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