3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-07-19 10:52:02 +00:00
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2019-12-26 02:30:12 -08:00
parent d13f1310a7
commit 2c6e6b1fdb
4 changed files with 75 additions and 9 deletions

View file

@ -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);
}