src/ZF/CardinalArith.thy
 author wenzelm Tue Sep 01 22:32:58 2015 +0200 (2015-09-01) changeset 61076 bdc1e2f0a86a parent 60770 240563fbf41d child 61378 3e04c9ca001a permissions -rw-r--r--
eliminated \<Colon>;
1 (*  Title:      ZF/CardinalArith.thy
2     Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
3     Copyright   1994  University of Cambridge
4 *)
6 section\<open>Cardinal Arithmetic Without the Axiom of Choice\<close>
8 theory CardinalArith imports Cardinal OrderArith ArithSimp Finite begin
10 definition
11   InfCard       :: "i=>o"  where
12     "InfCard(i) == Card(i) & nat \<le> i"
14 definition
15   cmult         :: "[i,i]=>i"       (infixl "|*|" 70)  where
16     "i |*| j == |i*j|"
18 definition
19   cadd          :: "[i,i]=>i"       (infixl "|+|" 65)  where
20     "i |+| j == |i+j|"
22 definition
23   csquare_rel   :: "i=>i"  where
24     "csquare_rel(K) ==
25           rvimage(K*K,
26                   lam <x,y>:K*K. <x \<union> y, x, y>,
27                   rmult(K,Memrel(K), K*K, rmult(K,Memrel(K), K,Memrel(K))))"
29 definition
30   jump_cardinal :: "i=>i"  where
31     --\<open>This def is more complex than Kunen's but it more easily proved to
32         be a cardinal\<close>
33     "jump_cardinal(K) ==
34          \<Union>X\<in>Pow(K). {z. r \<in> Pow(K*K), well_ord(X,r) & z = ordertype(X,r)}"
36 definition
37   csucc         :: "i=>i"  where
38     --\<open>needed because @{term "jump_cardinal(K)"} might not be the successor
39         of @{term K}\<close>
40     "csucc(K) == LEAST L. Card(L) & K<L"
42 notation (xsymbols)
43   cadd  (infixl "\<oplus>" 65) and
44   cmult  (infixl "\<otimes>" 70)
46 notation (HTML)
47   cadd  (infixl "\<oplus>" 65) and
48   cmult  (infixl "\<otimes>" 70)
51 lemma Card_Union [simp,intro,TC]:
52   assumes A: "\<And>x. x\<in>A \<Longrightarrow> Card(x)" shows "Card(\<Union>(A))"
53 proof (rule CardI)
54   show "Ord(\<Union>A)" using A
56 next
57   fix j
58   assume j: "j < \<Union>A"
59   hence "\<exists>c\<in>A. j < c & Card(c)" using A
60     by (auto simp add: lt_def intro: Card_is_Ord)
61   then obtain c where c: "c\<in>A" "j < c" "Card(c)"
62     by blast
63   hence jls: "j \<prec> c"
65   { assume eqp: "j \<approx> \<Union>A"
66     have  "c \<lesssim> \<Union>A" using c
67       by (blast intro: subset_imp_lepoll)
68     also have "... \<approx> j"  by (rule eqpoll_sym [OF eqp])
69     also have "... \<prec> c"  by (rule jls)
70     finally have "c \<prec> c" .
71     hence False
72       by auto
73   } thus "\<not> j \<approx> \<Union>A" by blast
74 qed
76 lemma Card_UN: "(!!x. x \<in> A ==> Card(K(x))) ==> Card(\<Union>x\<in>A. K(x))"
77   by blast
79 lemma Card_OUN [simp,intro,TC]:
80      "(!!x. x \<in> A ==> Card(K(x))) ==> Card(\<Union>x<A. K(x))"
81   by (auto simp add: OUnion_def Card_0)
83 lemma in_Card_imp_lesspoll: "[| Card(K); b \<in> K |] ==> b \<prec> K"
84 apply (unfold lesspoll_def)
86 apply (fast intro!: le_imp_lepoll ltI leI)
87 done
92 text\<open>Note: Could omit proving the algebraic laws for cardinal addition and
93 multiplication.  On finite cardinals these operations coincide with
94 addition and multiplication of natural numbers; on infinite cardinals they
95 coincide with union (maximum).  Either way we get most laws for free.\<close>
99 lemma sum_commute_eqpoll: "A+B \<approx> B+A"
100 proof (unfold eqpoll_def, rule exI)
101   show "(\<lambda>z\<in>A+B. case(Inr,Inl,z)) \<in> bij(A+B, B+A)"
102     by (auto intro: lam_bijective [where d = "case(Inr,Inl)"])
103 qed
105 lemma cadd_commute: "i \<oplus> j = j \<oplus> i"
107 apply (rule sum_commute_eqpoll [THEN cardinal_cong])
108 done
112 lemma sum_assoc_eqpoll: "(A+B)+C \<approx> A+(B+C)"
113 apply (unfold eqpoll_def)
114 apply (rule exI)
115 apply (rule sum_assoc_bij)
116 done
118 text\<open>Unconditional version requires AC\<close>
120   assumes i: "well_ord(i,ri)" and j: "well_ord(j,rj)" and k: "well_ord(k,rk)"
121   shows "(i \<oplus> j) \<oplus> k = i \<oplus> (j \<oplus> k)"
122 proof (unfold cadd_def, rule cardinal_cong)
123   have "|i + j| + k \<approx> (i + j) + k"
124     by (blast intro: sum_eqpoll_cong well_ord_cardinal_eqpoll eqpoll_refl well_ord_radd i j)
125   also have "...  \<approx> i + (j + k)"
126     by (rule sum_assoc_eqpoll)
127   also have "...  \<approx> i + |j + k|"
128     by (blast intro: sum_eqpoll_cong well_ord_cardinal_eqpoll eqpoll_refl well_ord_radd j k eqpoll_sym)
129   finally show "|i + j| + k \<approx> i + |j + k|" .
130 qed
133 subsubsection\<open>0 is the identity for addition\<close>
135 lemma sum_0_eqpoll: "0+A \<approx> A"
136 apply (unfold eqpoll_def)
137 apply (rule exI)
138 apply (rule bij_0_sum)
139 done
141 lemma cadd_0 [simp]: "Card(K) ==> 0 \<oplus> K = K"
143 apply (simp add: sum_0_eqpoll [THEN cardinal_cong] Card_cardinal_eq)
144 done
148 lemma sum_lepoll_self: "A \<lesssim> A+B"
149 proof (unfold lepoll_def, rule exI)
150   show "(\<lambda>x\<in>A. Inl (x)) \<in> inj(A, A + B)"
152 qed
154 (*Could probably weaken the premises to well_ord(K,r), or removing using AC*)
157   assumes K: "Card(K)" and L: "Ord(L)" shows "K \<le> (K \<oplus> L)"
159   have "K \<le> |K|"
160     by (rule Card_cardinal_le [OF K])
161   moreover have "|K| \<le> |K + L|" using K L
162     by (blast intro: well_ord_lepoll_imp_Card_le sum_lepoll_self
164   ultimately show "K \<le> |K + L|"
165     by (blast intro: le_trans)
166 qed
170 lemma sum_lepoll_mono:
171      "[| A \<lesssim> C;  B \<lesssim> D |] ==> A + B \<lesssim> C + D"
172 apply (unfold lepoll_def)
173 apply (elim exE)
174 apply (rule_tac x = "\<lambda>z\<in>A+B. case (%w. Inl(f`w), %y. Inr(fa`y), z)" in exI)
175 apply (rule_tac d = "case (%w. Inl(converse(f) `w), %y. Inr(converse(fa) ` y))"
176        in lam_injective)
177 apply (typecheck add: inj_is_fun, auto)
178 done
181     "[| K' \<le> K;  L' \<le> L |] ==> (K' \<oplus> L') \<le> (K \<oplus> L)"
183 apply (safe dest!: le_subset_iff [THEN iffD1])
184 apply (rule well_ord_lepoll_imp_Card_le)
185 apply (blast intro: well_ord_radd well_ord_Memrel)
186 apply (blast intro: sum_lepoll_mono subset_imp_lepoll)
187 done
191 lemma sum_succ_eqpoll: "succ(A)+B \<approx> succ(A+B)"
192 apply (unfold eqpoll_def)
193 apply (rule exI)
194 apply (rule_tac c = "%z. if z=Inl (A) then A+B else z"
195             and d = "%z. if z=A+B then Inl (A) else z" in lam_bijective)
196    apply simp_all
197 apply (blast dest: sym [THEN eq_imp_not_mem] elim: mem_irrefl)+
198 done
200 (*Pulling the  succ(...)  outside the |...| requires m, n \<in> nat  *)
201 (*Unconditional version requires AC*)
203   assumes "Ord(m)" "Ord(n)" shows "succ(m) \<oplus> n = |succ(m \<oplus> n)|"
205   have [intro]: "m + n \<approx> |m + n|" using assms
206     by (blast intro: eqpoll_sym well_ord_cardinal_eqpoll well_ord_radd well_ord_Memrel)
208   have "|succ(m) + n| = |succ(m + n)|"
209     by (rule sum_succ_eqpoll [THEN cardinal_cong])
210   also have "... = |succ(|m + n|)|"
211     by (blast intro: succ_eqpoll_cong cardinal_cong)
212   finally show "|succ(m) + n| = |succ(|m + n|)|" .
213 qed
216   assumes m: "m \<in> nat" and [simp]: "n \<in> nat" shows"m \<oplus> n = m #+ n"
217 using m
218 proof (induct m)
220 next
221   case (succ m) thus ?case by (simp add: cadd_succ_lemma nat_into_Card Card_cardinal_eq)
222 qed
225 subsection\<open>Cardinal multiplication\<close>
227 subsubsection\<open>Cardinal multiplication is commutative\<close>
229 lemma prod_commute_eqpoll: "A*B \<approx> B*A"
230 apply (unfold eqpoll_def)
231 apply (rule exI)
232 apply (rule_tac c = "%<x,y>.<y,x>" and d = "%<x,y>.<y,x>" in lam_bijective,
233        auto)
234 done
236 lemma cmult_commute: "i \<otimes> j = j \<otimes> i"
237 apply (unfold cmult_def)
238 apply (rule prod_commute_eqpoll [THEN cardinal_cong])
239 done
241 subsubsection\<open>Cardinal multiplication is associative\<close>
243 lemma prod_assoc_eqpoll: "(A*B)*C \<approx> A*(B*C)"
244 apply (unfold eqpoll_def)
245 apply (rule exI)
246 apply (rule prod_assoc_bij)
247 done
249 text\<open>Unconditional version requires AC\<close>
250 lemma well_ord_cmult_assoc:
251   assumes i: "well_ord(i,ri)" and j: "well_ord(j,rj)" and k: "well_ord(k,rk)"
252   shows "(i \<otimes> j) \<otimes> k = i \<otimes> (j \<otimes> k)"
253 proof (unfold cmult_def, rule cardinal_cong)
254   have "|i * j| * k \<approx> (i * j) * k"
255     by (blast intro: prod_eqpoll_cong well_ord_cardinal_eqpoll eqpoll_refl well_ord_rmult i j)
256   also have "...  \<approx> i * (j * k)"
257     by (rule prod_assoc_eqpoll)
258   also have "...  \<approx> i * |j * k|"
259     by (blast intro: prod_eqpoll_cong well_ord_cardinal_eqpoll eqpoll_refl well_ord_rmult j k eqpoll_sym)
260   finally show "|i * j| * k \<approx> i * |j * k|" .
261 qed
263 subsubsection\<open>Cardinal multiplication distributes over addition\<close>
265 lemma sum_prod_distrib_eqpoll: "(A+B)*C \<approx> (A*C)+(B*C)"
266 apply (unfold eqpoll_def)
267 apply (rule exI)
268 apply (rule sum_prod_distrib_bij)
269 done
272   assumes i: "well_ord(i,ri)" and j: "well_ord(j,rj)" and k: "well_ord(k,rk)"
273   shows "(i \<oplus> j) \<otimes> k = (i \<otimes> k) \<oplus> (j \<otimes> k)"
274 proof (unfold cadd_def cmult_def, rule cardinal_cong)
275   have "|i + j| * k \<approx> (i + j) * k"
276     by (blast intro: prod_eqpoll_cong well_ord_cardinal_eqpoll eqpoll_refl well_ord_radd i j)
277   also have "...  \<approx> i * k + j * k"
278     by (rule sum_prod_distrib_eqpoll)
279   also have "...  \<approx> |i * k| + |j * k|"
280     by (blast intro: sum_eqpoll_cong well_ord_cardinal_eqpoll well_ord_rmult i j k eqpoll_sym)
281   finally show "|i + j| * k \<approx> |i * k| + |j * k|" .
282 qed
284 subsubsection\<open>Multiplication by 0 yields 0\<close>
286 lemma prod_0_eqpoll: "0*A \<approx> 0"
287 apply (unfold eqpoll_def)
288 apply (rule exI)
289 apply (rule lam_bijective, safe)
290 done
292 lemma cmult_0 [simp]: "0 \<otimes> i = 0"
293 by (simp add: cmult_def prod_0_eqpoll [THEN cardinal_cong])
295 subsubsection\<open>1 is the identity for multiplication\<close>
297 lemma prod_singleton_eqpoll: "{x}*A \<approx> A"
298 apply (unfold eqpoll_def)
299 apply (rule exI)
300 apply (rule singleton_prod_bij [THEN bij_converse_bij])
301 done
303 lemma cmult_1 [simp]: "Card(K) ==> 1 \<otimes> K = K"
304 apply (unfold cmult_def succ_def)
305 apply (simp add: prod_singleton_eqpoll [THEN cardinal_cong] Card_cardinal_eq)
306 done
308 subsection\<open>Some inequalities for multiplication\<close>
310 lemma prod_square_lepoll: "A \<lesssim> A*A"
311 apply (unfold lepoll_def inj_def)
312 apply (rule_tac x = "\<lambda>x\<in>A. <x,x>" in exI, simp)
313 done
315 (*Could probably weaken the premise to well_ord(K,r), or remove using AC*)
316 lemma cmult_square_le: "Card(K) ==> K \<le> K \<otimes> K"
317 apply (unfold cmult_def)
318 apply (rule le_trans)
319 apply (rule_tac [2] well_ord_lepoll_imp_Card_le)
320 apply (rule_tac [3] prod_square_lepoll)
321 apply (simp add: le_refl Card_is_Ord Card_cardinal_eq)
322 apply (blast intro: well_ord_rmult well_ord_Memrel Card_is_Ord)
323 done
325 subsubsection\<open>Multiplication by a non-zero cardinal\<close>
327 lemma prod_lepoll_self: "b \<in> B ==> A \<lesssim> A*B"
328 apply (unfold lepoll_def inj_def)
329 apply (rule_tac x = "\<lambda>x\<in>A. <x,b>" in exI, simp)
330 done
332 (*Could probably weaken the premises to well_ord(K,r), or removing using AC*)
333 lemma cmult_le_self:
334     "[| Card(K);  Ord(L);  0<L |] ==> K \<le> (K \<otimes> L)"
335 apply (unfold cmult_def)
336 apply (rule le_trans [OF Card_cardinal_le well_ord_lepoll_imp_Card_le])
337   apply assumption
338  apply (blast intro: well_ord_rmult well_ord_Memrel Card_is_Ord)
339 apply (blast intro: prod_lepoll_self ltD)
340 done
342 subsubsection\<open>Monotonicity of multiplication\<close>
344 lemma prod_lepoll_mono:
345      "[| A \<lesssim> C;  B \<lesssim> D |] ==> A * B  \<lesssim>  C * D"
346 apply (unfold lepoll_def)
347 apply (elim exE)
348 apply (rule_tac x = "lam <w,y>:A*B. <f`w, fa`y>" in exI)
349 apply (rule_tac d = "%<w,y>. <converse (f) `w, converse (fa) `y>"
350        in lam_injective)
351 apply (typecheck add: inj_is_fun, auto)
352 done
354 lemma cmult_le_mono:
355     "[| K' \<le> K;  L' \<le> L |] ==> (K' \<otimes> L') \<le> (K \<otimes> L)"
356 apply (unfold cmult_def)
357 apply (safe dest!: le_subset_iff [THEN iffD1])
358 apply (rule well_ord_lepoll_imp_Card_le)
359  apply (blast intro: well_ord_rmult well_ord_Memrel)
360 apply (blast intro: prod_lepoll_mono subset_imp_lepoll)
361 done
363 subsection\<open>Multiplication of finite cardinals is "ordinary" multiplication\<close>
365 lemma prod_succ_eqpoll: "succ(A)*B \<approx> B + A*B"
366 apply (unfold eqpoll_def)
367 apply (rule exI)
368 apply (rule_tac c = "%<x,y>. if x=A then Inl (y) else Inr (<x,y>)"
369             and d = "case (%y. <A,y>, %z. z)" in lam_bijective)
370 apply safe
371 apply (simp_all add: succI2 if_type mem_imp_not_eq)
372 done
374 (*Unconditional version requires AC*)
375 lemma cmult_succ_lemma:
376     "[| Ord(m);  Ord(n) |] ==> succ(m) \<otimes> n = n \<oplus> (m \<otimes> n)"
378 apply (rule prod_succ_eqpoll [THEN cardinal_cong, THEN trans])
379 apply (rule cardinal_cong [symmetric])
380 apply (rule sum_eqpoll_cong [OF eqpoll_refl well_ord_cardinal_eqpoll])
381 apply (blast intro: well_ord_rmult well_ord_Memrel)
382 done
384 lemma nat_cmult_eq_mult: "[| m \<in> nat;  n \<in> nat |] ==> m \<otimes> n = m#*n"
385 apply (induct_tac m)
387 done
389 lemma cmult_2: "Card(n) ==> 2 \<otimes> n = n \<oplus> n"
392 lemma sum_lepoll_prod:
393   assumes C: "2 \<lesssim> C" shows "B+B \<lesssim> C*B"
394 proof -
395   have "B+B \<lesssim> 2*B"
397   also have "... \<lesssim> C*B"
398     by (blast intro: prod_lepoll_mono lepoll_refl C)
399   finally show "B+B \<lesssim> C*B" .
400 qed
402 lemma lepoll_imp_sum_lepoll_prod: "[| A \<lesssim> B; 2 \<lesssim> A |] ==> A+B \<lesssim> A*B"
403 by (blast intro: sum_lepoll_mono sum_lepoll_prod lepoll_trans lepoll_refl)
406 subsection\<open>Infinite Cardinals are Limit Ordinals\<close>
408 (*This proof is modelled upon one assuming nat<=A, with injection
409   \<lambda>z\<in>cons(u,A). if z=u then 0 else if z \<in> nat then succ(z) else z
410   and inverse %y. if y \<in> nat then nat_case(u, %z. z, y) else y.  \
411   If f \<in> inj(nat,A) then range(f) behaves like the natural numbers.*)
412 lemma nat_cons_lepoll: "nat \<lesssim> A ==> cons(u,A) \<lesssim> A"
413 apply (unfold lepoll_def)
414 apply (erule exE)
415 apply (rule_tac x =
416           "\<lambda>z\<in>cons (u,A).
417              if z=u then f`0
418              else if z \<in> range (f) then f`succ (converse (f) `z) else z"
419        in exI)
420 apply (rule_tac d =
421           "%y. if y \<in> range(f) then nat_case (u, %z. f`z, converse(f) `y)
422                               else y"
423        in lam_injective)
424 apply (fast intro!: if_type apply_type intro: inj_is_fun inj_converse_fun)
425 apply (simp add: inj_is_fun [THEN apply_rangeI]
426                  inj_converse_fun [THEN apply_rangeI]
427                  inj_converse_fun [THEN apply_funtype])
428 done
430 lemma nat_cons_eqpoll: "nat \<lesssim> A ==> cons(u,A) \<approx> A"
431 apply (erule nat_cons_lepoll [THEN eqpollI])
432 apply (rule subset_consI [THEN subset_imp_lepoll])
433 done
435 (*Specialized version required below*)
436 lemma nat_succ_eqpoll: "nat \<subseteq> A ==> succ(A) \<approx> A"
437 apply (unfold succ_def)
438 apply (erule subset_imp_lepoll [THEN nat_cons_eqpoll])
439 done
441 lemma InfCard_nat: "InfCard(nat)"
442 apply (unfold InfCard_def)
443 apply (blast intro: Card_nat le_refl Card_is_Ord)
444 done
446 lemma InfCard_is_Card: "InfCard(K) ==> Card(K)"
447 apply (unfold InfCard_def)
448 apply (erule conjunct1)
449 done
451 lemma InfCard_Un:
452     "[| InfCard(K);  Card(L) |] ==> InfCard(K \<union> L)"
453 apply (unfold InfCard_def)
454 apply (simp add: Card_Un Un_upper1_le [THEN [2] le_trans]  Card_is_Ord)
455 done
457 (*Kunen's Lemma 10.11*)
458 lemma InfCard_is_Limit: "InfCard(K) ==> Limit(K)"
459 apply (unfold InfCard_def)
460 apply (erule conjE)
461 apply (frule Card_is_Ord)
462 apply (rule ltI [THEN non_succ_LimitI])
463 apply (erule le_imp_subset [THEN subsetD])
464 apply (safe dest!: Limit_nat [THEN Limit_le_succD])
465 apply (unfold Card_def)
466 apply (drule trans)
467 apply (erule le_imp_subset [THEN nat_succ_eqpoll, THEN cardinal_cong])
468 apply (erule Ord_cardinal_le [THEN lt_trans2, THEN lt_irrefl])
469 apply (rule le_eqI, assumption)
470 apply (rule Ord_cardinal)
471 done
474 (*** An infinite cardinal equals its square (Kunen, Thm 10.12, page 29) ***)
476 (*A general fact about ordermap*)
477 lemma ordermap_eqpoll_pred:
478     "[| well_ord(A,r);  x \<in> A |] ==> ordermap(A,r)`x \<approx> Order.pred(A,x,r)"
479 apply (unfold eqpoll_def)
480 apply (rule exI)
481 apply (simp add: ordermap_eq_image well_ord_is_wf)
482 apply (erule ordermap_bij [THEN bij_is_inj, THEN restrict_bij,
483                            THEN bij_converse_bij])
484 apply (rule pred_subset)
485 done
487 subsubsection\<open>Establishing the well-ordering\<close>
489 lemma well_ord_csquare:
490   assumes K: "Ord(K)" shows "well_ord(K*K, csquare_rel(K))"
491 proof (unfold csquare_rel_def, rule well_ord_rvimage)
492   show "(\<lambda>\<langle>x,y\<rangle>\<in>K \<times> K. \<langle>x \<union> y, x, y\<rangle>) \<in> inj(K \<times> K, K \<times> K \<times> K)" using K
493     by (force simp add: inj_def intro: lam_type Un_least_lt [THEN ltD] ltI)
494 next
495   show "well_ord(K \<times> K \<times> K, rmult(K, Memrel(K), K \<times> K, rmult(K, Memrel(K), K, Memrel(K))))"
496     using K by (blast intro: well_ord_rmult well_ord_Memrel)
497 qed
499 subsubsection\<open>Characterising initial segments of the well-ordering\<close>
501 lemma csquareD:
502  "[| <<x,y>, <z,z>> \<in> csquare_rel(K);  x<K;  y<K;  z<K |] ==> x \<le> z & y \<le> z"
503 apply (unfold csquare_rel_def)
504 apply (erule rev_mp)
505 apply (elim ltE)
506 apply (simp add: rvimage_iff Un_absorb Un_least_mem_iff ltD)
507 apply (safe elim!: mem_irrefl intro!: Un_upper1_le Un_upper2_le)
508 apply (simp_all add: lt_def succI2)
509 done
511 lemma pred_csquare_subset:
512     "z<K ==> Order.pred(K*K, <z,z>, csquare_rel(K)) \<subseteq> succ(z)*succ(z)"
513 apply (unfold Order.pred_def)
514 apply (safe del: SigmaI dest!: csquareD)
515 apply (unfold lt_def, auto)
516 done
518 lemma csquare_ltI:
519  "[| x<z;  y<z;  z<K |] ==>  <<x,y>, <z,z>> \<in> csquare_rel(K)"
520 apply (unfold csquare_rel_def)
521 apply (subgoal_tac "x<K & y<K")
522  prefer 2 apply (blast intro: lt_trans)
523 apply (elim ltE)
524 apply (simp add: rvimage_iff Un_absorb Un_least_mem_iff ltD)
525 done
527 (*Part of the traditional proof.  UNUSED since it's harder to prove & apply *)
528 lemma csquare_or_eqI:
529  "[| x \<le> z;  y \<le> z;  z<K |] ==> <<x,y>, <z,z>> \<in> csquare_rel(K) | x=z & y=z"
530 apply (unfold csquare_rel_def)
531 apply (subgoal_tac "x<K & y<K")
532  prefer 2 apply (blast intro: lt_trans1)
533 apply (elim ltE)
534 apply (simp add: rvimage_iff Un_absorb Un_least_mem_iff ltD)
535 apply (elim succE)
536 apply (simp_all add: subset_Un_iff [THEN iff_sym]
537                      subset_Un_iff2 [THEN iff_sym] OrdmemD)
538 done
540 subsubsection\<open>The cardinality of initial segments\<close>
542 lemma ordermap_z_lt:
543       "[| Limit(K);  x<K;  y<K;  z=succ(x \<union> y) |] ==>
544           ordermap(K*K, csquare_rel(K)) ` <x,y> <
545           ordermap(K*K, csquare_rel(K)) ` <z,z>"
546 apply (subgoal_tac "z<K & well_ord (K*K, csquare_rel (K))")
547 prefer 2 apply (blast intro!: Un_least_lt Limit_has_succ
548                               Limit_is_Ord [THEN well_ord_csquare], clarify)
549 apply (rule csquare_ltI [THEN ordermap_mono, THEN ltI])
550 apply (erule_tac [4] well_ord_is_wf)
551 apply (blast intro!: Un_upper1_le Un_upper2_le Ord_ordermap elim!: ltE)+
552 done
554 text\<open>Kunen: "each @{term"\<langle>x,y\<rangle> \<in> K \<times> K"} has no more than @{term"z \<times> z"} predecessors..." (page 29)\<close>
555 lemma ordermap_csquare_le:
556   assumes K: "Limit(K)" and x: "x<K" and y: " y<K"
557   defines "z \<equiv> succ(x \<union> y)"
558   shows "|ordermap(K \<times> K, csquare_rel(K)) ` \<langle>x,y\<rangle>| \<le> |succ(z)| \<otimes> |succ(z)|"
559 proof (unfold cmult_def, rule well_ord_lepoll_imp_Card_le)
560   show "well_ord(|succ(z)| \<times> |succ(z)|,
561                  rmult(|succ(z)|, Memrel(|succ(z)|), |succ(z)|, Memrel(|succ(z)|)))"
562     by (blast intro: Ord_cardinal well_ord_Memrel well_ord_rmult)
563 next
564   have zK: "z<K" using x y K z_def
565     by (blast intro: Un_least_lt Limit_has_succ)
566   hence oz: "Ord(z)" by (elim ltE)
567   have "ordermap(K \<times> K, csquare_rel(K)) ` \<langle>x,y\<rangle> \<lesssim> ordermap(K \<times> K, csquare_rel(K)) ` \<langle>z,z\<rangle>"
568     using z_def
569     by (blast intro: ordermap_z_lt leI le_imp_lepoll K x y)
570   also have "... \<approx>  Order.pred(K \<times> K, \<langle>z,z\<rangle>, csquare_rel(K))"
571     proof (rule ordermap_eqpoll_pred)
572       show "well_ord(K \<times> K, csquare_rel(K))" using K
573         by (rule Limit_is_Ord [THEN well_ord_csquare])
574     next
575       show "\<langle>z, z\<rangle> \<in> K \<times> K" using zK
576         by (blast intro: ltD)
577     qed
578   also have "...  \<lesssim> succ(z) \<times> succ(z)" using zK
579     by (rule pred_csquare_subset [THEN subset_imp_lepoll])
580   also have "... \<approx> |succ(z)| \<times> |succ(z)|" using oz
581     by (blast intro: prod_eqpoll_cong Ord_succ Ord_cardinal_eqpoll eqpoll_sym)
582   finally show "ordermap(K \<times> K, csquare_rel(K)) ` \<langle>x,y\<rangle> \<lesssim> |succ(z)| \<times> |succ(z)|" .
583 qed
585 text\<open>Kunen: "... so the order type is @{text"\<le>"} K"\<close>
586 lemma ordertype_csquare_le:
587   assumes IK: "InfCard(K)" and eq: "\<And>y. y\<in>K \<Longrightarrow> InfCard(y) \<Longrightarrow> y \<otimes> y = y"
588   shows "ordertype(K*K, csquare_rel(K)) \<le> K"
589 proof -
590   have  CK: "Card(K)" using IK by (rule InfCard_is_Card)
591   hence OK: "Ord(K)"  by (rule Card_is_Ord)
592   moreover have "Ord(ordertype(K \<times> K, csquare_rel(K)))" using OK
593     by (rule well_ord_csquare [THEN Ord_ordertype])
594   ultimately show ?thesis
595   proof (rule all_lt_imp_le)
596     fix i
597     assume i: "i < ordertype(K \<times> K, csquare_rel(K))"
598     hence Oi: "Ord(i)" by (elim ltE)
599     obtain x y where x: "x \<in> K" and y: "y \<in> K"
600                  and ieq: "i = ordermap(K \<times> K, csquare_rel(K)) ` \<langle>x,y\<rangle>"
601       using i by (auto simp add: ordertype_unfold elim: ltE)
602     hence xy: "Ord(x)" "Ord(y)" "x < K" "y < K" using OK
603       by (blast intro: Ord_in_Ord ltI)+
604     hence ou: "Ord(x \<union> y)"
606     show "i < K"
607       proof (rule Card_lt_imp_lt [OF _ Oi CK])
608         have "|i| \<le> |succ(succ(x \<union> y))| \<otimes> |succ(succ(x \<union> y))|" using IK xy
609           by (auto simp add: ieq intro: InfCard_is_Limit [THEN ordermap_csquare_le])
610         moreover have "|succ(succ(x \<union> y))| \<otimes> |succ(succ(x \<union> y))| < K"
611           proof (cases rule: Ord_linear2 [OF ou Ord_nat])
612             assume "x \<union> y < nat"
613             hence "|succ(succ(x \<union> y))| \<otimes> |succ(succ(x \<union> y))| \<in> nat"
614               by (simp add: lt_def nat_cmult_eq_mult nat_succI mult_type
615                          nat_into_Card [THEN Card_cardinal_eq]  Ord_nat)
616             also have "... \<subseteq> K" using IK
617               by (simp add: InfCard_def le_imp_subset)
618             finally show "|succ(succ(x \<union> y))| \<otimes> |succ(succ(x \<union> y))| < K"
619               by (simp add: ltI OK)
620           next
621             assume natxy: "nat \<le> x \<union> y"
622             hence seq: "|succ(succ(x \<union> y))| = |x \<union> y|" using xy
623               by (simp add: le_imp_subset nat_succ_eqpoll [THEN cardinal_cong] le_succ_iff)
624             also have "... < K" using xy
625               by (simp add: Un_least_lt Ord_cardinal_le [THEN lt_trans1])
626             finally have "|succ(succ(x \<union> y))| < K" .
627             moreover have "InfCard(|succ(succ(x \<union> y))|)" using xy natxy
628               by (simp add: seq InfCard_def Card_cardinal nat_le_cardinal)
629             ultimately show ?thesis  by (simp add: eq ltD)
630           qed
631         ultimately show "|i| < K" by (blast intro: lt_trans1)
632     qed
633   qed
634 qed
636 (*Main result: Kunen's Theorem 10.12*)
637 lemma InfCard_csquare_eq:
638   assumes IK: "InfCard(K)" shows "InfCard(K) ==> K \<otimes> K = K"
639 proof -
640   have  OK: "Ord(K)" using IK by (simp add: Card_is_Ord InfCard_is_Card)
641   show "InfCard(K) ==> K \<otimes> K = K" using OK
642   proof (induct rule: trans_induct)
643     case (step i)
644     show "i \<otimes> i = i"
645     proof (rule le_anti_sym)
646       have "|i \<times> i| = |ordertype(i \<times> i, csquare_rel(i))|"
647         by (rule cardinal_cong,
648           simp add: step.hyps well_ord_csquare [THEN ordermap_bij, THEN bij_imp_eqpoll])
649       hence "i \<otimes> i \<le> ordertype(i \<times> i, csquare_rel(i))"
650         by (simp add: step.hyps cmult_def Ord_cardinal_le well_ord_csquare [THEN Ord_ordertype])
651       moreover
652       have "ordertype(i \<times> i, csquare_rel(i)) \<le> i" using step
654       ultimately show "i \<otimes> i \<le> i" by (rule le_trans)
655     next
656       show "i \<le> i \<otimes> i" using step
657         by (blast intro: cmult_square_le InfCard_is_Card)
658     qed
659   qed
660 qed
662 (*Corollary for arbitrary well-ordered sets (all sets, assuming AC)*)
663 lemma well_ord_InfCard_square_eq:
664   assumes r: "well_ord(A,r)" and I: "InfCard(|A|)" shows "A \<times> A \<approx> A"
665 proof -
666   have "A \<times> A \<approx> |A| \<times> |A|"
667     by (blast intro: prod_eqpoll_cong well_ord_cardinal_eqpoll eqpoll_sym r)
668   also have "... \<approx> A"
669     proof (rule well_ord_cardinal_eqE [OF _ r])
670       show "well_ord(|A| \<times> |A|, rmult(|A|, Memrel(|A|), |A|, Memrel(|A|)))"
671         by (blast intro: Ord_cardinal well_ord_rmult well_ord_Memrel r)
672     next
673       show "||A| \<times> |A|| = |A|" using InfCard_csquare_eq I
675     qed
676   finally show ?thesis .
677 qed
679 lemma InfCard_square_eqpoll: "InfCard(K) ==> K \<times> K \<approx> K"
680 apply (rule well_ord_InfCard_square_eq)
681  apply (erule InfCard_is_Card [THEN Card_is_Ord, THEN well_ord_Memrel])
682 apply (simp add: InfCard_is_Card [THEN Card_cardinal_eq])
683 done
685 lemma Inf_Card_is_InfCard: "[| Card(i); ~ Finite(i) |] ==> InfCard(i)"
686 by (simp add: InfCard_def Card_is_Ord [THEN nat_le_infinite_Ord])
688 subsubsection\<open>Toward's Kunen's Corollary 10.13 (1)\<close>
690 lemma InfCard_le_cmult_eq: "[| InfCard(K);  L \<le> K;  0<L |] ==> K \<otimes> L = K"
691 apply (rule le_anti_sym)
692  prefer 2
693  apply (erule ltE, blast intro: cmult_le_self InfCard_is_Card)
694 apply (frule InfCard_is_Card [THEN Card_is_Ord, THEN le_refl])
695 apply (rule cmult_le_mono [THEN le_trans], assumption+)
697 done
699 (*Corollary 10.13 (1), for cardinal multiplication*)
700 lemma InfCard_cmult_eq: "[| InfCard(K);  InfCard(L) |] ==> K \<otimes> L = K \<union> L"
701 apply (rule_tac i = K and j = L in Ord_linear_le)
702 apply (typecheck add: InfCard_is_Card Card_is_Ord)
703 apply (rule cmult_commute [THEN ssubst])
704 apply (rule Un_commute [THEN ssubst])
705 apply (simp_all add: InfCard_is_Limit [THEN Limit_has_0] InfCard_le_cmult_eq
706                      subset_Un_iff2 [THEN iffD1] le_imp_subset)
707 done
709 lemma InfCard_cdouble_eq: "InfCard(K) ==> K \<oplus> K = K"
710 apply (simp add: cmult_2 [symmetric] InfCard_is_Card cmult_commute)
711 apply (simp add: InfCard_le_cmult_eq InfCard_is_Limit Limit_has_0 Limit_has_succ)
712 done
714 (*Corollary 10.13 (1), for cardinal addition*)
715 lemma InfCard_le_cadd_eq: "[| InfCard(K);  L \<le> K |] ==> K \<oplus> L = K"
716 apply (rule le_anti_sym)
717  prefer 2
718  apply (erule ltE, blast intro: cadd_le_self InfCard_is_Card)
719 apply (frule InfCard_is_Card [THEN Card_is_Ord, THEN le_refl])
720 apply (rule cadd_le_mono [THEN le_trans], assumption+)
722 done
724 lemma InfCard_cadd_eq: "[| InfCard(K);  InfCard(L) |] ==> K \<oplus> L = K \<union> L"
725 apply (rule_tac i = K and j = L in Ord_linear_le)
726 apply (typecheck add: InfCard_is_Card Card_is_Ord)
727 apply (rule cadd_commute [THEN ssubst])
728 apply (rule Un_commute [THEN ssubst])
730 done
732 (*The other part, Corollary 10.13 (2), refers to the cardinality of the set
733   of all n-tuples of elements of K.  A better version for the Isabelle theory
734   might be  InfCard(K) ==> |list(K)| = K.
735 *)
737 subsection\<open>For Every Cardinal Number There Exists A Greater One\<close>
739 text\<open>This result is Kunen's Theorem 10.16, which would be trivial using AC\<close>
741 lemma Ord_jump_cardinal: "Ord(jump_cardinal(K))"
742 apply (unfold jump_cardinal_def)
743 apply (rule Ord_is_Transset [THEN [2] OrdI])
744  prefer 2 apply (blast intro!: Ord_ordertype)
745 apply (unfold Transset_def)
746 apply (safe del: subsetI)
747 apply (simp add: ordertype_pred_unfold, safe)
748 apply (rule UN_I)
749 apply (rule_tac [2] ReplaceI)
750    prefer 4 apply (blast intro: well_ord_subset elim!: predE)+
751 done
753 (*Allows selective unfolding.  Less work than deriving intro/elim rules*)
754 lemma jump_cardinal_iff:
755      "i \<in> jump_cardinal(K) \<longleftrightarrow>
756       (\<exists>r X. r \<subseteq> K*K & X \<subseteq> K & well_ord(X,r) & i = ordertype(X,r))"
757 apply (unfold jump_cardinal_def)
758 apply (blast del: subsetI)
759 done
761 (*The easy part of Theorem 10.16: jump_cardinal(K) exceeds K*)
762 lemma K_lt_jump_cardinal: "Ord(K) ==> K < jump_cardinal(K)"
763 apply (rule Ord_jump_cardinal [THEN [2] ltI])
764 apply (rule jump_cardinal_iff [THEN iffD2])
765 apply (rule_tac x="Memrel(K)" in exI)
766 apply (rule_tac x=K in exI)
767 apply (simp add: ordertype_Memrel well_ord_Memrel)
768 apply (simp add: Memrel_def subset_iff)
769 done
771 (*The proof by contradiction: the bijection f yields a wellordering of X
772   whose ordertype is jump_cardinal(K).  *)
773 lemma Card_jump_cardinal_lemma:
774      "[| well_ord(X,r);  r \<subseteq> K * K;  X \<subseteq> K;
775          f \<in> bij(ordertype(X,r), jump_cardinal(K)) |]
776       ==> jump_cardinal(K) \<in> jump_cardinal(K)"
777 apply (subgoal_tac "f O ordermap (X,r) \<in> bij (X, jump_cardinal (K))")
778  prefer 2 apply (blast intro: comp_bij ordermap_bij)
779 apply (rule jump_cardinal_iff [THEN iffD2])
780 apply (intro exI conjI)
781 apply (rule subset_trans [OF rvimage_type Sigma_mono], assumption+)
782 apply (erule bij_is_inj [THEN well_ord_rvimage])
783 apply (rule Ord_jump_cardinal [THEN well_ord_Memrel])
784 apply (simp add: well_ord_Memrel [THEN [2] bij_ordertype_vimage]
785                  ordertype_Memrel Ord_jump_cardinal)
786 done
788 (*The hard part of Theorem 10.16: jump_cardinal(K) is itself a cardinal*)
789 lemma Card_jump_cardinal: "Card(jump_cardinal(K))"
790 apply (rule Ord_jump_cardinal [THEN CardI])
791 apply (unfold eqpoll_def)
792 apply (safe dest!: ltD jump_cardinal_iff [THEN iffD1])
793 apply (blast intro: Card_jump_cardinal_lemma [THEN mem_irrefl])
794 done
796 subsection\<open>Basic Properties of Successor Cardinals\<close>
798 lemma csucc_basic: "Ord(K) ==> Card(csucc(K)) & K < csucc(K)"
799 apply (unfold csucc_def)
800 apply (rule LeastI)
801 apply (blast intro: Card_jump_cardinal K_lt_jump_cardinal Ord_jump_cardinal)+
802 done
804 lemmas Card_csucc = csucc_basic [THEN conjunct1]
806 lemmas lt_csucc = csucc_basic [THEN conjunct2]
808 lemma Ord_0_lt_csucc: "Ord(K) ==> 0 < csucc(K)"
809 by (blast intro: Ord_0_le lt_csucc lt_trans1)
811 lemma csucc_le: "[| Card(L);  K<L |] ==> csucc(K) \<le> L"
812 apply (unfold csucc_def)
813 apply (rule Least_le)
814 apply (blast intro: Card_is_Ord)+
815 done
817 lemma lt_csucc_iff: "[| Ord(i); Card(K) |] ==> i < csucc(K) \<longleftrightarrow> |i| \<le> K"
818 apply (rule iffI)
819 apply (rule_tac [2] Card_lt_imp_lt)
820 apply (erule_tac [2] lt_trans1)
821 apply (simp_all add: lt_csucc Card_csucc Card_is_Ord)
822 apply (rule notI [THEN not_lt_imp_le])
823 apply (rule Card_cardinal [THEN csucc_le, THEN lt_trans1, THEN lt_irrefl], assumption)
824 apply (rule Ord_cardinal_le [THEN lt_trans1])
825 apply (simp_all add: Ord_cardinal Card_is_Ord)
826 done
828 lemma Card_lt_csucc_iff:
829      "[| Card(K'); Card(K) |] ==> K' < csucc(K) \<longleftrightarrow> K' \<le> K"
830 by (simp add: lt_csucc_iff Card_cardinal_eq Card_is_Ord)
832 lemma InfCard_csucc: "InfCard(K) ==> InfCard(csucc(K))"
833 by (simp add: InfCard_def Card_csucc Card_is_Ord
834               lt_csucc [THEN leI, THEN [2] le_trans])
837 subsubsection\<open>Removing elements from a finite set decreases its cardinality\<close>
839 lemma Finite_imp_cardinal_cons [simp]:
840   assumes FA: "Finite(A)" and a: "a\<notin>A" shows "|cons(a,A)| = succ(|A|)"
841 proof -
842   { fix X
843     have "Finite(X) ==> a \<notin> X \<Longrightarrow> cons(a,X) \<lesssim> X \<Longrightarrow> False"
844       proof (induct X rule: Finite_induct)
845         case 0 thus False  by (simp add: lepoll_0_iff)
846       next
847         case (cons x Y)
848         hence "cons(x, cons(a, Y)) \<lesssim> cons(x, Y)" by (simp add: cons_commute)
849         hence "cons(a, Y) \<lesssim> Y" using cons        by (blast dest: cons_lepoll_consD)
850         thus False using cons by auto
851       qed
852   }
853   hence [simp]: "~ cons(a,A) \<lesssim> A" using a FA by auto
854   have [simp]: "|A| \<approx> A" using Finite_imp_well_ord [OF FA]
855     by (blast intro: well_ord_cardinal_eqpoll)
856   have "(\<mu> i. i \<approx> cons(a, A)) = succ(|A|)"
857     proof (rule Least_equality [OF _ _ notI])
858       show "succ(|A|) \<approx> cons(a, A)"
859         by (simp add: succ_def cons_eqpoll_cong mem_not_refl a)
860     next
861       show "Ord(succ(|A|))" by simp
862     next
863       fix i
864       assume i: "i \<le> |A|" "i \<approx> cons(a, A)"
865       have "cons(a, A) \<approx> i" by (rule eqpoll_sym) (rule i)
866       also have "... \<lesssim> |A|" by (rule le_imp_lepoll) (rule i)
867       also have "... \<approx> A"   by simp
868       finally have "cons(a, A) \<lesssim> A" .
869       thus False by simp
870     qed
871   thus ?thesis by (simp add: cardinal_def)
872 qed
874 lemma Finite_imp_succ_cardinal_Diff:
875      "[| Finite(A);  a \<in> A |] ==> succ(|A-{a}|) = |A|"
876 apply (rule_tac b = A in cons_Diff [THEN subst], assumption)
877 apply (simp add: Finite_imp_cardinal_cons Diff_subset [THEN subset_Finite])
879 done
881 lemma Finite_imp_cardinal_Diff: "[| Finite(A);  a \<in> A |] ==> |A-{a}| < |A|"
882 apply (rule succ_leE)
884 done
886 lemma Finite_cardinal_in_nat [simp]: "Finite(A) ==> |A| \<in> nat"
887 proof (induct rule: Finite_induct)
888   case 0 thus ?case by (simp add: cardinal_0)
889 next
890   case (cons x A) thus ?case by (simp add: Finite_imp_cardinal_cons)
891 qed
893 lemma card_Un_Int:
894      "[|Finite(A); Finite(B)|] ==> |A| #+ |B| = |A \<union> B| #+ |A \<inter> B|"
895 apply (erule Finite_induct, simp)
896 apply (simp add: Finite_Int cons_absorb Un_cons Int_cons_left)
897 done
899 lemma card_Un_disjoint:
900      "[|Finite(A); Finite(B); A \<inter> B = 0|] ==> |A \<union> B| = |A| #+ |B|"
901 by (simp add: Finite_Un card_Un_Int)
903 lemma card_partition:
904   assumes FC: "Finite(C)"
905   shows
906      "Finite (\<Union> C) \<Longrightarrow>
907         (\<forall>c\<in>C. |c| = k) \<Longrightarrow>
908         (\<forall>c1 \<in> C. \<forall>c2 \<in> C. c1 \<noteq> c2 \<longrightarrow> c1 \<inter> c2 = 0) \<Longrightarrow>
909         k #* |C| = |\<Union> C|"
910 using FC
911 proof (induct rule: Finite_induct)
912   case 0 thus ?case by simp
913 next
914   case (cons x B)
915   hence "x \<inter> \<Union>B = 0" by auto
916   thus ?case using cons
917     by (auto simp add: card_Un_disjoint)
918 qed
921 subsubsection\<open>Theorems by Krzysztof Grabczewski, proofs by lcp\<close>
923 lemmas nat_implies_well_ord = nat_into_Ord [THEN well_ord_Memrel]
925 lemma nat_sum_eqpoll_sum:
926   assumes m: "m \<in> nat" and n: "n \<in> nat" shows "m + n \<approx> m #+ n"
927 proof -
928   have "m + n \<approx> |m+n|" using m n
929     by (blast intro: nat_implies_well_ord well_ord_radd well_ord_cardinal_eqpoll eqpoll_sym)
930   also have "... = m #+ n" using m n
932   finally show ?thesis .
933 qed
935 lemma Ord_subset_natD [rule_format]: "Ord(i) ==> i \<subseteq> nat \<Longrightarrow> i \<in> nat | i=nat"
936 proof (induct i rule: trans_induct3)
937   case 0 thus ?case by auto
938 next
939   case (succ i) thus ?case by auto
940 next
941   case (limit l) thus ?case
942     by (blast dest: nat_le_Limit le_imp_subset)
943 qed
945 lemma Ord_nat_subset_into_Card: "[| Ord(i); i \<subseteq> nat |] ==> Card(i)"
946 by (blast dest: Ord_subset_natD intro: Card_nat nat_into_Card)
948 end