3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-06 17:44:08 +00:00

add propagation flag to monic and method for updating it to emonics. This replaces the bool-vector tracking for propagation and internalizes it to the emonics class

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2023-09-26 20:52:34 -07:00
parent 9c63ea3135
commit aaa587398e
3 changed files with 21 additions and 0 deletions

View file

@ -595,4 +595,20 @@ bool emonics::invariant() const {
return true;
}
void emonics::set_propagated(monic& m) {
struct set_unpropagated : public trail {
emonics& em;
unsigned var;
public:
set_unpropagated(emonics& em, unsigned var): em(em), var(var) {}
void undo() override {
em[var].set_propagated(false);
}
};
SASSERT(!m.is_propagated());
m.set_propagated(true);
m_u_f_stack.push(set_unpropagated(*this, m.var()));
}
}

View file

@ -142,6 +142,8 @@ public:
void merge_eh(unsigned r2, unsigned r1, unsigned v2, unsigned v1) {}
void after_merge_eh(unsigned r2, unsigned r1, unsigned v2, unsigned v1) {}
void set_propagated(monic& m);
// this method is required by union_find
trail_stack & get_trail_stack() { return m_u_f_stack; }

View file

@ -58,6 +58,7 @@ class monic: public mon_eq {
svector<lpvar> m_rvars;
bool m_rsign;
mutable unsigned m_visited;
bool m_propagated = false;
public:
// constructors
monic(lpvar v, unsigned sz, lpvar const* vs, unsigned idx):
@ -74,6 +75,8 @@ public:
void reset_rfields() { m_rsign = false; m_rvars.reset(); SASSERT(m_rvars.size() == 0); }
void push_rvar(signed_var sv) { m_rsign ^= sv.sign(); m_rvars.push_back(sv.var()); }
void sort_rvars() { std::sort(m_rvars.begin(), m_rvars.end()); }
void set_propagated(bool p) { m_propagated = p; }
bool is_propagated() const { return m_propagated; }
svector<lpvar>::const_iterator begin() const { return vars().begin(); }
svector<lpvar>::const_iterator end() const { return vars().end(); }