Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Merged by Bors] - feat: bounds on alternating convergent series #10120

Closed
wants to merge 4 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 66 additions & 0 deletions Mathlib/Analysis/SpecificLimits/Normed.lean
Original file line number Diff line number Diff line change
Expand Up @@ -696,6 +696,72 @@ theorem Antitone.tendsto_alternating_series_of_tendsto_zero (hfa : Antitone f)

end

/-! ### Partial sum bounds on alternating convergent series -/

section

variable {E : Type*} [OrderedRing E] [TopologicalSpace E] [OrderClosedTopology E]
{l : E} {f : ℕ → E}

/-- Partial sums of an alternating monotone series with an even number of terms provide
upper bounds on the limit. -/
theorem Monotone.tendsto_le_alternating_series
(hfl : Tendsto (fun n ↦ ∑ i in range n, (-1) ^ i * f i) atTop (𝓝 l))
(hfm : Monotone f) (k : ℕ) : l ≤ ∑ i in range (2 * k), (-1) ^ i * f i := by
have ha : Antitone (fun n ↦ ∑ i in range (2 * n), (-1) ^ i * f i) := by
refine' antitone_nat_of_succ_le (fun n ↦ _)
rw [show 2 * (n + 1) = 2 * n + 1 + 1 by ring, sum_range_succ, sum_range_succ]
simp_rw [_root_.pow_succ, show (-1 : E) ^ (2 * n) = 1 by simp, neg_one_mul, one_mul,
← sub_eq_add_neg, sub_le_iff_le_add]
gcongr
exact hfm (by omega)
exact ha.le_of_tendsto (hfl.comp (tendsto_atTop_mono (fun n ↦ by omega) tendsto_id)) _

/-- Partial sums of an alternating monotone series with an odd number of terms provide
lower bounds on the limit. -/
theorem Monotone.alternating_series_le_tendsto
(hfl : Tendsto (fun n ↦ ∑ i in range n, (-1) ^ i * f i) atTop (𝓝 l))
(hfm : Monotone f) (k : ℕ) : ∑ i in range (2 * k + 1), (-1) ^ i * f i ≤ l := by
have hm : Monotone (fun n ↦ ∑ i in range (2 * n + 1), (-1) ^ i * f i) := by
refine' monotone_nat_of_le_succ (fun n ↦ _)
rw [show 2 * (n + 1) = 2 * n + 1 + 1 by ring,
sum_range_succ _ (2 * n + 1 + 1), sum_range_succ _ (2 * n + 1)]
simp_rw [_root_.pow_succ, show (-1 : E) ^ (2 * n) = 1 by simp, neg_one_mul, neg_neg, one_mul,
← sub_eq_add_neg, sub_add_eq_add_sub, le_sub_iff_add_le]
gcongr
exact hfm (by omega)
exact hm.ge_of_tendsto (hfl.comp (tendsto_atTop_mono (fun n ↦ by omega) tendsto_id)) _

/-- Partial sums of an alternating antitone series with an even number of terms provide
lower bounds on the limit. -/
theorem Antitone.alternating_series_le_tendsto
(hfl : Tendsto (fun n ↦ ∑ i in range n, (-1) ^ i * f i) atTop (𝓝 l))
(hfa : Antitone f) (k : ℕ) : ∑ i in range (2 * k), (-1) ^ i * f i ≤ l := by
have hm : Monotone (fun n ↦ ∑ i in range (2 * n), (-1) ^ i * f i) := by
refine' monotone_nat_of_le_succ (fun n ↦ _)
rw [show 2 * (n + 1) = 2 * n + 1 + 1 by ring, sum_range_succ, sum_range_succ]
simp_rw [_root_.pow_succ, show (-1 : E) ^ (2 * n) = 1 by simp, neg_one_mul, one_mul,
← sub_eq_add_neg, le_sub_iff_add_le]
gcongr
exact hfa (by omega)
exact hm.ge_of_tendsto (hfl.comp (tendsto_atTop_mono (fun n ↦ by omega) tendsto_id)) _

/-- Partial sums of an alternating antitone series with an odd number of terms provide
upper bounds on the limit. -/
theorem Antitone.tendsto_le_alternating_series
(hfl : Tendsto (fun n ↦ ∑ i in range n, (-1) ^ i * f i) atTop (𝓝 l))
(hfa : Antitone f) (k : ℕ) : l ≤ ∑ i in range (2 * k + 1), (-1) ^ i * f i := by
have ha : Antitone (fun n ↦ ∑ i in range (2 * n + 1), (-1) ^ i * f i) := by
refine' antitone_nat_of_succ_le (fun n ↦ _)
rw [show 2 * (n + 1) = 2 * n + 1 + 1 by ring, sum_range_succ, sum_range_succ]
simp_rw [_root_.pow_succ, show (-1 : E) ^ (2 * n) = 1 by simp, neg_one_mul, neg_neg, one_mul,
← sub_eq_add_neg, sub_add_eq_add_sub, sub_le_iff_le_add]
gcongr
exact hfa (by omega)
exact ha.le_of_tendsto (hfl.comp (tendsto_atTop_mono (fun n ↦ by omega) tendsto_id)) _

end

/-!
### Factorial
-/
Expand Down
Loading