-
Notifications
You must be signed in to change notification settings - Fork 53
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
Unsoundness when using swap
due to AntiAliasing not flagging
#1497
Comments
This function is rejected by AntiAliasing:
with this message:
I argue the above examples should be rejected for the same reason. |
This version of the function with
|
After reflexion, it is due to the fact that |
Let's generalize it to return an environment! It's a non-trivial change, but opens up many different possibilities, including WSkS transductions as in https://www.brics.dk/PALE/ |
Okay! I'll work on that, maybe with @mario-bucev depending on his schedule! |
Let's try to first impose a restriction on |
Unfortunately, import stainless.lang._
case class X(var x: BigInt)
object Unsound:
def swaap(c1: Cell[X], c2: Cell[X]): Unit =
swap(c1, c2) // Ok, only variables
def simplerUnsoundExampleCell(): Unit = {
val a = Cell[X](X(0))
val newV = X(1)
swaap(a, Cell(newV))
assert(a.v.x == 1)
newV.x = 3
assert(a.v.x == 1) // WRONG <--- should be 3
}
end Unsound |
And if we disallow ´Cell´ to appear in arguments altogether? |
I think this should work for non-insane cases. However, there is a normalization phase that may bind some arguments and pass these bindings to the function; this check should be done before this transformation e.g. in |
Stainless verifies this program:
but it is wrong.
AntiAliasing should reject it, or other VCs generated to verify it correctly.
The text was updated successfully, but these errors were encountered: