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
datatype List<T> = Nil | Cons(hd:T,tl:List<T>)
predicatec(x:T_,y:T_) decreases x.sz() + y.sz() requires x.i() && y.i()
type T = t:T_ | t.i() witness*datatype T_ = N | P(x:T_,y:T_) {
functionsz():nat { if N? then 1 else 1 + x.sz() + y.sz() }
predicatei() decreasessz() { N? || (x.i() && y.i() &&c(x,y))}
}
functionlSz(l:List<T>):nat { if l.Nil? then 0 else l.hd.sz() +lSz(l.tl) }
functionf(ts:List<T>):List<T>decreaseslSz(ts) { // flattenif ts.Nil? then Nil elseif ts.hd.N? then List<T>.Cons(ts.hd,f(ts.tl))
elseCons(ts.hd.x,Cons(ts.hd.y,ts.tl as List<T_>))
}
Command to run and resulting output
In `f`, removing either the `as List<T_>` or the `List<T>.` prefix of the preceding `Cons` causes verification to fail.
What happened?
Neither of these annotations should be necessary. Note that normally T_ would be hidden from clients, so even the evil as workaround above would not be sufficient.
What type of operating system are you experiencing the problem on?
Mac
The text was updated successfully, but these errors were encountered:
Dafny version
4.9.1
Code to produce this issue
Command to run and resulting output
What happened?
Neither of these annotations should be necessary. Note that normally
T_
would be hidden from clients, so even the evilas
workaround above would not be sufficient.What type of operating system are you experiencing the problem on?
Mac
The text was updated successfully, but these errors were encountered: