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