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

No Counterexample states generated when using the attribute {:isolate_assertions} #5806

Open
TomSMaier opened this issue Oct 3, 2024 · 0 comments
Labels
kind: bug Crashes, unsoundness, incorrect output, etc. If possible, add a `part:` label misc: brittleness When Dafny sometimes proves something, and sometimes doesn't part: verifier Translation from Dafny to Boogie (translator) priority: next Will consider working on this after in progress work is done

Comments

@TomSMaier
Copy link

Dafny version

4.8.1

Code to produce this issue

// dafny verify --extract-counterexample input.dfy

// counterexample generated
method F(x: int) {
  assert x != 1;
}
// counterexample not generated
method {:isolate_assertions} F1(x: int) {
  assert x != 1;
}

Command to run and resulting output

$ dafny verify --extract-counterexample input.dfy
input.dfy(5,9): Error: assertion might not hold
 Related counterexample:
 WARNING: the following counterexample may be inconsistent or invalid. See dafny.org/dafny/DafnyRef/DafnyRef#sec-counterexamples
 input.dfy(4,17): initial state:
 assume 1 == x;
 
  |
5 |   assert x != 1;
  |          ^^^^^^

input.dfy(9,9): Error: assertion might not hold
 Related counterexample:
 WARNING: the following counterexample may be inconsistent or invalid. See dafny.org/dafny/DafnyRef/DafnyRef#sec-counterexamples
 
  |
9 |   assert x != 1;
  |          ^^^^^^


Dafny program verifier finished with 1 verified, 2 errors

What happened?

The example has two methods with failing assertions and uses dafny's flag --extract-counterexample for verification.
Dafny behaves as expected for method F and generates a counterexample with assume x == 1.
This line is missing in the output for method F1, which is identical to F, but is annotated with the {:isolated_assertions} attribute.

Discussed with @RustanLeino in-person a few weeks ago.

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

Mac

@TomSMaier TomSMaier added the kind: bug Crashes, unsoundness, incorrect output, etc. If possible, add a `part:` label label Oct 3, 2024
@keyboardDrummer keyboardDrummer added part: verifier Translation from Dafny to Boogie (translator) misc: brittleness When Dafny sometimes proves something, and sometimes doesn't priority: next Will consider working on this after in progress work is done labels Oct 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: bug Crashes, unsoundness, incorrect output, etc. If possible, add a `part:` label misc: brittleness When Dafny sometimes proves something, and sometimes doesn't part: verifier Translation from Dafny to Boogie (translator) priority: next Will consider working on this after in progress work is done
Projects
None yet
Development

No branches or pull requests

2 participants