# HG changeset patch # User paulson # Date 1744405023 -3600 # Node ID b4b205e407b30269ed8e94bf2d14486998dc6fc2 # Parent 12fe1e2b87e4b82e7c4f3253e9331c3c55653275# Parent 451f428c5814dba89cd88b51cd0717033602625b merged diff -r 12fe1e2b87e4 -r b4b205e407b3 src/HOL/Analysis/Derivative.thy --- a/src/HOL/Analysis/Derivative.thy Fri Apr 11 16:24:04 2025 +0100 +++ b/src/HOL/Analysis/Derivative.thy Fri Apr 11 21:57:03 2025 +0100 @@ -2810,7 +2810,7 @@ by simp qed have "\!x \ ?D. ?u x = x" - proof (rule banach_fix) + proof (rule Banach_fix) show "cball 0 \ \ {}" using \0 < \\ by auto show "(\x. x + (y - f x)) ` cball 0 \ \ cball 0 \" diff -r 12fe1e2b87e4 -r b4b205e407b3 src/HOL/Analysis/Elementary_Metric_Spaces.thy --- a/src/HOL/Analysis/Elementary_Metric_Spaces.thy Fri Apr 11 16:24:04 2025 +0100 +++ b/src/HOL/Analysis/Elementary_Metric_Spaces.thy Fri Apr 11 21:57:03 2025 +0100 @@ -145,17 +145,10 @@ fix x and e::real assume "x\S" "e>0" "ball x e \ S" then have "\d>0. cball x d \ S" - unfolding subset_eq by (rule_tac x="e/2" in exI, auto) + unfolding subset_eq by (intro exI [where x="e/2"], auto) } - moreover - { - fix x and e::real - assume "x\S" "e>0" "cball x e \ S" - then have "\d>0. ball x d \ S" - using mem_ball_imp_mem_cball by blast - } - ultimately show ?thesis - unfolding open_contains_ball by auto + then show ?thesis + unfolding open_contains_ball by force qed lemma open_contains_cball_eq: "open S \ (\x. x \ S \ (\e>0. cball x e \ S))" @@ -376,8 +369,8 @@ lemma cball_eq_sing: fixes x :: "'a::{metric_space,perfect_space}" shows "cball x e = {x} \ e = 0" - by (smt (verit, best) open_ball ball_eq_empty ball_subset_cball cball_empty cball_trivial - not_open_singleton subset_singleton_iff) + by (metis cball_trivial centre_in_cball finite.emptyI finite.insertI finite_Int + islimpt_UNIV islimpt_eq_infinite_cball less_eq_real_def) section \Finite and discrete\ @@ -406,8 +399,8 @@ case (insert x S) then obtain d where "d > 0" and d: "\x\S. x \ a \ d \ dist a x" by blast - show ?case - by (smt (verit, del_insts) dist_pos_lt insert.IH insert_iff) + then show ?case + by (metis dist_nz dual_order.strict_implies_order insertE leI order.strict_trans2) qed (auto intro: zero_less_one) lemma discrete_imp_closed: @@ -418,11 +411,10 @@ proof - have False if C: "\e. e>0 \ \x'\S. x' \ x \ dist x' x < e" for x proof - - from e have e2: "e/2 > 0" by arith - from C[OF e2] obtain y where y: "y \ S" "y \ x" "dist y x < e/2" - by blast - from e2 y(2) have mp: "min (e/2) (dist x y) > 0" - by simp + obtain y where y: "y \ S" "y \ x" "dist y x < e/2" + by (meson C e half_gt_zero) + then have mp: "min (e/2) (dist x y) > 0" + by (simp add: dist_commute) from d y C[OF mp] show ?thesis by metric qed @@ -434,15 +426,7 @@ assumes e: "0 < e" and d: "\x y. x \ S \ y \ S \ dist y x < e \ y = x" shows "\ x islimpt S" -proof - assume "x islimpt S" - hence "x islimpt S - {x}" - by (meson islimpt_punctured) - moreover from assms have "closed (S - {x})" - by (intro discrete_imp_closed) auto - ultimately show False - unfolding closed_limpt by blast -qed + by (metis closed_limpt d discrete_imp_closed e islimpt_approachable) section \Interior\ @@ -535,32 +519,19 @@ case (Suc n) then consider "m < n" | "m = n" using less_Suc_eq by blast then show ?case - proof cases - assume "m < n" - have "dist (f(Suc n)) x = dist (y (min (inverse(2 ^ (Suc n))) (dist (f n) x))) x" - by (simp add: fSuc) - also have "\ < dist (f n) x" - by (metis dist_pos_lt f min.strict_order_iff min_less_iff_conj y) - also have "\ < dist (f m) x" - using Suc.IH \m < n\ by blast - finally show ?thesis . - next - assume "m = n" then show ?case - by (smt (verit, best) dist_pos_lt f fSuc y) - qed + by (smt (verit, ccfv_threshold) Suc.IH dist_nz f fSuc y) qed then show "inj f" by (metis less_irrefl linorder_injI) - have "\e n. \0 < e; nat \1 / e\ \ n\ \ dist (f n) x < e" - apply (rule less_trans [OF f [THEN conjunct2, THEN conjunct2]]) + have "\e n. \0 < e; nat \1 / e::real\ \ n\ \ inverse (2 ^ n) < e" by (simp add: divide_simps order_le_less_trans) then show "f \ x" - using lim_sequentially by blast + by (metis dual_order.strict_trans f lim_sequentially) qed next assume ?rhs then show ?lhs - by (fastforce simp add: islimpt_approachable lim_sequentially) + by (fastforce simp: islimpt_approachable lim_sequentially) qed lemma Lim_dist_ubound: @@ -1117,7 +1088,7 @@ section \Banach fixed point theorem\ -theorem banach_fix:\ \TODO: rename to \Banach_fix\\ +theorem Banach_fix: assumes s: "complete s" "s \ {}" and c: "0 \ c" "c < 1" and f: "f ` s \ s" @@ -1200,21 +1171,13 @@ by (simp add: mult.assoc) also have "\ < (e * (1 - c) / d) * d * (1 - c ^ (m - n)) / (1 - c)" using mult_strict_right_mono[OF N **] by (auto simp: mult.assoc) - also from c \d > 0\ \1 - c > 0\ have "\ = e * (1 - c ^ (m - n))" - by simp also from c \1 - c ^ (m - n) > 0\ \e > 0\ have "\ \ e" using mult_right_le_one_le[of e "1 - c ^ (m - n)"] by auto finally show ?thesis by simp qed have "dist (z n) (z m) < e" if "N \ m" "N \ n" for m n :: nat - proof (cases "n = m") - case True - with \e > 0\ show ?thesis by simp - next - case False - with *[of n m] *[of m n] and that show ?thesis - by (auto simp: dist_commute nat_neq_iff) - qed + using *[of n m] *[of m n] + using \0 < e\ dist_commute_lessI that by fastforce then show ?thesis by auto qed then have "Cauchy z" @@ -1238,8 +1201,7 @@ by (metis dist_eq_0_iff dist_nz order_less_asym less_le) have "dist (f (z N)) (f x) \ c * dist (z N) x" using lipschitz[THEN bspec[where x="z N"], THEN bspec[where x=x]] - using z_in_s[of N] \x\s\ - using c + using z_in_s[of N] \x\s\ c by auto also have "\ < e/2" using N' and c using * by auto @@ -1253,7 +1215,7 @@ moreover have "y = x" if "f y = y" "y \ s" for y proof - from \x \ s\ \f x = x\ that have "dist x y \ c * dist x y" - using lipschitz[THEN bspec[where x=x], THEN bspec[where x=y]] by simp + using lipschitz by fastforce with c and zero_le_dist[of x y] have "dist x y = 0" by (simp add: mult_le_cancel_right1) then show ?thesis by simp @@ -1290,14 +1252,7 @@ using continuous_attains_inf[OF D cont] by auto have "g a = a" - proof (rule ccontr) - assume "g a \ a" - with \a \ S\ gs have "dist (g (g a)) (g a) < dist (g a) a" - by (intro dist[rule_format]) auto - moreover have "dist (g a) a \ dist (g (g a)) (g a)" - using \a \ S\ gs by (intro le) auto - ultimately show False by auto - qed + by (metis \a \ S\ dist gs image_subset_iff le order.strict_iff_not) moreover have "\x. x \ S \ g x = x \ x = a" using dist[THEN bspec[where x=a]] \g a = a\ and \a\S\ by auto ultimately show "\!x\S. g x = x" @@ -1453,7 +1408,7 @@ then obtain C where C: "x \ C" "C \ \" using \S \ \\\ by blast then obtain r where r: "r>0" "ball x (2*r) \ C" - by (metis mult.commute mult_2_right not_le ope openE field_sum_of_halves zero_le_numeral zero_less_mult_iff) + by (metis field_sum_of_halves half_gt_zero mult.commute mult_2_right ope open_contains_ball) then have "\r C. r > 0 \ ball x (2*r) \ C \ C \ \" using C by blast } @@ -1519,7 +1474,8 @@ assumes "bounded S" and "closed S" shows "seq_compact S" -proof (unfold seq_compact_def, clarify) + unfolding seq_compact_def +proof (intro strip) fix f :: "nat \ 'a" assume f: "\n. f n \ S" with \bounded S\ have "bounded (range f)" @@ -1675,63 +1631,61 @@ (* TODO: generalize to uniform spaces *) lemma compact_imp_complete: - fixes s :: "'a::metric_space set" - assumes "compact s" - shows "complete s" -proof - + fixes S :: "'a::metric_space set" + assumes "compact S" + shows "complete S" + unfolding complete_def +proof clarify + fix f + assume as: "(\n::nat. f n \ S)" "Cauchy f" + from as(1) obtain l r where lr: "l\S" "strict_mono r" "(f \ r) \ l" + using assms unfolding compact_def by blast + + note lr' = seq_suble [OF lr(2)] { - fix f - assume as: "(\n::nat. f n \ s)" "Cauchy f" - from as(1) obtain l r where lr: "l\s" "strict_mono r" "(f \ r) \ l" - using assms unfolding compact_def by blast - - note lr' = seq_suble [OF lr(2)] + fix e :: real + assume "e > 0" + from as(2) obtain N where N:"\m n. N \ m \ N \ n \ dist (f m) (f n) < e/2" + unfolding Cauchy_def using \e > 0\ by (meson half_gt_zero) + then obtain M where M:"\n\M. dist ((f \ r) n) l < e/2" + by (metis dist_self lim_sequentially lr(3)) { - fix e :: real - assume "e > 0" - from as(2) obtain N where N:"\m n. N \ m \ N \ n \ dist (f m) (f n) < e/2" - unfolding Cauchy_def using \e > 0\ by (meson half_gt_zero) - then obtain M where M:"\n\M. dist ((f \ r) n) l < e/2" - by (metis dist_self lim_sequentially lr(3)) - { - fix n :: nat - assume n: "n \ max N M" - have "dist ((f \ r) n) l < e/2" - using n M by auto - moreover have "r n \ N" - using lr'[of n] n by auto - then have "dist (f n) ((f \ r) n) < e/2" - using N and n by auto - ultimately have "dist (f n) l < e" using n M - by metric - } - then have "\N. \n\N. dist (f n) l < e" by blast + fix n :: nat + assume n: "n \ max N M" + have "dist ((f \ r) n) l < e/2" + using n M by auto + moreover have "r n \ N" + using lr'[of n] n by auto + then have "dist (f n) ((f \ r) n) < e/2" + using N and n by auto + ultimately have "dist (f n) l < e" using n M + by metric } - then have "\l\s. (f \ l) sequentially" using \l\s\ - unfolding lim_sequentially by auto + then have "\N. \n\N. dist (f n) l < e" by blast } - then show ?thesis unfolding complete_def by auto + then show "\l\S. (f \ l) sequentially" using \l\S\ + unfolding lim_sequentially by auto qed proposition compact_eq_totally_bounded: - "compact s \ complete s \ (\e>0. \k. finite k \ s \ (\x\k. ball x e))" + "compact S \ complete S \ (\e>0. \k. finite k \ S \ (\x\k. ball x e))" (is "_ \ ?rhs") proof assume assms: "?rhs" - then obtain k where k: "\e. 0 < e \ finite (k e)" "\e. 0 < e \ s \ (\x\k e. ball x e)" + then obtain k where k: "\e. 0 < e \ finite (k e)" "\e. 0 < e \ S \ (\x\k e. ball x e)" by (auto simp: choice_iff') - show "compact s" + show "compact S" proof cases - assume "s = {}" - then show "compact s" by (simp add: compact_def) + assume "S = {}" + then show "compact S" by (simp add: compact_def) next - assume "s \ {}" + assume "S \ {}" show ?thesis unfolding compact_def proof safe fix f :: "nat \ 'a" - assume f: "\n. f n \ s" + assume f: "\n. f n \ S" define e where "e n = 1 / (2 * Suc n)" for n then have [simp]: "\n. 0 < e n" by auto @@ -1776,7 +1730,7 @@ define t where "t = rec_nat (sel 0 0) (\n i. sel (Suc n) i)" have "strict_mono t" unfolding strict_mono_Suc_iff by (simp add: t_def sel) - moreover have "\i. (f \ t) i \ s" + moreover have "\i. (f \ t) i \ S" using f by auto moreover have t: "(f \ t) n \ F n" for n @@ -1794,29 +1748,28 @@ by metric qed - ultimately show "\l\s. \r. strict_mono r \ (f \ r) \ l" + ultimately show "\l\S. \r. strict_mono r \ (f \ r) \ l" using assms unfolding complete_def by blast qed qed qed (metis compact_imp_complete compact_imp_seq_compact seq_compact_imp_totally_bounded) lemma cauchy_imp_bounded: - assumes "Cauchy s" - shows "bounded (range s)" + assumes "Cauchy S" + shows "bounded (range S)" proof - - from assms obtain N :: nat where "\m n. N \ m \ N \ n \ dist (s m) (s n) < 1" + from assms obtain N :: nat where "\m n. N \ m \ N \ n \ dist (S m) (S n) < 1" by (meson Cauchy_def zero_less_one) - then have N:"\n. N \ n \ dist (s N) (s n) < 1" by auto + then have N:"\n. N \ n \ dist (S N) (S n) < 1" by auto moreover - have "bounded (s ` {0..N})" - using finite_imp_bounded[of "s ` {1..N}"] by auto - then obtain a where a:"\x\s ` {0..N}. dist (s N) x \ a" - unfolding bounded_any_center [where a="s N"] by auto + have "bounded (S ` {0..N})" + using finite_imp_bounded[of "S ` {1..N}"] by auto + then obtain a where a:"\x\S ` {0..N}. dist (S N) x \ a" + unfolding bounded_any_center [where a="S N"] by auto ultimately show "?thesis" - unfolding bounded_any_center [where a="s N"] - apply (rule_tac x="max a 1" in exI, auto) - apply (erule_tac x=y in allE) - apply (erule_tac x=y in ballE, auto) + unfolding bounded_any_center [where a="S N"] + apply (intro exI [where x="max a 1"]) + apply (force simp: le_max_iff_disj less_le_not_le) done qed @@ -1829,11 +1782,7 @@ qed lemma complete_UNIV: "complete (UNIV :: ('a::complete_space) set)" -proof (rule completeI) - fix f :: "nat \ 'a" assume "Cauchy f" - then show "\l\UNIV. f \ l" - using Cauchy_convergent convergent_def by blast -qed + by (meson Cauchy_convergent UNIV_I completeI convergent_def) lemma complete_imp_closed: fixes S :: "'a::metric_space set" @@ -1884,7 +1833,7 @@ assumes c:"0 \ c" "c < 1" and lipschitz:"\x. \y. dist (f x) (f y) \ c * dist x y" shows "\!x. (f x = x)" - using assms banach_fix[OF complete_UNIV UNIV_not_empty assms(1,2) subset_UNIV, of f] + using assms Banach_fix[OF complete_UNIV UNIV_not_empty c subset_UNIV, of f] by auto section \Cauchy continuity\ @@ -1978,8 +1927,7 @@ fixes S :: "'a::heine_borel set" shows "\closed S; \T. T \ \ \ compact T; - \\'. \finite \'; \' \ \\ \ S \ \\' \ {}\ - \ S \ \\ \ {}" + \\'. \finite \'; \' \ \\ \ S \ \\' \ {}\ \ S \ \\ \ {}" by (metis closed_imp_fip compact_eq_bounded_closed equals0I finite.emptyI order.refl) lemma closed_fip_Heine_Borel: @@ -2042,34 +1990,29 @@ section \Distance from a Set\ lemma distance_attains_sup: - assumes "compact s" "s \ {}" - shows "\x\s. \y\s. dist a y \ dist a x" + assumes "compact S" "S \ {}" + shows "\x\S. \y\S. dist a y \ dist a x" proof (rule continuous_attains_sup [OF assms]) - { - fix x - assume "x\s" - have "(dist a \ dist a x) (at x within s)" - by (intro tendsto_dist tendsto_const tendsto_ident_at) - } - then show "continuous_on s (dist a)" - unfolding continuous_on .. + show "continuous_on S (dist a)" + unfolding continuous_on + using Lim_at_imp_Lim_at_within continuous_at_dist isCont_def by blast qed text \For \emph{minimal} distance, we only need closure, not compactness.\ lemma distance_attains_inf: fixes a :: "'a::heine_borel" - assumes "closed s" and "s \ {}" - obtains x where "x\s" "\y. y \ s \ dist a x \ dist a y" + assumes "closed S" and "S \ {}" + obtains x where "x\S" "\y. y \ S \ dist a x \ dist a y" proof - - from assms obtain b where "b \ s" by auto - let ?B = "s \ cball a (dist b a)" - have "?B \ {}" using \b \ s\ + from assms obtain b where "b \ S" by auto + let ?B = "S \ cball a (dist b a)" + have "?B \ {}" using \b \ S\ by (auto simp: dist_commute) moreover have "continuous_on ?B (dist a)" by (auto intro!: continuous_at_imp_continuous_on continuous_dist continuous_ident continuous_const) moreover have "compact ?B" - by (intro closed_Int_compact \closed s\ compact_cball) + by (intro closed_Int_compact \closed S\ compact_cball) ultimately obtain x where "x \ ?B" "\y\?B. dist a x \ dist a y" by (metis continuous_attains_inf) with that show ?thesis by fastforce @@ -2119,12 +2062,8 @@ then obtain a where d: "d = dist x y + dist y a" "a \ A" by auto show "infdist x A \ d" - unfolding infdist_notempty[OF \A \ {}\] - proof (rule cINF_lower2) - show "a \ A" by fact - show "dist x a \ d" - unfolding d by (rule dist_triangle) - qed simp + using infdist_notempty[OF \A \ {}\] + by (metis d dist_commute dist_triangle3 infdist_le2) qed also have "\ = dist x y + infdist y A" proof (rule cInf_eq, safe) @@ -2145,7 +2084,7 @@ qed lemma infdist_triangle_abs: "\infdist x A - infdist y A\ \ dist x y" - by (metis (full_types) abs_diff_le_iff diff_le_eq dist_commute infdist_triangle) + by (metis abs_diff_le_iff diff_le_eq dist_commute infdist_triangle) lemma in_closure_iff_infdist_zero: assumes "A \ {}" @@ -2158,7 +2097,7 @@ with infdist_nonneg[of x A] have "infdist x A > 0" by auto then have "ball x (infdist x A) \ closure A = {}" - by (smt (verit, best) \x \ closure A\ closure_approachableD infdist_le) + by (meson \x \ closure A\ closure_approachableD infdist_le linorder_not_le) then have "x \ closure A" by (metis \0 < infdist x A\ centre_in_ball disjoint_iff_not_equal) then show False using \x \ closure A\ by simp @@ -2181,16 +2120,12 @@ lemma in_closed_iff_infdist_zero: assumes "closed A" "A \ {}" shows "x \ A \ infdist x A = 0" -proof - - have "x \ closure A \ infdist x A = 0" - by (simp add: \A \ {}\ in_closure_iff_infdist_zero) - with assms show ?thesis by simp -qed + by (metis assms closure_closed in_closure_iff_infdist_zero) lemma infdist_pos_not_in_closed: assumes "closed S" "S \ {}" "x \ S" shows "infdist x S > 0" - by (smt (verit, best) assms in_closed_iff_infdist_zero infdist_nonneg) + by (meson assms dual_order.order_iff_strict in_closed_iff_infdist_zero infdist_nonneg) lemma infdist_attains_inf: @@ -2426,8 +2361,9 @@ assume "e > 0" then obtain N :: nat where "N \ 0" and N: "0 < inverse (real N) \ inverse (real N) < e" unfolding real_arch_inverse[of e] by auto - then have "\N. \n\N. dist (x n) (y n) < e" - by (smt (verit, ccfv_SIG) inverse_le_imp_le nat_le_real_less of_nat_le_0_iff xy0) + with xy0 have "\N. \n\N. dist (x n) (y n) < e" + by (metis order.strict_trans inverse_positive_iff_positive less_imp_inverse_less + nat_le_real_less) } then have "\e>0. \N. \n\N. dist (f (x n)) (f (y n)) < e" using \?rhs\[THEN spec[where x=x], THEN spec[where x=y]] and xyn @@ -2461,8 +2397,7 @@ then obtain e where "0 < e" and e: "\z. dist z l < e \ z \ G" using opn open_dist by blast obtain N1 where N1: "\n. n \ N1 \ dist (f (r n)) l < e/2" - using to_l apply (simp add: lim_sequentially) - using \0 < e\ half_gt_zero that by blast + by (metis \0 < e\ half_gt_zero lim_sequentially o_apply to_l) obtain N2 where N2: "of_nat N2 > 2/e" using reals_Archimedean2 by blast obtain x where "x \ ball (f (r (max N1 N2))) (1 / real (Suc (r (max N1 N2))))" and "x \ G" @@ -2641,7 +2576,7 @@ by atomize_elim (simp only: convergent_eq_Cauchy) have "(f \ l) (at x within X)" - proof (safe intro!: Lim_within_LIMSEQ) + proof (clarify intro!: Lim_within_LIMSEQ) fix xs' assume "\n. xs' n \ x \ xs' n \ X" and xs': "xs' \ x" @@ -2772,7 +2707,7 @@ fixes f :: "'a :: heine_borel \ 'b :: heine_borel" assumes "uniformly_continuous_on S f" "bounded S" shows "bounded(f ` S)" - by (metis (no_types, lifting) assms bounded_closure_image compact_closure compact_continuous_image compact_eq_bounded_closed image_cong uniformly_continuous_imp_continuous uniformly_continuous_on_extension_on_closure) + by (metis (no_types) assms bounded_closure_image compact_closure compact_continuous_image compact_eq_bounded_closed image_cong uniformly_continuous_imp_continuous uniformly_continuous_on_extension_on_closure) section \With Abstract Topology (TODO: move and remove dependency?)\ @@ -2794,16 +2729,8 @@ lemma openin_contains_cball: "openin (top_of_set T) S \ S \ T \ (\x \ S. \e. 0 < e \ cball x e \ T \ S)" - (is "?lhs = ?rhs") -proof - assume ?lhs - then show ?rhs - by (force simp add: openin_contains_ball intro: exI [where x="_/2"]) -next - assume ?rhs - then show ?lhs - by (force simp add: openin_contains_ball) -qed + by (fastforce simp: openin_contains_ball intro: exI [where x="_/2"]) + section \Closed Nest\ @@ -2854,41 +2781,40 @@ proof - obtain t where t: "\n. t n \ S n" by (meson assms(2) equals0I) - { - fix e :: real - assume "e > 0" - then obtain N where N: "\x\S N. \y\S N. dist x y < e" + have "Cauchy t" + proof (intro metric_CauchyI) + fix \ :: real + assume "\ > 0" + then obtain N where N: "\x\S N. \y\S N. dist x y < \" using assms(4) by blast { fix m n :: nat assume "N \ m \ N \ n" then have "t m \ S N" "t n \ S N" using assms(3) t unfolding subset_eq t by blast+ - then have "dist (t m) (t n) < e" + then have "dist (t m) (t n) < \" using N by auto } - then have "\N. \m n. N \ m \ N \ n \ dist (t m) (t n) < e" + then show "\M. \m\M. \n\M. dist (t m) (t n) < \" by auto - } - then have "Cauchy t" - by (metis metric_CauchyI) + qed then obtain l where l:"(t \ l) sequentially" using complete_UNIV unfolding complete_def by auto - { fix n :: nat - { fix e :: real - assume "e > 0" - then obtain N :: nat where N: "\n\N. dist (t n) l < e" + show thesis + proof + fix n :: nat + { fix \ :: real + assume "\ > 0" + then obtain N :: nat where N: "\n\N. dist (t n) l < \" using l[unfolded lim_sequentially] by auto have "t (max n N) \ S n" by (meson assms(3) contra_subsetD max.cobounded1 t) - then have "\y\S n. dist y l < e" + then have "\y\S n. dist y l < \" using N max.cobounded2 by blast } - then have "l \ S n" + then show "l \ S n" using closed_approachable[of "S n" l] assms(1) by auto - } - then show ?thesis - using that by blast + qed qed text \Strengthen it to the intersection actually being a singleton.\ @@ -2898,20 +2824,15 @@ assumes "\n. closed(S n)" "\n. S n \ {}" "\m n. m \ n \ S n \ S m" - "\e. e>0 \ \n. \x \ (S n). \ y\(S n). dist x y < e" + and \
: "\\. \>0 \ \n. \x \ (S n). \ y\(S n). dist x y < \" shows "\a. \(range S) = {a}" proof - obtain a where a: "\n. a \ S n" using decreasing_closed_nest[of S] using assms by auto { fix b assume b: "b \ \(range S)" - { fix e :: real - assume "e > 0" - then have "dist a b < e" - using assms(4) and b and a by blast - } then have "dist a b = 0" - by (metis dist_eq_0_iff dist_nz less_le) + by (meson InterE a \
linorder_neq_iff linorder_not_less range_eqI zero_le_dist) } with a have "\(range S) = {a}" unfolding image_def by auto @@ -2922,18 +2843,18 @@ lemma continuous_within_avoid: fixes f :: "'a::metric_space \ 'b::t1_space" - assumes "continuous (at x within s) f" + assumes "continuous (at x within S) f" and "f x \ a" - shows "\e>0. \y \ s. dist x y < e --> f y \ a" + shows "\e>0. \y \ S. dist x y < e --> f y \ a" proof - obtain U where "open U" and "f x \ U" and "a \ U" using t1_space [OF \f x \ a\] by fast - have "(f \ f x) (at x within s)" + have "(f \ f x) (at x within S)" using assms(1) by (simp add: continuous_within) - then have "eventually (\y. f y \ U) (at x within s)" + then have "eventually (\y. f y \ U) (at x within S)" using \open U\ and \f x \ U\ unfolding tendsto_def by fast - then have "eventually (\y. f y \ a) (at x within s)" + then have "eventually (\y. f y \ a) (at x within S)" using \a \ U\ by (fast elim: eventually_mono) then show ?thesis using \f x \ a\ by (auto simp: dist_commute eventually_at) @@ -2948,25 +2869,22 @@ lemma continuous_on_avoid: fixes f :: "'a::metric_space \ 'b::t1_space" - assumes "continuous_on s f" - and "x \ s" + assumes "continuous_on S f" + and "x \ S" and "f x \ a" - shows "\e>0. \y \ s. dist x y < e \ f y \ a" - using assms(1)[unfolded continuous_on_eq_continuous_within, THEN bspec[where x=x], - OF assms(2)] continuous_within_avoid[of x s f a] - using assms(3) - by auto + shows "\e>0. \y \ S. dist x y < e \ f y \ a" + using continuous_within_avoid[of x S f a] assms + by (meson continuous_on_eq_continuous_within) lemma continuous_on_open_avoid: fixes f :: "'a::metric_space \ 'b::t1_space" - assumes "continuous_on s f" - and "open s" - and "x \ s" + assumes "continuous_on S f" + and "open S" + and "x \ S" and "f x \ a" shows "\e>0. \y. dist x y < e \ f y \ a" - using assms(1)[unfolded continuous_on_eq_continuous_at[OF assms(2)], THEN bspec[where x=x], OF assms(3)] - using continuous_at_avoid[of x f a] assms(4) - by auto + using continuous_at_avoid[of x f a] assms + by (meson continuous_on_eq_continuous_at) section \Consequences for Real Numbers\ @@ -3000,12 +2918,10 @@ by (simp add: bounded_iff) lemma bounded_imp_bdd_above: "bounded S \ bdd_above (S :: real set)" - by (auto simp: bounded_def bdd_above_def dist_real_def) - (metis abs_le_D1 abs_minus_commute diff_le_eq) + by (meson abs_le_D1 bdd_above.unfold bounded_real) lemma bounded_imp_bdd_below: "bounded S \ bdd_below (S :: real set)" - by (auto simp: bounded_def bdd_below_def dist_real_def) - (metis abs_le_D1 add.commute diff_le_eq) + by (metis add.commute abs_le_D1 bdd_below.unfold bounded_def diff_le_eq dist_real_def) lemma bounded_norm_le_SUP_norm: "bounded (range f) \ norm (f x) \ (SUP x. norm (f x))" @@ -3136,9 +3052,9 @@ lemma setdist_ltE: assumes "setdist S T < b" "S \ {}" "T \ {}" - obtains x y where "x \ S" "y \ T" "dist x y < b" -using assms -by (auto simp: not_le [symmetric] le_setdist_iff) + obtains x y where "x \ S" "y \ T" "dist x y < b" + using assms + by (auto simp: not_le [symmetric] le_setdist_iff) lemma setdist_refl: "setdist S S = 0" by (metis dist_eq_0_iff ex_in_conv order_antisym setdist_def setdist_le_dist setdist_pos_le) @@ -3153,7 +3069,6 @@ next case False then have "\x. x \ S \ setdist S T - dist x a \ setdist {a} T" - using dist_self dist_triangle3 empty_not_insert le_setdist_iff setdist_le_dist singleton_iff by (smt (verit, best) dist_self dist_triangle3 empty_not_insert le_setdist_iff setdist_le_dist singleton_iff) then have "setdist S T - setdist {a} T \ setdist S {a}" using False by (fastforce intro: le_setdistI) @@ -3165,7 +3080,7 @@ by (simp add: setdist_def) lemma setdist_Lipschitz: "\setdist {x} S - setdist {y} S\ \ dist x y" - apply (subst setdist_singletons [symmetric]) + unfolding setdist_singletons [symmetric] by (metis abs_diff_le_iff diff_le_eq setdist_triangle setdist_sym) lemma continuous_at_setdist [continuous_intros]: "continuous (at x) (\y. (setdist {y} S))" @@ -3208,7 +3123,7 @@ lemma setdist_unique: "\a \ S; b \ T; \x y. x \ S \ y \ T ==> dist a b \ dist x y\ \ setdist S T = dist a b" - by (force simp add: setdist_le_dist le_setdist_iff intro: antisym) + by (force simp: setdist_le_dist le_setdist_iff intro: antisym) lemma setdist_le_sing: "x \ S ==> setdist S T \ setdist {x} T" using setdist_subset_left by auto