src/HOL/Analysis/Function_Topology.thy
changeset 69566 c41954ee87cf
parent 69517 dc20f278e8f3
child 69597 ff784d5a5bfb
equal deleted inserted replaced
69565:1daf07b65385 69566:c41954ee87cf
    15 the sets which are products of open sets along finitely many coordinates, and the whole
    15 the sets which are products of open sets along finitely many coordinates, and the whole
    16 space along the other coordinates. This is the coarsest topology for which the projection
    16 space along the other coordinates. This is the coarsest topology for which the projection
    17 to each factor is continuous.
    17 to each factor is continuous.
    18 
    18 
    19 To form a product of objects in Isabelle/HOL, all these objects should be subsets of a common type
    19 To form a product of objects in Isabelle/HOL, all these objects should be subsets of a common type
    20 'a. The product is then @{term "Pi\<^sub>E I X"}, the set of elements from 'i to 'a such that the $i$-th
    20 'a. The product is then @{term "Pi\<^sub>E I X"}, the set of elements from \<open>'i\<close> to \<open>'a\<close> such that the \<open>i\<close>-th
    21 coordinate belongs to $X\;i$ for all $i \in I$.
    21 coordinate belongs to \<open>X i\<close> for all \<open>i \<in> I\<close>.
    22 
    22 
    23 Hence, to form a product of topological spaces, all these spaces should be subsets of a common type.
    23 Hence, to form a product of topological spaces, all these spaces should be subsets of a common type.
    24 This means that type classes can not be used to define such a product if one wants to take the
    24 This means that type classes can not be used to define such a product if one wants to take the
    25 product of different topological spaces (as the type 'a can only be given one structure of
    25 product of different topological spaces (as the type 'a can only be given one structure of
    26 topological space using type classes). On the other hand, one can define different topologies (as
    26 topological space using type classes). On the other hand, one can define different topologies (as
    27 introduced in \verb+thy+) on one type, and these topologies do not need to
    27 introduced in \<open>thy\<close>) on one type, and these topologies do not need to
    28 share the same maximal open set. Hence, one can form a product of topologies in this sense, and
    28 share the same maximal open set. Hence, one can form a product of topologies in this sense, and
    29 this works well. The big caveat is that it does not interact well with the main body of
    29 this works well. The big caveat is that it does not interact well with the main body of
    30 topology in Isabelle/HOL defined in terms of type classes... For instance, continuity of maps
    30 topology in Isabelle/HOL defined in terms of type classes... For instance, continuity of maps
    31 is not defined in this setting.
    31 is not defined in this setting.
    32 
    32 
    39 of topological spaces in Isabelle/HOL in terms of topologies, and keep the statements involving
    39 of topological spaces in Isabelle/HOL in terms of topologies, and keep the statements involving
    40 type classes as consequences of more general statements in terms of topologies (but I am
    40 type classes as consequences of more general statements in terms of topologies (but I am
    41 probably too naive here).
    41 probably too naive here).
    42 
    42 
    43 Here is an example of a reformulation using topologies. Let
    43 Here is an example of a reformulation using topologies. Let
    44 \begin{verbatim}
    44 @{text [display]
    45 continuous_on_topo T1 T2 f = ((\<forall> U. openin T2 U \<longrightarrow> openin T1 (f-`U \<inter> topspace(T1)))
    45 \<open>continuous_on_topo T1 T2 f =
    46                                       \<and> (f`(topspace T1) \<subseteq> (topspace T2)))
    46     ((\<forall> U. openin T2 U \<longrightarrow> openin T1 (f-`U \<inter> topspace(T1)))
    47 \end{verbatim}
    47             \<and> (f`(topspace T1) \<subseteq> (topspace T2)))\<close>}
    48 be the natural continuity definition of a map from the topology $T1$ to the topology $T2$. Then
    48 be the natural continuity definition of a map from the topology \<open>T1\<close> to the topology \<open>T2\<close>. Then
    49 the current \verb+continuous_on+ (with type classes) can be redefined as
    49 the current \<open>continuous_on\<close> (with type classes) can be redefined as
    50 \begin{verbatim}
    50 @{text [display] \<open>continuous_on s f =
    51 continuous_on s f = continuous_on_topo (subtopology euclidean s) (topology euclidean) f
    51     continuous_on_topo (subtopology euclidean s) (topology euclidean) f\<close>}
    52 \end{verbatim}
    52 
    53 
    53 In fact, I need \<open>continuous_on_topo\<close> to express the continuity of the projection on subfactors
    54 In fact, I need \verb+continuous_on_topo+ to express the continuity of the projection on subfactors
    54 for the product topology, in Lemma~\<open>continuous_on_restrict_product_topology\<close>, and I show
    55 for the product topology, in Lemma~\verb+continuous_on_restrict_product_topology+, and I show
    55 the above equivalence in Lemma~\<open>continuous_on_continuous_on_topo\<close>.
    56 the above equivalence in Lemma~\verb+continuous_on_continuous_on_topo+.
       
    57 
    56 
    58 I only develop the basics of the product topology in this theory. The most important missing piece
    57 I only develop the basics of the product topology in this theory. The most important missing piece
    59 is Tychonov theorem, stating that a product of compact spaces is always compact for the product
    58 is Tychonov theorem, stating that a product of compact spaces is always compact for the product
    60 topology, even when the product is not finite (or even countable).
    59 topology, even when the product is not finite (or even countable).
    61 
    60 
    62 I realized afterwards that this theory has a lot in common with \verb+Fin_Map.thy+.
    61 I realized afterwards that this theory has a lot in common with \<^file>\<open>~~/src/HOL/Library/Finite_Map.thy\<close>.
    63 \<close>
    62 \<close>
    64 
    63 
    65 subsection%important \<open>Topology without type classes\<close>
    64 subsection%important \<open>Topology without type classes\<close>
    66 
    65 
    67 subsubsection%important \<open>The topology generated by some (open) subsets\<close>
    66 subsubsection%important \<open>The topology generated by some (open) subsets\<close>
    68 
    67 
    69 text \<open>In the definition below of a generated topology, the \<open>Empty\<close> case is not necessary,
    68 text \<open>In the definition below of a generated topology, the \<open>Empty\<close> case is not necessary,
    70 as it follows from \<open>UN\<close> taking for $K$ the empty set. However, it is convenient to have,
    69 as it follows from \<open>UN\<close> taking for \<open>K\<close> the empty set. However, it is convenient to have,
    71 and is never a problem in proofs, so I prefer to write it down explicitly.
    70 and is never a problem in proofs, so I prefer to write it down explicitly.
    72 
    71 
    73 We do not require UNIV to be an open set, as this will not be the case in applications. (We are
    72 We do not require \<open>UNIV\<close> to be an open set, as this will not be the case in applications. (We are
    74 thinking of a topology on a subset of UNIV, the remaining part of UNIV being irrelevant.)\<close>
    73 thinking of a topology on a subset of \<open>UNIV\<close>, the remaining part of \<open>UNIV\<close> being irrelevant.)\<close>
    75 
    74 
    76 inductive generate_topology_on for S where
    75 inductive generate_topology_on for S where
    77 Empty: "generate_topology_on S {}"
    76   Empty: "generate_topology_on S {}"
    78 |Int: "generate_topology_on S a \<Longrightarrow> generate_topology_on S b \<Longrightarrow> generate_topology_on S (a \<inter> b)"
    77 | Int: "generate_topology_on S a \<Longrightarrow> generate_topology_on S b \<Longrightarrow> generate_topology_on S (a \<inter> b)"
    79 | UN: "(\<And>k. k \<in> K \<Longrightarrow> generate_topology_on S k) \<Longrightarrow> generate_topology_on S (\<Union>K)"
    78 | UN: "(\<And>k. k \<in> K \<Longrightarrow> generate_topology_on S k) \<Longrightarrow> generate_topology_on S (\<Union>K)"
    80 | Basis: "s \<in> S \<Longrightarrow> generate_topology_on S s"
    79 | Basis: "s \<in> S \<Longrightarrow> generate_topology_on S s"
    81 
    80 
    82 lemma%unimportant istopology_generate_topology_on:
    81 lemma%unimportant istopology_generate_topology_on:
    83   "istopology (generate_topology_on S)"
    82   "istopology (generate_topology_on S)"
    84 unfolding istopology_def by (auto intro: generate_topology_on.intros)
    83 unfolding istopology_def by (auto intro: generate_topology_on.intros)
    85 
    84 
    86 text \<open>The basic property of the topology generated by a set $S$ is that it is the
    85 text \<open>The basic property of the topology generated by a set \<open>S\<close> is that it is the
    87 smallest topology containing all the elements of $S$:\<close>
    86 smallest topology containing all the elements of \<open>S\<close>:\<close>
    88 
    87 
    89 lemma%unimportant generate_topology_on_coarsest:
    88 lemma%unimportant generate_topology_on_coarsest:
    90   assumes "istopology T"
    89   assumes "istopology T"
    91           "\<And>s. s \<in> S \<Longrightarrow> T s"
    90           "\<And>s. s \<in> S \<Longrightarrow> T s"
    92           "generate_topology_on S s0"
    91           "generate_topology_on S s0"
   342 text \<open>Pulling back a topology by map gives again a topology. \<open>subtopology\<close> is
   341 text \<open>Pulling back a topology by map gives again a topology. \<open>subtopology\<close> is
   343 a special case of this notion, pulling back by the identity. We introduce the general notion as
   342 a special case of this notion, pulling back by the identity. We introduce the general notion as
   344 we will need it to define the strong operator topology on the space of continuous linear operators,
   343 we will need it to define the strong operator topology on the space of continuous linear operators,
   345 by pulling back the product topology on the space of all functions.\<close>
   344 by pulling back the product topology on the space of all functions.\<close>
   346 
   345 
   347 text \<open>\verb+pullback_topology A f T+ is the pullback of the topology $T$ by the map $f$ on
   346 text \<open>\<open>pullback_topology A f T\<close> is the pullback of the topology \<open>T\<close> by the map \<open>f\<close> on
   348 the set $A$.\<close>
   347 the set \<open>A\<close>.\<close>
   349 
   348 
   350 definition%important pullback_topology::"('a set) \<Rightarrow> ('a \<Rightarrow> 'b) \<Rightarrow> ('b topology) \<Rightarrow> ('a topology)"
   349 definition%important pullback_topology::"('a set) \<Rightarrow> ('a \<Rightarrow> 'b) \<Rightarrow> ('b topology) \<Rightarrow> ('a topology)"
   351   where "pullback_topology A f T = topology (\<lambda>S. \<exists>U. openin T U \<and> S = f-`U \<inter> A)"
   350   where "pullback_topology A f T = topology (\<lambda>S. \<exists>U. openin T U \<and> S = f-`U \<inter> A)"
   352 
   351 
   353 lemma%important istopology_pullback_topology:
   352 lemma%important istopology_pullback_topology:
   432 the sets which are products of open sets along finitely many coordinates, and the whole
   431 the sets which are products of open sets along finitely many coordinates, and the whole
   433 space along the other coordinates. Equivalently, it is generated by sets which are one open
   432 space along the other coordinates. Equivalently, it is generated by sets which are one open
   434 set along one single coordinate, and the whole space along other coordinates. In fact, this is only
   433 set along one single coordinate, and the whole space along other coordinates. In fact, this is only
   435 equivalent for nonempty products, but for the empty product the first formulation is better
   434 equivalent for nonempty products, but for the empty product the first formulation is better
   436 (the second one gives an empty product space, while an empty product should have exactly one
   435 (the second one gives an empty product space, while an empty product should have exactly one
   437 point, equal to \verb+undefined+ along all coordinates.
   436 point, equal to \<open>undefined\<close> along all coordinates.
   438 
   437 
   439 So, we use the first formulation, which moreover seems to give rise to more straightforward proofs.
   438 So, we use the first formulation, which moreover seems to give rise to more straightforward proofs.
   440 \<close>
   439 \<close>
   441 
   440 
   442 definition%important product_topology::"('i \<Rightarrow> ('a topology)) \<Rightarrow> ('i set) \<Rightarrow> (('i \<Rightarrow> 'a) topology)"
   441 definition%important product_topology::"('i \<Rightarrow> ('a topology)) \<Rightarrow> ('i set) \<Rightarrow> (('i \<Rightarrow> 'a) topology)"
   968     apply (rule choice) using first_countable_basis by auto
   967     apply (rule choice) using first_countable_basis by auto
   969   then obtain A::"('b \<Rightarrow> nat \<Rightarrow> 'b set)" where A: "\<And>x i. x \<in> A x i"
   968   then obtain A::"('b \<Rightarrow> nat \<Rightarrow> 'b set)" where A: "\<And>x i. x \<in> A x i"
   970                                                   "\<And>x i. open (A x i)"
   969                                                   "\<And>x i. open (A x i)"
   971                                                   "\<And>x S. open S \<Longrightarrow> x \<in> S \<Longrightarrow> (\<exists>i. A x i \<subseteq> S)"
   970                                                   "\<And>x S. open S \<Longrightarrow> x \<in> S \<Longrightarrow> (\<exists>i. A x i \<subseteq> S)"
   972     by metis
   971     by metis
   973   text \<open>$B i$ is a countable basis of neighborhoods of $x_i$.\<close>
   972   text \<open>\<open>B i\<close> is a countable basis of neighborhoods of \<open>x\<^sub>i\<close>.\<close>
   974   define B where "B = (\<lambda>i. (A (x i))`UNIV \<union> {UNIV})"
   973   define B where "B = (\<lambda>i. (A (x i))`UNIV \<union> {UNIV})"
   975   have "countable (B i)" for i unfolding B_def by auto
   974   have "countable (B i)" for i unfolding B_def by auto
   976 
   975 
   977   define K where "K = {Pi\<^sub>E UNIV X | X. (\<forall>i. X i \<in> B i) \<and> finite {i. X i \<noteq> UNIV}}"
   976   define K where "K = {Pi\<^sub>E UNIV X | X. (\<forall>i. X i \<in> B i) \<and> finite {i. X i \<noteq> UNIV}}"
   978   have "Pi\<^sub>E UNIV (\<lambda>i. UNIV) \<in> K"
   977   have "Pi\<^sub>E UNIV (\<lambda>i. UNIV) \<in> K"
  1117   using product_topology_countable_basis topological_basis_imp_subbasis by auto
  1116   using product_topology_countable_basis topological_basis_imp_subbasis by auto
  1118 
  1117 
  1119 
  1118 
  1120 subsection%important \<open>The strong operator topology on continuous linear operators\<close> (* FIX ME mv*)
  1119 subsection%important \<open>The strong operator topology on continuous linear operators\<close> (* FIX ME mv*)
  1121 
  1120 
  1122 text \<open>Let 'a and 'b be two normed real vector spaces. Then the space of linear continuous
  1121 text \<open>Let \<open>'a\<close> and \<open>'b\<close> be two normed real vector spaces. Then the space of linear continuous
  1123 operators from 'a to 'b has a canonical norm, and therefore a canonical corresponding topology
  1122 operators from \<open>'a\<close> to \<open>'b\<close> has a canonical norm, and therefore a canonical corresponding topology
  1124 (the type classes instantiation are given in \verb+Bounded_Linear_Function.thy+).
  1123 (the type classes instantiation are given in \<^file>\<open>Bounded_Linear_Function.thy\<close>).
  1125 
  1124 
  1126 However, there is another topology on this space, the strong operator topology, where $T_n$ tends to
  1125 However, there is another topology on this space, the strong operator topology, where \<open>T\<^sub>n\<close> tends to
  1127 $T$ iff, for all $x$ in 'a, then $T_n x$ tends to $T x$. This is precisely the product topology
  1126 \<open>T\<close> iff, for all \<open>x\<close> in \<open>'a\<close>, then \<open>T\<^sub>n x\<close> tends to \<open>T x\<close>. This is precisely the product topology
  1128 where the target space is endowed with the norm topology. It is especially useful when 'b is the set
  1127 where the target space is endowed with the norm topology. It is especially useful when \<open>'b\<close> is the set
  1129 of real numbers, since then this topology is compact.
  1128 of real numbers, since then this topology is compact.
  1130 
  1129 
  1131 We can not implement it using type classes as there is already a topology, but at least we
  1130 We can not implement it using type classes as there is already a topology, but at least we
  1132 can define it as a topology.
  1131 can define it as a topology.
  1133 
  1132 
  1200 subsection%important \<open>Metrics on product spaces\<close>
  1199 subsection%important \<open>Metrics on product spaces\<close>
  1201 
  1200 
  1202 
  1201 
  1203 text \<open>In general, the product topology is not metrizable, unless the index set is countable.
  1202 text \<open>In general, the product topology is not metrizable, unless the index set is countable.
  1204 When the index set is countable, essentially any (convergent) combination of the metrics on the
  1203 When the index set is countable, essentially any (convergent) combination of the metrics on the
  1205 factors will do. We use below the simplest one, based on $L^1$, but $L^2$ would also work,
  1204 factors will do. We use below the simplest one, based on \<open>L\<^sup>1\<close>, but \<open>L\<^sup>2\<close> would also work,
  1206 for instance.
  1205 for instance.
  1207 
  1206 
  1208 What is not completely trivial is that the distance thus defined induces the same topology
  1207 What is not completely trivial is that the distance thus defined induces the same topology
  1209 as the product topology. This is what we have to prove to show that we have an instance
  1208 as the product topology. This is what we have to prove to show that we have an instance
  1210 of \verb+metric_space+.
  1209 of \<^class>\<open>metric_space\<close>.
  1211 
  1210 
  1212 The proofs below would work verbatim for general countable products of metric spaces. However,
  1211 The proofs below would work verbatim for general countable products of metric spaces. However,
  1213 since distances are only implemented in terms of type classes, we only develop the theory
  1212 since distances are only implemented in terms of type classes, we only develop the theory
  1214 for countable products of the same space.\<close>
  1213 for countable products of the same space.\<close>
  1215 
  1214 
  1474     unfolding dist_fun_def by simp
  1473     unfolding dist_fun_def by simp
  1475   finally show "dist x y \<le> dist x z + dist y z"
  1474   finally show "dist x y \<le> dist x z + dist y z"
  1476     by simp
  1475     by simp
  1477 next
  1476 next
  1478   text\<open>Finally, we show that the topology generated by the distance and the product
  1477   text\<open>Finally, we show that the topology generated by the distance and the product
  1479         topology coincide. This is essentially contained in Lemma \verb+fun_open_ball_aux+,
  1478         topology coincide. This is essentially contained in Lemma \<open>fun_open_ball_aux\<close>,
  1480         except that the condition to prove is expressed with filters. To deal with this,
  1479         except that the condition to prove is expressed with filters. To deal with this,
  1481         we copy some mumbo jumbo from Lemma \verb+eventually_uniformity_metric+ in
  1480         we copy some mumbo jumbo from Lemma \<open>eventually_uniformity_metric\<close> in
  1482         \verb+Real_Vector_Spaces.thy+\<close>
  1481         \<^file>\<open>~~/src/HOL/Real_Vector_Spaces.thy\<close>\<close>
  1483   fix U::"('a \<Rightarrow> 'b) set"
  1482   fix U::"('a \<Rightarrow> 'b) set"
  1484   have "eventually P uniformity \<longleftrightarrow> (\<exists>e>0. \<forall>x (y::('a \<Rightarrow> 'b)). dist x y < e \<longrightarrow> P (x, y))" for P
  1483   have "eventually P uniformity \<longleftrightarrow> (\<exists>e>0. \<forall>x (y::('a \<Rightarrow> 'b)). dist x y < e \<longrightarrow> P (x, y))" for P
  1485   unfolding uniformity_fun_def apply (subst eventually_INF_base)
  1484   unfolding uniformity_fun_def apply (subst eventually_INF_base)
  1486     by (auto simp: eventually_principal subset_eq intro: bexI[of _ "min _ _"])
  1485     by (auto simp: eventually_principal subset_eq intro: bexI[of _ "min _ _"])
  1487   then show "open U = (\<forall>x\<in>U. \<forall>\<^sub>F (x', y) in uniformity. x' = x \<longrightarrow> y \<in> U)"
  1486   then show "open U = (\<forall>x\<in>U. \<forall>\<^sub>F (x', y) in uniformity. x' = x \<longrightarrow> y \<in> U)"
  1579 subsection%important \<open>Measurability\<close> (*FIX ME mv *)
  1578 subsection%important \<open>Measurability\<close> (*FIX ME mv *)
  1580 
  1579 
  1581 text \<open>There are two natural sigma-algebras on a product space: the borel sigma algebra,
  1580 text \<open>There are two natural sigma-algebras on a product space: the borel sigma algebra,
  1582 generated by open sets in the product, and the product sigma algebra, countably generated by
  1581 generated by open sets in the product, and the product sigma algebra, countably generated by
  1583 products of measurable sets along finitely many coordinates. The second one is defined and studied
  1582 products of measurable sets along finitely many coordinates. The second one is defined and studied
  1584 in \verb+Finite_Product_Measure.thy+.
  1583 in \<^file>\<open>Finite_Product_Measure.thy\<close>.
  1585 
  1584 
  1586 These sigma-algebra share a lot of natural properties (measurability of coordinates, for instance),
  1585 These sigma-algebra share a lot of natural properties (measurability of coordinates, for instance),
  1587 but there is a fundamental difference: open sets are generated by arbitrary unions, not only
  1586 but there is a fundamental difference: open sets are generated by arbitrary unions, not only
  1588 countable ones, so typically many open sets will not be measurable with respect to the product sigma
  1587 countable ones, so typically many open sets will not be measurable with respect to the product sigma
  1589 algebra (while all sets in the product sigma algebra are borel). The two sigma algebras coincide
  1588 algebra (while all sets in the product sigma algebra are borel). The two sigma algebras coincide