/-- `Fintype.total R S v f` is the linear combination of vectors in `v` with weights in `f`.
This variant of `Finsupp.total` is defined on fintype indexed vectors.

This map is linear in `v` if `R` is commutative, and always linear in `f`.
See note [bundled maps over different rings] for why separate `R` and `S` semirings are used.
-/
protected def Fintype.total : (α → M) →ₗ[S] (α → R) →ₗ[R] M where
  toFun v :=
    { toFun := fun f => ∑ i, f i • v i
      map_add' := fun f g => by simp_rw [← Finset.sum_add_distrib, ← add_smul]; rfl
      map_smul' := fun r f => by simp_rw [Finset.smul_sum, smul_smul]; rfl }
  map_add' u v := by ext; simp [Finset.sum_add_distrib, Pi.add_apply, smul_add]
  map_smul' r v := by ext; 

Proof state:
case h
α : Type u_1
M : Type u_2
R : Type u_3
inst✝⁶ : Fintype α
inst✝⁵ : Semiring R
inst✝⁴ : AddCommMonoid M
inst✝³ : Module R M
S : Type u_4
inst✝² : Semiring S
inst✝¹ : Module S M
inst✝ : SMulCommClass R S M
v✝ : α → M
r : S
v : α → M
x✝ : α → R
⊢ (AddHom.toFun
        {
          toFun := fun v =>
            {
              toAddHom :=
                { toFun := fun f => ∑ i : α, f i • v i,
                  map_add' :=
                    (_ :
                      ∀ (f g : α → R),
                        (fun f => ∑ i : α, f i • v i) (f + g) =
                          (fun f => ∑ i : α, f i • v i) f + (fun f => ∑ i : α, f i • v i) g) },
              map_smul' :=
                (_ :
                  ∀ (r : R) (f : α → R),
                    AddHom.toFun
                        { toFun := fun f => ∑ i : α, f i • v i,
                          map_add' :=
                            (_ :
                              ∀ (f g : α → R),
                                (fun f => ∑ i : α, f i • v i) (f + g) =
                                  (fun f => ∑ i : α, f i • v i) f + (fun f => ∑ i : α, f i • v i) g) }
                        (r • f) =
                      (RingHom.id R) r •
                        AddHom.toFun
                          { toFun := fun f => ∑ i : α, f i • v i,
                            map_add' :=
                              (_ :
                                ∀ (f g : α → R),
                                  (fun f => ∑ i : α, f i • v i) (f + g) =
                                    (fun f => ∑ i : α, f i • v i) f + (fun f => ∑ i : α, f i • v i) g) }
                          f) },
          map_add' :=
            (_ :
              ∀ (u v : α → M),
                (fun v =>
                      {
                        toAddHom :=
                          { toFun := fun f => ∑ i : α, f i • v i,
                            map_add' :=
                              (_ :
                                ∀ (f g : α → R),
                                  (fun f => ∑ i : α, f i • v i) (f + g) =
                                    (fun f => ∑ i : α, f i • v i) f + (fun f => ∑ i : α, f i • v i) g) },
                        map_smul' :=
                          (_ :
                            ∀ (r : R) (f : α → R),
                              AddHom.toFun
                                  { toFun := fun f => ∑ i : α, f i • v i,
                                    map_add' :=
                                      (_ :
                                        ∀ (f g : α → R),
                                          (fun f => ∑ i : α, f i • v i) (f + g) =
                                            (fun f => ∑ i : α, f i • v i) f + (fun f => ∑ i : α, f i • v i) g) }
                                  (r • f) =
                                (RingHom.id R) r •
                                  AddHom.toFun
                                    { toFun := fun f => ∑ i : α, f i • v i,
                                      map_add' :=
                                        (_ :
                                          ∀ (f g : α → R),
                                            (fun f => ∑ i : α, f i • v i) (f + g) =
                                              (fun f => ∑ i : α, f i • v i) f + (fun f => ∑ i : α, f i • v i) g) }
                                    f) })
                    (u + v) =
                  (fun v =>
                        {
                          toAddHom :=
                            { toFun := fun f => ∑ i : α, f i • v i,
                              map_add' :=
                                (_ :
                                  ∀ (f g : α → R),
                                    (fun f => ∑ i : α, f i • v i) (f + g) =
                                      (fun f => ∑ i : α, f i • v i) f + (fun f => ∑ i : α, f i • v i) g) },
                          map_smul' :=
                            (_ :
                              ∀ (r : R) (f : α → R),
                                AddHom.toFun
                                    { toFun := fun f => ∑ i : α, f i • v i,
                                      map_add' :=
                                        (_ :
                                          ∀ (f g : α → R),
                                            (fun f => ∑ i : α, f i • v i) (f + g) =
                                              (fun f => ∑ i : α, f i • v i) f + (fun f => ∑ i : α, f i • v i) g) }
                                    (r • f) =
                                  (RingHom.id R) r •
                                    AddHom.toFun
                                      { toFun := fun f => ∑ i : α, f i • v i,
                                        map_add' :=
                                          (_ :
                                            ∀ (f g : α → R),
                                              (fun f => ∑ i : α, f i • v i) (f + g) =
                                                (fun f => ∑ i : α, f i • v i) f + (fun f => ∑ i : α, f i • v i) g) }
                                      f) })
                      u +
                    (fun v =>
                        {
                          toAddHom :=
                            { toFun := fun f => ∑ i : α, f i • v i,
                              map_add' :=
                                (_ :
                                  ∀ (f g : α → R),
                                    (fun f => ∑ i : α, f i • v i) (f + g) =
                                      (fun f => ∑ i : α, f i • v i) f + (fun f => ∑ i : α, f i • v i) g) },
                          map_smul' :=
                            (_ :
                              ∀ (r : R) (f : α → R),
                                AddHom.toFun
                                    { toFun := fun f => ∑ i : α, f i • v i,
                                      map_add' :=
                                        (_ :
                                          ∀ (f g : α → R),
                                            (fun f => ∑ i : α, f i • v i) (f + g) =
                                              (fun f => ∑ i : α, f i • v i) f + (fun f => ∑ i : α, f i • v i) g) }
                                    (r • f) =
                                  (RingHom.id R) r •
                                    AddHom.toFun
                                      { toFun := fun f => ∑ i : α, f i • v i,
                                        map_add' :=
                                          (_ :
                                            ∀ (f g : α → R),
                                              (fun f => ∑ i : α, f i • v i) (f + g) =
                                                (fun f => ∑ i : α, f i • v i) f + (fun f => ∑ i : α, f i • v i) g) }
                                      f) })
                      v) }
        (r • v))
      x✝ =
    ((RingHom.id S) r •
        AddHom.toFun
          {
            toFun := fun v =>
              {
                toAddHom :=
                  { toFun := fun f => ∑ i : α, f i • v i,
                    map_add' :=
                      (_ :
                        ∀ (f g : α → R),
                          (fun f => ∑ i : α, f i • v i) (f + g) =
                            (fun f => ∑ i : α, f i • v i) f + (fun f => ∑ i : α, f i • v i) g) },
                map_smul' :=
                  (_ :
                    ∀ (r : R) (f : α → R),
                      AddHom.toFun
                          { toFun := fun f => ∑ i : α, f i • v i,
                            map_add' :=
                              (_ :
                                ∀ (f g : α → R),
                                  (fun f => ∑ i : α, f i • v i) (f + g) =
                                    (fun f => ∑ i : α, f i • v i) f + (fun f => ∑ i : α, f i • v i) g) }
                          (r • f) =
                        (RingHom.id R) r •
                          AddHom.toFun
                            { toFun := fun f => ∑ i : α, f i • v i,
                              map_add' :=
                                (_ :
                                  ∀ (f g : α → R),
                                    (fun f => ∑ i : α, f i • v i) (f + g) =
                                      (fun f => ∑ i : α, f i • v i) f + (fun f => ∑ i : α, f i • v i) g) }
                            f) },
            map_add' :=
              (_ :
                ∀ (u v : α → M),
                  (fun v =>
                        {
                          toAddHom :=
                            { toFun := fun f => ∑ i : α, f i • v i,
                              map_add' :=
                                (_ :
                                  ∀ (f g : α → R),
                                    (fun f => ∑ i : α, f i • v i) (f + g) =
                                      (fun f => ∑ i : α, f i • v i) f + (fun f => ∑ i : α, f i • v i) g) },
                          map_smul' :=
                            (_ :
                              ∀ (r : R) (f : α → R),
                                AddHom.toFun
                                    { toFun := fun f => ∑ i : α, f i • v i,
                                      map_add' :=
                                        (_ :
                                          ∀ (f g : α → R),
                                            (fun f => ∑ i : α, f i • v i) (f + g) =
                                              (fun f => ∑ i : α, f i • v i) f + (fun f => ∑ i : α, f i • v i) g) }
                                    (r • f) =
                                  (RingHom.id R) r •
                                    AddHom.toFun
                                      { toFun := fun f => ∑ i : α, f i • v i,
                                        map_add' :=
                                          (_ :
                                            ∀ (f g : α → R),
                                              (fun f => ∑ i : α, f i • v i) (f + g) =
                                                (fun f => ∑ i : α, f i • v i) f + (fun f => ∑ i : α, f i • v i) g) }
                                      f) })
                      (u + v) =
                    (fun v =>
                          {
                            toAddHom :=
                              { toFun := fun f => ∑ i : α, f i • v i,
                                map_add' :=
                                  (_ :
                                    ∀ (f g : α → R),
                                      (fun f => ∑ i : α, f i • v i) (f + g) =
                                        (fun f => ∑ i : α, f i • v i) f + (fun f => ∑ i : α, f i • v i) g) },
                            map_smul' :=
                              (_ :
                                ∀ (r : R) (f : α → R),
                                  AddHom.toFun
                                      { toFun := fun f => ∑ i : α, f i • v i,
                                        map_add' :=
                                          (_ :
                                            ∀ (f g : α → R),
                                              (fun f => ∑ i : α, f i • v i) (f + g) =
                                                (fun f => ∑ i : α, f i • v i) f + (fun f => ∑ i : α, f i • v i) g) }
                                      (r • f) =
                                    (RingHom.id R) r •
                                      AddHom.toFun
                                        { toFun := fun f => ∑ i : α, f i • v i,
                                          map_add' :=
                                            (_ :
                                              ∀ (f g : α → R),
                                                (fun f => ∑ i : α, f i • v i) (f + g) =
                                                  (fun f => ∑ i : α, f i • v i) f + (fun f => ∑ i : α, f i • v i) g) }
                                        f) })
                        u +
                      (fun v =>
                          {
                            toAddHom :=
                              { toFun := fun f => ∑ i : α, f i • v i,
                                map_add' :=
                                  (_ :
                                    ∀ (f g : α → R),
                                      (fun f => ∑ i : α, f i • v i) (f + g) =
                                        (fun f => ∑ i : α, f i • v i) f + (fun f => ∑ i : α, f i • v i) g) },
                            map_smul' :=
                              (_ :
                                ∀ (r : R) (f : α → R),
                                  AddHom.toFun
                                      { toFun := fun f => ∑ i : α, f i • v i,
                                        map_add' :=
                                          (_ :
                                            ∀ (f g : α → R),
                                              (fun f => ∑ i : α, f i • v i) (f + g) =
                                                (fun f => ∑ i : α, f i • v i) f + (fun f => ∑ i : α, f i • v i) g) }
                                      (r • f) =
                                    (RingHom.id R) r •
                                      AddHom.toFun
                                        { toFun := fun f => ∑ i : α, f i • v i,
                                          map_add' :=
                                            (_ :
                                              ∀ (f g : α → R),
                                                (fun f => ∑ i : α, f i • v i) (f + g) =
                                                  (fun f => ∑ i : α, f i • v i) f + (fun f => ∑ i : α, f i • v i) g) }
                                        f) })
                        v) }
          v)
      x✝

Next tactic:
simp [Finset.smul_sum, smul_comm]