Theorem: hasSum_coe_mul_geometric_of_norm_lt_one
File: Mathlib/Analysis/SpecificLimits/Normed.lean

Proof steps:
state_before: α : Type u_1
β : Type u_2
ι : Type u_3
𝕜 : Type u_4
inst✝¹ : NormedDivisionRing 𝕜
inst✝ : CompleteSpace 𝕜
r : 𝕜
hr : ‖r‖ < 1
⊢ HasSum (fun n => ↑n * r ^ n) (r / (1 - r) ^ 2)
state_after: α : Type u_1
β : Type u_2
ι : Type u_3
𝕜 : Type u_4
inst✝¹ : NormedDivisionRing 𝕜
inst✝ : CompleteSpace 𝕜
r : 𝕜
hr : ‖r‖ < 1
A : Summable fun n => ↑n * r ^ n
⊢ HasSum (fun n => ↑n * r ^ n) (r / (1 - r) ^ 2)
tactic: have A : Summable (fun n ↦ (n : 𝕜) * r ^ n : ℕ → 𝕜) := by
    simpa only [pow_one] using summable_pow_mul_geometric_of_norm_lt_one 1 hr
state_before: α : Type u_1
β : Type u_2
ι : Type u_3
𝕜 : Type u_4
inst✝¹ : NormedDivisionRing 𝕜
inst✝ : CompleteSpace 𝕜
r : 𝕜
hr : ‖r‖ < 1
A : Summable fun n => ↑n * r ^ n
B : HasSum (fun x => r ^ x) (1 - r)⁻¹
⊢ HasSum (fun n => ↑n * r ^ n) (r / (1 - r) ^ 2)
state_after: α : Type u_1
β : Type u_2
ι : Type u_3
𝕜 : Type u_4
inst✝¹ : NormedDivisionRing 𝕜
inst✝ : CompleteSpace 𝕜
r : 𝕜
hr : ‖r‖ < 1
A : Summable fun n => ↑n * r ^ n
B : HasSum (fun x => r ^ x) (1 - r)⁻¹
⊢ ∑' (b : ℕ), ↑b * r ^ b = r / (1 - r) ^ 2
tactic: refine A.hasSum_iff.2 ?_
state_before: α : Type u_1
β : Type u_2
ι : Type u_3
𝕜 : Type u_4
inst✝¹ : NormedDivisionRing 𝕜
inst✝ : CompleteSpace 𝕜
r : 𝕜
hr : ‖r‖ < 1
A : Summable fun n => ↑n * r ^ n
B : HasSum (fun x => r ^ x) (1 - r)⁻¹
⊢ ∑' (b : ℕ), ↑b * r ^ b = r / (1 - r) ^ 2
state_after: α : Type u_1
β : Type u_2
ι : Type u_3
𝕜 : Type u_4
inst✝¹ : NormedDivisionRing 𝕜
inst✝ : CompleteSpace 𝕜
r : 𝕜
hr : ‖r‖ < 1
A : Summable fun n => ↑n * r ^ n
B : HasSum (fun x => r ^ x) (1 - r)⁻¹
hr' : r ≠ 1
⊢ ∑' (b : ℕ), ↑b * r ^ b = r / (1 - r) ^ 2
tactic: have hr' : r ≠ 1 := by
    rintro rfl
    simp [lt_irrefl] at hr
state_before: α : Type u_1
β : Type u_2
ι : Type u_3
𝕜 : Type u_4
inst✝¹ : NormedDivisionRing 𝕜
inst✝ : CompleteSpace 𝕜
r : 𝕜
hr : ‖r‖ < 1
A : Summable fun n => ↑n * r ^ n
B : HasSum (fun x => r ^ x) (1 - r)⁻¹
hr' : r ≠ 1
⊢ ∑' (b : ℕ), ↑b * r ^ b = r / (1 - r) ^ 2
state_after: α : Type u_1
β : Type u_2
ι : Type u_3
𝕜 : Type u_4
inst✝¹ : NormedDivisionRing 𝕜
inst✝ : CompleteSpace 𝕜
r : 𝕜
hr : ‖r‖ < 1
A : Summable fun n => ↑n * r ^ n
B : HasSum (fun x => r ^ x) (1 - r)⁻¹
hr' : r ≠ 1
s : 𝕜 := ∑' (n : ℕ), ↑n * r ^ n
⊢ s = r / (1 - r) ^ 2
tactic: set s : 𝕜 := ∑' n : ℕ, n * r ^ n
state_before: α : Type u_1
β : Type u_2
ι : Type u_3
𝕜 : Type u_4
inst✝¹ : NormedDivisionRing 𝕜
inst✝ : CompleteSpace 𝕜
r : 𝕜
hr : ‖r‖ < 1
A : Summable fun n => ↑n * r ^ n
B : HasSum (fun x => r ^ x) (1 - r)⁻¹
hr' : r ≠ 1
s : 𝕜 := ∑' (n : ℕ), ↑n * r ^ n
⊢ s = r / (1 - r) ^ 2
state_after: α : Type u_1
β : Type u_2
ι : Type u_3
𝕜 : Type u_4
inst✝¹ : NormedDivisionRing 𝕜
inst✝ : CompleteSpace 𝕜
r : 𝕜
hr : ‖r‖ < 1
A : Summable fun n => ↑n * r ^ n
B : HasSum (fun x => r ^ x) (1 - r)⁻¹
hr' : r ≠ 1
s : 𝕜 := ∑' (n : ℕ), ↑n * r ^ n
this : Commute (1 - r) s
⊢ s = r / (1 - r) ^ 2
tactic: have : Commute (1 - r) s :=
    .tsum_right _ fun _ =>
      .sub_left (.one_left _) (.mul_right (Nat.commute_cast _ _) (.pow_right (.refl _) _))
state_before: α : Type u_1
β : Type u_2
ι : Type u_3
𝕜 : Type u_4
inst✝¹ : NormedDivisionRing 𝕜
inst✝ : CompleteSpace 𝕜
r : 𝕜
hr : ‖r‖ < 1
A : Summable fun n => ↑n * r ^ n
B : HasSum (fun x => r ^ x) (1 - r)⁻¹
hr' : r ≠ 1
s : 𝕜 := ∑' (n : ℕ), ↑n * r ^ n
this : Commute (1 - r) s
⊢ s = r / (1 - r) ^ 2
state_after: no goals
tactic: calc
    s = s * (1 - r) / (1 - r) := (mul_div_cancel_right₀ _ (sub_ne_zero.2 hr'.symm)).symm
    _ = (1 - r) * s / (1 - r) := by rw [this.eq]
    _ = (s - r * s) / (1 - r) := by rw [_root_.sub_mul, one_mul]
    _ = (((0 : ℕ) * r ^ 0 + ∑' n : ℕ, (n + 1 : ℕ) * r ^ (n + 1)) - r * s) / (1 - r) := by
      rw [← tsum_eq_zero_add A]
    _ = ((r * ∑' n : ℕ, ↑(n + 1) * r ^ n) - r * s) / (1 - r) := by
      simp only [cast_zero, pow_zero, mul_one, _root_.pow_succ', (Nat.cast_commute _ r).left_comm,
        _root_.tsum_mul_left, zero_add]
    _ = r / (1 - r) ^ 2 := by
      simp [add_mul, tsum_add A B.summable, mul_add, B.tsum_eq, ← div_eq_mul_inv, sq,
        div_mul_eq_div_div_swap]