src/HOL/NSA/Filter.thy
author wenzelm
Fri Apr 16 21:28:09 2010 +0200 (2010-04-16)
changeset 36176 3fe7e97ccca8
parent 28823 dcbef866c9e2
child 41589 bbd861837ebc
permissions -rw-r--r--
replaced generic 'hide' command by more conventional 'hide_class', 'hide_type', 'hide_const', 'hide_fact' -- frees some popular keywords;
huffman@27468
     1
(*  Title       : Filter.thy
huffman@27468
     2
    ID          : $Id$
huffman@27468
     3
    Author      : Jacques D. Fleuriot
huffman@27468
     4
    Copyright   : 1998  University of Cambridge
huffman@27468
     5
    Conversion to Isar and new proofs by Lawrence C Paulson, 2004
huffman@27468
     6
    Conversion to locales by Brian Huffman, 2005
huffman@27468
     7
*) 
huffman@27468
     8
huffman@27468
     9
header {* Filters and Ultrafilters *}
huffman@27468
    10
huffman@27468
    11
theory Filter
huffman@27468
    12
imports "~~/src/HOL/Library/Zorn" "~~/src/HOL/Library/Infinite_Set"
huffman@27468
    13
begin
huffman@27468
    14
huffman@27468
    15
subsection {* Definitions and basic properties *}
huffman@27468
    16
huffman@27468
    17
subsubsection {* Filters *}
huffman@27468
    18
huffman@27468
    19
locale filter =
huffman@27468
    20
  fixes F :: "'a set set"
huffman@27468
    21
  assumes UNIV [iff]:  "UNIV \<in> F"
huffman@27468
    22
  assumes empty [iff]: "{} \<notin> F"
huffman@27468
    23
  assumes Int:         "\<lbrakk>u \<in> F; v \<in> F\<rbrakk> \<Longrightarrow> u \<inter> v \<in> F"
huffman@27468
    24
  assumes subset:      "\<lbrakk>u \<in> F; u \<subseteq> v\<rbrakk> \<Longrightarrow> v \<in> F"
huffman@27468
    25
huffman@27468
    26
lemma (in filter) memD: "A \<in> F \<Longrightarrow> - A \<notin> F"
huffman@27468
    27
proof
huffman@27468
    28
  assume "A \<in> F" and "- A \<in> F"
huffman@27468
    29
  hence "A \<inter> (- A) \<in> F" by (rule Int)
huffman@27468
    30
  thus "False" by simp
huffman@27468
    31
qed
huffman@27468
    32
huffman@27468
    33
lemma (in filter) not_memI: "- A \<in> F \<Longrightarrow> A \<notin> F"
huffman@27468
    34
by (drule memD, simp)
huffman@27468
    35
huffman@27468
    36
lemma (in filter) Int_iff: "(x \<inter> y \<in> F) = (x \<in> F \<and> y \<in> F)"
huffman@27468
    37
by (auto elim: subset intro: Int)
huffman@27468
    38
huffman@27468
    39
subsubsection {* Ultrafilters *}
huffman@27468
    40
huffman@27468
    41
locale ultrafilter = filter +
huffman@27468
    42
  assumes ultra: "A \<in> F \<or> - A \<in> F"
huffman@27468
    43
huffman@27468
    44
lemma (in ultrafilter) memI: "- A \<notin> F \<Longrightarrow> A \<in> F"
huffman@27468
    45
by (cut_tac ultra [of A], simp)
huffman@27468
    46
huffman@27468
    47
lemma (in ultrafilter) not_memD: "A \<notin> F \<Longrightarrow> - A \<in> F"
huffman@27468
    48
by (rule memI, simp)
huffman@27468
    49
huffman@27468
    50
lemma (in ultrafilter) not_mem_iff: "(A \<notin> F) = (- A \<in> F)"
huffman@27468
    51
by (rule iffI [OF not_memD not_memI])
huffman@27468
    52
huffman@27468
    53
lemma (in ultrafilter) Compl_iff: "(- A \<in> F) = (A \<notin> F)"
huffman@27468
    54
by (rule iffI [OF not_memI not_memD])
huffman@27468
    55
huffman@27468
    56
lemma (in ultrafilter) Un_iff: "(x \<union> y \<in> F) = (x \<in> F \<or> y \<in> F)"
huffman@27468
    57
 apply (rule iffI)
huffman@27468
    58
  apply (erule contrapos_pp)
huffman@27468
    59
  apply (simp add: Int_iff not_mem_iff)
huffman@27468
    60
 apply (auto elim: subset)
huffman@27468
    61
done
huffman@27468
    62
huffman@27468
    63
subsubsection {* Free Ultrafilters *}
huffman@27468
    64
huffman@27468
    65
locale freeultrafilter = ultrafilter +
huffman@27468
    66
  assumes infinite: "A \<in> F \<Longrightarrow> infinite A"
huffman@27468
    67
huffman@27468
    68
lemma (in freeultrafilter) finite: "finite A \<Longrightarrow> A \<notin> F"
huffman@27468
    69
by (erule contrapos_pn, erule infinite)
huffman@27468
    70
huffman@27468
    71
lemma (in freeultrafilter) singleton: "{x} \<notin> F"
huffman@27468
    72
by (rule finite, simp)
huffman@27468
    73
huffman@27468
    74
lemma (in freeultrafilter) insert_iff [simp]: "(insert x A \<in> F) = (A \<in> F)"
huffman@27468
    75
apply (subst insert_is_Un)
huffman@27468
    76
apply (subst Un_iff)
huffman@27468
    77
apply (simp add: singleton)
huffman@27468
    78
done
huffman@27468
    79
haftmann@28823
    80
lemma (in freeultrafilter) filter: "filter F" ..
huffman@27468
    81
haftmann@28823
    82
lemma (in freeultrafilter) ultrafilter: "ultrafilter F" ..
huffman@27468
    83
huffman@27468
    84
huffman@27468
    85
subsection {* Collect properties *}
huffman@27468
    86
huffman@27468
    87
lemma (in filter) Collect_ex:
huffman@27468
    88
  "({n. \<exists>x. P n x} \<in> F) = (\<exists>X. {n. P n (X n)} \<in> F)"
huffman@27468
    89
proof
huffman@27468
    90
  assume "{n. \<exists>x. P n x} \<in> F"
huffman@27468
    91
  hence "{n. P n (SOME x. P n x)} \<in> F"
huffman@27468
    92
    by (auto elim: someI subset)
huffman@27468
    93
  thus "\<exists>X. {n. P n (X n)} \<in> F" by fast
huffman@27468
    94
next
huffman@27468
    95
  show "\<exists>X. {n. P n (X n)} \<in> F \<Longrightarrow> {n. \<exists>x. P n x} \<in> F"
huffman@27468
    96
    by (auto elim: subset)
huffman@27468
    97
qed
huffman@27468
    98
huffman@27468
    99
lemma (in filter) Collect_conj:
huffman@27468
   100
  "({n. P n \<and> Q n} \<in> F) = ({n. P n} \<in> F \<and> {n. Q n} \<in> F)"
huffman@27468
   101
by (subst Collect_conj_eq, rule Int_iff)
huffman@27468
   102
huffman@27468
   103
lemma (in ultrafilter) Collect_not:
huffman@27468
   104
  "({n. \<not> P n} \<in> F) = ({n. P n} \<notin> F)"
huffman@27468
   105
by (subst Collect_neg_eq, rule Compl_iff)
huffman@27468
   106
huffman@27468
   107
lemma (in ultrafilter) Collect_disj:
huffman@27468
   108
  "({n. P n \<or> Q n} \<in> F) = ({n. P n} \<in> F \<or> {n. Q n} \<in> F)"
huffman@27468
   109
by (subst Collect_disj_eq, rule Un_iff)
huffman@27468
   110
huffman@27468
   111
lemma (in ultrafilter) Collect_all:
huffman@27468
   112
  "({n. \<forall>x. P n x} \<in> F) = (\<forall>X. {n. P n (X n)} \<in> F)"
huffman@27468
   113
apply (rule Not_eq_iff [THEN iffD1])
huffman@27468
   114
apply (simp add: Collect_not [symmetric])
huffman@27468
   115
apply (rule Collect_ex)
huffman@27468
   116
done
huffman@27468
   117
huffman@27468
   118
subsection {* Maximal filter = Ultrafilter *}
huffman@27468
   119
huffman@27468
   120
text {*
huffman@27468
   121
   A filter F is an ultrafilter iff it is a maximal filter,
huffman@27468
   122
   i.e. whenever G is a filter and @{term "F \<subseteq> G"} then @{term "F = G"}
huffman@27468
   123
*}
huffman@27468
   124
text {*
huffman@27468
   125
  Lemmas that shows existence of an extension to what was assumed to
huffman@27468
   126
  be a maximal filter. Will be used to derive contradiction in proof of
huffman@27468
   127
  property of ultrafilter.
huffman@27468
   128
*}
huffman@27468
   129
huffman@27468
   130
lemma extend_lemma1: "UNIV \<in> F \<Longrightarrow> A \<in> {X. \<exists>f\<in>F. A \<inter> f \<subseteq> X}"
huffman@27468
   131
by blast
huffman@27468
   132
huffman@27468
   133
lemma extend_lemma2: "F \<subseteq> {X. \<exists>f\<in>F. A \<inter> f \<subseteq> X}"
huffman@27468
   134
by blast
huffman@27468
   135
huffman@27468
   136
lemma (in filter) extend_filter:
huffman@27468
   137
assumes A: "- A \<notin> F"
huffman@27468
   138
shows "filter {X. \<exists>f\<in>F. A \<inter> f \<subseteq> X}" (is "filter ?X")
huffman@27468
   139
proof (rule filter.intro)
huffman@27468
   140
  show "UNIV \<in> ?X" by blast
huffman@27468
   141
next
huffman@27468
   142
  show "{} \<notin> ?X"
huffman@27468
   143
  proof (clarify)
huffman@27468
   144
    fix f assume f: "f \<in> F" and Af: "A \<inter> f \<subseteq> {}"
huffman@27468
   145
    from Af have fA: "f \<subseteq> - A" by blast
huffman@27468
   146
    from f fA have "- A \<in> F" by (rule subset)
huffman@27468
   147
    with A show "False" by simp
huffman@27468
   148
  qed
huffman@27468
   149
next
huffman@27468
   150
  fix u and v
huffman@27468
   151
  assume u: "u \<in> ?X" and v: "v \<in> ?X"
huffman@27468
   152
  from u obtain f where f: "f \<in> F" and Af: "A \<inter> f \<subseteq> u" by blast
huffman@27468
   153
  from v obtain g where g: "g \<in> F" and Ag: "A \<inter> g \<subseteq> v" by blast
huffman@27468
   154
  from f g have fg: "f \<inter> g \<in> F" by (rule Int)
huffman@27468
   155
  from Af Ag have Afg: "A \<inter> (f \<inter> g) \<subseteq> u \<inter> v" by blast
huffman@27468
   156
  from fg Afg show "u \<inter> v \<in> ?X" by blast
huffman@27468
   157
next
huffman@27468
   158
  fix u and v
huffman@27468
   159
  assume uv: "u \<subseteq> v" and u: "u \<in> ?X"
huffman@27468
   160
  from u obtain f where f: "f \<in> F" and Afu: "A \<inter> f \<subseteq> u" by blast
huffman@27468
   161
  from Afu uv have Afv: "A \<inter> f \<subseteq> v" by blast
huffman@27468
   162
  from f Afv have "\<exists>f\<in>F. A \<inter> f \<subseteq> v" by blast
huffman@27468
   163
  thus "v \<in> ?X" by simp
huffman@27468
   164
qed
huffman@27468
   165
huffman@27468
   166
lemma (in filter) max_filter_ultrafilter:
huffman@27468
   167
assumes max: "\<And>G. \<lbrakk>filter G; F \<subseteq> G\<rbrakk> \<Longrightarrow> F = G"
huffman@27468
   168
shows "ultrafilter_axioms F"
huffman@27468
   169
proof (rule ultrafilter_axioms.intro)
huffman@27468
   170
  fix A show "A \<in> F \<or> - A \<in> F"
huffman@27468
   171
  proof (rule disjCI)
huffman@27468
   172
    let ?X = "{X. \<exists>f\<in>F. A \<inter> f \<subseteq> X}"
huffman@27468
   173
    assume AF: "- A \<notin> F"
huffman@27468
   174
    from AF have X: "filter ?X" by (rule extend_filter)
huffman@27468
   175
    from UNIV have AX: "A \<in> ?X" by (rule extend_lemma1)
huffman@27468
   176
    have FX: "F \<subseteq> ?X" by (rule extend_lemma2)
huffman@27468
   177
    from X FX have "F = ?X" by (rule max)
huffman@27468
   178
    with AX show "A \<in> F" by simp
huffman@27468
   179
  qed
huffman@27468
   180
qed
huffman@27468
   181
huffman@27468
   182
lemma (in ultrafilter) max_filter:
huffman@27468
   183
assumes G: "filter G" and sub: "F \<subseteq> G" shows "F = G"
huffman@27468
   184
proof
huffman@27468
   185
  show "F \<subseteq> G" using sub .
huffman@27468
   186
  show "G \<subseteq> F"
huffman@27468
   187
  proof
huffman@27468
   188
    fix A assume A: "A \<in> G"
huffman@27468
   189
    from G A have "- A \<notin> G" by (rule filter.memD)
huffman@27468
   190
    with sub have B: "- A \<notin> F" by blast
huffman@27468
   191
    thus "A \<in> F" by (rule memI)
huffman@27468
   192
  qed
huffman@27468
   193
qed
huffman@27468
   194
huffman@27468
   195
subsection {* Ultrafilter Theorem *}
huffman@27468
   196
huffman@27468
   197
text "A locale makes proof of ultrafilter Theorem more modular"
haftmann@27681
   198
locale UFT =
huffman@27468
   199
  fixes   frechet :: "'a set set"
huffman@27468
   200
  and     superfrechet :: "'a set set set"
huffman@27468
   201
huffman@27468
   202
  assumes infinite_UNIV: "infinite (UNIV :: 'a set)"
huffman@27468
   203
huffman@27468
   204
  defines frechet_def: "frechet \<equiv> {A. finite (- A)}"
huffman@27468
   205
  and     superfrechet_def: "superfrechet \<equiv> {G. filter G \<and> frechet \<subseteq> G}"
huffman@27468
   206
huffman@27468
   207
lemma (in UFT) superfrechetI:
huffman@27468
   208
  "\<lbrakk>filter G; frechet \<subseteq> G\<rbrakk> \<Longrightarrow> G \<in> superfrechet"
huffman@27468
   209
by (simp add: superfrechet_def)
huffman@27468
   210
huffman@27468
   211
lemma (in UFT) superfrechetD1:
huffman@27468
   212
  "G \<in> superfrechet \<Longrightarrow> filter G"
huffman@27468
   213
by (simp add: superfrechet_def)
huffman@27468
   214
huffman@27468
   215
lemma (in UFT) superfrechetD2:
huffman@27468
   216
  "G \<in> superfrechet \<Longrightarrow> frechet \<subseteq> G"
huffman@27468
   217
by (simp add: superfrechet_def)
huffman@27468
   218
huffman@27468
   219
text {* A few properties of free filters *}
huffman@27468
   220
huffman@27468
   221
lemma filter_cofinite:
huffman@27468
   222
assumes inf: "infinite (UNIV :: 'a set)"
huffman@27468
   223
shows "filter {A:: 'a set. finite (- A)}" (is "filter ?F")
huffman@27468
   224
proof (rule filter.intro)
huffman@27468
   225
  show "UNIV \<in> ?F" by simp
huffman@27468
   226
next
huffman@27468
   227
  show "{} \<notin> ?F" using inf by simp
huffman@27468
   228
next
huffman@27468
   229
  fix u v assume "u \<in> ?F" and "v \<in> ?F"
huffman@27468
   230
  thus "u \<inter> v \<in> ?F" by simp
huffman@27468
   231
next
huffman@27468
   232
  fix u v assume uv: "u \<subseteq> v" and u: "u \<in> ?F"
huffman@27468
   233
  from uv have vu: "- v \<subseteq> - u" by simp
huffman@27468
   234
  from u show "v \<in> ?F"
huffman@27468
   235
    by (simp add: finite_subset [OF vu])
huffman@27468
   236
qed
huffman@27468
   237
huffman@27468
   238
text {*
huffman@27468
   239
   We prove: 1. Existence of maximal filter i.e. ultrafilter;
huffman@27468
   240
             2. Freeness property i.e ultrafilter is free.
huffman@27468
   241
             Use a locale to prove various lemmas and then 
huffman@27468
   242
             export main result: The ultrafilter Theorem
huffman@27468
   243
*}
huffman@27468
   244
huffman@27468
   245
lemma (in UFT) filter_frechet: "filter frechet"
huffman@27468
   246
by (unfold frechet_def, rule filter_cofinite [OF infinite_UNIV])
huffman@27468
   247
huffman@27468
   248
lemma (in UFT) frechet_in_superfrechet: "frechet \<in> superfrechet"
huffman@27468
   249
by (rule superfrechetI [OF filter_frechet subset_refl])
huffman@27468
   250
huffman@27468
   251
lemma (in UFT) lemma_mem_chain_filter:
huffman@27468
   252
  "\<lbrakk>c \<in> chain superfrechet; x \<in> c\<rbrakk> \<Longrightarrow> filter x"
huffman@27468
   253
by (unfold chain_def superfrechet_def, blast)
huffman@27468
   254
huffman@27468
   255
huffman@27468
   256
subsubsection {* Unions of chains of superfrechets *}
huffman@27468
   257
huffman@27468
   258
text "In this section we prove that superfrechet is closed
huffman@27468
   259
with respect to unions of non-empty chains. We must show
huffman@27468
   260
  1) Union of a chain is a filter,
huffman@27468
   261
  2) Union of a chain contains frechet.
huffman@27468
   262
huffman@27468
   263
Number 2 is trivial, but 1 requires us to prove all the filter rules."
huffman@27468
   264
huffman@27468
   265
lemma (in UFT) Union_chain_UNIV:
huffman@27468
   266
"\<lbrakk>c \<in> chain superfrechet; c \<noteq> {}\<rbrakk> \<Longrightarrow> UNIV \<in> \<Union>c"
huffman@27468
   267
proof -
huffman@27468
   268
  assume 1: "c \<in> chain superfrechet" and 2: "c \<noteq> {}"
huffman@27468
   269
  from 2 obtain x where 3: "x \<in> c" by blast
huffman@27468
   270
  from 1 3 have "filter x" by (rule lemma_mem_chain_filter)
huffman@27468
   271
  hence "UNIV \<in> x" by (rule filter.UNIV)
huffman@27468
   272
  with 3 show "UNIV \<in> \<Union>c" by blast
huffman@27468
   273
qed
huffman@27468
   274
huffman@27468
   275
lemma (in UFT) Union_chain_empty:
huffman@27468
   276
"c \<in> chain superfrechet \<Longrightarrow> {} \<notin> \<Union>c"
huffman@27468
   277
proof
huffman@27468
   278
  assume 1: "c \<in> chain superfrechet" and 2: "{} \<in> \<Union>c"
huffman@27468
   279
  from 2 obtain x where 3: "x \<in> c" and 4: "{} \<in> x" ..
huffman@27468
   280
  from 1 3 have "filter x" by (rule lemma_mem_chain_filter)
huffman@27468
   281
  hence "{} \<notin> x" by (rule filter.empty)
huffman@27468
   282
  with 4 show "False" by simp
huffman@27468
   283
qed
huffman@27468
   284
huffman@27468
   285
lemma (in UFT) Union_chain_Int:
huffman@27468
   286
"\<lbrakk>c \<in> chain superfrechet; u \<in> \<Union>c; v \<in> \<Union>c\<rbrakk> \<Longrightarrow> u \<inter> v \<in> \<Union>c"
huffman@27468
   287
proof -
huffman@27468
   288
  assume c: "c \<in> chain superfrechet"
huffman@27468
   289
  assume "u \<in> \<Union>c"
huffman@27468
   290
    then obtain x where ux: "u \<in> x" and xc: "x \<in> c" ..
huffman@27468
   291
  assume "v \<in> \<Union>c"
huffman@27468
   292
    then obtain y where vy: "v \<in> y" and yc: "y \<in> c" ..
huffman@27468
   293
  from c xc yc have "x \<subseteq> y \<or> y \<subseteq> x" by (rule chainD)
huffman@27468
   294
  with xc yc have xyc: "x \<union> y \<in> c"
huffman@27468
   295
    by (auto simp add: Un_absorb1 Un_absorb2)
huffman@27468
   296
  with c have fxy: "filter (x \<union> y)" by (rule lemma_mem_chain_filter)
huffman@27468
   297
  from ux have uxy: "u \<in> x \<union> y" by simp
huffman@27468
   298
  from vy have vxy: "v \<in> x \<union> y" by simp
huffman@27468
   299
  from fxy uxy vxy have "u \<inter> v \<in> x \<union> y" by (rule filter.Int)
huffman@27468
   300
  with xyc show "u \<inter> v \<in> \<Union>c" ..
huffman@27468
   301
qed
huffman@27468
   302
huffman@27468
   303
lemma (in UFT) Union_chain_subset:
huffman@27468
   304
"\<lbrakk>c \<in> chain superfrechet; u \<in> \<Union>c; u \<subseteq> v\<rbrakk> \<Longrightarrow> v \<in> \<Union>c"
huffman@27468
   305
proof -
huffman@27468
   306
  assume c: "c \<in> chain superfrechet"
huffman@27468
   307
     and u: "u \<in> \<Union>c" and uv: "u \<subseteq> v"
huffman@27468
   308
  from u obtain x where ux: "u \<in> x" and xc: "x \<in> c" ..
huffman@27468
   309
  from c xc have fx: "filter x" by (rule lemma_mem_chain_filter)
huffman@27468
   310
  from fx ux uv have vx: "v \<in> x" by (rule filter.subset)
huffman@27468
   311
  with xc show "v \<in> \<Union>c" ..
huffman@27468
   312
qed
huffman@27468
   313
huffman@27468
   314
lemma (in UFT) Union_chain_filter:
huffman@27468
   315
assumes chain: "c \<in> chain superfrechet" and nonempty: "c \<noteq> {}"
huffman@27468
   316
shows "filter (\<Union>c)"
huffman@27468
   317
proof (rule filter.intro)
huffman@27468
   318
  show "UNIV \<in> \<Union>c" using chain nonempty by (rule Union_chain_UNIV)
huffman@27468
   319
next
huffman@27468
   320
  show "{} \<notin> \<Union>c" using chain by (rule Union_chain_empty)
huffman@27468
   321
next
huffman@27468
   322
  fix u v assume "u \<in> \<Union>c" and "v \<in> \<Union>c"
huffman@27468
   323
  with chain show "u \<inter> v \<in> \<Union>c" by (rule Union_chain_Int)
huffman@27468
   324
next
huffman@27468
   325
  fix u v assume "u \<in> \<Union>c" and "u \<subseteq> v"
huffman@27468
   326
  with chain show "v \<in> \<Union>c" by (rule Union_chain_subset)
huffman@27468
   327
qed
huffman@27468
   328
huffman@27468
   329
lemma (in UFT) lemma_mem_chain_frechet_subset:
huffman@27468
   330
  "\<lbrakk>c \<in> chain superfrechet; x \<in> c\<rbrakk> \<Longrightarrow> frechet \<subseteq> x"
huffman@27468
   331
by (unfold superfrechet_def chain_def, blast)
huffman@27468
   332
huffman@27468
   333
lemma (in UFT) Union_chain_superfrechet:
huffman@27468
   334
  "\<lbrakk>c \<noteq> {}; c \<in> chain superfrechet\<rbrakk> \<Longrightarrow> \<Union>c \<in> superfrechet"
huffman@27468
   335
proof (rule superfrechetI)
huffman@27468
   336
  assume 1: "c \<in> chain superfrechet" and 2: "c \<noteq> {}"
huffman@27468
   337
  thus "filter (\<Union>c)" by (rule Union_chain_filter)
huffman@27468
   338
  from 2 obtain x where 3: "x \<in> c" by blast
huffman@27468
   339
  from 1 3 have "frechet \<subseteq> x" by (rule lemma_mem_chain_frechet_subset)
huffman@27468
   340
  also from 3 have "x \<subseteq> \<Union>c" by blast
huffman@27468
   341
  finally show "frechet \<subseteq> \<Union>c" .
huffman@27468
   342
qed
huffman@27468
   343
huffman@27468
   344
subsubsection {* Existence of free ultrafilter *}
huffman@27468
   345
huffman@27468
   346
lemma (in UFT) max_cofinite_filter_Ex:
huffman@27468
   347
  "\<exists>U\<in>superfrechet. \<forall>G\<in>superfrechet. U \<subseteq> G \<longrightarrow> U = G"
huffman@27468
   348
proof (rule Zorn_Lemma2 [rule_format])
huffman@27468
   349
  fix c assume c: "c \<in> chain superfrechet"
huffman@27468
   350
  show "\<exists>U\<in>superfrechet. \<forall>G\<in>c. G \<subseteq> U" (is "?U")
huffman@27468
   351
  proof (cases)
huffman@27468
   352
    assume "c = {}"
huffman@27468
   353
    with frechet_in_superfrechet show "?U" by blast
huffman@27468
   354
  next
huffman@27468
   355
    assume A: "c \<noteq> {}"
huffman@27468
   356
    from A c have "\<Union>c \<in> superfrechet"
huffman@27468
   357
      by (rule Union_chain_superfrechet)
huffman@27468
   358
    thus "?U" by blast
huffman@27468
   359
  qed
huffman@27468
   360
qed
huffman@27468
   361
huffman@27468
   362
lemma (in UFT) mem_superfrechet_all_infinite:
huffman@27468
   363
  "\<lbrakk>U \<in> superfrechet; A \<in> U\<rbrakk> \<Longrightarrow> infinite A"
huffman@27468
   364
proof
huffman@27468
   365
  assume U: "U \<in> superfrechet" and A: "A \<in> U" and fin: "finite A"
huffman@27468
   366
  from U have fil: "filter U" and fre: "frechet \<subseteq> U"
huffman@27468
   367
    by (simp_all add: superfrechet_def)
huffman@27468
   368
  from fin have "- A \<in> frechet" by (simp add: frechet_def)
huffman@27468
   369
  with fre have cA: "- A \<in> U" by (rule subsetD)
huffman@27468
   370
  from fil A cA have "A \<inter> - A \<in> U" by (rule filter.Int)
huffman@27468
   371
  with fil show "False" by (simp add: filter.empty)
huffman@27468
   372
qed
huffman@27468
   373
huffman@27468
   374
text {* There exists a free ultrafilter on any infinite set *}
huffman@27468
   375
huffman@27468
   376
lemma (in UFT) freeultrafilter_ex:
huffman@27468
   377
  "\<exists>U::'a set set. freeultrafilter U"
huffman@27468
   378
proof -
huffman@27468
   379
  from max_cofinite_filter_Ex obtain U
huffman@27468
   380
    where U: "U \<in> superfrechet"
huffman@27468
   381
      and max [rule_format]: "\<forall>G\<in>superfrechet. U \<subseteq> G \<longrightarrow> U = G" ..
huffman@27468
   382
  from U have fil: "filter U" by (rule superfrechetD1)
huffman@27468
   383
  from U have fre: "frechet \<subseteq> U" by (rule superfrechetD2)
huffman@27468
   384
  have ultra: "ultrafilter_axioms U"
huffman@27468
   385
  proof (rule filter.max_filter_ultrafilter [OF fil])
huffman@27468
   386
    fix G assume G: "filter G" and UG: "U \<subseteq> G"
huffman@27468
   387
    from fre UG have "frechet \<subseteq> G" by simp
huffman@27468
   388
    with G have "G \<in> superfrechet" by (rule superfrechetI)
huffman@27468
   389
    from this UG show "U = G" by (rule max)
huffman@27468
   390
  qed
huffman@27468
   391
  have free: "freeultrafilter_axioms U"
huffman@27468
   392
  proof (rule freeultrafilter_axioms.intro)
huffman@27468
   393
    fix A assume "A \<in> U"
huffman@27468
   394
    with U show "infinite A" by (rule mem_superfrechet_all_infinite)
huffman@27468
   395
  qed
huffman@27468
   396
  show ?thesis
huffman@27468
   397
  proof
huffman@27468
   398
    from fil ultra free show "freeultrafilter U"
huffman@27468
   399
      by (rule freeultrafilter.intro [OF ultrafilter.intro])
huffman@27468
   400
      (* FIXME: unfold_locales should use chained facts *)
huffman@27468
   401
  qed
huffman@27468
   402
qed
huffman@27468
   403
haftmann@27681
   404
lemmas freeultrafilter_Ex = UFT.freeultrafilter_ex [OF UFT.intro]
huffman@27468
   405
wenzelm@36176
   406
hide_const (open) filter
huffman@27468
   407
huffman@27468
   408
end