Open
Description
Dafny version
4.4.0
Code to produce this issue
method Main() {
var y;
y :| y == 2;
print y, " ";
y :| assume {:axiom} y == 3;
print y, "\n";
}
Command to run and resulting output
% dafny run test.dfy
Dafny program verifier finished with 1 verified, 0 errors
2 2
What happened?
The :| assume
construct should be different from :|
only in that it omits the proof obligation that a value exists. So, if the compiler does compile the program, then, in the event that the value actually does exist, the code should find it.
In other words,
y :| assume {:axiom} P(y);
should behave like
assume {:axiom} exists z :: P(z);
y :| P(y);
However, it seems the compiler emits no code for the :| assume
statement, which is wrong.
Additional test case
method Main() {
var y;
y :| y == 2;
print y, " ";
assume {:axiom} exists z :: z == 3 && P(z);
y :| y == 3 && P(y);
print y, " ";
y :| assume {:axiom} y == 4 && P(y);
print y, "\n";
}
opaque predicate P(x: int) { true }
Currently, this gives:
% dafny run test.dfy
Dafny program verifier finished with 1 verified, 0 errors
2 3 3
but it should have printed 2 3 4
.
What type of operating system are you experiencing the problem on?
Mac
Metadata
Metadata
Assignees
Labels
A bug in the Dafny compiler that causes a correct Dafny program to execute incorrectlyCrashes, unsoundness, incorrect output, etc. If possible, add a `part:` labelSupport for transpiling Dafny to another language. If relevant, add a `lang:` tagWill consider working on this after in progress work is done