Skip to content

Commit 1f8b081

Browse files
#7739 optimization
add simplification rule for at(x, offset) = "" Introducing j just postpones some rewrites that prevent useful simplifications. Z3 already uses common sub-expressions. The example highlights some opportunities for simplification, noteworthy at(..) = "". The example is solved in both versions after adding this simplification.
1 parent 8e1a528 commit 1f8b081

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/ast/rewriter/seq_rewriter.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6021,6 +6021,12 @@ bool seq_rewriter::reduce_eq_empty(expr* l, expr* r, expr_ref& result) {
60216021
result = m_autil.mk_lt(s, zero());
60226022
return true;
60236023
}
6024+
// at(s, offset) = "" <=> len(s) <= offset or offset < 0
6025+
if (str().is_at(r, s, offset)) {
6026+
expr_ref len_s(str().mk_length(s), m());
6027+
result = m().mk_or(m_autil.mk_le(len_s, offset), m_autil.mk_lt(offset, zero()));
6028+
return true;
6029+
}
60246030
return false;
60256031
}
60266032

0 commit comments

Comments
 (0)