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

by-clause ignored for assign-such-that statements #6024

Open
RustanLeino opened this issue Jan 8, 2025 · 0 comments · May be fixed by #6026
Open

by-clause ignored for assign-such-that statements #6024

RustanLeino opened this issue Jan 8, 2025 · 0 comments · May be fixed by #6026
Labels
kind: bug Crashes, unsoundness, incorrect output, etc. If possible, add a `part:` label

Comments

@RustanLeino
Copy link
Collaborator

Dafny version

4.9.1

Code to produce this issue

function F(x: int): int

method Works() {
  var a :| F(a) == 2 by {
    assume {:axiom} F(10) == 2;
  }
}

method ByClauseIsIgnored() {
  var a;
  a :| F(a) == 2 by { // this gives an error, but it should not
    assume {:axiom} F(10) == 2;
  }
}

Command to run and resulting output

% dafny verify test.dfy
test.dfy(11,4): Error: cannot establish the existence of LHS values that satisfy the such-that predicate
   |
11 |   a :| F(a) == 2 by { // this gives an error, but it should not
   |   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^


Dafny program verifier finished with 1 verified, 1 error

What happened?

The by clause in method Works works. The assumption contained therein proves the existence of an a.

Method ByClauseIgnored is similar, but uses just an assign-such-that statement with a by clause (rather than a statement that combines var and :=). Here, the assume statement does not help and the verifier cannot prove the existence of an a. Indeed, there is no trace of the assume statement in the Boogie that's generated.

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

Mac

@RustanLeino RustanLeino added the kind: bug Crashes, unsoundness, incorrect output, etc. If possible, add a `part:` label label Jan 8, 2025
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
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant