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

fixes in nex expressions simplifications

Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
This commit is contained in:
Lev Nachmanson 2019-10-18 14:24:20 -07:00
parent 7fbf3e0707
commit 64b189d932
6 changed files with 207 additions and 45 deletions

View file

@ -162,6 +162,13 @@ public:
friend std::ostream& operator<<(std::ostream& out, const nex_pow & p) { out << p.to_string(); return out; }
};
inline unsigned get_degree_children(const vector<nex_pow>& children) {
int degree = 0;
for (const auto& p : children) {
degree += p.e()->get_degree() * p.pow();
}
return degree;
}
class nex_mul : public nex {
rational m_coeff;
@ -169,6 +176,9 @@ class nex_mul : public nex {
public:
nex_mul() : m_coeff(rational(1)) {}
template <typename T>
nex_mul() : m_coeff() {}
const rational& coeff() const {
return m_coeff;
}
@ -258,13 +268,9 @@ public:
}
int get_degree() const {
int degree = 0;
for (const auto& p : *this) {
degree += p.e()->get_degree() * p.pow();
}
return degree;
}
return get_degree_children(children());
}
bool is_linear() const {
return get_degree() < 2; // todo: make it more efficient
}