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