-
Notifications
You must be signed in to change notification settings - Fork 254
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
Can't prove modifies clause #3265
Comments
Here is a smaller repro: method M(A: set<object>, B: set<object>, C: set<object>, D: set<object>)
requires C - D <= A - B
modifies A - B
{
var cd := C - D;
if * {
modify C - D; // does not verify
} else {
modify cd; // verifies
}
} The problem is that the verifier sometimes tries to be "helpful" in rewriting some proof obligations. In particular, of By the time things reach the SMT solver, the definition of the subset operator (
but that means that conditions like These "helpful" rewrites seemed innovative in the first year or so of Dafny, which was long before Dafny's auto-triggers were added. Maybe we should get ride of these "helpful" rewrites now, and instead add the following tweak to auto-triggers: if a trigger looks like |
Great that's helpful. I also verified that, replacing
by requires forall a | a in C && a !in D :: a in A && a !in B everything verifies as expected, which matches your insights. At least, we now have two workarounds. |
Dafny version
3.10.0
Code to produce this issue
Command to run and resulting output
What happened?
The modify statement fails, although if you replace
k.MainSet - {k.Element}
byc
; it suddenly verifies. But these two expressions are equal !The workaround thus is to use
c
but this error is disturbing, as I found no way for Dafny to verify the modify statement without having a single variable.What type of operating system are you experiencing the problem on?
Windows
The text was updated successfully, but these errors were encountered: