src/HOL/Analysis/Function_Topology.thy
changeset 69677 a06b204527e6
parent 69597 ff784d5a5bfb
child 69680 96a43caa4902
equal deleted inserted replaced
69661:a03a63b81f44 69677:a06b204527e6
    59 topology, even when the product is not finite (or even countable).
    59 topology, even when the product is not finite (or even countable).
    60 
    60 
    61 I realized afterwards that this theory has a lot in common with \<^file>\<open>~~/src/HOL/Library/Finite_Map.thy\<close>.
    61 I realized afterwards that this theory has a lot in common with \<^file>\<open>~~/src/HOL/Library/Finite_Map.thy\<close>.
    62 \<close>
    62 \<close>
    63 
    63 
       
    64 
       
    65 
    64 subsection%important \<open>Topology without type classes\<close>
    66 subsection%important \<open>Topology without type classes\<close>
    65 
    67 
    66 subsubsection%important \<open>The topology generated by some (open) subsets\<close>
    68 subsubsection%important \<open>The topology generated by some (open) subsets\<close>
    67 
    69 
    68 text \<open>In the definition below of a generated topology, the \<open>Empty\<close> case is not necessary,
    70 text \<open>In the definition below of a generated topology, the \<open>Empty\<close> case is not necessary,
    76   Empty: "generate_topology_on S {}"
    78   Empty: "generate_topology_on S {}"
    77 | Int: "generate_topology_on S a \<Longrightarrow> generate_topology_on S b \<Longrightarrow> generate_topology_on S (a \<inter> b)"
    79 | Int: "generate_topology_on S a \<Longrightarrow> generate_topology_on S b \<Longrightarrow> generate_topology_on S (a \<inter> b)"
    78 | UN: "(\<And>k. k \<in> K \<Longrightarrow> generate_topology_on S k) \<Longrightarrow> generate_topology_on S (\<Union>K)"
    80 | UN: "(\<And>k. k \<in> K \<Longrightarrow> generate_topology_on S k) \<Longrightarrow> generate_topology_on S (\<Union>K)"
    79 | Basis: "s \<in> S \<Longrightarrow> generate_topology_on S s"
    81 | Basis: "s \<in> S \<Longrightarrow> generate_topology_on S s"
    80 
    82 
    81 lemma%unimportant istopology_generate_topology_on:
    83 lemma istopology_generate_topology_on:
    82   "istopology (generate_topology_on S)"
    84   "istopology (generate_topology_on S)"
    83 unfolding istopology_def by (auto intro: generate_topology_on.intros)
    85 unfolding istopology_def by (auto intro: generate_topology_on.intros)
    84 
    86 
    85 text \<open>The basic property of the topology generated by a set \<open>S\<close> is that it is the
    87 text \<open>The basic property of the topology generated by a set \<open>S\<close> is that it is the
    86 smallest topology containing all the elements of \<open>S\<close>:\<close>
    88 smallest topology containing all the elements of \<open>S\<close>:\<close>
    87 
    89 
    88 lemma%unimportant generate_topology_on_coarsest:
    90 lemma generate_topology_on_coarsest:
    89   assumes "istopology T"
    91   assumes "istopology T"
    90           "\<And>s. s \<in> S \<Longrightarrow> T s"
    92           "\<And>s. s \<in> S \<Longrightarrow> T s"
    91           "generate_topology_on S s0"
    93           "generate_topology_on S s0"
    92   shows "T s0"
    94   shows "T s0"
    93 using assms(3) apply (induct rule: generate_topology_on.induct)
    95 using assms(3) apply (induct rule: generate_topology_on.induct)
    94 using assms(1) assms(2) unfolding istopology_def by auto
    96 using assms(1) assms(2) unfolding istopology_def by auto
    95 
    97 
    96 abbreviation%unimportant topology_generated_by::"('a set set) \<Rightarrow> ('a topology)"
    98 abbreviation%unimportant topology_generated_by::"('a set set) \<Rightarrow> ('a topology)"
    97   where "topology_generated_by S \<equiv> topology (generate_topology_on S)"
    99   where "topology_generated_by S \<equiv> topology (generate_topology_on S)"
    98 
   100 
    99 lemma%unimportant openin_topology_generated_by_iff:
   101 lemma openin_topology_generated_by_iff:
   100   "openin (topology_generated_by S) s \<longleftrightarrow> generate_topology_on S s"
   102   "openin (topology_generated_by S) s \<longleftrightarrow> generate_topology_on S s"
   101   using topology_inverse'[OF istopology_generate_topology_on[of S]] by simp
   103   using topology_inverse'[OF istopology_generate_topology_on[of S]] by simp
   102 
   104 
   103 lemma%unimportant openin_topology_generated_by:
   105 lemma openin_topology_generated_by:
   104   "openin (topology_generated_by S) s \<Longrightarrow> generate_topology_on S s"
   106   "openin (topology_generated_by S) s \<Longrightarrow> generate_topology_on S s"
   105 using openin_topology_generated_by_iff by auto
   107 using openin_topology_generated_by_iff by auto
   106 
   108 
   107 lemma%important topology_generated_by_topspace:
   109 lemma topology_generated_by_topspace:
   108   "topspace (topology_generated_by S) = (\<Union>S)"
   110   "topspace (topology_generated_by S) = (\<Union>S)"
   109 proof%unimportant
   111 proof
   110   {
   112   {
   111     fix s assume "openin (topology_generated_by S) s"
   113     fix s assume "openin (topology_generated_by S) s"
   112     then have "generate_topology_on S s" by (rule openin_topology_generated_by)
   114     then have "generate_topology_on S s" by (rule openin_topology_generated_by)
   113     then have "s \<subseteq> (\<Union>S)" by (induct, auto)
   115     then have "s \<subseteq> (\<Union>S)" by (induct, auto)
   114   }
   116   }
   119     using generate_topology_on.UN[OF generate_topology_on.Basis, of S S] by simp
   121     using generate_topology_on.UN[OF generate_topology_on.Basis, of S S] by simp
   120   then show "(\<Union>S) \<subseteq> topspace (topology_generated_by S)"
   122   then show "(\<Union>S) \<subseteq> topspace (topology_generated_by S)"
   121     unfolding topspace_def using openin_topology_generated_by_iff by auto
   123     unfolding topspace_def using openin_topology_generated_by_iff by auto
   122 qed
   124 qed
   123 
   125 
   124 lemma%important topology_generated_by_Basis:
   126 lemma topology_generated_by_Basis:
   125   "s \<in> S \<Longrightarrow> openin (topology_generated_by S) s"
   127   "s \<in> S \<Longrightarrow> openin (topology_generated_by S) s"
   126 by%unimportant (simp only: openin_topology_generated_by_iff, auto simp: generate_topology_on.Basis)
   128   by (simp only: openin_topology_generated_by_iff, auto simp: generate_topology_on.Basis)
   127 
   129 
   128 lemma generate_topology_on_Inter:
   130 lemma generate_topology_on_Inter:
   129   "\<lbrakk>finite \<F>; \<And>K. K \<in> \<F> \<Longrightarrow> generate_topology_on \<S> K; \<F> \<noteq> {}\<rbrakk> \<Longrightarrow> generate_topology_on \<S> (\<Inter>\<F>)"
   131   "\<lbrakk>finite \<F>; \<And>K. K \<in> \<F> \<Longrightarrow> generate_topology_on \<S> K; \<F> \<noteq> {}\<rbrakk> \<Longrightarrow> generate_topology_on \<S> (\<Inter>\<F>)"
   130   by (induction \<F> rule: finite_induct; force intro: generate_topology_on.intros)
   132   by (induction \<F> rule: finite_induct; force intro: generate_topology_on.intros)
   131 
   133 
   264 
   266 
   265 definition%important continuous_on_topo::"'a topology \<Rightarrow> 'b topology \<Rightarrow> ('a \<Rightarrow> 'b) \<Rightarrow> bool"
   267 definition%important continuous_on_topo::"'a topology \<Rightarrow> 'b topology \<Rightarrow> ('a \<Rightarrow> 'b) \<Rightarrow> bool"
   266   where "continuous_on_topo T1 T2 f = ((\<forall> U. openin T2 U \<longrightarrow> openin T1 (f-`U \<inter> topspace(T1)))
   268   where "continuous_on_topo T1 T2 f = ((\<forall> U. openin T2 U \<longrightarrow> openin T1 (f-`U \<inter> topspace(T1)))
   267                                       \<and> (f`(topspace T1) \<subseteq> (topspace T2)))"
   269                                       \<and> (f`(topspace T1) \<subseteq> (topspace T2)))"
   268 
   270 
   269 lemma%important continuous_on_continuous_on_topo:
   271 lemma continuous_on_continuous_on_topo:
   270   "continuous_on s f \<longleftrightarrow> continuous_on_topo (subtopology euclidean s) euclidean f"
   272   "continuous_on s f \<longleftrightarrow> continuous_on_topo (subtopology euclidean s) euclidean f"
   271 unfolding%unimportant continuous_on_open_invariant openin_open vimage_def continuous_on_topo_def
   273   unfolding continuous_on_open_invariant openin_open vimage_def continuous_on_topo_def
   272 topspace_euclidean_subtopology open_openin topspace_euclidean by fast
   274 topspace_euclidean_subtopology open_openin topspace_euclidean by fast
   273 
   275 
   274 lemma%unimportant continuous_on_topo_UNIV:
   276 lemma continuous_on_topo_UNIV:
   275   "continuous_on UNIV f \<longleftrightarrow> continuous_on_topo euclidean euclidean f"
   277   "continuous_on UNIV f \<longleftrightarrow> continuous_on_topo euclidean euclidean f"
   276 using continuous_on_continuous_on_topo[of UNIV f] subtopology_UNIV[of euclidean] by auto
   278 using continuous_on_continuous_on_topo[of UNIV f] subtopology_UNIV[of euclidean] by auto
   277 
   279 
   278 lemma%important continuous_on_topo_open [intro]:
   280 lemma continuous_on_topo_open [intro]:
   279   "continuous_on_topo T1 T2 f \<Longrightarrow> openin T2 U \<Longrightarrow> openin T1 (f-`U \<inter> topspace(T1))"
   281   "continuous_on_topo T1 T2 f \<Longrightarrow> openin T2 U \<Longrightarrow> openin T1 (f-`U \<inter> topspace(T1))"
   280 unfolding%unimportant continuous_on_topo_def by auto
   282   unfolding continuous_on_topo_def by auto
   281 
   283 
   282 lemma%unimportant continuous_on_topo_topspace [intro]:
   284 lemma continuous_on_topo_topspace [intro]:
   283   "continuous_on_topo T1 T2 f \<Longrightarrow> f`(topspace T1) \<subseteq> (topspace T2)"
   285   "continuous_on_topo T1 T2 f \<Longrightarrow> f`(topspace T1) \<subseteq> (topspace T2)"
   284 unfolding continuous_on_topo_def by auto
   286 unfolding continuous_on_topo_def by auto
   285 
   287 
   286 lemma%important continuous_on_generated_topo_iff:
   288 lemma continuous_on_generated_topo_iff:
   287   "continuous_on_topo T1 (topology_generated_by S) f \<longleftrightarrow>
   289   "continuous_on_topo T1 (topology_generated_by S) f \<longleftrightarrow>
   288       ((\<forall>U. U \<in> S \<longrightarrow> openin T1 (f-`U \<inter> topspace(T1))) \<and> (f`(topspace T1) \<subseteq> (\<Union> S)))"
   290       ((\<forall>U. U \<in> S \<longrightarrow> openin T1 (f-`U \<inter> topspace(T1))) \<and> (f`(topspace T1) \<subseteq> (\<Union> S)))"
   289 unfolding continuous_on_topo_def topology_generated_by_topspace
   291 unfolding continuous_on_topo_def topology_generated_by_topspace
   290 proof%unimportant (auto simp add: topology_generated_by_Basis)
   292 proof (auto simp add: topology_generated_by_Basis)
   291   assume H: "\<forall>U. U \<in> S \<longrightarrow> openin T1 (f -` U \<inter> topspace T1)"
   293   assume H: "\<forall>U. U \<in> S \<longrightarrow> openin T1 (f -` U \<inter> topspace T1)"
   292   fix U assume "openin (topology_generated_by S) U"
   294   fix U assume "openin (topology_generated_by S) U"
   293   then have "generate_topology_on S U" by (rule openin_topology_generated_by)
   295   then have "generate_topology_on S U" by (rule openin_topology_generated_by)
   294   then show "openin T1 (f -` U \<inter> topspace T1)"
   296   then show "openin T1 (f -` U \<inter> topspace T1)"
   295   proof (induct)
   297   proof (induct)
   307     moreover have "(\<Union>L) = (f -` \<Union>K \<inter> topspace T1)" unfolding L_def by auto
   309     moreover have "(\<Union>L) = (f -` \<Union>K \<inter> topspace T1)" unfolding L_def by auto
   308     ultimately show "openin T1 (f -` \<Union>K \<inter> topspace T1)" by simp
   310     ultimately show "openin T1 (f -` \<Union>K \<inter> topspace T1)" by simp
   309   qed (auto simp add: H)
   311   qed (auto simp add: H)
   310 qed
   312 qed
   311 
   313 
   312 lemma%important continuous_on_generated_topo:
   314 lemma continuous_on_generated_topo:
   313   assumes "\<And>U. U \<in>S \<Longrightarrow> openin T1 (f-`U \<inter> topspace(T1))"
   315   assumes "\<And>U. U \<in>S \<Longrightarrow> openin T1 (f-`U \<inter> topspace(T1))"
   314           "f`(topspace T1) \<subseteq> (\<Union> S)"
   316           "f`(topspace T1) \<subseteq> (\<Union> S)"
   315   shows "continuous_on_topo T1 (topology_generated_by S) f"
   317   shows "continuous_on_topo T1 (topology_generated_by S) f"
   316 using%unimportant assms continuous_on_generated_topo_iff by blast
   318   using assms continuous_on_generated_topo_iff by blast
   317 
   319 
   318 lemma%important continuous_on_topo_compose:
   320 proposition continuous_on_topo_compose:
   319   assumes "continuous_on_topo T1 T2 f" "continuous_on_topo T2 T3 g"
   321   assumes "continuous_on_topo T1 T2 f" "continuous_on_topo T2 T3 g"
   320   shows "continuous_on_topo T1 T3 (g o f)"
   322   shows "continuous_on_topo T1 T3 (g o f)"
   321 using%unimportant assms unfolding continuous_on_topo_def
   323   using assms unfolding continuous_on_topo_def
   322 proof%unimportant (auto)
   324 proof (auto)
   323   fix U :: "'c set"
   325   fix U :: "'c set"
   324   assume H: "openin T3 U"
   326   assume H: "openin T3 U"
   325   have "openin T1 (f -` (g -` U \<inter> topspace T2) \<inter> topspace T1)"
   327   have "openin T1 (f -` (g -` U \<inter> topspace T2) \<inter> topspace T1)"
   326     using H assms by blast
   328     using H assms by blast
   327   moreover have "f -` (g -` U \<inter> topspace T2) \<inter> topspace T1 = (g \<circ> f) -` U \<inter> topspace T1"
   329   moreover have "f -` (g -` U \<inter> topspace T2) \<inter> topspace T1 = (g \<circ> f) -` U \<inter> topspace T1"
   328     using H assms continuous_on_topo_topspace by fastforce
   330     using H assms continuous_on_topo_topspace by fastforce
   329   ultimately show "openin T1 ((g \<circ> f) -` U \<inter> topspace T1)"
   331   ultimately show "openin T1 ((g \<circ> f) -` U \<inter> topspace T1)"
   330     by simp
   332     by simp
   331 qed (blast)
   333 qed (blast)
   332 
   334 
   333 lemma%unimportant continuous_on_topo_preimage_topspace [intro]:
   335 lemma continuous_on_topo_preimage_topspace [intro]:
   334   assumes "continuous_on_topo T1 T2 f"
   336   assumes "continuous_on_topo T1 T2 f"
   335   shows "f-`(topspace T2) \<inter> topspace T1 = topspace T1"
   337   shows "f-`(topspace T2) \<inter> topspace T1 = topspace T1"
   336 using assms unfolding continuous_on_topo_def by auto
   338 using assms unfolding continuous_on_topo_def by auto
   337 
   339 
   338 
   340 
   347 the set \<open>A\<close>.\<close>
   349 the set \<open>A\<close>.\<close>
   348 
   350 
   349 definition%important pullback_topology::"('a set) \<Rightarrow> ('a \<Rightarrow> 'b) \<Rightarrow> ('b topology) \<Rightarrow> ('a topology)"
   351 definition%important pullback_topology::"('a set) \<Rightarrow> ('a \<Rightarrow> 'b) \<Rightarrow> ('b topology) \<Rightarrow> ('a topology)"
   350   where "pullback_topology A f T = topology (\<lambda>S. \<exists>U. openin T U \<and> S = f-`U \<inter> A)"
   352   where "pullback_topology A f T = topology (\<lambda>S. \<exists>U. openin T U \<and> S = f-`U \<inter> A)"
   351 
   353 
   352 lemma%important istopology_pullback_topology:
   354 lemma istopology_pullback_topology:
   353   "istopology (\<lambda>S. \<exists>U. openin T U \<and> S = f-`U \<inter> A)"
   355   "istopology (\<lambda>S. \<exists>U. openin T U \<and> S = f-`U \<inter> A)"
   354 unfolding%unimportant istopology_def proof (auto)
   356   unfolding istopology_def proof (auto)
   355   fix K assume "\<forall>S\<in>K. \<exists>U. openin T U \<and> S = f -` U \<inter> A"
   357   fix K assume "\<forall>S\<in>K. \<exists>U. openin T U \<and> S = f -` U \<inter> A"
   356   then have "\<exists>U. \<forall>S\<in>K. openin T (U S) \<and> S = f-`(U S) \<inter> A"
   358   then have "\<exists>U. \<forall>S\<in>K. openin T (U S) \<and> S = f-`(U S) \<inter> A"
   357     by (rule bchoice)
   359     by (rule bchoice)
   358   then obtain U where U: "\<forall>S\<in>K. openin T (U S) \<and> S = f-`(U S) \<inter> A"
   360   then obtain U where U: "\<forall>S\<in>K. openin T (U S) \<and> S = f-`(U S) \<inter> A"
   359     by blast
   361     by blast
   360   define V where "V = (\<Union>S\<in>K. U S)"
   362   define V where "V = (\<Union>S\<in>K. U S)"
   361   have "openin T V" "\<Union>K = f -` V \<inter> A" unfolding V_def using U by auto
   363   have "openin T V" "\<Union>K = f -` V \<inter> A" unfolding V_def using U by auto
   362   then show "\<exists>V. openin T V \<and> \<Union>K = f -` V \<inter> A" by auto
   364   then show "\<exists>V. openin T V \<and> \<Union>K = f -` V \<inter> A" by auto
   363 qed
   365 qed
   364 
   366 
   365 lemma%unimportant openin_pullback_topology:
   367 lemma openin_pullback_topology:
   366   "openin (pullback_topology A f T) S \<longleftrightarrow> (\<exists>U. openin T U \<and> S = f-`U \<inter> A)"
   368   "openin (pullback_topology A f T) S \<longleftrightarrow> (\<exists>U. openin T U \<and> S = f-`U \<inter> A)"
   367 unfolding pullback_topology_def topology_inverse'[OF istopology_pullback_topology] by auto
   369 unfolding pullback_topology_def topology_inverse'[OF istopology_pullback_topology] by auto
   368 
   370 
   369 lemma%unimportant topspace_pullback_topology:
   371 lemma topspace_pullback_topology:
   370   "topspace (pullback_topology A f T) = f-`(topspace T) \<inter> A"
   372   "topspace (pullback_topology A f T) = f-`(topspace T) \<inter> A"
   371 by (auto simp add: topspace_def openin_pullback_topology)
   373 by (auto simp add: topspace_def openin_pullback_topology)
   372 
   374 
   373 lemma%important continuous_on_topo_pullback [intro]:
   375 proposition continuous_on_topo_pullback [intro]:
   374   assumes "continuous_on_topo T1 T2 g"
   376   assumes "continuous_on_topo T1 T2 g"
   375   shows "continuous_on_topo (pullback_topology A f T1) T2 (g o f)"
   377   shows "continuous_on_topo (pullback_topology A f T1) T2 (g o f)"
   376 unfolding continuous_on_topo_def
   378 unfolding continuous_on_topo_def
   377 proof%unimportant (auto)
   379 proof (auto)
   378   fix U::"'b set" assume "openin T2 U"
   380   fix U::"'b set" assume "openin T2 U"
   379   then have "openin T1 (g-`U \<inter> topspace T1)"
   381   then have "openin T1 (g-`U \<inter> topspace T1)"
   380     using assms unfolding continuous_on_topo_def by auto
   382     using assms unfolding continuous_on_topo_def by auto
   381   have "(g o f)-`U \<inter> topspace (pullback_topology A f T1) = (g o f)-`U \<inter> A \<inter> f-`(topspace T1)"
   383   have "(g o f)-`U \<inter> topspace (pullback_topology A f T1) = (g o f)-`U \<inter> A \<inter> f-`(topspace T1)"
   382     unfolding topspace_pullback_topology by auto
   384     unfolding topspace_pullback_topology by auto
   392     unfolding topspace_pullback_topology by auto
   394     unfolding topspace_pullback_topology by auto
   393   then show "g (f x) \<in> topspace T2"
   395   then show "g (f x) \<in> topspace T2"
   394     using assms unfolding continuous_on_topo_def by auto
   396     using assms unfolding continuous_on_topo_def by auto
   395 qed
   397 qed
   396 
   398 
   397 lemma%important continuous_on_topo_pullback' [intro]:
   399 proposition continuous_on_topo_pullback' [intro]:
   398   assumes "continuous_on_topo T1 T2 (f o g)" "topspace T1 \<subseteq> g-`A"
   400   assumes "continuous_on_topo T1 T2 (f o g)" "topspace T1 \<subseteq> g-`A"
   399   shows "continuous_on_topo T1 (pullback_topology A f T2) g"
   401   shows "continuous_on_topo T1 (pullback_topology A f T2) g"
   400 unfolding continuous_on_topo_def
   402 unfolding continuous_on_topo_def
   401 proof%unimportant (auto)
   403 proof (auto)
   402   fix U assume "openin (pullback_topology A f T2) U"
   404   fix U assume "openin (pullback_topology A f T2) U"
   403   then have "\<exists>V. openin T2 V \<and> U = f-`V \<inter> A"
   405   then have "\<exists>V. openin T2 V \<and> U = f-`V \<inter> A"
   404     unfolding openin_pullback_topology by auto
   406     unfolding openin_pullback_topology by auto
   405   then obtain V where "openin T2 V" "U = f-`V \<inter> A"
   407   then obtain V where "openin T2 V" "U = f-`V \<inter> A"
   406     by blast
   408     by blast
   545     apply (rule arg_cong [where f = "(union_of)arbitrary"])
   547     apply (rule arg_cong [where f = "(union_of)arbitrary"])
   546     apply (force simp: *)
   548     apply (force simp: *)
   547     done
   549     done
   548 qed
   550 qed
   549 
   551 
   550 lemma%important topspace_product_topology:
   552 lemma topspace_product_topology:
   551   "topspace (product_topology T I) = (\<Pi>\<^sub>E i\<in>I. topspace(T i))"
   553   "topspace (product_topology T I) = (\<Pi>\<^sub>E i\<in>I. topspace(T i))"
   552 proof%unimportant
   554 proof
   553   show "topspace (product_topology T I) \<subseteq> (\<Pi>\<^sub>E i\<in>I. topspace (T i))"
   555   show "topspace (product_topology T I) \<subseteq> (\<Pi>\<^sub>E i\<in>I. topspace (T i))"
   554     unfolding product_topology_def topology_generated_by_topspace
   556     unfolding product_topology_def topology_generated_by_topspace
   555     unfolding topspace_def by auto
   557     unfolding topspace_def by auto
   556   have "(\<Pi>\<^sub>E i\<in>I. topspace (T i)) \<in> {(\<Pi>\<^sub>E i\<in>I. X i) |X. (\<forall>i. openin (T i) (X i)) \<and> finite {i. X i \<noteq> topspace (T i)}}"
   558   have "(\<Pi>\<^sub>E i\<in>I. topspace (T i)) \<in> {(\<Pi>\<^sub>E i\<in>I. X i) |X. (\<forall>i. openin (T i) (X i)) \<and> finite {i. X i \<noteq> topspace (T i)}}"
   557     using openin_topspace not_finite_existsD by auto
   559     using openin_topspace not_finite_existsD by auto
   558   then show "(\<Pi>\<^sub>E i\<in>I. topspace (T i)) \<subseteq> topspace (product_topology T I)"
   560   then show "(\<Pi>\<^sub>E i\<in>I. topspace (T i)) \<subseteq> topspace (product_topology T I)"
   559     unfolding product_topology_def using PiE_def by (auto simp add: topology_generated_by_topspace)
   561     unfolding product_topology_def using PiE_def by (auto simp add: topology_generated_by_topspace)
   560 qed
   562 qed
   561 
   563 
   562 lemma%unimportant product_topology_basis:
   564 lemma product_topology_basis:
   563   assumes "\<And>i. openin (T i) (X i)" "finite {i. X i \<noteq> topspace (T i)}"
   565   assumes "\<And>i. openin (T i) (X i)" "finite {i. X i \<noteq> topspace (T i)}"
   564   shows "openin (product_topology T I) (\<Pi>\<^sub>E i\<in>I. X i)"
   566   shows "openin (product_topology T I) (\<Pi>\<^sub>E i\<in>I. X i)"
   565   unfolding product_topology_def
   567   unfolding product_topology_def
   566   by (rule topology_generated_by_Basis) (use assms in auto)
   568   by (rule topology_generated_by_Basis) (use assms in auto)
   567 
   569 
   568 lemma%important product_topology_open_contains_basis:
   570 proposition product_topology_open_contains_basis:
   569   assumes "openin (product_topology T I) U" "x \<in> U"
   571   assumes "openin (product_topology T I) U" "x \<in> U"
   570   shows "\<exists>X. x \<in> (\<Pi>\<^sub>E i\<in>I. X i) \<and> (\<forall>i. openin (T i) (X i)) \<and> finite {i. X i \<noteq> topspace (T i)} \<and> (\<Pi>\<^sub>E i\<in>I. X i) \<subseteq> U"
   572   shows "\<exists>X. x \<in> (\<Pi>\<^sub>E i\<in>I. X i) \<and> (\<forall>i. openin (T i) (X i)) \<and> finite {i. X i \<noteq> topspace (T i)} \<and> (\<Pi>\<^sub>E i\<in>I. X i) \<subseteq> U"
   571 proof%unimportant -
   573 proof -
   572   have "generate_topology_on {(\<Pi>\<^sub>E i\<in>I. X i) |X. (\<forall>i. openin (T i) (X i)) \<and> finite {i. X i \<noteq> topspace (T i)}} U"
   574   have "generate_topology_on {(\<Pi>\<^sub>E i\<in>I. X i) |X. (\<forall>i. openin (T i) (X i)) \<and> finite {i. X i \<noteq> topspace (T i)}} U"
   573     using assms unfolding product_topology_def by (intro openin_topology_generated_by) auto
   575     using assms unfolding product_topology_def by (intro openin_topology_generated_by) auto
   574   then have "\<And>x. x\<in>U \<Longrightarrow> \<exists>X. x \<in> (\<Pi>\<^sub>E i\<in>I. X i) \<and> (\<forall>i. openin (T i) (X i)) \<and> finite {i. X i \<noteq> topspace (T i)} \<and> (\<Pi>\<^sub>E i\<in>I. X i) \<subseteq> U"
   576   then have "\<And>x. x\<in>U \<Longrightarrow> \<exists>X. x \<in> (\<Pi>\<^sub>E i\<in>I. X i) \<and> (\<forall>i. openin (T i) (X i)) \<and> finite {i. X i \<noteq> topspace (T i)} \<and> (\<Pi>\<^sub>E i\<in>I. X i) \<subseteq> U"
   575   proof induction
   577   proof induction
   576     case (Int U V x)
   578     case (Int U V x)
   715   done
   717   done
   716 
   718 
   717 
   719 
   718 text \<open>The basic property of the product topology is the continuity of projections:\<close>
   720 text \<open>The basic property of the product topology is the continuity of projections:\<close>
   719 
   721 
   720 lemma%unimportant continuous_on_topo_product_coordinates [simp]:
   722 lemma continuous_on_topo_product_coordinates [simp]:
   721   assumes "i \<in> I"
   723   assumes "i \<in> I"
   722   shows "continuous_on_topo (product_topology T I) (T i) (\<lambda>x. x i)"
   724   shows "continuous_on_topo (product_topology T I) (T i) (\<lambda>x. x i)"
   723 proof -
   725 proof -
   724   {
   726   {
   725     fix U assume "openin (T i) U"
   727     fix U assume "openin (T i) U"
   737   }
   739   }
   738   then show ?thesis unfolding continuous_on_topo_def
   740   then show ?thesis unfolding continuous_on_topo_def
   739     by (auto simp add: assms topspace_product_topology PiE_iff)
   741     by (auto simp add: assms topspace_product_topology PiE_iff)
   740 qed
   742 qed
   741 
   743 
   742 lemma%important continuous_on_topo_coordinatewise_then_product [intro]:
   744 lemma continuous_on_topo_coordinatewise_then_product [intro]:
   743   assumes "\<And>i. i \<in> I \<Longrightarrow> continuous_on_topo T1 (T i) (\<lambda>x. f x i)"
   745   assumes "\<And>i. i \<in> I \<Longrightarrow> continuous_on_topo T1 (T i) (\<lambda>x. f x i)"
   744           "\<And>i x. i \<notin> I \<Longrightarrow> x \<in> topspace T1 \<Longrightarrow> f x i = undefined"
   746           "\<And>i x. i \<notin> I \<Longrightarrow> x \<in> topspace T1 \<Longrightarrow> f x i = undefined"
   745   shows "continuous_on_topo T1 (product_topology T I) f"
   747   shows "continuous_on_topo T1 (product_topology T I) f"
   746 unfolding product_topology_def
   748 unfolding product_topology_def
   747 proof%unimportant (rule continuous_on_generated_topo)
   749 proof (rule continuous_on_generated_topo)
   748   fix U assume "U \<in> {Pi\<^sub>E I X |X. (\<forall>i. openin (T i) (X i)) \<and> finite {i. X i \<noteq> topspace (T i)}}"
   750   fix U assume "U \<in> {Pi\<^sub>E I X |X. (\<forall>i. openin (T i) (X i)) \<and> finite {i. X i \<noteq> topspace (T i)}}"
   749   then obtain X where H: "U = Pi\<^sub>E I X" "\<And>i. openin (T i) (X i)" "finite {i. X i \<noteq> topspace (T i)}"
   751   then obtain X where H: "U = Pi\<^sub>E I X" "\<And>i. openin (T i) (X i)" "finite {i. X i \<noteq> topspace (T i)}"
   750     by blast
   752     by blast
   751   define J where "J = {i \<in> I. X i \<noteq> topspace (T i)}"
   753   define J where "J = {i \<in> I. X i \<noteq> topspace (T i)}"
   752   have "finite J" "J \<subseteq> I" unfolding J_def using H(3) by auto
   754   have "finite J" "J \<subseteq> I" unfolding J_def using H(3) by auto
   770     apply (simp only: topspace_product_topology)
   772     apply (simp only: topspace_product_topology)
   771     apply (auto simp add: PiE_iff)
   773     apply (auto simp add: PiE_iff)
   772     using assms unfolding continuous_on_topo_def by auto
   774     using assms unfolding continuous_on_topo_def by auto
   773 qed
   775 qed
   774 
   776 
   775 lemma%unimportant continuous_on_topo_product_then_coordinatewise [intro]:
   777 lemma continuous_on_topo_product_then_coordinatewise [intro]:
   776   assumes "continuous_on_topo T1 (product_topology T I) f"
   778   assumes "continuous_on_topo T1 (product_topology T I) f"
   777   shows "\<And>i. i \<in> I \<Longrightarrow> continuous_on_topo T1 (T i) (\<lambda>x. f x i)"
   779   shows "\<And>i. i \<in> I \<Longrightarrow> continuous_on_topo T1 (T i) (\<lambda>x. f x i)"
   778         "\<And>i x. i \<notin> I \<Longrightarrow> x \<in> topspace T1 \<Longrightarrow> f x i = undefined"
   780         "\<And>i x. i \<notin> I \<Longrightarrow> x \<in> topspace T1 \<Longrightarrow> f x i = undefined"
   779 proof -
   781 proof -
   780   fix i assume "i \<in> I"
   782   fix i assume "i \<in> I"
   792     using topspace_product_topology by metis
   794     using topspace_product_topology by metis
   793   then show "f x i = undefined"
   795   then show "f x i = undefined"
   794     using \<open>i \<notin> I\<close> by (auto simp add: PiE_iff extensional_def)
   796     using \<open>i \<notin> I\<close> by (auto simp add: PiE_iff extensional_def)
   795 qed
   797 qed
   796 
   798 
   797 lemma%unimportant continuous_on_restrict:
   799 lemma continuous_on_restrict:
   798   assumes "J \<subseteq> I"
   800   assumes "J \<subseteq> I"
   799   shows "continuous_on_topo (product_topology T I) (product_topology T J) (\<lambda>x. restrict x J)"
   801   shows "continuous_on_topo (product_topology T I) (product_topology T J) (\<lambda>x. restrict x J)"
   800 proof (rule continuous_on_topo_coordinatewise_then_product)
   802 proof (rule continuous_on_topo_coordinatewise_then_product)
   801   fix i assume "i \<in> J"
   803   fix i assume "i \<in> J"
   802   then have "(\<lambda>x. restrict x J i) = (\<lambda>x. x i)" unfolding restrict_def by auto
   804   then have "(\<lambda>x. restrict x J i) = (\<lambda>x. x i)" unfolding restrict_def by auto
   815 begin
   817 begin
   816 
   818 
   817 definition%important open_fun_def:
   819 definition%important open_fun_def:
   818   "open U = openin (product_topology (\<lambda>i. euclidean) UNIV) U"
   820   "open U = openin (product_topology (\<lambda>i. euclidean) UNIV) U"
   819 
   821 
   820 instance proof%unimportant
   822 instance proof
   821   have "topspace (product_topology (\<lambda>(i::'a). euclidean::('b topology)) UNIV) = UNIV"
   823   have "topspace (product_topology (\<lambda>(i::'a). euclidean::('b topology)) UNIV) = UNIV"
   822     unfolding topspace_product_topology topspace_euclidean by auto
   824     unfolding topspace_product_topology topspace_euclidean by auto
   823   then show "open (UNIV::('a \<Rightarrow> 'b) set)"
   825   then show "open (UNIV::('a \<Rightarrow> 'b) set)"
   824     unfolding open_fun_def by (metis openin_topspace)
   826     unfolding open_fun_def by (metis openin_topspace)
   825 qed (auto simp add: open_fun_def)
   827 qed (auto simp add: open_fun_def)
   826 
   828 
   827 end
   829 end
   828 
   830 
   829 lemma%unimportant euclidean_product_topology:
   831 lemma euclidean_product_topology:
   830   "euclidean = product_topology (\<lambda>i. euclidean::('b::topological_space) topology) UNIV"
   832   "euclidean = product_topology (\<lambda>i. euclidean::('b::topological_space) topology) UNIV"
   831 by (metis open_openin topology_eq open_fun_def)
   833 by (metis open_openin topology_eq open_fun_def)
   832 
   834 
   833 lemma%important product_topology_basis':
   835 proposition product_topology_basis':
   834   fixes x::"'i \<Rightarrow> 'a" and U::"'i \<Rightarrow> ('b::topological_space) set"
   836   fixes x::"'i \<Rightarrow> 'a" and U::"'i \<Rightarrow> ('b::topological_space) set"
   835   assumes "finite I" "\<And>i. i \<in> I \<Longrightarrow> open (U i)"
   837   assumes "finite I" "\<And>i. i \<in> I \<Longrightarrow> open (U i)"
   836   shows "open {f. \<forall>i\<in>I. f (x i) \<in> U i}"
   838   shows "open {f. \<forall>i\<in>I. f (x i) \<in> U i}"
   837 proof%unimportant -
   839 proof -
   838   define J where "J = x`I"
   840   define J where "J = x`I"
   839   define V where "V = (\<lambda>y. if y \<in> J then \<Inter>{U i|i. i\<in>I \<and> x i = y} else UNIV)"
   841   define V where "V = (\<lambda>y. if y \<in> J then \<Inter>{U i|i. i\<in>I \<and> x i = y} else UNIV)"
   840   define X where "X = (\<lambda>y. if y \<in> J then V y else UNIV)"
   842   define X where "X = (\<lambda>y. if y \<in> J then V y else UNIV)"
   841   have *: "open (X i)" for i
   843   have *: "open (X i)" for i
   842     unfolding X_def V_def using assms by auto
   844     unfolding X_def V_def using assms by auto
   862 qed
   864 qed
   863 
   865 
   864 text \<open>The results proved in the general situation of products of possibly different
   866 text \<open>The results proved in the general situation of products of possibly different
   865 spaces have their counterparts in this simpler setting.\<close>
   867 spaces have their counterparts in this simpler setting.\<close>
   866 
   868 
   867 lemma%unimportant continuous_on_product_coordinates [simp]:
   869 lemma continuous_on_product_coordinates [simp]:
   868   "continuous_on UNIV (\<lambda>x. x i::('b::topological_space))"
   870   "continuous_on UNIV (\<lambda>x. x i::('b::topological_space))"
   869 unfolding continuous_on_topo_UNIV euclidean_product_topology
   871 unfolding continuous_on_topo_UNIV euclidean_product_topology
   870 by (rule continuous_on_topo_product_coordinates, simp)
   872 by (rule continuous_on_topo_product_coordinates, simp)
   871 
   873 
   872 lemma%unimportant continuous_on_coordinatewise_then_product [intro, continuous_intros]:
   874 lemma continuous_on_coordinatewise_then_product [intro, continuous_intros]:
   873   assumes "\<And>i. continuous_on UNIV (\<lambda>x. f x i)"
   875   assumes "\<And>i. continuous_on UNIV (\<lambda>x. f x i)"
   874   shows "continuous_on UNIV f"
   876   shows "continuous_on UNIV f"
   875 using assms unfolding continuous_on_topo_UNIV euclidean_product_topology
   877 using assms unfolding continuous_on_topo_UNIV euclidean_product_topology
   876 by (rule continuous_on_topo_coordinatewise_then_product, simp)
   878 by (rule continuous_on_topo_coordinatewise_then_product, simp)
   877 
   879 
   878 lemma%unimportant continuous_on_product_then_coordinatewise:
   880 lemma continuous_on_product_then_coordinatewise:
   879   assumes "continuous_on UNIV f"
   881   assumes "continuous_on UNIV f"
   880   shows "continuous_on UNIV (\<lambda>x. f x i)"
   882   shows "continuous_on UNIV (\<lambda>x. f x i)"
   881 using assms unfolding continuous_on_topo_UNIV euclidean_product_topology
   883 using assms unfolding continuous_on_topo_UNIV euclidean_product_topology
   882 by (rule continuous_on_topo_product_then_coordinatewise(1), simp)
   884 by (rule continuous_on_topo_product_then_coordinatewise(1), simp)
   883 
   885 
   884 lemma%unimportant continuous_on_product_coordinatewise_iff:
   886 lemma continuous_on_product_coordinatewise_iff:
   885   "continuous_on UNIV f \<longleftrightarrow> (\<forall>i. continuous_on UNIV (\<lambda>x. f x i))"
   887   "continuous_on UNIV f \<longleftrightarrow> (\<forall>i. continuous_on UNIV (\<lambda>x. f x i))"
   886 by (auto intro: continuous_on_product_then_coordinatewise)
   888 by (auto intro: continuous_on_product_then_coordinatewise)
   887 
   889 
   888 subsubsection%important \<open>Topological countability for product spaces\<close>
   890 subsubsection%important \<open>Topological countability for product spaces\<close>
   889 
   891 
   890 text \<open>The next two lemmas are useful to prove first or second countability
   892 text \<open>The next two lemmas are useful to prove first or second countability
   891 of product spaces, but they have more to do with countability and could
   893 of product spaces, but they have more to do with countability and could
   892 be put in the corresponding theory.\<close>
   894 be put in the corresponding theory.\<close>
   893 
   895 
   894 lemma%unimportant countable_nat_product_event_const:
   896 lemma countable_nat_product_event_const:
   895   fixes F::"'a set" and a::'a
   897   fixes F::"'a set" and a::'a
   896   assumes "a \<in> F" "countable F"
   898   assumes "a \<in> F" "countable F"
   897   shows "countable {x::(nat \<Rightarrow> 'a). (\<forall>i. x i \<in> F) \<and> finite {i. x i \<noteq> a}}"
   899   shows "countable {x::(nat \<Rightarrow> 'a). (\<forall>i. x i \<in> F) \<and> finite {i. x i \<noteq> a}}"
   898 proof -
   900 proof -
   899   have *: "{x::(nat \<Rightarrow> 'a). (\<forall>i. x i \<in> F) \<and> finite {i. x i \<noteq> a}}
   901   have *: "{x::(nat \<Rightarrow> 'a). (\<forall>i. x i \<in> F) \<and> finite {i. x i \<noteq> a}}
   926       by (meson countable_image countable_subset)
   928       by (meson countable_image countable_subset)
   927   qed
   929   qed
   928   then show ?thesis using countable_subset[OF *] by auto
   930   then show ?thesis using countable_subset[OF *] by auto
   929 qed
   931 qed
   930 
   932 
   931 lemma%unimportant countable_product_event_const:
   933 lemma countable_product_event_const:
   932   fixes F::"('a::countable) \<Rightarrow> 'b set" and b::'b
   934   fixes F::"('a::countable) \<Rightarrow> 'b set" and b::'b
   933   assumes "\<And>i. countable (F i)"
   935   assumes "\<And>i. countable (F i)"
   934   shows "countable {f::('a \<Rightarrow> 'b). (\<forall>i. f i \<in> F i) \<and> (finite {i. f i \<noteq> b})}"
   936   shows "countable {f::('a \<Rightarrow> 'b). (\<forall>i. f i \<in> F i) \<and> (finite {i. f i \<noteq> b})}"
   935 proof -
   937 proof -
   936   define G where "G = (\<Union>i. F i) \<union> {b}"
   938   define G where "G = (\<Union>i. F i) \<union> {b}"
   959     using countable_nat_product_event_const[OF \<open>b \<in> G\<close> \<open>countable G\<close>]
   961     using countable_nat_product_event_const[OF \<open>b \<in> G\<close> \<open>countable G\<close>]
   960     by (meson countable_image countable_subset)
   962     by (meson countable_image countable_subset)
   961 qed
   963 qed
   962 
   964 
   963 instance "fun" :: (countable, first_countable_topology) first_countable_topology
   965 instance "fun" :: (countable, first_countable_topology) first_countable_topology
   964 proof%unimportant
   966 proof
   965   fix x::"'a \<Rightarrow> 'b"
   967   fix x::"'a \<Rightarrow> 'b"
   966   have "\<exists>A::('b \<Rightarrow> nat \<Rightarrow> 'b set). \<forall>x. (\<forall>i. x \<in> A x i \<and> open (A x i)) \<and> (\<forall>S. open S \<and> x \<in> S \<longrightarrow> (\<exists>i. A x i \<subseteq> S))"
   968   have "\<exists>A::('b \<Rightarrow> nat \<Rightarrow> 'b set). \<forall>x. (\<forall>i. x \<in> A x i \<and> open (A x i)) \<and> (\<forall>S. open S \<and> x \<in> S \<longrightarrow> (\<exists>i. A x i \<subseteq> S))"
   967     apply (rule choice) using first_countable_basis by auto
   969     apply (rule choice) using first_countable_basis by auto
   968   then obtain A::"('b \<Rightarrow> nat \<Rightarrow> 'b set)" where A: "\<And>x i. x \<in> A x i"
   970   then obtain A::"('b \<Rightarrow> nat \<Rightarrow> 'b set)" where A: "\<And>x i. x \<in> A x i"
   969                                                   "\<And>x i. open (A x i)"
   971                                                   "\<And>x i. open (A x i)"
  1031   show "\<exists>L. (\<forall>(i::nat). x \<in> L i \<and> open (L i)) \<and> (\<forall>U. open U \<and> x \<in> U \<longrightarrow> (\<exists>i. L i \<subseteq> U))"
  1033   show "\<exists>L. (\<forall>(i::nat). x \<in> L i \<and> open (L i)) \<and> (\<forall>U. open U \<and> x \<in> U \<longrightarrow> (\<exists>i. L i \<subseteq> U))"
  1032     apply (rule first_countableI[of K])
  1034     apply (rule first_countableI[of K])
  1033     using \<open>countable K\<close> \<open>\<And>k. k \<in> K \<Longrightarrow> x \<in> k\<close> \<open>\<And>k. k \<in> K \<Longrightarrow> open k\<close> Inc by auto
  1035     using \<open>countable K\<close> \<open>\<And>k. k \<in> K \<Longrightarrow> x \<in> k\<close> \<open>\<And>k. k \<in> K \<Longrightarrow> open k\<close> Inc by auto
  1034 qed
  1036 qed
  1035 
  1037 
  1036 lemma%important product_topology_countable_basis:
  1038 proposition product_topology_countable_basis:
  1037   shows "\<exists>K::(('a::countable \<Rightarrow> 'b::second_countable_topology) set set).
  1039   shows "\<exists>K::(('a::countable \<Rightarrow> 'b::second_countable_topology) set set).
  1038           topological_basis K \<and> countable K \<and>
  1040           topological_basis K \<and> countable K \<and>
  1039           (\<forall>k\<in>K. \<exists>X. (k = Pi\<^sub>E UNIV X) \<and> (\<forall>i. open (X i)) \<and> finite {i. X i \<noteq> UNIV})"
  1041           (\<forall>k\<in>K. \<exists>X. (k = Pi\<^sub>E UNIV X) \<and> (\<forall>i. open (X i)) \<and> finite {i. X i \<noteq> UNIV})"
  1040 proof%unimportant -
  1042 proof -
  1041   obtain B::"'b set set" where B: "countable B \<and> topological_basis B"
  1043   obtain B::"'b set set" where B: "countable B \<and> topological_basis B"
  1042     using ex_countable_basis by auto
  1044     using ex_countable_basis by auto
  1043   then have "B \<noteq> {}" by (meson UNIV_I empty_iff open_UNIV topological_basisE)
  1045   then have "B \<noteq> {}" by (meson UNIV_I empty_iff open_UNIV topological_basisE)
  1044   define B2 where "B2 = B \<union> {UNIV}"
  1046   define B2 where "B2 = B \<union> {UNIV}"
  1045   have "countable B2"
  1047   have "countable B2"
  1138 \<close>
  1140 \<close>
  1139 
  1141 
  1140 definition%important strong_operator_topology::"('a::real_normed_vector \<Rightarrow>\<^sub>L'b::real_normed_vector) topology"
  1142 definition%important strong_operator_topology::"('a::real_normed_vector \<Rightarrow>\<^sub>L'b::real_normed_vector) topology"
  1141 where "strong_operator_topology = pullback_topology UNIV blinfun_apply euclidean"
  1143 where "strong_operator_topology = pullback_topology UNIV blinfun_apply euclidean"
  1142 
  1144 
  1143 lemma%unimportant strong_operator_topology_topspace:
  1145 lemma strong_operator_topology_topspace:
  1144   "topspace strong_operator_topology = UNIV"
  1146   "topspace strong_operator_topology = UNIV"
  1145 unfolding strong_operator_topology_def topspace_pullback_topology topspace_euclidean by auto
  1147 unfolding strong_operator_topology_def topspace_pullback_topology topspace_euclidean by auto
  1146 
  1148 
  1147 lemma%important strong_operator_topology_basis:
  1149 lemma strong_operator_topology_basis:
  1148   fixes f::"('a::real_normed_vector \<Rightarrow>\<^sub>L'b::real_normed_vector)" and U::"'i \<Rightarrow> 'b set" and x::"'i \<Rightarrow> 'a"
  1150   fixes f::"('a::real_normed_vector \<Rightarrow>\<^sub>L'b::real_normed_vector)" and U::"'i \<Rightarrow> 'b set" and x::"'i \<Rightarrow> 'a"
  1149   assumes "finite I" "\<And>i. i \<in> I \<Longrightarrow> open (U i)"
  1151   assumes "finite I" "\<And>i. i \<in> I \<Longrightarrow> open (U i)"
  1150   shows "openin strong_operator_topology {f. \<forall>i\<in>I. blinfun_apply f (x i) \<in> U i}"
  1152   shows "openin strong_operator_topology {f. \<forall>i\<in>I. blinfun_apply f (x i) \<in> U i}"
  1151 proof%unimportant -
  1153 proof -
  1152   have "open {g::('a\<Rightarrow>'b). \<forall>i\<in>I. g (x i) \<in> U i}"
  1154   have "open {g::('a\<Rightarrow>'b). \<forall>i\<in>I. g (x i) \<in> U i}"
  1153     by (rule product_topology_basis'[OF assms])
  1155     by (rule product_topology_basis'[OF assms])
  1154   moreover have "{f. \<forall>i\<in>I. blinfun_apply f (x i) \<in> U i}
  1156   moreover have "{f. \<forall>i\<in>I. blinfun_apply f (x i) \<in> U i}
  1155                 = blinfun_apply-`{g::('a\<Rightarrow>'b). \<forall>i\<in>I. g (x i) \<in> U i} \<inter> UNIV"
  1157                 = blinfun_apply-`{g::('a\<Rightarrow>'b). \<forall>i\<in>I. g (x i) \<in> U i} \<inter> UNIV"
  1156     by auto
  1158     by auto
  1157   ultimately show ?thesis
  1159   ultimately show ?thesis
  1158     unfolding strong_operator_topology_def open_openin apply (subst openin_pullback_topology) by auto
  1160     unfolding strong_operator_topology_def open_openin apply (subst openin_pullback_topology) by auto
  1159 qed
  1161 qed
  1160 
  1162 
  1161 lemma%important strong_operator_topology_continuous_evaluation:
  1163 lemma strong_operator_topology_continuous_evaluation:
  1162   "continuous_on_topo strong_operator_topology euclidean (\<lambda>f. blinfun_apply f x)"
  1164   "continuous_on_topo strong_operator_topology euclidean (\<lambda>f. blinfun_apply f x)"
  1163 proof%unimportant -
  1165 proof -
  1164   have "continuous_on_topo strong_operator_topology euclidean ((\<lambda>f. f x) o blinfun_apply)"
  1166   have "continuous_on_topo strong_operator_topology euclidean ((\<lambda>f. f x) o blinfun_apply)"
  1165     unfolding strong_operator_topology_def apply (rule continuous_on_topo_pullback)
  1167     unfolding strong_operator_topology_def apply (rule continuous_on_topo_pullback)
  1166     using continuous_on_topo_UNIV continuous_on_product_coordinates by fastforce
  1168     using continuous_on_topo_UNIV continuous_on_product_coordinates by fastforce
  1167   then show ?thesis unfolding comp_def by simp
  1169   then show ?thesis unfolding comp_def by simp
  1168 qed
  1170 qed
  1169 
  1171 
  1170 lemma%unimportant continuous_on_strong_operator_topo_iff_coordinatewise:
  1172 lemma continuous_on_strong_operator_topo_iff_coordinatewise:
  1171   "continuous_on_topo T strong_operator_topology f
  1173   "continuous_on_topo T strong_operator_topology f
  1172     \<longleftrightarrow> (\<forall>x. continuous_on_topo T euclidean (\<lambda>y. blinfun_apply (f y) x))"
  1174     \<longleftrightarrow> (\<forall>x. continuous_on_topo T euclidean (\<lambda>y. blinfun_apply (f y) x))"
  1173 proof (auto)
  1175 proof (auto)
  1174   fix x::"'b"
  1176   fix x::"'b"
  1175   assume "continuous_on_topo T strong_operator_topology f"
  1177   assume "continuous_on_topo T strong_operator_topology f"
  1188     unfolding strong_operator_topology_def
  1190     unfolding strong_operator_topology_def
  1189     apply (rule continuous_on_topo_pullback')
  1191     apply (rule continuous_on_topo_pullback')
  1190     by (auto simp add: \<open>continuous_on_topo T euclidean (blinfun_apply o f)\<close>)
  1192     by (auto simp add: \<open>continuous_on_topo T euclidean (blinfun_apply o f)\<close>)
  1191 qed
  1193 qed
  1192 
  1194 
  1193 lemma%important strong_operator_topology_weaker_than_euclidean:
  1195 lemma strong_operator_topology_weaker_than_euclidean:
  1194   "continuous_on_topo euclidean strong_operator_topology (\<lambda>f. f)"
  1196   "continuous_on_topo euclidean strong_operator_topology (\<lambda>f. f)"
  1195 by%unimportant (subst continuous_on_strong_operator_topo_iff_coordinatewise,
  1197   by (subst continuous_on_strong_operator_topo_iff_coordinatewise,
  1196     auto simp add: continuous_on_topo_UNIV[symmetric] linear_continuous_on)
  1198     auto simp add: continuous_on_topo_UNIV[symmetric] linear_continuous_on)
  1197 
  1199 
  1198 
  1200 
  1199 subsection%important \<open>Metrics on product spaces\<close>
  1201 subsection%important \<open>Metrics on product spaces\<close>
  1200 
  1202 
  1224 text \<open>Except for the first one, the auxiliary lemmas below are only useful when proving the
  1226 text \<open>Except for the first one, the auxiliary lemmas below are only useful when proving the
  1225 instance: once it is proved, they become trivial consequences of the general theory of metric
  1227 instance: once it is proved, they become trivial consequences of the general theory of metric
  1226 spaces. It would thus be desirable to hide them once the instance is proved, but I do not know how
  1228 spaces. It would thus be desirable to hide them once the instance is proved, but I do not know how
  1227 to do this.\<close>
  1229 to do this.\<close>
  1228 
  1230 
  1229 lemma%important dist_fun_le_dist_first_terms:
  1231 lemma dist_fun_le_dist_first_terms:
  1230   "dist x y \<le> 2 * Max {dist (x (from_nat n)) (y (from_nat n))|n. n \<le> N} + (1/2)^N"
  1232   "dist x y \<le> 2 * Max {dist (x (from_nat n)) (y (from_nat n))|n. n \<le> N} + (1/2)^N"
  1231 proof%unimportant -
  1233 proof -
  1232   have "(\<Sum>n. (1 / 2) ^ (n+Suc N) * min (dist (x (from_nat (n+Suc N))) (y (from_nat (n+Suc N)))) 1)
  1234   have "(\<Sum>n. (1 / 2) ^ (n+Suc N) * min (dist (x (from_nat (n+Suc N))) (y (from_nat (n+Suc N)))) 1)
  1233           = (\<Sum>n. (1 / 2) ^ (Suc N) * ((1/2) ^ n * min (dist (x (from_nat (n+Suc N))) (y (from_nat (n+Suc N)))) 1))"
  1235           = (\<Sum>n. (1 / 2) ^ (Suc N) * ((1/2) ^ n * min (dist (x (from_nat (n+Suc N))) (y (from_nat (n+Suc N)))) 1))"
  1234     by (rule suminf_cong, simp add: power_add)
  1236     by (rule suminf_cong, simp add: power_add)
  1235   also have "... = (1/2)^(Suc N) * (\<Sum>n. (1 / 2) ^ n * min (dist (x (from_nat (n+Suc N))) (y (from_nat (n+Suc N)))) 1)"
  1237   also have "... = (1/2)^(Suc N) * (\<Sum>n. (1 / 2) ^ n * min (dist (x (from_nat (n+Suc N))) (y (from_nat (n+Suc N)))) 1)"
  1236     apply (rule suminf_mult)
  1238     apply (rule suminf_mult)
  1274   also have "... \<le> 2 * M + (1/2)^N"
  1276   also have "... \<le> 2 * M + (1/2)^N"
  1275     using * ** by auto
  1277     using * ** by auto
  1276   finally show ?thesis unfolding M_def by simp
  1278   finally show ?thesis unfolding M_def by simp
  1277 qed
  1279 qed
  1278 
  1280 
  1279 lemma%unimportant open_fun_contains_ball_aux:
  1281 lemma open_fun_contains_ball_aux:
  1280   assumes "open (U::(('a \<Rightarrow> 'b) set))"
  1282   assumes "open (U::(('a \<Rightarrow> 'b) set))"
  1281           "x \<in> U"
  1283           "x \<in> U"
  1282   shows "\<exists>e>0. {y. dist x y < e} \<subseteq> U"
  1284   shows "\<exists>e>0. {y. dist x y < e} \<subseteq> U"
  1283 proof -
  1285 proof -
  1284   have *: "openin (product_topology (\<lambda>i. euclidean) UNIV) U"
  1286   have *: "openin (product_topology (\<lambda>i. euclidean) UNIV) U"
  1337     using that H(1) unfolding I_def topspace_euclidean by (auto simp add: PiE_iff)
  1339     using that H(1) unfolding I_def topspace_euclidean by (auto simp add: PiE_iff)
  1338   then have "\<exists>m>0. {y. dist x y < m} \<subseteq> U" if "I = {}" using that zero_less_one by blast
  1340   then have "\<exists>m>0. {y. dist x y < m} \<subseteq> U" if "I = {}" using that zero_less_one by blast
  1339   then show "\<exists>m>0. {y. dist x y < m} \<subseteq> U" using * by blast
  1341   then show "\<exists>m>0. {y. dist x y < m} \<subseteq> U" using * by blast
  1340 qed
  1342 qed
  1341 
  1343 
  1342 lemma%unimportant ball_fun_contains_open_aux:
  1344 lemma ball_fun_contains_open_aux:
  1343   fixes x::"('a \<Rightarrow> 'b)" and e::real
  1345   fixes x::"('a \<Rightarrow> 'b)" and e::real
  1344   assumes "e>0"
  1346   assumes "e>0"
  1345   shows "\<exists>U. open U \<and> x \<in> U \<and> U \<subseteq> {y. dist x y < e}"
  1347   shows "\<exists>U. open U \<and> x \<in> U \<and> U \<subseteq> {y. dist x y < e}"
  1346 proof -
  1348 proof -
  1347   have "\<exists>N::nat. 2^N > 8/e"
  1349   have "\<exists>N::nat. 2^N > 8/e"
  1384     finally show "dist x y < e" by simp
  1386     finally show "dist x y < e" by simp
  1385   qed
  1387   qed
  1386   ultimately show ?thesis by auto
  1388   ultimately show ?thesis by auto
  1387 qed
  1389 qed
  1388 
  1390 
  1389 lemma%unimportant fun_open_ball_aux:
  1391 lemma fun_open_ball_aux:
  1390   fixes U::"('a \<Rightarrow> 'b) set"
  1392   fixes U::"('a \<Rightarrow> 'b) set"
  1391   shows "open U \<longleftrightarrow> (\<forall>x\<in>U. \<exists>e>0. \<forall>y. dist x y < e \<longrightarrow> y \<in> U)"
  1393   shows "open U \<longleftrightarrow> (\<forall>x\<in>U. \<exists>e>0. \<forall>y. dist x y < e \<longrightarrow> y \<in> U)"
  1392 proof (auto)
  1394 proof (auto)
  1393   assume "open U"
  1395   assume "open U"
  1394   fix x assume "x \<in> U"
  1396   fix x assume "x \<in> U"
  1573 by standard
  1575 by standard
  1574 
  1576 
  1575 
  1577 
  1576 
  1578 
  1577 
  1579 
  1578 subsection%important \<open>Measurability\<close> (*FIX ME mv *)
  1580 subsection%important \<open>Measurability\<close> (*FIX ME move? *)
  1579 
  1581 
  1580 text \<open>There are two natural sigma-algebras on a product space: the borel sigma algebra,
  1582 text \<open>There are two natural sigma-algebras on a product space: the borel sigma algebra,
  1581 generated by open sets in the product, and the product sigma algebra, countably generated by
  1583 generated by open sets in the product, and the product sigma algebra, countably generated by
  1582 products of measurable sets along finitely many coordinates. The second one is defined and studied
  1584 products of measurable sets along finitely many coordinates. The second one is defined and studied
  1583 in \<^file>\<open>Finite_Product_Measure.thy\<close>.
  1585 in \<^file>\<open>Finite_Product_Measure.thy\<close>.
  1591 
  1593 
  1592 In this paragraph, we develop basic measurability properties for the borel sigma algebra, and
  1594 In this paragraph, we develop basic measurability properties for the borel sigma algebra, and
  1593 compare it with the product sigma algebra as explained above.
  1595 compare it with the product sigma algebra as explained above.
  1594 \<close>
  1596 \<close>
  1595 
  1597 
  1596 lemma%unimportant measurable_product_coordinates [measurable (raw)]:
  1598 lemma measurable_product_coordinates [measurable (raw)]:
  1597   "(\<lambda>x. x i) \<in> measurable borel borel"
  1599   "(\<lambda>x. x i) \<in> measurable borel borel"
  1598 by (rule borel_measurable_continuous_on1[OF continuous_on_product_coordinates])
  1600 by (rule borel_measurable_continuous_on1[OF continuous_on_product_coordinates])
  1599 
  1601 
  1600 lemma%unimportant measurable_product_then_coordinatewise:
  1602 lemma measurable_product_then_coordinatewise:
  1601   fixes f::"'a \<Rightarrow> 'b \<Rightarrow> ('c::topological_space)"
  1603   fixes f::"'a \<Rightarrow> 'b \<Rightarrow> ('c::topological_space)"
  1602   assumes [measurable]: "f \<in> borel_measurable M"
  1604   assumes [measurable]: "f \<in> borel_measurable M"
  1603   shows "(\<lambda>x. f x i) \<in> borel_measurable M"
  1605   shows "(\<lambda>x. f x i) \<in> borel_measurable M"
  1604 proof -
  1606 proof -
  1605   have "(\<lambda>x. f x i) = (\<lambda>y. y i) o f"
  1607   have "(\<lambda>x. f x i) = (\<lambda>y. y i) o f"
  1609 
  1611 
  1610 text \<open>To compare the Borel sigma algebra with the product sigma algebra, we give a presentation
  1612 text \<open>To compare the Borel sigma algebra with the product sigma algebra, we give a presentation
  1611 of the product sigma algebra that is more similar to the one we used above for the product
  1613 of the product sigma algebra that is more similar to the one we used above for the product
  1612 topology.\<close>
  1614 topology.\<close>
  1613 
  1615 
  1614 lemma%important sets_PiM_finite:
  1616 lemma sets_PiM_finite:
  1615   "sets (Pi\<^sub>M I M) = sigma_sets (\<Pi>\<^sub>E i\<in>I. space (M i))
  1617   "sets (Pi\<^sub>M I M) = sigma_sets (\<Pi>\<^sub>E i\<in>I. space (M i))
  1616         {(\<Pi>\<^sub>E i\<in>I. X i) |X. (\<forall>i. X i \<in> sets (M i)) \<and> finite {i. X i \<noteq> space (M i)}}"
  1618         {(\<Pi>\<^sub>E i\<in>I. X i) |X. (\<forall>i. X i \<in> sets (M i)) \<and> finite {i. X i \<noteq> space (M i)}}"
  1617 proof%unimportant
  1619 proof
  1618   have "{(\<Pi>\<^sub>E i\<in>I. X i) |X. (\<forall>i. X i \<in> sets (M i)) \<and> finite {i. X i \<noteq> space (M i)}} \<subseteq> sets (Pi\<^sub>M I M)"
  1620   have "{(\<Pi>\<^sub>E i\<in>I. X i) |X. (\<forall>i. X i \<in> sets (M i)) \<and> finite {i. X i \<noteq> space (M i)}} \<subseteq> sets (Pi\<^sub>M I M)"
  1619   proof (auto)
  1621   proof (auto)
  1620     fix X assume H: "\<forall>i. X i \<in> sets (M i)" "finite {i. X i \<noteq> space (M i)}"
  1622     fix X assume H: "\<forall>i. X i \<in> sets (M i)" "finite {i. X i \<noteq> space (M i)}"
  1621     then have *: "X i \<in> sets (M i)" for i by simp
  1623     then have *: "X i \<in> sets (M i)" for i by simp
  1622     define J where "J = {i \<in> I. X i \<noteq> space (M i)}"
  1624     define J where "J = {i \<in> I. X i \<noteq> space (M i)}"
  1652     apply (rule sigma_sets_mono')
  1654     apply (rule sigma_sets_mono')
  1653     apply (auto simp add: PiE_iff *)
  1655     apply (auto simp add: PiE_iff *)
  1654     done
  1656     done
  1655 qed
  1657 qed
  1656 
  1658 
  1657 lemma%important sets_PiM_subset_borel:
  1659 lemma sets_PiM_subset_borel:
  1658   "sets (Pi\<^sub>M UNIV (\<lambda>_. borel)) \<subseteq> sets borel"
  1660   "sets (Pi\<^sub>M UNIV (\<lambda>_. borel)) \<subseteq> sets borel"
  1659 proof%unimportant -
  1661 proof -
  1660   have *: "Pi\<^sub>E UNIV X \<in> sets borel" if [measurable]: "\<And>i. X i \<in> sets borel" "finite {i. X i \<noteq> UNIV}" for X::"'a \<Rightarrow> 'b set"
  1662   have *: "Pi\<^sub>E UNIV X \<in> sets borel" if [measurable]: "\<And>i. X i \<in> sets borel" "finite {i. X i \<noteq> UNIV}" for X::"'a \<Rightarrow> 'b set"
  1661   proof -
  1663   proof -
  1662     define I where "I = {i. X i \<noteq> UNIV}"
  1664     define I where "I = {i. X i \<noteq> UNIV}"
  1663     have "finite I" unfolding I_def using that by simp
  1665     have "finite I" unfolding I_def using that by simp
  1664     have "Pi\<^sub>E UNIV X = (\<Inter>i\<in>I. (\<lambda>x. x i)-`(X i) \<inter> space borel) \<inter> space borel"
  1666     have "Pi\<^sub>E UNIV X = (\<Inter>i\<in>I. (\<lambda>x. x i)-`(X i) \<inter> space borel) \<inter> space borel"
  1671     by auto
  1673     by auto
  1672   then show ?thesis unfolding sets_PiM_finite space_borel
  1674   then show ?thesis unfolding sets_PiM_finite space_borel
  1673     by (simp add: * sets.sigma_sets_subset')
  1675     by (simp add: * sets.sigma_sets_subset')
  1674 qed
  1676 qed
  1675 
  1677 
  1676 lemma%important sets_PiM_equal_borel:
  1678 proposition sets_PiM_equal_borel:
  1677   "sets (Pi\<^sub>M UNIV (\<lambda>i::('a::countable). borel::('b::second_countable_topology measure))) = sets borel"
  1679   "sets (Pi\<^sub>M UNIV (\<lambda>i::('a::countable). borel::('b::second_countable_topology measure))) = sets borel"
  1678 proof%unimportant
  1680 proof
  1679   obtain K::"('a \<Rightarrow> 'b) set set" where K: "topological_basis K" "countable K"
  1681   obtain K::"('a \<Rightarrow> 'b) set set" where K: "topological_basis K" "countable K"
  1680             "\<And>k. k \<in> K \<Longrightarrow> \<exists>X. (k = Pi\<^sub>E UNIV X) \<and> (\<forall>i. open (X i)) \<and> finite {i. X i \<noteq> UNIV}"
  1682             "\<And>k. k \<in> K \<Longrightarrow> \<exists>X. (k = Pi\<^sub>E UNIV X) \<and> (\<forall>i. open (X i)) \<and> finite {i. X i \<noteq> UNIV}"
  1681     using product_topology_countable_basis by fast
  1683     using product_topology_countable_basis by fast
  1682   have *: "k \<in> sets (Pi\<^sub>M UNIV (\<lambda>_. borel))" if "k \<in> K" for k
  1684   have *: "k \<in> sets (Pi\<^sub>M UNIV (\<lambda>_. borel))" if "k \<in> K" for k
  1683   proof -
  1685   proof -
  1698     apply (rule sets.sigma_sets_subset') using ** by auto
  1700     apply (rule sets.sigma_sets_subset') using ** by auto
  1699   then show "sets (borel::('a \<Rightarrow> 'b) measure) \<subseteq> sets (Pi\<^sub>M UNIV (\<lambda>_. borel))"
  1701   then show "sets (borel::('a \<Rightarrow> 'b) measure) \<subseteq> sets (Pi\<^sub>M UNIV (\<lambda>_. borel))"
  1700     unfolding borel_def by auto
  1702     unfolding borel_def by auto
  1701 qed (simp add: sets_PiM_subset_borel)
  1703 qed (simp add: sets_PiM_subset_borel)
  1702 
  1704 
  1703 lemma%important measurable_coordinatewise_then_product:
  1705 lemma measurable_coordinatewise_then_product:
  1704   fixes f::"'a \<Rightarrow> ('b::countable) \<Rightarrow> ('c::second_countable_topology)"
  1706   fixes f::"'a \<Rightarrow> ('b::countable) \<Rightarrow> ('c::second_countable_topology)"
  1705   assumes [measurable]: "\<And>i. (\<lambda>x. f x i) \<in> borel_measurable M"
  1707   assumes [measurable]: "\<And>i. (\<lambda>x. f x i) \<in> borel_measurable M"
  1706   shows "f \<in> borel_measurable M"
  1708   shows "f \<in> borel_measurable M"
  1707 proof%unimportant -
  1709 proof -
  1708   have "f \<in> measurable M (Pi\<^sub>M UNIV (\<lambda>_. borel))"
  1710   have "f \<in> measurable M (Pi\<^sub>M UNIV (\<lambda>_. borel))"
  1709     by (rule measurable_PiM_single', auto simp add: assms)
  1711     by (rule measurable_PiM_single', auto simp add: assms)
  1710   then show ?thesis using sets_PiM_equal_borel measurable_cong_sets by blast
  1712   then show ?thesis using sets_PiM_equal_borel measurable_cong_sets by blast
  1711 qed
  1713 qed
  1712 
  1714