Open linesthatinterlace opened 3 years ago
What is the definition of (<~)
I think i figured out that
(<~) : {a, b} (a -> b) -> a -> b
f <~ x = f x
In current master, the What4 backends are working properly and prove the property (which I think is the expected behavior).
The SBV backends, however, are still asking solvers to reason about 0-bit bitvectors, which are not allowed by the SMTLib standard. MathSAT appears to be accepting the query anyway, but the other solvers are (correctly) rejecting these queries.
Oh, sorry, I didn't notice I'd used that. Yes - I define <~ and ~~> to do the equivalent of Haskell's $ and . because they are so consistently useful, I forget they aren't core Lean.
Aha - I am using I think the latest numbered release of Cryptol, but the current version has since fixed this (and so it'll be fixed next release)?
It seems fixed for What4, although I'm interested in tracking down exactly what fixed it. For SBV, it's still a problem; I'll have to see if we can engineer a relatively easy fix.
I'm not certain now that's it's solely about zero-bit bitvectors though I'm unable to check at this time - I can't remember what values it was crashing with and should have included more, I suppose. It might just have been that though.
Here's a smaller example that seems to trigger the same bug:
:prove \(i:[1]) -> (zero:[2][0])@i == zero
With :set prover=yices
, I get this error message:
SBV exception:
*** Data.SBV: Unexpected non-success response from Yices:
***
*** Sent : (define-fun s1 () (_ BitVec 0) #x0)
*** Expected : success
*** Received : (error "at line 4, column 29: size must be positive in BitVec")
***
*** Exit code : ExitSuccess
*** Executable: /Users/huffman/.bin/yices-smt2
*** Options : --incremental
***
*** Reason : Check solver response for further information. If your code is correct,
*** please report this as an issue either with SBV or the solver itself!
Well, we have already implemented the easy tricks that I thought might help with this issue.
A proper solution to this will require altering the SBV backend representation of bitvectors to add a new dummy 0-bit-wide value, similar to what we are already doing for What4. However, I'm somewhat inclined to just implement #1132 instead, which would unify the What4 and SBV code for handling these issues, and others.
I have the following functions:
When running the following command with :prover = w4-yices, I get the following error message, which asks me to create an issue here.
:prove \(N : Integer) -> zero_from_eq N ([0] : [1][0])
Note that running it with :prover = yices gives the following:
Running it with :prover = offline gives:
And running it with :prove = w4-offline gives:
This last one, incidentally, crashes Cryptol entirely and dumps me to the command line.
:set prover = mathsat works and proves it. :set prover = z3 just seems to hang, but maybe it would have succeeded had I waited.
So there's two things going on here, maybe, which are probably related:
Obviously I think what these functions are doing is quite weird, so something is being stress-tested I guess! Thought you'd rather know.