src/HOL/Analysis/Topology_Euclidean_Space.thy
changeset 67155 9e5b05d54f9d
parent 66939 04678058308f
child 67399 eab6ce8368fa
equal deleted inserted replaced
67154:c7def8f836d0 67155:9e5b05d54f9d
  1247 lemma open_contains_cball_eq: "open S \<Longrightarrow> (\<forall>x. x \<in> S \<longleftrightarrow> (\<exists>e>0. cball x e \<subseteq> S))"
  1247 lemma open_contains_cball_eq: "open S \<Longrightarrow> (\<forall>x. x \<in> S \<longleftrightarrow> (\<exists>e>0. cball x e \<subseteq> S))"
  1248   by (metis open_contains_cball subset_eq order_less_imp_le centre_in_cball)
  1248   by (metis open_contains_cball subset_eq order_less_imp_le centre_in_cball)
  1249 
  1249 
  1250 lemma euclidean_dist_l2:
  1250 lemma euclidean_dist_l2:
  1251   fixes x y :: "'a :: euclidean_space"
  1251   fixes x y :: "'a :: euclidean_space"
  1252   shows "dist x y = setL2 (\<lambda>i. dist (x \<bullet> i) (y \<bullet> i)) Basis"
  1252   shows "dist x y = L2_set (\<lambda>i. dist (x \<bullet> i) (y \<bullet> i)) Basis"
  1253   unfolding dist_norm norm_eq_sqrt_inner setL2_def
  1253   unfolding dist_norm norm_eq_sqrt_inner L2_set_def
  1254   by (subst euclidean_inner) (simp add: power2_eq_square inner_diff_left)
  1254   by (subst euclidean_inner) (simp add: power2_eq_square inner_diff_left)
  1255 
  1255 
  1256 lemma eventually_nhds_ball: "d > 0 \<Longrightarrow> eventually (\<lambda>x. x \<in> ball z d) (nhds z)"
  1256 lemma eventually_nhds_ball: "d > 0 \<Longrightarrow> eventually (\<lambda>x. x \<in> ball z d) (nhds z)"
  1257   by (rule eventually_nhds_in_open) simp_all
  1257   by (rule eventually_nhds_in_open) simp_all
  1258 
  1258 
  1356   show ?thesis
  1356   show ?thesis
  1357   proof (rule exI[of _ ?a], rule exI[of _ ?b], safe)
  1357   proof (rule exI[of _ ?a], rule exI[of _ ?b], safe)
  1358     fix y :: 'a
  1358     fix y :: 'a
  1359     assume *: "y \<in> box ?a ?b"
  1359     assume *: "y \<in> box ?a ?b"
  1360     have "dist x y = sqrt (\<Sum>i\<in>Basis. (dist (x \<bullet> i) (y \<bullet> i))\<^sup>2)"
  1360     have "dist x y = sqrt (\<Sum>i\<in>Basis. (dist (x \<bullet> i) (y \<bullet> i))\<^sup>2)"
  1361       unfolding setL2_def[symmetric] by (rule euclidean_dist_l2)
  1361       unfolding L2_set_def[symmetric] by (rule euclidean_dist_l2)
  1362     also have "\<dots> < sqrt (\<Sum>(i::'a)\<in>Basis. e^2 / real (DIM('a)))"
  1362     also have "\<dots> < sqrt (\<Sum>(i::'a)\<in>Basis. e^2 / real (DIM('a)))"
  1363     proof (rule real_sqrt_less_mono, rule sum_strict_mono)
  1363     proof (rule real_sqrt_less_mono, rule sum_strict_mono)
  1364       fix i :: "'a"
  1364       fix i :: "'a"
  1365       assume i: "i \<in> Basis"
  1365       assume i: "i \<in> Basis"
  1366       have "a i < y\<bullet>i \<and> y\<bullet>i < b i"
  1366       have "a i < y\<bullet>i \<and> y\<bullet>i < b i"
  1458   show ?thesis
  1458   show ?thesis
  1459   proof (rule exI[of _ ?a], rule exI[of _ ?b], safe)
  1459   proof (rule exI[of _ ?a], rule exI[of _ ?b], safe)
  1460     fix y :: 'a
  1460     fix y :: 'a
  1461     assume *: "y \<in> cbox ?a ?b"
  1461     assume *: "y \<in> cbox ?a ?b"
  1462     have "dist x y = sqrt (\<Sum>i\<in>Basis. (dist (x \<bullet> i) (y \<bullet> i))\<^sup>2)"
  1462     have "dist x y = sqrt (\<Sum>i\<in>Basis. (dist (x \<bullet> i) (y \<bullet> i))\<^sup>2)"
  1463       unfolding setL2_def[symmetric] by (rule euclidean_dist_l2)
  1463       unfolding L2_set_def[symmetric] by (rule euclidean_dist_l2)
  1464     also have "\<dots> < sqrt (\<Sum>(i::'a)\<in>Basis. e^2 / real (DIM('a)))"
  1464     also have "\<dots> < sqrt (\<Sum>(i::'a)\<in>Basis. e^2 / real (DIM('a)))"
  1465     proof (rule real_sqrt_less_mono, rule sum_strict_mono)
  1465     proof (rule real_sqrt_less_mono, rule sum_strict_mono)
  1466       fix i :: "'a"
  1466       fix i :: "'a"
  1467       assume i: "i \<in> Basis"
  1467       assume i: "i \<in> Basis"
  1468       have "a i \<le> y\<bullet>i \<and> y\<bullet>i \<le> b i"
  1468       have "a i \<le> y\<bullet>i \<and> y\<bullet>i \<le> b i"
  4577       fix n
  4577       fix n
  4578       assume n: "\<forall>i\<in>Basis. dist (f (r n) \<bullet> i) (l \<bullet> i) < e / (real_of_nat DIM('a))"
  4578       assume n: "\<forall>i\<in>Basis. dist (f (r n) \<bullet> i) (l \<bullet> i) < e / (real_of_nat DIM('a))"
  4579       have "dist (f (r n)) l \<le> (\<Sum>i\<in>Basis. dist (f (r n) \<bullet> i) (l \<bullet> i))"
  4579       have "dist (f (r n)) l \<le> (\<Sum>i\<in>Basis. dist (f (r n) \<bullet> i) (l \<bullet> i))"
  4580         apply (subst euclidean_dist_l2)
  4580         apply (subst euclidean_dist_l2)
  4581         using zero_le_dist
  4581         using zero_le_dist
  4582         apply (rule setL2_le_sum)
  4582         apply (rule L2_set_le_sum)
  4583         done
  4583         done
  4584       also have "\<dots> < (\<Sum>i\<in>(Basis::'a set). e / (real_of_nat DIM('a)))"
  4584       also have "\<dots> < (\<Sum>i\<in>(Basis::'a set). e / (real_of_nat DIM('a)))"
  4585         apply (rule sum_strict_mono)
  4585         apply (rule sum_strict_mono)
  4586         using n
  4586         using n
  4587         apply auto
  4587         apply auto