/-- Lift a family of linear maps `M →ₗ[R] N` indexed by `x : α` to a linear map from `α →₀ M` to
`N` using `Finsupp.sum`. This is an upgraded version of `Finsupp.liftAddHom`.

See note [bundled maps over different rings] for why separate `R` and `S` semirings are used.
-/
def lsum : (α → M →ₗ[R] N) ≃ₗ[S] (α →₀ M) →ₗ[R] N where
  toFun F :=
    { toFun := fun d => d.sum fun i => F i
      map_add' := (liftAddHom (α := α) (M := M) (N := N) fun x => (F x).toAddMonoidHom).map_add
      map_smul' := fun c f => by simp [sum_smul_index', smul_sum] }
  invFun F x := F.comp (lsingle x)
  left_inv F := by
    

Proof state:
α : Type u_1
M : Type u_2
N : Type u_3
P : Type u_4
R : Type u_5
S : Type u_6
inst✝⁹ : Semiring R
inst✝⁸ : Semiring S
inst✝⁷ : AddCommMonoid M
inst✝⁶ : Module R M
inst✝⁵ : AddCommMonoid N
inst✝⁴ : Module R N
inst✝³ : AddCommMonoid P
inst✝² : Module R P
inst✝¹ : Module S N
inst✝ : SMulCommClass R S N
F : α → M →ₗ[R] N
⊢ (fun F x => F ∘ₗ lsingle x)
      (AddHom.toFun
        {
            toAddHom :=
              {
                toFun := fun F =>
                  {
                    toAddHom :=
                      { toFun := fun d => sum d fun i => ⇑(F i),
                        map_add' :=
                          (_ :
                            ∀ (a b : α →₀ M),
                              (liftAddHom fun x => toAddMonoidHom (F x)) (a + b) =
                                (liftAddHom fun x => toAddMonoidHom (F x)) a +
                                  (liftAddHom fun x => toAddMonoidHom (F x)) b) },
                    map_smul' :=
                      (_ : ∀ (c : R) (f : α →₀ M), (sum (c • f) fun i => ⇑(F i)) = c • sum f fun i => ⇑(F i)) },
                map_add' :=
                  (_ :
                    ∀ (F G : α → M →ₗ[R] N),
                      (fun F =>
                            {
                              toAddHom :=
                                { toFun := fun d => sum d fun i => ⇑(F i),
                                  map_add' :=
                                    (_ :
                                      ∀ (a b : α →₀ M),
                                        (liftAddHom fun x => toAddMonoidHom (F x)) (a + b) =
                                          (liftAddHom fun x => toAddMonoidHom (F x)) a +
                                            (liftAddHom fun x => toAddMonoidHom (F x)) b) },
                              map_smul' :=
                                (_ :
                                  ∀ (c : R) (f : α →₀ M), (sum (c • f) fun i => ⇑(F i)) = c • sum f fun i => ⇑(F i)) })
                          (F + G) =
                        (fun F =>
                              {
                                toAddHom :=
                                  { toFun := fun d => sum d fun i => ⇑(F i),
                                    map_add' :=
                                      (_ :
                                        ∀ (a b : α →₀ M),
                                          (liftAddHom fun x => toAddMonoidHom (F x)) (a + b) =
                                            (liftAddHom fun x => toAddMonoidHom (F x)) a +
                                              (liftAddHom fun x => toAddMonoidHom (F x)) b) },
                                map_smul' :=
                                  (_ :
                                    ∀ (c : R) (f : α →₀ M),
                                      (sum (c • f) fun i => ⇑(F i)) = c • sum f fun i => ⇑(F i)) })
                            F +
                          (fun F =>
                              {
                                toAddHom :=
                                  { toFun := fun d => sum d fun i => ⇑(F i),
                                    map_add' :=
                                      (_ :
                                        ∀ (a b : α →₀ M),
                                          (liftAddHom fun x => toAddMonoidHom (F x)) (a + b) =
                                            (liftAddHom fun x => toAddMonoidHom (F x)) a +
                                              (liftAddHom fun x => toAddMonoidHom (F x)) b) },
                                map_smul' :=
                                  (_ :
                                    ∀ (c : R) (f : α →₀ M),
                                      (sum (c • f) fun i => ⇑(F i)) = c • sum f fun i => ⇑(F i)) })
                            G) },
            map_smul' :=
              (_ :
                ∀ (F : S) (G : α → M →ₗ[R] N),
                  AddHom.toFun
                      {
                        toFun := fun F =>
                          {
                            toAddHom :=
                              { toFun := fun d => sum d fun i => ⇑(F i),
                                map_add' :=
                                  (_ :
                                    ∀ (a b : α →₀ M),
                                      (liftAddHom fun x => toAddMonoidHom (F x)) (a + b) =
                                        (liftAddHom fun x => toAddMonoidHom (F x)) a +
                                          (liftAddHom fun x => toAddMonoidHom (F x)) b) },
                            map_smul' :=
                              (_ : ∀ (c : R) (f : α →₀ M), (sum (c • f) fun i => ⇑(F i)) = c • sum f fun i => ⇑(F i)) },
                        map_add' :=
                          (_ :
                            ∀ (F G : α → M →ₗ[R] N),
                              (fun F =>
                                    {
                                      toAddHom :=
                                        { toFun := fun d => sum d fun i => ⇑(F i),
                                          map_add' :=
                                            (_ :
                                              ∀ (a b : α →₀ M),
                                                (liftAddHom fun x => toAddMonoidHom (F x)) (a + b) =
                                                  (liftAddHom fun x => toAddMonoidHom (F x)) a +
                                                    (liftAddHom fun x => toAddMonoidHom (F x)) b) },
                                      map_smul' :=
                                        (_ :
                                          ∀ (c : R) (f : α →₀ M),
                                            (sum (c • f) fun i => ⇑(F i)) = c • sum f fun i => ⇑(F i)) })
                                  (F + G) =
                                (fun F =>
                                      {
                                        toAddHom :=
                                          { toFun := fun d => sum d fun i => ⇑(F i),
                                            map_add' :=
                                              (_ :
                                                ∀ (a b : α →₀ M),
                                                  (liftAddHom fun x => toAddMonoidHom (F x)) (a + b) =
                                                    (liftAddHom fun x => toAddMonoidHom (F x)) a +
                                                      (liftAddHom fun x => toAddMonoidHom (F x)) b) },
                                        map_smul' :=
                                          (_ :
                                            ∀ (c : R) (f : α →₀ M),
                                              (sum (c • f) fun i => ⇑(F i)) = c • sum f fun i => ⇑(F i)) })
                                    F +
                                  (fun F =>
                                      {
                                        toAddHom :=
                                          { toFun := fun d => sum d fun i => ⇑(F i),
                                            map_add' :=
                                              (_ :
                                                ∀ (a b : α →₀ M),
                                                  (liftAddHom fun x => toAddMonoidHom (F x)) (a + b) =
                                                    (liftAddHom fun x => toAddMonoidHom (F x)) a +
                                                      (liftAddHom fun x => toAddMonoidHom (F x)) b) },
                                        map_smul' :=
                                          (_ :
                                            ∀ (c : R) (f : α →₀ M),
                                              (sum (c • f) fun i => ⇑(F i)) = c • sum f fun i => ⇑(F i)) })
                                    G) }
                      (F • G) =
                    (RingHom.id S) F •
                      AddHom.toFun
                        {
                          toFun := fun F =>
                            {
                              toAddHom :=
                                { toFun := fun d => sum d fun i => ⇑(F i),
                                  map_add' :=
                                    (_ :
                                      ∀ (a b : α →₀ M),
                                        (liftAddHom fun x => toAddMonoidHom (F x)) (a + b) =
                                          (liftAddHom fun x => toAddMonoidHom (F x)) a +
                                            (liftAddHom fun x => toAddMonoidHom (F x)) b) },
                              map_smul' :=
                                (_ :
                                  ∀ (c : R) (f : α →₀ M), (sum (c • f) fun i => ⇑(F i)) = c • sum f fun i => ⇑(F i)) },
                          map_add' :=
                            (_ :
                              ∀ (F G : α → M →ₗ[R] N),
                                (fun F =>
                                      {
                                        toAddHom :=
                                          { toFun := fun d => sum d fun i => ⇑(F i),
                                            map_add' :=
                                              (_ :
                                                ∀ (a b : α →₀ M),
                                                  (liftAddHom fun x => toAddMonoidHom (F x)) (a + b) =
                                                    (liftAddHom fun x => toAddMonoidHom (F x)) a +
                                                      (liftAddHom fun x => toAddMonoidHom (F x)) b) },
                                        map_smul' :=
                                          (_ :
                                            ∀ (c : R) (f : α →₀ M),
                                              (sum (c • f) fun i => ⇑(F i)) = c • sum f fun i => ⇑(F i)) })
                                    (F + G) =
                                  (fun F =>
                                        {
                                          toAddHom :=
                                            { toFun := fun d => sum d fun i => ⇑(F i),
                                              map_add' :=
                                                (_ :
                                                  ∀ (a b : α →₀ M),
                                                    (liftAddHom fun x => toAddMonoidHom (F x)) (a + b) =
                                                      (liftAddHom fun x => toAddMonoidHom (F x)) a +
                                                        (liftAddHom fun x => toAddMonoidHom (F x)) b) },
                                          map_smul' :=
                                            (_ :
                                              ∀ (c : R) (f : α →₀ M),
                                                (sum (c • f) fun i => ⇑(F i)) = c • sum f fun i => ⇑(F i)) })
                                      F +
                                    (fun F =>
                                        {
                                          toAddHom :=
                                            { toFun := fun d => sum d fun i => ⇑(F i),
                                              map_add' :=
                                                (_ :
                                                  ∀ (a b : α →₀ M),
                                                    (liftAddHom fun x => toAddMonoidHom (F x)) (a + b) =
                                                      (liftAddHom fun x => toAddMonoidHom (F x)) a +
                                                        (liftAddHom fun x => toAddMonoidHom (F x)) b) },
                                          map_smul' :=
                                            (_ :
                                              ∀ (c : R) (f : α →₀ M),
                                                (sum (c • f) fun i => ⇑(F i)) = c • sum f fun i => ⇑(F i)) })
                                      G) }
                        G) }.toAddHom
        F) =
    F

Next tactic:
ext x y