(* Author: Sébastien Gouëzel sebastien.gouezel@univ-rennes1.fr with additions from LCP License: BSD
*)
section \<open>Metrics on product spaces\<close>
theory Function_Metric imports
Function_Topology
Elementary_Metric_Spaces begin
text\<open>In general, the product topology is not metrizable, unless the index set is countable.
When the index set is countable, essentially any (convergent) combination of the metrics on the
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, forinstance.
What is not completely trivial is that the distance thus defined induces the same topology
as the product topology. This is what we haveto prove toshow that we have an instance
of \<^class>\<open>metric_space\<close>.
The proofs below would work verbatim for general countable products of metric spaces. However,
since distances are only implemented in terms of type classes, we only develop the theory for countable products of the same space.\<close>
instantiation"fun" :: (countable, metric_space) metric_space begin
definition\<^marker>\<open>tag important\<close> dist_fun_def: "dist x y = (\n. (1/2)^n * min (dist (x (from_nat n)) (y (from_nat n))) 1)"
text\<open>Except for the first one, the auxiliary lemmas below are only useful when proving the instance: once it is proved, they become trivial consequences of the general theory of metric
spaces. It would thus be desirable tohide them once the instanceis proved, but I do not know how to do this.\<close>
lemma dist_fun_le_dist_first_terms: "dist x y \ 2 * Max {dist (x (from_nat n)) (y (from_nat n))|n. n \ N} + (1/2)^N" proof - have"(\n. (1 / 2) ^ (n+Suc N) * min (dist (x (from_nat (n+Suc N))) (y (from_nat (n+Suc N)))) 1)
= (\<Sum>n. (1 / 2) ^ (Suc N) * ((1/2) ^ n * min (dist (x (from_nat (n+Suc N))) (y (from_nat (n+Suc N)))) 1))" by (rule suminf_cong, simp add: power_add) alsohave"... = (1/2)^(Suc N) * (\n. (1 / 2) ^ n * min (dist (x (from_nat (n+Suc N))) (y (from_nat (n+Suc N)))) 1)" apply (rule suminf_mult) by (rule summable_comparison_test'[of "\n. (1/2)^n"], auto simp add: summable_geometric_iff) alsohave"... \ (1/2)^(Suc N) * (\n. (1 / 2) ^ n)" apply (simp, rule suminf_le, simp) by (rule summable_comparison_test'[of "\n. (1/2)^n"], auto simp add: summable_geometric_iff) alsohave"... = (1/2)^(Suc N) * 2" using suminf_geometric[of "1/2"] by auto alsohave"... = (1/2)^N" by auto finallyhave *: "(\n. (1 / 2) ^ (n+Suc N) * min (dist (x (from_nat (n+Suc N))) (y (from_nat (n+Suc N)))) 1) \ (1/2)^N" by simp
define M where"M = Max {dist (x (from_nat n)) (y (from_nat n))|n. n \ N}" have"dist (x (from_nat 0)) (y (from_nat 0)) \ M" unfolding M_def by (rule Max_ge, auto) thenhave [simp]: "M \ 0" by (meson dual_order.trans zero_le_dist) have"dist (x (from_nat n)) (y (from_nat n)) \ M" if "n\N" for n unfolding M_def apply (rule Max_ge) using that by auto thenhave i: "min (dist (x (from_nat n)) (y (from_nat n))) 1 \ M" if "n\N" for n using that by force have"(\n< Suc N. (1 / 2) ^ n * min (dist (x (from_nat n)) (y (from_nat n))) 1) \
(\<Sum>n< Suc N. M * (1 / 2) ^ n)" by (rule sum_mono, simp add: i) alsohave"... = M * (\n by (rule sum_distrib_left[symmetric]) alsohave"... \ M * (\n. (1 / 2) ^ n)" by (rule mult_left_mono, rule sum_le_suminf, auto simp add: summable_geometric_iff) alsohave"... = M * 2" using suminf_geometric[of "1/2"] by auto finallyhave **: "(\n< Suc N. (1 / 2) ^ n * min (dist (x (from_nat n)) (y (from_nat n))) 1) \ 2 * M" by simp
have"dist x y = (\n. (1 / 2) ^ n * min (dist (x (from_nat n)) (y (from_nat n))) 1)" unfolding dist_fun_def by simp alsohave"... = (\n. (1 / 2) ^ (n+Suc N) * min (dist (x (from_nat (n+Suc N))) (y (from_nat (n+Suc N)))) 1)
+ (\<Sum>n<Suc N. (1 / 2) ^ n * min (dist (x (from_nat n)) (y (from_nat n))) 1)" apply (rule suminf_split_initial_segment) by (rule summable_comparison_test'[of "\n. (1/2)^n"], auto simp add: summable_geometric_iff) alsohave"... \ 2 * M + (1/2)^N" using * ** by auto finallyshow ?thesis unfolding M_def by simp qed
lemma open_fun_contains_ball_aux: assumes"open (U::(('a \ 'b) set))" "x \ U" shows"\e>0. {y. dist x y < e} \ U" proof - have *: "openin (product_topology (\i. euclidean) UNIV) U" using open_fun_def assms by auto obtain X where H: "Pi\<^sub>E UNIV X \ U" "\i. openin euclidean (X i)" "finite {i. X i \ topspace euclidean}" "x \ Pi\<^sub>E UNIV X" using product_topology_open_contains_basis[OF * \<open>x \<in> U\<close>] by auto
define I where"I = {i. X i \ topspace euclidean}" have"finite I"unfolding I_def using H(3) by auto
{ fix i have"x i \ X i" using \x \ U\ H by auto thenhave"\e. e>0 \ ball (x i) e \ X i" using\<open>openin euclidean (X i)\<close> open_openin open_contains_ball by blast thenobtain e where"e>0""ball (x i) e \ X i" by blast
define f where"f = min e (1/2)" have"f>0""f<1"unfolding f_def using\<open>e>0\<close> by auto moreoverhave"ball (x i) f \ X i" unfolding f_def using \ball (x i) e \ X i\ by auto ultimatelyhave"\f. f > 0 \ f < 1 \ ball (x i) f \ X i" by auto
} note * = this have"\e. \i. e i > 0 \ e i < 1 \ ball (x i) (e i) \ X i" by (rule choice, auto simp add: *) thenobtain e where"\i. e i > 0" "\i. e i < 1" "\i. ball (x i) (e i) \ X i" by blast
define m where"m = Min {(1/2)^(to_nat i) * e i|i. i \ I}" have"m > 0"if"I\{}" unfolding m_def Min_gr_iff using\<open>finite I\<close> \<open>I \<noteq> {}\<close> \<open>\<And>i. e i > 0\<close> by auto moreoverhave"{y. dist x y < m} \ U" proof (auto) fix y assume"dist x y < m" have"y i \ X i" if "i \ I" for i proof - have *: "summable (\n. (1/2)^n * min (dist (x (from_nat n)) (y (from_nat n))) 1)" by (rule summable_comparison_test'[of "\n. (1/2)^n"], auto simp add: summable_geometric_iff)
define n where"n = to_nat i" have"(1/2)^n * min (dist (x (from_nat n)) (y (from_nat n))) 1 < m" using\<open>dist x y < m\<close> unfolding dist_fun_def using sum_le_suminf[OF *, of "{n}"] by auto thenhave"(1/2)^(to_nat i) * min (dist (x i) (y i)) 1 < m" using\<open>n = to_nat i\<close> by auto alsohave"... \ (1/2)^(to_nat i) * e i" unfolding m_def apply (rule Min_le) using\<open>finite I\<close> \<open>i \<in> I\<close> by auto ultimatelyhave"min (dist (x i) (y i)) 1 < e i" by (auto simp add: field_split_simps) thenhave"dist (x i) (y i) < e i" using\<open>e i < 1\<close> by auto thenshow"y i \ X i" using \ball (x i) (e i) \ X i\ by auto qed thenhave"y \ Pi\<^sub>E UNIV X" using H(1) unfolding I_def topspace_euclidean by (auto simp add: PiE_iff) thenshow"y \ U" using \Pi\<^sub>E UNIV X \ U\ by auto qed ultimatelyhave *: "\m>0. {y. dist x y < m} \ U" if "I \ {}" using that by auto
have"U = UNIV"if"I = {}" using that H(1) unfolding I_def topspace_euclidean by (auto simp add: PiE_iff) thenhave"\m>0. {y. dist x y < m} \ U" if "I = {}" using that zero_less_one by blast thenshow"\m>0. {y. dist x y < m} \ U" using * by blast qed
lemma ball_fun_contains_open_aux: fixes x::"('a \ 'b)" and e::real assumes"e>0" shows"\U. open U \ x \ U \ U \ {y. dist x y < e}" proof - have"\N::nat. 2^N > 8/e" by (simp add: real_arch_pow) thenobtain N::nat where"2^N > 8/e"by auto
define f where"f = e/4" have [simp]: "e>0""f > 0"unfolding f_def using assms by auto
define X::"('a \ 'b set)" where "X = (\i. if (\n\N. i = from_nat n) then {z. dist (x i) z < f} else UNIV)" have"{i. X i \ UNIV} \ from_nat`{0..N}" unfolding X_def by auto thenhave"finite {i. X i \ topspace euclidean}" unfolding topspace_euclidean using finite_surj by blast have"\i. open (X i)" unfolding X_def using metric_space_class.open_ball open_UNIV by auto thenhave"\i. openin euclidean (X i)" using open_openin by auto
define U where"U = Pi\<^sub>E UNIV X" have"open U" unfolding open_fun_def product_topology_def apply (rule topology_generated_by_Basis) unfolding U_def using\<open>\<And>i. openin euclidean (X i)\<close> \<open>finite {i. X i \<noteq> topspace euclidean}\<close> by auto moreoverhave"x \ U" unfolding U_def X_def by (auto simp add: PiE_iff) moreoverhave"dist x y < e"if"y \ U" for y proof - have *: "dist (x (from_nat n)) (y (from_nat n)) \ f" if "n \ N" for n using\<open>y \<in> U\<close> unfolding U_def apply (auto simp add: PiE_iff) unfolding X_def using that by (metis less_imp_le mem_Collect_eq) have **: "Max {dist (x (from_nat n)) (y (from_nat n))|n. n \ N} \ f" apply (rule Max.boundedI) using * by auto
have"dist x y \ 2 * Max {dist (x (from_nat n)) (y (from_nat n))|n. n \ N} + (1/2)^N" by (rule dist_fun_le_dist_first_terms) alsohave"... \ 2 * f + e / 8" apply (rule add_mono) using ** \<open>2^N > 8/e\<close> by(auto simp add: field_split_simps) alsohave"... \ e/2 + e/8" unfolding f_def by auto alsohave"... < e" by auto finallyshow"dist x y < e"by simp qed ultimatelyshow ?thesis by auto qed
lemma fun_open_ball_aux: fixes U::"('a \ 'b) set" shows"open U \ (\x\U. \e>0. \y. dist x y < e \ y \ U)" proof (auto) assume"open U" fix x assume"x \ U" thenshow"\e>0. \y. dist x y < e \ y \ U" using open_fun_contains_ball_aux[OF \<open>open U\<close> \<open>x \<in> U\<close>] by auto next assume H: "\x\U. \e>0. \y. dist x y < e \ y \ U"
define K where"K = {V. open V \ V \ U}"
{ fix x assume"x \ U" thenobtain e where e: "e>0""{y. dist x y < e} \ U" using H by blast thenobtain V where V: "open V""x \ V" "V \ {y. dist x y < e}" using ball_fun_contains_open_aux[OF \<open>e>0\<close>, of x] by auto have"V \ K" unfolding K_def using e(2) V(1) V(3) by auto thenhave"x \ (\K)" using \x \ V\ by auto
} thenhave"(\K) = U" unfolding K_def by auto moreoverhave"open (\K)" unfolding K_def by auto ultimatelyshow"open U"by simp qed
instanceproof fix x y::"'a \ 'b" show "(dist x y = 0) = (x = y)" proof assume"x = y" thenshow"dist x y = 0"unfolding dist_fun_def using\<open>x = y\<close> by auto next assume"dist x y = 0" have *: "summable (\n. (1/2)^n * min (dist (x (from_nat n)) (y (from_nat n))) 1)" by (rule summable_comparison_test'[of "\n. (1/2)^n"], auto simp add: summable_geometric_iff) have"(1/2)^n * min (dist (x (from_nat n)) (y (from_nat n))) 1 = 0"for n using\<open>dist x y = 0\<close> unfolding dist_fun_def by (simp add: "*" suminf_eq_zero_iff) thenhave"dist (x (from_nat n)) (y (from_nat n)) = 0"for n by (metis div_0 min_def nonzero_mult_div_cancel_left power_eq_0_iff
zero_eq_1_divide_iff zero_neq_numeral) thenhave"x (from_nat n) = y (from_nat n)"for n by auto thenhave"x i = y i"for i by (metis from_nat_to_nat) thenshow"x = y" by auto qed next text\<open>The proof of the triangular inequality is trivial, modulo the fact that we are dealing with infinite series, hence we should justify the convergence at each step. In this
respect, the following simplification rule is extremely handy.\<close> have [simp]: "summable (\n. (1/2)^n * min (dist (u (from_nat n)) (v (from_nat n))) 1)" for u v::"'a \ 'b" by (rule summable_comparison_test'[of "\n. (1/2)^n"], auto simp add: summable_geometric_iff) fix x y z::"'a \ 'b"
{ fix n have *: "dist (x (from_nat n)) (y (from_nat n)) \
dist (x (from_nat n)) (z (from_nat n)) + dist (y (from_nat n)) (z (from_nat n))" by (simp add: dist_triangle2) have"0 \ dist (y (from_nat n)) (z (from_nat n))" using zero_le_dist by blast moreover
{ assume"min (dist (y (from_nat n)) (z (from_nat n))) 1 \ dist (y (from_nat n)) (z (from_nat n))" thenhave"1 \ min (dist (x (from_nat n)) (z (from_nat n))) 1 + min (dist (y (from_nat n)) (z (from_nat n))) 1" by (metis (no_types) diff_le_eq diff_self min_def zero_le_dist zero_le_one)
} ultimatelyhave"min (dist (x (from_nat n)) (y (from_nat n))) 1 \
min (dist (x (from_nat n)) (z (from_nat n))) 1 + min (dist (y (from_nat n)) (z (from_nat n))) 1" using * by linarith
} note ineq = this have"dist x y = (\n. (1/2)^n * min (dist (x (from_nat n)) (y (from_nat n))) 1)" unfolding dist_fun_def by simp alsohave"... \ (\n. (1/2)^n * min (dist (x (from_nat n)) (z (from_nat n))) 1
+ (1/2)^n * min (dist (y (from_nat n)) (z (from_nat n))) 1)" apply (rule suminf_le) using ineq apply (metis (no_types, opaque_lifting) add.right_neutral distrib_left
le_divide_eq_numeral1(1) mult_2_right mult_left_mono zero_le_one zero_le_power) by (auto simp add: summable_add) alsohave"... = (\n. (1/2)^n * min (dist (x (from_nat n)) (z (from_nat n))) 1)
+ (\<Sum>n. (1/2)^n * min (dist (y (from_nat n)) (z (from_nat n))) 1)" by (rule suminf_add[symmetric], auto) alsohave"... = dist x z + dist y z" unfolding dist_fun_def by simp finallyshow"dist x y \ dist x z + dist y z" by simp next text\<open>Finally, we show that the topology generated by the distance and the product
topology coincide. This is essentially contained inLemma\<open>fun_open_ball_aux\<close>,
except that the condition to prove is expressed with filters. To deal with this,
we copy some mumbo jumbo fromLemma\<open>eventually_uniformity_metric\<close> in \<^file>\<open>~~/src/HOL/Real_Vector_Spaces.thy\<close>\<close> fix U::"('a \ 'b) set" have"eventually P uniformity \ (\e>0. \x (y::('a \ 'b)). dist x y < e \ P (x, y))" for P unfolding uniformity_fun_def apply (subst eventually_INF_base) by (auto simp: eventually_principal subset_eq intro: bexI[of _ "min _ _"]) thenshow"open U = (\x\U. \\<^sub>F (x', y) in uniformity. x' = x \ y \ U)" unfolding fun_open_ball_aux by simp qed (simp add: uniformity_fun_def)
end
text\<open>Nice properties of spaces are preserved under countable products. In addition to first countability, second countability and metrizability, as we have seen above,
completeness isalso preserved, and therefore being Polish.\<close>
instance"fun" :: (countable, complete_space) complete_space proof fix u::"nat \ ('a \ 'b)" assume "Cauchy u" have"Cauchy (\n. u n i)" for i unfolding Cauchy_def proof (intro strip) fix e::real assume"e>0" obtain k where"i = from_nat k" using from_nat_to_nat[of i] by metis have"(1/2)^k * min e 1 > 0"using\<open>e>0\<close> by auto thenhave"\N. \m n. N \ m \ N \ n \ dist (u m) (u n) < (1/2)^k * min e 1" using\<open>Cauchy u\<close> by (meson Cauchy_def) thenobtain N::nat where C: "\m n. N \ m \ N \ n \ dist (u m) (u n) < (1/2)^k * min e 1" by blast have"\m n. N \ m \ N \ n \ dist (u m i) (u n i) < e" proof (auto) fix m n::nat assume"m \ N" "n \ N" have"(1/2)^k * min (dist (u m i) (u n i)) 1
= sum (\<lambda>p. (1/2)^p * min (dist (u m (from_nat p)) (u n (from_nat p))) 1) {k}" using\<open>i = from_nat k\<close> by auto alsohave"... \ (\p. (1/2)^p * min (dist (u m (from_nat p)) (u n (from_nat p))) 1)" apply (rule sum_le_suminf) by (rule summable_comparison_test'[of "\n. (1/2)^n"], auto simp add: summable_geometric_iff) alsohave"... = dist (u m) (u n)" unfolding dist_fun_def by auto alsohave"... < (1/2)^k * min e 1" using C \<open>m \<ge> N\<close> \<open>n \<ge> N\<close> by auto finallyhave"min (dist (u m i) (u n i)) 1 < min e 1" by (auto simp add: field_split_simps) thenshow"dist (u m i) (u n i) < e"by auto qed thenshow"\M. \m\M. \n\M. dist (u m i) (u n i) < e" by blast qed thenhave"\x. (\n. u n i) \ x" for i using Cauchy_convergent convergent_def by auto thenhave"\x. \i. (\n. u n i) \ x i" using choice by force thenobtain x where *: "\i. (\n. u n i) \ x i" by blast have"u \ x" proof (rule metric_LIMSEQ_I) fix e assume [simp]: "e>(0::real)" have i: "\K. \n\K. dist (u n i) (x i) < e/4" for i by (rule metric_LIMSEQ_D, auto simp add: *) have"\K. \i. \n\K i. dist (u n i) (x i) < e/4" apply (rule choice) using i by auto thenobtain K where K: "\i n. n \ K i \ dist (u n i) (x i) < e/4" by blast
have"\N::nat. 2^N > 4/e" by (simp add: real_arch_pow) thenobtain N::nat where"2^N > 4/e"by auto
define L where"L = Max {K (from_nat n)|n. n \ N}" have"dist (u k) x < e"if"k \ L" for k proof - have *: "dist (u k (from_nat n)) (x (from_nat n)) \ e / 4" if "n \ N" for n proof - have"K (from_nat n) \ L" unfolding L_def apply (rule Max_ge) using\<open>n \<le> N\<close> by auto thenhave"k \ K (from_nat n)" using \k \ L\ by auto thenshow ?thesis using K less_imp_le by auto qed have **: "Max {dist (u k (from_nat n)) (x (from_nat n)) |n. n \ N} \ e/4" apply (rule Max.boundedI) using * by auto have"dist (u k) x \ 2 * Max {dist (u k (from_nat n)) (x (from_nat n)) |n. n \ N} + (1/2)^N" using dist_fun_le_dist_first_terms by auto alsohave"... \ 2 * e/4 + e/4" apply (rule add_mono) using ** \<open>2^N > 4/e\<close> less_imp_le by (auto simp add: field_split_simps) alsohave"... < e"by auto finallyshow ?thesis by simp qed thenshow"\L. \k\L. dist (u k) x < e" by blast qed thenshow"convergent u"using convergent_def by blast qed
instance"fun" :: (countable, polish_space) polish_space by standard
end
¤ Dauer der Verarbeitung: 0.1 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.