# HG changeset patch # User Manuel Eberl # Date 1535642454 -7200 # Node ID f443ec10447da75b617294f84223cc6d3023ccfd # Parent 9207ada0ca3164bb0a8257d7a7b4719598a837db Some basic materials on filters and topology diff -r 9207ada0ca31 -r f443ec10447d src/HOL/Complete_Lattices.thy --- a/src/HOL/Complete_Lattices.thy Thu Aug 30 19:59:36 2018 +0200 +++ b/src/HOL/Complete_Lattices.thy Thu Aug 30 17:20:54 2018 +0200 @@ -236,6 +236,9 @@ lemma INF_mono: "(\m. m \ B \ \n\A. f n \ g m) \ (\n\A. f n) \ (\n\B. g n)" using Inf_mono [of "g ` B" "f ` A"] by auto +lemma INF_mono': "(\x. f x \ g x) \ (INF x:A. f x) \ (INF x:A. g x)" + by (rule INF_mono) auto + lemma Sup_mono: assumes "\a. a \ A \ \b\B. a \ b" shows "\A \ \B" @@ -249,6 +252,9 @@ lemma SUP_mono: "(\n. n \ A \ \m\B. f n \ g m) \ (\n\A. f n) \ (\n\B. g n)" using Sup_mono [of "f ` A" "g ` B"] by auto +lemma SUP_mono': "(\x. f x \ g x) \ (SUP x:A. f x) \ (SUP x:A. g x)" + by (rule SUP_mono) auto + lemma INF_superset_mono: "B \ A \ (\x. x \ B \ f x \ g x) \ (\x\A. f x) \ (\x\B. g x)" \ \The last inclusion is POSITIVE!\ by (blast intro: INF_mono dest: subsetD) diff -r 9207ada0ca31 -r f443ec10447d src/HOL/Filter.thy --- a/src/HOL/Filter.thy Thu Aug 30 19:59:36 2018 +0200 +++ b/src/HOL/Filter.thy Thu Aug 30 17:20:54 2018 +0200 @@ -522,6 +522,33 @@ lemma eventually_INF1: "i \ I \ eventually P (F i) \ eventually P (\i\I. F i)" using filter_leD[OF INF_lower] . +lemma eventually_INF_finite: + assumes "finite A" + shows "eventually P (INF x:A. F x) \ + (\Q. (\x\A. eventually (Q x) (F x)) \ (\y. (\x\A. Q x y) \ P y))" + using assms +proof (induction arbitrary: P rule: finite_induct) + case (insert a A P) + from insert.hyps have [simp]: "x \ a" if "x \ A" for x + using that by auto + have "eventually P (INF x:insert a A. F x) \ + (\Q R S. eventually Q (F a) \ (( (\x\A. eventually (S x) (F x)) \ + (\y. (\x\A. S x y) \ R y)) \ (\x. Q x \ R x \ P x)))" + unfolding ex_simps by (simp add: eventually_inf insert.IH) + also have "\ \ (\Q. (\x\insert a A. eventually (Q x) (F x)) \ + (\y. (\x\insert a A. Q x y) \ P y))" + proof (safe, goal_cases) + case (1 Q R S) + thus ?case using 1 by (intro exI[of _ "S(a := Q)"]) auto + next + case (2 Q) + show ?case + by (rule exI[of _ "Q a"], rule exI[of _ "\y. \x\A. Q x y"], + rule exI[of _ "Q(a := (\_. True))"]) (use 2 in auto) + qed + finally show ?case . +qed auto + subsubsection \Map function for filters\ definition filtermap :: "('a \ 'b) \ 'a filter \ 'b filter" @@ -653,6 +680,33 @@ "filtercomap f (\b\B. F b) \ (\b\B. filtercomap f (F b))" by (intro SUP_least filtercomap_mono SUP_upper) +lemma filtermap_le_iff_le_filtercomap: "filtermap f F \ G \ F \ filtercomap f G" + unfolding le_filter_def eventually_filtermap eventually_filtercomap + using eventually_mono by auto + +lemma filtercomap_neq_bot: + assumes "\P. eventually P F \ \x. P (f x)" + shows "filtercomap f F \ bot" + using assms by (auto simp: trivial_limit_def eventually_filtercomap) + +lemma filtercomap_neq_bot_surj: + assumes "F \ bot" and "surj f" + shows "filtercomap f F \ bot" +proof (rule filtercomap_neq_bot) + fix P assume *: "eventually P F" + show "\x. P (f x)" + proof (rule ccontr) + assume **: "\(\x. P (f x))" + from * have "eventually (\_. False) F" + proof eventually_elim + case (elim x) + from \surj f\ obtain y where "x = f y" by auto + with elim and ** show False by auto + qed + with assms show False by (simp add: trivial_limit_def) + qed +qed + lemma eventually_filtercomapI [intro]: assumes "eventually P F" shows "eventually (\x. P (f x)) (filtercomap f F)" @@ -858,6 +912,74 @@ lemma filtermap_sequentually_ne_bot: "filtermap f sequentially \ bot" by (simp add: filtermap_bot_iff) +subsection \Increasing finite subsets\ + +definition finite_subsets_at_top where + "finite_subsets_at_top A = (INF X:{X. finite X \ X \ A}. principal {Y. finite Y \ X \ Y \ Y \ A})" + +lemma eventually_finite_subsets_at_top: + "eventually P (finite_subsets_at_top A) \ + (\X. finite X \ X \ A \ (\Y. finite Y \ X \ Y \ Y \ A \ P Y))" + unfolding finite_subsets_at_top_def +proof (subst eventually_INF_base, goal_cases) + show "{X. finite X \ X \ A} \ {}" by auto +next + case (2 B C) + thus ?case by (intro bexI[of _ "B \ C"]) auto +qed (simp_all add: eventually_principal) + +lemma eventually_finite_subsets_at_top_weakI [intro]: + assumes "\X. finite X \ X \ A \ P X" + shows "eventually P (finite_subsets_at_top A)" +proof - + have "eventually (\X. finite X \ X \ A) (finite_subsets_at_top A)" + by (auto simp: eventually_finite_subsets_at_top) + thus ?thesis by eventually_elim (use assms in auto) +qed + +lemma finite_subsets_at_top_neq_bot [simp]: "finite_subsets_at_top A \ bot" +proof - + have "\eventually (\x. False) (finite_subsets_at_top A)" + by (auto simp: eventually_finite_subsets_at_top) + thus ?thesis by auto +qed + +lemma filtermap_image_finite_subsets_at_top: + assumes "inj_on f A" + shows "filtermap ((`) f) (finite_subsets_at_top A) = finite_subsets_at_top (f ` A)" + unfolding filter_eq_iff eventually_filtermap +proof (safe, goal_cases) + case (1 P) + then obtain X where X: "finite X" "X \ A" "\Y. finite Y \ X \ Y \ Y \ A \ P (f ` Y)" + unfolding eventually_finite_subsets_at_top by force + show ?case unfolding eventually_finite_subsets_at_top eventually_filtermap + proof (rule exI[of _ "f ` X"], intro conjI allI impI, goal_cases) + case (3 Y) + with assms and X(1,2) have "P (f ` (f -` Y \ A))" using X(1,2) + by (intro X(3) finite_vimage_IntI) auto + also have "f ` (f -` Y \ A) = Y" using assms 3 by blast + finally show ?case . + qed (insert assms X(1,2), auto intro!: finite_vimage_IntI) +next + case (2 P) + then obtain X where X: "finite X" "X \ f ` A" "\Y. finite Y \ X \ Y \ Y \ f ` A \ P Y" + unfolding eventually_finite_subsets_at_top by force + show ?case unfolding eventually_finite_subsets_at_top eventually_filtermap + proof (rule exI[of _ "f -` X \ A"], intro conjI allI impI, goal_cases) + case (3 Y) + with X(1,2) and assms show ?case by (intro X(3)) force+ + qed (insert assms X(1), auto intro!: finite_vimage_IntI) +qed + +lemma eventually_finite_subsets_at_top_finite: + assumes "finite A" + shows "eventually P (finite_subsets_at_top A) \ P A" + unfolding eventually_finite_subsets_at_top using assms by force + +lemma finite_subsets_at_top_finite: "finite A \ finite_subsets_at_top A = principal {A}" + by (auto simp: filter_eq_iff eventually_finite_subsets_at_top_finite eventually_principal) + + subsection \The cofinite filter\ definition "cofinite = Abs_filter (\P. finite {x. \ P x})" @@ -1208,6 +1330,9 @@ "(LIM x F. f x :> principal S) \ (eventually (\x. f x \ S) F)" unfolding filterlim_def eventually_filtermap le_principal .. +lemma filterlim_filtercomap [intro]: "filterlim f F (filtercomap f F)" + unfolding filterlim_def by (rule filtermap_filtercomap) + lemma filterlim_inf: "(LIM x F1. f x :> inf F2 F3) \ ((LIM x F1. f x :> F2) \ (LIM x F1. f x :> F3))" unfolding filterlim_def by simp @@ -1220,6 +1345,15 @@ "(\m. m \ J \ \i\I. filtermap f (F i) \ G m) \ LIM x (\i\I. F i). f x :> (\j\J. G j)" unfolding filterlim_def by (rule order_trans[OF filtermap_INF INF_mono]) +lemma filterlim_INF': "x \ A \ filterlim f F (G x) \ filterlim f F (INF x:A. G x)" + unfolding filterlim_def by (rule order.trans[OF filtermap_mono[OF INF_lower]]) + +lemma filterlim_filtercomap_iff: "filterlim f (filtercomap g G) F \ filterlim (g \ f) G F" + by (simp add: filterlim_def filtermap_le_iff_le_filtercomap filtercomap_filtercomap o_def) + +lemma filterlim_iff_le_filtercomap: "filterlim f F G \ G \ filtercomap f F" + by (simp add: filterlim_def filtermap_le_iff_le_filtercomap) + lemma filterlim_base: "(\m x. m \ J \ i m \ I) \ (\m x. m \ J \ x \ F (i m) \ f x \ G m) \ LIM x (\i\I. principal (F i)). f x :> (\j\J. principal (G j))" @@ -1347,9 +1481,51 @@ shows "(LIM x F. f x :> at_bot) \ (\Zx. Z \ f x) F)" by (metis filterlim_at_bot filterlim_at_bot_le lt_ex order_le_less_trans) -lemma filterlim_filtercomap [intro]: "filterlim f F (filtercomap f F)" - unfolding filterlim_def by (rule filtermap_filtercomap) +lemma filterlim_finite_subsets_at_top: + "filterlim f (finite_subsets_at_top A) F \ + (\X. finite X \ X \ A \ eventually (\y. finite (f y) \ X \ f y \ f y \ A) F)" + (is "?lhs = ?rhs") +proof + assume ?lhs + thus ?rhs + proof (safe, goal_cases) + case (1 X) + hence *: "(\\<^sub>F x in F. P (f x))" if "eventually P (finite_subsets_at_top A)" for P + using that by (auto simp: filterlim_def le_filter_def eventually_filtermap) + have "\\<^sub>F Y in finite_subsets_at_top A. finite Y \ X \ Y \ Y \ A" + using 1 unfolding eventually_finite_subsets_at_top by force + thus ?case by (intro *) auto + qed +next + assume rhs: ?rhs + show ?lhs unfolding filterlim_def le_filter_def eventually_finite_subsets_at_top + proof (safe, goal_cases) + case (1 P X) + with rhs have "\\<^sub>F y in F. finite (f y) \ X \ f y \ f y \ A" by auto + thus "eventually P (filtermap f F)" unfolding eventually_filtermap + by eventually_elim (insert 1, auto) + qed +qed +lemma filterlim_atMost_at_top: + "filterlim (\n. {..n}) (finite_subsets_at_top (UNIV :: nat set)) at_top" + unfolding filterlim_finite_subsets_at_top +proof (safe, goal_cases) + case (1 X) + then obtain n where n: "X \ {..n}" by (auto simp: finite_nat_set_iff_bounded_le) + show ?case using eventually_ge_at_top[of n] + by eventually_elim (insert n, auto) +qed + +lemma filterlim_lessThan_at_top: + "filterlim (\n. {.. {..Setup @{typ "'a filter"} for lifting and transfer\ diff -r 9207ada0ca31 -r f443ec10447d src/HOL/Library/Countable_Set.thy --- a/src/HOL/Library/Countable_Set.thy Thu Aug 30 19:59:36 2018 +0200 +++ b/src/HOL/Library/Countable_Set.thy Thu Aug 30 17:20:54 2018 +0200 @@ -69,6 +69,11 @@ then show thesis .. qed +lemma countable_infiniteE': + assumes "countable A" "infinite A" + obtains g where "bij_betw g (UNIV :: nat set) A" + using bij_betw_inv[OF countableE_infinite[OF assms]] that by blast + lemma countable_enum_cases: assumes "countable S" obtains (finite) f :: "'a \ nat" where "finite S" "bij_betw f S {.. B. f (fst p) (snd p))" by (rule antisym) (auto intro!: INF_greatest INF_lower2) +lemma INF_Sigma: + fixes f :: "_ \ _ \ _ :: complete_lattice" + shows "(INF i : A. INF j : B i. f i j) = (INF p : Sigma A B. f (fst p) (snd p))" + by (rule antisym) (auto intro!: INF_greatest INF_lower2) + subsubsection \\Liminf\ and \Limsup\\ definition Liminf :: "'a filter \ ('a \ 'b) \ 'b :: complete_lattice" where @@ -202,7 +207,7 @@ lemma le_Limsup: assumes F: "F \ bot" and x: "\\<^sub>F x in F. l \ f x" shows "l \ Limsup F f" - using F Liminf_bounded Liminf_le_Limsup order.trans x by blast + using F Liminf_bounded[of l f F] Liminf_le_Limsup[of F f] order.trans x by blast lemma Liminf_le: assumes F: "F \ bot" and x: "\\<^sub>F x in F. f x \ l" diff -r 9207ada0ca31 -r f443ec10447d src/HOL/Limits.thy --- a/src/HOL/Limits.thy Thu Aug 30 19:59:36 2018 +0200 +++ b/src/HOL/Limits.thy Thu Aug 30 17:20:54 2018 +0200 @@ -876,6 +876,91 @@ and tendsto_add[OF tendsto_const[of "-c"], of "\x. c + f x" "c + d"] by auto +class topological_monoid_mult = topological_semigroup_mult + monoid_mult +class topological_comm_monoid_mult = topological_monoid_mult + comm_monoid_mult + +lemma tendsto_power_strong [tendsto_intros]: + fixes f :: "_ \ 'b :: topological_monoid_mult" + assumes "(f \ a) F" "(g \ b) F" + shows "((\x. f x ^ g x) \ a ^ b) F" +proof - + have "((\x. f x ^ b) \ a ^ b) F" + by (induction b) (auto intro: tendsto_intros assms) + also from assms(2) have "eventually (\x. g x = b) F" + by (simp add: nhds_discrete filterlim_principal) + hence "eventually (\x. f x ^ b = f x ^ g x) F" + by eventually_elim simp + hence "((\x. f x ^ b) \ a ^ b) F \ ((\x. f x ^ g x) \ a ^ b) F" + by (intro filterlim_cong refl) + finally show ?thesis . +qed + +lemma continuous_mult' [continuous_intros]: + fixes f g :: "_ \ 'b::topological_semigroup_mult" + shows "continuous F f \ continuous F g \ continuous F (\x. f x * g x)" + unfolding continuous_def by (rule tendsto_mult) + +lemma continuous_power' [continuous_intros]: + fixes f :: "_ \ 'b::topological_monoid_mult" + shows "continuous F f \ continuous F g \ continuous F (\x. f x ^ g x)" + unfolding continuous_def by (rule tendsto_power_strong) auto + +lemma continuous_on_mult' [continuous_intros]: + fixes f g :: "_ \ 'b::topological_semigroup_mult" + shows "continuous_on A f \ continuous_on A g \ continuous_on A (\x. f x * g x)" + unfolding continuous_on_def by (auto intro: tendsto_mult) + +lemma continuous_on_power' [continuous_intros]: + fixes f :: "_ \ 'b::topological_monoid_mult" + shows "continuous_on A f \ continuous_on A g \ continuous_on A (\x. f x ^ g x)" + unfolding continuous_on_def by (auto intro: tendsto_power_strong) + +lemma tendsto_mult_one: + fixes f g :: "_ \ 'b::topological_monoid_mult" + shows "(f \ 1) F \ (g \ 1) F \ ((\x. f x * g x) \ 1) F" + by (drule (1) tendsto_mult) simp + +lemma tendsto_prod' [tendsto_intros]: + fixes f :: "'a \ 'b \ 'c::topological_comm_monoid_mult" + shows "(\i. i \ I \ (f i \ a i) F) \ ((\x. \i\I. f i x) \ (\i\I. a i)) F" + by (induct I rule: infinite_finite_induct) (simp_all add: tendsto_mult) + +lemma tendsto_one_prod': + fixes f :: "'a \ 'b \ 'c::topological_comm_monoid_mult" + assumes "\i. i \ I \ ((\x. f x i) \ 1) F" + shows "((\i. prod (f i) I) \ 1) F" + using tendsto_prod' [of I "\x y. f y x" "\x. 1"] assms by simp + +lemma continuous_prod' [continuous_intros]: + fixes f :: "'a \ 'b::t2_space \ 'c::topological_comm_monoid_mult" + shows "(\i. i \ I \ continuous F (f i)) \ continuous F (\x. \i\I. f i x)" + unfolding continuous_def by (rule tendsto_prod') + +lemma continuous_on_prod' [continuous_intros]: + fixes f :: "'a \ 'b::topological_space \ 'c::topological_comm_monoid_mult" + shows "(\i. i \ I \ continuous_on S (f i)) \ continuous_on S (\x. \i\I. f i x)" + unfolding continuous_on_def by (auto intro: tendsto_prod') + +instance nat :: topological_comm_monoid_mult + by standard + (simp add: nhds_discrete principal_prod_principal filterlim_principal eventually_principal) + +instance int :: topological_comm_monoid_mult + by standard + (simp add: nhds_discrete principal_prod_principal filterlim_principal eventually_principal) + +class comm_real_normed_algebra_1 = real_normed_algebra_1 + comm_monoid_mult + +context real_normed_field +begin + +subclass comm_real_normed_algebra_1 +proof + from norm_mult[of "1 :: 'a" 1] show "norm 1 = 1" by simp +qed (simp_all add: norm_mult) + +end + subsubsection \Inverse and division\ lemma (in bounded_bilinear) Zfun_prod_Bfun: diff -r 9207ada0ca31 -r f443ec10447d src/HOL/Series.thy --- a/src/HOL/Series.thy Thu Aug 30 19:59:36 2018 +0200 +++ b/src/HOL/Series.thy Thu Aug 30 17:20:54 2018 +0200 @@ -335,6 +335,18 @@ end +lemma sums_If_finite_set': + fixes f g :: "nat \ 'a::{t2_space,topological_ab_group_add}" + assumes "g sums S" and "finite A" and "S' = S + (\n\A. f n - g n)" + shows "(\n. if n \ A then f n else g n) sums S'" +proof - + have "(\n. g n + (if n \ A then f n - g n else 0)) sums (S + (\n\A. f n - g n))" + by (intro sums_add assms sums_If_finite_set) + also have "(\n. g n + (if n \ A then f n - g n else 0)) = (\n. if n \ A then f n else g n)" + by (simp add: fun_eq_iff) + finally show ?thesis using assms by simp +qed + subsection \Infinite summability on real normed vector spaces\ context diff -r 9207ada0ca31 -r f443ec10447d src/HOL/Topological_Spaces.thy --- a/src/HOL/Topological_Spaces.thy Thu Aug 30 19:59:36 2018 +0200 +++ b/src/HOL/Topological_Spaces.thy Thu Aug 30 17:20:54 2018 +0200 @@ -512,6 +512,10 @@ lemma (in discrete_topology) at_discrete: "at x within S = bot" unfolding at_within_def nhds_discrete by simp +lemma (in discrete_topology) tendsto_discrete: + "filterlim (f :: 'b \ 'a) (nhds y) F \ eventually (\x. f x = y) F" + by (auto simp: nhds_discrete filterlim_principal) + lemma (in topological_space) at_within_eq: "at x within s = (INF S:{S. open S \ x \ S}. principal (S \ s - {x}))" unfolding nhds_def at_within_def @@ -881,6 +885,36 @@ shows "((\x. a) \ b) F \ a = b" by (auto intro!: tendsto_unique [OF assms tendsto_const]) +lemma Lim_in_closed_set: + assumes "closed S" "eventually (\x. f(x) \ S) F" "F \ bot" "(f \ l) F" + shows "l \ S" +proof (rule ccontr) + assume "l \ S" + with \closed S\ have "open (- S)" "l \ - S" + by (simp_all add: open_Compl) + with assms(4) have "eventually (\x. f x \ - S) F" + by (rule topological_tendstoD) + with assms(2) have "eventually (\x. False) F" + by (rule eventually_elim2) simp + with assms(3) show "False" + by (simp add: eventually_False) +qed + +lemma (in t3_space) nhds_closed: + assumes "x \ A" and "open A" + shows "\A'. x \ A' \ closed A' \ A' \ A \ eventually (\y. y \ A') (nhds x)" +proof - + from assms have "\U V. open U \ open V \ x \ U \ - A \ V \ U \ V = {}" + by (intro t3_space) auto + then obtain U V where UV: "open U" "open V" "x \ U" "-A \ V" "U \ V = {}" + by auto + have "eventually (\y. y \ U) (nhds x)" + using \open U\ and \x \ U\ by (intro eventually_nhds_in_open) + hence "eventually (\y. y \ -V) (nhds x)" + by eventually_elim (use UV in auto) + with UV show ?thesis by (intro exI[of _ "-V"]) auto +qed + lemma (in order_topology) increasing_tendsto: assumes bdd: "eventually (\n. f n \ l) F" and en: "\x. x < l \ eventually (\n. x < f n) F" @@ -2082,6 +2116,9 @@ by (auto simp: at_within_Icc_at_right at_within_Icc_at_left continuous_on_def dest: bspec[where x=a] bspec[where x=b]) +lemma continuous_on_discrete [simp, continuous_intros]: + "continuous_on A (f :: 'a :: discrete_topology \ _)" + by (auto simp: continuous_on_def at_discrete) subsubsection \Continuity at a point\ @@ -2125,6 +2162,10 @@ "continuous_on s f \ (\x\s. continuous (at x within s) f)" unfolding continuous_on_def continuous_within .. +lemma continuous_discrete [simp, continuous_intros]: + "continuous (at x within A) (f :: 'a :: discrete_topology \ _)" + by (auto simp: continuous_def at_discrete) + abbreviation isCont :: "('a::t2_space \ 'b::topological_space) \ 'a \ bool" where "isCont f a \ continuous (at a) f"