d : ℝ := ∑' (k : ℕ), 1 / ↑(succ k) ^ 2
⊢ ∃ c, ∀ (n : ℕ), Real.log (stirlingSeq 1) - Real.log (stirlingSeq (succ n)) ≤ c
⊢ ∃ c, ∀ (n : ℕ), Real.log (stirlingSeq 1) - Real.log (stirlingSeq (succ n)) ≤ c
let d := ∑' k : ℕ, ↑1 / (k.succ:ℝ) ^ 2
d : ℝ := ∑' (k : ℕ), 1 / ↑(succ k) ^ 2
⊢ ∀ (n : ℕ), Real.log (stirlingSeq 1) - Real.log (stirlingSeq (succ n)) ≤ 1 / 4 * d
d : ℝ := ∑' (k : ℕ), 1 / ↑(succ k) ^ 2
⊢ ∃ c, ∀ (n : ℕ), Real.log (stirlingSeq 1) - Real.log (stirlingSeq (succ n)) ≤ c
use (1 / 4 * d : ℝ)
d : ℝ := ∑' (k : ℕ), 1 / ↑(succ k) ^ 2
log_stirlingSeq' : ℕ → ℝ := fun k => Real.log (stirlingSeq (succ k))
⊢ ∀ (n : ℕ), Real.log (stirlingSeq 1) - Real.log (stirlingSeq (succ n)) ≤ 1 / 4 * d
d : ℝ := ∑' (k : ℕ), 1 / ↑(succ k) ^ 2
⊢ ∀ (n : ℕ), Real.log (stirlingSeq 1) - Real.log (stirlingSeq (succ n)) ≤ 1 / 4 * d
let log_stirlingSeq' : ℕ → ℝ := fun k => log (stirlingSeq k.succ)
d : ℝ := ∑' (k : ℕ), 1 / ↑(succ k) ^ 2
log_stirlingSeq' : ℕ → ℝ := fun k => Real.log (stirlingSeq (succ k))
n : ℕ
⊢ Real.log (stirlingSeq 1) - Real.log (stirlingSeq (succ n)) ≤ 1 / 4 * d
d : ℝ := ∑' (k : ℕ), 1 / ↑(succ k) ^ 2
log_stirlingSeq' : ℕ → ℝ := fun k => Real.log (stirlingSeq (succ k))
⊢ ∀ (n : ℕ), Real.log (stirlingSeq 1) - Real.log (stirlingSeq (succ n)) ≤ 1 / 4 * d
intro n
d : ℝ := ∑' (k : ℕ), 1 / ↑(succ k) ^ 2
log_stirlingSeq' : ℕ → ℝ := fun k => Real.log (stirlingSeq (succ k))
n : ℕ
h₁ : ∀ (k : ℕ), log_stirlingSeq' k - log_stirlingSeq' (k + 1) ≤ 1 / 4 * (1 / ↑(succ k) ^ 2)
⊢ Real.log (stirlingSeq 1) - Real.log (stirlingSeq (succ n)) ≤ 1 / 4 * d
d : ℝ := ∑' (k : ℕ), 1 / ↑(succ k) ^ 2
log_stirlingSeq' : ℕ → ℝ := fun k => Real.log (stirlingSeq (succ k))
n : ℕ
⊢ Real.log (stirlingSeq 1) - Real.log (stirlingSeq (succ n)) ≤ 1 / 4 * d
have h₁ : ∀ k, log_stirlingSeq' k - log_stirlingSeq' (k + 1) ≤
    ↑1 / ↑4 * (↑1 / (k.succ:ℝ) ^ 2) := by
  intro k; convert log_stirlingSeq_sub_log_stirlingSeq_succ k using 1; field_simp
d : ℝ := ∑' (k : ℕ), 1 / ↑(succ k) ^ 2
log_stirlingSeq' : ℕ → ℝ := fun k => Real.log (stirlingSeq (succ k))
n : ℕ
h₁ : ∀ (k : ℕ), log_stirlingSeq' k - log_stirlingSeq' (k + 1) ≤ 1 / 4 * (1 / ↑(succ k) ^ 2)
h₂ : ∑ k in range n, 1 / ↑(succ k) ^ 2 ≤ d
⊢ Real.log (stirlingSeq 1) - Real.log (stirlingSeq (succ n)) ≤ 1 / 4 * d
d : ℝ := ∑' (k : ℕ), 1 / ↑(succ k) ^ 2
log_stirlingSeq' : ℕ → ℝ := fun k => Real.log (stirlingSeq (succ k))
n : ℕ
h₁ : ∀ (k : ℕ), log_stirlingSeq' k - log_stirlingSeq' (k + 1) ≤ 1 / 4 * (1 / ↑(succ k) ^ 2)
⊢ Real.log (stirlingSeq 1) - Real.log (stirlingSeq (succ n)) ≤ 1 / 4 * d
have h₂ : (∑ k : ℕ in range n, ↑1 / (k.succ:ℝ) ^ 2) ≤ d := by
  have := (summable_nat_add_iff 1).mpr <| Real.summable_one_div_nat_pow.mpr one_lt_two
  simp only [rpow_nat_cast] at this
  exact sum_le_tsum (range n) (fun k _ => by positivity) this
no goals
d : ℝ := ∑' (k : ℕ), 1 / ↑(succ k) ^ 2
log_stirlingSeq' : ℕ → ℝ := fun k => Real.log (stirlingSeq (succ k))
n : ℕ
h₁ : ∀ (k : ℕ), log_stirlingSeq' k - log_stirlingSeq' (k + 1) ≤ 1 / 4 * (1 / ↑(succ k) ^ 2)
h₂ : ∑ k in range n, 1 / ↑(succ k) ^ 2 ≤ d
⊢ Real.log (stirlingSeq 1) - Real.log (stirlingSeq (succ n)) ≤ 1 / 4 * d
calc
  log (stirlingSeq 1) - log (stirlingSeq n.succ) = log_stirlingSeq' 0 - log_stirlingSeq' n :=
    rfl
  _ = ∑ k in range n, (log_stirlingSeq' k - log_stirlingSeq' (k + 1)) := by
    rw [← sum_range_sub' log_stirlingSeq' n]
  _ ≤ ∑ k in range n, ↑1 / ↑4 * (↑1 / ↑(k.succ) ^ 2) := (sum_le_sum fun k _ => h₁ k)
  _ = ↑1 / ↑4 * ∑ k in range n, ↑1 / ↑(k.succ) ^ 2 := by rw [mul_sum]
  _ ≤ 1 / 4 * d := mul_le_mul_of_nonneg_left h₂ <| by positivity
d : ℝ := ∑' (k : ℕ), 1 / ↑(succ k) ^ 2
log_stirlingSeq' : ℕ → ℝ := fun k => Real.log (stirlingSeq (succ k))
n k : ℕ
⊢ log_stirlingSeq' k - log_stirlingSeq' (k + 1) ≤ 1 / 4 * (1 / ↑(succ k) ^ 2)
d : ℝ := ∑' (k : ℕ), 1 / ↑(succ k) ^ 2
log_stirlingSeq' : ℕ → ℝ := fun k => Real.log (stirlingSeq (succ k))
n : ℕ
⊢ ∀ (k : ℕ), log_stirlingSeq' k - log_stirlingSeq' (k + 1) ≤ 1 / 4 * (1 / ↑(succ k) ^ 2)
intro k
case h.e'_4
d : ℝ := ∑' (k : ℕ), 1 / ↑(succ k) ^ 2
log_stirlingSeq' : ℕ → ℝ := fun k => Real.log (stirlingSeq (succ k))
n k : ℕ
⊢ 1 / 4 * (1 / ↑(succ k) ^ 2) = 1 / (4 * ↑(succ k) ^ 2)
d : ℝ := ∑' (k : ℕ), 1 / ↑(succ k) ^ 2
log_stirlingSeq' : ℕ → ℝ := fun k => Real.log (stirlingSeq (succ k))
n k : ℕ
⊢ log_stirlingSeq' k - log_stirlingSeq' (k + 1) ≤ 1 / 4 * (1 / ↑(succ k) ^ 2)
convert log_stirlingSeq_sub_log_stirlingSeq_succ k using 1
no goals
case h.e'_4
d : ℝ := ∑' (k : ℕ), 1 / ↑(succ k) ^ 2
log_stirlingSeq' : ℕ → ℝ := fun k => Real.log (stirlingSeq (succ k))
n k : ℕ
⊢ 1 / 4 * (1 / ↑(succ k) ^ 2) = 1 / (4 * ↑(succ k) ^ 2)
field_simp
d : ℝ := ∑' (k : ℕ), 1 / ↑(succ k) ^ 2
log_stirlingSeq' : ℕ → ℝ := fun k => Real.log (stirlingSeq (succ k))
n : ℕ
h₁ : ∀ (k : ℕ), log_stirlingSeq' k - log_stirlingSeq' (k + 1) ≤ 1 / 4 * (1 / ↑(succ k) ^ 2)
this : Summable fun n => 1 / ↑(n + 1) ^ ↑2
⊢ ∑ k in range n, 1 / ↑(succ k) ^ 2 ≤ d
d : ℝ := ∑' (k : ℕ), 1 / ↑(succ k) ^ 2
log_stirlingSeq' : ℕ → ℝ := fun k => Real.log (stirlingSeq (succ k))
n : ℕ
h₁ : ∀ (k : ℕ), log_stirlingSeq' k - log_stirlingSeq' (k + 1) ≤ 1 / 4 * (1 / ↑(succ k) ^ 2)
⊢ ∑ k in range n, 1 / ↑(succ k) ^ 2 ≤ d
have := (summable_nat_add_iff 1).mpr <| Real.summable_one_div_nat_pow.mpr one_lt_two
d : ℝ := ∑' (k : ℕ), 1 / ↑(succ k) ^ 2
log_stirlingSeq' : ℕ → ℝ := fun k => Real.log (stirlingSeq (succ k))
n : ℕ
h₁ : ∀ (k : ℕ), log_stirlingSeq' k - log_stirlingSeq' (k + 1) ≤ 1 / 4 * (1 / ↑(succ k) ^ 2)
this : Summable fun n => 1 / ↑(n + 1) ^ 2
⊢ ∑ k in range n, 1 / ↑(succ k) ^ 2 ≤ d
d : ℝ := ∑' (k : ℕ), 1 / ↑(succ k) ^ 2
log_stirlingSeq' : ℕ → ℝ := fun k => Real.log (stirlingSeq (succ k))
n : ℕ
h₁ : ∀ (k : ℕ), log_stirlingSeq' k - log_stirlingSeq' (k + 1) ≤ 1 / 4 * (1 / ↑(succ k) ^ 2)
this : Summable fun n => 1 / ↑(n + 1) ^ ↑2
⊢ ∑ k in range n, 1 / ↑(succ k) ^ 2 ≤ d
simp only [rpow_nat_cast] at this
no goals
d : ℝ := ∑' (k : ℕ), 1 / ↑(succ k) ^ 2
log_stirlingSeq' : ℕ → ℝ := fun k => Real.log (stirlingSeq (succ k))
n : ℕ
h₁ : ∀ (k : ℕ), log_stirlingSeq' k - log_stirlingSeq' (k + 1) ≤ 1 / 4 * (1 / ↑(succ k) ^ 2)
this : Summable fun n => 1 / ↑(n + 1) ^ 2
⊢ ∑ k in range n, 1 / ↑(succ k) ^ 2 ≤ d
exact sum_le_tsum (range n) (fun k _ => by positivity) this
no goals
d : ℝ := ∑' (k : ℕ), 1 / ↑(succ k) ^ 2
log_stirlingSeq' : ℕ → ℝ := fun k => Real.log (stirlingSeq (succ k))
n : ℕ
h₁ : ∀ (k : ℕ), log_stirlingSeq' k - log_stirlingSeq' (k + 1) ≤ 1 / 4 * (1 / ↑(succ k) ^ 2)
this : Summable fun n => 1 / ↑(n + 1) ^ 2
k : ℕ
x✝ : ¬k ∈ range n
⊢ 0 ≤ 1 / ↑(succ k) ^ 2
positivity
no goals
d : ℝ := ∑' (k : ℕ), 1 / ↑(succ k) ^ 2
log_stirlingSeq' : ℕ → ℝ := fun k => Real.log (stirlingSeq (succ k))
n : ℕ
h₁ : ∀ (k : ℕ), log_stirlingSeq' k - log_stirlingSeq' (k + 1) ≤ 1 / 4 * (1 / ↑(succ k) ^ 2)
h₂ : ∑ k in range n, 1 / ↑(succ k) ^ 2 ≤ d
⊢ log_stirlingSeq' 0 - log_stirlingSeq' n = ∑ k in range n, (log_stirlingSeq' k - log_stirlingSeq' (k + 1))
rw [← sum_range_sub' log_stirlingSeq' n]
no goals
d : ℝ := ∑' (k : ℕ), 1 / ↑(succ k) ^ 2
log_stirlingSeq' : ℕ → ℝ := fun k => Real.log (stirlingSeq (succ k))
n : ℕ
h₁ : ∀ (k : ℕ), log_stirlingSeq' k - log_stirlingSeq' (k + 1) ≤ 1 / 4 * (1 / ↑(succ k) ^ 2)
h₂ : ∑ k in range n, 1 / ↑(succ k) ^ 2 ≤ d
⊢ ∑ k in range n, 1 / 4 * (1 / ↑(succ k) ^ 2) = 1 / 4 * ∑ k in range n, 1 / ↑(succ k) ^ 2
rw [mul_sum]
no goals
d : ℝ := ∑' (k : ℕ), 1 / ↑(succ k) ^ 2
log_stirlingSeq' : ℕ → ℝ := fun k => Real.log (stirlingSeq (succ k))
n : ℕ
h₁ : ∀ (k : ℕ), log_stirlingSeq' k - log_stirlingSeq' (k + 1) ≤ 1 / 4 * (1 / ↑(succ k) ^ 2)
h₂ : ∑ k in range n, 1 / ↑(succ k) ^ 2 ≤ d
⊢ 0 ≤ 1 / 4
positivity