Skip to content
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

feat: Compute matching patterns for automatic induction #5835

Open
wants to merge 47 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
8c4c4a6
chore: Improve trigger/induction code
RustanLeino Oct 12, 2024
e62d2b6
Compute triggers for automatic induction
RustanLeino Oct 12, 2024
ad1c724
Improve induction heuristics
RustanLeino Oct 12, 2024
29d715a
chore: Change “ghost method” to “lemma”
RustanLeino Oct 12, 2024
4cfbe21
chore: Improve C#
RustanLeino Oct 14, 2024
b17c662
Also consider codatatype equality as a greatest focal predicate
RustanLeino Oct 14, 2024
cee8d58
Show tooltips for any quantifier rewrite substitutions
RustanLeino Oct 14, 2024
dda37cb
feat!: Auto-induction for twostate lemmas but not ghost methods
RustanLeino Oct 14, 2024
fa79ba3
fix: Don’t consider arrow-typed variables for auto induction
RustanLeino Oct 16, 2024
0028a3a
feat: allow ternary expressions in triggers
RustanLeino Oct 16, 2024
394c635
Compute and use triggers for induction hypotheses
RustanLeino Oct 16, 2024
659d4ba
Tooltip named expressions from trigger selection
RustanLeino Oct 16, 2024
6b5b207
chore: Remove deprecated semi-colons
RustanLeino Oct 16, 2024
3fc56d3
Add tests for ternary expressions in triggers
RustanLeino Oct 16, 2024
73d2d61
Adjust resource count in test
RustanLeino Oct 16, 2024
73406c6
Merge branch 'master' into triggers-for-auto-induction
RustanLeino Oct 16, 2024
f4815f4
Add release notes
RustanLeino Oct 16, 2024
e4e4ce8
Help proof
RustanLeino Oct 17, 2024
3a0f1c0
Update test, which no longer exhausts resources
RustanLeino Oct 17, 2024
703c661
Improve proofs
RustanLeino Oct 17, 2024
54e9ddb
Fix typo in method name
RustanLeino Oct 20, 2024
b46f0dc
Remove unnecessary assertion
RustanLeino Oct 20, 2024
022685c
Remove unnecessary $’s
RustanLeino Oct 20, 2024
4cb3f5a
Improve C# and comments
RustanLeino Oct 20, 2024
a213285
Revert tooltip printing of trigger named expressions
RustanLeino Oct 20, 2024
72c15fe
Improve and document methods that compute/report induction triggers
RustanLeino Oct 20, 2024
704af8c
Incomplete attempt at specifying behavior
RustanLeino Oct 20, 2024
9e9dd80
doc: Align :induction documentation with actual behavior
cpitclaudel Oct 23, 2024
8a792b1
Remove unnecessary $s
cpitclaudel Oct 23, 2024
7c6ab84
Move :inductionPattern attribute generation to ComputeInductionTriggers
cpitclaudel Oct 23, 2024
766ac5b
Allow users to disable trigger generation with an empty inductionTrigger
cpitclaudel Oct 23, 2024
a3702d2
Update documentation
cpitclaudel Oct 23, 2024
ffe54af
Add one more test for induction triggers
cpitclaudel Oct 23, 2024
8c7b06c
Document {:inductionTrigger}
cpitclaudel Oct 24, 2024
769d6cd
Always report “inductionTrigger”, not just in DEBUG build
RustanLeino Oct 30, 2024
2c7fcc9
Fix format of expected test output
RustanLeino Oct 30, 2024
62e771c
Merge branch 'master' into triggers-for-auto-induction
RustanLeino Oct 30, 2024
af0223b
Use underscore name for generated attributes
RustanLeino Oct 31, 2024
6cdaa08
Update tests
RustanLeino Oct 31, 2024
a1149c9
Update tests and expected output
RustanLeino Oct 31, 2024
c447ffa
Fix previous code edit
RustanLeino Oct 31, 2024
3d8d0e7
Merge branch 'master' into triggers-for-auto-induction
RustanLeino Oct 31, 2024
63683d1
Update standard libraries
RustanLeino Oct 31, 2024
808a2b3
Merge branch 'master' into triggers-for-auto-induction
RustanLeino Oct 31, 2024
43bdbd3
Merge branch 'master' into triggers-for-auto-induction
RustanLeino Oct 31, 2024
3652ff3
Update standard library
RustanLeino Oct 31, 2024
b070751
Update standard library
RustanLeino Nov 1, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ greatest lemma {:induction false} Compare<T>(h: T)
Compare(Next(h));
if {
case true =>
assert FF(h).tail == GG(h).tail; // error: full equality is not known here
assert FF(h).tail == GG(h).tail; // yes, this full equality is a focal predicate, so it's rewritten into ==#[_k - 1]
case true =>
assert FF(h) ==#[_k] GG(h); // yes, this is the postcondition to be proved, and it is known to hold
case true =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ CoPrefix.dfy(76,55): Error: cannot prove termination; try supplying a decreases
CoPrefix.dfy(114,0): Error: a postcondition could not be proved on this return path
CoPrefix.dfy(113,10): Related location: this is the postcondition that could not be proved
CoPrefix.dfy(101,16): Related location: this proposition could not be proved
CoPrefix.dfy(138,24): Error: assertion might not hold
CoPrefix.dfy(142,24): Error: assertion might not hold
CoPrefix.dfy(117,22): Related location: this proposition could not be proved
CoPrefix.dfy(151,0): Error: a postcondition could not be proved on this return path
Expand All @@ -17,4 +16,4 @@ CoPrefix.dfy(205,6): Error: the calculation step between the previous line and t
CoPrefix.dfy(207,6): Error: the calculation step between the previous line and this line could not be proved
CoPrefix.dfy(220,12): Error: ORDINAL subtraction might underflow a limit ordinal (that is, RHS might be too large)

Dafny program verifier finished with 13 verified, 12 errors
Dafny program verifier finished with 13 verified, 11 errors
Original file line number Diff line number Diff line change
Expand Up @@ -206,3 +206,25 @@ lemma Fib_Correct(n: nat)
}
}
}

// --------------- ternary expression is a trigger ---------------

lemma OrdinalLemma(k: ORDINAL)
ensures OhOnes().tail ==#[k] ones()
{
// automatic induction on k
}

lemma NaturalLemma(k: nat)
ensures OhOnes().tail ==#[k] ones()
{
// automatic induction on k
}

lemma Quantifier()
// the following quantifiers use the entire body as a trigger (previously, ternary expressions
// had not been considered as trigger candidates)
requires forall k: nat :: OhOnes().tail ==#[k] ones()
requires forall k: ORDINAL :: OhOnes().tail ==#[k] ones()
cpitclaudel marked this conversation as resolved.
Show resolved Hide resolved
{
}