mirror of
https://github.com/Z3Prover/z3
synced 2025-06-22 22:03:39 +00:00
resolve
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
d13f1310a7
commit
2c6e6b1fdb
4 changed files with 75 additions and 9 deletions
|
@ -461,6 +461,30 @@ namespace dd {
|
|||
return is_binary(p.root);
|
||||
}
|
||||
|
||||
/*
|
||||
\brief determine if v occurs as a leaf variable.
|
||||
*/
|
||||
bool pdd_manager::var_is_leaf(PDD p, unsigned v) {
|
||||
init_mark();
|
||||
m_todo.push_back(p);
|
||||
while (!m_todo.empty()) {
|
||||
PDD r = m_todo.back();
|
||||
m_todo.pop_back();
|
||||
if (is_val(r) || is_marked(r)) continue;
|
||||
set_mark(r);
|
||||
if (var(r) == v) {
|
||||
if (!is_val(lo(r)) || !is_val(hi(r))) {
|
||||
m_todo.reset();
|
||||
return false;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (!is_marked(lo(r))) m_todo.push_back(lo(r));
|
||||
if (!is_marked(hi(r))) m_todo.push_back(hi(r));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void pdd_manager::push(PDD b) {
|
||||
m_pdd_stack.push_back(b);
|
||||
}
|
||||
|
|
|
@ -203,6 +203,8 @@ namespace dd {
|
|||
unsigned dag_size(pdd const& p);
|
||||
unsigned degree(pdd const& p);
|
||||
|
||||
bool var_is_leaf(PDD p, unsigned v);
|
||||
|
||||
bool is_reachable(PDD p);
|
||||
void compute_reachable(svector<bool>& reachable);
|
||||
void try_gc();
|
||||
|
@ -291,9 +293,9 @@ namespace dd {
|
|||
bool is_zero() const { return m.is_zero(root); }
|
||||
bool is_linear() const { return m.is_linear(root); }
|
||||
bool is_binary() const { return m.is_binary(root); }
|
||||
bool var_is_leaf(unsigned v) const { return m.var_is_leaf(root, v); }
|
||||
|
||||
pdd minus() const { return m.minus(*this); }
|
||||
pdd operator-() const { return m.minus(*this); }
|
||||
pdd operator+(pdd const& other) const { return m.add(*this, other); }
|
||||
pdd operator-(pdd const& other) const { return m.sub(*this, other); }
|
||||
pdd operator*(pdd const& other) const { return m.mul(*this, other); }
|
||||
|
@ -317,11 +319,11 @@ namespace dd {
|
|||
inline pdd operator*(int x, pdd const& b) { return b * rational(x); }
|
||||
inline pdd operator*(pdd const& b, int x) { return b * rational(x); }
|
||||
|
||||
inline pdd operator+(rational const& r, const pdd& b) { return b + r; }
|
||||
inline pdd operator+(rational const& r, pdd const& b) { return b + r; }
|
||||
inline pdd operator+(int x, pdd const& b) { return b + rational(x); }
|
||||
inline pdd operator+(pdd const& b, int x) { return b + rational(x); }
|
||||
|
||||
inline pdd operator-(rational const& r, pdd const& b) { return r + (-b); }
|
||||
inline pdd operator-(rational const& r, pdd const& b) { return r + b.minus(); }
|
||||
inline pdd operator-(int x, pdd const& b) { return rational(x) - b; }
|
||||
inline pdd operator-(pdd const& b, int x) { return b + (-rational(x)); }
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue