# HG changeset patch # User paulson # Date 1531319772 -3600 # Node ID 3cb44b0abc5c22582e8e5c32be1d4dc224acc338 # Parent 2fae3e01a2ecb7d3c504ca5290f56f1450cfcf07 more de-applying diff -r 2fae3e01a2ec -r 3cb44b0abc5c src/HOL/Limits.thy --- a/src/HOL/Limits.thy Wed Jul 11 09:47:09 2018 +0100 +++ b/src/HOL/Limits.thy Wed Jul 11 15:36:12 2018 +0100 @@ -23,24 +23,22 @@ corollary eventually_at_infinity_pos: "eventually p at_infinity \ (\b. 0 < b \ (\x. norm x \ b \ p x))" - apply (simp add: eventually_at_infinity) - apply auto - apply (case_tac "b \ 0") - using norm_ge_zero order_trans zero_less_one apply blast - apply force - done + unfolding eventually_at_infinity + by (meson le_less_trans norm_ge_zero not_le zero_less_one) lemma at_infinity_eq_at_top_bot: "(at_infinity :: real filter) = sup at_top at_bot" - apply (simp add: filter_eq_iff eventually_sup eventually_at_infinity - eventually_at_top_linorder eventually_at_bot_linorder) - apply safe - apply (rule_tac x="b" in exI) - apply simp - apply (rule_tac x="- b" in exI) - apply simp - apply (rule_tac x="max (- Na) N" in exI) - apply (auto simp: abs_real_def) - done +proof - + have 1: "\\n\u. A n; \n\v. A n\ + \ \b. \x. b \ \x\ \ A x" for A and u v::real + by (rule_tac x="max (- v) u" in exI) (auto simp: abs_real_def) + have 2: "\x. u \ \x\ \ A x \ \N. \n\N. A n" for A and u::real + by (meson abs_less_iff le_cases less_le_not_le) + have 3: "\x. u \ \x\ \ A x \ \N. \n\N. A n" for A and u::real + by (metis (full_types) abs_ge_self abs_minus_cancel le_minus_iff order_trans) + show ?thesis + by (auto simp add: filter_eq_iff eventually_sup eventually_at_infinity + eventually_at_top_linorder eventually_at_bot_linorder intro: 1 2 3) +qed lemma at_top_le_at_infinity: "at_top \ (at_infinity :: real filter)" unfolding at_infinity_eq_at_top_bot by simp @@ -103,19 +101,15 @@ obtains B where "0 < B" and "eventually (\x. norm (f x) \ B) F" using assms unfolding Bfun_def by blast -lemma Cauchy_Bseq: "Cauchy X \ Bseq X" - unfolding Cauchy_def Bfun_metric_def eventually_sequentially - apply (erule_tac x=1 in allE) - apply simp - apply safe - apply (rule_tac x="X M" in exI) - apply (rule_tac x=1 in exI) - apply (erule_tac x=M in allE) - apply simp - apply (rule_tac x=M in exI) - apply (auto simp: dist_commute) - done - +lemma Cauchy_Bseq: + assumes "Cauchy X" shows "Bseq X" +proof - + have "\y K. 0 < K \ (\N. \n\N. dist (X n) y \ K)" + if "\m n. \m \ M; n \ M\ \ dist (X m) (X n) < 1" for M + by (meson order.order_iff_strict that zero_less_one) + with assms show ?thesis + by (force simp: Cauchy_def Bfun_metric_def eventually_sequentially) +qed subsubsection \Bounded Sequences\ @@ -202,15 +196,14 @@ by (simp add: Bseq_def) (simp add: lemma_NBseq_def) lemma lemma_NBseq_def2: "(\K > 0. \n. norm (X n) \ K) = (\N. \n. norm (X n) < real(Suc N))" - apply (subst lemma_NBseq_def) - apply auto - apply (rule_tac x = "Suc N" in exI) - apply (rule_tac [2] x = N in exI) - apply auto - prefer 2 apply (blast intro: order_less_imp_le) - apply (drule_tac x = n in spec) - apply simp - done +proof - + have *: "\N. \n. norm (X n) \ 1 + real N \ + \N. \n. norm (X n) < 1 + real N" + by (metis add.commute le_less_trans less_add_one of_nat_Suc) + then show ?thesis + unfolding lemma_NBseq_def + by (metis less_le_not_le not_less_iff_gr_or_eq of_nat_Suc) +qed text \Yet another definition for Bseq.\ lemma Bseq_iff1a: "Bseq X \ (\N. \n. norm (X n) < real (Suc N))" @@ -220,19 +213,8 @@ text \Alternative formulation for boundedness.\ lemma Bseq_iff2: "Bseq X \ (\k > 0. \x. \n. norm (X n + - x) \ k)" - apply (unfold Bseq_def) - apply safe - apply (rule_tac [2] x = "k + norm x" in exI) - apply (rule_tac x = K in exI) - apply simp - apply (rule exI [where x = 0]) - apply auto - apply (erule order_less_le_trans) - apply simp - apply (drule_tac x=n in spec) - apply (drule order_trans [OF norm_triangle_ineq2]) - apply simp - done + by (metis BseqE BseqI' add.commute add_cancel_right_left add_uminus_conv_diff norm_add_leD + norm_minus_cancel norm_minus_commute) text \Alternative formulation for boundedness.\ lemma Bseq_iff3: "Bseq X \ (\k>0. \N. \n. norm (X n + - X N) \ k)" @@ -252,15 +234,6 @@ then show ?P by (auto simp add: Bseq_iff2) qed -lemma BseqI2: "\n. k \ f n \ f n \ K \ Bseq f" - for k K :: real - apply (simp add: Bseq_def) - apply (rule_tac x = "(\k\ + \K\) + 1" in exI) - apply auto - apply (drule_tac x = n in spec) - apply arith - done - subsubsection \Upper Bounds and Lubs of Bounded Sequences\ @@ -351,11 +324,13 @@ lemma Bseq_eq_bounded: "range f \ {a..b} \ Bseq f" for a b :: real - 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 +proof (rule BseqI'[where K="max (norm a) (norm b)"]) + fix n assume "range f \ {a..b}" + then have "f n \ {a..b}" + by blast + then show "norm (f n) \ max (norm a) (norm b)" + by auto +qed lemma incseq_bounded: "incseq X \ \i. X i \ B \ Bseq X" for B :: real @@ -366,20 +341,6 @@ by (intro Bseq_eq_bounded[of X B "X 0"]) (auto simp: decseq_def) -subsection \Bounded Monotonic Sequences\ - -subsubsection \A Bounded and Monotonic Sequence Converges\ - -(* TODO: delete *) -(* FIXME: one use in NSA/HSEQ.thy *) -lemma Bmonoseq_LIMSEQ: "\n. m \ n \ X n = X m \ \L. X \ L" - apply (rule_tac x="X m" in exI) - apply (rule filterlim_cong[THEN iffD2, OF refl refl _ tendsto_const]) - unfolding eventually_sequentially - apply blast - done - - subsection \Convergence to Zero\ definition Zfun :: "('a \ 'b::real_normed_vector) \ 'a filter \ bool" @@ -2371,10 +2332,10 @@ text \Limit of @{term "c^n"} for @{term"\c\ < 1"}.\ -lemma LIMSEQ_rabs_realpow_zero: "\c\ < 1 \ (\n. \c\ ^ n :: real) \ 0" +lemma LIMSEQ_abs_realpow_zero: "\c\ < 1 \ (\n. \c\ ^ n :: real) \ 0" by (rule LIMSEQ_realpow_zero [OF abs_ge_zero]) -lemma LIMSEQ_rabs_realpow_zero2: "\c\ < 1 \ (\n. c ^ n :: real) \ 0" +lemma LIMSEQ_abs_realpow_zero2: "\c\ < 1 \ (\n. c ^ n :: real) \ 0" by (rule LIMSEQ_power_zero) simp diff -r 2fae3e01a2ec -r 3cb44b0abc5c src/HOL/Nonstandard_Analysis/HSEQ.thy --- a/src/HOL/Nonstandard_Analysis/HSEQ.thy Wed Jul 11 09:47:09 2018 +0100 +++ b/src/HOL/Nonstandard_Analysis/HSEQ.thy Wed Jul 11 15:36:12 2018 +0100 @@ -354,8 +354,9 @@ theorem and then use equivalence to "transfer" it into the equivalent nonstandard form if needed!\ -lemma Bmonoseq_NSLIMSEQ: "\n \ m. X n = X m \ \L. X \\<^sub>N\<^sub>S L" - by (auto dest!: Bmonoseq_LIMSEQ simp add: LIMSEQ_NSLIMSEQ_iff) +lemma Bmonoseq_NSLIMSEQ: "\\<^sub>F k in sequentially. X k = X m \ X \\<^sub>N\<^sub>S X m" + unfolding LIMSEQ_NSLIMSEQ_iff[symmetric] + by (simp add: eventually_mono eventually_nhds_x_imp_x filterlim_iff) lemma NSBseq_mono_NSconvergent: "NSBseq X \ \m. \n \ m. X m \ X n \ NSconvergent X" for X :: "nat \ real" @@ -452,22 +453,22 @@ lemma NSconvergent_NSCauchy: "NSconvergent X \ NSCauchy X" by (simp add: NSconvergent_def NSLIMSEQ_def NSCauchy_def) (auto intro: approx_trans2) -lemma real_NSCauchy_NSconvergent: "NSCauchy X \ NSconvergent X" - for X :: "nat \ real" - apply (simp add: NSconvergent_def NSLIMSEQ_def) - apply (frule NSCauchy_NSBseq) - apply (simp add: NSBseq_def NSCauchy_def) - apply (drule HNatInfinite_whn [THEN [2] bspec]) - apply (drule HNatInfinite_whn [THEN [2] bspec]) - apply (auto dest!: st_part_Ex simp add: SReal_iff) - apply (blast intro: approx_trans3) - done +lemma real_NSCauchy_NSconvergent: + fixes X :: "nat \ real" + assumes "NSCauchy X" shows "NSconvergent X" + unfolding NSconvergent_def NSLIMSEQ_def +proof - + have "( *f* X) whn \ HFinite" + by (simp add: NSBseqD2 NSCauchy_NSBseq assms) + moreover have "\N\HNatInfinite. ( *f* X) whn \ ( *f* X) N" + using HNatInfinite_whn NSCauchy_def assms by blast + ultimately show "\L. \N\HNatInfinite. ( *f* X) N \ hypreal_of_real L" + by (force dest!: st_part_Ex simp add: SReal_iff intro: approx_trans3) +qed lemma NSCauchy_NSconvergent: "NSCauchy X \ NSconvergent X" for X :: "nat \ 'a::banach" - apply (drule NSCauchy_Cauchy [THEN Cauchy_convergent]) - apply (erule convergent_NSconvergent_iff [THEN iffD1]) - done + using Cauchy_convergent NSCauchy_Cauchy convergent_NSconvergent_iff by auto lemma NSCauchy_NSconvergent_iff: "NSCauchy X = NSconvergent X" for X :: "nat \ 'a::banach" @@ -481,42 +482,34 @@ also fact that bounded and monotonic sequence converges.\ text \We now use NS criterion to bring proof of theorem through.\ -lemma NSLIMSEQ_realpow_zero: "0 \ x \ x < 1 \ (\n. x ^ n) \\<^sub>N\<^sub>S 0" - for x :: real - apply (simp add: NSLIMSEQ_def) - apply (auto dest!: convergent_realpow simp add: convergent_NSconvergent_iff) - apply (frule NSconvergentD) - apply (auto simp add: NSLIMSEQ_def NSCauchy_NSconvergent_iff [symmetric] NSCauchy_def starfun_pow) - apply (frule HNatInfinite_add_one) - apply (drule bspec, assumption) - apply (drule bspec, assumption) - apply (drule_tac x = "N + 1" in bspec, assumption) - apply (simp add: hyperpow_add) - apply (drule approx_mult_subst_star_of, assumption) - apply (drule approx_trans3, assumption) - apply (auto simp del: star_of_mult simp add: star_of_mult [symmetric]) - done +lemma NSLIMSEQ_realpow_zero: + fixes x :: real + assumes "0 \ x" "x < 1" shows "(\n. x ^ n) \\<^sub>N\<^sub>S 0" +proof - + have "( *f* (^) x) N \ 0" + if N: "N \ HNatInfinite" and x: "NSconvergent ((^) x)" for N + proof - + have "hypreal_of_real x pow N \ hypreal_of_real x pow (N + 1)" + by (metis HNatInfinite_add N NSCauchy_NSconvergent_iff NSCauchy_def starfun_pow x) + moreover obtain L where L: "hypreal_of_real x pow N \ hypreal_of_real L" + using NSconvergentD [OF x] N by (auto simp add: NSLIMSEQ_def starfun_pow) + ultimately have "hypreal_of_real x pow N \ hypreal_of_real L * hypreal_of_real x" + by (simp add: approx_mult_subst_star_of hyperpow_add) + then have "hypreal_of_real L \ hypreal_of_real L * hypreal_of_real x" + using L approx_trans3 by blast + then show ?thesis + by (metis L \x < 1\ hyperpow_def less_irrefl mult.right_neutral mult_left_cancel star_of_approx_iff star_of_mult star_of_simps(9) starfun2_star_of) + qed + with assms show ?thesis + by (force dest!: convergent_realpow simp add: NSLIMSEQ_def convergent_NSconvergent_iff) +qed -lemma NSLIMSEQ_rabs_realpow_zero: "\c\ < 1 \ (\n. \c\ ^ n) \\<^sub>N\<^sub>S 0" +lemma NSLIMSEQ_abs_realpow_zero: "\c\ < 1 \ (\n. \c\ ^ n) \\<^sub>N\<^sub>S 0" for c :: real - by (simp add: LIMSEQ_rabs_realpow_zero LIMSEQ_NSLIMSEQ_iff [symmetric]) - -lemma NSLIMSEQ_rabs_realpow_zero2: "\c\ < 1 \ (\n. c ^ n) \\<^sub>N\<^sub>S 0" - for c :: real - by (simp add: LIMSEQ_rabs_realpow_zero2 LIMSEQ_NSLIMSEQ_iff [symmetric]) + by (simp add: LIMSEQ_abs_realpow_zero LIMSEQ_NSLIMSEQ_iff [symmetric]) -(***--------------------------------------------------------------- - Theorems proved by Harrison in HOL that we do not need - in order to prove equivalence between Cauchy criterion - and convergence: - -- Show that every sequence contains a monotonic subsequence -Goal "\f. subseq f & monoseq (%n. s (f n))" - -- Show that a subsequence of a bounded sequence is bounded -Goal "Bseq X ==> Bseq (%n. X (f n))"; - -- Show we can take subsequential terms arbitrarily far - up a sequence -Goal "subseq f ==> n \ f(n)"; -Goal "subseq f ==> \n. N1 \ n & N2 \ f(n)"; - ---------------------------------------------------------------***) +lemma NSLIMSEQ_abs_realpow_zero2: "\c\ < 1 \ (\n. c ^ n) \\<^sub>N\<^sub>S 0" + for c :: real + by (simp add: LIMSEQ_abs_realpow_zero2 LIMSEQ_NSLIMSEQ_iff [symmetric]) end diff -r 2fae3e01a2ec -r 3cb44b0abc5c src/HOL/Transcendental.thy --- a/src/HOL/Transcendental.thy Wed Jul 11 09:47:09 2018 +0100 +++ b/src/HOL/Transcendental.thy Wed Jul 11 15:36:12 2018 +0100 @@ -5697,16 +5697,9 @@ if x'_bounds: "x' \ {- 1 <..< 1}" for x' :: real proof - from that have "\x'\ < 1" by auto - then have *: "summable (\n. (- 1) ^ n * x' ^ (2 * n))" - by (rule summable_Integral) - show ?thesis - unfolding if_eq - apply (rule sums_summable [where l="0 + (\n. (-1)^n * x'^(2 * n))"]) - apply (rule sums_if) - apply (rule sums_zero) - apply (rule summable_sums) - apply (rule *) - done + then show ?thesis + using that sums_summable sums_if [OF sums_0 [of "\x. 0"] summable_sums [OF summable_Integral]] + by (auto simp add: if_distrib [of "\x. x * y" for y] cong: if_cong) qed qed auto then show ?thesis