src/HOL/Multivariate_Analysis/Topology_Euclidean_Space.thy
changeset 44122 5469da57ab77
parent 44081 730f7cced3a6
child 44125 230a8665c919
equal deleted inserted replaced
44081:730f7cced3a6 44122:5469da57ab77
   471   fixes x :: "'a::{perfect_space, metric_space}"
   471   fixes x :: "'a::{perfect_space, metric_space}"
   472   shows "0 < r \<Longrightarrow> \<exists>a. a \<noteq> x \<and> dist a x < r"
   472   shows "0 < r \<Longrightarrow> \<exists>a. a \<noteq> x \<and> dist a x < r"
   473 using islimpt_UNIV [of x]
   473 using islimpt_UNIV [of x]
   474 by (simp add: islimpt_approachable)
   474 by (simp add: islimpt_approachable)
   475 
   475 
   476 instance real :: perfect_space
   476 instance real_basis_with_inner \<subseteq> perfect_space
   477 apply default
   477 proof
   478 apply (rule islimpt_approachable [THEN iffD2])
   478   fix x :: 'a
   479 apply (clarify, rule_tac x="x + e/2" in bexI)
       
   480 apply (auto simp add: dist_norm)
       
   481 done
       
   482 
       
   483 instance euclidean_space \<subseteq> perfect_space
       
   484 proof fix x::'a
       
   485   { fix e :: real assume "0 < e"
   479   { fix e :: real assume "0 < e"
   486     def a \<equiv> "x $$ 0"
   480     def y \<equiv> "x + scaleR (e/2) (sgn (basis 0))"
   487     have "a islimpt UNIV" by (rule islimpt_UNIV)
   481     from `0 < e` have "y \<noteq> x"
   488     with `0 < e` obtain b where "b \<noteq> a" and "dist b a < e"
   482       unfolding y_def by (simp add: sgn_zero_iff basis_eq_0_iff DIM_positive)
   489       unfolding islimpt_approachable by auto
   483     from `0 < e` have "dist y x < e"
   490     def y \<equiv> "\<chi>\<chi> i. if i = 0 then b else x$$i :: 'a"
   484       unfolding y_def by (simp add: dist_norm norm_sgn)
   491     from `b \<noteq> a` have "y \<noteq> x" unfolding a_def y_def apply(subst euclidean_eq) apply safe
       
   492       apply(erule_tac x=0 in allE) using DIM_positive[where 'a='a] by auto
       
   493 
       
   494     have *:"(\<Sum>i<DIM('a). (dist (y $$ i) (x $$ i))\<twosuperior>) = (\<Sum>i\<in>{0}. (dist (y $$ i) (x $$ i))\<twosuperior>)"
       
   495       apply(rule setsum_mono_zero_right) unfolding y_def by auto
       
   496     from `dist b a < e` have "dist y x < e"
       
   497       apply(subst euclidean_dist_l2)
       
   498       unfolding setL2_def * unfolding y_def a_def using `0 < e` by auto
       
   499     from `y \<noteq> x` and `dist y x < e`
   485     from `y \<noteq> x` and `dist y x < e`
   500     have "\<exists>y\<in>UNIV. y \<noteq> x \<and> dist y x < e" by auto
   486     have "\<exists>y\<in>UNIV. y \<noteq> x \<and> dist y x < e" by auto
   501   }
   487   }
   502   then show "x islimpt UNIV" unfolding islimpt_approachable by blast
   488   then show "x islimpt UNIV" unfolding islimpt_approachable by blast
   503 qed
   489 qed