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