/-- Internal definition used to define `lift` -/
private def liftAux (f : X → A) : FreeAlgebra R X →ₐ[R] A where
  toFun a :=
    Quot.liftOn a (liftFun _ _ f) fun a b h ↦ by
      induction' h
      · exact (algebraMap R A).map_add _ _
      · exact (algebraMap R A).map_mul _ _
      · apply Algebra.commutes
      · change _ + _ + _ = _ + (_ + _)
        rw [add_assoc]
      · change _ + _ = _ + _
        rw [add_comm]
      · change algebraMap _ _ _ + liftFun R X f _ = liftFun R X f _
        simp
      · change _ * _ * _ = _ * (_ * _)
        rw [mul_assoc]
      · change algebraMap _ _ _ * liftFun R X f _ = liftFun R X f _
        simp
      · change liftFun R X f _ * algebraMap _ _ _ = liftFun R X f _
        simp
      · change _ * (_ + _) = _ * _ + _ * _
        rw [left_distrib]
      · change (_ + _) * _ = _ * _ + _ * _
        rw [right_distrib]
      · change algebraMap _ _ _ * _ = algebraMap _ _ _
        simp
      · change _ * algebraMap _ _ _ = algebraMap _ _ _
        simp
      repeat
        change liftFun R X f _ + liftFun R X f _ = _
        simp only [*]
        rfl
      repeat
        change liftFun R X f _ * liftFun R X f _ = _
        simp only [*]
        rfl
  map_one' := by
    change algebraMap _ _ _ = _
    simp
  map_mul' := by
    rintro ⟨⟩ ⟨⟩
    rfl
  map_zero' := by
    dsimp
    change algebraMap _ _ _ = _
    simp
  map_add' := by
    rintro ⟨⟩ ⟨⟩
    rfl
  commutes' := by 

Proof state:
R : Type u_1
inst✝² : CommSemiring R
X : Type u_2
A : Type u_3
inst✝¹ : Semiring A
inst✝ : Algebra R A
f : X → A
⊢ ∀ (r : R),
    OneHom.toFun
        (↑↑{
              toMonoidHom :=
                {
                  toOneHom :=
                    {
                      toFun := fun a =>
                        Quot.liftOn a (liftFun R X f)
                          (_ : ∀ (a b : Pre R X), Rel R X a b → liftFun R X f a = liftFun R X f b),
                      map_one' := (_ : (algebraMap R A) 1 = 1) },
                  map_mul' :=
                    (_ :
                      ∀ (x y : FreeAlgebra R X),
                        OneHom.toFun
                            {
                              toFun := fun a =>
                                Quot.liftOn a (liftFun R X f)
                                  (_ : ∀ (a b : Pre R X), Rel R X a b → liftFun R X f a = liftFun R X f b),
                              map_one' := (_ : (algebraMap R A) 1 = 1) }
                            (x * y) =
                          OneHom.toFun
                              {
                                toFun := fun a =>
                                  Quot.liftOn a (liftFun R X f)
                                    (_ : ∀ (a b : Pre R X), Rel R X a b → liftFun R X f a = liftFun R X f b),
                                map_one' := (_ : (algebraMap R A) 1 = 1) }
                              x *
                            OneHom.toFun
                              {
                                toFun := fun a =>
                                  Quot.liftOn a (liftFun R X f)
                                    (_ : ∀ (a b : Pre R X), Rel R X a b → liftFun R X f a = liftFun R X f b),
                                map_one' := (_ : (algebraMap R A) 1 = 1) }
                              y) },
              map_zero' :=
                (_ :
                  OneHom.toFun
                      (↑{
                          toOneHom :=
                            {
                              toFun := fun a =>
                                Quot.liftOn a (liftFun R X f)
                                  (_ : ∀ (a b : Pre R X), Rel R X a b → liftFun R X f a = liftFun R X f b),
                              map_one' := (_ : (algebraMap R A) 1 = 1) },
                          map_mul' :=
                            (_ :
                              ∀ (x y : FreeAlgebra R X),
                                OneHom.toFun
                                    {
                                      toFun := fun a =>
                                        Quot.liftOn a (liftFun R X f)
                                          (_ : ∀ (a b : Pre R X), Rel R X a b → liftFun R X f a = liftFun R X f b),
                                      map_one' := (_ : (algebraMap R A) 1 = 1) }
                                    (x * y) =
                                  OneHom.toFun
                                      {
                                        toFun := fun a =>
                                          Quot.liftOn a (liftFun R X f)
                                            (_ : ∀ (a b : Pre R X), Rel R X a b → liftFun R X f a = liftFun R X f b),
                                        map_one' := (_ : (algebraMap R A) 1 = 1) }
                                      x *
                                    OneHom.toFun
                                      {
                                        toFun := fun a =>
                                          Quot.liftOn a (liftFun R X f)
                                            (_ : ∀ (a b : Pre R X), Rel R X a b → liftFun R X f a = liftFun R X f b),
                                        map_one' := (_ : (algebraMap R A) 1 = 1) }
                                      y) })
                      0 =
                    0),
              map_add' :=
                (_ :
                  ∀ (x y : FreeAlgebra R X),
                    OneHom.toFun
                        (↑{
                            toOneHom :=
                              {
                                toFun := fun a =>
                                  Quot.liftOn a (liftFun R X f)
                                    (_ : ∀ (a b : Pre R X), Rel R X a b → liftFun R X f a = liftFun R X f b),
                                map_one' := (_ : (algebraMap R A) 1 = 1) },
                            map_mul' :=
                              (_ :
                                ∀ (x y : FreeAlgebra R X),
                                  OneHom.toFun
                                      {
                                        toFun := fun a =>
                                          Quot.liftOn a (liftFun R X f)
                                            (_ : ∀ (a b : Pre R X), Rel R X a b → liftFun R X f a = liftFun R X f b),
                                        map_one' := (_ : (algebraMap R A) 1 = 1) }
                                      (x * y) =
                                    OneHom.toFun
                                        {
                                          toFun := fun a =>
                                            Quot.liftOn a (liftFun R X f)
                                              (_ : ∀ (a b : Pre R X), Rel R X a b → liftFun R X f a = liftFun R X f b),
                                          map_one' := (_ : (algebraMap R A) 1 = 1) }
                                        x *
                                      OneHom.toFun
                                        {
                                          toFun := fun a =>
                                            Quot.liftOn a (liftFun R X f)
                                              (_ : ∀ (a b : Pre R X), Rel R X a b → liftFun R X f a = liftFun R X f b),
                                          map_one' := (_ : (algebraMap R A) 1 = 1) }
                                        y) })
                        (x + y) =
                      OneHom.toFun
                          (↑{
                              toOneHom :=
                                {
                                  toFun := fun a =>
                                    Quot.liftOn a (liftFun R X f)
                                      (_ : ∀ (a b : Pre R X), Rel R X a b → liftFun R X f a = liftFun R X f b),
                                  map_one' := (_ : (algebraMap R A) 1 = 1) },
                              map_mul' :=
                                (_ :
                                  ∀ (x y : FreeAlgebra R X),
                                    OneHom.toFun
                                        {
                                          toFun := fun a =>
                                            Quot.liftOn a (liftFun R X f)
                                              (_ : ∀ (a b : Pre R X), Rel R X a b → liftFun R X f a = liftFun R X f b),
                                          map_one' := (_ : (algebraMap R A) 1 = 1) }
                                        (x * y) =
                                      OneHom.toFun
                                          {
                                            toFun := fun a =>
                                              Quot.liftOn a (liftFun R X f)
                                                (_ :
                                                  ∀ (a b : Pre R X), Rel R X a b → liftFun R X f a = liftFun R X f b),
                                            map_one' := (_ : (algebraMap R A) 1 = 1) }
                                          x *
                                        OneHom.toFun
                                          {
                                            toFun := fun a =>
                                              Quot.liftOn a (liftFun R X f)
                                                (_ :
                                                  ∀ (a b : Pre R X), Rel R X a b → liftFun R X f a = liftFun R X f b),
                                            map_one' := (_ : (algebraMap R A) 1 = 1) }
                                          y) })
                          x +
                        OneHom.toFun
                          (↑{
                              toOneHom :=
                                {
                                  toFun := fun a =>
                                    Quot.liftOn a (liftFun R X f)
                                      (_ : ∀ (a b : Pre R X), Rel R X a b → liftFun R X f a = liftFun R X f b),
                                  map_one' := (_ : (algebraMap R A) 1 = 1) },
                              map_mul' :=
                                (_ :
                                  ∀ (x y : FreeAlgebra R X),
                                    OneHom.toFun
                                        {
                                          toFun := fun a =>
                                            Quot.liftOn a (liftFun R X f)
                                              (_ : ∀ (a b : Pre R X), Rel R X a b → liftFun R X f a = liftFun R X f b),
                                          map_one' := (_ : (algebraMap R A) 1 = 1) }
                                        (x * y) =
                                      OneHom.toFun
                                          {
                                            toFun := fun a =>
                                              Quot.liftOn a (liftFun R X f)
                                                (_ :
                                                  ∀ (a b : Pre R X), Rel R X a b → liftFun R X f a = liftFun R X f b),
                                            map_one' := (_ : (algebraMap R A) 1 = 1) }
                                          x *
                                        OneHom.toFun
                                          {
                                            toFun := fun a =>
                                              Quot.liftOn a (liftFun R X f)
                                                (_ :
                                                  ∀ (a b : Pre R X), Rel R X a b → liftFun R X f a = liftFun R X f b),
                                            map_one' := (_ : (algebraMap R A) 1 = 1) }
                                          y) })
                          y) })
        ((algebraMap R (FreeAlgebra R X)) r) =
      (algebraMap R A) r

Next tactic:
tauto