Theorem: Complex.hasSum_arctan
File: Mathlib/Analysis/SpecialFunctions/Complex/Arctan.lean

Proof steps:
state_before: z : ℂ
hz : ‖z‖ < 1
⊢ HasSum (fun n => (-1) ^ n * z ^ (2 * n + 1) / ↑(2 * n + 1)) z.arctan
state_after: z : ℂ
hz : ‖z‖ < 1
this :
  HasSum (fun i => -I / 2 * ((-1) ^ (i + 1) * (z * I) ^ i / ↑i + (z * I) ^ i / ↑i))
    (-I / 2 * (log (1 + z * I) + -log (1 - z * I)))
⊢ HasSum (fun n => (-1) ^ n * z ^ (2 * n + 1) / ↑(2 * n + 1)) z.arctan
tactic: have := ((hasSum_taylorSeries_log (z := z * I) (by simpa)).add
    (hasSum_taylorSeries_neg_log (z := z * I) (by simpa))).mul_left (-I / 2)
state_before: z : ℂ
hz : ‖z‖ < 1
this :
  HasSum (fun i => -I / 2 * ((-1) ^ (i + 1) * (z * I) ^ i / ↑i + (z * I) ^ i / ↑i))
    (-I / 2 * (log (1 + z * I) + -log (1 - z * I)))
⊢ HasSum (fun n => (-1) ^ n * z ^ (2 * n + 1) / ↑(2 * n + 1)) z.arctan
state_after: z : ℂ
hz : ‖z‖ < 1
this : HasSum (fun i => -I / 2 * (((-1) ^ (i + 1) + 1) * (z * I) ^ i / ↑i)) (-I / 2 * log ((1 + z * I) / (1 - z * I)))
⊢ HasSum (fun n => (-1) ^ n * z ^ (2 * n + 1) / ↑(2 * n + 1)) z.arctan
tactic: simp_rw [← add_div, ← add_one_mul, hasSum_arctan_aux hz] at this
state_before: z : ℂ
hz : ‖z‖ < 1
this : HasSum (fun i => -I / 2 * (((-1) ^ (i + 1) + 1) * (z * I) ^ i / ↑i)) (-I / 2 * log ((1 + z * I) / (1 - z * I)))
⊢ HasSum (fun n => (-1) ^ n * z ^ (2 * n + 1) / ↑(2 * n + 1)) z.arctan
state_after: z : ℂ
hz : ‖z‖ < 1
this :
  HasSum ((fun i => -I / 2 * (((-1) ^ (i + 1) + 1) * (z * I) ^ i / ↑i)) ∘ ⇑(Nat.divModEquiv 2).symm)
    (-I / 2 * log ((1 + z * I) / (1 - z * I)))
⊢ HasSum (fun n => (-1) ^ n * z ^ (2 * n + 1) / ↑(2 * n + 1)) z.arctan
tactic: replace := (Nat.divModEquiv 2).symm.hasSum_iff.mpr this
state_before: z : ℂ
hz : ‖z‖ < 1
this :
  HasSum ((fun i => -I / 2 * (((-1) ^ (i + 1) + 1) * (z * I) ^ i / ↑i)) ∘ ⇑(Nat.divModEquiv 2).symm)
    (-I / 2 * log ((1 + z * I) / (1 - z * I)))
⊢ HasSum (fun n => (-1) ^ n * z ^ (2 * n + 1) / ↑(2 * n + 1)) z.arctan
state_after: z : ℂ
hz : ‖z‖ < 1
this :
  HasSum (fun x => -I / 2 * (((-1) ^ (x.1 * 2 + ↑x.2 + 1) + 1) * (z * I) ^ (x.1 * 2 + ↑x.2) / ↑(x.1 * 2 + ↑x.2)))
    (-I / 2 * log ((1 + z * I) / (1 - z * I)))
⊢ HasSum (fun n => (-1) ^ n * z ^ (2 * n + 1) / ↑(2 * n + 1)) z.arctan
tactic: dsimp [Function.comp_def] at this
state_before: z : ℂ
hz : ‖z‖ < 1
this :
  HasSum (fun x => -I / 2 * (((-1) ^ (x.1 * 2 + ↑x.2 + 1) + 1) * (z * I) ^ (x.1 * 2 + ↑x.2) / ↑(x.1 * 2 + ↑x.2)))
    (-I / 2 * log ((1 + z * I) / (1 - z * I)))
⊢ HasSum (fun n => (-1) ^ n * z ^ (2 * n + 1) / ↑(2 * n + 1)) z.arctan
state_after: z : ℂ
hz : ‖z‖ < 1
this :
  HasSum (fun x => -I / 2 * (((-1) ^ (2 * x.1 + ↑x.2 + 1) + 1) * (z * I) ^ (2 * x.1 + ↑x.2) / ↑(2 * x.1 + ↑x.2)))
    (-I / 2 * log ((1 + z * I) / (1 - z * I)))
⊢ HasSum (fun n => (-1) ^ n * z ^ (2 * n + 1) / ↑(2 * n + 1)) z.arctan
tactic: simp_rw [← mul_comm 2 _] at this
state_before: z : ℂ
hz : ‖z‖ < 1
this :
  HasSum (fun x => -I / 2 * (((-1) ^ (2 * x.1 + ↑x.2 + 1) + 1) * (z * I) ^ (2 * x.1 + ↑x.2) / ↑(2 * x.1 + ↑x.2)))
    (-I / 2 * log ((1 + z * I) / (1 - z * I)))
⊢ HasSum (fun n => (-1) ^ n * z ^ (2 * n + 1) / ↑(2 * n + 1)) z.arctan
state_after: z : ℂ
hz : ‖z‖ < 1
this :
  HasSum (fun x => -I / 2 * (((-1) ^ (2 * x.1 + ↑x.2 + 1) + 1) * (z * I) ^ (2 * x.1 + ↑x.2) / ↑(2 * x.1 + ↑x.2)))
    (-I / 2 * log ((1 + z * I) / (1 - z * I)))
k : ℕ
⊢ HasSum
    (fun c =>
      -I / 2 *
        (((-1) ^ (2 * (k, c).1 + ↑(k, c).2 + 1) + 1) * (z * I) ^ (2 * (k, c).1 + ↑(k, c).2) /
          ↑(2 * (k, c).1 + ↑(k, c).2)))
    ((-1) ^ k * z ^ (2 * k + 1) / ↑(2 * k + 1))
tactic: refine this.prod_fiberwise fun k => ?_
state_before: z : ℂ
hz : ‖z‖ < 1
this :
  HasSum (fun x => -I / 2 * (((-1) ^ (2 * x.1 + ↑x.2 + 1) + 1) * (z * I) ^ (2 * x.1 + ↑x.2) / ↑(2 * x.1 + ↑x.2)))
    (-I / 2 * log ((1 + z * I) / (1 - z * I)))
k : ℕ
⊢ HasSum
    (fun c =>
      -I / 2 *
        (((-1) ^ (2 * (k, c).1 + ↑(k, c).2 + 1) + 1) * (z * I) ^ (2 * (k, c).1 + ↑(k, c).2) /
          ↑(2 * (k, c).1 + ↑(k, c).2)))
    ((-1) ^ k * z ^ (2 * k + 1) / ↑(2 * k + 1))
state_after: z : ℂ
hz : ‖z‖ < 1
this :
  HasSum (fun x => -I / 2 * (((-1) ^ (2 * x.1 + ↑x.2 + 1) + 1) * (z * I) ^ (2 * x.1 + ↑x.2) / ↑(2 * x.1 + ↑x.2)))
    (-I / 2 * log ((1 + z * I) / (1 - z * I)))
k : ℕ
⊢ HasSum (fun c => -I / 2 * (((-1) ^ (2 * k + ↑c + 1) + 1) * (z * I) ^ (2 * k + ↑c) / ↑(2 * k + ↑c)))
    ((-1) ^ k * z ^ (2 * k + 1) / ↑(2 * k + 1))
tactic: dsimp only
state_before: z : ℂ
hz : ‖z‖ < 1
this :
  HasSum (fun x => -I / 2 * (((-1) ^ (2 * x.1 + ↑x.2 + 1) + 1) * (z * I) ^ (2 * x.1 + ↑x.2) / ↑(2 * x.1 + ↑x.2)))
    (-I / 2 * log ((1 + z * I) / (1 - z * I)))
k : ℕ
⊢ HasSum (fun c => -I / 2 * (((-1) ^ (2 * k + ↑c + 1) + 1) * (z * I) ^ (2 * k + ↑c) / ↑(2 * k + ↑c)))
    ((-1) ^ k * z ^ (2 * k + 1) / ↑(2 * k + 1))
state_after: case h.e'_6
z : ℂ
hz : ‖z‖ < 1
this :
  HasSum (fun x => -I / 2 * (((-1) ^ (2 * x.1 + ↑x.2 + 1) + 1) * (z * I) ^ (2 * x.1 + ↑x.2) / ↑(2 * x.1 + ↑x.2)))
    (-I / 2 * log ((1 + z * I) / (1 - z * I)))
k : ℕ
⊢ (-1) ^ k * z ^ (2 * k + 1) / ↑(2 * k + 1) =
    ∑ b : Fin 2, -I / 2 * (((-1) ^ (2 * k + ↑b + 1) + 1) * (z * I) ^ (2 * k + ↑b) / ↑(2 * k + ↑b))
tactic: convert hasSum_fintype (_ : Fin 2 → ℂ) using 1
state_before: case h.e'_6
z : ℂ
hz : ‖z‖ < 1
this :
  HasSum (fun x => -I / 2 * (((-1) ^ (2 * x.1 + ↑x.2 + 1) + 1) * (z * I) ^ (2 * x.1 + ↑x.2) / ↑(2 * x.1 + ↑x.2)))
    (-I / 2 * log ((1 + z * I) / (1 - z * I)))
k : ℕ
⊢ (-1) ^ k * z ^ (2 * k + 1) / ↑(2 * k + 1) =
    ∑ b : Fin 2, -I / 2 * (((-1) ^ (2 * k + ↑b + 1) + 1) * (z * I) ^ (2 * k + ↑b) / ↑(2 * k + ↑b))
state_after: case h.e'_6
z : ℂ
hz : ‖z‖ < 1
this :
  HasSum (fun x => -I / 2 * (((-1) ^ (2 * x.1 + ↑x.2 + 1) + 1) * (z * I) ^ (2 * x.1 + ↑x.2) / ↑(2 * x.1 + ↑x.2)))
    (-I / 2 * log ((1 + z * I) / (1 - z * I)))
k : ℕ
⊢ (-1) ^ k * z ^ (2 * k + 1) / ↑(2 * k + 1) = -I * (z * I) ^ (2 * k + 1) / ↑(2 * k + 1)
tactic: rw [Fin.sum_univ_two, Fin.val_zero, Fin.val_one, Odd.neg_one_pow (n := 2 * k + 0 + 1) (by simp),
    add_left_neg, zero_mul, zero_div, mul_zero, zero_add, show 2 * k + 1 + 1 = 2 * (k + 1) by ring,
    Even.neg_one_pow (n := 2 * (k + 1)) (by simp), ← mul_div_assoc (_ / _), ← mul_assoc,
    show -I / 2 * (1 + 1) = -I by ring]
state_before: case h.e'_6
z : ℂ
hz : ‖z‖ < 1
this :
  HasSum (fun x => -I / 2 * (((-1) ^ (2 * x.1 + ↑x.2 + 1) + 1) * (z * I) ^ (2 * x.1 + ↑x.2) / ↑(2 * x.1 + ↑x.2)))
    (-I / 2 * log ((1 + z * I) / (1 - z * I)))
k : ℕ
⊢ (-1) ^ k * z ^ (2 * k + 1) / ↑(2 * k + 1) = -I * (z * I) ^ (2 * k + 1) / ↑(2 * k + 1)
state_after: case h.e'_6.e_a
z : ℂ
hz : ‖z‖ < 1
this :
  HasSum (fun x => -I / 2 * (((-1) ^ (2 * x.1 + ↑x.2 + 1) + 1) * (z * I) ^ (2 * x.1 + ↑x.2) / ↑(2 * x.1 + ↑x.2)))
    (-I / 2 * log ((1 + z * I) / (1 - z * I)))
k : ℕ
⊢ (-1) ^ k * z ^ (2 * k + 1) = -I * (z * I) ^ (2 * k + 1)
tactic: congr 1
state_before: case h.e'_6.e_a
z : ℂ
hz : ‖z‖ < 1
this :
  HasSum (fun x => -I / 2 * (((-1) ^ (2 * x.1 + ↑x.2 + 1) + 1) * (z * I) ^ (2 * x.1 + ↑x.2) / ↑(2 * x.1 + ↑x.2)))
    (-I / 2 * log ((1 + z * I) / (1 - z * I)))
k : ℕ
⊢ (-1) ^ k * z ^ (2 * k + 1) = -I * (z * I) ^ (2 * k + 1)
state_after: no goals
tactic: rw [mul_pow, pow_succ' I, pow_mul, I_sq,
    show -I * _ = -(I * I) * (-1) ^ k * z ^ (2 * k + 1) by ring, I_mul_I, neg_neg, one_mul]