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