src/HOL/Library/Infinite_Set.thy
author hoelzl
Thu, 17 Jan 2013 11:59:12 +0100
changeset 50936 b28f258ebc1a
parent 50134 13211e07d931
child 53239 2f21813cf2f0
permissions -rw-r--r--
countablility of finite subsets and rational numbers
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
27407
68e111812b83 rename lemmas INF_foo to INFM_foo; add new lemmas about MOST and INFM
huffman
parents: 27368
diff changeset
     1
(*  Title:      HOL/Library/Infinite_Set.thy
20809
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
     2
    Author:     Stephan Merz
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
     3
*)
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
     4
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
     5
header {* Infinite Sets and Related Concepts *}
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
     6
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
     7
theory Infinite_Set
30663
0b6aff7451b2 Main is (Complex_Main) base entry point in library theories
haftmann
parents: 29901
diff changeset
     8
imports Main
20809
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
     9
begin
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
    10
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
    11
subsection "Infinite Sets"
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
    12
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
    13
text {*
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
    14
  Some elementary facts about infinite sets, mostly by Stefan Merz.
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
    15
  Beware! Because "infinite" merely abbreviates a negation, these
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
    16
  lemmas may not work well with @{text "blast"}.
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
    17
*}
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
    18
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
    19
abbreviation
21404
eb85850d3eb7 more robust syntax for definition/abbreviation/notation;
wenzelm
parents: 21256
diff changeset
    20
  infinite :: "'a set \<Rightarrow> bool" where
20809
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
    21
  "infinite S == \<not> finite S"
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
    22
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
    23
text {*
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
    24
  Infinite sets are non-empty, and if we remove some elements from an
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
    25
  infinite set, the result is still infinite.
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
    26
*}
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
    27
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
    28
lemma infinite_imp_nonempty: "infinite S ==> S \<noteq> {}"
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
    29
  by auto
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
    30
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
    31
lemma infinite_remove:
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
    32
  "infinite S \<Longrightarrow> infinite (S - {a})"
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
    33
  by simp
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
    34
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
    35
lemma Diff_infinite_finite:
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
    36
  assumes T: "finite T" and S: "infinite S"
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
    37
  shows "infinite (S - T)"
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
    38
  using T
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
    39
proof induct
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
    40
  from S
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
    41
  show "infinite (S - {})" by auto
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
    42
next
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
    43
  fix T x
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
    44
  assume ih: "infinite (S - T)"
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
    45
  have "S - (insert x T) = (S - T) - {x}"
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
    46
    by (rule Diff_insert)
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
    47
  with ih
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
    48
  show "infinite (S - (insert x T))"
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
    49
    by (simp add: infinite_remove)
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
    50
qed
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
    51
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
    52
lemma Un_infinite: "infinite S \<Longrightarrow> infinite (S \<union> T)"
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
    53
  by simp
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
    54
35844
65258d2c3214 added lemma infinite_Un
Christian Urban <urbanc@in.tum.de>
parents: 35056
diff changeset
    55
lemma infinite_Un: "infinite (S \<union> T) \<longleftrightarrow> infinite S \<or> infinite T"
65258d2c3214 added lemma infinite_Un
Christian Urban <urbanc@in.tum.de>
parents: 35056
diff changeset
    56
  by simp
65258d2c3214 added lemma infinite_Un
Christian Urban <urbanc@in.tum.de>
parents: 35056
diff changeset
    57
20809
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
    58
lemma infinite_super:
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
    59
  assumes T: "S \<subseteq> T" and S: "infinite S"
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
    60
  shows "infinite T"
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
    61
proof
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
    62
  assume "finite T"
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
    63
  with T have "finite S" by (simp add: finite_subset)
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
    64
  with S show False by simp
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
    65
qed
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
    66
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
    67
text {*
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
    68
  As a concrete example, we prove that the set of natural numbers is
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
    69
  infinite.
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
    70
*}
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
    71
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
    72
lemma finite_nat_bounded:
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
    73
  assumes S: "finite (S::nat set)"
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
    74
  shows "\<exists>k. S \<subseteq> {..<k}"  (is "\<exists>k. ?bounded S k")
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
    75
using S
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
    76
proof induct
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
    77
  have "?bounded {} 0" by simp
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
    78
  then show "\<exists>k. ?bounded {} k" ..
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
    79
next
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
    80
  fix S x
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
    81
  assume "\<exists>k. ?bounded S k"
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
    82
  then obtain k where k: "?bounded S k" ..
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
    83
  show "\<exists>k. ?bounded (insert x S) k"
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
    84
  proof (cases "x < k")
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
    85
    case True
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
    86
    with k show ?thesis by auto
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
    87
  next
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
    88
    case False
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
    89
    with k have "?bounded S (Suc x)" by auto
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
    90
    then show ?thesis by auto
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
    91
  qed
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
    92
qed
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
    93
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
    94
lemma finite_nat_iff_bounded:
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
    95
  "finite (S::nat set) = (\<exists>k. S \<subseteq> {..<k})"  (is "?lhs = ?rhs")
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
    96
proof
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
    97
  assume ?lhs
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
    98
  then show ?rhs by (rule finite_nat_bounded)
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
    99
next
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   100
  assume ?rhs
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   101
  then obtain k where "S \<subseteq> {..<k}" ..
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   102
  then show "finite S"
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   103
    by (rule finite_subset) simp
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   104
qed
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   105
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   106
lemma finite_nat_iff_bounded_le:
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   107
  "finite (S::nat set) = (\<exists>k. S \<subseteq> {..k})"  (is "?lhs = ?rhs")
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   108
proof
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   109
  assume ?lhs
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   110
  then obtain k where "S \<subseteq> {..<k}"
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   111
    by (blast dest: finite_nat_bounded)
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   112
  then have "S \<subseteq> {..k}" by auto
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   113
  then show ?rhs ..
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   114
next
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   115
  assume ?rhs
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   116
  then obtain k where "S \<subseteq> {..k}" ..
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   117
  then show "finite S"
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   118
    by (rule finite_subset) simp
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   119
qed
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   120
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   121
lemma infinite_nat_iff_unbounded:
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   122
  "infinite (S::nat set) = (\<forall>m. \<exists>n. m<n \<and> n\<in>S)"
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   123
  (is "?lhs = ?rhs")
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   124
proof
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   125
  assume ?lhs
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   126
  show ?rhs
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   127
  proof (rule ccontr)
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   128
    assume "\<not> ?rhs"
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   129
    then obtain m where m: "\<forall>n. m<n \<longrightarrow> n\<notin>S" by blast
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   130
    then have "S \<subseteq> {..m}"
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   131
      by (auto simp add: sym [OF linorder_not_less])
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   132
    with `?lhs` show False
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   133
      by (simp add: finite_nat_iff_bounded_le)
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   134
  qed
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   135
next
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   136
  assume ?rhs
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   137
  show ?lhs
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   138
  proof
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   139
    assume "finite S"
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   140
    then obtain m where "S \<subseteq> {..m}"
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   141
      by (auto simp add: finite_nat_iff_bounded_le)
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   142
    then have "\<forall>n. m<n \<longrightarrow> n\<notin>S" by auto
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   143
    with `?rhs` show False by blast
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   144
  qed
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   145
qed
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   146
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   147
lemma infinite_nat_iff_unbounded_le:
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   148
  "infinite (S::nat set) = (\<forall>m. \<exists>n. m\<le>n \<and> n\<in>S)"
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   149
  (is "?lhs = ?rhs")
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   150
proof
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   151
  assume ?lhs
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   152
  show ?rhs
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   153
  proof
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   154
    fix m
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   155
    from `?lhs` obtain n where "m<n \<and> n\<in>S"
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   156
      by (auto simp add: infinite_nat_iff_unbounded)
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   157
    then have "m\<le>n \<and> n\<in>S" by simp
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   158
    then show "\<exists>n. m \<le> n \<and> n \<in> S" ..
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   159
  qed
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   160
next
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   161
  assume ?rhs
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   162
  show ?lhs
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   163
  proof (auto simp add: infinite_nat_iff_unbounded)
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   164
    fix m
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   165
    from `?rhs` obtain n where "Suc m \<le> n \<and> n\<in>S"
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   166
      by blast
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   167
    then have "m<n \<and> n\<in>S" by simp
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   168
    then show "\<exists>n. m < n \<and> n \<in> S" ..
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   169
  qed
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   170
qed
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   171
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   172
text {*
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   173
  For a set of natural numbers to be infinite, it is enough to know
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   174
  that for any number larger than some @{text k}, there is some larger
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   175
  number that is an element of the set.
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   176
*}
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   177
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   178
lemma unbounded_k_infinite:
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   179
  assumes k: "\<forall>m. k<m \<longrightarrow> (\<exists>n. m<n \<and> n\<in>S)"
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   180
  shows "infinite (S::nat set)"
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   181
proof -
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   182
  {
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   183
    fix m have "\<exists>n. m<n \<and> n\<in>S"
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   184
    proof (cases "k<m")
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   185
      case True
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   186
      with k show ?thesis by blast
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   187
    next
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   188
      case False
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   189
      from k obtain n where "Suc k < n \<and> n\<in>S" by auto
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   190
      with False have "m<n \<and> n\<in>S" by auto
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   191
      then show ?thesis ..
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   192
    qed
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   193
  }
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   194
  then show ?thesis
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   195
    by (auto simp add: infinite_nat_iff_unbounded)
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   196
qed
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   197
35056
d97b5c3af6d5 remove redundant theorem attributes
huffman
parents: 34941
diff changeset
   198
(* duplicates Finite_Set.infinite_UNIV_nat *)
d97b5c3af6d5 remove redundant theorem attributes
huffman
parents: 34941
diff changeset
   199
lemma nat_infinite: "infinite (UNIV :: nat set)"
20809
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   200
  by (auto simp add: infinite_nat_iff_unbounded)
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   201
35056
d97b5c3af6d5 remove redundant theorem attributes
huffman
parents: 34941
diff changeset
   202
lemma nat_not_finite: "finite (UNIV::nat set) \<Longrightarrow> R"
20809
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   203
  by simp
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   204
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   205
text {*
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   206
  Every infinite set contains a countable subset. More precisely we
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   207
  show that a set @{text S} is infinite if and only if there exists an
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   208
  injective function from the naturals into @{text S}.
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   209
*}
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   210
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   211
lemma range_inj_infinite:
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   212
  "inj (f::nat \<Rightarrow> 'a) \<Longrightarrow> infinite (range f)"
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   213
proof
27407
68e111812b83 rename lemmas INF_foo to INFM_foo; add new lemmas about MOST and INFM
huffman
parents: 27368
diff changeset
   214
  assume "finite (range f)" and "inj f"
20809
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   215
  then have "finite (UNIV::nat set)"
27407
68e111812b83 rename lemmas INF_foo to INFM_foo; add new lemmas about MOST and INFM
huffman
parents: 27368
diff changeset
   216
    by (rule finite_imageD)
20809
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   217
  then show False by simp
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   218
qed
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   219
22226
699385e6cb45 new theorem int_infinite
paulson
parents: 21404
diff changeset
   220
lemma int_infinite [simp]:
699385e6cb45 new theorem int_infinite
paulson
parents: 21404
diff changeset
   221
  shows "infinite (UNIV::int set)"
699385e6cb45 new theorem int_infinite
paulson
parents: 21404
diff changeset
   222
proof -
699385e6cb45 new theorem int_infinite
paulson
parents: 21404
diff changeset
   223
  from inj_int have "infinite (range int)" by (rule range_inj_infinite)
699385e6cb45 new theorem int_infinite
paulson
parents: 21404
diff changeset
   224
  moreover 
699385e6cb45 new theorem int_infinite
paulson
parents: 21404
diff changeset
   225
  have "range int \<subseteq> (UNIV::int set)" by simp
699385e6cb45 new theorem int_infinite
paulson
parents: 21404
diff changeset
   226
  ultimately show "infinite (UNIV::int set)" by (simp add: infinite_super)
699385e6cb45 new theorem int_infinite
paulson
parents: 21404
diff changeset
   227
qed
699385e6cb45 new theorem int_infinite
paulson
parents: 21404
diff changeset
   228
20809
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   229
text {*
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   230
  The ``only if'' direction is harder because it requires the
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   231
  construction of a sequence of pairwise different elements of an
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   232
  infinite set @{text S}. The idea is to construct a sequence of
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   233
  non-empty and infinite subsets of @{text S} obtained by successively
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   234
  removing elements of @{text S}.
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   235
*}
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   236
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   237
lemma linorder_injI:
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   238
  assumes hyp: "!!x y. x < (y::'a::linorder) ==> f x \<noteq> f y"
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   239
  shows "inj f"
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   240
proof (rule inj_onI)
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   241
  fix x y
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   242
  assume f_eq: "f x = f y"
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   243
  show "x = y"
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   244
  proof (rule linorder_cases)
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   245
    assume "x < y"
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   246
    with hyp have "f x \<noteq> f y" by blast
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   247
    with f_eq show ?thesis by simp
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   248
  next
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   249
    assume "x = y"
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   250
    then show ?thesis .
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   251
  next
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   252
    assume "y < x"
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   253
    with hyp have "f y \<noteq> f x" by blast
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   254
    with f_eq show ?thesis by simp
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   255
  qed
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   256
qed
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   257
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   258
lemma infinite_countable_subset:
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   259
  assumes inf: "infinite (S::'a set)"
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   260
  shows "\<exists>f. inj (f::nat \<Rightarrow> 'a) \<and> range f \<subseteq> S"
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   261
proof -
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   262
  def Sseq \<equiv> "nat_rec S (\<lambda>n T. T - {SOME e. e \<in> T})"
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   263
  def pick \<equiv> "\<lambda>n. (SOME e. e \<in> Sseq n)"
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   264
  have Sseq_inf: "\<And>n. infinite (Sseq n)"
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   265
  proof -
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   266
    fix n
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   267
    show "infinite (Sseq n)"
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   268
    proof (induct n)
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   269
      from inf show "infinite (Sseq 0)"
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   270
        by (simp add: Sseq_def)
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   271
    next
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   272
      fix n
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   273
      assume "infinite (Sseq n)" then show "infinite (Sseq (Suc n))"
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   274
        by (simp add: Sseq_def infinite_remove)
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   275
    qed
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   276
  qed
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   277
  have Sseq_S: "\<And>n. Sseq n \<subseteq> S"
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   278
  proof -
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   279
    fix n
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   280
    show "Sseq n \<subseteq> S"
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   281
      by (induct n) (auto simp add: Sseq_def)
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   282
  qed
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   283
  have Sseq_pick: "\<And>n. pick n \<in> Sseq n"
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   284
  proof -
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   285
    fix n
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   286
    show "pick n \<in> Sseq n"
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   287
    proof (unfold pick_def, rule someI_ex)
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   288
      from Sseq_inf have "infinite (Sseq n)" .
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   289
      then have "Sseq n \<noteq> {}" by auto
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   290
      then show "\<exists>x. x \<in> Sseq n" by auto
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   291
    qed
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   292
  qed
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   293
  with Sseq_S have rng: "range pick \<subseteq> S"
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   294
    by auto
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   295
  have pick_Sseq_gt: "\<And>n m. pick n \<notin> Sseq (n + Suc m)"
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   296
  proof -
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   297
    fix n m
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   298
    show "pick n \<notin> Sseq (n + Suc m)"
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   299
      by (induct m) (auto simp add: Sseq_def pick_def)
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   300
  qed
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   301
  have pick_pick: "\<And>n m. pick n \<noteq> pick (n + Suc m)"
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   302
  proof -
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   303
    fix n m
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   304
    from Sseq_pick have "pick (n + Suc m) \<in> Sseq (n + Suc m)" .
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   305
    moreover from pick_Sseq_gt
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   306
    have "pick n \<notin> Sseq (n + Suc m)" .
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   307
    ultimately show "pick n \<noteq> pick (n + Suc m)"
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   308
      by auto
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   309
  qed
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   310
  have inj: "inj pick"
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   311
  proof (rule linorder_injI)
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   312
    fix i j :: nat
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   313
    assume "i < j"
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   314
    show "pick i \<noteq> pick j"
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   315
    proof
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   316
      assume eq: "pick i = pick j"
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   317
      from `i < j` obtain k where "j = i + Suc k"
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   318
        by (auto simp add: less_iff_Suc_add)
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   319
      with pick_pick have "pick i \<noteq> pick j" by simp
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   320
      with eq show False by simp
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   321
    qed
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   322
  qed
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   323
  from rng inj show ?thesis by auto
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   324
qed
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   325
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   326
lemma infinite_iff_countable_subset:
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   327
    "infinite S = (\<exists>f. inj (f::nat \<Rightarrow> 'a) \<and> range f \<subseteq> S)"
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   328
  by (auto simp add: infinite_countable_subset range_inj_infinite infinite_super)
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   329
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   330
text {*
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   331
  For any function with infinite domain and finite range there is some
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   332
  element that is the image of infinitely many domain elements.  In
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   333
  particular, any infinite sequence of elements from a finite set
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   334
  contains some element that occurs infinitely often.
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   335
*}
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   336
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   337
lemma inf_img_fin_dom:
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   338
  assumes img: "finite (f`A)" and dom: "infinite A"
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   339
  shows "\<exists>y \<in> f`A. infinite (f -` {y})"
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   340
proof (rule ccontr)
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   341
  assume "\<not> ?thesis"
40786
0a54cfc9add3 gave more standard finite set rules simp and intro attribute
nipkow
parents: 35844
diff changeset
   342
  with img have "finite (UN y:f`A. f -` {y})" by blast
20809
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   343
  moreover have "A \<subseteq> (UN y:f`A. f -` {y})" by auto
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   344
  moreover note dom
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   345
  ultimately show False by (simp add: infinite_super)
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   346
qed
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   347
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   348
lemma inf_img_fin_domE:
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   349
  assumes "finite (f`A)" and "infinite A"
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   350
  obtains y where "y \<in> f`A" and "infinite (f -` {y})"
23394
474ff28210c0 tuned proofs;
wenzelm
parents: 22432
diff changeset
   351
  using assms by (blast dest: inf_img_fin_dom)
20809
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   352
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   353
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   354
subsection "Infinitely Many and Almost All"
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   355
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   356
text {*
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   357
  We often need to reason about the existence of infinitely many
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   358
  (resp., all but finitely many) objects satisfying some predicate, so
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   359
  we introduce corresponding binders and their proof rules.
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   360
*}
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   361
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   362
definition
22432
1d00d26fee0d Renamed INF to INFM to avoid clash with INF operator defined in FixedPoint theory.
berghofe
parents: 22226
diff changeset
   363
  Inf_many :: "('a \<Rightarrow> bool) \<Rightarrow> bool"  (binder "INFM " 10) where
20809
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   364
  "Inf_many P = infinite {x. P x}"
21404
eb85850d3eb7 more robust syntax for definition/abbreviation/notation;
wenzelm
parents: 21256
diff changeset
   365
eb85850d3eb7 more robust syntax for definition/abbreviation/notation;
wenzelm
parents: 21256
diff changeset
   366
definition
eb85850d3eb7 more robust syntax for definition/abbreviation/notation;
wenzelm
parents: 21256
diff changeset
   367
  Alm_all :: "('a \<Rightarrow> bool) \<Rightarrow> bool"  (binder "MOST " 10) where
22432
1d00d26fee0d Renamed INF to INFM to avoid clash with INF operator defined in FixedPoint theory.
berghofe
parents: 22226
diff changeset
   368
  "Alm_all P = (\<not> (INFM x. \<not> P x))"
20809
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   369
21210
c17fd2df4e9e renamed 'const_syntax' to 'notation';
wenzelm
parents: 20809
diff changeset
   370
notation (xsymbols)
21404
eb85850d3eb7 more robust syntax for definition/abbreviation/notation;
wenzelm
parents: 21256
diff changeset
   371
  Inf_many  (binder "\<exists>\<^sub>\<infinity>" 10) and
20809
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   372
  Alm_all  (binder "\<forall>\<^sub>\<infinity>" 10)
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   373
21210
c17fd2df4e9e renamed 'const_syntax' to 'notation';
wenzelm
parents: 20809
diff changeset
   374
notation (HTML output)
21404
eb85850d3eb7 more robust syntax for definition/abbreviation/notation;
wenzelm
parents: 21256
diff changeset
   375
  Inf_many  (binder "\<exists>\<^sub>\<infinity>" 10) and
20809
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   376
  Alm_all  (binder "\<forall>\<^sub>\<infinity>" 10)
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   377
34112
ca842111d698 added lemmas about INFM/MOST
huffman
parents: 30663
diff changeset
   378
lemma INFM_iff_infinite: "(INFM x. P x) \<longleftrightarrow> infinite {x. P x}"
ca842111d698 added lemmas about INFM/MOST
huffman
parents: 30663
diff changeset
   379
  unfolding Inf_many_def ..
ca842111d698 added lemmas about INFM/MOST
huffman
parents: 30663
diff changeset
   380
ca842111d698 added lemmas about INFM/MOST
huffman
parents: 30663
diff changeset
   381
lemma MOST_iff_cofinite: "(MOST x. P x) \<longleftrightarrow> finite {x. \<not> P x}"
ca842111d698 added lemmas about INFM/MOST
huffman
parents: 30663
diff changeset
   382
  unfolding Alm_all_def Inf_many_def by simp
ca842111d698 added lemmas about INFM/MOST
huffman
parents: 30663
diff changeset
   383
ca842111d698 added lemmas about INFM/MOST
huffman
parents: 30663
diff changeset
   384
(* legacy name *)
ca842111d698 added lemmas about INFM/MOST
huffman
parents: 30663
diff changeset
   385
lemmas MOST_iff_finiteNeg = MOST_iff_cofinite
ca842111d698 added lemmas about INFM/MOST
huffman
parents: 30663
diff changeset
   386
ca842111d698 added lemmas about INFM/MOST
huffman
parents: 30663
diff changeset
   387
lemma not_INFM [simp]: "\<not> (INFM x. P x) \<longleftrightarrow> (MOST x. \<not> P x)"
ca842111d698 added lemmas about INFM/MOST
huffman
parents: 30663
diff changeset
   388
  unfolding Alm_all_def not_not ..
20809
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   389
34112
ca842111d698 added lemmas about INFM/MOST
huffman
parents: 30663
diff changeset
   390
lemma not_MOST [simp]: "\<not> (MOST x. P x) \<longleftrightarrow> (INFM x. \<not> P x)"
ca842111d698 added lemmas about INFM/MOST
huffman
parents: 30663
diff changeset
   391
  unfolding Alm_all_def not_not ..
ca842111d698 added lemmas about INFM/MOST
huffman
parents: 30663
diff changeset
   392
ca842111d698 added lemmas about INFM/MOST
huffman
parents: 30663
diff changeset
   393
lemma INFM_const [simp]: "(INFM x::'a. P) \<longleftrightarrow> P \<and> infinite (UNIV::'a set)"
ca842111d698 added lemmas about INFM/MOST
huffman
parents: 30663
diff changeset
   394
  unfolding Inf_many_def by simp
ca842111d698 added lemmas about INFM/MOST
huffman
parents: 30663
diff changeset
   395
ca842111d698 added lemmas about INFM/MOST
huffman
parents: 30663
diff changeset
   396
lemma MOST_const [simp]: "(MOST x::'a. P) \<longleftrightarrow> P \<or> finite (UNIV::'a set)"
ca842111d698 added lemmas about INFM/MOST
huffman
parents: 30663
diff changeset
   397
  unfolding Alm_all_def by simp
ca842111d698 added lemmas about INFM/MOST
huffman
parents: 30663
diff changeset
   398
ca842111d698 added lemmas about INFM/MOST
huffman
parents: 30663
diff changeset
   399
lemma INFM_EX: "(\<exists>\<^sub>\<infinity>x. P x) \<Longrightarrow> (\<exists>x. P x)"
ca842111d698 added lemmas about INFM/MOST
huffman
parents: 30663
diff changeset
   400
  by (erule contrapos_pp, simp)
20809
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   401
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   402
lemma ALL_MOST: "\<forall>x. P x \<Longrightarrow> \<forall>\<^sub>\<infinity>x. P x"
34112
ca842111d698 added lemmas about INFM/MOST
huffman
parents: 30663
diff changeset
   403
  by simp
ca842111d698 added lemmas about INFM/MOST
huffman
parents: 30663
diff changeset
   404
ca842111d698 added lemmas about INFM/MOST
huffman
parents: 30663
diff changeset
   405
lemma INFM_E: assumes "INFM x. P x" obtains x where "P x"
ca842111d698 added lemmas about INFM/MOST
huffman
parents: 30663
diff changeset
   406
  using INFM_EX [OF assms] by (rule exE)
ca842111d698 added lemmas about INFM/MOST
huffman
parents: 30663
diff changeset
   407
ca842111d698 added lemmas about INFM/MOST
huffman
parents: 30663
diff changeset
   408
lemma MOST_I: assumes "\<And>x. P x" shows "MOST x. P x"
ca842111d698 added lemmas about INFM/MOST
huffman
parents: 30663
diff changeset
   409
  using assms by simp
20809
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   410
27407
68e111812b83 rename lemmas INF_foo to INFM_foo; add new lemmas about MOST and INFM
huffman
parents: 27368
diff changeset
   411
lemma INFM_mono:
20809
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   412
  assumes inf: "\<exists>\<^sub>\<infinity>x. P x" and q: "\<And>x. P x \<Longrightarrow> Q x"
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   413
  shows "\<exists>\<^sub>\<infinity>x. Q x"
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   414
proof -
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   415
  from inf have "infinite {x. P x}" unfolding Inf_many_def .
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   416
  moreover from q have "{x. P x} \<subseteq> {x. Q x}" by auto
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   417
  ultimately show ?thesis
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   418
    by (simp add: Inf_many_def infinite_super)
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   419
qed
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   420
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   421
lemma MOST_mono: "\<forall>\<^sub>\<infinity>x. P x \<Longrightarrow> (\<And>x. P x \<Longrightarrow> Q x) \<Longrightarrow> \<forall>\<^sub>\<infinity>x. Q x"
27407
68e111812b83 rename lemmas INF_foo to INFM_foo; add new lemmas about MOST and INFM
huffman
parents: 27368
diff changeset
   422
  unfolding Alm_all_def by (blast intro: INFM_mono)
68e111812b83 rename lemmas INF_foo to INFM_foo; add new lemmas about MOST and INFM
huffman
parents: 27368
diff changeset
   423
68e111812b83 rename lemmas INF_foo to INFM_foo; add new lemmas about MOST and INFM
huffman
parents: 27368
diff changeset
   424
lemma INFM_disj_distrib:
68e111812b83 rename lemmas INF_foo to INFM_foo; add new lemmas about MOST and INFM
huffman
parents: 27368
diff changeset
   425
  "(\<exists>\<^sub>\<infinity>x. P x \<or> Q x) \<longleftrightarrow> (\<exists>\<^sub>\<infinity>x. P x) \<or> (\<exists>\<^sub>\<infinity>x. Q x)"
68e111812b83 rename lemmas INF_foo to INFM_foo; add new lemmas about MOST and INFM
huffman
parents: 27368
diff changeset
   426
  unfolding Inf_many_def by (simp add: Collect_disj_eq)
68e111812b83 rename lemmas INF_foo to INFM_foo; add new lemmas about MOST and INFM
huffman
parents: 27368
diff changeset
   427
34112
ca842111d698 added lemmas about INFM/MOST
huffman
parents: 30663
diff changeset
   428
lemma INFM_imp_distrib:
ca842111d698 added lemmas about INFM/MOST
huffman
parents: 30663
diff changeset
   429
  "(INFM x. P x \<longrightarrow> Q x) \<longleftrightarrow> ((MOST x. P x) \<longrightarrow> (INFM x. Q x))"
ca842111d698 added lemmas about INFM/MOST
huffman
parents: 30663
diff changeset
   430
  by (simp only: imp_conv_disj INFM_disj_distrib not_MOST)
ca842111d698 added lemmas about INFM/MOST
huffman
parents: 30663
diff changeset
   431
27407
68e111812b83 rename lemmas INF_foo to INFM_foo; add new lemmas about MOST and INFM
huffman
parents: 27368
diff changeset
   432
lemma MOST_conj_distrib:
68e111812b83 rename lemmas INF_foo to INFM_foo; add new lemmas about MOST and INFM
huffman
parents: 27368
diff changeset
   433
  "(\<forall>\<^sub>\<infinity>x. P x \<and> Q x) \<longleftrightarrow> (\<forall>\<^sub>\<infinity>x. P x) \<and> (\<forall>\<^sub>\<infinity>x. Q x)"
68e111812b83 rename lemmas INF_foo to INFM_foo; add new lemmas about MOST and INFM
huffman
parents: 27368
diff changeset
   434
  unfolding Alm_all_def by (simp add: INFM_disj_distrib del: disj_not1)
20809
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   435
34112
ca842111d698 added lemmas about INFM/MOST
huffman
parents: 30663
diff changeset
   436
lemma MOST_conjI:
ca842111d698 added lemmas about INFM/MOST
huffman
parents: 30663
diff changeset
   437
  "MOST x. P x \<Longrightarrow> MOST x. Q x \<Longrightarrow> MOST x. P x \<and> Q x"
ca842111d698 added lemmas about INFM/MOST
huffman
parents: 30663
diff changeset
   438
  by (simp add: MOST_conj_distrib)
ca842111d698 added lemmas about INFM/MOST
huffman
parents: 30663
diff changeset
   439
34113
dbc0fb6e7eae add lemma INFM_conjI
huffman
parents: 34112
diff changeset
   440
lemma INFM_conjI:
dbc0fb6e7eae add lemma INFM_conjI
huffman
parents: 34112
diff changeset
   441
  "INFM x. P x \<Longrightarrow> MOST x. Q x \<Longrightarrow> INFM x. P x \<and> Q x"
dbc0fb6e7eae add lemma INFM_conjI
huffman
parents: 34112
diff changeset
   442
  unfolding MOST_iff_cofinite INFM_iff_infinite
dbc0fb6e7eae add lemma INFM_conjI
huffman
parents: 34112
diff changeset
   443
  apply (drule (1) Diff_infinite_finite)
dbc0fb6e7eae add lemma INFM_conjI
huffman
parents: 34112
diff changeset
   444
  apply (simp add: Collect_conj_eq Collect_neg_eq)
dbc0fb6e7eae add lemma INFM_conjI
huffman
parents: 34112
diff changeset
   445
  done
dbc0fb6e7eae add lemma INFM_conjI
huffman
parents: 34112
diff changeset
   446
27407
68e111812b83 rename lemmas INF_foo to INFM_foo; add new lemmas about MOST and INFM
huffman
parents: 27368
diff changeset
   447
lemma MOST_rev_mp:
68e111812b83 rename lemmas INF_foo to INFM_foo; add new lemmas about MOST and INFM
huffman
parents: 27368
diff changeset
   448
  assumes "\<forall>\<^sub>\<infinity>x. P x" and "\<forall>\<^sub>\<infinity>x. P x \<longrightarrow> Q x"
68e111812b83 rename lemmas INF_foo to INFM_foo; add new lemmas about MOST and INFM
huffman
parents: 27368
diff changeset
   449
  shows "\<forall>\<^sub>\<infinity>x. Q x"
68e111812b83 rename lemmas INF_foo to INFM_foo; add new lemmas about MOST and INFM
huffman
parents: 27368
diff changeset
   450
proof -
68e111812b83 rename lemmas INF_foo to INFM_foo; add new lemmas about MOST and INFM
huffman
parents: 27368
diff changeset
   451
  have "\<forall>\<^sub>\<infinity>x. P x \<and> (P x \<longrightarrow> Q x)"
34112
ca842111d698 added lemmas about INFM/MOST
huffman
parents: 30663
diff changeset
   452
    using assms by (rule MOST_conjI)
27407
68e111812b83 rename lemmas INF_foo to INFM_foo; add new lemmas about MOST and INFM
huffman
parents: 27368
diff changeset
   453
  thus ?thesis by (rule MOST_mono) simp
68e111812b83 rename lemmas INF_foo to INFM_foo; add new lemmas about MOST and INFM
huffman
parents: 27368
diff changeset
   454
qed
68e111812b83 rename lemmas INF_foo to INFM_foo; add new lemmas about MOST and INFM
huffman
parents: 27368
diff changeset
   455
34112
ca842111d698 added lemmas about INFM/MOST
huffman
parents: 30663
diff changeset
   456
lemma MOST_imp_iff:
ca842111d698 added lemmas about INFM/MOST
huffman
parents: 30663
diff changeset
   457
  assumes "MOST x. P x"
ca842111d698 added lemmas about INFM/MOST
huffman
parents: 30663
diff changeset
   458
  shows "(MOST x. P x \<longrightarrow> Q x) \<longleftrightarrow> (MOST x. Q x)"
ca842111d698 added lemmas about INFM/MOST
huffman
parents: 30663
diff changeset
   459
proof
ca842111d698 added lemmas about INFM/MOST
huffman
parents: 30663
diff changeset
   460
  assume "MOST x. P x \<longrightarrow> Q x"
ca842111d698 added lemmas about INFM/MOST
huffman
parents: 30663
diff changeset
   461
  with assms show "MOST x. Q x" by (rule MOST_rev_mp)
ca842111d698 added lemmas about INFM/MOST
huffman
parents: 30663
diff changeset
   462
next
ca842111d698 added lemmas about INFM/MOST
huffman
parents: 30663
diff changeset
   463
  assume "MOST x. Q x"
ca842111d698 added lemmas about INFM/MOST
huffman
parents: 30663
diff changeset
   464
  then show "MOST x. P x \<longrightarrow> Q x" by (rule MOST_mono) simp
ca842111d698 added lemmas about INFM/MOST
huffman
parents: 30663
diff changeset
   465
qed
27407
68e111812b83 rename lemmas INF_foo to INFM_foo; add new lemmas about MOST and INFM
huffman
parents: 27368
diff changeset
   466
34112
ca842111d698 added lemmas about INFM/MOST
huffman
parents: 30663
diff changeset
   467
lemma INFM_MOST_simps [simp]:
ca842111d698 added lemmas about INFM/MOST
huffman
parents: 30663
diff changeset
   468
  "\<And>P Q. (INFM x. P x \<and> Q) \<longleftrightarrow> (INFM x. P x) \<and> Q"
ca842111d698 added lemmas about INFM/MOST
huffman
parents: 30663
diff changeset
   469
  "\<And>P Q. (INFM x. P \<and> Q x) \<longleftrightarrow> P \<and> (INFM x. Q x)"
ca842111d698 added lemmas about INFM/MOST
huffman
parents: 30663
diff changeset
   470
  "\<And>P Q. (MOST x. P x \<or> Q) \<longleftrightarrow> (MOST x. P x) \<or> Q"
ca842111d698 added lemmas about INFM/MOST
huffman
parents: 30663
diff changeset
   471
  "\<And>P Q. (MOST x. P \<or> Q x) \<longleftrightarrow> P \<or> (MOST x. Q x)"
ca842111d698 added lemmas about INFM/MOST
huffman
parents: 30663
diff changeset
   472
  "\<And>P Q. (MOST x. P x \<longrightarrow> Q) \<longleftrightarrow> ((INFM x. P x) \<longrightarrow> Q)"
ca842111d698 added lemmas about INFM/MOST
huffman
parents: 30663
diff changeset
   473
  "\<And>P Q. (MOST x. P \<longrightarrow> Q x) \<longleftrightarrow> (P \<longrightarrow> (MOST x. Q x))"
ca842111d698 added lemmas about INFM/MOST
huffman
parents: 30663
diff changeset
   474
  unfolding Alm_all_def Inf_many_def
ca842111d698 added lemmas about INFM/MOST
huffman
parents: 30663
diff changeset
   475
  by (simp_all add: Collect_conj_eq)
ca842111d698 added lemmas about INFM/MOST
huffman
parents: 30663
diff changeset
   476
ca842111d698 added lemmas about INFM/MOST
huffman
parents: 30663
diff changeset
   477
text {* Properties of quantifiers with injective functions. *}
ca842111d698 added lemmas about INFM/MOST
huffman
parents: 30663
diff changeset
   478
ca842111d698 added lemmas about INFM/MOST
huffman
parents: 30663
diff changeset
   479
lemma INFM_inj:
ca842111d698 added lemmas about INFM/MOST
huffman
parents: 30663
diff changeset
   480
  "INFM x. P (f x) \<Longrightarrow> inj f \<Longrightarrow> INFM x. P x"
ca842111d698 added lemmas about INFM/MOST
huffman
parents: 30663
diff changeset
   481
  unfolding INFM_iff_infinite
ca842111d698 added lemmas about INFM/MOST
huffman
parents: 30663
diff changeset
   482
  by (clarify, drule (1) finite_vimageI, simp)
27407
68e111812b83 rename lemmas INF_foo to INFM_foo; add new lemmas about MOST and INFM
huffman
parents: 27368
diff changeset
   483
34112
ca842111d698 added lemmas about INFM/MOST
huffman
parents: 30663
diff changeset
   484
lemma MOST_inj:
ca842111d698 added lemmas about INFM/MOST
huffman
parents: 30663
diff changeset
   485
  "MOST x. P x \<Longrightarrow> inj f \<Longrightarrow> MOST x. P (f x)"
ca842111d698 added lemmas about INFM/MOST
huffman
parents: 30663
diff changeset
   486
  unfolding MOST_iff_cofinite
ca842111d698 added lemmas about INFM/MOST
huffman
parents: 30663
diff changeset
   487
  by (drule (1) finite_vimageI, simp)
ca842111d698 added lemmas about INFM/MOST
huffman
parents: 30663
diff changeset
   488
ca842111d698 added lemmas about INFM/MOST
huffman
parents: 30663
diff changeset
   489
text {* Properties of quantifiers with singletons. *}
ca842111d698 added lemmas about INFM/MOST
huffman
parents: 30663
diff changeset
   490
ca842111d698 added lemmas about INFM/MOST
huffman
parents: 30663
diff changeset
   491
lemma not_INFM_eq [simp]:
ca842111d698 added lemmas about INFM/MOST
huffman
parents: 30663
diff changeset
   492
  "\<not> (INFM x. x = a)"
ca842111d698 added lemmas about INFM/MOST
huffman
parents: 30663
diff changeset
   493
  "\<not> (INFM x. a = x)"
ca842111d698 added lemmas about INFM/MOST
huffman
parents: 30663
diff changeset
   494
  unfolding INFM_iff_infinite by simp_all
ca842111d698 added lemmas about INFM/MOST
huffman
parents: 30663
diff changeset
   495
ca842111d698 added lemmas about INFM/MOST
huffman
parents: 30663
diff changeset
   496
lemma MOST_neq [simp]:
ca842111d698 added lemmas about INFM/MOST
huffman
parents: 30663
diff changeset
   497
  "MOST x. x \<noteq> a"
ca842111d698 added lemmas about INFM/MOST
huffman
parents: 30663
diff changeset
   498
  "MOST x. a \<noteq> x"
ca842111d698 added lemmas about INFM/MOST
huffman
parents: 30663
diff changeset
   499
  unfolding MOST_iff_cofinite by simp_all
27407
68e111812b83 rename lemmas INF_foo to INFM_foo; add new lemmas about MOST and INFM
huffman
parents: 27368
diff changeset
   500
34112
ca842111d698 added lemmas about INFM/MOST
huffman
parents: 30663
diff changeset
   501
lemma INFM_neq [simp]:
ca842111d698 added lemmas about INFM/MOST
huffman
parents: 30663
diff changeset
   502
  "(INFM x::'a. x \<noteq> a) \<longleftrightarrow> infinite (UNIV::'a set)"
ca842111d698 added lemmas about INFM/MOST
huffman
parents: 30663
diff changeset
   503
  "(INFM x::'a. a \<noteq> x) \<longleftrightarrow> infinite (UNIV::'a set)"
ca842111d698 added lemmas about INFM/MOST
huffman
parents: 30663
diff changeset
   504
  unfolding INFM_iff_infinite by simp_all
ca842111d698 added lemmas about INFM/MOST
huffman
parents: 30663
diff changeset
   505
ca842111d698 added lemmas about INFM/MOST
huffman
parents: 30663
diff changeset
   506
lemma MOST_eq [simp]:
ca842111d698 added lemmas about INFM/MOST
huffman
parents: 30663
diff changeset
   507
  "(MOST x::'a. x = a) \<longleftrightarrow> finite (UNIV::'a set)"
ca842111d698 added lemmas about INFM/MOST
huffman
parents: 30663
diff changeset
   508
  "(MOST x::'a. a = x) \<longleftrightarrow> finite (UNIV::'a set)"
ca842111d698 added lemmas about INFM/MOST
huffman
parents: 30663
diff changeset
   509
  unfolding MOST_iff_cofinite by simp_all
ca842111d698 added lemmas about INFM/MOST
huffman
parents: 30663
diff changeset
   510
ca842111d698 added lemmas about INFM/MOST
huffman
parents: 30663
diff changeset
   511
lemma MOST_eq_imp:
ca842111d698 added lemmas about INFM/MOST
huffman
parents: 30663
diff changeset
   512
  "MOST x. x = a \<longrightarrow> P x"
ca842111d698 added lemmas about INFM/MOST
huffman
parents: 30663
diff changeset
   513
  "MOST x. a = x \<longrightarrow> P x"
ca842111d698 added lemmas about INFM/MOST
huffman
parents: 30663
diff changeset
   514
  unfolding MOST_iff_cofinite by simp_all
ca842111d698 added lemmas about INFM/MOST
huffman
parents: 30663
diff changeset
   515
ca842111d698 added lemmas about INFM/MOST
huffman
parents: 30663
diff changeset
   516
text {* Properties of quantifiers over the naturals. *}
27407
68e111812b83 rename lemmas INF_foo to INFM_foo; add new lemmas about MOST and INFM
huffman
parents: 27368
diff changeset
   517
68e111812b83 rename lemmas INF_foo to INFM_foo; add new lemmas about MOST and INFM
huffman
parents: 27368
diff changeset
   518
lemma INFM_nat: "(\<exists>\<^sub>\<infinity>n. P (n::nat)) = (\<forall>m. \<exists>n. m<n \<and> P n)"
20809
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   519
  by (simp add: Inf_many_def infinite_nat_iff_unbounded)
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   520
27407
68e111812b83 rename lemmas INF_foo to INFM_foo; add new lemmas about MOST and INFM
huffman
parents: 27368
diff changeset
   521
lemma INFM_nat_le: "(\<exists>\<^sub>\<infinity>n. P (n::nat)) = (\<forall>m. \<exists>n. m\<le>n \<and> P n)"
20809
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   522
  by (simp add: Inf_many_def infinite_nat_iff_unbounded_le)
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   523
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   524
lemma MOST_nat: "(\<forall>\<^sub>\<infinity>n. P (n::nat)) = (\<exists>m. \<forall>n. m<n \<longrightarrow> P n)"
27407
68e111812b83 rename lemmas INF_foo to INFM_foo; add new lemmas about MOST and INFM
huffman
parents: 27368
diff changeset
   525
  by (simp add: Alm_all_def INFM_nat)
20809
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   526
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   527
lemma MOST_nat_le: "(\<forall>\<^sub>\<infinity>n. P (n::nat)) = (\<exists>m. \<forall>n. m\<le>n \<longrightarrow> P n)"
27407
68e111812b83 rename lemmas INF_foo to INFM_foo; add new lemmas about MOST and INFM
huffman
parents: 27368
diff changeset
   528
  by (simp add: Alm_all_def INFM_nat_le)
20809
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   529
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   530
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   531
subsection "Enumeration of an Infinite Set"
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   532
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   533
text {*
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   534
  The set's element type must be wellordered (e.g. the natural numbers).
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   535
*}
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   536
34941
156925dd67af dropped some old primrecs and some constdefs
haftmann
parents: 34113
diff changeset
   537
primrec (in wellorder) enumerate :: "'a set \<Rightarrow> nat \<Rightarrow> 'a" where
156925dd67af dropped some old primrecs and some constdefs
haftmann
parents: 34113
diff changeset
   538
    enumerate_0:   "enumerate S 0       = (LEAST n. n \<in> S)"
156925dd67af dropped some old primrecs and some constdefs
haftmann
parents: 34113
diff changeset
   539
  | enumerate_Suc: "enumerate S (Suc n) = enumerate (S - {LEAST n. n \<in> S}) n"
20809
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   540
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   541
lemma enumerate_Suc':
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   542
    "enumerate S (Suc n) = enumerate (S - {enumerate S 0}) n"
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   543
  by simp
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   544
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   545
lemma enumerate_in_set: "infinite S \<Longrightarrow> enumerate S n : S"
29901
f4b3f8fbf599 finiteness lemmas
nipkow
parents: 29839
diff changeset
   546
apply (induct n arbitrary: S)
44890
22f665a2e91c new fastforce replacing fastsimp - less confusing name
nipkow
parents: 44454
diff changeset
   547
 apply (fastforce intro: LeastI dest!: infinite_imp_nonempty)
29901
f4b3f8fbf599 finiteness lemmas
nipkow
parents: 29839
diff changeset
   548
apply simp
44454
6f28f96a09bf avoid warnings
huffman
parents: 44169
diff changeset
   549
apply (metis DiffE infinite_remove)
29901
f4b3f8fbf599 finiteness lemmas
nipkow
parents: 29839
diff changeset
   550
done
20809
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   551
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   552
declare enumerate_0 [simp del] enumerate_Suc [simp del]
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   553
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   554
lemma enumerate_step: "infinite S \<Longrightarrow> enumerate S n < enumerate S (Suc n)"
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   555
  apply (induct n arbitrary: S)
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   556
   apply (rule order_le_neq_trans)
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   557
    apply (simp add: enumerate_0 Least_le enumerate_in_set)
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   558
   apply (simp only: enumerate_Suc')
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   559
   apply (subgoal_tac "enumerate (S - {enumerate S 0}) 0 : S - {enumerate S 0}")
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   560
    apply (blast intro: sym)
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   561
   apply (simp add: enumerate_in_set del: Diff_iff)
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   562
  apply (simp add: enumerate_Suc')
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   563
  done
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   564
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   565
lemma enumerate_mono: "m<n \<Longrightarrow> infinite S \<Longrightarrow> enumerate S m < enumerate S n"
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   566
  apply (erule less_Suc_induct)
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   567
  apply (auto intro: enumerate_step)
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   568
  done
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   569
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   570
50134
13211e07d931 add Countable_Set theory
hoelzl
parents: 46783
diff changeset
   571
lemma le_enumerate:
13211e07d931 add Countable_Set theory
hoelzl
parents: 46783
diff changeset
   572
  assumes S: "infinite S"
13211e07d931 add Countable_Set theory
hoelzl
parents: 46783
diff changeset
   573
  shows "n \<le> enumerate S n"
13211e07d931 add Countable_Set theory
hoelzl
parents: 46783
diff changeset
   574
  using S 
13211e07d931 add Countable_Set theory
hoelzl
parents: 46783
diff changeset
   575
proof (induct n)
13211e07d931 add Countable_Set theory
hoelzl
parents: 46783
diff changeset
   576
  case (Suc n)
13211e07d931 add Countable_Set theory
hoelzl
parents: 46783
diff changeset
   577
  then have "n \<le> enumerate S n" by simp
13211e07d931 add Countable_Set theory
hoelzl
parents: 46783
diff changeset
   578
  also note enumerate_mono[of n "Suc n", OF _ `infinite S`]
13211e07d931 add Countable_Set theory
hoelzl
parents: 46783
diff changeset
   579
  finally show ?case by simp
13211e07d931 add Countable_Set theory
hoelzl
parents: 46783
diff changeset
   580
qed simp
13211e07d931 add Countable_Set theory
hoelzl
parents: 46783
diff changeset
   581
13211e07d931 add Countable_Set theory
hoelzl
parents: 46783
diff changeset
   582
lemma enumerate_Suc'':
13211e07d931 add Countable_Set theory
hoelzl
parents: 46783
diff changeset
   583
  fixes S :: "'a::wellorder set"
13211e07d931 add Countable_Set theory
hoelzl
parents: 46783
diff changeset
   584
  shows "infinite S  \<Longrightarrow> enumerate S (Suc n) = (LEAST s. s \<in> S \<and> enumerate S n < s)"
13211e07d931 add Countable_Set theory
hoelzl
parents: 46783
diff changeset
   585
proof (induct n arbitrary: S)
13211e07d931 add Countable_Set theory
hoelzl
parents: 46783
diff changeset
   586
  case 0
13211e07d931 add Countable_Set theory
hoelzl
parents: 46783
diff changeset
   587
  then have "\<forall>s\<in>S. enumerate S 0 \<le> s"
13211e07d931 add Countable_Set theory
hoelzl
parents: 46783
diff changeset
   588
    by (auto simp: enumerate.simps intro: Least_le)
13211e07d931 add Countable_Set theory
hoelzl
parents: 46783
diff changeset
   589
  then show ?case
13211e07d931 add Countable_Set theory
hoelzl
parents: 46783
diff changeset
   590
    unfolding enumerate_Suc' enumerate_0[of "S - {enumerate S 0}"]
13211e07d931 add Countable_Set theory
hoelzl
parents: 46783
diff changeset
   591
    by (intro arg_cong[where f=Least] ext) auto
13211e07d931 add Countable_Set theory
hoelzl
parents: 46783
diff changeset
   592
next
13211e07d931 add Countable_Set theory
hoelzl
parents: 46783
diff changeset
   593
  case (Suc n S)
13211e07d931 add Countable_Set theory
hoelzl
parents: 46783
diff changeset
   594
  show ?case
13211e07d931 add Countable_Set theory
hoelzl
parents: 46783
diff changeset
   595
    using enumerate_mono[OF zero_less_Suc `infinite S`, of n] `infinite S`
13211e07d931 add Countable_Set theory
hoelzl
parents: 46783
diff changeset
   596
    apply (subst (1 2) enumerate_Suc')
13211e07d931 add Countable_Set theory
hoelzl
parents: 46783
diff changeset
   597
    apply (subst Suc)
13211e07d931 add Countable_Set theory
hoelzl
parents: 46783
diff changeset
   598
    apply (insert `infinite S`, simp)
13211e07d931 add Countable_Set theory
hoelzl
parents: 46783
diff changeset
   599
    by (intro arg_cong[where f=Least] ext)
13211e07d931 add Countable_Set theory
hoelzl
parents: 46783
diff changeset
   600
       (auto simp: enumerate_Suc'[symmetric])
13211e07d931 add Countable_Set theory
hoelzl
parents: 46783
diff changeset
   601
qed
13211e07d931 add Countable_Set theory
hoelzl
parents: 46783
diff changeset
   602
13211e07d931 add Countable_Set theory
hoelzl
parents: 46783
diff changeset
   603
lemma enumerate_Ex:
13211e07d931 add Countable_Set theory
hoelzl
parents: 46783
diff changeset
   604
  assumes S: "infinite (S::nat set)"
13211e07d931 add Countable_Set theory
hoelzl
parents: 46783
diff changeset
   605
  shows "s \<in> S \<Longrightarrow> \<exists>n. enumerate S n = s"
13211e07d931 add Countable_Set theory
hoelzl
parents: 46783
diff changeset
   606
proof (induct s rule: less_induct)
13211e07d931 add Countable_Set theory
hoelzl
parents: 46783
diff changeset
   607
  case (less s)
13211e07d931 add Countable_Set theory
hoelzl
parents: 46783
diff changeset
   608
  show ?case
13211e07d931 add Countable_Set theory
hoelzl
parents: 46783
diff changeset
   609
  proof cases
13211e07d931 add Countable_Set theory
hoelzl
parents: 46783
diff changeset
   610
    let ?y = "Max {s'\<in>S. s' < s}"
13211e07d931 add Countable_Set theory
hoelzl
parents: 46783
diff changeset
   611
    assume "\<exists>y\<in>S. y < s"
13211e07d931 add Countable_Set theory
hoelzl
parents: 46783
diff changeset
   612
    then have y: "\<And>x. ?y < x \<longleftrightarrow> (\<forall>s'\<in>S. s' < s \<longrightarrow> s' < x)" by (subst Max_less_iff) auto
13211e07d931 add Countable_Set theory
hoelzl
parents: 46783
diff changeset
   613
    then have y_in: "?y \<in> {s'\<in>S. s' < s}" by (intro Max_in) auto
13211e07d931 add Countable_Set theory
hoelzl
parents: 46783
diff changeset
   614
    with less.hyps[of ?y] obtain n where "enumerate S n = ?y" by auto
13211e07d931 add Countable_Set theory
hoelzl
parents: 46783
diff changeset
   615
    with S have "enumerate S (Suc n) = s"
13211e07d931 add Countable_Set theory
hoelzl
parents: 46783
diff changeset
   616
      by (auto simp: y less enumerate_Suc'' intro!: Least_equality)
13211e07d931 add Countable_Set theory
hoelzl
parents: 46783
diff changeset
   617
    then show ?case by auto
13211e07d931 add Countable_Set theory
hoelzl
parents: 46783
diff changeset
   618
  next
13211e07d931 add Countable_Set theory
hoelzl
parents: 46783
diff changeset
   619
    assume *: "\<not> (\<exists>y\<in>S. y < s)"
13211e07d931 add Countable_Set theory
hoelzl
parents: 46783
diff changeset
   620
    then have "\<forall>t\<in>S. s \<le> t" by auto
13211e07d931 add Countable_Set theory
hoelzl
parents: 46783
diff changeset
   621
    with `s \<in> S` show ?thesis
13211e07d931 add Countable_Set theory
hoelzl
parents: 46783
diff changeset
   622
      by (auto intro!: exI[of _ 0] Least_equality simp: enumerate_0)
13211e07d931 add Countable_Set theory
hoelzl
parents: 46783
diff changeset
   623
  qed
13211e07d931 add Countable_Set theory
hoelzl
parents: 46783
diff changeset
   624
qed
13211e07d931 add Countable_Set theory
hoelzl
parents: 46783
diff changeset
   625
13211e07d931 add Countable_Set theory
hoelzl
parents: 46783
diff changeset
   626
lemma bij_enumerate:
13211e07d931 add Countable_Set theory
hoelzl
parents: 46783
diff changeset
   627
  fixes S :: "nat set"
13211e07d931 add Countable_Set theory
hoelzl
parents: 46783
diff changeset
   628
  assumes S: "infinite S"
13211e07d931 add Countable_Set theory
hoelzl
parents: 46783
diff changeset
   629
  shows "bij_betw (enumerate S) UNIV S"
13211e07d931 add Countable_Set theory
hoelzl
parents: 46783
diff changeset
   630
proof -
13211e07d931 add Countable_Set theory
hoelzl
parents: 46783
diff changeset
   631
  have "\<And>n m. n \<noteq> m \<Longrightarrow> enumerate S n \<noteq> enumerate S m"
13211e07d931 add Countable_Set theory
hoelzl
parents: 46783
diff changeset
   632
    using enumerate_mono[OF _ `infinite S`] by (auto simp: neq_iff)
13211e07d931 add Countable_Set theory
hoelzl
parents: 46783
diff changeset
   633
  then have "inj (enumerate S)"
13211e07d931 add Countable_Set theory
hoelzl
parents: 46783
diff changeset
   634
    by (auto simp: inj_on_def)
13211e07d931 add Countable_Set theory
hoelzl
parents: 46783
diff changeset
   635
  moreover have "\<forall>s\<in>S. \<exists>i. enumerate S i = s"
13211e07d931 add Countable_Set theory
hoelzl
parents: 46783
diff changeset
   636
    using enumerate_Ex[OF S] by auto
13211e07d931 add Countable_Set theory
hoelzl
parents: 46783
diff changeset
   637
  moreover note `infinite S`
13211e07d931 add Countable_Set theory
hoelzl
parents: 46783
diff changeset
   638
  ultimately show ?thesis
13211e07d931 add Countable_Set theory
hoelzl
parents: 46783
diff changeset
   639
    unfolding bij_betw_def by (auto intro: enumerate_in_set)
13211e07d931 add Countable_Set theory
hoelzl
parents: 46783
diff changeset
   640
qed
13211e07d931 add Countable_Set theory
hoelzl
parents: 46783
diff changeset
   641
20809
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   642
subsection "Miscellaneous"
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   643
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   644
text {*
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   645
  A few trivial lemmas about sets that contain at most one element.
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   646
  These simplify the reasoning about deterministic automata.
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   647
*}
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   648
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   649
definition
21404
eb85850d3eb7 more robust syntax for definition/abbreviation/notation;
wenzelm
parents: 21256
diff changeset
   650
  atmost_one :: "'a set \<Rightarrow> bool" where
20809
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   651
  "atmost_one S = (\<forall>x y. x\<in>S \<and> y\<in>S \<longrightarrow> x=y)"
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   652
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   653
lemma atmost_one_empty: "S = {} \<Longrightarrow> atmost_one S"
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   654
  by (simp add: atmost_one_def)
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   655
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   656
lemma atmost_one_singleton: "S = {x} \<Longrightarrow> atmost_one S"
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   657
  by (simp add: atmost_one_def)
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   658
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   659
lemma atmost_one_unique [elim]: "atmost_one S \<Longrightarrow> x \<in> S \<Longrightarrow> y \<in> S \<Longrightarrow> y = x"
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   660
  by (simp add: atmost_one_def)
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   661
6c4fd0b4b63a moved theory Infinite_Set to Library;
wenzelm
parents:
diff changeset
   662
end
46783
3e89a5cab8d7 tuned whitespace
haftmann
parents: 44890
diff changeset
   663