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

port equality propagation changes to new core

This commit is contained in:
Nikolaj Bjorner 2021-03-28 16:15:04 -07:00
parent 0432311b11
commit 974ef3c147
5 changed files with 57 additions and 9 deletions

View file

@ -496,6 +496,7 @@ namespace arith {
vi = lp().add_var(v, a.is_int(term));
add_def_constraint_and_equality(vi, lp::GE, st.offset());
add_def_constraint_and_equality(vi, lp::LE, st.offset());
register_fixed_var(v, st.offset());
return v;
}
if (!st.offset().is_zero()) {
@ -674,5 +675,24 @@ namespace arith {
return false;
}
struct solver::undo_value : public trail {
solver& s;
undo_value(solver& s):s(s) {}
void undo() override {
s.m_value2var.erase(s.m_fixed_values.back());
s.m_fixed_values.pop_back();
}
};
void solver::register_fixed_var(theory_var v, rational const& value) {
if (m_value2var.contains(value))
return;
m_fixed_values.push_back(value);
m_value2var.insert(value, v);
ctx.push(undo_value(*this));
}
}