-- Lean 4 proof step from Mathlib.Algebra.MvPolynomial.Derivation (goal)
Goal:
σ : Type u_1
R : Type u_2
A : Type u_3
inst : CommSemiring R
inst_1 : AddCommMonoid A
inst_2 : Module R A
inst_3 : Module (MvPolynomial σ R) A
inst_4 : IsScalarTower R (MvPolynomial σ R) A
D : MvPolynomial σ R →ₗ[R] A
h₁ : Eq.{u_3 + 1} (α := A) ((D : (a : MvPolynomial σ R) → A) 1 : A) (0 : A)
H :
  ∀ (s : σ →₀ ℕ) (i : σ),
    (D : (a : MvPolynomial σ R) → A)
        (HMul.hMul (α := MvPolynomial σ R) ((MvPolynomial.monomial s : (a : R) → MvPolynomial σ R) 1) (X i)) =
      HSMul.hSMul (α := MvPolynomial σ R) (β := A) ((MvPolynomial.monomial s : (a : R) → MvPolynomial σ R) 1)
          ((D : (a : MvPolynomial σ R) → A) (X i) : A) +
        HSMul.hSMul (α := MvPolynomial σ R) (β := A) (X i)
          ((D : (a : MvPolynomial σ R) → A) ((MvPolynomial.monomial s : (a : R) → MvPolynomial σ R) 1) : A)
hC :
  ∀ (r : R),
    Eq.{u_3 + 1} (α := A) ((D : (a : MvPolynomial σ R) → A) ((C : (a : R) → MvPolynomial σ R) r : MvPolynomial σ R) : A)
      (0 : A)
i : σ
s : σ →₀ ℕ
r : R
monomial :
  (D : (a : MvPolynomial σ R) → A)
      (HMul.hMul (α := MvPolynomial σ R) (β := MvPolynomial σ R)
        ((MvPolynomial.monomial s : (a : R) → MvPolynomial σ R) (r * 1) : MvPolynomial σ R) (X i)) =
    HSMul.hSMul (α := MvPolynomial σ R) (β := A)
        ((MvPolynomial.monomial s : (a : R) → MvPolynomial σ R) (r * 1) : MvPolynomial σ R)
        ((D : (a : MvPolynomial σ R) → A) (X i) : A) +
      HSMul.hSMul (α := MvPolynomial σ R) (β := A) (X i)
        ((D : (a : MvPolynomial σ R) → A)
            ((MvPolynomial.monomial s : (a : R) → MvPolynomial σ R) (r * 1) : MvPolynomial σ R) :
          A)
monomial₁ :
  (D : (a : MvPolynomial σ R) → A)
      (HMul.hMul (α := MvPolynomial σ R) (β := MvPolynomial σ R) ((C : (a : R) → MvPolynomial σ R) r : MvPolynomial σ R)
          ((MvPolynomial.monomial s : (a : R) → MvPolynomial σ R) 1 : MvPolynomial σ R) *
        X i) =
    HSMul.hSMul (β := A)
        (HMul.hMul (α := MvPolynomial σ R) (β := MvPolynomial σ R)
          ((C : (a : R) → MvPolynomial σ R) r : MvPolynomial σ R)
          ((MvPolynomial.monomial s : (a : R) → MvPolynomial σ R) 1 : MvPolynomial σ R))
        ((D : (a : MvPolynomial σ R) → A) (X i) : A) +
      HSMul.hSMul (α := MvPolynomial σ R) (β := A) (X i)
        ((D : (a : MvPolynomial σ R) → A)
            (HMul.hMul (α := MvPolynomial σ R) (β := MvPolynomial σ R)
              ((C : (a : R) → MvPolynomial σ R) r : MvPolynomial σ R)
              ((MvPolynomial.monomial s : (a : R) → MvPolynomial σ R) 1 : MvPolynomial σ R)) :
          A)
monomial₂ :
  (D : (a : MvPolynomial σ R) → A)
      (HMul.hMul (α := MvPolynomial σ R) ((C : (a : R) → MvPolynomial σ R) r : MvPolynomial σ R)
        (HMul.hMul (α := MvPolynomial σ R) ((MvPolynomial.monomial s : (a : R) → MvPolynomial σ R) 1) (X i))) =
    HSMul.hSMul (β := A)
        (HMul.hMul (α := MvPolynomial σ R) (β := MvPolynomial σ R)
          ((C : (a : R) → MvPolynomial σ R) r : MvPolynomial σ R)
          ((MvPolynomial.monomial s : (a : R) → MvPolynomial σ R) 1 : MvPolynomial σ R))
        ((D : (a : MvPolynomial σ R) → A) (X i) : A) +
      HSMul.hSMul (α := MvPolynomial σ R) (β := A) (X i)
        ((D : (a : MvPolynomial σ R) → A)
            (HMul.hMul (α := MvPolynomial σ R) (β := MvPolynomial σ R)
              ((C : (a : R) → MvPolynomial σ R) r : MvPolynomial σ R)
              ((MvPolynomial.monomial s : (a : R) → MvPolynomial σ R) 1 : MvPolynomial σ R)) :
          A)
monomial₃ :
  (D : (a : MvPolynomial σ R) → A)
      (r • HMul.hMul (α := MvPolynomial σ R) ((MvPolynomial.monomial s : (a : R) → MvPolynomial σ R) 1) (X i)) =
    HSMul.hSMul (β := A)
        (HMul.hMul (α := MvPolynomial σ R) (β := MvPolynomial σ R)
          ((C : (a : R) → MvPolynomial σ R) r : MvPolynomial σ R)
          ((MvPolynomial.monomial s : (a : R) → MvPolynomial σ R) 1 : MvPolynomial σ R))
        ((D : (a : MvPolynomial σ R) → A) (X i) : A) +
      HSMul.hSMul (α := MvPolynomial σ R) (β := A) (X i)
        ((D : (a : MvPolynomial σ R) → A)
            (HMul.hMul (α := MvPolynomial σ R) (β := MvPolynomial σ R)
              ((C : (a : R) → MvPolynomial σ R) r : MvPolynomial σ R)
              ((MvPolynomial.monomial s : (a : R) → MvPolynomial σ R) 1 : MvPolynomial σ R)) :
          A)
monomial₄ :
  HSMul.hSMul (β := A) r
      ((D : (a : MvPolynomial σ R) → A)
          (HMul.hMul (α := MvPolynomial σ R) ((MvPolynomial.monomial s : (a : R) → MvPolynomial σ R) 1) (X i)) :
        A) =
    HSMul.hSMul (β := A)
        (HMul.hMul (α := MvPolynomial σ R) (β := MvPolynomial σ R)
          ((C : (a : R) → MvPolynomial σ R) r : MvPolynomial σ R)
          ((MvPolynomial.monomial s : (a : R) → MvPolynomial σ R) 1 : MvPolynomial σ R))
        ((D : (a : MvPolynomial σ R) → A) (X i) : A) +
      HSMul.hSMul (α := MvPolynomial σ R) (β := A) (X i)
        ((D : (a : MvPolynomial σ R) → A)
            (HMul.hMul (α := MvPolynomial σ R) (β := MvPolynomial σ R)
              ((C : (a : R) → MvPolynomial σ R) r : MvPolynomial σ R)
              ((MvPolynomial.monomial s : (a : R) → MvPolynomial σ R) 1 : MvPolynomial σ R)) :
          A)
monomial₅ :
  r •
      (HSMul.hSMul (α := MvPolynomial σ R) (β := A) ((MvPolynomial.monomial s : (a : R) → MvPolynomial σ R) 1)
          ((D : (a : MvPolynomial σ R) → A) (X i) : A) +
        HSMul.hSMul (α := MvPolynomial σ R) (β := A) (X i)
          ((D : (a : MvPolynomial σ R) → A) ((MvPolynomial.monomial s : (a : R) → MvPolynomial σ R) 1) : A)) =
    HSMul.hSMul (β := A)
        (HMul.hMul (α := MvPolynomial σ R) (β := MvPolynomial σ R)
          ((C : (a : R) → MvPolynomial σ R) r : MvPolynomial σ R)
          ((MvPolynomial.monomial s : (a : R) → MvPolynomial σ R) 1 : MvPolynomial σ R))
        ((D : (a : MvPolynomial σ R) → A) (X i) : A) +
      HSMul.hSMul (α := MvPolynomial σ R) (β := A) (X i)
        ((D : (a : MvPolynomial σ R) → A)
            (HMul.hMul (α := MvPolynomial σ R) (β := MvPolynomial σ R)
              ((C : (a : R) → MvPolynomial σ R) r : MvPolynomial σ R)
              ((MvPolynomial.monomial s : (a : R) → MvPolynomial σ R) 1 : MvPolynomial σ R)) :
          A)
monomial₆ :
  r •
      (HSMul.hSMul (α := MvPolynomial σ R) (β := A) ((MvPolynomial.monomial s : (a : R) → MvPolynomial σ R) 1)
          ((D : (a : MvPolynomial σ R) → A) (X i) : A) +
        HSMul.hSMul (α := MvPolynomial σ R) (β := A) (X i)
          ((D : (a : MvPolynomial σ R) → A) ((MvPolynomial.monomial s : (a : R) → MvPolynomial σ R) 1) : A)) =
    HSMul.hSMul (β := A)
        (HSMul.hSMul (β := MvPolynomial σ R) r ((MvPolynomial.monomial s : (a : R) → MvPolynomial σ R) 1))
        ((D : (a : MvPolynomial σ R) → A) (X i) : A) +
      HSMul.hSMul (α := MvPolynomial σ R) (β := A) (X i)
        ((D : (a : MvPolynomial σ R) → A)
            (HSMul.hSMul (β := MvPolynomial σ R) r ((MvPolynomial.monomial s : (a : R) → MvPolynomial σ R) 1)) :
          A)
⊢ (D : (a : MvPolynomial σ R) → A)
      (HMul.hMul (α := MvPolynomial σ R) (β := MvPolynomial σ R)
        ((MvPolynomial.monomial s : (a : R) → MvPolynomial σ R) r : MvPolynomial σ R) (X i)) =
    HSMul.hSMul (α := MvPolynomial σ R) (β := A)
        ((MvPolynomial.monomial s : (a : R) → MvPolynomial σ R) r : MvPolynomial σ R)
        ((D : (a : MvPolynomial σ R) → A) (X i) : A) +
      HSMul.hSMul (α := MvPolynomial σ R) (β := A) (X i)
        ((D : (a : MvPolynomial σ R) → A)
            ((MvPolynomial.monomial s : (a : R) → MvPolynomial σ R) r : MvPolynomial σ R) :
          A)
have monomial₇ : r •
    (HSMul.hSMul (α := MvPolynomial σ R) (β := A) ((MvPolynomial.monomial s : (a : R) → MvPolynomial σ R) 1)
        ((D : (a : MvPolynomial σ R) → A) (X i) : A) +
      HSMul.hSMul (α := MvPolynomial σ R) (β := A) (X i)
        ((D : (a : MvPolynomial σ R) → A) ((MvPolynomial.monomial s : (a : R) → MvPolynomial σ R) 1) : A)) =
  r •
      HSMul.hSMul (α := MvPolynomial σ R) (β := A) ((MvPolynomial.monomial s : (a : R) → MvPolynomial σ R) 1)
        ((D : (a : MvPolynomial σ R) → A) (X i) : A) +
    HSMul.hSMul (α := MvPolynomial σ R) (β := A) (X i)
      ((D : (a : MvPolynomial σ R) → A)
          (HSMul.hSMul (β := MvPolynomial σ R) r ((MvPolynomial.monomial s : (a : R) → MvPolynomial σ R) 1)) :
        A)
Tactic: rw [← mul_one r, ← C_mul_monomial, mul_assoc, C_mul', D.map_smul, H, C_mul', smul_assoc,
        smul_add, D.map_smul, smul_comm r (X i)]