src/HOL/Analysis/Topology_Euclidean_Space.thy
changeset 69618 2be1baf40351
parent 69617 63ee37c519a3
child 69619 3f7d8e05e0f2
equal deleted inserted replaced
69617:63ee37c519a3 69618:2be1baf40351
  1102 lemma closed_interval_right:
  1102 lemma closed_interval_right:
  1103   fixes a :: "'a::euclidean_space"
  1103   fixes a :: "'a::euclidean_space"
  1104   shows "closed {x::'a. \<forall>i\<in>Basis. a\<bullet>i \<le> x\<bullet>i}"
  1104   shows "closed {x::'a. \<forall>i\<in>Basis. a\<bullet>i \<le> x\<bullet>i}"
  1105   by (simp add: Collect_ball_eq closed_INT closed_Collect_le continuous_on_inner continuous_on_const continuous_on_id)
  1105   by (simp add: Collect_ball_eq closed_INT closed_Collect_le continuous_on_inner continuous_on_const continuous_on_id)
  1106 
  1106 
  1107 lemma continuous_le_on_closure:
       
  1108   fixes a::real
       
  1109   assumes f: "continuous_on (closure s) f"
       
  1110       and x: "x \<in> closure(s)"
       
  1111       and xlo: "\<And>x. x \<in> s ==> f(x) \<le> a"
       
  1112     shows "f(x) \<le> a"
       
  1113     using image_closure_subset [OF f]
       
  1114   using image_closure_subset [OF f] closed_halfspace_le [of "1::real" a] assms
       
  1115   by force
       
  1116 
       
  1117 lemma continuous_ge_on_closure:
       
  1118   fixes a::real
       
  1119   assumes f: "continuous_on (closure s) f"
       
  1120       and x: "x \<in> closure(s)"
       
  1121       and xlo: "\<And>x. x \<in> s ==> f(x) \<ge> a"
       
  1122     shows "f(x) \<ge> a"
       
  1123   using image_closure_subset [OF f] closed_halfspace_ge [of a "1::real"] assms
       
  1124   by force
       
  1125 
       
  1126 
  1107 
  1127 subsection%unimportant\<open>Some more convenient intermediate-value theorem formulations\<close>
  1108 subsection%unimportant\<open>Some more convenient intermediate-value theorem formulations\<close>
  1128 
  1109 
  1129 lemma connected_ivt_hyperplane:
  1110 lemma connected_ivt_hyperplane:
  1130   assumes "connected S" and xy: "x \<in> S" "y \<in> S" and b: "inner a x \<le> b" "b \<le> inner a y"
  1111   assumes "connected S" and xy: "x \<in> S" "y \<in> S" and b: "inner a x \<le> b" "b \<le> inner a y"
  2257     using dim_subset[OF closure_subset, of s]
  2238     using dim_subset[OF closure_subset, of s]
  2258     by simp
  2239     by simp
  2259 qed
  2240 qed
  2260 
  2241 
  2261 
  2242 
       
  2243 subsection \<open>Set Distance\<close>
       
  2244 
       
  2245 lemma setdist_compact_closed:
       
  2246   fixes S :: "'a::{heine_borel,real_normed_vector} set"
       
  2247   assumes S: "compact S" and T: "closed T"
       
  2248       and "S \<noteq> {}" "T \<noteq> {}"
       
  2249     shows "\<exists>x \<in> S. \<exists>y \<in> T. dist x y = setdist S T"
       
  2250 proof -
       
  2251   have "(\<Union>x\<in> S. \<Union>y \<in> T. {x - y}) \<noteq> {}"
       
  2252     using assms by blast
       
  2253   then have "\<exists>x \<in> S. \<exists>y \<in> T. dist x y \<le> setdist S T"
       
  2254     apply (rule distance_attains_inf [where a=0, OF compact_closed_differences [OF S T]])
       
  2255     apply (simp add: dist_norm le_setdist_iff)
       
  2256     apply blast
       
  2257     done
       
  2258   then show ?thesis
       
  2259     by (blast intro!: antisym [OF _ setdist_le_dist] )
       
  2260 qed
       
  2261 
       
  2262 lemma setdist_closed_compact:
       
  2263   fixes S :: "'a::{heine_borel,real_normed_vector} set"
       
  2264   assumes S: "closed S" and T: "compact T"
       
  2265       and "S \<noteq> {}" "T \<noteq> {}"
       
  2266     shows "\<exists>x \<in> S. \<exists>y \<in> T. dist x y = setdist S T"
       
  2267   using setdist_compact_closed [OF T S \<open>T \<noteq> {}\<close> \<open>S \<noteq> {}\<close>]
       
  2268   by (metis dist_commute setdist_sym)
       
  2269 
       
  2270 lemma setdist_eq_0_compact_closed:
       
  2271   fixes S :: "'a::{heine_borel,real_normed_vector} set"
       
  2272   assumes S: "compact S" and T: "closed T"
       
  2273     shows "setdist S T = 0 \<longleftrightarrow> S = {} \<or> T = {} \<or> S \<inter> T \<noteq> {}"
       
  2274   apply (cases "S = {} \<or> T = {}", force)
       
  2275   using setdist_compact_closed [OF S T]
       
  2276   apply (force intro: setdist_eq_0I )
       
  2277   done
       
  2278 
       
  2279 corollary setdist_gt_0_compact_closed:
       
  2280   fixes S :: "'a::{heine_borel,real_normed_vector} set"
       
  2281   assumes S: "compact S" and T: "closed T"
       
  2282     shows "setdist S T > 0 \<longleftrightarrow> (S \<noteq> {} \<and> T \<noteq> {} \<and> S \<inter> T = {})"
       
  2283   using setdist_pos_le [of S T] setdist_eq_0_compact_closed [OF assms]
       
  2284   by linarith
       
  2285 
       
  2286 lemma setdist_eq_0_closed_compact:
       
  2287   fixes S :: "'a::{heine_borel,real_normed_vector} set"
       
  2288   assumes S: "closed S" and T: "compact T"
       
  2289     shows "setdist S T = 0 \<longleftrightarrow> S = {} \<or> T = {} \<or> S \<inter> T \<noteq> {}"
       
  2290   using setdist_eq_0_compact_closed [OF T S]
       
  2291   by (metis Int_commute setdist_sym)
       
  2292 
       
  2293 lemma setdist_eq_0_bounded:
       
  2294   fixes S :: "'a::{heine_borel,real_normed_vector} set"
       
  2295   assumes "bounded S \<or> bounded T"
       
  2296     shows "setdist S T = 0 \<longleftrightarrow> S = {} \<or> T = {} \<or> closure S \<inter> closure T \<noteq> {}"
       
  2297   apply (cases "S = {} \<or> T = {}", force)
       
  2298   using setdist_eq_0_compact_closed [of "closure S" "closure T"]
       
  2299         setdist_eq_0_closed_compact [of "closure S" "closure T"] assms
       
  2300   apply (force simp add:  bounded_closure compact_eq_bounded_closed)
       
  2301   done
       
  2302 
       
  2303 lemma setdist_eq_0_sing_1:
       
  2304     fixes S :: "'a::{heine_borel,real_normed_vector} set"
       
  2305     shows "setdist {x} S = 0 \<longleftrightarrow> S = {} \<or> x \<in> closure S"
       
  2306   by (auto simp: setdist_eq_0_bounded)
       
  2307 
       
  2308 lemma setdist_eq_0_sing_2:
       
  2309     fixes S :: "'a::{heine_borel,real_normed_vector} set"
       
  2310     shows "setdist S {x} = 0 \<longleftrightarrow> S = {} \<or> x \<in> closure S"
       
  2311   by (auto simp: setdist_eq_0_bounded)
       
  2312 
       
  2313 lemma setdist_neq_0_sing_1:
       
  2314     fixes S :: "'a::{heine_borel,real_normed_vector} set"
       
  2315     shows "\<lbrakk>setdist {x} S = a; a \<noteq> 0\<rbrakk> \<Longrightarrow> S \<noteq> {} \<and> x \<notin> closure S"
       
  2316   by (auto simp: setdist_eq_0_sing_1)
       
  2317 
       
  2318 lemma setdist_neq_0_sing_2:
       
  2319     fixes S :: "'a::{heine_borel,real_normed_vector} set"
       
  2320     shows "\<lbrakk>setdist S {x} = a; a \<noteq> 0\<rbrakk> \<Longrightarrow> S \<noteq> {} \<and> x \<notin> closure S"
       
  2321   by (auto simp: setdist_eq_0_sing_2)
       
  2322 
       
  2323 lemma setdist_sing_in_set:
       
  2324     fixes S :: "'a::{heine_borel,real_normed_vector} set"
       
  2325     shows "x \<in> S \<Longrightarrow> setdist {x} S = 0"
       
  2326   using closure_subset by (auto simp: setdist_eq_0_sing_1)
       
  2327 
       
  2328 lemma setdist_eq_0_closed:
       
  2329   fixes S :: "'a::{heine_borel,real_normed_vector} set"
       
  2330   shows  "closed S \<Longrightarrow> (setdist {x} S = 0 \<longleftrightarrow> S = {} \<or> x \<in> S)"
       
  2331 by (simp add: setdist_eq_0_sing_1)
       
  2332 
       
  2333 lemma setdist_eq_0_closedin:
       
  2334   fixes S :: "'a::{heine_borel,real_normed_vector} set"
       
  2335   shows "\<lbrakk>closedin (subtopology euclidean U) S; x \<in> U\<rbrakk>
       
  2336          \<Longrightarrow> (setdist {x} S = 0 \<longleftrightarrow> S = {} \<or> x \<in> S)"
       
  2337   by (auto simp: closedin_limpt setdist_eq_0_sing_1 closure_def)
       
  2338 
       
  2339 lemma setdist_gt_0_closedin:
       
  2340   fixes S :: "'a::{heine_borel,real_normed_vector} set"
       
  2341   shows "\<lbrakk>closedin (subtopology euclidean U) S; x \<in> U; S \<noteq> {}; x \<notin> S\<rbrakk>
       
  2342          \<Longrightarrow> setdist {x} S > 0"
       
  2343   using less_eq_real_def setdist_eq_0_closedin by fastforce
       
  2344 
  2262 no_notation
  2345 no_notation
  2263   eucl_less (infix "<e" 50)
  2346   eucl_less (infix "<e" 50)
  2264 
  2347 
  2265 end
  2348 end