3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-23 09:05:31 +00:00

add ability to register expressions during callback

This commit is contained in:
Nikolaj Bjorner 2021-12-07 09:47:05 -08:00
parent 50d50cdb48
commit 1e95fb44d1
9 changed files with 44 additions and 2 deletions

View file

@ -346,6 +346,15 @@ public:
}
cb->propagate_cb(num_fixed, fixed.data(), num_eqs, lhs.data(), rhs.data(), conseq);
}
unsigned register_cb(expr* e) override {
unsigned j = t->m_vars.size();
t->m_vars.push_back(e);
unsigned i = cb->register_cb(e);
t->m_var2internal.setx(j, i, 0);
t->m_internal2var.setx(i, j, 0);
return j;
}
};
callback i_cb;

View file

@ -59,6 +59,10 @@ void theory_user_propagator::propagate_cb(
m_prop.push_back(prop_info(num_fixed, fixed_ids, num_eqs, eq_lhs, eq_rhs, expr_ref(conseq, m)));
}
unsigned theory_user_propagator::register_cb(expr* e) {
return add_expr(e);
}
theory * theory_user_propagator::mk_fresh(context * new_ctx) {
auto* th = alloc(theory_user_propagator, *new_ctx);
void* ctx = m_fresh_eh(m_user_context, new_ctx->get_manager(), th->m_api_context);

View file

@ -98,6 +98,7 @@ namespace smt {
bool has_fixed() const { return (bool)m_fixed_eh; }
void propagate_cb(unsigned num_fixed, unsigned const* fixed_ids, unsigned num_eqs, unsigned const* lhs, unsigned const* rhs, expr* conseq) override;
unsigned register_cb(expr* e) override;
void new_fixed_eh(theory_var v, expr* value, unsigned num_lits, literal const* jlits);