-
Notifications
You must be signed in to change notification settings - Fork 123
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
Reintroduce ":safe"/"assert" #284
Comments
SBV 5.4 is now out on hackage, with |
Thanks! We might not be able to take advantage of the new features for a while, but I've got a PR incoming to keep 7.8 on life support |
With the new evaluator in the IO monad, it probably makes sense to revisit this soon. |
As part of the refactoring I'm doing in #684, I'm making the internal changes necessary to compute safety conditions during symbolic evaluation. The result of a symbolic evaluation will either be an error (if all inputs obviously cause an error) or a pair of a safety predicate and a value. At this point, the slightly tricky bit is to figure out what to do with them, from a UI perspective. How should safety predicates interact with |
After thinking about this for a bit, here's my proposal. Let's add a new We can also add a separate We can also add to the Prelude:
Alternately, make |
When printing a counterexample from |
As of 60dcbd1 both SBV and What4 backends automatically include safety predicates as part of We still need to implement the user-configurable settings that control this behavior, and improve the output generated when displaying counterexamples. |
Fixed via #770 |
@acfoltzer @brianhuffman
In the good old days of Cryptol 1, there was the
:safe
command, which checked whether there's div-by-0, index-out-of-bounds, log-of-0, etc,; and violations of any user givenassert
s. This functionality seems to have evaporated in Cryptol 2: I can neither find the:safe
command, nor theassert
expression.The latest github version of SBV comes with
sAssert
andsafe
functions, which can be directly used to introduce similar functionality in Cryptol. See here: http://github.com/LeventErkok/sbv/blob/master/Data/SBV/Provers/Prover.hs#L350and here: http://github.com/LeventErkok/sbv/blob/master/Data/SBV/BitVectors/Model.hs#L1106
An example use case is here: http://github.com/LeventErkok/sbv/blob/master/Data/SBV/Examples/Misc/NoDiv0.hs
I'm intending to do a new SBV release on Hackage soon, containing this functionality. I understand that you guys probably don't have the bandwidth right now to look at this and give me an OK on the API; but we can always make a new SBV release to fit Cryptol's needs when/if you implement the
:safe
command and itsassert
counterpart. As usual, send a pull request with the mods you need!The text was updated successfully, but these errors were encountered: