src/ZF/Ordinal.thy
 author paulson Mon Jun 24 11:58:21 2002 +0200 (2002-06-24) changeset 13243 ba53d07d32d5 parent 13203 fac77a839aa2 child 13269 3ba9be497c33 permissions -rw-r--r--
new lemmas
```     1 (*  Title:      ZF/Ordinal.thy
```
```     2     ID:         \$Id\$
```
```     3     Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
```
```     4     Copyright   1994  University of Cambridge
```
```     5
```
```     6 Ordinals in Zermelo-Fraenkel Set Theory
```
```     7 *)
```
```     8
```
```     9 theory Ordinal = WF + Bool + equalities:
```
```    10
```
```    11 constdefs
```
```    12
```
```    13   Memrel        :: "i=>i"
```
```    14     "Memrel(A)   == {z: A*A . EX x y. z=<x,y> & x:y }"
```
```    15
```
```    16   Transset  :: "i=>o"
```
```    17     "Transset(i) == ALL x:i. x<=i"
```
```    18
```
```    19   Ord  :: "i=>o"
```
```    20     "Ord(i)      == Transset(i) & (ALL x:i. Transset(x))"
```
```    21
```
```    22   lt        :: "[i,i] => o"  (infixl "<" 50)   (*less-than on ordinals*)
```
```    23     "i<j         == i:j & Ord(j)"
```
```    24
```
```    25   Limit         :: "i=>o"
```
```    26     "Limit(i)    == Ord(i) & 0<i & (ALL y. y<i --> succ(y)<i)"
```
```    27
```
```    28 syntax
```
```    29   "le"          :: "[i,i] => o"  (infixl 50)   (*less-than or equals*)
```
```    30
```
```    31 translations
```
```    32   "x le y"      == "x < succ(y)"
```
```    33
```
```    34 syntax (xsymbols)
```
```    35   "op le"       :: "[i,i] => o"  (infixl "\<le>" 50)  (*less-than or equals*)
```
```    36
```
```    37
```
```    38 (*** Rules for Transset ***)
```
```    39
```
```    40 (** Three neat characterisations of Transset **)
```
```    41
```
```    42 lemma Transset_iff_Pow: "Transset(A) <-> A<=Pow(A)"
```
```    43 by (unfold Transset_def, blast)
```
```    44
```
```    45 lemma Transset_iff_Union_succ: "Transset(A) <-> Union(succ(A)) = A"
```
```    46 apply (unfold Transset_def)
```
```    47 apply (blast elim!: equalityE)
```
```    48 done
```
```    49
```
```    50 lemma Transset_iff_Union_subset: "Transset(A) <-> Union(A) <= A"
```
```    51 by (unfold Transset_def, blast)
```
```    52
```
```    53 (** Consequences of downwards closure **)
```
```    54
```
```    55 lemma Transset_doubleton_D:
```
```    56     "[| Transset(C); {a,b}: C |] ==> a:C & b: C"
```
```    57 by (unfold Transset_def, blast)
```
```    58
```
```    59 lemma Transset_Pair_D:
```
```    60     "[| Transset(C); <a,b>: C |] ==> a:C & b: C"
```
```    61 apply (simp add: Pair_def)
```
```    62 apply (blast dest: Transset_doubleton_D)
```
```    63 done
```
```    64
```
```    65 lemma Transset_includes_domain:
```
```    66     "[| Transset(C); A*B <= C; b: B |] ==> A <= C"
```
```    67 by (blast dest: Transset_Pair_D)
```
```    68
```
```    69 lemma Transset_includes_range:
```
```    70     "[| Transset(C); A*B <= C; a: A |] ==> B <= C"
```
```    71 by (blast dest: Transset_Pair_D)
```
```    72
```
```    73 (** Closure properties **)
```
```    74
```
```    75 lemma Transset_0: "Transset(0)"
```
```    76 by (unfold Transset_def, blast)
```
```    77
```
```    78 lemma Transset_Un:
```
```    79     "[| Transset(i);  Transset(j) |] ==> Transset(i Un j)"
```
```    80 by (unfold Transset_def, blast)
```
```    81
```
```    82 lemma Transset_Int:
```
```    83     "[| Transset(i);  Transset(j) |] ==> Transset(i Int j)"
```
```    84 by (unfold Transset_def, blast)
```
```    85
```
```    86 lemma Transset_succ: "Transset(i) ==> Transset(succ(i))"
```
```    87 by (unfold Transset_def, blast)
```
```    88
```
```    89 lemma Transset_Pow: "Transset(i) ==> Transset(Pow(i))"
```
```    90 by (unfold Transset_def, blast)
```
```    91
```
```    92 lemma Transset_Union: "Transset(A) ==> Transset(Union(A))"
```
```    93 by (unfold Transset_def, blast)
```
```    94
```
```    95 lemma Transset_Union_family:
```
```    96     "[| !!i. i:A ==> Transset(i) |] ==> Transset(Union(A))"
```
```    97 by (unfold Transset_def, blast)
```
```    98
```
```    99 lemma Transset_Inter_family:
```
```   100     "[| !!i. i:A ==> Transset(i) |] ==> Transset(Inter(A))"
```
```   101 by (unfold Inter_def Transset_def, blast)
```
```   102
```
```   103 lemma Transset_UN:
```
```   104      "(!!x. x \<in> A ==> Transset(B(x))) ==> Transset (UN x:A. B(x))"
```
```   105 by (rule Transset_Union_family, auto)
```
```   106
```
```   107 lemma Transset_INT:
```
```   108      "(!!x. x \<in> A ==> Transset(B(x))) ==> Transset (INT x:A. B(x))"
```
```   109 by (rule Transset_Inter_family, auto)
```
```   110
```
```   111
```
```   112 (*** Natural Deduction rules for Ord ***)
```
```   113
```
```   114 lemma OrdI:
```
```   115     "[| Transset(i);  !!x. x:i ==> Transset(x) |]  ==>  Ord(i)"
```
```   116 by (simp add: Ord_def)
```
```   117
```
```   118 lemma Ord_is_Transset: "Ord(i) ==> Transset(i)"
```
```   119 by (simp add: Ord_def)
```
```   120
```
```   121 lemma Ord_contains_Transset:
```
```   122     "[| Ord(i);  j:i |] ==> Transset(j) "
```
```   123 by (unfold Ord_def, blast)
```
```   124
```
```   125 (*** Lemmas for ordinals ***)
```
```   126
```
```   127 lemma Ord_in_Ord: "[| Ord(i);  j:i |] ==> Ord(j)"
```
```   128 by (unfold Ord_def Transset_def, blast)
```
```   129
```
```   130 (*suitable for rewriting PROVIDED i has been fixed*)
```
```   131 lemma Ord_in_Ord': "[| j:i; Ord(i) |] ==> Ord(j)"
```
```   132 by (blast intro: Ord_in_Ord)
```
```   133
```
```   134 (* Ord(succ(j)) ==> Ord(j) *)
```
```   135 lemmas Ord_succD = Ord_in_Ord [OF _ succI1]
```
```   136
```
```   137 lemma Ord_subset_Ord: "[| Ord(i);  Transset(j);  j<=i |] ==> Ord(j)"
```
```   138 by (simp add: Ord_def Transset_def, blast)
```
```   139
```
```   140 lemma OrdmemD: "[| j:i;  Ord(i) |] ==> j<=i"
```
```   141 by (unfold Ord_def Transset_def, blast)
```
```   142
```
```   143 lemma Ord_trans: "[| i:j;  j:k;  Ord(k) |] ==> i:k"
```
```   144 by (blast dest: OrdmemD)
```
```   145
```
```   146 lemma Ord_succ_subsetI: "[| i:j;  Ord(j) |] ==> succ(i) <= j"
```
```   147 by (blast dest: OrdmemD)
```
```   148
```
```   149
```
```   150 (*** The construction of ordinals: 0, succ, Union ***)
```
```   151
```
```   152 lemma Ord_0 [iff,TC]: "Ord(0)"
```
```   153 by (blast intro: OrdI Transset_0)
```
```   154
```
```   155 lemma Ord_succ [TC]: "Ord(i) ==> Ord(succ(i))"
```
```   156 by (blast intro: OrdI Transset_succ Ord_is_Transset Ord_contains_Transset)
```
```   157
```
```   158 lemmas Ord_1 = Ord_0 [THEN Ord_succ]
```
```   159
```
```   160 lemma Ord_succ_iff [iff]: "Ord(succ(i)) <-> Ord(i)"
```
```   161 by (blast intro: Ord_succ dest!: Ord_succD)
```
```   162
```
```   163 lemma Ord_Un [intro,simp,TC]: "[| Ord(i); Ord(j) |] ==> Ord(i Un j)"
```
```   164 apply (unfold Ord_def)
```
```   165 apply (blast intro!: Transset_Un)
```
```   166 done
```
```   167
```
```   168 lemma Ord_Int [TC]: "[| Ord(i); Ord(j) |] ==> Ord(i Int j)"
```
```   169 apply (unfold Ord_def)
```
```   170 apply (blast intro!: Transset_Int)
```
```   171 done
```
```   172
```
```   173 (*There is no set of all ordinals, for then it would contain itself*)
```
```   174 lemma ON_class: "~ (ALL i. i:X <-> Ord(i))"
```
```   175 apply (rule notI)
```
```   176 apply (frule_tac x = "X" in spec)
```
```   177 apply (safe elim!: mem_irrefl)
```
```   178 apply (erule swap, rule OrdI [OF _ Ord_is_Transset])
```
```   179 apply (simp add: Transset_def)
```
```   180 apply (blast intro: Ord_in_Ord)+
```
```   181 done
```
```   182
```
```   183 (*** < is 'less than' for ordinals ***)
```
```   184
```
```   185 lemma ltI: "[| i:j;  Ord(j) |] ==> i<j"
```
```   186 by (unfold lt_def, blast)
```
```   187
```
```   188 lemma ltE:
```
```   189     "[| i<j;  [| i:j;  Ord(i);  Ord(j) |] ==> P |] ==> P"
```
```   190 apply (unfold lt_def)
```
```   191 apply (blast intro: Ord_in_Ord)
```
```   192 done
```
```   193
```
```   194 lemma ltD: "i<j ==> i:j"
```
```   195 by (erule ltE, assumption)
```
```   196
```
```   197 lemma not_lt0 [simp]: "~ i<0"
```
```   198 by (unfold lt_def, blast)
```
```   199
```
```   200 lemma lt_Ord: "j<i ==> Ord(j)"
```
```   201 by (erule ltE, assumption)
```
```   202
```
```   203 lemma lt_Ord2: "j<i ==> Ord(i)"
```
```   204 by (erule ltE, assumption)
```
```   205
```
```   206 (* "ja le j ==> Ord(j)" *)
```
```   207 lemmas le_Ord2 = lt_Ord2 [THEN Ord_succD]
```
```   208
```
```   209 (* i<0 ==> R *)
```
```   210 lemmas lt0E = not_lt0 [THEN notE, elim!]
```
```   211
```
```   212 lemma lt_trans: "[| i<j;  j<k |] ==> i<k"
```
```   213 by (blast intro!: ltI elim!: ltE intro: Ord_trans)
```
```   214
```
```   215 lemma lt_not_sym: "i<j ==> ~ (j<i)"
```
```   216 apply (unfold lt_def)
```
```   217 apply (blast elim: mem_asym)
```
```   218 done
```
```   219
```
```   220 (* [| i<j;  ~P ==> j<i |] ==> P *)
```
```   221 lemmas lt_asym = lt_not_sym [THEN swap]
```
```   222
```
```   223 lemma lt_irrefl [elim!]: "i<i ==> P"
```
```   224 by (blast intro: lt_asym)
```
```   225
```
```   226 lemma lt_not_refl: "~ i<i"
```
```   227 apply (rule notI)
```
```   228 apply (erule lt_irrefl)
```
```   229 done
```
```   230
```
```   231
```
```   232 (** le is less than or equals;  recall  i le j  abbrevs  i<succ(j) !! **)
```
```   233
```
```   234 lemma le_iff: "i le j <-> i<j | (i=j & Ord(j))"
```
```   235 by (unfold lt_def, blast)
```
```   236
```
```   237 (*Equivalently, i<j ==> i < succ(j)*)
```
```   238 lemma leI: "i<j ==> i le j"
```
```   239 by (simp (no_asm_simp) add: le_iff)
```
```   240
```
```   241 lemma le_eqI: "[| i=j;  Ord(j) |] ==> i le j"
```
```   242 by (simp (no_asm_simp) add: le_iff)
```
```   243
```
```   244 lemmas le_refl = refl [THEN le_eqI]
```
```   245
```
```   246 lemma le_refl_iff [iff]: "i le i <-> Ord(i)"
```
```   247 by (simp (no_asm_simp) add: lt_not_refl le_iff)
```
```   248
```
```   249 lemma leCI: "(~ (i=j & Ord(j)) ==> i<j) ==> i le j"
```
```   250 by (simp add: le_iff, blast)
```
```   251
```
```   252 lemma leE:
```
```   253     "[| i le j;  i<j ==> P;  [| i=j;  Ord(j) |] ==> P |] ==> P"
```
```   254 by (simp add: le_iff, blast)
```
```   255
```
```   256 lemma le_anti_sym: "[| i le j;  j le i |] ==> i=j"
```
```   257 apply (simp add: le_iff)
```
```   258 apply (blast elim: lt_asym)
```
```   259 done
```
```   260
```
```   261 lemma le0_iff [simp]: "i le 0 <-> i=0"
```
```   262 by (blast elim!: leE)
```
```   263
```
```   264 lemmas le0D = le0_iff [THEN iffD1, dest!]
```
```   265
```
```   266 (*** Natural Deduction rules for Memrel ***)
```
```   267
```
```   268 (*The lemmas MemrelI/E give better speed than [iff] here*)
```
```   269 lemma Memrel_iff [simp]: "<a,b> : Memrel(A) <-> a:b & a:A & b:A"
```
```   270 by (unfold Memrel_def, blast)
```
```   271
```
```   272 lemma MemrelI [intro!]: "[| a: b;  a: A;  b: A |] ==> <a,b> : Memrel(A)"
```
```   273 by auto
```
```   274
```
```   275 lemma MemrelE [elim!]:
```
```   276     "[| <a,b> : Memrel(A);
```
```   277         [| a: A;  b: A;  a:b |]  ==> P |]
```
```   278      ==> P"
```
```   279 by auto
```
```   280
```
```   281 lemma Memrel_type: "Memrel(A) <= A*A"
```
```   282 by (unfold Memrel_def, blast)
```
```   283
```
```   284 lemma Memrel_mono: "A<=B ==> Memrel(A) <= Memrel(B)"
```
```   285 by (unfold Memrel_def, blast)
```
```   286
```
```   287 lemma Memrel_0 [simp]: "Memrel(0) = 0"
```
```   288 by (unfold Memrel_def, blast)
```
```   289
```
```   290 lemma Memrel_1 [simp]: "Memrel(1) = 0"
```
```   291 by (unfold Memrel_def, blast)
```
```   292
```
```   293 (*The membership relation (as a set) is well-founded.
```
```   294   Proof idea: show A<=B by applying the foundation axiom to A-B *)
```
```   295 lemma wf_Memrel: "wf(Memrel(A))"
```
```   296 apply (unfold wf_def)
```
```   297 apply (rule foundation [THEN disjE, THEN allI], erule disjI1, blast)
```
```   298 done
```
```   299
```
```   300 (*Transset(i) does not suffice, though ALL j:i.Transset(j) does*)
```
```   301 lemma trans_Memrel:
```
```   302     "Ord(i) ==> trans(Memrel(i))"
```
```   303 by (unfold Ord_def Transset_def trans_def, blast)
```
```   304
```
```   305 (*If Transset(A) then Memrel(A) internalizes the membership relation below A*)
```
```   306 lemma Transset_Memrel_iff:
```
```   307     "Transset(A) ==> <a,b> : Memrel(A) <-> a:b & b:A"
```
```   308 by (unfold Transset_def, blast)
```
```   309
```
```   310
```
```   311 (*** Transfinite induction ***)
```
```   312
```
```   313 (*Epsilon induction over a transitive set*)
```
```   314 lemma Transset_induct:
```
```   315     "[| i: k;  Transset(k);
```
```   316         !!x.[| x: k;  ALL y:x. P(y) |] ==> P(x) |]
```
```   317      ==>  P(i)"
```
```   318 apply (simp add: Transset_def)
```
```   319 apply (erule wf_Memrel [THEN wf_induct2], blast)
```
```   320 apply blast
```
```   321 done
```
```   322
```
```   323 (*Induction over an ordinal*)
```
```   324 lemmas Ord_induct = Transset_induct [OF _ Ord_is_Transset]
```
```   325
```
```   326 (*Induction over the class of ordinals -- a useful corollary of Ord_induct*)
```
```   327
```
```   328 lemma trans_induct:
```
```   329     "[| Ord(i);
```
```   330         !!x.[| Ord(x);  ALL y:x. P(y) |] ==> P(x) |]
```
```   331      ==>  P(i)"
```
```   332 apply (rule Ord_succ [THEN succI1 [THEN Ord_induct]], assumption)
```
```   333 apply (blast intro: Ord_succ [THEN Ord_in_Ord])
```
```   334 done
```
```   335
```
```   336
```
```   337 (*** Fundamental properties of the epsilon ordering (< on ordinals) ***)
```
```   338
```
```   339
```
```   340 (** Proving that < is a linear ordering on the ordinals **)
```
```   341
```
```   342 lemma Ord_linear [rule_format]:
```
```   343      "Ord(i) ==> (ALL j. Ord(j) --> i:j | i=j | j:i)"
```
```   344 apply (erule trans_induct)
```
```   345 apply (rule impI [THEN allI])
```
```   346 apply (erule_tac i=j in trans_induct)
```
```   347 apply (blast dest: Ord_trans)
```
```   348 done
```
```   349
```
```   350 (*The trichotomy law for ordinals!*)
```
```   351 lemma Ord_linear_lt:
```
```   352     "[| Ord(i);  Ord(j);  i<j ==> P;  i=j ==> P;  j<i ==> P |] ==> P"
```
```   353 apply (simp add: lt_def)
```
```   354 apply (rule_tac i1=i and j1=j in Ord_linear [THEN disjE], blast+)
```
```   355 done
```
```   356
```
```   357 lemma Ord_linear2:
```
```   358     "[| Ord(i);  Ord(j);  i<j ==> P;  j le i ==> P |]  ==> P"
```
```   359 apply (rule_tac i = "i" and j = "j" in Ord_linear_lt)
```
```   360 apply (blast intro: leI le_eqI sym ) +
```
```   361 done
```
```   362
```
```   363 lemma Ord_linear_le:
```
```   364     "[| Ord(i);  Ord(j);  i le j ==> P;  j le i ==> P |]  ==> P"
```
```   365 apply (rule_tac i = "i" and j = "j" in Ord_linear_lt)
```
```   366 apply (blast intro: leI le_eqI ) +
```
```   367 done
```
```   368
```
```   369 lemma le_imp_not_lt: "j le i ==> ~ i<j"
```
```   370 by (blast elim!: leE elim: lt_asym)
```
```   371
```
```   372 lemma not_lt_imp_le: "[| ~ i<j;  Ord(i);  Ord(j) |] ==> j le i"
```
```   373 by (rule_tac i = "i" and j = "j" in Ord_linear2, auto)
```
```   374
```
```   375 (** Some rewrite rules for <, le **)
```
```   376
```
```   377 lemma Ord_mem_iff_lt: "Ord(j) ==> i:j <-> i<j"
```
```   378 by (unfold lt_def, blast)
```
```   379
```
```   380 lemma not_lt_iff_le: "[| Ord(i);  Ord(j) |] ==> ~ i<j <-> j le i"
```
```   381 by (blast dest: le_imp_not_lt not_lt_imp_le)
```
```   382
```
```   383 lemma not_le_iff_lt: "[| Ord(i);  Ord(j) |] ==> ~ i le j <-> j<i"
```
```   384 by (simp (no_asm_simp) add: not_lt_iff_le [THEN iff_sym])
```
```   385
```
```   386 (*This is identical to 0<succ(i) *)
```
```   387 lemma Ord_0_le: "Ord(i) ==> 0 le i"
```
```   388 by (erule not_lt_iff_le [THEN iffD1], auto)
```
```   389
```
```   390 lemma Ord_0_lt: "[| Ord(i);  i~=0 |] ==> 0<i"
```
```   391 apply (erule not_le_iff_lt [THEN iffD1])
```
```   392 apply (rule Ord_0, blast)
```
```   393 done
```
```   394
```
```   395 lemma Ord_0_lt_iff: "Ord(i) ==> i~=0 <-> 0<i"
```
```   396 by (blast intro: Ord_0_lt)
```
```   397
```
```   398
```
```   399 (*** Results about less-than or equals ***)
```
```   400
```
```   401 (** For ordinals, j<=i (subset) implies j le i (less-than or equals) **)
```
```   402
```
```   403 lemma zero_le_succ_iff [iff]: "0 le succ(x) <-> Ord(x)"
```
```   404 by (blast intro: Ord_0_le elim: ltE)
```
```   405
```
```   406 lemma subset_imp_le: "[| j<=i;  Ord(i);  Ord(j) |] ==> j le i"
```
```   407 apply (rule not_lt_iff_le [THEN iffD1], assumption)
```
```   408 apply assumption
```
```   409 apply (blast elim: ltE mem_irrefl)
```
```   410 done
```
```   411
```
```   412 lemma le_imp_subset: "i le j ==> i<=j"
```
```   413 by (blast dest: OrdmemD elim: ltE leE)
```
```   414
```
```   415 lemma le_subset_iff: "j le i <-> j<=i & Ord(i) & Ord(j)"
```
```   416 by (blast dest: subset_imp_le le_imp_subset elim: ltE)
```
```   417
```
```   418 lemma le_succ_iff: "i le succ(j) <-> i le j | i=succ(j) & Ord(i)"
```
```   419 apply (simp (no_asm) add: le_iff)
```
```   420 apply blast
```
```   421 done
```
```   422
```
```   423 (*Just a variant of subset_imp_le*)
```
```   424 lemma all_lt_imp_le: "[| Ord(i);  Ord(j);  !!x. x<j ==> x<i |] ==> j le i"
```
```   425 by (blast intro: not_lt_imp_le dest: lt_irrefl)
```
```   426
```
```   427 (** Transitive laws **)
```
```   428
```
```   429 lemma lt_trans1: "[| i le j;  j<k |] ==> i<k"
```
```   430 by (blast elim!: leE intro: lt_trans)
```
```   431
```
```   432 lemma lt_trans2: "[| i<j;  j le k |] ==> i<k"
```
```   433 by (blast elim!: leE intro: lt_trans)
```
```   434
```
```   435 lemma le_trans: "[| i le j;  j le k |] ==> i le k"
```
```   436 by (blast intro: lt_trans1)
```
```   437
```
```   438 lemma succ_leI: "i<j ==> succ(i) le j"
```
```   439 apply (rule not_lt_iff_le [THEN iffD1])
```
```   440 apply (blast elim: ltE leE lt_asym)+
```
```   441 done
```
```   442
```
```   443 (*Identical to  succ(i) < succ(j) ==> i<j  *)
```
```   444 lemma succ_leE: "succ(i) le j ==> i<j"
```
```   445 apply (rule not_le_iff_lt [THEN iffD1])
```
```   446 apply (blast elim: ltE leE lt_asym)+
```
```   447 done
```
```   448
```
```   449 lemma succ_le_iff [iff]: "succ(i) le j <-> i<j"
```
```   450 by (blast intro: succ_leI succ_leE)
```
```   451
```
```   452 lemma succ_le_imp_le: "succ(i) le succ(j) ==> i le j"
```
```   453 by (blast dest!: succ_leE)
```
```   454
```
```   455 lemma lt_subset_trans: "[| i <= j;  j<k;  Ord(i) |] ==> i<k"
```
```   456 apply (rule subset_imp_le [THEN lt_trans1])
```
```   457 apply (blast intro: elim: ltE) +
```
```   458 done
```
```   459
```
```   460 lemma lt_imp_0_lt: "j<i ==> 0<i"
```
```   461 by (blast intro: lt_trans1 Ord_0_le [OF lt_Ord])
```
```   462
```
```   463 lemma succ_lt_iff: "succ(i) < j <-> i<j & succ(i) \<noteq> j"
```
```   464 apply auto
```
```   465 apply (blast intro: lt_trans le_refl dest: lt_Ord)
```
```   466 apply (frule lt_Ord)
```
```   467 apply (rule not_le_iff_lt [THEN iffD1])
```
```   468   apply (blast intro: lt_Ord2)
```
```   469  apply blast
```
```   470 apply (simp add: lt_Ord lt_Ord2 le_iff)
```
```   471 apply (blast dest: lt_asym)
```
```   472 done
```
```   473
```
```   474 lemma Ord_succ_mem_iff: "Ord(j) ==> succ(i) \<in> succ(j) <-> i\<in>j"
```
```   475 apply (insert succ_le_iff [of i j])
```
```   476 apply (simp add: lt_def)
```
```   477 done
```
```   478
```
```   479 (** Union and Intersection **)
```
```   480
```
```   481 lemma Un_upper1_le: "[| Ord(i); Ord(j) |] ==> i le i Un j"
```
```   482 by (rule Un_upper1 [THEN subset_imp_le], auto)
```
```   483
```
```   484 lemma Un_upper2_le: "[| Ord(i); Ord(j) |] ==> j le i Un j"
```
```   485 by (rule Un_upper2 [THEN subset_imp_le], auto)
```
```   486
```
```   487 (*Replacing k by succ(k') yields the similar rule for le!*)
```
```   488 lemma Un_least_lt: "[| i<k;  j<k |] ==> i Un j < k"
```
```   489 apply (rule_tac i = "i" and j = "j" in Ord_linear_le)
```
```   490 apply (auto simp add: Un_commute le_subset_iff subset_Un_iff lt_Ord)
```
```   491 done
```
```   492
```
```   493 lemma Un_least_lt_iff: "[| Ord(i); Ord(j) |] ==> i Un j < k  <->  i<k & j<k"
```
```   494 apply (safe intro!: Un_least_lt)
```
```   495 apply (rule_tac [2] Un_upper2_le [THEN lt_trans1])
```
```   496 apply (rule Un_upper1_le [THEN lt_trans1], auto)
```
```   497 done
```
```   498
```
```   499 lemma Un_least_mem_iff:
```
```   500     "[| Ord(i); Ord(j); Ord(k) |] ==> i Un j : k  <->  i:k & j:k"
```
```   501 apply (insert Un_least_lt_iff [of i j k])
```
```   502 apply (simp add: lt_def)
```
```   503 done
```
```   504
```
```   505 (*Replacing k by succ(k') yields the similar rule for le!*)
```
```   506 lemma Int_greatest_lt: "[| i<k;  j<k |] ==> i Int j < k"
```
```   507 apply (rule_tac i = "i" and j = "j" in Ord_linear_le)
```
```   508 apply (auto simp add: Int_commute le_subset_iff subset_Int_iff lt_Ord)
```
```   509 done
```
```   510
```
```   511 lemma Ord_Un_if:
```
```   512      "[| Ord(i); Ord(j) |] ==> i \<union> j = (if j<i then i else j)"
```
```   513 by (simp add: not_lt_iff_le le_imp_subset leI
```
```   514               subset_Un_iff [symmetric]  subset_Un_iff2 [symmetric])
```
```   515
```
```   516 lemma succ_Un_distrib:
```
```   517      "[| Ord(i); Ord(j) |] ==> succ(i \<union> j) = succ(i) \<union> succ(j)"
```
```   518 by (simp add: Ord_Un_if lt_Ord le_Ord2)
```
```   519
```
```   520 lemma lt_Un_iff:
```
```   521      "[| Ord(i); Ord(j) |] ==> k < i \<union> j <-> k < i | k < j";
```
```   522 apply (simp add: Ord_Un_if not_lt_iff_le)
```
```   523 apply (blast intro: leI lt_trans2)+
```
```   524 done
```
```   525
```
```   526 lemma le_Un_iff:
```
```   527      "[| Ord(i); Ord(j) |] ==> k \<le> i \<union> j <-> k \<le> i | k \<le> j";
```
```   528 by (simp add: succ_Un_distrib lt_Un_iff [symmetric])
```
```   529
```
```   530 lemma Un_upper1_lt: "[|k < i; Ord(j)|] ==> k < i Un j"
```
```   531 by (simp add: lt_Un_iff lt_Ord2)
```
```   532
```
```   533 lemma Un_upper2_lt: "[|k < j; Ord(i)|] ==> k < i Un j"
```
```   534 by (simp add: lt_Un_iff lt_Ord2)
```
```   535
```
```   536 (*See also Transset_iff_Union_succ*)
```
```   537 lemma Ord_Union_succ_eq: "Ord(i) ==> \<Union>(succ(i)) = i"
```
```   538 by (blast intro: Ord_trans)
```
```   539
```
```   540
```
```   541 (*** Results about limits ***)
```
```   542
```
```   543 lemma Ord_Union [intro,simp,TC]: "[| !!i. i:A ==> Ord(i) |] ==> Ord(Union(A))"
```
```   544 apply (rule Ord_is_Transset [THEN Transset_Union_family, THEN OrdI])
```
```   545 apply (blast intro: Ord_contains_Transset)+
```
```   546 done
```
```   547
```
```   548 lemma Ord_UN [intro,simp,TC]:
```
```   549      "[| !!x. x:A ==> Ord(B(x)) |] ==> Ord(UN x:A. B(x))"
```
```   550 by (rule Ord_Union, blast)
```
```   551
```
```   552 lemma Ord_Inter [intro,simp,TC]:
```
```   553     "[| !!i. i:A ==> Ord(i) |] ==> Ord(Inter(A))"
```
```   554 apply (rule Transset_Inter_family [THEN OrdI])
```
```   555 apply (blast intro: Ord_is_Transset)
```
```   556 apply (simp add: Inter_def)
```
```   557 apply (blast intro: Ord_contains_Transset)
```
```   558 done
```
```   559
```
```   560 lemma Ord_INT [intro,simp,TC]:
```
```   561     "[| !!x. x:A ==> Ord(B(x)) |] ==> Ord(INT x:A. B(x))"
```
```   562 by (rule Ord_Inter, blast)
```
```   563
```
```   564
```
```   565 (* No < version; consider (UN i:nat.i)=nat *)
```
```   566 lemma UN_least_le:
```
```   567     "[| Ord(i);  !!x. x:A ==> b(x) le i |] ==> (UN x:A. b(x)) le i"
```
```   568 apply (rule le_imp_subset [THEN UN_least, THEN subset_imp_le])
```
```   569 apply (blast intro: Ord_UN elim: ltE)+
```
```   570 done
```
```   571
```
```   572 lemma UN_succ_least_lt:
```
```   573     "[| j<i;  !!x. x:A ==> b(x)<j |] ==> (UN x:A. succ(b(x))) < i"
```
```   574 apply (rule ltE, assumption)
```
```   575 apply (rule UN_least_le [THEN lt_trans2])
```
```   576 apply (blast intro: succ_leI)+
```
```   577 done
```
```   578
```
```   579 lemma UN_upper_lt:
```
```   580      "[| a\<in>A;  i < b(a);  Ord(\<Union>x\<in>A. b(x)) |] ==> i < (\<Union>x\<in>A. b(x))"
```
```   581 by (unfold lt_def, blast)
```
```   582
```
```   583 lemma UN_upper_le:
```
```   584      "[| a: A;  i le b(a);  Ord(UN x:A. b(x)) |] ==> i le (UN x:A. b(x))"
```
```   585 apply (frule ltD)
```
```   586 apply (rule le_imp_subset [THEN subset_trans, THEN subset_imp_le])
```
```   587 apply (blast intro: lt_Ord UN_upper)+
```
```   588 done
```
```   589
```
```   590 lemma lt_Union_iff: "\<forall>i\<in>A. Ord(i) ==> (j < \<Union>(A)) <-> (\<exists>i\<in>A. j<i)"
```
```   591 by (auto simp: lt_def Ord_Union)
```
```   592
```
```   593 lemma Union_upper_le:
```
```   594      "[| j: J;  i\<le>j;  Ord(\<Union>(J)) |] ==> i \<le> \<Union>J"
```
```   595 apply (subst Union_eq_UN)
```
```   596 apply (rule UN_upper_le, auto)
```
```   597 done
```
```   598
```
```   599 lemma le_implies_UN_le_UN:
```
```   600     "[| !!x. x:A ==> c(x) le d(x) |] ==> (UN x:A. c(x)) le (UN x:A. d(x))"
```
```   601 apply (rule UN_least_le)
```
```   602 apply (rule_tac [2] UN_upper_le)
```
```   603 apply (blast intro: Ord_UN le_Ord2)+
```
```   604 done
```
```   605
```
```   606 lemma Ord_equality: "Ord(i) ==> (UN y:i. succ(y)) = i"
```
```   607 by (blast intro: Ord_trans)
```
```   608
```
```   609 (*Holds for all transitive sets, not just ordinals*)
```
```   610 lemma Ord_Union_subset: "Ord(i) ==> Union(i) <= i"
```
```   611 by (blast intro: Ord_trans)
```
```   612
```
```   613
```
```   614 (*** Limit ordinals -- general properties ***)
```
```   615
```
```   616 lemma Limit_Union_eq: "Limit(i) ==> Union(i) = i"
```
```   617 apply (unfold Limit_def)
```
```   618 apply (fast intro!: ltI elim!: ltE elim: Ord_trans)
```
```   619 done
```
```   620
```
```   621 lemma Limit_is_Ord: "Limit(i) ==> Ord(i)"
```
```   622 apply (unfold Limit_def)
```
```   623 apply (erule conjunct1)
```
```   624 done
```
```   625
```
```   626 lemma Limit_has_0: "Limit(i) ==> 0 < i"
```
```   627 apply (unfold Limit_def)
```
```   628 apply (erule conjunct2 [THEN conjunct1])
```
```   629 done
```
```   630
```
```   631 lemma Limit_has_succ: "[| Limit(i);  j<i |] ==> succ(j) < i"
```
```   632 by (unfold Limit_def, blast)
```
```   633
```
```   634 lemma zero_not_Limit [iff]: "~ Limit(0)"
```
```   635 by (simp add: Limit_def)
```
```   636
```
```   637 lemma Limit_has_1: "Limit(i) ==> 1 < i"
```
```   638 by (blast intro: Limit_has_0 Limit_has_succ)
```
```   639
```
```   640 lemma increasing_LimitI: "[| 0<l; \<forall>x\<in>l. \<exists>y\<in>l. x<y |] ==> Limit(l)"
```
```   641 apply (simp add: Limit_def lt_Ord2, clarify)
```
```   642 apply (drule_tac i=y in ltD)
```
```   643 apply (blast intro: lt_trans1 [OF _ ltI] lt_Ord2)
```
```   644 done
```
```   645
```
```   646 lemma non_succ_LimitI:
```
```   647     "[| 0<i;  ALL y. succ(y) ~= i |] ==> Limit(i)"
```
```   648 apply (unfold Limit_def)
```
```   649 apply (safe del: subsetI)
```
```   650 apply (rule_tac [2] not_le_iff_lt [THEN iffD1])
```
```   651 apply (simp_all add: lt_Ord lt_Ord2)
```
```   652 apply (blast elim: leE lt_asym)
```
```   653 done
```
```   654
```
```   655 lemma succ_LimitE [elim!]: "Limit(succ(i)) ==> P"
```
```   656 apply (rule lt_irrefl)
```
```   657 apply (rule Limit_has_succ, assumption)
```
```   658 apply (erule Limit_is_Ord [THEN Ord_succD, THEN le_refl])
```
```   659 done
```
```   660
```
```   661 lemma not_succ_Limit [simp]: "~ Limit(succ(i))"
```
```   662 by blast
```
```   663
```
```   664 lemma Limit_le_succD: "[| Limit(i);  i le succ(j) |] ==> i le j"
```
```   665 by (blast elim!: leE)
```
```   666
```
```   667
```
```   668 (** Traditional 3-way case analysis on ordinals **)
```
```   669
```
```   670 lemma Ord_cases_disj: "Ord(i) ==> i=0 | (EX j. Ord(j) & i=succ(j)) | Limit(i)"
```
```   671 by (blast intro!: non_succ_LimitI Ord_0_lt)
```
```   672
```
```   673 lemma Ord_cases:
```
```   674     "[| Ord(i);
```
```   675         i=0                          ==> P;
```
```   676         !!j. [| Ord(j); i=succ(j) |] ==> P;
```
```   677         Limit(i)                     ==> P
```
```   678      |] ==> P"
```
```   679 by (drule Ord_cases_disj, blast)
```
```   680
```
```   681 lemma trans_induct3:
```
```   682      "[| Ord(i);
```
```   683          P(0);
```
```   684          !!x. [| Ord(x);  P(x) |] ==> P(succ(x));
```
```   685          !!x. [| Limit(x);  ALL y:x. P(y) |] ==> P(x)
```
```   686       |] ==> P(i)"
```
```   687 apply (erule trans_induct)
```
```   688 apply (erule Ord_cases, blast+)
```
```   689 done
```
```   690
```
```   691 text{*A set of ordinals is either empty, contains its own union, or its
```
```   692 union is a limit ordinal.*}
```
```   693 lemma Ord_set_cases:
```
```   694    "\<forall>i\<in>I. Ord(i) ==> I=0 \<or> \<Union>(I) \<in> I \<or> (\<Union>(I) \<notin> I \<and> Limit(\<Union>(I)))"
```
```   695 apply (clarify elim!: not_emptyE)
```
```   696 apply (cases "\<Union>(I)" rule: Ord_cases)
```
```   697    apply (blast intro: Ord_Union)
```
```   698   apply (blast intro: subst_elem)
```
```   699  apply auto
```
```   700 apply (clarify elim!: equalityE succ_subsetE)
```
```   701 apply (simp add: Union_subset_iff)
```
```   702 apply (subgoal_tac "B = succ(j)", blast)
```
```   703 apply (rule le_anti_sym)
```
```   704  apply (simp add: le_subset_iff)
```
```   705 apply (simp add: ltI)
```
```   706 done
```
```   707
```
```   708 text{*If the union of a set of ordinals is a successor, then it is
```
```   709 an element of that set.*}
```
```   710 lemma Ord_Union_eq_succD: "[|\<forall>x\<in>X. Ord(x);  \<Union>X = succ(j)|] ==> succ(j) \<in> X"
```
```   711 by (drule Ord_set_cases, auto)
```
```   712
```
```   713 lemma Limit_Union [rule_format]: "[| I \<noteq> 0;  \<forall>i\<in>I. Limit(i) |] ==> Limit(\<Union>I)"
```
```   714 apply (simp add: Limit_def lt_def)
```
```   715 apply (blast intro!: equalityI)
```
```   716 done
```
```   717
```
```   718 (*special induction rules for the "induct" method*)
```
```   719 lemmas Ord_induct = Ord_induct [consumes 2]
```
```   720   and Ord_induct_rule = Ord_induct [rule_format, consumes 2]
```
```   721   and trans_induct = trans_induct [consumes 1]
```
```   722   and trans_induct_rule = trans_induct [rule_format, consumes 1]
```
```   723   and trans_induct3 = trans_induct3 [case_names 0 succ limit, consumes 1]
```
```   724   and trans_induct3_rule = trans_induct3 [rule_format, case_names 0 succ limit, consumes 1]
```
```   725
```
```   726 ML
```
```   727 {*
```
```   728 val Memrel_def = thm "Memrel_def";
```
```   729 val Transset_def = thm "Transset_def";
```
```   730 val Ord_def = thm "Ord_def";
```
```   731 val lt_def = thm "lt_def";
```
```   732 val Limit_def = thm "Limit_def";
```
```   733
```
```   734 val Transset_iff_Pow = thm "Transset_iff_Pow";
```
```   735 val Transset_iff_Union_succ = thm "Transset_iff_Union_succ";
```
```   736 val Transset_iff_Union_subset = thm "Transset_iff_Union_subset";
```
```   737 val Transset_doubleton_D = thm "Transset_doubleton_D";
```
```   738 val Transset_Pair_D = thm "Transset_Pair_D";
```
```   739 val Transset_includes_domain = thm "Transset_includes_domain";
```
```   740 val Transset_includes_range = thm "Transset_includes_range";
```
```   741 val Transset_0 = thm "Transset_0";
```
```   742 val Transset_Un = thm "Transset_Un";
```
```   743 val Transset_Int = thm "Transset_Int";
```
```   744 val Transset_succ = thm "Transset_succ";
```
```   745 val Transset_Pow = thm "Transset_Pow";
```
```   746 val Transset_Union = thm "Transset_Union";
```
```   747 val Transset_Union_family = thm "Transset_Union_family";
```
```   748 val Transset_Inter_family = thm "Transset_Inter_family";
```
```   749 val OrdI = thm "OrdI";
```
```   750 val Ord_is_Transset = thm "Ord_is_Transset";
```
```   751 val Ord_contains_Transset = thm "Ord_contains_Transset";
```
```   752 val Ord_in_Ord = thm "Ord_in_Ord";
```
```   753 val Ord_succD = thm "Ord_succD";
```
```   754 val Ord_subset_Ord = thm "Ord_subset_Ord";
```
```   755 val OrdmemD = thm "OrdmemD";
```
```   756 val Ord_trans = thm "Ord_trans";
```
```   757 val Ord_succ_subsetI = thm "Ord_succ_subsetI";
```
```   758 val Ord_0 = thm "Ord_0";
```
```   759 val Ord_succ = thm "Ord_succ";
```
```   760 val Ord_1 = thm "Ord_1";
```
```   761 val Ord_succ_iff = thm "Ord_succ_iff";
```
```   762 val Ord_Un = thm "Ord_Un";
```
```   763 val Ord_Int = thm "Ord_Int";
```
```   764 val Ord_Inter = thm "Ord_Inter";
```
```   765 val Ord_INT = thm "Ord_INT";
```
```   766 val ON_class = thm "ON_class";
```
```   767 val ltI = thm "ltI";
```
```   768 val ltE = thm "ltE";
```
```   769 val ltD = thm "ltD";
```
```   770 val not_lt0 = thm "not_lt0";
```
```   771 val lt_Ord = thm "lt_Ord";
```
```   772 val lt_Ord2 = thm "lt_Ord2";
```
```   773 val le_Ord2 = thm "le_Ord2";
```
```   774 val lt0E = thm "lt0E";
```
```   775 val lt_trans = thm "lt_trans";
```
```   776 val lt_not_sym = thm "lt_not_sym";
```
```   777 val lt_asym = thm "lt_asym";
```
```   778 val lt_irrefl = thm "lt_irrefl";
```
```   779 val lt_not_refl = thm "lt_not_refl";
```
```   780 val le_iff = thm "le_iff";
```
```   781 val leI = thm "leI";
```
```   782 val le_eqI = thm "le_eqI";
```
```   783 val le_refl = thm "le_refl";
```
```   784 val le_refl_iff = thm "le_refl_iff";
```
```   785 val leCI = thm "leCI";
```
```   786 val leE = thm "leE";
```
```   787 val le_anti_sym = thm "le_anti_sym";
```
```   788 val le0_iff = thm "le0_iff";
```
```   789 val le0D = thm "le0D";
```
```   790 val Memrel_iff = thm "Memrel_iff";
```
```   791 val MemrelI = thm "MemrelI";
```
```   792 val MemrelE = thm "MemrelE";
```
```   793 val Memrel_type = thm "Memrel_type";
```
```   794 val Memrel_mono = thm "Memrel_mono";
```
```   795 val Memrel_0 = thm "Memrel_0";
```
```   796 val Memrel_1 = thm "Memrel_1";
```
```   797 val wf_Memrel = thm "wf_Memrel";
```
```   798 val trans_Memrel = thm "trans_Memrel";
```
```   799 val Transset_Memrel_iff = thm "Transset_Memrel_iff";
```
```   800 val Transset_induct = thm "Transset_induct";
```
```   801 val Ord_induct = thm "Ord_induct";
```
```   802 val trans_induct = thm "trans_induct";
```
```   803 val Ord_linear = thm "Ord_linear";
```
```   804 val Ord_linear_lt = thm "Ord_linear_lt";
```
```   805 val Ord_linear2 = thm "Ord_linear2";
```
```   806 val Ord_linear_le = thm "Ord_linear_le";
```
```   807 val le_imp_not_lt = thm "le_imp_not_lt";
```
```   808 val not_lt_imp_le = thm "not_lt_imp_le";
```
```   809 val Ord_mem_iff_lt = thm "Ord_mem_iff_lt";
```
```   810 val not_lt_iff_le = thm "not_lt_iff_le";
```
```   811 val not_le_iff_lt = thm "not_le_iff_lt";
```
```   812 val Ord_0_le = thm "Ord_0_le";
```
```   813 val Ord_0_lt = thm "Ord_0_lt";
```
```   814 val Ord_0_lt_iff = thm "Ord_0_lt_iff";
```
```   815 val zero_le_succ_iff = thm "zero_le_succ_iff";
```
```   816 val subset_imp_le = thm "subset_imp_le";
```
```   817 val le_imp_subset = thm "le_imp_subset";
```
```   818 val le_subset_iff = thm "le_subset_iff";
```
```   819 val le_succ_iff = thm "le_succ_iff";
```
```   820 val all_lt_imp_le = thm "all_lt_imp_le";
```
```   821 val lt_trans1 = thm "lt_trans1";
```
```   822 val lt_trans2 = thm "lt_trans2";
```
```   823 val le_trans = thm "le_trans";
```
```   824 val succ_leI = thm "succ_leI";
```
```   825 val succ_leE = thm "succ_leE";
```
```   826 val succ_le_iff = thm "succ_le_iff";
```
```   827 val succ_le_imp_le = thm "succ_le_imp_le";
```
```   828 val lt_subset_trans = thm "lt_subset_trans";
```
```   829 val Un_upper1_le = thm "Un_upper1_le";
```
```   830 val Un_upper2_le = thm "Un_upper2_le";
```
```   831 val Un_least_lt = thm "Un_least_lt";
```
```   832 val Un_least_lt_iff = thm "Un_least_lt_iff";
```
```   833 val Un_least_mem_iff = thm "Un_least_mem_iff";
```
```   834 val Int_greatest_lt = thm "Int_greatest_lt";
```
```   835 val Ord_Union = thm "Ord_Union";
```
```   836 val Ord_UN = thm "Ord_UN";
```
```   837 val UN_least_le = thm "UN_least_le";
```
```   838 val UN_succ_least_lt = thm "UN_succ_least_lt";
```
```   839 val UN_upper_le = thm "UN_upper_le";
```
```   840 val le_implies_UN_le_UN = thm "le_implies_UN_le_UN";
```
```   841 val Ord_equality = thm "Ord_equality";
```
```   842 val Ord_Union_subset = thm "Ord_Union_subset";
```
```   843 val Limit_Union_eq = thm "Limit_Union_eq";
```
```   844 val Limit_is_Ord = thm "Limit_is_Ord";
```
```   845 val Limit_has_0 = thm "Limit_has_0";
```
```   846 val Limit_has_succ = thm "Limit_has_succ";
```
```   847 val non_succ_LimitI = thm "non_succ_LimitI";
```
```   848 val succ_LimitE = thm "succ_LimitE";
```
```   849 val not_succ_Limit = thm "not_succ_Limit";
```
```   850 val Limit_le_succD = thm "Limit_le_succD";
```
```   851 val Ord_cases_disj = thm "Ord_cases_disj";
```
```   852 val Ord_cases = thm "Ord_cases";
```
```   853 val trans_induct3 = thm "trans_induct3";
```
```   854 *}
```
```   855
```
```   856 end
```