Theorem: Stirling.log_stirlingSeq_bounded_aux
File: Mathlib/Analysis/SpecialFunctions/Stirling.lean

Proof steps:
state_before: ⊢ ∃ c, ∀ (n : ℕ), Real.log (stirlingSeq 1) - Real.log (stirlingSeq (n + 1)) ≤ c
state_after: d : ℝ := ∑' (k : ℕ), 1 / ↑(k + 1) ^ 2
⊢ ∃ c, ∀ (n : ℕ), Real.log (stirlingSeq 1) - Real.log (stirlingSeq (n + 1)) ≤ c
tactic: let d : ℝ := ∑' k : ℕ, (1 : ℝ) / (↑(k + 1) : ℝ) ^ 2
state_before: d : ℝ := ∑' (k : ℕ), 1 / ↑(k + 1) ^ 2
⊢ ∃ c, ∀ (n : ℕ), Real.log (stirlingSeq 1) - Real.log (stirlingSeq (n + 1)) ≤ c
state_after: case h
d : ℝ := ∑' (k : ℕ), 1 / ↑(k + 1) ^ 2
⊢ ∀ (n : ℕ), Real.log (stirlingSeq 1) - Real.log (stirlingSeq (n + 1)) ≤ 1 / 4 * d
tactic: use 1 / 4 * d
state_before: case h
d : ℝ := ∑' (k : ℕ), 1 / ↑(k + 1) ^ 2
⊢ ∀ (n : ℕ), Real.log (stirlingSeq 1) - Real.log (stirlingSeq (n + 1)) ≤ 1 / 4 * d
state_after: case h
d : ℝ := ∑' (k : ℕ), 1 / ↑(k + 1) ^ 2
log_stirlingSeq' : ℕ → ℝ := fun k => Real.log (stirlingSeq (k + 1))
⊢ ∀ (n : ℕ), Real.log (stirlingSeq 1) - Real.log (stirlingSeq (n + 1)) ≤ 1 / 4 * d
tactic: let log_stirlingSeq' : ℕ → ℝ := fun k => log (stirlingSeq (k + 1))
state_before: case h
d : ℝ := ∑' (k : ℕ), 1 / ↑(k + 1) ^ 2
log_stirlingSeq' : ℕ → ℝ := fun k => Real.log (stirlingSeq (k + 1))
⊢ ∀ (n : ℕ), Real.log (stirlingSeq 1) - Real.log (stirlingSeq (n + 1)) ≤ 1 / 4 * d
state_after: case h
d : ℝ := ∑' (k : ℕ), 1 / ↑(k + 1) ^ 2
log_stirlingSeq' : ℕ → ℝ := fun k => Real.log (stirlingSeq (k + 1))
n : ℕ
⊢ Real.log (stirlingSeq 1) - Real.log (stirlingSeq (n + 1)) ≤ 1 / 4 * d
tactic: intro n
state_before: case h
d : ℝ := ∑' (k : ℕ), 1 / ↑(k + 1) ^ 2
log_stirlingSeq' : ℕ → ℝ := fun k => Real.log (stirlingSeq (k + 1))
n : ℕ
⊢ Real.log (stirlingSeq 1) - Real.log (stirlingSeq (n + 1)) ≤ 1 / 4 * d
state_after: case h
d : ℝ := ∑' (k : ℕ), 1 / ↑(k + 1) ^ 2
log_stirlingSeq' : ℕ → ℝ := fun k => Real.log (stirlingSeq (k + 1))
n : ℕ
h₁ : ∀ (k : ℕ), log_stirlingSeq' k - log_stirlingSeq' (k + 1) ≤ 1 / 4 * (1 / ↑(k + 1) ^ 2)
⊢ Real.log (stirlingSeq 1) - Real.log (stirlingSeq (n + 1)) ≤ 1 / 4 * d
tactic: have h₁ k : log_stirlingSeq' k - log_stirlingSeq' (k + 1) ≤ 1 / 4 * (1 / (↑(k + 1) : ℝ) ^ 2) := by
    convert log_stirlingSeq_sub_log_stirlingSeq_succ k using 1; field_simp
state_before: case h
d : ℝ := ∑' (k : ℕ), 1 / ↑(k + 1) ^ 2
log_stirlingSeq' : ℕ → ℝ := fun k => Real.log (stirlingSeq (k + 1))
n : ℕ
h₁ : ∀ (k : ℕ), log_stirlingSeq' k - log_stirlingSeq' (k + 1) ≤ 1 / 4 * (1 / ↑(k + 1) ^ 2)
⊢ Real.log (stirlingSeq 1) - Real.log (stirlingSeq (n + 1)) ≤ 1 / 4 * d
state_after: case h
d : ℝ := ∑' (k : ℕ), 1 / ↑(k + 1) ^ 2
log_stirlingSeq' : ℕ → ℝ := fun k => Real.log (stirlingSeq (k + 1))
n : ℕ
h₁ : ∀ (k : ℕ), log_stirlingSeq' k - log_stirlingSeq' (k + 1) ≤ 1 / 4 * (1 / ↑(k + 1) ^ 2)
h₂ : ∑ k ∈ range n, 1 / ↑(k + 1) ^ 2 ≤ d
⊢ Real.log (stirlingSeq 1) - Real.log (stirlingSeq (n + 1)) ≤ 1 / 4 * d
tactic: have h₂ : (∑ k ∈ range n, 1 / (↑(k + 1) : ℝ) ^ 2) ≤ d := by
    have := (summable_nat_add_iff 1).mpr <| Real.summable_one_div_nat_pow.mpr one_lt_two
    exact sum_le_tsum (range n) (fun k _ => by positivity) this
state_before: case h
d : ℝ := ∑' (k : ℕ), 1 / ↑(k + 1) ^ 2
log_stirlingSeq' : ℕ → ℝ := fun k => Real.log (stirlingSeq (k + 1))
n : ℕ
h₁ : ∀ (k : ℕ), log_stirlingSeq' k - log_stirlingSeq' (k + 1) ≤ 1 / 4 * (1 / ↑(k + 1) ^ 2)
h₂ : ∑ k ∈ range n, 1 / ↑(k + 1) ^ 2 ≤ d
⊢ Real.log (stirlingSeq 1) - Real.log (stirlingSeq (n + 1)) ≤ 1 / 4 * d
state_after: no goals
tactic: calc
    log (stirlingSeq 1) - log (stirlingSeq (n + 1)) = log_stirlingSeq' 0 - log_stirlingSeq' n :=
      rfl
    _ = ∑ k ∈ range n, (log_stirlingSeq' k - log_stirlingSeq' (k + 1)) := by
      rw [← sum_range_sub' log_stirlingSeq' n]
    _ ≤ ∑ k ∈ range n, 1 / 4 * (1 / ↑((k + 1)) ^ 2) := sum_le_sum fun k _ => h₁ k
    _ = 1 / 4 * ∑ k ∈ range n, 1 / ↑((k + 1)) ^ 2 := by rw [mul_sum]
    _ ≤ 1 / 4 * d := by gcongr