# HG changeset patch # User paulson # Date 1687786706 -3600 # Node ID b0ad3aba48f1fed35635054ccf96935998e1d4b4 # Parent d6e6618db92965b7875c05251103e2a83425e871# Parent 264f2b69d09ce1637d6c188e79013ecd745b84f3 merged diff -r d6e6618db929 -r b0ad3aba48f1 src/HOL/Analysis/Abstract_Metric_Spaces.thy --- a/src/HOL/Analysis/Abstract_Metric_Spaces.thy Mon Jun 26 13:22:50 2023 +0200 +++ b/src/HOL/Analysis/Abstract_Metric_Spaces.thy Mon Jun 26 14:38:26 2023 +0100 @@ -144,21 +144,6 @@ by (auto simp: openin_mtopology) qed -lemma mcball_eq_cball [simp]: "Met_TC.mcball = cball" - by force - -lemma mball_eq_ball [simp]: "Met_TC.mball = ball" - by force - -lemma mopen_eq_open [simp]: "Met_TC.mopen = open" - by (force simp: open_contains_ball Met_TC.mopen_def) - -lemma limitin_iff_tendsto [iff]: "limitin Met_TC.mtopology \ x F = tendsto \ x F" - by (simp add: Met_TC.mtopology_def) - -lemma mtopology_is_euclideanreal [simp]: "Met_TC.mtopology = euclideanreal" - by (simp add: Met_TC.mtopology_def) - (* lemma metric_injective_image: "\f m s. @@ -419,7 +404,26 @@ qed auto qed -end + +end (*Metric_space*) + +lemma mcball_eq_cball [simp]: "Met_TC.mcball = cball" + by force + +lemma mball_eq_ball [simp]: "Met_TC.mball = ball" + by force + +lemma mopen_eq_open [simp]: "Met_TC.mopen = open" + by (force simp: open_contains_ball Met_TC.mopen_def) + +lemma limitin_iff_tendsto [iff]: "limitin Met_TC.mtopology \ x F = tendsto \ x F" + by (simp add: Met_TC.mtopology_def) + +lemma mtopology_is_euclidean [simp]: "Met_TC.mtopology = euclidean" + by (simp add: Met_TC.mtopology_def) + +lemma mbounded_iff_bounded [iff]: "Met_TC.mbounded A \ bounded A" + by (metis Met_TC.mbounded UNIV_I all_not_in_conv bounded_def) subsection\Subspace of a metric space\ @@ -472,7 +476,6 @@ subsection \Abstract type of metric spaces\ - typedef 'a metric = "{(M::'a set,d). Metric_space M d}" morphisms "dest_metric" "metric" proof - @@ -486,7 +489,7 @@ definition mdist where "mdist m \ snd (dest_metric m)" -lemma Metric_space_mspace_mdist: "Metric_space (mspace m) (mdist m)" +lemma Metric_space_mspace_mdist [iff]: "Metric_space (mspace m) (mdist m)" by (metis Product_Type.Collect_case_prodD dest_metric mdist_def mspace_def) lemma mdist_nonneg [simp]: "\x y. 0 \ mdist m x y" @@ -524,12 +527,18 @@ definition "mball_of \ \m. Metric_space.mball (mspace m) (mdist m)" +lemma in_mball_of [simp]: "y \ mball_of m x r \ x \ mspace m \ y \ mspace m \ mdist m x y < r" + by (simp add: Metric_space.in_mball mball_of_def) + lemma (in Metric_space) mball_of [simp]: "mball_of (metric (M,d)) = mball" by (simp add: mball_of_def) definition "mcball_of \ \m. Metric_space.mcball (mspace m) (mdist m)" +lemma in_mcball_of [simp]: "y \ mcball_of m x r \ x \ mspace m \ y \ mspace m \ mdist m x y \ r" + by (simp add: Metric_space.in_mcball mcball_of_def) + lemma (in Metric_space) mcball_of [simp]: "mcball_of (metric (M,d)) = mcball" by (simp add: mcball_of_def) @@ -545,6 +554,15 @@ lemma mtopology_of_euclidean [simp]: "mtopology_of euclidean_metric = euclidean" by (simp add: Met_TC.mtopology_def mtopology_of_def) +text \Allows reference to the current metric space within the locale as a value\ +definition (in Metric_space) "Self \ metric (M,d)" + +lemma (in Metric_space) mspace_Self [simp]: "mspace Self = M" + by (simp add: Self_def) + +lemma (in Metric_space) mdist_Self [simp]: "mdist Self = d" + by (simp add: Self_def) + text\ Subspace of a metric space\ definition submetric where @@ -822,12 +840,6 @@ "\metrizable_space X; openin X S\ \ fsigma_in X S" by (meson closed_imp_gdelta_in fsigma_in_gdelta_in openin_closedin openin_subset) -lemma mball_eq_ball [simp]: "Met_TC.mball = ball" - by force - -lemma mopen_eq_open [simp]: "Met_TC.mopen = open" - by (force simp: open_contains_ball Met_TC.mopen_def) - lemma metrizable_space_euclidean: "metrizable_space (euclidean :: 'a::metric_space topology)" unfolding metrizable_space_def @@ -1551,6 +1563,23 @@ end +definition mcomplete_of :: "'a metric \ bool" + where "mcomplete_of \ \m. Metric_space.mcomplete (mspace m) (mdist m)" + +lemma (in Metric_space) mcomplete_of [simp]: "mcomplete_of (metric (M,d)) = mcomplete" + by (simp add: mcomplete_of_def) + +lemma mcomplete_trivial: "Metric_space.mcomplete {} (\x y. 0)" + using Metric_space.intro Metric_space.mcomplete_empty_mspace by force + +lemma mcomplete_trivial_singleton: "Metric_space.mcomplete {\x. a} (\x y. 0)" +proof - + interpret Metric_space "{\x. a}" "\x y. 0" + by unfold_locales auto + show ?thesis + unfolding mcomplete_def MCauchy_def image_subset_iff by (metis UNIV_I limit_metric_sequentially) +qed + lemma MCauchy_iff_Cauchy [iff]: "Met_TC.MCauchy = Cauchy" by (force simp: Cauchy_def Met_TC.MCauchy_def) @@ -1558,9 +1587,6 @@ "Met_TC.mcomplete (Pure.type ::'a::metric_space itself) \ complete (UNIV::'a set)" by (auto simp: Met_TC.mcomplete_def complete_def) -lemma euclidean_metric: "Met_TC.mcomplete (Pure.type ::'a::euclidean_space itself)" - using complete_UNIV mcomplete_iff_complete by blast - context Submetric begin @@ -1593,7 +1619,6 @@ end - context Metric_space begin @@ -2745,9 +2770,9 @@ unfolding completely_metrizable_space_def by (metis discrete_metric.mcomplete_discrete_metric discrete_metric.mtopology_discrete_metric metric_M_dd) -lemma completely_metrizable_space_euclideanreal: - "completely_metrizable_space euclideanreal" - by (metis Met_TC.mtopology_is_euclideanreal Met_TC.completely_metrizable_space_mtopology euclidean_metric) +lemma completely_metrizable_space_euclidean: + "completely_metrizable_space (euclidean:: 'a::complete_space topology)" + using Met_TC.completely_metrizable_space_mtopology complete_UNIV by auto lemma completely_metrizable_space_closedin: assumes X: "completely_metrizable_space X" and S: "closedin X S" @@ -2772,6 +2797,9 @@ qed qed +lemma completely_metrizable_space_cbox: "completely_metrizable_space (top_of_set (cbox a b))" + using closed_closedin completely_metrizable_space_closedin completely_metrizable_space_euclidean by blast + lemma homeomorphic_completely_metrizable_space_aux: assumes homXY: "X homeomorphic_space Y" and X: "completely_metrizable_space X" shows "completely_metrizable_space Y" @@ -3364,6 +3392,14 @@ finally show ?thesis by (simp add: True) qed (simp add: atin_within_def) +lemma eventually_within_imp: + "eventually P (atin_within X a S) \ eventually (\x. x \ S \ P x) (atin X a)" + by (auto simp add: eventually_atin_within eventually_atin) + +lemma limit_within_subset: + "\limitin X f l (atin_within Y a S); T \ S\ \ limitin X f l (atin_within Y a T)" + by (smt (verit) eventually_atin_within limitin_def subset_eq) + lemma atin_subtopology_within: assumes "a \ S" shows "atin (subtopology X S) a = atin_within X a S" @@ -4504,7 +4540,7 @@ using assms continuous_map_compose continuous_map_metric by blast qed -lemma continuous_map_mdist: +lemma continuous_map_mdist [continuous_intros]: assumes f: "continuous_map X (mtopology_of m) f" and g: "continuous_map X (mtopology_of m) g" shows "continuous_map X euclidean (\x. mdist m (f x) (g x))" @@ -4560,6 +4596,542 @@ assumes fim: "f ` M1 = M2" and d: "\x y. \x \ M1; y \ M1\ \ d2 (f x) (f y) = d1 x y" shows "homeomorphic_map M1.mtopology M2.mtopology f" by (metis M1.topspace_mtopology M2.subtopology_mspace d embedding_map_def fim isometry_imp_embedding_map subsetI) +subsection\"Capped" equivalent bounded metrics and general product metrics\ + +definition (in Metric_space) capped_dist where + "capped_dist \ \\ x y. if \ > 0 then min \ (d x y) else d x y" + +lemma (in Metric_space) capped_dist: "Metric_space M (capped_dist \)" +proof + fix x y + assume "x \ M" "y \ M" + then show "(capped_dist \ x y = 0) = (x = y)" + by (smt (verit, best) capped_dist_def zero) + fix z + assume "z \ M" + show "capped_dist \ x z \ capped_dist \ x y + capped_dist \ y z" + unfolding capped_dist_def using \x \ M\ \y \ M\ \z \ M\ + by (smt (verit, del_insts) Metric_space.mdist_pos_eq Metric_space_axioms mdist_reverse_triangle) +qed (use capped_dist_def commute in auto) + + +definition capped_metric where + "capped_metric \ m \ metric(mspace m, Metric_space.capped_dist (mdist m) \)" + +lemma capped_metric: + "capped_metric \ m = (if \ \ 0 then m else metric(mspace m, \x y. min \ (mdist m x y)))" +proof - + interpret Metric_space "mspace m" "mdist m" + by (simp add: Metric_space_mspace_mdist) + show ?thesis + by (auto simp: capped_metric_def capped_dist_def) +qed + +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) + +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) + +lemma mdist_capped_le: "mdist (capped_metric \ m) x y \ mdist m x y" + by (simp add: capped_metric_mdist) + +lemma mdist_capped: "\ > 0 \ mdist (capped_metric \ m) x y \ \" + by (simp add: capped_metric_mdist) + +lemma mball_of_capped_metric [simp]: + assumes "x \ mspace m" "r > \" "\ > 0" + 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) + 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" + by (smt (verit) Metric_space.in_mball Metric_space_mspace_mdist assms capped_metric_mspace mdist_capped subset_eq) + ultimately show ?thesis + by (simp add: mball_of_def) +qed + +lemma Metric_space_capped_dist[simp]: + "Metric_space (mspace m) (Metric_space.capped_dist (mdist m) \)" + using Metric_space.capped_dist Metric_space_mspace_mdist by blast + +lemma mtopology_capped_metric: + "mtopology_of(capped_metric \ m) = mtopology_of m" +proof (cases "\ > 0") + case True + interpret Metric_space "mspace m" "mdist m" + by (simp add: Metric_space_mspace_mdist) + interpret Cap: Metric_space "mspace m" "mdist (capped_metric \ m)" + by (metis Metric_space_mspace_mdist capped_metric_mspace) + show ?thesis + unfolding topology_eq + proof + fix S + show "openin (mtopology_of (capped_metric \ m)) S = openin (mtopology_of m) S" + proof (cases "S \ mspace m") + case True + have "mball x r \ Cap.mball x r" for x r + by (smt (verit, ccfv_SIG) Cap.in_mball in_mball mdist_capped_le subsetI) + moreover have "\r>0. Cap.mball x r \ S" if "r>0" "x \ S" and r: "mball x r \ S" for r x + proof (intro exI conjI) + show "min (\/2) r > 0" + using \r>0\ \\>0\ by force + show "Cap.mball x (min (\/2) r) \ S" + using that + by clarsimp (smt (verit) capped_metric_mdist field_sum_of_halves in_mball subsetD) + qed + ultimately have "(\r>0. Cap.mball x r \ S) = (\r>0. mball x r \ S)" if "x \ S" for x + by (meson subset_trans that) + then show ?thesis + by (simp add: mtopology_of_def openin_mtopology Cap.openin_mtopology) + qed (simp add: openin_closedin_eq) + qed +qed (simp add: capped_metric) + +text \Might have been easier to prove this within the locale to start with (using Self)\ +lemma (in Metric_space) mtopology_capped_metric: + "Metric_space.mtopology M (capped_dist \) = mtopology" + using mtopology_capped_metric [of \ "metric(M,d)"] + by (simp add: Metric_space.mtopology_of capped_dist capped_metric_def) + +lemma (in Metric_space) MCauchy_capped_metric: + "Metric_space.MCauchy M (capped_dist \) \ \ MCauchy \" +proof (cases "\ > 0") + case True + interpret Cap: Metric_space "M" "capped_dist \" + by (simp add: capped_dist) + show ?thesis + proof + assume \: "Cap.MCauchy \" + show "MCauchy \" + unfolding MCauchy_def + proof (intro conjI strip) + show "range \ \ M" + using Cap.MCauchy_def \ by presburger + fix \ :: real + assume "\ > 0" + with True \ + obtain N where "\n n'. N \ n \ N \ n' \ capped_dist \ (\ n) (\ n') < min \ \" + unfolding Cap.MCauchy_def by (metis min_less_iff_conj) + with True show "\N. \n n'. N \ n \ N \ n' \ d (\ n) (\ n') < \" + by (force simp: capped_dist_def) + qed + next + assume "MCauchy \" + then show "Cap.MCauchy \" + unfolding MCauchy_def Cap.MCauchy_def by (force simp: capped_dist_def) + qed +qed (simp add: capped_dist_def) + + +lemma (in Metric_space) mcomplete_capped_metric: + "Metric_space.mcomplete M (capped_dist \) \ mcomplete" + by (simp add: MCauchy_capped_metric Metric_space.mcomplete_def capped_dist mtopology_capped_metric mcomplete_def) + +lemma bounded_equivalent_metric: + assumes "\ > 0" + obtains m' where "mspace m' = mspace m" "mtopology_of m' = mtopology_of m" "\x y. mdist m' x y < \" +proof + let ?m = "capped_metric (\/2) m" + fix x y + show "mdist ?m x y < \" + by (smt (verit, best) assms field_sum_of_halves mdist_capped) +qed (auto simp: mtopology_capped_metric) + +text \A technical lemma needed below\ +lemma Sup_metric_cartesian_product: + fixes I m + defines "S \ PiE I (mspace \ m)" + defines "D \ \x y. if x \ S \ y \ S then SUP i\I. mdist (m i) (x i) (y i) else 0" + defines "m' \ metric(S,D)" + assumes "I \ {}" + and c: "\i x y. \i \ I; x \ mspace(m i); y \ mspace(m i)\ \ mdist (m i) x y \ c" + shows "Metric_space S D" + and "\x \ S. \y \ S. \b. D x y \ b \ (\i \ I. mdist (m i) (x i) (y i) \ b)" (is "?the2") +proof - + have bdd: "bdd_above ((\i. mdist (m i) (x i) (y i)) ` I)" + if "x \ S" "y \ S" for x y + using c that by (force simp: S_def bdd_above_def) + have D_iff: "D x y \ b \ (\i \ I. mdist (m i) (x i) (y i) \ b)" + if "x \ S" "y \ S" for x y b + using that \I \ {}\ by (simp add: D_def PiE_iff cSup_le_iff bdd) + show "Metric_space S D" + 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) + show "D x y = D y x" + by (simp add: D_def mdist_commute) + assume "x \ S" and "y \ S" + then + have "D x y = 0 \ (\i\I. mdist (m i) (x i) (y i) = 0)" + using D0 D_iff [of x y 0] nle_le by fastforce + also have "... \ x = y" + using \x \ S\ \y \ S\ by (fastforce simp: S_def PiE_iff extensional_def) + finally show "(D x y = 0) \ (x = y)" . + fix z + assume "z \ S" + have "mdist (m i) (x i) (z i) \ D x y + D y z" if "i \ I" for i + proof - + have "mdist (m i) (x i) (z i) \ mdist (m i) (x i) (y i) + mdist (m i) (y i) (z i)" + by (metis PiE_E S_def \x \ S\ \y \ S\ \z \ S\ comp_apply mdist_triangle that) + also have "... \ D x y + D y z" + using \x \ S\ \y \ S\ \z \ S\ by (meson D_iff add_mono order_refl that) + finally show ?thesis . + qed + then show "D x z \ D x y + D y z" + by (simp add: D_iff \x \ S\ \z \ S\) + qed + then interpret Metric_space S D . + show ?the2 + proof (intro strip) + show "(D x y \ b) = (\i\I. mdist (m i) (x i) (y i) \ b)" + if "x \ S" and "y \ S" for x y b + using that by (simp add: D_iff m'_def) + qed +qed + +lemma metrizable_topology_A: + assumes "metrizable_space (product_topology X I)" + shows "topspace (product_topology X I) = {} \ (\i \ I. metrizable_space (X i))" + by (meson assms metrizable_space_retraction_map_image retraction_map_product_projection) + +lemma metrizable_topology_C: + assumes "completely_metrizable_space (product_topology X I)" + shows "topspace (product_topology X I) = {} \ (\i \ I. completely_metrizable_space (X i))" + by (meson assms completely_metrizable_space_retraction_map_image retraction_map_product_projection) + +lemma metrizable_topology_B: + fixes a X I + defines "L \ {i \ I. \a. topspace (X i) \ {a}}" + assumes "topspace (product_topology X I) \ {}" + and met: "metrizable_space (product_topology X I)" + and "\i. i \ I \ metrizable_space (X i)" + shows "countable L" +proof - + have "\i. \p q. i \ L \ p \ topspace(X i) \ q \ topspace(X i) \ p \ q" + unfolding L_def by blast + then obtain \ \ where \: "\i. i \ L \ \ i \ topspace(X i) \ \ i \ topspace(X i) \ \ i \ \ i" + by metis + obtain z where z: "z \ (\\<^sub>E i\I. topspace (X i))" + using assms(2) by fastforce + define p where "p \ \i. if i \ L then \ i else z i" + define q where "q \ \i j. if j = i then \ i else p j" + have p: "p \ topspace(product_topology X I)" + using z \ by (auto simp: p_def L_def) + then have q: "\i. i \ L \ q i \ topspace (product_topology X I)" + by (auto simp: L_def q_def \) + have fin: "finite {i \ L. q i \ U}" if U: "openin (product_topology X I) U" "p \ U" for U + proof - + obtain V where V: "finite {i \ I. V i \ topspace (X i)}" "(\i\I. openin (X i) (V i))" "p \ Pi\<^sub>E I V" "Pi\<^sub>E I V \ U" + using U by (force simp: openin_product_topology_alt) + moreover + have "V x \ topspace (X x)" if "x \ L" and "q x \ U" for x + using that V q + by (smt (verit, del_insts) PiE_iff q_def subset_eq topspace_product_topology) + then have "{i \ L. q i \ U} \ {i \ I. V i \ topspace (X i)}" + by (force simp: L_def) + ultimately show ?thesis + by (meson finite_subset) + qed + obtain M d where "Metric_space M d" and XI: "product_topology X I = Metric_space.mtopology M d" + using met metrizable_space_def by blast + then interpret Metric_space M d + by blast + define C where "C \ \n::nat. {i \ L. q i \ mball p (inverse (Suc n))}" + have "finite {i \ L. q i \ mball p (inverse (real (Suc n)))}" for n + using XI p by (intro fin; force) + then have "countable C" + unfolding C_def + by (meson countableI_type countable_UN countable_finite) + moreover have "L \ C" + proof (clarsimp simp: C_def) + fix i + assume "i \ L" and "q i \ M" and "p \ M" + then show "\n. \ d p (q i) < inverse (1 + real n)" + using reals_Archimedean [of "d p (q i)"] + by (metis \ mdist_pos_eq not_less_iff_gr_or_eq of_nat_Suc p_def q_def) + qed + ultimately show ?thesis + using countable_subset by blast +qed + +lemma metrizable_topology_DD: + assumes "topspace (product_topology X I) \ {}" + and co: "countable {i \ I. \a. topspace (X i) \ {a}}" + and m: "\i. i \ I \ X i = mtopology_of (m i)" + obtains M d where "Metric_space M d" "product_topology X I = Metric_space.mtopology M d" + "(\i. i \ I \ mcomplete_of (m i)) \ Metric_space.mcomplete M d" +proof (cases "I = {}") + case True + then show ?thesis + by (metis discrete_metric.mcomplete_discrete_metric discrete_metric.mtopology_discrete_metric metric_M_dd product_topology_empty_discrete that) +next + case False + obtain nk and C:: "nat set" where nk: "{i \ I. \a. topspace (X i) \ {a}} = nk ` C" and "inj_on nk C" + using co by (force simp: countable_as_injective_image_subset) + then obtain kn where kn: "\w. w \ C \ kn (nk w) = w" + by (metis inv_into_f_f) + define cm where "cm \ \i. capped_metric (inverse(Suc(kn i))) (m i)" + have mspace_cm: "mspace (cm i) = mspace (m i)" for i + by (simp add: cm_def) + have c1: "\i x y. mdist (cm i) x y \ 1" + by (simp add: cm_def capped_metric_mdist min_le_iff_disj divide_simps) + then have bdd: "bdd_above ((\i. mdist (cm i) (x i) (y i)) ` I)" for x y + by (meson bdd_above.I2) + define M where "M \ Pi\<^sub>E I (mspace \ cm)" + define d where "d \ \x y. if x \ M \ y \ M then SUP i\I. mdist (cm i) (x i) (y i) else 0" + + have d_le1: "d x y \ 1" for x y + using \I \ {}\ c1 by (simp add: d_def bdd cSup_le_iff) + with \I \ {}\ Sup_metric_cartesian_product [of I cm] + have "Metric_space M d" + and *: "\x\M. \y\M. \b. (d x y \ b) \ (\i\I. mdist (cm i) (x i) (y i) \ b)" + by (auto simp: False bdd M_def d_def cSUP_le_iff intro: c1) + then interpret Metric_space M d + by metis + have le_d: "mdist (cm i) (x i) (y i) \ d x y" if "i \ I" "x \ M" "y \ M" for i x y + using "*" that by blast + have product_m: "PiE I (\i. mspace (m i)) = topspace(product_topology X I)" + using m by force + + define m' where "m' = metric (M,d)" + define J where "J \ \U. {i \ I. U i \ topspace (X i)}" + have 1: "\U. finite (J U) \ (\i\I. openin (X i) (U i)) \ x \ Pi\<^sub>E I U \ Pi\<^sub>E I U \ mball z r" + if "x \ M" "z \ M" and r: "0 < r" "d z x < r" for x z r + proof - + have x: "\i. i \ I \ x i \ topspace(X i)" + using M_def m mspace_cm that(1) by auto + have z: "\i. i \ I \ z i \ topspace(X i)" + using M_def m mspace_cm that(2) by auto + obtain R where "0 < R" "d z x < R" "R < r" + using r dense by (smt (verit, ccfv_threshold)) + define U where "U \ \i. if R \ inverse(Suc(kn i)) then mball_of (m i) (z i) R else topspace(X i)" + show ?thesis + proof (intro exI conjI) + obtain n where n: "real n * R > 1" + using \0 < R\ ex_less_of_nat_mult by blast + have "finite (nk ` (C \ {..n}))" + by force + moreover + have "\m. m \ C \ m \ n \ i = nk m" + if R: "R \ inverse (1 + real (kn i))" and "i \ I" + and neq: "mball_of (m i) (z i) R \ topspace (X i)" for i + proof - + interpret MI: Metric_space "mspace (m i)" "mdist (m i)" + by auto + have "MI.mball (z i) R \ topspace (X i)" + by (metis mball_of_def neq) + then have "\a. topspace (X i) \ {a}" + using \0 < R\ m subset_antisym \i \ I\ z by fastforce + then have "i \ nk ` C" + using nk \i \ I\ by auto + then show ?thesis + by (smt (verit, ccfv_SIG) R \0 < R\ image_iff kn lift_Suc_mono_less_iff mult_mono n not_le_imp_less of_nat_0_le_iff of_nat_Suc right_inverse) + qed + then have "J U \ nk ` (C \ {..n})" + by (auto simp: image_iff Bex_def J_def U_def split: if_split_asm) + ultimately show "finite (J U)" + using finite_subset by blast + show "\i\I. openin (X i) (U i)" + by (simp add: Metric_space.openin_mball U_def mball_of_def mtopology_of_def m) + have xin: "x \ Pi\<^sub>E I (topspace \ X)" + using M_def \x \ M\ x by auto + moreover + have "\i. \i \ I; R \ inverse (1 + real (kn i))\ \ mdist (m i) (z i) (x i) < R" + by (smt (verit, ccfv_SIG) \d z x < R\ capped_metric_mdist cm_def le_d of_nat_Suc that) + ultimately show "x \ Pi\<^sub>E I U" + using m z by (auto simp: U_def PiE_iff) + show "Pi\<^sub>E I U \ mball z r" + proof + fix y + assume y: "y \ Pi\<^sub>E I U" + then have "y \ M" + by (force simp: PiE_iff M_def U_def m mspace_cm split: if_split_asm) + moreover + have "\i\I. mdist (cm i) (z i) (y i) \ R" + by (smt (verit) PiE_mem U_def cm_def in_mball_of inverse_Suc mdist_capped mdist_capped_le y) + then have "d z y \ R" + by (simp add: \y \ M\ \z \ M\ *) + ultimately show "y \ mball z r" + using \R < r\ \z \ M\ by force + qed + qed + qed + have 2: "\r>0. mball x r \ S" + if "finite (J U)" and x: "x \ Pi\<^sub>E I U" and S: "Pi\<^sub>E I U \ S" + and U: "\i. i\I \ openin (X i) (U i)" + and "x \ S" for U S x + proof - + { fix i + assume "i \ J U" + then have "i \ I" + by (auto simp: J_def) + then have "openin (mtopology_of (m i)) (U i)" + using U m by force + then have "openin (mtopology_of (cm i)) (U i)" + by (simp add: Abstract_Metric_Spaces.mtopology_capped_metric cm_def) + then have "\r>0. mball_of (cm i) (x i) r \ U i" + using x + by (simp add: Metric_space.openin_mtopology PiE_mem \i \ I\ mball_of_def mtopology_of_def) + } + then obtain rf where rf: "\j. j \ J U \ rf j >0 \ mball_of (cm j) (x j) (rf j) \ U j" + by metis + define r where "r \ Min (insert 1 (rf ` J U))" + show ?thesis + proof (intro exI conjI) + show "r > 0" + by (simp add: \finite (J U)\ r_def rf) + have r [simp]: "\j. j \ J U \ r \ rf j" "r \ 1" + by (auto simp: r_def that(1)) + have *: "mball_of (cm i) (x i) r \ U i" if "i \ I" for i + proof (cases "i \ J U") + case True + with r show ?thesis + by (smt (verit) Metric_space.in_mball Metric_space_mspace_mdist mball_of_def rf subset_eq) + next + case False + then show ?thesis + by (simp add: J_def cm_def m subset_eq that) + qed + show "mball x r \ S" + by (smt (verit) x * in_mball_of M_def Metric_space.in_mball Metric_space_axioms PiE_iff le_d o_apply subset_eq S) + qed + qed + have 3: "x \ M" + if \
: "\x. x\S \ \U. finite (J U) \ (\i\I. openin (X i) (U i)) \ x \ Pi\<^sub>E I U \ Pi\<^sub>E I U \ S" + and "x \ S" for S x + using \
[OF \x \ S\] m openin_subset by (fastforce simp: M_def PiE_iff cm_def) + show thesis + proof + show "Metric_space M d" + using Metric_space_axioms by blast + show eq: "product_topology X I = Metric_space.mtopology M d" + unfolding topology_eq openin_mtopology openin_product_topology_alt + using J_def 1 2 3 subset_iff zero by (smt (verit, ccfv_threshold)) + show "mcomplete" if "\i. i \ I \ mcomplete_of (m i)" + unfolding mcomplete_def + proof (intro strip) + fix \ + assume \: "MCauchy \" + have "\y. i \ I \ limitin (X i) (\n. \ n i) y sequentially" for i + proof (cases "i \ I") + case True + interpret MI: Metric_space "mspace (m i)" "mdist (m i)" + by auto + have "\\. MI.MCauchy \ \ (\x. limitin MI.mtopology \ x sequentially)" + by (meson MI.mcomplete_def True mcomplete_of_def that) + moreover have "MI.MCauchy (\n. \ n i)" + unfolding MI.MCauchy_def + proof (intro conjI strip) + show "range (\n. \ n i) \ mspace (m i)" + by (smt (verit, ccfv_threshold) MCauchy_def PiE_iff True \ eq image_subset_iff m topspace_mtopology topspace_mtopology_of topspace_product_topology) + fix \::real + define r where "r \ min \ (inverse(Suc (kn i)))" + assume "\ > 0" + then have "r > 0" + by (simp add: r_def) + then obtain N where N: "\n n'. N \ n \ N \ n' \ d (\ n) (\ n') < r" + using \ unfolding MCauchy_def by meson + show "\N. \n n'. N \ n \ N \ n' \ mdist (m i) (\ n i) (\ n' i) < \" + proof (intro strip exI) + fix n n' + assume "N \ n" and "N \ n'" + then have "mdist (cm i) (\ n i) (\ n' i) < r" + using * + by (smt (verit) Metric_space.MCauchy_def Metric_space_axioms N True \ rangeI subsetD) + then + show "mdist (m i) (\ n i) (\ n' i) < \" + unfolding cm_def r_def + by (smt (verit, ccfv_SIG) capped_metric_mdist) + qed + qed + ultimately show ?thesis + by (simp add: m mtopology_of_def) + qed auto + then obtain y where "\i. i \ I \ limitin (X i) (\n. \ n i) (y i) sequentially" + by metis + with \ show "\x. limitin mtopology \ x sequentially" + apply (rule_tac x="\i\I. y i" in exI) + apply (simp add: MCauchy_def limitin_componentwise flip: eq) + by (metis eq eventually_at_top_linorder range_subsetD topspace_mtopology topspace_product_topology) + qed + qed +qed + + +lemma metrizable_topology_D: + assumes "topspace (product_topology X I) \ {}" + and co: "countable {i \ I. \a. topspace (X i) \ {a}}" + and met: "\i. i \ I \ metrizable_space (X i)" + shows "metrizable_space (product_topology X I)" +proof - + have "\i. i \ I \ \m. X i = mtopology_of m" + by (metis Metric_space.mtopology_of met metrizable_space_def) + then obtain m where m: "\i. i \ I \ X i = mtopology_of (m i)" + by metis + then show ?thesis + using metrizable_topology_DD [of X I m] assms by (force simp: metrizable_space_def) +qed + +lemma metrizable_topology_E: + assumes "topspace (product_topology X I) \ {}" + and "countable {i \ I. \a. topspace (X i) \ {a}}" + and met: "\i. i \ I \ completely_metrizable_space (X i)" + shows "completely_metrizable_space (product_topology X I)" +proof - + have "\i. i \ I \ \m. mcomplete_of m \ X i = mtopology_of m" + using met Metric_space.mtopology_of Metric_space.mcomplete_of unfolding completely_metrizable_space_def + by metis + then obtain m where "\i. i \ I \ mcomplete_of (m i) \ X i = mtopology_of (m i)" + by metis + then show ?thesis + using metrizable_topology_DD [of X I m] assms unfolding metrizable_space_def + by (metis (full_types) completely_metrizable_space_def) +qed + + +lemma metrizable_space_product_topology: + "metrizable_space (product_topology X I) \ + topspace (product_topology X I) = {} \ + countable {i \ I. \ (\a. topspace(X i) \ {a})} \ + (\i \ I. metrizable_space (X i))" + by (metis (mono_tags, lifting) empty_metrizable_space metrizable_topology_A metrizable_topology_B metrizable_topology_D) + +lemma completely_metrizable_space_product_topology: + "completely_metrizable_space (product_topology X I) \ + topspace (product_topology X I) = {} \ + countable {i \ I. \ (\a. topspace(X i) \ {a})} \ + (\i \ I. completely_metrizable_space (X i))" + by (metis (mono_tags, lifting) completely_metrizable_imp_metrizable_space empty_completely_metrizable_space metrizable_topology_B metrizable_topology_C metrizable_topology_E) + + +lemma completely_metrizable_Euclidean_space: + "completely_metrizable_space(Euclidean_space n)" + unfolding Euclidean_space_def +proof (rule completely_metrizable_space_closedin) + show "completely_metrizable_space (powertop_real (UNIV::nat set))" + by (simp add: completely_metrizable_space_product_topology completely_metrizable_space_euclidean) + show "closedin (powertop_real UNIV) {x. \i\n. x i = 0}" + using closedin_Euclidean_space topspace_Euclidean_space by auto +qed + +lemma metrizable_Euclidean_space: + "metrizable_space(Euclidean_space n)" + by (simp add: completely_metrizable_Euclidean_space completely_metrizable_imp_metrizable_space) + +lemma locally_connected_Euclidean_space: + "locally_connected_space(Euclidean_space n)" + by (simp add: locally_path_connected_Euclidean_space locally_path_connected_imp_locally_connected_space) + end diff -r d6e6618db929 -r b0ad3aba48f1 src/HOL/Analysis/Abstract_Topological_Spaces.thy --- a/src/HOL/Analysis/Abstract_Topological_Spaces.thy Mon Jun 26 13:22:50 2023 +0200 +++ b/src/HOL/Analysis/Abstract_Topological_Spaces.thy Mon Jun 26 14:38:26 2023 +0100 @@ -3,7 +3,7 @@ section \Various Forms of Topological Spaces\ theory Abstract_Topological_Spaces - imports Lindelof_Spaces Locally Sum_Topology FSigma + imports Lindelof_Spaces Locally Abstract_Euclidean_Space Sum_Topology FSigma begin @@ -1122,7 +1122,7 @@ lemma open_map_Kolmogorov_quotient_gen: - "open_map (subtopology X S) (subtopology X (image (Kolmogorov_quotient X) S)) (Kolmogorov_quotient X)" + "open_map (subtopology X S) (subtopology X (Kolmogorov_quotient X ` S)) (Kolmogorov_quotient X)" proof (clarsimp simp: open_map_def openin_subtopology_alt image_iff) fix U assume "openin X U" @@ -1233,11 +1233,10 @@ lemma Kolmogorov_quotient_lift_exists: assumes "S \ topspace X" "t0_space Y" and f: "continuous_map (subtopology X S) Y f" - obtains g where "continuous_map (subtopology X (image (Kolmogorov_quotient X) S)) Y g" + obtains g where "continuous_map (subtopology X (Kolmogorov_quotient X ` S)) Y g" "\x. x \ S \ g(Kolmogorov_quotient X x) = f x" proof - - have "\x y. \x \ S; y \ S; Kolmogorov_quotient X x = Kolmogorov_quotient X y\ - \ f x = f y" + have "\x y. \x \ S; y \ S; Kolmogorov_quotient X x = Kolmogorov_quotient X y\ \ f x = f y" using assms apply (simp add: Kolmogorov_quotient_eq t0_space_def continuous_map_def Int_absorb1 openin_subtopology) by (smt (verit, del_insts) Int_iff mem_Collect_eq) @@ -1253,8 +1252,7 @@ subsection\Closed diagonals and graphs\ lemma Hausdorff_space_closedin_diagonal: - "Hausdorff_space X \ - closedin (prod_topology X X) ((\x. (x,x)) ` topspace X)" + "Hausdorff_space X \ closedin (prod_topology X X) ((\x. (x,x)) ` topspace X)" proof - have \
: "((\x. (x, x)) ` topspace X) \ topspace X \ topspace X" by auto @@ -1296,6 +1294,26 @@ qed qed +lemma forall_in_closure_of: + assumes "x \ X closure_of S" "\x. x \ S \ P x" + and "closedin X {x \ topspace X. P x}" + shows "P x" + by (smt (verit, ccfv_threshold) Diff_iff assms closedin_def in_closure_of mem_Collect_eq) + +lemma forall_in_closure_of_eq: + assumes x: "x \ X closure_of S" + and Y: "Hausdorff_space Y" + and f: "continuous_map X Y f" and g: "continuous_map X Y g" + and fg: "\x. x \ S \ f x = g x" + shows "f x = g x" +proof - + have "closedin X {x \ topspace X. f x = g x}" + using Y closedin_continuous_maps_eq f g by blast + then show ?thesis + using forall_in_closure_of [OF x fg] + by fastforce +qed + lemma retract_of_space_imp_closedin: assumes "Hausdorff_space X" and S: "S retract_of_space X" shows "closedin X S" @@ -3067,6 +3085,23 @@ qed qed +lemma locally_compact_space_euclidean: + "locally_compact_space (euclidean::'a::heine_borel topology)" + unfolding locally_compact_space_def +proof (intro strip) + fix x::'a + assume "x \ topspace euclidean" + have "ball x 1 \ cball x 1" + by auto + then show "\U K. openin euclidean U \ compactin euclidean K \ x \ U \ U \ K" + by (metis Elementary_Metric_Spaces.open_ball centre_in_ball compact_cball compactin_euclidean_iff open_openin zero_less_one) +qed + +lemma locally_compact_Euclidean_space: + "locally_compact_space(Euclidean_space n)" + using homeomorphic_locally_compact_space [OF homeomorphic_Euclidean_space_product_topology] + using locally_compact_space_product_topology locally_compact_space_euclidean by fastforce + proposition quotient_map_prod_right: assumes loc: "locally_compact_space Z" and reg: "Hausdorff_space Z \ regular_space Z" diff -r d6e6618db929 -r b0ad3aba48f1 src/HOL/Analysis/Abstract_Topology.thy --- a/src/HOL/Analysis/Abstract_Topology.thy Mon Jun 26 13:22:50 2023 +0200 +++ b/src/HOL/Analysis/Abstract_Topology.thy Mon Jun 26 14:38:26 2023 +0100 @@ -3033,7 +3033,7 @@ definition homeomorphic_space (infixr "homeomorphic'_space" 50) where "X homeomorphic_space Y \ \f g. homeomorphic_maps X Y f g" -lemma homeomorphic_space_refl: "X homeomorphic_space X" +lemma homeomorphic_space_refl [iff]: "X homeomorphic_space X" by (meson homeomorphic_maps_id homeomorphic_space_def) lemma homeomorphic_space_sym: diff -r d6e6618db929 -r b0ad3aba48f1 src/HOL/Analysis/Abstract_Topology_2.thy --- a/src/HOL/Analysis/Abstract_Topology_2.thy Mon Jun 26 13:22:50 2023 +0200 +++ b/src/HOL/Analysis/Abstract_Topology_2.thy Mon Jun 26 14:38:26 2023 +0100 @@ -1644,6 +1644,11 @@ shows "(x / (1 + \x\) = y) \ (\y\ < 1 \ y / (1 - \y\) = x)" using real_grow_shrink by (fastforce simp add: distrib_left) +lemma real_shrink_eq: + fixes x y::real + shows "(x / (1 + \x\) = y / (1 + \y\)) \ x = y" + by (metis real_shrink_Galois) + lemma real_shrink_lt: fixes x::real shows "x / (1 + \x\) < y / (1 + \y\) \ x < y" diff -r d6e6618db929 -r b0ad3aba48f1 src/HOL/Analysis/Function_Topology.thy --- a/src/HOL/Analysis/Function_Topology.thy Mon Jun 26 13:22:50 2023 +0200 +++ b/src/HOL/Analysis/Function_Topology.thy Mon Jun 26 14:38:26 2023 +0100 @@ -194,6 +194,10 @@ unfolding product_topology_def using PiE_def by (auto) qed +lemma topspace_product_topology_alt: + "topspace (product_topology X I) = {x \ extensional I. \i \ I. x i \ topspace(X i)}" + by (fastforce simp: PiE_iff) + lemma product_topology_basis: assumes "\i. openin (T i) (X i)" "finite {i. X i \ topspace (T i)}" shows "openin (product_topology T I) (\\<^sub>E i\I. X i)" @@ -1577,4 +1581,76 @@ then show ?thesis by metis qed +subsection \Limits\ + +text \The original HOL Light proof was a mess, yuk\ +lemma limitin_componentwise: + "limitin (product_topology X I) f l F \ + l \ extensional I \ + eventually (\a. f a \ topspace(product_topology X I)) F \ + (\i \ I. limitin (X i) (\c. f c i) (l i) F)" + (is "?L \ _ \ ?R1 \ ?R2") +proof (cases "l \ extensional I") + case l: True + show ?thesis + proof (cases "\i\I. l i \ topspace (X i)") + case True + have ?R1 if ?L + by (metis limitin_subtopology subtopology_topspace that) + moreover + have ?R2 if ?L + unfolding limitin_def + proof (intro conjI strip) + fix i U + assume "i \ I" and U: "openin (X i) U \ l i \ U" + then have "openin (product_topology X I) ({y. y i \ U} \ topspace (product_topology X I))" + unfolding openin_product_topology arbitrary_union_of_relative_to [symmetric] + apply (simp add: relative_to_def topspace_product_topology_alt) + by (smt (verit, del_insts) Collect_cong arbitrary_union_of_inc finite_intersection_of_inc inf_commute) + moreover have "l \ {y. y i \ U} \ topspace (product_topology X I)" + using U True l by (auto simp: extensional_def) + ultimately have "eventually (\x. f x \ {y. y i \ U} \ topspace (product_topology X I)) F" + by (metis limitin_def that) + then show "\\<^sub>F x in F. f x i \ U" + by (simp add: eventually_conj_iff) + qed (use True in auto) + moreover + have ?L if R1: ?R1 and R2: ?R2 + unfolding limitin_def openin_product_topology all_union_of imp_conjL arbitrary_def + proof (intro conjI strip) + show l: "l \ topspace (product_topology X I)" + by (simp add: PiE_iff True l) + fix \ + assume "\ \ Collect (finite intersection_of (\F. \i U. F = {f. f i \ U} \ i \ I \ openin (X i) U) + relative_to topspace (product_topology X I))" + and "l \ \ \" + then obtain \ where "finite \" and \X: "\X\\. l \ X" + and \: "\C. C \ \ \ C \ {{x. x i \ U} |i U. i \ I \ openin (X i) U}" + and \\: "topspace (product_topology X I) \ \ \ \ \" + by (fastforce simp: intersection_of_def relative_to_def subset_eq) + have "\\<^sub>F x in F. f x \ topspace (product_topology X I) \ \\" + proof - + have "\W. W \ {{x. x i \ U} | i U. i \ I \ openin (X i) U} \ W \ \ \ \\<^sub>F x in F. f x \ W" + using \X R2 by (auto simp: limitin_def) + with \ have "\\<^sub>F x in F. \W\\. f x \ W" + by (simp add: \finite \\ eventually_ball_finite) + with R1 show ?thesis + by (simp add: eventually_conj_iff) + qed + then show "\\<^sub>F x in F. f x \ \\" + by (smt (verit, ccfv_threshold) \\ UnionI eventually_mono) + qed + ultimately show ?thesis + using l by blast + next + case False + then show ?thesis + by (metis PiE_iff limitin_def topspace_product_topology) + qed +next + case False + then show ?thesis + by (simp add: limitin_def PiE_iff) +qed + end diff -r d6e6618db929 -r b0ad3aba48f1 src/HOL/Analysis/Ordered_Euclidean_Space.thy --- a/src/HOL/Analysis/Ordered_Euclidean_Space.thy Mon Jun 26 13:22:50 2023 +0200 +++ b/src/HOL/Analysis/Ordered_Euclidean_Space.thy Mon Jun 26 14:38:26 2023 +0100 @@ -157,27 +157,27 @@ shows "((\i. inf (X i) (Y i)) \ inf x y) net" unfolding inf_min eucl_inf by (intro assms tendsto_intros) -lemma tendsto_Inf: +lemma tendsto_Inf[tendsto_intros]: fixes f :: "'a \ 'b \ 'c::ordered_euclidean_space" assumes "finite K" "\i. i \ K \ ((\x. f x i) \ l i) F" shows "((\x. Inf (f x ` K)) \ Inf (l ` K)) F" using assms by (induction K rule: finite_induct) (auto simp: cInf_insert_If tendsto_inf) -lemma tendsto_Sup: +lemma tendsto_Sup[tendsto_intros]: fixes f :: "'a \ 'b \ 'c::ordered_euclidean_space" assumes "finite K" "\i. i \ K \ ((\x. f x i) \ l i) F" shows "((\x. Sup (f x ` K)) \ Sup (l ` K)) F" using assms by (induction K rule: finite_induct) (auto simp: cSup_insert_If tendsto_sup) -lemma continuous_map_Inf: +lemma continuous_map_Inf [continuous_intros]: fixes f :: "'a \ 'b \ 'c::ordered_euclidean_space" assumes "finite K" "\i. i \ K \ continuous_map X euclidean (\x. f x i)" shows "continuous_map X euclidean (\x. INF i\K. f x i)" using assms by (simp add: continuous_map_atin tendsto_Inf) -lemma continuous_map_Sup: +lemma continuous_map_Sup [continuous_intros]: fixes f :: "'a \ 'b \ 'c::ordered_euclidean_space" assumes "finite K" "\i. i \ K \ continuous_map X euclidean (\x. f x i)" shows "continuous_map X euclidean (\x. SUP i\K. f x i)" diff -r d6e6618db929 -r b0ad3aba48f1 src/HOL/Analysis/Urysohn.thy --- a/src/HOL/Analysis/Urysohn.thy Mon Jun 26 13:22:50 2023 +0200 +++ b/src/HOL/Analysis/Urysohn.thy Mon Jun 26 14:38:26 2023 +0100 @@ -161,7 +161,7 @@ qed qed then have contf: "continuous_map X (top_of_set {0..1}) f" - by (force simp add: Met_TC.continuous_map_to_metric dist_real_def continuous_map_in_subtopology fim simp flip: Met_TC.mtopology_is_euclideanreal) + by (force simp add: Met_TC.continuous_map_to_metric dist_real_def continuous_map_in_subtopology fim simp flip: mtopology_is_euclidean) define g where "g \ \x. a + (b - a) * f x" show thesis proof @@ -1976,8 +1976,8 @@ regular_space (subtopology ?Y (topspace ?Y - {None})) \ locally_compact_space (subtopology ?Y (topspace ?Y - {None}))" by (rule regular_space_one_point_compactification) (auto simp: compactin_subtopology closedin_subtopology closedin_Alexandroff_I) also have "... \ regular_space X \ locally_compact_space X" - using embedding_map_Some embedding_map_imp_homeomorphic_space homeomorphic_locally_compact_space homeomorphic_regular_space - by fastforce + by (metis embedding_map_Some embedding_map_imp_homeomorphic_space homeomorphic_locally_compact_space + homeomorphic_regular_space topspace_Alexandroff_compactification_delete) finally show ?thesis . qed diff -r d6e6618db929 -r b0ad3aba48f1 src/HOL/Library/Countable_Set.thy --- a/src/HOL/Library/Countable_Set.thy Mon Jun 26 13:22:50 2023 +0200 +++ b/src/HOL/Library/Countable_Set.thy Mon Jun 26 14:38:26 2023 +0100 @@ -14,6 +14,9 @@ definition countable :: "'a set \ bool" where "countable S \ (\f::'a \ nat. inj_on f S)" +lemma countable_as_injective_image_subset: "countable S \ (\f. \K::nat set. S = f ` K \ inj_on f K)" + by (metis countable_def inj_on_the_inv_into the_inv_into_onto) + lemma countableE: assumes S: "countable S" obtains f :: "'a \ nat" where "inj_on f S" using S by (auto simp: countable_def) diff -r d6e6618db929 -r b0ad3aba48f1 src/HOL/Library/Equipollence.thy --- a/src/HOL/Library/Equipollence.thy Mon Jun 26 13:22:50 2023 +0200 +++ b/src/HOL/Library/Equipollence.thy Mon Jun 26 14:38:26 2023 +0100 @@ -1,7 +1,7 @@ section \Equipollence and Other Relations Connected with Cardinality\ theory "Equipollence" - imports FuncSet + imports FuncSet Countable_Set begin subsection\Eqpoll\ @@ -47,11 +47,7 @@ by (meson card_of_ordLeq eqpoll_iff_card_of_ordIso lepoll_def lepoll_trans ordIso_iff_ordLeq) lemma lepoll_trans2 [trans]: "\A \ B; B \ C\ \ A \ C" - apply (clarsimp simp: eqpoll_def lepoll_def bij_betw_def) - apply (rename_tac f g) - apply (rule_tac x="g \ f" in exI) - apply (auto simp: image_subset_iff inj_on_def) - done + by (metis bij_betw_def eqpoll_def lepoll_def lepoll_trans order_refl) lemma eqpoll_sym: "A \ B \ B \ A" unfolding eqpoll_def @@ -87,9 +83,7 @@ by (auto simp: lepoll_iff) lemma infinite_le_lepoll: "infinite A \ (UNIV::nat set) \ A" -apply (auto simp: lepoll_def) - apply (simp add: infinite_countable_subset) - using infinite_iff_countable_subset by blast + by (simp add: infinite_iff_countable_subset lepoll_def) lemma lepoll_Pow_self: "A \ Pow A" unfolding lepoll_def inj_def @@ -121,12 +115,7 @@ by (blast intro: lepoll_antisym singleton_lepoll) lemma subset_singleton_iff_lepoll: "(\x. S \ {x}) \ S \ {()}" -proof safe - show "S \ {()}" if "S \ {x}" for x - using subset_imp_lepoll [OF that] by (simp add: singleton_eqpoll lepoll_trans2) - show "\x. S \ {x}" if "S \ {()}" - by (metis (no_types, opaque_lifting) image_empty image_insert lepoll_iff that) -qed + using lepoll_iff by fastforce lemma infinite_insert_lepoll: assumes "infinite A" shows "insert a A \ A" @@ -158,6 +147,12 @@ using \infinite A\ infinite_le_lepoll lepoll_trans by auto qed +lemma countable_lepoll: "\countable A; B \ A\ \ countable B" + by (meson countable_image countable_subset lepoll_iff) + +lemma countable_eqpoll: "\countable A; B \ A\ \ countable B" + using countable_lepoll eqpoll_imp_lepoll by blast + subsection\The strict relation\ lemma lesspoll_not_refl [iff]: "~ (i \ i)" @@ -192,6 +187,9 @@ assumes "infinite A" "finite B" shows "B \ A" by (meson assms eqpoll_finite_iff finite_lepoll_infinite lesspoll_def) +lemma countable_lesspoll: "\countable A; B \ A\ \ countable B" + using countable_lepoll lesspoll_def by blast + subsection\Mapping by an injection\ lemma inj_on_image_eqpoll_self: "inj_on f A \ f ` A \ A"