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

simplify nex_creator

Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
This commit is contained in:
Lev Nachmanson 2019-10-03 10:08:32 -07:00
parent e81318f8fd
commit eb3a5056b8
3 changed files with 31 additions and 14 deletions

View file

@ -191,6 +191,21 @@ public:
void add_child(nex* e) {
add_child_in_power(e, 1);
}
// returns true if the product of scalars gives a number different from 1
bool has_a_coeff() const {
rational r(1);
for (auto & p : *this) {
if (p.e()->is_scalar())
r *= to_scalar(p.e())->value();
}
return !r.is_one();
}
const nex_pow* begin() const { return m_children.begin(); }
const nex_pow* end() const { return m_children.end(); }
nex_pow* begin() { return m_children.begin(); }
nex_pow* end() { return m_children.end(); }
void add_child_in_power(nex* e, int power) { m_children.push_back(nex_pow(e, power)); }