Skip to content
Snippets Groups Projects
Commit ed824282 authored by Mirco Dotta's avatar Mirco Dotta
Browse files

Added pre/post condition to mk example

parent e705a25a
No related branches found
No related tags found
No related merge requests found
...@@ -67,8 +67,8 @@ object MiniBDD { ...@@ -67,8 +67,8 @@ object MiniBDD {
def empty2 = Map.empty[(BDD,BDD),BDD] def empty2 = Map.empty[(BDD,BDD),BDD]
def mk_not(x: BDD): BDD = { def mk_not(x: BDD): BDD = {
require(check(x))
val cache = empty val cache = empty
assert(check(x))
def mk_not_rec(cache: Map[BDD,BDD], x: BDD): (Map[BDD,BDD],BDD) = { def mk_not_rec(cache: Map[BDD,BDD], x: BDD): (Map[BDD,BDD],BDD) = {
cache.get(x) match { cache.get(x) match {
...@@ -92,9 +92,8 @@ object MiniBDD { ...@@ -92,9 +92,8 @@ object MiniBDD {
} }
val (_,rv) = mk_not_rec(cache, x) val (_,rv) = mk_not_rec(cache, x)
assert(check(rv))
rv rv
} } ensuring { res => check(res)}
def apply_op(op: Op, b1: Boolean, b2: Boolean): Boolean = op match { def apply_op(op: Op, b1: Boolean, b2: Boolean): Boolean = op match {
case And() => b1 && b2 case And() => b1 && b2
...@@ -174,4 +173,9 @@ object MiniBDD { ...@@ -174,4 +173,9 @@ object MiniBDD {
} }
} }
def main(args: Array[String]) = {
}
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment