3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-30 04:15:51 +00:00

delay (lazy) process equalities.

This commit is contained in:
Nikolaj Bjorner 2021-03-17 15:34:04 -07:00
parent ddbcd08d46
commit 156139622c
3 changed files with 49 additions and 20 deletions

View file

@ -304,7 +304,7 @@ namespace arith {
return lp::EQ;
}
void solver::mk_eq_axiom(bool is_eq, euf::th_eq const& e) {
void solver::new_eq_eh(euf::th_eq const& e) {
theory_var v1 = e.v1();
theory_var v2 = e.v2();
if (is_bool(v1))
@ -316,23 +316,35 @@ namespace arith {
if (e1->get_id() > e2->get_id())
std::swap(e1, e2);
if (is_eq && m.are_equal(e1, e2))
if (m.are_equal(e1, e2))
return;
if (!is_eq && m.are_distinct(e1, e2))
return;
if (is_eq) {
++m_stats.m_assert_eq;
m_new_eq = true;
euf::enode* n1 = var2enode(v1);
euf::enode* n2 = var2enode(v2);
lpvar w1 = register_theory_var_in_lar_solver(v1);
lpvar w2 = register_theory_var_in_lar_solver(v2);
auto cs = lp().add_equality(w1, w2);
add_eq_constraint(cs.first, n1, n2);
add_eq_constraint(cs.second, n1, n2);
++m_stats.m_assert_eq;
m_new_eq = true;
euf::enode* n1 = var2enode(v1);
euf::enode* n2 = var2enode(v2);
lpvar w1 = register_theory_var_in_lar_solver(v1);
lpvar w2 = register_theory_var_in_lar_solver(v2);
auto cs = lp().add_equality(w1, w2);
add_eq_constraint(cs.first, n1, n2);
add_eq_constraint(cs.second, n1, n2);
}
void solver::new_diseq_eh(euf::th_eq const& e) {
m_delayed_eqs.push_back(std::make_pair(e, false));
ctx.push(push_back_vector<svector<std::pair<euf::th_eq, bool>>>(m_delayed_eqs));
}
void solver::mk_diseq_axiom(euf::th_eq const& e) {
if (is_bool(e.v1()))
return;
}
force_push();
expr* e1 = var2expr(e.v1());
expr* e2 = var2expr(e.v2());
if (e1->get_id() > e2->get_id())
std::swap(e1, e2);
if (m.are_distinct(e1, e2))
return;
literal le, ge;
if (a.is_numeral(e1))
std::swap(e1, e2);
@ -347,9 +359,7 @@ namespace arith {
expr_ref zero(a.mk_numeral(rational(0), a.is_int(e1)), m);
rewrite(diff);
if (a.is_numeral(diff)) {
if (is_eq && a.is_zero(diff))
return;
if (!is_eq && !a.is_zero(diff))
if (!a.is_zero(diff))
return;
if (a.is_zero(diff))
add_unit(eq);