Theorem: ZetaAsymptotics.term_tsum_of_lt
File: Mathlib/NumberTheory/Harmonic/ZetaAsymp.lean

tactic: apply HasSum.tsum_eq
state_before: s : ℝ
hs : 1 < s
⊢ term_tsum s = 1 / (s - 1) - 1 / s * ∑' (n : ℕ), 1 / (↑n + 1) ^ s
state_after: case ha
s : ℝ
hs : 1 < s
⊢ HasSum (fun b => term (b + 1) s) (1 / (s - 1) - 1 / s * ∑' (n : ℕ), 1 / (↑n + 1) ^ s)

tactic: rw [hasSum_iff_tendsto_nat_of_nonneg (fun n ↦ term_nonneg (n + 1) s)]
state_before: case ha
s : ℝ
hs : 1 < s
⊢ HasSum (fun b => term (b + 1) s) (1 / (s - 1) - 1 / s * ∑' (n : ℕ), 1 / (↑n + 1) ^ s)
state_after: case ha
s : ℝ
hs : 1 < s
⊢ Tendsto (fun n => ∑ i ∈ Finset.range n, term (i + 1) s) atTop (𝓝 (1 / (s - 1) - 1 / s * ∑' (n : ℕ), 1 / (↑n + 1) ^ s))

tactic: change Tendsto (fun N ↦ term_sum s N) atTop _
state_before: case ha
s : ℝ
hs : 1 < s
⊢ Tendsto (fun n => ∑ i ∈ Finset.range n, term (i + 1) s) atTop (𝓝 (1 / (s - 1) - 1 / s * ∑' (n : ℕ), 1 / (↑n + 1) ^ s))
state_after: case ha
s : ℝ
hs : 1 < s
⊢ Tendsto (fun N => term_sum s N) atTop (𝓝 (1 / (s - 1) - 1 / s * ∑' (n : ℕ), 1 / (↑n + 1) ^ s))

tactic: simp_rw [term_sum_of_lt _ hs]
state_before: case ha
s : ℝ
hs : 1 < s
⊢ Tendsto (fun N => term_sum s N) atTop (𝓝 (1 / (s - 1) - 1 / s * ∑' (n : ℕ), 1 / (↑n + 1) ^ s))
state_after: case ha
s : ℝ
hs : 1 < s
⊢ Tendsto
    (fun N =>
      1 / (s - 1) * (1 - 1 / (↑N + 1) ^ (s - 1)) - 1 / s * (∑ n ∈ Finset.range N, 1 / (↑n + 1) ^ s - ↑N / (↑N + 1) ^ s))
    atTop (𝓝 (1 / (s - 1) - 1 / s * ∑' (n : ℕ), 1 / (↑n + 1) ^ s))

tactic: apply Tendsto.sub
state_before: case ha
s : ℝ
hs : 1 < s
⊢ Tendsto
    (fun N =>
      1 / (s - 1) * (1 - 1 / (↑N + 1) ^ (s - 1)) - 1 / s * (∑ n ∈ Finset.range N, 1 / (↑n + 1) ^ s - ↑N / (↑N + 1) ^ s))
    atTop (𝓝 (1 / (s - 1) - 1 / s * ∑' (n : ℕ), 1 / (↑n + 1) ^ s))
state_after: case ha.hf
s : ℝ
hs : 1 < s
⊢ Tendsto (fun x => 1 / (s - 1) * (1 - 1 / (↑x + 1) ^ (s - 1))) atTop (𝓝 (1 / (s - 1)))

case ha.hg
s : ℝ
hs : 1 < s
⊢ Tendsto (fun x => 1 / s * (∑ n ∈ Finset.range x, 1 / (↑n + 1) ^ s - ↑x / (↑x + 1) ^ s)) atTop
    (𝓝 (1 / s * ∑' (n : ℕ), 1 / (↑n + 1) ^ s))

tactic: rw [show 𝓝 (1 / (s - 1)) = 𝓝 (1 / (s - 1) - 1 / (s - 1) * 0) by simp]
state_before: case ha.hf
s : ℝ
hs : 1 < s
⊢ Tendsto (fun x => 1 / (s - 1) * (1 - 1 / (↑x + 1) ^ (s - 1))) atTop (𝓝 (1 / (s - 1)))
state_after: case ha.hf
s : ℝ
hs : 1 < s
⊢ Tendsto (fun x => 1 / (s - 1) * (1 - 1 / (↑x + 1) ^ (s - 1))) atTop (𝓝 (1 / (s - 1) - 1 / (s - 1) * 0))

tactic: simp_rw [mul_sub, mul_one]
state_before: case ha.hf
s : ℝ
hs : 1 < s
⊢ Tendsto (fun x => 1 / (s - 1) * (1 - 1 / (↑x + 1) ^ (s - 1))) atTop (𝓝 (1 / (s - 1) - 1 / (s - 1) * 0))
state_after: case ha.hf
s : ℝ
hs : 1 < s
⊢ Tendsto (fun x => 1 / (s - 1) - 1 / (s - 1) * (1 / (↑x + 1) ^ (s - 1))) atTop (𝓝 (1 / (s - 1) - 1 / (s - 1) * 0))

tactic: refine tendsto_const_nhds.sub (Tendsto.const_mul _ ?_)
state_before: case ha.hf
s : ℝ
hs : 1 < s
⊢ Tendsto (fun x => 1 / (s - 1) - 1 / (s - 1) * (1 / (↑x + 1) ^ (s - 1))) atTop (𝓝 (1 / (s - 1) - 1 / (s - 1) * 0))
state_after: case ha.hf
s : ℝ
hs : 1 < s
⊢ Tendsto (fun k => 1 / (↑k + 1) ^ (s - 1)) atTop (𝓝 0)

tactic: refine tendsto_const_nhds.div_atTop <| (tendsto_rpow_atTop (by linarith)).comp ?_
state_before: case ha.hf
s : ℝ
hs : 1 < s
⊢ Tendsto (fun k => 1 / (↑k + 1) ^ (s - 1)) atTop (𝓝 0)
state_after: case ha.hf
s : ℝ
hs : 1 < s
⊢ Tendsto (fun k => ↑k + 1) atTop atTop

tactic: exact tendsto_atTop_add_const_right _ _ tendsto_natCast_atTop_atTop
state_before: case ha.hf
s : ℝ
hs : 1 < s
⊢ Tendsto (fun k => ↑k + 1) atTop atTop
state_after: no goals

tactic: simp
state_before: s : ℝ
hs : 1 < s
⊢ 𝓝 (1 / (s - 1)) = 𝓝 (1 / (s - 1) - 1 / (s - 1) * 0)
state_after: no goals

tactic: linarith
state_before: s : ℝ
hs : 1 < s
⊢ 0 < s - 1
state_after: no goals

tactic: rw [← sub_zero (tsum _)]
state_before: case ha.hg
s : ℝ
hs : 1 < s
⊢ Tendsto (fun x => 1 / s * (∑ n ∈ Finset.range x, 1 / (↑n + 1) ^ s - ↑x / (↑x + 1) ^ s)) atTop
    (𝓝 (1 / s * ∑' (n : ℕ), 1 / (↑n + 1) ^ s))
state_after: case ha.hg
s : ℝ
hs : 1 < s
⊢ Tendsto (fun x => 1 / s * (∑ n ∈ Finset.range x, 1 / (↑n + 1) ^ s - ↑x / (↑x + 1) ^ s)) atTop
    (𝓝 (1 / s * (∑' (n : ℕ), 1 / (↑n + 1) ^ s - 0)))

tactic: apply (((Summable.hasSum ?_).tendsto_sum_nat).sub ?_).const_mul
state_before: case ha.hg
s : ℝ
hs : 1 < s
⊢ Tendsto (fun x => 1 / s * (∑ n ∈ Finset.range x, 1 / (↑n + 1) ^ s - ↑x / (↑x + 1) ^ s)) atTop
    (𝓝 (1 / s * (∑' (n : ℕ), 1 / (↑n + 1) ^ s - 0)))
state_after: s : ℝ
hs : 1 < s
⊢ Summable fun i => 1 / (↑i + 1) ^ s

s : ℝ
hs : 1 < s
⊢ Tendsto (fun k => ↑k / (↑k + 1) ^ s) atTop (𝓝 0)

tactic: exact_mod_cast (summable_nat_add_iff 1).mpr (summable_one_div_nat_rpow.mpr hs)
state_before: s : ℝ
hs : 1 < s
⊢ Summable fun i => 1 / (↑i + 1) ^ s
state_after: no goals

tactic: apply tendsto_of_tendsto_of_tendsto_of_le_of_le tendsto_const_nhds
state_before: s : ℝ
hs : 1 < s
⊢ Tendsto (fun k => ↑k / (↑k + 1) ^ s) atTop (𝓝 0)
state_after: case hh
s : ℝ
hs : 1 < s
⊢ Tendsto ?m.111765 atTop (𝓝 0)

case hgf
s : ℝ
hs : 1 < s
⊢ (fun x => 0) ≤ fun k => ↑k / (↑k + 1) ^ s

case hfh
s : ℝ
hs : 1 < s
⊢ (fun k => ↑k / (↑k + 1) ^ s) ≤ ?m.111765

s : ℝ
hs : 1 < s
⊢ ℕ → ℝ

tactic: change Tendsto (fun n : ℕ ↦ (1 / ↑(n + 1) : ℝ) ^ (s - 1)) ..
state_before: case hh
s : ℝ
hs : 1 < s
⊢ Tendsto ?m.111765 atTop (𝓝 0)
state_after: case hh
s : ℝ
hs : 1 < s
⊢ Tendsto (fun n => (1 / ↑(n + 1)) ^ (s - 1)) atTop (𝓝 0)

tactic: rw [show 𝓝 (0 : ℝ) = 𝓝 (0 ^ (s - 1)) by rw [zero_rpow]; linarith]
state_before: case hh
s : ℝ
hs : 1 < s
⊢ Tendsto (fun n => (1 / ↑(n + 1)) ^ (s - 1)) atTop (𝓝 0)
state_after: case hh
s : ℝ
hs : 1 < s
⊢ Tendsto (fun n => (1 / ↑(n + 1)) ^ (s - 1)) atTop (𝓝 (0 ^ (s - 1)))

tactic: refine Tendsto.rpow_const ?_ (Or.inr <| by linarith)
state_before: case hh
s : ℝ
hs : 1 < s
⊢ Tendsto (fun n => (1 / ↑(n + 1)) ^ (s - 1)) atTop (𝓝 (0 ^ (s - 1)))
state_after: case hh
s : ℝ
hs : 1 < s
⊢ Tendsto (fun n => 1 / ↑(n + 1)) atTop (𝓝 0)

tactic: exact (tendsto_const_div_atTop_nhds_zero_nat _).comp (tendsto_add_atTop_nat _)
state_before: case hh
s : ℝ
hs : 1 < s
⊢ Tendsto (fun n => 1 / ↑(n + 1)) atTop (𝓝 0)
state_after: no goals

tactic: rw [zero_rpow]
state_before: s : ℝ
hs : 1 < s
⊢ 𝓝 0 = 𝓝 (0 ^ (s - 1))
state_after: s : ℝ
hs : 1 < s
⊢ s - 1 ≠ 0

tactic: linarith
state_before: s : ℝ
hs : 1 < s
⊢ s - 1 ≠ 0
state_after: no goals

tactic: linarith
state_before: s : ℝ
hs : 1 < s
⊢ 0 ≤ s - 1
state_after: no goals

tactic: intro n
state_before: case hgf
s : ℝ
hs : 1 < s
⊢ (fun x => 0) ≤ fun k => ↑k / (↑k + 1) ^ s
state_after: case hgf
s : ℝ
hs : 1 < s
n : ℕ
⊢ (fun x => 0) n ≤ (fun k => ↑k / (↑k + 1) ^ s) n

tactic: positivity
state_before: case hgf
s : ℝ
hs : 1 < s
n : ℕ
⊢ (fun x => 0) n ≤ (fun k => ↑k / (↑k + 1) ^ s) n
state_after: no goals

tactic: intro n
state_before: case hfh
s : ℝ
hs : 1 < s
⊢ (fun k => ↑k / (↑k + 1) ^ s) ≤ fun n => (1 / ↑(n + 1)) ^ (s - 1)
state_after: case hfh
s : ℝ
hs : 1 < s
n : ℕ
⊢ (fun k => ↑k / (↑k + 1) ^ s) n ≤ (fun n => (1 / ↑(n + 1)) ^ (s - 1)) n

tactic: dsimp only
state_before: case hfh
s : ℝ
hs : 1 < s
n : ℕ
⊢ (fun k => ↑k / (↑k + 1) ^ s) n ≤ (fun n => (1 / ↑(n + 1)) ^ (s - 1)) n
state_after: case hfh
s : ℝ
hs : 1 < s
n : ℕ
⊢ ↑n / (↑n + 1) ^ s ≤ (1 / ↑(n + 1)) ^ (s - 1)

tactic: transitivity (n + 1) / (n + 1) ^ s
state_before: case hfh
s : ℝ
hs : 1 < s
n : ℕ
⊢ ↑n / (↑n + 1) ^ s ≤ (1 / ↑(n + 1)) ^ (s - 1)
state_after: s : ℝ
hs : 1 < s
n : ℕ
⊢ ↑n / (↑n + 1) ^ s ≤ (↑n + 1) / (↑n + 1) ^ s

s : ℝ
hs : 1 < s
n : ℕ
⊢ (↑n + 1) / (↑n + 1) ^ s ≤ (1 / ↑(n + 1)) ^ (s - 1)

tactic: gcongr
state_before: s : ℝ
hs : 1 < s
n : ℕ
⊢ ↑n / (↑n + 1) ^ s ≤ (↑n + 1) / (↑n + 1) ^ s
state_after: case hab
s : ℝ
hs : 1 < s
n : ℕ
⊢ ↑n ≤ ↑n + 1

tactic: linarith
state_before: case hab
s : ℝ
hs : 1 < s
n : ℕ
⊢ ↑n ≤ ↑n + 1
state_after: no goals

tactic: apply le_of_eq
state_before: s : ℝ
hs : 1 < s
n : ℕ
⊢ (↑n + 1) / (↑n + 1) ^ s ≤ (1 / ↑(n + 1)) ^ (s - 1)
state_after: case a
s : ℝ
hs : 1 < s
n : ℕ
⊢ (↑n + 1) / (↑n + 1) ^ s = (1 / ↑(n + 1)) ^ (s - 1)

tactic: rw [rpow_sub_one, ← div_mul, div_one, mul_comm, one_div, inv_rpow, ← div_eq_mul_inv]
state_before: case a
s : ℝ
hs : 1 < s
n : ℕ
⊢ (↑n + 1) / (↑n + 1) ^ s = (1 / ↑(n + 1)) ^ (s - 1)
state_after: case a
s : ℝ
hs : 1 < s
n : ℕ
⊢ (↑n + 1) / (↑n + 1) ^ s = ↑(n + 1) / ↑(n + 1) ^ s

case a.hx
s : ℝ
hs : 1 < s
n : ℕ
⊢ 0 ≤ ↑(n + 1)

case a.hx
s : ℝ
hs : 1 < s
n : ℕ
⊢ 1 / ↑(n + 1) ≠ 0

tactic: all_goals positivity
state_before: case a.hx
s : ℝ
hs : 1 < s
n : ℕ
⊢ 0 ≤ ↑(n + 1)

case a.hx
s : ℝ
hs : 1 < s
n : ℕ
⊢ 1 / ↑(n + 1) ≠ 0
state_after: no goals

tactic: norm_cast
state_before: case a
s : ℝ
hs : 1 < s
n : ℕ
⊢ (↑n + 1) / (↑n + 1) ^ s = ↑(n + 1) / ↑(n + 1) ^ s
state_after: no goals

tactic: positivity
state_before: case a.hx
s : ℝ
hs : 1 < s
n : ℕ
⊢ 1 / ↑(n + 1) ≠ 0
state_after: no goals