src/HOL/Infinite_Set.thy
author paulson
Tue, 13 Jun 2006 15:07:47 +0200
changeset 19869 eba1b9e7c458
parent 19656 09be06943252
child 19893 7546dafb3fc6
permissions -rw-r--r--
removal of the obsolete "infinite_nonempty"
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
14442
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
     1
(*  Title:      HOL/Infnite_Set.thy
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
     2
    ID:         $Id$
14896
985133486546 tuned comment;
wenzelm
parents: 14766
diff changeset
     3
    Author:     Stephan Merz 
14442
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
     4
*)
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
     5
19457
b6eb4b4546fa fixed typo
haftmann
parents: 19363
diff changeset
     6
header {* Infinite Sets and Related Concepts*}
14442
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
     7
15131
c69542757a4d New theory header syntax.
nipkow
parents: 15045
diff changeset
     8
theory Infinite_Set
16733
236dfafbeb63 linear arithmetic now takes "&" in assumptions apart.
nipkow
parents: 15140
diff changeset
     9
imports Hilbert_Choice Binomial
15131
c69542757a4d New theory header syntax.
nipkow
parents: 15045
diff changeset
    10
begin
14442
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
    11
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
    12
subsection "Infinite Sets"
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
    13
19869
eba1b9e7c458 removal of the obsolete "infinite_nonempty"
paulson
parents: 19656
diff changeset
    14
text {* Some elementary facts about infinite sets, mostly by Stefan Merz.
eba1b9e7c458 removal of the obsolete "infinite_nonempty"
paulson
parents: 19656
diff changeset
    15
Beware! Because "infinite" merely abbreviates a negation, these lemmas may
eba1b9e7c458 removal of the obsolete "infinite_nonempty"
paulson
parents: 19656
diff changeset
    16
not work well with "blast". *}
14442
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
    17
19363
667b5ea637dd refined 'abbreviation';
wenzelm
parents: 19328
diff changeset
    18
abbreviation
667b5ea637dd refined 'abbreviation';
wenzelm
parents: 19328
diff changeset
    19
  infinite :: "'a set \<Rightarrow> bool"
667b5ea637dd refined 'abbreviation';
wenzelm
parents: 19328
diff changeset
    20
  "infinite S == \<not> finite S"
14442
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
    21
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
    22
text {*
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
    23
  Infinite sets are non-empty, and if we remove some elements
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
    24
  from an infinite set, the result is still infinite.
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
    25
*}
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
    26
19869
eba1b9e7c458 removal of the obsolete "infinite_nonempty"
paulson
parents: 19656
diff changeset
    27
lemma infinite_imp_nonempty: "infinite S ==> S \<noteq> {}"
eba1b9e7c458 removal of the obsolete "infinite_nonempty"
paulson
parents: 19656
diff changeset
    28
  by auto
14442
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
    29
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
    30
lemma infinite_remove:
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
    31
  "infinite S \<Longrightarrow> infinite (S - {a})"
19537
213ff8b0c60c replaced syntax/translations by abbreviation;
wenzelm
parents: 19457
diff changeset
    32
  by simp
14442
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
    33
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
    34
lemma Diff_infinite_finite:
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
    35
  assumes T: "finite T" and S: "infinite S"
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
    36
  shows "infinite (S-T)"
19537
213ff8b0c60c replaced syntax/translations by abbreviation;
wenzelm
parents: 19457
diff changeset
    37
  using T
213ff8b0c60c replaced syntax/translations by abbreviation;
wenzelm
parents: 19457
diff changeset
    38
proof induct
14442
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
    39
  from S
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
    40
  show "infinite (S - {})" by auto
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
    41
next
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
    42
  fix T x
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
    43
  assume ih: "infinite (S-T)"
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
    44
  have "S - (insert x T) = (S-T) - {x}"
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
    45
    by (rule Diff_insert)
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
    46
  with ih
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
    47
  show "infinite (S - (insert x T))"
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
    48
    by (simp add: infinite_remove)
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
    49
qed
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
    50
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
    51
lemma Un_infinite:
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
    52
  "infinite S \<Longrightarrow> infinite (S \<union> T)"
19537
213ff8b0c60c replaced syntax/translations by abbreviation;
wenzelm
parents: 19457
diff changeset
    53
  by simp
14442
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
    54
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
    55
lemma infinite_super:
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
    56
  assumes T: "S \<subseteq> T" and S: "infinite S"
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
    57
  shows "infinite T"
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
    58
proof (rule ccontr)
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
    59
  assume "\<not>(infinite T)"
19537
213ff8b0c60c replaced syntax/translations by abbreviation;
wenzelm
parents: 19457
diff changeset
    60
  with T have "finite S" by (simp add: finite_subset)
213ff8b0c60c replaced syntax/translations by abbreviation;
wenzelm
parents: 19457
diff changeset
    61
  with S show False by simp
14442
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
    62
qed
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
    63
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
    64
text {*
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
    65
  As a concrete example, we prove that the set of natural
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
    66
  numbers is infinite.
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
    67
*}
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
    68
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
    69
lemma finite_nat_bounded:
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
    70
  assumes S: "finite (S::nat set)"
15045
d59f7e2e18d3 Moved to new m<..<n syntax for set intervals.
nipkow
parents: 14957
diff changeset
    71
  shows "\<exists>k. S \<subseteq> {..<k}" (is "\<exists>k. ?bounded S k")
14442
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
    72
using S
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
    73
proof (induct)
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
    74
  have "?bounded {} 0" by simp
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
    75
  thus "\<exists>k. ?bounded {} k" ..
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
    76
next
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
    77
  fix S x
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
    78
  assume "\<exists>k. ?bounded S k"
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
    79
  then obtain k where k: "?bounded S k" ..
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
    80
  show "\<exists>k. ?bounded (insert x S) k"
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
    81
  proof (cases "x<k")
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
    82
    case True
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
    83
    with k show ?thesis by auto
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
    84
  next
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
    85
    case False
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
    86
    with k have "?bounded S (Suc x)" by auto
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
    87
    thus ?thesis by auto
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
    88
  qed
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
    89
qed
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
    90
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
    91
lemma finite_nat_iff_bounded:
15045
d59f7e2e18d3 Moved to new m<..<n syntax for set intervals.
nipkow
parents: 14957
diff changeset
    92
  "finite (S::nat set) = (\<exists>k. S \<subseteq> {..<k})" (is "?lhs = ?rhs")
14442
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
    93
proof
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
    94
  assume ?lhs
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
    95
  thus ?rhs by (rule finite_nat_bounded)
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
    96
next
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
    97
  assume ?rhs
15045
d59f7e2e18d3 Moved to new m<..<n syntax for set intervals.
nipkow
parents: 14957
diff changeset
    98
  then obtain k where "S \<subseteq> {..<k}" ..
14442
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
    99
  thus "finite S"
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   100
    by (rule finite_subset, simp)
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   101
qed
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   102
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   103
lemma finite_nat_iff_bounded_le:
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   104
  "finite (S::nat set) = (\<exists>k. S \<subseteq> {..k})" (is "?lhs = ?rhs")
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   105
proof
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   106
  assume ?lhs
15045
d59f7e2e18d3 Moved to new m<..<n syntax for set intervals.
nipkow
parents: 14957
diff changeset
   107
  then obtain k where "S \<subseteq> {..<k}" 
14442
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   108
    by (blast dest: finite_nat_bounded)
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   109
  hence "S \<subseteq> {..k}" by auto
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   110
  thus ?rhs ..
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   111
next
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   112
  assume ?rhs
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   113
  then obtain k where "S \<subseteq> {..k}" ..
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   114
  thus "finite S"
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   115
    by (rule finite_subset, simp)
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   116
qed
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   117
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   118
lemma infinite_nat_iff_unbounded:
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   119
  "infinite (S::nat set) = (\<forall>m. \<exists>n. m<n \<and> n\<in>S)"
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   120
  (is "?lhs = ?rhs")
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   121
proof
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   122
  assume inf: ?lhs
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   123
  show ?rhs
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   124
  proof (rule ccontr)
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   125
    assume "\<not> ?rhs"
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   126
    then obtain m where m: "\<forall>n. m<n \<longrightarrow> n\<notin>S" by blast
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   127
    hence "S \<subseteq> {..m}"
16796
140f1e0ea846 generlization of some "nat" theorems
paulson
parents: 16733
diff changeset
   128
      by (auto simp add: sym[OF linorder_not_less])
14442
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   129
    with inf show "False" 
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   130
      by (simp add: finite_nat_iff_bounded_le)
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   131
  qed
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   132
next
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   133
  assume unbounded: ?rhs
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   134
  show ?lhs
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   135
  proof
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   136
    assume "finite S"
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   137
    then obtain m where "S \<subseteq> {..m}"
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   138
      by (auto simp add: finite_nat_iff_bounded_le)
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   139
    hence "\<forall>n. m<n \<longrightarrow> n\<notin>S" by auto
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   140
    with unbounded show "False" by blast
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   141
  qed
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   142
qed
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   143
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   144
lemma infinite_nat_iff_unbounded_le:
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   145
  "infinite (S::nat set) = (\<forall>m. \<exists>n. m\<le>n \<and> n\<in>S)"
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   146
  (is "?lhs = ?rhs")
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   147
proof
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   148
  assume inf: ?lhs
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   149
  show ?rhs
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   150
  proof
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   151
    fix m
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   152
    from inf obtain n where "m<n \<and> n\<in>S"
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   153
      by (auto simp add: infinite_nat_iff_unbounded)
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   154
    hence "m\<le>n \<and> n\<in>S" by auto
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   155
    thus "\<exists>n. m \<le> n \<and> n \<in> S" ..
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   156
  qed
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   157
next
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   158
  assume unbounded: ?rhs
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   159
  show ?lhs
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   160
  proof (auto simp add: infinite_nat_iff_unbounded)
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   161
    fix m
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   162
    from unbounded obtain n where "(Suc m)\<le>n \<and> n\<in>S"
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   163
      by blast
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   164
    hence "m<n \<and> n\<in>S" by auto
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   165
    thus "\<exists>n. m < n \<and> n \<in> S" ..
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   166
  qed
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   167
qed
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   168
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   169
text {*
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   170
  For a set of natural numbers to be infinite, it is enough
14957
0e94a1ccc6ae tuned document;
wenzelm
parents: 14896
diff changeset
   171
  to know that for any number larger than some @{text k}, there
14442
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   172
  is some larger number that is an element of the set.
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   173
*}
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   174
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   175
lemma unbounded_k_infinite:
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   176
  assumes k: "\<forall>m. k<m \<longrightarrow> (\<exists>n. m<n \<and> n\<in>S)"
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   177
  shows "infinite (S::nat set)"
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   178
proof (auto simp add: infinite_nat_iff_unbounded)
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   179
  fix m show "\<exists>n. m<n \<and> n\<in>S"
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   180
  proof (cases "k<m")
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   181
    case True
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   182
    with k show ?thesis by blast
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   183
  next
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   184
    case False
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   185
    from k obtain n where "Suc k < n \<and> n\<in>S" by auto
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   186
    with False have "m<n \<and> n\<in>S" by auto
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   187
    thus ?thesis ..
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   188
  qed
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   189
qed
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   190
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   191
theorem nat_infinite [simp]:
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   192
  "infinite (UNIV :: nat set)"
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   193
by (auto simp add: infinite_nat_iff_unbounded)
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   194
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   195
theorem nat_not_finite [elim]:
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   196
  "finite (UNIV::nat set) \<Longrightarrow> R"
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   197
by simp
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   198
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   199
text {*
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   200
  Every infinite set contains a countable subset. More precisely
14957
0e94a1ccc6ae tuned document;
wenzelm
parents: 14896
diff changeset
   201
  we show that a set @{text S} is infinite if and only if there exists 
0e94a1ccc6ae tuned document;
wenzelm
parents: 14896
diff changeset
   202
  an injective function from the naturals into @{text S}.
14442
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   203
*}
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   204
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   205
lemma range_inj_infinite:
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   206
  "inj (f::nat \<Rightarrow> 'a) \<Longrightarrow> infinite (range f)"
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   207
proof
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   208
  assume "inj f"
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   209
    and  "finite (range f)"
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   210
  hence "finite (UNIV::nat set)"
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   211
    by (auto intro: finite_imageD simp del: nat_infinite)
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   212
  thus "False" by simp
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   213
qed
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   214
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   215
text {*
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   216
  The ``only if'' direction is harder because it requires the
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   217
  construction of a sequence of pairwise different elements of
14957
0e94a1ccc6ae tuned document;
wenzelm
parents: 14896
diff changeset
   218
  an infinite set @{text S}. The idea is to construct a sequence of
0e94a1ccc6ae tuned document;
wenzelm
parents: 14896
diff changeset
   219
  non-empty and infinite subsets of @{text S} obtained by successively
0e94a1ccc6ae tuned document;
wenzelm
parents: 14896
diff changeset
   220
  removing elements of @{text S}.
14442
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   221
*}
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   222
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   223
lemma linorder_injI:
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   224
  assumes hyp: "\<forall>x y. x < (y::'a::linorder) \<longrightarrow> f x \<noteq> f y"
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   225
  shows "inj f"
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   226
proof (rule inj_onI)
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   227
  fix x y
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   228
  assume f_eq: "f x = f y"
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   229
  show "x = y"
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   230
  proof (rule linorder_cases)
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   231
    assume "x < y"
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   232
    with hyp have "f x \<noteq> f y" by blast
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   233
    with f_eq show ?thesis by simp
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   234
  next
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   235
    assume "x = y"
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   236
    thus ?thesis .
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   237
  next
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   238
    assume "y < x"
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   239
    with hyp have "f y \<noteq> f x" by blast
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   240
    with f_eq show ?thesis by simp
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   241
  qed
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   242
qed
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   243
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   244
lemma infinite_countable_subset:
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   245
  assumes inf: "infinite (S::'a set)"
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   246
  shows "\<exists>f. inj (f::nat \<Rightarrow> 'a) \<and> range f \<subseteq> S"
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   247
proof -
14766
c0401da7726d use plain SOME;
wenzelm
parents: 14565
diff changeset
   248
  def Sseq \<equiv> "nat_rec S (\<lambda>n T. T - {SOME e. e \<in> T})"
c0401da7726d use plain SOME;
wenzelm
parents: 14565
diff changeset
   249
  def pick \<equiv> "\<lambda>n. (SOME e. e \<in> Sseq n)"
14442
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   250
  have Sseq_inf: "\<And>n. infinite (Sseq n)"
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   251
  proof -
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   252
    fix n
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   253
    show "infinite (Sseq n)"
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   254
    proof (induct n)
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   255
      from inf show "infinite (Sseq 0)"
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   256
	by (simp add: Sseq_def)
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   257
    next
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   258
      fix n
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   259
      assume "infinite (Sseq n)" thus "infinite (Sseq (Suc n))"
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   260
	by (simp add: Sseq_def infinite_remove)
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   261
    qed
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   262
  qed
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   263
  have Sseq_S: "\<And>n. Sseq n \<subseteq> S"
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   264
  proof -
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   265
    fix n
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   266
    show "Sseq n \<subseteq> S"
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   267
      by (induct n, auto simp add: Sseq_def)
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   268
  qed
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   269
  have Sseq_pick: "\<And>n. pick n \<in> Sseq n"
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   270
  proof -
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   271
    fix n
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   272
    show "pick n \<in> Sseq n"
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   273
    proof (unfold pick_def, rule someI_ex)
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   274
      from Sseq_inf have "infinite (Sseq n)" .
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   275
      hence "Sseq n \<noteq> {}" by auto
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   276
      thus "\<exists>x. x \<in> Sseq n" by auto
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   277
    qed
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   278
  qed
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   279
  with Sseq_S have rng: "range pick \<subseteq> S"
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   280
    by auto
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   281
  have pick_Sseq_gt: "\<And>n m. pick n \<notin> Sseq (n + Suc m)"
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   282
  proof -
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   283
    fix n m
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   284
    show "pick n \<notin> Sseq (n + Suc m)"
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   285
      by (induct m, auto simp add: Sseq_def pick_def)
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   286
  qed
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   287
  have pick_pick: "\<And>n m. pick n \<noteq> pick (n + Suc m)"
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   288
  proof -
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   289
    fix n m
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   290
    from Sseq_pick have "pick (n + Suc m) \<in> Sseq (n + Suc m)" .
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   291
    moreover from pick_Sseq_gt
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   292
    have "pick n \<notin> Sseq (n + Suc m)" .
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   293
    ultimately show "pick n \<noteq> pick (n + Suc m)"
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   294
      by auto
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   295
  qed
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   296
  have inj: "inj pick"
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   297
  proof (rule linorder_injI)
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   298
    show "\<forall>i j. i<(j::nat) \<longrightarrow> pick i \<noteq> pick j"
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   299
    proof (clarify)
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   300
      fix i j
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   301
      assume ij: "i<(j::nat)"
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   302
	and eq: "pick i = pick j"
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   303
      from ij obtain k where "j = i + (Suc k)"
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   304
	by (auto simp add: less_iff_Suc_add)
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   305
      with pick_pick have "pick i \<noteq> pick j" by simp
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   306
      with eq show "False" by simp
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   307
    qed
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   308
  qed
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   309
  from rng inj show ?thesis by auto
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   310
qed
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   311
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   312
theorem infinite_iff_countable_subset:
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   313
  "infinite S = (\<exists>f. inj (f::nat \<Rightarrow> 'a) \<and> range f \<subseteq> S)"
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   314
  (is "?lhs = ?rhs")
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   315
by (auto simp add: infinite_countable_subset
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   316
                   range_inj_infinite infinite_super)
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   317
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   318
text {*
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   319
  For any function with infinite domain and finite range
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   320
  there is some element that is the image of infinitely
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   321
  many domain elements. In particular, any infinite sequence
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   322
  of elements from a finite set contains some element that
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   323
  occurs infinitely often.
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   324
*}
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   325
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   326
theorem inf_img_fin_dom:
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   327
  assumes img: "finite (f`A)" and dom: "infinite A"
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   328
  shows "\<exists>y \<in> f`A. infinite (f -` {y})"
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   329
proof (rule ccontr)
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   330
  assume "\<not> (\<exists>y\<in>f ` A. infinite (f -` {y}))"
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   331
  with img have "finite (UN y:f`A. f -` {y})"
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   332
    by (blast intro: finite_UN_I)
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   333
  moreover have "A \<subseteq> (UN y:f`A. f -` {y})" by auto
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   334
  moreover note dom
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   335
  ultimately show "False"
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   336
    by (simp add: infinite_super)
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   337
qed
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   338
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   339
theorems inf_img_fin_domE = inf_img_fin_dom[THEN bexE]
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   340
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   341
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   342
subsection "Infinitely Many and Almost All"
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   343
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   344
text {*
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   345
  We often need to reason about the existence of infinitely many
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   346
  (resp., all but finitely many) objects satisfying some predicate,
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   347
  so we introduce corresponding binders and their proof rules.
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   348
*}
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   349
19656
09be06943252 tuned concrete syntax -- abbreviation/const_syntax;
wenzelm
parents: 19537
diff changeset
   350
definition
14442
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   351
  Inf_many :: "('a \<Rightarrow> bool) \<Rightarrow> bool"      (binder "INF " 10)
19656
09be06943252 tuned concrete syntax -- abbreviation/const_syntax;
wenzelm
parents: 19537
diff changeset
   352
  INF_def:  "Inf_many P \<equiv> infinite {x. P x}"
14442
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   353
  Alm_all  :: "('a \<Rightarrow> bool) \<Rightarrow> bool"      (binder "MOST " 10)
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   354
  MOST_def: "Alm_all P \<equiv> \<not>(INF x. \<not> P x)"
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   355
19656
09be06943252 tuned concrete syntax -- abbreviation/const_syntax;
wenzelm
parents: 19537
diff changeset
   356
const_syntax (xsymbols)
09be06943252 tuned concrete syntax -- abbreviation/const_syntax;
wenzelm
parents: 19537
diff changeset
   357
  Inf_many  (binder "\<exists>\<^sub>\<infinity>" 10)
09be06943252 tuned concrete syntax -- abbreviation/const_syntax;
wenzelm
parents: 19537
diff changeset
   358
  Alm_all  (binder "\<forall>\<^sub>\<infinity>" 10)
14442
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   359
19656
09be06943252 tuned concrete syntax -- abbreviation/const_syntax;
wenzelm
parents: 19537
diff changeset
   360
const_syntax (HTML output)
09be06943252 tuned concrete syntax -- abbreviation/const_syntax;
wenzelm
parents: 19537
diff changeset
   361
  Inf_many  (binder "\<exists>\<^sub>\<infinity>" 10)
09be06943252 tuned concrete syntax -- abbreviation/const_syntax;
wenzelm
parents: 19537
diff changeset
   362
  Alm_all  (binder "\<forall>\<^sub>\<infinity>" 10)
14565
c6dc17aab88a use more symbols in HTML output
kleing
parents: 14485
diff changeset
   363
14442
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   364
lemma INF_EX:
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   365
  "(\<exists>\<^sub>\<infinity>x. P x) \<Longrightarrow> (\<exists>x. P x)"
19656
09be06943252 tuned concrete syntax -- abbreviation/const_syntax;
wenzelm
parents: 19537
diff changeset
   366
  unfolding INF_def
09be06943252 tuned concrete syntax -- abbreviation/const_syntax;
wenzelm
parents: 19537
diff changeset
   367
proof (rule ccontr)
14442
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   368
  assume inf: "infinite {x. P x}"
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   369
    and notP: "\<not>(\<exists>x. P x)"
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   370
  from notP have "{x. P x} = {}" by simp
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   371
  hence "finite {x. P x}" by simp
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   372
  with inf show "False" by simp
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   373
qed
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   374
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   375
lemma MOST_iff_finiteNeg:
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   376
  "(\<forall>\<^sub>\<infinity>x. P x) = finite {x. \<not> P x}"
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   377
by (simp add: MOST_def INF_def)
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   378
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   379
lemma ALL_MOST:
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   380
  "\<forall>x. P x \<Longrightarrow> \<forall>\<^sub>\<infinity>x. P x"
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   381
by (simp add: MOST_iff_finiteNeg)
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   382
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   383
lemma INF_mono:
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   384
  assumes inf: "\<exists>\<^sub>\<infinity>x. P x" and q: "\<And>x. P x \<Longrightarrow> Q x"
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   385
  shows "\<exists>\<^sub>\<infinity>x. Q x"
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   386
proof -
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   387
  from inf have "infinite {x. P x}" by (unfold INF_def)
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   388
  moreover from q have "{x. P x} \<subseteq> {x. Q x}" by auto
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   389
  ultimately show ?thesis
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   390
    by (simp add: INF_def infinite_super)
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   391
qed
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   392
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   393
lemma MOST_mono:
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   394
  "\<lbrakk> \<forall>\<^sub>\<infinity>x. P x; \<And>x. P x \<Longrightarrow> Q x \<rbrakk> \<Longrightarrow> \<forall>\<^sub>\<infinity>x. Q x"
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   395
by (unfold MOST_def, blast intro: INF_mono)
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   396
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   397
lemma INF_nat: "(\<exists>\<^sub>\<infinity>n. P (n::nat)) = (\<forall>m. \<exists>n. m<n \<and> P n)"
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   398
by (simp add: INF_def infinite_nat_iff_unbounded)
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   399
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   400
lemma INF_nat_le: "(\<exists>\<^sub>\<infinity>n. P (n::nat)) = (\<forall>m. \<exists>n. m\<le>n \<and> P n)"
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   401
by (simp add: INF_def infinite_nat_iff_unbounded_le)
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   402
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   403
lemma MOST_nat: "(\<forall>\<^sub>\<infinity>n. P (n::nat)) = (\<exists>m. \<forall>n. m<n \<longrightarrow> P n)"
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   404
by (simp add: MOST_def INF_nat)
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   405
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   406
lemma MOST_nat_le: "(\<forall>\<^sub>\<infinity>n. P (n::nat)) = (\<exists>m. \<forall>n. m\<le>n \<longrightarrow> P n)"
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   407
by (simp add: MOST_def INF_nat_le)
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   408
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   409
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   410
subsection "Miscellaneous"
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   411
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   412
text {*
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   413
  A few trivial lemmas about sets that contain at most one element.
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   414
  These simplify the reasoning about deterministic automata.
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   415
*}
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   416
19656
09be06943252 tuned concrete syntax -- abbreviation/const_syntax;
wenzelm
parents: 19537
diff changeset
   417
definition
14442
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   418
  atmost_one :: "'a set \<Rightarrow> bool"
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   419
  "atmost_one S \<equiv> \<forall>x y. x\<in>S \<and> y\<in>S \<longrightarrow> x=y"
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   420
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   421
lemma atmost_one_empty: "S={} \<Longrightarrow> atmost_one S"
19537
213ff8b0c60c replaced syntax/translations by abbreviation;
wenzelm
parents: 19457
diff changeset
   422
  by (simp add: atmost_one_def)
14442
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   423
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   424
lemma atmost_one_singleton: "S = {x} \<Longrightarrow> atmost_one S"
19537
213ff8b0c60c replaced syntax/translations by abbreviation;
wenzelm
parents: 19457
diff changeset
   425
  by (simp add: atmost_one_def)
14442
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   426
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   427
lemma atmost_one_unique [elim]: "\<lbrakk> atmost_one S; x \<in> S; y \<in> S \<rbrakk> \<Longrightarrow> y=x"
19537
213ff8b0c60c replaced syntax/translations by abbreviation;
wenzelm
parents: 19457
diff changeset
   428
  by (simp add: atmost_one_def)
14442
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   429
04135b0c06ff new theory of infinite sets
paulson
parents:
diff changeset
   430
end