# HG changeset patch # User immler # Date 1469718976 -7200 # Node ID 36e9732988ceecdadd0f05eee5f468b50c2e9c1e # Parent d00db72d86979596e6f4a7ab9fb78a611a731724 numerical bounds on pi diff -r d00db72d8697 -r 36e9732988ce src/HOL/Filter.thy --- a/src/HOL/Filter.thy Sun Jul 24 16:48:41 2016 +0200 +++ b/src/HOL/Filter.thy Thu Jul 28 17:16:16 2016 +0200 @@ -618,6 +618,12 @@ unfolding at_top_def by (subst eventually_INF_base) (auto simp: eventually_principal intro: max.cobounded1 max.cobounded2) +lemma eventually_at_top_linorderI: + fixes c::"'a::linorder" + assumes "\x. c \ x \ P x" + shows "eventually P at_top" + using assms by (auto simp: eventually_at_top_linorder) + lemma eventually_ge_at_top: "eventually (\x. (c::_::linorder) \ x) at_top" unfolding eventually_at_top_linorder by auto diff -r d00db72d8697 -r 36e9732988ce src/HOL/Limits.thy --- a/src/HOL/Limits.thy Sun Jul 24 16:48:41 2016 +0200 +++ b/src/HOL/Limits.thy Thu Jul 28 17:16:16 2016 +0200 @@ -1401,6 +1401,14 @@ lemma tendsto_inverse_0_at_top: "LIM x F. f x :> at_top \ ((\x. inverse (f x) :: real) \ 0) F" by (metis filterlim_at filterlim_mono[OF _ at_top_le_at_infinity order_refl] filterlim_inverse_at_iff) +lemma real_tendsto_divide_at_top: + fixes c::"real" + assumes "(f \ c) F" + assumes "filterlim g at_top F" + shows "((\x. f x / g x) \ 0) F" + by (auto simp: divide_inverse_commute + intro!: tendsto_mult[THEN tendsto_eq_rhs] tendsto_inverse_0_at_top assms) + lemma mult_nat_left_at_top: "c > 0 \ filterlim (\x. c * x) at_top sequentially" for c :: nat by (rule filterlim_subseq) (auto simp: subseq_def) @@ -1489,6 +1497,13 @@ qed qed +lemma filterlim_at_top_mult_tendsto_pos: + assumes f: "(f \ c) F" + and c: "0 < c" + and g: "LIM x F. g x :> at_top" + shows "LIM x F. (g x * f x:: real) :> at_top" + by (auto simp: mult.commute intro!: filterlim_tendsto_pos_mult_at_top f c g) + lemma filterlim_tendsto_pos_mult_at_bot: fixes c :: real assumes "(f \ c) F" "0 < c" "filterlim g at_bot F" @@ -2139,6 +2154,26 @@ lemma LIMSEQ_divide_realpow_zero: "1 < x \ (\n. a / (x ^ n) :: real) \ 0" by (rule tendsto_divide_0 [OF tendsto_const filterlim_realpow_sequentially_gt1]) simp +lemma + tendsto_power_zero: + fixes x::"'a::real_normed_algebra_1" + assumes "filterlim f at_top F" + assumes "norm x < 1" + shows "((\y. x ^ (f y)) \ 0) F" +proof (rule tendstoI) + fix e::real assume "0 < e" + from tendstoD[OF LIMSEQ_power_zero[OF \norm x < 1\] \0 < e\] + have "\\<^sub>F xa in sequentially. norm (x ^ xa) < e" + by simp + then obtain N where N: "norm (x ^ n) < e" if "n \ N" for n + by (auto simp: eventually_sequentially) + have "\\<^sub>F i in F. f i \ N" + using \filterlim f sequentially F\ + by (simp add: filterlim_at_top) + then show "\\<^sub>F i in F. dist (x ^ f i) 0 < e" + by (eventually_elim) (auto simp: N) +qed + text \Limit of @{term "c^n"} for @{term"\c\ < 1"}.\ lemma LIMSEQ_rabs_realpow_zero: "\c\ < 1 \ (\n. \c\ ^ n :: real) \ 0" diff -r d00db72d8697 -r 36e9732988ce src/HOL/Multivariate_Analysis/Complex_Transcendental.thy --- a/src/HOL/Multivariate_Analysis/Complex_Transcendental.thy Sun Jul 24 16:48:41 2016 +0200 +++ b/src/HOL/Multivariate_Analysis/Complex_Transcendental.thy Thu Jul 28 17:16:16 2016 +0200 @@ -2397,6 +2397,47 @@ lemma abs_tan_ge: "\x\ < pi/2 \ \x\ \ \tan x\" by (metis abs_arctan_le abs_less_iff arctan_tan minus_less_iff) +lemma arctan_bounds: + assumes "0 \ x" "x < 1" + shows arctan_lower_bound: + "(\k<2 * n. (- 1) ^ k * (1 / real (k * 2 + 1) * x ^ (k * 2 + 1))) \ arctan x" + (is "(\k<_. (- 1)^ k * ?a k) \ _") + and arctan_upper_bound: + "arctan x \ (\k<2 * n + 1. (- 1) ^ k * (1 / real (k * 2 + 1) * x ^ (k * 2 + 1)))" +proof - + have tendsto_zero: "?a \ 0" + using assms + apply - + apply (rule tendsto_eq_rhs[where x="0 * 0"]) + subgoal by (intro tendsto_mult real_tendsto_divide_at_top) + (auto simp: filterlim_real_sequentially filterlim_sequentially_iff_filterlim_real + intro!: real_tendsto_divide_at_top tendsto_power_zero filterlim_real_sequentially + tendsto_eq_intros filterlim_at_top_mult_tendsto_pos filterlim_tendsto_add_at_top) + subgoal by simp + done + have nonneg: "0 \ ?a n" for n + by (force intro!: divide_nonneg_nonneg mult_nonneg_nonneg zero_le_power assms) + have le: "?a (Suc n) \ ?a n" for n + by (rule mult_mono[OF _ power_decreasing]) (auto simp: divide_simps assms less_imp_le) + from summable_Leibniz'(4)[of ?a, OF tendsto_zero nonneg le, of n] + summable_Leibniz'(2)[of ?a, OF tendsto_zero nonneg le, of n] + assms + show "(\k<2*n. (- 1)^ k * ?a k) \ arctan x" "arctan x \ (\k<2 * n + 1. (- 1)^ k * ?a k)" + by (auto simp: arctan_series) +qed + +subsection \Bounds on pi using real arctangent\ + +lemma pi_machin: "pi = 16 * arctan (1 / 5) - 4 * arctan (1 / 239)" + using machin + by simp + +lemma pi_approx: "3.141592653588 \ pi" "pi \ 3.1415926535899" + unfolding pi_machin + using arctan_bounds[of "1/5" 4] + arctan_bounds[of "1/239" 4] + by (simp_all add: eval_nat_numeral) + subsection\Inverse Sine\ diff -r d00db72d8697 -r 36e9732988ce src/HOL/Real_Vector_Spaces.thy --- a/src/HOL/Real_Vector_Spaces.thy Sun Jul 24 16:48:41 2016 +0200 +++ b/src/HOL/Real_Vector_Spaces.thy Thu Jul 28 17:16:16 2016 +0200 @@ -1766,6 +1766,31 @@ apply linarith done +lemma filterlim_nat_sequentially: "filterlim nat sequentially at_top" + unfolding filterlim_at_top + apply (rule allI) + subgoal for Z by (auto intro!: eventually_at_top_linorderI[where c="int Z"]) + done + +lemma filterlim_floor_sequentially: "filterlim floor at_top at_top" + unfolding filterlim_at_top + apply (rule allI) + subgoal for Z by (auto simp: le_floor_iff intro!: eventually_at_top_linorderI[where c="of_int Z"]) + done + +lemma filterlim_sequentially_iff_filterlim_real: + "filterlim f sequentially F \ filterlim (\x. real (f x)) at_top F" + apply (rule iffI) + subgoal using filterlim_compose filterlim_real_sequentially by blast + subgoal premises prems + proof - + have "filterlim (\x. nat (floor (real (f x)))) sequentially F" + by (intro filterlim_compose[OF filterlim_nat_sequentially] + filterlim_compose[OF filterlim_floor_sequentially] prems) + then show ?thesis by simp + qed + done + subsubsection \Limits of Sequences\