# HG changeset patch # User paulson # Date 1725033621 -3600 # Node ID 1cbdba868710e27d245f7e075e65a0c6e9e558cd # Parent f38e59e1c019ac3ba54e95a55341d2cff55a2680 A bit of tidying diff -r f38e59e1c019 -r 1cbdba868710 src/HOL/Analysis/Abstract_Metric_Spaces.thy --- a/src/HOL/Analysis/Abstract_Metric_Spaces.thy Fri Aug 30 10:44:48 2024 +0100 +++ b/src/HOL/Analysis/Abstract_Metric_Spaces.thy Fri Aug 30 17:00:21 2024 +0100 @@ -266,9 +266,7 @@ have "\x B. S \ mcball x B \ \x\S. \y\S. d x y \ 2 * B" by (smt (verit, best) commute in_mcball subsetD triangle) then show ?thesis - apply (auto simp: mbounded_def subset_iff) - apply blast+ - done + unfolding mbounded_def by (metis in_mcball in_mono subsetI) qed @@ -659,7 +657,7 @@ lemma metrizable_imp_first_countable: "metrizable_space X \ first_countable X" - by (force simp add: metrizable_space_def Metric_space.first_countable_mtopology) + by (force simp: metrizable_space_def Metric_space.first_countable_mtopology) lemma openin_mtopology_eq_open [simp]: "openin Met_TC.mtopology = open" by (simp add: Met_TC.mtopology_def) @@ -819,9 +817,8 @@ by (metis \
that not0_implies_Suc order_less_le order_less_le_trans real_arch_inverse) have "closedin M.mtopology S" using S by (simp add: Xeq) - then show ?thesis - apply (simp add: M.closedin_metric) - by (metis * \x \ M\ M.in_mball disjnt_insert1 insert_absorb subsetD) + with * \x \ M\ show ?thesis + by (force simp: M.closedin_metric disjnt_iff) qed ultimately have Seq: "S = \(range (\n. {x\M. \y\S. d x y < inverse(Suc n)}))" using \S \ M\ by force @@ -834,10 +831,10 @@ with dxy show "\r>0. M.mball x r \ {z \ M. \y\S. d z y < inverse (1 + real n)}" by (rule_tac x="inverse(Suc n) - d x y" in exI) auto qed - then show ?thesis - apply (subst Seq) - apply (force simp: Xeq intro: gdelta_in_Inter open_imp_gdelta_in) - done + then have "gdelta_in X (\(range (\n. {x\M. \y\S. d x y < inverse(Suc n)})))" + by (force simp: Xeq intro: gdelta_in_Inter open_imp_gdelta_in) + with Seq show ?thesis + by presburger qed qed @@ -1145,8 +1142,7 @@ using cau \\ > 0\ by (fastforce simp: MCauchy_def) then show "\N. \n n'. N \ n \ N \ n' \ d (\ n) (\ n') < \" unfolding o_def - apply (rule_tac x="k+N" in exI) - by (smt (verit, del_insts) add.assoc le_add1 less_eqE) + by (intro exI [where x="k+N"]) (smt (verit, del_insts) add.assoc le_add1 less_eqE) qed lemma MCauchy_convergent_subsequence: @@ -1715,9 +1711,8 @@ then obtain x where x: "limitin SA.sub.mtopology \ x sequentially" by (metis A SA.sub.MCauchy_def SA.sub.mcomplete_alt MCauchy_def \range \ \ A\) show "\x. limitin MS.sub.mtopology \ x sequentially" - apply (rule_tac x="x" in exI) unfolding MS.limitin_submetric_iff - proof (intro conjI) + proof (intro exI conjI) show "x \ \ \" proof clarsimp fix U @@ -2740,8 +2735,8 @@ fix U assume "openin M'.mtopology U" then show "openin mtopology {x \ topspace mtopology. f x \ U}" - apply (simp add: continuous_map_def openin_mtopology M'.openin_mtopology subset_iff) - by (metis R image_subset_iff) + using R + by (force simp: continuous_map_def openin_mtopology M'.openin_mtopology subset_iff) qed (use R in auto) qed qed @@ -2882,7 +2877,7 @@ with x have "limitin MY.mtopology (f \ (g \ \)) (f x) sequentially" by (metis Xeq Yeq continuous_map_limit hmf homeomorphic_imp_continuous_map) moreover have "f \ (g \ \) = \" - using \MY.MCauchy \\ by (force simp add: fg MY.MCauchy_def subset_iff) + using \MY.MCauchy \\ by (force simp: fg MY.MCauchy_def subset_iff) ultimately have "limitin MY.mtopology \ (f x) sequentially" by simp then show "\y. limitin MY.mtopology \ y sequentially" by blast @@ -2951,7 +2946,7 @@ text \For easy reference to theorems outside of the locale\ lemma Metric_space12_mspace_mdist: "Metric_space12 (mspace m1) (mdist m1) (mspace m2) (mdist m2)" - by (simp add: Metric_space12_def Metric_space_mspace_mdist) + by (simp add: Metric_space12_def) definition prod_metric where "prod_metric \ \m1 m2. metric (mspace m1 \ mspace m2, prod_dist (mdist m1) (mdist m2))" @@ -2959,7 +2954,7 @@ lemma submetric_prod_metric: "submetric (prod_metric m1 m2) (S \ T) = prod_metric (submetric m1 S) (submetric m2 T)" apply (simp add: prod_metric_def) - by (simp add: submetric_def Metric_space.mspace_metric Metric_space.mdist_metric Metric_space12.prod_metric Metric_space12_def Metric_space_mspace_mdist Times_Int_Times) + by (simp add: submetric_def Metric_space.mspace_metric Metric_space.mdist_metric Metric_space12.prod_metric Metric_space12_def Times_Int_Times) lemma mspace_prod_metric [simp]:" mspace (prod_metric m1 m2) = mspace m1 \ mspace m2" @@ -3054,7 +3049,7 @@ moreover have "(x,y) \ B1 \ B2" using \r > 0\ by (simp add: \x \ M1\ \y \ M2\ B1_def B2_def) moreover have "B1 \ B2 \ U" - using r prod_metric_le_components by (force simp add: B1_def B2_def) + using r prod_metric_le_components by (force simp: B1_def B2_def) ultimately show "\B. B \ {S \ T |S T. openin M1.mtopology S \ openin M2.mtopology T} \ z \ B \ B \ U" by (auto simp: zeq) qed @@ -3213,7 +3208,7 @@ then have "M1.MCauchy (fst \ (\n. (\ n,y)) \ r)" by (simp add: MCauchy_prod_metric o_def) with \strict_mono r\ show "\r. strict_mono r \ M1.MCauchy (\ \ r)" - by (auto simp add: o_def) + by (auto simp: o_def) qed moreover have "M2.mtotally_bounded T" if L: ?lhs @@ -3229,7 +3224,7 @@ then have "M2.MCauchy (snd \ (\n. (x,\ n)) \ r)" by (simp add: MCauchy_prod_metric o_def) with \strict_mono r\ show "\r. strict_mono r \ M2.MCauchy (\ \ r)" - by (auto simp add: o_def) + by (auto simp: o_def) qed moreover have ?lhs if 1: "M1.mtotally_bounded S" and 2: "M2.mtotally_bounded T" unfolding Prod_metric.mtotally_bounded_sequentially @@ -3240,8 +3235,7 @@ fix \ :: "nat \ 'a \ 'b" assume \: "range \ \ S \ T" with 1 obtain r1 where r1: "strict_mono r1" "M1.MCauchy (fst \ \ \ r1)" - apply (clarsimp simp: M1.mtotally_bounded_sequentially image_subset_iff) - by (metis SigmaE comp_eq_dest_lhs fst_conv) + by (metis M1.mtotally_bounded_sequentially comp_apply image_subset_iff mem_Sigma_iff prod.collapse) from \ 2 obtain r2 where r2: "strict_mono r2" "M2.MCauchy (snd \ \ \ r1 \ r2)" apply (clarsimp simp: M2.mtotally_bounded_sequentially image_subset_iff) by (smt (verit, best) comp_apply mem_Sigma_iff prod.collapse) @@ -3738,7 +3732,7 @@ (\B>0. \x \ mspace m1. \y \ mspace m1. mdist m2 (f x) (f y) \ B * mdist m1 x y)" proof - have "B * mdist m1 x y \ (\B\ + 1) * mdist m1 x y" "\B\ + 1 > 0" for x y B - by (auto simp add: mult_right_mono) + by (auto simp: mult_right_mono) then show ?thesis unfolding Lipschitz_continuous_map_def by (meson dual_order.trans) qed @@ -3818,7 +3812,7 @@ and "(\n. mdist m1 (\ n) (\ n)) \ 0" and "range \ \ mspace m1" "range \ \ mspace m1" shows "(\n. mdist m2 (f (\ n)) (f (\ n))) \ 0" - using assms + using assms unfolding uniformly_continuous_map_def image_subset_iff tendsto_iff apply clarsimp by (metis (mono_tags, lifting) eventually_sequentially) @@ -3936,7 +3930,7 @@ lemma uniformly_continuous_map_euclidean [simp]: "uniformly_continuous_map (submetric euclidean_metric S) euclidean_metric f = uniformly_continuous_on S f" - by (auto simp add: uniformly_continuous_map_def uniformly_continuous_on_def) + by (auto simp: uniformly_continuous_map_def uniformly_continuous_on_def) subsubsection \Cauchy continuity\ @@ -3948,7 +3942,7 @@ lemma Cauchy_continuous_map_euclidean [simp]: "Cauchy_continuous_map (submetric euclidean_metric S) euclidean_metric f = Cauchy_continuous_on S f" - by (auto simp add: Cauchy_continuous_map_def Cauchy_continuous_on_def Cauchy_def Met_TC.subspace Metric_space.MCauchy_def) + by (auto simp: Cauchy_continuous_map_def Cauchy_continuous_on_def Cauchy_def Met_TC.subspace Metric_space.MCauchy_def) lemma Cauchy_continuous_map_funspace: assumes "Cauchy_continuous_map m1 m2 f" @@ -4024,7 +4018,7 @@ proof - obtain B where "\x\mspace m1. \y\mspace m1. mdist m2 (f x) (f y) \ B * mdist m1 x y" and "B>0" - using that assms by (force simp add: Lipschitz_continuous_map_pos) + using that assms by (force simp: Lipschitz_continuous_map_pos) then have "\x\mspace m1. \y\mspace m1. mdist m1 y x < \/B \ mdist m2 (f y) (f x) < \" by (smt (verit, ccfv_SIG) less_divide_eq mdist_nonneg mult.commute that zero_less_divide_iff) with \B>0\ show ?thesis @@ -4099,7 +4093,7 @@ fix \ assume "range \ \ M1 - {x} \ limitin M1.mtopology \ x sequentially" then have "M1.MCauchy (\n. if even n then \ (n div 2) else x)" - by (force simp add: M1.MCauchy_interleaving) + by (force simp: M1.MCauchy_interleaving) then have "M2.MCauchy (f \ (\n. if even n then \ (n div 2) else x))" using assms by (simp add: Cauchy_continuous_map_def) then show "limitin M2.mtopology (f \ \) (f x) sequentially" @@ -4132,14 +4126,14 @@ assumes "Cauchy_continuous_map m1 m2 f" shows "continuous_map (mtopology_of m1) (mtopology_of m2) f" using assms Metric_space12.Cauchy_continuous_imp_continuous_map [OF Metric_space12_mspace_mdist] - by (auto simp add: mtopology_of_def) + by (auto simp: mtopology_of_def) lemma continuous_imp_Cauchy_continuous_map: assumes "Metric_space.mcomplete (mspace m1) (mdist m1)" and "continuous_map (mtopology_of m1) (mtopology_of m2) f" shows "Cauchy_continuous_map m1 m2 f" using assms Metric_space12.continuous_imp_Cauchy_continuous_map [OF Metric_space12_mspace_mdist] - by (auto simp add: mtopology_of_def) + by (auto simp: mtopology_of_def) lemma uniformly_continuous_imp_continuous_map: "uniformly_continuous_map m1 m2 f @@ -4402,7 +4396,7 @@ \ \mdist m x y - mdist m x' y'\ \ 2 * sqrt ((mdist m x x')\<^sup>2 + (mdist m y y')\<^sup>2)" by (smt (verit, del_insts) mdist_commute mdist_triangle real_sqrt_sum_squares_ge2) then show ?thesis - by (fastforce simp add: Lipschitz_continuous_map_def prod_dist_def dist_real_def) + by (fastforce simp: Lipschitz_continuous_map_def prod_dist_def dist_real_def) qed lemma Lipschitz_continuous_map_mdist: @@ -4574,13 +4568,12 @@ lemma capped_metric_mspace [simp]: "mspace (capped_metric \ m) = mspace m" - apply (simp add: capped_metric not_le) - by (smt (verit, ccfv_threshold) Metric_space.mspace_metric Metric_space_def Metric_space_mspace_mdist) + by (simp add: Metric_space.capped_dist Metric_space.mspace_metric capped_metric_def) lemma capped_metric_mdist: "mdist (capped_metric \ m) = (\x y. if \ \ 0 then mdist m x y else min \ (mdist m x y))" - apply (simp add: capped_metric not_le) - by (smt (verit, del_insts) Metric_space.mdist_metric Metric_space_def Metric_space_mspace_mdist) + by (metis Metric_space.capped_dist Metric_space.capped_dist_def Metric_space.mdist_metric + Metric_space_mspace_mdist capped_metric capped_metric_def leI) lemma mdist_capped_le: "mdist (capped_metric \ m) x y \ mdist m x y" by (simp add: capped_metric_mdist) @@ -4593,7 +4586,7 @@ shows "mball_of (capped_metric \ m) x r = mspace m" proof - interpret Metric_space "mspace m" "mdist m" - by (simp add: Metric_space_mspace_mdist) + by auto have "Metric_space.mball (mspace m) (mdist (capped_metric \ m)) x r \ mspace m" by (metis Metric_space.mball_subset_mspace Metric_space_mspace_mdist capped_metric_mspace) moreover have "mspace m \ Metric_space.mball (mspace m) (mdist (capped_metric \ m)) x r" @@ -4710,9 +4703,8 @@ proof fix x y show D0: "0 \ D x y" - using bdd - apply (simp add: D_def) - by (meson \I \ {}\ cSUP_upper dual_order.trans ex_in_conv mdist_nonneg) + using bdd \I \ {}\ + by (metis D_def D_iff Orderings.order_eq_iff dual_order.trans ex_in_conv mdist_nonneg) show "D x y = D y x" by (simp add: D_def mdist_commute) assume "x \ S" and "y \ S"