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