3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-10 03:07:07 +00:00
z3/src/sat/smt/tseitin_proof_checker.h
Nikolaj Bjorner ac1552d194 wip - updates to proof logging and self-checking
move self-checking functionality to inside sat/smt so it can be used on-line and not just off-line.

when self-validation fails, use vs, not clause, to check. It allows self-validation without checking and maintaining RUP validation.

new options sat.smt.proof.check_rup, sat.smt.proof.check for online validation.

z3 sat.smt.proof.check=true sat.euf=true /v:1 sat.smt.proof.check_rup=true /st file.smt2 sat.smt.proof=p.smt2
2022-10-16 23:33:30 +02:00

75 lines
1.6 KiB
C++

/*++
Copyright (c) 2022 Microsoft Corporation
Module Name:
tseitin_proof_checker.h
Abstract:
Plugin for checking quantifier instantiations
Author:
Nikolaj Bjorner (nbjorner) 2022-10-07
--*/
#pragma once
#include "util/obj_pair_set.h"
#include "ast/ast_trail.h"
#include "ast/ast_util.h"
#include "sat/smt/euf_proof_checker.h"
#include <iostream>
namespace tseitin {
class theory_checker : public euf::theory_checker_plugin {
ast_manager& m;
expr_fast_mark1 m_mark;
expr_fast_mark2 m_nmark;
bool equiv(expr* a, expr* b);
void mark(expr* a) { m_mark.mark(a); }
bool is_marked(expr* a) { return m_mark.is_marked(a); }
void nmark(expr* a) { m_nmark.mark(a); }
bool is_nmarked(expr* a) { return m_nmark.is_marked(a); }
void complement_mark(expr* a) {
m_mark.mark(a);
if (m.is_not(a, a))
m_nmark.mark(a);
}
bool is_complement(expr* a) {
if (m.is_not(a, a))
return is_marked(a);
else
return is_nmarked(a);
}
struct scoped_mark {
theory_checker& pc;
scoped_mark(theory_checker& pc): pc(pc) {}
~scoped_mark() { pc.m_mark.reset(); pc.m_nmark.reset(); }
};
public:
theory_checker(ast_manager& m):
m(m) {
}
expr_ref_vector clause(app* jst) override;
bool check(app* jst) override;
void register_plugins(euf::theory_checker& pc) override {
pc.register_plugin(symbol("tseitin"), this);
}
};
}