src/HOL/Nonstandard_Analysis/Free_Ultrafilter.thy
author wenzelm
Wed, 17 May 2017 13:47:19 +0200
changeset 65851 c103358a5559
parent 64435 c93b0e6131c3
child 66453 cc19f7ca2ed6
permissions -rw-r--r--
tuned signature;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
62479
716336f19aa9 clarified session;
wenzelm
parents: 61975
diff changeset
     1
(*  Title:      HOL/Nonstandard_Analysis/Free_Ultrafilter.thy
41589
bbd861837ebc tuned headers;
wenzelm
parents: 36176
diff changeset
     2
    Author:     Jacques D. Fleuriot, University of Cambridge
bbd861837ebc tuned headers;
wenzelm
parents: 36176
diff changeset
     3
    Author:     Lawrence C Paulson
bbd861837ebc tuned headers;
wenzelm
parents: 36176
diff changeset
     4
    Author:     Brian Huffman
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 62479
diff changeset
     5
*)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
     6
61975
b4b11391c676 isabelle update_cartouches -c -t;
wenzelm
parents: 60041
diff changeset
     7
section \<open>Filters and Ultrafilters\<close>
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
     8
60036
218fcc645d22 move filters to their own theory
hoelzl
parents: 58878
diff changeset
     9
theory Free_Ultrafilter
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 62479
diff changeset
    10
  imports "~~/src/HOL/Library/Infinite_Set"
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    11
begin
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    12
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 62479
diff changeset
    13
61975
b4b11391c676 isabelle update_cartouches -c -t;
wenzelm
parents: 60041
diff changeset
    14
subsection \<open>Definitions and basic properties\<close>
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    15
61975
b4b11391c676 isabelle update_cartouches -c -t;
wenzelm
parents: 60041
diff changeset
    16
subsubsection \<open>Ultrafilters\<close>
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    17
60041
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
    18
locale ultrafilter =
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
    19
  fixes F :: "'a filter"
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
    20
  assumes proper: "F \<noteq> bot"
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
    21
  assumes ultra: "eventually P F \<or> eventually (\<lambda>x. \<not> P x) F"
47486
4d49f3ffe97e replace locale 'UFT' with new un-named context block feature;
huffman
parents: 46008
diff changeset
    22
begin
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    23
60041
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
    24
lemma eventually_imp_frequently: "frequently P F \<Longrightarrow> eventually P F"
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
    25
  using ultra[of P] by (simp add: frequently_def)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    26
60041
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
    27
lemma frequently_eq_eventually: "frequently P F = eventually P F"
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
    28
  using eventually_imp_frequently eventually_frequently[OF proper] ..
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    29
60041
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
    30
lemma eventually_disj_iff: "eventually (\<lambda>x. P x \<or> Q x) F \<longleftrightarrow> eventually P F \<or> eventually Q F"
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
    31
  unfolding frequently_eq_eventually[symmetric] frequently_disj_iff ..
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    32
60041
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
    33
lemma eventually_all_iff: "eventually (\<lambda>x. \<forall>y. P x y) F = (\<forall>Y. eventually (\<lambda>x. P x (Y x)) F)"
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
    34
  using frequently_all[of P F] by (simp add: frequently_eq_eventually)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    35
60041
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
    36
lemma eventually_imp_iff: "eventually (\<lambda>x. P x \<longrightarrow> Q x) F \<longleftrightarrow> (eventually P F \<longrightarrow> eventually Q F)"
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
    37
  using frequently_imp_iff[of P Q F] by (simp add: frequently_eq_eventually)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    38
60041
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
    39
lemma eventually_iff_iff: "eventually (\<lambda>x. P x \<longleftrightarrow> Q x) F \<longleftrightarrow> (eventually P F \<longleftrightarrow> eventually Q F)"
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
    40
  unfolding iff_conv_conj_imp eventually_conj_iff eventually_imp_iff by simp
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    41
60041
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
    42
lemma eventually_not_iff: "eventually (\<lambda>x. \<not> P x) F \<longleftrightarrow> \<not> eventually P F"
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
    43
  unfolding not_eventually frequently_eq_eventually ..
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    44
47486
4d49f3ffe97e replace locale 'UFT' with new un-named context block feature;
huffman
parents: 46008
diff changeset
    45
end
4d49f3ffe97e replace locale 'UFT' with new un-named context block feature;
huffman
parents: 46008
diff changeset
    46
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 62479
diff changeset
    47
61975
b4b11391c676 isabelle update_cartouches -c -t;
wenzelm
parents: 60041
diff changeset
    48
subsection \<open>Maximal filter = Ultrafilter\<close>
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    49
61975
b4b11391c676 isabelle update_cartouches -c -t;
wenzelm
parents: 60041
diff changeset
    50
text \<open>
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 62479
diff changeset
    51
   A filter \<open>F\<close> is an ultrafilter iff it is a maximal filter,
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 62479
diff changeset
    52
   i.e. whenever \<open>G\<close> is a filter and @{prop "F \<subseteq> G"} then @{prop "F = G"}
61975
b4b11391c676 isabelle update_cartouches -c -t;
wenzelm
parents: 60041
diff changeset
    53
\<close>
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 62479
diff changeset
    54
61975
b4b11391c676 isabelle update_cartouches -c -t;
wenzelm
parents: 60041
diff changeset
    55
text \<open>
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 62479
diff changeset
    56
  Lemma that shows existence of an extension to what was assumed to
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    57
  be a maximal filter. Will be used to derive contradiction in proof of
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    58
  property of ultrafilter.
61975
b4b11391c676 isabelle update_cartouches -c -t;
wenzelm
parents: 60041
diff changeset
    59
\<close>
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    60
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 62479
diff changeset
    61
lemma extend_filter: "frequently P F \<Longrightarrow> inf F (principal {x. P x}) \<noteq> bot"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 62479
diff changeset
    62
  by (simp add: trivial_limit_def eventually_inf_principal not_eventually)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    63
60041
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
    64
lemma max_filter_ultrafilter:
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 62479
diff changeset
    65
  assumes "F \<noteq> bot"
60041
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
    66
  assumes max: "\<And>G. G \<noteq> bot \<Longrightarrow> G \<le> F \<Longrightarrow> F = G"
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
    67
  shows "ultrafilter F"
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
    68
proof
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 62479
diff changeset
    69
  show "eventually P F \<or> (\<forall>\<^sub>Fx in F. \<not> P x)" for P
60041
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
    70
  proof (rule disjCI)
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
    71
    assume "\<not> (\<forall>\<^sub>Fx in F. \<not> P x)"
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
    72
    then have "inf F (principal {x. P x}) \<noteq> bot"
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
    73
      by (simp add: not_eventually extend_filter)
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
    74
    then have F: "F = inf F (principal {x. P x})"
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
    75
      by (rule max) simp
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
    76
    show "eventually P F"
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
    77
      by (subst F) (simp add: eventually_inf_principal)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    78
  qed
60041
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
    79
qed fact
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    80
60041
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
    81
lemma le_filter_frequently: "F \<le> G \<longleftrightarrow> (\<forall>P. frequently P F \<longrightarrow> frequently P G)"
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
    82
  unfolding frequently_def le_filter_def
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
    83
  apply auto
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
    84
  apply (erule_tac x="\<lambda>x. \<not> P x" in allE)
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
    85
  apply auto
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
    86
  done
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    87
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    88
lemma (in ultrafilter) max_filter:
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 62479
diff changeset
    89
  assumes G: "G \<noteq> bot"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 62479
diff changeset
    90
    and sub: "G \<le> F"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 62479
diff changeset
    91
  shows "F = G"
60041
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
    92
proof (rule antisym)
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
    93
  show "F \<le> G"
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
    94
    using sub
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
    95
    by (auto simp: le_filter_frequently[of F] frequently_eq_eventually le_filter_def[of G]
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
    96
             intro!: eventually_frequently G proper)
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
    97
qed fact
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
    98
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 62479
diff changeset
    99
61975
b4b11391c676 isabelle update_cartouches -c -t;
wenzelm
parents: 60041
diff changeset
   100
subsection \<open>Ultrafilter Theorem\<close>
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   101
60041
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
   102
lemma ex_max_ultrafilter:
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
   103
  fixes F :: "'a filter"
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
   104
  assumes F: "F \<noteq> bot"
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
   105
  shows "\<exists>U\<le>F. ultrafilter U"
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
   106
proof -
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
   107
  let ?X = "{G. G \<noteq> bot \<and> G \<le> F}"
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
   108
  let ?R = "{(b, a). a \<noteq> bot \<and> a \<le> b \<and> b \<le> F}"
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   109
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 62479
diff changeset
   110
  have bot_notin_R: "c \<in> Chains ?R \<Longrightarrow> bot \<notin> c" for c
60041
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
   111
    by (auto simp: Chains_def)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   112
60041
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
   113
  have [simp]: "Field ?R = ?X"
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
   114
    by (auto simp: Field_def bot_unique)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   115
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 62479
diff changeset
   116
  have "\<exists>m\<in>Field ?R. \<forall>a\<in>Field ?R. (m, a) \<in> ?R \<longrightarrow> a = m" (is "\<exists>m\<in>?A. ?B m")
60041
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
   117
  proof (rule Zorns_po_lemma)
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
   118
    show "Partial_order ?R"
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 62479
diff changeset
   119
      by (auto simp: partial_order_on_def preorder_on_def
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 62479
diff changeset
   120
          antisym_def refl_on_def trans_def Field_def bot_unique)
60041
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
   121
    show "\<forall>C\<in>Chains ?R. \<exists>u\<in>Field ?R. \<forall>a\<in>C. (a, u) \<in> ?R"
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
   122
    proof (safe intro!: bexI del: notI)
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 62479
diff changeset
   123
      fix c x
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 62479
diff changeset
   124
      assume c: "c \<in> Chains ?R"
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   125
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 62479
diff changeset
   126
      have Inf_c: "Inf c \<noteq> bot" "Inf c \<le> F" if "c \<noteq> {}"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 62479
diff changeset
   127
      proof -
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 62479
diff changeset
   128
        from c that have "Inf c = bot \<longleftrightarrow> (\<exists>x\<in>c. x = bot)"
60041
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
   129
          unfolding trivial_limit_def by (intro eventually_Inf_base) (auto simp: Chains_def)
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 62479
diff changeset
   130
        with c show "Inf c \<noteq> bot"
60041
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
   131
          by (simp add: bot_notin_R)
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 62479
diff changeset
   132
        from that obtain x where "x \<in> c" by auto
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 62479
diff changeset
   133
        with c show "Inf c \<le> F"
60041
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
   134
          by (auto intro!: Inf_lower2[of x] simp: Chains_def)
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 62479
diff changeset
   135
      qed
60041
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
   136
      then have [simp]: "inf F (Inf c) = (if c = {} then F else Inf c)"
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
   137
        using c by (auto simp add: inf_absorb2)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   138
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 62479
diff changeset
   139
      from c show "inf F (Inf c) \<noteq> bot"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 62479
diff changeset
   140
        by (simp add: F Inf_c)
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 62479
diff changeset
   141
      from c show "inf F (Inf c) \<in> Field ?R"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 62479
diff changeset
   142
        by (simp add: Chains_def Inf_c F)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   143
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 62479
diff changeset
   144
      assume "x \<in> c"
60041
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
   145
      with c show "inf F (Inf c) \<le> x" "x \<le> F"
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
   146
        by (auto intro: Inf_lower simp: Chains_def)
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
   147
    qed
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
   148
  qed
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 62479
diff changeset
   149
  then obtain U where U: "U \<in> ?A" "?B U" ..
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 62479
diff changeset
   150
  show ?thesis
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 62479
diff changeset
   151
  proof
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 62479
diff changeset
   152
    from U show "U \<le> F \<and> ultrafilter U"
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 62479
diff changeset
   153
      by (auto intro!: max_filter_ultrafilter)
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 62479
diff changeset
   154
  qed
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   155
qed
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   156
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 62479
diff changeset
   157
61975
b4b11391c676 isabelle update_cartouches -c -t;
wenzelm
parents: 60041
diff changeset
   158
subsubsection \<open>Free Ultrafilters\<close>
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   159
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 62479
diff changeset
   160
text \<open>There exists a free ultrafilter on any infinite set.\<close>
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   161
60041
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
   162
locale freeultrafilter = ultrafilter +
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
   163
  assumes infinite: "eventually P F \<Longrightarrow> infinite {x. P x}"
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
   164
begin
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
   165
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
   166
lemma finite: "finite {x. P x} \<Longrightarrow> \<not> eventually P F"
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 62479
diff changeset
   167
  by (erule contrapos_pn) (erule infinite)
60041
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
   168
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
   169
lemma finite': "finite {x. \<not> P x} \<Longrightarrow> eventually P F"
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
   170
  by (drule finite) (simp add: not_eventually frequently_eq_eventually)
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
   171
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
   172
lemma le_cofinite: "F \<le> cofinite"
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
   173
  by (intro filter_leI)
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 62479
diff changeset
   174
    (auto simp add: eventually_cofinite not_eventually frequently_eq_eventually dest!: finite)
60041
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
   175
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
   176
lemma singleton: "\<not> eventually (\<lambda>x. x = a) F"
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 62479
diff changeset
   177
  by (rule finite) simp
60041
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
   178
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
   179
lemma singleton': "\<not> eventually (op = a) F"
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 62479
diff changeset
   180
  by (rule finite) simp
60041
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
   181
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
   182
lemma ultrafilter: "ultrafilter F" ..
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
   183
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
   184
end
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
   185
47486
4d49f3ffe97e replace locale 'UFT' with new un-named context block feature;
huffman
parents: 46008
diff changeset
   186
lemma freeultrafilter_Ex:
60041
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
   187
  assumes [simp]: "infinite (UNIV :: 'a set)"
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
   188
  shows "\<exists>U::'a filter. freeultrafilter U"
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   189
proof -
60041
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
   190
  from ex_max_ultrafilter[of "cofinite :: 'a filter"]
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
   191
  obtain U :: "'a filter" where "U \<le> cofinite" "ultrafilter U"
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
   192
    by auto
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
   193
  interpret ultrafilter U by fact
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
   194
  have "freeultrafilter U"
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
   195
  proof
64435
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 62479
diff changeset
   196
    fix P
c93b0e6131c3 misc tuning and modernization;
wenzelm
parents: 62479
diff changeset
   197
    assume "eventually P U"
60041
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
   198
    with proper have "frequently P U"
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
   199
      by (rule eventually_frequently)
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
   200
    then have "frequently P cofinite"
61975
b4b11391c676 isabelle update_cartouches -c -t;
wenzelm
parents: 60041
diff changeset
   201
      using \<open>U \<le> cofinite\<close> by (simp add: le_filter_frequently)
60041
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
   202
    then show "infinite {x. P x}"
6c86d58ab0ca replace Filters in NSA by HOL-Filters
hoelzl
parents: 60036
diff changeset
   203
      by (simp add: frequently_cofinite)
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   204
  qed
46008
c296c75f4cf4 reverted some changes for set->predicate transition, according to "hg log -u berghofe -r Isabelle2007:Isabelle2008";
wenzelm
parents: 41959
diff changeset
   205
  then show ?thesis ..
27468
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   206
qed
0783dd1dc13d move nonstandard analysis theories to NSA directory
huffman
parents:
diff changeset
   207
47486
4d49f3ffe97e replace locale 'UFT' with new un-named context block feature;
huffman
parents: 46008
diff changeset
   208
end