src/HOL/Hyperreal/HyperDef.thy
changeset 21856 f44628fb2033
parent 21855 74909ecaf20a
child 21865 55cc354fd2d9
equal deleted inserted replaced
21855:74909ecaf20a 21856:f44628fb2033
     7 
     7 
     8 header{*Construction of Hyperreals Using Ultrafilters*}
     8 header{*Construction of Hyperreals Using Ultrafilters*}
     9 
     9 
    10 theory HyperDef
    10 theory HyperDef
    11 imports StarClasses "../Real/Real"
    11 imports StarClasses "../Real/Real"
    12 uses ("fuf.ML")  (*Warning: file fuf.ML refers to the name Hyperdef!*)
       
    13 begin
    12 begin
    14 
    13 
    15 types hypreal = "real star"
    14 types hypreal = "real star"
    16 
    15 
    17 abbreviation
    16 abbreviation
    96 
    95 
    97 lemma Reals_eq_Standard: "(Reals :: hypreal set) = Standard"
    96 lemma Reals_eq_Standard: "(Reals :: hypreal set) = Standard"
    98 by (simp add: Reals_def Standard_def)
    97 by (simp add: Reals_def Standard_def)
    99 
    98 
   100 
    99 
   101 subsection{*Existence of Free Ultrafilter over the Naturals*}
       
   102 
       
   103 text{*Also, proof of various properties of @{term FreeUltrafilterNat}: 
       
   104 an arbitrary free ultrafilter*}
       
   105 (*
       
   106 lemma FreeUltrafilterNat_Ex: "\<exists>U::nat set set. freeultrafilter U"
       
   107 by (rule nat_infinite [THEN freeultrafilter_Ex])
       
   108 
       
   109 lemma FreeUltrafilterNat_mem: "freeultrafilter FreeUltrafilterNat"
       
   110 apply (unfold FreeUltrafilterNat_def)
       
   111 apply (rule someI_ex)
       
   112 apply (rule FreeUltrafilterNat_Ex)
       
   113 done
       
   114 
       
   115 lemma UltrafilterNat_mem: "ultrafilter FreeUltrafilterNat"
       
   116 by (rule FreeUltrafilterNat_mem [THEN freeultrafilter.ultrafilter])
       
   117 
       
   118 lemma FilterNat_mem: "filter FreeUltrafilterNat"
       
   119 by (rule FreeUltrafilterNat_mem [THEN freeultrafilter.filter])
       
   120 
       
   121 lemma FreeUltrafilterNat_finite: "finite x ==> x \<notin> FreeUltrafilterNat"
       
   122 by (rule FreeUltrafilterNat.finite)
       
   123 
       
   124 lemma FreeUltrafilterNat_not_finite: "x \<in> FreeUltrafilterNat ==> ~ finite x"
       
   125 by (rule FreeUltrafilterNat.infinite)
       
   126 
       
   127 lemma FreeUltrafilterNat_empty: "{} \<notin> FreeUltrafilterNat"
       
   128 by (rule FreeUltrafilterNat.empty)
       
   129 
       
   130 lemma FreeUltrafilterNat_Int:
       
   131      "[| X \<in> FreeUltrafilterNat;  Y \<in> FreeUltrafilterNat |]   
       
   132       ==> X Int Y \<in> FreeUltrafilterNat"
       
   133 by (rule FreeUltrafilterNat.Int)
       
   134 
       
   135 lemma FreeUltrafilterNat_subset:
       
   136      "[| X \<in> FreeUltrafilterNat;  X \<subseteq> Y |]  
       
   137       ==> Y \<in> FreeUltrafilterNat"
       
   138 by (rule FreeUltrafilterNat.subset)
       
   139 
       
   140 lemma FreeUltrafilterNat_Compl:
       
   141      "X \<in> FreeUltrafilterNat ==> -X \<notin> FreeUltrafilterNat"
       
   142 by (rule FreeUltrafilterNat.memD)
       
   143 
       
   144 lemma FreeUltrafilterNat_Compl_mem:
       
   145      "X \<notin> FreeUltrafilterNat ==> -X \<in> FreeUltrafilterNat"
       
   146 by (rule FreeUltrafilterNat.not_memD)
       
   147 
       
   148 lemma FreeUltrafilterNat_Compl_iff1:
       
   149      "(X \<notin> FreeUltrafilterNat) = (-X \<in> FreeUltrafilterNat)"
       
   150 by (rule FreeUltrafilterNat.not_mem_iff)
       
   151 
       
   152 lemma FreeUltrafilterNat_Compl_iff2:
       
   153      "(X \<in> FreeUltrafilterNat) = (-X \<notin> FreeUltrafilterNat)"
       
   154 by (auto simp add: FreeUltrafilterNat_Compl_iff1 [symmetric])
       
   155 
       
   156 lemma cofinite_mem_FreeUltrafilterNat: "finite (-X) ==> X \<in> FreeUltrafilterNat"
       
   157 apply (drule FreeUltrafilterNat.finite)
       
   158 apply (simp add: FreeUltrafilterNat.not_mem_iff)
       
   159 done
       
   160 
       
   161 lemma FreeUltrafilterNat_UNIV: "UNIV \<in> FreeUltrafilterNat"
       
   162 by (rule FreeUltrafilterNat.UNIV)
       
   163 
       
   164 lemma FreeUltrafilterNat_Nat_set_refl [intro]:
       
   165      "{n. P(n) = P(n)} \<in> FreeUltrafilterNat"
       
   166 by simp
       
   167 
       
   168 lemma FreeUltrafilterNat_P: "{n::nat. P} \<in> FreeUltrafilterNat ==> P"
       
   169 by (rule ccontr, simp)
       
   170 
       
   171 lemma FreeUltrafilterNat_Ex_P: "{n. P(n)} \<in> FreeUltrafilterNat ==> \<exists>n. P(n)"
       
   172 by (rule ccontr, simp)
       
   173 
       
   174 lemma FreeUltrafilterNat_all: "\<forall>n. P(n) ==> {n. P(n)} \<in> FreeUltrafilterNat"
       
   175 by (auto)
       
   176 
       
   177 
       
   178 text{*Define and use Ultrafilter tactics*}
       
   179 use "fuf.ML"
       
   180 
       
   181 method_setup fuf = {*
       
   182     Method.ctxt_args (fn ctxt =>
       
   183         Method.SIMPLE_METHOD' (fuf_tac (local_clasimpset_of ctxt))) *}
       
   184     "free ultrafilter tactic"
       
   185 
       
   186 method_setup ultra = {*
       
   187     Method.ctxt_args (fn ctxt =>
       
   188         Method.SIMPLE_METHOD' (ultra_tac (local_clasimpset_of ctxt))) *}
       
   189     "ultrafilter tactic"
       
   190 
       
   191 
       
   192 text{*One further property of our free ultrafilter*}
       
   193 
       
   194 lemma FreeUltrafilterNat_Un:
       
   195      "X Un Y \<in> FreeUltrafilterNat  
       
   196       ==> X \<in> FreeUltrafilterNat | Y \<in> FreeUltrafilterNat"
       
   197 by (auto, ultra)
       
   198 *)
       
   199 
       
   200 subsection{*Properties of @{term starrel}*}
   100 subsection{*Properties of @{term starrel}*}
   201 
   101 
   202 lemma lemma_starrel_refl [simp]: "x \<in> starrel `` {x}"
   102 lemma lemma_starrel_refl [simp]: "x \<in> starrel `` {x}"
   203 by (simp add: starrel_def)
   103 by (simp add: starrel_def)
   204 
   104