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