# HG changeset patch # User hoelzl # Date 1359628282 -3600 # Node ID 501200635659a5c40d23013881270256310d44c4 # Parent 31f9ba85dc2e990e57022103d25bbba3b8d0ce99 simplify heine_borel type class diff -r 31f9ba85dc2e -r 501200635659 src/HOL/Multivariate_Analysis/Cartesian_Euclidean_Space.thy --- a/src/HOL/Multivariate_Analysis/Cartesian_Euclidean_Space.thy Thu Jan 31 11:20:12 2013 +0100 +++ b/src/HOL/Multivariate_Analysis/Cartesian_Euclidean_Space.thy Thu Jan 31 11:31:22 2013 +0100 @@ -1,4 +1,3 @@ - header {*Instanciates the finite cartesian product of euclidean spaces as a euclidean space.*} theory Cartesian_Euclidean_Space @@ -828,7 +827,7 @@ lemma compact_lemma_cart: fixes f :: "nat \ 'a::heine_borel ^ 'n" - assumes "bounded s" and "\n. f n \ s" + assumes f: "bounded (range f)" shows "\d. \l r. subseq r \ (\e>0. eventually (\n. \i\d. dist (f (r n) $ i) (l $ i) < e) sequentially)" @@ -842,16 +841,17 @@ thus ?case unfolding subseq_def by auto next case (insert k d) - have s': "bounded ((\x. x $ k) ` s)" - using `bounded s` by (rule bounded_component_cart) obtain l1::"'a^'n" and r1 where r1:"subseq r1" and lr1:"\e>0. eventually (\n. \i\d. dist (f (r1 n) $ i) (l1 $ i) < e) sequentially" using insert(3) by auto - have f': "\n. f (r1 n) $ k \ (\x. x $ k) ` s" - using `\n. f n \ s` by simp - obtain l2 r2 where r2: "subseq r2" + have s': "bounded ((\x. x $ k) ` range f)" using `bounded (range f)` + by (auto intro!: bounded_component_cart) + have f': "\n. f (r1 n) $ k \ (\x. x $ k) ` range f" by simp + have "bounded (range (\i. f (r1 i) $ k))" + by (metis (lifting) bounded_subset image_subsetI f' s') + then obtain l2 r2 where r2: "subseq r2" and lr2: "((\i. f (r1 (r2 i)) $ k) ---> l2) sequentially" - using bounded_imp_convergent_subsequence[OF s' f'] unfolding o_def by auto + using bounded_imp_convergent_subsequence[of "\i. f (r1 i) $ k"] by (auto simp: o_def) def r \ "r1 \ r2" have r: "subseq r" using r1 and r2 unfolding r_def o_def subseq_def by auto @@ -873,11 +873,11 @@ instance vec :: (heine_borel, finite) heine_borel proof - fix s :: "('a ^ 'b) set" and f :: "nat \ 'a ^ 'b" - assume s: "bounded s" and f: "\n. f n \ s" + fix f :: "nat \ 'a ^ 'b" + assume f: "bounded (range f)" then obtain l r where r: "subseq r" and l: "\e>0. eventually (\n. \i\UNIV. dist (f (r n) $ i) (l $ i) < e) sequentially" - using compact_lemma_cart [OF s f] by blast + using compact_lemma_cart [OF f] by blast let ?d = "UNIV::'b set" { fix e::real assume "e>0" hence "0 < e / (real_of_nat (card ?d))" diff -r 31f9ba85dc2e -r 501200635659 src/HOL/Multivariate_Analysis/Topology_Euclidean_Space.thy --- a/src/HOL/Multivariate_Analysis/Topology_Euclidean_Space.thy Thu Jan 31 11:20:12 2013 +0100 +++ b/src/HOL/Multivariate_Analysis/Topology_Euclidean_Space.thy Thu Jan 31 11:31:22 2013 +0100 @@ -47,6 +47,17 @@ definition "topological_basis B = ((\b\B. open b) \ (\x. open x \ (\B'. B' \ B \ Union B' = x)))" +lemma "topological_basis B = (\x. open x \ (\B'. B' \ B \ Union B' = x))" + unfolding topological_basis_def + apply safe + apply fastforce + apply fastforce + apply (erule_tac x="x" in allE) + apply simp + apply (rule_tac x="{x}" in exI) + apply auto + done + lemma topological_basis_iff: assumes "\B'. B' \ B \ open B'" shows "topological_basis B \ (\O'. open O' \ (\x\O'. \B'\B. x \ B' \ B' \ O'))" @@ -2143,6 +2154,9 @@ bounded :: "'a set \ bool" where "bounded S \ (\x e. \y\S. dist x y \ e)" +lemma bounded_subset_cball: "bounded S \ (\e x. S \ cball x e)" + unfolding bounded_def subset_eq by auto + lemma bounded_any_center: "bounded S \ (\e. \y\S. dist a y \ e)" unfolding bounded_def apply safe @@ -3202,16 +3216,16 @@ class heine_borel = metric_space + assumes bounded_imp_convergent_subsequence: - "bounded s \ \n. f n \ s - \ \l r. subseq r \ ((f \ r) ---> l) sequentially" + "bounded (range f) \ \l r. subseq r \ ((f \ r) ---> l) sequentially" lemma bounded_closed_imp_seq_compact: fixes s::"'a::heine_borel set" assumes "bounded s" and "closed s" shows "seq_compact s" proof (unfold seq_compact_def, clarify) fix f :: "nat \ 'a" assume f: "\n. f n \ s" + with `bounded s` have "bounded (range f)" by (auto intro: bounded_subset) obtain l r where r: "subseq r" and l: "((f \ r) ---> l) sequentially" - using bounded_imp_convergent_subsequence [OF `bounded s` `\n. f n \ s`] by auto + using bounded_imp_convergent_subsequence [OF `bounded (range f)`] by auto from f have fr: "\n. (f \ r) n \ s" by simp have "l \ s" using `closed s` fr l unfolding closed_sequential_limits by blast @@ -3239,20 +3253,20 @@ instance real :: heine_borel proof - fix s :: "real set" and f :: "nat \ real" - assume s: "bounded s" and f: "\n. f n \ s" + fix f :: "nat \ real" + assume f: "bounded (range f)" obtain r where r: "subseq r" "monoseq (f \ r)" unfolding comp_def by (metis seq_monosub) moreover then have "Bseq (f \ r)" - unfolding Bseq_eq_bounded using s f by (auto intro: bounded_subset) + unfolding Bseq_eq_bounded using f by (auto intro: bounded_subset) ultimately show "\l r. subseq r \ (f \ r) ----> l" using Bseq_monoseq_convergent[of "f \ r"] by (auto simp: convergent_def) qed lemma compact_lemma: fixes f :: "nat \ 'a::euclidean_space" - assumes "bounded s" and "\n. f n \ s" + assumes "bounded (range f)" shows "\d\Basis. \l::'a. \ r. subseq r \ (\e>0. eventually (\n. \i\d. dist (f (r n) \ i) (l \ i) < e) sequentially)" proof safe @@ -3262,14 +3276,16 @@ (\e>0. eventually (\n. \i\d. dist (f (r n) \ i) (l \ i) < e) sequentially)" proof(induct d) case empty thus ?case unfolding subseq_def by auto next case (insert k d) have k[intro]:"k\Basis" using insert by auto - have s': "bounded ((\x. x \ k) ` s)" using `bounded s` + have s': "bounded ((\x. x \ k) ` range f)" using `bounded (range f)` by (auto intro!: bounded_linear_image bounded_linear_inner_left) obtain l1::"'a" and r1 where r1:"subseq r1" and lr1:"\e>0. eventually (\n. \i\d. dist (f (r1 n) \ i) (l1 \ i) < e) sequentially" using insert(3) using insert(4) by auto - have f': "\n. f (r1 n) \ k \ (\x. x \ k) ` s" using `\n. f n \ s` by simp - obtain l2 r2 where r2:"subseq r2" and lr2:"((\i. f (r1 (r2 i)) \ k) ---> l2) sequentially" - using bounded_imp_convergent_subsequence[OF s' f'] unfolding o_def by auto + have f': "\n. f (r1 n) \ k \ (\x. x \ k) ` range f" by simp + have "bounded (range (\i. f (r1 i) \ k))" + by (metis (lifting) bounded_subset f' image_subsetI s') + then obtain l2 r2 where r2:"subseq r2" and lr2:"((\i. f (r1 (r2 i)) \ k) ---> l2) sequentially" + using bounded_imp_convergent_subsequence[of "\i. f (r1 i) \ k"] by (auto simp: o_def) def r \ "r1 \ r2" have r:"subseq r" using r1 and r2 unfolding r_def o_def subseq_def by auto moreover @@ -3289,11 +3305,11 @@ instance euclidean_space \ heine_borel proof - fix s :: "'a set" and f :: "nat \ 'a" - assume s: "bounded s" and f: "\n. f n \ s" + fix f :: "nat \ 'a" + assume f: "bounded (range f)" then obtain l::'a and r where r: "subseq r" and l: "\e>0. eventually (\n. \i\Basis. dist (f (r n) \ i) (l \ i) < e) sequentially" - using compact_lemma [OF s f] by blast + using compact_lemma [OF f] by blast { fix e::real assume "e>0" hence "0 < e / real_of_nat DIM('a)" by (auto intro!: divide_pos_pos DIM_positive) with l have "eventually (\n. \i\Basis. dist (f (r n) \ i) (l \ i) < e / (real_of_nat DIM('a))) sequentially" @@ -3338,19 +3354,16 @@ instance prod :: (heine_borel, heine_borel) heine_borel proof - fix s :: "('a * 'b) set" and f :: "nat \ 'a * 'b" - assume s: "bounded s" and f: "\n. f n \ s" - from s have s1: "bounded (fst ` s)" by (rule bounded_fst) - from f have f1: "\n. fst (f n) \ fst ` s" by simp - obtain l1 r1 where r1: "subseq r1" - and l1: "((\n. fst (f (r1 n))) ---> l1) sequentially" - using bounded_imp_convergent_subsequence [OF s1 f1] - unfolding o_def by fast - from s have s2: "bounded (snd ` s)" by (rule bounded_snd) - from f have f2: "\n. snd (f (r1 n)) \ snd ` s" by simp + fix f :: "nat \ 'a \ 'b" + assume f: "bounded (range f)" + from f have s1: "bounded (range (fst \ f))" unfolding image_comp by (rule bounded_fst) + obtain l1 r1 where r1: "subseq r1" and l1: "(\n. fst (f (r1 n))) ----> l1" + using bounded_imp_convergent_subsequence [OF s1] unfolding o_def by fast + from f have s2: "bounded (range (snd \ f \ r1))" + by (auto simp add: image_comp intro: bounded_snd bounded_subset) obtain l2 r2 where r2: "subseq r2" and l2: "((\n. snd (f (r1 (r2 n)))) ---> l2) sequentially" - using bounded_imp_convergent_subsequence [OF s2 f2] + using bounded_imp_convergent_subsequence [OF s2] unfolding o_def by fast have l1': "((\n. fst (f (r1 (r2 n)))) ---> l1) sequentially" using LIMSEQ_subseq_LIMSEQ [OF l1 r2] unfolding o_def .