fixed disambiguation problem
authorobua
Mon Sep 26 02:27:14 2005 +0200 (2005-09-26)
changeset 17644bd59bfd4bf37
parent 17643 7e417a7cbf9f
child 17645 940371ea0ff3
fixed disambiguation problem
src/HOL/Import/Generate-HOLLight/GenHOLLight.thy
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/ROOT.ML
src/HOL/Import/HOL/bool.imp
src/HOL/Import/HOL/pair.imp
src/HOL/Import/HOL/real.imp
src/HOL/Import/HOL/realax.imp
src/HOL/Import/HOLLight/HOLLight.thy
src/HOL/Import/HOLLight/hollight.imp
src/HOL/Import/hol4rews.ML
src/HOL/Import/import_package.ML
src/HOL/Import/import_syntax.ML
src/HOL/Import/proof_kernel.ML
     1.1 --- a/src/HOL/Import/Generate-HOLLight/GenHOLLight.thy	Mon Sep 26 02:06:44 2005 +0200
     1.2 +++ b/src/HOL/Import/Generate-HOLLight/GenHOLLight.thy	Mon Sep 26 02:27:14 2005 +0200
     1.3 @@ -5,10 +5,6 @@
     1.4  
     1.5  theory GenHOLLight imports "../HOLLightCompat" "../HOL4Syntax" begin;
     1.6  
     1.7 -ML {* reset ProofKernel.debug; *}
     1.8 -ML {* reset Shuffler.debug; *}
     1.9 -ML {* set show_types; set show_sorts; *}
    1.10 -
    1.11  ;import_segment "hollight";
    1.12  
    1.13  setup_dump "../HOLLight" "HOLLight";
     2.1 --- a/src/HOL/Import/HOL/HOL4Base.thy	Mon Sep 26 02:06:44 2005 +0200
     2.2 +++ b/src/HOL/Import/HOL/HOL4Base.thy	Mon Sep 26 02:27:14 2005 +0200
     2.3 @@ -5,215 +5,259 @@
     2.4  ;setup_theory bool
     2.5  
     2.6  constdefs
     2.7 -  ARB :: "'a" 
     2.8 -  "ARB == SOME x. True"
     2.9 -
    2.10 -lemma ARB_DEF: "ARB = (SOME x. True)"
    2.11 +  ARB :: "'a::type" 
    2.12 +  "ARB == SOME x::'a::type. True"
    2.13 +
    2.14 +lemma ARB_DEF: "ARB = (SOME x::'a::type. True)"
    2.15    by (import bool ARB_DEF)
    2.16  
    2.17  constdefs
    2.18 -  IN :: "'a => ('a => bool) => bool" 
    2.19 -  "IN == %x f. f x"
    2.20 -
    2.21 -lemma IN_DEF: "IN = (%x f. f x)"
    2.22 +  IN :: "'a::type => ('a::type => bool) => bool" 
    2.23 +  "IN == %(x::'a::type) f::'a::type => bool. f x"
    2.24 +
    2.25 +lemma IN_DEF: "IN = (%(x::'a::type) f::'a::type => bool. f x)"
    2.26    by (import bool IN_DEF)
    2.27  
    2.28  constdefs
    2.29 -  RES_FORALL :: "('a => bool) => ('a => bool) => bool" 
    2.30 -  "RES_FORALL == %p m. ALL x. IN x p --> m x"
    2.31 -
    2.32 -lemma RES_FORALL_DEF: "RES_FORALL = (%p m. ALL x. IN x p --> m x)"
    2.33 +  RES_FORALL :: "('a::type => bool) => ('a::type => bool) => bool" 
    2.34 +  "RES_FORALL ==
    2.35 +%(p::'a::type => bool) m::'a::type => bool. ALL x::'a::type. IN x p --> m x"
    2.36 +
    2.37 +lemma RES_FORALL_DEF: "RES_FORALL =
    2.38 +(%(p::'a::type => bool) m::'a::type => bool.
    2.39 +    ALL x::'a::type. IN x p --> m x)"
    2.40    by (import bool RES_FORALL_DEF)
    2.41  
    2.42  constdefs
    2.43 -  RES_EXISTS :: "('a => bool) => ('a => bool) => bool" 
    2.44 -  "RES_EXISTS == %p m. EX x. IN x p & m x"
    2.45 -
    2.46 -lemma RES_EXISTS_DEF: "RES_EXISTS = (%p m. EX x. IN x p & m x)"
    2.47 +  RES_EXISTS :: "('a::type => bool) => ('a::type => bool) => bool" 
    2.48 +  "RES_EXISTS ==
    2.49 +%(p::'a::type => bool) m::'a::type => bool. EX x::'a::type. IN x p & m x"
    2.50 +
    2.51 +lemma RES_EXISTS_DEF: "RES_EXISTS =
    2.52 +(%(p::'a::type => bool) m::'a::type => bool. EX x::'a::type. IN x p & m x)"
    2.53    by (import bool RES_EXISTS_DEF)
    2.54  
    2.55  constdefs
    2.56 -  RES_EXISTS_UNIQUE :: "('a => bool) => ('a => bool) => bool" 
    2.57 +  RES_EXISTS_UNIQUE :: "('a::type => bool) => ('a::type => bool) => bool" 
    2.58    "RES_EXISTS_UNIQUE ==
    2.59 -%p m. RES_EXISTS p m &
    2.60 -      RES_FORALL p (%x. RES_FORALL p (%y. m x & m y --> x = y))"
    2.61 +%(p::'a::type => bool) m::'a::type => bool.
    2.62 +   RES_EXISTS p m &
    2.63 +   RES_FORALL p
    2.64 +    (%x::'a::type. RES_FORALL p (%y::'a::type. m x & m y --> x = y))"
    2.65  
    2.66  lemma RES_EXISTS_UNIQUE_DEF: "RES_EXISTS_UNIQUE =
    2.67 -(%p m. RES_EXISTS p m &
    2.68 -       RES_FORALL p (%x. RES_FORALL p (%y. m x & m y --> x = y)))"
    2.69 +(%(p::'a::type => bool) m::'a::type => bool.
    2.70 +    RES_EXISTS p m &
    2.71 +    RES_FORALL p
    2.72 +     (%x::'a::type. RES_FORALL p (%y::'a::type. m x & m y --> x = y)))"
    2.73    by (import bool RES_EXISTS_UNIQUE_DEF)
    2.74  
    2.75  constdefs
    2.76 -  RES_SELECT :: "('a => bool) => ('a => bool) => 'a" 
    2.77 -  "RES_SELECT == %p m. SOME x. IN x p & m x"
    2.78 -
    2.79 -lemma RES_SELECT_DEF: "RES_SELECT = (%p m. SOME x. IN x p & m x)"
    2.80 +  RES_SELECT :: "('a::type => bool) => ('a::type => bool) => 'a::type" 
    2.81 +  "RES_SELECT ==
    2.82 +%(p::'a::type => bool) m::'a::type => bool. SOME x::'a::type. IN x p & m x"
    2.83 +
    2.84 +lemma RES_SELECT_DEF: "RES_SELECT =
    2.85 +(%(p::'a::type => bool) m::'a::type => bool. SOME x::'a::type. IN x p & m x)"
    2.86    by (import bool RES_SELECT_DEF)
    2.87  
    2.88 -lemma EXCLUDED_MIDDLE: "ALL t. t | ~ t"
    2.89 +lemma EXCLUDED_MIDDLE: "ALL t::bool. t | ~ t"
    2.90    by (import bool EXCLUDED_MIDDLE)
    2.91  
    2.92 -lemma FORALL_THM: "All f = All f"
    2.93 +lemma FORALL_THM: "All (f::'a::type => bool) = All f"
    2.94    by (import bool FORALL_THM)
    2.95  
    2.96 -lemma EXISTS_THM: "Ex f = Ex f"
    2.97 +lemma EXISTS_THM: "Ex (f::'a::type => bool) = Ex f"
    2.98    by (import bool EXISTS_THM)
    2.99  
   2.100 -lemma F_IMP: "ALL t. ~ t --> t --> False"
   2.101 +lemma F_IMP: "ALL t::bool. ~ t --> t --> False"
   2.102    by (import bool F_IMP)
   2.103  
   2.104 -lemma NOT_AND: "~ (t & ~ t)"
   2.105 +lemma NOT_AND: "~ ((t::bool) & ~ t)"
   2.106    by (import bool NOT_AND)
   2.107  
   2.108 -lemma AND_CLAUSES: "ALL t.
   2.109 +lemma AND_CLAUSES: "ALL t::bool.
   2.110     (True & t) = t &
   2.111     (t & True) = t & (False & t) = False & (t & False) = False & (t & t) = t"
   2.112    by (import bool AND_CLAUSES)
   2.113  
   2.114 -lemma OR_CLAUSES: "ALL t.
   2.115 +lemma OR_CLAUSES: "ALL t::bool.
   2.116     (True | t) = True &
   2.117     (t | True) = True & (False | t) = t & (t | False) = t & (t | t) = t"
   2.118    by (import bool OR_CLAUSES)
   2.119  
   2.120 -lemma IMP_CLAUSES: "ALL t.
   2.121 +lemma IMP_CLAUSES: "ALL t::bool.
   2.122     (True --> t) = t &
   2.123     (t --> True) = True &
   2.124     (False --> t) = True & (t --> t) = True & (t --> False) = (~ t)"
   2.125    by (import bool IMP_CLAUSES)
   2.126  
   2.127 -lemma NOT_CLAUSES: "(ALL t. (~ ~ t) = t) & (~ True) = False & (~ False) = True"
   2.128 +lemma NOT_CLAUSES: "(ALL t::bool. (~ ~ t) = t) & (~ True) = False & (~ False) = True"
   2.129    by (import bool NOT_CLAUSES)
   2.130  
   2.131  lemma BOOL_EQ_DISTINCT: "True ~= False & False ~= True"
   2.132    by (import bool BOOL_EQ_DISTINCT)
   2.133  
   2.134 -lemma EQ_CLAUSES: "ALL t.
   2.135 +lemma EQ_CLAUSES: "ALL t::bool.
   2.136     (True = t) = t &
   2.137     (t = True) = t & (False = t) = (~ t) & (t = False) = (~ t)"
   2.138    by (import bool EQ_CLAUSES)
   2.139  
   2.140 -lemma COND_CLAUSES: "ALL t1 t2. (if True then t1 else t2) = t1 & (if False then t1 else t2) = t2"
   2.141 +lemma COND_CLAUSES: "ALL (t1::'a::type) t2::'a::type.
   2.142 +   (if True then t1 else t2) = t1 & (if False then t1 else t2) = t2"
   2.143    by (import bool COND_CLAUSES)
   2.144  
   2.145 -lemma SELECT_UNIQUE: "ALL P x. (ALL y. P y = (y = x)) --> Eps P = x"
   2.146 +lemma SELECT_UNIQUE: "ALL (P::'a::type => bool) x::'a::type.
   2.147 +   (ALL y::'a::type. P y = (y = x)) --> Eps P = x"
   2.148    by (import bool SELECT_UNIQUE)
   2.149  
   2.150 -lemma BOTH_EXISTS_AND_THM: "ALL (P::bool) Q::bool. (EX x::'a. P & Q) = ((EX x::'a. P) & (EX x::'a. Q))"
   2.151 +lemma BOTH_EXISTS_AND_THM: "ALL (P::bool) Q::bool.
   2.152 +   (EX x::'a::type. P & Q) = ((EX x::'a::type. P) & (EX x::'a::type. Q))"
   2.153    by (import bool BOTH_EXISTS_AND_THM)
   2.154  
   2.155  lemma BOTH_FORALL_OR_THM: "ALL (P::bool) Q::bool.
   2.156 -   (ALL x::'a. P | Q) = ((ALL x::'a. P) | (ALL x::'a. Q))"
   2.157 +   (ALL x::'a::type. P | Q) = ((ALL x::'a::type. P) | (ALL x::'a::type. Q))"
   2.158    by (import bool BOTH_FORALL_OR_THM)
   2.159  
   2.160  lemma BOTH_FORALL_IMP_THM: "ALL (P::bool) Q::bool.
   2.161 -   (ALL x::'a. P --> Q) = ((EX x::'a. P) --> (ALL x::'a. Q))"
   2.162 +   (ALL x::'a::type. P --> Q) =
   2.163 +   ((EX x::'a::type. P) --> (ALL x::'a::type. Q))"
   2.164    by (import bool BOTH_FORALL_IMP_THM)
   2.165  
   2.166  lemma BOTH_EXISTS_IMP_THM: "ALL (P::bool) Q::bool.
   2.167 -   (EX x::'a. P --> Q) = ((ALL x::'a. P) --> (EX x::'a. Q))"
   2.168 +   (EX x::'a::type. P --> Q) =
   2.169 +   ((ALL x::'a::type. P) --> (EX x::'a::type. Q))"
   2.170    by (import bool BOTH_EXISTS_IMP_THM)
   2.171  
   2.172 -lemma OR_IMP_THM: "ALL A B. (A = (B | A)) = (B --> A)"
   2.173 +lemma OR_IMP_THM: "ALL (A::bool) B::bool. (A = (B | A)) = (B --> A)"
   2.174    by (import bool OR_IMP_THM)
   2.175  
   2.176 -lemma DE_MORGAN_THM: "ALL A B. (~ (A & B)) = (~ A | ~ B) & (~ (A | B)) = (~ A & ~ B)"
   2.177 +lemma DE_MORGAN_THM: "ALL (A::bool) B::bool. (~ (A & B)) = (~ A | ~ B) & (~ (A | B)) = (~ A & ~ B)"
   2.178    by (import bool DE_MORGAN_THM)
   2.179  
   2.180 -lemma IMP_F_EQ_F: "ALL t. (t --> False) = (t = False)"
   2.181 +lemma IMP_F_EQ_F: "ALL t::bool. (t --> False) = (t = False)"
   2.182    by (import bool IMP_F_EQ_F)
   2.183  
   2.184 -lemma EQ_EXPAND: "ALL t1 t2. (t1 = t2) = (t1 & t2 | ~ t1 & ~ t2)"
   2.185 +lemma EQ_EXPAND: "ALL (t1::bool) t2::bool. (t1 = t2) = (t1 & t2 | ~ t1 & ~ t2)"
   2.186    by (import bool EQ_EXPAND)
   2.187  
   2.188 -lemma COND_RATOR: "ALL b f g x. (if b then f else g) x = (if b then f x else g x)"
   2.189 +lemma COND_RATOR: "ALL (b::bool) (f::'a::type => 'b::type) (g::'a::type => 'b::type)
   2.190 +   x::'a::type. (if b then f else g) x = (if b then f x else g x)"
   2.191    by (import bool COND_RATOR)
   2.192  
   2.193 -lemma COND_ABS: "ALL b f g. (%x. if b then f x else g x) = (if b then f else g)"
   2.194 +lemma COND_ABS: "ALL (b::bool) (f::'a::type => 'b::type) g::'a::type => 'b::type.
   2.195 +   (%x::'a::type. if b then f x else g x) = (if b then f else g)"
   2.196    by (import bool COND_ABS)
   2.197  
   2.198 -lemma COND_EXPAND: "ALL b t1 t2. (if b then t1 else t2) = ((~ b | t1) & (b | t2))"
   2.199 +lemma COND_EXPAND: "ALL (b::bool) (t1::bool) t2::bool.
   2.200 +   (if b then t1 else t2) = ((~ b | t1) & (b | t2))"
   2.201    by (import bool COND_EXPAND)
   2.202  
   2.203 -lemma ONE_ONE_THM: "ALL f. inj f = (ALL x1 x2. f x1 = f x2 --> x1 = x2)"
   2.204 +lemma ONE_ONE_THM: "ALL f::'a::type => 'b::type.
   2.205 +   inj f = (ALL (x1::'a::type) x2::'a::type. f x1 = f x2 --> x1 = x2)"
   2.206    by (import bool ONE_ONE_THM)
   2.207  
   2.208 -lemma ABS_REP_THM: "(All::(('a => bool) => bool) => bool)
   2.209 - (%P::'a => bool.
   2.210 +lemma ABS_REP_THM: "(All::(('a::type => bool) => bool) => bool)
   2.211 + (%P::'a::type => bool.
   2.212       (op -->::bool => bool => bool)
   2.213 -      ((Ex::(('b => 'a) => bool) => bool)
   2.214 -        ((TYPE_DEFINITION::('a => bool) => ('b => 'a) => bool) P))
   2.215 -      ((Ex::(('b => 'a) => bool) => bool)
   2.216 -        (%x::'b => 'a.
   2.217 -            (Ex::(('a => 'b) => bool) => bool)
   2.218 -             (%abs::'a => 'b.
   2.219 +      ((Ex::(('b::type => 'a::type) => bool) => bool)
   2.220 +        ((TYPE_DEFINITION::('a::type => bool)
   2.221 +                           => ('b::type => 'a::type) => bool)
   2.222 +          P))
   2.223 +      ((Ex::(('b::type => 'a::type) => bool) => bool)
   2.224 +        (%x::'b::type => 'a::type.
   2.225 +            (Ex::(('a::type => 'b::type) => bool) => bool)
   2.226 +             (%abs::'a::type => 'b::type.
   2.227                   (op &::bool => bool => bool)
   2.228 -                  ((All::('b => bool) => bool)
   2.229 -                    (%a::'b. (op =::'b => 'b => bool) (abs (x a)) a))
   2.230 -                  ((All::('a => bool) => bool)
   2.231 -                    (%r::'a.
   2.232 +                  ((All::('b::type => bool) => bool)
   2.233 +                    (%a::'b::type.
   2.234 +                        (op =::'b::type => 'b::type => bool) (abs (x a)) a))
   2.235 +                  ((All::('a::type => bool) => bool)
   2.236 +                    (%r::'a::type.
   2.237                          (op =::bool => bool => bool) (P r)
   2.238 -                         ((op =::'a => 'a => bool) (x (abs r)) r)))))))"
   2.239 +                         ((op =::'a::type => 'a::type => bool) (x (abs r))
   2.240 +                           r)))))))"
   2.241    by (import bool ABS_REP_THM)
   2.242  
   2.243 -lemma LET_RAND: "(P::'b => bool) (Let (M::'a) (N::'a => 'b)) = (let x::'a = M in P (N x))"
   2.244 +lemma LET_RAND: "(P::'b::type => bool) (Let (M::'a::type) (N::'a::type => 'b::type)) =
   2.245 +(let x::'a::type = M in P (N x))"
   2.246    by (import bool LET_RAND)
   2.247  
   2.248 -lemma LET_RATOR: "Let (M::'a) (N::'a => 'b => 'c) (b::'b) = (let x::'a = M in N x b)"
   2.249 +lemma LET_RATOR: "Let (M::'a::type) (N::'a::type => 'b::type => 'c::type) (b::'b::type) =
   2.250 +(let x::'a::type = M in N x b)"
   2.251    by (import bool LET_RATOR)
   2.252  
   2.253 -lemma SWAP_FORALL_THM: "ALL P. (ALL x. All (P x)) = (ALL y x. P x y)"
   2.254 +lemma SWAP_FORALL_THM: "ALL P::'a::type => 'b::type => bool.
   2.255 +   (ALL x::'a::type. All (P x)) = (ALL (y::'b::type) x::'a::type. P x y)"
   2.256    by (import bool SWAP_FORALL_THM)
   2.257  
   2.258 -lemma SWAP_EXISTS_THM: "ALL P. (EX x. Ex (P x)) = (EX y x. P x y)"
   2.259 +lemma SWAP_EXISTS_THM: "ALL P::'a::type => 'b::type => bool.
   2.260 +   (EX x::'a::type. Ex (P x)) = (EX (y::'b::type) x::'a::type. P x y)"
   2.261    by (import bool SWAP_EXISTS_THM)
   2.262  
   2.263 -lemma AND_CONG: "ALL P P' Q Q'. (Q --> P = P') & (P' --> Q = Q') --> (P & Q) = (P' & Q')"
   2.264 +lemma AND_CONG: "ALL (P::bool) (P'::bool) (Q::bool) Q'::bool.
   2.265 +   (Q --> P = P') & (P' --> Q = Q') --> (P & Q) = (P' & Q')"
   2.266    by (import bool AND_CONG)
   2.267  
   2.268 -lemma OR_CONG: "ALL P P' Q Q'. (~ Q --> P = P') & (~ P' --> Q = Q') --> (P | Q) = (P' | Q')"
   2.269 +lemma OR_CONG: "ALL (P::bool) (P'::bool) (Q::bool) Q'::bool.
   2.270 +   (~ Q --> P = P') & (~ P' --> Q = Q') --> (P | Q) = (P' | Q')"
   2.271    by (import bool OR_CONG)
   2.272  
   2.273 -lemma COND_CONG: "ALL P Q x x' y y'.
   2.274 +lemma COND_CONG: "ALL (P::bool) (Q::bool) (x::'a::type) (x'::'a::type) (y::'a::type)
   2.275 +   y'::'a::type.
   2.276     P = Q & (Q --> x = x') & (~ Q --> y = y') -->
   2.277     (if P then x else y) = (if Q then x' else y')"
   2.278    by (import bool COND_CONG)
   2.279  
   2.280 -lemma MONO_COND: "(x --> y) --> (z --> w) --> (if b then x else z) --> (if b then y else w)"
   2.281 +lemma MONO_COND: "((x::bool) --> (y::bool)) -->
   2.282 +((z::bool) --> (w::bool)) -->
   2.283 +(if b::bool then x else z) --> (if b then y else w)"
   2.284    by (import bool MONO_COND)
   2.285  
   2.286 -lemma SKOLEM_THM: "ALL P. (ALL x. Ex (P x)) = (EX f. ALL x. P x (f x))"
   2.287 +lemma SKOLEM_THM: "ALL P::'a::type => 'b::type => bool.
   2.288 +   (ALL x::'a::type. Ex (P x)) =
   2.289 +   (EX f::'a::type => 'b::type. ALL x::'a::type. P x (f x))"
   2.290    by (import bool SKOLEM_THM)
   2.291  
   2.292 -lemma bool_case_thm: "(ALL (e0::'a) e1::'a. (case True of True => e0 | False => e1) = e0) &
   2.293 -(ALL (e0::'a) e1::'a. (case False of True => e0 | False => e1) = e1)"
   2.294 +lemma bool_case_thm: "(ALL (e0::'a::type) e1::'a::type.
   2.295 +    (case True of True => e0 | False => e1) = e0) &
   2.296 +(ALL (e0::'a::type) e1::'a::type.
   2.297 +    (case False of True => e0 | False => e1) = e1)"
   2.298    by (import bool bool_case_thm)
   2.299  
   2.300 -lemma bool_case_ID: "ALL x b. (case b of True => x | _ => x) = x"
   2.301 +lemma bool_case_ID: "ALL (x::'a::type) b::bool. (case b of True => x | _ => x) = x"
   2.302    by (import bool bool_case_ID)
   2.303  
   2.304 -lemma boolAxiom: "ALL e0 e1. EX x. x True = e0 & x False = e1"
   2.305 +lemma boolAxiom: "ALL (e0::'a::type) e1::'a::type.
   2.306 +   EX x::bool => 'a::type. x True = e0 & x False = e1"
   2.307    by (import bool boolAxiom)
   2.308  
   2.309 -lemma UEXISTS_OR_THM: "ALL P Q. (EX! x. P x | Q x) --> Ex1 P | Ex1 Q"
   2.310 +lemma UEXISTS_OR_THM: "ALL (P::'a::type => bool) Q::'a::type => bool.
   2.311 +   (EX! x::'a::type. P x | Q x) --> Ex1 P | Ex1 Q"
   2.312    by (import bool UEXISTS_OR_THM)
   2.313  
   2.314 -lemma UEXISTS_SIMP: "(EX! x::'a. (t::bool)) = (t & (ALL x::'a. All (op = x)))"
   2.315 +lemma UEXISTS_SIMP: "(EX! x::'a::type. (t::bool)) = (t & (ALL x::'a::type. All (op = x)))"
   2.316    by (import bool UEXISTS_SIMP)
   2.317  
   2.318  consts
   2.319 -  RES_ABSTRACT :: "('a => bool) => ('a => 'b) => 'a => 'b" 
   2.320 -
   2.321 -specification (RES_ABSTRACT) RES_ABSTRACT_DEF: "(ALL (p::'a => bool) (m::'a => 'b) x::'a.
   2.322 +  RES_ABSTRACT :: "('a::type => bool) => ('a::type => 'b::type) => 'a::type => 'b::type" 
   2.323 +
   2.324 +specification (RES_ABSTRACT) RES_ABSTRACT_DEF: "(ALL (p::'a::type => bool) (m::'a::type => 'b::type) x::'a::type.
   2.325      IN x p --> RES_ABSTRACT p m x = m x) &
   2.326 -(ALL (p::'a => bool) (m1::'a => 'b) m2::'a => 'b.
   2.327 -    (ALL x::'a. IN x p --> m1 x = m2 x) -->
   2.328 +(ALL (p::'a::type => bool) (m1::'a::type => 'b::type)
   2.329 +    m2::'a::type => 'b::type.
   2.330 +    (ALL x::'a::type. IN x p --> m1 x = m2 x) -->
   2.331      RES_ABSTRACT p m1 = RES_ABSTRACT p m2)"
   2.332    by (import bool RES_ABSTRACT_DEF)
   2.333  
   2.334 -lemma BOOL_FUN_CASES_THM: "ALL f. f = (%b. True) | f = (%b. False) | f = (%b. b) | f = Not"
   2.335 +lemma BOOL_FUN_CASES_THM: "ALL f::bool => bool.
   2.336 +   f = (%b::bool. True) |
   2.337 +   f = (%b::bool. False) | f = (%b::bool. b) | f = Not"
   2.338    by (import bool BOOL_FUN_CASES_THM)
   2.339  
   2.340 -lemma BOOL_FUN_INDUCT: "ALL P. P (%b. True) & P (%b. False) & P (%b. b) & P Not --> All P"
   2.341 +lemma BOOL_FUN_INDUCT: "ALL P::(bool => bool) => bool.
   2.342 +   P (%b::bool. True) & P (%b::bool. False) & P (%b::bool. b) & P Not -->
   2.343 +   All P"
   2.344    by (import bool BOOL_FUN_INDUCT)
   2.345  
   2.346  ;end_setup
   2.347 @@ -221,67 +265,80 @@
   2.348  ;setup_theory combin
   2.349  
   2.350  constdefs
   2.351 -  K :: "'a => 'b => 'a" 
   2.352 -  "K == %x y. x"
   2.353 -
   2.354 -lemma K_DEF: "K = (%x y. x)"
   2.355 +  K :: "'a::type => 'b::type => 'a::type" 
   2.356 +  "K == %(x::'a::type) y::'b::type. x"
   2.357 +
   2.358 +lemma K_DEF: "K = (%(x::'a::type) y::'b::type. x)"
   2.359    by (import combin K_DEF)
   2.360  
   2.361  constdefs
   2.362 -  S :: "('a => 'b => 'c) => ('a => 'b) => 'a => 'c" 
   2.363 -  "S == %f g x. f x (g x)"
   2.364 -
   2.365 -lemma S_DEF: "S = (%f g x. f x (g x))"
   2.366 +  S :: "('a::type => 'b::type => 'c::type)
   2.367 +=> ('a::type => 'b::type) => 'a::type => 'c::type" 
   2.368 +  "S ==
   2.369 +%(f::'a::type => 'b::type => 'c::type) (g::'a::type => 'b::type)
   2.370 +   x::'a::type. f x (g x)"
   2.371 +
   2.372 +lemma S_DEF: "S =
   2.373 +(%(f::'a::type => 'b::type => 'c::type) (g::'a::type => 'b::type)
   2.374 +    x::'a::type. f x (g x))"
   2.375    by (import combin S_DEF)
   2.376  
   2.377  constdefs
   2.378 -  I :: "'a => 'a" 
   2.379 -  "(op ==::('a => 'a) => ('a => 'a) => prop) (I::'a => 'a)
   2.380 - ((S::('a => ('a => 'a) => 'a) => ('a => 'a => 'a) => 'a => 'a)
   2.381 -   (K::'a => ('a => 'a) => 'a) (K::'a => 'a => 'a))"
   2.382 -
   2.383 -lemma I_DEF: "(op =::('a => 'a) => ('a => 'a) => bool) (I::'a => 'a)
   2.384 - ((S::('a => ('a => 'a) => 'a) => ('a => 'a => 'a) => 'a => 'a)
   2.385 -   (K::'a => ('a => 'a) => 'a) (K::'a => 'a => 'a))"
   2.386 +  I :: "'a::type => 'a::type" 
   2.387 +  "(op ==::('a::type => 'a::type) => ('a::type => 'a::type) => prop)
   2.388 + (I::'a::type => 'a::type)
   2.389 + ((S::('a::type => ('a::type => 'a::type) => 'a::type)
   2.390 +      => ('a::type => 'a::type => 'a::type) => 'a::type => 'a::type)
   2.391 +   (K::'a::type => ('a::type => 'a::type) => 'a::type)
   2.392 +   (K::'a::type => 'a::type => 'a::type))"
   2.393 +
   2.394 +lemma I_DEF: "(op =::('a::type => 'a::type) => ('a::type => 'a::type) => bool)
   2.395 + (I::'a::type => 'a::type)
   2.396 + ((S::('a::type => ('a::type => 'a::type) => 'a::type)
   2.397 +      => ('a::type => 'a::type => 'a::type) => 'a::type => 'a::type)
   2.398 +   (K::'a::type => ('a::type => 'a::type) => 'a::type)
   2.399 +   (K::'a::type => 'a::type => 'a::type))"
   2.400    by (import combin I_DEF)
   2.401  
   2.402  constdefs
   2.403 -  C :: "('a => 'b => 'c) => 'b => 'a => 'c" 
   2.404 -  "C == %f x y. f y x"
   2.405 -
   2.406 -lemma C_DEF: "C = (%f x y. f y x)"
   2.407 +  C :: "('a::type => 'b::type => 'c::type) => 'b::type => 'a::type => 'c::type" 
   2.408 +  "C == %(f::'a::type => 'b::type => 'c::type) (x::'b::type) y::'a::type. f y x"
   2.409 +
   2.410 +lemma C_DEF: "C =
   2.411 +(%(f::'a::type => 'b::type => 'c::type) (x::'b::type) y::'a::type. f y x)"
   2.412    by (import combin C_DEF)
   2.413  
   2.414  constdefs
   2.415 -  W :: "('a => 'a => 'b) => 'a => 'b" 
   2.416 -  "W == %f x. f x x"
   2.417 -
   2.418 -lemma W_DEF: "W = (%f x. f x x)"
   2.419 +  W :: "('a::type => 'a::type => 'b::type) => 'a::type => 'b::type" 
   2.420 +  "W == %(f::'a::type => 'a::type => 'b::type) x::'a::type. f x x"
   2.421 +
   2.422 +lemma W_DEF: "W = (%(f::'a::type => 'a::type => 'b::type) x::'a::type. f x x)"
   2.423    by (import combin W_DEF)
   2.424  
   2.425 -lemma I_THM: "ALL x. I x = x"
   2.426 +lemma I_THM: "ALL x::'a::type. I x = x"
   2.427    by (import combin I_THM)
   2.428  
   2.429 -lemma I_o_ID: "ALL f. I o f = f & f o I = f"
   2.430 +lemma I_o_ID: "ALL f::'a::type => 'b::type. I o f = f & f o I = f"
   2.431    by (import combin I_o_ID)
   2.432  
   2.433  ;end_setup
   2.434  
   2.435  ;setup_theory sum
   2.436  
   2.437 -lemma ISL_OR_ISR: "ALL x. ISL x | ISR x"
   2.438 +lemma ISL_OR_ISR: "ALL x::'a::type + 'b::type. ISL x | ISR x"
   2.439    by (import sum ISL_OR_ISR)
   2.440  
   2.441 -lemma INL: "ALL x. ISL x --> Inl (OUTL x) = x"
   2.442 +lemma INL: "ALL x::'a::type + 'b::type. ISL x --> Inl (OUTL x) = x"
   2.443    by (import sum INL)
   2.444  
   2.445 -lemma INR: "ALL x. ISR x --> Inr (OUTR x) = x"
   2.446 +lemma INR: "ALL x::'a::type + 'b::type. ISR x --> Inr (OUTR x) = x"
   2.447    by (import sum INR)
   2.448  
   2.449 -lemma sum_case_cong: "ALL (M::'b + 'c) (M'::'b + 'c) (f::'b => 'a) g::'c => 'a.
   2.450 +lemma sum_case_cong: "ALL (M::'b::type + 'c::type) (M'::'b::type + 'c::type)
   2.451 +   (f::'b::type => 'a::type) g::'c::type => 'a::type.
   2.452     M = M' &
   2.453 -   (ALL x::'b. M' = Inl x --> f x = (f'::'b => 'a) x) &
   2.454 -   (ALL y::'c. M' = Inr y --> g y = (g'::'c => 'a) y) -->
   2.455 +   (ALL x::'b::type. M' = Inl x --> f x = (f'::'b::type => 'a::type) x) &
   2.456 +   (ALL y::'c::type. M' = Inr y --> g y = (g'::'c::type => 'a::type) y) -->
   2.457     sum_case f g M = sum_case f' g' M'"
   2.458    by (import sum sum_case_cong)
   2.459  
   2.460 @@ -294,167 +351,194 @@
   2.461  ;setup_theory option
   2.462  
   2.463  lemma option_CLAUSES: "(op &::bool => bool => bool)
   2.464 - ((All::('a => bool) => bool)
   2.465 -   (%x::'a.
   2.466 -       (All::('a => bool) => bool)
   2.467 -        (%y::'a.
   2.468 + ((All::('a::type => bool) => bool)
   2.469 +   (%x::'a::type.
   2.470 +       (All::('a::type => bool) => bool)
   2.471 +        (%y::'a::type.
   2.472              (op =::bool => bool => bool)
   2.473 -             ((op =::'a option => 'a option => bool) ((Some::'a ~=> 'a) x)
   2.474 -               ((Some::'a ~=> 'a) y))
   2.475 -             ((op =::'a => 'a => bool) x y))))
   2.476 +             ((op =::'a::type option => 'a::type option => bool)
   2.477 +               ((Some::'a::type ~=> 'a::type) x)
   2.478 +               ((Some::'a::type ~=> 'a::type) y))
   2.479 +             ((op =::'a::type => 'a::type => bool) x y))))
   2.480   ((op &::bool => bool => bool)
   2.481 -   ((All::('a => bool) => bool)
   2.482 -     (%x::'a.
   2.483 -         (op =::'a => 'a => bool)
   2.484 -          ((the::'a option => 'a) ((Some::'a ~=> 'a) x)) x))
   2.485 +   ((All::('a::type => bool) => bool)
   2.486 +     (%x::'a::type.
   2.487 +         (op =::'a::type => 'a::type => bool)
   2.488 +          ((the::'a::type option => 'a::type)
   2.489 +            ((Some::'a::type ~=> 'a::type) x))
   2.490 +          x))
   2.491     ((op &::bool => bool => bool)
   2.492 -     ((All::('a => bool) => bool)
   2.493 -       (%x::'a.
   2.494 +     ((All::('a::type => bool) => bool)
   2.495 +       (%x::'a::type.
   2.496             (Not::bool => bool)
   2.497 -            ((op =::'a option => 'a option => bool) (None::'a option)
   2.498 -              ((Some::'a ~=> 'a) x))))
   2.499 +            ((op =::'a::type option => 'a::type option => bool)
   2.500 +              (None::'a::type option) ((Some::'a::type ~=> 'a::type) x))))
   2.501       ((op &::bool => bool => bool)
   2.502 -       ((All::('a => bool) => bool)
   2.503 -         (%x::'a.
   2.504 +       ((All::('a::type => bool) => bool)
   2.505 +         (%x::'a::type.
   2.506               (Not::bool => bool)
   2.507 -              ((op =::'a option => 'a option => bool) ((Some::'a ~=> 'a) x)
   2.508 -                (None::'a option))))
   2.509 +              ((op =::'a::type option => 'a::type option => bool)
   2.510 +                ((Some::'a::type ~=> 'a::type) x) (None::'a::type option))))
   2.511         ((op &::bool => bool => bool)
   2.512 -         ((All::('a => bool) => bool)
   2.513 -           (%x::'a.
   2.514 +         ((All::('a::type => bool) => bool)
   2.515 +           (%x::'a::type.
   2.516                 (op =::bool => bool => bool)
   2.517 -                ((IS_SOME::'a option => bool) ((Some::'a ~=> 'a) x))
   2.518 +                ((IS_SOME::'a::type option => bool)
   2.519 +                  ((Some::'a::type ~=> 'a::type) x))
   2.520                  (True::bool)))
   2.521           ((op &::bool => bool => bool)
   2.522             ((op =::bool => bool => bool)
   2.523 -             ((IS_SOME::'a option => bool) (None::'a option)) (False::bool))
   2.524 +             ((IS_SOME::'a::type option => bool) (None::'a::type option))
   2.525 +             (False::bool))
   2.526             ((op &::bool => bool => bool)
   2.527 -             ((All::('a option => bool) => bool)
   2.528 -               (%x::'a option.
   2.529 +             ((All::('a::type option => bool) => bool)
   2.530 +               (%x::'a::type option.
   2.531                     (op =::bool => bool => bool)
   2.532 -                    ((IS_NONE::'a option => bool) x)
   2.533 -                    ((op =::'a option => 'a option => bool) x
   2.534 -                      (None::'a option))))
   2.535 +                    ((IS_NONE::'a::type option => bool) x)
   2.536 +                    ((op =::'a::type option => 'a::type option => bool) x
   2.537 +                      (None::'a::type option))))
   2.538               ((op &::bool => bool => bool)
   2.539 -               ((All::('a option => bool) => bool)
   2.540 -                 (%x::'a option.
   2.541 +               ((All::('a::type option => bool) => bool)
   2.542 +                 (%x::'a::type option.
   2.543                       (op =::bool => bool => bool)
   2.544 -                      ((Not::bool => bool) ((IS_SOME::'a option => bool) x))
   2.545 -                      ((op =::'a option => 'a option => bool) x
   2.546 -                        (None::'a option))))
   2.547 +                      ((Not::bool => bool)
   2.548 +                        ((IS_SOME::'a::type option => bool) x))
   2.549 +                      ((op =::'a::type option => 'a::type option => bool) x
   2.550 +                        (None::'a::type option))))
   2.551                 ((op &::bool => bool => bool)
   2.552 -                 ((All::('a option => bool) => bool)
   2.553 -                   (%x::'a option.
   2.554 +                 ((All::('a::type option => bool) => bool)
   2.555 +                   (%x::'a::type option.
   2.556                         (op -->::bool => bool => bool)
   2.557 -                        ((IS_SOME::'a option => bool) x)
   2.558 -                        ((op =::'a option => 'a option => bool)
   2.559 -                          ((Some::'a ~=> 'a) ((the::'a option => 'a) x))
   2.560 +                        ((IS_SOME::'a::type option => bool) x)
   2.561 +                        ((op =::'a::type option => 'a::type option => bool)
   2.562 +                          ((Some::'a::type ~=> 'a::type)
   2.563 +                            ((the::'a::type option => 'a::type) x))
   2.564                            x)))
   2.565                   ((op &::bool => bool => bool)
   2.566 -                   ((All::('a option => bool) => bool)
   2.567 -                     (%x::'a option.
   2.568 -                         (op =::'a option => 'a option => bool)
   2.569 -                          ((option_case::'a option
   2.570 -   => ('a ~=> 'a) => 'a option ~=> 'a)
   2.571 -                            (None::'a option) (Some::'a ~=> 'a) x)
   2.572 +                   ((All::('a::type option => bool) => bool)
   2.573 +                     (%x::'a::type option.
   2.574 +                         (op =::'a::type option => 'a::type option => bool)
   2.575 +                          ((option_case::'a::type option
   2.576 +   => ('a::type ~=> 'a::type) => 'a::type option ~=> 'a::type)
   2.577 +                            (None::'a::type option)
   2.578 +                            (Some::'a::type ~=> 'a::type) x)
   2.579                            x))
   2.580                     ((op &::bool => bool => bool)
   2.581 -                     ((All::('a option => bool) => bool)
   2.582 -                       (%x::'a option.
   2.583 -                           (op =::'a option => 'a option => bool)
   2.584 -                            ((option_case::'a option
   2.585 -     => ('a ~=> 'a) => 'a option ~=> 'a)
   2.586 -                              x (Some::'a ~=> 'a) x)
   2.587 +                     ((All::('a::type option => bool) => bool)
   2.588 +                       (%x::'a::type option.
   2.589 +                           (op =::'a::type option
   2.590 +                                  => 'a::type option => bool)
   2.591 +                            ((option_case::'a::type option
   2.592 +     => ('a::type ~=> 'a::type) => 'a::type option ~=> 'a::type)
   2.593 +                              x (Some::'a::type ~=> 'a::type) x)
   2.594                              x))
   2.595                       ((op &::bool => bool => bool)
   2.596 -                       ((All::('a option => bool) => bool)
   2.597 -                         (%x::'a option.
   2.598 +                       ((All::('a::type option => bool) => bool)
   2.599 +                         (%x::'a::type option.
   2.600                               (op -->::bool => bool => bool)
   2.601 -                              ((IS_NONE::'a option => bool) x)
   2.602 -                              ((op =::'b => 'b => bool)
   2.603 -                                ((option_case::'b
   2.604 -         => ('a => 'b) => 'a option => 'b)
   2.605 -                                  (e::'b) (f::'a => 'b) x)
   2.606 +                              ((IS_NONE::'a::type option => bool) x)
   2.607 +                              ((op =::'b::type => 'b::type => bool)
   2.608 +                                ((option_case::'b::type
   2.609 +         => ('a::type => 'b::type) => 'a::type option => 'b::type)
   2.610 +                                  (e::'b::type) (f::'a::type => 'b::type) x)
   2.611                                  e)))
   2.612                         ((op &::bool => bool => bool)
   2.613 -                         ((All::('a option => bool) => bool)
   2.614 -                           (%x::'a option.
   2.615 +                         ((All::('a::type option => bool) => bool)
   2.616 +                           (%x::'a::type option.
   2.617                                 (op -->::bool => bool => bool)
   2.618 -                                ((IS_SOME::'a option => bool) x)
   2.619 -                                ((op =::'b => 'b => bool)
   2.620 -                                  ((option_case::'b
   2.621 -           => ('a => 'b) => 'a option => 'b)
   2.622 +                                ((IS_SOME::'a::type option => bool) x)
   2.623 +                                ((op =::'b::type => 'b::type => bool)
   2.624 +                                  ((option_case::'b::type
   2.625 +           => ('a::type => 'b::type) => 'a::type option => 'b::type)
   2.626                                      e f x)
   2.627 -                                  (f ((the::'a option => 'a) x)))))
   2.628 +                                  (f ((the::'a::type option => 'a::type)
   2.629 + x)))))
   2.630                           ((op &::bool => bool => bool)
   2.631 -                           ((All::('a option => bool) => bool)
   2.632 -                             (%x::'a option.
   2.633 +                           ((All::('a::type option => bool) => bool)
   2.634 +                             (%x::'a::type option.
   2.635                                   (op -->::bool => bool => bool)
   2.636 -                                  ((IS_SOME::'a option => bool) x)
   2.637 -                                  ((op =::'a option => 'a option => bool)
   2.638 -                                    ((option_case::'a option
   2.639 -             => ('a ~=> 'a) => 'a option ~=> 'a)
   2.640 -(ea::'a option) (Some::'a ~=> 'a) x)
   2.641 +                                  ((IS_SOME::'a::type option => bool) x)
   2.642 +                                  ((op =::'a::type option
   2.643 +    => 'a::type option => bool)
   2.644 +                                    ((option_case::'a::type option
   2.645 +             => ('a::type ~=> 'a::type) => 'a::type option ~=> 'a::type)
   2.646 +(ea::'a::type option) (Some::'a::type ~=> 'a::type) x)
   2.647                                      x)))
   2.648                             ((op &::bool => bool => bool)
   2.649 -                             ((All::('b => bool) => bool)
   2.650 -                               (%u::'b.
   2.651 -                                   (All::(('a => 'b) => bool) => bool)
   2.652 -                                    (%f::'a => 'b.
   2.653 -  (op =::'b => 'b => bool)
   2.654 -   ((option_case::'b => ('a => 'b) => 'a option => 'b) u f
   2.655 -     (None::'a option))
   2.656 +                             ((All::('b::type => bool) => bool)
   2.657 +                               (%u::'b::type.
   2.658 +                                   (All::(('a::type => 'b::type) => bool)
   2.659 +   => bool)
   2.660 +                                    (%f::'a::type => 'b::type.
   2.661 +  (op =::'b::type => 'b::type => bool)
   2.662 +   ((option_case::'b::type
   2.663 +                  => ('a::type => 'b::type) => 'a::type option => 'b::type)
   2.664 +     u f (None::'a::type option))
   2.665     u)))
   2.666                               ((op &::bool => bool => bool)
   2.667 -                               ((All::('b => bool) => bool)
   2.668 -                                 (%u::'b.
   2.669 -                                     (All::(('a => 'b) => bool) => bool)
   2.670 -(%f::'a => 'b.
   2.671 -    (All::('a => bool) => bool)
   2.672 -     (%x::'a.
   2.673 -         (op =::'b => 'b => bool)
   2.674 -          ((option_case::'b => ('a => 'b) => 'a option => 'b) u f
   2.675 -            ((Some::'a ~=> 'a) x))
   2.676 +                               ((All::('b::type => bool) => bool)
   2.677 +                                 (%u::'b::type.
   2.678 +                                     (All::(('a::type => 'b::type) => bool)
   2.679 +     => bool)
   2.680 +(%f::'a::type => 'b::type.
   2.681 +    (All::('a::type => bool) => bool)
   2.682 +     (%x::'a::type.
   2.683 +         (op =::'b::type => 'b::type => bool)
   2.684 +          ((option_case::'b::type
   2.685 +                         => ('a::type => 'b::type)
   2.686 +                            => 'a::type option => 'b::type)
   2.687 +            u f ((Some::'a::type ~=> 'a::type) x))
   2.688            (f x)))))
   2.689                                 ((op &::bool => bool => bool)
   2.690 -                                 ((All::(('a => 'b) => bool) => bool)
   2.691 -                                   (%f::'a => 'b.
   2.692 - (All::('a => bool) => bool)
   2.693 -  (%x::'a.
   2.694 -      (op =::'b option => 'b option => bool)
   2.695 -       ((option_map::('a => 'b) => 'a option ~=> 'b) f
   2.696 -         ((Some::'a ~=> 'a) x))
   2.697 -       ((Some::'b ~=> 'b) (f x)))))
   2.698 +                                 ((All::(('a::type => 'b::type) => bool)
   2.699 +  => bool)
   2.700 +                                   (%f::'a::type => 'b::type.
   2.701 + (All::('a::type => bool) => bool)
   2.702 +  (%x::'a::type.
   2.703 +      (op =::'b::type option => 'b::type option => bool)
   2.704 +       ((option_map::('a::type => 'b::type) => 'a::type option ~=> 'b::type)
   2.705 +         f ((Some::'a::type ~=> 'a::type) x))
   2.706 +       ((Some::'b::type ~=> 'b::type) (f x)))))
   2.707                                   ((op &::bool => bool => bool)
   2.708 -                                   ((All::(('a => 'b) => bool) => bool)
   2.709 -                                     (%f::'a => 'b.
   2.710 -   (op =::'b option => 'b option => bool)
   2.711 -    ((option_map::('a => 'b) => 'a option ~=> 'b) f (None::'a option))
   2.712 -    (None::'b option)))
   2.713 +                                   ((All::(('a::type => 'b::type) => bool)
   2.714 +    => bool)
   2.715 +                                     (%f::'a::type => 'b::type.
   2.716 +   (op =::'b::type option => 'b::type option => bool)
   2.717 +    ((option_map::('a::type => 'b::type) => 'a::type option ~=> 'b::type) f
   2.718 +      (None::'a::type option))
   2.719 +    (None::'b::type option)))
   2.720                                     ((op &::bool => bool => bool)
   2.721 -                                     ((op =::'a option => 'a option => bool)
   2.722 - ((OPTION_JOIN::'a option option ~=> 'a) (None::'a option option))
   2.723 - (None::'a option))
   2.724 -                                     ((All::('a option => bool) => bool)
   2.725 - (%x::'a option.
   2.726 -     (op =::'a option => 'a option => bool)
   2.727 -      ((OPTION_JOIN::'a option option ~=> 'a)
   2.728 -        ((Some::'a option ~=> 'a option) x))
   2.729 +                                     ((op =::'a::type option
   2.730 +       => 'a::type option => bool)
   2.731 + ((OPTION_JOIN::'a::type option option ~=> 'a::type)
   2.732 +   (None::'a::type option option))
   2.733 + (None::'a::type option))
   2.734 +                                     ((All::('a::type option => bool)
   2.735 +      => bool)
   2.736 + (%x::'a::type option.
   2.737 +     (op =::'a::type option => 'a::type option => bool)
   2.738 +      ((OPTION_JOIN::'a::type option option ~=> 'a::type)
   2.739 +        ((Some::'a::type option ~=> 'a::type option) x))
   2.740        x))))))))))))))))))))"
   2.741    by (import option option_CLAUSES)
   2.742  
   2.743 -lemma option_case_compute: "option_case (e::'b) (f::'a => 'b) (x::'a option) =
   2.744 +lemma option_case_compute: "option_case (e::'b::type) (f::'a::type => 'b::type) (x::'a::type option) =
   2.745  (if IS_SOME x then f (the x) else e)"
   2.746    by (import option option_case_compute)
   2.747  
   2.748 -lemma OPTION_MAP_EQ_SOME: "ALL f x y. (option_map f x = Some y) = (EX z. x = Some z & y = f z)"
   2.749 +lemma OPTION_MAP_EQ_SOME: "ALL (f::'a::type => 'b::type) (x::'a::type option) y::'b::type.
   2.750 +   (option_map f x = Some y) = (EX z::'a::type. x = Some z & y = f z)"
   2.751    by (import option OPTION_MAP_EQ_SOME)
   2.752  
   2.753 -lemma OPTION_JOIN_EQ_SOME: "ALL x xa. (OPTION_JOIN x = Some xa) = (x = Some (Some xa))"
   2.754 +lemma OPTION_JOIN_EQ_SOME: "ALL (x::'a::type option option) xa::'a::type.
   2.755 +   (OPTION_JOIN x = Some xa) = (x = Some (Some xa))"
   2.756    by (import option OPTION_JOIN_EQ_SOME)
   2.757  
   2.758 -lemma option_case_cong: "ALL M M' u f.
   2.759 -   M = M' & (M' = None --> u = u') & (ALL x. M' = Some x --> f x = f' x) -->
   2.760 +lemma option_case_cong: "ALL (M::'a::type option) (M'::'a::type option) (u::'b::type)
   2.761 +   f::'a::type => 'b::type.
   2.762 +   M = M' &
   2.763 +   (M' = None --> u = (u'::'b::type)) &
   2.764 +   (ALL x::'a::type. M' = Some x --> f x = (f'::'a::type => 'b::type) x) -->
   2.765     option_case u f M = option_case u' f' M'"
   2.766    by (import option option_case_cong)
   2.767  
   2.768 @@ -463,33 +547,33 @@
   2.769  ;setup_theory marker
   2.770  
   2.771  consts
   2.772 -  stmarker :: "'a => 'a" 
   2.773 +  stmarker :: "'a::type => 'a::type" 
   2.774  
   2.775  defs
   2.776 -  stmarker_primdef: "stmarker == %x. x"
   2.777 -
   2.778 -lemma stmarker_def: "ALL x. stmarker x = x"
   2.779 +  stmarker_primdef: "stmarker == %x::'a::type. x"
   2.780 +
   2.781 +lemma stmarker_def: "ALL x::'a::type. stmarker x = x"
   2.782    by (import marker stmarker_def)
   2.783  
   2.784 -lemma move_left_conj: "ALL x xa xb.
   2.785 +lemma move_left_conj: "ALL (x::bool) (xa::bool) xb::bool.
   2.786     (x & stmarker xb) = (stmarker xb & x) &
   2.787     ((stmarker xb & x) & xa) = (stmarker xb & x & xa) &
   2.788     (x & stmarker xb & xa) = (stmarker xb & x & xa)"
   2.789    by (import marker move_left_conj)
   2.790  
   2.791 -lemma move_right_conj: "ALL x xa xb.
   2.792 +lemma move_right_conj: "ALL (x::bool) (xa::bool) xb::bool.
   2.793     (stmarker xb & x) = (x & stmarker xb) &
   2.794     (x & xa & stmarker xb) = ((x & xa) & stmarker xb) &
   2.795     ((x & stmarker xb) & xa) = ((x & xa) & stmarker xb)"
   2.796    by (import marker move_right_conj)
   2.797  
   2.798 -lemma move_left_disj: "ALL x xa xb.
   2.799 +lemma move_left_disj: "ALL (x::bool) (xa::bool) xb::bool.
   2.800     (x | stmarker xb) = (stmarker xb | x) &
   2.801     ((stmarker xb | x) | xa) = (stmarker xb | x | xa) &
   2.802     (x | stmarker xb | xa) = (stmarker xb | x | xa)"
   2.803    by (import marker move_left_disj)
   2.804  
   2.805 -lemma move_right_disj: "ALL x xa xb.
   2.806 +lemma move_right_disj: "ALL (x::bool) (xa::bool) xb::bool.
   2.807     (stmarker xb | x) = (x | stmarker xb) &
   2.808     (x | xa | stmarker xb) = ((x | xa) | stmarker xb) &
   2.809     ((x | stmarker xb) | xa) = ((x | xa) | stmarker xb)"
   2.810 @@ -500,356 +584,516 @@
   2.811  ;setup_theory relation
   2.812  
   2.813  constdefs
   2.814 -  TC :: "('a => 'a => bool) => 'a => 'a => bool" 
   2.815 +  TC :: "('a::type => 'a::type => bool) => 'a::type => 'a::type => bool" 
   2.816    "TC ==
   2.817 -%R a b.
   2.818 -   ALL P.
   2.819 -      (ALL x y. R x y --> P x y) & (ALL x y z. P x y & P y z --> P x z) -->
   2.820 +%(R::'a::type => 'a::type => bool) (a::'a::type) b::'a::type.
   2.821 +   ALL P::'a::type => 'a::type => bool.
   2.822 +      (ALL (x::'a::type) y::'a::type. R x y --> P x y) &
   2.823 +      (ALL (x::'a::type) (y::'a::type) z::'a::type.
   2.824 +          P x y & P y z --> P x z) -->
   2.825        P a b"
   2.826  
   2.827 -lemma TC_DEF: "ALL R a b.
   2.828 +lemma TC_DEF: "ALL (R::'a::type => 'a::type => bool) (a::'a::type) b::'a::type.
   2.829     TC R a b =
   2.830 -   (ALL P.
   2.831 -       (ALL x y. R x y --> P x y) & (ALL x y z. P x y & P y z --> P x z) -->
   2.832 +   (ALL P::'a::type => 'a::type => bool.
   2.833 +       (ALL (x::'a::type) y::'a::type. R x y --> P x y) &
   2.834 +       (ALL (x::'a::type) (y::'a::type) z::'a::type.
   2.835 +           P x y & P y z --> P x z) -->
   2.836         P a b)"
   2.837    by (import relation TC_DEF)
   2.838  
   2.839  constdefs
   2.840 -  RTC :: "('a => 'a => bool) => 'a => 'a => bool" 
   2.841 +  RTC :: "('a::type => 'a::type => bool) => 'a::type => 'a::type => bool" 
   2.842    "RTC ==
   2.843 -%R a b.
   2.844 -   ALL P. (ALL x. P x x) & (ALL x y z. R x y & P y z --> P x z) --> P a b"
   2.845 -
   2.846 -lemma RTC_DEF: "ALL R a b.
   2.847 +%(R::'a::type => 'a::type => bool) (a::'a::type) b::'a::type.
   2.848 +   ALL P::'a::type => 'a::type => bool.
   2.849 +      (ALL x::'a::type. P x x) &
   2.850 +      (ALL (x::'a::type) (y::'a::type) z::'a::type.
   2.851 +          R x y & P y z --> P x z) -->
   2.852 +      P a b"
   2.853 +
   2.854 +lemma RTC_DEF: "ALL (R::'a::type => 'a::type => bool) (a::'a::type) b::'a::type.
   2.855     RTC R a b =
   2.856 -   (ALL P. (ALL x. P x x) & (ALL x y z. R x y & P y z --> P x z) --> P a b)"
   2.857 +   (ALL P::'a::type => 'a::type => bool.
   2.858 +       (ALL x::'a::type. P x x) &
   2.859 +       (ALL (x::'a::type) (y::'a::type) z::'a::type.
   2.860 +           R x y & P y z --> P x z) -->
   2.861 +       P a b)"
   2.862    by (import relation RTC_DEF)
   2.863  
   2.864  consts
   2.865 -  RC :: "('a => 'a => bool) => 'a => 'a => bool" 
   2.866 +  RC :: "('a::type => 'a::type => bool) => 'a::type => 'a::type => bool" 
   2.867  
   2.868  defs
   2.869 -  RC_primdef: "RC == %R x y. x = y | R x y"
   2.870 -
   2.871 -lemma RC_def: "ALL R x y. RC R x y = (x = y | R x y)"
   2.872 +  RC_primdef: "RC ==
   2.873 +%(R::'a::type => 'a::type => bool) (x::'a::type) y::'a::type. x = y | R x y"
   2.874 +
   2.875 +lemma RC_def: "ALL (R::'a::type => 'a::type => bool) (x::'a::type) y::'a::type.
   2.876 +   RC R x y = (x = y | R x y)"
   2.877    by (import relation RC_def)
   2.878  
   2.879  consts
   2.880 -  transitive :: "('a => 'a => bool) => bool" 
   2.881 +  transitive :: "('a::type => 'a::type => bool) => bool" 
   2.882  
   2.883  defs
   2.884 -  transitive_primdef: "transitive == %R. ALL x y z. R x y & R y z --> R x z"
   2.885 -
   2.886 -lemma transitive_def: "ALL R. transitive R = (ALL x y z. R x y & R y z --> R x z)"
   2.887 +  transitive_primdef: "transitive ==
   2.888 +%R::'a::type => 'a::type => bool.
   2.889 +   ALL (x::'a::type) (y::'a::type) z::'a::type. R x y & R y z --> R x z"
   2.890 +
   2.891 +lemma transitive_def: "ALL R::'a::type => 'a::type => bool.
   2.892 +   transitive R =
   2.893 +   (ALL (x::'a::type) (y::'a::type) z::'a::type. R x y & R y z --> R x z)"
   2.894    by (import relation transitive_def)
   2.895  
   2.896  constdefs
   2.897 -  pred_reflexive :: "('a => 'a => bool) => bool" 
   2.898 -  "pred_reflexive == %R. ALL x. R x x"
   2.899 -
   2.900 -lemma reflexive_def: "ALL R. pred_reflexive R = (ALL x. R x x)"
   2.901 +  pred_reflexive :: "('a::type => 'a::type => bool) => bool" 
   2.902 +  "pred_reflexive == %R::'a::type => 'a::type => bool. ALL x::'a::type. R x x"
   2.903 +
   2.904 +lemma reflexive_def: "ALL R::'a::type => 'a::type => bool.
   2.905 +   pred_reflexive R = (ALL x::'a::type. R x x)"
   2.906    by (import relation reflexive_def)
   2.907  
   2.908 -lemma TC_TRANSITIVE: "ALL x. transitive (TC x)"
   2.909 +lemma TC_TRANSITIVE: "ALL x::'a::type => 'a::type => bool. transitive (TC x)"
   2.910    by (import relation TC_TRANSITIVE)
   2.911  
   2.912 -lemma RTC_INDUCT: "ALL x xa.
   2.913 -   (ALL x. xa x x) & (ALL xb y z. x xb y & xa y z --> xa xb z) -->
   2.914 -   (ALL xb xc. RTC x xb xc --> xa xb xc)"
   2.915 +lemma RTC_INDUCT: "ALL (x::'a::type => 'a::type => bool) xa::'a::type => 'a::type => bool.
   2.916 +   (ALL x::'a::type. xa x x) &
   2.917 +   (ALL (xb::'a::type) (y::'a::type) z::'a::type.
   2.918 +       x xb y & xa y z --> xa xb z) -->
   2.919 +   (ALL (xb::'a::type) xc::'a::type. RTC x xb xc --> xa xb xc)"
   2.920    by (import relation RTC_INDUCT)
   2.921  
   2.922 -lemma TC_RULES: "ALL x.
   2.923 -   (ALL xa xb. x xa xb --> TC x xa xb) &
   2.924 -   (ALL xa xb xc. TC x xa xb & TC x xb xc --> TC x xa xc)"
   2.925 +lemma TC_RULES: "ALL x::'a::type => 'a::type => bool.
   2.926 +   (ALL (xa::'a::type) xb::'a::type. x xa xb --> TC x xa xb) &
   2.927 +   (ALL (xa::'a::type) (xb::'a::type) xc::'a::type.
   2.928 +       TC x xa xb & TC x xb xc --> TC x xa xc)"
   2.929    by (import relation TC_RULES)
   2.930  
   2.931 -lemma RTC_RULES: "ALL x.
   2.932 -   (ALL xa. RTC x xa xa) &
   2.933 -   (ALL xa xb xc. x xa xb & RTC x xb xc --> RTC x xa xc)"
   2.934 +lemma RTC_RULES: "ALL x::'a::type => 'a::type => bool.
   2.935 +   (ALL xa::'a::type. RTC x xa xa) &
   2.936 +   (ALL (xa::'a::type) (xb::'a::type) xc::'a::type.
   2.937 +       x xa xb & RTC x xb xc --> RTC x xa xc)"
   2.938    by (import relation RTC_RULES)
   2.939  
   2.940 -lemma RTC_STRONG_INDUCT: "ALL R P.
   2.941 -   (ALL x. P x x) & (ALL x y z. R x y & RTC R y z & P y z --> P x z) -->
   2.942 -   (ALL x y. RTC R x y --> P x y)"
   2.943 +lemma RTC_STRONG_INDUCT: "ALL (R::'a::type => 'a::type => bool) P::'a::type => 'a::type => bool.
   2.944 +   (ALL x::'a::type. P x x) &
   2.945 +   (ALL (x::'a::type) (y::'a::type) z::'a::type.
   2.946 +       R x y & RTC R y z & P y z --> P x z) -->
   2.947 +   (ALL (x::'a::type) y::'a::type. RTC R x y --> P x y)"
   2.948    by (import relation RTC_STRONG_INDUCT)
   2.949  
   2.950 -lemma RTC_RTC: "ALL R x y. RTC R x y --> (ALL z. RTC R y z --> RTC R x z)"
   2.951 +lemma RTC_RTC: "ALL (R::'a::type => 'a::type => bool) (x::'a::type) y::'a::type.
   2.952 +   RTC R x y --> (ALL z::'a::type. RTC R y z --> RTC R x z)"
   2.953    by (import relation RTC_RTC)
   2.954  
   2.955 -lemma RTC_TRANSITIVE: "ALL x. transitive (RTC x)"
   2.956 +lemma RTC_TRANSITIVE: "ALL x::'a::type => 'a::type => bool. transitive (RTC x)"
   2.957    by (import relation RTC_TRANSITIVE)
   2.958  
   2.959 -lemma RTC_REFLEXIVE: "ALL R. pred_reflexive (RTC R)"
   2.960 +lemma RTC_REFLEXIVE: "ALL R::'a::type => 'a::type => bool. pred_reflexive (RTC R)"
   2.961    by (import relation RTC_REFLEXIVE)
   2.962  
   2.963 -lemma RC_REFLEXIVE: "ALL R. pred_reflexive (RC R)"
   2.964 +lemma RC_REFLEXIVE: "ALL R::'a::type => 'a::type => bool. pred_reflexive (RC R)"
   2.965    by (import relation RC_REFLEXIVE)
   2.966  
   2.967 -lemma TC_SUBSET: "ALL x xa xb. x xa xb --> TC x xa xb"
   2.968 +lemma TC_SUBSET: "ALL (x::'a::type => 'a::type => bool) (xa::'a::type) xb::'a::type.
   2.969 +   x xa xb --> TC x xa xb"
   2.970    by (import relation TC_SUBSET)
   2.971  
   2.972 -lemma RTC_SUBSET: "ALL R x y. R x y --> RTC R x y"
   2.973 +lemma RTC_SUBSET: "ALL (R::'a::type => 'a::type => bool) (x::'a::type) y::'a::type.
   2.974 +   R x y --> RTC R x y"
   2.975    by (import relation RTC_SUBSET)
   2.976  
   2.977 -lemma RC_SUBSET: "ALL R x y. R x y --> RC R x y"
   2.978 +lemma RC_SUBSET: "ALL (R::'a::type => 'a::type => bool) (x::'a::type) y::'a::type.
   2.979 +   R x y --> RC R x y"
   2.980    by (import relation RC_SUBSET)
   2.981  
   2.982 -lemma RC_RTC: "ALL R x y. RC R x y --> RTC R x y"
   2.983 +lemma RC_RTC: "ALL (R::'a::type => 'a::type => bool) (x::'a::type) y::'a::type.
   2.984 +   RC R x y --> RTC R x y"
   2.985    by (import relation RC_RTC)
   2.986  
   2.987 -lemma TC_INDUCT: "ALL x xa.
   2.988 -   (ALL xb y. x xb y --> xa xb y) &
   2.989 -   (ALL x y z. xa x y & xa y z --> xa x z) -->
   2.990 -   (ALL xb xc. TC x xb xc --> xa xb xc)"
   2.991 +lemma TC_INDUCT: "ALL (x::'a::type => 'a::type => bool) xa::'a::type => 'a::type => bool.
   2.992 +   (ALL (xb::'a::type) y::'a::type. x xb y --> xa xb y) &
   2.993 +   (ALL (x::'a::type) (y::'a::type) z::'a::type.
   2.994 +       xa x y & xa y z --> xa x z) -->
   2.995 +   (ALL (xb::'a::type) xc::'a::type. TC x xb xc --> xa xb xc)"
   2.996    by (import relation TC_INDUCT)
   2.997  
   2.998 -lemma TC_INDUCT_LEFT1: "ALL x xa.
   2.999 -   (ALL xb y. x xb y --> xa xb y) &
  2.1000 -   (ALL xb y z. x xb y & xa y z --> xa xb z) -->
  2.1001 -   (ALL xb xc. TC x xb xc --> xa xb xc)"
  2.1002 +lemma TC_INDUCT_LEFT1: "ALL (x::'a::type => 'a::type => bool) xa::'a::type => 'a::type => bool.
  2.1003 +   (ALL (xb::'a::type) y::'a::type. x xb y --> xa xb y) &
  2.1004 +   (ALL (xb::'a::type) (y::'a::type) z::'a::type.
  2.1005 +       x xb y & xa y z --> xa xb z) -->
  2.1006 +   (ALL (xb::'a::type) xc::'a::type. TC x xb xc --> xa xb xc)"
  2.1007    by (import relation TC_INDUCT_LEFT1)
  2.1008  
  2.1009 -lemma TC_STRONG_INDUCT: "ALL R P.
  2.1010 -   (ALL x y. R x y --> P x y) &
  2.1011 -   (ALL x y z. P x y & P y z & TC R x y & TC R y z --> P x z) -->
  2.1012 -   (ALL u v. TC R u v --> P u v)"
  2.1013 +lemma TC_STRONG_INDUCT: "ALL (R::'a::type => 'a::type => bool) P::'a::type => 'a::type => bool.
  2.1014 +   (ALL (x::'a::type) y::'a::type. R x y --> P x y) &
  2.1015 +   (ALL (x::'a::type) (y::'a::type) z::'a::type.
  2.1016 +       P x y & P y z & TC R x y & TC R y z --> P x z) -->
  2.1017 +   (ALL (u::'a::type) v::'a::type. TC R u v --> P u v)"
  2.1018    by (import relation TC_STRONG_INDUCT)
  2.1019  
  2.1020 -lemma TC_STRONG_INDUCT_LEFT1: "ALL R P.
  2.1021 -   (ALL x y. R x y --> P x y) &
  2.1022 -   (ALL x y z. R x y & P y z & TC R y z --> P x z) -->
  2.1023 -   (ALL u v. TC R u v --> P u v)"
  2.1024 +lemma TC_STRONG_INDUCT_LEFT1: "ALL (R::'a::type => 'a::type => bool) P::'a::type => 'a::type => bool.
  2.1025 +   (ALL (x::'a::type) y::'a::type. R x y --> P x y) &
  2.1026 +   (ALL (x::'a::type) (y::'a::type) z::'a::type.
  2.1027 +       R x y & P y z & TC R y z --> P x z) -->
  2.1028 +   (ALL (u::'a::type) v::'a::type. TC R u v --> P u v)"
  2.1029    by (import relation TC_STRONG_INDUCT_LEFT1)
  2.1030  
  2.1031 -lemma TC_RTC: "ALL R x y. TC R x y --> RTC R x y"
  2.1032 +lemma TC_RTC: "ALL (R::'a::type => 'a::type => bool) (x::'a::type) y::'a::type.
  2.1033 +   TC R x y --> RTC R x y"
  2.1034    by (import relation TC_RTC)
  2.1035  
  2.1036 -lemma RTC_TC_RC: "ALL R x y. RTC R x y --> RC R x y | TC R x y"
  2.1037 +lemma RTC_TC_RC: "ALL (R::'a::type => 'a::type => bool) (x::'a::type) y::'a::type.
  2.1038 +   RTC R x y --> RC R x y | TC R x y"
  2.1039    by (import relation RTC_TC_RC)
  2.1040  
  2.1041 -lemma TC_RC_EQNS: "ALL R. RC (TC R) = RTC R & TC (RC R) = RTC R"
  2.1042 +lemma TC_RC_EQNS: "ALL R::'a::type => 'a::type => bool. RC (TC R) = RTC R & TC (RC R) = RTC R"
  2.1043    by (import relation TC_RC_EQNS)
  2.1044  
  2.1045 -lemma RC_IDEM: "ALL R. RC (RC R) = RC R"
  2.1046 +lemma RC_IDEM: "ALL R::'a::type => 'a::type => bool. RC (RC R) = RC R"
  2.1047    by (import relation RC_IDEM)
  2.1048  
  2.1049 -lemma TC_IDEM: "ALL R. TC (TC R) = TC R"
  2.1050 +lemma TC_IDEM: "ALL R::'a::type => 'a::type => bool. TC (TC R) = TC R"
  2.1051    by (import relation TC_IDEM)
  2.1052  
  2.1053 -lemma RTC_IDEM: "ALL R. RTC (RTC R) = RTC R"
  2.1054 +lemma RTC_IDEM: "ALL R::'a::type => 'a::type => bool. RTC (RTC R) = RTC R"
  2.1055    by (import relation RTC_IDEM)
  2.1056  
  2.1057 -lemma RTC_CASES1: "ALL x xa xb. RTC x xa xb = (xa = xb | (EX u. x xa u & RTC x u xb))"
  2.1058 +lemma RTC_CASES1: "ALL (x::'a::type => 'a::type => bool) (xa::'a::type) xb::'a::type.
  2.1059 +   RTC x xa xb = (xa = xb | (EX u::'a::type. x xa u & RTC x u xb))"
  2.1060    by (import relation RTC_CASES1)
  2.1061  
  2.1062 -lemma RTC_CASES2: "ALL x xa xb. RTC x xa xb = (xa = xb | (EX u. RTC x xa u & x u xb))"
  2.1063 +lemma RTC_CASES2: "ALL (x::'a::type => 'a::type => bool) (xa::'a::type) xb::'a::type.
  2.1064 +   RTC x xa xb = (xa = xb | (EX u::'a::type. RTC x xa u & x u xb))"
  2.1065    by (import relation RTC_CASES2)
  2.1066  
  2.1067 -lemma RTC_CASES_RTC_TWICE: "ALL x xa xb. RTC x xa xb = (EX u. RTC x xa u & RTC x u xb)"
  2.1068 +lemma RTC_CASES_RTC_TWICE: "ALL (x::'a::type => 'a::type => bool) (xa::'a::type) xb::'a::type.
  2.1069 +   RTC x xa xb = (EX u::'a::type. RTC x xa u & RTC x u xb)"
  2.1070    by (import relation RTC_CASES_RTC_TWICE)
  2.1071  
  2.1072 -lemma TC_CASES1: "ALL R x z. TC R x z --> R x z | (EX y. R x y & TC R y z)"
  2.1073 +lemma TC_CASES1: "ALL (R::'a::type => 'a::type => bool) (x::'a::type) z::'a::type.
  2.1074 +   TC R x z --> R x z | (EX y::'a::type. R x y & TC R y z)"
  2.1075    by (import relation TC_CASES1)
  2.1076  
  2.1077 -lemma TC_CASES2: "ALL R x z. TC R x z --> R x z | (EX y. TC R x y & R y z)"
  2.1078 +lemma TC_CASES2: "ALL (R::'a::type => 'a::type => bool) (x::'a::type) z::'a::type.
  2.1079 +   TC R x z --> R x z | (EX y::'a::type. TC R x y & R y z)"
  2.1080    by (import relation TC_CASES2)
  2.1081  
  2.1082 -lemma TC_MONOTONE: "ALL R Q. (ALL x y. R x y --> Q x y) --> (ALL x y. TC R x y --> TC Q x y)"
  2.1083 +lemma TC_MONOTONE: "ALL (R::'a::type => 'a::type => bool) Q::'a::type => 'a::type => bool.
  2.1084 +   (ALL (x::'a::type) y::'a::type. R x y --> Q x y) -->
  2.1085 +   (ALL (x::'a::type) y::'a::type. TC R x y --> TC Q x y)"
  2.1086    by (import relation TC_MONOTONE)
  2.1087  
  2.1088 -lemma RTC_MONOTONE: "ALL R Q. (ALL x y. R x y --> Q x y) --> (ALL x y. RTC R x y --> RTC Q x y)"
  2.1089 +lemma RTC_MONOTONE: "ALL (R::'a::type => 'a::type => bool) Q::'a::type => 'a::type => bool.
  2.1090 +   (ALL (x::'a::type) y::'a::type. R x y --> Q x y) -->
  2.1091 +   (ALL (x::'a::type) y::'a::type. RTC R x y --> RTC Q x y)"
  2.1092    by (import relation RTC_MONOTONE)
  2.1093  
  2.1094  constdefs
  2.1095 -  WF :: "('a => 'a => bool) => bool" 
  2.1096 -  "WF == %R. ALL B. Ex B --> (EX min. B min & (ALL b. R b min --> ~ B b))"
  2.1097 -
  2.1098 -lemma WF_DEF: "ALL R. WF R = (ALL B. Ex B --> (EX min. B min & (ALL b. R b min --> ~ B b)))"
  2.1099 +  WF :: "('a::type => 'a::type => bool) => bool" 
  2.1100 +  "WF ==
  2.1101 +%R::'a::type => 'a::type => bool.
  2.1102 +   ALL B::'a::type => bool.
  2.1103 +      Ex B -->
  2.1104 +      (EX min::'a::type. B min & (ALL b::'a::type. R b min --> ~ B b))"
  2.1105 +
  2.1106 +lemma WF_DEF: "ALL R::'a::type => 'a::type => bool.
  2.1107 +   WF R =
  2.1108 +   (ALL B::'a::type => bool.
  2.1109 +       Ex B -->
  2.1110 +       (EX min::'a::type. B min & (ALL b::'a::type. R b min --> ~ B b)))"
  2.1111    by (import relation WF_DEF)
  2.1112  
  2.1113 -lemma WF_INDUCTION_THM: "ALL R. WF R --> (ALL P. (ALL x. (ALL y. R y x --> P y) --> P x) --> All P)"
  2.1114 +lemma WF_INDUCTION_THM: "ALL R::'a::type => 'a::type => bool.
  2.1115 +   WF R -->
  2.1116 +   (ALL P::'a::type => bool.
  2.1117 +       (ALL x::'a::type. (ALL y::'a::type. R y x --> P y) --> P x) -->
  2.1118 +       All P)"
  2.1119    by (import relation WF_INDUCTION_THM)
  2.1120  
  2.1121 -lemma WF_NOT_REFL: "ALL x xa xb. WF x --> x xa xb --> xa ~= xb"
  2.1122 +lemma WF_NOT_REFL: "ALL (x::'a::type => 'a::type => bool) (xa::'a::type) xb::'a::type.
  2.1123 +   WF x --> x xa xb --> xa ~= xb"
  2.1124    by (import relation WF_NOT_REFL)
  2.1125  
  2.1126  constdefs
  2.1127 -  EMPTY_REL :: "'a => 'a => bool" 
  2.1128 -  "EMPTY_REL == %x y. False"
  2.1129 -
  2.1130 -lemma EMPTY_REL_DEF: "ALL x y. EMPTY_REL x y = False"
  2.1131 +  EMPTY_REL :: "'a::type => 'a::type => bool" 
  2.1132 +  "EMPTY_REL == %(x::'a::type) y::'a::type. False"
  2.1133 +
  2.1134 +lemma EMPTY_REL_DEF: "ALL (x::'a::type) y::'a::type. EMPTY_REL x y = False"
  2.1135    by (import relation EMPTY_REL_DEF)
  2.1136  
  2.1137  lemma WF_EMPTY_REL: "WF EMPTY_REL"
  2.1138    by (import relation WF_EMPTY_REL)
  2.1139  
  2.1140 -lemma WF_SUBSET: "ALL x xa. WF x & (ALL xb y. xa xb y --> x xb y) --> WF xa"
  2.1141 +lemma WF_SUBSET: "ALL (x::'a::type => 'a::type => bool) xa::'a::type => 'a::type => bool.
  2.1142 +   WF x & (ALL (xb::'a::type) y::'a::type. xa xb y --> x xb y) --> WF xa"
  2.1143    by (import relation WF_SUBSET)
  2.1144  
  2.1145 -lemma WF_TC: "ALL R. WF R --> WF (TC R)"
  2.1146 +lemma WF_TC: "ALL R::'a::type => 'a::type => bool. WF R --> WF (TC R)"
  2.1147    by (import relation WF_TC)
  2.1148  
  2.1149  consts
  2.1150 -  inv_image :: "('b => 'b => bool) => ('a => 'b) => 'a => 'a => bool" 
  2.1151 +  inv_image :: "('b::type => 'b::type => bool)
  2.1152 +=> ('a::type => 'b::type) => 'a::type => 'a::type => bool" 
  2.1153  
  2.1154  defs
  2.1155    inv_image_primdef: "relation.inv_image ==
  2.1156 -%(R::'b => 'b => bool) (f::'a => 'b) (x::'a) y::'a. R (f x) (f y)"
  2.1157 -
  2.1158 -lemma inv_image_def: "ALL (R::'b => 'b => bool) f::'a => 'b.
  2.1159 -   relation.inv_image R f = (%(x::'a) y::'a. R (f x) (f y))"
  2.1160 +%(R::'b::type => 'b::type => bool) (f::'a::type => 'b::type) (x::'a::type)
  2.1161 +   y::'a::type. R (f x) (f y)"
  2.1162 +
  2.1163 +lemma inv_image_def: "ALL (R::'b::type => 'b::type => bool) f::'a::type => 'b::type.
  2.1164 +   relation.inv_image R f = (%(x::'a::type) y::'a::type. R (f x) (f y))"
  2.1165    by (import relation inv_image_def)
  2.1166  
  2.1167 -lemma WF_inv_image: "ALL (R::'b => 'b => bool) f::'a => 'b. WF R --> WF (relation.inv_image R f)"
  2.1168 +lemma WF_inv_image: "ALL (R::'b::type => 'b::type => bool) f::'a::type => 'b::type.
  2.1169 +   WF R --> WF (relation.inv_image R f)"
  2.1170    by (import relation WF_inv_image)
  2.1171  
  2.1172  constdefs
  2.1173 -  RESTRICT :: "('a => 'b) => ('a => 'a => bool) => 'a => 'a => 'b" 
  2.1174 -  "RESTRICT == %f R x y. if R y x then f y else ARB"
  2.1175 -
  2.1176 -lemma RESTRICT_DEF: "ALL f R x. RESTRICT f R x = (%y. if R y x then f y else ARB)"
  2.1177 +  RESTRICT :: "('a::type => 'b::type)
  2.1178 +=> ('a::type => 'a::type => bool) => 'a::type => 'a::type => 'b::type" 
  2.1179 +  "RESTRICT ==
  2.1180 +%(f::'a::type => 'b::type) (R::'a::type => 'a::type => bool) (x::'a::type)
  2.1181 +   y::'a::type. if R y x then f y else ARB"
  2.1182 +
  2.1183 +lemma RESTRICT_DEF: "ALL (f::'a::type => 'b::type) (R::'a::type => 'a::type => bool) x::'a::type.
  2.1184 +   RESTRICT f R x = (%y::'a::type. if R y x then f y else ARB)"
  2.1185    by (import relation RESTRICT_DEF)
  2.1186  
  2.1187 -lemma RESTRICT_LEMMA: "ALL x xa xb xc. xa xb xc --> RESTRICT x xa xc xb = x xb"
  2.1188 +lemma RESTRICT_LEMMA: "ALL (x::'a::type => 'b::type) (xa::'a::type => 'a::type => bool)
  2.1189 +   (xb::'a::type) xc::'a::type. xa xb xc --> RESTRICT x xa xc xb = x xb"
  2.1190    by (import relation RESTRICT_LEMMA)
  2.1191  
  2.1192  consts
  2.1193 -  approx :: "('a => 'a => bool) => (('a => 'b) => 'a => 'b) => 'a => ('a => 'b) => bool" 
  2.1194 +  approx :: "('a::type => 'a::type => bool)
  2.1195 +=> (('a::type => 'b::type) => 'a::type => 'b::type)
  2.1196 +   => 'a::type => ('a::type => 'b::type) => bool" 
  2.1197  
  2.1198  defs
  2.1199 -  approx_primdef: "approx == %R M x f. f = RESTRICT (%y. M (RESTRICT f R y) y) R x"
  2.1200 -
  2.1201 -lemma approx_def: "ALL R M x f. approx R M x f = (f = RESTRICT (%y. M (RESTRICT f R y) y) R x)"
  2.1202 +  approx_primdef: "approx ==
  2.1203 +%(R::'a::type => 'a::type => bool)
  2.1204 +   (M::('a::type => 'b::type) => 'a::type => 'b::type) (x::'a::type)
  2.1205 +   f::'a::type => 'b::type.
  2.1206 +   f = RESTRICT (%y::'a::type. M (RESTRICT f R y) y) R x"
  2.1207 +
  2.1208 +lemma approx_def: "ALL (R::'a::type => 'a::type => bool)
  2.1209 +   (M::('a::type => 'b::type) => 'a::type => 'b::type) (x::'a::type)
  2.1210 +   f::'a::type => 'b::type.
  2.1211 +   approx R M x f = (f = RESTRICT (%y::'a::type. M (RESTRICT f R y) y) R x)"
  2.1212    by (import relation approx_def)
  2.1213  
  2.1214  consts
  2.1215 -  the_fun :: "('a => 'a => bool) => (('a => 'b) => 'a => 'b) => 'a => 'a => 'b" 
  2.1216 +  the_fun :: "('a::type => 'a::type => bool)
  2.1217 +=> (('a::type => 'b::type) => 'a::type => 'b::type)
  2.1218 +   => 'a::type => 'a::type => 'b::type" 
  2.1219  
  2.1220  defs
  2.1221 -  the_fun_primdef: "the_fun == %R M x. Eps (approx R M x)"
  2.1222 -
  2.1223 -lemma the_fun_def: "ALL R M x. the_fun R M x = Eps (approx R M x)"
  2.1224 +  the_fun_primdef: "the_fun ==
  2.1225 +%(R::'a::type => 'a::type => bool)
  2.1226 +   (M::('a::type => 'b::type) => 'a::type => 'b::type) x::'a::type.
  2.1227 +   Eps (approx R M x)"
  2.1228 +
  2.1229 +lemma the_fun_def: "ALL (R::'a::type => 'a::type => bool)
  2.1230 +   (M::('a::type => 'b::type) => 'a::type => 'b::type) x::'a::type.
  2.1231 +   the_fun R M x = Eps (approx R M x)"
  2.1232    by (import relation the_fun_def)
  2.1233  
  2.1234  constdefs
  2.1235 -  WFREC :: "('a => 'a => bool) => (('a => 'b) => 'a => 'b) => 'a => 'b" 
  2.1236 +  WFREC :: "('a::type => 'a::type => bool)
  2.1237 +=> (('a::type => 'b::type) => 'a::type => 'b::type) => 'a::type => 'b::type" 
  2.1238    "WFREC ==
  2.1239 -%R M x. M (RESTRICT (the_fun (TC R) (%f v. M (RESTRICT f R v) v) x) R x) x"
  2.1240 -
  2.1241 -lemma WFREC_DEF: "ALL R M.
  2.1242 +%(R::'a::type => 'a::type => bool)
  2.1243 +   (M::('a::type => 'b::type) => 'a::type => 'b::type) x::'a::type.
  2.1244 +   M (RESTRICT
  2.1245 +       (the_fun (TC R)
  2.1246 +         (%(f::'a::type => 'b::type) v::'a::type. M (RESTRICT f R v) v) x)
  2.1247 +       R x)
  2.1248 +    x"
  2.1249 +
  2.1250 +lemma WFREC_DEF: "ALL (R::'a::type => 'a::type => bool)
  2.1251 +   M::('a::type => 'b::type) => 'a::type => 'b::type.
  2.1252     WFREC R M =
  2.1253 -   (%x. M (RESTRICT (the_fun (TC R) (%f v. M (RESTRICT f R v) v) x) R x) x)"
  2.1254 +   (%x::'a::type.
  2.1255 +       M (RESTRICT
  2.1256 +           (the_fun (TC R)
  2.1257 +             (%(f::'a::type => 'b::type) v::'a::type. M (RESTRICT f R v) v)
  2.1258 +             x)
  2.1259 +           R x)
  2.1260 +        x)"
  2.1261    by (import relation WFREC_DEF)
  2.1262  
  2.1263 -lemma WFREC_THM: "ALL R M. WF R --> (ALL x. WFREC R M x = M (RESTRICT (WFREC R M) R x) x)"
  2.1264 +lemma WFREC_THM: "ALL (R::'a::type => 'a::type => bool)
  2.1265 +   M::('a::type => 'b::type) => 'a::type => 'b::type.
  2.1266 +   WF R --> (ALL x::'a::type. WFREC R M x = M (RESTRICT (WFREC R M) R x) x)"
  2.1267    by (import relation WFREC_THM)
  2.1268  
  2.1269 -lemma WFREC_COROLLARY: "ALL M R f. f = WFREC R M --> WF R --> (ALL x. f x = M (RESTRICT f R x) x)"
  2.1270 +lemma WFREC_COROLLARY: "ALL (M::('a::type => 'b::type) => 'a::type => 'b::type)
  2.1271 +   (R::'a::type => 'a::type => bool) f::'a::type => 'b::type.
  2.1272 +   f = WFREC R M --> WF R --> (ALL x::'a::type. f x = M (RESTRICT f R x) x)"
  2.1273    by (import relation WFREC_COROLLARY)
  2.1274  
  2.1275 -lemma WF_RECURSION_THM: "ALL R. WF R --> (ALL M. EX! f. ALL x. f x = M (RESTRICT f R x) x)"
  2.1276 +lemma WF_RECURSION_THM: "ALL R::'a::type => 'a::type => bool.
  2.1277 +   WF R -->
  2.1278 +   (ALL M::('a::type => 'b::type) => 'a::type => 'b::type.
  2.1279 +       EX! f::'a::type => 'b::type.
  2.1280 +          ALL x::'a::type. f x = M (RESTRICT f R x) x)"
  2.1281    by (import relation WF_RECURSION_THM)
  2.1282  
  2.1283  ;end_setup
  2.1284  
  2.1285  ;setup_theory pair
  2.1286  
  2.1287 -lemma CURRY_ONE_ONE_THM: "(curry f = curry g) = (f = g)"
  2.1288 +lemma CURRY_ONE_ONE_THM: "(curry (f::'a::type * 'b::type => 'c::type) =
  2.1289 + curry (g::'a::type * 'b::type => 'c::type)) =
  2.1290 +(f = g)"
  2.1291    by (import pair CURRY_ONE_ONE_THM)
  2.1292  
  2.1293  lemma UNCURRY_ONE_ONE_THM: "(op =::bool => bool => bool)
  2.1294 - ((op =::('a * 'b => 'c) => ('a * 'b => 'c) => bool)
  2.1295 -   ((split::('a => 'b => 'c) => 'a * 'b => 'c) (f::'a => 'b => 'c))
  2.1296 -   ((split::('a => 'b => 'c) => 'a * 'b => 'c) (g::'a => 'b => 'c)))
  2.1297 - ((op =::('a => 'b => 'c) => ('a => 'b => 'c) => bool) f g)"
  2.1298 + ((op =::('a::type * 'b::type => 'c::type)
  2.1299 +         => ('a::type * 'b::type => 'c::type) => bool)
  2.1300 +   ((split::('a::type => 'b::type => 'c::type)
  2.1301 +            => 'a::type * 'b::type => 'c::type)
  2.1302 +     (f::'a::type => 'b::type => 'c::type))
  2.1303 +   ((split::('a::type => 'b::type => 'c::type)
  2.1304 +            => 'a::type * 'b::type => 'c::type)
  2.1305 +     (g::'a::type => 'b::type => 'c::type)))
  2.1306 + ((op =::('a::type => 'b::type => 'c::type)
  2.1307 +         => ('a::type => 'b::type => 'c::type) => bool)
  2.1308 +   f g)"
  2.1309    by (import pair UNCURRY_ONE_ONE_THM)
  2.1310  
  2.1311 -lemma pair_Axiom: "ALL f. EX x. ALL xa y. x (xa, y) = f xa y"
  2.1312 +lemma pair_Axiom: "ALL f::'a::type => 'b::type => 'c::type.
  2.1313 +   EX x::'a::type * 'b::type => 'c::type.
  2.1314 +      ALL (xa::'a::type) y::'b::type. x (xa, y) = f xa y"
  2.1315    by (import pair pair_Axiom)
  2.1316  
  2.1317 -lemma UNCURRY_CONG: "ALL M M' f.
  2.1318 -   M = M' & (ALL x y. M' = (x, y) --> f x y = f' x y) -->
  2.1319 +lemma UNCURRY_CONG: "ALL (M::'a::type * 'b::type) (M'::'a::type * 'b::type)
  2.1320 +   f::'a::type => 'b::type => 'c::type.
  2.1321 +   M = M' &
  2.1322 +   (ALL (x::'a::type) y::'b::type.
  2.1323 +       M' = (x, y) -->
  2.1324 +       f x y = (f'::'a::type => 'b::type => 'c::type) x y) -->
  2.1325     split f M = split f' M'"
  2.1326    by (import pair UNCURRY_CONG)
  2.1327  
  2.1328 -lemma ELIM_PEXISTS: "(EX p. P (fst p) (snd p)) = (EX p1. Ex (P p1))"
  2.1329 +lemma ELIM_PEXISTS: "(EX p::'a::type * 'b::type.
  2.1330 +    (P::'a::type => 'b::type => bool) (fst p) (snd p)) =
  2.1331 +(EX p1::'a::type. Ex (P p1))"
  2.1332    by (import pair ELIM_PEXISTS)
  2.1333  
  2.1334 -lemma ELIM_PFORALL: "(ALL p. P (fst p) (snd p)) = (ALL p1. All (P p1))"
  2.1335 +lemma ELIM_PFORALL: "(ALL p::'a::type * 'b::type.
  2.1336 +    (P::'a::type => 'b::type => bool) (fst p) (snd p)) =
  2.1337 +(ALL p1::'a::type. All (P p1))"
  2.1338    by (import pair ELIM_PFORALL)
  2.1339  
  2.1340 -lemma PFORALL_THM: "(All::(('a => 'b => bool) => bool) => bool)
  2.1341 - (%x::'a => 'b => bool.
  2.1342 +lemma PFORALL_THM: "(All::(('a::type => 'b::type => bool) => bool) => bool)
  2.1343 + (%x::'a::type => 'b::type => bool.
  2.1344       (op =::bool => bool => bool)
  2.1345 -      ((All::('a => bool) => bool)
  2.1346 -        (%xa::'a. (All::('b => bool) => bool) (x xa)))
  2.1347 -      ((All::('a * 'b => bool) => bool)
  2.1348 -        ((split::('a => 'b => bool) => 'a * 'b => bool) x)))"
  2.1349 +      ((All::('a::type => bool) => bool)
  2.1350 +        (%xa::'a::type. (All::('b::type => bool) => bool) (x xa)))
  2.1351 +      ((All::('a::type * 'b::type => bool) => bool)
  2.1352 +        ((split::('a::type => 'b::type => bool)
  2.1353 +                 => 'a::type * 'b::type => bool)
  2.1354 +          x)))"
  2.1355    by (import pair PFORALL_THM)
  2.1356  
  2.1357 -lemma PEXISTS_THM: "(All::(('a => 'b => bool) => bool) => bool)
  2.1358 - (%x::'a => 'b => bool.
  2.1359 +lemma PEXISTS_THM: "(All::(('a::type => 'b::type => bool) => bool) => bool)
  2.1360 + (%x::'a::type => 'b::type => bool.
  2.1361       (op =::bool => bool => bool)
  2.1362 -      ((Ex::('a => bool) => bool)
  2.1363 -        (%xa::'a. (Ex::('b => bool) => bool) (x xa)))
  2.1364 -      ((Ex::('a * 'b => bool) => bool)
  2.1365 -        ((split::('a => 'b => bool) => 'a * 'b => bool) x)))"
  2.1366 +      ((Ex::('a::type => bool) => bool)
  2.1367 +        (%xa::'a::type. (Ex::('b::type => bool) => bool) (x xa)))
  2.1368 +      ((Ex::('a::type * 'b::type => bool) => bool)
  2.1369 +        ((split::('a::type => 'b::type => bool)
  2.1370 +                 => 'a::type * 'b::type => bool)
  2.1371 +          x)))"
  2.1372    by (import pair PEXISTS_THM)
  2.1373  
  2.1374 -lemma LET2_RAND: "(All::(('c => 'd) => bool) => bool)
  2.1375 - (%x::'c => 'd.
  2.1376 -     (All::('a * 'b => bool) => bool)
  2.1377 -      (%xa::'a * 'b.
  2.1378 -          (All::(('a => 'b => 'c) => bool) => bool)
  2.1379 -           (%xb::'a => 'b => 'c.
  2.1380 -               (op =::'d => 'd => bool)
  2.1381 -                (x ((Let::'a * 'b => ('a * 'b => 'c) => 'c) xa
  2.1382 -                     ((split::('a => 'b => 'c) => 'a * 'b => 'c) xb)))
  2.1383 -                ((Let::'a * 'b => ('a * 'b => 'd) => 'd) xa
  2.1384 -                  ((split::('a => 'b => 'd) => 'a * 'b => 'd)
  2.1385 -                    (%(xa::'a) y::'b. x (xb xa y)))))))"
  2.1386 +lemma LET2_RAND: "(All::(('c::type => 'd::type) => bool) => bool)
  2.1387 + (%x::'c::type => 'd::type.
  2.1388 +     (All::('a::type * 'b::type => bool) => bool)
  2.1389 +      (%xa::'a::type * 'b::type.
  2.1390 +          (All::(('a::type => 'b::type => 'c::type) => bool) => bool)
  2.1391 +           (%xb::'a::type => 'b::type => 'c::type.
  2.1392 +               (op =::'d::type => 'd::type => bool)
  2.1393 +                (x ((Let::'a::type * 'b::type
  2.1394 +                          => ('a::type * 'b::type => 'c::type) => 'c::type)
  2.1395 +                     xa ((split::('a::type => 'b::type => 'c::type)
  2.1396 +                                 => 'a::type * 'b::type => 'c::type)
  2.1397 +                          xb)))
  2.1398 +                ((Let::'a::type * 'b::type
  2.1399 +                       => ('a::type * 'b::type => 'd::type) => 'd::type)
  2.1400 +                  xa ((split::('a::type => 'b::type => 'd::type)
  2.1401 +                              => 'a::type * 'b::type => 'd::type)
  2.1402 +                       (%(xa::'a::type) y::'b::type. x (xb xa y)))))))"
  2.1403    by (import pair LET2_RAND)
  2.1404  
  2.1405 -lemma LET2_RATOR: "(All::('a1 * 'a2 => bool) => bool)
  2.1406 - (%x::'a1 * 'a2.
  2.1407 -     (All::(('a1 => 'a2 => 'b => 'c) => bool) => bool)
  2.1408 -      (%xa::'a1 => 'a2 => 'b => 'c.
  2.1409 -          (All::('b => bool) => bool)
  2.1410 -           (%xb::'b.
  2.1411 -               (op =::'c => 'c => bool)
  2.1412 -                ((Let::'a1 * 'a2 => ('a1 * 'a2 => 'b => 'c) => 'b => 'c) x
  2.1413 -                  ((split::('a1 => 'a2 => 'b => 'c)
  2.1414 -                           => 'a1 * 'a2 => 'b => 'c)
  2.1415 -                    xa)
  2.1416 +lemma LET2_RATOR: "(All::('a1::type * 'a2::type => bool) => bool)
  2.1417 + (%x::'a1::type * 'a2::type.
  2.1418 +     (All::(('a1::type => 'a2::type => 'b::type => 'c::type) => bool)
  2.1419 +           => bool)
  2.1420 +      (%xa::'a1::type => 'a2::type => 'b::type => 'c::type.
  2.1421 +          (All::('b::type => bool) => bool)
  2.1422 +           (%xb::'b::type.
  2.1423 +               (op =::'c::type => 'c::type => bool)
  2.1424 +                ((Let::'a1::type * 'a2::type
  2.1425 +                       => ('a1::type * 'a2::type => 'b::type => 'c::type)
  2.1426 +                          => 'b::type => 'c::type)
  2.1427 +                  x ((split::('a1::type
  2.1428 +                              => 'a2::type => 'b::type => 'c::type)
  2.1429 +                             => 'a1::type * 'a2::type
  2.1430 +                                => 'b::type => 'c::type)
  2.1431 +                      xa)
  2.1432                    xb)
  2.1433 -                ((Let::'a1 * 'a2 => ('a1 * 'a2 => 'c) => 'c) x
  2.1434 -                  ((split::('a1 => 'a2 => 'c) => 'a1 * 'a2 => 'c)
  2.1435 -                    (%(x::'a1) y::'a2. xa x y xb))))))"
  2.1436 +                ((Let::'a1::type * 'a2::type
  2.1437 +                       => ('a1::type * 'a2::type => 'c::type) => 'c::type)
  2.1438 +                  x ((split::('a1::type => 'a2::type => 'c::type)
  2.1439 +                             => 'a1::type * 'a2::type => 'c::type)
  2.1440 +                      (%(x::'a1::type) y::'a2::type. xa x y xb))))))"
  2.1441    by (import pair LET2_RATOR)
  2.1442  
  2.1443 -lemma pair_case_cong: "ALL x xa xb.
  2.1444 -   x = xa & (ALL x y. xa = (x, y) --> xb x y = f' x y) -->
  2.1445 +lemma pair_case_cong: "ALL (x::'a::type * 'b::type) (xa::'a::type * 'b::type)
  2.1446 +   xb::'a::type => 'b::type => 'c::type.
  2.1447 +   x = xa &
  2.1448 +   (ALL (x::'a::type) y::'b::type.
  2.1449 +       xa = (x, y) -->
  2.1450 +       xb x y = (f'::'a::type => 'b::type => 'c::type) x y) -->
  2.1451     split xb x = split f' xa"
  2.1452    by (import pair pair_case_cong)
  2.1453  
  2.1454  constdefs
  2.1455 -  LEX :: "('a => 'a => bool) => ('b => 'b => bool) => 'a * 'b => 'a * 'b => bool" 
  2.1456 -  "LEX == %R1 R2 (s, t) (u, v). R1 s u | s = u & R2 t v"
  2.1457 -
  2.1458 -lemma LEX_DEF: "ALL R1 R2. LEX R1 R2 = (%(s, t) (u, v). R1 s u | s = u & R2 t v)"
  2.1459 +  LEX :: "('a::type => 'a::type => bool)
  2.1460 +=> ('b::type => 'b::type => bool)
  2.1461 +   => 'a::type * 'b::type => 'a::type * 'b::type => bool" 
  2.1462 +  "LEX ==
  2.1463 +%(R1::'a::type => 'a::type => bool) (R2::'b::type => 'b::type => bool)
  2.1464 +   (s::'a::type, t::'b::type) (u::'a::type, v::'b::type).
  2.1465 +   R1 s u | s = u & R2 t v"
  2.1466 +
  2.1467 +lemma LEX_DEF: "ALL (R1::'a::type => 'a::type => bool) R2::'b::type => 'b::type => bool.
  2.1468 +   LEX R1 R2 =
  2.1469 +   (%(s::'a::type, t::'b::type) (u::'a::type, v::'b::type).
  2.1470 +       R1 s u | s = u & R2 t v)"
  2.1471    by (import pair LEX_DEF)
  2.1472  
  2.1473 -lemma WF_LEX: "ALL x xa. WF x & WF xa --> WF (LEX x xa)"
  2.1474 +lemma WF_LEX: "ALL (x::'a::type => 'a::type => bool) xa::'b::type => 'b::type => bool.
  2.1475 +   WF x & WF xa --> WF (LEX x xa)"
  2.1476    by (import pair WF_LEX)
  2.1477  
  2.1478  constdefs
  2.1479 -  RPROD :: "('a => 'a => bool) => ('b => 'b => bool) => 'a * 'b => 'a * 'b => bool" 
  2.1480 -  "RPROD == %R1 R2 (s, t) (u, v). R1 s u & R2 t v"
  2.1481 -
  2.1482 -lemma RPROD_DEF: "ALL R1 R2. RPROD R1 R2 = (%(s, t) (u, v). R1 s u & R2 t v)"
  2.1483 +  RPROD :: "('a::type => 'a::type => bool)
  2.1484 +=> ('b::type => 'b::type => bool)
  2.1485 +   => 'a::type * 'b::type => 'a::type * 'b::type => bool" 
  2.1486 +  "RPROD ==
  2.1487 +%(R1::'a::type => 'a::type => bool) (R2::'b::type => 'b::type => bool)
  2.1488 +   (s::'a::type, t::'b::type) (u::'a::type, v::'b::type). R1 s u & R2 t v"
  2.1489 +
  2.1490 +lemma RPROD_DEF: "ALL (R1::'a::type => 'a::type => bool) R2::'b::type => 'b::type => bool.
  2.1491 +   RPROD R1 R2 =
  2.1492 +   (%(s::'a::type, t::'b::type) (u::'a::type, v::'b::type). R1 s u & R2 t v)"
  2.1493    by (import pair RPROD_DEF)
  2.1494  
  2.1495 -lemma WF_RPROD: "ALL R Q. WF R & WF Q --> WF (RPROD R Q)"
  2.1496 +lemma WF_RPROD: "ALL (R::'a::type => 'a::type => bool) Q::'b::type => 'b::type => bool.
  2.1497 +   WF R & WF Q --> WF (RPROD R Q)"
  2.1498    by (import pair WF_RPROD)
  2.1499  
  2.1500  ;end_setup
  2.1501 @@ -860,152 +1104,184 @@
  2.1502  
  2.1503  ;setup_theory prim_rec
  2.1504  
  2.1505 -lemma LESS_0_0: "0 < Suc 0"
  2.1506 +lemma LESS_0_0: "(0::nat) < Suc (0::nat)"
  2.1507    by (import prim_rec LESS_0_0)
  2.1508  
  2.1509 -lemma LESS_LEMMA1: "ALL x xa. x < Suc xa --> x = xa | x < xa"
  2.1510 +lemma LESS_LEMMA1: "ALL (x::nat) xa::nat. x < Suc xa --> x = xa | x < xa"
  2.1511    by (import prim_rec LESS_LEMMA1)
  2.1512  
  2.1513 -lemma LESS_LEMMA2: "ALL m n. m = n | m < n --> m < Suc n"
  2.1514 +lemma LESS_LEMMA2: "ALL (m::nat) n::nat. m = n | m < n --> m < Suc n"
  2.1515    by (import prim_rec LESS_LEMMA2)
  2.1516  
  2.1517 -lemma LESS_THM: "ALL m n. (m < Suc n) = (m = n | m < n)"
  2.1518 +lemma LESS_THM: "ALL (m::nat) n::nat. (m < Suc n) = (m = n | m < n)"
  2.1519    by (import prim_rec LESS_THM)
  2.1520  
  2.1521 -lemma LESS_SUC_IMP: "ALL x xa. x < Suc xa --> x ~= xa --> x < xa"
  2.1522 +lemma LESS_SUC_IMP: "ALL (x::nat) xa::nat. x < Suc xa --> x ~= xa --> x < xa"
  2.1523    by (import prim_rec LESS_SUC_IMP)
  2.1524  
  2.1525 -lemma EQ_LESS: "ALL n. Suc m = n --> m < n"
  2.1526 +lemma EQ_LESS: "ALL n::nat. Suc (m::nat) = n --> m < n"
  2.1527    by (import prim_rec EQ_LESS)
  2.1528  
  2.1529  lemma NOT_LESS_EQ: "ALL (m::nat) n::nat. m = n --> ~ m < n"
  2.1530    by (import prim_rec NOT_LESS_EQ)
  2.1531  
  2.1532  constdefs
  2.1533 -  SIMP_REC_REL :: "(nat => 'a) => 'a => ('a => 'a) => nat => bool" 
  2.1534 -  "(op ==::((nat => 'a) => 'a => ('a => 'a) => nat => bool)
  2.1535 -        => ((nat => 'a) => 'a => ('a => 'a) => nat => bool) => prop)
  2.1536 - (SIMP_REC_REL::(nat => 'a) => 'a => ('a => 'a) => nat => bool)
  2.1537 - (%(fun::nat => 'a) (x::'a) (f::'a => 'a) n::nat.
  2.1538 +  SIMP_REC_REL :: "(nat => 'a::type) => 'a::type => ('a::type => 'a::type) => nat => bool" 
  2.1539 +  "(op ==::((nat => 'a::type)
  2.1540 +         => 'a::type => ('a::type => 'a::type) => nat => bool)
  2.1541 +        => ((nat => 'a::type)
  2.1542 +            => 'a::type => ('a::type => 'a::type) => nat => bool)
  2.1543 +           => prop)
  2.1544 + (SIMP_REC_REL::(nat => 'a::type)
  2.1545 +                => 'a::type => ('a::type => 'a::type) => nat => bool)
  2.1546 + (%(fun::nat => 'a::type) (x::'a::type) (f::'a::type => 'a::type) n::nat.
  2.1547       (op &::bool => bool => bool)
  2.1548 -      ((op =::'a => 'a => bool) (fun (0::nat)) x)
  2.1549 +      ((op =::'a::type => 'a::type => bool) (fun (0::nat)) x)
  2.1550        ((All::(nat => bool) => bool)
  2.1551          (%m::nat.
  2.1552              (op -->::bool => bool => bool) ((op <::nat => nat => bool) m n)
  2.1553 -             ((op =::'a => 'a => bool) (fun ((Suc::nat => nat) m))
  2.1554 -               (f (fun m))))))"
  2.1555 -
  2.1556 -lemma SIMP_REC_REL: "(All::((nat => 'a) => bool) => bool)
  2.1557 - (%fun::nat => 'a.
  2.1558 -     (All::('a => bool) => bool)
  2.1559 -      (%x::'a.
  2.1560 -          (All::(('a => 'a) => bool) => bool)
  2.1561 -           (%f::'a => 'a.
  2.1562 +             ((op =::'a::type => 'a::type => bool)
  2.1563 +               (fun ((Suc::nat => nat) m)) (f (fun m))))))"
  2.1564 +
  2.1565 +lemma SIMP_REC_REL: "(All::((nat => 'a::type) => bool) => bool)
  2.1566 + (%fun::nat => 'a::type.
  2.1567 +     (All::('a::type => bool) => bool)
  2.1568 +      (%x::'a::type.
  2.1569 +          (All::(('a::type => 'a::type) => bool) => bool)
  2.1570 +           (%f::'a::type => 'a::type.
  2.1571                 (All::(nat => bool) => bool)
  2.1572                  (%n::nat.
  2.1573                      (op =::bool => bool => bool)
  2.1574 -                     ((SIMP_REC_REL::(nat => 'a)
  2.1575 -                                     => 'a => ('a => 'a) => nat => bool)
  2.1576 +                     ((SIMP_REC_REL::(nat => 'a::type)
  2.1577 +                                     => 'a::type
  2.1578 +  => ('a::type => 'a::type) => nat => bool)
  2.1579                         fun x f n)
  2.1580                       ((op &::bool => bool => bool)
  2.1581 -                       ((op =::'a => 'a => bool) (fun (0::nat)) x)
  2.1582 +                       ((op =::'a::type => 'a::type => bool) (fun (0::nat))
  2.1583 +                         x)
  2.1584                         ((All::(nat => bool) => bool)
  2.1585                           (%m::nat.
  2.1586                               (op -->::bool => bool => bool)
  2.1587                                ((op <::nat => nat => bool) m n)
  2.1588 -                              ((op =::'a => 'a => bool)
  2.1589 +                              ((op =::'a::type => 'a::type => bool)
  2.1590                                  (fun ((Suc::nat => nat) m))
  2.1591                                  (f (fun m))))))))))"
  2.1592    by (import prim_rec SIMP_REC_REL)
  2.1593  
  2.1594 -lemma SIMP_REC_EXISTS: "ALL x f n. EX fun. SIMP_REC_REL fun x f n"
  2.1595 +lemma SIMP_REC_EXISTS: "ALL (x::'a::type) (f::'a::type => 'a::type) n::nat.
  2.1596 +   EX fun::nat => 'a::type. SIMP_REC_REL fun x f n"
  2.1597    by (import prim_rec SIMP_REC_EXISTS)
  2.1598  
  2.1599 -lemma SIMP_REC_REL_UNIQUE: "ALL x xa xb xc xd xe.
  2.1600 +lemma SIMP_REC_REL_UNIQUE: "ALL (x::'a::type) (xa::'a::type => 'a::type) (xb::nat => 'a::type)
  2.1601 +   (xc::nat => 'a::type) (xd::nat) xe::nat.
  2.1602     SIMP_REC_REL xb x xa xd & SIMP_REC_REL xc x xa xe -->
  2.1603 -   (ALL n. n < xd & n < xe --> xb n = xc n)"
  2.1604 +   (ALL n::nat. n < xd & n < xe --> xb n = xc n)"
  2.1605    by (import prim_rec SIMP_REC_REL_UNIQUE)
  2.1606  
  2.1607 -lemma SIMP_REC_REL_UNIQUE_RESULT: "ALL x f n. EX! y. EX g. SIMP_REC_REL g x f (Suc n) & y = g n"
  2.1608 +lemma SIMP_REC_REL_UNIQUE_RESULT: "ALL (x::'a::type) (f::'a::type => 'a::type) n::nat.
  2.1609 +   EX! y::'a::type.
  2.1610 +      EX g::nat => 'a::type. SIMP_REC_REL g x f (Suc n) & y = g n"
  2.1611    by (import prim_rec SIMP_REC_REL_UNIQUE_RESULT)
  2.1612  
  2.1613  consts
  2.1614 -  SIMP_REC :: "'a => ('a => 'a) => nat => 'a" 
  2.1615 -
  2.1616 -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"
  2.1617 +  SIMP_REC :: "'a::type => ('a::type => 'a::type) => nat => 'a::type" 
  2.1618 +
  2.1619 +specification (SIMP_REC) SIMP_REC: "ALL (x::'a::type) (f'::'a::type => 'a::type) n::nat.
  2.1620 +   EX g::nat => 'a::type.
  2.1621 +      SIMP_REC_REL g x f' (Suc n) & SIMP_REC x f' n = g n"
  2.1622    by (import prim_rec SIMP_REC)
  2.1623  
  2.1624 -lemma LESS_SUC_SUC: "ALL m. m < Suc m & m < Suc (Suc m)"
  2.1625 +lemma LESS_SUC_SUC: "ALL m::nat. m < Suc m & m < Suc (Suc m)"
  2.1626    by (import prim_rec LESS_SUC_SUC)
  2.1627  
  2.1628 -lemma SIMP_REC_THM: "ALL x f.
  2.1629 -   SIMP_REC x f 0 = x & (ALL m. SIMP_REC x f (Suc m) = f (SIMP_REC x f m))"
  2.1630 +lemma SIMP_REC_THM: "ALL (x::'a::type) f::'a::type => 'a::type.
  2.1631 +   SIMP_REC x f (0::nat) = x &
  2.1632 +   (ALL m::nat. SIMP_REC x f (Suc m) = f (SIMP_REC x f m))"
  2.1633    by (import prim_rec SIMP_REC_THM)
  2.1634  
  2.1635  constdefs
  2.1636    PRE :: "nat => nat" 
  2.1637 -  "PRE == %m. if m = 0 then 0 else SOME n. m = Suc n"
  2.1638 -
  2.1639 -lemma PRE_DEF: "ALL m. PRE m = (if m = 0 then 0 else SOME n. m = Suc n)"
  2.1640 +  "PRE == %m::nat. if m = (0::nat) then 0::nat else SOME n::nat. m = Suc n"
  2.1641 +
  2.1642 +lemma PRE_DEF: "ALL m::nat.
  2.1643 +   PRE m = (if m = (0::nat) then 0::nat else SOME n::nat. m = Suc n)"
  2.1644    by (import prim_rec PRE_DEF)
  2.1645  
  2.1646 -lemma PRE: "PRE 0 = 0 & (ALL m. PRE (Suc m) = m)"
  2.1647 +lemma PRE: "PRE (0::nat) = (0::nat) & (ALL m::nat. PRE (Suc m) = m)"
  2.1648    by (import prim_rec PRE)
  2.1649  
  2.1650  constdefs
  2.1651 -  PRIM_REC_FUN :: "'a => ('a => nat => 'a) => nat => nat => 'a" 
  2.1652 -  "PRIM_REC_FUN == %x f. SIMP_REC (%n. x) (%fun n. f (fun (PRE n)) n)"
  2.1653 -
  2.1654 -lemma PRIM_REC_FUN: "ALL x f. PRIM_REC_FUN x f = SIMP_REC (%n. x) (%fun n. f (fun (PRE n)) n)"
  2.1655 +  PRIM_REC_FUN :: "'a::type => ('a::type => nat => 'a::type) => nat => nat => 'a::type" 
  2.1656 +  "PRIM_REC_FUN ==
  2.1657 +%(x::'a::type) f::'a::type => nat => 'a::type.
  2.1658 +   SIMP_REC (%n::nat. x) (%(fun::nat => 'a::type) n::nat. f (fun (PRE n)) n)"
  2.1659 +
  2.1660 +lemma PRIM_REC_FUN: "ALL (x::'a::type) f::'a::type => nat => 'a::type.
  2.1661 +   PRIM_REC_FUN x f =
  2.1662 +   SIMP_REC (%n::nat. x) (%(fun::nat => 'a::type) n::nat. f (fun (PRE n)) n)"
  2.1663    by (import prim_rec PRIM_REC_FUN)
  2.1664  
  2.1665 -lemma PRIM_REC_EQN: "ALL x f.
  2.1666 -   (ALL n. PRIM_REC_FUN x f 0 n = x) &
  2.1667 -   (ALL m n. PRIM_REC_FUN x f (Suc m) n = f (PRIM_REC_FUN x f m (PRE n)) n)"
  2.1668 +lemma PRIM_REC_EQN: "ALL (x::'a::type) f::'a::type => nat => 'a::type.
  2.1669 +   (ALL n::nat. PRIM_REC_FUN x f (0::nat) n = x) &
  2.1670 +   (ALL (m::nat) n::nat.
  2.1671 +       PRIM_REC_FUN x f (Suc m) n = f (PRIM_REC_FUN x f m (PRE n)) n)"
  2.1672    by (import prim_rec PRIM_REC_EQN)
  2.1673  
  2.1674  constdefs
  2.1675 -  PRIM_REC :: "'a => ('a => nat => 'a) => nat => 'a" 
  2.1676 -  "PRIM_REC == %x f m. PRIM_REC_FUN x f m (PRE m)"
  2.1677 -
  2.1678 -lemma PRIM_REC: "ALL x f m. PRIM_REC x f m = PRIM_REC_FUN x f m (PRE m)"
  2.1679 +  PRIM_REC :: "'a::type => ('a::type => nat => 'a::type) => nat => 'a::type" 
  2.1680 +  "PRIM_REC ==
  2.1681 +%(x::'a::type) (f::'a::type => nat => 'a::type) m::nat.
  2.1682 +   PRIM_REC_FUN x f m (PRE m)"
  2.1683 +
  2.1684 +lemma PRIM_REC: "ALL (x::'a::type) (f::'a::type => nat => 'a::type) m::nat.
  2.1685 +   PRIM_REC x f m = PRIM_REC_FUN x f m (PRE m)"
  2.1686    by (import prim_rec PRIM_REC)
  2.1687  
  2.1688 -lemma PRIM_REC_THM: "ALL x f.
  2.1689 -   PRIM_REC x f 0 = x & (ALL m. PRIM_REC x f (Suc m) = f (PRIM_REC x f m) m)"
  2.1690 +lemma PRIM_REC_THM: "ALL (x::'a::type) f::'a::type => nat => 'a::type.
  2.1691 +   PRIM_REC x f (0::nat) = x &
  2.1692 +   (ALL m::nat. PRIM_REC x f (Suc m) = f (PRIM_REC x f m) m)"
  2.1693    by (import prim_rec PRIM_REC_THM)
  2.1694  
  2.1695 -lemma DC: "ALL P R a.
  2.1696 -   P a & (ALL x. P x --> (EX y. P y & R x y)) -->
  2.1697 -   (EX x. x 0 = a & (ALL n. P (x n) & R (x n) (x (Suc n))))"
  2.1698 +lemma DC: "ALL (P::'a::type => bool) (R::'a::type => 'a::type => bool) a::'a::type.
  2.1699 +   P a & (ALL x::'a::type. P x --> (EX y::'a::type. P y & R x y)) -->
  2.1700 +   (EX x::nat => 'a::type.
  2.1701 +       x (0::nat) = a & (ALL n::nat. P (x n) & R (x n) (x (Suc n))))"
  2.1702    by (import prim_rec DC)
  2.1703  
  2.1704 -lemma num_Axiom_old: "ALL e f. EX! fn1. fn1 0 = e & (ALL n. fn1 (Suc n) = f (fn1 n) n)"
  2.1705 +lemma num_Axiom_old: "ALL (e::'a::type) f::'a::type => nat => 'a::type.
  2.1706 +   EX! fn1::nat => 'a::type.
  2.1707 +      fn1 (0::nat) = e & (ALL n::nat. fn1 (Suc n) = f (fn1 n) n)"
  2.1708    by (import prim_rec num_Axiom_old)
  2.1709  
  2.1710 -lemma num_Axiom: "ALL e f. EX x. x 0 = e & (ALL n. x (Suc n) = f n (x n))"
  2.1711 +lemma num_Axiom: "ALL (e::'a::type) f::nat => 'a::type => 'a::type.
  2.1712 +   EX x::nat => 'a::type.
  2.1713 +      x (0::nat) = e & (ALL n::nat. x (Suc n) = f n (x n))"
  2.1714    by (import prim_rec num_Axiom)
  2.1715  
  2.1716  consts
  2.1717 -  wellfounded :: "('a => 'a => bool) => bool" 
  2.1718 +  wellfounded :: "('a::type => 'a::type => bool) => bool" 
  2.1719  
  2.1720  defs
  2.1721 -  wellfounded_primdef: "wellfounded == %R. ~ (EX f. ALL n. R (f (Suc n)) (f n))"
  2.1722 -
  2.1723 -lemma wellfounded_def: "ALL R. wellfounded R = (~ (EX f. ALL n. R (f (Suc n)) (f n)))"
  2.1724 +  wellfounded_primdef: "wellfounded ==
  2.1725 +%R::'a::type => 'a::type => bool.
  2.1726 +   ~ (EX f::nat => 'a::type. ALL n::nat. R (f (Suc n)) (f n))"
  2.1727 +
  2.1728 +lemma wellfounded_def: "ALL R::'a::type => 'a::type => bool.
  2.1729 +   wellfounded R =
  2.1730 +   (~ (EX f::nat => 'a::type. ALL n::nat. R (f (Suc n)) (f n)))"
  2.1731    by (import prim_rec wellfounded_def)
  2.1732  
  2.1733 -lemma WF_IFF_WELLFOUNDED: "ALL R. WF R = wellfounded R"
  2.1734 +lemma WF_IFF_WELLFOUNDED: "ALL R::'a::type => 'a::type => bool. WF R = wellfounded R"
  2.1735    by (import prim_rec WF_IFF_WELLFOUNDED)
  2.1736  
  2.1737 -lemma WF_PRED: "WF (%x y. y = Suc x)"
  2.1738 +lemma WF_PRED: "WF (%(x::nat) y::nat. y = Suc x)"
  2.1739    by (import prim_rec WF_PRED)
  2.1740  
  2.1741  lemma WF_LESS: "(WF::(nat => nat => bool) => bool) (op <::nat => nat => bool)"
  2.1742    by (import prim_rec WF_LESS)
  2.1743  
  2.1744  consts
  2.1745 -  measure :: "('a => nat) => 'a => 'a => bool" 
  2.1746 +  measure :: "('a::type => nat) => 'a::type => 'a::type => bool" 
  2.1747  
  2.1748  defs
  2.1749    measure_primdef: "prim_rec.measure == relation.inv_image op <"
  2.1750 @@ -1013,10 +1289,11 @@
  2.1751  lemma measure_def: "prim_rec.measure = relation.inv_image op <"
  2.1752    by (import prim_rec measure_def)
  2.1753  
  2.1754 -lemma WF_measure: "ALL x. WF (prim_rec.measure x)"
  2.1755 +lemma WF_measure: "ALL x::'a::type => nat. WF (prim_rec.measure x)"
  2.1756    by (import prim_rec WF_measure)
  2.1757  
  2.1758 -lemma measure_thm: "ALL x xa xb. prim_rec.measure x xa xb = (x xa < x xb)"
  2.1759 +lemma measure_thm: "ALL (x::'a::type => nat) (xa::'a::type) xb::'a::type.
  2.1760 +   prim_rec.measure x xa xb = (x xa < x xb)"
  2.1761    by (import prim_rec measure_thm)
  2.1762  
  2.1763  ;end_setup
  2.1764 @@ -1025,33 +1302,36 @@
  2.1765  
  2.1766  constdefs
  2.1767    nat_elim__magic :: "nat => nat" 
  2.1768 -  "nat_elim__magic == %n. n"
  2.1769 -
  2.1770 -lemma nat_elim__magic: "ALL n. nat_elim__magic n = n"
  2.1771 +  "nat_elim__magic == %n::nat. n"
  2.1772 +
  2.1773 +lemma nat_elim__magic: "ALL n::nat. nat_elim__magic n = n"
  2.1774    by (import arithmetic nat_elim__magic)
  2.1775  
  2.1776  consts
  2.1777    EVEN :: "nat => bool" 
  2.1778  
  2.1779 -specification (EVEN) EVEN: "EVEN 0 = True & (ALL n. EVEN (Suc n) = (~ EVEN n))"
  2.1780 +specification (EVEN) EVEN: "EVEN (0::nat) = True & (ALL n::nat. EVEN (Suc n) = (~ EVEN n))"
  2.1781    by (import arithmetic EVEN)
  2.1782  
  2.1783  consts
  2.1784    ODD :: "nat => bool" 
  2.1785  
  2.1786 -specification (ODD) ODD: "ODD 0 = False & (ALL n. ODD (Suc n) = (~ ODD n))"
  2.1787 +specification (ODD) ODD: "ODD (0::nat) = False & (ALL n::nat. ODD (Suc n) = (~ ODD n))"
  2.1788    by (import arithmetic ODD)
  2.1789  
  2.1790 -lemma TWO: "2 = Suc 1"
  2.1791 +lemma TWO: "(2::nat) = Suc (1::nat)"
  2.1792    by (import arithmetic TWO)
  2.1793  
  2.1794  lemma NORM_0: "(0::nat) = (0::nat)"
  2.1795    by (import arithmetic NORM_0)
  2.1796  
  2.1797 -lemma num_case_compute: "ALL n. nat_case f g n = (if n = 0 then f else g (PRE n))"
  2.1798 +lemma num_case_compute: "ALL n::nat.
  2.1799 +   nat_case (f::'a::type) (g::nat => 'a::type) n =
  2.1800 +   (if n = (0::nat) then f else g (PRE n))"
  2.1801    by (import arithmetic num_case_compute)
  2.1802  
  2.1803 -lemma ADD_CLAUSES: "0 + m = m & m + 0 = m & Suc m + n = Suc (m + n) & m + Suc n = Suc (m + n)"
  2.1804 +lemma ADD_CLAUSES: "(0::nat) + (m::nat) = m &
  2.1805 +m + (0::nat) = m & Suc m + (n::nat) = Suc (m + n) & m + Suc n = Suc (m + n)"
  2.1806    by (import arithmetic ADD_CLAUSES)
  2.1807  
  2.1808  lemma LESS_ADD: "ALL (m::nat) n::nat. n < m --> (EX p::nat. p + n = m)"
  2.1809 @@ -1060,13 +1340,14 @@
  2.1810  lemma LESS_ANTISYM: "ALL (m::nat) n::nat. ~ (m < n & n < m)"
  2.1811    by (import arithmetic LESS_ANTISYM)
  2.1812  
  2.1813 -lemma LESS_LESS_SUC: "ALL x xa. ~ (x < xa & xa < Suc x)"
  2.1814 +lemma LESS_LESS_SUC: "ALL (x::nat) xa::nat. ~ (x < xa & xa < Suc x)"
  2.1815    by (import arithmetic LESS_LESS_SUC)
  2.1816  
  2.1817 -lemma FUN_EQ_LEMMA: "ALL f x1 x2. f x1 & ~ f x2 --> x1 ~= x2"
  2.1818 +lemma FUN_EQ_LEMMA: "ALL (f::'a::type => bool) (x1::'a::type) x2::'a::type.
  2.1819 +   f x1 & ~ f x2 --> x1 ~= x2"
  2.1820    by (import arithmetic FUN_EQ_LEMMA)
  2.1821  
  2.1822 -lemma LESS_NOT_SUC: "ALL m n. m < n & n ~= Suc m --> Suc m < n"
  2.1823 +lemma LESS_NOT_SUC: "ALL (m::nat) n::nat. m < n & n ~= Suc m --> Suc m < n"
  2.1824    by (import arithmetic LESS_NOT_SUC)
  2.1825  
  2.1826  lemma LESS_0_CASES: "ALL m::nat. (0::nat) = m | (0::nat) < m"
  2.1827 @@ -1078,7 +1359,7 @@
  2.1828  lemma LESS_CASES: "ALL (m::nat) n::nat. m < n | n <= m"
  2.1829    by (import arithmetic LESS_CASES)
  2.1830  
  2.1831 -lemma LESS_EQ_SUC_REFL: "ALL m. m <= Suc m"
  2.1832 +lemma LESS_EQ_SUC_REFL: "ALL m::nat. m <= Suc m"
  2.1833    by (import arithmetic LESS_EQ_SUC_REFL)
  2.1834  
  2.1835  lemma LESS_ADD_NONZERO: "ALL (m::nat) n::nat. n ~= (0::nat) --> m < m + n"
  2.1836 @@ -1090,20 +1371,20 @@
  2.1837  lemma SUB_0: "ALL m::nat. (0::nat) - m = (0::nat) & m - (0::nat) = m"
  2.1838    by (import arithmetic SUB_0)
  2.1839  
  2.1840 -lemma SUC_SUB1: "ALL m. Suc m - 1 = m"
  2.1841 +lemma SUC_SUB1: "ALL m::nat. Suc m - (1::nat) = m"
  2.1842    by (import arithmetic SUC_SUB1)
  2.1843  
  2.1844 -lemma PRE_SUB1: "ALL m. PRE m = m - 1"
  2.1845 +lemma PRE_SUB1: "ALL m::nat. PRE m = m - (1::nat)"
  2.1846    by (import arithmetic PRE_SUB1)
  2.1847  
  2.1848 -lemma MULT_CLAUSES: "ALL x xa.
  2.1849 -   0 * x = 0 &
  2.1850 -   x * 0 = 0 &
  2.1851 -   1 * x = x &
  2.1852 -   x * 1 = x & Suc x * xa = x * xa + xa & x * Suc xa = x + x * xa"
  2.1853 +lemma MULT_CLAUSES: "ALL (x::nat) xa::nat.
  2.1854 +   (0::nat) * x = (0::nat) &
  2.1855 +   x * (0::nat) = (0::nat) &
  2.1856 +   (1::nat) * x = x &
  2.1857 +   x * (1::nat) = x & Suc x * xa = x * xa + xa & x * Suc xa = x + x * xa"
  2.1858    by (import arithmetic MULT_CLAUSES)
  2.1859  
  2.1860 -lemma PRE_SUB: "ALL m n. PRE (m - n) = PRE m - n"
  2.1861 +lemma PRE_SUB: "ALL (m::nat) n::nat. PRE (m - n) = PRE m - n"
  2.1862    by (import arithmetic PRE_SUB)
  2.1863  
  2.1864  lemma ADD_EQ_1: "ALL (m::nat) n::nat.
  2.1865 @@ -1114,13 +1395,14 @@
  2.1866  lemma ADD_INV_0_EQ: "ALL (m::nat) n::nat. (m + n = m) = (n = (0::nat))"
  2.1867    by (import arithmetic ADD_INV_0_EQ)
  2.1868  
  2.1869 -lemma PRE_SUC_EQ: "ALL m n. 0 < n --> (m = PRE n) = (Suc m = n)"
  2.1870 +lemma PRE_SUC_EQ: "ALL (m::nat) n::nat. (0::nat) < n --> (m = PRE n) = (Suc m = n)"
  2.1871    by (import arithmetic PRE_SUC_EQ)
  2.1872  
  2.1873 -lemma INV_PRE_EQ: "ALL m n. 0 < m & 0 < n --> (PRE m = PRE n) = (m = n)"
  2.1874 +lemma INV_PRE_EQ: "ALL (m::nat) n::nat.
  2.1875 +   (0::nat) < m & (0::nat) < n --> (PRE m = PRE n) = (m = n)"
  2.1876    by (import arithmetic INV_PRE_EQ)
  2.1877  
  2.1878 -lemma LESS_SUC_NOT: "ALL m n. m < n --> ~ n < Suc m"
  2.1879 +lemma LESS_SUC_NOT: "ALL (m::nat) n::nat. m < n --> ~ n < Suc m"
  2.1880    by (import arithmetic LESS_SUC_NOT)
  2.1881  
  2.1882  lemma ADD_EQ_SUB: "ALL (m::nat) (n::nat) p::nat. n <= p --> (m + n = p) = (m = p - n)"
  2.1883 @@ -1129,16 +1411,17 @@
  2.1884  lemma LESS_ADD_1: "ALL (x::nat) xa::nat. xa < x --> (EX xb::nat. x = xa + (xb + (1::nat)))"
  2.1885    by (import arithmetic LESS_ADD_1)
  2.1886  
  2.1887 -lemma NOT_ODD_EQ_EVEN: "ALL n m. Suc (n + n) ~= m + m"
  2.1888 +lemma NOT_ODD_EQ_EVEN: "ALL (n::nat) m::nat. Suc (n + n) ~= m + m"
  2.1889    by (import arithmetic NOT_ODD_EQ_EVEN)
  2.1890  
  2.1891 -lemma MULT_SUC_EQ: "ALL p m n. (n * Suc p = m * Suc p) = (n = m)"
  2.1892 +lemma MULT_SUC_EQ: "ALL (p::nat) (m::nat) n::nat. (n * Suc p = m * Suc p) = (n = m)"
  2.1893    by (import arithmetic MULT_SUC_EQ)
  2.1894  
  2.1895 -lemma MULT_EXP_MONO: "ALL p q n m. (n * Suc q ^ p = m * Suc q ^ p) = (n = m)"
  2.1896 +lemma MULT_EXP_MONO: "ALL (p::nat) (q::nat) (n::nat) m::nat.
  2.1897 +   (n * Suc q ^ p = m * Suc q ^ p) = (n = m)"
  2.1898    by (import arithmetic MULT_EXP_MONO)
  2.1899  
  2.1900 -lemma LESS_ADD_SUC: "ALL m n. m < m + Suc n"
  2.1901 +lemma LESS_ADD_SUC: "ALL (m::nat) n::nat. m < m + Suc n"
  2.1902    by (import arithmetic LESS_ADD_SUC)
  2.1903  
  2.1904  lemma LESS_OR_EQ_ADD: "ALL (n::nat) m::nat. n < m | (EX p::nat. n = p + m)"
  2.1905 @@ -1157,10 +1440,10 @@
  2.1906                      ((Not::bool => bool) (P m)))))))"
  2.1907    by (import arithmetic WOP)
  2.1908  
  2.1909 -lemma INV_PRE_LESS: "ALL m>0. ALL n. (PRE m < PRE n) = (m < n)"
  2.1910 +lemma INV_PRE_LESS: "ALL m>0::nat. ALL n::nat. (PRE m < PRE n) = (m < n)"
  2.1911    by (import arithmetic INV_PRE_LESS)
  2.1912  
  2.1913 -lemma INV_PRE_LESS_EQ: "ALL n>0. ALL m. (PRE m <= PRE n) = (m <= n)"
  2.1914 +lemma INV_PRE_LESS_EQ: "ALL n>0::nat. ALL m::nat. (PRE m <= PRE n) = (m <= n)"
  2.1915    by (import arithmetic INV_PRE_LESS_EQ)
  2.1916  
  2.1917  lemma SUB_EQ_EQ_0: "ALL (m::nat) n::nat. (m - n = m) = (m = (0::nat) | n = (0::nat))"
  2.1918 @@ -1175,7 +1458,7 @@
  2.1919  lemma LESS_EQ_SUB_LESS: "ALL (x::nat) xa::nat. xa <= x --> (ALL c::nat. (x - xa < c) = (x < xa + c))"
  2.1920    by (import arithmetic LESS_EQ_SUB_LESS)
  2.1921  
  2.1922 -lemma NOT_SUC_LESS_EQ: "ALL x xa. (~ Suc x <= xa) = (xa <= x)"
  2.1923 +lemma NOT_SUC_LESS_EQ: "ALL (x::nat) xa::nat. (~ Suc x <= xa) = (xa <= x)"
  2.1924    by (import arithmetic NOT_SUC_LESS_EQ)
  2.1925  
  2.1926  lemma SUB_LESS_EQ_ADD: "ALL (m::nat) p::nat. m <= p --> (ALL n::nat. (p - m <= n) = (p <= m + n))"
  2.1927 @@ -1185,16 +1468,18 @@
  2.1928     xa <= x & xb <= x --> (x - xa = x - xb) = (xa = xb)"
  2.1929    by (import arithmetic SUB_CANCEL)
  2.1930  
  2.1931 -lemma NOT_EXP_0: "ALL m n. Suc n ^ m ~= 0"
  2.1932 +lemma NOT_EXP_0: "ALL (m::nat) n::nat. Suc n ^ m ~= (0::nat)"
  2.1933    by (import arithmetic NOT_EXP_0)
  2.1934  
  2.1935 -lemma ZERO_LESS_EXP: "ALL m n. 0 < Suc n ^ m"
  2.1936 +lemma ZERO_LESS_EXP: "ALL (m::nat) n::nat. (0::nat) < Suc n ^ m"
  2.1937    by (import arithmetic ZERO_LESS_EXP)
  2.1938  
  2.1939 -lemma ODD_OR_EVEN: "ALL x. EX xa. x = Suc (Suc 0) * xa | x = Suc (Suc 0) * xa + 1"
  2.1940 +lemma ODD_OR_EVEN: "ALL x::nat.
  2.1941 +   EX xa::nat.
  2.1942 +      x = Suc (Suc (0::nat)) * xa | x = Suc (Suc (0::nat)) * xa + (1::nat)"
  2.1943    by (import arithmetic ODD_OR_EVEN)
  2.1944  
  2.1945 -lemma LESS_EXP_SUC_MONO: "ALL n m. Suc (Suc m) ^ n < Suc (Suc m) ^ Suc n"
  2.1946 +lemma LESS_EXP_SUC_MONO: "ALL (n::nat) m::nat. Suc (Suc m) ^ n < Suc (Suc m) ^ Suc n"
  2.1947    by (import arithmetic LESS_EXP_SUC_MONO)
  2.1948  
  2.1949  lemma LESS_LESS_CASES: "ALL (m::nat) n::nat. m = n | m < n | n < m"
  2.1950 @@ -1212,67 +1497,69 @@
  2.1951  consts
  2.1952    FACT :: "nat => nat" 
  2.1953  
  2.1954 -specification (FACT) FACT: "FACT 0 = 1 & (ALL n. FACT (Suc n) = Suc n * FACT n)"
  2.1955 +specification (FACT) FACT: "FACT (0::nat) = (1::nat) & (ALL n::nat. FACT (Suc n) = Suc n * FACT n)"
  2.1956    by (import arithmetic FACT)
  2.1957  
  2.1958 -lemma FACT_LESS: "ALL n. 0 < FACT n"
  2.1959 +lemma FACT_LESS: "ALL n::nat. (0::nat) < FACT n"
  2.1960    by (import arithmetic FACT_LESS)
  2.1961  
  2.1962 -lemma EVEN_ODD: "ALL n. EVEN n = (~ ODD n)"
  2.1963 +lemma EVEN_ODD: "ALL n::nat. EVEN n = (~ ODD n)"
  2.1964    by (import arithmetic EVEN_ODD)
  2.1965  
  2.1966 -lemma ODD_EVEN: "ALL x. ODD x = (~ EVEN x)"
  2.1967 +lemma ODD_EVEN: "ALL x::nat. ODD x = (~ EVEN x)"
  2.1968    by (import arithmetic ODD_EVEN)
  2.1969  
  2.1970 -lemma EVEN_OR_ODD: "ALL x. EVEN x | ODD x"
  2.1971 +lemma EVEN_OR_ODD: "ALL x::nat. EVEN x | ODD x"
  2.1972    by (import arithmetic EVEN_OR_ODD)
  2.1973  
  2.1974 -lemma EVEN_AND_ODD: "ALL x. ~ (EVEN x & ODD x)"
  2.1975 +lemma EVEN_AND_ODD: "ALL x::nat. ~ (EVEN x & ODD x)"
  2.1976    by (import arithmetic EVEN_AND_ODD)
  2.1977  
  2.1978 -lemma EVEN_ADD: "ALL m n. EVEN (m + n) = (EVEN m = EVEN n)"
  2.1979 +lemma EVEN_ADD: "ALL (m::nat) n::nat. EVEN (m + n) = (EVEN m = EVEN n)"
  2.1980    by (import arithmetic EVEN_ADD)
  2.1981  
  2.1982 -lemma EVEN_MULT: "ALL m n. EVEN (m * n) = (EVEN m | EVEN n)"
  2.1983 +lemma EVEN_MULT: "ALL (m::nat) n::nat. EVEN (m * n) = (EVEN m | EVEN n)"
  2.1984    by (import arithmetic EVEN_MULT)
  2.1985  
  2.1986 -lemma ODD_ADD: "ALL m n. ODD (m + n) = (ODD m ~= ODD n)"
  2.1987 +lemma ODD_ADD: "ALL (m::nat) n::nat. ODD (m + n) = (ODD m ~= ODD n)"
  2.1988    by (import arithmetic ODD_ADD)
  2.1989  
  2.1990 -lemma ODD_MULT: "ALL m n. ODD (m * n) = (ODD m & ODD n)"
  2.1991 +lemma ODD_MULT: "ALL (m::nat) n::nat. ODD (m * n) = (ODD m & ODD n)"
  2.1992    by (import arithmetic ODD_MULT)
  2.1993  
  2.1994 -lemma EVEN_DOUBLE: "ALL n. EVEN (2 * n)"
  2.1995 +lemma EVEN_DOUBLE: "ALL n::nat. EVEN ((2::nat) * n)"
  2.1996    by (import arithmetic EVEN_DOUBLE)
  2.1997  
  2.1998 -lemma ODD_DOUBLE: "ALL x. ODD (Suc (2 * x))"
  2.1999 +lemma ODD_DOUBLE: "ALL x::nat. ODD (Suc ((2::nat) * x))"
  2.2000    by (import arithmetic ODD_DOUBLE)
  2.2001  
  2.2002 -lemma EVEN_ODD_EXISTS: "ALL x. (EVEN x --> (EX m. x = 2 * m)) & (ODD x --> (EX m. x = Suc (2 * m)))"
  2.2003 +lemma EVEN_ODD_EXISTS: "ALL x::nat.
  2.2004 +   (EVEN x --> (EX m::nat. x = (2::nat) * m)) &
  2.2005 +   (ODD x --> (EX m::nat. x = Suc ((2::nat) * m)))"
  2.2006    by (import arithmetic EVEN_ODD_EXISTS)
  2.2007  
  2.2008 -lemma EVEN_EXISTS: "ALL n. EVEN n = (EX m. n = 2 * m)"
  2.2009 +lemma EVEN_EXISTS: "ALL n::nat. EVEN n = (EX m::nat. n = (2::nat) * m)"
  2.2010    by (import arithmetic EVEN_EXISTS)
  2.2011  
  2.2012 -lemma ODD_EXISTS: "ALL n. ODD n = (EX m. n = Suc (2 * m))"
  2.2013 +lemma ODD_EXISTS: "ALL n::nat. ODD n = (EX m::nat. n = Suc ((2::nat) * m))"
  2.2014    by (import arithmetic ODD_EXISTS)
  2.2015  
  2.2016 -lemma NOT_SUC_LESS_EQ_0: "ALL x. ~ Suc x <= 0"
  2.2017 +lemma NOT_SUC_LESS_EQ_0: "ALL x::nat. ~ Suc x <= (0::nat)"
  2.2018    by (import arithmetic NOT_SUC_LESS_EQ_0)
  2.2019  
  2.2020 -lemma NOT_LEQ: "ALL x xa. (~ x <= xa) = (Suc xa <= x)"
  2.2021 +lemma NOT_LEQ: "ALL (x::nat) xa::nat. (~ x <= xa) = (Suc xa <= x)"
  2.2022    by (import arithmetic NOT_LEQ)
  2.2023  
  2.2024 -lemma NOT_NUM_EQ: "ALL x xa. (x ~= xa) = (Suc x <= xa | Suc xa <= x)"
  2.2025 +lemma NOT_NUM_EQ: "ALL (x::nat) xa::nat. (x ~= xa) = (Suc x <= xa | Suc xa <= x)"
  2.2026    by (import arithmetic NOT_NUM_EQ)
  2.2027  
  2.2028 -lemma NOT_GREATER_EQ: "ALL x xa. (~ xa <= x) = (Suc x <= xa)"
  2.2029 +lemma NOT_GREATER_EQ: "ALL (x::nat) xa::nat. (~ xa <= x) = (Suc x <= xa)"
  2.2030    by (import arithmetic NOT_GREATER_EQ)
  2.2031  
  2.2032 -lemma SUC_ADD_SYM: "ALL m n. Suc (m + n) = Suc n + m"
  2.2033 +lemma SUC_ADD_SYM: "ALL (m::nat) n::nat. Suc (m + n) = Suc n + m"
  2.2034    by (import arithmetic SUC_ADD_SYM)
  2.2035  
  2.2036 -lemma NOT_SUC_ADD_LESS_EQ: "ALL m n. ~ Suc (m + n) <= m"
  2.2037 +lemma NOT_SUC_ADD_LESS_EQ: "ALL (m::nat) n::nat. ~ Suc (m + n) <= m"
  2.2038    by (import arithmetic NOT_SUC_ADD_LESS_EQ)
  2.2039  
  2.2040  lemma SUB_LEFT_ADD: "ALL (m::nat) (n::nat) p::nat.
  2.2041 @@ -1286,7 +1573,8 @@
  2.2042     m - (n - p) = (if n <= p then m else m + p - n)"
  2.2043    by (import arithmetic SUB_LEFT_SUB)
  2.2044  
  2.2045 -lemma SUB_LEFT_SUC: "ALL m n. Suc (m - n) = (if m <= n then Suc 0 else Suc m - n)"
  2.2046 +lemma SUB_LEFT_SUC: "ALL (m::nat) n::nat.
  2.2047 +   Suc (m - n) = (if m <= n then Suc (0::nat) else Suc m - n)"
  2.2048    by (import arithmetic SUB_LEFT_SUC)
  2.2049  
  2.2050  lemma SUB_LEFT_LESS_EQ: "ALL (m::nat) (n::nat) p::nat. (m <= n - p) = (m + p <= n | m <= (0::nat))"
  2.2051 @@ -1391,22 +1679,26 @@
  2.2052     (0::nat) < n & (0::nat) < q --> n * (p mod q) = n * p mod (n * q)"
  2.2053    by (import arithmetic MOD_COMMON_FACTOR)
  2.2054  
  2.2055 -lemma num_case_cong: "ALL M M' b f.
  2.2056 -   M = M' & (M' = 0 --> b = b') & (ALL n. M' = Suc n --> f n = f' n) -->
  2.2057 +lemma num_case_cong: "ALL (M::nat) (M'::nat) (b::'a::type) f::nat => 'a::type.
  2.2058 +   M = M' &
  2.2059 +   (M' = (0::nat) --> b = (b'::'a::type)) &
  2.2060 +   (ALL n::nat. M' = Suc n --> f n = (f'::nat => 'a::type) n) -->
  2.2061     nat_case b f M = nat_case b' f' M'"
  2.2062    by (import arithmetic num_case_cong)
  2.2063  
  2.2064 -lemma SUC_ELIM_THM: "ALL P. (ALL n. P (Suc n) n) = (ALL n>0. P n (n - 1))"
  2.2065 +lemma SUC_ELIM_THM: "ALL P::nat => nat => bool.
  2.2066 +   (ALL n::nat. P (Suc n) n) = (ALL n>0::nat. P n (n - (1::nat)))"
  2.2067    by (import arithmetic SUC_ELIM_THM)
  2.2068  
  2.2069  lemma SUB_ELIM_THM: "(P::nat => bool) ((a::nat) - (b::nat)) =
  2.2070  (ALL x::nat. (b = a + x --> P (0::nat)) & (a = b + x --> P x))"
  2.2071    by (import arithmetic SUB_ELIM_THM)
  2.2072  
  2.2073 -lemma PRE_ELIM_THM: "P (PRE n) = (ALL m. (n = 0 --> P 0) & (n = Suc m --> P m))"
  2.2074 +lemma PRE_ELIM_THM: "(P::nat => bool) (PRE (n::nat)) =
  2.2075 +(ALL m::nat. (n = (0::nat) --> P (0::nat)) & (n = Suc m --> P m))"
  2.2076    by (import arithmetic PRE_ELIM_THM)
  2.2077  
  2.2078 -lemma MULT_INCREASES: "ALL m n. 1 < m & 0 < n --> Suc n <= m * n"
  2.2079 +lemma MULT_INCREASES: "ALL (m::nat) n::nat. (1::nat) < m & (0::nat) < n --> Suc n <= m * n"
  2.2080    by (import arithmetic MULT_INCREASES)
  2.2081  
  2.2082  lemma EXP_ALWAYS_BIG_ENOUGH: "ALL b>1::nat. ALL n::nat. EX m::nat. n <= b ^ m"
  2.2083 @@ -1466,133 +1758,146 @@
  2.2084  
  2.2085  constdefs
  2.2086    trat_1 :: "nat * nat" 
  2.2087 -  "trat_1 == (0, 0)"
  2.2088 -
  2.2089 -lemma trat_1: "trat_1 = (0, 0)"
  2.2090 +  "trat_1 == (0::nat, 0::nat)"
  2.2091 +
  2.2092 +lemma trat_1: "trat_1 = (0::nat, 0::nat)"
  2.2093    by (import hrat trat_1)
  2.2094  
  2.2095  constdefs
  2.2096    trat_inv :: "nat * nat => nat * nat" 
  2.2097 -  "trat_inv == %(x, y). (y, x)"
  2.2098 -
  2.2099 -lemma trat_inv: "ALL x y. trat_inv (x, y) = (y, x)"
  2.2100 +  "trat_inv == %(x::nat, y::nat). (y, x)"
  2.2101 +
  2.2102 +lemma trat_inv: "ALL (x::nat) y::nat. trat_inv (x, y) = (y, x)"
  2.2103    by (import hrat trat_inv)
  2.2104  
  2.2105  constdefs
  2.2106    trat_add :: "nat * nat => nat * nat => nat * nat" 
  2.2107    "trat_add ==
  2.2108 -%(x, y) (x', y').
  2.2109 +%(x::nat, y::nat) (x'::nat, y'::nat).
  2.2110     (PRE (Suc x * Suc y' + Suc x' * Suc y), PRE (Suc y * Suc y'))"
  2.2111  
  2.2112 -lemma trat_add: "ALL x y x' y'.
  2.2113 +lemma trat_add: "ALL (x::nat) (y::nat) (x'::nat) y'::nat.
  2.2114     trat_add (x, y) (x', y') =
  2.2115     (PRE (Suc x * Suc y' + Suc x' * Suc y), PRE (Suc y * Suc y'))"
  2.2116    by (import hrat trat_add)
  2.2117  
  2.2118  constdefs
  2.2119    trat_mul :: "nat * nat => nat * nat => nat * nat" 
  2.2120 -  "trat_mul == %(x, y) (x', y'). (PRE (Suc x * Suc x'), PRE (Suc y * Suc y'))"
  2.2121 -
  2.2122 -lemma trat_mul: "ALL x y x' y'.
  2.2123 +  "trat_mul ==
  2.2124 +%(x::nat, y::nat) (x'::nat, y'::nat).
  2.2125 +   (PRE (Suc x * Suc x'), PRE (Suc y * Suc y'))"
  2.2126 +
  2.2127 +lemma trat_mul: "ALL (x::nat) (y::nat) (x'::nat) y'::nat.
  2.2128     trat_mul (x, y) (x', y') = (PRE (Suc x * Suc x'), PRE (Suc y * Suc y'))"
  2.2129    by (import hrat trat_mul)
  2.2130  
  2.2131  consts
  2.2132    trat_sucint :: "nat => nat * nat" 
  2.2133  
  2.2134 -specification (trat_sucint) trat_sucint: "trat_sucint 0 = trat_1 &
  2.2135 -(ALL n. trat_sucint (Suc n) = trat_add (trat_sucint n) trat_1)"
  2.2136 +specification (trat_sucint) trat_sucint: "trat_sucint (0::nat) = trat_1 &
  2.2137 +(ALL n::nat. trat_sucint (Suc n) = trat_add (trat_sucint n) trat_1)"
  2.2138    by (import hrat trat_sucint)
  2.2139  
  2.2140  constdefs
  2.2141    trat_eq :: "nat * nat => nat * nat => bool" 
  2.2142 -  "trat_eq == %(x, y) (x', y'). Suc x * Suc y' = Suc x' * Suc y"
  2.2143 -
  2.2144 -lemma trat_eq: "ALL x y x' y'. trat_eq (x, y) (x', y') = (Suc x * Suc y' = Suc x' * Suc y)"
  2.2145 +  "trat_eq ==
  2.2146 +%(x::nat, y::nat) (x'::nat, y'::nat). Suc x * Suc y' = Suc x' * Suc y"
  2.2147 +
  2.2148 +lemma trat_eq: "ALL (x::nat) (y::nat) (x'::nat) y'::nat.
  2.2149 +   trat_eq (x, y) (x', y') = (Suc x * Suc y' = Suc x' * Suc y)"
  2.2150    by (import hrat trat_eq)
  2.2151  
  2.2152 -lemma TRAT_EQ_REFL: "ALL p. trat_eq p p"
  2.2153 +lemma TRAT_EQ_REFL: "ALL p::nat * nat. trat_eq p p"
  2.2154    by (import hrat TRAT_EQ_REFL)
  2.2155  
  2.2156 -lemma TRAT_EQ_SYM: "ALL p q. trat_eq p q = trat_eq q p"
  2.2157 +lemma TRAT_EQ_SYM: "ALL (p::nat * nat) q::nat * nat. trat_eq p q = trat_eq q p"
  2.2158    by (import hrat TRAT_EQ_SYM)
  2.2159  
  2.2160 -lemma TRAT_EQ_TRANS: "ALL p q r. trat_eq p q & trat_eq q r --> trat_eq p r"
  2.2161 +lemma TRAT_EQ_TRANS: "ALL (p::nat * nat) (q::nat * nat) r::nat * nat.
  2.2162 +   trat_eq p q & trat_eq q r --> trat_eq p r"
  2.2163    by (import hrat TRAT_EQ_TRANS)
  2.2164  
  2.2165 -lemma TRAT_EQ_AP: "ALL p q. p = q --> trat_eq p q"
  2.2166 +lemma TRAT_EQ_AP: "ALL (p::nat * nat) q::nat * nat. p = q --> trat_eq p q"
  2.2167    by (import hrat TRAT_EQ_AP)
  2.2168  
  2.2169 -lemma TRAT_ADD_SYM_EQ: "ALL h i. trat_add h i = trat_add i h"
  2.2170 +lemma TRAT_ADD_SYM_EQ: "ALL (h::nat * nat) i::nat * nat. trat_add h i = trat_add i h"
  2.2171    by (import hrat TRAT_ADD_SYM_EQ)
  2.2172  
  2.2173 -lemma TRAT_MUL_SYM_EQ: "ALL h i. trat_mul h i = trat_mul i h"
  2.2174 +lemma TRAT_MUL_SYM_EQ: "ALL (h::nat * nat) i::nat * nat. trat_mul h i = trat_mul i h"
  2.2175    by (import hrat TRAT_MUL_SYM_EQ)
  2.2176  
  2.2177 -lemma TRAT_INV_WELLDEFINED: "ALL p q. trat_eq p q --> trat_eq (trat_inv p) (trat_inv q)"
  2.2178 +lemma TRAT_INV_WELLDEFINED: "ALL (p::nat * nat) q::nat * nat.
  2.2179 +   trat_eq p q --> trat_eq (trat_inv p) (trat_inv q)"
  2.2180    by (import hrat TRAT_INV_WELLDEFINED)
  2.2181  
  2.2182 -lemma TRAT_ADD_WELLDEFINED: "ALL p q r. trat_eq p q --> trat_eq (trat_add p r) (trat_add q r)"
  2.2183 +lemma TRAT_ADD_WELLDEFINED: "ALL (p::nat * nat) (q::nat * nat) r::nat * nat.
  2.2184 +   trat_eq p q --> trat_eq (trat_add p r) (trat_add q r)"
  2.2185    by (import hrat TRAT_ADD_WELLDEFINED)
  2.2186  
  2.2187 -lemma TRAT_ADD_WELLDEFINED2: "ALL p1 p2 q1 q2.
  2.2188 +lemma TRAT_ADD_WELLDEFINED2: "ALL (p1::nat * nat) (p2::nat * nat) (q1::nat * nat) q2::nat * nat.
  2.2189     trat_eq p1 p2 & trat_eq q1 q2 -->
  2.2190     trat_eq (trat_add p1 q1) (trat_add p2 q2)"
  2.2191    by (import hrat TRAT_ADD_WELLDEFINED2)
  2.2192  
  2.2193 -lemma TRAT_MUL_WELLDEFINED: "ALL p q r. trat_eq p q --> trat_eq (trat_mul p r) (trat_mul q r)"
  2.2194 +lemma TRAT_MUL_WELLDEFINED: "ALL (p::nat * nat) (q::nat * nat) r::nat * nat.
  2.2195 +   trat_eq p q --> trat_eq (trat_mul p r) (trat_mul q r)"
  2.2196    by (import hrat TRAT_MUL_WELLDEFINED)
  2.2197  
  2.2198 -lemma TRAT_MUL_WELLDEFINED2: "ALL p1 p2 q1 q2.
  2.2199 +lemma TRAT_MUL_WELLDEFINED2: "ALL (p1::nat * nat) (p2::nat * nat) (q1::nat * nat) q2::nat * nat.
  2.2200     trat_eq p1 p2 & trat_eq q1 q2 -->
  2.2201     trat_eq (trat_mul p1 q1) (trat_mul p2 q2)"
  2.2202    by (import hrat TRAT_MUL_WELLDEFINED2)
  2.2203  
  2.2204 -lemma TRAT_ADD_SYM: "ALL h i. trat_eq (trat_add h i) (trat_add i h)"
  2.2205 +lemma TRAT_ADD_SYM: "ALL (h::nat * nat) i::nat * nat. trat_eq (trat_add h i) (trat_add i h)"
  2.2206    by (import hrat TRAT_ADD_SYM)
  2.2207  
  2.2208 -lemma TRAT_ADD_ASSOC: "ALL h i j. trat_eq (trat_add h (trat_add i j)) (trat_add (trat_add h i) j)"
  2.2209 +lemma TRAT_ADD_ASSOC: "ALL (h::nat * nat) (i::nat * nat) j::nat * nat.
  2.2210 +   trat_eq (trat_add h (trat_add i j)) (trat_add (trat_add h i) j)"
  2.2211    by (import hrat TRAT_ADD_ASSOC)
  2.2212  
  2.2213 -lemma TRAT_MUL_SYM: "ALL h i. trat_eq (trat_mul h i) (trat_mul i h)"
  2.2214 +lemma TRAT_MUL_SYM: "ALL (h::nat * nat) i::nat * nat. trat_eq (trat_mul h i) (trat_mul i h)"
  2.2215    by (import hrat TRAT_MUL_SYM)
  2.2216  
  2.2217 -lemma TRAT_MUL_ASSOC: "ALL h i j. trat_eq (trat_mul h (trat_mul i j)) (trat_mul (trat_mul h i) j)"
  2.2218 +lemma TRAT_MUL_ASSOC: "ALL (h::nat * nat) (i::nat * nat) j::nat * nat.
  2.2219 +   trat_eq (trat_mul h (trat_mul i j)) (trat_mul (trat_mul h i) j)"
  2.2220    by (import hrat TRAT_MUL_ASSOC)
  2.2221  
  2.2222 -lemma TRAT_LDISTRIB: "ALL h i j.
  2.2223 +lemma TRAT_LDISTRIB: "ALL (h::nat * nat) (i::nat * nat) j::nat * nat.
  2.2224     trat_eq (trat_mul h (trat_add i j))
  2.2225      (trat_add (trat_mul h i) (trat_mul h j))"
  2.2226    by (import hrat TRAT_LDISTRIB)
  2.2227  
  2.2228 -lemma TRAT_MUL_LID: "ALL h. trat_eq (trat_mul trat_1 h) h"
  2.2229 +lemma TRAT_MUL_LID: "ALL h::nat * nat. trat_eq (trat_mul trat_1 h) h"
  2.2230    by (import hrat TRAT_MUL_LID)
  2.2231  
  2.2232 -lemma TRAT_MUL_LINV: "ALL h. trat_eq (trat_mul (trat_inv h) h) trat_1"
  2.2233 +lemma TRAT_MUL_LINV: "ALL h::nat * nat. trat_eq (trat_mul (trat_inv h) h) trat_1"
  2.2234    by (import hrat TRAT_MUL_LINV)
  2.2235  
  2.2236 -lemma TRAT_NOZERO: "ALL h i. ~ trat_eq (trat_add h i) h"
  2.2237 +lemma TRAT_NOZERO: "ALL (h::nat * nat) i::nat * nat. ~ trat_eq (trat_add h i) h"
  2.2238    by (import hrat TRAT_NOZERO)
  2.2239  
  2.2240 -lemma TRAT_ADD_TOTAL: "ALL h i.
  2.2241 +lemma TRAT_ADD_TOTAL: "ALL (h::nat * nat) i::nat * nat.
  2.2242     trat_eq h i |
  2.2243 -   (EX d. trat_eq h (trat_add i d)) | (EX d. trat_eq i (trat_add h d))"
  2.2244 +   (EX d::nat * nat. trat_eq h (trat_add i d)) |
  2.2245 +   (EX d::nat * nat. trat_eq i (trat_add h d))"
  2.2246    by (import hrat TRAT_ADD_TOTAL)
  2.2247  
  2.2248 -lemma TRAT_SUCINT_0: "ALL n. trat_eq (trat_sucint n) (n, 0)"
  2.2249 +lemma TRAT_SUCINT_0: "ALL n::nat. trat_eq (trat_sucint n) (n, 0::nat)"
  2.2250    by (import hrat TRAT_SUCINT_0)
  2.2251  
  2.2252 -lemma TRAT_ARCH: "ALL h. EX n d. trat_eq (trat_sucint n) (trat_add h d)"
  2.2253 +lemma TRAT_ARCH: "ALL h::nat * nat.
  2.2254 +   EX (n::nat) d::nat * nat. trat_eq (trat_sucint n) (trat_add h d)"
  2.2255    by (import hrat TRAT_ARCH)
  2.2256  
  2.2257 -lemma TRAT_SUCINT: "trat_eq (trat_sucint 0) trat_1 &
  2.2258 -(ALL n. trat_eq (trat_sucint (Suc n)) (trat_add (trat_sucint n) trat_1))"
  2.2259 +lemma TRAT_SUCINT: "trat_eq (trat_sucint (0::nat)) trat_1 &
  2.2260 +(ALL n::nat.
  2.2261 +    trat_eq (trat_sucint (Suc n)) (trat_add (trat_sucint n) trat_1))"
  2.2262    by (import hrat TRAT_SUCINT)
  2.2263  
  2.2264 -lemma TRAT_EQ_EQUIV: "ALL p q. trat_eq p q = (trat_eq p = trat_eq q)"
  2.2265 +lemma TRAT_EQ_EQUIV: "ALL (p::nat * nat) q::nat * nat. trat_eq p q = (trat_eq p = trat_eq q)"
  2.2266    by (import hrat TRAT_EQ_EQUIV)
  2.2267  
  2.2268 -typedef (open) hrat = "{x. EX xa. x = trat_eq xa}" 
  2.2269 +typedef (open) hrat = "{x::nat * nat => bool. EX xa::nat * nat. x = trat_eq xa}" 
  2.2270    by (rule typedef_helper,import hrat hrat_TY_DEF)
  2.2271  
  2.2272  lemmas hrat_TY_DEF = typedef_hol2hol4 [OF type_definition_hrat]
  2.2273 @@ -1601,8 +1906,9 @@
  2.2274    mk_hrat :: "(nat * nat => bool) => hrat" 
  2.2275    dest_hrat :: "hrat => nat * nat => bool" 
  2.2276  
  2.2277 -specification (dest_hrat mk_hrat) hrat_tybij: "(ALL a. mk_hrat (dest_hrat a) = a) &
  2.2278 -(ALL r. (EX x. r = trat_eq x) = (dest_hrat (mk_hrat r) = r))"
  2.2279 +specification (dest_hrat mk_hrat) hrat_tybij: "(ALL a::hrat. mk_hrat (dest_hrat a) = a) &
  2.2280 +(ALL r::nat * nat => bool.
  2.2281 +    (EX x::nat * nat. r = trat_eq x) = (dest_hrat (mk_hrat r) = r))"
  2.2282    by (import hrat hrat_tybij)
  2.2283  
  2.2284  constdefs
  2.2285 @@ -1614,18 +1920,19 @@
  2.2286  
  2.2287  constdefs
  2.2288    hrat_inv :: "hrat => hrat" 
  2.2289 -  "hrat_inv == %T1. mk_hrat (trat_eq (trat_inv (Eps (dest_hrat T1))))"
  2.2290 -
  2.2291 -lemma hrat_inv: "ALL T1. hrat_inv T1 = mk_hrat (trat_eq (trat_inv (Eps (dest_hrat T1))))"
  2.2292 +  "hrat_inv == %T1::hrat. mk_hrat (trat_eq (trat_inv (Eps (dest_hrat T1))))"
  2.2293 +
  2.2294 +lemma hrat_inv: "ALL T1::hrat.
  2.2295 +   hrat_inv T1 = mk_hrat (trat_eq (trat_inv (Eps (dest_hrat T1))))"
  2.2296    by (import hrat hrat_inv)
  2.2297  
  2.2298  constdefs
  2.2299    hrat_add :: "hrat => hrat => hrat" 
  2.2300    "hrat_add ==
  2.2301 -%T1 T2.
  2.2302 +%(T1::hrat) T2::hrat.
  2.2303     mk_hrat (trat_eq (trat_add (Eps (dest_hrat T1)) (Eps (dest_hrat T2))))"
  2.2304  
  2.2305 -lemma hrat_add: "ALL T1 T2.
  2.2306 +lemma hrat_add: "ALL (T1::hrat) T2::hrat.
  2.2307     hrat_add T1 T2 =
  2.2308     mk_hrat (trat_eq (trat_add (Eps (dest_hrat T1)) (Eps (dest_hrat T2))))"
  2.2309    by (import hrat hrat_add)
  2.2310 @@ -1633,54 +1940,57 @@
  2.2311  constdefs
  2.2312    hrat_mul :: "hrat => hrat => hrat" 
  2.2313    "hrat_mul ==
  2.2314 -%T1 T2.
  2.2315 +%(T1::hrat) T2::hrat.
  2.2316     mk_hrat (trat_eq (trat_mul (Eps (dest_hrat T1)) (Eps (dest_hrat T2))))"
  2.2317  
  2.2318 -lemma hrat_mul: "ALL T1 T2.
  2.2319 +lemma hrat_mul: "ALL (T1::hrat) T2::hrat.
  2.2320     hrat_mul T1 T2 =
  2.2321     mk_hrat (trat_eq (trat_mul (Eps (dest_hrat T1)) (Eps (dest_hrat T2))))"
  2.2322    by (import hrat hrat_mul)
  2.2323  
  2.2324  constdefs
  2.2325    hrat_sucint :: "nat => hrat" 
  2.2326 -  "hrat_sucint == %T1. mk_hrat (trat_eq (trat_sucint T1))"
  2.2327 -
  2.2328 -lemma hrat_sucint: "ALL T1. hrat_sucint T1 = mk_hrat (trat_eq (trat_sucint T1))"
  2.2329 +  "hrat_sucint == %T1::nat. mk_hrat (trat_eq (trat_sucint T1))"
  2.2330 +
  2.2331 +lemma hrat_sucint: "ALL T1::nat. hrat_sucint T1 = mk_hrat (trat_eq (trat_sucint T1))"
  2.2332    by (import hrat hrat_sucint)
  2.2333  
  2.2334 -lemma HRAT_ADD_SYM: "ALL h i. hrat_add h i = hrat_add i h"
  2.2335 +lemma HRAT_ADD_SYM: "ALL (h::hrat) i::hrat. hrat_add h i = hrat_add i h"
  2.2336    by (import hrat HRAT_ADD_SYM)
  2.2337  
  2.2338 -lemma HRAT_ADD_ASSOC: "ALL h i j. hrat_add h (hrat_add i j) = hrat_add (hrat_add h i) j"
  2.2339 +lemma HRAT_ADD_ASSOC: "ALL (h::hrat) (i::hrat) j::hrat.
  2.2340 +   hrat_add h (hrat_add i j) = hrat_add (hrat_add h i) j"
  2.2341    by (import hrat HRAT_ADD_ASSOC)
  2.2342  
  2.2343 -lemma HRAT_MUL_SYM: "ALL h i. hrat_mul h i = hrat_mul i h"
  2.2344 +lemma HRAT_MUL_SYM: "ALL (h::hrat) i::hrat. hrat_mul h i = hrat_mul i h"
  2.2345    by (import hrat HRAT_MUL_SYM)
  2.2346  
  2.2347 -lemma HRAT_MUL_ASSOC: "ALL h i j. hrat_mul h (hrat_mul i j) = hrat_mul (hrat_mul h i) j"
  2.2348 +lemma HRAT_MUL_ASSOC: "ALL (h::hrat) (i::hrat) j::hrat.
  2.2349 +   hrat_mul h (hrat_mul i j) = hrat_mul (hrat_mul h i) j"
  2.2350    by (import hrat HRAT_MUL_ASSOC)
  2.2351  
  2.2352 -lemma HRAT_LDISTRIB: "ALL h i j.
  2.2353 +lemma HRAT_LDISTRIB: "ALL (h::hrat) (i::hrat) j::hrat.
  2.2354     hrat_mul h (hrat_add i j) = hrat_add (hrat_mul h i) (hrat_mul h j)"
  2.2355    by (import hrat HRAT_LDISTRIB)
  2.2356  
  2.2357 -lemma HRAT_MUL_LID: "ALL h. hrat_mul hrat_1 h = h"
  2.2358 +lemma HRAT_MUL_LID: "ALL h::hrat. hrat_mul hrat_1 h = h"
  2.2359    by (import hrat HRAT_MUL_LID)
  2.2360  
  2.2361 -lemma HRAT_MUL_LINV: "ALL h. hrat_mul (hrat_inv h) h = hrat_1"
  2.2362 +lemma HRAT_MUL_LINV: "ALL h::hrat. hrat_mul (hrat_inv h) h = hrat_1"
  2.2363    by (import hrat HRAT_MUL_LINV)
  2.2364  
  2.2365 -lemma HRAT_NOZERO: "ALL h i. hrat_add h i ~= h"
  2.2366 +lemma HRAT_NOZERO: "ALL (h::hrat) i::hrat. hrat_add h i ~= h"
  2.2367    by (import hrat HRAT_NOZERO)
  2.2368  
  2.2369 -lemma HRAT_ADD_TOTAL: "ALL h i. h = i | (EX x. h = hrat_add i x) | (EX x. i = hrat_add h x)"
  2.2370 +lemma HRAT_ADD_TOTAL: "ALL (h::hrat) i::hrat.
  2.2371 +   h = i | (EX x::hrat. h = hrat_add i x) | (EX x::hrat. i = hrat_add h x)"
  2.2372    by (import hrat HRAT_ADD_TOTAL)
  2.2373  
  2.2374 -lemma HRAT_ARCH: "ALL h. EX x xa. hrat_sucint x = hrat_add h xa"
  2.2375 +lemma HRAT_ARCH: "ALL h::hrat. EX (x::nat) xa::hrat. hrat_sucint x = hrat_add h xa"
  2.2376    by (import hrat HRAT_ARCH)
  2.2377  
  2.2378 -lemma HRAT_SUCINT: "hrat_sucint 0 = hrat_1 &
  2.2379 -(ALL x. hrat_sucint (Suc x) = hrat_add (hrat_sucint x) hrat_1)"
  2.2380 +lemma HRAT_SUCINT: "hrat_sucint (0::nat) = hrat_1 &
  2.2381 +(ALL x::nat. hrat_sucint (Suc x) = hrat_add (hrat_sucint x) hrat_1)"
  2.2382    by (import hrat HRAT_SUCINT)
  2.2383  
  2.2384  ;end_setup
  2.2385 @@ -1689,128 +1999,138 @@
  2.2386  
  2.2387  constdefs
  2.2388    hrat_lt :: "hrat => hrat => bool" 
  2.2389 -  "hrat_lt == %x y. EX d. y = hrat_add x d"
  2.2390 -
  2.2391 -lemma hrat_lt: "ALL x y. hrat_lt x y = (EX d. y = hrat_add x d)"
  2.2392 +  "hrat_lt == %(x::hrat) y::hrat. EX d::hrat. y = hrat_add x d"
  2.2393 +
  2.2394 +lemma hrat_lt: "ALL (x::hrat) y::hrat. hrat_lt x y = (EX d::hrat. y = hrat_add x d)"
  2.2395    by (import hreal hrat_lt)
  2.2396  
  2.2397 -lemma HRAT_LT_REFL: "ALL x. ~ hrat_lt x x"
  2.2398 +lemma HRAT_LT_REFL: "ALL x::hrat. ~ hrat_lt x x"
  2.2399    by (import hreal HRAT_LT_REFL)
  2.2400  
  2.2401 -lemma HRAT_LT_TRANS: "ALL x y z. hrat_lt x y & hrat_lt y z --> hrat_lt x z"
  2.2402 +lemma HRAT_LT_TRANS: "ALL (x::hrat) (y::hrat) z::hrat. hrat_lt x y & hrat_lt y z --> hrat_lt x z"
  2.2403    by (import hreal HRAT_LT_TRANS)
  2.2404  
  2.2405 -lemma HRAT_LT_ANTISYM: "ALL x y. ~ (hrat_lt x y & hrat_lt y x)"
  2.2406 +lemma HRAT_LT_ANTISYM: "ALL (x::hrat) y::hrat. ~ (hrat_lt x y & hrat_lt y x)"
  2.2407    by (import hreal HRAT_LT_ANTISYM)
  2.2408  
  2.2409 -lemma HRAT_LT_TOTAL: "ALL x y. x = y | hrat_lt x y | hrat_lt y x"
  2.2410 +lemma HRAT_LT_TOTAL: "ALL (x::hrat) y::hrat. x = y | hrat_lt x y | hrat_lt y x"
  2.2411    by (import hreal HRAT_LT_TOTAL)
  2.2412  
  2.2413 -lemma HRAT_MUL_RID: "ALL x. hrat_mul x hrat_1 = x"
  2.2414 +lemma HRAT_MUL_RID: "ALL x::hrat. hrat_mul x hrat_1 = x"
  2.2415    by (import hreal HRAT_MUL_RID)
  2.2416  
  2.2417 -lemma HRAT_MUL_RINV: "ALL x. hrat_mul x (hrat_inv x) = hrat_1"
  2.2418 +lemma HRAT_MUL_RINV: "ALL x::hrat. hrat_mul x (hrat_inv x) = hrat_1"
  2.2419    by (import hreal HRAT_MUL_RINV)
  2.2420  
  2.2421 -lemma HRAT_RDISTRIB: "ALL x y z.
  2.2422 +lemma HRAT_RDISTRIB: "ALL (x::hrat) (y::hrat) z::hrat.
  2.2423     hrat_mul (hrat_add x y) z = hrat_add (hrat_mul x z) (hrat_mul y z)"
  2.2424    by (import hreal HRAT_RDISTRIB)
  2.2425  
  2.2426 -lemma HRAT_LT_ADDL: "ALL x y. hrat_lt x (hrat_add x y)"
  2.2427 +lemma HRAT_LT_ADDL: "ALL (x::hrat) y::hrat. hrat_lt x (hrat_add x y)"
  2.2428    by (import hreal HRAT_LT_ADDL)
  2.2429  
  2.2430 -lemma HRAT_LT_ADDR: "ALL x xa. hrat_lt xa (hrat_add x xa)"
  2.2431 +lemma HRAT_LT_ADDR: "ALL (x::hrat) xa::hrat. hrat_lt xa (hrat_add x xa)"
  2.2432    by (import hreal HRAT_LT_ADDR)
  2.2433  
  2.2434 -lemma HRAT_LT_GT: "ALL x y. hrat_lt x y --> ~ hrat_lt y x"
  2.2435 +lemma HRAT_LT_GT: "ALL (x::hrat) y::hrat. hrat_lt x y --> ~ hrat_lt y x"
  2.2436    by (import hreal HRAT_LT_GT)
  2.2437  
  2.2438 -lemma HRAT_LT_NE: "ALL x y. hrat_lt x y --> x ~= y"
  2.2439 +lemma HRAT_LT_NE: "ALL (x::hrat) y::hrat. hrat_lt x y --> x ~= y"
  2.2440    by (import hreal HRAT_LT_NE)
  2.2441  
  2.2442 -lemma HRAT_EQ_LADD: "ALL x y z. (hrat_add x y = hrat_add x z) = (y = z)"
  2.2443 +lemma HRAT_EQ_LADD: "ALL (x::hrat) (y::hrat) z::hrat. (hrat_add x y = hrat_add x z) = (y = z)"
  2.2444    by (import hreal HRAT_EQ_LADD)
  2.2445  
  2.2446 -lemma HRAT_EQ_LMUL: "ALL x y z. (hrat_mul x y = hrat_mul x z) = (y = z)"
  2.2447 +lemma HRAT_EQ_LMUL: "ALL (x::hrat) (y::hrat) z::hrat. (hrat_mul x y = hrat_mul x z) = (y = z)"
  2.2448    by (import hreal HRAT_EQ_LMUL)
  2.2449  
  2.2450 -lemma HRAT_LT_ADD2: "ALL u v x y.
  2.2451 +lemma HRAT_LT_ADD2: "ALL (u::hrat) (v::hrat) (x::hrat) y::hrat.
  2.2452     hrat_lt u x & hrat_lt v y --> hrat_lt (hrat_add u v) (hrat_add x y)"
  2.2453    by (import hreal HRAT_LT_ADD2)
  2.2454  
  2.2455 -lemma HRAT_LT_LADD: "ALL x y z. hrat_lt (hrat_add z x) (hrat_add z y) = hrat_lt x y"
  2.2456 +lemma HRAT_LT_LADD: "ALL (x::hrat) (y::hrat) z::hrat.
  2.2457 +   hrat_lt (hrat_add z x) (hrat_add z y) = hrat_lt x y"
  2.2458    by (import hreal HRAT_LT_LADD)
  2.2459  
  2.2460 -lemma HRAT_LT_RADD: "ALL x y z. hrat_lt (hrat_add x z) (hrat_add y z) = hrat_lt x y"
  2.2461 +lemma HRAT_LT_RADD: "ALL (x::hrat) (y::hrat) z::hrat.
  2.2462 +   hrat_lt (hrat_add x z) (hrat_add y z) = hrat_lt x y"
  2.2463    by (import hreal HRAT_LT_RADD)
  2.2464  
  2.2465 -lemma HRAT_LT_MUL2: "ALL u v x y.
  2.2466 +lemma HRAT_LT_MUL2: "ALL (u::hrat) (v::hrat) (x::hrat) y::hrat.
  2.2467     hrat_lt u x & hrat_lt v y --> hrat_lt (hrat_mul u v) (hrat_mul x y)"
  2.2468    by (import hreal HRAT_LT_MUL2)
  2.2469  
  2.2470 -lemma HRAT_LT_LMUL: "ALL x y z. hrat_lt (hrat_mul z x) (hrat_mul z y) = hrat_lt x y"
  2.2471 +lemma HRAT_LT_LMUL: "ALL (x::hrat) (y::hrat) z::hrat.
  2.2472 +   hrat_lt (hrat_mul z x) (hrat_mul z y) = hrat_lt x y"
  2.2473    by (import hreal HRAT_LT_LMUL)
  2.2474  
  2.2475 -lemma HRAT_LT_RMUL: "ALL x y z. hrat_lt (hrat_mul x z) (hrat_mul y z) = hrat_lt x y"
  2.2476 +lemma HRAT_LT_RMUL: "ALL (x::hrat) (y::hrat) z::hrat.
  2.2477 +   hrat_lt (hrat_mul x z) (hrat_mul y z) = hrat_lt x y"
  2.2478    by (import hreal HRAT_LT_RMUL)
  2.2479  
  2.2480 -lemma HRAT_LT_LMUL1: "ALL x y. hrat_lt (hrat_mul x y) y = hrat_lt x hrat_1"
  2.2481 +lemma HRAT_LT_LMUL1: "ALL (x::hrat) y::hrat. hrat_lt (hrat_mul x y) y = hrat_lt x hrat_1"
  2.2482    by (import hreal HRAT_LT_LMUL1)
  2.2483  
  2.2484 -lemma HRAT_LT_RMUL1: "ALL x y. hrat_lt (hrat_mul x y) x = hrat_lt y hrat_1"
  2.2485 +lemma HRAT_LT_RMUL1: "ALL (x::hrat) y::hrat. hrat_lt (hrat_mul x y) x = hrat_lt y hrat_1"
  2.2486    by (import hreal HRAT_LT_RMUL1)
  2.2487  
  2.2488 -lemma HRAT_GT_LMUL1: "ALL x y. hrat_lt y (hrat_mul x y) = hrat_lt hrat_1 x"
  2.2489 +lemma HRAT_GT_LMUL1: "ALL (x::hrat) y::hrat. hrat_lt y (hrat_mul x y) = hrat_lt hrat_1 x"
  2.2490    by (import hreal HRAT_GT_LMUL1)
  2.2491  
  2.2492 -lemma HRAT_LT_L1: "ALL x y. hrat_lt (hrat_mul (hrat_inv x) y) hrat_1 = hrat_lt y x"
  2.2493 +lemma HRAT_LT_L1: "ALL (x::hrat) y::hrat.
  2.2494 +   hrat_lt (hrat_mul (hrat_inv x) y) hrat_1 = hrat_lt y x"
  2.2495    by (import hreal HRAT_LT_L1)
  2.2496  
  2.2497 -lemma HRAT_LT_R1: "ALL x y. hrat_lt (hrat_mul x (hrat_inv y)) hrat_1 = hrat_lt x y"
  2.2498 +lemma HRAT_LT_R1: "ALL (x::hrat) y::hrat.
  2.2499 +   hrat_lt (hrat_mul x (hrat_inv y)) hrat_1 = hrat_lt x y"
  2.2500    by (import hreal HRAT_LT_R1)
  2.2501  
  2.2502 -lemma HRAT_GT_L1: "ALL x y. hrat_lt hrat_1 (hrat_mul (hrat_inv x) y) = hrat_lt x y"
  2.2503 +lemma HRAT_GT_L1: "ALL (x::hrat) y::hrat.
  2.2504 +   hrat_lt hrat_1 (hrat_mul (hrat_inv x) y) = hrat_lt x y"
  2.2505    by (import hreal HRAT_GT_L1)
  2.2506  
  2.2507 -lemma HRAT_INV_MUL: "ALL x y. hrat_inv (hrat_mul x y) = hrat_mul (hrat_inv x) (hrat_inv y)"
  2.2508 +lemma HRAT_INV_MUL: "ALL (x::hrat) y::hrat.
  2.2509 +   hrat_inv (hrat_mul x y) = hrat_mul (hrat_inv x) (hrat_inv y)"
  2.2510    by (import hreal HRAT_INV_MUL)
  2.2511  
  2.2512 -lemma HRAT_UP: "ALL x. Ex (hrat_lt x)"
  2.2513 +lemma HRAT_UP: "ALL x::hrat. Ex (hrat_lt x)"
  2.2514    by (import hreal HRAT_UP)
  2.2515  
  2.2516 -lemma HRAT_DOWN: "ALL x. EX xa. hrat_lt xa x"
  2.2517 +lemma HRAT_DOWN: "ALL x::hrat. EX xa::hrat. hrat_lt xa x"
  2.2518    by (import hreal HRAT_DOWN)
  2.2519  
  2.2520 -lemma HRAT_DOWN2: "ALL x y. EX xa. hrat_lt xa x & hrat_lt xa y"
  2.2521 +lemma HRAT_DOWN2: "ALL (x::hrat) y::hrat. EX xa::hrat. hrat_lt xa x & hrat_lt xa y"
  2.2522    by (import hreal HRAT_DOWN2)
  2.2523  
  2.2524 -lemma HRAT_MEAN: "ALL x y. hrat_lt x y --> (EX xa. hrat_lt x xa & hrat_lt xa y)"
  2.2525 +lemma HRAT_MEAN: "ALL (x::hrat) y::hrat.
  2.2526 +   hrat_lt x y --> (EX xa::hrat. hrat_lt x xa & hrat_lt xa y)"
  2.2527    by (import hreal HRAT_MEAN)
  2.2528  
  2.2529  constdefs
  2.2530    isacut :: "(hrat => bool) => bool" 
  2.2531    "isacut ==
  2.2532 -%C. Ex C &
  2.2533 -    (EX x. ~ C x) &
  2.2534 -    (ALL x y. C x & hrat_lt y x --> C y) &
  2.2535 -    (ALL x. C x --> (EX y. C y & hrat_lt x y))"
  2.2536 -
  2.2537 -lemma isacut: "ALL C.
  2.2538 +%C::hrat => bool.
  2.2539 +   Ex C &
  2.2540 +   (EX x::hrat. ~ C x) &
  2.2541 +   (ALL (x::hrat) y::hrat. C x & hrat_lt y x --> C y) &
  2.2542 +   (ALL x::hrat. C x --> (EX y::hrat. C y & hrat_lt x y))"
  2.2543 +
  2.2544 +lemma isacut: "ALL C::hrat => bool.
  2.2545     isacut C =
  2.2546     (Ex C &
  2.2547 -    (EX x. ~ C x) &
  2.2548 -    (ALL x y. C x & hrat_lt y x --> C y) &
  2.2549 -    (ALL x. C x --> (EX y. C y & hrat_lt x y)))"
  2.2550 +    (EX x::hrat. ~ C x) &
  2.2551 +    (ALL (x::hrat) y::hrat. C x & hrat_lt y x --> C y) &
  2.2552 +    (ALL x::hrat. C x --> (EX y::hrat. C y & hrat_lt x y)))"
  2.2553    by (import hreal isacut)
  2.2554  
  2.2555  constdefs
  2.2556    cut_of_hrat :: "hrat => hrat => bool" 
  2.2557 -  "cut_of_hrat == %x y. hrat_lt y x"
  2.2558 -
  2.2559 -lemma cut_of_hrat: "ALL x. cut_of_hrat x = (%y. hrat_lt y x)"
  2.2560 +  "cut_of_hrat == %(x::hrat) y::hrat. hrat_lt y x"
  2.2561 +
  2.2562 +lemma cut_of_hrat: "ALL x::hrat. cut_of_hrat x = (%y::hrat. hrat_lt y x)"
  2.2563    by (import hreal cut_of_hrat)
  2.2564  
  2.2565 -lemma ISACUT_HRAT: "ALL h. isacut (cut_of_hrat h)"
  2.2566 +lemma ISACUT_HRAT: "ALL h::hrat. isacut (cut_of_hrat h)"
  2.2567    by (import hreal ISACUT_HRAT)
  2.2568  
  2.2569  typedef (open) hreal = "Collect isacut" 
  2.2570 @@ -1822,39 +2142,45 @@
  2.2571    hreal :: "(hrat => bool) => hreal" 
  2.2572    cut :: "hreal => hrat => bool" 
  2.2573  
  2.2574 -specification (cut hreal) hreal_tybij: "(ALL a. hreal (hreal.cut a) = a) &
  2.2575 -(ALL r. isacut r = (hreal.cut (hreal r) = r))"
  2.2576 +specification (cut hreal) hreal_tybij: "(ALL a::hreal. hreal (hreal.cut a) = a) &
  2.2577 +(ALL r::hrat => bool. isacut r = (hreal.cut (hreal r) = r))"
  2.2578    by (import hreal hreal_tybij)
  2.2579  
  2.2580 -lemma EQUAL_CUTS: "ALL X Y. hreal.cut X = hreal.cut Y --> X = Y"
  2.2581 +lemma EQUAL_CUTS: "ALL (X::hreal) Y::hreal. hreal.cut X = hreal.cut Y --> X = Y"
  2.2582    by (import hreal EQUAL_CUTS)
  2.2583  
  2.2584 -lemma CUT_ISACUT: "ALL x. isacut (hreal.cut x)"
  2.2585 +lemma CUT_ISACUT: "ALL x::hreal. isacut (hreal.cut x)"
  2.2586    by (import hreal CUT_ISACUT)
  2.2587  
  2.2588 -lemma CUT_NONEMPTY: "ALL x. Ex (hreal.cut x)"
  2.2589 +lemma CUT_NONEMPTY: "ALL x::hreal. Ex (hreal.cut x)"
  2.2590    by (import hreal CUT_NONEMPTY)
  2.2591  
  2.2592 -lemma CUT_BOUNDED: "ALL x. EX xa. ~ hreal.cut x xa"
  2.2593 +lemma CUT_BOUNDED: "ALL x::hreal. EX xa::hrat. ~ hreal.cut x xa"
  2.2594    by (import hreal CUT_BOUNDED)
  2.2595  
  2.2596 -lemma CUT_DOWN: "ALL x xa xb. hreal.cut x xa & hrat_lt xb xa --> hreal.cut x xb"
  2.2597 +lemma CUT_DOWN: "ALL (x::hreal) (xa::hrat) xb::hrat.
  2.2598 +   hreal.cut x xa & hrat_lt xb xa --> hreal.cut x xb"
  2.2599    by (import hreal CUT_DOWN)
  2.2600  
  2.2601 -lemma CUT_UP: "ALL x xa. hreal.cut x xa --> (EX y. hreal.cut x y & hrat_lt xa y)"
  2.2602 +lemma CUT_UP: "ALL (x::hreal) xa::hrat.
  2.2603 +   hreal.cut x xa --> (EX y::hrat. hreal.cut x y & hrat_lt xa y)"
  2.2604    by (import hreal CUT_UP)
  2.2605  
  2.2606 -lemma CUT_UBOUND: "ALL x xa xb. ~ hreal.cut x xa & hrat_lt xa xb --> ~ hreal.cut x xb"
  2.2607 +lemma CUT_UBOUND: "ALL (x::hreal) (xa::hrat) xb::hrat.
  2.2608 +   ~ hreal.cut x xa & hrat_lt xa xb --> ~ hreal.cut x xb"
  2.2609    by (import hreal CUT_UBOUND)
  2.2610  
  2.2611 -lemma CUT_STRADDLE: "ALL X x y. hreal.cut X x & ~ hreal.cut X y --> hrat_lt x y"
  2.2612 +lemma CUT_STRADDLE: "ALL (X::hreal) (x::hrat) y::hrat.
  2.2613 +   hreal.cut X x & ~ hreal.cut X y --> hrat_lt x y"
  2.2614    by (import hreal CUT_STRADDLE)
  2.2615  
  2.2616 -lemma CUT_NEARTOP_ADD: "ALL X e. EX x. hreal.cut X x & ~ hreal.cut X (hrat_add x e)"
  2.2617 +lemma CUT_NEARTOP_ADD: "ALL (X::hreal) e::hrat.
  2.2618 +   EX x::hrat. hreal.cut X x & ~ hreal.cut X (hrat_add x e)"
  2.2619    by (import hreal CUT_NEARTOP_ADD)
  2.2620  
  2.2621 -lemma CUT_NEARTOP_MUL: "ALL X u.
  2.2622 -   hrat_lt hrat_1 u --> (EX x. hreal.cut X x & ~ hreal.cut X (hrat_mul u x))"
  2.2623 +lemma CUT_NEARTOP_MUL: "ALL (X::hreal) u::hrat.
  2.2624 +   hrat_lt hrat_1 u -->
  2.2625 +   (EX x::hrat. hreal.cut X x & ~ hreal.cut X (hrat_mul u x))"
  2.2626    by (import hreal CUT_NEARTOP_MUL)
  2.2627  
  2.2628  constdefs
  2.2629 @@ -1867,128 +2193,170 @@
  2.2630  constdefs
  2.2631    hreal_add :: "hreal => hreal => hreal" 
  2.2632    "hreal_add ==
  2.2633 -%X Y. hreal (%w. EX x y. w = hrat_add x y & hreal.cut X x & hreal.cut Y y)"
  2.2634 -
  2.2635 -lemma hreal_add: "ALL X Y.
  2.2636 +%(X::hreal) Y::hreal.
  2.2637 +   hreal
  2.2638 +    (%w::hrat.
  2.2639 +        EX (x::hrat) y::hrat.
  2.2640 +           w = hrat_add x y & hreal.cut X x & hreal.cut Y y)"
  2.2641 +
  2.2642 +lemma hreal_add: "ALL (X::hreal) Y::hreal.
  2.2643     hreal_add X Y =
  2.2644 -   hreal (%w. EX x y. w = hrat_add x y & hreal.cut X x & hreal.cut Y y)"
  2.2645 +   hreal
  2.2646 +    (%w::hrat.
  2.2647 +        EX (x::hrat) y::hrat.
  2.2648 +           w = hrat_add x y & hreal.cut X x & hreal.cut Y y)"
  2.2649    by (import hreal hreal_add)
  2.2650  
  2.2651  constdefs
  2.2652    hreal_mul :: "hreal => hreal => hreal" 
  2.2653    "hreal_mul ==
  2.2654 -%X Y. hreal (%w. EX x y. w = hrat_mul x y & hreal.cut X x & hreal.cut Y y)"
  2.2655 -
  2.2656 -lemma hreal_mul: "ALL X Y.
  2.2657 +%(X::hreal) Y::hreal.
  2.2658 +   hreal
  2.2659 +    (%w::hrat.
  2.2660 +        EX (x::hrat) y::hrat.
  2.2661 +           w = hrat_mul x y & hreal.cut X x & hreal.cut Y y)"
  2.2662 +
  2.2663 +lemma hreal_mul: "ALL (X::hreal) Y::hreal.
  2.2664     hreal_mul X Y =
  2.2665 -   hreal (%w. EX x y. w = hrat_mul x y & hreal.cut X x & hreal.cut Y y)"
  2.2666 +   hreal
  2.2667 +    (%w::hrat.
  2.2668 +        EX (x::hrat) y::hrat.
  2.2669 +           w = hrat_mul x y & hreal.cut X x & hreal.cut Y y)"
  2.2670    by (import hreal hreal_mul)
  2.2671  
  2.2672  constdefs
  2.2673    hreal_inv :: "hreal => hreal" 
  2.2674    "hreal_inv ==
  2.2675 -%X. hreal
  2.2676 -     (%w. EX d. hrat_lt d hrat_1 &
  2.2677 -                (ALL x. hreal.cut X x --> hrat_lt (hrat_mul w x) d))"
  2.2678 -
  2.2679 -lemma hreal_inv: "ALL X.
  2.2680 +%X::hreal.
  2.2681 +   hreal
  2.2682 +    (%w::hrat.
  2.2683 +        EX d::hrat.
  2.2684 +           hrat_lt d hrat_1 &
  2.2685 +           (ALL x::hrat. hreal.cut X x --> hrat_lt (hrat_mul w x) d))"
  2.2686 +
  2.2687 +lemma hreal_inv: "ALL X::hreal.
  2.2688     hreal_inv X =
  2.2689     hreal
  2.2690 -    (%w. EX d. hrat_lt d hrat_1 &
  2.2691 -               (ALL x. hreal.cut X x --> hrat_lt (hrat_mul w x) d))"
  2.2692 +    (%w::hrat.
  2.2693 +        EX d::hrat.
  2.2694 +           hrat_lt d hrat_1 &
  2.2695 +           (ALL x::hrat. hreal.cut X x --> hrat_lt (hrat_mul w x) d))"
  2.2696    by (import hreal hreal_inv)
  2.2697  
  2.2698  constdefs
  2.2699    hreal_sup :: "(hreal => bool) => hreal" 
  2.2700 -  "hreal_sup == %P. hreal (%w. EX X. P X & hreal.cut X w)"
  2.2701 -
  2.2702 -lemma hreal_sup: "ALL P. hreal_sup P = hreal (%w. EX X. P X & hreal.cut X w)"
  2.2703 +  "hreal_sup ==
  2.2704 +%P::hreal => bool. hreal (%w::hrat. EX X::hreal. P X & hreal.cut X w)"
  2.2705 +
  2.2706 +lemma hreal_sup: "ALL P::hreal => bool.
  2.2707 +   hreal_sup P = hreal (%w::hrat. EX X::hreal. P X & hreal.cut X w)"
  2.2708    by (import hreal hreal_sup)
  2.2709  
  2.2710  constdefs
  2.2711    hreal_lt :: "hreal => hreal => bool" 
  2.2712 -  "hreal_lt == %X Y. X ~= Y & (ALL x. hreal.cut X x --> hreal.cut Y x)"
  2.2713 -
  2.2714 -lemma hreal_lt: "ALL X Y. hreal_lt X Y = (X ~= Y & (ALL x. hreal.cut X x --> hreal.cut Y x))"
  2.2715 +  "hreal_lt ==
  2.2716 +%(X::hreal) Y::hreal.
  2.2717 +   X ~= Y & (ALL x::hrat. hreal.cut X x --> hreal.cut Y x)"
  2.2718 +
  2.2719 +lemma hreal_lt: "ALL (X::hreal) Y::hreal.
  2.2720 +   hreal_lt X Y = (X ~= Y & (ALL x::hrat. hreal.cut X x --> hreal.cut Y x))"
  2.2721    by (import hreal hreal_lt)
  2.2722  
  2.2723 -lemma HREAL_INV_ISACUT: "ALL X.
  2.2724 +lemma HREAL_INV_ISACUT: "ALL X::hreal.
  2.2725     isacut
  2.2726 -    (%w. EX d. hrat_lt d hrat_1 &
  2.2727 -               (ALL x. hreal.cut X x --> hrat_lt (hrat_mul w x) d))"
  2.2728 +    (%w::hrat.
  2.2729 +        EX d::hrat.
  2.2730 +           hrat_lt d hrat_1 &
  2.2731 +           (ALL x::hrat. hreal.cut X x --> hrat_lt (hrat_mul w x) d))"
  2.2732    by (import hreal HREAL_INV_ISACUT)
  2.2733  
  2.2734 -lemma HREAL_ADD_ISACUT: "ALL X Y.
  2.2735 -   isacut (%w. EX x y. w = hrat_add x y & hreal.cut X x & hreal.cut Y y)"
  2.2736 +lemma HREAL_ADD_ISACUT: "ALL (X::hreal) Y::hreal.
  2.2737 +   isacut
  2.2738 +    (%w::hrat.
  2.2739 +        EX (x::hrat) y::hrat.
  2.2740 +           w = hrat_add x y & hreal.cut X x & hreal.cut Y y)"
  2.2741    by (import hreal HREAL_ADD_ISACUT)
  2.2742  
  2.2743 -lemma HREAL_MUL_ISACUT: "ALL X Y.
  2.2744 -   isacut (%w. EX x y. w = hrat_mul x y & hreal.cut X x & hreal.cut Y y)"
  2.2745 +lemma HREAL_MUL_ISACUT: "ALL (X::hreal) Y::hreal.
  2.2746 +   isacut
  2.2747 +    (%w::hrat.
  2.2748 +        EX (x::hrat) y::hrat.
  2.2749 +           w = hrat_mul x y & hreal.cut X x & hreal.cut Y y)"
  2.2750    by (import hreal HREAL_MUL_ISACUT)
  2.2751  
  2.2752 -lemma HREAL_ADD_SYM: "ALL X Y. hreal_add X Y = hreal_add Y X"
  2.2753 +lemma HREAL_ADD_SYM: "ALL (X::hreal) Y::hreal. hreal_add X Y = hreal_add Y X"
  2.2754    by (import hreal HREAL_ADD_SYM)
  2.2755  
  2.2756 -lemma HREAL_MUL_SYM: "ALL X Y. hreal_mul X Y = hreal_mul Y X"
  2.2757 +lemma HREAL_MUL_SYM: "ALL (X::hreal) Y::hreal. hreal_mul X Y = hreal_mul Y X"
  2.2758    by (import hreal HREAL_MUL_SYM)
  2.2759  
  2.2760 -lemma HREAL_ADD_ASSOC: "ALL X Y Z. hreal_add X (hreal_add Y Z) = hreal_add (hreal_add X Y) Z"
  2.2761 +lemma HREAL_ADD_ASSOC: "ALL (X::hreal) (Y::hreal) Z::hreal.
  2.2762 +   hreal_add X (hreal_add Y Z) = hreal_add (hreal_add X Y) Z"
  2.2763    by (import hreal HREAL_ADD_ASSOC)
  2.2764  
  2.2765 -lemma HREAL_MUL_ASSOC: "ALL X Y Z. hreal_mul X (hreal_mul Y Z) = hreal_mul (hreal_mul X Y) Z"
  2.2766 +lemma HREAL_MUL_ASSOC: "ALL (X::hreal) (Y::hreal) Z::hreal.
  2.2767 +   hreal_mul X (hreal_mul Y Z) = hreal_mul (hreal_mul X Y) Z"
  2.2768    by (import hreal HREAL_MUL_ASSOC)
  2.2769  
  2.2770 -lemma HREAL_LDISTRIB: "ALL X Y Z.
  2.2771 +lemma HREAL_LDISTRIB: "ALL (X::hreal) (Y::hreal) Z::hreal.
  2.2772     hreal_mul X (hreal_add Y Z) = hreal_add (hreal_mul X Y) (hreal_mul X Z)"
  2.2773    by (import hreal HREAL_LDISTRIB)
  2.2774  
  2.2775 -lemma HREAL_MUL_LID: "ALL X. hreal_mul hreal_1 X = X"
  2.2776 +lemma HREAL_MUL_LID: "ALL X::hreal. hreal_mul hreal_1 X = X"
  2.2777    by (import hreal HREAL_MUL_LID)
  2.2778  
  2.2779 -lemma HREAL_MUL_LINV: "ALL X. hreal_mul (hreal_inv X) X = hreal_1"
  2.2780 +lemma HREAL_MUL_LINV: "ALL X::hreal. hreal_mul (hreal_inv X) X = hreal_1"
  2.2781    by (import hreal HREAL_MUL_LINV)
  2.2782  
  2.2783 -lemma HREAL_NOZERO: "ALL X Y. hreal_add X Y ~= X"
  2.2784 +lemma HREAL_NOZERO: "ALL (X::hreal) Y::hreal. hreal_add X Y ~= X"
  2.2785    by (import hreal HREAL_NOZERO)
  2.2786  
  2.2787  constdefs
  2.2788    hreal_sub :: "hreal => hreal => hreal" 
  2.2789    "hreal_sub ==
  2.2790 -%Y X. hreal (%w. EX x. ~ hreal.cut X x & hreal.cut Y (hrat_add x w))"
  2.2791 -
  2.2792 -lemma hreal_sub: "ALL Y X.
  2.2793 +%(Y::hreal) X::hreal.
  2.2794 +   hreal
  2.2795 +    (%w::hrat. EX x::hrat. ~ hreal.cut X x & hreal.cut Y (hrat_add x w))"
  2.2796 +
  2.2797 +lemma hreal_sub: "ALL (Y::hreal) X::hreal.
  2.2798     hreal_sub Y X =
  2.2799 -   hreal (%w. EX x. ~ hreal.cut X x & hreal.cut Y (hrat_add x w))"
  2.2800 +   hreal
  2.2801 +    (%w::hrat. EX x::hrat. ~ hreal.cut X x & hreal.cut Y (hrat_add x w))"
  2.2802    by (import hreal hreal_sub)
  2.2803  
  2.2804 -lemma HREAL_LT_LEMMA: "ALL X Y. hreal_lt X Y --> (EX x. ~ hreal.cut X x & hreal.cut Y x)"
  2.2805 +lemma HREAL_LT_LEMMA: "ALL (X::hreal) Y::hreal.
  2.2806 +   hreal_lt X Y --> (EX x::hrat. ~ hreal.cut X x & hreal.cut Y x)"
  2.2807    by (import hreal HREAL_LT_LEMMA)
  2.2808  
  2.2809 -lemma HREAL_SUB_ISACUT: "ALL X Y.
  2.2810 +lemma HREAL_SUB_ISACUT: "ALL (X::hreal) Y::hreal.
  2.2811     hreal_lt X Y -->
  2.2812 -   isacut (%w. EX x. ~ hreal.cut X x & hreal.cut Y (hrat_add x w))"
  2.2813 +   isacut
  2.2814 +    (%w::hrat. EX x::hrat. ~ hreal.cut X x & hreal.cut Y (hrat_add x w))"
  2.2815    by (import hreal HREAL_SUB_ISACUT)
  2.2816  
  2.2817 -lemma HREAL_SUB_ADD: "ALL X Y. hreal_lt X Y --> hreal_add (hreal_sub Y X) X = Y"
  2.2818 +lemma HREAL_SUB_ADD: "ALL (X::hreal) Y::hreal. hreal_lt X Y --> hreal_add (hreal_sub Y X) X = Y"
  2.2819    by (import hreal HREAL_SUB_ADD)
  2.2820  
  2.2821 -lemma HREAL_LT_TOTAL: "ALL X Y. X = Y | hreal_lt X Y | hreal_lt Y X"
  2.2822 +lemma HREAL_LT_TOTAL: "ALL (X::hreal) Y::hreal. X = Y | hreal_lt X Y | hreal_lt Y X"
  2.2823    by (import hreal HREAL_LT_TOTAL)
  2.2824  
  2.2825 -lemma HREAL_LT: "ALL X Y. hreal_lt X Y = (EX D. Y = hreal_add X D)"
  2.2826 +lemma HREAL_LT: "ALL (X::hreal) Y::hreal. hreal_lt X Y = (EX D::hreal. Y = hreal_add X D)"
  2.2827    by (import hreal HREAL_LT)
  2.2828  
  2.2829 -lemma HREAL_ADD_TOTAL: "ALL X Y. X = Y | (EX D. Y = hreal_add X D) | (EX D. X = hreal_add Y D)"
  2.2830 +lemma HREAL_ADD_TOTAL: "ALL (X::hreal) Y::hreal.
  2.2831 +   X = Y |
  2.2832 +   (EX D::hreal. Y = hreal_add X D) | (EX D::hreal. X = hreal_add Y D)"
  2.2833    by (import hreal HREAL_ADD_TOTAL)
  2.2834  
  2.2835 -lemma HREAL_SUP_ISACUT: "ALL P.
  2.2836 -   Ex P & (EX Y. ALL X. P X --> hreal_lt X Y) -->
  2.2837 -   isacut (%w. EX X. P X & hreal.cut X w)"
  2.2838 +lemma HREAL_SUP_ISACUT: "ALL P::hreal => bool.
  2.2839 +   Ex P & (EX Y::hreal. ALL X::hreal. P X --> hreal_lt X Y) -->
  2.2840 +   isacut (%w::hrat. EX X::hreal. P X & hreal.cut X w)"
  2.2841    by (import hreal HREAL_SUP_ISACUT)
  2.2842  
  2.2843 -lemma HREAL_SUP: "ALL P.
  2.2844 -   Ex P & (EX Y. ALL X. P X --> hreal_lt X Y) -->
  2.2845 -   (ALL Y. (EX X. P X & hreal_lt Y X) = hreal_lt Y (hreal_sup P))"
  2.2846 +lemma HREAL_SUP: "ALL P::hreal => bool.
  2.2847 +   Ex P & (EX Y::hreal. ALL X::hreal. P X --> hreal_lt X Y) -->
  2.2848 +   (ALL Y::hreal.
  2.2849 +       (EX X::hreal. P X & hreal_lt Y X) = hreal_lt Y (hreal_sup P))"
  2.2850    by (import hreal HREAL_SUP)
  2.2851  
  2.2852  ;end_setup
  2.2853 @@ -1996,22 +2364,22 @@
  2.2854  ;setup_theory numeral
  2.2855  
  2.2856  lemma numeral_suc: "Suc ALT_ZERO = NUMERAL_BIT1 ALT_ZERO &
  2.2857 -(ALL x. Suc (NUMERAL_BIT1 x) = NUMERAL_BIT2 x) &
  2.2858 -(ALL x. Suc (NUMERAL_BIT2 x) = NUMERAL_BIT1 (Suc x))"
  2.2859 +(ALL x::nat. Suc (NUMERAL_BIT1 x) = NUMERAL_BIT2 x) &
  2.2860 +(ALL x::nat. Suc (NUMERAL_BIT2 x) = NUMERAL_BIT1 (Suc x))"
  2.2861    by (import numeral numeral_suc)
  2.2862  
  2.2863  constdefs
  2.2864    iZ :: "nat => nat" 
  2.2865 -  "iZ == %x. x"
  2.2866 -
  2.2867 -lemma iZ: "ALL x. iZ x = x"
  2.2868 +  "iZ == %x::nat. x"
  2.2869 +
  2.2870 +lemma iZ: "ALL x::nat. iZ x = x"
  2.2871    by (import numeral iZ)
  2.2872  
  2.2873  constdefs
  2.2874    iiSUC :: "nat => nat" 
  2.2875 -  "iiSUC == %n. Suc (Suc n)"
  2.2876 -
  2.2877 -lemma iiSUC: "ALL n. iiSUC n = Suc (Suc n)"
  2.2878 +  "iiSUC == %n::nat. Suc (Suc n)"
  2.2879 +
  2.2880 +lemma iiSUC: "ALL n::nat. iiSUC n = Suc (Suc n)"
  2.2881    by (import numeral iiSUC)
  2.2882  
  2.2883  lemma numeral_distrib: "(ALL x::nat. (0::nat) + x = x) &
  2.2884 @@ -2051,11 +2419,11 @@
  2.2885    by (import numeral numeral_distrib)
  2.2886  
  2.2887  lemma numeral_iisuc: "iiSUC ALT_ZERO = NUMERAL_BIT2 ALT_ZERO &
  2.2888 -iiSUC (NUMERAL_BIT1 n) = NUMERAL_BIT1 (Suc n) &
  2.2889 +iiSUC (NUMERAL_BIT1 (n::nat)) = NUMERAL_BIT1 (Suc n) &
  2.2890  iiSUC (NUMERAL_BIT2 n) = NUMERAL_BIT2 (Suc n)"
  2.2891    by (import numeral numeral_iisuc)
  2.2892  
  2.2893 -lemma numeral_add: "ALL x xa.
  2.2894 +lemma numeral_add: "ALL (x::nat) xa::nat.
  2.2895     iZ (ALT_ZERO + x) = x &
  2.2896     iZ (x + ALT_ZERO) = x &
  2.2897     iZ (NUMERAL_BIT1 x + NUMERAL_BIT1 xa) = NUMERAL_BIT2 (iZ (x + xa)) &
  2.2898 @@ -2078,7 +2446,7 @@
  2.2899     iiSUC (NUMERAL_BIT2 x + NUMERAL_BIT2 xa) = NUMERAL_BIT2 (iiSUC (x + xa))"
  2.2900    by (import numeral numeral_add)
  2.2901  
  2.2902 -lemma numeral_eq: "ALL x xa.
  2.2903 +lemma numeral_eq: "ALL (x::nat) xa::nat.
  2.2904     (ALT_ZERO = NUMERAL_BIT1 x) = False &
  2.2905     (NUMERAL_BIT1 x = ALT_ZERO) = False &
  2.2906     (ALT_ZERO = NUMERAL_BIT2 x) = False &
  2.2907 @@ -2089,7 +2457,7 @@
  2.2908     (NUMERAL_BIT2 x = NUMERAL_BIT2 xa) = (x = xa)"
  2.2909    by (import numeral numeral_eq)
  2.2910  
  2.2911 -lemma numeral_lt: "ALL x xa.
  2.2912 +lemma numeral_lt: "ALL (x::nat) xa::nat.
  2.2913     (ALT_ZERO < NUMERAL_BIT1 x) = True &
  2.2914     (ALT_ZERO < NUMERAL_BIT2 x) = True &
  2.2915     (x < ALT_ZERO) = False &
  2.2916 @@ -2099,7 +2467,7 @@
  2.2917     (NUMERAL_BIT2 x < NUMERAL_BIT1 xa) = (x < xa)"
  2.2918    by (import numeral numeral_lt)
  2.2919  
  2.2920 -lemma numeral_lte: "ALL x xa.
  2.2921 +lemma numeral_lte: "ALL (x::nat) xa::nat.
  2.2922     (ALT_ZERO <= x) = True &
  2.2923     (NUMERAL_BIT1 x <= ALT_ZERO) = False &
  2.2924     (NUMERAL_BIT2 x <= ALT_ZERO) = False &
  2.2925 @@ -2111,67 +2479,70 @@
  2.2926  
  2.2927  lemma numeral_pre: "PRE ALT_ZERO = ALT_ZERO &
  2.2928  PRE (NUMERAL_BIT1 ALT_ZERO) = ALT_ZERO &
  2.2929 -(ALL x.
  2.2930 +(ALL x::nat.
  2.2931      PRE (NUMERAL_BIT1 (NUMERAL_BIT1 x)) =
  2.2932      NUMERAL_BIT2 (PRE (NUMERAL_BIT1 x))) &
  2.2933 -(ALL x.
  2.2934 +(ALL x::nat.
  2.2935      PRE (NUMERAL_BIT1 (NUMERAL_BIT2 x)) = NUMERAL_BIT2 (NUMERAL_BIT1 x)) &
  2.2936 -(ALL x. PRE (NUMERAL_BIT2 x) = NUMERAL_BIT1 x)"
  2.2937 +(ALL x::nat. PRE (NUMERAL_BIT2 x) = NUMERAL_BIT1 x)"
  2.2938    by (import numeral numeral_pre)
  2.2939  
  2.2940 -lemma bit_initiality: "ALL zf b1f b2f.
  2.2941 -   EX x. x ALT_ZERO = zf &
  2.2942 -         (ALL n. x (NUMERAL_BIT1 n) = b1f n (x n)) &
  2.2943 -         (ALL n. x (NUMERAL_BIT2 n) = b2f n (x n))"
  2.2944 +lemma bit_initiality: "ALL (zf::'a::type) (b1f::nat => 'a::type => 'a::type)
  2.2945 +   b2f::nat => 'a::type => 'a::type.
  2.2946 +   EX x::nat => 'a::type.
  2.2947 +      x ALT_ZERO = zf &
  2.2948 +      (ALL n::nat. x (NUMERAL_BIT1 n) = b1f n (x n)) &
  2.2949 +      (ALL n::nat. x (NUMERAL_BIT2 n) = b2f n (x n))"
  2.2950    by (import numeral bit_initiality)
  2.2951  
  2.2952  consts
  2.2953 -  iBIT_cases :: "nat => 'a => (nat => 'a) => (nat => 'a) => 'a" 
  2.2954 -
  2.2955 -specification (iBIT_cases) iBIT_cases: "(ALL (zf::'a) (bf1::nat => 'a) bf2::nat => 'a.
  2.2956 +  iBIT_cases :: "nat => 'a::type => (nat => 'a::type) => (nat => 'a::type) => 'a::type" 
  2.2957 +
  2.2958 +specification (iBIT_cases) iBIT_cases: "(ALL (zf::'a::type) (bf1::nat => 'a::type) bf2::nat => 'a::type.
  2.2959      iBIT_cases ALT_ZERO zf bf1 bf2 = zf) &
  2.2960 -(ALL (n::nat) (zf::'a) (bf1::nat => 'a) bf2::nat => 'a.
  2.2961 +(ALL (n::nat) (zf::'a::type) (bf1::nat => 'a::type) bf2::nat => 'a::type.
  2.2962      iBIT_cases (NUMERAL_BIT1 n) zf bf1 bf2 = bf1 n) &
  2.2963 -(ALL (n::nat) (zf::'a) (bf1::nat => 'a) bf2::nat => 'a.
  2.2964 +(ALL (n::nat) (zf::'a::type) (bf1::nat => 'a::type) bf2::nat => 'a::type.
  2.2965      iBIT_cases (NUMERAL_BIT2 n) zf bf1 bf2 = bf2 n)"
  2.2966    by (import numeral iBIT_cases)
  2.2967  
  2.2968  constdefs
  2.2969    iDUB :: "nat => nat" 
  2.2970 -  "iDUB == %x. x + x"
  2.2971 -
  2.2972 -lemma iDUB: "ALL x. iDUB x = x + x"
  2.2973 +  "iDUB == %x::nat. x + x"
  2.2974 +
  2.2975 +lemma iDUB: "ALL x::nat. iDUB x = x + x"
  2.2976    by (import numeral iDUB)
  2.2977  
  2.2978  consts
  2.2979    iSUB :: "bool => nat => nat => nat" 
  2.2980  
  2.2981 -specification (iSUB) iSUB_DEF: "(ALL b x. iSUB b ALT_ZERO x = ALT_ZERO) &
  2.2982 -(ALL b n x.
  2.2983 +specification (iSUB) iSUB_DEF: "(ALL (b::bool) x::nat. iSUB b ALT_ZERO x = ALT_ZERO) &
  2.2984 +(ALL (b::bool) (n::nat) x::nat.
  2.2985      iSUB b (NUMERAL_BIT1 n) x =
  2.2986      (if b
  2.2987 -     then iBIT_cases x (NUMERAL_BIT1 n) (%m. iDUB (iSUB True n m))
  2.2988 -           (%m. NUMERAL_BIT1 (iSUB False n m))
  2.2989 -     else iBIT_cases x (iDUB n) (%m. NUMERAL_BIT1 (iSUB False n m))
  2.2990 -           (%m. iDUB (iSUB False n m)))) &
  2.2991 -(ALL b n x.
  2.2992 +     then iBIT_cases x (NUMERAL_BIT1 n) (%m::nat. iDUB (iSUB True n m))
  2.2993 +           (%m::nat. NUMERAL_BIT1 (iSUB False n m))
  2.2994 +     else iBIT_cases x (iDUB n) (%m::nat. NUMERAL_BIT1 (iSUB False n m))
  2.2995 +           (%m::nat. iDUB (iSUB False n m)))) &
  2.2996 +(ALL (b::bool) (n::nat) x::nat.
  2.2997      iSUB b (NUMERAL_BIT2 n) x =
  2.2998      (if b
  2.2999 -     then iBIT_cases x (NUMERAL_BIT2 n) (%m. NUMERAL_BIT1 (iSUB True n m))
  2.3000 -           (%m. iDUB (iSUB True n m))
  2.3001 -     else iBIT_cases x (NUMERAL_BIT1 n) (%m. iDUB (iSUB True n m))
  2.3002 -           (%m. NUMERAL_BIT1 (iSUB False n m))))"
  2.3003 +     then iBIT_cases x (NUMERAL_BIT2 n)
  2.3004 +           (%m::nat. NUMERAL_BIT1 (iSUB True n m))
  2.3005 +           (%m::nat. iDUB (iSUB True n m))
  2.3006 +     else iBIT_cases x (NUMERAL_BIT1 n) (%m::nat. iDUB (iSUB True n m))
  2.3007 +           (%m::nat. NUMERAL_BIT1 (iSUB False n m))))"
  2.3008    by (import numeral iSUB_DEF)
  2.3009  
  2.3010 -lemma bit_induction: "ALL P.
  2.3011 +lemma bit_induction: "ALL P::nat => bool.
  2.3012     P ALT_ZERO &
  2.3013 -   (ALL n. P n --> P (NUMERAL_BIT1 n)) &
  2.3014 -   (ALL n. P n --> P (NUMERAL_BIT2 n)) -->
  2.3015 +   (ALL n::nat. P n --> P (NUMERAL_BIT1 n)) &
  2.3016 +   (ALL n::nat. P n --> P (NUMERAL_BIT2 n)) -->
  2.3017     All P"
  2.3018    by (import numeral bit_induction)
  2.3019  
  2.3020 -lemma iSUB_THM: "ALL xa xb xc.
  2.3021 -   iSUB xa ALT_ZERO x = ALT_ZERO &
  2.3022 +lemma iSUB_THM: "ALL (xa::bool) (xb::nat) xc::nat.
  2.3023 +   iSUB xa ALT_ZERO (x::nat) = ALT_ZERO &
  2.3024     iSUB True xb ALT_ZERO = xb &
  2.3025     iSUB False (NUMERAL_BIT1 xb) ALT_ZERO = iDUB xb &
  2.3026     iSUB True (NUMERAL_BIT1 xb) (NUMERAL_BIT1 xc) = iDUB (iSUB True xb xc) &
  2.3027 @@ -2190,17 +2561,26 @@
  2.3028     NUMERAL_BIT1 (iSUB False xb xc)"
  2.3029    by (import numeral iSUB_THM)
  2.3030  
  2.3031 -lemma numeral_sub: "ALL x xa.
  2.3032 -   NUMERAL (x - xa) = (if xa < x then NUMERAL (iSUB True x xa) else 0)"
  2.3033 +lemma numeral_sub: "(All::(nat => bool) => bool)
  2.3034 + (%x::nat.
  2.3035 +     (All::(nat => bool) => bool)
  2.3036 +      (%xa::nat.
  2.3037 +          (op =::nat => nat => bool)
  2.3038 +           ((NUMERAL::nat => nat) ((op -::nat => nat => nat) x xa))
  2.3039 +           ((If::bool => nat => nat => nat)
  2.3040 +             ((op <::nat => nat => bool) xa x)
  2.3041 +             ((NUMERAL::nat => nat)
  2.3042 +               ((iSUB::bool => nat => nat => nat) (True::bool) x xa))
  2.3043 +             (0::nat))))"
  2.3044    by (import numeral numeral_sub)
  2.3045  
  2.3046 -lemma iDUB_removal: "ALL x.
  2.3047 +lemma iDUB_removal: "ALL x::nat.
  2.3048     iDUB (NUMERAL_BIT1 x) = NUMERAL_BIT2 (iDUB x) &
  2.3049     iDUB (NUMERAL_BIT2 x) = NUMERAL_BIT2 (NUMERAL_BIT1 x) &
  2.3050     iDUB ALT_ZERO = ALT_ZERO"
  2.3051    by (import numeral iDUB_removal)
  2.3052  
  2.3053 -lemma numeral_mult: "ALL x xa.
  2.3054 +lemma numeral_mult: "ALL (x::nat) xa::nat.
  2.3055     ALT_ZERO * x = ALT_ZERO &
  2.3056     x * ALT_ZERO = ALT_ZERO &
  2.3057     NUMERAL_BIT1 x * xa = iZ (iDUB (x * xa) + xa) &
  2.3058 @@ -2209,265 +2589,316 @@
  2.3059  
  2.3060  constdefs
  2.3061    iSQR :: "nat => nat" 
  2.3062 -  "iSQR == %x. x * x"
  2.3063 -
  2.3064 -lemma iSQR: "ALL x. iSQR x = x * x"
  2.3065 +  "iSQR == %x::nat. x * x"
  2.3066 +
  2.3067 +lemma iSQR: "ALL x::nat. iSQR x = x * x"
  2.3068    by (import numeral iSQR)
  2.3069  
  2.3070 -lemma numeral_exp: "(ALL x. x ^ ALT_ZERO = NUMERAL_BIT1 ALT_ZERO) &
  2.3071 -(ALL x xa. x ^ NUMERAL_BIT1 xa = x * iSQR (x ^ xa)) &
  2.3072 -(ALL x xa. x ^ NUMERAL_BIT2 xa = iSQR x * iSQR (x ^ xa))"
  2.3073 +lemma numeral_exp: "(ALL x::nat. x ^ ALT_ZERO = NUMERAL_BIT1 ALT_ZERO) &
  2.3074 +(ALL (x::nat) xa::nat. x ^ NUMERAL_BIT1 xa = x * iSQR (x ^ xa)) &
  2.3075 +(ALL (x::nat) xa::nat. x ^ NUMERAL_BIT2 xa = iSQR x * iSQR (x ^ xa))"
  2.3076    by (import numeral numeral_exp)
  2.3077  
  2.3078 -lemma numeral_evenodd: "ALL x.
  2.3079 +lemma numeral_evenodd: "ALL x::nat.
  2.3080     EVEN ALT_ZERO &
  2.3081     EVEN (NUMERAL_BIT2 x) &
  2.3082     ~ EVEN (NUMERAL_BIT1 x) &
  2.3083     ~ ODD ALT_ZERO & ~ ODD (NUMERAL_BIT2 x) & ODD (NUMERAL_BIT1 x)"
  2.3084    by (import numeral numeral_evenodd)
  2.3085  
  2.3086 -lemma numeral_fact: "ALL n. FACT n = (if n = 0 then 1 else n * FACT (PRE n))"
  2.3087 +lemma numeral_fact: "ALL n::nat. FACT n = (if n = (0::nat) then 1::nat else n * FACT (PRE n))"
  2.3088    by (import numeral numeral_fact)
  2.3089  
  2.3090 -lemma numeral_funpow: "ALL n. (f ^ n) x = (if n = 0 then x else (f ^ (n - 1)) (f x))"
  2.3091 +lemma numeral_funpow: "ALL n::nat.
  2.3092 +   ((f::'a::type => 'a::type) ^ n) (x::'a::type) =
  2.3093 +   (if n = (0::nat) then x else (f ^ (n - (1::nat))) (f x))"
  2.3094    by (import numeral numeral_funpow)
  2.3095  
  2.3096  ;end_setup
  2.3097  
  2.3098  ;setup_theory ind_type
  2.3099  
  2.3100 -lemma INJ_INVERSE2: "ALL P::'A => 'B => 'C.
  2.3101 -   (ALL (x1::'A) (y1::'B) (x2::'A) y2::'B.
  2.3102 +lemma INJ_INVERSE2: "ALL P::'A::type => 'B::type => 'C::type.
  2.3103 +   (ALL (x1::'A::type) (y1::'B::type) (x2::'A::type) y2::'B::type.
  2.3104         (P x1 y1 = P x2 y2) = (x1 = x2 & y1 = y2)) -->
  2.3105 -   (EX (x::'C => 'A) Y::'C => 'B.
  2.3106 -       ALL (xa::'A) y::'B. x (P xa y) = xa & Y (P xa y) = y)"
  2.3107 +   (EX (x::'C::type => 'A::type) Y::'C::type => 'B::type.
  2.3108 +       ALL (xa::'A::type) y::'B::type. x (P xa y) = xa & Y (P xa y) = y)"
  2.3109    by (import ind_type INJ_INVERSE2)
  2.3110  
  2.3111  constdefs
  2.3112    NUMPAIR :: "nat => nat => nat" 
  2.3113 -  "NUMPAIR == %x y. 2 ^ x * (2 * y + 1)"
  2.3114 -
  2.3115 -lemma NUMPAIR: "ALL x y. NUMPAIR x y = 2 ^ x * (2 * y + 1)"
  2.3116 +  "NUMPAIR == %(x::nat) y::nat. (2::nat) ^ x * ((2::nat) * y + (1::nat))"
  2.3117 +
  2.3118 +lemma NUMPAIR: "ALL (x::nat) y::nat. NUMPAIR x y = (2::nat) ^ x * ((2::nat) * y + (1::nat))"
  2.3119    by (import ind_type NUMPAIR)
  2.3120  
  2.3121 -lemma NUMPAIR_INJ_LEMMA: "ALL x xa xb xc. NUMPAIR x xa = NUMPAIR xb xc --> x = xb"
  2.3122 +lemma NUMPAIR_INJ_LEMMA: "ALL (x::nat) (xa::nat) (xb::nat) xc::nat.
  2.3123 +   NUMPAIR x xa = NUMPAIR xb xc --> x = xb"
  2.3124    by (import ind_type NUMPAIR_INJ_LEMMA)
  2.3125  
  2.3126 -lemma NUMPAIR_INJ: "ALL x1 y1 x2 y2. (NUMPAIR x1 y1 = NUMPAIR x2 y2) = (x1 = x2 & y1 = y2)"
  2.3127 +lemma NUMPAIR_INJ: "ALL (x1::nat) (y1::nat) (x2::nat) y2::nat.
  2.3128 +   (NUMPAIR x1 y1 = NUMPAIR x2 y2) = (x1 = x2 & y1 = y2)"
  2.3129    by (import ind_type NUMPAIR_INJ)
  2.3130  
  2.3131  consts
  2.3132    NUMSND :: "nat => nat" 
  2.3133    NUMFST :: "nat => nat" 
  2.3134  
  2.3135 -specification (NUMFST NUMSND) NUMPAIR_DEST: "ALL x y. NUMFST (NUMPAIR x y) = x & NUMSND (NUMPAIR x y) = y"
  2.3136 +specification (NUMFST NUMSND) NUMPAIR_DEST: "ALL (x::nat) y::nat. NUMFST (NUMPAIR x y) = x & NUMSND (NUMPAIR x y) = y"
  2.3137    by (import ind_type NUMPAIR_DEST)
  2.3138  
  2.3139  constdefs
  2.3140    NUMSUM :: "bool => nat => nat" 
  2.3141 -  "NUMSUM == %b x. if b then Suc (2 * x) else 2 * x"
  2.3142 -
  2.3143 -lemma NUMSUM: "ALL b x. NUMSUM b x = (if b then Suc (2 * x) else 2 * x)"
  2.3144 +  "NUMSUM == %(b::bool) x::nat. if b then Suc ((2::nat) * x) else (2::nat) * x"
  2.3145 +
  2.3146 +lemma NUMSUM: "ALL (b::bool) x::nat.
  2.3147 +   NUMSUM b x = (if b then Suc ((2::nat) * x) else (2::nat) * x)"
  2.3148    by (import ind_type NUMSUM)
  2.3149  
  2.3150 -lemma NUMSUM_INJ: "ALL b1 x1 b2 x2. (NUMSUM b1 x1 = NUMSUM b2 x2) = (b1 = b2 & x1 = x2)"
  2.3151 +lemma NUMSUM_INJ: "ALL (b1::bool) (x1::nat) (b2::bool) x2::nat.
  2.3152 +   (NUMSUM b1 x1 = NUMSUM b2 x2) = (b1 = b2 & x1 = x2)"
  2.3153    by (import ind_type NUMSUM_INJ)
  2.3154  
  2.3155  consts
  2.3156    NUMRIGHT :: "nat => nat" 
  2.3157    NUMLEFT :: "nat => bool" 
  2.3158  
  2.3159 -specification (NUMLEFT NUMRIGHT) NUMSUM_DEST: "ALL x y. NUMLEFT (NUMSUM x y) = x & NUMRIGHT (NUMSUM x y) = y"
  2.3160 +specification (NUMLEFT NUMRIGHT) NUMSUM_DEST: "ALL (x::bool) y::nat. NUMLEFT (NUMSUM x y) = x & NUMRIGHT (NUMSUM x y) = y"
  2.3161    by (import ind_type NUMSUM_DEST)
  2.3162  
  2.3163  constdefs
  2.3164 -  INJN :: "nat => nat => 'a => bool" 
  2.3165 -  "INJN == %m n a. n = m"
  2.3166 -
  2.3167 -lemma INJN: "ALL m. INJN m = (%n a. n = m)"
  2.3168 +  INJN :: "nat => nat => 'a::type => bool" 
  2.3169 +  "INJN == %(m::nat) (n::nat) a::'a::type. n = m"
  2.3170 +
  2.3171 +lemma INJN: "ALL m::nat. INJN m = (%(n::nat) a::'a::type. n = m)"
  2.3172    by (import ind_type INJN)
  2.3173  
  2.3174 -lemma INJN_INJ: "ALL n1 n2. (INJN n1 = INJN n2) = (n1 = n2)"
  2.3175 +lemma INJN_INJ: "ALL (n1::nat) n2::nat. (INJN n1 = INJN n2) = (n1 = n2)"
  2.3176    by (import ind_type INJN_INJ)
  2.3177  
  2.3178  constdefs
  2.3179 -  INJA :: "'a => nat => 'a => bool" 
  2.3180 -  "INJA == %a n b. b = a"
  2.3181 -
  2.3182 -lemma INJA: "ALL a. INJA a = (%n b. b = a)"
  2.3183 +  INJA :: "'a::type => nat => 'a::type => bool" 
  2.3184 +  "INJA == %(a::'a::type) (n::nat) b::'a::type. b = a"
  2.3185 +
  2.3186 +lemma INJA: "ALL a::'a::type. INJA a = (%(n::nat) b::'a::type. b = a)"
  2.3187    by (import ind_type INJA)
  2.3188  
  2.3189 -lemma INJA_INJ: "ALL a1 a2. (INJA a1 = INJA a2) = (a1 = a2)"
  2.3190 +lemma INJA_INJ: "ALL (a1::'a::type) a2::'a::type. (INJA a1 = INJA a2) = (a1 = a2)"
  2.3191    by (import ind_type INJA_INJ)
  2.3192  
  2.3193  constdefs
  2.3194 -  INJF :: "(nat => nat => 'a => bool) => nat => 'a => bool" 
  2.3195 -  "INJF == %f n. f (NUMFST n) (NUMSND n)"
  2.3196 -
  2.3197 -lemma INJF: "ALL f. INJF f = (%n. f (NUMFST n) (NUMSND n))"
  2.3198 +  INJF :: "(nat => nat => 'a::type => bool) => nat => 'a::type => bool" 
  2.3199 +  "INJF == %(f::nat => nat => 'a::type => bool) n::nat. f (NUMFST n) (NUMSND n)"
  2.3200 +
  2.3201 +lemma INJF: "ALL f::nat => nat => 'a::type => bool.
  2.3202 +   INJF f = (%n::nat. f (NUMFST n) (NUMSND n))"
  2.3203    by (import ind_type INJF)
  2.3204  
  2.3205 -lemma INJF_INJ: "ALL f1 f2. (INJF f1 = INJF f2) = (f1 = f2)"
  2.3206 +lemma INJF_INJ: "ALL (f1::nat => nat => 'a::type => bool) f2::nat => nat => 'a::type => bool.
  2.3207 +   (INJF f1 = INJF f2) = (f1 = f2)"
  2.3208    by (import ind_type INJF_INJ)
  2.3209  
  2.3210  constdefs
  2.3211 -  INJP :: "(nat => 'a => bool) => (nat => 'a => bool) => nat => 'a => bool" 
  2.3212 +  INJP :: "(nat => 'a::type => bool)
  2.3213 +=> (nat => 'a::type => bool) => nat => 'a::type => bool" 
  2.3214    "INJP ==
  2.3215 -%f1 f2 n a. if NUMLEFT n then f1 (NUMRIGHT n) a else f2 (NUMRIGHT n) a"
  2.3216 -
  2.3217 -lemma INJP: "ALL f1 f2.
  2.3218 +%(f1::nat => 'a::type => bool) (f2::nat => 'a::type => bool) (n::nat)
  2.3219 +   a::'a::type. if NUMLEFT n then f1 (NUMRIGHT n) a else f2 (NUMRIGHT n) a"
  2.3220 +
  2.3221 +lemma INJP: "ALL (f1::nat => 'a::type => bool) f2::nat => 'a::type => bool.
  2.3222     INJP f1 f2 =
  2.3223 -   (%n a. if NUMLEFT n then f1 (NUMRIGHT n) a else f2 (NUMRIGHT n) a)"
  2.3224 +   (%(n::nat) a::'a::type.
  2.3225 +       if NUMLEFT n then f1 (NUMRIGHT n) a else f2 (NUMRIGHT n) a)"
  2.3226    by (import ind_type INJP)
  2.3227  
  2.3228 -lemma INJP_INJ: "ALL f1 f1' f2 f2'. (INJP f1 f2 = INJP f1' f2') = (f1 = f1' & f2 = f2')"
  2.3229 +lemma INJP_INJ: "ALL (f1::nat => 'a::type => bool) (f1'::nat => 'a::type => bool)
  2.3230 +   (f2::nat => 'a::type => bool) f2'::nat => 'a::type => bool.
  2.3231 +   (INJP f1 f2 = INJP f1' f2') = (f1 = f1' & f2 = f2')"
  2.3232    by (import ind_type INJP_INJ)
  2.3233  
  2.3234  constdefs
  2.3235 -  ZCONSTR :: "nat => 'a => (nat => nat => 'a => bool) => nat => 'a => bool" 
  2.3236 -  "ZCONSTR == %c i r. INJP (INJN (Suc c)) (INJP (INJA i) (INJF r))"
  2.3237 -
  2.3238 -lemma ZCONSTR: "ALL c i r. ZCONSTR c i r = INJP (INJN (Suc c)) (INJP (INJA i) (INJF r))"
  2.3239 +  ZCONSTR :: "nat
  2.3240 +=> 'a::type => (nat => nat => 'a::type => bool) => nat => 'a::type => bool" 
  2.3241 +  "ZCONSTR ==
  2.3242 +%(c::nat) (i::'a::type) r::nat => nat => 'a::type => bool.
  2.3243 +   INJP (INJN (Suc c)) (INJP (INJA i) (INJF r))"
  2.3244 +
  2.3245 +lemma ZCONSTR: "ALL (c::nat) (i::'a::type) r::nat => nat => 'a::type => bool.
  2.3246 +   ZCONSTR c i r = INJP (INJN (Suc c)) (INJP (INJA i) (INJF r))"
  2.3247    by (import ind_type ZCONSTR)
  2.3248  
  2.3249  constdefs
  2.3250 -  ZBOT :: "nat => 'a => bool" 
  2.3251 -  "ZBOT == INJP (INJN 0) (SOME z. True)"
  2.3252 -
  2.3253 -lemma ZBOT: "ZBOT = INJP (INJN 0) (SOME z. True)"
  2.3254 +  ZBOT :: "nat => 'a::type => bool" 
  2.3255 +  "ZBOT == INJP (INJN (0::nat)) (SOME z::nat => 'a::type => bool. True)"
  2.3256 +
  2.3257 +lemma ZBOT: "ZBOT = INJP (INJN (0::nat)) (SOME z::nat => 'a::type => bool. True)"
  2.3258    by (import ind_type ZBOT)
  2.3259  
  2.3260 -lemma ZCONSTR_ZBOT: "ALL x xa xb. ZCONSTR x xa xb ~= ZBOT"
  2.3261 +lemma ZCONSTR_ZBOT: "ALL (x::nat) (xa::'a::type) xb::nat => nat => 'a::type => bool.
  2.3262 +   ZCONSTR x xa xb ~= ZBOT"
  2.3263    by (import ind_type ZCONSTR_ZBOT)
  2.3264  
  2.3265  constdefs
  2.3266 -  ZRECSPACE :: "(nat => 'a => bool) => bool" 
  2.3267 +  ZRECSPACE :: "(nat => 'a::type => bool) => bool" 
  2.3268    "ZRECSPACE ==
  2.3269 -%a0. ALL ZRECSPACE'.
  2.3270 -        (ALL a0.
  2.3271 -            a0 = ZBOT |
  2.3272 -            (EX c i r. a0 = ZCONSTR c i r & (ALL n. ZRECSPACE' (r n))) -->
  2.3273 -            ZRECSPACE' a0) -->
  2.3274 -        ZRECSPACE' a0"
  2.3275 +%a0::nat => 'a::type => bool.
  2.3276 +   ALL ZRECSPACE'::(nat => 'a::type => bool) => bool.
  2.3277 +      (ALL a0::nat => 'a::type => bool.
  2.3278 +          a0 = ZBOT |
  2.3279 +          (EX (c::nat) (i::'a::type) r::nat => nat => 'a::type => bool.
  2.3280 +              a0 = ZCONSTR c i r & (ALL n::nat. ZRECSPACE' (r n))) -->
  2.3281 +          ZRECSPACE' a0) -->
  2.3282 +      ZRECSPACE' a0"
  2.3283  
  2.3284  lemma ZRECSPACE: "ZRECSPACE =
  2.3285 -(%a0. ALL ZRECSPACE'.
  2.3286 -         (ALL a0.
  2.3287 -             a0 = ZBOT |
  2.3288 -             (EX c i r. a0 = ZCONSTR c i r & (ALL n. ZRECSPACE' (r n))) -->
  2.3289 -             ZRECSPACE' a0) -->
  2.3290 -         ZRECSPACE' a0)"
  2.3291 +(%a0::nat => 'a::type => bool.
  2.3292 +    ALL ZRECSPACE'::(nat => 'a::type => bool) => bool.
  2.3293 +       (ALL a0::nat => 'a::type => bool.
  2.3294 +           a0 = ZBOT |
  2.3295 +           (EX (c::nat) (i::'a::type) r::nat => nat => 'a::type => bool.
  2.3296 +               a0 = ZCONSTR c i r & (ALL n::nat. ZRECSPACE' (r n))) -->
  2.3297 +           ZRECSPACE' a0) -->
  2.3298 +       ZRECSPACE' a0)"
  2.3299    by (import ind_type ZRECSPACE)
  2.3300  
  2.3301  lemma ZRECSPACE_rules: "(op &::bool => bool => bool)
  2.3302 - ((ZRECSPACE::(nat => 'a => bool) => bool) (ZBOT::nat => 'a => bool))
  2.3303 + ((ZRECSPACE::(nat => 'a::type => bool) => bool)
  2.3304 +   (ZBOT::nat => 'a::type => bool))
  2.3305   ((All::(nat => bool) => bool)
  2.3306     (%c::nat.
  2.3307 -       (All::('a => bool) => bool)
  2.3308 -        (%i::'a.
  2.3309 -            (All::((nat => nat => 'a => bool) => bool) => bool)
  2.3310 -             (%r::nat => nat => 'a => bool.
  2.3311 +       (All::('a::type => bool) => bool)
  2.3312 +        (%i::'a::type.
  2.3313 +            (All::((nat => nat => 'a::type => bool) => bool) => bool)
  2.3314 +             (%r::nat => nat => 'a::type => bool.
  2.3315                   (op -->::bool => bool => bool)
  2.3316                    ((All::(nat => bool) => bool)
  2.3317                      (%n::nat.
  2.3318 -                        (ZRECSPACE::(nat => 'a => bool) => bool) (r n)))
  2.3319 -                  ((ZRECSPACE::(nat => 'a => bool) => bool)
  2.3320 +                        (ZRECSPACE::(nat => 'a::type => bool) => bool)
  2.3321 +                         (r n)))
  2.3322 +                  ((ZRECSPACE::(nat => 'a::type => bool) => bool)
  2.3323                      ((ZCONSTR::nat
  2.3324 -                               => 'a => (nat => nat => 'a => bool)
  2.3325 -  => nat => 'a => bool)
  2.3326 +                               => 'a::type
  2.3327 +                                  => (nat => nat => 'a::type => bool)
  2.3328 +                                     => nat => 'a::type => bool)
  2.3329                        c i r))))))"
  2.3330    by (import ind_type ZRECSPACE_rules)
  2.3331  
  2.3332 -lemma ZRECSPACE_ind: "ALL x.
  2.3333 -   x ZBOT & (ALL c i r. (ALL n. x (r n)) --> x (ZCONSTR c i r)) -->
  2.3334 -   (ALL a0. ZRECSPACE a0 --> x a0)"
  2.3335 +lemma ZRECSPACE_ind: "ALL x::(nat => 'a::type => bool) => bool.
  2.3336 +   x ZBOT &
  2.3337 +   (ALL (c::nat) (i::'a::type) r::nat => nat => 'a::type => bool.
  2.3338 +       (ALL n::nat. x (r n)) --> x (ZCONSTR c i r)) -->
  2.3339 +   (ALL a0::nat => 'a::type => bool. ZRECSPACE a0 --> x a0)"
  2.3340    by (import ind_type ZRECSPACE_ind)
  2.3341  
  2.3342 -lemma ZRECSPACE_cases: "ALL a0.
  2.3343 +lemma ZRECSPACE_cases: "ALL a0::nat => 'a::type => bool.
  2.3344     ZRECSPACE a0 =
  2.3345 -   (a0 = ZBOT | (EX c i r. a0 = ZCONSTR c i r & (ALL n. ZRECSPACE (r n))))"
  2.3346 +   (a0 = ZBOT |
  2.3347 +    (EX (c::nat) (i::'a::type) r::nat => nat => 'a::type => bool.
  2.3348 +        a0 = ZCONSTR c i r & (ALL n::nat. ZRECSPACE (r n))))"
  2.3349    by (import ind_type ZRECSPACE_cases)
  2.3350  
  2.3351 -typedef (open) ('a) recspace = "(Collect::((nat => 'a => bool) => bool) => (nat => 'a => bool) set)
  2.3352 - (ZRECSPACE::(nat => 'a => bool) => bool)" 
  2.3353 +typedef (open) ('a) recspace = "(Collect::((nat => 'a::type => bool) => bool)
  2.3354 +          => (nat => 'a::type => bool) set)
  2.3355 + (ZRECSPACE::(nat => 'a::type => bool) => bool)" 
  2.3356    by (rule typedef_helper,import ind_type recspace_TY_DEF)
  2.3357  
  2.3358  lemmas recspace_TY_DEF = typedef_hol2hol4 [OF type_definition_recspace]
  2.3359  
  2.3360  consts
  2.3361 -  mk_rec :: "(nat => 'a => bool) => 'a recspace" 
  2.3362 -  dest_rec :: "'a recspace => nat => 'a => bool" 
  2.3363 -
  2.3364 -specification (dest_rec mk_rec) recspace_repfns: "(ALL a::'a recspace. mk_rec (dest_rec a) = a) &
  2.3365 -(ALL r::nat => 'a => bool. ZRECSPACE r = (dest_rec (mk_rec r) = r))"
  2.3366 +  mk_rec :: "(nat => 'a::type => bool) => 'a::type recspace" 
  2.3367 +  dest_rec :: "'a::type recspace => nat => 'a::type => bool" 
  2.3368 +
  2.3369 +specification (dest_rec mk_rec) recspace_repfns: "(ALL a::'a::type recspace. mk_rec (dest_rec a) = a) &
  2.3370 +(ALL r::nat => 'a::type => bool. ZRECSPACE r = (dest_rec (mk_rec r) = r))"
  2.3371    by (import ind_type recspace_repfns)
  2.3372  
  2.3373  constdefs
  2.3374 -  BOTTOM :: "'a recspace" 
  2.3375 +  BOTTOM :: "'a::type recspace" 
  2.3376    "BOTTOM == mk_rec ZBOT"
  2.3377  
  2.3378  lemma BOTTOM: "BOTTOM = mk_rec ZBOT"
  2.3379    by (import ind_type BOTTOM)
  2.3380  
  2.3381  constdefs
  2.3382 -  CONSTR :: "nat => 'a => (nat => 'a recspace) => 'a recspace" 
  2.3383 -  "CONSTR == %c i r. mk_rec (ZCONSTR c i (%n. dest_rec (r n)))"
  2.3384 -
  2.3385 -lemma CONSTR: "ALL c i r. CONSTR c i r = mk_rec (ZCONSTR c i (%n. dest_rec (r n)))"
  2.3386 +  CONSTR :: "nat => 'a::type => (nat => 'a::type recspace) => 'a::type recspace" 
  2.3387 +  "CONSTR ==
  2.3388 +%(c::nat) (i::'a::type) r::nat => 'a::type recspace.
  2.3389 +   mk_rec (ZCONSTR c i (%n::nat. dest_rec (r n)))"
  2.3390 +
  2.3391 +lemma CONSTR: "ALL (c::nat) (i::'a::type) r::nat => 'a::type recspace.
  2.3392 +   CONSTR c i r = mk_rec (ZCONSTR c i (%n::nat. dest_rec (r n)))"
  2.3393    by (import ind_type CONSTR)
  2.3394  
  2.3395 -lemma MK_REC_INJ: "ALL x y. mk_rec x = mk_rec y --> ZRECSPACE x & ZRECSPACE y --> x = y"
  2.3396 +lemma MK_REC_INJ: "ALL (x::nat => 'a::type => bool) y::nat => 'a::type => bool.
  2.3397 +   mk_rec x = mk_rec y --> ZRECSPACE x & ZRECSPACE y --> x = y"
  2.3398    by (import ind_type MK_REC_INJ)
  2.3399  
  2.3400 -lemma DEST_REC_INJ: "ALL x y. (dest_rec x = dest_rec y) = (x = y)"
  2.3401 +lemma DEST_REC_INJ: "ALL (x::'a::type recspace) y::'a::type recspace.
  2.3402 +   (dest_rec x = dest_rec y) = (x = y)"
  2.3403    by (import ind_type DEST_REC_INJ)
  2.3404  
  2.3405 -lemma CONSTR_BOT: "ALL c i r. CONSTR c i r ~= BOTTOM"
  2.3406 +lemma CONSTR_BOT: "ALL (c::nat) (i::'a::type) r::nat => 'a::type recspace.
  2.3407 +   CONSTR c i r ~= BOTTOM"
  2.3408    by (import ind_type CONSTR_BOT)
  2.3409  
  2.3410 -lemma CONSTR_INJ: "ALL c1 i1 r1 c2 i2 r2.
  2.3411 +lemma CONSTR_INJ: "ALL (c1::nat) (i1::'a::type) (r1::nat => 'a::type recspace) (c2::nat)
  2.3412 +   (i2::'a::type) r2::nat => 'a::type recspace.
  2.3413     (CONSTR c1 i1 r1 = CONSTR c2 i2 r2) = (c1 = c2 & i1 = i2 & r1 = r2)"
  2.3414    by (import ind_type CONSTR_INJ)
  2.3415  
  2.3416 -lemma CONSTR_IND: "ALL P.
  2.3417 -   P BOTTOM & (ALL c i r. (ALL n. P (r n)) --> P (CONSTR c i r)) --> All P"
  2.3418 +lemma CONSTR_IND: "ALL P::'a::type recspace => bool.
  2.3419 +   P BOTTOM &
  2.3420 +   (ALL (c::nat) (i::'a::type) r::nat => 'a::type recspace.
  2.3421 +       (ALL n::nat. P (r n)) --> P (CONSTR c i r)) -->
  2.3422 +   All P"
  2.3423    by (import ind_type CONSTR_IND)
  2.3424  
  2.3425 -lemma CONSTR_REC: "ALL Fn. EX f. ALL c i r. f (CONSTR c i r) = Fn c i r (%n. f (r n))"
  2.3426 +lemma CONSTR_REC: "ALL Fn::nat
  2.3427 +        => 'a::type
  2.3428 +           => (nat => 'a::type recspace) => (nat => 'b::type) => 'b::type.
  2.3429 +   EX f::'a::type recspace => 'b::type.
  2.3430 +      ALL (c::nat) (i::'a::type) r::nat => 'a::type recspace.
  2.3431 +         f (CONSTR c i r) = Fn c i r (%n::nat. f (r n))"
  2.3432    by (import ind_type CONSTR_REC)
  2.3433  
  2.3434  consts
  2.3435 -  FCONS :: "'a => (nat => 'a) => nat => 'a" 
  2.3436 -
  2.3437 -specification (FCONS) FCONS: "(ALL (a::'a) f::nat => 'a. FCONS a f (0::nat) = a) &
  2.3438 -(ALL (a::'a) (f::nat => 'a) n::nat. FCONS a f (Suc n) = f n)"
  2.3439 +  FCONS :: "'a::type => (nat => 'a::type) => nat => 'a::type" 
  2.3440 +
  2.3441 +specification (FCONS) FCONS: "(ALL (a::'a::type) f::nat => 'a::type. FCONS a f (0::nat) = a) &
  2.3442 +(ALL (a::'a::type) (f::nat => 'a::type) n::nat. FCONS a f (Suc n) = f n)"
  2.3443    by (import ind_type FCONS)
  2.3444  
  2.3445  constdefs
  2.3446 -  FNIL :: "nat => 'a" 
  2.3447 -  "FNIL == %n. SOME x. True"
  2.3448 -
  2.3449 -lemma FNIL: "ALL n. FNIL n = (SOME x. True)"
  2.3450 +  FNIL :: "nat => 'a::type" 
  2.3451 +  "FNIL == %n::nat. SOME x::'a::type. True"
  2.3452 +
  2.3453 +lemma FNIL: "ALL n::nat. FNIL n = (SOME x::'a::type. True)"
  2.3454    by (import ind_type FNIL)
  2.3455  
  2.3456  constdefs
  2.3457 -  ISO :: "('a => 'b) => ('b => 'a) => bool" 
  2.3458 -  "ISO == %f g. (ALL x. f (g x) = x) & (ALL y. g (f y) = y)"
  2.3459 -
  2.3460 -lemma ISO: "ALL f g. ISO f g = ((ALL x. f (g x) = x) & (ALL y. g (f y) = y))"
  2.3461 +  ISO :: "('a::type => 'b::type) => ('b::type => 'a::type) => bool" 
  2.3462 +  "ISO ==
  2.3463 +%(f::'a::type => 'b::type) g::'b::type => 'a::type.
  2.3464 +   (ALL x::'b::type. f (g x) = x) & (ALL y::'a::type. g (f y) = y)"
  2.3465 +
  2.3466 +lemma ISO: "ALL (f::'a::type => 'b::type) g::'b::type => 'a::type.
  2.3467 +   ISO f g =
  2.3468 +   ((ALL x::'b::type. f (g x) = x) & (ALL y::'a::type. g (f y) = y))"
  2.3469    by (import ind_type ISO)
  2.3470  
  2.3471 -lemma ISO_REFL: "ISO (%x. x) (%x. x)"
  2.3472 +lemma ISO_REFL: "ISO (%x::'a::type. x) (%x::'a::type. x)"
  2.3473    by (import ind_type ISO_REFL)
  2.3474  
  2.3475 -lemma ISO_FUN: "ISO (f::'a => 'c) (f'::'c => 'a) & ISO (g::'b => 'd) (g'::'d => 'b) -->
  2.3476 -ISO (%(h::'a => 'b) a'::'c. g (h (f' a')))
  2.3477 - (%(h::'c => 'd) a::'a. g' (h (f a)))"
  2.3478 +lemma ISO_FUN: "ISO (f::'a::type => 'c::type) (f'::'c::type => 'a::type) &
  2.3479 +ISO (g::'b::type => 'd::type) (g'::'d::type => 'b::type) -->
  2.3480 +ISO (%(h::'a::type => 'b::type) a'::'c::type. g (h (f' a')))
  2.3481 + (%(h::'c::type => 'd::type) a::'a::type. g' (h (f a)))"
  2.3482    by (import ind_type ISO_FUN)
  2.3483  
  2.3484 -lemma ISO_USAGE: "ISO f g -->
  2.3485 -(ALL P. All P = (ALL x. P (g x))) &
  2.3486 -(ALL P. Ex P = (EX x. P (g x))) & (ALL a b. (a = g b) = (f a = b))"
  2.3487 +lemma ISO_USAGE: "ISO (f::'a::type => 'b::type) (g::'b::type => 'a::type) -->
  2.3488 +(ALL P::'a::type => bool. All P = (ALL x::'b::type. P (g x))) &
  2.3489 +(ALL P::'a::type => bool. Ex P = (EX x::'b::type. P (g x))) &
  2.3490 +(ALL (a::'a::type) b::'b::type. (a = g b) = (f a = b))"
  2.3491    by (import ind_type ISO_USAGE)
  2.3492  
  2.3493  ;end_setup
  2.3494 @@ -2480,7 +2911,7 @@
  2.3495  lemma DIVIDES_ADD_2: "ALL (a::nat) (b::nat) c::nat. a dvd b & a dvd b + c --> a dvd c"
  2.3496    by (import divides DIVIDES_ADD_2)
  2.3497  
  2.3498 -lemma DIVIDES_FACT: "ALL b>0. b dvd FACT b"
  2.3499 +lemma DIVIDES_FACT: "ALL b>0::nat. b dvd FACT b"
  2.3500    by (import divides DIVIDES_FACT)
  2.3501  
  2.3502  lemma DIVIDES_MULT_LEFT: "ALL (x::nat) xa::nat. (x * xa dvd xa) = (xa = (0::nat) | x = (1::nat))"
  2.3503 @@ -2494,15 +2925,18 @@
  2.3504    prime :: "nat => bool" 
  2.3505  
  2.3506  defs
  2.3507 -  prime_primdef: "prime.prime == %a. a ~= 1 & (ALL b. b dvd a --> b = a | b = 1)"
  2.3508 -
  2.3509 -lemma prime_def: "ALL a. prime.prime a = (a ~= 1 & (ALL b. b dvd a --> b = a | b = 1))"
  2.3510 +  prime_primdef: "prime.prime ==
  2.3511 +%a::nat. a ~= (1::nat) & (ALL b::nat. b dvd a --> b = a | b = (1::nat))"
  2.3512 +
  2.3513 +lemma prime_def: "ALL a::nat.
  2.3514 +   prime.prime a =
  2.3515 +   (a ~= (1::nat) & (ALL b::nat. b dvd a --> b = a | b = (1::nat)))"
  2.3516    by (import prime prime_def)
  2.3517  
  2.3518 -lemma NOT_PRIME_0: "~ prime.prime 0"
  2.3519 +lemma NOT_PRIME_0: "~ prime.prime (0::nat)"
  2.3520    by (import prime NOT_PRIME_0)
  2.3521  
  2.3522 -lemma NOT_PRIME_1: "~ prime.prime 1"
  2.3523 +lemma NOT_PRIME_1: "~ prime.prime (1::nat)"
  2.3524    by (import prime NOT_PRIME_1)
  2.3525  
  2.3526  ;end_setup
  2.3527 @@ -2510,224 +2944,286 @@
  2.3528  ;setup_theory list
  2.3529  
  2.3530  consts
  2.3531 -  EL :: "nat => 'a list => 'a" 
  2.3532 -
  2.3533 -specification (EL) EL: "(ALL l::'a list. EL (0::nat) l = hd l) &
  2.3534 -(ALL (l::'a list) n::nat. EL (Suc n) l = EL n (tl l))"
  2.3535 +  EL :: "nat => 'a::type list => 'a::type" 
  2.3536 +
  2.3537 +specification (EL) EL: "(ALL l::'a::type list. EL (0::nat) l = hd l) &
  2.3538 +(ALL (l::'a::type list) n::nat. EL (Suc n) l = EL n (tl l))"
  2.3539    by (import list EL)
  2.3540  
  2.3541 -lemma NULL: "(op &::bool => bool => bool) ((null::'a list => bool) ([]::'a list))
  2.3542 - ((All::('a => bool) => bool)
  2.3543 -   (%x::'a.
  2.3544 -       (All::('a list => bool) => bool)
  2.3545 -        (%xa::'a list.
  2.3546 +lemma NULL: "(op &::bool => bool => bool)
  2.3547 + ((null::'a::type list => bool) ([]::'a::type list))
  2.3548 + ((All::('a::type => bool) => bool)
  2.3549 +   (%x::'a::type.
  2.3550 +       (All::('a::type list => bool) => bool)
  2.3551 +        (%xa::'a::type list.
  2.3552              (Not::bool => bool)
  2.3553 -             ((null::'a list => bool)
  2.3554 -               ((op #::'a => 'a list => 'a list) x xa)))))"
  2.3555 +             ((null::'a::type list => bool)
  2.3556 +               ((op #::'a::type => 'a::type list => 'a::type list) x xa)))))"
  2.3557    by (import list NULL)
  2.3558  
  2.3559 -lemma list_case_compute: "ALL l. list_case b f l = (if null l then b else f (hd l) (tl l))"
  2.3560 +lemma list_case_compute: "ALL l::'a::type list.
  2.3561 +   list_case (b::'b::type) (f::'a::type => 'a::type list => 'b::type) l =
  2.3562 +   (if null l then b else f (hd l) (tl l))"
  2.3563    by (import list list_case_compute)
  2.3564  
  2.3565 -lemma LIST_NOT_EQ: "ALL l1 l2. l1 ~= l2 --> (ALL x xa. x # l1 ~= xa # l2)"
  2.3566 +lemma LIST_NOT_EQ: "ALL (l1::'a::type list) l2::'a::type list.
  2.3567 +   l1 ~= l2 --> (ALL (x::'a::type) xa::'a::type. x # l1 ~= xa # l2)"
  2.3568    by (import list LIST_NOT_EQ)
  2.3569  
  2.3570 -lemma NOT_EQ_LIST: "ALL h1 h2. h1 ~= h2 --> (ALL x xa. h1 # x ~= h2 # xa)"
  2.3571 +lemma NOT_EQ_LIST: "ALL (h1::'a::type) h2::'a::type.
  2.3572 +   h1 ~= h2 -->
  2.3573 +   (ALL (x::'a::type list) xa::'a::type list. h1 # x ~= h2 # xa)"
  2.3574    by (import list NOT_EQ_LIST)
  2.3575  
  2.3576 -lemma EQ_LIST: "ALL h1 h2. h1 = h2 --> (ALL l1 l2. l1 = l2 --> h1 # l1 = h2 # l2)"
  2.3577 +lemma EQ_LIST: "ALL (h1::'a::type) h2::'a::type.
  2.3578 +   h1 = h2 -->
  2.3579 +   (ALL (l1::'a::type list) l2::'a::type list.
  2.3580 +       l1 = l2 --> h1 # l1 = h2 # l2)"
  2.3581    by (import list EQ_LIST)
  2.3582  
  2.3583 -lemma CONS: "ALL l. ~ null l --> hd l # tl l = l"
  2.3584 +lemma CONS: "ALL l::'a::type list. ~ null l --> hd l # tl l = l"
  2.3585    by (import list CONS)
  2.3586  
  2.3587 -lemma MAP_EQ_NIL: "ALL l f. (map f l = []) = (l = []) & ([] = map f l) = (l = [])"
  2.3588 +lemma MAP_EQ_NIL: "ALL (l::'a::type list) f::'a::type => 'b::type.
  2.3589 +   (map f l = []) = (l = []) & ([] = map f l) = (l = [])"
  2.3590    by (import list MAP_EQ_NIL)
  2.3591  
  2.3592 -lemma EVERY_EL: "(All::('a list => bool) => bool)
  2.3593 - (%l::'a list.
  2.3594 -     (All::(('a => bool) => bool) => bool)
  2.3595 -      (%P::'a => bool.
  2.3596 +lemma EVERY_EL: "(All::('a::type list => bool) => bool)
  2.3597 + (%l::'a::type list.
  2.3598 +     (All::(('a::type => bool) => bool) => bool)
  2.3599 +      (%P::'a::type => bool.
  2.3600            (op =::bool => bool => bool)
  2.3601 -           ((list_all::('a => bool) => 'a list => bool) P l)
  2.3602 +           ((list_all::('a::type => bool) => 'a::type list => bool) P l)
  2.3603             ((All::(nat => bool) => bool)
  2.3604               (%n::nat.
  2.3605                   (op -->::bool => bool => bool)
  2.3606 -                  ((op <::nat => nat => bool) n ((size::'a list => nat) l))
  2.3607 -                  (P ((EL::nat => 'a list => 'a) n l))))))"
  2.3608 +                  ((op <::nat => nat => bool) n
  2.3609 +                    ((size::'a::type list => nat) l))
  2.3610 +                  (P ((EL::nat => 'a::type list => 'a::type) n l))))))"
  2.3611    by (import list EVERY_EL)
  2.3612  
  2.3613 -lemma EVERY_CONJ: "ALL l. list_all (%x. P x & Q x) l = (list_all P l & list_all Q l)"
  2.3614 +lemma EVERY_CONJ: "ALL l::'a::type list.
  2.3615 +   list_all
  2.3616 +    (%x::'a::type. (P::'a::type => bool) x & (Q::'a::type => bool) x) l =
  2.3617 +   (list_all P l & list_all Q l)"
  2.3618    by (import list EVERY_CONJ)
  2.3619  
  2.3620 -lemma EVERY_MEM: "ALL P l. list_all P l = (ALL e. e mem l --> P e)"
  2.3621 +lemma EVERY_MEM: "ALL (P::'a::type => bool) l::'a::type list.
  2.3622 +   list_all P l = (ALL e::'a::type. e mem l --> P e)"
  2.3623    by (import list EVERY_MEM)
  2.3624  
  2.3625 -lemma EXISTS_MEM: "ALL P l. list_exists P l = (EX e. e mem l & P e)"
  2.3626 +lemma EXISTS_MEM: "ALL (P::'a::type => bool) l::'a::type list.
  2.3627 +   list_exists P l = (EX e::'a::type. e mem l & P e)"
  2.3628    by (import list EXISTS_MEM)
  2.3629  
  2.3630 -lemma MEM_APPEND: "ALL e l1 l2. e mem l1 @ l2 = (e mem l1 | e mem l2)"
  2.3631 +lemma MEM_APPEND: "ALL (e::'a::type) (l1::'a::type list) l2::'a::type list.
  2.3632 +   e mem l1 @ l2 = (e mem l1 | e mem l2)"
  2.3633    by (import list MEM_APPEND)
  2.3634  
  2.3635 -lemma EXISTS_APPEND: "ALL P l1 l2. list_exists P (l1 @ l2) = (list_exists P l1 | list_exists P l2)"
  2.3636 +lemma EXISTS_APPEND: "ALL (P::'a::type => bool) (l1::'a::type list) l2::'a::type list.
  2.3637 +   list_exists P (l1 @ l2) = (list_exists P l1 | list_exists P l2)"
  2.3638    by (import list EXISTS_APPEND)
  2.3639  
  2.3640 -lemma NOT_EVERY: "ALL P l. (~ list_all P l) = list_exists (Not o P) l"
  2.3641 +lemma NOT_EVERY: "ALL (P::'a::type => bool) l::'a::type list.
  2.3642 +   (~ list_all P l) = list_exists (Not o P) l"
  2.3643    by (import list NOT_EVERY)
  2.3644  
  2.3645 -lemma NOT_EXISTS: "ALL P l. (~ list_exists P l) = list_all (Not o P) l"
  2.3646 +lemma NOT_EXISTS: "ALL (P::'a::type => bool) l::'a::type list.
  2.3647 +   (~ list_exists P l) = list_all (Not o P) l"
  2.3648    by (import list NOT_EXISTS)
  2.3649  
  2.3650 -lemma MEM_MAP: "ALL l f x. x mem map f l = (EX y. x = f y & y mem l)"
  2.3651 +lemma MEM_MAP: "ALL (l::'a::type list) (f::'a::type => 'b::type) x::'b::type.
  2.3652 +   x mem map f l = (EX y::'a::type. x = f y & y mem l)"
  2.3653    by (import list MEM_MAP)
  2.3654  
  2.3655 -lemma LENGTH_CONS: "ALL l n. (length l = Suc n) = (EX h l'. length l' = n & l = h # l')"
  2.3656 +lemma LENGTH_CONS: "ALL (l::'a::type list) n::nat.
  2.3657 +   (length l = Suc n) =
  2.3658 +   (EX (h::'a::type) l'::'a::type list. length l' = n & l = h # l')"
  2.3659    by (import list LENGTH_CONS)
  2.3660  
  2.3661 -lemma LENGTH_EQ_CONS: "ALL P n.
  2.3662 -   (ALL l. length l = Suc n --> P l) =
  2.3663 -   (ALL l. length l = n --> (ALL x. P (x # l)))"
  2.3664 +lemma LENGTH_EQ_CONS: "ALL (P::'a::type list => bool) n::nat.
  2.3665 +   (ALL l::'a::type list. length l = Suc n --> P l) =
  2.3666 +   (ALL l::'a::type list. length l = n --> (ALL x::'a::type. P (x # l)))"
  2.3667    by (import list LENGTH_EQ_CONS)
  2.3668  
  2.3669 -lemma LENGTH_EQ_NIL: "ALL P. (ALL l. length l = 0 --> P l) = P []"
  2.3670 +lemma LENGTH_EQ_NIL: "ALL P::'a::type list => bool.
  2.3671 +   (ALL l::'a::type list. length l = (0::nat) --> P l) = P []"
  2.3672    by (import list LENGTH_EQ_NIL)
  2.3673  
  2.3674 -lemma CONS_ACYCLIC: "ALL l x. l ~= x # l & x # l ~= l"
  2.3675 +lemma CONS_ACYCLIC: "ALL (l::'a::type list) x::'a::type. l ~= x # l & x # l ~= l"
  2.3676    by (import list CONS_ACYCLIC)
  2.3677  
  2.3678 -lemma APPEND_eq_NIL: "(ALL (l1::'a list) l2::'a list. ([] = l1 @ l2) = (l1 = [] & l2 = [])) &
  2.3679 -(ALL (l1::'a list) l2::'a list. (l1 @ l2 = []) = (l1 = [] & l2 = []))"
  2.3680 +lemma APPEND_eq_NIL: "(ALL (l1::'a::type list) l2::'a::type list.
  2.3681 +    ([] = l1 @ l2) = (l1 = [] & l2 = [])) &
  2.3682 +(ALL (l1::'a::type list) l2::'a::type list.
  2.3683 +    (l1 @ l2 = []) = (l1 = [] & l2 = []))"
  2.3684    by (import list APPEND_eq_NIL)
  2.3685  
  2.3686 -lemma APPEND_11: "(ALL (l1::'a list) (l2::'a list) l3::'a list.
  2.3687 +lemma APPEND_11: "(ALL (l1::'a::type list) (l2::'a::type list) l3::'a::type list.
  2.3688      (l1 @ l2 = l1 @ l3) = (l2 = l3)) &
  2.3689 -(ALL (l1::'a list) (l2::'a list) l3::'a list.
  2.3690 +(ALL (l1::'a::type list) (l2::'a::type list) l3::'a::type list.
  2.3691      (l2 @ l1 = l3 @ l1) = (l2 = l3))"
  2.3692    by (import list APPEND_11)
  2.3693  
  2.3694 -lemma EL_compute: "ALL n. EL n l = (if n = 0 then hd l else EL (PRE n) (tl l))"
  2.3695 +lemma EL_compute: "ALL n::nat.
  2.3696 +   EL n (l::'a::type list) =
  2.3697 +   (if n = (0::nat) then hd l else EL (PRE n) (tl l))"
  2.3698    by (import list EL_compute)
  2.3699  
  2.3700 -lemma WF_LIST_PRED: "WF (%L1 L2. EX h. L2 = h # L1)"
  2.3701 +lemma WF_LIST_PRED: "WF (%(L1::'a::type list) L2::'a::type list. EX h::'a::type. L2 = h # L1)"
  2.3702    by (import list WF_LIST_PRED)
  2.3703  
  2.3704 -lemma list_size_cong: "ALL M N f f'.
  2.3705 -   M = N & (ALL x. x mem N --> f x = f' x) -->
  2.3706 +lemma list_size_cong: "ALL (M::'a::type list) (N::'a::type list) (f::'a::type => nat)
  2.3707 +   f'::'a::type => nat.
  2.3708 +   M = N & (ALL x::'a::type. x mem N --> f x = f' x) -->
  2.3709     list_size f M = list_size f' N"
  2.3710    by (import list list_size_cong)
  2.3711  
  2.3712 -lemma FOLDR_CONG: "ALL l l' b b' f f'.
  2.3713 -   l = l' & b = b' & (ALL x a. x mem l' --> f x a = f' x a) -->
  2.3714 +lemma FOLDR_CONG: "ALL (l::'a::type list) (l'::'a::type list) (b::'b::type) (b'::'b::type)
  2.3715 +   (f::'a::type => 'b::type => 'b::type)
  2.3716 +   f'::'a::type => 'b::type => 'b::type.
  2.3717 +   l = l' &
  2.3718 +   b = b' & (ALL (x::'a::type) a::'b::type. x mem l' --> f x a = f' x a) -->
  2.3719     foldr f l b = foldr f' l' b'"
  2.3720    by (import list FOLDR_CONG)
  2.3721  
  2.3722 -lemma FOLDL_CONG: "ALL l l' b b' f f'.
  2.3723 -   l = l' & b = b' & (ALL x a. x mem l' --> f a x = f' a x) -->
  2.3724 +lemma FOLDL_CONG: "ALL (l::'a::type list) (l'::'a::type list) (b::'b::type) (b'::'b::type)
  2.3725 +   (f::'b::type => 'a::type => 'b::type)
  2.3726 +   f'::'b::type => 'a::type => 'b::type.
  2.3727 +   l = l' &
  2.3728 +   b = b' & (ALL (x::'a::type) a::'b::type. x mem l' --> f a x = f' a x) -->
  2.3729     foldl f b l = foldl f' b' l'"
  2.3730    by (import list FOLDL_CONG)
  2.3731  
  2.3732 -lemma MAP_CONG: "ALL l1 l2 f f'.
  2.3733 -   l1 = l2 & (ALL x. x mem l2 --> f x = f' x) --> map f l1 = map f' l2"
  2.3734 +lemma MAP_CONG: "ALL (l1::'a::type list) (l2::'a::type list) (f::'a::type => 'b::type)
  2.3735 +   f'::'a::type => 'b::type.
  2.3736 +   l1 = l2 & (ALL x::'a::type. x mem l2 --> f x = f' x) -->
  2.3737 +   map f l1 = map f' l2"
  2.3738    by (import list MAP_CONG)
  2.3739  
  2.3740 -lemma EXISTS_CONG: "ALL l1 l2 P P'.
  2.3741 -   l1 = l2 & (ALL x. x mem l2 --> P x = P' x) -->
  2.3742 +lemma EXISTS_CONG: "ALL (l1::'a::type list) (l2::'a::type list) (P::'a::type => bool)
  2.3743 +   P'::'a::type => bool.
  2.3744 +   l1 = l2 & (ALL x::'a::type. x mem l2 --> P x = P' x) -->
  2.3745     list_exists P l1 = list_exists P' l2"
  2.3746    by (import list EXISTS_CONG)
  2.3747  
  2.3748 -lemma EVERY_CONG: "ALL l1 l2 P P'.
  2.3749 -   l1 = l2 & (ALL x. x mem l2 --> P x = P' x) -->
  2.3750 +lemma EVERY_CONG: "ALL (l1::'a::type list) (l2::'a::type list) (P::'a::type => bool)
  2.3751 +   P'::'a::type => bool.
  2.3752 +   l1 = l2 & (ALL x::'a::type. x mem l2 --> P x = P' x) -->
  2.3753     list_all P l1 = list_all P' l2"
  2.3754    by (import list EVERY_CONG)
  2.3755  
  2.3756 -lemma EVERY_MONOTONIC: "ALL P Q. (ALL x. P x --> Q x) --> (ALL l. list_all P l --> list_all Q l)"
  2.3757 +lemma EVERY_MONOTONIC: "ALL (P::'a::type => bool) Q::'a::type => bool.
  2.3758 +   (ALL x::'a::type. P x --> Q x) -->
  2.3759 +   (ALL l::'a::type list. list_all P l --> list_all Q l)"
  2.3760    by (import list EVERY_MONOTONIC)
  2.3761  
  2.3762 -lemma LENGTH_ZIP: "ALL l1 l2.
  2.3763 +lemma LENGTH_ZIP: "ALL (l1::'a::type list) l2::'b::type list.
  2.3764     length l1 = length l2 -->
  2.3765     length (zip l1 l2) = length l1 & length (zip l1 l2) = length l2"
  2.3766    by (import list LENGTH_ZIP)
  2.3767  
  2.3768 -lemma LENGTH_UNZIP: "ALL pl.
  2.3769 +lemma LENGTH_UNZIP: "ALL pl::('a::type * 'b::type) list.
  2.3770     length (fst (unzip pl)) = length pl & length (snd (unzip pl)) = length pl"
  2.3771    by (import list LENGTH_UNZIP)
  2.3772  
  2.3773 -lemma ZIP_UNZIP: "ALL l. ZIP (unzip l) = l"
  2.3774 +lemma ZIP_UNZIP: "ALL l::('a::type * 'b::type) list. ZIP (unzip l) = l"
  2.3775    by (import list ZIP_UNZIP)
  2.3776  
  2.3777 -lemma UNZIP_ZIP: "ALL l1 l2. length l1 = length l2 --> unzip (zip l1 l2) = (l1, l2)"
  2.3778 +lemma UNZIP_ZIP: "ALL (l1::'a::type list) l2::'b::type list.
  2.3779 +   length l1 = length l2 --> unzip (zip l1 l2) = (l1, l2)"
  2.3780    by (import list UNZIP_ZIP)
  2.3781  
  2.3782 -lemma ZIP_MAP: "ALL l1 l2 f1 f2.
  2.3783 +lemma ZIP_MAP: "ALL (l1::'a::type list) (l2::'b::type list) (f1::'a::type => 'c::type)
  2.3784 +   f2::'b::type => 'd::type.
  2.3785     length l1 = length l2 -->
  2.3786 -   zip (map f1 l1) l2 = map (%p. (f1 (fst p), snd p)) (zip l1 l2) &
  2.3787 -   zip l1 (map f2 l2) = map (%p. (fst p, f2 (snd p))) (zip l1 l2)"
  2.3788 +   zip (map f1 l1) l2 =
  2.3789 +   map (%p::'a::type * 'b::type. (f1 (fst p), snd p)) (zip l1 l2) &
  2.3790 +   zip l1 (map f2 l2) =
  2.3791 +   map (%p::'a::type * 'b::type. (fst p, f2 (snd p))) (zip l1 l2)"
  2.3792    by (import list ZIP_MAP)
  2.3793  
  2.3794 -lemma MEM_ZIP: "(All::('a list => bool) => bool)
  2.3795 - (%l1::'a list.
  2.3796 -     (All::('b list => bool) => bool)
  2.3797 -      (%l2::'b list.
  2.3798 -          (All::('a * 'b => bool) => bool)
  2.3799 -           (%p::'a * 'b.
  2.3800 +lemma MEM_ZIP: "(All::('a::type list => bool) => bool)
  2.3801 + (%l1::'a::type list.
  2.3802 +     (All::('b::type list => bool) => bool)
  2.3803 +      (%l2::'b::type list.
  2.3804 +          (All::('a::type * 'b::type => bool) => bool)
  2.3805 +           (%p::'a::type * 'b::type.
  2.3806                 (op -->::bool => bool => bool)
  2.3807 -                ((op =::nat => nat => bool) ((size::'a list => nat) l1)
  2.3808 -                  ((size::'b list => nat) l2))
  2.3809 +                ((op =::nat => nat => bool)
  2.3810 +                  ((size::'a::type list => nat) l1)
  2.3811 +                  ((size::'b::type list => nat) l2))
  2.3812                  ((op =::bool => bool => bool)
  2.3813 -                  ((op mem::'a * 'b => ('a * 'b) list => bool) p
  2.3814 -                    ((zip::'a list => 'b list => ('a * 'b) list) l1 l2))
  2.3815 +                  ((op mem::'a::type * 'b::type
  2.3816 +                            => ('a::type * 'b::type) list => bool)
  2.3817 +                    p ((zip::'a::type list
  2.3818 +                             => 'b::type list => ('a::type * 'b::type) list)
  2.3819 +                        l1 l2))
  2.3820                    ((Ex::(nat => bool) => bool)
  2.3821                      (%n::nat.
  2.3822                          (op &::bool => bool => bool)
  2.3823                           ((op <::nat => nat => bool) n
  2.3824 -                           ((size::'a list => nat) l1))
  2.3825 -                         ((op =::'a * 'b => 'a * 'b => bool) p
  2.3826 -                           ((Pair::'a => 'b => 'a * 'b)
  2.3827 -                             ((EL::nat => 'a list => 'a) n l1)
  2.3828 -                             ((EL::nat => 'b list => 'b) n l2)))))))))"
  2.3829 +                           ((size::'a::type list => nat) l1))
  2.3830 +                         ((op =::'a::type * 'b::type
  2.3831 +                                 => 'a::type * 'b::type => bool)
  2.3832 +                           p ((Pair::'a::type
  2.3833 +                                     => 'b::type => 'a::type * 'b::type)
  2.3834 +                               ((EL::nat => 'a::type list => 'a::type) n l1)
  2.3835 +                               ((EL::nat => 'b::type list => 'b::type) n
  2.3836 +                                 l2)))))))))"
  2.3837    by (import list MEM_ZIP)
  2.3838  
  2.3839 -lemma EL_ZIP: "ALL l1 l2 n.
  2.3840 +lemma EL_ZIP: "ALL (l1::'a::type list) (l2::'b::type list) n::nat.
  2.3841     length l1 = length l2 & n < length l1 -->
  2.3842     EL n (zip l1 l2) = (EL n l1, EL n l2)"
  2.3843    by (import list EL_ZIP)
  2.3844  
  2.3845 -lemma MAP2_ZIP: "(All::('a list => bool) => bool)
  2.3846 - (%l1::'a list.
  2.3847 -     (All::('b list => bool) => bool)
  2.3848 -      (%l2::'b list.
  2.3849 +lemma MAP2_ZIP: "(All::('a::type list => bool) => bool)
  2.3850 + (%l1::'a::type list.
  2.3851 +     (All::('b::type list => bool) => bool)
  2.3852 +      (%l2::'b::type list.
  2.3853            (op -->::bool => bool => bool)
  2.3854 -           ((op =::nat => nat => bool) ((size::'a list => nat) l1)
  2.3855 -             ((size::'b list => nat) l2))
  2.3856 -           ((All::(('a => 'b => 'c) => bool) => bool)
  2.3857 -             (%f::'a => 'b => 'c.
  2.3858 -                 (op =::'c list => 'c list => bool)
  2.3859 -                  ((map2::('a => 'b => 'c) => 'a list => 'b list => 'c list)
  2.3860 +           ((op =::nat => nat => bool) ((size::'a::type list => nat) l1)
  2.3861 +             ((size::'b::type list => nat) l2))
  2.3862 +           ((All::(('a::type => 'b::type => 'c::type) => bool) => bool)
  2.3863 +             (%f::'a::type => 'b::type => 'c::type.
  2.3864 +                 (op =::'c::type list => 'c::type list => bool)
  2.3865 +                  ((map2::('a::type => 'b::type => 'c::type)
  2.3866 +                          => 'a::type list
  2.3867 +                             => 'b::type list => 'c::type list)
  2.3868                      f l1 l2)
  2.3869 -                  ((map::('a * 'b => 'c) => ('a * 'b) list => 'c list)
  2.3870 -                    ((split::('a => 'b => 'c) => 'a * 'b => 'c) f)
  2.3871 -                    ((zip::'a list => 'b list => ('a * 'b) list) l1 l2))))))"
  2.3872 +                  ((map::('a::type * 'b::type => 'c::type)
  2.3873 +                         => ('a::type * 'b::type) list => 'c::type list)
  2.3874 +                    ((split::('a::type => 'b::type => 'c::type)
  2.3875 +                             => 'a::type * 'b::type => 'c::type)
  2.3876 +                      f)
  2.3877 +                    ((zip::'a::type list
  2.3878 +                           => 'b::type list => ('a::type * 'b::type) list)
  2.3879 +                      l1 l2))))))"
  2.3880    by (import list MAP2_ZIP)
  2.3881  
  2.3882 -lemma MEM_EL: "(All::('a list => bool) => bool)
  2.3883 - (%l::'a list.
  2.3884 -     (All::('a => bool) => bool)
  2.3885 -      (%x::'a.
  2.3886 -          (op =::bool => bool => bool) ((op mem::'a => 'a list => bool) x l)
  2.3887 +lemma MEM_EL: "(All::('a::type list => bool) => bool)
  2.3888 + (%l::'a::type list.
  2.3889 +     (All::('a::type => bool) => bool)
  2.3890 +      (%x::'a::type.
  2.3891 +          (op =::bool => bool => bool)
  2.3892 +           ((op mem::'a::type => 'a::type list => bool) x l)
  2.3893             ((Ex::(nat => bool) => bool)
  2.3894               (%n::nat.
  2.3895                   (op &::bool => bool => bool)
  2.3896 -                  ((op <::nat => nat => bool) n ((size::'a list => nat) l))
  2.3897 -                  ((op =::'a => 'a => bool) x
  2.3898 -                    ((EL::nat => 'a list => 'a) n l))))))"
  2.3899 +                  ((op <::nat => nat => bool) n
  2.3900 +                    ((size::'a::type list => nat) l))
  2.3901 +                  ((op =::'a::type => 'a::type => bool) x
  2.3902 +                    ((EL::nat => 'a::type list => 'a::type) n l))))))"
  2.3903    by (import list MEM_EL)
  2.3904  
  2.3905 -lemma LAST_CONS: "(ALL x::'a. last [x] = x) &
  2.3906 -(ALL (x::'a) (xa::'a) xb::'a list. last (x # xa # xb) = last (xa # xb))"
  2.3907 +lemma LAST_CONS: "(ALL x::'a::type. last [x] = x) &
  2.3908 +(ALL (x::'a::type) (xa::'a::type) xb::'a::type list.
  2.3909 +    last (x # xa # xb) = last (xa # xb))"
  2.3910    by (import list LAST_CONS)
  2.3911  
  2.3912 -lemma FRONT_CONS: "(ALL x::'a. butlast [x] = []) &
  2.3913 -(ALL (x::'a) (xa::'a) xb::'a list.
  2.3914 +lemma FRONT_CONS: "(ALL x::'a::type. butlast [x] = []) &
  2.3915 +(ALL (x::'a::type) (xa::'a::type) xb::'a::type list.
  2.3916      butlast (x # xa # xb) = x # butlast (xa # xb))"
  2.3917    by (import list FRONT_CONS)
  2.3918  
  2.3919 @@ -2735,10 +3231,12 @@
  2.3920  
  2.3921  ;setup_theory pred_set
  2.3922  
  2.3923 -lemma EXTENSION: "ALL s t. (s = t) = (ALL x. IN x s = IN x t)"
  2.3924 +lemma EXTENSION: "ALL (s::'a::type => bool) t::'a::type => bool.
  2.3925 +   (s = t) = (ALL x::'a::type. IN x s = IN x t)"
  2.3926    by (import pred_set EXTENSION)
  2.3927  
  2.3928 -lemma NOT_EQUAL_SETS: "ALL x xa. (x ~= xa) = (EX xb. IN xb xa = (~ IN xb x))"
  2.3929 +lemma NOT_EQUAL_SETS: "ALL (x::'a::type => bool) xa::'a::type => bool.
  2.3930 +   (x ~= xa) = (EX xb::'a::type. IN xb xa = (~ IN xb x))"
  2.3931    by (import pred_set NOT_EQUAL_SETS)
  2.3932  
  2.3933  lemma NUM_SET_WOP: "ALL s::nat => bool.
  2.3934 @@ -2747,39 +3245,40 @@
  2.3935    by (import pred_set NUM_SET_WOP)
  2.3936  
  2.3937  consts
  2.3938 -  GSPEC :: "('b => 'a * bool) => 'a => bool" 
  2.3939 -
  2.3940 -specification (GSPEC) GSPECIFICATION: "ALL (f::'b => 'a * bool) v::'a. IN v (GSPEC f) = (EX x::'b. (v, True) = f x)"
  2.3941 +  GSPEC :: "('b::type => 'a::type * bool) => 'a::type => bool" 
  2.3942 +
  2.3943 +specification (GSPEC) GSPECIFICATION: "ALL (f::'b::type => 'a::type * bool) v::'a::type.
  2.3944 +   IN v (GSPEC f) = (EX x::'b::type. (v, True) = f x)"
  2.3945    by (import pred_set GSPECIFICATION)
  2.3946  
  2.3947 -lemma SET_MINIMUM: "ALL (s::'a => bool) M::'a => nat.
  2.3948 -   (EX x::'a. IN x s) =
  2.3949 -   (EX x::'a. IN x s & (ALL y::'a. IN y s --> M x <= M y))"
  2.3950 +lemma SET_MINIMUM: "ALL (s::'a::type => bool) M::'a::type => nat.
  2.3951 +   (EX x::'a::type. IN x s) =
  2.3952 +   (EX x::'a::type. IN x s & (ALL y::'a::type. IN y s --> M x <= M y))"
  2.3953    by (import pred_set SET_MINIMUM)
  2.3954  
  2.3955  constdefs
  2.3956 -  EMPTY :: "'a => bool" 
  2.3957 -  "EMPTY == %x. False"
  2.3958 -
  2.3959 -lemma EMPTY_DEF: "EMPTY = (%x. False)"
  2.3960 +  EMPTY :: "'a::type => bool" 
  2.3961 +  "EMPTY == %x::'a::type. False"
  2.3962 +
  2.3963 +lemma EMPTY_DEF: "EMPTY = (%x::'a::type. False)"
  2.3964    by (import pred_set EMPTY_DEF)
  2.3965  
  2.3966 -lemma NOT_IN_EMPTY: "ALL x. ~ IN x EMPTY"
  2.3967 +lemma NOT_IN_EMPTY: "ALL x::'a::type. ~ IN x EMPTY"
  2.3968    by (import pred_set NOT_IN_EMPTY)
  2.3969  
  2.3970 -lemma MEMBER_NOT_EMPTY: "ALL x. (EX xa. IN xa x) = (x ~= EMPTY)"
  2.3971 +lemma MEMBER_NOT_EMPTY: "ALL x::'a::type => bool. (EX xa::'a::type. IN xa x) = (x ~= EMPTY)"
  2.3972    by (import pred_set MEMBER_NOT_EMPTY)
  2.3973  
  2.3974  consts
  2.3975 -  UNIV :: "'a => bool" 
  2.3976 +  UNIV :: "'a::type => bool" 
  2.3977  
  2.3978  defs
  2.3979 -  UNIV_def: "pred_set.UNIV == %x. True"
  2.3980 -
  2.3981 -lemma UNIV_DEF: "pred_set.UNIV = (%x. True)"
  2.3982 +  UNIV_def: "pred_set.UNIV == %x::'a::type. True"
  2.3983 +
  2.3984 +lemma UNIV_DEF: "pred_set.UNIV = (%x::'a::type. True)"
  2.3985    by (import pred_set UNIV_DEF)
  2.3986  
  2.3987 -lemma IN_UNIV: "ALL x. IN x pred_set.UNIV"
  2.3988 +lemma IN_UNIV: "ALL x::'a::type. IN x pred_set.UNIV"
  2.3989    by (import pred_set IN_UNIV)
  2.3990  
  2.3991  lemma UNIV_NOT_EMPTY: "pred_set.UNIV ~= EMPTY"
  2.3992 @@ -2788,868 +3287,1025 @@
  2.3993  lemma EMPTY_NOT_UNIV: "EMPTY ~= pred_set.UNIV"
  2.3994    by (import pred_set EMPTY_NOT_UNIV)
  2.3995  
  2.3996 -lemma EQ_UNIV: "(ALL x. IN x s) = (s = pred_set.UNIV)"
  2.3997 +lemma EQ_UNIV: "(ALL x::'a::type. IN x (s::'a::type => bool)) = (s = pred_set.UNIV)"
  2.3998    by (import pred_set EQ_UNIV)
  2.3999  
  2.4000  constdefs
  2.4001 -  SUBSET :: "('a => bool) => ('a => bool) => bool" 
  2.4002 -  "SUBSET == %s t. ALL x. IN x s --> IN x t"
  2.4003 -
  2.4004 -lemma SUBSET_DEF: "ALL s t. SUBSET s t = (ALL x. IN x s --> IN x t)"
  2.4005 +  SUBSET :: "('a::type => bool) => ('a::type => bool) => bool" 
  2.4006 +  "SUBSET ==
  2.4007 +%(s::'a::type => bool) t::'a::type => bool.
  2.4008 +   ALL x::'a::type. IN x s --> IN x t"
  2.4009 +
  2.4010 +lemma SUBSET_DEF: "ALL (s::'a::type => bool) t::'a::type => bool.
  2.4011 +   SUBSET s t = (ALL x::'a::type. IN x s --> IN x t)"
  2.4012    by (import pred_set SUBSET_DEF)
  2.4013  
  2.4014 -lemma SUBSET_TRANS: "ALL x xa xb. SUBSET x xa & SUBSET xa xb --> SUBSET x xb"
  2.4015 +lemma SUBSET_TRANS: "ALL (x::'a::type => bool) (xa::'a::type => bool) xb::'a::type => bool.
  2.4016 +   SUBSET x xa & SUBSET xa xb --> SUBSET x xb"
  2.4017    by (import pred_set SUBSET_TRANS)
  2.4018  
  2.4019 -lemma SUBSET_REFL: "ALL x. SUBSET x x"
  2.4020 +lemma SUBSET_REFL: "ALL x::'a::type => bool. SUBSET x x"
  2.4021    by (import pred_set SUBSET_REFL)
  2.4022  
  2.4023 -lemma SUBSET_ANTISYM: "ALL x xa. SUBSET x xa & SUBSET xa x --> x = xa"
  2.4024 +lemma SUBSET_ANTISYM: "ALL (x::'a::type => bool) xa::'a::type => bool.
  2.4025 +   SUBSET x xa & SUBSET xa x --> x = xa"
  2.4026    by (import pred_set SUBSET_ANTISYM)
  2.4027  
  2.4028  lemma EMPTY_SUBSET: "All (SUBSET EMPTY)"
  2.4029    by (import pred_set EMPTY_SUBSET)
  2.4030  
  2.4031 -lemma SUBSET_EMPTY: "ALL x. SUBSET x EMPTY = (x = EMPTY)"
  2.4032 +lemma SUBSET_EMPTY: "ALL x::'a::type => bool. SUBSET x EMPTY = (x = EMPTY)"
  2.4033    by (import pred_set SUBSET_EMPTY)
  2.4034  
  2.4035 -lemma SUBSET_UNIV: "ALL x. SUBSET x pred_set.UNIV"
  2.4036 +lemma SUBSET_UNIV: "ALL x::'a::type => bool. SUBSET x pred_set.UNIV"
  2.4037    by (import pred_set SUBSET_UNIV)
  2.4038  
  2.4039 -lemma UNIV_SUBSET: "ALL x. SUBSET pred_set.UNIV x = (x = pred_set.UNIV)"
  2.4040 +lemma UNIV_SUBSET: "ALL x::'a::type => bool. SUBSET pred_set.UNIV x = (x = pred_set.UNIV)"
  2.4041    by (import pred_set UNIV_SUBSET)
  2.4042  
  2.4043  constdefs
  2.4044 -  PSUBSET :: "('a => bool) => ('a => bool) => bool" 
  2.4045 -  "PSUBSET == %s t. SUBSET s t & s ~= t"
  2.4046 -
  2.4047 -lemma PSUBSET_DEF: "ALL s t. PSUBSET s t = (SUBSET s t & s ~= t)"
  2.4048 +  PSUBSET :: "('a::type => bool) => ('a::type => bool) => bool" 
  2.4049 +  "PSUBSET == %(s::'a::type => bool) t::'a::type => bool. SUBSET s t & s ~= t"
  2.4050 +
  2.4051 +lemma PSUBSET_DEF: "ALL (s::'a::type => bool) t::'a::type => bool.
  2.4052 +   PSUBSET s t = (SUBSET s t & s ~= t)"
  2.4053    by (import pred_set PSUBSET_DEF)
  2.4054  
  2.4055 -lemma PSUBSET_TRANS: "ALL x xa xb. PSUBSET x xa & PSUBSET xa xb --> PSUBSET x xb"
  2.4056 +lemma PSUBSET_TRANS: "ALL (x::'a::type => bool) (xa::'a::type => bool) xb::'a::type => bool.
  2.4057 +   PSUBSET x xa & PSUBSET xa xb --> PSUBSET x xb"
  2.4058    by (import pred_set PSUBSET_TRANS)
  2.4059  
  2.4060 -lemma PSUBSET_IRREFL: "ALL x. ~ PSUBSET x x"
  2.4061 +lemma PSUBSET_IRREFL: "ALL x::'a::type => bool. ~ PSUBSET x x"
  2.4062    by (import pred_set PSUBSET_IRREFL)
  2.4063  
  2.4064 -lemma NOT_PSUBSET_EMPTY: "ALL x. ~ PSUBSET x EMPTY"
  2.4065 +lemma NOT_PSUBSET_EMPTY: "ALL x::'a::type => bool. ~ PSUBSET x EMPTY"
  2.4066    by (import pred_set NOT_PSUBSET_EMPTY)
  2.4067  
  2.4068 -lemma NOT_UNIV_PSUBSET: "ALL x. ~ PSUBSET pred_set.UNIV x"
  2.4069 +lemma NOT_UNIV_PSUBSET: "ALL x::'a::type => bool. ~ PSUBSET pred_set.UNIV x"
  2.4070    by (import pred_set NOT_UNIV_PSUBSET)
  2.4071  
  2.4072 -lemma PSUBSET_UNIV: "ALL x. PSUBSET x pred_set.UNIV = (EX xa. ~ IN xa x)"
  2.4073 +lemma PSUBSET_UNIV: "ALL x::'a::type => bool.
  2.4074 +   PSUBSET x pred_set.UNIV = (EX xa::'a::type. ~ IN xa x)"
  2.4075    by (import pred_set PSUBSET_UNIV)
  2.4076  
  2.4077  consts
  2.4078 -  UNION :: "('a => bool) => ('a => bool) => 'a => bool" 
  2.4079 +  UNION :: "('a::type => bool) => ('a::type => bool) => 'a::type => bool" 
  2.4080  
  2.4081  defs
  2.4082 -  UNION_def: "pred_set.UNION == %s t. GSPEC (%x. (x, IN x s | IN x t))"
  2.4083 -
  2.4084 -lemma UNION_DEF: "ALL s t. pred_set.UNION s t = GSPEC (%x. (x, IN x s | IN x t))"
  2.4085 +  UNION_def: "pred_set.UNION ==
  2.4086 +%(s::'a::type => bool) t::'a::type => bool.
  2.4087 +   GSPEC (%x::'a::type. (x, IN x s | IN x t))"
  2.4088 +
  2.4089 +lemma UNION_DEF: "ALL (s::'a::type => bool) t::'a::type => bool.
  2.4090 +   pred_set.UNION s t = GSPEC (%x::'a::type. (x, IN x s | IN x t))"
  2.4091    by (import pred_set UNION_DEF)
  2.4092  
  2.4093 -lemma IN_UNION: "ALL x xa xb. IN xb (pred_set.UNION x xa) = (IN xb x | IN xb xa)"
  2.4094 +lemma IN_UNION: "ALL (x::'a::type => bool) (xa::'a::type => bool) xb::'a::type.
  2.4095 +   IN xb (pred_set.UNION x xa) = (IN xb x | IN xb xa)"
  2.4096    by (import pred_set IN_UNION)
  2.4097  
  2.4098 -lemma UNION_ASSOC: "ALL x xa xb.
  2.4099 +lemma UNION_ASSOC: "ALL (x::'a::type => bool) (xa::'a::type => bool) xb::'a::type => bool.
  2.4100     pred_set.UNION x (pred_set.UNION xa xb) =
  2.4101     pred_set.UNION (pred_set.UNION x xa) xb"
  2.4102    by (import pred_set UNION_ASSOC)
  2.4103  
  2.4104 -lemma UNION_IDEMPOT: "ALL x. pred_set.UNION x x = x"
  2.4105 +lemma UNION_IDEMPOT: "ALL x::'a::type => bool. pred_set.UNION x x = x"
  2.4106    by (import pred_set UNION_IDEMPOT)
  2.4107  
  2.4108 -lemma UNION_COMM: "ALL x xa. pred_set.UNION x xa = pred_set.UNION xa x"
  2.4109 +lemma UNION_COMM: "ALL (x::'a::type => bool) xa::'a::type => bool.
  2.4110 +   pred_set.UNION x xa = pred_set.UNION xa x"
  2.4111    by (import pred_set UNION_COMM)
  2.4112  
  2.4113 -lemma SUBSET_UNION: "(ALL (x::'a => bool) xa::'a => bool. SUBSET x (pred_set.UNION x xa)) &
  2.4114 -(ALL (x::'a => bool) xa::'a => bool. SUBSET x (pred_set.UNION xa x))"
  2.4115 +lemma SUBSET_UNION: "(ALL (x::'a::type => bool) xa::'a::type => bool.
  2.4116 +    SUBSET x (pred_set.UNION x xa)) &
  2.4117 +(ALL (x::'a::type => bool) xa::'a::type => bool.
  2.4118 +    SUBSET x (pred_set.UNION xa x))"
  2.4119    by (import pred_set SUBSET_UNION)
  2.4120  
  2.4121 -lemma UNION_SUBSET: "ALL s t u. SUBSET (pred_set.UNION s t) u = (SUBSET s u & SUBSET t u)"
  2.4122 +lemma UNION_SUBSET: "ALL (s::'a::type => bool) (t::'a::type => bool) u::'a::type => bool.
  2.4123 +   SUBSET (pred_set.UNION s t) u = (SUBSET s u & SUBSET t u)"
  2.4124    by (import pred_set UNION_SUBSET)
  2.4125  
  2.4126 -lemma SUBSET_UNION_ABSORPTION: "ALL x xa. SUBSET x xa = (pred_set.UNION x xa = xa)"
  2.4127 +lemma SUBSET_UNION_ABSORPTION: "ALL (x::'a::type => bool) xa::'a::type => bool.
  2.4128 +   SUBSET x xa = (pred_set.UNION x xa = xa)"
  2.4129    by (import pred_set SUBSET_UNION_ABSORPTION)
  2.4130  
  2.4131 -lemma UNION_EMPTY: "(ALL x::'a => bool. pred_set.UNION EMPTY x = x) &
  2.4132 -(ALL x::'a => bool. pred_set.UNION x EMPTY = x)"
  2.4133 +lemma UNION_EMPTY: "(ALL x::'a::type => bool. pred_set.UNION EMPTY x = x) &
  2.4134 +(ALL x::'a::type => bool. pred_set.UNION x EMPTY = x)"
  2.4135    by (import pred_set UNION_EMPTY)
  2.4136  
  2.4137 -lemma UNION_UNIV: "(ALL x::'a => bool. pred_set.UNION pred_set.UNIV x = pred_set.UNIV) &
  2.4138 -(ALL x::'a => bool. pred_set.UNION x pred_set.UNIV = pred_set.UNIV)"
  2.4139 +lemma UNION_UNIV: "(ALL x::'a::type => bool. pred_set.UNION pred_set.UNIV x = pred_set.UNIV) &
  2.4140 +(ALL x::'a::type => bool. pred_set.UNION x pred_set.UNIV = pred_set.UNIV)"
  2.4141    by (import pred_set UNION_UNIV)
  2.4142  
  2.4143 -lemma EMPTY_UNION: "ALL x xa. (pred_set.UNION x xa = EMPTY) = (x = EMPTY & xa = EMPTY)"
  2.4144 +lemma EMPTY_UNION: "ALL (x::'a::type => bool) xa::'a::type => bool.
  2.4145 +   (pred_set.UNION x xa = EMPTY) = (x = EMPTY & xa = EMPTY)"
  2.4146    by (import pred_set EMPTY_UNION)
  2.4147  
  2.4148  consts
  2.4149 -  INTER :: "('a => bool) => ('a => bool) => 'a => bool" 
  2.4150 +  INTER :: "('a::type => bool) => ('a::type => bool) => 'a::type => bool" 
  2.4151  
  2.4152  defs
  2.4153 -  INTER_def: "pred_set.INTER == %s t. GSPEC (%x. (x, IN x s & IN x t))"
  2.4154 -
  2.4155 -lemma INTER_DEF: "ALL s t. pred_set.INTER s t = GSPEC (%x. (x, IN x s & IN x t))"
  2.4156 +  INTER_def: "pred_set.INTER ==
  2.4157 +%(s::'a::type => bool) t::'a::type => bool.
  2.4158 +   GSPEC (%x::'a::type. (x, IN x s & IN x t))"
  2.4159 +
  2.4160 +lemma INTER_DEF: "ALL (s::'a::type => bool) t::'a::type => bool.
  2.4161 +   pred_set.INTER s t = GSPEC (%x::'a::type. (x, IN x s & IN x t))"
  2.4162    by (import pred_set INTER_DEF)
  2.4163  
  2.4164 -lemma IN_INTER: "ALL x xa xb. IN xb (pred_set.INTER x xa) = (IN xb x & IN xb xa)"
  2.4165 +lemma IN_INTER: "ALL (x::'a::type => bool) (xa::'a::type => bool) xb::'a::type.
  2.4166 +   IN xb (pred_set.INTER x xa) = (IN xb x & IN xb xa)"
  2.4167    by (import pred_set IN_INTER)
  2.4168  
  2.4169 -lemma INTER_ASSOC: "ALL x xa xb.
  2.4170 +lemma INTER_ASSOC: "ALL (x::'a::type => bool) (xa::'a::type => bool) xb::'a::type => bool.
  2.4171     pred_set.INTER x (pred_set.INTER xa xb) =
  2.4172     pred_set.INTER (pred_set.INTER x xa) xb"
  2.4173    by (import pred_set INTER_ASSOC)
  2.4174  
  2.4175 -lemma INTER_IDEMPOT: "ALL x. pred_set.INTER x x = x"
  2.4176 +lemma INTER_IDEMPOT: "ALL x::'a::type => bool. pred_set.INTER x x = x"
  2.4177    by (import pred_set INTER_IDEMPOT)
  2.4178  
  2.4179 -lemma INTER_COMM: "ALL x xa. pred_set.INTER x xa = pred_set.INTER xa x"
  2.4180 +lemma INTER_COMM: "ALL (x::'a::type => bool) xa::'a::type => bool.
  2.4181 +   pred_set.INTER x xa = pred_set.INTER xa x"
  2.4182    by (import pred_set INTER_COMM)
  2.4183  
  2.4184 -lemma INTER_SUBSET: "(ALL (x::'a => bool) xa::'a => bool. SUBSET (pred_set.INTER x xa) x) &
  2.4185 -(ALL (x::'a => bool) xa::'a => bool. SUBSET (pred_set.INTER xa x) x)"
  2.4186 +lemma INTER_SUBSET: "(ALL (x::'a::type => bool) xa::'a::type => bool.
  2.4187 +    SUBSET (pred_set.INTER x xa) x) &
  2.4188 +(ALL (x::'a::type => bool) xa::'a::type => bool.
  2.4189 +    SUBSET (pred_set.INTER xa x) x)"
  2.4190    by (import pred_set INTER_SUBSET)
  2.4191  
  2.4192 -lemma SUBSET_INTER: "ALL s t u. SUBSET s (pred_set.INTER t u) = (SUBSET s t & SUBSET s u)"
  2.4193 +lemma SUBSET_INTER: "ALL (s::'a::type => bool) (t::'a::type => bool) u::'a::type => bool.
  2.4194 +   SUBSET s (pred_set.INTER t u) = (SUBSET s t & SUBSET s u)"
  2.4195    by (import pred_set SUBSET_INTER)
  2.4196  
  2.4197 -lemma SUBSET_INTER_ABSORPTION: "ALL x xa. SUBSET x xa = (pred_set.INTER x xa = x)"
  2.4198 +lemma SUBSET_INTER_ABSORPTION: "ALL (x::'a::type => bool) xa::'a::type => bool.
  2.4199 +   SUBSET x xa = (pred_set.INTER x xa = x)"
  2.4200    by (import pred_set SUBSET_INTER_ABSORPTION)
  2.4201  
  2.4202 -lemma INTER_EMPTY: "(ALL x::'a => bool. pred_set.INTER EMPTY x = EMPTY) &
  2.4203 -(ALL x::'a => bool. pred_set.INTER x EMPTY = EMPTY)"
  2.4204 +lemma INTER_EMPTY: "(ALL x::'a::type => bool. pred_set.INTER EMPTY x = EMPTY) &
  2.4205 +(ALL x::'a::type => bool. pred_set.INTER x EMPTY = EMPTY)"
  2.4206    by (import pred_set INTER_EMPTY)
  2.4207  
  2.4208 -lemma INTER_UNIV: "(ALL x::'a => bool. pred_set.INTER pred_set.UNIV x = x) &
  2.4209 -(ALL x::'a => bool. pred_set.INTER x pred_set.UNIV = x)"
  2.4210 +lemma INTER_UNIV: "(ALL x::'a::type => bool. pred_set.INTER pred_set.UNIV x = x) &
  2.4211 +(ALL x::'a::type => bool. pred_set.INTER x pred_set.UNIV = x)"
  2.4212    by (import pred_set INTER_UNIV)
  2.4213  
  2.4214 -lemma UNION_OVER_INTER: "ALL x xa xb.
  2.4215 +lemma UNION_OVER_INTER: "ALL (x::'a::type => bool) (xa::'a::type => bool) xb::'a::type => bool.
  2.4216     pred_set.INTER x (pred_set.UNION xa xb) =
  2.4217     pred_set.UNION (pred_set.INTER x xa) (pred_set.INTER x xb)"
  2.4218    by (import pred_set UNION_OVER_INTER)
  2.4219  
  2.4220 -lemma INTER_OVER_UNION: "ALL x xa xb.
  2.4221 +lemma INTER_OVER_UNION: "ALL (x::'a::type => bool) (xa::'a::type => bool) xb::'a::type => bool.
  2.4222     pred_set.UNION x (pred_set.INTER xa xb) =
  2.4223     pred_set.INTER (pred_set.UNION x xa) (pred_set.UNION x xb)"
  2.4224    by (import pred_set INTER_OVER_UNION)
  2.4225  
  2.4226  constdefs
  2.4227 -  DISJOINT :: "('a => bool) => ('a => bool) => bool" 
  2.4228 -  "DISJOINT == %s t. pred_set.INTER s t = EMPTY"
  2.4229 -
  2.4230 -lemma DISJOINT_DEF: "ALL s t. DISJOINT s t = (pred_set.INTER s t = EMPTY)"
  2.4231 +  DISJOINT :: "('a::type => bool) => ('a::type => bool) => bool" 
  2.4232 +  "DISJOINT ==
  2.4233 +%(s::'a::type => bool) t::'a::type => bool. pred_set.INTER s t = EMPTY"
  2.4234 +
  2.4235 +lemma DISJOINT_DEF: "ALL (s::'a::type => bool) t::'a::type => bool.
  2.4236 +   DISJOINT s t = (pred_set.INTER s t = EMPTY)"
  2.4237    by (import pred_set DISJOINT_DEF)
  2.4238  
  2.4239 -lemma IN_DISJOINT: "ALL x xa. DISJOINT x xa = (~ (EX xb. IN xb x & IN xb xa))"
  2.4240 +lemma IN_DISJOINT: "ALL (x::'a::type => bool) xa::'a::type => bool.
  2.4241 +   DISJOINT x xa = (~ (EX xb::'a::type. IN xb x & IN xb xa))"
  2.4242    by (import pred_set IN_DISJOINT)
  2.4243  
  2.4244 -lemma DISJOINT_SYM: "ALL x xa. DISJOINT x xa = DISJOINT xa x"
  2.4245 +lemma DISJOINT_SYM: "ALL (x::'a::type => bool) xa::'a::type => bool.
  2.4246 +   DISJOINT x xa = DISJOINT xa x"
  2.4247    by (import pred_set DISJOINT_SYM)
  2.4248  
  2.4249 -lemma DISJOINT_EMPTY: "ALL x. DISJOINT EMPTY x & DISJOINT x EMPTY"
  2.4250 +lemma DISJOINT_EMPTY: "ALL x::'a::type => bool. DISJOINT EMPTY x & DISJOINT x EMPTY"
  2.4251    by (import pred_set DISJOINT_EMPTY)
  2.4252  
  2.4253 -lemma DISJOINT_EMPTY_REFL: "ALL x. (x = EMPTY) = DISJOINT x x"
  2.4254 +lemma DISJOINT_EMPTY_REFL: "ALL x::'a::type => bool. (x = EMPTY) = DISJOINT x x"
  2.4255    by (import pred_set DISJOINT_EMPTY_REFL)
  2.4256  
  2.4257 -lemma DISJOINT_UNION: "ALL x xa xb.
  2.4258 +lemma DISJOINT_UNION: "ALL (x::'a::type => bool) (xa::'a::type => bool) xb::'a::type => bool.
  2.4259     DISJOINT (pred_set.UNION x xa) xb = (DISJOINT x xb & DISJOINT xa xb)"
  2.4260    by (import pred_set DISJOINT_UNION)
  2.4261  
  2.4262 -lemma DISJOINT_UNION_BOTH: "ALL s t u.
  2.4263 +lemma DISJOINT_UNION_BOTH: "ALL (s::'a::type => bool) (t::'a::type => bool) u::'a::type => bool.
  2.4264     DISJOINT (pred_set.UNION s t) u = (DISJOINT s u & DISJOINT t u) &
  2.4265     DISJOINT u (pred_set.UNION s t) = (DISJOINT s u & DISJOINT t u)"
  2.4266    by (import pred_set DISJOINT_UNION_BOTH)
  2.4267  
  2.4268  constdefs
  2.4269 -  DIFF :: "('a => bool) => ('a => bool) => 'a => bool" 
  2.4270 -  "DIFF == %s t. GSPEC (%x. (x, IN x s & ~ IN x t))"
  2.4271 -
  2.4272 -lemma DIFF_DEF: "ALL s t. DIFF s t = GSPEC (%x. (x, IN x s & ~ IN x t))"
  2.4273 +  DIFF :: "('a::type => bool) => ('a::type => bool) => 'a::type => bool" 
  2.4274 +  "DIFF ==
  2.4275 +%(s::'a::type => bool) t::'a::type => bool.
  2.4276 +   GSPEC (%x::'a::type. (x, IN x s & ~ IN x t))"
  2.4277 +
  2.4278 +lemma DIFF_DEF: "ALL (s::'a::type => bool) t::'a::type => bool.
  2.4279 +   DIFF s t = GSPEC (%x::'a::type. (x, IN x s & ~ IN x t))"
  2.4280    by (import pred_set DIFF_DEF)
  2.4281  
  2.4282 -lemma IN_DIFF: "ALL s t x. IN x (DIFF s t) = (IN x s & ~ IN x t)"
  2.4283 +lemma IN_DIFF: "ALL (s::'a::type => bool) (t::'a::type => bool) x::'a::type.
  2.4284 +   IN x (DIFF s t) = (IN x s & ~ IN x t)"
  2.4285    by (import pred_set IN_DIFF)
  2.4286  
  2.4287 -lemma DIFF_EMPTY: "ALL s. DIFF s EMPTY = s"
  2.4288 +lemma DIFF_EMPTY: "ALL s::'a::type => bool. DIFF s EMPTY = s"
  2.4289    by (import pred_set DIFF_EMPTY)
  2.4290  
  2.4291 -lemma EMPTY_DIFF: "ALL s. DIFF EMPTY s = EMPTY"
  2.4292 +lemma EMPTY_DIFF: "ALL s::'a::type => bool. DIFF EMPTY s = EMPTY"
  2.4293    by (import pred_set EMPTY_DIFF)
  2.4294  
  2.4295 -lemma DIFF_UNIV: "ALL s. DIFF s pred_set.UNIV = EMPTY"
  2.4296 +lemma DIFF_UNIV: "ALL s::'a::type => bool. DIFF s pred_set.UNIV = EMPTY"
  2.4297    by (import pred_set DIFF_UNIV)
  2.4298  
  2.4299 -lemma DIFF_DIFF: "ALL x xa. DIFF (DIFF x xa) xa = DIFF x xa"
  2.4300 +lemma DIFF_DIFF: "ALL (x::'a::type => bool) xa::'a::type => bool.
  2.4301 +   DIFF (DIFF x xa) xa = DIFF x xa"
  2.4302    by (import pred_set DIFF_DIFF)
  2.4303  
  2.4304 -lemma DIFF_EQ_EMPTY: "ALL x. DIFF x x = EMPTY"
  2.4305 +lemma DIFF_EQ_EMPTY: "ALL x::'a::type => bool. DIFF x x = EMPTY"
  2.4306    by (import pred_set DIFF_EQ_EMPTY)
  2.4307  
  2.4308  constdefs
  2.4309 -  INSERT :: "'a => ('a => bool) => 'a => bool" 
  2.4310 -  "INSERT == %x s. GSPEC (%y. (y, y = x | IN y s))"
  2.4311 -
  2.4312 -lemma INSERT_DEF: "ALL x s. INSERT x s = GSPEC (%y. (y, y = x | IN y s))"
  2.4313 +  INSERT :: "'a::type => ('a::type => bool) => 'a::type => bool" 
  2.4314 +  "INSERT ==
  2.4315 +%(x::'a::type) s::'a::type => bool.
  2.4316 +   GSPEC (%y::'a::type. (y, y = x | IN y s))"
  2.4317 +
  2.4318 +lemma INSERT_DEF: "ALL (x::'a::type) s::'a::type => bool.
  2.4319 +   INSERT x s = GSPEC (%y::'a::type. (y, y = x | IN y s))"
  2.4320    by (import pred_set INSERT_DEF)
  2.4321  
  2.4322 -lemma IN_INSERT: "ALL x xa xb. IN x (INSERT xa xb) = (x = xa | IN x xb)"
  2.4323 +lemma IN_INSERT: "ALL (x::'a::type) (xa::'a::type) xb::'a::type => bool.
  2.4324 +   IN x (INSERT xa xb) = (x = xa | IN x xb)"
  2.4325    by (import pred_set IN_INSERT)
  2.4326  
  2.4327 -lemma COMPONENT: "ALL x xa. IN x (INSERT x xa)"
  2.4328 +lemma COMPONENT: "ALL (x::'a::type) xa::'a::type => bool. IN x (INSERT x xa)"
  2.4329    by (import pred_set COMPONENT)
  2.4330  
  2.4331 -lemma SET_CASES: "ALL x. x = EMPTY | (EX xa xb. x = INSERT xa xb & ~ IN xa xb)"
  2.4332 +lemma SET_CASES: "ALL x::'a::type => bool.
  2.4333 +   x = EMPTY |
  2.4334 +   (EX (xa::'a::type) xb::'a::type => bool. x = INSERT xa xb & ~ IN xa xb)"
  2.4335    by (import pred_set SET_CASES)
  2.4336  
  2.4337 -lemma DECOMPOSITION: "ALL s x. IN x s = (EX t. s = INSERT x t & ~ IN x t)"
  2.4338 +lemma DECOMPOSITION: "ALL (s::'a::type => bool) x::'a::type.
  2.4339 +   IN x s = (EX t::'a::type => bool. s = INSERT x t & ~ IN x t)"
  2.4340    by (import pred_set DECOMPOSITION)
  2.4341  
  2.4342 -lemma ABSORPTION: "ALL x xa. IN x xa = (INSERT x xa = xa)"
  2.4343 +lemma ABSORPTION: "ALL (x::'a::type) xa::'a::type => bool. IN x xa = (INSERT x xa = xa)"
  2.4344    by (import pred_set ABSORPTION)
  2.4345  
  2.4346 -lemma INSERT_INSERT: "ALL x xa. INSERT x (INSERT x xa) = INSERT x xa"
  2.4347 +lemma INSERT_INSERT: "ALL (x::'a::type) xa::'a::type => bool. INSERT x (INSERT x xa) = INSERT x xa"
  2.4348    by (import pred_set INSERT_INSERT)
  2.4349  
  2.4350 -lemma INSERT_COMM: "ALL x xa xb. INSERT x (INSERT xa xb) = INSERT xa (INSERT x xb)"
  2.4351 +lemma INSERT_COMM: "ALL (x::'a::type) (xa::'a::type) xb::'a::type => bool.
  2.4352 +   INSERT x (INSERT xa xb) = INSERT xa (INSERT x xb)"
  2.4353    by (import pred_set INSERT_COMM)
  2.4354  
  2.4355 -lemma INSERT_UNIV: "ALL x. INSERT x pred_set.UNIV = pred_set.UNIV"
  2.4356 +lemma INSERT_UNIV: "ALL x::'a::type. INSERT x pred_set.UNIV = pred_set.UNIV"
  2.4357    by (import pred_set INSERT_UNIV)
  2.4358  
  2.4359 -lemma NOT_INSERT_EMPTY: "ALL x xa. INSERT x xa ~= EMPTY"
  2.4360 +lemma NOT_INSERT_EMPTY: "ALL (x::'a::type) xa::'a::type => bool. INSERT x xa ~= EMPTY"
  2.4361    by (import pred_set NOT_INSERT_EMPTY)
  2.4362  
  2.4363 -lemma NOT_EMPTY_INSERT: "ALL x xa. EMPTY ~= INSERT x xa"
  2.4364 +lemma NOT_EMPTY_INSERT: "ALL (x::'a::type) xa::'a::type => bool. EMPTY ~= INSERT x xa"
  2.4365    by (import pred_set NOT_EMPTY_INSERT)
  2.4366  
  2.4367 -lemma INSERT_UNION: "ALL x s t.
  2.4368 +lemma INSERT_UNION: "ALL (x::'a::type) (s::'a::type => bool) t::'a::type => bool.
  2.4369     pred_set.UNION (INSERT x s) t =
  2.4370     (if IN x t then pred_set.UNION s t else INSERT x (pred_set.UNION s t))"
  2.4371    by (import pred_set INSERT_UNION)
  2.4372  
  2.4373 -lemma INSERT_UNION_EQ: "ALL x s t. pred_set.UNION (INSERT x s) t = INSERT x (pred_set.UNION s t)"
  2.4374 +lemma INSERT_UNION_EQ: "ALL (x::'a::type) (s::'a::type => bool) t::'a::type => bool.
  2.4375 +   pred_set.UNION (INSERT x s) t = INSERT x (pred_set.UNION s t)"
  2.4376    by (import pred_set INSERT_UNION_EQ)
  2.4377  
  2.4378 -lemma INSERT_INTER: "ALL x s t.
  2.4379 +lemma INSERT_INTER: "ALL (x::'a::type) (s::'a::type => bool) t::'a::type => bool.
  2.4380     pred_set.INTER (INSERT x s) t =
  2.4381     (if IN x t then INSERT x (pred_set.INTER s t) else pred_set.INTER s t)"
  2.4382    by (import pred_set INSERT_INTER)
  2.4383  
  2.4384 -lemma DISJOINT_INSERT: "ALL x xa xb. DISJOINT (INSERT x xa) xb = (DISJOINT xa xb & ~ IN x xb)"
  2.4385 +lemma DISJOINT_INSERT: "ALL (x::'a::type) (xa::'a::type => bool) xb::'a::type => bool.
  2.4386 +   DISJOINT (INSERT x xa) xb = (DISJOINT xa xb & ~ IN x xb)"
  2.4387    by (import pred_set DISJOINT_INSERT)
  2.4388  
  2.4389 -lemma INSERT_SUBSET: "ALL x xa xb. SUBSET (INSERT x xa) xb = (IN x xb & SUBSET xa xb)"
  2.4390 +lemma INSERT_SUBSET: "ALL (x::'a::type) (xa::'a::type => bool) xb::'a::type => bool.
  2.4391 +   SUBSET (INSERT x xa) xb = (IN x xb & SUBSET xa xb)"
  2.4392    by (import pred_set INSERT_SUBSET)
  2.4393  
  2.4394 -lemma SUBSET_INSERT: "ALL x xa. ~ IN x xa --> (ALL xb. SUBSET xa (INSERT x xb) = SUBSET xa xb)"
  2.4395 +lemma SUBSET_INSERT: "ALL (x::'a::type) xa::'a::type => bool.
  2.4396 +   ~ IN x xa -->
  2.4397 +   (ALL xb::'a::type => bool. SUBSET xa (INSERT x xb) = SUBSET xa xb)"
  2.4398    by (import pred_set SUBSET_INSERT)
  2.4399  
  2.4400 -lemma INSERT_DIFF: "ALL s t x.
  2.4401 +lemma INSERT_DIFF: "ALL (s::'a::type => bool) (t::'a::type => bool) x::'a::type.
  2.4402     DIFF (INSERT x s) t = (if IN x t then DIFF s t else INSERT x (DIFF s t))"
  2.4403    by (import pred_set INSERT_DIFF)
  2.4404  
  2.4405  constdefs
  2.4406 -  DELETE :: "('a => bool) => 'a => 'a => bool" 
  2.4407 -  "DELETE == %s x. DIFF s (INSERT x EMPTY)"
  2.4408 -
  2.4409 -lemma DELETE_DEF: "ALL s x. DELETE s x = DIFF s (INSERT x EMPTY)"
  2.4410 +  DELETE :: "('a::type => bool) => 'a::type => 'a::type => bool" 
  2.4411 +  "DELETE == %(s::'a::type => bool) x::'a::type. DIFF s (INSERT x EMPTY)"
  2.4412 +
  2.4413 +lemma DELETE_DEF: "ALL (s::'a::type => bool) x::'a::type. DELETE s x = DIFF s (INSERT x EMPTY)"
  2.4414    by (import pred_set DELETE_DEF)
  2.4415  
  2.4416 -lemma IN_DELETE: "ALL x xa xb. IN xa (DELETE x xb) = (IN xa x & xa ~= xb)"
  2.4417 +lemma IN_DELETE: "ALL (x::'a::type => bool) (xa::'a::type) xb::'a::type.
  2.4418 +   IN xa (DELETE x xb) = (IN xa x & xa ~= xb)"
  2.4419    by (import pred_set IN_DELETE)
  2.4420  
  2.4421 -lemma DELETE_NON_ELEMENT: "ALL x xa. (~ IN x xa) = (DELETE xa x = xa)"
  2.4422 +lemma DELETE_NON_ELEMENT: "ALL (x::'a::type) xa::'a::type => bool. (~ IN x xa) = (DELETE xa x = xa)"
  2.4423    by (import pred_set DELETE_NON_ELEMENT)
  2.4424  
  2.4425 -lemma IN_DELETE_EQ: "ALL s x x'. (IN x s = IN x' s) = (IN x (DELETE s x') = IN x' (DELETE s x))"
  2.4426 +lemma IN_DELETE_EQ: "ALL (s::'a::type => bool) (x::'a::type) x'::'a::type.
  2.4427 +   (IN x s = IN x' s) = (IN x (DELETE s x') = IN x' (DELETE s x))"
  2.4428    by (import pred_set IN_DELETE_EQ)
  2.4429  
  2.4430 -lemma EMPTY_DELETE: "ALL x. DELETE EMPTY x = EMPTY"
  2.4431 +lemma EMPTY_DELETE: "ALL x::'a::type. DELETE EMPTY x = EMPTY"
  2.4432    by (import pred_set EMPTY_DELETE)
  2.4433  
  2.4434 -lemma DELETE_DELETE: "ALL x xa. DELETE (DELETE xa x) x = DELETE xa x"
  2.4435 +lemma DELETE_DELETE: "ALL (x::'a::type) xa::'a::type => bool. DELETE (DELETE xa x) x = DELETE xa x"
  2.4436    by (import pred_set DELETE_DELETE)
  2.4437  
  2.4438 -lemma DELETE_COMM: "ALL x xa xb. DELETE (DELETE xb x) xa = DELETE (DELETE xb xa) x"
  2.4439 +lemma DELETE_COMM: "ALL (x::'a::type) (xa::'a::type) xb::'a::type => bool.
  2.4440 +   DELETE (DELETE xb x) xa = DELETE (DELETE xb xa) x"
  2.4441    by (import pred_set DELETE_COMM)
  2.4442  
  2.4443 -lemma DELETE_SUBSET: "ALL x xa. SUBSET (DELETE xa x) xa"
  2.4444 +lemma DELETE_SUBSET: "ALL (x::'a::type) xa::'a::type => bool. SUBSET (DELETE xa x) xa"
  2.4445    by (import pred_set DELETE_SUBSET)
  2.4446  
  2.4447 -lemma SUBSET_DELETE: "ALL x xa xb. SUBSET xa (DELETE xb x) = (~ IN x xa & SUBSET xa xb)"
  2.4448 +lemma SUBSET_DELETE: "ALL (x::'a::type) (xa::'a::type => bool) xb::'a::type => bool.
  2.4449 +   SUBSET xa (DELETE xb x) = (~ IN x xa & SUBSET xa xb)"
  2.4450    by (import pred_set SUBSET_DELETE)
  2.4451  
  2.4452 -lemma SUBSET_INSERT_DELETE: "ALL x s t. SUBSET s (INSERT x t) = SUBSET (DELETE s x) t"
  2.4453 +lemma SUBSET_INSERT_DELETE: "ALL (x::'a::type) (s::'a::type => bool) t::'a::type => bool.
  2.4454 +   SUBSET s (INSERT x t) = SUBSET (DELETE s x) t"
  2.4455    by (import pred_set SUBSET_INSERT_DELETE)
  2.4456  
  2.4457 -lemma DIFF_INSERT: "ALL x xa xb. DIFF x (INSERT xb xa) = DIFF (DELETE x xb) xa"
  2.4458 +lemma DIFF_INSERT: "ALL (x::'a::type => bool) (xa::'a::type => bool) xb::'a::type.
  2.4459 +   DIFF x (INSERT xb xa) = DIFF (DELETE x xb) xa"
  2.4460    by (import pred_set DIFF_INSERT)
  2.4461  
  2.4462 -lemma PSUBSET_INSERT_SUBSET: "ALL x xa. PSUBSET x xa = (EX xb. ~ IN xb x & SUBSET (INSERT xb x) xa)"
  2.4463 +lemma PSUBSET_INSERT_SUBSET: "ALL (x::'a::type => bool) xa::'a::type => bool.
  2.4464 +   PSUBSET x xa = (EX xb::'a::type. ~ IN xb x & SUBSET (INSERT xb x) xa)"
  2.4465    by (import pred_set PSUBSET_INSERT_SUBSET)
  2.4466  
  2.4467 -lemma PSUBSET_MEMBER: "ALL s t. PSUBSET s t = (SUBSET s t & (EX y. IN y t & ~ IN y s))"
  2.4468 +lemma PSUBSET_MEMBER: "ALL (s::'a::type => bool) t::'a::type => bool.
  2.4469 +   PSUBSET s t = (SUBSET s t & (EX y::'a::type. IN y t & ~ IN y s))"
  2.4470    by (import pred_set PSUBSET_MEMBER)
  2.4471  
  2.4472 -lemma DELETE_INSERT: "ALL x xa xb.
  2.4473 +lemma DELETE_INSERT: "ALL (x::'a::type) (xa::'a::type) xb::'a::type => bool.
  2.4474     DELETE (INSERT x xb) xa =
  2.4475     (if x = xa then DELETE xb xa else INSERT x (DELETE xb xa))"
  2.4476    by (import pred_set DELETE_INSERT)
  2.4477  
  2.4478 -lemma INSERT_DELETE: "ALL x xa. IN x xa --> INSERT x (DELETE xa x) = xa"
  2.4479 +lemma INSERT_DELETE: "ALL (x::'a::type) xa::'a::type => bool.
  2.4480 +   IN x xa --> INSERT x (DELETE xa x) = xa"
  2.4481    by (import pred_set INSERT_DELETE)
  2.4482  
  2.4483 -lemma DELETE_INTER: "ALL x xa xb.
  2.4484 +lemma DELETE_INTER: "ALL (x::'a::type => bool) (xa::'a::type => bool) xb::'a::type.
  2.4485     pred_set.INTER (DELETE x xb) xa = DELETE (pred_set.INTER x xa) xb"
  2.4486    by (import pred_set DELETE_INTER)
  2.4487  
  2.4488 -lemma DISJOINT_DELETE_SYM: "ALL x xa xb. DISJOINT (DELETE x xb) xa = DISJOINT (DELETE xa xb) x"
  2.4489 +lemma DISJOINT_DELETE_SYM: "ALL (x::'a::type => bool) (xa::'a::type => bool) xb::'a::type.
  2.4490 +   DISJOINT (DELETE x xb) xa = DISJOINT (DELETE xa xb) x"
  2.4491    by (import pred_set DISJOINT_DELETE_SYM)
  2.4492  
  2.4493  consts
  2.4494 -  CHOICE :: "('a => bool) => 'a" 
  2.4495 -
  2.4496 -specification (CHOICE) CHOICE_DEF: "ALL x. x ~= EMPTY --> IN (CHOICE x) x"
  2.4497 +  CHOICE :: "('a::type => bool) => 'a::type" 
  2.4498 +
  2.4499 +specification (CHOICE) CHOICE_DEF: "ALL x::'a::type => bool. x ~= EMPTY --> IN (CHOICE x) x"
  2.4500    by (import pred_set CHOICE_DEF)
  2.4501  
  2.4502  constdefs
  2.4503 -  REST :: "('a => bool) => 'a => bool" 
  2.4504 -  "REST == %s. DELETE s (CHOICE s)"
  2.4505 -
  2.4506 -lemma REST_DEF: "ALL s. REST s = DELETE s (CHOICE s)"
  2.4507 +  REST :: "('a::type => bool) => 'a::type => bool" 
  2.4508 +  "REST == %s::'a::type => bool. DELETE s (CHOICE s)"
  2.4509 +
  2.4510 +lemma REST_DEF: "ALL s::'a::type => bool. REST s = DELETE s (CHOICE s)"
  2.4511    by (import pred_set REST_DEF)
  2.4512  
  2.4513 -lemma CHOICE_NOT_IN_REST: "ALL x. ~ IN (CHOICE x) (REST x)"
  2.4514 +lemma CHOICE_NOT_IN_REST: "ALL x::'a::type => bool. ~ IN (CHOICE x) (REST x)"
  2.4515    by (import pred_set CHOICE_NOT_IN_REST)
  2.4516  
  2.4517 -lemma CHOICE_INSERT_REST: "ALL s. s ~= EMPTY --> INSERT (CHOICE s) (REST s) = s"
  2.4518 +lemma CHOICE_INSERT_REST: "ALL s::'a::type => bool. s ~= EMPTY --> INSERT (CHOICE s) (REST s) = s"
  2.4519    by (import pred_set CHOICE_INSERT_REST)
  2.4520  
  2.4521 -lemma REST_SUBSET: "ALL x. SUBSET (REST x) x"
  2.4522 +lemma REST_SUBSET: "ALL x::'a::type => bool. SUBSET (REST x) x"
  2.4523    by (import pred_set REST_SUBSET)
  2.4524  
  2.4525 -lemma REST_PSUBSET: "ALL x. x ~= EMPTY --> PSUBSET (REST x) x"
  2.4526 +lemma REST_PSUBSET: "ALL x::'a::type => bool. x ~= EMPTY --> PSUBSET (REST x) x"
  2.4527    by (import pred_set REST_PSUBSET)
  2.4528  
  2.4529  constdefs
  2.4530 -  SING :: "('a => bool) => bool" 
  2.4531 -  "SING == %s. EX x. s = INSERT x EMPTY"
  2.4532 -
  2.4533 -lemma SING_DEF: "ALL s. SING s = (EX x. s = INSERT x EMPTY)"
  2.4534 +  SING :: "('a::type => bool) => bool" 
  2.4535 +  "SING == %s::'a::type => bool. EX x::'a::type. s = INSERT x EMPTY"
  2.4536 +
  2.4537 +lemma SING_DEF: "ALL s::'a::type => bool. SING s = (EX x::'a::type. s = INSERT x EMPTY)"
  2.4538    by (import pred_set SING_DEF)
  2.4539  
  2.4540 -lemma SING: "ALL x. SING (INSERT x EMPTY)"
  2.4541 +lemma SING: "ALL x::'a::type. SING (INSERT x EMPTY)"
  2.4542    by (import pred_set SING)
  2.4543  
  2.4544 -lemma IN_SING: "ALL x xa. IN x (INSERT xa EMPTY) = (x = xa)"
  2.4545 +lemma IN_SING: "ALL (x::'a::type) xa::'a::type. IN x (INSERT xa EMPTY) = (x = xa)"
  2.4546    by (import pred_set IN_SING)
  2.4547  
  2.4548 -lemma NOT_SING_EMPTY: "ALL x. INSERT x EMPTY ~= EMPTY"
  2.4549 +lemma NOT_SING_EMPTY: "ALL x::'a::type. INSERT x EMPTY ~= EMPTY"
  2.4550    by (import pred_set NOT_SING_EMPTY)
  2.4551  
  2.4552 -lemma NOT_EMPTY_SING: "ALL x. EMPTY ~= INSERT x EMPTY"
  2.4553 +lemma NOT_EMPTY_SING: "ALL x::'a::type. EMPTY ~= INSERT x EMPTY"
  2.4554    by (import pred_set NOT_EMPTY_SING)
  2.4555  
  2.4556 -lemma EQUAL_SING: "ALL x xa. (INSERT x EMPTY = INSERT xa EMPTY) = (x = xa)"
  2.4557 +lemma EQUAL_SING: "ALL (x::'a::type) xa::'a::type.
  2.4558 +   (INSERT x EMPTY = INSERT xa EMPTY) = (x = xa)"
  2.4559    by (import pred_set EQUAL_SING)
  2.4560  
  2.4561 -lemma DISJOINT_SING_EMPTY: "ALL x. DISJOINT (INSERT x EMPTY) EMPTY"
  2.4562 +lemma DISJOINT_SING_EMPTY: "ALL x::'a::type. DISJOINT (INSERT x EMPTY) EMPTY"
  2.4563    by (import pred_set DISJOINT_SING_EMPTY)
  2.4564  
  2.4565 -lemma INSERT_SING_UNION: "ALL x xa. INSERT xa x = pred_set.UNION (INSERT xa EMPTY) x"
  2.4566 +lemma INSERT_SING_UNION: "ALL (x::'a::type => bool) xa::'a::type.
  2.4567 +   INSERT xa x = pred_set.UNION (INSERT xa EMPTY) x"
  2.4568    by (import pred_set INSERT_SING_UNION)
  2.4569  
  2.4570 -lemma SING_DELETE: "ALL x. DELETE (INSERT x EMPTY) x = EMPTY"
  2.4571 +lemma SING_DELETE: "ALL x::'a::type. DELETE (INSERT x EMPTY) x = EMPTY"
  2.4572    by (import pred_set SING_DELETE)
  2.4573  
  2.4574 -lemma DELETE_EQ_SING: "ALL x xa. IN xa x --> (DELETE x xa = EMPTY) = (x = INSERT xa EMPTY)"
  2.4575 +lemma DELETE_EQ_SING: "ALL (x::'a::type => bool) xa::'a::type.
  2.4576 +   IN xa x --> (DELETE x xa = EMPTY) = (x = INSERT xa EMPTY)"
  2.4577    by (import pred_set DELETE_EQ_SING)
  2.4578  
  2.4579 -lemma CHOICE_SING: "ALL x. CHOICE (INSERT x EMPTY) = x"
  2.4580 +lemma CHOICE_SING: "ALL x::'a::type. CHOICE (INSERT x EMPTY) = x"
  2.4581    by (import pred_set CHOICE_SING)
  2.4582  
  2.4583 -lemma REST_SING: "ALL x. REST (INSERT x EMPTY) = EMPTY"
  2.4584 +lemma REST_SING: "ALL x::'a::type. REST (INSERT x EMPTY) = EMPTY"
  2.4585    by (import pred_set REST_SING)
  2.4586  
  2.4587 -lemma SING_IFF_EMPTY_REST: "ALL x. SING x = (x ~= EMPTY & REST x = EMPTY)"
  2.4588 +lemma SING_IFF_EMPTY_REST: "ALL x::'a::type => bool. SING x = (x ~= EMPTY & REST x = EMPTY)"
  2.4589    by (import pred_set SING_IFF_EMPTY_REST)
  2.4590  
  2.4591  constdefs
  2.4592 -  IMAGE :: "('a => 'b) => ('a => bool) => 'b => bool" 
  2.4593 -  "IMAGE == %f s. GSPEC (%x. (f x, IN x s))"
  2.4594 -
  2.4595 -lemma IMAGE_DEF: "ALL f s. IMAGE f s = GSPEC (%x. (f x, IN x s))"
  2.4596 +  IMAGE :: "('a::type => 'b::type) => ('a::type => bool) => 'b::type => bool" 
  2.4597 +  "IMAGE ==
  2.4598 +%(f::'a::type => 'b::type) s::'a::type => bool.
  2.4599 +   GSPEC (%x::'a::type. (f x, IN x s))"
  2.4600 +
  2.4601 +lemma IMAGE_DEF: "ALL (f::'a::type => 'b::type) s::'a::type => bool.
  2.4602 +   IMAGE f s = GSPEC (%x::'a::type. (f x, IN x s))"
  2.4603    by (import pred_set IMAGE_DEF)
  2.4604  
  2.4605 -lemma IN_IMAGE: "ALL (x::'b) (xa::'a => bool) xb::'a => 'b.
  2.4606 -   IN x (IMAGE xb xa) = (EX xc::'a. x = xb xc & IN xc xa)"
  2.4607 +lemma IN_IMAGE: "ALL (x::'b::type) (xa::'a::type => bool) xb::'a::type => 'b::type.
  2.4608 +   IN x (IMAGE xb xa) = (EX xc::'a::type. x = xb xc & IN xc xa)"
  2.4609    by (import pred_set IN_IMAGE)
  2.4610  
  2.4611 -lemma IMAGE_IN: "ALL x xa. IN x xa --> (ALL xb. IN (xb x) (IMAGE xb xa))"
  2.4612 +lemma IMAGE_IN: "ALL (x::'a::type) xa::'a::type => bool.
  2.4613 +   IN x xa --> (ALL xb::'a::type => 'b::type. IN (xb x) (IMAGE xb xa))"
  2.4614    by (import pred_set IMAGE_IN)
  2.4615  
  2.4616 -lemma IMAGE_EMPTY: "ALL x. IMAGE x EMPTY = EMPTY"
  2.4617 +lemma IMAGE_EMPTY: "ALL x::'a::type => 'b::type. IMAGE x EMPTY = EMPTY"
  2.4618    by (import pred_set IMAGE_EMPTY)
  2.4619  
  2.4620 -lemma IMAGE_ID: "ALL x. IMAGE (%x. x) x = x"
  2.4621 +lemma IMAGE_ID: "ALL x::'a::type => bool. IMAGE (%x::'a::type. x) x = x"
  2.4622    by (import pred_set IMAGE_ID)
  2.4623  
  2.4624 -lemma IMAGE_COMPOSE: "ALL (x::'b => 'c) (xa::'a => 'b) xb::'a => bool.
  2.4625 -   IMAGE (x o xa) xb = IMAGE x (IMAGE xa xb)"
  2.4626 +lemma IMAGE_COMPOSE: "ALL (x::'b::type => 'c::type) (xa::'a::type => 'b::type)
  2.4627 +   xb::'a::type => bool. IMAGE (x o xa) xb = IMAGE x (IMAGE xa xb)"
  2.4628    by (import pred_set IMAGE_COMPOSE)
  2.4629  
  2.4630 -lemma IMAGE_INSERT: "ALL x xa xb. IMAGE x (INSERT xa xb) = INSERT (x xa) (IMAGE x xb)"
  2.4631 +lemma IMAGE_INSERT: "ALL (x::'a::type => 'b::type) (xa::'a::type) xb::'a::type => bool.
  2.4632 +   IMAGE x (INSERT xa xb) = INSERT (x xa) (IMAGE x xb)"
  2.4633    by (import pred_set IMAGE_INSERT)
  2.4634  
  2.4635 -lemma IMAGE_EQ_EMPTY: "ALL s x. (IMAGE x s = EMPTY) = (s = EMPTY)"
  2.4636 +lemma IMAGE_EQ_EMPTY: "ALL (s::'a::type => bool) x::'a::type => 'b::type.
  2.4637 +   (IMAGE x s = EMPTY) = (s = EMPTY)"
  2.4638    by (import pred_set IMAGE_EQ_EMPTY)
  2.4639  
  2.4640 -lemma IMAGE_DELETE: "ALL f x s. ~ IN x s --> IMAGE f (DELETE s x) = IMAGE f s"
  2.4641 +lemma IMAGE_DELETE: "ALL (f::'a::type => 'b::type) (x::'a::type) s::'a::type => bool.
  2.4642 +   ~ IN x s --> IMAGE f (DELETE s x) = IMAGE f s"
  2.4643    by (import pred_set IMAGE_DELETE)
  2.4644  
  2.4645 -lemma IMAGE_UNION: "ALL x xa xb.
  2.4646 +lemma IMAGE_UNION: "ALL (x::'a::type => 'b::type) (xa::'a::type => bool) xb::'a::type => bool.
  2.4647     IMAGE x (pred_set.UNION xa xb) = pred_set.UNION (IMAGE x xa) (IMAGE x xb)"
  2.4648    by (import pred_set IMAGE_UNION)
  2.4649  
  2.4650 -lemma IMAGE_SUBSET: "ALL x xa. SUBSET x xa --> (ALL xb. SUBSET (IMAGE xb x) (IMAGE xb xa))"
  2.4651 +lemma IMAGE_SUBSET: "ALL (x::'a::type => bool) xa::'a::type => bool.
  2.4652 +   SUBSET x xa -->
  2.4653 +   (ALL xb::'a::type => 'b::type. SUBSET (IMAGE xb x) (IMAGE xb xa))"
  2.4654    by (import pred_set IMAGE_SUBSET)
  2.4655  
  2.4656 -lemma IMAGE_INTER: "ALL f s t.
  2.4657 +lemma IMAGE_INTER: "ALL (f::'a::type => 'b::type) (s::'a::type => bool) t::'a::type => bool.
  2.4658     SUBSET (IMAGE f (pred_set.INTER s t))
  2.4659      (pred_set.INTER (IMAGE f s) (IMAGE f t))"
  2.4660    by (import pred_set IMAGE_INTER)
  2.4661  
  2.4662  constdefs
  2.4663 -  INJ :: "('a => 'b) => ('a => bool) => ('b => bool) => bool" 
  2.4664 +  INJ :: "('a::type => 'b::type) => ('a::type => bool) => ('b::type => bool) => bool" 
  2.4665    "INJ ==
  2.4666 -%f s t.
  2.4667 -   (ALL x. IN x s --> IN (f x) t) &
  2.4668 -   (ALL x y. IN x s & IN y s --> f x = f y --> x = y)"
  2.4669 -
  2.4670 -lemma INJ_DEF: "ALL f s t.
  2.4671 +%(f::'a::type => 'b::type) (s::'a::type => bool) t::'b::type => bool.
  2.4672 +   (ALL x::'a::type. IN x s --> IN (f x) t) &
  2.4673 +   (ALL (x::'a::type) y::'a::type. IN x s & IN y s --> f x = f y --> x = y)"
  2.4674 +
  2.4675 +lemma INJ_DEF: "ALL (f::'a::type => 'b::type) (s::'a::type => bool) t::'b::type => bool.
  2.4676     INJ f s t =
  2.4677 -   ((ALL x. IN x s --> IN (f x) t) &
  2.4678 -    (ALL x y. IN x s & IN y s --> f x = f y --> x = y))"
  2.4679 +   ((ALL x::'a::type. IN x s --> IN (f x) t) &
  2.4680 +    (ALL (x::'a::type) y::'a::type.
  2.4681 +        IN x s & IN y s --> f x = f y --> x = y))"
  2.4682    by (import pred_set INJ_DEF)
  2.4683  
  2.4684 -lemma INJ_ID: "ALL x. INJ (%x. x) x x"
  2.4685 +lemma INJ_ID: "ALL x::'a::type => bool. INJ (%x::'a::type. x) x x"
  2.4686    by (import pred_set INJ_ID)
  2.4687  
  2.4688 -lemma INJ_COMPOSE: "ALL x xa xb xc xd. INJ x xb xc & INJ xa xc xd --> INJ (xa o x) xb xd"
  2.4689 +lemma INJ_COMPOSE: "ALL (x::'a::type => 'b::type) (xa::'b::type => 'c::type)
  2.4690 +   (xb::'a::type => bool) (xc::'b::type => bool) xd::'c::type => bool.
  2.4691 +   INJ x xb xc & INJ xa xc xd --> INJ (xa o x) xb xd"
  2.4692    by (import pred_set INJ_COMPOSE)
  2.4693  
  2.4694 -lemma INJ_EMPTY: "ALL x. All (INJ x EMPTY) & (ALL xa. INJ x xa EMPTY = (xa = EMPTY))"
  2.4695 +lemma INJ_EMPTY: "ALL x::'a::type => 'b::type.
  2.4696 +   All (INJ x EMPTY) &
  2.4697 +   (ALL xa::'a::type => bool. INJ x xa EMPTY = (xa = EMPTY))"
  2.4698    by (import pred_set INJ_EMPTY)
  2.4699  
  2.4700  constdefs
  2.4701 -  SURJ :: "('a => 'b) => ('a => bool) => ('b => bool) => bool" 
  2.4702 +  SURJ :: "('a::type => 'b::type) => ('a::type => bool) => ('b::type => bool) => bool" 
  2.4703    "SURJ ==
  2.4704 -%f s t.
  2.4705 -   (ALL x. IN x s --> IN (f x) t) &
  2.4706 -   (ALL x. IN x t --> (EX y. IN y s & f y = x))"
  2.4707 -
  2.4708 -lemma SURJ_DEF: "ALL f s t.
  2.4709 +%(f::'a::type => 'b::type) (s::'a::type => bool) t::'b::type => bool.
  2.4710 +   (ALL x::'a::type. IN x s --> IN (f x) t) &
  2.4711 +   (ALL x::'b::type. IN x t --> (EX y::'a::type. IN y s & f y = x))"
  2.4712 +
  2.4713 +lemma SURJ_DEF: "ALL (f::'a::type => 'b::type) (s::'a::type => bool) t::'b::type => bool.
  2.4714     SURJ f s t =
  2.4715 -   ((ALL x. IN x s --> IN (f x) t) &
  2.4716 -    (ALL x. IN x t --> (EX y. IN y s & f y = x)))"
  2.4717 +   ((ALL x::'a::type. IN x s --> IN (f x) t) &
  2.4718 +    (ALL x::'b::type. IN x t --> (EX y::'a::type. IN y s & f y = x)))"
  2.4719    by (import pred_set SURJ_DEF)
  2.4720  
  2.4721 -lemma SURJ_ID: "ALL x. SURJ (%x. x) x x"
  2.4722 +lemma SURJ_ID: "ALL x::'a::type => bool. SURJ (%x::'a::type. x) x x"
  2.4723    by (import pred_set SURJ_ID)
  2.4724  
  2.4725 -lemma SURJ_COMPOSE: "ALL x xa xb xc xd. SURJ x xb xc & SURJ xa xc xd --> SURJ (xa o x) xb xd"
  2.4726 +lemma SURJ_COMPOSE: "ALL (x::'a::type => 'b::type) (xa::'b::type => 'c::type)
  2.4727 +   (xb::'a::type => bool) (xc::'b::type => bool) xd::'c::type => bool.
  2.4728 +   SURJ x xb xc & SURJ xa xc xd --> SURJ (xa o x) xb xd"
  2.4729    by (import pred_set SURJ_COMPOSE)
  2.4730  
  2.4731 -lemma SURJ_EMPTY: "ALL x.
  2.4732 -   (ALL xa. SURJ x EMPTY xa = (xa = EMPTY)) &
  2.4733 -   (ALL xa. SURJ x xa EMPTY = (xa = EMPTY))"
  2.4734 +lemma SURJ_EMPTY: "ALL x::'a::type => 'b::type.
  2.4735 +   (ALL xa::'b::type => bool. SURJ x EMPTY xa = (xa = EMPTY)) &
  2.4736 +   (ALL xa::'a::type => bool. SURJ x xa EMPTY = (xa = EMPTY))"
  2.4737    by (import pred_set SURJ_EMPTY)
  2.4738  
  2.4739 -lemma IMAGE_SURJ: "ALL x xa xb. SURJ x xa xb = (IMAGE x xa = xb)"
  2.4740 +lemma IMAGE_SURJ: "ALL (x::'a::type => 'b::type) (xa::'a::type => bool) xb::'b::type => bool.
  2.4741 +   SURJ x xa xb = (IMAGE x xa = xb)"
  2.4742    by (import pred_set IMAGE_SURJ)
  2.4743  
  2.4744  constdefs
  2.4745 -  BIJ :: "('a => 'b) => ('a => bool) => ('b => bool) => bool" 
  2.4746 -  "BIJ == %f s t. INJ f s t & SURJ f s t"
  2.4747 -
  2.4748 -lemma BIJ_DEF: "ALL f s t. BIJ f s t = (INJ f s t & SURJ f s t)"
  2.4749 +  BIJ :: "('a::type => 'b::type) => ('a::type => bool) => ('b::type => bool) => bool" 
  2.4750 +  "BIJ ==
  2.4751 +%(f::'a::type => 'b::type) (s::'a::type => bool) t::'b::type => bool.
  2.4752 +   INJ f s t & SURJ f s t"
  2.4753 +
  2.4754 +lemma BIJ_DEF: "ALL (f::'a::type => 'b::type) (s::'a::type => bool) t::'b::type => bool.
  2.4755 +   BIJ f s t = (INJ f s t & SURJ f s t)"
  2.4756    by (import pred_set BIJ_DEF)
  2.4757  
  2.4758 -lemma BIJ_ID: "ALL x. BIJ (%x. x) x x"
  2.4759 +lemma BIJ_ID: "ALL x::'a::type => bool. BIJ (%x::'a::type. x) x x"
  2.4760    by (import pred_set BIJ_ID)
  2.4761  
  2.4762 -lemma BIJ_EMPTY: "ALL x.
  2.4763 -   (ALL xa. BIJ x EMPTY xa = (xa = EMPTY)) &
  2.4764 -   (ALL xa. BIJ x xa EMPTY = (xa = EMPTY))"
  2.4765 +lemma BIJ_EMPTY: "ALL x::'a::type => 'b::type.
  2.4766 +   (ALL xa::'b::type => bool. BIJ x EMPTY xa = (xa = EMPTY)) &
  2.4767 +   (ALL xa::'a::type => bool. BIJ x xa EMPTY = (xa = EMPTY))"
  2.4768    by (import pred_set BIJ_EMPTY)
  2.4769  
  2.4770 -lemma BIJ_COMPOSE: "ALL x xa xb xc xd. BIJ x xb xc & BIJ xa xc xd --> BIJ (xa o x) xb xd"
  2.4771 +lemma BIJ_COMPOSE: "ALL (x::'a::type => 'b::type) (xa::'b::type => 'c::type)
  2.4772 +   (xb::'a::type => bool) (xc::'b::type => bool) xd::'c::type => bool.
  2.4773 +   BIJ x xb xc & BIJ xa xc xd --> BIJ (xa o x) xb xd"
  2.4774    by (import pred_set BIJ_COMPOSE)
  2.4775  
  2.4776  consts
  2.4777 -  LINV :: "('a => 'b) => ('a => bool) => 'b => 'a" 
  2.4778 -
  2.4779 -specification (LINV) LINV_DEF: "ALL f s t. INJ f s t --> (ALL x. IN x s --> LINV f s (f x) = x)"
  2.4780 +  LINV :: "('a::type => 'b::type) => ('a::type => bool) => 'b::type => 'a::type" 
  2.4781 +
  2.4782 +specification (LINV) LINV_DEF: "ALL (f::'a::type => 'b::type) (s::'a::type => bool) t::'b::type => bool.
  2.4783 +   INJ f s t --> (ALL x::'a::type. IN x s --> LINV f s (f x) = x)"
  2.4784    by (import pred_set LINV_DEF)
  2.4785  
  2.4786  consts
  2.4787 -  RINV :: "('a => 'b) => ('a => bool) => 'b => 'a" 
  2.4788 -
  2.4789 -specification (RINV) RINV_DEF: "ALL f s t. SURJ f s t --> (ALL x. IN x t --> f (RINV f s x) = x)"
  2.4790 +  RINV :: "('a::type => 'b::type) => ('a::type => bool) => 'b::type => 'a::type" 
  2.4791 +
  2.4792 +specification (RINV) RINV_DEF: "ALL (f::'a::type => 'b::type) (s::'a::type => bool) t::'b::type => bool.
  2.4793 +   SURJ f s t --> (ALL x::'b::type. IN x t --> f (RINV f s x) = x)"
  2.4794    by (import pred_set RINV_DEF)
  2.4795  
  2.4796  constdefs
  2.4797 -  FINITE :: "('a => bool) => bool" 
  2.4798 +  FINITE :: "('a::type => bool) => bool" 
  2.4799    "FINITE ==
  2.4800 -%s. ALL P. P EMPTY & (ALL s. P s --> (ALL e. P (INSERT e s))) --> P s"
  2.4801 -
  2.4802 -lemma FINITE_DEF: "ALL s.
  2.4803 +%s::'a::type => bool.
  2.4804 +   ALL P::('a::type => bool) => bool.
  2.4805 +      P EMPTY &
  2.4806 +      (ALL s::'a::type => bool.
  2.4807 +          P s --> (ALL e::'a::type. P (INSERT e s))) -->
  2.4808 +      P s"
  2.4809 +
  2.4810 +lemma FINITE_DEF: "ALL s::'a::type => bool.
  2.4811     FINITE s =
  2.4812 -   (ALL P. P EMPTY & (ALL s. P s --> (ALL e. P (INSERT e s))) --> P s)"
  2.4813 +   (ALL P::('a::type => bool) => bool.
  2.4814 +       P EMPTY &
  2.4815 +       (ALL s::'a::type => bool.
  2.4816 +           P s --> (ALL e::'a::type. P (INSERT e s))) -->
  2.4817 +       P s)"
  2.4818    by (import pred_set FINITE_DEF)
  2.4819  
  2.4820  lemma FINITE_EMPTY: "FINITE EMPTY"
  2.4821    by (import pred_set FINITE_EMPTY)
  2.4822  
  2.4823 -lemma FINITE_INDUCT: "ALL P.
  2.4824 +lemma FINITE_INDUCT: "ALL P::('a::type => bool) => bool.
  2.4825     P EMPTY &
  2.4826 -   (ALL s. FINITE s & P s --> (ALL e. ~ IN e s --> P (INSERT e s))) -->
  2.4827 -   (ALL s. FINITE s --> P s)"
  2.4828 +   (ALL s::'a::type => bool.
  2.4829 +       FINITE s & P s -->
  2.4830 +       (ALL e::'a::type. ~ IN e s --> P (INSERT e s))) -->
  2.4831 +   (ALL s::'a::type => bool. FINITE s --> P s)"
  2.4832    by (import pred_set FINITE_INDUCT)
  2.4833  
  2.4834 -lemma FINITE_INSERT: "ALL x s. FINITE (INSERT x s) = FINITE s"
  2.4835 +lemma FINITE_INSERT: "ALL (x::'a::type) s::'a::type => bool. FINITE (INSERT x s) = FINITE s"
  2.4836    by (import pred_set FINITE_INSERT)
  2.4837  
  2.4838 -lemma FINITE_DELETE: "ALL x s. FINITE (DELETE s x) = FINITE s"
  2.4839 +lemma FINITE_DELETE: "ALL (x::'a::type) s::'a::type => bool. FINITE (DELETE s x) = FINITE s"
  2.4840    by (import pred_set FINITE_DELETE)
  2.4841  
  2.4842 -lemma FINITE_UNION: "ALL s t. FINITE (pred_set.UNION s t) = (FINITE s & FINITE t)"
  2.4843 +lemma FINITE_UNION: "ALL (s::'a::type => bool) t::'a::type => bool.
  2.4844 +   FINITE (pred_set.UNION s t) = (FINITE s & FINITE t)"
  2.4845    by (import pred_set FINITE_UNION)
  2.4846  
  2.4847 -lemma INTER_FINITE: "ALL s. FINITE s --> (ALL t. FINITE (pred_set.INTER s t))"
  2.4848 +lemma INTER_FINITE: "ALL s::'a::type => bool.
  2.4849 +   FINITE s --> (ALL t::'a::type => bool. FINITE (pred_set.INTER s t))"
  2.4850    by (import pred_set INTER_FINITE)
  2.4851  
  2.4852 -lemma SUBSET_FINITE: "ALL s. FINITE s --> (ALL t. SUBSET t s --> FINITE t)"
  2.4853 +lemma SUBSET_FINITE: "ALL s::'a::type => bool.
  2.4854 +   FINITE s --> (ALL t::'a::type => bool. SUBSET t s --> FINITE t)"
  2.4855    by (import pred_set SUBSET_FINITE)
  2.4856  
  2.4857 -lemma PSUBSET_FINITE: "ALL x. FINITE x --> (ALL xa. PSUBSET xa x --> FINITE xa)"
  2.4858 +lemma PSUBSET_FINITE: "ALL x::'a::type => bool.
  2.4859 +   FINITE x --> (ALL xa::'a::type => bool. PSUBSET xa x --> FINITE xa)"
  2.4860    by (import pred_set PSUBSET_FINITE)
  2.4861  
  2.4862 -lemma FINITE_DIFF: "ALL s. FINITE s --> (ALL t. FINITE (DIFF s t))"
  2.4863 +lemma FINITE_DIFF: "ALL s::'a::type => bool.
  2.4864 +   FINITE s --> (ALL t::'a::type => bool. FINITE (DIFF s t))"
  2.4865    by (import pred_set FINITE_DIFF)
  2.4866  
  2.4867 -lemma FINITE_SING: "ALL x. FINITE (INSERT x EMPTY)"
  2.4868 +lemma FINITE_SING: "ALL x::'a::type. FINITE (INSERT x EMPTY)"
  2.4869    by (import pred_set FINITE_SING)
  2.4870  
  2.4871 -lemma SING_FINITE: "ALL x. SING x --> FINITE x"
  2.4872 +lemma SING_FINITE: "ALL x::'a::type => bool. SING x --> FINITE x"
  2.4873    by (import pred_set SING_FINITE)
  2.4874  
  2.4875 -lemma IMAGE_FINITE: "ALL s. FINITE s --> (ALL f. FINITE (IMAGE f s))"
  2.4876 +lemma IMAGE_FINITE: "ALL s::'a::type => bool.
  2.4877 +   FINITE s --> (ALL f::'a::type => 'b::type. FINITE (IMAGE f s))"
  2.4878    by (import pred_set IMAGE_FINITE)
  2.4879  
  2.4880  consts
  2.4881 -  CARD :: "('a => bool) => nat" 
  2.4882 +  CARD :: "('a::type => bool) => nat" 
  2.4883  
  2.4884  specification (CARD) CARD_DEF: "(op &::bool => bool => bool)
  2.4885   ((op =::nat => nat => bool)
  2.4886 -   ((CARD::('a => bool) => nat) (EMPTY::'a => bool)) (0::nat))
  2.4887 - ((All::(('a => bool) => bool) => bool)
  2.4888 -   (%s::'a => bool.
  2.4889 -       (op -->::bool => bool => bool) ((FINITE::('a => bool) => bool) s)
  2.4890 -        ((All::('a => bool) => bool)
  2.4891 -          (%x::'a.
  2.4892 +   ((CARD::('a::type => bool) => nat) (EMPTY::'a::type => bool)) (0::nat))
  2.4893 + ((All::(('a::type => bool) => bool) => bool)
  2.4894 +   (%s::'a::type => bool.
  2.4895 +       (op -->::bool => bool => bool)
  2.4896 +        ((FINITE::('a::type => bool) => bool) s)
  2.4897 +        ((All::('a::type => bool) => bool)
  2.4898 +          (%x::'a::type.
  2.4899                (op =::nat => nat => bool)
  2.4900 -               ((CARD::('a => bool) => nat)
  2.4901 -                 ((INSERT::'a => ('a => bool) => 'a => bool) x s))
  2.4902 +               ((CARD::('a::type => bool) => nat)
  2.4903 +                 ((INSERT::'a::type
  2.4904 +                           => ('a::type => bool) => 'a::type => bool)
  2.4905 +                   x s))
  2.4906                 ((If::bool => nat => nat => nat)
  2.4907 -                 ((IN::'a => ('a => bool) => bool) x s)
  2.4908 -                 ((CARD::('a => bool) => nat) s)
  2.4909 -                 ((Suc::nat => nat) ((CARD::('a => bool) => nat) s)))))))"
  2.4910 +                 ((IN::'a::type => ('a::type => bool) => bool) x s)
  2.4911 +                 ((CARD::('a::type => bool) => nat) s)
  2.4912 +                 ((Suc::nat => nat)
  2.4913 +                   ((CARD::('a::type => bool) => nat) s)))))))"
  2.4914    by (import pred_set CARD_DEF)
  2.4915  
  2.4916 -lemma CARD_EMPTY: "CARD EMPTY = 0"
  2.4917 +lemma CARD_EMPTY: "CARD EMPTY = (0::nat)"
  2.4918    by (import pred_set CARD_EMPTY)
  2.4919  
  2.4920 -lemma CARD_INSERT: "ALL s.
  2.4921 +lemma CARD_INSERT: "ALL s::'a::type => bool.
  2.4922     FINITE s -->
  2.4923 -   (ALL x. CARD (INSERT x s) = (if IN x s then CARD s else Suc (CARD s)))"
  2.4924 +   (ALL x::'a::type.
  2.4925 +       CARD (INSERT x s) = (if IN x s then CARD s else Suc (CARD s)))"
  2.4926    by (import pred_set CARD_INSERT)
  2.4927  
  2.4928 -lemma CARD_EQ_0: "ALL s. FINITE s --> (CARD s = 0) = (s = EMPTY)"
  2.4929 +lemma CARD_EQ_0: "ALL s::'a::type => bool. FINITE s --> (CARD s = (0::nat)) = (s = EMPTY)"
  2.4930    by (import pred_set CARD_EQ_0)
  2.4931  
  2.4932 -lemma CARD_DELETE: "ALL s.
  2.4933 +lemma CARD_DELETE: "ALL s::'a::type => bool.
  2.4934     FINITE s -->
  2.4935 -   (ALL x. CARD (DELETE s x) = (if IN x s then CARD s - 1 else CARD s))"
  2.4936 +   (ALL x::'a::type.
  2.4937 +       CARD (DELETE s x) = (if IN x s then CARD s - (1::nat) else CARD s))"
  2.4938    by (import pred_set CARD_DELETE)
  2.4939  
  2.4940 -lemma CARD_INTER_LESS_EQ: "ALL s. FINITE s --> (ALL t. CARD (pred_set.INTER s t) <= CARD s)"
  2.4941 +lemma CARD_INTER_LESS_EQ: "ALL s::'a::type => bool.
  2.4942 +   FINITE s -->
  2.4943 +   (ALL t::'a::type => bool. CARD (pred_set.INTER s t) <= CARD s)"
  2.4944    by (import pred_set CARD_INTER_LESS_EQ)
  2.4945  
  2.4946 -lemma CARD_UNION: "ALL s.
  2.4947 +lemma CARD_UNION: "ALL s::'a::type => bool.
  2.4948     FINITE s -->
  2.4949 -   (ALL t.
  2.4950 +   (ALL t::'a::type => bool.
  2.4951         FINITE t -->
  2.4952         CARD (pred_set.UNION s t) + CARD (pred_set.INTER s t) =
  2.4953         CARD s + CARD t)"
  2.4954    by (import pred_set CARD_UNION)
  2.4955  
  2.4956 -lemma CARD_SUBSET: "ALL s. FINITE s --> (ALL t. SUBSET t s --> CARD t <= CARD s)"
  2.4957 +lemma CARD_SUBSET: "ALL s::'a::type => bool.
  2.4958 +   FINITE s --> (ALL t::'a::type => bool. SUBSET t s --> CARD t <= CARD s)"
  2.4959    by (import pred_set CARD_SUBSET)
  2.4960  
  2.4961 -lemma CARD_PSUBSET: "ALL s. FINITE s --> (ALL t. PSUBSET t s --> CARD t < CARD s)"
  2.4962 +lemma CARD_PSUBSET: "ALL s::'a::type => bool.
  2.4963 +   FINITE s --> (ALL t::'a::type => bool. PSUBSET t s --> CARD t < CARD s)"
  2.4964    by (import pred_set CARD_PSUBSET)
  2.4965  
  2.4966 -lemma CARD_SING: "ALL x. CARD (INSERT x EMPTY) = 1"
  2.4967 +lemma CARD_SING: "ALL x::'a::type. CARD (INSERT x EMPTY) = (1::nat)"
  2.4968    by (import pred_set CARD_SING)
  2.4969  
  2.4970 -lemma SING_IFF_CARD1: "ALL x. SING x = (CARD x = 1 & FINITE x)"
  2.4971 +lemma SING_IFF_CARD1: "ALL x::'a::type => bool. SING x = (CARD x = (1::nat) & FINITE x)"
  2.4972    by (import pred_set SING_IFF_CARD1)
  2.4973  
  2.4974 -lemma CARD_DIFF: "ALL t.
  2.4975 +lemma CARD_DIFF: "ALL t::'a::type => bool.
  2.4976     FINITE t -->
  2.4977 -   (ALL s.
  2.4978 +   (ALL s::'a::type => bool.
  2.4979         FINITE s --> CARD (DIFF s t) = CARD s - CARD (pred_set.INTER s t))"
  2.4980    by (import pred_set CARD_DIFF)
  2.4981  
  2.4982 -lemma LESS_CARD_DIFF: "ALL t.
  2.4983 +lemma LESS_CARD_DIFF: "ALL t::'a::type => bool.
  2.4984     FINITE t -->
  2.4985 -   (ALL s. FINITE s --> CARD t < CARD s --> 0 < CARD (DIFF s t))"
  2.4986 +   (ALL s::'a::type => bool.
  2.4987 +       FINITE s --> CARD t < CARD s --> (0::nat) < CARD (DIFF s t))"
  2.4988    by (import pred_set LESS_CARD_DIFF)
  2.4989  
  2.4990 -lemma FINITE_COMPLETE_INDUCTION: "ALL P.
  2.4991 -   (ALL x. (ALL y. PSUBSET y x --> P y) --> FINITE x --> P x) -->
  2.4992 -   (ALL x. FINITE x --> P x)"
  2.4993 +lemma FINITE_COMPLETE_INDUCTION: "ALL P::('a::type => bool) => bool.
  2.4994 +   (ALL x::'a::type => bool.
  2.4995 +       (ALL y::'a::type => bool. PSUBSET y x --> P y) -->
  2.4996 +       FINITE x --> P x) -->
  2.4997 +   (ALL x::'a::type => bool. FINITE x --> P x)"
  2.4998    by (import pred_set FINITE_COMPLETE_INDUCTION)
  2.4999  
  2.5000  constdefs
  2.5001 -  INFINITE :: "('a => bool) => bool" 
  2.5002 -  "INFINITE == %s. ~ FINITE s"
  2.5003 -
  2.5004 -lemma INFINITE_DEF: "ALL s. INFINITE s = (~ FINITE s)"
  2.5005 +  INFINITE :: "('a::type => bool) => bool" 
  2.5006 +  "INFINITE == %s::'a::type => bool. ~ FINITE s"
  2.5007 +
  2.5008 +lemma INFINITE_DEF: "ALL s::'a::type => bool. INFINITE s = (~ FINITE s)"
  2.5009    by (import pred_set INFINITE_DEF)
  2.5010  
  2.5011  lemma NOT_IN_FINITE: "(op =::bool => bool => bool)
  2.5012 - ((INFINITE::('a => bool) => bool) (pred_set.UNIV::'a => bool))
  2.5013 - ((All::(('a => bool) => bool) => bool)
  2.5014 -   (%s::'a => bool.
  2.5015 -       (op -->::bool => bool => bool) ((FINITE::('a => bool) => bool) s)
  2.5016 -        ((Ex::('a => bool) => bool)
  2.5017 -          (%x::'a.
  2.5018 -              (Not::bool => bool) ((IN::'a => ('a => bool) => bool) x s)))))"
  2.5019 + ((INFINITE::('a::type => bool) => bool) (pred_set.UNIV::'a::type => bool))
  2.5020 + ((All::(('a::type => bool) => bool) => bool)
  2.5021 +   (%s::'a::type => bool.
  2.5022 +       (op -->::bool => bool => bool)
  2.5023 +        ((FINITE::('a::type => bool) => bool) s)
  2.5024 +        ((Ex::('a::type => bool) => bool)
  2.5025 +          (%x::'a::type.
  2.5026 +              (Not::bool => bool)
  2.5027 +               ((IN::'a::type => ('a::type => bool) => bool) x s)))))"
  2.5028    by (import pred_set NOT_IN_FINITE)
  2.5029  
  2.5030 -lemma INFINITE_INHAB: "ALL x. INFINITE x --> (EX xa. IN xa x)"
  2.5031 +lemma INFINITE_INHAB: "ALL x::'a::type => bool. INFINITE x --> (EX xa::'a::type. IN xa x)"
  2.5032    by (import pred_set INFINITE_INHAB)
  2.5033  
  2.5034 -lemma IMAGE_11_INFINITE: "ALL f.
  2.5035 -   (ALL x y. f x = f y --> x = y) -->
  2.5036 -   (ALL s. INFINITE s --> INFINITE (IMAGE f s))"
  2.5037 +lemma IMAGE_11_INFINITE: "ALL f::'a::type => 'b::type.
  2.5038 +   (ALL (x::'a::type) y::'a::type. f x = f y --> x = y) -->
  2.5039 +   (ALL s::'a::type => bool. INFINITE s --> INFINITE (IMAGE f s))"
  2.5040    by (import pred_set IMAGE_11_INFINITE)
  2.5041  
  2.5042 -lemma INFINITE_SUBSET: "ALL x. INFINITE x --> (ALL xa. SUBSET x xa --> INFINITE xa)"
  2.5043 +lemma INFINITE_SUBSET: "ALL x::'a::type => bool.
  2.5044 +   INFINITE x --> (ALL xa::'a::type => bool. SUBSET x xa --> INFINITE xa)"
  2.5045    by (import pred_set INFINITE_SUBSET)
  2.5046  
  2.5047 -lemma IN_INFINITE_NOT_FINITE: "ALL x xa. INFINITE x & FINITE xa --> (EX xb. IN xb x & ~ IN xb xa)"
  2.5048 +lemma IN_INFINITE_NOT_FINITE: "ALL (x::'a::type => bool) xa::'a::type => bool.
  2.5049 +   INFINITE x & FINITE xa --> (EX xb::'a::type. IN xb x & ~ IN xb xa)"
  2.5050    by (import pred_set IN_INFINITE_NOT_FINITE)
  2.5051  
  2.5052  lemma INFINITE_UNIV: "(op =::bool => bool => bool)
  2.5053 - ((INFINITE::('a => bool) => bool) (pred_set.UNIV::'a => bool))
  2.5054 - ((Ex::(('a => 'a) => bool) => bool)
  2.5055 -   (%f::'a => 'a.
  2.5056 + ((INFINITE::('a::type => bool) => bool) (pred_set.UNIV::'a::type => bool))
  2.5057 + ((Ex::(('a::type => 'a::type) => bool) => bool)
  2.5058 +   (%f::'a::type => 'a::type.
  2.5059         (op &::bool => bool => bool)
  2.5060 -        ((All::('a => bool) => bool)
  2.5061 -          (%x::'a.
  2.5062 -              (All::('a => bool) => bool)
  2.5063 -               (%y::'a.
  2.5064 +        ((All::('a::type => bool) => bool)
  2.5065 +          (%x::'a::type.
  2.5066 +              (All::('a::type => bool) => bool)
  2.5067 +               (%y::'a::type.
  2.5068                     (op -->::bool => bool => bool)
  2.5069 -                    ((op =::'a => 'a => bool) (f x) (f y))
  2.5070 -                    ((op =::'a => 'a => bool) x y))))
  2.5071 -        ((Ex::('a => bool) => bool)
  2.5072 -          (%y::'a.
  2.5073 -              (All::('a => bool) => bool)
  2.5074 -               (%x::'a.
  2.5075 +                    ((op =::'a::type => 'a::type => bool) (f x) (f y))
  2.5076 +                    ((op =::'a::type => 'a::type => bool) x y))))
  2.5077 +        ((Ex::('a::type => bool) => bool)
  2.5078 +          (%y::'a::type.
  2.5079 +              (All::('a::type => bool) => bool)
  2.5080 +               (%x::'a::type.
  2.5081                     (Not::bool => bool)
  2.5082 -                    ((op =::'a => 'a => bool) (f x) y))))))"
  2.5083 +                    ((op =::'a::type => 'a::type => bool) (f x) y))))))"
  2.5084    by (import pred_set INFINITE_UNIV)
  2.5085  
  2.5086 -lemma FINITE_PSUBSET_INFINITE: "ALL x. INFINITE x = (ALL xa. FINITE xa --> SUBSET xa x --> PSUBSET xa x)"
  2.5087 +lemma FINITE_PSUBSET_INFINITE: "ALL x::'a::type => bool.
  2.5088 +   INFINITE x =
  2.5089 +   (ALL xa::'a::type => bool. FINITE xa --> SUBSET xa x --> PSUBSET xa x)"
  2.5090    by (import pred_set FINITE_PSUBSET_INFINITE)
  2.5091  
  2.5092  lemma FINITE_PSUBSET_UNIV: "(op =::bool => bool => bool)
  2.5093 - ((INFINITE::('a => bool) => bool) (pred_set.UNIV::'a => bool))
  2.5094 - ((All::(('a => bool) => bool) => bool)
  2.5095 -   (%s::'a => bool.
  2.5096 -       (op -->::bool => bool => bool) ((FINITE::('a => bool) => bool) s)
  2.5097 -        ((PSUBSET::('a => bool) => ('a => bool) => bool) s
  2.5098 -          (pred_set.UNIV::'a => bool))))"
  2.5099 + ((INFINITE::('a::type => bool) => bool) (pred_set.UNIV::'a::type => bool))
  2.5100 + ((All::(('a::type => bool) => bool) => bool)
  2.5101 +   (%s::'a::type => bool.
  2.5102 +       (op -->::bool => bool => bool)
  2.5103 +        ((FINITE::('a::type => bool) => bool) s)
  2.5104 +        ((PSUBSET::('a::type => bool) => ('a::type => bool) => bool) s
  2.5105 +          (pred_set.UNIV::'a::type => bool))))"
  2.5106    by (import pred_set FINITE_PSUBSET_UNIV)
  2.5107  
  2.5108 -lemma INFINITE_DIFF_FINITE: "ALL s t. INFINITE s & FINITE t --> DIFF s t ~= EMPTY"
  2.5109 +lemma INFINITE_DIFF_FINITE: "ALL (s::'a::type => bool) t::'a::type => bool.
  2.5110 +   INFINITE s & FINITE t --> DIFF s t ~= EMPTY"
  2.5111    by (import pred_set INFINITE_DIFF_FINITE)
  2.5112  
  2.5113 -lemma FINITE_ISO_NUM: "ALL s.
  2.5114 +lemma FINITE_ISO_NUM: "ALL s::'a::type => bool.
  2.5115     FINITE s -->
  2.5116 -   (EX f. (ALL n m. n < CARD s & m < CARD s --> f n = f m --> n = m) &
  2.5117 -          s = GSPEC (%n. (f n, n < CARD s)))"
  2.5118 +   (EX f::nat => 'a::type.
  2.5119 +       (ALL (n::nat) m::nat.
  2.5120 +           n < CARD s & m < CARD s --> f n = f m --> n = m) &
  2.5121 +       s = GSPEC (%n::nat. (f n, n < CARD s)))"
  2.5122    by (import pred_set FINITE_ISO_NUM)
  2.5123  
  2.5124 -lemma FINITE_WEAK_ENUMERATE: "(All::(('a => bool) => bool) => bool)
  2.5125 - (%x::'a => bool.
  2.5126 -     (op =::bool => bool => bool) ((FINITE::('a => bool) => bool) x)
  2.5127 -      ((Ex::((nat => 'a) => bool) => bool)
  2.5128 -        (%f::nat => 'a.
  2.5129 +lemma FINITE_WEAK_ENUMERATE: "(All::(('a::type => bool) => bool) => bool)
  2.5130 + (%x::'a::type => bool.
  2.5131 +     (op =::bool => bool => bool) ((FINITE::('a::type => bool) => bool) x)
  2.5132 +      ((Ex::((nat => 'a::type) => bool) => bool)
  2.5133 +        (%f::nat => 'a::type.
  2.5134              (Ex::(nat => bool) => bool)
  2.5135               (%b::nat.
  2.5136 -                 (All::('a => bool) => bool)
  2.5137 -                  (%e::'a.
  2.5138 +                 (All::('a::type => bool) => bool)
  2.5139 +                  (%e::'a::type.
  2.5140                        (op =::bool => bool => bool)
  2.5141 -                       ((IN::'a => ('a => bool) => bool) e x)
  2.5142 +                       ((IN::'a::type => ('a::type => bool) => bool) e x)
  2.5143                         ((Ex::(nat => bool) => bool)
  2.5144                           (%n::nat.
  2.5145                               (op &::bool => bool => bool)
  2.5146                                ((op <::nat => nat => bool) n b)
  2.5147 -                              ((op =::'a => 'a => bool) e (f n)))))))))"
  2.5148 +                              ((op =::'a::type => 'a::type => bool) e
  2.5149 +                                (f n)))))))))"
  2.5150    by (import pred_set FINITE_WEAK_ENUMERATE)
  2.5151  
  2.5152  constdefs
  2.5153 -  BIGUNION :: "(('a => bool) => bool) => 'a => bool" 
  2.5154 -  "BIGUNION == %P. GSPEC (%x. (x, EX p. IN p P & IN x p))"
  2.5155 -
  2.5156 -lemma BIGUNION: "ALL P. BIGUNION P = GSPEC (%x. (x, EX p. IN p P & IN x p))"
  2.5157 +  BIGUNION :: "(('a::type => bool) => bool) => 'a::type => bool" 
  2.5158 +  "BIGUNION ==
  2.5159 +%P::('a::type => bool) => bool.
  2.5160 +   GSPEC (%x::'a::type. (x, EX p::'a::type => bool. IN p P & IN x p))"
  2.5161 +
  2.5162 +lemma BIGUNION: "ALL P::('a::type => bool) => bool.
  2.5163 +   BIGUNION P =
  2.5164 +   GSPEC (%x::'a::type. (x, EX p::'a::type => bool. IN p P & IN x p))"
  2.5165    by (import pred_set BIGUNION)
  2.5166  
  2.5167 -lemma IN_BIGUNION: "ALL x xa. IN x (BIGUNION xa) = (EX s. IN x s & IN s xa)"
  2.5168 +lemma IN_BIGUNION: "ALL (x::'a::type) xa::('a::type => bool) => bool.
  2.5169 +   IN x (BIGUNION xa) = (EX s::'a::type => bool. IN x s & IN s xa)"
  2.5170    by (import pred_set IN_BIGUNION)
  2.5171  
  2.5172  lemma BIGUNION_EMPTY: "BIGUNION EMPTY = EMPTY"
  2.5173    by (import pred_set BIGUNION_EMPTY)
  2.5174  
  2.5175 -lemma BIGUNION_SING: "ALL x. BIGUNION (INSERT x EMPTY) = x"
  2.5176 +lemma BIGUNION_SING: "ALL x::'a::type => bool. BIGUNION (INSERT x EMPTY) = x"
  2.5177    by (import pred_set BIGUNION_SING)
  2.5178  
  2.5179 -lemma BIGUNION_UNION: "ALL x xa.
  2.5180 +lemma BIGUNION_UNION: "ALL (x::('a::type => bool) => bool) xa::('a::type => bool) => bool.
  2.5181     BIGUNION (pred_set.UNION x xa) =
  2.5182     pred_set.UNION (BIGUNION x) (BIGUNION xa)"
  2.5183    by (import pred_set BIGUNION_UNION)
  2.5184  
  2.5185 -lemma DISJOINT_BIGUNION: "(ALL (s::('a => bool) => bool) t::'a => bool.
  2.5186 +lemma DISJOINT_BIGUNION: "(ALL (s::('a::type => bool) => bool) t::'a::type => bool.
  2.5187      DISJOINT (BIGUNION s) t =
  2.5188 -    (ALL s'::'a => bool. IN s' s --> DISJOINT s' t)) &
  2.5189 -(ALL (x::('a => bool) => bool) xa::'a => bool.
  2.5190 +    (ALL s'::'a::type => bool. IN s' s --> DISJOINT s' t)) &
  2.5191 +(ALL (x::('a::type => bool) => bool) xa::'a::type => bool.
  2.5192      DISJOINT xa (BIGUNION x) =
  2.5193 -    (ALL xb::'a => bool. IN xb x --> DISJOINT xa xb))"
  2.5194 +    (ALL xb::'a::type => bool. IN xb x --> DISJOINT xa xb))"
  2.5195    by (import pred_set DISJOINT_BIGUNION)
  2.5196  
  2.5197 -lemma BIGUNION_INSERT: "ALL x xa. BIGUNION (INSERT x xa) = pred_set.UNION x (BIGUNION xa)"
  2.5198 +lemma BIGUNION_INSERT: "ALL (x::'a::type => bool) xa::('a::type => bool) => bool.
  2.5199 +   BIGUNION (INSERT x xa) = pred_set.UNION x (BIGUNION xa)"
  2.5200    by (import pred_set BIGUNION_INSERT)
  2.5201  
  2.5202 -lemma BIGUNION_SUBSET: "ALL X P. SUBSET (BIGUNION P) X = (ALL Y. IN Y P --> SUBSET Y X)"
  2.5203 +lemma BIGUNION_SUBSET: "ALL (X::'a::type => bool) P::('a::type => bool) => bool.
  2.5204 +   SUBSET (BIGUNION P) X = (ALL Y::'a::type => bool. IN Y P --> SUBSET Y X)"
  2.5205    by (import pred_set BIGUNION_SUBSET)
  2.5206  
  2.5207 -lemma FINITE_BIGUNION: "ALL x. FINITE x & (ALL s. IN s x --> FINITE s) --> FINITE (BIGUNION x)"
  2.5208 +lemma FINITE_BIGUNION: "ALL x::('a::type => bool) => bool.
  2.5209 +   FINITE x & (ALL s::'a::type => bool. IN s x --> FINITE s) -->
  2.5210 +   FINITE (BIGUNION x)"
  2.5211    by (import pred_set FINITE_BIGUNION)
  2.5212  
  2.5213  constdefs
  2.5214 -  BIGINTER :: "(('a => bool) => bool) => 'a => bool" 
  2.5215 -  "BIGINTER == %B. GSPEC (%x. (x, ALL P. IN P B --> IN x P))"
  2.5216 -
  2.5217 -lemma BIGINTER: "ALL B. BIGINTER B = GSPEC (%x. (x, ALL P. IN P B --> IN x P))"
  2.5218 +  BIGINTER :: "(('a::type => bool) => bool) => 'a::type => bool" 
  2.5219 +  "BIGINTER ==
  2.5220 +%B::('a::type => bool) => bool.
  2.5221 +   GSPEC (%x::'a::type. (x, ALL P::'a::type => bool. IN P B --> IN x P))"
  2.5222 +
  2.5223 +lemma BIGINTER: "ALL B::('a::type => bool) => bool.
  2.5224 +   BIGINTER B =
  2.5225 +   GSPEC (%x::'a::type. (x, ALL P::'a::type => bool. IN P B --> IN x P))"
  2.5226    by (import pred_set BIGINTER)
  2.5227  
  2.5228 -lemma IN_BIGINTER: "IN x (BIGINTER B) = (ALL P. IN P B --> IN x P)"
  2.5229 +lemma IN_BIGINTER: "IN (x::'a::type) (BIGINTER (B::('a::type => bool) => bool)) =
  2.5230 +(ALL P::'a::type => bool. IN P B --> IN x P)"
  2.5231    by (import pred_set IN_BIGINTER)
  2.5232  
  2.5233 -lemma BIGINTER_INSERT: "ALL P B. BIGINTER (INSERT P B) = pred_set.INTER P (BIGINTER B)"
  2.5234 +lemma BIGINTER_INSERT: "ALL (P::'a::type => bool) B::('a::type => bool) => bool.
  2.5235 +   BIGINTER (INSERT P B) = pred_set.INTER P (BIGINTER B)"
  2.5236    by (import pred_set BIGINTER_INSERT)
  2.5237  
  2.5238  lemma BIGINTER_EMPTY: "BIGINTER EMPTY = pred_set.UNIV"
  2.5239    by (import pred_set BIGINTER_EMPTY)
  2.5240  
  2.5241 -lemma BIGINTER_INTER: "ALL x xa. BIGINTER (INSERT x (INSERT xa EMPTY)) = pred_set.INTER x xa"
  2.5242 +lemma BIGINTER_INTER: "ALL (x::'a::type => bool) xa::'a::type => bool.
  2.5243 +   BIGINTER (INSERT x (INSERT xa EMPTY)) = pred_set.INTER x xa"
  2.5244    by (import pred_set BIGINTER_INTER)
  2.5245  
  2.5246 -lemma BIGINTER_SING: "ALL x. BIGINTER (INSERT x EMPTY) = x"
  2.5247 +lemma BIGINTER_SING: "ALL x::'a::type => bool. BIGINTER (INSERT x EMPTY) = x"
  2.5248    by (import pred_set BIGINTER_SING)
  2.5249  
  2.5250 -lemma SUBSET_BIGINTER: "ALL X P. SUBSET X (BIGINTER P) = (ALL x. IN x P --> SUBSET X x)"
  2.5251 +lemma SUBSET_BIGINTER: "ALL (X::'a::type => bool) P::('a::type => bool) => bool.
  2.5252 +   SUBSET X (BIGINTER P) = (ALL x::'a::type => bool. IN x P --> SUBSET X x)"
  2.5253    by (import pred_set SUBSET_BIGINTER)
  2.5254  
  2.5255 -lemma DISJOINT_BIGINTER: "ALL x xa xb.
  2.5256 +lemma DISJOINT_BIGINTER: "ALL (x::'a::type => bool) (xa::'a::type => bool)
  2.5257 +   xb::('a::type => bool) => bool.
  2.5258     IN xa xb & DISJOINT xa x -->
  2.5259     DISJOINT x (BIGINTER xb) & DISJOINT (BIGINTER xb) x"
  2.5260    by (import pred_set DISJOINT_BIGINTER)
  2.5261  
  2.5262  constdefs
  2.5263 -  CROSS :: "('a => bool) => ('b => bool) => 'a * 'b => bool" 
  2.5264 -  "CROSS == %P Q. GSPEC (%p. (p, IN (fst p) P & IN (snd p) Q))"
  2.5265 -
  2.5266 -lemma CROSS_DEF: "ALL P Q. CROSS P Q = GSPEC (%p. (p, IN (fst p) P & IN (snd p) Q))"
  2.5267 +  CROSS :: "('a::type => bool) => ('b::type => bool) => 'a::type * 'b::type => bool" 
  2.5268 +  "CROSS ==
  2.5269 +%(P::'a::type => bool) Q::'b::type => bool.
  2.5270 +   GSPEC (%p::'a::type * 'b::type. (p, IN (fst p) P & IN (snd p) Q))"
  2.5271 +
  2.5272 +lemma CROSS_DEF: "ALL (P::'a::type => bool) Q::'b::type => bool.
  2.5273 +   CROSS P Q =
  2.5274 +   GSPEC (%p::'a::type * 'b::type. (p, IN (fst p) P & IN (snd p) Q))"
  2.5275    by (import pred_set CROSS_DEF)
  2.5276  
  2.5277 -lemma IN_CROSS: "ALL x xa xb. IN xb (CROSS x xa) = (IN (fst xb) x & IN (snd xb) xa)"
  2.5278 +lemma IN_CROSS: "ALL (x::'a::type => bool) (xa::'b::type => bool) xb::'a::type * 'b::type.
  2.5279 +   IN xb (CROSS x xa) = (IN (fst xb) x & IN (snd xb) xa)"
  2.5280    by (import pred_set IN_CROSS)
  2.5281  
  2.5282 -lemma CROSS_EMPTY: "ALL x. CROSS x EMPTY = EMPTY & CROSS EMPTY x = EMPTY"
  2.5283 +lemma CROSS_EMPTY: "ALL x::'a::type => bool. CROSS x EMPTY = EMPTY & CROSS EMPTY x = EMPTY"
  2.5284    by (import pred_set CROSS_EMPTY)
  2.5285  
  2.5286 -lemma CROSS_INSERT_LEFT: "ALL x xa xb.
  2.5287 +lemma CROSS_INSERT_LEFT: "ALL (x::'a::type => bool) (xa::'b::type => bool) xb::'a::type.
  2.5288     CROSS (INSERT xb x) xa =
  2.5289     pred_set.UNION (CROSS (INSERT xb EMPTY) xa) (CROSS x xa)"
  2.5290    by (import pred_set CROSS_INSERT_LEFT)
  2.5291  
  2.5292 -lemma CROSS_INSERT_RIGHT: "ALL x xa xb.
  2.5293 +lemma CROSS_INSERT_RIGHT: "ALL (x::'a::type => bool) (xa::'b::type => bool) xb::'b::type.
  2.5294     CROSS x (INSERT xb xa) =
  2.5295     pred_set.UNION (CROSS x (INSERT xb EMPTY)) (CROSS x xa)"
  2.5296    by (import pred_set CROSS_INSERT_RIGHT)
  2.5297  
  2.5298 -lemma FINITE_CROSS: "ALL x xa. FINITE x & FINITE xa --> FINITE (CROSS x xa)"
  2.5299 +lemma FINITE_CROSS: "ALL (x::'a::type => bool) xa::'b::type => bool.
  2.5300 +   FINITE x & FINITE xa --> FINITE (CROSS x xa)"
  2.5301    by (import pred_set FINITE_CROSS)
  2.5302  
  2.5303 -lemma CROSS_SINGS: "ALL x xa. CROSS (INSERT x EMPTY) (INSERT xa EMPTY) = INSERT (x, xa) EMPTY"
  2.5304 +lemma CROSS_SINGS: "ALL (x::'a::type) xa::'b::type.
  2.5305 +   CROSS (INSERT x EMPTY) (INSERT xa EMPTY) = INSERT (x, xa) EMPTY"
  2.5306    by (import pred_set CROSS_SINGS)
  2.5307  
  2.5308 -lemma CARD_SING_CROSS: "ALL x s. FINITE s --> CARD (CROSS (INSERT x EMPTY) s) = CARD s"
  2.5309 +lemma CARD_SING_CROSS: "ALL (x::'a::type) s::'b::type => bool.
  2.5310 +   FINITE s --> CARD (CROSS (INSERT x EMPTY) s) = CARD s"
  2.5311    by (import pred_set CARD_SING_CROSS)
  2.5312  
  2.5313 -lemma CARD_CROSS: "ALL x xa. FINITE x & FINITE xa --> CARD (CROSS x xa) = CARD x * CARD xa"
  2.5314 +lemma CARD_CROSS: "ALL (x::'a::type => bool) xa::'b::type => bool.
  2.5315 +   FINITE x & FINITE xa --> CARD (CROSS x xa) = CARD x * CARD xa"
  2.5316    by (import pred_set CARD_CROSS)
  2.5317  
  2.5318 -lemma CROSS_SUBSET: "ALL x xa xb xc.
  2.5319 +lemma CROSS_SUBSET: "ALL (x::'a::type => bool) (xa::'b::type => bool) (xb::'a::type => bool)
  2.5320 +   xc::'b::type => bool.
  2.5321     SUBSET (CROSS xb xc) (CROSS x xa) =
  2.5322     (xb = EMPTY | xc = EMPTY | SUBSET xb x & SUBSET xc xa)"
  2.5323    by (import pred_set CROSS_SUBSET)
  2.5324  
  2.5325 -lemma FINITE_CROSS_EQ: "ALL P Q. FINITE (CROSS P Q) = (P = EMPTY | Q = EMPTY | FINITE P & FINITE Q)"
  2.5326 +lemma FINITE_CROSS_EQ: "ALL (P::'a::type => bool) Q::'b::type => bool.
  2.5327 +   FINITE (CROSS P Q) = (P = EMPTY | Q = EMPTY | FINITE P & FINITE Q)"
  2.5328    by (import pred_set FINITE_CROSS_EQ)
  2.5329  
  2.5330  constdefs
  2.5331 -  COMPL :: "('a => bool) => 'a => bool" 
  2.5332 +  COMPL :: "('a::type => bool) => 'a::type => bool" 
  2.5333    "COMPL == DIFF pred_set.UNIV"
  2.5334  
  2.5335 -lemma COMPL_DEF: "ALL P. COMPL P = DIFF pred_set.UNIV P"
  2.5336 +lemma COMPL_DEF: "ALL P::'a::type => bool. COMPL P = DIFF pred_set.UNIV P"
  2.5337    by (import pred_set COMPL_DEF)
  2.5338  
  2.5339 -lemma IN_COMPL: "ALL x xa. IN x (COMPL xa) = (~ IN x xa)"
  2.5340 +lemma IN_COMPL: "ALL (x::'a::type) xa::'a::type => bool. IN x (COMPL xa) = (~ IN x xa)"
  2.5341    by (import pred_set IN_COMPL)
  2.5342  
  2.5343 -lemma COMPL_COMPL: "ALL x. COMPL (COMPL x) = x"
  2.5344 +lemma COMPL_COMPL: "ALL x::'a::type => bool. COMPL (COMPL x) = x"
  2.5345    by (import pred_set COMPL_COMPL)
  2.5346  
  2.5347 -lemma COMPL_CLAUSES: "ALL x.
  2.5348 +lemma COMPL_CLAUSES: "ALL x::'a::type => bool.
  2.5349     pred_set.INTER (COMPL x) x = EMPTY &
  2.5350     pred_set.UNION (COMPL x) x = pred_set.UNIV"
  2.5351    by (import pred_set COMPL_CLAUSES)
  2.5352  
  2.5353 -lemma COMPL_SPLITS: "ALL x xa.
  2.5354 +lemma COMPL_SPLITS: "ALL (x::'a::type => bool) xa::'a::type => bool.
  2.5355     pred_set.UNION (pred_set.INTER x xa) (pred_set.INTER (COMPL x) xa) = xa"
  2.5356    by (import pred_set COMPL_SPLITS)
  2.5357  
  2.5358 -lemma INTER_UNION_COMPL: "ALL x xa. pred_set.INTER x xa = COMPL (pred_set.UNION (COMPL x) (COMPL xa))"
  2.5359 +lemma INTER_UNION_COMPL: "ALL (x::'a::type => bool) xa::'a::type => bool.
  2.5360 +   pred_set.INTER x xa = COMPL (pred_set.UNION (COMPL x) (COMPL xa))"
  2.5361    by (import pred_set INTER_UNION_COMPL)
  2.5362  
  2.5363  lemma COMPL_EMPTY: "COMPL EMPTY = pred_set.UNIV"
  2.5364 @@ -3659,48 +4315,54 @@
  2.5365    count :: "nat => nat => bool" 
  2.5366  
  2.5367  defs
  2.5368 -  count_primdef: "count == %n. GSPEC (%m. (m, m < n))"
  2.5369 -
  2.5370 -lemma count_def: "ALL n. count n = GSPEC (%m. (m, m < n))"
  2.5371 +  count_primdef: "count == %n::nat. GSPEC (%m::nat. (m, m < n))"
  2.5372 +
  2.5373 +lemma count_def: "ALL n::nat. count n = GSPEC (%m::nat. (m, m < n))"
  2.5374    by (import pred_set count_def)
  2.5375  
  2.5376 -lemma IN_COUNT: "ALL m n. IN m (count n) = (m < n)"
  2.5377 +lemma IN_COUNT: "ALL (m::nat) n::nat. IN m (count n) = (m < n)"
  2.5378    by (import pred_set IN_COUNT)
  2.5379  
  2.5380 -lemma COUNT_ZERO: "count 0 = EMPTY"
  2.5381 +lemma COUNT_ZERO: "count (0::nat) = EMPTY"
  2.5382    by (import pred_set COUNT_ZERO)
  2.5383  
  2.5384 -lemma COUNT_SUC: "ALL n. count (Suc n) = INSERT n (count n)"
  2.5385 +lemma COUNT_SUC: "ALL n::nat. count (Suc n) = INSERT n (count n)"
  2.5386    by (import pred_set COUNT_SUC)
  2.5387  
  2.5388 -lemma FINITE_COUNT: "ALL n. FINITE (count n)"
  2.5389 +lemma FINITE_COUNT: "ALL n::nat. FINITE (count n)"
  2.5390    by (import pred_set FINITE_COUNT)
  2.5391  
  2.5392 -lemma CARD_COUNT: "ALL n. CARD (count n) = n"
  2.5393 +lemma CARD_COUNT: "ALL n::nat. CARD (count n) = n"
  2.5394    by (import pred_set CARD_COUNT)
  2.5395  
  2.5396  constdefs
  2.5397 -  ITSET_tupled :: "('a => 'b => 'b) => ('a => bool) * 'b => 'b" 
  2.5398 +  ITSET_tupled :: "('a::type => 'b::type => 'b::type)
  2.5399 +=> ('a::type => bool) * 'b::type => 'b::type" 
  2.5400    "ITSET_tupled ==
  2.5401 -%f. WFREC
  2.5402 -     (SOME R.
  2.5403 -         WF R &
  2.5404 -         (ALL b s.
  2.5405 -             FINITE s & s ~= EMPTY --> R (REST s, f (CHOICE s) b) (s, b)))
  2.5406 -     (%ITSET_tupled (v, v1).
  2.5407 -         if FINITE v
  2.5408 -         then if v = EMPTY then v1
  2.5409 -              else ITSET_tupled (REST v, f (CHOICE v) v1)
  2.5410 -         else ARB)"
  2.5411 -
  2.5412 -lemma ITSET_tupled_primitive_def: "ALL f.
  2.5413 +%f::'a::type => 'b::type => 'b::type.
  2.5414 +   WFREC
  2.5415 +    (SOME R::('a::type => bool) * 'b::type
  2.5416 +             => ('a::type => bool) * 'b::type => bool.
  2.5417 +        WF R &
  2.5418 +        (ALL (b::'b::type) s::'a::type => bool.
  2.5419 +            FINITE s & s ~= EMPTY --> R (REST s, f (CHOICE s) b) (s, b)))
  2.5420 +    (%(ITSET_tupled::('a::type => bool) * 'b::type => 'b::type)
  2.5421 +        (v::'a::type => bool, v1::'b::type).
  2.5422 +        if FINITE v
  2.5423 +        then if v = EMPTY then v1
  2.5424 +             else ITSET_tupled (REST v, f (CHOICE v) v1)
  2.5425 +        else ARB)"
  2.5426 +
  2.5427 +lemma ITSET_tupled_primitive_def: "ALL f::'a::type => 'b::type => 'b::type.
  2.5428     ITSET_tupled f =
  2.5429     WFREC
  2.5430 -    (SOME R.
  2.5431 +    (SOME R::('a::type => bool) * 'b::type
  2.5432 +             => ('a::type => bool) * 'b::type => bool.
  2.5433          WF R &
  2.5434 -        (ALL b s.
  2.5435 +        (ALL (b::'b::type) s::'a::type => bool.
  2.5436              FINITE s & s ~= EMPTY --> R (REST s, f (CHOICE s) b) (s, b)))
  2.5437 -    (%ITSET_tupled (v, v1).
  2.5438 +    (%(ITSET_tupled::('a::type => bool) * 'b::type => 'b::type)
  2.5439 +        (v::'a::type => bool, v1::'b::type).
  2.5440          if FINITE v
  2.5441          then if v = EMPTY then v1
  2.5442               else ITSET_tupled (REST v, f (CHOICE v) v1)
  2.5443 @@ -3708,26 +4370,32 @@
  2.5444    by (import pred_set ITSET_tupled_primitive_def)
  2.5445  
  2.5446  constdefs
  2.5447 -  ITSET :: "('a => 'b => 'b) => ('a => bool) => 'b => 'b" 
  2.5448 -  "ITSET == %f x x1. ITSET_tupled f (x, x1)"
  2.5449 -
  2.5450 -lemma ITSET_curried_def: "ALL f x x1. ITSET f x x1 = ITSET_tupled f (x, x1)"
  2.5451 +  ITSET :: "('a::type => 'b::type => 'b::type)
  2.5452 +=> ('a::type => bool) => 'b::type => 'b::type" 
  2.5453 +  "ITSET ==
  2.5454 +%(f::'a::type => 'b::type => 'b::type) (x::'a::type => bool) x1::'b::type.
  2.5455 +   ITSET_tupled f (x, x1)"
  2.5456 +
  2.5457 +lemma ITSET_curried_def: "ALL (f::'a::type => 'b::type => 'b::type) (x::'a::type => bool)
  2.5458 +   x1::'b::type. ITSET f x x1 = ITSET_tupled f (x, x1)"
  2.5459    by (import pred_set ITSET_curried_def)
  2.5460  
  2.5461 -lemma ITSET_IND: "ALL P.
  2.5462 -   (ALL s b.
  2.5463 -       (FINITE s & s ~= EMPTY --> P (REST s) (f (CHOICE s) b)) -->
  2.5464 +lemma ITSET_IND: "ALL P::('a::type => bool) => 'b::type => bool.
  2.5465 +   (ALL (s::'a::type => bool) b::'b::type.
  2.5466 +       (FINITE s & s ~= EMPTY -->
  2.5467 +        P (REST s) ((f::'a::type => 'b::type => 'b::type) (CHOICE s) b)) -->
  2.5468         P s b) -->
  2.5469 -   (ALL v. All (P v))"
  2.5470 +   (ALL v::'a::type => bool. All (P v))"
  2.5471    by (import pred_set ITSET_IND)
  2.5472  
  2.5473 -lemma ITSET_THM: "ALL s f b.
  2.5474 +lemma ITSET_THM: "ALL (s::'a::type => bool) (f::'a::type => 'b::type => 'b::type) b::'b::type.
  2.5475     FINITE s -->
  2.5476     ITSET f s b =
  2.5477     (if s = EMPTY then b else ITSET f (REST s) (f (CHOICE s) b))"
  2.5478    by (import pred_set ITSET_THM)
  2.5479  
  2.5480 -lemma ITSET_EMPTY: "ALL x xa. ITSET x EMPTY xa = xa"
  2.5481 +lemma ITSET_EMPTY: "ALL (x::'a::type => 'b::type => 'b::type) xa::'b::type.
  2.5482 +   ITSET x EMPTY xa = xa"
  2.5483    by (import pred_set ITSET_EMPTY)
  2.5484  
  2.5485  ;end_setup
  2.5486 @@ -3735,45 +4403,67 @@
  2.5487  ;setup_theory operator
  2.5488  
  2.5489  constdefs
  2.5490 -  ASSOC :: "('a => 'a => 'a) => bool" 
  2.5491 -  "ASSOC == %f. ALL x y z. f x (f y z) = f (f x y) z"
  2.5492 -
  2.5493 -lemma ASSOC_DEF: "ALL f. ASSOC f = (ALL x y z. f x (f y z) = f (f x y) z)"
  2.5494 +  ASSOC :: "('a::type => 'a::type => 'a::type) => bool" 
  2.5495 +  "ASSOC ==
  2.5496 +%f::'a::type => 'a::type => 'a::type.
  2.5497 +   ALL (x::'a::type) (y::'a::type) z::'a::type. f x (f y z) = f (f x y) z"
  2.5498 +
  2.5499 +lemma ASSOC_DEF: "ALL f::'a::type => 'a::type => 'a::type.
  2.5500 +   ASSOC f =
  2.5501 +   (ALL (x::'a::type) (y::'a::type) z::'a::type. f x (f y z) = f (f x y) z)"
  2.5502    by (import operator ASSOC_DEF)
  2.5503  
  2.5504  constdefs
  2.5505 -  COMM :: "('a => 'a => 'b) => bool" 
  2.5506 -  "COMM == %f. ALL x y. f x y = f y x"
  2.5507 -
  2.5508 -lemma COMM_DEF: "ALL f. COMM f = (ALL x y. f x y = f y x)"
  2.5509 +  COMM :: "('a::type => 'a::type => 'b::type) => bool" 
  2.5510 +  "COMM ==
  2.5511 +%f::'a::type => 'a::type => 'b::type.
  2.5512 +   ALL (x::'a::type) y::'a::type. f x y = f y x"
  2.5513 +
  2.5514 +lemma COMM_DEF: "ALL f::'a::type => 'a::type => 'b::type.
  2.5515 +   COMM f = (ALL (x::'a::type) y::'a::type. f x y = f y x)"
  2.5516    by (import operator COMM_DEF)
  2.5517  
  2.5518  constdefs
  2.5519 -  FCOMM :: "('a => 'b => 'a) => ('c => 'a => 'a) => bool" 
  2.5520 -  "FCOMM == %f g. ALL x y z. g x (f y z) = f (g x y) z"
  2.5521 -
  2.5522 -lemma FCOMM_DEF: "ALL f g. FCOMM f g = (ALL x y z. g x (f y z) = f (g x y) z)"
  2.5523 +  FCOMM :: "('a::type => 'b::type => 'a::type)
  2.5524 +=> ('c::type => 'a::type => 'a::type) => bool" 
  2.5525 +  "FCOMM ==
  2.5526 +%(f::'a::type => 'b::type => 'a::type) g::'c::type => 'a::type => 'a::type.
  2.5527 +   ALL (x::'c::type) (y::'a::type) z::'b::type. g x (f y z) = f (g x y) z"
  2.5528 +
  2.5529 +lemma FCOMM_DEF: "ALL (f::'a::type => 'b::type => 'a::type)
  2.5530 +   g::'c::type => 'a::type => 'a::type.
  2.5531 +   FCOMM f g =
  2.5532 +   (ALL (x::'c::type) (y::'a::type) z::'b::type. g x (f y z) = f (g x y) z)"
  2.5533    by (import operator FCOMM_DEF)
  2.5534  
  2.5535  constdefs
  2.5536 -  RIGHT_ID :: "('a => 'b => 'a) => 'b => bool" 
  2.5537 -  "RIGHT_ID == %f e. ALL x. f x e = x"
  2.5538 -
  2.5539 -lemma RIGHT_ID_DEF: "ALL f e. RIGHT_ID f e = (ALL x. f x e = x)"
  2.5540 +  RIGHT_ID :: "('a::type => 'b::type => 'a::type) => 'b::type => bool" 
  2.5541 +  "RIGHT_ID ==
  2.5542 +%(f::'a::type => 'b::type => 'a::type) e::'b::type.
  2.5543 +   ALL x::'a::type. f x e = x"
  2.5544 +
  2.5545 +lemma RIGHT_ID_DEF: "ALL (f::'a::type => 'b::type => 'a::type) e::'b::type.
  2.5546 +   RIGHT_ID f e = (ALL x::'a::type. f x e = x)"
  2.5547    by (import operator RIGHT_ID_DEF)
  2.5548  
  2.5549  constdefs
  2.5550 -  LEFT_ID :: "('a => 'b => 'b) => 'a => bool" 
  2.5551 -  "LEFT_ID == %f e. ALL x. f e x = x"
  2.5552 -
  2.5553 -lemma LEFT_ID_DEF: "ALL f e. LEFT_ID f e = (ALL x. f e x = x)"
  2.5554 +  LEFT_ID :: "('a::type => 'b::type => 'b::type) => 'a::type => bool" 
  2.5555 +  "LEFT_ID ==
  2.5556 +%(f::'a::type => 'b::type => 'b::type) e::'a::type.
  2.5557 +   ALL x::'b::type. f e x = x"
  2.5558 +
  2.5559 +lemma LEFT_ID_DEF: "ALL (f::'a::type => 'b::type => 'b::type) e::'a::type.
  2.5560 +   LEFT_ID f e = (ALL x::'b::type. f e x = x)"
  2.5561    by (import operator LEFT_ID_DEF)
  2.5562  
  2.5563  constdefs
  2.5564 -  MONOID :: "('a => 'a => 'a) => 'a => bool" 
  2.5565 -  "MONOID == %f e. ASSOC f & RIGHT_ID f e & LEFT_ID f e"
  2.5566 -
  2.5567 -lemma MONOID_DEF: "ALL f e. MONOID f e = (ASSOC f & RIGHT_ID f e & LEFT_ID f e)"
  2.5568 +  MONOID :: "('a::type => 'a::type => 'a::type) => 'a::type => bool" 
  2.5569 +  "MONOID ==
  2.5570 +%(f::'a::type => 'a::type => 'a::type) e::'a::type.
  2.5571 +   ASSOC f & RIGHT_ID f e & LEFT_ID f e"
  2.5572 +
  2.5573 +lemma MONOID_DEF: "ALL (f::'a::type => 'a::type => 'a::type) e::'a::type.
  2.5574 +   MONOID f e = (ASSOC f & RIGHT_ID f e & LEFT_ID f e)"
  2.5575    by (import operator MONOID_DEF)
  2.5576  
  2.5577  lemma ASSOC_CONJ: "ASSOC op &"
  2.5578 @@ -3782,7 +4472,7 @@
  2.5579  lemma ASSOC_DISJ: "ASSOC op |"
  2.5580    by (import operator ASSOC_DISJ)
  2.5581  
  2.5582 -lemma FCOMM_ASSOC: "ALL x. FCOMM x x = ASSOC x"
  2.5583 +lemma FCOMM_ASSOC: "ALL x::'a::type => 'a::type => 'a::type. FCOMM x x = ASSOC x"
  2.5584    by (import operator FCOMM_ASSOC)
  2.5585  
  2.5586  lemma MONOID_CONJ_T: "MONOID op & True"
  2.5587 @@ -3796,29 +4486,35 @@
  2.5588  ;setup_theory rich_list
  2.5589  
  2.5590  consts
  2.5591 -  SNOC :: "'a => 'a list => 'a list" 
  2.5592 -
  2.5593 -specification (SNOC) SNOC: "(ALL x::'a. SNOC x [] = [x]) &
  2.5594 -(ALL (x::'a) (x'::'a) l::'a list. SNOC x (x' # l) = x' # SNOC x l)"
  2.5595 +  SNOC :: "'a::type => 'a::type list => 'a::type list" 
  2.5596 +
  2.5597 +specification (SNOC) SNOC: "(ALL x::'a::type. SNOC x [] = [x]) &
  2.5598 +(ALL (x::'a::type) (x'::'a::type) l::'a::type list.
  2.5599 +    SNOC x (x' # l) = x' # SNOC x l)"
  2.5600    by (import rich_list SNOC)
  2.5601  
  2.5602  consts
  2.5603 -  SCANL :: "('b => 'a => 'b) => 'b => 'a list => 'b list" 
  2.5604 -
  2.5605 -specification (SCANL) SCANL: "(ALL (f::'b => 'a => 'b) e::'b. SCANL f e [] = [e]) &
  2.5606 -(ALL (f::'b => 'a => 'b) (e::'b) (x::'a) l::'a list.
  2.5607 -    SCANL f e (x # l) = e # SCANL f (f e x) l)"
  2.5608 +  SCANL :: "('b::type => 'a::type => 'b::type)
  2.5609 +=> 'b::type => 'a::type list => 'b::type list" 
  2.5610 +
  2.5611 +specification (SCANL) SCANL: "(ALL (f::'b::type => 'a::type => 'b::type) e::'b::type.
  2.5612 +    SCANL f e [] = [e]) &
  2.5613 +(ALL (f::'b::type => 'a::type => 'b::type) (e::'b::type) (x::'a::type)
  2.5614 +    l::'a::type list. SCANL f e (x # l) = e # SCANL f (f e x) l)"
  2.5615    by (import rich_list SCANL)
  2.5616  
  2.5617  consts
  2.5618 -  SCANR :: "('a => 'b => 'b) => 'b => 'a list => 'b list" 
  2.5619 -
  2.5620 -specification (SCANR) SCANR: "(ALL (f::'a => 'b => 'b) e::'b. SCANR f e [] = [e]) &
  2.5621 -(ALL (f::'a => 'b => 'b) (e::'b) (x::'a) l::'a list.
  2.5622 +  SCANR :: "('a::type => 'b::type => 'b::type)
  2.5623 +=> 'b::type => 'a::type list => 'b::type list" 
  2.5624 +
  2.5625 +specification (SCANR) SCANR: "(ALL (f::'a::type => 'b::type => 'b::type) e::'b::type.
  2.5626 +    SCANR f e [] = [e]) &
  2.5627 +(ALL (f::'a::type => 'b::type => 'b::type) (e::'b::type) (x::'a::type)
  2.5628 +    l::'a::type list.
  2.5629      SCANR f e (x # l) = f x (hd (SCANR f e l)) # SCANR f e l)"
  2.5630    by (import rich_list SCANR)
  2.5631  
  2.5632 -lemma IS_EL_DEF: "ALL x l. x mem l = list_exists (op = x) l"
  2.5633 +lemma IS_EL_DEF: "ALL (x::'a::type) l::'a::type list. x mem l = list_exists (op = x) l"
  2.5634    by (import rich_list IS_EL_DEF)
  2.5635  
  2.5636  constdefs
  2.5637 @@ -3836,255 +4532,290 @@
  2.5638    by (import rich_list OR_EL_DEF)
  2.5639  
  2.5640  consts
  2.5641 -  FIRSTN :: "nat => 'a list => 'a list" 
  2.5642 -
  2.5643 -specification (FIRSTN) FIRSTN: "(ALL l::'a list. FIRSTN (0::nat) l = []) &
  2.5644 -(ALL (n::nat) (x::'a) l::'a list. FIRSTN (Suc n) (x # l) = x # FIRSTN n l)"
  2.5645 +  FIRSTN :: "nat => 'a::type list => 'a::type list" 
  2.5646 +
  2.5647 +specification (FIRSTN) FIRSTN: "(ALL l::'a::type list. FIRSTN (0::nat) l = []) &
  2.5648 +(ALL (n::nat) (x::'a::type) l::'a::type list.
  2.5649 +    FIRSTN (Suc n) (x # l) = x # FIRSTN n l)"
  2.5650    by (import rich_list FIRSTN)
  2.5651  
  2.5652  consts
  2.5653 -  BUTFIRSTN :: "nat => 'a list => 'a list" 
  2.5654 -
  2.5655 -specification (BUTFIRSTN) BUTFIRSTN: "(ALL l::'a list. BUTFIRSTN (0::nat) l = l) &
  2.5656 -(ALL (n::nat) (x::'a) l::'a list. BUTFIRSTN (Suc n) (x # l) = BUTFIRSTN n l)"
  2.5657 +  BUTFIRSTN :: "nat => 'a::type list => 'a::type list" 
  2.5658 +
  2.5659 +specification (BUTFIRSTN) BUTFIRSTN: "(ALL l::'a::type list. BUTFIRSTN (0::nat) l = l) &
  2.5660 +(ALL (n::nat) (x::'a::type) l::'a::type list.
  2.5661 +    BUTFIRSTN (Suc n) (x # l) = BUTFIRSTN n l)"
  2.5662    by (import rich_list BUTFIRSTN)
  2.5663  
  2.5664  consts
  2.5665 -  SEG :: "nat => nat => 'a list => 'a list" 
  2.5666 -
  2.5667 -specification (SEG) SEG: "(ALL (k::nat) l::'a list. SEG (0::nat) k l = []) &
  2.5668 -(ALL (m::nat) (x::'a) l::'a list.
  2.5669 +  SEG :: "nat => nat => 'a::type list => 'a::type list" 
  2.5670 +
  2.5671 +specification (SEG) SEG: "(ALL (k::nat) l::'a::type list. SEG (0::nat) k l = []) &
  2.5672 +(ALL (m::nat) (x::'a::type) l::'a::type list.
  2.5673      SEG (Suc m) (0::nat) (x # l) = x # SEG m (0::nat) l) &
  2.5674 -(ALL (m::nat) (k::nat) (x::'a) l::'a list.
  2.5675 +(ALL (m::nat) (k::nat) (x::'a::type) l::'a::type list.
  2.5676      SEG (Suc m) (Suc k) (x # l) = SEG (Suc m) k l)"
  2.5677    by (import rich_list SEG)
  2.5678  
  2.5679 -lemma LAST: "ALL x l. last (SNOC x l) = x"
  2.5680 +lemma LAST: "ALL (x::'a::type) l::'a::type list. last (SNOC x l) = x"
  2.5681    by (import rich_list LAST)
  2.5682  
  2.5683 -lemma BUTLAST: "ALL x l. butlast (SNOC x l) = l"
  2.5684 +lemma BUTLAST: "ALL (x::'a::type) l::'a::type list. butlast (SNOC x l) = l"
  2.5685    by (import rich_list BUTLAST)
  2.5686  
  2.5687  consts
  2.5688 -  LASTN :: "nat => 'a list => 'a list" 
  2.5689 -
  2.5690 -specification (LASTN) LASTN: "(ALL l::'a list. LASTN (0::nat) l = []) &
  2.5691 -(ALL (n::nat) (x::'a) l::'a list.
  2.5692 +  LASTN :: "nat => 'a::type list => 'a::type list" 
  2.5693 +
  2.5694 +specification (LASTN) LASTN: "(ALL l::'a::type list. LASTN (0::nat) l = []) &
  2.5695 +(ALL (n::nat) (x::'a::type) l::'a::type list.
  2.5696      LASTN (Suc n) (SNOC x l) = SNOC x (LASTN n l))"
  2.5697    by (import rich_list LASTN)
  2.5698  
  2.5699  consts
  2.5700 -  BUTLASTN :: "nat => 'a list => 'a list" 
  2.5701 -
  2.5702 -specification (BUTLASTN) BUTLASTN: "(ALL l::'a list. BUTLASTN (0::nat) l = l) &
  2.5703 -(ALL (n::nat) (x::'a) l::'a list.
  2.5704 +  BUTLASTN :: "nat => 'a::type list => 'a::type list" 
  2.5705 +
  2.5706 +specification (BUTLASTN) BUTLASTN: "(ALL l::'a::type list. BUTLASTN (0::nat) l = l) &
  2.5707 +(ALL (n::nat) (x::'a::type) l::'a::type list.
  2.5708      BUTLASTN (Suc n) (SNOC x l) = BUTLASTN n l)"
  2.5709    by (import rich_list BUTLASTN)
  2.5710  
  2.5711 -lemma EL: "(ALL x::'a list. EL (0::nat) x = hd x) &
  2.5712 -(ALL (x::nat) xa::'a list. EL (Suc x) xa = EL x (tl xa))"
  2.5713 +lemma EL: "(ALL x::'a::type list. EL (0::nat) x = hd x) &
  2.5714 +(ALL (x::nat) xa::'a::type list. EL (Suc x) xa = EL x (tl xa))"
  2.5715    by (import rich_list EL)
  2.5716  
  2.5717  consts
  2.5718 -  ELL :: "nat => 'a list => 'a" 
  2.5719 -
  2.5720 -specification (ELL) ELL: "(ALL l::'a list. ELL (0::nat) l = last l) &
  2.5721 -(ALL (n::nat) l::'a list. ELL (Suc n) l = ELL n (butlast l))"
  2.5722 +  ELL :: "nat => 'a::type list => 'a::type" 
  2.5723 +
  2.5724 +specification (ELL) ELL: "(ALL l::'a::type list. ELL (0::nat) l = last l) &
  2.5725 +(ALL (n::nat) l::'a::type list. ELL (Suc n) l = ELL n (butlast l))"
  2.5726    by (import rich_list ELL)
  2.5727  
  2.5728  consts
  2.5729 -  IS_PREFIX :: "'a list => 'a list => bool" 
  2.5730 -
  2.5731 -specification (IS_PREFIX) IS_PREFIX: "(ALL l::'a list. IS_PREFIX l [] = True) &
  2.5732 -(ALL (x::'a) l::'a list. IS_PREFIX [] (x # l) = False) &
  2.5733 -(ALL (x1::'a) (l1::'a list) (x2::'a) l2::'a list.
  2.5734 +  IS_PREFIX :: "'a::type list => 'a::type list => bool" 
  2.5735 +
  2.5736 +specification (IS_PREFIX) IS_PREFIX: "(ALL l::'a::type list. IS_PREFIX l [] = True) &
  2.5737 +(ALL (x::'a::type) l::'a::type list. IS_PREFIX [] (x # l) = False) &
  2.5738 +(ALL (x1::'a::type) (l1::'a::type list) (x2::'a::type) l2::'a::type list.
  2.5739      IS_PREFIX (x1 # l1) (x2 # l2) = (x1 = x2 & IS_PREFIX l1 l2))"
  2.5740    by (import rich_list IS_PREFIX)
  2.5741  
  2.5742 -lemma SNOC_APPEND: "ALL x l. SNOC x l = l @ [x]"
  2.5743 +lemma SNOC_APPEND: "ALL (x::'a::type) l::'a::type list. SNOC x l = l @ [x]"
  2.5744    by (import rich_list SNOC_APPEND)
  2.5745  
  2.5746 -lemma REVERSE: "rev [] = [] & (ALL (x::'a) xa::'a list. rev (x # xa) = SNOC x (rev xa))"
  2.5747 +lemma REVERSE: "rev [] = [] &
  2.5748 +(ALL (x::'a::type) xa::'a::type list. rev (x # xa) = SNOC x (rev xa))"
  2.5749    by (import rich_list REVERSE)
  2.5750  
  2.5751 -lemma REVERSE_SNOC: "ALL x l. rev (SNOC x l) = x # rev l"
  2.5752 +lemma REVERSE_SNOC: "ALL (x::'a::type) l::'a::type list. rev (SNOC x l) = x # rev l"
  2.5753    by (import rich_list REVERSE_SNOC)
  2.5754  
  2.5755 -lemma SNOC_Axiom: "ALL (e::'b) f::'a => 'a list => 'b => 'b.
  2.5756 -   EX x::'a list => 'b.
  2.5757 -      x [] = e & (ALL (xa::'a) l::'a list. x (SNOC xa l) = f xa l (x l))"
  2.5758 +lemma SNOC_Axiom: "ALL (e::'b::type) f::'a::type => 'a::type list => 'b::type => 'b::type.
  2.5759 +   EX x::'a::type list => 'b::type.
  2.5760 +      x [] = e &
  2.5761 +      (ALL (xa::'a::type) l::'a::type list. x (SNOC xa l) = f xa l (x l))"
  2.5762    by (import rich_list SNOC_Axiom)
  2.5763  
  2.5764  consts
  2.5765 -  IS_SUFFIX :: "'a list => 'a list => bool" 
  2.5766 -
  2.5767 -specification (IS_SUFFIX) IS_SUFFIX: "(ALL l::'a list. IS_SUFFIX l [] = True) &
  2.5768 -(ALL (x::'a) l::'a list. IS_SUFFIX [] (SNOC x l) = False) &
  2.5769 -(ALL (x1::'a) (l1::'a list) (x2::'a) l2::'a list.
  2.5770 +  IS_SUFFIX :: "'a::type list => 'a::type list => bool" 
  2.5771 +
  2.5772 +specification (IS_SUFFIX) IS_SUFFIX: "(ALL l::'a::type list. IS_SUFFIX l [] = True) &
  2.5773 +(ALL (x::'a::type) l::'a::type list. IS_SUFFIX [] (SNOC x l) = False) &
  2.5774 +(ALL (x1::'a::type) (l1::'a::type list) (x2::'a::type) l2::'a::type list.
  2.5775      IS_SUFFIX (SNOC x1 l1) (SNOC x2 l2) = (x1 = x2 & IS_SUFFIX l1 l2))"
  2.5776    by (import rich_list IS_SUFFIX)
  2.5777  
  2.5778  consts
  2.5779 -  IS_SUBLIST :: "'a list => 'a list => bool" 
  2.5780 -
  2.5781 -specification (IS_SUBLIST) IS_SUBLIST: "(ALL l::'a list. IS_SUBLIST l [] = True) &
  2.5782 -(ALL (x::'a) l::'a list. IS_SUBLIST [] (x # l) = False) &
  2.5783 -(ALL (x1::'a) (l1::'a list) (x2::'a) l2::'a list.
  2.5784 +  IS_SUBLIST :: "'a::type list => 'a::type list => bool" 
  2.5785 +
  2.5786 +specification (IS_SUBLIST) IS_SUBLIST: "(ALL l::'a::type list. IS_SUBLIST l [] = True) &
  2.5787 +(ALL (x::'a::type) l::'a::type list. IS_SUBLIST [] (x # l) = False) &
  2.5788 +(ALL (x1::'a::type) (l1::'a::type list) (x2::'a::type) l2::'a::type list.
  2.5789      IS_SUBLIST (x1 # l1) (x2 # l2) =
  2.5790      (x1 = x2 & IS_PREFIX l1 l2 | IS_SUBLIST l1 (x2 # l2)))"
  2.5791    by (import rich_list IS_SUBLIST)
  2.5792  
  2.5793  consts
  2.5794 -  SPLITP :: "('a => bool) => 'a list => 'a list * 'a list" 
  2.5795 -
  2.5796 -specification (SPLITP) SPLITP: "(ALL P::'a => bool. SPLITP P [] = ([], [])) &
  2.5797 -(ALL (P::'a => bool) (x::'a) l::'a list.
  2.5798 +  SPLITP :: "('a::type => bool) => 'a::type list => 'a::type list * 'a::type list" 
  2.5799 +
  2.5800 +specification (SPLITP) SPLITP: "(ALL P::'a::type => bool. SPLITP P [] = ([], [])) &
  2.5801 +(ALL (P::'a::type => bool) (x::'a::type) l::'a::type list.
  2.5802      SPLITP P (x # l) =
  2.5803      (if P x then ([], x # l) else (x # fst (SPLITP P l), snd (SPLITP P l))))"
  2.5804    by (import rich_list SPLITP)
  2.5805  
  2.5806  constdefs
  2.5807 -  PREFIX :: "('a => bool) => 'a list => 'a list" 
  2.5808 -  "PREFIX == %P l. fst (SPLITP (Not o P) l)"
  2.5809 -
  2.5810 -lemma PREFIX_DEF: "ALL P l. PREFIX P l = fst (SPLITP (Not o P) l)"
  2.5811 +  PREFIX :: "('a::type => bool) => 'a::type list => 'a::type list" 
  2.5812 +  "PREFIX == %(P::'a::type => bool) l::'a::type list. fst (SPLITP (Not o P) l)"
  2.5813 +
  2.5814 +lemma PREFIX_DEF: "ALL (P::'a::type => bool) l::'a::type list.
  2.5815 +   PREFIX P l = fst (SPLITP (Not o P) l)"
  2.5816    by (import rich_list PREFIX_DEF)
  2.5817  
  2.5818  constdefs
  2.5819 -  SUFFIX :: "('a => bool) => 'a list => 'a list" 
  2.5820 -  "SUFFIX == %P. foldl (%l' x. if P x then SNOC x l' else []) []"
  2.5821 -
  2.5822 -lemma SUFFIX_DEF: "ALL P l. SUFFIX P l = foldl (%l' x. if P x then SNOC x l' else []) [] l"
  2.5823 +  SUFFIX :: "('a::type => bool) => 'a::type list => 'a::type list" 
  2.5824 +  "SUFFIX ==
  2.5825 +%P::'a::type => bool.
  2.5826 +   foldl (%(l'::'a::type list) x::'a::type. if P x then SNOC x l' else [])
  2.5827 +    []"
  2.5828 +
  2.5829 +lemma SUFFIX_DEF: "ALL (P::'a::type => bool) l::'a::type list.
  2.5830 +   SUFFIX P l =
  2.5831 +   foldl (%(l'::'a::type list) x::'a::type. if P x then SNOC x l' else [])
  2.5832 +    [] l"
  2.5833    by (import rich_list SUFFIX_DEF)
  2.5834  
  2.5835  constdefs
  2.5836 -  UNZIP_FST :: "('a * 'b) list => 'a list" 
  2.5837 -  "UNZIP_FST == %l. fst (unzip l)"
  2.5838 -
  2.5839 -lemma UNZIP_FST_DEF: "ALL l. UNZIP_FST l = fst (unzip l)"
  2.5840 +  UNZIP_FST :: "('a::type * 'b::type) list => 'a::type list" 
  2.5841 +  "UNZIP_FST == %l::('a::type * 'b::type) list. fst (unzip l)"
  2.5842 +
  2.5843 +lemma UNZIP_FST_DEF: "ALL l::('a::type * 'b::type) list. UNZIP_FST l = fst (unzip l)"
  2.5844    by (import rich_list UNZIP_FST_DEF)
  2.5845  
  2.5846  constdefs
  2.5847 -  UNZIP_SND :: "('a * 'b) list => 'b list" 
  2.5848 -  "UNZIP_SND == %l. snd (unzip l)"
  2.5849 -
  2.5850 -lemma UNZIP_SND_DEF: "ALL l. UNZIP_SND l = snd (unzip l)"
  2.5851 +  UNZIP_SND :: "('a::type * 'b::type) list => 'b::type list" 
  2.5852 +  "UNZIP_SND == %l::('a::type * 'b::type) list. snd (unzip l)"
  2.5853 +
  2.5854 +lemma UNZIP_SND_DEF: "ALL l::('a::type * 'b::type) list. UNZIP_SND l = snd (unzip l)"
  2.5855    by (import rich_list UNZIP_SND_DEF)
  2.5856  
  2.5857  consts
  2.5858 -  GENLIST :: "(nat => 'a) => nat => 'a list" 
  2.5859 -
  2.5860 -specification (GENLIST) GENLIST: "(ALL f::nat => 'a. GENLIST f (0::nat) = []) &
  2.5861 -(ALL (f::nat => 'a) n::nat. GENLIST f (Suc n) = SNOC (f n) (GENLIST f n))"
  2.5862 +  GENLIST :: "(nat => 'a::type) => nat => 'a::type list" 
  2.5863 +
  2.5864 +specification (GENLIST) GENLIST: "(ALL f::nat => 'a::type. GENLIST f (0::nat) = []) &
  2.5865 +(ALL (f::nat => 'a::type) n::nat.
  2.5866 +    GENLIST f (Suc n) = SNOC (f n) (GENLIST f n))"
  2.5867    by (import rich_list GENLIST)
  2.5868  
  2.5869  consts
  2.5870 -  REPLICATE :: "nat => 'a => 'a list" 
  2.5871 -
  2.5872 -specification (REPLICATE) REPLICATE: "(ALL x::'a. REPLICATE (0::nat) x = []) &
  2.5873 -(ALL (n::nat) x::'a. REPLICATE (Suc n) x = x # REPLICATE n x)"
  2.5874 +  REPLICATE :: "nat => 'a::type => 'a::type list" 
  2.5875 +
  2.5876 +specification (REPLICATE) REPLICATE: "(ALL x::'a::type. REPLICATE (0::nat) x = []) &
  2.5877 +(ALL (n::nat) x::'a::type. REPLICATE (Suc n) x = x # REPLICATE n x)"
  2.5878    by (import rich_list REPLICATE)
  2.5879  
  2.5880 -lemma LENGTH_MAP2: "ALL l1 l2.
  2.5881 +lemma LENGTH_MAP2: "ALL (l1::'a::type list) l2::'b::type list.
  2.5882     length l1 = length l2 -->
  2.5883 -   (ALL f.
  2.5884 +   (ALL f::'a::type => 'b::type => 'c::type.
  2.5885         length (map2 f l1 l2) = length l1 &
  2.5886         length (map2 f l1 l2) = length l2)"
  2.5887    by (import rich_list LENGTH_MAP2)
  2.5888  
  2.5889 -lemma NULL_EQ_NIL: "ALL l. null l = (l = [])"
  2.5890 +lemma NULL_EQ_NIL: "ALL l::'a::type list. null l = (l = [])"
  2.5891    by (import rich_list NULL_EQ_NIL)
  2.5892  
  2.5893 -lemma LENGTH_EQ: "ALL x y. x = y --> length x = length y"
  2.5894 +lemma LENGTH_EQ: "ALL (x::'a::type list) y::'a::type list. x = y --> length x = length y"
  2.5895    by (import rich_list LENGTH_EQ)
  2.5896  
  2.5897 -lemma LENGTH_NOT_NULL: "ALL l. (0 < length l) = (~ null l)"
  2.5898 +lemma LENGTH_NOT_NULL: "ALL l::'a::type list. ((0::nat) < length l) = (~ null l)"
  2.5899    by (import rich_list LENGTH_NOT_NULL)
  2.5900  
  2.5901 -lemma SNOC_INDUCT: "ALL P. P [] & (ALL l. P l --> (ALL x. P (SNOC x l))) --> All P"
  2.5902 +lemma SNOC_INDUCT: "ALL P::'a::type list => bool.
  2.5903 +   P [] &
  2.5904 +   (ALL l::'a::type list. P l --> (ALL x::'a::type. P (SNOC x l))) -->
  2.5905 +   All P"
  2.5906    by (import rich_list SNOC_INDUCT)
  2.5907  
  2.5908 -lemma SNOC_CASES: "ALL x'. x' = [] | (EX x l. x' = SNOC x l)"
  2.5909 +lemma SNOC_CASES: "ALL x'::'a::type list.
  2.5910 +   x' = [] | (EX (x::'a::type) l::'a::type list. x' = SNOC x l)"
  2.5911    by (import rich_list SNOC_CASES)
  2.5912  
  2.5913 -lemma LENGTH_SNOC: "ALL x l. length (SNOC x l) = Suc (length l)"
  2.5914 +lemma LENGTH_SNOC: "ALL (x::'a::type) l::'a::type list. length (SNOC x l) = Suc (length l)"
  2.5915    by (import rich_list LENGTH_SNOC)
  2.5916  
  2.5917 -lemma NOT_NIL_SNOC: "ALL x xa. [] ~= SNOC x xa"
  2.5918 +lemma NOT_NIL_SNOC: "ALL (x::'a::type) xa::'a::type list. [] ~= SNOC x xa"
  2.5919    by (import rich_list NOT_NIL_SNOC)
  2.5920  
  2.5921 -lemma NOT_SNOC_NIL: "ALL x xa. SNOC x xa ~= []"
  2.5922 +lemma NOT_SNOC_NIL: "ALL (x::'a::type) xa::'a::type list. SNOC x xa ~= []"
  2.5923    by (import rich_list NOT_SNOC_NIL)
  2.5924  
  2.5925 -lemma SNOC_11: "ALL x l x' l'. (SNOC x l = SNOC x' l') = (x = x' & l = l')"
  2.5926 +lemma SNOC_11: "ALL (x::'a::type) (l::'a::type list) (x'::'a::type) l'::'a::type list.
  2.5927 +   (SNOC x l = SNOC x' l') = (x = x' & l = l')"
  2.5928    by (import rich_list SNOC_11)
  2.5929  
  2.5930 -lemma SNOC_EQ_LENGTH_EQ: "ALL x1 l1 x2 l2. SNOC x1 l1 = SNOC x2 l2 --> length l1 = length l2"
  2.5931 +lemma SNOC_EQ_LENGTH_EQ: "ALL (x1::'a::type) (l1::'a::type list) (x2::'a::type) l2::'a::type list.
  2.5932 +   SNOC x1 l1 = SNOC x2 l2 --> length l1 = length l2"
  2.5933    by (import rich_list SNOC_EQ_LENGTH_EQ)
  2.5934  
  2.5935 -lemma SNOC_REVERSE_CONS: "ALL x xa. SNOC x xa = rev (x # rev xa)"
  2.5936 +lemma SNOC_REVERSE_CONS: "ALL (x::'a::type) xa::'a::type list. SNOC x xa = rev (x # rev xa)"
  2.5937    by (import rich_list SNOC_REVERSE_CONS)
  2.5938  
  2.5939 -lemma MAP_SNOC: "ALL x xa xb. map x (SNOC xa xb) = SNOC (x xa) (map x xb)"
  2.5940 +lemma MAP_SNOC: "ALL (x::'a::type => 'b::type) (xa::'a::type) xb::'a::type list.
  2.5941 +   map x (SNOC xa xb) = SNOC (x xa) (map x xb)"
  2.5942    by (import rich_list MAP_SNOC)
  2.5943  
  2.5944 -lemma FOLDR_SNOC: "ALL f e x l. foldr f (SNOC x l) e = foldr f l (f x e)"
  2.5945 +lemma FOLDR_SNOC: "ALL (f::'a::type => 'b::type => 'b::type) (e::'b::type) (x::'a::type)
  2.5946 +   l::'a::type list. foldr f (SNOC x l) e = foldr f l (f x e)"
  2.5947    by (import rich_list FOLDR_SNOC)
  2.5948  
  2.5949 -lemma FOLDL_SNOC: "ALL (f::'b => 'a => 'b) (e::'b) (x::'a) l::'a list.
  2.5950 -   foldl f e (SNOC x l) = f (foldl f e l) x"
  2.5951 +lemma FOLDL_SNOC: "ALL (f::'b::type => 'a::type => 'b::type) (e::'b::type) (x::'a::type)
  2.5952 +   l::'a::type list. foldl f e (SNOC x l) = f (foldl f e l) x"
  2.5953    by (import rich_list FOLDL_SNOC)
  2.5954  
  2.5955 -lemma FOLDR_FOLDL: "ALL f e. MONOID f e --> (ALL l. foldr f l e = foldl f e l)"
  2.5956 +lemma FOLDR_FOLDL: "ALL (f::'a::type => 'a::type => 'a::type) e::'a::type.
  2.5957 +   MONOID f e --> (ALL l::'a::type list. foldr f l e = foldl f e l)"
  2.5958    by (import rich_list FOLDR_FOLDL)
  2.5959  
  2.5960 -lemma LENGTH_FOLDR: "ALL l. length l = foldr (%x. Suc) l 0"
  2.5961 +lemma LENGTH_FOLDR: "ALL l::'a::type list. length l = foldr (%x::'a::type. Suc) l (0::nat)"
  2.5962    by (import rich_list LENGTH_FOLDR)
  2.5963  
  2.5964 -lemma LENGTH_FOLDL: "ALL l. length l = foldl (%l' x. Suc l') 0 l"
  2.5965 +lemma LENGTH_FOLDL: "ALL l::'a::type list.
  2.5966 +   length l = foldl (%(l'::nat) x::'a::type. Suc l') (0::nat) l"
  2.5967    by (import rich_list LENGTH_FOLDL)
  2.5968  
  2.5969 -lemma MAP_FOLDR: "ALL f l. map f l = foldr (%x. op # (f x)) l []"
  2.5970 +lemma MAP_FOLDR: "ALL (f::'a::type => 'b::type) l::'a::type list.
  2.5971 +   map f l = foldr (%x::'a::type. op # (f x)) l []"
  2.5972    by (import rich_list MAP_FOLDR)
  2.5973  
  2.5974 -lemma MAP_FOLDL: "ALL f l. map f l = foldl (%l' x. SNOC (f x) l') [] l"
  2.5975 +lemma MAP_FOLDL: "ALL (f::'a::type => 'b::type) l::'a::type list.
  2.5976 +   map f l = foldl (%(l'::'b::type list) x::'a::type. SNOC (f x) l') [] l"
  2.5977    by (import rich_list MAP_FOLDL)
  2.5978  
  2.5979 -lemma MAP_o: "ALL (f::'b => 'c) g::'a => 'b. map (f o g) = map f o map g"
  2.5980 +lemma MAP_o: "ALL (f::'b::type => 'c::type) g::'a::type => 'b::type.
  2.5981 +   map (f o g) = map f o map g"
  2.5982    by (import rich_list MAP_o)
  2.5983  
  2.5984 -lemma FILTER_FOLDR: "ALL P l. filter P l = foldr (%x l'. if P x then x # l' else l') l []"
  2.5985 +lemma FILTER_FOLDR: "ALL (P::'a::type => bool) l::'a::type list.
  2.5986 +   filter P l =
  2.5987 +   foldr (%(x::'a::type) l'::'a::type list. if P x then x # l' else l') l []"
  2.5988    by (import rich_list FILTER_FOLDR)
  2.5989  
  2.5990 -lemma FILTER_SNOC: "ALL P x l.
  2.5991 +lemma FILTER_SNOC: "ALL (P::'a::type => bool) (x::'a::type) l::'a::type list.
  2.5992     filter P (SNOC x l) = (if P x then SNOC x (filter P l) else filter P l)"
  2.5993    by (import rich_list FILTER_SNOC)
  2.5994  
  2.5995 -lemma FILTER_FOLDL: "ALL P l. filter P l = foldl (%l' x. if P x then SNOC x l' else l') [] l"
  2.5996 +lemma FILTER_FOLDL: "ALL (P::'a::type => bool) l::'a::type list.
  2.5997 +   filter P l =
  2.5998 +   foldl (%(l'::'a::type list) x::'a::type. if P x then SNOC x l' else l')
  2.5999 +    [] l"
  2.6000    by (import rich_list FILTER_FOLDL)
  2.6001  
  2.6002 -lemma FILTER_COMM: "ALL f1 f2 l. filter f1 (filter f2 l) = filter f2 (filter f1 l)"
  2.6003 +lemma FILTER_COMM: "ALL (f1::'a::type => bool) (f2::'a::type => bool) l::'a::type list.
  2.6004 +   filter f1 (filter f2 l) = filter f2 (filter f1 l)"
  2.6005    by (import rich_list FILTER_COMM)
  2.6006  
  2.6007 -lemma FILTER_IDEM: "ALL f l. filter f (filter f l) = filter f l"
  2.6008 +lemma FILTER_IDEM: "ALL (f::'a::type => bool) l::'a::type list.
  2.6009 +   filter f (filter f l) = filter f l"
  2.6010    by (import rich_list FILTER_IDEM)
  2.6011  
  2.6012 -lemma LENGTH_SEG: "ALL n k l. n + k <= length l --> length (SEG n k l) = n"
  2.6013 +lemma LENGTH_SEG: "ALL (n::nat) (k::nat) l::'a::type list.
  2.6014 +   n + k <= length l --> length (SEG n k l) = n"
  2.6015    by (import rich_list LENGTH_SEG)
  2.6016  
  2.6017 -lemma APPEND_NIL: "(ALL l::'a list. l @ [] = l) & (ALL x::'a list. [] @ x = x)"
  2.6018 +lemma APPEND_NIL: "(ALL l::'a::type list. l @ [] = l) & (ALL x::'a::type list. [] @ x = x)"
  2.6019    by (import rich_list APPEND_NIL)
  2.6020  
  2.6021 -lemma APPEND_SNOC: "ALL l1 x l2. l1 @ SNOC x l2 = SNOC x (l1 @ l2)"
  2.6022 +lemma APPEND_SNOC: "ALL (l1::'a::type list) (x::'a::type) l2::'a::type list.
  2.6023 +   l1 @ SNOC x l2 = SNOC x (l1 @ l2)"
  2.6024    by (import rich_list APPEND_SNOC)
  2.6025  
  2.6026 -lemma APPEND_FOLDR: "ALL l1 l2. l1 @ l2 = foldr op # l1 l2"
  2.6027 +lemma APPEND_FOLDR: "ALL (l1::'a::type list) l2::'a::type list. l1 @ l2 = foldr op # l1 l2"
  2.6028    by (import rich_list APPEND_FOLDR)
  2.6029  
  2.6030 -lemma APPEND_FOLDL: "ALL l1 l2. l1 @ l2 = foldl (%l' x. SNOC x l') l1 l2"
  2.6031 +lemma APPEND_FOLDL: "ALL (l1::'a::type list) l2::'a::type list.
  2.6032 +   l1 @ l2 = foldl (%(l'::'a::type list) x::'a::type. SNOC x l') l1 l2"
  2.6033    by (import rich_list APPEND_FOLDL)
  2.6034  
  2.6035 -lemma CONS_APPEND: "ALL x l. x # l = [x] @ l"
  2.6036 +lemma CONS_APPEND: "ALL (x::'a::type) l::'a::type list. x # l = [x] @ l"
  2.6037    by (import rich_list CONS_APPEND)
  2.6038  
  2.6039  lemma ASSOC_APPEND: "ASSOC op @"
  2.6040 @@ -4093,767 +4824,924 @@
  2.6041  lemma MONOID_APPEND_NIL: "MONOID op @ []"
  2.6042    by (import rich_list MONOID_APPEND_NIL)
  2.6043  
  2.6044 -lemma APPEND_LENGTH_EQ: "ALL l1 l1'.
  2.6045 +lemma APPEND_LENGTH_EQ: "ALL (l1::'a::type list) l1'::'a::type list.
  2.6046     length l1 = length l1' -->
  2.6047 -   (ALL l2 l2'.
  2.6048 +   (ALL (l2::'a::type list) l2'::'a::type list.
  2.6049         length l2 = length l2' -->
  2.6050         (l1 @ l2 = l1' @ l2') = (l1 = l1' & l2 = l2'))"
  2.6051    by (import rich_list APPEND_LENGTH_EQ)
  2.6052  
  2.6053 -lemma FLAT_SNOC: "ALL x l. concat (SNOC x l) = concat l @ x"
  2.6054 +lemma FLAT_SNOC: "ALL (x::'a::type list) l::'a::type list list.
  2.6055 +   concat (SNOC x l) = concat l @ x"
  2.6056    by (import rich_list FLAT_SNOC)
  2.6057  
  2.6058 -lemma FLAT_FOLDR: "ALL l. concat l = foldr op @ l []"
  2.6059 +lemma FLAT_FOLDR: "ALL l::'a::type list list. concat l = foldr op @ l []"
  2.6060    by (import rich_list FLAT_FOLDR)
  2.6061  
  2.6062 -lemma FLAT_FOLDL: "ALL l. concat l = foldl op @ [] l"
  2.6063 +lemma FLAT_FOLDL: "ALL l::'a::type list list. concat l = foldl op @ [] l"
  2.6064    by (import rich_list FLAT_FOLDL)
  2.6065  
  2.6066 -lemma LENGTH_FLAT: "ALL l. length (concat l) = sum (map size l)"
  2.6067 +lemma LENGTH_FLAT: "ALL l::'a::type list list. length (concat l) = sum (map size l)"
  2.6068    by (import rich_list LENGTH_FLAT)
  2.6069  
  2.6070 -lemma REVERSE_FOLDR: "ALL l. rev l = foldr SNOC l []"
  2.6071 +lemma REVERSE_FOLDR: "ALL l::'a::type list. rev l = foldr SNOC l []"
  2.6072    by (import rich_list REVERSE_FOLDR)
  2.6073  
  2.6074 -lemma REVERSE_FOLDL: "ALL l. rev l = foldl (%l' x. x # l') [] l"
  2.6075 +lemma REVERSE_FOLDL: "ALL l::'a::type list.
  2.6076 +   rev l = foldl (%(l'::'a::type list) x::'a::type. x # l') [] l"
  2.6077    by (import rich_list REVERSE_FOLDL)
  2.6078  
  2.6079 -lemma ALL_EL_SNOC: "ALL P x l. list_all P (SNOC x l) = (list_all P l & P x)"
  2.6080 +lemma ALL_EL_SNOC: "ALL (P::'a::type => bool) (x::'a::type) l::'a::type list.
  2.6081 +   list_all P (SNOC x l) = (list_all P l & P x)"
  2.6082    by (import rich_list ALL_EL_SNOC)
  2.6083  
  2.6084 -lemma ALL_EL_MAP: "ALL (P::'b => bool) (f::'a => 'b) l::'a list.
  2.6085 +lemma ALL_EL_MAP: "ALL (P::'b::type => bool) (f::'a::type => 'b::type) l::'a::type list.
  2.6086     list_all P (map f l) = list_all (P o f) l"
  2.6087    by (import rich_list ALL_EL_MAP)
  2.6088  
  2.6089 -lemma SOME_EL_SNOC: "ALL P x l. list_exists P (SNOC x l) = (P x | list_exists P l)"
  2.6090 +lemma SOME_EL_SNOC: "ALL (P::'a::type => bool) (x::'a::type) l::'a::type list.
  2.6091 +   list_exists P (SNOC x l) = (P x | list_exists P l)"
  2.6092    by (import rich_list SOME_EL_SNOC)
  2.6093  
  2.6094 -lemma IS_EL_SNOC: "ALL y x l. y mem SNOC x l = (y = x | y mem l)"
  2.6095 +lemma IS_EL_SNOC: "ALL (y::'a::type) (x::'a::type) l::'a::type list.
  2.6096 +   y mem SNOC x l = (y = x | y mem l)"
  2.6097    by (import rich_list IS_EL_SNOC)
  2.6098  
  2.6099 -lemma SUM_SNOC: "ALL x l. sum (SNOC x l) = sum l + x"
  2.6100 +lemma SUM_SNOC: "ALL (x::nat) l::nat list. sum (SNOC x l) = sum l + x"
  2.6101    by (import rich_list SUM_SNOC)
  2.6102  
  2.6103 -lemma SUM_FOLDL: "ALL l. sum l = foldl op + 0 l"
  2.6104 +lemma SUM_FOLDL: "ALL l::nat list. sum l = foldl op + (0::nat) l"
  2.6105    by (import rich_list SUM_FOLDL)
  2.6106  
  2.6107 -lemma IS_PREFIX_APPEND: "ALL l1 l2. IS_PREFIX l1 l2 = (EX l. l1 = l2 @ l)"
  2.6108 +lemma IS_PREFIX_APPEND: "ALL (l1::'a::type list) l2::'a::type list.
  2.6109 +   IS_PREFIX l1 l2 = (EX l::'a::type list. l1 = l2 @ l)"
  2.6110    by (import rich_list IS_PREFIX_APPEND)
  2.6111  
  2.6112 -lemma IS_SUFFIX_APPEND: "ALL l1 l2. IS_SUFFIX l1 l2 = (EX l. l1 = l @ l2)"
  2.6113 +lemma IS_SUFFIX_APPEND: "ALL (l1::'a::type list) l2::'a::type list.
  2.6114 +   IS_SUFFIX l1 l2 = (EX l::'a::type list. l1 = l @ l2)"
  2.6115    by (import rich_list IS_SUFFIX_APPEND)
  2.6116  
  2.6117 -lemma IS_SUBLIST_APPEND: "ALL l1 l2. IS_SUBLIST l1 l2 = (EX l l'. l1 = l @ l2 @ l')"
  2.6118 +lemma IS_SUBLIST_APPEND: "ALL (l1::'a::type list) l2::'a::type list.
  2.6119 +   IS_SUBLIST l1 l2 =
  2.6120 +   (EX (l::'a::type list) l'::'a::type list. l1 = l @ l2 @ l')"
  2.6121    by (import rich_list IS_SUBLIST_APPEND)
  2.6122  
  2.6123 -lemma IS_PREFIX_IS_SUBLIST: "ALL l1 l2. IS_PREFIX l1 l2 --> IS_SUBLIST l1 l2"
  2.6124 +lemma IS_PREFIX_IS_SUBLIST: "ALL (l1::'a::type list) l2::'a::type list.
  2.6125 +   IS_PREFIX l1 l2 --> IS_SUBLIST l1 l2"
  2.6126    by (import rich_list IS_PREFIX_IS_SUBLIST)
  2.6127  
  2.6128 -lemma IS_SUFFIX_IS_SUBLIST: "ALL l1 l2. IS_SUFFIX l1 l2 --> IS_SUBLIST l1 l2"
  2.6129 +lemma IS_SUFFIX_IS_SUBLIST: "ALL (l1::'a::type list) l2::'a::type list.
  2.6130 +   IS_SUFFIX l1 l2 --> IS_SUBLIST l1 l2"
  2.6131    by (import rich_list IS_SUFFIX_IS_SUBLIST)
  2.6132  
  2.6133 -lemma IS_PREFIX_REVERSE: "ALL l1 l2. IS_PREFIX (rev l1) (rev l2) = IS_SUFFIX l1 l2"
  2.6134 +lemma IS_PREFIX_REVERSE: "ALL (l1::'a::type list) l2::'a::type list.
  2.6135 +   IS_PREFIX (rev l1) (rev l2) = IS_SUFFIX l1 l2"
  2.6136    by (import rich_list IS_PREFIX_REVERSE)
  2.6137  
  2.6138 -lemma IS_SUFFIX_REVERSE: "ALL l2 l1. IS_SUFFIX (rev l1) (rev l2) = IS_PREFIX l1 l2"
  2.6139 +lemma IS_SUFFIX_REVERSE: "ALL (l2::'a::type list) l1::'a::type list.
  2.6140 +   IS_SUFFIX (rev l1) (rev l2) = IS_PREFIX l1 l2"
  2.6141    by (import rich_list IS_SUFFIX_REVERSE)
  2.6142  
  2.6143 -lemma IS_SUBLIST_REVERSE: "ALL l1 l2. IS_SUBLIST (rev l1) (rev l2) = IS_SUBLIST l1 l2"
  2.6144 +lemma IS_SUBLIST_REVERSE: "ALL (l1::'a::type list) l2::'a::type list.
  2.6145 +   IS_SUBLIST (rev l1) (rev l2) = IS_SUBLIST l1 l2"
  2.6146    by (import rich_list IS_SUBLIST_REVERSE)
  2.6147  
  2.6148 -lemma PREFIX_FOLDR: "ALL P x. PREFIX P x = foldr (%x l'. if P x then x # l' else []) x []"
  2.6149 +lemma PREFIX_FOLDR: "ALL (P::'a::type => bool) x::'a::type list.
  2.6150 +   PREFIX P x =
  2.6151 +   foldr (%(x::'a::type) l'::'a::type list. if P x then x # l' else []) x []"
  2.6152    by (import rich_list PREFIX_FOLDR)
  2.6153  
  2.6154 -lemma PREFIX: "(ALL x::'a => bool. PREFIX x [] = []) &
  2.6155 -(ALL (x::'a => bool) (xa::'a) xb::'a list.
  2.6156 +lemma PREFIX: "(ALL x::'a::type => bool. PREFIX x [] = []) &
  2.6157 +(ALL (x::'a::type => bool) (xa::'a::type) xb::'a::type list.
  2.6158      PREFIX x (xa # xb) = (if x xa then xa # PREFIX x xb else []))"
  2.6159    by (import rich_list PREFIX)
  2.6160  
  2.6161 -lemma IS_PREFIX_PREFIX: "ALL P l. IS_PREFIX l (PREFIX P l)"
  2.6162 +lemma IS_PREFIX_PREFIX: "ALL (P::'a::type => bool) l::'a::type list. IS_PREFIX l (PREFIX P l)"
  2.6163    by (import rich_list IS_PREFIX_PREFIX)
  2.6164  
  2.6165 -lemma LENGTH_SCANL: "ALL (f::'b => 'a => 'b) (e::'b) l::'a list.
  2.6166 +lemma LENGTH_SCANL: "ALL (f::'b::type => 'a::type => 'b::type) (e::'b::type) l::'a::type list.
  2.6167     length (SCANL f e l) = Suc (length l)"
  2.6168    by (import rich_list LENGTH_SCANL)
  2.6169  
  2.6170 -lemma LENGTH_SCANR: "ALL f e l. length (SCANR f e l) = Suc (length l)"
  2.6171 +lemma LENGTH_SCANR: "ALL (f::'a::type => 'b::type => 'b::type) (e::'b::type) l::'a::type list.
  2.6172 +   length (SCANR f e l) = Suc (length l)"
  2.6173    by (import rich_list LENGTH_SCANR)
  2.6174  
  2.6175 -lemma COMM_MONOID_FOLDL: "ALL x.
  2.6176 +lemma COMM_MONOID_FOLDL: "ALL x::'a::type => 'a::type => 'a::type.
  2.6177     COMM x -->
  2.6178 -   (ALL xa. MONOID x xa --> (ALL e l. foldl x e l = x e (foldl x xa l)))"
  2.6179 +   (ALL xa::'a::type.
  2.6180 +       MONOID x xa -->
  2.6181 +       (ALL (e::'a::type) l::'a::type list.
  2.6182 +           foldl x e l = x e (foldl x xa l)))"
  2.6183    by (import rich_list COMM_MONOID_FOLDL)
  2.6184  
  2.6185 -lemma COMM_MONOID_FOLDR: "ALL x.
  2.6186 +lemma COMM_MONOID_FOLDR: "ALL x::'a::type => 'a::type => 'a::type.
  2.6187     COMM x -->
  2.6188 -   (ALL xa. MONOID x xa --> (ALL e l. foldr x l e = x e (foldr x l xa)))"
  2.6189 +   (ALL xa::'a::type.
  2.6190 +       MONOID x xa -->
  2.6191 +       (ALL (e::'a::type) l::'a::type list.
  2.6192 +           foldr x l e = x e (foldr x l xa)))"
  2.6193    by (import rich_list COMM_MONOID_FOLDR)
  2.6194  
  2.6195 -lemma FCOMM_FOLDR_APPEND: "ALL x xa.
  2.6196 +lemma FCOMM_FOLDR_APPEND: "ALL (x::'a::type => 'a::type => 'a::type)
  2.6197 +   xa::'b::type => 'a::type => 'a::type.
  2.6198     FCOMM x xa -->
  2.6199 -   (ALL xb.
  2.6200 +   (ALL xb::'a::type.
  2.6201         LEFT_ID x xb -->
  2.6202 -       (ALL l1 l2.
  2.6203 +       (ALL (l1::'b::type list) l2::'b::type list.
  2.6204             foldr xa (l1 @ l2) xb = x (foldr xa l1 xb) (foldr xa l2 xb)))"
  2.6205    by (import rich_list FCOMM_FOLDR_APPEND)
  2.6206  
  2.6207 -lemma FCOMM_FOLDL_APPEND: "ALL x xa.
  2.6208 +lemma FCOMM_FOLDL_APPEND: "ALL (x::'a::type => 'b::type => 'a::type)
  2.6209 +   xa::'a::type => 'a::type => 'a::type.
  2.6210     FCOMM x xa -->
  2.6211 -   (ALL xb.
  2.6212 +   (ALL xb::'a::type.
  2.6213         RIGHT_ID xa xb -->
  2.6214 -       (ALL l1 l2.
  2.6215 +       (ALL (l1::'b::type list) l2::'b::type list.
  2.6216             foldl x xb (l1 @ l2) = xa (foldl x xb l1) (foldl x xb l2)))"
  2.6217    by (import rich_list FCOMM_FOLDL_APPEND)
  2.6218  
  2.6219 -lemma FOLDL_SINGLE: "ALL x xa xb. foldl x xa [xb] = x xa xb"
  2.6220 +lemma FOLDL_SINGLE: "ALL (x::'a::type => 'b::type => 'a::type) (xa::'a::type) xb::'b::type.
  2.6221 +   foldl x xa [xb] = x xa xb"
  2.6222    by (import rich_list FOLDL_SINGLE)
  2.6223  
  2.6224 -lemma FOLDR_SINGLE: "ALL x xa xb. foldr x [xb] xa = x xb xa"
  2.6225 +lemma FOLDR_SINGLE: "ALL (x::'a::type => 'b::type => 'b::type) (xa::'b::type) xb::'a::type.
  2.6226 +   foldr x [xb] xa = x xb xa"
  2.6227    by (import rich_list FOLDR_SINGLE)
  2.6228  
  2.6229 -lemma FOLDR_CONS_NIL: "ALL l. foldr op # l [] = l"
  2.6230 +lemma FOLDR_CONS_NIL: "ALL l::'a::type list. foldr op # l [] = l"
  2.6231    by (import rich_list FOLDR_CONS_NIL)
  2.6232  
  2.6233 -lemma FOLDL_SNOC_NIL: "ALL l. foldl (%xs x. SNOC x xs) [] l = l"
  2.6234 +lemma FOLDL_SNOC_NIL: "ALL l::'a::type list.
  2.6235 +   foldl (%(xs::'a::type list) x::'a::type. SNOC x xs) [] l = l"
  2.6236    by (import rich_list FOLDL_SNOC_NIL)
  2.6237  
  2.6238 -lemma FOLDR_REVERSE: "ALL x xa xb. foldr x (rev xb) xa = foldl (%xa y. x y xa) xa xb"
  2.6239 +lemma FOLDR_REVERSE: "ALL (x::'a::type => 'b::type => 'b::type) (xa::'b::type) xb::'a::type list.
  2.6240 +   foldr x (rev xb) xa = foldl (%(xa::'b::type) y::'a::type. x y xa) xa xb"
  2.6241    by (import rich_list FOLDR_REVERSE)
  2.6242  
  2.6243 -lemma FOLDL_REVERSE: "ALL x xa xb. foldl x xa (rev xb) = foldr (%xa y. x y xa) xb xa"
  2.6244 +lemma FOLDL_REVERSE: "ALL (x::'a::type => 'b::type => 'a::type) (xa::'a::type) xb::'b::type list.
  2.6245 +   foldl x xa (rev xb) = foldr (%(xa::'b::type) y::'a::type. x y xa) xb xa"
  2.6246    by (import rich_list FOLDL_REVERSE)
  2.6247  
  2.6248 -lemma FOLDR_MAP: "ALL (f::'a => 'a => 'a) (e::'a) (g::'b => 'a) l::'b list.
  2.6249 -   foldr f (map g l) e = foldr (%x::'b. f (g x)) l e"
  2.6250 +lemma FOLDR_MAP: "ALL (f::'a::type => 'a::type => 'a::type) (e::'a::type)
  2.6251 +   (g::'b::type => 'a::type) l::'b::type list.
  2.6252 +   foldr f (map g l) e = foldr (%x::'b::type. f (g x)) l e"
  2.6253    by (import rich_list FOLDR_MAP)
  2.6254  
  2.6255 -lemma FOLDL_MAP: "ALL (f::'a => 'a => 'a) (e::'a) (g::'b => 'a) l::'b list.
  2.6256 -   foldl f e (map g l) = foldl (%(x::'a) y::'b. f x (g y)) e l"
  2.6257 +lemma FOLDL_MAP: "ALL (f::'a::type => 'a::type => 'a::type) (e::'a::type)
  2.6258 +   (g::'b::type => 'a::type) l::'b::type list.
  2.6259 +   foldl f e (map g l) = foldl (%(x::'a::type) y::'b::type. f x (g y)) e l"
  2.6260    by (import rich_list FOLDL_MAP)
  2.6261  
  2.6262 -lemma ALL_EL_FOLDR: "ALL P l. list_all P l = foldr (%x. op & (P x)) l True"
  2.6263 +lemma ALL_EL_FOLDR: "ALL (P::'a::type => bool) l::'a::type list.
  2.6264 +   list_all P l = foldr (%x::'a::type. op & (P x)) l True"
  2.6265    by (import rich_list ALL_EL_FOLDR)
  2.6266  
  2.6267 -lemma ALL_EL_FOLDL: "ALL P l. list_all P l = foldl (%l' x. l' & P x) True l"
  2.6268 +lemma ALL_EL_FOLDL: "ALL (P::'a::type => bool) l::'a::type list.
  2.6269 +   list_all P l = foldl (%(l'::bool) x::'a::type. l' & P x) True l"
  2.6270    by (import rich_list ALL_EL_FOLDL)
  2.6271  
  2.6272 -lemma SOME_EL_FOLDR: "ALL P l. list_exists P l = foldr (%x. op | (P x)) l False"
  2.6273 +lemma SOME_EL_FOLDR: "ALL (P::'a::type => bool) l::'a::type list.
  2.6274 +   list_exists P l = foldr (%x::'a::type. op | (P x)) l False"
  2.6275    by (import rich_list SOME_EL_FOLDR)
  2.6276  
  2.6277 -lemma SOME_EL_FOLDL: "ALL P l. list_exists P l = foldl (%l' x. l' | P x) False l"
  2.6278 +lemma SOME_EL_FOLDL: "ALL (P::'a::type => bool) l::'a::type list.
  2.6279 +   list_exists P l = foldl (%(l'::bool) x::'a::type. l' | P x) False l"
  2.6280    by (import rich_list SOME_EL_FOLDL)
  2.6281  
  2.6282 -lemma ALL_EL_FOLDR_MAP: "ALL x xa. list_all x xa = foldr op & (map x xa) True"
  2.6283 +lemma ALL_EL_FOLDR_MAP: "ALL (x::'a::type => bool) xa::'a::type list.
  2.6284 +   list_all x xa = foldr op & (map x xa) True"
  2.6285    by (import rich_list ALL_EL_FOLDR_MAP)
  2.6286  
  2.6287 -lemma ALL_EL_FOLDL_MAP: "ALL x xa. list_all x xa = foldl op & True (map x xa)"
  2.6288 +lemma ALL_EL_FOLDL_MAP: "ALL (x::'a::type => bool) xa::'a::type list.
  2.6289 +   list_all x xa = foldl op & True (map x xa)"
  2.6290    by (import rich_list ALL_EL_FOLDL_MAP)
  2.6291  
  2.6292 -lemma SOME_EL_FOLDR_MAP: "ALL x xa. list_exists x xa = foldr op | (map x xa) False"
  2.6293 +lemma SOME_EL_FOLDR_MAP: "ALL (x::'a::type => bool) xa::'a::type list.
  2.6294 +   list_exists x xa = foldr op | (map x xa) False"
  2.6295    by (import rich_list SOME_EL_FOLDR_MAP)
  2.6296  
  2.6297 -lemma SOME_EL_FOLDL_MAP: "ALL x xa. list_exists x xa = foldl op | False (map x xa)"
  2.6298 +lemma SOME_EL_FOLDL_MAP: "ALL (x::'a::type => bool) xa::'a::type list.
  2.6299 +   list_exists x xa = foldl op | False (map x xa)"
  2.6300    by (import rich_list SOME_EL_FOLDL_MAP)
  2.6301  
  2.6302 -lemma FOLDR_FILTER: "ALL (f::'a => 'a => 'a) (e::'a) (P::'a => bool) l::'a list.
  2.6303 +lemma FOLDR_FILTER: "ALL (f::'a::type => 'a::type => 'a::type) (e::'a::type)
  2.6304 +   (P::'a::type => bool) l::'a::type list.
  2.6305     foldr f (filter P l) e =
  2.6306 -   foldr (%(x::'a) y::'a. if P x then f x y else y) l e"
  2.6307 +   foldr (%(x::'a::type) y::'a::type. if P x then f x y else y) l e"
  2.6308    by (import rich_list FOLDR_FILTER)
  2.6309  
  2.6310 -lemma FOLDL_FILTER: "ALL (f::'a => 'a => 'a) (e::'a) (P::'a => bool) l::'a list.
  2.6311 +lemma FOLDL_FILTER: "ALL (f::'a::type => 'a::type => 'a::type) (e::'a::type)
  2.6312 +   (P::'a::type => bool) l::'a::type list.
  2.6313     foldl f e (filter P l) =
  2.6314 -   foldl (%(x::'a) y::'a. if P y then f x y else x) e l"
  2.6315 +   foldl (%(x::'a::type) y::'a::type. if P y then f x y else x) e l"
  2.6316    by (import rich_list FOLDL_FILTER)
  2.6317  
  2.6318 -lemma ASSOC_FOLDR_FLAT: "ALL f.
  2.6319 +lemma ASSOC_FOLDR_FLAT: "ALL f::'a::type => 'a::type => 'a::type.
  2.6320     ASSOC f -->
  2.6321 -   (ALL e.
  2.6322 +   (ALL e::'a::type.
  2.6323         LEFT_ID f e -->
  2.6324 -       (ALL l. foldr f (concat l) e = foldr f (map (FOLDR f e) l) e))"
  2.6325 +       (ALL l::'a::type list list.
  2.6326 +           foldr f (concat l) e = foldr f (map (FOLDR f e) l) e))"
  2.6327    by (import rich_list ASSOC_FOLDR_FLAT)
  2.6328  
  2.6329 -lemma ASSOC_FOLDL_FLAT: "ALL f.
  2.6330 +lemma ASSOC_FOLDL_FLAT: "ALL f::'a::type => 'a::type => 'a::type.
  2.6331     ASSOC f -->
  2.6332 -   (ALL e.
  2.6333 +   (ALL e::'a::type.
  2.6334         RIGHT_ID f e -->
  2.6335 -       (ALL l. foldl f e (concat l) = foldl f e (map (foldl f e) l)))"
  2.6336 +       (ALL l::'a::type list list.
  2.6337 +           foldl f e (concat l) = foldl f e (map (foldl f e) l)))"
  2.6338    by (import rich_list ASSOC_FOLDL_FLAT)
  2.6339  
  2.6340 -lemma SOME_EL_MAP: "ALL (P::'b => bool) (f::'a => 'b) l::'a list.
  2.6341 +lemma SOME_EL_MAP: "ALL (P::'b::type => bool) (f::'a::type => 'b::type) l::'a::type list.
  2.6342     list_exists P (map f l) = list_exists (P o f) l"
  2.6343    by (import rich_list SOME_EL_MAP)
  2.6344  
  2.6345 -lemma SOME_EL_DISJ: "ALL P Q l.
  2.6346 -   list_exists (%x. P x | Q x) l = (list_exists P l | list_exists Q l)"
  2.6347 +lemma SOME_EL_DISJ: "ALL (P::'a::type => bool) (Q::'a::type => bool) l::'a::type list.
  2.6348 +   list_exists (%x::'a::type. P x | Q x) l =
  2.6349 +   (list_exists P l | list_exists Q l)"
  2.6350    by (import rich_list SOME_EL_DISJ)
  2.6351  
  2.6352 -lemma IS_EL_FOLDR: "ALL x xa. x mem xa = foldr (%xa. op | (x = xa)) xa False"
  2.6353 +lemma IS_EL_FOLDR: "ALL (x::'a::type) xa::'a::type list.
  2.6354 +   x mem xa = foldr (%xa::'a::type. op | (x = xa)) xa False"
  2.6355    by (import rich_list IS_EL_FOLDR)
  2.6356  
  2.6357 -lemma IS_EL_FOLDL: "ALL x xa. x mem xa = foldl (%l' xa. l' | x = xa) False xa"
  2.6358 +lemma IS_EL_FOLDL: "ALL (x::'a::type) xa::'a::type list.
  2.6359 +   x mem xa = foldl (%(l'::bool) xa::'a::type. l' | x = xa) False xa"
  2.6360    by (import rich_list IS_EL_FOLDL)
  2.6361  
  2.6362 -lemma NULL_FOLDR: "ALL l. null l = foldr (%x l'. False) l True"
  2.6363 +lemma NULL_FOLDR: "ALL l::'a::type list. null l = foldr (%(x::'a::type) l'::bool. False) l True"
  2.6364    by (import rich_list NULL_FOLDR)
  2.6365  
  2.6366 -lemma NULL_FOLDL: "ALL l. null l = foldl (%x l'. False) True l"
  2.6367 +lemma NULL_FOLDL: "ALL l::'a::type list. null l = foldl (%(x::bool) l'::'a::type. False) True l"
  2.6368    by (import rich_list NULL_FOLDL)
  2.6369  
  2.6370 -lemma SEG_LENGTH_ID: "ALL l. SEG (length l) 0 l = l"
  2.6371 +lemma SEG_LENGTH_ID: "ALL l::'a::type list. SEG (length l) (0::nat) l = l"
  2.6372    by (import rich_list SEG_LENGTH_ID)
  2.6373  
  2.6374 -lemma SEG_SUC_CONS: "ALL m n l x. SEG m (Suc n) (x # l) = SEG m n l"
  2.6375 +lemma SEG_SUC_CONS: "ALL (m::nat) (n::nat) (l::'a::type list) x::'a::type.
  2.6376 +   SEG m (Suc n) (x # l) = SEG m n l"
  2.6377    by (import rich_list SEG_SUC_CONS)
  2.6378  
  2.6379 -lemma SEG_0_SNOC: "ALL m l x. m <= length l --> SEG m 0 (SNOC x l) = SEG m 0 l"
  2.6380 +lemma SEG_0_SNOC: "ALL (m::nat) (l::'a::type list) x::'a::type.
  2.6381 +   m <= length l --> SEG m (0::nat) (SNOC x l) = SEG m (0::nat) l"
  2.6382    by (import rich_list SEG_0_SNOC)
  2.6383  
  2.6384 -lemma BUTLASTN_SEG: "ALL n l. n <= length l --> BUTLASTN n l = SEG (length l - n) 0 l"
  2.6385 +lemma BUTLASTN_SEG: "ALL (n::nat) l::'a::type list.
  2.6386 +   n <= length l --> BUTLASTN n l = SEG (length l - n) (0::nat) l"
  2.6387    by (import rich_list BUTLASTN_SEG)
  2.6388  
  2.6389 -lemma LASTN_CONS: "ALL n l. n <= length l --> (ALL x. LASTN n (x # l) = LASTN n l)"
  2.6390 +lemma LASTN_CONS: "ALL (n::nat) l::'a::type list.
  2.6391 +   n <= length l --> (ALL x::'a::type. LASTN n (x # l) = LASTN n l)"
  2.6392    by (import rich_list LASTN_CONS)
  2.6393  
  2.6394 -lemma LENGTH_LASTN: "ALL n l. n <= length l --> length (LASTN n l) = n"
  2.6395 +lemma LENGTH_LASTN: "ALL (n::nat) l::'a::type list. n <= length l --> length (LASTN n l) = n"
  2.6396    by (import rich_list LENGTH_LASTN)
  2.6397  
  2.6398 -lemma LASTN_LENGTH_ID: "ALL l. LASTN (length l) l = l"
  2.6399 +lemma LASTN_LENGTH_ID: "ALL l::'a::type list. LASTN (length l) l = l"
  2.6400    by (import rich_list LASTN_LENGTH_ID)
  2.6401  
  2.6402 -lemma LASTN_LASTN: "ALL l n m. m <= length l --> n <= m --> LASTN n (LASTN m l) = LASTN n l"
  2.6403 +lemma LASTN_LASTN: "ALL (l::'a::type list) (n::nat) m::nat.
  2.6404 +   m <= length l --> n <= m --> LASTN n (LASTN m l) = LASTN n l"
  2.6405    by (import rich_list LASTN_LASTN)
  2.6406  
  2.6407 -lemma FIRSTN_LENGTH_ID: "ALL l. FIRSTN (length l) l = l"
  2.6408 +lemma FIRSTN_LENGTH_ID: "ALL l::'a::type list. FIRSTN (length l) l = l"
  2.6409    by (import rich_list FIRSTN_LENGTH_ID)
  2.6410  
  2.6411 -lemma FIRSTN_SNOC: "ALL n l. n <= length l --> (ALL x. FIRSTN n (SNOC x l) = FIRSTN n l)"
  2.6412 +lemma FIRSTN_SNOC: "ALL (n::nat) l::'a::type list.
  2.6413 +   n <= length l --> (ALL x::'a::type. FIRSTN n (SNOC x l) = FIRSTN n l)"
  2.6414    by (import rich_list FIRSTN_SNOC)
  2.6415  
  2.6416 -lemma BUTLASTN_LENGTH_NIL: "ALL l. BUTLASTN (length l) l = []"
  2.6417 +lemma BUTLASTN_LENGTH_NIL: "ALL l::'a::type list. BUTLASTN (length l) l = []"
  2.6418    by (import rich_list BUTLASTN_LENGTH_NIL)
  2.6419  
  2.6420 -lemma BUTLASTN_SUC_BUTLAST: "ALL n l. n < length l --> BUTLASTN (Suc n) l = BUTLASTN n (butlast l)"
  2.6421 +lemma BUTLASTN_SUC_BUTLAST: "ALL (n::nat) l::'a::type list.
  2.6422 +   n < length l --> BUTLASTN (Suc n) l = BUTLASTN n (butlast l)"
  2.6423    by (import rich_list BUTLASTN_SUC_BUTLAST)
  2.6424  
  2.6425 -lemma BUTLASTN_BUTLAST: "ALL n l. n < length l --> BUTLASTN n (butlast l) = butlast (BUTLASTN n l)"
  2.6426 +lemma BUTLASTN_BUTLAST: "ALL (n::nat) l::'a::type list.
  2.6427 +   n < length l --> BUTLASTN n (butlast l) = butlast (BUTLASTN n l)"
  2.6428    by (import rich_list BUTLASTN_BUTLAST)
  2.6429  
  2.6430 -lemma LENGTH_BUTLASTN: "ALL n l. n <= length l --> length (BUTLASTN n l) = length l - n"
  2.6431 +lemma LENGTH_BUTLASTN: "ALL (n::nat) l::'a::type list.
  2.6432 +   n <= length l --> length (BUTLASTN n l) = length l - n"
  2.6433    by (import rich_list LENGTH_BUTLASTN)
  2.6434  
  2.6435 -lemma BUTLASTN_BUTLASTN: "ALL m n l.
  2.6436 +lemma BUTLASTN_BUTLASTN: "ALL (m::nat) (n::nat) l::'a::type list.
  2.6437     n + m <= length l --> BUTLASTN n (BUTLASTN m l) = BUTLASTN (n + m) l"
  2.6438    by (import rich_list BUTLASTN_BUTLASTN)
  2.6439  
  2.6440 -lemma APPEND_BUTLASTN_LASTN: "ALL n l. n <= length l --> BUTLASTN n l @ LASTN n l = l"
  2.6441 +lemma APPEND_BUTLASTN_LASTN: "ALL (n::nat) l::'a::type list.
  2.6442 +   n <= length l --> BUTLASTN n l @ LASTN n l = l"
  2.6443    by (import rich_list APPEND_BUTLASTN_LASTN)
  2.6444  
  2.6445 -lemma APPEND_FIRSTN_LASTN: "ALL m n l. m + n = length l --> FIRSTN n l @ LASTN m l = l"
  2.6446 +lemma APPEND_FIRSTN_LASTN: "ALL (m::nat) (n::nat) l::'a::type list.
  2.6447 +   m + n = length l --> FIRSTN n l @ LASTN m l = l"
  2.6448    by (import rich_list APPEND_FIRSTN_LASTN)
  2.6449  
  2.6450 -lemma BUTLASTN_APPEND2: "ALL n l1 l2. n <= length l2 --> BUTLASTN n (l1 @ l2) = l1 @ BUTLASTN n l2"
  2.6451 +lemma BUTLASTN_APPEND2: "ALL (n::nat) (l1::'a::type list) l2::'a::type list.
  2.6452 +   n <= length l2 --> BUTLASTN n (l1 @ l2) = l1 @ BUTLASTN n l2"
  2.6453    by (import rich_list BUTLASTN_APPEND2)
  2.6454  
  2.6455 -lemma BUTLASTN_LENGTH_APPEND: "ALL l2 l1. BUTLASTN (length l2) (l1 @ l2) = l1"
  2.6456 +lemma BUTLASTN_LENGTH_APPEND: "ALL (l2::'a::type list) l1::'a::type list.
  2.6457 +   BUTLASTN (length l2) (l1 @ l2) = l1"
  2.6458    by (import rich_list BUTLASTN_LENGTH_APPEND)
  2.6459  
  2.6460 -lemma LASTN_LENGTH_APPEND: "ALL l2 l1. LASTN (length l2) (l1 @ l2) = l2"
  2.6461 +lemma LASTN_LENGTH_APPEND: "ALL (l2::'a::type list) l1::'a::type list. LASTN (length l2) (l1 @ l2) = l2"
  2.6462    by (import rich_list LASTN_LENGTH_APPEND)
  2.6463  
  2.6464 -lemma BUTLASTN_CONS: "ALL n l. n <= length l --> (ALL x. BUTLASTN n (x # l) = x # BUTLASTN n l)"
  2.6465 +lemma BUTLASTN_CONS: "ALL (n::nat) l::'a::type list.
  2.6466 +   n <= length l -->
  2.6467 +   (ALL x::'a::type. BUTLASTN n (x # l) = x # BUTLASTN n l)"
  2.6468    by (import rich_list BUTLASTN_CONS)
  2.6469  
  2.6470 -lemma BUTLASTN_LENGTH_CONS: "ALL l x. BUTLASTN (length l) (x # l) = [x]"
  2.6471 +lemma BUTLASTN_LENGTH_CONS: "ALL (l::'a::type list) x::'a::type. BUTLASTN (length l) (x # l) = [x]"
  2.6472    by (import rich_list BUTLASTN_LENGTH_CONS)
  2.6473  
  2.6474 -lemma LAST_LASTN_LAST: "ALL n l. n <= length l --> 0 < n --> last (LASTN n l) = last l"
  2.6475 +lemma LAST_LASTN_LAST: "ALL (n::nat) l::'a::type list.
  2.6476 +   n <= length l --> (0::nat) < n --> last (LASTN n l) = last l"
  2.6477    by (import rich_list LAST_LASTN_LAST)
  2.6478  
  2.6479 -lemma BUTLASTN_LASTN_NIL: "ALL n l. n <= length l --> BUTLASTN n (LASTN n l) = []"
  2.6480 +lemma BUTLASTN_LASTN_NIL: "ALL (n::nat) l::'a::type list. n <= length l --> BUTLASTN n (LASTN n l) = []"
  2.6481    by (import rich_list BUTLASTN_LASTN_NIL)
  2.6482  
  2.6483 -lemma LASTN_BUTLASTN: "ALL n m l.
  2.6484 +lemma LASTN_BUTLASTN: "ALL (n::nat) (m::nat) l::'a::type list.
  2.6485     n + m <= length l -->
  2.6486     LASTN n (BUTLASTN m l) = BUTLASTN m (LASTN (n + m) l)"
  2.6487    by (import rich_list LASTN_BUTLASTN)
  2.6488  
  2.6489 -lemma BUTLASTN_LASTN: "ALL m n l.
  2.6490 +lemma BUTLASTN_LASTN: "ALL (m::nat) (n::nat) l::'a::type list.
  2.6491     m <= n & n <= length l -->
  2.6492     BUTLASTN m (LASTN n l) = LASTN (n - m) (BUTLASTN m l)"
  2.6493    by (import rich_list BUTLASTN_LASTN)
  2.6494  
  2.6495 -lemma LASTN_1: "ALL l. l ~= [] --> LASTN 1 l = [last l]"
  2.6496 +lemma LASTN_1: "ALL l::'a::type list. l ~= [] --> LASTN (1::nat) l = [last l]"
  2.6497    by (import rich_list LASTN_1)
  2.6498  
  2.6499 -lemma BUTLASTN_1: "ALL l. l ~= [] --> BUTLASTN 1 l = butlast l"
  2.6500 +lemma BUTLASTN_1: "ALL l::'a::type list. l ~= [] --> BUTLASTN (1::nat) l = butlast l"
  2.6501    by (import rich_list BUTLASTN_1)
  2.6502  
  2.6503 -lemma BUTLASTN_APPEND1: "ALL l2 n.
  2.6504 +lemma BUTLASTN_APPEND1: "ALL (l2::'a::type list) n::nat.
  2.6505     length l2 <= n -->
  2.6506 -   (ALL l1. BUTLASTN n (l1 @ l2) = BUTLASTN (n - length l2) l1)"
  2.6507 +   (ALL l1::'a::type list.
  2.6508 +       BUTLASTN n (l1 @ l2) = BUTLASTN (n - length l2) l1)"
  2.6509    by (import rich_list BUTLASTN_APPEND1)
  2.6510  
  2.6511 -lemma LASTN_APPEND2: "ALL n l2. n <= length l2 --> (ALL l1. LASTN n (l1 @ l2) = LASTN n l2)"
  2.6512 +lemma LASTN_APPEND2: "ALL (n::nat) l2::'a::type list.
  2.6513 +   n <= length l2 -->
  2.6514 +   (ALL l1::'a::type list. LASTN n (l1 @ l2) = LASTN n l2)"
  2.6515    by (import rich_list LASTN_APPEND2)
  2.6516  
  2.6517 -lemma LASTN_APPEND1: "ALL l2 n.
  2.6518 +lemma LASTN_APPEND1: "ALL (l2::'a::type list) n::nat.
  2.6519     length l2 <= n -->
  2.6520 -   (ALL l1. LASTN n (l1 @ l2) = LASTN (n - length l2) l1 @ l2)"
  2.6521 +   (ALL l1::'a::type list.
  2.6522 +       LASTN n (l1 @ l2) = LASTN (n - length l2) l1 @ l2)"
  2.6523    by (import rich_list LASTN_APPEND1)
  2.6524  
  2.6525 -lemma LASTN_MAP: "ALL n l. n <= length l --> (ALL f. LASTN n (map f l) = map f (LASTN n l))"
  2.6526 +lemma LASTN_MAP: "ALL (n::nat) l::'a::type list.
  2.6527 +   n <= length l -->
  2.6528 +   (ALL f::'a::type => 'b::type. LASTN n (map f l) = map f (LASTN n l))"
  2.6529    by (import rich_list LASTN_MAP)
  2.6530  
  2.6531 -lemma BUTLASTN_MAP: "ALL n l.
  2.6532 -   n <= length l --> (ALL f. BUTLASTN n (map f l) = map f (BUTLASTN n l))"
  2.6533 +lemma BUTLASTN_MAP: "ALL (n::nat) l::'a::type list.
  2.6534 +   n <= length l -->
  2.6535 +   (ALL f::'a::type => 'b::type.
  2.6536 +       BUTLASTN n (map f l) = map f (BUTLASTN n l))"
  2.6537    by (import rich_list BUTLASTN_MAP)
  2.6538  
  2.6539 -lemma ALL_EL_LASTN: "(All::(('a => bool) => bool) => bool)
  2.6540 - (%P::'a => bool.
  2.6541 -     (All::('a list => bool) => bool)
  2.6542 -      (%l::'a list.
  2.6543 +lemma ALL_EL_LASTN: "(All::(('a::type => bool) => bool) => bool)
  2.6544 + (%P::'a::type => bool.
  2.6545 +     (All::('a::type list => bool) => bool)
  2.6546 +      (%l::'a::type list.
  2.6547            (op -->::bool => bool => bool)
  2.6548 -           ((list_all::('a => bool) => 'a list => bool) P l)
  2.6549 +           ((list_all::('a::type => bool) => 'a::type list => bool) P l)
  2.6550             ((All::(nat => bool) => bool)
  2.6551               (%m::nat.
  2.6552                   (op -->::bool => bool => bool)
  2.6553 -                  ((op <=::nat => nat => bool) m ((size::'a list => nat) l))
  2.6554 -                  ((list_all::('a => bool) => 'a list => bool) P
  2.6555 -                    ((LASTN::nat => 'a list => 'a list) m l))))))"
  2.6556 +                  ((op <=::nat => nat => bool) m
  2.6557 +                    ((size::'a::type list => nat) l))
  2.6558 +                  ((list_all::('a::type => bool) => 'a::type list => bool) P
  2.6559 +                    ((LASTN::nat => 'a::type list => 'a::type list) m
  2.6560 +                      l))))))"
  2.6561    by (import rich_list ALL_EL_LASTN)
  2.6562  
  2.6563 -lemma ALL_EL_BUTLASTN: "(All::(('a => bool) => bool) => bool)
  2.6564 - (%P::'a => bool.
  2.6565 -     (All::('a list => bool) => bool)
  2.6566 -      (%l::'a list.
  2.6567 +lemma ALL_EL_BUTLASTN: "(All::(('a::type => bool) => bool) => bool)
  2.6568 + (%P::'a::type => bool.
  2.6569 +     (All::('a::type list => bool) => bool)
  2.6570 +      (%l::'a::type list.
  2.6571            (op -->::bool => bool => bool)
  2.6572 -           ((list_all::('a => bool) => 'a list => bool) P l)
  2.6573 +           ((list_all::('a::type => bool) => 'a::type list => bool) P l)
  2.6574             ((All::(nat => bool) => bool)
  2.6575               (%m::nat.
  2.6576                   (op -->::bool => bool => bool)
  2.6577 -                  ((op <=::nat => nat => bool) m ((size::'a list => nat) l))
  2.6578 -                  ((list_all::('a => bool) => 'a list => bool) P
  2.6579 -                    ((BUTLASTN::nat => 'a list => 'a list) m l))))))"
  2.6580 +                  ((op <=::nat => nat => bool) m
  2.6581 +                    ((size::'a::type list => nat) l))
  2.6582 +                  ((list_all::('a::type => bool) => 'a::type list => bool) P
  2.6583 +                    ((BUTLASTN::nat => 'a::type list => 'a::type list) m
  2.6584 +                      l))))))"
  2.6585    by (import rich_list ALL_EL_BUTLASTN)
  2.6586  
  2.6587 -lemma LENGTH_FIRSTN: "ALL n l. n <= length l --> length (FIRSTN n l) = n"
  2.6588 +lemma LENGTH_FIRSTN: "ALL (n::nat) l::'a::type list. n <= length l --> length (FIRSTN n l) = n"
  2.6589    by (import rich_list LENGTH_FIRSTN)
  2.6590  
  2.6591  lemma FIRSTN_FIRSTN: "(All::(nat => bool) => bool)
  2.6592   (%m::nat.
  2.6593 -     (All::('a list => bool) => bool)
  2.6594 -      (%l::'a list.
  2.6595 +     (All::('a::type list => bool) => bool)
  2.6596 +      (%l::'a::type list.
  2.6597            (op -->::bool => bool => bool)
  2.6598 -           ((op <=::nat => nat => bool) m ((size::'a list => nat) l))
  2.6599 +           ((op <=::nat => nat => bool) m ((size::'a::type list => nat) l))
  2.6600             ((All::(nat => bool) => bool)
  2.6601               (%n::nat.
  2.6602                   (op -->::bool => bool => bool)
  2.6603                    ((op <=::nat => nat => bool) n m)
  2.6604 -                  ((op =::'a list => 'a list => bool)
  2.6605 -                    ((FIRSTN::nat => 'a list => 'a list) n
  2.6606 -                      ((FIRSTN::nat => 'a list => 'a list) m l))
  2.6607 -                    ((FIRSTN::nat => 'a list => 'a list) n l))))))"
  2.6608 +                  ((op =::'a::type list => 'a::type list => bool)
  2.6609 +                    ((FIRSTN::nat => 'a::type list => 'a::type list) n
  2.6610 +                      ((FIRSTN::nat => 'a::type list => 'a::type list) m l))
  2.6611 +                    ((FIRSTN::nat => 'a::type list => 'a::type list) n
  2.6612 +                      l))))))"
  2.6613    by (import rich_list FIRSTN_FIRSTN)
  2.6614  
  2.6615 -lemma LENGTH_BUTFIRSTN: "ALL n l. n <= length l --> length (BUTFIRSTN n l) = length l - n"
  2.6616 +lemma LENGTH_BUTFIRSTN: "ALL (n::nat) l::'a::type list.
  2.6617 +   n <= length l --> length (BUTFIRSTN n l) = length l - n"
  2.6618    by (import rich_list LENGTH_BUTFIRSTN)
  2.6619  
  2.6620 -lemma BUTFIRSTN_LENGTH_NIL: "ALL l. BUTFIRSTN (length l) l = []"
  2.6621 +lemma BUTFIRSTN_LENGTH_NIL: "ALL l::'a::type list. BUTFIRSTN (length l) l = []"
  2.6622    by (import rich_list BUTFIRSTN_LENGTH_NIL)
  2.6623  
  2.6624 -lemma BUTFIRSTN_APPEND1: "ALL n l1.
  2.6625 -   n <= length l1 --> (ALL l2. BUTFIRSTN n (l1 @ l2) = BUTFIRSTN n l1 @ l2)"
  2.6626 +lemma BUTFIRSTN_APPEND1: "ALL (n::nat) l1::'a::type list.
  2.6627 +   n <= length l1 -->
  2.6628 +   (ALL l2::'a::type list. BUTFIRSTN n (l1 @ l2) = BUTFIRSTN n l1 @ l2)"
  2.6629    by (import rich_list BUTFIRSTN_APPEND1)
  2.6630  
  2.6631 -lemma BUTFIRSTN_APPEND2: "ALL l1 n.
  2.6632 +lemma BUTFIRSTN_APPEND2: "ALL (l1::'a::type list) n::nat.
  2.6633     length l1 <= n -->
  2.6634 -   (ALL l2. BUTFIRSTN n (l1 @ l2) = BUTFIRSTN (n - length l1) l2)"
  2.6635 +   (ALL l2::'a::type list.
  2.6636 +       BUTFIRSTN n (l1 @ l2) = BUTFIRSTN (n - length l1) l2)"
  2.6637    by (import rich_list BUTFIRSTN_APPEND2)
  2.6638  
  2.6639 -lemma BUTFIRSTN_BUTFIRSTN: "ALL n m l.
  2.6640 +lemma BUTFIRSTN_BUTFIRSTN: "ALL (n::nat) (m::nat) l::'a::type list.
  2.6641     n + m <= length l --> BUTFIRSTN n (BUTFIRSTN m l) = BUTFIRSTN (n + m) l"
  2.6642    by (import rich_list BUTFIRSTN_BUTFIRSTN)
  2.6643  
  2.6644 -lemma APPEND_FIRSTN_BUTFIRSTN: "ALL n l. n <= length l --> FIRSTN n l @ BUTFIRSTN n l = l"
  2.6645 +lemma APPEND_FIRSTN_BUTFIRSTN: "ALL (n::nat) l::'a::type list.
  2.6646 +   n <= length l --> FIRSTN n l @ BUTFIRSTN n l = l"
  2.6647    by (import rich_list APPEND_FIRSTN_BUTFIRSTN)
  2.6648  
  2.6649 -lemma LASTN_SEG: "ALL n l. n <= length l --> LASTN n l = SEG n (length l - n) l"
  2.6650 +lemma LASTN_SEG: "ALL (n::nat) l::'a::type list.
  2.6651 +   n <= length l --> LASTN n l = SEG n (length l - n) l"
  2.6652    by (import rich_list LASTN_SEG)
  2.6653  
  2.6654 -lemma FIRSTN_SEG: "ALL n l. n <= length l --> FIRSTN n l = SEG n 0 l"
  2.6655 +lemma FIRSTN_SEG: "ALL (n::nat) l::'a::type list.
  2.6656 +   n <= length l --> FIRSTN n l = SEG n (0::nat) l"
  2.6657    by (import rich_list FIRSTN_SEG)
  2.6658  
  2.6659 -lemma BUTFIRSTN_SEG: "ALL n l. n <= length l --> BUTFIRSTN n l = SEG (length l - n) n l"
  2.6660 +lemma BUTFIRSTN_SEG: "ALL (n::nat) l::'a::type list.
  2.6661 +   n <= length l --> BUTFIRSTN n l = SEG (length l - n) n l"
  2.6662    by (import rich_list BUTFIRSTN_SEG)
  2.6663  
  2.6664 -lemma BUTFIRSTN_SNOC: "ALL n l.
  2.6665 +lemma BUTFIRSTN_SNOC: "ALL (n::nat) l::'a::type list.
  2.6666     n <= length l -->
  2.6667 -   (ALL x. BUTFIRSTN n (SNOC x l) = SNOC x (BUTFIRSTN n l))"
  2.6668 +   (ALL x::'a::type. BUTFIRSTN n (SNOC x l) = SNOC x (BUTFIRSTN n l))"
  2.6669    by (import rich_list BUTFIRSTN_SNOC)
  2.6670  
  2.6671 -lemma APPEND_BUTLASTN_BUTFIRSTN: "ALL m n l. m + n = length l --> BUTLASTN m l @ BUTFIRSTN n l = l"
  2.6672 +lemma APPEND_BUTLASTN_BUTFIRSTN: "ALL (m::nat) (n::nat) l::'a::type list.
  2.6673 +   m + n = length l --> BUTLASTN m l @ BUTFIRSTN n l = l"
  2.6674    by (import rich_list APPEND_BUTLASTN_BUTFIRSTN)
  2.6675  
  2.6676 -lemma SEG_SEG: "ALL n1 m1 n2 m2 l.
  2.6677 +lemma SEG_SEG: "ALL (n1::nat) (m1::nat) (n2::nat) (m2::nat) l::'a::type list.
  2.6678     n1 + m1 <= length l & n2 + m2 <= n1 -->
  2.6679     SEG n2 m2 (SEG n1 m1 l) = SEG n2 (m1 + m2) l"
  2.6680    by (import rich_list SEG_SEG)
  2.6681  
  2.6682 -lemma SEG_APPEND1: "ALL n m l1. n + m <= length l1 --> (ALL l2. SEG n m (l1 @ l2) = SEG n m l1)"
  2.6683 +lemma SEG_APPEND1: "ALL (n::nat) (m::nat) l1::'a::type list.
  2.6684 +   n + m <= length l1 -->
  2.6685 +   (ALL l2::'a::type list. SEG n m (l1 @ l2) = SEG n m l1)"
  2.6686    by (import rich_list SEG_APPEND1)
  2.6687  
  2.6688 -lemma SEG_APPEND2: "ALL l1 m n l2.
  2.6689 +lemma SEG_APPEND2: "ALL (l1::'a::type list) (m::nat) (n::nat) l2::'a::type list.
  2.6690     length l1 <= m & n <= length l2 -->
  2.6691     SEG n m (l1 @ l2) = SEG n (m - length l1) l2"
  2.6692    by (import rich_list SEG_APPEND2)
  2.6693  
  2.6694 -lemma SEG_FIRSTN_BUTFISTN: "ALL n m l. n + m <= length l --> SEG n m l = FIRSTN n (BUTFIRSTN m l)"
  2.6695 +lemma SEG_FIRSTN_BUTFISTN: "ALL (n::nat) (m::nat) l::'a::type list.
  2.6696 +   n + m <= length l --> SEG n m l = FIRSTN n (BUTFIRSTN m l)"
  2.6697    by (import rich_list SEG_FIRSTN_BUTFISTN)
  2.6698  
  2.6699 -lemma SEG_APPEND: "ALL m l1 n l2.
  2.6700 +lemma SEG_APPEND: "ALL (m::nat) (l1::'a::type list) (n::nat) l2::'a::type list.
  2.6701     m < length l1 & length l1 <= n + m & n + m <= length l1 + length l2 -->
  2.6702     SEG n m (l1 @ l2) =
  2.6703 -   SEG (length l1 - m) m l1 @ SEG (n + m - length l1) 0 l2"
  2.6704 +   SEG (length l1 - m) m l1 @ SEG (n + m - length l1) (0::nat) l2"
  2.6705    by (import rich_list SEG_APPEND)
  2.6706  
  2.6707 -lemma SEG_LENGTH_SNOC: "ALL x xa. SEG 1 (length x) (SNOC xa x) = [xa]"
  2.6708 +lemma SEG_LENGTH_SNOC: "ALL (x::'a::type list) xa::'a::type.
  2.6709 +   SEG (1::nat) (length x) (SNOC xa x) = [xa]"
  2.6710    by (import rich_list SEG_LENGTH_SNOC)
  2.6711  
  2.6712 -lemma SEG_SNOC: "ALL n m l. n + m <= length l --> (ALL x. SEG n m (SNOC x l) = SEG n m l)"
  2.6713 +lemma SEG_SNOC: "ALL (n::nat) (m::nat) l::'a::type list.
  2.6714 +   n + m <= length l --> (ALL x::'a::type. SEG n m (SNOC x l) = SEG n m l)"
  2.6715    by (import rich_list SEG_SNOC)
  2.6716  
  2.6717 -lemma ELL_SEG: "ALL n l. n < length l --> ELL n l = hd (SEG 1 (PRE (length l - n)) l)"
  2.6718 +lemma ELL_SEG: "ALL (n::nat) l::'a::type list.
  2.6719 +   n < length l --> ELL n l = hd (SEG (1::nat) (PRE (length l - n)) l)"
  2.6720    by (import rich_list ELL_SEG)
  2.6721  
  2.6722 -lemma SNOC_FOLDR: "ALL x l. SNOC x l = foldr op # l [x]"
  2.6723 +lemma SNOC_FOLDR: "ALL (x::'a::type) l::'a::type list. SNOC x l = foldr op # l [x]"
  2.6724    by (import rich_list SNOC_FOLDR)
  2.6725  
  2.6726 -lemma IS_EL_FOLDR_MAP: "ALL x xa. x mem xa = foldr op | (map (op = x) xa) False"
  2.6727 +lemma IS_EL_FOLDR_MAP: "ALL (x::'a::type) xa::'a::type list.
  2.6728 +   x mem xa = foldr op | (map (op = x) xa) False"
  2.6729    by (import rich_list IS_EL_FOLDR_MAP)
  2.6730  
  2.6731 -lemma IS_EL_FOLDL_MAP: "ALL x xa. x mem xa = foldl op | False (map (op = x) xa)"
  2.6732 +lemma IS_EL_FOLDL_MAP: "ALL (x::'a::type) xa::'a::type list.
  2.6733 +   x mem xa = foldl op | False (map (op = x) xa)"
  2.6734    by (import rich_list IS_EL_FOLDL_MAP)
  2.6735  
  2.6736 -lemma FILTER_FILTER: "ALL P Q l. filter P (filter Q l) = [x:l. P x & Q x]"
  2.6737 +lemma FILTER_FILTER: "ALL (P::'a::type => bool) (Q::'a::type => bool) l::'a::type list.
  2.6738 +   filter P (filter Q l) = [x::'a::type:l. P x & Q x]"
  2.6739    by (import rich_list FILTER_FILTER)
  2.6740  
  2.6741 -lemma FCOMM_FOLDR_FLAT: "ALL g f.
  2.6742 +lemma FCOMM_FOLDR_FLAT: "ALL (g::'a::type => 'a::type => 'a::type)
  2.6743 +   f::'b::type => 'a::type => 'a::type.
  2.6744     FCOMM g f -->
  2.6745 -   (ALL e.
  2.6746 +   (ALL e::'a::type.
  2.6747         LEFT_ID g e -->
  2.6748 -       (ALL l. foldr f (concat l) e = foldr g (map (FOLDR f e) l) e))"
  2.6749 +       (ALL l::'b::type list list.
  2.6750 +           foldr f (concat l) e = foldr g (map (FOLDR f e) l) e))"
  2.6751    by (import rich_list FCOMM_FOLDR_FLAT)
  2.6752  
  2.6753 -lemma FCOMM_FOLDL_FLAT: "ALL f g.
  2.6754 +lemma FCOMM_FOLDL_FLAT: "ALL (f::'a::type => 'b::type => 'a::type)
  2.6755 +   g::'a::type => 'a::type => 'a::type.
  2.6756     FCOMM f g -->
  2.6757 -   (ALL e.
  2.6758 +   (ALL e::'a::type.
  2.6759         RIGHT_ID g e -->
  2.6760 -       (ALL l. foldl f e (concat l) = foldl g e (map (foldl f e) l)))"
  2.6761 +       (ALL l::'b::type list list.
  2.6762 +           foldl f e (concat l) = foldl g e (map (foldl f e) l)))"
  2.6763    by (import rich_list FCOMM_FOLDL_FLAT)
  2.6764  
  2.6765 -lemma FOLDR_MAP_REVERSE: "ALL f::'a => 'a => 'a.
  2.6766 -   (ALL (a::'a) (b::'a) c::'a. f a (f b c) = f b (f a c)) -->
  2.6767 -   (ALL (e::'a) (g::'b => 'a) l::'b list.
  2.6768 +lemma FOLDR_MAP_REVERSE: "ALL f::'a::type => 'a::type => 'a::type.
  2.6769 +   (ALL (a::'a::type) (b::'a::type) c::'a::type.
  2.6770 +       f a (f b c) = f b (f a c)) -->
  2.6771 +   (ALL (e::'a::type) (g::'b::type => 'a::type) l::'b::type list.
  2.6772         foldr f (map g (rev l)) e = foldr f (map g l) e)"
  2.6773    by (import rich_list FOLDR_MAP_REVERSE)
  2.6774  
  2.6775 -lemma FOLDR_FILTER_REVERSE: "ALL f::'a => 'a => 'a.
  2.6776 -   (ALL (a::'a) (b::'a) c::'a. f a (f b c) = f b (f a c)) -->
  2.6777 -   (ALL (e::'a) (P::'a => bool) l::'a list.
  2.6778 +lemma FOLDR_FILTER_REVERSE: "ALL f::'a::type => 'a::type => 'a::type.
  2.6779 +   (ALL (a::'a::type) (b::'a::type) c::'a::type.
  2.6780 +       f a (f b c) = f b (f a c)) -->
  2.6781 +   (ALL (e::'a::type) (P::'a::type => bool) l::'a::type list.
  2.6782         foldr f (filter P (rev l)) e = foldr f (filter P l) e)"
  2.6783    by (import rich_list FOLDR_FILTER_REVERSE)
  2.6784  
  2.6785 -lemma COMM_ASSOC_FOLDR_REVERSE: "ALL f. COMM f --> ASSOC f --> (ALL e l. foldr f (rev l) e = foldr f l e)"
  2.6786 +lemma COMM_ASSOC_FOLDR_REVERSE: "ALL f::'a::type => 'a::type => 'a::type.
  2.6787 +   COMM f -->
  2.6788 +   ASSOC f -->
  2.6789 +   (ALL (e::'a::type) l::'a::type list. foldr f (rev l) e = foldr f l e)"
  2.6790    by (import rich_list COMM_ASSOC_FOLDR_REVERSE)
  2.6791  
  2.6792 -lemma COMM_ASSOC_FOLDL_REVERSE: "ALL f. COMM f --> ASSOC f --> (ALL e l. foldl f e (rev l) = foldl f e l)"
  2.6793 +lemma COMM_ASSOC_FOLDL_REVERSE: "ALL f::'a::type => 'a::type => 'a::type.
  2.6794 +   COMM f -->
  2.6795 +   ASSOC f -->
  2.6796 +   (ALL (e::'a::type) l::'a::type list. foldl f e (rev l) = foldl f e l)"
  2.6797    by (import rich_list COMM_ASSOC_FOLDL_REVERSE)
  2.6798  
  2.6799 -lemma ELL_LAST: "ALL l. ~ null l --> ELL 0 l = last l"
  2.6800 +lemma ELL_LAST: "ALL l::'a::type list. ~ null l --> ELL (0::nat) l = last l"
  2.6801    by (import rich_list ELL_LAST)
  2.6802  
  2.6803 -lemma ELL_0_SNOC: "ALL l x. ELL 0 (SNOC x l) = x"
  2.6804 +lemma ELL_0_SNOC: "ALL (l::'a::type list) x::'a::type. ELL (0::nat) (SNOC x l) = x"
  2.6805    by (import rich_list ELL_0_SNOC)
  2.6806  
  2.6807 -lemma ELL_SNOC: "ALL n>0. ALL x l. ELL n (SNOC x l) = ELL (PRE n) l"
  2.6808 +lemma ELL_SNOC: "ALL n>0::nat.
  2.6809 +   ALL (x::'a::type) l::'a::type list. ELL n (SNOC x l) = ELL (PRE n) l"
  2.6810    by (import rich_list ELL_SNOC)
  2.6811  
  2.6812 -lemma ELL_SUC_SNOC: "ALL n x xa. ELL (Suc n) (SNOC x xa) = ELL n xa"
  2.6813 +lemma ELL_SUC_SNOC: "ALL (n::nat) (x::'a::type) xa::'a::type list.
  2.6814 +   ELL (Suc n) (SNOC x xa) = ELL n xa"
  2.6815    by (import rich_list ELL_SUC_SNOC)
  2.6816  
  2.6817 -lemma ELL_CONS: "ALL n l. n < length l --> (ALL x. ELL n (x # l) = ELL n l)"
  2.6818 +lemma ELL_CONS: "ALL (n::nat) l::'a::type list.
  2.6819 +   n < length l --> (ALL x::'a::type. ELL n (x # l) = ELL n l)"
  2.6820    by (import rich_list ELL_CONS)
  2.6821  
  2.6822 -lemma ELL_LENGTH_CONS: "ALL l x. ELL (length l) (x # l) = x"
  2.6823 +lemma ELL_LENGTH_CONS: "ALL (l::'a::type list) x::'a::type. ELL (length l) (x # l) = x"
  2.6824    by (import rich_list ELL_LENGTH_CONS)
  2.6825  
  2.6826 -lemma ELL_LENGTH_SNOC: "ALL l x. ELL (length l) (SNOC x l) = (if null l then x else hd l)"
  2.6827 +lemma ELL_LENGTH_SNOC: "ALL (l::'a::type list) x::'a::type.
  2.6828 +   ELL (length l) (SNOC x l) = (if null l then x else hd l)"
  2.6829    by (import rich_list ELL_LENGTH_SNOC)
  2.6830  
  2.6831 -lemma ELL_APPEND2: "ALL n l2. n < length l2 --> (ALL l1. ELL n (l1 @ l2) = ELL n l2)"
  2.6832 +lemma ELL_APPEND2: "ALL (n::nat) l2::'a::type list.
  2.6833 +   n < length l2 --> (ALL l1::'a::type list. ELL n (l1 @ l2) = ELL n l2)"
  2.6834    by (import rich_list ELL_APPEND2)
  2.6835  
  2.6836 -lemma ELL_APPEND1: "ALL l2 n.
  2.6837 -   length l2 <= n --> (ALL l1. ELL n (l1 @ l2) = ELL (n - length l2) l1)"
  2.6838 +lemma ELL_APPEND1: "ALL (l2::'a::type list) n::nat.
  2.6839 +   length l2 <= n -->
  2.6840 +   (ALL l1::'a::type list. ELL n (l1 @ l2) = ELL (n - length l2) l1)"
  2.6841    by (import rich_list ELL_APPEND1)
  2.6842  
  2.6843 -lemma ELL_PRE_LENGTH: "ALL l. l ~= [] --> ELL (PRE (length l)) l = hd l"
  2.6844 +lemma ELL_PRE_LENGTH: "ALL l::'a::type list. l ~= [] --> ELL (PRE (length l)) l = hd l"
  2.6845    by (import rich_list ELL_PRE_LENGTH)
  2.6846  
  2.6847 -lemma EL_LENGTH_SNOC: "ALL l x. EL (length l) (SNOC x l) = x"
  2.6848 +lemma EL_LENGTH_SNOC: "ALL (l::'a::type list) x::'a::type. EL (length l) (SNOC x l) = x"
  2.6849    by (import rich_list EL_LENGTH_SNOC)
  2.6850  
  2.6851 -lemma EL_PRE_LENGTH: "ALL l. l ~= [] --> EL (PRE (length l)) l = last l"
  2.6852 +lemma EL_PRE_LENGTH: "ALL l::'a::type list. l ~= [] --> EL (PRE (length l)) l = last l"
  2.6853    by (import rich_list EL_PRE_LENGTH)
  2.6854  
  2.6855 -lemma EL_SNOC: "ALL n l. n < length l --> (ALL x. EL n (SNOC x l) = EL n l)"
  2.6856 +lemma EL_SNOC: "ALL (n::nat) l::'a::type list.
  2.6857 +   n < length l --> (ALL x::'a::type. EL n (SNOC x l) = EL n l)"
  2.6858    by (import rich_list EL_SNOC)
  2.6859  
  2.6860 -lemma EL_ELL: "ALL n l. n < length l --> EL n l = ELL (PRE (length l - n)) l"
  2.6861 +lemma EL_ELL: "ALL (n::nat) l::'a::type list.
  2.6862 +   n < length l --> EL n l = ELL (PRE (length l - n)) l"
  2.6863    by (import rich_list EL_ELL)
  2.6864  
  2.6865 -lemma EL_LENGTH_APPEND: "ALL l2 l1. ~ null l2 --> EL (length l1) (l1 @ l2) = hd l2"
  2.6866 +lemma EL_LENGTH_APPEND: "ALL (l2::'a::type list) l1::'a::type list.
  2.6867 +   ~ null l2 --> EL (length l1) (l1 @ l2) = hd l2"
  2.6868    by (import rich_list EL_LENGTH_APPEND)
  2.6869  
  2.6870 -lemma ELL_EL: "ALL n l. n < length l --> ELL n l = EL (PRE (length l - n)) l"
  2.6871 +lemma ELL_EL: "ALL (n::nat) l::'a::type list.
  2.6872 +   n < length l --> ELL n l = EL (PRE (length l - n)) l"
  2.6873    by (import rich_list ELL_EL)
  2.6874  
  2.6875 -lemma ELL_MAP: "ALL n l f. n < length l --> ELL n (map f l) = f (ELL n l)"
  2.6876 +lemma ELL_MAP: "ALL (n::nat) (l::'a::type list) f::'a::type => 'b::type.
  2.6877 +   n < length l --> ELL n (map f l) = f (ELL n l)"
  2.6878    by (import rich_list ELL_MAP)
  2.6879  
  2.6880 -lemma LENGTH_BUTLAST: "ALL l. l ~= [] --> length (butlast l) = PRE (length l)"
  2.6881 +lemma LENGTH_BUTLAST: "ALL l::'a::type list. l ~= [] --> length (butlast l) = PRE (length l)"
  2.6882    by (import rich_list LENGTH_BUTLAST)
  2.6883  
  2.6884 -lemma BUTFIRSTN_LENGTH_APPEND: "ALL l1 l2. BUTFIRSTN (length l1) (l1 @ l2) = l2"
  2.6885 +lemma BUTFIRSTN_LENGTH_APPEND: "ALL (l1::'a::type list) l2::'a::type list.
  2.6886 +   BUTFIRSTN (length l1) (l1 @ l2) = l2"
  2.6887    by (import rich_list BUTFIRSTN_LENGTH_APPEND)
  2.6888  
  2.6889 -lemma FIRSTN_APPEND1: "ALL n l1. n <= length l1 --> (ALL l2. FIRSTN n (l1 @ l2) = FIRSTN n l1)"
  2.6890 +lemma FIRSTN_APPEND1: "ALL (n::nat) l1::'a::type list.
  2.6891 +   n <= length l1 -->
  2.6892 +   (ALL l2::'a::type list. FIRSTN n (l1 @ l2) = FIRSTN n l1)"
  2.6893    by (import rich_list FIRSTN_APPEND1)
  2.6894  
  2.6895 -lemma FIRSTN_APPEND2: "ALL l1 n.
  2.6896 +lemma FIRSTN_APPEND2: "ALL (l1::'a::type list) n::nat.
  2.6897     length l1 <= n -->
  2.6898 -   (ALL l2. FIRSTN n (l1 @ l2) = l1 @ FIRSTN (n - length l1) l2)"
  2.6899 +   (ALL l2::'a::type list.
  2.6900 +       FIRSTN n (l1 @ l2) = l1 @ FIRSTN (n - length l1) l2)"
  2.6901    by (import rich_list FIRSTN_APPEND2)
  2.6902  
  2.6903 -lemma FIRSTN_LENGTH_APPEND: "ALL l1 l2. FIRSTN (length l1) (l1 @ l2) = l1"
  2.6904 +lemma FIRSTN_LENGTH_APPEND: "ALL (l1::'a::type list) l2::'a::type list. FIRSTN (length l1) (l1 @ l2) = l1"
  2.6905    by (import rich_list FIRSTN_LENGTH_APPEND)
  2.6906  
  2.6907 -lemma REVERSE_FLAT: "ALL l. rev (concat l) = concat (rev (map rev l))"
  2.6908 +lemma REVERSE_FLAT: "ALL l::'a::type list list. rev (concat l) = concat (rev (map rev l))"
  2.6909    by (import rich_list REVERSE_FLAT)
  2.6910  
  2.6911 -lemma MAP_FILTER: "ALL f P l.
  2.6912 -   (ALL x. P (f x) = P x) --> map f (filter P l) = filter P (map f l)"
  2.6913 +lemma MAP_FILTER: "ALL (f::'a::type => 'a::type) (P::'a::type => bool) l::'a::type list.
  2.6914 +   (ALL x::'a::type. P (f x) = P x) -->
  2.6915 +   map f (filter P l) = filter P (map f l)"
  2.6916    by (import rich_list MAP_FILTER)
  2.6917  
  2.6918 -lemma FLAT_REVERSE: "ALL l. concat (rev l) = rev (concat (map rev l))"
  2.6919 +lemma FLAT_REVERSE: "ALL l::'a::type list list. concat (rev l) = rev (concat (map rev l))"
  2.6920    by (import rich_list FLAT_REVERSE)
  2.6921  
  2.6922 -lemma FLAT_FLAT: "ALL l. concat (concat l) = concat (map concat l)"
  2.6923 +lemma FLAT_FLAT: "ALL l::'a::type list list list. concat (concat l) = concat (map concat l)"
  2.6924    by (import rich_list FLAT_FLAT)
  2.6925  
  2.6926 -lemma SOME_EL_REVERSE: "ALL P l. list_exists P (rev l) = list_exists P l"
  2.6927 +lemma SOME_EL_REVERSE: "ALL (P::'a::type => bool) l::'a::type list.
  2.6928 +   list_exists P (rev l) = list_exists P l"
  2.6929    by (import rich_list SOME_EL_REVERSE)
  2.6930  
  2.6931 -lemma ALL_EL_SEG: "ALL P l.
  2.6932 -   list_all P l --> (ALL m k. m + k <= length l --> list_all P (SEG m k l))"
  2.6933 +lemma ALL_EL_SEG: "ALL (P::'a::type => bool) l::'a::type list.
  2.6934 +   list_all P l -->
  2.6935 +   (ALL (m::nat) k::nat. m + k <= length l --> list_all P (SEG m k l))"
  2.6936    by (import rich_list ALL_EL_SEG)
  2.6937  
  2.6938 -lemma ALL_EL_FIRSTN: "(All::(('a => bool) => bool) => bool)
  2.6939 - (%P::'a => bool.
  2.6940 -     (All::('a list => bool) => bool)
  2.6941 -      (%l::'a list.
  2.6942 +lemma ALL_EL_FIRSTN: "(All::(('a::type => bool) => bool) => bool)
  2.6943 + (%P::'a::type => bool.
  2.6944 +     (All::('a::type list => bool) => bool)
  2.6945 +      (%l::'a::type list.
  2.6946            (op -->::bool => bool => bool)
  2.6947 -           ((list_all::('a => bool) => 'a list => bool) P l)
  2.6948 -           ((All::(nat => bool) => bool)
  2.6949 -             (%m::nat.
  2.6950 -                 (op -->::bool => bool => bool)
  2.6951 -                  ((op <=::nat => nat => bool) m ((size::'a list => nat) l))
  2.6952 -                  ((list_all::('a => bool) => 'a list => bool) P
  2.6953 -                    ((FIRSTN::nat => 'a list => 'a list) m l))))))"
  2.6954 -  by (import rich_list ALL_EL_FIRSTN)
  2.6955 -
  2.6956 -lemma ALL_EL_BUTFIRSTN: "(All::(('a => bool) => bool) => bool)
  2.6957 - (%P::'a => bool.
  2.6958 -     (All::('a list => bool) => bool)
  2.6959 -      (%l::'a list.
  2.6960 -          (op -->::bool => bool => bool)
  2.6961 -           ((list_all::('a => bool) => 'a list => bool) P l)
  2.6962 +           ((list_all::('a::type => bool) => 'a::type list => bool) P l)
  2.6963             ((All::(nat => bool) => bool)
  2.6964               (%m::nat.
  2.6965                   (op -->::bool => bool => bool)
  2.6966 -                  ((op <=::nat => nat => bool) m ((size::'a list => nat) l))
  2.6967 -                  ((list_all::('a => bool) => 'a list => bool) P
  2.6968 -                    ((BUTFIRSTN::nat => 'a list => 'a list) m l))))))"
  2.6969 +                  ((op <=::nat => nat => bool) m
  2.6970 +                    ((size::'a::type list => nat) l))
  2.6971 +                  ((list_all::('a::type => bool) => 'a::type list => bool) P
  2.6972 +                    ((FIRSTN::nat => 'a::type list => 'a::type list) m
  2.6973 +                      l))))))"
  2.6974 +  by (import rich_list ALL_EL_FIRSTN)
  2.6975 +
  2.6976 +lemma ALL_EL_BUTFIRSTN: "(All::(('a::type => bool) => bool) => bool)
  2.6977 + (%P::'a::type => bool.
  2.6978 +     (All::('a::type list => bool) => bool)
  2.6979 +      (%l::'a::type list.
  2.6980 +          (op -->::bool => bool => bool)
  2.6981 +           ((list_all::('a::type => bool) => 'a::type list => bool) P l)
  2.6982 +           ((All::(nat => bool) => bool)
  2.6983 +             (%m::nat.
  2.6984 +                 (op -->::bool => bool => bool)
  2.6985 +                  ((op <=::nat => nat => bool) m
  2.6986 +                    ((size::'a::type list => nat) l))
  2.6987 +                  ((list_all::('a::type => bool) => 'a::type list => bool) P
  2.6988 +                    ((BUTFIRSTN::nat => 'a::type list => 'a::type list) m
  2.6989 +                      l))))))"
  2.6990    by (import rich_list ALL_EL_BUTFIRSTN)
  2.6991  
  2.6992 -lemma SOME_EL_SEG: "ALL m k l.
  2.6993 +lemma SOME_EL_SEG: "ALL (m::nat) (k::nat) l::'a::type list.
  2.6994     m + k <= length l -->
  2.6995 -   (ALL P. list_exists P (SEG m k l) --> list_exists P l)"
  2.6996 +   (ALL P::'a::type => bool. list_exists P (SEG m k l) --> list_exists P l)"
  2.6997    by (import rich_list SOME_EL_SEG)
  2.6998  
  2.6999 -lemma SOME_EL_FIRSTN: "ALL m l.
  2.7000 -   m <= length l --> (ALL P. list_exists P (FIRSTN m l) --> list_exists P l)"
  2.7001 +lemma SOME_EL_FIRSTN: "ALL (m::nat) l::'a::type list.
  2.7002 +   m <= length l -->
  2.7003 +   (ALL P::'a::type => bool. list_exists P (FIRSTN m l) --> list_exists P l)"
  2.7004    by (import rich_list SOME_EL_FIRSTN)
  2.7005  
  2.7006 -lemma SOME_EL_BUTFIRSTN: "ALL m l.
  2.7007 +lemma SOME_EL_BUTFIRSTN: "ALL (m::nat) l::'a::type list.
  2.7008     m <= length l -->
  2.7009 -   (ALL P. list_exists P (BUTFIRSTN m l) --> list_exists P l)"
  2.7010 +   (ALL P::'a::type => bool.
  2.7011 +       list_exists P (BUTFIRSTN m l) --> list_exists P l)"
  2.7012    by (import rich_list SOME_EL_BUTFIRSTN)
  2.7013  
  2.7014 -lemma SOME_EL_LASTN: "ALL m l.
  2.7015 -   m <= length l --> (ALL P. list_exists P (LASTN m l) --> list_exists P l)"
  2.7016 +lemma SOME_EL_LASTN: "ALL (m::nat) l::'a::type list.
  2.7017 +   m <= length l -->
  2.7018 +   (ALL P::'a::type => bool. list_exists P (LASTN m l) --> list_exists P l)"
  2.7019    by (import rich_list SOME_EL_LASTN)
  2.7020  
  2.7021 -lemma SOME_EL_BUTLASTN: "ALL m l.
  2.7022 +lemma SOME_EL_BUTLASTN: "ALL (m::nat) l::'a::type list.
  2.7023     m <= length l -->
  2.7024 -   (ALL P. list_exists P (BUTLASTN m l) --> list_exists P l)"
  2.7025 +   (ALL P::'a::type => bool.
  2.7026 +       list_exists P (BUTLASTN m l) --> list_exists P l)"
  2.7027    by (import rich_list SOME_EL_BUTLASTN)
  2.7028  
  2.7029 -lemma IS_EL_REVERSE: "ALL x l. x mem rev l = x mem l"
  2.7030 +lemma IS_EL_REVERSE: "ALL (x::'a::type) l::'a::type list. x mem rev l = x mem l"
  2.7031    by (import rich_list IS_EL_REVERSE)
  2.7032  
  2.7033 -lemma IS_EL_FILTER: "ALL P x. P x --> (ALL l. x mem filter P l = x mem l)"
  2.7034 +lemma IS_EL_FILTER: "ALL (P::'a::type => bool) x::'a::type.
  2.7035 +   P x --> (ALL l::'a::type list. x mem filter P l = x mem l)"
  2.7036    by (import rich_list IS_EL_FILTER)
  2.7037  
  2.7038 -lemma IS_EL_SEG: "ALL n m l. n + m <= length l --> (ALL x. x mem SEG n m l --> x mem l)"
  2.7039 +lemma IS_EL_SEG: "ALL (n::nat) (m::nat) l::'a::type list.
  2.7040 +   n + m <= length l --> (ALL x::'a::type. x mem SEG n m l --> x mem l)"
  2.7041    by (import rich_list IS_EL_SEG)
  2.7042  
  2.7043 -lemma IS_EL_SOME_EL: "ALL x l. x mem l = list_exists (op = x) l"
  2.7044 +lemma IS_EL_SOME_EL: "ALL (x::'a::type) l::'a::type list. x mem l = list_exists (op = x) l"
  2.7045    by (import rich_list IS_EL_SOME_EL)
  2.7046  
  2.7047 -lemma IS_EL_FIRSTN: "ALL x xa. x <= length xa --> (ALL xb. xb mem FIRSTN x xa --> xb mem xa)"
  2.7048 +lemma IS_EL_FIRSTN: "ALL (x::nat) xa::'a::type list.
  2.7049 +   x <= length xa --> (ALL xb::'a::type. xb mem FIRSTN x xa --> xb mem xa)"
  2.7050    by (import rich_list IS_EL_FIRSTN)
  2.7051  
  2.7052 -lemma IS_EL_BUTFIRSTN: "ALL x xa. x <= length xa --> (ALL xb. xb mem BUTFIRSTN x xa --> xb mem xa)"
  2.7053 +lemma IS_EL_BUTFIRSTN: "ALL (x::nat) xa::'a::type list.
  2.7054 +   x <= length xa -->
  2.7055 +   (ALL xb::'a::type. xb mem BUTFIRSTN x xa --> xb mem xa)"
  2.7056    by (import rich_list IS_EL_BUTFIRSTN)
  2.7057  
  2.7058 -lemma IS_EL_BUTLASTN: "ALL x xa. x <= length xa --> (ALL xb. xb mem BUTLASTN x xa --> xb mem xa)"
  2.7059 +lemma IS_EL_BUTLASTN: "ALL (x::nat) xa::'a::type list.
  2.7060 +   x <= length xa --> (ALL xb::'a::type. xb mem BUTLASTN x xa --> xb mem xa)"
  2.7061    by (import rich_list IS_EL_BUTLASTN)
  2.7062  
  2.7063 -lemma IS_EL_LASTN: "ALL x xa. x <= length xa --> (ALL xb. xb mem LASTN x xa --> xb mem xa)"
  2.7064 +lemma IS_EL_LASTN: "ALL (x::nat) xa::'a::type list.
  2.7065 +   x <= length xa --> (ALL xb::'a::type. xb mem LASTN x xa --> xb mem xa)"
  2.7066    by (import rich_list IS_EL_LASTN)
  2.7067  
  2.7068 -lemma ZIP_SNOC: "ALL l1 l2.
  2.7069 +lemma ZIP_SNOC: "ALL (l1::'a::type list) l2::'b::type list.
  2.7070     length l1 = length l2 -->
  2.7071 -   (ALL x1 x2. zip (SNOC x1 l1) (SNOC x2 l2) = SNOC (x1, x2) (zip l1 l2))"
  2.7072 +   (ALL (x1::'a::type) x2::'b::type.
  2.7073 +       zip (SNOC x1 l1) (SNOC x2 l2) = SNOC (x1, x2) (zip l1 l2))"
  2.7074    by (import rich_list ZIP_SNOC)
  2.7075  
  2.7076 -lemma UNZIP_SNOC: "ALL x l.
  2.7077 +lemma UNZIP_SNOC: "ALL (x::'a::type * 'b::type) l::('a::type * 'b::type) list.
  2.7078     unzip (SNOC x l) =
  2.7079     (SNOC (fst x) (fst (unzip l)), SNOC (snd x) (snd (unzip l)))"
  2.7080    by (import rich_list UNZIP_SNOC)
  2.7081  
  2.7082 -lemma LENGTH_UNZIP_FST: "ALL x. length (UNZIP_FST x) = length x"
  2.7083 +lemma LENGTH_UNZIP_FST: "ALL x::('a::type * 'b::type) list. length (UNZIP_FST x) = length x"
  2.7084    by (import rich_list LENGTH_UNZIP_FST)
  2.7085  
  2.7086 -lemma LENGTH_UNZIP_SND: "ALL x. length (UNZIP_SND x) = length x"
  2.7087 +lemma LENGTH_UNZIP_SND: "ALL x::('a::type * 'b::type) list. length (UNZIP_SND x) = length x"
  2.7088    by (import rich_list LENGTH_UNZIP_SND)
  2.7089  
  2.7090 -lemma SUM_APPEND: "ALL l1 l2. sum (l1 @ l2) = sum l1 + sum l2"
  2.7091 +lemma SUM_APPEND: "ALL (l1::nat list) l2::nat list. sum (l1 @ l2) = sum l1 + sum l2"
  2.7092    by (import rich_list SUM_APPEND)
  2.7093  
  2.7094 -lemma SUM_REVERSE: "ALL l. sum (rev l) = sum l"
  2.7095 +lemma SUM_REVERSE: "ALL l::nat list. sum (rev l) = sum l"
  2.7096    by (import rich_list SUM_REVERSE)
  2.7097  
  2.7098 -lemma SUM_FLAT: "ALL l. sum (concat l) = sum (map sum l)"
  2.7099 +lemma SUM_FLAT: "ALL l::nat list list. sum (concat l) = sum (map sum l)"
  2.7100    by (import rich_list SUM_FLAT)
  2.7101  
  2.7102 -lemma EL_APPEND1: "ALL n l1 l2. n < length l1 --> EL n (l1 @ l2) = EL n l1"
  2.7103 +lemma EL_APPEND1: "ALL (n::nat) (l1::'a::type list) l2::'a::type list.
  2.7104 +   n < length l1 --> EL n (l1 @ l2) = EL n l1"
  2.7105    by (import rich_list EL_APPEND1)
  2.7106  
  2.7107 -lemma EL_APPEND2: "ALL l1 n.
  2.7108 -   length l1 <= n --> (ALL l2. EL n (l1 @ l2) = EL (n - length l1) l2)"
  2.7109 +lemma EL_APPEND2: "ALL (l1::'a::type list) n::nat.
  2.7110 +   length l1 <= n -->
  2.7111 +   (ALL l2::'a::type list. EL n (l1 @ l2) = EL (n - length l1) l2)"
  2.7112    by (import rich_list EL_APPEND2)
  2.7113  
  2.7114 -lemma EL_MAP: "ALL n l. n < length l --> (ALL f. EL n (map f l) = f (EL n l))"
  2.7115 +lemma EL_MAP: "ALL (n::nat) l::'a::type list.
  2.7116 +   n < length l -->
  2.7117 +   (ALL f::'a::type => 'b::type. EL n (map f l) = f (EL n l))"
  2.7118    by (import rich_list EL_MAP)
  2.7119  
  2.7120 -lemma EL_CONS: "ALL n>0. ALL x l. EL n (x # l) = EL (PRE n) l"
  2.7121 +lemma EL_CONS: "ALL n>0::nat.
  2.7122 +   ALL (x::'a::type) l::'a::type list. EL n (x # l) = EL (PRE n) l"
  2.7123    by (import rich_list EL_CONS)
  2.7124  
  2.7125 -lemma EL_SEG: "ALL n l. n < length l --> EL n l = hd (SEG 1 n l)"
  2.7126 +lemma EL_SEG: "ALL (n::nat) l::'a::type list.
  2.7127 +   n < length l --> EL n l = hd (SEG (1::nat) n l)"
  2.7128    by (import rich_list EL_SEG)
  2.7129  
  2.7130 -lemma EL_IS_EL: "ALL n l. n < length l --> EL n l mem l"
  2.7131 +lemma EL_IS_EL: "ALL (n::nat) l::'a::type list. n < length l --> EL n l mem l"
  2.7132    by (import rich_list EL_IS_EL)
  2.7133  
  2.7134 -lemma TL_SNOC: "ALL x l. tl (SNOC x l) = (if null l then [] else SNOC x (tl l))"
  2.7135 +lemma TL_SNOC: "ALL (x::'a::type) l::'a::type list.
  2.7136 +   tl (SNOC x l) = (if null l then [] else SNOC x (tl l))"
  2.7137    by (import rich_list TL_SNOC)
  2.7138  
  2.7139 -lemma EL_REVERSE: "ALL n l. n < length l --> EL n (rev l) = EL (PRE (length l - n)) l"
  2.7140 +lemma EL_REVERSE: "ALL (n::nat) l::'a::type list.
  2.7141 +   n < length l --> EL n (rev l) = EL (PRE (length l - n)) l"
  2.7142    by (import rich_list EL_REVERSE)
  2.7143  
  2.7144 -lemma EL_REVERSE_ELL: "ALL n l. n < length l --> EL n (rev l) = ELL n l"
  2.7145 +lemma EL_REVERSE_ELL: "ALL (n::nat) l::'a::type list. n < length l --> EL n (rev l) = ELL n l"
  2.7146    by (import rich_list EL_REVERSE_ELL)
  2.7147  
  2.7148 -lemma ELL_LENGTH_APPEND: "ALL l1 l2. ~ null l1 --> ELL (length l2) (l1 @ l2) = last l1"
  2.7149 +lemma ELL_LENGTH_APPEND: "ALL (l1::'a::type list) l2::'a::type list.
  2.7150 +   ~ null l1 --> ELL (length l2) (l1 @ l2) = last l1"
  2.7151    by (import rich_list ELL_LENGTH_APPEND)
  2.7152  
  2.7153 -lemma ELL_IS_EL: "ALL n l. n < length l --> ELL n l mem l"
  2.7154 +lemma ELL_IS_EL: "ALL (n::nat) l::'a::type list. n < length l --> ELL n l mem l"
  2.7155    by (import rich_list ELL_IS_EL)
  2.7156  
  2.7157 -lemma ELL_REVERSE: "ALL n l. n < length l --> ELL n (rev l) = ELL (PRE (length l - n)) l"
  2.7158 +lemma ELL_REVERSE: "ALL (n::nat) l::'a::type list.
  2.7159 +   n < length l --> ELL n (rev l) = ELL (PRE (length l - n)) l"
  2.7160    by (import rich_list ELL_REVERSE)
  2.7161  
  2.7162 -lemma ELL_REVERSE_EL: "ALL n l. n < length l --> ELL n (rev l) = EL n l"
  2.7163 +lemma ELL_REVERSE_EL: "ALL (n::nat) l::'a::type list. n < length l --> ELL n (rev l) = EL n l"
  2.7164    by (import rich_list ELL_REVERSE_EL)
  2.7165  
  2.7166 -lemma FIRSTN_BUTLASTN: "ALL n l. n <= length l --> FIRSTN n l = BUTLASTN (length l - n) l"
  2.7167 +lemma FIRSTN_BUTLASTN: "ALL (n::nat) l::'a::type list.
  2.7168 +   n <= length l --> FIRSTN n l = BUTLASTN (length l - n) l"
  2.7169    by (import rich_list FIRSTN_BUTLASTN)
  2.7170  
  2.7171 -lemma BUTLASTN_FIRSTN: "ALL n l. n <= length l --> BUTLASTN n l = FIRSTN (length l - n) l"
  2.7172 +lemma BUTLASTN_FIRSTN: "ALL (n::nat) l::'a::type list.
  2.7173 +   n <= length l --> BUTLASTN n l = FIRSTN (length l - n) l"
  2.7174    by (import rich_list BUTLASTN_FIRSTN)
  2.7175  
  2.7176 -lemma LASTN_BUTFIRSTN: "ALL n l. n <= length l --> LASTN n l = BUTFIRSTN (length l - n) l"
  2.7177 +lemma LASTN_BUTFIRSTN: "ALL (n::nat) l::'a::type list.
  2.7178 +   n <= length l --> LASTN n l = BUTFIRSTN (length l - n) l"
  2.7179    by (import rich_list LASTN_BUTFIRSTN)
  2.7180  
  2.7181 -lemma BUTFIRSTN_LASTN: "ALL n l. n <= length l --> BUTFIRSTN n l = LASTN (length l - n) l"
  2.7182 +lemma BUTFIRSTN_LASTN: "ALL (n::nat) l::'a::type list.
  2.7183 +   n <= length l --> BUTFIRSTN n l = LASTN (length l - n) l"
  2.7184    by (import rich_list BUTFIRSTN_LASTN)
  2.7185  
  2.7186 -lemma SEG_LASTN_BUTLASTN: "ALL n m l.
  2.7187 +lemma SEG_LASTN_BUTLASTN: "ALL (n::nat) (m::nat) l::'a::type list.
  2.7188     n + m <= length l -->
  2.7189     SEG n m l = LASTN n (BUTLASTN (length l - (n + m)) l)"
  2.7190    by (import rich_list SEG_LASTN_BUTLASTN)
  2.7191  
  2.7192 -lemma BUTFIRSTN_REVERSE: "ALL n l. n <= length l --> BUTFIRSTN n (rev l) = rev (BUTLASTN n l)"
  2.7193 +lemma BUTFIRSTN_REVERSE: "ALL (n::nat) l::'a::type list.
  2.7194 +   n <= length l --> BUTFIRSTN n (rev l) = rev (BUTLASTN n l)"
  2.7195    by (import rich_list BUTFIRSTN_REVERSE)
  2.7196  
  2.7197 -lemma BUTLASTN_REVERSE: "ALL n l. n <= length l --> BUTLASTN n (rev l) = rev (BUTFIRSTN n l)"
  2.7198 +lemma BUTLASTN_REVERSE: "ALL (n::nat) l::'a::type list.
  2.7199 +   n <= length l --> BUTLASTN n (rev l) = rev (BUTFIRSTN n l)"
  2.7200    by (import rich_list BUTLASTN_REVERSE)
  2.7201  
  2.7202 -lemma LASTN_REVERSE: "ALL n l. n <= length l --> LASTN n (rev l) = rev (FIRSTN n l)"
  2.7203 +lemma LASTN_REVERSE: "ALL (n::nat) l::'a::type list.
  2.7204 +   n <= length l --> LASTN n (rev l) = rev (FIRSTN n l)"
  2.7205    by (import rich_list LASTN_REVERSE)
  2.7206  
  2.7207 -lemma FIRSTN_REVERSE: "ALL n l. n <= length l --> FIRSTN n (rev l) = rev (LASTN n l)"
  2.7208 +lemma FIRSTN_REVERSE: "ALL (n::nat) l::'a::type list.
  2.7209 +   n <= length l --> FIRSTN n (rev l) = rev (LASTN n l)"
  2.7210    by (import rich_list FIRSTN_REVERSE)
  2.7211  
  2.7212 -lemma SEG_REVERSE: "ALL n m l.
  2.7213 +lemma SEG_REVERSE: "ALL (n::nat) (m::nat) l::'a::type list.
  2.7214     n + m <= length l -->
  2.7215     SEG n m (rev l) = rev (SEG n (length l - (n + m)) l)"
  2.7216    by (import rich_list SEG_REVERSE)
  2.7217  
  2.7218 -lemma LENGTH_GENLIST: "ALL f n. length (GENLIST f n) = n"
  2.7219 +lemma LENGTH_GENLIST: "ALL (f::nat => 'a::type) n::nat. length (GENLIST f n) = n"
  2.7220    by (import rich_list LENGTH_GENLIST)
  2.7221  
  2.7222 -lemma LENGTH_REPLICATE: "ALL n x. length (REPLICATE n x) = n"
  2.7223 +lemma LENGTH_REPLICATE: "ALL (n::nat) x::'a::type. length (REPLICATE n x) = n"
  2.7224    by (import rich_list LENGTH_REPLICATE)
  2.7225  
  2.7226 -lemma IS_EL_REPLICATE: "ALL n>0. ALL x. x mem REPLICATE n x"
  2.7227 +lemma IS_EL_REPLICATE: "ALL n>0::nat. ALL x::'a::type. x mem REPLICATE n x"
  2.7228    by (import rich_list IS_EL_REPLICATE)
  2.7229  
  2.7230 -lemma ALL_EL_REPLICATE: "ALL x n. list_all (op = x) (REPLICATE n x)"
  2.7231 +lemma ALL_EL_REPLICATE: "ALL (x::'a::type) n::nat. list_all (op = x) (REPLICATE n x)"
  2.7232    by (import rich_list ALL_EL_REPLICATE)
  2.7233  
  2.7234 -lemma AND_EL_FOLDL: "ALL l. AND_EL l = foldl op & True l"
  2.7235 +lemma AND_EL_FOLDL: "ALL l::bool list. AND_EL l = foldl op & True l"
  2.7236    by (import rich_list AND_EL_FOLDL)
  2.7237  
  2.7238 -lemma AND_EL_FOLDR: "ALL l. AND_EL l = foldr op & l True"
  2.7239 +lemma AND_EL_FOLDR: "ALL l::bool list. AND_EL l = foldr op & l True"
  2.7240    by (import rich_list AND_EL_FOLDR)
  2.7241  
  2.7242 -lemma OR_EL_FOLDL: "ALL l. OR_EL l = foldl op | False l"
  2.7243 +lemma OR_EL_FOLDL: "ALL l::bool list. OR_EL l = foldl op | False l"
  2.7244    by (import rich_list OR_EL_FOLDL)
  2.7245  
  2.7246 -lemma OR_EL_FOLDR: "ALL l. OR_EL l = foldr op | l False"
  2.7247 +lemma OR_EL_FOLDR: "ALL l::bool list. OR_EL l = foldr op | l False"
  2.7248    by (import rich_list OR_EL_FOLDR)
  2.7249  
  2.7250  ;end_setup
  2.7251 @@ -4861,71 +5749,106 @@
  2.7252  ;setup_theory state_transformer
  2.7253  
  2.7254  constdefs
  2.7255 -  UNIT :: "'b => 'a => 'b * 'a" 
  2.7256 -  "(op ==::('b => 'a => 'b * 'a) => ('b => 'a => 'b * 'a) => prop)
  2.7257 - (UNIT::'b => 'a => 'b * 'a) (Pair::'b => 'a => 'b * 'a)"
  2.7258 -
  2.7259 -lemma UNIT_DEF: "ALL x::'b. UNIT x = Pair x"
  2.7260 +  UNIT :: "'b::type => 'a::type => 'b::type * 'a::type" 
  2.7261 +  "(op ==::('b::type => 'a::type => 'b::type * 'a::type)
  2.7262 +        => ('b::type => 'a::type => 'b::type * 'a::type) => prop)
  2.7263 + (UNIT::'b::type => 'a::type => 'b::type * 'a::type)
  2.7264 + (Pair::'b::type => 'a::type => 'b::type * 'a::type)"
  2.7265 +
  2.7266 +lemma UNIT_DEF: "ALL x::'b::type. UNIT x = Pair x"
  2.7267    by (import state_transformer UNIT_DEF)
  2.7268  
  2.7269  constdefs
  2.7270 -  BIND :: "('a => 'b * 'a) => ('b => 'a => 'c * 'a) => 'a => 'c * 'a" 
  2.7271 -  "(op ==::(('a => 'b * 'a) => ('b => 'a => 'c * 'a) => 'a => 'c * 'a)
  2.7272 -        => (('a => 'b * 'a) => ('b => 'a => 'c * 'a) => 'a => 'c * 'a)
  2.7273 +  BIND :: "('a::type => 'b::type * 'a::type)
  2.7274 +=> ('b::type => 'a::type => 'c::type * 'a::type)
  2.7275 +   => 'a::type => 'c::type * 'a::type" 
  2.7276 +  "(op ==::(('a::type => 'b::type * 'a::type)
  2.7277 +         => ('b::type => 'a::type => 'c::type * 'a::type)
  2.7278 +            => 'a::type => 'c::type * 'a::type)
  2.7279 +        => (('a::type => 'b::type * 'a::type)
  2.7280 +            => ('b::type => 'a::type => 'c::type * 'a::type)
  2.7281 +               => 'a::type => 'c::type * 'a::type)
  2.7282             => prop)
  2.7283 - (BIND::('a => 'b * 'a) => ('b => 'a => 'c * 'a) => 'a => 'c * 'a)
  2.7284 - (%(g::'a => 'b * 'a) f::'b => 'a => 'c * 'a.
  2.7285 -     (op o::('b * 'a => 'c * 'a) => ('a => 'b * 'a) => 'a => 'c * 'a)
  2.7286 -      ((split::('b => 'a => 'c * 'a) => 'b * 'a => 'c * 'a) f) g)"
  2.7287 -
  2.7288 -lemma BIND_DEF: "(All::(('a => 'b * 'a) => bool) => bool)
  2.7289 - (%g::'a => 'b * 'a.
  2.7290 -     (All::(('b => 'a => 'c * 'a) => bool) => bool)
  2.7291 -      (%f::'b => 'a => 'c * 'a.
  2.7292 -          (op =::('a => 'c * 'a) => ('a => 'c * 'a) => bool)
  2.7293 -           ((BIND::('a => 'b * 'a)
  2.7294 -                   => ('b => 'a => 'c * 'a) => 'a => 'c * 'a)
  2.7295 + (BIND::('a::type => 'b::type * 'a::type)
  2.7296 +        => ('b::type => 'a::type => 'c::type * 'a::type)
  2.7297 +           => 'a::type => 'c::type * 'a::type)
  2.7298 + (%(g::'a::type => 'b::type * 'a::type)
  2.7299 +     f::'b::type => 'a::type => 'c::type * 'a::type.
  2.7300 +     (op o::('b::type * 'a::type => 'c::type * 'a::type)
  2.7301 +            => ('a::type => 'b::type * 'a::type)
  2.7302 +               => 'a::type => 'c::type * 'a::type)
  2.7303 +      ((split::('b::type => 'a::type => 'c::type * 'a::type)
  2.7304 +               => 'b::type * 'a::type => 'c::type * 'a::type)
  2.7305 +        f)
  2.7306 +      g)"
  2.7307 +
  2.7308 +lemma BIND_DEF: "(All::(('a::type => 'b::type * 'a::type) => bool) => bool)
  2.7309 + (%g::'a::type => 'b::type * 'a::type.
  2.7310 +     (All::(('b::type => 'a::type => 'c::type * 'a::type) => bool) => bool)
  2.7311 +      (%f::'b::type => 'a::type => 'c::type * 'a::type.
  2.7312 +          (op =::('a::type => 'c::type * 'a::type)
  2.7313 +                 => ('a::type => 'c::type * 'a::type) => bool)
  2.7314 +           ((BIND::('a::type => 'b::type * 'a::type)
  2.7315 +                   => ('b::type => 'a::type => 'c::type * 'a::type)
  2.7316 +                      => 'a::type => 'c::type * 'a::type)
  2.7317               g f)
  2.7318 -           ((op o::('b * 'a => 'c * 'a) => ('a => 'b * 'a) => 'a => 'c * 'a)
  2.7319 -             ((split::('b => 'a => 'c * 'a) => 'b * 'a => 'c * 'a) f) g)))"
  2.7320 +           ((op o::('b::type * 'a::type => 'c::type * 'a::type)
  2.7321 +                   => ('a::type => 'b::type * 'a::type)
  2.7322 +                      => 'a::type => 'c::type * 'a::type)
  2.7323 +             ((split::('b::type => 'a::type => 'c::type * 'a::type)
  2.7324 +                      => 'b::type * 'a::type => 'c::type * 'a::type)
  2.7325 +               f)
  2.7326 +             g)))"
  2.7327    by (import state_transformer BIND_DEF)
  2.7328  
  2.7329  constdefs
  2.7330 -  MMAP :: "('c => 'b) => ('a => 'c * 'a) => 'a => 'b * 'a" 
  2.7331 -  "MMAP == %(f::'c => 'b) m::'a => 'c * 'a. BIND m (UNIT o f)"
  2.7332 -
  2.7333 -lemma MMAP_DEF: "ALL (f::'c => 'b) m::'a => 'c * 'a. MMAP f m = BIND m (UNIT o f)"
  2.7334 +  MMAP :: "('c::type => 'b::type)
  2.7335 +=> ('a::type => 'c::type * 'a::type) => 'a::type => 'b::type * 'a::type" 
  2.7336 +  "MMAP ==
  2.7337 +%(f::'c::type => 'b::type) m::'a::type => 'c::type * 'a::type.
  2.7338 +   BIND m (UNIT o f)"
  2.7339 +
  2.7340 +lemma MMAP_DEF: "ALL (f::'c::type => 'b::type) m::'a::type => 'c::type * 'a::type.
  2.7341 +   MMAP f m = BIND m (UNIT o f)"
  2.7342    by (import state_transformer MMAP_DEF)
  2.7343  
  2.7344  constdefs
  2.7345 -  JOIN :: "('a => ('a => 'b * 'a) * 'a) => 'a => 'b * 'a" 
  2.7346 -  "JOIN == %z. BIND z I"
  2.7347 -
  2.7348 -lemma JOIN_DEF: "ALL z. JOIN z = BIND z I"
  2.7349 +  JOIN :: "('a::type => ('a::type => 'b::type * 'a::type) * 'a::type)
  2.7350 +=> 'a::type => 'b::type * 'a::type" 
  2.7351 +  "JOIN ==
  2.7352 +%z::'a::type => ('a::type => 'b::type * 'a::type) * 'a::type. BIND z I"
  2.7353 +
  2.7354 +lemma JOIN_DEF: "ALL z::'a::type => ('a::type => 'b::type * 'a::type) * 'a::type.
  2.7355 +   JOIN z = BIND z I"
  2.7356    by (import state_transformer JOIN_DEF)
  2.7357  
  2.7358 -lemma BIND_LEFT_UNIT: "ALL k x. BIND (UNIT x) k = k x"
  2.7359 +lemma BIND_LEFT_UNIT: "ALL (k::'a::type => 'b::type => 'c::type * 'b::type) x::'a::type.
  2.7360 +   BIND (UNIT x) k = k x"
  2.7361    by (import state_transformer BIND_LEFT_UNIT)
  2.7362  
  2.7363 -lemma UNIT_UNCURRY: "ALL x. split UNIT x = x"
  2.7364 +lemma UNIT_UNCURRY: "ALL x::'a::type * 'b::type. split UNIT x = x"
  2.7365    by (import state_transformer UNIT_UNCURRY)
  2.7366  
  2.7367 -lemma BIND_RIGHT_UNIT: "ALL k. BIND k UNIT = k"
  2.7368 +lemma BIND_RIGHT_UNIT: "ALL k::'a::type => 'b::type * 'a::type. BIND k UNIT = k"
  2.7369    by (import state_transformer BIND_RIGHT_UNIT)
  2.7370  
  2.7371 -lemma BIND_ASSOC: "ALL x xa xb. BIND x (%a. BIND (xa a) xb) = BIND (BIND x xa) xb"
  2.7372 +lemma BIND_ASSOC: "ALL (x::'a::type => 'b::type * 'a::type)
  2.7373 +   (xa::'b::type => 'a::type => 'c::type * 'a::type)
  2.7374 +   xb::'c::type => 'a::type => 'd::type * 'a::type.
  2.7375 +   BIND x (%a::'b::type. BIND (xa a) xb) = BIND (BIND x xa) xb"
  2.7376    by (import state_transformer BIND_ASSOC)
  2.7377  
  2.7378  lemma MMAP_ID: "MMAP I = I"
  2.7379    by (import state_transformer MMAP_ID)
  2.7380  
  2.7381 -lemma MMAP_COMP: "ALL (f::'c => 'd) g::'b => 'c. MMAP (f o g) = MMAP f o MMAP g"
  2.7382 +lemma MMAP_COMP: "ALL (f::'c::type => 'd::type) g::'b::type => 'c::type.
  2.7383 +   MMAP (f o g) = MMAP f o MMAP g"
  2.7384    by (import state_transformer MMAP_COMP)
  2.7385  
  2.7386 -lemma MMAP_UNIT: "ALL f::'b => 'c. MMAP f o UNIT = UNIT o f"
  2.7387 +lemma MMAP_UNIT: "ALL f::'b::type => 'c::type. MMAP f o UNIT = UNIT o f"
  2.7388    by (import state_transformer MMAP_UNIT)
  2.7389  
  2.7390 -lemma MMAP_JOIN: "ALL f::'b => 'c. MMAP f o JOIN = JOIN o MMAP (MMAP f)"
  2.7391 +lemma MMAP_JOIN: "ALL f::'b::type => 'c::type. MMAP f o JOIN = JOIN o MMAP (MMAP f)"
  2.7392    by (import state_transformer MMAP_JOIN)
  2.7393  
  2.7394  lemma JOIN_UNIT: "JOIN o UNIT = I"
  2.7395 @@ -4937,16 +5860,19 @@
  2.7396  lemma JOIN_MAP_JOIN: "JOIN o MMAP JOIN = JOIN o JOIN"
  2.7397    by (import state_transformer JOIN_MAP_JOIN)
  2.7398  
  2.7399 -lemma JOIN_MAP: "ALL x xa. BIND x xa = JOIN (MMAP xa x)"
  2.7400 +lemma JOIN_MAP: "ALL (x::'a::type => 'b::type * 'a::type)
  2.7401 +   xa::'b::type => 'a::type => 'c::type * 'a::type.
  2.7402 +   BIND x xa = JOIN (MMAP xa x)"
  2.7403    by (import state_transformer JOIN_MAP)
  2.7404  
  2.7405 -lemma FST_o_UNIT: "ALL x. fst o UNIT x = K x"
  2.7406 +lemma FST_o_UNIT: "ALL x::'a::type. fst o UNIT x = K x"
  2.7407    by (import state_transformer FST_o_UNIT)
  2.7408  
  2.7409 -lemma SND_o_UNIT: "ALL x. snd o UNIT x = I"
  2.7410 +lemma SND_o_UNIT: "ALL x::'a::type. snd o UNIT x = I"
  2.7411    by (import state_transformer SND_o_UNIT)
  2.7412  
  2.7413 -lemma FST_o_MMAP: "ALL x xa. fst o MMAP x xa = x o (fst o xa)"
  2.7414 +lemma FST_o_MMAP: "ALL (x::'a::type => 'b::type) xa::'c::type => 'a::type * 'c::type.
  2.7415 +   fst o MMAP x xa = x o (fst o xa)"
  2.7416    by (import state_transformer FST_o_MMAP)
  2.7417  
  2.7418  ;end_setup
     3.1 --- a/src/HOL/Import/HOL/HOL4Prob.thy	Mon Sep 26 02:06:44 2005 +0200
     3.2 +++ b/src/HOL/Import/HOL/HOL4Prob.thy	Mon Sep 26 02:27:14 2005 +0200
     3.3 @@ -4,16 +4,22 @@
     3.4  
     3.5  ;setup_theory prob_extra
     3.6  
     3.7 -lemma BOOL_BOOL_CASES_THM: "ALL f. f = (%b. False) | f = (%b. True) | f = (%b. b) | f = Not"
     3.8 +lemma BOOL_BOOL_CASES_THM: "ALL f::bool => bool.
     3.9 +   f = (%b::bool. False) |
    3.10 +   f = (%b::bool. True) | f = (%b::bool. b) | f = Not"
    3.11    by (import prob_extra BOOL_BOOL_CASES_THM)
    3.12  
    3.13 -lemma EVEN_ODD_BASIC: "EVEN 0 & ~ EVEN 1 & EVEN 2 & ~ ODD 0 & ODD 1 & ~ ODD 2"
    3.14 +lemma EVEN_ODD_BASIC: "EVEN (0::nat) &
    3.15 +~ EVEN (1::nat) &
    3.16 +EVEN (2::nat) & ~ ODD (0::nat) & ODD (1::nat) & ~ ODD (2::nat)"
    3.17    by (import prob_extra EVEN_ODD_BASIC)
    3.18  
    3.19 -lemma EVEN_ODD_EXISTS_EQ: "ALL n. EVEN n = (EX m. n = 2 * m) & ODD n = (EX m. n = Suc (2 * m))"
    3.20 +lemma EVEN_ODD_EXISTS_EQ: "ALL n::nat.
    3.21 +   EVEN n = (EX m::nat. n = (2::nat) * m) &
    3.22 +   ODD n = (EX m::nat. n = Suc ((2::nat) * m))"
    3.23    by (import prob_extra EVEN_ODD_EXISTS_EQ)
    3.24  
    3.25 -lemma DIV_THEN_MULT: "ALL p q. Suc q * (p div Suc q) <= p"
    3.26 +lemma DIV_THEN_MULT: "ALL (p::nat) q::nat. Suc q * (p div Suc q) <= p"
    3.27    by (import prob_extra DIV_THEN_MULT)
    3.28  
    3.29  lemma DIV_TWO_UNIQUE: "(All::(nat => bool) => bool)
    3.30 @@ -62,7 +68,8 @@
    3.31  lemma DIV_TWO: "ALL n::nat. n = (2::nat) * (n div (2::nat)) + n mod (2::nat)"
    3.32    by (import prob_extra DIV_TWO)
    3.33  
    3.34 -lemma MOD_TWO: "ALL n. n mod 2 = (if EVEN n then 0 else 1)"
    3.35 +lemma MOD_TWO: "(ALL (n::nat).
    3.36 +    ((n mod (2::nat)) = (if (EVEN n) then (0::nat) else (1::nat))))"
    3.37    by (import prob_extra MOD_TWO)
    3.38  
    3.39  lemma DIV_TWO_BASIC: "(0::nat) div (2::nat) = (0::nat) &
    3.40 @@ -112,13 +119,14 @@
    3.41               ((op <::nat => nat => bool) m n))))"
    3.42    by (import prob_extra DIV_TWO_MONO_EVEN)
    3.43  
    3.44 -lemma DIV_TWO_CANCEL: "ALL n. 2 * n div 2 = n & Suc (2 * n) div 2 = n"
    3.45 +lemma DIV_TWO_CANCEL: "ALL n::nat.
    3.46 +   (2::nat) * n div (2::nat) = n & Suc ((2::nat) * n) div (2::nat) = n"
    3.47    by (import prob_extra DIV_TWO_CANCEL)
    3.48  
    3.49  lemma EXP_DIV_TWO: "ALL n::nat. (2::nat) ^ Suc n div (2::nat) = (2::nat) ^ n"
    3.50    by (import prob_extra EXP_DIV_TWO)
    3.51  
    3.52 -lemma EVEN_EXP_TWO: "ALL n. EVEN (2 ^ n) = (n ~= 0)"
    3.53 +lemma EVEN_EXP_TWO: "ALL n::nat. EVEN ((2::nat) ^ n) = (n ~= (0::nat))"
    3.54    by (import prob_extra EVEN_EXP_TWO)
    3.55  
    3.56  lemma DIV_TWO_EXP: "ALL (n::nat) k::nat.
    3.57 @@ -129,12 +137,12 @@
    3.58    inf :: "(real => bool) => real" 
    3.59  
    3.60  defs
    3.61 -  inf_primdef: "inf == %P. - sup (IMAGE uminus P)"
    3.62 -
    3.63 -lemma inf_def: "ALL P. inf P = - sup (IMAGE uminus P)"
    3.64 +  inf_primdef: "inf == %P::real => bool. - sup (IMAGE uminus P)"
    3.65 +
    3.66 +lemma inf_def: "ALL P::real => bool. inf P = - sup (IMAGE uminus P)"
    3.67    by (import prob_extra inf_def)
    3.68  
    3.69 -lemma INF_DEF_ALT: "ALL P. inf P = - sup (%r. P (- r))"
    3.70 +lemma INF_DEF_ALT: "ALL P::real => bool. inf P = - sup (%r::real. P (- r))"
    3.71    by (import prob_extra INF_DEF_ALT)
    3.72  
    3.73  lemma REAL_SUP_EXISTS_UNIQUE: "(All::((real => bool) => bool) => bool)
    3.74 @@ -275,13 +283,15 @@
    3.75  lemma POW_HALF_EXP: "ALL n::nat. ((1::real) / (2::real)) ^ n = inverse (real ((2::nat) ^ n))"
    3.76    by (import prob_extra POW_HALF_EXP)
    3.77  
    3.78 -lemma INV_SUC_POS: "ALL n. 0 < 1 / real (Suc n)"
    3.79 +lemma INV_SUC_POS: "ALL n::nat. (0::real) < (1::real) / real (Suc n)"
    3.80    by (import prob_extra INV_SUC_POS)
    3.81  
    3.82 -lemma INV_SUC_MAX: "ALL x. 1 / real (Suc x) <= 1"
    3.83 +lemma INV_SUC_MAX: "ALL x::nat. (1::real) / real (Suc x) <= (1::real)"
    3.84    by (import prob_extra INV_SUC_MAX)
    3.85  
    3.86 -lemma INV_SUC: "ALL n. 0 < 1 / real (Suc n) & 1 / real (Suc n) <= 1"
    3.87 +lemma INV_SUC: "ALL n::nat.
    3.88 +   (0::real) < (1::real) / real (Suc n) &
    3.89 +   (1::real) / real (Suc n) <= (1::real)"
    3.90    by (import prob_extra INV_SUC)
    3.91  
    3.92  lemma ABS_UNIT_INTERVAL: "(All::(real => bool) => bool)
    3.93 @@ -301,181 +311,200 @@
    3.94               (1::real))))"
    3.95    by (import prob_extra ABS_UNIT_INTERVAL)
    3.96  
    3.97 -lemma MEM_NIL: "ALL l. (ALL x. ~ x mem l) = (l = [])"
    3.98 +lemma MEM_NIL: "ALL l::'a::type list. (ALL x::'a::type. ~ x mem l) = (l = [])"
    3.99    by (import prob_extra MEM_NIL)
   3.100  
   3.101 -lemma MAP_MEM: "ALL f l x. x mem map f l = (EX y. y mem l & x = f y)"
   3.102 +lemma MAP_MEM: "ALL (f::'a::type => 'b::type) (l::'a::type list) x::'b::type.
   3.103 +   x mem map f l = (EX y::'a::type. y mem l & x = f y)"
   3.104    by (import prob_extra MAP_MEM)
   3.105  
   3.106 -lemma MEM_NIL_MAP_CONS: "ALL x l. ~ [] mem map (op # x) l"
   3.107 +lemma MEM_NIL_MAP_CONS: "ALL (x::'a::type) l::'a::type list list. ~ [] mem map (op # x) l"
   3.108    by (import prob_extra MEM_NIL_MAP_CONS)
   3.109  
   3.110 -lemma FILTER_TRUE: "ALL l. [x:l. True] = l"
   3.111 +lemma FILTER_TRUE: "ALL l::'a::type list. [x::'a::type:l. True] = l"
   3.112    by (import prob_extra FILTER_TRUE)
   3.113  
   3.114 -lemma FILTER_FALSE: "ALL l. [x:l. False] = []"
   3.115 +lemma FILTER_FALSE: "ALL l::'a::type list. [x::'a::type:l. False] = []"
   3.116    by (import prob_extra FILTER_FALSE)
   3.117  
   3.118 -lemma FILTER_MEM: "(All::(('a => bool) => bool) => bool)
   3.119 - (%P::'a => bool.
   3.120 -     (All::('a => bool) => bool)
   3.121 -      (%x::'a.
   3.122 -          (All::('a list => bool) => bool)
   3.123 -           (%l::'a list.
   3.124 +lemma FILTER_MEM: "(All::(('a::type => bool) => bool) => bool)
   3.125 + (%P::'a::type => bool.
   3.126 +     (All::('a::type => bool) => bool)
   3.127 +      (%x::'a::type.
   3.128 +          (All::('a::type list => bool) => bool)
   3.129 +           (%l::'a::type list.
   3.130                 (op -->::bool => bool => bool)
   3.131 -                ((op mem::'a => 'a list => bool) x
   3.132 -                  ((filter::('a => bool) => 'a list => 'a list) P l))
   3.133 +                ((op mem::'a::type => 'a::type list => bool) x
   3.134 +                  ((filter::('a::type => bool)
   3.135 +                            => 'a::type list => 'a::type list)
   3.136 +                    P l))
   3.137                  (P x))))"
   3.138    by (import prob_extra FILTER_MEM)
   3.139  
   3.140 -lemma MEM_FILTER: "(All::(('a => bool) => bool) => bool)
   3.141 - (%P::'a => bool.
   3.142 -     (All::('a list => bool) => bool)
   3.143 -      (%l::'a list.
   3.144 -          (All::('a => bool) => bool)
   3.145 -           (%x::'a.
   3.146 +lemma MEM_FILTER: "(All::(('a::type => bool) => bool) => bool)
   3.147 + (%P::'a::type => bool.
   3.148 +     (All::('a::type list => bool) => bool)
   3.149 +      (%l::'a::type list.
   3.150 +          (All::('a::type => bool) => bool)
   3.151 +           (%x::'a::type.
   3.152                 (op -->::bool => bool => bool)
   3.153 -                ((op mem::'a => 'a list => bool) x
   3.154 -                  ((filter::('a => bool) => 'a list => 'a list) P l))
   3.155 -                ((op mem::'a => 'a list => bool) x l))))"
   3.156 +                ((op mem::'a::type => 'a::type list => bool) x
   3.157 +                  ((filter::('a::type => bool)
   3.158 +                            => 'a::type list => 'a::type list)
   3.159 +                    P l))
   3.160 +                ((op mem::'a::type => 'a::type list => bool) x l))))"
   3.161    by (import prob_extra MEM_FILTER)
   3.162  
   3.163 -lemma FILTER_OUT_ELT: "ALL x l. x mem l | [y:l. y ~= x] = l"
   3.164 +lemma FILTER_OUT_ELT: "ALL (x::'a::type) l::'a::type list. x mem l | [y::'a::type:l. y ~= x] = l"
   3.165    by (import prob_extra FILTER_OUT_ELT)
   3.166  
   3.167 -lemma IS_PREFIX_NIL: "ALL x. IS_PREFIX x [] & IS_PREFIX [] x = (x = [])"
   3.168 +lemma IS_PREFIX_NIL: "ALL x::'a::type list. IS_PREFIX x [] & IS_PREFIX [] x = (x = [])"
   3.169    by (import prob_extra IS_PREFIX_NIL)
   3.170  
   3.171 -lemma IS_PREFIX_REFL: "ALL x. IS_PREFIX x x"
   3.172 +lemma IS_PREFIX_REFL: "ALL x::'a::type list. IS_PREFIX x x"
   3.173    by (import prob_extra IS_PREFIX_REFL)
   3.174  
   3.175 -lemma IS_PREFIX_ANTISYM: "(All::('a list => bool) => bool)
   3.176 - (%x::'a list.
   3.177 -     (All::('a list => bool) => bool)
   3.178 -      (%y::'a list.
   3.179 +lemma IS_PREFIX_ANTISYM: "(All::('a::type list => bool) => bool)
   3.180 + (%x::'a::type list.
   3.181 +     (All::('a::type list => bool) => bool)
   3.182 +      (%y::'a::type list.
   3.183            (op -->::bool => bool => bool)
   3.184             ((op &::bool => bool => bool)
   3.185 -             ((IS_PREFIX::'a list => 'a list => bool) y x)
   3.186 -             ((IS_PREFIX::'a list => 'a list => bool) x y))
   3.187 -           ((op =::'a list => 'a list => bool) x y)))"
   3.188 +             ((IS_PREFIX::'a::type list => 'a::type list => bool) y x)
   3.189 +             ((IS_PREFIX::'a::type list => 'a::type list => bool) x y))
   3.190 +           ((op =::'a::type list => 'a::type list => bool) x y)))"
   3.191    by (import prob_extra IS_PREFIX_ANTISYM)
   3.192  
   3.193 -lemma IS_PREFIX_TRANS: "(All::('a list => bool) => bool)
   3.194 - (%x::'a list.
   3.195 -     (All::('a list => bool) => bool)
   3.196 -      (%y::'a list.
   3.197 -          (All::('a list => bool) => bool)
   3.198 -           (%z::'a list.
   3.199 +lemma IS_PREFIX_TRANS: "(All::('a::type list => bool) => bool)
   3.200 + (%x::'a::type list.
   3.201 +     (All::('a::type list => bool) => bool)
   3.202 +      (%y::'a::type list.
   3.203 +          (All::('a::type list => bool) => bool)
   3.204 +           (%z::'a::type list.
   3.205                 (op -->::bool => bool => bool)
   3.206                  ((op &::bool => bool => bool)
   3.207 -                  ((IS_PREFIX::'a list => 'a list => bool) x y)
   3.208 -                  ((IS_PREFIX::'a list => 'a list => bool) y z))
   3.209 -                ((IS_PREFIX::'a list => 'a list => bool) x z))))"
   3.210 +                  ((IS_PREFIX::'a::type list => 'a::type list => bool) x y)
   3.211 +                  ((IS_PREFIX::'a::type list => 'a::type list => bool) y z))
   3.212 +                ((IS_PREFIX::'a::type list => 'a::type list => bool) x z))))"
   3.213    by (import prob_extra IS_PREFIX_TRANS)
   3.214  
   3.215 -lemma IS_PREFIX_BUTLAST: "ALL x y. IS_PREFIX (x # y) (butlast (x # y))"
   3.216 +lemma IS_PREFIX_BUTLAST: "ALL (x::'a::type) y::'a::type list. IS_PREFIX (x # y) (butlast (x # y))"
   3.217    by (import prob_extra IS_PREFIX_BUTLAST)
   3.218  
   3.219 -lemma IS_PREFIX_LENGTH: "(All::('a list => bool) => bool)
   3.220 - (%x::'a list.
   3.221 -     (All::('a list => bool) => bool)
   3.222 -      (%y::'