-
Notifications
You must be signed in to change notification settings - Fork 7
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
[BUG] Timeout in str.indexof -1 #83
Comments
Hi @leonbett, This a Z3 problem and not "ISLa's fault." ISLa reports
which means that Z3 failed to evaluate the logic constraint. That's a pity, but there's not much to be done here from our side. ISLa already tries to solve SMT constraints with and without Z3's parallel mode and with different timeouts. It works if you remove one Would you happen to have any idea on how to improve this situation? Unsatisfiability can also not be answered by generating random values, which we could do for satisfiability in the case of ISLa (given enough time—semi-decidability). I'm closing this for now; please feel free to follow up if you have any more ideas. |
Thanks Dominic! In this particular example, one idea would be to transform:
into
and solve each subexpression separately. My intuition is that Z3 would return unsat for |
Right, |
Added a feature request. I can't say when or whether I can address it, though. Contributions welcome :) |
Thanks! I agree that it is more complicated for the non -1 case. For constant -1 |
That could be a feasible solution in some instances. I'm not sure whether I want to go this path, though. ISLa is a constraint solver, and it is nothing unusual that different formulations of semantically equivalent constraints work differently well. On the one hand, that continues beyond the SMT level, so we might end up with an extensive list of ad-hoc rewrites; on the other hand, it's not even obvious if such rewrites are always beneficial. Z3 might react differently for different constraint combinations; there may be situations where a rewrite works well and others where it doesn't. Automatic rewriting would take the possibility of manual constraint optimization away from the users. |
Describe the bug
(str.indexof
<buffer>
"a") should return the offset of the first occurence of "a" in<buffer>
, or-1
if "a" is not in<buffer>
.Queries that constrain
str.indexof
to-1
hit a timeout ("Satisfiability of [...] could not be decided"), even when settingtimeout_ms
to a higher value like5000
inz3_helpers.py
.To Reproduce
Run the following program:
Behavior
Expected behavior: ISLa should return
unsat
because every string derived from the grammar containsx
.Actual behavior: ISLa returns
unsat
, but due to hitting a timeout: "Satisfiability of [...] could not be decided".System/Installation Specs:
The text was updated successfully, but these errors were encountered: