equal
deleted
inserted
replaced
7 |
7 |
8 header {* Type of (at Most) Countable Sets *} |
8 header {* Type of (at Most) Countable Sets *} |
9 |
9 |
10 theory Countable_Set_Type |
10 theory Countable_Set_Type |
11 imports |
11 imports |
12 More_BNFs |
12 "~~/src/HOL/Cardinals/Cardinal_Notations" |
13 "~~/src/HOL/Cardinals/Cardinals" |
|
14 "~~/src/HOL/Library/Countable_Set" |
13 "~~/src/HOL/Library/Countable_Set" |
15 begin |
14 begin |
|
15 |
|
16 abbreviation "Grp \<equiv> BNF_Util.Grp" |
|
17 |
16 |
18 |
17 subsection{* Cardinal stuff *} |
19 subsection{* Cardinal stuff *} |
18 |
20 |
19 lemma countable_card_of_nat: "countable A \<longleftrightarrow> |A| \<le>o |UNIV::nat set|" |
21 lemma countable_card_of_nat: "countable A \<longleftrightarrow> |A| \<le>o |UNIV::nat set|" |
20 unfolding countable_def card_of_ordLeq[symmetric] by auto |
22 unfolding countable_def card_of_ordLeq[symmetric] by auto |
24 |
26 |
25 lemma countable_or_card_of: |
27 lemma countable_or_card_of: |
26 assumes "countable A" |
28 assumes "countable A" |
27 shows "(finite A \<and> |A| <o |UNIV::nat set| ) \<or> |
29 shows "(finite A \<and> |A| <o |UNIV::nat set| ) \<or> |
28 (infinite A \<and> |A| =o |UNIV::nat set| )" |
30 (infinite A \<and> |A| =o |UNIV::nat set| )" |
29 proof (cases "finite A") |
31 by (metis assms countable_card_of_nat infinite_iff_card_of_nat ordIso_iff_ordLeq |
30 case True thus ?thesis by (metis finite_iff_cardOf_nat) |
32 ordLeq_iff_ordLess_or_ordIso) |
31 next |
|
32 case False with assms show ?thesis |
|
33 by (metis countable_card_of_nat infinite_iff_card_of_nat ordIso_iff_ordLeq) |
|
34 qed |
|
35 |
33 |
36 lemma countable_cases_card_of[elim]: |
34 lemma countable_cases_card_of[elim]: |
37 assumes "countable A" |
35 assumes "countable A" |
38 obtains (Fin) "finite A" "|A| <o |UNIV::nat set|" |
36 obtains (Fin) "finite A" "|A| <o |UNIV::nat set|" |
39 | (Inf) "infinite A" "|A| =o |UNIV::nat set|" |
37 | (Inf) "infinite A" "|A| =o |UNIV::nat set|" |
140 proof |
138 proof |
141 assume ?L |
139 assume ?L |
142 def R' \<equiv> "the_inv rcset (Collect (split R) \<inter> (rcset a \<times> rcset b))" |
140 def R' \<equiv> "the_inv rcset (Collect (split R) \<inter> (rcset a \<times> rcset b))" |
143 (is "the_inv rcset ?L'") |
141 (is "the_inv rcset ?L'") |
144 have L: "countable ?L'" by auto |
142 have L: "countable ?L'" by auto |
145 hence *: "rcset R' = ?L'" unfolding R'_def using fset_to_fset by (intro rcset_to_rcset) |
143 hence *: "rcset R' = ?L'" unfolding R'_def by (intro rcset_to_rcset) |
146 thus ?R unfolding Grp_def relcompp.simps conversep.simps |
144 thus ?R unfolding Grp_def relcompp.simps conversep.simps |
147 proof (intro CollectI prod_caseI exI[of _ a] exI[of _ b] exI[of _ R'] conjI refl) |
145 proof (intro CollectI prod_caseI exI[of _ a] exI[of _ b] exI[of _ R'] conjI refl) |
148 from * `?L` show "a = cimage fst R'" by transfer (auto simp: image_def Collect_Int_Times) |
146 from * `?L` show "a = cimage fst R'" by transfer (auto simp: image_def Collect_Int_Times) |
149 next |
147 next |
150 from * `?L` show "b = cimage snd R'" by transfer (auto simp: image_def Collect_Int_Times) |
148 from * `?L` show "b = cimage snd R'" by transfer (auto simp: image_def Collect_Int_Times) |