-
Notifications
You must be signed in to change notification settings - Fork 267
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 triggers for such-that operations #6023
Open
RustanLeino
wants to merge
49
commits into
dafny-lang:master
Choose a base branch
from
RustanLeino:triggers-for-such-that
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
feat: Compute triggers for such-that operations #6023
RustanLeino
wants to merge
49
commits into
dafny-lang:master
from
RustanLeino:triggers-for-such-that
Conversation
This file contains 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
# Conflicts: # Source/DafnyCore/Triggers/QuantifiersCollector.cs
# Conflicts: # Source/DafnyCore/AST/Expressions/Comprehensions/ExistsExpr.cs # Source/DafnyCore/AST/Substituter.cs # Source/DafnyCore/Dafny.atg # Source/DafnyCore/Triggers/ComprehensionTriggerGenerator.cs # Source/DafnyCore/Verifier/BoogieGenerator.ExpressionWellformed.cs # Source/DafnyCore/Verifier/BoogieGenerator.cs # Source/DafnyCore/Verifier/Statements/BoogieGenerator.TrStatement.cs # Source/IntegrationTests/TestFiles/LitTests/LitTest/auditor/TestAuditor.dfy.expect # Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny0/CoinductiveProofs.dfy.expect # Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny0/Comprehensions.dfy.expect # Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny0/ComprehensionsNewSyntax.dfy.expect # Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny0/DirtyLoops.dfy.expect # Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny0/LetExpr.dfy.expect # Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny0/snapshots/Snapshots5.run.legacy.dfy.expect # Source/IntegrationTests/TestFiles/LitTests/LitTest/git-issues/git-issue-1207.dfy.expect # Source/IntegrationTests/TestFiles/LitTests/LitTest/git-issues/git-issue-1545.dfy.refresh.expect # Source/IntegrationTests/TestFiles/LitTests/LitTest/git-issues/git-issue-897.dfy.expect # Source/IntegrationTests/TestFiles/LitTests/LitTest/triggers/emptyTrigger.dfy.expect # Source/IntegrationTests/TestFiles/LitTests/LitTest/triggers/loop-detection-messages--unit-tests.dfy.expect # Source/IntegrationTests/TestFiles/LitTests/LitTest/triggers/some-terms-do-not-look-like-the-triggers-they-match.dfy.expect # Source/IntegrationTests/TestFiles/LitTests/LitTest/wishlist/assign-such-that-antecedent.dfy.expect
# Conflicts: # Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny0/BitvectorResolution.dfy.expect # Source/IntegrationTests/TestFiles/LitTests/LitTest/dafny4/Bug170.dfy.expect
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR computes triggers for
:|
operations ("assign such that", "let such that", bindingif
statements, and bindingif case
statements). It also improves the logic used to guess witnesses.Main new features
:|
constructsif
andif-case
statements with:|
, output warning if there is no trigger:|
constructs, support the same trigger attributes as for quantifiers, namely:{:trigger <exprs>}
to manually specify a trigger{:trigger}
to suppress any warning{:nowarn}
to change the warning into an information messageRelated new features
A proof obligation associated with assign-such-that and let-such-that constructs
x :| P(x)
is to show that such anx
exists. The general form of this is the proof obligationexists x :: P(x)
. However, Dafny also allows the proof obligation to be established from candidate witnesses that the verifier guesses. Thus, the proof obligation may have several disjuncts, for example:This PR improves this machinery further; specifically:
x
is a mapP(x)
has the formx in map[...]
for some map displaymap[...]
, use the given keys as guesses (just like is done for other collection displays)P(x)
that don't mentionx
to outside the existential, so that instead ofexists x :: R || P(x)
, the proof obligation isR || exists x :: P(x)
(for soundness, this is done only if the type ofx
is nonempty)Notes for reviewers
The PR also contains smaller changes, namely:
BoundVar
creation to indicate ghost statusif
statements to print the original:|
syntax in the guard, rather than its desugaringLiteralExpr.IsFalse
methodBlockByProofStmt
statementsZero
, return an empty mapGuessWitnesses
make more use of theZero
methodAnd regarding tests:
triggers/TriggersForSuchThat.dfy
(also relevant:wishlist/assign-such-that-antecedent.dfy
):|
constructs have specific triggersBy submitting this pull request, I confirm that my contribution is made under the terms of the MIT license.