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

chore: Remove Dafny trigger warnings #160

Merged
merged 5 commits into from
Oct 9, 2024

Conversation

seebees
Copy link
Contributor

@seebees seebees commented Oct 3, 2024

This removes Dafny warnings around forall statments lacking a {trigger}

By submitting this pull request, I confirm that my contribution is made under the terms of the MIT license.

This removes Dafny warnings around `forall` statments lacking a `{trigger}`
@@ -209,7 +209,7 @@ module {:options "-functionSyntax:4"} DivMod {
ensures forall a: int, b: int, d: int, R: int {:trigger d * ((a + b) / d) - R, d*(a/d) + d*(b/d)}
:: 0 < d && R == a%d + b%d - (a+b)%d ==> d*((a+b)/d) - R == d*(a/d) + d*(b/d)
{
forall (a: int, b: int, d: int, R: int {:trigger true} | 0< d && R == a%d + b%d - (a+b)%d)
forall (a: int, b: int, d: int, R: int {:trigger d * ((a + b) / d) - R, d*(a/d) + d*(b/d)} | 0< d && R == a%d + b%d - (a+b)%d)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can't use interpreted functions, like any of the arithmetic or logical operators, in a trigger. Sorry that there is no automatic feedback on this, or even good documentation. And to be honest I'm not sure what the right trigger for this forall would be. @MikaelMayer @atomb ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can run Dafny and it will give you some help, but also {:nowarn} works in newer versions of Dafny, and that gets me what I want!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use {:nowarn} everywhere then. These triggers are not valid triggers because they map to builtin operators that do not work with pattern matching.

Copy link

@ajewellamz ajewellamz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@robin-aws robin-aws merged commit fabf44d into dafny-lang:master Oct 9, 2024
4 checks passed
@seebees seebees deleted the remove-warnings branch October 16, 2024 22:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants