# HG changeset patch # User immler # Date 1452522017 -3600 # Node ID d8e7738bd2e9c04bb23427fe5a983dbafba8632c # Parent 2d187ace28274b8d7896a15a1128a8651801d7f1 generalized proofs diff -r 2d187ace2827 -r d8e7738bd2e9 src/HOL/Multivariate_Analysis/Bounded_Linear_Function.thy --- a/src/HOL/Multivariate_Analysis/Bounded_Linear_Function.thy Mon Jan 11 13:15:15 2016 +0100 +++ b/src/HOL/Multivariate_Analysis/Bounded_Linear_Function.thy Mon Jan 11 15:20:17 2016 +0100 @@ -467,74 +467,15 @@ "(if P then (1::'a::comm_semiring_1) else 0) * q = (if P then q else 0)" by auto -text \TODO: generalize this and @{thm compact_lemma}?!\ lemma compact_blinfun_lemma: fixes f :: "nat \ 'a::euclidean_space \\<^sub>L 'b::euclidean_space" assumes "bounded (range f)" shows "\d\Basis. \l::'a \\<^sub>L 'b. \ r. subseq r \ (\e>0. eventually (\n. \i\d. dist (f (r n) i) (l i) < e) sequentially)" -proof safe - fix d :: "'a set" - assume d: "d \ Basis" - with finite_Basis have "finite d" - by (blast intro: finite_subset) - from this d show "\l::'a \\<^sub>L 'b. \r. subseq r \ - (\e>0. eventually (\n. \i\d. dist (f (r n) i) (l i) < e) sequentially)" - proof (induct d) - case empty - then show ?case - unfolding subseq_def by auto - next - case (insert k d) - have k[intro]: "k \ Basis" - using insert by auto - have s': "bounded ((\x. blinfun_apply x k) ` range f)" - using \bounded (range f)\ - by (auto intro!: bounded_linear_image bounded_linear_intros) - obtain l1::"'a \\<^sub>L 'b" 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. blinfun_apply 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 - def l \ "blinfun_of_matrix (\i j. if j = k then l2 \ i else l1 j \ i)::'a \\<^sub>L 'b" - { - fix e::real - assume "e > 0" - from lr1 \e > 0\ have N1: "eventually (\n. \i\d. dist (f (r1 n) i) (l1 i) < e) sequentially" - by blast - from lr2 \e > 0\ have N2:"eventually (\n. dist (f (r1 (r2 n)) k) l2 < e) sequentially" - by (rule tendstoD) - from r2 N1 have N1': "eventually (\n. \i\d. dist (f (r1 (r2 n)) i) (l1 i) < e) sequentially" - by (rule eventually_subseq) - have l2: "l k = l2" - using insert.prems - by (auto simp: blinfun_of_matrix.rep_eq inner_Basis l_def mult_if_delta - scaleR_setsum_left[symmetric] setsum.delta' intro!: euclidean_eqI[where 'a='b]) - { - fix i assume "i \ d" - with insert have "i \ Basis" "i \ k" by auto - hence l1: "l i = (l1 i)" - by (auto simp: blinfun_of_matrix.rep_eq inner_Basis l_def mult_if_delta - scaleR_setsum_left[symmetric] setsum.delta' intro!: euclidean_eqI[where 'a='b]) - } note l1 = this - have "eventually (\n. \i\(insert k d). dist (f (r n) i) (l i) < e) sequentially" - using N1' N2 - by eventually_elim (insert insert.prems, auto simp: r_def o_def l1 l2) - } - ultimately show ?case by auto - qed -qed + by (rule compact_lemma_general[where unproj = "\e. blinfun_of_matrix (\i j. e j \ i)"]) + (auto intro!: euclidean_eqI[where 'a='b] bounded_linear_image assms + simp: blinfun_of_matrix_works blinfun_of_matrix_apply inner_Basis mult_if_delta setsum.delta' + scaleR_setsum_left[symmetric]) lemma blinfun_euclidean_eqI: "(\i. i \ Basis \ blinfun_apply x i = blinfun_apply y i) \ x = y" apply (auto intro!: blinfun_eqI) diff -r 2d187ace2827 -r d8e7738bd2e9 src/HOL/Multivariate_Analysis/Cartesian_Euclidean_Space.thy --- a/src/HOL/Multivariate_Analysis/Cartesian_Euclidean_Space.thy Mon Jan 11 13:15:15 2016 +0100 +++ b/src/HOL/Multivariate_Analysis/Cartesian_Euclidean_Space.thy Mon Jan 11 15:20:17 2016 +0100 @@ -820,47 +820,14 @@ lemma compact_lemma_cart: fixes f :: "nat \ 'a::heine_borel ^ 'n" assumes f: "bounded (range f)" - shows "\d. - \l r. subseq r \ + shows "\l r. subseq r \ (\e>0. eventually (\n. \i\d. dist (f (r n) $ i) (l $ i) < e) sequentially)" -proof - fix d :: "'n set" - have "finite d" by simp - thus "\l::'a ^ 'n. \r. subseq r \ - (\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) - 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 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 "\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 - def l \ "(\ i. if i = k then l2 else l1$i)::'a^'n" - { fix e :: real assume "e > 0" - from lr1 \e>0\ have N1:"eventually (\n. \i\d. dist (f (r1 n) $ i) (l1 $ i) < e) sequentially" - by blast - from lr2 \e>0\ have N2:"eventually (\n. dist (f (r1 (r2 n)) $ k) l2 < e) sequentially" - by (rule tendstoD) - from r2 N1 have N1': "eventually (\n. \i\d. dist (f (r1 (r2 n)) $ i) (l1 $ i) < e) sequentially" - by (rule eventually_subseq) - have "eventually (\n. \i\(insert k d). dist (f (r n) $ i) (l $ i) < e) sequentially" - using N1' N2 by (rule eventually_elim2, simp add: l_def r_def) - } - ultimately show ?case by auto - qed + (is "?th d") +proof - + have "\d' \ d. ?th d'" + by (rule compact_lemma_general[where unproj=vec_lambda]) + (auto intro!: f bounded_component_cart simp: vec_lambda_eta) + then show "?th d" by simp qed instance vec :: (heine_borel, finite) heine_borel diff -r 2d187ace2827 -r d8e7738bd2e9 src/HOL/Multivariate_Analysis/Topology_Euclidean_Space.thy --- a/src/HOL/Multivariate_Analysis/Topology_Euclidean_Space.thy Mon Jan 11 13:15:15 2016 +0100 +++ b/src/HOL/Multivariate_Analysis/Topology_Euclidean_Space.thy Mon Jan 11 15:20:17 2016 +0100 @@ -4443,61 +4443,75 @@ using Bseq_monoseq_convergent[of "f \ r"] by (auto simp: convergent_def) qed -lemma compact_lemma: - fixes f :: "nat \ 'a::euclidean_space" - 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)" +lemma compact_lemma_general: + fixes f :: "nat \ 'a" + fixes proj::"'a \ 'b \ 'c::heine_borel" (infixl "proj" 60) + fixes unproj:: "('b \ 'c) \ 'a" + assumes finite_basis: "finite basis" + assumes bounded_proj: "\k. k \ basis \ bounded ((\x. x proj k) ` range f)" + assumes proj_unproj: "\e k. k \ basis \ (unproj e) proj k = e k" + assumes unproj_proj: "\x. unproj (\k. x proj k) = x" + shows "\d\basis. \l::'a. \ r. + subseq r \ (\e>0. eventually (\n. \i\d. dist (f (r n) proj i) (l proj i) < e) sequentially)" proof safe - fix d :: "'a set" - assume d: "d \ Basis" - with finite_Basis have "finite d" + fix d :: "'b set" + assume d: "d \ basis" + with finite_basis have "finite d" by (blast intro: finite_subset) from this d show "\l::'a. \r. subseq r \ - (\e>0. eventually (\n. \i\d. dist (f (r n) \ i) (l \ i) < e) sequentially)" + (\e>0. eventually (\n. \i\d. dist (f (r n) proj i) (l proj i) < e) sequentially)" proof (induct d) case empty then show ?case unfolding subseq_def by auto next case (insert k d) - have k[intro]: "k \ Basis" + have k[intro]: "k \ basis" using insert by auto - have s': "bounded ((\x. x \ k) ` range f)" - using \bounded (range f)\ - by (auto intro!: bounded_linear_image bounded_linear_inner_left) + have s': "bounded ((\x. x proj k) ` range f)" + using k + by (rule bounded_proj) 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" + and lr1: "\e > 0. eventually (\n. \i\d. dist (f (r1 n) proj i) (l1 proj i) < e) sequentially" using insert(3) using insert(4) by auto - have f': "\n. f (r1 n) \ k \ (\x. x \ k) ` range f" + have f': "\n. f (r1 n) proj k \ (\x. x proj k) ` range f" by simp - have "bounded (range (\i. f (r1 i) \ k))" + have "bounded (range (\i. f (r1 i) proj 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"] + then obtain l2 r2 where r2:"subseq r2" and lr2:"((\i. f (r1 (r2 i)) proj k) \ l2) sequentially" + using bounded_imp_convergent_subsequence[of "\i. f (r1 i) proj 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 - def l \ "(\i\Basis. (if i = k then l2 else l1\i) *\<^sub>R i)::'a" + def l \ "unproj (\i. if i = k then l2 else l1 proj i)::'a" { fix e::real assume "e > 0" - from lr1 \e > 0\ have N1: "eventually (\n. \i\d. dist (f (r1 n) \ i) (l1 \ i) < e) sequentially" + from lr1 \e > 0\ have N1: "eventually (\n. \i\d. dist (f (r1 n) proj i) (l1 proj i) < e) sequentially" by blast - from lr2 \e > 0\ have N2:"eventually (\n. dist (f (r1 (r2 n)) \ k) l2 < e) sequentially" + from lr2 \e > 0\ have N2:"eventually (\n. dist (f (r1 (r2 n)) proj k) l2 < e) sequentially" by (rule tendstoD) - from r2 N1 have N1': "eventually (\n. \i\d. dist (f (r1 (r2 n)) \ i) (l1 \ i) < e) sequentially" + from r2 N1 have N1': "eventually (\n. \i\d. dist (f (r1 (r2 n)) proj i) (l1 proj i) < e) sequentially" by (rule eventually_subseq) - have "eventually (\n. \i\(insert k d). dist (f (r n) \ i) (l \ i) < e) sequentially" + have "eventually (\n. \i\(insert k d). dist (f (r n) proj i) (l proj i) < e) sequentially" using N1' N2 - by eventually_elim (insert insert.prems, auto simp: l_def r_def o_def) + by eventually_elim (insert insert.prems, auto simp: l_def r_def o_def proj_unproj) } ultimately show ?case by auto qed qed +lemma compact_lemma: + fixes f :: "nat \ 'a::euclidean_space" + 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)" + by (rule compact_lemma_general[where unproj="\e. \i\Basis. e i *\<^sub>R i"]) + (auto intro!: assms bounded_linear_inner_left bounded_linear_image + simp: euclidean_representation) + instance euclidean_space \ heine_borel proof fix f :: "nat \ 'a"