/-- This is not an instance for the same reasons as `Polynomial.hasSMulPi'`. -/
noncomputable def Polynomial.algebraPi : Algebra R'[X] (S' → T') :=
  { Polynomial.hasSMulPi' R' S' T' with
    toFun := fun p z => algebraMap S' T' (aeval z p)
    map_one' := by
      funext z
      simp only [Polynomial.aeval_one, Pi.one_apply, map_one]
    map_mul' := fun f g => by
      funext z
      simp only [Pi.mul_apply, map_mul]
    map_zero' := by
      funext z
      simp only [Polynomial.aeval_zero, Pi.zero_apply, map_zero]
    map_add' := fun f g => by
      funext z
      simp only [Polynomial.aeval_add, Pi.add_apply, map_add]
    commutes' := fun p f => by
      funext z
      

Proof state:
case h
R : Type u_1
S : Type u_2
inst✝⁷ : CommRing R
inst✝⁶ : IsDomain R
inst✝⁵ : CommRing S
R' : Type u
S' : Type v
T' : Type w
inst✝⁴ : CommSemiring R'
inst✝³ : CommSemiring S'
inst✝² : CommSemiring T'
inst✝¹ : Algebra R' S'
inst✝ : Algebra S' T'
src✝ : SMul R'[X] (S' → T') := hasSMulPi' R' S' T'
p : R'[X]
f : S' → T'
z : S'
⊢ ({
            toMonoidHom :=
              {
                toOneHom :=
                  { toFun := fun p z => (algebraMap S' T') ((aeval z) p),
                    map_one' := (_ : (fun p z => (algebraMap S' T') ((aeval z) p)) 1 = 1) },
                map_mul' :=
                  (_ :
                    ∀ (f g : R'[X]),
                      OneHom.toFun
                          { toFun := fun p z => (algebraMap S' T') ((aeval z) p),
                            map_one' := (_ : (fun p z => (algebraMap S' T') ((aeval z) p)) 1 = 1) }
                          (f * g) =
                        OneHom.toFun
                            { toFun := fun p z => (algebraMap S' T') ((aeval z) p),
                              map_one' := (_ : (fun p z => (algebraMap S' T') ((aeval z) p)) 1 = 1) }
                            f *
                          OneHom.toFun
                            { toFun := fun p z => (algebraMap S' T') ((aeval z) p),
                              map_one' := (_ : (fun p z => (algebraMap S' T') ((aeval z) p)) 1 = 1) }
                            g) },
            map_zero' :=
              (_ :
                OneHom.toFun
                    (↑{
                        toOneHom :=
                          { toFun := fun p z => (algebraMap S' T') ((aeval z) p),
                            map_one' := (_ : (fun p z => (algebraMap S' T') ((aeval z) p)) 1 = 1) },
                        map_mul' :=
                          (_ :
                            ∀ (f g : R'[X]),
                              OneHom.toFun
                                  { toFun := fun p z => (algebraMap S' T') ((aeval z) p),
                                    map_one' := (_ : (fun p z => (algebraMap S' T') ((aeval z) p)) 1 = 1) }
                                  (f * g) =
                                OneHom.toFun
                                    { toFun := fun p z => (algebraMap S' T') ((aeval z) p),
                                      map_one' := (_ : (fun p z => (algebraMap S' T') ((aeval z) p)) 1 = 1) }
                                    f *
                                  OneHom.toFun
                                    { toFun := fun p z => (algebraMap S' T') ((aeval z) p),
                                      map_one' := (_ : (fun p z => (algebraMap S' T') ((aeval z) p)) 1 = 1) }
                                    g) })
                    0 =
                  0),
            map_add' :=
              (_ :
                ∀ (f g : R'[X]),
                  OneHom.toFun
                      (↑{
                          toOneHom :=
                            { toFun := fun p z => (algebraMap S' T') ((aeval z) p),
                              map_one' := (_ : (fun p z => (algebraMap S' T') ((aeval z) p)) 1 = 1) },
                          map_mul' :=
                            (_ :
                              ∀ (f g : R'[X]),
                                OneHom.toFun
                                    { toFun := fun p z => (algebraMap S' T') ((aeval z) p),
                                      map_one' := (_ : (fun p z => (algebraMap S' T') ((aeval z) p)) 1 = 1) }
                                    (f * g) =
                                  OneHom.toFun
                                      { toFun := fun p z => (algebraMap S' T') ((aeval z) p),
                                        map_one' := (_ : (fun p z => (algebraMap S' T') ((aeval z) p)) 1 = 1) }
                                      f *
                                    OneHom.toFun
                                      { toFun := fun p z => (algebraMap S' T') ((aeval z) p),
                                        map_one' := (_ : (fun p z => (algebraMap S' T') ((aeval z) p)) 1 = 1) }
                                      g) })
                      (f + g) =
                    OneHom.toFun
                        (↑{
                            toOneHom :=
                              { toFun := fun p z => (algebraMap S' T') ((aeval z) p),
                                map_one' := (_ : (fun p z => (algebraMap S' T') ((aeval z) p)) 1 = 1) },
                            map_mul' :=
                              (_ :
                                ∀ (f g : R'[X]),
                                  OneHom.toFun
                                      { toFun := fun p z => (algebraMap S' T') ((aeval z) p),
                                        map_one' := (_ : (fun p z => (algebraMap S' T') ((aeval z) p)) 1 = 1) }
                                      (f * g) =
                                    OneHom.toFun
                                        { toFun := fun p z => (algebraMap S' T') ((aeval z) p),
                                          map_one' := (_ : (fun p z => (algebraMap S' T') ((aeval z) p)) 1 = 1) }
                                        f *
                                      OneHom.toFun
                                        { toFun := fun p z => (algebraMap S' T') ((aeval z) p),
                                          map_one' := (_ : (fun p z => (algebraMap S' T') ((aeval z) p)) 1 = 1) }
                                        g) })
                        f +
                      OneHom.toFun
                        (↑{
                            toOneHom :=
                              { toFun := fun p z => (algebraMap S' T') ((aeval z) p),
                                map_one' := (_ : (fun p z => (algebraMap S' T') ((aeval z) p)) 1 = 1) },
                            map_mul' :=
                              (_ :
                                ∀ (f g : R'[X]),
                                  OneHom.toFun
                                      { toFun := fun p z => (algebraMap S' T') ((aeval z) p),
                                        map_one' := (_ : (fun p z => (algebraMap S' T') ((aeval z) p)) 1 = 1) }
                                      (f * g) =
                                    OneHom.toFun
                                        { toFun := fun p z => (algebraMap S' T') ((aeval z) p),
                                          map_one' := (_ : (fun p z => (algebraMap S' T') ((aeval z) p)) 1 = 1) }
                                        f *
                                      OneHom.toFun
                                        { toFun := fun p z => (algebraMap S' T') ((aeval z) p),
                                          map_one' := (_ : (fun p z => (algebraMap S' T') ((aeval z) p)) 1 = 1) }
                                        g) })
                        g) }
          p *
        f)
      z =
    (f *
        {
            toMonoidHom :=
              {
                toOneHom :=
                  { toFun := fun p z => (algebraMap S' T') ((aeval z) p),
                    map_one' := (_ : (fun p z => (algebraMap S' T') ((aeval z) p)) 1 = 1) },
                map_mul' :=
                  (_ :
                    ∀ (f g : R'[X]),
                      OneHom.toFun
                          { toFun := fun p z => (algebraMap S' T') ((aeval z) p),
                            map_one' := (_ : (fun p z => (algebraMap S' T') ((aeval z) p)) 1 = 1) }
                          (f * g) =
                        OneHom.toFun
                            { toFun := fun p z => (algebraMap S' T') ((aeval z) p),
                              map_one' := (_ : (fun p z => (algebraMap S' T') ((aeval z) p)) 1 = 1) }
                            f *
                          OneHom.toFun
                            { toFun := fun p z => (algebraMap S' T') ((aeval z) p),
                              map_one' := (_ : (fun p z => (algebraMap S' T') ((aeval z) p)) 1 = 1) }
                            g) },
            map_zero' :=
              (_ :
                OneHom.toFun
                    (↑{
                        toOneHom :=
                          { toFun := fun p z => (algebraMap S' T') ((aeval z) p),
                            map_one' := (_ : (fun p z => (algebraMap S' T') ((aeval z) p)) 1 = 1) },
                        map_mul' :=
                          (_ :
                            ∀ (f g : R'[X]),
                              OneHom.toFun
                                  { toFun := fun p z => (algebraMap S' T') ((aeval z) p),
                                    map_one' := (_ : (fun p z => (algebraMap S' T') ((aeval z) p)) 1 = 1) }
                                  (f * g) =
                                OneHom.toFun
                                    { toFun := fun p z => (algebraMap S' T') ((aeval z) p),
                                      map_one' := (_ : (fun p z => (algebraMap S' T') ((aeval z) p)) 1 = 1) }
                                    f *
                                  OneHom.toFun
                                    { toFun := fun p z => (algebraMap S' T') ((aeval z) p),
                                      map_one' := (_ : (fun p z => (algebraMap S' T') ((aeval z) p)) 1 = 1) }
                                    g) })
                    0 =
                  0),
            map_add' :=
              (_ :
                ∀ (f g : R'[X]),
                  OneHom.toFun
                      (↑{
                          toOneHom :=
                            { toFun := fun p z => (algebraMap S' T') ((aeval z) p),
                              map_one' := (_ : (fun p z => (algebraMap S' T') ((aeval z) p)) 1 = 1) },
                          map_mul' :=
                            (_ :
                              ∀ (f g : R'[X]),
                                OneHom.toFun
                                    { toFun := fun p z => (algebraMap S' T') ((aeval z) p),
                                      map_one' := (_ : (fun p z => (algebraMap S' T') ((aeval z) p)) 1 = 1) }
                                    (f * g) =
                                  OneHom.toFun
                                      { toFun := fun p z => (algebraMap S' T') ((aeval z) p),
                                        map_one' := (_ : (fun p z => (algebraMap S' T') ((aeval z) p)) 1 = 1) }
                                      f *
                                    OneHom.toFun
                                      { toFun := fun p z => (algebraMap S' T') ((aeval z) p),
                                        map_one' := (_ : (fun p z => (algebraMap S' T') ((aeval z) p)) 1 = 1) }
                                      g) })
                      (f + g) =
                    OneHom.toFun
                        (↑{
                            toOneHom :=
                              { toFun := fun p z => (algebraMap S' T') ((aeval z) p),
                                map_one' := (_ : (fun p z => (algebraMap S' T') ((aeval z) p)) 1 = 1) },
                            map_mul' :=
                              (_ :
                                ∀ (f g : R'[X]),
                                  OneHom.toFun
                                      { toFun := fun p z => (algebraMap S' T') ((aeval z) p),
                                        map_one' := (_ : (fun p z => (algebraMap S' T') ((aeval z) p)) 1 = 1) }
                                      (f * g) =
                                    OneHom.toFun
                                        { toFun := fun p z => (algebraMap S' T') ((aeval z) p),
                                          map_one' := (_ : (fun p z => (algebraMap S' T') ((aeval z) p)) 1 = 1) }
                                        f *
                                      OneHom.toFun
                                        { toFun := fun p z => (algebraMap S' T') ((aeval z) p),
                                          map_one' := (_ : (fun p z => (algebraMap S' T') ((aeval z) p)) 1 = 1) }
                                        g) })
                        f +
                      OneHom.toFun
                        (↑{
                            toOneHom :=
                              { toFun := fun p z => (algebraMap S' T') ((aeval z) p),
                                map_one' := (_ : (fun p z => (algebraMap S' T') ((aeval z) p)) 1 = 1) },
                            map_mul' :=
                              (_ :
                                ∀ (f g : R'[X]),
                                  OneHom.toFun
                                      { toFun := fun p z => (algebraMap S' T') ((aeval z) p),
                                        map_one' := (_ : (fun p z => (algebraMap S' T') ((aeval z) p)) 1 = 1) }
                                      (f * g) =
                                    OneHom.toFun
                                        { toFun := fun p z => (algebraMap S' T') ((aeval z) p),
                                          map_one' := (_ : (fun p z => (algebraMap S' T') ((aeval z) p)) 1 = 1) }
                                        f *
                                      OneHom.toFun
                                        { toFun := fun p z => (algebraMap S' T') ((aeval z) p),
                                          map_one' := (_ : (fun p z => (algebraMap S' T') ((aeval z) p)) 1 = 1) }
                                        g) })
                        g) }
          p)
      z

Next tactic:
exact mul_comm _ _