3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-06-23 14:23:40 +00:00

wip - proof checker

This commit is contained in:
Nikolaj Bjorner 2022-10-12 09:34:45 +02:00
parent ace727ee0f
commit a2e0646eed
3 changed files with 16 additions and 13 deletions

View file

@ -42,6 +42,7 @@ Proof checker for clauses created during search.
#include "util/small_object_allocator.h" #include "util/small_object_allocator.h"
#include "ast/ast_util.h" #include "ast/ast_util.h"
#include "ast/ast_ll_pp.h"
#include "smt/smt_solver.h" #include "smt/smt_solver.h"
#include "sat/sat_solver.h" #include "sat/sat_solver.h"
#include "sat/sat_drat.h" #include "sat/sat_drat.h"
@ -181,9 +182,9 @@ public:
} }
m_solver->pop(1); m_solver->pop(1);
std::cout << "(verified-smt"; std::cout << "(verified-smt";
if (proof_hint) std::cout << " " << mk_pp(proof_hint, m); if (proof_hint) std::cout << " " << mk_bounded_pp(proof_hint, m, 4);
for (expr* arg : clause) for (expr* arg : clause)
std::cout << " " << mk_pp(arg, m); std::cout << " " << mk_bounded_pp(arg, m);
std::cout << ")\n"; std::cout << ")\n";
add_clause(clause); add_clause(clause);
} }

View file

@ -293,17 +293,13 @@ namespace euf {
} }
bool proof_checker::check(expr* e) { bool proof_checker::check(expr* e) {
if (m_checked_clauses.contains(e))
return true;
if (!e || !is_app(e)) if (!e || !is_app(e))
return false; return false;
if (m_checked_clauses.contains(e))
return true;
app* a = to_app(e); app* a = to_app(e);
proof_checker_plugin* p = nullptr; proof_checker_plugin* p = nullptr;
if (!m_map.find(a->get_decl()->get_name(), p)) return m_map.find(a->get_decl()->get_name(), p) && p->check(a);
return false;
if (!p->check(a))
return false;
return true;
} }
expr_ref_vector proof_checker::clause(expr* e) { expr_ref_vector proof_checker::clause(expr* e) {

View file

@ -234,9 +234,15 @@ namespace tseitin {
bool proof_checker::equiv(expr* a, expr* b) { bool proof_checker::equiv(expr* a, expr* b) {
if (a == b) if (a == b)
return true; return true;
expr* x, *y, *z, *u; if (!is_app(a) || !is_app(b))
if (m.is_eq(a, x, y) && m.is_eq(b, z, u))
return x == u && y == z;
return false; return false;
if (to_app(a)->get_decl() != to_app(b)->get_decl())
return false;
if (!to_app(a)->get_decl()->is_commutative())
return false;
if (to_app(a)->get_num_args() != 2)
return false;
return to_app(a)->get_arg(0) == to_app(b)->get_arg(1) &&
to_app(a)->get_arg(1) == to_app(b)->get_arg(0);
} }
} }