[GOAL]
q : ℍ
hq : q.re = 0
c s : ℝ
hc : HasSum (fun n => (-1) ^ n * ‖q‖ ^ (2 * n) / ↑(2 * n)!) c
hs : HasSum (fun n => (-1) ^ n * ‖q‖ ^ (2 * n + 1) / ↑(2 * n + 1)!) s
⊢ HasSum (fun n => ↑(expSeries ℝ ℍ n) fun x => q) (↑c + (s / ‖q‖) • q)
[PROOFSTEP]
replace hc := hasSum_coe.mpr hc
[GOAL]
q : ℍ
hq : q.re = 0
c s : ℝ
hs : HasSum (fun n => (-1) ^ n * ‖q‖ ^ (2 * n + 1) / ↑(2 * n + 1)!) s
hc : HasSum (fun a => ↑((-1) ^ a * ‖q‖ ^ (2 * a) / ↑(2 * a)!)) ↑c
⊢ HasSum (fun n => ↑(expSeries ℝ ℍ n) fun x => q) (↑c + (s / ‖q‖) • q)
[PROOFSTEP]
replace hs := (hs.div_const ‖q‖).smul_const q
[GOAL]
q : ℍ
hq : q.re = 0
c s : ℝ
hc : HasSum (fun a => ↑((-1) ^ a * ‖q‖ ^ (2 * a) / ↑(2 * a)!)) ↑c
hs : HasSum (fun z => ((-1) ^ z * ‖q‖ ^ (2 * z + 1) / ↑(2 * z + 1)! / ‖q‖) • q) ((s / ‖q‖) • q)
⊢ HasSum (fun n => ↑(expSeries ℝ ℍ n) fun x => q) (↑c + (s / ‖q‖) • q)
[PROOFSTEP]
obtain rfl | hq0 := eq_or_ne q 0
[GOAL]
case inl
c s : ℝ
hq : 0.re = 0
hc : HasSum (fun a => ↑((-1) ^ a * ‖0‖ ^ (2 * a) / ↑(2 * a)!)) ↑c
hs : HasSum (fun z => ((-1) ^ z * ‖0‖ ^ (2 * z + 1) / ↑(2 * z + 1)! / ‖0‖) • 0) ((s / ‖0‖) • 0)
⊢ HasSum (fun n => ↑(expSeries ℝ ℍ n) fun x => 0) (↑c + (s / ‖0‖) • 0)
[PROOFSTEP]
simp_rw [expSeries_apply_zero, norm_zero, div_zero, zero_smul, add_zero]
[GOAL]
case inl
c s : ℝ
hq : 0.re = 0
hc : HasSum (fun a => ↑((-1) ^ a * ‖0‖ ^ (2 * a) / ↑(2 * a)!)) ↑c
hs : HasSum (fun z => ((-1) ^ z * ‖0‖ ^ (2 * z + 1) / ↑(2 * z + 1)! / ‖0‖) • 0) ((s / ‖0‖) • 0)
⊢ HasSum (fun n => Pi.single 0 1 n) ↑c
[PROOFSTEP]
simp_rw [norm_zero] at hc
[GOAL]
case inl
c s : ℝ
hq : 0.re = 0
hs : HasSum (fun z => ((-1) ^ z * ‖0‖ ^ (2 * z + 1) / ↑(2 * z + 1)! / ‖0‖) • 0) ((s / ‖0‖) • 0)
hc : HasSum (fun a => ↑((-1) ^ a * 0 ^ (2 * a) / ↑(2 * a)!)) ↑c
⊢ HasSum (fun n => Pi.single 0 1 n) ↑c
[PROOFSTEP]
convert hc using 1
[GOAL]
case h.e'_5
c s : ℝ
hq : 0.re = 0
hs : HasSum (fun z => ((-1) ^ z * ‖0‖ ^ (2 * z + 1) / ↑(2 * z + 1)! / ‖0‖) • 0) ((s / ‖0‖) • 0)
hc : HasSum (fun a => ↑((-1) ^ a * 0 ^ (2 * a) / ↑(2 * a)!)) ↑c
⊢ (fun n => Pi.single 0 1 n) = fun a => ↑((-1) ^ a * 0 ^ (2 * a) / ↑(2 * a)!)
[PROOFSTEP]
ext (_ | n) : 1
[GOAL]
case h.e'_5.h.zero
c s : ℝ
hq : 0.re = 0
hs : HasSum (fun z => ((-1) ^ z * ‖0‖ ^ (2 * z + 1) / ↑(2 * z + 1)! / ‖0‖) • 0) ((s / ‖0‖) • 0)
hc : HasSum (fun a => ↑((-1) ^ a * 0 ^ (2 * a) / ↑(2 * a)!)) ↑c
⊢ Pi.single 0 1 Nat.zero = ↑((-1) ^ Nat.zero * 0 ^ (2 * Nat.zero) / ↑(2 * Nat.zero)!)
[PROOFSTEP]
rw [pow_zero, Nat.zero_eq, mul_zero, pow_zero, Nat.factorial_zero, Nat.cast_one, div_one, one_mul, Pi.single_eq_same,
  coe_one]
[GOAL]
case h.e'_5.h.succ
c s : ℝ
hq : 0.re = 0
hs : HasSum (fun z => ((-1) ^ z * ‖0‖ ^ (2 * z + 1) / ↑(2 * z + 1)! / ‖0‖) • 0) ((s / ‖0‖) • 0)
hc : HasSum (fun a => ↑((-1) ^ a * 0 ^ (2 * a) / ↑(2 * a)!)) ↑c
n : ℕ
⊢ Pi.single 0 1 (Nat.succ n) = ↑((-1) ^ Nat.succ n * 0 ^ (2 * Nat.succ n) / ↑(2 * Nat.succ n)!)
[PROOFSTEP]
rw [zero_pow (mul_pos two_pos (Nat.succ_pos _)), mul_zero, zero_div, Pi.single_eq_of_ne n.succ_ne_zero, coe_zero]
[GOAL]
case inr
q : ℍ
hq : q.re = 0
c s : ℝ
hc : HasSum (fun a => ↑((-1) ^ a * ‖q‖ ^ (2 * a) / ↑(2 * a)!)) ↑c
hs : HasSum (fun z => ((-1) ^ z * ‖q‖ ^ (2 * z + 1) / ↑(2 * z + 1)! / ‖q‖) • q) ((s / ‖q‖) • q)
hq0 : q ≠ 0
⊢ HasSum (fun n => ↑(expSeries ℝ ℍ n) fun x => q) (↑c + (s / ‖q‖) • q)
[PROOFSTEP]
simp_rw [expSeries_apply_eq]
[GOAL]
case inr
q : ℍ
hq : q.re = 0
c s : ℝ
hc : HasSum (fun a => ↑((-1) ^ a * ‖q‖ ^ (2 * a) / ↑(2 * a)!)) ↑c
hs : HasSum (fun z => ((-1) ^ z * ‖q‖ ^ (2 * z + 1) / ↑(2 * z + 1)! / ‖q‖) • q) ((s / ‖q‖) • q)
hq0 : q ≠ 0
⊢ HasSum (fun n => (↑n !)⁻¹ • q ^ n) (↑c + (s / ‖q‖) • q)
[PROOFSTEP]
have hq2 : q ^ 2 = -normSq q := sq_eq_neg_normSq.mpr hq
[GOAL]
case inr
q : ℍ
hq : q.re = 0
c s : ℝ
hc : HasSum (fun a => ↑((-1) ^ a * ‖q‖ ^ (2 * a) / ↑(2 * a)!)) ↑c
hs : HasSum (fun z => ((-1) ^ z * ‖q‖ ^ (2 * z + 1) / ↑(2 * z + 1)! / ‖q‖) • q) ((s / ‖q‖) • q)
hq0 : q ≠ 0
hq2 : q ^ 2 = -↑(↑normSq q)
⊢ HasSum (fun n => (↑n !)⁻¹ • q ^ n) (↑c + (s / ‖q‖) • q)
[PROOFSTEP]
have hqn := norm_ne_zero_iff.mpr hq0
[GOAL]
case inr
q : ℍ
hq : q.re = 0
c s : ℝ
hc : HasSum (fun a => ↑((-1) ^ a * ‖q‖ ^ (2 * a) / ↑(2 * a)!)) ↑c
hs : HasSum (fun z => ((-1) ^ z * ‖q‖ ^ (2 * z + 1) / ↑(2 * z + 1)! / ‖q‖) • q) ((s / ‖q‖) • q)
hq0 : q ≠ 0
hq2 : q ^ 2 = -↑(↑normSq q)
hqn : ‖q‖ ≠ 0
⊢ HasSum (fun n => (↑n !)⁻¹ • q ^ n) (↑c + (s / ‖q‖) • q)
[PROOFSTEP]
refine' HasSum.even_add_odd _ _
[GOAL]
case inr.refine'_1
q : ℍ
hq : q.re = 0
c s : ℝ
hc : HasSum (fun a => ↑((-1) ^ a * ‖q‖ ^ (2 * a) / ↑(2 * a)!)) ↑c
hs : HasSum (fun z => ((-1) ^ z * ‖q‖ ^ (2 * z + 1) / ↑(2 * z + 1)! / ‖q‖) • q) ((s / ‖q‖) • q)
hq0 : q ≠ 0
hq2 : q ^ 2 = -↑(↑normSq q)
hqn : ‖q‖ ≠ 0
⊢ HasSum (fun k => (↑(2 * k)!)⁻¹ • q ^ (2 * k)) ↑c
[PROOFSTEP]
convert hc using 1
[GOAL]
case h.e'_5
q : ℍ
hq : q.re = 0
c s : ℝ
hc : HasSum (fun a => ↑((-1) ^ a * ‖q‖ ^ (2 * a) / ↑(2 * a)!)) ↑c
hs : HasSum (fun z => ((-1) ^ z * ‖q‖ ^ (2 * z + 1) / ↑(2 * z + 1)! / ‖q‖) • q) ((s / ‖q‖) • q)
hq0 : q ≠ 0
hq2 : q ^ 2 = -↑(↑normSq q)
hqn : ‖q‖ ≠ 0
⊢ (fun k => (↑(2 * k)!)⁻¹ • q ^ (2 * k)) = fun a => ↑((-1) ^ a * ‖q‖ ^ (2 * a) / ↑(2 * a)!)
[PROOFSTEP]
ext n : 1
[GOAL]
case h.e'_5.h
q : ℍ
hq : q.re = 0
c s : ℝ
hc : HasSum (fun a => ↑((-1) ^ a * ‖q‖ ^ (2 * a) / ↑(2 * a)!)) ↑c
hs : HasSum (fun z => ((-1) ^ z * ‖q‖ ^ (2 * z + 1) / ↑(2 * z + 1)! / ‖q‖) • q) ((s / ‖q‖) • q)
hq0 : q ≠ 0
hq2 : q ^ 2 = -↑(↑normSq q)
hqn : ‖q‖ ≠ 0
n : ℕ
⊢ (↑(2 * n)!)⁻¹ • q ^ (2 * n) = ↑((-1) ^ n * ‖q‖ ^ (2 * n) / ↑(2 * n)!)
[PROOFSTEP]
letI k : ℝ := ↑(2 * n)!
[GOAL]
case h.e'_5.h
q : ℍ
hq : q.re = 0
c s : ℝ
hc : HasSum (fun a => ↑((-1) ^ a * ‖q‖ ^ (2 * a) / ↑(2 * a)!)) ↑c
hs : HasSum (fun z => ((-1) ^ z * ‖q‖ ^ (2 * z + 1) / ↑(2 * z + 1)! / ‖q‖) • q) ((s / ‖q‖) • q)
hq0 : q ≠ 0
hq2 : q ^ 2 = -↑(↑normSq q)
hqn : ‖q‖ ≠ 0
n : ℕ
k : ℝ := ↑(2 * n)!
⊢ (↑(2 * n)!)⁻¹ • q ^ (2 * n) = ↑((-1) ^ n * ‖q‖ ^ (2 * n) / ↑(2 * n)!)
[PROOFSTEP]
calc
  k⁻¹ • q ^ (2 * n) = k⁻¹ • (-normSq q) ^ n := by rw [pow_mul, hq2]; norm_cast
  _ = k⁻¹ • ↑((-1 : ℝ) ^ n * ‖q‖ ^ (2 * n)) := ?_
  _ = ↑((-1 : ℝ) ^ n * ‖q‖ ^ (2 * n) / k) := ?_
[GOAL]
q : ℍ
hq : q.re = 0
c s : ℝ
hc : HasSum (fun a => ↑((-1) ^ a * ‖q‖ ^ (2 * a) / ↑(2 * a)!)) ↑c
hs : HasSum (fun z => ((-1) ^ z * ‖q‖ ^ (2 * z + 1) / ↑(2 * z + 1)! / ‖q‖) • q) ((s / ‖q‖) • q)
hq0 : q ≠ 0
hq2 : q ^ 2 = -↑(↑normSq q)
hqn : ‖q‖ ≠ 0
n : ℕ
k : ℝ := ↑(2 * n)!
⊢ k⁻¹ • q ^ (2 * n) = ↑(k⁻¹ • (-↑normSq q) ^ n)
[PROOFSTEP]
rw [pow_mul, hq2]
[GOAL]
q : ℍ
hq : q.re = 0
c s : ℝ
hc : HasSum (fun a => ↑((-1) ^ a * ‖q‖ ^ (2 * a) / ↑(2 * a)!)) ↑c
hs : HasSum (fun z => ((-1) ^ z * ‖q‖ ^ (2 * z + 1) / ↑(2 * z + 1)! / ‖q‖) • q) ((s / ‖q‖) • q)
hq0 : q ≠ 0
hq2 : q ^ 2 = -↑(↑normSq q)
hqn : ‖q‖ ≠ 0
n : ℕ
k : ℝ := ↑(2 * n)!
⊢ k⁻¹ • (-↑(↑normSq q)) ^ n = ↑(k⁻¹ • (-↑normSq q) ^ n)
[PROOFSTEP]
norm_cast
[GOAL]
case h.e'_5.h.calc_1
q : ℍ
hq : q.re = 0
c s : ℝ
hc : HasSum (fun a => ↑((-1) ^ a * ‖q‖ ^ (2 * a) / ↑(2 * a)!)) ↑c
hs : HasSum (fun z => ((-1) ^ z * ‖q‖ ^ (2 * z + 1) / ↑(2 * z + 1)! / ‖q‖) • q) ((s / ‖q‖) • q)
hq0 : q ≠ 0
hq2 : q ^ 2 = -↑(↑normSq q)
hqn : ‖q‖ ≠ 0
n : ℕ
k : ℝ := ↑(2 * n)!
⊢ ↑(k⁻¹ • (-↑normSq q) ^ n) = k⁻¹ • ↑((-1) ^ n * ‖q‖ ^ (2 * n))
[PROOFSTEP]
congr 1
[GOAL]
case h.e'_5.h.calc_1
q : ℍ
hq : q.re = 0
c s : ℝ
hc : HasSum (fun a => ↑((-1) ^ a * ‖q‖ ^ (2 * a) / ↑(2 * a)!)) ↑c
hs : HasSum (fun z => ((-1) ^ z * ‖q‖ ^ (2 * z + 1) / ↑(2 * z + 1)! / ‖q‖) • q) ((s / ‖q‖) • q)
hq0 : q ≠ 0
hq2 : q ^ 2 = -↑(↑normSq q)
hqn : ‖q‖ ≠ 0
n : ℕ
k : ℝ := ↑(2 * n)!
⊢ ↑(k⁻¹ • (-↑normSq q) ^ n) = k⁻¹ • ↑((-1) ^ n * ‖q‖ ^ (2 * n))
[PROOFSTEP]
rw [neg_pow, normSq_eq_norm_mul_self, pow_mul, sq]
[GOAL]
case h.e'_5.h.calc_1
q : ℍ
hq : q.re = 0
c s : ℝ
hc : HasSum (fun a => ↑((-1) ^ a * ‖q‖ ^ (2 * a) / ↑(2 * a)!)) ↑c
hs : HasSum (fun z => ((-1) ^ z * ‖q‖ ^ (2 * z + 1) / ↑(2 * z + 1)! / ‖q‖) • q) ((s / ‖q‖) • q)
hq0 : q ≠ 0
hq2 : q ^ 2 = -↑(↑normSq q)
hqn : ‖q‖ ≠ 0
n : ℕ
k : ℝ := ↑(2 * n)!
⊢ ↑(k⁻¹ • ((-1) ^ n * (‖q‖ * ‖q‖) ^ n)) = k⁻¹ • ↑((-1) ^ n * (‖q‖ * ‖q‖) ^ n)
[PROOFSTEP]
push_cast
[GOAL]
case h.e'_5.h.calc_1
q : ℍ
hq : q.re = 0
c s : ℝ
hc : HasSum (fun a => ↑((-1) ^ a * ‖q‖ ^ (2 * a) / ↑(2 * a)!)) ↑c
hs : HasSum (fun z => ((-1) ^ z * ‖q‖ ^ (2 * z + 1) / ↑(2 * z + 1)! / ‖q‖) • q) ((s / ‖q‖) • q)
hq0 : q ≠ 0
hq2 : q ^ 2 = -↑(↑normSq q)
hqn : ‖q‖ ≠ 0
n : ℕ
k : ℝ := ↑(2 * n)!
⊢ (↑(2 * n)!)⁻¹ • ((-1) ^ n * (↑‖q‖ * ↑‖q‖) ^ n) = (↑(2 * n)!)⁻¹ • ((-1) ^ n * (↑‖q‖ * ↑‖q‖) ^ n)
[PROOFSTEP]
rfl
[GOAL]
case h.e'_5.h.calc_2
q : ℍ
hq : q.re = 0
c s : ℝ
hc : HasSum (fun a => ↑((-1) ^ a * ‖q‖ ^ (2 * a) / ↑(2 * a)!)) ↑c
hs : HasSum (fun z => ((-1) ^ z * ‖q‖ ^ (2 * z + 1) / ↑(2 * z + 1)! / ‖q‖) • q) ((s / ‖q‖) • q)
hq0 : q ≠ 0
hq2 : q ^ 2 = -↑(↑normSq q)
hqn : ‖q‖ ≠ 0
n : ℕ
k : ℝ := ↑(2 * n)!
⊢ k⁻¹ • ↑((-1) ^ n * ‖q‖ ^ (2 * n)) = ↑((-1) ^ n * ‖q‖ ^ (2 * n) / k)
[PROOFSTEP]
rw [← coe_mul_eq_smul, div_eq_mul_inv]
[GOAL]
case h.e'_5.h.calc_2
q : ℍ
hq : q.re = 0
c s : ℝ
hc : HasSum (fun a => ↑((-1) ^ a * ‖q‖ ^ (2 * a) / ↑(2 * a)!)) ↑c
hs : HasSum (fun z => ((-1) ^ z * ‖q‖ ^ (2 * z + 1) / ↑(2 * z + 1)! / ‖q‖) • q) ((s / ‖q‖) • q)
hq0 : q ≠ 0
hq2 : q ^ 2 = -↑(↑normSq q)
hqn : ‖q‖ ≠ 0
n : ℕ
k : ℝ := ↑(2 * n)!
⊢ ↑k⁻¹ * ↑((-1) ^ n * ‖q‖ ^ (2 * n)) = ↑((-1) ^ n * ‖q‖ ^ (2 * n) * k⁻¹)
[PROOFSTEP]
norm_cast
[GOAL]
case h.e'_5.h.calc_2
q : ℍ
hq : q.re = 0
c s : ℝ
hc : HasSum (fun a => ↑((-1) ^ a * ‖q‖ ^ (2 * a) / ↑(2 * a)!)) ↑c
hs : HasSum (fun z => ((-1) ^ z * ‖q‖ ^ (2 * z + 1) / ↑(2 * z + 1)! / ‖q‖) • q) ((s / ‖q‖) • q)
hq0 : q ≠ 0
hq2 : q ^ 2 = -↑(↑normSq q)
hqn : ‖q‖ ≠ 0
n : ℕ
k : ℝ := ↑(2 * n)!
⊢ ↑(k⁻¹ * (↑(Int.negSucc 0 ^ n) * ‖q‖ ^ (2 * n))) = ↑(↑(Int.negSucc 0 ^ n) * ‖q‖ ^ (2 * n) * k⁻¹)
[PROOFSTEP]
ring_nf
[GOAL]
case inr.refine'_2
q : ℍ
hq : q.re = 0
c s : ℝ
hc : HasSum (fun a => ↑((-1) ^ a * ‖q‖ ^ (2 * a) / ↑(2 * a)!)) ↑c
hs : HasSum (fun z => ((-1) ^ z * ‖q‖ ^ (2 * z + 1) / ↑(2 * z + 1)! / ‖q‖) • q) ((s / ‖q‖) • q)
hq0 : q ≠ 0
hq2 : q ^ 2 = -↑(↑normSq q)
hqn : ‖q‖ ≠ 0
⊢ HasSum (fun k => (↑(2 * k + 1)!)⁻¹ • q ^ (2 * k + 1)) ((s / ‖q‖) • q)
[PROOFSTEP]
convert hs using 1
[GOAL]
case h.e'_5
q : ℍ
hq : q.re = 0
c s : ℝ
hc : HasSum (fun a => ↑((-1) ^ a * ‖q‖ ^ (2 * a) / ↑(2 * a)!)) ↑c
hs : HasSum (fun z => ((-1) ^ z * ‖q‖ ^ (2 * z + 1) / ↑(2 * z + 1)! / ‖q‖) • q) ((s / ‖q‖) • q)
hq0 : q ≠ 0
hq2 : q ^ 2 = -↑(↑normSq q)
hqn : ‖q‖ ≠ 0
⊢ (fun k => (↑(2 * k + 1)!)⁻¹ • q ^ (2 * k + 1)) = fun z => ((-1) ^ z * ‖q‖ ^ (2 * z + 1) / ↑(2 * z + 1)! / ‖q‖) • q
[PROOFSTEP]
ext n : 1
[GOAL]
case h.e'_5.h
q : ℍ
hq : q.re = 0
c s : ℝ
hc : HasSum (fun a => ↑((-1) ^ a * ‖q‖ ^ (2 * a) / ↑(2 * a)!)) ↑c
hs : HasSum (fun z => ((-1) ^ z * ‖q‖ ^ (2 * z + 1) / ↑(2 * z + 1)! / ‖q‖) • q) ((s / ‖q‖) • q)
hq0 : q ≠ 0
hq2 : q ^ 2 = -↑(↑normSq q)
hqn : ‖q‖ ≠ 0
n : ℕ
⊢ (↑(2 * n + 1)!)⁻¹ • q ^ (2 * n + 1) = ((-1) ^ n * ‖q‖ ^ (2 * n + 1) / ↑(2 * n + 1)! / ‖q‖) • q
[PROOFSTEP]
let k : ℝ := ↑(2 * n + 1)!
[GOAL]
case h.e'_5.h
q : ℍ
hq : q.re = 0
c s : ℝ
hc : HasSum (fun a => ↑((-1) ^ a * ‖q‖ ^ (2 * a) / ↑(2 * a)!)) ↑c
hs : HasSum (fun z => ((-1) ^ z * ‖q‖ ^ (2 * z + 1) / ↑(2 * z + 1)! / ‖q‖) • q) ((s / ‖q‖) • q)
hq0 : q ≠ 0
hq2 : q ^ 2 = -↑(↑normSq q)
hqn : ‖q‖ ≠ 0
n : ℕ
k : ℝ := ↑(2 * n + 1)!
⊢ (↑(2 * n + 1)!)⁻¹ • q ^ (2 * n + 1) = ((-1) ^ n * ‖q‖ ^ (2 * n + 1) / ↑(2 * n + 1)! / ‖q‖) • q
[PROOFSTEP]
calc
  k⁻¹ • q ^ (2 * n + 1) = k⁻¹ • ((-normSq q) ^ n * q) :=
    by
    rw [pow_succ', pow_mul, hq2]
    norm_cast
  _ = k⁻¹ • ((-1 : ℝ) ^ n * ‖q‖ ^ (2 * n)) • q := ?_
  _ = ((-1 : ℝ) ^ n * ‖q‖ ^ (2 * n + 1) / k / ‖q‖) • q := ?_
[GOAL]
q : ℍ
hq : q.re = 0
c s : ℝ
hc : HasSum (fun a => ↑((-1) ^ a * ‖q‖ ^ (2 * a) / ↑(2 * a)!)) ↑c
hs : HasSum (fun z => ((-1) ^ z * ‖q‖ ^ (2 * z + 1) / ↑(2 * z + 1)! / ‖q‖) • q) ((s / ‖q‖) • q)
hq0 : q ≠ 0
hq2 : q ^ 2 = -↑(↑normSq q)
hqn : ‖q‖ ≠ 0
n : ℕ
k : ℝ := ↑(2 * n + 1)!
⊢ k⁻¹ • q ^ (2 * n + 1) = k⁻¹ • (↑((-↑normSq q) ^ n) * q)
[PROOFSTEP]
rw [pow_succ', pow_mul, hq2]
[GOAL]
q : ℍ
hq : q.re = 0
c s : ℝ
hc : HasSum (fun a => ↑((-1) ^ a * ‖q‖ ^ (2 * a) / ↑(2 * a)!)) ↑c
hs : HasSum (fun z => ((-1) ^ z * ‖q‖ ^ (2 * z + 1) / ↑(2 * z + 1)! / ‖q‖) • q) ((s / ‖q‖) • q)
hq0 : q ≠ 0
hq2 : q ^ 2 = -↑(↑normSq q)
hqn : ‖q‖ ≠ 0
n : ℕ
k : ℝ := ↑(2 * n + 1)!
⊢ k⁻¹ • ((-↑(↑normSq q)) ^ n * q) = k⁻¹ • (↑((-↑normSq q) ^ n) * q)
[PROOFSTEP]
norm_cast
[GOAL]
case h.e'_5.h.calc_1
q : ℍ
hq : q.re = 0
c s : ℝ
hc : HasSum (fun a => ↑((-1) ^ a * ‖q‖ ^ (2 * a) / ↑(2 * a)!)) ↑c
hs : HasSum (fun z => ((-1) ^ z * ‖q‖ ^ (2 * z + 1) / ↑(2 * z + 1)! / ‖q‖) • q) ((s / ‖q‖) • q)
hq0 : q ≠ 0
hq2 : q ^ 2 = -↑(↑normSq q)
hqn : ‖q‖ ≠ 0
n : ℕ
k : ℝ := ↑(2 * n + 1)!
⊢ k⁻¹ • (↑((-↑normSq q) ^ n) * q) = k⁻¹ • ((-1) ^ n * ‖q‖ ^ (2 * n)) • q
[PROOFSTEP]
congr 1
[GOAL]
case h.e'_5.h.calc_1.e_a
q : ℍ
hq : q.re = 0
c s : ℝ
hc : HasSum (fun a => ↑((-1) ^ a * ‖q‖ ^ (2 * a) / ↑(2 * a)!)) ↑c
hs : HasSum (fun z => ((-1) ^ z * ‖q‖ ^ (2 * z + 1) / ↑(2 * z + 1)! / ‖q‖) • q) ((s / ‖q‖) • q)
hq0 : q ≠ 0
hq2 : q ^ 2 = -↑(↑normSq q)
hqn : ‖q‖ ≠ 0
n : ℕ
k : ℝ := ↑(2 * n + 1)!
⊢ ↑((-↑normSq q) ^ n) * q = ((-1) ^ n * ‖q‖ ^ (2 * n)) • q
[PROOFSTEP]
rw [neg_pow, normSq_eq_norm_mul_self, pow_mul, sq, ← coe_mul_eq_smul]
[GOAL]
case h.e'_5.h.calc_2
q : ℍ
hq : q.re = 0
c s : ℝ
hc : HasSum (fun a => ↑((-1) ^ a * ‖q‖ ^ (2 * a) / ↑(2 * a)!)) ↑c
hs : HasSum (fun z => ((-1) ^ z * ‖q‖ ^ (2 * z + 1) / ↑(2 * z + 1)! / ‖q‖) • q) ((s / ‖q‖) • q)
hq0 : q ≠ 0
hq2 : q ^ 2 = -↑(↑normSq q)
hqn : ‖q‖ ≠ 0
n : ℕ
k : ℝ := ↑(2 * n + 1)!
⊢ k⁻¹ • ((-1) ^ n * ‖q‖ ^ (2 * n)) • q = ((-1) ^ n * ‖q‖ ^ (2 * n + 1) / k / ‖q‖) • q
[PROOFSTEP]
rw [smul_smul]
[GOAL]
case h.e'_5.h.calc_2
q : ℍ
hq : q.re = 0
c s : ℝ
hc : HasSum (fun a => ↑((-1) ^ a * ‖q‖ ^ (2 * a) / ↑(2 * a)!)) ↑c
hs : HasSum (fun z => ((-1) ^ z * ‖q‖ ^ (2 * z + 1) / ↑(2 * z + 1)! / ‖q‖) • q) ((s / ‖q‖) • q)
hq0 : q ≠ 0
hq2 : q ^ 2 = -↑(↑normSq q)
hqn : ‖q‖ ≠ 0
n : ℕ
k : ℝ := ↑(2 * n + 1)!
⊢ (k⁻¹ * ((-1) ^ n * ‖q‖ ^ (2 * n))) • q = ((-1) ^ n * ‖q‖ ^ (2 * n + 1) / k / ‖q‖) • q
[PROOFSTEP]
congr 1
[GOAL]
case h.e'_5.h.calc_2.e_a
q : ℍ
hq : q.re = 0
c s : ℝ
hc : HasSum (fun a => ↑((-1) ^ a * ‖q‖ ^ (2 * a) / ↑(2 * a)!)) ↑c
hs : HasSum (fun z => ((-1) ^ z * ‖q‖ ^ (2 * z + 1) / ↑(2 * z + 1)! / ‖q‖) • q) ((s / ‖q‖) • q)
hq0 : q ≠ 0
hq2 : q ^ 2 = -↑(↑normSq q)
hqn : ‖q‖ ≠ 0
n : ℕ
k : ℝ := ↑(2 * n + 1)!
⊢ k⁻¹ * ((-1) ^ n * ‖q‖ ^ (2 * n)) = (-1) ^ n * ‖q‖ ^ (2 * n + 1) / k / ‖q‖
[PROOFSTEP]
simp_rw [pow_succ', mul_div_assoc, div_div_cancel_left' hqn]
[GOAL]
case h.e'_5.h.calc_2.e_a
q : ℍ
hq : q.re = 0
c s : ℝ
hc : HasSum (fun a => ↑((-1) ^ a * ‖q‖ ^ (2 * a) / ↑(2 * a)!)) ↑c
hs : HasSum (fun z => ((-1) ^ z * ‖q‖ ^ (2 * z + 1) / ↑(2 * z + 1)! / ‖q‖) • q) ((s / ‖q‖) • q)
hq0 : q ≠ 0
hq2 : q ^ 2 = -↑(↑normSq q)
hqn : ‖q‖ ≠ 0
n : ℕ
k : ℝ := ↑(2 * n + 1)!
⊢ (↑(2 * n + 1)!)⁻¹ * ((-1) ^ n * ‖q‖ ^ (2 * n)) = (-1) ^ n * (‖q‖ ^ (2 * n) * (↑(2 * n + 1)!)⁻¹)
[PROOFSTEP]
ring
[GOAL]
q : ℍ
hq : q.re = 0
⊢ exp ℝ q = ↑(Real.cos ‖q‖) + (Real.sin ‖q‖ / ‖q‖) • q
[PROOFSTEP]
rw [exp_eq_tsum]
[GOAL]
q : ℍ
hq : q.re = 0
⊢ (fun x => ∑' (n : ℕ), (↑n !)⁻¹ • x ^ n) q = ↑(Real.cos ‖q‖) + (Real.sin ‖q‖ / ‖q‖) • q
[PROOFSTEP]
refine' HasSum.tsum_eq _
[GOAL]
q : ℍ
hq : q.re = 0
⊢ HasSum (fun n => (↑n !)⁻¹ • q ^ n) (↑(Real.cos ‖q‖) + (Real.sin ‖q‖ / ‖q‖) • q)
[PROOFSTEP]
simp_rw [← expSeries_apply_eq]
[GOAL]
q : ℍ
hq : q.re = 0
⊢ HasSum (fun n => ↑(expSeries ℝ ℍ n) fun x => q) (↑(Real.cos ‖q‖) + (Real.sin ‖q‖ / ‖q‖) • q)
[PROOFSTEP]
exact hasSum_expSeries_of_imaginary hq (Real.hasSum_cos _) (Real.hasSum_sin _)
[GOAL]
q : ℍ
⊢ exp ℝ q = exp ℝ q.re • (↑(Real.cos ‖im q‖) + (Real.sin ‖im q‖ / ‖im q‖) • im q)
[PROOFSTEP]
rw [← exp_of_re_eq_zero q.im q.im_re, ← coe_mul_eq_smul, ← exp_coe, ← exp_add_of_commute, re_add_im]
[GOAL]
q : ℍ
⊢ Commute (↑q.re) (im q)
[PROOFSTEP]
exact Algebra.commutes q.re (_ : ℍ[ℝ])
[GOAL]
q : ℍ
⊢ (exp ℝ q).re = exp ℝ q.re * Real.cos ‖q - ↑q.re‖
[PROOFSTEP]
simp [exp_eq]
[GOAL]
q : ℍ
⊢ im (exp ℝ q) = (exp ℝ q.re * (Real.sin ‖im q‖ / ‖im q‖)) • im q
[PROOFSTEP]
simp [exp_eq, smul_smul]
[GOAL]
q : ℍ
⊢ ↑normSq (exp ℝ q) = ↑normSq (exp ℝ q.re • (↑(Real.cos ‖im q‖) + (Real.sin ‖im q‖ / ‖im q‖) • im q))
[PROOFSTEP]
rw [exp_eq]
[GOAL]
q : ℍ
⊢ ↑normSq (exp ℝ q.re • (↑(Real.cos ‖im q‖) + (Real.sin ‖im q‖ / ‖im q‖) • im q)) =
    exp ℝ q.re ^ 2 * ↑normSq (↑(Real.cos ‖im q‖) + (Real.sin ‖im q‖ / ‖im q‖) • im q)
[PROOFSTEP]
rw [normSq_smul]
[GOAL]
q : ℍ
⊢ exp ℝ q.re ^ 2 * ↑normSq (↑(Real.cos ‖im q‖) + (Real.sin ‖im q‖ / ‖im q‖) • im q) =
    exp ℝ q.re ^ 2 * (Real.cos ‖im q‖ ^ 2 + Real.sin ‖im q‖ ^ 2)
[PROOFSTEP]
congr 1
[GOAL]
case e_a
q : ℍ
⊢ ↑normSq (↑(Real.cos ‖im q‖) + (Real.sin ‖im q‖ / ‖im q‖) • im q) = Real.cos ‖im q‖ ^ 2 + Real.sin ‖im q‖ ^ 2
[PROOFSTEP]
obtain hv | hv := eq_or_ne ‖q.im‖ 0
[GOAL]
case e_a.inl
q : ℍ
hv : ‖im q‖ = 0
⊢ ↑normSq (↑(Real.cos ‖im q‖) + (Real.sin ‖im q‖ / ‖im q‖) • im q) = Real.cos ‖im q‖ ^ 2 + Real.sin ‖im q‖ ^ 2
[PROOFSTEP]
simp [hv]
[GOAL]
case e_a.inr
q : ℍ
hv : ‖im q‖ ≠ 0
⊢ ↑normSq (↑(Real.cos ‖im q‖) + (Real.sin ‖im q‖ / ‖im q‖) • im q) = Real.cos ‖im q‖ ^ 2 + Real.sin ‖im q‖ ^ 2
[PROOFSTEP]
rw [normSq_add, normSq_smul, star_smul, coe_mul_eq_smul, smul_re, smul_re, star_re, im_re, smul_zero, smul_zero,
  mul_zero, add_zero, div_pow, normSq_coe, normSq_eq_norm_mul_self, ← sq, div_mul_cancel _ (pow_ne_zero _ hv)]
[GOAL]
q : ℍ
⊢ exp ℝ q.re ^ 2 * (Real.cos ‖im q‖ ^ 2 + Real.sin ‖im q‖ ^ 2) = exp ℝ q.re ^ 2
[PROOFSTEP]
rw [Real.cos_sq_add_sin_sq, mul_one]
[GOAL]
q : ℍ
⊢ ‖exp ℝ q‖ = ‖exp ℝ q.re‖
[PROOFSTEP]
rw [norm_eq_sqrt_real_inner (exp ℝ q), inner_self, normSq_exp, Real.sqrt_sq_eq_abs, Real.norm_eq_abs]