mirror of
https://github.com/Z3Prover/z3
synced 2025-04-12 04:03:39 +00:00
change user propagation to apply scheme similar to theory_recfun
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
3c1aedf219
commit
4daba290b1
|
@ -53,7 +53,7 @@ void theory_user_propagator::propagate_cb(
|
||||||
unsigned num_eqs, unsigned const* eq_lhs, unsigned const* eq_rhs,
|
unsigned num_eqs, unsigned const* eq_lhs, unsigned const* eq_rhs,
|
||||||
expr* conseq) {
|
expr* conseq) {
|
||||||
CTRACE("user_propagate", ctx.lit_internalized(conseq) && ctx.get_assignment(ctx.get_literal(conseq)) == l_true,
|
CTRACE("user_propagate", ctx.lit_internalized(conseq) && ctx.get_assignment(ctx.get_literal(conseq)) == l_true,
|
||||||
tout << "redundant consequence: " << mk_pp(conseq, m) << " relevant " << ctx.is_relevant(ctx.get_literal(conseq)) << "\n");
|
tout << "redundant consequence: " << mk_pp(conseq, m) << "\n");
|
||||||
if (ctx.lit_internalized(conseq) && ctx.get_assignment(ctx.get_literal(conseq)) == l_true)
|
if (ctx.lit_internalized(conseq) && ctx.get_assignment(ctx.get_literal(conseq)) == l_true)
|
||||||
return;
|
return;
|
||||||
m_prop.push_back(prop_info(num_fixed, fixed_ids, num_eqs, eq_lhs, eq_rhs, expr_ref(conseq, m)));
|
m_prop.push_back(prop_info(num_fixed, fixed_ids, num_eqs, eq_lhs, eq_rhs, expr_ref(conseq, m)));
|
||||||
|
@ -130,10 +130,10 @@ void theory_user_propagator::propagate() {
|
||||||
for (auto const& p : prop.m_eqs)
|
for (auto const& p : prop.m_eqs)
|
||||||
m_eqs.push_back(enode_pair(get_enode(p.first), get_enode(p.second)));
|
m_eqs.push_back(enode_pair(get_enode(p.first), get_enode(p.second)));
|
||||||
DEBUG_CODE(for (auto const& p : m_eqs) VERIFY(p.first->get_root() == p.second->get_root()););
|
DEBUG_CODE(for (auto const& p : m_eqs) VERIFY(p.first->get_root() == p.second->get_root()););
|
||||||
DEBUG_CODE(for (unsigned id : prop.m_ids) VERIFY(m_fixed.contains(id)););
|
DEBUG_CODE(for (unsigned id : prop.m_ids) VERIFY(m_fixed.contains(id)););
|
||||||
DEBUG_CODE(for (literal lit : m_lits) VERIFY(ctx.get_assignment(lit) == l_true););
|
DEBUG_CODE(for (literal lit : m_lits) VERIFY(ctx.get_assignment(lit) == l_true););
|
||||||
|
|
||||||
TRACE("user_propagate", tout << "propagating: " << prop.m_conseq << "\n");
|
TRACE("user_propagate", tout << "propagating #" << prop.m_conseq->get_id() << ": " << prop.m_conseq << "\n");
|
||||||
|
|
||||||
if (m.is_false(prop.m_conseq)) {
|
if (m.is_false(prop.m_conseq)) {
|
||||||
js = ctx.mk_justification(
|
js = ctx.mk_justification(
|
||||||
|
@ -142,11 +142,25 @@ void theory_user_propagator::propagate() {
|
||||||
ctx.set_conflict(js);
|
ctx.set_conflict(js);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
literal lit = mk_literal(prop.m_conseq);
|
for (auto& lit : m_lits)
|
||||||
js = ctx.mk_justification(
|
lit.neg();
|
||||||
ext_theory_propagation_justification(
|
for (auto const& [a,b] : m_eqs)
|
||||||
get_id(), ctx.get_region(), m_lits.size(), m_lits.data(), m_eqs.size(), m_eqs.data(), lit));
|
m_lits.push_back(~mk_eq(a->get_expr(), b->get_expr(), false));
|
||||||
ctx.assign(lit, js);
|
literal lit;
|
||||||
|
if (has_quantifiers(prop.m_conseq)) {
|
||||||
|
expr_ref fn(m.mk_fresh_const("user-conseq", m.mk_bool_sort()), m);
|
||||||
|
expr_ref eq(m.mk_eq(fn, prop.m_conseq), m);
|
||||||
|
ctx.assert_expr(eq);
|
||||||
|
ctx.internalize_assertions();
|
||||||
|
lit = mk_literal(fn);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
lit = mk_literal(prop.m_conseq);
|
||||||
|
}
|
||||||
|
ctx.mark_as_relevant(lit);
|
||||||
|
m_lits.push_back(lit);
|
||||||
|
ctx.mk_th_axiom(get_id(), m_lits);
|
||||||
|
TRACE("user_propagate", ctx.display(tout););
|
||||||
}
|
}
|
||||||
++m_stats.m_num_propagations;
|
++m_stats.m_num_propagations;
|
||||||
++qhead;
|
++qhead;
|
||||||
|
|
Loading…
Reference in a new issue