3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2026-05-16 23:25:36 +00:00

add simplification rule to concatentations of regex to avoid stack overflow in derivatives of very long expressions

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2026-04-20 18:19:16 +02:00
parent 41412293fe
commit e172aa370d
2 changed files with 7 additions and 0 deletions

View file

@ -4539,6 +4539,11 @@ br_status seq_rewriter::mk_re_concat(expr* a, expr* b, expr_ref& result) {
result = re().mk_plus(b);
return BR_DONE;
}
expr *x = nullptr, *y = nullptr;
if (re().is_concat(a, x, y) && re().is_full_seq(y) && re().is_full_seq(b)) {
result = a;
return BR_DONE;
}
expr_ref a_str(m());
expr_ref b_str(m());
if (lift_str_from_to_re(a, a_str) && lift_str_from_to_re(b, b_str)) {

View file

@ -1502,6 +1502,8 @@ namespace seq {
IF_VERBOSE(1, display(verbose_stream(), node));
CTRACE(seq, !ext, display(tout, node) << to_dot() << "\n");
if (!ext) {
std::cout << "No extensions generated for node " << node->id() << ", but not satisfied or conflict?!"
<< std::endl;
node->to_html(std::cout, m);
std::cout << std::endl;
display(std::cout, node);