# HG changeset patch # User paulson # Date 1683195247 -3600 # Node ID 2b07535e0d2726a222fc4d8a267bfcb778ace1f7 # Parent 051b09437a6b496867dac21339ce7a80bcd61f17# Parent 98879407d33c86960f8dc343897dcb3fbc2d76e4 merged diff -r 051b09437a6b -r 2b07535e0d27 src/HOL/Analysis/Abstract_Topology.thy --- a/src/HOL/Analysis/Abstract_Topology.thy Thu May 04 08:53:45 2023 +1000 +++ b/src/HOL/Analysis/Abstract_Topology.thy Thu May 04 11:14:07 2023 +0100 @@ -1,5 +1,4 @@ -(* Author: L C Paulson, University of Cambridge [ported from HOL Light] -*) +(* Author: L C Paulson, University of Cambridge [ported from HOL Light] *) section \Operators involving abstract topology\ diff -r 051b09437a6b -r 2b07535e0d27 src/HOL/Analysis/Analysis.thy --- a/src/HOL/Analysis/Analysis.thy Thu May 04 08:53:45 2023 +1000 +++ b/src/HOL/Analysis/Analysis.thy Thu May 04 11:14:07 2023 +0100 @@ -4,6 +4,8 @@ Convex Determinants (* Topology *) + FSigma + Sum_Topology Connected Abstract_Limits Isolated diff -r 051b09437a6b -r 2b07535e0d27 src/HOL/Analysis/FSigma.thy --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/HOL/Analysis/FSigma.thy Thu May 04 11:14:07 2023 +0100 @@ -0,0 +1,236 @@ +(* Author: L C Paulson, University of Cambridge [ported from HOL Light, metric.ml] *) + +section \$F$-Sigma and $G$-Delta sets in a Topological Space\ + +text \An $F$-sigma set is a countable union of closed sets; a $G$-delta set is the dual.\ + +theory FSigma + imports Abstract_Topology +begin + + +definition fsigma_in + where "fsigma_in X \ countable union_of closedin X" + +definition gdelta_in + where "gdelta_in X \ (countable intersection_of openin X) relative_to topspace X" + +lemma fsigma_in_ascending: + "fsigma_in X S \ (\C. (\n. closedin X (C n)) \ (\n. C n \ C(Suc n)) \ \ (range C) = S)" + unfolding fsigma_in_def + by (metis closedin_Un countable_union_of_ascending closedin_empty) + +lemma gdelta_in_alt: + "gdelta_in X S \ S \ topspace X \ (countable intersection_of openin X) S" +proof - + have "(countable intersection_of openin X) (topspace X)" + by (simp add: countable_intersection_of_inc) + then show ?thesis + unfolding gdelta_in_def + by (metis countable_intersection_of_inter relative_to_def relative_to_imp_subset relative_to_subset) +qed + +lemma fsigma_in_subset: "fsigma_in X S \ S \ topspace X" + using closedin_subset by (fastforce simp: fsigma_in_def union_of_def subset_iff) + +lemma gdelta_in_subset: "gdelta_in X S \ S \ topspace X" + by (simp add: gdelta_in_alt) + +lemma closed_imp_fsigma_in: "closedin X S \ fsigma_in X S" + by (simp add: countable_union_of_inc fsigma_in_def) + +lemma open_imp_gdelta_in: "openin X S \ gdelta_in X S" + by (simp add: countable_intersection_of_inc gdelta_in_alt openin_subset) + +lemma fsigma_in_empty [iff]: "fsigma_in X {}" + by (simp add: closed_imp_fsigma_in) + +lemma gdelta_in_empty [iff]: "gdelta_in X {}" + by (simp add: open_imp_gdelta_in) + +lemma fsigma_in_topspace [iff]: "fsigma_in X (topspace X)" + by (simp add: closed_imp_fsigma_in) + +lemma gdelta_in_topspace [iff]: "gdelta_in X (topspace X)" + by (simp add: open_imp_gdelta_in) + +lemma fsigma_in_Union: + "\countable T; \S. S \ T \ fsigma_in X S\ \ fsigma_in X (\ T)" + by (simp add: countable_union_of_Union fsigma_in_def) + +lemma fsigma_in_Un: + "\fsigma_in X S; fsigma_in X T\ \ fsigma_in X (S \ T)" + by (simp add: countable_union_of_Un fsigma_in_def) + +lemma fsigma_in_Int: + "\fsigma_in X S; fsigma_in X T\ \ fsigma_in X (S \ T)" + by (simp add: closedin_Int countable_union_of_Int fsigma_in_def) + +lemma gdelta_in_Inter: + "\countable T; T\{}; \S. S \ T \ gdelta_in X S\ \ gdelta_in X (\ T)" + by (simp add: Inf_less_eq countable_intersection_of_Inter gdelta_in_alt) + +lemma gdelta_in_Int: + "\gdelta_in X S; gdelta_in X T\ \ gdelta_in X (S \ T)" + by (simp add: countable_intersection_of_inter gdelta_in_alt le_infI2) + +lemma gdelta_in_Un: + "\gdelta_in X S; gdelta_in X T\ \ gdelta_in X (S \ T)" + by (simp add: countable_intersection_of_union gdelta_in_alt openin_Un) + +lemma fsigma_in_diff: + assumes "fsigma_in X S" "gdelta_in X T" + shows "fsigma_in X (S - T)" +proof - + have [simp]: "S - (S \ T) = S - T" for S T :: "'a set" + by auto + have [simp]: "topspace X - \\ = (\T\\. topspace X - T)" for \ + by auto + have "\\. \countable \; \ \ Collect (openin X)\ \ + (countable union_of closedin X) (\ ((-) (topspace X) ` \))" + by (metis Ball_Collect countable_union_of_UN countable_union_of_inc openin_closedin_eq) + then have "\S. gdelta_in X S \ fsigma_in X (topspace X - S)" + by (simp add: fsigma_in_def gdelta_in_def all_relative_to all_intersection_of del: UN_simps) + then show ?thesis + by (metis Diff_Int2 Diff_Int_distrib2 assms fsigma_in_Int fsigma_in_subset inf.absorb_iff2) +qed + +lemma gdelta_in_diff: + assumes "gdelta_in X S" "fsigma_in X T" + shows "gdelta_in X (S - T)" +proof - + have [simp]: "topspace X - \\ = topspace X \ (\T\\. topspace X - T)" for \ + by auto + have "\\. \countable \; \ \ Collect (closedin X)\ + \ (countable intersection_of openin X relative_to topspace X) + (topspace X \ \ ((-) (topspace X) ` \))" + by (metis Ball_Collect closedin_def countable_intersection_of_INT countable_intersection_of_inc relative_to_inc) + then have "\S. fsigma_in X S \ gdelta_in X (topspace X - S)" + by (simp add: fsigma_in_def gdelta_in_def all_union_of del: INT_simps) + then show ?thesis + by (metis Diff_Int2 Diff_Int_distrib2 assms gdelta_in_Int gdelta_in_alt inf.orderE inf_commute) +qed + +lemma gdelta_in_fsigma_in: + "gdelta_in X S \ S \ topspace X \ fsigma_in X (topspace X - S)" + by (metis double_diff fsigma_in_diff fsigma_in_topspace gdelta_in_alt gdelta_in_diff gdelta_in_topspace) + +lemma fsigma_in_gdelta_in: + "fsigma_in X S \ S \ topspace X \ gdelta_in X (topspace X - S)" + by (metis Diff_Diff_Int fsigma_in_subset gdelta_in_fsigma_in inf.absorb_iff2) + +lemma gdelta_in_descending: + "gdelta_in X S \ (\C. (\n. openin X (C n)) \ (\n. C(Suc n) \ C n) \ \(range C) = S)" (is "?lhs=?rhs") +proof + assume ?lhs + then obtain C where C: "S \ topspace X" "\n. closedin X (C n)" + "\n. C n \ C(Suc n)" "\(range C) = topspace X - S" + by (meson fsigma_in_ascending gdelta_in_fsigma_in) + define D where "D \ \n. topspace X - C n" + have "\n. openin X (D n) \ D (Suc n) \ D n" + by (simp add: Diff_mono C D_def openin_diff) + moreover have "\(range D) = S" + by (simp add: Diff_Diff_Int Int_absorb1 C D_def) + ultimately show ?rhs + by metis +next + assume ?rhs + then obtain C where "S \ topspace X" + and C: "\n. openin X (C n)" "\n. C(Suc n) \ C n" "\(range C) = S" + using openin_subset by fastforce + define D where "D \ \n. topspace X - C n" + have "\n. closedin X (D n) \ D n \ D(Suc n)" + by (simp add: Diff_mono C closedin_diff D_def) + moreover have "\(range D) = topspace X - S" + using C D_def by blast + ultimately show ?lhs + by (metis \S \ topspace X\ fsigma_in_ascending gdelta_in_fsigma_in) +qed + +lemma homeomorphic_map_fsigmaness: + assumes f: "homeomorphic_map X Y f" and "U \ topspace X" + shows "fsigma_in Y (f ` U) \ fsigma_in X U" (is "?lhs=?rhs") +proof - + obtain g where g: "homeomorphic_maps X Y f g" and g: "homeomorphic_map Y X g" + and 1: "(\x \ topspace X. g(f x) = x)" and 2: "(\y \ topspace Y. f(g y) = y)" + using assms homeomorphic_map_maps by (metis homeomorphic_maps_map) + show ?thesis + proof + assume ?lhs + then obtain \ where "countable \" and \: "\ \ Collect (closedin Y)" "\\ = f`U" + by (force simp: fsigma_in_def union_of_def) + define \ where "\ \ image (image g) \" + have "countable \" + using \_def \countable \\ by blast + moreover have "\ \ Collect (closedin X)" + using f g homeomorphic_map_closedness_eq \ unfolding \_def by blast + moreover have "\\ \ U" + unfolding \_def by (smt (verit) assms 1 \ image_Union image_iff in_mono subsetI) + moreover have "U \ \\" + unfolding \_def using assms \ + by (smt (verit, del_insts) "1" imageI image_Union subset_iff) + ultimately show ?rhs + by (metis fsigma_in_def subset_antisym union_of_def) + next + assume ?rhs + then obtain \ where "countable \" and \: "\ \ Collect (closedin X)" "\\ = U" + by (auto simp: fsigma_in_def union_of_def) + define \ where "\ \ image (image f) \" + have "countable \" + using \_def \countable \\ by blast + moreover have "\ \ Collect (closedin Y)" + using f g homeomorphic_map_closedness_eq \ unfolding \_def by blast + moreover have "\\ = f`U" + unfolding \_def using \ by blast + ultimately show ?lhs + by (metis fsigma_in_def union_of_def) + qed +qed + +lemma homeomorphic_map_fsigmaness_eq: + "homeomorphic_map X Y f + \ (fsigma_in X U \ U \ topspace X \ fsigma_in Y (f ` U))" + by (metis fsigma_in_subset homeomorphic_map_fsigmaness) + +lemma homeomorphic_map_gdeltaness: + assumes "homeomorphic_map X Y f" "U \ topspace X" + shows "gdelta_in Y (f ` U) \ gdelta_in X U" +proof - + have "topspace Y - f ` U = f ` (topspace X - U)" + by (metis (no_types, lifting) Diff_subset assms homeomorphic_eq_everything_map inj_on_image_set_diff) + then show ?thesis + using assms homeomorphic_imp_surjective_map + by (fastforce simp: gdelta_in_fsigma_in homeomorphic_map_fsigmaness_eq) +qed + +lemma homeomorphic_map_gdeltaness_eq: + "homeomorphic_map X Y f + \ gdelta_in X U \ U \ topspace X \ gdelta_in Y (f ` U)" + by (meson gdelta_in_subset homeomorphic_map_gdeltaness) + +lemma fsigma_in_relative_to: + "(fsigma_in X relative_to S) = fsigma_in (subtopology X S)" + by (simp add: fsigma_in_def countable_union_of_relative_to closedin_relative_to) + +lemma fsigma_in_subtopology: + "fsigma_in (subtopology X U) S \ (\T. fsigma_in X T \ S = T \ U)" + by (metis fsigma_in_relative_to inf_commute relative_to_def) + +lemma gdelta_in_relative_to: + "(gdelta_in X relative_to S) = gdelta_in (subtopology X S)" + apply (simp add: gdelta_in_def) + by (metis countable_intersection_of_relative_to openin_relative_to subtopology_restrict) + +lemma gdelta_in_subtopology: + "gdelta_in (subtopology X U) S \ (\T. gdelta_in X T \ S = T \ U)" + by (metis gdelta_in_relative_to inf_commute relative_to_def) + +lemma fsigma_in_fsigma_subtopology: + "fsigma_in X S \ (fsigma_in (subtopology X S) T \ fsigma_in X T \ T \ S)" + by (metis fsigma_in_Int fsigma_in_gdelta_in fsigma_in_subtopology inf.orderE topspace_subtopology_subset) + +lemma gdelta_in_gdelta_subtopology: + "gdelta_in X S \ (gdelta_in (subtopology X S) T \ gdelta_in X T \ T \ S)" + by (metis gdelta_in_Int gdelta_in_subset gdelta_in_subtopology inf.orderE topspace_subtopology_subset) + +end diff -r 051b09437a6b -r 2b07535e0d27 src/HOL/Analysis/Product_Topology.thy --- a/src/HOL/Analysis/Product_Topology.thy Thu May 04 08:53:45 2023 +1000 +++ b/src/HOL/Analysis/Product_Topology.thy Thu May 04 11:14:07 2023 +0100 @@ -1,7 +1,7 @@ section\The binary product topology\ theory Product_Topology -imports Function_Topology + imports Function_Topology begin section \Product Topology\ diff -r 051b09437a6b -r 2b07535e0d27 src/HOL/Analysis/Sum_Topology.thy --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/HOL/Analysis/Sum_Topology.thy Thu May 04 11:14:07 2023 +0100 @@ -0,0 +1,146 @@ +section\Disjoint sum of arbitarily many spaces\ + +theory Sum_Topology + imports Abstract_Topology +begin + + +definition sum_topology :: "('a \ 'b topology) \ 'a set \ ('a \ 'b) topology" where + "sum_topology X I \ + topology (\U. U \ Sigma I (topspace \ X) \ (\i \ I. openin (X i) {x. (i,x) \ U}))" + +lemma is_sum_topology: "istopology (\U. U \ Sigma I (topspace \ X) \ (\i\I. openin (X i) {x. (i, x) \ U}))" +proof - + have 1: "{x. (i, x) \ S \ T} = {x. (i, x) \ S} \ {x::'b. (i, x) \ T}" for S T and i::'a + by auto + have 2: "{x. (i, x) \ \ \} = (\K\\. {x::'b. (i, x) \ K})" for \ and i::'a + by auto + show ?thesis + unfolding istopology_def 1 2 by blast +qed + +lemma openin_sum_topology: + "openin (sum_topology X I) U \ + U \ Sigma I (topspace \ X) \ (\i \ I. openin (X i) {x. (i,x) \ U})" + by (auto simp: sum_topology_def is_sum_topology) + +lemma openin_disjoint_union: + "openin (sum_topology X I) (Sigma I U) \ (\i \ I. openin (X i) (U i))" + using openin_subset by (force simp: openin_sum_topology) + +lemma topspace_sum_topology [simp]: + "topspace(sum_topology X I) = Sigma I (topspace \ X)" + by (metis comp_apply openin_disjoint_union openin_subset openin_sum_topology openin_topspace subset_antisym) + +lemma openin_sum_topology_alt: + "openin (sum_topology X I) U \ (\T. U = Sigma I T \ (\i \ I. openin (X i) (T i)))" + by (bestsimp simp: openin_sum_topology dest: openin_subset) + +lemma forall_openin_sum_topology: + "(\U. openin (sum_topology X I) U \ P U) \ (\T. (\i \ I. openin (X i) (T i)) \ P(Sigma I T))" + by (auto simp: openin_sum_topology_alt) + +lemma exists_openin_sum_topology: + "(\U. openin (sum_topology X I) U \ P U) \ + (\T. (\i \ I. openin (X i) (T i)) \ P(Sigma I T))" + by (auto simp: openin_sum_topology_alt) + +lemma closedin_sum_topology: + "closedin (sum_topology X I) U \ U \ Sigma I (topspace \ X) \ (\i \ I. closedin (X i) {x. (i,x) \ U})" + (is "?lhs = ?rhs") +proof + assume L: ?lhs + then have U: "U \ Sigma I (topspace \ X)" + using closedin_subset by fastforce + then have "\i\I. {x. (i, x) \ U} \ topspace (X i)" + by fastforce + moreover have "openin (X i) (topspace (X i) - {x. (i, x) \ U})" if "i\I" for i + apply (subst openin_subopen) + using L that unfolding closedin_def openin_sum_topology + by (bestsimp simp: o_def subset_iff) + ultimately show ?rhs + by (simp add: U closedin_def) +next + assume R: ?rhs + then have "openin (X i) {x. (i, x) \ topspace (sum_topology X I) - U}" if "i\I" for i + apply (subst openin_subopen) + using that unfolding closedin_def openin_sum_topology + by (bestsimp simp: o_def subset_iff) + then show ?lhs + by (simp add: R closedin_def openin_sum_topology) +qed + +lemma closedin_disjoint_union: + "closedin (sum_topology X I) (Sigma I U) \ (\i \ I. closedin (X i) (U i))" + using closedin_subset by (force simp: closedin_sum_topology) + +lemma closedin_sum_topology_alt: + "closedin (sum_topology X I) U \ (\T. U = Sigma I T \ (\i \ I. closedin (X i) (T i)))" + using closedin_subset unfolding closedin_sum_topology by auto blast + +lemma forall_closedin_sum_topology: + "(\U. closedin (sum_topology X I) U \ P U) \ + (\t. (\i \ I. closedin (X i) (t i)) \ P(Sigma I t))" + by (metis closedin_sum_topology_alt) + +lemma exists_closedin_sum_topology: + "(\U. closedin (sum_topology X I) U \ P U) \ + (\T. (\i \ I. closedin (X i) (T i)) \ P(Sigma I T))" + by (simp add: closedin_sum_topology_alt) blast + +lemma open_map_component_injection: + "i \ I \ open_map (X i) (sum_topology X I) (\x. (i,x))" + unfolding open_map_def openin_sum_topology + using openin_subset openin_subopen by (force simp: image_iff) + +lemma closed_map_component_injection: + assumes "i \ I" + shows "closed_map(X i) (sum_topology X I) (\x. (i,x))" +proof - + have "closedin (X j) {x. j = i \ x \ U}" + if "\U S. closedin U S \ S \ topspace U" and "closedin (X i) U" and "j \ I" for U j + using that by (cases "j=i") auto + then show ?thesis + using closedin_subset assms by (force simp: closed_map_def closedin_sum_topology image_iff) +qed + +lemma continuous_map_component_injection: + "i \ I \ continuous_map(X i) (sum_topology X I) (\x. (i,x))" + apply (clarsimp simp: continuous_map_def openin_sum_topology) + by (smt (verit, best) Collect_cong mem_Collect_eq openin_subset subsetD) + +lemma subtopology_sum_topology: + "subtopology (sum_topology X I) (Sigma I S) = + sum_topology (\i. subtopology (X i) (S i)) I" + unfolding topology_eq +proof (intro strip iffI) + fix T + assume *: "openin (subtopology (sum_topology X I) (Sigma I S)) T" + then obtain U where U: "\i\I. openin (X i) (U i) \ T = Sigma I U \ Sigma I S" + by (auto simp: openin_subtopology openin_sum_topology_alt) + have "T = (SIGMA i:I. U i \ S i)" + proof + show "T \ (SIGMA i:I. U i \ S i)" + by (metis "*" SigmaE Sigma_Int_distrib2 U openin_imp_subset subset_iff) + show "(SIGMA i:I. U i \ S i) \ T" + using U by fastforce + qed + then show "openin (sum_topology (\i. subtopology (X i) (S i)) I) T" + by (simp add: U openin_disjoint_union openin_subtopology_Int) +next + fix T + assume *: "openin (sum_topology (\i. subtopology (X i) (S i)) I) T" + then obtain U where "\i\I. \T. openin (X i) T \ U i = T \ S i" and Teq: "T = Sigma I U" + by (auto simp: openin_subtopology openin_sum_topology_alt) + then obtain B where "\i. i\I \ openin (X i) (B i) \ U i = B i \ S i" + by metis + then show "openin (subtopology (sum_topology X I) (Sigma I S)) T" + by (auto simp: openin_subtopology openin_sum_topology_alt Teq) +qed + +lemma embedding_map_component_injection: + "i \ I \ embedding_map (X i) (sum_topology X I) (\x. (i,x))" + by (metis injective_open_imp_embedding_map continuous_map_component_injection + open_map_component_injection inj_onI prod.inject) + +end