mirror of
https://github.com/Z3Prover/z3
synced 2025-04-27 19:05:51 +00:00
make sure that the returned cross nested form is equal to the original
Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
This commit is contained in:
parent
41064f2b25
commit
4e59976c2f
2 changed files with 27 additions and 4 deletions
|
@ -43,6 +43,9 @@ class cross_nested {
|
|||
std::unordered_map<lpvar, unsigned> m_powers;
|
||||
ptr_vector<nex> m_allocated;
|
||||
ptr_vector<nex> m_b_split_vec;
|
||||
#ifdef Z3DEBUG
|
||||
nex* m_e_clone;
|
||||
#endif
|
||||
public:
|
||||
cross_nested(std::function<bool (const nex*)> call_on_result,
|
||||
std::function<bool (unsigned)> var_is_fixed):
|
||||
|
@ -53,7 +56,10 @@ public:
|
|||
|
||||
void run(nex *e) {
|
||||
m_e = e;
|
||||
|
||||
#ifdef Z3DEBUG
|
||||
m_e_clone = clone(m_e);
|
||||
m_e_clone = normalize(m_e_clone);
|
||||
#endif
|
||||
vector<nex**> front;
|
||||
explore_expr_on_front_elem(&m_e, front);
|
||||
}
|
||||
|
@ -337,6 +343,13 @@ public:
|
|||
if(front.empty()) {
|
||||
TRACE("nla_cn", tout << "got the cn form: =" << *m_e << "\n";);
|
||||
m_done = m_call_on_result(m_e);
|
||||
#ifdef Z3DEBUG
|
||||
nex *ce = clone(m_e);
|
||||
TRACE("nla_cn", tout << "ce = " << *ce << "\n";);
|
||||
nex *n = normalize(ce);
|
||||
TRACE("nla_cn", tout << "n = " << *n << "\nm_e_clone=" << * m_e_clone << "\n";);
|
||||
SASSERT(*n == *m_e_clone);
|
||||
#endif
|
||||
} else {
|
||||
nex** f = pop_front(front);
|
||||
explore_expr_on_front_elem(f, front);
|
||||
|
@ -619,7 +632,9 @@ public:
|
|||
if ((int)j != sum_j)
|
||||
b->add_child(a->children()[j]);
|
||||
}
|
||||
}
|
||||
b->simplify();
|
||||
}
|
||||
TRACE("nla_cn", tout << *r << "\n";);
|
||||
return normalize_sum(r);
|
||||
}
|
||||
|
||||
|
@ -635,8 +650,9 @@ public:
|
|||
r = normalize_sum(to_sum(a));
|
||||
}
|
||||
r->sort();
|
||||
return r;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue