3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-08-25 04:26:00 +00:00

Performance improvements for seq-sls (#7519)

* Improve length repair

* Fixed arguments

* Special case regex membership with constant string

* Trying hybrid eq-repair strategy

* Different heuristic

* Fixed stoi
This commit is contained in:
Clemens Eisenhofer 2025-01-21 17:01:59 +01:00 committed by GitHub
parent 3cdcd831b1
commit 1553bae20c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 118 additions and 36 deletions

View file

@ -4545,6 +4545,27 @@ br_status seq_rewriter::mk_str_in_regexp(expr* a, expr* b, expr_ref& result) {
result = m().mk_true();
return BR_DONE;
}
zstring s;
if (str().is_string(a, s) && re().is_ground(b)) {
// Just check membership and replace by true/false
expr_ref r(b, m());
for (unsigned i = 0; i < s.length(); i++) {
if (re().is_empty(r)) {
result = m().mk_false();
return BR_DONE;
}
unsigned ch = s[i];
expr_ref new_r = mk_derivative(m_util.mk_char(ch), r);
r = new_r;
}
if (re().get_info(r).nullable)
result = m().mk_true();
else
result = m().mk_false();
return BR_DONE;
}
expr_ref b_s(m());
if (lift_str_from_to_re(b, b_s)) {
result = m_br.mk_eq_rw(a, b_s);