Implement a proof-by-contradiction attribute#5001
Conversation
Allows a particular assertion to be marked as an intentional proof by contradiction, preventing `--warn-contradictory-assumptions` from flagging it. Fixes dafny-lang#4778
There was a problem hiding this comment.
Interesting and useful. Could you perhaps do two things:
- When you report "proved by contradictory assumptions", could you also mention this
{:contradiction}attribute so that it's easy to discover? - Add one more line in docs/dev/news about that new attribute
- Add a line about the documentation of this new attributes in docs/DafnyRef/Attributes.md
|
Could you document the attribute in the help of the |
MikaelMayer
left a comment
There was a problem hiding this comment.
Looks great! This is a good answer to the problem of being able to assert intermediate steps when the hypotheses already contradict.
I note that it won't help for preconditions in lemmas though, correct?
Are you thinking of the use case of trying to show that If that's what you mean, then no, this PR doesn't support that use case. Perhaps it would be possible to allow the same attribute on an |
Description
Allows a particular assertion to be marked as an intentional proof by contradiction, preventing
--warn-contradictory-assumptionsfrom flagging it.Fixes #4778
How has this been tested?
Source/IntegrationTests/TestFiles/LitTests/LitTest/git-issues/git-issue-4778.dfyBy submitting this pull request, I confirm that my contribution is made under the terms of the MIT license.