src/HOL/Cardinals/Cardinal_Arithmetic_LFP.thy
author blanchet
Mon, 18 Nov 2013 18:04:44 +0100
changeset 54474 6d5941722fae
child 54480 57e781b711b5
permissions -rw-r--r--
split 'Cardinal_Arithmetic' 3-way
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
54474
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
     1
(*  Title:      HOL/Cardinals/Cardinal_Arithmetic_LFP.thy
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
     2
    Author:     Dmitriy Traytel, TU Muenchen
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
     3
    Copyright   2012
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
     4
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
     5
Cardinal arithmetic.
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
     6
*)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
     7
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
     8
header {* Cardinal Arithmetic  *}
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
     9
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
    10
theory Cardinal_Arithmetic_LFP
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
    11
imports Cardinal_Order_Relation_LFP
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
    12
begin
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
    13
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
    14
(*library candidate*)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
    15
lemma dir_image: "\<lbrakk>\<And>x y. (f x = f y) = (x = y); Card_order r\<rbrakk> \<Longrightarrow> r =o dir_image r f"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
    16
by (rule dir_image_ordIso) (auto simp add: inj_on_def card_order_on_def)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
    17
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
    18
(*should supersede a weaker lemma from the library*)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
    19
lemma dir_image_Field: "Field (dir_image r f) = f ` Field r"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
    20
unfolding dir_image_def Field_def Range_def Domain_def by fastforce
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
    21
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
    22
lemma card_order_dir_image:
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
    23
  assumes bij: "bij f" and co: "card_order r"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
    24
  shows "card_order (dir_image r f)"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
    25
proof -
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
    26
  from assms have "Field (dir_image r f) = UNIV"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
    27
    using card_order_on_Card_order[of UNIV r] unfolding bij_def dir_image_Field by auto
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
    28
  moreover from bij have "\<And>x y. (f x = f y) = (x = y)" unfolding bij_def inj_on_def by auto
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
    29
  with co have "Card_order (dir_image r f)"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
    30
    using card_order_on_Card_order[of UNIV r] Card_order_ordIso2[OF _ dir_image] by blast
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
    31
  ultimately show ?thesis by auto
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
    32
qed
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
    33
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
    34
(*library candidate*)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
    35
lemma ordIso_refl: "Card_order r \<Longrightarrow> r =o r"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
    36
by (rule card_order_on_ordIso)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
    37
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
    38
(*library candidate*)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
    39
lemma ordLeq_refl: "Card_order r \<Longrightarrow> r \<le>o r"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
    40
by (rule ordIso_imp_ordLeq, rule card_order_on_ordIso)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
    41
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
    42
(*library candidate*)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
    43
lemma card_of_ordIso_subst: "A = B \<Longrightarrow> |A| =o |B|"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
    44
by (simp only: ordIso_refl card_of_Card_order)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
    45
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
    46
(*library candidate*)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
    47
lemma Field_card_order: "card_order r \<Longrightarrow> Field r = UNIV"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
    48
using card_order_on_Card_order[of UNIV r] by simp
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
    49
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
    50
(*library candidate*)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
    51
lemma card_of_Times_Plus_distrib:
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
    52
  "|A <*> (B <+> C)| =o |A <*> B <+> A <*> C|" (is "|?RHS| =o |?LHS|")
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
    53
proof -
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
    54
  let ?f = "\<lambda>(a, bc). case bc of Inl b \<Rightarrow> Inl (a, b) | Inr c \<Rightarrow> Inr (a, c)"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
    55
  have "bij_betw ?f ?RHS ?LHS" unfolding bij_betw_def inj_on_def by force
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
    56
  thus ?thesis using card_of_ordIso by blast
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
    57
qed
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
    58
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
    59
(*library candidate*)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
    60
lemma Func_Times_Range:
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
    61
  "|Func A (B <*> C)| =o |Func A B <*> Func A C|" (is "|?LHS| =o |?RHS|")
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
    62
proof -
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
    63
  let ?F = "\<lambda>fg. (\<lambda>x. if x \<in> A then fst (fg x) else undefined,
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
    64
                  \<lambda>x. if x \<in> A then snd (fg x) else undefined)"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
    65
  let ?G = "\<lambda>(f, g) x. if x \<in> A then (f x, g x) else undefined"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
    66
  have "bij_betw ?F ?LHS ?RHS" unfolding bij_betw_def inj_on_def
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
    67
  proof safe
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
    68
    fix f g assume "f \<in> Func A B" "g \<in> Func A C"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
    69
    thus "(f, g) \<in> ?F ` Func A (B \<times> C)"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
    70
      by (intro image_eqI[of _ _ "?G (f, g)"]) (auto simp: Func_def)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
    71
  qed (auto simp: Func_def fun_eq_iff, metis pair_collapse)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
    72
  thus ?thesis using card_of_ordIso by blast
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
    73
qed
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
    74
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
    75
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
    76
subsection {* Zero *}
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
    77
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
    78
definition czero where
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
    79
  "czero = card_of {}"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
    80
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
    81
lemma czero_ordIso:
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
    82
  "czero =o czero"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
    83
using card_of_empty_ordIso by (simp add: czero_def)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
    84
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
    85
lemma card_of_ordIso_czero_iff_empty:
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
    86
  "|A| =o (czero :: 'b rel) \<longleftrightarrow> A = ({} :: 'a set)"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
    87
unfolding czero_def by (rule iffI[OF card_of_empty2]) (auto simp: card_of_refl card_of_empty_ordIso)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
    88
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
    89
(* A "not czero" Cardinal predicate *)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
    90
abbreviation Cnotzero where
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
    91
  "Cnotzero (r :: 'a rel) \<equiv> \<not>(r =o (czero :: 'a rel)) \<and> Card_order r"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
    92
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
    93
(*helper*)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
    94
lemma Cnotzero_imp_not_empty: "Cnotzero r \<Longrightarrow> Field r \<noteq> {}"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
    95
by (metis Card_order_iff_ordIso_card_of czero_def)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
    96
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
    97
lemma czeroI:
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
    98
  "\<lbrakk>Card_order r; Field r = {}\<rbrakk> \<Longrightarrow> r =o czero"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
    99
using Cnotzero_imp_not_empty ordIso_transitive[OF _ czero_ordIso] by blast
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   100
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   101
lemma czeroE:
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   102
  "r =o czero \<Longrightarrow> Field r = {}"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   103
unfolding czero_def
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   104
by (drule card_of_cong) (simp only: Field_card_of card_of_empty2)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   105
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   106
lemma Cnotzero_mono:
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   107
  "\<lbrakk>Cnotzero r; Card_order q; r \<le>o q\<rbrakk> \<Longrightarrow> Cnotzero q"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   108
apply (rule ccontr)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   109
apply auto
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   110
apply (drule czeroE)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   111
apply (erule notE)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   112
apply (erule czeroI)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   113
apply (drule card_of_mono2)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   114
apply (simp only: card_of_empty3)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   115
done
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   116
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   117
subsection {* (In)finite cardinals *}
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   118
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   119
definition cinfinite where
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   120
  "cinfinite r = infinite (Field r)"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   121
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   122
abbreviation Cinfinite where
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   123
  "Cinfinite r \<equiv> cinfinite r \<and> Card_order r"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   124
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   125
definition cfinite where
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   126
  "cfinite r = finite (Field r)"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   127
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   128
abbreviation Cfinite where
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   129
  "Cfinite r \<equiv> cfinite r \<and> Card_order r"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   130
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   131
lemma Cfinite_ordLess_Cinfinite: "\<lbrakk>Cfinite r; Cinfinite s\<rbrakk> \<Longrightarrow> r <o s"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   132
  unfolding cfinite_def cinfinite_def
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   133
  by (metis card_order_on_well_order_on finite_ordLess_infinite)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   134
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   135
lemma natLeq_ordLeq_cinfinite:
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   136
  assumes inf: "Cinfinite r"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   137
  shows "natLeq \<le>o r"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   138
proof -
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   139
  from inf have "natLeq \<le>o |Field r|" by (simp add: cinfinite_def infinite_iff_natLeq_ordLeq)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   140
  also from inf have "|Field r| =o r" by (simp add: card_of_unique ordIso_symmetric)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   141
  finally show ?thesis .
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   142
qed
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   143
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   144
lemma cinfinite_not_czero: "cinfinite r \<Longrightarrow> \<not> (r =o (czero :: 'a rel))"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   145
unfolding cinfinite_def by (metis czeroE finite.emptyI)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   146
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   147
lemma Cinfinite_Cnotzero: "Cinfinite r \<Longrightarrow> Cnotzero r"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   148
by (metis cinfinite_not_czero)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   149
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   150
lemma Cinfinite_cong: "\<lbrakk>r1 =o r2; Cinfinite r1\<rbrakk> \<Longrightarrow> Cinfinite r2"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   151
by (metis Card_order_ordIso2 card_of_mono2 card_of_ordLeq_infinite cinfinite_def ordIso_iff_ordLeq)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   152
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   153
lemma cinfinite_mono: "\<lbrakk>r1 \<le>o r2; cinfinite r1\<rbrakk> \<Longrightarrow> cinfinite r2"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   154
by (metis card_of_mono2 card_of_ordLeq_infinite cinfinite_def)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   155
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   156
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   157
subsection {* Binary sum *}
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   158
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   159
definition csum (infixr "+c" 65) where
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   160
  "r1 +c r2 \<equiv> |Field r1 <+> Field r2|"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   161
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   162
lemma Field_csum: "Field (r +c s) = Inl ` Field r \<union> Inr ` Field s"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   163
  unfolding csum_def Field_card_of by auto
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   164
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   165
lemma Card_order_csum:
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   166
  "Card_order (r1 +c r2)"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   167
unfolding csum_def by (simp add: card_of_Card_order)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   168
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   169
lemma csum_Cnotzero1:
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   170
  "Cnotzero r1 \<Longrightarrow> Cnotzero (r1 +c r2)"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   171
unfolding csum_def
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   172
by (metis Cnotzero_imp_not_empty Field_card_of Plus_eq_empty_conv card_of_card_order_on czeroE)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   173
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   174
lemma card_order_csum:
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   175
  assumes "card_order r1" "card_order r2"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   176
  shows "card_order (r1 +c r2)"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   177
proof -
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   178
  have "Field r1 = UNIV" "Field r2 = UNIV" using assms card_order_on_Card_order by auto
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   179
  thus ?thesis unfolding csum_def by (auto simp: card_of_card_order_on)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   180
qed
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   181
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   182
lemma cinfinite_csum:
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   183
  "cinfinite r1 \<or> cinfinite r2 \<Longrightarrow> cinfinite (r1 +c r2)"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   184
unfolding cinfinite_def csum_def by (auto simp: Field_card_of)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   185
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   186
lemma Cinfinite_csum1:
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   187
  "Cinfinite r1 \<Longrightarrow> Cinfinite (r1 +c r2)"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   188
unfolding cinfinite_def csum_def by (metis Field_card_of card_of_Card_order finite_Plus_iff)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   189
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   190
lemma csum_cong: "\<lbrakk>p1 =o r1; p2 =o r2\<rbrakk> \<Longrightarrow> p1 +c p2 =o r1 +c r2"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   191
by (simp only: csum_def ordIso_Plus_cong)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   192
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   193
lemma csum_cong1: "p1 =o r1 \<Longrightarrow> p1 +c q =o r1 +c q"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   194
by (simp only: csum_def ordIso_Plus_cong1)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   195
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   196
lemma csum_cong2: "p2 =o r2 \<Longrightarrow> q +c p2 =o q +c r2"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   197
by (simp only: csum_def ordIso_Plus_cong2)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   198
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   199
lemma csum_mono: "\<lbrakk>p1 \<le>o r1; p2 \<le>o r2\<rbrakk> \<Longrightarrow> p1 +c p2 \<le>o r1 +c r2"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   200
by (simp only: csum_def ordLeq_Plus_mono)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   201
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   202
lemma csum_mono1: "p1 \<le>o r1 \<Longrightarrow> p1 +c q \<le>o r1 +c q"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   203
by (simp only: csum_def ordLeq_Plus_mono1)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   204
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   205
lemma csum_mono2: "p2 \<le>o r2 \<Longrightarrow> q +c p2 \<le>o q +c r2"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   206
by (simp only: csum_def ordLeq_Plus_mono2)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   207
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   208
lemma ordLeq_csum1: "Card_order p1 \<Longrightarrow> p1 \<le>o p1 +c p2"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   209
by (simp only: csum_def Card_order_Plus1)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   210
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   211
lemma ordLeq_csum2: "Card_order p2 \<Longrightarrow> p2 \<le>o p1 +c p2"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   212
by (simp only: csum_def Card_order_Plus2)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   213
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   214
lemma csum_com: "p1 +c p2 =o p2 +c p1"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   215
by (simp only: csum_def card_of_Plus_commute)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   216
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   217
lemma csum_assoc: "(p1 +c p2) +c p3 =o p1 +c p2 +c p3"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   218
by (simp only: csum_def Field_card_of card_of_Plus_assoc)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   219
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   220
lemma Cfinite_csum: "\<lbrakk>Cfinite r; Cfinite s\<rbrakk> \<Longrightarrow> Cfinite (r +c s)"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   221
  unfolding cfinite_def csum_def Field_card_of using card_of_card_order_on by simp
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   222
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   223
lemma csum_csum: "(r1 +c r2) +c (r3 +c r4) =o (r1 +c r3) +c (r2 +c r4)"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   224
proof -
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   225
  have "(r1 +c r2) +c (r3 +c r4) =o r1 +c r2 +c (r3 +c r4)"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   226
    by (metis csum_assoc)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   227
  also have "r1 +c r2 +c (r3 +c r4) =o r1 +c (r2 +c r3) +c r4"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   228
    by (metis csum_assoc csum_cong2 ordIso_symmetric)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   229
  also have "r1 +c (r2 +c r3) +c r4 =o r1 +c (r3 +c r2) +c r4"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   230
    by (metis csum_com csum_cong1 csum_cong2)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   231
  also have "r1 +c (r3 +c r2) +c r4 =o r1 +c r3 +c r2 +c r4"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   232
    by (metis csum_assoc csum_cong2 ordIso_symmetric)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   233
  also have "r1 +c r3 +c r2 +c r4 =o (r1 +c r3) +c (r2 +c r4)"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   234
    by (metis csum_assoc ordIso_symmetric)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   235
  finally show ?thesis .
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   236
qed
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   237
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   238
lemma Plus_csum: "|A <+> B| =o |A| +c |B|"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   239
by (simp only: csum_def Field_card_of card_of_refl)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   240
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   241
lemma Un_csum: "|A \<union> B| \<le>o |A| +c |B|"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   242
using ordLeq_ordIso_trans[OF card_of_Un_Plus_ordLeq Plus_csum] by blast
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   243
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   244
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   245
subsection {* One *}
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   246
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   247
definition cone where
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   248
  "cone = card_of {()}"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   249
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   250
lemma Card_order_cone: "Card_order cone"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   251
unfolding cone_def by (rule card_of_Card_order)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   252
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   253
lemma Cfinite_cone: "Cfinite cone"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   254
  unfolding cfinite_def by (simp add: Card_order_cone)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   255
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   256
lemma cone_not_czero: "\<not> (cone =o czero)"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   257
unfolding czero_def cone_def by (metis empty_not_insert card_of_empty3[of "{()}"] ordIso_iff_ordLeq)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   258
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   259
lemma cone_ordLeq_Cnotzero: "Cnotzero r \<Longrightarrow> cone \<le>o r"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   260
unfolding cone_def by (metis Card_order_singl_ordLeq czeroI)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   261
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   262
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   263
subsection{* Two *}
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   264
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   265
definition ctwo where
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   266
  "ctwo = |UNIV :: bool set|"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   267
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   268
lemma Card_order_ctwo: "Card_order ctwo"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   269
unfolding ctwo_def by (rule card_of_Card_order)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   270
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   271
lemma ctwo_not_czero: "\<not> (ctwo =o czero)"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   272
using card_of_empty3[of "UNIV :: bool set"] ordIso_iff_ordLeq
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   273
unfolding czero_def ctwo_def by (metis UNIV_not_empty)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   274
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   275
lemma ctwo_Cnotzero: "Cnotzero ctwo"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   276
by (simp add: ctwo_not_czero Card_order_ctwo)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   277
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   278
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   279
subsection {* Family sum *}
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   280
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   281
definition Csum where
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   282
  "Csum r rs \<equiv> |SIGMA i : Field r. Field (rs i)|"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   283
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   284
(* Similar setup to the one for SIGMA from theory Big_Operators: *)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   285
syntax "_Csum" ::
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   286
  "pttrn => ('a * 'a) set => 'b * 'b set => (('a * 'b) * ('a * 'b)) set"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   287
  ("(3CSUM _:_. _)" [0, 51, 10] 10)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   288
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   289
translations
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   290
  "CSUM i:r. rs" == "CONST Csum r (%i. rs)"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   291
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   292
lemma SIGMA_CSUM: "|SIGMA i : I. As i| = (CSUM i : |I|. |As i| )"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   293
by (auto simp: Csum_def Field_card_of)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   294
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   295
(* NB: Always, under the cardinal operator,
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   296
operations on sets are reduced automatically to operations on cardinals.
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   297
This should make cardinal reasoning more direct and natural.  *)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   298
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   299
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   300
subsection {* Product *}
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   301
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   302
definition cprod (infixr "*c" 80) where
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   303
  "r1 *c r2 = |Field r1 <*> Field r2|"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   304
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   305
lemma card_order_cprod:
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   306
  assumes "card_order r1" "card_order r2"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   307
  shows "card_order (r1 *c r2)"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   308
proof -
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   309
  have "Field r1 = UNIV" "Field r2 = UNIV" using assms card_order_on_Card_order by auto
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   310
  thus ?thesis by (auto simp: cprod_def card_of_card_order_on)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   311
qed
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   312
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   313
lemma Card_order_cprod: "Card_order (r1 *c r2)"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   314
by (simp only: cprod_def Field_card_of card_of_card_order_on)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   315
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   316
lemma cprod_mono1: "p1 \<le>o r1 \<Longrightarrow> p1 *c q \<le>o r1 *c q"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   317
by (simp only: cprod_def ordLeq_Times_mono1)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   318
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   319
lemma cprod_mono2: "p2 \<le>o r2 \<Longrightarrow> q *c p2 \<le>o q *c r2"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   320
by (simp only: cprod_def ordLeq_Times_mono2)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   321
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   322
lemma ordLeq_cprod2: "\<lbrakk>Cnotzero p1; Card_order p2\<rbrakk> \<Longrightarrow> p2 \<le>o p1 *c p2"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   323
unfolding cprod_def by (metis Card_order_Times2 czeroI)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   324
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   325
lemma cinfinite_cprod: "\<lbrakk>cinfinite r1; cinfinite r2\<rbrakk> \<Longrightarrow> cinfinite (r1 *c r2)"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   326
by (simp add: cinfinite_def cprod_def Field_card_of infinite_cartesian_product)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   327
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   328
lemma cinfinite_cprod2: "\<lbrakk>Cnotzero r1; Cinfinite r2\<rbrakk> \<Longrightarrow> cinfinite (r1 *c r2)"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   329
by (metis cinfinite_mono ordLeq_cprod2)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   330
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   331
lemma Cinfinite_cprod2: "\<lbrakk>Cnotzero r1; Cinfinite r2\<rbrakk> \<Longrightarrow> Cinfinite (r1 *c r2)"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   332
by (blast intro: cinfinite_cprod2 Card_order_cprod)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   333
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   334
lemma cprod_com: "p1 *c p2 =o p2 *c p1"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   335
by (simp only: cprod_def card_of_Times_commute)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   336
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   337
lemma card_of_Csum_Times:
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   338
  "\<forall>i \<in> I. |A i| \<le>o |B| \<Longrightarrow> (CSUM i : |I|. |A i| ) \<le>o |I| *c |B|"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   339
by (simp only: Csum_def cprod_def Field_card_of card_of_Sigma_Times)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   340
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   341
lemma card_of_Csum_Times':
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   342
  assumes "Card_order r" "\<forall>i \<in> I. |A i| \<le>o r"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   343
  shows "(CSUM i : |I|. |A i| ) \<le>o |I| *c r"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   344
proof -
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   345
  from assms(1) have *: "r =o |Field r|" by (simp add: card_of_unique)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   346
  with assms(2) have "\<forall>i \<in> I. |A i| \<le>o |Field r|" by (blast intro: ordLeq_ordIso_trans)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   347
  hence "(CSUM i : |I|. |A i| ) \<le>o |I| *c |Field r|" by (simp only: card_of_Csum_Times)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   348
  also from * have "|I| *c |Field r| \<le>o |I| *c r"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   349
    by (simp only: Field_card_of card_of_refl cprod_def ordIso_imp_ordLeq)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   350
  finally show ?thesis .
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   351
qed
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   352
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   353
lemma cprod_csum_distrib1: "r1 *c r2 +c r1 *c r3 =o r1 *c (r2 +c r3)"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   354
unfolding csum_def cprod_def by (simp add: Field_card_of card_of_Times_Plus_distrib ordIso_symmetric)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   355
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   356
lemma csum_absorb2': "\<lbrakk>Card_order r2; r1 \<le>o r2; cinfinite r1 \<or> cinfinite r2\<rbrakk> \<Longrightarrow> r1 +c r2 =o r2"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   357
unfolding csum_def by (metis Card_order_Plus_infinite cinfinite_def cinfinite_mono)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   358
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   359
lemma csum_absorb1':
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   360
  assumes card: "Card_order r2"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   361
  and r12: "r1 \<le>o r2" and cr12: "cinfinite r1 \<or> cinfinite r2"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   362
  shows "r2 +c r1 =o r2"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   363
by (rule ordIso_transitive, rule csum_com, rule csum_absorb2', (simp only: assms)+)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   364
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   365
lemma csum_absorb1: "\<lbrakk>Cinfinite r2; r1 \<le>o r2\<rbrakk> \<Longrightarrow> r2 +c r1 =o r2"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   366
by (rule csum_absorb1') auto
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   367
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   368
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   369
subsection {* Exponentiation *}
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   370
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   371
definition cexp (infixr "^c" 90) where
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   372
  "r1 ^c r2 \<equiv> |Func (Field r2) (Field r1)|"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   373
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   374
lemma Card_order_cexp: "Card_order (r1 ^c r2)"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   375
unfolding cexp_def by (rule card_of_Card_order)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   376
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   377
lemma cexp_mono':
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   378
  assumes 1: "p1 \<le>o r1" and 2: "p2 \<le>o r2"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   379
  and n: "Field p2 = {} \<Longrightarrow> Field r2 = {}"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   380
  shows "p1 ^c p2 \<le>o r1 ^c r2"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   381
proof(cases "Field p1 = {}")
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   382
  case True
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   383
  hence "|Field |Func (Field p2) (Field p1)|| \<le>o cone"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   384
    unfolding cone_def Field_card_of
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   385
    by (cases "Field p2 = {}", auto intro: card_of_ordLeqI2 simp: Func_empty)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   386
       (metis Func_is_emp card_of_empty ex_in_conv)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   387
  hence "|Func (Field p2) (Field p1)| \<le>o cone" by (simp add: Field_card_of cexp_def)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   388
  hence "p1 ^c p2 \<le>o cone" unfolding cexp_def .
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   389
  thus ?thesis
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   390
  proof (cases "Field p2 = {}")
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   391
    case True
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   392
    with n have "Field r2 = {}" .
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   393
    hence "cone \<le>o r1 ^c r2" unfolding cone_def cexp_def Func_def by (auto intro: card_of_ordLeqI)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   394
    thus ?thesis using `p1 ^c p2 \<le>o cone` ordLeq_transitive by auto
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   395
  next
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   396
    case False with True have "|Field (p1 ^c p2)| =o czero"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   397
      unfolding card_of_ordIso_czero_iff_empty cexp_def Field_card_of Func_def by auto
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   398
    thus ?thesis unfolding cexp_def card_of_ordIso_czero_iff_empty Field_card_of
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   399
      by (simp add: card_of_empty)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   400
  qed
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   401
next
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   402
  case False
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   403
  have 1: "|Field p1| \<le>o |Field r1|" and 2: "|Field p2| \<le>o |Field r2|"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   404
    using 1 2 by (auto simp: card_of_mono2)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   405
  obtain f1 where f1: "f1 ` Field r1 = Field p1"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   406
    using 1 unfolding card_of_ordLeq2[OF False, symmetric] by auto
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   407
  obtain f2 where f2: "inj_on f2 (Field p2)" "f2 ` Field p2 \<subseteq> Field r2"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   408
    using 2 unfolding card_of_ordLeq[symmetric] by blast
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   409
  have 0: "Func_map (Field p2) f1 f2 ` (Field (r1 ^c r2)) = Field (p1 ^c p2)"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   410
    unfolding cexp_def Field_card_of using Func_map_surj[OF f1 f2 n, symmetric] .
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   411
  have 00: "Field (p1 ^c p2) \<noteq> {}" unfolding cexp_def Field_card_of Func_is_emp
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   412
    using False by simp
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   413
  show ?thesis
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   414
    using 0 card_of_ordLeq2[OF 00] unfolding cexp_def Field_card_of by blast
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   415
qed
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   416
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   417
lemma cexp_mono:
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   418
  assumes 1: "p1 \<le>o r1" and 2: "p2 \<le>o r2"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   419
  and n: "p2 =o czero \<Longrightarrow> r2 =o czero" and card: "Card_order p2"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   420
  shows "p1 ^c p2 \<le>o r1 ^c r2"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   421
  by (metis (full_types) "1" "2" card cexp_mono' czeroE czeroI n)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   422
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   423
lemma cexp_mono1:
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   424
  assumes 1: "p1 \<le>o r1" and q: "Card_order q"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   425
  shows "p1 ^c q \<le>o r1 ^c q"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   426
using ordLeq_refl[OF q] by (rule cexp_mono[OF 1]) (auto simp: q)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   427
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   428
lemma cexp_mono2':
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   429
  assumes 2: "p2 \<le>o r2" and q: "Card_order q"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   430
  and n: "Field p2 = {} \<Longrightarrow> Field r2 = {}"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   431
  shows "q ^c p2 \<le>o q ^c r2"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   432
using ordLeq_refl[OF q] by (rule cexp_mono'[OF _ 2 n]) auto
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   433
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   434
lemma cexp_mono2:
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   435
  assumes 2: "p2 \<le>o r2" and q: "Card_order q"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   436
  and n: "p2 =o czero \<Longrightarrow> r2 =o czero" and card: "Card_order p2"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   437
  shows "q ^c p2 \<le>o q ^c r2"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   438
using ordLeq_refl[OF q] by (rule cexp_mono[OF _ 2 n card]) auto
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   439
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   440
lemma cexp_mono2_Cnotzero:
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   441
  assumes "p2 \<le>o r2" "Card_order q" "Cnotzero p2"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   442
  shows "q ^c p2 \<le>o q ^c r2"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   443
by (metis assms cexp_mono2' czeroI)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   444
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   445
lemma cexp_cong:
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   446
  assumes 1: "p1 =o r1" and 2: "p2 =o r2"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   447
  and Cr: "Card_order r2"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   448
  and Cp: "Card_order p2"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   449
  shows "p1 ^c p2 =o r1 ^c r2"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   450
proof -
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   451
  obtain f where "bij_betw f (Field p2) (Field r2)"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   452
    using 2 card_of_ordIso[of "Field p2" "Field r2"] card_of_cong by auto
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   453
  hence 0: "Field p2 = {} \<longleftrightarrow> Field r2 = {}" unfolding bij_betw_def by auto
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   454
  have r: "p2 =o czero \<Longrightarrow> r2 =o czero"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   455
    and p: "r2 =o czero \<Longrightarrow> p2 =o czero"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   456
     using 0 Cr Cp czeroE czeroI by auto
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   457
  show ?thesis using 0 1 2 unfolding ordIso_iff_ordLeq
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   458
    using r p cexp_mono[OF _ _ _ Cp] cexp_mono[OF _ _ _ Cr] by blast
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   459
qed
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   460
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   461
lemma cexp_cong1:
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   462
  assumes 1: "p1 =o r1" and q: "Card_order q"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   463
  shows "p1 ^c q =o r1 ^c q"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   464
by (rule cexp_cong[OF 1 _ q q]) (rule ordIso_refl[OF q])
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   465
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   466
lemma cexp_cong2:
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   467
  assumes 2: "p2 =o r2" and q: "Card_order q" and p: "Card_order p2"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   468
  shows "q ^c p2 =o q ^c r2"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   469
by (rule cexp_cong[OF _ 2]) (auto simp only: ordIso_refl Card_order_ordIso2[OF p 2] q p)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   470
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   471
lemma cexp_cone:
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   472
  assumes "Card_order r"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   473
  shows "r ^c cone =o r"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   474
proof -
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   475
  have "r ^c cone =o |Field r|"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   476
    unfolding cexp_def cone_def Field_card_of Func_empty
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   477
      card_of_ordIso[symmetric] bij_betw_def Func_def inj_on_def image_def
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   478
    by (rule exI[of _ "\<lambda>f. f ()"]) auto
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   479
  also have "|Field r| =o r" by (rule card_of_Field_ordIso[OF assms])
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   480
  finally show ?thesis .
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   481
qed
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   482
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   483
lemma cexp_cprod:
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   484
  assumes r1: "Card_order r1"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   485
  shows "(r1 ^c r2) ^c r3 =o r1 ^c (r2 *c r3)" (is "?L =o ?R")
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   486
proof -
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   487
  have "?L =o r1 ^c (r3 *c r2)"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   488
    unfolding cprod_def cexp_def Field_card_of
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   489
    using card_of_Func_Times by(rule ordIso_symmetric)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   490
  also have "r1 ^c (r3 *c r2) =o ?R"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   491
    apply(rule cexp_cong2) using cprod_com r1 by (auto simp: Card_order_cprod)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   492
  finally show ?thesis .
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   493
qed
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   494
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   495
lemma cprod_infinite1': "\<lbrakk>Cinfinite r; Cnotzero p; p \<le>o r\<rbrakk> \<Longrightarrow> r *c p =o r"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   496
unfolding cinfinite_def cprod_def
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   497
by (rule Card_order_Times_infinite[THEN conjunct1]) (blast intro: czeroI)+
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   498
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   499
lemma cexp_cprod_ordLeq:
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   500
  assumes r1: "Card_order r1" and r2: "Cinfinite r2"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   501
  and r3: "Cnotzero r3" "r3 \<le>o r2"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   502
  shows "(r1 ^c r2) ^c r3 =o r1 ^c r2" (is "?L =o ?R")
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   503
proof-
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   504
  have "?L =o r1 ^c (r2 *c r3)" using cexp_cprod[OF r1] .
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   505
  also have "r1 ^c (r2 *c r3) =o ?R"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   506
  apply(rule cexp_cong2)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   507
  apply(rule cprod_infinite1'[OF r2 r3]) using r1 r2 by (fastforce simp: Card_order_cprod)+
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   508
  finally show ?thesis .
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   509
qed
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   510
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   511
lemma Cnotzero_UNIV: "Cnotzero |UNIV|"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   512
by (auto simp: card_of_Card_order card_of_ordIso_czero_iff_empty)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   513
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   514
lemma ordLess_ctwo_cexp:
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   515
  assumes "Card_order r"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   516
  shows "r <o ctwo ^c r"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   517
proof -
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   518
  have "r <o |Pow (Field r)|" using assms by (rule Card_order_Pow)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   519
  also have "|Pow (Field r)| =o ctwo ^c r"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   520
    unfolding ctwo_def cexp_def Field_card_of by (rule card_of_Pow_Func)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   521
  finally show ?thesis .
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   522
qed
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   523
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   524
lemma ordLeq_cexp1:
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   525
  assumes "Cnotzero r" "Card_order q"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   526
  shows "q \<le>o q ^c r"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   527
proof (cases "q =o (czero :: 'a rel)")
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   528
  case True thus ?thesis by (simp only: card_of_empty cexp_def czero_def ordIso_ordLeq_trans)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   529
next
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   530
  case False
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   531
  thus ?thesis
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   532
    apply -
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   533
    apply (rule ordIso_ordLeq_trans)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   534
    apply (rule ordIso_symmetric)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   535
    apply (rule cexp_cone)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   536
    apply (rule assms(2))
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   537
    apply (rule cexp_mono2)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   538
    apply (rule cone_ordLeq_Cnotzero)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   539
    apply (rule assms(1))
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   540
    apply (rule assms(2))
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   541
    apply (rule notE)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   542
    apply (rule cone_not_czero)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   543
    apply assumption
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   544
    apply (rule Card_order_cone)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   545
  done
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   546
qed
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   547
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   548
lemma ordLeq_cexp2:
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   549
  assumes "ctwo \<le>o q" "Card_order r"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   550
  shows "r \<le>o q ^c r"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   551
proof (cases "r =o (czero :: 'a rel)")
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   552
  case True thus ?thesis by (simp only: card_of_empty cexp_def czero_def ordIso_ordLeq_trans)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   553
next
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   554
  case False thus ?thesis
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   555
    apply -
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   556
    apply (rule ordLess_imp_ordLeq)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   557
    apply (rule ordLess_ordLeq_trans)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   558
    apply (rule ordLess_ctwo_cexp)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   559
    apply (rule assms(2))
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   560
    apply (rule cexp_mono1)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   561
    apply (rule assms(1))
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   562
    apply (rule assms(2))
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   563
  done
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   564
qed
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   565
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   566
lemma cinfinite_cexp: "\<lbrakk>ctwo \<le>o q; Cinfinite r\<rbrakk> \<Longrightarrow> cinfinite (q ^c r)"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   567
by (metis assms cinfinite_mono ordLeq_cexp2)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   568
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   569
lemma Cinfinite_cexp:
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   570
  "\<lbrakk>ctwo \<le>o q; Cinfinite r\<rbrakk> \<Longrightarrow> Cinfinite (q ^c r)"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   571
by (simp add: cinfinite_cexp Card_order_cexp)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   572
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   573
lemma ctwo_ordLess_natLeq: "ctwo <o natLeq"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   574
unfolding ctwo_def using finite_iff_ordLess_natLeq finite_UNIV by fast
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   575
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   576
lemma ctwo_ordLess_Cinfinite: "Cinfinite r \<Longrightarrow> ctwo <o r"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   577
by (metis ctwo_ordLess_natLeq natLeq_ordLeq_cinfinite ordLess_ordLeq_trans)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   578
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   579
lemma ctwo_ordLeq_Cinfinite:
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   580
  assumes "Cinfinite r"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   581
  shows "ctwo \<le>o r"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   582
by (rule ordLess_imp_ordLeq[OF ctwo_ordLess_Cinfinite[OF assms]])
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   583
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   584
lemma Un_Cinfinite_bound: "\<lbrakk>|A| \<le>o r; |B| \<le>o r; Cinfinite r\<rbrakk> \<Longrightarrow> |A \<union> B| \<le>o r"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   585
by (auto simp add: cinfinite_def card_of_Un_ordLeq_infinite_Field)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   586
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   587
lemma UNION_Cinfinite_bound: "\<lbrakk>|I| \<le>o r; \<forall>i \<in> I. |A i| \<le>o r; Cinfinite r\<rbrakk> \<Longrightarrow> |\<Union>i \<in> I. A i| \<le>o r"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   588
by (auto simp add: card_of_UNION_ordLeq_infinite_Field cinfinite_def)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   589
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   590
lemma csum_cinfinite_bound:
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   591
  assumes "p \<le>o r" "q \<le>o r" "Card_order p" "Card_order q" "Cinfinite r"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   592
  shows "p +c q \<le>o r"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   593
proof -
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   594
  from assms(1-4) have "|Field p| \<le>o r" "|Field q| \<le>o r"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   595
    unfolding card_order_on_def using card_of_least ordLeq_transitive by blast+
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   596
  with assms show ?thesis unfolding cinfinite_def csum_def
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   597
    by (blast intro: card_of_Plus_ordLeq_infinite_Field)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   598
qed
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   599
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   600
lemma cprod_cinfinite_bound:
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   601
  assumes "p \<le>o r" "q \<le>o r" "Card_order p" "Card_order q" "Cinfinite r"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   602
  shows "p *c q \<le>o r"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   603
proof -
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   604
  from assms(1-4) have "|Field p| \<le>o r" "|Field q| \<le>o r"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   605
    unfolding card_order_on_def using card_of_least ordLeq_transitive by blast+
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   606
  with assms show ?thesis unfolding cinfinite_def cprod_def
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   607
    by (blast intro: card_of_Times_ordLeq_infinite_Field)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   608
qed
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   609
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   610
lemma cprod_csum_cexp:
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   611
  "r1 *c r2 \<le>o (r1 +c r2) ^c ctwo"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   612
unfolding cprod_def csum_def cexp_def ctwo_def Field_card_of
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   613
proof -
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   614
  let ?f = "\<lambda>(a, b). %x. if x then Inl a else Inr b"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   615
  have "inj_on ?f (Field r1 \<times> Field r2)" (is "inj_on _ ?LHS")
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   616
    by (auto simp: inj_on_def fun_eq_iff split: bool.split)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   617
  moreover
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   618
  have "?f ` ?LHS \<subseteq> Func (UNIV :: bool set) (Field r1 <+> Field r2)" (is "_ \<subseteq> ?RHS")
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   619
    by (auto simp: Func_def)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   620
  ultimately show "|?LHS| \<le>o |?RHS|" using card_of_ordLeq by blast
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   621
qed
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   622
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   623
lemma Cfinite_cprod_Cinfinite: "\<lbrakk>Cfinite r; Cinfinite s\<rbrakk> \<Longrightarrow> r *c s \<le>o s"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   624
by (intro cprod_cinfinite_bound)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   625
  (auto intro: ordLeq_refl ordLess_imp_ordLeq[OF Cfinite_ordLess_Cinfinite])
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   626
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   627
lemma cprod_cexp: "(r *c s) ^c t =o r ^c t *c s ^c t"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   628
  unfolding cprod_def cexp_def Field_card_of by (rule Func_Times_Range)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   629
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   630
lemma cprod_cexp_csum_cexp_Cinfinite:
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   631
  assumes t: "Cinfinite t"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   632
  shows "(r *c s) ^c t \<le>o (r +c s) ^c t"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   633
proof -
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   634
  have "(r *c s) ^c t \<le>o ((r +c s) ^c ctwo) ^c t"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   635
    by (rule cexp_mono1[OF cprod_csum_cexp conjunct2[OF t]])
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   636
  also have "((r +c s) ^c ctwo) ^c t =o (r +c s) ^c (ctwo *c t)"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   637
    by (rule cexp_cprod[OF Card_order_csum])
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   638
  also have "(r +c s) ^c (ctwo *c t) =o (r +c s) ^c (t *c ctwo)"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   639
    by (rule cexp_cong2[OF cprod_com Card_order_csum Card_order_cprod])
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   640
  also have "(r +c s) ^c (t *c ctwo) =o ((r +c s) ^c t) ^c ctwo"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   641
    by (rule ordIso_symmetric[OF cexp_cprod[OF Card_order_csum]])
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   642
  also have "((r +c s) ^c t) ^c ctwo =o (r +c s) ^c t"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   643
    by (rule cexp_cprod_ordLeq[OF Card_order_csum t ctwo_Cnotzero ctwo_ordLeq_Cinfinite[OF t]])
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   644
  finally show ?thesis .
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   645
qed
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   646
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   647
lemma Cfinite_cexp_Cinfinite:
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   648
  assumes s: "Cfinite s" and t: "Cinfinite t"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   649
  shows "s ^c t \<le>o ctwo ^c t"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   650
proof (cases "s \<le>o ctwo")
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   651
  case True thus ?thesis using t by (blast intro: cexp_mono1)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   652
next
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   653
  case False
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   654
  hence "ctwo \<le>o s" by (metis card_order_on_well_order_on ctwo_Cnotzero ordLeq_total s)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   655
  hence "Cnotzero s" by (metis Cnotzero_mono ctwo_Cnotzero s)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   656
  hence st: "Cnotzero (s *c t)" by (metis Cinfinite_cprod2 cinfinite_not_czero t)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   657
  have "s ^c t \<le>o (ctwo ^c s) ^c t"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   658
    using assms by (blast intro: cexp_mono1 ordLess_imp_ordLeq[OF ordLess_ctwo_cexp])
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   659
  also have "(ctwo ^c s) ^c t =o ctwo ^c (s *c t)"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   660
    by (blast intro: Card_order_ctwo cexp_cprod)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   661
  also have "ctwo ^c (s *c t) \<le>o ctwo ^c t"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   662
    using assms st by (intro cexp_mono2_Cnotzero Cfinite_cprod_Cinfinite Card_order_ctwo)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   663
  finally show ?thesis .
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   664
qed
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   665
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   666
lemma csum_Cfinite_cexp_Cinfinite:
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   667
  assumes r: "Card_order r" and s: "Cfinite s" and t: "Cinfinite t"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   668
  shows "(r +c s) ^c t \<le>o (r +c ctwo) ^c t"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   669
proof (cases "Cinfinite r")
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   670
  case True
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   671
  hence "r +c s =o r" by (intro csum_absorb1 ordLess_imp_ordLeq[OF Cfinite_ordLess_Cinfinite] s)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   672
  hence "(r +c s) ^c t =o r ^c t" using t by (blast intro: cexp_cong1)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   673
  also have "r ^c t \<le>o (r +c ctwo) ^c t" using t by (blast intro: cexp_mono1 ordLeq_csum1 r)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   674
  finally show ?thesis .
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   675
next
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   676
  case False
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   677
  with r have "Cfinite r" unfolding cinfinite_def cfinite_def by auto
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   678
  hence "Cfinite (r +c s)" by (intro Cfinite_csum s)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   679
  hence "(r +c s) ^c t \<le>o ctwo ^c t" by (intro Cfinite_cexp_Cinfinite t)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   680
  also have "ctwo ^c t \<le>o (r +c ctwo) ^c t" using t
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   681
    by (blast intro: cexp_mono1 ordLeq_csum2 Card_order_ctwo)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   682
  finally show ?thesis .
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   683
qed
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   684
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   685
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   686
(* cardSuc *)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   687
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   688
lemma Cinfinite_cardSuc: "Cinfinite r \<Longrightarrow> Cinfinite (cardSuc r)"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   689
by (simp add: cinfinite_def cardSuc_Card_order cardSuc_finite)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   690
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   691
lemma cardSuc_UNION_Cinfinite:
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   692
  assumes "Cinfinite r" "relChain (cardSuc r) As" "B \<le> (UN i : Field (cardSuc r). As i)" "|B| <=o r"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   693
  shows "EX i : Field (cardSuc r). B \<le> As i"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   694
using cardSuc_UNION assms unfolding cinfinite_def by blast
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   695
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   696
subsection {* Powerset *}
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   697
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   698
definition cpow where "cpow r = |Pow (Field r)|"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   699
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   700
lemma card_order_cpow: "card_order r \<Longrightarrow> card_order (cpow r)"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   701
by (simp only: cpow_def Field_card_order Pow_UNIV card_of_card_order_on)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   702
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   703
lemma cpow_greater_eq: "Card_order r \<Longrightarrow> r \<le>o cpow r"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   704
by (rule ordLess_imp_ordLeq) (simp only: cpow_def Card_order_Pow)
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   705
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   706
subsection {* Lists *}
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   707
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   708
definition clists where "clists r = |lists (Field r)|"
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   709
6d5941722fae split 'Cardinal_Arithmetic' 3-way
blanchet
parents:
diff changeset
   710
end