# HG changeset patch # User hoelzl # Date 1358422014 -3600 # Node ID a7c273a83d2783d550e65eaf15f310af002483ef # Parent ae7cd20ed118f4e063f40f0754ee6299617a3c20 group compactness-eq-seq-compactness lemmas together diff -r ae7cd20ed118 -r a7c273a83d27 src/HOL/Multivariate_Analysis/Topology_Euclidean_Space.thy --- a/src/HOL/Multivariate_Analysis/Topology_Euclidean_Space.thy Thu Jan 17 12:21:24 2013 +0100 +++ b/src/HOL/Multivariate_Analysis/Topology_Euclidean_Space.thy Thu Jan 17 12:26:54 2013 +0100 @@ -2992,6 +2992,122 @@ thus ?thesis unfolding seq_compact_def by auto qed +subsubsection{* Total boundedness *} + +lemma cauchy_def: + "Cauchy s \ (\e>0. \N. \m n. m \ N \ n \ N --> dist(s m)(s n) < e)" +unfolding Cauchy_def by blast + +fun helper_1::"('a::metric_space set) \ real \ nat \ 'a" where + "helper_1 s e n = (SOME y::'a. y \ s \ (\m (dist (helper_1 s e m) y < e)))" +declare helper_1.simps[simp del] + +lemma seq_compact_imp_totally_bounded: + assumes "seq_compact s" + shows "\e>0. \k. finite k \ k \ s \ s \ (\((\x. ball x e) ` k))" +proof(rule, rule, rule ccontr) + fix e::real assume "e>0" and assm:"\ (\k. finite k \ k \ s \ s \ \(\x. ball x e) ` k)" + def x \ "helper_1 s e" + { fix n + have "x n \ s \ (\m dist (x m) (x n) < e)" + proof(induct_tac rule:nat_less_induct) + fix n def Q \ "(\y. y \ s \ (\m dist (x m) y < e))" + assume as:"\m s \ (\ma dist (x ma) (x m) < e)" + have "\ s \ (\x\x ` {0..s" "z \ (\x\x ` {0.. s \ (\m dist (x m) (x n) < e)" unfolding Q_def by auto + qed } + hence "\n::nat. x n \ s" and x:"\n. \m < n. \ (dist (x m) (x n) < e)" by blast+ + then obtain l r where "l\s" and r:"subseq r" and "((x \ r) ---> l) sequentially" using assms(1)[unfolded seq_compact_def, THEN spec[where x=x]] by auto + from this(3) have "Cauchy (x \ r)" using LIMSEQ_imp_Cauchy by auto + then obtain N::nat where N:"\m n. N \ m \ N \ n \ dist ((x \ r) m) ((x \ r) n) < e" unfolding cauchy_def using `e>0` by auto + show False + using N[THEN spec[where x=N], THEN spec[where x="N+1"]] + using r[unfolded subseq_def, THEN spec[where x=N], THEN spec[where x="N+1"]] + using x[THEN spec[where x="r (N+1)"], THEN spec[where x="r (N)"]] by auto +qed + +subsubsection{* Heine-Borel theorem *} + +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 +qed + +lemma compact_eq_seq_compact_metric: + "compact (s :: 'a::metric_space set) \ seq_compact s" + using compact_imp_seq_compact seq_compact_imp_heine_borel by blast + +lemma compact_def: + "compact (S :: 'a::metric_space set) \ + (\f. (\n. f n \ S) \ + (\l\S. \r. subseq r \ ((f o r) ---> l) sequentially)) " + unfolding compact_eq_seq_compact_metric seq_compact_def by auto + text {* A metric space (or topological vector space) is said to have the Heine-Borel property if every closed and bounded subset is compact. @@ -3214,10 +3330,6 @@ subsubsection{* Completeness *} -lemma cauchy_def: - "Cauchy s \ (\e>0. \N. \m n. m \ N \ n \ N --> dist(s m)(s n) < e)" -unfolding Cauchy_def by blast - definition complete :: "'a::metric_space set \ bool" where "complete s \ (\f. (\n. f n \ s) \ Cauchy f @@ -3344,108 +3456,6 @@ shows "(s ---> l) sequentially \ bounded (range s)" by (intro cauchy_imp_bounded LIMSEQ_imp_Cauchy) -subsubsection{* Total boundedness *} - -fun helper_1::"('a::metric_space set) \ real \ nat \ 'a" where - "helper_1 s e n = (SOME y::'a. y \ s \ (\m (dist (helper_1 s e m) y < e)))" -declare helper_1.simps[simp del] - -lemma seq_compact_imp_totally_bounded: - assumes "seq_compact s" - shows "\e>0. \k. finite k \ k \ s \ s \ (\((\x. ball x e) ` k))" -proof(rule, rule, rule ccontr) - fix e::real assume "e>0" and assm:"\ (\k. finite k \ k \ s \ s \ \(\x. ball x e) ` k)" - def x \ "helper_1 s e" - { fix n - have "x n \ s \ (\m dist (x m) (x n) < e)" - proof(induct_tac rule:nat_less_induct) - fix n def Q \ "(\y. y \ s \ (\m dist (x m) y < e))" - assume as:"\m s \ (\ma dist (x ma) (x m) < e)" - have "\ s \ (\x\x ` {0..s" "z \ (\x\x ` {0.. s \ (\m dist (x m) (x n) < e)" unfolding Q_def by auto - qed } - hence "\n::nat. x n \ s" and x:"\n. \m < n. \ (dist (x m) (x n) < e)" by blast+ - then obtain l r where "l\s" and r:"subseq r" and "((x \ r) ---> l) sequentially" using assms(1)[unfolded seq_compact_def, THEN spec[where x=x]] by auto - from this(3) have "Cauchy (x \ r)" using LIMSEQ_imp_Cauchy by auto - then obtain N::nat where N:"\m n. N \ m \ N \ n \ dist ((x \ r) m) ((x \ r) n) < e" unfolding cauchy_def using `e>0` by auto - show False - using N[THEN spec[where x=N], THEN spec[where x="N+1"]] - using r[unfolded subseq_def, THEN spec[where x=N], THEN spec[where x="N+1"]] - using x[THEN spec[where x="r (N+1)"], THEN spec[where x="r (N)"]] by auto -qed - -subsubsection{* Heine-Borel theorem *} - -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 -qed - subsubsection {* Complete the chain of compactness variants *} primrec helper_2::"(real \ 'a::metric_space) \ nat \ 'a" where @@ -3514,16 +3524,6 @@ text {* Hence express everything as an equivalence. *} -lemma compact_eq_seq_compact_metric: - "compact (s :: 'a::metric_space set) \ seq_compact s" - using compact_imp_seq_compact seq_compact_imp_heine_borel by blast - -lemma compact_def: - "compact (S :: 'a::metric_space set) \ - (\f. (\n. f n \ S) \ - (\l\S. \r. subseq r \ ((f o r) ---> l) sequentially)) " - unfolding compact_eq_seq_compact_metric seq_compact_def by auto - lemma compact_eq_bolzano_weierstrass: fixes s :: "'a::metric_space set" shows "compact s \ (\t. infinite t \ t \ s --> (\x \ s. x islimpt t))" (is "?lhs = ?rhs")