Skip to content

Commit

Permalink
correct newly introduced rewrite
Browse files Browse the repository at this point in the history
  • Loading branch information
NikolajBjorner committed May 2, 2020
1 parent ec8866c commit f313ab9
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/ast/rewriter/bv_rewriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -510,10 +510,14 @@ br_status bv_rewriter::mk_leq_core(bool is_signed, expr * a, expr * b, expr_ref
return BR_REWRITE2;
}

// (bvule c (+ c a)) -> (bvule a (2^n - c)) (could be generalized)
if (!is_signed && is_num1 && m_util.is_bv_add(b, a1, a2) && is_numeral(a1, r2, sz) && r1 == r2) {
result = m_util.mk_ule(a2, m_util.mk_numeral(-r1, sz));
return BR_REWRITE1;
// (bvule r1 (+ r2 a)) ->
// for r1 = r2, (bvule a (2^n - r2 - 1))
// other cases r1 > r2, r1 < r2 are TBD
if (!is_signed && is_num1 && m_util.is_bv_add(b, a1, a2) && is_numeral(a1, r2, sz)) {
if (r1 == r2) {
result = m_util.mk_ule(a2, m_util.mk_numeral(-r2 - 1, sz));
return BR_REWRITE1;
}
}

if (m_le_extra) {
Expand Down

0 comments on commit f313ab9

Please sign in to comment.