45 |
45 |
46 lemma Times_cprod: "|A \<times> B| =o |A| *c |B|" |
46 lemma Times_cprod: "|A \<times> B| =o |A| *c |B|" |
47 by (simp only: cprod_def Field_card_of card_of_refl) |
47 by (simp only: cprod_def Field_card_of card_of_refl) |
48 |
48 |
49 lemma card_of_Times_singleton: |
49 lemma card_of_Times_singleton: |
50 fixes A :: "'a set" |
50 fixes A :: "'a set" |
51 shows "|A \<times> {x}| =o |A|" |
51 shows "|A \<times> {x}| =o |A|" |
52 proof - |
52 proof - |
53 def f \<equiv> "\<lambda>(a::'a,b::'b). (a)" |
53 define f :: "'a \<times> 'b \<Rightarrow> 'a" where "f = (\<lambda>(a, b). a)" |
54 have "A \<subseteq> f ` (A \<times> {x})" unfolding f_def by (auto simp: image_iff) |
54 have "A \<subseteq> f ` (A \<times> {x})" unfolding f_def by (auto simp: image_iff) |
55 hence "bij_betw f (A \<times> {x}) A" unfolding bij_betw_def inj_on_def f_def by fastforce |
55 hence "bij_betw f (A \<times> {x}) A" unfolding bij_betw_def inj_on_def f_def by fastforce |
56 thus ?thesis using card_of_ordIso by blast |
56 thus ?thesis using card_of_ordIso by blast |
57 qed |
57 qed |
58 |
58 |
221 |
221 |
222 lemma Func_singleton: |
222 lemma Func_singleton: |
223 fixes x :: 'b and A :: "'a set" |
223 fixes x :: 'b and A :: "'a set" |
224 shows "|Func A {x}| =o |{x}|" |
224 shows "|Func A {x}| =o |{x}|" |
225 proof (rule ordIso_symmetric) |
225 proof (rule ordIso_symmetric) |
226 def f \<equiv> "\<lambda>y a. if y = x \<and> a \<in> A then x else undefined" |
226 define f where [abs_def]: "f y a = (if y = x \<and> a \<in> A then x else undefined)" for y a |
227 have "Func A {x} \<subseteq> f ` {x}" unfolding f_def Func_def by (force simp: fun_eq_iff) |
227 have "Func A {x} \<subseteq> f ` {x}" unfolding f_def Func_def by (force simp: fun_eq_iff) |
228 hence "bij_betw f {x} (Func A {x})" unfolding bij_betw_def inj_on_def f_def Func_def |
228 hence "bij_betw f {x} (Func A {x})" unfolding bij_betw_def inj_on_def f_def Func_def |
229 by (auto split: if_split_asm) |
229 by (auto split: if_split_asm) |
230 thus "|{x}| =o |Func A {x}|" using card_of_ordIso by blast |
230 thus "|{x}| =o |Func A {x}|" using card_of_ordIso by blast |
231 qed |
231 qed |
235 |
235 |
236 lemma card_of_Func_squared: |
236 lemma card_of_Func_squared: |
237 fixes A :: "'a set" |
237 fixes A :: "'a set" |
238 shows "|Func (UNIV :: bool set) A| =o |A \<times> A|" |
238 shows "|Func (UNIV :: bool set) A| =o |A \<times> A|" |
239 proof (rule ordIso_symmetric) |
239 proof (rule ordIso_symmetric) |
240 def f \<equiv> "\<lambda>(x::'a,y) b. if A = {} then undefined else if b then x else y" |
240 define f where "f = (\<lambda>(x::'a,y) b. if A = {} then undefined else if b then x else y)" |
241 have "Func (UNIV :: bool set) A \<subseteq> f ` (A \<times> A)" unfolding f_def Func_def |
241 have "Func (UNIV :: bool set) A \<subseteq> f ` (A \<times> A)" unfolding f_def Func_def |
242 by (auto simp: image_iff fun_eq_iff split: option.splits if_split_asm) blast |
242 by (auto simp: image_iff fun_eq_iff split: option.splits if_split_asm) blast |
243 hence "bij_betw f (A \<times> A) (Func (UNIV :: bool set) A)" |
243 hence "bij_betw f (A \<times> A) (Func (UNIV :: bool set) A)" |
244 unfolding bij_betw_def inj_on_def f_def Func_def by (auto simp: fun_eq_iff) |
244 unfolding bij_betw_def inj_on_def f_def Func_def by (auto simp: fun_eq_iff) |
245 thus "|A \<times> A| =o |Func (UNIV :: bool set) A|" using card_of_ordIso by blast |
245 thus "|A \<times> A| =o |Func (UNIV :: bool set) A|" using card_of_ordIso by blast |
250 |
250 |
251 lemma card_of_Func_Plus: |
251 lemma card_of_Func_Plus: |
252 fixes A :: "'a set" and B :: "'b set" and C :: "'c set" |
252 fixes A :: "'a set" and B :: "'b set" and C :: "'c set" |
253 shows "|Func (A <+> B) C| =o |Func A C \<times> Func B C|" |
253 shows "|Func (A <+> B) C| =o |Func A C \<times> Func B C|" |
254 proof (rule ordIso_symmetric) |
254 proof (rule ordIso_symmetric) |
255 def f \<equiv> "\<lambda>(g :: 'a => 'c, h::'b \<Rightarrow> 'c) ab. case ab of Inl a \<Rightarrow> g a | Inr b \<Rightarrow> h b" |
255 define f where "f = (\<lambda>(g :: 'a => 'c, h::'b \<Rightarrow> 'c) ab. case ab of Inl a \<Rightarrow> g a | Inr b \<Rightarrow> h b)" |
256 def f' \<equiv> "\<lambda>(f :: ('a + 'b) \<Rightarrow> 'c). (\<lambda>a. f (Inl a), \<lambda>b. f (Inr b))" |
256 define f' where "f' = (\<lambda>(f :: ('a + 'b) \<Rightarrow> 'c). (\<lambda>a. f (Inl a), \<lambda>b. f (Inr b)))" |
257 have "f ` (Func A C \<times> Func B C) \<subseteq> Func (A <+> B) C" |
257 have "f ` (Func A C \<times> Func B C) \<subseteq> Func (A <+> B) C" |
258 unfolding Func_def f_def by (force split: sum.splits) |
258 unfolding Func_def f_def by (force split: sum.splits) |
259 moreover have "f' ` Func (A <+> B) C \<subseteq> Func A C \<times> Func B C" unfolding Func_def f'_def by force |
259 moreover have "f' ` Func (A <+> B) C \<subseteq> Func A C \<times> Func B C" unfolding Func_def f'_def by force |
260 moreover have "\<forall>a \<in> Func A C \<times> Func B C. f' (f a) = a" unfolding f'_def f_def Func_def by auto |
260 moreover have "\<forall>a \<in> Func A C \<times> Func B C. f' (f a) = a" unfolding f'_def f_def Func_def by auto |
261 moreover have "\<forall>a' \<in> Func (A <+> B) C. f (f' a') = a'" unfolding f'_def f_def Func_def |
261 moreover have "\<forall>a' \<in> Func (A <+> B) C. f (f' a') = a'" unfolding f'_def f_def Func_def |