author | clasohm |
Wed, 14 Dec 1994 11:41:49 +0100 | |
changeset 782 | 200a16083201 |
parent 772 | 5ca7f94117bb |
child 830 | 18240b5d8a06 |
permissions | -rw-r--r-- |
435 | 1 |
(* Title: ZF/Ordinal.thy |
2 |
ID: $Id$ |
|
3 |
Author: Lawrence C Paulson, Cambridge University Computer Laboratory |
|
4 |
Copyright 1993 University of Cambridge |
|
5 |
||
6 |
For Ordinal.thy. Ordinals in Zermelo-Fraenkel Set Theory |
|
7 |
*) |
|
8 |
||
9 |
open Ordinal; |
|
10 |
||
11 |
(*** Rules for Transset ***) |
|
12 |
||
13 |
(** Two neat characterisations of Transset **) |
|
14 |
||
15 |
goalw Ordinal.thy [Transset_def] "Transset(A) <-> A<=Pow(A)"; |
|
16 |
by (fast_tac ZF_cs 1); |
|
760 | 17 |
qed "Transset_iff_Pow"; |
435 | 18 |
|
19 |
goalw Ordinal.thy [Transset_def] "Transset(A) <-> Union(succ(A)) = A"; |
|
20 |
by (fast_tac (eq_cs addSEs [equalityE]) 1); |
|
760 | 21 |
qed "Transset_iff_Union_succ"; |
435 | 22 |
|
23 |
(** Consequences of downwards closure **) |
|
24 |
||
25 |
goalw Ordinal.thy [Transset_def] |
|
26 |
"!!C a b. [| Transset(C); {a,b}: C |] ==> a:C & b: C"; |
|
27 |
by (fast_tac ZF_cs 1); |
|
760 | 28 |
qed "Transset_doubleton_D"; |
435 | 29 |
|
30 |
val [prem1,prem2] = goalw Ordinal.thy [Pair_def] |
|
31 |
"[| Transset(C); <a,b>: C |] ==> a:C & b: C"; |
|
32 |
by (cut_facts_tac [prem2] 1); |
|
33 |
by (fast_tac (ZF_cs addSDs [prem1 RS Transset_doubleton_D]) 1); |
|
760 | 34 |
qed "Transset_Pair_D"; |
435 | 35 |
|
36 |
val prem1::prems = goal Ordinal.thy |
|
37 |
"[| Transset(C); A*B <= C; b: B |] ==> A <= C"; |
|
38 |
by (cut_facts_tac prems 1); |
|
39 |
by (fast_tac (ZF_cs addSDs [prem1 RS Transset_Pair_D]) 1); |
|
760 | 40 |
qed "Transset_includes_domain"; |
435 | 41 |
|
42 |
val prem1::prems = goal Ordinal.thy |
|
43 |
"[| Transset(C); A*B <= C; a: A |] ==> B <= C"; |
|
44 |
by (cut_facts_tac prems 1); |
|
45 |
by (fast_tac (ZF_cs addSDs [prem1 RS Transset_Pair_D]) 1); |
|
760 | 46 |
qed "Transset_includes_range"; |
435 | 47 |
|
48 |
val [prem1,prem2] = goalw (merge_theories(Ordinal.thy,Sum.thy)) [sum_def] |
|
49 |
"[| Transset(C); A+B <= C |] ==> A <= C & B <= C"; |
|
50 |
by (rtac (prem2 RS (Un_subset_iff RS iffD1) RS conjE) 1); |
|
51 |
by (REPEAT (etac (prem1 RS Transset_includes_range) 1 |
|
52 |
ORELSE resolve_tac [conjI, singletonI] 1)); |
|
53 |
val Transset_includes_summands = result(); |
|
54 |
||
55 |
val [prem] = goalw (merge_theories(Ordinal.thy,Sum.thy)) [sum_def] |
|
56 |
"Transset(C) ==> (A+B) Int C <= (A Int C) + (B Int C)"; |
|
57 |
by (rtac (Int_Un_distrib RS ssubst) 1); |
|
58 |
by (fast_tac (ZF_cs addSDs [prem RS Transset_Pair_D]) 1); |
|
59 |
val Transset_sum_Int_subset = result(); |
|
60 |
||
61 |
(** Closure properties **) |
|
62 |
||
63 |
goalw Ordinal.thy [Transset_def] "Transset(0)"; |
|
64 |
by (fast_tac ZF_cs 1); |
|
760 | 65 |
qed "Transset_0"; |
435 | 66 |
|
67 |
goalw Ordinal.thy [Transset_def] |
|
68 |
"!!i j. [| Transset(i); Transset(j) |] ==> Transset(i Un j)"; |
|
69 |
by (fast_tac ZF_cs 1); |
|
760 | 70 |
qed "Transset_Un"; |
435 | 71 |
|
72 |
goalw Ordinal.thy [Transset_def] |
|
73 |
"!!i j. [| Transset(i); Transset(j) |] ==> Transset(i Int j)"; |
|
74 |
by (fast_tac ZF_cs 1); |
|
760 | 75 |
qed "Transset_Int"; |
435 | 76 |
|
77 |
goalw Ordinal.thy [Transset_def] "!!i. Transset(i) ==> Transset(succ(i))"; |
|
78 |
by (fast_tac ZF_cs 1); |
|
760 | 79 |
qed "Transset_succ"; |
435 | 80 |
|
81 |
goalw Ordinal.thy [Transset_def] "!!i. Transset(i) ==> Transset(Pow(i))"; |
|
82 |
by (fast_tac ZF_cs 1); |
|
760 | 83 |
qed "Transset_Pow"; |
435 | 84 |
|
85 |
goalw Ordinal.thy [Transset_def] "!!A. Transset(A) ==> Transset(Union(A))"; |
|
86 |
by (fast_tac ZF_cs 1); |
|
760 | 87 |
qed "Transset_Union"; |
435 | 88 |
|
89 |
val [Transprem] = goalw Ordinal.thy [Transset_def] |
|
90 |
"[| !!i. i:A ==> Transset(i) |] ==> Transset(Union(A))"; |
|
91 |
by (fast_tac (ZF_cs addEs [Transprem RS bspec RS subsetD]) 1); |
|
760 | 92 |
qed "Transset_Union_family"; |
435 | 93 |
|
94 |
val [prem,Transprem] = goalw Ordinal.thy [Transset_def] |
|
95 |
"[| j:A; !!i. i:A ==> Transset(i) |] ==> Transset(Inter(A))"; |
|
96 |
by (cut_facts_tac [prem] 1); |
|
97 |
by (fast_tac (ZF_cs addEs [Transprem RS bspec RS subsetD]) 1); |
|
760 | 98 |
qed "Transset_Inter_family"; |
435 | 99 |
|
100 |
(*** Natural Deduction rules for Ord ***) |
|
101 |
||
102 |
val prems = goalw Ordinal.thy [Ord_def] |
|
103 |
"[| Transset(i); !!x. x:i ==> Transset(x) |] ==> Ord(i) "; |
|
104 |
by (REPEAT (ares_tac (prems@[ballI,conjI]) 1)); |
|
760 | 105 |
qed "OrdI"; |
435 | 106 |
|
107 |
val [major] = goalw Ordinal.thy [Ord_def] |
|
108 |
"Ord(i) ==> Transset(i)"; |
|
109 |
by (rtac (major RS conjunct1) 1); |
|
760 | 110 |
qed "Ord_is_Transset"; |
435 | 111 |
|
112 |
val [major,minor] = goalw Ordinal.thy [Ord_def] |
|
113 |
"[| Ord(i); j:i |] ==> Transset(j) "; |
|
114 |
by (rtac (minor RS (major RS conjunct2 RS bspec)) 1); |
|
760 | 115 |
qed "Ord_contains_Transset"; |
435 | 116 |
|
117 |
(*** Lemmas for ordinals ***) |
|
118 |
||
119 |
goalw Ordinal.thy [Ord_def,Transset_def] "!!i j.[| Ord(i); j:i |] ==> Ord(j)"; |
|
120 |
by (fast_tac ZF_cs 1); |
|
760 | 121 |
qed "Ord_in_Ord"; |
435 | 122 |
|
123 |
(* Ord(succ(j)) ==> Ord(j) *) |
|
124 |
val Ord_succD = succI1 RSN (2, Ord_in_Ord); |
|
125 |
||
126 |
goal Ordinal.thy "!!i j. [| Ord(i); Transset(j); j<=i |] ==> Ord(j)"; |
|
127 |
by (REPEAT (ares_tac [OrdI] 1 |
|
128 |
ORELSE eresolve_tac [Ord_contains_Transset, subsetD] 1)); |
|
760 | 129 |
qed "Ord_subset_Ord"; |
435 | 130 |
|
131 |
goalw Ordinal.thy [Ord_def,Transset_def] "!!i j. [| j:i; Ord(i) |] ==> j<=i"; |
|
132 |
by (fast_tac ZF_cs 1); |
|
760 | 133 |
qed "OrdmemD"; |
435 | 134 |
|
135 |
goal Ordinal.thy "!!i j k. [| i:j; j:k; Ord(k) |] ==> i:k"; |
|
136 |
by (REPEAT (ares_tac [OrdmemD RS subsetD] 1)); |
|
760 | 137 |
qed "Ord_trans"; |
435 | 138 |
|
139 |
goal Ordinal.thy "!!i j. [| i:j; Ord(j) |] ==> succ(i) <= j"; |
|
140 |
by (REPEAT (ares_tac [OrdmemD RSN (2,succ_subsetI)] 1)); |
|
760 | 141 |
qed "Ord_succ_subsetI"; |
435 | 142 |
|
143 |
||
144 |
(*** The construction of ordinals: 0, succ, Union ***) |
|
145 |
||
146 |
goal Ordinal.thy "Ord(0)"; |
|
147 |
by (REPEAT (ares_tac [OrdI,Transset_0] 1 ORELSE etac emptyE 1)); |
|
760 | 148 |
qed "Ord_0"; |
435 | 149 |
|
150 |
goal Ordinal.thy "!!i. Ord(i) ==> Ord(succ(i))"; |
|
151 |
by (REPEAT (ares_tac [OrdI,Transset_succ] 1 |
|
152 |
ORELSE eresolve_tac [succE,ssubst,Ord_is_Transset, |
|
153 |
Ord_contains_Transset] 1)); |
|
760 | 154 |
qed "Ord_succ"; |
435 | 155 |
|
156 |
goal Ordinal.thy "Ord(succ(i)) <-> Ord(i)"; |
|
157 |
by (fast_tac (ZF_cs addIs [Ord_succ] addDs [Ord_succD]) 1); |
|
760 | 158 |
qed "Ord_succ_iff"; |
435 | 159 |
|
160 |
goalw Ordinal.thy [Ord_def] "!!i j. [| Ord(i); Ord(j) |] ==> Ord(i Un j)"; |
|
161 |
by (fast_tac (ZF_cs addSIs [Transset_Un]) 1); |
|
760 | 162 |
qed "Ord_Un"; |
435 | 163 |
|
164 |
goalw Ordinal.thy [Ord_def] "!!i j. [| Ord(i); Ord(j) |] ==> Ord(i Int j)"; |
|
165 |
by (fast_tac (ZF_cs addSIs [Transset_Int]) 1); |
|
760 | 166 |
qed "Ord_Int"; |
435 | 167 |
|
168 |
val nonempty::prems = goal Ordinal.thy |
|
169 |
"[| j:A; !!i. i:A ==> Ord(i) |] ==> Ord(Inter(A))"; |
|
170 |
by (rtac (nonempty RS Transset_Inter_family RS OrdI) 1); |
|
171 |
by (rtac Ord_is_Transset 1); |
|
172 |
by (REPEAT (ares_tac ([Ord_contains_Transset,nonempty]@prems) 1 |
|
173 |
ORELSE etac InterD 1)); |
|
760 | 174 |
qed "Ord_Inter"; |
435 | 175 |
|
176 |
val jmemA::prems = goal Ordinal.thy |
|
177 |
"[| j:A; !!x. x:A ==> Ord(B(x)) |] ==> Ord(INT x:A. B(x))"; |
|
178 |
by (rtac (jmemA RS RepFunI RS Ord_Inter) 1); |
|
179 |
by (etac RepFunE 1); |
|
180 |
by (etac ssubst 1); |
|
181 |
by (eresolve_tac prems 1); |
|
760 | 182 |
qed "Ord_INT"; |
435 | 183 |
|
184 |
(*There is no set of all ordinals, for then it would contain itself*) |
|
185 |
goal Ordinal.thy "~ (ALL i. i:X <-> Ord(i))"; |
|
186 |
by (rtac notI 1); |
|
187 |
by (forw_inst_tac [("x", "X")] spec 1); |
|
437 | 188 |
by (safe_tac (ZF_cs addSEs [mem_irrefl])); |
435 | 189 |
by (swap_res_tac [Ord_is_Transset RSN (2,OrdI)] 1); |
190 |
by (fast_tac ZF_cs 2); |
|
437 | 191 |
by (rewtac Transset_def); |
435 | 192 |
by (safe_tac ZF_cs); |
193 |
by (asm_full_simp_tac ZF_ss 1); |
|
194 |
by (REPEAT (eresolve_tac [asm_rl, Ord_in_Ord] 1)); |
|
760 | 195 |
qed "ON_class"; |
435 | 196 |
|
197 |
(*** < is 'less than' for ordinals ***) |
|
198 |
||
199 |
goalw Ordinal.thy [lt_def] "!!i j. [| i:j; Ord(j) |] ==> i<j"; |
|
200 |
by (REPEAT (ares_tac [conjI] 1)); |
|
760 | 201 |
qed "ltI"; |
435 | 202 |
|
203 |
val major::prems = goalw Ordinal.thy [lt_def] |
|
204 |
"[| i<j; [| i:j; Ord(i); Ord(j) |] ==> P |] ==> P"; |
|
205 |
by (rtac (major RS conjE) 1); |
|
206 |
by (REPEAT (ares_tac (prems@[Ord_in_Ord]) 1)); |
|
760 | 207 |
qed "ltE"; |
435 | 208 |
|
209 |
goal Ordinal.thy "!!i j. i<j ==> i:j"; |
|
210 |
by (etac ltE 1); |
|
211 |
by (assume_tac 1); |
|
760 | 212 |
qed "ltD"; |
435 | 213 |
|
214 |
goalw Ordinal.thy [lt_def] "~ i<0"; |
|
215 |
by (fast_tac ZF_cs 1); |
|
760 | 216 |
qed "not_lt0"; |
435 | 217 |
|
218 |
(* i<0 ==> R *) |
|
782
200a16083201
added bind_thm for theorems defined by "standard ..."
clasohm
parents:
772
diff
changeset
|
219 |
bind_thm ("lt0E", not_lt0 RS notE); |
435 | 220 |
|
221 |
goal Ordinal.thy "!!i j k. [| i<j; j<k |] ==> i<k"; |
|
222 |
by (fast_tac (ZF_cs addSIs [ltI] addSEs [ltE, Ord_trans]) 1); |
|
760 | 223 |
qed "lt_trans"; |
435 | 224 |
|
225 |
goalw Ordinal.thy [lt_def] "!!i j. [| i<j; j<i |] ==> P"; |
|
437 | 226 |
by (REPEAT (eresolve_tac [asm_rl, conjE, mem_asym] 1)); |
760 | 227 |
qed "lt_asym"; |
435 | 228 |
|
760 | 229 |
qed_goal "lt_irrefl" Ordinal.thy "i<i ==> P" |
437 | 230 |
(fn [major]=> [ (rtac (major RS (major RS lt_asym)) 1) ]); |
435 | 231 |
|
760 | 232 |
qed_goal "lt_not_refl" Ordinal.thy "~ i<i" |
437 | 233 |
(fn _=> [ (rtac notI 1), (etac lt_irrefl 1) ]); |
435 | 234 |
|
235 |
(** le is less than or equals; recall i le j abbrevs i<succ(j) !! **) |
|
236 |
||
237 |
goalw Ordinal.thy [lt_def] "i le j <-> i<j | (i=j & Ord(j))"; |
|
238 |
by (fast_tac (ZF_cs addSIs [Ord_succ] addSDs [Ord_succD]) 1); |
|
760 | 239 |
qed "le_iff"; |
435 | 240 |
|
772 | 241 |
(*Equivalently, i<j ==> i < succ(j)*) |
435 | 242 |
goal Ordinal.thy "!!i j. i<j ==> i le j"; |
243 |
by (asm_simp_tac (ZF_ss addsimps [le_iff]) 1); |
|
760 | 244 |
qed "leI"; |
435 | 245 |
|
246 |
goal Ordinal.thy "!!i. [| i=j; Ord(j) |] ==> i le j"; |
|
247 |
by (asm_simp_tac (ZF_ss addsimps [le_iff]) 1); |
|
760 | 248 |
qed "le_eqI"; |
435 | 249 |
|
250 |
val le_refl = refl RS le_eqI; |
|
251 |
||
252 |
val [prem] = goal Ordinal.thy "(~ (i=j & Ord(j)) ==> i<j) ==> i le j"; |
|
253 |
by (rtac (disjCI RS (le_iff RS iffD2)) 1); |
|
254 |
by (etac prem 1); |
|
760 | 255 |
qed "leCI"; |
435 | 256 |
|
257 |
val major::prems = goal Ordinal.thy |
|
258 |
"[| i le j; i<j ==> P; [| i=j; Ord(j) |] ==> P |] ==> P"; |
|
259 |
by (rtac (major RS (le_iff RS iffD1 RS disjE)) 1); |
|
260 |
by (DEPTH_SOLVE (ares_tac prems 1 ORELSE etac conjE 1)); |
|
760 | 261 |
qed "leE"; |
435 | 262 |
|
263 |
goal Ordinal.thy "!!i j. [| i le j; j le i |] ==> i=j"; |
|
264 |
by (asm_full_simp_tac (ZF_ss addsimps [le_iff]) 1); |
|
437 | 265 |
by (fast_tac (ZF_cs addEs [lt_asym]) 1); |
760 | 266 |
qed "le_anti_sym"; |
435 | 267 |
|
268 |
goal Ordinal.thy "i le 0 <-> i=0"; |
|
269 |
by (fast_tac (ZF_cs addSIs [Ord_0 RS le_refl] addSEs [leE, lt0E]) 1); |
|
760 | 270 |
qed "le0_iff"; |
435 | 271 |
|
782
200a16083201
added bind_thm for theorems defined by "standard ..."
clasohm
parents:
772
diff
changeset
|
272 |
bind_thm ("le0D", le0_iff RS iffD1); |
435 | 273 |
|
274 |
val lt_cs = |
|
275 |
ZF_cs addSIs [le_refl, leCI] |
|
276 |
addSDs [le0D] |
|
437 | 277 |
addSEs [lt_irrefl, lt0E, leE]; |
435 | 278 |
|
279 |
||
280 |
(*** Natural Deduction rules for Memrel ***) |
|
281 |
||
282 |
goalw Ordinal.thy [Memrel_def] "<a,b> : Memrel(A) <-> a:b & a:A & b:A"; |
|
283 |
by (fast_tac ZF_cs 1); |
|
760 | 284 |
qed "Memrel_iff"; |
435 | 285 |
|
286 |
val prems = goal Ordinal.thy "[| a: b; a: A; b: A |] ==> <a,b> : Memrel(A)"; |
|
287 |
by (REPEAT (resolve_tac (prems@[conjI, Memrel_iff RS iffD2]) 1)); |
|
760 | 288 |
qed "MemrelI"; |
435 | 289 |
|
290 |
val [major,minor] = goal Ordinal.thy |
|
291 |
"[| <a,b> : Memrel(A); \ |
|
292 |
\ [| a: A; b: A; a:b |] ==> P \ |
|
293 |
\ |] ==> P"; |
|
294 |
by (rtac (major RS (Memrel_iff RS iffD1) RS conjE) 1); |
|
295 |
by (etac conjE 1); |
|
296 |
by (rtac minor 1); |
|
297 |
by (REPEAT (assume_tac 1)); |
|
760 | 298 |
qed "MemrelE"; |
435 | 299 |
|
300 |
(*The membership relation (as a set) is well-founded. |
|
301 |
Proof idea: show A<=B by applying the foundation axiom to A-B *) |
|
302 |
goalw Ordinal.thy [wf_def] "wf(Memrel(A))"; |
|
303 |
by (EVERY1 [rtac (foundation RS disjE RS allI), |
|
304 |
etac disjI1, |
|
305 |
etac bexE, |
|
306 |
rtac (impI RS allI RS bexI RS disjI2), |
|
307 |
etac MemrelE, |
|
308 |
etac bspec, |
|
309 |
REPEAT o assume_tac]); |
|
760 | 310 |
qed "wf_Memrel"; |
435 | 311 |
|
312 |
(*Transset(i) does not suffice, though ALL j:i.Transset(j) does*) |
|
313 |
goalw Ordinal.thy [Ord_def, Transset_def, trans_def] |
|
314 |
"!!i. Ord(i) ==> trans(Memrel(i))"; |
|
315 |
by (fast_tac (ZF_cs addSIs [MemrelI] addSEs [MemrelE]) 1); |
|
760 | 316 |
qed "trans_Memrel"; |
435 | 317 |
|
318 |
(*If Transset(A) then Memrel(A) internalizes the membership relation below A*) |
|
319 |
goalw Ordinal.thy [Transset_def] |
|
320 |
"!!A. Transset(A) ==> <a,b> : Memrel(A) <-> a:b & b:A"; |
|
321 |
by (fast_tac (ZF_cs addSIs [MemrelI] addSEs [MemrelE]) 1); |
|
760 | 322 |
qed "Transset_Memrel_iff"; |
435 | 323 |
|
324 |
||
325 |
(*** Transfinite induction ***) |
|
326 |
||
327 |
(*Epsilon induction over a transitive set*) |
|
328 |
val major::prems = goalw Ordinal.thy [Transset_def] |
|
329 |
"[| i: k; Transset(k); \ |
|
330 |
\ !!x.[| x: k; ALL y:x. P(y) |] ==> P(x) \ |
|
331 |
\ |] ==> P(i)"; |
|
332 |
by (rtac (major RS (wf_Memrel RS wf_induct2)) 1); |
|
333 |
by (fast_tac (ZF_cs addEs [MemrelE]) 1); |
|
334 |
by (resolve_tac prems 1); |
|
335 |
by (assume_tac 1); |
|
336 |
by (cut_facts_tac prems 1); |
|
337 |
by (fast_tac (ZF_cs addIs [MemrelI]) 1); |
|
760 | 338 |
qed "Transset_induct"; |
435 | 339 |
|
340 |
(*Induction over an ordinal*) |
|
341 |
val Ord_induct = Ord_is_Transset RSN (2, Transset_induct); |
|
342 |
||
343 |
(*Induction over the class of ordinals -- a useful corollary of Ord_induct*) |
|
344 |
val [major,indhyp] = goal Ordinal.thy |
|
345 |
"[| Ord(i); \ |
|
346 |
\ !!x.[| Ord(x); ALL y:x. P(y) |] ==> P(x) \ |
|
347 |
\ |] ==> P(i)"; |
|
348 |
by (rtac (major RS Ord_succ RS (succI1 RS Ord_induct)) 1); |
|
349 |
by (rtac indhyp 1); |
|
350 |
by (rtac (major RS Ord_succ RS Ord_in_Ord) 1); |
|
351 |
by (REPEAT (assume_tac 1)); |
|
760 | 352 |
qed "trans_induct"; |
435 | 353 |
|
354 |
(*Perform induction on i, then prove the Ord(i) subgoal using prems. *) |
|
355 |
fun trans_ind_tac a prems i = |
|
356 |
EVERY [res_inst_tac [("i",a)] trans_induct i, |
|
357 |
rename_last_tac a ["1"] (i+1), |
|
358 |
ares_tac prems i]; |
|
359 |
||
360 |
||
361 |
(*** Fundamental properties of the epsilon ordering (< on ordinals) ***) |
|
362 |
||
363 |
(*Finds contradictions for the following proof*) |
|
364 |
val Ord_trans_tac = EVERY' [etac notE, etac Ord_trans, REPEAT o atac]; |
|
365 |
||
366 |
(** Proving that < is a linear ordering on the ordinals **) |
|
367 |
||
368 |
val prems = goal Ordinal.thy |
|
369 |
"Ord(i) ==> (ALL j. Ord(j) --> i:j | i=j | j:i)"; |
|
370 |
by (trans_ind_tac "i" prems 1); |
|
371 |
by (rtac (impI RS allI) 1); |
|
372 |
by (trans_ind_tac "j" [] 1); |
|
373 |
by (DEPTH_SOLVE (step_tac eq_cs 1 ORELSE Ord_trans_tac 1)); |
|
760 | 374 |
qed "Ord_linear_lemma"; |
782
200a16083201
added bind_thm for theorems defined by "standard ..."
clasohm
parents:
772
diff
changeset
|
375 |
bind_thm ("Ord_linear", Ord_linear_lemma RS spec RS mp); |
435 | 376 |
|
377 |
(*The trichotomy law for ordinals!*) |
|
378 |
val ordi::ordj::prems = goalw Ordinal.thy [lt_def] |
|
379 |
"[| Ord(i); Ord(j); i<j ==> P; i=j ==> P; j<i ==> P |] ==> P"; |
|
380 |
by (rtac ([ordi,ordj] MRS Ord_linear RS disjE) 1); |
|
381 |
by (etac disjE 2); |
|
382 |
by (DEPTH_SOLVE (ares_tac ([ordi,ordj,conjI] @ prems) 1)); |
|
760 | 383 |
qed "Ord_linear_lt"; |
435 | 384 |
|
385 |
val prems = goal Ordinal.thy |
|
386 |
"[| Ord(i); Ord(j); i<j ==> P; j le i ==> P |] ==> P"; |
|
387 |
by (res_inst_tac [("i","i"),("j","j")] Ord_linear_lt 1); |
|
388 |
by (DEPTH_SOLVE (ares_tac ([leI, sym RS le_eqI] @ prems) 1)); |
|
760 | 389 |
qed "Ord_linear2"; |
435 | 390 |
|
391 |
val prems = goal Ordinal.thy |
|
392 |
"[| Ord(i); Ord(j); i le j ==> P; j le i ==> P |] ==> P"; |
|
393 |
by (res_inst_tac [("i","i"),("j","j")] Ord_linear_lt 1); |
|
394 |
by (DEPTH_SOLVE (ares_tac ([leI,le_eqI] @ prems) 1)); |
|
760 | 395 |
qed "Ord_linear_le"; |
435 | 396 |
|
397 |
goal Ordinal.thy "!!i j. j le i ==> ~ i<j"; |
|
437 | 398 |
by (fast_tac (lt_cs addEs [lt_asym]) 1); |
760 | 399 |
qed "le_imp_not_lt"; |
435 | 400 |
|
401 |
goal Ordinal.thy "!!i j. [| ~ i<j; Ord(i); Ord(j) |] ==> j le i"; |
|
402 |
by (res_inst_tac [("i","i"),("j","j")] Ord_linear2 1); |
|
403 |
by (REPEAT (SOMEGOAL assume_tac)); |
|
437 | 404 |
by (fast_tac (lt_cs addEs [lt_asym]) 1); |
760 | 405 |
qed "not_lt_imp_le"; |
435 | 406 |
|
407 |
goal Ordinal.thy "!!i j. [| Ord(i); Ord(j) |] ==> ~ i<j <-> j le i"; |
|
408 |
by (REPEAT (ares_tac [iffI, le_imp_not_lt, not_lt_imp_le] 1)); |
|
760 | 409 |
qed "not_lt_iff_le"; |
435 | 410 |
|
411 |
goal Ordinal.thy "!!i j. [| Ord(i); Ord(j) |] ==> ~ i le j <-> j<i"; |
|
412 |
by (asm_simp_tac (ZF_ss addsimps [not_lt_iff_le RS iff_sym]) 1); |
|
760 | 413 |
qed "not_le_iff_lt"; |
435 | 414 |
|
415 |
goal Ordinal.thy "!!i. Ord(i) ==> 0 le i"; |
|
416 |
by (etac (not_lt_iff_le RS iffD1) 1); |
|
417 |
by (REPEAT (resolve_tac [Ord_0, not_lt0] 1)); |
|
760 | 418 |
qed "Ord_0_le"; |
435 | 419 |
|
420 |
goal Ordinal.thy "!!i. [| Ord(i); i~=0 |] ==> 0<i"; |
|
421 |
by (etac (not_le_iff_lt RS iffD1) 1); |
|
422 |
by (rtac Ord_0 1); |
|
423 |
by (fast_tac lt_cs 1); |
|
760 | 424 |
qed "Ord_0_lt"; |
435 | 425 |
|
426 |
(*** Results about less-than or equals ***) |
|
427 |
||
428 |
(** For ordinals, j<=i (subset) implies j le i (less-than or equals) **) |
|
429 |
||
430 |
goal Ordinal.thy "!!i j. [| j<=i; Ord(i); Ord(j) |] ==> j le i"; |
|
431 |
by (rtac (not_lt_iff_le RS iffD1) 1); |
|
432 |
by (assume_tac 1); |
|
433 |
by (assume_tac 1); |
|
437 | 434 |
by (fast_tac (ZF_cs addEs [ltE, mem_irrefl]) 1); |
760 | 435 |
qed "subset_imp_le"; |
435 | 436 |
|
437 |
goal Ordinal.thy "!!i j. i le j ==> i<=j"; |
|
438 |
by (etac leE 1); |
|
439 |
by (fast_tac ZF_cs 2); |
|
440 |
by (fast_tac (subset_cs addIs [OrdmemD] addEs [ltE]) 1); |
|
760 | 441 |
qed "le_imp_subset"; |
435 | 442 |
|
443 |
goal Ordinal.thy "j le i <-> j<=i & Ord(i) & Ord(j)"; |
|
444 |
by (fast_tac (ZF_cs addSEs [subset_imp_le, le_imp_subset] |
|
445 |
addEs [ltE, make_elim Ord_succD]) 1); |
|
760 | 446 |
qed "le_subset_iff"; |
435 | 447 |
|
448 |
goal Ordinal.thy "i le succ(j) <-> i le j | i=succ(j) & Ord(i)"; |
|
449 |
by (simp_tac (ZF_ss addsimps [le_iff]) 1); |
|
450 |
by (fast_tac (ZF_cs addIs [Ord_succ] addDs [Ord_succD]) 1); |
|
760 | 451 |
qed "le_succ_iff"; |
435 | 452 |
|
453 |
(*Just a variant of subset_imp_le*) |
|
454 |
val [ordi,ordj,minor] = goal Ordinal.thy |
|
455 |
"[| Ord(i); Ord(j); !!x. x<j ==> x<i |] ==> j le i"; |
|
456 |
by (REPEAT_FIRST (ares_tac [notI RS not_lt_imp_le, ordi, ordj])); |
|
437 | 457 |
by (etac (minor RS lt_irrefl) 1); |
760 | 458 |
qed "all_lt_imp_le"; |
435 | 459 |
|
460 |
(** Transitive laws **) |
|
461 |
||
462 |
goal Ordinal.thy "!!i j. [| i le j; j<k |] ==> i<k"; |
|
463 |
by (fast_tac (ZF_cs addEs [leE, lt_trans]) 1); |
|
760 | 464 |
qed "lt_trans1"; |
435 | 465 |
|
466 |
goal Ordinal.thy "!!i j. [| i<j; j le k |] ==> i<k"; |
|
467 |
by (fast_tac (ZF_cs addEs [leE, lt_trans]) 1); |
|
760 | 468 |
qed "lt_trans2"; |
435 | 469 |
|
470 |
goal Ordinal.thy "!!i j. [| i le j; j le k |] ==> i le k"; |
|
471 |
by (REPEAT (ares_tac [lt_trans1] 1)); |
|
760 | 472 |
qed "le_trans"; |
435 | 473 |
|
474 |
goal Ordinal.thy "!!i j. i<j ==> succ(i) le j"; |
|
475 |
by (rtac (not_lt_iff_le RS iffD1) 1); |
|
437 | 476 |
by (fast_tac (lt_cs addEs [lt_asym]) 3); |
435 | 477 |
by (ALLGOALS (fast_tac (ZF_cs addEs [ltE] addIs [Ord_succ]))); |
760 | 478 |
qed "succ_leI"; |
435 | 479 |
|
480 |
goal Ordinal.thy "!!i j. succ(i) le j ==> i<j"; |
|
481 |
by (rtac (not_le_iff_lt RS iffD1) 1); |
|
437 | 482 |
by (fast_tac (lt_cs addEs [lt_asym]) 3); |
435 | 483 |
by (ALLGOALS (fast_tac (ZF_cs addEs [ltE, make_elim Ord_succD]))); |
760 | 484 |
qed "succ_leE"; |
435 | 485 |
|
486 |
goal Ordinal.thy "succ(i) le j <-> i<j"; |
|
487 |
by (REPEAT (ares_tac [iffI,succ_leI,succ_leE] 1)); |
|
760 | 488 |
qed "succ_le_iff"; |
435 | 489 |
|
490 |
(** Union and Intersection **) |
|
491 |
||
492 |
goal Ordinal.thy "!!i j. [| Ord(i); Ord(j) |] ==> i le i Un j"; |
|
493 |
by (rtac (Un_upper1 RS subset_imp_le) 1); |
|
494 |
by (REPEAT (ares_tac [Ord_Un] 1)); |
|
760 | 495 |
qed "Un_upper1_le"; |
435 | 496 |
|
497 |
goal Ordinal.thy "!!i j. [| Ord(i); Ord(j) |] ==> j le i Un j"; |
|
498 |
by (rtac (Un_upper2 RS subset_imp_le) 1); |
|
499 |
by (REPEAT (ares_tac [Ord_Un] 1)); |
|
760 | 500 |
qed "Un_upper2_le"; |
435 | 501 |
|
502 |
(*Replacing k by succ(k') yields the similar rule for le!*) |
|
503 |
goal Ordinal.thy "!!i j k. [| i<k; j<k |] ==> i Un j < k"; |
|
504 |
by (res_inst_tac [("i","i"),("j","j")] Ord_linear_le 1); |
|
505 |
by (rtac (Un_commute RS ssubst) 4); |
|
506 |
by (asm_full_simp_tac (ZF_ss addsimps [le_subset_iff, subset_Un_iff]) 4); |
|
507 |
by (asm_full_simp_tac (ZF_ss addsimps [le_subset_iff, subset_Un_iff]) 3); |
|
508 |
by (REPEAT (eresolve_tac [asm_rl, ltE] 1)); |
|
760 | 509 |
qed "Un_least_lt"; |
435 | 510 |
|
511 |
goal Ordinal.thy "!!i j. [| Ord(i); Ord(j) |] ==> i Un j < k <-> i<k & j<k"; |
|
512 |
by (safe_tac (ZF_cs addSIs [Un_least_lt])); |
|
437 | 513 |
by (rtac (Un_upper2_le RS lt_trans1) 2); |
514 |
by (rtac (Un_upper1_le RS lt_trans1) 1); |
|
435 | 515 |
by (REPEAT_SOME assume_tac); |
760 | 516 |
qed "Un_least_lt_iff"; |
435 | 517 |
|
518 |
val [ordi,ordj,ordk] = goal Ordinal.thy |
|
519 |
"[| Ord(i); Ord(j); Ord(k) |] ==> i Un j : k <-> i:k & j:k"; |
|
520 |
by (cut_facts_tac [[ordi,ordj] MRS |
|
521 |
read_instantiate [("k","k")] Un_least_lt_iff] 1); |
|
522 |
by (asm_full_simp_tac (ZF_ss addsimps [lt_def,ordi,ordj,ordk]) 1); |
|
760 | 523 |
qed "Un_least_mem_iff"; |
435 | 524 |
|
525 |
(*Replacing k by succ(k') yields the similar rule for le!*) |
|
526 |
goal Ordinal.thy "!!i j k. [| i<k; j<k |] ==> i Int j < k"; |
|
527 |
by (res_inst_tac [("i","i"),("j","j")] Ord_linear_le 1); |
|
528 |
by (rtac (Int_commute RS ssubst) 4); |
|
529 |
by (asm_full_simp_tac (ZF_ss addsimps [le_subset_iff, subset_Int_iff]) 4); |
|
530 |
by (asm_full_simp_tac (ZF_ss addsimps [le_subset_iff, subset_Int_iff]) 3); |
|
531 |
by (REPEAT (eresolve_tac [asm_rl, ltE] 1)); |
|
760 | 532 |
qed "Int_greatest_lt"; |
435 | 533 |
|
534 |
(*FIXME: the Intersection duals are missing!*) |
|
535 |
||
536 |
||
537 |
(*** Results about limits ***) |
|
538 |
||
539 |
val prems = goal Ordinal.thy "[| !!i. i:A ==> Ord(i) |] ==> Ord(Union(A))"; |
|
540 |
by (rtac (Ord_is_Transset RS Transset_Union_family RS OrdI) 1); |
|
541 |
by (REPEAT (etac UnionE 1 ORELSE ares_tac ([Ord_contains_Transset]@prems) 1)); |
|
760 | 542 |
qed "Ord_Union"; |
435 | 543 |
|
544 |
val prems = goal Ordinal.thy |
|
545 |
"[| !!x. x:A ==> Ord(B(x)) |] ==> Ord(UN x:A. B(x))"; |
|
546 |
by (rtac Ord_Union 1); |
|
547 |
by (etac RepFunE 1); |
|
548 |
by (etac ssubst 1); |
|
549 |
by (eresolve_tac prems 1); |
|
760 | 550 |
qed "Ord_UN"; |
435 | 551 |
|
552 |
(* No < version; consider (UN i:nat.i)=nat *) |
|
553 |
val [ordi,limit] = goal Ordinal.thy |
|
554 |
"[| Ord(i); !!x. x:A ==> b(x) le i |] ==> (UN x:A. b(x)) le i"; |
|
555 |
by (rtac (le_imp_subset RS UN_least RS subset_imp_le) 1); |
|
556 |
by (REPEAT (ares_tac [ordi, Ord_UN, limit] 1 ORELSE etac (limit RS ltE) 1)); |
|
760 | 557 |
qed "UN_least_le"; |
435 | 558 |
|
559 |
val [jlti,limit] = goal Ordinal.thy |
|
560 |
"[| j<i; !!x. x:A ==> b(x)<j |] ==> (UN x:A. succ(b(x))) < i"; |
|
561 |
by (rtac (jlti RS ltE) 1); |
|
562 |
by (rtac (UN_least_le RS lt_trans2) 1); |
|
563 |
by (REPEAT (ares_tac [jlti, succ_leI, limit] 1)); |
|
760 | 564 |
qed "UN_succ_least_lt"; |
435 | 565 |
|
566 |
val prems = goal Ordinal.thy |
|
567 |
"[| a: A; i le b(a); !!x. x:A ==> Ord(b(x)) |] ==> i le (UN x:A. b(x))"; |
|
568 |
by (resolve_tac (prems RL [ltE]) 1); |
|
569 |
by (rtac (le_imp_subset RS subset_trans RS subset_imp_le) 1); |
|
570 |
by (REPEAT (ares_tac (prems @ [UN_upper, Ord_UN]) 1)); |
|
760 | 571 |
qed "UN_upper_le"; |
435 | 572 |
|
573 |
goal Ordinal.thy "!!i. Ord(i) ==> (UN y:i. succ(y)) = i"; |
|
574 |
by (fast_tac (eq_cs addEs [Ord_trans]) 1); |
|
760 | 575 |
qed "Ord_equality"; |
435 | 576 |
|
577 |
(*Holds for all transitive sets, not just ordinals*) |
|
578 |
goal Ordinal.thy "!!i. Ord(i) ==> Union(i) <= i"; |
|
579 |
by (fast_tac (ZF_cs addSEs [Ord_trans]) 1); |
|
760 | 580 |
qed "Ord_Union_subset"; |
435 | 581 |
|
582 |
||
583 |
(*** Limit ordinals -- general properties ***) |
|
584 |
||
585 |
goalw Ordinal.thy [Limit_def] "!!i. Limit(i) ==> Union(i) = i"; |
|
586 |
by (fast_tac (eq_cs addSIs [ltI] addSEs [ltE] addEs [Ord_trans]) 1); |
|
760 | 587 |
qed "Limit_Union_eq"; |
435 | 588 |
|
589 |
goalw Ordinal.thy [Limit_def] "!!i. Limit(i) ==> Ord(i)"; |
|
590 |
by (etac conjunct1 1); |
|
760 | 591 |
qed "Limit_is_Ord"; |
435 | 592 |
|
593 |
goalw Ordinal.thy [Limit_def] "!!i. Limit(i) ==> 0 < i"; |
|
594 |
by (etac (conjunct2 RS conjunct1) 1); |
|
760 | 595 |
qed "Limit_has_0"; |
435 | 596 |
|
597 |
goalw Ordinal.thy [Limit_def] "!!i. [| Limit(i); j<i |] ==> succ(j) < i"; |
|
598 |
by (fast_tac ZF_cs 1); |
|
760 | 599 |
qed "Limit_has_succ"; |
435 | 600 |
|
601 |
goalw Ordinal.thy [Limit_def] |
|
602 |
"!!i. [| 0<i; ALL y. succ(y) ~= i |] ==> Limit(i)"; |
|
603 |
by (safe_tac subset_cs); |
|
604 |
by (rtac (not_le_iff_lt RS iffD1) 2); |
|
437 | 605 |
by (fast_tac (lt_cs addEs [lt_asym]) 4); |
435 | 606 |
by (REPEAT (eresolve_tac [asm_rl, ltE, Ord_succ] 1)); |
760 | 607 |
qed "non_succ_LimitI"; |
435 | 608 |
|
609 |
goal Ordinal.thy "!!i. Limit(succ(i)) ==> P"; |
|
437 | 610 |
by (rtac lt_irrefl 1); |
611 |
by (rtac Limit_has_succ 1); |
|
612 |
by (assume_tac 1); |
|
613 |
by (etac (Limit_is_Ord RS Ord_succD RS le_refl) 1); |
|
760 | 614 |
qed "succ_LimitE"; |
435 | 615 |
|
616 |
goal Ordinal.thy "!!i. [| Limit(i); i le succ(j) |] ==> i le j"; |
|
617 |
by (safe_tac (ZF_cs addSEs [succ_LimitE, leE])); |
|
760 | 618 |
qed "Limit_le_succD"; |
435 | 619 |
|
620 |