blanchet@50325
|
1 |
(* Title: HOL/Cardinals/Cardinal_Order_Relation.thy
|
blanchet@49990
|
2 |
Author: Andrei Popescu, TU Muenchen
|
blanchet@49990
|
3 |
Copyright 2012
|
blanchet@49990
|
4 |
|
blanchet@49990
|
5 |
Cardinal-order relations.
|
blanchet@49990
|
6 |
*)
|
blanchet@49990
|
7 |
|
blanchet@49990
|
8 |
header {* Cardinal-Order Relations *}
|
blanchet@49990
|
9 |
|
blanchet@49990
|
10 |
theory Cardinal_Order_Relation
|
blanchet@55854
|
11 |
imports Cardinal_Order_Relation_FP Constructions_on_Wellorders
|
blanchet@49990
|
12 |
begin
|
blanchet@49990
|
13 |
|
blanchet@49990
|
14 |
declare
|
blanchet@49990
|
15 |
card_order_on_well_order_on[simp]
|
blanchet@49990
|
16 |
card_of_card_order_on[simp]
|
blanchet@49990
|
17 |
card_of_well_order_on[simp]
|
blanchet@49990
|
18 |
Field_card_of[simp]
|
blanchet@49990
|
19 |
card_of_Card_order[simp]
|
blanchet@49990
|
20 |
card_of_Well_order[simp]
|
blanchet@49990
|
21 |
card_of_least[simp]
|
blanchet@49990
|
22 |
card_of_unique[simp]
|
blanchet@49990
|
23 |
card_of_mono1[simp]
|
blanchet@49990
|
24 |
card_of_mono2[simp]
|
blanchet@49990
|
25 |
card_of_cong[simp]
|
blanchet@49990
|
26 |
card_of_Field_ordLess[simp]
|
blanchet@49990
|
27 |
card_of_Field_ordIso[simp]
|
blanchet@49990
|
28 |
card_of_underS[simp]
|
blanchet@49990
|
29 |
ordLess_Field[simp]
|
blanchet@49990
|
30 |
card_of_empty[simp]
|
blanchet@49990
|
31 |
card_of_empty1[simp]
|
blanchet@49990
|
32 |
card_of_image[simp]
|
blanchet@49990
|
33 |
card_of_singl_ordLeq[simp]
|
blanchet@49990
|
34 |
Card_order_singl_ordLeq[simp]
|
blanchet@49990
|
35 |
card_of_Pow[simp]
|
blanchet@49990
|
36 |
Card_order_Pow[simp]
|
blanchet@49990
|
37 |
card_of_Plus1[simp]
|
blanchet@49990
|
38 |
Card_order_Plus1[simp]
|
blanchet@49990
|
39 |
card_of_Plus2[simp]
|
blanchet@49990
|
40 |
Card_order_Plus2[simp]
|
blanchet@49990
|
41 |
card_of_Plus_mono1[simp]
|
blanchet@49990
|
42 |
card_of_Plus_mono2[simp]
|
blanchet@49990
|
43 |
card_of_Plus_mono[simp]
|
blanchet@49990
|
44 |
card_of_Plus_cong2[simp]
|
blanchet@49990
|
45 |
card_of_Plus_cong[simp]
|
blanchet@49990
|
46 |
card_of_Un_Plus_ordLeq[simp]
|
blanchet@49990
|
47 |
card_of_Times1[simp]
|
blanchet@49990
|
48 |
card_of_Times2[simp]
|
blanchet@49990
|
49 |
card_of_Times3[simp]
|
blanchet@49990
|
50 |
card_of_Times_mono1[simp]
|
blanchet@49990
|
51 |
card_of_Times_mono2[simp]
|
blanchet@49990
|
52 |
card_of_ordIso_finite[simp]
|
blanchet@49990
|
53 |
card_of_Times_same_infinite[simp]
|
blanchet@49990
|
54 |
card_of_Times_infinite_simps[simp]
|
blanchet@49990
|
55 |
card_of_Plus_infinite1[simp]
|
blanchet@49990
|
56 |
card_of_Plus_infinite2[simp]
|
blanchet@49990
|
57 |
card_of_Plus_ordLess_infinite[simp]
|
blanchet@49990
|
58 |
card_of_Plus_ordLess_infinite_Field[simp]
|
blanchet@49990
|
59 |
infinite_cartesian_product[simp]
|
blanchet@49990
|
60 |
cardSuc_Card_order[simp]
|
blanchet@49990
|
61 |
cardSuc_greater[simp]
|
blanchet@49990
|
62 |
cardSuc_ordLeq[simp]
|
blanchet@49990
|
63 |
cardSuc_ordLeq_ordLess[simp]
|
blanchet@49990
|
64 |
cardSuc_mono_ordLeq[simp]
|
blanchet@49990
|
65 |
cardSuc_invar_ordIso[simp]
|
blanchet@49990
|
66 |
card_of_cardSuc_finite[simp]
|
blanchet@49990
|
67 |
cardSuc_finite[simp]
|
blanchet@49990
|
68 |
card_of_Plus_ordLeq_infinite_Field[simp]
|
blanchet@49990
|
69 |
curr_in[intro, simp]
|
blanchet@49990
|
70 |
Func_empty[simp]
|
blanchet@49990
|
71 |
Func_is_emp[simp]
|
blanchet@49990
|
72 |
|
blanchet@49990
|
73 |
|
blanchet@49990
|
74 |
subsection {* Cardinal of a set *}
|
blanchet@49990
|
75 |
|
blanchet@49990
|
76 |
lemma card_of_inj_rel: assumes INJ: "!! x y y'. \<lbrakk>(x,y) : R; (x,y') : R\<rbrakk> \<Longrightarrow> y = y'"
|
blanchet@49990
|
77 |
shows "|{y. EX x. (x,y) : R}| <=o |{x. EX y. (x,y) : R}|"
|
blanchet@49990
|
78 |
proof-
|
blanchet@49990
|
79 |
let ?Y = "{y. EX x. (x,y) : R}" let ?X = "{x. EX y. (x,y) : R}"
|
blanchet@49990
|
80 |
let ?f = "% y. SOME x. (x,y) : R"
|
traytel@52901
|
81 |
have "?f ` ?Y <= ?X" by (auto dest: someI)
|
blanchet@49990
|
82 |
moreover have "inj_on ?f ?Y"
|
blanchet@49990
|
83 |
unfolding inj_on_def proof(auto)
|
blanchet@49990
|
84 |
fix y1 x1 y2 x2
|
blanchet@49990
|
85 |
assume *: "(x1, y1) \<in> R" "(x2, y2) \<in> R" and **: "?f y1 = ?f y2"
|
blanchet@49990
|
86 |
hence "(?f y1,y1) : R" using someI[of "% x. (x,y1) : R"] by auto
|
blanchet@49990
|
87 |
moreover have "(?f y2,y2) : R" using * someI[of "% x. (x,y2) : R"] by auto
|
blanchet@49990
|
88 |
ultimately show "y1 = y2" using ** INJ by auto
|
blanchet@49990
|
89 |
qed
|
blanchet@49990
|
90 |
ultimately show "|?Y| <=o |?X|" using card_of_ordLeq by blast
|
blanchet@49990
|
91 |
qed
|
blanchet@49990
|
92 |
|
blanchet@49990
|
93 |
lemma card_of_unique2: "\<lbrakk>card_order_on B r; bij_betw f A B\<rbrakk> \<Longrightarrow> r =o |A|"
|
blanchet@49990
|
94 |
using card_of_ordIso card_of_unique ordIso_equivalence by blast
|
blanchet@49990
|
95 |
|
blanchet@49990
|
96 |
lemma internalize_card_of_ordLess:
|
blanchet@49990
|
97 |
"( |A| <o r) = (\<exists>B < Field r. |A| =o |B| \<and> |B| <o r)"
|
blanchet@49990
|
98 |
proof
|
blanchet@49990
|
99 |
assume "|A| <o r"
|
blanchet@49990
|
100 |
then obtain p where 1: "Field p < Field r \<and> |A| =o p \<and> p <o r"
|
blanchet@49990
|
101 |
using internalize_ordLess[of "|A|" r] by blast
|
blanchet@49990
|
102 |
hence "Card_order p" using card_of_Card_order Card_order_ordIso2 by blast
|
blanchet@49990
|
103 |
hence "|Field p| =o p" using card_of_Field_ordIso by blast
|
blanchet@49990
|
104 |
hence "|A| =o |Field p| \<and> |Field p| <o r"
|
blanchet@49990
|
105 |
using 1 ordIso_equivalence ordIso_ordLess_trans by blast
|
blanchet@49990
|
106 |
thus "\<exists>B < Field r. |A| =o |B| \<and> |B| <o r" using 1 by blast
|
blanchet@49990
|
107 |
next
|
blanchet@49990
|
108 |
assume "\<exists>B < Field r. |A| =o |B| \<and> |B| <o r"
|
blanchet@49990
|
109 |
thus "|A| <o r" using ordIso_ordLess_trans by blast
|
blanchet@49990
|
110 |
qed
|
blanchet@49990
|
111 |
|
blanchet@49990
|
112 |
lemma internalize_card_of_ordLess2:
|
blanchet@49990
|
113 |
"( |A| <o |C| ) = (\<exists>B < C. |A| =o |B| \<and> |B| <o |C| )"
|
blanchet@49990
|
114 |
using internalize_card_of_ordLess[of "A" "|C|"] Field_card_of[of C] by auto
|
blanchet@49990
|
115 |
|
blanchet@49990
|
116 |
lemma Card_order_omax:
|
blanchet@49990
|
117 |
assumes "finite R" and "R \<noteq> {}" and "\<forall>r\<in>R. Card_order r"
|
blanchet@49990
|
118 |
shows "Card_order (omax R)"
|
blanchet@49990
|
119 |
proof-
|
blanchet@49990
|
120 |
have "\<forall>r\<in>R. Well_order r"
|
blanchet@49990
|
121 |
using assms unfolding card_order_on_def by simp
|
blanchet@49990
|
122 |
thus ?thesis using assms apply - apply(drule omax_in) by auto
|
blanchet@49990
|
123 |
qed
|
blanchet@49990
|
124 |
|
blanchet@49990
|
125 |
lemma Card_order_omax2:
|
blanchet@49990
|
126 |
assumes "finite I" and "I \<noteq> {}"
|
blanchet@49990
|
127 |
shows "Card_order (omax {|A i| | i. i \<in> I})"
|
blanchet@49990
|
128 |
proof-
|
blanchet@49990
|
129 |
let ?R = "{|A i| | i. i \<in> I}"
|
blanchet@49990
|
130 |
have "finite ?R" and "?R \<noteq> {}" using assms by auto
|
blanchet@49990
|
131 |
moreover have "\<forall>r\<in>?R. Card_order r"
|
blanchet@49990
|
132 |
using card_of_Card_order by auto
|
blanchet@49990
|
133 |
ultimately show ?thesis by(rule Card_order_omax)
|
blanchet@49990
|
134 |
qed
|
blanchet@49990
|
135 |
|
blanchet@49990
|
136 |
|
blanchet@49990
|
137 |
subsection {* Cardinals versus set operations on arbitrary sets *}
|
blanchet@49990
|
138 |
|
blanchet@55854
|
139 |
lemma card_of_set_type[simp]: "|UNIV::'a set| <o |UNIV::'a set set|"
|
blanchet@55848
|
140 |
using card_of_Pow[of "UNIV::'a set"] by simp
|
blanchet@55848
|
141 |
|
blanchet@55848
|
142 |
lemma card_of_Un1[simp]:
|
blanchet@55848
|
143 |
shows "|A| \<le>o |A \<union> B| "
|
blanchet@55848
|
144 |
using inj_on_id[of A] card_of_ordLeq[of A _] by fastforce
|
blanchet@55848
|
145 |
|
blanchet@55848
|
146 |
lemma card_of_diff[simp]:
|
blanchet@55848
|
147 |
shows "|A - B| \<le>o |A|"
|
blanchet@55848
|
148 |
using inj_on_id[of "A - B"] card_of_ordLeq[of "A - B" _] by fastforce
|
blanchet@55848
|
149 |
|
blanchet@49990
|
150 |
lemma subset_ordLeq_strict:
|
blanchet@49990
|
151 |
assumes "A \<le> B" and "|A| <o |B|"
|
blanchet@49990
|
152 |
shows "A < B"
|
blanchet@49990
|
153 |
proof-
|
blanchet@49990
|
154 |
{assume "\<not>(A < B)"
|
blanchet@49990
|
155 |
hence "A = B" using assms(1) by blast
|
blanchet@49990
|
156 |
hence False using assms(2) not_ordLess_ordIso card_of_refl by blast
|
blanchet@49990
|
157 |
}
|
blanchet@49990
|
158 |
thus ?thesis by blast
|
blanchet@49990
|
159 |
qed
|
blanchet@49990
|
160 |
|
blanchet@49990
|
161 |
corollary subset_ordLeq_diff:
|
blanchet@49990
|
162 |
assumes "A \<le> B" and "|A| <o |B|"
|
blanchet@49990
|
163 |
shows "B - A \<noteq> {}"
|
blanchet@49990
|
164 |
using assms subset_ordLeq_strict by blast
|
blanchet@49990
|
165 |
|
blanchet@49990
|
166 |
lemma card_of_empty4:
|
blanchet@49990
|
167 |
"|{}::'b set| <o |A::'a set| = (A \<noteq> {})"
|
blanchet@49990
|
168 |
proof(intro iffI notI)
|
blanchet@49990
|
169 |
assume *: "|{}::'b set| <o |A|" and "A = {}"
|
blanchet@49990
|
170 |
hence "|A| =o |{}::'b set|"
|
blanchet@49990
|
171 |
using card_of_ordIso unfolding bij_betw_def inj_on_def by blast
|
blanchet@49990
|
172 |
hence "|{}::'b set| =o |A|" using ordIso_symmetric by blast
|
blanchet@49990
|
173 |
with * show False using not_ordLess_ordIso[of "|{}::'b set|" "|A|"] by blast
|
blanchet@49990
|
174 |
next
|
blanchet@49990
|
175 |
assume "A \<noteq> {}"
|
blanchet@49990
|
176 |
hence "(\<not> (\<exists>f. inj_on f A \<and> f ` A \<subseteq> {}))"
|
blanchet@49990
|
177 |
unfolding inj_on_def by blast
|
blanchet@49990
|
178 |
thus "| {} | <o | A |"
|
blanchet@49990
|
179 |
using card_of_ordLess by blast
|
blanchet@49990
|
180 |
qed
|
blanchet@49990
|
181 |
|
blanchet@49990
|
182 |
lemma card_of_empty5:
|
blanchet@49990
|
183 |
"|A| <o |B| \<Longrightarrow> B \<noteq> {}"
|
blanchet@49990
|
184 |
using card_of_empty not_ordLess_ordLeq by blast
|
blanchet@49990
|
185 |
|
blanchet@49990
|
186 |
lemma Well_order_card_of_empty:
|
blanchet@49990
|
187 |
"Well_order r \<Longrightarrow> |{}| \<le>o r" by simp
|
blanchet@49990
|
188 |
|
blanchet@49990
|
189 |
lemma card_of_UNIV[simp]:
|
blanchet@49990
|
190 |
"|A :: 'a set| \<le>o |UNIV :: 'a set|"
|
blanchet@49990
|
191 |
using card_of_mono1[of A] by simp
|
blanchet@49990
|
192 |
|
blanchet@49990
|
193 |
lemma card_of_UNIV2[simp]:
|
blanchet@49990
|
194 |
"Card_order r \<Longrightarrow> (r :: 'a rel) \<le>o |UNIV :: 'a set|"
|
blanchet@49990
|
195 |
using card_of_UNIV[of "Field r"] card_of_Field_ordIso
|
blanchet@49990
|
196 |
ordIso_symmetric ordIso_ordLeq_trans by blast
|
blanchet@49990
|
197 |
|
blanchet@49990
|
198 |
lemma card_of_Pow_mono[simp]:
|
blanchet@49990
|
199 |
assumes "|A| \<le>o |B|"
|
blanchet@49990
|
200 |
shows "|Pow A| \<le>o |Pow B|"
|
blanchet@49990
|
201 |
proof-
|
blanchet@49990
|
202 |
obtain f where "inj_on f A \<and> f ` A \<le> B"
|
blanchet@49990
|
203 |
using assms card_of_ordLeq[of A B] by auto
|
blanchet@49990
|
204 |
hence "inj_on (image f) (Pow A) \<and> (image f) ` (Pow A) \<le> (Pow B)"
|
blanchet@49990
|
205 |
by (auto simp add: inj_on_image_Pow image_Pow_mono)
|
blanchet@49990
|
206 |
thus ?thesis using card_of_ordLeq[of "Pow A"] by metis
|
blanchet@49990
|
207 |
qed
|
blanchet@49990
|
208 |
|
blanchet@49990
|
209 |
lemma ordIso_Pow_mono[simp]:
|
blanchet@49990
|
210 |
assumes "r \<le>o r'"
|
blanchet@49990
|
211 |
shows "|Pow(Field r)| \<le>o |Pow(Field r')|"
|
blanchet@49990
|
212 |
using assms card_of_mono2 card_of_Pow_mono by blast
|
blanchet@49990
|
213 |
|
blanchet@49990
|
214 |
lemma card_of_Pow_cong[simp]:
|
blanchet@49990
|
215 |
assumes "|A| =o |B|"
|
blanchet@49990
|
216 |
shows "|Pow A| =o |Pow B|"
|
blanchet@49990
|
217 |
proof-
|
blanchet@49990
|
218 |
obtain f where "bij_betw f A B"
|
blanchet@49990
|
219 |
using assms card_of_ordIso[of A B] by auto
|
blanchet@49990
|
220 |
hence "bij_betw (image f) (Pow A) (Pow B)"
|
blanchet@49990
|
221 |
by (auto simp add: bij_betw_image_Pow)
|
blanchet@49990
|
222 |
thus ?thesis using card_of_ordIso[of "Pow A"] by auto
|
blanchet@49990
|
223 |
qed
|
blanchet@49990
|
224 |
|
blanchet@49990
|
225 |
lemma ordIso_Pow_cong[simp]:
|
blanchet@49990
|
226 |
assumes "r =o r'"
|
blanchet@49990
|
227 |
shows "|Pow(Field r)| =o |Pow(Field r')|"
|
blanchet@49990
|
228 |
using assms card_of_cong card_of_Pow_cong by blast
|
blanchet@49990
|
229 |
|
blanchet@49990
|
230 |
corollary Card_order_Plus_empty1:
|
blanchet@49990
|
231 |
"Card_order r \<Longrightarrow> r =o |(Field r) <+> {}|"
|
blanchet@49990
|
232 |
using card_of_Plus_empty1 card_of_Field_ordIso ordIso_equivalence by blast
|
blanchet@49990
|
233 |
|
blanchet@49990
|
234 |
corollary Card_order_Plus_empty2:
|
blanchet@49990
|
235 |
"Card_order r \<Longrightarrow> r =o |{} <+> (Field r)|"
|
blanchet@49990
|
236 |
using card_of_Plus_empty2 card_of_Field_ordIso ordIso_equivalence by blast
|
blanchet@49990
|
237 |
|
blanchet@49990
|
238 |
lemma Card_order_Un1:
|
blanchet@49990
|
239 |
shows "Card_order r \<Longrightarrow> |Field r| \<le>o |(Field r) \<union> B| "
|
blanchet@49990
|
240 |
using card_of_Un1 card_of_Field_ordIso ordIso_symmetric ordIso_ordLeq_trans by auto
|
blanchet@49990
|
241 |
|
blanchet@49990
|
242 |
lemma card_of_Un2[simp]:
|
blanchet@49990
|
243 |
shows "|A| \<le>o |B \<union> A|"
|
blanchet@49990
|
244 |
using inj_on_id[of A] card_of_ordLeq[of A _] by fastforce
|
blanchet@49990
|
245 |
|
blanchet@49990
|
246 |
lemma Card_order_Un2:
|
blanchet@49990
|
247 |
shows "Card_order r \<Longrightarrow> |Field r| \<le>o |A \<union> (Field r)| "
|
blanchet@49990
|
248 |
using card_of_Un2 card_of_Field_ordIso ordIso_symmetric ordIso_ordLeq_trans by auto
|
blanchet@49990
|
249 |
|
blanchet@49990
|
250 |
lemma Un_Plus_bij_betw:
|
blanchet@49990
|
251 |
assumes "A Int B = {}"
|
blanchet@49990
|
252 |
shows "\<exists>f. bij_betw f (A \<union> B) (A <+> B)"
|
blanchet@49990
|
253 |
proof-
|
blanchet@49990
|
254 |
let ?f = "\<lambda> c. if c \<in> A then Inl c else Inr c"
|
blanchet@49990
|
255 |
have "bij_betw ?f (A \<union> B) (A <+> B)"
|
blanchet@49990
|
256 |
using assms by(unfold bij_betw_def inj_on_def, auto)
|
blanchet@49990
|
257 |
thus ?thesis by blast
|
blanchet@49990
|
258 |
qed
|
blanchet@49990
|
259 |
|
blanchet@49990
|
260 |
lemma card_of_Un_Plus_ordIso:
|
blanchet@49990
|
261 |
assumes "A Int B = {}"
|
blanchet@49990
|
262 |
shows "|A \<union> B| =o |A <+> B|"
|
blanchet@49990
|
263 |
using assms card_of_ordIso[of "A \<union> B"] Un_Plus_bij_betw[of A B] by auto
|
blanchet@49990
|
264 |
|
blanchet@49990
|
265 |
lemma card_of_Un_Plus_ordIso1:
|
blanchet@49990
|
266 |
"|A \<union> B| =o |A <+> (B - A)|"
|
blanchet@49990
|
267 |
using card_of_Un_Plus_ordIso[of A "B - A"] by auto
|
blanchet@49990
|
268 |
|
blanchet@49990
|
269 |
lemma card_of_Un_Plus_ordIso2:
|
blanchet@49990
|
270 |
"|A \<union> B| =o |(A - B) <+> B|"
|
blanchet@49990
|
271 |
using card_of_Un_Plus_ordIso[of "A - B" B] by auto
|
blanchet@49990
|
272 |
|
blanchet@49990
|
273 |
lemma card_of_Times_singl1: "|A| =o |A \<times> {b}|"
|
blanchet@49990
|
274 |
proof-
|
blanchet@49990
|
275 |
have "bij_betw fst (A \<times> {b}) A" unfolding bij_betw_def inj_on_def by force
|
blanchet@49990
|
276 |
thus ?thesis using card_of_ordIso ordIso_symmetric by blast
|
blanchet@49990
|
277 |
qed
|
blanchet@49990
|
278 |
|
blanchet@49990
|
279 |
corollary Card_order_Times_singl1:
|
blanchet@49990
|
280 |
"Card_order r \<Longrightarrow> r =o |(Field r) \<times> {b}|"
|
blanchet@49990
|
281 |
using card_of_Times_singl1[of _ b] card_of_Field_ordIso ordIso_equivalence by blast
|
blanchet@49990
|
282 |
|
blanchet@49990
|
283 |
lemma card_of_Times_singl2: "|A| =o |{b} \<times> A|"
|
blanchet@49990
|
284 |
proof-
|
blanchet@49990
|
285 |
have "bij_betw snd ({b} \<times> A) A" unfolding bij_betw_def inj_on_def by force
|
blanchet@49990
|
286 |
thus ?thesis using card_of_ordIso ordIso_symmetric by blast
|
blanchet@49990
|
287 |
qed
|
blanchet@49990
|
288 |
|
blanchet@49990
|
289 |
corollary Card_order_Times_singl2:
|
blanchet@49990
|
290 |
"Card_order r \<Longrightarrow> r =o |{a} \<times> (Field r)|"
|
blanchet@49990
|
291 |
using card_of_Times_singl2[of _ a] card_of_Field_ordIso ordIso_equivalence by blast
|
blanchet@49990
|
292 |
|
blanchet@49990
|
293 |
lemma card_of_Times_assoc: "|(A \<times> B) \<times> C| =o |A \<times> B \<times> C|"
|
blanchet@49990
|
294 |
proof -
|
blanchet@49990
|
295 |
let ?f = "\<lambda>((a,b),c). (a,(b,c))"
|
blanchet@49990
|
296 |
have "A \<times> B \<times> C \<subseteq> ?f ` ((A \<times> B) \<times> C)"
|
blanchet@49990
|
297 |
proof
|
blanchet@49990
|
298 |
fix x assume "x \<in> A \<times> B \<times> C"
|
blanchet@49990
|
299 |
then obtain a b c where *: "a \<in> A" "b \<in> B" "c \<in> C" "x = (a, b, c)" by blast
|
blanchet@49990
|
300 |
let ?x = "((a, b), c)"
|
blanchet@49990
|
301 |
from * have "?x \<in> (A \<times> B) \<times> C" "x = ?f ?x" by auto
|
blanchet@49990
|
302 |
thus "x \<in> ?f ` ((A \<times> B) \<times> C)" by blast
|
blanchet@49990
|
303 |
qed
|
blanchet@49990
|
304 |
hence "bij_betw ?f ((A \<times> B) \<times> C) (A \<times> B \<times> C)"
|
blanchet@49990
|
305 |
unfolding bij_betw_def inj_on_def by auto
|
blanchet@49990
|
306 |
thus ?thesis using card_of_ordIso by blast
|
blanchet@49990
|
307 |
qed
|
blanchet@49990
|
308 |
|
blanchet@49990
|
309 |
corollary Card_order_Times3:
|
blanchet@49990
|
310 |
"Card_order r \<Longrightarrow> |Field r| \<le>o |(Field r) \<times> (Field r)|"
|
traytel@55951
|
311 |
by (rule card_of_Times3)
|
blanchet@49990
|
312 |
|
blanchet@55848
|
313 |
lemma card_of_Times_cong1[simp]:
|
blanchet@55848
|
314 |
assumes "|A| =o |B|"
|
blanchet@55848
|
315 |
shows "|A \<times> C| =o |B \<times> C|"
|
traytel@55951
|
316 |
using assms by (simp add: ordIso_iff_ordLeq)
|
blanchet@55848
|
317 |
|
blanchet@55848
|
318 |
lemma card_of_Times_cong2[simp]:
|
blanchet@55848
|
319 |
assumes "|A| =o |B|"
|
blanchet@55848
|
320 |
shows "|C \<times> A| =o |C \<times> B|"
|
traytel@55951
|
321 |
using assms by (simp add: ordIso_iff_ordLeq)
|
blanchet@55848
|
322 |
|
blanchet@49990
|
323 |
lemma card_of_Times_mono[simp]:
|
blanchet@49990
|
324 |
assumes "|A| \<le>o |B|" and "|C| \<le>o |D|"
|
blanchet@49990
|
325 |
shows "|A \<times> C| \<le>o |B \<times> D|"
|
blanchet@49990
|
326 |
using assms card_of_Times_mono1[of A B C] card_of_Times_mono2[of C D B]
|
blanchet@49990
|
327 |
ordLeq_transitive[of "|A \<times> C|"] by blast
|
blanchet@49990
|
328 |
|
blanchet@49990
|
329 |
corollary ordLeq_Times_mono:
|
blanchet@49990
|
330 |
assumes "r \<le>o r'" and "p \<le>o p'"
|
blanchet@49990
|
331 |
shows "|(Field r) \<times> (Field p)| \<le>o |(Field r') \<times> (Field p')|"
|
blanchet@49990
|
332 |
using assms card_of_mono2[of r r'] card_of_mono2[of p p'] card_of_Times_mono by blast
|
blanchet@49990
|
333 |
|
blanchet@49990
|
334 |
corollary ordIso_Times_cong1[simp]:
|
blanchet@49990
|
335 |
assumes "r =o r'"
|
blanchet@49990
|
336 |
shows "|(Field r) \<times> C| =o |(Field r') \<times> C|"
|
blanchet@49990
|
337 |
using assms card_of_cong card_of_Times_cong1 by blast
|
blanchet@49990
|
338 |
|
blanchet@55848
|
339 |
corollary ordIso_Times_cong2:
|
blanchet@55848
|
340 |
assumes "r =o r'"
|
blanchet@55848
|
341 |
shows "|A \<times> (Field r)| =o |A \<times> (Field r')|"
|
blanchet@55848
|
342 |
using assms card_of_cong card_of_Times_cong2 by blast
|
blanchet@55848
|
343 |
|
blanchet@49990
|
344 |
lemma card_of_Times_cong[simp]:
|
blanchet@49990
|
345 |
assumes "|A| =o |B|" and "|C| =o |D|"
|
blanchet@49990
|
346 |
shows "|A \<times> C| =o |B \<times> D|"
|
blanchet@49990
|
347 |
using assms
|
blanchet@49990
|
348 |
by (auto simp add: ordIso_iff_ordLeq)
|
blanchet@49990
|
349 |
|
blanchet@49990
|
350 |
corollary ordIso_Times_cong:
|
blanchet@49990
|
351 |
assumes "r =o r'" and "p =o p'"
|
blanchet@49990
|
352 |
shows "|(Field r) \<times> (Field p)| =o |(Field r') \<times> (Field p')|"
|
blanchet@49990
|
353 |
using assms card_of_cong[of r r'] card_of_cong[of p p'] card_of_Times_cong by blast
|
blanchet@49990
|
354 |
|
blanchet@49990
|
355 |
lemma card_of_Sigma_mono2:
|
blanchet@49990
|
356 |
assumes "inj_on f (I::'i set)" and "f ` I \<le> (J::'j set)"
|
blanchet@49990
|
357 |
shows "|SIGMA i : I. (A::'j \<Rightarrow> 'a set) (f i)| \<le>o |SIGMA j : J. A j|"
|
blanchet@49990
|
358 |
proof-
|
blanchet@49990
|
359 |
let ?LEFT = "SIGMA i : I. A (f i)"
|
blanchet@49990
|
360 |
let ?RIGHT = "SIGMA j : J. A j"
|
blanchet@49990
|
361 |
obtain u where u_def: "u = (\<lambda>(i::'i,a::'a). (f i,a))" by blast
|
blanchet@49990
|
362 |
have "inj_on u ?LEFT \<and> u `?LEFT \<le> ?RIGHT"
|
blanchet@49990
|
363 |
using assms unfolding u_def inj_on_def by auto
|
blanchet@49990
|
364 |
thus ?thesis using card_of_ordLeq by blast
|
blanchet@49990
|
365 |
qed
|
blanchet@49990
|
366 |
|
blanchet@49990
|
367 |
lemma card_of_Sigma_mono:
|
blanchet@49990
|
368 |
assumes INJ: "inj_on f I" and IM: "f ` I \<le> J" and
|
blanchet@49990
|
369 |
LEQ: "\<forall>j \<in> J. |A j| \<le>o |B j|"
|
blanchet@49990
|
370 |
shows "|SIGMA i : I. A (f i)| \<le>o |SIGMA j : J. B j|"
|
blanchet@49990
|
371 |
proof-
|
blanchet@49990
|
372 |
have "\<forall>i \<in> I. |A(f i)| \<le>o |B(f i)|"
|
blanchet@49990
|
373 |
using IM LEQ by blast
|
blanchet@49990
|
374 |
hence "|SIGMA i : I. A (f i)| \<le>o |SIGMA i : I. B (f i)|"
|
blanchet@49990
|
375 |
using card_of_Sigma_mono1[of I] by metis
|
blanchet@49990
|
376 |
moreover have "|SIGMA i : I. B (f i)| \<le>o |SIGMA j : J. B j|"
|
blanchet@49990
|
377 |
using INJ IM card_of_Sigma_mono2 by blast
|
blanchet@49990
|
378 |
ultimately show ?thesis using ordLeq_transitive by blast
|
blanchet@49990
|
379 |
qed
|
blanchet@49990
|
380 |
|
blanchet@49990
|
381 |
|
blanchet@49990
|
382 |
lemma ordLeq_Sigma_mono1:
|
blanchet@49990
|
383 |
assumes "\<forall>i \<in> I. p i \<le>o r i"
|
blanchet@49990
|
384 |
shows "|SIGMA i : I. Field(p i)| \<le>o |SIGMA i : I. Field(r i)|"
|
blanchet@49990
|
385 |
using assms by (auto simp add: card_of_Sigma_mono1)
|
blanchet@49990
|
386 |
|
blanchet@49990
|
387 |
|
blanchet@49990
|
388 |
lemma ordLeq_Sigma_mono:
|
blanchet@49990
|
389 |
assumes "inj_on f I" and "f ` I \<le> J" and
|
blanchet@49990
|
390 |
"\<forall>j \<in> J. p j \<le>o r j"
|
blanchet@49990
|
391 |
shows "|SIGMA i : I. Field(p(f i))| \<le>o |SIGMA j : J. Field(r j)|"
|
blanchet@49990
|
392 |
using assms card_of_mono2 card_of_Sigma_mono
|
blanchet@49990
|
393 |
[of f I J "\<lambda> i. Field(p i)" "\<lambda> j. Field(r j)"] by metis
|
blanchet@49990
|
394 |
|
blanchet@49990
|
395 |
|
blanchet@49990
|
396 |
lemma card_of_Sigma_cong1:
|
blanchet@49990
|
397 |
assumes "\<forall>i \<in> I. |A i| =o |B i|"
|
blanchet@49990
|
398 |
shows "|SIGMA i : I. A i| =o |SIGMA i : I. B i|"
|
blanchet@49990
|
399 |
using assms by (auto simp add: card_of_Sigma_mono1 ordIso_iff_ordLeq)
|
blanchet@49990
|
400 |
|
blanchet@49990
|
401 |
|
blanchet@49990
|
402 |
lemma card_of_Sigma_cong2:
|
blanchet@49990
|
403 |
assumes "bij_betw f (I::'i set) (J::'j set)"
|
blanchet@49990
|
404 |
shows "|SIGMA i : I. (A::'j \<Rightarrow> 'a set) (f i)| =o |SIGMA j : J. A j|"
|
blanchet@49990
|
405 |
proof-
|
blanchet@49990
|
406 |
let ?LEFT = "SIGMA i : I. A (f i)"
|
blanchet@49990
|
407 |
let ?RIGHT = "SIGMA j : J. A j"
|
blanchet@49990
|
408 |
obtain u where u_def: "u = (\<lambda>(i::'i,a::'a). (f i,a))" by blast
|
blanchet@49990
|
409 |
have "bij_betw u ?LEFT ?RIGHT"
|
blanchet@49990
|
410 |
using assms unfolding u_def bij_betw_def inj_on_def by auto
|
blanchet@49990
|
411 |
thus ?thesis using card_of_ordIso by blast
|
blanchet@49990
|
412 |
qed
|
blanchet@49990
|
413 |
|
blanchet@49990
|
414 |
lemma card_of_Sigma_cong:
|
blanchet@49990
|
415 |
assumes BIJ: "bij_betw f I J" and
|
blanchet@49990
|
416 |
ISO: "\<forall>j \<in> J. |A j| =o |B j|"
|
blanchet@49990
|
417 |
shows "|SIGMA i : I. A (f i)| =o |SIGMA j : J. B j|"
|
blanchet@49990
|
418 |
proof-
|
blanchet@49990
|
419 |
have "\<forall>i \<in> I. |A(f i)| =o |B(f i)|"
|
blanchet@49990
|
420 |
using ISO BIJ unfolding bij_betw_def by blast
|
blanchet@49990
|
421 |
hence "|SIGMA i : I. A (f i)| =o |SIGMA i : I. B (f i)|"
|
blanchet@49990
|
422 |
using card_of_Sigma_cong1 by metis
|
blanchet@49990
|
423 |
moreover have "|SIGMA i : I. B (f i)| =o |SIGMA j : J. B j|"
|
blanchet@49990
|
424 |
using BIJ card_of_Sigma_cong2 by blast
|
blanchet@49990
|
425 |
ultimately show ?thesis using ordIso_transitive by blast
|
blanchet@49990
|
426 |
qed
|
blanchet@49990
|
427 |
|
blanchet@49990
|
428 |
lemma ordIso_Sigma_cong1:
|
blanchet@49990
|
429 |
assumes "\<forall>i \<in> I. p i =o r i"
|
blanchet@49990
|
430 |
shows "|SIGMA i : I. Field(p i)| =o |SIGMA i : I. Field(r i)|"
|
blanchet@49990
|
431 |
using assms by (auto simp add: card_of_Sigma_cong1)
|
blanchet@49990
|
432 |
|
blanchet@49990
|
433 |
lemma ordLeq_Sigma_cong:
|
blanchet@49990
|
434 |
assumes "bij_betw f I J" and
|
blanchet@49990
|
435 |
"\<forall>j \<in> J. p j =o r j"
|
blanchet@49990
|
436 |
shows "|SIGMA i : I. Field(p(f i))| =o |SIGMA j : J. Field(r j)|"
|
blanchet@49990
|
437 |
using assms card_of_cong card_of_Sigma_cong
|
blanchet@49990
|
438 |
[of f I J "\<lambda> j. Field(p j)" "\<lambda> j. Field(r j)"] by blast
|
blanchet@49990
|
439 |
|
blanchet@49990
|
440 |
corollary ordLeq_Sigma_Times:
|
blanchet@49990
|
441 |
"\<forall>i \<in> I. p i \<le>o r \<Longrightarrow> |SIGMA i : I. Field (p i)| \<le>o |I \<times> (Field r)|"
|
blanchet@49990
|
442 |
by (auto simp add: card_of_Sigma_Times)
|
blanchet@49990
|
443 |
|
blanchet@49990
|
444 |
lemma card_of_UNION_Sigma2:
|
blanchet@49990
|
445 |
assumes
|
blanchet@49990
|
446 |
"!! i j. \<lbrakk>{i,j} <= I; i ~= j\<rbrakk> \<Longrightarrow> A i Int A j = {}"
|
blanchet@49990
|
447 |
shows
|
blanchet@49990
|
448 |
"|\<Union>i\<in>I. A i| =o |Sigma I A|"
|
blanchet@49990
|
449 |
proof-
|
blanchet@49990
|
450 |
let ?L = "\<Union>i\<in>I. A i" let ?R = "Sigma I A"
|
blanchet@49990
|
451 |
have "|?L| <=o |?R|" using card_of_UNION_Sigma .
|
blanchet@49990
|
452 |
moreover have "|?R| <=o |?L|"
|
blanchet@49990
|
453 |
proof-
|
blanchet@49990
|
454 |
have "inj_on snd ?R"
|
blanchet@49990
|
455 |
unfolding inj_on_def using assms by auto
|
blanchet@49990
|
456 |
moreover have "snd ` ?R <= ?L" by auto
|
blanchet@49990
|
457 |
ultimately show ?thesis using card_of_ordLeq by blast
|
blanchet@49990
|
458 |
qed
|
blanchet@49990
|
459 |
ultimately show ?thesis by(simp add: ordIso_iff_ordLeq)
|
blanchet@49990
|
460 |
qed
|
blanchet@49990
|
461 |
|
blanchet@49990
|
462 |
corollary Plus_into_Times:
|
blanchet@49990
|
463 |
assumes A2: "a1 \<noteq> a2 \<and> {a1,a2} \<le> A" and
|
blanchet@49990
|
464 |
B2: "b1 \<noteq> b2 \<and> {b1,b2} \<le> B"
|
blanchet@49990
|
465 |
shows "\<exists>f. inj_on f (A <+> B) \<and> f ` (A <+> B) \<le> A \<times> B"
|
blanchet@49990
|
466 |
using assms by (auto simp add: card_of_Plus_Times card_of_ordLeq)
|
blanchet@49990
|
467 |
|
blanchet@49990
|
468 |
corollary Plus_into_Times_types:
|
blanchet@49990
|
469 |
assumes A2: "(a1::'a) \<noteq> a2" and B2: "(b1::'b) \<noteq> b2"
|
blanchet@49990
|
470 |
shows "\<exists>(f::'a + 'b \<Rightarrow> 'a * 'b). inj f"
|
blanchet@49990
|
471 |
using assms Plus_into_Times[of a1 a2 UNIV b1 b2 UNIV]
|
blanchet@49990
|
472 |
by auto
|
blanchet@49990
|
473 |
|
blanchet@49990
|
474 |
corollary Times_same_infinite_bij_betw:
|
traytel@55951
|
475 |
assumes "\<not>finite A"
|
blanchet@49990
|
476 |
shows "\<exists>f. bij_betw f (A \<times> A) A"
|
blanchet@49990
|
477 |
using assms by (auto simp add: card_of_ordIso)
|
blanchet@49990
|
478 |
|
blanchet@49990
|
479 |
corollary Times_same_infinite_bij_betw_types:
|
traytel@55951
|
480 |
assumes INF: "\<not>finite(UNIV::'a set)"
|
blanchet@49990
|
481 |
shows "\<exists>(f::('a * 'a) => 'a). bij f"
|
blanchet@49990
|
482 |
using assms Times_same_infinite_bij_betw[of "UNIV::'a set"]
|
blanchet@49990
|
483 |
by auto
|
blanchet@49990
|
484 |
|
blanchet@49990
|
485 |
corollary Times_infinite_bij_betw:
|
traytel@55951
|
486 |
assumes INF: "\<not>finite A" and NE: "B \<noteq> {}" and INJ: "inj_on g B \<and> g ` B \<le> A"
|
blanchet@49990
|
487 |
shows "(\<exists>f. bij_betw f (A \<times> B) A) \<and> (\<exists>h. bij_betw h (B \<times> A) A)"
|
blanchet@49990
|
488 |
proof-
|
blanchet@49990
|
489 |
have "|B| \<le>o |A|" using INJ card_of_ordLeq by blast
|
blanchet@49990
|
490 |
thus ?thesis using INF NE
|
blanchet@49990
|
491 |
by (auto simp add: card_of_ordIso card_of_Times_infinite)
|
blanchet@49990
|
492 |
qed
|
blanchet@49990
|
493 |
|
blanchet@49990
|
494 |
corollary Times_infinite_bij_betw_types:
|
traytel@55951
|
495 |
assumes INF: "\<not>finite(UNIV::'a set)" and
|
blanchet@49990
|
496 |
BIJ: "inj(g::'b \<Rightarrow> 'a)"
|
blanchet@49990
|
497 |
shows "(\<exists>(f::('b * 'a) => 'a). bij f) \<and> (\<exists>(h::('a * 'b) => 'a). bij h)"
|
blanchet@49990
|
498 |
using assms Times_infinite_bij_betw[of "UNIV::'a set" "UNIV::'b set" g]
|
blanchet@49990
|
499 |
by auto
|
blanchet@49990
|
500 |
|
blanchet@49990
|
501 |
lemma card_of_Times_ordLeq_infinite:
|
traytel@55951
|
502 |
"\<lbrakk>\<not>finite C; |A| \<le>o |C|; |B| \<le>o |C|\<rbrakk>
|
blanchet@49990
|
503 |
\<Longrightarrow> |A <*> B| \<le>o |C|"
|
blanchet@49990
|
504 |
by(simp add: card_of_Sigma_ordLeq_infinite)
|
blanchet@49990
|
505 |
|
blanchet@49990
|
506 |
corollary Plus_infinite_bij_betw:
|
traytel@55951
|
507 |
assumes INF: "\<not>finite A" and INJ: "inj_on g B \<and> g ` B \<le> A"
|
blanchet@49990
|
508 |
shows "(\<exists>f. bij_betw f (A <+> B) A) \<and> (\<exists>h. bij_betw h (B <+> A) A)"
|
blanchet@49990
|
509 |
proof-
|
blanchet@49990
|
510 |
have "|B| \<le>o |A|" using INJ card_of_ordLeq by blast
|
blanchet@49990
|
511 |
thus ?thesis using INF
|
blanchet@49990
|
512 |
by (auto simp add: card_of_ordIso)
|
blanchet@49990
|
513 |
qed
|
blanchet@49990
|
514 |
|
blanchet@49990
|
515 |
corollary Plus_infinite_bij_betw_types:
|
traytel@55951
|
516 |
assumes INF: "\<not>finite(UNIV::'a set)" and
|
blanchet@49990
|
517 |
BIJ: "inj(g::'b \<Rightarrow> 'a)"
|
blanchet@49990
|
518 |
shows "(\<exists>(f::('b + 'a) => 'a). bij f) \<and> (\<exists>(h::('a + 'b) => 'a). bij h)"
|
blanchet@49990
|
519 |
using assms Plus_infinite_bij_betw[of "UNIV::'a set" g "UNIV::'b set"]
|
blanchet@49990
|
520 |
by auto
|
blanchet@49990
|
521 |
|
blanchet@55848
|
522 |
lemma card_of_Un_infinite:
|
traytel@55951
|
523 |
assumes INF: "\<not>finite A" and LEQ: "|B| \<le>o |A|"
|
blanchet@55848
|
524 |
shows "|A \<union> B| =o |A| \<and> |B \<union> A| =o |A|"
|
blanchet@55848
|
525 |
proof-
|
blanchet@55848
|
526 |
have "|A \<union> B| \<le>o |A <+> B|" by (rule card_of_Un_Plus_ordLeq)
|
blanchet@55848
|
527 |
moreover have "|A <+> B| =o |A|"
|
blanchet@55848
|
528 |
using assms by (metis card_of_Plus_infinite)
|
blanchet@55848
|
529 |
ultimately have "|A \<union> B| \<le>o |A|" using ordLeq_ordIso_trans by blast
|
blanchet@55848
|
530 |
hence "|A \<union> B| =o |A|" using card_of_Un1 ordIso_iff_ordLeq by blast
|
blanchet@55848
|
531 |
thus ?thesis using Un_commute[of B A] by auto
|
blanchet@55848
|
532 |
qed
|
blanchet@55848
|
533 |
|
blanchet@49990
|
534 |
lemma card_of_Un_infinite_simps[simp]:
|
traytel@55951
|
535 |
"\<lbrakk>\<not>finite A; |B| \<le>o |A| \<rbrakk> \<Longrightarrow> |A \<union> B| =o |A|"
|
traytel@55951
|
536 |
"\<lbrakk>\<not>finite A; |B| \<le>o |A| \<rbrakk> \<Longrightarrow> |B \<union> A| =o |A|"
|
blanchet@49990
|
537 |
using card_of_Un_infinite by auto
|
blanchet@49990
|
538 |
|
blanchet@55848
|
539 |
lemma card_of_Un_diff_infinite:
|
traytel@55951
|
540 |
assumes INF: "\<not>finite A" and LESS: "|B| <o |A|"
|
blanchet@55848
|
541 |
shows "|A - B| =o |A|"
|
blanchet@55848
|
542 |
proof-
|
blanchet@55848
|
543 |
obtain C where C_def: "C = A - B" by blast
|
blanchet@55848
|
544 |
have "|A \<union> B| =o |A|"
|
blanchet@55848
|
545 |
using assms ordLeq_iff_ordLess_or_ordIso card_of_Un_infinite by blast
|
blanchet@55848
|
546 |
moreover have "C \<union> B = A \<union> B" unfolding C_def by auto
|
blanchet@55848
|
547 |
ultimately have 1: "|C \<union> B| =o |A|" by auto
|
blanchet@55848
|
548 |
(* *)
|
blanchet@55848
|
549 |
{assume *: "|C| \<le>o |B|"
|
blanchet@55848
|
550 |
moreover
|
blanchet@55848
|
551 |
{assume **: "finite B"
|
blanchet@55848
|
552 |
hence "finite C"
|
blanchet@55848
|
553 |
using card_of_ordLeq_finite * by blast
|
blanchet@55848
|
554 |
hence False using ** INF card_of_ordIso_finite 1 by blast
|
blanchet@55848
|
555 |
}
|
traytel@55951
|
556 |
hence "\<not>finite B" by auto
|
blanchet@55848
|
557 |
ultimately have False
|
blanchet@55848
|
558 |
using card_of_Un_infinite 1 ordIso_equivalence(1,3) LESS not_ordLess_ordIso by metis
|
blanchet@55848
|
559 |
}
|
blanchet@55848
|
560 |
hence 2: "|B| \<le>o |C|" using card_of_Well_order ordLeq_total by blast
|
blanchet@55848
|
561 |
{assume *: "finite C"
|
blanchet@55848
|
562 |
hence "finite B" using card_of_ordLeq_finite 2 by blast
|
blanchet@55848
|
563 |
hence False using * INF card_of_ordIso_finite 1 by blast
|
blanchet@55848
|
564 |
}
|
traytel@55951
|
565 |
hence "\<not>finite C" by auto
|
blanchet@55848
|
566 |
hence "|C| =o |A|"
|
blanchet@55848
|
567 |
using card_of_Un_infinite 1 2 ordIso_equivalence(1,3) by metis
|
blanchet@55848
|
568 |
thus ?thesis unfolding C_def .
|
blanchet@55848
|
569 |
qed
|
blanchet@55848
|
570 |
|
blanchet@49990
|
571 |
corollary Card_order_Un_infinite:
|
traytel@55951
|
572 |
assumes INF: "\<not>finite(Field r)" and CARD: "Card_order r" and
|
blanchet@49990
|
573 |
LEQ: "p \<le>o r"
|
blanchet@49990
|
574 |
shows "| (Field r) \<union> (Field p) | =o r \<and> | (Field p) \<union> (Field r) | =o r"
|
blanchet@49990
|
575 |
proof-
|
blanchet@49990
|
576 |
have "| Field r \<union> Field p | =o | Field r | \<and>
|
blanchet@49990
|
577 |
| Field p \<union> Field r | =o | Field r |"
|
blanchet@49990
|
578 |
using assms by (auto simp add: card_of_Un_infinite)
|
blanchet@49990
|
579 |
thus ?thesis
|
blanchet@49990
|
580 |
using assms card_of_Field_ordIso[of r]
|
blanchet@49990
|
581 |
ordIso_transitive[of "|Field r \<union> Field p|"]
|
blanchet@49990
|
582 |
ordIso_transitive[of _ "|Field r|"] by blast
|
blanchet@49990
|
583 |
qed
|
blanchet@49990
|
584 |
|
blanchet@49990
|
585 |
corollary subset_ordLeq_diff_infinite:
|
traytel@55951
|
586 |
assumes INF: "\<not>finite B" and SUB: "A \<le> B" and LESS: "|A| <o |B|"
|
traytel@55951
|
587 |
shows "\<not>finite (B - A)"
|
blanchet@49990
|
588 |
using assms card_of_Un_diff_infinite card_of_ordIso_finite by blast
|
blanchet@49990
|
589 |
|
blanchet@49990
|
590 |
lemma card_of_Times_ordLess_infinite[simp]:
|
traytel@55951
|
591 |
assumes INF: "\<not>finite C" and
|
blanchet@49990
|
592 |
LESS1: "|A| <o |C|" and LESS2: "|B| <o |C|"
|
blanchet@49990
|
593 |
shows "|A \<times> B| <o |C|"
|
blanchet@49990
|
594 |
proof(cases "A = {} \<or> B = {}")
|
blanchet@49990
|
595 |
assume Case1: "A = {} \<or> B = {}"
|
blanchet@49990
|
596 |
hence "A \<times> B = {}" by blast
|
blanchet@49990
|
597 |
moreover have "C \<noteq> {}" using
|
blanchet@49990
|
598 |
LESS1 card_of_empty5 by blast
|
blanchet@49990
|
599 |
ultimately show ?thesis by(auto simp add: card_of_empty4)
|
blanchet@49990
|
600 |
next
|
blanchet@49990
|
601 |
assume Case2: "\<not>(A = {} \<or> B = {})"
|
blanchet@49990
|
602 |
{assume *: "|C| \<le>o |A \<times> B|"
|
traytel@55951
|
603 |
hence "\<not>finite (A \<times> B)" using INF card_of_ordLeq_finite by blast
|
traytel@55951
|
604 |
hence 1: "\<not>finite A \<or> \<not>finite B" using finite_cartesian_product by blast
|
blanchet@49990
|
605 |
{assume Case21: "|A| \<le>o |B|"
|
traytel@55951
|
606 |
hence "\<not>finite B" using 1 card_of_ordLeq_finite by blast
|
blanchet@49990
|
607 |
hence "|A \<times> B| =o |B|" using Case2 Case21
|
blanchet@49990
|
608 |
by (auto simp add: card_of_Times_infinite)
|
blanchet@49990
|
609 |
hence False using LESS2 not_ordLess_ordLeq * ordLeq_ordIso_trans by blast
|
blanchet@49990
|
610 |
}
|
blanchet@49990
|
611 |
moreover
|
blanchet@49990
|
612 |
{assume Case22: "|B| \<le>o |A|"
|
traytel@55951
|
613 |
hence "\<not>finite A" using 1 card_of_ordLeq_finite by blast
|
blanchet@49990
|
614 |
hence "|A \<times> B| =o |A|" using Case2 Case22
|
blanchet@49990
|
615 |
by (auto simp add: card_of_Times_infinite)
|
blanchet@49990
|
616 |
hence False using LESS1 not_ordLess_ordLeq * ordLeq_ordIso_trans by blast
|
blanchet@49990
|
617 |
}
|
blanchet@49990
|
618 |
ultimately have False using ordLeq_total card_of_Well_order[of A]
|
blanchet@49990
|
619 |
card_of_Well_order[of B] by blast
|
blanchet@49990
|
620 |
}
|
blanchet@49990
|
621 |
thus ?thesis using ordLess_or_ordLeq[of "|A \<times> B|" "|C|"]
|
blanchet@49990
|
622 |
card_of_Well_order[of "A \<times> B"] card_of_Well_order[of "C"] by auto
|
blanchet@49990
|
623 |
qed
|
blanchet@49990
|
624 |
|
blanchet@49990
|
625 |
lemma card_of_Times_ordLess_infinite_Field[simp]:
|
traytel@55951
|
626 |
assumes INF: "\<not>finite (Field r)" and r: "Card_order r" and
|
blanchet@49990
|
627 |
LESS1: "|A| <o r" and LESS2: "|B| <o r"
|
blanchet@49990
|
628 |
shows "|A \<times> B| <o r"
|
blanchet@49990
|
629 |
proof-
|
blanchet@49990
|
630 |
let ?C = "Field r"
|
blanchet@49990
|
631 |
have 1: "r =o |?C| \<and> |?C| =o r" using r card_of_Field_ordIso
|
blanchet@49990
|
632 |
ordIso_symmetric by blast
|
blanchet@49990
|
633 |
hence "|A| <o |?C|" "|B| <o |?C|"
|
blanchet@49990
|
634 |
using LESS1 LESS2 ordLess_ordIso_trans by blast+
|
blanchet@49990
|
635 |
hence "|A <*> B| <o |?C|" using INF
|
blanchet@49990
|
636 |
card_of_Times_ordLess_infinite by blast
|
blanchet@49990
|
637 |
thus ?thesis using 1 ordLess_ordIso_trans by blast
|
blanchet@49990
|
638 |
qed
|
blanchet@49990
|
639 |
|
blanchet@49990
|
640 |
lemma card_of_Un_ordLess_infinite[simp]:
|
traytel@55951
|
641 |
assumes INF: "\<not>finite C" and
|
blanchet@49990
|
642 |
LESS1: "|A| <o |C|" and LESS2: "|B| <o |C|"
|
blanchet@49990
|
643 |
shows "|A \<union> B| <o |C|"
|
blanchet@49990
|
644 |
using assms card_of_Plus_ordLess_infinite card_of_Un_Plus_ordLeq
|
blanchet@49990
|
645 |
ordLeq_ordLess_trans by blast
|
blanchet@49990
|
646 |
|
blanchet@49990
|
647 |
lemma card_of_Un_ordLess_infinite_Field[simp]:
|
traytel@55951
|
648 |
assumes INF: "\<not>finite (Field r)" and r: "Card_order r" and
|
blanchet@49990
|
649 |
LESS1: "|A| <o r" and LESS2: "|B| <o r"
|
blanchet@49990
|
650 |
shows "|A Un B| <o r"
|
blanchet@49990
|
651 |
proof-
|
blanchet@49990
|
652 |
let ?C = "Field r"
|
blanchet@49990
|
653 |
have 1: "r =o |?C| \<and> |?C| =o r" using r card_of_Field_ordIso
|
blanchet@49990
|
654 |
ordIso_symmetric by blast
|
blanchet@49990
|
655 |
hence "|A| <o |?C|" "|B| <o |?C|"
|
blanchet@49990
|
656 |
using LESS1 LESS2 ordLess_ordIso_trans by blast+
|
blanchet@49990
|
657 |
hence "|A Un B| <o |?C|" using INF
|
blanchet@49990
|
658 |
card_of_Un_ordLess_infinite by blast
|
blanchet@49990
|
659 |
thus ?thesis using 1 ordLess_ordIso_trans by blast
|
blanchet@49990
|
660 |
qed
|
blanchet@49990
|
661 |
|
blanchet@55848
|
662 |
|
blanchet@55848
|
663 |
subsection {* Cardinals versus set operations involving infinite sets *}
|
blanchet@55848
|
664 |
|
blanchet@55848
|
665 |
lemma finite_iff_cardOf_nat:
|
blanchet@55848
|
666 |
"finite A = ( |A| <o |UNIV :: nat set| )"
|
blanchet@55848
|
667 |
using infinite_iff_card_of_nat[of A]
|
blanchet@55848
|
668 |
not_ordLeq_iff_ordLess[of "|A|" "|UNIV :: nat set|"]
|
traytel@55951
|
669 |
by fastforce
|
blanchet@55848
|
670 |
|
blanchet@55848
|
671 |
lemma finite_ordLess_infinite2[simp]:
|
traytel@55951
|
672 |
assumes "finite A" and "\<not>finite B"
|
blanchet@55848
|
673 |
shows "|A| <o |B|"
|
blanchet@55848
|
674 |
using assms
|
blanchet@55848
|
675 |
finite_ordLess_infinite[of "|A|" "|B|"]
|
blanchet@55848
|
676 |
card_of_Well_order[of A] card_of_Well_order[of B]
|
blanchet@55848
|
677 |
Field_card_of[of A] Field_card_of[of B] by auto
|
blanchet@55848
|
678 |
|
blanchet@55848
|
679 |
lemma infinite_card_of_insert:
|
traytel@55951
|
680 |
assumes "\<not>finite A"
|
blanchet@55848
|
681 |
shows "|insert a A| =o |A|"
|
blanchet@55848
|
682 |
proof-
|
blanchet@55848
|
683 |
have iA: "insert a A = A \<union> {a}" by simp
|
blanchet@55848
|
684 |
show ?thesis
|
blanchet@55848
|
685 |
using infinite_imp_bij_betw2[OF assms] unfolding iA
|
blanchet@55848
|
686 |
by (metis bij_betw_inv card_of_ordIso)
|
blanchet@55848
|
687 |
qed
|
blanchet@55848
|
688 |
|
blanchet@49990
|
689 |
lemma card_of_Un_singl_ordLess_infinite1:
|
traytel@55951
|
690 |
assumes "\<not>finite B" and "|A| <o |B|"
|
blanchet@49990
|
691 |
shows "|{a} Un A| <o |B|"
|
blanchet@49990
|
692 |
proof-
|
blanchet@49990
|
693 |
have "|{a}| <o |B|" using assms by auto
|
traytel@52901
|
694 |
thus ?thesis using assms card_of_Un_ordLess_infinite[of B] by blast
|
blanchet@49990
|
695 |
qed
|
blanchet@49990
|
696 |
|
blanchet@49990
|
697 |
lemma card_of_Un_singl_ordLess_infinite:
|
traytel@55951
|
698 |
assumes "\<not>finite B"
|
blanchet@49990
|
699 |
shows "( |A| <o |B| ) = ( |{a} Un A| <o |B| )"
|
blanchet@49990
|
700 |
using assms card_of_Un_singl_ordLess_infinite1[of B A]
|
blanchet@49990
|
701 |
proof(auto)
|
blanchet@49990
|
702 |
assume "|insert a A| <o |B|"
|
traytel@52901
|
703 |
moreover have "|A| <=o |insert a A|" using card_of_mono1[of A "insert a A"] by blast
|
blanchet@49990
|
704 |
ultimately show "|A| <o |B|" using ordLeq_ordLess_trans by blast
|
blanchet@49990
|
705 |
qed
|
blanchet@49990
|
706 |
|
blanchet@49990
|
707 |
|
blanchet@55848
|
708 |
subsection {* Cardinals versus lists *}
|
blanchet@55848
|
709 |
|
blanchet@55848
|
710 |
text{* The next is an auxiliary operator, which shall be used for inductive
|
blanchet@55848
|
711 |
proofs of facts concerning the cardinality of @{text "List"} : *}
|
blanchet@55848
|
712 |
|
blanchet@55848
|
713 |
definition nlists :: "'a set \<Rightarrow> nat \<Rightarrow> 'a list set"
|
blanchet@55848
|
714 |
where "nlists A n \<equiv> {l. set l \<le> A \<and> length l = n}"
|
blanchet@55848
|
715 |
|
blanchet@55848
|
716 |
lemma lists_def2: "lists A = {l. set l \<le> A}"
|
blanchet@55848
|
717 |
using in_listsI by blast
|
blanchet@55848
|
718 |
|
blanchet@55848
|
719 |
lemma lists_UNION_nlists: "lists A = (\<Union> n. nlists A n)"
|
blanchet@55848
|
720 |
unfolding lists_def2 nlists_def by blast
|
blanchet@55848
|
721 |
|
blanchet@55848
|
722 |
lemma card_of_lists: "|A| \<le>o |lists A|"
|
blanchet@55848
|
723 |
proof-
|
blanchet@55848
|
724 |
let ?h = "\<lambda> a. [a]"
|
blanchet@55848
|
725 |
have "inj_on ?h A \<and> ?h ` A \<le> lists A"
|
blanchet@55848
|
726 |
unfolding inj_on_def lists_def2 by auto
|
blanchet@55848
|
727 |
thus ?thesis by (metis card_of_ordLeq)
|
blanchet@55848
|
728 |
qed
|
blanchet@55848
|
729 |
|
blanchet@55848
|
730 |
lemma nlists_0: "nlists A 0 = {[]}"
|
blanchet@55848
|
731 |
unfolding nlists_def by auto
|
blanchet@55848
|
732 |
|
blanchet@55848
|
733 |
lemma nlists_not_empty:
|
blanchet@55848
|
734 |
assumes "A \<noteq> {}"
|
blanchet@55848
|
735 |
shows "nlists A n \<noteq> {}"
|
blanchet@55848
|
736 |
proof(induct n, simp add: nlists_0)
|
blanchet@55848
|
737 |
fix n assume "nlists A n \<noteq> {}"
|
blanchet@55848
|
738 |
then obtain a and l where "a \<in> A \<and> l \<in> nlists A n" using assms by auto
|
blanchet@55848
|
739 |
hence "a # l \<in> nlists A (Suc n)" unfolding nlists_def by auto
|
blanchet@55848
|
740 |
thus "nlists A (Suc n) \<noteq> {}" by auto
|
blanchet@55848
|
741 |
qed
|
blanchet@55848
|
742 |
|
blanchet@55848
|
743 |
lemma Nil_in_lists: "[] \<in> lists A"
|
blanchet@55848
|
744 |
unfolding lists_def2 by auto
|
blanchet@55848
|
745 |
|
blanchet@55848
|
746 |
lemma lists_not_empty: "lists A \<noteq> {}"
|
blanchet@55848
|
747 |
using Nil_in_lists by blast
|
blanchet@55848
|
748 |
|
blanchet@55848
|
749 |
lemma card_of_nlists_Succ: "|nlists A (Suc n)| =o |A \<times> (nlists A n)|"
|
blanchet@55848
|
750 |
proof-
|
blanchet@55848
|
751 |
let ?B = "A \<times> (nlists A n)" let ?h = "\<lambda>(a,l). a # l"
|
blanchet@55848
|
752 |
have "inj_on ?h ?B \<and> ?h ` ?B \<le> nlists A (Suc n)"
|
blanchet@55848
|
753 |
unfolding inj_on_def nlists_def by auto
|
blanchet@55848
|
754 |
moreover have "nlists A (Suc n) \<le> ?h ` ?B"
|
blanchet@55848
|
755 |
proof(auto)
|
blanchet@55848
|
756 |
fix l assume "l \<in> nlists A (Suc n)"
|
blanchet@55848
|
757 |
hence 1: "length l = Suc n \<and> set l \<le> A" unfolding nlists_def by auto
|
blanchet@55848
|
758 |
then obtain a and l' where 2: "l = a # l'" by (auto simp: length_Suc_conv)
|
blanchet@55848
|
759 |
hence "a \<in> A \<and> set l' \<le> A \<and> length l' = n" using 1 by auto
|
blanchet@55848
|
760 |
thus "l \<in> ?h ` ?B" using 2 unfolding nlists_def by auto
|
blanchet@55848
|
761 |
qed
|
blanchet@55848
|
762 |
ultimately have "bij_betw ?h ?B (nlists A (Suc n))"
|
blanchet@55848
|
763 |
unfolding bij_betw_def by auto
|
blanchet@55848
|
764 |
thus ?thesis using card_of_ordIso ordIso_symmetric by blast
|
blanchet@55848
|
765 |
qed
|
blanchet@55848
|
766 |
|
blanchet@55848
|
767 |
lemma card_of_nlists_infinite:
|
traytel@55951
|
768 |
assumes "\<not>finite A"
|
blanchet@55848
|
769 |
shows "|nlists A n| \<le>o |A|"
|
blanchet@55848
|
770 |
proof(induct n)
|
blanchet@55848
|
771 |
have "A \<noteq> {}" using assms by auto
|
traytel@55951
|
772 |
thus "|nlists A 0| \<le>o |A|" by (simp add: nlists_0)
|
blanchet@55848
|
773 |
next
|
blanchet@55848
|
774 |
fix n assume IH: "|nlists A n| \<le>o |A|"
|
blanchet@55848
|
775 |
have "|nlists A (Suc n)| =o |A \<times> (nlists A n)|"
|
blanchet@55848
|
776 |
using card_of_nlists_Succ by blast
|
blanchet@55848
|
777 |
moreover
|
blanchet@55848
|
778 |
{have "nlists A n \<noteq> {}" using assms nlists_not_empty[of A] by blast
|
blanchet@55848
|
779 |
hence "|A \<times> (nlists A n)| =o |A|"
|
blanchet@55848
|
780 |
using assms IH by (auto simp add: card_of_Times_infinite)
|
blanchet@55848
|
781 |
}
|
blanchet@55848
|
782 |
ultimately show "|nlists A (Suc n)| \<le>o |A|"
|
blanchet@55848
|
783 |
using ordIso_transitive ordIso_iff_ordLeq by blast
|
blanchet@55848
|
784 |
qed
|
blanchet@49990
|
785 |
|
blanchet@49990
|
786 |
lemma Card_order_lists: "Card_order r \<Longrightarrow> r \<le>o |lists(Field r) |"
|
blanchet@49990
|
787 |
using card_of_lists card_of_Field_ordIso ordIso_ordLeq_trans ordIso_symmetric by blast
|
blanchet@49990
|
788 |
|
blanchet@49990
|
789 |
lemma Union_set_lists:
|
blanchet@49990
|
790 |
"Union(set ` (lists A)) = A"
|
blanchet@49990
|
791 |
unfolding lists_def2 proof(auto)
|
blanchet@49990
|
792 |
fix a assume "a \<in> A"
|
blanchet@49990
|
793 |
hence "set [a] \<le> A \<and> a \<in> set [a]" by auto
|
blanchet@49990
|
794 |
thus "\<exists>l. set l \<le> A \<and> a \<in> set l" by blast
|
blanchet@49990
|
795 |
qed
|
blanchet@49990
|
796 |
|
blanchet@49990
|
797 |
lemma inj_on_map_lists:
|
blanchet@49990
|
798 |
assumes "inj_on f A"
|
blanchet@49990
|
799 |
shows "inj_on (map f) (lists A)"
|
blanchet@49990
|
800 |
using assms Union_set_lists[of A] inj_on_mapI[of f "lists A"] by auto
|
blanchet@49990
|
801 |
|
blanchet@49990
|
802 |
lemma map_lists_mono:
|
blanchet@49990
|
803 |
assumes "f ` A \<le> B"
|
blanchet@49990
|
804 |
shows "(map f) ` (lists A) \<le> lists B"
|
blanchet@49990
|
805 |
using assms unfolding lists_def2 by (auto, blast) (* lethal combination of methods :) *)
|
blanchet@49990
|
806 |
|
blanchet@49990
|
807 |
lemma map_lists_surjective:
|
blanchet@49990
|
808 |
assumes "f ` A = B"
|
blanchet@49990
|
809 |
shows "(map f) ` (lists A) = lists B"
|
blanchet@49990
|
810 |
using assms unfolding lists_def2
|
blanchet@49990
|
811 |
proof (auto, blast)
|
blanchet@49990
|
812 |
fix l' assume *: "set l' \<le> f ` A"
|
blanchet@49990
|
813 |
have "set l' \<le> f ` A \<longrightarrow> l' \<in> map f ` {l. set l \<le> A}"
|
blanchet@49990
|
814 |
proof(induct l', auto)
|
blanchet@49990
|
815 |
fix l a
|
blanchet@49990
|
816 |
assume "a \<in> A" and "set l \<le> A" and
|
blanchet@49990
|
817 |
IH: "f ` (set l) \<le> f ` A"
|
blanchet@49990
|
818 |
hence "set (a # l) \<le> A" by auto
|
blanchet@49990
|
819 |
hence "map f (a # l) \<in> map f ` {l. set l \<le> A}" by blast
|
blanchet@49990
|
820 |
thus "f a # map f l \<in> map f ` {l. set l \<le> A}" by auto
|
blanchet@49990
|
821 |
qed
|
blanchet@49990
|
822 |
thus "l' \<in> map f ` {l. set l \<le> A}" using * by auto
|
blanchet@49990
|
823 |
qed
|
blanchet@49990
|
824 |
|
blanchet@49990
|
825 |
lemma bij_betw_map_lists:
|
blanchet@49990
|
826 |
assumes "bij_betw f A B"
|
blanchet@49990
|
827 |
shows "bij_betw (map f) (lists A) (lists B)"
|
blanchet@49990
|
828 |
using assms unfolding bij_betw_def
|
blanchet@49990
|
829 |
by(auto simp add: inj_on_map_lists map_lists_surjective)
|
blanchet@49990
|
830 |
|
blanchet@49990
|
831 |
lemma card_of_lists_mono[simp]:
|
blanchet@49990
|
832 |
assumes "|A| \<le>o |B|"
|
blanchet@49990
|
833 |
shows "|lists A| \<le>o |lists B|"
|
blanchet@49990
|
834 |
proof-
|
blanchet@49990
|
835 |
obtain f where "inj_on f A \<and> f ` A \<le> B"
|
blanchet@49990
|
836 |
using assms card_of_ordLeq[of A B] by auto
|
blanchet@49990
|
837 |
hence "inj_on (map f) (lists A) \<and> (map f) ` (lists A) \<le> (lists B)"
|
blanchet@49990
|
838 |
by (auto simp add: inj_on_map_lists map_lists_mono)
|
blanchet@49990
|
839 |
thus ?thesis using card_of_ordLeq[of "lists A"] by metis
|
blanchet@49990
|
840 |
qed
|
blanchet@49990
|
841 |
|
blanchet@49990
|
842 |
lemma ordIso_lists_mono:
|
blanchet@49990
|
843 |
assumes "r \<le>o r'"
|
blanchet@49990
|
844 |
shows "|lists(Field r)| \<le>o |lists(Field r')|"
|
blanchet@49990
|
845 |
using assms card_of_mono2 card_of_lists_mono by blast
|
blanchet@49990
|
846 |
|
blanchet@49990
|
847 |
lemma card_of_lists_cong[simp]:
|
blanchet@49990
|
848 |
assumes "|A| =o |B|"
|
blanchet@49990
|
849 |
shows "|lists A| =o |lists B|"
|
blanchet@49990
|
850 |
proof-
|
blanchet@49990
|
851 |
obtain f where "bij_betw f A B"
|
blanchet@49990
|
852 |
using assms card_of_ordIso[of A B] by auto
|
blanchet@49990
|
853 |
hence "bij_betw (map f) (lists A) (lists B)"
|
blanchet@49990
|
854 |
by (auto simp add: bij_betw_map_lists)
|
blanchet@49990
|
855 |
thus ?thesis using card_of_ordIso[of "lists A"] by auto
|
blanchet@49990
|
856 |
qed
|
blanchet@49990
|
857 |
|
blanchet@55848
|
858 |
lemma card_of_lists_infinite[simp]:
|
traytel@55951
|
859 |
assumes "\<not>finite A"
|
blanchet@55848
|
860 |
shows "|lists A| =o |A|"
|
blanchet@55848
|
861 |
proof-
|
traytel@55951
|
862 |
have "|lists A| \<le>o |A|" unfolding lists_UNION_nlists
|
traytel@55951
|
863 |
by (rule card_of_UNION_ordLeq_infinite[OF assms _ ballI[OF card_of_nlists_infinite[OF assms]]])
|
traytel@55951
|
864 |
(metis infinite_iff_card_of_nat assms)
|
blanchet@55848
|
865 |
thus ?thesis using card_of_lists ordIso_iff_ordLeq by blast
|
blanchet@55848
|
866 |
qed
|
blanchet@55848
|
867 |
|
blanchet@55848
|
868 |
lemma Card_order_lists_infinite:
|
traytel@55951
|
869 |
assumes "Card_order r" and "\<not>finite(Field r)"
|
blanchet@55848
|
870 |
shows "|lists(Field r)| =o r"
|
blanchet@55848
|
871 |
using assms card_of_lists_infinite card_of_Field_ordIso ordIso_transitive by blast
|
blanchet@55848
|
872 |
|
blanchet@49990
|
873 |
lemma ordIso_lists_cong:
|
blanchet@49990
|
874 |
assumes "r =o r'"
|
blanchet@49990
|
875 |
shows "|lists(Field r)| =o |lists(Field r')|"
|
blanchet@49990
|
876 |
using assms card_of_cong card_of_lists_cong by blast
|
blanchet@49990
|
877 |
|
blanchet@49990
|
878 |
corollary lists_infinite_bij_betw:
|
traytel@55951
|
879 |
assumes "\<not>finite A"
|
blanchet@49990
|
880 |
shows "\<exists>f. bij_betw f (lists A) A"
|
blanchet@49990
|
881 |
using assms card_of_lists_infinite card_of_ordIso by blast
|
blanchet@49990
|
882 |
|
blanchet@49990
|
883 |
corollary lists_infinite_bij_betw_types:
|
traytel@55951
|
884 |
assumes "\<not>finite(UNIV :: 'a set)"
|
blanchet@49990
|
885 |
shows "\<exists>(f::'a list \<Rightarrow> 'a). bij f"
|
blanchet@49990
|
886 |
using assms assms lists_infinite_bij_betw[of "UNIV::'a set"]
|
blanchet@49990
|
887 |
using lists_UNIV by auto
|
blanchet@49990
|
888 |
|
blanchet@49990
|
889 |
|
blanchet@49990
|
890 |
subsection {* Cardinals versus the set-of-finite-sets operator *}
|
blanchet@49990
|
891 |
|
blanchet@49990
|
892 |
definition Fpow :: "'a set \<Rightarrow> 'a set set"
|
blanchet@49990
|
893 |
where "Fpow A \<equiv> {X. X \<le> A \<and> finite X}"
|
blanchet@49990
|
894 |
|
blanchet@49990
|
895 |
lemma Fpow_mono: "A \<le> B \<Longrightarrow> Fpow A \<le> Fpow B"
|
blanchet@49990
|
896 |
unfolding Fpow_def by auto
|
blanchet@49990
|
897 |
|
blanchet@49990
|
898 |
lemma empty_in_Fpow: "{} \<in> Fpow A"
|
blanchet@49990
|
899 |
unfolding Fpow_def by auto
|
blanchet@49990
|
900 |
|
blanchet@49990
|
901 |
lemma Fpow_not_empty: "Fpow A \<noteq> {}"
|
blanchet@49990
|
902 |
using empty_in_Fpow by blast
|
blanchet@49990
|
903 |
|
blanchet@49990
|
904 |
lemma Fpow_subset_Pow: "Fpow A \<le> Pow A"
|
blanchet@49990
|
905 |
unfolding Fpow_def by auto
|
blanchet@49990
|
906 |
|
blanchet@49990
|
907 |
lemma card_of_Fpow[simp]: "|A| \<le>o |Fpow A|"
|
blanchet@49990
|
908 |
proof-
|
blanchet@49990
|
909 |
let ?h = "\<lambda> a. {a}"
|
blanchet@49990
|
910 |
have "inj_on ?h A \<and> ?h ` A \<le> Fpow A"
|
blanchet@49990
|
911 |
unfolding inj_on_def Fpow_def by auto
|
blanchet@49990
|
912 |
thus ?thesis using card_of_ordLeq by metis
|
blanchet@49990
|
913 |
qed
|
blanchet@49990
|
914 |
|
blanchet@49990
|
915 |
lemma Card_order_Fpow: "Card_order r \<Longrightarrow> r \<le>o |Fpow(Field r) |"
|
blanchet@49990
|
916 |
using card_of_Fpow card_of_Field_ordIso ordIso_ordLeq_trans ordIso_symmetric by blast
|
blanchet@49990
|
917 |
|
blanchet@49990
|
918 |
lemma Fpow_Pow_finite: "Fpow A = Pow A Int {A. finite A}"
|
blanchet@49990
|
919 |
unfolding Fpow_def Pow_def by blast
|
blanchet@49990
|
920 |
|
blanchet@49990
|
921 |
lemma inj_on_image_Fpow:
|
blanchet@49990
|
922 |
assumes "inj_on f A"
|
blanchet@49990
|
923 |
shows "inj_on (image f) (Fpow A)"
|
blanchet@49990
|
924 |
using assms Fpow_subset_Pow[of A] subset_inj_on[of "image f" "Pow A"]
|
blanchet@49990
|
925 |
inj_on_image_Pow by blast
|
blanchet@49990
|
926 |
|
blanchet@49990
|
927 |
lemma image_Fpow_mono:
|
blanchet@49990
|
928 |
assumes "f ` A \<le> B"
|
blanchet@49990
|
929 |
shows "(image f) ` (Fpow A) \<le> Fpow B"
|
blanchet@49990
|
930 |
using assms by(unfold Fpow_def, auto)
|
blanchet@49990
|
931 |
|
blanchet@49990
|
932 |
lemma image_Fpow_surjective:
|
blanchet@49990
|
933 |
assumes "f ` A = B"
|
blanchet@49990
|
934 |
shows "(image f) ` (Fpow A) = Fpow B"
|
blanchet@49990
|
935 |
using assms proof(unfold Fpow_def, auto)
|
blanchet@49990
|
936 |
fix Y assume *: "Y \<le> f ` A" and **: "finite Y"
|
blanchet@49990
|
937 |
hence "\<forall>b \<in> Y. \<exists>a. a \<in> A \<and> f a = b" by auto
|
blanchet@49990
|
938 |
with bchoice[of Y "\<lambda>b a. a \<in> A \<and> f a = b"]
|
blanchet@49990
|
939 |
obtain g where 1: "\<forall>b \<in> Y. g b \<in> A \<and> f(g b) = b" by blast
|
blanchet@49990
|
940 |
obtain X where X_def: "X = g ` Y" by blast
|
blanchet@49990
|
941 |
have "f ` X = Y \<and> X \<le> A \<and> finite X"
|
blanchet@49990
|
942 |
by(unfold X_def, force simp add: ** 1)
|
blanchet@49990
|
943 |
thus "Y \<in> (image f) ` {X. X \<le> A \<and> finite X}" by auto
|
blanchet@49990
|
944 |
qed
|
blanchet@49990
|
945 |
|
blanchet@49990
|
946 |
lemma bij_betw_image_Fpow:
|
blanchet@49990
|
947 |
assumes "bij_betw f A B"
|
blanchet@49990
|
948 |
shows "bij_betw (image f) (Fpow A) (Fpow B)"
|
blanchet@49990
|
949 |
using assms unfolding bij_betw_def
|
blanchet@49990
|
950 |
by (auto simp add: inj_on_image_Fpow image_Fpow_surjective)
|
blanchet@49990
|
951 |
|
blanchet@49990
|
952 |
lemma card_of_Fpow_mono[simp]:
|
blanchet@49990
|
953 |
assumes "|A| \<le>o |B|"
|
blanchet@49990
|
954 |
shows "|Fpow A| \<le>o |Fpow B|"
|
blanchet@49990
|
955 |
proof-
|
blanchet@49990
|
956 |
obtain f where "inj_on f A \<and> f ` A \<le> B"
|
blanchet@49990
|
957 |
using assms card_of_ordLeq[of A B] by auto
|
blanchet@49990
|
958 |
hence "inj_on (image f) (Fpow A) \<and> (image f) ` (Fpow A) \<le> (Fpow B)"
|
blanchet@49990
|
959 |
by (auto simp add: inj_on_image_Fpow image_Fpow_mono)
|
blanchet@49990
|
960 |
thus ?thesis using card_of_ordLeq[of "Fpow A"] by auto
|
blanchet@49990
|
961 |
qed
|
blanchet@49990
|
962 |
|
blanchet@49990
|
963 |
lemma ordIso_Fpow_mono:
|
blanchet@49990
|
964 |
assumes "r \<le>o r'"
|
blanchet@49990
|
965 |
shows "|Fpow(Field r)| \<le>o |Fpow(Field r')|"
|
blanchet@49990
|
966 |
using assms card_of_mono2 card_of_Fpow_mono by blast
|
blanchet@49990
|
967 |
|
blanchet@49990
|
968 |
lemma card_of_Fpow_cong[simp]:
|
blanchet@49990
|
969 |
assumes "|A| =o |B|"
|
blanchet@49990
|
970 |
shows "|Fpow A| =o |Fpow B|"
|
blanchet@49990
|
971 |
proof-
|
blanchet@49990
|
972 |
obtain f where "bij_betw f A B"
|
blanchet@49990
|
973 |
using assms card_of_ordIso[of A B] by auto
|
blanchet@49990
|
974 |
hence "bij_betw (image f) (Fpow A) (Fpow B)"
|
blanchet@49990
|
975 |
by (auto simp add: bij_betw_image_Fpow)
|
blanchet@49990
|
976 |
thus ?thesis using card_of_ordIso[of "Fpow A"] by auto
|
blanchet@49990
|
977 |
qed
|
blanchet@49990
|
978 |
|
blanchet@49990
|
979 |
lemma ordIso_Fpow_cong:
|
blanchet@49990
|
980 |
assumes "r =o r'"
|
blanchet@49990
|
981 |
shows "|Fpow(Field r)| =o |Fpow(Field r')|"
|
blanchet@49990
|
982 |
using assms card_of_cong card_of_Fpow_cong by blast
|
blanchet@49990
|
983 |
|
blanchet@49990
|
984 |
lemma card_of_Fpow_lists: "|Fpow A| \<le>o |lists A|"
|
blanchet@49990
|
985 |
proof-
|
blanchet@49990
|
986 |
have "set ` (lists A) = Fpow A"
|
blanchet@49990
|
987 |
unfolding lists_def2 Fpow_def using finite_list finite_set by blast
|
blanchet@49990
|
988 |
thus ?thesis using card_of_ordLeq2[of "Fpow A"] Fpow_not_empty[of A] by blast
|
blanchet@49990
|
989 |
qed
|
blanchet@49990
|
990 |
|
blanchet@49990
|
991 |
lemma card_of_Fpow_infinite[simp]:
|
traytel@55951
|
992 |
assumes "\<not>finite A"
|
blanchet@49990
|
993 |
shows "|Fpow A| =o |A|"
|
blanchet@49990
|
994 |
using assms card_of_Fpow_lists card_of_lists_infinite card_of_Fpow
|
blanchet@49990
|
995 |
ordLeq_ordIso_trans ordIso_iff_ordLeq by blast
|
blanchet@49990
|
996 |
|
blanchet@49990
|
997 |
corollary Fpow_infinite_bij_betw:
|
traytel@55951
|
998 |
assumes "\<not>finite A"
|
blanchet@49990
|
999 |
shows "\<exists>f. bij_betw f (Fpow A) A"
|
blanchet@49990
|
1000 |
using assms card_of_Fpow_infinite card_of_ordIso by blast
|
blanchet@49990
|
1001 |
|
blanchet@49990
|
1002 |
|
blanchet@49990
|
1003 |
subsection {* The cardinal $\omega$ and the finite cardinals *}
|
blanchet@49990
|
1004 |
|
blanchet@49990
|
1005 |
subsubsection {* First as well-orders *}
|
blanchet@49990
|
1006 |
|
blanchet@49990
|
1007 |
lemma Field_natLess: "Field natLess = (UNIV::nat set)"
|
blanchet@49990
|
1008 |
by(unfold Field_def, auto)
|
blanchet@49990
|
1009 |
|
blanchet@55848
|
1010 |
lemma natLeq_well_order_on: "well_order_on UNIV natLeq"
|
blanchet@55848
|
1011 |
using natLeq_Well_order Field_natLeq by auto
|
blanchet@55848
|
1012 |
|
blanchet@55848
|
1013 |
lemma natLeq_wo_rel: "wo_rel natLeq"
|
blanchet@55848
|
1014 |
unfolding wo_rel_def using natLeq_Well_order .
|
blanchet@55848
|
1015 |
|
blanchet@49990
|
1016 |
lemma natLeq_ofilter_less: "ofilter natLeq {0 ..< n}"
|
blanchet@49990
|
1017 |
by(auto simp add: natLeq_wo_rel wo_rel.ofilter_def,
|
blanchet@55848
|
1018 |
simp add: Field_natLeq, unfold rel.under_def, auto)
|
blanchet@49990
|
1019 |
|
blanchet@49990
|
1020 |
lemma natLeq_ofilter_leq: "ofilter natLeq {0 .. n}"
|
blanchet@49990
|
1021 |
by(auto simp add: natLeq_wo_rel wo_rel.ofilter_def,
|
blanchet@55848
|
1022 |
simp add: Field_natLeq, unfold rel.under_def, auto)
|
blanchet@55848
|
1023 |
|
blanchet@55848
|
1024 |
lemma natLeq_UNIV_ofilter: "wo_rel.ofilter natLeq UNIV"
|
blanchet@55848
|
1025 |
using natLeq_wo_rel Field_natLeq wo_rel.Field_ofilter[of natLeq] by auto
|
blanchet@49990
|
1026 |
|
traytel@55954
|
1027 |
lemma closed_nat_set_iff:
|
traytel@55954
|
1028 |
assumes "\<forall>(m::nat) n. n \<in> A \<and> m \<le> n \<longrightarrow> m \<in> A"
|
traytel@55954
|
1029 |
shows "A = UNIV \<or> (\<exists>n. A = {0 ..< n})"
|
traytel@55954
|
1030 |
proof-
|
traytel@55954
|
1031 |
{assume "A \<noteq> UNIV" hence "\<exists>n. n \<notin> A" by blast
|
traytel@55954
|
1032 |
moreover obtain n where n_def: "n = (LEAST n. n \<notin> A)" by blast
|
traytel@55954
|
1033 |
ultimately have 1: "n \<notin> A \<and> (\<forall>m. m < n \<longrightarrow> m \<in> A)"
|
traytel@55954
|
1034 |
using LeastI_ex[of "\<lambda> n. n \<notin> A"] n_def Least_le[of "\<lambda> n. n \<notin> A"] by fastforce
|
traytel@55954
|
1035 |
have "A = {0 ..< n}"
|
traytel@55954
|
1036 |
proof(auto simp add: 1)
|
traytel@55954
|
1037 |
fix m assume *: "m \<in> A"
|
traytel@55954
|
1038 |
{assume "n \<le> m" with assms * have "n \<in> A" by blast
|
traytel@55954
|
1039 |
hence False using 1 by auto
|
traytel@55954
|
1040 |
}
|
traytel@55954
|
1041 |
thus "m < n" by fastforce
|
traytel@55954
|
1042 |
qed
|
traytel@55954
|
1043 |
hence "\<exists>n. A = {0 ..< n}" by blast
|
traytel@55954
|
1044 |
}
|
traytel@55954
|
1045 |
thus ?thesis by blast
|
traytel@55954
|
1046 |
qed
|
traytel@55954
|
1047 |
|
blanchet@49990
|
1048 |
lemma natLeq_ofilter_iff:
|
blanchet@49990
|
1049 |
"ofilter natLeq A = (A = UNIV \<or> (\<exists>n. A = {0 ..< n}))"
|
blanchet@49990
|
1050 |
proof(rule iffI)
|
blanchet@49990
|
1051 |
assume "ofilter natLeq A"
|
blanchet@49990
|
1052 |
hence "\<forall>m n. n \<in> A \<and> m \<le> n \<longrightarrow> m \<in> A"
|
blanchet@49990
|
1053 |
by(auto simp add: natLeq_wo_rel wo_rel.ofilter_def rel.under_def)
|
blanchet@49990
|
1054 |
thus "A = UNIV \<or> (\<exists>n. A = {0 ..< n})" using closed_nat_set_iff by blast
|
blanchet@49990
|
1055 |
next
|
blanchet@49990
|
1056 |
assume "A = UNIV \<or> (\<exists>n. A = {0 ..< n})"
|
blanchet@49990
|
1057 |
thus "ofilter natLeq A"
|
blanchet@49990
|
1058 |
by(auto simp add: natLeq_ofilter_less natLeq_UNIV_ofilter)
|
blanchet@49990
|
1059 |
qed
|
blanchet@49990
|
1060 |
|
blanchet@49990
|
1061 |
lemma natLeq_under_leq: "under natLeq n = {0 .. n}"
|
blanchet@49990
|
1062 |
unfolding rel.under_def by auto
|
blanchet@49990
|
1063 |
|
traytel@55954
|
1064 |
lemma natLeq_on_ofilter_less_eq:
|
traytel@55954
|
1065 |
"n \<le> m \<Longrightarrow> wo_rel.ofilter (natLeq_on m) {0 ..< n}"
|
traytel@55954
|
1066 |
apply (auto simp add: natLeq_on_wo_rel wo_rel.ofilter_def)
|
traytel@55954
|
1067 |
apply (simp add: Field_natLeq_on)
|
traytel@55954
|
1068 |
by (auto simp add: rel.under_def)
|
traytel@55954
|
1069 |
|
traytel@55954
|
1070 |
lemma natLeq_on_ofilter_iff:
|
traytel@55954
|
1071 |
"wo_rel.ofilter (natLeq_on m) A = (\<exists>n \<le> m. A = {0 ..< n})"
|
traytel@55954
|
1072 |
proof(rule iffI)
|
traytel@55954
|
1073 |
assume *: "wo_rel.ofilter (natLeq_on m) A"
|
traytel@55954
|
1074 |
hence 1: "A \<le> {0..<m}"
|
traytel@55954
|
1075 |
by (auto simp add: natLeq_on_wo_rel wo_rel.ofilter_def rel.under_def Field_natLeq_on)
|
traytel@55954
|
1076 |
hence "\<forall>n1 n2. n2 \<in> A \<and> n1 \<le> n2 \<longrightarrow> n1 \<in> A"
|
traytel@55954
|
1077 |
using * by(fastforce simp add: natLeq_on_wo_rel wo_rel.ofilter_def rel.under_def)
|
traytel@55954
|
1078 |
hence "A = UNIV \<or> (\<exists>n. A = {0 ..< n})" using closed_nat_set_iff by blast
|
traytel@55954
|
1079 |
thus "\<exists>n \<le> m. A = {0 ..< n}" using 1 atLeastLessThan_less_eq by blast
|
traytel@55954
|
1080 |
next
|
traytel@55954
|
1081 |
assume "(\<exists>n\<le>m. A = {0 ..< n})"
|
traytel@55954
|
1082 |
thus "wo_rel.ofilter (natLeq_on m) A" by (auto simp add: natLeq_on_ofilter_less_eq)
|
traytel@55954
|
1083 |
qed
|
traytel@55954
|
1084 |
|
blanchet@49990
|
1085 |
corollary natLeq_on_ofilter:
|
blanchet@49990
|
1086 |
"ofilter(natLeq_on n) {0 ..< n}"
|
blanchet@49990
|
1087 |
by (auto simp add: natLeq_on_ofilter_less_eq)
|
blanchet@49990
|
1088 |
|
blanchet@49990
|
1089 |
lemma natLeq_on_ofilter_less:
|
blanchet@49990
|
1090 |
"n < m \<Longrightarrow> ofilter (natLeq_on m) {0 .. n}"
|
blanchet@49990
|
1091 |
by(auto simp add: natLeq_on_wo_rel wo_rel.ofilter_def,
|
blanchet@49990
|
1092 |
simp add: Field_natLeq_on, unfold rel.under_def, auto)
|
blanchet@49990
|
1093 |
|
blanchet@49990
|
1094 |
lemma natLeq_on_ordLess_natLeq: "natLeq_on n <o natLeq"
|
traytel@55951
|
1095 |
using Field_natLeq Field_natLeq_on[of n]
|
blanchet@49990
|
1096 |
finite_ordLess_infinite[of "natLeq_on n" natLeq]
|
blanchet@49990
|
1097 |
natLeq_Well_order natLeq_on_Well_order[of n] by auto
|
blanchet@49990
|
1098 |
|
blanchet@49990
|
1099 |
lemma natLeq_on_injective:
|
blanchet@49990
|
1100 |
"natLeq_on m = natLeq_on n \<Longrightarrow> m = n"
|
blanchet@49990
|
1101 |
using Field_natLeq_on[of m] Field_natLeq_on[of n]
|
traytel@55954
|
1102 |
atLeastLessThan_injective[of m n, unfolded atLeastLessThan_def] by blast
|
blanchet@49990
|
1103 |
|
blanchet@49990
|
1104 |
lemma natLeq_on_injective_ordIso:
|
blanchet@49990
|
1105 |
"(natLeq_on m =o natLeq_on n) = (m = n)"
|
blanchet@49990
|
1106 |
proof(auto simp add: natLeq_on_Well_order ordIso_reflexive)
|
blanchet@49990
|
1107 |
assume "natLeq_on m =o natLeq_on n"
|
traytel@55954
|
1108 |
then obtain f where "bij_betw f {x. x<m} {x. x<n}"
|
blanchet@49990
|
1109 |
using Field_natLeq_on assms unfolding ordIso_def iso_def[abs_def] by auto
|
traytel@55954
|
1110 |
thus "m = n" using atLeastLessThan_injective2[of f m n]
|
traytel@55954
|
1111 |
unfolding atLeast_0 atLeastLessThan_def lessThan_def Int_UNIV_left by blast
|
blanchet@49990
|
1112 |
qed
|
blanchet@49990
|
1113 |
|
blanchet@49990
|
1114 |
|
blanchet@49990
|
1115 |
subsubsection {* Then as cardinals *}
|
blanchet@49990
|
1116 |
|
blanchet@49990
|
1117 |
lemma ordIso_natLeq_infinite1:
|
traytel@55951
|
1118 |
"|A| =o natLeq \<Longrightarrow> \<not>finite A"
|
blanchet@49990
|
1119 |
using ordIso_symmetric ordIso_imp_ordLeq infinite_iff_natLeq_ordLeq by blast
|
blanchet@49990
|
1120 |
|
blanchet@49990
|
1121 |
lemma ordIso_natLeq_infinite2:
|
traytel@55951
|
1122 |
"natLeq =o |A| \<Longrightarrow> \<not>finite A"
|
blanchet@49990
|
1123 |
using ordIso_imp_ordLeq infinite_iff_natLeq_ordLeq by blast
|
blanchet@49990
|
1124 |
|
traytel@55954
|
1125 |
|
traytel@55954
|
1126 |
lemma ordIso_natLeq_on_imp_finite:
|
traytel@55954
|
1127 |
"|A| =o natLeq_on n \<Longrightarrow> finite A"
|
traytel@55954
|
1128 |
unfolding ordIso_def iso_def[abs_def]
|
traytel@55954
|
1129 |
by (auto simp: Field_natLeq_on bij_betw_finite)
|
traytel@55954
|
1130 |
|
traytel@55954
|
1131 |
|
traytel@55954
|
1132 |
lemma natLeq_on_Card_order: "Card_order (natLeq_on n)"
|
traytel@55954
|
1133 |
proof(unfold card_order_on_def,
|
traytel@55954
|
1134 |
auto simp add: natLeq_on_Well_order, simp add: Field_natLeq_on)
|
traytel@55954
|
1135 |
fix r assume "well_order_on {x. x < n} r"
|
traytel@55954
|
1136 |
thus "natLeq_on n \<le>o r"
|
traytel@55954
|
1137 |
using finite_atLeastLessThan natLeq_on_well_order_on
|
traytel@55954
|
1138 |
finite_well_order_on_ordIso ordIso_iff_ordLeq by blast
|
traytel@55954
|
1139 |
qed
|
traytel@55954
|
1140 |
|
traytel@55954
|
1141 |
|
traytel@55954
|
1142 |
corollary card_of_Field_natLeq_on:
|
traytel@55954
|
1143 |
"|Field (natLeq_on n)| =o natLeq_on n"
|
traytel@55954
|
1144 |
using Field_natLeq_on natLeq_on_Card_order
|
traytel@55954
|
1145 |
Card_order_iff_ordIso_card_of[of "natLeq_on n"]
|
traytel@55954
|
1146 |
ordIso_symmetric[of "natLeq_on n"] by blast
|
traytel@55954
|
1147 |
|
traytel@55954
|
1148 |
|
traytel@55954
|
1149 |
corollary card_of_less:
|
traytel@55954
|
1150 |
"|{0 ..< n}| =o natLeq_on n"
|
traytel@55954
|
1151 |
using Field_natLeq_on card_of_Field_natLeq_on
|
traytel@55954
|
1152 |
unfolding atLeast_0 atLeastLessThan_def lessThan_def Int_UNIV_left by auto
|
traytel@55954
|
1153 |
|
traytel@55954
|
1154 |
|
traytel@55954
|
1155 |
lemma natLeq_on_ordLeq_less_eq:
|
traytel@55954
|
1156 |
"((natLeq_on m) \<le>o (natLeq_on n)) = (m \<le> n)"
|
traytel@55954
|
1157 |
proof
|
traytel@55954
|
1158 |
assume "natLeq_on m \<le>o natLeq_on n"
|
traytel@55954
|
1159 |
then obtain f where "inj_on f {x. x < m} \<and> f ` {x. x < m} \<le> {x. x < n}"
|
traytel@55954
|
1160 |
unfolding ordLeq_def using
|
traytel@55954
|
1161 |
embed_inj_on[OF natLeq_on_Well_order[of m], of "natLeq_on n", unfolded Field_natLeq_on]
|
traytel@55954
|
1162 |
embed_Field[OF natLeq_on_Well_order[of m], of "natLeq_on n", unfolded Field_natLeq_on] by blast
|
traytel@55954
|
1163 |
thus "m \<le> n" using atLeastLessThan_less_eq2
|
traytel@55954
|
1164 |
unfolding atLeast_0 atLeastLessThan_def lessThan_def Int_UNIV_left by blast
|
traytel@55954
|
1165 |
next
|
traytel@55954
|
1166 |
assume "m \<le> n"
|
traytel@55954
|
1167 |
hence "inj_on id {0..<m} \<and> id ` {0..<m} \<le> {0..<n}" unfolding inj_on_def by auto
|
traytel@55954
|
1168 |
hence "|{0..<m}| \<le>o |{0..<n}|" using card_of_ordLeq by blast
|
traytel@55954
|
1169 |
thus "natLeq_on m \<le>o natLeq_on n"
|
traytel@55954
|
1170 |
using card_of_less ordIso_ordLeq_trans ordLeq_ordIso_trans ordIso_symmetric by blast
|
traytel@55954
|
1171 |
qed
|
traytel@55954
|
1172 |
|
traytel@55954
|
1173 |
|
traytel@55954
|
1174 |
lemma natLeq_on_ordLeq_less:
|
traytel@55954
|
1175 |
"((natLeq_on m) <o (natLeq_on n)) = (m < n)"
|
traytel@55954
|
1176 |
using not_ordLeq_iff_ordLess[of "natLeq_on m" "natLeq_on n"]
|
traytel@55954
|
1177 |
natLeq_on_Well_order natLeq_on_ordLeq_less_eq
|
traytel@55954
|
1178 |
by fastforce
|
traytel@55954
|
1179 |
|
blanchet@49990
|
1180 |
lemma ordLeq_natLeq_on_imp_finite:
|
blanchet@49990
|
1181 |
assumes "|A| \<le>o natLeq_on n"
|
blanchet@49990
|
1182 |
shows "finite A"
|
blanchet@49990
|
1183 |
proof-
|
blanchet@49990
|
1184 |
have "|A| \<le>o |{0 ..< n}|"
|
blanchet@49990
|
1185 |
using assms card_of_less ordIso_symmetric ordLeq_ordIso_trans by blast
|
blanchet@49990
|
1186 |
thus ?thesis by (auto simp add: card_of_ordLeq_finite)
|
blanchet@49990
|
1187 |
qed
|
blanchet@49990
|
1188 |
|
blanchet@49990
|
1189 |
|
blanchet@55848
|
1190 |
subsubsection {* "Backward compatibility" with the numeric cardinal operator for finite sets *}
|
blanchet@49990
|
1191 |
|
traytel@55954
|
1192 |
lemma finite_card_of_iff_card2:
|
traytel@55954
|
1193 |
assumes FIN: "finite A" and FIN': "finite B"
|
traytel@55954
|
1194 |
shows "( |A| \<le>o |B| ) = (card A \<le> card B)"
|
traytel@55954
|
1195 |
using assms card_of_ordLeq[of A B] inj_on_iff_card_le[of A B] by blast
|
traytel@55954
|
1196 |
|
traytel@55954
|
1197 |
lemma finite_imp_card_of_natLeq_on:
|
traytel@55954
|
1198 |
assumes "finite A"
|
traytel@55954
|
1199 |
shows "|A| =o natLeq_on (card A)"
|
traytel@55954
|
1200 |
proof-
|
traytel@55954
|
1201 |
obtain h where "bij_betw h A {0 ..< card A}"
|
traytel@55954
|
1202 |
using assms ex_bij_betw_finite_nat by blast
|
traytel@55954
|
1203 |
thus ?thesis using card_of_ordIso card_of_less ordIso_equivalence by blast
|
traytel@55954
|
1204 |
qed
|
traytel@55954
|
1205 |
|
traytel@55954
|
1206 |
lemma finite_iff_card_of_natLeq_on:
|
traytel@55954
|
1207 |
"finite A = (\<exists>n. |A| =o natLeq_on n)"
|
traytel@55954
|
1208 |
using finite_imp_card_of_natLeq_on[of A]
|
traytel@55954
|
1209 |
by(auto simp add: ordIso_natLeq_on_imp_finite)
|
traytel@55954
|
1210 |
|
traytel@55954
|
1211 |
|
blanchet@49990
|
1212 |
lemma finite_card_of_iff_card:
|
blanchet@49990
|
1213 |
assumes FIN: "finite A" and FIN': "finite B"
|
blanchet@49990
|
1214 |
shows "( |A| =o |B| ) = (card A = card B)"
|
blanchet@49990
|
1215 |
using assms card_of_ordIso[of A B] bij_betw_iff_card[of A B] by blast
|
blanchet@49990
|
1216 |
|
blanchet@49990
|
1217 |
lemma finite_card_of_iff_card3:
|
blanchet@49990
|
1218 |
assumes FIN: "finite A" and FIN': "finite B"
|
blanchet@49990
|
1219 |
shows "( |A| <o |B| ) = (card A < card B)"
|
blanchet@49990
|
1220 |
proof-
|
blanchet@49990
|
1221 |
have "( |A| <o |B| ) = (~ ( |B| \<le>o |A| ))" by simp
|
blanchet@49990
|
1222 |
also have "... = (~ (card B \<le> card A))"
|
blanchet@49990
|
1223 |
using assms by(simp add: finite_card_of_iff_card2)
|
blanchet@49990
|
1224 |
also have "... = (card A < card B)" by auto
|
blanchet@49990
|
1225 |
finally show ?thesis .
|
blanchet@49990
|
1226 |
qed
|
blanchet@49990
|
1227 |
|
blanchet@49990
|
1228 |
lemma card_Field_natLeq_on:
|
blanchet@49990
|
1229 |
"card(Field(natLeq_on n)) = n"
|
blanchet@49990
|
1230 |
using Field_natLeq_on card_atLeastLessThan by auto
|
blanchet@49990
|
1231 |
|
blanchet@49990
|
1232 |
|
blanchet@49990
|
1233 |
subsection {* The successor of a cardinal *}
|
blanchet@49990
|
1234 |
|
blanchet@49990
|
1235 |
lemma embed_implies_ordIso_Restr:
|
blanchet@49990
|
1236 |
assumes WELL: "Well_order r" and WELL': "Well_order r'" and EMB: "embed r' r f"
|
blanchet@49990
|
1237 |
shows "r' =o Restr r (f ` (Field r'))"
|
blanchet@49990
|
1238 |
using assms embed_implies_iso_Restr Well_order_Restr unfolding ordIso_def by blast
|
blanchet@49990
|
1239 |
|
blanchet@49990
|
1240 |
lemma cardSuc_Well_order[simp]:
|
blanchet@49990
|
1241 |
"Card_order r \<Longrightarrow> Well_order(cardSuc r)"
|
blanchet@49990
|
1242 |
using cardSuc_Card_order unfolding card_order_on_def by blast
|
blanchet@49990
|
1243 |
|
blanchet@49990
|
1244 |
lemma Field_cardSuc_not_empty:
|
blanchet@49990
|
1245 |
assumes "Card_order r"
|
blanchet@49990
|
1246 |
shows "Field (cardSuc r) \<noteq> {}"
|
blanchet@49990
|
1247 |
proof
|
blanchet@49990
|
1248 |
assume "Field(cardSuc r) = {}"
|
blanchet@49990
|
1249 |
hence "|Field(cardSuc r)| \<le>o r" using assms Card_order_empty[of r] by auto
|
blanchet@49990
|
1250 |
hence "cardSuc r \<le>o r" using assms card_of_Field_ordIso
|
blanchet@49990
|
1251 |
cardSuc_Card_order ordIso_symmetric ordIso_ordLeq_trans by blast
|
blanchet@49990
|
1252 |
thus False using cardSuc_greater not_ordLess_ordLeq assms by blast
|
blanchet@49990
|
1253 |
qed
|
blanchet@49990
|
1254 |
|
blanchet@49990
|
1255 |
lemma cardSuc_mono_ordLess[simp]:
|
blanchet@49990
|
1256 |
assumes CARD: "Card_order r" and CARD': "Card_order r'"
|
blanchet@49990
|
1257 |
shows "(cardSuc r <o cardSuc r') = (r <o r')"
|
blanchet@49990
|
1258 |
proof-
|
blanchet@49990
|
1259 |
have 0: "Well_order r \<and> Well_order r' \<and> Well_order(cardSuc r) \<and> Well_order(cardSuc r')"
|
blanchet@49990
|
1260 |
using assms by auto
|
blanchet@49990
|
1261 |
thus ?thesis
|
blanchet@49990
|
1262 |
using not_ordLeq_iff_ordLess not_ordLeq_iff_ordLess[of r r']
|
blanchet@49990
|
1263 |
using cardSuc_mono_ordLeq[of r' r] assms by blast
|
blanchet@49990
|
1264 |
qed
|
blanchet@49990
|
1265 |
|
traytel@55954
|
1266 |
lemma cardSuc_natLeq_on_Suc:
|
traytel@55954
|
1267 |
"cardSuc(natLeq_on n) =o natLeq_on(Suc n)"
|
traytel@55954
|
1268 |
proof-
|
traytel@55954
|
1269 |
obtain r r' p where r_def: "r = natLeq_on n" and
|
traytel@55954
|
1270 |
r'_def: "r' = cardSuc(natLeq_on n)" and
|
traytel@55954
|
1271 |
p_def: "p = natLeq_on(Suc n)" by blast
|
traytel@55954
|
1272 |
(* Preliminary facts: *)
|
traytel@55954
|
1273 |
have CARD: "Card_order r \<and> Card_order r' \<and> Card_order p" unfolding r_def r'_def p_def
|
traytel@55954
|
1274 |
using cardSuc_ordLess_ordLeq natLeq_on_Card_order cardSuc_Card_order by blast
|
traytel@55954
|
1275 |
hence WELL: "Well_order r \<and> Well_order r' \<and> Well_order p"
|
traytel@55954
|
1276 |
unfolding card_order_on_def by force
|
traytel@55954
|
1277 |
have FIELD: "Field r = {0..<n} \<and> Field p = {0..<(Suc n)}"
|
traytel@55954
|
1278 |
unfolding r_def p_def Field_natLeq_on atLeast_0 atLeastLessThan_def lessThan_def by simp
|
traytel@55954
|
1279 |
hence FIN: "finite (Field r)" by force
|
traytel@55954
|
1280 |
have "r <o r'" using CARD unfolding r_def r'_def using cardSuc_greater by blast
|
traytel@55954
|
1281 |
hence "|Field r| <o r'" using CARD card_of_Field_ordIso ordIso_ordLess_trans by blast
|
traytel@55954
|
1282 |
hence LESS: "|Field r| <o |Field r'|"
|
traytel@55954
|
1283 |
using CARD card_of_Field_ordIso ordLess_ordIso_trans ordIso_symmetric by blast
|
traytel@55954
|
1284 |
(* Main proof: *)
|
traytel@55954
|
1285 |
have "r' \<le>o p" using CARD unfolding r_def r'_def p_def
|
traytel@55954
|
1286 |
using natLeq_on_ordLeq_less cardSuc_ordLess_ordLeq by blast
|
traytel@55954
|
1287 |
moreover have "p \<le>o r'"
|
traytel@55954
|
1288 |
proof-
|
traytel@55954
|
1289 |
{assume "r' <o p"
|
traytel@55954
|
1290 |
then obtain f where 0: "embedS r' p f" unfolding ordLess_def by force
|
traytel@55954
|
1291 |
let ?q = "Restr p (f ` Field r')"
|
traytel@55954
|
1292 |
have 1: "embed r' p f" using 0 unfolding embedS_def by force
|
traytel@55954
|
1293 |
hence 2: "f ` Field r' < {0..<(Suc n)}"
|
traytel@55954
|
1294 |
using WELL FIELD 0 by (auto simp add: embedS_iff)
|
traytel@55954
|
1295 |
have "wo_rel.ofilter p (f ` Field r')" using embed_Field_ofilter 1 WELL by blast
|
traytel@55954
|
1296 |
then obtain m where "m \<le> Suc n" and 3: "f ` (Field r') = {0..<m}"
|
traytel@55954
|
1297 |
unfolding p_def by (auto simp add: natLeq_on_ofilter_iff)
|
traytel@55954
|
1298 |
hence 4: "m \<le> n" using 2 by force
|
traytel@55954
|
1299 |
(* *)
|
traytel@55954
|
1300 |
have "bij_betw f (Field r') (f ` (Field r'))"
|
traytel@55954
|
1301 |
using 1 WELL embed_inj_on unfolding bij_betw_def by force
|
traytel@55954
|
1302 |
moreover have "finite(f ` (Field r'))" using 3 finite_atLeastLessThan[of 0 m] by force
|
traytel@55954
|
1303 |
ultimately have 5: "finite (Field r') \<and> card(Field r') = card (f ` (Field r'))"
|
traytel@55954
|
1304 |
using bij_betw_same_card bij_betw_finite by metis
|
traytel@55954
|
1305 |
hence "card(Field r') \<le> card(Field r)" using 3 4 FIELD by force
|
traytel@55954
|
1306 |
hence "|Field r'| \<le>o |Field r|" using FIN 5 finite_card_of_iff_card2 by blast
|
traytel@55954
|
1307 |
hence False using LESS not_ordLess_ordLeq by auto
|
traytel@55954
|
1308 |
}
|
traytel@55954
|
1309 |
thus ?thesis using WELL CARD by fastforce
|
traytel@55954
|
1310 |
qed
|
traytel@55954
|
1311 |
ultimately show ?thesis using ordIso_iff_ordLeq unfolding r'_def p_def by blast
|
traytel@55954
|
1312 |
qed
|
traytel@55954
|
1313 |
|
blanchet@49990
|
1314 |
lemma card_of_Plus_ordLeq_infinite[simp]:
|
traytel@55951
|
1315 |
assumes C: "\<not>finite C" and A: "|A| \<le>o |C|" and B: "|B| \<le>o |C|"
|
blanchet@49990
|
1316 |
shows "|A <+> B| \<le>o |C|"
|
blanchet@49990
|
1317 |
proof-
|
blanchet@49990
|
1318 |
let ?r = "cardSuc |C|"
|
traytel@55951
|
1319 |
have "Card_order ?r \<and> \<not>finite (Field ?r)" using assms by simp
|
blanchet@49990
|
1320 |
moreover have "|A| <o ?r" and "|B| <o ?r" using A B by auto
|
blanchet@49990
|
1321 |
ultimately have "|A <+> B| <o ?r"
|
blanchet@49990
|
1322 |
using card_of_Plus_ordLess_infinite_Field by blast
|
blanchet@49990
|
1323 |
thus ?thesis using C by simp
|
blanchet@49990
|
1324 |
qed
|
blanchet@49990
|
1325 |
|
blanchet@49990
|
1326 |
lemma card_of_Un_ordLeq_infinite[simp]:
|
traytel@55951
|
1327 |
assumes C: "\<not>finite C" and A: "|A| \<le>o |C|" and B: "|B| \<le>o |C|"
|
blanchet@49990
|
1328 |
shows "|A Un B| \<le>o |C|"
|
blanchet@49990
|
1329 |
using assms card_of_Plus_ordLeq_infinite card_of_Un_Plus_ordLeq
|
blanchet@49990
|
1330 |
ordLeq_transitive by metis
|
blanchet@49990
|
1331 |
|
blanchet@49990
|
1332 |
|
blanchet@49990
|
1333 |
subsection {* Others *}
|
blanchet@49990
|
1334 |
|
blanchet@49990
|
1335 |
lemma under_mono[simp]:
|
blanchet@49990
|
1336 |
assumes "Well_order r" and "(i,j) \<in> r"
|
blanchet@49990
|
1337 |
shows "under r i \<subseteq> under r j"
|
blanchet@49990
|
1338 |
using assms unfolding rel.under_def order_on_defs
|
blanchet@49990
|
1339 |
trans_def by blast
|
blanchet@49990
|
1340 |
|
blanchet@49990
|
1341 |
lemma underS_under:
|
blanchet@49990
|
1342 |
assumes "i \<in> Field r"
|
blanchet@49990
|
1343 |
shows "underS r i = under r i - {i}"
|
blanchet@49990
|
1344 |
using assms unfolding rel.underS_def rel.under_def by auto
|
blanchet@49990
|
1345 |
|
blanchet@49990
|
1346 |
lemma relChain_under:
|
blanchet@49990
|
1347 |
assumes "Well_order r"
|
blanchet@49990
|
1348 |
shows "relChain r (\<lambda> i. under r i)"
|
blanchet@49990
|
1349 |
using assms unfolding relChain_def by auto
|
blanchet@49990
|
1350 |
|
blanchet@55848
|
1351 |
lemma card_of_infinite_diff_finite:
|
traytel@55951
|
1352 |
assumes "\<not>finite A" and "finite B"
|
blanchet@55848
|
1353 |
shows "|A - B| =o |A|"
|
blanchet@55848
|
1354 |
by (metis assms card_of_Un_diff_infinite finite_ordLess_infinite2)
|
blanchet@55848
|
1355 |
|
blanchet@49990
|
1356 |
lemma infinite_card_of_diff_singl:
|
traytel@55951
|
1357 |
assumes "\<not>finite A"
|
blanchet@49990
|
1358 |
shows "|A - {a}| =o |A|"
|
traytel@53681
|
1359 |
by (metis assms card_of_infinite_diff_finite finite.emptyI finite_insert)
|
blanchet@49990
|
1360 |
|
blanchet@49990
|
1361 |
lemma card_of_vimage:
|
blanchet@49990
|
1362 |
assumes "B \<subseteq> range f"
|
blanchet@49990
|
1363 |
shows "|B| \<le>o |f -` B|"
|
blanchet@49990
|
1364 |
apply(rule surj_imp_ordLeq[of _ f])
|
blanchet@49990
|
1365 |
using assms by (metis Int_absorb2 image_vimage_eq order_refl)
|
blanchet@49990
|
1366 |
|
blanchet@49990
|
1367 |
lemma surj_card_of_vimage:
|
blanchet@49990
|
1368 |
assumes "surj f"
|
blanchet@49990
|
1369 |
shows "|B| \<le>o |f -` B|"
|
blanchet@49990
|
1370 |
by (metis assms card_of_vimage subset_UNIV)
|
blanchet@49990
|
1371 |
|
blanchet@49990
|
1372 |
(* bounded powerset *)
|
blanchet@49990
|
1373 |
definition Bpow where
|
blanchet@49990
|
1374 |
"Bpow r A \<equiv> {X . X \<subseteq> A \<and> |X| \<le>o r}"
|
blanchet@49990
|
1375 |
|
blanchet@49990
|
1376 |
lemma Bpow_empty[simp]:
|
blanchet@49990
|
1377 |
assumes "Card_order r"
|
blanchet@49990
|
1378 |
shows "Bpow r {} = {{}}"
|
blanchet@49990
|
1379 |
using assms unfolding Bpow_def by auto
|
blanchet@49990
|
1380 |
|
blanchet@49990
|
1381 |
lemma singl_in_Bpow:
|
blanchet@49990
|
1382 |
assumes rc: "Card_order r"
|
blanchet@49990
|
1383 |
and r: "Field r \<noteq> {}" and a: "a \<in> A"
|
blanchet@49990
|
1384 |
shows "{a} \<in> Bpow r A"
|
blanchet@49990
|
1385 |
proof-
|
blanchet@49990
|
1386 |
have "|{a}| \<le>o r" using r rc by auto
|
blanchet@49990
|
1387 |
thus ?thesis unfolding Bpow_def using a by auto
|
blanchet@49990
|
1388 |
qed
|
blanchet@49990
|
1389 |
|
blanchet@49990
|
1390 |
lemma ordLeq_card_Bpow:
|
blanchet@49990
|
1391 |
assumes rc: "Card_order r" and r: "Field r \<noteq> {}"
|
blanchet@49990
|
1392 |
shows "|A| \<le>o |Bpow r A|"
|
blanchet@49990
|
1393 |
proof-
|
blanchet@49990
|
1394 |
have "inj_on (\<lambda> a. {a}) A" unfolding inj_on_def by auto
|
blanchet@49990
|
1395 |
moreover have "(\<lambda> a. {a}) ` A \<subseteq> Bpow r A"
|
blanchet@49990
|
1396 |
using singl_in_Bpow[OF assms] by auto
|
blanchet@49990
|
1397 |
ultimately show ?thesis unfolding card_of_ordLeq[symmetric] by blast
|
blanchet@49990
|
1398 |
qed
|
blanchet@49990
|
1399 |
|
blanchet@49990
|
1400 |
lemma infinite_Bpow:
|
blanchet@49990
|
1401 |
assumes rc: "Card_order r" and r: "Field r \<noteq> {}"
|
traytel@55951
|
1402 |
and A: "\<not>finite A"
|
traytel@55951
|
1403 |
shows "\<not>finite (Bpow r A)"
|
blanchet@49990
|
1404 |
using ordLeq_card_Bpow[OF rc r]
|
blanchet@49990
|
1405 |
by (metis A card_of_ordLeq_infinite)
|
blanchet@49990
|
1406 |
|
traytel@53682
|
1407 |
definition Func_option where
|
traytel@53682
|
1408 |
"Func_option A B \<equiv>
|
traytel@53682
|
1409 |
{f. (\<forall> a. f a \<noteq> None \<longleftrightarrow> a \<in> A) \<and> (\<forall> a \<in> A. case f a of Some b \<Rightarrow> b \<in> B |None \<Rightarrow> True)}"
|
traytel@53682
|
1410 |
|
traytel@53682
|
1411 |
lemma card_of_Func_option_Func:
|
traytel@53682
|
1412 |
"|Func_option A B| =o |Func A B|"
|
traytel@53682
|
1413 |
proof (rule ordIso_symmetric, unfold card_of_ordIso[symmetric], intro exI)
|
traytel@53682
|
1414 |
let ?F = "\<lambda> f a. if a \<in> A then Some (f a) else None"
|
traytel@53682
|
1415 |
show "bij_betw ?F (Func A B) (Func_option A B)"
|
traytel@53682
|
1416 |
unfolding bij_betw_def unfolding inj_on_def proof(intro conjI ballI impI)
|
traytel@53682
|
1417 |
fix f g assume f: "f \<in> Func A B" and g: "g \<in> Func A B" and eq: "?F f = ?F g"
|
traytel@53682
|
1418 |
show "f = g"
|
traytel@53682
|
1419 |
proof(rule ext)
|
traytel@53682
|
1420 |
fix a
|
traytel@53682
|
1421 |
show "f a = g a"
|
traytel@53682
|
1422 |
proof(cases "a \<in> A")
|
traytel@53682
|
1423 |
case True
|
traytel@53682
|
1424 |
have "Some (f a) = ?F f a" using True by auto
|
traytel@53682
|
1425 |
also have "... = ?F g a" using eq unfolding fun_eq_iff by(rule allE)
|
traytel@53682
|
1426 |
also have "... = Some (g a)" using True by auto
|
traytel@53682
|
1427 |
finally have "Some (f a) = Some (g a)" .
|
traytel@53682
|
1428 |
thus ?thesis by simp
|
traytel@53682
|
1429 |
qed(insert f g, unfold Func_def, auto)
|
traytel@53682
|
1430 |
qed
|
traytel@53682
|
1431 |
next
|
traytel@53682
|
1432 |
show "?F ` Func A B = Func_option A B"
|
traytel@53682
|
1433 |
proof safe
|
traytel@53682
|
1434 |
fix f assume f: "f \<in> Func_option A B"
|
traytel@53682
|
1435 |
def g \<equiv> "\<lambda> a. case f a of Some b \<Rightarrow> b | None \<Rightarrow> undefined"
|
traytel@53682
|
1436 |
have "g \<in> Func A B"
|
traytel@53682
|
1437 |
using f unfolding g_def Func_def Func_option_def by force+
|
traytel@53682
|
1438 |
moreover have "f = ?F g"
|
traytel@53682
|
1439 |
proof(rule ext)
|
traytel@53682
|
1440 |
fix a show "f a = ?F g a"
|
traytel@53682
|
1441 |
using f unfolding Func_option_def g_def by (cases "a \<in> A") force+
|
traytel@53682
|
1442 |
qed
|
traytel@53682
|
1443 |
ultimately show "f \<in> ?F ` (Func A B)" by blast
|
traytel@53682
|
1444 |
qed(unfold Func_def Func_option_def, auto)
|
traytel@53682
|
1445 |
qed
|
traytel@53682
|
1446 |
qed
|
traytel@53682
|
1447 |
|
traytel@53682
|
1448 |
(* partial-function space: *)
|
traytel@53682
|
1449 |
definition Pfunc where
|
traytel@53682
|
1450 |
"Pfunc A B \<equiv>
|
traytel@53682
|
1451 |
{f. (\<forall>a. f a \<noteq> None \<longrightarrow> a \<in> A) \<and>
|
traytel@53682
|
1452 |
(\<forall>a. case f a of None \<Rightarrow> True | Some b \<Rightarrow> b \<in> B)}"
|
traytel@53682
|
1453 |
|
traytel@53682
|
1454 |
lemma Func_Pfunc:
|
traytel@53682
|
1455 |
"Func_option A B \<subseteq> Pfunc A B"
|
traytel@53682
|
1456 |
unfolding Func_option_def Pfunc_def by auto
|
traytel@53682
|
1457 |
|
traytel@53682
|
1458 |
lemma Pfunc_Func_option:
|
traytel@53682
|
1459 |
"Pfunc A B = (\<Union> A' \<in> Pow A. Func_option A' B)"
|
traytel@53682
|
1460 |
proof safe
|
traytel@53682
|
1461 |
fix f assume f: "f \<in> Pfunc A B"
|
traytel@53682
|
1462 |
show "f \<in> (\<Union>A'\<in>Pow A. Func_option A' B)"
|
traytel@53682
|
1463 |
proof (intro UN_I)
|
traytel@53682
|
1464 |
let ?A' = "{a. f a \<noteq> None}"
|
traytel@53682
|
1465 |
show "?A' \<in> Pow A" using f unfolding Pow_def Pfunc_def by auto
|
traytel@53682
|
1466 |
show "f \<in> Func_option ?A' B" using f unfolding Func_option_def Pfunc_def by auto
|
traytel@53682
|
1467 |
qed
|
traytel@53682
|
1468 |
next
|
traytel@53682
|
1469 |
fix f A' assume "f \<in> Func_option A' B" and "A' \<subseteq> A"
|
traytel@53682
|
1470 |
thus "f \<in> Pfunc A B" unfolding Func_option_def Pfunc_def by auto
|
traytel@53682
|
1471 |
qed
|
traytel@53682
|
1472 |
|
blanchet@55848
|
1473 |
lemma card_of_Func_mono:
|
blanchet@55848
|
1474 |
fixes A1 A2 :: "'a set" and B :: "'b set"
|
blanchet@55848
|
1475 |
assumes A12: "A1 \<subseteq> A2" and B: "B \<noteq> {}"
|
blanchet@55848
|
1476 |
shows "|Func A1 B| \<le>o |Func A2 B|"
|
blanchet@55848
|
1477 |
proof-
|
blanchet@55848
|
1478 |
obtain bb where bb: "bb \<in> B" using B by auto
|
blanchet@55848
|
1479 |
def F \<equiv> "\<lambda> (f1::'a \<Rightarrow> 'b) a. if a \<in> A2 then (if a \<in> A1 then f1 a else bb)
|
blanchet@55848
|
1480 |
else undefined"
|
blanchet@55848
|
1481 |
show ?thesis unfolding card_of_ordLeq[symmetric] proof(intro exI[of _ F] conjI)
|
blanchet@55848
|
1482 |
show "inj_on F (Func A1 B)" unfolding inj_on_def proof safe
|
blanchet@55848
|
1483 |
fix f g assume f: "f \<in> Func A1 B" and g: "g \<in> Func A1 B" and eq: "F f = F g"
|
blanchet@55848
|
1484 |
show "f = g"
|
blanchet@55848
|
1485 |
proof(rule ext)
|
blanchet@55848
|
1486 |
fix a show "f a = g a"
|
blanchet@55848
|
1487 |
proof(cases "a \<in> A1")
|
blanchet@55848
|
1488 |
case True
|
blanchet@55848
|
1489 |
thus ?thesis using eq A12 unfolding F_def fun_eq_iff
|
blanchet@55848
|
1490 |
by (elim allE[of _ a]) auto
|
blanchet@55848
|
1491 |
qed(insert f g, unfold Func_def, fastforce)
|
blanchet@55848
|
1492 |
qed
|
blanchet@55848
|
1493 |
qed
|
blanchet@55848
|
1494 |
qed(insert bb, unfold Func_def F_def, force)
|
blanchet@55848
|
1495 |
qed
|
blanchet@55848
|
1496 |
|
traytel@53682
|
1497 |
lemma card_of_Func_option_mono:
|
traytel@53682
|
1498 |
fixes A1 A2 :: "'a set" and B :: "'b set"
|
traytel@53682
|
1499 |
assumes A12: "A1 \<subseteq> A2" and B: "B \<noteq> {}"
|
traytel@53682
|
1500 |
shows "|Func_option A1 B| \<le>o |Func_option A2 B|"
|
traytel@53682
|
1501 |
by (metis card_of_Func_mono[OF A12 B] card_of_Func_option_Func
|
traytel@53682
|
1502 |
ordIso_ordLeq_trans ordLeq_ordIso_trans ordIso_symmetric)
|
traytel@53682
|
1503 |
|
traytel@53682
|
1504 |
lemma card_of_Pfunc_Pow_Func_option:
|
traytel@53682
|
1505 |
assumes "B \<noteq> {}"
|
traytel@53682
|
1506 |
shows "|Pfunc A B| \<le>o |Pow A <*> Func_option A B|"
|
traytel@53682
|
1507 |
proof-
|
traytel@53682
|
1508 |
have "|Pfunc A B| =o |\<Union> A' \<in> Pow A. Func_option A' B|" (is "_ =o ?K")
|
traytel@53682
|
1509 |
unfolding Pfunc_Func_option by(rule card_of_refl)
|
traytel@53682
|
1510 |
also have "?K \<le>o |Sigma (Pow A) (\<lambda> A'. Func_option A' B)|" using card_of_UNION_Sigma .
|
traytel@53682
|
1511 |
also have "|Sigma (Pow A) (\<lambda> A'. Func_option A' B)| \<le>o |Pow A <*> Func_option A B|"
|
traytel@53682
|
1512 |
apply(rule card_of_Sigma_mono1) using card_of_Func_option_mono[OF _ assms] by auto
|
traytel@53682
|
1513 |
finally show ?thesis .
|
traytel@53682
|
1514 |
qed
|
traytel@53682
|
1515 |
|
blanchet@49990
|
1516 |
lemma Bpow_ordLeq_Func_Field:
|
traytel@55951
|
1517 |
assumes rc: "Card_order r" and r: "Field r \<noteq> {}" and A: "\<not>finite A"
|
blanchet@49990
|
1518 |
shows "|Bpow r A| \<le>o |Func (Field r) A|"
|
blanchet@49990
|
1519 |
proof-
|
traytel@53682
|
1520 |
let ?F = "\<lambda> f. {x | x a. f a = x \<and> a \<in> Field r}"
|
blanchet@49990
|
1521 |
{fix X assume "X \<in> Bpow r A - {{}}"
|
blanchet@49990
|
1522 |
hence XA: "X \<subseteq> A" and "|X| \<le>o r"
|
blanchet@49990
|
1523 |
and X: "X \<noteq> {}" unfolding Bpow_def by auto
|
blanchet@49990
|
1524 |
hence "|X| \<le>o |Field r|" by (metis Field_card_of card_of_mono2)
|
blanchet@49990
|
1525 |
then obtain F where 1: "X = F ` (Field r)"
|
blanchet@49990
|
1526 |
using card_of_ordLeq2[OF X] by metis
|
traytel@53682
|
1527 |
def f \<equiv> "\<lambda> i. if i \<in> Field r then F i else undefined"
|
blanchet@49990
|
1528 |
have "\<exists> f \<in> Func (Field r) A. X = ?F f"
|
blanchet@49990
|
1529 |
apply (intro bexI[of _ f]) using 1 XA unfolding Func_def f_def by auto
|
blanchet@49990
|
1530 |
}
|
blanchet@49990
|
1531 |
hence "Bpow r A - {{}} \<subseteq> ?F ` (Func (Field r) A)" by auto
|
blanchet@49990
|
1532 |
hence "|Bpow r A - {{}}| \<le>o |Func (Field r) A|"
|
blanchet@49990
|
1533 |
by (rule surj_imp_ordLeq)
|
blanchet@49990
|
1534 |
moreover
|
traytel@55951
|
1535 |
{have 2: "\<not>finite (Bpow r A)" using infinite_Bpow[OF rc r A] .
|
blanchet@49990
|
1536 |
have "|Bpow r A| =o |Bpow r A - {{}}|"
|
traytel@55951
|
1537 |
by (metis 2 infinite_card_of_diff_singl ordIso_symmetric)
|
blanchet@49990
|
1538 |
}
|
blanchet@49990
|
1539 |
ultimately show ?thesis by (metis ordIso_ordLeq_trans)
|
blanchet@49990
|
1540 |
qed
|
blanchet@49990
|
1541 |
|
blanchet@49990
|
1542 |
lemma Func_emp2[simp]: "A \<noteq> {} \<Longrightarrow> Func A {} = {}" by auto
|
blanchet@49990
|
1543 |
|
blanchet@49990
|
1544 |
lemma empty_in_Func[simp]:
|
traytel@53682
|
1545 |
"B \<noteq> {} \<Longrightarrow> (\<lambda>x. undefined) \<in> Func {} B"
|
blanchet@49990
|
1546 |
unfolding Func_def by auto
|
blanchet@49990
|
1547 |
|
blanchet@49990
|
1548 |
lemma Func_mono[simp]:
|
blanchet@49990
|
1549 |
assumes "B1 \<subseteq> B2"
|
blanchet@49990
|
1550 |
shows "Func A B1 \<subseteq> Func A B2"
|
blanchet@49990
|
1551 |
using assms unfolding Func_def by force
|
blanchet@49990
|
1552 |
|
blanchet@49990
|
1553 |
lemma Pfunc_mono[simp]:
|
blanchet@49990
|
1554 |
assumes "A1 \<subseteq> A2" and "B1 \<subseteq> B2"
|
blanchet@49990
|
1555 |
shows "Pfunc A B1 \<subseteq> Pfunc A B2"
|
blanchet@49990
|
1556 |
using assms in_mono unfolding Pfunc_def apply safe
|
blanchet@49990
|
1557 |
apply(case_tac "x a", auto)
|
blanchet@49990
|
1558 |
by (metis in_mono option.simps(5))
|
blanchet@49990
|
1559 |
|
blanchet@49990
|
1560 |
lemma card_of_Func_UNIV_UNIV:
|
blanchet@49990
|
1561 |
"|Func (UNIV::'a set) (UNIV::'b set)| =o |UNIV::('a \<Rightarrow> 'b) set|"
|
blanchet@49990
|
1562 |
using card_of_Func_UNIV[of "UNIV::'b set"] by auto
|
blanchet@49990
|
1563 |
|
blanchet@55848
|
1564 |
lemma ordLeq_Func:
|
blanchet@55848
|
1565 |
assumes "{b1,b2} \<subseteq> B" "b1 \<noteq> b2"
|
blanchet@55848
|
1566 |
shows "|A| \<le>o |Func A B|"
|
blanchet@55848
|
1567 |
unfolding card_of_ordLeq[symmetric] proof(intro exI conjI)
|
blanchet@55848
|
1568 |
let ?F = "\<lambda> aa a. if a \<in> A then (if a = aa then b1 else b2) else undefined"
|
blanchet@55848
|
1569 |
show "inj_on ?F A" using assms unfolding inj_on_def fun_eq_iff by auto
|
blanchet@55848
|
1570 |
show "?F ` A \<subseteq> Func A B" using assms unfolding Func_def by auto
|
blanchet@55848
|
1571 |
qed
|
blanchet@55848
|
1572 |
|
blanchet@55848
|
1573 |
lemma infinite_Func:
|
traytel@55951
|
1574 |
assumes A: "\<not>finite A" and B: "{b1,b2} \<subseteq> B" "b1 \<noteq> b2"
|
traytel@55951
|
1575 |
shows "\<not>finite (Func A B)"
|
blanchet@55848
|
1576 |
using ordLeq_Func[OF B] by (metis A card_of_ordLeq_finite)
|
blanchet@55848
|
1577 |
|
blanchet@49990
|
1578 |
end
|