src/HOL/Analysis/Topology_Euclidean_Space.thy
changeset 69619 3f7d8e05e0f2
parent 69618 2be1baf40351
child 69676 56acd449da41
equal deleted inserted replaced
69618:2be1baf40351 69619:3f7d8e05e0f2
   259     using finite_ball_avoid[OF assms] by auto
   259     using finite_ball_avoid[OF assms] by auto
   260   define e2 where "e2 \<equiv> e1/2"
   260   define e2 where "e2 \<equiv> e1/2"
   261   have "e2>0" and "e2 < e1" unfolding e2_def using \<open>e1>0\<close> by auto
   261   have "e2>0" and "e2 < e1" unfolding e2_def using \<open>e1>0\<close> by auto
   262   then have "cball p e2 \<subseteq> ball p e1" by (subst cball_subset_ball_iff,auto)
   262   then have "cball p e2 \<subseteq> ball p e1" by (subst cball_subset_ball_iff,auto)
   263   then show "\<exists>e>0. \<forall>w\<in>cball p e. w \<in> S \<and> (w \<noteq> p \<longrightarrow> w \<notin> X)" using \<open>e2>0\<close> e1 by auto
   263   then show "\<exists>e>0. \<forall>w\<in>cball p e. w \<in> S \<and> (w \<noteq> p \<longrightarrow> w \<notin> X)" using \<open>e2>0\<close> e1 by auto
       
   264 qed
       
   265 
       
   266 lemma dim_cball:
       
   267   assumes "e > 0"
       
   268   shows "dim (cball (0 :: 'n::euclidean_space) e) = DIM('n)"
       
   269 proof -
       
   270   {
       
   271     fix x :: "'n::euclidean_space"
       
   272     define y where "y = (e / norm x) *\<^sub>R x"
       
   273     then have "y \<in> cball 0 e"
       
   274       using assms by auto
       
   275     moreover have *: "x = (norm x / e) *\<^sub>R y"
       
   276       using y_def assms by simp
       
   277     moreover from * have "x = (norm x/e) *\<^sub>R y"
       
   278       by auto
       
   279     ultimately have "x \<in> span (cball 0 e)"
       
   280       using span_scale[of y "cball 0 e" "norm x/e"]
       
   281         span_superset[of "cball 0 e"]
       
   282       by (simp add: span_base)
       
   283   }
       
   284   then have "span (cball 0 e) = (UNIV :: 'n::euclidean_space set)"
       
   285     by auto
       
   286   then show ?thesis
       
   287     using dim_span[of "cball (0 :: 'n::euclidean_space) e"] by (auto simp: dim_UNIV)
   264 qed
   288 qed
   265 
   289 
   266 
   290 
   267 subsection \<open>Boxes\<close>
   291 subsection \<open>Boxes\<close>
   268 
   292 
   827 
   851 
   828 lemma image_smult_cbox:"(\<lambda>x. m *\<^sub>R (x::_::euclidean_space)) ` cbox a b =
   852 lemma image_smult_cbox:"(\<lambda>x. m *\<^sub>R (x::_::euclidean_space)) ` cbox a b =
   829   (if cbox a b = {} then {} else if 0 \<le> m then cbox (m *\<^sub>R a) (m *\<^sub>R b) else cbox (m *\<^sub>R b) (m *\<^sub>R a))"
   853   (if cbox a b = {} then {} else if 0 \<le> m then cbox (m *\<^sub>R a) (m *\<^sub>R b) else cbox (m *\<^sub>R b) (m *\<^sub>R a))"
   830   using image_affinity_cbox[of m 0 a b] by auto
   854   using image_affinity_cbox[of m 0 a b] by auto
   831 
   855 
       
   856 lemma swap_continuous:
       
   857   assumes "continuous_on (cbox (a,c) (b,d)) (\<lambda>(x,y). f x y)"
       
   858     shows "continuous_on (cbox (c,a) (d,b)) (\<lambda>(x, y). f y x)"
       
   859 proof -
       
   860   have "(\<lambda>(x, y). f y x) = (\<lambda>(x, y). f x y) \<circ> prod.swap"
       
   861     by auto
       
   862   then show ?thesis
       
   863     apply (rule ssubst)
       
   864     apply (rule continuous_on_compose)
       
   865     apply (simp add: split_def)
       
   866     apply (rule continuous_intros | simp add: assms)+
       
   867     done
       
   868 qed
       
   869 
   832 
   870 
   833 subsection \<open>General Intervals\<close>
   871 subsection \<open>General Intervals\<close>
   834 
   872 
   835 definition%important "is_interval (s::('a::euclidean_space) set) \<longleftrightarrow>
   873 definition%important "is_interval (s::('a::euclidean_space) set) \<longleftrightarrow>
   836   (\<forall>a\<in>s. \<forall>b\<in>s. \<forall>x. (\<forall>i\<in>Basis. ((a\<bullet>i \<le> x\<bullet>i \<and> x\<bullet>i \<le> b\<bullet>i) \<or> (b\<bullet>i \<le> x\<bullet>i \<and> x\<bullet>i \<le> a\<bullet>i))) \<longrightarrow> x \<in> s)"
   874   (\<forall>a\<in>s. \<forall>b\<in>s. \<forall>x. (\<forall>i\<in>Basis. ((a\<bullet>i \<le> x\<bullet>i \<and> x\<bullet>i \<le> b\<bullet>i) \<or> (b\<bullet>i \<le> x\<bullet>i \<and> x\<bullet>i \<le> a\<bullet>i))) \<longrightarrow> x \<in> s)"
  2132 qed
  2170 qed
  2133 
  2171 
  2134 
  2172 
  2135 subsection%unimportant \<open>Some properties of a canonical subspace\<close>
  2173 subsection%unimportant \<open>Some properties of a canonical subspace\<close>
  2136 
  2174 
  2137 lemma subspace_substandard: "subspace {x::'a::euclidean_space. (\<forall>i\<in>Basis. P i \<longrightarrow> x\<bullet>i = 0)}"
       
  2138   by (auto simp: subspace_def inner_add_left)
       
  2139 
       
  2140 lemma closed_substandard: "closed {x::'a::euclidean_space. \<forall>i\<in>Basis. P i \<longrightarrow> x\<bullet>i = 0}"
  2175 lemma closed_substandard: "closed {x::'a::euclidean_space. \<forall>i\<in>Basis. P i \<longrightarrow> x\<bullet>i = 0}"
  2141   (is "closed ?A")
  2176   (is "closed ?A")
  2142 proof -
  2177 proof -
  2143   let ?D = "{i\<in>Basis. P i}"
  2178   let ?D = "{i\<in>Basis. P i}"
  2144   have "closed (\<Inter>i\<in>?D. {x::'a. x\<bullet>i = 0})"
  2179   have "closed (\<Inter>i\<in>?D. {x::'a. x\<bullet>i = 0})"
  2145     by (simp add: closed_INT closed_Collect_eq continuous_on_inner
  2180     by (simp add: closed_INT closed_Collect_eq continuous_on_inner
  2146         continuous_on_const continuous_on_id)
  2181         continuous_on_const continuous_on_id)
  2147   also have "(\<Inter>i\<in>?D. {x::'a. x\<bullet>i = 0}) = ?A"
  2182   also have "(\<Inter>i\<in>?D. {x::'a. x\<bullet>i = 0}) = ?A"
  2148     by auto
  2183     by auto
  2149   finally show "closed ?A" .
  2184   finally show "closed ?A" .
  2150 qed
       
  2151 
       
  2152 lemma dim_substandard:
       
  2153   assumes d: "d \<subseteq> Basis"
       
  2154   shows "dim {x::'a::euclidean_space. \<forall>i\<in>Basis. i \<notin> d \<longrightarrow> x\<bullet>i = 0} = card d" (is "dim ?A = _")
       
  2155 proof (rule dim_unique)
       
  2156   from d show "d \<subseteq> ?A"
       
  2157     by (auto simp: inner_Basis)
       
  2158   from d show "independent d"
       
  2159     by (rule independent_mono [OF independent_Basis])
       
  2160   have "x \<in> span d" if "\<forall>i\<in>Basis. i \<notin> d \<longrightarrow> x \<bullet> i = 0" for x
       
  2161   proof -
       
  2162     have "finite d"
       
  2163       by (rule finite_subset [OF d finite_Basis])
       
  2164     then have "(\<Sum>i\<in>d. (x \<bullet> i) *\<^sub>R i) \<in> span d"
       
  2165       by (simp add: span_sum span_clauses)
       
  2166     also have "(\<Sum>i\<in>d. (x \<bullet> i) *\<^sub>R i) = (\<Sum>i\<in>Basis. (x \<bullet> i) *\<^sub>R i)"
       
  2167       by (rule sum.mono_neutral_cong_left [OF finite_Basis d]) (auto simp: that)
       
  2168     finally show "x \<in> span d"
       
  2169       by (simp only: euclidean_representation)
       
  2170   qed
       
  2171   then show "?A \<subseteq> span d" by auto
       
  2172 qed simp
       
  2173 
       
  2174 text \<open>Hence closure and completeness of all subspaces.\<close>
       
  2175 lemma ex_card:
       
  2176   assumes "n \<le> card A"
       
  2177   shows "\<exists>S\<subseteq>A. card S = n"
       
  2178 proof (cases "finite A")
       
  2179   case True
       
  2180   from ex_bij_betw_nat_finite[OF this] obtain f where f: "bij_betw f {0..<card A} A" ..
       
  2181   moreover from f \<open>n \<le> card A\<close> have "{..< n} \<subseteq> {..< card A}" "inj_on f {..< n}"
       
  2182     by (auto simp: bij_betw_def intro: subset_inj_on)
       
  2183   ultimately have "f ` {..< n} \<subseteq> A" "card (f ` {..< n}) = n"
       
  2184     by (auto simp: bij_betw_def card_image)
       
  2185   then show ?thesis by blast
       
  2186 next
       
  2187   case False
       
  2188   with \<open>n \<le> card A\<close> show ?thesis by force
       
  2189 qed
  2185 qed
  2190 
  2186 
  2191 lemma closed_subspace:
  2187 lemma closed_subspace:
  2192   fixes s :: "'a::euclidean_space set"
  2188   fixes s :: "'a::euclidean_space set"
  2193   assumes "subspace s"
  2189   assumes "subspace s"