3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-08-19 01:32:17 +00:00

remove dependency on bool-rewriter in hoist rewriter

deal with regression reported in
cac5052685 (commitcomment-100606067)
and unit tests doc.cpp
This commit is contained in:
Nikolaj Bjorner 2023-02-14 17:48:02 -08:00
parent a976b781a0
commit c2fe76569f
4 changed files with 19 additions and 12 deletions

View file

@ -28,17 +28,23 @@ hoist_rewriter::hoist_rewriter(ast_manager & m, params_ref const & p):
}
expr_ref hoist_rewriter::mk_and(expr_ref_vector const& args) {
if (m_rewriter)
return m_rewriter->mk_and(args);
if (m_elim_and) {
expr_ref_vector negs(m);
for (expr* a : args)
if (m.is_false(a))
return expr_ref(m.mk_false(), m);
else if (m.is_true(a))
continue;
else
negs.push_back(::mk_not(m, a));
return expr_ref(::mk_not(m, mk_or(negs)), m);
}
else
return ::mk_and(args);
}
expr_ref hoist_rewriter::mk_or(expr_ref_vector const& args) {
if (false && m_rewriter)
return m_rewriter->mk_or(args);
else
return ::mk_or(args);
return ::mk_or(args);
}
br_status hoist_rewriter::mk_or(unsigned num_args, expr * const * es, expr_ref & result) {
@ -159,11 +165,11 @@ unsigned hoist_rewriter::mk_var(expr* e) {
expr_ref hoist_rewriter::hoist_predicates(obj_hashtable<expr> const& preds, unsigned num_args, expr* const* es) {
expr_ref result(m);
expr_ref_vector args(m), fmls(m);
expr_ref_vector args(m), args1(m), fmls(m);
for (unsigned i = 0; i < num_args; ++i) {
VERIFY(is_and(es[i], &m_args1));
VERIFY(is_and(es[i], &args1));
fmls.reset();
for (expr* e : m_args1)
for (expr* e : args1)
if (!preds.contains(e))
fmls.push_back(e);
args.push_back(mk_and(fmls));
@ -199,6 +205,7 @@ bool hoist_rewriter::is_and(expr * e, expr_ref_vector* args) {
args->reset();
for (expr* arg : *to_app(e))
args->push_back(::mk_not(m, arg));
TRACE("hoist", tout << args << " " << * args << "\n");
}
return true;
}