3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-29 11:55:51 +00:00

out of memory in horner::split_with_var()

Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
This commit is contained in:
Lev Nachmanson 2019-07-02 17:00:15 -07:00
parent 7bac714762
commit d7265ab4d0
5 changed files with 94 additions and 25 deletions

View file

@ -207,19 +207,29 @@ public:
return m_j == j;
if (is_mul()) {
for (const nla_expr<T>& c : children()) {
if (c.is_var() && c.var() == j) return true;
if (c.contains(j))
return true;
}
}
return false;
}
}
};
template <typename T>
nla_expr<T> operator/(const nla_expr<T>& a, lpvar j) {
SASSERT(a.is_mul());
SASSERT((a.is_mul() && a.contains(j)) || (a.is_var() && a.var() == j));
if (a.is_var())
return nla_expr<T>::scalar(T(1));
nla_expr<T> b;
bool seenj = false;
for (const nla_expr<T>& c : a.children()) {
if (c.is_var() && c.var() == j) continue;
if (!seenj) {
if (c.contains(j)) {
if (!c.is_var())
b.add_child(c / j);
seenj = true;
continue;
}
}
b.add_child(c);
}
if (b.children().size() > 1) {