3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-08-09 04:31:24 +00:00

remove simplify dependencies

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2017-08-25 23:56:09 -07:00
parent 9438ff848f
commit ac0bb6a3d0
11 changed files with 108 additions and 45 deletions

View file

@ -52,4 +52,37 @@ public:
void cleanup();
};
class scoped_expr_substitution {
expr_substitution& m_subst;
expr_ref_vector m_trail;
unsigned_vector m_trail_lim;
public:
scoped_expr_substitution(expr_substitution& s): m_subst(s), m_trail(s.m()) {}
~scoped_expr_substitution() {}
void insert(expr * s, expr * def, proof * def_pr = 0, expr_dependency * def_dep = 0) {
if (!m_subst.contains(s)) {
m_subst.insert(s, def, def_pr, def_dep);
m_trail.push_back(s);
}
}
void reset() { m_subst.reset(); m_trail.reset(); m_trail_lim.reset(); }
void push() { m_trail_lim.push_back(m_trail.size()); }
void pop(unsigned n) {
if (n > 0) {
unsigned new_sz = m_trail_lim.size() - n;
unsigned old_sz = m_trail_lim[new_sz];
for (unsigned i = old_sz; i < m_trail.size(); ++i) m_subst.erase(m_trail[i].get());
m_trail.resize(old_sz);
m_trail_lim.resize(new_sz);
}
}
bool empty() const { return m_subst.empty(); }
bool find(expr * s, expr * & def, proof * & def_pr) { return m_subst.find(s, def, def_pr); }
bool find(expr * s, expr * & def, proof * & def_pr, expr_dependency * & def_dep) { return m_subst.find(s, def, def_pr, def_dep); }
bool contains(expr * s) { return m_subst.contains(s); }
void cleanup() { m_subst.cleanup(); }
};
#endif