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

fixes in nla_expr operators and delete m_reported

Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
This commit is contained in:
Lev Nachmanson 2019-07-18 11:05:12 -07:00
parent 5cc3812aa9
commit cef9726f00
3 changed files with 20 additions and 15 deletions

View file

@ -396,6 +396,11 @@ public:
nla_expr& operator/=(const nla_expr& b) {
TRACE("nla_cn_details", tout << *this <<", " << b << "\n";);
if (b.is_var()) {
*this = (*this) / b.var();
return *this;
}
SASSERT(b.is_mul());
if (is_sum()) {
for (auto & e : children()) {
@ -403,6 +408,10 @@ public:
}
return *this;
}
if (is_var()) {
*this = scalar(T(1));
return *this;
}
SASSERT(is_mul());
auto powers = b.get_powers_from_mul();
unsigned i = 0, k = 0;
@ -496,6 +505,7 @@ nla_expr<T> operator*(const nla_expr<T>& a, const nla_expr<T>& b) {
template <typename T>
nla_expr<T> operator/(const nla_expr<T>& a, lpvar j) {
TRACE("nla_cn_details", tout << "a=" << a << ", v" << j << "\n";);
SASSERT((a.is_mul() && a.contains(j)) || (a.is_var() && a.var() == j));
if (a.is_var())
return nla_expr<T>::scalar(T(1));
@ -514,8 +524,11 @@ nla_expr<T> operator/(const nla_expr<T>& a, lpvar j) {
}
if (b.children().size() > 1) {
b.type() = expr_type::MUL;
} else if (b.children().size() == 1) {
auto t = b.children()[0];
b = t;
} else {
b = b.children()[0];
b = nla_expr<T>::scalar(T(1));
}
return b;
}