HOL/Import: Update HOL4 generated files to current Isabelle.
authorCezary Kaliszyk <kaliszyk@in.tum.de>
Wed, 07 Sep 2011 07:59:45 +0900
changeset 44763 b50d5d694838
parent 44762 8f9d09241a68
child 44767 233f30abb040
HOL/Import: Update HOL4 generated files to current Isabelle.
src/HOL/Import/HOL/HOL4Base.thy
src/HOL/Import/HOL/HOL4Prob.thy
src/HOL/Import/HOL/HOL4Real.thy
src/HOL/Import/HOL/HOL4Vec.thy
src/HOL/Import/HOL/HOL4Word32.thy
src/HOL/Import/HOL/arithmetic.imp
src/HOL/Import/HOL/bits.imp
src/HOL/Import/HOL/bool.imp
src/HOL/Import/HOL/combin.imp
src/HOL/Import/HOL/divides.imp
src/HOL/Import/HOL/lim.imp
src/HOL/Import/HOL/list.imp
src/HOL/Import/HOL/num.imp
src/HOL/Import/HOL/option.imp
src/HOL/Import/HOL/pair.imp
src/HOL/Import/HOL/poly.imp
src/HOL/Import/HOL/prim_rec.imp
src/HOL/Import/HOL/prob_extra.imp
src/HOL/Import/HOL/real.imp
src/HOL/Import/HOL/realax.imp
src/HOL/Import/HOL/rich_list.imp
src/HOL/Import/HOL/seq.imp
src/HOL/Import/HOL/sum.imp
src/HOL/Import/HOL/word32.imp
--- a/src/HOL/Import/HOL/HOL4Base.thy	Wed Sep 07 00:08:09 2011 +0200
+++ b/src/HOL/Import/HOL/HOL4Base.thy	Wed Sep 07 07:59:45 2011 +0900
@@ -4,277 +4,225 @@
 
 ;setup_theory bool
 
-definition ARB :: "'a" where 
-  "ARB == SOME x::'a::type. True"
-
-lemma ARB_DEF: "ARB = (SOME x::'a::type. True)"
-  by (import bool ARB_DEF)
-
-definition IN :: "'a => ('a => bool) => bool" where 
-  "IN == %(x::'a::type) f::'a::type => bool. f x"
-
-lemma IN_DEF: "IN = (%(x::'a::type) f::'a::type => bool. f x)"
-  by (import bool IN_DEF)
-
-definition RES_FORALL :: "('a => bool) => ('a => bool) => bool" where 
-  "RES_FORALL ==
-%(p::'a::type => bool) m::'a::type => bool. ALL x::'a::type. IN x p --> m x"
-
-lemma RES_FORALL_DEF: "RES_FORALL =
-(%(p::'a::type => bool) m::'a::type => bool.
-    ALL x::'a::type. IN x p --> m x)"
-  by (import bool RES_FORALL_DEF)
-
-definition RES_EXISTS :: "('a => bool) => ('a => bool) => bool" where 
-  "RES_EXISTS ==
-%(p::'a::type => bool) m::'a::type => bool. EX x::'a::type. IN x p & m x"
-
-lemma RES_EXISTS_DEF: "RES_EXISTS =
-(%(p::'a::type => bool) m::'a::type => bool. EX x::'a::type. IN x p & m x)"
-  by (import bool RES_EXISTS_DEF)
-
-definition RES_EXISTS_UNIQUE :: "('a => bool) => ('a => bool) => bool" where 
+definition
+  ARB :: "'a"  where
+  "ARB == SOME x. True"
+
+lemma ARB_DEF: "ARB = (SOME x. True)"
+  sorry
+
+definition
+  IN :: "'a => ('a => bool) => bool"  where
+  "IN == %x f. f x"
+
+lemma IN_DEF: "IN = (%x f. f x)"
+  sorry
+
+definition
+  RES_FORALL :: "('a => bool) => ('a => bool) => bool"  where
+  "RES_FORALL == %p m. ALL x. IN x p --> m x"
+
+lemma RES_FORALL_DEF: "RES_FORALL = (%p m. ALL x. IN x p --> m x)"
+  sorry
+
+definition
+  RES_EXISTS :: "('a => bool) => ('a => bool) => bool"  where
+  "RES_EXISTS == %p m. EX x. IN x p & m x"
+
+lemma RES_EXISTS_DEF: "RES_EXISTS = (%p m. EX x. IN x p & m x)"
+  sorry
+
+definition
+  RES_EXISTS_UNIQUE :: "('a => bool) => ('a => bool) => bool"  where
   "RES_EXISTS_UNIQUE ==
-%(p::'a::type => bool) m::'a::type => bool.
-   RES_EXISTS p m &
-   RES_FORALL p
-    (%x::'a::type. RES_FORALL p (%y::'a::type. m x & m y --> x = y))"
+%p m. RES_EXISTS p m &
+      RES_FORALL p (%x. RES_FORALL p (%y. m x & m y --> x = y))"
 
 lemma RES_EXISTS_UNIQUE_DEF: "RES_EXISTS_UNIQUE =
-(%(p::'a::type => bool) m::'a::type => bool.
-    RES_EXISTS p m &
-    RES_FORALL p
-     (%x::'a::type. RES_FORALL p (%y::'a::type. m x & m y --> x = y)))"
-  by (import bool RES_EXISTS_UNIQUE_DEF)
-
-definition RES_SELECT :: "('a => bool) => ('a => bool) => 'a" where 
-  "RES_SELECT ==
-%(p::'a::type => bool) m::'a::type => bool. SOME x::'a::type. IN x p & m x"
-
-lemma RES_SELECT_DEF: "RES_SELECT =
-(%(p::'a::type => bool) m::'a::type => bool. SOME x::'a::type. IN x p & m x)"
-  by (import bool RES_SELECT_DEF)
-
-lemma EXCLUDED_MIDDLE: "ALL t::bool. t | ~ t"
-  by (import bool EXCLUDED_MIDDLE)
-
-lemma FORALL_THM: "All (f::'a::type => bool) = All f"
-  by (import bool FORALL_THM)
-
-lemma EXISTS_THM: "Ex (f::'a::type => bool) = Ex f"
-  by (import bool EXISTS_THM)
-
-lemma F_IMP: "ALL t::bool. ~ t --> t --> False"
-  by (import bool F_IMP)
-
-lemma NOT_AND: "~ ((t::bool) & ~ t)"
-  by (import bool NOT_AND)
-
-lemma AND_CLAUSES: "ALL t::bool.
-   (True & t) = t &
-   (t & True) = t & (False & t) = False & (t & False) = False & (t & t) = t"
-  by (import bool AND_CLAUSES)
-
-lemma OR_CLAUSES: "ALL t::bool.
-   (True | t) = True &
-   (t | True) = True & (False | t) = t & (t | False) = t & (t | t) = t"
-  by (import bool OR_CLAUSES)
-
-lemma IMP_CLAUSES: "ALL t::bool.
-   (True --> t) = t &
-   (t --> True) = True &
-   (False --> t) = True & (t --> t) = True & (t --> False) = (~ t)"
-  by (import bool IMP_CLAUSES)
-
-lemma NOT_CLAUSES: "(ALL t::bool. (~ ~ t) = t) & (~ True) = False & (~ False) = True"
-  by (import bool NOT_CLAUSES)
+(%p m. RES_EXISTS p m &
+       RES_FORALL p (%x. RES_FORALL p (%y. m x & m y --> x = y)))"
+  sorry
+
+definition
+  RES_SELECT :: "('a => bool) => ('a => bool) => 'a"  where
+  "RES_SELECT == %p m. SOME x. IN x p & m x"
+
+lemma RES_SELECT_DEF: "RES_SELECT = (%p m. SOME x. IN x p & m x)"
+  sorry
+
+lemma EXCLUDED_MIDDLE: "t | ~ t"
+  sorry
+
+lemma FORALL_THM: "All f = All f"
+  sorry
+
+lemma EXISTS_THM: "Ex f = Ex f"
+  sorry
+
+lemma F_IMP: "[| ~ t; t |] ==> False"
+  sorry
+
+lemma NOT_AND: "~ (t & ~ t)"
+  sorry
+
+lemma AND_CLAUSES: "(True & t) = t &
+(t & True) = t & (False & t) = False & (t & False) = False & (t & t) = t"
+  sorry
+
+lemma OR_CLAUSES: "(True | t) = True &
+(t | True) = True & (False | t) = t & (t | False) = t & (t | t) = t"
+  sorry
+
+lemma IMP_CLAUSES: "(True --> t) = t &
+(t --> True) = True &
+(False --> t) = True & (t --> t) = True & (t --> False) = (~ t)"
+  sorry
+
+lemma NOT_CLAUSES: "(ALL t. (~ ~ t) = t) & (~ True) = False & (~ False) = True"
+  sorry
 
 lemma BOOL_EQ_DISTINCT: "True ~= False & False ~= True"
-  by (import bool BOOL_EQ_DISTINCT)
-
-lemma EQ_CLAUSES: "ALL t::bool.
-   (True = t) = t &
-   (t = True) = t & (False = t) = (~ t) & (t = False) = (~ t)"
-  by (import bool EQ_CLAUSES)
-
-lemma COND_CLAUSES: "ALL (t1::'a::type) t2::'a::type.
-   (if True then t1 else t2) = t1 & (if False then t1 else t2) = t2"
-  by (import bool COND_CLAUSES)
-
-lemma SELECT_UNIQUE: "ALL (P::'a::type => bool) x::'a::type.
-   (ALL y::'a::type. P y = (y = x)) --> Eps P = x"
-  by (import bool SELECT_UNIQUE)
-
-lemma BOTH_EXISTS_AND_THM: "ALL (P::bool) Q::bool.
-   (EX x::'a::type. P & Q) = ((EX x::'a::type. P) & (EX x::'a::type. Q))"
-  by (import bool BOTH_EXISTS_AND_THM)
-
-lemma BOTH_FORALL_OR_THM: "ALL (P::bool) Q::bool.
-   (ALL x::'a::type. P | Q) = ((ALL x::'a::type. P) | (ALL x::'a::type. Q))"
-  by (import bool BOTH_FORALL_OR_THM)
-
-lemma BOTH_FORALL_IMP_THM: "ALL (P::bool) Q::bool.
-   (ALL x::'a::type. P --> Q) =
-   ((EX x::'a::type. P) --> (ALL x::'a::type. Q))"
-  by (import bool BOTH_FORALL_IMP_THM)
-
-lemma BOTH_EXISTS_IMP_THM: "ALL (P::bool) Q::bool.
-   (EX x::'a::type. P --> Q) =
-   ((ALL x::'a::type. P) --> (EX x::'a::type. Q))"
-  by (import bool BOTH_EXISTS_IMP_THM)
-
-lemma OR_IMP_THM: "ALL (A::bool) B::bool. (A = (B | A)) = (B --> A)"
-  by (import bool OR_IMP_THM)
-
-lemma DE_MORGAN_THM: "ALL (A::bool) B::bool. (~ (A & B)) = (~ A | ~ B) & (~ (A | B)) = (~ A & ~ B)"
-  by (import bool DE_MORGAN_THM)
-
-lemma IMP_F_EQ_F: "ALL t::bool. (t --> False) = (t = False)"
-  by (import bool IMP_F_EQ_F)
-
-lemma EQ_EXPAND: "ALL (t1::bool) t2::bool. (t1 = t2) = (t1 & t2 | ~ t1 & ~ t2)"
-  by (import bool EQ_EXPAND)
-
-lemma COND_RATOR: "ALL (b::bool) (f::'a::type => 'b::type) (g::'a::type => 'b::type)
-   x::'a::type. (if b then f else g) x = (if b then f x else g x)"
-  by (import bool COND_RATOR)
-
-lemma COND_ABS: "ALL (b::bool) (f::'a::type => 'b::type) g::'a::type => 'b::type.
-   (%x::'a::type. if b then f x else g x) = (if b then f else g)"
-  by (import bool COND_ABS)
-
-lemma COND_EXPAND: "ALL (b::bool) (t1::bool) t2::bool.
-   (if b then t1 else t2) = ((~ b | t1) & (b | t2))"
-  by (import bool COND_EXPAND)
-
-lemma ONE_ONE_THM: "ALL f::'a::type => 'b::type.
-   inj f = (ALL (x1::'a::type) x2::'a::type. f x1 = f x2 --> x1 = x2)"
-  by (import bool ONE_ONE_THM)
-
-lemma ABS_REP_THM: "(All::(('a::type => bool) => bool) => bool)
- (%P::'a::type => bool.
-     (op -->::bool => bool => bool)
-      ((Ex::(('b::type => 'a::type) => bool) => bool)
-        ((TYPE_DEFINITION::('a::type => bool)
-                           => ('b::type => 'a::type) => bool)
-          P))
-      ((Ex::(('b::type => 'a::type) => bool) => bool)
-        (%x::'b::type => 'a::type.
-            (Ex::(('a::type => 'b::type) => bool) => bool)
-             (%abs::'a::type => 'b::type.
-                 (op &::bool => bool => bool)
-                  ((All::('b::type => bool) => bool)
-                    (%a::'b::type.
-                        (op =::'b::type => 'b::type => bool) (abs (x a)) a))
-                  ((All::('a::type => bool) => bool)
-                    (%r::'a::type.
-                        (op =::bool => bool => bool) (P r)
-                         ((op =::'a::type => 'a::type => bool) (x (abs r))
-                           r)))))))"
-  by (import bool ABS_REP_THM)
-
-lemma LET_RAND: "(P::'b::type => bool) (Let (M::'a::type) (N::'a::type => 'b::type)) =
-(let x::'a::type = M in P (N x))"
-  by (import bool LET_RAND)
-
-lemma LET_RATOR: "Let (M::'a::type) (N::'a::type => 'b::type => 'c::type) (b::'b::type) =
-(let x::'a::type = M in N x b)"
-  by (import bool LET_RATOR)
-
-lemma SWAP_FORALL_THM: "ALL P::'a::type => 'b::type => bool.
-   (ALL x::'a::type. All (P x)) = (ALL (y::'b::type) x::'a::type. P x y)"
-  by (import bool SWAP_FORALL_THM)
-
-lemma SWAP_EXISTS_THM: "ALL P::'a::type => 'b::type => bool.
-   (EX x::'a::type. Ex (P x)) = (EX (y::'b::type) x::'a::type. P x y)"
-  by (import bool SWAP_EXISTS_THM)
-
-lemma AND_CONG: "ALL (P::bool) (P'::bool) (Q::bool) Q'::bool.
-   (Q --> P = P') & (P' --> Q = Q') --> (P & Q) = (P' & Q')"
-  by (import bool AND_CONG)
-
-lemma OR_CONG: "ALL (P::bool) (P'::bool) (Q::bool) Q'::bool.
-   (~ Q --> P = P') & (~ P' --> Q = Q') --> (P | Q) = (P' | Q')"
-  by (import bool OR_CONG)
-
-lemma COND_CONG: "ALL (P::bool) (Q::bool) (x::'a::type) (x'::'a::type) (y::'a::type)
-   y'::'a::type.
-   P = Q & (Q --> x = x') & (~ Q --> y = y') -->
-   (if P then x else y) = (if Q then x' else y')"
-  by (import bool COND_CONG)
-
-lemma MONO_COND: "((x::bool) --> (y::bool)) -->
-((z::bool) --> (w::bool)) -->
-(if b::bool then x else z) --> (if b then y else w)"
-  by (import bool MONO_COND)
-
-lemma SKOLEM_THM: "ALL P::'a::type => 'b::type => bool.
-   (ALL x::'a::type. Ex (P x)) =
-   (EX f::'a::type => 'b::type. ALL x::'a::type. P x (f x))"
-  by (import bool SKOLEM_THM)
-
-lemma bool_case_thm: "(ALL (e0::'a::type) e1::'a::type.
-    (case True of True => e0 | False => e1) = e0) &
-(ALL (e0::'a::type) e1::'a::type.
-    (case False of True => e0 | False => e1) = e1)"
-  by (import bool bool_case_thm)
-
-lemma bool_case_ID: "ALL (x::'a::type) b::bool. (case b of True => x | _ => x) = x"
-  by (import bool bool_case_ID)
-
-lemma boolAxiom: "ALL (e0::'a::type) e1::'a::type.
-   EX x::bool => 'a::type. x True = e0 & x False = e1"
-  by (import bool boolAxiom)
-
-lemma UEXISTS_OR_THM: "ALL (P::'a::type => bool) Q::'a::type => bool.
-   (EX! x::'a::type. P x | Q x) --> Ex1 P | Ex1 Q"
-  by (import bool UEXISTS_OR_THM)
-
-lemma UEXISTS_SIMP: "(EX! x::'a::type. (t::bool)) = (t & (ALL x::'a::type. All (op = x)))"
-  by (import bool UEXISTS_SIMP)
+  sorry
+
+lemma EQ_CLAUSES: "(True = t) = t & (t = True) = t & (False = t) = (~ t) & (t = False) = (~ t)"
+  sorry
+
+lemma COND_CLAUSES: "(if True then t1 else t2) = t1 & (if False then t1 else t2) = t2"
+  sorry
+
+lemma SELECT_UNIQUE: "(!!y. P y = (y = x)) ==> Eps P = x"
+  sorry
+
+lemma BOTH_EXISTS_AND_THM: "(EX x::'a. (P::bool) & (Q::bool)) = ((EX x::'a. P) & (EX x::'a. Q))"
+  sorry
+
+lemma BOTH_FORALL_OR_THM: "(ALL x::'a. (P::bool) | (Q::bool)) = ((ALL x::'a. P) | (ALL x::'a. Q))"
+  sorry
+
+lemma BOTH_FORALL_IMP_THM: "(ALL x::'a. (P::bool) --> (Q::bool)) = ((EX x::'a. P) --> (ALL x::'a. Q))"
+  sorry
+
+lemma BOTH_EXISTS_IMP_THM: "(EX x::'a. (P::bool) --> (Q::bool)) = ((ALL x::'a. P) --> (EX x::'a. Q))"
+  sorry
+
+lemma OR_IMP_THM: "(A = (B | A)) = (B --> A)"
+  sorry
+
+lemma DE_MORGAN_THM: "(~ (A & B)) = (~ A | ~ B) & (~ (A | B)) = (~ A & ~ B)"
+  sorry
+
+lemma IMP_F_EQ_F: "(t --> False) = (t = False)"
+  sorry
+
+lemma COND_RATOR: "(if b::bool then f::'a => 'b else (g::'a => 'b)) (x::'a) =
+(if b then f x else g x)"
+  sorry
+
+lemma COND_ABS: "(%x. if b then f x else g x) = (if b then f else g)"
+  sorry
+
+lemma COND_EXPAND: "(if b then t1 else t2) = ((~ b | t1) & (b | t2))"
+  sorry
+
+lemma ONE_ONE_THM: "inj f = (ALL x1 x2. f x1 = f x2 --> x1 = x2)"
+  sorry
+
+lemma ABS_REP_THM: "(op ==>::prop => prop => prop)
+ ((Trueprop::bool => prop)
+   ((Ex::(('b::type => 'a::type) => bool) => bool)
+     ((TYPE_DEFINITION::('a::type => bool)
+                        => ('b::type => 'a::type) => bool)
+       (P::'a::type => bool))))
+ ((Trueprop::bool => prop)
+   ((Ex::(('b::type => 'a::type) => bool) => bool)
+     (%x::'b::type => 'a::type.
+         (Ex::(('a::type => 'b::type) => bool) => bool)
+          (%abs::'a::type => 'b::type.
+              (op &::bool => bool => bool)
+               ((All::('b::type => bool) => bool)
+                 (%a::'b::type.
+                     (op =::'b::type => 'b::type => bool) (abs (x a)) a))
+               ((All::('a::type => bool) => bool)
+                 (%r::'a::type.
+                     (op =::bool => bool => bool) (P r)
+                      ((op =::'a::type => 'a::type => bool) (x (abs r))
+                        r)))))))"
+  sorry
+
+lemma LET_RAND: "(P::'b => bool) (Let (M::'a) (N::'a => 'b)) = (let x::'a = M in P (N x))"
+  sorry
+
+lemma LET_RATOR: "Let (M::'a) (N::'a => 'b => 'c) (b::'b) = (let x::'a = M in N x b)"
+  sorry
+
+lemma AND_CONG: "(Q --> P = P') & (P' --> Q = Q') ==> (P & Q) = (P' & Q')"
+  sorry
+
+lemma OR_CONG: "(~ Q --> P = P') & (~ P' --> Q = Q') ==> (P | Q) = (P' | Q')"
+  sorry
+
+lemma COND_CONG: "P = Q & (Q --> x = x') & (~ Q --> y = y')
+==> (if P then x else y) = (if Q then x' else y')"
+  sorry
+
+lemma MONO_COND: "[| x ==> y; z ==> w; if b then x else z |] ==> if b then y else w"
+  sorry
+
+lemma SKOLEM_THM: "(ALL x. Ex (P x)) = (EX f. ALL x. P x (f x))"
+  sorry
+
+lemma bool_case_thm: "(ALL (e0::'a) e1::'a. (case True of True => e0 | False => e1) = e0) &
+(ALL (e0::'a) e1::'a. (case False of True => e0 | False => e1) = e1)"
+  sorry
+
+lemma bool_case_ID: "(case b of True => x | _ => x) = x"
+  sorry
+
+lemma boolAxiom: "EX x. x True = e0 & x False = e1"
+  sorry
+
+lemma UEXISTS_OR_THM: "EX! x. P x | Q x ==> Ex1 P | Ex1 Q"
+  sorry
+
+lemma UEXISTS_SIMP: "(EX! x::'a. (t::bool)) = (t & (ALL x::'a. All (op = x)))"
+  sorry
 
 consts
   RES_ABSTRACT :: "('a => bool) => ('a => 'b) => 'a => 'b" 
 
-specification (RES_ABSTRACT) RES_ABSTRACT_DEF: "(ALL (p::'a::type => bool) (m::'a::type => 'b::type) x::'a::type.
+specification (RES_ABSTRACT) RES_ABSTRACT_DEF: "(ALL (p::'a => bool) (m::'a => 'b) x::'a.
     IN x p --> RES_ABSTRACT p m x = m x) &
-(ALL (p::'a::type => bool) (m1::'a::type => 'b::type)
-    m2::'a::type => 'b::type.
-    (ALL x::'a::type. IN x p --> m1 x = m2 x) -->
+(ALL (p::'a => bool) (m1::'a => 'b) m2::'a => 'b.
+    (ALL x::'a. IN x p --> m1 x = m2 x) -->
     RES_ABSTRACT p m1 = RES_ABSTRACT p m2)"
-  by (import bool RES_ABSTRACT_DEF)
-
-lemma BOOL_FUN_CASES_THM: "ALL f::bool => bool.
-   f = (%b::bool. True) |
-   f = (%b::bool. False) | f = (%b::bool. b) | f = Not"
-  by (import bool BOOL_FUN_CASES_THM)
-
-lemma BOOL_FUN_INDUCT: "ALL P::(bool => bool) => bool.
-   P (%b::bool. True) & P (%b::bool. False) & P (%b::bool. b) & P Not -->
-   All P"
-  by (import bool BOOL_FUN_INDUCT)
+  sorry
+
+lemma BOOL_FUN_CASES_THM: "f = (%b. True) | f = (%b. False) | f = (%b. b) | f = Not"
+  sorry
+
+lemma BOOL_FUN_INDUCT: "P (%b. True) & P (%b. False) & P (%b. b) & P Not ==> P x"
+  sorry
 
 ;end_setup
 
 ;setup_theory combin
 
-definition K :: "'a => 'b => 'a" where 
-  "K == %(x::'a::type) y::'b::type. x"
-
-lemma K_DEF: "K = (%(x::'a::type) y::'b::type. x)"
-  by (import combin K_DEF)
-
-definition S :: "('a => 'b => 'c) => ('a => 'b) => 'a => 'c" where 
-  "S ==
-%(f::'a::type => 'b::type => 'c::type) (g::'a::type => 'b::type)
-   x::'a::type. f x (g x)"
-
-lemma S_DEF: "S =
-(%(f::'a::type => 'b::type => 'c::type) (g::'a::type => 'b::type)
-    x::'a::type. f x (g x))"
-  by (import combin S_DEF)
-
-definition I :: "'a => 'a" where 
+definition
+  K :: "'a => 'b => 'a"  where
+  "K == %x y. x"
+
+lemma K_DEF: "K = (%x y. x)"
+  sorry
+
+definition
+  S :: "('a => 'b => 'c) => ('a => 'b) => 'a => 'c"  where
+  "S == %f g x. f x (g x)"
+
+lemma S_DEF: "S = (%f g x. f x (g x))"
+  sorry
+
+definition
+  I :: "'a => 'a"  where
   "(op ==::('a::type => 'a::type) => ('a::type => 'a::type) => prop)
  (I::'a::type => 'a::type)
  ((S::('a::type => ('a::type => 'a::type) => 'a::type)
@@ -288,47 +236,46 @@
       => ('a::type => 'a::type => 'a::type) => 'a::type => 'a::type)
    (K::'a::type => ('a::type => 'a::type) => 'a::type)
    (K::'a::type => 'a::type => 'a::type))"
-  by (import combin I_DEF)
-
-definition C :: "('a => 'b => 'c) => 'b => 'a => 'c" where 
-  "C == %(f::'a::type => 'b::type => 'c::type) (x::'b::type) y::'a::type. f y x"
-
-lemma C_DEF: "C =
-(%(f::'a::type => 'b::type => 'c::type) (x::'b::type) y::'a::type. f y x)"
-  by (import combin C_DEF)
-
-definition W :: "('a => 'a => 'b) => 'a => 'b" where 
-  "W == %(f::'a::type => 'a::type => 'b::type) x::'a::type. f x x"
-
-lemma W_DEF: "W = (%(f::'a::type => 'a::type => 'b::type) x::'a::type. f x x)"
-  by (import combin W_DEF)
-
-lemma I_THM: "ALL x::'a::type. I x = x"
-  by (import combin I_THM)
-
-lemma I_o_ID: "ALL f::'a::type => 'b::type. I o f = f & f o I = f"
-  by (import combin I_o_ID)
+  sorry
+
+definition
+  C :: "('a => 'b => 'c) => 'b => 'a => 'c"  where
+  "C == %f x y. f y x"
+
+lemma C_DEF: "C = (%f x y. f y x)"
+  sorry
+
+definition
+  W :: "('a => 'a => 'b) => 'a => 'b"  where
+  "W == %f x. f x x"
+
+lemma W_DEF: "W = (%f x. f x x)"
+  sorry
+
+lemma I_THM: "I x = x"
+  sorry
+
+lemma I_o_ID: "I o f = f & f o I = f"
+  sorry
 
 ;end_setup
 
 ;setup_theory sum
 
-lemma ISL_OR_ISR: "ALL x::'a::type + 'b::type. ISL x | ISR x"
-  by (import sum ISL_OR_ISR)
-
-lemma INL: "ALL x::'a::type + 'b::type. ISL x --> Inl (OUTL x) = x"
-  by (import sum INL)
-
-lemma INR: "ALL x::'a::type + 'b::type. ISR x --> Inr (OUTR x) = x"
-  by (import sum INR)
-
-lemma sum_case_cong: "ALL (M::'b::type + 'c::type) (M'::'b::type + 'c::type)
-   (f::'b::type => 'a::type) g::'c::type => 'a::type.
-   M = M' &
-   (ALL x::'b::type. M' = Inl x --> f x = (f'::'b::type => 'a::type) x) &
-   (ALL y::'c::type. M' = Inr y --> g y = (g'::'c::type => 'a::type) y) -->
-   sum_case f g M = sum_case f' g' M'"
-  by (import sum sum_case_cong)
+lemma ISL_OR_ISR: "ISL x | ISR x"
+  sorry
+
+lemma INL: "ISL x ==> Inl (OUTL x) = x"
+  sorry
+
+lemma INR: "ISR x ==> Inr (OUTR x) = x"
+  sorry
+
+lemma sum_case_cong: "(M::'b + 'c) = (M'::'b + 'c) &
+(ALL x::'b. M' = Inl x --> (f::'b => 'a) x = (f'::'b => 'a) x) &
+(ALL y::'c. M' = Inr y --> (g::'c => 'a) y = (g'::'c => 'a) y)
+==> sum_case f g M = sum_case f' g' M'"
+  sorry
 
 ;end_setup
 
@@ -345,34 +292,34 @@
         (%y::'a::type.
             (op =::bool => bool => bool)
              ((op =::'a::type option => 'a::type option => bool)
-               ((Some::'a::type ~=> 'a::type) x)
-               ((Some::'a::type ~=> 'a::type) y))
+               ((Some::'a::type => 'a::type option) x)
+               ((Some::'a::type => 'a::type option) y))
              ((op =::'a::type => 'a::type => bool) x y))))
  ((op &::bool => bool => bool)
    ((All::('a::type => bool) => bool)
      (%x::'a::type.
          (op =::'a::type => 'a::type => bool)
           ((the::'a::type option => 'a::type)
-            ((Some::'a::type ~=> 'a::type) x))
+            ((Some::'a::type => 'a::type option) x))
           x))
    ((op &::bool => bool => bool)
      ((All::('a::type => bool) => bool)
        (%x::'a::type.
-           (Not::bool => bool)
-            ((op =::'a::type option => 'a::type option => bool)
-              (None::'a::type option) ((Some::'a::type ~=> 'a::type) x))))
+           (op ~=::'a::type option => 'a::type option => bool)
+            (None::'a::type option)
+            ((Some::'a::type => 'a::type option) x)))
      ((op &::bool => bool => bool)
        ((All::('a::type => bool) => bool)
          (%x::'a::type.
-             (Not::bool => bool)
-              ((op =::'a::type option => 'a::type option => bool)
-                ((Some::'a::type ~=> 'a::type) x) (None::'a::type option))))
+             (op ~=::'a::type option => 'a::type option => bool)
+              ((Some::'a::type => 'a::type option) x)
+              (None::'a::type option)))
        ((op &::bool => bool => bool)
          ((All::('a::type => bool) => bool)
            (%x::'a::type.
                (op =::bool => bool => bool)
                 ((IS_SOME::'a::type option => bool)
-                  ((Some::'a::type ~=> 'a::type) x))
+                  ((Some::'a::type => 'a::type option) x))
                 (True::bool)))
          ((op &::bool => bool => bool)
            ((op =::bool => bool => bool)
@@ -399,7 +346,7 @@
                        (op -->::bool => bool => bool)
                         ((IS_SOME::'a::type option => bool) x)
                         ((op =::'a::type option => 'a::type option => bool)
-                          ((Some::'a::type ~=> 'a::type)
+                          ((Some::'a::type => 'a::type option)
                             ((the::'a::type option => 'a::type) x))
                           x)))
                  ((op &::bool => bool => bool)
@@ -407,9 +354,9 @@
                      (%x::'a::type option.
                          (op =::'a::type option => 'a::type option => bool)
                           ((option_case::'a::type option
-   => ('a::type ~=> 'a::type) => 'a::type option ~=> 'a::type)
+   => ('a::type => 'a::type option) => 'a::type option => 'a::type option)
                             (None::'a::type option)
-                            (Some::'a::type ~=> 'a::type) x)
+                            (Some::'a::type => 'a::type option) x)
                           x))
                    ((op &::bool => bool => bool)
                      ((All::('a::type option => bool) => bool)
@@ -417,8 +364,8 @@
                            (op =::'a::type option
                                   => 'a::type option => bool)
                             ((option_case::'a::type option
-     => ('a::type ~=> 'a::type) => 'a::type option ~=> 'a::type)
-                              x (Some::'a::type ~=> 'a::type) x)
+     => ('a::type => 'a::type option) => 'a::type option => 'a::type option)
+                              x (Some::'a::type => 'a::type option) x)
                             x))
                      ((op &::bool => bool => bool)
                        ((All::('a::type option => bool) => bool)
@@ -449,8 +396,9 @@
                                   ((op =::'a::type option
     => 'a::type option => bool)
                                     ((option_case::'a::type option
-             => ('a::type ~=> 'a::type) => 'a::type option ~=> 'a::type)
-(ea::'a::type option) (Some::'a::type ~=> 'a::type) x)
+             => ('a::type => 'a::type option)
+                => 'a::type option => 'a::type option)
+(ea::'a::type option) (Some::'a::type => 'a::type option) x)
                                     x)))
                            ((op &::bool => bool => bool)
                              ((All::('b::type => bool) => bool)
@@ -475,7 +423,7 @@
           ((option_case::'b::type
                          => ('a::type => 'b::type)
                             => 'a::type option => 'b::type)
-            u f ((Some::'a::type ~=> 'a::type) x))
+            u f ((Some::'a::type => 'a::type option) x))
           (f x)))))
                                ((op &::bool => bool => bool)
                                  ((All::(('a::type => 'b::type) => bool)
@@ -484,51 +432,48 @@
  (All::('a::type => bool) => bool)
   (%x::'a::type.
       (op =::'b::type option => 'b::type option => bool)
-       ((option_map::('a::type => 'b::type) => 'a::type option ~=> 'b::type)
-         f ((Some::'a::type ~=> 'a::type) x))
-       ((Some::'b::type ~=> 'b::type) (f x)))))
+       ((Option.map::('a::type => 'b::type)
+                     => 'a::type option => 'b::type option)
+         f ((Some::'a::type => 'a::type option) x))
+       ((Some::'b::type => 'b::type option) (f x)))))
                                  ((op &::bool => bool => bool)
                                    ((All::(('a::type => 'b::type) => bool)
     => bool)
                                      (%f::'a::type => 'b::type.
    (op =::'b::type option => 'b::type option => bool)
-    ((option_map::('a::type => 'b::type) => 'a::type option ~=> 'b::type) f
-      (None::'a::type option))
+    ((Option.map::('a::type => 'b::type)
+                  => 'a::type option => 'b::type option)
+      f (None::'a::type option))
     (None::'b::type option)))
                                    ((op &::bool => bool => bool)
                                      ((op =::'a::type option
        => 'a::type option => bool)
- ((OPTION_JOIN::'a::type option option ~=> 'a::type)
+ ((OPTION_JOIN::'a::type option option => 'a::type option)
    (None::'a::type option option))
  (None::'a::type option))
                                      ((All::('a::type option => bool)
       => bool)
  (%x::'a::type option.
      (op =::'a::type option => 'a::type option => bool)
-      ((OPTION_JOIN::'a::type option option ~=> 'a::type)
-        ((Some::'a::type option ~=> 'a::type option) x))
+      ((OPTION_JOIN::'a::type option option => 'a::type option)
+        ((Some::'a::type option => 'a::type option option) x))
       x))))))))))))))))))))"
-  by (import option option_CLAUSES)
-
-lemma option_case_compute: "option_case (e::'b::type) (f::'a::type => 'b::type) (x::'a::type option) =
+  sorry
+
+lemma option_case_compute: "option_case (e::'b) (f::'a => 'b) (x::'a option) =
 (if IS_SOME x then f (the x) else e)"
-  by (import option option_case_compute)
-
-lemma OPTION_MAP_EQ_SOME: "ALL (f::'a::type => 'b::type) (x::'a::type option) y::'b::type.
-   (option_map f x = Some y) = (EX z::'a::type. x = Some z & y = f z)"
-  by (import option OPTION_MAP_EQ_SOME)
-
-lemma OPTION_JOIN_EQ_SOME: "ALL (x::'a::type option option) xa::'a::type.
-   (OPTION_JOIN x = Some xa) = (x = Some (Some xa))"
-  by (import option OPTION_JOIN_EQ_SOME)
-
-lemma option_case_cong: "ALL (M::'a::type option) (M'::'a::type option) (u::'b::type)
-   f::'a::type => 'b::type.
-   M = M' &
-   (M' = None --> u = (u'::'b::type)) &
-   (ALL x::'a::type. M' = Some x --> f x = (f'::'a::type => 'b::type) x) -->
-   option_case u f M = option_case u' f' M'"
-  by (import option option_case_cong)
+  sorry
+
+lemma OPTION_MAP_EQ_SOME: "(Option.map (f::'a => 'b) (x::'a option) = Some (y::'b)) =
+(EX z::'a. x = Some z & y = f z)"
+  sorry
+
+lemma OPTION_JOIN_EQ_SOME: "(OPTION_JOIN x = Some xa) = (x = Some (Some xa))"
+  sorry
+
+lemma option_case_cong: "M = M' & (M' = None --> u = u') & (ALL x. M' = Some x --> f x = f' x)
+==> option_case u f M = option_case u' f' M'"
+  sorry
 
 ;end_setup
 
@@ -538,531 +483,341 @@
   stmarker :: "'a => 'a" 
 
 defs
-  stmarker_primdef: "stmarker == %x::'a::type. x"
-
-lemma stmarker_def: "ALL x::'a::type. stmarker x = x"
-  by (import marker stmarker_def)
-
-lemma move_left_conj: "ALL (x::bool) (xa::bool) xb::bool.
-   (x & stmarker xb) = (stmarker xb & x) &
-   ((stmarker xb & x) & xa) = (stmarker xb & x & xa) &
-   (x & stmarker xb & xa) = (stmarker xb & x & xa)"
-  by (import marker move_left_conj)
-
-lemma move_right_conj: "ALL (x::bool) (xa::bool) xb::bool.
-   (stmarker xb & x) = (x & stmarker xb) &
-   (x & xa & stmarker xb) = ((x & xa) & stmarker xb) &
-   ((x & stmarker xb) & xa) = ((x & xa) & stmarker xb)"
-  by (import marker move_right_conj)
-
-lemma move_left_disj: "ALL (x::bool) (xa::bool) xb::bool.
-   (x | stmarker xb) = (stmarker xb | x) &
-   ((stmarker xb | x) | xa) = (stmarker xb | x | xa) &
-   (x | stmarker xb | xa) = (stmarker xb | x | xa)"
-  by (import marker move_left_disj)
-
-lemma move_right_disj: "ALL (x::bool) (xa::bool) xb::bool.
-   (stmarker xb | x) = (x | stmarker xb) &
-   (x | xa | stmarker xb) = ((x | xa) | stmarker xb) &
-   ((x | stmarker xb) | xa) = ((x | xa) | stmarker xb)"
-  by (import marker move_right_disj)
+  stmarker_primdef: "stmarker == %x. x"
+
+lemma stmarker_def: "stmarker x = x"
+  sorry
+
+lemma move_left_conj: "(x & stmarker xb) = (stmarker xb & x) &
+((stmarker xb & x) & xa) = (stmarker xb & x & xa) &
+(x & stmarker xb & xa) = (stmarker xb & x & xa)"
+  sorry
+
+lemma move_right_conj: "(stmarker xb & x) = (x & stmarker xb) &
+(x & xa & stmarker xb) = ((x & xa) & stmarker xb) &
+((x & stmarker xb) & xa) = ((x & xa) & stmarker xb)"
+  sorry
+
+lemma move_left_disj: "(x | stmarker xb) = (stmarker xb | x) &
+((stmarker xb | x) | xa) = (stmarker xb | x | xa) &
+(x | stmarker xb | xa) = (stmarker xb | x | xa)"
+  sorry
+
+lemma move_right_disj: "(stmarker xb | x) = (x | stmarker xb) &
+(x | xa | stmarker xb) = ((x | xa) | stmarker xb) &
+((x | stmarker xb) | xa) = ((x | xa) | stmarker xb)"
+  sorry
 
 ;end_setup
 
 ;setup_theory relation
 
-definition TC :: "('a => 'a => bool) => 'a => 'a => bool" where 
+definition
+  TC :: "('a => 'a => bool) => 'a => 'a => bool"  where
   "TC ==
-%(R::'a::type => 'a::type => bool) (a::'a::type) b::'a::type.
-   ALL P::'a::type => 'a::type => bool.
-      (ALL (x::'a::type) y::'a::type. R x y --> P x y) &
-      (ALL (x::'a::type) (y::'a::type) z::'a::type.
-          P x y & P y z --> P x z) -->
+%R a b.
+   ALL P.
+      (ALL x y. R x y --> P x y) & (ALL x y z. P x y & P y z --> P x z) -->
       P a b"
 
-lemma TC_DEF: "ALL (R::'a::type => 'a::type => bool) (a::'a::type) b::'a::type.
-   TC R a b =
-   (ALL P::'a::type => 'a::type => bool.
-       (ALL (x::'a::type) y::'a::type. R x y --> P x y) &
-       (ALL (x::'a::type) (y::'a::type) z::'a::type.
-           P x y & P y z --> P x z) -->
-       P a b)"
-  by (import relation TC_DEF)
-
-definition RTC :: "('a => 'a => bool) => 'a => 'a => bool" where 
+lemma TC_DEF: "TC R a b =
+(ALL P.
+    (ALL x y. R x y --> P x y) & (ALL x y z. P x y & P y z --> P x z) -->
+    P a b)"
+  sorry
+
+definition
+  RTC :: "('a => 'a => bool) => 'a => 'a => bool"  where
   "RTC ==
-%(R::'a::type => 'a::type => bool) (a::'a::type) b::'a::type.
-   ALL P::'a::type => 'a::type => bool.
-      (ALL x::'a::type. P x x) &
-      (ALL (x::'a::type) (y::'a::type) z::'a::type.
-          R x y & P y z --> P x z) -->
-      P a b"
-
-lemma RTC_DEF: "ALL (R::'a::type => 'a::type => bool) (a::'a::type) b::'a::type.
-   RTC R a b =
-   (ALL P::'a::type => 'a::type => bool.
-       (ALL x::'a::type. P x x) &
-       (ALL (x::'a::type) (y::'a::type) z::'a::type.
-           R x y & P y z --> P x z) -->
-       P a b)"
-  by (import relation RTC_DEF)
+%R a b.
+   ALL P. (ALL x. P x x) & (ALL x y z. R x y & P y z --> P x z) --> P a b"
+
+lemma RTC_DEF: "RTC R a b =
+(ALL P. (ALL x. P x x) & (ALL x y z. R x y & P y z --> P x z) --> P a b)"
+  sorry
 
 consts
   RC :: "('a => 'a => bool) => 'a => 'a => bool" 
 
 defs
-  RC_primdef: "RC ==
-%(R::'a::type => 'a::type => bool) (x::'a::type) y::'a::type. x = y | R x y"
-
-lemma RC_def: "ALL (R::'a::type => 'a::type => bool) (x::'a::type) y::'a::type.
-   RC R x y = (x = y | R x y)"
-  by (import relation RC_def)
+  RC_primdef: "RC == %R x y. x = y | R x y"
+
+lemma RC_def: "RC R x y = (x = y | R x y)"
+  sorry
 
 consts
   transitive :: "('a => 'a => bool) => bool" 
 
 defs
-  transitive_primdef: "transitive ==
-%R::'a::type => 'a::type => bool.
-   ALL (x::'a::type) (y::'a::type) z::'a::type. R x y & R y z --> R x z"
-
-lemma transitive_def: "ALL R::'a::type => 'a::type => bool.
-   transitive R =
-   (ALL (x::'a::type) (y::'a::type) z::'a::type. R x y & R y z --> R x z)"
-  by (import relation transitive_def)
-
-definition pred_reflexive :: "('a => 'a => bool) => bool" where 
-  "pred_reflexive == %R::'a::type => 'a::type => bool. ALL x::'a::type. R x x"
-
-lemma reflexive_def: "ALL R::'a::type => 'a::type => bool.
-   pred_reflexive R = (ALL x::'a::type. R x x)"
-  by (import relation reflexive_def)
-
-lemma TC_TRANSITIVE: "ALL x::'a::type => 'a::type => bool. transitive (TC x)"
-  by (import relation TC_TRANSITIVE)
-
-lemma RTC_INDUCT: "ALL (x::'a::type => 'a::type => bool) xa::'a::type => 'a::type => bool.
-   (ALL x::'a::type. xa x x) &
-   (ALL (xb::'a::type) (y::'a::type) z::'a::type.
-       x xb y & xa y z --> xa xb z) -->
-   (ALL (xb::'a::type) xc::'a::type. RTC x xb xc --> xa xb xc)"
-  by (import relation RTC_INDUCT)
-
-lemma TC_RULES: "ALL x::'a::type => 'a::type => bool.
-   (ALL (xa::'a::type) xb::'a::type. x xa xb --> TC x xa xb) &
-   (ALL (xa::'a::type) (xb::'a::type) xc::'a::type.
-       TC x xa xb & TC x xb xc --> TC x xa xc)"
-  by (import relation TC_RULES)
-
-lemma RTC_RULES: "ALL x::'a::type => 'a::type => bool.
-   (ALL xa::'a::type. RTC x xa xa) &
-   (ALL (xa::'a::type) (xb::'a::type) xc::'a::type.
-       x xa xb & RTC x xb xc --> RTC x xa xc)"
-  by (import relation RTC_RULES)
-
-lemma RTC_STRONG_INDUCT: "ALL (R::'a::type => 'a::type => bool) P::'a::type => 'a::type => bool.
-   (ALL x::'a::type. P x x) &
-   (ALL (x::'a::type) (y::'a::type) z::'a::type.
-       R x y & RTC R y z & P y z --> P x z) -->
-   (ALL (x::'a::type) y::'a::type. RTC R x y --> P x y)"
-  by (import relation RTC_STRONG_INDUCT)
-
-lemma RTC_RTC: "ALL (R::'a::type => 'a::type => bool) (x::'a::type) y::'a::type.
-   RTC R x y --> (ALL z::'a::type. RTC R y z --> RTC R x z)"
-  by (import relation RTC_RTC)
-
-lemma RTC_TRANSITIVE: "ALL x::'a::type => 'a::type => bool. transitive (RTC x)"
-  by (import relation RTC_TRANSITIVE)
-
-lemma RTC_REFLEXIVE: "ALL R::'a::type => 'a::type => bool. pred_reflexive (RTC R)"
-  by (import relation RTC_REFLEXIVE)
-
-lemma RC_REFLEXIVE: "ALL R::'a::type => 'a::type => bool. pred_reflexive (RC R)"
-  by (import relation RC_REFLEXIVE)
-
-lemma TC_SUBSET: "ALL (x::'a::type => 'a::type => bool) (xa::'a::type) xb::'a::type.
-   x xa xb --> TC x xa xb"
-  by (import relation TC_SUBSET)
-
-lemma RTC_SUBSET: "ALL (R::'a::type => 'a::type => bool) (x::'a::type) y::'a::type.
-   R x y --> RTC R x y"
-  by (import relation RTC_SUBSET)
-
-lemma RC_SUBSET: "ALL (R::'a::type => 'a::type => bool) (x::'a::type) y::'a::type.
-   R x y --> RC R x y"
-  by (import relation RC_SUBSET)
-
-lemma RC_RTC: "ALL (R::'a::type => 'a::type => bool) (x::'a::type) y::'a::type.
-   RC R x y --> RTC R x y"
-  by (import relation RC_RTC)
-
-lemma TC_INDUCT: "ALL (x::'a::type => 'a::type => bool) xa::'a::type => 'a::type => bool.
-   (ALL (xb::'a::type) y::'a::type. x xb y --> xa xb y) &
-   (ALL (x::'a::type) (y::'a::type) z::'a::type.
-       xa x y & xa y z --> xa x z) -->
-   (ALL (xb::'a::type) xc::'a::type. TC x xb xc --> xa xb xc)"
-  by (import relation TC_INDUCT)
-
-lemma TC_INDUCT_LEFT1: "ALL (x::'a::type => 'a::type => bool) xa::'a::type => 'a::type => bool.
-   (ALL (xb::'a::type) y::'a::type. x xb y --> xa xb y) &
-   (ALL (xb::'a::type) (y::'a::type) z::'a::type.
-       x xb y & xa y z --> xa xb z) -->
-   (ALL (xb::'a::type) xc::'a::type. TC x xb xc --> xa xb xc)"
-  by (import relation TC_INDUCT_LEFT1)
-
-lemma TC_STRONG_INDUCT: "ALL (R::'a::type => 'a::type => bool) P::'a::type => 'a::type => bool.
-   (ALL (x::'a::type) y::'a::type. R x y --> P x y) &
-   (ALL (x::'a::type) (y::'a::type) z::'a::type.
-       P x y & P y z & TC R x y & TC R y z --> P x z) -->
-   (ALL (u::'a::type) v::'a::type. TC R u v --> P u v)"
-  by (import relation TC_STRONG_INDUCT)
-
-lemma TC_STRONG_INDUCT_LEFT1: "ALL (R::'a::type => 'a::type => bool) P::'a::type => 'a::type => bool.
-   (ALL (x::'a::type) y::'a::type. R x y --> P x y) &
-   (ALL (x::'a::type) (y::'a::type) z::'a::type.
-       R x y & P y z & TC R y z --> P x z) -->
-   (ALL (u::'a::type) v::'a::type. TC R u v --> P u v)"
-  by (import relation TC_STRONG_INDUCT_LEFT1)
-
-lemma TC_RTC: "ALL (R::'a::type => 'a::type => bool) (x::'a::type) y::'a::type.
-   TC R x y --> RTC R x y"
-  by (import relation TC_RTC)
-
-lemma RTC_TC_RC: "ALL (R::'a::type => 'a::type => bool) (x::'a::type) y::'a::type.
-   RTC R x y --> RC R x y | TC R x y"
-  by (import relation RTC_TC_RC)
-
-lemma TC_RC_EQNS: "ALL R::'a::type => 'a::type => bool. RC (TC R) = RTC R & TC (RC R) = RTC R"
-  by (import relation TC_RC_EQNS)
-
-lemma RC_IDEM: "ALL R::'a::type => 'a::type => bool. RC (RC R) = RC R"
-  by (import relation RC_IDEM)
-
-lemma TC_IDEM: "ALL R::'a::type => 'a::type => bool. TC (TC R) = TC R"
-  by (import relation TC_IDEM)
-
-lemma RTC_IDEM: "ALL R::'a::type => 'a::type => bool. RTC (RTC R) = RTC R"
-  by (import relation RTC_IDEM)
-
-lemma RTC_CASES1: "ALL (x::'a::type => 'a::type => bool) (xa::'a::type) xb::'a::type.
-   RTC x xa xb = (xa = xb | (EX u::'a::type. x xa u & RTC x u xb))"
-  by (import relation RTC_CASES1)
-
-lemma RTC_CASES2: "ALL (x::'a::type => 'a::type => bool) (xa::'a::type) xb::'a::type.
-   RTC x xa xb = (xa = xb | (EX u::'a::type. RTC x xa u & x u xb))"
-  by (import relation RTC_CASES2)
-
-lemma RTC_CASES_RTC_TWICE: "ALL (x::'a::type => 'a::type => bool) (xa::'a::type) xb::'a::type.
-   RTC x xa xb = (EX u::'a::type. RTC x xa u & RTC x u xb)"
-  by (import relation RTC_CASES_RTC_TWICE)
-
-lemma TC_CASES1: "ALL (R::'a::type => 'a::type => bool) (x::'a::type) z::'a::type.
-   TC R x z --> R x z | (EX y::'a::type. R x y & TC R y z)"
-  by (import relation TC_CASES1)
-
-lemma TC_CASES2: "ALL (R::'a::type => 'a::type => bool) (x::'a::type) z::'a::type.
-   TC R x z --> R x z | (EX y::'a::type. TC R x y & R y z)"
-  by (import relation TC_CASES2)
-
-lemma TC_MONOTONE: "ALL (R::'a::type => 'a::type => bool) Q::'a::type => 'a::type => bool.
-   (ALL (x::'a::type) y::'a::type. R x y --> Q x y) -->
-   (ALL (x::'a::type) y::'a::type. TC R x y --> TC Q x y)"
-  by (import relation TC_MONOTONE)
-
-lemma RTC_MONOTONE: "ALL (R::'a::type => 'a::type => bool) Q::'a::type => 'a::type => bool.
-   (ALL (x::'a::type) y::'a::type. R x y --> Q x y) -->
-   (ALL (x::'a::type) y::'a::type. RTC R x y --> RTC Q x y)"
-  by (import relation RTC_MONOTONE)
-
-definition WF :: "('a => 'a => bool) => bool" where 
-  "WF ==
-%R::'a::type => 'a::type => bool.
-   ALL B::'a::type => bool.
-      Ex B -->
-      (EX min::'a::type. B min & (ALL b::'a::type. R b min --> ~ B b))"
-
-lemma WF_DEF: "ALL R::'a::type => 'a::type => bool.
-   WF R =
-   (ALL B::'a::type => bool.
-       Ex B -->
-       (EX min::'a::type. B min & (ALL b::'a::type. R b min --> ~ B b)))"
-  by (import relation WF_DEF)
-
-lemma WF_INDUCTION_THM: "ALL R::'a::type => 'a::type => bool.
-   WF R -->
-   (ALL P::'a::type => bool.
-       (ALL x::'a::type. (ALL y::'a::type. R y x --> P y) --> P x) -->
-       All P)"
-  by (import relation WF_INDUCTION_THM)
-
-lemma WF_NOT_REFL: "ALL (x::'a::type => 'a::type => bool) (xa::'a::type) xb::'a::type.
-   WF x --> x xa xb --> xa ~= xb"
-  by (import relation WF_NOT_REFL)
-
-definition EMPTY_REL :: "'a => 'a => bool" where 
-  "EMPTY_REL == %(x::'a::type) y::'a::type. False"
-
-lemma EMPTY_REL_DEF: "ALL (x::'a::type) y::'a::type. EMPTY_REL x y = False"
-  by (import relation EMPTY_REL_DEF)
+  transitive_primdef: "transitive == %R. ALL x y z. R x y & R y z --> R x z"
+
+lemma transitive_def: "transitive R = (ALL x y z. R x y & R y z --> R x z)"
+  sorry
+
+definition
+  pred_reflexive :: "('a => 'a => bool) => bool"  where
+  "pred_reflexive == %R. ALL x. R x x"
+
+lemma reflexive_def: "pred_reflexive R = (ALL x. R x x)"
+  sorry
+
+lemma TC_TRANSITIVE: "transitive (TC x)"
+  sorry
+
+lemma RTC_INDUCT: "[| (ALL x. xa x x) & (ALL xb y z. x xb y & xa y z --> xa xb z);
+   RTC x xb xc |]
+==> xa xb xc"
+  sorry
+
+lemma TC_RULES: "(ALL xa xb. x xa xb --> TC x xa xb) &
+(ALL xa xb xc. TC x xa xb & TC x xb xc --> TC x xa xc)"
+  sorry
+
+lemma RTC_RULES: "(ALL xa. RTC x xa xa) &
+(ALL xa xb xc. x xa xb & RTC x xb xc --> RTC x xa xc)"
+  sorry
+
+lemma RTC_STRONG_INDUCT: "[| (ALL x. P x x) & (ALL x y z. R x y & RTC R y z & P y z --> P x z);
+   RTC R x y |]
+==> P x y"
+  sorry
+
+lemma RTC_RTC: "[| RTC R x y; RTC R y z |] ==> RTC R x z"
+  sorry
+
+lemma RTC_TRANSITIVE: "transitive (RTC x)"
+  sorry
+
+lemma RTC_REFLEXIVE: "pred_reflexive (RTC R)"
+  sorry
+
+lemma RC_REFLEXIVE: "pred_reflexive (RC R)"
+  sorry
+
+lemma TC_SUBSET: "x xa xb ==> TC x xa xb"
+  sorry
+
+lemma RTC_SUBSET: "R x y ==> RTC R x y"
+  sorry
+
+lemma RC_SUBSET: "R x y ==> RC R x y"
+  sorry
+
+lemma RC_RTC: "RC R x y ==> RTC R x y"
+  sorry
+
+lemma TC_INDUCT: "[| (ALL xb y. x xb y --> xa xb y) & (ALL x y z. xa x y & xa y z --> xa x z);
+   TC x xb xc |]
+==> xa xb xc"
+  sorry
+
+lemma TC_INDUCT_LEFT1: "[| (ALL xb y. x xb y --> xa xb y) &
+   (ALL xb y z. x xb y & xa y z --> xa xb z);
+   TC x xb xc |]
+==> xa xb xc"
+  sorry
+
+lemma TC_STRONG_INDUCT: "[| (ALL x y. R x y --> P x y) &
+   (ALL x y z. P x y & P y z & TC R x y & TC R y z --> P x z);
+   TC R u v |]
+==> P u v"
+  sorry
+
+lemma TC_STRONG_INDUCT_LEFT1: "[| (ALL x y. R x y --> P x y) &
+   (ALL x y z. R x y & P y z & TC R y z --> P x z);
+   TC R u v |]
+==> P u v"
+  sorry
+
+lemma TC_RTC: "TC R x y ==> RTC R x y"
+  sorry
+
+lemma RTC_TC_RC: "RTC R x y ==> RC R x y | TC R x y"
+  sorry
+
+lemma TC_RC_EQNS: "RC (TC R) = RTC R & TC (RC R) = RTC R"
+  sorry
+
+lemma RC_IDEM: "RC (RC R) = RC R"
+  sorry
+
+lemma TC_IDEM: "TC (TC R) = TC R"
+  sorry
+
+lemma RTC_IDEM: "RTC (RTC R) = RTC R"
+  sorry
+
+lemma RTC_CASES1: "RTC x xa xb = (xa = xb | (EX u. x xa u & RTC x u xb))"
+  sorry
+
+lemma RTC_CASES2: "RTC x xa xb = (xa = xb | (EX u. RTC x xa u & x u xb))"
+  sorry
+
+lemma RTC_CASES_RTC_TWICE: "RTC x xa xb = (EX u. RTC x xa u & RTC x u xb)"
+  sorry
+
+lemma TC_CASES1: "TC R x z ==> R x z | (EX y. R x y & TC R y z)"
+  sorry
+
+lemma TC_CASES2: "TC R x z ==> R x z | (EX y. TC R x y & R y z)"
+  sorry
+
+lemma TC_MONOTONE: "[| !!x y. R x y ==> Q x y; TC R x y |] ==> TC Q x y"
+  sorry
+
+lemma RTC_MONOTONE: "[| !!x y. R x y ==> Q x y; RTC R x y |] ==> RTC Q x y"
+  sorry
+
+definition
+  WF :: "('a => 'a => bool) => bool"  where
+  "WF == %R. ALL B. Ex B --> (EX min. B min & (ALL b. R b min --> ~ B b))"
+
+lemma WF_DEF: "WF R = (ALL B. Ex B --> (EX min. B min & (ALL b. R b min --> ~ B b)))"
+  sorry
+
+lemma WF_INDUCTION_THM: "[| WF R; !!x. (!!y. R y x ==> P y) ==> P x |] ==> P x"
+  sorry
+
+lemma WF_NOT_REFL: "[| WF x; x xa xb |] ==> xa ~= xb"
+  sorry
+
+definition
+  EMPTY_REL :: "'a => 'a => bool"  where
+  "EMPTY_REL == %x y. False"
+
+lemma EMPTY_REL_DEF: "EMPTY_REL x y = False"
+  sorry
 
 lemma WF_EMPTY_REL: "WF EMPTY_REL"
-  by (import relation WF_EMPTY_REL)
-
-lemma WF_SUBSET: "ALL (x::'a::type => 'a::type => bool) xa::'a::type => 'a::type => bool.
-   WF x & (ALL (xb::'a::type) y::'a::type. xa xb y --> x xb y) --> WF xa"
-  by (import relation WF_SUBSET)
-
-lemma WF_TC: "ALL R::'a::type => 'a::type => bool. WF R --> WF (TC R)"
-  by (import relation WF_TC)
+  sorry
+
+lemma WF_SUBSET: "WF x & (ALL xb y. xa xb y --> x xb y) ==> WF xa"
+  sorry
+
+lemma WF_TC: "WF R ==> WF (TC R)"
+  sorry
 
 consts
   inv_image :: "('b => 'b => bool) => ('a => 'b) => 'a => 'a => bool" 
 
 defs
   inv_image_primdef: "relation.inv_image ==
-%(R::'b::type => 'b::type => bool) (f::'a::type => 'b::type) (x::'a::type)
-   y::'a::type. R (f x) (f y)"
-
-lemma inv_image_def: "ALL (R::'b::type => 'b::type => bool) f::'a::type => 'b::type.
-   relation.inv_image R f = (%(x::'a::type) y::'a::type. R (f x) (f y))"
-  by (import relation inv_image_def)
-
-lemma WF_inv_image: "ALL (R::'b::type => 'b::type => bool) f::'a::type => 'b::type.
-   WF R --> WF (relation.inv_image R f)"
-  by (import relation WF_inv_image)
-
-definition RESTRICT :: "('a => 'b) => ('a => 'a => bool) => 'a => 'a => 'b" where 
-  "RESTRICT ==
-%(f::'a::type => 'b::type) (R::'a::type => 'a::type => bool) (x::'a::type)
-   y::'a::type. if R y x then f y else ARB"
-
-lemma RESTRICT_DEF: "ALL (f::'a::type => 'b::type) (R::'a::type => 'a::type => bool) x::'a::type.
-   RESTRICT f R x = (%y::'a::type. if R y x then f y else ARB)"
-  by (import relation RESTRICT_DEF)
-
-lemma RESTRICT_LEMMA: "ALL (x::'a::type => 'b::type) (xa::'a::type => 'a::type => bool)
-   (xb::'a::type) xc::'a::type. xa xb xc --> RESTRICT x xa xc xb = x xb"
-  by (import relation RESTRICT_LEMMA)
+%(R::'b => 'b => bool) (f::'a => 'b) (x::'a) y::'a. R (f x) (f y)"
+
+lemma inv_image_def: "relation.inv_image R f = (%x y. R (f x) (f y))"
+  sorry
+
+lemma WF_inv_image: "WF (R::'b => 'b => bool) ==> WF (relation.inv_image R (f::'a => 'b))"
+  sorry
+
+definition
+  RESTRICT :: "('a => 'b) => ('a => 'a => bool) => 'a => 'a => 'b"  where
+  "RESTRICT == %f R x y. if R y x then f y else ARB"
+
+lemma RESTRICT_DEF: "RESTRICT f R x = (%y. if R y x then f y else ARB)"
+  sorry
+
+lemma RESTRICT_LEMMA: "xa xb xc ==> RESTRICT x xa xc xb = x xb"
+  sorry
 
 consts
   approx :: "('a => 'a => bool) => (('a => 'b) => 'a => 'b) => 'a => ('a => 'b) => bool" 
 
 defs
-  approx_primdef: "approx ==
-%(R::'a::type => 'a::type => bool)
-   (M::('a::type => 'b::type) => 'a::type => 'b::type) (x::'a::type)
-   f::'a::type => 'b::type.
-   f = RESTRICT (%y::'a::type. M (RESTRICT f R y) y) R x"
-
-lemma approx_def: "ALL (R::'a::type => 'a::type => bool)
-   (M::('a::type => 'b::type) => 'a::type => 'b::type) (x::'a::type)
-   f::'a::type => 'b::type.
-   approx R M x f = (f = RESTRICT (%y::'a::type. M (RESTRICT f R y) y) R x)"
-  by (import relation approx_def)
+  approx_primdef: "approx == %R M x f. f = RESTRICT (%y. M (RESTRICT f R y) y) R x"
+
+lemma approx_def: "approx R M x f = (f = RESTRICT (%y. M (RESTRICT f R y) y) R x)"
+  sorry
 
 consts
   the_fun :: "('a => 'a => bool) => (('a => 'b) => 'a => 'b) => 'a => 'a => 'b" 
 
 defs
-  the_fun_primdef: "the_fun ==
-%(R::'a::type => 'a::type => bool)
-   (M::('a::type => 'b::type) => 'a::type => 'b::type) x::'a::type.
-   Eps (approx R M x)"
-
-lemma the_fun_def: "ALL (R::'a::type => 'a::type => bool)
-   (M::('a::type => 'b::type) => 'a::type => 'b::type) x::'a::type.
-   the_fun R M x = Eps (approx R M x)"
-  by (import relation the_fun_def)
-
-definition WFREC :: "('a => 'a => bool) => (('a => 'b) => 'a => 'b) => 'a => 'b" where 
+  the_fun_primdef: "the_fun == %R M x. Eps (approx R M x)"
+
+lemma the_fun_def: "the_fun R M x = Eps (approx R M x)"
+  sorry
+
+definition
+  WFREC :: "('a => 'a => bool) => (('a => 'b) => 'a => 'b) => 'a => 'b"  where
   "WFREC ==
-%(R::'a::type => 'a::type => bool)
-   (M::('a::type => 'b::type) => 'a::type => 'b::type) x::'a::type.
-   M (RESTRICT
-       (the_fun (TC R)
-         (%(f::'a::type => 'b::type) v::'a::type. M (RESTRICT f R v) v) x)
-       R x)
-    x"
-
-lemma WFREC_DEF: "ALL (R::'a::type => 'a::type => bool)
-   M::('a::type => 'b::type) => 'a::type => 'b::type.
-   WFREC R M =
-   (%x::'a::type.
-       M (RESTRICT
-           (the_fun (TC R)
-             (%(f::'a::type => 'b::type) v::'a::type. M (RESTRICT f R v) v)
-             x)
-           R x)
-        x)"
-  by (import relation WFREC_DEF)
-
-lemma WFREC_THM: "ALL (R::'a::type => 'a::type => bool)
-   M::('a::type => 'b::type) => 'a::type => 'b::type.
-   WF R --> (ALL x::'a::type. WFREC R M x = M (RESTRICT (WFREC R M) R x) x)"
-  by (import relation WFREC_THM)
-
-lemma WFREC_COROLLARY: "ALL (M::('a::type => 'b::type) => 'a::type => 'b::type)
-   (R::'a::type => 'a::type => bool) f::'a::type => 'b::type.
-   f = WFREC R M --> WF R --> (ALL x::'a::type. f x = M (RESTRICT f R x) x)"
-  by (import relation WFREC_COROLLARY)
-
-lemma WF_RECURSION_THM: "ALL R::'a::type => 'a::type => bool.
-   WF R -->
-   (ALL M::('a::type => 'b::type) => 'a::type => 'b::type.
-       EX! f::'a::type => 'b::type.
-          ALL x::'a::type. f x = M (RESTRICT f R x) x)"
-  by (import relation WF_RECURSION_THM)
+%R M x. M (RESTRICT (the_fun (TC R) (%f v. M (RESTRICT f R v) v) x) R x) x"
+
+lemma WFREC_DEF: "WFREC R M =
+(%x. M (RESTRICT (the_fun (TC R) (%f v. M (RESTRICT f R v) v) x) R x) x)"
+  sorry
+
+lemma WFREC_THM: "WF R ==> WFREC R M x = M (RESTRICT (WFREC R M) R x) x"
+  sorry
+
+lemma WFREC_COROLLARY: "[| f = WFREC R M; WF R |] ==> f x = M (RESTRICT f R x) x"
+  sorry
+
+lemma WF_RECURSION_THM: "WF R ==> EX! f. ALL x. f x = M (RESTRICT f R x) x"
+  sorry
 
 ;end_setup
 
 ;setup_theory pair
 
-lemma CURRY_ONE_ONE_THM: "(curry (f::'a::type * 'b::type => 'c::type) =
- curry (g::'a::type * 'b::type => 'c::type)) =
-(f = g)"
-  by (import pair CURRY_ONE_ONE_THM)
-
-lemma UNCURRY_ONE_ONE_THM: "(op =::bool => bool => bool)
- ((op =::('a::type * 'b::type => 'c::type)
-         => ('a::type * 'b::type => 'c::type) => bool)
-   ((split::('a::type => 'b::type => 'c::type)
-            => 'a::type * 'b::type => 'c::type)
-     (f::'a::type => 'b::type => 'c::type))
-   ((split::('a::type => 'b::type => 'c::type)
-            => 'a::type * 'b::type => 'c::type)
-     (g::'a::type => 'b::type => 'c::type)))
- ((op =::('a::type => 'b::type => 'c::type)
-         => ('a::type => 'b::type => 'c::type) => bool)
-   f g)"
-  by (import pair UNCURRY_ONE_ONE_THM)
-
-lemma pair_Axiom: "ALL f::'a::type => 'b::type => 'c::type.
-   EX x::'a::type * 'b::type => 'c::type.
-      ALL (xa::'a::type) y::'b::type. x (xa, y) = f xa y"
-  by (import pair pair_Axiom)
-
-lemma UNCURRY_CONG: "ALL (M::'a::type * 'b::type) (M'::'a::type * 'b::type)
-   f::'a::type => 'b::type => 'c::type.
-   M = M' &
-   (ALL (x::'a::type) y::'b::type.
-       M' = (x, y) -->
-       f x y = (f'::'a::type => 'b::type => 'c::type) x y) -->
-   split f M = split f' M'"
-  by (import pair UNCURRY_CONG)
-
-lemma ELIM_PEXISTS: "(EX p::'a::type * 'b::type.
-    (P::'a::type => 'b::type => bool) (fst p) (snd p)) =
-(EX p1::'a::type. Ex (P p1))"
-  by (import pair ELIM_PEXISTS)
-
-lemma ELIM_PFORALL: "(ALL p::'a::type * 'b::type.
-    (P::'a::type => 'b::type => bool) (fst p) (snd p)) =
-(ALL p1::'a::type. All (P p1))"
-  by (import pair ELIM_PFORALL)
-
-lemma PFORALL_THM: "(All::(('a::type => 'b::type => bool) => bool) => bool)
- (%x::'a::type => 'b::type => bool.
-     (op =::bool => bool => bool)
-      ((All::('a::type => bool) => bool)
-        (%xa::'a::type. (All::('b::type => bool) => bool) (x xa)))
-      ((All::('a::type * 'b::type => bool) => bool)
-        ((split::('a::type => 'b::type => bool)
-                 => 'a::type * 'b::type => bool)
-          x)))"
-  by (import pair PFORALL_THM)
-
-lemma PEXISTS_THM: "(All::(('a::type => 'b::type => bool) => bool) => bool)
- (%x::'a::type => 'b::type => bool.
-     (op =::bool => bool => bool)
-      ((Ex::('a::type => bool) => bool)
-        (%xa::'a::type. (Ex::('b::type => bool) => bool) (x xa)))
-      ((Ex::('a::type * 'b::type => bool) => bool)
-        ((split::('a::type => 'b::type => bool)
-                 => 'a::type * 'b::type => bool)
-          x)))"
-  by (import pair PEXISTS_THM)
-
-lemma LET2_RAND: "(All::(('c::type => 'd::type) => bool) => bool)
- (%x::'c::type => 'd::type.
-     (All::('a::type * 'b::type => bool) => bool)
-      (%xa::'a::type * 'b::type.
-          (All::(('a::type => 'b::type => 'c::type) => bool) => bool)
-           (%xb::'a::type => 'b::type => 'c::type.
-               (op =::'d::type => 'd::type => bool)
-                (x ((Let::'a::type * 'b::type
-                          => ('a::type * 'b::type => 'c::type) => 'c::type)
-                     xa ((split::('a::type => 'b::type => 'c::type)
-                                 => 'a::type * 'b::type => 'c::type)
-                          xb)))
-                ((Let::'a::type * 'b::type
-                       => ('a::type * 'b::type => 'd::type) => 'd::type)
-                  xa ((split::('a::type => 'b::type => 'd::type)
-                              => 'a::type * 'b::type => 'd::type)
-                       (%(xa::'a::type) y::'b::type. x (xb xa y)))))))"
-  by (import pair LET2_RAND)
-
-lemma LET2_RATOR: "(All::('a1::type * 'a2::type => bool) => bool)
- (%x::'a1::type * 'a2::type.
-     (All::(('a1::type => 'a2::type => 'b::type => 'c::type) => bool)
-           => bool)
-      (%xa::'a1::type => 'a2::type => 'b::type => 'c::type.
-          (All::('b::type => bool) => bool)
-           (%xb::'b::type.
-               (op =::'c::type => 'c::type => bool)
-                ((Let::'a1::type * 'a2::type
-                       => ('a1::type * 'a2::type => 'b::type => 'c::type)
-                          => 'b::type => 'c::type)
-                  x ((split::('a1::type
-                              => 'a2::type => 'b::type => 'c::type)
-                             => 'a1::type * 'a2::type
-                                => 'b::type => 'c::type)
-                      xa)
-                  xb)
-                ((Let::'a1::type * 'a2::type
-                       => ('a1::type * 'a2::type => 'c::type) => 'c::type)
-                  x ((split::('a1::type => 'a2::type => 'c::type)
-                             => 'a1::type * 'a2::type => 'c::type)
-                      (%(x::'a1::type) y::'a2::type. xa x y xb))))))"
-  by (import pair LET2_RATOR)
-
-lemma pair_case_cong: "ALL (x::'a::type * 'b::type) (xa::'a::type * 'b::type)
-   xb::'a::type => 'b::type => 'c::type.
-   x = xa &
-   (ALL (x::'a::type) y::'b::type.
-       xa = (x, y) -->
-       xb x y = (f'::'a::type => 'b::type => 'c::type) x y) -->
-   split xb x = split f' xa"
-  by (import pair pair_case_cong)
-
-definition LEX :: "('a => 'a => bool) => ('b => 'b => bool) => 'a * 'b => 'a * 'b => bool" where 
-  "LEX ==
-%(R1::'a::type => 'a::type => bool) (R2::'b::type => 'b::type => bool)
-   (s::'a::type, t::'b::type) (u::'a::type, v::'b::type).
-   R1 s u | s = u & R2 t v"
-
-lemma LEX_DEF: "ALL (R1::'a::type => 'a::type => bool) R2::'b::type => 'b::type => bool.
-   LEX R1 R2 =
-   (%(s::'a::type, t::'b::type) (u::'a::type, v::'b::type).
-       R1 s u | s = u & R2 t v)"
-  by (import pair LEX_DEF)
-
-lemma WF_LEX: "ALL (x::'a::type => 'a::type => bool) xa::'b::type => 'b::type => bool.
-   WF x & WF xa --> WF (LEX x xa)"
-  by (import pair WF_LEX)
-
-definition RPROD :: "('a => 'a => bool) => ('b => 'b => bool) => 'a * 'b => 'a * 'b => bool" where 
-  "RPROD ==
-%(R1::'a::type => 'a::type => bool) (R2::'b::type => 'b::type => bool)
-   (s::'a::type, t::'b::type) (u::'a::type, v::'b::type). R1 s u & R2 t v"
-
-lemma RPROD_DEF: "ALL (R1::'a::type => 'a::type => bool) R2::'b::type => 'b::type => bool.
-   RPROD R1 R2 =
-   (%(s::'a::type, t::'b::type) (u::'a::type, v::'b::type). R1 s u & R2 t v)"
-  by (import pair RPROD_DEF)
-
-lemma WF_RPROD: "ALL (R::'a::type => 'a::type => bool) Q::'b::type => 'b::type => bool.
-   WF R & WF Q --> WF (RPROD R Q)"
-  by (import pair WF_RPROD)
+lemma CURRY_ONE_ONE_THM: "(curry f = curry g) = (f = g)"
+  sorry
+
+lemma UNCURRY_ONE_ONE_THM: "((%(x, y). f x y) = (%(x, y). g x y)) = (f = g)"
+  sorry
+
+lemma pair_Axiom: "EX x. ALL xa y. x (xa, y) = f xa y"
+  sorry
+
+lemma UNCURRY_CONG: "M = M' & (ALL x y. M' = (x, y) --> f x y = f' x y)
+==> prod_case f M = prod_case f' M'"
+  sorry
+
+lemma ELIM_PEXISTS: "(EX p. P (fst p) (snd p)) = (EX p1. Ex (P p1))"
+  sorry
+
+lemma ELIM_PFORALL: "(ALL p. P (fst p) (snd p)) = (ALL p1. All (P p1))"
+  sorry
+
+lemma PFORALL_THM: "(ALL xa. All (x xa)) = All (%(xa, y). x xa y)"
+  sorry
+
+lemma PEXISTS_THM: "(EX xa. Ex (x xa)) = Ex (%(xa, y). x xa y)"
+  sorry
+
+lemma LET2_RAND: "(x::'c => 'd)
+ (let (x::'a, y::'b) = xa::'a * 'b in (xb::'a => 'b => 'c) x y) =
+(let (xa::'a, y::'b) = xa in x (xb xa y))"
+  sorry
+
+lemma LET2_RATOR: "(let (x::'a1, y::'a2) = x::'a1 * 'a2 in (xa::'a1 => 'a2 => 'b => 'c) x y)
+ (xb::'b) =
+(let (x::'a1, y::'a2) = x in xa x y xb)"
+  sorry
+
+lemma pair_case_cong: "x = xa & (ALL x y. xa = (x, y) --> xb x y = f' x y)
+==> prod_case xb x = prod_case f' xa"
+  sorry
+
+definition
+  LEX :: "('a => 'a => bool) => ('b => 'b => bool) => 'a * 'b => 'a * 'b => bool"  where
+  "LEX == %R1 R2 (s, t) (u, v). R1 s u | s = u & R2 t v"
+
+lemma LEX_DEF: "LEX R1 R2 = (%(s, t) (u, v). R1 s u | s = u & R2 t v)"
+  sorry
+
+lemma WF_LEX: "WF x & WF xa ==> WF (LEX x xa)"
+  sorry
+
+definition
+  RPROD :: "('a => 'a => bool) => ('b => 'b => bool) => 'a * 'b => 'a * 'b => bool"  where
+  "RPROD == %R1 R2 (s, t) (u, v). R1 s u & R2 t v"
+
+lemma RPROD_DEF: "RPROD R1 R2 = (%(s, t) (u, v). R1 s u & R2 t v)"
+  sorry
+
+lemma WF_RPROD: "WF R & WF Q ==> WF (RPROD R Q)"
+  sorry
 
 ;end_setup
 
@@ -1073,174 +828,113 @@
 ;setup_theory prim_rec
 
 lemma LESS_0_0: "0 < Suc 0"
-  by (import prim_rec LESS_0_0)
-
-lemma LESS_LEMMA1: "ALL (x::nat) xa::nat. x < Suc xa --> x = xa | x < xa"
-  by (import prim_rec LESS_LEMMA1)
-
-lemma LESS_LEMMA2: "ALL (m::nat) n::nat. m = n | m < n --> m < Suc n"
-  by (import prim_rec LESS_LEMMA2)
-
-lemma LESS_THM: "ALL (m::nat) n::nat. (m < Suc n) = (m = n | m < n)"
-  by (import prim_rec LESS_THM)
-
-lemma LESS_SUC_IMP: "ALL (x::nat) xa::nat. x < Suc xa --> x ~= xa --> x < xa"
-  by (import prim_rec LESS_SUC_IMP)
-
-lemma EQ_LESS: "ALL n::nat. Suc (m::nat) = n --> m < n"
-  by (import prim_rec EQ_LESS)
-
-lemma NOT_LESS_EQ: "ALL (m::nat) n::nat. m = n --> ~ m < n"
-  by (import prim_rec NOT_LESS_EQ)
-
-definition SIMP_REC_REL :: "(nat => 'a) => 'a => ('a => 'a) => nat => bool" where 
-  "(op ==::((nat => 'a::type)
-         => 'a::type => ('a::type => 'a::type) => nat => bool)
-        => ((nat => 'a::type)
-            => 'a::type => ('a::type => 'a::type) => nat => bool)
-           => prop)
- (SIMP_REC_REL::(nat => 'a::type)
-                => 'a::type => ('a::type => 'a::type) => nat => bool)
- (%(fun::nat => 'a::type) (x::'a::type) (f::'a::type => 'a::type) n::nat.
-     (op &::bool => bool => bool)
-      ((op =::'a::type => 'a::type => bool) (fun (0::nat)) x)
-      ((All::(nat => bool) => bool)
-        (%m::nat.
-            (op -->::bool => bool => bool) ((op <::nat => nat => bool) m n)
-             ((op =::'a::type => 'a::type => bool)
-               (fun ((Suc::nat => nat) m)) (f (fun m))))))"
-
-lemma SIMP_REC_REL: "(All::((nat => 'a::type) => bool) => bool)
- (%fun::nat => 'a::type.
-     (All::('a::type => bool) => bool)
-      (%x::'a::type.
-          (All::(('a::type => 'a::type) => bool) => bool)
-           (%f::'a::type => 'a::type.
-               (All::(nat => bool) => bool)
-                (%n::nat.
-                    (op =::bool => bool => bool)
-                     ((SIMP_REC_REL::(nat => 'a::type)
-                                     => 'a::type
-  => ('a::type => 'a::type) => nat => bool)
-                       fun x f n)
-                     ((op &::bool => bool => bool)
-                       ((op =::'a::type => 'a::type => bool) (fun (0::nat))
-                         x)
-                       ((All::(nat => bool) => bool)
-                         (%m::nat.
-                             (op -->::bool => bool => bool)
-                              ((op <::nat => nat => bool) m n)
-                              ((op =::'a::type => 'a::type => bool)
-                                (fun ((Suc::nat => nat) m))
-                                (f (fun m))))))))))"
-  by (import prim_rec SIMP_REC_REL)
-
-lemma SIMP_REC_EXISTS: "ALL (x::'a::type) (f::'a::type => 'a::type) n::nat.
-   EX fun::nat => 'a::type. SIMP_REC_REL fun x f n"
-  by (import prim_rec SIMP_REC_EXISTS)
-
-lemma SIMP_REC_REL_UNIQUE: "ALL (x::'a::type) (xa::'a::type => 'a::type) (xb::nat => 'a::type)
-   (xc::nat => 'a::type) (xd::nat) xe::nat.
-   SIMP_REC_REL xb x xa xd & SIMP_REC_REL xc x xa xe -->
-   (ALL n::nat. n < xd & n < xe --> xb n = xc n)"
-  by (import prim_rec SIMP_REC_REL_UNIQUE)
-
-lemma SIMP_REC_REL_UNIQUE_RESULT: "ALL (x::'a::type) (f::'a::type => 'a::type) n::nat.
-   EX! y::'a::type.
-      EX g::nat => 'a::type. SIMP_REC_REL g x f (Suc n) & y = g n"
-  by (import prim_rec SIMP_REC_REL_UNIQUE_RESULT)
+  sorry
+
+lemma LESS_LEMMA1: "x < Suc xa ==> x = xa | x < xa"
+  sorry
+
+lemma LESS_LEMMA2: "m = n | m < n ==> m < Suc n"
+  sorry
+
+lemma LESS_THM: "(m < Suc n) = (m = n | m < n)"
+  sorry
+
+lemma LESS_SUC_IMP: "[| x < Suc xa; x ~= xa |] ==> x < xa"
+  sorry
+
+lemma EQ_LESS: "Suc m = n ==> m < n"
+  sorry
+
+lemma NOT_LESS_EQ: "(m::nat) = (n::nat) ==> ~ m < n"
+  sorry
+
+definition
+  SIMP_REC_REL :: "(nat => 'a) => 'a => ('a => 'a) => nat => bool"  where
+  "SIMP_REC_REL == %fun x f n. fun 0 = x & (ALL m<n. fun (Suc m) = f (fun m))"
+
+lemma SIMP_REC_REL: "SIMP_REC_REL fun x f n = (fun 0 = x & (ALL m<n. fun (Suc m) = f (fun m)))"
+  sorry
+
+lemma SIMP_REC_EXISTS: "EX fun. SIMP_REC_REL fun x f n"
+  sorry
+
+lemma SIMP_REC_REL_UNIQUE: "[| SIMP_REC_REL xb x xa xd & SIMP_REC_REL xc x xa xe; n < xd & n < xe |]
+==> xb n = xc n"
+  sorry
+
+lemma SIMP_REC_REL_UNIQUE_RESULT: "EX! y. EX g. SIMP_REC_REL g x f (Suc n) & y = g n"
+  sorry
 
 consts
   SIMP_REC :: "'a => ('a => 'a) => nat => 'a" 
 
-specification (SIMP_REC) SIMP_REC: "ALL (x::'a::type) (f'::'a::type => 'a::type) n::nat.
-   EX g::nat => 'a::type.
-      SIMP_REC_REL g x f' (Suc n) & SIMP_REC x f' n = g n"
-  by (import prim_rec SIMP_REC)
-
-lemma LESS_SUC_SUC: "ALL m::nat. m < Suc m & m < Suc (Suc m)"
-  by (import prim_rec LESS_SUC_SUC)
-
-lemma SIMP_REC_THM: "ALL (x::'a::type) f::'a::type => 'a::type.
-   SIMP_REC x f 0 = x &
-   (ALL m::nat. SIMP_REC x f (Suc m) = f (SIMP_REC x f m))"
-  by (import prim_rec SIMP_REC_THM)
-
-definition PRE :: "nat => nat" where 
-  "PRE == %m::nat. if m = 0 then 0 else SOME n::nat. m = Suc n"
-
-lemma PRE_DEF: "ALL m::nat. PRE m = (if m = 0 then 0 else SOME n::nat. m = Suc n)"
-  by (import prim_rec PRE_DEF)
-
-lemma PRE: "PRE 0 = 0 & (ALL m::nat. PRE (Suc m) = m)"
-  by (import prim_rec PRE)
-
-definition PRIM_REC_FUN :: "'a => ('a => nat => 'a) => nat => nat => 'a" where 
-  "PRIM_REC_FUN ==
-%(x::'a::type) f::'a::type => nat => 'a::type.
-   SIMP_REC (%n::nat. x) (%(fun::nat => 'a::type) n::nat. f (fun (PRE n)) n)"
-
-lemma PRIM_REC_FUN: "ALL (x::'a::type) f::'a::type => nat => 'a::type.
-   PRIM_REC_FUN x f =
-   SIMP_REC (%n::nat. x) (%(fun::nat => 'a::type) n::nat. f (fun (PRE n)) n)"
-  by (import prim_rec PRIM_REC_FUN)
-
-lemma PRIM_REC_EQN: "ALL (x::'a::type) f::'a::type => nat => 'a::type.
-   (ALL n::nat. PRIM_REC_FUN x f 0 n = x) &
-   (ALL (m::nat) n::nat.
-       PRIM_REC_FUN x f (Suc m) n = f (PRIM_REC_FUN x f m (PRE n)) n)"
-  by (import prim_rec PRIM_REC_EQN)
-
-definition PRIM_REC :: "'a => ('a => nat => 'a) => nat => 'a" where 
-  "PRIM_REC ==
-%(x::'a::type) (f::'a::type => nat => 'a::type) m::nat.
-   PRIM_REC_FUN x f m (PRE m)"
-
-lemma PRIM_REC: "ALL (x::'a::type) (f::'a::type => nat => 'a::type) m::nat.
-   PRIM_REC x f m = PRIM_REC_FUN x f m (PRE m)"
-  by (import prim_rec PRIM_REC)
-
-lemma PRIM_REC_THM: "ALL (x::'a::type) f::'a::type => nat => 'a::type.
-   PRIM_REC x f 0 = x &
-   (ALL m::nat. PRIM_REC x f (Suc m) = f (PRIM_REC x f m) m)"
-  by (import prim_rec PRIM_REC_THM)
-
-lemma DC: "ALL (P::'a::type => bool) (R::'a::type => 'a::type => bool) a::'a::type.
-   P a & (ALL x::'a::type. P x --> (EX y::'a::type. P y & R x y)) -->
-   (EX x::nat => 'a::type.
-       x 0 = a & (ALL n::nat. P (x n) & R (x n) (x (Suc n))))"
-  by (import prim_rec DC)
-
-lemma num_Axiom_old: "ALL (e::'a::type) f::'a::type => nat => 'a::type.
-   EX! fn1::nat => 'a::type.
-      fn1 0 = e & (ALL n::nat. fn1 (Suc n) = f (fn1 n) n)"
-  by (import prim_rec num_Axiom_old)
-
-lemma num_Axiom: "ALL (e::'a::type) f::nat => 'a::type => 'a::type.
-   EX x::nat => 'a::type. x 0 = e & (ALL n::nat. x (Suc n) = f n (x n))"
-  by (import prim_rec num_Axiom)
+specification (SIMP_REC) SIMP_REC: "ALL x f' n. EX g. SIMP_REC_REL g x f' (Suc n) & SIMP_REC x f' n = g n"
+  sorry
+
+lemma LESS_SUC_SUC: "m < Suc m & m < Suc (Suc m)"
+  sorry
+
+lemma SIMP_REC_THM: "SIMP_REC x f 0 = x & (ALL m. SIMP_REC x f (Suc m) = f (SIMP_REC x f m))"
+  sorry
+
+definition
+  PRE :: "nat => nat"  where
+  "PRE == %m. if m = 0 then 0 else SOME n. m = Suc n"
+
+lemma PRE_DEF: "PRE m = (if m = 0 then 0 else SOME n. m = Suc n)"
+  sorry
+
+lemma PRE: "PRE 0 = 0 & (ALL m. PRE (Suc m) = m)"
+  sorry
+
+definition
+  PRIM_REC_FUN :: "'a => ('a => nat => 'a) => nat => nat => 'a"  where
+  "PRIM_REC_FUN == %x f. SIMP_REC (%n. x) (%fun n. f (fun (PRE n)) n)"
+
+lemma PRIM_REC_FUN: "PRIM_REC_FUN x f = SIMP_REC (%n. x) (%fun n. f (fun (PRE n)) n)"
+  sorry
+
+lemma PRIM_REC_EQN: "(ALL n. PRIM_REC_FUN x f 0 n = x) &
+(ALL m n. PRIM_REC_FUN x f (Suc m) n = f (PRIM_REC_FUN x f m (PRE n)) n)"
+  sorry
+
+definition
+  PRIM_REC :: "'a => ('a => nat => 'a) => nat => 'a"  where
+  "PRIM_REC == %x f m. PRIM_REC_FUN x f m (PRE m)"
+
+lemma PRIM_REC: "PRIM_REC x f m = PRIM_REC_FUN x f m (PRE m)"
+  sorry
+
+lemma PRIM_REC_THM: "PRIM_REC x f 0 = x & (ALL m. PRIM_REC x f (Suc m) = f (PRIM_REC x f m) m)"
+  sorry
+
+lemma DC: "P a & (ALL x. P x --> (EX y. P y & R x y))
+==> EX x. x 0 = a & (ALL n. P (x n) & R (x n) (x (Suc n)))"
+  sorry
+
+lemma num_Axiom_old: "EX! fn1. fn1 0 = e & (ALL n. fn1 (Suc n) = f (fn1 n) n)"
+  sorry
+
+lemma num_Axiom: "EX x. x 0 = e & (ALL n. x (Suc n) = f n (x n))"
+  sorry
 
 consts
   wellfounded :: "('a => 'a => bool) => bool" 
 
 defs
-  wellfounded_primdef: "wellfounded ==
-%R::'a::type => 'a::type => bool.
-   ~ (EX f::nat => 'a::type. ALL n::nat. R (f (Suc n)) (f n))"
-
-lemma wellfounded_def: "ALL R::'a::type => 'a::type => bool.
-   wellfounded R =
-   (~ (EX f::nat => 'a::type. ALL n::nat. R (f (Suc n)) (f n)))"
-  by (import prim_rec wellfounded_def)
-
-lemma WF_IFF_WELLFOUNDED: "ALL R::'a::type => 'a::type => bool. WF R = wellfounded R"
-  by (import prim_rec WF_IFF_WELLFOUNDED)
-
-lemma WF_PRED: "WF (%(x::nat) y::nat. y = Suc x)"
-  by (import prim_rec WF_PRED)
+  wellfounded_primdef: "wellfounded == %R. ~ (EX f. ALL n. R (f (Suc n)) (f n))"
+
+lemma wellfounded_def: "wellfounded R = (~ (EX f. ALL n. R (f (Suc n)) (f n)))"
+  sorry
+
+lemma WF_IFF_WELLFOUNDED: "WF R = wellfounded R"
+  sorry
+
+lemma WF_PRED: "WF (%x y. y = Suc x)"
+  sorry
 
 lemma WF_LESS: "(WF::(nat => nat => bool) => bool) (op <::nat => nat => bool)"
-  by (import prim_rec WF_LESS)
+  sorry
 
 consts
   measure :: "('a => nat) => 'a => 'a => bool" 
@@ -1249,616 +943,533 @@
   measure_primdef: "prim_rec.measure == relation.inv_image op <"
 
 lemma measure_def: "prim_rec.measure = relation.inv_image op <"
-  by (import prim_rec measure_def)
-
-lemma WF_measure: "ALL x::'a::type => nat. WF (prim_rec.measure x)"
-  by (import prim_rec WF_measure)
-
-lemma measure_thm: "ALL (x::'a::type => nat) (xa::'a::type) xb::'a::type.
-   prim_rec.measure x xa xb = (x xa < x xb)"
-  by (import prim_rec measure_thm)
+  sorry
+
+lemma WF_measure: "WF (prim_rec.measure x)"
+  sorry
+
+lemma measure_thm: "prim_rec.measure x xa xb = (x xa < x xb)"
+  sorry
 
 ;end_setup
 
 ;setup_theory arithmetic
 
-definition nat_elim__magic :: "nat => nat" where 
-  "nat_elim__magic == %n::nat. n"
-
-lemma nat_elim__magic: "ALL n::nat. nat_elim__magic n = n"
-  by (import arithmetic nat_elim__magic)
+definition
+  nat_elim__magic :: "nat => nat"  where
+  "nat_elim__magic == %n. n"
+
+lemma nat_elim__magic: "nat_elim__magic n = n"
+  sorry
 
 consts
   EVEN :: "nat => bool" 
 
-specification (EVEN) EVEN: "EVEN 0 = True & (ALL n::nat. EVEN (Suc n) = (~ EVEN n))"
-  by (import arithmetic EVEN)
+specification (EVEN) EVEN: "EVEN 0 = True & (ALL n. EVEN (Suc n) = (~ EVEN n))"
+  sorry
 
 consts
   ODD :: "nat => bool" 
 
-specification (ODD) ODD: "ODD 0 = False & (ALL n::nat. ODD (Suc n) = (~ ODD n))"
-  by (import arithmetic ODD)
+specification (ODD) ODD: "ODD 0 = False & (ALL n. ODD (Suc n) = (~ ODD n))"
+  sorry
 
 lemma TWO: "2 = Suc 1"
-  by (import arithmetic TWO)
-
-lemma NORM_0: "(op =::nat => nat => bool) (0::nat) (0::nat)"
-  by (import arithmetic NORM_0)
-
-lemma num_case_compute: "ALL n::nat.
-   nat_case (f::'a::type) (g::nat => 'a::type) n =
-   (if n = 0 then f else g (PRE n))"
-  by (import arithmetic num_case_compute)
-
-lemma ADD_CLAUSES: "0 + (m::nat) = m &
-m + 0 = m & Suc m + (n::nat) = Suc (m + n) & m + Suc n = Suc (m + n)"
-  by (import arithmetic ADD_CLAUSES)
-
-lemma LESS_ADD: "ALL (m::nat) n::nat. n < m --> (EX p::nat. p + n = m)"
-  by (import arithmetic LESS_ADD)
-
-lemma LESS_ANTISYM: "ALL (m::nat) n::nat. ~ (m < n & n < m)"
-  by (import arithmetic LESS_ANTISYM)
-
-lemma LESS_LESS_SUC: "ALL (x::nat) xa::nat. ~ (x < xa & xa < Suc x)"
-  by (import arithmetic LESS_LESS_SUC)
-
-lemma FUN_EQ_LEMMA: "ALL (f::'a::type => bool) (x1::'a::type) x2::'a::type.
-   f x1 & ~ f x2 --> x1 ~= x2"
-  by (import arithmetic FUN_EQ_LEMMA)
-
-lemma LESS_NOT_SUC: "ALL (m::nat) n::nat. m < n & n ~= Suc m --> Suc m < n"
-  by (import arithmetic LESS_NOT_SUC)
-
-lemma LESS_0_CASES: "ALL m::nat. 0 = m | 0 < m"
-  by (import arithmetic LESS_0_CASES)
-
-lemma LESS_CASES_IMP: "ALL (m::nat) n::nat. ~ m < n & m ~= n --> n < m"
-  by (import arithmetic LESS_CASES_IMP)
-
-lemma LESS_CASES: "ALL (m::nat) n::nat. m < n | n <= m"
-  by (import arithmetic LESS_CASES)
-
-lemma LESS_EQ_SUC_REFL: "ALL m::nat. m <= Suc m"
-  by (import arithmetic LESS_EQ_SUC_REFL)
-
-lemma LESS_ADD_NONZERO: "ALL (m::nat) n::nat. n ~= 0 --> m < m + n"
-  by (import arithmetic LESS_ADD_NONZERO)
-
-lemma LESS_EQ_ANTISYM: "ALL (x::nat) xa::nat. ~ (x < xa & xa <= x)"
-  by (import arithmetic LESS_EQ_ANTISYM)
-
-lemma SUB_0: "ALL m::nat. 0 - m = 0 & m - 0 = m"
-  by (import arithmetic SUB_0)
-
-lemma SUC_SUB1: "ALL m::nat. Suc m - 1 = m"
-  by (import arithmetic SUC_SUB1)
-
-lemma PRE_SUB1: "ALL m::nat. PRE m = m - 1"
-  by (import arithmetic PRE_SUB1)
-
-lemma MULT_CLAUSES: "ALL (x::nat) xa::nat.
-   0 * x = 0 &
-   x * 0 = 0 &
-   1 * x = x &
-   x * 1 = x & Suc x * xa = x * xa + xa & x * Suc xa = x + x * xa"
-  by (import arithmetic MULT_CLAUSES)
-
-lemma PRE_SUB: "ALL (m::nat) n::nat. PRE (m - n) = PRE m - n"
-  by (import arithmetic PRE_SUB)
-
-lemma ADD_EQ_1: "ALL (m::nat) n::nat. (m + n = 1) = (m = 1 & n = 0 | m = 0 & n = 1)"
-  by (import arithmetic ADD_EQ_1)
-
-lemma ADD_INV_0_EQ: "ALL (m::nat) n::nat. (m + n = m) = (n = 0)"
-  by (import arithmetic ADD_INV_0_EQ)
-
-lemma PRE_SUC_EQ: "ALL (m::nat) n::nat. 0 < n --> (m = PRE n) = (Suc m = n)"
-  by (import arithmetic PRE_SUC_EQ)
-
-lemma INV_PRE_EQ: "ALL (m::nat) n::nat. 0 < m & 0 < n --> (PRE m = PRE n) = (m = n)"
-  by (import arithmetic INV_PRE_EQ)
-
-lemma LESS_SUC_NOT: "ALL (m::nat) n::nat. m < n --> ~ n < Suc m"
-  by (import arithmetic LESS_SUC_NOT)
-
-lemma ADD_EQ_SUB: "ALL (m::nat) (n::nat) p::nat. n <= p --> (m + n = p) = (m = p - n)"
-  by (import arithmetic ADD_EQ_SUB)
-
-lemma LESS_ADD_1: "ALL (x::nat) xa::nat. xa < x --> (EX xb::nat. x = xa + (xb + 1))"
-  by (import arithmetic LESS_ADD_1)
-
-lemma NOT_ODD_EQ_EVEN: "ALL (n::nat) m::nat. Suc (n + n) ~= m + m"
-  by (import arithmetic NOT_ODD_EQ_EVEN)
-
-lemma MULT_SUC_EQ: "ALL (p::nat) (m::nat) n::nat. (n * Suc p = m * Suc p) = (n = m)"
-  by (import arithmetic MULT_SUC_EQ)
-
-lemma MULT_EXP_MONO: "ALL (p::nat) (q::nat) (n::nat) m::nat.
-   (n * Suc q ^ p = m * Suc q ^ p) = (n = m)"
-  by (import arithmetic MULT_EXP_MONO)
-
-lemma LESS_ADD_SUC: "ALL (m::nat) n::nat. m < m + Suc n"
-  by (import arithmetic LESS_ADD_SUC)
-
-lemma LESS_OR_EQ_ADD: "ALL (n::nat) m::nat. n < m | (EX p::nat. n = p + m)"
-  by (import arithmetic LESS_OR_EQ_ADD)
-
-lemma WOP: "(All::((nat => bool) => bool) => bool)
- (%P::nat => bool.
-     (op -->::bool => bool => bool) ((Ex::(nat => bool) => bool) P)
-      ((Ex::(nat => bool) => bool)
-        (%n::nat.
-            (op &::bool => bool => bool) (P n)
-             ((All::(nat => bool) => bool)
-               (%m::nat.
-                   (op -->::bool => bool => bool)
-                    ((op <::nat => nat => bool) m n)
-                    ((Not::bool => bool) (P m)))))))"
-  by (import arithmetic WOP)
-
-lemma INV_PRE_LESS: "ALL m>0. ALL n::nat. (PRE m < PRE n) = (m < n)"
-  by (import arithmetic INV_PRE_LESS)
-
-lemma INV_PRE_LESS_EQ: "ALL n>0. ALL m::nat. (PRE m <= PRE n) = (m <= n)"
-  by (import arithmetic INV_PRE_LESS_EQ)
-
-lemma SUB_EQ_EQ_0: "ALL (m::nat) n::nat. (m - n = m) = (m = 0 | n = 0)"
-  by (import arithmetic SUB_EQ_EQ_0)
-
-lemma SUB_LESS_OR: "ALL (m::nat) n::nat. n < m --> n <= m - 1"
-  by (import arithmetic SUB_LESS_OR)
-
-lemma LESS_SUB_ADD_LESS: "ALL (n::nat) (m::nat) i::nat. i < n - m --> i + m < n"
-  by (import arithmetic LESS_SUB_ADD_LESS)
-
-lemma LESS_EQ_SUB_LESS: "ALL (x::nat) xa::nat. xa <= x --> (ALL c::nat. (x - xa < c) = (x < xa + c))"
-  by (import arithmetic LESS_EQ_SUB_LESS)
-
-lemma NOT_SUC_LESS_EQ: "ALL (x::nat) xa::nat. (~ Suc x <= xa) = (xa <= x)"
-  by (import arithmetic NOT_SUC_LESS_EQ)
-
-lemma SUB_LESS_EQ_ADD: "ALL (m::nat) p::nat. m <= p --> (ALL n::nat. (p - m <= n) = (p <= m + n))"
-  by (import arithmetic SUB_LESS_EQ_ADD)
-
-lemma SUB_CANCEL: "ALL (x::nat) (xa::nat) xb::nat.
-   xa <= x & xb <= x --> (x - xa = x - xb) = (xa = xb)"
-  by (import arithmetic SUB_CANCEL)
-
-lemma NOT_EXP_0: "ALL (m::nat) n::nat. Suc n ^ m ~= 0"
-  by (import arithmetic NOT_EXP_0)
-
-lemma ZERO_LESS_EXP: "ALL (m::nat) n::nat. 0 < Suc n ^ m"
-  by (import arithmetic ZERO_LESS_EXP)
-
-lemma ODD_OR_EVEN: "ALL x::nat. EX xa::nat. x = Suc (Suc 0) * xa | x = Suc (Suc 0) * xa + 1"
-  by (import arithmetic ODD_OR_EVEN)
-
-lemma LESS_EXP_SUC_MONO: "ALL (n::nat) m::nat. Suc (Suc m) ^ n < Suc (Suc m) ^ Suc n"
-  by (import arithmetic LESS_EXP_SUC_MONO)
-
-lemma LESS_LESS_CASES: "ALL (m::nat) n::nat. m = n | m < n | n < m"
-  by (import arithmetic LESS_LESS_CASES)
-
-lemma LESS_EQUAL_ADD: "ALL (m::nat) n::nat. m <= n --> (EX p::nat. n = m + p)"
-  by (import arithmetic LESS_EQUAL_ADD)
-
-lemma MULT_EQ_1: "ALL (x::nat) y::nat. (x * y = 1) = (x = 1 & y = 1)"
-  by (import arithmetic MULT_EQ_1)
+  sorry
+
+lemma NORM_0: "(0::nat) = (0::nat)"
+  sorry
+
+lemma num_case_compute: "nat_case f g n = (if n = 0 then f else g (PRE n))"
+  sorry
+
+lemma ADD_CLAUSES: "0 + m = m & m + 0 = m & Suc m + n = Suc (m + n) & m + Suc n = Suc (m + n)"
+  sorry
+
+lemma LESS_ADD: "(n::nat) < (m::nat) ==> EX p::nat. p + n = m"
+  sorry
+
+lemma LESS_ANTISYM: "~ ((m::nat) < (n::nat) & n < m)"
+  sorry
+
+lemma LESS_LESS_SUC: "~ (x < xa & xa < Suc x)"
+  sorry
+
+lemma FUN_EQ_LEMMA: "f x1 & ~ f x2 ==> x1 ~= x2"
+  sorry
+
+lemma LESS_NOT_SUC: "m < n & n ~= Suc m ==> Suc m < n"
+  sorry
+
+lemma LESS_0_CASES: "(0::nat) = (m::nat) | (0::nat) < m"
+  sorry
+
+lemma LESS_CASES_IMP: "~ (m::nat) < (n::nat) & m ~= n ==> n < m"
+  sorry
+
+lemma LESS_CASES: "(m::nat) < (n::nat) | n <= m"
+  sorry
+
+lemma LESS_EQ_SUC_REFL: "m <= Suc m"
+  sorry
+
+lemma LESS_ADD_NONZERO: "(n::nat) ~= (0::nat) ==> (m::nat) < m + n"
+  sorry
+
+lemma LESS_EQ_ANTISYM: "~ ((x::nat) < (xa::nat) & xa <= x)"
+  sorry
+
+lemma SUB_0: "(0::nat) - (m::nat) = (0::nat) & m - (0::nat) = m"
+  sorry
+
+lemma PRE_SUB1: "PRE m = m - 1"
+  sorry
+
+lemma MULT_CLAUSES: "0 * x = 0 &
+x * 0 = 0 &
+1 * x = x & x * 1 = x & Suc x * xa = x * xa + xa & x * Suc xa = x + x * xa"
+  sorry
+
+lemma PRE_SUB: "PRE (m - n) = PRE m - n"
+  sorry
+
+lemma ADD_EQ_1: "((m::nat) + (n::nat) = (1::nat)) =
+(m = (1::nat) & n = (0::nat) | m = (0::nat) & n = (1::nat))"
+  sorry
+
+lemma ADD_INV_0_EQ: "((m::nat) + (n::nat) = m) = (n = (0::nat))"
+  sorry
+
+lemma PRE_SUC_EQ: "0 < n ==> (m = PRE n) = (Suc m = n)"
+  sorry
+
+lemma INV_PRE_EQ: "0 < m & 0 < n ==> (PRE m = PRE n) = (m = n)"
+  sorry
+
+lemma LESS_SUC_NOT: "m < n ==> ~ n < Suc m"
+  sorry
+
+lemma ADD_EQ_SUB: "(n::nat) <= (p::nat) ==> ((m::nat) + n = p) = (m = p - n)"
+  sorry
+
+lemma LESS_ADD_1: "(xa::nat) < (x::nat) ==> EX xb::nat. x = xa + (xb + (1::nat))"
+  sorry
+
+lemma NOT_ODD_EQ_EVEN: "Suc (n + n) ~= m + m"
+  sorry
+
+lemma MULT_SUC_EQ: "(n * Suc p = m * Suc p) = (n = m)"
+  sorry
+
+lemma MULT_EXP_MONO: "(n * Suc q ^ p = m * Suc q ^ p) = (n = m)"
+  sorry
+
+lemma LESS_ADD_SUC: "m < m + Suc n"
+  sorry
+
+lemma LESS_OR_EQ_ADD: "(n::nat) < (m::nat) | (EX p::nat. n = p + m)"
+  sorry
+
+lemma WOP: "Ex (P::nat => bool) ==> EX n::nat. P n & (ALL m<n. ~ P m)"
+  sorry
+
+lemma INV_PRE_LESS: "0 < m ==> (PRE m < PRE n) = (m < n)"
+  sorry
+
+lemma INV_PRE_LESS_EQ: "0 < n ==> (PRE m <= PRE n) = (m <= n)"
+  sorry
+
+lemma SUB_EQ_EQ_0: "((m::nat) - (n::nat) = m) = (m = (0::nat) | n = (0::nat))"
+  sorry
+
+lemma SUB_LESS_OR: "(n::nat) < (m::nat) ==> n <= m - (1::nat)"
+  sorry
+
+lemma LESS_SUB_ADD_LESS: "(i::nat) < (n::nat) - (m::nat) ==> i + m < n"
+  sorry
+
+lemma LESS_EQ_SUB_LESS: "(xa::nat) <= (x::nat) ==> (x - xa < (c::nat)) = (x < xa + c)"
+  sorry
+
+lemma NOT_SUC_LESS_EQ: "(~ Suc x <= xa) = (xa <= x)"
+  sorry
+
+lemma SUB_LESS_EQ_ADD: "(m::nat) <= (p::nat) ==> (p - m <= (n::nat)) = (p <= m + n)"
+  sorry
+
+lemma SUB_CANCEL: "(xa::nat) <= (x::nat) & (xb::nat) <= x ==> (x - xa = x - xb) = (xa = xb)"
+  sorry
+
+lemma NOT_EXP_0: "Suc n ^ m ~= 0"
+  sorry
+
+lemma ZERO_LESS_EXP: "0 < Suc n ^ m"
+  sorry
+
+lemma ODD_OR_EVEN: "EX xa. x = Suc (Suc 0) * xa | x = Suc (Suc 0) * xa + 1"
+  sorry
+
+lemma LESS_EXP_SUC_MONO: "Suc (Suc m) ^ n < Suc (Suc m) ^ Suc n"
+  sorry
+
+lemma LESS_LESS_CASES: "(m::nat) = (n::nat) | m < n | n < m"
+  sorry
 
 consts
   FACT :: "nat => nat" 
 
-specification (FACT) FACT: "FACT 0 = 1 & (ALL n::nat. FACT (Suc n) = Suc n * FACT n)"
-  by (import arithmetic FACT)
-
-lemma FACT_LESS: "ALL n::nat. 0 < FACT n"
-  by (import arithmetic FACT_LESS)
-
-lemma EVEN_ODD: "ALL n::nat. EVEN n = (~ ODD n)"
-  by (import arithmetic EVEN_ODD)
-
-lemma ODD_EVEN: "ALL x::nat. ODD x = (~ EVEN x)"
-  by (import arithmetic ODD_EVEN)
-
-lemma EVEN_OR_ODD: "ALL x::nat. EVEN x | ODD x"
-  by (import arithmetic EVEN_OR_ODD)
-
-lemma EVEN_AND_ODD: "ALL x::nat. ~ (EVEN x & ODD x)"
-  by (import arithmetic EVEN_AND_ODD)
-
-lemma EVEN_ADD: "ALL (m::nat) n::nat. EVEN (m + n) = (EVEN m = EVEN n)"
-  by (import arithmetic EVEN_ADD)
-
-lemma EVEN_MULT: "ALL (m::nat) n::nat. EVEN (m * n) = (EVEN m | EVEN n)"
-  by (import arithmetic EVEN_MULT)
-
-lemma ODD_ADD: "ALL (m::nat) n::nat. ODD (m + n) = (ODD m ~= ODD n)"
-  by (import arithmetic ODD_ADD)
-
-lemma ODD_MULT: "ALL (m::nat) n::nat. ODD (m * n) = (ODD m & ODD n)"
-  by (import arithmetic ODD_MULT)
-
-lemma EVEN_DOUBLE: "ALL n::nat. EVEN (2 * n)"
-  by (import arithmetic EVEN_DOUBLE)
-
-lemma ODD_DOUBLE: "ALL x::nat. ODD (Suc (2 * x))"
-  by (import arithmetic ODD_DOUBLE)
-
-lemma EVEN_ODD_EXISTS: "ALL x::nat.
-   (EVEN x --> (EX m::nat. x = 2 * m)) &
-   (ODD x --> (EX m::nat. x = Suc (2 * m)))"
-  by (import arithmetic EVEN_ODD_EXISTS)
-
-lemma EVEN_EXISTS: "ALL n::nat. EVEN n = (EX m::nat. n = 2 * m)"
-  by (import arithmetic EVEN_EXISTS)
-
-lemma ODD_EXISTS: "ALL n::nat. ODD n = (EX m::nat. n = Suc (2 * m))"
-  by (import arithmetic ODD_EXISTS)
-
-lemma NOT_SUC_LESS_EQ_0: "ALL x::nat. ~ Suc x <= 0"
-  by (import arithmetic NOT_SUC_LESS_EQ_0)
-
-lemma NOT_LEQ: "ALL (x::nat) xa::nat. (~ x <= xa) = (Suc xa <= x)"
-  by (import arithmetic NOT_LEQ)
-
-lemma NOT_NUM_EQ: "ALL (x::nat) xa::nat. (x ~= xa) = (Suc x <= xa | Suc xa <= x)"
-  by (import arithmetic NOT_NUM_EQ)
-
-lemma NOT_GREATER_EQ: "ALL (x::nat) xa::nat. (~ xa <= x) = (Suc x <= xa)"
-  by (import arithmetic NOT_GREATER_EQ)
-
-lemma SUC_ADD_SYM: "ALL (m::nat) n::nat. Suc (m + n) = Suc n + m"
-  by (import arithmetic SUC_ADD_SYM)
-
-lemma NOT_SUC_ADD_LESS_EQ: "ALL (m::nat) n::nat. ~ Suc (m + n) <= m"
-  by (import arithmetic NOT_SUC_ADD_LESS_EQ)
-
-lemma SUB_LEFT_ADD: "ALL (m::nat) (n::nat) p::nat.
-   m + (n - p) = (if n <= p then m else m + n - p)"
-  by (import arithmetic SUB_LEFT_ADD)
-
-lemma SUB_RIGHT_ADD: "ALL (m::nat) (n::nat) p::nat. m - n + p = (if m <= n then p else m + p - n)"
-  by (import arithmetic SUB_RIGHT_ADD)
-
-lemma SUB_LEFT_SUB: "ALL (m::nat) (n::nat) p::nat.
-   m - (n - p) = (if n <= p then m else m + p - n)"
-  by (import arithmetic SUB_LEFT_SUB)
-
-lemma SUB_LEFT_SUC: "ALL (m::nat) n::nat. Suc (m - n) = (if m <= n then Suc 0 else Suc m - n)"
-  by (import arithmetic SUB_LEFT_SUC)
-
-lemma SUB_LEFT_LESS_EQ: "ALL (m::nat) (n::nat) p::nat. (m <= n - p) = (m + p <= n | m <= 0)"
-  by (import arithmetic SUB_LEFT_LESS_EQ)
-
-lemma SUB_RIGHT_LESS_EQ: "ALL (m::nat) (n::nat) p::nat. (m - n <= p) = (m <= n + p)"
-  by (import arithmetic SUB_RIGHT_LESS_EQ)
-
-lemma SUB_RIGHT_LESS: "ALL (m::nat) (n::nat) p::nat. (m - n < p) = (m < n + p & 0 < p)"
-  by (import arithmetic SUB_RIGHT_LESS)
-
-lemma SUB_RIGHT_GREATER_EQ: "ALL (m::nat) (n::nat) p::nat. (p <= m - n) = (n + p <= m | p <= 0)"
-  by (import arithmetic SUB_RIGHT_GREATER_EQ)
-
-lemma SUB_LEFT_GREATER: "ALL (m::nat) (n::nat) p::nat. (n - p < m) = (n < m + p & 0 < m)"
-  by (import arithmetic SUB_LEFT_GREATER)
-
-lemma SUB_RIGHT_GREATER: "ALL (m::nat) (n::nat) p::nat. (p < m - n) = (n + p < m)"
-  by (import arithmetic SUB_RIGHT_GREATER)
-
-lemma SUB_LEFT_EQ: "ALL (m::nat) (n::nat) p::nat. (m = n - p) = (m + p = n | m <= 0 & n <= p)"
-  by (import arithmetic SUB_LEFT_EQ)
-
-lemma SUB_RIGHT_EQ: "ALL (m::nat) (n::nat) p::nat. (m - n = p) = (m = n + p | m <= n & p <= 0)"
-  by (import arithmetic SUB_RIGHT_EQ)
-
-lemma LE: "(ALL n::nat. (n <= 0) = (n = 0)) &
+specification (FACT) FACT: "FACT 0 = 1 & (ALL n. FACT (Suc n) = Suc n * FACT n)"
+  sorry
+
+lemma FACT_LESS: "0 < FACT n"
+  sorry
+
+lemma EVEN_ODD: "EVEN n = (~ ODD n)"
+  sorry
+
+lemma ODD_EVEN: "ODD x = (~ EVEN x)"
+  sorry
+
+lemma EVEN_OR_ODD: "EVEN x | ODD x"
+  sorry
+
+lemma EVEN_AND_ODD: "~ (EVEN x & ODD x)"
+  sorry
+
+lemma EVEN_ADD: "EVEN (m + n) = (EVEN m = EVEN n)"
+  sorry
+
+lemma EVEN_MULT: "EVEN (m * n) = (EVEN m | EVEN n)"
+  sorry
+
+lemma ODD_ADD: "ODD (m + n) = (ODD m ~= ODD n)"
+  sorry
+
+lemma ODD_MULT: "ODD (m * n) = (ODD m & ODD n)"
+  sorry
+
+lemma EVEN_DOUBLE: "EVEN (2 * n)"
+  sorry
+
+lemma ODD_DOUBLE: "ODD (Suc (2 * x))"
+  sorry
+
+lemma EVEN_ODD_EXISTS: "(EVEN x --> (EX m. x = 2 * m)) & (ODD x --> (EX m. x = Suc (2 * m)))"
+  sorry
+
+lemma EVEN_EXISTS: "EVEN n = (EX m. n = 2 * m)"
+  sorry
+
+lemma ODD_EXISTS: "ODD n = (EX m. n = Suc (2 * m))"
+  sorry
+
+lemma NOT_SUC_LESS_EQ_0: "~ Suc x <= 0"
+  sorry
+
+lemma NOT_NUM_EQ: "(x ~= xa) = (Suc x <= xa | Suc xa <= x)"
+  sorry
+
+lemma SUC_ADD_SYM: "Suc (m + n) = Suc n + m"
+  sorry
+
+lemma NOT_SUC_ADD_LESS_EQ: "~ Suc (m + n) <= m"
+  sorry
+
+lemma SUB_LEFT_ADD: "(m::nat) + ((n::nat) - (p::nat)) = (if n <= p then m else m + n - p)"
+  sorry
+
+lemma SUB_RIGHT_ADD: "(m::nat) - (n::nat) + (p::nat) = (if m <= n then p else m + p - n)"
+  sorry
+
+lemma SUB_LEFT_SUB: "(m::nat) - ((n::nat) - (p::nat)) = (if n <= p then m else m + p - n)"
+  sorry
+
+lemma SUB_LEFT_SUC: "Suc (m - n) = (if m <= n then Suc 0 else Suc m - n)"
+  sorry
+
+lemma SUB_LEFT_LESS_EQ: "((m::nat) <= (n::nat) - (p::nat)) = (m + p <= n | m <= (0::nat))"
+  sorry
+
+lemma SUB_RIGHT_LESS_EQ: "((m::nat) - (n::nat) <= (p::nat)) = (m <= n + p)"
+  sorry
+
+lemma SUB_RIGHT_LESS: "((m::nat) - (n::nat) < (p::nat)) = (m < n + p & (0::nat) < p)"
+  sorry
+
+lemma SUB_RIGHT_GREATER_EQ: "((p::nat) <= (m::nat) - (n::nat)) = (n + p <= m | p <= (0::nat))"
+  sorry
+
+lemma SUB_LEFT_GREATER: "((n::nat) - (p::nat) < (m::nat)) = (n < m + p & (0::nat) < m)"
+  sorry
+
+lemma SUB_RIGHT_GREATER: "((p::nat) < (m::nat) - (n::nat)) = (n + p < m)"
+  sorry
+
+lemma SUB_LEFT_EQ: "((m::nat) = (n::nat) - (p::nat)) = (m + p = n | m <= (0::nat) & n <= p)"
+  sorry
+
+lemma SUB_RIGHT_EQ: "((m::nat) - (n::nat) = (p::nat)) = (m = n + p | m <= n & p <= (0::nat))"
+  sorry
+
+lemma LE: "(ALL n::nat. (n <= (0::nat)) = (n = (0::nat))) &
 (ALL (m::nat) n::nat. (m <= Suc n) = (m = Suc n | m <= n))"
-  by (import arithmetic LE)
-
-lemma DA: "ALL (k::nat) n::nat. 0 < n --> (EX (x::nat) q::nat. k = q * n + x & x < n)"
-  by (import arithmetic DA)
-
-lemma DIV_LESS_EQ: "ALL n>0. ALL k::nat. k div n <= k"
-  by (import arithmetic DIV_LESS_EQ)
-
-lemma DIV_UNIQUE: "ALL (n::nat) (k::nat) q::nat.
-   (EX r::nat. k = q * n + r & r < n) --> k div n = q"
-  by (import arithmetic DIV_UNIQUE)
-
-lemma MOD_UNIQUE: "ALL (n::nat) (k::nat) r::nat.
-   (EX q::nat. k = q * n + r & r < n) --> k mod n = r"
-  by (import arithmetic MOD_UNIQUE)
-
-lemma DIV_MULT: "ALL (n::nat) r::nat. r < n --> (ALL q::nat. (q * n + r) div n = q)"
-  by (import arithmetic DIV_MULT)
-
-lemma MOD_EQ_0: "ALL n>0. ALL k::nat. k * n mod n = 0"
-  by (import arithmetic MOD_EQ_0)
-
-lemma ZERO_MOD: "(All::(nat => bool) => bool)
- (%n::nat.
-     (op -->::bool => bool => bool) ((op <::nat => nat => bool) (0::nat) n)
-      ((op =::nat => nat => bool) ((op mod::nat => nat => nat) (0::nat) n)
-        (0::nat)))"
-  by (import arithmetic ZERO_MOD)
-
-lemma ZERO_DIV: "(All::(nat => bool) => bool)
- (%n::nat.
-     (op -->::bool => bool => bool) ((op <::nat => nat => bool) (0::nat) n)
-      ((op =::nat => nat => bool) ((op div::nat => nat => nat) (0::nat) n)
-        (0::nat)))"
-  by (import arithmetic ZERO_DIV)
-
-lemma MOD_MULT: "ALL (n::nat) r::nat. r < n --> (ALL q::nat. (q * n + r) mod n = r)"
-  by (import arithmetic MOD_MULT)
-
-lemma MOD_TIMES: "ALL n>0. ALL (q::nat) r::nat. (q * n + r) mod n = r mod n"
-  by (import arithmetic MOD_TIMES)
-
-lemma MOD_PLUS: "ALL n>0. ALL (j::nat) k::nat. (j mod n + k mod n) mod n = (j + k) mod n"
-  by (import arithmetic MOD_PLUS)
-
-lemma MOD_MOD: "ALL n>0. ALL k::nat. k mod n mod n = k mod n"
-  by (import arithmetic MOD_MOD)
-
-lemma ADD_DIV_ADD_DIV: "ALL x>0. ALL (xa::nat) r::nat. (xa * x + r) div x = xa + r div x"
-  by (import arithmetic ADD_DIV_ADD_DIV)
-
-lemma MOD_MULT_MOD: "ALL (m::nat) n::nat.
-   0 < n & 0 < m --> (ALL x::nat. x mod (n * m) mod n = x mod n)"
-  by (import arithmetic MOD_MULT_MOD)
-
-lemma DIVMOD_ID: "(All::(nat => bool) => bool)
- (%n::nat.
-     (op -->::bool => bool => bool) ((op <::nat => nat => bool) (0::nat) n)
-      ((op &::bool => bool => bool)
-        ((op =::nat => nat => bool) ((op div::nat => nat => nat) n n)
-          (1::nat))
-        ((op =::nat => nat => bool) ((op mod::nat => nat => nat) n n)
-          (0::nat))))"
-  by (import arithmetic DIVMOD_ID)
-
-lemma DIV_DIV_DIV_MULT: "ALL (x::nat) xa::nat.
-   0 < x & 0 < xa --> (ALL xb::nat. xb div x div xa = xb div (x * xa))"
-  by (import arithmetic DIV_DIV_DIV_MULT)
-
-lemma DIV_P: "ALL (P::nat => bool) (p::nat) q::nat.
-   0 < q --> P (p div q) = (EX (k::nat) r::nat. p = k * q + r & r < q & P k)"
-  by (import arithmetic DIV_P)
-
-lemma MOD_P: "ALL (P::nat => bool) (p::nat) q::nat.
-   0 < q --> P (p mod q) = (EX (k::nat) r::nat. p = k * q + r & r < q & P r)"
-  by (import arithmetic MOD_P)
-
-lemma MOD_TIMES2: "ALL n>0. ALL (j::nat) k::nat. j mod n * (k mod n) mod n = j * k mod n"
-  by (import arithmetic MOD_TIMES2)
-
-lemma MOD_COMMON_FACTOR: "ALL (n::nat) (p::nat) q::nat.
-   0 < n & 0 < q --> n * (p mod q) = n * p mod (n * q)"
-  by (import arithmetic MOD_COMMON_FACTOR)
-
-lemma num_case_cong: "ALL (M::nat) (M'::nat) (b::'a::type) f::nat => 'a::type.
-   M = M' &
-   (M' = 0 --> b = (b'::'a::type)) &
-   (ALL n::nat. M' = Suc n --> f n = (f'::nat => 'a::type) n) -->
-   nat_case b f M = nat_case b' f' M'"
-  by (import arithmetic num_case_cong)
-
-lemma SUC_ELIM_THM: "ALL P::nat => nat => bool.
-   (ALL n::nat. P (Suc n) n) = (ALL n>0. P n (n - 1))"
-  by (import arithmetic SUC_ELIM_THM)
+  sorry
+
+lemma DA: "(0::nat) < (n::nat) ==> EX (x::nat) q::nat. (k::nat) = q * n + x & x < n"
+  sorry
+
+lemma DIV_LESS_EQ: "(0::nat) < (n::nat) ==> (k::nat) div n <= k"
+  sorry
+
+lemma DIV_UNIQUE: "EX r::nat. (k::nat) = (q::nat) * (n::nat) + r & r < n ==> k div n = q"
+  sorry
+
+lemma MOD_UNIQUE: "EX q::nat. (k::nat) = q * (n::nat) + (r::nat) & r < n ==> k mod n = r"
+  sorry
+
+lemma DIV_MULT: "(r::nat) < (n::nat) ==> ((q::nat) * n + r) div n = q"
+  sorry
+
+lemma MOD_EQ_0: "(0::nat) < (n::nat) ==> (k::nat) * n mod n = (0::nat)"
+  sorry
+
+lemma ZERO_MOD: "(0::nat) < (n::nat) ==> (0::nat) mod n = (0::nat)"
+  sorry
+
+lemma ZERO_DIV: "(0::nat) < (n::nat) ==> (0::nat) div n = (0::nat)"
+  sorry
+
+lemma MOD_MULT: "(r::nat) < (n::nat) ==> ((q::nat) * n + r) mod n = r"
+  sorry
+
+lemma MOD_TIMES: "(0::nat) < (n::nat) ==> ((q::nat) * n + (r::nat)) mod n = r mod n"
+  sorry
+
+lemma MOD_PLUS: "(0::nat) < (n::nat)
+==> ((j::nat) mod n + (k::nat) mod n) mod n = (j + k) mod n"
+  sorry
+
+lemma MOD_MOD: "(0::nat) < (n::nat) ==> (k::nat) mod n mod n = k mod n"
+  sorry
+
+lemma ADD_DIV_ADD_DIV: "(0::nat) < (x::nat) ==> ((xa::nat) * x + (r::nat)) div x = xa + r div x"
+  sorry
+
+lemma MOD_MULT_MOD: "(0::nat) < (n::nat) & (0::nat) < (m::nat)
+==> (x::nat) mod (n * m) mod n = x mod n"
+  sorry
+
+lemma DIVMOD_ID: "(0::nat) < (n::nat) ==> n div n = (1::nat) & n mod n = (0::nat)"
+  sorry
+
+lemma DIV_DIV_DIV_MULT: "(0::nat) < (x::nat) & (0::nat) < (xa::nat)
+==> (xb::nat) div x div xa = xb div (x * xa)"
+  sorry
+
+lemma DIV_P: "(0::nat) < (q::nat)
+==> (P::nat => bool) ((p::nat) div q) =
+    (EX (k::nat) r::nat. p = k * q + r & r < q & P k)"
+  sorry
+
+lemma MOD_P: "(0::nat) < (q::nat)
+==> (P::nat => bool) ((p::nat) mod q) =
+    (EX (k::nat) r::nat. p = k * q + r & r < q & P r)"
+  sorry
+
+lemma MOD_TIMES2: "(0::nat) < (n::nat)
+==> (j::nat) mod n * ((k::nat) mod n) mod n = j * k mod n"
+  sorry
+
+lemma MOD_COMMON_FACTOR: "(0::nat) < (n::nat) & (0::nat) < (q::nat)
+==> n * ((p::nat) mod q) = n * p mod (n * q)"
+  sorry
+
+lemma num_case_cong: "M = M' & (M' = 0 --> b = b') & (ALL n. M' = Suc n --> f n = f' n)
+==> nat_case b f M = nat_case b' f' M'"
+  sorry
+
+lemma SUC_ELIM_THM: "(ALL n. P (Suc n) n) = (ALL n>0. P n (n - 1))"
+  sorry
 
 lemma SUB_ELIM_THM: "(P::nat => bool) ((a::nat) - (b::nat)) =
-(ALL x::nat. (b = a + x --> P 0) & (a = b + x --> P x))"
-  by (import arithmetic SUB_ELIM_THM)
-
-lemma PRE_ELIM_THM: "(P::nat => bool) (PRE (n::nat)) =
-(ALL m::nat. (n = 0 --> P 0) & (n = Suc m --> P m))"
-  by (import arithmetic PRE_ELIM_THM)
-
-lemma MULT_INCREASES: "ALL (m::nat) n::nat. 1 < m & 0 < n --> Suc n <= m * n"
-  by (import arithmetic MULT_INCREASES)
-
-lemma EXP_ALWAYS_BIG_ENOUGH: "ALL b>1. ALL n::nat. EX m::nat. n <= b ^ m"
-  by (import arithmetic EXP_ALWAYS_BIG_ENOUGH)
-
-lemma EXP_EQ_0: "ALL (n::nat) m::nat. (n ^ m = 0) = (n = 0 & 0 < m)"
-  by (import arithmetic EXP_EQ_0)
-
-lemma EXP_1: "(All::(nat => bool) => bool)
- (%x::nat.
-     (op &::bool => bool => bool)
-      ((op =::nat => nat => bool) ((op ^::nat => nat => nat) (1::nat) x)
-        (1::nat))
-      ((op =::nat => nat => bool) ((op ^::nat => nat => nat) x (1::nat)) x))"
-  by (import arithmetic EXP_1)
-
-lemma EXP_EQ_1: "ALL (n::nat) m::nat. (n ^ m = 1) = (n = 1 | m = 0)"
-  by (import arithmetic EXP_EQ_1)
-
-lemma MIN_MAX_EQ: "ALL (x::nat) xa::nat. (min x xa = max x xa) = (x = xa)"
-  by (import arithmetic MIN_MAX_EQ)
-
-lemma MIN_MAX_LT: "ALL (x::nat) xa::nat. (min x xa < max x xa) = (x ~= xa)"
-  by (import arithmetic MIN_MAX_LT)
-
-lemma MIN_MAX_PRED: "ALL (P::nat => bool) (m::nat) n::nat.
-   P m & P n --> P (min m n) & P (max m n)"
-  by (import arithmetic MIN_MAX_PRED)
-
-lemma MIN_LT: "ALL (x::nat) xa::nat.
-   (min xa x < xa) = (xa ~= x & min xa x = x) &
-   (min xa x < x) = (xa ~= x & min xa x = xa) &
-   (xa < min xa x) = False & (x < min xa x) = False"
-  by (import arithmetic MIN_LT)
-
-lemma MAX_LT: "ALL (x::nat) xa::nat.
-   (xa < max xa x) = (xa ~= x & max xa x = x) &
-   (x < max xa x) = (xa ~= x & max xa x = xa) &
-   (max xa x < xa) = False & (max xa x < x) = False"
-  by (import arithmetic MAX_LT)
-
-lemma MIN_LE: "ALL (x::nat) xa::nat. min xa x <= xa & min xa x <= x"
-  by (import arithmetic MIN_LE)
-
-lemma MAX_LE: "ALL (x::nat) xa::nat. xa <= max xa x & x <= max xa x"
-  by (import arithmetic MAX_LE)
-
-lemma MIN_0: "ALL x::nat. min x 0 = 0 & min 0 x = 0"
-  by (import arithmetic MIN_0)
-
-lemma MAX_0: "ALL x::nat. max x 0 = x & max 0 x = x"
-  by (import arithmetic MAX_0)
-
-lemma EXISTS_GREATEST: "ALL P::nat => bool.
-   (Ex P & (EX x::nat. ALL y::nat. x < y --> ~ P y)) =
-   (EX x::nat. P x & (ALL y::nat. x < y --> ~ P y))"
-  by (import arithmetic EXISTS_GREATEST)
+(ALL x::nat. (b = a + x --> P (0::nat)) & (a = b + x --> P x))"
+  sorry
+
+lemma PRE_ELIM_THM: "P (PRE n) = (ALL m. (n = 0 --> P 0) & (n = Suc m --> P m))"
+  sorry
+
+lemma MULT_INCREASES: "1 < m & 0 < n ==> Suc n <= m * n"
+  sorry
+
+lemma EXP_ALWAYS_BIG_ENOUGH: "(1::nat) < (b::nat) ==> EX m::nat. (n::nat) <= b ^ m"
+  sorry
+
+lemma EXP_EQ_0: "((n::nat) ^ (m::nat) = (0::nat)) = (n = (0::nat) & (0::nat) < m)"
+  sorry
+
+lemma EXP_1: "(1::nat) ^ (x::nat) = (1::nat) & x ^ (1::nat) = x"
+  sorry
+
+lemma MIN_MAX_EQ: "(min (x::nat) (xa::nat) = max x xa) = (x = xa)"
+  sorry
+
+lemma MIN_MAX_LT: "(min (x::nat) (xa::nat) < max x xa) = (x ~= xa)"
+  sorry
+
+lemma MIN_MAX_PRED: "(P::nat => bool) (m::nat) & P (n::nat) ==> P (min m n) & P (max m n)"
+  sorry
+
+lemma MIN_LT: "(min (xa::nat) (x::nat) < xa) = (xa ~= x & min xa x = x) &
+(min xa x < x) = (xa ~= x & min xa x = xa) &
+(xa < min xa x) = False & (x < min xa x) = False"
+  sorry
+
+lemma MAX_LT: "((xa::nat) < max xa (x::nat)) = (xa ~= x & max xa x = x) &
+(x < max xa x) = (xa ~= x & max xa x = xa) &
+(max xa x < xa) = False & (max xa x < x) = False"
+  sorry
+
+lemma MIN_LE: "min (xa::nat) (x::nat) <= xa & min xa x <= x"
+  sorry
+
+lemma MAX_LE: "(xa::nat) <= max xa (x::nat) & x <= max xa x"
+  sorry
+
+lemma MIN_0: "min (x::nat) (0::nat) = (0::nat) & min (0::nat) x = (0::nat)"
+  sorry
+
+lemma MAX_0: "max (x::nat) (0::nat) = x & max (0::nat) x = x"
+  sorry
+
+lemma EXISTS_GREATEST: "(Ex (P::nat => bool) & (EX x::nat. ALL y>x. ~ P y)) =
+(EX x::nat. P x & (ALL y>x. ~ P y))"
+  sorry
 
 ;end_setup
 
 ;setup_theory hrat
 
-definition trat_1 :: "nat * nat" where 
+definition
+  trat_1 :: "nat * nat"  where
   "trat_1 == (0, 0)"
 
 lemma trat_1: "trat_1 = (0, 0)"
-  by (import hrat trat_1)
-
-definition trat_inv :: "nat * nat => nat * nat" where 
-  "trat_inv == %(x::nat, y::nat). (y, x)"
-
-lemma trat_inv: "ALL (x::nat) y::nat. trat_inv (x, y) = (y, x)"
-  by (import hrat trat_inv)
-
-definition trat_add :: "nat * nat => nat * nat => nat * nat" where 
+  sorry
+
+definition
+  trat_inv :: "nat * nat => nat * nat"  where
+  "trat_inv == %(x, y). (y, x)"
+
+lemma trat_inv: "trat_inv (x, y) = (y, x)"
+  sorry
+
+definition
+  trat_add :: "nat * nat => nat * nat => nat * nat"  where
   "trat_add ==
-%(x::nat, y::nat) (x'::nat, y'::nat).
+%(x, y) (x', y').
    (PRE (Suc x * Suc y' + Suc x' * Suc y), PRE (Suc y * Suc y'))"
 
-lemma trat_add: "ALL (x::nat) (y::nat) (x'::nat) y'::nat.
-   trat_add (x, y) (x', y') =
-   (PRE (Suc x * Suc y' + Suc x' * Suc y), PRE (Suc y * Suc y'))"
-  by (import hrat trat_add)
-
-definition trat_mul :: "nat * nat => nat * nat => nat * nat" where 
-  "trat_mul ==
-%(x::nat, y::nat) (x'::nat, y'::nat).
-   (PRE (Suc x * Suc x'), PRE (Suc y * Suc y'))"
-
-lemma trat_mul: "ALL (x::nat) (y::nat) (x'::nat) y'::nat.
-   trat_mul (x, y) (x', y') = (PRE (Suc x * Suc x'), PRE (Suc y * Suc y'))"
-  by (import hrat trat_mul)
+lemma trat_add: "trat_add (x, y) (x', y') =
+(PRE (Suc x * Suc y' + Suc x' * Suc y), PRE (Suc y * Suc y'))"
+  sorry
+
+definition
+  trat_mul :: "nat * nat => nat * nat => nat * nat"  where
+  "trat_mul == %(x, y) (x', y'). (PRE (Suc x * Suc x'), PRE (Suc y * Suc y'))"
+
+lemma trat_mul: "trat_mul (x, y) (x', y') = (PRE (Suc x * Suc x'), PRE (Suc y * Suc y'))"
+  sorry
 
 consts
   trat_sucint :: "nat => nat * nat" 
 
 specification (trat_sucint) trat_sucint: "trat_sucint 0 = trat_1 &
-(ALL n::nat. trat_sucint (Suc n) = trat_add (trat_sucint n) trat_1)"
-  by (import hrat trat_sucint)
-
-definition trat_eq :: "nat * nat => nat * nat => bool" where 
-  "trat_eq ==
-%(x::nat, y::nat) (x'::nat, y'::nat). Suc x * Suc y' = Suc x' * Suc y"
-
-lemma trat_eq: "ALL (x::nat) (y::nat) (x'::nat) y'::nat.
-   trat_eq (x, y) (x', y') = (Suc x * Suc y' = Suc x' * Suc y)"
-  by (import hrat trat_eq)
-
-lemma TRAT_EQ_REFL: "ALL p::nat * nat. trat_eq p p"
-  by (import hrat TRAT_EQ_REFL)
-
-lemma TRAT_EQ_SYM: "ALL (p::nat * nat) q::nat * nat. trat_eq p q = trat_eq q p"
-  by (import hrat TRAT_EQ_SYM)
-
-lemma TRAT_EQ_TRANS: "ALL (p::nat * nat) (q::nat * nat) r::nat * nat.
-   trat_eq p q & trat_eq q r --> trat_eq p r"
-  by (import hrat TRAT_EQ_TRANS)
-
-lemma TRAT_EQ_AP: "ALL (p::nat * nat) q::nat * nat. p = q --> trat_eq p q"
-  by (import hrat TRAT_EQ_AP)
-
-lemma TRAT_ADD_SYM_EQ: "ALL (h::nat * nat) i::nat * nat. trat_add h i = trat_add i h"
-  by (import hrat TRAT_ADD_SYM_EQ)
-
-lemma TRAT_MUL_SYM_EQ: "ALL (h::nat * nat) i::nat * nat. trat_mul h i = trat_mul i h"
-  by (import hrat TRAT_MUL_SYM_EQ)
-
-lemma TRAT_INV_WELLDEFINED: "ALL (p::nat * nat) q::nat * nat.
-   trat_eq p q --> trat_eq (trat_inv p) (trat_inv q)"
-  by (import hrat TRAT_INV_WELLDEFINED)
-
-lemma TRAT_ADD_WELLDEFINED: "ALL (p::nat * nat) (q::nat * nat) r::nat * nat.
-   trat_eq p q --> trat_eq (trat_add p r) (trat_add q r)"
-  by (import hrat TRAT_ADD_WELLDEFINED)
-
-lemma TRAT_ADD_WELLDEFINED2: "ALL (p1::nat * nat) (p2::nat * nat) (q1::nat * nat) q2::nat * nat.
-   trat_eq p1 p2 & trat_eq q1 q2 -->
-   trat_eq (trat_add p1 q1) (trat_add p2 q2)"
-  by (import hrat TRAT_ADD_WELLDEFINED2)
-
-lemma TRAT_MUL_WELLDEFINED: "ALL (p::nat * nat) (q::nat * nat) r::nat * nat.
-   trat_eq p q --> trat_eq (trat_mul p r) (trat_mul q r)"
-  by (import hrat TRAT_MUL_WELLDEFINED)
-
-lemma TRAT_MUL_WELLDEFINED2: "ALL (p1::nat * nat) (p2::nat * nat) (q1::nat * nat) q2::nat * nat.
-   trat_eq p1 p2 & trat_eq q1 q2 -->
-   trat_eq (trat_mul p1 q1) (trat_mul p2 q2)"
-  by (import hrat TRAT_MUL_WELLDEFINED2)
-
-lemma TRAT_ADD_SYM: "ALL (h::nat * nat) i::nat * nat. trat_eq (trat_add h i) (trat_add i h)"
-  by (import hrat TRAT_ADD_SYM)
-
-lemma TRAT_ADD_ASSOC: "ALL (h::nat * nat) (i::nat * nat) j::nat * nat.
-   trat_eq (trat_add h (trat_add i j)) (trat_add (trat_add h i) j)"
-  by (import hrat TRAT_ADD_ASSOC)
-
-lemma TRAT_MUL_SYM: "ALL (h::nat * nat) i::nat * nat. trat_eq (trat_mul h i) (trat_mul i h)"
-  by (import hrat TRAT_MUL_SYM)
-
-lemma TRAT_MUL_ASSOC: "ALL (h::nat * nat) (i::nat * nat) j::nat * nat.
-   trat_eq (trat_mul h (trat_mul i j)) (trat_mul (trat_mul h i) j)"
-  by (import hrat TRAT_MUL_ASSOC)
-
-lemma TRAT_LDISTRIB: "ALL (h::nat * nat) (i::nat * nat) j::nat * nat.
-   trat_eq (trat_mul h (trat_add i j))
-    (trat_add (trat_mul h i) (trat_mul h j))"
-  by (import hrat TRAT_LDISTRIB)
-
-lemma TRAT_MUL_LID: "ALL h::nat * nat. trat_eq (trat_mul trat_1 h) h"
-  by (import hrat TRAT_MUL_LID)
-
-lemma TRAT_MUL_LINV: "ALL h::nat * nat. trat_eq (trat_mul (trat_inv h) h) trat_1"
-  by (import hrat TRAT_MUL_LINV)
-
-lemma TRAT_NOZERO: "ALL (h::nat * nat) i::nat * nat. ~ trat_eq (trat_add h i) h"
-  by (import hrat TRAT_NOZERO)
-
-lemma TRAT_ADD_TOTAL: "ALL (h::nat * nat) i::nat * nat.
-   trat_eq h i |
-   (EX d::nat * nat. trat_eq h (trat_add i d)) |
-   (EX d::nat * nat. trat_eq i (trat_add h d))"
-  by (import hrat TRAT_ADD_TOTAL)
-
-lemma TRAT_SUCINT_0: "ALL n::nat. trat_eq (trat_sucint n) (n, 0)"
-  by (import hrat TRAT_SUCINT_0)
-
-lemma TRAT_ARCH: "ALL h::nat * nat.
-   EX (n::nat) d::nat * nat. trat_eq (trat_sucint n) (trat_add h d)"
-  by (import hrat TRAT_ARCH)
+(ALL n. trat_sucint (Suc n) = trat_add (trat_sucint n) trat_1)"
+  sorry
+
+definition
+  trat_eq :: "nat * nat => nat * nat => bool"  where
+  "trat_eq == %(x, y) (x', y'). Suc x * Suc y' = Suc x' * Suc y"
+
+lemma trat_eq: "trat_eq (x, y) (x', y') = (Suc x * Suc y' = Suc x' * Suc y)"
+  sorry
+
+lemma TRAT_EQ_REFL: "trat_eq p p"
+  sorry
+
+lemma TRAT_EQ_SYM: "trat_eq p q = trat_eq q p"
+  sorry
+
+lemma TRAT_EQ_TRANS: "trat_eq p q & trat_eq q r ==> trat_eq p r"
+  sorry
+
+lemma TRAT_EQ_AP: "p = q ==> trat_eq p q"
+  sorry
+
+lemma TRAT_ADD_SYM_EQ: "trat_add h i = trat_add i h"
+  sorry
+
+lemma TRAT_MUL_SYM_EQ: "trat_mul h i = trat_mul i h"
+  sorry
+
+lemma TRAT_INV_WELLDEFINED: "trat_eq p q ==> trat_eq (trat_inv p) (trat_inv q)"
+  sorry
+
+lemma TRAT_ADD_WELLDEFINED: "trat_eq p q ==> trat_eq (trat_add p r) (trat_add q r)"
+  sorry
+
+lemma TRAT_ADD_WELLDEFINED2: "trat_eq p1 p2 & trat_eq q1 q2 ==> trat_eq (trat_add p1 q1) (trat_add p2 q2)"
+  sorry
+
+lemma TRAT_MUL_WELLDEFINED: "trat_eq p q ==> trat_eq (trat_mul p r) (trat_mul q r)"
+  sorry
+
+lemma TRAT_MUL_WELLDEFINED2: "trat_eq p1 p2 & trat_eq q1 q2 ==> trat_eq (trat_mul p1 q1) (trat_mul p2 q2)"
+  sorry
+
+lemma TRAT_ADD_SYM: "trat_eq (trat_add h i) (trat_add i h)"
+  sorry
+
+lemma TRAT_ADD_ASSOC: "trat_eq (trat_add h (trat_add i j)) (trat_add (trat_add h i) j)"
+  sorry
+
+lemma TRAT_MUL_SYM: "trat_eq (trat_mul h i) (trat_mul i h)"
+  sorry
+
+lemma TRAT_MUL_ASSOC: "trat_eq (trat_mul h (trat_mul i j)) (trat_mul (trat_mul h i) j)"
+  sorry
+
+lemma TRAT_LDISTRIB: "trat_eq (trat_mul h (trat_add i j)) (trat_add (trat_mul h i) (trat_mul h j))"
+  sorry
+
+lemma TRAT_MUL_LID: "trat_eq (trat_mul trat_1 h) h"
+  sorry
+
+lemma TRAT_MUL_LINV: "trat_eq (trat_mul (trat_inv h) h) trat_1"
+  sorry
+
+lemma TRAT_NOZERO: "~ trat_eq (trat_add h i) h"
+  sorry
+
+lemma TRAT_ADD_TOTAL: "trat_eq h i |
+(EX d. trat_eq h (trat_add i d)) | (EX d. trat_eq i (trat_add h d))"
+  sorry
+
+lemma TRAT_SUCINT_0: "trat_eq (trat_sucint n) (n, 0)"
+  sorry
+
+lemma TRAT_ARCH: "EX n d. trat_eq (trat_sucint n) (trat_add h d)"
+  sorry
 
 lemma TRAT_SUCINT: "trat_eq (trat_sucint 0) trat_1 &
-(ALL n::nat.
-    trat_eq (trat_sucint (Suc n)) (trat_add (trat_sucint n) trat_1))"
-  by (import hrat TRAT_SUCINT)
-
-lemma TRAT_EQ_EQUIV: "ALL (p::nat * nat) q::nat * nat. trat_eq p q = (trat_eq p = trat_eq q)"
-  by (import hrat TRAT_EQ_EQUIV)
-
-typedef (open) hrat = "{x::nat * nat => bool. EX xa::nat * nat. x = trat_eq xa}" 
-  by (rule typedef_helper,import hrat hrat_TY_DEF)
+(ALL n. trat_eq (trat_sucint (Suc n)) (trat_add (trat_sucint n) trat_1))"
+  sorry
+
+lemma TRAT_EQ_EQUIV: "trat_eq p q = (trat_eq p = trat_eq q)"
+  sorry
+
+typedef (open) hrat = "{x. EX xa. x = trat_eq xa}" 
+  sorry
 
 lemmas hrat_TY_DEF = typedef_hol2hol4 [OF type_definition_hrat]
 
@@ -1866,227 +1477,213 @@
   mk_hrat :: "(nat * nat => bool) => hrat" 
   dest_hrat :: "hrat => nat * nat => bool" 
 
-specification (dest_hrat mk_hrat) hrat_tybij: "(ALL a::hrat. mk_hrat (dest_hrat a) = a) &
-(ALL r::nat * nat => bool.
-    (EX x::nat * nat. r = trat_eq x) = (dest_hrat (mk_hrat r) = r))"
-  by (import hrat hrat_tybij)
-
-definition hrat_1 :: "hrat" where 
+specification (dest_hrat mk_hrat) hrat_tybij: "(ALL a. mk_hrat (dest_hrat a) = a) &
+(ALL r. (EX x. r = trat_eq x) = (dest_hrat (mk_hrat r) = r))"
+  sorry
+
+definition
+  hrat_1 :: "hrat"  where
   "hrat_1 == mk_hrat (trat_eq trat_1)"
 
 lemma hrat_1: "hrat_1 = mk_hrat (trat_eq trat_1)"
-  by (import hrat hrat_1)
-
-definition hrat_inv :: "hrat => hrat" where 
-  "hrat_inv == %T1::hrat. mk_hrat (trat_eq (trat_inv (Eps (dest_hrat T1))))"
-
-lemma hrat_inv: "ALL T1::hrat.
-   hrat_inv T1 = mk_hrat (trat_eq (trat_inv (Eps (dest_hrat T1))))"
-  by (import hrat hrat_inv)
-
-definition hrat_add :: "hrat => hrat => hrat" where 
+  sorry
+
+definition
+  hrat_inv :: "hrat => hrat"  where
+  "hrat_inv == %T1. mk_hrat (trat_eq (trat_inv (Eps (dest_hrat T1))))"
+
+lemma hrat_inv: "hrat_inv T1 = mk_hrat (trat_eq (trat_inv (Eps (dest_hrat T1))))"
+  sorry
+
+definition
+  hrat_add :: "hrat => hrat => hrat"  where
   "hrat_add ==
-%(T1::hrat) T2::hrat.
+%T1 T2.
    mk_hrat (trat_eq (trat_add (Eps (dest_hrat T1)) (Eps (dest_hrat T2))))"
 
-lemma hrat_add: "ALL (T1::hrat) T2::hrat.
-   hrat_add T1 T2 =
-   mk_hrat (trat_eq (trat_add (Eps (dest_hrat T1)) (Eps (dest_hrat T2))))"
-  by (import hrat hrat_add)
-
-definition hrat_mul :: "hrat => hrat => hrat" where 
+lemma hrat_add: "hrat_add T1 T2 =
+mk_hrat (trat_eq (trat_add (Eps (dest_hrat T1)) (Eps (dest_hrat T2))))"
+  sorry
+
+definition
+  hrat_mul :: "hrat => hrat => hrat"  where
   "hrat_mul ==
-%(T1::hrat) T2::hrat.
-   mk_hrat (trat_eq (trat_mul (Eps (dest_hrat T1)) (Eps (dest_hrat T2))))"
-
-lemma hrat_mul: "ALL (T1::hrat) T2::hrat.
-   hrat_mul T1 T2 =
+%T1 T2.
    mk_hrat (trat_eq (trat_mul (Eps (dest_hrat T1)) (Eps (dest_hrat T2))))"
-  by (import hrat hrat_mul)
-
-definition hrat_sucint :: "nat => hrat" where 
-  "hrat_sucint == %T1::nat. mk_hrat (trat_eq (trat_sucint T1))"
-
-lemma hrat_sucint: "ALL T1::nat. hrat_sucint T1 = mk_hrat (trat_eq (trat_sucint T1))"
-  by (import hrat hrat_sucint)
-
-lemma HRAT_ADD_SYM: "ALL (h::hrat) i::hrat. hrat_add h i = hrat_add i h"
-  by (import hrat HRAT_ADD_SYM)
-
-lemma HRAT_ADD_ASSOC: "ALL (h::hrat) (i::hrat) j::hrat.
-   hrat_add h (hrat_add i j) = hrat_add (hrat_add h i) j"
-  by (import hrat HRAT_ADD_ASSOC)
-
-lemma HRAT_MUL_SYM: "ALL (h::hrat) i::hrat. hrat_mul h i = hrat_mul i h"
-  by (import hrat HRAT_MUL_SYM)
-
-lemma HRAT_MUL_ASSOC: "ALL (h::hrat) (i::hrat) j::hrat.
-   hrat_mul h (hrat_mul i j) = hrat_mul (hrat_mul h i) j"
-  by (import hrat HRAT_MUL_ASSOC)
-
-lemma HRAT_LDISTRIB: "ALL (h::hrat) (i::hrat) j::hrat.
-   hrat_mul h (hrat_add i j) = hrat_add (hrat_mul h i) (hrat_mul h j)"
-  by (import hrat HRAT_LDISTRIB)
-
-lemma HRAT_MUL_LID: "ALL h::hrat. hrat_mul hrat_1 h = h"
-  by (import hrat HRAT_MUL_LID)
-
-lemma HRAT_MUL_LINV: "ALL h::hrat. hrat_mul (hrat_inv h) h = hrat_1"
-  by (import hrat HRAT_MUL_LINV)
-
-lemma HRAT_NOZERO: "ALL (h::hrat) i::hrat. hrat_add h i ~= h"
-  by (import hrat HRAT_NOZERO)
-
-lemma HRAT_ADD_TOTAL: "ALL (h::hrat) i::hrat.
-   h = i | (EX x::hrat. h = hrat_add i x) | (EX x::hrat. i = hrat_add h x)"
-  by (import hrat HRAT_ADD_TOTAL)
-
-lemma HRAT_ARCH: "ALL h::hrat. EX (x::nat) xa::hrat. hrat_sucint x = hrat_add h xa"
-  by (import hrat HRAT_ARCH)
+
+lemma hrat_mul: "hrat_mul T1 T2 =
+mk_hrat (trat_eq (trat_mul (Eps (dest_hrat T1)) (Eps (dest_hrat T2))))"
+  sorry
+
+definition
+  hrat_sucint :: "nat => hrat"  where
+  "hrat_sucint == %T1. mk_hrat (trat_eq (trat_sucint T1))"
+
+lemma hrat_sucint: "hrat_sucint T1 = mk_hrat (trat_eq (trat_sucint T1))"
+  sorry
+
+lemma HRAT_ADD_SYM: "hrat_add h i = hrat_add i h"
+  sorry
+
+lemma HRAT_ADD_ASSOC: "hrat_add h (hrat_add i j) = hrat_add (hrat_add h i) j"
+  sorry
+
+lemma HRAT_MUL_SYM: "hrat_mul h i = hrat_mul i h"
+  sorry
+
+lemma HRAT_MUL_ASSOC: "hrat_mul h (hrat_mul i j) = hrat_mul (hrat_mul h i) j"
+  sorry
+
+lemma HRAT_LDISTRIB: "hrat_mul h (hrat_add i j) = hrat_add (hrat_mul h i) (hrat_mul h j)"
+  sorry
+
+lemma HRAT_MUL_LID: "hrat_mul hrat_1 h = h"
+  sorry
+
+lemma HRAT_MUL_LINV: "hrat_mul (hrat_inv h) h = hrat_1"
+  sorry
+
+lemma HRAT_NOZERO: "hrat_add h i ~= h"
+  sorry
+
+lemma HRAT_ADD_TOTAL: "h = i | (EX x. h = hrat_add i x) | (EX x. i = hrat_add h x)"
+  sorry
+
+lemma HRAT_ARCH: "EX x xa. hrat_sucint x = hrat_add h xa"
+  sorry
 
 lemma HRAT_SUCINT: "hrat_sucint 0 = hrat_1 &
-(ALL x::nat. hrat_sucint (Suc x) = hrat_add (hrat_sucint x) hrat_1)"
-  by (import hrat HRAT_SUCINT)
+(ALL x. hrat_sucint (Suc x) = hrat_add (hrat_sucint x) hrat_1)"
+  sorry
 
 ;end_setup
 
 ;setup_theory hreal
 
-definition hrat_lt :: "hrat => hrat => bool" where 
-  "hrat_lt == %(x::hrat) y::hrat. EX d::hrat. y = hrat_add x d"
-
-lemma hrat_lt: "ALL (x::hrat) y::hrat. hrat_lt x y = (EX d::hrat. y = hrat_add x d)"
-  by (import hreal hrat_lt)
-
-lemma HRAT_LT_REFL: "ALL x::hrat. ~ hrat_lt x x"
-  by (import hreal HRAT_LT_REFL)
-
-lemma HRAT_LT_TRANS: "ALL (x::hrat) (y::hrat) z::hrat. hrat_lt x y & hrat_lt y z --> hrat_lt x z"
-  by (import hreal HRAT_LT_TRANS)
-
-lemma HRAT_LT_ANTISYM: "ALL (x::hrat) y::hrat. ~ (hrat_lt x y & hrat_lt y x)"
-  by (import hreal HRAT_LT_ANTISYM)
-
-lemma HRAT_LT_TOTAL: "ALL (x::hrat) y::hrat. x = y | hrat_lt x y | hrat_lt y x"
-  by (import hreal HRAT_LT_TOTAL)
-
-lemma HRAT_MUL_RID: "ALL x::hrat. hrat_mul x hrat_1 = x"
-  by (import hreal HRAT_MUL_RID)
-
-lemma HRAT_MUL_RINV: "ALL x::hrat. hrat_mul x (hrat_inv x) = hrat_1"
-  by (import hreal HRAT_MUL_RINV)
-
-lemma HRAT_RDISTRIB: "ALL (x::hrat) (y::hrat) z::hrat.
-   hrat_mul (hrat_add x y) z = hrat_add (hrat_mul x z) (hrat_mul y z)"
-  by (import hreal HRAT_RDISTRIB)
-
-lemma HRAT_LT_ADDL: "ALL (x::hrat) y::hrat. hrat_lt x (hrat_add x y)"
-  by (import hreal HRAT_LT_ADDL)
-
-lemma HRAT_LT_ADDR: "ALL (x::hrat) xa::hrat. hrat_lt xa (hrat_add x xa)"
-  by (import hreal HRAT_LT_ADDR)
-
-lemma HRAT_LT_GT: "ALL (x::hrat) y::hrat. hrat_lt x y --> ~ hrat_lt y x"
-  by (import hreal HRAT_LT_GT)
-
-lemma HRAT_LT_NE: "ALL (x::hrat) y::hrat. hrat_lt x y --> x ~= y"
-  by (import hreal HRAT_LT_NE)
-
-lemma HRAT_EQ_LADD: "ALL (x::hrat) (y::hrat) z::hrat. (hrat_add x y = hrat_add x z) = (y = z)"
-  by (import hreal HRAT_EQ_LADD)
-
-lemma HRAT_EQ_LMUL: "ALL (x::hrat) (y::hrat) z::hrat. (hrat_mul x y = hrat_mul x z) = (y = z)"
-  by (import hreal HRAT_EQ_LMUL)
-
-lemma HRAT_LT_ADD2: "ALL (u::hrat) (v::hrat) (x::hrat) y::hrat.
-   hrat_lt u x & hrat_lt v y --> hrat_lt (hrat_add u v) (hrat_add x y)"
-  by (import hreal HRAT_LT_ADD2)
-
-lemma HRAT_LT_LADD: "ALL (x::hrat) (y::hrat) z::hrat.
-   hrat_lt (hrat_add z x) (hrat_add z y) = hrat_lt x y"
-  by (import hreal HRAT_LT_LADD)
-
-lemma HRAT_LT_RADD: "ALL (x::hrat) (y::hrat) z::hrat.
-   hrat_lt (hrat_add x z) (hrat_add y z) = hrat_lt x y"
-  by (import hreal HRAT_LT_RADD)
-
-lemma HRAT_LT_MUL2: "ALL (u::hrat) (v::hrat) (x::hrat) y::hrat.
-   hrat_lt u x & hrat_lt v y --> hrat_lt (hrat_mul u v) (hrat_mul x y)"
-  by (import hreal HRAT_LT_MUL2)
-
-lemma HRAT_LT_LMUL: "ALL (x::hrat) (y::hrat) z::hrat.
-   hrat_lt (hrat_mul z x) (hrat_mul z y) = hrat_lt x y"
-  by (import hreal HRAT_LT_LMUL)
-
-lemma HRAT_LT_RMUL: "ALL (x::hrat) (y::hrat) z::hrat.
-   hrat_lt (hrat_mul x z) (hrat_mul y z) = hrat_lt x y"
-  by (import hreal HRAT_LT_RMUL)
-
-lemma HRAT_LT_LMUL1: "ALL (x::hrat) y::hrat. hrat_lt (hrat_mul x y) y = hrat_lt x hrat_1"
-  by (import hreal HRAT_LT_LMUL1)
-
-lemma HRAT_LT_RMUL1: "ALL (x::hrat) y::hrat. hrat_lt (hrat_mul x y) x = hrat_lt y hrat_1"
-  by (import hreal HRAT_LT_RMUL1)
-
-lemma HRAT_GT_LMUL1: "ALL (x::hrat) y::hrat. hrat_lt y (hrat_mul x y) = hrat_lt hrat_1 x"
-  by (import hreal HRAT_GT_LMUL1)
-
-lemma HRAT_LT_L1: "ALL (x::hrat) y::hrat.
-   hrat_lt (hrat_mul (hrat_inv x) y) hrat_1 = hrat_lt y x"
-  by (import hreal HRAT_LT_L1)
-
-lemma HRAT_LT_R1: "ALL (x::hrat) y::hrat.
-   hrat_lt (hrat_mul x (hrat_inv y)) hrat_1 = hrat_lt x y"
-  by (import hreal HRAT_LT_R1)
-
-lemma HRAT_GT_L1: "ALL (x::hrat) y::hrat.
-   hrat_lt hrat_1 (hrat_mul (hrat_inv x) y) = hrat_lt x y"
-  by (import hreal HRAT_GT_L1)
-
-lemma HRAT_INV_MUL: "ALL (x::hrat) y::hrat.
-   hrat_inv (hrat_mul x y) = hrat_mul (hrat_inv x) (hrat_inv y)"
-  by (import hreal HRAT_INV_MUL)
-
-lemma HRAT_UP: "ALL x::hrat. Ex (hrat_lt x)"
-  by (import hreal HRAT_UP)
-
-lemma HRAT_DOWN: "ALL x::hrat. EX xa::hrat. hrat_lt xa x"
-  by (import hreal HRAT_DOWN)
-
-lemma HRAT_DOWN2: "ALL (x::hrat) y::hrat. EX xa::hrat. hrat_lt xa x & hrat_lt xa y"
-  by (import hreal HRAT_DOWN2)
-
-lemma HRAT_MEAN: "ALL (x::hrat) y::hrat.
-   hrat_lt x y --> (EX xa::hrat. hrat_lt x xa & hrat_lt xa y)"
-  by (import hreal HRAT_MEAN)
-
-definition isacut :: "(hrat => bool) => bool" where 
+definition
+  hrat_lt :: "hrat => hrat => bool"  where
+  "hrat_lt == %x y. EX d. y = hrat_add x d"
+
+lemma hrat_lt: "hrat_lt x y = (EX d. y = hrat_add x d)"
+  sorry
+
+lemma HRAT_LT_REFL: "~ hrat_lt x x"
+  sorry
+
+lemma HRAT_LT_TRANS: "hrat_lt x y & hrat_lt y z ==> hrat_lt x z"
+  sorry
+
+lemma HRAT_LT_ANTISYM: "~ (hrat_lt x y & hrat_lt y x)"
+  sorry
+
+lemma HRAT_LT_TOTAL: "x = y | hrat_lt x y | hrat_lt y x"
+  sorry
+
+lemma HRAT_MUL_RID: "hrat_mul x hrat_1 = x"
+  sorry
+
+lemma HRAT_MUL_RINV: "hrat_mul x (hrat_inv x) = hrat_1"
+  sorry
+
+lemma HRAT_RDISTRIB: "hrat_mul (hrat_add x y) z = hrat_add (hrat_mul x z) (hrat_mul y z)"
+  sorry
+
+lemma HRAT_LT_ADDL: "hrat_lt x (hrat_add x y)"
+  sorry
+
+lemma HRAT_LT_ADDR: "hrat_lt xa (hrat_add x xa)"
+  sorry
+
+lemma HRAT_LT_GT: "hrat_lt x y ==> ~ hrat_lt y x"
+  sorry
+
+lemma HRAT_LT_NE: "hrat_lt x y ==> x ~= y"
+  sorry
+
+lemma HRAT_EQ_LADD: "(hrat_add x y = hrat_add x z) = (y = z)"
+  sorry
+
+lemma HRAT_EQ_LMUL: "(hrat_mul x y = hrat_mul x z) = (y = z)"
+  sorry
+
+lemma HRAT_LT_ADD2: "hrat_lt u x & hrat_lt v y ==> hrat_lt (hrat_add u v) (hrat_add x y)"
+  sorry
+
+lemma HRAT_LT_LADD: "hrat_lt (hrat_add z x) (hrat_add z y) = hrat_lt x y"
+  sorry
+
+lemma HRAT_LT_RADD: "hrat_lt (hrat_add x z) (hrat_add y z) = hrat_lt x y"
+  sorry
+
+lemma HRAT_LT_MUL2: "hrat_lt u x & hrat_lt v y ==> hrat_lt (hrat_mul u v) (hrat_mul x y)"
+  sorry
+
+lemma HRAT_LT_LMUL: "hrat_lt (hrat_mul z x) (hrat_mul z y) = hrat_lt x y"
+  sorry
+
+lemma HRAT_LT_RMUL: "hrat_lt (hrat_mul x z) (hrat_mul y z) = hrat_lt x y"
+  sorry
+
+lemma HRAT_LT_LMUL1: "hrat_lt (hrat_mul x y) y = hrat_lt x hrat_1"
+  sorry
+
+lemma HRAT_LT_RMUL1: "hrat_lt (hrat_mul x y) x = hrat_lt y hrat_1"
+  sorry
+
+lemma HRAT_GT_LMUL1: "hrat_lt y (hrat_mul x y) = hrat_lt hrat_1 x"
+  sorry
+
+lemma HRAT_LT_L1: "hrat_lt (hrat_mul (hrat_inv x) y) hrat_1 = hrat_lt y x"
+  sorry
+
+lemma HRAT_LT_R1: "hrat_lt (hrat_mul x (hrat_inv y)) hrat_1 = hrat_lt x y"
+  sorry
+
+lemma HRAT_GT_L1: "hrat_lt hrat_1 (hrat_mul (hrat_inv x) y) = hrat_lt x y"
+  sorry
+
+lemma HRAT_INV_MUL: "hrat_inv (hrat_mul x y) = hrat_mul (hrat_inv x) (hrat_inv y)"
+  sorry
+
+lemma HRAT_UP: "Ex (hrat_lt x)"
+  sorry
+
+lemma HRAT_DOWN: "EX xa. hrat_lt xa x"
+  sorry
+
+lemma HRAT_DOWN2: "EX xa. hrat_lt xa x & hrat_lt xa y"
+  sorry
+
+lemma HRAT_MEAN: "hrat_lt x y ==> EX xa. hrat_lt x xa & hrat_lt xa y"
+  sorry
+
+definition
+  isacut :: "(hrat => bool) => bool"  where
   "isacut ==
-%C::hrat => bool.
-   Ex C &
-   (EX x::hrat. ~ C x) &
-   (ALL (x::hrat) y::hrat. C x & hrat_lt y x --> C y) &
-   (ALL x::hrat. C x --> (EX y::hrat. C y & hrat_lt x y))"
-
-lemma isacut: "ALL C::hrat => bool.
-   isacut C =
-   (Ex C &
-    (EX x::hrat. ~ C x) &
-    (ALL (x::hrat) y::hrat. C x & hrat_lt y x --> C y) &
-    (ALL x::hrat. C x --> (EX y::hrat. C y & hrat_lt x y)))"
-  by (import hreal isacut)
-
-definition cut_of_hrat :: "hrat => hrat => bool" where 
-  "cut_of_hrat == %(x::hrat) y::hrat. hrat_lt y x"
-
-lemma cut_of_hrat: "ALL x::hrat. cut_of_hrat x = (%y::hrat. hrat_lt y x)"
-  by (import hreal cut_of_hrat)
-
-lemma ISACUT_HRAT: "ALL h::hrat. isacut (cut_of_hrat h)"
-  by (import hreal ISACUT_HRAT)
+%C. Ex C &
+    (EX x. ~ C x) &
+    (ALL x y. C x & hrat_lt y x --> C y) &
+    (ALL x. C x --> (EX y. C y & hrat_lt x y))"
+
+lemma isacut: "isacut (CC::hrat => bool) =
+(Ex CC &
+ (EX x::hrat. ~ CC x) &
+ (ALL (x::hrat) y::hrat. CC x & hrat_lt y x --> CC y) &
+ (ALL x::hrat. CC x --> (EX y::hrat. CC y & hrat_lt x y)))"
+  sorry
+
+definition
+  cut_of_hrat :: "hrat => hrat => bool"  where
+  "cut_of_hrat == %x y. hrat_lt y x"
+
+lemma cut_of_hrat: "cut_of_hrat x = (%y. hrat_lt y x)"
+  sorry
+
+lemma ISACUT_HRAT: "isacut (cut_of_hrat h)"
+  sorry
 
 typedef (open) hreal = "Collect isacut" 
-  by (rule typedef_helper,import hreal hreal_TY_DEF)
+  sorry
 
 lemmas hreal_TY_DEF = typedef_hol2hol4 [OF type_definition_hreal]
 
@@ -2094,795 +1691,506 @@
   hreal :: "(hrat => bool) => hreal" 
   cut :: "hreal => hrat => bool" 
 
-specification (cut hreal) hreal_tybij: "(ALL a::hreal. hreal (hreal.cut a) = a) &
-(ALL r::hrat => bool. isacut r = (hreal.cut (hreal r) = r))"
-  by (import hreal hreal_tybij)
-
-lemma EQUAL_CUTS: "ALL (X::hreal) Y::hreal. hreal.cut X = hreal.cut Y --> X = Y"
-  by (import hreal EQUAL_CUTS)
-
-lemma CUT_ISACUT: "ALL x::hreal. isacut (hreal.cut x)"
-  by (import hreal CUT_ISACUT)
-
-lemma CUT_NONEMPTY: "ALL x::hreal. Ex (hreal.cut x)"
-  by (import hreal CUT_NONEMPTY)
-
-lemma CUT_BOUNDED: "ALL x::hreal. EX xa::hrat. ~ hreal.cut x xa"
-  by (import hreal CUT_BOUNDED)
-
-lemma CUT_DOWN: "ALL (x::hreal) (xa::hrat) xb::hrat.
-   hreal.cut x xa & hrat_lt xb xa --> hreal.cut x xb"
-  by (import hreal CUT_DOWN)
-
-lemma CUT_UP: "ALL (x::hreal) xa::hrat.
-   hreal.cut x xa --> (EX y::hrat. hreal.cut x y & hrat_lt xa y)"
-  by (import hreal CUT_UP)
-
-lemma CUT_UBOUND: "ALL (x::hreal) (xa::hrat) xb::hrat.
-   ~ hreal.cut x xa & hrat_lt xa xb --> ~ hreal.cut x xb"
-  by (import hreal CUT_UBOUND)
-
-lemma CUT_STRADDLE: "ALL (X::hreal) (x::hrat) y::hrat.
-   hreal.cut X x & ~ hreal.cut X y --> hrat_lt x y"
-  by (import hreal CUT_STRADDLE)
-
-lemma CUT_NEARTOP_ADD: "ALL (X::hreal) e::hrat.
-   EX x::hrat. hreal.cut X x & ~ hreal.cut X (hrat_add x e)"
-  by (import hreal CUT_NEARTOP_ADD)
-
-lemma CUT_NEARTOP_MUL: "ALL (X::hreal) u::hrat.
-   hrat_lt hrat_1 u -->
-   (EX x::hrat. hreal.cut X x & ~ hreal.cut X (hrat_mul u x))"
-  by (import hreal CUT_NEARTOP_MUL)
-
-definition hreal_1 :: "hreal" where 
+specification (cut hreal) hreal_tybij: "(ALL a. hreal (cut a) = a) & (ALL r. isacut r = (cut (hreal r) = r))"
+  sorry
+
+lemma EQUAL_CUTS: "cut X = cut Y ==> X = Y"
+  sorry
+
+lemma CUT_ISACUT: "isacut (cut x)"
+  sorry
+
+lemma CUT_NONEMPTY: "Ex (cut x)"
+  sorry
+
+lemma CUT_BOUNDED: "EX xa. ~ cut x xa"
+  sorry
+
+lemma CUT_DOWN: "cut x xa & hrat_lt xb xa ==> cut x xb"
+  sorry
+
+lemma CUT_UP: "cut x xa ==> EX y. cut x y & hrat_lt xa y"
+  sorry
+
+lemma CUT_UBOUND: "~ cut x xa & hrat_lt xa xb ==> ~ cut x xb"
+  sorry
+
+lemma CUT_STRADDLE: "cut X x & ~ cut X y ==> hrat_lt x y"
+  sorry
+
+lemma CUT_NEARTOP_ADD: "EX x. cut X x & ~ cut X (hrat_add x e)"
+  sorry
+
+lemma CUT_NEARTOP_MUL: "hrat_lt hrat_1 u ==> EX x. cut X x & ~ cut X (hrat_mul u x)"
+  sorry
+
+definition
+  hreal_1 :: "hreal"  where
   "hreal_1 == hreal (cut_of_hrat hrat_1)"
 
 lemma hreal_1: "hreal_1 = hreal (cut_of_hrat hrat_1)"
-  by (import hreal hreal_1)
-
-definition hreal_add :: "hreal => hreal => hreal" where 
-  "hreal_add ==
-%(X::hreal) Y::hreal.
-   hreal
-    (%w::hrat.
-        EX (x::hrat) y::hrat.
-           w = hrat_add x y & hreal.cut X x & hreal.cut Y y)"
-
-lemma hreal_add: "ALL (X::hreal) Y::hreal.
-   hreal_add X Y =
-   hreal
-    (%w::hrat.
-        EX (x::hrat) y::hrat.
-           w = hrat_add x y & hreal.cut X x & hreal.cut Y y)"
-  by (import hreal hreal_add)
-
-definition hreal_mul :: "hreal => hreal => hreal" where 
-  "hreal_mul ==
-%(X::hreal) Y::hreal.
-   hreal
-    (%w::hrat.
-        EX (x::hrat) y::hrat.
-           w = hrat_mul x y & hreal.cut X x & hreal.cut Y y)"
-
-lemma hreal_mul: "ALL (X::hreal) Y::hreal.
-   hreal_mul X Y =
-   hreal
-    (%w::hrat.
-        EX (x::hrat) y::hrat.
-           w = hrat_mul x y & hreal.cut X x & hreal.cut Y y)"
-  by (import hreal hreal_mul)
-
-definition hreal_inv :: "hreal => hreal" where 
+  sorry
+
+definition
+  hreal_add :: "hreal => hreal => hreal"  where
+  "hreal_add == %X Y. hreal (%w. EX x y. w = hrat_add x y & cut X x & cut Y y)"
+
+lemma hreal_add: "hreal_add X Y = hreal (%w. EX x y. w = hrat_add x y & cut X x & cut Y y)"
+  sorry
+
+definition
+  hreal_mul :: "hreal => hreal => hreal"  where
+  "hreal_mul == %X Y. hreal (%w. EX x y. w = hrat_mul x y & cut X x & cut Y y)"
+
+lemma hreal_mul: "hreal_mul X Y = hreal (%w. EX x y. w = hrat_mul x y & cut X x & cut Y y)"
+  sorry
+
+definition
+  hreal_inv :: "hreal => hreal"  where
   "hreal_inv ==
-%X::hreal.
-   hreal
-    (%w::hrat.
-        EX d::hrat.
-           hrat_lt d hrat_1 &
-           (ALL x::hrat. hreal.cut X x --> hrat_lt (hrat_mul w x) d))"
-
-lemma hreal_inv: "ALL X::hreal.
-   hreal_inv X =
-   hreal
-    (%w::hrat.
-        EX d::hrat.
-           hrat_lt d hrat_1 &
-           (ALL x::hrat. hreal.cut X x --> hrat_lt (hrat_mul w x) d))"
-  by (import hreal hreal_inv)
-
-definition hreal_sup :: "(hreal => bool) => hreal" where 
-  "hreal_sup ==
-%P::hreal => bool. hreal (%w::hrat. EX X::hreal. P X & hreal.cut X w)"
-
-lemma hreal_sup: "ALL P::hreal => bool.
-   hreal_sup P = hreal (%w::hrat. EX X::hreal. P X & hreal.cut X w)"
-  by (import hreal hreal_sup)
-
-definition hreal_lt :: "hreal => hreal => bool" where 
-  "hreal_lt ==
-%(X::hreal) Y::hreal.
-   X ~= Y & (ALL x::hrat. hreal.cut X x --> hreal.cut Y x)"
-
-lemma hreal_lt: "ALL (X::hreal) Y::hreal.
-   hreal_lt X Y = (X ~= Y & (ALL x::hrat. hreal.cut X x --> hreal.cut Y x))"
-  by (import hreal hreal_lt)
-
-lemma HREAL_INV_ISACUT: "ALL X::hreal.
-   isacut
-    (%w::hrat.
-        EX d::hrat.
-           hrat_lt d hrat_1 &
-           (ALL x::hrat. hreal.cut X x --> hrat_lt (hrat_mul w x) d))"
-  by (import hreal HREAL_INV_ISACUT)
-
-lemma HREAL_ADD_ISACUT: "ALL (X::hreal) Y::hreal.
-   isacut
-    (%w::hrat.
-        EX (x::hrat) y::hrat.
-           w = hrat_add x y & hreal.cut X x & hreal.cut Y y)"
-  by (import hreal HREAL_ADD_ISACUT)
-
-lemma HREAL_MUL_ISACUT: "ALL (X::hreal) Y::hreal.
-   isacut
-    (%w::hrat.
-        EX (x::hrat) y::hrat.
-           w = hrat_mul x y & hreal.cut X x & hreal.cut Y y)"
-  by (import hreal HREAL_MUL_ISACUT)
-
-lemma HREAL_ADD_SYM: "ALL (X::hreal) Y::hreal. hreal_add X Y = hreal_add Y X"
-  by (import hreal HREAL_ADD_SYM)
-
-lemma HREAL_MUL_SYM: "ALL (X::hreal) Y::hreal. hreal_mul X Y = hreal_mul Y X"
-  by (import hreal HREAL_MUL_SYM)
-
-lemma HREAL_ADD_ASSOC: "ALL (X::hreal) (Y::hreal) Z::hreal.
-   hreal_add X (hreal_add Y Z) = hreal_add (hreal_add X Y) Z"
-  by (import hreal HREAL_ADD_ASSOC)
-
-lemma HREAL_MUL_ASSOC: "ALL (X::hreal) (Y::hreal) Z::hreal.
-   hreal_mul X (hreal_mul Y Z) = hreal_mul (hreal_mul X Y) Z"
-  by (import hreal HREAL_MUL_ASSOC)
-
-lemma HREAL_LDISTRIB: "ALL (X::hreal) (Y::hreal) Z::hreal.
-   hreal_mul X (hreal_add Y Z) = hreal_add (hreal_mul X Y) (hreal_mul X Z)"
-  by (import hreal HREAL_LDISTRIB)
-
-lemma HREAL_MUL_LID: "ALL X::hreal. hreal_mul hreal_1 X = X"
-  by (import hreal HREAL_MUL_LID)
-
-lemma HREAL_MUL_LINV: "ALL X::hreal. hreal_mul (hreal_inv X) X = hreal_1"
-  by (import hreal HREAL_MUL_LINV)
-
-lemma HREAL_NOZERO: "ALL (X::hreal) Y::hreal. hreal_add X Y ~= X"
-  by (import hreal HREAL_NOZERO)
-
-definition hreal_sub :: "hreal => hreal => hreal" where 
-  "hreal_sub ==
-%(Y::hreal) X::hreal.
-   hreal
-    (%w::hrat. EX x::hrat. ~ hreal.cut X x & hreal.cut Y (hrat_add x w))"
-
-lemma hreal_sub: "ALL (Y::hreal) X::hreal.
-   hreal_sub Y X =
-   hreal
-    (%w::hrat. EX x::hrat. ~ hreal.cut X x & hreal.cut Y (hrat_add x w))"
-  by (import hreal hreal_sub)
-
-lemma HREAL_LT_LEMMA: "ALL (X::hreal) Y::hreal.
-   hreal_lt X Y --> (EX x::hrat. ~ hreal.cut X x & hreal.cut Y x)"
-  by (import hreal HREAL_LT_LEMMA)
-
-lemma HREAL_SUB_ISACUT: "ALL (X::hreal) Y::hreal.
-   hreal_lt X Y -->
-   isacut
-    (%w::hrat. EX x::hrat. ~ hreal.cut X x & hreal.cut Y (hrat_add x w))"
-  by (import hreal HREAL_SUB_ISACUT)
-
-lemma HREAL_SUB_ADD: "ALL (X::hreal) Y::hreal. hreal_lt X Y --> hreal_add (hreal_sub Y X) X = Y"
-  by (import hreal HREAL_SUB_ADD)
-
-lemma HREAL_LT_TOTAL: "ALL (X::hreal) Y::hreal. X = Y | hreal_lt X Y | hreal_lt Y X"
-  by (import hreal HREAL_LT_TOTAL)
-
-lemma HREAL_LT: "ALL (X::hreal) Y::hreal. hreal_lt X Y = (EX D::hreal. Y = hreal_add X D)"
-  by (import hreal HREAL_LT)
-
-lemma HREAL_ADD_TOTAL: "ALL (X::hreal) Y::hreal.
-   X = Y |
-   (EX D::hreal. Y = hreal_add X D) | (EX D::hreal. X = hreal_add Y D)"
-  by (import hreal HREAL_ADD_TOTAL)
-
-lemma HREAL_SUP_ISACUT: "ALL P::hreal => bool.
-   Ex P & (EX Y::hreal. ALL X::hreal. P X --> hreal_lt X Y) -->
-   isacut (%w::hrat. EX X::hreal. P X & hreal.cut X w)"
-  by (import hreal HREAL_SUP_ISACUT)
-
-lemma HREAL_SUP: "ALL P::hreal => bool.
-   Ex P & (EX Y::hreal. ALL X::hreal. P X --> hreal_lt X Y) -->
-   (ALL Y::hreal.
-       (EX X::hreal. P X & hreal_lt Y X) = hreal_lt Y (hreal_sup P))"
-  by (import hreal HREAL_SUP)
+%X. hreal
+     (%w. EX d. hrat_lt d hrat_1 &
+                (ALL x. cut X x --> hrat_lt (hrat_mul w x) d))"
+
+lemma hreal_inv: "hreal_inv X =
+hreal
+ (%w. EX d. hrat_lt d hrat_1 &
+            (ALL x. cut X x --> hrat_lt (hrat_mul w x) d))"
+  sorry
+
+definition
+  hreal_sup :: "(hreal => bool) => hreal"  where
+  "hreal_sup == %P. hreal (%w. EX X. P X & cut X w)"
+
+lemma hreal_sup: "hreal_sup P = hreal (%w. EX X. P X & cut X w)"
+  sorry
+
+definition
+  hreal_lt :: "hreal => hreal => bool"  where
+  "hreal_lt == %X Y. X ~= Y & (ALL x. cut X x --> cut Y x)"
+
+lemma hreal_lt: "hreal_lt X Y = (X ~= Y & (ALL x. cut X x --> cut Y x))"
+  sorry
+
+lemma HREAL_INV_ISACUT: "isacut
+ (%w. EX d. hrat_lt d hrat_1 &
+            (ALL x. cut X x --> hrat_lt (hrat_mul w x) d))"
+  sorry
+
+lemma HREAL_ADD_ISACUT: "isacut (%w. EX x y. w = hrat_add x y & cut X x & cut Y y)"
+  sorry
+
+lemma HREAL_MUL_ISACUT: "isacut (%w. EX x y. w = hrat_mul x y & cut X x & cut Y y)"
+  sorry
+
+lemma HREAL_ADD_SYM: "hreal_add X Y = hreal_add Y X"
+  sorry
+
+lemma HREAL_MUL_SYM: "hreal_mul X Y = hreal_mul Y X"
+  sorry
+
+lemma HREAL_ADD_ASSOC: "hreal_add X (hreal_add Y Z) = hreal_add (hreal_add X Y) Z"
+  sorry
+
+lemma HREAL_MUL_ASSOC: "hreal_mul X (hreal_mul Y Z) = hreal_mul (hreal_mul X Y) Z"
+  sorry
+
+lemma HREAL_LDISTRIB: "hreal_mul X (hreal_add Y Z) = hreal_add (hreal_mul X Y) (hreal_mul X Z)"
+  sorry
+
+lemma HREAL_MUL_LID: "hreal_mul hreal_1 X = X"
+  sorry
+
+lemma HREAL_MUL_LINV: "hreal_mul (hreal_inv X) X = hreal_1"
+  sorry
+
+lemma HREAL_NOZERO: "hreal_add X Y ~= X"
+  sorry
+
+definition
+  hreal_sub :: "hreal => hreal => hreal"  where
+  "hreal_sub == %Y X. hreal (%w. EX x. ~ cut X x & cut Y (hrat_add x w))"
+
+lemma hreal_sub: "hreal_sub Y X = hreal (%w. EX x. ~ cut X x & cut Y (hrat_add x w))"
+  sorry
+
+lemma HREAL_LT_LEMMA: "hreal_lt X Y ==> EX x. ~ cut X x & cut Y x"
+  sorry
+
+lemma HREAL_SUB_ISACUT: "hreal_lt X Y ==> isacut (%w. EX x. ~ cut X x & cut Y (hrat_add x w))"
+  sorry
+
+lemma HREAL_SUB_ADD: "hreal_lt X Y ==> hreal_add (hreal_sub Y X) X = Y"
+  sorry
+
+lemma HREAL_LT_TOTAL: "X = Y | hreal_lt X Y | hreal_lt Y X"
+  sorry
+
+lemma HREAL_LT: "hreal_lt X Y = (EX D. Y = hreal_add X D)"
+  sorry
+
+lemma HREAL_ADD_TOTAL: "X = Y | (EX D. Y = hreal_add X D) | (EX D. X = hreal_add Y D)"
+  sorry
+
+lemma HREAL_SUP_ISACUT: "Ex P & (EX Y. ALL X. P X --> hreal_lt X Y)
+==> isacut (%w. EX X. P X & cut X w)"
+  sorry
+
+lemma HREAL_SUP: "Ex P & (EX Y. ALL X. P X --> hreal_lt X Y)
+==> (EX X. P X & hreal_lt Y X) = hreal_lt Y (hreal_sup P)"
+  sorry
 
 ;end_setup
 
 ;setup_theory numeral
 
 lemma numeral_suc: "Suc ALT_ZERO = NUMERAL_BIT1 ALT_ZERO &
-(ALL x::nat. Suc (NUMERAL_BIT1 x) = NUMERAL_BIT2 x) &
-(ALL x::nat. Suc (NUMERAL_BIT2 x) = NUMERAL_BIT1 (Suc x))"
-  by (import numeral numeral_suc)
-
-definition iZ :: "nat => nat" where 
-  "iZ == %x::nat. x"
-
-lemma iZ: "ALL x::nat. iZ x = x"
-  by (import numeral iZ)
-
-definition iiSUC :: "nat => nat" where 
-  "iiSUC == %n::nat. Suc (Suc n)"
-
-lemma iiSUC: "ALL n::nat. iiSUC n = Suc (Suc n)"
-  by (import numeral iiSUC)
-
-lemma numeral_distrib: "(op &::bool => bool => bool)
- ((All::(nat => bool) => bool)
-   (%x::nat.
-       (op =::nat => nat => bool) ((op +::nat => nat => nat) (0::nat) x) x))
- ((op &::bool => bool => bool)
-   ((All::(nat => bool) => bool)
-     (%x::nat.
-         (op =::nat => nat => bool) ((op +::nat => nat => nat) x (0::nat))
-          x))
-   ((op &::bool => bool => bool)
-     ((All::(nat => bool) => bool)
-       (%x::nat.
-           (All::(nat => bool) => bool)
-            (%xa::nat.
-                (op =::nat => nat => bool)
-                 ((op +::nat => nat => nat) ((NUMERAL::nat => nat) x)
-                   ((NUMERAL::nat => nat) xa))
-                 ((NUMERAL::nat => nat)
-                   ((iZ::nat => nat) ((op +::nat => nat => nat) x xa))))))
-     ((op &::bool => bool => bool)
-       ((All::(nat => bool) => bool)
-         (%x::nat.
-             (op =::nat => nat => bool)
-              ((op *::nat => nat => nat) (0::nat) x) (0::nat)))
-       ((op &::bool => bool => bool)
-         ((All::(nat => bool) => bool)
-           (%x::nat.
-               (op =::nat => nat => bool)
-                ((op *::nat => nat => nat) x (0::nat)) (0::nat)))
-         ((op &::bool => bool => bool)
-           ((All::(nat => bool) => bool)
-             (%x::nat.
-                 (All::(nat => bool) => bool)
-                  (%xa::nat.
-                      (op =::nat => nat => bool)
-                       ((op *::nat => nat => nat) ((NUMERAL::nat => nat) x)
-                         ((NUMERAL::nat => nat) xa))
-                       ((NUMERAL::nat => nat)
-                         ((op *::nat => nat => nat) x xa)))))
-           ((op &::bool => bool => bool)
-             ((All::(nat => bool) => bool)
-               (%x::nat.
-                   (op =::nat => nat => bool)
-                    ((op -::nat => nat => nat) (0::nat) x) (0::nat)))
-             ((op &::bool => bool => bool)
-               ((All::(nat => bool) => bool)
-                 (%x::nat.
-                     (op =::nat => nat => bool)
-                      ((op -::nat => nat => nat) x (0::nat)) x))
-               ((op &::bool => bool => bool)
-                 ((All::(nat => bool) => bool)
-                   (%x::nat.
-                       (All::(nat => bool) => bool)
-                        (%xa::nat.
-                            (op =::nat => nat => bool)
-                             ((op -::nat => nat => nat)
-                               ((NUMERAL::nat => nat) x)
-                               ((NUMERAL::nat => nat) xa))
-                             ((NUMERAL::nat => nat)
-                               ((op -::nat => nat => nat) x xa)))))
-                 ((op &::bool => bool => bool)
-                   ((All::(nat => bool) => bool)
-                     (%x::nat.
-                         (op =::nat => nat => bool)
-                          ((op ^::nat => nat => nat) (0::nat)
-                            ((NUMERAL::nat => nat)
-                              ((NUMERAL_BIT1::nat => nat) x)))
-                          (0::nat)))
-                   ((op &::bool => bool => bool)
-                     ((All::(nat => bool) => bool)
-                       (%x::nat.
-                           (op =::nat => nat => bool)
-                            ((op ^::nat => nat => nat) (0::nat)
-                              ((NUMERAL::nat => nat)
-                                ((NUMERAL_BIT2::nat => nat) x)))
-                            (0::nat)))
-                     ((op &::bool => bool => bool)
-                       ((All::(nat => bool) => bool)
-                         (%x::nat.
-                             (op =::nat => nat => bool)
-                              ((op ^::nat => nat => nat) x (0::nat))
-                              (1::nat)))
-                       ((op &::bool => bool => bool)
-                         ((All::(nat => bool) => bool)
-                           (%x::nat.
-                               (All::(nat => bool) => bool)
-                                (%xa::nat.
-                                    (op =::nat => nat => bool)
-                                     ((op ^::nat => nat => nat)
- ((NUMERAL::nat => nat) x) ((NUMERAL::nat => nat) xa))
-                                     ((NUMERAL::nat => nat)
- ((op ^::nat => nat => nat) x xa)))))
-                         ((op &::bool => bool => bool)
-                           ((op =::nat => nat => bool)
-                             ((Suc::nat => nat) (0::nat)) (1::nat))
-                           ((op &::bool => bool => bool)
-                             ((All::(nat => bool) => bool)
-                               (%x::nat.
-                                   (op =::nat => nat => bool)
-                                    ((Suc::nat => nat)
-((NUMERAL::nat => nat) x))
-                                    ((NUMERAL::nat => nat)
-((Suc::nat => nat) x))))
-                             ((op &::bool => bool => bool)
-                               ((op =::nat => nat => bool)
-                                 ((PRE::nat => nat) (0::nat)) (0::nat))
-                               ((op &::bool => bool => bool)
-                                 ((All::(nat => bool) => bool)
-                                   (%x::nat.
- (op =::nat => nat => bool) ((PRE::nat => nat) ((NUMERAL::nat => nat) x))
-  ((NUMERAL::nat => nat) ((PRE::nat => nat) x))))
-                                 ((op &::bool => bool => bool)
-                                   ((All::(nat => bool) => bool)
-                                     (%x::nat.
-   (op =::bool => bool => bool)
-    ((op =::nat => nat => bool) ((NUMERAL::nat => nat) x) (0::nat))
-    ((op =::nat => nat => bool) x (ALT_ZERO::nat))))
-                                   ((op &::bool => bool => bool)
-                                     ((All::(nat => bool) => bool)
- (%x::nat.
-     (op =::bool => bool => bool)
-      ((op =::nat => nat => bool) (0::nat) ((NUMERAL::nat => nat) x))
-      ((op =::nat => nat => bool) x (ALT_ZERO::nat))))
-                                     ((op &::bool => bool => bool)
- ((All::(nat => bool) => bool)
-   (%x::nat.
-       (All::(nat => bool) => bool)
-        (%xa::nat.
-            (op =::bool => bool => bool)
-             ((op =::nat => nat => bool) ((NUMERAL::nat => nat) x)
-               ((NUMERAL::nat => nat) xa))
-             ((op =::nat => nat => bool) x xa))))
- ((op &::bool => bool => bool)
-   ((All::(nat => bool) => bool)
-     (%x::nat.
-         (op =::bool => bool => bool)
-          ((op <::nat => nat => bool) x (0::nat)) (False::bool)))
-   ((op &::bool => bool => bool)
-     ((All::(nat => bool) => bool)
-       (%x::nat.
-           (op =::bool => bool => bool)
-            ((op <::nat => nat => bool) (0::nat) ((NUMERAL::nat => nat) x))
-            ((op <::nat => nat => bool) (ALT_ZERO::nat) x)))
-     ((op &::bool => bool => bool)
-       ((All::(nat => bool) => bool)
-         (%x::nat.
-             (All::(nat => bool) => bool)
-              (%xa::nat.
-                  (op =::bool => bool => bool)
-                   ((op <::nat => nat => bool) ((NUMERAL::nat => nat) x)
-                     ((NUMERAL::nat => nat) xa))
-                   ((op <::nat => nat => bool) x xa))))
-       ((op &::bool => bool => bool)
-         ((All::(nat => bool) => bool)
-           (%x::nat.
-               (op =::bool => bool => bool)
-                ((op <::nat => nat => bool) x (0::nat)) (False::bool)))
-         ((op &::bool => bool => bool)
-           ((All::(nat => bool) => bool)
-             (%x::nat.
-                 (op =::bool => bool => bool)
-                  ((op <::nat => nat => bool) (0::nat)
-                    ((NUMERAL::nat => nat) x))
-                  ((op <::nat => nat => bool) (ALT_ZERO::nat) x)))
-           ((op &::bool => bool => bool)
-             ((All::(nat => bool) => bool)
-               (%x::nat.
-                   (All::(nat => bool) => bool)
-                    (%xa::nat.
-                        (op =::bool => bool => bool)
-                         ((op <::nat => nat => bool)
-                           ((NUMERAL::nat => nat) xa)
-                           ((NUMERAL::nat => nat) x))
-                         ((op <::nat => nat => bool) xa x))))
-             ((op &::bool => bool => bool)
-               ((All::(nat => bool) => bool)
-                 (%x::nat.
-                     (op =::bool => bool => bool)
-                      ((op <=::nat => nat => bool) (0::nat) x)
-                      (True::bool)))
-               ((op &::bool => bool => bool)
-                 ((All::(nat => bool) => bool)
-                   (%x::nat.
-                       (op =::bool => bool => bool)
-                        ((op <=::nat => nat => bool)
-                          ((NUMERAL::nat => nat) x) (0::nat))
-                        ((op <=::nat => nat => bool) x (ALT_ZERO::nat))))
-                 ((op &::bool => bool => bool)
-                   ((All::(nat => bool) => bool)
-                     (%x::nat.
-                         (All::(nat => bool) => bool)
-                          (%xa::nat.
-                              (op =::bool => bool => bool)
-                               ((op <=::nat => nat => bool)
-                                 ((NUMERAL::nat => nat) x)
-                                 ((NUMERAL::nat => nat) xa))
-                               ((op <=::nat => nat => bool) x xa))))
-                   ((op &::bool => bool => bool)
-                     ((All::(nat => bool) => bool)
-                       (%x::nat.
-                           (op =::bool => bool => bool)
-                            ((op <=::nat => nat => bool) (0::nat) x)
-                            (True::bool)))
-                     ((op &::bool => bool => bool)
-                       ((All::(nat => bool) => bool)
-                         (%x::nat.
-                             (op =::bool => bool => bool)
-                              ((op <=::nat => nat => bool) x (0::nat))
-                              ((op =::nat => nat => bool) x (0::nat))))
-                       ((op &::bool => bool => bool)
-                         ((All::(nat => bool) => bool)
-                           (%x::nat.
-                               (All::(nat => bool) => bool)
-                                (%xa::nat.
-                                    (op =::bool => bool => bool)
-                                     ((op <=::nat => nat => bool)
- ((NUMERAL::nat => nat) xa) ((NUMERAL::nat => nat) x))
-                                     ((op <=::nat => nat => bool) xa x))))
-                         ((op &::bool => bool => bool)
-                           ((All::(nat => bool) => bool)
-                             (%x::nat.
-                                 (op =::bool => bool => bool)
-                                  ((ODD::nat => bool)
-                                    ((NUMERAL::nat => nat) x))
-                                  ((ODD::nat => bool) x)))
-                           ((op &::bool => bool => bool)
-                             ((All::(nat => bool) => bool)
-                               (%x::nat.
-                                   (op =::bool => bool => bool)
-                                    ((EVEN::nat => bool)
-((NUMERAL::nat => nat) x))
-                                    ((EVEN::nat => bool) x)))
-                             ((op &::bool => bool => bool)
-                               ((Not::bool => bool)
-                                 ((ODD::nat => bool) (0::nat)))
-                               ((EVEN::nat => bool)
-                                 (0::nat))))))))))))))))))))))))))))))))))))"
-  by (import numeral numeral_distrib)
+(ALL x. Suc (NUMERAL_BIT1 x) = NUMERAL_BIT2 x) &
+(ALL x. Suc (NUMERAL_BIT2 x) = NUMERAL_BIT1 (Suc x))"
+  sorry
+
+definition
+  iZ :: "nat => nat"  where
+  "iZ == %x. x"
+
+lemma iZ: "iZ x = x"
+  sorry
+
+definition
+  iiSUC :: "nat => nat"  where
+  "iiSUC == %n. Suc (Suc n)"
+
+lemma iiSUC: "iiSUC n = Suc (Suc n)"
+  sorry
+
+lemma numeral_distrib: "(ALL x::nat. (0::nat) + x = x) &
+(ALL x::nat. x + (0::nat) = x) &
+(ALL (x::nat) xa::nat. NUMERAL x + NUMERAL xa = NUMERAL (iZ (x + xa))) &
+(ALL x::nat. (0::nat) * x = (0::nat)) &
+(ALL x::nat. x * (0::nat) = (0::nat)) &
+(ALL (x::nat) xa::nat. NUMERAL x * NUMERAL xa = NUMERAL (x * xa)) &
+(ALL x::nat. (0::nat) - x = (0::nat)) &
+(ALL x::nat. x - (0::nat) = x) &
+(ALL (x::nat) xa::nat. NUMERAL x - NUMERAL xa = NUMERAL (x - xa)) &
+(ALL x::nat. (0::nat) ^ NUMERAL (NUMERAL_BIT1 x) = (0::nat)) &
+(ALL x::nat. (0::nat) ^ NUMERAL (NUMERAL_BIT2 x) = (0::nat)) &
+(ALL x::nat. x ^ (0::nat) = (1::nat)) &
+(ALL (x::nat) xa::nat. NUMERAL x ^ NUMERAL xa = NUMERAL (x ^ xa)) &
+Suc (0::nat) = (1::nat) &
+(ALL x::nat. Suc (NUMERAL x) = NUMERAL (Suc x)) &
+PRE (0::nat) = (0::nat) &
+(ALL x::nat. PRE (NUMERAL x) = NUMERAL (PRE x)) &
+(ALL x::nat. (NUMERAL x = (0::nat)) = (x = ALT_ZERO)) &
+(ALL x::nat. ((0::nat) = NUMERAL x) = (x = ALT_ZERO)) &
+(ALL (x::nat) xa::nat. (NUMERAL x = NUMERAL xa) = (x = xa)) &
+(ALL x::nat. (x < (0::nat)) = False) &
+(ALL x::nat. ((0::nat) < NUMERAL x) = (ALT_ZERO < x)) &
+(ALL (x::nat) xa::nat. (NUMERAL x < NUMERAL xa) = (x < xa)) &
+(ALL x::nat. (x < (0::nat)) = False) &
+(ALL x::nat. ((0::nat) < NUMERAL x) = (ALT_ZERO < x)) &
+(ALL (x::nat) xa::nat. (NUMERAL xa < NUMERAL x) = (xa < x)) &
+(ALL x::nat. ((0::nat) <= x) = True) &
+(ALL x::nat. (NUMERAL x <= (0::nat)) = (x <= ALT_ZERO)) &
+(ALL (x::nat) xa::nat. (NUMERAL x <= NUMERAL xa) = (x <= xa)) &
+(ALL x::nat. ((0::nat) <= x) = True) &
+(ALL x::nat. (x <= (0::nat)) = (x = (0::nat))) &
+(ALL (x::nat) xa::nat. (NUMERAL xa <= NUMERAL x) = (xa <= x)) &
+(ALL x::nat. ODD (NUMERAL x) = ODD x) &
+(ALL x::nat. EVEN (NUMERAL x) = EVEN x) & ~ ODD (0::nat) & EVEN (0::nat)"
+  sorry
 
 lemma numeral_iisuc: "iiSUC ALT_ZERO = NUMERAL_BIT2 ALT_ZERO &
-iiSUC (NUMERAL_BIT1 (n::nat)) = NUMERAL_BIT1 (Suc n) &
+iiSUC (NUMERAL_BIT1 n) = NUMERAL_BIT1 (Suc n) &
 iiSUC (NUMERAL_BIT2 n) = NUMERAL_BIT2 (Suc n)"
-  by (import numeral numeral_iisuc)
-
-lemma numeral_add: "ALL (x::nat) xa::nat.
-   iZ (ALT_ZERO + x) = x &
-   iZ (x + ALT_ZERO) = x &
-   iZ (NUMERAL_BIT1 x + NUMERAL_BIT1 xa) = NUMERAL_BIT2 (iZ (x + xa)) &
-   iZ (NUMERAL_BIT1 x + NUMERAL_BIT2 xa) = NUMERAL_BIT1 (Suc (x + xa)) &
-   iZ (NUMERAL_BIT2 x + NUMERAL_BIT1 xa) = NUMERAL_BIT1 (Suc (x + xa)) &
-   iZ (NUMERAL_BIT2 x + NUMERAL_BIT2 xa) = NUMERAL_BIT2 (Suc (x + xa)) &
-   Suc (ALT_ZERO + x) = Suc x &
-   Suc (x + ALT_ZERO) = Suc x &
-   Suc (NUMERAL_BIT1 x + NUMERAL_BIT1 xa) = NUMERAL_BIT1 (Suc (x + xa)) &
-   Suc (NUMERAL_BIT1 x + NUMERAL_BIT2 xa) = NUMERAL_BIT2 (Suc (x + xa)) &
-   Suc (NUMERAL_BIT2 x + NUMERAL_BIT1 xa) = NUMERAL_BIT2 (Suc (x + xa)) &
-   Suc (NUMERAL_BIT2 x + NUMERAL_BIT2 xa) = NUMERAL_BIT1 (iiSUC (x + xa)) &
-   iiSUC (ALT_ZERO + x) = iiSUC x &
-   iiSUC (x + ALT_ZERO) = iiSUC x &
-   iiSUC (NUMERAL_BIT1 x + NUMERAL_BIT1 xa) = NUMERAL_BIT2 (Suc (x + xa)) &
-   iiSUC (NUMERAL_BIT1 x + NUMERAL_BIT2 xa) =
-   NUMERAL_BIT1 (iiSUC (x + xa)) &
-   iiSUC (NUMERAL_BIT2 x + NUMERAL_BIT1 xa) =
-   NUMERAL_BIT1 (iiSUC (x + xa)) &
-   iiSUC (NUMERAL_BIT2 x + NUMERAL_BIT2 xa) = NUMERAL_BIT2 (iiSUC (x + xa))"
-  by (import numeral numeral_add)
-
-lemma numeral_eq: "ALL (x::nat) xa::nat.
-   (ALT_ZERO = NUMERAL_BIT1 x) = False &
-   (NUMERAL_BIT1 x = ALT_ZERO) = False &
-   (ALT_ZERO = NUMERAL_BIT2 x) = False &
-   (NUMERAL_BIT2 x = ALT_ZERO) = False &
-   (NUMERAL_BIT1 x = NUMERAL_BIT2 xa) = False &
-   (NUMERAL_BIT2 x = NUMERAL_BIT1 xa) = False &
-   (NUMERAL_BIT1 x = NUMERAL_BIT1 xa) = (x = xa) &
-   (NUMERAL_BIT2 x = NUMERAL_BIT2 xa) = (x = xa)"
-  by (import numeral numeral_eq)
-
-lemma numeral_lt: "ALL (x::nat) xa::nat.
-   (ALT_ZERO < NUMERAL_BIT1 x) = True &
-   (ALT_ZERO < NUMERAL_BIT2 x) = True &
-   (x < ALT_ZERO) = False &
-   (NUMERAL_BIT1 x < NUMERAL_BIT1 xa) = (x < xa) &
-   (NUMERAL_BIT2 x < NUMERAL_BIT2 xa) = (x < xa) &
-   (NUMERAL_BIT1 x < NUMERAL_BIT2 xa) = (~ xa < x) &
-   (NUMERAL_BIT2 x < NUMERAL_BIT1 xa) = (x < xa)"
-  by (import numeral numeral_lt)
-
-lemma numeral_lte: "ALL (x::nat) xa::nat.
-   (ALT_ZERO <= x) = True &
-   (NUMERAL_BIT1 x <= ALT_ZERO) = False &
-   (NUMERAL_BIT2 x <= ALT_ZERO) = False &
-   (NUMERAL_BIT1 x <= NUMERAL_BIT1 xa) = (x <= xa) &
-   (NUMERAL_BIT1 x <= NUMERAL_BIT2 xa) = (x <= xa) &
-   (NUMERAL_BIT2 x <= NUMERAL_BIT1 xa) = (~ xa <= x) &
-   (NUMERAL_BIT2 x <= NUMERAL_BIT2 xa) = (x <= xa)"
-  by (import numeral numeral_lte)
+  sorry
+
+lemma numeral_add: "iZ (ALT_ZERO + x) = x &
+iZ (x + ALT_ZERO) = x &
+iZ (NUMERAL_BIT1 x + NUMERAL_BIT1 xa) = NUMERAL_BIT2 (iZ (x + xa)) &
+iZ (NUMERAL_BIT1 x + NUMERAL_BIT2 xa) = NUMERAL_BIT1 (Suc (x + xa)) &
+iZ (NUMERAL_BIT2 x + NUMERAL_BIT1 xa) = NUMERAL_BIT1 (Suc (x + xa)) &
+iZ (NUMERAL_BIT2 x + NUMERAL_BIT2 xa) = NUMERAL_BIT2 (Suc (x + xa)) &
+Suc (ALT_ZERO + x) = Suc x &
+Suc (x + ALT_ZERO) = Suc x &
+Suc (NUMERAL_BIT1 x + NUMERAL_BIT1 xa) = NUMERAL_BIT1 (Suc (x + xa)) &
+Suc (NUMERAL_BIT1 x + NUMERAL_BIT2 xa) = NUMERAL_BIT2 (Suc (x + xa)) &
+Suc (NUMERAL_BIT2 x + NUMERAL_BIT1 xa) = NUMERAL_BIT2 (Suc (x + xa)) &
+Suc (NUMERAL_BIT2 x + NUMERAL_BIT2 xa) = NUMERAL_BIT1 (iiSUC (x + xa)) &
+iiSUC (ALT_ZERO + x) = iiSUC x &
+iiSUC (x + ALT_ZERO) = iiSUC x &
+iiSUC (NUMERAL_BIT1 x + NUMERAL_BIT1 xa) = NUMERAL_BIT2 (Suc (x + xa)) &
+iiSUC (NUMERAL_BIT1 x + NUMERAL_BIT2 xa) = NUMERAL_BIT1 (iiSUC (x + xa)) &
+iiSUC (NUMERAL_BIT2 x + NUMERAL_BIT1 xa) = NUMERAL_BIT1 (iiSUC (x + xa)) &
+iiSUC (NUMERAL_BIT2 x + NUMERAL_BIT2 xa) = NUMERAL_BIT2 (iiSUC (x + xa))"
+  sorry
+
+lemma numeral_eq: "(ALT_ZERO = NUMERAL_BIT1 x) = False &
+(NUMERAL_BIT1 x = ALT_ZERO) = False &
+(ALT_ZERO = NUMERAL_BIT2 x) = False &
+(NUMERAL_BIT2 x = ALT_ZERO) = False &
+(NUMERAL_BIT1 x = NUMERAL_BIT2 xa) = False &
+(NUMERAL_BIT2 x = NUMERAL_BIT1 xa) = False &
+(NUMERAL_BIT1 x = NUMERAL_BIT1 xa) = (x = xa) &
+(NUMERAL_BIT2 x = NUMERAL_BIT2 xa) = (x = xa)"
+  sorry
+
+lemma numeral_lt: "(ALT_ZERO < NUMERAL_BIT1 x) = True &
+(ALT_ZERO < NUMERAL_BIT2 x) = True &
+(x < ALT_ZERO) = False &
+(NUMERAL_BIT1 x < NUMERAL_BIT1 xa) = (x < xa) &
+(NUMERAL_BIT2 x < NUMERAL_BIT2 xa) = (x < xa) &
+(NUMERAL_BIT1 x < NUMERAL_BIT2 xa) = (~ xa < x) &
+(NUMERAL_BIT2 x < NUMERAL_BIT1 xa) = (x < xa)"
+  sorry
+
+lemma numeral_lte: "(ALT_ZERO <= x) = True &
+(NUMERAL_BIT1 x <= ALT_ZERO) = False &
+(NUMERAL_BIT2 x <= ALT_ZERO) = False &
+(NUMERAL_BIT1 x <= NUMERAL_BIT1 xa) = (x <= xa) &
+(NUMERAL_BIT1 x <= NUMERAL_BIT2 xa) = (x <= xa) &
+(NUMERAL_BIT2 x <= NUMERAL_BIT1 xa) = (~ xa <= x) &
+(NUMERAL_BIT2 x <= NUMERAL_BIT2 xa) = (x <= xa)"
+  sorry
 
 lemma numeral_pre: "PRE ALT_ZERO = ALT_ZERO &
 PRE (NUMERAL_BIT1 ALT_ZERO) = ALT_ZERO &
-(ALL x::nat.
+(ALL x.
     PRE (NUMERAL_BIT1 (NUMERAL_BIT1 x)) =
     NUMERAL_BIT2 (PRE (NUMERAL_BIT1 x))) &
-(ALL x::nat.
+(ALL x.
     PRE (NUMERAL_BIT1 (NUMERAL_BIT2 x)) = NUMERAL_BIT2 (NUMERAL_BIT1 x)) &
-(ALL x::nat. PRE (NUMERAL_BIT2 x) = NUMERAL_BIT1 x)"
-  by (import numeral numeral_pre)
-
-lemma bit_initiality: "ALL (zf::'a::type) (b1f::nat => 'a::type => 'a::type)
-   b2f::nat => 'a::type => 'a::type.
-   EX x::nat => 'a::type.
-      x ALT_ZERO = zf &
-      (ALL n::nat. x (NUMERAL_BIT1 n) = b1f n (x n)) &
-      (ALL n::nat. x (NUMERAL_BIT2 n) = b2f n (x n))"
-  by (import numeral bit_initiality)
+(ALL x. PRE (NUMERAL_BIT2 x) = NUMERAL_BIT1 x)"
+  sorry
+
+lemma bit_initiality: "EX x. x ALT_ZERO = zf &
+      (ALL n. x (NUMERAL_BIT1 n) = b1f n (x n)) &
+      (ALL n. x (NUMERAL_BIT2 n) = b2f n (x n))"
+  sorry
 
 consts
   iBIT_cases :: "nat => 'a => (nat => 'a) => (nat => 'a) => 'a" 
 
-specification (iBIT_cases) iBIT_cases: "(ALL (zf::'a::type) (bf1::nat => 'a::type) bf2::nat => 'a::type.
+specification (iBIT_cases) iBIT_cases: "(ALL (zf::'a) (bf1::nat => 'a) bf2::nat => 'a.
     iBIT_cases ALT_ZERO zf bf1 bf2 = zf) &
-(ALL (n::nat) (zf::'a::type) (bf1::nat => 'a::type) bf2::nat => 'a::type.
+(ALL (n::nat) (zf::'a) (bf1::nat => 'a) bf2::nat => 'a.
     iBIT_cases (NUMERAL_BIT1 n) zf bf1 bf2 = bf1 n) &
-(ALL (n::nat) (zf::'a::type) (bf1::nat => 'a::type) bf2::nat => 'a::type.
+(ALL (n::nat) (zf::'a) (bf1::nat => 'a) bf2::nat => 'a.
     iBIT_cases (NUMERAL_BIT2 n) zf bf1 bf2 = bf2 n)"
-  by (import numeral iBIT_cases)
-
-definition iDUB :: "nat => nat" where 
-  "iDUB == %x::nat. x + x"
-
-lemma iDUB: "ALL x::nat. iDUB x = x + x"
-  by (import numeral iDUB)
+  sorry
+
+definition
+  iDUB :: "nat => nat"  where
+  "iDUB == %x. x + x"
+
+lemma iDUB: "iDUB x = x + x"
+  sorry
 
 consts
   iSUB :: "bool => nat => nat => nat" 
 
-specification (iSUB) iSUB_DEF: "(ALL (b::bool) x::nat. iSUB b ALT_ZERO x = ALT_ZERO) &
-(ALL (b::bool) (n::nat) x::nat.
+specification (iSUB) iSUB_DEF: "(ALL b x. iSUB b ALT_ZERO x = ALT_ZERO) &
+(ALL b n x.
     iSUB b (NUMERAL_BIT1 n) x =
     (if b
-     then iBIT_cases x (NUMERAL_BIT1 n) (%m::nat. iDUB (iSUB True n m))
-           (%m::nat. NUMERAL_BIT1 (iSUB False n m))
-     else iBIT_cases x (iDUB n) (%m::nat. NUMERAL_BIT1 (iSUB False n m))
-           (%m::nat. iDUB (iSUB False n m)))) &
-(ALL (b::bool) (n::nat) x::nat.
+     then iBIT_cases x (NUMERAL_BIT1 n) (%m. iDUB (iSUB True n m))
+           (%m. NUMERAL_BIT1 (iSUB False n m))
+     else iBIT_cases x (iDUB n) (%m. NUMERAL_BIT1 (iSUB False n m))
+           (%m. iDUB (iSUB False n m)))) &
+(ALL b n x.
     iSUB b (NUMERAL_BIT2 n) x =
     (if b
-     then iBIT_cases x (NUMERAL_BIT2 n)
-           (%m::nat. NUMERAL_BIT1 (iSUB True n m))
-           (%m::nat. iDUB (iSUB True n m))
-     else iBIT_cases x (NUMERAL_BIT1 n) (%m::nat. iDUB (iSUB True n m))
-           (%m::nat. NUMERAL_BIT1 (iSUB False n m))))"
-  by (import numeral iSUB_DEF)
-
-lemma bit_induction: "ALL P::nat => bool.
-   P ALT_ZERO &
-   (ALL n::nat. P n --> P (NUMERAL_BIT1 n)) &
-   (ALL n::nat. P n --> P (NUMERAL_BIT2 n)) -->
-   All P"
-  by (import numeral bit_induction)
-
-lemma iSUB_THM: "ALL (xa::bool) (xb::nat) xc::nat.
-   iSUB xa ALT_ZERO (x::nat) = ALT_ZERO &
-   iSUB True xb ALT_ZERO = xb &
-   iSUB False (NUMERAL_BIT1 xb) ALT_ZERO = iDUB xb &
-   iSUB True (NUMERAL_BIT1 xb) (NUMERAL_BIT1 xc) = iDUB (iSUB True xb xc) &
-   iSUB False (NUMERAL_BIT1 xb) (NUMERAL_BIT1 xc) =
-   NUMERAL_BIT1 (iSUB False xb xc) &
-   iSUB True (NUMERAL_BIT1 xb) (NUMERAL_BIT2 xc) =
-   NUMERAL_BIT1 (iSUB False xb xc) &
-   iSUB False (NUMERAL_BIT1 xb) (NUMERAL_BIT2 xc) =
-   iDUB (iSUB False xb xc) &
-   iSUB False (NUMERAL_BIT2 xb) ALT_ZERO = NUMERAL_BIT1 xb &
-   iSUB True (NUMERAL_BIT2 xb) (NUMERAL_BIT1 xc) =
-   NUMERAL_BIT1 (iSUB True xb xc) &
-   iSUB False (NUMERAL_BIT2 xb) (NUMERAL_BIT1 xc) = iDUB (iSUB True xb xc) &
-   iSUB True (NUMERAL_BIT2 xb) (NUMERAL_BIT2 xc) = iDUB (iSUB True xb xc) &
-   iSUB False (NUMERAL_BIT2 xb) (NUMERAL_BIT2 xc) =
-   NUMERAL_BIT1 (iSUB False xb xc)"
-  by (import numeral iSUB_THM)
-
-lemma numeral_sub: "ALL (x::nat) xa::nat.
-   NUMERAL (x - xa) = (if xa < x then NUMERAL (iSUB True x xa) else 0)"
-  by (import numeral numeral_sub)
-
-lemma iDUB_removal: "ALL x::nat.
-   iDUB (NUMERAL_BIT1 x) = NUMERAL_BIT2 (iDUB x) &
-   iDUB (NUMERAL_BIT2 x) = NUMERAL_BIT2 (NUMERAL_BIT1 x) &
-   iDUB ALT_ZERO = ALT_ZERO"
-  by (import numeral iDUB_removal)
-
-lemma numeral_mult: "ALL (x::nat) xa::nat.
-   ALT_ZERO * x = ALT_ZERO &
-   x * ALT_ZERO = ALT_ZERO &
-   NUMERAL_BIT1 x * xa = iZ (iDUB (x * xa) + xa) &
-   NUMERAL_BIT2 x * xa = iDUB (iZ (x * xa + xa))"
-  by (import numeral numeral_mult)
-
-definition iSQR :: "nat => nat" where 
-  "iSQR == %x::nat. x * x"
-
-lemma iSQR: "ALL x::nat. iSQR x = x * x"
-  by (import numeral iSQR)
-
-lemma numeral_exp: "(ALL x::nat. x ^ ALT_ZERO = NUMERAL_BIT1 ALT_ZERO) &
-(ALL (x::nat) xa::nat. x ^ NUMERAL_BIT1 xa = x * iSQR (x ^ xa)) &
-(ALL (x::nat) xa::nat. x ^ NUMERAL_BIT2 xa = iSQR x * iSQR (x ^ xa))"
-  by (import numeral numeral_exp)
-
-lemma numeral_evenodd: "ALL x::nat.
-   EVEN ALT_ZERO &
-   EVEN (NUMERAL_BIT2 x) &
-   ~ EVEN (NUMERAL_BIT1 x) &
-   ~ ODD ALT_ZERO & ~ ODD (NUMERAL_BIT2 x) & ODD (NUMERAL_BIT1 x)"
-  by (import numeral numeral_evenodd)
-
-lemma numeral_fact: "ALL n::nat. FACT n = (if n = 0 then 1 else n * FACT (PRE n))"
-  by (import numeral numeral_fact)
-
-lemma numeral_funpow: "ALL n::nat.
-   ((f::'a::type => 'a::type) ^^ n) (x::'a::type) =
-   (if n = 0 then x else (f ^^ (n - 1)) (f x))"
-  by (import numeral numeral_funpow)
+     then iBIT_cases x (NUMERAL_BIT2 n) (%m. NUMERAL_BIT1 (iSUB True n m))
+           (%m. iDUB (iSUB True n m))
+     else iBIT_cases x (NUMERAL_BIT1 n) (%m. iDUB (iSUB True n m))
+           (%m. NUMERAL_BIT1 (iSUB False n m))))"
+  sorry
+
+lemma bit_induction: "P ALT_ZERO &
+(ALL n. P n --> P (NUMERAL_BIT1 n)) & (ALL n. P n --> P (NUMERAL_BIT2 n))
+==> P x"
+  sorry
+
+lemma iSUB_THM: "iSUB (x::bool) ALT_ZERO (xn::nat) = ALT_ZERO &
+iSUB True (xa::nat) ALT_ZERO = xa &
+iSUB False (NUMERAL_BIT1 xa) ALT_ZERO = iDUB xa &
+iSUB True (NUMERAL_BIT1 xa) (NUMERAL_BIT1 (xb::nat)) =
+iDUB (iSUB True xa xb) &
+iSUB False (NUMERAL_BIT1 xa) (NUMERAL_BIT1 xb) =
+NUMERAL_BIT1 (iSUB False xa xb) &
+iSUB True (NUMERAL_BIT1 xa) (NUMERAL_BIT2 xb) =
+NUMERAL_BIT1 (iSUB False xa xb) &
+iSUB False (NUMERAL_BIT1 xa) (NUMERAL_BIT2 xb) = iDUB (iSUB False xa xb) &
+iSUB False (NUMERAL_BIT2 xa) ALT_ZERO = NUMERAL_BIT1 xa &
+iSUB True (NUMERAL_BIT2 xa) (NUMERAL_BIT1 xb) =
+NUMERAL_BIT1 (iSUB True xa xb) &
+iSUB False (NUMERAL_BIT2 xa) (NUMERAL_BIT1 xb) = iDUB (iSUB True xa xb) &
+iSUB True (NUMERAL_BIT2 xa) (NUMERAL_BIT2 xb) = iDUB (iSUB True xa xb) &
+iSUB False (NUMERAL_BIT2 xa) (NUMERAL_BIT2 xb) =
+NUMERAL_BIT1 (iSUB False xa xb)"
+  sorry
+
+lemma numeral_sub: "NUMERAL (x - xa) = (if xa < x then NUMERAL (iSUB True x xa) else 0)"
+  sorry
+
+lemma iDUB_removal: "iDUB (NUMERAL_BIT1 x) = NUMERAL_BIT2 (iDUB x) &
+iDUB (NUMERAL_BIT2 x) = NUMERAL_BIT2 (NUMERAL_BIT1 x) &
+iDUB ALT_ZERO = ALT_ZERO"
+  sorry
+
+lemma numeral_mult: "ALT_ZERO * x = ALT_ZERO &
+x * ALT_ZERO = ALT_ZERO &
+NUMERAL_BIT1 x * xa = iZ (iDUB (x * xa) + xa) &
+NUMERAL_BIT2 x * xa = iDUB (iZ (x * xa + xa))"
+  sorry
+
+definition
+  iSQR :: "nat => nat"  where
+  "iSQR == %x. x * x"
+
+lemma iSQR: "iSQR x = x * x"
+  sorry
+
+lemma numeral_exp: "(ALL x. x ^ ALT_ZERO = NUMERAL_BIT1 ALT_ZERO) &
+(ALL x xa. x ^ NUMERAL_BIT1 xa = x * iSQR (x ^ xa)) &
+(ALL x xa. x ^ NUMERAL_BIT2 xa = iSQR x * iSQR (x ^ xa))"
+  sorry
+
+lemma numeral_evenodd: "EVEN ALT_ZERO &
+EVEN (NUMERAL_BIT2 x) &
+~ EVEN (NUMERAL_BIT1 x) &
+~ ODD ALT_ZERO & ~ ODD (NUMERAL_BIT2 x) & ODD (NUMERAL_BIT1 x)"
+  sorry
+
+lemma numeral_fact: "FACT n = (if n = 0 then 1 else n * FACT (PRE n))"
+  sorry
+
+lemma numeral_funpow: "(f ^^ n) x = (if n = 0 then x else (f ^^ (n - 1)) (f x))"
+  sorry
 
 ;end_setup
 
 ;setup_theory ind_type
 
-lemma INJ_INVERSE2: "ALL P::'A::type => 'B::type => 'C::type.
-   (ALL (x1::'A::type) (y1::'B::type) (x2::'A::type) y2::'B::type.
-       (P x1 y1 = P x2 y2) = (x1 = x2 & y1 = y2)) -->
-   (EX (x::'C::type => 'A::type) Y::'C::type => 'B::type.
-       ALL (xa::'A::type) y::'B::type. x (P xa y) = xa & Y (P xa y) = y)"
-  by (import ind_type INJ_INVERSE2)
-
-definition NUMPAIR :: "nat => nat => nat" where 
-  "NUMPAIR == %(x::nat) y::nat. 2 ^ x * (2 * y + 1)"
-
-lemma NUMPAIR: "ALL (x::nat) y::nat. NUMPAIR x y = 2 ^ x * (2 * y + 1)"
-  by (import ind_type NUMPAIR)
-
-lemma NUMPAIR_INJ_LEMMA: "ALL (x::nat) (xa::nat) (xb::nat) xc::nat.
-   NUMPAIR x xa = NUMPAIR xb xc --> x = xb"
-  by (import ind_type NUMPAIR_INJ_LEMMA)
-
-lemma NUMPAIR_INJ: "ALL (x1::nat) (y1::nat) (x2::nat) y2::nat.
-   (NUMPAIR x1 y1 = NUMPAIR x2 y2) = (x1 = x2 & y1 = y2)"
-  by (import ind_type NUMPAIR_INJ)
+lemma INJ_INVERSE2: "(!!(x1::'A) (y1::'B) (x2::'A) y2::'B.
+    ((P::'A => 'B => 'C) x1 y1 = P x2 y2) = (x1 = x2 & y1 = y2))
+==> EX (x::'C => 'A) Y::'C => 'B.
+       ALL (xa::'A) y::'B. x (P xa y) = xa & Y (P xa y) = y"
+  sorry
+
+definition
+  NUMPAIR :: "nat => nat => nat"  where
+  "NUMPAIR == %x y. 2 ^ x * (2 * y + 1)"
+
+lemma NUMPAIR: "NUMPAIR x y = 2 ^ x * (2 * y + 1)"
+  sorry
+
+lemma NUMPAIR_INJ_LEMMA: "NUMPAIR x xa = NUMPAIR xb xc ==> x = xb"
+  sorry
+
+lemma NUMPAIR_INJ: "(NUMPAIR x1 y1 = NUMPAIR x2 y2) = (x1 = x2 & y1 = y2)"
+  sorry
 
 consts
   NUMSND :: "nat => nat" 
   NUMFST :: "nat => nat" 
 
-specification (NUMFST NUMSND) NUMPAIR_DEST: "ALL (x::nat) y::nat. NUMFST (NUMPAIR x y) = x & NUMSND (NUMPAIR x y) = y"
-  by (import ind_type NUMPAIR_DEST)
-
-definition NUMSUM :: "bool => nat => nat" where 
-  "NUMSUM == %(b::bool) x::nat. if b then Suc (2 * x) else 2 * x"
-
-lemma NUMSUM: "ALL (b::bool) x::nat. NUMSUM b x = (if b then Suc (2 * x) else 2 * x)"
-  by (import ind_type NUMSUM)
-
-lemma NUMSUM_INJ: "ALL (b1::bool) (x1::nat) (b2::bool) x2::nat.
-   (NUMSUM b1 x1 = NUMSUM b2 x2) = (b1 = b2 & x1 = x2)"
-  by (import ind_type NUMSUM_INJ)
+specification (NUMFST NUMSND) NUMPAIR_DEST: "ALL x y. NUMFST (NUMPAIR x y) = x & NUMSND (NUMPAIR x y) = y"
+  sorry
+
+definition
+  NUMSUM :: "bool => nat => nat"  where
+  "NUMSUM == %b x. if b then Suc (2 * x) else 2 * x"
+
+lemma NUMSUM: "NUMSUM b x = (if b then Suc (2 * x) else 2 * x)"
+  sorry
+
+lemma NUMSUM_INJ: "(NUMSUM b1 x1 = NUMSUM b2 x2) = (b1 = b2 & x1 = x2)"
+  sorry
 
 consts
   NUMRIGHT :: "nat => nat" 
   NUMLEFT :: "nat => bool" 
 
-specification (NUMLEFT NUMRIGHT) NUMSUM_DEST: "ALL (x::bool) y::nat. NUMLEFT (NUMSUM x y) = x & NUMRIGHT (NUMSUM x y) = y"
-  by (import ind_type NUMSUM_DEST)
-
-definition INJN :: "nat => nat => 'a => bool" where 
-  "INJN == %(m::nat) (n::nat) a::'a::type. n = m"
-
-lemma INJN: "ALL m::nat. INJN m = (%(n::nat) a::'a::type. n = m)"
-  by (import ind_type INJN)
-
-lemma INJN_INJ: "ALL (n1::nat) n2::nat. (INJN n1 = INJN n2) = (n1 = n2)"
-  by (import ind_type INJN_INJ)
-
-definition INJA :: "'a => nat => 'a => bool" where 
-  "INJA == %(a::'a::type) (n::nat) b::'a::type. b = a"
-
-lemma INJA: "ALL a::'a::type. INJA a = (%(n::nat) b::'a::type. b = a)"
-  by (import ind_type INJA)
-
-lemma INJA_INJ: "ALL (a1::'a::type) a2::'a::type. (INJA a1 = INJA a2) = (a1 = a2)"
-  by (import ind_type INJA_INJ)
-
-definition INJF :: "(nat => nat => 'a => bool) => nat => 'a => bool" where 
-  "INJF == %(f::nat => nat => 'a::type => bool) n::nat. f (NUMFST n) (NUMSND n)"
-
-lemma INJF: "ALL f::nat => nat => 'a::type => bool.
-   INJF f = (%n::nat. f (NUMFST n) (NUMSND n))"
-  by (import ind_type INJF)
-
-lemma INJF_INJ: "ALL (f1::nat => nat => 'a::type => bool) f2::nat => nat => 'a::type => bool.
-   (INJF f1 = INJF f2) = (f1 = f2)"
-  by (import ind_type INJF_INJ)
-
-definition INJP :: "(nat => 'a => bool) => (nat => 'a => bool) => nat => 'a => bool" where 
+specification (NUMLEFT NUMRIGHT) NUMSUM_DEST: "ALL x y. NUMLEFT (NUMSUM x y) = x & NUMRIGHT (NUMSUM x y) = y"
+  sorry
+
+definition
+  INJN :: "nat => nat => 'a => bool"  where
+  "INJN == %m n a. n = m"
+
+lemma INJN: "INJN m = (%n a. n = m)"
+  sorry
+
+lemma INJN_INJ: "(INJN n1 = INJN n2) = (n1 = n2)"
+  sorry
+
+definition
+  INJA :: "'a => nat => 'a => bool"  where
+  "INJA == %a n b. b = a"
+
+lemma INJA: "INJA a = (%n b. b = a)"
+  sorry
+
+lemma INJA_INJ: "(INJA a1 = INJA a2) = (a1 = a2)"
+  sorry
+
+definition
+  INJF :: "(nat => nat => 'a => bool) => nat => 'a => bool"  where
+  "INJF == %f n. f (NUMFST n) (NUMSND n)"
+
+lemma INJF: "INJF f = (%n. f (NUMFST n) (NUMSND n))"
+  sorry
+
+lemma INJF_INJ: "(INJF f1 = INJF f2) = (f1 = f2)"
+  sorry
+
+definition
+  INJP :: "(nat => 'a => bool) => (nat => 'a => bool) => nat => 'a => bool"  where
   "INJP ==
-%(f1::nat => 'a::type => bool) (f2::nat => 'a::type => bool) (n::nat)
-   a::'a::type. if NUMLEFT n then f1 (NUMRIGHT n) a else f2 (NUMRIGHT n) a"
-
-lemma INJP: "ALL (f1::nat => 'a::type => bool) f2::nat => 'a::type => bool.
-   INJP f1 f2 =
-   (%(n::nat) a::'a::type.
-       if NUMLEFT n then f1 (NUMRIGHT n) a else f2 (NUMRIGHT n) a)"
-  by (import ind_type INJP)
-
-lemma INJP_INJ: "ALL (f1::nat => 'a::type => bool) (f1'::nat => 'a::type => bool)
-   (f2::nat => 'a::type => bool) f2'::nat => 'a::type => bool.
-   (INJP f1 f2 = INJP f1' f2') = (f1 = f1' & f2 = f2')"
-  by (import ind_type INJP_INJ)
-
-definition ZCONSTR :: "nat => 'a => (nat => nat => 'a => bool) => nat => 'a => bool" where 
-  "ZCONSTR ==
-%(c::nat) (i::'a::type) r::nat => nat => 'a::type => bool.
-   INJP (INJN (Suc c)) (INJP (INJA i) (INJF r))"
-
-lemma ZCONSTR: "ALL (c::nat) (i::'a::type) r::nat => nat => 'a::type => bool.
-   ZCONSTR c i r = INJP (INJN (Suc c)) (INJP (INJA i) (INJF r))"
-  by (import ind_type ZCONSTR)
-
-definition ZBOT :: "nat => 'a => bool" where 
-  "ZBOT == INJP (INJN 0) (SOME z::nat => 'a::type => bool. True)"
-
-lemma ZBOT: "ZBOT = INJP (INJN 0) (SOME z::nat => 'a::type => bool. True)"
-  by (import ind_type ZBOT)
-
-lemma ZCONSTR_ZBOT: "ALL (x::nat) (xa::'a::type) xb::nat => nat => 'a::type => bool.
-   ZCONSTR x xa xb ~= ZBOT"
-  by (import ind_type ZCONSTR_ZBOT)
-
-definition ZRECSPACE :: "(nat => 'a => bool) => bool" where 
+%f1 f2 n a. if NUMLEFT n then f1 (NUMRIGHT n) a else f2 (NUMRIGHT n) a"
+
+lemma INJP: "INJP f1 f2 =
+(%n a. if NUMLEFT n then f1 (NUMRIGHT n) a else f2 (NUMRIGHT n) a)"
+  sorry
+
+lemma INJP_INJ: "(INJP f1 f2 = INJP f1' f2') = (f1 = f1' & f2 = f2')"
+  sorry
+
+definition
+  ZCONSTR :: "nat => 'a => (nat => nat => 'a => bool) => nat => 'a => bool"  where
+  "ZCONSTR == %c i r. INJP (INJN (Suc c)) (INJP (INJA i) (INJF r))"
+
+lemma ZCONSTR: "ZCONSTR c i r = INJP (INJN (Suc c)) (INJP (INJA i) (INJF r))"
+  sorry
+
+definition
+  ZBOT :: "nat => 'a => bool"  where
+  "ZBOT == INJP (INJN 0) (SOME z. True)"
+
+lemma ZBOT: "ZBOT = INJP (INJN 0) (SOME z. True)"
+  sorry
+
+lemma ZCONSTR_ZBOT: "ZCONSTR x xa xb ~= ZBOT"
+  sorry
+
+definition
+  ZRECSPACE :: "(nat => 'a => bool) => bool"  where
   "ZRECSPACE ==
-%a0::nat => 'a::type => bool.
-   ALL ZRECSPACE'::(nat => 'a::type => bool) => bool.
-      (ALL a0::nat => 'a::type => bool.
-          a0 = ZBOT |
-          (EX (c::nat) (i::'a::type) r::nat => nat => 'a::type => bool.
-              a0 = ZCONSTR c i r & (ALL n::nat. ZRECSPACE' (r n))) -->
-          ZRECSPACE' a0) -->
-      ZRECSPACE' a0"
+%a0. ALL ZRECSPACE'.
+        (ALL a0.
+            a0 = ZBOT |
+            (EX c i r. a0 = ZCONSTR c i r & (ALL n. ZRECSPACE' (r n))) -->
+            ZRECSPACE' a0) -->
+        ZRECSPACE' a0"
 
 lemma ZRECSPACE: "ZRECSPACE =
-(%a0::nat => 'a::type => bool.
-    ALL ZRECSPACE'::(nat => 'a::type => bool) => bool.
-       (ALL a0::nat => 'a::type => bool.
-           a0 = ZBOT |
-           (EX (c::nat) (i::'a::type) r::nat => nat => 'a::type => bool.
-               a0 = ZCONSTR c i r & (ALL n::nat. ZRECSPACE' (r n))) -->
-           ZRECSPACE' a0) -->
-       ZRECSPACE' a0)"
-  by (import ind_type ZRECSPACE)
+(%a0. ALL ZRECSPACE'.
+         (ALL a0.
+             a0 = ZBOT |
+             (EX c i r. a0 = ZCONSTR c i r & (ALL n. ZRECSPACE' (r n))) -->
+             ZRECSPACE' a0) -->
+         ZRECSPACE' a0)"
+  sorry
 
 lemma ZRECSPACE_rules: "(op &::bool => bool => bool)
  ((ZRECSPACE::(nat => 'a::type => bool) => bool)
@@ -2904,26 +2212,19 @@
                                   => (nat => nat => 'a::type => bool)
                                      => nat => 'a::type => bool)
                       c i r))))))"
-  by (import ind_type ZRECSPACE_rules)
-
-lemma ZRECSPACE_ind: "ALL x::(nat => 'a::type => bool) => bool.
-   x ZBOT &
-   (ALL (c::nat) (i::'a::type) r::nat => nat => 'a::type => bool.
-       (ALL n::nat. x (r n)) --> x (ZCONSTR c i r)) -->
-   (ALL a0::nat => 'a::type => bool. ZRECSPACE a0 --> x a0)"
-  by (import ind_type ZRECSPACE_ind)
-
-lemma ZRECSPACE_cases: "ALL a0::nat => 'a::type => bool.
-   ZRECSPACE a0 =
-   (a0 = ZBOT |
-    (EX (c::nat) (i::'a::type) r::nat => nat => 'a::type => bool.
-        a0 = ZCONSTR c i r & (ALL n::nat. ZRECSPACE (r n))))"
-  by (import ind_type ZRECSPACE_cases)
-
-typedef (open) ('a) recspace = "(Collect::((nat => 'a::type => bool) => bool)
-          => (nat => 'a::type => bool) set)
- (ZRECSPACE::(nat => 'a::type => bool) => bool)" 
-  by (rule typedef_helper,import ind_type recspace_TY_DEF)
+  sorry
+
+lemma ZRECSPACE_ind: "[| x ZBOT & (ALL c i r. (ALL n. x (r n)) --> x (ZCONSTR c i r));
+   ZRECSPACE a0 |]
+==> x a0"
+  sorry
+
+lemma ZRECSPACE_cases: "ZRECSPACE a0 =
+(a0 = ZBOT | (EX c i r. a0 = ZCONSTR c i r & (ALL n. ZRECSPACE (r n))))"
+  sorry
+
+typedef (open) ('a) recspace = "Collect ZRECSPACE :: (nat \<Rightarrow> 'a\<Colon>type \<Rightarrow> bool) set"
+  sorry
 
 lemmas recspace_TY_DEF = typedef_hol2hol4 [OF type_definition_recspace]
 
@@ -2931,110 +2232,85 @@
   mk_rec :: "(nat => 'a => bool) => 'a recspace" 
   dest_rec :: "'a recspace => nat => 'a => bool" 
 
-specification (dest_rec mk_rec) recspace_repfns: "(ALL a::'a::type recspace. mk_rec (dest_rec a) = a) &
-(ALL r::nat => 'a::type => bool. ZRECSPACE r = (dest_rec (mk_rec r) = r))"
-  by (import ind_type recspace_repfns)
-
-definition BOTTOM :: "'a recspace" where 
+specification (dest_rec mk_rec) recspace_repfns: "(ALL a::'a recspace. mk_rec (dest_rec a) = a) &
+(ALL r::nat => 'a => bool. ZRECSPACE r = (dest_rec (mk_rec r) = r))"
+  sorry
+
+definition
+  BOTTOM :: "'a recspace"  where
   "BOTTOM == mk_rec ZBOT"
 
 lemma BOTTOM: "BOTTOM = mk_rec ZBOT"
-  by (import ind_type BOTTOM)
-
-definition CONSTR :: "nat => 'a => (nat => 'a recspace) => 'a recspace" where 
-  "CONSTR ==
-%(c::nat) (i::'a::type) r::nat => 'a::type recspace.
-   mk_rec (ZCONSTR c i (%n::nat. dest_rec (r n)))"
-
-lemma CONSTR: "ALL (c::nat) (i::'a::type) r::nat => 'a::type recspace.
-   CONSTR c i r = mk_rec (ZCONSTR c i (%n::nat. dest_rec (r n)))"
-  by (import ind_type CONSTR)
-
-lemma MK_REC_INJ: "ALL (x::nat => 'a::type => bool) y::nat => 'a::type => bool.
-   mk_rec x = mk_rec y --> ZRECSPACE x & ZRECSPACE y --> x = y"
-  by (import ind_type MK_REC_INJ)
-
-lemma DEST_REC_INJ: "ALL (x::'a::type recspace) y::'a::type recspace.
-   (dest_rec x = dest_rec y) = (x = y)"
-  by (import ind_type DEST_REC_INJ)
-
-lemma CONSTR_BOT: "ALL (c::nat) (i::'a::type) r::nat => 'a::type recspace.
-   CONSTR c i r ~= BOTTOM"
-  by (import ind_type CONSTR_BOT)
-
-lemma CONSTR_INJ: "ALL (c1::nat) (i1::'a::type) (r1::nat => 'a::type recspace) (c2::nat)
-   (i2::'a::type) r2::nat => 'a::type recspace.
-   (CONSTR c1 i1 r1 = CONSTR c2 i2 r2) = (c1 = c2 & i1 = i2 & r1 = r2)"
-  by (import ind_type CONSTR_INJ)
-
-lemma CONSTR_IND: "ALL P::'a::type recspace => bool.
-   P BOTTOM &
-   (ALL (c::nat) (i::'a::type) r::nat => 'a::type recspace.
-       (ALL n::nat. P (r n)) --> P (CONSTR c i r)) -->
-   All P"
-  by (import ind_type CONSTR_IND)
-
-lemma CONSTR_REC: "ALL Fn::nat
-        => 'a::type
-           => (nat => 'a::type recspace) => (nat => 'b::type) => 'b::type.
-   EX f::'a::type recspace => 'b::type.
-      ALL (c::nat) (i::'a::type) r::nat => 'a::type recspace.
-         f (CONSTR c i r) = Fn c i r (%n::nat. f (r n))"
-  by (import ind_type CONSTR_REC)
+  sorry
+
+definition
+  CONSTR :: "nat => 'a => (nat => 'a recspace) => 'a recspace"  where
+  "CONSTR == %c i r. mk_rec (ZCONSTR c i (%n. dest_rec (r n)))"
+
+lemma CONSTR: "CONSTR c i r = mk_rec (ZCONSTR c i (%n. dest_rec (r n)))"
+  sorry
+
+lemma MK_REC_INJ: "[| mk_rec x = mk_rec y; ZRECSPACE x & ZRECSPACE y |] ==> x = y"
+  sorry
+
+lemma DEST_REC_INJ: "(dest_rec x = dest_rec y) = (x = y)"
+  sorry
+
+lemma CONSTR_BOT: "CONSTR c i r ~= BOTTOM"
+  sorry
+
+lemma CONSTR_INJ: "(CONSTR c1 i1 r1 = CONSTR c2 i2 r2) = (c1 = c2 & i1 = i2 & r1 = r2)"
+  sorry
+
+lemma CONSTR_IND: "P BOTTOM & (ALL c i r. (ALL n. P (r n)) --> P (CONSTR c i r)) ==> P x"
+  sorry
+
+lemma CONSTR_REC: "EX f. ALL c i r. f (CONSTR c i r) = Fn c i r (%n. f (r n))"
+  sorry
 
 consts
   FCONS :: "'a => (nat => 'a) => nat => 'a" 
 
-specification (FCONS) FCONS: "(ALL (a::'a::type) f::nat => 'a::type. FCONS a f 0 = a) &
-(ALL (a::'a::type) (f::nat => 'a::type) n::nat. FCONS a f (Suc n) = f n)"
-  by (import ind_type FCONS)
-
-definition FNIL :: "nat => 'a" where 
-  "FNIL == %n::nat. SOME x::'a::type. True"
-
-lemma FNIL: "ALL n::nat. FNIL n = (SOME x::'a::type. True)"
-  by (import ind_type FNIL)
-
-definition ISO :: "('a => 'b) => ('b => 'a) => bool" where 
-  "ISO ==
-%(f::'a::type => 'b::type) g::'b::type => 'a::type.
-   (ALL x::'b::type. f (g x) = x) & (ALL y::'a::type. g (f y) = y)"
-
-lemma ISO: "ALL (f::'a::type => 'b::type) g::'b::type => 'a::type.
-   ISO f g =
-   ((ALL x::'b::type. f (g x) = x) & (ALL y::'a::type. g (f y) = y))"
-  by (import ind_type ISO)
-
-lemma ISO_REFL: "ISO (%x::'a::type. x) (%x::'a::type. x)"
-  by (import ind_type ISO_REFL)
-
-lemma ISO_FUN: "ISO (f::'a::type => 'c::type) (f'::'c::type => 'a::type) &
-ISO (g::'b::type => 'd::type) (g'::'d::type => 'b::type) -->
-ISO (%(h::'a::type => 'b::type) a'::'c::type. g (h (f' a')))
- (%(h::'c::type => 'd::type) a::'a::type. g' (h (f a)))"
-  by (import ind_type ISO_FUN)
-
-lemma ISO_USAGE: "ISO (f::'a::type => 'b::type) (g::'b::type => 'a::type) -->
-(ALL P::'a::type => bool. All P = (ALL x::'b::type. P (g x))) &
-(ALL P::'a::type => bool. Ex P = (EX x::'b::type. P (g x))) &
-(ALL (a::'a::type) b::'b::type. (a = g b) = (f a = b))"
-  by (import ind_type ISO_USAGE)
+specification (FCONS) FCONS: "(ALL (a::'a) f::nat => 'a. FCONS a f (0::nat) = a) &
+(ALL (a::'a) (f::nat => 'a) n::nat. FCONS a f (Suc n) = f n)"
+  sorry
+
+definition
+  FNIL :: "nat => 'a"  where
+  "FNIL == %n. SOME x. True"
+
+lemma FNIL: "FNIL n = (SOME x. True)"
+  sorry
+
+definition
+  ISO :: "('a => 'b) => ('b => 'a) => bool"  where
+  "ISO == %f g. (ALL x. f (g x) = x) & (ALL y. g (f y) = y)"
+
+lemma ISO: "ISO f g = ((ALL x. f (g x) = x) & (ALL y. g (f y) = y))"
+  sorry
+
+lemma ISO_REFL: "ISO (%x. x) (%x. x)"
+  sorry
+
+lemma ISO_FUN: "ISO (f::'a => 'c) (f'::'c => 'a) & ISO (g::'b => 'd) (g'::'d => 'b)
+==> ISO (%(h::'a => 'b) a'::'c. g (h (f' a')))
+     (%(h::'c => 'd) a::'a. g' (h (f a)))"
+  sorry
+
+lemma ISO_USAGE: "ISO f g
+==> (ALL P. All P = (ALL x. P (g x))) &
+    (ALL P. Ex P = (EX x. P (g x))) & (ALL a b. (a = g b) = (f a = b))"
+  sorry
 
 ;end_setup
 
 ;setup_theory divides
 
-lemma ONE_DIVIDES_ALL: "(All::(nat => bool) => bool) ((op dvd::nat => nat => bool) (1::nat))"
-  by (import divides ONE_DIVIDES_ALL)
-
-lemma DIVIDES_ADD_2: "ALL (a::nat) (b::nat) c::nat. a dvd b & a dvd b + c --> a dvd c"
-  by (import divides DIVIDES_ADD_2)
-
-lemma DIVIDES_FACT: "ALL b>0. b dvd FACT b"
-  by (import divides DIVIDES_FACT)
-
-lemma DIVIDES_MULT_LEFT: "ALL (x::nat) xa::nat. (x * xa dvd xa) = (xa = 0 | x = 1)"
-  by (import divides DIVIDES_MULT_LEFT)
+lemma DIVIDES_FACT: "0 < b ==> b dvd FACT b"
+  sorry
+
+lemma DIVIDES_MULT_LEFT: "((x::nat) * (xa::nat) dvd xa) = (xa = (0::nat) | x = (1::nat))"
+  sorry
 
 ;end_setup
 
@@ -3044,17 +2320,16 @@
   prime :: "nat => bool" 
 
 defs
-  prime_primdef: "prime.prime == %a::nat. a ~= 1 & (ALL b::nat. b dvd a --> b = a | b = 1)"
-
-lemma prime_def: "ALL a::nat.
-   prime.prime a = (a ~= 1 & (ALL b::nat. b dvd a --> b = a | b = 1))"
-  by (import prime prime_def)
+  prime_primdef: "prime.prime == %a. a ~= 1 & (ALL b. b dvd a --> b = a | b = 1)"
+
+lemma prime_def: "prime.prime a = (a ~= 1 & (ALL b. b dvd a --> b = a | b = 1))"
+  sorry
 
 lemma NOT_PRIME_0: "~ prime.prime 0"
-  by (import prime NOT_PRIME_0)
+  sorry
 
 lemma NOT_PRIME_1: "~ prime.prime 1"
-  by (import prime NOT_PRIME_1)
+  sorry
 
 ;end_setup
 
@@ -3063,997 +2338,758 @@
 consts
   EL :: "nat => 'a list => 'a" 
 
-specification (EL) EL: "(ALL l::'a::type list. EL 0 l = hd l) &
-(ALL (l::'a::type list) n::nat. EL (Suc n) l = EL n (tl l))"
-  by (import list EL)
+specification (EL) EL: "(ALL l::'a list. EL (0::nat) l = hd l) &
+(ALL (l::'a list) n::nat. EL (Suc n) l = EL n (tl l))"
+  sorry
 
 lemma NULL: "(op &::bool => bool => bool)
- ((null::'a::type list => bool) ([]::'a::type list))
+ ((List.null::'a::type list => bool) ([]::'a::type list))
  ((All::('a::type => bool) => bool)
    (%x::'a::type.
        (All::('a::type list => bool) => bool)
         (%xa::'a::type list.
             (Not::bool => bool)
-             ((null::'a::type list => bool)
+             ((List.null::'a::type list => bool)
                ((op #::'a::type => 'a::type list => 'a::type list) x xa)))))"
-  by (import list NULL)
-
-lemma list_case_compute: "ALL l::'a::type list.
-   list_case (b::'b::type) (f::'a::type => 'a::type list => 'b::type) l =
-   (if null l then b else f (hd l) (tl l))"
-  by (import list list_case_compute)
-
-lemma LIST_NOT_EQ: "ALL (l1::'a::type list) l2::'a::type list.
-   l1 ~= l2 --> (ALL (x::'a::type) xa::'a::type. x # l1 ~= xa # l2)"
-  by (import list LIST_NOT_EQ)
-
-lemma NOT_EQ_LIST: "ALL (h1::'a::type) h2::'a::type.
-   h1 ~= h2 -->
-   (ALL (x::'a::type list) xa::'a::type list. h1 # x ~= h2 # xa)"
-  by (import list NOT_EQ_LIST)
-
-lemma EQ_LIST: "ALL (h1::'a::type) h2::'a::type.
-   h1 = h2 -->
-   (ALL (l1::'a::type list) l2::'a::type list.
-       l1 = l2 --> h1 # l1 = h2 # l2)"
-  by (import list EQ_LIST)
-
-lemma CONS: "ALL l::'a::type list. ~ null l --> hd l # tl l = l"
-  by (import list CONS)
-
-lemma MAP_EQ_NIL: "ALL (l::'a::type list) f::'a::type => 'b::type.
-   (map f l = []) = (l = []) & ([] = map f l) = (l = [])"
-  by (import list MAP_EQ_NIL)
-
-lemma EVERY_EL: "(All::('a::type list => bool) => bool)
- (%l::'a::type list.
-     (All::(('a::type => bool) => bool) => bool)
-      (%P::'a::type => bool.
-          (op =::bool => bool => bool)
-           ((list_all::('a::type => bool) => 'a::type list => bool) P l)
-           ((All::(nat => bool) => bool)
-             (%n::nat.
-                 (op -->::bool => bool => bool)
-                  ((op <::nat => nat => bool) n
-                    ((size::'a::type list => nat) l))
-                  (P ((EL::nat => 'a::type list => 'a::type) n l))))))"
-  by (import list EVERY_EL)
-
-lemma EVERY_CONJ: "ALL l::'a::type list.
-   list_all
-    (%x::'a::type. (P::'a::type => bool) x & (Q::'a::type => bool) x) l =
-   (list_all P l & list_all Q l)"
-  by (import list EVERY_CONJ)
-
-lemma EVERY_MEM: "ALL (P::'a::type => bool) l::'a::type list.
-   list_all P l = (ALL e::'a::type. e mem l --> P e)"
-  by (import list EVERY_MEM)
-
-lemma EXISTS_MEM: "ALL (P::'a::type => bool) l::'a::type list.
-   list_ex P l = (EX e::'a::type. e mem l & P e)"
-  by (import list EXISTS_MEM)
-
-lemma MEM_APPEND: "ALL (e::'a::type) (l1::'a::type list) l2::'a::type list.
-   e mem l1 @ l2 = (e mem l1 | e mem l2)"
-  by (import list MEM_APPEND)
-
-lemma EXISTS_APPEND: "ALL (P::'a::type => bool) (l1::'a::type list) l2::'a::type list.
-   list_ex P (l1 @ l2) = (list_ex P l1 | list_ex P l2)"
-  by (import list EXISTS_APPEND)
-
-lemma NOT_EVERY: "ALL (P::'a::type => bool) l::'a::type list.
-   (~ list_all P l) = list_ex (Not o P) l"
-  by (import list NOT_EVERY)
-
-lemma NOT_EXISTS: "ALL (P::'a::type => bool) l::'a::type list.
-   (~ list_ex P l) = list_all (Not o P) l"
-  by (import list NOT_EXISTS)
-
-lemma MEM_MAP: "ALL (l::'a::type list) (f::'a::type => 'b::type) x::'b::type.
-   x mem map f l = (EX y::'a::type. x = f y & y mem l)"
-  by (import list MEM_MAP)
-
-lemma LENGTH_CONS: "ALL (l::'a::type list) n::nat.
-   (length l = Suc n) =
-   (EX (h::'a::type) l'::'a::type list. length l' = n & l = h # l')"
-  by (import list LENGTH_CONS)
-
-lemma LENGTH_EQ_CONS: "ALL (P::'a::type list => bool) n::nat.
-   (ALL l::'a::type list. length l = Suc n --> P l) =
-   (ALL l::'a::type list. length l = n --> (ALL x::'a::type. P (x # l)))"
-  by (import list LENGTH_EQ_CONS)
-
-lemma LENGTH_EQ_NIL: "ALL P::'a::type list => bool.
-   (ALL l::'a::type list. length l = 0 --> P l) = P []"
-  by (import list LENGTH_EQ_NIL)
-
-lemma CONS_ACYCLIC: "ALL (l::'a::type list) x::'a::type. l ~= x # l & x # l ~= l"
-  by (import list CONS_ACYCLIC)
-
-lemma APPEND_eq_NIL: "(ALL (l1::'a::type list) l2::'a::type list.
-    ([] = l1 @ l2) = (l1 = [] & l2 = [])) &
-(ALL (l1::'a::type list) l2::'a::type list.
-    (l1 @ l2 = []) = (l1 = [] & l2 = []))"
-  by (import list APPEND_eq_NIL)
-
-lemma APPEND_11: "(ALL (l1::'a::type list) (l2::'a::type list) l3::'a::type list.
+  sorry
+
+lemma list_case_compute: "list_case (b::'b) (f::'a => 'a list => 'b) (l::'a list) =
+(if List.null l then b else f (hd l) (tl l))"
+  sorry
+
+lemma LIST_NOT_EQ: "l1 ~= l2 ==> x # l1 ~= xa # l2"
+  sorry
+
+lemma NOT_EQ_LIST: "h1 ~= h2 ==> h1 # x ~= h2 # xa"
+  sorry
+
+lemma EQ_LIST: "[| h1 = h2; l1 = l2 |] ==> h1 # l1 = h2 # l2"
+  sorry
+
+lemma CONS: "~ List.null l ==> hd l # tl l = l"
+  sorry
+
+lemma MAP_EQ_NIL: "(map (f::'a => 'b) (l::'a list) = []) = (l = []) & ([] = map f l) = (l = [])"
+  sorry
+
+lemma EVERY_EL: "list_all P l = (ALL n<length l. P (EL n l))"
+  sorry
+
+lemma EVERY_CONJ: "list_all (%x. P x & Q x) l = (list_all P l & list_all Q l)"
+  sorry
+
+lemma EVERY_MEM: "list_all P l = (ALL e. List.member l e --> P e)"
+  sorry
+
+lemma EXISTS_MEM: "list_ex P l = (EX e. List.member l e & P e)"
+  sorry
+
+lemma MEM_APPEND: "List.member (l1 @ l2) e = (List.member l1 e | List.member l2 e)"
+  sorry
+
+lemma NOT_EVERY: "(~ list_all P l) = list_ex (Not o P) l"
+  sorry
+
+lemma NOT_EXISTS: "(~ list_ex P l) = list_all (Not o P) l"
+  sorry
+
+lemma MEM_MAP: "List.member (map (f::'a => 'b) (l::'a list)) (x::'b) =
+(EX y::'a. x = f y & List.member l y)"
+  sorry
+
+lemma LENGTH_CONS: "(length l = Suc n) = (EX h l'. length l' = n & l = h # l')"
+  sorry
+
+lemma LENGTH_EQ_CONS: "(ALL l. length l = Suc n --> P l) =
+(ALL l. length l = n --> (ALL x. P (x # l)))"
+  sorry
+
+lemma LENGTH_EQ_NIL: "(ALL l. length l = 0 --> P l) = P []"
+  sorry
+
+lemma CONS_ACYCLIC: "l ~= x # l & x # l ~= l"
+  sorry
+
+lemma APPEND_eq_NIL: "(ALL (l1::'a list) l2::'a list. ([] = l1 @ l2) = (l1 = [] & l2 = [])) &
+(ALL (l1::'a list) l2::'a list. (l1 @ l2 = []) = (l1 = [] & l2 = []))"
+  sorry
+
+lemma APPEND_11: "(ALL (l1::'a list) (l2::'a list) l3::'a list.
     (l1 @ l2 = l1 @ l3) = (l2 = l3)) &
-(ALL (l1::'a::type list) (l2::'a::type list) l3::'a::type list.
+(ALL (l1::'a list) (l2::'a list) l3::'a list.
     (l2 @ l1 = l3 @ l1) = (l2 = l3))"
-  by (import list APPEND_11)
-
-lemma EL_compute: "ALL n::nat.
-   EL n (l::'a::type list) = (if n = 0 then hd l else EL (PRE n) (tl l))"
-  by (import list EL_compute)
-
-lemma WF_LIST_PRED: "WF (%(L1::'a::type list) L2::'a::type list. EX h::'a::type. L2 = h # L1)"
-  by (import list WF_LIST_PRED)
-
-lemma list_size_cong: "ALL (M::'a::type list) (N::'a::type list) (f::'a::type => nat)
-   f'::'a::type => nat.
-   M = N & (ALL x::'a::type. x mem N --> f x = f' x) -->
-   list_size f M = list_size f' N"
-  by (import list list_size_cong)
-
-lemma FOLDR_CONG: "ALL (l::'a::type list) (l'::'a::type list) (b::'b::type) (b'::'b::type)
-   (f::'a::type => 'b::type => 'b::type)
-   f'::'a::type => 'b::type => 'b::type.
-   l = l' &
-   b = b' & (ALL (x::'a::type) a::'b::type. x mem l' --> f x a = f' x a) -->
-   foldr f l b = foldr f' l' b'"
-  by (import list FOLDR_CONG)
-
-lemma FOLDL_CONG: "ALL (l::'a::type list) (l'::'a::type list) (b::'b::type) (b'::'b::type)
-   (f::'b::type => 'a::type => 'b::type)
-   f'::'b::type => 'a::type => 'b::type.
-   l = l' &
-   b = b' & (ALL (x::'a::type) a::'b::type. x mem l' --> f a x = f' a x) -->
-   foldl f b l = foldl f' b' l'"
-  by (import list FOLDL_CONG)
-
-lemma MAP_CONG: "ALL (l1::'a::type list) (l2::'a::type list) (f::'a::type => 'b::type)
-   f'::'a::type => 'b::type.
-   l1 = l2 & (ALL x::'a::type. x mem l2 --> f x = f' x) -->
-   map f l1 = map f' l2"
-  by (import list MAP_CONG)
-
-lemma EXISTS_CONG: "ALL (l1::'a::type list) (l2::'a::type list) (P::'a::type => bool)
-   P'::'a::type => bool.
-   l1 = l2 & (ALL x::'a::type. x mem l2 --> P x = P' x) -->
-   list_ex P l1 = list_ex P' l2"
-  by (import list EXISTS_CONG)
-
-lemma EVERY_CONG: "ALL (l1::'a::type list) (l2::'a::type list) (P::'a::type => bool)
-   P'::'a::type => bool.
-   l1 = l2 & (ALL x::'a::type. x mem l2 --> P x = P' x) -->
-   list_all P l1 = list_all P' l2"
-  by (import list EVERY_CONG)
-
-lemma EVERY_MONOTONIC: "ALL (P::'a::type => bool) Q::'a::type => bool.
-   (ALL x::'a::type. P x --> Q x) -->
-   (ALL l::'a::type list. list_all P l --> list_all Q l)"
-  by (import list EVERY_MONOTONIC)
-
-lemma LENGTH_ZIP: "ALL (l1::'a::type list) l2::'b::type list.
-   length l1 = length l2 -->
-   length (zip l1 l2) = length l1 & length (zip l1 l2) = length l2"
-  by (import list LENGTH_ZIP)
-
-lemma LENGTH_UNZIP: "ALL pl::('a::type * 'b::type) list.
-   length (fst (unzip pl)) = length pl & length (snd (unzip pl)) = length pl"
-  by (import list LENGTH_UNZIP)
-
-lemma ZIP_UNZIP: "ALL l::('a::type * 'b::type) list. ZIP (unzip l) = l"
-  by (import list ZIP_UNZIP)
-
-lemma UNZIP_ZIP: "ALL (l1::'a::type list) l2::'b::type list.
-   length l1 = length l2 --> unzip (zip l1 l2) = (l1, l2)"
-  by (import list UNZIP_ZIP)
-
-lemma ZIP_MAP: "ALL (l1::'a::type list) (l2::'b::type list) (f1::'a::type => 'c::type)
-   f2::'b::type => 'd::type.
-   length l1 = length l2 -->
-   zip (map f1 l1) l2 =
-   map (%p::'a::type * 'b::type. (f1 (fst p), snd p)) (zip l1 l2) &
-   zip l1 (map f2 l2) =
-   map (%p::'a::type * 'b::type. (fst p, f2 (snd p))) (zip l1 l2)"
-  by (import list ZIP_MAP)
-
-lemma MEM_ZIP: "(All::('a::type list => bool) => bool)
- (%l1::'a::type list.
-     (All::('b::type list => bool) => bool)
-      (%l2::'b::type list.
-          (All::('a::type * 'b::type => bool) => bool)
-           (%p::'a::type * 'b::type.
-               (op -->::bool => bool => bool)
-                ((op =::nat => nat => bool)
-                  ((size::'a::type list => nat) l1)
-                  ((size::'b::type list => nat) l2))
-                ((op =::bool => bool => bool)
-                  ((op mem::'a::type * 'b::type
-                            => ('a::type * 'b::type) list => bool)
-                    p ((zip::'a::type list
-                             => 'b::type list => ('a::type * 'b::type) list)
-                        l1 l2))
-                  ((Ex::(nat => bool) => bool)
-                    (%n::nat.
-                        (op &::bool => bool => bool)
-                         ((op <::nat => nat => bool) n
-                           ((size::'a::type list => nat) l1))
-                         ((op =::'a::type * 'b::type
-                                 => 'a::type * 'b::type => bool)
-                           p ((Pair::'a::type
-                                     => 'b::type => 'a::type * 'b::type)
-                               ((EL::nat => 'a::type list => 'a::type) n l1)
-                               ((EL::nat => 'b::type list => 'b::type) n
-                                 l2)))))))))"
-  by (import list MEM_ZIP)
-
-lemma EL_ZIP: "ALL (l1::'a::type list) (l2::'b::type list) n::nat.
-   length l1 = length l2 & n < length l1 -->
-   EL n (zip l1 l2) = (EL n l1, EL n l2)"
-  by (import list EL_ZIP)
-
-lemma MAP2_ZIP: "(All::('a::type list => bool) => bool)
- (%l1::'a::type list.
-     (All::('b::type list => bool) => bool)
-      (%l2::'b::type list.
-          (op -->::bool => bool => bool)
-           ((op =::nat => nat => bool) ((size::'a::type list => nat) l1)
-             ((size::'b::type list => nat) l2))
-           ((All::(('a::type => 'b::type => 'c::type) => bool) => bool)
-             (%f::'a::type => 'b::type => 'c::type.
-                 (op =::'c::type list => 'c::type list => bool)
-                  ((map2::('a::type => 'b::type => 'c::type)
-                          => 'a::type list
-                             => 'b::type list => 'c::type list)
-                    f l1 l2)
-                  ((map::('a::type * 'b::type => 'c::type)
-                         => ('a::type * 'b::type) list => 'c::type list)
-                    ((split::('a::type => 'b::type => 'c::type)
-                             => 'a::type * 'b::type => 'c::type)
-                      f)
-                    ((zip::'a::type list
-                           => 'b::type list => ('a::type * 'b::type) list)
-                      l1 l2))))))"
-  by (import list MAP2_ZIP)
-
-lemma MEM_EL: "(All::('a::type list => bool) => bool)
- (%l::'a::type list.
-     (All::('a::type => bool) => bool)
-      (%x::'a::type.
-          (op =::bool => bool => bool)
-           ((op mem::'a::type => 'a::type list => bool) x l)
-           ((Ex::(nat => bool) => bool)
-             (%n::nat.
-                 (op &::bool => bool => bool)
-                  ((op <::nat => nat => bool) n
-                    ((size::'a::type list => nat) l))
-                  ((op =::'a::type => 'a::type => bool) x
-                    ((EL::nat => 'a::type list => 'a::type) n l))))))"
-  by (import list MEM_EL)
-
-lemma LAST_CONS: "(ALL x::'a::type. last [x] = x) &
-(ALL (x::'a::type) (xa::'a::type) xb::'a::type list.
-    last (x # xa # xb) = last (xa # xb))"
-  by (import list LAST_CONS)
-
-lemma FRONT_CONS: "(ALL x::'a::type. butlast [x] = []) &
-(ALL (x::'a::type) (xa::'a::type) xb::'a::type list.
+  sorry
+
+lemma EL_compute: "EL n l = (if n = 0 then hd l else EL (PRE n) (tl l))"
+  sorry
+
+lemma WF_LIST_PRED: "WF (%L1 L2. EX h. L2 = h # L1)"
+  sorry
+
+lemma list_size_cong: "M = N & (ALL x. List.member N x --> f x = f' x)
+==> HOL4Compat.list_size f M = HOL4Compat.list_size f' N"
+  sorry
+
+lemma FOLDR_CONG: "l = l' & b = b' & (ALL x a. List.member l' x --> f x a = f' x a)
+==> foldr f l b = foldr f' l' b'"
+  sorry
+
+lemma FOLDL_CONG: "l = l' & b = b' & (ALL x a. List.member l' x --> f a x = f' a x)
+==> foldl f b l = foldl f' b' l'"
+  sorry
+
+lemma MAP_CONG: "l1 = l2 & (ALL x. List.member l2 x --> f x = f' x) ==> map f l1 = map f' l2"
+  sorry
+
+lemma EXISTS_CONG: "l1 = l2 & (ALL x. List.member l2 x --> P x = P' x)
+==> list_ex P l1 = list_ex P' l2"
+  sorry
+
+lemma EVERY_CONG: "l1 = l2 & (ALL x. List.member l2 x --> P x = P' x)
+==> list_all P l1 = list_all P' l2"
+  sorry
+
+lemma EVERY_MONOTONIC: "[| !!x. P x ==> Q x; list_all P l |] ==> list_all Q l"
+  sorry
+
+lemma LENGTH_ZIP: "length l1 = length l2
+==> length (zip l1 l2) = length l1 & length (zip l1 l2) = length l2"
+  sorry
+
+lemma LENGTH_UNZIP: "length (fst (unzip pl)) = length pl & length (snd (unzip pl)) = length pl"
+  sorry
+
+lemma ZIP_UNZIP: "ZIP (unzip l) = l"
+  sorry
+
+lemma UNZIP_ZIP: "length l1 = length l2 ==> unzip (zip l1 l2) = (l1, l2)"
+  sorry
+
+lemma ZIP_MAP: "length l1 = length l2
+==> zip (map f1 l1) l2 = map (%p. (f1 (fst p), snd p)) (zip l1 l2) &
+    zip l1 (map f2 l2) = map (%p. (fst p, f2 (snd p))) (zip l1 l2)"
+  sorry
+
+lemma MEM_ZIP: "length l1 = length l2
+==> List.member (zip l1 l2) p = (EX n<length l1. p = (EL n l1, EL n l2))"
+  sorry
+
+lemma EL_ZIP: "length l1 = length l2 & n < length l1
+==> EL n (zip l1 l2) = (EL n l1, EL n l2)"
+  sorry
+
+lemma MAP2_ZIP: "length l1 = length l2 ==> map2 f l1 l2 = map (%(x, y). f x y) (zip l1 l2)"
+  sorry
+
+lemma MEM_EL: "List.member l x = (EX n<length l. x = EL n l)"
+  sorry
+
+lemma LAST_CONS: "(ALL x::'a. last [x] = x) &
+(ALL (x::'a) (xa::'a) xb::'a list. last (x # xa # xb) = last (xa # xb))"
+  sorry
+
+lemma FRONT_CONS: "(ALL x::'a. butlast [x] = []) &
+(ALL (x::'a) (xa::'a) xb::'a list.
     butlast (x # xa # xb) = x # butlast (xa # xb))"
-  by (import list FRONT_CONS)
+  sorry
 
 ;end_setup
 
 ;setup_theory pred_set
 
-lemma EXTENSION: "ALL (s::'a::type => bool) t::'a::type => bool.
-   (s = t) = (ALL x::'a::type. IN x s = IN x t)"
-  by (import pred_set EXTENSION)
-
-lemma NOT_EQUAL_SETS: "ALL (x::'a::type => bool) xa::'a::type => bool.
-   (x ~= xa) = (EX xb::'a::type. IN xb xa = (~ IN xb x))"
-  by (import pred_set NOT_EQUAL_SETS)
-
-lemma NUM_SET_WOP: "ALL s::nat => bool.
-   (EX n::nat. IN n s) =
-   (EX n::nat. IN n s & (ALL m::nat. IN m s --> n <= m))"
-  by (import pred_set NUM_SET_WOP)
+lemma EXTENSION: "(s = t) = (ALL x. IN x s = IN x t)"
+  sorry
+
+lemma NOT_EQUAL_SETS: "(x ~= xa) = (EX xb. IN xb xa = (~ IN xb x))"
+  sorry
+
+lemma NUM_SET_WOP: "(EX n::nat. IN n (s::nat => bool)) =
+(EX n::nat. IN n s & (ALL m::nat. IN m s --> n <= m))"
+  sorry
 
 consts
   GSPEC :: "('b => 'a * bool) => 'a => bool" 
 
-specification (GSPEC) GSPECIFICATION: "ALL (f::'b::type => 'a::type * bool) v::'a::type.
-   IN v (GSPEC f) = (EX x::'b::type. (v, True) = f x)"
-  by (import pred_set GSPECIFICATION)
-
-lemma SET_MINIMUM: "ALL (s::'a::type => bool) M::'a::type => nat.
-   (EX x::'a::type. IN x s) =
-   (EX x::'a::type. IN x s & (ALL y::'a::type. IN y s --> M x <= M y))"
-  by (import pred_set SET_MINIMUM)
-
-definition EMPTY :: "'a => bool" where 
-  "EMPTY == %x::'a::type. False"
-
-lemma EMPTY_DEF: "EMPTY = (%x::'a::type. False)"
-  by (import pred_set EMPTY_DEF)
-
-lemma NOT_IN_EMPTY: "ALL x::'a::type. ~ IN x EMPTY"
-  by (import pred_set NOT_IN_EMPTY)
-
-lemma MEMBER_NOT_EMPTY: "ALL x::'a::type => bool. (EX xa::'a::type. IN xa x) = (x ~= EMPTY)"
-  by (import pred_set MEMBER_NOT_EMPTY)
-
-consts
-  UNIV :: "'a => bool" 
-
-defs
-  UNIV_def: "pred_set.UNIV == %x::'a::type. True"
-
-lemma UNIV_DEF: "pred_set.UNIV = (%x::'a::type. True)"
-  by (import pred_set UNIV_DEF)
-
-lemma IN_UNIV: "ALL x::'a::type. IN x pred_set.UNIV"
-  by (import pred_set IN_UNIV)
+specification (GSPEC) GSPECIFICATION: "ALL (f::'b => 'a * bool) v::'a. IN v (GSPEC f) = (EX x::'b. (v, True) = f x)"
+  sorry
+
+lemma SET_MINIMUM: "(EX x::'a. IN x (s::'a => bool)) =
+(EX x::'a. IN x s & (ALL y::'a. IN y s --> (M::'a => nat) x <= M y))"
+  sorry
+
+definition
+  EMPTY :: "'a => bool"  where
+  "EMPTY == %x. False"
+
+lemma EMPTY_DEF: "EMPTY = (%x. False)"
+  sorry
+
+lemma NOT_IN_EMPTY: "~ IN x EMPTY"
+  sorry
+
+lemma MEMBER_NOT_EMPTY: "(EX xa. IN xa x) = (x ~= EMPTY)"
+  sorry
+
+definition
+  UNIV :: "'a => bool"  where
+  "UNIV == %x. True"
+
+lemma UNIV_DEF: "pred_set.UNIV = (%x. True)"
+  sorry
+
+lemma IN_UNIV: "IN x pred_set.UNIV"
+  sorry
 
 lemma UNIV_NOT_EMPTY: "pred_set.UNIV ~= EMPTY"
-  by (import pred_set UNIV_NOT_EMPTY)
+  sorry
 
 lemma EMPTY_NOT_UNIV: "EMPTY ~= pred_set.UNIV"
-  by (import pred_set EMPTY_NOT_UNIV)
-
-lemma EQ_UNIV: "(ALL x::'a::type. IN x (s::'a::type => bool)) = (s = pred_set.UNIV)"
-  by (import pred_set EQ_UNIV)
-
-definition SUBSET :: "('a => bool) => ('a => bool) => bool" where 
-  "SUBSET ==
-%(s::'a::type => bool) t::'a::type => bool.
-   ALL x::'a::type. IN x s --> IN x t"
-
-lemma SUBSET_DEF: "ALL (s::'a::type => bool) t::'a::type => bool.
-   SUBSET s t = (ALL x::'a::type. IN x s --> IN x t)"
-  by (import pred_set SUBSET_DEF)
-
-lemma SUBSET_TRANS: "ALL (x::'a::type => bool) (xa::'a::type => bool) xb::'a::type => bool.
-   SUBSET x xa & SUBSET xa xb --> SUBSET x xb"
-  by (import pred_set SUBSET_TRANS)
-
-lemma SUBSET_REFL: "ALL x::'a::type => bool. SUBSET x x"
-  by (import pred_set SUBSET_REFL)
-
-lemma SUBSET_ANTISYM: "ALL (x::'a::type => bool) xa::'a::type => bool.
-   SUBSET x xa & SUBSET xa x --> x = xa"
-  by (import pred_set SUBSET_ANTISYM)
-
-lemma EMPTY_SUBSET: "All (SUBSET EMPTY)"
-  by (import pred_set EMPTY_SUBSET)
-
-lemma SUBSET_EMPTY: "ALL x::'a::type => bool. SUBSET x EMPTY = (x = EMPTY)"
-  by (import pred_set SUBSET_EMPTY)
-
-lemma SUBSET_UNIV: "ALL x::'a::type => bool. SUBSET x pred_set.UNIV"
-  by (import pred_set SUBSET_UNIV)
-
-lemma UNIV_SUBSET: "ALL x::'a::type => bool. SUBSET pred_set.UNIV x = (x = pred_set.UNIV)"
-  by (import pred_set UNIV_SUBSET)
-
-definition PSUBSET :: "('a => bool) => ('a => bool) => bool" where 
-  "PSUBSET == %(s::'a::type => bool) t::'a::type => bool. SUBSET s t & s ~= t"
-
-lemma PSUBSET_DEF: "ALL (s::'a::type => bool) t::'a::type => bool.
-   PSUBSET s t = (SUBSET s t & s ~= t)"
-  by (import pred_set PSUBSET_DEF)
-
-lemma PSUBSET_TRANS: "ALL (x::'a::type => bool) (xa::'a::type => bool) xb::'a::type => bool.
-   PSUBSET x xa & PSUBSET xa xb --> PSUBSET x xb"
-  by (import pred_set PSUBSET_TRANS)
-
-lemma PSUBSET_IRREFL: "ALL x::'a::type => bool. ~ PSUBSET x x"
-  by (import pred_set PSUBSET_IRREFL)
-
-lemma NOT_PSUBSET_EMPTY: "ALL x::'a::type => bool. ~ PSUBSET x EMPTY"
-  by (import pred_set NOT_PSUBSET_EMPTY)
-
-lemma NOT_UNIV_PSUBSET: "ALL x::'a::type => bool. ~ PSUBSET pred_set.UNIV x"
-  by (import pred_set NOT_UNIV_PSUBSET)
-
-lemma PSUBSET_UNIV: "ALL x::'a::type => bool.
-   PSUBSET x pred_set.UNIV = (EX xa::'a::type. ~ IN xa x)"
-  by (import pred_set PSUBSET_UNIV)
-
-consts
-  UNION :: "('a => bool) => ('a => bool) => 'a => bool" 
-
-defs
-  UNION_def: "pred_set.UNION ==
-%(s::'a::type => bool) t::'a::type => bool.
-   GSPEC (%x::'a::type. (x, IN x s | IN x t))"
-
-lemma UNION_DEF: "ALL (s::'a::type => bool) t::'a::type => bool.
-   pred_set.UNION s t = GSPEC (%x::'a::type. (x, IN x s | IN x t))"
-  by (import pred_set UNION_DEF)
-
-lemma IN_UNION: "ALL (x::'a::type => bool) (xa::'a::type => bool) xb::'a::type.
-   IN xb (pred_set.UNION x xa) = (IN xb x | IN xb xa)"
-  by (import pred_set IN_UNION)
-
-lemma UNION_ASSOC: "ALL (x::'a::type => bool) (xa::'a::type => bool) xb::'a::type => bool.
-   pred_set.UNION x (pred_set.UNION xa xb) =
-   pred_set.UNION (pred_set.UNION x xa) xb"
-  by (import pred_set UNION_ASSOC)
-
-lemma UNION_IDEMPOT: "ALL x::'a::type => bool. pred_set.UNION x x = x"
-  by (import pred_set UNION_IDEMPOT)
-
-lemma UNION_COMM: "ALL (x::'a::type => bool) xa::'a::type => bool.
-   pred_set.UNION x xa = pred_set.UNION xa x"
-  by (import pred_set UNION_COMM)
-
-lemma SUBSET_UNION: "(ALL (x::'a::type => bool) xa::'a::type => bool.
-    SUBSET x (pred_set.UNION x xa)) &
-(ALL (x::'a::type => bool) xa::'a::type => bool.
-    SUBSET x (pred_set.UNION xa x))"
-  by (import pred_set SUBSET_UNION)
-
-lemma UNION_SUBSET: "ALL (s::'a::type => bool) (t::'a::type => bool) u::'a::type => bool.
-   SUBSET (pred_set.UNION s t) u = (SUBSET s u & SUBSET t u)"
-  by (import pred_set UNION_SUBSET)
-
-lemma SUBSET_UNION_ABSORPTION: "ALL (x::'a::type => bool) xa::'a::type => bool.
-   SUBSET x xa = (pred_set.UNION x xa = xa)"
-  by (import pred_set SUBSET_UNION_ABSORPTION)
-
-lemma UNION_EMPTY: "(ALL x::'a::type => bool. pred_set.UNION EMPTY x = x) &
-(ALL x::'a::type => bool. pred_set.UNION x EMPTY = x)"
-  by (import pred_set UNION_EMPTY)
-
-lemma UNION_UNIV: "(ALL x::'a::type => bool. pred_set.UNION pred_set.UNIV x = pred_set.UNIV) &
-(ALL x::'a::type => bool. pred_set.UNION x pred_set.UNIV = pred_set.UNIV)"
-  by (import pred_set UNION_UNIV)
-
-lemma EMPTY_UNION: "ALL (x::'a::type => bool) xa::'a::type => bool.
-   (pred_set.UNION x xa = EMPTY) = (x = EMPTY & xa = EMPTY)"
-  by (import pred_set EMPTY_UNION)
-
-consts
-  INTER :: "('a => bool) => ('a => bool) => 'a => bool" 
-
-defs
-  INTER_def: "pred_set.INTER ==
-%(s::'a::type => bool) t::'a::type => bool.
-   GSPEC (%x::'a::type. (x, IN x s & IN x t))"
-
-lemma INTER_DEF: "ALL (s::'a::type => bool) t::'a::type => bool.
-   pred_set.INTER s t = GSPEC (%x::'a::type. (x, IN x s & IN x t))"
-  by (import pred_set INTER_DEF)
-
-lemma IN_INTER: "ALL (x::'a::type => bool) (xa::'a::type => bool) xb::'a::type.
-   IN xb (pred_set.INTER x xa) = (IN xb x & IN xb xa)"
-  by (import pred_set IN_INTER)
-
-lemma INTER_ASSOC: "ALL (x::'a::type => bool) (xa::'a::type => bool) xb::'a::type => bool.
-   pred_set.INTER x (pred_set.INTER xa xb) =
-   pred_set.INTER (pred_set.INTER x xa) xb"
-  by (import pred_set INTER_ASSOC)
-
-lemma INTER_IDEMPOT: "ALL x::'a::type => bool. pred_set.INTER x x = x"
-  by (import pred_set INTER_IDEMPOT)
-
-lemma INTER_COMM: "ALL (x::'a::type => bool) xa::'a::type => bool.
-   pred_set.INTER x xa = pred_set.INTER xa x"
-  by (import pred_set INTER_COMM)
-
-lemma INTER_SUBSET: "(ALL (x::'a::type => bool) xa::'a::type => bool.
-    SUBSET (pred_set.INTER x xa) x) &
-(ALL (x::'a::type => bool) xa::'a::type => bool.
-    SUBSET (pred_set.INTER xa x) x)"
-  by (import pred_set INTER_SUBSET)
-
-lemma SUBSET_INTER: "ALL (s::'a::type => bool) (t::'a::type => bool) u::'a::type => bool.
-   SUBSET s (pred_set.INTER t u) = (SUBSET s t & SUBSET s u)"
-  by (import pred_set SUBSET_INTER)
-
-lemma SUBSET_INTER_ABSORPTION: "ALL (x::'a::type => bool) xa::'a::type => bool.
-   SUBSET x xa = (pred_set.INTER x xa = x)"
-  by (import pred_set SUBSET_INTER_ABSORPTION)
-
-lemma INTER_EMPTY: "(ALL x::'a::type => bool. pred_set.INTER EMPTY x = EMPTY) &
-(ALL x::'a::type => bool. pred_set.INTER x EMPTY = EMPTY)"
-  by (import pred_set INTER_EMPTY)
-
-lemma INTER_UNIV: "(ALL x::'a::type => bool. pred_set.INTER pred_set.UNIV x = x) &
-(ALL x::'a::type => bool. pred_set.INTER x pred_set.UNIV = x)"
-  by (import pred_set INTER_UNIV)
-
-lemma UNION_OVER_INTER: "ALL (x::'a::type => bool) (xa::'a::type => bool) xb::'a::type => bool.
-   pred_set.INTER x (pred_set.UNION xa xb) =
-   pred_set.UNION (pred_set.INTER x xa) (pred_set.INTER x xb)"
-  by (import pred_set UNION_OVER_INTER)
-
-lemma INTER_OVER_UNION: "ALL (x::'a::type => bool) (xa::'a::type => bool) xb::'a::type => bool.
-   pred_set.UNION x (pred_set.INTER xa xb) =
-   pred_set.INTER (pred_set.UNION x xa) (pred_set.UNION x xb)"
-  by (import pred_set INTER_OVER_UNION)
-
-definition DISJOINT :: "('a => bool) => ('a => bool) => bool" where 
-  "DISJOINT ==
-%(s::'a::type => bool) t::'a::type => bool. pred_set.INTER s t = EMPTY"
-
-lemma DISJOINT_DEF: "ALL (s::'a::type => bool) t::'a::type => bool.
-   DISJOINT s t = (pred_set.INTER s t = EMPTY)"
-  by (import pred_set DISJOINT_DEF)
-
-lemma IN_DISJOINT: "ALL (x::'a::type => bool) xa::'a::type => bool.
-   DISJOINT x xa = (~ (EX xb::'a::type. IN xb x & IN xb xa))"
-  by (import pred_set IN_DISJOINT)
-
-lemma DISJOINT_SYM: "ALL (x::'a::type => bool) xa::'a::type => bool.
-   DISJOINT x xa = DISJOINT xa x"
-  by (import pred_set DISJOINT_SYM)
-
-lemma DISJOINT_EMPTY: "ALL x::'a::type => bool. DISJOINT EMPTY x & DISJOINT x EMPTY"
-  by (import pred_set DISJOINT_EMPTY)
-
-lemma DISJOINT_EMPTY_REFL: "ALL x::'a::type => bool. (x = EMPTY) = DISJOINT x x"
-  by (import pred_set DISJOINT_EMPTY_REFL)
-
-lemma DISJOINT_UNION: "ALL (x::'a::type => bool) (xa::'a::type => bool) xb::'a::type => bool.
-   DISJOINT (pred_set.UNION x xa) xb = (DISJOINT x xb & DISJOINT xa xb)"
-  by (import pred_set DISJOINT_UNION)
-
-lemma DISJOINT_UNION_BOTH: "ALL (s::'a::type => bool) (t::'a::type => bool) u::'a::type => bool.
-   DISJOINT (pred_set.UNION s t) u = (DISJOINT s u & DISJOINT t u) &
-   DISJOINT u (pred_set.UNION s t) = (DISJOINT s u & DISJOINT t u)"
-  by (import pred_set DISJOINT_UNION_BOTH)
-
-definition DIFF :: "('a => bool) => ('a => bool) => 'a => bool" where 
-  "DIFF ==
-%(s::'a::type => bool) t::'a::type => bool.
-   GSPEC (%x::'a::type. (x, IN x s & ~ IN x t))"
-
-lemma DIFF_DEF: "ALL (s::'a::type => bool) t::'a::type => bool.
-   DIFF s t = GSPEC (%x::'a::type. (x, IN x s & ~ IN x t))"
-  by (import pred_set DIFF_DEF)
-
-lemma IN_DIFF: "ALL (s::'a::type => bool) (t::'a::type => bool) x::'a::type.
-   IN x (DIFF s t) = (IN x s & ~ IN x t)"
-  by (import pred_set IN_DIFF)
-
-lemma DIFF_EMPTY: "ALL s::'a::type => bool. DIFF s EMPTY = s"
-  by (import pred_set DIFF_EMPTY)
-
-lemma EMPTY_DIFF: "ALL s::'a::type => bool. DIFF EMPTY s = EMPTY"
-  by (import pred_set EMPTY_DIFF)
-
-lemma DIFF_UNIV: "ALL s::'a::type => bool. DIFF s pred_set.UNIV = EMPTY"
-  by (import pred_set DIFF_UNIV)
-
-lemma DIFF_DIFF: "ALL (x::'a::type => bool) xa::'a::type => bool.
-   DIFF (DIFF x xa) xa = DIFF x xa"
-  by (import pred_set DIFF_DIFF)
-
-lemma DIFF_EQ_EMPTY: "ALL x::'a::type => bool. DIFF x x = EMPTY"
-  by (import pred_set DIFF_EQ_EMPTY)
-
-definition INSERT :: "'a => ('a => bool) => 'a => bool" where 
-  "INSERT ==
-%(x::'a::type) s::'a::type => bool.
-   GSPEC (%y::'a::type. (y, y = x | IN y s))"
-
-lemma INSERT_DEF: "ALL (x::'a::type) s::'a::type => bool.
-   INSERT x s = GSPEC (%y::'a::type. (y, y = x | IN y s))"
-  by (import pred_set INSERT_DEF)
-
-lemma IN_INSERT: "ALL (x::'a::type) (xa::'a::type) xb::'a::type => bool.
-   IN x (INSERT xa xb) = (x = xa | IN x xb)"
-  by (import pred_set IN_INSERT)
-
-lemma COMPONENT: "ALL (x::'a::type) xa::'a::type => bool. IN x (INSERT x xa)"
-  by (import pred_set COMPONENT)
-
-lemma SET_CASES: "ALL x::'a::type => bool.
-   x = EMPTY |
-   (EX (xa::'a::type) xb::'a::type => bool. x = INSERT xa xb & ~ IN xa xb)"
-  by (import pred_set SET_CASES)
-
-lemma DECOMPOSITION: "ALL (s::'a::type => bool) x::'a::type.
-   IN x s = (EX t::'a::type => bool. s = INSERT x t & ~ IN x t)"
-  by (import pred_set DECOMPOSITION)
-
-lemma ABSORPTION: "ALL (x::'a::type) xa::'a::type => bool. IN x xa = (INSERT x xa = xa)"
-  by (import pred_set ABSORPTION)
-
-lemma INSERT_INSERT: "ALL (x::'a::type) xa::'a::type => bool. INSERT x (INSERT x xa) = INSERT x xa"
-  by (import pred_set INSERT_INSERT)
-
-lemma INSERT_COMM: "ALL (x::'a::type) (xa::'a::type) xb::'a::type => bool.
-   INSERT x (INSERT xa xb) = INSERT xa (INSERT x xb)"
-  by (import pred_set INSERT_COMM)
-
-lemma INSERT_UNIV: "ALL x::'a::type. INSERT x pred_set.UNIV = pred_set.UNIV"
-  by (import pred_set INSERT_UNIV)
-
-lemma NOT_INSERT_EMPTY: "ALL (x::'a::type) xa::'a::type => bool. INSERT x xa ~= EMPTY"
-  by (import pred_set NOT_INSERT_EMPTY)
-
-lemma NOT_EMPTY_INSERT: "ALL (x::'a::type) xa::'a::type => bool. EMPTY ~= INSERT x xa"
-  by (import pred_set NOT_EMPTY_INSERT)
-
-lemma INSERT_UNION: "ALL (x::'a::type) (s::'a::type => bool) t::'a::type => bool.
-   pred_set.UNION (INSERT x s) t =
-   (if IN x t then pred_set.UNION s t else INSERT x (pred_set.UNION s t))"
-  by (import pred_set INSERT_UNION)
-
-lemma INSERT_UNION_EQ: "ALL (x::'a::type) (s::'a::type => bool) t::'a::type => bool.
-   pred_set.UNION (INSERT x s) t = INSERT x (pred_set.UNION s t)"
-  by (import pred_set INSERT_UNION_EQ)
-
-lemma INSERT_INTER: "ALL (x::'a::type) (s::'a::type => bool) t::'a::type => bool.
-   pred_set.INTER (INSERT x s) t =
-   (if IN x t then INSERT x (pred_set.INTER s t) else pred_set.INTER s t)"
-  by (import pred_set INSERT_INTER)
-
-lemma DISJOINT_INSERT: "ALL (x::'a::type) (xa::'a::type => bool) xb::'a::type => bool.
-   DISJOINT (INSERT x xa) xb = (DISJOINT xa xb & ~ IN x xb)"
-  by (import pred_set DISJOINT_INSERT)
-
-lemma INSERT_SUBSET: "ALL (x::'a::type) (xa::'a::type => bool) xb::'a::type => bool.
-   SUBSET (INSERT x xa) xb = (IN x xb & SUBSET xa xb)"
-  by (import pred_set INSERT_SUBSET)
-
-lemma SUBSET_INSERT: "ALL (x::'a::type) xa::'a::type => bool.
-   ~ IN x xa -->
-   (ALL xb::'a::type => bool. SUBSET xa (INSERT x xb) = SUBSET xa xb)"
-  by (import pred_set SUBSET_INSERT)
-
-lemma INSERT_DIFF: "ALL (s::'a::type => bool) (t::'a::type => bool) x::'a::type.
-   DIFF (INSERT x s) t = (if IN x t then DIFF s t else INSERT x (DIFF s t))"
-  by (import pred_set INSERT_DIFF)
-
-definition DELETE :: "('a => bool) => 'a => 'a => bool" where 
-  "DELETE == %(s::'a::type => bool) x::'a::type. DIFF s (INSERT x EMPTY)"
-
-lemma DELETE_DEF: "ALL (s::'a::type => bool) x::'a::type. DELETE s x = DIFF s (INSERT x EMPTY)"
-  by (import pred_set DELETE_DEF)
-
-lemma IN_DELETE: "ALL (x::'a::type => bool) (xa::'a::type) xb::'a::type.
-   IN xa (DELETE x xb) = (IN xa x & xa ~= xb)"
-  by (import pred_set IN_DELETE)
-
-lemma DELETE_NON_ELEMENT: "ALL (x::'a::type) xa::'a::type => bool. (~ IN x xa) = (DELETE xa x = xa)"
-  by (import pred_set DELETE_NON_ELEMENT)
-
-lemma IN_DELETE_EQ: "ALL (s::'a::type => bool) (x::'a::type) x'::'a::type.
-   (IN x s = IN x' s) = (IN x (DELETE s x') = IN x' (DELETE s x))"
-  by (import pred_set IN_DELETE_EQ)
-
-lemma EMPTY_DELETE: "ALL x::'a::type. DELETE EMPTY x = EMPTY"
-  by (import pred_set EMPTY_DELETE)
-
-lemma DELETE_DELETE: "ALL (x::'a::type) xa::'a::type => bool. DELETE (DELETE xa x) x = DELETE xa x"
-  by (import pred_set DELETE_DELETE)
-
-lemma DELETE_COMM: "ALL (x::'a::type) (xa::'a::type) xb::'a::type => bool.
-   DELETE (DELETE xb x) xa = DELETE (DELETE xb xa) x"
-  by (import pred_set DELETE_COMM)
-
-lemma DELETE_SUBSET: "ALL (x::'a::type) xa::'a::type => bool. SUBSET (DELETE xa x) xa"
-  by (import pred_set DELETE_SUBSET)
-
-lemma SUBSET_DELETE: "ALL (x::'a::type) (xa::'a::type => bool) xb::'a::type => bool.
-   SUBSET xa (DELETE xb x) = (~ IN x xa & SUBSET xa xb)"
-  by (import pred_set SUBSET_DELETE)
-
-lemma SUBSET_INSERT_DELETE: "ALL (x::'a::type) (s::'a::type => bool) t::'a::type => bool.
-   SUBSET s (INSERT x t) = SUBSET (DELETE s x) t"
-  by (import pred_set SUBSET_INSERT_DELETE)
-
-lemma DIFF_INSERT: "ALL (x::'a::type => bool) (xa::'a::type => bool) xb::'a::type.
-   DIFF x (INSERT xb xa) = DIFF (DELETE x xb) xa"
-  by (import pred_set DIFF_INSERT)
-
-lemma PSUBSET_INSERT_SUBSET: "ALL (x::'a::type => bool) xa::'a::type => bool.
-   PSUBSET x xa = (EX xb::'a::type. ~ IN xb x & SUBSET (INSERT xb x) xa)"
-  by (import pred_set PSUBSET_INSERT_SUBSET)
-
-lemma PSUBSET_MEMBER: "ALL (s::'a::type => bool) t::'a::type => bool.
-   PSUBSET s t = (SUBSET s t & (EX y::'a::type. IN y t & ~ IN y s))"
-  by (import pred_set PSUBSET_MEMBER)
-
-lemma DELETE_INSERT: "ALL (x::'a::type) (xa::'a::type) xb::'a::type => bool.
-   DELETE (INSERT x xb) xa =
-   (if x = xa then DELETE xb xa else INSERT x (DELETE xb xa))"
-  by (import pred_set DELETE_INSERT)
-
-lemma INSERT_DELETE: "ALL (x::'a::type) xa::'a::type => bool.
-   IN x xa --> INSERT x (DELETE xa x) = xa"
-  by (import pred_set INSERT_DELETE)
-
-lemma DELETE_INTER: "ALL (x::'a::type => bool) (xa::'a::type => bool) xb::'a::type.
-   pred_set.INTER (DELETE x xb) xa = DELETE (pred_set.INTER x xa) xb"
-  by (import pred_set DELETE_INTER)
-
-lemma DISJOINT_DELETE_SYM: "ALL (x::'a::type => bool) (xa::'a::type => bool) xb::'a::type.
-   DISJOINT (DELETE x xb) xa = DISJOINT (DELETE xa xb) x"
-  by (import pred_set DISJOINT_DELETE_SYM)
+  sorry
+
+lemma EQ_UNIV: "(ALL x. IN x s) = (s = pred_set.UNIV)"
+  sorry
+
+definition
+  SUBSET :: "('a => bool) => ('a => bool) => bool"  where
+  "SUBSET == %s t. ALL x. IN x s --> IN x t"
+
+lemma SUBSET_DEF: "SUBSET s t = (ALL x. IN x s --> IN x t)"
+  sorry
+
+lemma SUBSET_TRANS: "SUBSET x xa & SUBSET xa xb ==> SUBSET x xb"
+  sorry
+
+lemma SUBSET_REFL: "SUBSET x x"
+  sorry
+
+lemma SUBSET_ANTISYM: "SUBSET x xa & SUBSET xa x ==> x = xa"
+  sorry
+
+lemma EMPTY_SUBSET: "SUBSET EMPTY x"
+  sorry
+
+lemma SUBSET_EMPTY: "SUBSET x EMPTY = (x = EMPTY)"
+  sorry
+
+lemma SUBSET_UNIV: "SUBSET x pred_set.UNIV"
+  sorry
+
+lemma UNIV_SUBSET: "SUBSET pred_set.UNIV x = (x = pred_set.UNIV)"
+  sorry
+
+definition
+  PSUBSET :: "('a => bool) => ('a => bool) => bool"  where
+  "PSUBSET == %s t. SUBSET s t & s ~= t"
+
+lemma PSUBSET_DEF: "PSUBSET s t = (SUBSET s t & s ~= t)"
+  sorry
+
+lemma PSUBSET_TRANS: "PSUBSET x xa & PSUBSET xa xb ==> PSUBSET x xb"
+  sorry
+
+lemma PSUBSET_IRREFL: "~ PSUBSET x x"
+  sorry
+
+lemma NOT_PSUBSET_EMPTY: "~ PSUBSET x EMPTY"
+  sorry
+
+lemma NOT_UNIV_PSUBSET: "~ PSUBSET pred_set.UNIV x"
+  sorry
+
+lemma PSUBSET_UNIV: "PSUBSET x pred_set.UNIV = (EX xa. ~ IN xa x)"
+  sorry
+
+definition
+  UNION :: "('a => bool) => ('a => bool) => 'a => bool"  where
+  "UNION == %s t. GSPEC (%x. (x, IN x s | IN x t))"
+
+lemma UNION_DEF: "pred_set.UNION s t = GSPEC (%x. (x, IN x s | IN x t))"
+  sorry
+
+lemma IN_UNION: "IN xb (pred_set.UNION x xa) = (IN xb x | IN xb xa)"
+  sorry
+
+lemma UNION_ASSOC: "pred_set.UNION x (pred_set.UNION xa xb) =
+pred_set.UNION (pred_set.UNION x xa) xb"
+  sorry
+
+lemma UNION_IDEMPOT: "pred_set.UNION x x = x"
+  sorry
+
+lemma UNION_COMM: "pred_set.UNION x xa = pred_set.UNION xa x"
+  sorry
+
+lemma SUBSET_UNION: "(ALL (x::'a => bool) xa::'a => bool. SUBSET x (pred_set.UNION x xa)) &
+(ALL (x::'a => bool) xa::'a => bool. SUBSET x (pred_set.UNION xa x))"
+  sorry
+
+lemma UNION_SUBSET: "SUBSET (pred_set.UNION s t) u = (SUBSET s u & SUBSET t u)"
+  sorry
+
+lemma SUBSET_UNION_ABSORPTION: "SUBSET x xa = (pred_set.UNION x xa = xa)"
+  sorry
+
+lemma UNION_EMPTY: "(ALL x::'a => bool. pred_set.UNION EMPTY x = x) &
+(ALL x::'a => bool. pred_set.UNION x EMPTY = x)"
+  sorry
+
+lemma UNION_UNIV: "(ALL x::'a => bool. pred_set.UNION pred_set.UNIV x = pred_set.UNIV) &
+(ALL x::'a => bool. pred_set.UNION x pred_set.UNIV = pred_set.UNIV)"
+  sorry
+
+lemma EMPTY_UNION: "(pred_set.UNION x xa = EMPTY) = (x = EMPTY & xa = EMPTY)"
+  sorry
+
+definition
+  INTER :: "('a => bool) => ('a => bool) => 'a => bool"  where
+  "INTER == %s t. GSPEC (%x. (x, IN x s & IN x t))"
+
+lemma INTER_DEF: "pred_set.INTER s t = GSPEC (%x. (x, IN x s & IN x t))"
+  sorry
+
+lemma IN_INTER: "IN xb (pred_set.INTER x xa) = (IN xb x & IN xb xa)"
+  sorry
+
+lemma INTER_ASSOC: "pred_set.INTER x (pred_set.INTER xa xb) =
+pred_set.INTER (pred_set.INTER x xa) xb"
+  sorry
+
+lemma INTER_IDEMPOT: "pred_set.INTER x x = x"
+  sorry
+
+lemma INTER_COMM: "pred_set.INTER x xa = pred_set.INTER xa x"
+  sorry
+
+lemma INTER_SUBSET: "(ALL (x::'a => bool) xa::'a => bool. SUBSET (pred_set.INTER x xa) x) &
+(ALL (x::'a => bool) xa::'a => bool. SUBSET (pred_set.INTER xa x) x)"
+  sorry
+
+lemma SUBSET_INTER: "SUBSET s (pred_set.INTER t u) = (SUBSET s t & SUBSET s u)"
+  sorry
+
+lemma SUBSET_INTER_ABSORPTION: "SUBSET x xa = (pred_set.INTER x xa = x)"
+  sorry
+
+lemma INTER_EMPTY: "(ALL x::'a => bool. pred_set.INTER EMPTY x = EMPTY) &
+(ALL x::'a => bool. pred_set.INTER x EMPTY = EMPTY)"
+  sorry
+
+lemma INTER_UNIV: "(ALL x::'a => bool. pred_set.INTER pred_set.UNIV x = x) &
+(ALL x::'a => bool. pred_set.INTER x pred_set.UNIV = x)"
+  sorry
+
+lemma UNION_OVER_INTER: "pred_set.INTER x (pred_set.UNION xa xb) =
+pred_set.UNION (pred_set.INTER x xa) (pred_set.INTER x xb)"
+  sorry
+
+lemma INTER_OVER_UNION: "pred_set.UNION x (pred_set.INTER xa xb) =
+pred_set.INTER (pred_set.UNION x xa) (pred_set.UNION x xb)"
+  sorry
+
+definition
+  DISJOINT :: "('a => bool) => ('a => bool) => bool"  where
+  "DISJOINT == %s t. pred_set.INTER s t = EMPTY"
+
+lemma DISJOINT_DEF: "DISJOINT s t = (pred_set.INTER s t = EMPTY)"
+  sorry
+
+lemma IN_DISJOINT: "DISJOINT x xa = (~ (EX xb. IN xb x & IN xb xa))"
+  sorry
+
+lemma DISJOINT_SYM: "DISJOINT x xa = DISJOINT xa x"
+  sorry
+
+lemma DISJOINT_EMPTY: "DISJOINT EMPTY x & DISJOINT x EMPTY"
+  sorry
+
+lemma DISJOINT_EMPTY_REFL: "(x = EMPTY) = DISJOINT x x"
+  sorry
+
+lemma DISJOINT_UNION: "DISJOINT (pred_set.UNION x xa) xb = (DISJOINT x xb & DISJOINT xa xb)"
+  sorry
+
+lemma DISJOINT_UNION_BOTH: "DISJOINT (pred_set.UNION s t) u = (DISJOINT s u & DISJOINT t u) &
+DISJOINT u (pred_set.UNION s t) = (DISJOINT s u & DISJOINT t u)"
+  sorry
+
+definition
+  DIFF :: "('a => bool) => ('a => bool) => 'a => bool"  where
+  "DIFF == %s t. GSPEC (%x. (x, IN x s & ~ IN x t))"
+
+lemma DIFF_DEF: "DIFF s t = GSPEC (%x. (x, IN x s & ~ IN x t))"
+  sorry
+
+lemma IN_DIFF: "IN x (DIFF s t) = (IN x s & ~ IN x t)"
+  sorry
+
+lemma DIFF_EMPTY: "DIFF s EMPTY = s"
+  sorry
+
+lemma EMPTY_DIFF: "DIFF EMPTY s = EMPTY"
+  sorry
+
+lemma DIFF_UNIV: "DIFF s pred_set.UNIV = EMPTY"
+  sorry
+
+lemma DIFF_DIFF: "DIFF (DIFF x xa) xa = DIFF x xa"
+  sorry
+
+lemma DIFF_EQ_EMPTY: "DIFF x x = EMPTY"
+  sorry
+
+definition
+  INSERT :: "'a => ('a => bool) => 'a => bool"  where
+  "INSERT == %x s. GSPEC (%y. (y, y = x | IN y s))"
+
+lemma INSERT_DEF: "INSERT x s = GSPEC (%y. (y, y = x | IN y s))"
+  sorry
+
+lemma IN_INSERT: "IN x (INSERT xa xb) = (x = xa | IN x xb)"
+  sorry
+
+lemma COMPONENT: "IN x (INSERT x xa)"
+  sorry
+
+lemma SET_CASES: "x = EMPTY | (EX xa xb. x = INSERT xa xb & ~ IN xa xb)"
+  sorry
+
+lemma DECOMPOSITION: "IN x s = (EX t. s = INSERT x t & ~ IN x t)"
+  sorry
+
+lemma ABSORPTION: "IN x xa = (INSERT x xa = xa)"
+  sorry
+
+lemma INSERT_INSERT: "INSERT x (INSERT x xa) = INSERT x xa"
+  sorry
+
+lemma INSERT_COMM: "INSERT x (INSERT xa xb) = INSERT xa (INSERT x xb)"
+  sorry
+
+lemma INSERT_UNIV: "INSERT x pred_set.UNIV = pred_set.UNIV"
+  sorry
+
+lemma NOT_INSERT_EMPTY: "INSERT x xa ~= EMPTY"
+  sorry
+
+lemma NOT_EMPTY_INSERT: "EMPTY ~= INSERT x xa"
+  sorry
+
+lemma INSERT_UNION: "pred_set.UNION (INSERT x s) t =
+(if IN x t then pred_set.UNION s t else INSERT x (pred_set.UNION s t))"
+  sorry
+
+lemma INSERT_UNION_EQ: "pred_set.UNION (INSERT x s) t = INSERT x (pred_set.UNION s t)"
+  sorry
+
+lemma INSERT_INTER: "pred_set.INTER (INSERT x s) t =
+(if IN x t then INSERT x (pred_set.INTER s t) else pred_set.INTER s t)"
+  sorry
+
+lemma DISJOINT_INSERT: "DISJOINT (INSERT x xa) xb = (DISJOINT xa xb & ~ IN x xb)"
+  sorry
+
+lemma INSERT_SUBSET: "SUBSET (INSERT x xa) xb = (IN x xb & SUBSET xa xb)"
+  sorry
+
+lemma SUBSET_INSERT: "~ IN x xa ==> SUBSET xa (INSERT x xb) = SUBSET xa xb"
+  sorry
+
+lemma INSERT_DIFF: "DIFF (INSERT x s) t = (if IN x t then DIFF s t else INSERT x (DIFF s t))"
+  sorry
+
+definition
+  DELETE :: "('a => bool) => 'a => 'a => bool"  where
+  "DELETE == %s x. DIFF s (INSERT x EMPTY)"
+
+lemma DELETE_DEF: "DELETE s x = DIFF s (INSERT x EMPTY)"
+  sorry
+
+lemma IN_DELETE: "IN xa (DELETE x xb) = (IN xa x & xa ~= xb)"
+  sorry
+
+lemma DELETE_NON_ELEMENT: "(~ IN x xa) = (DELETE xa x = xa)"
+  sorry
+
+lemma IN_DELETE_EQ: "(IN x s = IN x' s) = (IN x (DELETE s x') = IN x' (DELETE s x))"
+  sorry
+
+lemma EMPTY_DELETE: "DELETE EMPTY x = EMPTY"
+  sorry
+
+lemma DELETE_DELETE: "DELETE (DELETE xa x) x = DELETE xa x"
+  sorry
+
+lemma DELETE_COMM: "DELETE (DELETE xb x) xa = DELETE (DELETE xb xa) x"
+  sorry
+
+lemma DELETE_SUBSET: "SUBSET (DELETE xa x) xa"
+  sorry
+
+lemma SUBSET_DELETE: "SUBSET xa (DELETE xb x) = (~ IN x xa & SUBSET xa xb)"
+  sorry
+
+lemma SUBSET_INSERT_DELETE: "SUBSET s (INSERT x t) = SUBSET (DELETE s x) t"
+  sorry
+
+lemma DIFF_INSERT: "DIFF x (INSERT xb xa) = DIFF (DELETE x xb) xa"
+  sorry
+
+lemma PSUBSET_INSERT_SUBSET: "PSUBSET x xa = (EX xb. ~ IN xb x & SUBSET (INSERT xb x) xa)"
+  sorry
+
+lemma PSUBSET_MEMBER: "PSUBSET s t = (SUBSET s t & (EX y. IN y t & ~ IN y s))"
+  sorry
+
+lemma DELETE_INSERT: "DELETE (INSERT x xb) xa =
+(if x = xa then DELETE xb xa else INSERT x (DELETE xb xa))"
+  sorry
+
+lemma INSERT_DELETE: "IN x xa ==> INSERT x (DELETE xa x) = xa"
+  sorry
+
+lemma DELETE_INTER: "pred_set.INTER (DELETE x xb) xa = DELETE (pred_set.INTER x xa) xb"
+  sorry
+
+lemma DISJOINT_DELETE_SYM: "DISJOINT (DELETE x xb) xa = DISJOINT (DELETE xa xb) x"
+  sorry
 
 consts
   CHOICE :: "('a => bool) => 'a" 
 
-specification (CHOICE) CHOICE_DEF: "ALL x::'a::type => bool. x ~= EMPTY --> IN (CHOICE x) x"
-  by (import pred_set CHOICE_DEF)
-
-definition REST :: "('a => bool) => 'a => bool" where 
-  "REST == %s::'a::type => bool. DELETE s (CHOICE s)"
-
-lemma REST_DEF: "ALL s::'a::type => bool. REST s = DELETE s (CHOICE s)"
-  by (import pred_set REST_DEF)
-
-lemma CHOICE_NOT_IN_REST: "ALL x::'a::type => bool. ~ IN (CHOICE x) (REST x)"
-  by (import pred_set CHOICE_NOT_IN_REST)
-
-lemma CHOICE_INSERT_REST: "ALL s::'a::type => bool. s ~= EMPTY --> INSERT (CHOICE s) (REST s) = s"
-  by (import pred_set CHOICE_INSERT_REST)
-
-lemma REST_SUBSET: "ALL x::'a::type => bool. SUBSET (REST x) x"
-  by (import pred_set REST_SUBSET)
-
-lemma REST_PSUBSET: "ALL x::'a::type => bool. x ~= EMPTY --> PSUBSET (REST x) x"
-  by (import pred_set REST_PSUBSET)
-
-definition SING :: "('a => bool) => bool" where 
-  "SING == %s::'a::type => bool. EX x::'a::type. s = INSERT x EMPTY"
-
-lemma SING_DEF: "ALL s::'a::type => bool. SING s = (EX x::'a::type. s = INSERT x EMPTY)"
-  by (import pred_set SING_DEF)
-
-lemma SING: "ALL x::'a::type. SING (INSERT x EMPTY)"
-  by (import pred_set SING)
-
-lemma IN_SING: "ALL (x::'a::type) xa::'a::type. IN x (INSERT xa EMPTY) = (x = xa)"
-  by (import pred_set IN_SING)
-
-lemma NOT_SING_EMPTY: "ALL x::'a::type. INSERT x EMPTY ~= EMPTY"
-  by (import pred_set NOT_SING_EMPTY)
-
-lemma NOT_EMPTY_SING: "ALL x::'a::type. EMPTY ~= INSERT x EMPTY"
-  by (import pred_set NOT_EMPTY_SING)
-
-lemma EQUAL_SING: "ALL (x::'a::type) xa::'a::type.
-   (INSERT x EMPTY = INSERT xa EMPTY) = (x = xa)"
-  by (import pred_set EQUAL_SING)
-
-lemma DISJOINT_SING_EMPTY: "ALL x::'a::type. DISJOINT (INSERT x EMPTY) EMPTY"
-  by (import pred_set DISJOINT_SING_EMPTY)
-
-lemma INSERT_SING_UNION: "ALL (x::'a::type => bool) xa::'a::type.
-   INSERT xa x = pred_set.UNION (INSERT xa EMPTY) x"
-  by (import pred_set INSERT_SING_UNION)
-
-lemma SING_DELETE: "ALL x::'a::type. DELETE (INSERT x EMPTY) x = EMPTY"
-  by (import pred_set SING_DELETE)
-
-lemma DELETE_EQ_SING: "ALL (x::'a::type => bool) xa::'a::type.
-   IN xa x --> (DELETE x xa = EMPTY) = (x = INSERT xa EMPTY)"
-  by (import pred_set DELETE_EQ_SING)
-
-lemma CHOICE_SING: "ALL x::'a::type. CHOICE (INSERT x EMPTY) = x"
-  by (import pred_set CHOICE_SING)
-
-lemma REST_SING: "ALL x::'a::type. REST (INSERT x EMPTY) = EMPTY"
-  by (import pred_set REST_SING)
-
-lemma SING_IFF_EMPTY_REST: "ALL x::'a::type => bool. SING x = (x ~= EMPTY & REST x = EMPTY)"
-  by (import pred_set SING_IFF_EMPTY_REST)
-
-definition IMAGE :: "('a => 'b) => ('a => bool) => 'b => bool" where 
-  "IMAGE ==
-%(f::'a::type => 'b::type) s::'a::type => bool.
-   GSPEC (%x::'a::type. (f x, IN x s))"
-
-lemma IMAGE_DEF: "ALL (f::'a::type => 'b::type) s::'a::type => bool.
-   IMAGE f s = GSPEC (%x::'a::type. (f x, IN x s))"
-  by (import pred_set IMAGE_DEF)
-
-lemma IN_IMAGE: "ALL (x::'b::type) (xa::'a::type => bool) xb::'a::type => 'b::type.
-   IN x (IMAGE xb xa) = (EX xc::'a::type. x = xb xc & IN xc xa)"
-  by (import pred_set IN_IMAGE)
-
-lemma IMAGE_IN: "ALL (x::'a::type) xa::'a::type => bool.
-   IN x xa --> (ALL xb::'a::type => 'b::type. IN (xb x) (IMAGE xb xa))"
-  by (import pred_set IMAGE_IN)
-
-lemma IMAGE_EMPTY: "ALL x::'a::type => 'b::type. IMAGE x EMPTY = EMPTY"
-  by (import pred_set IMAGE_EMPTY)
-
-lemma IMAGE_ID: "ALL x::'a::type => bool. IMAGE (%x::'a::type. x) x = x"
-  by (import pred_set IMAGE_ID)
-
-lemma IMAGE_COMPOSE: "ALL (x::'b::type => 'c::type) (xa::'a::type => 'b::type)
-   xb::'a::type => bool. IMAGE (x o xa) xb = IMAGE x (IMAGE xa xb)"
-  by (import pred_set IMAGE_COMPOSE)
-
-lemma IMAGE_INSERT: "ALL (x::'a::type => 'b::type) (xa::'a::type) xb::'a::type => bool.
-   IMAGE x (INSERT xa xb) = INSERT (x xa) (IMAGE x xb)"
-  by (import pred_set IMAGE_INSERT)
-
-lemma IMAGE_EQ_EMPTY: "ALL (s::'a::type => bool) x::'a::type => 'b::type.
-   (IMAGE x s = EMPTY) = (s = EMPTY)"
-  by (import pred_set IMAGE_EQ_EMPTY)
-
-lemma IMAGE_DELETE: "ALL (f::'a::type => 'b::type) (x::'a::type) s::'a::type => bool.
-   ~ IN x s --> IMAGE f (DELETE s x) = IMAGE f s"
-  by (import pred_set IMAGE_DELETE)
-
-lemma IMAGE_UNION: "ALL (x::'a::type => 'b::type) (xa::'a::type => bool) xb::'a::type => bool.
-   IMAGE x (pred_set.UNION xa xb) = pred_set.UNION (IMAGE x xa) (IMAGE x xb)"
-  by (import pred_set IMAGE_UNION)
-
-lemma IMAGE_SUBSET: "ALL (x::'a::type => bool) xa::'a::type => bool.
-   SUBSET x xa -->
-   (ALL xb::'a::type => 'b::type. SUBSET (IMAGE xb x) (IMAGE xb xa))"
-  by (import pred_set IMAGE_SUBSET)
-
-lemma IMAGE_INTER: "ALL (f::'a::type => 'b::type) (s::'a::type => bool) t::'a::type => bool.
-   SUBSET (IMAGE f (pred_set.INTER s t))
-    (pred_set.INTER (IMAGE f s) (IMAGE f t))"
-  by (import pred_set IMAGE_INTER)
-
-definition INJ :: "('a => 'b) => ('a => bool) => ('b => bool) => bool" where 
+specification (CHOICE) CHOICE_DEF: "ALL x. x ~= EMPTY --> IN (CHOICE x) x"
+  sorry
+
+definition
+  REST :: "('a => bool) => 'a => bool"  where
+  "REST == %s. DELETE s (CHOICE s)"
+
+lemma REST_DEF: "REST s = DELETE s (CHOICE s)"
+  sorry
+
+lemma CHOICE_NOT_IN_REST: "~ IN (CHOICE x) (REST x)"
+  sorry
+
+lemma CHOICE_INSERT_REST: "s ~= EMPTY ==> INSERT (CHOICE s) (REST s) = s"
+  sorry
+
+lemma REST_SUBSET: "SUBSET (REST x) x"
+  sorry
+
+lemma REST_PSUBSET: "x ~= EMPTY ==> PSUBSET (REST x) x"
+  sorry
+
+definition
+  SING :: "('a => bool) => bool"  where
+  "SING == %s. EX x. s = INSERT x EMPTY"
+
+lemma SING_DEF: "SING s = (EX x. s = INSERT x EMPTY)"
+  sorry
+
+lemma SING: "SING (INSERT x EMPTY)"
+  sorry
+
+lemma IN_SING: "IN x (INSERT xa EMPTY) = (x = xa)"
+  sorry
+
+lemma NOT_SING_EMPTY: "INSERT x EMPTY ~= EMPTY"
+  sorry
+
+lemma NOT_EMPTY_SING: "EMPTY ~= INSERT x EMPTY"
+  sorry
+
+lemma EQUAL_SING: "(INSERT x EMPTY = INSERT xa EMPTY) = (x = xa)"
+  sorry
+
+lemma DISJOINT_SING_EMPTY: "DISJOINT (INSERT x EMPTY) EMPTY"
+  sorry
+
+lemma INSERT_SING_UNION: "INSERT xa x = pred_set.UNION (INSERT xa EMPTY) x"
+  sorry
+
+lemma SING_DELETE: "DELETE (INSERT x EMPTY) x = EMPTY"
+  sorry
+
+lemma DELETE_EQ_SING: "IN xa x ==> (DELETE x xa = EMPTY) = (x = INSERT xa EMPTY)"
+  sorry
+
+lemma CHOICE_SING: "CHOICE (INSERT x EMPTY) = x"
+  sorry
+
+lemma REST_SING: "REST (INSERT x EMPTY) = EMPTY"
+  sorry
+
+lemma SING_IFF_EMPTY_REST: "SING x = (x ~= EMPTY & REST x = EMPTY)"
+  sorry
+
+definition
+  IMAGE :: "('a => 'b) => ('a => bool) => 'b => bool"  where
+  "IMAGE == %f s. GSPEC (%x. (f x, IN x s))"
+
+lemma IMAGE_DEF: "IMAGE (f::'a => 'b) (s::'a => bool) = GSPEC (%x::'a. (f x, IN x s))"
+  sorry
+
+lemma IN_IMAGE: "IN (x::'b) (IMAGE (xb::'a => 'b) (xa::'a => bool)) =
+(EX xc::'a. x = xb xc & IN xc xa)"
+  sorry
+
+lemma IMAGE_IN: "IN x xa ==> IN (xb x) (IMAGE xb xa)"
+  sorry
+
+lemma IMAGE_EMPTY: "IMAGE (x::'a => 'b) EMPTY = EMPTY"
+  sorry
+
+lemma IMAGE_ID: "IMAGE (%x. x) x = x"
+  sorry
+
+lemma IMAGE_COMPOSE: "IMAGE ((x::'b => 'c) o (xa::'a => 'b)) (xb::'a => bool) =
+IMAGE x (IMAGE xa xb)"
+  sorry
+
+lemma IMAGE_INSERT: "IMAGE (x::'a => 'b) (INSERT (xa::'a) (xb::'a => bool)) =
+INSERT (x xa) (IMAGE x xb)"
+  sorry
+
+lemma IMAGE_EQ_EMPTY: "(IMAGE (x::'a => 'b) (s::'a => bool) = EMPTY) = (s = EMPTY)"
+  sorry
+
+lemma IMAGE_DELETE: "~ IN x s ==> IMAGE f (DELETE s x) = IMAGE f s"
+  sorry
+
+lemma IMAGE_UNION: "IMAGE (x::'a => 'b) (pred_set.UNION (xa::'a => bool) (xb::'a => bool)) =
+pred_set.UNION (IMAGE x xa) (IMAGE x xb)"
+  sorry
+
+lemma IMAGE_SUBSET: "SUBSET x xa ==> SUBSET (IMAGE xb x) (IMAGE xb xa)"
+  sorry
+
+lemma IMAGE_INTER: "SUBSET
+ (IMAGE (f::'a => 'b) (pred_set.INTER (s::'a => bool) (t::'a => bool)))
+ (pred_set.INTER (IMAGE f s) (IMAGE f t))"
+  sorry
+
+definition
+  INJ :: "('a => 'b) => ('a => bool) => ('b => bool) => bool"  where
   "INJ ==
-%(f::'a::type => 'b::type) (s::'a::type => bool) t::'b::type => bool.
-   (ALL x::'a::type. IN x s --> IN (f x) t) &
-   (ALL (x::'a::type) y::'a::type. IN x s & IN y s --> f x = f y --> x = y)"
-
-lemma INJ_DEF: "ALL (f::'a::type => 'b::type) (s::'a::type => bool) t::'b::type => bool.
-   INJ f s t =
-   ((ALL x::'a::type. IN x s --> IN (f x) t) &
-    (ALL (x::'a::type) y::'a::type.
-        IN x s & IN y s --> f x = f y --> x = y))"
-  by (import pred_set INJ_DEF)
-
-lemma INJ_ID: "ALL x::'a::type => bool. INJ (%x::'a::type. x) x x"
-  by (import pred_set INJ_ID)
-
-lemma INJ_COMPOSE: "ALL (x::'a::type => 'b::type) (xa::'b::type => 'c::type)
-   (xb::'a::type => bool) (xc::'b::type => bool) xd::'c::type => bool.
-   INJ x xb xc & INJ xa xc xd --> INJ (xa o x) xb xd"
-  by (import pred_set INJ_COMPOSE)
-
-lemma INJ_EMPTY: "ALL x::'a::type => 'b::type.
-   All (INJ x EMPTY) &
-   (ALL xa::'a::type => bool. INJ x xa EMPTY = (xa = EMPTY))"
-  by (import pred_set INJ_EMPTY)
-
-definition SURJ :: "('a => 'b) => ('a => bool) => ('b => bool) => bool" where 
+%f s t.
+   (ALL x. IN x s --> IN (f x) t) &
+   (ALL x y. IN x s & IN y s --> f x = f y --> x = y)"
+
+lemma INJ_DEF: "INJ f s t =
+((ALL x. IN x s --> IN (f x) t) &
+ (ALL x y. IN x s & IN y s --> f x = f y --> x = y))"
+  sorry
+
+lemma INJ_ID: "INJ (%x. x) x x"
+  sorry
+
+lemma INJ_COMPOSE: "INJ x xb xc & INJ xa xc xd ==> INJ (xa o x) xb xd"
+  sorry
+
+lemma INJ_EMPTY: "All (INJ (x::'a => 'b) EMPTY) &
+(ALL xa::'a => bool. INJ x xa EMPTY = (xa = EMPTY))"
+  sorry
+
+definition
+  SURJ :: "('a => 'b) => ('a => bool) => ('b => bool) => bool"  where
   "SURJ ==
-%(f::'a::type => 'b::type) (s::'a::type => bool) t::'b::type => bool.
-   (ALL x::'a::type. IN x s --> IN (f x) t) &
-   (ALL x::'b::type. IN x t --> (EX y::'a::type. IN y s & f y = x))"
-
-lemma SURJ_DEF: "ALL (f::'a::type => 'b::type) (s::'a::type => bool) t::'b::type => bool.
-   SURJ f s t =
-   ((ALL x::'a::type. IN x s --> IN (f x) t) &
-    (ALL x::'b::type. IN x t --> (EX y::'a::type. IN y s & f y = x)))"
-  by (import pred_set SURJ_DEF)
-
-lemma SURJ_ID: "ALL x::'a::type => bool. SURJ (%x::'a::type. x) x x"
-  by (import pred_set SURJ_ID)
-
-lemma SURJ_COMPOSE: "ALL (x::'a::type => 'b::type) (xa::'b::type => 'c::type)
-   (xb::'a::type => bool) (xc::'b::type => bool) xd::'c::type => bool.
-   SURJ x xb xc & SURJ xa xc xd --> SURJ (xa o x) xb xd"
-  by (import pred_set SURJ_COMPOSE)
-
-lemma SURJ_EMPTY: "ALL x::'a::type => 'b::type.
-   (ALL xa::'b::type => bool. SURJ x EMPTY xa = (xa = EMPTY)) &
-   (ALL xa::'a::type => bool. SURJ x xa EMPTY = (xa = EMPTY))"
-  by (import pred_set SURJ_EMPTY)
-
-lemma IMAGE_SURJ: "ALL (x::'a::type => 'b::type) (xa::'a::type => bool) xb::'b::type => bool.
-   SURJ x xa xb = (IMAGE x xa = xb)"
-  by (import pred_set IMAGE_SURJ)
-
-definition BIJ :: "('a => 'b) => ('a => bool) => ('b => bool) => bool" where 
-  "BIJ ==
-%(f::'a::type => 'b::type) (s::'a::type => bool) t::'b::type => bool.
-   INJ f s t & SURJ f s t"
-
-lemma BIJ_DEF: "ALL (f::'a::type => 'b::type) (s::'a::type => bool) t::'b::type => bool.
-   BIJ f s t = (INJ f s t & SURJ f s t)"
-  by (import pred_set BIJ_DEF)
-
-lemma BIJ_ID: "ALL x::'a::type => bool. BIJ (%x::'a::type. x) x x"
-  by (import pred_set BIJ_ID)
-
-lemma BIJ_EMPTY: "ALL x::'a::type => 'b::type.
-   (ALL xa::'b::type => bool. BIJ x EMPTY xa = (xa = EMPTY)) &
-   (ALL xa::'a::type => bool. BIJ x xa EMPTY = (xa = EMPTY))"
-  by (import pred_set BIJ_EMPTY)
-
-lemma BIJ_COMPOSE: "ALL (x::'a::type => 'b::type) (xa::'b::type => 'c::type)
-   (xb::'a::type => bool) (xc::'b::type => bool) xd::'c::type => bool.
-   BIJ x xb xc & BIJ xa xc xd --> BIJ (xa o x) xb xd"
-  by (import pred_set BIJ_COMPOSE)
+%f s t.
+   (ALL x. IN x s --> IN (f x) t) &
+   (ALL x. IN x t --> (EX y. IN y s & f y = x))"
+
+lemma SURJ_DEF: "SURJ f s t =
+((ALL x. IN x s --> IN (f x) t) &
+ (ALL x. IN x t --> (EX y. IN y s & f y = x)))"
+  sorry
+
+lemma SURJ_ID: "SURJ (%x. x) x x"
+  sorry
+
+lemma SURJ_COMPOSE: "SURJ x xb xc & SURJ xa xc xd ==> SURJ (xa o x) xb xd"
+  sorry
+
+lemma SURJ_EMPTY: "(ALL xa::'b => bool. SURJ (x::'a => 'b) EMPTY xa = (xa = EMPTY)) &
+(ALL xa::'a => bool. SURJ x xa EMPTY = (xa = EMPTY))"
+  sorry
+
+lemma IMAGE_SURJ: "SURJ x xa xb = (IMAGE x xa = xb)"
+  sorry
+
+definition
+  BIJ :: "('a => 'b) => ('a => bool) => ('b => bool) => bool"  where
+  "BIJ == %f s t. INJ f s t & SURJ f s t"
+
+lemma BIJ_DEF: "BIJ f s t = (INJ f s t & SURJ f s t)"
+  sorry
+
+lemma BIJ_ID: "BIJ (%x. x) x x"
+  sorry
+
+lemma BIJ_EMPTY: "(ALL xa::'b => bool. BIJ (x::'a => 'b) EMPTY xa = (xa = EMPTY)) &
+(ALL xa::'a => bool. BIJ x xa EMPTY = (xa = EMPTY))"
+  sorry
+
+lemma BIJ_COMPOSE: "BIJ x xb xc & BIJ xa xc xd ==> BIJ (xa o x) xb xd"
+  sorry
 
 consts
   LINV :: "('a => 'b) => ('a => bool) => 'b => 'a" 
 
-specification (LINV) LINV_DEF: "ALL (f::'a::type => 'b::type) (s::'a::type => bool) t::'b::type => bool.
-   INJ f s t --> (ALL x::'a::type. IN x s --> LINV f s (f x) = x)"
-  by (import pred_set LINV_DEF)
+specification (LINV) LINV_DEF: "ALL f s t. INJ f s t --> (ALL x. IN x s --> LINV f s (f x) = x)"
+  sorry
 
 consts
   RINV :: "('a => 'b) => ('a => bool) => 'b => 'a" 
 
-specification (RINV) RINV_DEF: "ALL (f::'a::type => 'b::type) (s::'a::type => bool) t::'b::type => bool.
-   SURJ f s t --> (ALL x::'b::type. IN x t --> f (RINV f s x) = x)"
-  by (import pred_set RINV_DEF)
-
-definition FINITE :: "('a => bool) => bool" where 
+specification (RINV) RINV_DEF: "ALL f s t. SURJ f s t --> (ALL x. IN x t --> f (RINV f s x) = x)"
+  sorry
+
+definition
+  FINITE :: "('a => bool) => bool"  where
   "FINITE ==
-%s::'a::type => bool.
-   ALL P::('a::type => bool) => bool.
-      P EMPTY &
-      (ALL s::'a::type => bool.
-          P s --> (ALL e::'a::type. P (INSERT e s))) -->
-      P s"
-
-lemma FINITE_DEF: "ALL s::'a::type => bool.
-   FINITE s =
-   (ALL P::('a::type => bool) => bool.
-       P EMPTY &
-       (ALL s::'a::type => bool.
-           P s --> (ALL e::'a::type. P (INSERT e s))) -->
-       P s)"
-  by (import pred_set FINITE_DEF)
+%s. ALL P. P EMPTY & (ALL s. P s --> (ALL e. P (INSERT e s))) --> P s"
+
+lemma FINITE_DEF: "FINITE s =
+(ALL P. P EMPTY & (ALL s. P s --> (ALL e. P (INSERT e s))) --> P s)"
+  sorry
 
 lemma FINITE_EMPTY: "FINITE EMPTY"
-  by (import pred_set FINITE_EMPTY)
-
-lemma FINITE_INDUCT: "ALL P::('a::type => bool) => bool.
-   P EMPTY &
-   (ALL s::'a::type => bool.
-       FINITE s & P s -->
-       (ALL e::'a::type. ~ IN e s --> P (INSERT e s))) -->
-   (ALL s::'a::type => bool. FINITE s --> P s)"
-  by (import pred_set FINITE_INDUCT)
-
-lemma FINITE_INSERT: "ALL (x::'a::type) s::'a::type => bool. FINITE (INSERT x s) = FINITE s"
-  by (import pred_set FINITE_INSERT)
-
-lemma FINITE_DELETE: "ALL (x::'a::type) s::'a::type => bool. FINITE (DELETE s x) = FINITE s"
-  by (import pred_set FINITE_DELETE)
-
-lemma FINITE_UNION: "ALL (s::'a::type => bool) t::'a::type => bool.
-   FINITE (pred_set.UNION s t) = (FINITE s & FINITE t)"
-  by (import pred_set FINITE_UNION)
-
-lemma INTER_FINITE: "ALL s::'a::type => bool.
-   FINITE s --> (ALL t::'a::type => bool. FINITE (pred_set.INTER s t))"
-  by (import pred_set INTER_FINITE)
-
-lemma SUBSET_FINITE: "ALL s::'a::type => bool.
-   FINITE s --> (ALL t::'a::type => bool. SUBSET t s --> FINITE t)"
-  by (import pred_set SUBSET_FINITE)
-
-lemma PSUBSET_FINITE: "ALL x::'a::type => bool.
-   FINITE x --> (ALL xa::'a::type => bool. PSUBSET xa x --> FINITE xa)"
-  by (import pred_set PSUBSET_FINITE)
-
-lemma FINITE_DIFF: "ALL s::'a::type => bool.
-   FINITE s --> (ALL t::'a::type => bool. FINITE (DIFF s t))"
-  by (import pred_set FINITE_DIFF)
-
-lemma FINITE_SING: "ALL x::'a::type. FINITE (INSERT x EMPTY)"
-  by (import pred_set FINITE_SING)
-
-lemma SING_FINITE: "ALL x::'a::type => bool. SING x --> FINITE x"
-  by (import pred_set SING_FINITE)
-
-lemma IMAGE_FINITE: "ALL s::'a::type => bool.
-   FINITE s --> (ALL f::'a::type => 'b::type. FINITE (IMAGE f s))"
-  by (import pred_set IMAGE_FINITE)
+  sorry
+
+lemma FINITE_INDUCT: "[| P EMPTY &
+   (ALL s. FINITE s & P s --> (ALL e. ~ IN e s --> P (INSERT e s)));
+   FINITE s |]
+==> P s"
+  sorry
+
+lemma FINITE_INSERT: "FINITE (INSERT x s) = FINITE s"
+  sorry
+
+lemma FINITE_DELETE: "FINITE (DELETE s x) = FINITE s"
+  sorry
+
+lemma FINITE_UNION: "FINITE (pred_set.UNION s t) = (FINITE s & FINITE t)"
+  sorry
+
+lemma INTER_FINITE: "FINITE s ==> FINITE (pred_set.INTER s t)"
+  sorry
+
+lemma SUBSET_FINITE: "[| FINITE s; SUBSET t s |] ==> FINITE t"
+  sorry
+
+lemma PSUBSET_FINITE: "[| FINITE x; PSUBSET xa x |] ==> FINITE xa"
+  sorry
+
+lemma FINITE_DIFF: "FINITE s ==> FINITE (DIFF s t)"
+  sorry
+
+lemma FINITE_SING: "FINITE (INSERT x EMPTY)"
+  sorry
+
+lemma SING_FINITE: "SING x ==> FINITE x"
+  sorry
+
+lemma IMAGE_FINITE: "FINITE s ==> FINITE (IMAGE f s)"
+  sorry
 
 consts
   CARD :: "('a => bool) => nat" 
@@ -4077,77 +3113,56 @@
                  ((CARD::('a::type => bool) => nat) s)
                  ((Suc::nat => nat)
                    ((CARD::('a::type => bool) => nat) s)))))))"
-  by (import pred_set CARD_DEF)
+  sorry
 
 lemma CARD_EMPTY: "CARD EMPTY = 0"
-  by (import pred_set CARD_EMPTY)
-
-lemma CARD_INSERT: "ALL s::'a::type => bool.
-   FINITE s -->
-   (ALL x::'a::type.
-       CARD (INSERT x s) = (if IN x s then CARD s else Suc (CARD s)))"
-  by (import pred_set CARD_INSERT)
-
-lemma CARD_EQ_0: "ALL s::'a::type => bool. FINITE s --> (CARD s = 0) = (s = EMPTY)"
-  by (import pred_set CARD_EQ_0)
-
-lemma CARD_DELETE: "ALL s::'a::type => bool.
-   FINITE s -->
-   (ALL x::'a::type.
-       CARD (DELETE s x) = (if IN x s then CARD s - 1 else CARD s))"
-  by (import pred_set CARD_DELETE)
-
-lemma CARD_INTER_LESS_EQ: "ALL s::'a::type => bool.
-   FINITE s -->
-   (ALL t::'a::type => bool. CARD (pred_set.INTER s t) <= CARD s)"
-  by (import pred_set CARD_INTER_LESS_EQ)
-
-lemma CARD_UNION: "ALL s::'a::type => bool.
-   FINITE s -->
-   (ALL t::'a::type => bool.
-       FINITE t -->
-       CARD (pred_set.UNION s t) + CARD (pred_set.INTER s t) =
-       CARD s + CARD t)"
-  by (import pred_set CARD_UNION)
-
-lemma CARD_SUBSET: "ALL s::'a::type => bool.
-   FINITE s --> (ALL t::'a::type => bool. SUBSET t s --> CARD t <= CARD s)"
-  by (import pred_set CARD_SUBSET)
-
-lemma CARD_PSUBSET: "ALL s::'a::type => bool.
-   FINITE s --> (ALL t::'a::type => bool. PSUBSET t s --> CARD t < CARD s)"
-  by (import pred_set CARD_PSUBSET)
-
-lemma CARD_SING: "ALL x::'a::type. CARD (INSERT x EMPTY) = 1"
-  by (import pred_set CARD_SING)
-
-lemma SING_IFF_CARD1: "ALL x::'a::type => bool. SING x = (CARD x = 1 & FINITE x)"
-  by (import pred_set SING_IFF_CARD1)
-
-lemma CARD_DIFF: "ALL t::'a::type => bool.
-   FINITE t -->
-   (ALL s::'a::type => bool.
-       FINITE s --> CARD (DIFF s t) = CARD s - CARD (pred_set.INTER s t))"
-  by (import pred_set CARD_DIFF)
-
-lemma LESS_CARD_DIFF: "ALL t::'a::type => bool.
-   FINITE t -->
-   (ALL s::'a::type => bool.
-       FINITE s --> CARD t < CARD s --> 0 < CARD (DIFF s t))"
-  by (import pred_set LESS_CARD_DIFF)
-
-lemma FINITE_COMPLETE_INDUCTION: "ALL P::('a::type => bool) => bool.
-   (ALL x::'a::type => bool.
-       (ALL y::'a::type => bool. PSUBSET y x --> P y) -->
-       FINITE x --> P x) -->
-   (ALL x::'a::type => bool. FINITE x --> P x)"
-  by (import pred_set FINITE_COMPLETE_INDUCTION)
-
-definition INFINITE :: "('a => bool) => bool" where 
-  "INFINITE == %s::'a::type => bool. ~ FINITE s"
-
-lemma INFINITE_DEF: "ALL s::'a::type => bool. INFINITE s = (~ FINITE s)"
-  by (import pred_set INFINITE_DEF)
+  sorry
+
+lemma CARD_INSERT: "FINITE s ==> CARD (INSERT x s) = (if IN x s then CARD s else Suc (CARD s))"
+  sorry
+
+lemma CARD_EQ_0: "FINITE s ==> (CARD s = 0) = (s = EMPTY)"
+  sorry
+
+lemma CARD_DELETE: "FINITE s ==> CARD (DELETE s x) = (if IN x s then CARD s - 1 else CARD s)"
+  sorry
+
+lemma CARD_INTER_LESS_EQ: "FINITE s ==> CARD (pred_set.INTER s t) <= CARD s"
+  sorry
+
+lemma CARD_UNION: "[| FINITE s; FINITE t |]
+==> CARD (pred_set.UNION s t) + CARD (pred_set.INTER s t) = CARD s + CARD t"
+  sorry
+
+lemma CARD_SUBSET: "[| FINITE s; SUBSET t s |] ==> CARD t <= CARD s"
+  sorry
+
+lemma CARD_PSUBSET: "[| FINITE s; PSUBSET t s |] ==> CARD t < CARD s"
+  sorry
+
+lemma CARD_SING: "CARD (INSERT x EMPTY) = 1"
+  sorry
+
+lemma SING_IFF_CARD1: "SING x = (CARD x = 1 & FINITE x)"
+  sorry
+
+lemma CARD_DIFF: "[| FINITE t; FINITE s |]
+==> CARD (DIFF s t) = CARD s - CARD (pred_set.INTER s t)"
+  sorry
+
+lemma LESS_CARD_DIFF: "[| FINITE t; FINITE s; CARD t < CARD s |] ==> 0 < CARD (DIFF s t)"
+  sorry
+
+lemma FINITE_COMPLETE_INDUCTION: "[| !!x. [| !!y. PSUBSET y x ==> P y; FINITE x |] ==> P x; FINITE x |]
+==> P x"
+  sorry
+
+definition
+  INFINITE :: "('a => bool) => bool"  where
+  "INFINITE == %s. ~ FINITE s"
+
+lemma INFINITE_DEF: "INFINITE s = (~ FINITE s)"
+  sorry
 
 lemma NOT_IN_FINITE: "(op =::bool => bool => bool)
  ((INFINITE::('a::type => bool) => bool) (pred_set.UNIV::'a::type => bool))
@@ -4159,23 +3174,19 @@
           (%x::'a::type.
               (Not::bool => bool)
                ((IN::'a::type => ('a::type => bool) => bool) x s)))))"
-  by (import pred_set NOT_IN_FINITE)
-
-lemma INFINITE_INHAB: "ALL x::'a::type => bool. INFINITE x --> (EX xa::'a::type. IN xa x)"
-  by (import pred_set INFINITE_INHAB)
-
-lemma IMAGE_11_INFINITE: "ALL f::'a::type => 'b::type.
-   (ALL (x::'a::type) y::'a::type. f x = f y --> x = y) -->
-   (ALL s::'a::type => bool. INFINITE s --> INFINITE (IMAGE f s))"
-  by (import pred_set IMAGE_11_INFINITE)
-
-lemma INFINITE_SUBSET: "ALL x::'a::type => bool.
-   INFINITE x --> (ALL xa::'a::type => bool. SUBSET x xa --> INFINITE xa)"
-  by (import pred_set INFINITE_SUBSET)
-
-lemma IN_INFINITE_NOT_FINITE: "ALL (x::'a::type => bool) xa::'a::type => bool.
-   INFINITE x & FINITE xa --> (EX xb::'a::type. IN xb x & ~ IN xb xa)"
-  by (import pred_set IN_INFINITE_NOT_FINITE)
+  sorry
+
+lemma INFINITE_INHAB: "INFINITE x ==> EX xa. IN xa x"
+  sorry
+
+lemma IMAGE_11_INFINITE: "[| !!x y. f x = f y ==> x = y; INFINITE s |] ==> INFINITE (IMAGE f s)"
+  sorry
+
+lemma INFINITE_SUBSET: "[| INFINITE x; SUBSET x xa |] ==> INFINITE xa"
+  sorry
+
+lemma IN_INFINITE_NOT_FINITE: "INFINITE x & FINITE xa ==> EX xb. IN xb x & ~ IN xb xa"
+  sorry
 
 lemma INFINITE_UNIV: "(op =::bool => bool => bool)
  ((INFINITE::('a::type => bool) => bool) (pred_set.UNIV::'a::type => bool))
@@ -4193,14 +3204,11 @@
           (%y::'a::type.
               (All::('a::type => bool) => bool)
                (%x::'a::type.
-                   (Not::bool => bool)
-                    ((op =::'a::type => 'a::type => bool) (f x) y))))))"
-  by (import pred_set INFINITE_UNIV)
-
-lemma FINITE_PSUBSET_INFINITE: "ALL x::'a::type => bool.
-   INFINITE x =
-   (ALL xa::'a::type => bool. FINITE xa --> SUBSET xa x --> PSUBSET xa x)"
-  by (import pred_set FINITE_PSUBSET_INFINITE)
+                   (op ~=::'a::type => 'a::type => bool) (f x) y)))))"
+  sorry
+
+lemma FINITE_PSUBSET_INFINITE: "INFINITE x = (ALL xa. FINITE xa --> SUBSET xa x --> PSUBSET xa x)"
+  sorry
 
 lemma FINITE_PSUBSET_UNIV: "(op =::bool => bool => bool)
  ((INFINITE::('a::type => bool) => bool) (pred_set.UNIV::'a::type => bool))
@@ -4210,362 +3218,283 @@
         ((FINITE::('a::type => bool) => bool) s)
         ((PSUBSET::('a::type => bool) => ('a::type => bool) => bool) s
           (pred_set.UNIV::'a::type => bool))))"
-  by (import pred_set FINITE_PSUBSET_UNIV)
-
-lemma INFINITE_DIFF_FINITE: "ALL (s::'a::type => bool) t::'a::type => bool.
-   INFINITE s & FINITE t --> DIFF s t ~= EMPTY"
-  by (import pred_set INFINITE_DIFF_FINITE)
-
-lemma FINITE_ISO_NUM: "ALL s::'a::type => bool.
-   FINITE s -->
-   (EX f::nat => 'a::type.
-       (ALL (n::nat) m::nat.
-           n < CARD s & m < CARD s --> f n = f m --> n = m) &
-       s = GSPEC (%n::nat. (f n, n < CARD s)))"
-  by (import pred_set FINITE_ISO_NUM)
-
-lemma FINITE_WEAK_ENUMERATE: "(All::(('a::type => bool) => bool) => bool)
- (%x::'a::type => bool.
-     (op =::bool => bool => bool) ((FINITE::('a::type => bool) => bool) x)
-      ((Ex::((nat => 'a::type) => bool) => bool)
-        (%f::nat => 'a::type.
-            (Ex::(nat => bool) => bool)
-             (%b::nat.
-                 (All::('a::type => bool) => bool)
-                  (%e::'a::type.
-                      (op =::bool => bool => bool)
-                       ((IN::'a::type => ('a::type => bool) => bool) e x)
-                       ((Ex::(nat => bool) => bool)
-                         (%n::nat.
-                             (op &::bool => bool => bool)
-                              ((op <::nat => nat => bool) n b)
-                              ((op =::'a::type => 'a::type => bool) e
-                                (f n)))))))))"
-  by (import pred_set FINITE_WEAK_ENUMERATE)
-
-definition BIGUNION :: "(('a => bool) => bool) => 'a => bool" where 
-  "BIGUNION ==
-%P::('a::type => bool) => bool.
-   GSPEC (%x::'a::type. (x, EX p::'a::type => bool. IN p P & IN x p))"
-
-lemma BIGUNION: "ALL P::('a::type => bool) => bool.
-   BIGUNION P =
-   GSPEC (%x::'a::type. (x, EX p::'a::type => bool. IN p P & IN x p))"
-  by (import pred_set BIGUNION)
-
-lemma IN_BIGUNION: "ALL (x::'a::type) xa::('a::type => bool) => bool.
-   IN x (BIGUNION xa) = (EX s::'a::type => bool. IN x s & IN s xa)"
-  by (import pred_set IN_BIGUNION)
+  sorry
+
+lemma INFINITE_DIFF_FINITE: "INFINITE s & FINITE t ==> DIFF s t ~= EMPTY"
+  sorry
+
+lemma FINITE_ISO_NUM: "FINITE s
+==> EX f. (ALL n m. n < CARD s & m < CARD s --> f n = f m --> n = m) &
+          s = GSPEC (%n. (f n, n < CARD s))"
+  sorry
+
+lemma FINITE_WEAK_ENUMERATE: "FINITE (x::'a => bool) =
+(EX (f::nat => 'a) b::nat. ALL e::'a. IN e x = (EX n<b. e = f n))"
+  sorry
+
+definition
+  BIGUNION :: "(('a => bool) => bool) => 'a => bool"  where
+  "BIGUNION == %P. GSPEC (%x. (x, EX p. IN p P & IN x p))"
+
+lemma BIGUNION: "BIGUNION P = GSPEC (%x. (x, EX p. IN p P & IN x p))"
+  sorry
+
+lemma IN_BIGUNION: "IN x (BIGUNION xa) = (EX s. IN x s & IN s xa)"
+  sorry
 
 lemma BIGUNION_EMPTY: "BIGUNION EMPTY = EMPTY"
-  by (import pred_set BIGUNION_EMPTY)
-
-lemma BIGUNION_SING: "ALL x::'a::type => bool. BIGUNION (INSERT x EMPTY) = x"
-  by (import pred_set BIGUNION_SING)
-
-lemma BIGUNION_UNION: "ALL (x::('a::type => bool) => bool) xa::('a::type => bool) => bool.
-   BIGUNION (pred_set.UNION x xa) =
-   pred_set.UNION (BIGUNION x) (BIGUNION xa)"
-  by (import pred_set BIGUNION_UNION)
-
-lemma DISJOINT_BIGUNION: "(ALL (s::('a::type => bool) => bool) t::'a::type => bool.
+  sorry
+
+lemma BIGUNION_SING: "BIGUNION (INSERT x EMPTY) = x"
+  sorry
+
+lemma BIGUNION_UNION: "BIGUNION (pred_set.UNION x xa) = pred_set.UNION (BIGUNION x) (BIGUNION xa)"
+  sorry
+
+lemma DISJOINT_BIGUNION: "(ALL (s::('a => bool) => bool) t::'a => bool.
     DISJOINT (BIGUNION s) t =
-    (ALL s'::'a::type => bool. IN s' s --> DISJOINT s' t)) &
-(ALL (x::('a::type => bool) => bool) xa::'a::type => bool.
+    (ALL s'::'a => bool. IN s' s --> DISJOINT s' t)) &
+(ALL (x::('a => bool) => bool) xa::'a => bool.
     DISJOINT xa (BIGUNION x) =
-    (ALL xb::'a::type => bool. IN xb x --> DISJOINT xa xb))"
-  by (import pred_set DISJOINT_BIGUNION)
-
-lemma BIGUNION_INSERT: "ALL (x::'a::type => bool) xa::('a::type => bool) => bool.
-   BIGUNION (INSERT x xa) = pred_set.UNION x (BIGUNION xa)"
-  by (import pred_set BIGUNION_INSERT)
-
-lemma BIGUNION_SUBSET: "ALL (X::'a::type => bool) P::('a::type => bool) => bool.
-   SUBSET (BIGUNION P) X = (ALL Y::'a::type => bool. IN Y P --> SUBSET Y X)"
-  by (import pred_set BIGUNION_SUBSET)
-
-lemma FINITE_BIGUNION: "ALL x::('a::type => bool) => bool.
-   FINITE x & (ALL s::'a::type => bool. IN s x --> FINITE s) -->
-   FINITE (BIGUNION x)"
-  by (import pred_set FINITE_BIGUNION)
-
-definition BIGINTER :: "(('a => bool) => bool) => 'a => bool" where 
-  "BIGINTER ==
-%B::('a::type => bool) => bool.
-   GSPEC (%x::'a::type. (x, ALL P::'a::type => bool. IN P B --> IN x P))"
-
-lemma BIGINTER: "ALL B::('a::type => bool) => bool.
-   BIGINTER B =
-   GSPEC (%x::'a::type. (x, ALL P::'a::type => bool. IN P B --> IN x P))"
-  by (import pred_set BIGINTER)
-
-lemma IN_BIGINTER: "IN (x::'a::type) (BIGINTER (B::('a::type => bool) => bool)) =
-(ALL P::'a::type => bool. IN P B --> IN x P)"
-  by (import pred_set IN_BIGINTER)
-
-lemma BIGINTER_INSERT: "ALL (P::'a::type => bool) B::('a::type => bool) => bool.
-   BIGINTER (INSERT P B) = pred_set.INTER P (BIGINTER B)"
-  by (import pred_set BIGINTER_INSERT)
+    (ALL xb::'a => bool. IN xb x --> DISJOINT xa xb))"
+  sorry
+
+lemma BIGUNION_INSERT: "BIGUNION (INSERT x xa) = pred_set.UNION x (BIGUNION xa)"
+  sorry
+
+lemma BIGUNION_SUBSET: "SUBSET (BIGUNION P) X = (ALL Y. IN Y P --> SUBSET Y X)"
+  sorry
+
+lemma FINITE_BIGUNION: "FINITE x & (ALL s. IN s x --> FINITE s) ==> FINITE (BIGUNION x)"
+  sorry
+
+definition
+  BIGINTER :: "(('a => bool) => bool) => 'a => bool"  where
+  "BIGINTER == %B. GSPEC (%x. (x, ALL P. IN P B --> IN x P))"
+
+lemma BIGINTER: "BIGINTER B = GSPEC (%x. (x, ALL P. IN P B --> IN x P))"
+  sorry
+
+lemma IN_BIGINTER: "IN x (BIGINTER B) = (ALL P. IN P B --> IN x P)"
+  sorry
+
+lemma BIGINTER_INSERT: "BIGINTER (INSERT P B) = pred_set.INTER P (BIGINTER B)"
+  sorry
 
 lemma BIGINTER_EMPTY: "BIGINTER EMPTY = pred_set.UNIV"
-  by (import pred_set BIGINTER_EMPTY)
-
-lemma BIGINTER_INTER: "ALL (x::'a::type => bool) xa::'a::type => bool.
-   BIGINTER (INSERT x (INSERT xa EMPTY)) = pred_set.INTER x xa"
-  by (import pred_set BIGINTER_INTER)
-
-lemma BIGINTER_SING: "ALL x::'a::type => bool. BIGINTER (INSERT x EMPTY) = x"
-  by (import pred_set BIGINTER_SING)
-
-lemma SUBSET_BIGINTER: "ALL (X::'a::type => bool) P::('a::type => bool) => bool.
-   SUBSET X (BIGINTER P) = (ALL x::'a::type => bool. IN x P --> SUBSET X x)"
-  by (import pred_set SUBSET_BIGINTER)
-
-lemma DISJOINT_BIGINTER: "ALL (x::'a::type => bool) (xa::'a::type => bool)
-   xb::('a::type => bool) => bool.
-   IN xa xb & DISJOINT xa x -->
-   DISJOINT x (BIGINTER xb) & DISJOINT (BIGINTER xb) x"
-  by (import pred_set DISJOINT_BIGINTER)
-
-definition CROSS :: "('a => bool) => ('b => bool) => 'a * 'b => bool" where 
-  "CROSS ==
-%(P::'a::type => bool) Q::'b::type => bool.
-   GSPEC (%p::'a::type * 'b::type. (p, IN (fst p) P & IN (snd p) Q))"
-
-lemma CROSS_DEF: "ALL (P::'a::type => bool) Q::'b::type => bool.
-   CROSS P Q =
-   GSPEC (%p::'a::type * 'b::type. (p, IN (fst p) P & IN (snd p) Q))"
-  by (import pred_set CROSS_DEF)
-
-lemma IN_CROSS: "ALL (x::'a::type => bool) (xa::'b::type => bool) xb::'a::type * 'b::type.
-   IN xb (CROSS x xa) = (IN (fst xb) x & IN (snd xb) xa)"
-  by (import pred_set IN_CROSS)
-
-lemma CROSS_EMPTY: "ALL x::'a::type => bool. CROSS x EMPTY = EMPTY & CROSS EMPTY x = EMPTY"
-  by (import pred_set CROSS_EMPTY)
-
-lemma CROSS_INSERT_LEFT: "ALL (x::'a::type => bool) (xa::'b::type => bool) xb::'a::type.
-   CROSS (INSERT xb x) xa =
-   pred_set.UNION (CROSS (INSERT xb EMPTY) xa) (CROSS x xa)"
-  by (import pred_set CROSS_INSERT_LEFT)
-
-lemma CROSS_INSERT_RIGHT: "ALL (x::'a::type => bool) (xa::'b::type => bool) xb::'b::type.
-   CROSS x (INSERT xb xa) =
-   pred_set.UNION (CROSS x (INSERT xb EMPTY)) (CROSS x xa)"
-  by (import pred_set CROSS_INSERT_RIGHT)
-
-lemma FINITE_CROSS: "ALL (x::'a::type => bool) xa::'b::type => bool.
-   FINITE x & FINITE xa --> FINITE (CROSS x xa)"
-  by (import pred_set FINITE_CROSS)
-
-lemma CROSS_SINGS: "ALL (x::'a::type) xa::'b::type.
-   CROSS (INSERT x EMPTY) (INSERT xa EMPTY) = INSERT (x, xa) EMPTY"
-  by (import pred_set CROSS_SINGS)
-
-lemma CARD_SING_CROSS: "ALL (x::'a::type) s::'b::type => bool.
-   FINITE s --> CARD (CROSS (INSERT x EMPTY) s) = CARD s"
-  by (import pred_set CARD_SING_CROSS)
-
-lemma CARD_CROSS: "ALL (x::'a::type => bool) xa::'b::type => bool.
-   FINITE x & FINITE xa --> CARD (CROSS x xa) = CARD x * CARD xa"
-  by (import pred_set CARD_CROSS)
-
-lemma CROSS_SUBSET: "ALL (x::'a::type => bool) (xa::'b::type => bool) (xb::'a::type => bool)
-   xc::'b::type => bool.
-   SUBSET (CROSS xb xc) (CROSS x xa) =
-   (xb = EMPTY | xc = EMPTY | SUBSET xb x & SUBSET xc xa)"
-  by (import pred_set CROSS_SUBSET)
-
-lemma FINITE_CROSS_EQ: "ALL (P::'a::type => bool) Q::'b::type => bool.
-   FINITE (CROSS P Q) = (P = EMPTY | Q = EMPTY | FINITE P & FINITE Q)"
-  by (import pred_set FINITE_CROSS_EQ)
-
-definition COMPL :: "('a => bool) => 'a => bool" where 
+  sorry
+
+lemma BIGINTER_INTER: "BIGINTER (INSERT x (INSERT xa EMPTY)) = pred_set.INTER x xa"
+  sorry
+
+lemma BIGINTER_SING: "BIGINTER (INSERT x EMPTY) = x"
+  sorry
+
+lemma SUBSET_BIGINTER: "SUBSET X (BIGINTER P) = (ALL x. IN x P --> SUBSET X x)"
+  sorry
+
+lemma DISJOINT_BIGINTER: "IN xa xb & DISJOINT xa x
+==> DISJOINT x (BIGINTER xb) & DISJOINT (BIGINTER xb) x"
+  sorry
+
+definition
+  CROSS :: "('a => bool) => ('b => bool) => 'a * 'b => bool"  where
+  "CROSS == %P Q. GSPEC (%p. (p, IN (fst p) P & IN (snd p) Q))"
+
+lemma CROSS_DEF: "CROSS P Q = GSPEC (%p. (p, IN (fst p) P & IN (snd p) Q))"
+  sorry
+
+lemma IN_CROSS: "IN xb (CROSS x xa) = (IN (fst xb) x & IN (snd xb) xa)"
+  sorry
+
+lemma CROSS_EMPTY: "CROSS x EMPTY = EMPTY & CROSS EMPTY x = EMPTY"
+  sorry
+
+lemma CROSS_INSERT_LEFT: "CROSS (INSERT xb x) xa =
+pred_set.UNION (CROSS (INSERT xb EMPTY) xa) (CROSS x xa)"
+  sorry
+
+lemma CROSS_INSERT_RIGHT: "CROSS x (INSERT xb xa) =
+pred_set.UNION (CROSS x (INSERT xb EMPTY)) (CROSS x xa)"
+  sorry
+
+lemma FINITE_CROSS: "FINITE x & FINITE xa ==> FINITE (CROSS x xa)"
+  sorry
+
+lemma CROSS_SINGS: "CROSS (INSERT x EMPTY) (INSERT xa EMPTY) = INSERT (x, xa) EMPTY"
+  sorry
+
+lemma CARD_SING_CROSS: "FINITE (s::'b => bool) ==> CARD (CROSS (INSERT (x::'a) EMPTY) s) = CARD s"
+  sorry
+
+lemma CARD_CROSS: "FINITE x & FINITE xa ==> CARD (CROSS x xa) = CARD x * CARD xa"
+  sorry
+
+lemma CROSS_SUBSET: "SUBSET (CROSS xb xc) (CROSS x xa) =
+(xb = EMPTY | xc = EMPTY | SUBSET xb x & SUBSET xc xa)"
+  sorry
+
+lemma FINITE_CROSS_EQ: "FINITE (CROSS P Q) = (P = EMPTY | Q = EMPTY | FINITE P & FINITE Q)"
+  sorry
+
+definition
+  COMPL :: "('a => bool) => 'a => bool"  where
   "COMPL == DIFF pred_set.UNIV"
 
-lemma COMPL_DEF: "ALL P::'a::type => bool. COMPL P = DIFF pred_set.UNIV P"
-  by (import pred_set COMPL_DEF)
-
-lemma IN_COMPL: "ALL (x::'a::type) xa::'a::type => bool. IN x (COMPL xa) = (~ IN x xa)"
-  by (import pred_set IN_COMPL)
-
-lemma COMPL_COMPL: "ALL x::'a::type => bool. COMPL (COMPL x) = x"
-  by (import pred_set COMPL_COMPL)
-
-lemma COMPL_CLAUSES: "ALL x::'a::type => bool.
-   pred_set.INTER (COMPL x) x = EMPTY &
-   pred_set.UNION (COMPL x) x = pred_set.UNIV"
-  by (import pred_set COMPL_CLAUSES)
-
-lemma COMPL_SPLITS: "ALL (x::'a::type => bool) xa::'a::type => bool.
-   pred_set.UNION (pred_set.INTER x xa) (pred_set.INTER (COMPL x) xa) = xa"
-  by (import pred_set COMPL_SPLITS)
-
-lemma INTER_UNION_COMPL: "ALL (x::'a::type => bool) xa::'a::type => bool.
-   pred_set.INTER x xa = COMPL (pred_set.UNION (COMPL x) (COMPL xa))"
-  by (import pred_set INTER_UNION_COMPL)
+lemma COMPL_DEF: "COMPL P = DIFF pred_set.UNIV P"
+  sorry
+
+lemma IN_COMPL: "IN x (COMPL xa) = (~ IN x xa)"
+  sorry
+
+lemma COMPL_COMPL: "COMPL (COMPL x) = x"
+  sorry
+
+lemma COMPL_CLAUSES: "pred_set.INTER (COMPL x) x = EMPTY &
+pred_set.UNION (COMPL x) x = pred_set.UNIV"
+  sorry
+
+lemma COMPL_SPLITS: "pred_set.UNION (pred_set.INTER x xa) (pred_set.INTER (COMPL x) xa) = xa"
+  sorry
+
+lemma INTER_UNION_COMPL: "pred_set.INTER x xa = COMPL (pred_set.UNION (COMPL x) (COMPL xa))"
+  sorry
 
 lemma COMPL_EMPTY: "COMPL EMPTY = pred_set.UNIV"
-  by (import pred_set COMPL_EMPTY)
+  sorry
 
 consts
   count :: "nat => nat => bool" 
 
 defs
-  count_primdef: "count == %n::nat. GSPEC (%m::nat. (m, m < n))"
-
-lemma count_def: "ALL n::nat. count n = GSPEC (%m::nat. (m, m < n))"
-  by (import pred_set count_def)
-
-lemma IN_COUNT: "ALL (m::nat) n::nat. IN m (count n) = (m < n)"
-  by (import pred_set IN_COUNT)
+  count_primdef: "count == %n. GSPEC (%m. (m, m < n))"
+
+lemma count_def: "count n = GSPEC (%m. (m, m < n))"
+  sorry
+
+lemma IN_COUNT: "IN m (count n) = (m < n)"
+  sorry
 
 lemma COUNT_ZERO: "count 0 = EMPTY"
-  by (import pred_set COUNT_ZERO)
-
-lemma COUNT_SUC: "ALL n::nat. count (Suc n) = INSERT n (count n)"
-  by (import pred_set COUNT_SUC)
-
-lemma FINITE_COUNT: "ALL n::nat. FINITE (count n)"
-  by (import pred_set FINITE_COUNT)
-
-lemma CARD_COUNT: "ALL n::nat. CARD (count n) = n"
-  by (import pred_set CARD_COUNT)
-
-definition ITSET_tupled :: "('a => 'b => 'b) => ('a => bool) * 'b => 'b" where 
+  sorry
+
+lemma COUNT_SUC: "count (Suc n) = INSERT n (count n)"
+  sorry
+
+lemma FINITE_COUNT: "FINITE (count n)"
+  sorry
+
+lemma CARD_COUNT: "CARD (count n) = n"
+  sorry
+
+definition
+  ITSET_tupled :: "('a => 'b => 'b) => ('a => bool) * 'b => 'b"  where
   "ITSET_tupled ==
-%f::'a::type => 'b::type => 'b::type.
-   WFREC
-    (SOME R::('a::type => bool) * 'b::type
-             => ('a::type => bool) * 'b::type => bool.
-        WF R &
-        (ALL (b::'b::type) s::'a::type => bool.
-            FINITE s & s ~= EMPTY --> R (REST s, f (CHOICE s) b) (s, b)))
-    (%(ITSET_tupled::('a::type => bool) * 'b::type => 'b::type)
-        (v::'a::type => bool, v1::'b::type).
-        if FINITE v
-        then if v = EMPTY then v1
-             else ITSET_tupled (REST v, f (CHOICE v) v1)
-        else ARB)"
-
-lemma ITSET_tupled_primitive_def: "ALL f::'a::type => 'b::type => 'b::type.
-   ITSET_tupled f =
-   WFREC
-    (SOME R::('a::type => bool) * 'b::type
-             => ('a::type => bool) * 'b::type => bool.
-        WF R &
-        (ALL (b::'b::type) s::'a::type => bool.
-            FINITE s & s ~= EMPTY --> R (REST s, f (CHOICE s) b) (s, b)))
-    (%(ITSET_tupled::('a::type => bool) * 'b::type => 'b::type)
-        (v::'a::type => bool, v1::'b::type).
-        if FINITE v
-        then if v = EMPTY then v1
-             else ITSET_tupled (REST v, f (CHOICE v) v1)
-        else ARB)"
-  by (import pred_set ITSET_tupled_primitive_def)
-
-definition ITSET :: "('a => 'b => 'b) => ('a => bool) => 'b => 'b" where 
-  "ITSET ==
-%(f::'a::type => 'b::type => 'b::type) (x::'a::type => bool) x1::'b::type.
-   ITSET_tupled f (x, x1)"
-
-lemma ITSET_curried_def: "ALL (f::'a::type => 'b::type => 'b::type) (x::'a::type => bool)
-   x1::'b::type. ITSET f x x1 = ITSET_tupled f (x, x1)"
-  by (import pred_set ITSET_curried_def)
-
-lemma ITSET_IND: "ALL P::('a::type => bool) => 'b::type => bool.
-   (ALL (s::'a::type => bool) b::'b::type.
-       (FINITE s & s ~= EMPTY -->
-        P (REST s) ((f::'a::type => 'b::type => 'b::type) (CHOICE s) b)) -->
-       P s b) -->
-   (ALL v::'a::type => bool. All (P v))"
-  by (import pred_set ITSET_IND)
-
-lemma ITSET_THM: "ALL (s::'a::type => bool) (f::'a::type => 'b::type => 'b::type) b::'b::type.
-   FINITE s -->
-   ITSET f s b =
-   (if s = EMPTY then b else ITSET f (REST s) (f (CHOICE s) b))"
-  by (import pred_set ITSET_THM)
-
-lemma ITSET_EMPTY: "ALL (x::'a::type => 'b::type => 'b::type) xa::'b::type.
-   ITSET x EMPTY xa = xa"
-  by (import pred_set ITSET_EMPTY)
+%f. WFREC
+     (SOME R.
+         WF R &
+         (ALL b s.
+             FINITE s & s ~= EMPTY --> R (REST s, f (CHOICE s) b) (s, b)))
+     (%ITSET_tupled (v, v1).
+         if FINITE v
+         then if v = EMPTY then v1
+              else ITSET_tupled (REST v, f (CHOICE v) v1)
+         else ARB)"
+
+lemma ITSET_tupled_primitive_def: "ITSET_tupled f =
+WFREC
+ (SOME R.
+     WF R &
+     (ALL b s. FINITE s & s ~= EMPTY --> R (REST s, f (CHOICE s) b) (s, b)))
+ (%ITSET_tupled (v, v1).
+     if FINITE v
+     then if v = EMPTY then v1 else ITSET_tupled (REST v, f (CHOICE v) v1)
+     else ARB)"
+  sorry
+
+definition
+  ITSET :: "('a => 'b => 'b) => ('a => bool) => 'b => 'b"  where
+  "ITSET == %f x x1. ITSET_tupled f (x, x1)"
+
+lemma ITSET_curried_def: "ITSET (f::'a => 'b => 'b) (x::'a => bool) (x1::'b) = ITSET_tupled f (x, x1)"
+  sorry
+
+lemma ITSET_IND: "(!!(s::'a => bool) b::'b.
+    (FINITE s & s ~= EMPTY
+     ==> (P::('a => bool) => 'b => bool) (REST s)
+          ((f::'a => 'b => 'b) (CHOICE s) b))
+    ==> P s b)
+==> P (v::'a => bool) (x::'b)"
+  sorry
+
+lemma ITSET_THM: "FINITE s
+==> ITSET f s b =
+    (if s = EMPTY then b else ITSET f (REST s) (f (CHOICE s) b))"
+  sorry
+
+lemma ITSET_EMPTY: "ITSET (x::'a => 'b => 'b) EMPTY (xa::'b) = xa"
+  sorry
 
 ;end_setup
 
 ;setup_theory operator
 
-definition ASSOC :: "('a => 'a => 'a) => bool" where 
-  "ASSOC ==
-%f::'a::type => 'a::type => 'a::type.
-   ALL (x::'a::type) (y::'a::type) z::'a::type. f x (f y z) = f (f x y) z"
-
-lemma ASSOC_DEF: "ALL f::'a::type => 'a::type => 'a::type.
-   ASSOC f =
-   (ALL (x::'a::type) (y::'a::type) z::'a::type. f x (f y z) = f (f x y) z)"
-  by (import operator ASSOC_DEF)
-
-definition COMM :: "('a => 'a => 'b) => bool" where 
-  "COMM ==
-%f::'a::type => 'a::type => 'b::type.
-   ALL (x::'a::type) y::'a::type. f x y = f y x"
-
-lemma COMM_DEF: "ALL f::'a::type => 'a::type => 'b::type.
-   COMM f = (ALL (x::'a::type) y::'a::type. f x y = f y x)"
-  by (import operator COMM_DEF)
-
-definition FCOMM :: "('a => 'b => 'a) => ('c => 'a => 'a) => bool" where 
-  "FCOMM ==
-%(f::'a::type => 'b::type => 'a::type) g::'c::type => 'a::type => 'a::type.
-   ALL (x::'c::type) (y::'a::type) z::'b::type. g x (f y z) = f (g x y) z"
-
-lemma FCOMM_DEF: "ALL (f::'a::type => 'b::type => 'a::type)
-   g::'c::type => 'a::type => 'a::type.
-   FCOMM f g =
-   (ALL (x::'c::type) (y::'a::type) z::'b::type. g x (f y z) = f (g x y) z)"
-  by (import operator FCOMM_DEF)
-
-definition RIGHT_ID :: "('a => 'b => 'a) => 'b => bool" where 
-  "RIGHT_ID ==
-%(f::'a::type => 'b::type => 'a::type) e::'b::type.
-   ALL x::'a::type. f x e = x"
-
-lemma RIGHT_ID_DEF: "ALL (f::'a::type => 'b::type => 'a::type) e::'b::type.
-   RIGHT_ID f e = (ALL x::'a::type. f x e = x)"
-  by (import operator RIGHT_ID_DEF)
-
-definition LEFT_ID :: "('a => 'b => 'b) => 'a => bool" where 
-  "LEFT_ID ==
-%(f::'a::type => 'b::type => 'b::type) e::'a::type.
-   ALL x::'b::type. f e x = x"
-
-lemma LEFT_ID_DEF: "ALL (f::'a::type => 'b::type => 'b::type) e::'a::type.
-   LEFT_ID f e = (ALL x::'b::type. f e x = x)"
-  by (import operator LEFT_ID_DEF)
-
-definition MONOID :: "('a => 'a => 'a) => 'a => bool" where 
-  "MONOID ==
-%(f::'a::type => 'a::type => 'a::type) e::'a::type.
-   ASSOC f & RIGHT_ID f e & LEFT_ID f e"
-
-lemma MONOID_DEF: "ALL (f::'a::type => 'a::type => 'a::type) e::'a::type.
-   MONOID f e = (ASSOC f & RIGHT_ID f e & LEFT_ID f e)"
-  by (import operator MONOID_DEF)
+definition
+  ASSOC :: "('a => 'a => 'a) => bool"  where
+  "ASSOC == %f. ALL x y z. f x (f y z) = f (f x y) z"
+
+lemma ASSOC_DEF: "ASSOC f = (ALL x y z. f x (f y z) = f (f x y) z)"
+  sorry
+
+definition
+  COMM :: "('a => 'a => 'b) => bool"  where
+  "COMM == %f. ALL x y. f x y = f y x"
+
+lemma COMM_DEF: "COMM f = (ALL x y. f x y = f y x)"
+  sorry
+
+definition
+  FCOMM :: "('a => 'b => 'a) => ('c => 'a => 'a) => bool"  where
+  "FCOMM == %f g. ALL x y z. g x (f y z) = f (g x y) z"
+
+lemma FCOMM_DEF: "FCOMM f g = (ALL x y z. g x (f y z) = f (g x y) z)"
+  sorry
+
+definition
+  RIGHT_ID :: "('a => 'b => 'a) => 'b => bool"  where
+  "RIGHT_ID == %f e. ALL x. f x e = x"
+
+lemma RIGHT_ID_DEF: "RIGHT_ID f e = (ALL x. f x e = x)"
+  sorry
+
+definition
+  LEFT_ID :: "('a => 'b => 'b) => 'a => bool"  where
+  "LEFT_ID == %f e. ALL x. f e x = x"
+
+lemma LEFT_ID_DEF: "LEFT_ID f e = (ALL x. f e x = x)"
+  sorry
+
+definition
+  MONOID :: "('a => 'a => 'a) => 'a => bool"  where
+  "MONOID == %f e. ASSOC f & RIGHT_ID f e & LEFT_ID f e"
+
+lemma MONOID_DEF: "MONOID f e = (ASSOC f & RIGHT_ID f e & LEFT_ID f e)"
+  sorry
 
 lemma ASSOC_CONJ: "ASSOC op &"
-  by (import operator ASSOC_CONJ)
+  sorry
 
 lemma ASSOC_DISJ: "ASSOC op |"
-  by (import operator ASSOC_DISJ)
-
-lemma FCOMM_ASSOC: "ALL x::'a::type => 'a::type => 'a::type. FCOMM x x = ASSOC x"
-  by (import operator FCOMM_ASSOC)
+  sorry
+
+lemma FCOMM_ASSOC: "FCOMM x x = ASSOC x"
+  sorry
 
 lemma MONOID_CONJ_T: "MONOID op & True"
-  by (import operator MONOID_CONJ_T)
+  sorry
 
 lemma MONOID_DISJ_F: "MONOID op | False"
-  by (import operator MONOID_DISJ_F)
+  sorry
 
 ;end_setup
 
@@ -4574,1371 +3503,995 @@
 consts
   SNOC :: "'a => 'a list => 'a list" 
 
-specification (SNOC) SNOC: "(ALL x::'a::type. SNOC x [] = [x]) &
-(ALL (x::'a::type) (x'::'a::type) l::'a::type list.
-    SNOC x (x' # l) = x' # SNOC x l)"
-  by (import rich_list SNOC)
+specification (SNOC) SNOC: "(ALL x::'a. SNOC x [] = [x]) &
+(ALL (x::'a) (x'::'a) l::'a list. SNOC x (x' # l) = x' # SNOC x l)"
+  sorry
 
 consts
   SCANL :: "('b => 'a => 'b) => 'b => 'a list => 'b list" 
 
-specification (SCANL) SCANL: "(ALL (f::'b::type => 'a::type => 'b::type) e::'b::type.
-    SCANL f e [] = [e]) &
-(ALL (f::'b::type => 'a::type => 'b::type) (e::'b::type) (x::'a::type)
-    l::'a::type list. SCANL f e (x # l) = e # SCANL f (f e x) l)"
-  by (import rich_list SCANL)
+specification (SCANL) SCANL: "(ALL (f::'b => 'a => 'b) e::'b. SCANL f e [] = [e]) &
+(ALL (f::'b => 'a => 'b) (e::'b) (x::'a) l::'a list.
+    SCANL f e (x # l) = e # SCANL f (f e x) l)"
+  sorry
 
 consts
   SCANR :: "('a => 'b => 'b) => 'b => 'a list => 'b list" 
 
-specification (SCANR) SCANR: "(ALL (f::'a::type => 'b::type => 'b::type) e::'b::type.
-    SCANR f e [] = [e]) &
-(ALL (f::'a::type => 'b::type => 'b::type) (e::'b::type) (x::'a::type)
-    l::'a::type list.
+specification (SCANR) SCANR: "(ALL (f::'a => 'b => 'b) e::'b. SCANR f e [] = [e]) &
+(ALL (f::'a => 'b => 'b) (e::'b) (x::'a) l::'a list.
     SCANR f e (x # l) = f x (hd (SCANR f e l)) # SCANR f e l)"
-  by (import rich_list SCANR)
-
-lemma IS_EL_DEF: "ALL (x::'a::type) l::'a::type list. x mem l = list_ex (op = x) l"
-  by (import rich_list IS_EL_DEF)
-
-definition AND_EL :: "bool list => bool" where 
+  sorry
+
+lemma IS_EL_DEF: "List.member l x = list_ex (op = x) l"
+  sorry
+
+definition
+  AND_EL :: "bool list => bool"  where
   "AND_EL == list_all I"
 
 lemma AND_EL_DEF: "AND_EL = list_all I"
-  by (import rich_list AND_EL_DEF)
-
-definition OR_EL :: "bool list => bool" where 
+  sorry
+
+definition
+  OR_EL :: "bool list => bool"  where
   "OR_EL == list_ex I"
 
 lemma OR_EL_DEF: "OR_EL = list_ex I"
-  by (import rich_list OR_EL_DEF)
+  sorry
 
 consts
   FIRSTN :: "nat => 'a list => 'a list" 
 
-specification (FIRSTN) FIRSTN: "(ALL l::'a::type list. FIRSTN 0 l = []) &
-(ALL (n::nat) (x::'a::type) l::'a::type list.
-    FIRSTN (Suc n) (x # l) = x # FIRSTN n l)"
-  by (import rich_list FIRSTN)
+specification (FIRSTN) FIRSTN: "(ALL l::'a list. FIRSTN (0::nat) l = []) &
+(ALL (n::nat) (x::'a) l::'a list. FIRSTN (Suc n) (x # l) = x # FIRSTN n l)"
+  sorry
 
 consts
   BUTFIRSTN :: "nat => 'a list => 'a list" 
 
-specification (BUTFIRSTN) BUTFIRSTN: "(ALL l::'a::type list. BUTFIRSTN 0 l = l) &
-(ALL (n::nat) (x::'a::type) l::'a::type list.
-    BUTFIRSTN (Suc n) (x # l) = BUTFIRSTN n l)"
-  by (import rich_list BUTFIRSTN)
+specification (BUTFIRSTN) BUTFIRSTN: "(ALL l::'a list. BUTFIRSTN (0::nat) l = l) &
+(ALL (n::nat) (x::'a) l::'a list. BUTFIRSTN (Suc n) (x # l) = BUTFIRSTN n l)"
+  sorry
 
 consts
   SEG :: "nat => nat => 'a list => 'a list" 
 
-specification (SEG) SEG: "(ALL (k::nat) l::'a::type list. SEG 0 k l = []) &
-(ALL (m::nat) (x::'a::type) l::'a::type list.
-    SEG (Suc m) 0 (x # l) = x # SEG m 0 l) &
-(ALL (m::nat) (k::nat) (x::'a::type) l::'a::type list.
+specification (SEG) SEG: "(ALL (k::nat) l::'a list. SEG (0::nat) k l = []) &
+(ALL (m::nat) (x::'a) l::'a list.
+    SEG (Suc m) (0::nat) (x # l) = x # SEG m (0::nat) l) &
+(ALL (m::nat) (k::nat) (x::'a) l::'a list.
     SEG (Suc m) (Suc k) (x # l) = SEG (Suc m) k l)"
-  by (import rich_list SEG)
-
-lemma LAST: "ALL (x::'a::type) l::'a::type list. last (SNOC x l) = x"
-  by (import rich_list LAST)
-
-lemma BUTLAST: "ALL (x::'a::type) l::'a::type list. butlast (SNOC x l) = l"
-  by (import rich_list BUTLAST)
+  sorry
+
+lemma LAST: "last (SNOC x l) = x"
+  sorry
+
+lemma BUTLAST: "butlast (SNOC x l) = l"
+  sorry
 
 consts
   LASTN :: "nat => 'a list => 'a list" 
 
-specification (LASTN) LASTN: "(ALL l::'a::type list. LASTN 0 l = []) &
-(ALL (n::nat) (x::'a::type) l::'a::type list.
+specification (LASTN) LASTN: "(ALL l::'a list. LASTN (0::nat) l = []) &
+(ALL (n::nat) (x::'a) l::'a list.
     LASTN (Suc n) (SNOC x l) = SNOC x (LASTN n l))"
-  by (import rich_list LASTN)
+  sorry
 
 consts
   BUTLASTN :: "nat => 'a list => 'a list" 
 
-specification (BUTLASTN) BUTLASTN: "(ALL l::'a::type list. BUTLASTN 0 l = l) &
-(ALL (n::nat) (x::'a::type) l::'a::type list.
+specification (BUTLASTN) BUTLASTN: "(ALL l::'a list. BUTLASTN (0::nat) l = l) &
+(ALL (n::nat) (x::'a) l::'a list.
     BUTLASTN (Suc n) (SNOC x l) = BUTLASTN n l)"
-  by (import rich_list BUTLASTN)
-
-lemma EL: "(ALL x::'a::type list. EL 0 x = hd x) &
-(ALL (x::nat) xa::'a::type list. EL (Suc x) xa = EL x (tl xa))"
-  by (import rich_list EL)
+  sorry
+
+lemma EL: "(ALL x::'a list. EL (0::nat) x = hd x) &
+(ALL (x::nat) xa::'a list. EL (Suc x) xa = EL x (tl xa))"
+  sorry
 
 consts
   ELL :: "nat => 'a list => 'a" 
 
-specification (ELL) ELL: "(ALL l::'a::type list. ELL 0 l = last l) &
-(ALL (n::nat) l::'a::type list. ELL (Suc n) l = ELL n (butlast l))"
-  by (import rich_list ELL)
+specification (ELL) ELL: "(ALL l::'a list. ELL (0::nat) l = last l) &
+(ALL (n::nat) l::'a list. ELL (Suc n) l = ELL n (butlast l))"
+  sorry
 
 consts
   IS_PREFIX :: "'a list => 'a list => bool" 
 
-specification (IS_PREFIX) IS_PREFIX: "(ALL l::'a::type list. IS_PREFIX l [] = True) &
-(ALL (x::'a::type) l::'a::type list. IS_PREFIX [] (x # l) = False) &
-(ALL (x1::'a::type) (l1::'a::type list) (x2::'a::type) l2::'a::type list.
+specification (IS_PREFIX) IS_PREFIX: "(ALL l::'a list. IS_PREFIX l [] = True) &
+(ALL (x::'a) l::'a list. IS_PREFIX [] (x # l) = False) &
+(ALL (x1::'a) (l1::'a list) (x2::'a) l2::'a list.
     IS_PREFIX (x1 # l1) (x2 # l2) = (x1 = x2 & IS_PREFIX l1 l2))"
-  by (import rich_list IS_PREFIX)
-
-lemma SNOC_APPEND: "ALL (x::'a::type) l::'a::type list. SNOC x l = l @ [x]"
-  by (import rich_list SNOC_APPEND)
-
-lemma REVERSE: "rev [] = [] &
-(ALL (x::'a::type) xa::'a::type list. rev (x # xa) = SNOC x (rev xa))"
-  by (import rich_list REVERSE)
-
-lemma REVERSE_SNOC: "ALL (x::'a::type) l::'a::type list. rev (SNOC x l) = x # rev l"
-  by (import rich_list REVERSE_SNOC)
-
-lemma SNOC_Axiom: "ALL (e::'b::type) f::'a::type => 'a::type list => 'b::type => 'b::type.
-   EX x::'a::type list => 'b::type.
-      x [] = e &
-      (ALL (xa::'a::type) l::'a::type list. x (SNOC xa l) = f xa l (x l))"
-  by (import rich_list SNOC_Axiom)
+  sorry
+
+lemma SNOC_APPEND: "SNOC x l = l @ [x]"
+  sorry
+
+lemma REVERSE: "rev [] = [] & (ALL (x::'a) xa::'a list. rev (x # xa) = SNOC x (rev xa))"
+  sorry
+
+lemma REVERSE_SNOC: "rev (SNOC x l) = x # rev l"
+  sorry
+
+lemma SNOC_Axiom: "EX x. x [] = e & (ALL xa l. x (SNOC xa l) = f xa l (x l))"
+  sorry
 
 consts
   IS_SUFFIX :: "'a list => 'a list => bool" 
 
-specification (IS_SUFFIX) IS_SUFFIX: "(ALL l::'a::type list. IS_SUFFIX l [] = True) &
-(ALL (x::'a::type) l::'a::type list. IS_SUFFIX [] (SNOC x l) = False) &
-(ALL (x1::'a::type) (l1::'a::type list) (x2::'a::type) l2::'a::type list.
+specification (IS_SUFFIX) IS_SUFFIX: "(ALL l::'a list. IS_SUFFIX l [] = True) &
+(ALL (x::'a) l::'a list. IS_SUFFIX [] (SNOC x l) = False) &
+(ALL (x1::'a) (l1::'a list) (x2::'a) l2::'a list.
     IS_SUFFIX (SNOC x1 l1) (SNOC x2 l2) = (x1 = x2 & IS_SUFFIX l1 l2))"
-  by (import rich_list IS_SUFFIX)
+  sorry
 
 consts
   IS_SUBLIST :: "'a list => 'a list => bool" 
 
-specification (IS_SUBLIST) IS_SUBLIST: "(ALL l::'a::type list. IS_SUBLIST l [] = True) &
-(ALL (x::'a::type) l::'a::type list. IS_SUBLIST [] (x # l) = False) &
-(ALL (x1::'a::type) (l1::'a::type list) (x2::'a::type) l2::'a::type list.
+specification (IS_SUBLIST) IS_SUBLIST: "(ALL l::'a list. IS_SUBLIST l [] = True) &
+(ALL (x::'a) l::'a list. IS_SUBLIST [] (x # l) = False) &
+(ALL (x1::'a) (l1::'a list) (x2::'a) l2::'a list.
     IS_SUBLIST (x1 # l1) (x2 # l2) =
     (x1 = x2 & IS_PREFIX l1 l2 | IS_SUBLIST l1 (x2 # l2)))"
-  by (import rich_list IS_SUBLIST)
+  sorry
 
 consts
   SPLITP :: "('a => bool) => 'a list => 'a list * 'a list" 
 
-specification (SPLITP) SPLITP: "(ALL P::'a::type => bool. SPLITP P [] = ([], [])) &
-(ALL (P::'a::type => bool) (x::'a::type) l::'a::type list.
+specification (SPLITP) SPLITP: "(ALL P::'a => bool. SPLITP P [] = ([], [])) &
+(ALL (P::'a => bool) (x::'a) l::'a list.
     SPLITP P (x # l) =
     (if P x then ([], x # l) else (x # fst (SPLITP P l), snd (SPLITP P l))))"
-  by (import rich_list SPLITP)
-
-definition PREFIX :: "('a => bool) => 'a list => 'a list" where 
-  "PREFIX == %(P::'a::type => bool) l::'a::type list. fst (SPLITP (Not o P) l)"
-
-lemma PREFIX_DEF: "ALL (P::'a::type => bool) l::'a::type list.
-   PREFIX P l = fst (SPLITP (Not o P) l)"
-  by (import rich_list PREFIX_DEF)
-
-definition SUFFIX :: "('a => bool) => 'a list => 'a list" where 
-  "SUFFIX ==
-%P::'a::type => bool.
-   foldl (%(l'::'a::type list) x::'a::type. if P x then SNOC x l' else [])
-    []"
-
-lemma SUFFIX_DEF: "ALL (P::'a::type => bool) l::'a::type list.
-   SUFFIX P l =
-   foldl (%(l'::'a::type list) x::'a::type. if P x then SNOC x l' else [])
-    [] l"
-  by (import rich_list SUFFIX_DEF)
-
-definition UNZIP_FST :: "('a * 'b) list => 'a list" where 
-  "UNZIP_FST == %l::('a::type * 'b::type) list. fst (unzip l)"
-
-lemma UNZIP_FST_DEF: "ALL l::('a::type * 'b::type) list. UNZIP_FST l = fst (unzip l)"
-  by (import rich_list UNZIP_FST_DEF)
-
-definition UNZIP_SND :: "('a * 'b) list => 'b list" where 
-  "UNZIP_SND == %l::('a::type * 'b::type) list. snd (unzip l)"
-
-lemma UNZIP_SND_DEF: "ALL l::('a::type * 'b::type) list. UNZIP_SND l = snd (unzip l)"
-  by (import rich_list UNZIP_SND_DEF)
+  sorry
+
+definition
+  PREFIX :: "('a => bool) => 'a list => 'a list"  where
+  "PREFIX == %P l. fst (SPLITP (Not o P) l)"
+
+lemma PREFIX_DEF: "PREFIX P l = fst (SPLITP (Not o P) l)"
+  sorry
+
+definition
+  SUFFIX :: "('a => bool) => 'a list => 'a list"  where
+  "SUFFIX == %P. foldl (%l' x. if P x then SNOC x l' else []) []"
+
+lemma SUFFIX_DEF: "SUFFIX P l = foldl (%l' x. if P x then SNOC x l' else []) [] l"
+  sorry
+
+definition
+  UNZIP_FST :: "('a * 'b) list => 'a list"  where
+  "UNZIP_FST == %l. fst (unzip l)"
+
+lemma UNZIP_FST_DEF: "UNZIP_FST l = fst (unzip l)"
+  sorry
+
+definition
+  UNZIP_SND :: "('a * 'b) list => 'b list"  where
+  "UNZIP_SND == %l. snd (unzip l)"
+
+lemma UNZIP_SND_DEF: "UNZIP_SND (l::('a * 'b) list) = snd (unzip l)"
+  sorry
 
 consts
   GENLIST :: "(nat => 'a) => nat => 'a list" 
 
-specification (GENLIST) GENLIST: "(ALL f::nat => 'a::type. GENLIST f 0 = []) &
-(ALL (f::nat => 'a::type) n::nat.
-    GENLIST f (Suc n) = SNOC (f n) (GENLIST f n))"
-  by (import rich_list GENLIST)
+specification (GENLIST) GENLIST: "(ALL f::nat => 'a. GENLIST f (0::nat) = []) &
+(ALL (f::nat => 'a) n::nat. GENLIST f (Suc n) = SNOC (f n) (GENLIST f n))"
+  sorry
 
 consts
   REPLICATE :: "nat => 'a => 'a list" 
 
-specification (REPLICATE) REPLICATE: "(ALL x::'a::type. REPLICATE 0 x = []) &
-(ALL (n::nat) x::'a::type. REPLICATE (Suc n) x = x # REPLICATE n x)"
-  by (import rich_list REPLICATE)
-
-lemma LENGTH_MAP2: "ALL (l1::'a::type list) l2::'b::type list.
-   length l1 = length l2 -->
-   (ALL f::'a::type => 'b::type => 'c::type.
-       length (map2 f l1 l2) = length l1 &
-       length (map2 f l1 l2) = length l2)"
-  by (import rich_list LENGTH_MAP2)
-
-lemma NULL_EQ_NIL: "ALL l::'a::type list. null l = (l = [])"
-  by (import rich_list NULL_EQ_NIL)
-
-lemma LENGTH_EQ: "ALL (x::'a::type list) y::'a::type list. x = y --> length x = length y"
-  by (import rich_list LENGTH_EQ)
-
-lemma LENGTH_NOT_NULL: "ALL l::'a::type list. (0 < length l) = (~ null l)"
-  by (import rich_list LENGTH_NOT_NULL)
-
-lemma SNOC_INDUCT: "ALL P::'a::type list => bool.
-   P [] &
-   (ALL l::'a::type list. P l --> (ALL x::'a::type. P (SNOC x l))) -->
-   All P"
-  by (import rich_list SNOC_INDUCT)
-
-lemma SNOC_CASES: "ALL x'::'a::type list.
-   x' = [] | (EX (x::'a::type) l::'a::type list. x' = SNOC x l)"
-  by (import rich_list SNOC_CASES)
-
-lemma LENGTH_SNOC: "ALL (x::'a::type) l::'a::type list. length (SNOC x l) = Suc (length l)"
-  by (import rich_list LENGTH_SNOC)
-
-lemma NOT_NIL_SNOC: "ALL (x::'a::type) xa::'a::type list. [] ~= SNOC x xa"
-  by (import rich_list NOT_NIL_SNOC)
-
-lemma NOT_SNOC_NIL: "ALL (x::'a::type) xa::'a::type list. SNOC x xa ~= []"
-  by (import rich_list NOT_SNOC_NIL)
-
-lemma SNOC_11: "ALL (x::'a::type) (l::'a::type list) (x'::'a::type) l'::'a::type list.
-   (SNOC x l = SNOC x' l') = (x = x' & l = l')"
-  by (import rich_list SNOC_11)
-
-lemma SNOC_EQ_LENGTH_EQ: "ALL (x1::'a::type) (l1::'a::type list) (x2::'a::type) l2::'a::type list.
-   SNOC x1 l1 = SNOC x2 l2 --> length l1 = length l2"
-  by (import rich_list SNOC_EQ_LENGTH_EQ)
-
-lemma SNOC_REVERSE_CONS: "ALL (x::'a::type) xa::'a::type list. SNOC x xa = rev (x # rev xa)"
-  by (import rich_list SNOC_REVERSE_CONS)
-
-lemma MAP_SNOC: "ALL (x::'a::type => 'b::type) (xa::'a::type) xb::'a::type list.
-   map x (SNOC xa xb) = SNOC (x xa) (map x xb)"
-  by (import rich_list MAP_SNOC)
-
-lemma FOLDR_SNOC: "ALL (f::'a::type => 'b::type => 'b::type) (e::'b::type) (x::'a::type)
-   l::'a::type list. foldr f (SNOC x l) e = foldr f l (f x e)"
-  by (import rich_list FOLDR_SNOC)
-
-lemma FOLDL_SNOC: "ALL (f::'b::type => 'a::type => 'b::type) (e::'b::type) (x::'a::type)
-   l::'a::type list. foldl f e (SNOC x l) = f (foldl f e l) x"
-  by (import rich_list FOLDL_SNOC)
-
-lemma FOLDR_FOLDL: "ALL (f::'a::type => 'a::type => 'a::type) e::'a::type.
-   MONOID f e --> (ALL l::'a::type list. foldr f l e = foldl f e l)"
-  by (import rich_list FOLDR_FOLDL)
-
-lemma LENGTH_FOLDR: "ALL l::'a::type list. length l = foldr (%x::'a::type. Suc) l 0"
-  by (import rich_list LENGTH_FOLDR)
-
-lemma LENGTH_FOLDL: "ALL l::'a::type list. length l = foldl (%(l'::nat) x::'a::type. Suc l') 0 l"
-  by (import rich_list LENGTH_FOLDL)
-
-lemma MAP_FOLDR: "ALL (f::'a::type => 'b::type) l::'a::type list.
-   map f l = foldr (%x::'a::type. op # (f x)) l []"
-  by (import rich_list MAP_FOLDR)
-
-lemma MAP_FOLDL: "ALL (f::'a::type => 'b::type) l::'a::type list.
-   map f l = foldl (%(l'::'b::type list) x::'a::type. SNOC (f x) l') [] l"
-  by (import rich_list MAP_FOLDL)
-
-lemma MAP_o: "ALL (f::'b::type => 'c::type) g::'a::type => 'b::type.
-   map (f o g) = map f o map g"
-  by (import rich_list MAP_o)
-
-lemma FILTER_FOLDR: "ALL (P::'a::type => bool) l::'a::type list.
-   filter P l =
-   foldr (%(x::'a::type) l'::'a::type list. if P x then x # l' else l') l []"
-  by (import rich_list FILTER_FOLDR)
-
-lemma FILTER_SNOC: "ALL (P::'a::type => bool) (x::'a::type) l::'a::type list.
-   filter P (SNOC x l) = (if P x then SNOC x (filter P l) else filter P l)"
-  by (import rich_list FILTER_SNOC)
-
-lemma FILTER_FOLDL: "ALL (P::'a::type => bool) l::'a::type list.
-   filter P l =
-   foldl (%(l'::'a::type list) x::'a::type. if P x then SNOC x l' else l')
-    [] l"
-  by (import rich_list FILTER_FOLDL)
-
-lemma FILTER_COMM: "ALL (f1::'a::type => bool) (f2::'a::type => bool) l::'a::type list.
-   filter f1 (filter f2 l) = filter f2 (filter f1 l)"
-  by (import rich_list FILTER_COMM)
-
-lemma FILTER_IDEM: "ALL (f::'a::type => bool) l::'a::type list.
-   filter f (filter f l) = filter f l"
-  by (import rich_list FILTER_IDEM)
-
-lemma LENGTH_SEG: "ALL (n::nat) (k::nat) l::'a::type list.
-   n + k <= length l --> length (SEG n k l) = n"
-  by (import rich_list LENGTH_SEG)
-
-lemma APPEND_NIL: "(ALL l::'a::type list. l @ [] = l) & (ALL x::'a::type list. [] @ x = x)"
-  by (import rich_list APPEND_NIL)
-
-lemma APPEND_SNOC: "ALL (l1::'a::type list) (x::'a::type) l2::'a::type list.
-   l1 @ SNOC x l2 = SNOC x (l1 @ l2)"
-  by (import rich_list APPEND_SNOC)
-
-lemma APPEND_FOLDR: "ALL (l1::'a::type list) l2::'a::type list. l1 @ l2 = foldr op # l1 l2"
-  by (import rich_list APPEND_FOLDR)
-
-lemma APPEND_FOLDL: "ALL (l1::'a::type list) l2::'a::type list.
-   l1 @ l2 = foldl (%(l'::'a::type list) x::'a::type. SNOC x l') l1 l2"
-  by (import rich_list APPEND_FOLDL)
-
-lemma CONS_APPEND: "ALL (x::'a::type) l::'a::type list. x # l = [x] @ l"
-  by (import rich_list CONS_APPEND)
+specification (REPLICATE) REPLICATE: "(ALL x::'a. REPLICATE (0::nat) x = []) &
+(ALL (n::nat) x::'a. REPLICATE (Suc n) x = x # REPLICATE n x)"
+  sorry
+
+lemma LENGTH_MAP2: "length l1 = length l2
+==> length (map2 f l1 l2) = length l1 & length (map2 f l1 l2) = length l2"
+  sorry
+
+lemma LENGTH_EQ: "x = y ==> length x = length y"
+  sorry
+
+lemma LENGTH_NOT_NULL: "(0 < length l) = (~ List.null l)"
+  sorry
+
+lemma SNOC_INDUCT: "P [] & (ALL l. P l --> (ALL x. P (SNOC x l))) ==> P x"
+  sorry
+
+lemma SNOC_CASES: "x' = [] | (EX x l. x' = SNOC x l)"
+  sorry
+
+lemma LENGTH_SNOC: "length (SNOC x l) = Suc (length l)"
+  sorry
+
+lemma NOT_NIL_SNOC: "[] ~= SNOC x xa"
+  sorry
+
+lemma NOT_SNOC_NIL: "SNOC x xa ~= []"
+  sorry
+
+lemma SNOC_11: "(SNOC x l = SNOC x' l') = (x = x' & l = l')"
+  sorry
+
+lemma SNOC_EQ_LENGTH_EQ: "SNOC x1 l1 = SNOC x2 l2 ==> length l1 = length l2"
+  sorry
+
+lemma SNOC_REVERSE_CONS: "SNOC x xa = rev (x # rev xa)"
+  sorry
+
+lemma MAP_SNOC: "map (x::'a => 'b) (SNOC (xa::'a) (xb::'a list)) = SNOC (x xa) (map x xb)"
+  sorry
+
+lemma FOLDR_SNOC: "foldr (f::'a => 'b => 'b) (SNOC (x::'a) (l::'a list)) (e::'b) =
+foldr f l (f x e)"
+  sorry
+
+lemma FOLDL_SNOC: "foldl (f::'b => 'a => 'b) (e::'b) (SNOC (x::'a) (l::'a list)) =
+f (foldl f e l) x"
+  sorry
+
+lemma FOLDR_FOLDL: "MONOID f e ==> foldr f l e = foldl f e l"
+  sorry
+
+lemma LENGTH_FOLDR: "length l = foldr (%x. Suc) l 0"
+  sorry
+
+lemma LENGTH_FOLDL: "length l = foldl (%l' x. Suc l') 0 l"
+  sorry
+
+lemma MAP_FOLDR: "map (f::'a => 'b) (l::'a list) = foldr (%x::'a. op # (f x)) l []"
+  sorry
+
+lemma MAP_FOLDL: "map (f::'a => 'b) (l::'a list) =
+foldl (%(l'::'b list) x::'a. SNOC (f x) l') [] l"
+  sorry
+
+lemma FILTER_FOLDR: "filter P l = foldr (%x l'. if P x then x # l' else l') l []"
+  sorry
+
+lemma FILTER_SNOC: "filter P (SNOC x l) = (if P x then SNOC x (filter P l) else filter P l)"
+  sorry
+
+lemma FILTER_FOLDL: "filter P l = foldl (%l' x. if P x then SNOC x l' else l') [] l"
+  sorry
+
+lemma FILTER_COMM: "filter f1 (filter f2 l) = filter f2 (filter f1 l)"
+  sorry
+
+lemma FILTER_IDEM: "filter f (filter f l) = filter f l"
+  sorry
+
+lemma LENGTH_SEG: "n + k <= length l ==> length (SEG n k l) = n"
+  sorry
+
+lemma APPEND_NIL: "(ALL l::'a list. l @ [] = l) & (ALL x::'a list. [] @ x = x)"
+  sorry
+
+lemma APPEND_SNOC: "l1 @ SNOC x l2 = SNOC x (l1 @ l2)"
+  sorry
+
+lemma APPEND_FOLDR: "l1 @ l2 = foldr op # l1 l2"
+  sorry
+
+lemma APPEND_FOLDL: "l1 @ l2 = foldl (%l' x. SNOC x l') l1 l2"
+  sorry
+
+lemma CONS_APPEND: "x # l = [x] @ l"
+  sorry
 
 lemma ASSOC_APPEND: "ASSOC op @"
-  by (import rich_list ASSOC_APPEND)
+  sorry
 
 lemma MONOID_APPEND_NIL: "MONOID op @ []"
-  by (import rich_list MONOID_APPEND_NIL)
-
-lemma APPEND_LENGTH_EQ: "ALL (l1::'a::type list) l1'::'a::type list.
-   length l1 = length l1' -->
-   (ALL (l2::'a::type list) l2'::'a::type list.
-       length l2 = length l2' -->
-       (l1 @ l2 = l1' @ l2') = (l1 = l1' & l2 = l2'))"
-  by (import rich_list APPEND_LENGTH_EQ)
-
-lemma FLAT_SNOC: "ALL (x::'a::type list) l::'a::type list list.
-   concat (SNOC x l) = concat l @ x"
-  by (import rich_list FLAT_SNOC)
-
-lemma FLAT_FOLDR: "ALL l::'a::type list list. concat l = foldr op @ l []"
-  by (import rich_list FLAT_FOLDR)
-
-lemma FLAT_FOLDL: "ALL l::'a::type list list. concat l = foldl op @ [] l"
-  by (import rich_list FLAT_FOLDL)
-
-lemma LENGTH_FLAT: "ALL l::'a::type list list. length (concat l) = sum (map size l)"
-  by (import rich_list LENGTH_FLAT)
-
-lemma REVERSE_FOLDR: "ALL l::'a::type list. rev l = foldr SNOC l []"
-  by (import rich_list REVERSE_FOLDR)
-
-lemma REVERSE_FOLDL: "ALL l::'a::type list.
-   rev l = foldl (%(l'::'a::type list) x::'a::type. x # l') [] l"
-  by (import rich_list REVERSE_FOLDL)
-
-lemma ALL_EL_SNOC: "ALL (P::'a::type => bool) (x::'a::type) l::'a::type list.
-   list_all P (SNOC x l) = (list_all P l & P x)"
-  by (import rich_list ALL_EL_SNOC)
-
-lemma ALL_EL_MAP: "ALL (P::'b::type => bool) (f::'a::type => 'b::type) l::'a::type list.
-   list_all P (map f l) = list_all (P o f) l"
-  by (import rich_list ALL_EL_MAP)
-
-lemma SOME_EL_SNOC: "ALL (P::'a::type => bool) (x::'a::type) l::'a::type list.
-   list_ex P (SNOC x l) = (P x | list_ex P l)"
-  by (import rich_list SOME_EL_SNOC)
-
-lemma IS_EL_SNOC: "ALL (y::'a::type) (x::'a::type) l::'a::type list.
-   y mem SNOC x l = (y = x | y mem l)"
-  by (import rich_list IS_EL_SNOC)
-
-lemma SUM_SNOC: "ALL (x::nat) l::nat list. sum (SNOC x l) = sum l + x"
-  by (import rich_list SUM_SNOC)
-
-lemma SUM_FOLDL: "ALL l::nat list. sum l = foldl op + 0 l"
-  by (import rich_list SUM_FOLDL)
-
-lemma IS_PREFIX_APPEND: "ALL (l1::'a::type list) l2::'a::type list.
-   IS_PREFIX l1 l2 = (EX l::'a::type list. l1 = l2 @ l)"
-  by (import rich_list IS_PREFIX_APPEND)
-
-lemma IS_SUFFIX_APPEND: "ALL (l1::'a::type list) l2::'a::type list.
-   IS_SUFFIX l1 l2 = (EX l::'a::type list. l1 = l @ l2)"
-  by (import rich_list IS_SUFFIX_APPEND)
-
-lemma IS_SUBLIST_APPEND: "ALL (l1::'a::type list) l2::'a::type list.
-   IS_SUBLIST l1 l2 =
-   (EX (l::'a::type list) l'::'a::type list. l1 = l @ l2 @ l')"
-  by (import rich_list IS_SUBLIST_APPEND)
-
-lemma IS_PREFIX_IS_SUBLIST: "ALL (l1::'a::type list) l2::'a::type list.
-   IS_PREFIX l1 l2 --> IS_SUBLIST l1 l2"
-  by (import rich_list IS_PREFIX_IS_SUBLIST)
-
-lemma IS_SUFFIX_IS_SUBLIST: "ALL (l1::'a::type list) l2::'a::type list.
-   IS_SUFFIX l1 l2 --> IS_SUBLIST l1 l2"
-  by (import rich_list IS_SUFFIX_IS_SUBLIST)
-
-lemma IS_PREFIX_REVERSE: "ALL (l1::'a::type list) l2::'a::type list.
-   IS_PREFIX (rev l1) (rev l2) = IS_SUFFIX l1 l2"
-  by (import rich_list IS_PREFIX_REVERSE)
-
-lemma IS_SUFFIX_REVERSE: "ALL (l2::'a::type list) l1::'a::type list.
-   IS_SUFFIX (rev l1) (rev l2) = IS_PREFIX l1 l2"
-  by (import rich_list IS_SUFFIX_REVERSE)
-
-lemma IS_SUBLIST_REVERSE: "ALL (l1::'a::type list) l2::'a::type list.
-   IS_SUBLIST (rev l1) (rev l2) = IS_SUBLIST l1 l2"
-  by (import rich_list IS_SUBLIST_REVERSE)
-
-lemma PREFIX_FOLDR: "ALL (P::'a::type => bool) x::'a::type list.
-   PREFIX P x =
-   foldr (%(x::'a::type) l'::'a::type list. if P x then x # l' else []) x []"
-  by (import rich_list PREFIX_FOLDR)
-
-lemma PREFIX: "(ALL x::'a::type => bool. PREFIX x [] = []) &
-(ALL (x::'a::type => bool) (xa::'a::type) xb::'a::type list.
+  sorry
+
+lemma APPEND_LENGTH_EQ: "[| length l1 = length l1'; length l2 = length l2' |]
+==> (l1 @ l2 = l1' @ l2') = (l1 = l1' & l2 = l2')"
+  sorry
+
+lemma FLAT_SNOC: "concat (SNOC x l) = concat l @ x"
+  sorry
+
+lemma FLAT_FOLDR: "concat l = foldr op @ l []"
+  sorry
+
+lemma LENGTH_FLAT: "length (concat l) = HOL4Compat.sum (map length l)"
+  sorry
+
+lemma REVERSE_FOLDR: "rev l = foldr SNOC l []"
+  sorry
+
+lemma ALL_EL_SNOC: "list_all P (SNOC x l) = (list_all P l & P x)"
+  sorry
+
+lemma ALL_EL_MAP: "list_all (P::'b => bool) (map (f::'a => 'b) (l::'a list)) =
+list_all (P o f) l"
+  sorry
+
+lemma SOME_EL_SNOC: "list_ex P (SNOC x l) = (P x | list_ex P l)"
+  sorry
+
+lemma IS_EL_SNOC: "List.member (SNOC x l) y = (y = x | List.member l y)"
+  sorry
+
+lemma SUM_SNOC: "HOL4Compat.sum (SNOC x l) = HOL4Compat.sum l + x"
+  sorry
+
+lemma SUM_FOLDL: "HOL4Compat.sum l = foldl op + 0 l"
+  sorry
+
+lemma IS_PREFIX_APPEND: "IS_PREFIX l1 l2 = (EX l. l1 = l2 @ l)"
+  sorry
+
+lemma IS_SUFFIX_APPEND: "IS_SUFFIX l1 l2 = (EX l. l1 = l @ l2)"
+  sorry
+
+lemma IS_SUBLIST_APPEND: "IS_SUBLIST l1 l2 = (EX l l'. l1 = l @ l2 @ l')"
+  sorry
+
+lemma IS_PREFIX_IS_SUBLIST: "IS_PREFIX l1 l2 ==> IS_SUBLIST l1 l2"
+  sorry
+
+lemma IS_SUFFIX_IS_SUBLIST: "IS_SUFFIX l1 l2 ==> IS_SUBLIST l1 l2"
+  sorry
+
+lemma IS_PREFIX_REVERSE: "IS_PREFIX (rev l1) (rev l2) = IS_SUFFIX l1 l2"
+  sorry
+
+lemma IS_SUFFIX_REVERSE: "IS_SUFFIX (rev l1) (rev l2) = IS_PREFIX l1 l2"
+  sorry
+
+lemma IS_SUBLIST_REVERSE: "IS_SUBLIST (rev l1) (rev l2) = IS_SUBLIST l1 l2"
+  sorry
+
+lemma PREFIX_FOLDR: "PREFIX P x = foldr (%x l'. if P x then x # l' else []) x []"
+  sorry
+
+lemma PREFIX: "(ALL x::'a => bool. PREFIX x [] = []) &
+(ALL (x::'a => bool) (xa::'a) xb::'a list.
     PREFIX x (xa # xb) = (if x xa then xa # PREFIX x xb else []))"
-  by (import rich_list PREFIX)
-
-lemma IS_PREFIX_PREFIX: "ALL (P::'a::type => bool) l::'a::type list. IS_PREFIX l (PREFIX P l)"
-  by (import rich_list IS_PREFIX_PREFIX)
-
-lemma LENGTH_SCANL: "ALL (f::'b::type => 'a::type => 'b::type) (e::'b::type) l::'a::type list.
-   length (SCANL f e l) = Suc (length l)"
-  by (import rich_list LENGTH_SCANL)
-
-lemma LENGTH_SCANR: "ALL (f::'a::type => 'b::type => 'b::type) (e::'b::type) l::'a::type list.
-   length (SCANR f e l) = Suc (length l)"
-  by (import rich_list LENGTH_SCANR)
-
-lemma COMM_MONOID_FOLDL: "ALL x::'a::type => 'a::type => 'a::type.
-   COMM x -->
-   (ALL xa::'a::type.
-       MONOID x xa -->
-       (ALL (e::'a::type) l::'a::type list.
-           foldl x e l = x e (foldl x xa l)))"
-  by (import rich_list COMM_MONOID_FOLDL)
-
-lemma COMM_MONOID_FOLDR: "ALL x::'a::type => 'a::type => 'a::type.
-   COMM x -->
-   (ALL xa::'a::type.
-       MONOID x xa -->
-       (ALL (e::'a::type) l::'a::type list.
-           foldr x l e = x e (foldr x l xa)))"
-  by (import rich_list COMM_MONOID_FOLDR)
-
-lemma FCOMM_FOLDR_APPEND: "ALL (x::'a::type => 'a::type => 'a::type)
-   xa::'b::type => 'a::type => 'a::type.
-   FCOMM x xa -->
-   (ALL xb::'a::type.
-       LEFT_ID x xb -->
-       (ALL (l1::'b::type list) l2::'b::type list.
-           foldr xa (l1 @ l2) xb = x (foldr xa l1 xb) (foldr xa l2 xb)))"
-  by (import rich_list FCOMM_FOLDR_APPEND)
-
-lemma FCOMM_FOLDL_APPEND: "ALL (x::'a::type => 'b::type => 'a::type)
-   xa::'a::type => 'a::type => 'a::type.
-   FCOMM x xa -->
-   (ALL xb::'a::type.
-       RIGHT_ID xa xb -->
-       (ALL (l1::'b::type list) l2::'b::type list.
-           foldl x xb (l1 @ l2) = xa (foldl x xb l1) (foldl x xb l2)))"
-  by (import rich_list FCOMM_FOLDL_APPEND)
-
-lemma FOLDL_SINGLE: "ALL (x::'a::type => 'b::type => 'a::type) (xa::'a::type) xb::'b::type.
-   foldl x xa [xb] = x xa xb"
-  by (import rich_list FOLDL_SINGLE)
-
-lemma FOLDR_SINGLE: "ALL (x::'a::type => 'b::type => 'b::type) (xa::'b::type) xb::'a::type.
-   foldr x [xb] xa = x xb xa"
-  by (import rich_list FOLDR_SINGLE)
-
-lemma FOLDR_CONS_NIL: "ALL l::'a::type list. foldr op # l [] = l"
-  by (import rich_list FOLDR_CONS_NIL)
-
-lemma FOLDL_SNOC_NIL: "ALL l::'a::type list.
-   foldl (%(xs::'a::type list) x::'a::type. SNOC x xs) [] l = l"
-  by (import rich_list FOLDL_SNOC_NIL)
-
-lemma FOLDR_REVERSE: "ALL (x::'a::type => 'b::type => 'b::type) (xa::'b::type) xb::'a::type list.
-   foldr x (rev xb) xa = foldl (%(xa::'b::type) y::'a::type. x y xa) xa xb"
-  by (import rich_list FOLDR_REVERSE)
-
-lemma FOLDL_REVERSE: "ALL (x::'a::type => 'b::type => 'a::type) (xa::'a::type) xb::'b::type list.
-   foldl x xa (rev xb) = foldr (%(xa::'b::type) y::'a::type. x y xa) xb xa"
-  by (import rich_list FOLDL_REVERSE)
-
-lemma FOLDR_MAP: "ALL (f::'a::type => 'a::type => 'a::type) (e::'a::type)
-   (g::'b::type => 'a::type) l::'b::type list.
-   foldr f (map g l) e = foldr (%x::'b::type. f (g x)) l e"
-  by (import rich_list FOLDR_MAP)
-
-lemma FOLDL_MAP: "ALL (f::'a::type => 'a::type => 'a::type) (e::'a::type)
-   (g::'b::type => 'a::type) l::'b::type list.
-   foldl f e (map g l) = foldl (%(x::'a::type) y::'b::type. f x (g y)) e l"
-  by (import rich_list FOLDL_MAP)
-
-lemma ALL_EL_FOLDR: "ALL (P::'a::type => bool) l::'a::type list.
-   list_all P l = foldr (%x::'a::type. op & (P x)) l True"
-  by (import rich_list ALL_EL_FOLDR)
-
-lemma ALL_EL_FOLDL: "ALL (P::'a::type => bool) l::'a::type list.
-   list_all P l = foldl (%(l'::bool) x::'a::type. l' & P x) True l"
-  by (import rich_list ALL_EL_FOLDL)
-
-lemma SOME_EL_FOLDR: "ALL (P::'a::type => bool) l::'a::type list.
-   list_ex P l = foldr (%x::'a::type. op | (P x)) l False"
-  by (import rich_list SOME_EL_FOLDR)
-
-lemma SOME_EL_FOLDL: "ALL (P::'a::type => bool) l::'a::type list.
-   list_ex P l = foldl (%(l'::bool) x::'a::type. l' | P x) False l"
-  by (import rich_list SOME_EL_FOLDL)
-
-lemma ALL_EL_FOLDR_MAP: "ALL (x::'a::type => bool) xa::'a::type list.
-   list_all x xa = foldr op & (map x xa) True"
-  by (import rich_list ALL_EL_FOLDR_MAP)
-
-lemma ALL_EL_FOLDL_MAP: "ALL (x::'a::type => bool) xa::'a::type list.
-   list_all x xa = foldl op & True (map x xa)"
-  by (import rich_list ALL_EL_FOLDL_MAP)
-
-lemma SOME_EL_FOLDR_MAP: "ALL (x::'a::type => bool) xa::'a::type list.
-   list_ex x xa = foldr op | (map x xa) False"
-  by (import rich_list SOME_EL_FOLDR_MAP)
-
-lemma SOME_EL_FOLDL_MAP: "ALL (x::'a::type => bool) xa::'a::type list.
-   list_ex x xa = foldl op | False (map x xa)"
-  by (import rich_list SOME_EL_FOLDL_MAP)
-
-lemma FOLDR_FILTER: "ALL (f::'a::type => 'a::type => 'a::type) (e::'a::type)
-   (P::'a::type => bool) l::'a::type list.
-   foldr f (filter P l) e =
-   foldr (%(x::'a::type) y::'a::type. if P x then f x y else y) l e"
-  by (import rich_list FOLDR_FILTER)
-
-lemma FOLDL_FILTER: "ALL (f::'a::type => 'a::type => 'a::type) (e::'a::type)
-   (P::'a::type => bool) l::'a::type list.
-   foldl f e (filter P l) =
-   foldl (%(x::'a::type) y::'a::type. if P y then f x y else x) e l"
-  by (import rich_list FOLDL_FILTER)
-
-lemma ASSOC_FOLDR_FLAT: "ALL f::'a::type => 'a::type => 'a::type.
-   ASSOC f -->
-   (ALL e::'a::type.
-       LEFT_ID f e -->
-       (ALL l::'a::type list list.
-           foldr f (concat l) e = foldr f (map (FOLDR f e) l) e))"
-  by (import rich_list ASSOC_FOLDR_FLAT)
-
-lemma ASSOC_FOLDL_FLAT: "ALL f::'a::type => 'a::type => 'a::type.
-   ASSOC f -->
-   (ALL e::'a::type.
-       RIGHT_ID f e -->
-       (ALL l::'a::type list list.
-           foldl f e (concat l) = foldl f e (map (foldl f e) l)))"
-  by (import rich_list ASSOC_FOLDL_FLAT)
-
-lemma SOME_EL_MAP: "ALL (P::'b::type => bool) (f::'a::type => 'b::type) l::'a::type list.
-   list_ex P (map f l) = list_ex (P o f) l"
-  by (import rich_list SOME_EL_MAP)
-
-lemma SOME_EL_DISJ: "ALL (P::'a::type => bool) (Q::'a::type => bool) l::'a::type list.
-   list_ex (%x::'a::type. P x | Q x) l =
-   (list_ex P l | list_ex Q l)"
-  by (import rich_list SOME_EL_DISJ)
-
-lemma IS_EL_FOLDR: "ALL (x::'a::type) xa::'a::type list.
-   x mem xa = foldr (%xa::'a::type. op | (x = xa)) xa False"
-  by (import rich_list IS_EL_FOLDR)
-
-lemma IS_EL_FOLDL: "ALL (x::'a::type) xa::'a::type list.
-   x mem xa = foldl (%(l'::bool) xa::'a::type. l' | x = xa) False xa"
-  by (import rich_list IS_EL_FOLDL)
-
-lemma NULL_FOLDR: "ALL l::'a::type list. null l = foldr (%(x::'a::type) l'::bool. False) l True"
-  by (import rich_list NULL_FOLDR)
-
-lemma NULL_FOLDL: "ALL l::'a::type list. null l = foldl (%(x::bool) l'::'a::type. False) True l"
-  by (import rich_list NULL_FOLDL)
-
-lemma SEG_LENGTH_ID: "ALL l::'a::type list. SEG (length l) 0 l = l"
-  by (import rich_list SEG_LENGTH_ID)
-
-lemma SEG_SUC_CONS: "ALL (m::nat) (n::nat) (l::'a::type list) x::'a::type.
-   SEG m (Suc n) (x # l) = SEG m n l"
-  by (import rich_list SEG_SUC_CONS)
-
-lemma SEG_0_SNOC: "ALL (m::nat) (l::'a::type list) x::'a::type.
-   m <= length l --> SEG m 0 (SNOC x l) = SEG m 0 l"
-  by (import rich_list SEG_0_SNOC)
-
-lemma BUTLASTN_SEG: "ALL (n::nat) l::'a::type list.
-   n <= length l --> BUTLASTN n l = SEG (length l - n) 0 l"
-  by (import rich_list BUTLASTN_SEG)
-
-lemma LASTN_CONS: "ALL (n::nat) l::'a::type list.
-   n <= length l --> (ALL x::'a::type. LASTN n (x # l) = LASTN n l)"
-  by (import rich_list LASTN_CONS)
-
-lemma LENGTH_LASTN: "ALL (n::nat) l::'a::type list. n <= length l --> length (LASTN n l) = n"
-  by (import rich_list LENGTH_LASTN)
-
-lemma LASTN_LENGTH_ID: "ALL l::'a::type list. LASTN (length l) l = l"
-  by (import rich_list LASTN_LENGTH_ID)
-
-lemma LASTN_LASTN: "ALL (l::'a::type list) (n::nat) m::nat.
-   m <= length l --> n <= m --> LASTN n (LASTN m l) = LASTN n l"
-  by (import rich_list LASTN_LASTN)
-
-lemma FIRSTN_LENGTH_ID: "ALL l::'a::type list. FIRSTN (length l) l = l"
-  by (import rich_list FIRSTN_LENGTH_ID)
-
-lemma FIRSTN_SNOC: "ALL (n::nat) l::'a::type list.
-   n <= length l --> (ALL x::'a::type. FIRSTN n (SNOC x l) = FIRSTN n l)"
-  by (import rich_list FIRSTN_SNOC)
-
-lemma BUTLASTN_LENGTH_NIL: "ALL l::'a::type list. BUTLASTN (length l) l = []"
-  by (import rich_list BUTLASTN_LENGTH_NIL)
-
-lemma BUTLASTN_SUC_BUTLAST: "ALL (n::nat) l::'a::type list.
-   n < length l --> BUTLASTN (Suc n) l = BUTLASTN n (butlast l)"
-  by (import rich_list BUTLASTN_SUC_BUTLAST)
-
-lemma BUTLASTN_BUTLAST: "ALL (n::nat) l::'a::type list.
-   n < length l --> BUTLASTN n (butlast l) = butlast (BUTLASTN n l)"
-  by (import rich_list BUTLASTN_BUTLAST)
-
-lemma LENGTH_BUTLASTN: "ALL (n::nat) l::'a::type list.
-   n <= length l --> length (BUTLASTN n l) = length l - n"
-  by (import rich_list LENGTH_BUTLASTN)
-
-lemma BUTLASTN_BUTLASTN: "ALL (m::nat) (n::nat) l::'a::type list.
-   n + m <= length l --> BUTLASTN n (BUTLASTN m l) = BUTLASTN (n + m) l"
-  by (import rich_list BUTLASTN_BUTLASTN)
-
-lemma APPEND_BUTLASTN_LASTN: "ALL (n::nat) l::'a::type list.
-   n <= length l --> BUTLASTN n l @ LASTN n l = l"
-  by (import rich_list APPEND_BUTLASTN_LASTN)
-
-lemma APPEND_FIRSTN_LASTN: "ALL (m::nat) (n::nat) l::'a::type list.
-   m + n = length l --> FIRSTN n l @ LASTN m l = l"
-  by (import rich_list APPEND_FIRSTN_LASTN)
-
-lemma BUTLASTN_APPEND2: "ALL (n::nat) (l1::'a::type list) l2::'a::type list.
-   n <= length l2 --> BUTLASTN n (l1 @ l2) = l1 @ BUTLASTN n l2"
-  by (import rich_list BUTLASTN_APPEND2)
-
-lemma BUTLASTN_LENGTH_APPEND: "ALL (l2::'a::type list) l1::'a::type list.
-   BUTLASTN (length l2) (l1 @ l2) = l1"
-  by (import rich_list BUTLASTN_LENGTH_APPEND)
-
-lemma LASTN_LENGTH_APPEND: "ALL (l2::'a::type list) l1::'a::type list. LASTN (length l2) (l1 @ l2) = l2"
-  by (import rich_list LASTN_LENGTH_APPEND)
-
-lemma BUTLASTN_CONS: "ALL (n::nat) l::'a::type list.
-   n <= length l -->
-   (ALL x::'a::type. BUTLASTN n (x # l) = x # BUTLASTN n l)"
-  by (import rich_list BUTLASTN_CONS)
-
-lemma BUTLASTN_LENGTH_CONS: "ALL (l::'a::type list) x::'a::type. BUTLASTN (length l) (x # l) = [x]"
-  by (import rich_list BUTLASTN_LENGTH_CONS)
-
-lemma LAST_LASTN_LAST: "ALL (n::nat) l::'a::type list.
-   n <= length l --> 0 < n --> last (LASTN n l) = last l"
-  by (import rich_list LAST_LASTN_LAST)
-
-lemma BUTLASTN_LASTN_NIL: "ALL (n::nat) l::'a::type list. n <= length l --> BUTLASTN n (LASTN n l) = []"
-  by (import rich_list BUTLASTN_LASTN_NIL)
-
-lemma LASTN_BUTLASTN: "ALL (n::nat) (m::nat) l::'a::type list.
-   n + m <= length l -->
-   LASTN n (BUTLASTN m l) = BUTLASTN m (LASTN (n + m) l)"
-  by (import rich_list LASTN_BUTLASTN)
-
-lemma BUTLASTN_LASTN: "ALL (m::nat) (n::nat) l::'a::type list.
-   m <= n & n <= length l -->
-   BUTLASTN m (LASTN n l) = LASTN (n - m) (BUTLASTN m l)"
-  by (import rich_list BUTLASTN_LASTN)
-
-lemma LASTN_1: "ALL l::'a::type list. l ~= [] --> LASTN 1 l = [last l]"
-  by (import rich_list LASTN_1)
-
-lemma BUTLASTN_1: "ALL l::'a::type list. l ~= [] --> BUTLASTN 1 l = butlast l"
-  by (import rich_list BUTLASTN_1)
-
-lemma BUTLASTN_APPEND1: "ALL (l2::'a::type list) n::nat.
-   length l2 <= n -->
-   (ALL l1::'a::type list.
-       BUTLASTN n (l1 @ l2) = BUTLASTN (n - length l2) l1)"
-  by (import rich_list BUTLASTN_APPEND1)
-
-lemma LASTN_APPEND2: "ALL (n::nat) l2::'a::type list.
-   n <= length l2 -->
-   (ALL l1::'a::type list. LASTN n (l1 @ l2) = LASTN n l2)"
-  by (import rich_list LASTN_APPEND2)
-
-lemma LASTN_APPEND1: "ALL (l2::'a::type list) n::nat.
-   length l2 <= n -->
-   (ALL l1::'a::type list.
-       LASTN n (l1 @ l2) = LASTN (n - length l2) l1 @ l2)"
-  by (import rich_list LASTN_APPEND1)
-
-lemma LASTN_MAP: "ALL (n::nat) l::'a::type list.
-   n <= length l -->
-   (ALL f::'a::type => 'b::type. LASTN n (map f l) = map f (LASTN n l))"
-  by (import rich_list LASTN_MAP)
-
-lemma BUTLASTN_MAP: "ALL (n::nat) l::'a::type list.
-   n <= length l -->
-   (ALL f::'a::type => 'b::type.
-       BUTLASTN n (map f l) = map f (BUTLASTN n l))"
-  by (import rich_list BUTLASTN_MAP)
-
-lemma ALL_EL_LASTN: "(All::(('a::type => bool) => bool) => bool)
- (%P::'a::type => bool.
-     (All::('a::type list => bool) => bool)
-      (%l::'a::type list.
-          (op -->::bool => bool => bool)
-           ((list_all::('a::type => bool) => 'a::type list => bool) P l)
-           ((All::(nat => bool) => bool)
-             (%m::nat.
-                 (op -->::bool => bool => bool)
-                  ((op <=::nat => nat => bool) m
-                    ((size::'a::type list => nat) l))
-                  ((list_all::('a::type => bool) => 'a::type list => bool) P
-                    ((LASTN::nat => 'a::type list => 'a::type list) m
-                      l))))))"
-  by (import rich_list ALL_EL_LASTN)
-
-lemma ALL_EL_BUTLASTN: "(All::(('a::type => bool) => bool) => bool)
- (%P::'a::type => bool.
-     (All::('a::type list => bool) => bool)
-      (%l::'a::type list.
-          (op -->::bool => bool => bool)
-           ((list_all::('a::type => bool) => 'a::type list => bool) P l)
-           ((All::(nat => bool) => bool)
-             (%m::nat.
-                 (op -->::bool => bool => bool)
-                  ((op <=::nat => nat => bool) m
-                    ((size::'a::type list => nat) l))
-                  ((list_all::('a::type => bool) => 'a::type list => bool) P
-                    ((BUTLASTN::nat => 'a::type list => 'a::type list) m
-                      l))))))"
-  by (import rich_list ALL_EL_BUTLASTN)
-
-lemma LENGTH_FIRSTN: "ALL (n::nat) l::'a::type list. n <= length l --> length (FIRSTN n l) = n"
-  by (import rich_list LENGTH_FIRSTN)
-
-lemma FIRSTN_FIRSTN: "(All::(nat => bool) => bool)
- (%m::nat.
-     (All::('a::type list => bool) => bool)
-      (%l::'a::type list.
-          (op -->::bool => bool => bool)
-           ((op <=::nat => nat => bool) m ((size::'a::type list => nat) l))
-           ((All::(nat => bool) => bool)
-             (%n::nat.
-                 (op -->::bool => bool => bool)
-                  ((op <=::nat => nat => bool) n m)
-                  ((op =::'a::type list => 'a::type list => bool)
-                    ((FIRSTN::nat => 'a::type list => 'a::type list) n
-                      ((FIRSTN::nat => 'a::type list => 'a::type list) m l))
-                    ((FIRSTN::nat => 'a::type list => 'a::type list) n
-                      l))))))"
-  by (import rich_list FIRSTN_FIRSTN)
-
-lemma LENGTH_BUTFIRSTN: "ALL (n::nat) l::'a::type list.
-   n <= length l --> length (BUTFIRSTN n l) = length l - n"
-  by (import rich_list LENGTH_BUTFIRSTN)
-
-lemma BUTFIRSTN_LENGTH_NIL: "ALL l::'a::type list. BUTFIRSTN (length l) l = []"
-  by (import rich_list BUTFIRSTN_LENGTH_NIL)
-
-lemma BUTFIRSTN_APPEND1: "ALL (n::nat) l1::'a::type list.
-   n <= length l1 -->
-   (ALL l2::'a::type list. BUTFIRSTN n (l1 @ l2) = BUTFIRSTN n l1 @ l2)"
-  by (import rich_list BUTFIRSTN_APPEND1)
-
-lemma BUTFIRSTN_APPEND2: "ALL (l1::'a::type list) n::nat.
-   length l1 <= n -->
-   (ALL l2::'a::type list.
-       BUTFIRSTN n (l1 @ l2) = BUTFIRSTN (n - length l1) l2)"
-  by (import rich_list BUTFIRSTN_APPEND2)
-
-lemma BUTFIRSTN_BUTFIRSTN: "ALL (n::nat) (m::nat) l::'a::type list.
-   n + m <= length l --> BUTFIRSTN n (BUTFIRSTN m l) = BUTFIRSTN (n + m) l"
-  by (import rich_list BUTFIRSTN_BUTFIRSTN)
-
-lemma APPEND_FIRSTN_BUTFIRSTN: "ALL (n::nat) l::'a::type list.
-   n <= length l --> FIRSTN n l @ BUTFIRSTN n l = l"
-  by (import rich_list APPEND_FIRSTN_BUTFIRSTN)
-
-lemma LASTN_SEG: "ALL (n::nat) l::'a::type list.
-   n <= length l --> LASTN n l = SEG n (length l - n) l"
-  by (import rich_list LASTN_SEG)
-
-lemma FIRSTN_SEG: "ALL (n::nat) l::'a::type list. n <= length l --> FIRSTN n l = SEG n 0 l"
-  by (import rich_list FIRSTN_SEG)
-
-lemma BUTFIRSTN_SEG: "ALL (n::nat) l::'a::type list.
-   n <= length l --> BUTFIRSTN n l = SEG (length l - n) n l"
-  by (import rich_list BUTFIRSTN_SEG)
-
-lemma BUTFIRSTN_SNOC: "ALL (n::nat) l::'a::type list.
-   n <= length l -->
-   (ALL x::'a::type. BUTFIRSTN n (SNOC x l) = SNOC x (BUTFIRSTN n l))"
-  by (import rich_list BUTFIRSTN_SNOC)
-
-lemma APPEND_BUTLASTN_BUTFIRSTN: "ALL (m::nat) (n::nat) l::'a::type list.
-   m + n = length l --> BUTLASTN m l @ BUTFIRSTN n l = l"
-  by (import rich_list APPEND_BUTLASTN_BUTFIRSTN)
-
-lemma SEG_SEG: "ALL (n1::nat) (m1::nat) (n2::nat) (m2::nat) l::'a::type list.
-   n1 + m1 <= length l & n2 + m2 <= n1 -->
-   SEG n2 m2 (SEG n1 m1 l) = SEG n2 (m1 + m2) l"
-  by (import rich_list SEG_SEG)
-
-lemma SEG_APPEND1: "ALL (n::nat) (m::nat) l1::'a::type list.
-   n + m <= length l1 -->
-   (ALL l2::'a::type list. SEG n m (l1 @ l2) = SEG n m l1)"
-  by (import rich_list SEG_APPEND1)
-
-lemma SEG_APPEND2: "ALL (l1::'a::type list) (m::nat) (n::nat) l2::'a::type list.
-   length l1 <= m & n <= length l2 -->
-   SEG n m (l1 @ l2) = SEG n (m - length l1) l2"
-  by (import rich_list SEG_APPEND2)
-
-lemma SEG_FIRSTN_BUTFISTN: "ALL (n::nat) (m::nat) l::'a::type list.
-   n + m <= length l --> SEG n m l = FIRSTN n (BUTFIRSTN m l)"
-  by (import rich_list SEG_FIRSTN_BUTFISTN)
-
-lemma SEG_APPEND: "ALL (m::nat) (l1::'a::type list) (n::nat) l2::'a::type list.
-   m < length l1 & length l1 <= n + m & n + m <= length l1 + length l2 -->
-   SEG n m (l1 @ l2) =
-   SEG (length l1 - m) m l1 @ SEG (n + m - length l1) 0 l2"
-  by (import rich_list SEG_APPEND)
-
-lemma SEG_LENGTH_SNOC: "ALL (x::'a::type list) xa::'a::type. SEG 1 (length x) (SNOC xa x) = [xa]"
-  by (import rich_list SEG_LENGTH_SNOC)
-
-lemma SEG_SNOC: "ALL (n::nat) (m::nat) l::'a::type list.
-   n + m <= length l --> (ALL x::'a::type. SEG n m (SNOC x l) = SEG n m l)"
-  by (import rich_list SEG_SNOC)
-
-lemma ELL_SEG: "ALL (n::nat) l::'a::type list.
-   n < length l --> ELL n l = hd (SEG 1 (PRE (length l - n)) l)"
-  by (import rich_list ELL_SEG)
-
-lemma SNOC_FOLDR: "ALL (x::'a::type) l::'a::type list. SNOC x l = foldr op # l [x]"
-  by (import rich_list SNOC_FOLDR)
-
-lemma IS_EL_FOLDR_MAP: "ALL (x::'a::type) xa::'a::type list.
-   x mem xa = foldr op | (map (op = x) xa) False"
-  by (import rich_list IS_EL_FOLDR_MAP)
-
-lemma IS_EL_FOLDL_MAP: "ALL (x::'a::type) xa::'a::type list.
-   x mem xa = foldl op | False (map (op = x) xa)"
-  by (import rich_list IS_EL_FOLDL_MAP)
-
-lemma FILTER_FILTER: "ALL (P::'a::type => bool) (Q::'a::type => bool) l::'a::type list.
-   filter P (filter Q l) = [x::'a::type<-l. P x & Q x]"
-  by (import rich_list FILTER_FILTER)
-
-lemma FCOMM_FOLDR_FLAT: "ALL (g::'a::type => 'a::type => 'a::type)
-   f::'b::type => 'a::type => 'a::type.
-   FCOMM g f -->
-   (ALL e::'a::type.
-       LEFT_ID g e -->
-       (ALL l::'b::type list list.
-           foldr f (concat l) e = foldr g (map (FOLDR f e) l) e))"
-  by (import rich_list FCOMM_FOLDR_FLAT)
-
-lemma FCOMM_FOLDL_FLAT: "ALL (f::'a::type => 'b::type => 'a::type)
-   g::'a::type => 'a::type => 'a::type.
-   FCOMM f g -->
-   (ALL e::'a::type.
-       RIGHT_ID g e -->
-       (ALL l::'b::type list list.
-           foldl f e (concat l) = foldl g e (map (foldl f e) l)))"
-  by (import rich_list FCOMM_FOLDL_FLAT)
-
-lemma FOLDR_MAP_REVERSE: "ALL f::'a::type => 'a::type => 'a::type.
-   (ALL (a::'a::type) (b::'a::type) c::'a::type.
-       f a (f b c) = f b (f a c)) -->
-   (ALL (e::'a::type) (g::'b::type => 'a::type) l::'b::type list.
-       foldr f (map g (rev l)) e = foldr f (map g l) e)"
-  by (import rich_list FOLDR_MAP_REVERSE)
-
-lemma FOLDR_FILTER_REVERSE: "ALL f::'a::type => 'a::type => 'a::type.
-   (ALL (a::'a::type) (b::'a::type) c::'a::type.
-       f a (f b c) = f b (f a c)) -->
-   (ALL (e::'a::type) (P::'a::type => bool) l::'a::type list.
-       foldr f (filter P (rev l)) e = foldr f (filter P l) e)"
-  by (import rich_list FOLDR_FILTER_REVERSE)
-
-lemma COMM_ASSOC_FOLDR_REVERSE: "ALL f::'a::type => 'a::type => 'a::type.
-   COMM f -->
-   ASSOC f -->
-   (ALL (e::'a::type) l::'a::type list. foldr f (rev l) e = foldr f l e)"
-  by (import rich_list COMM_ASSOC_FOLDR_REVERSE)
-
-lemma COMM_ASSOC_FOLDL_REVERSE: "ALL f::'a::type => 'a::type => 'a::type.
-   COMM f -->
-   ASSOC f -->
-   (ALL (e::'a::type) l::'a::type list. foldl f e (rev l) = foldl f e l)"
-  by (import rich_list COMM_ASSOC_FOLDL_REVERSE)
-
-lemma ELL_LAST: "ALL l::'a::type list. ~ null l --> ELL 0 l = last l"
-  by (import rich_list ELL_LAST)
-
-lemma ELL_0_SNOC: "ALL (l::'a::type list) x::'a::type. ELL 0 (SNOC x l) = x"
-  by (import rich_list ELL_0_SNOC)
-
-lemma ELL_SNOC: "ALL n>0.
-   ALL (x::'a::type) l::'a::type list. ELL n (SNOC x l) = ELL (PRE n) l"
-  by (import rich_list ELL_SNOC)
-
-lemma ELL_SUC_SNOC: "ALL (n::nat) (x::'a::type) xa::'a::type list.
-   ELL (Suc n) (SNOC x xa) = ELL n xa"
-  by (import rich_list ELL_SUC_SNOC)
-
-lemma ELL_CONS: "ALL (n::nat) l::'a::type list.
-   n < length l --> (ALL x::'a::type. ELL n (x # l) = ELL n l)"
-  by (import rich_list ELL_CONS)
-
-lemma ELL_LENGTH_CONS: "ALL (l::'a::type list) x::'a::type. ELL (length l) (x # l) = x"
-  by (import rich_list ELL_LENGTH_CONS)
-
-lemma ELL_LENGTH_SNOC: "ALL (l::'a::type list) x::'a::type.
-   ELL (length l) (SNOC x l) = (if null l then x else hd l)"
-  by (import rich_list ELL_LENGTH_SNOC)
-
-lemma ELL_APPEND2: "ALL (n::nat) l2::'a::type list.
-   n < length l2 --> (ALL l1::'a::type list. ELL n (l1 @ l2) = ELL n l2)"
-  by (import rich_list ELL_APPEND2)
-
-lemma ELL_APPEND1: "ALL (l2::'a::type list) n::nat.
-   length l2 <= n -->
-   (ALL l1::'a::type list. ELL n (l1 @ l2) = ELL (n - length l2) l1)"
-  by (import rich_list ELL_APPEND1)
-
-lemma ELL_PRE_LENGTH: "ALL l::'a::type list. l ~= [] --> ELL (PRE (length l)) l = hd l"
-  by (import rich_list ELL_PRE_LENGTH)
-
-lemma EL_LENGTH_SNOC: "ALL (l::'a::type list) x::'a::type. EL (length l) (SNOC x l) = x"
-  by (import rich_list EL_LENGTH_SNOC)
-
-lemma EL_PRE_LENGTH: "ALL l::'a::type list. l ~= [] --> EL (PRE (length l)) l = last l"
-  by (import rich_list EL_PRE_LENGTH)
-
-lemma EL_SNOC: "ALL (n::nat) l::'a::type list.
-   n < length l --> (ALL x::'a::type. EL n (SNOC x l) = EL n l)"
-  by (import rich_list EL_SNOC)
-
-lemma EL_ELL: "ALL (n::nat) l::'a::type list.
-   n < length l --> EL n l = ELL (PRE (length l - n)) l"
-  by (import rich_list EL_ELL)
-
-lemma EL_LENGTH_APPEND: "ALL (l2::'a::type list) l1::'a::type list.
-   ~ null l2 --> EL (length l1) (l1 @ l2) = hd l2"
-  by (import rich_list EL_LENGTH_APPEND)
-
-lemma ELL_EL: "ALL (n::nat) l::'a::type list.
-   n < length l --> ELL n l = EL (PRE (length l - n)) l"
-  by (import rich_list ELL_EL)
-
-lemma ELL_MAP: "ALL (n::nat) (l::'a::type list) f::'a::type => 'b::type.
-   n < length l --> ELL n (map f l) = f (ELL n l)"
-  by (import rich_list ELL_MAP)
-
-lemma LENGTH_BUTLAST: "ALL l::'a::type list. l ~= [] --> length (butlast l) = PRE (length l)"
-  by (import rich_list LENGTH_BUTLAST)
-
-lemma BUTFIRSTN_LENGTH_APPEND: "ALL (l1::'a::type list) l2::'a::type list.
-   BUTFIRSTN (length l1) (l1 @ l2) = l2"
-  by (import rich_list BUTFIRSTN_LENGTH_APPEND)
-
-lemma FIRSTN_APPEND1: "ALL (n::nat) l1::'a::type list.
-   n <= length l1 -->
-   (ALL l2::'a::type list. FIRSTN n (l1 @ l2) = FIRSTN n l1)"
-  by (import rich_list FIRSTN_APPEND1)
-
-lemma FIRSTN_APPEND2: "ALL (l1::'a::type list) n::nat.
-   length l1 <= n -->
-   (ALL l2::'a::type list.
-       FIRSTN n (l1 @ l2) = l1 @ FIRSTN (n - length l1) l2)"
-  by (import rich_list FIRSTN_APPEND2)
-
-lemma FIRSTN_LENGTH_APPEND: "ALL (l1::'a::type list) l2::'a::type list. FIRSTN (length l1) (l1 @ l2) = l1"
-  by (import rich_list FIRSTN_LENGTH_APPEND)
-
-lemma REVERSE_FLAT: "ALL l::'a::type list list. rev (concat l) = concat (rev (map rev l))"
-  by (import rich_list REVERSE_FLAT)
-
-lemma MAP_FILTER: "ALL (f::'a::type => 'a::type) (P::'a::type => bool) l::'a::type list.
-   (ALL x::'a::type. P (f x) = P x) -->
-   map f (filter P l) = filter P (map f l)"
-  by (import rich_list MAP_FILTER)
-
-lemma FLAT_REVERSE: "ALL l::'a::type list list. concat (rev l) = rev (concat (map rev l))"
-  by (import rich_list FLAT_REVERSE)
-
-lemma FLAT_FLAT: "ALL l::'a::type list list list. concat (concat l) = concat (map concat l)"
-  by (import rich_list FLAT_FLAT)
-
-lemma SOME_EL_REVERSE: "ALL (P::'a::type => bool) l::'a::type list.
-   list_ex P (rev l) = list_ex P l"
-  by (import rich_list SOME_EL_REVERSE)
-
-lemma ALL_EL_SEG: "ALL (P::'a::type => bool) l::'a::type list.
-   list_all P l -->
-   (ALL (m::nat) k::nat. m + k <= length l --> list_all P (SEG m k l))"
-  by (import rich_list ALL_EL_SEG)
-
-lemma ALL_EL_FIRSTN: "(All::(('a::type => bool) => bool) => bool)
- (%P::'a::type => bool.
-     (All::('a::type list => bool) => bool)
-      (%l::'a::type list.
-          (op -->::bool => bool => bool)
-           ((list_all::('a::type => bool) => 'a::type list => bool) P l)
-           ((All::(nat => bool) => bool)
-             (%m::nat.
-                 (op -->::bool => bool => bool)
-                  ((op <=::nat => nat => bool) m
-                    ((size::'a::type list => nat) l))
-                  ((list_all::('a::type => bool) => 'a::type list => bool) P
-                    ((FIRSTN::nat => 'a::type list => 'a::type list) m
-                      l))))))"
-  by (import rich_list ALL_EL_FIRSTN)
-
-lemma ALL_EL_BUTFIRSTN: "(All::(('a::type => bool) => bool) => bool)
- (%P::'a::type => bool.
-     (All::('a::type list => bool) => bool)
-      (%l::'a::type list.
-          (op -->::bool => bool => bool)
-           ((list_all::('a::type => bool) => 'a::type list => bool) P l)
-           ((All::(nat => bool) => bool)
-             (%m::nat.
-                 (op -->::bool => bool => bool)
-                  ((op <=::nat => nat => bool) m
-                    ((size::'a::type list => nat) l))
-                  ((list_all::('a::type => bool) => 'a::type list => bool) P
-                    ((BUTFIRSTN::nat => 'a::type list => 'a::type list) m
-                      l))))))"
-  by (import rich_list ALL_EL_BUTFIRSTN)
-
-lemma SOME_EL_SEG: "ALL (m::nat) (k::nat) l::'a::type list.
-   m + k <= length l -->
-   (ALL P::'a::type => bool. list_ex P (SEG m k l) --> list_ex P l)"
-  by (import rich_list SOME_EL_SEG)
-
-lemma SOME_EL_FIRSTN: "ALL (m::nat) l::'a::type list.
-   m <= length l -->
-   (ALL P::'a::type => bool. list_ex P (FIRSTN m l) --> list_ex P l)"
-  by (import rich_list SOME_EL_FIRSTN)
-
-lemma SOME_EL_BUTFIRSTN: "ALL (m::nat) l::'a::type list.
-   m <= length l -->
-   (ALL P::'a::type => bool.
-       list_ex P (BUTFIRSTN m l) --> list_ex P l)"
-  by (import rich_list SOME_EL_BUTFIRSTN)
-
-lemma SOME_EL_LASTN: "ALL (m::nat) l::'a::type list.
-   m <= length l -->
-   (ALL P::'a::type => bool. list_ex P (LASTN m l) --> list_ex P l)"
-  by (import rich_list SOME_EL_LASTN)
-
-lemma SOME_EL_BUTLASTN: "ALL (m::nat) l::'a::type list.
-   m <= length l -->
-   (ALL P::'a::type => bool.
-       list_ex P (BUTLASTN m l) --> list_ex P l)"
-  by (import rich_list SOME_EL_BUTLASTN)
-
-lemma IS_EL_REVERSE: "ALL (x::'a::type) l::'a::type list. x mem rev l = x mem l"
-  by (import rich_list IS_EL_REVERSE)
-
-lemma IS_EL_FILTER: "ALL (P::'a::type => bool) x::'a::type.
-   P x --> (ALL l::'a::type list. x mem filter P l = x mem l)"
-  by (import rich_list IS_EL_FILTER)
-
-lemma IS_EL_SEG: "ALL (n::nat) (m::nat) l::'a::type list.
-   n + m <= length l --> (ALL x::'a::type. x mem SEG n m l --> x mem l)"
-  by (import rich_list IS_EL_SEG)
-
-lemma IS_EL_SOME_EL: "ALL (x::'a::type) l::'a::type list. x mem l = list_ex (op = x) l"
-  by (import rich_list IS_EL_SOME_EL)
-
-lemma IS_EL_FIRSTN: "ALL (x::nat) xa::'a::type list.
-   x <= length xa --> (ALL xb::'a::type. xb mem FIRSTN x xa --> xb mem xa)"
-  by (import rich_list IS_EL_FIRSTN)
-
-lemma IS_EL_BUTFIRSTN: "ALL (x::nat) xa::'a::type list.
-   x <= length xa -->
-   (ALL xb::'a::type. xb mem BUTFIRSTN x xa --> xb mem xa)"
-  by (import rich_list IS_EL_BUTFIRSTN)
-
-lemma IS_EL_BUTLASTN: "ALL (x::nat) xa::'a::type list.
-   x <= length xa --> (ALL xb::'a::type. xb mem BUTLASTN x xa --> xb mem xa)"
-  by (import rich_list IS_EL_BUTLASTN)
-
-lemma IS_EL_LASTN: "ALL (x::nat) xa::'a::type list.
-   x <= length xa --> (ALL xb::'a::type. xb mem LASTN x xa --> xb mem xa)"
-  by (import rich_list IS_EL_LASTN)
-
-lemma ZIP_SNOC: "ALL (l1::'a::type list) l2::'b::type list.
-   length l1 = length l2 -->
-   (ALL (x1::'a::type) x2::'b::type.
-       zip (SNOC x1 l1) (SNOC x2 l2) = SNOC (x1, x2) (zip l1 l2))"
-  by (import rich_list ZIP_SNOC)
-
-lemma UNZIP_SNOC: "ALL (x::'a::type * 'b::type) l::('a::type * 'b::type) list.
-   unzip (SNOC x l) =
-   (SNOC (fst x) (fst (unzip l)), SNOC (snd x) (snd (unzip l)))"
-  by (import rich_list UNZIP_SNOC)
-
-lemma LENGTH_UNZIP_FST: "ALL x::('a::type * 'b::type) list. length (UNZIP_FST x) = length x"
-  by (import rich_list LENGTH_UNZIP_FST)
-
-lemma LENGTH_UNZIP_SND: "ALL x::('a::type * 'b::type) list. length (UNZIP_SND x) = length x"
-  by (import rich_list LENGTH_UNZIP_SND)
-
-lemma SUM_APPEND: "ALL (l1::nat list) l2::nat list. sum (l1 @ l2) = sum l1 + sum l2"
-  by (import rich_list SUM_APPEND)
-
-lemma SUM_REVERSE: "ALL l::nat list. sum (rev l) = sum l"
-  by (import rich_list SUM_REVERSE)
-
-lemma SUM_FLAT: "ALL l::nat list list. sum (concat l) = sum (map sum l)"
-  by (import rich_list SUM_FLAT)
-
-lemma EL_APPEND1: "ALL (n::nat) (l1::'a::type list) l2::'a::type list.
-   n < length l1 --> EL n (l1 @ l2) = EL n l1"
-  by (import rich_list EL_APPEND1)
-
-lemma EL_APPEND2: "ALL (l1::'a::type list) n::nat.
-   length l1 <= n -->
-   (ALL l2::'a::type list. EL n (l1 @ l2) = EL (n - length l1) l2)"
-  by (import rich_list EL_APPEND2)
-
-lemma EL_MAP: "ALL (n::nat) l::'a::type list.
-   n < length l -->
-   (ALL f::'a::type => 'b::type. EL n (map f l) = f (EL n l))"
-  by (import rich_list EL_MAP)
-
-lemma EL_CONS: "ALL n>0. ALL (x::'a::type) l::'a::type list. EL n (x # l) = EL (PRE n) l"
-  by (import rich_list EL_CONS)
-
-lemma EL_SEG: "ALL (n::nat) l::'a::type list. n < length l --> EL n l = hd (SEG 1 n l)"
-  by (import rich_list EL_SEG)
-
-lemma EL_IS_EL: "ALL (n::nat) l::'a::type list. n < length l --> EL n l mem l"
-  by (import rich_list EL_IS_EL)
-
-lemma TL_SNOC: "ALL (x::'a::type) l::'a::type list.
-   tl (SNOC x l) = (if null l then [] else SNOC x (tl l))"
-  by (import rich_list TL_SNOC)
-
-lemma EL_REVERSE: "ALL (n::nat) l::'a::type list.
-   n < length l --> EL n (rev l) = EL (PRE (length l - n)) l"
-  by (import rich_list EL_REVERSE)
-
-lemma EL_REVERSE_ELL: "ALL (n::nat) l::'a::type list. n < length l --> EL n (rev l) = ELL n l"
-  by (import rich_list EL_REVERSE_ELL)
-
-lemma ELL_LENGTH_APPEND: "ALL (l1::'a::type list) l2::'a::type list.
-   ~ null l1 --> ELL (length l2) (l1 @ l2) = last l1"
-  by (import rich_list ELL_LENGTH_APPEND)
-
-lemma ELL_IS_EL: "ALL (n::nat) l::'a::type list. n < length l --> ELL n l mem l"
-  by (import rich_list ELL_IS_EL)
-
-lemma ELL_REVERSE: "ALL (n::nat) l::'a::type list.
-   n < length l --> ELL n (rev l) = ELL (PRE (length l - n)) l"
-  by (import rich_list ELL_REVERSE)
-
-lemma ELL_REVERSE_EL: "ALL (n::nat) l::'a::type list. n < length l --> ELL n (rev l) = EL n l"
-  by (import rich_list ELL_REVERSE_EL)
-
-lemma FIRSTN_BUTLASTN: "ALL (n::nat) l::'a::type list.
-   n <= length l --> FIRSTN n l = BUTLASTN (length l - n) l"
-  by (import rich_list FIRSTN_BUTLASTN)
-
-lemma BUTLASTN_FIRSTN: "ALL (n::nat) l::'a::type list.
-   n <= length l --> BUTLASTN n l = FIRSTN (length l - n) l"
-  by (import rich_list BUTLASTN_FIRSTN)
-
-lemma LASTN_BUTFIRSTN: "ALL (n::nat) l::'a::type list.
-   n <= length l --> LASTN n l = BUTFIRSTN (length l - n) l"
-  by (import rich_list LASTN_BUTFIRSTN)
-
-lemma BUTFIRSTN_LASTN: "ALL (n::nat) l::'a::type list.
-   n <= length l --> BUTFIRSTN n l = LASTN (length l - n) l"
-  by (import rich_list BUTFIRSTN_LASTN)
-
-lemma SEG_LASTN_BUTLASTN: "ALL (n::nat) (m::nat) l::'a::type list.
-   n + m <= length l -->
-   SEG n m l = LASTN n (BUTLASTN (length l - (n + m)) l)"
-  by (import rich_list SEG_LASTN_BUTLASTN)
-
-lemma BUTFIRSTN_REVERSE: "ALL (n::nat) l::'a::type list.
-   n <= length l --> BUTFIRSTN n (rev l) = rev (BUTLASTN n l)"
-  by (import rich_list BUTFIRSTN_REVERSE)
-
-lemma BUTLASTN_REVERSE: "ALL (n::nat) l::'a::type list.
-   n <= length l --> BUTLASTN n (rev l) = rev (BUTFIRSTN n l)"
-  by (import rich_list BUTLASTN_REVERSE)
-
-lemma LASTN_REVERSE: "ALL (n::nat) l::'a::type list.
-   n <= length l --> LASTN n (rev l) = rev (FIRSTN n l)"
-  by (import rich_list LASTN_REVERSE)
-
-lemma FIRSTN_REVERSE: "ALL (n::nat) l::'a::type list.
-   n <= length l --> FIRSTN n (rev l) = rev (LASTN n l)"
-  by (import rich_list FIRSTN_REVERSE)
-
-lemma SEG_REVERSE: "ALL (n::nat) (m::nat) l::'a::type list.
-   n + m <= length l -->
-   SEG n m (rev l) = rev (SEG n (length l - (n + m)) l)"
-  by (import rich_list SEG_REVERSE)
-
-lemma LENGTH_GENLIST: "ALL (f::nat => 'a::type) n::nat. length (GENLIST f n) = n"
-  by (import rich_list LENGTH_GENLIST)
-
-lemma LENGTH_REPLICATE: "ALL (n::nat) x::'a::type. length (REPLICATE n x) = n"
-  by (import rich_list LENGTH_REPLICATE)
-
-lemma IS_EL_REPLICATE: "ALL n>0. ALL x::'a::type. x mem REPLICATE n x"
-  by (import rich_list IS_EL_REPLICATE)
-
-lemma ALL_EL_REPLICATE: "ALL (x::'a::type) n::nat. list_all (op = x) (REPLICATE n x)"
-  by (import rich_list ALL_EL_REPLICATE)
-
-lemma AND_EL_FOLDL: "ALL l::bool list. AND_EL l = foldl op & True l"
-  by (import rich_list AND_EL_FOLDL)
-
-lemma AND_EL_FOLDR: "ALL l::bool list. AND_EL l = foldr op & l True"
-  by (import rich_list AND_EL_FOLDR)
-
-lemma OR_EL_FOLDL: "ALL l::bool list. OR_EL l = foldl op | False l"
-  by (import rich_list OR_EL_FOLDL)
-
-lemma OR_EL_FOLDR: "ALL l::bool list. OR_EL l = foldr op | l False"
-  by (import rich_list OR_EL_FOLDR)
+  sorry
+
+lemma IS_PREFIX_PREFIX: "IS_PREFIX l (PREFIX P l)"
+  sorry
+
+lemma LENGTH_SCANL: "length (SCANL (f::'b => 'a => 'b) (e::'b) (l::'a list)) = Suc (length l)"
+  sorry
+
+lemma LENGTH_SCANR: "length (SCANR (f::'a => 'b => 'b) (e::'b) (l::'a list)) = Suc (length l)"
+  sorry
+
+lemma COMM_MONOID_FOLDL: "[| COMM x; MONOID x xa |] ==> foldl x e l = x e (foldl x xa l)"
+  sorry
+
+lemma COMM_MONOID_FOLDR: "[| COMM x; MONOID x xa |] ==> foldr x l e = x e (foldr x l xa)"
+  sorry
+
+lemma FCOMM_FOLDR_APPEND: "[| FCOMM x xa; LEFT_ID x xb |]
+==> foldr xa (l1 @ l2) xb = x (foldr xa l1 xb) (foldr xa l2 xb)"
+  sorry
+
+lemma FCOMM_FOLDL_APPEND: "[| FCOMM x xa; RIGHT_ID xa xb |]
+==> foldl x xb (l1 @ l2) = xa (foldl x xb l1) (foldl x xb l2)"
+  sorry
+
+lemma FOLDL_SINGLE: "foldl x xa [xb] = x xa xb"
+  sorry
+
+lemma FOLDR_SINGLE: "foldr (x::'a => 'b => 'b) [xb::'a] (xa::'b) = x xb xa"
+  sorry
+
+lemma FOLDR_CONS_NIL: "foldr op # l [] = l"
+  sorry
+
+lemma FOLDL_SNOC_NIL: "foldl (%xs x. SNOC x xs) [] l = l"
+  sorry
+
+lemma FOLDR_REVERSE: "foldr (x::'a => 'b => 'b) (rev (xb::'a list)) (xa::'b) =
+foldl (%(xa::'b) y::'a. x y xa) xa xb"
+  sorry
+
+lemma FOLDL_REVERSE: "foldl x xa (rev xb) = foldr (%xa y. x y xa) xb xa"
+  sorry
+
+lemma FOLDR_MAP: "foldr (f::'a => 'a => 'a) (map (g::'b => 'a) (l::'b list)) (e::'a) =
+foldr (%x::'b. f (g x)) l e"
+  sorry
+
+lemma ALL_EL_FOLDR: "list_all P l = foldr (%x. op & (P x)) l True"
+  sorry
+
+lemma ALL_EL_FOLDL: "list_all P l = foldl (%l' x. l' & P x) True l"
+  sorry
+
+lemma SOME_EL_FOLDR: "list_ex P l = foldr (%x. op | (P x)) l False"
+  sorry
+
+lemma SOME_EL_FOLDL: "list_ex P l = foldl (%l' x. l' | P x) False l"
+  sorry
+
+lemma ALL_EL_FOLDR_MAP: "list_all x xa = foldr op & (map x xa) True"
+  sorry
+
+lemma ALL_EL_FOLDL_MAP: "list_all x xa = foldl op & True (map x xa)"
+  sorry
+
+lemma SOME_EL_FOLDR_MAP: "list_ex x xa = foldr op | (map x xa) False"
+  sorry
+
+lemma SOME_EL_FOLDL_MAP: "list_ex x xa = foldl op | False (map x xa)"
+  sorry
+
+lemma FOLDR_FILTER: "foldr (f::'a => 'a => 'a) (filter (P::'a => bool) (l::'a list)) (e::'a) =
+foldr (%(x::'a) y::'a. if P x then f x y else y) l e"
+  sorry
+
+lemma FOLDL_FILTER: "foldl (f::'a => 'a => 'a) (e::'a) (filter (P::'a => bool) (l::'a list)) =
+foldl (%(x::'a) y::'a. if P y then f x y else x) e l"
+  sorry
+
+lemma ASSOC_FOLDR_FLAT: "[| ASSOC f; LEFT_ID f e |]
+==> foldr f (concat l) e = foldr f (map (FOLDR f e) l) e"
+  sorry
+
+lemma ASSOC_FOLDL_FLAT: "[| ASSOC f; RIGHT_ID f e |]
+==> foldl f e (concat l) = foldl f e (map (foldl f e) l)"
+  sorry
+
+lemma SOME_EL_MAP: "list_ex (P::'b => bool) (map (f::'a => 'b) (l::'a list)) = list_ex (P o f) l"
+  sorry
+
+lemma SOME_EL_DISJ: "list_ex (%x. P x | Q x) l = (list_ex P l | list_ex Q l)"
+  sorry
+
+lemma IS_EL_FOLDR: "List.member xa x = foldr (%xa. op | (x = xa)) xa False"
+  sorry
+
+lemma IS_EL_FOLDL: "List.member xa x = foldl (%l' xa. l' | x = xa) False xa"
+  sorry
+
+lemma NULL_FOLDR: "List.null l = foldr (%x l'. False) l True"
+  sorry
+
+lemma NULL_FOLDL: "List.null l = foldl (%x l'. False) True l"
+  sorry
+
+lemma SEG_LENGTH_ID: "SEG (length l) 0 l = l"
+  sorry
+
+lemma SEG_SUC_CONS: "SEG m (Suc n) (x # l) = SEG m n l"
+  sorry
+
+lemma SEG_0_SNOC: "m <= length l ==> SEG m 0 (SNOC x l) = SEG m 0 l"
+  sorry
+
+lemma BUTLASTN_SEG: "n <= length l ==> BUTLASTN n l = SEG (length l - n) 0 l"
+  sorry
+
+lemma LASTN_CONS: "n <= length l ==> LASTN n (x # l) = LASTN n l"
+  sorry
+
+lemma LENGTH_LASTN: "n <= length l ==> length (LASTN n l) = n"
+  sorry
+
+lemma LASTN_LENGTH_ID: "LASTN (length l) l = l"
+  sorry
+
+lemma LASTN_LASTN: "[| m <= length l; n <= m |] ==> LASTN n (LASTN m l) = LASTN n l"
+  sorry
+
+lemma FIRSTN_LENGTH_ID: "FIRSTN (length l) l = l"
+  sorry
+
+lemma FIRSTN_SNOC: "n <= length l ==> FIRSTN n (SNOC x l) = FIRSTN n l"
+  sorry
+
+lemma BUTLASTN_LENGTH_NIL: "BUTLASTN (length l) l = []"
+  sorry
+
+lemma BUTLASTN_SUC_BUTLAST: "n < length l ==> BUTLASTN (Suc n) l = BUTLASTN n (butlast l)"
+  sorry
+
+lemma BUTLASTN_BUTLAST: "n < length l ==> BUTLASTN n (butlast l) = butlast (BUTLASTN n l)"
+  sorry
+
+lemma LENGTH_BUTLASTN: "n <= length l ==> length (BUTLASTN n l) = length l - n"
+  sorry
+
+lemma BUTLASTN_BUTLASTN: "n + m <= length l ==> BUTLASTN n (BUTLASTN m l) = BUTLASTN (n + m) l"
+  sorry
+
+lemma APPEND_BUTLASTN_LASTN: "n <= length l ==> BUTLASTN n l @ LASTN n l = l"
+  sorry
+
+lemma APPEND_FIRSTN_LASTN: "m + n = length l ==> FIRSTN n l @ LASTN m l = l"
+  sorry
+
+lemma BUTLASTN_APPEND2: "n <= length l2 ==> BUTLASTN n (l1 @ l2) = l1 @ BUTLASTN n l2"
+  sorry
+
+lemma BUTLASTN_LENGTH_APPEND: "BUTLASTN (length l2) (l1 @ l2) = l1"
+  sorry
+
+lemma LASTN_LENGTH_APPEND: "LASTN (length l2) (l1 @ l2) = l2"
+  sorry
+
+lemma BUTLASTN_CONS: "n <= length l ==> BUTLASTN n (x # l) = x # BUTLASTN n l"
+  sorry
+
+lemma BUTLASTN_LENGTH_CONS: "BUTLASTN (length l) (x # l) = [x]"
+  sorry
+
+lemma LAST_LASTN_LAST: "[| n <= length l; 0 < n |] ==> last (LASTN n l) = last l"
+  sorry
+
+lemma BUTLASTN_LASTN_NIL: "n <= length l ==> BUTLASTN n (LASTN n l) = []"
+  sorry
+
+lemma LASTN_BUTLASTN: "n + m <= length l ==> LASTN n (BUTLASTN m l) = BUTLASTN m (LASTN (n + m) l)"
+  sorry
+
+lemma BUTLASTN_LASTN: "m <= n & n <= length l
+==> BUTLASTN m (LASTN n l) = LASTN (n - m) (BUTLASTN m l)"
+  sorry
+
+lemma LASTN_1: "l ~= [] ==> LASTN 1 l = [last l]"
+  sorry
+
+lemma BUTLASTN_1: "l ~= [] ==> BUTLASTN 1 l = butlast l"
+  sorry
+
+lemma BUTLASTN_APPEND1: "length l2 <= n ==> BUTLASTN n (l1 @ l2) = BUTLASTN (n - length l2) l1"
+  sorry
+
+lemma LASTN_APPEND2: "n <= length l2 ==> LASTN n (l1 @ l2) = LASTN n l2"
+  sorry
+
+lemma LASTN_APPEND1: "length l2 <= n ==> LASTN n (l1 @ l2) = LASTN (n - length l2) l1 @ l2"
+  sorry
+
+lemma LASTN_MAP: "n <= length l ==> LASTN n (map f l) = map f (LASTN n l)"
+  sorry
+
+lemma BUTLASTN_MAP: "n <= length l ==> BUTLASTN n (map f l) = map f (BUTLASTN n l)"
+  sorry
+
+lemma ALL_EL_LASTN: "[| list_all P l; m <= length l |] ==> list_all P (LASTN m l)"
+  sorry
+
+lemma ALL_EL_BUTLASTN: "[| list_all P l; m <= length l |] ==> list_all P (BUTLASTN m l)"
+  sorry
+
+lemma LENGTH_FIRSTN: "n <= length l ==> length (FIRSTN n l) = n"
+  sorry
+
+lemma FIRSTN_FIRSTN: "[| m <= length l; n <= m |] ==> FIRSTN n (FIRSTN m l) = FIRSTN n l"
+  sorry
+
+lemma LENGTH_BUTFIRSTN: "n <= length l ==> length (BUTFIRSTN n l) = length l - n"
+  sorry
+
+lemma BUTFIRSTN_LENGTH_NIL: "BUTFIRSTN (length l) l = []"
+  sorry
+
+lemma BUTFIRSTN_APPEND1: "n <= length l1 ==> BUTFIRSTN n (l1 @ l2) = BUTFIRSTN n l1 @ l2"
+  sorry
+
+lemma BUTFIRSTN_APPEND2: "length l1 <= n ==> BUTFIRSTN n (l1 @ l2) = BUTFIRSTN (n - length l1) l2"
+  sorry
+
+lemma BUTFIRSTN_BUTFIRSTN: "n + m <= length l ==> BUTFIRSTN n (BUTFIRSTN m l) = BUTFIRSTN (n + m) l"
+  sorry
+
+lemma APPEND_FIRSTN_BUTFIRSTN: "n <= length l ==> FIRSTN n l @ BUTFIRSTN n l = l"
+  sorry
+
+lemma LASTN_SEG: "n <= length l ==> LASTN n l = SEG n (length l - n) l"
+  sorry
+
+lemma FIRSTN_SEG: "n <= length l ==> FIRSTN n l = SEG n 0 l"
+  sorry
+
+lemma BUTFIRSTN_SEG: "n <= length l ==> BUTFIRSTN n l = SEG (length l - n) n l"
+  sorry
+
+lemma BUTFIRSTN_SNOC: "n <= length l ==> BUTFIRSTN n (SNOC x l) = SNOC x (BUTFIRSTN n l)"
+  sorry
+
+lemma APPEND_BUTLASTN_BUTFIRSTN: "m + n = length l ==> BUTLASTN m l @ BUTFIRSTN n l = l"
+  sorry
+
+lemma SEG_SEG: "n1 + m1 <= length l & n2 + m2 <= n1
+==> SEG n2 m2 (SEG n1 m1 l) = SEG n2 (m1 + m2) l"
+  sorry
+
+lemma SEG_APPEND1: "n + m <= length l1 ==> SEG n m (l1 @ l2) = SEG n m l1"
+  sorry
+
+lemma SEG_APPEND2: "length l1 <= m & n <= length l2
+==> SEG n m (l1 @ l2) = SEG n (m - length l1) l2"
+  sorry
+
+lemma SEG_FIRSTN_BUTFISTN: "n + m <= length l ==> SEG n m l = FIRSTN n (BUTFIRSTN m l)"
+  sorry
+
+lemma SEG_APPEND: "m < length l1 & length l1 <= n + m & n + m <= length l1 + length l2
+==> SEG n m (l1 @ l2) =
+    SEG (length l1 - m) m l1 @ SEG (n + m - length l1) 0 l2"
+  sorry
+
+lemma SEG_LENGTH_SNOC: "SEG 1 (length x) (SNOC xa x) = [xa]"
+  sorry
+
+lemma SEG_SNOC: "n + m <= length l ==> SEG n m (SNOC x l) = SEG n m l"
+  sorry
+
+lemma ELL_SEG: "n < length l ==> ELL n l = hd (SEG 1 (PRE (length l - n)) l)"
+  sorry
+
+lemma SNOC_FOLDR: "SNOC x l = foldr op # l [x]"
+  sorry
+
+lemma IS_EL_FOLDR_MAP: "List.member xa x = foldr op | (map (op = x) xa) False"
+  sorry
+
+lemma IS_EL_FOLDL_MAP: "List.member xa x = foldl op | False (map (op = x) xa)"
+  sorry
+
+lemma FILTER_FILTER: "filter P (filter Q l) = [x<-l. P x & Q x]"
+  sorry
+
+lemma FCOMM_FOLDR_FLAT: "[| FCOMM g f; LEFT_ID g e |]
+==> foldr f (concat l) e = foldr g (map (FOLDR f e) l) e"
+  sorry
+
+lemma FCOMM_FOLDL_FLAT: "[| FCOMM f g; RIGHT_ID g e |]
+==> foldl f e (concat l) = foldl g e (map (foldl f e) l)"
+  sorry
+
+lemma FOLDR_MAP_REVERSE: "(!!(a::'a) (b::'a) c::'a. (f::'a => 'a => 'a) a (f b c) = f b (f a c))
+==> foldr f (map (g::'b => 'a) (rev (l::'b list))) (e::'a) =
+    foldr f (map g l) e"
+  sorry
+
+lemma FOLDR_FILTER_REVERSE: "(!!(a::'a) (b::'a) c::'a. (f::'a => 'a => 'a) a (f b c) = f b (f a c))
+==> foldr f (filter (P::'a => bool) (rev (l::'a list))) (e::'a) =
+    foldr f (filter P l) e"
+  sorry
+
+lemma COMM_ASSOC_FOLDR_REVERSE: "[| COMM f; ASSOC f |] ==> foldr f (rev l) e = foldr f l e"
+  sorry
+
+lemma COMM_ASSOC_FOLDL_REVERSE: "[| COMM f; ASSOC f |] ==> foldl f e (rev l) = foldl f e l"
+  sorry
+
+lemma ELL_LAST: "~ List.null l ==> ELL 0 l = last l"
+  sorry
+
+lemma ELL_0_SNOC: "ELL 0 (SNOC x l) = x"
+  sorry
+
+lemma ELL_SNOC: "0 < n ==> ELL n (SNOC x l) = ELL (PRE n) l"
+  sorry
+
+lemma ELL_SUC_SNOC: "ELL (Suc n) (SNOC x xa) = ELL n xa"
+  sorry
+
+lemma ELL_CONS: "n < length l ==> ELL n (x # l) = ELL n l"
+  sorry
+
+lemma ELL_LENGTH_CONS: "ELL (length l) (x # l) = x"
+  sorry
+
+lemma ELL_LENGTH_SNOC: "ELL (length l) (SNOC x l) = (if List.null l then x else hd l)"
+  sorry
+
+lemma ELL_APPEND2: "n < length l2 ==> ELL n (l1 @ l2) = ELL n l2"
+  sorry
+
+lemma ELL_APPEND1: "length l2 <= n ==> ELL n (l1 @ l2) = ELL (n - length l2) l1"
+  sorry
+
+lemma ELL_PRE_LENGTH: "l ~= [] ==> ELL (PRE (length l)) l = hd l"
+  sorry
+
+lemma EL_LENGTH_SNOC: "EL (length l) (SNOC x l) = x"
+  sorry
+
+lemma EL_PRE_LENGTH: "l ~= [] ==> EL (PRE (length l)) l = last l"
+  sorry
+
+lemma EL_SNOC: "n < length l ==> EL n (SNOC x l) = EL n l"
+  sorry
+
+lemma EL_ELL: "n < length l ==> EL n l = ELL (PRE (length l - n)) l"
+  sorry
+
+lemma EL_LENGTH_APPEND: "~ List.null l2 ==> EL (length l1) (l1 @ l2) = hd l2"
+  sorry
+
+lemma ELL_EL: "n < length l ==> ELL n l = EL (PRE (length l - n)) l"
+  sorry
+
+lemma ELL_MAP: "n < length l ==> ELL n (map f l) = f (ELL n l)"
+  sorry
+
+lemma LENGTH_BUTLAST: "l ~= [] ==> length (butlast l) = PRE (length l)"
+  sorry
+
+lemma BUTFIRSTN_LENGTH_APPEND: "BUTFIRSTN (length l1) (l1 @ l2) = l2"
+  sorry
+
+lemma FIRSTN_APPEND1: "n <= length l1 ==> FIRSTN n (l1 @ l2) = FIRSTN n l1"
+  sorry
+
+lemma FIRSTN_APPEND2: "length l1 <= n ==> FIRSTN n (l1 @ l2) = l1 @ FIRSTN (n - length l1) l2"
+  sorry
+
+lemma FIRSTN_LENGTH_APPEND: "FIRSTN (length l1) (l1 @ l2) = l1"
+  sorry
+
+lemma REVERSE_FLAT: "rev (concat l) = concat (rev (map rev l))"
+  sorry
+
+lemma MAP_FILTER: "(!!x. P (f x) = P x) ==> map f (filter P l) = filter P (map f l)"
+  sorry
+
+lemma FLAT_REVERSE: "concat (rev l) = rev (concat (map rev l))"
+  sorry
+
+lemma FLAT_FLAT: "concat (concat l) = concat (map concat l)"
+  sorry
+
+lemma ALL_EL_SEG: "[| list_all P l; m + k <= length l |] ==> list_all P (SEG m k l)"
+  sorry
+
+lemma ALL_EL_FIRSTN: "[| list_all P l; m <= length l |] ==> list_all P (FIRSTN m l)"
+  sorry
+
+lemma ALL_EL_BUTFIRSTN: "[| list_all P l; m <= length l |] ==> list_all P (BUTFIRSTN m l)"
+  sorry
+
+lemma SOME_EL_SEG: "[| m + k <= length l; list_ex P (SEG m k l) |] ==> list_ex P l"
+  sorry
+
+lemma SOME_EL_FIRSTN: "[| m <= length l; list_ex P (FIRSTN m l) |] ==> list_ex P l"
+  sorry
+
+lemma SOME_EL_BUTFIRSTN: "[| m <= length l; list_ex P (BUTFIRSTN m l) |] ==> list_ex P l"
+  sorry
+
+lemma SOME_EL_LASTN: "[| m <= length l; list_ex P (LASTN m l) |] ==> list_ex P l"
+  sorry
+
+lemma SOME_EL_BUTLASTN: "[| m <= length l; list_ex P (BUTLASTN m l) |] ==> list_ex P l"
+  sorry
+
+lemma IS_EL_REVERSE: "List.member (rev l) x = List.member l x"
+  sorry
+
+lemma IS_EL_FILTER: "P x ==> List.member (filter P l) x = List.member l x"
+  sorry
+
+lemma IS_EL_SEG: "[| n + m <= length l; List.member (SEG n m l) x |] ==> List.member l x"
+  sorry
+
+lemma IS_EL_SOME_EL: "List.member l x = list_ex (op = x) l"
+  sorry
+
+lemma IS_EL_FIRSTN: "[| x <= length xa; List.member (FIRSTN x xa) xb |] ==> List.member xa xb"
+  sorry
+
+lemma IS_EL_BUTFIRSTN: "[| x <= length xa; List.member (BUTFIRSTN x xa) xb |] ==> List.member xa xb"
+  sorry
+
+lemma IS_EL_BUTLASTN: "[| x <= length xa; List.member (BUTLASTN x xa) xb |] ==> List.member xa xb"
+  sorry
+
+lemma IS_EL_LASTN: "[| x <= length xa; List.member (LASTN x xa) xb |] ==> List.member xa xb"
+  sorry
+
+lemma ZIP_SNOC: "length l1 = length l2
+==> zip (SNOC x1 l1) (SNOC x2 l2) = SNOC (x1, x2) (zip l1 l2)"
+  sorry
+
+lemma UNZIP_SNOC: "unzip (SNOC x l) =
+(SNOC (fst x) (fst (unzip l)), SNOC (snd x) (snd (unzip l)))"
+  sorry
+
+lemma LENGTH_UNZIP_FST: "length (UNZIP_FST x) = length x"
+  sorry
+
+lemma LENGTH_UNZIP_SND: "length (UNZIP_SND (x::('a * 'b) list)) = length x"
+  sorry
+
+lemma SUM_APPEND: "HOL4Compat.sum (l1 @ l2) = HOL4Compat.sum l1 + HOL4Compat.sum l2"
+  sorry
+
+lemma SUM_REVERSE: "HOL4Compat.sum (rev l) = HOL4Compat.sum l"
+  sorry
+
+lemma SUM_FLAT: "HOL4Compat.sum (concat l) = HOL4Compat.sum (map HOL4Compat.sum l)"
+  sorry
+
+lemma EL_APPEND1: "n < length l1 ==> EL n (l1 @ l2) = EL n l1"
+  sorry
+
+lemma EL_APPEND2: "length l1 <= n ==> EL n (l1 @ l2) = EL (n - length l1) l2"
+  sorry
+
+lemma EL_MAP: "n < length l ==> EL n (map f l) = f (EL n l)"
+  sorry
+
+lemma EL_CONS: "0 < n ==> EL n (x # l) = EL (PRE n) l"
+  sorry
+
+lemma EL_SEG: "n < length l ==> EL n l = hd (SEG 1 n l)"
+  sorry
+
+lemma EL_IS_EL: "n < length l ==> List.member l (EL n l)"
+  sorry
+
+lemma TL_SNOC: "tl (SNOC x l) = (if List.null l then [] else SNOC x (tl l))"
+  sorry
+
+lemma EL_REVERSE: "n < length l ==> EL n (rev l) = EL (PRE (length l - n)) l"
+  sorry
+
+lemma EL_REVERSE_ELL: "n < length l ==> EL n (rev l) = ELL n l"
+  sorry
+
+lemma ELL_LENGTH_APPEND: "~ List.null l1 ==> ELL (length l2) (l1 @ l2) = last l1"
+  sorry
+
+lemma ELL_IS_EL: "n < length l ==> List.member l (ELL n l)"
+  sorry
+
+lemma ELL_REVERSE: "n < length l ==> ELL n (rev l) = ELL (PRE (length l - n)) l"
+  sorry
+
+lemma ELL_REVERSE_EL: "n < length l ==> ELL n (rev l) = EL n l"
+  sorry
+
+lemma FIRSTN_BUTLASTN: "n <= length l ==> FIRSTN n l = BUTLASTN (length l - n) l"
+  sorry
+
+lemma BUTLASTN_FIRSTN: "n <= length l ==> BUTLASTN n l = FIRSTN (length l - n) l"
+  sorry
+
+lemma LASTN_BUTFIRSTN: "n <= length l ==> LASTN n l = BUTFIRSTN (length l - n) l"
+  sorry
+
+lemma BUTFIRSTN_LASTN: "n <= length l ==> BUTFIRSTN n l = LASTN (length l - n) l"
+  sorry
+
+lemma SEG_LASTN_BUTLASTN: "n + m <= length l ==> SEG n m l = LASTN n (BUTLASTN (length l - (n + m)) l)"
+  sorry
+
+lemma BUTFIRSTN_REVERSE: "n <= length l ==> BUTFIRSTN n (rev l) = rev (BUTLASTN n l)"
+  sorry
+
+lemma BUTLASTN_REVERSE: "n <= length l ==> BUTLASTN n (rev l) = rev (BUTFIRSTN n l)"
+  sorry
+
+lemma LASTN_REVERSE: "n <= length l ==> LASTN n (rev l) = rev (FIRSTN n l)"
+  sorry
+
+lemma FIRSTN_REVERSE: "n <= length l ==> FIRSTN n (rev l) = rev (LASTN n l)"
+  sorry
+
+lemma SEG_REVERSE: "n + m <= length l ==> SEG n m (rev l) = rev (SEG n (length l - (n + m)) l)"
+  sorry
+
+lemma LENGTH_GENLIST: "length (GENLIST f n) = n"
+  sorry
+
+lemma LENGTH_REPLICATE: "length (REPLICATE n x) = n"
+  sorry
+
+lemma IS_EL_REPLICATE: "0 < n ==> List.member (REPLICATE n x) x"
+  sorry
+
+lemma ALL_EL_REPLICATE: "list_all (op = x) (REPLICATE n x)"
+  sorry
+
+lemma AND_EL_FOLDL: "AND_EL l = foldl op & True l"
+  sorry
+
+lemma AND_EL_FOLDR: "AND_EL l = foldr op & l True"
+  sorry
+
+lemma OR_EL_FOLDL: "OR_EL l = foldl op | False l"
+  sorry
+
+lemma OR_EL_FOLDR: "OR_EL l = foldr op | l False"
+  sorry
 
 ;end_setup
 
 ;setup_theory state_transformer
 
-definition UNIT :: "'b => 'a => 'b * 'a" where 
+definition
+  UNIT :: "'b => 'a => 'b * 'a"  where
   "(op ==::('b::type => 'a::type => 'b::type * 'a::type)
         => ('b::type => 'a::type => 'b::type * 'a::type) => prop)
  (UNIT::'b::type => 'a::type => 'b::type * 'a::type)
  (Pair::'b::type => 'a::type => 'b::type * 'a::type)"
 
-lemma UNIT_DEF: "ALL x::'b::type. UNIT x = Pair x"
-  by (import state_transformer UNIT_DEF)
-
-definition BIND :: "('a => 'b * 'a) => ('b => 'a => 'c * 'a) => 'a => 'c * 'a" where 
-  "(op ==::(('a::type => 'b::type * 'a::type)
-         => ('b::type => 'a::type => 'c::type * 'a::type)
-            => 'a::type => 'c::type * 'a::type)
-        => (('a::type => 'b::type * 'a::type)
-            => ('b::type => 'a::type => 'c::type * 'a::type)
-               => 'a::type => 'c::type * 'a::type)
-           => prop)
- (BIND::('a::type => 'b::type * 'a::type)
-        => ('b::type => 'a::type => 'c::type * 'a::type)
-           => 'a::type => 'c::type * 'a::type)
- (%(g::'a::type => 'b::type * 'a::type)
-     f::'b::type => 'a::type => 'c::type * 'a::type.
-     (op o::('b::type * 'a::type => 'c::type * 'a::type)
-            => ('a::type => 'b::type * 'a::type)
-               => 'a::type => 'c::type * 'a::type)
-      ((split::('b::type => 'a::type => 'c::type * 'a::type)
-               => 'b::type * 'a::type => 'c::type * 'a::type)
-        f)
-      g)"