# HG changeset patch # User huffman # Date 1244660040 25200 # Node ID ca9e56897403ac17e59b25b60ef75917b3085f21 # Parent e7a282113145921fcc1e94bb3d4f26180ff87807 use constants subseq, incseq, monoseq diff -r e7a282113145 -r ca9e56897403 src/HOL/Library/Topology_Euclidean_Space.thy --- a/src/HOL/Library/Topology_Euclidean_Space.thy Tue Jun 09 16:13:18 2009 -0700 +++ b/src/HOL/Library/Topology_Euclidean_Space.thy Wed Jun 10 11:54:00 2009 -0700 @@ -2243,8 +2243,8 @@ definition compact :: "'a::metric_space set \ bool" where (* TODO: generalize *) "compact S \ - (\f. (\n::nat. f n \ S) \ - (\l\S. \r. (\m n. m < n \ r m < r n) \ ((f o r) ---> l) sequentially))" + (\f. (\n. f n \ S) \ + (\l\S. \r. subseq r \ ((f o r) ---> l) sequentially))" text {* A metric space (or topological vector space) is said to have the @@ -2253,44 +2253,43 @@ class heine_borel = assumes bounded_imp_convergent_subsequence: - "bounded s \ \n::nat. f n \ s - \ \l r. (\m n. m < n --> r m < r n) \ ((f \ r) ---> l) sequentially" + "bounded s \ \n. f n \ s + \ \l r. subseq r \ ((f \ r) ---> l) sequentially" lemma bounded_closed_imp_compact: fixes s::"'a::heine_borel set" assumes "bounded s" and "closed s" shows "compact s" proof (unfold compact_def, clarify) fix f :: "nat \ 'a" assume f: "\n. f n \ s" - obtain l r where r: "\m n. m < n \ r m < r n" and l: "((f \ r) ---> l) sequentially" + 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 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 - show "\l\s. \r. (\m n. m < n \ r m < r n) \ ((f \ r) ---> l) sequentially" + show "\l\s. \r. subseq r \ ((f \ r) ---> l) sequentially" using `l \ s` r l by blast qed -lemma monotone_bigger: fixes r::"nat\nat" - assumes "\m n::nat. m < n --> r m < r n" - shows "n \ r n" +lemma subseq_bigger: assumes "subseq r" shows "n \ r n" proof(induct n) show "0 \ r 0" by auto next fix n assume "n \ r n" - moreover have "r n < r (Suc n)" using assms by auto + moreover have "r n < r (Suc n)" + using assms [unfolded subseq_def] by auto ultimately show "Suc n \ r (Suc n)" by auto qed -lemma eventually_subsequence: - assumes r: "\m n. m < n \ r m < r n" +lemma eventually_subseq: + assumes r: "subseq r" shows "eventually P sequentially \ eventually (\n. P (r n)) sequentially" unfolding eventually_sequentially -by (metis monotone_bigger [OF r] le_trans) - -lemma lim_subsequence: - fixes l :: "'a::metric_space" (* TODO: generalize *) - shows "\m n. m < n \ r m < r n \ (s ---> l) sequentially \ ((s o r) ---> l) sequentially" -unfolding Lim_sequentially by (simp, metis monotone_bigger le_trans) +by (metis subseq_bigger [OF r] le_trans) + +lemma lim_subseq: + "subseq r \ (s ---> l) sequentially \ ((s o r) ---> l) sequentially" +unfolding tendsto_def eventually_sequentially o_def +by (metis subseq_bigger le_trans) lemma num_Axiom: "EX! g. g 0 = e \ (\n. g (Suc n) = f n (g n))" unfolding Ex1_def @@ -2306,9 +2305,8 @@ apply (simp) done - lemma convergent_bounded_increasing: fixes s ::"nat\real" - assumes "\m n. m \ n --> s m \ s n" and "\n. abs(s n) \ b" + assumes "incseq s" and "\n. abs(s n) \ b" shows "\ l. \e::real>0. \ N. \n \ N. abs(s n - l) < e" proof- have "isUb UNIV (range s) b" using assms(2) and abs_le_D1 unfolding isUb_def and setle_def by auto @@ -2318,27 +2316,27 @@ obtain N where "N\n" and n:"\s N - t\ \ e" using as[THEN spec[where x=n]] by auto have "t \ s N" using isLub_isUb[OF t, unfolded isUb_def setle_def] by auto with n have "s N \ t - e" using `e>0` by auto - hence "s n \ t - e" using assms(1)[THEN spec[where x=n], THEN spec[where x=N]] using `n\N` by auto } + hence "s n \ t - e" using assms(1)[unfolded incseq_def, THEN spec[where x=n], THEN spec[where x=N]] using `n\N` by auto } hence "isUb UNIV (range s) (t - e)" unfolding isUb_def and setle_def by auto hence False using isLub_le_isUb[OF t, of "t - e"] and `e>0` by auto } thus ?thesis by blast qed lemma convergent_bounded_monotone: fixes s::"nat \ real" - assumes "\n. abs(s n) \ b" and "(\m n. m \ n --> s m \ s n) \ (\m n. m \ n --> s n \ s m)" + assumes "\n. abs(s n) \ b" and "monoseq s" shows "\l. \e::real>0. \N. \n\N. abs(s n - l) < e" using convergent_bounded_increasing[of s b] assms using convergent_bounded_increasing[of "\n. - s n" b] + unfolding monoseq_def incseq_def apply auto unfolding minus_add_distrib[THEN sym, unfolded diff_minus[THEN sym]] unfolding abs_minus_cancel by(rule_tac x="-l" in exI)auto lemma compact_real_lemma: assumes "\n::nat. abs(s n) \ b" - shows "\(l::real) r. (\m n::nat. m < n --> r m < r n) \ ((s \ r) ---> l) sequentially" + shows "\(l::real) r. subseq r \ ((s \ r) ---> l) sequentially" proof- - obtain r where r:"\m n::nat. m < n \ r m < r n" - "(\m n. m \ n \ s (r m) \ s (r n)) \ (\m n. m \ n \ s (r n) \ s (r m))" - using seq_monosub[of s] by (auto simp add: subseq_def monoseq_def) - thus ?thesis using convergent_bounded_monotone[of "s o r" b] and assms + obtain r where r:"subseq r" "monoseq (\n. s (r n))" + using seq_monosub[of s] by auto + thus ?thesis using convergent_bounded_monotone[of "\n. s (r n)" b] and assms unfolding tendsto_iff dist_norm eventually_sequentially by auto qed @@ -2349,9 +2347,9 @@ then obtain b where b: "\n. abs (f n) \ b" unfolding bounded_iff by auto obtain l :: real and r :: "nat \ nat" where - r: "\m n. m < n \ r m < r n" and l: "((f \ r) ---> l) sequentially" + r: "subseq r" and l: "((f \ r) ---> l) sequentially" using compact_real_lemma [OF b] by auto - thus "\l r. (\m n. m < n \ r m < r n) \ ((f \ r) ---> l) sequentially" + thus "\l r. subseq r \ ((f \ r) ---> l) sequentially" by auto qed @@ -2368,28 +2366,29 @@ fixes f :: "nat \ 'a::heine_borel ^ 'n::finite" assumes "bounded s" and "\n. f n \ s" shows "\d. - \l r. (\n m::nat. m < n --> r m < r n) \ + \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. (\n m::nat. m < n --> r m < r n) \ + 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 by auto + proof(induct d) case empty 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) - obtain l1::"'a^'n" and r1 where r1:"\n m::nat. m < n \ r1 m < r1 n" and lr1:"\e>0. eventually (\n. \i\d. dist (f (r1 n) $ i) (l1 $ i) < e) sequentially" + 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:"\m n::nat. m < n \ r2 m < r2 n" and lr2:"((\i. f (r1 (r2 i)) $ k) ---> l2) sequentially" + 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 - def r \ "r1 \ r2" have r:"\m n. m < n \ r m < r n" unfolding r_def o_def using r1 and r2 by auto + 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_subsequence) + 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) } @@ -2401,7 +2400,7 @@ proof fix s :: "('a ^ 'b) set" and f :: "nat \ 'a ^ 'b" assume s: "bounded s" and f: "\n. f n \ s" - then obtain l r where r: "\n m::nat. m < n --> r m < r n" + 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 [OF s f] by blast let ?d = "UNIV::'b set" @@ -2422,7 +2421,7 @@ by (rule eventually_elim1) } hence *:"((f \ r) ---> l) sequentially" unfolding o_def tendsto_iff by simp - with r show "\l r. (\m n. m < n \ r m < r n) \ ((f \ r) ---> l) sequentially" by auto + with r show "\l r. subseq r \ ((f \ r) ---> l) sequentially" by auto qed subsection{* Completeness. *} @@ -2487,14 +2486,9 @@ lemma compact_imp_complete: assumes "compact s" shows "complete s" proof- { fix f assume as: "(\n::nat. f n \ s)" "Cauchy f" - from as(1) obtain l r where lr: "l\s" "(\m n. m < n \ r m < r n)" "((f \ r) ---> l) sequentially" using assms unfolding compact_def by blast - - { fix n :: nat have lr':"n \ r n" - proof (induct n) - show "0 \ r 0" using lr(2) by blast - next fix na assume "na \ r na" moreover have "na < Suc na \ r na < r (Suc na)" using lr(2) by blast - ultimately show "Suc na \ r (Suc na)" by auto - qed } note lr' = this + from as(1) obtain l r where lr: "l\s" "subseq r" "((f \ r) ---> l) sequentially" using assms unfolding compact_def by blast + + note lr' = subseq_bigger [OF lr(2)] { fix e::real assume "e>0" from as(2) obtain N where N:"\m n. N \ m \ N \ n \ dist (f m) (f n) < e/2" unfolding cauchy_def using `e>0` apply (erule_tac x="e/2" in allE) by auto @@ -2601,12 +2595,12 @@ thus "x n \ 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:"\m n. m < n \ r m < r n" and "((x \ r) ---> l) sequentially" using assms(1)[unfolded compact_def, THEN spec[where x=x]] by auto + then obtain l r where "l\s" and r:"subseq r" and "((x \ r) ---> l) sequentially" using assms(1)[unfolded compact_def, THEN spec[where x=x]] by auto from this(3) have "Cauchy (x \ r)" using convergent_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[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 @@ -2625,7 +2619,7 @@ 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:"\m n. m < n \ r m < r n" and lr:"((f \ r) ---> l) sequentially" + then obtain l r where l:"l\s" and r:"subseq r" and lr:"((f \ r) ---> l) sequentially" using assms(1)[unfolded compact_def, THEN spec[where x=f]] by auto obtain b where "l\b" "b\t" using assms(2) and l by auto @@ -2638,7 +2632,7 @@ 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 monotone_bigger[OF r, of "N1 + N2"] by auto + using subseq_bigger[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 @@ -2952,7 +2946,7 @@ by blast lemma compact_sing [simp]: "compact {a}" - unfolding compact_def o_def + unfolding compact_def o_def subseq_def by (auto simp add: tendsto_const) lemma compact_cball[simp]: @@ -3013,7 +3007,7 @@ from assms(2) obtain x where x:"\n::nat. x n \ s n" using choice[of "\n x. x\ s n"] by auto from assms(4,1) have *:"compact (s 0)" using bounded_closed_imp_compact[of "s 0"] by auto - then obtain l r where lr:"l\s 0" "\m n. m < n \ r m < r n" "((x \ r) ---> l) sequentially" + then obtain l r where lr:"l\s 0" "subseq r" "((x \ r) ---> l) sequentially" unfolding compact_def apply(erule_tac x=x in allE) using x using assms(3) by blast { fix n::nat @@ -3021,7 +3015,7 @@ with lr(3) obtain N where N:"\m\N. dist ((x \ r) m) l < e" unfolding Lim_sequentially by auto hence "dist ((x \ r) (max N n)) l < e" by auto moreover - have "r (max N n) \ n" using lr(2) using monotone_bigger[of r "max N n"] by auto + have "r (max N n) \ n" using lr(2) using subseq_bigger[of r "max N n"] by auto hence "(x \ r) (max N n) \ s n" using x apply(erule_tac x=n in allE) using x apply(erule_tac x="r (max N n)" in allE) @@ -3901,13 +3895,13 @@ proof- { fix x assume x:"\n::nat. x n \ f ` s" then obtain y where y:"\n. y n \ s \ x n = f (y n)" unfolding image_iff Bex_def using choice[of "\n xa. xa \ s \ x n = f xa"] by auto - then obtain l r where "l\s" and r:"\m n. m < n \ r m < r n" and lr:"((y \ r) ---> l) sequentially" using assms(2)[unfolded compact_def, THEN spec[where x=y]] by auto + then obtain l r where "l\s" and r:"subseq r" and lr:"((y \ r) ---> l) sequentially" using assms(2)[unfolded compact_def, THEN spec[where x=y]] by auto { fix e::real assume "e>0" then obtain d where "d>0" and d:"\x'\s. dist x' l < d \ dist (f x') (f l) < e" using assms(1)[unfolded continuous_on_def, THEN bspec[where x=l], OF `l\s`] by auto then obtain N::nat where N:"\n\N. dist ((y \ r) n) l < d" using lr[unfolded Lim_sequentially, THEN spec[where x=d]] by auto { fix n::nat assume "n\N" hence "dist ((x \ r) n) (f l) < e" using N[THEN spec[where x=n]] d[THEN bspec[where x="y (r n)"]] y[THEN spec[where x="r n"]] by auto } hence "\N. \n\N. dist ((x \ r) n) (f l) < e" by auto } - hence "\l\f ` s. \r. (\m n. m < n \ r m < r n) \ ((x \ r) ---> l) sequentially" unfolding Lim_sequentially using r lr `l\s` by auto } + hence "\l\f ` s. \r. subseq r \ ((x \ r) ---> l) sequentially" unfolding Lim_sequentially using r lr `l\s` by auto } thus ?thesis unfolding compact_def by auto qed @@ -4504,10 +4498,10 @@ { fix x l assume as:"\n. x n \ ?S" "(x ---> l) sequentially" from as(1) obtain f where f:"\n. x n = fst (f n) + snd (f n)" "\n. fst (f n) \ s" "\n. snd (f n) \ t" using choice[of "\n y. x n = (fst y) + (snd y) \ fst y \ s \ snd y \ t"] by auto - obtain l' r where "l'\s" and r:"\m n. m < n \ r m < r n" and lr:"(((\n. fst (f n)) \ r) ---> l') sequentially" + obtain l' r where "l'\s" and r:"subseq r" and lr:"(((\n. fst (f n)) \ r) ---> l') sequentially" using assms(1)[unfolded compact_def, THEN spec[where x="\ n. fst (f n)"]] using f(2) by auto have "((\n. snd (f (r n))) ---> l - l') sequentially" - using Lim_sub[OF lim_subsequence[OF r as(2)] lr] and f(1) unfolding o_def by auto + using Lim_sub[OF lim_subseq[OF r as(2)] lr] and f(1) unfolding o_def by auto hence "l - l' \ t" using assms(2)[unfolded closed_sequential_limits, THEN spec[where x="\ n. snd (f (r n))"], THEN spec[where x="l - l'"]] using f(3) by auto @@ -5301,7 +5295,7 @@ have "\ n. n\m \ dest_vec1 (s m) \ dest_vec1 (s n)" apply(induct_tac n) apply simp using assms(2) apply(erule_tac x="na" in allE) by(auto simp add: not_less_eq_eq) } hence "\m n. m \ n \ dest_vec1 (s m) \ dest_vec1 (s n)" by auto - then obtain l where "\e>0. \N. \n\N. \dest_vec1 (s n) - l\ < e" using convergent_bounded_monotone[OF a] by auto + then obtain l where "\e>0. \N. \n\N. \dest_vec1 (s n) - l\ < e" using convergent_bounded_monotone[OF a] unfolding monoseq_def by auto thus ?thesis unfolding Lim_sequentially apply(rule_tac x="vec1 l" in exI) unfolding dist_norm unfolding abs_dest_vec1 and dest_vec1_sub by auto qed @@ -5968,7 +5962,7 @@ def h \ "\n. pastecart (f n x) (f n y)" let ?s2 = "{pastecart x y |x y. x \ s \ y \ s}" - obtain l r where "l\?s2" and r:"\m n. m < n \ r m < r n" and lr:"((h \ r) ---> l) sequentially" + obtain l r where "l\?s2" and r:"subseq r" and lr:"((h \ r) ---> l) sequentially" using compact_pastecart[OF s(1) s(1), unfolded compact_def, THEN spec[where x=h]] unfolding h_def using fs[OF `x\s`] and fs[OF `y\s`] by blast def a \ "fstcart l" def b \ "sndcart l" @@ -6002,7 +5996,7 @@ moreover have "dist (f (r (Na + Nb + n)) x - f (r (Na + Nb + n)) y) (a - b) \ dist a b - dist (f n x) (f n y)" using distf[of n "r (Na+Nb+n)", OF _ `x\s` `y\s`] - using monotone_bigger[OF r, of "Na+Nb+n"] + using subseq_bigger[OF r, of "Na+Nb+n"] using *[of "f (r (Na + Nb + n)) x" "f (r (Na + Nb + n)) y" "f n x" "f n y"] by auto ultimately have False by simp }