-
Notifications
You must be signed in to change notification settings - Fork 265
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
Unbounded loop proof causes non-termination and giant SMT file #8505
Comments
Reproducible test case here: Background: Trying to prove type-safety of a simple loop. Example code main1.c (and makefile m1) show this with unrolling the loop in the function mvm. Run
and the proof terminates successfully in about 1 minute on my laptop. NOW... look at main2.c. This adds a simple loop invariant to the loop in mvm(), and removed the call to goto-instrument (in Makefile m2) that unrolls the loop. Now run
The cbmc process seems to run forever. The generated SMT2 file reaches about 192 Megabytes before I killed the process. This is unexepected. I expect proof of loops with invariants to be smaller and faster. |
With Contract instrumentation introduces a number of arrays in the program, and the explosion we're seeing is CBMC built-in array theory solver blowing up by eagerly instantiating read-over-write lemmas (the blowup is quadratic). With these options we tell CBMC to not decompose arrays into their individual cells, to model arrays directly as SMT-lib arrays, and to slice constraints that are not in the cone of influcence of the proof obligations. This defers array reasoning to the SMT solver. |
Err... not sure I understand most of that. How was I supposed to know about those options? When is it a good/bad idea to turn these on? |
How many other really useful options and switches are there that I don't know about and have no idea what they do? |
I tried these switches on all the proofs in mlkem-native. Mixed results - some faster, some slower. All succeed, which is good news. So... what C language idioms and kind of proof typically benefit from these switches? How do I know when to turn them on? |
@remi-delmas-3000 Thank you. I can imagine that this strategy can be fruitful. Can you disentangle which option is responsible for what, or point to documentation? |
We don't really have a better heuristic than "try that if the array theory blows up" at the moment. The main symptom of array theory blowup is staying stuck on the
I can't find anything else than
|
Another fun observation on this problem:
So it really goes either way.
|
When I'm running everything using the run-cbmc-proofs.py script, I don't see the "converting SSA" message at all... it just sits there doing nothing. I have no idea where the SMT file is, so I can't check it to see how big it is. This all seems a bit trial-and-error to me... |
Well.. not "doing nothing" - it's eating up CPU time and disk space... but I don't know why, or when it will stop... |
"maximum size M of arrays" - what is the "Size" of an array? Bytes, elements?? Is that a max size for any one array object, all object of one particular array type, or total of all array objects in an entire program? |
CBMC version: 6.4.0
Operating system: macOS
Exact command line resulting in the issue: make -f m2
What behaviour did you expect: Successful proof
What happened instead: Non-termination of the cbmc process
See link to example code in following comment.
The text was updated successfully, but these errors were encountered: