You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Case 1 verifies
least predicate {:opaque} Spec1(i: int) {
exists j :: Spec1(j)
}
lemmaL1() {
revealSpec1();
assumeSpec1(200);
assertexists j :: Spec1(j);
assertSpec1(100);
}
// Case 2 does not verify
least predicateRule2(i: int, j: int) {
Spec2(j)
}
least predicate {:opaque} Spec2(i: int) {
exists j :: Rule2(i, j)
}
lemmaL2() {
revealSpec2();
assumeSpec2(200);
assertRule2(100, 200); // VERIFIESassertexists j :: Rule2(100, j); // VERIFIESassertSpec2(100); // ERROR ONLY HERE
}
// Case 3 verifies
least predicateRule3(i: int, j: int) {
Spec3(j)
}
least predicateWrapped3(i: int) {
exists j :: Rule3(i, j)
}
least predicate {:opaque} Spec3(i: int) {
Wrapped3(i)
}
lemmaL3() {
revealSpec3();
assumeSpec3(200);
assertRule3(100, 200);
assertWrapped3(100);
assertSpec3(100);
}
Command to run and resulting output
dafny verify Code.dfy
What happened?
Hi, I’m having the following issue with a combination of a few Dafny features: least predicate, opaque and exists (if one of these features is absent all cases seem to verify). I tried coming up with a minimal example that doesn’t quite make sense logically, but shows the problem.
For some context, I used to have my specification defined in the style of Case 1. I can then verify that assuming that Spec1(200) holds, that Spec(100) holds too, which follows from the definition directly.
However, once I added many more disjunctions, the predicate became a bit too big, so I tried splitting each case into separate predicates (shown in Case 2). However, I ran into issues where I couldn’t prove direct things about the predicate anymore, like assume that a disjunct holds and therefore showing that the whole predicate holds. In the following, assuming the same things as for Case 1, I can’t seem to prove that Spec2(100) holds anymore.
// Case 2 does not verify
least predicateRule2(i: int, j: int) {
Spec2(j)
}
least predicate {:opaque} Spec2(i: int) {
exists j :: Rule2(i, j)
}
lemmaL2() {
revealSpec2();
assumeSpec2(200);
assertRule2(100, 200); // VERIFIESassertexists j :: Rule2(100, j); // VERIFIESassertSpec2(100); // ERROR ONLY HERE
}
Finally, it seems like adding one more layer of indirection (with a Wrapped3 predicate) in Case 3 makes everything work again which is interesting.
// Case 3 verifies
least predicateRule3(i: int, j: int) {
Spec3(j)
}
least predicateWrapped3(i: int) {
exists j :: Rule3(i, j)
}
least predicate {:opaque} Spec3(i: int) {
Wrapped3(i)
}
lemmaL3() {
revealSpec3();
assumeSpec3(200);
assertRule3(100, 200);
assertWrapped3(100);
assertSpec3(100);
}
My current work around is to either use Case 1 and have the predicate Opaque, or use Case 2 with the predicate not opaque, which also works fine but I wanted to make it opaque because I felt like proofs were slowing down a bit. Case 3 is a bit unwieldly.
What type of operating system are you experiencing the problem on?
Mac
The text was updated successfully, but these errors were encountered:
Dafny version
3.11.0.50201
Code to produce this issue
Command to run and resulting output
What happened?
Hi, I’m having the following issue with a combination of a few Dafny features: least predicate, opaque and exists (if one of these features is absent all cases seem to verify). I tried coming up with a minimal example that doesn’t quite make sense logically, but shows the problem.
For some context, I used to have my specification defined in the style of Case 1. I can then verify that assuming that
Spec1(200)
holds, thatSpec(100)
holds too, which follows from the definition directly.However, once I added many more disjunctions, the predicate became a bit too big, so I tried splitting each case into separate predicates (shown in Case 2). However, I ran into issues where I couldn’t prove direct things about the predicate anymore, like assume that a disjunct holds and therefore showing that the whole predicate holds. In the following, assuming the same things as for Case 1, I can’t seem to prove that Spec2(100) holds anymore.
Finally, it seems like adding one more layer of indirection (with a
Wrapped3
predicate) in Case 3 makes everything work again which is interesting.My current work around is to either use Case 1 and have the predicate Opaque, or use Case 2 with the predicate not opaque, which also works fine but I wanted to make it opaque because I felt like proofs were slowing down a bit. Case 3 is a bit unwieldly.
What type of operating system are you experiencing the problem on?
Mac
The text was updated successfully, but these errors were encountered: