data.real.pi.leibniz ⟷
Mathlib.Data.Real.Pi.Leibniz
The following section lists changes to this file in mathlib3 and mathlib4 that occured after the initial port. Most recent changes are shown first. Hovering over a commit will show all commits associated with the same mathlib3 commit.
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(last sync)
mathlib commit https://github.com/leanprover-community/mathlib/commit/65a1391a0106c9204fe45bc73a039f056558cb83
@@ -57,9 +57,9 @@ theorem tendsto_sum_pi_div_four :
convert
(((tendsto_rpow_div_mul_add (-1) 2 1 two_ne_zero.symm).neg.const_add 1).add
tendsto_inv_atTop_zero).comp
- tendsto_nat_cast_atTop_atTop
+ tendsto_natCast_atTop_atTop
· ext k
- simp only [NNReal.coe_nat_cast, Function.comp_apply, NNReal.coe_rpow]
+ simp only [NNReal.coe_natCast, Function.comp_apply, NNReal.coe_rpow]
rw [← rpow_mul (Nat.cast_nonneg k) (-1 / (2 * (k : ℝ) + 1)) (2 * (k : ℝ) + 1),
@div_mul_cancel₀ _ _ (2 * (k : ℝ) + 1) _
(by norm_cast; simp only [Nat.succ_ne_zero, not_false_iff]),
mathlib commit https://github.com/leanprover-community/mathlib/commit/65a1391a0106c9204fe45bc73a039f056558cb83
@@ -61,7 +61,7 @@ theorem tendsto_sum_pi_div_four :
· ext k
simp only [NNReal.coe_nat_cast, Function.comp_apply, NNReal.coe_rpow]
rw [← rpow_mul (Nat.cast_nonneg k) (-1 / (2 * (k : ℝ) + 1)) (2 * (k : ℝ) + 1),
- @div_mul_cancel _ _ (2 * (k : ℝ) + 1) _
+ @div_mul_cancel₀ _ _ (2 * (k : ℝ) + 1) _
(by norm_cast; simp only [Nat.succ_ne_zero, not_false_iff]),
rpow_neg_one k, sub_eq_add_neg]
· simp only [add_zero, add_right_neg]
@@ -105,7 +105,7 @@ theorem tendsto_sum_pi_div_four :
ring
· simp only [Nat.add_succ_sub_one, add_zero, mul_one, id.def, Nat.cast_bit0, Nat.cast_add,
Nat.cast_one, Nat.cast_mul]
- rw [← mul_assoc, @div_mul_cancel _ _ (2 * (i : ℝ) + 1) _ (by norm_cast; linarith),
+ rw [← mul_assoc, @div_mul_cancel₀ _ _ (2 * (i : ℝ) + 1) _ (by norm_cast; linarith),
pow_mul x 2 i, ← mul_pow (-1) (x ^ 2) i]
ring_nf
convert (has_deriv_at_arctan x).sub (HasDerivAt.sum has_deriv_at_b)
@@ -151,7 +151,7 @@ theorem tendsto_sum_pi_div_four :
_ ≤ 1 * (1 - U) + U ^ (2 * k) * (U - 0) :=
(le_trans (abs_add (f 1 - f U) (f U - f 0)) (add_le_add mvt1 mvt2))
_ = 1 - U + U ^ (2 * k) * U := by ring
- _ = 1 - u k + u k ^ (2 * (k : ℝ) + 1) := by rw [← pow_succ' (U : ℝ) (2 * k)]; norm_cast
+ _ = 1 - u k + u k ^ (2 * (k : ℝ) + 1) := by rw [← pow_succ (U : ℝ) (2 * k)]; norm_cast
#align real.tendsto_sum_pi_div_four Real.tendsto_sum_pi_div_four
-/
mathlib commit https://github.com/leanprover-community/mathlib/commit/65a1391a0106c9204fe45bc73a039f056558cb83
@@ -132,15 +132,15 @@ theorem tendsto_sum_pi_div_four :
by
rintro x ⟨hx_left, hx_right⟩
have hincr := pow_le_pow_left (le_trans hU2 hx_left) (le_of_lt hx_right) (2 * k)
- rw [one_pow (2 * k), ← abs_of_nonneg (le_trans hU2 hx_left)] at hincr
- rw [← abs_of_nonneg (le_trans hU2 hx_left)] at hx_right
+ rw [one_pow (2 * k), ← abs_of_nonneg (le_trans hU2 hx_left)] at hincr
+ rw [← abs_of_nonneg (le_trans hU2 hx_left)] at hx_right
linarith [f'_bound x (mem_Icc.mpr (abs_le.mp (le_of_lt hx_right)))]
have hbound2 : ∀ x ∈ Ico 0 (U : ℝ), |f' x| ≤ U ^ (2 * k) :=
by
rintro x ⟨hx_left, hx_right⟩
have hincr := pow_le_pow_left hx_left (le_of_lt hx_right) (2 * k)
- rw [← abs_of_nonneg hx_left] at hincr hx_right
- rw [← abs_of_nonneg hU2] at hU1 hx_right
+ rw [← abs_of_nonneg hx_left] at hincr hx_right
+ rw [← abs_of_nonneg hU2] at hU1 hx_right
linarith [f'_bound x (mem_Icc.mpr (abs_le.mp (le_trans (le_of_lt hx_right) hU1)))]
-- (6) We twice apply the Mean Value Theorem to obtain bounds on `f` from the bounds on `f'`
have mvt1 := norm_image_sub_le_of_norm_deriv_le_segment' hderiv1 hbound1 _ (right_mem_Icc.mpr hU1)
mathlib commit https://github.com/leanprover-community/mathlib/commit/65a1391a0106c9204fe45bc73a039f056558cb83
@@ -131,14 +131,14 @@ theorem tendsto_sum_pi_div_four :
have hbound1 : ∀ x ∈ Ico (U : ℝ) 1, |f' x| ≤ 1 :=
by
rintro x ⟨hx_left, hx_right⟩
- have hincr := pow_le_pow_of_le_left (le_trans hU2 hx_left) (le_of_lt hx_right) (2 * k)
+ have hincr := pow_le_pow_left (le_trans hU2 hx_left) (le_of_lt hx_right) (2 * k)
rw [one_pow (2 * k), ← abs_of_nonneg (le_trans hU2 hx_left)] at hincr
rw [← abs_of_nonneg (le_trans hU2 hx_left)] at hx_right
linarith [f'_bound x (mem_Icc.mpr (abs_le.mp (le_of_lt hx_right)))]
have hbound2 : ∀ x ∈ Ico 0 (U : ℝ), |f' x| ≤ U ^ (2 * k) :=
by
rintro x ⟨hx_left, hx_right⟩
- have hincr := pow_le_pow_of_le_left hx_left (le_of_lt hx_right) (2 * k)
+ have hincr := pow_le_pow_left hx_left (le_of_lt hx_right) (2 * k)
rw [← abs_of_nonneg hx_left] at hincr hx_right
rw [← abs_of_nonneg hU2] at hU1 hx_right
linarith [f'_bound x (mem_Icc.mpr (abs_le.mp (le_trans (le_of_lt hx_right) hU1)))]
mathlib commit https://github.com/leanprover-community/mathlib/commit/ce64cd319bb6b3e82f31c2d38e79080d377be451
@@ -3,7 +3,7 @@ Copyright (c) 2020 Benjamin Davidson. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Benjamin Davidson
-/
-import Mathbin.Analysis.SpecialFunctions.Trigonometric.ArctanDeriv
+import Analysis.SpecialFunctions.Trigonometric.ArctanDeriv
#align_import data.real.pi.leibniz from "leanprover-community/mathlib"@"7e5137f579de09a059a5ce98f364a04e221aabf0"
mathlib commit https://github.com/leanprover-community/mathlib/commit/442a83d738cb208d3600056c489be16900ba701d
@@ -48,7 +48,7 @@ local notation "|" x "|" => abs x
theorem tendsto_sum_pi_div_four :
Tendsto (fun k => ∑ i in Finset.range k, (-(1 : ℝ)) ^ i / (2 * i + 1)) atTop (𝓝 (π / 4)) :=
by
- rw [tendsto_iff_norm_tendsto_zero, ← tendsto_zero_iff_norm_tendsto_zero]
+ rw [tendsto_iff_norm_sub_tendsto_zero, ← tendsto_zero_iff_norm_tendsto_zero]
-- (1) We introduce a useful sequence `u` of values in [0,1], then prove that another sequence
-- constructed from `u` tends to `0` at `+∞`
let u := fun k : ℕ => (k : NNReal) ^ (-1 / (2 * (k : ℝ) + 1))
mathlib commit https://github.com/leanprover-community/mathlib/commit/8ea5598db6caeddde6cb734aa179cc2408dbd345
@@ -2,14 +2,11 @@
Copyright (c) 2020 Benjamin Davidson. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Benjamin Davidson
-
-! This file was ported from Lean 3 source module data.real.pi.leibniz
-! leanprover-community/mathlib commit 7e5137f579de09a059a5ce98f364a04e221aabf0
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
-/
import Mathbin.Analysis.SpecialFunctions.Trigonometric.ArctanDeriv
+#align_import data.real.pi.leibniz from "leanprover-community/mathlib"@"7e5137f579de09a059a5ce98f364a04e221aabf0"
+
/-! ### Leibniz's Series for Pi
> THIS FILE IS SYNCHRONIZED WITH MATHLIB4.
mathlib commit https://github.com/leanprover-community/mathlib/commit/9fb8964792b4237dac6200193a0d533f1b3f7423
@@ -22,9 +22,9 @@ open Filter Set
open scoped Classical BigOperators Topology Real
--- mathport name: abs
local notation "|" x "|" => abs x
+#print Real.tendsto_sum_pi_div_four /-
/-- This theorem establishes **Leibniz's series for `π`**: The alternating sum of the reciprocals
of the odd numbers is `π/4`. Note that this is a conditionally rather than absolutely convergent
series. The main tool that this proof uses is the Mean Value Theorem (specifically avoiding the
@@ -156,6 +156,7 @@ theorem tendsto_sum_pi_div_four :
_ = 1 - U + U ^ (2 * k) * U := by ring
_ = 1 - u k + u k ^ (2 * (k : ℝ) + 1) := by rw [← pow_succ' (U : ℝ) (2 * k)]; norm_cast
#align real.tendsto_sum_pi_div_four Real.tendsto_sum_pi_div_four
+-/
end Real
mathlib commit https://github.com/leanprover-community/mathlib/commit/7e5137f579de09a059a5ce98f364a04e221aabf0
@@ -155,7 +155,6 @@ theorem tendsto_sum_pi_div_four :
(le_trans (abs_add (f 1 - f U) (f U - f 0)) (add_le_add mvt1 mvt2))
_ = 1 - U + U ^ (2 * k) * U := by ring
_ = 1 - u k + u k ^ (2 * (k : ℝ) + 1) := by rw [← pow_succ' (U : ℝ) (2 * k)]; norm_cast
-
#align real.tendsto_sum_pi_div_four Real.tendsto_sum_pi_div_four
end Real
mathlib commit https://github.com/leanprover-community/mathlib/commit/7e5137f579de09a059a5ce98f364a04e221aabf0
@@ -4,13 +4,16 @@ Released under Apache 2.0 license as described in the file LICENSE.
Authors: Benjamin Davidson
! This file was ported from Lean 3 source module data.real.pi.leibniz
-! leanprover-community/mathlib commit f2ce6086713c78a7f880485f7917ea547a215982
+! leanprover-community/mathlib commit 7e5137f579de09a059a5ce98f364a04e221aabf0
! Please do not edit these lines, except to modify the commit id
! if you have ported upstream changes.
-/
import Mathbin.Analysis.SpecialFunctions.Trigonometric.ArctanDeriv
-/-! ### Leibniz's Series for Pi -/
+/-! ### Leibniz's Series for Pi
+
+> THIS FILE IS SYNCHRONIZED WITH MATHLIB4.
+> Any changes to this file require a corresponding PR to mathlib4.-/
namespace Real
mathlib commit https://github.com/leanprover-community/mathlib/commit/5f25c089cb34db4db112556f23c50d12da81b297
@@ -54,7 +54,8 @@ theorem tendsto_sum_pi_div_four :
let u := fun k : ℕ => (k : NNReal) ^ (-1 / (2 * (k : ℝ) + 1))
have H : tendsto (fun k : ℕ => (1 : ℝ) - u k + u k ^ (2 * (k : ℝ) + 1)) at_top (𝓝 0) :=
by
- convert(((tendsto_rpow_div_mul_add (-1) 2 1 two_ne_zero.symm).neg.const_add 1).add
+ convert
+ (((tendsto_rpow_div_mul_add (-1) 2 1 two_ne_zero.symm).neg.const_add 1).add
tendsto_inv_atTop_zero).comp
tendsto_nat_cast_atTop_atTop
· ext k
@@ -96,7 +97,8 @@ theorem tendsto_sum_pi_div_four :
have has_deriv_at_b : ∀ i ∈ Finset.range k, HasDerivAt (b i) ((-x ^ 2) ^ i) x :=
by
intro i hi
- convert HasDerivAt.const_mul ((-1 : ℝ) ^ i / (2 * i + 1))
+ convert
+ HasDerivAt.const_mul ((-1 : ℝ) ^ i / (2 * i + 1))
(@HasDerivAt.pow _ _ _ _ _ (2 * i + 1) (hasDerivAt_id x))
· ext y
simp only [b, id.def]
@@ -106,7 +108,7 @@ theorem tendsto_sum_pi_div_four :
rw [← mul_assoc, @div_mul_cancel _ _ (2 * (i : ℝ) + 1) _ (by norm_cast; linarith),
pow_mul x 2 i, ← mul_pow (-1) (x ^ 2) i]
ring_nf
- convert(has_deriv_at_arctan x).sub (HasDerivAt.sum has_deriv_at_b)
+ convert (has_deriv_at_arctan x).sub (HasDerivAt.sum has_deriv_at_b)
have g_sum :=
@geom_sum_eq _ _ (-x ^ 2) ((neg_nonpos.mpr (sq_nonneg x)).trans_lt zero_lt_one).Ne k
simp only [f'] at g_sum ⊢
mathlib commit https://github.com/leanprover-community/mathlib/commit/cca40788df1b8755d5baf17ab2f27dacc2e17acb
@@ -109,7 +109,7 @@ theorem tendsto_sum_pi_div_four :
convert(has_deriv_at_arctan x).sub (HasDerivAt.sum has_deriv_at_b)
have g_sum :=
@geom_sum_eq _ _ (-x ^ 2) ((neg_nonpos.mpr (sq_nonneg x)).trans_lt zero_lt_one).Ne k
- simp only [f'] at g_sum⊢
+ simp only [f'] at g_sum ⊢
rw [g_sum, ← neg_add' (x ^ 2) 1, add_comm (x ^ 2) 1, sub_eq_add_neg, neg_div', neg_div_neg_eq]
ring
have hderiv1 : ∀ x ∈ Icc (U : ℝ) 1, HasDerivWithinAt f (f' x) (Icc (U : ℝ) 1) x := fun x hx =>
@@ -130,15 +130,15 @@ theorem tendsto_sum_pi_div_four :
by
rintro x ⟨hx_left, hx_right⟩
have hincr := pow_le_pow_of_le_left (le_trans hU2 hx_left) (le_of_lt hx_right) (2 * k)
- rw [one_pow (2 * k), ← abs_of_nonneg (le_trans hU2 hx_left)] at hincr
- rw [← abs_of_nonneg (le_trans hU2 hx_left)] at hx_right
+ rw [one_pow (2 * k), ← abs_of_nonneg (le_trans hU2 hx_left)] at hincr
+ rw [← abs_of_nonneg (le_trans hU2 hx_left)] at hx_right
linarith [f'_bound x (mem_Icc.mpr (abs_le.mp (le_of_lt hx_right)))]
have hbound2 : ∀ x ∈ Ico 0 (U : ℝ), |f' x| ≤ U ^ (2 * k) :=
by
rintro x ⟨hx_left, hx_right⟩
have hincr := pow_le_pow_of_le_left hx_left (le_of_lt hx_right) (2 * k)
- rw [← abs_of_nonneg hx_left] at hincr hx_right
- rw [← abs_of_nonneg hU2] at hU1 hx_right
+ rw [← abs_of_nonneg hx_left] at hincr hx_right
+ rw [← abs_of_nonneg hU2] at hU1 hx_right
linarith [f'_bound x (mem_Icc.mpr (abs_le.mp (le_trans (le_of_lt hx_right) hU1)))]
-- (6) We twice apply the Mean Value Theorem to obtain bounds on `f` from the bounds on `f'`
have mvt1 := norm_image_sub_le_of_norm_deriv_le_segment' hderiv1 hbound1 _ (right_mem_Icc.mpr hU1)
mathlib commit https://github.com/leanprover-community/mathlib/commit/917c3c072e487b3cccdbfeff17e75b40e45f66cb
@@ -17,7 +17,7 @@ namespace Real
open Filter Set
-open Classical BigOperators Topology Real
+open scoped Classical BigOperators Topology Real
-- mathport name: abs
local notation "|" x "|" => abs x
mathlib commit https://github.com/leanprover-community/mathlib/commit/917c3c072e487b3cccdbfeff17e75b40e45f66cb
@@ -61,9 +61,7 @@ theorem tendsto_sum_pi_div_four :
simp only [NNReal.coe_nat_cast, Function.comp_apply, NNReal.coe_rpow]
rw [← rpow_mul (Nat.cast_nonneg k) (-1 / (2 * (k : ℝ) + 1)) (2 * (k : ℝ) + 1),
@div_mul_cancel _ _ (2 * (k : ℝ) + 1) _
- (by
- norm_cast
- simp only [Nat.succ_ne_zero, not_false_iff]),
+ (by norm_cast; simp only [Nat.succ_ne_zero, not_false_iff]),
rpow_neg_one k, sub_eq_add_neg]
· simp only [add_zero, add_right_neg]
-- (2) We convert the limit in our goal to an inequality
@@ -77,8 +75,7 @@ theorem tendsto_sum_pi_div_four :
suffices f_bound : |f 1 - f 0| ≤ (1 : ℝ) - U + U ^ (2 * (k : ℝ) + 1)
· rw [← norm_neg]
convert f_bound
- simp only [f]
- simp [b]
+ simp only [f]; simp [b]
-- We show that `U` is indeed in [0,1]
have hU1 : (U : ℝ) ≤ 1 := by
by_cases hk : k = 0
@@ -86,14 +83,10 @@ theorem tendsto_sum_pi_div_four :
·
exact
rpow_le_one_of_one_le_of_nonpos
- (by
- norm_cast
- exact nat.succ_le_iff.mpr (Nat.pos_of_ne_zero hk))
+ (by norm_cast; exact nat.succ_le_iff.mpr (Nat.pos_of_ne_zero hk))
(le_of_lt
(@div_neg_of_neg_of_pos _ _ (-(1 : ℝ)) (2 * k + 1) (neg_neg_iff_pos.mpr zero_lt_one)
- (by
- norm_cast
- exact Nat.succ_pos')))
+ (by norm_cast; exact Nat.succ_pos')))
have hU2 := NNReal.coe_nonneg U
-- (4) We compute the derivative of `f`, denoted by `f'`
let f' := fun x : ℝ => (-x ^ 2) ^ k / (1 + x ^ 2)
@@ -110,11 +103,7 @@ theorem tendsto_sum_pi_div_four :
ring
· simp only [Nat.add_succ_sub_one, add_zero, mul_one, id.def, Nat.cast_bit0, Nat.cast_add,
Nat.cast_one, Nat.cast_mul]
- rw [← mul_assoc,
- @div_mul_cancel _ _ (2 * (i : ℝ) + 1) _
- (by
- norm_cast
- linarith),
+ rw [← mul_assoc, @div_mul_cancel _ _ (2 * (i : ℝ) + 1) _ (by norm_cast; linarith),
pow_mul x 2 i, ← mul_pow (-1) (x ^ 2) i]
ring_nf
convert(has_deriv_at_arctan x).sub (HasDerivAt.sum has_deriv_at_b)
@@ -160,10 +149,7 @@ theorem tendsto_sum_pi_div_four :
_ ≤ 1 * (1 - U) + U ^ (2 * k) * (U - 0) :=
(le_trans (abs_add (f 1 - f U) (f U - f 0)) (add_le_add mvt1 mvt2))
_ = 1 - U + U ^ (2 * k) * U := by ring
- _ = 1 - u k + u k ^ (2 * (k : ℝ) + 1) :=
- by
- rw [← pow_succ' (U : ℝ) (2 * k)]
- norm_cast
+ _ = 1 - u k + u k ^ (2 * (k : ℝ) + 1) := by rw [← pow_succ' (U : ℝ) (2 * k)]; norm_cast
#align real.tendsto_sum_pi_div_four Real.tendsto_sum_pi_div_four
mathlib commit https://github.com/leanprover-community/mathlib/commit/ce7e9d53d4bbc38065db3b595cd5bd73c323bc1d
@@ -54,8 +54,7 @@ theorem tendsto_sum_pi_div_four :
let u := fun k : ℕ => (k : NNReal) ^ (-1 / (2 * (k : ℝ) + 1))
have H : tendsto (fun k : ℕ => (1 : ℝ) - u k + u k ^ (2 * (k : ℝ) + 1)) at_top (𝓝 0) :=
by
- convert
- (((tendsto_rpow_div_mul_add (-1) 2 1 two_ne_zero.symm).neg.const_add 1).add
+ convert(((tendsto_rpow_div_mul_add (-1) 2 1 two_ne_zero.symm).neg.const_add 1).add
tendsto_inv_atTop_zero).comp
tendsto_nat_cast_atTop_atTop
· ext k
@@ -104,8 +103,7 @@ theorem tendsto_sum_pi_div_four :
have has_deriv_at_b : ∀ i ∈ Finset.range k, HasDerivAt (b i) ((-x ^ 2) ^ i) x :=
by
intro i hi
- convert
- HasDerivAt.const_mul ((-1 : ℝ) ^ i / (2 * i + 1))
+ convert HasDerivAt.const_mul ((-1 : ℝ) ^ i / (2 * i + 1))
(@HasDerivAt.pow _ _ _ _ _ (2 * i + 1) (hasDerivAt_id x))
· ext y
simp only [b, id.def]
@@ -119,7 +117,7 @@ theorem tendsto_sum_pi_div_four :
linarith),
pow_mul x 2 i, ← mul_pow (-1) (x ^ 2) i]
ring_nf
- convert (has_deriv_at_arctan x).sub (HasDerivAt.sum has_deriv_at_b)
+ convert(has_deriv_at_arctan x).sub (HasDerivAt.sum has_deriv_at_b)
have g_sum :=
@geom_sum_eq _ _ (-x ^ 2) ((neg_nonpos.mpr (sq_nonneg x)).trans_lt zero_lt_one).Ne k
simp only [f'] at g_sum⊢
mathlib commit https://github.com/leanprover-community/mathlib/commit/4c586d291f189eecb9d00581aeb3dd998ac34442
@@ -160,7 +160,7 @@ theorem tendsto_sum_pi_div_four :
calc
|f 1 - f 0| = |f 1 - f U + (f U - f 0)| := by ring_nf
_ ≤ 1 * (1 - U) + U ^ (2 * k) * (U - 0) :=
- le_trans (abs_add (f 1 - f U) (f U - f 0)) (add_le_add mvt1 mvt2)
+ (le_trans (abs_add (f 1 - f U) (f U - f 0)) (add_le_add mvt1 mvt2))
_ = 1 - U + U ^ (2 * k) * U := by ring
_ = 1 - u k + u k ^ (2 * (k : ℝ) + 1) :=
by
mathlib commit https://github.com/leanprover-community/mathlib/commit/bd9851ca476957ea4549eb19b40e7b5ade9428cc
nat_cast/int_cast/rat_cast to natCast/intCast/ratCast (#11486)
Now that I am defining NNRat.cast, I want a definitive answer to this naming issue. Plenty of lemmas in mathlib already use natCast/intCast/ratCast over nat_cast/int_cast/rat_cast, and this matches with the general expectation that underscore-separated name parts correspond to a single declaration.
@@ -26,7 +26,7 @@ theorem tendsto_sum_pi_div_four :
apply Antitone.tendsto_alternating_series_of_tendsto_zero
· exact antitone_iff_forall_lt.mpr fun _ _ _ ↦ by gcongr
· apply Tendsto.inv_tendsto_atTop; apply tendsto_atTop_add_const_right
- exact tendsto_nat_cast_atTop_atTop.const_mul_atTop zero_lt_two
+ exact tendsto_natCast_atTop_atTop.const_mul_atTop zero_lt_two
-- Abel's limit theorem states that the corresponding power series has the same limit as `x → 1⁻`
have abel := tendsto_tsum_powerSeries_nhdsWithin_lt h
-- Massage the expression to get `x ^ (2 * n + 1)` in the tsum rather than `x ^ n`...
We change the following field in the definition of an additive commutative monoid:
nsmul_succ : ∀ (n : ℕ) (x : G),
- AddMonoid.nsmul (n + 1) x = x + AddMonoid.nsmul n x
+ AddMonoid.nsmul (n + 1) x = AddMonoid.nsmul n x + x
where the latter is more natural
We adjust the definitions of ^ in monoids, groups, etc.
Originally there was a warning comment about why this natural order was preferred
use
x * npowRec n xand notnpowRec n x * xin the definition to make sure that definitional unfolding ofnpowRecis blocked, to avoid deep recursion issues.
but it seems to no longer apply.
Remarks on the PR :
pow_succ and pow_succ' have switched their meanings.Ideal.IsPrime.mul_mem_pow which is defined in [Mathlib/RingTheory/DedekindDomain/Ideal.lean]. Changing the order of operation forced me to add the symmetric lemma Ideal.IsPrime.mem_pow_mul.@@ -51,7 +51,7 @@ theorem tendsto_sum_pi_div_four :
rw [Set.mem_Iio] at hy2
have ny : ‖y‖ < 1 := by rw [norm_eq_abs, abs_lt]; constructor <;> linarith
rw [← (hasSum_arctan ny).tsum_eq, Function.comp_apply, ← tsum_mul_right]
- simp_rw [mul_assoc, ← pow_mul, ← pow_succ', div_mul_eq_mul_div]
+ simp_rw [mul_assoc, ← pow_mul, ← pow_succ, div_mul_eq_mul_div]
norm_cast
-- But `arctan` is continuous everywhere, so the limit is `arctan 1 = π / 4`
rwa [tendsto_nhds_unique abel ((continuous_arctan.tendsto 1).mono_left m), arctan_one] at h
@@ -1,7 +1,7 @@
/-
Copyright (c) 2020 Benjamin Davidson. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
-Authors: Benjamin Davidson
+Authors: Benjamin Davidson, Jeremy Tan
-/
import Mathlib.Analysis.Complex.AbelLimit
import Mathlib.Analysis.SpecialFunctions.Complex.Arctan
@@ -3,136 +3,58 @@ Copyright (c) 2020 Benjamin Davidson. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Benjamin Davidson
-/
-import Mathlib.Analysis.SpecialFunctions.Trigonometric.ArctanDeriv
-import Mathlib.Analysis.SpecialFunctions.Pow.Asymptotics
+import Mathlib.Analysis.Complex.AbelLimit
+import Mathlib.Analysis.SpecialFunctions.Complex.Arctan
#align_import data.real.pi.leibniz from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
-/-! ### Leibniz's Series for Pi -/
-
+/-! ### Leibniz's series for `π` -/
namespace Real
-open Filter Set
-
-open scoped Classical BigOperators Topology Real
-
-/-- This theorem establishes **Leibniz's series for `π`**: The alternating sum of the reciprocals
- of the odd numbers is `π/4`. Note that this is a conditionally rather than absolutely convergent
- series. The main tool that this proof uses is the Mean Value Theorem (specifically avoiding the
- Fundamental Theorem of Calculus).
-
- Intuitively, the theorem holds because Leibniz's series is the Taylor series of `arctan x`
- centered about `0` and evaluated at the value `x = 1`. Therefore, much of this proof consists of
- reasoning about a function
- `f := arctan x - ∑ i in Finset.range k, (-(1:ℝ))^i * x^(2*i+1) / (2*i+1)`,
- the difference between `arctan` and the `k`-th partial sum of its Taylor series. Some ingenuity is
- required due to the fact that the Taylor series is not absolutely convergent at `x = 1`.
+open Filter Finset
- This proof requires a bound on `f 1`, the key idea being that `f 1` can be split as the sum of
- `f 1 - f u` and `f u`, where `u` is a sequence of values in [0,1], carefully chosen such that
- each of these two terms can be controlled (in different ways).
+open scoped BigOperators Topology
- We begin the proof by (1) introducing that sequence `u` and then proving that another sequence
- constructed from `u` tends to `0` at `+∞`. After (2) converting the limit in our goal to an
- inequality, we (3) introduce the auxiliary function `f` defined above. Next, we (4) compute the
- derivative of `f`, denoted by `f'`, first generally and then on each of two subintervals of [0,1].
- We then (5) prove a bound for `f'`, again both generally as well as on each of the two
- subintervals. Finally, we (6) apply the Mean Value Theorem twice, obtaining bounds on `f 1 - f u`
- and `f u - f 0` from the bounds on `f'` (note that `f 0 = 0`). -/
+/-- **Leibniz's series for `π`**. The alternating sum of odd number reciprocals is `π / 4`,
+proved by using Abel's limit theorem to extend the Maclaurin series of `arctan` to 1. -/
theorem tendsto_sum_pi_div_four :
- Tendsto (fun k => ∑ i in Finset.range k, (-(1 : ℝ)) ^ i / (2 * i + 1)) atTop (𝓝 (π / 4)) := by
- rw [tendsto_iff_norm_sub_tendsto_zero, ← tendsto_zero_iff_norm_tendsto_zero]
- -- (1) We introduce a useful sequence `u` of values in [0,1], then prove that another sequence
- -- constructed from `u` tends to `0` at `+∞`
- let u := fun k : ℕ => (k : NNReal) ^ (-1 / (2 * (k : ℝ) + 1))
- have H : Tendsto (fun k : ℕ => (1 : ℝ) - u k + u k ^ (2 * (k : ℝ) + 1)) atTop (𝓝 0) := by
- convert (((tendsto_rpow_div_mul_add (-1) 2 1 two_ne_zero.symm).neg.const_add 1).add
- tendsto_inv_atTop_zero).comp tendsto_nat_cast_atTop_atTop using 1
- · ext k
- simp only [u, NNReal.coe_nat_cast, Function.comp_apply, NNReal.coe_rpow]
- rw [← rpow_mul (Nat.cast_nonneg k) (-1 / (2 * (k : ℝ) + 1)) (2 * (k : ℝ) + 1),
- @div_mul_cancel _ _ (2 * (k : ℝ) + 1) _
- (by norm_cast; simp only [Nat.succ_ne_zero, not_false_iff]),
- rpow_neg_one k, sub_eq_add_neg]
- · simp only [add_zero, add_right_neg]
- -- (2) We convert the limit in our goal to an inequality
- refine' squeeze_zero_norm _ H
- intro k
- -- Since `k` is now fixed, we henceforth denote `u k` as `U`
- let U := u k
- -- (3) We introduce an auxiliary function `f`
- let b (i : ℕ) x := (-(1 : ℝ)) ^ i * x ^ (2 * i + 1) / (2 * i + 1)
- let f x := arctan x - ∑ i in Finset.range k, b i x
- suffices f_bound : |f 1 - f 0| ≤ (1 : ℝ) - U + U ^ (2 * (k : ℝ) + 1) by
- rw [← norm_neg]
- convert f_bound using 1
- simp [b, f]
- -- We show that `U` is indeed in [0,1]
- have hU1 : (U : ℝ) ≤ 1 := by
- by_cases hk : k = 0
- · simp [U, u, hk]
- · exact rpow_le_one_of_one_le_of_nonpos
- (by norm_cast; exact Nat.succ_le_iff.mpr (Nat.pos_of_ne_zero hk)) (le_of_lt
- (@div_neg_of_neg_of_pos _ _ (-(1 : ℝ)) (2 * k + 1) (neg_neg_iff_pos.mpr zero_lt_one)
- (by norm_cast; exact Nat.succ_pos')))
- have hU2 := NNReal.coe_nonneg U
- -- (4) We compute the derivative of `f`, denoted by `f'`
- let f' := fun x : ℝ => (-x ^ 2) ^ k / (1 + x ^ 2)
- have has_deriv_at_f : ∀ x, HasDerivAt f (f' x) x := by
- intro x
- have has_deriv_at_b : ∀ i ∈ Finset.range k, HasDerivAt (b i) ((-x ^ 2) ^ i) x := by
- intro i _
- convert HasDerivAt.const_mul ((-1 : ℝ) ^ i / (2 * i + 1))
- (HasDerivAt.pow (2 * i + 1) (hasDerivAt_id x)) using 1
- · ext y
- simp only [id.def]
- ring
- · simp
- rw [← mul_assoc, @div_mul_cancel _ _ (2 * (i : ℝ) + 1) _ (by norm_cast; omega),
- pow_mul x 2 i, ← mul_pow (-1 : ℝ) (x ^ 2) i]
- ring_nf
- convert (hasDerivAt_arctan x).sub (HasDerivAt.sum has_deriv_at_b) using 1
- have g_sum :=
- @geom_sum_eq _ _ (-x ^ 2) ((neg_nonpos.mpr (sq_nonneg x)).trans_lt zero_lt_one).ne k
- simp only at g_sum ⊢
- rw [g_sum, ← neg_add' (x ^ 2) 1, add_comm (x ^ 2) 1, sub_eq_add_neg, neg_div', neg_div_neg_eq]
- ring
- have hderiv1 : ∀ x ∈ Icc (U : ℝ) 1, HasDerivWithinAt f (f' x) (Icc (U : ℝ) 1) x := fun x _ =>
- (has_deriv_at_f x).hasDerivWithinAt
- have hderiv2 : ∀ x ∈ Icc 0 (U : ℝ), HasDerivWithinAt f (f' x) (Icc 0 (U : ℝ)) x := fun x _ =>
- (has_deriv_at_f x).hasDerivWithinAt
- -- (5) We prove a general bound for `f'` and then more precise bounds on each of two subintervals
- have f'_bound : ∀ x ∈ Icc (-1 : ℝ) 1, |f' x| ≤ |x| ^ (2 * k) := by
- intro x _
- rw [abs_div, IsAbsoluteValue.abv_pow abs (-x ^ 2) k, abs_neg, IsAbsoluteValue.abv_pow abs x 2,
- ← pow_mul]
- refine' div_le_of_nonneg_of_le_mul (abs_nonneg _) (pow_nonneg (abs_nonneg _) _) _
- refine' le_mul_of_one_le_right (pow_nonneg (abs_nonneg _) _) _
- rw_mod_cast [abs_of_nonneg (add_nonneg zero_le_one (sq_nonneg x) : (0 : ℝ) ≤ _)]
- exact (le_add_of_nonneg_right (sq_nonneg x) : (1 : ℝ) ≤ _)
- have hbound1 : ∀ x ∈ Ico (U : ℝ) 1, |f' x| ≤ 1 := by
- rintro x ⟨hx_left, hx_right⟩
- have hincr := pow_le_pow_left (le_trans hU2 hx_left) (le_of_lt hx_right) (2 * k)
- rw [one_pow (2 * k), ← abs_of_nonneg (le_trans hU2 hx_left)] at hincr
- rw [← abs_of_nonneg (le_trans hU2 hx_left)] at hx_right
- linarith [f'_bound x (mem_Icc.mpr (abs_le.mp (le_of_lt hx_right)))]
- have hbound2 : ∀ x ∈ Ico 0 (U : ℝ), |f' x| ≤ U ^ (2 * k) := by
- rintro x ⟨hx_left, hx_right⟩
- have hincr := pow_le_pow_left hx_left (le_of_lt hx_right) (2 * k)
- rw [← abs_of_nonneg hx_left] at hincr hx_right
- rw [← abs_of_nonneg hU2] at hU1 hx_right
- exact (f'_bound x (mem_Icc.mpr (abs_le.mp (le_trans (le_of_lt hx_right) hU1)))).trans hincr
- -- (6) We twice apply the Mean Value Theorem to obtain bounds on `f` from the bounds on `f'`
- have mvt1 := norm_image_sub_le_of_norm_deriv_le_segment' hderiv1 hbound1 _ (right_mem_Icc.mpr hU1)
- have mvt2 := norm_image_sub_le_of_norm_deriv_le_segment' hderiv2 hbound2 _ (right_mem_Icc.mpr hU2)
- -- The following algebra is enough to complete the proof
- calc
- |f 1 - f 0| = |f 1 - f U + (f U - f 0)| := by simp
- _ ≤ 1 * (1 - U) + U ^ (2 * k) * (U - 0) :=
- (le_trans (abs_add (f 1 - f U) (f U - f 0)) (add_le_add mvt1 mvt2))
- _ = 1 - U + (U : ℝ) ^ (2 * k) * U := by simp
- _ = 1 - u k + u k ^ (2 * (k : ℝ) + 1) := by rw [← pow_succ' (U : ℝ) (2 * k)]; norm_cast
+ Tendsto (fun k => ∑ i in range k, (-1 : ℝ) ^ i / (2 * i + 1)) atTop (𝓝 (π / 4)) := by
+ -- The series is alternating with terms of decreasing magnitude, so it converges to some limit
+ obtain ⟨l, h⟩ :
+ ∃ l, Tendsto (fun n ↦ ∑ i in range n, (-1 : ℝ) ^ i / (2 * i + 1)) atTop (𝓝 l) := by
+ apply Antitone.tendsto_alternating_series_of_tendsto_zero
+ · exact antitone_iff_forall_lt.mpr fun _ _ _ ↦ by gcongr
+ · apply Tendsto.inv_tendsto_atTop; apply tendsto_atTop_add_const_right
+ exact tendsto_nat_cast_atTop_atTop.const_mul_atTop zero_lt_two
+ -- Abel's limit theorem states that the corresponding power series has the same limit as `x → 1⁻`
+ have abel := tendsto_tsum_powerSeries_nhdsWithin_lt h
+ -- Massage the expression to get `x ^ (2 * n + 1)` in the tsum rather than `x ^ n`...
+ have m : 𝓝[<] (1 : ℝ) ≤ 𝓝 1 := tendsto_nhdsWithin_of_tendsto_nhds fun _ a ↦ a
+ have q : Tendsto (fun x : ℝ ↦ x ^ 2) (𝓝[<] 1) (𝓝[<] 1) := by
+ apply tendsto_nhdsWithin_of_tendsto_nhds_of_eventually_within
+ · nth_rw 3 [← one_pow 2]
+ exact Tendsto.pow ‹_› _
+ · rw [eventually_iff_exists_mem]
+ use Set.Ioo (-1) 1
+ exact ⟨(by rw [mem_nhdsWithin_Iio_iff_exists_Ioo_subset]; use -1, by simp),
+ fun _ _ ↦ by rwa [Set.mem_Iio, sq_lt_one_iff_abs_lt_one, abs_lt, ← Set.mem_Ioo]⟩
+ replace abel := (abel.comp q).mul m
+ rw [mul_one] at abel
+ -- ...so that we can replace the tsum with the real arctangent function
+ replace abel : Tendsto arctan (𝓝[<] 1) (𝓝 l) := by
+ apply abel.congr'
+ rw [eventuallyEq_nhdsWithin_iff, Metric.eventually_nhds_iff]
+ use 1, zero_lt_one
+ intro y hy1 hy2
+ rw [dist_eq, abs_sub_lt_iff] at hy1
+ rw [Set.mem_Iio] at hy2
+ have ny : ‖y‖ < 1 := by rw [norm_eq_abs, abs_lt]; constructor <;> linarith
+ rw [← (hasSum_arctan ny).tsum_eq, Function.comp_apply, ← tsum_mul_right]
+ simp_rw [mul_assoc, ← pow_mul, ← pow_succ', div_mul_eq_mul_div]
+ norm_cast
+ -- But `arctan` is continuous everywhere, so the limit is `arctan 1 = π / 4`
+ rwa [tendsto_nhds_unique abel ((continuous_arctan.tendsto 1).mono_left m), arctan_one] at h
#align real.tendsto_sum_pi_div_four Real.tendsto_sum_pi_div_four
end Real
I ran tryAtEachStep on all files under Mathlib to find all locations where omega succeeds. For each that was a linarith without an only, I tried replacing it with omega, and I verified that elaboration time got smaller. (In almost all cases, there was a noticeable speedup.) I also replaced some slow aesops along the way.
@@ -89,7 +89,7 @@ theorem tendsto_sum_pi_div_four :
simp only [id.def]
ring
· simp
- rw [← mul_assoc, @div_mul_cancel _ _ (2 * (i : ℝ) + 1) _ (by norm_cast; linarith),
+ rw [← mul_assoc, @div_mul_cancel _ _ (2 * (i : ℝ) + 1) _ (by norm_cast; omega),
pow_mul x 2 i, ← mul_pow (-1 : ℝ) (x ^ 2) i]
ring_nf
convert (hasDerivAt_arctan x).sub (HasDerivAt.sum has_deriv_at_b) using 1
@@ -50,7 +50,7 @@ theorem tendsto_sum_pi_div_four :
convert (((tendsto_rpow_div_mul_add (-1) 2 1 two_ne_zero.symm).neg.const_add 1).add
tendsto_inv_atTop_zero).comp tendsto_nat_cast_atTop_atTop using 1
· ext k
- simp only [NNReal.coe_nat_cast, Function.comp_apply, NNReal.coe_rpow]
+ simp only [u, NNReal.coe_nat_cast, Function.comp_apply, NNReal.coe_rpow]
rw [← rpow_mul (Nat.cast_nonneg k) (-1 / (2 * (k : ℝ) + 1)) (2 * (k : ℝ) + 1),
@div_mul_cancel _ _ (2 * (k : ℝ) + 1) _
(by norm_cast; simp only [Nat.succ_ne_zero, not_false_iff]),
@@ -67,11 +67,11 @@ theorem tendsto_sum_pi_div_four :
suffices f_bound : |f 1 - f 0| ≤ (1 : ℝ) - U + U ^ (2 * (k : ℝ) + 1) by
rw [← norm_neg]
convert f_bound using 1
- simp
+ simp [b, f]
-- We show that `U` is indeed in [0,1]
have hU1 : (U : ℝ) ≤ 1 := by
by_cases hk : k = 0
- · simp [hk]
+ · simp [U, u, hk]
· exact rpow_le_one_of_one_le_of_nonpos
(by norm_cast; exact Nat.succ_le_iff.mpr (Nat.pos_of_ne_zero hk)) (le_of_lt
(@div_neg_of_neg_of_pos _ _ (-(1 : ℝ)) (2 * k + 1) (neg_neg_iff_pos.mpr zero_lt_one)
have, replace and suffices (#10640)
No changes to tactic file, it's just boring fixes throughout the library.
This follows on from #6964.
Co-authored-by: sgouezel <sebastien.gouezel@univ-rennes1.fr> Co-authored-by: Eric Wieser <wieser.eric@gmail.com>
@@ -64,8 +64,8 @@ theorem tendsto_sum_pi_div_four :
-- (3) We introduce an auxiliary function `f`
let b (i : ℕ) x := (-(1 : ℝ)) ^ i * x ^ (2 * i + 1) / (2 * i + 1)
let f x := arctan x - ∑ i in Finset.range k, b i x
- suffices f_bound : |f 1 - f 0| ≤ (1 : ℝ) - U + U ^ (2 * (k : ℝ) + 1)
- · rw [← norm_neg]
+ suffices f_bound : |f 1 - f 0| ≤ (1 : ℝ) - U + U ^ (2 * (k : ℝ) + 1) by
+ rw [← norm_neg]
convert f_bound using 1
simp
-- We show that `U` is indeed in [0,1]
@@ -4,6 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
Authors: Benjamin Davidson
-/
import Mathlib.Analysis.SpecialFunctions.Trigonometric.ArctanDeriv
+import Mathlib.Analysis.SpecialFunctions.Pow.Asymptotics
#align_import data.real.pi.leibniz from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
The names for lemmas about monotonicity of (a ^ ·) and (· ^ n) were a mess. This PR tidies up everything related by following the naming convention for (a * ·) and (· * b). Namely, (a ^ ·) is pow_right and (· ^ n) is pow_left in lemma names. All lemma renames follow the corresponding multiplication lemma names closely.
Algebra.GroupPower.Orderpow_mono → pow_right_monopow_le_pow → pow_le_pow_rightpow_le_pow_of_le_left → pow_le_pow_leftpow_lt_pow_of_lt_left → pow_lt_pow_leftstrictMonoOn_pow → pow_left_strictMonoOnpow_strictMono_right → pow_right_strictMonopow_lt_pow → pow_lt_pow_rightpow_lt_pow_iff → pow_lt_pow_iff_rightpow_le_pow_iff → pow_le_pow_iff_rightself_lt_pow → lt_self_powstrictAnti_pow → pow_right_strictAntipow_lt_pow_iff_of_lt_one → pow_lt_pow_iff_right_of_lt_onepow_lt_pow_of_lt_one → pow_lt_pow_right_of_lt_onelt_of_pow_lt_pow → lt_of_pow_lt_pow_leftle_of_pow_le_pow → le_of_pow_le_pow_leftpow_lt_pow₀ → pow_lt_pow_right₀Algebra.GroupPower.CovariantClasspow_le_pow_of_le_left' → pow_le_pow_left'nsmul_le_nsmul_of_le_right → nsmul_le_nsmul_rightpow_lt_pow' → pow_lt_pow_right'nsmul_lt_nsmul → nsmul_lt_nsmul_leftpow_strictMono_left → pow_right_strictMono'nsmul_strictMono_right → nsmul_left_strictMonoStrictMono.pow_right' → StrictMono.pow_constStrictMono.nsmul_left → StrictMono.const_nsmulpow_strictMono_right' → pow_left_strictMononsmul_strictMono_left → nsmul_right_strictMonoMonotone.pow_right → Monotone.pow_constMonotone.nsmul_left → Monotone.const_nsmullt_of_pow_lt_pow' → lt_of_pow_lt_pow_left'lt_of_nsmul_lt_nsmul → lt_of_nsmul_lt_nsmul_rightpow_le_pow' → pow_le_pow_right'nsmul_le_nsmul → nsmul_le_nsmul_leftpow_le_pow_of_le_one' → pow_le_pow_right_of_le_one'nsmul_le_nsmul_of_nonpos → nsmul_le_nsmul_left_of_nonposle_of_pow_le_pow' → le_of_pow_le_pow_left'le_of_nsmul_le_nsmul' → le_of_nsmul_le_nsmul_right'pow_le_pow_iff' → pow_le_pow_iff_right'nsmul_le_nsmul_iff → nsmul_le_nsmul_iff_leftpow_lt_pow_iff' → pow_lt_pow_iff_right'nsmul_lt_nsmul_iff → nsmul_lt_nsmul_iff_leftData.Nat.PowNat.pow_lt_pow_of_lt_left → Nat.pow_lt_pow_leftNat.pow_le_iff_le_left → Nat.pow_le_pow_iff_leftNat.pow_lt_iff_lt_left → Nat.pow_lt_pow_iff_leftpow_le_pow_iff_leftpow_lt_pow_iff_leftpow_right_injectivepow_right_injNat.pow_le_pow_left to have the correct name since Nat.pow_le_pow_of_le_left is in Std.Nat.pow_le_pow_right to have the correct name since Nat.pow_le_pow_of_le_right is in Std.self_le_pow was a duplicate of le_self_pow.Nat.pow_lt_pow_of_lt_right is defeq to pow_lt_pow_right.Nat.pow_right_strictMono is defeq to pow_right_strictMono.Nat.pow_le_iff_le_right is defeq to pow_le_pow_iff_right.Nat.pow_lt_iff_lt_right is defeq to pow_lt_pow_iff_right.0 < n or 1 ≤ n to n ≠ 0.Nat lemmas have been protected.@@ -112,13 +112,13 @@ theorem tendsto_sum_pi_div_four :
exact (le_add_of_nonneg_right (sq_nonneg x) : (1 : ℝ) ≤ _)
have hbound1 : ∀ x ∈ Ico (U : ℝ) 1, |f' x| ≤ 1 := by
rintro x ⟨hx_left, hx_right⟩
- have hincr := pow_le_pow_of_le_left (le_trans hU2 hx_left) (le_of_lt hx_right) (2 * k)
+ have hincr := pow_le_pow_left (le_trans hU2 hx_left) (le_of_lt hx_right) (2 * k)
rw [one_pow (2 * k), ← abs_of_nonneg (le_trans hU2 hx_left)] at hincr
rw [← abs_of_nonneg (le_trans hU2 hx_left)] at hx_right
linarith [f'_bound x (mem_Icc.mpr (abs_le.mp (le_of_lt hx_right)))]
have hbound2 : ∀ x ∈ Ico 0 (U : ℝ), |f' x| ≤ U ^ (2 * k) := by
rintro x ⟨hx_left, hx_right⟩
- have hincr := pow_le_pow_of_le_left hx_left (le_of_lt hx_right) (2 * k)
+ have hincr := pow_le_pow_left hx_left (le_of_lt hx_right) (2 * k)
rw [← abs_of_nonneg hx_left] at hincr hx_right
rw [← abs_of_nonneg hU2] at hU1 hx_right
exact (f'_bound x (mem_Icc.mpr (abs_le.mp (le_trans (le_of_lt hx_right) hU1)))).trans hincr
This is the supremum of
along with some minor fixes from failures on nightly-testing as Mathlib master is merged into it.
Note that some PRs for changes that are already compatible with the current toolchain and will be necessary have already been split out: #8380.
I am hopeful that in future we will be able to progressively merge adaptation PRs into a bump/v4.X.0 branch, so we never end up with a "big merge" like this. However one of these adaptation PRs (#8056) predates my new scheme for combined CI, and it wasn't possible to keep that PR viable in the meantime.
In particular this includes adjustments for the Lean PRs
We can get rid of all the
local macro_rules | `($x ^ $y) => `(HPow.hPow $x $y) -- Porting note: See issue [lean4#2220](https://github.com/leanprover/lean4/pull/2220)
macros across Mathlib (and in any projects that want to write natural number powers of reals).
Changes the default behaviour of simp to (config := {decide := false}). This makes simp (and consequentially norm_num) less powerful, but also more consistent, and less likely to blow up in long failures. This requires a variety of changes: changing some previously by simp or norm_num to decide or rfl, or adding (config := {decide := true}).
This changed the behaviour of simp so that simp [f] will only unfold "fully applied" occurrences of f. The old behaviour can be recovered with simp (config := { unfoldPartialApp := true }). We may in future add a syntax for this, e.g. simp [!f]; please provide feedback! In the meantime, we have made the following changes:
(config := { unfoldPartialApp := true }) in some places, to recover the old behaviour@[eqns] to manually adjust the equation lemmas for a particular definition, recovering the old behaviour just for that definition. See #8371, where we do this for Function.comp and Function.flip.This change in Lean may require further changes down the line (e.g. adding the !f syntax, and/or upstreaming the special treatment for Function.comp and Function.flip, and/or removing this special treatment). Please keep an open and skeptical mind about these changes!
Co-authored-by: leanprover-community-mathlib4-bot <leanprover-community-mathlib4-bot@users.noreply.github.com> Co-authored-by: Scott Morrison <scott.morrison@gmail.com> Co-authored-by: Eric Wieser <wieser.eric@gmail.com> Co-authored-by: Mauricio Collares <mauricio@collares.org>
@@ -12,8 +12,6 @@ import Mathlib.Analysis.SpecialFunctions.Trigonometric.ArctanDeriv
namespace Real
-local macro_rules | `($x ^ $y) => `(HPow.hPow $x $y) -- Porting note: See issue lean4#2220
-
open Filter Set
open scoped Classical BigOperators Topology Real
Rename:
tendsto_iff_norm_tendsto_one →
tendsto_iff_norm_div_tendsto_zero;tendsto_iff_norm_tendsto_zero →
tendsto_iff_norm_sub_tendsto_zero;tendsto_one_iff_norm_tendsto_one →
tendsto_one_iff_norm_tendsto_zero;Filter.Tendsto.continuous_of_equicontinuous_at →
Filter.Tendsto.continuous_of_equicontinuousAt.@@ -43,7 +43,7 @@ open scoped Classical BigOperators Topology Real
and `f u - f 0` from the bounds on `f'` (note that `f 0 = 0`). -/
theorem tendsto_sum_pi_div_four :
Tendsto (fun k => ∑ i in Finset.range k, (-(1 : ℝ)) ^ i / (2 * i + 1)) atTop (𝓝 (π / 4)) := by
- rw [tendsto_iff_norm_tendsto_zero, ← tendsto_zero_iff_norm_tendsto_zero]
+ rw [tendsto_iff_norm_sub_tendsto_zero, ← tendsto_zero_iff_norm_tendsto_zero]
-- (1) We introduce a useful sequence `u` of values in [0,1], then prove that another sequence
-- constructed from `u` tends to `0` at `+∞`
let u := fun k : ℕ => (k : NNReal) ^ (-1 / (2 * (k : ℝ) + 1))
@@ -12,7 +12,7 @@ import Mathlib.Analysis.SpecialFunctions.Trigonometric.ArctanDeriv
namespace Real
-local macro_rules | `($x ^ $y) => `(HPow.hPow $x $y) -- Porting note: See issue #2220
+local macro_rules | `($x ^ $y) => `(HPow.hPow $x $y) -- Porting note: See issue lean4#2220
open Filter Set
@@ -2,14 +2,11 @@
Copyright (c) 2020 Benjamin Davidson. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Benjamin Davidson
-
-! This file was ported from Lean 3 source module data.real.pi.leibniz
-! leanprover-community/mathlib commit f2ce6086713c78a7f880485f7917ea547a215982
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
-/
import Mathlib.Analysis.SpecialFunctions.Trigonometric.ArctanDeriv
+#align_import data.real.pi.leibniz from "leanprover-community/mathlib"@"f2ce6086713c78a7f880485f7917ea547a215982"
+
/-! ### Leibniz's Series for Pi -/
The unported dependencies are
algebra.order.moduleinit.corelinear_algebra.free_module.finite.rankalgebra.order.monoid.cancel.defsalgebra.absalgebra.group_power.lemmasinit.data.list.basiclinear_algebra.free_module.rankinit.data.list.defaultalgebra.order.monoid.cancel.basictopology.subset_propertiesinit.logicThe following 1 dependencies have changed in mathlib3 since they were ported, which may complicate porting this file