# HG changeset patch # User hoelzl # Date 1358427482 -3600 # Node ID 88a00a1c7c2ca444f8ccd559f4665a411700c848 # Parent 1aa1a7991fd924f07dd7eaa6f866ba205bf1888f use accumulation point characterization (avoids t1_space restriction for equivalence of countable and sequential compactness); remove heine_borel_lemma diff -r 1aa1a7991fd9 -r 88a00a1c7c2c src/HOL/Multivariate_Analysis/Topology_Euclidean_Space.thy --- a/src/HOL/Multivariate_Analysis/Topology_Euclidean_Space.thy Thu Jan 17 13:21:34 2013 +0100 +++ b/src/HOL/Multivariate_Analysis/Topology_Euclidean_Space.thy Thu Jan 17 13:58:02 2013 +0100 @@ -17,6 +17,9 @@ Norm_Arith begin +lemma dist_double: "dist x y < d / 2 \ dist x z < d / 2 \ dist y z < d" + using dist_triangle[of y z x] by (simp add: dist_commute) + (* TODO: Move this to RComplete.thy -- would need to include Glb into RComplete *) lemma real_isGlb_unique: "[| isGlb R S x; isGlb R S y |] ==> x = (y::real)" apply (frule isGlb_isLb) @@ -2373,25 +2376,23 @@ ultimately show False using g(2) using finite_subset by auto qed -lemma islimpt_range_imp_convergent_subsequence: - fixes l :: "'a :: {t1_space, first_countable_topology}" - assumes l: "l islimpt (range f)" - shows "\r. subseq r \ ((f \ r) ---> l) sequentially" +lemma acc_point_range_imp_convergent_subsequence: + fixes l :: "'a :: first_countable_topology" + assumes l: "\U. l\U \ open U \ infinite (U \ range f)" + shows "\r. subseq r \ (f \ r) ----> l" proof - - from first_countable_topology_class.countable_basis_at_decseq[of l] guess A . note A = this + from countable_basis_at_decseq[of l] guess A . note A = this def s \ "\n i. SOME j. i < j \ f j \ A (Suc n)" { fix n i - have "\a. i < a \ f a \ A (Suc n) - (f ` {.. i} - {l})" (is "\a. _ \ _ \ ?A") - apply (rule l[THEN islimptE, of "?A"]) - using A(2) apply fastforce - using A(1) - apply (intro open_Diff finite_imp_closed) - apply auto - apply (rule_tac x=x in exI) - apply auto - done - then have "\a. i < a \ f a \ A (Suc n)" by blast + have "infinite (A (Suc n) \ range f - f`{.. i})" + using l A by auto + then have "\x. x \ A (Suc n) \ range f - f`{.. i}" + unfolding ex_in_conv by (intro notI) simp + then have "\j. f j \ A (Suc n) \ j \ {.. i}" + by auto + then have "\a. i < a \ f a \ A (Suc n)" + by (auto simp: not_le) then have "i < s n i" "f (s n i) \ A (Suc n)" unfolding s_def by (auto intro: someI2_ex) } note s = this @@ -2475,6 +2476,31 @@ shows "finite s \ x islimpt (s \ t) \ x islimpt t" by (simp add: islimpt_Un islimpt_finite) +lemma islimpt_eq_acc_point: + fixes l :: "'a :: t1_space" + shows "l islimpt S \ (\U. l\U \ open U \ infinite (U \ S))" +proof (safe intro!: islimptI) + fix U assume "l islimpt S" "l \ U" "open U" "finite (U \ S)" + then have "l islimpt S" "l \ (U - (U \ S - {l}))" "open (U - (U \ S - {l}))" + by (auto intro: finite_imp_closed) + then show False + by (rule islimptE) auto +next + fix T assume *: "\U. l\U \ open U \ infinite (U \ S)" "l \ T" "open T" + then have "infinite (T \ S - {l})" by auto + then have "\x. x \ (T \ S - {l})" + unfolding ex_in_conv by (intro notI) simp + then show "\y\S. y \ T \ y \ l" + by auto +qed + +lemma islimpt_range_imp_convergent_subsequence: + fixes l :: "'a :: {t1_space, first_countable_topology}" + assumes l: "l islimpt (range f)" + shows "\r. subseq r \ (f \ r) ----> l" + using l unfolding islimpt_eq_acc_point + by (rule acc_point_range_imp_convergent_subsequence) + lemma sequence_unique_limpt: fixes f :: "nat \ 'a::t2_space" assumes "(f ---> l) sequentially" and "l' islimpt (range f)" @@ -2837,6 +2863,10 @@ then show "\b\SOME B. countable B \ topological_basis B. x \ b \ b \ U \ T" by auto qed (insert countable_basis topological_basis_open[OF is_basis], auto) +lemma countably_compact_eq_compact: + "countably_compact U \ compact (U :: 'a :: second_countable_topology set)" + using countably_compact_imp_compact_second_countable compact_imp_countably_compact by blast + subsubsection{* Sequential compactness *} definition @@ -2937,12 +2967,6 @@ using `x \ U` by (auto simp: convergent_def comp_def) qed -lemma seq_compact_eq_compact: - fixes U :: "'a :: second_countable_topology set" - shows "seq_compact U \ compact U" - using compact_imp_seq_compact seq_compact_imp_countably_compact countably_compact_imp_compact_second_countable - by blast - lemma seq_compactI: assumes "\f. \n. f n \ S \ \l\S. \r. subseq r \ ((f o r) ---> l) sequentially" shows "seq_compact S" @@ -2953,13 +2977,45 @@ obtains l r where "l \ S" "subseq r" "((f \ r) ---> l) sequentially" using assms unfolding seq_compact_def by fast -lemma bolzano_weierstrass_imp_seq_compact: - fixes s :: "'a::{t1_space, first_countable_topology} set" - assumes "\t. infinite t \ t \ s --> (\x \ s. x islimpt t)" +lemma countably_compact_imp_acc_point: + assumes "countably_compact s" "countable t" "infinite t" "t \ s" + shows "\x\s. \U. x\U \ open U \ infinite (U \ t)" +proof (rule ccontr) + def C \ "(\F. interior (F \ (- t))) ` {F. finite F \ F \ t }" + note `countably_compact s` + moreover have "\t\C. open t" + by (auto simp: C_def) + moreover + assume "\ (\x\s. \U. x\U \ open U \ infinite (U \ t))" + then have s: "\x. x \ s \ \U. x\U \ open U \ finite (U \ t)" by metis + have "s \ \C" + using `t \ s` + unfolding C_def Union_image_eq + apply (safe dest!: s) + apply (rule_tac a="U \ t" in UN_I) + apply (auto intro!: interiorI simp add: finite_subset) + done + moreover + from `countable t` have "countable C" + unfolding C_def by (auto intro: countable_Collect_finite_subset) + ultimately guess D by (rule countably_compactE) + then obtain E where E: "E \ {F. finite F \ F \ t }" "finite E" and + s: "s \ (\F\E. interior (F \ (- t)))" + by (metis (lifting) Union_image_eq finite_subset_image C_def) + from s `t \ s` have "t \ \E" + using interior_subset by blast + moreover have "finite (\E)" + using E by auto + ultimately show False using `infinite t` by (auto simp: finite_subset) +qed + +lemma countable_acc_point_imp_seq_compact: + fixes s :: "'a::first_countable_topology set" + assumes "\t. infinite t \ countable t \ t \ s --> (\x\s. \U. x\U \ open U \ infinite (U \ t))" shows "seq_compact s" proof - { fix f :: "nat \ 'a" assume f: "\n. f n \ s" - have "\l\s. \r. subseq r \ (f \ r) ----> l" + have "\l\s. \r. subseq r \ ((f \ r) ---> l) sequentially" proof (cases "finite (range f)") case True obtain l where "infinite {n. f n = f l}" @@ -2972,17 +3028,44 @@ by auto next case False - with f assms have "\x\s. x islimpt (range f)" by auto - then obtain l where "l \ s" "l islimpt (range f)" .. - have "\r. subseq r \ (f \ r) ----> l" - using `l islimpt (range f)` - by (rule islimpt_range_imp_convergent_subsequence) - with `l \ s` show "\l\s. \r. subseq r \ (f \ r) ----> l" .. + with f assms have "\x\s. \U. x\U \ open U \ infinite (U \ range f)" by auto + then obtain l where "l \ s" "\U. l\U \ open U \ infinite (U \ range f)" .. + from this(2) have "\r. subseq r \ ((f \ r) ---> l) sequentially" + using acc_point_range_imp_convergent_subsequence[of l f] by auto + with `l \ s` show "\l\s. \r. subseq r \ ((f \ r) ---> l) sequentially" .. qed } thus ?thesis unfolding seq_compact_def by auto qed +lemma seq_compact_eq_countably_compact: + fixes U :: "'a :: first_countable_topology set" + shows "seq_compact U \ countably_compact U" + using + countable_acc_point_imp_seq_compact + countably_compact_imp_acc_point + seq_compact_imp_countably_compact + by metis + +lemma seq_compact_eq_acc_point: + fixes s :: "'a :: first_countable_topology set" + shows "seq_compact s \ (\t. infinite t \ countable t \ t \ s --> (\x\s. \U. x\U \ open U \ infinite (U \ t)))" + using + countable_acc_point_imp_seq_compact[of s] + countably_compact_imp_acc_point[of s] + seq_compact_imp_countably_compact[of s] + by metis + +lemma seq_compact_eq_compact: + fixes U :: "'a :: second_countable_topology set" + shows "seq_compact U \ compact U" + using seq_compact_eq_countably_compact countably_compact_eq_compact by blast + +lemma bolzano_weierstrass_imp_seq_compact: + fixes s :: "'a::{t1_space, first_countable_topology} set" + shows "\t. infinite t \ t \ s --> (\x \ s. x islimpt t) \ seq_compact s" + by (rule countable_acc_point_imp_seq_compact) (metis islimpt_eq_acc_point) + subsubsection{* Total boundedness *} lemma cauchy_def: @@ -3024,69 +3107,38 @@ text {* Following Burkill \& Burkill vol. 2. *} -lemma heine_borel_lemma: fixes s::"'a::metric_space set" - assumes "seq_compact s" "s \ (\ t)" "\b \ t. open b" - shows "\e>0. \x \ s. \b \ t. ball x e \ b" -proof(rule ccontr) - assume "\ (\e>0. \x\s. \b\t. ball x e \ b)" - hence cont:"\e>0. \x\s. \xa\t. \ (ball x e \ xa)" by auto - { fix n::nat - have "1 / real (n + 1) > 0" by auto - hence "\x. x\s \ (\xa\t. \ (ball x (inverse (real (n+1))) \ xa))" using cont unfolding Bex_def by auto } - hence "\n::nat. \x. x \ s \ (\xa\t. \ ball x (inverse (real (n + 1))) \ xa)" by auto - then obtain f where f:"\n::nat. f n \ s \ (\xa\t. \ ball (f n) (inverse (real (n + 1))) \ xa)" - using choice[of "\n::nat. \x. x\s \ (\xa\t. \ ball x (inverse (real (n + 1))) \ xa)"] by auto - - then obtain l r where l:"l\s" and r:"subseq r" and lr:"((f \ r) ---> l) sequentially" - using assms(1)[unfolded seq_compact_def, THEN spec[where x=f]] by auto - - obtain b where "l\b" "b\t" using assms(2) and l by auto - then obtain e where "e>0" and e:"\z. dist z l < e \ z\b" - using assms(3)[THEN bspec[where x=b]] unfolding open_dist by auto - - then obtain N1 where N1:"\n\N1. dist ((f \ r) n) l < e / 2" - using lr[unfolded LIMSEQ_def, THEN spec[where x="e/2"]] by auto - - obtain N2::nat where N2:"N2>0" "inverse (real N2) < e /2" using real_arch_inv[of "e/2"] and `e>0` by auto - have N2':"inverse (real (r (N1 + N2) +1 )) < e/2" - apply(rule order_less_trans) apply(rule less_imp_inverse_less) using N2 - using seq_suble[OF r, of "N1 + N2"] by auto - - def x \ "(f (r (N1 + N2)))" - have x:"\ ball x (inverse (real (r (N1 + N2) + 1))) \ b" unfolding x_def - using f[THEN spec[where x="r (N1 + N2)"]] using `b\t` by auto - have "\y\ball x (inverse (real (r (N1 + N2) + 1))). y\b" apply(rule ccontr) using x by auto - then obtain y where y:"y \ ball x (inverse (real (r (N1 + N2) + 1)))" "y \ b" by auto - - have "dist x l < e/2" using N1 unfolding x_def o_def by auto - hence "dist y l < e" using y N2' using dist_triangle[of y l x]by (auto simp add:dist_commute) - - thus False using e and `y\b` by auto -qed - lemma seq_compact_imp_heine_borel: fixes s :: "'a :: metric_space set" - shows "seq_compact s \ compact s" - unfolding compact_eq_heine_borel -proof clarify - fix f assume "seq_compact s" " \t\f. open t" "s \ \f" - then obtain e::real where "e>0" and "\x\s. \b\f. ball x e \ b" using heine_borel_lemma[of s f] by auto - hence "\x\s. \b. b\f \ ball x e \ b" by auto - hence "\bb. \x\s. bb x \f \ ball x e \ bb x" using bchoice[of s "\x b. b\f \ ball x e \ b"] by auto - then obtain bb where bb:"\x\s. (bb x) \ f \ ball x e \ (bb x)" by blast - - from `seq_compact s` have "\ k. finite k \ k \ s \ s \ \(\x. ball x e) ` k" - using seq_compact_imp_totally_bounded[of s] `e>0` by auto - then obtain k where k:"finite k" "k \ s" "s \ \(\x. ball x e) ` k" by auto - - have "finite (bb ` k)" using k(1) by auto - moreover - { fix x assume "x\s" - hence "x\\(\x. ball x e) ` k" using k(3) unfolding subset_eq by auto - hence "\X\bb ` k. x \ X" using bb k(2) by blast - hence "x \ \(bb ` k)" using Union_iff[of x "bb ` k"] by auto - } - ultimately show "\f'\f. finite f' \ s \ \f'" using bb k(2) by (rule_tac x="bb ` k" in exI) auto + assumes "seq_compact s" shows "compact s" +proof - + from seq_compact_imp_totally_bounded[OF `seq_compact s`] + guess f unfolding choice_iff' .. note f = this + def K \ "(\(x, r). ball x r) ` ((\e \ \ \ {0 <..}. f e) \ \)" + have "countably_compact s" + using `seq_compact s` by (rule seq_compact_imp_countably_compact) + then show "compact s" + proof (rule countably_compact_imp_compact) + show "countable K" + unfolding K_def using f + by (auto intro: countable_finite countable_subset countable_rat + intro!: countable_image countable_SIGMA countable_UN) + show "\b\K. open b" by (auto simp: K_def) + next + fix T x assume T: "open T" "x \ T" and x: "x \ s" + from openE[OF T] obtain e where "0 < e" "ball x e \ T" by auto + then have "0 < e / 2" "ball x (e / 2) \ T" by auto + from Rats_dense_in_real[OF `0 < e / 2`] obtain r where "r \ \" "0 < r" "r < e / 2" by auto + from f[rule_format, of r] `0 < r` `x \ s` obtain k where "k \ f r" "x \ ball k r" + unfolding Union_image_eq by auto + from `r \ \` `0 < r` `k \ f r` have "ball k r \ K" by (auto simp: K_def) + then show "\b\K. x \ b \ b \ s \ T" + proof (rule bexI[rotated], safe) + fix y assume "y \ ball k r" + with `r < e / 2` `x \ ball k r` have "dist x y < e" + by (intro dist_double[where x = k and d=e]) (auto simp: dist_commute) + with `ball x e \ T` show "y \ T" by auto + qed (rule `x \ ball k r`) + qed qed lemma compact_eq_seq_compact_metric: @@ -3095,8 +3147,7 @@ lemma compact_def: "compact (S :: 'a::metric_space set) \ - (\f. (\n. f n \ S) \ - (\l\S. \r. subseq r \ ((f o r) ---> l) sequentially)) " + (\f. (\n. f n \ S) \ (\l\S. \r. subseq r \ (f o r) ----> l))" unfolding compact_eq_seq_compact_metric seq_compact_def by auto text {* @@ -4879,41 +4930,42 @@ qed text {* Continuity implies uniform continuity on a compact domain. *} - + lemma compact_uniformly_continuous: - assumes "continuous_on s f" "compact s" + assumes f: "continuous_on s f" and s: "compact s" shows "uniformly_continuous_on s f" -proof- - { fix x assume x:"x\s" - hence "\xa. \y. 0 < xa \ (y > 0 \ (\x'\s. dist x' x < y \ dist (f x') (f x) < xa))" using assms(1)[unfolded continuous_on_iff, THEN bspec[where x=x]] by auto - hence "\fa. \xa>0. \x'\s. fa xa > 0 \ (dist x' x < fa xa \ dist (f x') (f x) < xa)" using choice[of "\e d. e>0 \ d>0 \(\x'\s. (dist x' x < d \ dist (f x') (f x) < e))"] by auto } - then have "\x\s. \y. \xa. 0 < xa \ (\x'\s. y xa > 0 \ (dist x' x < y xa \ dist (f x') (f x) < xa))" by auto - then obtain d where d:"\e>0. \x\s. \x'\s. d x e > 0 \ (dist x' x < d x e \ dist (f x') (f x) < e)" - using bchoice[of s "\x fa. \xa>0. \x'\s. fa xa > 0 \ (dist x' x < fa xa \ dist (f x') (f x) < xa)"] by blast - - { fix e::real assume "e>0" - - { fix x assume "x\s" hence "x \ ball x (d x (e / 2))" unfolding centre_in_ball using d[THEN spec[where x="e/2"]] using `e>0` by auto } - hence "s \ \{ball x (d x (e / 2)) |x. x \ s}" unfolding subset_eq by auto - moreover - { fix b assume "b\{ball x (d x (e / 2)) |x. x \ s}" hence "open b" by auto } - ultimately obtain ea where "ea>0" and ea:"\x\s. \b\{ball x (d x (e / 2)) |x. x \ s}. ball x ea \ b" - using heine_borel_lemma[OF assms(2)[unfolded compact_eq_seq_compact_metric], of "{ball x (d x (e / 2)) | x. x\s }"] by auto - - { fix x y assume "x\s" "y\s" and as:"dist y x < ea" - obtain z where "z\s" and z:"ball x ea \ ball z (d z (e / 2))" using ea[THEN bspec[where x=x]] and `x\s` by auto - hence "x\ball z (d z (e / 2))" using `ea>0` unfolding subset_eq by auto - hence "dist (f z) (f x) < e / 2" using d[THEN spec[where x="e/2"]] and `e>0` and `x\s` and `z\s` - by (auto simp add: dist_commute) - moreover have "y\ball z (d z (e / 2))" using as and `ea>0` and z[unfolded subset_eq] - by (auto simp add: dist_commute) - hence "dist (f z) (f y) < e / 2" using d[THEN spec[where x="e/2"]] and `e>0` and `y\s` and `z\s` - by (auto simp add: dist_commute) - ultimately have "dist (f y) (f x) < e" using dist_triangle_half_r[of "f z" "f x" e "f y"] - by (auto simp add: dist_commute) } - then have "\d>0. \x\s. \x'\s. dist x' x < d \ dist (f x') (f x) < e" using `ea>0` by auto } - thus ?thesis unfolding uniformly_continuous_on_def by auto -qed + unfolding uniformly_continuous_on_def +proof (cases, safe) + fix e :: real assume "0 < e" "s \ {}" + def [simp]: R \ "{(y, d). y \ s \ 0 < d \ ball y d \ s \ {x \ s. f x \ ball (f y) (e/2) } }" + let ?C = "(\(y, d). ball y (d/2)) ` R" + have "(\r\?C. open r) \ s \ \?C" + proof safe + fix y assume "y \ s" + from continuous_open_in_preimage[OF f open_ball] + obtain T where "open T" and T: "{x \ s. f x \ ball (f y) (e/2)} = T \ s" + unfolding openin_subtopology open_openin by metis + then obtain d where "ball y d \ T" "0 < d" + using `0 < e` `y \ s` by (auto elim!: openE) + with T `y \ s` show "y \ \(\(y, d). ball y (d/2)) ` R" + by (intro UnionI[where X="ball y (d/2)"]) auto + qed auto + then obtain D where D: "finite D" "D \ R" "s \ (\(y, d)\D. ball y (d/2))" + by (metis (lifting) finite_subset_image compact_eq_heine_borel[of s] s Union_image_eq) + with `s \ {}` have [simp]: "\x. x < Min (snd ` D) \ (\(y, d)\D. x < d)" + by (subst Min_gr_iff) auto + show "\d>0. \x\s. \x'\s. dist x' x < d \ dist (f x') (f x) < e" + proof (rule, safe) + fix x x' assume in_s: "x' \ s" "x \ s" + with D obtain y d where x: "x \ ball y (d/2)" "(y, d) \ D" + by blast + moreover assume "dist x x' < Min (snd`D) / 2" + ultimately have "dist y x' < d" + by (intro dist_double[where x=x and d=d]) (auto simp: dist_commute) + with D x in_s show "dist (f x) (f x') < e" + by (intro dist_double[where x="f y" and d=e]) (auto simp: dist_commute subset_eq) + qed (insert D, auto) +qed auto text{* Continuity of inverse function on compact domain. *}