restored executability of cmp
authornipkow
Mon, 11 Jul 2016 20:40:45 +0200
changeset 63437 b81a6bfa9c23
parent 63436 9974230f9574
child 63438 6b82bad2277f
restored executability of cmp
src/HOL/Data_Structures/Cmp.thy
--- a/src/HOL/Data_Structures/Cmp.thy	Mon Jul 11 11:16:10 2016 +0200
+++ b/src/HOL/Data_Structures/Cmp.thy	Mon Jul 11 20:40:45 2016 +0200
@@ -8,18 +8,14 @@
 
 datatype cmp_val = LT | EQ | GT
 
-function cmp :: "'a:: linorder \<Rightarrow> 'a \<Rightarrow> cmp_val" where
-"x < y \<Longrightarrow> cmp x y = LT" |
-"x = y \<Longrightarrow> cmp x y = EQ" |
-"x > y \<Longrightarrow> cmp x y = GT"
-by (auto, force)
-termination by lexicographic_order
+definition cmp :: "'a:: linorder \<Rightarrow> 'a \<Rightarrow> cmp_val" where
+"cmp x y = (if x < y then LT else if x=y then EQ else GT)"
 
 lemma 
     LT[simp]: "cmp x y = LT \<longleftrightarrow> x < y"
 and EQ[simp]: "cmp x y = EQ \<longleftrightarrow> x = y"
 and GT[simp]: "cmp x y = GT \<longleftrightarrow> x > y"
-by (cases x y rule: linorder_cases, auto)+
+by (auto simp: cmp_def)
 
 lemma case_cmp_if[simp]: "(case c of EQ \<Rightarrow> e | LT \<Rightarrow> l | GT \<Rightarrow> g) =
   (if c = LT then l else if c = GT then g else e)"