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

strange assertion failure #5435

Open
toNanjingnan opened this issue May 14, 2024 · 2 comments
Open

strange assertion failure #5435

toNanjingnan opened this issue May 14, 2024 · 2 comments
Labels
incompleteness Things that Dafny should be able to prove, but can't

Comments

@toNanjingnan
Copy link

toNanjingnan commented May 14, 2024

Dafny version

4.6.0

Code to produce this issue

method Main(){
    var lift_5 := {false, false};
    var lift_1 := {true, true, true};
    assert (((2 == |((lift_1 * lift_1) + (lift_1 + lift_5 + lift_1))|)));
}

Command to run and resulting output

// verify dfy file
$ dafny test.dfy
 
output:
test.dfy(8,11): Error: assertion might not hold

Dafny program verifier finished with 0 verified, 1 error

What happened?

the assertion fails but it should be true. Print the expression in the assertion and the result is true. when I add some assertion using the component of expression in the failed assertion, it suddenly stops failing.

What type of operating system are you experiencing the problem on?

Windows

@toNanjingnan toNanjingnan added the kind: bug Crashes, unsoundness, incorrect output, etc. If possible, add a `part:` label label May 14, 2024
@robin-aws
Copy link
Member

This is a classic symptom of the fact that Dafny verification is extremely powerful but fundamentally incomplete: there will always be assertions that are in fact true but where Dafny cannot prove they are true without help.

https://dafny.org/dafny/DafnyRef/DafnyRef#sec-verification has lots of information about how to debug failing verification and add assertions as necessary to fix it (as you did by accident when trying to debug it :)

@robin-aws robin-aws added incompleteness Things that Dafny should be able to prove, but can't and removed kind: bug Crashes, unsoundness, incorrect output, etc. If possible, add a `part:` label labels May 15, 2024
@MikaelMayer
Copy link
Member

If we had changed "assertion might not hold" to "assertion could not be proved", how would you have reacted? Same or differently?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
incompleteness Things that Dafny should be able to prove, but can't
Projects
None yet
Development

No branches or pull requests

3 participants