-
Notifications
You must be signed in to change notification settings - Fork 266
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
opaque
function called within lambda is not opaque!
#3719
Comments
I am investigating the problem. So far:
(_module.__default.inc(StartFuel__module._default.inc, LitInt(1)) In the lambda: AtLayer((lambda $l#9#ly#0: LayerType ::
Handle0((lambda $l#9#heap#0: Heap ::
$Box(_module.__default.inc($l#9#ly#0, LitInt(1)) == LitInt(2))),
(lambda $l#9#heap#0: Heap :: true),
(lambda $l#9#heap#0: Heap :: SetRef_to_SetBox((lambda $l#9#o#0: ref :: false))))),
$LS($LZ)) So our translation is somehow incorrect. The first construction (outside of the lambda) correct prevents the verifier from picking up the axiom of "inc" until Reveal is properly called. Another interesting experiment: method test() {
assert Check(() => assert inc(1) == 2;inc(1) == 2);
} Here the check verifies, but not the inner assert. This is because the inner assert is checked as part of the well-formedness, and there it's using the correct fuel that can be revealed or not. Looking at the difference between the two calls, in the stand-alone version, the "amount" is set to low = 1, whereas in the lambda, the amount is set to low = 0. Will investigate. |
Another interesting case: method test() {
var l := () => assert inc(1) >= 2;inc(1) == 2;
assert Check(l); // Error on this one
} In this one, it cannot prove the assertion inner to the definition of
Another interesting example
Here, since constants have a slightly different reveal mechanism that does not involve fuel, the check fails. The fuel passed in the lambda cannot be used for the constant. Revealing the constant anywhere (except in the body of the lambda) makes the check to pass. My take away is that we shouldn't rely on layer/fuel to "reveal". Opaqueness It should be a different mechanism. I think I found a better way. I'll write a write-up about this. |
Another interesting example method test() {
var x := inc(1);
assert CheckThis(() => x == 2); // Error on this one
} This one fails, although we just extracted |
Dafny version
4.0.0
Code to produce this issue
Command to run and resulting output
No response
What happened?
The assertion verifies when it should not because there is no specification of
inc()
and, furthermore,inc()
is markedopaque
. The problem persists when using the attribute syntax{:opaque}
as well. Finally, observe that this assertion does not verify as expected:What type of operating system are you experiencing the problem on?
Linux
The text was updated successfully, but these errors were encountered: