Theorem: padicValRat_two_harmonic
File: Mathlib/NumberTheory/Harmonic/Int.lean

tactic: induction' n with n ih
state_before: n : ℕ
⊢ padicValRat 2 (harmonic n) = -↑(Nat.log 2 n)
state_after: case zero

⊢ padicValRat 2 (harmonic 0) = -↑(Nat.log 2 0)

case succ
n : ℕ
ih : padicValRat 2 (harmonic n) = -↑(Nat.log 2 n)
⊢ padicValRat 2 (harmonic (n + 1)) = -↑(Nat.log 2 (n + 1))

tactic: simp
state_before: case zero

⊢ padicValRat 2 (harmonic 0) = -↑(Nat.log 2 0)
state_after: no goals

tactic: rcases eq_or_ne n 0 with rfl | hn
state_before: case succ
n : ℕ
ih : padicValRat 2 (harmonic n) = -↑(Nat.log 2 n)
⊢ padicValRat 2 (harmonic (n + 1)) = -↑(Nat.log 2 (n + 1))
state_after: case succ.inl
ih : padicValRat 2 (harmonic 0) = -↑(Nat.log 2 0)
⊢ padicValRat 2 (harmonic (0 + 1)) = -↑(Nat.log 2 (0 + 1))

case succ.inr
n : ℕ
ih : padicValRat 2 (harmonic n) = -↑(Nat.log 2 n)
hn : n ≠ 0
⊢ padicValRat 2 (harmonic (n + 1)) = -↑(Nat.log 2 (n + 1))

tactic: rw [harmonic_succ]
state_before: case succ.inr
n : ℕ
ih : padicValRat 2 (harmonic n) = -↑(Nat.log 2 n)
hn : n ≠ 0
⊢ padicValRat 2 (harmonic (n + 1)) = -↑(Nat.log 2 (n + 1))
state_after: case succ.inr
n : ℕ
ih : padicValRat 2 (harmonic n) = -↑(Nat.log 2 n)
hn : n ≠ 0
⊢ padicValRat 2 (harmonic n + (↑(n + 1))⁻¹) = -↑(Nat.log 2 (n + 1))

tactic: have key : padicValRat 2 (harmonic n) ≠ padicValRat 2 (↑(n + 1))⁻¹ := by
  rw [ih, padicValRat.inv, padicValRat.of_nat, Ne, neg_inj, Nat.cast_inj]
  exact Nat.log_ne_padicValNat_succ hn
state_before: case succ.inr
n : ℕ
ih : padicValRat 2 (harmonic n) = -↑(Nat.log 2 n)
hn : n ≠ 0
⊢ padicValRat 2 (harmonic n + (↑(n + 1))⁻¹) = -↑(Nat.log 2 (n + 1))
state_after: case succ.inr
n : ℕ
ih : padicValRat 2 (harmonic n) = -↑(Nat.log 2 n)
hn : n ≠ 0
key : padicValRat 2 (harmonic n) ≠ padicValRat 2 (↑(n + 1))⁻¹
⊢ padicValRat 2 (harmonic n + (↑(n + 1))⁻¹) = -↑(Nat.log 2 (n + 1))

tactic: rw [padicValRat.add_eq_min (harmonic_succ n ▸ (harmonic_pos n.succ_ne_zero).ne')
    (harmonic_pos hn).ne' (inv_ne_zero (Nat.cast_ne_zero.mpr n.succ_ne_zero)) key, ih,
    padicValRat.inv, padicValRat.of_nat, min_neg_neg, neg_inj, ← Nat.cast_max, Nat.cast_inj]
state_before: case succ.inr
n : ℕ
ih : padicValRat 2 (harmonic n) = -↑(Nat.log 2 n)
hn : n ≠ 0
key : padicValRat 2 (harmonic n) ≠ padicValRat 2 (↑(n + 1))⁻¹
⊢ padicValRat 2 (harmonic n + (↑(n + 1))⁻¹) = -↑(Nat.log 2 (n + 1))
state_after: case succ.inr
n : ℕ
ih : padicValRat 2 (harmonic n) = -↑(Nat.log 2 n)
hn : n ≠ 0
key : padicValRat 2 (harmonic n) ≠ padicValRat 2 (↑(n + 1))⁻¹
⊢ max (Nat.log 2 n) (padicValNat 2 n.succ) = Nat.log 2 (n + 1)

tactic: exact Nat.max_log_padicValNat_succ_eq_log_succ n
state_before: case succ.inr
n : ℕ
ih : padicValRat 2 (harmonic n) = -↑(Nat.log 2 n)
hn : n ≠ 0
key : padicValRat 2 (harmonic n) ≠ padicValRat 2 (↑(n + 1))⁻¹
⊢ max (Nat.log 2 n) (padicValNat 2 n.succ) = Nat.log 2 (n + 1)
state_after: no goals

tactic: simp
state_before: case succ.inl
ih : padicValRat 2 (harmonic 0) = -↑(Nat.log 2 0)
⊢ padicValRat 2 (harmonic (0 + 1)) = -↑(Nat.log 2 (0 + 1))
state_after: no goals

tactic: rw [ih, padicValRat.inv, padicValRat.of_nat, Ne, neg_inj, Nat.cast_inj]
state_before: n : ℕ
ih : padicValRat 2 (harmonic n) = -↑(Nat.log 2 n)
hn : n ≠ 0
⊢ padicValRat 2 (harmonic n) ≠ padicValRat 2 (↑(n + 1))⁻¹
state_after: n : ℕ
ih : padicValRat 2 (harmonic n) = -↑(Nat.log 2 n)
hn : n ≠ 0
⊢ ¬Nat.log 2 n = padicValNat 2 (n + 1)

tactic: exact Nat.log_ne_padicValNat_succ hn
state_before: n : ℕ
ih : padicValRat 2 (harmonic n) = -↑(Nat.log 2 n)
hn : n ≠ 0
⊢ ¬Nat.log 2 n = padicValNat 2 (n + 1)
state_after: no goals