Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improved subset checking for regexes with counters #5731

Merged
merged 1 commit into from
Dec 23, 2021

Conversation

veanes
Copy link
Collaborator

@veanes veanes commented Dec 22, 2021

Two main edits.

  1. Some cases with counters caused divergence of unsat checking.
    A common case is a regex with nested counting (a{0,k})*. where one gets
    disjuncts of the form a{0,k-1}(a{0,k})* | a{0,k-2}(a{0,k})* but where the first one subsumes the second one.
    The PR extends the is_subset check to avoid the blowup (in some cases).
    The problem is in general very hard though.

  2. The PR also fixes an issue with Antimitov form that allowed unions of conditionals with the same condition,
    by simplifying them, essentally by turning if(c, t1, e1) U if(c, t2, e2) into if(c, t1 U t2, e1 U e2)

A related test I intend to add to the regression tests is this (that would before the fix not terminate):
I'll also add a few variants of it for unicode as well as ascii encodings.

(declare-const s String)
(assert (str.in_re s (re.inter (re.+ ((_ re.loop 1 100000) (str.to_re "a"))) (re.comp (re.++ re.all (str.to_re "a"))))))
(check-sat)

@NikolajBjorner NikolajBjorner merged commit 5afb95b into Z3Prover:master Dec 23, 2021
@veanes veanes deleted the isSubsetRE branch December 23, 2021 19:10
veanes referenced this pull request in Z3Prover/z3test Jan 7, 2022
Test aims to cover file `nlsat/nlsat_explain.cpp`, function
`normalize()`, within `if(m_atoms[b]->is_ineq_atom())` block, within
`for` loop itering until `sz`, `else` branch of `(is_const(p) ||
max_var(p) < max)` check, when `p != a->p(i)` holds.

Co-authored-by: Andrei Lascu <andrei.lascu10@imperial.ac.uk>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants