-- Lean 4 proof step from Mathlib.RingTheory.MvPowerSeries.Substitution (goal)
Goal:
σ : Type u_1
A : Type u_2
inst : CommSemiring A
R_1 : Type u_3
inst_1 : CommRing R_1
inst_2 : Algebra A R_1
τ : Type u_4
S : Type u_5
inst_3 : CommRing S
inst_4 : Algebra A S
inst_5 : Algebra R_1 S
inst_6 : IsScalarTower A R_1 S
a_1 a_2 : σ → MvPowerSeries τ S
T_1 : Type u_6
inst_7 : CommRing T_1
inst_8 : UniformSpace T_1
inst_9 : T2Space T_1
inst_10 : CompleteSpace T_1
inst_11 : IsUniformAddGroup T_1
inst_12 : IsTopologicalRing T_1
inst_13 : IsLinearTopology T_1 T_1
inst_14 : Algebra R_1 T_1
ε : MvPowerSeries τ S →ₐ[R_1] T_1
inst_15 : Algebra S T_1
inst_16 : IsScalarTower R_1 S T_1
υ : Type u_7
T : Type u_8
inst_17 : CommRing T
inst_18 : Algebra R_1 T
inst_19 : Algebra S T
inst_20 : IsScalarTower R_1 S T
b : τ → MvPowerSeries υ T
R : Type u_9
inst_21 : CommSemiring R
a : σ → R
f g : MvPowerSeries σ R
n : σ →₀ ℕ
h :
  HMul.hMul (α := R) (β := R) (n.prod fun (s : σ) (m : ℕ) ↦ a s ^ m : R)
      ((coeff n : (a : MvPowerSeries σ R) → R) (f * g) : R) =
    (coeff n : (a : MvPowerSeries σ R) → R)
      (HMul.hMul (α := MvPowerSeries σ R)
        (fun (n : σ →₀ ℕ) ↦
          HMul.hMul (α := R) (β := R) (n.prod fun (s : σ) (m : ℕ) ↦ a s ^ m : R)
            ((coeff n : (a : MvPowerSeries σ R) → R) f : R))
        fun (n : σ →₀ ℕ) ↦
        HMul.hMul (α := R) (β := R) (n.prod fun (s : σ) (m : ℕ) ↦ a s ^ m : R)
          ((coeff n : (a : MvPowerSeries σ R) → R) g : R))
h₁ :
  HMul.hMul (α := R) (n.prod fun (s : σ) (m : ℕ) ↦ a s ^ m)
      (∑ p ∈ @Finset.antidiagonal _ Finsupp.instAddMonoid _ n,
        HMul.hMul (α := R) (β := R) ((coeff p.1 : (a : MvPowerSeries σ R) → R) f : R)
          ((coeff p.2 : (a : MvPowerSeries σ R) → R) g : R)) =
    (coeff n : (a : MvPowerSeries σ R) → R)
      (HMul.hMul (α := MvPowerSeries σ R)
        (fun (n : σ →₀ ℕ) ↦
          HMul.hMul (α := R) (β := R) (n.prod fun (s : σ) (m : ℕ) ↦ a s ^ m : R)
            ((coeff n : (a : MvPowerSeries σ R) → R) f : R))
        fun (n : σ →₀ ℕ) ↦
        HMul.hMul (α := R) (β := R) (n.prod fun (s : σ) (m : ℕ) ↦ a s ^ m : R)
          ((coeff n : (a : MvPowerSeries σ R) → R) g : R))
h₂ :
  HMul.hMul (α := R) (n.prod fun (s : σ) (m : ℕ) ↦ a s ^ m)
      (∑ p ∈ @Finset.antidiagonal _ Finsupp.instAddMonoid _ n,
        HMul.hMul (α := R) (β := R) ((coeff p.1 : (a : MvPowerSeries σ R) → R) f : R)
          ((coeff p.2 : (a : MvPowerSeries σ R) → R) g : R)) =
    ∑ p ∈ @Finset.antidiagonal _ Finsupp.instAddMonoid _ n,
      HMul.hMul (α := R) (β := R)
        ((coeff p.1 : (a : MvPowerSeries σ R) → R) fun (n : σ →₀ ℕ) ↦
            HMul.hMul (α := R) (β := R) (n.prod fun (s : σ) (m : ℕ) ↦ a s ^ m : R)
              ((coeff n : (a : MvPowerSeries σ R) → R) f : R) :
          R)
        ((coeff p.2 : (a : MvPowerSeries σ R) → R) fun (n : σ →₀ ℕ) ↦
            HMul.hMul (α := R) (β := R) (n.prod fun (s : σ) (m : ℕ) ↦ a s ^ m : R)
              ((coeff n : (a : MvPowerSeries σ R) → R) g : R) :
          R)
h₃ h₄ h₅ :
  Eq.{u_9 + 1} (α := R)
    (∑ i ∈ @Finset.antidiagonal _ Finsupp.instAddMonoid _ n,
      (n.prod fun (s : σ) (m : ℕ) ↦ a s ^ m) *
        HMul.hMul (α := R) (β := R) ((coeff i.1 : (a : MvPowerSeries σ R) → R) f : R)
          ((coeff i.2 : (a : MvPowerSeries σ R) → R) g : R))
    (∑ p ∈ @Finset.antidiagonal _ Finsupp.instAddMonoid _ n,
      HMul.hMul (α := R) (β := R)
        ((coeff p.1 : (a : MvPowerSeries σ R) → R) fun (n : σ →₀ ℕ) ↦
            HMul.hMul (α := R) (β := R) (n.prod fun (s : σ) (m : ℕ) ↦ a s ^ m : R)
              ((coeff n : (a : MvPowerSeries σ R) → R) f : R) :
          R)
        ((coeff p.2 : (a : MvPowerSeries σ R) → R) fun (n : σ →₀ ℕ) ↦
            HMul.hMul (α := R) (β := R) (n.prod fun (s : σ) (m : ℕ) ↦ a s ^ m : R)
              ((coeff n : (a : MvPowerSeries σ R) → R) g : R) :
          R))
h₆ h₇ :
  ∀ (x : (σ →₀ ℕ) × (σ →₀ ℕ)) (hx : x ∈ @Finset.antidiagonal _ Finsupp.instAddMonoid _ n),
    (n.prod fun (s : σ) (m : ℕ) ↦ a s ^ m) *
        HMul.hMul (α := R) (β := R) ((coeff x.1 : (a : MvPowerSeries σ R) → R) f : R)
          ((coeff x.2 : (a : MvPowerSeries σ R) → R) g : R) =
      HMul.hMul (α := R) (β := R)
        ((coeff x.1 : (a : MvPowerSeries σ R) → R) fun (n : σ →₀ ℕ) ↦
            HMul.hMul (α := R) (β := R) (n.prod fun (s : σ) (m : ℕ) ↦ a s ^ m : R)
              ((coeff n : (a : MvPowerSeries σ R) → R) f : R) :
          R)
        ((coeff x.2 : (a : MvPowerSeries σ R) → R) fun (n : σ →₀ ℕ) ↦
            HMul.hMul (α := R) (β := R) (n.prod fun (s : σ) (m : ℕ) ↦ a s ^ m : R)
              ((coeff n : (a : MvPowerSeries σ R) → R) g : R) :
          R)
⊢ Eq.{u_9 + 1} (α := R)
    ((coeff n : (a : MvPowerSeries σ R) → R) fun (n : σ →₀ ℕ) ↦
        HMul.hMul (α := R) (β := R) (n.prod fun (s : σ) (m : ℕ) ↦ a s ^ m : R)
          ((coeff n : (a : MvPowerSeries σ R) → R) (f * g) : R) :
      R)
    ((coeff n : (a : MvPowerSeries σ R) → R)
        (HMul.hMul (α := MvPowerSeries σ R)
          (fun (n : σ →₀ ℕ) ↦
            HMul.hMul (α := R) (β := R) (n.prod fun (s : σ) (m : ℕ) ↦ a s ^ m : R)
              ((coeff n : (a : MvPowerSeries σ R) → R) f : R))
          fun (n : σ →₀ ℕ) ↦
          HMul.hMul (α := R) (β := R) (n.prod fun (s : σ) (m : ℕ) ↦ a s ^ m : R)
            ((coeff n : (a : MvPowerSeries σ R) → R) g : R)) :
      R)
have h₈ : ∀ (x : (σ →₀ ℕ) × (σ →₀ ℕ)) (hx : x.1 + x.2 = n),
  (n.prod fun (s : σ) (m : ℕ) ↦ a s ^ m) *
      HMul.hMul (α := R) (β := R) ((coeff x.1 : (a : MvPowerSeries σ R) → R) f : R)
        ((coeff x.2 : (a : MvPowerSeries σ R) → R) g : R) =
    HMul.hMul (α := R) (β := R)
      ((coeff x.1 : (a : MvPowerSeries σ R) → R) fun (n : σ →₀ ℕ) ↦
          HMul.hMul (α := R) (β := R) (n.prod fun (s : σ) (m : ℕ) ↦ a s ^ m : R)
            ((coeff n : (a : MvPowerSeries σ R) → R) f : R) :
        R)
      ((coeff x.2 : (a : MvPowerSeries σ R) → R) fun (n : σ →₀ ℕ) ↦
          HMul.hMul (α := R) (β := R) (n.prod fun (s : σ) (m : ℕ) ↦ a s ^ m : R)
            ((coeff n : (a : MvPowerSeries σ R) → R) g : R) :
        R)
Tactic: classical
    rw [coeff_apply, coeff_mul, coeff_mul, Finset.mul_sum]
    apply Finset.sum_congr rfl
    intro x hx
    simp only [Finset.mem_antidiagonal] at hx
    rw [← hx]
    simp only [coeff_apply]
    rw [Finsupp.prod_of_support_subset _ Finsupp.support_add,
      Finsupp.prod_of_support_subset x.1 Finset.subset_union_left,
      Finsupp.prod_of_support_subset x.2 Finset.subset_union_right]
    · simp only [← mul_assoc]
      congr 1
      rw [mul_assoc, mul_comm (f x.1), ← mul_assoc]
      congr 1
      rw [← Finset.prod_mul_distrib]
      apply Finset.prod_congr rfl
      simp [pow_add]
    all_goals {simp}