-
Notifications
You must be signed in to change notification settings - Fork 285
fix: Fix antecedent in induction hypothesis #6367
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
Merged
Merged
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
e019685
fix: FIx parameter in lit script
RustanLeino 6d63f89
fix: Fix antecedent in induction hypothesis
RustanLeino d30b648
Remove use of --manual-trigger
RustanLeino 2a44062
Add release notes
RustanLeino 6f843eb
Adjust expected resource count
RustanLeino File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/GHC-MergeSort.dfy.expect
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,2 @@ | ||
|
|
||
| Dafny program verifier finished with 52 verified, 0 errors | ||
| Dafny program verifier finished with 55 verified, 0 errors |
56 changes: 56 additions & 0 deletions
56
Source/IntegrationTests/TestFiles/LitTests/LitTest/git-issues/git-issue-6366.dfy
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| // RUN: %exits-with 4 %verify "%s" > "%t" | ||
| // RUN: %diff "%s.expect" "%t" | ||
|
|
||
| datatype Nat = Nat(n: nat) | ||
|
|
||
| datatype SeqNat = Seq(seqn: seq<Nat>) { | ||
| predicate LessThan(n: nat) | ||
| decreases seqn | ||
| { | ||
| if seqn == [] then true else seqn[0].n < n && Seq(seqn[1..]).LessThan(n) | ||
| } | ||
| } | ||
|
|
||
| predicate LessThan(ss: seq<SeqNat>, n: nat) { | ||
| if ss == [] then true else | ||
| ss[0].LessThan(n) && LessThan(ss[1..], n) | ||
| } | ||
|
|
||
| lemma Foo(ss: seq<SeqNat>, l: nat) | ||
| requires l < |ss| | ||
| requires LessThan(ss, 30) | ||
| requires LessThan(ss, 239) | ||
| ensures ss[l].LessThan(1) // error: (but this was once provable, due to a bug) | ||
| { | ||
| if ss != [] { | ||
| if l != 0 { | ||
| Foo(ss[1..], l - 1); | ||
| assert ss[1..][l - 1] == ss[l]; | ||
| assert ss[1..][l - 1..] == ss[l..]; | ||
| } | ||
| } | ||
| } | ||
|
|
||
| method Main() { | ||
| var sn: SeqNat := Seq([Nat(28)]); | ||
| assert sn.LessThan(30); | ||
| assert sn.LessThan(239); | ||
|
|
||
| var ss := [sn]; | ||
| var l := 0; | ||
| Foo(ss, l); | ||
|
|
||
| // by the postcondition of Foo: | ||
| assert ss[l].LessThan(1); | ||
| assert ss[l] == sn; | ||
| assert sn.LessThan(1); | ||
| assert sn.seqn[0].n < 1; | ||
|
|
||
| // yet: | ||
| assert sn.seqn[0] == Nat(28); | ||
| assert sn.seqn[0].n == 28; | ||
| assert 28 < 1; | ||
| assert false; | ||
|
|
||
| print 10 / 0; | ||
| } |
8 changes: 8 additions & 0 deletions
8
Source/IntegrationTests/TestFiles/LitTests/LitTest/git-issues/git-issue-6366.dfy.expect
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| git-issue-6366.dfy(26,4): Error: a postcondition could not be proved on this return path | ||
| git-issue-6366.dfy(23,24): Related location: this is the postcondition that could not be proved | ||
| git-issue-6366.dfy(10,43): Related location: this proposition could not be proved | ||
| git-issue-6366.dfy(26,4): Error: a postcondition could not be proved on this return path | ||
| git-issue-6366.dfy(23,24): Related location: this is the postcondition that could not be proved | ||
| git-issue-6366.dfy(10,73): Related location: this proposition could not be proved | ||
|
|
||
| Dafny program verifier finished with 4 verified, 2 errors |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Fix the generated induction hypothesis for auto-induction |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wait, does that mean these lemmas relied on the soundness issue ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the one test file that was affected by the PR. One of the lemmas in this file stopped verifying. When I was going to look into the details, I noticed that the test was also using
--manual-trigger, which is an option that tries to support tests that were written before Dafny did automatic trigger generation. So, I removed this option. Then, the failing lemma started verifying again. But two other lemmas in this file stopped verifying, so I wrote proofs for those.In conclusion, the PR did affect this test file, but only with
--manual-trigger. And since all the lemmas verify now, we at least know that the soundness bug did not cause a proof of a lemma that 's not true.