author | wenzelm |
Sun, 10 Dec 2006 19:37:27 +0100 | |
changeset 21756 | 09f62e99859e |
parent 21404 | eb85850d3eb7 |
child 22226 | 699385e6cb45 |
permissions | -rw-r--r-- |
20809 | 1 |
(* Title: HOL/Infnite_Set.thy |
2 |
ID: $Id$ |
|
3 |
Author: Stephan Merz |
|
4 |
*) |
|
5 |
||
6 |
header {* Infinite Sets and Related Concepts *} |
|
7 |
||
8 |
theory Infinite_Set |
|
21256 | 9 |
imports Main |
20809 | 10 |
begin |
11 |
||
12 |
subsection "Infinite Sets" |
|
13 |
||
14 |
text {* |
|
15 |
Some elementary facts about infinite sets, mostly by Stefan Merz. |
|
16 |
Beware! Because "infinite" merely abbreviates a negation, these |
|
17 |
lemmas may not work well with @{text "blast"}. |
|
18 |
*} |
|
19 |
||
20 |
abbreviation |
|
21404
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21256
diff
changeset
|
21 |
infinite :: "'a set \<Rightarrow> bool" where |
20809 | 22 |
"infinite S == \<not> finite S" |
23 |
||
24 |
text {* |
|
25 |
Infinite sets are non-empty, and if we remove some elements from an |
|
26 |
infinite set, the result is still infinite. |
|
27 |
*} |
|
28 |
||
29 |
lemma infinite_imp_nonempty: "infinite S ==> S \<noteq> {}" |
|
30 |
by auto |
|
31 |
||
32 |
lemma infinite_remove: |
|
33 |
"infinite S \<Longrightarrow> infinite (S - {a})" |
|
34 |
by simp |
|
35 |
||
36 |
lemma Diff_infinite_finite: |
|
37 |
assumes T: "finite T" and S: "infinite S" |
|
38 |
shows "infinite (S - T)" |
|
39 |
using T |
|
40 |
proof induct |
|
41 |
from S |
|
42 |
show "infinite (S - {})" by auto |
|
43 |
next |
|
44 |
fix T x |
|
45 |
assume ih: "infinite (S - T)" |
|
46 |
have "S - (insert x T) = (S - T) - {x}" |
|
47 |
by (rule Diff_insert) |
|
48 |
with ih |
|
49 |
show "infinite (S - (insert x T))" |
|
50 |
by (simp add: infinite_remove) |
|
51 |
qed |
|
52 |
||
53 |
lemma Un_infinite: "infinite S \<Longrightarrow> infinite (S \<union> T)" |
|
54 |
by simp |
|
55 |
||
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 |
||
65 |
text {* |
|
66 |
As a concrete example, we prove that the set of natural numbers is |
|
67 |
infinite. |
|
68 |
*} |
|
69 |
||
70 |
lemma finite_nat_bounded: |
|
71 |
assumes S: "finite (S::nat set)" |
|
72 |
shows "\<exists>k. S \<subseteq> {..<k}" (is "\<exists>k. ?bounded S k") |
|
73 |
using S |
|
74 |
proof induct |
|
75 |
have "?bounded {} 0" by simp |
|
76 |
then show "\<exists>k. ?bounded {} k" .. |
|
77 |
next |
|
78 |
fix S x |
|
79 |
assume "\<exists>k. ?bounded S k" |
|
80 |
then obtain k where k: "?bounded S k" .. |
|
81 |
show "\<exists>k. ?bounded (insert x S) k" |
|
82 |
proof (cases "x < k") |
|
83 |
case True |
|
84 |
with k show ?thesis by auto |
|
85 |
next |
|
86 |
case False |
|
87 |
with k have "?bounded S (Suc x)" by auto |
|
88 |
then show ?thesis by auto |
|
89 |
qed |
|
90 |
qed |
|
91 |
||
92 |
lemma finite_nat_iff_bounded: |
|
93 |
"finite (S::nat set) = (\<exists>k. S \<subseteq> {..<k})" (is "?lhs = ?rhs") |
|
94 |
proof |
|
95 |
assume ?lhs |
|
96 |
then show ?rhs by (rule finite_nat_bounded) |
|
97 |
next |
|
98 |
assume ?rhs |
|
99 |
then obtain k where "S \<subseteq> {..<k}" .. |
|
100 |
then show "finite S" |
|
101 |
by (rule finite_subset) simp |
|
102 |
qed |
|
103 |
||
104 |
lemma finite_nat_iff_bounded_le: |
|
105 |
"finite (S::nat set) = (\<exists>k. S \<subseteq> {..k})" (is "?lhs = ?rhs") |
|
106 |
proof |
|
107 |
assume ?lhs |
|
108 |
then obtain k where "S \<subseteq> {..<k}" |
|
109 |
by (blast dest: finite_nat_bounded) |
|
110 |
then have "S \<subseteq> {..k}" by auto |
|
111 |
then show ?rhs .. |
|
112 |
next |
|
113 |
assume ?rhs |
|
114 |
then obtain k where "S \<subseteq> {..k}" .. |
|
115 |
then show "finite S" |
|
116 |
by (rule finite_subset) simp |
|
117 |
qed |
|
118 |
||
119 |
lemma infinite_nat_iff_unbounded: |
|
120 |
"infinite (S::nat set) = (\<forall>m. \<exists>n. m<n \<and> n\<in>S)" |
|
121 |
(is "?lhs = ?rhs") |
|
122 |
proof |
|
123 |
assume ?lhs |
|
124 |
show ?rhs |
|
125 |
proof (rule ccontr) |
|
126 |
assume "\<not> ?rhs" |
|
127 |
then obtain m where m: "\<forall>n. m<n \<longrightarrow> n\<notin>S" by blast |
|
128 |
then have "S \<subseteq> {..m}" |
|
129 |
by (auto simp add: sym [OF linorder_not_less]) |
|
130 |
with `?lhs` show False |
|
131 |
by (simp add: finite_nat_iff_bounded_le) |
|
132 |
qed |
|
133 |
next |
|
134 |
assume ?rhs |
|
135 |
show ?lhs |
|
136 |
proof |
|
137 |
assume "finite S" |
|
138 |
then obtain m where "S \<subseteq> {..m}" |
|
139 |
by (auto simp add: finite_nat_iff_bounded_le) |
|
140 |
then have "\<forall>n. m<n \<longrightarrow> n\<notin>S" by auto |
|
141 |
with `?rhs` show False by blast |
|
142 |
qed |
|
143 |
qed |
|
144 |
||
145 |
lemma infinite_nat_iff_unbounded_le: |
|
146 |
"infinite (S::nat set) = (\<forall>m. \<exists>n. m\<le>n \<and> n\<in>S)" |
|
147 |
(is "?lhs = ?rhs") |
|
148 |
proof |
|
149 |
assume ?lhs |
|
150 |
show ?rhs |
|
151 |
proof |
|
152 |
fix m |
|
153 |
from `?lhs` obtain n where "m<n \<and> n\<in>S" |
|
154 |
by (auto simp add: infinite_nat_iff_unbounded) |
|
155 |
then have "m\<le>n \<and> n\<in>S" by simp |
|
156 |
then show "\<exists>n. m \<le> n \<and> n \<in> S" .. |
|
157 |
qed |
|
158 |
next |
|
159 |
assume ?rhs |
|
160 |
show ?lhs |
|
161 |
proof (auto simp add: infinite_nat_iff_unbounded) |
|
162 |
fix m |
|
163 |
from `?rhs` obtain n where "Suc m \<le> n \<and> n\<in>S" |
|
164 |
by blast |
|
165 |
then have "m<n \<and> n\<in>S" by simp |
|
166 |
then show "\<exists>n. m < n \<and> n \<in> S" .. |
|
167 |
qed |
|
168 |
qed |
|
169 |
||
170 |
text {* |
|
171 |
For a set of natural numbers to be infinite, it is enough to know |
|
172 |
that for any number larger than some @{text k}, there is some larger |
|
173 |
number that is an element of the set. |
|
174 |
*} |
|
175 |
||
176 |
lemma unbounded_k_infinite: |
|
177 |
assumes k: "\<forall>m. k<m \<longrightarrow> (\<exists>n. m<n \<and> n\<in>S)" |
|
178 |
shows "infinite (S::nat set)" |
|
179 |
proof - |
|
180 |
{ |
|
181 |
fix m have "\<exists>n. m<n \<and> n\<in>S" |
|
182 |
proof (cases "k<m") |
|
183 |
case True |
|
184 |
with k show ?thesis by blast |
|
185 |
next |
|
186 |
case False |
|
187 |
from k obtain n where "Suc k < n \<and> n\<in>S" by auto |
|
188 |
with False have "m<n \<and> n\<in>S" by auto |
|
189 |
then show ?thesis .. |
|
190 |
qed |
|
191 |
} |
|
192 |
then show ?thesis |
|
193 |
by (auto simp add: infinite_nat_iff_unbounded) |
|
194 |
qed |
|
195 |
||
196 |
lemma nat_infinite [simp]: "infinite (UNIV :: nat set)" |
|
197 |
by (auto simp add: infinite_nat_iff_unbounded) |
|
198 |
||
199 |
lemma nat_not_finite [elim]: "finite (UNIV::nat set) \<Longrightarrow> R" |
|
200 |
by simp |
|
201 |
||
202 |
text {* |
|
203 |
Every infinite set contains a countable subset. More precisely we |
|
204 |
show that a set @{text S} is infinite if and only if there exists an |
|
205 |
injective function from the naturals into @{text S}. |
|
206 |
*} |
|
207 |
||
208 |
lemma range_inj_infinite: |
|
209 |
"inj (f::nat \<Rightarrow> 'a) \<Longrightarrow> infinite (range f)" |
|
210 |
proof |
|
211 |
assume "inj f" |
|
212 |
and "finite (range f)" |
|
213 |
then have "finite (UNIV::nat set)" |
|
214 |
by (auto intro: finite_imageD simp del: nat_infinite) |
|
215 |
then show False by simp |
|
216 |
qed |
|
217 |
||
218 |
text {* |
|
219 |
The ``only if'' direction is harder because it requires the |
|
220 |
construction of a sequence of pairwise different elements of an |
|
221 |
infinite set @{text S}. The idea is to construct a sequence of |
|
222 |
non-empty and infinite subsets of @{text S} obtained by successively |
|
223 |
removing elements of @{text S}. |
|
224 |
*} |
|
225 |
||
226 |
lemma linorder_injI: |
|
227 |
assumes hyp: "!!x y. x < (y::'a::linorder) ==> f x \<noteq> f y" |
|
228 |
shows "inj f" |
|
229 |
proof (rule inj_onI) |
|
230 |
fix x y |
|
231 |
assume f_eq: "f x = f y" |
|
232 |
show "x = y" |
|
233 |
proof (rule linorder_cases) |
|
234 |
assume "x < y" |
|
235 |
with hyp have "f x \<noteq> f y" by blast |
|
236 |
with f_eq show ?thesis by simp |
|
237 |
next |
|
238 |
assume "x = y" |
|
239 |
then show ?thesis . |
|
240 |
next |
|
241 |
assume "y < x" |
|
242 |
with hyp have "f y \<noteq> f x" by blast |
|
243 |
with f_eq show ?thesis by simp |
|
244 |
qed |
|
245 |
qed |
|
246 |
||
247 |
lemma infinite_countable_subset: |
|
248 |
assumes inf: "infinite (S::'a set)" |
|
249 |
shows "\<exists>f. inj (f::nat \<Rightarrow> 'a) \<and> range f \<subseteq> S" |
|
250 |
proof - |
|
251 |
def Sseq \<equiv> "nat_rec S (\<lambda>n T. T - {SOME e. e \<in> T})" |
|
252 |
def pick \<equiv> "\<lambda>n. (SOME e. e \<in> Sseq n)" |
|
253 |
have Sseq_inf: "\<And>n. infinite (Sseq n)" |
|
254 |
proof - |
|
255 |
fix n |
|
256 |
show "infinite (Sseq n)" |
|
257 |
proof (induct n) |
|
258 |
from inf show "infinite (Sseq 0)" |
|
259 |
by (simp add: Sseq_def) |
|
260 |
next |
|
261 |
fix n |
|
262 |
assume "infinite (Sseq n)" then show "infinite (Sseq (Suc n))" |
|
263 |
by (simp add: Sseq_def infinite_remove) |
|
264 |
qed |
|
265 |
qed |
|
266 |
have Sseq_S: "\<And>n. Sseq n \<subseteq> S" |
|
267 |
proof - |
|
268 |
fix n |
|
269 |
show "Sseq n \<subseteq> S" |
|
270 |
by (induct n) (auto simp add: Sseq_def) |
|
271 |
qed |
|
272 |
have Sseq_pick: "\<And>n. pick n \<in> Sseq n" |
|
273 |
proof - |
|
274 |
fix n |
|
275 |
show "pick n \<in> Sseq n" |
|
276 |
proof (unfold pick_def, rule someI_ex) |
|
277 |
from Sseq_inf have "infinite (Sseq n)" . |
|
278 |
then have "Sseq n \<noteq> {}" by auto |
|
279 |
then show "\<exists>x. x \<in> Sseq n" by auto |
|
280 |
qed |
|
281 |
qed |
|
282 |
with Sseq_S have rng: "range pick \<subseteq> S" |
|
283 |
by auto |
|
284 |
have pick_Sseq_gt: "\<And>n m. pick n \<notin> Sseq (n + Suc m)" |
|
285 |
proof - |
|
286 |
fix n m |
|
287 |
show "pick n \<notin> Sseq (n + Suc m)" |
|
288 |
by (induct m) (auto simp add: Sseq_def pick_def) |
|
289 |
qed |
|
290 |
have pick_pick: "\<And>n m. pick n \<noteq> pick (n + Suc m)" |
|
291 |
proof - |
|
292 |
fix n m |
|
293 |
from Sseq_pick have "pick (n + Suc m) \<in> Sseq (n + Suc m)" . |
|
294 |
moreover from pick_Sseq_gt |
|
295 |
have "pick n \<notin> Sseq (n + Suc m)" . |
|
296 |
ultimately show "pick n \<noteq> pick (n + Suc m)" |
|
297 |
by auto |
|
298 |
qed |
|
299 |
have inj: "inj pick" |
|
300 |
proof (rule linorder_injI) |
|
301 |
fix i j :: nat |
|
302 |
assume "i < j" |
|
303 |
show "pick i \<noteq> pick j" |
|
304 |
proof |
|
305 |
assume eq: "pick i = pick j" |
|
306 |
from `i < j` obtain k where "j = i + Suc k" |
|
307 |
by (auto simp add: less_iff_Suc_add) |
|
308 |
with pick_pick have "pick i \<noteq> pick j" by simp |
|
309 |
with eq show False by simp |
|
310 |
qed |
|
311 |
qed |
|
312 |
from rng inj show ?thesis by auto |
|
313 |
qed |
|
314 |
||
315 |
lemma infinite_iff_countable_subset: |
|
316 |
"infinite S = (\<exists>f. inj (f::nat \<Rightarrow> 'a) \<and> range f \<subseteq> S)" |
|
317 |
by (auto simp add: infinite_countable_subset range_inj_infinite infinite_super) |
|
318 |
||
319 |
text {* |
|
320 |
For any function with infinite domain and finite range there is some |
|
321 |
element that is the image of infinitely many domain elements. In |
|
322 |
particular, any infinite sequence of elements from a finite set |
|
323 |
contains some element that occurs infinitely often. |
|
324 |
*} |
|
325 |
||
326 |
lemma inf_img_fin_dom: |
|
327 |
assumes img: "finite (f`A)" and dom: "infinite A" |
|
328 |
shows "\<exists>y \<in> f`A. infinite (f -` {y})" |
|
329 |
proof (rule ccontr) |
|
330 |
assume "\<not> ?thesis" |
|
331 |
with img have "finite (UN y:f`A. f -` {y})" by (blast intro: finite_UN_I) |
|
332 |
moreover have "A \<subseteq> (UN y:f`A. f -` {y})" by auto |
|
333 |
moreover note dom |
|
334 |
ultimately show False by (simp add: infinite_super) |
|
335 |
qed |
|
336 |
||
337 |
lemma inf_img_fin_domE: |
|
338 |
assumes "finite (f`A)" and "infinite A" |
|
339 |
obtains y where "y \<in> f`A" and "infinite (f -` {y})" |
|
340 |
using prems by (blast dest: inf_img_fin_dom) |
|
341 |
||
342 |
||
343 |
subsection "Infinitely Many and Almost All" |
|
344 |
||
345 |
text {* |
|
346 |
We often need to reason about the existence of infinitely many |
|
347 |
(resp., all but finitely many) objects satisfying some predicate, so |
|
348 |
we introduce corresponding binders and their proof rules. |
|
349 |
*} |
|
350 |
||
351 |
definition |
|
21404
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21256
diff
changeset
|
352 |
Inf_many :: "('a \<Rightarrow> bool) \<Rightarrow> bool" (binder "INF " 10) where |
20809 | 353 |
"Inf_many P = infinite {x. P x}" |
21404
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21256
diff
changeset
|
354 |
|
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21256
diff
changeset
|
355 |
definition |
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21256
diff
changeset
|
356 |
Alm_all :: "('a \<Rightarrow> bool) \<Rightarrow> bool" (binder "MOST " 10) where |
20809 | 357 |
"Alm_all P = (\<not> (INF x. \<not> P x))" |
358 |
||
21210 | 359 |
notation (xsymbols) |
21404
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21256
diff
changeset
|
360 |
Inf_many (binder "\<exists>\<^sub>\<infinity>" 10) and |
20809 | 361 |
Alm_all (binder "\<forall>\<^sub>\<infinity>" 10) |
362 |
||
21210 | 363 |
notation (HTML output) |
21404
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21256
diff
changeset
|
364 |
Inf_many (binder "\<exists>\<^sub>\<infinity>" 10) and |
20809 | 365 |
Alm_all (binder "\<forall>\<^sub>\<infinity>" 10) |
366 |
||
367 |
lemma INF_EX: |
|
368 |
"(\<exists>\<^sub>\<infinity>x. P x) \<Longrightarrow> (\<exists>x. P x)" |
|
369 |
unfolding Inf_many_def |
|
370 |
proof (rule ccontr) |
|
371 |
assume inf: "infinite {x. P x}" |
|
372 |
assume "\<not> ?thesis" then have "{x. P x} = {}" by simp |
|
373 |
then have "finite {x. P x}" by simp |
|
374 |
with inf show False by simp |
|
375 |
qed |
|
376 |
||
377 |
lemma MOST_iff_finiteNeg: "(\<forall>\<^sub>\<infinity>x. P x) = finite {x. \<not> P x}" |
|
378 |
by (simp add: Alm_all_def Inf_many_def) |
|
379 |
||
380 |
lemma ALL_MOST: "\<forall>x. P x \<Longrightarrow> \<forall>\<^sub>\<infinity>x. P x" |
|
381 |
by (simp add: MOST_iff_finiteNeg) |
|
382 |
||
383 |
lemma INF_mono: |
|
384 |
assumes inf: "\<exists>\<^sub>\<infinity>x. P x" and q: "\<And>x. P x \<Longrightarrow> Q x" |
|
385 |
shows "\<exists>\<^sub>\<infinity>x. Q x" |
|
386 |
proof - |
|
387 |
from inf have "infinite {x. P x}" unfolding Inf_many_def . |
|
388 |
moreover from q have "{x. P x} \<subseteq> {x. Q x}" by auto |
|
389 |
ultimately show ?thesis |
|
390 |
by (simp add: Inf_many_def infinite_super) |
|
391 |
qed |
|
392 |
||
393 |
lemma MOST_mono: "\<forall>\<^sub>\<infinity>x. P x \<Longrightarrow> (\<And>x. P x \<Longrightarrow> Q x) \<Longrightarrow> \<forall>\<^sub>\<infinity>x. Q x" |
|
394 |
unfolding Alm_all_def by (blast intro: INF_mono) |
|
395 |
||
396 |
lemma INF_nat: "(\<exists>\<^sub>\<infinity>n. P (n::nat)) = (\<forall>m. \<exists>n. m<n \<and> P n)" |
|
397 |
by (simp add: Inf_many_def infinite_nat_iff_unbounded) |
|
398 |
||
399 |
lemma INF_nat_le: "(\<exists>\<^sub>\<infinity>n. P (n::nat)) = (\<forall>m. \<exists>n. m\<le>n \<and> P n)" |
|
400 |
by (simp add: Inf_many_def infinite_nat_iff_unbounded_le) |
|
401 |
||
402 |
lemma MOST_nat: "(\<forall>\<^sub>\<infinity>n. P (n::nat)) = (\<exists>m. \<forall>n. m<n \<longrightarrow> P n)" |
|
403 |
by (simp add: Alm_all_def INF_nat) |
|
404 |
||
405 |
lemma MOST_nat_le: "(\<forall>\<^sub>\<infinity>n. P (n::nat)) = (\<exists>m. \<forall>n. m\<le>n \<longrightarrow> P n)" |
|
406 |
by (simp add: Alm_all_def INF_nat_le) |
|
407 |
||
408 |
||
409 |
subsection "Enumeration of an Infinite Set" |
|
410 |
||
411 |
text {* |
|
412 |
The set's element type must be wellordered (e.g. the natural numbers). |
|
413 |
*} |
|
414 |
||
415 |
consts |
|
416 |
enumerate :: "'a::wellorder set => (nat => 'a::wellorder)" |
|
417 |
primrec |
|
418 |
enumerate_0: "enumerate S 0 = (LEAST n. n \<in> S)" |
|
419 |
enumerate_Suc: "enumerate S (Suc n) = enumerate (S - {LEAST n. n \<in> S}) n" |
|
420 |
||
421 |
lemma enumerate_Suc': |
|
422 |
"enumerate S (Suc n) = enumerate (S - {enumerate S 0}) n" |
|
423 |
by simp |
|
424 |
||
425 |
lemma enumerate_in_set: "infinite S \<Longrightarrow> enumerate S n : S" |
|
426 |
apply (induct n arbitrary: S) |
|
427 |
apply (fastsimp intro: LeastI dest!: infinite_imp_nonempty) |
|
428 |
apply (fastsimp iff: finite_Diff_singleton) |
|
429 |
done |
|
430 |
||
431 |
declare enumerate_0 [simp del] enumerate_Suc [simp del] |
|
432 |
||
433 |
lemma enumerate_step: "infinite S \<Longrightarrow> enumerate S n < enumerate S (Suc n)" |
|
434 |
apply (induct n arbitrary: S) |
|
435 |
apply (rule order_le_neq_trans) |
|
436 |
apply (simp add: enumerate_0 Least_le enumerate_in_set) |
|
437 |
apply (simp only: enumerate_Suc') |
|
438 |
apply (subgoal_tac "enumerate (S - {enumerate S 0}) 0 : S - {enumerate S 0}") |
|
439 |
apply (blast intro: sym) |
|
440 |
apply (simp add: enumerate_in_set del: Diff_iff) |
|
441 |
apply (simp add: enumerate_Suc') |
|
442 |
done |
|
443 |
||
444 |
lemma enumerate_mono: "m<n \<Longrightarrow> infinite S \<Longrightarrow> enumerate S m < enumerate S n" |
|
445 |
apply (erule less_Suc_induct) |
|
446 |
apply (auto intro: enumerate_step) |
|
447 |
done |
|
448 |
||
449 |
||
450 |
subsection "Miscellaneous" |
|
451 |
||
452 |
text {* |
|
453 |
A few trivial lemmas about sets that contain at most one element. |
|
454 |
These simplify the reasoning about deterministic automata. |
|
455 |
*} |
|
456 |
||
457 |
definition |
|
21404
eb85850d3eb7
more robust syntax for definition/abbreviation/notation;
wenzelm
parents:
21256
diff
changeset
|
458 |
atmost_one :: "'a set \<Rightarrow> bool" where |
20809 | 459 |
"atmost_one S = (\<forall>x y. x\<in>S \<and> y\<in>S \<longrightarrow> x=y)" |
460 |
||
461 |
lemma atmost_one_empty: "S = {} \<Longrightarrow> atmost_one S" |
|
462 |
by (simp add: atmost_one_def) |
|
463 |
||
464 |
lemma atmost_one_singleton: "S = {x} \<Longrightarrow> atmost_one S" |
|
465 |
by (simp add: atmost_one_def) |
|
466 |
||
467 |
lemma atmost_one_unique [elim]: "atmost_one S \<Longrightarrow> x \<in> S \<Longrightarrow> y \<in> S \<Longrightarrow> y = x" |
|
468 |
by (simp add: atmost_one_def) |
|
469 |
||
470 |
end |