mirror of
https://github.com/Z3Prover/z3
synced 2025-05-12 02:04:43 +00:00
force-push on new_eq, new_diseq in user propagator, other fixes to Python bindings for user propagator
This update allows the python bindings for user-propagator to handle functions that are declared to be registered with the user propagator plugin. It fixes a bug in UserPropagateBase.add to allow registering terms dynamically during search. It also fixes a bug in theory_user_propagate as scopes were not fully pushed when the solver gets the callbacks for new equalities and new disequalities. It also adds equality and disequality interfaces to the sat/smt solver version (which isn't being exercised in earnest yet)
This commit is contained in:
parent
3e38bbb009
commit
5c2c0ae900
7 changed files with 93 additions and 25 deletions
|
@ -146,7 +146,9 @@ final_check_status theory_user_propagator::final_check_eh() {
|
|||
catch (...) {
|
||||
throw default_exception("Exception thrown in \"final\"-callback");
|
||||
}
|
||||
CTRACE("user_propagate", can_propagate(), tout << "can propagate\n");
|
||||
propagate();
|
||||
CTRACE("user_propagate", ctx.inconsistent(), tout << "inconsistent\n");
|
||||
// check if it became inconsistent or something new was propagated/registered
|
||||
bool done = (sz1 == m_prop.size()) && (sz2 == m_expr2var.size()) && !ctx.inconsistent();
|
||||
return done ? FC_DONE : FC_CONTINUE;
|
||||
|
@ -298,13 +300,17 @@ void theory_user_propagator::propagate_consequence(prop_info const& prop) {
|
|||
m_eqs.reset();
|
||||
for (expr* id : prop.m_ids)
|
||||
m_lits.append(m_id2justification[expr2var(id)]);
|
||||
for (auto const& p : prop.m_eqs)
|
||||
m_eqs.push_back(enode_pair(get_enode(expr2var(p.first)), get_enode(expr2var(p.second))));
|
||||
DEBUG_CODE(for (auto const& p : m_eqs) VERIFY(p.first->get_root() == p.second->get_root()););
|
||||
for (auto const& [a,b] : prop.m_eqs)
|
||||
if (a != b)
|
||||
m_eqs.push_back(enode_pair(get_enode(expr2var(a)), get_enode(expr2var(b))));
|
||||
DEBUG_CODE(for (auto const& [a, b] : m_eqs) VERIFY(a->get_root() == b->get_root()););
|
||||
DEBUG_CODE(for (expr* e : prop.m_ids) VERIFY(m_fixed.contains(expr2var(e))););
|
||||
DEBUG_CODE(for (literal lit : m_lits) VERIFY(ctx.get_assignment(lit) == l_true););
|
||||
|
||||
TRACE("user_propagate", tout << "propagating #" << prop.m_conseq->get_id() << ": " << prop.m_conseq << "\n");
|
||||
TRACE("user_propagate", tout << "propagating #" << prop.m_conseq->get_id() << ": " << prop.m_conseq << "\n";
|
||||
for (auto const& [a,b] : m_eqs) tout << enode_pp(a, ctx) << " == " << enode_pp(b, ctx) << "\n";
|
||||
for (expr* e : prop.m_ids) tout << mk_pp(e, m) << "\n";
|
||||
for (literal lit : m_lits) tout << lit << "\n");
|
||||
|
||||
if (m.is_false(prop.m_conseq)) {
|
||||
js = ctx.mk_justification(
|
||||
|
@ -341,9 +347,9 @@ void theory_user_propagator::propagate_new_fixed(prop_info const& prop) {
|
|||
|
||||
|
||||
void theory_user_propagator::propagate() {
|
||||
TRACE("user_propagate", tout << "propagating queue head: " << m_qhead << " prop queue: " << m_prop.size() << "\n");
|
||||
if (m_qhead == m_prop.size() && m_to_add_qhead == m_to_add.size())
|
||||
return;
|
||||
TRACE("user_propagate", tout << "propagating queue head: " << m_qhead << " prop queue: " << m_prop.size() << "\n");
|
||||
force_push();
|
||||
|
||||
unsigned qhead = m_to_add_qhead;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue