1 (* Title: ZF/Cardinal.ML |
1 (* Title: ZF/Cardinal.ML |
2 ID: $Id$ |
2 ID: $Id$ |
3 Author: Lawrence C Paulson, Cambridge University Computer Laboratory |
3 Author: Lawrence C Paulson, Cambridge University Computer Laboratory |
4 Copyright 1994 University of Cambridge |
4 Copyright 1994 University of Cambridge |
5 |
5 |
6 Cardinals in Zermelo-Fraenkel Set Theory |
6 Cardinals in Zermelo-Fraenkel Set Theory |
7 |
7 |
8 This theory does NOT assume the Axiom of Choice |
8 This theory does NOT assume the Axiom of Choice |
18 by (rtac bnd_monoI 1); |
18 by (rtac bnd_monoI 1); |
19 by (REPEAT (ares_tac [Diff_subset, subset_refl, Diff_mono, image_mono] 1)); |
19 by (REPEAT (ares_tac [Diff_subset, subset_refl, Diff_mono, image_mono] 1)); |
20 qed "decomp_bnd_mono"; |
20 qed "decomp_bnd_mono"; |
21 |
21 |
22 val [gfun] = goal Cardinal.thy |
22 val [gfun] = goal Cardinal.thy |
23 "g: Y->X ==> \ |
23 "g: Y->X ==> \ |
24 \ g``(Y - f`` lfp(X, %W. X - g``(Y - f``W))) = \ |
24 \ g``(Y - f`` lfp(X, %W. X - g``(Y - f``W))) = \ |
25 \ X - lfp(X, %W. X - g``(Y - f``W)) "; |
25 \ X - lfp(X, %W. X - g``(Y - f``W)) "; |
26 by (res_inst_tac [("P", "%u. ?v = X-u")] |
26 by (res_inst_tac [("P", "%u. ?v = X-u")] |
27 (decomp_bnd_mono RS lfp_Tarski RS ssubst) 1); |
27 (decomp_bnd_mono RS lfp_Tarski RS ssubst) 1); |
28 by (simp_tac (ZF_ss addsimps [subset_refl, double_complement, |
28 by (simp_tac (ZF_ss addsimps [subset_refl, double_complement, |
29 gfun RS fun_is_rel RS image_subset]) 1); |
29 gfun RS fun_is_rel RS image_subset]) 1); |
30 qed "Banach_last_equation"; |
30 qed "Banach_last_equation"; |
31 |
31 |
32 val prems = goal Cardinal.thy |
32 val prems = goal Cardinal.thy |
33 "[| f: X->Y; g: Y->X |] ==> \ |
33 "[| f: X->Y; g: Y->X |] ==> \ |
34 \ EX XA XB YA YB. (XA Int XB = 0) & (XA Un XB = X) & \ |
34 \ EX XA XB YA YB. (XA Int XB = 0) & (XA Un XB = X) & \ |
190 |
190 |
191 (*Easier to apply than LeastI: conclusion has only one occurrence of P*) |
191 (*Easier to apply than LeastI: conclusion has only one occurrence of P*) |
192 qed_goal "LeastI2" Cardinal.thy |
192 qed_goal "LeastI2" Cardinal.thy |
193 "[| P(i); Ord(i); !!j. P(j) ==> Q(j) |] ==> Q(LEAST j. P(j))" |
193 "[| P(i); Ord(i); !!j. P(j) ==> Q(j) |] ==> Q(LEAST j. P(j))" |
194 (fn prems => [ resolve_tac prems 1, |
194 (fn prems => [ resolve_tac prems 1, |
195 rtac LeastI 1, |
195 rtac LeastI 1, |
196 resolve_tac prems 1, |
196 resolve_tac prems 1, |
197 resolve_tac prems 1 ]); |
197 resolve_tac prems 1 ]); |
198 |
198 |
199 (*If there is no such P then LEAST is vacuously 0*) |
199 (*If there is no such P then LEAST is vacuously 0*) |
200 goalw Cardinal.thy [Least_def] |
200 goalw Cardinal.thy [Least_def] |
201 "!!P. [| ~ (EX i. Ord(i) & P(i)) |] ==> (LEAST x.P(x)) = 0"; |
201 "!!P. [| ~ (EX i. Ord(i) & P(i)) |] ==> (LEAST x.P(x)) = 0"; |
202 by (rtac the_0 1); |
202 by (rtac the_0 1); |
279 (*The cardinals are the initial ordinals*) |
279 (*The cardinals are the initial ordinals*) |
280 goal Cardinal.thy "Card(K) <-> Ord(K) & (ALL j. j<K --> ~ j eqpoll K)"; |
280 goal Cardinal.thy "Card(K) <-> Ord(K) & (ALL j. j<K --> ~ j eqpoll K)"; |
281 by (safe_tac (ZF_cs addSIs [CardI, Card_is_Ord])); |
281 by (safe_tac (ZF_cs addSIs [CardI, Card_is_Ord])); |
282 by (fast_tac ZF_cs 2); |
282 by (fast_tac ZF_cs 2); |
283 by (rewrite_goals_tac [Card_def, cardinal_def]); |
283 by (rewrite_goals_tac [Card_def, cardinal_def]); |
284 by (resolve_tac [less_LeastE] 1); |
284 by (rtac less_LeastE 1); |
285 by (eresolve_tac [subst] 2); |
285 by (etac subst 2); |
286 by (ALLGOALS assume_tac); |
286 by (ALLGOALS assume_tac); |
287 qed "Card_iff_initial"; |
287 qed "Card_iff_initial"; |
288 |
288 |
289 goal Cardinal.thy "Card(0)"; |
289 goal Cardinal.thy "Card(0)"; |
290 by (rtac (Ord_0 RS CardI) 1); |
290 by (rtac (Ord_0 RS CardI) 1); |
342 by (etac cardinal_mono 1); |
342 by (etac cardinal_mono 1); |
343 qed "cardinal_lt_imp_lt"; |
343 qed "cardinal_lt_imp_lt"; |
344 |
344 |
345 goal Cardinal.thy "!!i j. [| |i| < K; Ord(i); Card(K) |] ==> i < K"; |
345 goal Cardinal.thy "!!i j. [| |i| < K; Ord(i); Card(K) |] ==> i < K"; |
346 by (asm_simp_tac (ZF_ss addsimps |
346 by (asm_simp_tac (ZF_ss addsimps |
347 [cardinal_lt_imp_lt, Card_is_Ord, Card_cardinal_eq]) 1); |
347 [cardinal_lt_imp_lt, Card_is_Ord, Card_cardinal_eq]) 1); |
348 qed "Card_lt_imp_lt"; |
348 qed "Card_lt_imp_lt"; |
349 |
349 |
350 goal Cardinal.thy "!!i j. [| Ord(i); Card(K) |] ==> (|i| < K) <-> (i < K)"; |
350 goal Cardinal.thy "!!i j. [| Ord(i); Card(K) |] ==> (|i| < K) <-> (i < K)"; |
351 by (fast_tac (ZF_cs addEs [Card_lt_imp_lt, Ord_cardinal_le RS lt_trans1]) 1); |
351 by (fast_tac (ZF_cs addEs [Card_lt_imp_lt, Ord_cardinal_le RS lt_trans1]) 1); |
352 qed "Card_lt_iff"; |
352 qed "Card_lt_iff"; |
353 |
353 |
354 goal Cardinal.thy "!!i j. [| Ord(i); Card(K) |] ==> (K le |i|) <-> (K le i)"; |
354 goal Cardinal.thy "!!i j. [| Ord(i); Card(K) |] ==> (K le |i|) <-> (K le i)"; |
355 by (asm_simp_tac (ZF_ss addsimps |
355 by (asm_simp_tac (ZF_ss addsimps |
356 [Card_lt_iff, Card_is_Ord, Ord_cardinal, |
356 [Card_lt_iff, Card_is_Ord, Ord_cardinal, |
357 not_lt_iff_le RS iff_sym]) 1); |
357 not_lt_iff_le RS iff_sym]) 1); |
358 qed "Card_le_iff"; |
358 qed "Card_le_iff"; |
359 |
359 |
360 |
360 |
361 (*** The finite cardinals ***) |
361 (*** The finite cardinals ***) |
362 |
362 |
391 by (nat_ind_tac "m" [prem] 1); |
391 by (nat_ind_tac "m" [prem] 1); |
392 by (fast_tac (ZF_cs addSIs [nat_0_le]) 1); |
392 by (fast_tac (ZF_cs addSIs [nat_0_le]) 1); |
393 by (rtac ballI 1); |
393 by (rtac ballI 1); |
394 by (eres_inst_tac [("n","n")] natE 1); |
394 by (eres_inst_tac [("n","n")] natE 1); |
395 by (asm_simp_tac (ZF_ss addsimps [lepoll_def, inj_def, |
395 by (asm_simp_tac (ZF_ss addsimps [lepoll_def, inj_def, |
396 succI1 RS Pi_empty2]) 1); |
396 succI1 RS Pi_empty2]) 1); |
397 by (fast_tac (ZF_cs addSIs [succ_leI] addSDs [succ_lepoll_succD]) 1); |
397 by (fast_tac (ZF_cs addSIs [succ_leI] addSDs [succ_lepoll_succD]) 1); |
398 val nat_lepoll_imp_le_lemma = result(); |
398 val nat_lepoll_imp_le_lemma = result(); |
399 |
399 |
400 bind_thm ("nat_lepoll_imp_le", nat_lepoll_imp_le_lemma RS bspec RS mp); |
400 bind_thm ("nat_lepoll_imp_le", nat_lepoll_imp_le_lemma RS bspec RS mp); |
401 |
401 |
440 by (fast_tac (ZF_cs addSIs [inj_not_surj_succ]) 1); |
440 by (fast_tac (ZF_cs addSIs [inj_not_surj_succ]) 1); |
441 qed "lesspoll_succ_imp_lepoll"; |
441 qed "lesspoll_succ_imp_lepoll"; |
442 |
442 |
443 goal Cardinal.thy "!!m. m:nat ==> A lesspoll succ(m) <-> A lepoll m"; |
443 goal Cardinal.thy "!!m. m:nat ==> A lesspoll succ(m) <-> A lepoll m"; |
444 by (fast_tac (ZF_cs addSIs [lepoll_imp_lesspoll_succ, |
444 by (fast_tac (ZF_cs addSIs [lepoll_imp_lesspoll_succ, |
445 lesspoll_succ_imp_lepoll]) 1); |
445 lesspoll_succ_imp_lepoll]) 1); |
446 qed "lesspoll_succ_iff"; |
446 qed "lesspoll_succ_iff"; |
447 |
447 |
448 goal Cardinal.thy "!!A m. [| A lepoll succ(m); m:nat |] ==> \ |
448 goal Cardinal.thy "!!A m. [| A lepoll succ(m); m:nat |] ==> \ |
449 \ A lepoll m | A eqpoll succ(m)"; |
449 \ A lepoll m | A eqpoll succ(m)"; |
450 by (rtac disjCI 1); |
450 by (rtac disjCI 1); |
547 |
547 |
548 goalw Cardinal.thy [eqpoll_def] |
548 goalw Cardinal.thy [eqpoll_def] |
549 "!!f. [| f: inj(A,B); A Int B = 0 |] ==> A Un (B - range(f)) eqpoll B"; |
549 "!!f. [| f: inj(A,B); A Int B = 0 |] ==> A Un (B - range(f)) eqpoll B"; |
550 by (rtac exI 1); |
550 by (rtac exI 1); |
551 by (res_inst_tac [("c", "%x. if(x:A, f`x, x)"), |
551 by (res_inst_tac [("c", "%x. if(x:A, f`x, x)"), |
552 ("d", "%y. if(y: range(f), converse(f)`y, y)")] |
552 ("d", "%y. if(y: range(f), converse(f)`y, y)")] |
553 lam_bijective 1); |
553 lam_bijective 1); |
554 by (fast_tac (ZF_cs addSIs [if_type, apply_type] addIs [inj_is_fun]) 1); |
554 by (fast_tac (ZF_cs addSIs [if_type, apply_type] addIs [inj_is_fun]) 1); |
555 by (asm_simp_tac |
555 by (asm_simp_tac |
556 (ZF_ss addsimps [inj_converse_fun RS apply_funtype] |
556 (ZF_ss addsimps [inj_converse_fun RS apply_funtype] |
557 setloop split_tac [expand_if]) 1); |
557 setloop split_tac [expand_if]) 1); |
610 |
610 |
611 goalw Cardinal.thy [Finite_def] |
611 goalw Cardinal.thy [Finite_def] |
612 "!!X. [| Y lepoll X; Finite(X) |] ==> Finite(Y)"; |
612 "!!X. [| Y lepoll X; Finite(X) |] ==> Finite(Y)"; |
613 by (fast_tac (ZF_cs addSEs [eqpollE] |
613 by (fast_tac (ZF_cs addSEs [eqpollE] |
614 addEs [lepoll_trans RS |
614 addEs [lepoll_trans RS |
615 rewrite_rule [Finite_def] lepoll_nat_imp_Finite]) 1); |
615 rewrite_rule [Finite_def] lepoll_nat_imp_Finite]) 1); |
616 qed "lepoll_Finite"; |
616 qed "lepoll_Finite"; |
617 |
617 |
618 goalw Cardinal.thy [Finite_def] "!!x. Finite(x) ==> Finite(cons(y,x))"; |
618 goalw Cardinal.thy [Finite_def] "!!x. Finite(x) ==> Finite(cons(y,x))"; |
619 by (excluded_middle_tac "y:x" 1); |
619 by (excluded_middle_tac "y:x" 1); |
620 by (asm_simp_tac (ZF_ss addsimps [cons_absorb]) 2); |
620 by (asm_simp_tac (ZF_ss addsimps [cons_absorb]) 2); |
660 by (rewtac well_ord_def); |
660 by (rewtac well_ord_def); |
661 by (fast_tac (ZF_cs addSIs [tot_ord_converse, nat_wf_on_converse_Memrel]) 1); |
661 by (fast_tac (ZF_cs addSIs [tot_ord_converse, nat_wf_on_converse_Memrel]) 1); |
662 qed "nat_well_ord_converse_Memrel"; |
662 qed "nat_well_ord_converse_Memrel"; |
663 |
663 |
664 goal Cardinal.thy |
664 goal Cardinal.thy |
665 "!!A. [| well_ord(A,r); \ |
665 "!!A. [| well_ord(A,r); \ |
666 \ well_ord(ordertype(A,r), converse(Memrel(ordertype(A, r)))) \ |
666 \ well_ord(ordertype(A,r), converse(Memrel(ordertype(A, r)))) \ |
667 \ |] ==> well_ord(A,converse(r))"; |
667 \ |] ==> well_ord(A,converse(r))"; |
668 by (resolve_tac [well_ord_Int_iff RS iffD1] 1); |
668 by (resolve_tac [well_ord_Int_iff RS iffD1] 1); |
669 by (forward_tac [ordermap_bij RS bij_is_inj RS well_ord_rvimage] 1); |
669 by (forward_tac [ordermap_bij RS bij_is_inj RS well_ord_rvimage] 1); |
670 by (assume_tac 1); |
670 by (assume_tac 1); |
671 by (asm_full_simp_tac |
671 by (asm_full_simp_tac |
672 (ZF_ss addsimps [rvimage_converse, converse_Int, converse_prod, |
672 (ZF_ss addsimps [rvimage_converse, converse_Int, converse_prod, |
673 ordertype_ord_iso RS ord_iso_rvimage_eq]) 1); |
673 ordertype_ord_iso RS ord_iso_rvimage_eq]) 1); |
674 qed "well_ord_converse"; |
674 qed "well_ord_converse"; |
675 |
675 |
676 goal Cardinal.thy |
676 goal Cardinal.thy |
677 "!!A. [| well_ord(A,r); A eqpoll n; n:nat |] ==> ordertype(A,r)=n"; |
677 "!!A. [| well_ord(A,r); A eqpoll n; n:nat |] ==> ordertype(A,r)=n"; |
678 by (rtac (Ord_ordertype RS Ord_nat_eqpoll_iff RS iffD1) 1 THEN |
678 by (rtac (Ord_ordertype RS Ord_nat_eqpoll_iff RS iffD1) 1 THEN |