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

fixes in nex expressions

Signed-off-by: Lev Nachmanson <levnach@hotmail.com>
This commit is contained in:
Lev Nachmanson 2019-10-03 14:31:45 -07:00
parent 3929e002a5
commit f9beef19ce
4 changed files with 60 additions and 45 deletions

View file

@ -398,5 +398,33 @@ inline bool less_than_nex_standard(const nex* a, const nex* b) {
lt_on_vars lt = [](lpvar j, lpvar k) { return j < k; };
return less_than_nex(a, b, lt);
}
inline std::unordered_set<lpvar> get_vars_of_expr(const nex *e ) {
std::unordered_set<lpvar> r;
switch (e->type()) {
case expr_type::SCALAR:
return r;
case expr_type::SUM:
{
for (auto c: *to_sum(e))
for ( lpvar j : get_vars_of_expr(c))
r.insert(j);
}
case expr_type::MUL:
{
for (auto &c: *to_mul(e))
for ( lpvar j : get_vars_of_expr(c.e()))
r.insert(j);
}
return r;
case expr_type::VAR:
r.insert(to_var(e)->var());
return r;
default:
TRACE("nla_cn_details", tout << e->type() << "\n";);
SASSERT(false);
return r;
}
}
}