3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-22 16:45:31 +00:00

distribute string and regex concatenation on literals, scenario exposed by #2668

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2019-11-29 11:24:18 -08:00
parent b479c34c0b
commit 7e452254c3

View file

@ -1581,6 +1581,11 @@ br_status seq_rewriter::mk_str_in_regexp(expr* a, expr* b, expr_ref& result) {
result = m().mk_true();
return BR_DONE;
}
expr* b1 = nullptr;
if (m_util.re.is_to_re(b, b1)) {
result = m().mk_eq(a, b1);
return BR_REWRITE1;
}
scoped_ptr<eautomaton> aut;
expr_ref_vector seq(m());
if (!(aut = m_re2aut(b))) {
@ -1694,6 +1699,10 @@ br_status seq_rewriter::mk_re_concat(expr* a, expr* b, expr_ref& result) {
return BR_DONE;
}
expr* a1 = nullptr, *b1 = nullptr;
if (m_util.re.is_to_re(a, a1) && m_util.re.is_to_re(b, b1)) {
result = m_util.re.mk_to_re(m_util.str.mk_concat(a1, b1));
return BR_REWRITE2;
}
if (m_util.re.is_star(a, a1) && m_util.re.is_star(b, b1) && a1 == b1) {
result = a;
return BR_DONE;