3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-08-20 18:20:22 +00:00

overhaul of proof format for new solver

This commit overhauls the proof format (in development) for the new core.

NOTE: this functionality is work in progress with a long way to go.
It is shielded by the sat.euf option, which is off by default and in pre-release state.
It is too early to fuzz or use it. It is pushed into master to shed light on road-map for certifying inferences of sat.euf.

It retires the ad-hoc extension of DRUP used by the SAT solver.
Instead it relies on SMT with ad-hoc extensions for proof terms.
It adds the following commands (consumed by proof_cmds.cpp):

- assume  - for input clauses
- learn   - when a clause is learned (or redundant clause is added)
- del     - when a clause is deleted.

The commands take a list of expressions of type Bool and the
last argument can optionally be of type Proof.
When the last argument is of type Proof it is provided as a hint
to justify the learned clause.

Proof hints can be checked using a self-contained proof
checker. The sat/smt/euf_proof_checker.h class provides
a plugin dispatcher for checkers.
It is instantiated with a checker for arithmetic lemmas,
so far for Farkas proofs.

Use example:
```
(set-option :sat.euf true)
(set-option :tactic.default_tactic smt)
(set-option :sat.smt.proof f.proof)
(declare-const x Int)
(declare-const y Int)
(declare-const z Int)
(declare-const u Int)
(assert (< x y))
(assert (< y z))
(assert (< z x))
(check-sat)
```

Run z3 on a file with above content.
Then run z3 on f.proof

```
(verified-smt)
(verified-smt)
(verified-smt)
(verified-farkas)
(verified-smt)
```
This commit is contained in:
Nikolaj Bjorner 2022-08-28 17:44:33 -07:00
parent 9922c766b9
commit e2f4fc2307
37 changed files with 809 additions and 1078 deletions

View file

@ -60,8 +60,8 @@ namespace sat {
class justification;
class clause;
struct print_clause {
virtual ~print_clause() {}
struct clause_eh {
virtual ~clause_eh() {}
virtual void on_clause(unsigned, literal const*, status) = 0;
};
@ -78,7 +78,7 @@ namespace sat {
watched_clause(clause* c, literal l1, literal l2):
m_clause(c), m_l1(l1), m_l2(l2) {}
};
print_clause* m_print_clause = nullptr;
clause_eh* m_clause_eh = nullptr;
svector<watched_clause> m_watched_clauses;
typedef svector<unsigned> watch;
solver& s;
@ -95,7 +95,6 @@ namespace sat {
bool m_check_sat = false;
bool m_check = false;
bool m_activity = false;
bool m_trim = false;
stats m_stats;
@ -145,17 +144,10 @@ namespace sat {
void add(literal_vector const& c); // add learned clause
void add(unsigned sz, literal const* lits, status st);
void set_print_clause(print_clause& print_clause) {
m_print_clause = &print_clause;
}
void set_clause_eh(clause_eh& clause_eh) { m_clause_eh = &clause_eh; }
// support for SMT - connect Boolean variables with AST nodes
// associate AST node id with Boolean variable v
// declare AST node n with 'name' and arguments arg
std::ostream* out() { return m_out; }
bool is_cleaned(clause& c) const;
void del(literal l);
void del(literal l1, literal l2);
@ -181,8 +173,6 @@ namespace sat {
svector<std::pair<literal, clause*>> const& units() { return m_units; }
bool is_drup(unsigned n, literal const* c, literal_vector& units);
solver& get_solver() { return s; }
svector<std::pair<clause&, status>> trim();
};