Skip to content

Commit 5993735

Browse files
simplify string patterns into prefix/suffix constraints
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
1 parent 62478db commit 5993735

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/ast/rewriter/seq_rewriter.cpp

+9
Original file line numberDiff line numberDiff line change
@@ -4541,6 +4541,15 @@ br_status seq_rewriter::mk_str_in_regexp(expr* a, expr* b, expr_ref& result) {
45414541
result = m_br.mk_eq_rw(a, b_s);
45424542
return BR_REWRITE_FULL;
45434543
}
4544+
expr* c = nullptr, *d = nullptr, *e = nullptr;
4545+
if (re().is_concat(b, c, d) && re().is_to_re(c, e) && re().is_full_seq(d)) {
4546+
result = str().mk_prefix(e, a);
4547+
return BR_REWRITE1;
4548+
}
4549+
if (re().is_concat(b, c, d) && re().is_to_re(d, e) && re().is_full_seq(c)) {
4550+
result = str().mk_suffix(e, a);
4551+
return BR_REWRITE1;
4552+
}
45444553
expr* b1 = nullptr;
45454554
expr* eps = nullptr;
45464555
if (re().is_opt(b, b1) ||

0 commit comments

Comments
 (0)