diff -r f3d19c8445ec -r 24b70433c2e8 src/HOL/Analysis/Urysohn.thy --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/HOL/Analysis/Urysohn.thy Tue May 30 12:33:06 2023 +0100 @@ -0,0 +1,2238 @@ +(* Title: HOL/Analysis/Arcwise_Connected.thy + Authors: LC Paulson, based on material from HOL Light +*) + +section \Urysohn lemma and its Consequences\ + +theory Urysohn +imports Abstract_Topological_Spaces Abstract_Metric_Spaces Infinite_Sum Arcwise_Connected +begin + +subsection \Urysohn lemma and Tietze's theorem\ + +lemma Urysohn_lemma: + fixes a b :: real + assumes "normal_space X" "closedin X S" "closedin X T" "disjnt S T" "a \ b" + obtains f where "continuous_map X (top_of_set {a..b}) f" "f ` S \ {a}" "f ` T \ {b}" +proof - + obtain U where "openin X U" "S \ U" "X closure_of U \ topspace X - T" + using assms unfolding normal_space_alt disjnt_def + by (metis Diff_mono Un_Diff_Int closedin_def subset_eq sup_bot_right) + have "\G :: real \ 'a set. G 0 = U \ G 1 = topspace X - T \ + (\x \ dyadics \ {0..1}. \y \ dyadics \ {0..1}. x < y \ openin X (G x) \ openin X (G y) \ X closure_of (G x) \ G y)" + proof (rule recursion_on_dyadic_fractions) + show "openin X U \ openin X (topspace X - T) \ X closure_of U \ topspace X - T" + using \X closure_of U \ topspace X - T\ \openin X U\ \closedin X T\ by blast + show "\z. (openin X x \ openin X z \ X closure_of x \ z) \ openin X z \ openin X y \ X closure_of z \ y" + if "openin X x \ openin X y \ X closure_of x \ y" for x y + by (meson that closedin_closure_of normal_space_alt \normal_space X\) + show "openin X x \ openin X z \ X closure_of x \ z" + if "openin X x \ openin X y \ X closure_of x \ y" and "openin X y \ openin X z \ X closure_of y \ z" for x y z + by (meson that closure_of_subset openin_subset subset_trans) + qed + then obtain G :: "real \ 'a set" + where G0: "G 0 = U" and G1: "G 1 = topspace X - T" + and G: "\x y. \x \ dyadics; y \ dyadics; 0 \ x; x < y; y \ 1\ + \ openin X (G x) \ openin X (G y) \ X closure_of (G x) \ G y" + by (smt (verit, del_insts) Int_iff atLeastAtMost_iff) + define f where "f \ \x. Inf(insert 1 {r. r \ dyadics \ {0..1} \ x \ G r})" + have f_ge: "f x \ 0" if "x \ topspace X" for x + unfolding f_def by (force intro: cInf_greatest) + moreover have f_le1: "f x \ 1" if "x \ topspace X" for x + proof - + have "bdd_below {r \ dyadics \ {0..1}. x \ G r}" + by (auto simp: bdd_below_def) + then show ?thesis + by (auto simp: f_def cInf_lower) + qed + ultimately have fim: "f ` topspace X \ {0..1}" + by (auto simp: f_def) + have 0: "0 \ dyadics \ {0..1::real}" and 1: "1 \ dyadics \ {0..1::real}" + by (force simp: dyadics_def)+ + then have opeG: "openin X (G r)" if "r \ dyadics \ {0..1}" for r + using G G0 \openin X U\ less_eq_real_def that by auto + have "x \ G 0" if "x \ S" for x + using G0 \S \ U\ that by blast + with 0 have fimS: "f ` S \ {0}" + unfolding f_def by (force intro!: cInf_eq_minimum) + have False if "r \ dyadics" "0 \ r" "r < 1" "x \ G r" "x \ T" for r x + using G [of r 1] 1 + by (smt (verit, best) DiffD2 G1 Int_iff closure_of_subset inf.orderE openin_subset that) + then have "r\1" if "r \ dyadics" "0 \ r" "r \ 1" "x \ G r" "x \ T" for r x + using linorder_not_le that by blast + then have fimT: "f ` T \ {1}" + unfolding f_def by (force intro!: cInf_eq_minimum) + have fle1: "f z \ 1" for z + by (force simp: f_def intro: cInf_lower) + have fle: "f z \ x" if "x \ dyadics \ {0..1}" "z \ G x" for z x + using that by (force simp: f_def intro: cInf_lower) + have *: "b \ f z" if "b \ 1" "\x. \x \ dyadics \ {0..1}; z \ G x\ \ b \ x" for z b + using that by (force simp: f_def intro: cInf_greatest) + have **: "r \ f x" if r: "r \ dyadics \ {0..1}" "x \ G r" for r x + proof (rule *) + show "r \ s" if "s \ dyadics \ {0..1}" and "x \ G s" for s :: real + using that r G [of s r] by (force simp add: dest: closure_of_subset openin_subset) + qed (use that in force) + + have "\U. openin X U \ x \ U \ (\y \ U. \f y - f x\ < \)" + if "x \ topspace X" and "0 < \" for x \ + proof - + have A: "\r. r \ dyadics \ {0..1} \ r < y \ \r - y\ < d" if "0 < y" "y \ 1" "0 < d" for y d::real + proof - + obtain n q r + where "of_nat q / 2^n < y" "y < of_nat r / 2^n" "\q / 2^n - r / 2^n \ < d" + by (smt (verit, del_insts) padic_rational_approximation_straddle_pos \0 < d\ \0 < y\) + then show ?thesis + unfolding dyadics_def + using divide_eq_0_iff that(2) by fastforce + qed + have B: "\r. r \ dyadics \ {0..1} \ y < r \ \r - y\ < d" if "0 \ y" "y < 1" "0 < d" for y d::real + proof - + obtain n q r + where "of_nat q / 2^n \ y" "y < of_nat r / 2^n" "\q / 2^n - r / 2^n \ < d" + using padic_rational_approximation_straddle_pos_le + by (smt (verit, del_insts) \0 < d\ \0 \ y\) + then show ?thesis + apply (clarsimp simp: dyadics_def) + using divide_eq_0_iff \y < 1\ + by (smt (verit) divide_nonneg_nonneg divide_self of_nat_0_le_iff of_nat_1 power_0 zero_le_power) + qed + show ?thesis + proof (cases "f x = 0") + case True + with B[of 0] obtain r where r: "r \ dyadics \ {0..1}" "0 < r" "\r\ < \/2" + by (smt (verit) \0 < \\ half_gt_zero) + show ?thesis + proof (intro exI conjI) + show "openin X (G r)" + using opeG r(1) by blast + show "x \ G r" + using True ** r by force + show "\y \ G r. \f y - f x\ < \" + using f_ge \openin X (G r)\ fle openin_subset r by (fastforce simp: True) + qed + next + case False + show ?thesis + proof (cases "f x = 1") + case True + with A[of 1] obtain r where r: "r \ dyadics \ {0..1}" "r < 1" "\r-1\ < \/2" + by (smt (verit) \0 < \\ half_gt_zero) + define G' where "G' \ topspace X - X closure_of G r" + show ?thesis + proof (intro exI conjI) + show "openin X G'" + unfolding G'_def by fastforce + obtain r' where "r' \ dyadics \ 0 \ r' \ r' \ 1 \ r < r' \ \r' - r\ < 1 - r" + using B r by force + moreover + have "1 - r \ dyadics" "0 \ r" + using 1 r dyadics_diff by force+ + ultimately have "x \ X closure_of G r" + using G True r fle by force + then show "x \ G'" + by (simp add: G'_def that) + show "\y \ G'. \f y - f x\ < \" + using ** f_le1 in_closure_of r by (fastforce simp add: True G'_def) + qed + next + case False + have "0 < f x" "f x < 1" + using fle1 f_ge that(1) \f x \ 0\ \f x \ 1\ by (metis order_le_less) + + obtain r where r: "r \ dyadics \ {0..1}" "r < f x" "\r - f x\ < \ / 2" + using A \0 < \\ \0 < f x\ \f x < 1\ by (smt (verit, best) half_gt_zero) + obtain r' where r': "r' \ dyadics \ {0..1}" "f x < r'" "\r' - f x\ < \ / 2" + using B \0 < \\ \0 < f x\ \f x < 1\ by (smt (verit, best) half_gt_zero) + have "r < 1" + using \f x < 1\ r(2) by force + show ?thesis + proof (intro conjI exI) + show "openin X (G r' - X closure_of G r)" + using closedin_closure_of opeG r' by blast + have "x \ X closure_of G r \ False" + using B [of r "f x - r"] r \r < 1\ G [of r] fle by force + then show "x \ G r' - X closure_of G r" + using ** r' by fastforce + show "\y\G r' - X closure_of G r. \f y - f x\ < \" + using r r' ** G closure_of_subset field_sum_of_halves fle openin_subset subset_eq + by (smt (verit) DiffE opeG) + qed + qed + 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) + define g where "g \ \x. a + (b - a) * f x" + show thesis + proof + have "continuous_map X euclideanreal g" + using contf \a \ b\ unfolding g_def by (auto simp: continuous_intros continuous_map_in_subtopology) + moreover have "g ` (topspace X) \ {a..b}" + using mult_left_le [of "f _" "b-a"] contf \a \ b\ + by (simp add: g_def add.commute continuous_map_in_subtopology image_subset_iff le_diff_eq) + ultimately show "continuous_map X (top_of_set {a..b}) g" + by (meson continuous_map_in_subtopology) + show "g ` S \ {a}" "g ` T \ {b}" + using fimS fimT by (auto simp: g_def) + qed +qed + +lemma Urysohn_lemma_alt: + fixes a b :: real + assumes "normal_space X" "closedin X S" "closedin X T" "disjnt S T" + obtains f where "continuous_map X euclideanreal f" "f ` S \ {a}" "f ` T \ {b}" + by (metis Urysohn_lemma assms continuous_map_in_subtopology disjnt_sym linear) + +lemma normal_space_iff_Urysohn_gen_alt: + assumes "a \ b" + shows "normal_space X \ + (\S T. closedin X S \ closedin X T \ disjnt S T + \ (\f. continuous_map X euclideanreal f \ f ` S \ {a} \ f ` T \ {b}))" + (is "?lhs=?rhs") +proof + show "?lhs \ ?rhs" + by (metis Urysohn_lemma_alt) +next + assume R: ?rhs + show ?lhs + unfolding normal_space_def + proof clarify + fix S T + assume "closedin X S" and "closedin X T" and "disjnt S T" + with R obtain f where contf: "continuous_map X euclideanreal f" and "f ` S \ {a}" "f ` T \ {b}" + by meson + show "\U V. openin X U \ openin X V \ S \ U \ T \ V \ disjnt U V" + proof (intro conjI exI) + show "openin X {x \ topspace X. f x \ ball a (\a - b\ / 2)}" + by (force intro!: openin_continuous_map_preimage [OF contf]) + show "openin X {x \ topspace X. f x \ ball b (\a - b\ / 2)}" + by (force intro!: openin_continuous_map_preimage [OF contf]) + show "S \ {x \ topspace X. f x \ ball a (\a - b\ / 2)}" + using \closedin X S\ closedin_subset \f ` S \ {a}\ assms by force + show "T \ {x \ topspace X. f x \ ball b (\a - b\ / 2)}" + using \closedin X T\ closedin_subset \f ` T \ {b}\ assms by force + have "\x. \x \ topspace X; dist a (f x) < \a-b\/2; dist b (f x) < \a-b\/2\ \ False" + by (smt (verit, best) dist_real_def dist_triangle_half_l) + then show "disjnt {x \ topspace X. f x \ ball a (\a-b\ / 2)} {x \ topspace X. f x \ ball b (\a-b\ / 2)}" + using disjnt_iff by fastforce + qed + qed +qed + +lemma normal_space_iff_Urysohn_gen: + fixes a b::real + shows + "a < b \ + normal_space X \ + (\S T. closedin X S \ closedin X T \ disjnt S T + \ (\f. continuous_map X (top_of_set {a..b}) f \ + f ` S \ {a} \ f ` T \ {b}))" + by (metis linear not_le Urysohn_lemma normal_space_iff_Urysohn_gen_alt continuous_map_in_subtopology) + +lemma normal_space_iff_Urysohn_alt: + "normal_space X \ + (\S T. closedin X S \ closedin X T \ disjnt S T + \ (\f. continuous_map X euclideanreal f \ + f ` S \ {0} \ f ` T \ {1}))" + by (rule normal_space_iff_Urysohn_gen_alt) auto + +lemma normal_space_iff_Urysohn: + "normal_space X \ + (\S T. closedin X S \ closedin X T \ disjnt S T + \ (\f::'a\real. continuous_map X (top_of_set {0..1}) f \ + f ` S \ {0} \ f ` T \ {1}))" + by (rule normal_space_iff_Urysohn_gen) auto + +lemma normal_space_perfect_map_image: + "\normal_space X; perfect_map X Y f\ \ normal_space Y" + unfolding perfect_map_def proper_map_def + using normal_space_continuous_closed_map_image by fastforce + +lemma Hausdorff_normal_space_closed_continuous_map_image: + "\normal_space X; closed_map X Y f; continuous_map X Y f; + f ` topspace X = topspace Y; t1_space Y\ + \ Hausdorff_space Y" + by (metis normal_space_continuous_closed_map_image normal_t1_imp_Hausdorff_space) + +lemma normal_Hausdorff_space_closed_continuous_map_image: + "\normal_space X; Hausdorff_space X; closed_map X Y f; + continuous_map X Y f; f ` topspace X = topspace Y\ + \ normal_space Y \ Hausdorff_space Y" + by (meson normal_space_continuous_closed_map_image normal_t1_eq_Hausdorff_space t1_space_closed_map_image) + +lemma Lindelof_cover: + assumes "regular_space X" and "Lindelof_space X" and "S \ {}" + and clo: "closedin X S" "closedin X T" "disjnt S T" + obtains h :: "nat \ 'a set" where + "\n. openin X (h n)" "\n. disjnt T (X closure_of (h n))" and "S \ \(range h)" +proof - + have "\U. openin X U \ x \ U \ disjnt T (X closure_of U)" + if "x \ S" for x + using \regular_space X\ unfolding regular_space + by (metis (full_types) Diff_iff \disjnt S T\ clo closure_of_eq disjnt_iff in_closure_of that) + then obtain h where oh: "\x. x \ S \ openin X (h x)" + and xh: "\x. x \ S \ x \ h x" + and dh: "\x. x \ S \ disjnt T (X closure_of h x)" + by metis + have "Lindelof_space(subtopology X S)" + by (simp add: Lindelof_space_closedin_subtopology \Lindelof_space X\ \closedin X S\) + then obtain \ where \: "countable \ \ \ \ h ` S \ S \ \\" + unfolding Lindelof_space_subtopology_subset [OF closedin_subset [OF \closedin X S\]] + by (smt (verit, del_insts) oh xh UN_I image_iff subsetI) + with \S \ {}\ have "\ \ {}" + by blast + show ?thesis + proof + show "openin X (from_nat_into \ n)" for n + by (metis \ from_nat_into image_iff \\ \ {}\ oh subsetD) + show "disjnt T (X closure_of (from_nat_into \) n)" for n + using dh from_nat_into [OF \\ \ {}\] + by (metis \ f_inv_into_f inv_into_into subset_eq) + show "S \ \(range (from_nat_into \))" + by (simp add: \ \\ \ {}\) + qed +qed + +lemma regular_Lindelof_imp_normal_space: + assumes "regular_space X" and "Lindelof_space X" + shows "normal_space X" + unfolding normal_space_def +proof clarify + fix S T + assume clo: "closedin X S" "closedin X T" and "disjnt S T" + show "\U V. openin X U \ openin X V \ S \ U \ T \ V \ disjnt U V" + proof (cases "S={} \ T={}") + case True + with clo show ?thesis + by (meson closedin_def disjnt_empty1 disjnt_empty2 openin_empty openin_topspace subset_empty) + next + case False + obtain h :: "nat \ 'a set" where + opeh: "\n. openin X (h n)" and dish: "\n. disjnt T (X closure_of (h n))" + and Sh: "S \ \(range h)" + by (metis Lindelof_cover False \disjnt S T\ assms clo) + obtain k :: "nat \ 'a set" where + opek: "\n. openin X (k n)" and disk: "\n. disjnt S (X closure_of (k n))" + and Tk: "T \ \(range k)" + by (metis Lindelof_cover False \disjnt S T\ assms clo disjnt_sym) + define U where "U \ \i. h i - (\j \i. k i - (\j\i. X closure_of h j)" + show ?thesis + proof (intro exI conjI) + show "openin X U" "openin X V" + unfolding U_def V_def + by (force intro!: opek opeh closedin_Union closedin_closure_of)+ + show "S \ U" "T \ V" + using Sh Tk dish disk by (fastforce simp: U_def V_def disjnt_iff)+ + have "\x i j. \x \ k i; x \ h j; \j\i. x \ X closure_of h j\ + \ \i X closure_of k i" + by (metis in_closure_of linorder_not_less opek openin_subset subsetD) + then show "disjnt U V" + by (force simp add: U_def V_def disjnt_iff) + qed + qed +qed + +lemma Tietze_extension_closed_real_interval: + assumes "normal_space X" and "closedin X S" + and contf: "continuous_map (subtopology X S) euclideanreal f" + and fim: "f ` S \ {a..b}" and "a \ b" + obtains g + where "continuous_map X euclideanreal g" + "\x. x \ S \ g x = f x" "g ` topspace X \ {a..b}" +proof - + define c where "c \ max \a\ \b\ + 1" + have "0 < c" and c: "\x. x \ S \ \f x\ \ c" + using fim by (auto simp: c_def image_subset_iff) + define good where + "good \ \g n. continuous_map X euclideanreal g \ (\x \ S. \f x - g x\ \ c * (2/3)^n)" + have step: "\g. good g (Suc n) \ + (\x \ topspace X. \g x - h x\ \ c * (2/3)^n / 3)" + if h: "good h n" for n h + proof - + have pos: "0 < c * (2/3) ^ n" + by (simp add: \0 < c\) + have S_eq: "S = topspace(subtopology X S)" and "S \ topspace X" + using \closedin X S\ closedin_subset by auto + define d where "d \ c/3 * (2/3) ^ n" + define SA where "SA \ {x \ S. f x - h x \ {..-d}}" + define SB where "SB \ {x \ S. f x - h x \ {d..}}" + have contfh: "continuous_map (subtopology X S) euclideanreal (\x. f x - h x)" + using that + by (simp add: contf good_def continuous_map_diff continuous_map_from_subtopology) + then have "closedin (subtopology X S) SA" + unfolding SA_def + by (smt (verit, del_insts) closed_closedin continuous_map_closedin Collect_cong S_eq closed_real_atMost) + then have "closedin X SA" + using \closedin X S\ closedin_trans_full by blast + moreover have "closedin (subtopology X S) SB" + unfolding SB_def + using closedin_continuous_map_preimage_gen [OF contfh] + by (metis (full_types) S_eq closed_atLeast closed_closedin closedin_topspace) + then have "closedin X SB" + using \closedin X S\ closedin_trans_full by blast + moreover have "disjnt SA SB" + using pos by (auto simp: d_def disjnt_def SA_def SB_def) + moreover have "-d \ d" + using pos by (auto simp: d_def) + ultimately + obtain g where contg: "continuous_map X (top_of_set {- d..d}) g" + and ga: "g ` SA \ {- d}" and gb: "g ` SB \ {d}" + using Urysohn_lemma \normal_space X\ by metis + then have g_le_d: "\x. x \ topspace X \ \g x\ \ d" + by (simp add: abs_le_iff continuous_map_def minus_le_iff) + have g_eq_d: "\x. \x \ S; f x - h x \ -d\ \ g x = -d" + using ga by (auto simp: SA_def) + have g_eq_negd: "\x. \x \ S; f x - h x \ d\ \ g x = d" + using gb by (auto simp: SB_def) + show ?thesis + unfolding good_def + proof (intro conjI strip exI) + show "continuous_map X euclideanreal (\x. h x + g x)" + using contg continuous_map_add continuous_map_in_subtopology that + unfolding good_def by blast + show "\f x - (h x + g x)\ \ c * (2 / 3) ^ Suc n" if "x \ S" for x + proof - + have x: "x \ topspace X" + using \S \ topspace X\ that by auto + have "\f x - h x\ \ c * (2/3) ^ n" + using good_def h that by blast + with g_eq_d [OF that] g_eq_negd [OF that] g_le_d [OF x] + have "\f x - (h x + g x)\ \ d + d" + unfolding d_def by linarith + then show ?thesis + by (simp add: d_def) + qed + show "\h x + g x - h x\ \ c * (2 / 3) ^ n / 3" if "x \ topspace X" for x + using that d_def g_le_d by auto + qed + qed + then obtain nxtg where nxtg: "\h n. good h n \ + good (nxtg h n) (Suc n) \ (\x \ topspace X. \nxtg h n x - h x\ \ c * (2/3)^n / 3)" + by metis + define g where "g \ rec_nat (\x. 0) (\n r. nxtg r n)" + have [simp]: "g 0 x = 0" for x + by (auto simp: g_def) + have g_Suc: "g(Suc n) = nxtg (g n) n" for n + by (auto simp: g_def) + have good: "good (g n) n" for n + proof (induction n) + case 0 + with c show ?case + by (auto simp: good_def) + qed (simp add: g_Suc nxtg) + have *: "\n x. x \ topspace X \ \g(Suc n) x - g n x\ \ c * (2/3) ^ n / 3" + using nxtg g_Suc good by force + obtain h where conth: "continuous_map X euclideanreal h" + and h: "\\. 0 < \ \ \\<^sub>F n in sequentially. \x\topspace X. dist (g n x) (h x) < \" + proof (rule Met_TC.continuous_map_uniformly_Cauchy_limit) + show "\\<^sub>F n in sequentially. continuous_map X (Met_TC.mtopology) (g n)" + using good good_def by fastforce + show "\N. \m n x. N \ m \ N \ n \ x \ topspace X \ dist (g m x) (g n x) < \" + if "\ > 0" for \ + proof - + have "\\<^sub>F n in sequentially. \(2/3) ^ n\ < \/c" + proof (rule Archimedean_eventually_pow_inverse) + show "0 < \ / c" + by (simp add: \0 < c\ that) + qed auto + then obtain N where N: "\n. n \ N \ \(2/3) ^ n\ < \/c" + by (meson eventually_sequentially order_le_less_trans) + have "\g m x - g n x\ < \" + if "N \ m" "N \ n" and x: "x \ topspace X" "m \ n" for m n x + proof (cases "m < n") + case True + have 23: "(\k = m..m \ n\ + by (induction n) (auto simp: le_Suc_eq) + have "\g m x - g n x\ \ \\k = m.." + by (subst sum_Suc_diff' [OF \m \ n\]) linarith + also have "\ \ (\k = m..g (Suc k) x - g k x\)" + by (rule sum_abs) + also have "\ \ (\k = m.. = (c/3) * (\k = m.. = (c/3) * 3 * ((2/3) ^ m - (2/3) ^ n)" + by (simp add: sum_distrib_left 23) + also have "... < (c/3) * 3 * ((2/3) ^ m)" + using \0 < c\ by auto + also have "\ < \" + using N [OF \N \ m\] \0 < c\ by (simp add: field_simps) + finally show ?thesis . + qed (use \0 < \\ \m \ n\ in auto) + then show ?thesis + by (metis dist_commute_lessI dist_real_def nle_le) + qed + qed auto + define \ where "\ \ \x. max a (min (h x) b)" + show thesis + proof + show "continuous_map X euclidean \" + unfolding \_def using conth by (intro continuous_intros) auto + show "\ x = f x" if "x \ S" for x + proof - + have x: "x \ topspace X" + using \closedin X S\ closedin_subset that by blast + have "h x = f x" + proof (rule Met_TC.limitin_metric_unique) + show "limitin Met_TC.mtopology (\n. g n x) (h x) sequentially" + using h x by (force simp: tendsto_iff eventually_sequentially) + show "limitin Met_TC.mtopology (\n. g n x) (f x) sequentially" + proof (clarsimp simp: tendsto_iff) + fix \::real + assume "\ > 0" + then have "\\<^sub>F n in sequentially. \(2/3) ^ n\ < \/c" + by (intro Archimedean_eventually_pow_inverse) (auto simp: \c > 0\) + then show "\\<^sub>F n in sequentially. dist (g n x) (f x) < \" + apply eventually_elim + by (smt (verit) good x good_def \c > 0\ dist_real_def mult.commute pos_less_divide_eq that) + qed + qed auto + then show ?thesis + using that fim by (auto simp: \_def) + qed + then show "\ ` topspace X \ {a..b}" + using fim \a \ b\ by (auto simp: \_def) + qed +qed + + +lemma Tietze_extension_realinterval: + assumes XS: "normal_space X" "closedin X S" and T: "is_interval T" "T \ {}" + and contf: "continuous_map (subtopology X S) euclideanreal f" + and "f ` S \ T" + obtains g where "continuous_map X euclideanreal g" "g ` topspace X \ T" "\x. x \ S \ g x = f x" +proof - + define \ where + "\ \ \T::real set. \f. continuous_map (subtopology X S) euclidean f \ f`S \ T + \ (\g. continuous_map X euclidean g \ g ` topspace X \ T \ (\x \ S. g x = f x))" + have "\ T" + if *: "\T. \bounded T; is_interval T; T \ {}\ \ \ T" + and "is_interval T" "T \ {}" for T + unfolding \_def + proof (intro strip) + fix f + assume contf: "continuous_map (subtopology X S) euclideanreal f" + and "f ` S \ T" + have \T: "\ ((\x. x / (1 + \x\)) ` T)" + proof (rule *) + show "bounded ((\x. x / (1 + \x\)) ` T)" + using shrink_range [of T] by (force intro: boundedI [where B=1]) + show "is_interval ((\x. x / (1 + \x\)) ` T)" + using connected_shrink that(2) is_interval_connected_1 by blast + show "(\x. x / (1 + \x\)) ` T \ {}" + using \T \ {}\ by auto + qed + moreover have "continuous_map (subtopology X S) euclidean ((\x. x / (1 + \x\)) \ f)" + by (metis contf continuous_map_compose continuous_map_into_fulltopology continuous_map_real_shrink) + moreover have "((\x. x / (1 + \x\)) \ f) ` S \ (\x. x / (1 + \x\)) ` T" + using \f ` S \ T\ by auto + ultimately obtain g + where contg: "continuous_map X euclidean g" + and gim: "g ` topspace X \ (\x. x / (1 + \x\)) ` T" + and geq: "\x. x \ S \ g x = ((\x. x / (1 + \x\)) \ f) x" + using \T unfolding \_def by force + show "\g. continuous_map X euclideanreal g \ g ` topspace X \ T \ (\x\S. g x = f x)" + proof (intro conjI exI) + have "continuous_map X (top_of_set {-1<..<1}) g" + using contg continuous_map_in_subtopology gim shrink_range by blast + then show "continuous_map X euclideanreal ((\x. x / (1 - \x\)) \ g)" + by (rule continuous_map_compose) (auto simp: continuous_on_real_grow) + show "((\x. x / (1 - \x\)) \ g) ` topspace X \ T" + using gim real_grow_shrink by fastforce + show "\x\S. ((\x. x / (1 - \x\)) \ g) x = f x" + using geq real_grow_shrink by force + qed + qed + moreover have "\ T" + if "bounded T" "is_interval T" "T \ {}" for T + unfolding \_def + proof (intro strip) + fix f + assume contf: "continuous_map (subtopology X S) euclideanreal f" + and "f ` S \ T" + obtain a b where ab: "closure T = {a..b}" + by (meson \bounded T\ \is_interval T\ compact_closure connected_compact_interval_1 + connected_imp_connected_closure is_interval_connected) + with \T \ {}\ have "a \ b" by auto + have "f ` S \ {a..b}" + using \f ` S \ T\ ab closure_subset by auto + then obtain g where contg: "continuous_map X euclideanreal g" + and gf: "\x. x \ S \ g x = f x" and gim: "g ` topspace X \ {a..b}" + using Tietze_extension_closed_real_interval [OF XS contf _ \a \ b\] by metis + define W where "W \ {x \ topspace X. g x \ closure T - T}" + have "{a..b} - {a, b} \ T" + using that + by (metis ab atLeastAtMost_diff_ends convex_interior_closure interior_atLeastAtMost_real + interior_subset is_interval_convex) + with finite_imp_compact have "compact (closure T - T)" + by (metis Diff_eq_empty_iff Diff_insert2 ab finite.emptyI finite_Diff_insert) + then have "closedin X W" + unfolding W_def using closedin_continuous_map_preimage [OF contg] compact_imp_closed by force + moreover have "disjnt W S" + unfolding W_def disjnt_iff using \f ` S \ T\ gf by blast + ultimately obtain h :: "'a \ real" + where conth: "continuous_map X (top_of_set {0..1}) h" + and him: "h ` W \ {0}" "h ` S \ {1}" + by (metis XS normal_space_iff_Urysohn) + then have him01: "h ` topspace X \ {0..1}" + by (meson continuous_map_in_subtopology) + obtain z where "z \ T" + using \T \ {}\ by blast + define g' where "g' \ \x. z + h x * (g x - z)" + show "\g. continuous_map X euclidean g \ g ` topspace X \ T \ (\x\S. g x = f x)" + proof (intro exI conjI) + show "continuous_map X euclideanreal g'" + unfolding g'_def using contg conth continuous_map_in_subtopology + by (intro continuous_intros) auto + show "g' ` topspace X \ T" + unfolding g'_def + proof clarify + fix x + assume "x \ topspace X" + show "z + h x * (g x - z) \ T" + proof (cases "g x \ T") + case True + define w where "w \ z + h x * (g x - z)" + have "\h x\ * \g x - z\ \ \g x - z\" "\1 - h x\ * \g x - z\ \ \g x - z\" + using him01 \x \ topspace X\ by (force simp: intro: mult_left_le_one_le)+ + then consider "z \ w \ w \ g x" | "g x \ w \ w \ z" + unfolding w_def by (smt (verit) left_diff_distrib mult_cancel_right2 mult_minus_right zero_less_mult_iff) + then show ?thesis + using \is_interval T\ unfolding w_def is_interval_1 by (metis True \z \ T\) + next + case False + then have "g x \ closure T" + using \x \ topspace X\ ab gim by blast + then have "h x = 0" + using him False \x \ topspace X\ by (auto simp: W_def image_subset_iff) + then show ?thesis + by (simp add: \z \ T\) + qed + qed + show "\x\S. g' x = f x" + using gf him by (auto simp: W_def g'_def) + qed + qed + ultimately show thesis + using assms that unfolding \_def by best +qed + +lemma normal_space_iff_Tietze: + "normal_space X \ + (\f S. closedin X S \ + continuous_map (subtopology X S) euclidean f + \ (\g:: 'a \ real. continuous_map X euclidean g \ (\x \ S. g x = f x)))" + (is "?lhs \ ?rhs") +proof + assume ?lhs + then show ?rhs + by (metis Tietze_extension_realinterval empty_not_UNIV is_interval_univ subset_UNIV) +next + assume R: ?rhs + show ?lhs + unfolding normal_space_iff_Urysohn_alt + proof clarify + fix S T + assume "closedin X S" + and "closedin X T" + and "disjnt S T" + then have cloST: "closedin X (S \ T)" + by (simp add: closedin_Un) + moreover + have "continuous_map (subtopology X (S \ T)) euclideanreal (\x. if x \ S then 0 else 1)" + unfolding continuous_map_closedin + proof (intro conjI strip) + fix C :: "real set" + define D where "D \ {x \ topspace X. if x \ S then 0 \ C else x \ T \ 1 \ C}" + have "D \ {{}, S, T, S \ T}" + unfolding D_def + using closedin_subset [OF \closedin X S\] closedin_subset [OF \closedin X T\] \disjnt S T\ + by (auto simp: disjnt_iff) + then have "closedin X D" + using \closedin X S\ \closedin X T\ closedin_empty by blast + with closedin_subset_topspace + show "closedin (subtopology X (S \ T)) {x \ topspace (subtopology X (S \ T)). (if x \ S then 0::real else 1) \ C}" + apply (simp add: D_def) + by (smt (verit, best) Collect_cong Collect_mono_iff Un_def closedin_subset_topspace) + qed auto + ultimately obtain g :: "'a \ real" where + contg: "continuous_map X euclidean g" and gf: "\x \ S \ T. g x = (if x \ S then 0 else 1)" + using R by blast + then show "\f. continuous_map X euclideanreal f \ f ` S \ {0} \ f ` T \ {1}" + by (smt (verit) Un_iff \disjnt S T\ disjnt_iff image_subset_iff insert_iff) + qed +qed + +subsection \random metric space stuff\ + + +lemma metrizable_imp_k_space: + assumes "metrizable_space X" + shows "k_space X" +proof - + obtain M d where "Metric_space M d" and Xeq: "X = Metric_space.mtopology M d" + using assms unfolding metrizable_space_def by metis + then interpret Metric_space M d + by blast + show ?thesis + unfolding k_space Xeq + proof clarsimp + fix S + assume "S \ M" and S: "\K. compactin mtopology K \ closedin (subtopology mtopology K) (K \ S)" + have "l \ S" + if \: "range \ \ S" and l: "limitin mtopology \ l sequentially" for \ l + proof - + define K where "K \ insert l (range \)" + interpret Submetric M d K + proof + show "K \ M" + unfolding K_def using l limitin_mspace \S \ M\ \ by blast + qed + have "compactin mtopology K" + unfolding K_def using \S \ M\ \ + by (force intro: compactin_sequence_with_limit [OF l]) + then have *: "closedin sub.mtopology (K \ S)" + by (simp add: S mtopology_submetric) + have "\ n \ K \ S" for n + by (simp add: K_def range_subsetD \) + moreover have "limitin sub.mtopology \ l sequentially" + using l + unfolding sub.limit_metric_sequentially limit_metric_sequentially + by (force simp: K_def) + ultimately have "l \ K \ S" + by (meson * \ image_subsetI sub.metric_closedin_iff_sequentially_closed) + then show ?thesis + by simp + qed + then show "closedin mtopology S" + unfolding metric_closedin_iff_sequentially_closed + using \S \ M\ by blast + qed +qed + +lemma (in Metric_space) k_space_mtopology: "k_space mtopology" + by (simp add: metrizable_imp_k_space metrizable_space_mtopology) + +lemma k_space_euclideanreal: "k_space (euclidean :: 'a::metric_space topology)" + using metrizable_imp_k_space metrizable_space_euclidean by auto + + +subsection\Hereditarily normal spaces\ + +lemma hereditarily_B: + assumes "\S T. separatedin X S T + \ \U V. openin X U \ openin X V \ S \ U \ T \ V \ disjnt U V" + shows "hereditarily normal_space X" + unfolding hereditarily_def +proof (intro strip) + fix W + assume "W \ topspace X" + show "normal_space (subtopology X W)" + unfolding normal_space_def + proof clarify + fix S T + assume clo: "closedin (subtopology X W) S" "closedin (subtopology X W) T" + and "disjnt S T" + then have "separatedin (subtopology X W) S T" + by (simp add: separatedin_closed_sets) + then obtain U V where "openin X U \ openin X V \ S \ U \ T \ V \ disjnt U V" + using assms [of S T] by (meson separatedin_subtopology) + then show "\U V. openin (subtopology X W) U \ openin (subtopology X W) V \ S \ U \ T \ V \ disjnt U V" + apply (simp add: openin_subtopology_alt) + by (meson clo closedin_imp_subset disjnt_subset1 disjnt_subset2 inf_le2) + qed +qed + +lemma hereditarily_C: + assumes "separatedin X S T" and norm: "\U. openin X U \ normal_space (subtopology X U)" + shows "\U V. openin X U \ openin X V \ S \ U \ T \ V \ disjnt U V" +proof - + define ST where "ST \ X closure_of S \ X closure_of T" + have subX: "S \ topspace X" "T \ topspace X" + by (meson \separatedin X S T\ separation_closedin_Un_gen)+ + have sub: "S \ topspace X - ST" "T \ topspace X - ST" + unfolding ST_def + by (metis Diff_mono Diff_triv \separatedin X S T\ Int_lower1 Int_lower2 separatedin_def)+ + have "normal_space (subtopology X (topspace X - ST))" + by (simp add: ST_def norm closedin_Int openin_diff) + moreover have " disjnt (subtopology X (topspace X - ST) closure_of S) + (subtopology X (topspace X - ST) closure_of T)" + using Int_absorb1 ST_def sub by (fastforce simp: disjnt_iff closure_of_subtopology) + ultimately show ?thesis + using sub subX + apply (simp add: normal_space_closures) + by (metis ST_def closedin_Int closedin_closure_of closedin_def openin_trans_full) +qed + +lemma hereditarily_normal_space: + "hereditarily normal_space X \ (\U. openin X U \ normal_space(subtopology X U))" + by (metis hereditarily_B hereditarily_C hereditarily) + +lemma hereditarily_normal_separation: + "hereditarily normal_space X \ + (\S T. separatedin X S T + \ (\U V. openin X U \ openin X V \ S \ U \ T \ V \ disjnt U V))" + by (metis hereditarily_B hereditarily_C hereditarily) + + +lemma metrizable_imp_hereditarily_normal_space: + "metrizable_space X \ hereditarily normal_space X" + by (simp add: hereditarily metrizable_imp_normal_space metrizable_space_subtopology) + +lemma metrizable_space_separation: + "\metrizable_space X; separatedin X S T\ + \ \U V. openin X U \ openin X V \ S \ U \ T \ V \ disjnt U V" + by (metis hereditarily hereditarily_C metrizable_imp_hereditarily_normal_space) + +lemma hereditarily_normal_separation_pairwise: + "hereditarily normal_space X \ + (\\. finite \ \ (\S \ \. S \ topspace X) \ pairwise (separatedin X) \ + \ (\\. (\S \ \. openin X (\ S) \ S \ \ S) \ + pairwise (\S T. disjnt (\ S) (\ T)) \))" + (is "?lhs \ ?rhs") +proof + assume L: ?lhs + show ?rhs + proof clarify + fix \ + assume "finite \" and \: "\S\\. S \ topspace X" + and pw\: "pairwise (separatedin X) \" + have "\V W. openin X V \ openin X W \ S \ V \ + (\T. T \ \ \ T \ S \ T \ W) \ disjnt V W" + if "S \ \" for S + proof - + have "separatedin X S (\(\ - {S}))" + by (metis \ \finite \\ pw\ finite_Diff pairwise_alt separatedin_Union(1) that) + with L show ?thesis + unfolding hereditarily_normal_separation + by (smt (verit) Diff_iff UnionI empty_iff insert_iff subset_iff) + qed + then obtain \ \ + where *: "\S. S \ \ \ S \ \ S \ (\T. T \ \ \ T \ S \ T \ \ S)" + and ope: "\S. S \ \ \ openin X (\ S) \ openin X (\ S)" + and dis: "\S. S \ \ \ disjnt (\ S) (\ S)" + by metis + define \ where "\ \ \S. \ S \ (\T \ \ - {S}. \ T)" + show "\\. (\S\\. openin X (\ S) \ S \ \ S) \ pairwise (\S T. disjnt (\ S) (\ T)) \" + proof (intro exI conjI strip) + show "openin X (\ S)" if "S \ \" for S + unfolding \_def + by (smt (verit) ope that DiffD1 \finite \\ finite_Diff finite_imageI imageE openin_Int_Inter) + show "S \ \ S" if "S \ \" for S + unfolding \_def using "*" that by auto + show "pairwise (\S T. disjnt (\ S) (\ T)) \" + using dis by (fastforce simp: disjnt_iff pairwise_alt \_def) + qed + qed +next + assume R: ?rhs + show ?lhs + unfolding hereditarily_normal_separation + proof (intro strip) + fix S T + assume "separatedin X S T" + show "\U V. openin X U \ openin X V \ S \ U \ T \ V \ disjnt U V" + proof (cases "T=S") + case True + then show ?thesis + using \separatedin X S T\ by force + next + case False + have "pairwise (separatedin X) {S, T}" + by (simp add: \separatedin X S T\ pairwise_insert separatedin_sym) + moreover have "\S\{S, T}. S \ topspace X" + by (metis \separatedin X S T\ insertE separatedin_def singletonD) + ultimately show ?thesis + using R by (smt (verit) False finite.emptyI finite.insertI insertCI pairwiseD) + qed + qed +qed + +lemma hereditarily_normal_space_perfect_map_image: + "\hereditarily normal_space X; perfect_map X Y f\ \ hereditarily normal_space Y" + unfolding perfect_map_def proper_map_def + by (meson hereditarily_normal_space_continuous_closed_map_image) + +lemma regular_second_countable_imp_hereditarily_normal_space: + assumes "regular_space X \ second_countable X" + shows "hereditarily normal_space X" + unfolding hereditarily + proof (intro regular_Lindelof_imp_normal_space strip) + show "regular_space (subtopology X S)" for S + by (simp add: assms regular_space_subtopology) + show "Lindelof_space (subtopology X S)" for S + using assms by (simp add: second_countable_imp_Lindelof_space second_countable_subtopology) +qed + + +subsection\Completely regular spaces\ + +definition completely_regular_space where + "completely_regular_space X \ + \S x. closedin X S \ x \ topspace X - S + \ (\f::'a\real. continuous_map X (top_of_set {0..1}) f \ + f x = 0 \ (f ` S \ {1}))" + +lemma homeomorphic_completely_regular_space_aux: + assumes X: "completely_regular_space X" and hom: "X homeomorphic_space Y" + shows "completely_regular_space Y" +proof - + obtain f g where hmf: "homeomorphic_map X Y f" and hmg: "homeomorphic_map Y X g" + and fg: "(\x \ topspace X. g(f x) = x) \ (\y \ topspace Y. f(g y) = y)" + using assms X homeomorphic_maps_map homeomorphic_space_def by fastforce + show ?thesis + unfolding completely_regular_space_def + proof clarify + fix S x + assume A: "closedin Y S" and x: "x \ topspace Y" and "x \ S" + then have "closedin X (g`S)" + using hmg homeomorphic_map_closedness_eq by blast + moreover have "g x \ g`S" + by (meson A x \x \ S\ closedin_subset hmg homeomorphic_imp_injective_map inj_on_image_mem_iff) + ultimately obtain \ where \: "continuous_map X (top_of_set {0..1::real}) \ \ \ (g x) = 0 \ \ ` g`S \ {1}" + by (metis DiffI X completely_regular_space_def hmg homeomorphic_imp_surjective_map image_eqI x) + then have "continuous_map Y (top_of_set {0..1::real}) (\ \ g)" + by (meson continuous_map_compose hmg homeomorphic_imp_continuous_map) + then show "\\. continuous_map Y (top_of_set {0..1::real}) \ \ \ x = 0 \ \ ` S \ {1}" + by (metis \ comp_apply image_comp) + qed +qed + +lemma homeomorphic_completely_regular_space: + assumes "X homeomorphic_space Y" + shows "completely_regular_space X \ completely_regular_space Y" + by (meson assms homeomorphic_completely_regular_space_aux homeomorphic_space_sym) + +lemma completely_regular_space_alt: + "completely_regular_space X \ + (\S x. closedin X S \ x \ topspace X - S + \ (\f. continuous_map X euclideanreal f \ f x = 0 \ f ` S \ {1}))" +proof - + have "\f. continuous_map X (top_of_set {0..1::real}) f \ f x = 0 \ f ` S \ {1}" + if "closedin X S" "x \ topspace X - S" and f: "continuous_map X euclideanreal f \ f x = 0 \ f ` S \ {1}" + for S x f + proof (intro exI conjI) + show "continuous_map X (top_of_set {0..1}) (\x. max 0 (min (f x) 1))" + using that + by (auto simp: continuous_map_in_subtopology intro!: continuous_map_real_max continuous_map_real_min) + qed (use that in auto) + with continuous_map_in_subtopology show ?thesis + unfolding completely_regular_space_def by metis +qed + +text \As above, but with @{term openin}\ +lemma completely_regular_space_alt': + "completely_regular_space X \ + (\S x. openin X S \ x \ S + \ (\f. continuous_map X euclideanreal f \ f x = 0 \ f ` (topspace X - S) \ {1}))" + apply (simp add: completely_regular_space_alt all_closedin) + by (meson openin_subset subsetD) + +lemma completely_regular_space_gen_alt: + fixes a b::real + assumes "a \ b" + shows "completely_regular_space X \ + (\S x. closedin X S \ x \ topspace X - S + \ (\f. continuous_map X euclidean f \ f x = a \ (f ` S \ {b})))" +proof - + have "\f. continuous_map X euclideanreal f \ f x = 0 \ f ` S \ {1}" + if "closedin X S" "x \ topspace X - S" + and f: "continuous_map X euclidean f \ f x = a \ f ` S \ {b}" + for S x f + proof (intro exI conjI) + show "continuous_map X euclideanreal ((\x. inverse(b - a) * (x - a)) \ f)" + using that by (intro continuous_intros) auto + qed (use that assms in auto) + moreover + have "\f. continuous_map X euclidean f \ f x = a \ f ` S \ {b}" + if "closedin X S" "x \ topspace X - S" + and f: "continuous_map X euclideanreal f \ f x = 0 \ f ` S \ {1}" + for S x f + proof (intro exI conjI) + show "continuous_map X euclideanreal ((\x. a + (b - a) * x) \ f)" + using that by (intro continuous_intros) auto + qed (use that in auto) + ultimately show ?thesis + unfolding completely_regular_space_alt by meson +qed + +text \As above, but with @{term openin}\ +lemma completely_regular_space_gen_alt': + fixes a b::real + assumes "a \ b" + shows "completely_regular_space X \ + (\S x. openin X S \ x \ S + \ (\f. continuous_map X euclidean f \ f x = a \ (f ` (topspace X - S) \ {b})))" + apply (simp add: completely_regular_space_gen_alt[OF assms] all_closedin) + by (meson openin_subset subsetD) + +lemma completely_regular_space_gen: + fixes a b::real + assumes "a < b" + shows "completely_regular_space X \ + (\S x. closedin X S \ x \ topspace X - S + \ (\f. continuous_map X (top_of_set {a..b}) f \ f x = a \ f ` S \ {b}))" +proof - + have "\f. continuous_map X (top_of_set {a..b}) f \ f x = a \ f ` S \ {b}" + if "closedin X S" "x \ topspace X - S" + and f: "continuous_map X euclidean f \ f x = a \ f ` S \ {b}" + for S x f + proof (intro exI conjI) + show "continuous_map X (top_of_set {a..b}) (\x. max a (min (f x) b))" + using that assms + by (auto simp: continuous_map_in_subtopology intro!: continuous_map_real_max continuous_map_real_min) + qed (use that assms in auto) + with continuous_map_in_subtopology assms show ?thesis + using completely_regular_space_gen_alt [of a b] + by (smt (verit) atLeastAtMost_singleton atLeastatMost_empty singletonI) +qed + +lemma normal_imp_completely_regular_space_A: + assumes "normal_space X" "t1_space X" + shows "completely_regular_space X" + unfolding completely_regular_space_alt +proof clarify + fix x S + assume A: "closedin X S" "x \ S" + assume "x \ topspace X" + then have "closedin X {x}" + by (simp add: \t1_space X\ closedin_t1_singleton) + with A \normal_space X\ have "\f. continuous_map X euclideanreal f \ f ` {x} \ {0} \ f ` S \ {1}" + using assms unfolding normal_space_iff_Urysohn_alt disjnt_iff by blast + then show "\f. continuous_map X euclideanreal f \ f x = 0 \ f ` S \ {1}" + by auto +qed + +lemma normal_imp_completely_regular_space_B: + assumes "normal_space X" "regular_space X" + shows "completely_regular_space X" + unfolding completely_regular_space_alt +proof clarify + fix x S + assume "closedin X S" "x \ S" "x \ topspace X" + then obtain U C where "openin X U" "closedin X C" "x \ U" "U \ C" "C \ topspace X - S" + using assms + unfolding neighbourhood_base_of_closedin [symmetric] neighbourhood_base_of closedin_def by (metis Diff_iff) + then obtain f where "continuous_map X euclideanreal f \ f ` C \ {0} \ f ` S \ {1}" + using assms unfolding normal_space_iff_Urysohn_alt + by (metis Diff_iff \closedin X S\ disjnt_iff subsetD) + then show "\f. continuous_map X euclideanreal f \ f x = 0 \ f ` S \ {1}" + by (meson \U \ C\ \x \ U\ image_subset_iff singletonD subsetD) +qed + +lemma normal_imp_completely_regular_space_gen: + "\normal_space X; t1_space X \ Hausdorff_space X \ regular_space X\ \ completely_regular_space X" + using normal_imp_completely_regular_space_A normal_imp_completely_regular_space_B t1_or_Hausdorff_space by blast + +lemma normal_imp_completely_regular_space: + "\normal_space X; Hausdorff_space X \ regular_space X\ \ completely_regular_space X" + by (simp add: normal_imp_completely_regular_space_gen) + +lemma (in Metric_space) completely_regular_space_mtopology: + "completely_regular_space mtopology" + by (simp add: normal_imp_completely_regular_space normal_space_mtopology regular_space_mtopology) + +lemma metrizable_imp_completely_regular_space: + "metrizable_space X \ completely_regular_space X" + by (simp add: metrizable_imp_normal_space metrizable_imp_regular_space normal_imp_completely_regular_space) + +lemma completely_regular_space_discrete_topology: + "completely_regular_space(discrete_topology U)" + by (simp add: normal_imp_completely_regular_space normal_space_discrete_topology) + +lemma completely_regular_space_subtopology: + assumes "completely_regular_space X" + shows "completely_regular_space (subtopology X S)" + unfolding completely_regular_space_def +proof clarify + fix A x + assume "closedin (subtopology X S) A" and x: "x \ topspace (subtopology X S)" and "x \ A" + then obtain T where "closedin X T" "A = S \ T" "x \ topspace X" "x \ S" + by (force simp: closedin_subtopology_alt image_iff) + then show "\f. continuous_map (subtopology X S) (top_of_set {0::real..1}) f \ f x = 0 \ f ` A \ {1}" + using assms \x \ A\ + apply (simp add: completely_regular_space_def continuous_map_from_subtopology) + using continuous_map_from_subtopology by fastforce +qed + +lemma completely_regular_space_retraction_map_image: + " \retraction_map X Y r; completely_regular_space X\ \ completely_regular_space Y" + using completely_regular_space_subtopology hereditary_imp_retractive_property homeomorphic_completely_regular_space by blast + +lemma completely_regular_imp_regular_space: + assumes "completely_regular_space X" + shows "regular_space X" +proof - + have *: "\U V. openin X U \ openin X V \ a \ U \ C \ V \ disjnt U V" + if contf: "continuous_map X euclideanreal f" and a: "a \ topspace X - C" and "closedin X C" + and fim: "f ` topspace X \ {0..1}" and f0: "f a = 0" and f1: "f ` C \ {1}" + for C a f + proof (intro exI conjI) + show "openin X {x \ topspace X. f x \ {..<1 / 2}}" "openin X {x \ topspace X. f x \ {1 / 2<..}}" + using openin_continuous_map_preimage [OF contf] + by (meson open_lessThan open_greaterThan open_openin)+ + show "a \ {x \ topspace X. f x \ {..<1 / 2}}" + using a f0 by auto + show "C \ {x \ topspace X. f x \ {1 / 2<..}}" + using \closedin X C\ f1 closedin_subset by auto + qed (auto simp: disjnt_iff) + show ?thesis + using assms + unfolding completely_regular_space_def regular_space_def continuous_map_in_subtopology + by (meson "*") +qed + + +lemma locally_compact_regular_imp_completely_regular_space: + assumes "locally_compact_space X" "Hausdorff_space X \ regular_space X" + shows "completely_regular_space X" + unfolding completely_regular_space_def +proof clarify + fix S x + assume "closedin X S" and "x \ topspace X" and "x \ S" + have "regular_space X" + using assms locally_compact_Hausdorff_imp_regular_space by blast + then have nbase: "neighbourhood_base_of (\C. compactin X C \ closedin X C) X" + using assms(1) locally_compact_regular_space_neighbourhood_base by blast + then obtain U M where "openin X U" "compactin X M" "closedin X M" "x \ U" "U \ M" "M \ topspace X - S" + unfolding neighbourhood_base_of by (metis (no_types, lifting) Diff_iff \closedin X S\ \x \ topspace X\ \x \ S\ closedin_def) + then have "M \ topspace X" + by blast + obtain V K where "openin X V" "closedin X K" "x \ V" "V \ K" "K \ U" + by (metis (no_types, lifting) \openin X U\ \x \ U\ neighbourhood_base_of nbase) + have "compact_space (subtopology X M)" + by (simp add: \compactin X M\ compact_space_subtopology) + then have "normal_space (subtopology X M)" + by (simp add: \regular_space X\ compact_Hausdorff_or_regular_imp_normal_space regular_space_subtopology) + moreover have "closedin (subtopology X M) K" + using \K \ U\ \U \ M\ \closedin X K\ closedin_subset_topspace by fastforce + moreover have "closedin (subtopology X M) (M - U)" + by (simp add: \closedin X M\ \openin X U\ closedin_diff closedin_subset_topspace) + moreover have "disjnt K (M - U)" + by (meson DiffD2 \K \ U\ disjnt_iff subsetD) + ultimately obtain f::"'a\real" where contf: "continuous_map (subtopology X M) (top_of_set {0..1}) f" + and f0: "f ` K \ {0}" and f1: "f ` (M - U) \ {1}" + using Urysohn_lemma [of "subtopology X M" K "M-U" 0 1] by auto + then obtain g::"'a\real" where contg: "continuous_map (subtopology X M) euclidean g" and gim: "g ` M \ {0..1}" + and g0: "\x. x \ K \ g x = 0" and g1: "\x. \x \ M; x \ U\ \ g x = 1" + using \M \ topspace X\ by (force simp add: continuous_map_in_subtopology image_subset_iff) + show "\f::'a\real. continuous_map X (top_of_set {0..1}) f \ f x = 0 \ f ` S \ {1}" + proof (intro exI conjI) + show "continuous_map X (top_of_set {0..1}) (\x. if x \ M then g x else 1)" + unfolding continuous_map_closedin + proof (intro strip conjI) + fix C + assume C: "closedin (top_of_set {0::real..1}) C" + have eq: "{x \ topspace X. (if x \ M then g x else 1) \ C} = {x \ M. g x \ C} \ (if 1 \ C then topspace X - U else {})" + using \U \ M\ \M \ topspace X\ g1 by auto + show "closedin X {x \ topspace X. (if x \ M then g x else 1) \ C}" + unfolding eq + proof (intro closedin_Un) + have "closedin euclidean C" + using C closed_closedin closedin_closed_trans by blast + then have "closedin (subtopology X M) {x \ M. g x \ C}" + using closedin_continuous_map_preimage_gen [OF contg] \M \ topspace X\ by auto + then show "closedin X {x \ M. g x \ C}" + using \closedin X M\ closedin_trans_full by blast + qed (use \openin X U\ in force) + qed (use gim in force) + show "(if x \ M then g x else 1) = 0" + using \U \ M\ \V \ K\ g0 \x \ U\ \x \ V\ by auto + show "(\x. if x \ M then g x else 1) ` S \ {1}" + using \M \ topspace X - S\ by auto + qed +qed + +lemma completely_regular_eq_regular_space: + "locally_compact_space X + \ (completely_regular_space X \ regular_space X)" + using completely_regular_imp_regular_space locally_compact_regular_imp_completely_regular_space + by blast + +lemma completely_regular_space_prod_topology: + "completely_regular_space (prod_topology X Y) \ + topspace (prod_topology X Y) = {} \ + completely_regular_space X \ completely_regular_space Y" (is "?lhs=?rhs") +proof + assume ?lhs then show ?rhs + by (rule topological_property_of_prod_component) + (auto simp: completely_regular_space_subtopology homeomorphic_completely_regular_space) +next + assume R: ?rhs + show ?lhs + proof (cases "topspace(prod_topology X Y) = {}") + case False + then have X: "completely_regular_space X" and Y: "completely_regular_space Y" + using R by blast+ + show ?thesis + unfolding completely_regular_space_alt' + proof clarify + fix W x y + assume "openin (prod_topology X Y) W" and "(x, y) \ W" + then obtain U V where "openin X U" "openin Y V" "x \ U" "y \ V" "U\V \ W" + by (force simp: openin_prod_topology_alt) + then have "x \ topspace X" "y \ topspace Y" + using openin_subset by fastforce+ + obtain f where contf: "continuous_map X euclideanreal f" and "f x = 0" + and f1: "\x. x \ topspace X \ x \ U \ f x = 1" + using X \openin X U\ \x \ U\ unfolding completely_regular_space_alt' + by (smt (verit, best) Diff_iff image_subset_iff singletonD) + obtain g where contg: "continuous_map Y euclideanreal g" and "g y = 0" + and g1: "\y. y \ topspace Y \ y \ V \ g y = 1" + using Y \openin Y V\ \y \ V\ unfolding completely_regular_space_alt' + by (smt (verit, best) Diff_iff image_subset_iff singletonD) + define h where "h \ \(x,y). 1 - (1 - f x) * (1 - g y)" + show "\h. continuous_map (prod_topology X Y) euclideanreal h \ h (x,y) = 0 \ h ` (topspace (prod_topology X Y) - W) \ {1}" + proof (intro exI conjI) + have "continuous_map (prod_topology X Y) euclideanreal (f \ fst)" + using contf continuous_map_of_fst by blast + moreover + have "continuous_map (prod_topology X Y) euclideanreal (g \ snd)" + using contg continuous_map_of_snd by blast + ultimately + show "continuous_map (prod_topology X Y) euclideanreal h" + unfolding o_def h_def case_prod_unfold + by (intro continuous_intros) auto + show "h (x, y) = 0" + by (simp add: h_def \f x = 0\ \g y = 0\) + show "h ` (topspace (prod_topology X Y) - W) \ {1}" + using \U \ V \ W\ f1 g1 by (force simp: h_def) + qed + qed + qed (force simp: completely_regular_space_def) +qed + + +lemma completely_regular_space_product_topology: + "completely_regular_space (product_topology X I) \ + (\\<^sub>E i\I. topspace(X i)) = {} \ (\i \ I. completely_regular_space (X i))" + (is "?lhs \ ?rhs") +proof + assume ?lhs then show ?rhs + by (rule topological_property_of_product_component) + (auto simp: completely_regular_space_subtopology homeomorphic_completely_regular_space) +next + assume R: ?rhs + show ?lhs + proof (cases "(\\<^sub>E i\I. topspace(X i)) = {}") + case False + show ?thesis + unfolding completely_regular_space_alt' + proof clarify + fix W x + assume W: "openin (product_topology X I) W" and "x \ W" + then obtain U where finU: "finite {i \ I. U i \ topspace (X i)}" + and ope: "\i. i\I \ openin (X i) (U i)" + and x: "x \ Pi\<^sub>E I U" and "Pi\<^sub>E I U \ W" + by (auto simp: openin_product_topology_alt) + have "\i \ I. openin (X i) (U i) \ x i \ U i + \ (\f. continuous_map (X i) euclideanreal f \ + f (x i) = 0 \ (\x \ topspace(X i). x \ U i \ f x = 1))" + using R unfolding completely_regular_space_alt' + by (smt (verit) DiffI False image_subset_iff singletonD) + with ope x have "\i. \f. i \ I \ continuous_map (X i) euclideanreal f \ + f (x i) = 0 \ (\x \ topspace (X i). x \ U i \ f x = 1)" + by auto + then obtain f where f: "\i. i \ I \ continuous_map (X i) euclideanreal (f i) \ + f i (x i) = 0 \ (\x \ topspace (X i). x \ U i \ f i x = 1)" + by metis + define h where "h \ \z. 1 - prod (\i. 1 - f i (z i)) {i\I. U i \ topspace(X i)}" + show "\h. continuous_map (product_topology X I) euclideanreal h \ h x = 0 \ + h ` (topspace (product_topology X I) - W) \ {1}" + proof (intro conjI exI) + have "continuous_map (product_topology X I) euclidean (f i \ (\x. x i))" if "i\I" for i + using f that + by (blast intro: continuous_intros continuous_map_product_projection) + then show "continuous_map (product_topology X I) euclideanreal h" + unfolding h_def o_def by (intro continuous_intros) (auto simp: finU) + show "h x = 0" + by (simp add: h_def f) + show "h ` (topspace (product_topology X I) - W) \ {1}" + proof - + have "\i. i \ I \ U i \ topspace (X i) \ f i (x' i) = 1" + if "x' \ (\\<^sub>E i\I. topspace (X i))" "x' \ W" for x' + using that \Pi\<^sub>E I U \ W\ by (smt (verit, best) PiE_iff f in_mono) + then show ?thesis + by (auto simp: f h_def finU) + qed + qed + qed + qed (force simp: completely_regular_space_def) +qed + + +lemma (in Metric_space) t1_space_mtopology: + "t1_space mtopology" + using Hausdorff_space_mtopology t1_or_Hausdorff_space by blast + + +subsection\More generally, the k-ification functor\ + +definition kification_open + where "kification_open \ + \X S. S \ topspace X \ (\K. compactin X K \ openin (subtopology X K) (K \ S))" + +definition kification + where "kification X \ topology (kification_open X)" + +lemma istopology_kification_open: "istopology (kification_open X)" + unfolding istopology_def +proof (intro conjI strip) + show "kification_open X (S \ T)" + if "kification_open X S" and "kification_open X T" for S T + using that unfolding kification_open_def + by (smt (verit, best) inf.idem inf_commute inf_left_commute le_infI2 openin_Int) + show "kification_open X (\ \)" if "\K\\. kification_open X K" for \ + using that unfolding kification_open_def Int_Union by blast +qed + +lemma openin_kification: + "openin (kification X) U \ + U \ topspace X \ + (\K. compactin X K \ openin (subtopology X K) (K \ U))" + by (metis topology_inverse' kification_def istopology_kification_open kification_open_def) + +lemma openin_kification_finer: + "openin X S \ openin (kification X) S" + by (simp add: openin_kification openin_subset openin_subtopology_Int2) + +lemma topspace_kification [simp]: + "topspace(kification X) = topspace X" + by (meson openin_kification openin_kification_finer openin_topspace subset_antisym) + +lemma closedin_kification: + "closedin (kification X) U \ + U \ topspace X \ + (\K. compactin X K \ closedin (subtopology X K) (K \ U))" +proof (cases "U \ topspace X") + case True + then show ?thesis + by (simp add: closedin_def Diff_Int_distrib inf_commute le_infI2 openin_kification) +qed (simp add: closedin_def) + +lemma closedin_kification_finer: "closedin X S \ closedin (kification X) S" + by (simp add: closedin_def openin_kification_finer) + +lemma kification_eq_self: "kification X = X \ k_space X" + unfolding fun_eq_iff openin_kification k_space_alt openin_inject [symmetric] + by (metis openin_closedin_eq) + +lemma compactin_kification [simp]: + "compactin (kification X) K \ compactin X K" (is "?lhs \ ?rhs") +proof + assume ?lhs then show ?rhs + by (simp add: compactin_contractive openin_kification_finer) +next + assume R: ?rhs + show ?lhs + unfolding compactin_def + proof (intro conjI strip) + show "K \ topspace (kification X)" + by (simp add: R compactin_subset_topspace) + fix \ + assume \: "Ball \ (openin (kification X)) \ K \ \ \" + then have *: "\U. U \ \ \ U \ topspace X \ openin (subtopology X K) (K \ U)" + by (simp add: R openin_kification) + have "K \ topspace X" "compact_space (subtopology X K)" + using R compactin_subspace by force+ + then have "\V. finite V \ V \ (\U. K \ U) ` \ \ \ V = topspace (subtopology X K)" + unfolding compact_space + by (smt (verit, del_insts) Int_Union \ * image_iff inf.order_iff inf_commute topspace_subtopology) + then show "\\. finite \ \ \ \ \ \ K \ \ \" + by (metis Int_Union \K \ topspace X\ finite_subset_image inf.orderI topspace_subtopology_subset) + qed +qed + +lemma compact_space_kification [simp]: + "compact_space(kification X) \ compact_space X" + by (simp add: compact_space_def) + +lemma kification_kification [simp]: + "kification(kification X) = kification X" + unfolding openin_inject [symmetric] +proof + fix U + show "openin (kification (kification X)) U = openin (kification X) U" + proof + show "openin (kification (kification X)) U \ openin (kification X) U" + by (metis compactin_kification inf_commute openin_kification openin_subtopology topspace_kification) + qed (simp add: openin_kification_finer) +qed + +lemma k_space_kification [iff]: "k_space(kification X)" + using kification_eq_self by fastforce + +lemma continuous_map_into_kification: + assumes "k_space X" + shows "continuous_map X (kification Y) f \ continuous_map X Y f" (is "?lhs \ ?rhs") +proof + assume ?lhs then show ?rhs + by (simp add: continuous_map_def openin_kification_finer) +next + assume R: ?rhs + have "openin X {x \ topspace X. f x \ V}" if V: "openin (kification Y) V" for V + proof - + have "openin (subtopology X K) (K \ {x \ topspace X. f x \ V})" + if "compactin X K" for K + proof - + have "compactin Y (f ` K)" + using R image_compactin that by blast + then have "openin (subtopology Y (f ` K)) (f ` K \ V)" + by (meson V openin_kification) + then obtain U where U: "openin Y U" "f`K \ V = U \ f`K" + by (meson openin_subtopology) + show ?thesis + unfolding openin_subtopology + proof (intro conjI exI) + show "openin X {x \ topspace X. f x \ U}" + using R U openin_continuous_map_preimage_gen by (simp add: continuous_map_def) + qed (use U in auto) + qed + then show ?thesis + by (metis (full_types) Collect_subset assms k_space_open) + qed + with R show ?lhs + by (simp add: continuous_map_def) +qed + +lemma continuous_map_from_kification: + "continuous_map X Y f \ continuous_map (kification X) Y f" + by (simp add: continuous_map_openin_preimage_eq openin_kification_finer) + +lemma continuous_map_kification: + "continuous_map X Y f \ continuous_map (kification X) (kification Y) f" + by (simp add: continuous_map_from_kification continuous_map_into_kification) + +lemma subtopology_kification_compact: + assumes "compactin X K" + shows "subtopology (kification X) K = subtopology X K" + unfolding openin_inject [symmetric] +proof + fix U + show "openin (subtopology (kification X) K) U = openin (subtopology X K) U" + by (metis assms inf_commute openin_kification openin_subset openin_subtopology) +qed + + +lemma subtopology_kification_finer: + assumes "openin (subtopology (kification X) S) U" + shows "openin (kification (subtopology X S)) U" + using assms + by (fastforce simp: openin_subtopology_alt image_iff openin_kification subtopology_subtopology compactin_subtopology) + +lemma proper_map_from_kification: + assumes "k_space Y" + shows "proper_map (kification X) Y f \ proper_map X Y f" (is "?lhs \ ?rhs") +proof + assume ?lhs then show ?rhs + by (simp add: closed_map_def closedin_kification_finer proper_map_alt) +next + assume R: ?rhs + have "compactin Y K \ compactin X {x \ topspace X. f x \ K}" for K + using R proper_map_alt by auto + with R show ?lhs + by (simp add: assms proper_map_into_k_space_eq subtopology_kification_compact) +qed + +lemma perfect_map_from_kification: + "\k_space Y; perfect_map X Y f\ \ perfect_map(kification X) Y f" + by (simp add: continuous_map_from_kification perfect_map_def proper_map_from_kification) + +lemma k_space_perfect_map_image_eq: + assumes "Hausdorff_space X" "perfect_map X Y f" + shows "k_space X \ k_space Y" +proof + show "k_space X \ k_space Y" + using k_space_perfect_map_image assms by blast + assume "k_space Y" + have "homeomorphic_map (kification X) X id" + unfolding homeomorphic_eq_injective_perfect_map + proof (intro conjI perfect_map_from_composition_right [where f = id]) + show "perfect_map (kification X) Y (f \ id)" + by (simp add: \k_space Y\ assms(2) perfect_map_from_kification) + show "continuous_map (kification X) X id" + by (simp add: continuous_map_from_kification) +qed (use assms perfect_map_def in auto) + then show "k_space X" + using homeomorphic_k_space homeomorphic_space by blast +qed + + +subsection\One-point compactifications and the Alexandroff extension construction\ + +lemma one_point_compactification_dense: + "\compact_space X; \ compactin X (topspace X - {a})\ \ X closure_of (topspace X - {a}) = topspace X" + unfolding closure_of_complement + by (metis Diff_empty closedin_compact_space interior_of_eq_empty openin_closedin_eq subset_singletonD) + +lemma one_point_compactification_interior: + "\compact_space X; \ compactin X (topspace X - {a})\ \ X interior_of {a} = {}" + by (simp add: interior_of_eq_empty_complement one_point_compactification_dense) + +lemma kc_space_one_point_compactification_gen: + assumes "compact_space X" + shows "kc_space X \ + openin X (topspace X - {a}) \ (\K. compactin X K \ a\K \ closedin X K) \ + k_space (subtopology X (topspace X - {a})) \ kc_space (subtopology X (topspace X - {a}))" + (is "?lhs \ ?rhs") +proof + assume L: ?lhs show ?rhs + proof (intro conjI strip) + show "openin X (topspace X - {a})" + using L kc_imp_t1_space t1_space_openin_delete_alt by auto + then show "k_space (subtopology X (topspace X - {a}))" + by (simp add: L assms k_space_open_subtopology_aux) + show "closedin X k" if "compactin X k \ a \ k" for k :: "'a set" + using L kc_space_def that by blast + show "kc_space (subtopology X (topspace X - {a}))" + by (simp add: L kc_space_subtopology) + qed +next + assume R: ?rhs + show ?lhs + unfolding kc_space_def + proof (intro strip) + fix S + assume "compactin X S" + then have "S \topspace X" + by (simp add: compactin_subset_topspace) + show "closedin X S" + proof (cases "a \ S") + case True + then have "topspace X - S = topspace X - {a} - (S - {a})" + by auto + moreover have "openin X (topspace X - {a} - (S - {a}))" + proof (rule openin_trans_full) + show "openin (subtopology X (topspace X - {a})) (topspace X - {a} - (S - {a}))" + proof + show "openin (subtopology X (topspace X - {a})) (topspace X - {a})" + using R openin_open_subtopology by blast + have "closedin (subtopology X ((topspace X - {a}) \ K)) (K \ (S - {a}))" + if "compactin X K" "K \ topspace X - {a}" for K + proof (intro closedin_subset_topspace) + show "closedin X (K \ (S - {a}))" + using that + by (metis IntD1 Int_insert_right_if0 R True \compactin X S\ closed_Int_compactin insert_Diff subset_Diff_insert) + qed (use that in auto) + moreover have "k_space (subtopology X (topspace X - {a}))" + using R by blast + moreover have "S-{a} \ topspace X \ S-{a} \ topspace X - {a}" + using \S \ topspace X\ by auto + ultimately show "closedin (subtopology X (topspace X - {a})) (S - {a})" + using \S \ topspace X\ True + by (simp add: k_space_def compactin_subtopology subtopology_subtopology) + qed + show "openin X (topspace X - {a})" + by (simp add: R) + qed + ultimately show ?thesis + by (simp add: \S \ topspace X\ closedin_def) + next + case False + then show ?thesis + by (simp add: R \compactin X S\) + qed + qed +qed + + +inductive Alexandroff_open for X where + base: "openin X U \ Alexandroff_open X (Some ` U)" +| ext: "\compactin X C; closedin X C\ \ Alexandroff_open X (insert None (Some ` (topspace X - C)))" + +lemma Alexandroff_open_iff: "Alexandroff_open X S \ + (\U. (S = Some ` U \ openin X U) \ (S = insert None (Some ` (topspace X - U)) \ compactin X U \ closedin X U))" + by (meson Alexandroff_open.cases Alexandroff_open.ext base) + +lemma Alexandroff_open_Un_aux: + assumes U: "openin X U" and "Alexandroff_open X T" + shows "Alexandroff_open X (Some ` U \ T)" + using \Alexandroff_open X T\ +proof (induction rule: Alexandroff_open.induct) + case (base V) + then show ?case + by (metis Alexandroff_open.base U image_Un openin_Un) +next + case (ext C) + have "U \ topspace X" + by (simp add: U openin_subset) + then have eq: "Some ` U \ insert None (Some ` (topspace X - C)) = insert None (Some ` (topspace X - (C \ (topspace X - U))))" + by force + have "closedin X (C \ (topspace X - U))" + using U ext.hyps(2) by blast + moreover + have "compactin X (C \ (topspace X - U))" + using U compact_Int_closedin ext.hyps(1) by blast + ultimately show ?case + unfolding eq using Alexandroff_open.ext by blast +qed + +lemma Alexandroff_open_Un: + assumes "Alexandroff_open X S" and "Alexandroff_open X T" + shows "Alexandroff_open X (S \ T)" + using assms +proof (induction rule: Alexandroff_open.induct) + case (base U) + then show ?case + by (simp add: Alexandroff_open_Un_aux) +next + case (ext C) + then show ?case + by (smt (verit, best) Alexandroff_open_Un_aux Alexandroff_open_iff Un_commute Un_insert_left closedin_def insert_absorb2) +qed + +lemma Alexandroff_open_Int_aux: + assumes U: "openin X U" and "Alexandroff_open X T" + shows "Alexandroff_open X (Some ` U \ T)" + using \Alexandroff_open X T\ +proof (induction rule: Alexandroff_open.induct) + case (base V) + then show ?case + by (metis Alexandroff_open.base U image_Int inj_Some openin_Int) +next + case (ext C) + have eq: "Some ` U \ insert None (Some ` (topspace X - C)) = Some ` (topspace X - (C \ (topspace X - U)))" + by force + have "openin X (topspace X - (C \ (topspace X - U)))" + using U ext.hyps(2) by blast + then show ?case + unfolding eq using Alexandroff_open.base by blast +qed + +lemma istopology_Alexandroff_open: "istopology (Alexandroff_open X)" + unfolding istopology_def +proof (intro conjI strip) + fix S T + assume "Alexandroff_open X S" and "Alexandroff_open X T" + then show "Alexandroff_open X (S \ T)" + proof (induction rule: Alexandroff_open.induct) + case (base U) + then show ?case + using Alexandroff_open_Int_aux by blast + next + case EC: (ext C) + show ?case + using \Alexandroff_open X T\ + proof (induction rule: Alexandroff_open.induct) + case (base V) + then show ?case + by (metis Alexandroff_open.ext Alexandroff_open_Int_aux EC.hyps inf_commute) + next + case (ext D) + have eq: "insert None (Some ` (topspace X - C)) \ insert None (Some ` (topspace X - D)) + = insert None (Some ` (topspace X - (C \ D)))" + by auto + show ?case + unfolding eq + by (simp add: Alexandroff_open.ext EC.hyps closedin_Un compactin_Un ext.hyps) + qed + qed +next + fix \ + assume \
: "\K\\. Alexandroff_open X K" + show "Alexandroff_open X (\\)" + proof (cases "None \ \\") + case True + have "\K\\. \U. (openin X U \ K = Some ` U) \ (K = insert None (Some ` (topspace X - U)) \ compactin X U \ closedin X U)" + by (metis \
Alexandroff_open_iff) + then obtain U where U: + "\K. K \ \ \ openin X (U K) \ K = Some ` (U K) + \ (K = insert None (Some ` (topspace X - U K)) \ compactin X (U K) \ closedin X (U K))" + by metis + define \N where "\N \ {K \ \. None \ K}" + define A where "A \ \K\\-\N. U K" + define B where "B \ \K\\N. U K" + have U1: "\K. K \ \-\N \ openin X (U K) \ K = Some ` (U K)" + using U \N_def by auto + have U2: "\K. K \ \N \ K = insert None (Some ` (topspace X - U K)) \ compactin X (U K) \ closedin X (U K)" + using U \N_def by auto + have eqA: "\(\-\N) = Some ` A" + proof + show "\ (\ - \N) \ Some ` A" + by (metis A_def Sup_le_iff U1 UN_upper subset_image_iff) + show "Some ` A \ \ (\ - \N)" + using A_def U1 by blast + qed + have eqB: "\\N = insert None (Some ` (topspace X - B))" + using U2 True + by (auto simp: B_def image_iff \N_def) + have "\\ = \\N \ \(\-\N)" + by (auto simp: \N_def) + then have eq: "\\ = (Some ` A) \ (insert None (Some ` (topspace X - B)))" + by (simp add: eqA eqB Un_commute) + show ?thesis + unfolding eq + proof (intro Alexandroff_open_Un Alexandroff_open.intros) + show "openin X A" + using A_def U1 by blast + show "closedin X B" + unfolding B_def using U2 True \N_def by auto + show "compactin X B" + by (metis B_def U2 eqB Inf_lower Union_iff \closedin X B\ closed_compactin imageI insertI1) + qed + next + case False + then have "\K\\. \U. openin X U \ K = Some ` U" + by (metis Alexandroff_open.simps UnionI \
insertCI) + then obtain U where U: "\K\\. openin X (U K) \ K = Some ` (U K)" + by metis + then have eq: "\\ = Some ` (\ K\\. U K)" + using image_iff by fastforce + show ?thesis + unfolding eq by (simp add: U base openin_clauses(3)) + qed +qed + + +definition Alexandroff_compactification where + "Alexandroff_compactification X \ topology (Alexandroff_open X)" + +lemma openin_Alexandroff_compactification: + "openin(Alexandroff_compactification X) V \ + (\U. openin X U \ V = Some ` U) \ + (\C. compactin X C \ closedin X C \ V = insert None (Some ` (topspace X - C)))" + by (auto simp: Alexandroff_compactification_def istopology_Alexandroff_open Alexandroff_open.simps) + + +lemma topspace_Alexandroff_compactification [simp]: + "topspace(Alexandroff_compactification X) = insert None (Some ` topspace X)" + (is "?lhs = ?rhs") +proof + show "?lhs \ ?rhs" + by (force simp add: topspace_def openin_Alexandroff_compactification) + have "None \ topspace (Alexandroff_compactification X)" + by (meson closedin_empty compactin_empty insert_subset openin_Alexandroff_compactification openin_subset) + moreover have "Some x \ topspace (Alexandroff_compactification X)" + if "x \ topspace X" for x + by (meson that imageI openin_Alexandroff_compactification openin_subset openin_topspace subsetD) + ultimately show "?rhs \ ?lhs" + by (auto simp: image_subset_iff) +qed + +lemma closedin_Alexandroff_compactification: + "closedin (Alexandroff_compactification X) C \ + (\K. compactin X K \ closedin X K \ C = Some ` K) \ + (\U. openin X U \ C = topspace(Alexandroff_compactification X) - Some ` U)" + (is "?lhs \ ?rhs") +proof + show "?lhs \ ?rhs" + apply (clarsimp simp: closedin_def openin_Alexandroff_compactification) + by (smt (verit) Diff_Diff_Int None_notin_image_Some image_set_diff inf.absorb_iff2 inj_Some insert_Diff_if subset_insert) + show "?rhs \ ?lhs" + using openin_subset + by (fastforce simp: closedin_def openin_Alexandroff_compactification) +qed + +lemma openin_Alexandroff_compactification_image_Some [simp]: + "openin(Alexandroff_compactification X) (Some ` U) \ openin X U" + by (auto simp: openin_Alexandroff_compactification inj_image_eq_iff) + +lemma closedin_Alexandroff_compactification_image_Some [simp]: + "closedin (Alexandroff_compactification X) (Some ` K) \ compactin X K \ closedin X K" + by (auto simp: closedin_Alexandroff_compactification inj_image_eq_iff) + +lemma open_map_Some: "open_map X (Alexandroff_compactification X) Some" + using open_map_def openin_Alexandroff_compactification by blast + +lemma continuous_map_Some: "continuous_map X (Alexandroff_compactification X) Some" + unfolding continuous_map_def +proof (intro conjI strip) + fix U + assume "openin (Alexandroff_compactification X) U" + then consider V where "openin X V" "U = Some ` V" + | C where "compactin X C" "closedin X C" "U = insert None (Some ` (topspace X - C))" + by (auto simp: openin_Alexandroff_compactification) + then show "openin X {x \ topspace X. Some x \ U}" + proof cases + case 1 + then show ?thesis + using openin_subopen openin_subset by fastforce + next + case 2 + then show ?thesis + by (simp add: closedin_def image_iff set_diff_eq) + qed +qed auto + + +lemma embedding_map_Some: "embedding_map X (Alexandroff_compactification X) Some" + by (simp add: continuous_map_Some injective_open_imp_embedding_map open_map_Some) + +lemma compact_space_Alexandroff_compactification [simp]: + "compact_space(Alexandroff_compactification X)" +proof (clarsimp simp: compact_space_alt image_subset_iff) + fix \ U + assume ope [rule_format]: "\U\\. openin (Alexandroff_compactification X) U" + and cover: "\x\topspace X. \X\\. Some x \ X" + and "U \ \" "None \ U" + then have Usub: "U \ insert None (Some ` topspace X)" + by (metis openin_subset topspace_Alexandroff_compactification) + with ope [OF \U \ \\] \None \ U\ + obtain C where C: "compactin X C \ closedin X C \ + insert None (Some ` topspace X) - U = Some ` C" + by (auto simp: openin_closedin closedin_Alexandroff_compactification) + then have D: "compactin (Alexandroff_compactification X) (insert None (Some ` topspace X) - U)" + by (metis continuous_map_Some image_compactin) + consider V where "openin X V" "U = Some ` V" + | C where "compactin X C" "closedin X C" "U = insert None (Some ` (topspace X - C))" + using ope [OF \U \ \\] by (auto simp: openin_Alexandroff_compactification) + then show "\\. finite \ \ \ \ \ \ (\X\\. None \ X) \ (\x\topspace X. \X\\. Some x \ X)" + proof cases + case 1 + then show ?thesis + using \None \ U\ by blast + next + case 2 + obtain \ where "finite \" "\ \ \" "insert None (Some ` topspace X) - U \ \\" + by (smt (verit, del_insts) C D Union_iff compactinD compactin_subset_topspace cover image_subset_iff ope subsetD) + with \U \ \\ show ?thesis + by (rule_tac x="insert U \" in exI) auto + qed +qed + +lemma topspace_Alexandroff_compactification_delete: + "topspace(Alexandroff_compactification X) - {None} = Some ` topspace X" + by simp + +lemma Alexandroff_compactification_dense: + assumes "\ compact_space X" + shows "(Alexandroff_compactification X) closure_of (Some ` topspace X) = + topspace(Alexandroff_compactification X)" + unfolding topspace_Alexandroff_compactification_delete [symmetric] +proof (intro one_point_compactification_dense) + show "\ compactin (Alexandroff_compactification X) (topspace (Alexandroff_compactification X) - {None})" + using assms compact_space_proper_map_preimage compact_space_subtopology embedding_map_Some embedding_map_def homeomorphic_imp_proper_map by fastforce +qed auto + + +lemma t0_space_one_point_compactification: + assumes "compact_space X \ openin X (topspace X - {a})" + shows "t0_space X \ t0_space (subtopology X (topspace X - {a}))" + (is "?lhs \ ?rhs") +proof + show "?lhs \ ?rhs" + using t0_space_subtopology by blast + show "?rhs \ ?lhs" + using assms + unfolding t0_space_def by (bestsimp simp flip: Int_Diff dest: openin_trans_full) +qed + +lemma t0_space_Alexandroff_compactification [simp]: + "t0_space (Alexandroff_compactification X) \ t0_space X" + using t0_space_one_point_compactification [of "Alexandroff_compactification X" None] + using embedding_map_Some embedding_map_imp_homeomorphic_space homeomorphic_t0_space by fastforce + +lemma t1_space_one_point_compactification: + assumes Xa: "openin X (topspace X - {a})" + and \
: "\K. \compactin (subtopology X (topspace X - {a})) K; closedin (subtopology X (topspace X - {a})) K\ \ closedin X K" + shows "t1_space X \ t1_space (subtopology X (topspace X - {a}))" (is "?lhs \ ?rhs") +proof + show "?lhs \ ?rhs" + using t1_space_subtopology by blast + assume R: ?rhs + show ?lhs + unfolding t1_space_closedin_singleton + proof (intro strip) + fix x + assume "x \ topspace X" + show "closedin X {x}" + proof (cases "x=a") + case True + then show ?thesis + using \x \ topspace X\ Xa closedin_def by blast + next + case False + show ?thesis + by (simp add: "\
" False R \x \ topspace X\ closedin_t1_singleton) + qed + qed +qed + +lemma closedin_Alexandroff_I: + assumes "compactin (Alexandroff_compactification X) K" "K \ Some ` topspace X" + "closedin (Alexandroff_compactification X) T" "K = T \ Some ` topspace X" + shows "closedin (Alexandroff_compactification X) K" +proof - + obtain S where S: "S \ topspace X" "K = Some ` S" + by (meson \K \ Some ` topspace X\ subset_imageE) + with assms have "compactin X S" + by (metis compactin_subtopology embedding_map_Some embedding_map_def homeomorphic_map_compactness) + moreover have "closedin X S" + using assms S + by (metis closedin_subtopology embedding_map_Some embedding_map_def homeomorphic_map_closedness) + ultimately show ?thesis + by (simp add: S) +qed + + +lemma t1_space_Alexandroff_compactification [simp]: + "t1_space(Alexandroff_compactification X) \ t1_space X" +proof - + have "openin (Alexandroff_compactification X) (topspace (Alexandroff_compactification X) - {None})" + by auto + then show ?thesis + using t1_space_one_point_compactification [of "Alexandroff_compactification X" None] + using embedding_map_Some embedding_map_imp_homeomorphic_space homeomorphic_t1_space + by (fastforce simp add: compactin_subtopology closedin_Alexandroff_I closedin_subtopology) +qed + + +lemma kc_space_one_point_compactification: + assumes "compact_space X" + and ope: "openin X (topspace X - {a})" + and \
: "\K. \compactin (subtopology X (topspace X - {a})) K; closedin (subtopology X (topspace X - {a})) K\ + \ closedin X K" + shows "kc_space X \ + k_space (subtopology X (topspace X - {a})) \ kc_space (subtopology X (topspace X - {a}))" +proof - + have "closedin X K" + if "kc_space (subtopology X (topspace X - {a}))" and "compactin X K" "a \ K" for K + using that unfolding kc_space_def + by (metis "\
" Diff_empty compactin_subspace compactin_subtopology subset_Diff_insert) + then show ?thesis + by (metis \compact_space X\ kc_space_one_point_compactification_gen ope) +qed + +lemma kc_space_Alexandroff_compactification: + "kc_space(Alexandroff_compactification X) \ (k_space X \ kc_space X)" (is "kc_space ?Y = _") +proof - + have "kc_space (Alexandroff_compactification X) \ + (k_space (subtopology ?Y (topspace ?Y - {None})) \ kc_space (subtopology ?Y (topspace ?Y - {None})))" + by (rule kc_space_one_point_compactification) (auto simp: compactin_subtopology closedin_subtopology closedin_Alexandroff_I) + also have "... \ k_space X \ kc_space X" + using embedding_map_Some embedding_map_imp_homeomorphic_space homeomorphic_k_space homeomorphic_kc_space by simp blast + finally show ?thesis . +qed + + +lemma regular_space_one_point_compactification: + assumes "compact_space X" and ope: "openin X (topspace X - {a})" + and \
: "\K. \compactin (subtopology X (topspace X - {a})) K; closedin (subtopology X (topspace X - {a})) K\ \ closedin X K" + shows "regular_space X \ + regular_space (subtopology X (topspace X - {a})) \ locally_compact_space (subtopology X (topspace X - {a}))" + (is "?lhs \ ?rhs") +proof + show "?lhs \ ?rhs" + using assms(1) compact_imp_locally_compact_space locally_compact_space_open_subset ope regular_space_subtopology by blast + assume R: ?rhs + let ?Xa = "subtopology X (topspace X - {a})" + show ?lhs + unfolding neighbourhood_base_of_closedin [symmetric] neighbourhood_base_of imp_conjL + proof (intro strip) + fix W x + assume "openin X W" and "x \ W" + show "\U V. openin X U \ closedin X V \ x \ U \ U \ V \ V \ W" + proof (cases "x=a") + case True + have "compactin ?Xa (topspace X - W)" + using \openin X W\ assms(1) closedin_compact_space + by (metis Diff_mono True \x \ W\ compactin_subtopology empty_subsetI insert_subset openin_closedin_eq order_refl) + then obtain V K where V: "openin ?Xa V" and K: "compactin ?Xa K" "closedin ?Xa K" and "topspace X - W \ V" "V \ K" + by (metis locally_compact_space_compact_closed_compact R) + show ?thesis + proof (intro exI conjI) + show "openin X (topspace X - K)" + using "\
" K by blast + show "closedin X (topspace X - V)" + using V ope openin_trans_full by blast + show "x \ topspace X - K" + proof (rule) + show "x \ topspace X" + using \openin X W\ \x \ W\ openin_subset by blast + show "x \ K" + using K True closedin_imp_subset by blast + qed + show "topspace X - K \ topspace X - V" + by (simp add: Diff_mono \V \ K\) + show "topspace X - V \ W" + using \topspace X - W \ V\ by auto + qed + next + case False + have "openin ?Xa ((topspace X - {a}) \ W)" + using \openin X W\ openin_subtopology_Int2 by blast + moreover have "x \ (topspace X - {a}) \ W" + using \openin X W\ \x \ W\ openin_subset False by blast + ultimately obtain U V where "openin ?Xa U" "compactin ?Xa V" "closedin ?Xa V" + "x \ U" "U \ V" "V \ (topspace X - {a}) \ W" + using R locally_compact_regular_space_neighbourhood_base neighbourhood_base_of + by (metis (no_types, lifting)) + then show ?thesis + by (meson "\
" le_infE ope openin_trans_full) + qed + qed +qed + + +lemma regular_space_Alexandroff_compactification: + "regular_space(Alexandroff_compactification X) \ regular_space X \ locally_compact_space X" + (is "regular_space ?Y = ?rhs") +proof - + have "regular_space ?Y \ + 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 + finally show ?thesis . +qed + + +lemma Hausdorff_space_one_point_compactification: + assumes "compact_space X" and "openin X (topspace X - {a})" + and "\K. \compactin (subtopology X (topspace X - {a})) K; closedin (subtopology X (topspace X - {a})) K\ \ closedin X K" + shows "Hausdorff_space X \ + Hausdorff_space (subtopology X (topspace X - {a})) \ locally_compact_space (subtopology X (topspace X - {a}))" + (is "?lhs \ ?rhs") +proof + show ?rhs if ?lhs + proof - + have "locally_compact_space (subtopology X (topspace X - {a}))" + using assms that compact_imp_locally_compact_space locally_compact_space_open_subset + by blast + with that show ?rhs + by (simp add: Hausdorff_space_subtopology) + qed +next + show "?rhs \ ?lhs" + by (metis assms locally_compact_Hausdorff_or_regular regular_space_one_point_compactification + regular_t1_eq_Hausdorff_space t1_space_one_point_compactification) +qed + +lemma Hausdorff_space_Alexandroff_compactification: + "Hausdorff_space(Alexandroff_compactification X) \ Hausdorff_space X \ locally_compact_space X" + by (meson compact_Hausdorff_imp_regular_space compact_space_Alexandroff_compactification + locally_compact_Hausdorff_or_regular regular_space_Alexandroff_compactification + regular_t1_eq_Hausdorff_space t1_space_Alexandroff_compactification) + +lemma completely_regular_space_Alexandroff_compactification: + "completely_regular_space(Alexandroff_compactification X) \ + completely_regular_space X \ locally_compact_space X" + by (metis regular_space_Alexandroff_compactification completely_regular_eq_regular_space + compact_imp_locally_compact_space compact_space_Alexandroff_compactification) + +lemma Hausdorff_space_one_point_compactification_asymmetric_prod: + assumes "compact_space X" + shows "Hausdorff_space X \ + kc_space (prod_topology X (subtopology X (topspace X - {a}))) \ + k_space (prod_topology X (subtopology X (topspace X - {a})))" (is "?lhs \ ?rhs") +proof (cases "a \ topspace X") + case True + show ?thesis + proof + show ?rhs if ?lhs + proof + show "kc_space (prod_topology X (subtopology X (topspace X - {a})))" + using Hausdorff_imp_kc_space kc_space_prod_topology_right kc_space_subtopology that by blast + show "k_space (prod_topology X (subtopology X (topspace X - {a})))" + by (meson Hausdorff_imp_kc_space assms compact_imp_locally_compact_space k_space_prod_topology_left + kc_space_one_point_compactification_gen that) + qed + next + assume R: ?rhs + define D where "D \ (\x. (x,x)) ` (topspace X - {a})" + show ?lhs + proof (cases "topspace X = {a}") + case True + then show ?thesis + by (simp add: Hausdorff_space_def) + next + case False + then have "kc_space X" + using kc_space_retraction_map_image [of "prod_topology X (subtopology X (topspace X - {a}))" X fst] + by (metis Diff_subset R True insert_Diff retraction_map_fst topspace_subtopology_subset) + have "closedin (subtopology (prod_topology X (subtopology X (topspace X - {a}))) K) (K \ D)" + if "compactin (prod_topology X (subtopology X (topspace X - {a}))) K" for K + proof (intro closedin_subtopology_Int_subset[where V=K] closedin_subset_topspace) + show "fst ` K \ snd ` K \ D \ fst ` K \ snd ` K" "K \ fst ` K \ snd ` K" + by force+ + have eq: "(fst ` K \ snd ` K \ D) = ((\x. (x,x)) ` (fst ` K \ snd ` K))" + using compactin_subset_topspace that by (force simp: D_def image_iff) + have "compactin (prod_topology X (subtopology X (topspace X - {a}))) (fst ` K \ snd ` K \ D)" + unfolding eq + proof (rule image_compactin [of "subtopology X (topspace X - {a})"]) + have "compactin X (fst ` K)" "compactin X (snd ` K)" + by (meson compactin_subtopology continuous_map_fst continuous_map_snd image_compactin that)+ + moreover have "fst ` K \ snd ` K \ topspace X - {a}" + using compactin_subset_topspace that by force + ultimately + show "compactin (subtopology X (topspace X - {a})) (fst ` K \ snd ` K)" + unfolding compactin_subtopology + by (meson \kc_space X\ closed_Int_compactin kc_space_def) + show "continuous_map (subtopology X (topspace X - {a})) (prod_topology X (subtopology X (topspace X - {a}))) (\x. (x,x))" + by (simp add: continuous_map_paired) + qed + then show "closedin (prod_topology X (subtopology X (topspace X - {a}))) (fst ` K \ snd ` K \ D)" + using R compactin_imp_closedin_gen by blast + qed + moreover have "D \ topspace X \ (topspace X \ (topspace X - {a}))" + by (auto simp: D_def) + ultimately have *: "closedin (prod_topology X (subtopology X (topspace X - {a}))) D" + using R by (auto simp: k_space) + have "x=y" + if "x \ topspace X" "y \ topspace X" + and \
: "\T. \(x,y) \ T; openin (prod_topology X X) T\ \ \z \ topspace X. (z,z) \ T" for x y + proof (cases "x=a \ y=a") + case False + then consider "x\a" | "y\a" + by blast + then show ?thesis + proof cases + case 1 + have "\z \ topspace X - {a}. (z,z) \ T" + if "(y,x) \ T" "openin (prod_topology X (subtopology X (topspace X - {a}))) T" for T + proof - + have "(x,y) \ {z \ topspace (prod_topology X X). (snd z,fst z) \ T \ topspace X \ (topspace X - {a})}" + by (simp add: "1" \x \ topspace X\ \y \ topspace X\ that) + moreover have "openin (prod_topology X X) {z \ topspace (prod_topology X X). (snd z,fst z) \ T \ topspace X \ (topspace X - {a})}" + proof (rule openin_continuous_map_preimage) + show "continuous_map (prod_topology X X) (prod_topology X X) (\x. (snd x, fst x))" + by (simp add: continuous_map_fst continuous_map_pairedI continuous_map_snd) + have "openin (prod_topology X X) (topspace X \ (topspace X - {a}))" + using \kc_space X\ assms kc_space_one_point_compactification_gen openin_prod_Times_iff by fastforce + moreover have "openin (prod_topology X X) T" + using kc_space_one_point_compactification_gen [OF \compact_space X\] \kc_space X\ that + by (metis openin_prod_Times_iff openin_topspace openin_trans_full prod_topology_subtopology(2)) + ultimately show "openin (prod_topology X X) (T \ topspace X \ (topspace X - {a}))" + by blast + qed + ultimately show ?thesis + by (smt (verit) \
Int_iff fst_conv mem_Collect_eq mem_Sigma_iff snd_conv) + qed + then have "(y,x) \ prod_topology X (subtopology X (topspace X - {a})) closure_of D" + by (simp add: "1" D_def in_closure_of that) + then show ?thesis + using that "*" D_def closure_of_closedin by fastforce + next + case 2 + have "\z \ topspace X - {a}. (z,z) \ T" + if "(x,y) \ T" "openin (prod_topology X (subtopology X (topspace X - {a}))) T" for T + proof - + have "openin (prod_topology X X) (topspace X \ (topspace X - {a}))" + using \kc_space X\ assms kc_space_one_point_compactification_gen openin_prod_Times_iff by fastforce + moreover have XXT: "openin (prod_topology X X) T" + using kc_space_one_point_compactification_gen [OF \compact_space X\] \kc_space X\ that + by (metis openin_prod_Times_iff openin_topspace openin_trans_full prod_topology_subtopology(2)) + ultimately have "openin (prod_topology X X) (T \ topspace X \ (topspace X - {a}))" + by blast + then show ?thesis + by (smt (verit) "\
" Diff_subset XXT mem_Sigma_iff openin_subset subsetD that topspace_prod_topology topspace_subtopology_subset) + qed + then have "(x,y) \ prod_topology X (subtopology X (topspace X - {a})) closure_of D" + by (simp add: "2" D_def in_closure_of that) + then show ?thesis + using that "*" D_def closure_of_closedin by fastforce + qed + qed auto + then show ?thesis + unfolding Hausdorff_space_closedin_diagonal closure_of_subset_eq [symmetric] + by (force simp add: closure_of_def) + qed + qed +next + case False + then show ?thesis + by (simp add: assms compact_imp_k_space compact_space_prod_topology kc_space_compact_prod_topology) +qed + + +lemma Hausdorff_space_Alexandroff_compactification_asymmetric_prod: + "Hausdorff_space(Alexandroff_compactification X) \ + kc_space(prod_topology (Alexandroff_compactification X) X) \ + k_space(prod_topology (Alexandroff_compactification X) X)" + (is "Hausdorff_space ?Y = ?rhs") +proof - + have *: "subtopology (Alexandroff_compactification X) + (topspace (Alexandroff_compactification X) - + {None}) homeomorphic_space X" + using embedding_map_Some embedding_map_imp_homeomorphic_space homeomorphic_space_sym by fastforce + have "Hausdorff_space (Alexandroff_compactification X) \ + (kc_space (prod_topology ?Y (subtopology ?Y (topspace ?Y - {None}))) \ + k_space (prod_topology ?Y (subtopology ?Y (topspace ?Y - {None}))))" + by (rule Hausdorff_space_one_point_compactification_asymmetric_prod) (auto simp: compactin_subtopology closedin_subtopology closedin_Alexandroff_I) + also have "... \ ?rhs" + using homeomorphic_k_space homeomorphic_kc_space homeomorphic_space_prod_topology + homeomorphic_space_refl * by blast + finally show ?thesis . +qed + +lemma kc_space_as_compactification_unique: + assumes "kc_space X" "compact_space X" + shows "openin X U \ + (if a \ U then U \ topspace X \ compactin X (topspace X - U) + else openin (subtopology X (topspace X - {a})) U)" +proof (cases "a \ U") + case True + then show ?thesis + by (meson assms closedin_compact_space compactin_imp_closedin_gen openin_closedin_eq) +next + case False + then show ?thesis + by (metis Diff_empty kc_space_one_point_compactification_gen openin_open_subtopology openin_subset subset_Diff_insert assms) +qed + +lemma kc_space_as_compactification_unique_explicit: + assumes "kc_space X" "compact_space X" + shows "openin X U \ + (if a \ U then U \ topspace X \ + compactin (subtopology X (topspace X - {a})) (topspace X - U) \ + closedin (subtopology X (topspace X - {a})) (topspace X - U) + else openin (subtopology X (topspace X - {a})) U)" + apply (simp add: kc_space_subtopology compactin_imp_closedin_gen assms compactin_subtopology cong: conj_cong) + by (metis Diff_mono assms bot.extremum insert_subset kc_space_as_compactification_unique subset_refl) + +lemma Alexandroff_compactification_unique: + assumes "kc_space X" "compact_space X" and a: "a \ topspace X" + shows "Alexandroff_compactification (subtopology X (topspace X - {a})) homeomorphic_space X" + (is "?Y homeomorphic_space X") +proof - + have [simp]: "topspace X \ (topspace X - {a}) = topspace X - {a}" + by auto + have [simp]: "insert None (Some ` A) = insert None (Some ` B) \ A = B" + "insert None (Some ` A) \ Some ` B" for A B + by auto + have "quotient_map X ?Y (\x. if x = a then None else Some x)" + unfolding quotient_map_def + proof (intro conjI strip) + show "(\x. if x = a then None else Some x) ` topspace X = topspace ?Y" + using \a \ topspace X\ by force + show "openin X {x \ topspace X. (if x = a then None else Some x) \ U} = openin ?Y U" (is "?L = ?R") + if "U \ topspace ?Y" for U + proof (cases "None \ U") + case True + then obtain T where T[simp]: "U = insert None (Some ` T)" + by (metis Int_insert_right UNIV_I UNIV_option_conv inf.orderE inf_le2 subsetI subset_imageE) + have Tsub: "T \ topspace X - {a}" + using in_these_eq that by auto + then have "{x \ topspace X. (if x = a then None else Some x) \ U} = insert a T" + by (auto simp: a image_iff cong: conj_cong) + then have "?L \ openin X (insert a T)" + by metis + also have "\ \ ?R" + using Tsub assms + apply (simp add: openin_Alexandroff_compactification kc_space_as_compactification_unique_explicit [where a=a]) + by (smt (verit, best) Diff_insert2 Diff_subset closedin_imp_subset double_diff) + finally show ?thesis . + next + case False + then obtain T where [simp]: "U = Some ` T" + by (metis Int_insert_right UNIV_I UNIV_option_conv inf.orderE inf_le2 subsetI subset_imageE) + have **: "\V. openin X V \ openin X (V - {a})" + by (simp add: assms compactin_imp_closedin_gen openin_diff) + have Tsub: "T \ topspace X - {a}" + using in_these_eq that by auto + then have "{x \ topspace X. (if x = a then None else Some x) \ U} = T" + by (auto simp: image_iff cong: conj_cong) + then show ?thesis + by (simp add: "**" Tsub openin_open_subtopology) + qed + qed + moreover have "inj_on (\x. if x = a then None else Some x) (topspace X)" + by (auto simp: inj_on_def) + ultimately show ?thesis + using homeomorphic_space_sym homeomorphic_space homeomorphic_map_def by blast +qed + +end