-
Notifications
You must be signed in to change notification settings - Fork 0
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
Finding Triggers #131
Comments
See also boogie-org/boogie#441 |
This doesn't verify: // In-place reverse of items in an array
function reverse(int[] xs) -> (int[] ys)
// Returned array is same size as input
ensures |xs| == |ys|
// All items in return array in opposite order
ensures all { i in 0..|xs| | xs[i] == ys[|xs|-(i+1)]}:
//
int n = |xs| - 1
int i = 0
int j = n
int[] zs = xs
//
while i < j
where i >= 0 && j == (n - i) && |zs| == |xs|
where all { k in 0..i | xs[k] == zs[n-k] }:
//
int tmp = xs[i]
xs[i] = xs[j]
xs[j] = tmp
j = j - 1
i = i + 1
//
return xs |
Here is the boogie for the first example above:
Observe that the other way around works. See also boogie-org/boogie#451 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Presumably it needs a lemma. This is an interesting one because it shows up differences in the difficulty of quantified formulae. I guess the other question is: does a trigger help?
The text was updated successfully, but these errors were encountered: