/-- Given a linear map `f : M → A` where `A` is an `R`-algebra, `lift R f` is the unique lift
of `f` to a morphism of `R`-algebras `TensorAlgebra R M → A`.
-/
@[simps symm_apply]
def lift {A : Type*} [Semiring A] [Algebra R A] : (M →ₗ[R] A) ≃ (TensorAlgebra R M →ₐ[R] A) :=
  { toFun :=
      RingQuot.liftAlgHom R ∘ fun f =>
        ⟨FreeAlgebra.lift R (⇑f), fun x y (h : Rel R M x y) => by
          induction h <;>
            simp only [Algebra.smul_def, FreeAlgebra.lift_ι_apply, LinearMap.map_smulₛₗ,
              RingHom.id_apply, map_mul, AlgHom.commutes, map_add]⟩
    invFun := fun F => F.toLinearMap.comp (ι R)
    left_inv := fun f => by
      rw [ι]
      ext1 x
      exact (RingQuot.liftAlgHom_mkAlgHom_apply _ _ _ _).trans (FreeAlgebra.lift_ι_apply f x)
    right_inv := fun F =>
      RingQuot.ringQuot_ext' _ _ _ <|
        FreeAlgebra.hom_ext <|
          funext fun x => by
            rw [ι]
            

Proof state:
R : Type u_1
inst✝⁴ : CommSemiring R
M : Type u_2
inst✝³ : AddCommMonoid M
inst✝² : Module R M
A : Type u_3
inst✝¹ : Semiring A
inst✝ : Algebra R A
F : TensorAlgebra R M →ₐ[R] A
x : M
⊢ (⇑(AlgHom.comp
            ((⇑(RingQuot.liftAlgHom R) ∘ fun f =>
                { val := (FreeAlgebra.lift R) ⇑f,
                  property :=
                    (_ :
                      ∀ (x y : FreeAlgebra R M),
                        Rel R M x y → ((FreeAlgebra.lift R) ⇑f) x = ((FreeAlgebra.lift R) ⇑f) y) })
              ((fun F =>
                  AlgHom.toLinearMap F ∘ₗ
                    {
                      toAddHom :=
                        { toFun := fun m => (RingQuot.mkAlgHom R (Rel R M)) (FreeAlgebra.ι R m),
                          map_add' :=
                            (_ :
                              ∀ (x y : M),
                                (fun m => (RingQuot.mkAlgHom R (Rel R M)) (FreeAlgebra.ι R m)) (x + y) =
                                  (fun m => (RingQuot.mkAlgHom R (Rel R M)) (FreeAlgebra.ι R m)) x +
                                    (fun m => (RingQuot.mkAlgHom R (Rel R M)) (FreeAlgebra.ι R m)) y) },
                      map_smul' :=
                        (_ :
                          ∀ (r : R) (x : M),
                            AddHom.toFun
                                { toFun := fun m => (RingQuot.mkAlgHom R (Rel R M)) (FreeAlgebra.ι R m),
                                  map_add' :=
                                    (_ :
                                      ∀ (x y : M),
                                        (fun m => (RingQuot.mkAlgHom R (Rel R M)) (FreeAlgebra.ι R m)) (x + y) =
                                          (fun m => (RingQuot.mkAlgHom R (Rel R M)) (FreeAlgebra.ι R m)) x +
                                            (fun m => (RingQuot.mkAlgHom R (Rel R M)) (FreeAlgebra.ι R m)) y) }
                                (r • x) =
                              (RingHom.id R) r •
                                AddHom.toFun
                                  { toFun := fun m => (RingQuot.mkAlgHom R (Rel R M)) (FreeAlgebra.ι R m),
                                    map_add' :=
                                      (_ :
                                        ∀ (x y : M),
                                          (fun m => (RingQuot.mkAlgHom R (Rel R M)) (FreeAlgebra.ι R m)) (x + y) =
                                            (fun m => (RingQuot.mkAlgHom R (Rel R M)) (FreeAlgebra.ι R m)) x +
                                              (fun m => (RingQuot.mkAlgHom R (Rel R M)) (FreeAlgebra.ι R m)) y) }
                                  x) })
                F))
            (RingQuot.mkAlgHom R (Rel R M))) ∘
        FreeAlgebra.ι R)
      x =
    (⇑(AlgHom.comp F (RingQuot.mkAlgHom R (Rel R M))) ∘ FreeAlgebra.ι R) x

Next tactic:
exact
              (RingQuot.liftAlgHom_mkAlgHom_apply _ _ _ _).trans (FreeAlgebra.lift_ι_apply _ _)