Theorem: Complex.hasDerivAt_logTaylor
File: Mathlib/Analysis/SpecialFunctions/Complex/LogBounds.lean

tactic: induction n with
| zero => simp [logTaylor_succ, logTaylor_zero, Pi.add_def, hasDerivAt_const]
| succ n ih =>
  rw [logTaylor_succ]
  simp only [cpow_natCast, Nat.cast_add, Nat.cast_one, Nat.odd_iff_not_even,
    Finset.sum_range_succ, (show (-1) ^ (n + 1 + 1) = (-1) ^ n by ring)]
  refine HasDerivAt.add ih ?_
  simp only [Nat.odd_iff_not_even, Int.cast_pow, Int.cast_neg, Int.cast_one, mul_div_assoc]
  have : HasDerivAt (fun x : ℂ ↦ (x ^ (n + 1) / (n + 1))) (z ^ n) z := by
    simp_rw [div_eq_mul_inv]
    convert HasDerivAt.mul_const (hasDerivAt_pow (n + 1) z) (((n : ℂ) + 1)⁻¹) using 1
    field_simp [Nat.cast_add_one_ne_zero n]
  convert HasDerivAt.const_mul _ this using 2
  ring
state_before: n : ℕ
z : ℂ
⊢ HasDerivAt (logTaylor (n + 1)) (∑ j ∈ Finset.range n, (-1) ^ j * z ^ j) z
state_after: no goals

tactic: simp [logTaylor_succ, logTaylor_zero, Pi.add_def, hasDerivAt_const]
state_before: case zero
z : ℂ
⊢ HasDerivAt (logTaylor (0 + 1)) (∑ j ∈ Finset.range 0, (-1) ^ j * z ^ j) z
state_after: no goals

tactic: rw [logTaylor_succ]
state_before: case succ
z : ℂ
n : ℕ
ih : HasDerivAt (logTaylor (n + 1)) (∑ j ∈ Finset.range n, (-1) ^ j * z ^ j) z
⊢ HasDerivAt (logTaylor (n + 1 + 1)) (∑ j ∈ Finset.range (n + 1), (-1) ^ j * z ^ j) z
state_after: case succ
z : ℂ
n : ℕ
ih : HasDerivAt (logTaylor (n + 1)) (∑ j ∈ Finset.range n, (-1) ^ j * z ^ j) z
⊢ HasDerivAt (logTaylor (n + 1) + fun z => (-1) ^ (n + 1 + 1) * z ^ (n + 1) / ↑(n + 1))
    (∑ j ∈ Finset.range (n + 1), (-1) ^ j * z ^ j) z

tactic: simp only [cpow_natCast, Nat.cast_add, Nat.cast_one, Nat.odd_iff_not_even,
  Finset.sum_range_succ, (show (-1) ^ (n + 1 + 1) = (-1) ^ n by ring)]
state_before: case succ
z : ℂ
n : ℕ
ih : HasDerivAt (logTaylor (n + 1)) (∑ j ∈ Finset.range n, (-1) ^ j * z ^ j) z
⊢ HasDerivAt (logTaylor (n + 1) + fun z => (-1) ^ (n + 1 + 1) * z ^ (n + 1) / ↑(n + 1))
    (∑ j ∈ Finset.range (n + 1), (-1) ^ j * z ^ j) z
state_after: case succ
z : ℂ
n : ℕ
ih : HasDerivAt (logTaylor (n + 1)) (∑ j ∈ Finset.range n, (-1) ^ j * z ^ j) z
⊢ HasDerivAt (logTaylor (n + 1) + fun z => (-1) ^ (n + 1 + 1) * z ^ (n + 1) / (↑n + 1))
    (∑ j ∈ Finset.range n, (-1) ^ j * z ^ j + (-1) ^ n * z ^ n) z

tactic: refine HasDerivAt.add ih ?_
state_before: case succ
z : ℂ
n : ℕ
ih : HasDerivAt (logTaylor (n + 1)) (∑ j ∈ Finset.range n, (-1) ^ j * z ^ j) z
⊢ HasDerivAt (logTaylor (n + 1) + fun z => (-1) ^ (n + 1 + 1) * z ^ (n + 1) / (↑n + 1))
    (∑ j ∈ Finset.range n, (-1) ^ j * z ^ j + (-1) ^ n * z ^ n) z
state_after: case succ
z : ℂ
n : ℕ
ih : HasDerivAt (logTaylor (n + 1)) (∑ j ∈ Finset.range n, (-1) ^ j * z ^ j) z
⊢ HasDerivAt (fun z => (-1) ^ (n + 1 + 1) * z ^ (n + 1) / (↑n + 1)) ((-1) ^ n * z ^ n) z

tactic: simp only [Nat.odd_iff_not_even, Int.cast_pow, Int.cast_neg, Int.cast_one, mul_div_assoc]
state_before: case succ
z : ℂ
n : ℕ
ih : HasDerivAt (logTaylor (n + 1)) (∑ j ∈ Finset.range n, (-1) ^ j * z ^ j) z
⊢ HasDerivAt (fun z => (-1) ^ (n + 1 + 1) * z ^ (n + 1) / (↑n + 1)) ((-1) ^ n * z ^ n) z
state_after: case succ
z : ℂ
n : ℕ
ih : HasDerivAt (logTaylor (n + 1)) (∑ j ∈ Finset.range n, (-1) ^ j * z ^ j) z
⊢ HasDerivAt (fun z => (-1) ^ (n + 1 + 1) * (z ^ (n + 1) / (↑n + 1))) ((-1) ^ n * z ^ n) z

tactic: have : HasDerivAt (fun x : ℂ ↦ (x ^ (n + 1) / (n + 1))) (z ^ n) z := by
  simp_rw [div_eq_mul_inv]
  convert HasDerivAt.mul_const (hasDerivAt_pow (n + 1) z) (((n : ℂ) + 1)⁻¹) using 1
  field_simp [Nat.cast_add_one_ne_zero n]
state_before: case succ
z : ℂ
n : ℕ
ih : HasDerivAt (logTaylor (n + 1)) (∑ j ∈ Finset.range n, (-1) ^ j * z ^ j) z
⊢ HasDerivAt (fun z => (-1) ^ (n + 1 + 1) * (z ^ (n + 1) / (↑n + 1))) ((-1) ^ n * z ^ n) z
state_after: case succ
z : ℂ
n : ℕ
ih : HasDerivAt (logTaylor (n + 1)) (∑ j ∈ Finset.range n, (-1) ^ j * z ^ j) z
this : HasDerivAt (fun x => x ^ (n + 1) / (↑n + 1)) (z ^ n) z
⊢ HasDerivAt (fun z => (-1) ^ (n + 1 + 1) * (z ^ (n + 1) / (↑n + 1))) ((-1) ^ n * z ^ n) z

tactic: convert HasDerivAt.const_mul _ this using 2
state_before: case succ
z : ℂ
n : ℕ
ih : HasDerivAt (logTaylor (n + 1)) (∑ j ∈ Finset.range n, (-1) ^ j * z ^ j) z
this : HasDerivAt (fun x => x ^ (n + 1) / (↑n + 1)) (z ^ n) z
⊢ HasDerivAt (fun z => (-1) ^ (n + 1 + 1) * (z ^ (n + 1) / (↑n + 1))) ((-1) ^ n * z ^ n) z
state_after: case h.e'_7.h.e'_5
z : ℂ
n : ℕ
ih : HasDerivAt (logTaylor (n + 1)) (∑ j ∈ Finset.range n, (-1) ^ j * z ^ j) z
this : HasDerivAt (fun x => x ^ (n + 1) / (↑n + 1)) (z ^ n) z
⊢ (-1) ^ n = (-1) ^ (n + 1 + 1)

tactic: ring
state_before: case h.e'_7.h.e'_5
z : ℂ
n : ℕ
ih : HasDerivAt (logTaylor (n + 1)) (∑ j ∈ Finset.range n, (-1) ^ j * z ^ j) z
this : HasDerivAt (fun x => x ^ (n + 1) / (↑n + 1)) (z ^ n) z
⊢ (-1) ^ n = (-1) ^ (n + 1 + 1)
state_after: no goals

tactic: ring
state_before: z : ℂ
n : ℕ
ih : HasDerivAt (logTaylor (n + 1)) (∑ j ∈ Finset.range n, (-1) ^ j * z ^ j) z
⊢ (-1) ^ (n + 1 + 1) = (-1) ^ n
state_after: no goals

tactic: simp_rw [div_eq_mul_inv]
state_before: z : ℂ
n : ℕ
ih : HasDerivAt (logTaylor (n + 1)) (∑ j ∈ Finset.range n, (-1) ^ j * z ^ j) z
⊢ HasDerivAt (fun x => x ^ (n + 1) / (↑n + 1)) (z ^ n) z
state_after: z : ℂ
n : ℕ
ih : HasDerivAt (logTaylor (n + 1)) (∑ j ∈ Finset.range n, (-1) ^ j * z ^ j) z
⊢ HasDerivAt (fun x => x ^ (n + 1) * (↑n + 1)⁻¹) (z ^ n) z

tactic: convert HasDerivAt.mul_const (hasDerivAt_pow (n + 1) z) (((n : ℂ) + 1)⁻¹) using 1
state_before: z : ℂ
n : ℕ
ih : HasDerivAt (logTaylor (n + 1)) (∑ j ∈ Finset.range n, (-1) ^ j * z ^ j) z
⊢ HasDerivAt (fun x => x ^ (n + 1) * (↑n + 1)⁻¹) (z ^ n) z
state_after: case h.e'_7
z : ℂ
n : ℕ
ih : HasDerivAt (logTaylor (n + 1)) (∑ j ∈ Finset.range n, (-1) ^ j * z ^ j) z
⊢ z ^ n = ↑(n + 1) * z ^ (n + 1 - 1) * (↑n + 1)⁻¹

tactic: field_simp [Nat.cast_add_one_ne_zero n]
state_before: case h.e'_7
z : ℂ
n : ℕ
ih : HasDerivAt (logTaylor (n + 1)) (∑ j ∈ Finset.range n, (-1) ^ j * z ^ j) z
⊢ z ^ n = ↑(n + 1) * z ^ (n + 1 - 1) * (↑n + 1)⁻¹
state_after: no goals