You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
function Map<T, U>(s: seq<T>, f: T ~> U): (res: seq<U>)
readsset x, y | x in s && y in f.reads(x) :: y
requiresforall x: T :: x in s ==> f.requires(x)
ensures |res| == |s|
ensuresforall i: nat :: i < |s| ==> res[i] ==f(s[i])
decreases |s|
{
if s == [] then
[]
else
[f(s[0])] +Map(s[1..], f)
}
predicate R<T>(x: T)
predicate P<U>(x: U)
function goo<T, U>(x: T): (r: U)
requiresR(x)
ensuresP(r)
function foo<T, U>(x: seq<T>): (res: seq<U>)
// requires forall a <- x :: R(a)ensuresforall r <- res :: P(r)
{
Map(x, a requires R(a) =>goo(a))
}
Command to run and resulting output
(22,9): Error: a postcondition could not be proved on this return path
|
22 | function foo<T, U>(x: seq<T>): (res: seq<U>)
| ^^^
(24,10): Related location: this is the postcondition that could not be proved
|
24 | ensures forall r <- res :: P(r)
| ^^^^^^^^^^^^^^^^^^^^^^^
(26,2): Error: function precondition could not be proved
|
26 | Map(x, a requires R(a) => goo(a))
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
(3,11): Related location: this proposition could not be proved
|
3 | requires forall x: T :: x in s ==> f.requires(x)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
What happened?
The error message is complaining about the failure to satisfy the post-condition as well. The pre-condition should have turned into an assume for the post-condition to be proven. I also encountered a case where the error message only returned one error complaining about the post-condition and not the pre-condition, which caused some confusion.
What type of operating system are you experiencing the problem on?
Mac
The text was updated successfully, but these errors were encountered:
txiang61
added
the
kind: bug
Crashes, unsoundness, incorrect output, etc. If possible, add a `part:` label
label
Oct 29, 2024
Dafny version
4.8.1
Code to produce this issue
Command to run and resulting output
What happened?
The error message is complaining about the failure to satisfy the post-condition as well. The pre-condition should have turned into an assume for the post-condition to be proven. I also encountered a case where the error message only returned one error complaining about the post-condition and not the pre-condition, which caused some confusion.
What type of operating system are you experiencing the problem on?
Mac
The text was updated successfully, but these errors were encountered: