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

tactic: have hv : ∀ x ∈ uIcc (n : ℝ) (n + 1), 0 < x := by
  intro x hx
  rw [uIcc_of_le (by simp only [le_add_iff_nonneg_right, zero_le_one])] at hx
  exact (Nat.cast_pos.mpr hn).trans_le hx.1
state_before: n : ℕ
hn : 0 < n
⊢ term n 1 = log (↑n + 1) - log ↑n - 1 / (↑n + 1)
state_after: n : ℕ
hn : 0 < n
hv : ∀ x ∈ uIcc (↑n) (↑n + 1), 0 < x
⊢ term n 1 = log (↑n + 1) - log ↑n - 1 / (↑n + 1)

tactic: intro x hx
state_before: n : ℕ
hn : 0 < n
⊢ ∀ x ∈ uIcc (↑n) (↑n + 1), 0 < x
state_after: n : ℕ
hn : 0 < n
x : ℝ
hx : x ∈ uIcc (↑n) (↑n + 1)
⊢ 0 < x

tactic: rw [uIcc_of_le (by simp only [le_add_iff_nonneg_right, zero_le_one])] at hx
state_before: n : ℕ
hn : 0 < n
x : ℝ
hx : x ∈ uIcc (↑n) (↑n + 1)
⊢ 0 < x
state_after: n : ℕ
hn : 0 < n
x : ℝ
hx : x ∈ Icc (↑n) (↑n + 1)
⊢ 0 < x

tactic: exact (Nat.cast_pos.mpr hn).trans_le hx.1
state_before: n : ℕ
hn : 0 < n
x : ℝ
hx : x ∈ Icc (↑n) (↑n + 1)
⊢ 0 < x
state_after: no goals

tactic: simp only [le_add_iff_nonneg_right, zero_le_one]
state_before: n : ℕ
hn : 0 < n
x : ℝ
hx : x ∈ uIcc (↑n) (↑n + 1)
⊢ ↑n ≤ ↑n + 1
state_after: no goals

tactic: simp_rw [term, one_add_one_eq_two, ← Nat.cast_two (R := ℝ), rpow_natCast]
state_before: n : ℕ
hn : 0 < n
hv : ∀ x ∈ uIcc (↑n) (↑n + 1), 0 < x
⊢ term n 1 = ∫ (x : ℝ) in ↑n..↑n + 1, (x - ↑n) / x ^ 2
state_after: no goals

tactic: refine intervalIntegral.integral_congr (fun x hx ↦ ?_)
state_before: n : ℕ
hn : 0 < n
hv : ∀ x ∈ uIcc (↑n) (↑n + 1), 0 < x
⊢ ∫ (x : ℝ) in ↑n..↑n + 1, (x - ↑n) / x ^ 2 = ∫ (x : ℝ) in ↑n..↑n + 1, 1 / x - ↑n / x ^ 2
state_after: n : ℕ
hn : 0 < n
hv : ∀ x ∈ uIcc (↑n) (↑n + 1), 0 < x
x : ℝ
hx : x ∈ uIcc (↑n) (↑n + 1)
⊢ (x - ↑n) / x ^ 2 = 1 / x - ↑n / x ^ 2

tactic: field_simp [(hv x hx).ne']
state_before: n : ℕ
hn : 0 < n
hv : ∀ x ∈ uIcc (↑n) (↑n + 1), 0 < x
x : ℝ
hx : x ∈ uIcc (↑n) (↑n + 1)
⊢ (x - ↑n) / x ^ 2 = 1 / x - ↑n / x ^ 2
state_after: n : ℕ
hn : 0 < n
hv : ∀ x ∈ uIcc (↑n) (↑n + 1), 0 < x
x : ℝ
hx : x ∈ uIcc (↑n) (↑n + 1)
⊢ (x - ↑n) * (x * x ^ 2) = (x ^ 2 - x * ↑n) * x ^ 2

tactic: ring
state_before: n : ℕ
hn : 0 < n
hv : ∀ x ∈ uIcc (↑n) (↑n + 1), 0 < x
x : ℝ
hx : x ∈ uIcc (↑n) (↑n + 1)
⊢ (x - ↑n) * (x * x ^ 2) = (x ^ 2 - x * ↑n) * x ^ 2
state_after: no goals

tactic: simp_rw [← mul_one_div (n : ℝ)]
state_before: n : ℕ
hn : 0 < n
hv : ∀ x ∈ uIcc (↑n) (↑n + 1), 0 < x
⊢ ∫ (x : ℝ) in ↑n..↑n + 1, 1 / x - ↑n / x ^ 2 =
    (∫ (x : ℝ) in ↑n..↑n + 1, 1 / x) - ↑n * ∫ (x : ℝ) in ↑n..↑n + 1, 1 / x ^ 2
state_after: n : ℕ
hn : 0 < n
hv : ∀ x ∈ uIcc (↑n) (↑n + 1), 0 < x
⊢ ∫ (x : ℝ) in ↑n..↑n + 1, 1 / x - ↑n * (1 / x ^ 2) =
    (∫ (x : ℝ) in ↑n..↑n + 1, 1 / x) - ↑n * ∫ (x : ℝ) in ↑n..↑n + 1, 1 / x ^ 2

tactic: rw [intervalIntegral.integral_sub]
state_before: n : ℕ
hn : 0 < n
hv : ∀ x ∈ uIcc (↑n) (↑n + 1), 0 < x
⊢ ∫ (x : ℝ) in ↑n..↑n + 1, 1 / x - ↑n * (1 / x ^ 2) =
    (∫ (x : ℝ) in ↑n..↑n + 1, 1 / x) - ↑n * ∫ (x : ℝ) in ↑n..↑n + 1, 1 / x ^ 2
state_after: n : ℕ
hn : 0 < n
hv : ∀ x ∈ uIcc (↑n) (↑n + 1), 0 < x
⊢ (∫ (x : ℝ) in ↑n..↑n + 1, 1 / x) - ∫ (x : ℝ) in ↑n..↑n + 1, ↑n * (1 / x ^ 2) =
    (∫ (x : ℝ) in ↑n..↑n + 1, 1 / x) - ↑n * ∫ (x : ℝ) in ↑n..↑n + 1, 1 / x ^ 2

case hf
n : ℕ
hn : 0 < n
hv : ∀ x ∈ uIcc (↑n) (↑n + 1), 0 < x
⊢ IntervalIntegrable (HDiv.hDiv 1) volume (↑n) (↑n + 1)

case hg
n : ℕ
hn : 0 < n
hv : ∀ x ∈ uIcc (↑n) (↑n + 1), 0 < x
⊢ IntervalIntegrable (fun x => ↑n * (1 / x ^ 2)) volume (↑n) (↑n + 1)

tactic: simp_rw [intervalIntegral.integral_const_mul]
state_before: n : ℕ
hn : 0 < n
hv : ∀ x ∈ uIcc (↑n) (↑n + 1), 0 < x
⊢ (∫ (x : ℝ) in ↑n..↑n + 1, 1 / x) - ∫ (x : ℝ) in ↑n..↑n + 1, ↑n * (1 / x ^ 2) =
    (∫ (x : ℝ) in ↑n..↑n + 1, 1 / x) - ↑n * ∫ (x : ℝ) in ↑n..↑n + 1, 1 / x ^ 2
state_after: no goals

tactic: exact intervalIntegral.intervalIntegrable_one_div (fun x hx ↦ (hv x hx).ne') (by fun_prop)
state_before: case hf
n : ℕ
hn : 0 < n
hv : ∀ x ∈ uIcc (↑n) (↑n + 1), 0 < x
⊢ IntervalIntegrable (HDiv.hDiv 1) volume (↑n) (↑n + 1)
state_after: no goals

tactic: fun_prop
state_before: n : ℕ
hn : 0 < n
hv : ∀ x ∈ uIcc (↑n) (↑n + 1), 0 < x
⊢ ContinuousOn (fun x => x) (uIcc (↑n) (↑n + 1))
state_after: no goals

tactic: exact (intervalIntegral.intervalIntegrable_one_div
  (fun x hx ↦ (sq_pos_of_pos (hv x hx)).ne') (by fun_prop)).const_mul _
state_before: case hg
n : ℕ
hn : 0 < n
hv : ∀ x ∈ uIcc (↑n) (↑n + 1), 0 < x
⊢ IntervalIntegrable (fun x => ↑n * (1 / x ^ 2)) volume (↑n) (↑n + 1)
state_after: no goals

tactic: fun_prop
state_before: n : ℕ
hn : 0 < n
hv : ∀ x ∈ uIcc (↑n) (↑n + 1), 0 < x
⊢ ContinuousOn (fun x => x ^ 2) (uIcc (↑n) (↑n + 1))
state_after: no goals

tactic: congr 1
state_before: n : ℕ
hn : 0 < n
hv : ∀ x ∈ uIcc (↑n) (↑n + 1), 0 < x
⊢ (∫ (x : ℝ) in ↑n..↑n + 1, 1 / x) - ↑n * ∫ (x : ℝ) in ↑n..↑n + 1, 1 / x ^ 2 =
    log (↑n + 1) - log ↑n - ↑n * ∫ (x : ℝ) in ↑n..↑n + 1, 1 / x ^ 2
state_after: case e_a
n : ℕ
hn : 0 < n
hv : ∀ x ∈ uIcc (↑n) (↑n + 1), 0 < x
⊢ ∫ (x : ℝ) in ↑n..↑n + 1, 1 / x = log (↑n + 1) - log ↑n

tactic: rw [integral_one_div_of_pos, log_div]
state_before: case e_a
n : ℕ
hn : 0 < n
hv : ∀ x ∈ uIcc (↑n) (↑n + 1), 0 < x
⊢ ∫ (x : ℝ) in ↑n..↑n + 1, 1 / x = log (↑n + 1) - log ↑n
state_after: case e_a.hx
n : ℕ
hn : 0 < n
hv : ∀ x ∈ uIcc (↑n) (↑n + 1), 0 < x
⊢ ↑n + 1 ≠ 0

case e_a.hy
n : ℕ
hn : 0 < n
hv : ∀ x ∈ uIcc (↑n) (↑n + 1), 0 < x
⊢ ↑n ≠ 0

case e_a.ha
n : ℕ
hn : 0 < n
hv : ∀ x ∈ uIcc (↑n) (↑n + 1), 0 < x
⊢ 0 < ↑n

case e_a.hb
n : ℕ
hn : 0 < n
hv : ∀ x ∈ uIcc (↑n) (↑n + 1), 0 < x
⊢ 0 < ↑n + 1

tactic: all_goals positivity
state_before: case e_a.hx
n : ℕ
hn : 0 < n
hv : ∀ x ∈ uIcc (↑n) (↑n + 1), 0 < x
⊢ ↑n + 1 ≠ 0

case e_a.hy
n : ℕ
hn : 0 < n
hv : ∀ x ∈ uIcc (↑n) (↑n + 1), 0 < x
⊢ ↑n ≠ 0

case e_a.ha
n : ℕ
hn : 0 < n
hv : ∀ x ∈ uIcc (↑n) (↑n + 1), 0 < x
⊢ 0 < ↑n

case e_a.hb
n : ℕ
hn : 0 < n
hv : ∀ x ∈ uIcc (↑n) (↑n + 1), 0 < x
⊢ 0 < ↑n + 1
state_after: no goals

tactic: positivity
state_before: case e_a.hb
n : ℕ
hn : 0 < n
hv : ∀ x ∈ uIcc (↑n) (↑n + 1), 0 < x
⊢ 0 < ↑n + 1
state_after: no goals

tactic: congr 2
state_before: n : ℕ
hn : 0 < n
hv : ∀ x ∈ uIcc (↑n) (↑n + 1), 0 < x
⊢ log (↑n + 1) - log ↑n - ↑n * ∫ (x : ℝ) in ↑n..↑n + 1, 1 / x ^ 2 =
    log (↑n + 1) - log ↑n - ↑n * ∫ (x : ℝ) in ↑n..↑n + 1, x ^ (-2)
state_after: case e_a.e_a
n : ℕ
hn : 0 < n
hv : ∀ x ∈ uIcc (↑n) (↑n + 1), 0 < x
⊢ ∫ (x : ℝ) in ↑n..↑n + 1, 1 / x ^ 2 = ∫ (x : ℝ) in ↑n..↑n + 1, x ^ (-2)

tactic: refine intervalIntegral.integral_congr (fun x hx ↦ ?_)
state_before: case e_a.e_a
n : ℕ
hn : 0 < n
hv : ∀ x ∈ uIcc (↑n) (↑n + 1), 0 < x
⊢ ∫ (x : ℝ) in ↑n..↑n + 1, 1 / x ^ 2 = ∫ (x : ℝ) in ↑n..↑n + 1, x ^ (-2)
state_after: case e_a.e_a
n : ℕ
hn : 0 < n
hv : ∀ x ∈ uIcc (↑n) (↑n + 1), 0 < x
x : ℝ
hx : x ∈ uIcc (↑n) (↑n + 1)
⊢ 1 / x ^ 2 = x ^ (-2)

tactic: rw [rpow_neg, one_div, ← Nat.cast_two (R := ℝ), rpow_natCast]
state_before: case e_a.e_a
n : ℕ
hn : 0 < n
hv : ∀ x ∈ uIcc (↑n) (↑n + 1), 0 < x
x : ℝ
hx : x ∈ uIcc (↑n) (↑n + 1)
⊢ 1 / x ^ 2 = x ^ (-2)
state_after: case e_a.e_a.hx
n : ℕ
hn : 0 < n
hv : ∀ x ∈ uIcc (↑n) (↑n + 1), 0 < x
x : ℝ
hx : x ∈ uIcc (↑n) (↑n + 1)
⊢ 0 ≤ x

tactic: exact (hv x hx).le
state_before: case e_a.e_a.hx
n : ℕ
hn : 0 < n
hv : ∀ x ∈ uIcc (↑n) (↑n + 1), 0 < x
x : ℝ
hx : x ∈ uIcc (↑n) (↑n + 1)
⊢ 0 ≤ x
state_after: no goals

tactic: rw [integral_rpow]
state_before: n : ℕ
hn : 0 < n
hv : ∀ x ∈ uIcc (↑n) (↑n + 1), 0 < x
⊢ log (↑n + 1) - log ↑n - ↑n * ∫ (x : ℝ) in ↑n..↑n + 1, x ^ (-2) = log (↑n + 1) - log ↑n - ↑n * (1 / ↑n - 1 / (↑n + 1))
state_after: n : ℕ
hn : 0 < n
hv : ∀ x ∈ uIcc (↑n) (↑n + 1), 0 < x
⊢ log (↑n + 1) - log ↑n - ↑n * (((↑n + 1) ^ (-2 + 1) - ↑n ^ (-2 + 1)) / (-2 + 1)) =
    log (↑n + 1) - log ↑n - ↑n * (1 / ↑n - 1 / (↑n + 1))

n : ℕ
hn : 0 < n
hv : ∀ x ∈ uIcc (↑n) (↑n + 1), 0 < x
⊢ -1 < -2 ∨ -2 ≠ -1 ∧ 0 ∉ uIcc (↑n) (↑n + 1)

tactic: simp_rw [sub_div, (by norm_num : (-2 : ℝ) + 1 = -1), div_neg, div_one, neg_sub_neg,
  rpow_neg_one, ← one_div]
state_before: n : ℕ
hn : 0 < n
hv : ∀ x ∈ uIcc (↑n) (↑n + 1), 0 < x
⊢ log (↑n + 1) - log ↑n - ↑n * (((↑n + 1) ^ (-2 + 1) - ↑n ^ (-2 + 1)) / (-2 + 1)) =
    log (↑n + 1) - log ↑n - ↑n * (1 / ↑n - 1 / (↑n + 1))
state_after: no goals

tactic: norm_num
state_before: n : ℕ
hn : 0 < n
hv : ∀ x ∈ uIcc (↑n) (↑n + 1), 0 < x
⊢ -2 + 1 = -1
state_after: no goals

tactic: refine Or.inr ⟨by norm_num, not_mem_uIcc_of_lt ?_ ?_⟩
state_before: n : ℕ
hn : 0 < n
hv : ∀ x ∈ uIcc (↑n) (↑n + 1), 0 < x
⊢ -1 < -2 ∨ -2 ≠ -1 ∧ 0 ∉ uIcc (↑n) (↑n + 1)
state_after: case refine_1
n : ℕ
hn : 0 < n
hv : ∀ x ∈ uIcc (↑n) (↑n + 1), 0 < x
⊢ 0 < ↑n

case refine_2
n : ℕ
hn : 0 < n
hv : ∀ x ∈ uIcc (↑n) (↑n + 1), 0 < x
⊢ 0 < ↑n + 1

tactic: all_goals positivity
state_before: case refine_1
n : ℕ
hn : 0 < n
hv : ∀ x ∈ uIcc (↑n) (↑n + 1), 0 < x
⊢ 0 < ↑n

case refine_2
n : ℕ
hn : 0 < n
hv : ∀ x ∈ uIcc (↑n) (↑n + 1), 0 < x
⊢ 0 < ↑n + 1
state_after: no goals

tactic: norm_num
state_before: n : ℕ
hn : 0 < n
hv : ∀ x ∈ uIcc (↑n) (↑n + 1), 0 < x
⊢ -2 ≠ -1
state_after: no goals

tactic: positivity
state_before: case refine_2
n : ℕ
hn : 0 < n
hv : ∀ x ∈ uIcc (↑n) (↑n + 1), 0 < x
⊢ 0 < ↑n + 1
state_after: no goals

tactic: congr 1
state_before: n : ℕ
hn : 0 < n
hv : ∀ x ∈ uIcc (↑n) (↑n + 1), 0 < x
⊢ log (↑n + 1) - log ↑n - ↑n * (1 / ↑n - 1 / (↑n + 1)) = log (↑n + 1) - log ↑n - 1 / (↑n + 1)
state_after: case e_a
n : ℕ
hn : 0 < n
hv : ∀ x ∈ uIcc (↑n) (↑n + 1), 0 < x
⊢ ↑n * (1 / ↑n - 1 / (↑n + 1)) = 1 / (↑n + 1)

tactic: field_simp
state_before: case e_a
n : ℕ
hn : 0 < n
hv : ∀ x ∈ uIcc (↑n) (↑n + 1), 0 < x
⊢ ↑n * (1 / ↑n - 1 / (↑n + 1)) = 1 / (↑n + 1)
state_after: no goals