Advertisement
ultiprosan

Infinite loop but where?

Feb 25th, 2012
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Scala 0.42 KB | None | 0 0
  1. object Prop {
  2.   def simplify(prop : Prop) : Prop = {
  3.     prop match {
  4.       case Not(Or(a,b)) => simplify(And(Not(a),Not(b)))
  5.       case Not(And(a,b)) => simplify(Or(Not(a),Not(b)))
  6.       case Not(Not(a)) => simplify(a)
  7.       case _ => {
  8.         if (testSimp(prop)) simplify(prop)
  9.         else prop
  10.       }
  11.     }
  12.   }
  13.   def testSimp (prop : Prop) : Boolean = {
  14.     if (simplify(prop) == prop) false
  15.     else true
  16.   }
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement