mirror of
https://github.com/Z3Prover/z3
synced 2025-08-08 12:11:23 +00:00
add shortcuts in rewriter, eliminate redundancies in dependent_expr tactic
This commit is contained in:
parent
bfae8b2162
commit
9845c33236
5 changed files with 50 additions and 25 deletions
|
@ -686,6 +686,10 @@ br_status bool_rewriter::try_ite_value(app * ite, app * val, expr_ref & result)
|
|||
|
||||
|
||||
app* bool_rewriter::mk_eq(expr* lhs, expr* rhs) {
|
||||
if (m().are_distinct(lhs, rhs))
|
||||
return m().mk_false();
|
||||
if (lhs == rhs)
|
||||
return m().mk_true();
|
||||
// degrades simplification
|
||||
// if (lhs->get_id() > rhs->get_id()) std::swap(lhs, rhs);
|
||||
return m().mk_eq(lhs, rhs);
|
||||
|
@ -785,7 +789,7 @@ br_status bool_rewriter::mk_distinct_core(unsigned num_args, expr * const * args
|
|||
|
||||
if (num_args == 2) {
|
||||
expr_ref tmp(m());
|
||||
result = m().mk_not(mk_eq(args[0], args[1]));
|
||||
result = mk_not(mk_eq(args[0], args[1]));
|
||||
return BR_REWRITE2; // mk_eq may be dispatched to other rewriters.
|
||||
}
|
||||
|
||||
|
@ -827,7 +831,7 @@ br_status bool_rewriter::mk_distinct_core(unsigned num_args, expr * const * args
|
|||
ptr_buffer<expr> new_diseqs;
|
||||
for (unsigned i = 0; i < num_args; i++) {
|
||||
for (unsigned j = i + 1; j < num_args; j++)
|
||||
new_diseqs.push_back(m().mk_not(mk_eq(args[i], args[j])));
|
||||
new_diseqs.push_back(mk_not(mk_eq(args[i], args[j])));
|
||||
}
|
||||
result = m().mk_and(new_diseqs);
|
||||
return BR_REWRITE3;
|
||||
|
@ -937,13 +941,13 @@ br_status bool_rewriter::mk_ite_core(expr * c, expr * t, expr * e, expr_ref & re
|
|||
if (m().is_not(t, t1) && m().is_eq(t1, t1, t2) && e == t1) {
|
||||
expr_ref a(m());
|
||||
mk_and(c, t2, a);
|
||||
result = m().mk_not(m().mk_eq(t1, a));
|
||||
result = mk_not(mk_eq(t1, a));
|
||||
return BR_REWRITE3;
|
||||
}
|
||||
if (m().is_not(t, t1) && m().is_eq(t1, t2, t1) && e == t1) {
|
||||
expr_ref a(m());
|
||||
mk_and(c, t2, a);
|
||||
result = m().mk_eq(t1, a);
|
||||
result = mk_eq(t1, a);
|
||||
return BR_REWRITE3;
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue