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