Skip to content
Snippets Groups Projects
Commit cc6344e8 authored by Viktor Kuncak's avatar Viktor Kuncak
Browse files

drunk function in lists example set

parent b95e12e9
No related branches found
No related tags found
No related merge requests found
...@@ -21,6 +21,11 @@ object ListWithSize { ...@@ -21,6 +21,11 @@ object ListWithSize {
size(l) == 0 || content(l) != Set.empty[Int] size(l) == 0 || content(l) != Set.empty[Int]
} ensuring(_ == true) } ensuring(_ == true)
def drunk(l : List) : List = (l match {
case Nil() => Nil()
case Cons(x,l1) => Cons(x,Cons(x,drunk(l1)))
}) ensuring (size(_) == 2 * size(l))
// proved with unrolling=1 // proved with unrolling=1
def funnyCons(x: Int, l: List) : List = (l match { def funnyCons(x: Int, l: List) : List = (l match {
case Nil() => Cons(x, Nil()) case Nil() => Cons(x, Nil())
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment