# HG changeset patch # User hoelzl # Date 1428831256 -7200 # Node ID 6c86d58ab0ca6324573d2e0d48f2b0fe8d4bf8c6 # Parent 1fa1023b13b9cb1fcf810859213afffd2a506162 replace Filters in NSA by HOL-Filters diff -r 1fa1023b13b9 -r 6c86d58ab0ca src/HOL/NSA/Free_Ultrafilter.thy --- a/src/HOL/NSA/Free_Ultrafilter.thy Sun Apr 12 11:34:09 2015 +0200 +++ b/src/HOL/NSA/Free_Ultrafilter.thy Sun Apr 12 11:34:16 2015 +0200 @@ -12,115 +12,37 @@ subsection {* Definitions and basic properties *} -subsubsection {* Filters *} +subsubsection {* Ultrafilters *} -locale filter = - fixes F :: "'a set set" - assumes UNIV [iff]: "UNIV \ F" - assumes empty [iff]: "{} \ F" - assumes Int: "\u \ F; v \ F\ \ u \ v \ F" - assumes subset: "\u \ F; u \ v\ \ v \ F" +locale ultrafilter = + fixes F :: "'a filter" + assumes proper: "F \ bot" + assumes ultra: "eventually P F \ eventually (\x. \ P x) F" begin -lemma memD: "A \ F \ - A \ F" -proof - assume "A \ F" and "- A \ F" - hence "A \ (- A) \ F" by (rule Int) - thus "False" by simp -qed +lemma eventually_imp_frequently: "frequently P F \ eventually P F" + using ultra[of P] by (simp add: frequently_def) -lemma not_memI: "- A \ F \ A \ F" -by (drule memD, simp) +lemma frequently_eq_eventually: "frequently P F = eventually P F" + using eventually_imp_frequently eventually_frequently[OF proper] .. -lemma Int_iff: "(x \ y \ F) = (x \ F \ y \ F)" -by (auto elim: subset intro: Int) - -end - -subsubsection {* Ultrafilters *} +lemma eventually_disj_iff: "eventually (\x. P x \ Q x) F \ eventually P F \ eventually Q F" + unfolding frequently_eq_eventually[symmetric] frequently_disj_iff .. -locale ultrafilter = filter + - assumes ultra: "A \ F \ - A \ F" -begin +lemma eventually_all_iff: "eventually (\x. \y. P x y) F = (\Y. eventually (\x. P x (Y x)) F)" + using frequently_all[of P F] by (simp add: frequently_eq_eventually) -lemma memI: "- A \ F \ A \ F" -using ultra [of A] by simp - -lemma not_memD: "A \ F \ - A \ F" -by (rule memI, simp) +lemma eventually_imp_iff: "eventually (\x. P x \ Q x) F \ (eventually P F \ eventually Q F)" + using frequently_imp_iff[of P Q F] by (simp add: frequently_eq_eventually) -lemma not_mem_iff: "(A \ F) = (- A \ F)" -by (rule iffI [OF not_memD not_memI]) - -lemma Compl_iff: "(- A \ F) = (A \ F)" -by (rule iffI [OF not_memI not_memD]) +lemma eventually_iff_iff: "eventually (\x. P x \ Q x) F \ (eventually P F \ eventually Q F)" + unfolding iff_conv_conj_imp eventually_conj_iff eventually_imp_iff by simp -lemma Un_iff: "(x \ y \ F) = (x \ F \ y \ F)" - apply (rule iffI) - apply (erule contrapos_pp) - apply (simp add: Int_iff not_mem_iff) - apply (auto elim: subset) -done +lemma eventually_not_iff: "eventually (\x. \ P x) F \ \ eventually P F" + unfolding not_eventually frequently_eq_eventually .. end -subsubsection {* Free Ultrafilters *} - -locale freeultrafilter = ultrafilter + - assumes infinite: "A \ F \ infinite A" -begin - -lemma finite: "finite A \ A \ F" -by (erule contrapos_pn, erule infinite) - -lemma singleton: "{x} \ F" -by (rule finite, simp) - -lemma insert_iff [simp]: "(insert x A \ F) = (A \ F)" -apply (subst insert_is_Un) -apply (subst Un_iff) -apply (simp add: singleton) -done - -lemma filter: "filter F" .. - -lemma ultrafilter: "ultrafilter F" .. - -end - -subsection {* Collect properties *} - -lemma (in filter) Collect_ex: - "({n. \x. P n x} \ F) = (\X. {n. P n (X n)} \ F)" -proof - assume "{n. \x. P n x} \ F" - hence "{n. P n (SOME x. P n x)} \ F" - by (auto elim: someI subset) - thus "\X. {n. P n (X n)} \ F" by fast -next - show "\X. {n. P n (X n)} \ F \ {n. \x. P n x} \ F" - by (auto elim: subset) -qed - -lemma (in filter) Collect_conj: - "({n. P n \ Q n} \ F) = ({n. P n} \ F \ {n. Q n} \ F)" -by (subst Collect_conj_eq, rule Int_iff) - -lemma (in ultrafilter) Collect_not: - "({n. \ P n} \ F) = ({n. P n} \ F)" -by (subst Collect_neg_eq, rule Compl_iff) - -lemma (in ultrafilter) Collect_disj: - "({n. P n \ Q n} \ F) = ({n. P n} \ F \ {n. Q n} \ F)" -by (subst Collect_disj_eq, rule Un_iff) - -lemma (in ultrafilter) Collect_all: - "({n. \x. P n x} \ F) = (\X. {n. P n (X n)} \ F)" -apply (rule Not_eq_iff [THEN iffD1]) -apply (simp add: Collect_not [symmetric]) -apply (rule Collect_ex) -done - subsection {* Maximal filter = Ultrafilter *} text {* @@ -133,281 +55,146 @@ property of ultrafilter. *} -lemma extend_lemma1: "UNIV \ F \ A \ {X. \f\F. A \ f \ X}" -by blast - -lemma extend_lemma2: "F \ {X. \f\F. A \ f \ X}" -by blast +lemma extend_filter: + "frequently P F \ inf F (principal {x. P x}) \ bot" + unfolding trivial_limit_def eventually_inf_principal by (simp add: not_eventually) -lemma (in filter) extend_filter: -assumes A: "- A \ F" -shows "filter {X. \f\F. A \ f \ X}" (is "filter ?X") -proof (rule filter.intro) - show "UNIV \ ?X" by blast -next - show "{} \ ?X" - proof (clarify) - fix f assume f: "f \ F" and Af: "A \ f \ {}" - from Af have fA: "f \ - A" by blast - from f fA have "- A \ F" by (rule subset) - with A show "False" by simp +lemma max_filter_ultrafilter: + assumes proper: "F \ bot" + assumes max: "\G. G \ bot \ G \ F \ F = G" + shows "ultrafilter F" +proof + fix P show "eventually P F \ (\\<^sub>Fx in F. \ P x)" + proof (rule disjCI) + assume "\ (\\<^sub>Fx in F. \ P x)" + then have "inf F (principal {x. P x}) \ bot" + by (simp add: not_eventually extend_filter) + then have F: "F = inf F (principal {x. P x})" + by (rule max) simp + show "eventually P F" + by (subst F) (simp add: eventually_inf_principal) qed -next - fix u and v - assume u: "u \ ?X" and v: "v \ ?X" - from u obtain f where f: "f \ F" and Af: "A \ f \ u" by blast - from v obtain g where g: "g \ F" and Ag: "A \ g \ v" by blast - from f g have fg: "f \ g \ F" by (rule Int) - from Af Ag have Afg: "A \ (f \ g) \ u \ v" by blast - from fg Afg show "u \ v \ ?X" by blast -next - fix u and v - assume uv: "u \ v" and u: "u \ ?X" - from u obtain f where f: "f \ F" and Afu: "A \ f \ u" by blast - from Afu uv have Afv: "A \ f \ v" by blast - from f Afv have "\f\F. A \ f \ v" by blast - thus "v \ ?X" by simp -qed +qed fact -lemma (in filter) max_filter_ultrafilter: -assumes max: "\G. \filter G; F \ G\ \ F = G" -shows "ultrafilter_axioms F" -proof (rule ultrafilter_axioms.intro) - fix A show "A \ F \ - A \ F" - proof (rule disjCI) - let ?X = "{X. \f\F. A \ f \ X}" - assume AF: "- A \ F" - from AF have X: "filter ?X" by (rule extend_filter) - from UNIV have AX: "A \ ?X" by (rule extend_lemma1) - have FX: "F \ ?X" by (rule extend_lemma2) - from X FX have "F = ?X" by (rule max) - with AX show "A \ F" by simp - qed -qed +lemma le_filter_frequently: "F \ G \ (\P. frequently P F \ frequently P G)" + unfolding frequently_def le_filter_def + apply auto + apply (erule_tac x="\x. \ P x" in allE) + apply auto + done lemma (in ultrafilter) max_filter: -assumes G: "filter G" and sub: "F \ G" shows "F = G" -proof - show "F \ G" using sub . - show "G \ F" - proof - fix A assume A: "A \ G" - from G A have "- A \ G" by (rule filter.memD) - with sub have B: "- A \ F" by blast - thus "A \ F" by (rule memI) - qed -qed + assumes G: "G \ bot" and sub: "G \ F" shows "F = G" +proof (rule antisym) + show "F \ G" + using sub + by (auto simp: le_filter_frequently[of F] frequently_eq_eventually le_filter_def[of G] + intro!: eventually_frequently G proper) +qed fact subsection {* Ultrafilter Theorem *} text "A local context makes proof of ultrafilter Theorem more modular" -context - fixes frechet :: "'a set set" - and superfrechet :: "'a set set set" - - assumes infinite_UNIV: "infinite (UNIV :: 'a set)" - defines frechet_def: "frechet \ {A. finite (- A)}" - and superfrechet_def: "superfrechet \ {G. filter G \ frechet \ G}" -begin +lemma ex_max_ultrafilter: + fixes F :: "'a filter" + assumes F: "F \ bot" + shows "\U\F. ultrafilter U" +proof - + let ?X = "{G. G \ bot \ G \ F}" + let ?R = "{(b, a). a \ bot \ a \ b \ b \ F}" -lemma superfrechetI: - "\filter G; frechet \ G\ \ G \ superfrechet" -by (simp add: superfrechet_def) - -lemma superfrechetD1: - "G \ superfrechet \ filter G" -by (simp add: superfrechet_def) + have bot_notin_R: "\c. c \ Chains ?R \ bot \ c" + by (auto simp: Chains_def) -lemma superfrechetD2: - "G \ superfrechet \ frechet \ G" -by (simp add: superfrechet_def) - -text {* A few properties of free filters *} + have [simp]: "Field ?R = ?X" + by (auto simp: Field_def bot_unique) -lemma filter_cofinite: -assumes inf: "infinite (UNIV :: 'a set)" -shows "filter {A:: 'a set. finite (- A)}" (is "filter ?F") -proof (rule filter.intro) - show "UNIV \ ?F" by simp -next - show "{} \ ?F" using inf by simp -next - fix u v assume "u \ ?F" and "v \ ?F" - thus "u \ v \ ?F" by simp -next - fix u v assume uv: "u \ v" and u: "u \ ?F" - from uv have vu: "- v \ - u" by simp - from u show "v \ ?F" - by (simp add: finite_subset [OF vu]) -qed + have "\m\Field ?R. \a\Field ?R. (m, a) \ ?R \ a = m" + proof (rule Zorns_po_lemma) + show "Partial_order ?R" + unfolding partial_order_on_def preorder_on_def + by (auto simp: antisym_def refl_on_def trans_def Field_def bot_unique) + show "\C\Chains ?R. \u\Field ?R. \a\C. (a, u) \ ?R" + proof (safe intro!: bexI del: notI) + fix c x assume c: "c \ Chains ?R" -text {* - We prove: 1. Existence of maximal filter i.e. ultrafilter; - 2. Freeness property i.e ultrafilter is free. - Use a locale to prove various lemmas and then - export main result: The ultrafilter Theorem -*} - -lemma filter_frechet: "filter frechet" -by (unfold frechet_def, rule filter_cofinite [OF infinite_UNIV]) - -lemma frechet_in_superfrechet: "frechet \ superfrechet" -by (rule superfrechetI [OF filter_frechet subset_refl]) - -lemma lemma_mem_chain_filter: - "\c \ chains superfrechet; x \ c\ \ filter x" -by (unfold chains_def superfrechet_def, blast) - - -subsubsection {* Unions of chains of superfrechets *} + { assume "c \ {}" + with c have "Inf c = bot \ (\x\c. x = bot)" + unfolding trivial_limit_def by (intro eventually_Inf_base) (auto simp: Chains_def) + with c have 1: "Inf c \ bot" + by (simp add: bot_notin_R) + from `c \ {}` obtain x where "x \ c" by auto + with c have 2: "Inf c \ F" + by (auto intro!: Inf_lower2[of x] simp: Chains_def) + note 1 2 } + note Inf_c = this + then have [simp]: "inf F (Inf c) = (if c = {} then F else Inf c)" + using c by (auto simp add: inf_absorb2) -text "In this section we prove that superfrechet is closed -with respect to unions of non-empty chains. We must show - 1) Union of a chain is a filter, - 2) Union of a chain contains frechet. + show "inf F (Inf c) \ bot" + using c by (simp add: F Inf_c) -Number 2 is trivial, but 1 requires us to prove all the filter rules." + show "inf F (Inf c) \ Field ?R" + using c by (simp add: Chains_def Inf_c F) -lemma Union_chain_UNIV: - "\c \ chains superfrechet; c \ {}\ \ UNIV \ \c" -proof - - assume 1: "c \ chains superfrechet" and 2: "c \ {}" - from 2 obtain x where 3: "x \ c" by blast - from 1 3 have "filter x" by (rule lemma_mem_chain_filter) - hence "UNIV \ x" by (rule filter.UNIV) - with 3 show "UNIV \ \c" by blast -qed - -lemma Union_chain_empty: - "c \ chains superfrechet \ {} \ \c" -proof - assume 1: "c \ chains superfrechet" and 2: "{} \ \c" - from 2 obtain x where 3: "x \ c" and 4: "{} \ x" .. - from 1 3 have "filter x" by (rule lemma_mem_chain_filter) - hence "{} \ x" by (rule filter.empty) - with 4 show "False" by simp + assume x: "x \ c" + with c show "inf F (Inf c) \ x" "x \ F" + by (auto intro: Inf_lower simp: Chains_def) + qed + qed + then guess U .. + then show ?thesis + by (intro exI[of _ U] conjI max_filter_ultrafilter) auto qed -lemma Union_chain_Int: - "\c \ chains superfrechet; u \ \c; v \ \c\ \ u \ v \ \c" -proof - - assume c: "c \ chains superfrechet" - assume "u \ \c" - then obtain x where ux: "u \ x" and xc: "x \ c" .. - assume "v \ \c" - then obtain y where vy: "v \ y" and yc: "y \ c" .. - from c xc yc have "x \ y \ y \ x" using c unfolding chains_def chain_subset_def by auto - with xc yc have xyc: "x \ y \ c" - by (auto simp add: Un_absorb1 Un_absorb2) - with c have fxy: "filter (x \ y)" by (rule lemma_mem_chain_filter) - from ux have uxy: "u \ x \ y" by simp - from vy have vxy: "v \ x \ y" by simp - from fxy uxy vxy have "u \ v \ x \ y" by (rule filter.Int) - with xyc show "u \ v \ \c" .. -qed - -lemma Union_chain_subset: - "\c \ chains superfrechet; u \ \c; u \ v\ \ v \ \c" -proof - - assume c: "c \ chains superfrechet" - and u: "u \ \c" and uv: "u \ v" - from u obtain x where ux: "u \ x" and xc: "x \ c" .. - from c xc have fx: "filter x" by (rule lemma_mem_chain_filter) - from fx ux uv have vx: "v \ x" by (rule filter.subset) - with xc show "v \ \c" .. -qed - -lemma Union_chain_filter: -assumes chain: "c \ chains superfrechet" and nonempty: "c \ {}" -shows "filter (\c)" -proof (rule filter.intro) - show "UNIV \ \c" using chain nonempty by (rule Union_chain_UNIV) -next - show "{} \ \c" using chain by (rule Union_chain_empty) -next - fix u v assume "u \ \c" and "v \ \c" - with chain show "u \ v \ \c" by (rule Union_chain_Int) -next - fix u v assume "u \ \c" and "u \ v" - with chain show "v \ \c" by (rule Union_chain_subset) -qed - -lemma lemma_mem_chain_frechet_subset: - "\c \ chains superfrechet; x \ c\ \ frechet \ x" -by (unfold superfrechet_def chains_def, blast) - -lemma Union_chain_superfrechet: - "\c \ {}; c \ chains superfrechet\ \ \c \ superfrechet" -proof (rule superfrechetI) - assume 1: "c \ chains superfrechet" and 2: "c \ {}" - thus "filter (\c)" by (rule Union_chain_filter) - from 2 obtain x where 3: "x \ c" by blast - from 1 3 have "frechet \ x" by (rule lemma_mem_chain_frechet_subset) - also from 3 have "x \ \c" by blast - finally show "frechet \ \c" . -qed - -subsubsection {* Existence of free ultrafilter *} - -lemma max_cofinite_filter_Ex: - "\U\superfrechet. \G\superfrechet. U \ G \ G = U" -proof (rule Zorn_Lemma2, safe) - fix c assume c: "c \ chains superfrechet" - show "\U\superfrechet. \G\c. G \ U" (is "?U") - proof (cases) - assume "c = {}" - with frechet_in_superfrechet show "?U" by blast - next - assume A: "c \ {}" - from A c have "\c \ superfrechet" - by (rule Union_chain_superfrechet) - thus "?U" by blast - qed -qed - -lemma mem_superfrechet_all_infinite: - "\U \ superfrechet; A \ U\ \ infinite A" -proof - assume U: "U \ superfrechet" and A: "A \ U" and fin: "finite A" - from U have fil: "filter U" and fre: "frechet \ U" - by (simp_all add: superfrechet_def) - from fin have "- A \ frechet" by (simp add: frechet_def) - with fre have cA: "- A \ U" by (rule subsetD) - from fil A cA have "A \ - A \ U" by (rule filter.Int) - with fil show "False" by (simp add: filter.empty) -qed +subsubsection {* Free Ultrafilters *} text {* There exists a free ultrafilter on any infinite set *} +locale freeultrafilter = ultrafilter + + assumes infinite: "eventually P F \ infinite {x. P x}" +begin + +lemma finite: "finite {x. P x} \ \ eventually P F" + by (erule contrapos_pn, erule infinite) + +lemma finite': "finite {x. \ P x} \ eventually P F" + by (drule finite) (simp add: not_eventually frequently_eq_eventually) + +lemma le_cofinite: "F \ cofinite" + by (intro filter_leI) + (auto simp add: eventually_cofinite not_eventually frequently_eq_eventually dest!: finite) + +lemma singleton: "\ eventually (\x. x = a) F" +by (rule finite, simp) + +lemma singleton': "\ eventually (op = a) F" +by (rule finite, simp) + +lemma ultrafilter: "ultrafilter F" .. + +end + lemma freeultrafilter_Ex: - "\U::'a set set. freeultrafilter U" + assumes [simp]: "infinite (UNIV :: 'a set)" + shows "\U::'a filter. freeultrafilter U" proof - - from max_cofinite_filter_Ex obtain U - where U: "U \ superfrechet" - and max [rule_format]: "\G\superfrechet. U \ G \ G = U" .. - from U have fil: "filter U" by (rule superfrechetD1) - from U have fre: "frechet \ U" by (rule superfrechetD2) - have ultra: "ultrafilter_axioms U" - proof (rule filter.max_filter_ultrafilter [OF fil]) - fix G assume G: "filter G" and UG: "U \ G" - from fre UG have "frechet \ G" by simp - with G have "G \ superfrechet" by (rule superfrechetI) - from this UG show "U = G" by (rule max[symmetric]) + from ex_max_ultrafilter[of "cofinite :: 'a filter"] + obtain U :: "'a filter" where "U \ cofinite" "ultrafilter U" + by auto + interpret ultrafilter U by fact + have "freeultrafilter U" + proof + fix P assume "eventually P U" + with proper have "frequently P U" + by (rule eventually_frequently) + then have "frequently P cofinite" + using `U \ cofinite` by (simp add: le_filter_frequently) + then show "infinite {x. P x}" + by (simp add: frequently_cofinite) qed - have free: "freeultrafilter_axioms U" - proof (rule freeultrafilter_axioms.intro) - fix A assume "A \ U" - with U show "infinite A" by (rule mem_superfrechet_all_infinite) - qed - from fil ultra free have "freeultrafilter U" - by (rule freeultrafilter.intro [OF ultrafilter.intro]) - (* FIXME: unfold_locales should use chained facts *) then show ?thesis .. qed end - -hide_const (open) filter - -end diff -r 1fa1023b13b9 -r 6c86d58ab0ca src/HOL/NSA/HyperDef.thy --- a/src/HOL/NSA/HyperDef.thy Sun Apr 12 11:34:09 2015 +0200 +++ b/src/HOL/NSA/HyperDef.thy Sun Apr 12 11:34:16 2015 +0200 @@ -178,7 +178,7 @@ by (cases x, simp add: star_n_def) lemma Rep_star_star_n_iff [simp]: - "(X \ Rep_star (star_n Y)) = ({n. Y n = X n} \ \)" + "(X \ Rep_star (star_n Y)) = (eventually (\n. Y n = X n) \)" by (simp add: star_n_def) lemma Rep_star_star_n: "X \ Rep_star (star_n X)" @@ -207,12 +207,11 @@ by (simp only: star_inverse_def starfun_star_n) lemma star_n_le: - "star_n X \ star_n Y = - ({n. X n \ Y n} \ FreeUltrafilterNat)" + "star_n X \ star_n Y = (eventually (\n. X n \ Y n) FreeUltrafilterNat)" by (simp only: star_le_def starP2_star_n) lemma star_n_less: - "star_n X < star_n Y = ({n. X n < Y n} \ FreeUltrafilterNat)" + "star_n X < star_n Y = (eventually (\n. X n < Y n) FreeUltrafilterNat)" by (simp only: star_less_def starP2_star_n) lemma star_n_zero_num: "0 = star_n (%n. 0)" @@ -273,7 +272,7 @@ by (insert not_ex_hypreal_of_real_eq_epsilon, auto) lemma hypreal_epsilon_not_zero: "epsilon \ 0" -by (simp add: epsilon_def star_zero_def star_of_def star_n_eq_iff +by (simp add: epsilon_def star_zero_def star_of_def star_n_eq_iff FreeUltrafilterNat.proper del: star_of_zero) lemma hypreal_epsilon_inverse_omega: "epsilon = inverse(omega)" diff -r 1fa1023b13b9 -r 6c86d58ab0ca src/HOL/NSA/HyperNat.thy --- a/src/HOL/NSA/HyperNat.thy Sun Apr 12 11:34:09 2015 +0200 +++ b/src/HOL/NSA/HyperNat.thy Sun Apr 12 11:34:16 2015 +0200 @@ -274,10 +274,10 @@ hypnat_omega_def: "whn = star_n (%n::nat. n)" lemma hypnat_of_nat_neq_whn: "hypnat_of_nat n \ whn" -by (simp add: hypnat_omega_def star_of_def star_n_eq_iff) +by (simp add: FreeUltrafilterNat.singleton' hypnat_omega_def star_of_def star_n_eq_iff) lemma whn_neq_hypnat_of_nat: "whn \ hypnat_of_nat n" -by (simp add: hypnat_omega_def star_of_def star_n_eq_iff) +by (simp add: FreeUltrafilterNat.singleton hypnat_omega_def star_of_def star_n_eq_iff) lemma whn_not_Nats [simp]: "whn \ Nats" by (simp add: Nats_def image_def whn_neq_hypnat_of_nat) @@ -285,15 +285,9 @@ lemma HNatInfinite_whn [simp]: "whn \ HNatInfinite" by (simp add: HNatInfinite_def) -lemma lemma_unbounded_set [simp]: "{n::nat. m < n} \ FreeUltrafilterNat" -apply (insert finite_atMost [of m]) -apply (drule FreeUltrafilterNat.finite) -apply (drule FreeUltrafilterNat.not_memD) -apply (simp add: Collect_neg_eq [symmetric] linorder_not_le atMost_def) -done - -lemma Compl_Collect_le: "- {n::nat. N \ n} = {n. n < N}" -by (simp add: Collect_neg_eq [symmetric] linorder_not_le) +lemma lemma_unbounded_set [simp]: "eventually (\n::nat. m < n) \" + by (rule filter_leD[OF FreeUltrafilterNat.le_cofinite]) + (auto simp add: cofinite_eq_sequentially eventually_at_top_dense) lemma hypnat_of_nat_eq: "hypnat_of_nat m = star_n (%n::nat. m)" @@ -327,14 +321,14 @@ (*??delete? similar reasoning in hypnat_omega_gt_SHNat above*) lemma HNatInfinite_FreeUltrafilterNat_lemma: - assumes "\N::nat. {n. f n \ N} \ FreeUltrafilterNat" - shows "{n. N < f n} \ FreeUltrafilterNat" + assumes "\N::nat. eventually (\n. f n \ N) \" + shows "eventually (\n. N < f n) \" apply (induct N) using assms apply (drule_tac x = 0 in spec, simp) using assms apply (drule_tac x = "Suc N" in spec) -apply (elim ultra, auto) +apply (auto elim: eventually_elim2) done lemma HNatInfinite_iff: "HNatInfinite = {N. \n \ Nats. n < N}" @@ -347,18 +341,18 @@ Free Ultrafilter*} lemma HNatInfinite_FreeUltrafilterNat: - "star_n X \ HNatInfinite ==> \u. {n. u < X n}: FreeUltrafilterNat" + "star_n X \ HNatInfinite ==> \u. eventually (\n. u < X n) FreeUltrafilterNat" apply (auto simp add: HNatInfinite_iff SHNat_eq) apply (drule_tac x="star_of u" in spec, simp) apply (simp add: star_of_def star_less_def starP2_star_n) done lemma FreeUltrafilterNat_HNatInfinite: - "\u. {n. u < X n}: FreeUltrafilterNat ==> star_n X \ HNatInfinite" + "\u. eventually (\n. u < X n) FreeUltrafilterNat ==> star_n X \ HNatInfinite" by (auto simp add: star_less_def starP2_star_n HNatInfinite_iff SHNat_eq hypnat_of_nat_eq) lemma HNatInfinite_FreeUltrafilterNat_iff: - "(star_n X \ HNatInfinite) = (\u. {n. u < X n}: FreeUltrafilterNat)" + "(star_n X \ HNatInfinite) = (\u. eventually (\n. u < X n) FreeUltrafilterNat)" by (rule iffI [OF HNatInfinite_FreeUltrafilterNat FreeUltrafilterNat_HNatInfinite]) diff -r 1fa1023b13b9 -r 6c86d58ab0ca src/HOL/NSA/NSA.thy --- a/src/HOL/NSA/NSA.thy Sun Apr 12 11:34:09 2015 +0200 +++ b/src/HOL/NSA/NSA.thy Sun Apr 12 11:34:16 2015 +0200 @@ -1915,7 +1915,7 @@ lemma HFinite_FreeUltrafilterNat: "star_n X \ HFinite - ==> \u. {n. norm (X n) < u} \ FreeUltrafilterNat" + ==> \u. eventually (\n. norm (X n) < u) FreeUltrafilterNat" apply (auto simp add: HFinite_def SReal_def) apply (rule_tac x=r in exI) apply (simp add: hnorm_def star_of_def starfun_star_n) @@ -1923,7 +1923,7 @@ done lemma FreeUltrafilterNat_HFinite: - "\u. {n. norm (X n) < u} \ FreeUltrafilterNat + "\u. eventually (\n. norm (X n) < u) FreeUltrafilterNat ==> star_n X \ HFinite" apply (auto simp add: HFinite_def mem_Rep_star_iff) apply (rule_tac x="star_of u" in bexI) @@ -1933,7 +1933,7 @@ done lemma HFinite_FreeUltrafilterNat_iff: - "(star_n X \ HFinite) = (\u. {n. norm (X n) < u} \ FreeUltrafilterNat)" + "(star_n X \ HFinite) = (\u. eventually (\n. norm (X n) < u) FreeUltrafilterNat)" by (blast intro!: HFinite_FreeUltrafilterNat FreeUltrafilterNat_HFinite) subsubsection {* @{term HInfinite} *} @@ -1957,20 +1957,19 @@ ultrafilter for Infinite numbers! -------------------------------------*) lemma FreeUltrafilterNat_const_Finite: - "{n. norm (X n) = u} \ FreeUltrafilterNat ==> star_n X \ HFinite" + "eventually (\n. norm (X n) = u) FreeUltrafilterNat ==> star_n X \ HFinite" apply (rule FreeUltrafilterNat_HFinite) apply (rule_tac x = "u + 1" in exI) -apply (erule ultra, simp) +apply (auto elim: eventually_elim1) done lemma HInfinite_FreeUltrafilterNat: - "star_n X \ HInfinite ==> \u. {n. u < norm (X n)} \ FreeUltrafilterNat" + "star_n X \ HInfinite ==> \u. eventually (\n. u < norm (X n)) FreeUltrafilterNat" apply (drule HInfinite_HFinite_iff [THEN iffD1]) apply (simp add: HFinite_FreeUltrafilterNat_iff) apply (rule allI, drule_tac x="u + 1" in spec) -apply (drule FreeUltrafilterNat.not_memD) -apply (simp add: Collect_neg_eq [symmetric] linorder_not_less) -apply (erule ultra, simp) +apply (simp add: FreeUltrafilterNat.eventually_not_iff[symmetric]) +apply (auto elim: eventually_elim1) done lemma lemma_Int_HI: @@ -1981,17 +1980,20 @@ by (auto intro: order_less_asym) lemma FreeUltrafilterNat_HInfinite: - "\u. {n. u < norm (X n)} \ FreeUltrafilterNat ==> star_n X \ HInfinite" + "\u. eventually (\n. u < norm (X n)) FreeUltrafilterNat ==> star_n X \ HInfinite" apply (rule HInfinite_HFinite_iff [THEN iffD2]) apply (safe, drule HFinite_FreeUltrafilterNat, safe) apply (drule_tac x = u in spec) -apply (drule (1) FreeUltrafilterNat.Int) -apply (simp add: Collect_conj_eq [symmetric]) -apply (subgoal_tac "\n. \ (norm (X n) < u \ u < norm (X n))", auto) -done +proof - + fix u assume "\\<^sub>Fn in \. norm (X n) < u" "\\<^sub>Fn in \. u < norm (X n)" + then have "\\<^sub>F x in \. False" + by eventually_elim auto + then show False + by (simp add: eventually_False FreeUltrafilterNat.proper) +qed lemma HInfinite_FreeUltrafilterNat_iff: - "(star_n X \ HInfinite) = (\u. {n. u < norm (X n)} \ FreeUltrafilterNat)" + "(star_n X \ HInfinite) = (\u. eventually (\n. u < norm (X n)) FreeUltrafilterNat)" by (blast intro!: HInfinite_FreeUltrafilterNat FreeUltrafilterNat_HInfinite) subsubsection {* @{term Infinitesimal} *} @@ -2000,21 +2002,21 @@ by (unfold SReal_def, auto) lemma Infinitesimal_FreeUltrafilterNat: - "star_n X \ Infinitesimal ==> \u>0. {n. norm (X n) < u} \ \" + "star_n X \ Infinitesimal ==> \u>0. eventually (\n. norm (X n) < u) \" apply (simp add: Infinitesimal_def ball_SReal_eq) apply (simp add: hnorm_def starfun_star_n star_of_def) apply (simp add: star_less_def starP2_star_n) done lemma FreeUltrafilterNat_Infinitesimal: - "\u>0. {n. norm (X n) < u} \ \ ==> star_n X \ Infinitesimal" + "\u>0. eventually (\n. norm (X n) < u) \ ==> star_n X \ Infinitesimal" apply (simp add: Infinitesimal_def ball_SReal_eq) apply (simp add: hnorm_def starfun_star_n star_of_def) apply (simp add: star_less_def starP2_star_n) done lemma Infinitesimal_FreeUltrafilterNat_iff: - "(star_n X \ Infinitesimal) = (\u>0. {n. norm (X n) < u} \ \)" + "(star_n X \ Infinitesimal) = (\u>0. eventually (\n. norm (X n) < u) \)" by (blast intro!: Infinitesimal_FreeUltrafilterNat FreeUltrafilterNat_Infinitesimal) (*------------------------------------------------------------------------ @@ -2087,14 +2089,13 @@ done lemma rabs_real_of_nat_le_real_FreeUltrafilterNat: - "{n. abs(real n) \ u} \ FreeUltrafilterNat" + "\ eventually (\n. abs(real n) \ u) FreeUltrafilterNat" by (blast intro!: FreeUltrafilterNat.finite finite_rabs_real_of_nat_le_real) -lemma FreeUltrafilterNat_nat_gt_real: "{n. u < real n} \ FreeUltrafilterNat" -apply (rule ccontr, drule FreeUltrafilterNat.not_memD) -apply (subgoal_tac "- {n::nat. u < real n} = {n. real n \ u}") -prefer 2 apply force -apply (simp add: finite_real_of_nat_le_real [THEN FreeUltrafilterNat.finite]) +lemma FreeUltrafilterNat_nat_gt_real: "eventually (\n. u < real n) FreeUltrafilterNat" +apply (rule FreeUltrafilterNat.finite') +apply (subgoal_tac "{n::nat. \ u < real n} = {n. real n \ u}") +apply (auto simp add: finite_real_of_nat_le_real) done (*-------------------------------------------------------------- @@ -2108,10 +2109,8 @@ text{*@{term omega} is a member of @{term HInfinite}*} -lemma FreeUltrafilterNat_omega: "{n. u < real n} \ FreeUltrafilterNat" -apply (cut_tac u = u in rabs_real_of_nat_le_real_FreeUltrafilterNat) -apply (auto dest: FreeUltrafilterNat.not_memD simp add: Compl_real_le_eq) -done +lemma FreeUltrafilterNat_omega: "eventually (\n. u < real n) FreeUltrafilterNat" + by (fact FreeUltrafilterNat_nat_gt_real) theorem HInfinite_omega [simp]: "omega \ HInfinite" apply (simp add: omega_def) @@ -2165,7 +2164,7 @@ by (auto simp add: lemma_real_le_Un_eq2 lemma_finite_epsilon_set finite_inverse_real_of_posnat_gt_real) lemma inverse_real_of_posnat_ge_real_FreeUltrafilterNat: - "0 < u ==> {n. u \ inverse(real(Suc n))} \ FreeUltrafilterNat" + "0 < u ==> \ eventually (\n. u \ inverse(real(Suc n))) FreeUltrafilterNat" by (blast intro!: FreeUltrafilterNat.finite finite_inverse_real_of_posnat_ge_real) (*-------------------------------------------------------------- @@ -2179,9 +2178,9 @@ lemma FreeUltrafilterNat_inverse_real_of_posnat: - "0 < u ==> - {n. inverse(real(Suc n)) < u} \ FreeUltrafilterNat" -by (metis Compl_le_inverse_eq FreeUltrafilterNat.ultra inverse_real_of_posnat_ge_real_FreeUltrafilterNat) + "0 < u ==> eventually (\n. inverse(real(Suc n)) < u) FreeUltrafilterNat" +by (drule inverse_real_of_posnat_ge_real_FreeUltrafilterNat) + (simp add: FreeUltrafilterNat.eventually_not_iff not_le[symmetric]) text{* Example of an hypersequence (i.e. an extended standard sequence) whose term with an hypernatural suffix is an infinitesimal i.e. @@ -2208,8 +2207,8 @@ "\n. norm(X n - x) < inverse(real(Suc n)) ==> star_n X - star_of x \ Infinitesimal" unfolding star_n_diff star_of_def Infinitesimal_FreeUltrafilterNat_iff star_n_inverse -by (auto dest: FreeUltrafilterNat_inverse_real_of_posnat FreeUltrafilterNat.Int - intro: order_less_trans FreeUltrafilterNat.subset) +by (auto dest!: FreeUltrafilterNat_inverse_real_of_posnat + intro: order_less_trans elim!: eventually_elim1) lemma real_seq_to_hypreal_approx: "\n. norm(X n - x) < inverse(real(Suc n)) @@ -2225,7 +2224,7 @@ "\n. norm(X n - Y n) < inverse(real(Suc n)) ==> star_n X - star_n Y \ Infinitesimal" unfolding Infinitesimal_FreeUltrafilterNat_iff star_n_diff -by (auto dest: FreeUltrafilterNat_inverse_real_of_posnat - intro: order_less_trans FreeUltrafilterNat.subset) +by (auto dest!: FreeUltrafilterNat_inverse_real_of_posnat + intro: order_less_trans elim!: eventually_elim1) end diff -r 1fa1023b13b9 -r 6c86d58ab0ca src/HOL/NSA/Star.thy --- a/src/HOL/NSA/Star.thy Sun Apr 12 11:34:09 2015 +0200 +++ b/src/HOL/NSA/Star.thy Sun Apr 12 11:34:16 2015 +0200 @@ -22,8 +22,8 @@ definition (* nonstandard extension of function *) is_starext :: "['a star => 'a star, 'a => 'a] => bool" where - "is_starext F f = (\x y. \X \ Rep_star(x). \Y \ Rep_star(y). - ((y = (F x)) = ({n. Y n = f(X n)} : FreeUltrafilterNat)))" + "is_starext F f = + (\x y. \X \ Rep_star(x). \Y \ Rep_star(y). ((y = (F x)) = (eventually (\n. Y n = f(X n)) \)))" definition (* internal functions *) @@ -71,7 +71,7 @@ lemma STAR_real_seq_to_hypreal: "\n. (X n) \ M ==> star_n X \ *s* M" apply (unfold starset_def star_of_def) -apply (simp add: Iset_star_n) +apply (simp add: Iset_star_n FreeUltrafilterNat.proper) done lemma STAR_singleton: "*s* {x} = {star_of x}" @@ -304,9 +304,7 @@ In this theory since @{text hypreal_hrabs} proved here. Maybe move both theorems??*} lemma Infinitesimal_FreeUltrafilterNat_iff2: - "(star_n X \ Infinitesimal) = - (\m. {n. norm(X n) < inverse(real(Suc m))} - \ FreeUltrafilterNat)" + "(star_n X \ Infinitesimal) = (\m. eventually (\n. norm(X n) < inverse(real(Suc m))) \)" by (simp add: Infinitesimal_hypreal_of_nat_iff star_of_def hnorm_def star_of_nat_def starfun_star_n star_n_inverse star_n_less real_of_nat_def) @@ -318,11 +316,11 @@ HNatInfinite_FreeUltrafilterNat_iff Infinitesimal_FreeUltrafilterNat_iff2) apply (drule_tac x="Suc m" in spec) -apply (erule ultra, simp) +apply (auto elim!: eventually_elim1) done lemma approx_FreeUltrafilterNat_iff: "star_n X @= star_n Y = - (\r>0. {n. norm (X n - Y n) < r} : FreeUltrafilterNat)" + (\r>0. eventually (\n. norm (X n - Y n) < r) \)" apply (subst approx_minus_iff) apply (rule mem_infmal_iff [THEN subst]) apply (simp add: star_n_diff) @@ -330,8 +328,7 @@ done lemma approx_FreeUltrafilterNat_iff2: "star_n X @= star_n Y = - (\m. {n. norm (X n - Y n) < - inverse(real(Suc m))} : FreeUltrafilterNat)" + (\m. eventually (\n. norm (X n - Y n) < inverse(real(Suc m))) \)" apply (subst approx_minus_iff) apply (rule mem_infmal_iff [THEN subst]) apply (simp add: star_n_diff) @@ -342,7 +339,7 @@ apply (rule inj_onI) apply (rule ext, rule ccontr) apply (drule_tac x = "star_n (%n. xa)" in fun_cong) -apply (auto simp add: starfun star_n_eq_iff) +apply (auto simp add: starfun star_n_eq_iff FreeUltrafilterNat.proper) done end diff -r 1fa1023b13b9 -r 6c86d58ab0ca src/HOL/NSA/StarDef.thy --- a/src/HOL/NSA/StarDef.thy Sun Apr 12 11:34:09 2015 +0200 +++ b/src/HOL/NSA/StarDef.thy Sun Apr 12 11:34:16 2015 +0200 @@ -11,7 +11,7 @@ subsection {* A Free Ultrafilter over the Naturals *} definition - FreeUltrafilterNat :: "nat set set" ("\") where + FreeUltrafilterNat :: "nat filter" ("\") where "\ = (SOME U. freeultrafilter U)" lemma freeultrafilter_FreeUltrafilterNat: "freeultrafilter \" @@ -24,19 +24,11 @@ interpretation FreeUltrafilterNat: freeultrafilter FreeUltrafilterNat by (rule freeultrafilter_FreeUltrafilterNat) -text {* This rule takes the place of the old ultra tactic *} - -lemma ultra: - "\{n. P n} \ \; {n. P n \ Q n} \ \\ \ {n. Q n} \ \" -by (simp add: Collect_imp_eq - FreeUltrafilterNat.Un_iff FreeUltrafilterNat.Compl_iff) - - subsection {* Definition of @{text star} type constructor *} definition starrel :: "((nat \ 'a) \ (nat \ 'a)) set" where - "starrel = {(X,Y). {n. X n = Y n} \ \}" + "starrel = {(X,Y). eventually (\n. X n = Y n) \}" definition "star = (UNIV :: (nat \ 'a) set) // starrel" @@ -59,14 +51,14 @@ text {* Proving that @{term starrel} is an equivalence relation *} -lemma starrel_iff [iff]: "((X,Y) \ starrel) = ({n. X n = Y n} \ \)" +lemma starrel_iff [iff]: "((X,Y) \ starrel) = (eventually (\n. X n = Y n) \)" by (simp add: starrel_def) lemma equiv_starrel: "equiv UNIV starrel" proof (rule equivI) show "refl starrel" by (simp add: refl_on_def) show "sym starrel" by (simp add: sym_def eq_commute) - show "trans starrel" by (auto intro: transI elim!: ultra) + show "trans starrel" by (intro transI) (auto elim: eventually_elim2) qed lemmas equiv_starrel_iff = @@ -75,7 +67,7 @@ lemma starrel_in_star: "starrel``{x} \ star" by (simp add: star_def quotientI) -lemma star_n_eq_iff: "(star_n X = star_n Y) = ({n. X n = Y n} \ \)" +lemma star_n_eq_iff: "(star_n X = star_n Y) = (eventually (\n. X n = Y n) \)" by (simp add: star_n_def Abs_star_inject starrel_in_star equiv_starrel_iff) @@ -83,8 +75,8 @@ text {* This introduction rule starts each transfer proof. *} lemma transfer_start: - "P \ {n. Q} \ \ \ Trueprop P \ Trueprop Q" -by (subgoal_tac "P \ Q", simp, simp add: atomize_eq) + "P \ eventually (\n. Q) \ \ Trueprop P \ Trueprop Q" + by (simp add: FreeUltrafilterNat.proper) text {*Initialize transfer tactic.*} ML_file "transfer.ML" @@ -98,66 +90,66 @@ text {* Transfer introduction rules. *} lemma transfer_ex [transfer_intro]: - "\\X. p (star_n X) \ {n. P n (X n)} \ \\ - \ \x::'a star. p x \ {n. \x. P n x} \ \" -by (simp only: ex_star_eq FreeUltrafilterNat.Collect_ex) + "\\X. p (star_n X) \ eventually (\n. P n (X n)) \\ + \ \x::'a star. p x \ eventually (\n. \x. P n x) \" +by (simp only: ex_star_eq eventually_ex) lemma transfer_all [transfer_intro]: - "\\X. p (star_n X) \ {n. P n (X n)} \ \\ - \ \x::'a star. p x \ {n. \x. P n x} \ \" -by (simp only: all_star_eq FreeUltrafilterNat.Collect_all) + "\\X. p (star_n X) \ eventually (\n. P n (X n)) \\ + \ \x::'a star. p x \ eventually (\n. \x. P n x) \" +by (simp only: all_star_eq FreeUltrafilterNat.eventually_all_iff) lemma transfer_not [transfer_intro]: - "\p \ {n. P n} \ \\ \ \ p \ {n. \ P n} \ \" -by (simp only: FreeUltrafilterNat.Collect_not) + "\p \ eventually P \\ \ \ p \ eventually (\n. \ P n) \" +by (simp only: FreeUltrafilterNat.eventually_not_iff) lemma transfer_conj [transfer_intro]: - "\p \ {n. P n} \ \; q \ {n. Q n} \ \\ - \ p \ q \ {n. P n \ Q n} \ \" -by (simp only: FreeUltrafilterNat.Collect_conj) + "\p \ eventually P \; q \ eventually Q \\ + \ p \ q \ eventually (\n. P n \ Q n) \" +by (simp only: eventually_conj_iff) lemma transfer_disj [transfer_intro]: - "\p \ {n. P n} \ \; q \ {n. Q n} \ \\ - \ p \ q \ {n. P n \ Q n} \ \" -by (simp only: FreeUltrafilterNat.Collect_disj) + "\p \ eventually P \; q \ eventually Q \\ + \ p \ q \ eventually (\n. P n \ Q n) \" +by (simp only: FreeUltrafilterNat.eventually_disj_iff) lemma transfer_imp [transfer_intro]: - "\p \ {n. P n} \ \; q \ {n. Q n} \ \\ - \ p \ q \ {n. P n \ Q n} \ \" -by (simp only: imp_conv_disj transfer_disj transfer_not) + "\p \ eventually P \; q \ eventually Q \\ + \ p \ q \ eventually (\n. P n \ Q n) \" +by (simp only: FreeUltrafilterNat.eventually_imp_iff) lemma transfer_iff [transfer_intro]: - "\p \ {n. P n} \ \; q \ {n. Q n} \ \\ - \ p = q \ {n. P n = Q n} \ \" -by (simp only: iff_conv_conj_imp transfer_conj transfer_imp) + "\p \ eventually P \; q \ eventually Q \\ + \ p = q \ eventually (\n. P n = Q n) \" +by (simp only: FreeUltrafilterNat.eventually_iff_iff) lemma transfer_if_bool [transfer_intro]: - "\p \ {n. P n} \ \; x \ {n. X n} \ \; y \ {n. Y n} \ \\ - \ (if p then x else y) \ {n. if P n then X n else Y n} \ \" + "\p \ eventually P \; x \ eventually X \; y \ eventually Y \\ + \ (if p then x else y) \ eventually (\n. if P n then X n else Y n) \" by (simp only: if_bool_eq_conj transfer_conj transfer_imp transfer_not) lemma transfer_eq [transfer_intro]: - "\x \ star_n X; y \ star_n Y\ \ x = y \ {n. X n = Y n} \ \" + "\x \ star_n X; y \ star_n Y\ \ x = y \ eventually (\n. X n = Y n) \" by (simp only: star_n_eq_iff) lemma transfer_if [transfer_intro]: - "\p \ {n. P n} \ \; x \ star_n X; y \ star_n Y\ + "\p \ eventually (\n. P n) \; x \ star_n X; y \ star_n Y\ \ (if p then x else y) \ star_n (\n. if P n then X n else Y n)" apply (rule eq_reflection) -apply (auto simp add: star_n_eq_iff transfer_not elim!: ultra) +apply (auto simp add: star_n_eq_iff transfer_not elim!: eventually_elim1) done lemma transfer_fun_eq [transfer_intro]: "\\X. f (star_n X) = g (star_n X) - \ {n. F n (X n) = G n (X n)} \ \\ - \ f = g \ {n. F n = G n} \ \" + \ eventually (\n. F n (X n) = G n (X n)) \\ + \ f = g \ eventually (\n. F n = G n) \" by (simp only: fun_eq_iff transfer_all) lemma transfer_star_n [transfer_intro]: "star_n X \ star_n (\n. X n)" by (rule reflexive) -lemma transfer_bool [transfer_intro]: "p \ {n. p} \ \" -by (simp add: atomize_eq) +lemma transfer_bool [transfer_intro]: "p \ eventually (\n. p) \" +by (simp add: FreeUltrafilterNat.proper) subsection {* Standard elements *} @@ -191,7 +183,7 @@ lemma Ifun_congruent2: "congruent2 starrel starrel (\F X. starrel``{\n. F n (X n)})" -by (auto simp add: congruent2_def equiv_starrel_iff elim!: ultra) +by (auto simp add: congruent2_def equiv_starrel_iff elim!: eventually_rev_mp) lemma Ifun_star_n: "star_n F \ star_n X = star_n (\n. F n (X n))" by (simp add: Ifun_def star_n_def Abs_star_inverse starrel_in_star @@ -298,7 +290,7 @@ definition unstar :: "bool star \ bool" where "unstar b \ b = star_of True" -lemma unstar_star_n: "unstar (star_n P) = ({n. P n} \ \)" +lemma unstar_star_n: "unstar (star_n P) = (eventually P \)" by (simp add: unstar_def star_of_def star_n_eq_iff) lemma unstar_star_of [simp]: "unstar (star_of p) = p" @@ -308,7 +300,7 @@ setup {* Transfer_Principle.add_const @{const_name unstar} *} lemma transfer_unstar [transfer_intro]: - "p \ star_n P \ unstar p \ {n. P n} \ \" + "p \ star_n P \ unstar p \ eventually P \" by (simp only: unstar_star_n) definition @@ -322,11 +314,11 @@ declare starP_def [transfer_unfold] declare starP2_def [transfer_unfold] -lemma starP_star_n: "( *p* P) (star_n X) = ({n. P (X n)} \ \)" +lemma starP_star_n: "( *p* P) (star_n X) = (eventually (\n. P (X n)) \)" by (simp only: starP_def star_of_def Ifun_star_n unstar_star_n) lemma starP2_star_n: - "( *p2* P) (star_n X) (star_n Y) = ({n. P (X n) (Y n)} \ \)" + "( *p2* P) (star_n X) (star_n Y) = (eventually (\n. P (X n) (Y n)) \)" by (simp only: starP2_def star_of_def Ifun_star_n unstar_star_n) lemma starP_star_of [simp]: "( *p* P) (star_of x) = P x" @@ -343,7 +335,7 @@ "Iset A = {x. ( *p2* op \) x A}" lemma Iset_star_n: - "(star_n X \ Iset (star_n A)) = ({n. X n \ A n} \ \)" + "(star_n X \ Iset (star_n A)) = (eventually (\n. X n \ A n) \)" by (simp add: Iset_def starP2_star_n) text {* Transfer tactic should remove occurrences of @{term Iset} *} @@ -351,27 +343,27 @@ lemma transfer_mem [transfer_intro]: "\x \ star_n X; a \ Iset (star_n A)\ - \ x \ a \ {n. X n \ A n} \ \" + \ x \ a \ eventually (\n. X n \ A n) \" by (simp only: Iset_star_n) lemma transfer_Collect [transfer_intro]: - "\\X. p (star_n X) \ {n. P n (X n)} \ \\ + "\\X. p (star_n X) \ eventually (\n. P n (X n)) \\ \ Collect p \ Iset (star_n (\n. Collect (P n)))" by (simp add: atomize_eq set_eq_iff all_star_eq Iset_star_n) lemma transfer_set_eq [transfer_intro]: "\a \ Iset (star_n A); b \ Iset (star_n B)\ - \ a = b \ {n. A n = B n} \ \" + \ a = b \ eventually (\n. A n = B n) \" by (simp only: set_eq_iff transfer_all transfer_iff transfer_mem) lemma transfer_ball [transfer_intro]: - "\a \ Iset (star_n A); \X. p (star_n X) \ {n. P n (X n)} \ \\ - \ \x\a. p x \ {n. \x\A n. P n x} \ \" + "\a \ Iset (star_n A); \X. p (star_n X) \ eventually (\n. P n (X n)) \\ + \ \x\a. p x \ eventually (\n. \x\A n. P n x) \" by (simp only: Ball_def transfer_all transfer_imp transfer_mem) lemma transfer_bex [transfer_intro]: - "\a \ Iset (star_n A); \X. p (star_n X) \ {n. P n (X n)} \ \\ - \ \x\a. p x \ {n. \x\A n. P n x} \ \" + "\a \ Iset (star_n A); \X. p (star_n X) \ eventually (\n. P n (X n)) \\ + \ \x\a. p x \ eventually (\n. \x\A n. P n x) \" by (simp only: Bex_def transfer_ex transfer_conj transfer_mem) lemma transfer_Iset [transfer_intro]: