# HG changeset patch # User hoelzl # Date 1404135925 -7200 # Node ID 159e45728ceb34f4c3e6b3e137228b91b938be63 # Parent 87429bdecad513d8923e563a610038bb6f81e6d9 more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs diff -r 87429bdecad5 -r 159e45728ceb src/HOL/Complete_Lattices.thy --- a/src/HOL/Complete_Lattices.thy Mon Jun 30 15:45:21 2014 +0200 +++ b/src/HOL/Complete_Lattices.thy Mon Jun 30 15:45:25 2014 +0200 @@ -415,6 +415,15 @@ then show ?thesis by simp qed +lemma INF_inf_const1: + "I \ {} \ (INF i:I. inf x (f i)) = inf x (INF i:I. f i)" + by (intro antisym INF_greatest inf_mono order_refl INF_lower) + (auto intro: INF_lower2 le_infI2 intro!: INF_mono) + +lemma INF_inf_const2: + "I \ {} \ (INF i:I. inf (f i) x) = inf (INF i:I. f i) x" + using INF_inf_const1[of I x f] by (simp add: inf_commute) + lemma INF_constant: "(\y\A. c) = (if A = {} then \ else c)" by simp diff -r 87429bdecad5 -r 159e45728ceb src/HOL/Hilbert_Choice.thy --- a/src/HOL/Hilbert_Choice.thy Mon Jun 30 15:45:21 2014 +0200 +++ b/src/HOL/Hilbert_Choice.thy Mon Jun 30 15:45:25 2014 +0200 @@ -99,14 +99,14 @@ by (fast elim: someI) lemma dependent_nat_choice: - assumes 1: "\x. P x" and - 2: "\x n. P x \ \y. P y \ Q n x y" - shows "\f. \n. P (f n) \ Q n (f n) (f (Suc n))" + assumes 1: "\x. P 0 x" and + 2: "\x n. P n x \ \y. P (Suc n) y \ Q n x y" + shows "\f. \n. P n (f n) \ Q n (f n) (f (Suc n))" proof (intro exI allI conjI) - fix n def f \ "rec_nat (SOME x. P x) (\n x. SOME y. P y \ Q n x y)" - then have "P (f 0)" "\n. P (f n) \ P (f (Suc n)) \ Q n (f n) (f (Suc n))" + fix n def f \ "rec_nat (SOME x. P 0 x) (\n x. SOME y. P (Suc n) y \ Q n x y)" + have "P 0 (f 0)" "\n. P n (f n) \ P (Suc n) (f (Suc n)) \ Q n (f n) (f (Suc n))" using someI_ex[OF 1] someI_ex[OF 2] by (simp_all add: f_def) - then show "P (f n)" "Q n (f n) (f (Suc n))" + then show "P n (f n)" "Q n (f n) (f (Suc n))" by (induct n) auto qed diff -r 87429bdecad5 -r 159e45728ceb src/HOL/Multivariate_Analysis/Topology_Euclidean_Space.thy --- a/src/HOL/Multivariate_Analysis/Topology_Euclidean_Space.thy Mon Jun 30 15:45:21 2014 +0200 +++ b/src/HOL/Multivariate_Analysis/Topology_Euclidean_Space.thy Mon Jun 30 15:45:25 2014 +0200 @@ -4616,41 +4616,31 @@ using continuous_within_eps_delta [of x UNIV f] by simp lemma continuous_at_right_real_increasing: - assumes nondecF: "\ x y. x \ y \ f x \ ((f y) :: real)" - shows "(continuous (at_right (a :: real)) f) = (\e > 0. \delta > 0. f (a + delta) - f a < e)" - apply (auto simp add: continuous_within_eps_delta dist_real_def greaterThan_def) - apply (drule_tac x = e in spec, auto) - apply (drule_tac x = "a + d / 2" in spec) - apply (subst (asm) abs_of_nonneg) - apply (auto intro: nondecF simp add: field_simps) - apply (rule_tac x = "d / 2" in exI) - apply (auto simp add: field_simps) - apply (drule_tac x = e in spec, auto) - apply (rule_tac x = delta in exI, auto) - apply (subst abs_of_nonneg) - apply (auto intro: nondecF simp add: field_simps) - apply (rule le_less_trans) - prefer 2 apply assumption -by (rule nondecF, auto) + fixes f :: "real \ real" + assumes nondecF: "\x y. x \ y \ f x \ f y" + shows "continuous (at_right a) f \ (\e>0. \d>0. f (a + d) - f a < e)" + apply (simp add: greaterThan_def dist_real_def continuous_within Lim_within_le) + apply (intro all_cong ex_cong) + apply safe + apply (erule_tac x="a + d" in allE) + apply simp + apply (simp add: nondecF field_simps) + apply (drule nondecF) + apply simp + done lemma continuous_at_left_real_increasing: assumes nondecF: "\ x y. x \ y \ f x \ ((f y) :: real)" shows "(continuous (at_left (a :: real)) f) = (\e > 0. \delta > 0. f a - f (a - delta) < e)" - apply (auto simp add: continuous_within_eps_delta dist_real_def lessThan_def) - apply (drule_tac x = e in spec, auto) - apply (drule_tac x = "a - d / 2" in spec) - apply (subst (asm) abs_of_nonpos) - apply (auto intro: nondecF simp add: field_simps) - apply (rule_tac x = "d / 2" in exI) - apply (auto simp add: field_simps) - apply (drule_tac x = e in spec, auto) - apply (rule_tac x = delta in exI, auto) - apply (subst abs_of_nonpos) - apply (auto intro: nondecF simp add: field_simps) - apply (rule less_le_trans) - apply assumption - apply auto -by (rule nondecF, auto) + apply (simp add: lessThan_def dist_real_def continuous_within Lim_within_le) + apply (intro all_cong ex_cong) + apply safe + apply (erule_tac x="a - d" in allE) + apply simp + apply (simp add: nondecF field_simps) + apply (cut_tac x="a - d" and y="x" in nondecF) + apply simp_all + done text{* Versions in terms of open balls. *} diff -r 87429bdecad5 -r 159e45728ceb src/HOL/Real_Vector_Spaces.thy --- a/src/HOL/Real_Vector_Spaces.thy Mon Jun 30 15:45:21 2014 +0200 +++ b/src/HOL/Real_Vector_Spaces.thy Mon Jun 30 15:45:25 2014 +0200 @@ -1466,18 +1466,31 @@ subsection {* Filters and Limits on Metric Space *} -lemma eventually_nhds_metric: - fixes a :: "'a :: metric_space" - shows "eventually P (nhds a) \ (\d>0. \x. dist x a < d \ P x)" -unfolding eventually_nhds open_dist -apply safe -apply fast -apply (rule_tac x="{x. dist x a < d}" in exI, simp) -apply clarsimp -apply (rule_tac x="d - dist x a" in exI, clarsimp) -apply (simp only: less_diff_eq) -apply (erule le_less_trans [OF dist_triangle]) -done +lemma (in metric_space) nhds_metric: "nhds x = (INF e:{0 <..}. principal {y. dist y x < e})" + unfolding nhds_def +proof (safe intro!: INF_eq) + fix S assume "open S" "x \ S" + then obtain e where "{y. dist y x < e} \ S" "0 < e" + by (auto simp: open_dist subset_eq) + then show "\e\{0<..}. principal {y. dist y x < e} \ principal S" + by auto +qed (auto intro!: exI[of _ "{y. dist x y < e}" for e] open_ball simp: dist_commute) + +lemma (in metric_space) tendsto_iff: + "(f ---> l) F \ (\e>0. eventually (\x. dist (f x) l < e) F)" + unfolding nhds_metric filterlim_INF filterlim_principal by auto + +lemma (in metric_space) tendstoI: "(\e. 0 < e \ eventually (\x. dist (f x) l < e) F) \ (f ---> l) F" + by (auto simp: tendsto_iff) + +lemma (in metric_space) tendstoD: "(f ---> l) F \ 0 < e \ eventually (\x. dist (f x) l < e) F" + by (auto simp: tendsto_iff) + +lemma (in metric_space) eventually_nhds_metric: + "eventually P (nhds a) \ (\d>0. \x. dist x a < d \ P x)" + unfolding nhds_metric + by (subst eventually_INF_base) + (auto simp: eventually_principal Bex_def subset_eq intro: exI[of _ "min a b" for a b]) lemma eventually_at: fixes a :: "'a :: metric_space" @@ -1493,34 +1506,6 @@ apply auto done -lemma tendstoI: - fixes l :: "'a :: metric_space" - assumes "\e. 0 < e \ eventually (\x. dist (f x) l < e) F" - shows "(f ---> l) F" - apply (rule topological_tendstoI) - apply (simp add: open_dist) - apply (drule (1) bspec, clarify) - apply (drule assms) - apply (erule eventually_elim1, simp) - done - -lemma tendstoD: - fixes l :: "'a :: metric_space" - shows "(f ---> l) F \ 0 < e \ eventually (\x. dist (f x) l < e) F" - apply (drule_tac S="{x. dist x l < e}" in topological_tendstoD) - apply (clarsimp simp add: open_dist) - apply (rule_tac x="e - dist x l" in exI, clarsimp) - apply (simp only: less_diff_eq) - apply (erule le_less_trans [OF dist_triangle]) - apply simp - apply simp - done - -lemma tendsto_iff: - fixes l :: "'a :: metric_space" - shows "(f ---> l) F \ (\e>0. eventually (\x. dist (f x) l < e) F)" - using tendstoI tendstoD by fast - lemma metric_tendsto_imp_tendsto: fixes a :: "'a :: metric_space" and b :: "'b :: metric_space" assumes f: "(f ---> a) F" @@ -1786,49 +1771,31 @@ fixes f :: "real \ 'b::first_countable_topology" assumes *: "\X. filterlim X at_top sequentially \ (\n. f (X n)) ----> y" shows "(f ---> y) at_top" - unfolding filterlim_iff -proof safe - fix P assume "eventually P (nhds y)" - then have seq: "\f. f ----> y \ eventually (\x. P (f x)) at_top" - unfolding eventually_nhds_iff_sequentially by simp - - show "eventually (\x. P (f x)) at_top" - proof (rule ccontr) - assume "\ eventually (\x. P (f x)) at_top" - then have "\X. \x>X. \ P (f x)" - unfolding eventually_at_top_dense by simp - then obtain r where not_P: "\x. \ P (f (r x))" and r: "\x. x < r x" - by metis - - def s \ "rec_nat (r 0) (\_ x. r (x + 1))" - then have [simp]: "s 0 = r 0" "\n. s (Suc n) = r (s n + 1)" - by auto - - { fix n have "n < s n" using r - by (induct n) (auto simp add: real_of_nat_Suc intro: less_trans add_strict_right_mono) } - note s_subseq = this +proof - + from nhds_countable[of y] guess A . note A = this - have "mono s" - proof (rule incseq_SucI) - fix n show "s n \ s (Suc n)" - using r[of "s n + 1"] by simp - qed - - have "filterlim s at_top sequentially" - unfolding filterlim_at_top_gt[where c=0] eventually_sequentially - proof (safe intro!: exI) - fix Z :: real and n assume "0 < Z" "natceiling Z \ n" - with real_natceiling_ge[of Z] `n < s n` - show "Z \ s n" - by auto - qed - moreover then have "eventually (\x. P (f (s x))) sequentially" - by (rule seq[OF *]) - then obtain n where "P (f (s n))" - by (auto simp: eventually_sequentially) - then show False - using not_P by (cases n) auto + have "\m. \k. \x\k. f x \ A m" + proof (rule ccontr) + assume "\ (\m. \k. \x\k. f x \ A m)" + then obtain m where "\k. \x\k. f x \ A m" + by auto + then have "\X. \n. (f (X n) \ A m) \ max n (X n) + 1 \ X (Suc n)" + by (intro dependent_nat_choice) (auto simp del: max.bounded_iff) + then obtain X where X: "\n. f (X n) \ A m" "\n. max n (X n) + 1 \ X (Suc n)" + by auto + { fix n have "1 \ n \ real n \ X n" + using X[of "n - 1"] by auto } + then have "filterlim X at_top sequentially" + by (force intro!: filterlim_at_top_mono[OF filterlim_real_sequentially] + simp: eventually_sequentially) + from topological_tendstoD[OF *[OF this] A(2, 3), of m] X(1) show False + by auto qed + then obtain k where "\m x. k m \ x \ f x \ A m" + by metis + then show ?thesis + unfolding at_top_def A + by (intro filterlim_base[where i=k]) auto qed lemma tendsto_at_topI_sequentially_real: diff -r 87429bdecad5 -r 159e45728ceb src/HOL/Set_Interval.thy --- a/src/HOL/Set_Interval.thy Mon Jun 30 15:45:21 2014 +0200 +++ b/src/HOL/Set_Interval.thy Mon Jun 30 15:45:25 2014 +0200 @@ -175,6 +175,12 @@ shows "{.. m < n" by (metis leD lessThan_subset_iff linorder_linear not_less_iff_gr_or_eq psubset_eq) +lemma (in linorder) Ici_subset_Ioi_iff: "{a ..} \ {b <..} \ b < a" + by auto + +lemma (in linorder) Iic_subset_Iio_iff: "{.. a} \ {..< b} \ a < b" + by auto + subsection {*Two-sided intervals*} context ord diff -r 87429bdecad5 -r 159e45728ceb src/HOL/Topological_Spaces.thy --- a/src/HOL/Topological_Spaces.thy Mon Jun 30 15:45:21 2014 +0200 +++ b/src/HOL/Topological_Spaces.thy Mon Jun 30 15:45:25 2014 +0200 @@ -757,6 +757,9 @@ definition at_top :: "('a::order) filter" where "at_top = (INF k. principal {k ..})" +lemma at_top_sub: "at_top = (INF k:{c::'a::linorder..}. principal {k ..})" + by (auto intro!: INF_eq max.cobounded1 max.cobounded2 simp: at_top_def) + lemma eventually_at_top_linorder: "eventually P at_top \ (\N::'a::linorder. \n\N. P n)" unfolding at_top_def by (subst eventually_INF_base) (auto simp: eventually_principal intro: max.cobounded1 max.cobounded2) @@ -765,12 +768,6 @@ "eventually (\x. (c::_::linorder) \ x) at_top" unfolding eventually_at_top_linorder by auto -lemma (in linorder) Ici_subset_Ioi_iff: "{a ..} \ {b <..} \ b < a" - by auto - -lemma (in linorder) Iic_subset_Iio_iff: "{.. a} \ {..< b} \ a < b" - by auto - lemma eventually_at_top_dense: "eventually P at_top \ (\N::'a::{no_top, linorder}. \n>N. P n)" proof - have "eventually P (INF k. principal {k <..}) \ (\N::'a. \n>N. P n)" @@ -788,6 +785,9 @@ definition at_bot :: "('a::order) filter" where "at_bot = (INF k. principal {.. k})" +lemma at_bot_sub: "at_bot = (INF k:{.. c::'a::linorder}. principal {.. k})" + by (auto intro!: INF_eq min.cobounded1 min.cobounded2 simp: at_bot_def) + lemma eventually_at_bot_linorder: fixes P :: "'a::linorder \ bool" shows "eventually P at_bot \ (\N. \n\N. P n)" unfolding at_bot_def @@ -875,6 +875,16 @@ abbreviation (in order_topology) at_left :: "'a \ 'a filter" where "at_left x \ at x within {..< x}" +lemma (in topological_space) nhds_generated_topology: + "open = generate_topology T \ nhds x = (INF S:{S\T. x \ S}. principal S)" + unfolding nhds_def +proof (safe intro!: antisym INF_greatest) + fix S assume "generate_topology T S" "x \ S" + then show "(INF S:{S \ T. x \ S}. principal S) \ principal S" + by induction + (auto intro: INF_lower order_trans simp add: inf_principal[symmetric] simp del: inf_principal) +qed (auto intro!: INF_lower intro: generate_topology.intros) + lemma (in topological_space) eventually_nhds: "eventually P (nhds a) \ (\S. open S \ a \ S \ (\x\S. P x))" unfolding nhds_def by (subst eventually_INF_base) (auto simp: eventually_principal) @@ -882,6 +892,9 @@ lemma nhds_neq_bot [simp]: "nhds a \ bot" unfolding trivial_limit_def eventually_nhds by simp +lemma at_within_eq: "at x within s = (INF S:{S. open S \ x \ S}. principal (S \ s - {x}))" + unfolding nhds_def at_within_def by (subst INF_inf_const2[symmetric]) (auto simp add: Diff_Int_distrib) + lemma eventually_at_filter: "eventually P (at a within s) \ eventually (\x. x \ a \ x \ s \ P x) (nhds a)" unfolding at_within_def eventually_inf_principal by (simp add: imp_conjL[symmetric] conj_commute) @@ -910,39 +923,48 @@ lemma at_neq_bot [simp]: "at (a::'a::perfect_space) \ bot" by (simp add: at_eq_bot_iff not_open_singleton) -lemma eventually_at_right: - fixes x :: "'a :: linorder_topology" - assumes gt_ex: "x < y" - shows "eventually P (at_right x) \ (\b. x < b \ (\z. x < z \ z < b \ P z))" - unfolding eventually_at_topological -proof safe - note gt_ex - moreover fix S assume "open S" "x \ S" note open_right[OF this, of y] - moreover assume "\s\S. s \ x \ s \ {x<..} \ P s" - ultimately show "\b>x. \z. x < z \ z < b \ P z" - by (auto simp: subset_eq Ball_def) -next - fix b assume "x < b" "\z. x < z \ z < b \ P z" - then show "\S. open S \ x \ S \ (\xa\S. xa \ x \ xa \ {x<..} \ P xa)" - by (intro exI[of _ "{..< b}"]) auto +lemma (in order_topology) nhds_order: "nhds x = + inf (INF a:{x <..}. principal {..< a}) (INF a:{..< x}. principal {a <..})" +proof - + have 1: "{S \ range lessThan \ range greaterThan. x \ S} = + (\a. {..< a}) ` {x <..} \ (\a. {a <..}) ` {..< x}" + by auto + show ?thesis + unfolding nhds_generated_topology[OF open_generated_order] INF_union 1 INF_image comp_def .. qed -lemma eventually_at_left: - fixes x :: "'a :: linorder_topology" - assumes lt_ex: "y < x" - shows "eventually P (at_left x) \ (\b. x > b \ (\z. b < z \ z < x \ P z))" - unfolding eventually_at_topological -proof safe - note lt_ex - moreover fix S assume "open S" "x \ S" note open_left[OF this, of y] - moreover assume "\s\S. s \ x \ s \ {.. P s" - ultimately show "\bz. b < z \ z < x \ P z" - by (auto simp: subset_eq Ball_def) -next - fix b assume "b < x" "\z. b < z \ z < x \ P z" - then show "\S. open S \ x \ S \ (\s\S. s \ x \ s \ {.. P s)" - by (intro exI[of _ "{b <..}"]) auto -qed +lemma (in linorder_topology) at_within_order: "UNIV \ {x} \ + at x within s = inf (INF a:{x <..}. principal ({..< a} \ s - {x})) + (INF a:{..< x}. principal ({a <..} \ s - {x}))" +proof (cases "{x <..} = {}" "{..< x} = {}" rule: case_split[case_product case_split]) + assume "UNIV \ {x}" "{x<..} = {}" "{..< x} = {}" + moreover have "UNIV = {..< x} \ {x} \ {x <..}" + by auto + ultimately show ?thesis + by auto +qed (auto simp: at_within_def nhds_order Int_Diff inf_principal[symmetric] INF_inf_const2 + inf_sup_aci[where 'a="'a filter"] + simp del: inf_principal) + +lemma (in linorder_topology) at_left_eq: + "y < x \ at_left x = (INF a:{..< x}. principal {a <..< x})" + by (subst at_within_order) + (auto simp: greaterThan_Int_greaterThan greaterThanLessThan_eq[symmetric] min.absorb2 INF_constant + intro!: INF_lower2 inf_absorb2) + +lemma (in linorder_topology) eventually_at_left: + "y < x \ eventually P (at_left x) \ (\by>b. y < x \ P y)" + unfolding at_left_eq by (subst eventually_INF_base) (auto simp: eventually_principal Ball_def) + +lemma (in linorder_topology) at_right_eq: + "x < y \ at_right x = (INF a:{x <..}. principal {x <..< a})" + by (subst at_within_order) + (auto simp: lessThan_Int_lessThan greaterThanLessThan_eq[symmetric] max.absorb2 INF_constant Int_commute + intro!: INF_lower2 inf_absorb1) + +lemma (in linorder_topology) eventually_at_right: + "x < y \ eventually P (at_right x) \ (\b>x. \y>x. y < b \ P y)" + unfolding at_right_eq by (subst eventually_INF_base) (auto simp: eventually_principal Ball_def) lemma trivial_limit_at_right_top: "at_right (top::_::{order_top, linorder_topology}) = bot" unfolding filter_eq_iff eventually_at_topological by auto @@ -1029,6 +1051,26 @@ "(LIM x F. f x :> (INF b:B. G b)) \ (\b\B. LIM x F. f x :> G b)" unfolding filterlim_def le_INF_iff .. +lemma filterlim_INF_INF: + "(\m. m \ J \ \i\I. filtermap f (F i) \ G m) \ LIM x (INF i:I. F i). f x :> (INF j:J. G j)" + unfolding filterlim_def by (rule order_trans[OF filtermap_INF INF_mono]) + +lemma filterlim_base: + "(\m x. m \ J \ i m \ I) \ (\m x. m \ J \ x \ F (i m) \ f x \ G m) \ + LIM x (INF i:I. principal (F i)). f x :> (INF j:J. principal (G j))" + by (force intro!: filterlim_INF_INF simp: image_subset_iff) + +lemma filterlim_base_iff: + assumes "I \ {}" and chain: "\i j. i \ I \ j \ I \ F i \ F j \ F j \ F i" + shows "(LIM x (INF i:I. principal (F i)). f x :> INF j:J. principal (G j)) \ + (\j\J. \i\I. \x\F i. f x \ G j)" + unfolding filterlim_INF filterlim_principal +proof (subst eventually_INF_base) + fix i j assume "i \ I" "j \ I" + with chain[OF this] show "\x\I. principal (F x) \ inf (principal (F i)) (principal (F j))" + by auto +qed (auto simp: eventually_principal `I \ {}`) + lemma filterlim_filtermap: "filterlim f F1 (filtermap g F2) = filterlim (\x. f (g x)) F1 F2" unfolding filterlim_def filtermap_filtermap .. @@ -1096,40 +1138,25 @@ "(f ---> l) F \ open S \ l \ S \ eventually (\x. f x \ S) F" unfolding tendsto_def by auto -lemma order_tendstoI: - fixes y :: "_ :: order_topology" - assumes "\a. a < y \ eventually (\x. a < f x) F" - assumes "\a. y < a \ eventually (\x. f x < a) F" - shows "(f ---> y) F" -proof (rule topological_tendstoI) - fix S assume "open S" "y \ S" - then show "eventually (\x. f x \ S) F" - unfolding open_generated_order - proof induct - case (UN K) - then obtain k where "y \ k" "k \ K" by auto - with UN(2)[of k] show ?case - by (auto elim: eventually_elim1) - qed (insert assms, auto elim: eventually_elim2) -qed - -lemma order_tendstoD: - fixes y :: "_ :: order_topology" - assumes y: "(f ---> y) F" +lemma (in order_topology) order_tendsto_iff: + "(f ---> x) F \ (\lx. l < f x) F) \ (\u>x. eventually (\x. f x < u) F)" + unfolding nhds_order filterlim_inf filterlim_INF filterlim_principal by auto + +lemma (in order_topology) order_tendstoI: + "(\a. a < y \ eventually (\x. a < f x) F) \ (\a. y < a \ eventually (\x. f x < a) F) \ + (f ---> y) F" + unfolding order_tendsto_iff by auto + +lemma (in order_topology) order_tendstoD: + assumes "(f ---> y) F" shows "a < y \ eventually (\x. a < f x) F" and "y < a \ eventually (\x. f x < a) F" - using topological_tendstoD[OF y, of "{..< a}"] topological_tendstoD[OF y, of "{a <..}"] by auto - -lemma order_tendsto_iff: - fixes f :: "_ \ 'a :: order_topology" - shows "(f ---> x) F \(\lx. l < f x) F) \ (\u>x. eventually (\x. f x < u) F)" - by (metis order_tendstoI order_tendstoD) + using assms unfolding order_tendsto_iff by auto lemma tendsto_bot [simp]: "(f ---> a) bot" unfolding tendsto_def by simp -lemma tendsto_max: - fixes x y :: "'a::linorder_topology" +lemma (in linorder_topology) tendsto_max: assumes X: "(X ---> x) net" assumes Y: "(Y ---> y) net" shows "((\x. max (X x) (Y x)) ---> max x y) net" @@ -1145,8 +1172,7 @@ by (auto simp: eventually_conj_iff) qed -lemma tendsto_min: - fixes x y :: "'a::linorder_topology" +lemma (in linorder_topology) tendsto_min: assumes X: "(X ---> x) net" assumes Y: "(Y ---> y) net" shows "((\x. min (X x) (Y x)) ---> min x y) net" @@ -1162,7 +1188,6 @@ by (auto simp: min_less_iff_disj elim: eventually_elim1) qed - lemma tendsto_ident_at [tendsto_intros]: "((\x. x) ---> a) (at a within s)" unfolding tendsto_def eventually_at_topological by auto @@ -1170,7 +1195,7 @@ by (simp add: tendsto_def) lemma (in t2_space) tendsto_unique: - assumes "\ trivial_limit F" and "(f ---> a) F" and "(f ---> b) F" + assumes "F \ bot" and "(f ---> a) F" and "(f ---> b) F" shows "a = b" proof (rule ccontr) assume "a \ b" @@ -1271,6 +1296,11 @@ shows "(LIM x F. f x :> at_top) \ (\Z. eventually (\x. Z \ f x) F)" by (auto simp: filterlim_iff eventually_at_top_linorder elim!: eventually_elim1) +lemma filterlim_at_top_mono: + "LIM x F. f x :> at_top \ eventually (\x. f x \ (g x::'a::linorder)) F \ + LIM x F. g x :> at_top" + by (auto simp: filterlim_at_top elim: eventually_elim2 intro: order_trans) + lemma filterlim_at_top_dense: fixes f :: "'a \ ('b::unbounded_dense_linorder)" shows "(LIM x F. f x :> at_top) \ (\Z. eventually (\x. Z < f x) F)" @@ -1280,12 +1310,7 @@ lemma filterlim_at_top_ge: fixes f :: "'a \ ('b::linorder)" and c :: "'b" shows "(LIM x F. f x :> at_top) \ (\Z\c. eventually (\x. Z \ f x) F)" - unfolding filterlim_at_top -proof safe - fix Z assume *: "\Z\c. eventually (\x. Z \ f x) F" - with *[THEN spec, of "max Z c"] show "eventually (\x. Z \ f x) F" - by (auto elim!: eventually_elim1) -qed simp + unfolding at_top_sub[of c] filterlim_INF by (auto simp add: filterlim_principal) lemma filterlim_at_top_at_top: fixes f :: "'a::linorder \ 'b::linorder" @@ -1546,45 +1571,30 @@ text{* for any sequence, there is a monotonic subsequence *} lemma seq_monosub: fixes s :: "nat => 'a::linorder" - shows "\f. subseq f \ monoseq (\ n. (s (f n)))" + shows "\f. subseq f \ monoseq (\n. (s (f n)))" proof cases - let "?P p n" = "p > n \ (\m\p. s m \ s p)" - assume *: "\n. \p. ?P p n" - def f \ "rec_nat (SOME p. ?P p 0) (\_ n. SOME p. ?P p n)" - have f_0: "f 0 = (SOME p. ?P p 0)" unfolding f_def by simp - have f_Suc: "\i. f (Suc i) = (SOME p. ?P p (f i))" unfolding f_def nat.rec(2) .. - have P_0: "?P (f 0) 0" unfolding f_0 using *[rule_format] by (rule someI2_ex) auto - have P_Suc: "\i. ?P (f (Suc i)) (f i)" unfolding f_Suc using *[rule_format] by (rule someI2_ex) auto - then have "subseq f" unfolding subseq_Suc_iff by auto - moreover have "monoseq (\n. s (f n))" unfolding monoseq_Suc - proof (intro disjI2 allI) - fix n show "s (f (Suc n)) \ s (f n)" - proof (cases n) - case 0 with P_Suc[of 0] P_0 show ?thesis by auto - next - case (Suc m) - from P_Suc[of n] Suc have "f (Suc m) \ f (Suc (Suc m))" by simp - with P_Suc Suc show ?thesis by simp - qed - qed - ultimately show ?thesis by auto + assume "\n. \p>n. \m\p. s m \ s p" + then have "\f. \n. (\m\f n. s m \ s (f n)) \ f n < f (Suc n)" + by (intro dependent_nat_choice) (auto simp: conj_commute) + then obtain f where "subseq f" and mono: "\n m. f n \ m \ s m \ s (f n)" + by (auto simp: subseq_Suc_iff) + moreover + then have "incseq f" + unfolding subseq_Suc_iff incseq_Suc_iff by (auto intro: less_imp_le) + then have "monoseq (\n. s (f n))" + by (auto simp add: incseq_def intro!: mono monoI2) + ultimately show ?thesis + by auto next - let "?P p m" = "m < p \ s m < s p" assume "\ (\n. \p>n. (\m\p. s m \ s p))" then obtain N where N: "\p. p > N \ \m>p. s p < s m" by (force simp: not_le le_less) - def f \ "rec_nat (SOME p. ?P p (Suc N)) (\_ n. SOME p. ?P p n)" - have f_0: "f 0 = (SOME p. ?P p (Suc N))" unfolding f_def by simp - have f_Suc: "\i. f (Suc i) = (SOME p. ?P p (f i))" unfolding f_def nat.rec(2) .. - have P_0: "?P (f 0) (Suc N)" - unfolding f_0 some_eq_ex[of "\p. ?P p (Suc N)"] using N[of "Suc N"] by auto - { fix i have "N < f i \ ?P (f (Suc i)) (f i)" - unfolding f_Suc some_eq_ex[of "\p. ?P p (f i)"] using N[of "f i"] . } - note P' = this - { fix i have "N < f i \ ?P (f (Suc i)) (f i)" - by (induct i) (insert P_0 P', auto) } - then have "subseq f" "monoseq (\x. s (f x))" - unfolding subseq_Suc_iff monoseq_Suc by (auto simp: not_le intro: less_imp_le) - then show ?thesis by auto + have "\f. \n. N < f n \ f n < f (Suc n) \ s (f n) \ s (f (Suc n))" + proof (intro dependent_nat_choice) + fix x assume "N < x" with N[of x] show "\y>N. x < y \ s x \ s y" + by (auto intro: less_trans) + qed auto + then show ?thesis + by (auto simp: monoseq_iff incseq_Suc_iff subseq_Suc_iff) qed lemma seq_suble: assumes sf: "subseq f" shows "n \ f n" @@ -1768,6 +1778,30 @@ qed qed +lemma (in first_countable_topology) nhds_countable: + obtains X :: "nat \ 'a set" + where "decseq X" "\n. open (X n)" "\n. x \ X n" "nhds x = (INF n. principal (X n))" +proof - + from first_countable_basis obtain A :: "nat \ 'a set" + where A: "\n. x \ A n" "\n. open (A n)" "\S. open S \ x \ S \ \i. A i \ S" + by metis + show thesis + proof + show "decseq (\n. \i\n. A i)" + by (auto simp: decseq_def) + show "\n. x \ (\i\n. A i)" "\n. open (\i\n. A i)" + using A by auto + show "nhds x = (INF n. principal (\ i\n. A i))" + using A unfolding nhds_def + apply (intro INF_eq) + apply simp_all + apply force + apply (intro exI[of _ "\ i\n. A i" for n] conjI open_INT) + apply auto + done + qed +qed + lemma (in first_countable_topology) countable_basis: obtains A :: "nat \ 'a set" where "\i. open (A i)" "\i. x \ A i"