Skip to content

Commit

Permalink
simplify string patterns into prefix/suffix constraints
Browse files Browse the repository at this point in the history
Signed-off-by: Nikolaj Bjorner <[email protected]>
  • Loading branch information
NikolajBjorner committed Oct 14, 2024
1 parent 62478db commit 5993735
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/ast/rewriter/seq_rewriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4541,6 +4541,15 @@ br_status seq_rewriter::mk_str_in_regexp(expr* a, expr* b, expr_ref& result) {
result = m_br.mk_eq_rw(a, b_s);
return BR_REWRITE_FULL;
}
expr* c = nullptr, *d = nullptr, *e = nullptr;
if (re().is_concat(b, c, d) && re().is_to_re(c, e) && re().is_full_seq(d)) {
result = str().mk_prefix(e, a);
return BR_REWRITE1;
}
if (re().is_concat(b, c, d) && re().is_to_re(d, e) && re().is_full_seq(c)) {
result = str().mk_suffix(e, a);
return BR_REWRITE1;
}
expr* b1 = nullptr;
expr* eps = nullptr;
if (re().is_opt(b, b1) ||
Expand Down

0 comments on commit 5993735

Please sign in to comment.