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);
|
|
17 |
val Transset_iff_Pow = result();
|
|
18 |
|
|
19 |
goalw Ordinal.thy [Transset_def] "Transset(A) <-> Union(succ(A)) = A";
|
|
20 |
by (fast_tac (eq_cs addSEs [equalityE]) 1);
|
|
21 |
val Transset_iff_Union_succ = result();
|
|
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);
|
|
28 |
val Transset_doubleton_D = result();
|
|
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);
|
|
34 |
val Transset_Pair_D = result();
|
|
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);
|
|
40 |
val Transset_includes_domain = result();
|
|
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);
|
|
46 |
val Transset_includes_range = result();
|
|
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);
|
|
65 |
val Transset_0 = result();
|
|
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);
|
|
70 |
val Transset_Un = result();
|
|
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);
|
|
75 |
val Transset_Int = result();
|
|
76 |
|
|
77 |
goalw Ordinal.thy [Transset_def] "!!i. Transset(i) ==> Transset(succ(i))";
|
|
78 |
by (fast_tac ZF_cs 1);
|
|
79 |
val Transset_succ = result();
|
|
80 |
|
|
81 |
goalw Ordinal.thy [Transset_def] "!!i. Transset(i) ==> Transset(Pow(i))";
|
|
82 |
by (fast_tac ZF_cs 1);
|
|
83 |
val Transset_Pow = result();
|
|
84 |
|
|
85 |
goalw Ordinal.thy [Transset_def] "!!A. Transset(A) ==> Transset(Union(A))";
|
|
86 |
by (fast_tac ZF_cs 1);
|
|
87 |
val Transset_Union = result();
|
|
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);
|
|
92 |
val Transset_Union_family = result();
|
|
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);
|
|
98 |
val Transset_Inter_family = result();
|
|
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));
|
|
105 |
val OrdI = result();
|
|
106 |
|
|
107 |
val [major] = goalw Ordinal.thy [Ord_def]
|
|
108 |
"Ord(i) ==> Transset(i)";
|
|
109 |
by (rtac (major RS conjunct1) 1);
|
|
110 |
val Ord_is_Transset = result();
|
|
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);
|
|
115 |
val Ord_contains_Transset = result();
|
|
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);
|
|
121 |
val Ord_in_Ord = result();
|
|
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));
|
|
129 |
val Ord_subset_Ord = result();
|
|
130 |
|
|
131 |
goalw Ordinal.thy [Ord_def,Transset_def] "!!i j. [| j:i; Ord(i) |] ==> j<=i";
|
|
132 |
by (fast_tac ZF_cs 1);
|
|
133 |
val OrdmemD = result();
|
|
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));
|
|
137 |
val Ord_trans = result();
|
|
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));
|
|
141 |
val Ord_succ_subsetI = result();
|
|
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));
|
|
148 |
val Ord_0 = result();
|
|
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));
|
|
154 |
val Ord_succ = result();
|
|
155 |
|
|
156 |
goal Ordinal.thy "Ord(succ(i)) <-> Ord(i)";
|
|
157 |
by (fast_tac (ZF_cs addIs [Ord_succ] addDs [Ord_succD]) 1);
|
|
158 |
val Ord_succ_iff = result();
|
|
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);
|
|
162 |
val Ord_Un = result();
|
|
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);
|
|
166 |
val Ord_Int = result();
|
|
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));
|
|
174 |
val Ord_Inter = result();
|
|
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);
|
|
182 |
val Ord_INT = result();
|
|
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));
|
|
195 |
val ON_class = result();
|
|
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));
|
|
201 |
val ltI = result();
|
|
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));
|
|
207 |
val ltE = result();
|
|
208 |
|
|
209 |
goal Ordinal.thy "!!i j. i<j ==> i:j";
|
|
210 |
by (etac ltE 1);
|
|
211 |
by (assume_tac 1);
|
|
212 |
val ltD = result();
|
|
213 |
|
|
214 |
goalw Ordinal.thy [lt_def] "~ i<0";
|
|
215 |
by (fast_tac ZF_cs 1);
|
|
216 |
val not_lt0 = result();
|
|
217 |
|
|
218 |
(* i<0 ==> R *)
|
|
219 |
val lt0E = standard (not_lt0 RS notE);
|
|
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);
|
|
223 |
val lt_trans = result();
|
|
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));
|
|
227 |
val lt_asym = result();
|
435
|
228 |
|
437
|
229 |
val lt_irrefl = prove_goal Ordinal.thy "i<i ==> P"
|
|
230 |
(fn [major]=> [ (rtac (major RS (major RS lt_asym)) 1) ]);
|
435
|
231 |
|
|
232 |
val lt_not_refl = prove_goal 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);
|
|
239 |
val le_iff = result();
|
|
240 |
|
|
241 |
goal Ordinal.thy "!!i j. i<j ==> i le j";
|
|
242 |
by (asm_simp_tac (ZF_ss addsimps [le_iff]) 1);
|
|
243 |
val leI = result();
|
|
244 |
|
|
245 |
goal Ordinal.thy "!!i. [| i=j; Ord(j) |] ==> i le j";
|
|
246 |
by (asm_simp_tac (ZF_ss addsimps [le_iff]) 1);
|
|
247 |
val le_eqI = result();
|
|
248 |
|
|
249 |
val le_refl = refl RS le_eqI;
|
|
250 |
|
|
251 |
val [prem] = goal Ordinal.thy "(~ (i=j & Ord(j)) ==> i<j) ==> i le j";
|
|
252 |
by (rtac (disjCI RS (le_iff RS iffD2)) 1);
|
|
253 |
by (etac prem 1);
|
|
254 |
val leCI = result();
|
|
255 |
|
|
256 |
val major::prems = goal Ordinal.thy
|
|
257 |
"[| i le j; i<j ==> P; [| i=j; Ord(j) |] ==> P |] ==> P";
|
|
258 |
by (rtac (major RS (le_iff RS iffD1 RS disjE)) 1);
|
|
259 |
by (DEPTH_SOLVE (ares_tac prems 1 ORELSE etac conjE 1));
|
|
260 |
val leE = result();
|
|
261 |
|
|
262 |
goal Ordinal.thy "!!i j. [| i le j; j le i |] ==> i=j";
|
|
263 |
by (asm_full_simp_tac (ZF_ss addsimps [le_iff]) 1);
|
437
|
264 |
by (fast_tac (ZF_cs addEs [lt_asym]) 1);
|
|
265 |
val le_anti_sym = result();
|
435
|
266 |
|
|
267 |
goal Ordinal.thy "i le 0 <-> i=0";
|
|
268 |
by (fast_tac (ZF_cs addSIs [Ord_0 RS le_refl] addSEs [leE, lt0E]) 1);
|
|
269 |
val le0_iff = result();
|
|
270 |
|
|
271 |
val le0D = standard (le0_iff RS iffD1);
|
|
272 |
|
|
273 |
val lt_cs =
|
|
274 |
ZF_cs addSIs [le_refl, leCI]
|
|
275 |
addSDs [le0D]
|
437
|
276 |
addSEs [lt_irrefl, lt0E, leE];
|
435
|
277 |
|
|
278 |
|
|
279 |
(*** Natural Deduction rules for Memrel ***)
|
|
280 |
|
|
281 |
goalw Ordinal.thy [Memrel_def] "<a,b> : Memrel(A) <-> a:b & a:A & b:A";
|
|
282 |
by (fast_tac ZF_cs 1);
|
|
283 |
val Memrel_iff = result();
|
|
284 |
|
|
285 |
val prems = goal Ordinal.thy "[| a: b; a: A; b: A |] ==> <a,b> : Memrel(A)";
|
|
286 |
by (REPEAT (resolve_tac (prems@[conjI, Memrel_iff RS iffD2]) 1));
|
|
287 |
val MemrelI = result();
|
|
288 |
|
|
289 |
val [major,minor] = goal Ordinal.thy
|
|
290 |
"[| <a,b> : Memrel(A); \
|
|
291 |
\ [| a: A; b: A; a:b |] ==> P \
|
|
292 |
\ |] ==> P";
|
|
293 |
by (rtac (major RS (Memrel_iff RS iffD1) RS conjE) 1);
|
|
294 |
by (etac conjE 1);
|
|
295 |
by (rtac minor 1);
|
|
296 |
by (REPEAT (assume_tac 1));
|
|
297 |
val MemrelE = result();
|
|
298 |
|
|
299 |
(*The membership relation (as a set) is well-founded.
|
|
300 |
Proof idea: show A<=B by applying the foundation axiom to A-B *)
|
|
301 |
goalw Ordinal.thy [wf_def] "wf(Memrel(A))";
|
|
302 |
by (EVERY1 [rtac (foundation RS disjE RS allI),
|
|
303 |
etac disjI1,
|
|
304 |
etac bexE,
|
|
305 |
rtac (impI RS allI RS bexI RS disjI2),
|
|
306 |
etac MemrelE,
|
|
307 |
etac bspec,
|
|
308 |
REPEAT o assume_tac]);
|
|
309 |
val wf_Memrel = result();
|
|
310 |
|
|
311 |
(*Transset(i) does not suffice, though ALL j:i.Transset(j) does*)
|
|
312 |
goalw Ordinal.thy [Ord_def, Transset_def, trans_def]
|
|
313 |
"!!i. Ord(i) ==> trans(Memrel(i))";
|
|
314 |
by (fast_tac (ZF_cs addSIs [MemrelI] addSEs [MemrelE]) 1);
|
|
315 |
val trans_Memrel = result();
|
|
316 |
|
|
317 |
(*If Transset(A) then Memrel(A) internalizes the membership relation below A*)
|
|
318 |
goalw Ordinal.thy [Transset_def]
|
|
319 |
"!!A. Transset(A) ==> <a,b> : Memrel(A) <-> a:b & b:A";
|
|
320 |
by (fast_tac (ZF_cs addSIs [MemrelI] addSEs [MemrelE]) 1);
|
|
321 |
val Transset_Memrel_iff = result();
|
|
322 |
|
|
323 |
|
|
324 |
(*** Transfinite induction ***)
|
|
325 |
|
|
326 |
(*Epsilon induction over a transitive set*)
|
|
327 |
val major::prems = goalw Ordinal.thy [Transset_def]
|
|
328 |
"[| i: k; Transset(k); \
|
|
329 |
\ !!x.[| x: k; ALL y:x. P(y) |] ==> P(x) \
|
|
330 |
\ |] ==> P(i)";
|
|
331 |
by (rtac (major RS (wf_Memrel RS wf_induct2)) 1);
|
|
332 |
by (fast_tac (ZF_cs addEs [MemrelE]) 1);
|
|
333 |
by (resolve_tac prems 1);
|
|
334 |
by (assume_tac 1);
|
|
335 |
by (cut_facts_tac prems 1);
|
|
336 |
by (fast_tac (ZF_cs addIs [MemrelI]) 1);
|
|
337 |
val Transset_induct = result();
|
|
338 |
|
|
339 |
(*Induction over an ordinal*)
|
|
340 |
val Ord_induct = Ord_is_Transset RSN (2, Transset_induct);
|
|
341 |
|
|
342 |
(*Induction over the class of ordinals -- a useful corollary of Ord_induct*)
|
|
343 |
val [major,indhyp] = goal Ordinal.thy
|
|
344 |
"[| Ord(i); \
|
|
345 |
\ !!x.[| Ord(x); ALL y:x. P(y) |] ==> P(x) \
|
|
346 |
\ |] ==> P(i)";
|
|
347 |
by (rtac (major RS Ord_succ RS (succI1 RS Ord_induct)) 1);
|
|
348 |
by (rtac indhyp 1);
|
|
349 |
by (rtac (major RS Ord_succ RS Ord_in_Ord) 1);
|
|
350 |
by (REPEAT (assume_tac 1));
|
|
351 |
val trans_induct = result();
|
|
352 |
|
|
353 |
(*Perform induction on i, then prove the Ord(i) subgoal using prems. *)
|
|
354 |
fun trans_ind_tac a prems i =
|
|
355 |
EVERY [res_inst_tac [("i",a)] trans_induct i,
|
|
356 |
rename_last_tac a ["1"] (i+1),
|
|
357 |
ares_tac prems i];
|
|
358 |
|
|
359 |
|
|
360 |
(*** Fundamental properties of the epsilon ordering (< on ordinals) ***)
|
|
361 |
|
|
362 |
(*Finds contradictions for the following proof*)
|
|
363 |
val Ord_trans_tac = EVERY' [etac notE, etac Ord_trans, REPEAT o atac];
|
|
364 |
|
|
365 |
(** Proving that < is a linear ordering on the ordinals **)
|
|
366 |
|
|
367 |
val prems = goal Ordinal.thy
|
|
368 |
"Ord(i) ==> (ALL j. Ord(j) --> i:j | i=j | j:i)";
|
|
369 |
by (trans_ind_tac "i" prems 1);
|
|
370 |
by (rtac (impI RS allI) 1);
|
|
371 |
by (trans_ind_tac "j" [] 1);
|
|
372 |
by (DEPTH_SOLVE (step_tac eq_cs 1 ORELSE Ord_trans_tac 1));
|
|
373 |
val Ord_linear_lemma = result();
|
|
374 |
val Ord_linear = standard (Ord_linear_lemma RS spec RS mp);
|
|
375 |
|
|
376 |
(*The trichotomy law for ordinals!*)
|
|
377 |
val ordi::ordj::prems = goalw Ordinal.thy [lt_def]
|
|
378 |
"[| Ord(i); Ord(j); i<j ==> P; i=j ==> P; j<i ==> P |] ==> P";
|
|
379 |
by (rtac ([ordi,ordj] MRS Ord_linear RS disjE) 1);
|
|
380 |
by (etac disjE 2);
|
|
381 |
by (DEPTH_SOLVE (ares_tac ([ordi,ordj,conjI] @ prems) 1));
|
|
382 |
val Ord_linear_lt = result();
|
|
383 |
|
|
384 |
val prems = goal Ordinal.thy
|
|
385 |
"[| Ord(i); Ord(j); i<j ==> P; j le i ==> P |] ==> P";
|
|
386 |
by (res_inst_tac [("i","i"),("j","j")] Ord_linear_lt 1);
|
|
387 |
by (DEPTH_SOLVE (ares_tac ([leI, sym RS le_eqI] @ prems) 1));
|
|
388 |
val Ord_linear2 = result();
|
|
389 |
|
|
390 |
val prems = goal Ordinal.thy
|
|
391 |
"[| Ord(i); Ord(j); i le j ==> P; j le i ==> P |] ==> P";
|
|
392 |
by (res_inst_tac [("i","i"),("j","j")] Ord_linear_lt 1);
|
|
393 |
by (DEPTH_SOLVE (ares_tac ([leI,le_eqI] @ prems) 1));
|
|
394 |
val Ord_linear_le = result();
|
|
395 |
|
|
396 |
goal Ordinal.thy "!!i j. j le i ==> ~ i<j";
|
437
|
397 |
by (fast_tac (lt_cs addEs [lt_asym]) 1);
|
435
|
398 |
val le_imp_not_lt = result();
|
|
399 |
|
|
400 |
goal Ordinal.thy "!!i j. [| ~ i<j; Ord(i); Ord(j) |] ==> j le i";
|
|
401 |
by (res_inst_tac [("i","i"),("j","j")] Ord_linear2 1);
|
|
402 |
by (REPEAT (SOMEGOAL assume_tac));
|
437
|
403 |
by (fast_tac (lt_cs addEs [lt_asym]) 1);
|
435
|
404 |
val not_lt_imp_le = result();
|
|
405 |
|
|
406 |
goal Ordinal.thy "!!i j. [| Ord(i); Ord(j) |] ==> ~ i<j <-> j le i";
|
|
407 |
by (REPEAT (ares_tac [iffI, le_imp_not_lt, not_lt_imp_le] 1));
|
|
408 |
val not_lt_iff_le = result();
|
|
409 |
|
|
410 |
goal Ordinal.thy "!!i j. [| Ord(i); Ord(j) |] ==> ~ i le j <-> j<i";
|
|
411 |
by (asm_simp_tac (ZF_ss addsimps [not_lt_iff_le RS iff_sym]) 1);
|
|
412 |
val not_le_iff_lt = result();
|
|
413 |
|
|
414 |
goal Ordinal.thy "!!i. Ord(i) ==> 0 le i";
|
|
415 |
by (etac (not_lt_iff_le RS iffD1) 1);
|
|
416 |
by (REPEAT (resolve_tac [Ord_0, not_lt0] 1));
|
|
417 |
val Ord_0_le = result();
|
|
418 |
|
|
419 |
goal Ordinal.thy "!!i. [| Ord(i); i~=0 |] ==> 0<i";
|
|
420 |
by (etac (not_le_iff_lt RS iffD1) 1);
|
|
421 |
by (rtac Ord_0 1);
|
|
422 |
by (fast_tac lt_cs 1);
|
|
423 |
val Ord_0_lt = result();
|
|
424 |
|
|
425 |
(*** Results about less-than or equals ***)
|
|
426 |
|
|
427 |
(** For ordinals, j<=i (subset) implies j le i (less-than or equals) **)
|
|
428 |
|
|
429 |
goal Ordinal.thy "!!i j. [| j<=i; Ord(i); Ord(j) |] ==> j le i";
|
|
430 |
by (rtac (not_lt_iff_le RS iffD1) 1);
|
|
431 |
by (assume_tac 1);
|
|
432 |
by (assume_tac 1);
|
437
|
433 |
by (fast_tac (ZF_cs addEs [ltE, mem_irrefl]) 1);
|
435
|
434 |
val subset_imp_le = result();
|
|
435 |
|
|
436 |
goal Ordinal.thy "!!i j. i le j ==> i<=j";
|
|
437 |
by (etac leE 1);
|
|
438 |
by (fast_tac ZF_cs 2);
|
|
439 |
by (fast_tac (subset_cs addIs [OrdmemD] addEs [ltE]) 1);
|
|
440 |
val le_imp_subset = result();
|
|
441 |
|
|
442 |
goal Ordinal.thy "j le i <-> j<=i & Ord(i) & Ord(j)";
|
|
443 |
by (fast_tac (ZF_cs addSEs [subset_imp_le, le_imp_subset]
|
|
444 |
addEs [ltE, make_elim Ord_succD]) 1);
|
|
445 |
val le_subset_iff = result();
|
|
446 |
|
|
447 |
goal Ordinal.thy "i le succ(j) <-> i le j | i=succ(j) & Ord(i)";
|
|
448 |
by (simp_tac (ZF_ss addsimps [le_iff]) 1);
|
|
449 |
by (fast_tac (ZF_cs addIs [Ord_succ] addDs [Ord_succD]) 1);
|
|
450 |
val le_succ_iff = result();
|
|
451 |
|
|
452 |
(*Just a variant of subset_imp_le*)
|
|
453 |
val [ordi,ordj,minor] = goal Ordinal.thy
|
|
454 |
"[| Ord(i); Ord(j); !!x. x<j ==> x<i |] ==> j le i";
|
|
455 |
by (REPEAT_FIRST (ares_tac [notI RS not_lt_imp_le, ordi, ordj]));
|
437
|
456 |
by (etac (minor RS lt_irrefl) 1);
|
435
|
457 |
val all_lt_imp_le = result();
|
|
458 |
|
|
459 |
(** Transitive laws **)
|
|
460 |
|
|
461 |
goal Ordinal.thy "!!i j. [| i le j; j<k |] ==> i<k";
|
|
462 |
by (fast_tac (ZF_cs addEs [leE, lt_trans]) 1);
|
|
463 |
val lt_trans1 = result();
|
|
464 |
|
|
465 |
goal Ordinal.thy "!!i j. [| i<j; j le k |] ==> i<k";
|
|
466 |
by (fast_tac (ZF_cs addEs [leE, lt_trans]) 1);
|
|
467 |
val lt_trans2 = result();
|
|
468 |
|
|
469 |
goal Ordinal.thy "!!i j. [| i le j; j le k |] ==> i le k";
|
|
470 |
by (REPEAT (ares_tac [lt_trans1] 1));
|
|
471 |
val le_trans = result();
|
|
472 |
|
|
473 |
goal Ordinal.thy "!!i j. i<j ==> succ(i) le j";
|
|
474 |
by (rtac (not_lt_iff_le RS iffD1) 1);
|
437
|
475 |
by (fast_tac (lt_cs addEs [lt_asym]) 3);
|
435
|
476 |
by (ALLGOALS (fast_tac (ZF_cs addEs [ltE] addIs [Ord_succ])));
|
|
477 |
val succ_leI = result();
|
|
478 |
|
|
479 |
goal Ordinal.thy "!!i j. succ(i) le j ==> i<j";
|
|
480 |
by (rtac (not_le_iff_lt RS iffD1) 1);
|
437
|
481 |
by (fast_tac (lt_cs addEs [lt_asym]) 3);
|
435
|
482 |
by (ALLGOALS (fast_tac (ZF_cs addEs [ltE, make_elim Ord_succD])));
|
|
483 |
val succ_leE = result();
|
|
484 |
|
|
485 |
goal Ordinal.thy "succ(i) le j <-> i<j";
|
|
486 |
by (REPEAT (ares_tac [iffI,succ_leI,succ_leE] 1));
|
|
487 |
val succ_le_iff = result();
|
|
488 |
|
|
489 |
(** Union and Intersection **)
|
|
490 |
|
|
491 |
goal Ordinal.thy "!!i j. [| Ord(i); Ord(j) |] ==> i le i Un j";
|
|
492 |
by (rtac (Un_upper1 RS subset_imp_le) 1);
|
|
493 |
by (REPEAT (ares_tac [Ord_Un] 1));
|
|
494 |
val Un_upper1_le = result();
|
|
495 |
|
|
496 |
goal Ordinal.thy "!!i j. [| Ord(i); Ord(j) |] ==> j le i Un j";
|
|
497 |
by (rtac (Un_upper2 RS subset_imp_le) 1);
|
|
498 |
by (REPEAT (ares_tac [Ord_Un] 1));
|
|
499 |
val Un_upper2_le = result();
|
|
500 |
|
|
501 |
(*Replacing k by succ(k') yields the similar rule for le!*)
|
|
502 |
goal Ordinal.thy "!!i j k. [| i<k; j<k |] ==> i Un j < k";
|
|
503 |
by (res_inst_tac [("i","i"),("j","j")] Ord_linear_le 1);
|
|
504 |
by (rtac (Un_commute RS ssubst) 4);
|
|
505 |
by (asm_full_simp_tac (ZF_ss addsimps [le_subset_iff, subset_Un_iff]) 4);
|
|
506 |
by (asm_full_simp_tac (ZF_ss addsimps [le_subset_iff, subset_Un_iff]) 3);
|
|
507 |
by (REPEAT (eresolve_tac [asm_rl, ltE] 1));
|
|
508 |
val Un_least_lt = result();
|
|
509 |
|
|
510 |
goal Ordinal.thy "!!i j. [| Ord(i); Ord(j) |] ==> i Un j < k <-> i<k & j<k";
|
|
511 |
by (safe_tac (ZF_cs addSIs [Un_least_lt]));
|
437
|
512 |
by (rtac (Un_upper2_le RS lt_trans1) 2);
|
|
513 |
by (rtac (Un_upper1_le RS lt_trans1) 1);
|
435
|
514 |
by (REPEAT_SOME assume_tac);
|
|
515 |
val Un_least_lt_iff = result();
|
|
516 |
|
|
517 |
val [ordi,ordj,ordk] = goal Ordinal.thy
|
|
518 |
"[| Ord(i); Ord(j); Ord(k) |] ==> i Un j : k <-> i:k & j:k";
|
|
519 |
by (cut_facts_tac [[ordi,ordj] MRS
|
|
520 |
read_instantiate [("k","k")] Un_least_lt_iff] 1);
|
|
521 |
by (asm_full_simp_tac (ZF_ss addsimps [lt_def,ordi,ordj,ordk]) 1);
|
|
522 |
val Un_least_mem_iff = result();
|
|
523 |
|
|
524 |
(*Replacing k by succ(k') yields the similar rule for le!*)
|
|
525 |
goal Ordinal.thy "!!i j k. [| i<k; j<k |] ==> i Int j < k";
|
|
526 |
by (res_inst_tac [("i","i"),("j","j")] Ord_linear_le 1);
|
|
527 |
by (rtac (Int_commute RS ssubst) 4);
|
|
528 |
by (asm_full_simp_tac (ZF_ss addsimps [le_subset_iff, subset_Int_iff]) 4);
|
|
529 |
by (asm_full_simp_tac (ZF_ss addsimps [le_subset_iff, subset_Int_iff]) 3);
|
|
530 |
by (REPEAT (eresolve_tac [asm_rl, ltE] 1));
|
|
531 |
val Int_greatest_lt = result();
|
|
532 |
|
|
533 |
(*FIXME: the Intersection duals are missing!*)
|
|
534 |
|
|
535 |
|
|
536 |
(*** Results about limits ***)
|
|
537 |
|
|
538 |
val prems = goal Ordinal.thy "[| !!i. i:A ==> Ord(i) |] ==> Ord(Union(A))";
|
|
539 |
by (rtac (Ord_is_Transset RS Transset_Union_family RS OrdI) 1);
|
|
540 |
by (REPEAT (etac UnionE 1 ORELSE ares_tac ([Ord_contains_Transset]@prems) 1));
|
|
541 |
val Ord_Union = result();
|
|
542 |
|
|
543 |
val prems = goal Ordinal.thy
|
|
544 |
"[| !!x. x:A ==> Ord(B(x)) |] ==> Ord(UN x:A. B(x))";
|
|
545 |
by (rtac Ord_Union 1);
|
|
546 |
by (etac RepFunE 1);
|
|
547 |
by (etac ssubst 1);
|
|
548 |
by (eresolve_tac prems 1);
|
|
549 |
val Ord_UN = result();
|
|
550 |
|
|
551 |
(* No < version; consider (UN i:nat.i)=nat *)
|
|
552 |
val [ordi,limit] = goal Ordinal.thy
|
|
553 |
"[| Ord(i); !!x. x:A ==> b(x) le i |] ==> (UN x:A. b(x)) le i";
|
|
554 |
by (rtac (le_imp_subset RS UN_least RS subset_imp_le) 1);
|
|
555 |
by (REPEAT (ares_tac [ordi, Ord_UN, limit] 1 ORELSE etac (limit RS ltE) 1));
|
|
556 |
val UN_least_le = result();
|
|
557 |
|
|
558 |
val [jlti,limit] = goal Ordinal.thy
|
|
559 |
"[| j<i; !!x. x:A ==> b(x)<j |] ==> (UN x:A. succ(b(x))) < i";
|
|
560 |
by (rtac (jlti RS ltE) 1);
|
|
561 |
by (rtac (UN_least_le RS lt_trans2) 1);
|
|
562 |
by (REPEAT (ares_tac [jlti, succ_leI, limit] 1));
|
|
563 |
val UN_succ_least_lt = result();
|
|
564 |
|
|
565 |
val prems = goal Ordinal.thy
|
|
566 |
"[| a: A; i le b(a); !!x. x:A ==> Ord(b(x)) |] ==> i le (UN x:A. b(x))";
|
|
567 |
by (resolve_tac (prems RL [ltE]) 1);
|
|
568 |
by (rtac (le_imp_subset RS subset_trans RS subset_imp_le) 1);
|
|
569 |
by (REPEAT (ares_tac (prems @ [UN_upper, Ord_UN]) 1));
|
|
570 |
val UN_upper_le = result();
|
|
571 |
|
|
572 |
goal Ordinal.thy "!!i. Ord(i) ==> (UN y:i. succ(y)) = i";
|
|
573 |
by (fast_tac (eq_cs addEs [Ord_trans]) 1);
|
|
574 |
val Ord_equality = result();
|
|
575 |
|
|
576 |
(*Holds for all transitive sets, not just ordinals*)
|
|
577 |
goal Ordinal.thy "!!i. Ord(i) ==> Union(i) <= i";
|
|
578 |
by (fast_tac (ZF_cs addSEs [Ord_trans]) 1);
|
|
579 |
val Ord_Union_subset = result();
|
|
580 |
|
|
581 |
|
|
582 |
(*** Limit ordinals -- general properties ***)
|
|
583 |
|
|
584 |
goalw Ordinal.thy [Limit_def] "!!i. Limit(i) ==> Union(i) = i";
|
|
585 |
by (fast_tac (eq_cs addSIs [ltI] addSEs [ltE] addEs [Ord_trans]) 1);
|
|
586 |
val Limit_Union_eq = result();
|
|
587 |
|
|
588 |
goalw Ordinal.thy [Limit_def] "!!i. Limit(i) ==> Ord(i)";
|
|
589 |
by (etac conjunct1 1);
|
|
590 |
val Limit_is_Ord = result();
|
|
591 |
|
|
592 |
goalw Ordinal.thy [Limit_def] "!!i. Limit(i) ==> 0 < i";
|
|
593 |
by (etac (conjunct2 RS conjunct1) 1);
|
|
594 |
val Limit_has_0 = result();
|
|
595 |
|
|
596 |
goalw Ordinal.thy [Limit_def] "!!i. [| Limit(i); j<i |] ==> succ(j) < i";
|
|
597 |
by (fast_tac ZF_cs 1);
|
|
598 |
val Limit_has_succ = result();
|
|
599 |
|
|
600 |
goalw Ordinal.thy [Limit_def]
|
|
601 |
"!!i. [| 0<i; ALL y. succ(y) ~= i |] ==> Limit(i)";
|
|
602 |
by (safe_tac subset_cs);
|
|
603 |
by (rtac (not_le_iff_lt RS iffD1) 2);
|
437
|
604 |
by (fast_tac (lt_cs addEs [lt_asym]) 4);
|
435
|
605 |
by (REPEAT (eresolve_tac [asm_rl, ltE, Ord_succ] 1));
|
|
606 |
val non_succ_LimitI = result();
|
|
607 |
|
|
608 |
goal Ordinal.thy "!!i. Limit(succ(i)) ==> P";
|
437
|
609 |
by (rtac lt_irrefl 1);
|
|
610 |
by (rtac Limit_has_succ 1);
|
|
611 |
by (assume_tac 1);
|
|
612 |
by (etac (Limit_is_Ord RS Ord_succD RS le_refl) 1);
|
435
|
613 |
val succ_LimitE = result();
|
|
614 |
|
|
615 |
goal Ordinal.thy "!!i. [| Limit(i); i le succ(j) |] ==> i le j";
|
|
616 |
by (safe_tac (ZF_cs addSEs [succ_LimitE, leE]));
|
|
617 |
val Limit_le_succD = result();
|
|
618 |
|
|
619 |
|