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