author | paulson |
Wed, 02 Apr 1997 15:29:48 +0200 | |
changeset 2873 | 5f0599e15448 |
parent 2493 | bdeb5024353a |
child 3731 | 71366483323b |
permissions | -rw-r--r-- |
1461 | 1 |
(* Title: ZF/AC/WO6_WO1.ML |
992 | 2 |
ID: $Id$ |
1461 | 3 |
Author: Krzysztof Grabczewski |
992 | 4 |
|
1041 | 5 |
The proof of "WO6 ==> WO1". Simplified by L C Paulson. |
992 | 6 |
|
7 |
From the book "Equivalents of the Axiom of Choice" by Rubin & Rubin, |
|
8 |
pages 2-5 |
|
9 |
*) |
|
10 |
||
1041 | 11 |
open WO6_WO1; |
12 |
||
13 |
goal OrderType.thy |
|
14 |
"!!i j k. [| k < i++j; Ord(i); Ord(j) |] ==> \ |
|
15 |
\ k < i | (~ k<i & k = i ++ (k--i) & (k--i)<j)"; |
|
16 |
by (res_inst_tac [("i","k"),("j","i")] Ord_linear2 1); |
|
17 |
by (dtac odiff_lt_mono2 4 THEN assume_tac 4); |
|
18 |
by (asm_full_simp_tac |
|
2469 | 19 |
(!simpset addsimps [oadd_odiff_inverse, odiff_oadd_inverse]) 4); |
20 |
by (safe_tac (!claset addSEs [lt_Ord])); |
|
1041 | 21 |
val lt_oadd_odiff_disj = result(); |
22 |
||
23 |
(*The corresponding elimination rule*) |
|
2469 | 24 |
val lt_oadd_odiff_cases = rule_by_tactic (safe_tac (!claset)) |
1041 | 25 |
(lt_oadd_odiff_disj RS disjE); |
26 |
||
992 | 27 |
(* ********************************************************************** *) |
1461 | 28 |
(* The most complicated part of the proof - lemma ii - p. 2-4 *) |
992 | 29 |
(* ********************************************************************** *) |
30 |
||
31 |
(* ********************************************************************** *) |
|
1461 | 32 |
(* some properties of relation uu(beta, gamma, delta) - p. 2 *) |
992 | 33 |
(* ********************************************************************** *) |
34 |
||
35 |
goalw thy [uu_def] "domain(uu(f,b,g,d)) <= f`b"; |
|
2469 | 36 |
by (Fast_tac 1); |
992 | 37 |
val domain_uu_subset = result(); |
38 |
||
1041 | 39 |
goal thy "!! a. ALL b<a. f`b lepoll m ==> \ |
40 |
\ ALL b<a. ALL g<a. ALL d<a. domain(uu(f,b,g,d)) lepoll m"; |
|
2469 | 41 |
by (fast_tac (!claset addSEs |
1461 | 42 |
[domain_uu_subset RS subset_imp_lepoll RS lepoll_trans]) 1); |
992 | 43 |
val quant_domain_uu_lepoll_m = result(); |
44 |
||
45 |
goalw thy [uu_def] "uu(f,b,g,d) <= f`b * f`g"; |
|
2469 | 46 |
by (Fast_tac 1); |
992 | 47 |
val uu_subset1 = result(); |
48 |
||
49 |
goalw thy [uu_def] "uu(f,b,g,d) <= f`d"; |
|
2469 | 50 |
by (Fast_tac 1); |
992 | 51 |
val uu_subset2 = result(); |
52 |
||
1041 | 53 |
goal thy "!! a. [| ALL b<a. f`b lepoll m; d<a |] ==> uu(f,b,g,d) lepoll m"; |
2469 | 54 |
by (fast_tac (!claset |
1461 | 55 |
addSEs [uu_subset2 RS subset_imp_lepoll RS lepoll_trans]) 1); |
992 | 56 |
val uu_lepoll_m = result(); |
57 |
||
58 |
(* ********************************************************************** *) |
|
1461 | 59 |
(* Two cases for lemma ii *) |
992 | 60 |
(* ********************************************************************** *) |
61 |
goalw thy [lesspoll_def] |
|
62 |
"!! a f u. ALL b<a. ALL g<a. ALL d<a. u(f,b,g,d) lepoll m ==> \ |
|
1041 | 63 |
\ (ALL b<a. f`b ~= 0 --> (EX g<a. EX d<a. u(f,b,g,d) ~= 0 & \ |
1461 | 64 |
\ u(f,b,g,d) lesspoll m)) | \ |
1041 | 65 |
\ (EX b<a. f`b ~= 0 & (ALL g<a. ALL d<a. u(f,b,g,d) ~= 0 --> \ |
1461 | 66 |
\ u(f,b,g,d) eqpoll m))"; |
2469 | 67 |
by (Asm_simp_tac 1); |
2493 | 68 |
by (fast_tac (!claset delrules [equalityI]) 1); |
992 | 69 |
val cases = result(); |
70 |
||
71 |
(* ********************************************************************** *) |
|
1461 | 72 |
(* Lemmas used in both cases *) |
992 | 73 |
(* ********************************************************************** *) |
1041 | 74 |
goal thy "!!a C. Ord(a) ==> (UN b<a++a. C(b)) = (UN b<a. C(b) Un C(a++b))"; |
2469 | 75 |
by (fast_tac (!claset addSIs [equalityI] addIs [ltI] |
1041 | 76 |
addSDs [lt_oadd_disj] |
77 |
addSEs [lt_oadd1, oadd_lt_mono2]) 1); |
|
992 | 78 |
val UN_oadd = result(); |
79 |
||
80 |
||
81 |
(* ********************************************************************** *) |
|
1461 | 82 |
(* Case 1 : lemmas *) |
992 | 83 |
(* ********************************************************************** *) |
84 |
||
1041 | 85 |
goalw thy [vv1_def] "vv1(f,m,b) <= f`b"; |
1450 | 86 |
by (rtac (LetI RS LetI) 1); |
1041 | 87 |
by (split_tac [expand_if] 1); |
2469 | 88 |
by (simp_tac (!simpset addsimps [domain_uu_subset]) 1); |
992 | 89 |
val vv1_subset = result(); |
90 |
||
91 |
(* ********************************************************************** *) |
|
1461 | 92 |
(* Case 1 : Union of images is the whole "y" *) |
992 | 93 |
(* ********************************************************************** *) |
1041 | 94 |
goalw thy [gg1_def] |
1461 | 95 |
"!! a f y. [| Ord(a); m:nat |] ==> \ |
96 |
\ (UN b<a++a. gg1(f,a,m)`b) = (UN b<a. f`b)"; |
|
1041 | 97 |
by (asm_simp_tac |
2469 | 98 |
(!simpset addsimps [UN_oadd, lt_oadd1, |
1461 | 99 |
oadd_le_self RS le_imp_not_lt, lt_Ord, |
100 |
odiff_oadd_inverse, ltD, |
|
101 |
vv1_subset RS Diff_partition, ww1_def]) 1); |
|
1041 | 102 |
val UN_gg1_eq = result(); |
103 |
||
104 |
goal thy "domain(gg1(f,a,m)) = a++a"; |
|
2469 | 105 |
by (simp_tac (!simpset addsimps [lam_funtype RS domain_of_fun, gg1_def]) 1); |
1041 | 106 |
val domain_gg1 = result(); |
992 | 107 |
|
108 |
(* ********************************************************************** *) |
|
1461 | 109 |
(* every value of defined function is less than or equipollent to m *) |
992 | 110 |
(* ********************************************************************** *) |
1041 | 111 |
goal thy "!!a b. [| P(a, b); Ord(a); Ord(b); \ |
1461 | 112 |
\ Least_a = (LEAST a. EX x. Ord(x) & P(a, x)) |] \ |
113 |
\ ==> P(Least_a, LEAST b. P(Least_a, b))"; |
|
1208
bc3093616ba4
Ran expandshort and corrected spelling of Grabczewski
paulson
parents:
1071
diff
changeset
|
114 |
by (etac ssubst 1); |
992 | 115 |
by (res_inst_tac [("Q","%z. P(z, LEAST b. P(z, b))")] LeastI2 1); |
2469 | 116 |
by (REPEAT (fast_tac (!claset addSEs [LeastI]) 1)); |
992 | 117 |
val nested_LeastI = result(); |
118 |
||
1041 | 119 |
val nested_Least_instance = |
120 |
standard |
|
121 |
(read_instantiate |
|
1461 | 122 |
[("P","%g d. domain(uu(f,b,g,d)) ~= 0 & \ |
123 |
\ domain(uu(f,b,g,d)) lepoll m")] nested_LeastI); |
|
992 | 124 |
|
1041 | 125 |
goalw thy [gg1_def] |
126 |
"!!a. [| Ord(a); m:nat; \ |
|
1461 | 127 |
\ ALL b<a. f`b ~=0 --> \ |
128 |
\ (EX g<a. EX d<a. domain(uu(f,b,g,d)) ~= 0 & \ |
|
129 |
\ domain(uu(f,b,g,d)) lepoll m); \ |
|
130 |
\ ALL b<a. f`b lepoll succ(m); b<a++a \ |
|
131 |
\ |] ==> gg1(f,a,m)`b lepoll m"; |
|
2469 | 132 |
by (Asm_simp_tac 1); |
133 |
by (safe_tac (!claset addSEs [lt_oadd_odiff_cases])); |
|
1041 | 134 |
(*Case b<a : show vv1(f,m,b) lepoll m *) |
2469 | 135 |
by (asm_simp_tac (!simpset addsimps [vv1_def, Let_def] |
1041 | 136 |
setloop split_tac [expand_if]) 1); |
2469 | 137 |
by (fast_tac (!claset addIs [nested_Least_instance RS conjunct2] |
1461 | 138 |
addSEs [lt_Ord] |
139 |
addSIs [empty_lepollI]) 1); |
|
1041 | 140 |
(*Case a le b: show ww1(f,m,b--a) lepoll m *) |
2469 | 141 |
by (asm_simp_tac (!simpset addsimps [ww1_def]) 1); |
1041 | 142 |
by (excluded_middle_tac "f`(b--a) = 0" 1); |
2469 | 143 |
by (asm_simp_tac (!simpset addsimps [empty_lepollI]) 2); |
1208
bc3093616ba4
Ran expandshort and corrected spelling of Grabczewski
paulson
parents:
1071
diff
changeset
|
144 |
by (rtac Diff_lepoll 1); |
2469 | 145 |
by (Fast_tac 1); |
1041 | 146 |
by (rtac vv1_subset 1); |
147 |
by (dtac (ospec RS mp) 1); |
|
148 |
by (REPEAT (eresolve_tac [asm_rl, oexE] 1)); |
|
2469 | 149 |
by (asm_simp_tac (!simpset |
1461 | 150 |
addsimps [vv1_def, Let_def, lt_Ord, |
151 |
nested_Least_instance RS conjunct1]) 1); |
|
1041 | 152 |
val gg1_lepoll_m = result(); |
992 | 153 |
|
154 |
(* ********************************************************************** *) |
|
1461 | 155 |
(* Case 2 : lemmas *) |
992 | 156 |
(* ********************************************************************** *) |
157 |
||
158 |
(* ********************************************************************** *) |
|
1461 | 159 |
(* Case 2 : vv2_subset *) |
992 | 160 |
(* ********************************************************************** *) |
161 |
||
1461 | 162 |
goalw thy [uu_def] "!!f. [| b<a; g<a; f`b~=0; f`g~=0; \ |
163 |
\ y*y <= y; (UN b<a. f`b)=y \ |
|
164 |
\ |] ==> EX d<a. uu(f,b,g,d) ~= 0"; |
|
2469 | 165 |
by (fast_tac (!claset addSIs [not_emptyI] |
1461 | 166 |
addSDs [SigmaI RSN (2, subsetD)] |
167 |
addSEs [not_emptyE]) 1); |
|
992 | 168 |
val ex_d_uu_not_empty = result(); |
169 |
||
170 |
goal thy "!!f. [| b<a; g<a; f`b~=0; f`g~=0; \ |
|
1461 | 171 |
\ y*y<=y; (UN b<a. f`b)=y |] \ |
172 |
\ ==> uu(f,b,g,LEAST d. (uu(f,b,g,d) ~= 0)) ~= 0"; |
|
1208
bc3093616ba4
Ran expandshort and corrected spelling of Grabczewski
paulson
parents:
1071
diff
changeset
|
173 |
by (dtac ex_d_uu_not_empty 1 THEN REPEAT (assume_tac 1)); |
2469 | 174 |
by (fast_tac (!claset addSEs [LeastI, lt_Ord]) 1); |
992 | 175 |
val uu_not_empty = result(); |
176 |
||
2873 | 177 |
goal ZF.thy "!!r. [| r<=A*B; r~=0 |] ==> domain(r)~=0"; |
992 | 178 |
by (REPEAT (eresolve_tac [asm_rl, not_emptyE, subsetD RS SigmaE, |
1461 | 179 |
sym RSN (2, subst_elem) RS domainI RS not_emptyI] 1)); |
992 | 180 |
val not_empty_rel_imp_domain = result(); |
181 |
||
182 |
goal thy "!!f. [| b<a; g<a; f`b~=0; f`g~=0; \ |
|
1461 | 183 |
\ y*y <= y; (UN b<a. f`b)=y |] \ |
184 |
\ ==> (LEAST d. uu(f,b,g,d) ~= 0) < a"; |
|
992 | 185 |
by (eresolve_tac [ex_d_uu_not_empty RS oexE] 1 |
1461 | 186 |
THEN REPEAT (assume_tac 1)); |
992 | 187 |
by (resolve_tac [Least_le RS lt_trans1] 1 |
1461 | 188 |
THEN (REPEAT (ares_tac [lt_Ord] 1))); |
992 | 189 |
val Least_uu_not_empty_lt_a = result(); |
190 |
||
2873 | 191 |
goal ZF.thy "!!B. [| B<=A; a~:B |] ==> B <= A-{a}"; |
2469 | 192 |
by (Fast_tac 1); |
992 | 193 |
val subset_Diff_sing = result(); |
194 |
||
1041 | 195 |
(*Could this be proved more directly?*) |
992 | 196 |
goal thy "!!A B. [| A lepoll m; m lepoll B; B <= A; m:nat |] ==> A=B"; |
1208
bc3093616ba4
Ran expandshort and corrected spelling of Grabczewski
paulson
parents:
1071
diff
changeset
|
197 |
by (etac natE 1); |
2469 | 198 |
by (fast_tac (!claset addSDs [lepoll_0_is_0] addSIs [equalityI]) 1); |
992 | 199 |
by (hyp_subst_tac 1); |
1208
bc3093616ba4
Ran expandshort and corrected spelling of Grabczewski
paulson
parents:
1071
diff
changeset
|
200 |
by (rtac equalityI 1); |
1041 | 201 |
by (assume_tac 2); |
1208
bc3093616ba4
Ran expandshort and corrected spelling of Grabczewski
paulson
parents:
1071
diff
changeset
|
202 |
by (rtac subsetI 1); |
1041 | 203 |
by (excluded_middle_tac "?P" 1 THEN (assume_tac 2)); |
992 | 204 |
by (eresolve_tac [subset_Diff_sing RS subset_imp_lepoll RSN (2, |
1461 | 205 |
Diff_sing_lepoll RSN (3, lepoll_trans RS lepoll_trans)) RS |
206 |
succ_lepoll_natE] 1 |
|
207 |
THEN REPEAT (assume_tac 1)); |
|
992 | 208 |
val supset_lepoll_imp_eq = result(); |
209 |
||
1041 | 210 |
goal thy |
1461 | 211 |
"!!a. [| ALL g<a. ALL d<a. domain(uu(f, b, g, d))~=0 --> \ |
212 |
\ domain(uu(f, b, g, d)) eqpoll succ(m); \ |
|
213 |
\ ALL b<a. f`b lepoll succ(m); y*y <= y; \ |
|
214 |
\ (UN b<a. f`b)=y; b<a; g<a; d<a; \ |
|
215 |
\ f`b~=0; f`g~=0; m:nat; s:f`b \ |
|
1071 | 216 |
\ |] ==> uu(f, b, g, LEAST d. uu(f,b,g,d)~=0) : f`b -> f`g"; |
217 |
by (dres_inst_tac [("x2","g")] (ospec RS ospec RS mp) 1); |
|
218 |
by (rtac ([uu_subset1, uu_not_empty] MRS not_empty_rel_imp_domain) 3); |
|
219 |
by (rtac Least_uu_not_empty_lt_a 2 THEN TRYALL assume_tac); |
|
992 | 220 |
by (resolve_tac [eqpoll_sym RS eqpoll_imp_lepoll RS |
1461 | 221 |
(Least_uu_not_empty_lt_a RSN (2, uu_lepoll_m) RSN (2, |
222 |
uu_subset1 RSN (4, rel_is_fun)))] 1 |
|
223 |
THEN TRYALL assume_tac); |
|
1071 | 224 |
by (rtac (eqpoll_sym RS eqpoll_imp_lepoll RSN (2, supset_lepoll_imp_eq)) 1); |
2469 | 225 |
by (REPEAT (fast_tac (!claset addSIs [domain_uu_subset, nat_succI]) 1)); |
992 | 226 |
val uu_Least_is_fun = result(); |
227 |
||
228 |
goalw thy [vv2_def] |
|
1461 | 229 |
"!!a. [| ALL g<a. ALL d<a. domain(uu(f, b, g, d))~=0 --> \ |
230 |
\ domain(uu(f, b, g, d)) eqpoll succ(m); \ |
|
231 |
\ ALL b<a. f`b lepoll succ(m); y*y <= y; \ |
|
232 |
\ (UN b<a. f`b)=y; b<a; g<a; m:nat; s:f`b \ |
|
233 |
\ |] ==> vv2(f,b,g,s) <= f`g"; |
|
1041 | 234 |
by (split_tac [expand_if] 1); |
2469 | 235 |
by (Step_tac 1); |
2493 | 236 |
by (etac (uu_Least_is_fun RS apply_type) 1); |
2469 | 237 |
by (REPEAT_SOME (fast_tac (!claset addSIs [not_emptyI, singleton_subsetI]))); |
992 | 238 |
val vv2_subset = result(); |
239 |
||
240 |
(* ********************************************************************** *) |
|
1461 | 241 |
(* Case 2 : Union of images is the whole "y" *) |
992 | 242 |
(* ********************************************************************** *) |
1041 | 243 |
goalw thy [gg2_def] |
1461 | 244 |
"!!a. [| ALL g<a. ALL d<a. domain(uu(f,b,g,d)) ~= 0 --> \ |
245 |
\ domain(uu(f,b,g,d)) eqpoll succ(m); \ |
|
246 |
\ ALL b<a. f`b lepoll succ(m); y*y<=y; \ |
|
247 |
\ (UN b<a.f`b)=y; Ord(a); m:nat; s:f`b; b<a \ |
|
248 |
\ |] ==> (UN g<a++a. gg2(f,a,b,s) ` g) = y"; |
|
1208
bc3093616ba4
Ran expandshort and corrected spelling of Grabczewski
paulson
parents:
1071
diff
changeset
|
249 |
by (dtac sym 1); |
1041 | 250 |
by (asm_simp_tac |
2469 | 251 |
(!simpset addsimps [UN_oadd, lt_oadd1, |
1461 | 252 |
oadd_le_self RS le_imp_not_lt, lt_Ord, |
253 |
odiff_oadd_inverse, ww2_def, |
|
254 |
vv2_subset RS Diff_partition]) 1); |
|
1041 | 255 |
val UN_gg2_eq = result(); |
256 |
||
257 |
goal thy "domain(gg2(f,a,b,s)) = a++a"; |
|
2469 | 258 |
by (simp_tac (!simpset addsimps [lam_funtype RS domain_of_fun, gg2_def]) 1); |
1041 | 259 |
val domain_gg2 = result(); |
992 | 260 |
|
261 |
(* ********************************************************************** *) |
|
1461 | 262 |
(* every value of defined function is less than or equipollent to m *) |
992 | 263 |
(* ********************************************************************** *) |
264 |
||
265 |
goalw thy [vv2_def] |
|
1041 | 266 |
"!!m. [| m:nat; m~=0 |] ==> vv2(f,b,g,s) lepoll m"; |
2469 | 267 |
by (asm_simp_tac (!simpset addsimps [empty_lepollI] |
1057 | 268 |
setloop split_tac [expand_if]) 1); |
2469 | 269 |
by (fast_tac (!claset |
1461 | 270 |
addSDs [le_imp_subset RS subset_imp_lepoll RS lepoll_0_is_0] |
271 |
addSIs [singleton_eqpoll_1 RS eqpoll_imp_lepoll RS lepoll_trans, |
|
272 |
not_lt_imp_le RS le_imp_subset RS subset_imp_lepoll, |
|
273 |
nat_into_Ord, nat_1I]) 1); |
|
1041 | 274 |
val vv2_lepoll = result(); |
992 | 275 |
|
1041 | 276 |
goalw thy [ww2_def] |
277 |
"!!m. [| ALL b<a. f`b lepoll succ(m); g<a; m:nat; vv2(f,b,g,d) <= f`g \ |
|
1461 | 278 |
\ |] ==> ww2(f,b,g,d) lepoll m"; |
1041 | 279 |
by (excluded_middle_tac "f`g = 0" 1); |
2469 | 280 |
by (asm_simp_tac (!simpset addsimps [empty_lepollI]) 2); |
1208
bc3093616ba4
Ran expandshort and corrected spelling of Grabczewski
paulson
parents:
1071
diff
changeset
|
281 |
by (dtac ospec 1 THEN (assume_tac 1)); |
bc3093616ba4
Ran expandshort and corrected spelling of Grabczewski
paulson
parents:
1071
diff
changeset
|
282 |
by (rtac Diff_lepoll 1 |
1461 | 283 |
THEN (TRYALL assume_tac)); |
2469 | 284 |
by (asm_simp_tac (!simpset addsimps [vv2_def, expand_if, not_emptyI]) 1); |
1041 | 285 |
val ww2_lepoll = result(); |
286 |
||
287 |
goalw thy [gg2_def] |
|
1461 | 288 |
"!!a. [| ALL g<a. ALL d<a. domain(uu(f,b,g,d)) ~= 0 --> \ |
289 |
\ domain(uu(f,b,g,d)) eqpoll succ(m); \ |
|
290 |
\ ALL b<a. f`b lepoll succ(m); y*y <= y; \ |
|
291 |
\ (UN b<a. f`b)=y; b<a; s:f`b; m:nat; m~= 0; g<a++a \ |
|
1041 | 292 |
\ |] ==> gg2(f,a,b,s) ` g lepoll m"; |
2469 | 293 |
by (Asm_simp_tac 1); |
294 |
by (safe_tac (!claset addSEs [lt_oadd_odiff_cases, lt_Ord2])); |
|
295 |
by (asm_simp_tac (!simpset addsimps [vv2_lepoll]) 1); |
|
296 |
by (asm_simp_tac (!simpset addsimps [ww2_lepoll, vv2_subset]) 1); |
|
1041 | 297 |
val gg2_lepoll_m = result(); |
992 | 298 |
|
299 |
(* ********************************************************************** *) |
|
1461 | 300 |
(* lemma ii *) |
992 | 301 |
(* ********************************************************************** *) |
302 |
goalw thy [NN_def] |
|
1461 | 303 |
"!!y. [| succ(m) : NN(y); y*y <= y; m:nat; m~=0 |] ==> m : NN(y)"; |
992 | 304 |
by (REPEAT (eresolve_tac [CollectE, exE, conjE] 1)); |
305 |
by (resolve_tac [quant_domain_uu_lepoll_m RS cases RS disjE] 1 |
|
1041 | 306 |
THEN (assume_tac 1)); |
992 | 307 |
(* case 1 *) |
2469 | 308 |
by (asm_full_simp_tac (!simpset addsimps [lesspoll_succ_iff]) 1); |
1041 | 309 |
by (res_inst_tac [("x","a++a")] exI 1); |
2469 | 310 |
by (fast_tac (!claset addSIs [Ord_oadd, domain_gg1, UN_gg1_eq, |
1461 | 311 |
gg1_lepoll_m]) 1); |
992 | 312 |
(* case 2 *) |
313 |
by (REPEAT (eresolve_tac [oexE, conjE] 1)); |
|
1041 | 314 |
by (res_inst_tac [("A","f`?B")] not_emptyE 1 THEN (assume_tac 1)); |
1208
bc3093616ba4
Ran expandshort and corrected spelling of Grabczewski
paulson
parents:
1071
diff
changeset
|
315 |
by (rtac CollectI 1); |
bc3093616ba4
Ran expandshort and corrected spelling of Grabczewski
paulson
parents:
1071
diff
changeset
|
316 |
by (etac succ_natD 1); |
992 | 317 |
by (res_inst_tac [("x","a++a")] exI 1); |
1041 | 318 |
by (res_inst_tac [("x","gg2(f,a,b,x)")] exI 1); |
319 |
(*Calling fast_tac might get rid of the res_inst_tac calls, but it |
|
320 |
is just too slow.*) |
|
2469 | 321 |
by (asm_simp_tac (!simpset addsimps |
1461 | 322 |
[Ord_oadd, domain_gg2, UN_gg2_eq, gg2_lepoll_m]) 1); |
992 | 323 |
val lemma_ii = result(); |
324 |
||
325 |
||
326 |
(* ********************************************************************** *) |
|
327 |
(* lemma iv - p. 4 : *) |
|
328 |
(* For every set x there is a set y such that x Un (y * y) <= y *) |
|
329 |
(* ********************************************************************** *) |
|
330 |
||
331 |
(* the quantifier ALL looks inelegant but makes the proofs shorter *) |
|
332 |
(* (used only in the following two lemmas) *) |
|
333 |
||
334 |
goal thy "ALL n:nat. rec(n, x, %k r. r Un r*r) <= \ |
|
335 |
\ rec(succ(n), x, %k r. r Un r*r)"; |
|
2469 | 336 |
by (fast_tac (!claset addIs [rec_succ RS ssubst]) 1); |
992 | 337 |
val z_n_subset_z_succ_n = result(); |
338 |
||
339 |
goal thy "!!n. [| ALL n:nat. f(n)<=f(succ(n)); n le m; n : nat; m: nat |] \ |
|
340 |
\ ==> f(n)<=f(m)"; |
|
2469 | 341 |
by (eres_inst_tac [("P","n le m")] rev_mp 1); |
992 | 342 |
by (res_inst_tac [("P","%z. n le z --> f(n) <= f(z)")] nat_induct 1); |
2469 | 343 |
by (REPEAT (fast_tac le_cs 1)); |
992 | 344 |
val le_subsets = result(); |
345 |
||
346 |
goal thy "!!n m. [| n le m; m:nat |] ==> \ |
|
1461 | 347 |
\ rec(n, x, %k r. r Un r*r) <= rec(m, x, %k r. r Un r*r)"; |
992 | 348 |
by (resolve_tac [z_n_subset_z_succ_n RS le_subsets] 1 |
1041 | 349 |
THEN (TRYALL assume_tac)); |
992 | 350 |
by (eresolve_tac [Ord_nat RSN (2, ltI) RSN (2, lt_trans1) RS ltD] 1 |
1041 | 351 |
THEN (assume_tac 1)); |
992 | 352 |
val le_imp_rec_subset = result(); |
353 |
||
1041 | 354 |
goal thy "EX y. x Un y*y <= y"; |
992 | 355 |
by (res_inst_tac [("x","UN n:nat. rec(n, x, %k r. r Un r*r)")] exI 1); |
2469 | 356 |
by (safe_tac (!claset)); |
2493 | 357 |
by (rtac (nat_0I RS UN_I) 1); |
2469 | 358 |
by (Asm_simp_tac 1); |
992 | 359 |
by (res_inst_tac [("a","succ(n Un na)")] UN_I 1); |
1041 | 360 |
by (eresolve_tac [Un_nat_type RS nat_succI] 1 THEN (assume_tac 1)); |
992 | 361 |
by (fast_tac (ZF_cs addIs [le_imp_rec_subset RS subsetD] |
1461 | 362 |
addSIs [Un_upper1_le, Un_upper2_le, Un_nat_type] |
2469 | 363 |
addSEs [nat_into_Ord] addss (!simpset)) 1); |
992 | 364 |
val lemma_iv = result(); |
365 |
||
366 |
(* ********************************************************************** *) |
|
1461 | 367 |
(* Rubin & Rubin wrote : *) |
992 | 368 |
(* "It follows from (ii) and mathematical induction that if y*y <= y then *) |
1461 | 369 |
(* y can be well-ordered" *) |
992 | 370 |
|
1461 | 371 |
(* In fact we have to prove : *) |
372 |
(* * WO6 ==> NN(y) ~= 0 *) |
|
373 |
(* * reverse induction which lets us infer that 1 : NN(y) *) |
|
374 |
(* * 1 : NN(y) ==> y can be well-ordered *) |
|
992 | 375 |
(* ********************************************************************** *) |
376 |
||
377 |
(* ********************************************************************** *) |
|
1461 | 378 |
(* WO6 ==> NN(y) ~= 0 *) |
992 | 379 |
(* ********************************************************************** *) |
380 |
||
381 |
goalw thy [WO6_def, NN_def] "!!y. WO6 ==> NN(y) ~= 0"; |
|
1071 | 382 |
by (fast_tac (ZF_cs addEs [equals0D]) 1); |
992 | 383 |
val WO6_imp_NN_not_empty = result(); |
384 |
||
385 |
(* ********************************************************************** *) |
|
1461 | 386 |
(* 1 : NN(y) ==> y can be well-ordered *) |
992 | 387 |
(* ********************************************************************** *) |
388 |
||
389 |
goal thy "!!f. [| (UN b<a. f`b)=y; x:y; ALL b<a. f`b lepoll 1; Ord(a) |] \ |
|
1461 | 390 |
\ ==> EX c<a. f`c = {x}"; |
2469 | 391 |
by (fast_tac (!claset addSEs [lepoll_1_is_sing]) 1); |
992 | 392 |
val lemma1 = result(); |
393 |
||
394 |
goal thy "!!f. [| (UN b<a. f`b)=y; x:y; ALL b<a. f`b lepoll 1; Ord(a) |] \ |
|
1461 | 395 |
\ ==> f` (LEAST i. f`i = {x}) = {x}"; |
1208
bc3093616ba4
Ran expandshort and corrected spelling of Grabczewski
paulson
parents:
1071
diff
changeset
|
396 |
by (dtac lemma1 1 THEN REPEAT (assume_tac 1)); |
2469 | 397 |
by (fast_tac (!claset addSEs [lt_Ord] addIs [LeastI]) 1); |
992 | 398 |
val lemma2 = result(); |
399 |
||
400 |
goalw thy [NN_def] "!!y. 1 : NN(y) ==> EX a f. Ord(a) & f:inj(y, a)"; |
|
1208
bc3093616ba4
Ran expandshort and corrected spelling of Grabczewski
paulson
parents:
1071
diff
changeset
|
401 |
by (etac CollectE 1); |
992 | 402 |
by (REPEAT (eresolve_tac [exE, conjE] 1)); |
403 |
by (res_inst_tac [("x","a")] exI 1); |
|
404 |
by (res_inst_tac [("x","lam x:y. LEAST i. f`i = {x}")] exI 1); |
|
1208
bc3093616ba4
Ran expandshort and corrected spelling of Grabczewski
paulson
parents:
1071
diff
changeset
|
405 |
by (rtac conjI 1 THEN (assume_tac 1)); |
992 | 406 |
by (res_inst_tac [("d","%i. THE x. x:f`i")] lam_injective 1); |
1208
bc3093616ba4
Ran expandshort and corrected spelling of Grabczewski
paulson
parents:
1071
diff
changeset
|
407 |
by (dtac lemma1 1 THEN REPEAT (assume_tac 1)); |
2469 | 408 |
by (fast_tac (!claset addSEs [Least_le RS lt_trans1 RS ltD, lt_Ord]) 1); |
1041 | 409 |
by (resolve_tac [lemma2 RS ssubst] 1 THEN REPEAT (assume_tac 1)); |
2469 | 410 |
by (fast_tac (!claset addSIs [the_equality]) 1); |
992 | 411 |
val NN_imp_ex_inj = result(); |
412 |
||
413 |
goal thy "!!y. [| y*y <= y; 1 : NN(y) |] ==> EX r. well_ord(y, r)"; |
|
1208
bc3093616ba4
Ran expandshort and corrected spelling of Grabczewski
paulson
parents:
1071
diff
changeset
|
414 |
by (dtac NN_imp_ex_inj 1); |
2469 | 415 |
by (fast_tac (!claset addSEs [well_ord_Memrel RSN (2, well_ord_rvimage)]) 1); |
992 | 416 |
val y_well_ord = result(); |
417 |
||
418 |
(* ********************************************************************** *) |
|
1461 | 419 |
(* reverse induction which lets us infer that 1 : NN(y) *) |
992 | 420 |
(* ********************************************************************** *) |
421 |
||
422 |
val [prem1, prem2] = goal thy |
|
1461 | 423 |
"[| n:nat; !!m. [| m:nat; m~=0; P(succ(m)) |] ==> P(m) |] \ |
424 |
\ ==> n~=0 --> P(n) --> P(1)"; |
|
992 | 425 |
by (res_inst_tac [("n","n")] nat_induct 1); |
1208
bc3093616ba4
Ran expandshort and corrected spelling of Grabczewski
paulson
parents:
1071
diff
changeset
|
426 |
by (rtac prem1 1); |
2469 | 427 |
by (Fast_tac 1); |
992 | 428 |
by (excluded_middle_tac "x=0" 1); |
2469 | 429 |
by (Fast_tac 2); |
430 |
by (fast_tac (!claset addSIs [prem2]) 1); |
|
992 | 431 |
val rev_induct_lemma = result(); |
432 |
||
433 |
val prems = goal thy |
|
1461 | 434 |
"[| P(n); n:nat; n~=0; \ |
435 |
\ !!m. [| m:nat; m~=0; P(succ(m)) |] ==> P(m) |] \ |
|
436 |
\ ==> P(1)"; |
|
992 | 437 |
by (resolve_tac [rev_induct_lemma RS impE] 1); |
1208
bc3093616ba4
Ran expandshort and corrected spelling of Grabczewski
paulson
parents:
1071
diff
changeset
|
438 |
by (etac impE 4 THEN (assume_tac 5)); |
992 | 439 |
by (REPEAT (ares_tac prems 1)); |
440 |
val rev_induct = result(); |
|
441 |
||
442 |
goalw thy [NN_def] "!!n. n:NN(y) ==> n:nat"; |
|
1057 | 443 |
by (etac CollectD1 1); |
992 | 444 |
val NN_into_nat = result(); |
445 |
||
446 |
goal thy "!!n. [| n:NN(y); y*y <= y; n~=0 |] ==> 1:NN(y)"; |
|
1208
bc3093616ba4
Ran expandshort and corrected spelling of Grabczewski
paulson
parents:
1071
diff
changeset
|
447 |
by (rtac rev_induct 1 THEN REPEAT (ares_tac [NN_into_nat] 1)); |
bc3093616ba4
Ran expandshort and corrected spelling of Grabczewski
paulson
parents:
1071
diff
changeset
|
448 |
by (rtac lemma_ii 1 THEN REPEAT (assume_tac 1)); |
992 | 449 |
val lemma3 = result(); |
450 |
||
451 |
(* ********************************************************************** *) |
|
1461 | 452 |
(* Main theorem "WO6 ==> WO1" *) |
992 | 453 |
(* ********************************************************************** *) |
454 |
||
455 |
(* another helpful lemma *) |
|
456 |
goalw thy [NN_def] "!!y. 0:NN(y) ==> y=0"; |
|
2469 | 457 |
by (fast_tac (!claset addSIs [equalityI] |
992 | 458 |
addSDs [lepoll_0_is_0] addEs [subst]) 1); |
459 |
val NN_y_0 = result(); |
|
460 |
||
461 |
goalw thy [WO1_def] "!!Z. WO6 ==> WO1"; |
|
1208
bc3093616ba4
Ran expandshort and corrected spelling of Grabczewski
paulson
parents:
1071
diff
changeset
|
462 |
by (rtac allI 1); |
992 | 463 |
by (excluded_middle_tac "A=0" 1); |
2469 | 464 |
by (fast_tac (!claset addSIs [well_ord_Memrel, nat_0I RS nat_into_Ord]) 2); |
992 | 465 |
by (res_inst_tac [("x1","A")] (lemma_iv RS revcut_rl) 1); |
1208
bc3093616ba4
Ran expandshort and corrected spelling of Grabczewski
paulson
parents:
1071
diff
changeset
|
466 |
by (etac exE 1); |
bc3093616ba4
Ran expandshort and corrected spelling of Grabczewski
paulson
parents:
1071
diff
changeset
|
467 |
by (dtac WO6_imp_NN_not_empty 1); |
992 | 468 |
by (eresolve_tac [Un_subset_iff RS iffD1 RS conjE] 1); |
469 |
by (eres_inst_tac [("A","NN(y)")] not_emptyE 1); |
|
470 |
by (forward_tac [y_well_ord] 1); |
|
2469 | 471 |
by (fast_tac (!claset addEs [well_ord_subset]) 2); |
472 |
by (fast_tac (!claset addSIs [lemma3] addSDs [NN_y_0] addSEs [not_emptyE]) 1); |
|
992 | 473 |
qed "WO6_imp_WO1"; |
474 |