exactly1true rewritten (much better when converting to CNF now)
authorwebertj
Fri, 16 Apr 2004 20:34:41 +0200
changeset 14604 1946097f7068
parent 14603 985eb6708207
child 14605 9de4d64eee3b
exactly1true rewritten (much better when converting to CNF now)
src/HOL/Tools/refute.ML
--- a/src/HOL/Tools/refute.ML	Fri Apr 16 20:33:16 2004 +0200
+++ b/src/HOL/Tools/refute.ML	Fri Apr 16 20:34:41 2004 +0200
@@ -210,11 +210,10 @@
 	fun is_satisfying_model model intr satisfy =
 	let
 		(* prop_formula list -> prop_formula *)
-		fun allfalse []      = True
-		  | allfalse (x::xs) = SAnd (SNot x, allfalse xs)
+		fun oneoutoftwofalse []      = True
+		  | oneoutoftwofalse (x::xs) = SAnd (PropLogic.all (map (fn x' => SOr (SNot x, SNot x')) xs), oneoutoftwofalse xs)
 		(* prop_formula list -> prop_formula *)
-		fun exactly1true []      = False
-		  | exactly1true (x::xs) = SOr (SAnd (x, allfalse xs), SAnd (SNot x, exactly1true xs))
+		fun exactly1true xs = SAnd (PropLogic.exists xs, oneoutoftwofalse xs)
 	(* ------------------------------------------------------------------------- *)
 	(* restrict_to_single_element: returns a propositional formula that is true  *)
 	(*      iff the interpretation denotes a single element of its corresponding *)