# HG changeset patch # User hoelzl # Date 1363945303 -3600 # Node ID 2990382dc066359c85edd0976c6bba264f199ebf # Parent 0c0efde246d1a32e0d0d3554cdb4980e29d95d9b clean up lemma_nest_unique and renamed to nested_sequence_unique diff -r 0c0efde246d1 -r 2990382dc066 src/HOL/Deriv.thy --- a/src/HOL/Deriv.thy Fri Mar 22 10:41:43 2013 +0100 +++ b/src/HOL/Deriv.thy Fri Mar 22 10:41:43 2013 +0100 @@ -425,80 +425,27 @@ subsection {* Nested Intervals and Bisection *} -text{*Lemmas about nested intervals and proof by bisection (cf.Harrison). - All considerably tidied by lcp.*} - -lemma lemma_f_mono_add [rule_format (no_asm)]: "(\n. (f::nat=>real) n \ f (Suc n)) --> f m \ f(m + no)" -apply (induct "no") -apply (auto intro: order_trans) -done - -lemma f_inc_g_dec_Beq_f: "[| \n. f(n) \ f(Suc n); - \n. g(Suc n) \ g(n); - \n. f(n) \ g(n) |] - ==> Bseq (f :: nat \ real)" -apply (rule_tac k = "f 0" and K = "g 0" in BseqI2, rule allI) -apply (rule conjI) -apply (induct_tac "n") -apply (auto intro: order_trans) -apply (rule_tac y = "g n" in order_trans) -apply (induct_tac [2] "n") -apply (auto intro: order_trans) -done - -lemma f_inc_g_dec_Beq_g: "[| \n. f(n) \ f(Suc n); - \n. g(Suc n) \ g(n); - \n. f(n) \ g(n) |] - ==> Bseq (g :: nat \ real)" -apply (subst Bseq_minus_iff [symmetric]) -apply (rule_tac g = "%x. - (f x)" in f_inc_g_dec_Beq_f) -apply auto -done - -lemma f_inc_imp_le_lim: - fixes f :: "nat \ real" - shows "\\n. f n \ f (Suc n); convergent f\ \ f n \ lim f" - by (rule incseq_le, simp add: incseq_SucI, simp add: convergent_LIMSEQ_iff) +lemma nested_sequence_unique: + assumes "\n. f n \ f (Suc n)" "\n. g (Suc n) \ g n" "\n. f n \ g n" "(\n. f n - g n) ----> 0" + shows "\l::real. ((\n. f n \ l) \ f ----> l) \ ((\n. l \ g n) \ g ----> l)" +proof - + have "incseq f" unfolding incseq_Suc_iff by fact + have "decseq g" unfolding decseq_Suc_iff by fact -lemma lim_uminus: - fixes g :: "nat \ 'a::real_normed_vector" - shows "convergent g ==> lim (%x. - g x) = - (lim g)" -apply (rule tendsto_minus [THEN limI]) -apply (simp add: convergent_LIMSEQ_iff) -done - -lemma g_dec_imp_lim_le: - fixes g :: "nat \ real" - shows "\\n. g (Suc n) \ g(n); convergent g\ \ lim g \ g n" - by (rule decseq_le, simp add: decseq_SucI, simp add: convergent_LIMSEQ_iff) - -lemma lemma_nest: "[| \n. f(n) \ f(Suc n); - \n. g(Suc n) \ g(n); - \n. f(n) \ g(n) |] - ==> \l m :: real. l \ m & ((\n. f(n) \ l) & f ----> l) & - ((\n. m \ g(n)) & g ----> m)" -apply (subgoal_tac "monoseq f & monoseq g") -prefer 2 apply (force simp add: LIMSEQ_iff monoseq_Suc) -apply (subgoal_tac "Bseq f & Bseq g") -prefer 2 apply (blast intro: f_inc_g_dec_Beq_f f_inc_g_dec_Beq_g) -apply (auto dest!: Bseq_monoseq_convergent simp add: convergent_LIMSEQ_iff) -apply (rule_tac x = "lim f" in exI) -apply (rule_tac x = "lim g" in exI) -apply (auto intro: LIMSEQ_le) -apply (auto simp add: f_inc_imp_le_lim g_dec_imp_lim_le convergent_LIMSEQ_iff) -done - -lemma lemma_nest_unique: "[| \n. f(n) \ f(Suc n); - \n. g(Suc n) \ g(n); - \n. f(n) \ g(n); - (%n. f(n) - g(n)) ----> 0 |] - ==> \l::real. ((\n. f(n) \ l) & f ----> l) & - ((\n. l \ g(n)) & g ----> l)" -apply (drule lemma_nest, auto) -apply (subgoal_tac "l = m") -apply (drule_tac [2] f = f in tendsto_diff) -apply (auto intro: LIMSEQ_unique) -done + { fix n + from `decseq g` have "g n \ g 0" by (rule decseqD) simp + with `\n. f n \ g n`[THEN spec, of n] have "f n \ g 0" by auto } + then obtain u where "f ----> u" "\i. f i \ u" + using incseq_convergent[OF `incseq f`] by auto + moreover + { fix n + from `incseq f` have "f 0 \ f n" by (rule incseqD) simp + with `\n. f n \ g n`[THEN spec, of n] have "f 0 \ g n" by simp } + then obtain l where "g ----> l" "\i. l \ g i" + using decseq_convergent[OF `decseq g`] by auto + moreover note LIMSEQ_unique[OF assms(4) tendsto_diff[OF `f ----> u` `g ----> l`]] + ultimately show ?thesis by auto +qed lemma Bolzano[consumes 1, case_names trans local]: fixes P :: "real \ real \ bool" @@ -516,7 +463,7 @@ { fix n have "l n \ u n" by (induct n) auto } note this[simp] have "\x. ((\n. l n \ x) \ l ----> x) \ ((\n. x \ u n) \ u ----> x)" - proof (safe intro!: lemma_nest_unique) + proof (safe intro!: nested_sequence_unique) fix n show "l n \ l (Suc n)" "u (Suc n) \ u n" by (induct n) auto next { fix n have "l n - u n = (a - b) / 2^n" by (induct n) (auto simp: field_simps) } diff -r 0c0efde246d1 -r 2990382dc066 src/HOL/SEQ.thy --- a/src/HOL/SEQ.thy Fri Mar 22 10:41:43 2013 +0100 +++ b/src/HOL/SEQ.thy Fri Mar 22 10:41:43 2013 +0100 @@ -301,6 +301,43 @@ shows "\Cauchy X; 0 < e\ \ \M. \m\M. \n\M. norm (X m - X n) < e" by (simp add: Cauchy_iff) +lemma Bseq_eq_bounded: "range f \ {a .. b::real} \ Bseq f" + apply (simp add: subset_eq) + apply (rule BseqI'[where K="max (norm a) (norm b)"]) + apply (erule_tac x=n in allE) + apply auto + done + +lemma incseq_bounded: "incseq X \ \i. X i \ (B::real) \ Bseq X" + by (intro Bseq_eq_bounded[of X "X 0" B]) (auto simp: incseq_def) + +lemma decseq_bounded: "decseq X \ \i. (B::real) \ X i \ Bseq X" + by (intro Bseq_eq_bounded[of X B "X 0"]) (auto simp: decseq_def) + +lemma incseq_convergent: + fixes X :: "nat \ real" + assumes "incseq X" and "\i. X i \ B" + obtains L where "X ----> L" "\i. X i \ L" +proof atomize_elim + from incseq_bounded[OF assms] `incseq X` Bseq_monoseq_convergent[of X] + obtain L where "X ----> L" + by (auto simp: convergent_def monoseq_def incseq_def) + with `incseq X` show "\L. X ----> L \ (\i. X i \ L)" + by (auto intro!: exI[of _ L] incseq_le) +qed + +lemma decseq_convergent: + fixes X :: "nat \ real" + assumes "decseq X" and "\i. B \ X i" + obtains L where "X ----> L" "\i. L \ X i" +proof atomize_elim + from decseq_bounded[OF assms] `decseq X` Bseq_monoseq_convergent[of X] + obtain L where "X ----> L" + by (auto simp: convergent_def monoseq_def decseq_def) + with `decseq X` show "\L. X ----> L \ (\i. L \ X i)" + by (auto intro!: exI[of _ L] decseq_le) +qed + subsubsection {* Cauchy Sequences are Bounded *} text{*A Cauchy sequence is bounded -- this is the standard diff -r 0c0efde246d1 -r 2990382dc066 src/HOL/Series.thy --- a/src/HOL/Series.thy Fri Mar 22 10:41:43 2013 +0100 +++ b/src/HOL/Series.thy Fri Mar 22 10:41:43 2013 +0100 @@ -373,16 +373,13 @@ have "convergent (\n. setsum f {0..n. setsum f {0..n. setsum f {0..n. x"]) - (auto simp add: le pos) + by (intro BseqI'[of _ x]) (auto simp add: setsum_nonneg pos intro: le) next show "\m n. m \ n \ setsum f {0.. setsum f {0.. L" - by (blast dest: convergentD) thus ?thesis - by (force simp add: summable_def sums_def) + by (force simp add: summable_def sums_def convergent_def) qed lemma series_pos_le: diff -r 0c0efde246d1 -r 2990382dc066 src/HOL/Transcendental.thy --- a/src/HOL/Transcendental.thy Fri Mar 22 10:41:43 2013 +0100 +++ b/src/HOL/Transcendental.thy Fri Mar 22 10:41:43 2013 +0100 @@ -207,7 +207,7 @@ thus "\ N. \ n \ N. norm (- a (2 * n) - 0) < r" by auto qed ultimately - show ?thesis by (rule lemma_nest_unique) + show ?thesis by (rule nested_sequence_unique) qed lemma summable_Leibniz': fixes a :: "nat \ real"