Skip to content

Commit

Permalink
only allow flip if it doesn't increase unsat score
Browse files Browse the repository at this point in the history
Signed-off-by: Nikolaj Bjorner <[email protected]>
  • Loading branch information
NikolajBjorner committed Jan 2, 2025
1 parent 814d7f4 commit f67e1b8
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/ast/rewriter/bool_rewriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -729,6 +729,8 @@ br_status bool_rewriter::mk_eq_core(expr * lhs, expr * rhs, expr_ref & result) {
return BR_REWRITE1;

if (m_ite_extra_rules) {
expr* c1, * t1, * e1;
expr* c2, * t2, * e2;
if (m().is_ite(lhs) && m().is_value(rhs)) {
r = try_ite_value(to_app(lhs), to_app(rhs), result);
CTRACE("try_ite_value", r != BR_FAILED,
Expand All @@ -739,6 +741,16 @@ br_status bool_rewriter::mk_eq_core(expr * lhs, expr * rhs, expr_ref & result) {
CTRACE("try_ite_value", r != BR_FAILED,
tout << mk_bounded_pp(lhs, m()) << "\n" << mk_bounded_pp(rhs, m()) << "\n--->\n" << mk_bounded_pp(result, m()) << "\n";);
}
else if (m().is_ite(lhs, c1, t1, e1) && m().is_ite(rhs, c2, t2, e2) &&
m().is_value(t1) && m().is_value(e1) && m().is_value(t2) && m().is_value(e2)) {
expr_ref_vector args(m());
args.push_back(m().mk_or(c1, c2, m().mk_eq(e1, e2)));
args.push_back(m().mk_or(m().mk_not(c1), m().mk_not(c2), m().mk_eq(t1, t2)));
args.push_back(m().mk_or(m().mk_not(c1), c2, m().mk_eq(t1, e2)));
args.push_back(m().mk_or(c1, m().mk_not(c2), m().mk_eq(e1, t2)));
result = m().mk_and(args);
return BR_REWRITE_FULL;
}
if (r != BR_FAILED)
return r;
}
Expand Down
1 change: 1 addition & 0 deletions src/ast/rewriter/bv_rewriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2934,6 +2934,7 @@ br_status bv_rewriter::mk_eq_core(expr * lhs, expr * rhs, expr_ref & result) {
return BR_DONE;
}


return BR_FAILED;
}

Expand Down
3 changes: 3 additions & 0 deletions src/ast/sls/sls_bv_lookahead.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -553,8 +553,11 @@ namespace sls {
continue;
if (ctx.is_true(v) == v1)
continue;
unsigned num_unsat = ctx.unsat().size();
TRACE("bv", tout << "update flip " << mk_bounded_pp(e, m) << "\n";);
ctx.flip(v);
if (num_unsat < ctx.unsat().size())
ctx.flip(v);
}
m_ev.set_bool_value(to_app(e), v1);
}
Expand Down

0 comments on commit f67e1b8

Please sign in to comment.