3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-08 10:25:18 +00:00

fix #2965, fix #2968: bugs in domsimplify on cache usage and boolean trial propagation

This commit is contained in:
Nuno Lopes 2020-02-10 10:56:36 +00:00
parent 524434cfbb
commit feba007696
2 changed files with 9 additions and 2 deletions

View file

@ -237,7 +237,8 @@ expr_ref dom_simplify_tactic::simplify_ite(app * ite) {
TRACE("simplify", tout << new_c << "\n" << new_t << "\n" << new_e << "\n";);
r = m.mk_ite(new_c, new_t, new_e);
}
}
}
reset_cache();
return r;
}
@ -281,7 +282,12 @@ expr_ref dom_simplify_tactic::simplify_rec(expr * e0) {
if (is_app(e)) {
m_args.reset();
for (expr* arg : *to_app(e)) {
m_args.push_back(simplify_arg(arg));
// we don't have a way to distinguish between e.g.
// ite(c, f(c), foo) (which should go to ite(c, f(true), foo))
// from and(or(x, y), f(x)), where we do a "trial" with x=false
// Trials are good for boolean formula simplification but not sound
// for fn applications.
m_args.push_back(m.is_bool(arg) ? arg : simplify_arg(arg));
}
r = m.mk_app(to_app(e)->get_decl(), m_args.size(), m_args.c_ptr());
}

View file

@ -114,6 +114,7 @@ class dom_simplify_tactic : public tactic {
expr_ref get_cached(expr* t) { expr* r = nullptr; if (!m_result.find(t, r)) r = t; return expr_ref(r, m); }
void cache(expr *t, expr* r) { m_result.insert(t, r); m_trail.push_back(r); }
void reset_cache() { m_result.reset(); }
ptr_vector<expr> const & tree(expr * e);
expr* idom(expr *e) const { return m_dominators.idom(e); }