src/HOL/Analysis/Urysohn.thy
changeset 78248 740b23f1138a
parent 78202 759c71cdaf2a
child 78250 400aecdfd71f
equal deleted inserted replaced
78239:4fe65149f3fd 78248:740b23f1138a
  2514   have "T \<subseteq> mspace m1"
  2514   have "T \<subseteq> mspace m1"
  2515     using Tsub by (auto simp: mtopology_of_def closure_of_def)
  2515     using Tsub by (auto simp: mtopology_of_def closure_of_def)
  2516   show ?thesis
  2516   show ?thesis
  2517     unfolding Lipschitz_continuous_map_pos
  2517     unfolding Lipschitz_continuous_map_pos
  2518   proof
  2518   proof
  2519     show "f ` mspace (submetric m1 T) \<subseteq> mspace m2"
  2519     show "f \<in> mspace (submetric m1 T) \<rightarrow> mspace m2"
  2520       by (metis cmf Metric_space.metric_continuous_map Metric_space_mspace_mdist  mtopology_of_def mtopology_of_submetric)
  2520       by (metis cmf Metric_space.metric_continuous_map Metric_space_mspace_mdist  mtopology_of_def 
       
  2521           mtopology_of_submetric image_subset_iff_funcset)
  2521     define X where "X \<equiv> prod_topology (subtopology L.M1.mtopology T) (subtopology L.M1.mtopology T)"
  2522     define X where "X \<equiv> prod_topology (subtopology L.M1.mtopology T) (subtopology L.M1.mtopology T)"
  2522     obtain B::real where "B > 0" and B: "\<forall>(x,y) \<in> S\<times>S. mdist m2 (f x) (f y) \<le> B * mdist m1 x y"
  2523     obtain B::real where "B > 0" and B: "\<forall>(x,y) \<in> S\<times>S. mdist m2 (f x) (f y) \<le> B * mdist m1 x y"
  2523       using lcf \<open>S \<subseteq> mspace m1\<close>  by (force simp: Lipschitz_continuous_map_pos)
  2524       using lcf \<open>S \<subseteq> mspace m1\<close>  by (force simp: Lipschitz_continuous_map_pos)
  2524     have eq: "{z \<in> A. case z of (x,y) \<Rightarrow> p x y \<le> B * q x y} = {z \<in> A. ((\<lambda>(x,y). B * q x y - p x y)z) \<in> {0..}}" 
  2525     have eq: "{z \<in> A. case z of (x,y) \<Rightarrow> p x y \<le> B * q x y} = {z \<in> A. ((\<lambda>(x,y). B * q x y - p x y)z) \<in> {0..}}" 
  2525         for p q and A::"('a*'a)set"
  2526         for p q and A::"('a*'a)set"
  2606   have "T \<subseteq> mspace m1"
  2607   have "T \<subseteq> mspace m1"
  2607     using Tsub by (auto simp: mtopology_of_def closure_of_def)
  2608     using Tsub by (auto simp: mtopology_of_def closure_of_def)
  2608   show ?thesis
  2609   show ?thesis
  2609     unfolding uniformly_continuous_map_def
  2610     unfolding uniformly_continuous_map_def
  2610     proof (intro conjI strip)
  2611     proof (intro conjI strip)
  2611     show "f ` mspace (submetric m1 T) \<subseteq> mspace m2"
  2612     show "f \<in> mspace (submetric m1 T) \<rightarrow> mspace m2"
  2612       by (metis cmf Metric_space.metric_continuous_map Metric_space_mspace_mdist  mtopology_of_def mtopology_of_submetric)
  2613       by (metis cmf Metric_space.metric_continuous_map Metric_space_mspace_mdist  
       
  2614           mtopology_of_def mtopology_of_submetric image_subset_iff_funcset)
  2613     fix \<epsilon>::real
  2615     fix \<epsilon>::real
  2614     assume "\<epsilon> > 0"
  2616     assume "\<epsilon> > 0"
  2615     then obtain \<delta> where "\<delta>>0" and \<delta>: "\<forall>(x,y) \<in> S\<times>S. mdist m1 x y < \<delta> \<longrightarrow> mdist m2 (f x) (f y) \<le> \<epsilon>/2"
  2617     then obtain \<delta> where "\<delta>>0" and \<delta>: "\<forall>(x,y) \<in> S\<times>S. mdist m1 x y < \<delta> \<longrightarrow> mdist m2 (f x) (f y) \<le> \<epsilon>/2"
  2616       using ucf \<open>S \<subseteq> mspace m1\<close> unfolding uniformly_continuous_map_def mspace_submetric
  2618       using ucf \<open>S \<subseteq> mspace m1\<close> unfolding uniformly_continuous_map_def mspace_submetric
  2617       apply (simp add: Ball_def del: divide_const_simps)
  2619       apply (simp add: Ball_def del: divide_const_simps)
  3141 definition cfunspace where
  3143 definition cfunspace where
  3142   "cfunspace X m \<equiv> submetric (funspace (topspace X) m) {f. continuous_map X (mtopology_of m) f}"
  3144   "cfunspace X m \<equiv> submetric (funspace (topspace X) m) {f. continuous_map X (mtopology_of m) f}"
  3143 
  3145 
  3144 lemma mspace_cfunspace [simp]:
  3146 lemma mspace_cfunspace [simp]:
  3145   "mspace (cfunspace X m) = 
  3147   "mspace (cfunspace X m) = 
  3146      {f. f ` topspace X \<subseteq> mspace m \<and> f \<in> extensional (topspace X) \<and>
  3148      {f. f \<in> topspace X \<rightarrow> mspace m \<and> f \<in> extensional (topspace X) \<and>
  3147          Metric_space.mbounded (mspace m) (mdist m) (f ` (topspace X)) \<and>
  3149          Metric_space.mbounded (mspace m) (mdist m) (f ` (topspace X)) \<and>
  3148          continuous_map X (mtopology_of m) f}"
  3150          continuous_map X (mtopology_of m) f}"
  3149   by (auto simp: cfunspace_def Metric_space.fspace_def)
  3151   by (auto simp: cfunspace_def Metric_space.fspace_def)
  3150 
  3152 
  3151 lemma mdist_cfunspace_eq_mdist_funspace:
  3153 lemma mdist_cfunspace_eq_mdist_funspace:
  3276         by (metis assms mcomplete_funspace mcomplete_of_def mdist_Self mdist_funspace mspace_Self mspace_funspace)
  3278         by (metis assms mcomplete_funspace mcomplete_of_def mdist_Self mdist_funspace mspace_Self mspace_funspace)
  3277       fix \<sigma> g
  3279       fix \<sigma> g
  3278       assume g: "range \<sigma> \<subseteq> mspace (cfunspace X Self) \<and> limitin F.mtopology \<sigma> g sequentially"
  3280       assume g: "range \<sigma> \<subseteq> mspace (cfunspace X Self) \<and> limitin F.mtopology \<sigma> g sequentially"
  3279       show "g \<in> mspace (cfunspace X Self)"
  3281       show "g \<in> mspace (cfunspace X Self)"
  3280       proof (simp add: mtopology_of_def, intro conjI)
  3282       proof (simp add: mtopology_of_def, intro conjI)
  3281         show "g ` topspace X \<subseteq> M" "g \<in> extensional (topspace X)" "mbounded (g ` topspace X)"
  3283         show "g \<in> topspace X \<rightarrow> M" "g \<in> extensional (topspace X)" "mbounded (g ` topspace X)"
  3282           using g F.limitin_mspace by (force simp: fspace_def)+
  3284           using g F.limitin_mspace by (force simp: fspace_def)+
  3283         show "continuous_map X mtopology g"
  3285         show "continuous_map X mtopology g"
  3284           using * g by blast
  3286           using * g by blast
  3285       qed
  3287       qed
  3286     qed
  3288     qed
  3294 
  3296 
  3295 lemma (in Metric_space) metric_completion_explicit:
  3297 lemma (in Metric_space) metric_completion_explicit:
  3296   obtains f :: "['a,'a] \<Rightarrow> real" and S where
  3298   obtains f :: "['a,'a] \<Rightarrow> real" and S where
  3297       "S \<subseteq> mspace(funspace M euclidean_metric)"
  3299       "S \<subseteq> mspace(funspace M euclidean_metric)"
  3298       "mcomplete_of (submetric (funspace M euclidean_metric) S)"
  3300       "mcomplete_of (submetric (funspace M euclidean_metric) S)"
  3299       "f ` M \<subseteq> S"
  3301       "f \<in> M \<rightarrow> S"
  3300       "mtopology_of(funspace M euclidean_metric) closure_of f ` M = S"
  3302       "mtopology_of(funspace M euclidean_metric) closure_of f ` M = S"
  3301       "\<And>x y. \<lbrakk>x \<in> M; y \<in> M\<rbrakk>
  3303       "\<And>x y. \<lbrakk>x \<in> M; y \<in> M\<rbrakk>
  3302             \<Longrightarrow> mdist (funspace M euclidean_metric) (f x) (f y) = d x y"
  3304             \<Longrightarrow> mdist (funspace M euclidean_metric) (f x) (f y) = d x y"
  3303 proof -
  3305 proof -
  3304   define m':: "('a\<Rightarrow>real) metric" where "m' \<equiv> funspace M euclidean_metric"
  3306   define m':: "('a\<Rightarrow>real) metric" where "m' \<equiv> funspace M euclidean_metric"
  3335         by (simp add: S_def closedin_Int funspace_def)
  3337         by (simp add: S_def closedin_Int funspace_def)
  3336       moreover have "S.mcomplete"
  3338       moreover have "S.mcomplete"
  3337         using Metric_space.mcomplete_funspace Met_TC.Metric_space_axioms by (fastforce simp: mcomplete_of_def)
  3339         using Metric_space.mcomplete_funspace Met_TC.Metric_space_axioms by (fastforce simp: mcomplete_of_def)
  3338       ultimately show "mcomplete_of (submetric (funspace M euclidean_metric) S)"
  3340       ultimately show "mcomplete_of (submetric (funspace M euclidean_metric) S)"
  3339         by (simp add: S.closedin_eq_mcomplete mcomplete_of_def)
  3341         by (simp add: S.closedin_eq_mcomplete mcomplete_of_def)
  3340       show "f ` M \<subseteq> S"
  3342       show "f \<in> M \<rightarrow> S"
  3341         using S_def fim in_closure_of m'_def by fastforce
  3343         using S_def fim in_closure_of m'_def by fastforce
  3342       show "mtopology_of (funspace M euclidean_metric) closure_of f ` M = S"
  3344       show "mtopology_of (funspace M euclidean_metric) closure_of f ` M = S"
  3343         by (auto simp: f_def S_def mtopology_of_def)
  3345         by (auto simp: f_def S_def mtopology_of_def)
  3344       show "mdist (funspace M euclidean_metric) (f x) (f y) = d x y"
  3346       show "mdist (funspace M euclidean_metric) (f x) (f y) = d x y"
  3345         if "x \<in> M" "y \<in> M" for x y
  3347         if "x \<in> M" "y \<in> M" for x y
  3361 
  3363 
  3362 
  3364 
  3363 lemma (in Metric_space) metric_completion:
  3365 lemma (in Metric_space) metric_completion:
  3364   obtains f :: "['a,'a] \<Rightarrow> real" and m' where
  3366   obtains f :: "['a,'a] \<Rightarrow> real" and m' where
  3365     "mcomplete_of m'"
  3367     "mcomplete_of m'"
  3366     "f ` M \<subseteq> mspace m' "
  3368     "f \<in> M \<rightarrow> mspace m' "
  3367     "mtopology_of m' closure_of f ` M = mspace m'"
  3369     "mtopology_of m' closure_of f ` M = mspace m'"
  3368     "\<And>x y. \<lbrakk>x \<in> M; y \<in> M\<rbrakk> \<Longrightarrow> mdist m' (f x) (f y) = d x y"
  3370     "\<And>x y. \<lbrakk>x \<in> M; y \<in> M\<rbrakk> \<Longrightarrow> mdist m' (f x) (f y) = d x y"
  3369 proof -
  3371 proof -
  3370   obtain f :: "['a,'a] \<Rightarrow> real" and S where
  3372   obtain f :: "['a,'a] \<Rightarrow> real" and S where
  3371     Ssub: "S \<subseteq> mspace(funspace M euclidean_metric)"
  3373     Ssub: "S \<subseteq> mspace(funspace M euclidean_metric)"
  3372     and mcom: "mcomplete_of (submetric (funspace M euclidean_metric) S)"
  3374     and mcom: "mcomplete_of (submetric (funspace M euclidean_metric) S)"
  3373     and fim: "f ` M \<subseteq> S"
  3375     and fim: "f \<in> M \<rightarrow> S"
  3374     and eqS: "mtopology_of(funspace M euclidean_metric) closure_of f ` M = S"
  3376     and eqS: "mtopology_of(funspace M euclidean_metric) closure_of f ` M = S"
  3375     and eqd: "\<And>x y. \<lbrakk>x \<in> M; y \<in> M\<rbrakk> \<Longrightarrow> mdist (funspace M euclidean_metric) (f x) (f y) = d x y"
  3377     and eqd: "\<And>x y. \<lbrakk>x \<in> M; y \<in> M\<rbrakk> \<Longrightarrow> mdist (funspace M euclidean_metric) (f x) (f y) = d x y"
  3376     using metric_completion_explicit by metis
  3378     using metric_completion_explicit by metis
  3377   define m' where "m' \<equiv> submetric (funspace M euclidean_metric) S"
  3379   define m' where "m' \<equiv> submetric (funspace M euclidean_metric) S"
  3378   show thesis
  3380   show thesis
  3379   proof
  3381   proof
  3380     show "mcomplete_of m'"
  3382     show "mcomplete_of m'"
  3381       by (simp add: mcom m'_def)
  3383       by (simp add: mcom m'_def)
  3382     show "f ` M \<subseteq> mspace m'"
  3384     show "f \<in> M \<rightarrow> mspace m'"
  3383       using Ssub fim m'_def by auto
  3385       using Ssub fim m'_def by auto
  3384     show "mtopology_of m' closure_of f ` M = mspace m'"
  3386     show "mtopology_of m' closure_of f ` M = mspace m'"
  3385       using eqS fim Ssub
  3387       using eqS fim Ssub
  3386       by (force simp: m'_def mtopology_of_submetric closure_of_subtopology Int_absorb1)
  3388       by (force simp: m'_def mtopology_of_submetric closure_of_subtopology Int_absorb1 image_subset_iff_funcset)
  3387     show "mdist m' (f x) (f y) = d x y" if "x \<in> M" and "y \<in> M" for x y
  3389     show "mdist m' (f x) (f y) = d x y" if "x \<in> M" and "y \<in> M" for x y
  3388       using that eqd m'_def by force 
  3390       using that eqd m'_def by force 
  3389   qed 
  3391   qed 
  3390 qed
  3392 qed
  3391 
  3393 
  3398   obtain M d where "Metric_space M d" and Xeq: "X = Metric_space.mtopology M d"
  3400   obtain M d where "Metric_space M d" and Xeq: "X = Metric_space.mtopology M d"
  3399     using assms metrizable_space_def by blast
  3401     using assms metrizable_space_def by blast
  3400   then interpret Metric_space M d by simp
  3402   then interpret Metric_space M d by simp
  3401   obtain f :: "['a,'a] \<Rightarrow> real" and m' where
  3403   obtain f :: "['a,'a] \<Rightarrow> real" and m' where
  3402     "mcomplete_of m'"
  3404     "mcomplete_of m'"
  3403     and fim: "f ` M \<subseteq> mspace m' "
  3405     and fim: "f \<in> M \<rightarrow> mspace m' "
  3404     and m': "mtopology_of m' closure_of f ` M = mspace m'"
  3406     and m': "mtopology_of m' closure_of f ` M = mspace m'"
  3405     and eqd: "\<And>x y. \<lbrakk>x \<in> M; y \<in> M\<rbrakk> \<Longrightarrow> mdist m' (f x) (f y) = d x y"
  3407     and eqd: "\<And>x y. \<lbrakk>x \<in> M; y \<in> M\<rbrakk> \<Longrightarrow> mdist m' (f x) (f y) = d x y"
  3406     by (meson metric_completion)
  3408     by (metis metric_completion)
  3407   show thesis
  3409   show thesis
  3408   proof
  3410   proof
  3409     show "completely_metrizable_space (mtopology_of m')"
  3411     show "completely_metrizable_space (mtopology_of m')"
  3410       using \<open>mcomplete_of m'\<close>
  3412       using \<open>mcomplete_of m'\<close>
  3411       unfolding completely_metrizable_space_def mcomplete_of_def mtopology_of_def
  3413       unfolding completely_metrizable_space_def mcomplete_of_def mtopology_of_def
  3412       by (metis Metric_space_mspace_mdist)
  3414       by (metis Metric_space_mspace_mdist)
  3413     show "embedding_map X (mtopology_of m') f"
  3415     show "embedding_map X (mtopology_of m') f"
  3414       using Metric_space12.isometry_imp_embedding_map
  3416       using Metric_space12.isometry_imp_embedding_map
  3415       by (metis Metric_space12_def Metric_space_axioms Metric_space_mspace_mdist Xeq eqd fim mtopology_of_def)
  3417       by (metis Metric_space12_def Metric_space_axioms Metric_space_mspace_mdist Xeq eqd fim 
       
  3418              mtopology_of_def)
  3416     show "(mtopology_of m') closure_of f ` topspace X = topspace (mtopology_of m')"
  3419     show "(mtopology_of m') closure_of f ` topspace X = topspace (mtopology_of m')"
  3417       by (simp add: Xeq m')
  3420       by (simp add: Xeq m')
  3418   qed
  3421   qed
  3419 qed
  3422 qed
  3420 
  3423 
  3422 
  3425 
  3423 subsection\<open>Contractions\<close>
  3426 subsection\<open>Contractions\<close>
  3424 
  3427 
  3425 lemma (in Metric_space) contraction_imp_unique_fixpoint:
  3428 lemma (in Metric_space) contraction_imp_unique_fixpoint:
  3426   assumes "f x = x" "f y = y"
  3429   assumes "f x = x" "f y = y"
  3427     and "f ` M \<subseteq> M"
  3430     and "f \<in> M \<rightarrow> M"
  3428     and "k < 1"
  3431     and "k < 1"
  3429     and "\<And>x y. \<lbrakk>x \<in> M; y \<in> M\<rbrakk> \<Longrightarrow> d (f x) (f y) \<le> k * d x y"
  3432     and "\<And>x y. \<lbrakk>x \<in> M; y \<in> M\<rbrakk> \<Longrightarrow> d (f x) (f y) \<le> k * d x y"
  3430     and "x \<in> M" "y \<in> M"
  3433     and "x \<in> M" "y \<in> M"
  3431   shows "x = y"
  3434   shows "x = y"
  3432   by (smt (verit, ccfv_SIG) Metric_space.mdist_pos_less Metric_space_axioms assms mult_le_cancel_right1)
  3435   by (smt (verit, ccfv_SIG) Metric_space.mdist_pos_less Metric_space_axioms assms mult_le_cancel_right1)
  3433 
  3436 
  3434 text \<open>Banach Fixed-Point Theorem (aka, Contraction Mapping Principle)\<close>
  3437 text \<open>Banach Fixed-Point Theorem (aka, Contraction Mapping Principle)\<close>
  3435 lemma (in Metric_space) Banach_fixedpoint_thm:
  3438 lemma (in Metric_space) Banach_fixedpoint_thm:
  3436   assumes mcomplete and "M \<noteq> {}" and fim: "f ` M \<subseteq> M"    
  3439   assumes mcomplete and "M \<noteq> {}" and fim: "f \<in> M \<rightarrow> M"    
  3437     and "k < 1"
  3440     and "k < 1"
  3438     and con: "\<And>x y. \<lbrakk>x \<in> M; y \<in> M\<rbrakk> \<Longrightarrow> d (f x) (f y) \<le> k * d x y"
  3441     and con: "\<And>x y. \<lbrakk>x \<in> M; y \<in> M\<rbrakk> \<Longrightarrow> d (f x) (f y) \<le> k * d x y"
  3439   obtains x where "x \<in> M" "f x = x"
  3442   obtains x where "x \<in> M" "f x = x"
  3440 proof -
  3443 proof -
  3441   obtain a where "a \<in> M"
  3444   obtain a where "a \<in> M"
  3442     using \<open>M \<noteq> {}\<close> by blast
  3445     using \<open>M \<noteq> {}\<close> by blast
  3443   show thesis
  3446   show thesis
  3444   proof (cases "\<forall>x \<in> M. f x = f a")
  3447   proof (cases "\<forall>x \<in> M. f x = f a")
  3445     case True
  3448     case True
  3446     then show ?thesis
  3449     then show ?thesis
  3447       by (metis \<open>a \<in> M\<close> fim image_subset_iff that)
  3450       by (metis \<open>a \<in> M\<close> fim image_subset_iff image_subset_iff_funcset that)
  3448   next
  3451   next
  3449     case False
  3452     case False
  3450     then obtain b where "b \<in> M" and b: "f b \<noteq> f a"
  3453     then obtain b where "b \<in> M" and b: "f b \<noteq> f a"
  3451       by blast
  3454       by blast
  3452     have "k>0"
  3455     have "k>0"
  3470           show "range \<sigma> \<subseteq> M"
  3473           show "range \<sigma> \<subseteq> M"
  3471             using f_iter by blast
  3474             using f_iter by blast
  3472           fix \<epsilon>::real
  3475           fix \<epsilon>::real
  3473           assume "\<epsilon>>0"
  3476           assume "\<epsilon>>0"
  3474           with \<open>k < 1\<close> \<open>f a \<noteq> a\<close> \<open>a \<in> M\<close> fim have gt0: "((1 - k) * \<epsilon>) / d a (f a) > 0"
  3477           with \<open>k < 1\<close> \<open>f a \<noteq> a\<close> \<open>a \<in> M\<close> fim have gt0: "((1 - k) * \<epsilon>) / d a (f a) > 0"
  3475             by (fastforce simp: divide_simps)
  3478             by (fastforce simp: divide_simps Pi_iff)
  3476           obtain N where "k^N < ((1-k) * \<epsilon>) / d a (f a)"
  3479           obtain N where "k^N < ((1-k) * \<epsilon>) / d a (f a)"
  3477             using real_arch_pow_inv [OF gt0 \<open>k < 1\<close>] by blast
  3480             using real_arch_pow_inv [OF gt0 \<open>k < 1\<close>] by blast
  3478           then have N: "\<And>n. n \<ge> N \<Longrightarrow> k^n < ((1-k) * \<epsilon>) / d a (f a)"
  3481           then have N: "\<And>n. n \<ge> N \<Longrightarrow> k^n < ((1-k) * \<epsilon>) / d a (f a)"
  3479             by (smt (verit) \<open>0 < k\<close> assms(4) power_decreasing)
  3482             by (smt (verit) \<open>0 < k\<close> assms(4) power_decreasing)
  3480           have "\<forall>n n'. n<n' \<longrightarrow> N \<le> n \<longrightarrow> N \<le> n' \<longrightarrow> d (\<sigma> n) (\<sigma> n') < \<epsilon>"
  3483           have "\<forall>n n'. n<n' \<longrightarrow> N \<le> n \<longrightarrow> N \<le> n' \<longrightarrow> d (\<sigma> n) (\<sigma> n') < \<epsilon>"
  3990 lemma completely_regular_space_cube_embedding_explicit:
  3993 lemma completely_regular_space_cube_embedding_explicit:
  3991   assumes "completely_regular_space X" "Hausdorff_space X"
  3994   assumes "completely_regular_space X" "Hausdorff_space X"
  3992   shows "embedding_map X
  3995   shows "embedding_map X
  3993              (product_topology (\<lambda>f. top_of_set {0..1::real})
  3996              (product_topology (\<lambda>f. top_of_set {0..1::real})
  3994                 (mspace (submetric (cfunspace X euclidean_metric)
  3997                 (mspace (submetric (cfunspace X euclidean_metric)
  3995                   {f. f ` topspace X \<subseteq> {0..1}})) )
  3998                   {f. f \<in> topspace X \<rightarrow> {0..1}})) )
  3996              (\<lambda>x. \<lambda>f \<in> mspace (submetric (cfunspace X euclidean_metric) {f. f ` topspace X \<subseteq> {0..1}}).
  3999              (\<lambda>x. \<lambda>f \<in> mspace (submetric (cfunspace X euclidean_metric) {f. f \<in> topspace X \<rightarrow> {0..1}}).
  3997               f x)"
  4000               f x)"
  3998 proof -
  4001 proof -
  3999   define K where "K \<equiv> mspace(submetric (cfunspace X euclidean_metric) {f. f ` topspace X \<subseteq> {0..1::real}})"
  4002   define K where "K \<equiv> mspace(submetric (cfunspace X euclidean_metric) {f. f \<in> topspace X \<rightarrow> {0..1::real}})"
  4000   define e where "e \<equiv> \<lambda>x. \<lambda>f\<in>K. f x"
  4003   define e where "e \<equiv> \<lambda>x. \<lambda>f\<in>K. f x"
  4001   have "e x \<noteq> e y" if xy: "x \<noteq> y" "x \<in> topspace X" "y \<in> topspace X" for x y
  4004   have "e x \<noteq> e y" if xy: "x \<noteq> y" "x \<in> topspace X" "y \<in> topspace X" for x y
  4002   proof -
  4005   proof -
  4003     have "closedin X {x}"
  4006     have "closedin X {x}"
  4004       by (simp add: \<open>Hausdorff_space X\<close> closedin_Hausdorff_singleton \<open>x \<in> topspace X\<close>)
  4007       by (simp add: \<open>Hausdorff_space X\<close> closedin_Hausdorff_singleton \<open>x \<in> topspace X\<close>)
  4021   proof (clarsimp simp add: continuous_map_atin limitin_atin openin_subtopology_alt e')
  4024   proof (clarsimp simp add: continuous_map_atin limitin_atin openin_subtopology_alt e')
  4022     fix x U
  4025     fix x U
  4023     assume "e x \<in> K \<rightarrow>\<^sub>E {0..1}" and "x \<in> topspace X" and "openin X U" and "x \<in> U"
  4026     assume "e x \<in> K \<rightarrow>\<^sub>E {0..1}" and "x \<in> topspace X" and "openin X U" and "x \<in> U"
  4024     then obtain g where contg: "continuous_map X (top_of_set {0..1}) g" and "g x = 0" 
  4027     then obtain g where contg: "continuous_map X (top_of_set {0..1}) g" and "g x = 0" 
  4025           and gim: "g ` (topspace X - U) \<subseteq> {1::real}"
  4028           and gim: "g ` (topspace X - U) \<subseteq> {1::real}"
  4026       using \<open>completely_regular_space X\<close> unfolding completely_regular_space_def
  4029       using \<open>completely_regular_space X\<close> unfolding completely_regular_space_def 
  4027       by (metis Diff_iff openin_closedin_eq)
  4030       by (metis Diff_iff openin_closedin_eq)
  4028     then have "bounded (g ` topspace X)"
  4031     then have "bounded (g ` topspace X)"
  4029       by (meson bounded_closed_interval bounded_subset continuous_map_in_subtopology)
  4032       by (meson bounded_closed_interval bounded_subset continuous_map_in_subtopology)
  4030     moreover have "g ` topspace X \<subseteq> {0..1}"
  4033     moreover have "g \<in> topspace X \<rightarrow> {0..1}"
  4031       using contg by (simp add: continuous_map_in_subtopology)
  4034       using contg by (simp add: continuous_map_def)
  4032     ultimately have g_in_K: "restrict g (topspace X) \<in> K"
  4035     ultimately have g_in_K: "restrict g (topspace X) \<in> K"
  4033       using contg by (simp add: K_def continuous_map_in_subtopology)
  4036       using contg by (force simp add: K_def continuous_map_in_subtopology)
  4034     have "openin (top_of_set {0..1}) {0..<1::real}"
  4037     have "openin (top_of_set {0..1}) {0..<1::real}"
  4035       using open_real_greaterThanLessThan[of "-1" 1] by (force simp: openin_open)
  4038       using open_real_greaterThanLessThan[of "-1" 1] by (force simp: openin_open)
  4036     moreover have "e x \<in> (\<Pi>\<^sub>E f\<in>K. if f = restrict g (topspace X) then {0..<1} else {0..1})"
  4039     moreover have "e x \<in> (\<Pi>\<^sub>E f\<in>K. if f = restrict g (topspace X) then {0..<1} else {0..1})"
  4037       using \<open>e x \<in> K \<rightarrow>\<^sub>E {0..1}\<close> by (simp add: e_def \<open>g x = 0\<close> \<open>x \<in> topspace X\<close> PiE_iff)
  4040       using \<open>e x \<in> K \<rightarrow>\<^sub>E {0..1}\<close> by (simp add: e_def \<open>g x = 0\<close> \<open>x \<in> topspace X\<close> PiE_iff)
  4038     moreover have "e y = e x"
  4041     moreover have "e y = e x"