-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Nondeterministic behavior observed despite seed set #7525
Comments
You are setting a timeout from the command prompt. The timeout fires in a way independent of CPU cycles. What may be non-obvious is that the timeout value you use appears very high. I get non-deterministic behavior for -t:100 not your value on Windows. Are you therefore reporting a Mac issue with timeouts? C:\z3\release>z3 test.smt2 smt.random_seed=10101 /v:1 -t:100 C:\z3\release>z3 test.smt2 smt.random_seed=10101 /v:1 -t:100 C:\z3\release>z3 test.smt2 smt.random_seed=10101 /v:1 -t:100000 C:\z3\release>z3 test.smt2 smt.random_seed=10101 /v:1 -t:100000 C:\z3\release>z3 test.smt2 smt.random_seed=10101 /v:1 -t:100000 |
I was actually under the impression that the timeout is in milliseconds, so it's not so long. The timeout being considered long just strengthens my claim that this is not caused by minor deviations in OS interrupt time causing the formula to sometimes exceed the timeout despite the solver supposedly doing the same thing. Indeed, on my computer I get "non-deterministic" output for the lower timeout you suggested:
Which I think may be attributed to OS time. I don't think this is a timeout issue. The timeout is just because it'd otherwise probably run forever. I'm claiming that the solver itself introduces non-determinism that does not depend only on the seed. Also note the weird behavior I observed in the edit to the original issue, where calls to Thanks for the quick response! |
If you simply remove the timeout arguments from the command-line you could know if to rule out the timer from this behavior. Next, add a line (get-info :reason-unknown) after each check-sat. Next, it could be platform behavior. |
It is "timeout", but the question is twofold:
I have asked a colleague to run the queries on WSL (Linux) running on a Windows computer, and got the same behavior:
(The two queries are exactly the same, except the first one has the first two |
Here it is on Windows as well:
So, it doesn't seem platform-specific. |
Also, it's the same behavior when using
|
I have been testing this on newest builds. It doesn't reproduce Windows, wsl2. |
I can confirm that the behavior in the latest
It's still quite weird how running |
The behavior of the solver is determined by a number of factors, such as the current set of expressions that are created. If you creaute expressions in different order, it results in a different solver state. If you run a solver call and interrupt it, the state after interruption is not the same as the state before the solver was invoked. It is determined by the state changes during solving. |
I am trying to get Z3 to behave deterministically on a formula outside of the decidable fragment. I don't really mind more unknowns, but it is important that Z3 returns the same result every call. I was under the impression that it would be sufficient to set the random seed, but this seems to not be the case:
What other sources of nondeterminism could there be? Is this a bug in Z3 or am I missing something? This isn't a "borderline timeout" issue.
I am running on a MacBook Pro M2 with macOS 15.1.1. I also attach
test.smt
(renamed for GitHub).Edit for more information: The formula has 5
check-sat-assuming
commands at the end. The first two always returnunsat
with no issue, the third seems to always returnunknown
and the latter two may returnunsat
orunknown
seemingly nondeterministically. However, when commenting out the first two commands, the latter three seem to always returnsat; unsat; unsat
. So, it seems that the firstcheck-sat-assuming
commands are interfering with the latter ones.TIA!
test.txt
The text was updated successfully, but these errors were encountered: