3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-07-22 12:22:05 +00:00

user propagator over the API

This commit is contained in:
Nikolaj Bjorner 2020-08-18 21:52:52 -07:00
parent c50e869e5a
commit 4857d60c99
13 changed files with 141 additions and 63 deletions

View file

@ -32,6 +32,7 @@ namespace smt {
std::function<void(void*, unsigned, expr*)> m_fixed_eh;
std::function<void(void*)> m_push_eh;
std::function<void(void*, unsigned)> m_pop_eh;
std::function<void*(void*)> m_fresh_eh;
struct prop_info {
unsigned_vector m_ids;
expr_ref m_conseq;
@ -44,6 +45,9 @@ namespace smt {
vector<prop_info> m_prop;
unsigned_vector m_prop_lim;
vector<literal_vector> m_id2justification;
unsigned m_num_scopes;
void force_push();
public:
user_propagator(context& ctx);
@ -57,11 +61,13 @@ namespace smt {
void* ctx,
std::function<void(void*, unsigned, expr*)>& fixed_eh,
std::function<void(void*)>& push_eh,
std::function<void(void*, unsigned)>& pop_eh) {
std::function<void(void*, unsigned)>& pop_eh,
std::function<void*(void*)>& fresh_eh) {
m_user_context = ctx;
m_fixed_eh = fixed_eh;
m_push_eh = push_eh;
m_pop_eh = pop_eh;
m_fresh_eh = fresh_eh;
}
unsigned add_expr(expr* e);
@ -72,16 +78,21 @@ namespace smt {
void new_fixed_eh(theory_var v, expr* value, unsigned num_lits, literal const* jlits);
theory * mk_fresh(context * new_ctx) override { UNREACHABLE(); return alloc(user_propagator, *new_ctx); }
theory * mk_fresh(context * new_ctx) override {
auto* th = alloc(user_propagator, *new_ctx);
void* ctx = m_fresh_eh(m_user_context);
th->add(ctx, m_fixed_eh, m_push_eh, m_pop_eh, m_fresh_eh);
return th;
}
bool internalize_atom(app * atom, bool gate_ctx) override { UNREACHABLE(); return false; }
bool internalize_term(app * term) override { UNREACHABLE(); return false; }
void new_eq_eh(theory_var v1, theory_var v2) override { UNREACHABLE(); }
void new_diseq_eh(theory_var v1, theory_var v2) override { UNREACHABLE(); }
void new_eq_eh(theory_var v1, theory_var v2) override { }
void new_diseq_eh(theory_var v1, theory_var v2) override { }
bool use_diseqs() const override { return false; }
bool build_models() const override { return false; }
final_check_status final_check_eh() override { UNREACHABLE(); return FC_DONE; }
final_check_status final_check_eh() override { return FC_DONE; }
void reset_eh() override {}
void assign_eh(bool_var v, bool is_true) override { UNREACHABLE(); }
void assign_eh(bool_var v, bool is_true) override { }
void init_search_eh() override {}
void push_scope_eh() override;
void pop_scope_eh(unsigned num_scopes) override;