author | paulson <lp15@cam.ac.uk> |
Tue, 01 Dec 2015 14:09:10 +0000 | |
changeset 61762 | d50b993b4fb9 |
parent 61585 | a9599d3d7610 |
child 61810 | 3c5040d5694a |
permissions | -rw-r--r-- |
27407
68e111812b83
rename lemmas INF_foo to INFM_foo; add new lemmas about MOST and INFM
huffman
parents:
27368
diff
changeset
|
1 |
(* Title: HOL/Library/Infinite_Set.thy |
20809 | 2 |
Author: Stephan Merz |
3 |
*) |
|
4 |
||
60500 | 5 |
section \<open>Infinite Sets and Related Concepts\<close> |
20809 | 6 |
|
7 |
theory Infinite_Set |
|
54612
7e291ae244ea
Backed out changeset: a8ad7f6dd217---bypassing Main breaks theories that use \<inf> or \<sup>
traytel
parents:
54607
diff
changeset
|
8 |
imports Main |
20809 | 9 |
begin |
10 |
||
11 |
subsection "Infinite Sets" |
|
12 |
||
60500 | 13 |
text \<open> |
54557
d71c2737ee21
correctly account for dead variables when naming set functions
blanchet
parents:
53239
diff
changeset
|
14 |
Some elementary facts about infinite sets, mostly by Stephan Merz. |
20809 | 15 |
Beware! Because "infinite" merely abbreviates a negation, these |
61585 | 16 |
lemmas may not work well with \<open>blast\<close>. |
60500 | 17 |
\<close> |
20809 | 18 |
|
53239 | 19 |
abbreviation infinite :: "'a set \<Rightarrow> bool" |
20 |
where "infinite S \<equiv> \<not> finite S" |
|
20809 | 21 |
|
60500 | 22 |
text \<open> |
20809 | 23 |
Infinite sets are non-empty, and if we remove some elements from an |
24 |
infinite set, the result is still infinite. |
|
60500 | 25 |
\<close> |
20809 | 26 |
|
53239 | 27 |
lemma infinite_imp_nonempty: "infinite S \<Longrightarrow> S \<noteq> {}" |
20809 | 28 |
by auto |
29 |
||
53239 | 30 |
lemma infinite_remove: "infinite S \<Longrightarrow> infinite (S - {a})" |
20809 | 31 |
by simp |
32 |
||
33 |
lemma Diff_infinite_finite: |
|
34 |
assumes T: "finite T" and S: "infinite S" |
|
35 |
shows "infinite (S - T)" |
|
36 |
using T |
|
37 |
proof induct |
|
38 |
from S |
|
39 |
show "infinite (S - {})" by auto |
|
40 |
next |
|
41 |
fix T x |
|
42 |
assume ih: "infinite (S - T)" |
|
43 |
have "S - (insert x T) = (S - T) - {x}" |
|
44 |
by (rule Diff_insert) |
|
45 |
with ih |
|
46 |
show "infinite (S - (insert x T))" |
|
47 |
by (simp add: infinite_remove) |
|
48 |
qed |
|
49 |
||
50 |
lemma Un_infinite: "infinite S \<Longrightarrow> infinite (S \<union> T)" |
|
51 |
by simp |
|
52 |
||
35844
65258d2c3214
added lemma infinite_Un
Christian Urban <urbanc@in.tum.de>
parents:
35056
diff
changeset
|
53 |
lemma infinite_Un: "infinite (S \<union> T) \<longleftrightarrow> infinite S \<or> infinite T" |
65258d2c3214
added lemma infinite_Un
Christian Urban <urbanc@in.tum.de>
parents:
35056
diff
changeset
|
54 |
by simp |
65258d2c3214
added lemma infinite_Un
Christian Urban <urbanc@in.tum.de>
parents:
35056
diff
changeset
|
55 |
|
20809 | 56 |
lemma infinite_super: |
57 |
assumes T: "S \<subseteq> T" and S: "infinite S" |
|
58 |
shows "infinite T" |
|
59 |
proof |
|
60 |
assume "finite T" |
|
61 |
with T have "finite S" by (simp add: finite_subset) |
|
62 |
with S show False by simp |
|
63 |
qed |
|
64 |
||
60828 | 65 |
lemma infinite_coinduct [consumes 1, case_names infinite]: |
66 |
assumes "X A" |
|
67 |
and step: "\<And>A. X A \<Longrightarrow> \<exists>x\<in>A. X (A - {x}) \<or> infinite (A - {x})" |
|
68 |
shows "infinite A" |
|
69 |
proof |
|
70 |
assume "finite A" |
|
71 |
then show False using \<open>X A\<close> |
|
72 |
by(induction rule: finite_psubset_induct)(meson Diff_subset card_Diff1_less card_psubset finite_Diff step) |
|
73 |
qed |
|
74 |
||
61762
d50b993b4fb9
Removal of redundant lemmas (diff_less_iff, diff_le_iff) and of the abbreviation Exp. Addition of some new material.
paulson <lp15@cam.ac.uk>
parents:
61585
diff
changeset
|
75 |
text \<open>As a concrete example, we prove that the set of natural numbers is infinite.\<close> |
20809 | 76 |
|
60040
1fa1023b13b9
move MOST and INFM in Infinite_Set to Filter; change them to abbreviations over the cofinite filter
hoelzl
parents:
59506
diff
changeset
|
77 |
lemma infinite_nat_iff_unbounded_le: "infinite (S::nat set) \<longleftrightarrow> (\<forall>m. \<exists>n\<ge>m. n \<in> S)" |
1fa1023b13b9
move MOST and INFM in Infinite_Set to Filter; change them to abbreviations over the cofinite filter
hoelzl
parents:
59506
diff
changeset
|
78 |
using frequently_cofinite[of "\<lambda>x. x \<in> S"] |
1fa1023b13b9
move MOST and INFM in Infinite_Set to Filter; change them to abbreviations over the cofinite filter
hoelzl
parents:
59506
diff
changeset
|
79 |
by (simp add: cofinite_eq_sequentially frequently_def eventually_sequentially) |
1fa1023b13b9
move MOST and INFM in Infinite_Set to Filter; change them to abbreviations over the cofinite filter
hoelzl
parents:
59506
diff
changeset
|
80 |
|
1fa1023b13b9
move MOST and INFM in Infinite_Set to Filter; change them to abbreviations over the cofinite filter
hoelzl
parents:
59506
diff
changeset
|
81 |
lemma infinite_nat_iff_unbounded: "infinite (S::nat set) \<longleftrightarrow> (\<forall>m. \<exists>n>m. n \<in> S)" |
1fa1023b13b9
move MOST and INFM in Infinite_Set to Filter; change them to abbreviations over the cofinite filter
hoelzl
parents:
59506
diff
changeset
|
82 |
using frequently_cofinite[of "\<lambda>x. x \<in> S"] |
1fa1023b13b9
move MOST and INFM in Infinite_Set to Filter; change them to abbreviations over the cofinite filter
hoelzl
parents:
59506
diff
changeset
|
83 |
by (simp add: cofinite_eq_sequentially frequently_def eventually_at_top_dense) |
20809 | 84 |
|
59000 | 85 |
lemma finite_nat_iff_bounded: "finite (S::nat set) \<longleftrightarrow> (\<exists>k. S \<subseteq> {..<k})" |
60040
1fa1023b13b9
move MOST and INFM in Infinite_Set to Filter; change them to abbreviations over the cofinite filter
hoelzl
parents:
59506
diff
changeset
|
86 |
using infinite_nat_iff_unbounded_le[of S] by (simp add: subset_eq) (metis not_le) |
20809 | 87 |
|
60040
1fa1023b13b9
move MOST and INFM in Infinite_Set to Filter; change them to abbreviations over the cofinite filter
hoelzl
parents:
59506
diff
changeset
|
88 |
lemma finite_nat_iff_bounded_le: "finite (S::nat set) \<longleftrightarrow> (\<exists>k. S \<subseteq> {.. k})" |
1fa1023b13b9
move MOST and INFM in Infinite_Set to Filter; change them to abbreviations over the cofinite filter
hoelzl
parents:
59506
diff
changeset
|
89 |
using infinite_nat_iff_unbounded[of S] by (simp add: subset_eq) (metis not_le) |
20809 | 90 |
|
60040
1fa1023b13b9
move MOST and INFM in Infinite_Set to Filter; change them to abbreviations over the cofinite filter
hoelzl
parents:
59506
diff
changeset
|
91 |
lemma finite_nat_bounded: "finite (S::nat set) \<Longrightarrow> \<exists>k. S \<subseteq> {..<k}" |
1fa1023b13b9
move MOST and INFM in Infinite_Set to Filter; change them to abbreviations over the cofinite filter
hoelzl
parents:
59506
diff
changeset
|
92 |
by (simp add: finite_nat_iff_bounded) |
20809 | 93 |
|
61762
d50b993b4fb9
Removal of redundant lemmas (diff_less_iff, diff_le_iff) and of the abbreviation Exp. Addition of some new material.
paulson <lp15@cam.ac.uk>
parents:
61585
diff
changeset
|
94 |
|
60500 | 95 |
text \<open> |
20809 | 96 |
For a set of natural numbers to be infinite, it is enough to know |
61585 | 97 |
that for any number larger than some \<open>k\<close>, there is some larger |
20809 | 98 |
number that is an element of the set. |
60500 | 99 |
\<close> |
20809 | 100 |
|
60040
1fa1023b13b9
move MOST and INFM in Infinite_Set to Filter; change them to abbreviations over the cofinite filter
hoelzl
parents:
59506
diff
changeset
|
101 |
lemma unbounded_k_infinite: "\<forall>m>k. \<exists>n>m. n \<in> S \<Longrightarrow> infinite (S::nat set)" |
1fa1023b13b9
move MOST and INFM in Infinite_Set to Filter; change them to abbreviations over the cofinite filter
hoelzl
parents:
59506
diff
changeset
|
102 |
by (metis (full_types) infinite_nat_iff_unbounded_le le_imp_less_Suc not_less |
1fa1023b13b9
move MOST and INFM in Infinite_Set to Filter; change them to abbreviations over the cofinite filter
hoelzl
parents:
59506
diff
changeset
|
103 |
not_less_iff_gr_or_eq sup.bounded_iff) |
20809 | 104 |
|
35056 | 105 |
lemma nat_not_finite: "finite (UNIV::nat set) \<Longrightarrow> R" |
20809 | 106 |
by simp |
107 |
||
108 |
lemma range_inj_infinite: |
|
109 |
"inj (f::nat \<Rightarrow> 'a) \<Longrightarrow> infinite (range f)" |
|
110 |
proof |
|
27407
68e111812b83
rename lemmas INF_foo to INFM_foo; add new lemmas about MOST and INFM
huffman
parents:
27368
diff
changeset
|
111 |
assume "finite (range f)" and "inj f" |
20809 | 112 |
then have "finite (UNIV::nat set)" |
27407
68e111812b83
rename lemmas INF_foo to INFM_foo; add new lemmas about MOST and INFM
huffman
parents:
27368
diff
changeset
|
113 |
by (rule finite_imageD) |
20809 | 114 |
then show False by simp |
115 |
qed |
|
116 |
||
60500 | 117 |
text \<open> |
20809 | 118 |
For any function with infinite domain and finite range there is some |
119 |
element that is the image of infinitely many domain elements. In |
|
120 |
particular, any infinite sequence of elements from a finite set |
|
121 |
contains some element that occurs infinitely often. |
|
60500 | 122 |
\<close> |
20809 | 123 |
|
59488 | 124 |
lemma inf_img_fin_dom': |
125 |
assumes img: "finite (f ` A)" and dom: "infinite A" |
|
126 |
shows "\<exists>y \<in> f ` A. infinite (f -` {y} \<inter> A)" |
|
127 |
proof (rule ccontr) |
|
128 |
have "A \<subseteq> (\<Union>y\<in>f ` A. f -` {y} \<inter> A)" by auto |
|
129 |
moreover |
|
130 |
assume "\<not> ?thesis" |
|
131 |
with img have "finite (\<Union>y\<in>f ` A. f -` {y} \<inter> A)" by blast |
|
132 |
ultimately have "finite A" by(rule finite_subset) |
|
133 |
with dom show False by contradiction |
|
134 |
qed |
|
135 |
||
136 |
lemma inf_img_fin_domE': |
|
137 |
assumes "finite (f ` A)" and "infinite A" |
|
138 |
obtains y where "y \<in> f`A" and "infinite (f -` {y} \<inter> A)" |
|
139 |
using assms by (blast dest: inf_img_fin_dom') |
|
140 |
||
20809 | 141 |
lemma inf_img_fin_dom: |
142 |
assumes img: "finite (f`A)" and dom: "infinite A" |
|
143 |
shows "\<exists>y \<in> f`A. infinite (f -` {y})" |
|
59488 | 144 |
using inf_img_fin_dom'[OF assms] by auto |
20809 | 145 |
|
146 |
lemma inf_img_fin_domE: |
|
147 |
assumes "finite (f`A)" and "infinite A" |
|
148 |
obtains y where "y \<in> f`A" and "infinite (f -` {y})" |
|
23394 | 149 |
using assms by (blast dest: inf_img_fin_dom) |
20809 | 150 |
|
61762
d50b993b4fb9
Removal of redundant lemmas (diff_less_iff, diff_le_iff) and of the abbreviation Exp. Addition of some new material.
paulson <lp15@cam.ac.uk>
parents:
61585
diff
changeset
|
151 |
proposition finite_image_absD: |
d50b993b4fb9
Removal of redundant lemmas (diff_less_iff, diff_le_iff) and of the abbreviation Exp. Addition of some new material.
paulson <lp15@cam.ac.uk>
parents:
61585
diff
changeset
|
152 |
fixes S :: "'a::linordered_ring set" |
d50b993b4fb9
Removal of redundant lemmas (diff_less_iff, diff_le_iff) and of the abbreviation Exp. Addition of some new material.
paulson <lp15@cam.ac.uk>
parents:
61585
diff
changeset
|
153 |
shows "finite (abs ` S) \<Longrightarrow> finite S" |
d50b993b4fb9
Removal of redundant lemmas (diff_less_iff, diff_le_iff) and of the abbreviation Exp. Addition of some new material.
paulson <lp15@cam.ac.uk>
parents:
61585
diff
changeset
|
154 |
by (rule ccontr) (auto simp: abs_eq_iff vimage_def dest: inf_img_fin_dom) |
d50b993b4fb9
Removal of redundant lemmas (diff_less_iff, diff_le_iff) and of the abbreviation Exp. Addition of some new material.
paulson <lp15@cam.ac.uk>
parents:
61585
diff
changeset
|
155 |
|
d50b993b4fb9
Removal of redundant lemmas (diff_less_iff, diff_le_iff) and of the abbreviation Exp. Addition of some new material.
paulson <lp15@cam.ac.uk>
parents:
61585
diff
changeset
|
156 |
text \<open>The set of integers is also infinite.\<close> |
d50b993b4fb9
Removal of redundant lemmas (diff_less_iff, diff_le_iff) and of the abbreviation Exp. Addition of some new material.
paulson <lp15@cam.ac.uk>
parents:
61585
diff
changeset
|
157 |
|
d50b993b4fb9
Removal of redundant lemmas (diff_less_iff, diff_le_iff) and of the abbreviation Exp. Addition of some new material.
paulson <lp15@cam.ac.uk>
parents:
61585
diff
changeset
|
158 |
lemma infinite_int_iff_infinite_nat_abs: "infinite (S::int set) \<longleftrightarrow> infinite ((nat o abs) ` S)" |
d50b993b4fb9
Removal of redundant lemmas (diff_less_iff, diff_le_iff) and of the abbreviation Exp. Addition of some new material.
paulson <lp15@cam.ac.uk>
parents:
61585
diff
changeset
|
159 |
by (auto simp: transfer_nat_int_set_relations o_def image_comp dest: finite_image_absD) |
d50b993b4fb9
Removal of redundant lemmas (diff_less_iff, diff_le_iff) and of the abbreviation Exp. Addition of some new material.
paulson <lp15@cam.ac.uk>
parents:
61585
diff
changeset
|
160 |
|
d50b993b4fb9
Removal of redundant lemmas (diff_less_iff, diff_le_iff) and of the abbreviation Exp. Addition of some new material.
paulson <lp15@cam.ac.uk>
parents:
61585
diff
changeset
|
161 |
proposition infinite_int_iff_unbounded_le: "infinite (S::int set) \<longleftrightarrow> (\<forall>m. \<exists>n. abs n \<ge> m \<and> n \<in> S)" |
d50b993b4fb9
Removal of redundant lemmas (diff_less_iff, diff_le_iff) and of the abbreviation Exp. Addition of some new material.
paulson <lp15@cam.ac.uk>
parents:
61585
diff
changeset
|
162 |
apply (simp add: infinite_int_iff_infinite_nat_abs infinite_nat_iff_unbounded_le o_def image_def) |
d50b993b4fb9
Removal of redundant lemmas (diff_less_iff, diff_le_iff) and of the abbreviation Exp. Addition of some new material.
paulson <lp15@cam.ac.uk>
parents:
61585
diff
changeset
|
163 |
apply (metis abs_ge_zero nat_le_eq_zle le_nat_iff) |
d50b993b4fb9
Removal of redundant lemmas (diff_less_iff, diff_le_iff) and of the abbreviation Exp. Addition of some new material.
paulson <lp15@cam.ac.uk>
parents:
61585
diff
changeset
|
164 |
done |
d50b993b4fb9
Removal of redundant lemmas (diff_less_iff, diff_le_iff) and of the abbreviation Exp. Addition of some new material.
paulson <lp15@cam.ac.uk>
parents:
61585
diff
changeset
|
165 |
|
d50b993b4fb9
Removal of redundant lemmas (diff_less_iff, diff_le_iff) and of the abbreviation Exp. Addition of some new material.
paulson <lp15@cam.ac.uk>
parents:
61585
diff
changeset
|
166 |
proposition infinite_int_iff_unbounded: "infinite (S::int set) \<longleftrightarrow> (\<forall>m. \<exists>n. abs n > m \<and> n \<in> S)" |
d50b993b4fb9
Removal of redundant lemmas (diff_less_iff, diff_le_iff) and of the abbreviation Exp. Addition of some new material.
paulson <lp15@cam.ac.uk>
parents:
61585
diff
changeset
|
167 |
apply (simp add: infinite_int_iff_infinite_nat_abs infinite_nat_iff_unbounded o_def image_def) |
d50b993b4fb9
Removal of redundant lemmas (diff_less_iff, diff_le_iff) and of the abbreviation Exp. Addition of some new material.
paulson <lp15@cam.ac.uk>
parents:
61585
diff
changeset
|
168 |
apply (metis (full_types) nat_le_iff nat_mono not_le) |
d50b993b4fb9
Removal of redundant lemmas (diff_less_iff, diff_le_iff) and of the abbreviation Exp. Addition of some new material.
paulson <lp15@cam.ac.uk>
parents:
61585
diff
changeset
|
169 |
done |
d50b993b4fb9
Removal of redundant lemmas (diff_less_iff, diff_le_iff) and of the abbreviation Exp. Addition of some new material.
paulson <lp15@cam.ac.uk>
parents:
61585
diff
changeset
|
170 |
|
d50b993b4fb9
Removal of redundant lemmas (diff_less_iff, diff_le_iff) and of the abbreviation Exp. Addition of some new material.
paulson <lp15@cam.ac.uk>
parents:
61585
diff
changeset
|
171 |
proposition finite_int_iff_bounded: "finite (S::int set) \<longleftrightarrow> (\<exists>k. abs ` S \<subseteq> {..<k})" |
d50b993b4fb9
Removal of redundant lemmas (diff_less_iff, diff_le_iff) and of the abbreviation Exp. Addition of some new material.
paulson <lp15@cam.ac.uk>
parents:
61585
diff
changeset
|
172 |
using infinite_int_iff_unbounded_le[of S] by (simp add: subset_eq) (metis not_le) |
d50b993b4fb9
Removal of redundant lemmas (diff_less_iff, diff_le_iff) and of the abbreviation Exp. Addition of some new material.
paulson <lp15@cam.ac.uk>
parents:
61585
diff
changeset
|
173 |
|
d50b993b4fb9
Removal of redundant lemmas (diff_less_iff, diff_le_iff) and of the abbreviation Exp. Addition of some new material.
paulson <lp15@cam.ac.uk>
parents:
61585
diff
changeset
|
174 |
proposition finite_int_iff_bounded_le: "finite (S::int set) \<longleftrightarrow> (\<exists>k. abs ` S \<subseteq> {.. k})" |
d50b993b4fb9
Removal of redundant lemmas (diff_less_iff, diff_le_iff) and of the abbreviation Exp. Addition of some new material.
paulson <lp15@cam.ac.uk>
parents:
61585
diff
changeset
|
175 |
using infinite_int_iff_unbounded[of S] by (simp add: subset_eq) (metis not_le) |
d50b993b4fb9
Removal of redundant lemmas (diff_less_iff, diff_le_iff) and of the abbreviation Exp. Addition of some new material.
paulson <lp15@cam.ac.uk>
parents:
61585
diff
changeset
|
176 |
|
20809 | 177 |
subsection "Infinitely Many and Almost All" |
178 |
||
60500 | 179 |
text \<open> |
20809 | 180 |
We often need to reason about the existence of infinitely many |
181 |
(resp., all but finitely many) objects satisfying some predicate, so |
|
182 |
we introduce corresponding binders and their proof rules. |
|
60500 | 183 |
\<close> |
20809 | 184 |
|
60040
1fa1023b13b9
move MOST and INFM in Infinite_Set to Filter; change them to abbreviations over the cofinite filter
hoelzl
parents:
59506
diff
changeset
|
185 |
(* The following two lemmas are available as filter-rules, but not in the simp-set *) |
1fa1023b13b9
move MOST and INFM in Infinite_Set to Filter; change them to abbreviations over the cofinite filter
hoelzl
parents:
59506
diff
changeset
|
186 |
lemma not_INFM [simp]: "\<not> (INFM x. P x) \<longleftrightarrow> (MOST x. \<not> P x)" by (fact not_frequently) |
1fa1023b13b9
move MOST and INFM in Infinite_Set to Filter; change them to abbreviations over the cofinite filter
hoelzl
parents:
59506
diff
changeset
|
187 |
lemma not_MOST [simp]: "\<not> (MOST x. P x) \<longleftrightarrow> (INFM x. \<not> P x)" by (fact not_eventually) |
34112 | 188 |
|
189 |
lemma INFM_const [simp]: "(INFM x::'a. P) \<longleftrightarrow> P \<and> infinite (UNIV::'a set)" |
|
60040
1fa1023b13b9
move MOST and INFM in Infinite_Set to Filter; change them to abbreviations over the cofinite filter
hoelzl
parents:
59506
diff
changeset
|
190 |
by (simp add: frequently_const_iff) |
34112 | 191 |
|
192 |
lemma MOST_const [simp]: "(MOST x::'a. P) \<longleftrightarrow> P \<or> finite (UNIV::'a set)" |
|
60040
1fa1023b13b9
move MOST and INFM in Infinite_Set to Filter; change them to abbreviations over the cofinite filter
hoelzl
parents:
59506
diff
changeset
|
193 |
by (simp add: eventually_const_iff) |
20809 | 194 |
|
60040
1fa1023b13b9
move MOST and INFM in Infinite_Set to Filter; change them to abbreviations over the cofinite filter
hoelzl
parents:
59506
diff
changeset
|
195 |
lemma INFM_imp_distrib: "(INFM x. P x \<longrightarrow> Q x) \<longleftrightarrow> ((MOST x. P x) \<longrightarrow> (INFM x. Q x))" |
1fa1023b13b9
move MOST and INFM in Infinite_Set to Filter; change them to abbreviations over the cofinite filter
hoelzl
parents:
59506
diff
changeset
|
196 |
by (simp only: imp_conv_disj frequently_disj_iff not_eventually) |
34112 | 197 |
|
60040
1fa1023b13b9
move MOST and INFM in Infinite_Set to Filter; change them to abbreviations over the cofinite filter
hoelzl
parents:
59506
diff
changeset
|
198 |
lemma MOST_imp_iff: "MOST x. P x \<Longrightarrow> (MOST x. P x \<longrightarrow> Q x) \<longleftrightarrow> (MOST x. Q x)" |
1fa1023b13b9
move MOST and INFM in Infinite_Set to Filter; change them to abbreviations over the cofinite filter
hoelzl
parents:
59506
diff
changeset
|
199 |
by (auto intro: eventually_rev_mp eventually_elim1) |
34113 | 200 |
|
60040
1fa1023b13b9
move MOST and INFM in Infinite_Set to Filter; change them to abbreviations over the cofinite filter
hoelzl
parents:
59506
diff
changeset
|
201 |
lemma INFM_conjI: "INFM x. P x \<Longrightarrow> MOST x. Q x \<Longrightarrow> INFM x. P x \<and> Q x" |
1fa1023b13b9
move MOST and INFM in Infinite_Set to Filter; change them to abbreviations over the cofinite filter
hoelzl
parents:
59506
diff
changeset
|
202 |
by (rule frequently_rev_mp[of P]) (auto elim: eventually_elim1) |
34112 | 203 |
|
60500 | 204 |
text \<open>Properties of quantifiers with injective functions.\<close> |
34112 | 205 |
|
53239 | 206 |
lemma INFM_inj: "INFM x. P (f x) \<Longrightarrow> inj f \<Longrightarrow> INFM x. P x" |
60040
1fa1023b13b9
move MOST and INFM in Infinite_Set to Filter; change them to abbreviations over the cofinite filter
hoelzl
parents:
59506
diff
changeset
|
207 |
using finite_vimageI[of "{x. P x}" f] by (auto simp: frequently_cofinite) |
27407
68e111812b83
rename lemmas INF_foo to INFM_foo; add new lemmas about MOST and INFM
huffman
parents:
27368
diff
changeset
|
208 |
|
53239 | 209 |
lemma MOST_inj: "MOST x. P x \<Longrightarrow> inj f \<Longrightarrow> MOST x. P (f x)" |
60040
1fa1023b13b9
move MOST and INFM in Infinite_Set to Filter; change them to abbreviations over the cofinite filter
hoelzl
parents:
59506
diff
changeset
|
210 |
using finite_vimageI[of "{x. \<not> P x}" f] by (auto simp: eventually_cofinite) |
34112 | 211 |
|
60500 | 212 |
text \<open>Properties of quantifiers with singletons.\<close> |
34112 | 213 |
|
214 |
lemma not_INFM_eq [simp]: |
|
215 |
"\<not> (INFM x. x = a)" |
|
216 |
"\<not> (INFM x. a = x)" |
|
60040
1fa1023b13b9
move MOST and INFM in Infinite_Set to Filter; change them to abbreviations over the cofinite filter
hoelzl
parents:
59506
diff
changeset
|
217 |
unfolding frequently_cofinite by simp_all |
34112 | 218 |
|
219 |
lemma MOST_neq [simp]: |
|
220 |
"MOST x. x \<noteq> a" |
|
221 |
"MOST x. a \<noteq> x" |
|
60040
1fa1023b13b9
move MOST and INFM in Infinite_Set to Filter; change them to abbreviations over the cofinite filter
hoelzl
parents:
59506
diff
changeset
|
222 |
unfolding eventually_cofinite by simp_all |
27407
68e111812b83
rename lemmas INF_foo to INFM_foo; add new lemmas about MOST and INFM
huffman
parents:
27368
diff
changeset
|
223 |
|
34112 | 224 |
lemma INFM_neq [simp]: |
225 |
"(INFM x::'a. x \<noteq> a) \<longleftrightarrow> infinite (UNIV::'a set)" |
|
226 |
"(INFM x::'a. a \<noteq> x) \<longleftrightarrow> infinite (UNIV::'a set)" |
|
60040
1fa1023b13b9
move MOST and INFM in Infinite_Set to Filter; change them to abbreviations over the cofinite filter
hoelzl
parents:
59506
diff
changeset
|
227 |
unfolding frequently_cofinite by simp_all |
34112 | 228 |
|
229 |
lemma MOST_eq [simp]: |
|
230 |
"(MOST x::'a. x = a) \<longleftrightarrow> finite (UNIV::'a set)" |
|
231 |
"(MOST x::'a. a = x) \<longleftrightarrow> finite (UNIV::'a set)" |
|
60040
1fa1023b13b9
move MOST and INFM in Infinite_Set to Filter; change them to abbreviations over the cofinite filter
hoelzl
parents:
59506
diff
changeset
|
232 |
unfolding eventually_cofinite by simp_all |
34112 | 233 |
|
234 |
lemma MOST_eq_imp: |
|
235 |
"MOST x. x = a \<longrightarrow> P x" |
|
236 |
"MOST x. a = x \<longrightarrow> P x" |
|
60040
1fa1023b13b9
move MOST and INFM in Infinite_Set to Filter; change them to abbreviations over the cofinite filter
hoelzl
parents:
59506
diff
changeset
|
237 |
unfolding eventually_cofinite by simp_all |
34112 | 238 |
|
60500 | 239 |
text \<open>Properties of quantifiers over the naturals.\<close> |
27407
68e111812b83
rename lemmas INF_foo to INFM_foo; add new lemmas about MOST and INFM
huffman
parents:
27368
diff
changeset
|
240 |
|
60040
1fa1023b13b9
move MOST and INFM in Infinite_Set to Filter; change them to abbreviations over the cofinite filter
hoelzl
parents:
59506
diff
changeset
|
241 |
lemma MOST_nat: "(\<forall>\<^sub>\<infinity>n. P (n::nat)) \<longleftrightarrow> (\<exists>m. \<forall>n>m. P n)" |
1fa1023b13b9
move MOST and INFM in Infinite_Set to Filter; change them to abbreviations over the cofinite filter
hoelzl
parents:
59506
diff
changeset
|
242 |
by (auto simp add: eventually_cofinite finite_nat_iff_bounded_le subset_eq not_le[symmetric]) |
1fa1023b13b9
move MOST and INFM in Infinite_Set to Filter; change them to abbreviations over the cofinite filter
hoelzl
parents:
59506
diff
changeset
|
243 |
|
1fa1023b13b9
move MOST and INFM in Infinite_Set to Filter; change them to abbreviations over the cofinite filter
hoelzl
parents:
59506
diff
changeset
|
244 |
lemma MOST_nat_le: "(\<forall>\<^sub>\<infinity>n. P (n::nat)) \<longleftrightarrow> (\<exists>m. \<forall>n\<ge>m. P n)" |
1fa1023b13b9
move MOST and INFM in Infinite_Set to Filter; change them to abbreviations over the cofinite filter
hoelzl
parents:
59506
diff
changeset
|
245 |
by (auto simp add: eventually_cofinite finite_nat_iff_bounded subset_eq not_le[symmetric]) |
1fa1023b13b9
move MOST and INFM in Infinite_Set to Filter; change them to abbreviations over the cofinite filter
hoelzl
parents:
59506
diff
changeset
|
246 |
|
1fa1023b13b9
move MOST and INFM in Infinite_Set to Filter; change them to abbreviations over the cofinite filter
hoelzl
parents:
59506
diff
changeset
|
247 |
lemma INFM_nat: "(\<exists>\<^sub>\<infinity>n. P (n::nat)) \<longleftrightarrow> (\<forall>m. \<exists>n>m. P n)" |
1fa1023b13b9
move MOST and INFM in Infinite_Set to Filter; change them to abbreviations over the cofinite filter
hoelzl
parents:
59506
diff
changeset
|
248 |
by (simp add: frequently_cofinite infinite_nat_iff_unbounded) |
20809 | 249 |
|
60040
1fa1023b13b9
move MOST and INFM in Infinite_Set to Filter; change them to abbreviations over the cofinite filter
hoelzl
parents:
59506
diff
changeset
|
250 |
lemma INFM_nat_le: "(\<exists>\<^sub>\<infinity>n. P (n::nat)) \<longleftrightarrow> (\<forall>m. \<exists>n\<ge>m. P n)" |
1fa1023b13b9
move MOST and INFM in Infinite_Set to Filter; change them to abbreviations over the cofinite filter
hoelzl
parents:
59506
diff
changeset
|
251 |
by (simp add: frequently_cofinite infinite_nat_iff_unbounded_le) |
1fa1023b13b9
move MOST and INFM in Infinite_Set to Filter; change them to abbreviations over the cofinite filter
hoelzl
parents:
59506
diff
changeset
|
252 |
|
1fa1023b13b9
move MOST and INFM in Infinite_Set to Filter; change them to abbreviations over the cofinite filter
hoelzl
parents:
59506
diff
changeset
|
253 |
lemma MOST_INFM: "infinite (UNIV::'a set) \<Longrightarrow> MOST x::'a. P x \<Longrightarrow> INFM x::'a. P x" |
1fa1023b13b9
move MOST and INFM in Infinite_Set to Filter; change them to abbreviations over the cofinite filter
hoelzl
parents:
59506
diff
changeset
|
254 |
by (simp add: eventually_frequently) |
1fa1023b13b9
move MOST and INFM in Infinite_Set to Filter; change them to abbreviations over the cofinite filter
hoelzl
parents:
59506
diff
changeset
|
255 |
|
1fa1023b13b9
move MOST and INFM in Infinite_Set to Filter; change them to abbreviations over the cofinite filter
hoelzl
parents:
59506
diff
changeset
|
256 |
lemma MOST_Suc_iff: "(MOST n. P (Suc n)) \<longleftrightarrow> (MOST n. P n)" |
1fa1023b13b9
move MOST and INFM in Infinite_Set to Filter; change them to abbreviations over the cofinite filter
hoelzl
parents:
59506
diff
changeset
|
257 |
by (simp add: cofinite_eq_sequentially eventually_sequentially_Suc) |
20809 | 258 |
|
60040
1fa1023b13b9
move MOST and INFM in Infinite_Set to Filter; change them to abbreviations over the cofinite filter
hoelzl
parents:
59506
diff
changeset
|
259 |
lemma |
1fa1023b13b9
move MOST and INFM in Infinite_Set to Filter; change them to abbreviations over the cofinite filter
hoelzl
parents:
59506
diff
changeset
|
260 |
shows MOST_SucI: "MOST n. P n \<Longrightarrow> MOST n. P (Suc n)" |
1fa1023b13b9
move MOST and INFM in Infinite_Set to Filter; change them to abbreviations over the cofinite filter
hoelzl
parents:
59506
diff
changeset
|
261 |
and MOST_SucD: "MOST n. P (Suc n) \<Longrightarrow> MOST n. P n" |
1fa1023b13b9
move MOST and INFM in Infinite_Set to Filter; change them to abbreviations over the cofinite filter
hoelzl
parents:
59506
diff
changeset
|
262 |
by (simp_all add: MOST_Suc_iff) |
1fa1023b13b9
move MOST and INFM in Infinite_Set to Filter; change them to abbreviations over the cofinite filter
hoelzl
parents:
59506
diff
changeset
|
263 |
|
1fa1023b13b9
move MOST and INFM in Infinite_Set to Filter; change them to abbreviations over the cofinite filter
hoelzl
parents:
59506
diff
changeset
|
264 |
lemma MOST_ge_nat: "MOST n::nat. m \<le> n" |
1fa1023b13b9
move MOST and INFM in Infinite_Set to Filter; change them to abbreviations over the cofinite filter
hoelzl
parents:
59506
diff
changeset
|
265 |
by (simp add: cofinite_eq_sequentially eventually_ge_at_top) |
20809 | 266 |
|
60040
1fa1023b13b9
move MOST and INFM in Infinite_Set to Filter; change them to abbreviations over the cofinite filter
hoelzl
parents:
59506
diff
changeset
|
267 |
(* legacy names *) |
1fa1023b13b9
move MOST and INFM in Infinite_Set to Filter; change them to abbreviations over the cofinite filter
hoelzl
parents:
59506
diff
changeset
|
268 |
lemma Inf_many_def: "Inf_many P \<longleftrightarrow> infinite {x. P x}" by (fact frequently_cofinite) |
1fa1023b13b9
move MOST and INFM in Infinite_Set to Filter; change them to abbreviations over the cofinite filter
hoelzl
parents:
59506
diff
changeset
|
269 |
lemma Alm_all_def: "Alm_all P \<longleftrightarrow> \<not> (INFM x. \<not> P x)" by simp |
1fa1023b13b9
move MOST and INFM in Infinite_Set to Filter; change them to abbreviations over the cofinite filter
hoelzl
parents:
59506
diff
changeset
|
270 |
lemma INFM_iff_infinite: "(INFM x. P x) \<longleftrightarrow> infinite {x. P x}" by (fact frequently_cofinite) |
1fa1023b13b9
move MOST and INFM in Infinite_Set to Filter; change them to abbreviations over the cofinite filter
hoelzl
parents:
59506
diff
changeset
|
271 |
lemma MOST_iff_cofinite: "(MOST x. P x) \<longleftrightarrow> finite {x. \<not> P x}" by (fact eventually_cofinite) |
1fa1023b13b9
move MOST and INFM in Infinite_Set to Filter; change them to abbreviations over the cofinite filter
hoelzl
parents:
59506
diff
changeset
|
272 |
lemma INFM_EX: "(\<exists>\<^sub>\<infinity>x. P x) \<Longrightarrow> (\<exists>x. P x)" by (fact frequently_ex) |
1fa1023b13b9
move MOST and INFM in Infinite_Set to Filter; change them to abbreviations over the cofinite filter
hoelzl
parents:
59506
diff
changeset
|
273 |
lemma ALL_MOST: "\<forall>x. P x \<Longrightarrow> \<forall>\<^sub>\<infinity>x. P x" by (fact always_eventually) |
1fa1023b13b9
move MOST and INFM in Infinite_Set to Filter; change them to abbreviations over the cofinite filter
hoelzl
parents:
59506
diff
changeset
|
274 |
lemma INFM_mono: "\<exists>\<^sub>\<infinity>x. P x \<Longrightarrow> (\<And>x. P x \<Longrightarrow> Q x) \<Longrightarrow> \<exists>\<^sub>\<infinity>x. Q x" by (fact frequently_elim1) |
1fa1023b13b9
move MOST and INFM in Infinite_Set to Filter; change them to abbreviations over the cofinite filter
hoelzl
parents:
59506
diff
changeset
|
275 |
lemma MOST_mono: "\<forall>\<^sub>\<infinity>x. P x \<Longrightarrow> (\<And>x. P x \<Longrightarrow> Q x) \<Longrightarrow> \<forall>\<^sub>\<infinity>x. Q x" by (fact eventually_elim1) |
1fa1023b13b9
move MOST and INFM in Infinite_Set to Filter; change them to abbreviations over the cofinite filter
hoelzl
parents:
59506
diff
changeset
|
276 |
lemma INFM_disj_distrib: "(\<exists>\<^sub>\<infinity>x. P x \<or> Q x) \<longleftrightarrow> (\<exists>\<^sub>\<infinity>x. P x) \<or> (\<exists>\<^sub>\<infinity>x. Q x)" by (fact frequently_disj_iff) |
1fa1023b13b9
move MOST and INFM in Infinite_Set to Filter; change them to abbreviations over the cofinite filter
hoelzl
parents:
59506
diff
changeset
|
277 |
lemma MOST_rev_mp: "\<forall>\<^sub>\<infinity>x. P x \<Longrightarrow> \<forall>\<^sub>\<infinity>x. P x \<longrightarrow> Q x \<Longrightarrow> \<forall>\<^sub>\<infinity>x. Q x" by (fact eventually_rev_mp) |
1fa1023b13b9
move MOST and INFM in Infinite_Set to Filter; change them to abbreviations over the cofinite filter
hoelzl
parents:
59506
diff
changeset
|
278 |
lemma MOST_conj_distrib: "(\<forall>\<^sub>\<infinity>x. P x \<and> Q x) \<longleftrightarrow> (\<forall>\<^sub>\<infinity>x. P x) \<and> (\<forall>\<^sub>\<infinity>x. Q x)" by (fact eventually_conj_iff) |
1fa1023b13b9
move MOST and INFM in Infinite_Set to Filter; change them to abbreviations over the cofinite filter
hoelzl
parents:
59506
diff
changeset
|
279 |
lemma MOST_conjI: "MOST x. P x \<Longrightarrow> MOST x. Q x \<Longrightarrow> MOST x. P x \<and> Q x" by (fact eventually_conj) |
1fa1023b13b9
move MOST and INFM in Infinite_Set to Filter; change them to abbreviations over the cofinite filter
hoelzl
parents:
59506
diff
changeset
|
280 |
lemma INFM_finite_Bex_distrib: "finite A \<Longrightarrow> (INFM y. \<exists>x\<in>A. P x y) \<longleftrightarrow> (\<exists>x\<in>A. INFM y. P x y)" by (fact frequently_bex_finite_distrib) |
1fa1023b13b9
move MOST and INFM in Infinite_Set to Filter; change them to abbreviations over the cofinite filter
hoelzl
parents:
59506
diff
changeset
|
281 |
lemma MOST_finite_Ball_distrib: "finite A \<Longrightarrow> (MOST y. \<forall>x\<in>A. P x y) \<longleftrightarrow> (\<forall>x\<in>A. MOST y. P x y)" by (fact eventually_ball_finite_distrib) |
1fa1023b13b9
move MOST and INFM in Infinite_Set to Filter; change them to abbreviations over the cofinite filter
hoelzl
parents:
59506
diff
changeset
|
282 |
lemma INFM_E: "INFM x. P x \<Longrightarrow> (\<And>x. P x \<Longrightarrow> thesis) \<Longrightarrow> thesis" by (fact frequentlyE) |
1fa1023b13b9
move MOST and INFM in Infinite_Set to Filter; change them to abbreviations over the cofinite filter
hoelzl
parents:
59506
diff
changeset
|
283 |
lemma MOST_I: "(\<And>x. P x) \<Longrightarrow> MOST x. P x" by (rule eventuallyI) |
1fa1023b13b9
move MOST and INFM in Infinite_Set to Filter; change them to abbreviations over the cofinite filter
hoelzl
parents:
59506
diff
changeset
|
284 |
lemmas MOST_iff_finiteNeg = MOST_iff_cofinite |
20809 | 285 |
|
286 |
subsection "Enumeration of an Infinite Set" |
|
287 |
||
60500 | 288 |
text \<open> |
20809 | 289 |
The set's element type must be wellordered (e.g. the natural numbers). |
60500 | 290 |
\<close> |
20809 | 291 |
|
60040
1fa1023b13b9
move MOST and INFM in Infinite_Set to Filter; change them to abbreviations over the cofinite filter
hoelzl
parents:
59506
diff
changeset
|
292 |
text \<open> |
1fa1023b13b9
move MOST and INFM in Infinite_Set to Filter; change them to abbreviations over the cofinite filter
hoelzl
parents:
59506
diff
changeset
|
293 |
Could be generalized to |
1fa1023b13b9
move MOST and INFM in Infinite_Set to Filter; change them to abbreviations over the cofinite filter
hoelzl
parents:
59506
diff
changeset
|
294 |
@{term "enumerate' S n = (SOME t. t \<in> s \<and> finite {s\<in>S. s < t} \<and> card {s\<in>S. s < t} = n)"}. |
1fa1023b13b9
move MOST and INFM in Infinite_Set to Filter; change them to abbreviations over the cofinite filter
hoelzl
parents:
59506
diff
changeset
|
295 |
\<close> |
1fa1023b13b9
move MOST and INFM in Infinite_Set to Filter; change them to abbreviations over the cofinite filter
hoelzl
parents:
59506
diff
changeset
|
296 |
|
53239 | 297 |
primrec (in wellorder) enumerate :: "'a set \<Rightarrow> nat \<Rightarrow> 'a" |
298 |
where |
|
299 |
enumerate_0: "enumerate S 0 = (LEAST n. n \<in> S)" |
|
300 |
| enumerate_Suc: "enumerate S (Suc n) = enumerate (S - {LEAST n. n \<in> S}) n" |
|
20809 | 301 |
|
53239 | 302 |
lemma enumerate_Suc': "enumerate S (Suc n) = enumerate (S - {enumerate S 0}) n" |
20809 | 303 |
by simp |
304 |
||
60040
1fa1023b13b9
move MOST and INFM in Infinite_Set to Filter; change them to abbreviations over the cofinite filter
hoelzl
parents:
59506
diff
changeset
|
305 |
lemma enumerate_in_set: "infinite S \<Longrightarrow> enumerate S n \<in> S" |
53239 | 306 |
apply (induct n arbitrary: S) |
307 |
apply (fastforce intro: LeastI dest!: infinite_imp_nonempty) |
|
308 |
apply simp |
|
309 |
apply (metis DiffE infinite_remove) |
|
310 |
done |
|
20809 | 311 |
|
312 |
declare enumerate_0 [simp del] enumerate_Suc [simp del] |
|
313 |
||
314 |
lemma enumerate_step: "infinite S \<Longrightarrow> enumerate S n < enumerate S (Suc n)" |
|
315 |
apply (induct n arbitrary: S) |
|
316 |
apply (rule order_le_neq_trans) |
|
317 |
apply (simp add: enumerate_0 Least_le enumerate_in_set) |
|
318 |
apply (simp only: enumerate_Suc') |
|
60040
1fa1023b13b9
move MOST and INFM in Infinite_Set to Filter; change them to abbreviations over the cofinite filter
hoelzl
parents:
59506
diff
changeset
|
319 |
apply (subgoal_tac "enumerate (S - {enumerate S 0}) 0 \<in> S - {enumerate S 0}") |
20809 | 320 |
apply (blast intro: sym) |
321 |
apply (simp add: enumerate_in_set del: Diff_iff) |
|
322 |
apply (simp add: enumerate_Suc') |
|
323 |
done |
|
324 |
||
60040
1fa1023b13b9
move MOST and INFM in Infinite_Set to Filter; change them to abbreviations over the cofinite filter
hoelzl
parents:
59506
diff
changeset
|
325 |
lemma enumerate_mono: "m < n \<Longrightarrow> infinite S \<Longrightarrow> enumerate S m < enumerate S n" |
20809 | 326 |
apply (erule less_Suc_induct) |
327 |
apply (auto intro: enumerate_step) |
|
328 |
done |
|
329 |
||
330 |
||
50134 | 331 |
lemma le_enumerate: |
332 |
assumes S: "infinite S" |
|
333 |
shows "n \<le> enumerate S n" |
|
334 |
using S |
|
335 |
proof (induct n) |
|
53239 | 336 |
case 0 |
337 |
then show ?case by simp |
|
338 |
next |
|
50134 | 339 |
case (Suc n) |
340 |
then have "n \<le> enumerate S n" by simp |
|
60500 | 341 |
also note enumerate_mono[of n "Suc n", OF _ \<open>infinite S\<close>] |
50134 | 342 |
finally show ?case by simp |
53239 | 343 |
qed |
50134 | 344 |
|
345 |
lemma enumerate_Suc'': |
|
346 |
fixes S :: "'a::wellorder set" |
|
53239 | 347 |
assumes "infinite S" |
348 |
shows "enumerate S (Suc n) = (LEAST s. s \<in> S \<and> enumerate S n < s)" |
|
349 |
using assms |
|
50134 | 350 |
proof (induct n arbitrary: S) |
351 |
case 0 |
|
53239 | 352 |
then have "\<forall>s \<in> S. enumerate S 0 \<le> s" |
50134 | 353 |
by (auto simp: enumerate.simps intro: Least_le) |
354 |
then show ?case |
|
355 |
unfolding enumerate_Suc' enumerate_0[of "S - {enumerate S 0}"] |
|
53239 | 356 |
by (intro arg_cong[where f = Least] ext) auto |
50134 | 357 |
next |
358 |
case (Suc n S) |
|
359 |
show ?case |
|
60500 | 360 |
using enumerate_mono[OF zero_less_Suc \<open>infinite S\<close>, of n] \<open>infinite S\<close> |
50134 | 361 |
apply (subst (1 2) enumerate_Suc') |
362 |
apply (subst Suc) |
|
60500 | 363 |
using \<open>infinite S\<close> |
53239 | 364 |
apply simp |
365 |
apply (intro arg_cong[where f = Least] ext) |
|
366 |
apply (auto simp: enumerate_Suc'[symmetric]) |
|
367 |
done |
|
50134 | 368 |
qed |
369 |
||
370 |
lemma enumerate_Ex: |
|
371 |
assumes S: "infinite (S::nat set)" |
|
372 |
shows "s \<in> S \<Longrightarrow> \<exists>n. enumerate S n = s" |
|
373 |
proof (induct s rule: less_induct) |
|
374 |
case (less s) |
|
375 |
show ?case |
|
376 |
proof cases |
|
377 |
let ?y = "Max {s'\<in>S. s' < s}" |
|
378 |
assume "\<exists>y\<in>S. y < s" |
|
53239 | 379 |
then have y: "\<And>x. ?y < x \<longleftrightarrow> (\<forall>s'\<in>S. s' < s \<longrightarrow> s' < x)" |
380 |
by (subst Max_less_iff) auto |
|
381 |
then have y_in: "?y \<in> {s'\<in>S. s' < s}" |
|
382 |
by (intro Max_in) auto |
|
383 |
with less.hyps[of ?y] obtain n where "enumerate S n = ?y" |
|
384 |
by auto |
|
50134 | 385 |
with S have "enumerate S (Suc n) = s" |
386 |
by (auto simp: y less enumerate_Suc'' intro!: Least_equality) |
|
387 |
then show ?case by auto |
|
388 |
next |
|
389 |
assume *: "\<not> (\<exists>y\<in>S. y < s)" |
|
390 |
then have "\<forall>t\<in>S. s \<le> t" by auto |
|
60500 | 391 |
with \<open>s \<in> S\<close> show ?thesis |
50134 | 392 |
by (auto intro!: exI[of _ 0] Least_equality simp: enumerate_0) |
393 |
qed |
|
394 |
qed |
|
395 |
||
396 |
lemma bij_enumerate: |
|
397 |
fixes S :: "nat set" |
|
398 |
assumes S: "infinite S" |
|
399 |
shows "bij_betw (enumerate S) UNIV S" |
|
400 |
proof - |
|
401 |
have "\<And>n m. n \<noteq> m \<Longrightarrow> enumerate S n \<noteq> enumerate S m" |
|
60500 | 402 |
using enumerate_mono[OF _ \<open>infinite S\<close>] by (auto simp: neq_iff) |
50134 | 403 |
then have "inj (enumerate S)" |
404 |
by (auto simp: inj_on_def) |
|
53239 | 405 |
moreover have "\<forall>s \<in> S. \<exists>i. enumerate S i = s" |
50134 | 406 |
using enumerate_Ex[OF S] by auto |
60500 | 407 |
moreover note \<open>infinite S\<close> |
50134 | 408 |
ultimately show ?thesis |
409 |
unfolding bij_betw_def by (auto intro: enumerate_in_set) |
|
410 |
qed |
|
411 |
||
20809 | 412 |
end |
54612
7e291ae244ea
Backed out changeset: a8ad7f6dd217---bypassing Main breaks theories that use \<inf> or \<sup>
traytel
parents:
54607
diff
changeset
|
413 |