Skip to content
Snippets Groups Projects
Commit 6a0d337c authored by Robin Steiger's avatar Robin Steiger
Browse files

Moved mkInfiniteTree example to demo file.

parent 9e1b8e0b
No related branches found
No related tags found
No related merge requests found
......@@ -133,6 +133,12 @@ object BinarySearchTree {
}) ensuring (contents(_) == contents(tree) -- Set(value))
*/
def mkInfiniteTree(x: Int): Node = {
Node(mkInfiniteTree(x), x, mkInfiniteTree(x))
} ensuring (res =>
res.left != Leaf() && res.right != Leaf()
)
def contains(tree: Tree, value: Int): Boolean = tree match {
case Leaf() => false
case n@Node(l, v, r) => if (v < value) {
......
......@@ -43,14 +43,6 @@ object UnificationTest {
})*/
// Proved by unifier
def mkInfiniteTree(x: Int): Node = {
Node(mkInfiniteTree(x), x, mkInfiniteTree(x))
} ensuring (res =>
res.left != Leaf() && res.right != Leaf()
)
// Cannot be solved yet, due to the presence of an if expression
def insert(tree: Tree, value: Int) : Node = (tree match {
case Leaf() => Node(Leaf(), value, Leaf())
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment