mirror of
https://github.com/Z3Prover/z3
synced 2025-08-22 19:17:53 +00:00
experimental feature to access congruence closure of SimpleSolver
This update includes an experimental feature to access a congruence closure data-structure after search. It comes with several caveats as pre-processing is free to eliminate terms. It is therefore necessary to use a solver that does not eliminate the terms you want to track for congruence of. This is partially addressed by using SimpleSolver or incremental mode solving. ```python from z3 import * s = SimpleSolver() x, y, z = Ints('x y z') s.add(x == y) s.add(y == z) s.check() print(s.root(x), s.root(y), s.root(z)) print(s.next(x), s.next(y), s.next(z)) ```
This commit is contained in:
parent
c0f1f33898
commit
f6d411d54b
21 changed files with 145 additions and 12 deletions
|
@ -24,6 +24,7 @@ protected:
|
|||
ast_manager& m;
|
||||
std::function<bool(expr*)> m_is_var;
|
||||
generic_model_converter_ref m_mc;
|
||||
bool m_produce_proofs = false;
|
||||
|
||||
bool uncnstr(expr* e) const { return m_is_var(e); }
|
||||
bool uncnstr(unsigned num, expr * const * args) const;
|
||||
|
@ -37,8 +38,9 @@ public:
|
|||
virtual ~iexpr_inverter() {}
|
||||
virtual void set_is_var(std::function<bool(expr*)>& is_var) { m_is_var = is_var; }
|
||||
virtual void set_model_converter(generic_model_converter* mc) { m_mc = mc; }
|
||||
virtual void set_produce_proofs(bool p) { m_produce_proofs = true; }
|
||||
|
||||
virtual bool operator()(func_decl* f, unsigned n, expr* const* args, expr_ref& new_expr, expr_ref& side_cond) = 0;
|
||||
virtual bool operator()(func_decl* f, unsigned n, expr* const* args, expr_ref& new_expr, proof_ref& pr) = 0;
|
||||
virtual bool mk_diff(expr* t, expr_ref& r) = 0;
|
||||
virtual family_id get_fid() const = 0;
|
||||
};
|
||||
|
@ -49,9 +51,10 @@ class expr_inverter : public iexpr_inverter {
|
|||
public:
|
||||
expr_inverter(ast_manager& m);
|
||||
~expr_inverter() override;
|
||||
bool operator()(func_decl* f, unsigned n, expr* const* args, expr_ref& new_expr, expr_ref& side_cond) override;
|
||||
bool operator()(func_decl* f, unsigned n, expr* const* args, expr_ref& new_expr, proof_ref& pr) override;
|
||||
bool mk_diff(expr* t, expr_ref& r) override;
|
||||
void set_is_var(std::function<bool(expr*)>& is_var) override;
|
||||
void set_model_converter(generic_model_converter* mc) override;
|
||||
void set_produce_proofs(bool p) override;
|
||||
family_id get_fid() const override { return null_family_id; }
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue