/-
Copyright (c) 2020 Adam Topaz. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Scott Morrison, Adam Topaz

! This file was ported from Lean 3 source module algebra.free_algebra
! leanprover-community/mathlib commit aa3a420527e0fbfd0f6615b95b761254a9166e12
! Please do not edit these lines, except to modify the commit id
! if you have ported upstream changes.
-/
import Mathbin.Algebra.Algebra.Subalgebra.Basic
import Mathbin.Algebra.MonoidAlgebra.Basic

/-!
# Free Algebras

> THIS FILE IS SYNCHRONIZED WITH MATHLIB4.
> Any changes to this file require a corresponding PR to mathlib4.

Given a commutative semiring `R`, and a type `X`, we construct the free unital, associative
`R`-algebra on `X`.

## Notation

1. `free_algebra R X` is the free algebra itself. It is endowed with an `R`-algebra structure.
2. `free_algebra.ι R` is the function `X → free_algebra R X`.
3. Given a function `f : X → A` to an R-algebra `A`, `lift R f` is the lift of `f` to an
  `R`-algebra morphism `free_algebra R X → A`.

## Theorems

1. `ι_comp_lift` states that the composition `(lift R f) ∘ (ι R)` is identical to `f`.
2. `lift_unique` states that whenever an R-algebra morphism `g : free_algebra R X → A` is
  given whose composition with `ι R` is `f`, then one has `g = lift R f`.
3. `hom_ext` is a variant of `lift_unique` in the form of an extensionality theorem.
4. `lift_comp_ι` is a combination of `ι_comp_lift` and `lift_unique`. It states that the lift
  of the composition of an algebra morphism with `ι` is the algebra morphism itself.
5. `equiv_monoid_algebra_free_monoid : free_algebra R X ≃ₐ[R] monoid_algebra R (free_monoid X)`
6. An inductive principle `induction`.

## Implementation details

We construct the free algebra on `X` as a quotient of an inductive type `free_algebra.pre` by an
inductively defined relation `free_algebra.rel`. Explicitly, the construction involves three steps:
1. We construct an inductive type `free_algebra.pre R X`, the terms of which should be thought
  of as representatives for the elements of `free_algebra R X`.
  It is the free type with maps from `R` and `X`, and with two binary operations `add` and `mul`.
2. We construct an inductive relation `free_algebra.rel R X` on `free_algebra.pre R X`.
  This is the smallest relation for which the quotient is an `R`-algebra where addition resp.
  multiplication are induced by `add` resp. `mul` from 1., and for which the map from `R` is the
  structure map for the algebra.
3. The free algebra `free_algebra R X` is the quotient of `free_algebra.pre R X` by
  the relation `free_algebra.rel R X`.
-/

variable (R : Type _) [CommSemiring R]

variable (X : Type _)

namespace FreeAlgebra

/- warning: free_algebra.pre -> FreeAlgebra.Pre is a dubious translation:
lean 3 declaration is
  forall (R : Type.{u1}) [_inst_1 : CommSemiring.{u1} R], Type.{u2} -> Sort.{max (succ u1) (succ u2)}
but is expected to have type
  Type.{u1} -> Type.{u2} -> Sort.{max (succ u1) (succ u2)}
Case conversion may be inaccurate. Consider using '#align free_algebra.pre FreeAlgebra.Preₓ'. -/
/-- This inductive type is used to express representatives of the free algebra.
-/
inductive Pre
  | of : X → pre
  | of_scalar : R → pre
  | add : pre → pre → pre
  | mul : pre → pre → pre
#align free_algebra.pre FreeAlgebra.Pre

namespace Pre

instance : Inhabited (Pre R X) :=
  ⟨of_scalar 0⟩

/- warning: free_algebra.pre.has_coe_generator -> FreeAlgebra.Pre.hasCoeGenerator is a dubious translation:
lean 3 declaration is
  forall (R : Type.{u1}) [_inst_1 : CommSemiring.{u1} R] (X : Type.{u2}), Coe.{succ u2, max (succ u1) (succ u2)} X (FreeAlgebra.Pre.{u1, u2} R _inst_1 X)
but is expected to have type
  forall (R : Type.{u1}) (_inst_1 : Type.{u2}), Coe.{succ u2, max (succ u2) (succ u1)} _inst_1 (FreeAlgebra.Pre.{u1, u2} R _inst_1)
Case conversion may be inaccurate. Consider using '#align free_algebra.pre.has_coe_generator FreeAlgebra.Pre.hasCoeGeneratorₓ'. -/
-- Note: These instances are only used to simplify the notation.
/-- Coercion from `X` to `pre R X`. Note: Used for notation only. -/
def hasCoeGenerator : Coe X (Pre R X) :=
  ⟨of⟩
#align free_algebra.pre.has_coe_generator FreeAlgebra.Pre.hasCoeGenerator

/- warning: free_algebra.pre.has_coe_semiring -> FreeAlgebra.Pre.hasCoeSemiring is a dubious translation:
lean 3 declaration is
  forall (R : Type.{u1}) [_inst_1 : CommSemiring.{u1} R] (X : Type.{u2}), Coe.{succ u1, max (succ u1) (succ u2)} R (FreeAlgebra.Pre.{u1, u2} R _inst_1 X)
but is expected to have type
  forall (R : Type.{u1}) (_inst_1 : Type.{u2}), Coe.{succ u1, max (succ u2) (succ u1)} R (FreeAlgebra.Pre.{u1, u2} R _inst_1)
Case conversion may be inaccurate. Consider using '#align free_algebra.pre.has_coe_semiring FreeAlgebra.Pre.hasCoeSemiringₓ'. -/
/-- Coercion from `R` to `pre R X`. Note: Used for notation only. -/
def hasCoeSemiring : Coe R (Pre R X) :=
  ⟨of_scalar⟩
#align free_algebra.pre.has_coe_semiring FreeAlgebra.Pre.hasCoeSemiring

/- warning: free_algebra.pre.has_mul -> FreeAlgebra.Pre.hasMul is a dubious translation:
lean 3 declaration is
  forall (R : Type.{u1}) [_inst_1 : CommSemiring.{u1} R] (X : Type.{u2}), Mul.{max u1 u2} (FreeAlgebra.Pre.{u1, u2} R _inst_1 X)
but is expected to have type
  forall (R : Type.{u1}) (_inst_1 : Type.{u2}), Mul.{max u2 u1} (FreeAlgebra.Pre.{u1, u2} R _inst_1)
Case conversion may be inaccurate. Consider using '#align free_algebra.pre.has_mul FreeAlgebra.Pre.hasMulₓ'. -/
/-- Multiplication in `pre R X` defined as `pre.mul`. Note: Used for notation only. -/
def hasMul : Mul (Pre R X) :=
  ⟨mul⟩
#align free_algebra.pre.has_mul FreeAlgebra.Pre.hasMul

/- warning: free_algebra.pre.has_add -> FreeAlgebra.Pre.hasAdd is a dubious translation:
lean 3 declaration is
  forall (R : Type.{u1}) [_inst_1 : CommSemiring.{u1} R] (X : Type.{u2}), Add.{max u1 u2} (FreeAlgebra.Pre.{u1, u2} R _inst_1 X)
but is expected to have type
  forall (R : Type.{u1}) (_inst_1 : Type.{u2}), Add.{max u2 u1} (FreeAlgebra.Pre.{u1, u2} R _inst_1)
Case conversion may be inaccurate. Consider using '#align free_algebra.pre.has_add FreeAlgebra.Pre.hasAddₓ'. -/
/-- Addition in `pre R X` defined as `pre.add`. Note: Used for notation only. -/
def hasAdd : Add (Pre R X) :=
  ⟨add⟩
#align free_algebra.pre.has_add FreeAlgebra.Pre.hasAdd

#print FreeAlgebra.Pre.hasZero /-
/-- Zero in `pre R X` defined as the image of `0` from `R`. Note: Used for notation only. -/
def hasZero : Zero (Pre R X) :=
  ⟨of_scalar 0⟩
#align free_algebra.pre.has_zero FreeAlgebra.Pre.hasZero
-/

#print FreeAlgebra.Pre.hasOne /-
/-- One in `pre R X` defined as the image of `1` from `R`. Note: Used for notation only. -/
def hasOne : One (Pre R X) :=
  ⟨of_scalar 1⟩
#align free_algebra.pre.has_one FreeAlgebra.Pre.hasOne
-/

/- warning: free_algebra.pre.has_smul -> FreeAlgebra.Pre.hasSmul is a dubious translation:
lean 3 declaration is
  forall (R : Type.{u1}) [_inst_1 : CommSemiring.{u1} R] (X : Type.{u2}), SMul.{u1, max u1 u2} R (FreeAlgebra.Pre.{u1, u2} R _inst_1 X)
but is expected to have type
  forall (R : Type.{u1}) (_inst_1 : Type.{u2}), SMul.{u1, max u2 u1} R (FreeAlgebra.Pre.{u1, u2} R _inst_1)
Case conversion may be inaccurate. Consider using '#align free_algebra.pre.has_smul FreeAlgebra.Pre.hasSmulₓ'. -/
/-- Scalar multiplication defined as multiplication by the image of elements from `R`.
Note: Used for notation only.
-/
def hasSmul : SMul R (Pre R X) :=
  ⟨fun r m => mul (of_scalar r) m⟩
#align free_algebra.pre.has_smul FreeAlgebra.Pre.hasSmul

end Pre

attribute [local instance]
  pre.has_coe_generator pre.has_coe_semiring pre.has_mul pre.has_add pre.has_zero pre.has_one pre.has_smul

#print FreeAlgebra.liftFun /-
/-- Given a function from `X` to an `R`-algebra `A`, `lift_fun` provides a lift of `f` to a function
from `pre R X` to `A`. This is mainly used in the construction of `free_algebra.lift`.
-/
def liftFun {A : Type _} [Semiring A] [Algebra R A] (f : X → A) : Pre R X → A := fun t =>
  Pre.recOn t f (algebraMap _ _) (fun _ _ => (· + ·)) fun _ _ => (· * ·)
#align free_algebra.lift_fun FreeAlgebra.liftFun
-/

#print FreeAlgebra.Rel /-
/-- An inductively defined relation on `pre R X` used to force the initial algebra structure on
the associated quotient.
-/
inductive Rel : Pre R X → Pre R X → Prop-- force `of_scalar` to be a central semiring morphism

  | add_scalar {r s : R} : Rel (↑(r + s)) (↑r + ↑s)
  | mul_scalar {r s : R} : Rel (↑(r * s)) (↑r * ↑s)
  | central_scalar {r : R} {a : Pre R X} : Rel (r * a) (a * r)-- commutative additive semigroup

  | add_assoc {a b c : Pre R X} : Rel (a + b + c) (a + (b + c))
  | add_comm {a b : Pre R X} : Rel (a + b) (b + a)
  | zero_add {a : Pre R X} : Rel (0 + a) a-- multiplicative monoid

  | mul_assoc {a b c : Pre R X} : Rel (a * b * c) (a * (b * c))
  | one_mul {a : Pre R X} : Rel (1 * a) a
  | mul_one {a : Pre R X} : Rel (a * 1) a-- distributivity

  | left_distrib {a b c : Pre R X} : Rel (a * (b + c)) (a * b + a * c)
  |
  right_distrib {a b c : Pre R X} :
    Rel ((a + b) * c) (a * c + b * c)-- other relations needed for semiring

  | MulZeroClass.zero_mul {a : Pre R X} : Rel (0 * a) 0
  | MulZeroClass.mul_zero {a : Pre R X} : Rel (a * 0) 0-- compatibility

  | add_compat_left {a b c : Pre R X} : Rel a b → Rel (a + c) (b + c)
  | add_compat_right {a b c : Pre R X} : Rel a b → Rel (c + a) (c + b)
  | mul_compat_left {a b c : Pre R X} : Rel a b → Rel (a * c) (b * c)
  | mul_compat_right {a b c : Pre R X} : Rel a b → Rel (c * a) (c * b)
#align free_algebra.rel FreeAlgebra.Rel
-/

end FreeAlgebra

#print FreeAlgebra /-
/-- The free algebra for the type `X` over the commutative semiring `R`.
-/
def FreeAlgebra :=
  Quot (FreeAlgebra.Rel R X)
#align free_algebra FreeAlgebra
-/

namespace FreeAlgebra

attribute [local instance]
  pre.has_coe_generator pre.has_coe_semiring pre.has_mul pre.has_add pre.has_zero pre.has_one pre.has_smul

instance : Semiring (FreeAlgebra R X)
    where
  add := Quot.map₂ (· + ·) (fun _ _ _ => Rel.add_compat_right) fun _ _ _ => Rel.add_compat_left
  add_assoc := by
    rintro ⟨⟩ ⟨⟩ ⟨⟩
    exact Quot.sound rel.add_assoc
  zero := Quot.mk _ 0
  zero_add := by
    rintro ⟨⟩
    exact Quot.sound rel.zero_add
  add_zero := by
    rintro ⟨⟩
    change Quot.mk _ _ = _
    rw [Quot.sound rel.add_comm, Quot.sound rel.zero_add]
  add_comm := by
    rintro ⟨⟩ ⟨⟩
    exact Quot.sound rel.add_comm
  mul := Quot.map₂ (· * ·) (fun _ _ _ => Rel.mul_compat_right) fun _ _ _ => Rel.mul_compat_left
  mul_assoc := by
    rintro ⟨⟩ ⟨⟩ ⟨⟩
    exact Quot.sound rel.mul_assoc
  one := Quot.mk _ 1
  one_mul := by
    rintro ⟨⟩
    exact Quot.sound rel.one_mul
  mul_one := by
    rintro ⟨⟩
    exact Quot.sound rel.mul_one
  left_distrib := by
    rintro ⟨⟩ ⟨⟩ ⟨⟩
    exact Quot.sound rel.left_distrib
  right_distrib := by
    rintro ⟨⟩ ⟨⟩ ⟨⟩
    exact Quot.sound rel.right_distrib
  zero_mul := by
    rintro ⟨⟩
    exact Quot.sound rel.zero_mul
  mul_zero := by
    rintro ⟨⟩
    exact Quot.sound rel.mul_zero

instance : Inhabited (FreeAlgebra R X) :=
  ⟨0⟩

instance : SMul R (FreeAlgebra R X)
    where smul r := Quot.map ((· * ·) ↑r) fun a b => Rel.mul_compat_right

instance : Algebra R (FreeAlgebra R X)
    where
  toFun r := Quot.mk _ r
  map_one' := rfl
  map_mul' _ _ := Quot.sound Rel.mul_scalar
  map_zero' := rfl
  map_add' _ _ := Quot.sound Rel.add_scalar
  commutes' _ := by
    rintro ⟨⟩
    exact Quot.sound rel.central_scalar
  smul_def' _ _ := rfl

instance {S : Type _} [CommRing S] : Ring (FreeAlgebra S X) :=
  Algebra.semiringToRing S

variable {X}

#print FreeAlgebra.ι /-
/-- The canonical function `X → free_algebra R X`.
-/
irreducible_def ι : X → FreeAlgebra R X := fun m => Quot.mk _ m
#align free_algebra.ι FreeAlgebra.ι
-/

/- warning: free_algebra.quot_mk_eq_ι -> FreeAlgebra.quot_mk_eq_ι is a dubious translation:
lean 3 declaration is
  forall (R : Type.{u1}) [_inst_1 : CommSemiring.{u1} R] {X : Type.{u2}} (m : X), Eq.{max (succ u1) (succ u2)} (Quot.{max (succ u1) (succ u2)} (FreeAlgebra.Pre.{u1, u2} R _inst_1 X) (FreeAlgebra.Rel.{u1, u2} R _inst_1 X)) (Quot.mk.{max (succ u1) (succ u2)} (FreeAlgebra.Pre.{u1, u2} R _inst_1 X) (FreeAlgebra.Rel.{u1, u2} R _inst_1 X) ((fun (a : Type.{u2}) (b : Sort.{max (succ u1) (succ u2)}) [self : HasLiftT.{succ u2, max (succ u1) (succ u2)} a b] => self.0) X (FreeAlgebra.Pre.{u1, u2} R _inst_1 X) (HasLiftT.mk.{succ u2, max (succ u1) (succ u2)} X (FreeAlgebra.Pre.{u1, u2} R _inst_1 X) (CoeTCₓ.coe.{succ u2, max (succ u1) (succ u2)} X (FreeAlgebra.Pre.{u1, u2} R _inst_1 X) (coeBase.{succ u2, max (succ u1) (succ u2)} X (FreeAlgebra.Pre.{u1, u2} R _inst_1 X) (FreeAlgebra.Pre.hasCoeGenerator.{u1, u2} R _inst_1 X)))) m)) (FreeAlgebra.ι.{u1, u2} R _inst_1 X m)
but is expected to have type
  forall (R : Type.{u2}) [_inst_1 : CommSemiring.{u2} R] {X : Type.{u1}} (m : X), Eq.{max (succ u2) (succ u1)} (Quot.{max (succ u2) (succ u1)} (FreeAlgebra.Pre.{u2, u1} R X) (FreeAlgebra.Rel.{u2, u1} R _inst_1 X)) (Quot.mk.{max (succ u2) (succ u1)} (FreeAlgebra.Pre.{u2, u1} R X) (FreeAlgebra.Rel.{u2, u1} R _inst_1 X) (FreeAlgebra.Pre.of.{u2, u1} R X m)) (FreeAlgebra.ι.{u2, u1} R _inst_1 X m)
Case conversion may be inaccurate. Consider using '#align free_algebra.quot_mk_eq_ι FreeAlgebra.quot_mk_eq_ιₓ'. -/
@[simp]
theorem quot_mk_eq_ι (m : X) : Quot.mk (FreeAlgebra.Rel R X) m = ι R m := by rw [ι]
#align free_algebra.quot_mk_eq_ι FreeAlgebra.quot_mk_eq_ι

variable {A : Type _} [Semiring A] [Algebra R A]

/-- Internal definition used to define `lift` -/
private def lift_aux (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 h_r h_s
      · exact (algebraMap R A).map_mul h_r h_s
      · apply Algebra.commutes
      · change _ + _ + _ = _ + (_ + _)
        rw [add_assoc]
      · change _ + _ = _ + _
        rw [add_comm]
      · change algebraMap _ _ _ + lift_fun R X f _ = lift_fun R X f _
        simp
      · change _ * _ * _ = _ * (_ * _)
        rw [mul_assoc]
      · change algebraMap _ _ _ * lift_fun R X f _ = lift_fun R X f _
        simp
      · change lift_fun R X f _ * algebraMap _ _ _ = lift_fun R X f _
        simp
      · change _ * (_ + _) = _ * _ + _ * _
        rw [left_distrib]
      · change (_ + _) * _ = _ * _ + _ * _
        rw [right_distrib]
      · change algebraMap _ _ _ * _ = algebraMap _ _ _
        simp
      · change _ * algebraMap _ _ _ = algebraMap _ _ _
        simp
      repeat'
        change lift_fun R X f _ + lift_fun R X f _ = _
        rw [h_ih]
        rfl
      repeat'
        change lift_fun R X f _ * lift_fun R X f _ = _
        rw [h_ih]
        rfl
  map_one' := by
    change algebraMap _ _ _ = _
    simp
  map_mul' := by
    rintro ⟨⟩ ⟨⟩
    rfl
  map_zero' := by
    change algebraMap _ _ _ = _
    simp
  map_add' := by
    rintro ⟨⟩ ⟨⟩
    rfl
  commutes' := by tauto
#align free_algebra.lift_aux free_algebra.lift_aux

/- warning: free_algebra.lift -> FreeAlgebra.lift is a dubious translation:
lean 3 declaration is
  forall (R : Type.{u1}) [_inst_1 : CommSemiring.{u1} R] {X : Type.{u2}} {A : Type.{u3}} [_inst_2 : Semiring.{u3} A] [_inst_3 : Algebra.{u1, u3} R A _inst_1 _inst_2], Equiv.{max (succ u2) (succ u3), max (succ (max u1 u2)) (succ u3)} (X -> A) (AlgHom.{u1, max u1 u2, u3} R (FreeAlgebra.{u1, u2} R _inst_1 X) A _inst_1 (FreeAlgebra.semiring.{u1, u2} R _inst_1 X) _inst_2 (FreeAlgebra.algebra.{u1, u2} R _inst_1 X) _inst_3)
but is expected to have type
  forall (R : Type.{u1}) [_inst_1 : CommSemiring.{u1} R] {X : Type.{u2}} {A : Type.{u3}} [_inst_2 : Semiring.{u3} A] [_inst_3 : Algebra.{u1, u3} R A _inst_1 _inst_2], Equiv.{max (succ u2) (succ u3), max (succ u3) (succ (max u2 u1))} (X -> A) (AlgHom.{u1, max u2 u1, u3} R (FreeAlgebra.{u1, u2} R _inst_1 X) A _inst_1 (FreeAlgebra.instSemiringFreeAlgebra.{u1, u2} R _inst_1 X) _inst_2 (FreeAlgebra.instAlgebraFreeAlgebraInstSemiringFreeAlgebra.{u1, u2} R _inst_1 X) _inst_3)
Case conversion may be inaccurate. Consider using '#align free_algebra.lift FreeAlgebra.liftₓ'. -/
/-- Given a function `f : X → A` where `A` is an `R`-algebra, `lift R f` is the unique lift
of `f` to a morphism of `R`-algebras `free_algebra R X → A`.
-/
irreducible_def lift : (X → A) ≃ (FreeAlgebra R X →ₐ[R] A) :=
  { toFun := liftAux R
    invFun := fun F => F ∘ ι R
    left_inv := fun f => by
      ext
      rw [ι]
      rfl
    right_inv := fun F => by
      ext x
      rcases x with ⟨⟩
      induction x
      case of =>
        change ((F : FreeAlgebra R X → A) ∘ ι R) _ = _
        rw [ι]
        rfl
      case of_scalar =>
        change algebraMap _ _ x = F (algebraMap _ _ x)
        rw [AlgHom.commutes F x]
      case
        add a b ha hb =>
        change lift_aux R (F ∘ ι R) (Quot.mk _ _ + Quot.mk _ _) = F (Quot.mk _ _ + Quot.mk _ _)
        rw [AlgHom.map_add, AlgHom.map_add, ha, hb]
      case
        mul a b ha hb =>
        change lift_aux R (F ∘ ι R) (Quot.mk _ _ * Quot.mk _ _) = F (Quot.mk _ _ * Quot.mk _ _)
        rw [AlgHom.map_mul, AlgHom.map_mul, ha, hb] }
#align free_algebra.lift FreeAlgebra.lift

/- warning: free_algebra.lift_aux_eq -> FreeAlgebra.liftAux_eq is a dubious translation:
lean 3 declaration is
  forall (R : Type.{u1}) [_inst_1 : CommSemiring.{u1} R] {X : Type.{u2}} {A : Type.{u3}} [_inst_2 : Semiring.{u3} A] [_inst_3 : Algebra.{u1, u3} R A _inst_1 _inst_2] (f : X -> A), Eq.{max (succ (max u1 u2)) (succ u3)} (AlgHom.{u1, max u1 u2, u3} R (FreeAlgebra.{u1, u2} R _inst_1 X) A _inst_1 (FreeAlgebra.semiring.{u1, u2} R _inst_1 X) _inst_2 (FreeAlgebra.algebra.{u1, u2} R _inst_1 X) _inst_3) (_Private.3391014519.liftAux.{u1, u2, u3} R _inst_1 X A _inst_2 _inst_3 f) (coeFn.{max 1 (max (max (succ u2) (succ u3)) (succ (max u1 u2)) (succ u3)) (max (succ (max u1 u2)) (succ u3)) (succ u2) (succ u3), max (max (succ u2) (succ u3)) (succ (max u1 u2)) (succ u3)} (Equiv.{max (succ u2) (succ u3), max (succ (max u1 u2)) (succ u3)} (X -> A) (AlgHom.{u1, max u1 u2, u3} R (FreeAlgebra.{u1, u2} R _inst_1 X) A _inst_1 (FreeAlgebra.semiring.{u1, u2} R _inst_1 X) _inst_2 (FreeAlgebra.algebra.{u1, u2} R _inst_1 X) _inst_3)) (fun (_x : Equiv.{max (succ u2) (succ u3), max (succ (max u1 u2)) (succ u3)} (X -> A) (AlgHom.{u1, max u1 u2, u3} R (FreeAlgebra.{u1, u2} R _inst_1 X) A _inst_1 (FreeAlgebra.semiring.{u1, u2} R _inst_1 X) _inst_2 (FreeAlgebra.algebra.{u1, u2} R _inst_1 X) _inst_3)) => (X -> A) -> (AlgHom.{u1, max u1 u2, u3} R (FreeAlgebra.{u1, u2} R _inst_1 X) A _inst_1 (FreeAlgebra.semiring.{u1, u2} R _inst_1 X) _inst_2 (FreeAlgebra.algebra.{u1, u2} R _inst_1 X) _inst_3)) (Equiv.hasCoeToFun.{max (succ u2) (succ u3), max (succ (max u1 u2)) (succ u3)} (X -> A) (AlgHom.{u1, max u1 u2, u3} R (FreeAlgebra.{u1, u2} R _inst_1 X) A _inst_1 (FreeAlgebra.semiring.{u1, u2} R _inst_1 X) _inst_2 (FreeAlgebra.algebra.{u1, u2} R _inst_1 X) _inst_3)) (FreeAlgebra.lift.{u1, u2, u3} R _inst_1 X A _inst_2 _inst_3) f)
but is expected to have type
  forall (R : Type.{u3}) [_inst_1 : CommSemiring.{u3} R] {X : Type.{u2}} {A : Type.{u1}} [_inst_2 : Semiring.{u1} A] [_inst_3 : Algebra.{u3, u1} R A _inst_1 _inst_2] (f : X -> A), Eq.{max (max (succ u3) (succ u2)) (succ u1)} (AlgHom.{u3, max u2 u3, u1} R (FreeAlgebra.{u3, u2} R _inst_1 X) A _inst_1 (FreeAlgebra.instSemiringFreeAlgebra.{u3, u2} R _inst_1 X) _inst_2 (FreeAlgebra.instAlgebraFreeAlgebraInstSemiringFreeAlgebra.{u3, u2} R _inst_1 X) _inst_3) (_private.Mathlib.Algebra.FreeAlgebra.0.FreeAlgebra.liftAux.{u3, u2, u1} R _inst_1 X A _inst_2 _inst_3 f) (FunLike.coe.{max (max (succ u3) (succ u1)) (succ u2), max (succ u1) (succ u2), max (max (succ u3) (succ u1)) (succ u2)} (Equiv.{max (succ u2) (succ u1), max (succ u1) (succ (max u2 u3))} (X -> A) (AlgHom.{u3, max u2 u3, u1} R (FreeAlgebra.{u3, u2} R _inst_1 X) A _inst_1 (FreeAlgebra.instSemiringFreeAlgebra.{u3, u2} R _inst_1 X) _inst_2 (FreeAlgebra.instAlgebraFreeAlgebraInstSemiringFreeAlgebra.{u3, u2} R _inst_1 X) _inst_3)) (X -> A) (fun (_x : X -> A) => (fun (x._@.Mathlib.Logic.Equiv.Defs._hyg.808 : X -> A) => AlgHom.{u3, max u2 u3, u1} R (FreeAlgebra.{u3, u2} R _inst_1 X) A _inst_1 (FreeAlgebra.instSemiringFreeAlgebra.{u3, u2} R _inst_1 X) _inst_2 (FreeAlgebra.instAlgebraFreeAlgebraInstSemiringFreeAlgebra.{u3, u2} R _inst_1 X) _inst_3) _x) (Equiv.instFunLikeEquiv.{max (succ u1) (succ u2), max (max (succ u3) (succ u1)) (succ u2)} (X -> A) (AlgHom.{u3, max u2 u3, u1} R (FreeAlgebra.{u3, u2} R _inst_1 X) A _inst_1 (FreeAlgebra.instSemiringFreeAlgebra.{u3, u2} R _inst_1 X) _inst_2 (FreeAlgebra.instAlgebraFreeAlgebraInstSemiringFreeAlgebra.{u3, u2} R _inst_1 X) _inst_3)) (FreeAlgebra.lift.{u3, u2, u1} R _inst_1 X A _inst_2 _inst_3) f)
Case conversion may be inaccurate. Consider using '#align free_algebra.lift_aux_eq FreeAlgebra.liftAux_eqₓ'. -/
@[simp]
theorem liftAux_eq (f : X → A) : liftAux R f = lift R f :=
  by
  rw [lift]
  rfl
#align free_algebra.lift_aux_eq FreeAlgebra.liftAux_eq

/- warning: free_algebra.lift_symm_apply -> FreeAlgebra.lift_symm_apply is a dubious translation:
lean 3 declaration is
  forall (R : Type.{u1}) [_inst_1 : CommSemiring.{u1} R] {X : Type.{u2}} {A : Type.{u3}} [_inst_2 : Semiring.{u3} A] [_inst_3 : Algebra.{u1, u3} R A _inst_1 _inst_2] (F : AlgHom.{u1, max u1 u2, u3} R (FreeAlgebra.{u1, u2} R _inst_1 X) A _inst_1 (FreeAlgebra.semiring.{u1, u2} R _inst_1 X) _inst_2 (FreeAlgebra.algebra.{u1, u2} R _inst_1 X) _inst_3), Eq.{max (succ u2) (succ u3)} (X -> A) (coeFn.{max 1 (max (max (succ (max u1 u2)) (succ u3)) (succ u2) (succ u3)) (max (succ u2) (succ u3)) (succ (max u1 u2)) (succ u3), max (max (succ (max u1 u2)) (succ u3)) (succ u2) (succ u3)} (Equiv.{max (succ (max u1 u2)) (succ u3), max (succ u2) (succ u3)} (AlgHom.{u1, max u1 u2, u3} R (FreeAlgebra.{u1, u2} R _inst_1 X) A _inst_1 (FreeAlgebra.semiring.{u1, u2} R _inst_1 X) _inst_2 (FreeAlgebra.algebra.{u1, u2} R _inst_1 X) _inst_3) (X -> A)) (fun (_x : Equiv.{max (succ (max u1 u2)) (succ u3), max (succ u2) (succ u3)} (AlgHom.{u1, max u1 u2, u3} R (FreeAlgebra.{u1, u2} R _inst_1 X) A _inst_1 (FreeAlgebra.semiring.{u1, u2} R _inst_1 X) _inst_2 (FreeAlgebra.algebra.{u1, u2} R _inst_1 X) _inst_3) (X -> A)) => (AlgHom.{u1, max u1 u2, u3} R (FreeAlgebra.{u1, u2} R _inst_1 X) A _inst_1 (FreeAlgebra.semiring.{u1, u2} R _inst_1 X) _inst_2 (FreeAlgebra.algebra.{u1, u2} R _inst_1 X) _inst_3) -> X -> A) (Equiv.hasCoeToFun.{max (succ (max u1 u2)) (succ u3), max (succ u2) (succ u3)} (AlgHom.{u1, max u1 u2, u3} R (FreeAlgebra.{u1, u2} R _inst_1 X) A _inst_1 (FreeAlgebra.semiring.{u1, u2} R _inst_1 X) _inst_2 (FreeAlgebra.algebra.{u1, u2} R _inst_1 X) _inst_3) (X -> A)) (Equiv.symm.{max (succ u2) (succ u3), max (succ (max u1 u2)) (succ u3)} (X -> A) (AlgHom.{u1, max u1 u2, u3} R (FreeAlgebra.{u1, u2} R _inst_1 X) A _inst_1 (FreeAlgebra.semiring.{u1, u2} R _inst_1 X) _inst_2 (FreeAlgebra.algebra.{u1, u2} R _inst_1 X) _inst_3) (FreeAlgebra.lift.{u1, u2, u3} R _inst_1 X A _inst_2 _inst_3)) F) (Function.comp.{succ u2, max (succ u1) (succ u2), succ u3} X (FreeAlgebra.{u1, u2} R _inst_1 X) A (coeFn.{max (succ (max u1 u2)) (succ u3), max (succ (max u1 u2)) (succ u3)} (AlgHom.{u1, max u1 u2, u3} R (FreeAlgebra.{u1, u2} R _inst_1 X) A _inst_1 (FreeAlgebra.semiring.{u1, u2} R _inst_1 X) _inst_2 (FreeAlgebra.algebra.{u1, u2} R _inst_1 X) _inst_3) (fun (_x : AlgHom.{u1, max u1 u2, u3} R (FreeAlgebra.{u1, u2} R _inst_1 X) A _inst_1 (FreeAlgebra.semiring.{u1, u2} R _inst_1 X) _inst_2 (FreeAlgebra.algebra.{u1, u2} R _inst_1 X) _inst_3) => (FreeAlgebra.{u1, u2} R _inst_1 X) -> A) ([anonymous].{u1, max u1 u2, u3} R (FreeAlgebra.{u1, u2} R _inst_1 X) A _inst_1 (FreeAlgebra.semiring.{u1, u2} R _inst_1 X) _inst_2 (FreeAlgebra.algebra.{u1, u2} R _inst_1 X) _inst_3) F) (FreeAlgebra.ι.{u1, u2} R _inst_1 X))
but is expected to have type
  forall (R : Type.{u3}) [_inst_1 : CommSemiring.{u3} R] {X : Type.{u2}} {A : Type.{u1}} [_inst_2 : Semiring.{u1} A] [_inst_3 : Algebra.{u3, u1} R A _inst_1 _inst_2] (F : AlgHom.{u3, max u2 u3, u1} R (FreeAlgebra.{u3, u2} R _inst_1 X) A _inst_1 (FreeAlgebra.instSemiringFreeAlgebra.{u3, u2} R _inst_1 X) _inst_2 (FreeAlgebra.instAlgebraFreeAlgebraInstSemiringFreeAlgebra.{u3, u2} R _inst_1 X) _inst_3), Eq.{max (succ u2) (succ u1)} ((fun (x._@.Mathlib.Logic.Equiv.Defs._hyg.808 : AlgHom.{u3, max u2 u3, u1} R (FreeAlgebra.{u3, u2} R _inst_1 X) A _inst_1 (FreeAlgebra.instSemiringFreeAlgebra.{u3, u2} R _inst_1 X) _inst_2 (FreeAlgebra.instAlgebraFreeAlgebraInstSemiringFreeAlgebra.{u3, u2} R _inst_1 X) _inst_3) => X -> A) F) (FunLike.coe.{max (max (succ u3) (succ u1)) (succ u2), max (max (succ u3) (succ u1)) (succ u2), max (succ u1) (succ u2)} (Equiv.{max (max (succ u3) (succ u1)) (succ u2), max (succ u1) (succ u2)} (AlgHom.{u3, max u2 u3, u1} R (FreeAlgebra.{u3, u2} R _inst_1 X) A _inst_1 (FreeAlgebra.instSemiringFreeAlgebra.{u3, u2} R _inst_1 X) _inst_2 (FreeAlgebra.instAlgebraFreeAlgebraInstSemiringFreeAlgebra.{u3, u2} R _inst_1 X) _inst_3) (X -> A)) (AlgHom.{u3, max u2 u3, u1} R (FreeAlgebra.{u3, u2} R _inst_1 X) A _inst_1 (FreeAlgebra.instSemiringFreeAlgebra.{u3, u2} R _inst_1 X) _inst_2 (FreeAlgebra.instAlgebraFreeAlgebraInstSemiringFreeAlgebra.{u3, u2} R _inst_1 X) _inst_3) (fun (_x : AlgHom.{u3, max u2 u3, u1} R (FreeAlgebra.{u3, u2} R _inst_1 X) A _inst_1 (FreeAlgebra.instSemiringFreeAlgebra.{u3, u2} R _inst_1 X) _inst_2 (FreeAlgebra.instAlgebraFreeAlgebraInstSemiringFreeAlgebra.{u3, u2} R _inst_1 X) _inst_3) => (fun (x._@.Mathlib.Logic.Equiv.Defs._hyg.808 : AlgHom.{u3, max u2 u3, u1} R (FreeAlgebra.{u3, u2} R _inst_1 X) A _inst_1 (FreeAlgebra.instSemiringFreeAlgebra.{u3, u2} R _inst_1 X) _inst_2 (FreeAlgebra.instAlgebraFreeAlgebraInstSemiringFreeAlgebra.{u3, u2} R _inst_1 X) _inst_3) => X -> A) _x) (Equiv.instFunLikeEquiv.{max (max (succ u3) (succ u1)) (succ u2), max (succ u1) (succ u2)} (AlgHom.{u3, max u2 u3, u1} R (FreeAlgebra.{u3, u2} R _inst_1 X) A _inst_1 (FreeAlgebra.instSemiringFreeAlgebra.{u3, u2} R _inst_1 X) _inst_2 (FreeAlgebra.instAlgebraFreeAlgebraInstSemiringFreeAlgebra.{u3, u2} R _inst_1 X) _inst_3) (X -> A)) (Equiv.symm.{max (succ u1) (succ u2), max (max (succ u3) (succ u1)) (succ u2)} (X -> A) (AlgHom.{u3, max u2 u3, u1} R (FreeAlgebra.{u3, u2} R _inst_1 X) A _inst_1 (FreeAlgebra.instSemiringFreeAlgebra.{u3, u2} R _inst_1 X) _inst_2 (FreeAlgebra.instAlgebraFreeAlgebraInstSemiringFreeAlgebra.{u3, u2} R _inst_1 X) _inst_3) (FreeAlgebra.lift.{u3, u2, u1} R _inst_1 X A _inst_2 _inst_3)) F) (Function.comp.{succ u2, max (succ u3) (succ u2), succ u1} X (FreeAlgebra.{u3, u2} R _inst_1 X) A (FunLike.coe.{max (max (succ u3) (succ u2)) (succ u1), max (succ u3) (succ u2), succ u1} (AlgHom.{u3, max u2 u3, u1} R (FreeAlgebra.{u3, u2} R _inst_1 X) A _inst_1 (FreeAlgebra.instSemiringFreeAlgebra.{u3, u2} R _inst_1 X) _inst_2 (FreeAlgebra.instAlgebraFreeAlgebraInstSemiringFreeAlgebra.{u3, u2} R _inst_1 X) _inst_3) (FreeAlgebra.{u3, u2} R _inst_1 X) (fun (_x : FreeAlgebra.{u3, u2} R _inst_1 X) => (fun (x._@.Mathlib.Algebra.Hom.GroupAction._hyg.2186 : FreeAlgebra.{u3, u2} R _inst_1 X) => A) _x) (SMulHomClass.toFunLike.{max (max u3 u2) u1, u3, max u3 u2, u1} (AlgHom.{u3, max u2 u3, u1} R (FreeAlgebra.{u3, u2} R _inst_1 X) A _inst_1 (FreeAlgebra.instSemiringFreeAlgebra.{u3, u2} R _inst_1 X) _inst_2 (FreeAlgebra.instAlgebraFreeAlgebraInstSemiringFreeAlgebra.{u3, u2} R _inst_1 X) _inst_3) R (FreeAlgebra.{u3, u2} R _inst_1 X) A (SMulZeroClass.toSMul.{u3, max u3 u2} R (FreeAlgebra.{u3, u2} R _inst_1 X) (AddMonoid.toZero.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (AddCommMonoid.toAddMonoid.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (NonUnitalNonAssocSemiring.toAddCommMonoid.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (Semiring.toNonAssocSemiring.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (FreeAlgebra.instSemiringFreeAlgebra.{u3, u2} R _inst_1 X)))))) (DistribSMul.toSMulZeroClass.{u3, max u3 u2} R (FreeAlgebra.{u3, u2} R _inst_1 X) (AddMonoid.toAddZeroClass.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (AddCommMonoid.toAddMonoid.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (NonUnitalNonAssocSemiring.toAddCommMonoid.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (Semiring.toNonAssocSemiring.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (FreeAlgebra.instSemiringFreeAlgebra.{u3, u2} R _inst_1 X)))))) (DistribMulAction.toDistribSMul.{u3, max u3 u2} R (FreeAlgebra.{u3, u2} R _inst_1 X) (MonoidWithZero.toMonoid.{u3} R (Semiring.toMonoidWithZero.{u3} R (CommSemiring.toSemiring.{u3} R _inst_1))) (AddCommMonoid.toAddMonoid.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (NonUnitalNonAssocSemiring.toAddCommMonoid.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (Semiring.toNonAssocSemiring.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (FreeAlgebra.instSemiringFreeAlgebra.{u3, u2} R _inst_1 X))))) (Module.toDistribMulAction.{u3, max u3 u2} R (FreeAlgebra.{u3, u2} R _inst_1 X) (CommSemiring.toSemiring.{u3} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (Semiring.toNonAssocSemiring.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (FreeAlgebra.instSemiringFreeAlgebra.{u3, u2} R _inst_1 X)))) (Algebra.toModule.{u3, max u3 u2} R (FreeAlgebra.{u3, u2} R _inst_1 X) _inst_1 (FreeAlgebra.instSemiringFreeAlgebra.{u3, u2} R _inst_1 X) (FreeAlgebra.instAlgebraFreeAlgebraInstSemiringFreeAlgebra.{u3, u2} R _inst_1 X)))))) (SMulZeroClass.toSMul.{u3, u1} R A (AddMonoid.toZero.{u1} A (AddCommMonoid.toAddMonoid.{u1} A (NonUnitalNonAssocSemiring.toAddCommMonoid.{u1} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} A (Semiring.toNonAssocSemiring.{u1} A _inst_2))))) (DistribSMul.toSMulZeroClass.{u3, u1} R A (AddMonoid.toAddZeroClass.{u1} A (AddCommMonoid.toAddMonoid.{u1} A (NonUnitalNonAssocSemiring.toAddCommMonoid.{u1} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} A (Semiring.toNonAssocSemiring.{u1} A _inst_2))))) (DistribMulAction.toDistribSMul.{u3, u1} R A (MonoidWithZero.toMonoid.{u3} R (Semiring.toMonoidWithZero.{u3} R (CommSemiring.toSemiring.{u3} R _inst_1))) (AddCommMonoid.toAddMonoid.{u1} A (NonUnitalNonAssocSemiring.toAddCommMonoid.{u1} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} A (Semiring.toNonAssocSemiring.{u1} A _inst_2)))) (Module.toDistribMulAction.{u3, u1} R A (CommSemiring.toSemiring.{u3} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u1} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} A (Semiring.toNonAssocSemiring.{u1} A _inst_2))) (Algebra.toModule.{u3, u1} R A _inst_1 _inst_2 _inst_3))))) (DistribMulActionHomClass.toSMulHomClass.{max (max u3 u2) u1, u3, max u3 u2, u1} (AlgHom.{u3, max u2 u3, u1} R (FreeAlgebra.{u3, u2} R _inst_1 X) A _inst_1 (FreeAlgebra.instSemiringFreeAlgebra.{u3, u2} R _inst_1 X) _inst_2 (FreeAlgebra.instAlgebraFreeAlgebraInstSemiringFreeAlgebra.{u3, u2} R _inst_1 X) _inst_3) R (FreeAlgebra.{u3, u2} R _inst_1 X) A (MonoidWithZero.toMonoid.{u3} R (Semiring.toMonoidWithZero.{u3} R (CommSemiring.toSemiring.{u3} R _inst_1))) (AddCommMonoid.toAddMonoid.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (NonUnitalNonAssocSemiring.toAddCommMonoid.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (Semiring.toNonAssocSemiring.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (FreeAlgebra.instSemiringFreeAlgebra.{u3, u2} R _inst_1 X))))) (AddCommMonoid.toAddMonoid.{u1} A (NonUnitalNonAssocSemiring.toAddCommMonoid.{u1} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} A (Semiring.toNonAssocSemiring.{u1} A _inst_2)))) (Module.toDistribMulAction.{u3, max u3 u2} R (FreeAlgebra.{u3, u2} R _inst_1 X) (CommSemiring.toSemiring.{u3} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (Semiring.toNonAssocSemiring.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (FreeAlgebra.instSemiringFreeAlgebra.{u3, u2} R _inst_1 X)))) (Algebra.toModule.{u3, max u3 u2} R (FreeAlgebra.{u3, u2} R _inst_1 X) _inst_1 (FreeAlgebra.instSemiringFreeAlgebra.{u3, u2} R _inst_1 X) (FreeAlgebra.instAlgebraFreeAlgebraInstSemiringFreeAlgebra.{u3, u2} R _inst_1 X))) (Module.toDistribMulAction.{u3, u1} R A (CommSemiring.toSemiring.{u3} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u1} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} A (Semiring.toNonAssocSemiring.{u1} A _inst_2))) (Algebra.toModule.{u3, u1} R A _inst_1 _inst_2 _inst_3)) (NonUnitalAlgHomClass.toDistribMulActionHomClass.{max (max u3 u2) u1, u3, max u3 u2, u1} (AlgHom.{u3, max u2 u3, u1} R (FreeAlgebra.{u3, u2} R _inst_1 X) A _inst_1 (FreeAlgebra.instSemiringFreeAlgebra.{u3, u2} R _inst_1 X) _inst_2 (FreeAlgebra.instAlgebraFreeAlgebraInstSemiringFreeAlgebra.{u3, u2} R _inst_1 X) _inst_3) R (FreeAlgebra.{u3, u2} R _inst_1 X) A (MonoidWithZero.toMonoid.{u3} R (Semiring.toMonoidWithZero.{u3} R (CommSemiring.toSemiring.{u3} R _inst_1))) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (Semiring.toNonAssocSemiring.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (FreeAlgebra.instSemiringFreeAlgebra.{u3, u2} R _inst_1 X))) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} A (Semiring.toNonAssocSemiring.{u1} A _inst_2)) (Module.toDistribMulAction.{u3, max u3 u2} R (FreeAlgebra.{u3, u2} R _inst_1 X) (CommSemiring.toSemiring.{u3} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (Semiring.toNonAssocSemiring.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (FreeAlgebra.instSemiringFreeAlgebra.{u3, u2} R _inst_1 X)))) (Algebra.toModule.{u3, max u3 u2} R (FreeAlgebra.{u3, u2} R _inst_1 X) _inst_1 (FreeAlgebra.instSemiringFreeAlgebra.{u3, u2} R _inst_1 X) (FreeAlgebra.instAlgebraFreeAlgebraInstSemiringFreeAlgebra.{u3, u2} R _inst_1 X))) (Module.toDistribMulAction.{u3, u1} R A (CommSemiring.toSemiring.{u3} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u1} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} A (Semiring.toNonAssocSemiring.{u1} A _inst_2))) (Algebra.toModule.{u3, u1} R A _inst_1 _inst_2 _inst_3)) (AlgHom.instNonUnitalAlgHomClassToMonoidToMonoidWithZeroToSemiringToNonUnitalNonAssocSemiringToNonAssocSemiringToNonUnitalNonAssocSemiringToNonAssocSemiringToDistribMulActionToAddCommMonoidToModuleToDistribMulActionToAddCommMonoidToModule.{u3, max u3 u2, u1, max (max u3 u2) u1} R (FreeAlgebra.{u3, u2} R _inst_1 X) A _inst_1 (FreeAlgebra.instSemiringFreeAlgebra.{u3, u2} R _inst_1 X) _inst_2 (FreeAlgebra.instAlgebraFreeAlgebraInstSemiringFreeAlgebra.{u3, u2} R _inst_1 X) _inst_3 (AlgHom.{u3, max u2 u3, u1} R (FreeAlgebra.{u3, u2} R _inst_1 X) A _inst_1 (FreeAlgebra.instSemiringFreeAlgebra.{u3, u2} R _inst_1 X) _inst_2 (FreeAlgebra.instAlgebraFreeAlgebraInstSemiringFreeAlgebra.{u3, u2} R _inst_1 X) _inst_3) (AlgHom.algHomClass.{u3, max u3 u2, u1} R (FreeAlgebra.{u3, u2} R _inst_1 X) A _inst_1 (FreeAlgebra.instSemiringFreeAlgebra.{u3, u2} R _inst_1 X) _inst_2 (FreeAlgebra.instAlgebraFreeAlgebraInstSemiringFreeAlgebra.{u3, u2} R _inst_1 X) _inst_3))))) F) (FreeAlgebra.ι.{u3, u2} R _inst_1 X))
Case conversion may be inaccurate. Consider using '#align free_algebra.lift_symm_apply FreeAlgebra.lift_symm_applyₓ'. -/
@[simp]
theorem lift_symm_apply (F : FreeAlgebra R X →ₐ[R] A) : (lift R).symm F = F ∘ ι R :=
  by
  rw [lift]
  rfl
#align free_algebra.lift_symm_apply FreeAlgebra.lift_symm_apply

variable {R X}

/- warning: free_algebra.ι_comp_lift -> FreeAlgebra.ι_comp_lift is a dubious translation:
lean 3 declaration is
  forall {R : Type.{u1}} [_inst_1 : CommSemiring.{u1} R] {X : Type.{u2}} {A : Type.{u3}} [_inst_2 : Semiring.{u3} A] [_inst_3 : Algebra.{u1, u3} R A _inst_1 _inst_2] (f : X -> A), Eq.{max (succ u2) (succ u3)} (X -> A) (Function.comp.{succ u2, max (succ u1) (succ u2), succ u3} X (FreeAlgebra.{u1, u2} R _inst_1 X) A (coeFn.{max (succ (max u1 u2)) (succ u3), max (succ (max u1 u2)) (succ u3)} (AlgHom.{u1, max u1 u2, u3} R (FreeAlgebra.{u1, u2} R _inst_1 X) A _inst_1 (FreeAlgebra.semiring.{u1, u2} R _inst_1 X) _inst_2 (FreeAlgebra.algebra.{u1, u2} R _inst_1 X) _inst_3) (fun (_x : AlgHom.{u1, max u1 u2, u3} R (FreeAlgebra.{u1, u2} R _inst_1 X) A _inst_1 (FreeAlgebra.semiring.{u1, u2} R _inst_1 X) _inst_2 (FreeAlgebra.algebra.{u1, u2} R _inst_1 X) _inst_3) => (FreeAlgebra.{u1, u2} R _inst_1 X) -> A) ([anonymous].{u1, max u1 u2, u3} R (FreeAlgebra.{u1, u2} R _inst_1 X) A _inst_1 (FreeAlgebra.semiring.{u1, u2} R _inst_1 X) _inst_2 (FreeAlgebra.algebra.{u1, u2} R _inst_1 X) _inst_3) (coeFn.{max 1 (max (max (succ u2) (succ u3)) (succ (max u1 u2)) (succ u3)) (max (succ (max u1 u2)) (succ u3)) (succ u2) (succ u3), max (max (succ u2) (succ u3)) (succ (max u1 u2)) (succ u3)} (Equiv.{max (succ u2) (succ u3), max (succ (max u1 u2)) (succ u3)} (X -> A) (AlgHom.{u1, max u1 u2, u3} R (FreeAlgebra.{u1, u2} R _inst_1 X) A _inst_1 (FreeAlgebra.semiring.{u1, u2} R _inst_1 X) _inst_2 (FreeAlgebra.algebra.{u1, u2} R _inst_1 X) _inst_3)) (fun (_x : Equiv.{max (succ u2) (succ u3), max (succ (max u1 u2)) (succ u3)} (X -> A) (AlgHom.{u1, max u1 u2, u3} R (FreeAlgebra.{u1, u2} R _inst_1 X) A _inst_1 (FreeAlgebra.semiring.{u1, u2} R _inst_1 X) _inst_2 (FreeAlgebra.algebra.{u1, u2} R _inst_1 X) _inst_3)) => (X -> A) -> (AlgHom.{u1, max u1 u2, u3} R (FreeAlgebra.{u1, u2} R _inst_1 X) A _inst_1 (FreeAlgebra.semiring.{u1, u2} R _inst_1 X) _inst_2 (FreeAlgebra.algebra.{u1, u2} R _inst_1 X) _inst_3)) (Equiv.hasCoeToFun.{max (succ u2) (succ u3), max (succ (max u1 u2)) (succ u3)} (X -> A) (AlgHom.{u1, max u1 u2, u3} R (FreeAlgebra.{u1, u2} R _inst_1 X) A _inst_1 (FreeAlgebra.semiring.{u1, u2} R _inst_1 X) _inst_2 (FreeAlgebra.algebra.{u1, u2} R _inst_1 X) _inst_3)) (FreeAlgebra.lift.{u1, u2, u3} R _inst_1 X A _inst_2 _inst_3) f)) (FreeAlgebra.ι.{u1, u2} R _inst_1 X)) f
but is expected to have type
  forall {R : Type.{u1}} [_inst_1 : CommSemiring.{u1} R] {X : Type.{u3}} {A : Type.{u2}} [_inst_2 : Semiring.{u2} A] [_inst_3 : Algebra.{u1, u2} R A _inst_1 _inst_2] (f : X -> A), Eq.{max (succ u3) (succ u2)} (X -> A) (Function.comp.{succ u3, max (succ u1) (succ u3), succ u2} X (FreeAlgebra.{u1, u3} R _inst_1 X) A (FunLike.coe.{max (max (succ u1) (succ u3)) (succ u2), max (succ u1) (succ u3), succ u2} ((fun (x._@.Mathlib.Logic.Equiv.Defs._hyg.808 : X -> A) => AlgHom.{u1, max u3 u1, u2} R (FreeAlgebra.{u1, u3} R _inst_1 X) A _inst_1 (FreeAlgebra.instSemiringFreeAlgebra.{u1, u3} R _inst_1 X) _inst_2 (FreeAlgebra.instAlgebraFreeAlgebraInstSemiringFreeAlgebra.{u1, u3} R _inst_1 X) _inst_3) f) (FreeAlgebra.{u1, u3} R _inst_1 X) (fun (_x : FreeAlgebra.{u1, u3} R _inst_1 X) => (fun (x._@.Mathlib.Algebra.Hom.GroupAction._hyg.2186 : FreeAlgebra.{u1, u3} R _inst_1 X) => A) _x) (SMulHomClass.toFunLike.{max (max u1 u3) u2, u1, max u1 u3, u2} ((fun (x._@.Mathlib.Logic.Equiv.Defs._hyg.808 : X -> A) => AlgHom.{u1, max u3 u1, u2} R (FreeAlgebra.{u1, u3} R _inst_1 X) A _inst_1 (FreeAlgebra.instSemiringFreeAlgebra.{u1, u3} R _inst_1 X) _inst_2 (FreeAlgebra.instAlgebraFreeAlgebraInstSemiringFreeAlgebra.{u1, u3} R _inst_1 X) _inst_3) f) R (FreeAlgebra.{u1, u3} R _inst_1 X) A (SMulZeroClass.toSMul.{u1, max u1 u3} R (FreeAlgebra.{u1, u3} R _inst_1 X) (AddMonoid.toZero.{max u1 u3} (FreeAlgebra.{u1, u3} R _inst_1 X) (AddCommMonoid.toAddMonoid.{max u1 u3} (FreeAlgebra.{u1, u3} R _inst_1 X) (NonUnitalNonAssocSemiring.toAddCommMonoid.{max u1 u3} (FreeAlgebra.{u1, u3} R _inst_1 X) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{max u1 u3} (FreeAlgebra.{u1, u3} R _inst_1 X) (Semiring.toNonAssocSemiring.{max u1 u3} (FreeAlgebra.{u1, u3} R _inst_1 X) (FreeAlgebra.instSemiringFreeAlgebra.{u1, u3} R _inst_1 X)))))) (DistribSMul.toSMulZeroClass.{u1, max u1 u3} R (FreeAlgebra.{u1, u3} R _inst_1 X) (AddMonoid.toAddZeroClass.{max u1 u3} (FreeAlgebra.{u1, u3} R _inst_1 X) (AddCommMonoid.toAddMonoid.{max u1 u3} (FreeAlgebra.{u1, u3} R _inst_1 X) (NonUnitalNonAssocSemiring.toAddCommMonoid.{max u1 u3} (FreeAlgebra.{u1, u3} R _inst_1 X) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{max u1 u3} (FreeAlgebra.{u1, u3} R _inst_1 X) (Semiring.toNonAssocSemiring.{max u1 u3} (FreeAlgebra.{u1, u3} R _inst_1 X) (FreeAlgebra.instSemiringFreeAlgebra.{u1, u3} R _inst_1 X)))))) (DistribMulAction.toDistribSMul.{u1, max u1 u3} R (FreeAlgebra.{u1, u3} R _inst_1 X) (MonoidWithZero.toMonoid.{u1} R (Semiring.toMonoidWithZero.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1))) (AddCommMonoid.toAddMonoid.{max u1 u3} (FreeAlgebra.{u1, u3} R _inst_1 X) (NonUnitalNonAssocSemiring.toAddCommMonoid.{max u1 u3} (FreeAlgebra.{u1, u3} R _inst_1 X) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{max u1 u3} (FreeAlgebra.{u1, u3} R _inst_1 X) (Semiring.toNonAssocSemiring.{max u1 u3} (FreeAlgebra.{u1, u3} R _inst_1 X) (FreeAlgebra.instSemiringFreeAlgebra.{u1, u3} R _inst_1 X))))) (Module.toDistribMulAction.{u1, max u1 u3} R (FreeAlgebra.{u1, u3} R _inst_1 X) (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{max u1 u3} (FreeAlgebra.{u1, u3} R _inst_1 X) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{max u1 u3} (FreeAlgebra.{u1, u3} R _inst_1 X) (Semiring.toNonAssocSemiring.{max u1 u3} (FreeAlgebra.{u1, u3} R _inst_1 X) (FreeAlgebra.instSemiringFreeAlgebra.{u1, u3} R _inst_1 X)))) (Algebra.toModule.{u1, max u1 u3} R (FreeAlgebra.{u1, u3} R _inst_1 X) _inst_1 (FreeAlgebra.instSemiringFreeAlgebra.{u1, u3} R _inst_1 X) (FreeAlgebra.instAlgebraFreeAlgebraInstSemiringFreeAlgebra.{u1, u3} R _inst_1 X)))))) (SMulZeroClass.toSMul.{u1, u2} R A (AddMonoid.toZero.{u2} A (AddCommMonoid.toAddMonoid.{u2} A (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))))) (DistribSMul.toSMulZeroClass.{u1, u2} R A (AddMonoid.toAddZeroClass.{u2} A (AddCommMonoid.toAddMonoid.{u2} A (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))))) (DistribMulAction.toDistribSMul.{u1, u2} R A (MonoidWithZero.toMonoid.{u1} R (Semiring.toMonoidWithZero.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1))) (AddCommMonoid.toAddMonoid.{u2} A (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2)))) (Module.toDistribMulAction.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_3))))) (DistribMulActionHomClass.toSMulHomClass.{max (max u1 u3) u2, u1, max u1 u3, u2} ((fun (x._@.Mathlib.Logic.Equiv.Defs._hyg.808 : X -> A) => AlgHom.{u1, max u3 u1, u2} R (FreeAlgebra.{u1, u3} R _inst_1 X) A _inst_1 (FreeAlgebra.instSemiringFreeAlgebra.{u1, u3} R _inst_1 X) _inst_2 (FreeAlgebra.instAlgebraFreeAlgebraInstSemiringFreeAlgebra.{u1, u3} R _inst_1 X) _inst_3) f) R (FreeAlgebra.{u1, u3} R _inst_1 X) A (MonoidWithZero.toMonoid.{u1} R (Semiring.toMonoidWithZero.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1))) (AddCommMonoid.toAddMonoid.{max u1 u3} (FreeAlgebra.{u1, u3} R _inst_1 X) (NonUnitalNonAssocSemiring.toAddCommMonoid.{max u1 u3} (FreeAlgebra.{u1, u3} R _inst_1 X) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{max u1 u3} (FreeAlgebra.{u1, u3} R _inst_1 X) (Semiring.toNonAssocSemiring.{max u1 u3} (FreeAlgebra.{u1, u3} R _inst_1 X) (FreeAlgebra.instSemiringFreeAlgebra.{u1, u3} R _inst_1 X))))) (AddCommMonoid.toAddMonoid.{u2} A (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2)))) (Module.toDistribMulAction.{u1, max u1 u3} R (FreeAlgebra.{u1, u3} R _inst_1 X) (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{max u1 u3} (FreeAlgebra.{u1, u3} R _inst_1 X) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{max u1 u3} (FreeAlgebra.{u1, u3} R _inst_1 X) (Semiring.toNonAssocSemiring.{max u1 u3} (FreeAlgebra.{u1, u3} R _inst_1 X) (FreeAlgebra.instSemiringFreeAlgebra.{u1, u3} R _inst_1 X)))) (Algebra.toModule.{u1, max u1 u3} R (FreeAlgebra.{u1, u3} R _inst_1 X) _inst_1 (FreeAlgebra.instSemiringFreeAlgebra.{u1, u3} R _inst_1 X) (FreeAlgebra.instAlgebraFreeAlgebraInstSemiringFreeAlgebra.{u1, u3} R _inst_1 X))) (Module.toDistribMulAction.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_3)) (NonUnitalAlgHomClass.toDistribMulActionHomClass.{max (max u1 u3) u2, u1, max u1 u3, u2} ((fun (x._@.Mathlib.Logic.Equiv.Defs._hyg.808 : X -> A) => AlgHom.{u1, max u3 u1, u2} R (FreeAlgebra.{u1, u3} R _inst_1 X) A _inst_1 (FreeAlgebra.instSemiringFreeAlgebra.{u1, u3} R _inst_1 X) _inst_2 (FreeAlgebra.instAlgebraFreeAlgebraInstSemiringFreeAlgebra.{u1, u3} R _inst_1 X) _inst_3) f) R (FreeAlgebra.{u1, u3} R _inst_1 X) A (MonoidWithZero.toMonoid.{u1} R (Semiring.toMonoidWithZero.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1))) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{max u1 u3} (FreeAlgebra.{u1, u3} R _inst_1 X) (Semiring.toNonAssocSemiring.{max u1 u3} (FreeAlgebra.{u1, u3} R _inst_1 X) (FreeAlgebra.instSemiringFreeAlgebra.{u1, u3} R _inst_1 X))) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2)) (Module.toDistribMulAction.{u1, max u1 u3} R (FreeAlgebra.{u1, u3} R _inst_1 X) (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{max u1 u3} (FreeAlgebra.{u1, u3} R _inst_1 X) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{max u1 u3} (FreeAlgebra.{u1, u3} R _inst_1 X) (Semiring.toNonAssocSemiring.{max u1 u3} (FreeAlgebra.{u1, u3} R _inst_1 X) (FreeAlgebra.instSemiringFreeAlgebra.{u1, u3} R _inst_1 X)))) (Algebra.toModule.{u1, max u1 u3} R (FreeAlgebra.{u1, u3} R _inst_1 X) _inst_1 (FreeAlgebra.instSemiringFreeAlgebra.{u1, u3} R _inst_1 X) (FreeAlgebra.instAlgebraFreeAlgebraInstSemiringFreeAlgebra.{u1, u3} R _inst_1 X))) (Module.toDistribMulAction.{u1, u2} R A (CommSemiring.toSemiring.{u1} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} A (Semiring.toNonAssocSemiring.{u2} A _inst_2))) (Algebra.toModule.{u1, u2} R A _inst_1 _inst_2 _inst_3)) (AlgHom.instNonUnitalAlgHomClassToMonoidToMonoidWithZeroToSemiringToNonUnitalNonAssocSemiringToNonAssocSemiringToNonUnitalNonAssocSemiringToNonAssocSemiringToDistribMulActionToAddCommMonoidToModuleToDistribMulActionToAddCommMonoidToModule.{u1, max u1 u3, u2, max (max u1 u3) u2} R (FreeAlgebra.{u1, u3} R _inst_1 X) A _inst_1 (FreeAlgebra.instSemiringFreeAlgebra.{u1, u3} R _inst_1 X) _inst_2 (FreeAlgebra.instAlgebraFreeAlgebraInstSemiringFreeAlgebra.{u1, u3} R _inst_1 X) _inst_3 ((fun (x._@.Mathlib.Logic.Equiv.Defs._hyg.808 : X -> A) => AlgHom.{u1, max u3 u1, u2} R (FreeAlgebra.{u1, u3} R _inst_1 X) A _inst_1 (FreeAlgebra.instSemiringFreeAlgebra.{u1, u3} R _inst_1 X) _inst_2 (FreeAlgebra.instAlgebraFreeAlgebraInstSemiringFreeAlgebra.{u1, u3} R _inst_1 X) _inst_3) f) (AlgHom.algHomClass.{u1, max u1 u3, u2} R (FreeAlgebra.{u1, u3} R _inst_1 X) A _inst_1 (FreeAlgebra.instSemiringFreeAlgebra.{u1, u3} R _inst_1 X) _inst_2 (FreeAlgebra.instAlgebraFreeAlgebraInstSemiringFreeAlgebra.{u1, u3} R _inst_1 X) _inst_3))))) (FunLike.coe.{max (max (succ u1) (succ u2)) (succ u3), max (succ u2) (succ u3), max (max (succ u1) (succ u2)) (succ u3)} (Equiv.{max (succ u3) (succ u2), max (succ u2) (succ (max u3 u1))} (X -> A) (AlgHom.{u1, max u3 u1, u2} R (FreeAlgebra.{u1, u3} R _inst_1 X) A _inst_1 (FreeAlgebra.instSemiringFreeAlgebra.{u1, u3} R _inst_1 X) _inst_2 (FreeAlgebra.instAlgebraFreeAlgebraInstSemiringFreeAlgebra.{u1, u3} R _inst_1 X) _inst_3)) (X -> A) (fun (_x : X -> A) => (fun (x._@.Mathlib.Logic.Equiv.Defs._hyg.808 : X -> A) => AlgHom.{u1, max u3 u1, u2} R (FreeAlgebra.{u1, u3} R _inst_1 X) A _inst_1 (FreeAlgebra.instSemiringFreeAlgebra.{u1, u3} R _inst_1 X) _inst_2 (FreeAlgebra.instAlgebraFreeAlgebraInstSemiringFreeAlgebra.{u1, u3} R _inst_1 X) _inst_3) _x) (Equiv.instFunLikeEquiv.{max (succ u2) (succ u3), max (max (succ u1) (succ u2)) (succ u3)} (X -> A) (AlgHom.{u1, max u3 u1, u2} R (FreeAlgebra.{u1, u3} R _inst_1 X) A _inst_1 (FreeAlgebra.instSemiringFreeAlgebra.{u1, u3} R _inst_1 X) _inst_2 (FreeAlgebra.instAlgebraFreeAlgebraInstSemiringFreeAlgebra.{u1, u3} R _inst_1 X) _inst_3)) (FreeAlgebra.lift.{u1, u3, u2} R _inst_1 X A _inst_2 _inst_3) f)) (FreeAlgebra.ι.{u1, u3} R _inst_1 X)) f
Case conversion may be inaccurate. Consider using '#align free_algebra.ι_comp_lift FreeAlgebra.ι_comp_liftₓ'. -/
@[simp]
theorem ι_comp_lift (f : X → A) : (lift R f : FreeAlgebra R X → A) ∘ ι R = f :=
  by
  ext
  rw [ι, lift]
  rfl
#align free_algebra.ι_comp_lift FreeAlgebra.ι_comp_lift

/- warning: free_algebra.lift_ι_apply -> FreeAlgebra.lift_ι_apply is a dubious translation:
lean 3 declaration is
  forall {R : Type.{u1}} [_inst_1 : CommSemiring.{u1} R] {X : Type.{u2}} {A : Type.{u3}} [_inst_2 : Semiring.{u3} A] [_inst_3 : Algebra.{u1, u3} R A _inst_1 _inst_2] (f : X -> A) (x : X), Eq.{succ u3} A (coeFn.{max (succ (max u1 u2)) (succ u3), max (succ (max u1 u2)) (succ u3)} (AlgHom.{u1, max u1 u2, u3} R (FreeAlgebra.{u1, u2} R _inst_1 X) A _inst_1 (FreeAlgebra.semiring.{u1, u2} R _inst_1 X) _inst_2 (FreeAlgebra.algebra.{u1, u2} R _inst_1 X) _inst_3) (fun (_x : AlgHom.{u1, max u1 u2, u3} R (FreeAlgebra.{u1, u2} R _inst_1 X) A _inst_1 (FreeAlgebra.semiring.{u1, u2} R _inst_1 X) _inst_2 (FreeAlgebra.algebra.{u1, u2} R _inst_1 X) _inst_3) => (FreeAlgebra.{u1, u2} R _inst_1 X) -> A) ([anonymous].{u1, max u1 u2, u3} R (FreeAlgebra.{u1, u2} R _inst_1 X) A _inst_1 (FreeAlgebra.semiring.{u1, u2} R _inst_1 X) _inst_2 (FreeAlgebra.algebra.{u1, u2} R _inst_1 X) _inst_3) (coeFn.{max 1 (max (max (succ u2) (succ u3)) (succ (max u1 u2)) (succ u3)) (max (succ (max u1 u2)) (succ u3)) (succ u2) (succ u3), max (max (succ u2) (succ u3)) (succ (max u1 u2)) (succ u3)} (Equiv.{max (succ u2) (succ u3), max (succ (max u1 u2)) (succ u3)} (X -> A) (AlgHom.{u1, max u1 u2, u3} R (FreeAlgebra.{u1, u2} R _inst_1 X) A _inst_1 (FreeAlgebra.semiring.{u1, u2} R _inst_1 X) _inst_2 (FreeAlgebra.algebra.{u1, u2} R _inst_1 X) _inst_3)) (fun (_x : Equiv.{max (succ u2) (succ u3), max (succ (max u1 u2)) (succ u3)} (X -> A) (AlgHom.{u1, max u1 u2, u3} R (FreeAlgebra.{u1, u2} R _inst_1 X) A _inst_1 (FreeAlgebra.semiring.{u1, u2} R _inst_1 X) _inst_2 (FreeAlgebra.algebra.{u1, u2} R _inst_1 X) _inst_3)) => (X -> A) -> (AlgHom.{u1, max u1 u2, u3} R (FreeAlgebra.{u1, u2} R _inst_1 X) A _inst_1 (FreeAlgebra.semiring.{u1, u2} R _inst_1 X) _inst_2 (FreeAlgebra.algebra.{u1, u2} R _inst_1 X) _inst_3)) (Equiv.hasCoeToFun.{max (succ u2) (succ u3), max (succ (max u1 u2)) (succ u3)} (X -> A) (AlgHom.{u1, max u1 u2, u3} R (FreeAlgebra.{u1, u2} R _inst_1 X) A _inst_1 (FreeAlgebra.semiring.{u1, u2} R _inst_1 X) _inst_2 (FreeAlgebra.algebra.{u1, u2} R _inst_1 X) _inst_3)) (FreeAlgebra.lift.{u1, u2, u3} R _inst_1 X A _inst_2 _inst_3) f) (FreeAlgebra.ι.{u1, u2} R _inst_1 X x)) (f x)
but is expected to have type
  forall {R : Type.{u2}} [_inst_1 : CommSemiring.{u2} R] {X : Type.{u1}} {A : Type.{u3}} [_inst_2 : Semiring.{u3} A] [_inst_3 : Algebra.{u2, u3} R A _inst_1 _inst_2] (f : X -> A) (x : X), Eq.{succ u3} ((fun (x._@.Mathlib.Algebra.Hom.GroupAction._hyg.2186 : FreeAlgebra.{u2, u1} R _inst_1 X) => A) (FreeAlgebra.ι.{u2, u1} R _inst_1 X x)) (FunLike.coe.{max (max (succ u2) (succ u1)) (succ u3), max (succ u2) (succ u1), succ u3} ((fun (x._@.Mathlib.Logic.Equiv.Defs._hyg.808 : X -> A) => AlgHom.{u2, max u1 u2, u3} R (FreeAlgebra.{u2, u1} R _inst_1 X) A _inst_1 (FreeAlgebra.instSemiringFreeAlgebra.{u2, u1} R _inst_1 X) _inst_2 (FreeAlgebra.instAlgebraFreeAlgebraInstSemiringFreeAlgebra.{u2, u1} R _inst_1 X) _inst_3) f) (FreeAlgebra.{u2, u1} R _inst_1 X) (fun (_x : FreeAlgebra.{u2, u1} R _inst_1 X) => (fun (x._@.Mathlib.Algebra.Hom.GroupAction._hyg.2186 : FreeAlgebra.{u2, u1} R _inst_1 X) => A) _x) (SMulHomClass.toFunLike.{max (max u2 u1) u3, u2, max u2 u1, u3} ((fun (x._@.Mathlib.Logic.Equiv.Defs._hyg.808 : X -> A) => AlgHom.{u2, max u1 u2, u3} R (FreeAlgebra.{u2, u1} R _inst_1 X) A _inst_1 (FreeAlgebra.instSemiringFreeAlgebra.{u2, u1} R _inst_1 X) _inst_2 (FreeAlgebra.instAlgebraFreeAlgebraInstSemiringFreeAlgebra.{u2, u1} R _inst_1 X) _inst_3) f) R (FreeAlgebra.{u2, u1} R _inst_1 X) A (SMulZeroClass.toSMul.{u2, max u2 u1} R (FreeAlgebra.{u2, u1} R _inst_1 X) (AddMonoid.toZero.{max u2 u1} (FreeAlgebra.{u2, u1} R _inst_1 X) (AddCommMonoid.toAddMonoid.{max u2 u1} (FreeAlgebra.{u2, u1} R _inst_1 X) (NonUnitalNonAssocSemiring.toAddCommMonoid.{max u2 u1} (FreeAlgebra.{u2, u1} R _inst_1 X) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{max u2 u1} (FreeAlgebra.{u2, u1} R _inst_1 X) (Semiring.toNonAssocSemiring.{max u2 u1} (FreeAlgebra.{u2, u1} R _inst_1 X) (FreeAlgebra.instSemiringFreeAlgebra.{u2, u1} R _inst_1 X)))))) (DistribSMul.toSMulZeroClass.{u2, max u2 u1} R (FreeAlgebra.{u2, u1} R _inst_1 X) (AddMonoid.toAddZeroClass.{max u2 u1} (FreeAlgebra.{u2, u1} R _inst_1 X) (AddCommMonoid.toAddMonoid.{max u2 u1} (FreeAlgebra.{u2, u1} R _inst_1 X) (NonUnitalNonAssocSemiring.toAddCommMonoid.{max u2 u1} (FreeAlgebra.{u2, u1} R _inst_1 X) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{max u2 u1} (FreeAlgebra.{u2, u1} R _inst_1 X) (Semiring.toNonAssocSemiring.{max u2 u1} (FreeAlgebra.{u2, u1} R _inst_1 X) (FreeAlgebra.instSemiringFreeAlgebra.{u2, u1} R _inst_1 X)))))) (DistribMulAction.toDistribSMul.{u2, max u2 u1} R (FreeAlgebra.{u2, u1} R _inst_1 X) (MonoidWithZero.toMonoid.{u2} R (Semiring.toMonoidWithZero.{u2} R (CommSemiring.toSemiring.{u2} R _inst_1))) (AddCommMonoid.toAddMonoid.{max u2 u1} (FreeAlgebra.{u2, u1} R _inst_1 X) (NonUnitalNonAssocSemiring.toAddCommMonoid.{max u2 u1} (FreeAlgebra.{u2, u1} R _inst_1 X) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{max u2 u1} (FreeAlgebra.{u2, u1} R _inst_1 X) (Semiring.toNonAssocSemiring.{max u2 u1} (FreeAlgebra.{u2, u1} R _inst_1 X) (FreeAlgebra.instSemiringFreeAlgebra.{u2, u1} R _inst_1 X))))) (Module.toDistribMulAction.{u2, max u2 u1} R (FreeAlgebra.{u2, u1} R _inst_1 X) (CommSemiring.toSemiring.{u2} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{max u2 u1} (FreeAlgebra.{u2, u1} R _inst_1 X) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{max u2 u1} (FreeAlgebra.{u2, u1} R _inst_1 X) (Semiring.toNonAssocSemiring.{max u2 u1} (FreeAlgebra.{u2, u1} R _inst_1 X) (FreeAlgebra.instSemiringFreeAlgebra.{u2, u1} R _inst_1 X)))) (Algebra.toModule.{u2, max u2 u1} R (FreeAlgebra.{u2, u1} R _inst_1 X) _inst_1 (FreeAlgebra.instSemiringFreeAlgebra.{u2, u1} R _inst_1 X) (FreeAlgebra.instAlgebraFreeAlgebraInstSemiringFreeAlgebra.{u2, u1} R _inst_1 X)))))) (SMulZeroClass.toSMul.{u2, u3} R A (AddMonoid.toZero.{u3} A (AddCommMonoid.toAddMonoid.{u3} A (NonUnitalNonAssocSemiring.toAddCommMonoid.{u3} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u3} A (Semiring.toNonAssocSemiring.{u3} A _inst_2))))) (DistribSMul.toSMulZeroClass.{u2, u3} R A (AddMonoid.toAddZeroClass.{u3} A (AddCommMonoid.toAddMonoid.{u3} A (NonUnitalNonAssocSemiring.toAddCommMonoid.{u3} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u3} A (Semiring.toNonAssocSemiring.{u3} A _inst_2))))) (DistribMulAction.toDistribSMul.{u2, u3} R A (MonoidWithZero.toMonoid.{u2} R (Semiring.toMonoidWithZero.{u2} R (CommSemiring.toSemiring.{u2} R _inst_1))) (AddCommMonoid.toAddMonoid.{u3} A (NonUnitalNonAssocSemiring.toAddCommMonoid.{u3} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u3} A (Semiring.toNonAssocSemiring.{u3} A _inst_2)))) (Module.toDistribMulAction.{u2, u3} R A (CommSemiring.toSemiring.{u2} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u3} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u3} A (Semiring.toNonAssocSemiring.{u3} A _inst_2))) (Algebra.toModule.{u2, u3} R A _inst_1 _inst_2 _inst_3))))) (DistribMulActionHomClass.toSMulHomClass.{max (max u2 u1) u3, u2, max u2 u1, u3} ((fun (x._@.Mathlib.Logic.Equiv.Defs._hyg.808 : X -> A) => AlgHom.{u2, max u1 u2, u3} R (FreeAlgebra.{u2, u1} R _inst_1 X) A _inst_1 (FreeAlgebra.instSemiringFreeAlgebra.{u2, u1} R _inst_1 X) _inst_2 (FreeAlgebra.instAlgebraFreeAlgebraInstSemiringFreeAlgebra.{u2, u1} R _inst_1 X) _inst_3) f) R (FreeAlgebra.{u2, u1} R _inst_1 X) A (MonoidWithZero.toMonoid.{u2} R (Semiring.toMonoidWithZero.{u2} R (CommSemiring.toSemiring.{u2} R _inst_1))) (AddCommMonoid.toAddMonoid.{max u2 u1} (FreeAlgebra.{u2, u1} R _inst_1 X) (NonUnitalNonAssocSemiring.toAddCommMonoid.{max u2 u1} (FreeAlgebra.{u2, u1} R _inst_1 X) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{max u2 u1} (FreeAlgebra.{u2, u1} R _inst_1 X) (Semiring.toNonAssocSemiring.{max u2 u1} (FreeAlgebra.{u2, u1} R _inst_1 X) (FreeAlgebra.instSemiringFreeAlgebra.{u2, u1} R _inst_1 X))))) (AddCommMonoid.toAddMonoid.{u3} A (NonUnitalNonAssocSemiring.toAddCommMonoid.{u3} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u3} A (Semiring.toNonAssocSemiring.{u3} A _inst_2)))) (Module.toDistribMulAction.{u2, max u2 u1} R (FreeAlgebra.{u2, u1} R _inst_1 X) (CommSemiring.toSemiring.{u2} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{max u2 u1} (FreeAlgebra.{u2, u1} R _inst_1 X) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{max u2 u1} (FreeAlgebra.{u2, u1} R _inst_1 X) (Semiring.toNonAssocSemiring.{max u2 u1} (FreeAlgebra.{u2, u1} R _inst_1 X) (FreeAlgebra.instSemiringFreeAlgebra.{u2, u1} R _inst_1 X)))) (Algebra.toModule.{u2, max u2 u1} R (FreeAlgebra.{u2, u1} R _inst_1 X) _inst_1 (FreeAlgebra.instSemiringFreeAlgebra.{u2, u1} R _inst_1 X) (FreeAlgebra.instAlgebraFreeAlgebraInstSemiringFreeAlgebra.{u2, u1} R _inst_1 X))) (Module.toDistribMulAction.{u2, u3} R A (CommSemiring.toSemiring.{u2} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u3} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u3} A (Semiring.toNonAssocSemiring.{u3} A _inst_2))) (Algebra.toModule.{u2, u3} R A _inst_1 _inst_2 _inst_3)) (NonUnitalAlgHomClass.toDistribMulActionHomClass.{max (max u2 u1) u3, u2, max u2 u1, u3} ((fun (x._@.Mathlib.Logic.Equiv.Defs._hyg.808 : X -> A) => AlgHom.{u2, max u1 u2, u3} R (FreeAlgebra.{u2, u1} R _inst_1 X) A _inst_1 (FreeAlgebra.instSemiringFreeAlgebra.{u2, u1} R _inst_1 X) _inst_2 (FreeAlgebra.instAlgebraFreeAlgebraInstSemiringFreeAlgebra.{u2, u1} R _inst_1 X) _inst_3) f) R (FreeAlgebra.{u2, u1} R _inst_1 X) A (MonoidWithZero.toMonoid.{u2} R (Semiring.toMonoidWithZero.{u2} R (CommSemiring.toSemiring.{u2} R _inst_1))) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{max u2 u1} (FreeAlgebra.{u2, u1} R _inst_1 X) (Semiring.toNonAssocSemiring.{max u2 u1} (FreeAlgebra.{u2, u1} R _inst_1 X) (FreeAlgebra.instSemiringFreeAlgebra.{u2, u1} R _inst_1 X))) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u3} A (Semiring.toNonAssocSemiring.{u3} A _inst_2)) (Module.toDistribMulAction.{u2, max u2 u1} R (FreeAlgebra.{u2, u1} R _inst_1 X) (CommSemiring.toSemiring.{u2} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{max u2 u1} (FreeAlgebra.{u2, u1} R _inst_1 X) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{max u2 u1} (FreeAlgebra.{u2, u1} R _inst_1 X) (Semiring.toNonAssocSemiring.{max u2 u1} (FreeAlgebra.{u2, u1} R _inst_1 X) (FreeAlgebra.instSemiringFreeAlgebra.{u2, u1} R _inst_1 X)))) (Algebra.toModule.{u2, max u2 u1} R (FreeAlgebra.{u2, u1} R _inst_1 X) _inst_1 (FreeAlgebra.instSemiringFreeAlgebra.{u2, u1} R _inst_1 X) (FreeAlgebra.instAlgebraFreeAlgebraInstSemiringFreeAlgebra.{u2, u1} R _inst_1 X))) (Module.toDistribMulAction.{u2, u3} R A (CommSemiring.toSemiring.{u2} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u3} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u3} A (Semiring.toNonAssocSemiring.{u3} A _inst_2))) (Algebra.toModule.{u2, u3} R A _inst_1 _inst_2 _inst_3)) (AlgHom.instNonUnitalAlgHomClassToMonoidToMonoidWithZeroToSemiringToNonUnitalNonAssocSemiringToNonAssocSemiringToNonUnitalNonAssocSemiringToNonAssocSemiringToDistribMulActionToAddCommMonoidToModuleToDistribMulActionToAddCommMonoidToModule.{u2, max u2 u1, u3, max (max u2 u1) u3} R (FreeAlgebra.{u2, u1} R _inst_1 X) A _inst_1 (FreeAlgebra.instSemiringFreeAlgebra.{u2, u1} R _inst_1 X) _inst_2 (FreeAlgebra.instAlgebraFreeAlgebraInstSemiringFreeAlgebra.{u2, u1} R _inst_1 X) _inst_3 ((fun (x._@.Mathlib.Logic.Equiv.Defs._hyg.808 : X -> A) => AlgHom.{u2, max u1 u2, u3} R (FreeAlgebra.{u2, u1} R _inst_1 X) A _inst_1 (FreeAlgebra.instSemiringFreeAlgebra.{u2, u1} R _inst_1 X) _inst_2 (FreeAlgebra.instAlgebraFreeAlgebraInstSemiringFreeAlgebra.{u2, u1} R _inst_1 X) _inst_3) f) (AlgHom.algHomClass.{u2, max u2 u1, u3} R (FreeAlgebra.{u2, u1} R _inst_1 X) A _inst_1 (FreeAlgebra.instSemiringFreeAlgebra.{u2, u1} R _inst_1 X) _inst_2 (FreeAlgebra.instAlgebraFreeAlgebraInstSemiringFreeAlgebra.{u2, u1} R _inst_1 X) _inst_3))))) (FunLike.coe.{max (max (succ u2) (succ u3)) (succ u1), max (succ u3) (succ u1), max (max (succ u2) (succ u3)) (succ u1)} (Equiv.{max (succ u1) (succ u3), max (succ u3) (succ (max u1 u2))} (X -> A) (AlgHom.{u2, max u1 u2, u3} R (FreeAlgebra.{u2, u1} R _inst_1 X) A _inst_1 (FreeAlgebra.instSemiringFreeAlgebra.{u2, u1} R _inst_1 X) _inst_2 (FreeAlgebra.instAlgebraFreeAlgebraInstSemiringFreeAlgebra.{u2, u1} R _inst_1 X) _inst_3)) (X -> A) (fun (_x : X -> A) => (fun (x._@.Mathlib.Logic.Equiv.Defs._hyg.808 : X -> A) => AlgHom.{u2, max u1 u2, u3} R (FreeAlgebra.{u2, u1} R _inst_1 X) A _inst_1 (FreeAlgebra.instSemiringFreeAlgebra.{u2, u1} R _inst_1 X) _inst_2 (FreeAlgebra.instAlgebraFreeAlgebraInstSemiringFreeAlgebra.{u2, u1} R _inst_1 X) _inst_3) _x) (Equiv.instFunLikeEquiv.{max (succ u3) (succ u1), max (max (succ u2) (succ u3)) (succ u1)} (X -> A) (AlgHom.{u2, max u1 u2, u3} R (FreeAlgebra.{u2, u1} R _inst_1 X) A _inst_1 (FreeAlgebra.instSemiringFreeAlgebra.{u2, u1} R _inst_1 X) _inst_2 (FreeAlgebra.instAlgebraFreeAlgebraInstSemiringFreeAlgebra.{u2, u1} R _inst_1 X) _inst_3)) (FreeAlgebra.lift.{u2, u1, u3} R _inst_1 X A _inst_2 _inst_3) f) (FreeAlgebra.ι.{u2, u1} R _inst_1 X x)) (f x)
Case conversion may be inaccurate. Consider using '#align free_algebra.lift_ι_apply FreeAlgebra.lift_ι_applyₓ'. -/
@[simp]
theorem lift_ι_apply (f : X → A) (x) : lift R f (ι R x) = f x :=
  by
  rw [ι, lift]
  rfl
#align free_algebra.lift_ι_apply FreeAlgebra.lift_ι_apply

/- warning: free_algebra.lift_unique -> FreeAlgebra.lift_unique is a dubious translation:
lean 3 declaration is
  forall {R : Type.{u1}} [_inst_1 : CommSemiring.{u1} R] {X : Type.{u2}} {A : Type.{u3}} [_inst_2 : Semiring.{u3} A] [_inst_3 : Algebra.{u1, u3} R A _inst_1 _inst_2] (f : X -> A) (g : AlgHom.{u1, max u1 u2, u3} R (FreeAlgebra.{u1, u2} R _inst_1 X) A _inst_1 (FreeAlgebra.semiring.{u1, u2} R _inst_1 X) _inst_2 (FreeAlgebra.algebra.{u1, u2} R _inst_1 X) _inst_3), Iff (Eq.{max (succ u2) (succ u3)} (X -> A) (Function.comp.{succ u2, max (succ u1) (succ u2), succ u3} X (FreeAlgebra.{u1, u2} R _inst_1 X) A (coeFn.{max (succ (max u1 u2)) (succ u3), max (succ (max u1 u2)) (succ u3)} (AlgHom.{u1, max u1 u2, u3} R (FreeAlgebra.{u1, u2} R _inst_1 X) A _inst_1 (FreeAlgebra.semiring.{u1, u2} R _inst_1 X) _inst_2 (FreeAlgebra.algebra.{u1, u2} R _inst_1 X) _inst_3) (fun (_x : AlgHom.{u1, max u1 u2, u3} R (FreeAlgebra.{u1, u2} R _inst_1 X) A _inst_1 (FreeAlgebra.semiring.{u1, u2} R _inst_1 X) _inst_2 (FreeAlgebra.algebra.{u1, u2} R _inst_1 X) _inst_3) => (FreeAlgebra.{u1, u2} R _inst_1 X) -> A) ([anonymous].{u1, max u1 u2, u3} R (FreeAlgebra.{u1, u2} R _inst_1 X) A _inst_1 (FreeAlgebra.semiring.{u1, u2} R _inst_1 X) _inst_2 (FreeAlgebra.algebra.{u1, u2} R _inst_1 X) _inst_3) g) (FreeAlgebra.ι.{u1, u2} R _inst_1 X)) f) (Eq.{max (succ (max u1 u2)) (succ u3)} (AlgHom.{u1, max u1 u2, u3} R (FreeAlgebra.{u1, u2} R _inst_1 X) A _inst_1 (FreeAlgebra.semiring.{u1, u2} R _inst_1 X) _inst_2 (FreeAlgebra.algebra.{u1, u2} R _inst_1 X) _inst_3) g (coeFn.{max 1 (max (max (succ u2) (succ u3)) (succ (max u1 u2)) (succ u3)) (max (succ (max u1 u2)) (succ u3)) (succ u2) (succ u3), max (max (succ u2) (succ u3)) (succ (max u1 u2)) (succ u3)} (Equiv.{max (succ u2) (succ u3), max (succ (max u1 u2)) (succ u3)} (X -> A) (AlgHom.{u1, max u1 u2, u3} R (FreeAlgebra.{u1, u2} R _inst_1 X) A _inst_1 (FreeAlgebra.semiring.{u1, u2} R _inst_1 X) _inst_2 (FreeAlgebra.algebra.{u1, u2} R _inst_1 X) _inst_3)) (fun (_x : Equiv.{max (succ u2) (succ u3), max (succ (max u1 u2)) (succ u3)} (X -> A) (AlgHom.{u1, max u1 u2, u3} R (FreeAlgebra.{u1, u2} R _inst_1 X) A _inst_1 (FreeAlgebra.semiring.{u1, u2} R _inst_1 X) _inst_2 (FreeAlgebra.algebra.{u1, u2} R _inst_1 X) _inst_3)) => (X -> A) -> (AlgHom.{u1, max u1 u2, u3} R (FreeAlgebra.{u1, u2} R _inst_1 X) A _inst_1 (FreeAlgebra.semiring.{u1, u2} R _inst_1 X) _inst_2 (FreeAlgebra.algebra.{u1, u2} R _inst_1 X) _inst_3)) (Equiv.hasCoeToFun.{max (succ u2) (succ u3), max (succ (max u1 u2)) (succ u3)} (X -> A) (AlgHom.{u1, max u1 u2, u3} R (FreeAlgebra.{u1, u2} R _inst_1 X) A _inst_1 (FreeAlgebra.semiring.{u1, u2} R _inst_1 X) _inst_2 (FreeAlgebra.algebra.{u1, u2} R _inst_1 X) _inst_3)) (FreeAlgebra.lift.{u1, u2, u3} R _inst_1 X A _inst_2 _inst_3) f))
but is expected to have type
  forall {R : Type.{u3}} [_inst_1 : CommSemiring.{u3} R] {X : Type.{u2}} {A : Type.{u1}} [_inst_2 : Semiring.{u1} A] [_inst_3 : Algebra.{u3, u1} R A _inst_1 _inst_2] (f : X -> A) (g : AlgHom.{u3, max u2 u3, u1} R (FreeAlgebra.{u3, u2} R _inst_1 X) A _inst_1 (FreeAlgebra.instSemiringFreeAlgebra.{u3, u2} R _inst_1 X) _inst_2 (FreeAlgebra.instAlgebraFreeAlgebraInstSemiringFreeAlgebra.{u3, u2} R _inst_1 X) _inst_3), Iff (Eq.{max (succ u2) (succ u1)} (X -> A) (Function.comp.{succ u2, max (succ u3) (succ u2), succ u1} X (FreeAlgebra.{u3, u2} R _inst_1 X) A (FunLike.coe.{max (max (succ u3) (succ u2)) (succ u1), max (succ u3) (succ u2), succ u1} (AlgHom.{u3, max u2 u3, u1} R (FreeAlgebra.{u3, u2} R _inst_1 X) A _inst_1 (FreeAlgebra.instSemiringFreeAlgebra.{u3, u2} R _inst_1 X) _inst_2 (FreeAlgebra.instAlgebraFreeAlgebraInstSemiringFreeAlgebra.{u3, u2} R _inst_1 X) _inst_3) (FreeAlgebra.{u3, u2} R _inst_1 X) (fun (_x : FreeAlgebra.{u3, u2} R _inst_1 X) => (fun (x._@.Mathlib.Algebra.Hom.GroupAction._hyg.2186 : FreeAlgebra.{u3, u2} R _inst_1 X) => A) _x) (SMulHomClass.toFunLike.{max (max u3 u2) u1, u3, max u3 u2, u1} (AlgHom.{u3, max u2 u3, u1} R (FreeAlgebra.{u3, u2} R _inst_1 X) A _inst_1 (FreeAlgebra.instSemiringFreeAlgebra.{u3, u2} R _inst_1 X) _inst_2 (FreeAlgebra.instAlgebraFreeAlgebraInstSemiringFreeAlgebra.{u3, u2} R _inst_1 X) _inst_3) R (FreeAlgebra.{u3, u2} R _inst_1 X) A (SMulZeroClass.toSMul.{u3, max u3 u2} R (FreeAlgebra.{u3, u2} R _inst_1 X) (AddMonoid.toZero.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (AddCommMonoid.toAddMonoid.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (NonUnitalNonAssocSemiring.toAddCommMonoid.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (Semiring.toNonAssocSemiring.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (FreeAlgebra.instSemiringFreeAlgebra.{u3, u2} R _inst_1 X)))))) (DistribSMul.toSMulZeroClass.{u3, max u3 u2} R (FreeAlgebra.{u3, u2} R _inst_1 X) (AddMonoid.toAddZeroClass.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (AddCommMonoid.toAddMonoid.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (NonUnitalNonAssocSemiring.toAddCommMonoid.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (Semiring.toNonAssocSemiring.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (FreeAlgebra.instSemiringFreeAlgebra.{u3, u2} R _inst_1 X)))))) (DistribMulAction.toDistribSMul.{u3, max u3 u2} R (FreeAlgebra.{u3, u2} R _inst_1 X) (MonoidWithZero.toMonoid.{u3} R (Semiring.toMonoidWithZero.{u3} R (CommSemiring.toSemiring.{u3} R _inst_1))) (AddCommMonoid.toAddMonoid.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (NonUnitalNonAssocSemiring.toAddCommMonoid.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (Semiring.toNonAssocSemiring.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (FreeAlgebra.instSemiringFreeAlgebra.{u3, u2} R _inst_1 X))))) (Module.toDistribMulAction.{u3, max u3 u2} R (FreeAlgebra.{u3, u2} R _inst_1 X) (CommSemiring.toSemiring.{u3} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (Semiring.toNonAssocSemiring.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (FreeAlgebra.instSemiringFreeAlgebra.{u3, u2} R _inst_1 X)))) (Algebra.toModule.{u3, max u3 u2} R (FreeAlgebra.{u3, u2} R _inst_1 X) _inst_1 (FreeAlgebra.instSemiringFreeAlgebra.{u3, u2} R _inst_1 X) (FreeAlgebra.instAlgebraFreeAlgebraInstSemiringFreeAlgebra.{u3, u2} R _inst_1 X)))))) (SMulZeroClass.toSMul.{u3, u1} R A (AddMonoid.toZero.{u1} A (AddCommMonoid.toAddMonoid.{u1} A (NonUnitalNonAssocSemiring.toAddCommMonoid.{u1} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} A (Semiring.toNonAssocSemiring.{u1} A _inst_2))))) (DistribSMul.toSMulZeroClass.{u3, u1} R A (AddMonoid.toAddZeroClass.{u1} A (AddCommMonoid.toAddMonoid.{u1} A (NonUnitalNonAssocSemiring.toAddCommMonoid.{u1} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} A (Semiring.toNonAssocSemiring.{u1} A _inst_2))))) (DistribMulAction.toDistribSMul.{u3, u1} R A (MonoidWithZero.toMonoid.{u3} R (Semiring.toMonoidWithZero.{u3} R (CommSemiring.toSemiring.{u3} R _inst_1))) (AddCommMonoid.toAddMonoid.{u1} A (NonUnitalNonAssocSemiring.toAddCommMonoid.{u1} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} A (Semiring.toNonAssocSemiring.{u1} A _inst_2)))) (Module.toDistribMulAction.{u3, u1} R A (CommSemiring.toSemiring.{u3} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u1} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} A (Semiring.toNonAssocSemiring.{u1} A _inst_2))) (Algebra.toModule.{u3, u1} R A _inst_1 _inst_2 _inst_3))))) (DistribMulActionHomClass.toSMulHomClass.{max (max u3 u2) u1, u3, max u3 u2, u1} (AlgHom.{u3, max u2 u3, u1} R (FreeAlgebra.{u3, u2} R _inst_1 X) A _inst_1 (FreeAlgebra.instSemiringFreeAlgebra.{u3, u2} R _inst_1 X) _inst_2 (FreeAlgebra.instAlgebraFreeAlgebraInstSemiringFreeAlgebra.{u3, u2} R _inst_1 X) _inst_3) R (FreeAlgebra.{u3, u2} R _inst_1 X) A (MonoidWithZero.toMonoid.{u3} R (Semiring.toMonoidWithZero.{u3} R (CommSemiring.toSemiring.{u3} R _inst_1))) (AddCommMonoid.toAddMonoid.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (NonUnitalNonAssocSemiring.toAddCommMonoid.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (Semiring.toNonAssocSemiring.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (FreeAlgebra.instSemiringFreeAlgebra.{u3, u2} R _inst_1 X))))) (AddCommMonoid.toAddMonoid.{u1} A (NonUnitalNonAssocSemiring.toAddCommMonoid.{u1} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} A (Semiring.toNonAssocSemiring.{u1} A _inst_2)))) (Module.toDistribMulAction.{u3, max u3 u2} R (FreeAlgebra.{u3, u2} R _inst_1 X) (CommSemiring.toSemiring.{u3} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (Semiring.toNonAssocSemiring.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (FreeAlgebra.instSemiringFreeAlgebra.{u3, u2} R _inst_1 X)))) (Algebra.toModule.{u3, max u3 u2} R (FreeAlgebra.{u3, u2} R _inst_1 X) _inst_1 (FreeAlgebra.instSemiringFreeAlgebra.{u3, u2} R _inst_1 X) (FreeAlgebra.instAlgebraFreeAlgebraInstSemiringFreeAlgebra.{u3, u2} R _inst_1 X))) (Module.toDistribMulAction.{u3, u1} R A (CommSemiring.toSemiring.{u3} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u1} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} A (Semiring.toNonAssocSemiring.{u1} A _inst_2))) (Algebra.toModule.{u3, u1} R A _inst_1 _inst_2 _inst_3)) (NonUnitalAlgHomClass.toDistribMulActionHomClass.{max (max u3 u2) u1, u3, max u3 u2, u1} (AlgHom.{u3, max u2 u3, u1} R (FreeAlgebra.{u3, u2} R _inst_1 X) A _inst_1 (FreeAlgebra.instSemiringFreeAlgebra.{u3, u2} R _inst_1 X) _inst_2 (FreeAlgebra.instAlgebraFreeAlgebraInstSemiringFreeAlgebra.{u3, u2} R _inst_1 X) _inst_3) R (FreeAlgebra.{u3, u2} R _inst_1 X) A (MonoidWithZero.toMonoid.{u3} R (Semiring.toMonoidWithZero.{u3} R (CommSemiring.toSemiring.{u3} R _inst_1))) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (Semiring.toNonAssocSemiring.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (FreeAlgebra.instSemiringFreeAlgebra.{u3, u2} R _inst_1 X))) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} A (Semiring.toNonAssocSemiring.{u1} A _inst_2)) (Module.toDistribMulAction.{u3, max u3 u2} R (FreeAlgebra.{u3, u2} R _inst_1 X) (CommSemiring.toSemiring.{u3} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (Semiring.toNonAssocSemiring.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (FreeAlgebra.instSemiringFreeAlgebra.{u3, u2} R _inst_1 X)))) (Algebra.toModule.{u3, max u3 u2} R (FreeAlgebra.{u3, u2} R _inst_1 X) _inst_1 (FreeAlgebra.instSemiringFreeAlgebra.{u3, u2} R _inst_1 X) (FreeAlgebra.instAlgebraFreeAlgebraInstSemiringFreeAlgebra.{u3, u2} R _inst_1 X))) (Module.toDistribMulAction.{u3, u1} R A (CommSemiring.toSemiring.{u3} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u1} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} A (Semiring.toNonAssocSemiring.{u1} A _inst_2))) (Algebra.toModule.{u3, u1} R A _inst_1 _inst_2 _inst_3)) (AlgHom.instNonUnitalAlgHomClassToMonoidToMonoidWithZeroToSemiringToNonUnitalNonAssocSemiringToNonAssocSemiringToNonUnitalNonAssocSemiringToNonAssocSemiringToDistribMulActionToAddCommMonoidToModuleToDistribMulActionToAddCommMonoidToModule.{u3, max u3 u2, u1, max (max u3 u2) u1} R (FreeAlgebra.{u3, u2} R _inst_1 X) A _inst_1 (FreeAlgebra.instSemiringFreeAlgebra.{u3, u2} R _inst_1 X) _inst_2 (FreeAlgebra.instAlgebraFreeAlgebraInstSemiringFreeAlgebra.{u3, u2} R _inst_1 X) _inst_3 (AlgHom.{u3, max u2 u3, u1} R (FreeAlgebra.{u3, u2} R _inst_1 X) A _inst_1 (FreeAlgebra.instSemiringFreeAlgebra.{u3, u2} R _inst_1 X) _inst_2 (FreeAlgebra.instAlgebraFreeAlgebraInstSemiringFreeAlgebra.{u3, u2} R _inst_1 X) _inst_3) (AlgHom.algHomClass.{u3, max u3 u2, u1} R (FreeAlgebra.{u3, u2} R _inst_1 X) A _inst_1 (FreeAlgebra.instSemiringFreeAlgebra.{u3, u2} R _inst_1 X) _inst_2 (FreeAlgebra.instAlgebraFreeAlgebraInstSemiringFreeAlgebra.{u3, u2} R _inst_1 X) _inst_3))))) g) (FreeAlgebra.ι.{u3, u2} R _inst_1 X)) f) (Eq.{max (max (succ u3) (succ u2)) (succ u1)} (AlgHom.{u3, max u2 u3, u1} R (FreeAlgebra.{u3, u2} R _inst_1 X) A _inst_1 (FreeAlgebra.instSemiringFreeAlgebra.{u3, u2} R _inst_1 X) _inst_2 (FreeAlgebra.instAlgebraFreeAlgebraInstSemiringFreeAlgebra.{u3, u2} R _inst_1 X) _inst_3) g (FunLike.coe.{max (max (succ u3) (succ u1)) (succ u2), max (succ u1) (succ u2), max (max (succ u3) (succ u1)) (succ u2)} (Equiv.{max (succ u2) (succ u1), max (succ u1) (succ (max u2 u3))} (X -> A) (AlgHom.{u3, max u2 u3, u1} R (FreeAlgebra.{u3, u2} R _inst_1 X) A _inst_1 (FreeAlgebra.instSemiringFreeAlgebra.{u3, u2} R _inst_1 X) _inst_2 (FreeAlgebra.instAlgebraFreeAlgebraInstSemiringFreeAlgebra.{u3, u2} R _inst_1 X) _inst_3)) (X -> A) (fun (_x : X -> A) => (fun (x._@.Mathlib.Logic.Equiv.Defs._hyg.808 : X -> A) => AlgHom.{u3, max u2 u3, u1} R (FreeAlgebra.{u3, u2} R _inst_1 X) A _inst_1 (FreeAlgebra.instSemiringFreeAlgebra.{u3, u2} R _inst_1 X) _inst_2 (FreeAlgebra.instAlgebraFreeAlgebraInstSemiringFreeAlgebra.{u3, u2} R _inst_1 X) _inst_3) _x) (Equiv.instFunLikeEquiv.{max (succ u1) (succ u2), max (max (succ u3) (succ u1)) (succ u2)} (X -> A) (AlgHom.{u3, max u2 u3, u1} R (FreeAlgebra.{u3, u2} R _inst_1 X) A _inst_1 (FreeAlgebra.instSemiringFreeAlgebra.{u3, u2} R _inst_1 X) _inst_2 (FreeAlgebra.instAlgebraFreeAlgebraInstSemiringFreeAlgebra.{u3, u2} R _inst_1 X) _inst_3)) (FreeAlgebra.lift.{u3, u2, u1} R _inst_1 X A _inst_2 _inst_3) f))
Case conversion may be inaccurate. Consider using '#align free_algebra.lift_unique FreeAlgebra.lift_uniqueₓ'. -/
@[simp]
theorem lift_unique (f : X → A) (g : FreeAlgebra R X →ₐ[R] A) :
    (g : FreeAlgebra R X → A) ∘ ι R = f ↔ g = lift R f :=
  by
  rw [← (lift R).symm_apply_eq, lift]
  rfl
#align free_algebra.lift_unique FreeAlgebra.lift_unique

/-!
Since we have set the basic definitions as `@[irreducible]`, from this point onwards one
should only use the universal properties of the free algebra, and consider the actual implementation
as a quotient of an inductive type as completely hidden. -/

/- warning: free_algebra.lift_comp_ι -> FreeAlgebra.lift_comp_ι is a dubious translation:
lean 3 declaration is
  forall {R : Type.{u1}} [_inst_1 : CommSemiring.{u1} R] {X : Type.{u2}} {A : Type.{u3}} [_inst_2 : Semiring.{u3} A] [_inst_3 : Algebra.{u1, u3} R A _inst_1 _inst_2] (g : AlgHom.{u1, max u1 u2, u3} R (FreeAlgebra.{u1, u2} R _inst_1 X) A _inst_1 (FreeAlgebra.semiring.{u1, u2} R _inst_1 X) _inst_2 (FreeAlgebra.algebra.{u1, u2} R _inst_1 X) _inst_3), Eq.{max (succ (max u1 u2)) (succ u3)} (AlgHom.{u1, max u1 u2, u3} R (FreeAlgebra.{u1, u2} R _inst_1 X) A _inst_1 (FreeAlgebra.semiring.{u1, u2} R _inst_1 X) _inst_2 (FreeAlgebra.algebra.{u1, u2} R _inst_1 X) _inst_3) (coeFn.{max 1 (max (max (succ u2) (succ u3)) (succ (max u1 u2)) (succ u3)) (max (succ (max u1 u2)) (succ u3)) (succ u2) (succ u3), max (max (succ u2) (succ u3)) (succ (max u1 u2)) (succ u3)} (Equiv.{max (succ u2) (succ u3), max (succ (max u1 u2)) (succ u3)} (X -> A) (AlgHom.{u1, max u1 u2, u3} R (FreeAlgebra.{u1, u2} R _inst_1 X) A _inst_1 (FreeAlgebra.semiring.{u1, u2} R _inst_1 X) _inst_2 (FreeAlgebra.algebra.{u1, u2} R _inst_1 X) _inst_3)) (fun (_x : Equiv.{max (succ u2) (succ u3), max (succ (max u1 u2)) (succ u3)} (X -> A) (AlgHom.{u1, max u1 u2, u3} R (FreeAlgebra.{u1, u2} R _inst_1 X) A _inst_1 (FreeAlgebra.semiring.{u1, u2} R _inst_1 X) _inst_2 (FreeAlgebra.algebra.{u1, u2} R _inst_1 X) _inst_3)) => (X -> A) -> (AlgHom.{u1, max u1 u2, u3} R (FreeAlgebra.{u1, u2} R _inst_1 X) A _inst_1 (FreeAlgebra.semiring.{u1, u2} R _inst_1 X) _inst_2 (FreeAlgebra.algebra.{u1, u2} R _inst_1 X) _inst_3)) (Equiv.hasCoeToFun.{max (succ u2) (succ u3), max (succ (max u1 u2)) (succ u3)} (X -> A) (AlgHom.{u1, max u1 u2, u3} R (FreeAlgebra.{u1, u2} R _inst_1 X) A _inst_1 (FreeAlgebra.semiring.{u1, u2} R _inst_1 X) _inst_2 (FreeAlgebra.algebra.{u1, u2} R _inst_1 X) _inst_3)) (FreeAlgebra.lift.{u1, u2, u3} R _inst_1 X A _inst_2 _inst_3) (Function.comp.{succ u2, max (succ u1) (succ u2), succ u3} X (FreeAlgebra.{u1, u2} R _inst_1 X) A (coeFn.{max (succ (max u1 u2)) (succ u3), max (succ (max u1 u2)) (succ u3)} (AlgHom.{u1, max u1 u2, u3} R (FreeAlgebra.{u1, u2} R _inst_1 X) A _inst_1 (FreeAlgebra.semiring.{u1, u2} R _inst_1 X) _inst_2 (FreeAlgebra.algebra.{u1, u2} R _inst_1 X) _inst_3) (fun (_x : AlgHom.{u1, max u1 u2, u3} R (FreeAlgebra.{u1, u2} R _inst_1 X) A _inst_1 (FreeAlgebra.semiring.{u1, u2} R _inst_1 X) _inst_2 (FreeAlgebra.algebra.{u1, u2} R _inst_1 X) _inst_3) => (FreeAlgebra.{u1, u2} R _inst_1 X) -> A) ([anonymous].{u1, max u1 u2, u3} R (FreeAlgebra.{u1, u2} R _inst_1 X) A _inst_1 (FreeAlgebra.semiring.{u1, u2} R _inst_1 X) _inst_2 (FreeAlgebra.algebra.{u1, u2} R _inst_1 X) _inst_3) g) (FreeAlgebra.ι.{u1, u2} R _inst_1 X))) g
but is expected to have type
  forall {R : Type.{u3}} [_inst_1 : CommSemiring.{u3} R] {X : Type.{u2}} {A : Type.{u1}} [_inst_2 : Semiring.{u1} A] [_inst_3 : Algebra.{u3, u1} R A _inst_1 _inst_2] (g : AlgHom.{u3, max u2 u3, u1} R (FreeAlgebra.{u3, u2} R _inst_1 X) A _inst_1 (FreeAlgebra.instSemiringFreeAlgebra.{u3, u2} R _inst_1 X) _inst_2 (FreeAlgebra.instAlgebraFreeAlgebraInstSemiringFreeAlgebra.{u3, u2} R _inst_1 X) _inst_3), Eq.{max (max (succ u3) (succ u2)) (succ u1)} ((fun (x._@.Mathlib.Logic.Equiv.Defs._hyg.808 : X -> A) => AlgHom.{u3, max u2 u3, u1} R (FreeAlgebra.{u3, u2} R _inst_1 X) A _inst_1 (FreeAlgebra.instSemiringFreeAlgebra.{u3, u2} R _inst_1 X) _inst_2 (FreeAlgebra.instAlgebraFreeAlgebraInstSemiringFreeAlgebra.{u3, u2} R _inst_1 X) _inst_3) (Function.comp.{succ u2, max (succ u3) (succ u2), succ u1} X (FreeAlgebra.{u3, u2} R _inst_1 X) A (FunLike.coe.{max (max (succ u3) (succ u2)) (succ u1), max (succ u3) (succ u2), succ u1} (AlgHom.{u3, max u2 u3, u1} R (FreeAlgebra.{u3, u2} R _inst_1 X) A _inst_1 (FreeAlgebra.instSemiringFreeAlgebra.{u3, u2} R _inst_1 X) _inst_2 (FreeAlgebra.instAlgebraFreeAlgebraInstSemiringFreeAlgebra.{u3, u2} R _inst_1 X) _inst_3) (FreeAlgebra.{u3, u2} R _inst_1 X) (fun (a : FreeAlgebra.{u3, u2} R _inst_1 X) => (fun (x._@.Mathlib.Algebra.Hom.GroupAction._hyg.2186 : FreeAlgebra.{u3, u2} R _inst_1 X) => A) a) (SMulHomClass.toFunLike.{max (max u3 u2) u1, u3, max u3 u2, u1} (AlgHom.{u3, max u2 u3, u1} R (FreeAlgebra.{u3, u2} R _inst_1 X) A _inst_1 (FreeAlgebra.instSemiringFreeAlgebra.{u3, u2} R _inst_1 X) _inst_2 (FreeAlgebra.instAlgebraFreeAlgebraInstSemiringFreeAlgebra.{u3, u2} R _inst_1 X) _inst_3) R (FreeAlgebra.{u3, u2} R _inst_1 X) A (SMulZeroClass.toSMul.{u3, max u3 u2} R (FreeAlgebra.{u3, u2} R _inst_1 X) (AddMonoid.toZero.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (AddCommMonoid.toAddMonoid.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (NonUnitalNonAssocSemiring.toAddCommMonoid.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (Semiring.toNonAssocSemiring.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (FreeAlgebra.instSemiringFreeAlgebra.{u3, u2} R _inst_1 X)))))) (DistribSMul.toSMulZeroClass.{u3, max u3 u2} R (FreeAlgebra.{u3, u2} R _inst_1 X) (AddMonoid.toAddZeroClass.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (AddCommMonoid.toAddMonoid.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (NonUnitalNonAssocSemiring.toAddCommMonoid.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (Semiring.toNonAssocSemiring.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (FreeAlgebra.instSemiringFreeAlgebra.{u3, u2} R _inst_1 X)))))) (DistribMulAction.toDistribSMul.{u3, max u3 u2} R (FreeAlgebra.{u3, u2} R _inst_1 X) (MonoidWithZero.toMonoid.{u3} R (Semiring.toMonoidWithZero.{u3} R (CommSemiring.toSemiring.{u3} R _inst_1))) (AddCommMonoid.toAddMonoid.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (NonUnitalNonAssocSemiring.toAddCommMonoid.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (Semiring.toNonAssocSemiring.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (FreeAlgebra.instSemiringFreeAlgebra.{u3, u2} R _inst_1 X))))) (Module.toDistribMulAction.{u3, max u3 u2} R (FreeAlgebra.{u3, u2} R _inst_1 X) (CommSemiring.toSemiring.{u3} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (Semiring.toNonAssocSemiring.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (FreeAlgebra.instSemiringFreeAlgebra.{u3, u2} R _inst_1 X)))) (Algebra.toModule.{u3, max u3 u2} R (FreeAlgebra.{u3, u2} R _inst_1 X) _inst_1 (FreeAlgebra.instSemiringFreeAlgebra.{u3, u2} R _inst_1 X) (FreeAlgebra.instAlgebraFreeAlgebraInstSemiringFreeAlgebra.{u3, u2} R _inst_1 X)))))) (SMulZeroClass.toSMul.{u3, u1} R A (AddMonoid.toZero.{u1} A (AddCommMonoid.toAddMonoid.{u1} A (NonUnitalNonAssocSemiring.toAddCommMonoid.{u1} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} A (Semiring.toNonAssocSemiring.{u1} A _inst_2))))) (DistribSMul.toSMulZeroClass.{u3, u1} R A (AddMonoid.toAddZeroClass.{u1} A (AddCommMonoid.toAddMonoid.{u1} A (NonUnitalNonAssocSemiring.toAddCommMonoid.{u1} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} A (Semiring.toNonAssocSemiring.{u1} A _inst_2))))) (DistribMulAction.toDistribSMul.{u3, u1} R A (MonoidWithZero.toMonoid.{u3} R (Semiring.toMonoidWithZero.{u3} R (CommSemiring.toSemiring.{u3} R _inst_1))) (AddCommMonoid.toAddMonoid.{u1} A (NonUnitalNonAssocSemiring.toAddCommMonoid.{u1} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} A (Semiring.toNonAssocSemiring.{u1} A _inst_2)))) (Module.toDistribMulAction.{u3, u1} R A (CommSemiring.toSemiring.{u3} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u1} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} A (Semiring.toNonAssocSemiring.{u1} A _inst_2))) (Algebra.toModule.{u3, u1} R A _inst_1 _inst_2 _inst_3))))) (DistribMulActionHomClass.toSMulHomClass.{max (max u3 u2) u1, u3, max u3 u2, u1} (AlgHom.{u3, max u2 u3, u1} R (FreeAlgebra.{u3, u2} R _inst_1 X) A _inst_1 (FreeAlgebra.instSemiringFreeAlgebra.{u3, u2} R _inst_1 X) _inst_2 (FreeAlgebra.instAlgebraFreeAlgebraInstSemiringFreeAlgebra.{u3, u2} R _inst_1 X) _inst_3) R (FreeAlgebra.{u3, u2} R _inst_1 X) A (MonoidWithZero.toMonoid.{u3} R (Semiring.toMonoidWithZero.{u3} R (CommSemiring.toSemiring.{u3} R _inst_1))) (AddCommMonoid.toAddMonoid.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (NonUnitalNonAssocSemiring.toAddCommMonoid.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (Semiring.toNonAssocSemiring.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (FreeAlgebra.instSemiringFreeAlgebra.{u3, u2} R _inst_1 X))))) (AddCommMonoid.toAddMonoid.{u1} A (NonUnitalNonAssocSemiring.toAddCommMonoid.{u1} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} A (Semiring.toNonAssocSemiring.{u1} A _inst_2)))) (Module.toDistribMulAction.{u3, max u3 u2} R (FreeAlgebra.{u3, u2} R _inst_1 X) (CommSemiring.toSemiring.{u3} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (Semiring.toNonAssocSemiring.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (FreeAlgebra.instSemiringFreeAlgebra.{u3, u2} R _inst_1 X)))) (Algebra.toModule.{u3, max u3 u2} R (FreeAlgebra.{u3, u2} R _inst_1 X) _inst_1 (FreeAlgebra.instSemiringFreeAlgebra.{u3, u2} R _inst_1 X) (FreeAlgebra.instAlgebraFreeAlgebraInstSemiringFreeAlgebra.{u3, u2} R _inst_1 X))) (Module.toDistribMulAction.{u3, u1} R A (CommSemiring.toSemiring.{u3} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u1} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} A (Semiring.toNonAssocSemiring.{u1} A _inst_2))) (Algebra.toModule.{u3, u1} R A _inst_1 _inst_2 _inst_3)) (NonUnitalAlgHomClass.toDistribMulActionHomClass.{max (max u3 u2) u1, u3, max u3 u2, u1} (AlgHom.{u3, max u2 u3, u1} R (FreeAlgebra.{u3, u2} R _inst_1 X) A _inst_1 (FreeAlgebra.instSemiringFreeAlgebra.{u3, u2} R _inst_1 X) _inst_2 (FreeAlgebra.instAlgebraFreeAlgebraInstSemiringFreeAlgebra.{u3, u2} R _inst_1 X) _inst_3) R (FreeAlgebra.{u3, u2} R _inst_1 X) A (MonoidWithZero.toMonoid.{u3} R (Semiring.toMonoidWithZero.{u3} R (CommSemiring.toSemiring.{u3} R _inst_1))) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (Semiring.toNonAssocSemiring.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (FreeAlgebra.instSemiringFreeAlgebra.{u3, u2} R _inst_1 X))) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} A (Semiring.toNonAssocSemiring.{u1} A _inst_2)) (Module.toDistribMulAction.{u3, max u3 u2} R (FreeAlgebra.{u3, u2} R _inst_1 X) (CommSemiring.toSemiring.{u3} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (Semiring.toNonAssocSemiring.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (FreeAlgebra.instSemiringFreeAlgebra.{u3, u2} R _inst_1 X)))) (Algebra.toModule.{u3, max u3 u2} R (FreeAlgebra.{u3, u2} R _inst_1 X) _inst_1 (FreeAlgebra.instSemiringFreeAlgebra.{u3, u2} R _inst_1 X) (FreeAlgebra.instAlgebraFreeAlgebraInstSemiringFreeAlgebra.{u3, u2} R _inst_1 X))) (Module.toDistribMulAction.{u3, u1} R A (CommSemiring.toSemiring.{u3} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u1} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} A (Semiring.toNonAssocSemiring.{u1} A _inst_2))) (Algebra.toModule.{u3, u1} R A _inst_1 _inst_2 _inst_3)) (AlgHom.instNonUnitalAlgHomClassToMonoidToMonoidWithZeroToSemiringToNonUnitalNonAssocSemiringToNonAssocSemiringToNonUnitalNonAssocSemiringToNonAssocSemiringToDistribMulActionToAddCommMonoidToModuleToDistribMulActionToAddCommMonoidToModule.{u3, max u3 u2, u1, max (max u3 u2) u1} R (FreeAlgebra.{u3, u2} R _inst_1 X) A _inst_1 (FreeAlgebra.instSemiringFreeAlgebra.{u3, u2} R _inst_1 X) _inst_2 (FreeAlgebra.instAlgebraFreeAlgebraInstSemiringFreeAlgebra.{u3, u2} R _inst_1 X) _inst_3 (AlgHom.{u3, max u2 u3, u1} R (FreeAlgebra.{u3, u2} R _inst_1 X) A _inst_1 (FreeAlgebra.instSemiringFreeAlgebra.{u3, u2} R _inst_1 X) _inst_2 (FreeAlgebra.instAlgebraFreeAlgebraInstSemiringFreeAlgebra.{u3, u2} R _inst_1 X) _inst_3) (AlgHom.algHomClass.{u3, max u3 u2, u1} R (FreeAlgebra.{u3, u2} R _inst_1 X) A _inst_1 (FreeAlgebra.instSemiringFreeAlgebra.{u3, u2} R _inst_1 X) _inst_2 (FreeAlgebra.instAlgebraFreeAlgebraInstSemiringFreeAlgebra.{u3, u2} R _inst_1 X) _inst_3))))) g) (FreeAlgebra.ι.{u3, u2} R _inst_1 X))) (FunLike.coe.{max (max (succ u3) (succ u1)) (succ u2), max (succ u1) (succ u2), max (max (succ u3) (succ u1)) (succ u2)} (Equiv.{max (succ u2) (succ u1), max (succ u1) (succ (max u2 u3))} (X -> A) (AlgHom.{u3, max u2 u3, u1} R (FreeAlgebra.{u3, u2} R _inst_1 X) A _inst_1 (FreeAlgebra.instSemiringFreeAlgebra.{u3, u2} R _inst_1 X) _inst_2 (FreeAlgebra.instAlgebraFreeAlgebraInstSemiringFreeAlgebra.{u3, u2} R _inst_1 X) _inst_3)) (X -> A) (fun (_x : X -> A) => (fun (x._@.Mathlib.Logic.Equiv.Defs._hyg.808 : X -> A) => AlgHom.{u3, max u2 u3, u1} R (FreeAlgebra.{u3, u2} R _inst_1 X) A _inst_1 (FreeAlgebra.instSemiringFreeAlgebra.{u3, u2} R _inst_1 X) _inst_2 (FreeAlgebra.instAlgebraFreeAlgebraInstSemiringFreeAlgebra.{u3, u2} R _inst_1 X) _inst_3) _x) (Equiv.instFunLikeEquiv.{max (succ u1) (succ u2), max (max (succ u3) (succ u1)) (succ u2)} (X -> A) (AlgHom.{u3, max u2 u3, u1} R (FreeAlgebra.{u3, u2} R _inst_1 X) A _inst_1 (FreeAlgebra.instSemiringFreeAlgebra.{u3, u2} R _inst_1 X) _inst_2 (FreeAlgebra.instAlgebraFreeAlgebraInstSemiringFreeAlgebra.{u3, u2} R _inst_1 X) _inst_3)) (FreeAlgebra.lift.{u3, u2, u1} R _inst_1 X A _inst_2 _inst_3) (Function.comp.{succ u2, max (succ u3) (succ u2), succ u1} X (FreeAlgebra.{u3, u2} R _inst_1 X) A (FunLike.coe.{max (max (succ u3) (succ u2)) (succ u1), max (succ u3) (succ u2), succ u1} (AlgHom.{u3, max u2 u3, u1} R (FreeAlgebra.{u3, u2} R _inst_1 X) A _inst_1 (FreeAlgebra.instSemiringFreeAlgebra.{u3, u2} R _inst_1 X) _inst_2 (FreeAlgebra.instAlgebraFreeAlgebraInstSemiringFreeAlgebra.{u3, u2} R _inst_1 X) _inst_3) (FreeAlgebra.{u3, u2} R _inst_1 X) (fun (_x : FreeAlgebra.{u3, u2} R _inst_1 X) => (fun (x._@.Mathlib.Algebra.Hom.GroupAction._hyg.2186 : FreeAlgebra.{u3, u2} R _inst_1 X) => A) _x) (SMulHomClass.toFunLike.{max (max u3 u2) u1, u3, max u3 u2, u1} (AlgHom.{u3, max u2 u3, u1} R (FreeAlgebra.{u3, u2} R _inst_1 X) A _inst_1 (FreeAlgebra.instSemiringFreeAlgebra.{u3, u2} R _inst_1 X) _inst_2 (FreeAlgebra.instAlgebraFreeAlgebraInstSemiringFreeAlgebra.{u3, u2} R _inst_1 X) _inst_3) R (FreeAlgebra.{u3, u2} R _inst_1 X) A (SMulZeroClass.toSMul.{u3, max u3 u2} R (FreeAlgebra.{u3, u2} R _inst_1 X) (AddMonoid.toZero.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (AddCommMonoid.toAddMonoid.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (NonUnitalNonAssocSemiring.toAddCommMonoid.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (Semiring.toNonAssocSemiring.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (FreeAlgebra.instSemiringFreeAlgebra.{u3, u2} R _inst_1 X)))))) (DistribSMul.toSMulZeroClass.{u3, max u3 u2} R (FreeAlgebra.{u3, u2} R _inst_1 X) (AddMonoid.toAddZeroClass.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (AddCommMonoid.toAddMonoid.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (NonUnitalNonAssocSemiring.toAddCommMonoid.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (Semiring.toNonAssocSemiring.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (FreeAlgebra.instSemiringFreeAlgebra.{u3, u2} R _inst_1 X)))))) (DistribMulAction.toDistribSMul.{u3, max u3 u2} R (FreeAlgebra.{u3, u2} R _inst_1 X) (MonoidWithZero.toMonoid.{u3} R (Semiring.toMonoidWithZero.{u3} R (CommSemiring.toSemiring.{u3} R _inst_1))) (AddCommMonoid.toAddMonoid.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (NonUnitalNonAssocSemiring.toAddCommMonoid.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (Semiring.toNonAssocSemiring.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (FreeAlgebra.instSemiringFreeAlgebra.{u3, u2} R _inst_1 X))))) (Module.toDistribMulAction.{u3, max u3 u2} R (FreeAlgebra.{u3, u2} R _inst_1 X) (CommSemiring.toSemiring.{u3} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (Semiring.toNonAssocSemiring.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (FreeAlgebra.instSemiringFreeAlgebra.{u3, u2} R _inst_1 X)))) (Algebra.toModule.{u3, max u3 u2} R (FreeAlgebra.{u3, u2} R _inst_1 X) _inst_1 (FreeAlgebra.instSemiringFreeAlgebra.{u3, u2} R _inst_1 X) (FreeAlgebra.instAlgebraFreeAlgebraInstSemiringFreeAlgebra.{u3, u2} R _inst_1 X)))))) (SMulZeroClass.toSMul.{u3, u1} R A (AddMonoid.toZero.{u1} A (AddCommMonoid.toAddMonoid.{u1} A (NonUnitalNonAssocSemiring.toAddCommMonoid.{u1} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} A (Semiring.toNonAssocSemiring.{u1} A _inst_2))))) (DistribSMul.toSMulZeroClass.{u3, u1} R A (AddMonoid.toAddZeroClass.{u1} A (AddCommMonoid.toAddMonoid.{u1} A (NonUnitalNonAssocSemiring.toAddCommMonoid.{u1} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} A (Semiring.toNonAssocSemiring.{u1} A _inst_2))))) (DistribMulAction.toDistribSMul.{u3, u1} R A (MonoidWithZero.toMonoid.{u3} R (Semiring.toMonoidWithZero.{u3} R (CommSemiring.toSemiring.{u3} R _inst_1))) (AddCommMonoid.toAddMonoid.{u1} A (NonUnitalNonAssocSemiring.toAddCommMonoid.{u1} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} A (Semiring.toNonAssocSemiring.{u1} A _inst_2)))) (Module.toDistribMulAction.{u3, u1} R A (CommSemiring.toSemiring.{u3} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u1} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} A (Semiring.toNonAssocSemiring.{u1} A _inst_2))) (Algebra.toModule.{u3, u1} R A _inst_1 _inst_2 _inst_3))))) (DistribMulActionHomClass.toSMulHomClass.{max (max u3 u2) u1, u3, max u3 u2, u1} (AlgHom.{u3, max u2 u3, u1} R (FreeAlgebra.{u3, u2} R _inst_1 X) A _inst_1 (FreeAlgebra.instSemiringFreeAlgebra.{u3, u2} R _inst_1 X) _inst_2 (FreeAlgebra.instAlgebraFreeAlgebraInstSemiringFreeAlgebra.{u3, u2} R _inst_1 X) _inst_3) R (FreeAlgebra.{u3, u2} R _inst_1 X) A (MonoidWithZero.toMonoid.{u3} R (Semiring.toMonoidWithZero.{u3} R (CommSemiring.toSemiring.{u3} R _inst_1))) (AddCommMonoid.toAddMonoid.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (NonUnitalNonAssocSemiring.toAddCommMonoid.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (Semiring.toNonAssocSemiring.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (FreeAlgebra.instSemiringFreeAlgebra.{u3, u2} R _inst_1 X))))) (AddCommMonoid.toAddMonoid.{u1} A (NonUnitalNonAssocSemiring.toAddCommMonoid.{u1} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} A (Semiring.toNonAssocSemiring.{u1} A _inst_2)))) (Module.toDistribMulAction.{u3, max u3 u2} R (FreeAlgebra.{u3, u2} R _inst_1 X) (CommSemiring.toSemiring.{u3} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (Semiring.toNonAssocSemiring.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (FreeAlgebra.instSemiringFreeAlgebra.{u3, u2} R _inst_1 X)))) (Algebra.toModule.{u3, max u3 u2} R (FreeAlgebra.{u3, u2} R _inst_1 X) _inst_1 (FreeAlgebra.instSemiringFreeAlgebra.{u3, u2} R _inst_1 X) (FreeAlgebra.instAlgebraFreeAlgebraInstSemiringFreeAlgebra.{u3, u2} R _inst_1 X))) (Module.toDistribMulAction.{u3, u1} R A (CommSemiring.toSemiring.{u3} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u1} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} A (Semiring.toNonAssocSemiring.{u1} A _inst_2))) (Algebra.toModule.{u3, u1} R A _inst_1 _inst_2 _inst_3)) (NonUnitalAlgHomClass.toDistribMulActionHomClass.{max (max u3 u2) u1, u3, max u3 u2, u1} (AlgHom.{u3, max u2 u3, u1} R (FreeAlgebra.{u3, u2} R _inst_1 X) A _inst_1 (FreeAlgebra.instSemiringFreeAlgebra.{u3, u2} R _inst_1 X) _inst_2 (FreeAlgebra.instAlgebraFreeAlgebraInstSemiringFreeAlgebra.{u3, u2} R _inst_1 X) _inst_3) R (FreeAlgebra.{u3, u2} R _inst_1 X) A (MonoidWithZero.toMonoid.{u3} R (Semiring.toMonoidWithZero.{u3} R (CommSemiring.toSemiring.{u3} R _inst_1))) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (Semiring.toNonAssocSemiring.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (FreeAlgebra.instSemiringFreeAlgebra.{u3, u2} R _inst_1 X))) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} A (Semiring.toNonAssocSemiring.{u1} A _inst_2)) (Module.toDistribMulAction.{u3, max u3 u2} R (FreeAlgebra.{u3, u2} R _inst_1 X) (CommSemiring.toSemiring.{u3} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (Semiring.toNonAssocSemiring.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (FreeAlgebra.instSemiringFreeAlgebra.{u3, u2} R _inst_1 X)))) (Algebra.toModule.{u3, max u3 u2} R (FreeAlgebra.{u3, u2} R _inst_1 X) _inst_1 (FreeAlgebra.instSemiringFreeAlgebra.{u3, u2} R _inst_1 X) (FreeAlgebra.instAlgebraFreeAlgebraInstSemiringFreeAlgebra.{u3, u2} R _inst_1 X))) (Module.toDistribMulAction.{u3, u1} R A (CommSemiring.toSemiring.{u3} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u1} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} A (Semiring.toNonAssocSemiring.{u1} A _inst_2))) (Algebra.toModule.{u3, u1} R A _inst_1 _inst_2 _inst_3)) (AlgHom.instNonUnitalAlgHomClassToMonoidToMonoidWithZeroToSemiringToNonUnitalNonAssocSemiringToNonAssocSemiringToNonUnitalNonAssocSemiringToNonAssocSemiringToDistribMulActionToAddCommMonoidToModuleToDistribMulActionToAddCommMonoidToModule.{u3, max u3 u2, u1, max (max u3 u2) u1} R (FreeAlgebra.{u3, u2} R _inst_1 X) A _inst_1 (FreeAlgebra.instSemiringFreeAlgebra.{u3, u2} R _inst_1 X) _inst_2 (FreeAlgebra.instAlgebraFreeAlgebraInstSemiringFreeAlgebra.{u3, u2} R _inst_1 X) _inst_3 (AlgHom.{u3, max u2 u3, u1} R (FreeAlgebra.{u3, u2} R _inst_1 X) A _inst_1 (FreeAlgebra.instSemiringFreeAlgebra.{u3, u2} R _inst_1 X) _inst_2 (FreeAlgebra.instAlgebraFreeAlgebraInstSemiringFreeAlgebra.{u3, u2} R _inst_1 X) _inst_3) (AlgHom.algHomClass.{u3, max u3 u2, u1} R (FreeAlgebra.{u3, u2} R _inst_1 X) A _inst_1 (FreeAlgebra.instSemiringFreeAlgebra.{u3, u2} R _inst_1 X) _inst_2 (FreeAlgebra.instAlgebraFreeAlgebraInstSemiringFreeAlgebra.{u3, u2} R _inst_1 X) _inst_3))))) g) (FreeAlgebra.ι.{u3, u2} R _inst_1 X))) g
Case conversion may be inaccurate. Consider using '#align free_algebra.lift_comp_ι FreeAlgebra.lift_comp_ιₓ'. -/
-- Marking `free_algebra` irreducible makes `ring` instances inaccessible on quotients.
-- https://leanprover.zulipchat.com/#narrow/stream/113488-general/topic/algebra.2Esemiring_to_ring.20breaks.20semimodule.20typeclass.20lookup/near/212580241
-- For now, we avoid this by not marking it irreducible.
@[simp]
theorem lift_comp_ι (g : FreeAlgebra R X →ₐ[R] A) : lift R ((g : FreeAlgebra R X → A) ∘ ι R) = g :=
  by
  rw [← lift_symm_apply]
  exact (lift R).apply_symm_apply g
#align free_algebra.lift_comp_ι FreeAlgebra.lift_comp_ι

/- warning: free_algebra.hom_ext -> FreeAlgebra.hom_ext is a dubious translation:
lean 3 declaration is
  forall {R : Type.{u1}} [_inst_1 : CommSemiring.{u1} R] {X : Type.{u2}} {A : Type.{u3}} [_inst_2 : Semiring.{u3} A] [_inst_3 : Algebra.{u1, u3} R A _inst_1 _inst_2] {f : AlgHom.{u1, max u1 u2, u3} R (FreeAlgebra.{u1, u2} R _inst_1 X) A _inst_1 (FreeAlgebra.semiring.{u1, u2} R _inst_1 X) _inst_2 (FreeAlgebra.algebra.{u1, u2} R _inst_1 X) _inst_3} {g : AlgHom.{u1, max u1 u2, u3} R (FreeAlgebra.{u1, u2} R _inst_1 X) A _inst_1 (FreeAlgebra.semiring.{u1, u2} R _inst_1 X) _inst_2 (FreeAlgebra.algebra.{u1, u2} R _inst_1 X) _inst_3}, (Eq.{max (succ u2) (succ u3)} (X -> A) (Function.comp.{succ u2, max (succ u1) (succ u2), succ u3} X (FreeAlgebra.{u1, u2} R _inst_1 X) A (coeFn.{max (succ (max u1 u2)) (succ u3), max (succ (max u1 u2)) (succ u3)} (AlgHom.{u1, max u1 u2, u3} R (FreeAlgebra.{u1, u2} R _inst_1 X) A _inst_1 (FreeAlgebra.semiring.{u1, u2} R _inst_1 X) _inst_2 (FreeAlgebra.algebra.{u1, u2} R _inst_1 X) _inst_3) (fun (_x : AlgHom.{u1, max u1 u2, u3} R (FreeAlgebra.{u1, u2} R _inst_1 X) A _inst_1 (FreeAlgebra.semiring.{u1, u2} R _inst_1 X) _inst_2 (FreeAlgebra.algebra.{u1, u2} R _inst_1 X) _inst_3) => (FreeAlgebra.{u1, u2} R _inst_1 X) -> A) ([anonymous].{u1, max u1 u2, u3} R (FreeAlgebra.{u1, u2} R _inst_1 X) A _inst_1 (FreeAlgebra.semiring.{u1, u2} R _inst_1 X) _inst_2 (FreeAlgebra.algebra.{u1, u2} R _inst_1 X) _inst_3) f) (FreeAlgebra.ι.{u1, u2} R _inst_1 X)) (Function.comp.{succ u2, max (succ u1) (succ u2), succ u3} X (FreeAlgebra.{u1, u2} R _inst_1 X) A (coeFn.{max (succ (max u1 u2)) (succ u3), max (succ (max u1 u2)) (succ u3)} (AlgHom.{u1, max u1 u2, u3} R (FreeAlgebra.{u1, u2} R _inst_1 X) A _inst_1 (FreeAlgebra.semiring.{u1, u2} R _inst_1 X) _inst_2 (FreeAlgebra.algebra.{u1, u2} R _inst_1 X) _inst_3) (fun (_x : AlgHom.{u1, max u1 u2, u3} R (FreeAlgebra.{u1, u2} R _inst_1 X) A _inst_1 (FreeAlgebra.semiring.{u1, u2} R _inst_1 X) _inst_2 (FreeAlgebra.algebra.{u1, u2} R _inst_1 X) _inst_3) => (FreeAlgebra.{u1, u2} R _inst_1 X) -> A) ([anonymous].{u1, max u1 u2, u3} R (FreeAlgebra.{u1, u2} R _inst_1 X) A _inst_1 (FreeAlgebra.semiring.{u1, u2} R _inst_1 X) _inst_2 (FreeAlgebra.algebra.{u1, u2} R _inst_1 X) _inst_3) g) (FreeAlgebra.ι.{u1, u2} R _inst_1 X))) -> (Eq.{max (succ (max u1 u2)) (succ u3)} (AlgHom.{u1, max u1 u2, u3} R (FreeAlgebra.{u1, u2} R _inst_1 X) A _inst_1 (FreeAlgebra.semiring.{u1, u2} R _inst_1 X) _inst_2 (FreeAlgebra.algebra.{u1, u2} R _inst_1 X) _inst_3) f g)
but is expected to have type
  forall {R : Type.{u3}} [_inst_1 : CommSemiring.{u3} R] {X : Type.{u2}} {A : Type.{u1}} [_inst_2 : Semiring.{u1} A] [_inst_3 : Algebra.{u3, u1} R A _inst_1 _inst_2] {f : AlgHom.{u3, max u2 u3, u1} R (FreeAlgebra.{u3, u2} R _inst_1 X) A _inst_1 (FreeAlgebra.instSemiringFreeAlgebra.{u3, u2} R _inst_1 X) _inst_2 (FreeAlgebra.instAlgebraFreeAlgebraInstSemiringFreeAlgebra.{u3, u2} R _inst_1 X) _inst_3} {g : AlgHom.{u3, max u2 u3, u1} R (FreeAlgebra.{u3, u2} R _inst_1 X) A _inst_1 (FreeAlgebra.instSemiringFreeAlgebra.{u3, u2} R _inst_1 X) _inst_2 (FreeAlgebra.instAlgebraFreeAlgebraInstSemiringFreeAlgebra.{u3, u2} R _inst_1 X) _inst_3}, (Eq.{max (succ u2) (succ u1)} (X -> A) (Function.comp.{succ u2, max (succ u3) (succ u2), succ u1} X (FreeAlgebra.{u3, u2} R _inst_1 X) A (FunLike.coe.{max (max (succ u3) (succ u2)) (succ u1), max (succ u3) (succ u2), succ u1} (AlgHom.{u3, max u2 u3, u1} R (FreeAlgebra.{u3, u2} R _inst_1 X) A _inst_1 (FreeAlgebra.instSemiringFreeAlgebra.{u3, u2} R _inst_1 X) _inst_2 (FreeAlgebra.instAlgebraFreeAlgebraInstSemiringFreeAlgebra.{u3, u2} R _inst_1 X) _inst_3) (FreeAlgebra.{u3, u2} R _inst_1 X) (fun (_x : FreeAlgebra.{u3, u2} R _inst_1 X) => (fun (x._@.Mathlib.Algebra.Hom.GroupAction._hyg.2186 : FreeAlgebra.{u3, u2} R _inst_1 X) => A) _x) (SMulHomClass.toFunLike.{max (max u3 u2) u1, u3, max u3 u2, u1} (AlgHom.{u3, max u2 u3, u1} R (FreeAlgebra.{u3, u2} R _inst_1 X) A _inst_1 (FreeAlgebra.instSemiringFreeAlgebra.{u3, u2} R _inst_1 X) _inst_2 (FreeAlgebra.instAlgebraFreeAlgebraInstSemiringFreeAlgebra.{u3, u2} R _inst_1 X) _inst_3) R (FreeAlgebra.{u3, u2} R _inst_1 X) A (SMulZeroClass.toSMul.{u3, max u3 u2} R (FreeAlgebra.{u3, u2} R _inst_1 X) (AddMonoid.toZero.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (AddCommMonoid.toAddMonoid.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (NonUnitalNonAssocSemiring.toAddCommMonoid.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (Semiring.toNonAssocSemiring.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (FreeAlgebra.instSemiringFreeAlgebra.{u3, u2} R _inst_1 X)))))) (DistribSMul.toSMulZeroClass.{u3, max u3 u2} R (FreeAlgebra.{u3, u2} R _inst_1 X) (AddMonoid.toAddZeroClass.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (AddCommMonoid.toAddMonoid.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (NonUnitalNonAssocSemiring.toAddCommMonoid.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (Semiring.toNonAssocSemiring.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (FreeAlgebra.instSemiringFreeAlgebra.{u3, u2} R _inst_1 X)))))) (DistribMulAction.toDistribSMul.{u3, max u3 u2} R (FreeAlgebra.{u3, u2} R _inst_1 X) (MonoidWithZero.toMonoid.{u3} R (Semiring.toMonoidWithZero.{u3} R (CommSemiring.toSemiring.{u3} R _inst_1))) (AddCommMonoid.toAddMonoid.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (NonUnitalNonAssocSemiring.toAddCommMonoid.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (Semiring.toNonAssocSemiring.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (FreeAlgebra.instSemiringFreeAlgebra.{u3, u2} R _inst_1 X))))) (Module.toDistribMulAction.{u3, max u3 u2} R (FreeAlgebra.{u3, u2} R _inst_1 X) (CommSemiring.toSemiring.{u3} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (Semiring.toNonAssocSemiring.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (FreeAlgebra.instSemiringFreeAlgebra.{u3, u2} R _inst_1 X)))) (Algebra.toModule.{u3, max u3 u2} R (FreeAlgebra.{u3, u2} R _inst_1 X) _inst_1 (FreeAlgebra.instSemiringFreeAlgebra.{u3, u2} R _inst_1 X) (FreeAlgebra.instAlgebraFreeAlgebraInstSemiringFreeAlgebra.{u3, u2} R _inst_1 X)))))) (SMulZeroClass.toSMul.{u3, u1} R A (AddMonoid.toZero.{u1} A (AddCommMonoid.toAddMonoid.{u1} A (NonUnitalNonAssocSemiring.toAddCommMonoid.{u1} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} A (Semiring.toNonAssocSemiring.{u1} A _inst_2))))) (DistribSMul.toSMulZeroClass.{u3, u1} R A (AddMonoid.toAddZeroClass.{u1} A (AddCommMonoid.toAddMonoid.{u1} A (NonUnitalNonAssocSemiring.toAddCommMonoid.{u1} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} A (Semiring.toNonAssocSemiring.{u1} A _inst_2))))) (DistribMulAction.toDistribSMul.{u3, u1} R A (MonoidWithZero.toMonoid.{u3} R (Semiring.toMonoidWithZero.{u3} R (CommSemiring.toSemiring.{u3} R _inst_1))) (AddCommMonoid.toAddMonoid.{u1} A (NonUnitalNonAssocSemiring.toAddCommMonoid.{u1} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} A (Semiring.toNonAssocSemiring.{u1} A _inst_2)))) (Module.toDistribMulAction.{u3, u1} R A (CommSemiring.toSemiring.{u3} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u1} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} A (Semiring.toNonAssocSemiring.{u1} A _inst_2))) (Algebra.toModule.{u3, u1} R A _inst_1 _inst_2 _inst_3))))) (DistribMulActionHomClass.toSMulHomClass.{max (max u3 u2) u1, u3, max u3 u2, u1} (AlgHom.{u3, max u2 u3, u1} R (FreeAlgebra.{u3, u2} R _inst_1 X) A _inst_1 (FreeAlgebra.instSemiringFreeAlgebra.{u3, u2} R _inst_1 X) _inst_2 (FreeAlgebra.instAlgebraFreeAlgebraInstSemiringFreeAlgebra.{u3, u2} R _inst_1 X) _inst_3) R (FreeAlgebra.{u3, u2} R _inst_1 X) A (MonoidWithZero.toMonoid.{u3} R (Semiring.toMonoidWithZero.{u3} R (CommSemiring.toSemiring.{u3} R _inst_1))) (AddCommMonoid.toAddMonoid.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (NonUnitalNonAssocSemiring.toAddCommMonoid.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (Semiring.toNonAssocSemiring.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (FreeAlgebra.instSemiringFreeAlgebra.{u3, u2} R _inst_1 X))))) (AddCommMonoid.toAddMonoid.{u1} A (NonUnitalNonAssocSemiring.toAddCommMonoid.{u1} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} A (Semiring.toNonAssocSemiring.{u1} A _inst_2)))) (Module.toDistribMulAction.{u3, max u3 u2} R (FreeAlgebra.{u3, u2} R _inst_1 X) (CommSemiring.toSemiring.{u3} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (Semiring.toNonAssocSemiring.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (FreeAlgebra.instSemiringFreeAlgebra.{u3, u2} R _inst_1 X)))) (Algebra.toModule.{u3, max u3 u2} R (FreeAlgebra.{u3, u2} R _inst_1 X) _inst_1 (FreeAlgebra.instSemiringFreeAlgebra.{u3, u2} R _inst_1 X) (FreeAlgebra.instAlgebraFreeAlgebraInstSemiringFreeAlgebra.{u3, u2} R _inst_1 X))) (Module.toDistribMulAction.{u3, u1} R A (CommSemiring.toSemiring.{u3} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u1} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} A (Semiring.toNonAssocSemiring.{u1} A _inst_2))) (Algebra.toModule.{u3, u1} R A _inst_1 _inst_2 _inst_3)) (NonUnitalAlgHomClass.toDistribMulActionHomClass.{max (max u3 u2) u1, u3, max u3 u2, u1} (AlgHom.{u3, max u2 u3, u1} R (FreeAlgebra.{u3, u2} R _inst_1 X) A _inst_1 (FreeAlgebra.instSemiringFreeAlgebra.{u3, u2} R _inst_1 X) _inst_2 (FreeAlgebra.instAlgebraFreeAlgebraInstSemiringFreeAlgebra.{u3, u2} R _inst_1 X) _inst_3) R (FreeAlgebra.{u3, u2} R _inst_1 X) A (MonoidWithZero.toMonoid.{u3} R (Semiring.toMonoidWithZero.{u3} R (CommSemiring.toSemiring.{u3} R _inst_1))) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (Semiring.toNonAssocSemiring.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (FreeAlgebra.instSemiringFreeAlgebra.{u3, u2} R _inst_1 X))) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} A (Semiring.toNonAssocSemiring.{u1} A _inst_2)) (Module.toDistribMulAction.{u3, max u3 u2} R (FreeAlgebra.{u3, u2} R _inst_1 X) (CommSemiring.toSemiring.{u3} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (Semiring.toNonAssocSemiring.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (FreeAlgebra.instSemiringFreeAlgebra.{u3, u2} R _inst_1 X)))) (Algebra.toModule.{u3, max u3 u2} R (FreeAlgebra.{u3, u2} R _inst_1 X) _inst_1 (FreeAlgebra.instSemiringFreeAlgebra.{u3, u2} R _inst_1 X) (FreeAlgebra.instAlgebraFreeAlgebraInstSemiringFreeAlgebra.{u3, u2} R _inst_1 X))) (Module.toDistribMulAction.{u3, u1} R A (CommSemiring.toSemiring.{u3} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u1} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} A (Semiring.toNonAssocSemiring.{u1} A _inst_2))) (Algebra.toModule.{u3, u1} R A _inst_1 _inst_2 _inst_3)) (AlgHom.instNonUnitalAlgHomClassToMonoidToMonoidWithZeroToSemiringToNonUnitalNonAssocSemiringToNonAssocSemiringToNonUnitalNonAssocSemiringToNonAssocSemiringToDistribMulActionToAddCommMonoidToModuleToDistribMulActionToAddCommMonoidToModule.{u3, max u3 u2, u1, max (max u3 u2) u1} R (FreeAlgebra.{u3, u2} R _inst_1 X) A _inst_1 (FreeAlgebra.instSemiringFreeAlgebra.{u3, u2} R _inst_1 X) _inst_2 (FreeAlgebra.instAlgebraFreeAlgebraInstSemiringFreeAlgebra.{u3, u2} R _inst_1 X) _inst_3 (AlgHom.{u3, max u2 u3, u1} R (FreeAlgebra.{u3, u2} R _inst_1 X) A _inst_1 (FreeAlgebra.instSemiringFreeAlgebra.{u3, u2} R _inst_1 X) _inst_2 (FreeAlgebra.instAlgebraFreeAlgebraInstSemiringFreeAlgebra.{u3, u2} R _inst_1 X) _inst_3) (AlgHom.algHomClass.{u3, max u3 u2, u1} R (FreeAlgebra.{u3, u2} R _inst_1 X) A _inst_1 (FreeAlgebra.instSemiringFreeAlgebra.{u3, u2} R _inst_1 X) _inst_2 (FreeAlgebra.instAlgebraFreeAlgebraInstSemiringFreeAlgebra.{u3, u2} R _inst_1 X) _inst_3))))) f) (FreeAlgebra.ι.{u3, u2} R _inst_1 X)) (Function.comp.{succ u2, max (succ u3) (succ u2), succ u1} X (FreeAlgebra.{u3, u2} R _inst_1 X) A (FunLike.coe.{max (max (succ u3) (succ u2)) (succ u1), max (succ u3) (succ u2), succ u1} (AlgHom.{u3, max u2 u3, u1} R (FreeAlgebra.{u3, u2} R _inst_1 X) A _inst_1 (FreeAlgebra.instSemiringFreeAlgebra.{u3, u2} R _inst_1 X) _inst_2 (FreeAlgebra.instAlgebraFreeAlgebraInstSemiringFreeAlgebra.{u3, u2} R _inst_1 X) _inst_3) (FreeAlgebra.{u3, u2} R _inst_1 X) (fun (_x : FreeAlgebra.{u3, u2} R _inst_1 X) => (fun (x._@.Mathlib.Algebra.Hom.GroupAction._hyg.2186 : FreeAlgebra.{u3, u2} R _inst_1 X) => A) _x) (SMulHomClass.toFunLike.{max (max u3 u2) u1, u3, max u3 u2, u1} (AlgHom.{u3, max u2 u3, u1} R (FreeAlgebra.{u3, u2} R _inst_1 X) A _inst_1 (FreeAlgebra.instSemiringFreeAlgebra.{u3, u2} R _inst_1 X) _inst_2 (FreeAlgebra.instAlgebraFreeAlgebraInstSemiringFreeAlgebra.{u3, u2} R _inst_1 X) _inst_3) R (FreeAlgebra.{u3, u2} R _inst_1 X) A (SMulZeroClass.toSMul.{u3, max u3 u2} R (FreeAlgebra.{u3, u2} R _inst_1 X) (AddMonoid.toZero.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (AddCommMonoid.toAddMonoid.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (NonUnitalNonAssocSemiring.toAddCommMonoid.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (Semiring.toNonAssocSemiring.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (FreeAlgebra.instSemiringFreeAlgebra.{u3, u2} R _inst_1 X)))))) (DistribSMul.toSMulZeroClass.{u3, max u3 u2} R (FreeAlgebra.{u3, u2} R _inst_1 X) (AddMonoid.toAddZeroClass.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (AddCommMonoid.toAddMonoid.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (NonUnitalNonAssocSemiring.toAddCommMonoid.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (Semiring.toNonAssocSemiring.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (FreeAlgebra.instSemiringFreeAlgebra.{u3, u2} R _inst_1 X)))))) (DistribMulAction.toDistribSMul.{u3, max u3 u2} R (FreeAlgebra.{u3, u2} R _inst_1 X) (MonoidWithZero.toMonoid.{u3} R (Semiring.toMonoidWithZero.{u3} R (CommSemiring.toSemiring.{u3} R _inst_1))) (AddCommMonoid.toAddMonoid.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (NonUnitalNonAssocSemiring.toAddCommMonoid.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (Semiring.toNonAssocSemiring.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (FreeAlgebra.instSemiringFreeAlgebra.{u3, u2} R _inst_1 X))))) (Module.toDistribMulAction.{u3, max u3 u2} R (FreeAlgebra.{u3, u2} R _inst_1 X) (CommSemiring.toSemiring.{u3} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (Semiring.toNonAssocSemiring.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (FreeAlgebra.instSemiringFreeAlgebra.{u3, u2} R _inst_1 X)))) (Algebra.toModule.{u3, max u3 u2} R (FreeAlgebra.{u3, u2} R _inst_1 X) _inst_1 (FreeAlgebra.instSemiringFreeAlgebra.{u3, u2} R _inst_1 X) (FreeAlgebra.instAlgebraFreeAlgebraInstSemiringFreeAlgebra.{u3, u2} R _inst_1 X)))))) (SMulZeroClass.toSMul.{u3, u1} R A (AddMonoid.toZero.{u1} A (AddCommMonoid.toAddMonoid.{u1} A (NonUnitalNonAssocSemiring.toAddCommMonoid.{u1} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} A (Semiring.toNonAssocSemiring.{u1} A _inst_2))))) (DistribSMul.toSMulZeroClass.{u3, u1} R A (AddMonoid.toAddZeroClass.{u1} A (AddCommMonoid.toAddMonoid.{u1} A (NonUnitalNonAssocSemiring.toAddCommMonoid.{u1} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} A (Semiring.toNonAssocSemiring.{u1} A _inst_2))))) (DistribMulAction.toDistribSMul.{u3, u1} R A (MonoidWithZero.toMonoid.{u3} R (Semiring.toMonoidWithZero.{u3} R (CommSemiring.toSemiring.{u3} R _inst_1))) (AddCommMonoid.toAddMonoid.{u1} A (NonUnitalNonAssocSemiring.toAddCommMonoid.{u1} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} A (Semiring.toNonAssocSemiring.{u1} A _inst_2)))) (Module.toDistribMulAction.{u3, u1} R A (CommSemiring.toSemiring.{u3} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u1} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} A (Semiring.toNonAssocSemiring.{u1} A _inst_2))) (Algebra.toModule.{u3, u1} R A _inst_1 _inst_2 _inst_3))))) (DistribMulActionHomClass.toSMulHomClass.{max (max u3 u2) u1, u3, max u3 u2, u1} (AlgHom.{u3, max u2 u3, u1} R (FreeAlgebra.{u3, u2} R _inst_1 X) A _inst_1 (FreeAlgebra.instSemiringFreeAlgebra.{u3, u2} R _inst_1 X) _inst_2 (FreeAlgebra.instAlgebraFreeAlgebraInstSemiringFreeAlgebra.{u3, u2} R _inst_1 X) _inst_3) R (FreeAlgebra.{u3, u2} R _inst_1 X) A (MonoidWithZero.toMonoid.{u3} R (Semiring.toMonoidWithZero.{u3} R (CommSemiring.toSemiring.{u3} R _inst_1))) (AddCommMonoid.toAddMonoid.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (NonUnitalNonAssocSemiring.toAddCommMonoid.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (Semiring.toNonAssocSemiring.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (FreeAlgebra.instSemiringFreeAlgebra.{u3, u2} R _inst_1 X))))) (AddCommMonoid.toAddMonoid.{u1} A (NonUnitalNonAssocSemiring.toAddCommMonoid.{u1} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} A (Semiring.toNonAssocSemiring.{u1} A _inst_2)))) (Module.toDistribMulAction.{u3, max u3 u2} R (FreeAlgebra.{u3, u2} R _inst_1 X) (CommSemiring.toSemiring.{u3} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (Semiring.toNonAssocSemiring.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (FreeAlgebra.instSemiringFreeAlgebra.{u3, u2} R _inst_1 X)))) (Algebra.toModule.{u3, max u3 u2} R (FreeAlgebra.{u3, u2} R _inst_1 X) _inst_1 (FreeAlgebra.instSemiringFreeAlgebra.{u3, u2} R _inst_1 X) (FreeAlgebra.instAlgebraFreeAlgebraInstSemiringFreeAlgebra.{u3, u2} R _inst_1 X))) (Module.toDistribMulAction.{u3, u1} R A (CommSemiring.toSemiring.{u3} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u1} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} A (Semiring.toNonAssocSemiring.{u1} A _inst_2))) (Algebra.toModule.{u3, u1} R A _inst_1 _inst_2 _inst_3)) (NonUnitalAlgHomClass.toDistribMulActionHomClass.{max (max u3 u2) u1, u3, max u3 u2, u1} (AlgHom.{u3, max u2 u3, u1} R (FreeAlgebra.{u3, u2} R _inst_1 X) A _inst_1 (FreeAlgebra.instSemiringFreeAlgebra.{u3, u2} R _inst_1 X) _inst_2 (FreeAlgebra.instAlgebraFreeAlgebraInstSemiringFreeAlgebra.{u3, u2} R _inst_1 X) _inst_3) R (FreeAlgebra.{u3, u2} R _inst_1 X) A (MonoidWithZero.toMonoid.{u3} R (Semiring.toMonoidWithZero.{u3} R (CommSemiring.toSemiring.{u3} R _inst_1))) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (Semiring.toNonAssocSemiring.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (FreeAlgebra.instSemiringFreeAlgebra.{u3, u2} R _inst_1 X))) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} A (Semiring.toNonAssocSemiring.{u1} A _inst_2)) (Module.toDistribMulAction.{u3, max u3 u2} R (FreeAlgebra.{u3, u2} R _inst_1 X) (CommSemiring.toSemiring.{u3} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (Semiring.toNonAssocSemiring.{max u3 u2} (FreeAlgebra.{u3, u2} R _inst_1 X) (FreeAlgebra.instSemiringFreeAlgebra.{u3, u2} R _inst_1 X)))) (Algebra.toModule.{u3, max u3 u2} R (FreeAlgebra.{u3, u2} R _inst_1 X) _inst_1 (FreeAlgebra.instSemiringFreeAlgebra.{u3, u2} R _inst_1 X) (FreeAlgebra.instAlgebraFreeAlgebraInstSemiringFreeAlgebra.{u3, u2} R _inst_1 X))) (Module.toDistribMulAction.{u3, u1} R A (CommSemiring.toSemiring.{u3} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u1} A (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} A (Semiring.toNonAssocSemiring.{u1} A _inst_2))) (Algebra.toModule.{u3, u1} R A _inst_1 _inst_2 _inst_3)) (AlgHom.instNonUnitalAlgHomClassToMonoidToMonoidWithZeroToSemiringToNonUnitalNonAssocSemiringToNonAssocSemiringToNonUnitalNonAssocSemiringToNonAssocSemiringToDistribMulActionToAddCommMonoidToModuleToDistribMulActionToAddCommMonoidToModule.{u3, max u3 u2, u1, max (max u3 u2) u1} R (FreeAlgebra.{u3, u2} R _inst_1 X) A _inst_1 (FreeAlgebra.instSemiringFreeAlgebra.{u3, u2} R _inst_1 X) _inst_2 (FreeAlgebra.instAlgebraFreeAlgebraInstSemiringFreeAlgebra.{u3, u2} R _inst_1 X) _inst_3 (AlgHom.{u3, max u2 u3, u1} R (FreeAlgebra.{u3, u2} R _inst_1 X) A _inst_1 (FreeAlgebra.instSemiringFreeAlgebra.{u3, u2} R _inst_1 X) _inst_2 (FreeAlgebra.instAlgebraFreeAlgebraInstSemiringFreeAlgebra.{u3, u2} R _inst_1 X) _inst_3) (AlgHom.algHomClass.{u3, max u3 u2, u1} R (FreeAlgebra.{u3, u2} R _inst_1 X) A _inst_1 (FreeAlgebra.instSemiringFreeAlgebra.{u3, u2} R _inst_1 X) _inst_2 (FreeAlgebra.instAlgebraFreeAlgebraInstSemiringFreeAlgebra.{u3, u2} R _inst_1 X) _inst_3))))) g) (FreeAlgebra.ι.{u3, u2} R _inst_1 X))) -> (Eq.{max (max (succ u3) (succ u2)) (succ u1)} (AlgHom.{u3, max u2 u3, u1} R (FreeAlgebra.{u3, u2} R _inst_1 X) A _inst_1 (FreeAlgebra.instSemiringFreeAlgebra.{u3, u2} R _inst_1 X) _inst_2 (FreeAlgebra.instAlgebraFreeAlgebraInstSemiringFreeAlgebra.{u3, u2} R _inst_1 X) _inst_3) f g)
Case conversion may be inaccurate. Consider using '#align free_algebra.hom_ext FreeAlgebra.hom_extₓ'. -/
/-- See note [partially-applied ext lemmas]. -/
@[ext]
theorem hom_ext {f g : FreeAlgebra R X →ₐ[R] A}
    (w : (f : FreeAlgebra R X → A) ∘ ι R = (g : FreeAlgebra R X → A) ∘ ι R) : f = g :=
  by
  rw [← lift_symm_apply, ← lift_symm_apply] at w
  exact (lift R).symm.Injective w
#align free_algebra.hom_ext FreeAlgebra.hom_ext

/- warning: free_algebra.equiv_monoid_algebra_free_monoid -> FreeAlgebra.equivMonoidAlgebraFreeMonoid is a dubious translation:
lean 3 declaration is
  forall {R : Type.{u1}} [_inst_1 : CommSemiring.{u1} R] {X : Type.{u2}}, AlgEquiv.{u1, max u1 u2, max u1 u2} R (FreeAlgebra.{u1, u2} R _inst_1 X) (MonoidAlgebra.{u1, u2} R (FreeMonoid.{u2} X) (CommSemiring.toSemiring.{u1} R _inst_1)) _inst_1 (FreeAlgebra.semiring.{u1, u2} R _inst_1 X) (MonoidAlgebra.semiring.{u1, u2} R (FreeMonoid.{u2} X) (CommSemiring.toSemiring.{u1} R _inst_1) (RightCancelMonoid.toMonoid.{u2} (FreeMonoid.{u2} X) (CancelMonoid.toRightCancelMonoid.{u2} (FreeMonoid.{u2} X) (FreeMonoid.cancelMonoid.{u2} X)))) (FreeAlgebra.algebra.{u1, u2} R _inst_1 X) (MonoidAlgebra.algebra.{u1, u2, u1} R (FreeMonoid.{u2} X) R _inst_1 (CommSemiring.toSemiring.{u1} R _inst_1) (Algebra.id.{u1} R _inst_1) (RightCancelMonoid.toMonoid.{u2} (FreeMonoid.{u2} X) (CancelMonoid.toRightCancelMonoid.{u2} (FreeMonoid.{u2} X) (FreeMonoid.cancelMonoid.{u2} X))))
but is expected to have type
  forall {R : Type.{u1}} [_inst_1 : CommSemiring.{u1} R] {X : Type.{u2}}, AlgEquiv.{u1, max u2 u1, max u2 u1} R (FreeAlgebra.{u1, u2} R _inst_1 X) (MonoidAlgebra.{u1, u2} R (FreeMonoid.{u2} X) (CommSemiring.toSemiring.{u1} R _inst_1)) _inst_1 (FreeAlgebra.instSemiringFreeAlgebra.{u1, u2} R _inst_1 X) (MonoidAlgebra.semiring.{u1, u2} R (FreeMonoid.{u2} X) (CommSemiring.toSemiring.{u1} R _inst_1) (RightCancelMonoid.toMonoid.{u2} (FreeMonoid.{u2} X) (CancelMonoid.toRightCancelMonoid.{u2} (FreeMonoid.{u2} X) (FreeMonoid.instCancelMonoidFreeMonoid.{u2} X)))) (FreeAlgebra.instAlgebraFreeAlgebraInstSemiringFreeAlgebra.{u1, u2} R _inst_1 X) (MonoidAlgebra.algebra.{u1, u2, u1} R (FreeMonoid.{u2} X) R _inst_1 (CommSemiring.toSemiring.{u1} R _inst_1) (Algebra.id.{u1} R _inst_1) (RightCancelMonoid.toMonoid.{u2} (FreeMonoid.{u2} X) (CancelMonoid.toRightCancelMonoid.{u2} (FreeMonoid.{u2} X) (FreeMonoid.instCancelMonoidFreeMonoid.{u2} X))))
Case conversion may be inaccurate. Consider using '#align free_algebra.equiv_monoid_algebra_free_monoid FreeAlgebra.equivMonoidAlgebraFreeMonoidₓ'. -/
/-- The free algebra on `X` is "just" the monoid algebra on the free monoid on `X`.

This would be useful when constructing linear maps out of a free algebra,
for example.
-/
noncomputable def equivMonoidAlgebraFreeMonoid :
    FreeAlgebra R X ≃ₐ[R] MonoidAlgebra R (FreeMonoid X) :=
  AlgEquiv.ofAlgHom (lift R fun x => (MonoidAlgebra.of R (FreeMonoid X)) (FreeMonoid.of x))
    ((MonoidAlgebra.lift R (FreeMonoid X) (FreeAlgebra R X)) (FreeMonoid.lift (ι R)))
    (by
      apply MonoidAlgebra.algHom_ext; intro x
      apply FreeMonoid.recOn x
      · simp
        rfl
      · intro x y ih
        simp at ih
        simp [ih])
    (by
      ext
      simp)
#align free_algebra.equiv_monoid_algebra_free_monoid FreeAlgebra.equivMonoidAlgebraFreeMonoid

instance [Nontrivial R] : Nontrivial (FreeAlgebra R X) :=
  equivMonoidAlgebraFreeMonoid.Surjective.Nontrivial

section

/- warning: free_algebra.algebra_map_inv -> FreeAlgebra.algebraMapInv is a dubious translation:
lean 3 declaration is
  forall {R : Type.{u1}} [_inst_1 : CommSemiring.{u1} R] {X : Type.{u2}}, AlgHom.{u1, max u1 u2, u1} R (FreeAlgebra.{u1, u2} R _inst_1 X) R _inst_1 (FreeAlgebra.semiring.{u1, u2} R _inst_1 X) (CommSemiring.toSemiring.{u1} R _inst_1) (FreeAlgebra.algebra.{u1, u2} R _inst_1 X) (Algebra.id.{u1} R _inst_1)
but is expected to have type
  forall {R : Type.{u1}} [_inst_1 : CommSemiring.{u1} R] {X : Type.{u2}}, AlgHom.{u1, max u2 u1, u1} R (FreeAlgebra.{u1, u2} R _inst_1 X) R _inst_1 (FreeAlgebra.instSemiringFreeAlgebra.{u1, u2} R _inst_1 X) (CommSemiring.toSemiring.{u1} R _inst_1) (FreeAlgebra.instAlgebraFreeAlgebraInstSemiringFreeAlgebra.{u1, u2} R _inst_1 X) (Algebra.id.{u1} R _inst_1)
Case conversion may be inaccurate. Consider using '#align free_algebra.algebra_map_inv FreeAlgebra.algebraMapInvₓ'. -/
/-- The left-inverse of `algebra_map`. -/
def algebraMapInv : FreeAlgebra R X →ₐ[R] R :=
  lift R (0 : X → R)
#align free_algebra.algebra_map_inv FreeAlgebra.algebraMapInv

/- warning: free_algebra.algebra_map_left_inverse -> FreeAlgebra.algebraMap_leftInverse is a dubious translation:
lean 3 declaration is
  forall {R : Type.{u1}} [_inst_1 : CommSemiring.{u1} R] {X : Type.{u2}}, Function.LeftInverse.{succ u1, max (succ u1) (succ u2)} R (FreeAlgebra.{u1, u2} R _inst_1 X) (coeFn.{max (succ (max u1 u2)) (succ u1), max (succ (max u1 u2)) (succ u1)} (AlgHom.{u1, max u1 u2, u1} R (FreeAlgebra.{u1, u2} R _inst_1 X) R _inst_1 (FreeAlgebra.semiring.{u1, u2} R _inst_1 X) (CommSemiring.toSemiring.{u1} R _inst_1) (FreeAlgebra.algebra.{u1, u2} R _inst_1 X) (Algebra.id.{u1} R _inst_1)) (fun (_x : AlgHom.{u1, max u1 u2, u1} R (FreeAlgebra.{u1, u2} R _inst_1 X) R _inst_1 (FreeAlgebra.semiring.{u1, u2} R _inst_1 X) (CommSemiring.toSemiring.{u1} R _inst_1) (FreeAlgebra.algebra.{u1, u2} R _inst_1 X) (Algebra.id.{u1} R _inst_1)) => (FreeAlgebra.{u1, u2} R _inst_1 X) -> R) ([anonymous].{u1, max u1 u2, u1} R (FreeAlgebra.{u1, u2} R _inst_1 X) R _inst_1 (FreeAlgebra.semiring.{u1, u2} R _inst_1 X) (CommSemiring.toSemiring.{u1} R _inst_1) (FreeAlgebra.algebra.{u1, u2} R _inst_1 X) (Algebra.id.{u1} R _inst_1)) (FreeAlgebra.algebraMapInv.{u1, u2} R _inst_1 X)) (coeFn.{max (succ u1) (succ (max u1 u2)), max (succ u1) (succ (max u1 u2))} (RingHom.{u1, max u1 u2} R (FreeAlgebra.{u1, u2} R _inst_1 X) (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1)) (Semiring.toNonAssocSemiring.{max u1 u2} (FreeAlgebra.{u1, u2} R _inst_1 X) (FreeAlgebra.semiring.{u1, u2} R _inst_1 X))) (fun (_x : RingHom.{u1, max u1 u2} R (FreeAlgebra.{u1, u2} R _inst_1 X) (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1)) (Semiring.toNonAssocSemiring.{max u1 u2} (FreeAlgebra.{u1, u2} R _inst_1 X) (FreeAlgebra.semiring.{u1, u2} R _inst_1 X))) => R -> (FreeAlgebra.{u1, u2} R _inst_1 X)) (RingHom.hasCoeToFun.{u1, max u1 u2} R (FreeAlgebra.{u1, u2} R _inst_1 X) (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1)) (Semiring.toNonAssocSemiring.{max u1 u2} (FreeAlgebra.{u1, u2} R _inst_1 X) (FreeAlgebra.semiring.{u1, u2} R _inst_1 X))) (algebraMap.{u1, max u1 u2} R (FreeAlgebra.{u1, u2} R _inst_1 X) _inst_1 (FreeAlgebra.semiring.{u1, u2} R _inst_1 X) (FreeAlgebra.algebra.{u1, u2} R _inst_1 X)))
but is expected to have type
  forall {R : Type.{u2}} [_inst_1 : CommSemiring.{u2} R] {X : Type.{u1}}, Function.LeftInverse.{succ u2, max (succ u1) (succ u2)} R (FreeAlgebra.{u2, u1} R _inst_1 X) (FunLike.coe.{max (succ u1) (succ u2), max (succ u1) (succ u2), succ u2} (AlgHom.{u2, max u1 u2, u2} R (FreeAlgebra.{u2, u1} R _inst_1 X) R _inst_1 (FreeAlgebra.instSemiringFreeAlgebra.{u2, u1} R _inst_1 X) (CommSemiring.toSemiring.{u2} R _inst_1) (FreeAlgebra.instAlgebraFreeAlgebraInstSemiringFreeAlgebra.{u2, u1} R _inst_1 X) (Algebra.id.{u2} R _inst_1)) (FreeAlgebra.{u2, u1} R _inst_1 X) (fun (_x : FreeAlgebra.{u2, u1} R _inst_1 X) => (fun (x._@.Mathlib.Algebra.Hom.GroupAction._hyg.2186 : FreeAlgebra.{u2, u1} R _inst_1 X) => R) _x) (SMulHomClass.toFunLike.{max u1 u2, u2, max u1 u2, u2} (AlgHom.{u2, max u1 u2, u2} R (FreeAlgebra.{u2, u1} R _inst_1 X) R _inst_1 (FreeAlgebra.instSemiringFreeAlgebra.{u2, u1} R _inst_1 X) (CommSemiring.toSemiring.{u2} R _inst_1) (FreeAlgebra.instAlgebraFreeAlgebraInstSemiringFreeAlgebra.{u2, u1} R _inst_1 X) (Algebra.id.{u2} R _inst_1)) R (FreeAlgebra.{u2, u1} R _inst_1 X) R (SMulZeroClass.toSMul.{u2, max u1 u2} R (FreeAlgebra.{u2, u1} R _inst_1 X) (AddMonoid.toZero.{max u1 u2} (FreeAlgebra.{u2, u1} R _inst_1 X) (AddCommMonoid.toAddMonoid.{max u1 u2} (FreeAlgebra.{u2, u1} R _inst_1 X) (NonUnitalNonAssocSemiring.toAddCommMonoid.{max u1 u2} (FreeAlgebra.{u2, u1} R _inst_1 X) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{max u1 u2} (FreeAlgebra.{u2, u1} R _inst_1 X) (Semiring.toNonAssocSemiring.{max u1 u2} (FreeAlgebra.{u2, u1} R _inst_1 X) (FreeAlgebra.instSemiringFreeAlgebra.{u2, u1} R _inst_1 X)))))) (DistribSMul.toSMulZeroClass.{u2, max u1 u2} R (FreeAlgebra.{u2, u1} R _inst_1 X) (AddMonoid.toAddZeroClass.{max u1 u2} (FreeAlgebra.{u2, u1} R _inst_1 X) (AddCommMonoid.toAddMonoid.{max u1 u2} (FreeAlgebra.{u2, u1} R _inst_1 X) (NonUnitalNonAssocSemiring.toAddCommMonoid.{max u1 u2} (FreeAlgebra.{u2, u1} R _inst_1 X) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{max u1 u2} (FreeAlgebra.{u2, u1} R _inst_1 X) (Semiring.toNonAssocSemiring.{max u1 u2} (FreeAlgebra.{u2, u1} R _inst_1 X) (FreeAlgebra.instSemiringFreeAlgebra.{u2, u1} R _inst_1 X)))))) (DistribMulAction.toDistribSMul.{u2, max u1 u2} R (FreeAlgebra.{u2, u1} R _inst_1 X) (MonoidWithZero.toMonoid.{u2} R (Semiring.toMonoidWithZero.{u2} R (CommSemiring.toSemiring.{u2} R _inst_1))) (AddCommMonoid.toAddMonoid.{max u1 u2} (FreeAlgebra.{u2, u1} R _inst_1 X) (NonUnitalNonAssocSemiring.toAddCommMonoid.{max u1 u2} (FreeAlgebra.{u2, u1} R _inst_1 X) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{max u1 u2} (FreeAlgebra.{u2, u1} R _inst_1 X) (Semiring.toNonAssocSemiring.{max u1 u2} (FreeAlgebra.{u2, u1} R _inst_1 X) (FreeAlgebra.instSemiringFreeAlgebra.{u2, u1} R _inst_1 X))))) (Module.toDistribMulAction.{u2, max u1 u2} R (FreeAlgebra.{u2, u1} R _inst_1 X) (CommSemiring.toSemiring.{u2} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{max u1 u2} (FreeAlgebra.{u2, u1} R _inst_1 X) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{max u1 u2} (FreeAlgebra.{u2, u1} R _inst_1 X) (Semiring.toNonAssocSemiring.{max u1 u2} (FreeAlgebra.{u2, u1} R _inst_1 X) (FreeAlgebra.instSemiringFreeAlgebra.{u2, u1} R _inst_1 X)))) (Algebra.toModule.{u2, max u1 u2} R (FreeAlgebra.{u2, u1} R _inst_1 X) _inst_1 (FreeAlgebra.instSemiringFreeAlgebra.{u2, u1} R _inst_1 X) (FreeAlgebra.instAlgebraFreeAlgebraInstSemiringFreeAlgebra.{u2, u1} R _inst_1 X)))))) (SMulZeroClass.toSMul.{u2, u2} R R (AddMonoid.toZero.{u2} R (AddCommMonoid.toAddMonoid.{u2} R (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} R (Semiring.toNonAssocSemiring.{u2} R (CommSemiring.toSemiring.{u2} R _inst_1)))))) (DistribSMul.toSMulZeroClass.{u2, u2} R R (AddMonoid.toAddZeroClass.{u2} R (AddCommMonoid.toAddMonoid.{u2} R (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} R (Semiring.toNonAssocSemiring.{u2} R (CommSemiring.toSemiring.{u2} R _inst_1)))))) (DistribMulAction.toDistribSMul.{u2, u2} R R (MonoidWithZero.toMonoid.{u2} R (Semiring.toMonoidWithZero.{u2} R (CommSemiring.toSemiring.{u2} R _inst_1))) (AddCommMonoid.toAddMonoid.{u2} R (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} R (Semiring.toNonAssocSemiring.{u2} R (CommSemiring.toSemiring.{u2} R _inst_1))))) (Module.toDistribMulAction.{u2, u2} R R (CommSemiring.toSemiring.{u2} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} R (Semiring.toNonAssocSemiring.{u2} R (CommSemiring.toSemiring.{u2} R _inst_1)))) (Algebra.toModule.{u2, u2} R R _inst_1 (CommSemiring.toSemiring.{u2} R _inst_1) (Algebra.id.{u2} R _inst_1)))))) (DistribMulActionHomClass.toSMulHomClass.{max u1 u2, u2, max u1 u2, u2} (AlgHom.{u2, max u1 u2, u2} R (FreeAlgebra.{u2, u1} R _inst_1 X) R _inst_1 (FreeAlgebra.instSemiringFreeAlgebra.{u2, u1} R _inst_1 X) (CommSemiring.toSemiring.{u2} R _inst_1) (FreeAlgebra.instAlgebraFreeAlgebraInstSemiringFreeAlgebra.{u2, u1} R _inst_1 X) (Algebra.id.{u2} R _inst_1)) R (FreeAlgebra.{u2, u1} R _inst_1 X) R (MonoidWithZero.toMonoid.{u2} R (Semiring.toMonoidWithZero.{u2} R (CommSemiring.toSemiring.{u2} R _inst_1))) (AddCommMonoid.toAddMonoid.{max u1 u2} (FreeAlgebra.{u2, u1} R _inst_1 X) (NonUnitalNonAssocSemiring.toAddCommMonoid.{max u1 u2} (FreeAlgebra.{u2, u1} R _inst_1 X) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{max u1 u2} (FreeAlgebra.{u2, u1} R _inst_1 X) (Semiring.toNonAssocSemiring.{max u1 u2} (FreeAlgebra.{u2, u1} R _inst_1 X) (FreeAlgebra.instSemiringFreeAlgebra.{u2, u1} R _inst_1 X))))) (AddCommMonoid.toAddMonoid.{u2} R (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} R (Semiring.toNonAssocSemiring.{u2} R (CommSemiring.toSemiring.{u2} R _inst_1))))) (Module.toDistribMulAction.{u2, max u1 u2} R (FreeAlgebra.{u2, u1} R _inst_1 X) (CommSemiring.toSemiring.{u2} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{max u1 u2} (FreeAlgebra.{u2, u1} R _inst_1 X) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{max u1 u2} (FreeAlgebra.{u2, u1} R _inst_1 X) (Semiring.toNonAssocSemiring.{max u1 u2} (FreeAlgebra.{u2, u1} R _inst_1 X) (FreeAlgebra.instSemiringFreeAlgebra.{u2, u1} R _inst_1 X)))) (Algebra.toModule.{u2, max u1 u2} R (FreeAlgebra.{u2, u1} R _inst_1 X) _inst_1 (FreeAlgebra.instSemiringFreeAlgebra.{u2, u1} R _inst_1 X) (FreeAlgebra.instAlgebraFreeAlgebraInstSemiringFreeAlgebra.{u2, u1} R _inst_1 X))) (Module.toDistribMulAction.{u2, u2} R R (CommSemiring.toSemiring.{u2} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} R (Semiring.toNonAssocSemiring.{u2} R (CommSemiring.toSemiring.{u2} R _inst_1)))) (Algebra.toModule.{u2, u2} R R _inst_1 (CommSemiring.toSemiring.{u2} R _inst_1) (Algebra.id.{u2} R _inst_1))) (NonUnitalAlgHomClass.toDistribMulActionHomClass.{max u1 u2, u2, max u1 u2, u2} (AlgHom.{u2, max u1 u2, u2} R (FreeAlgebra.{u2, u1} R _inst_1 X) R _inst_1 (FreeAlgebra.instSemiringFreeAlgebra.{u2, u1} R _inst_1 X) (CommSemiring.toSemiring.{u2} R _inst_1) (FreeAlgebra.instAlgebraFreeAlgebraInstSemiringFreeAlgebra.{u2, u1} R _inst_1 X) (Algebra.id.{u2} R _inst_1)) R (FreeAlgebra.{u2, u1} R _inst_1 X) R (MonoidWithZero.toMonoid.{u2} R (Semiring.toMonoidWithZero.{u2} R (CommSemiring.toSemiring.{u2} R _inst_1))) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{max u1 u2} (FreeAlgebra.{u2, u1} R _inst_1 X) (Semiring.toNonAssocSemiring.{max u1 u2} (FreeAlgebra.{u2, u1} R _inst_1 X) (FreeAlgebra.instSemiringFreeAlgebra.{u2, u1} R _inst_1 X))) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} R (Semiring.toNonAssocSemiring.{u2} R (CommSemiring.toSemiring.{u2} R _inst_1))) (Module.toDistribMulAction.{u2, max u1 u2} R (FreeAlgebra.{u2, u1} R _inst_1 X) (CommSemiring.toSemiring.{u2} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{max u1 u2} (FreeAlgebra.{u2, u1} R _inst_1 X) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{max u1 u2} (FreeAlgebra.{u2, u1} R _inst_1 X) (Semiring.toNonAssocSemiring.{max u1 u2} (FreeAlgebra.{u2, u1} R _inst_1 X) (FreeAlgebra.instSemiringFreeAlgebra.{u2, u1} R _inst_1 X)))) (Algebra.toModule.{u2, max u1 u2} R (FreeAlgebra.{u2, u1} R _inst_1 X) _inst_1 (FreeAlgebra.instSemiringFreeAlgebra.{u2, u1} R _inst_1 X) (FreeAlgebra.instAlgebraFreeAlgebraInstSemiringFreeAlgebra.{u2, u1} R _inst_1 X))) (Module.toDistribMulAction.{u2, u2} R R (CommSemiring.toSemiring.{u2} R _inst_1) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} R (Semiring.toNonAssocSemiring.{u2} R (CommSemiring.toSemiring.{u2} R _inst_1)))) (Algebra.toModule.{u2, u2} R R _inst_1 (CommSemiring.toSemiring.{u2} R _inst_1) (Algebra.id.{u2} R _inst_1))) (AlgHom.instNonUnitalAlgHomClassToMonoidToMonoidWithZeroToSemiringToNonUnitalNonAssocSemiringToNonAssocSemiringToNonUnitalNonAssocSemiringToNonAssocSemiringToDistribMulActionToAddCommMonoidToModuleToDistribMulActionToAddCommMonoidToModule.{u2, max u1 u2, u2, max u1 u2} R (FreeAlgebra.{u2, u1} R _inst_1 X) R _inst_1 (FreeAlgebra.instSemiringFreeAlgebra.{u2, u1} R _inst_1 X) (CommSemiring.toSemiring.{u2} R _inst_1) (FreeAlgebra.instAlgebraFreeAlgebraInstSemiringFreeAlgebra.{u2, u1} R _inst_1 X) (Algebra.id.{u2} R _inst_1) (AlgHom.{u2, max u1 u2, u2} R (FreeAlgebra.{u2, u1} R _inst_1 X) R _inst_1 (FreeAlgebra.instSemiringFreeAlgebra.{u2, u1} R _inst_1 X) (CommSemiring.toSemiring.{u2} R _inst_1) (FreeAlgebra.instAlgebraFreeAlgebraInstSemiringFreeAlgebra.{u2, u1} R _inst_1 X) (Algebra.id.{u2} R _inst_1)) (AlgHom.algHomClass.{u2, max u1 u2, u2} R (FreeAlgebra.{u2, u1} R _inst_1 X) R _inst_1 (FreeAlgebra.instSemiringFreeAlgebra.{u2, u1} R _inst_1 X) (CommSemiring.toSemiring.{u2} R _inst_1) (FreeAlgebra.instAlgebraFreeAlgebraInstSemiringFreeAlgebra.{u2, u1} R _inst_1 X) (Algebra.id.{u2} R _inst_1)))))) (FreeAlgebra.algebraMapInv.{u2, u1} R _inst_1 X)) (FunLike.coe.{max (succ u2) (succ u1), succ u2, max (succ u2) (succ u1)} (RingHom.{u2, max u1 u2} R (FreeAlgebra.{u2, u1} R _inst_1 X) (Semiring.toNonAssocSemiring.{u2} R (CommSemiring.toSemiring.{u2} R _inst_1)) (Semiring.toNonAssocSemiring.{max u1 u2} (FreeAlgebra.{u2, u1} R _inst_1 X) (FreeAlgebra.instSemiringFreeAlgebra.{u2, u1} R _inst_1 X))) R (fun (_x : R) => (fun (x._@.Mathlib.Algebra.Hom.Group._hyg.2391 : R) => FreeAlgebra.{u2, u1} R _inst_1 X) _x) (MulHomClass.toFunLike.{max u2 u1, u2, max u2 u1} (RingHom.{u2, max u1 u2} R (FreeAlgebra.{u2, u1} R _inst_1 X) (Semiring.toNonAssocSemiring.{u2} R (CommSemiring.toSemiring.{u2} R _inst_1)) (Semiring.toNonAssocSemiring.{max u1 u2} (FreeAlgebra.{u2, u1} R _inst_1 X) (FreeAlgebra.instSemiringFreeAlgebra.{u2, u1} R _inst_1 X))) R (FreeAlgebra.{u2, u1} R _inst_1 X) (NonUnitalNonAssocSemiring.toMul.{u2} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} R (Semiring.toNonAssocSemiring.{u2} R (CommSemiring.toSemiring.{u2} R _inst_1)))) (NonUnitalNonAssocSemiring.toMul.{max u2 u1} (FreeAlgebra.{u2, u1} R _inst_1 X) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{max u2 u1} (FreeAlgebra.{u2, u1} R _inst_1 X) (Semiring.toNonAssocSemiring.{max u1 u2} (FreeAlgebra.{u2, u1} R _inst_1 X) (FreeAlgebra.instSemiringFreeAlgebra.{u2, u1} R _inst_1 X)))) (NonUnitalRingHomClass.toMulHomClass.{max u2 u1, u2, max u2 u1} (RingHom.{u2, max u1 u2} R (FreeAlgebra.{u2, u1} R _inst_1 X) (Semiring.toNonAssocSemiring.{u2} R (CommSemiring.toSemiring.{u2} R _inst_1)) (Semiring.toNonAssocSemiring.{max u1 u2} (FreeAlgebra.{u2, u1} R _inst_1 X) (FreeAlgebra.instSemiringFreeAlgebra.{u2, u1} R _inst_1 X))) R (FreeAlgebra.{u2, u1} R _inst_1 X) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} R (Semiring.toNonAssocSemiring.{u2} R (CommSemiring.toSemiring.{u2} R _inst_1))) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{max u2 u1} (FreeAlgebra.{u2, u1} R _inst_1 X) (Semiring.toNonAssocSemiring.{max u1 u2} (FreeAlgebra.{u2, u1} R _inst_1 X) (FreeAlgebra.instSemiringFreeAlgebra.{u2, u1} R _inst_1 X))) (RingHomClass.toNonUnitalRingHomClass.{max u2 u1, u2, max u2 u1} (RingHom.{u2, max u1 u2} R (FreeAlgebra.{u2, u1} R _inst_1 X) (Semiring.toNonAssocSemiring.{u2} R (CommSemiring.toSemiring.{u2} R _inst_1)) (Semiring.toNonAssocSemiring.{max u1 u2} (FreeAlgebra.{u2, u1} R _inst_1 X) (FreeAlgebra.instSemiringFreeAlgebra.{u2, u1} R _inst_1 X))) R (FreeAlgebra.{u2, u1} R _inst_1 X) (Semiring.toNonAssocSemiring.{u2} R (CommSemiring.toSemiring.{u2} R _inst_1)) (Semiring.toNonAssocSemiring.{max u1 u2} (FreeAlgebra.{u2, u1} R _inst_1 X) (FreeAlgebra.instSemiringFreeAlgebra.{u2, u1} R _inst_1 X)) (RingHom.instRingHomClassRingHom.{u2, max u2 u1} R (FreeAlgebra.{u2, u1} R _inst_1 X) (Semiring.toNonAssocSemiring.{u2} R (CommSemiring.toSemiring.{u2} R _inst_1)) (Semiring.toNonAssocSemiring.{max u1 u2} (FreeAlgebra.{u2, u1} R _inst_1 X) (FreeAlgebra.instSemiringFreeAlgebra.{u2, u1} R _inst_1 X)))))) (algebraMap.{u2, max u1 u2} R (FreeAlgebra.{u2, u1} R _inst_1 X) _inst_1 (FreeAlgebra.instSemiringFreeAlgebra.{u2, u1} R _inst_1 X) (FreeAlgebra.instAlgebraFreeAlgebraInstSemiringFreeAlgebra.{u2, u1} R _inst_1 X)))
Case conversion may be inaccurate. Consider using '#align free_algebra.algebra_map_left_inverse FreeAlgebra.algebraMap_leftInverseₓ'. -/
theorem algebraMap_leftInverse :
    Function.LeftInverse algebraMapInv (algebraMap R <| FreeAlgebra R X) := fun x => by
  simp [algebra_map_inv]
#align free_algebra.algebra_map_left_inverse FreeAlgebra.algebraMap_leftInverse

/- warning: free_algebra.algebra_map_inj -> FreeAlgebra.algebraMap_inj is a dubious translation:
lean 3 declaration is
  forall {R : Type.{u1}} [_inst_1 : CommSemiring.{u1} R] {X : Type.{u2}} (x : R) (y : R), Iff (Eq.{max (succ u1) (succ u2)} (FreeAlgebra.{u1, u2} R _inst_1 X) (coeFn.{max (succ u1) (succ (max u1 u2)), max (succ u1) (succ (max u1 u2))} (RingHom.{u1, max u1 u2} R (FreeAlgebra.{u1, u2} R _inst_1 X) (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1)) (Semiring.toNonAssocSemiring.{max u1 u2} (FreeAlgebra.{u1, u2} R _inst_1 X) (FreeAlgebra.semiring.{u1, u2} R _inst_1 X))) (fun (_x : RingHom.{u1, max u1 u2} R (FreeAlgebra.{u1, u2} R _inst_1 X) (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1)) (Semiring.toNonAssocSemiring.{max u1 u2} (FreeAlgebra.{u1, u2} R _inst_1 X) (FreeAlgebra.semiring.{u1, u2} R _inst_1 X))) => R -> (FreeAlgebra.{u1, u2} R _inst_1 X)) (RingHom.hasCoeToFun.{u1, max u1 u2} R (FreeAlgebra.{u1, u2} R _inst_1 X) (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1)) (Semiring.toNonAssocSemiring.{max u1 u2} (FreeAlgebra.{u1, u2} R _inst_1 X) (FreeAlgebra.semiring.{u1, u2} R _inst_1 X))) (algebraMap.{u1, max u1 u2} R (FreeAlgebra.{u1, u2} R _inst_1 X) _inst_1 (FreeAlgebra.semiring.{u1, u2} R _inst_1 X) (FreeAlgebra.algebra.{u1, u2} R _inst_1 X)) x) (coeFn.{max (succ u1) (succ (max u1 u2)), max (succ u1) (succ (max u1 u2))} (RingHom.{u1, max u1 u2} R (FreeAlgebra.{u1, u2} R _inst_1 X) (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1)) (Semiring.toNonAssocSemiring.{max u1 u2} (FreeAlgebra.{u1, u2} R _inst_1 X) (FreeAlgebra.semiring.{u1, u2} R _inst_1 X))) (fun (_x : RingHom.{u1, max u1 u2} R (FreeAlgebra.{u1, u2} R _inst_1 X) (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1)) (Semiring.toNonAssocSemiring.{max u1 u2} (FreeAlgebra.{u1, u2} R _inst_1 X) (FreeAlgebra.semiring.{u1, u2} R _inst_1 X))) => R -> (FreeAlgebra.{u1, u2} R _inst_1 X)) (RingHom.hasCoeToFun.{u1, max u1 u2} R (FreeAlgebra.{u1, u2} R _inst_1 X) (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1)) (Semiring.toNonAssocSemiring.{max u1 u2} (FreeAlgebra.{u1, u2} R _inst_1 X) (FreeAlgebra.semiring.{u1, u2} R _inst_1 X))) (algebraMap.{u1, max u1 u2} R (FreeAlgebra.{u1, u2} R _inst_1 X) _inst_1 (FreeAlgebra.semiring.{u1, u2} R _inst_1 X) (FreeAlgebra.algebra.{u1, u2} R _inst_1 X)) y)) (Eq.{succ u1} R x y)
but is expected to have type
  forall {R : Type.{u2}} [_inst_1 : CommSemiring.{u2} R] {X : Type.{u1}} (x : R) (y : R), Iff (Eq.{max (succ u2) (succ u1)} ((fun (x._@.Mathlib.Algebra.Hom.Group._hyg.2391 : R) => FreeAlgebra.{u2, u1} R _inst_1 X) x) (FunLike.coe.{max (succ u2) (succ u1), succ u2, max (succ u2) (succ u1)} (RingHom.{u2, max u1 u2} R (FreeAlgebra.{u2, u1} R _inst_1 X) (Semiring.toNonAssocSemiring.{u2} R (CommSemiring.toSemiring.{u2} R _inst_1)) (Semiring.toNonAssocSemiring.{max u1 u2} (FreeAlgebra.{u2, u1} R _inst_1 X) (FreeAlgebra.instSemiringFreeAlgebra.{u2, u1} R _inst_1 X))) R (fun (_x : R) => (fun (x._@.Mathlib.Algebra.Hom.Group._hyg.2391 : R) => FreeAlgebra.{u2, u1} R _inst_1 X) _x) (MulHomClass.toFunLike.{max u2 u1, u2, max u2 u1} (RingHom.{u2, max u1 u2} R (FreeAlgebra.{u2, u1} R _inst_1 X) (Semiring.toNonAssocSemiring.{u2} R (CommSemiring.toSemiring.{u2} R _inst_1)) (Semiring.toNonAssocSemiring.{max u1 u2} (FreeAlgebra.{u2, u1} R _inst_1 X) (FreeAlgebra.instSemiringFreeAlgebra.{u2, u1} R _inst_1 X))) R (FreeAlgebra.{u2, u1} R _inst_1 X) (NonUnitalNonAssocSemiring.toMul.{u2} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} R (Semiring.toNonAssocSemiring.{u2} R (CommSemiring.toSemiring.{u2} R _inst_1)))) (NonUnitalNonAssocSemiring.toMul.{max u2 u1} (FreeAlgebra.{u2, u1} R _inst_1 X) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{max u2 u1} (FreeAlgebra.{u2, u1} R _inst_1 X) (Semiring.toNonAssocSemiring.{max u1 u2} (FreeAlgebra.{u2, u1} R _inst_1 X) (FreeAlgebra.instSemiringFreeAlgebra.{u2, u1} R _inst_1 X)))) (NonUnitalRingHomClass.toMulHomClass.{max u2 u1, u2, max u2 u1} (RingHom.{u2, max u1 u2} R (FreeAlgebra.{u2, u1} R _inst_1 X) (Semiring.toNonAssocSemiring.{u2} R (CommSemiring.toSemiring.{u2} R _inst_1)) (Semiring.toNonAssocSemiring.{max u1 u2} (FreeAlgebra.{u2, u1} R _inst_1 X) (FreeAlgebra.instSemiringFreeAlgebra.{u2, u1} R _inst_1 X))) R (FreeAlgebra.{u2, u1} R _inst_1 X) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} R (Semiring.toNonAssocSemiring.{u2} R (CommSemiring.toSemiring.{u2} R _inst_1))) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{max u2 u1} (FreeAlgebra.{u2, u1} R _inst_1 X) (Semiring.toNonAssocSemiring.{max u1 u2} (FreeAlgebra.{u2, u1} R _inst_1 X) (FreeAlgebra.instSemiringFreeAlgebra.{u2, u1} R _inst_1 X))) (RingHomClass.toNonUnitalRingHomClass.{max u2 u1, u2, max u2 u1} (RingHom.{u2, max u1 u2} R (FreeAlgebra.{u2, u1} R _inst_1 X) (Semiring.toNonAssocSemiring.{u2} R (CommSemiring.toSemiring.{u2} R _inst_1)) (Semiring.toNonAssocSemiring.{max u1 u2} (FreeAlgebra.{u2, u1} R _inst_1 X) (FreeAlgebra.instSemiringFreeAlgebra.{u2, u1} R _inst_1 X))) R (FreeAlgebra.{u2, u1} R _inst_1 X) (Semiring.toNonAssocSemiring.{u2} R (CommSemiring.toSemiring.{u2} R _inst_1)) (Semiring.toNonAssocSemiring.{max u1 u2} (FreeAlgebra.{u2, u1} R _inst_1 X) (FreeAlgebra.instSemiringFreeAlgebra.{u2, u1} R _inst_1 X)) (RingHom.instRingHomClassRingHom.{u2, max u2 u1} R (FreeAlgebra.{u2, u1} R _inst_1 X) (Semiring.toNonAssocSemiring.{u2} R (CommSemiring.toSemiring.{u2} R _inst_1)) (Semiring.toNonAssocSemiring.{max u1 u2} (FreeAlgebra.{u2, u1} R _inst_1 X) (FreeAlgebra.instSemiringFreeAlgebra.{u2, u1} R _inst_1 X)))))) (algebraMap.{u2, max u1 u2} R (FreeAlgebra.{u2, u1} R _inst_1 X) _inst_1 (FreeAlgebra.instSemiringFreeAlgebra.{u2, u1} R _inst_1 X) (FreeAlgebra.instAlgebraFreeAlgebraInstSemiringFreeAlgebra.{u2, u1} R _inst_1 X)) x) (FunLike.coe.{max (succ u2) (succ u1), succ u2, max (succ u2) (succ u1)} (RingHom.{u2, max u1 u2} R (FreeAlgebra.{u2, u1} R _inst_1 X) (Semiring.toNonAssocSemiring.{u2} R (CommSemiring.toSemiring.{u2} R _inst_1)) (Semiring.toNonAssocSemiring.{max u1 u2} (FreeAlgebra.{u2, u1} R _inst_1 X) (FreeAlgebra.instSemiringFreeAlgebra.{u2, u1} R _inst_1 X))) R (fun (_x : R) => (fun (x._@.Mathlib.Algebra.Hom.Group._hyg.2391 : R) => FreeAlgebra.{u2, u1} R _inst_1 X) _x) (MulHomClass.toFunLike.{max u2 u1, u2, max u2 u1} (RingHom.{u2, max u1 u2} R (FreeAlgebra.{u2, u1} R _inst_1 X) (Semiring.toNonAssocSemiring.{u2} R (CommSemiring.toSemiring.{u2} R _inst_1)) (Semiring.toNonAssocSemiring.{max u1 u2} (FreeAlgebra.{u2, u1} R _inst_1 X) (FreeAlgebra.instSemiringFreeAlgebra.{u2, u1} R _inst_1 X))) R (FreeAlgebra.{u2, u1} R _inst_1 X) (NonUnitalNonAssocSemiring.toMul.{u2} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} R (Semiring.toNonAssocSemiring.{u2} R (CommSemiring.toSemiring.{u2} R _inst_1)))) (NonUnitalNonAssocSemiring.toMul.{max u2 u1} (FreeAlgebra.{u2, u1} R _inst_1 X) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{max u2 u1} (FreeAlgebra.{u2, u1} R _inst_1 X) (Semiring.toNonAssocSemiring.{max u1 u2} (FreeAlgebra.{u2, u1} R _inst_1 X) (FreeAlgebra.instSemiringFreeAlgebra.{u2, u1} R _inst_1 X)))) (NonUnitalRingHomClass.toMulHomClass.{max u2 u1, u2, max u2 u1} (RingHom.{u2, max u1 u2} R (FreeAlgebra.{u2, u1} R _inst_1 X) (Semiring.toNonAssocSemiring.{u2} R (CommSemiring.toSemiring.{u2} R _inst_1)) (Semiring.toNonAssocSemiring.{max u1 u2} (FreeAlgebra.{u2, u1} R _inst_1 X) (FreeAlgebra.instSemiringFreeAlgebra.{u2, u1} R _inst_1 X))) R (FreeAlgebra.{u2, u1} R _inst_1 X) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} R (Semiring.toNonAssocSemiring.{u2} R (CommSemiring.toSemiring.{u2} R _inst_1))) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{max u2 u1} (FreeAlgebra.{u2, u1} R _inst_1 X) (Semiring.toNonAssocSemiring.{max u1 u2} (FreeAlgebra.{u2, u1} R _inst_1 X) (FreeAlgebra.instSemiringFreeAlgebra.{u2, u1} R _inst_1 X))) (RingHomClass.toNonUnitalRingHomClass.{max u2 u1, u2, max u2 u1} (RingHom.{u2, max u1 u2} R (FreeAlgebra.{u2, u1} R _inst_1 X) (Semiring.toNonAssocSemiring.{u2} R (CommSemiring.toSemiring.{u2} R _inst_1)) (Semiring.toNonAssocSemiring.{max u1 u2} (FreeAlgebra.{u2, u1} R _inst_1 X) (FreeAlgebra.instSemiringFreeAlgebra.{u2, u1} R _inst_1 X))) R (FreeAlgebra.{u2, u1} R _inst_1 X) (Semiring.toNonAssocSemiring.{u2} R (CommSemiring.toSemiring.{u2} R _inst_1)) (Semiring.toNonAssocSemiring.{max u1 u2} (FreeAlgebra.{u2, u1} R _inst_1 X) (FreeAlgebra.instSemiringFreeAlgebra.{u2, u1} R _inst_1 X)) (RingHom.instRingHomClassRingHom.{u2, max u2 u1} R (FreeAlgebra.{u2, u1} R _inst_1 X) (Semiring.toNonAssocSemiring.{u2} R (CommSemiring.toSemiring.{u2} R _inst_1)) (Semiring.toNonAssocSemiring.{max u1 u2} (FreeAlgebra.{u2, u1} R _inst_1 X) (FreeAlgebra.instSemiringFreeAlgebra.{u2, u1} R _inst_1 X)))))) (algebraMap.{u2, max u1 u2} R (FreeAlgebra.{u2, u1} R _inst_1 X) _inst_1 (FreeAlgebra.instSemiringFreeAlgebra.{u2, u1} R _inst_1 X) (FreeAlgebra.instAlgebraFreeAlgebraInstSemiringFreeAlgebra.{u2, u1} R _inst_1 X)) y)) (Eq.{succ u2} R x y)
Case conversion may be inaccurate. Consider using '#align free_algebra.algebra_map_inj FreeAlgebra.algebraMap_injₓ'. -/
@[simp]
theorem algebraMap_inj (x y : R) :
    algebraMap R (FreeAlgebra R X) x = algebraMap R (FreeAlgebra R X) y ↔ x = y :=
  algebraMap_leftInverse.Injective.eq_iff
#align free_algebra.algebra_map_inj FreeAlgebra.algebraMap_inj

/- warning: free_algebra.algebra_map_eq_zero_iff -> FreeAlgebra.algebraMap_eq_zero_iff is a dubious translation:
lean 3 declaration is
  forall {R : Type.{u1}} [_inst_1 : CommSemiring.{u1} R] {X : Type.{u2}} (x : R), Iff (Eq.{max (succ u1) (succ u2)} (FreeAlgebra.{u1, u2} R _inst_1 X) (coeFn.{max (succ u1) (succ (max u1 u2)), max (succ u1) (succ (max u1 u2))} (RingHom.{u1, max u1 u2} R (FreeAlgebra.{u1, u2} R _inst_1 X) (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1)) (Semiring.toNonAssocSemiring.{max u1 u2} (FreeAlgebra.{u1, u2} R _inst_1 X) (FreeAlgebra.semiring.{u1, u2} R _inst_1 X))) (fun (_x : RingHom.{u1, max u1 u2} R (FreeAlgebra.{u1, u2} R _inst_1 X) (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1)) (Semiring.toNonAssocSemiring.{max u1 u2} (FreeAlgebra.{u1, u2} R _inst_1 X) (FreeAlgebra.semiring.{u1, u2} R _inst_1 X))) => R -> (FreeAlgebra.{u1, u2} R _inst_1 X)) (RingHom.hasCoeToFun.{u1, max u1 u2} R (FreeAlgebra.{u1, u2} R _inst_1 X) (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1)) (Semiring.toNonAssocSemiring.{max u1 u2} (FreeAlgebra.{u1, u2} R _inst_1 X) (FreeAlgebra.semiring.{u1, u2} R _inst_1 X))) (algebraMap.{u1, max u1 u2} R (FreeAlgebra.{u1, u2} R _inst_1 X) _inst_1 (FreeAlgebra.semiring.{u1, u2} R _inst_1 X) (FreeAlgebra.algebra.{u1, u2} R _inst_1 X)) x) (OfNat.ofNat.{max u1 u2} (FreeAlgebra.{u1, u2} R _inst_1 X) 0 (OfNat.mk.{max u1 u2} (FreeAlgebra.{u1, u2} R _inst_1 X) 0 (Zero.zero.{max u1 u2} (FreeAlgebra.{u1, u2} R _inst_1 X) (MulZeroClass.toHasZero.{max u1 u2} (FreeAlgebra.{u1, u2} R _inst_1 X) (NonUnitalNonAssocSemiring.toMulZeroClass.{max u1 u2} (FreeAlgebra.{u1, u2} R _inst_1 X) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{max u1 u2} (FreeAlgebra.{u1, u2} R _inst_1 X) (Semiring.toNonAssocSemiring.{max u1 u2} (FreeAlgebra.{u1, u2} R _inst_1 X) (FreeAlgebra.semiring.{u1, u2} R _inst_1 X))))))))) (Eq.{succ u1} R x (OfNat.ofNat.{u1} R 0 (OfNat.mk.{u1} R 0 (Zero.zero.{u1} R (MulZeroClass.toHasZero.{u1} R (NonUnitalNonAssocSemiring.toMulZeroClass.{u1} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} R (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1)))))))))
but is expected to have type
  forall {R : Type.{u2}} [_inst_1 : CommSemiring.{u2} R] {X : Type.{u1}} (x : R), Iff (Eq.{max (succ u2) (succ u1)} ((fun (x._@.Mathlib.Algebra.Hom.Group._hyg.2391 : R) => FreeAlgebra.{u2, u1} R _inst_1 X) x) (FunLike.coe.{max (succ u2) (succ u1), succ u2, max (succ u2) (succ u1)} (RingHom.{u2, max u1 u2} R (FreeAlgebra.{u2, u1} R _inst_1 X) (Semiring.toNonAssocSemiring.{u2} R (CommSemiring.toSemiring.{u2} R _inst_1)) (Semiring.toNonAssocSemiring.{max u1 u2} (FreeAlgebra.{u2, u1} R _inst_1 X) (FreeAlgebra.instSemiringFreeAlgebra.{u2, u1} R _inst_1 X))) R (fun (_x : R) => (fun (x._@.Mathlib.Algebra.Hom.Group._hyg.2391 : R) => FreeAlgebra.{u2, u1} R _inst_1 X) _x) (MulHomClass.toFunLike.{max u2 u1, u2, max u2 u1} (RingHom.{u2, max u1 u2} R (FreeAlgebra.{u2, u1} R _inst_1 X) (Semiring.toNonAssocSemiring.{u2} R (CommSemiring.toSemiring.{u2} R _inst_1)) (Semiring.toNonAssocSemiring.{max u1 u2} (FreeAlgebra.{u2, u1} R _inst_1 X) (FreeAlgebra.instSemiringFreeAlgebra.{u2, u1} R _inst_1 X))) R (FreeAlgebra.{u2, u1} R _inst_1 X) (NonUnitalNonAssocSemiring.toMul.{u2} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} R (Semiring.toNonAssocSemiring.{u2} R (CommSemiring.toSemiring.{u2} R _inst_1)))) (NonUnitalNonAssocSemiring.toMul.{max u2 u1} (FreeAlgebra.{u2, u1} R _inst_1 X) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{max u2 u1} (FreeAlgebra.{u2, u1} R _inst_1 X) (Semiring.toNonAssocSemiring.{max u1 u2} (FreeAlgebra.{u2, u1} R _inst_1 X) (FreeAlgebra.instSemiringFreeAlgebra.{u2, u1} R _inst_1 X)))) (NonUnitalRingHomClass.toMulHomClass.{max u2 u1, u2, max u2 u1} (RingHom.{u2, max u1 u2} R (FreeAlgebra.{u2, u1} R _inst_1 X) (Semiring.toNonAssocSemiring.{u2} R (CommSemiring.toSemiring.{u2} R _inst_1)) (Semiring.toNonAssocSemiring.{max u1 u2} (FreeAlgebra.{u2, u1} R _inst_1 X) (FreeAlgebra.instSemiringFreeAlgebra.{u2, u1} R _inst_1 X))) R (FreeAlgebra.{u2, u1} R _inst_1 X) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} R (Semiring.toNonAssocSemiring.{u2} R (CommSemiring.toSemiring.{u2} R _inst_1))) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{max u2 u1} (FreeAlgebra.{u2, u1} R _inst_1 X) (Semiring.toNonAssocSemiring.{max u1 u2} (FreeAlgebra.{u2, u1} R _inst_1 X) (FreeAlgebra.instSemiringFreeAlgebra.{u2, u1} R _inst_1 X))) (RingHomClass.toNonUnitalRingHomClass.{max u2 u1, u2, max u2 u1} (RingHom.{u2, max u1 u2} R (FreeAlgebra.{u2, u1} R _inst_1 X) (Semiring.toNonAssocSemiring.{u2} R (CommSemiring.toSemiring.{u2} R _inst_1)) (Semiring.toNonAssocSemiring.{max u1 u2} (FreeAlgebra.{u2, u1} R _inst_1 X) (FreeAlgebra.instSemiringFreeAlgebra.{u2, u1} R _inst_1 X))) R (FreeAlgebra.{u2, u1} R _inst_1 X) (Semiring.toNonAssocSemiring.{u2} R (CommSemiring.toSemiring.{u2} R _inst_1)) (Semiring.toNonAssocSemiring.{max u1 u2} (FreeAlgebra.{u2, u1} R _inst_1 X) (FreeAlgebra.instSemiringFreeAlgebra.{u2, u1} R _inst_1 X)) (RingHom.instRingHomClassRingHom.{u2, max u2 u1} R (FreeAlgebra.{u2, u1} R _inst_1 X) (Semiring.toNonAssocSemiring.{u2} R (CommSemiring.toSemiring.{u2} R _inst_1)) (Semiring.toNonAssocSemiring.{max u1 u2} (FreeAlgebra.{u2, u1} R _inst_1 X) (FreeAlgebra.instSemiringFreeAlgebra.{u2, u1} R _inst_1 X)))))) (algebraMap.{u2, max u1 u2} R (FreeAlgebra.{u2, u1} R _inst_1 X) _inst_1 (FreeAlgebra.instSemiringFreeAlgebra.{u2, u1} R _inst_1 X) (FreeAlgebra.instAlgebraFreeAlgebraInstSemiringFreeAlgebra.{u2, u1} R _inst_1 X)) x) (OfNat.ofNat.{max u2 u1} ((fun (x._@.Mathlib.Algebra.Hom.Group._hyg.2391 : R) => FreeAlgebra.{u2, u1} R _inst_1 X) x) 0 (Zero.toOfNat0.{max u2 u1} ((fun (x._@.Mathlib.Algebra.Hom.Group._hyg.2391 : R) => FreeAlgebra.{u2, u1} R _inst_1 X) x) (MonoidWithZero.toZero.{max u2 u1} ((fun (x._@.Mathlib.Algebra.Hom.Group._hyg.2391 : R) => FreeAlgebra.{u2, u1} R _inst_1 X) x) (Semiring.toMonoidWithZero.{max u2 u1} ((fun (x._@.Mathlib.Algebra.Hom.Group._hyg.2391 : R) => FreeAlgebra.{u2, u1} R _inst_1 X) x) (FreeAlgebra.instSemiringFreeAlgebra.{u2, u1} R _inst_1 X)))))) (Eq.{succ u2} R x (OfNat.ofNat.{u2} R 0 (Zero.toOfNat0.{u2} R (CommMonoidWithZero.toZero.{u2} R (CommSemiring.toCommMonoidWithZero.{u2} R _inst_1)))))
Case conversion may be inaccurate. Consider using '#align free_algebra.algebra_map_eq_zero_iff FreeAlgebra.algebraMap_eq_zero_iffₓ'. -/
@[simp]
theorem algebraMap_eq_zero_iff (x : R) : algebraMap R (FreeAlgebra R X) x = 0 ↔ x = 0 :=
  map_eq_zero_iff (algebraMap _ _) algebraMap_leftInverse.Injective
#align free_algebra.algebra_map_eq_zero_iff FreeAlgebra.algebraMap_eq_zero_iff

/- warning: free_algebra.algebra_map_eq_one_iff -> FreeAlgebra.algebraMap_eq_one_iff is a dubious translation:
lean 3 declaration is
  forall {R : Type.{u1}} [_inst_1 : CommSemiring.{u1} R] {X : Type.{u2}} (x : R), Iff (Eq.{max (succ u1) (succ u2)} (FreeAlgebra.{u1, u2} R _inst_1 X) (coeFn.{max (succ u1) (succ (max u1 u2)), max (succ u1) (succ (max u1 u2))} (RingHom.{u1, max u1 u2} R (FreeAlgebra.{u1, u2} R _inst_1 X) (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1)) (Semiring.toNonAssocSemiring.{max u1 u2} (FreeAlgebra.{u1, u2} R _inst_1 X) (FreeAlgebra.semiring.{u1, u2} R _inst_1 X))) (fun (_x : RingHom.{u1, max u1 u2} R (FreeAlgebra.{u1, u2} R _inst_1 X) (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1)) (Semiring.toNonAssocSemiring.{max u1 u2} (FreeAlgebra.{u1, u2} R _inst_1 X) (FreeAlgebra.semiring.{u1, u2} R _inst_1 X))) => R -> (FreeAlgebra.{u1, u2} R _inst_1 X)) (RingHom.hasCoeToFun.{u1, max u1 u2} R (FreeAlgebra.{u1, u2} R _inst_1 X) (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1)) (Semiring.toNonAssocSemiring.{max u1 u2} (FreeAlgebra.{u1, u2} R _inst_1 X) (FreeAlgebra.semiring.{u1, u2} R _inst_1 X))) (algebraMap.{u1, max u1 u2} R (FreeAlgebra.{u1, u2} R _inst_1 X) _inst_1 (FreeAlgebra.semiring.{u1, u2} R _inst_1 X) (FreeAlgebra.algebra.{u1, u2} R _inst_1 X)) x) (OfNat.ofNat.{max u1 u2} (FreeAlgebra.{u1, u2} R _inst_1 X) 1 (OfNat.mk.{max u1 u2} (FreeAlgebra.{u1, u2} R _inst_1 X) 1 (One.one.{max u1 u2} (FreeAlgebra.{u1, u2} R _inst_1 X) (AddMonoidWithOne.toOne.{max u1 u2} (FreeAlgebra.{u1, u2} R _inst_1 X) (AddCommMonoidWithOne.toAddMonoidWithOne.{max u1 u2} (FreeAlgebra.{u1, u2} R _inst_1 X) (NonAssocSemiring.toAddCommMonoidWithOne.{max u1 u2} (FreeAlgebra.{u1, u2} R _inst_1 X) (Semiring.toNonAssocSemiring.{max u1 u2} (FreeAlgebra.{u1, u2} R _inst_1 X) (FreeAlgebra.semiring.{u1, u2} R _inst_1 X))))))))) (Eq.{succ u1} R x (OfNat.ofNat.{u1} R 1 (OfNat.mk.{u1} R 1 (One.one.{u1} R (AddMonoidWithOne.toOne.{u1} R (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} R (NonAssocSemiring.toAddCommMonoidWithOne.{u1} R (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1)))))))))
but is expected to have type
  forall {R : Type.{u2}} [_inst_1 : CommSemiring.{u2} R] {X : Type.{u1}} (x : R), Iff (Eq.{max (succ u2) (succ u1)} ((fun (x._@.Mathlib.Algebra.Hom.Group._hyg.2391 : R) => FreeAlgebra.{u2, u1} R _inst_1 X) x) (FunLike.coe.{max (succ u2) (succ u1), succ u2, max (succ u2) (succ u1)} (RingHom.{u2, max u1 u2} R (FreeAlgebra.{u2, u1} R _inst_1 X) (Semiring.toNonAssocSemiring.{u2} R (CommSemiring.toSemiring.{u2} R _inst_1)) (Semiring.toNonAssocSemiring.{max u1 u2} (FreeAlgebra.{u2, u1} R _inst_1 X) (FreeAlgebra.instSemiringFreeAlgebra.{u2, u1} R _inst_1 X))) R (fun (_x : R) => (fun (x._@.Mathlib.Algebra.Hom.Group._hyg.2391 : R) => FreeAlgebra.{u2, u1} R _inst_1 X) _x) (MulHomClass.toFunLike.{max u2 u1, u2, max u2 u1} (RingHom.{u2, max u1 u2} R (FreeAlgebra.{u2, u1} R _inst_1 X) (Semiring.toNonAssocSemiring.{u2} R (CommSemiring.toSemiring.{u2} R _inst_1)) (Semiring.toNonAssocSemiring.{max u1 u2} (FreeAlgebra.{u2, u1} R _inst_1 X) (FreeAlgebra.instSemiringFreeAlgebra.{u2, u1} R _inst_1 X))) R (FreeAlgebra.{u2, u1} R _inst_1 X) (NonUnitalNonAssocSemiring.toMul.{u2} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} R (Semiring.toNonAssocSemiring.{u2} R (CommSemiring.toSemiring.{u2} R _inst_1)))) (NonUnitalNonAssocSemiring.toMul.{max u2 u1} (FreeAlgebra.{u2, u1} R _inst_1 X) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{max u2 u1} (FreeAlgebra.{u2, u1} R _inst_1 X) (Semiring.toNonAssocSemiring.{max u1 u2} (FreeAlgebra.{u2, u1} R _inst_1 X) (FreeAlgebra.instSemiringFreeAlgebra.{u2, u1} R _inst_1 X)))) (NonUnitalRingHomClass.toMulHomClass.{max u2 u1, u2, max u2 u1} (RingHom.{u2, max u1 u2} R (FreeAlgebra.{u2, u1} R _inst_1 X) (Semiring.toNonAssocSemiring.{u2} R (CommSemiring.toSemiring.{u2} R _inst_1)) (Semiring.toNonAssocSemiring.{max u1 u2} (FreeAlgebra.{u2, u1} R _inst_1 X) (FreeAlgebra.instSemiringFreeAlgebra.{u2, u1} R _inst_1 X))) R (FreeAlgebra.{u2, u1} R _inst_1 X) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} R (Semiring.toNonAssocSemiring.{u2} R (CommSemiring.toSemiring.{u2} R _inst_1))) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{max u2 u1} (FreeAlgebra.{u2, u1} R _inst_1 X) (Semiring.toNonAssocSemiring.{max u1 u2} (FreeAlgebra.{u2, u1} R _inst_1 X) (FreeAlgebra.instSemiringFreeAlgebra.{u2, u1} R _inst_1 X))) (RingHomClass.toNonUnitalRingHomClass.{max u2 u1, u2, max u2 u1} (RingHom.{u2, max u1 u2} R (FreeAlgebra.{u2, u1} R _inst_1 X) (Semiring.toNonAssocSemiring.{u2} R (CommSemiring.toSemiring.{u2} R _inst_1)) (Semiring.toNonAssocSemiring.{max u1 u2} (FreeAlgebra.{u2, u1} R _inst_1 X) (FreeAlgebra.instSemiringFreeAlgebra.{u2, u1} R _inst_1 X))) R (FreeAlgebra.{u2, u1} R _inst_1 X) (Semiring.toNonAssocSemiring.{u2} R (CommSemiring.toSemiring.{u2} R _inst_1)) (Semiring.toNonAssocSemiring.{max u1 u2} (FreeAlgebra.{u2, u1} R _inst_1 X) (FreeAlgebra.instSemiringFreeAlgebra.{u2, u1} R _inst_1 X)) (RingHom.instRingHomClassRingHom.{u2, max u2 u1} R (FreeAlgebra.{u2, u1} R _inst_1 X) (Semiring.toNonAssocSemiring.{u2} R (CommSemiring.toSemiring.{u2} R _inst_1)) (Semiring.toNonAssocSemiring.{max u1 u2} (FreeAlgebra.{u2, u1} R _inst_1 X) (FreeAlgebra.instSemiringFreeAlgebra.{u2, u1} R _inst_1 X)))))) (algebraMap.{u2, max u1 u2} R (FreeAlgebra.{u2, u1} R _inst_1 X) _inst_1 (FreeAlgebra.instSemiringFreeAlgebra.{u2, u1} R _inst_1 X) (FreeAlgebra.instAlgebraFreeAlgebraInstSemiringFreeAlgebra.{u2, u1} R _inst_1 X)) x) (OfNat.ofNat.{max u2 u1} ((fun (x._@.Mathlib.Algebra.Hom.Group._hyg.2391 : R) => FreeAlgebra.{u2, u1} R _inst_1 X) x) 1 (One.toOfNat1.{max u2 u1} ((fun (x._@.Mathlib.Algebra.Hom.Group._hyg.2391 : R) => FreeAlgebra.{u2, u1} R _inst_1 X) x) (Semiring.toOne.{max u2 u1} ((fun (x._@.Mathlib.Algebra.Hom.Group._hyg.2391 : R) => FreeAlgebra.{u2, u1} R _inst_1 X) x) (FreeAlgebra.instSemiringFreeAlgebra.{u2, u1} R _inst_1 X))))) (Eq.{succ u2} R x (OfNat.ofNat.{u2} R 1 (One.toOfNat1.{u2} R (Semiring.toOne.{u2} R (CommSemiring.toSemiring.{u2} R _inst_1)))))
Case conversion may be inaccurate. Consider using '#align free_algebra.algebra_map_eq_one_iff FreeAlgebra.algebraMap_eq_one_iffₓ'. -/
@[simp]
theorem algebraMap_eq_one_iff (x : R) : algebraMap R (FreeAlgebra R X) x = 1 ↔ x = 1 :=
  map_eq_one_iff (algebraMap _ _) algebraMap_leftInverse.Injective
#align free_algebra.algebra_map_eq_one_iff FreeAlgebra.algebraMap_eq_one_iff

/- warning: free_algebra.ι_injective -> FreeAlgebra.ι_injective is a dubious translation:
lean 3 declaration is
  forall {R : Type.{u1}} [_inst_1 : CommSemiring.{u1} R] {X : Type.{u2}} [_inst_4 : Nontrivial.{u1} R], Function.Injective.{succ u2, max (succ u1) (succ u2)} X (FreeAlgebra.{u1, u2} R _inst_1 X) (FreeAlgebra.ι.{u1, u2} R _inst_1 X)
but is expected to have type
  forall {R : Type.{u2}} [_inst_1 : CommSemiring.{u2} R] {X : Type.{u1}} [_inst_4 : Nontrivial.{u2} R], Function.Injective.{succ u1, max (succ u2) (succ u1)} X (FreeAlgebra.{u2, u1} R _inst_1 X) (FreeAlgebra.ι.{u2, u1} R _inst_1 X)
Case conversion may be inaccurate. Consider using '#align free_algebra.ι_injective FreeAlgebra.ι_injectiveₓ'. -/
-- this proof is copied from the approach in `free_abelian_group.of_injective`
theorem ι_injective [Nontrivial R] : Function.Injective (ι R : X → FreeAlgebra R X) :=
  fun x y hoxy =>
  by_contradiction <| by
    classical exact fun hxy : x ≠ y =>
        let f : FreeAlgebra R X →ₐ[R] R := lift R fun z => if x = z then (1 : R) else 0
        have hfx1 : f (ι R x) = 1 := (lift_ι_apply _ _).trans <| if_pos rfl
        have hfy1 : f (ι R y) = 1 := hoxy ▸ hfx1
        have hfy0 : f (ι R y) = 0 := (lift_ι_apply _ _).trans <| if_neg hxy
        one_ne_zero <| hfy1.symm.trans hfy0
#align free_algebra.ι_injective FreeAlgebra.ι_injective

/- warning: free_algebra.ι_inj -> FreeAlgebra.ι_inj is a dubious translation:
lean 3 declaration is
  forall {R : Type.{u1}} [_inst_1 : CommSemiring.{u1} R] {X : Type.{u2}} [_inst_4 : Nontrivial.{u1} R] (x : X) (y : X), Iff (Eq.{max (succ u1) (succ u2)} (FreeAlgebra.{u1, u2} R _inst_1 X) (FreeAlgebra.ι.{u1, u2} R _inst_1 X x) (FreeAlgebra.ι.{u1, u2} R _inst_1 X y)) (Eq.{succ u2} X x y)
but is expected to have type
  forall {R : Type.{u2}} [_inst_1 : CommSemiring.{u2} R] {X : Type.{u1}} [_inst_4 : Nontrivial.{u2} R] (x : X) (y : X), Iff (Eq.{max (succ u2) (succ u1)} (FreeAlgebra.{u2, u1} R _inst_1 X) (FreeAlgebra.ι.{u2, u1} R _inst_1 X x) (FreeAlgebra.ι.{u2, u1} R _inst_1 X y)) (Eq.{succ u1} X x y)
Case conversion may be inaccurate. Consider using '#align free_algebra.ι_inj FreeAlgebra.ι_injₓ'. -/
@[simp]
theorem ι_inj [Nontrivial R] (x y : X) : ι R x = ι R y ↔ x = y :=
  ι_injective.eq_iff
#align free_algebra.ι_inj FreeAlgebra.ι_inj

/- warning: free_algebra.ι_ne_algebra_map -> FreeAlgebra.ι_ne_algebraMap is a dubious translation:
lean 3 declaration is
  forall {R : Type.{u1}} [_inst_1 : CommSemiring.{u1} R] {X : Type.{u2}} [_inst_4 : Nontrivial.{u1} R] (x : X) (r : R), Ne.{max (succ u1) (succ u2)} (FreeAlgebra.{u1, u2} R _inst_1 X) (FreeAlgebra.ι.{u1, u2} R _inst_1 X x) (coeFn.{max (succ u1) (succ (max u1 u2)), max (succ u1) (succ (max u1 u2))} (RingHom.{u1, max u1 u2} R (FreeAlgebra.{u1, u2} R _inst_1 X) (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1)) (Semiring.toNonAssocSemiring.{max u1 u2} (FreeAlgebra.{u1, u2} R _inst_1 X) (FreeAlgebra.semiring.{u1, u2} R _inst_1 X))) (fun (_x : RingHom.{u1, max u1 u2} R (FreeAlgebra.{u1, u2} R _inst_1 X) (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1)) (Semiring.toNonAssocSemiring.{max u1 u2} (FreeAlgebra.{u1, u2} R _inst_1 X) (FreeAlgebra.semiring.{u1, u2} R _inst_1 X))) => R -> (FreeAlgebra.{u1, u2} R _inst_1 X)) (RingHom.hasCoeToFun.{u1, max u1 u2} R (FreeAlgebra.{u1, u2} R _inst_1 X) (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1)) (Semiring.toNonAssocSemiring.{max u1 u2} (FreeAlgebra.{u1, u2} R _inst_1 X) (FreeAlgebra.semiring.{u1, u2} R _inst_1 X))) (algebraMap.{u1, max u1 u2} R (FreeAlgebra.{u1, u2} R _inst_1 X) _inst_1 (FreeAlgebra.semiring.{u1, u2} R _inst_1 X) (FreeAlgebra.algebra.{u1, u2} R _inst_1 X)) r)
but is expected to have type
  forall {R : Type.{u2}} [_inst_1 : CommSemiring.{u2} R] {X : Type.{u1}} [_inst_4 : Nontrivial.{u2} R] (x : X) (r : R), Ne.{max (succ u2) (succ u1)} (FreeAlgebra.{u2, u1} R _inst_1 X) (FreeAlgebra.ι.{u2, u1} R _inst_1 X x) (FunLike.coe.{max (succ u2) (succ (max u2 u1)), succ u2, succ (max u2 u1)} (RingHom.{u2, max u2 u1} R (FreeAlgebra.{u2, u1} R _inst_1 X) (Semiring.toNonAssocSemiring.{u2} R (CommSemiring.toSemiring.{u2} R _inst_1)) (Semiring.toNonAssocSemiring.{max u2 u1} (FreeAlgebra.{u2, u1} R _inst_1 X) (FreeAlgebra.instSemiringFreeAlgebra.{u2, u1} R _inst_1 X))) R (fun (_x : R) => (fun (x._@.Mathlib.Algebra.Hom.Group._hyg.2391 : R) => FreeAlgebra.{u2, u1} R _inst_1 X) _x) (MulHomClass.toFunLike.{max u2 u1, u2, max u2 u1} (RingHom.{u2, max u2 u1} R (FreeAlgebra.{u2, u1} R _inst_1 X) (Semiring.toNonAssocSemiring.{u2} R (CommSemiring.toSemiring.{u2} R _inst_1)) (Semiring.toNonAssocSemiring.{max u2 u1} (FreeAlgebra.{u2, u1} R _inst_1 X) (FreeAlgebra.instSemiringFreeAlgebra.{u2, u1} R _inst_1 X))) R (FreeAlgebra.{u2, u1} R _inst_1 X) (NonUnitalNonAssocSemiring.toMul.{u2} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} R (Semiring.toNonAssocSemiring.{u2} R (CommSemiring.toSemiring.{u2} R _inst_1)))) (NonUnitalNonAssocSemiring.toMul.{max u2 u1} (FreeAlgebra.{u2, u1} R _inst_1 X) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{max u2 u1} (FreeAlgebra.{u2, u1} R _inst_1 X) (Semiring.toNonAssocSemiring.{max u2 u1} (FreeAlgebra.{u2, u1} R _inst_1 X) (FreeAlgebra.instSemiringFreeAlgebra.{u2, u1} R _inst_1 X)))) (NonUnitalRingHomClass.toMulHomClass.{max u2 u1, u2, max u2 u1} (RingHom.{u2, max u2 u1} R (FreeAlgebra.{u2, u1} R _inst_1 X) (Semiring.toNonAssocSemiring.{u2} R (CommSemiring.toSemiring.{u2} R _inst_1)) (Semiring.toNonAssocSemiring.{max u2 u1} (FreeAlgebra.{u2, u1} R _inst_1 X) (FreeAlgebra.instSemiringFreeAlgebra.{u2, u1} R _inst_1 X))) R (FreeAlgebra.{u2, u1} R _inst_1 X) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} R (Semiring.toNonAssocSemiring.{u2} R (CommSemiring.toSemiring.{u2} R _inst_1))) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{max u2 u1} (FreeAlgebra.{u2, u1} R _inst_1 X) (Semiring.toNonAssocSemiring.{max u2 u1} (FreeAlgebra.{u2, u1} R _inst_1 X) (FreeAlgebra.instSemiringFreeAlgebra.{u2, u1} R _inst_1 X))) (RingHomClass.toNonUnitalRingHomClass.{max u2 u1, u2, max u2 u1} (RingHom.{u2, max u2 u1} R (FreeAlgebra.{u2, u1} R _inst_1 X) (Semiring.toNonAssocSemiring.{u2} R (CommSemiring.toSemiring.{u2} R _inst_1)) (Semiring.toNonAssocSemiring.{max u2 u1} (FreeAlgebra.{u2, u1} R _inst_1 X) (FreeAlgebra.instSemiringFreeAlgebra.{u2, u1} R _inst_1 X))) R (FreeAlgebra.{u2, u1} R _inst_1 X) (Semiring.toNonAssocSemiring.{u2} R (CommSemiring.toSemiring.{u2} R _inst_1)) (Semiring.toNonAssocSemiring.{max u2 u1} (FreeAlgebra.{u2, u1} R _inst_1 X) (FreeAlgebra.instSemiringFreeAlgebra.{u2, u1} R _inst_1 X)) (RingHom.instRingHomClassRingHom.{u2, max u2 u1} R (FreeAlgebra.{u2, u1} R _inst_1 X) (Semiring.toNonAssocSemiring.{u2} R (CommSemiring.toSemiring.{u2} R _inst_1)) (Semiring.toNonAssocSemiring.{max u2 u1} (FreeAlgebra.{u2, u1} R _inst_1 X) (FreeAlgebra.instSemiringFreeAlgebra.{u2, u1} R _inst_1 X)))))) (algebraMap.{u2, max u2 u1} R (FreeAlgebra.{u2, u1} R _inst_1 X) _inst_1 (FreeAlgebra.instSemiringFreeAlgebra.{u2, u1} R _inst_1 X) (FreeAlgebra.instAlgebraFreeAlgebraInstSemiringFreeAlgebra.{u2, u1} R _inst_1 X)) r)
Case conversion may be inaccurate. Consider using '#align free_algebra.ι_ne_algebra_map FreeAlgebra.ι_ne_algebraMapₓ'. -/
@[simp]
theorem ι_ne_algebraMap [Nontrivial R] (x : X) (r : R) : ι R x ≠ algebraMap R _ r := fun h =>
  by
  let f0 : FreeAlgebra R X →ₐ[R] R := lift R 0
  let f1 : FreeAlgebra R X →ₐ[R] R := lift R 1
  have hf0 : f0 (ι R x) = 0 := lift_ι_apply _ _
  have hf1 : f1 (ι R x) = 1 := lift_ι_apply _ _
  rw [h, f0.commutes, Algebra.id.map_eq_self] at hf0
  rw [h, f1.commutes, Algebra.id.map_eq_self] at hf1
  exact zero_ne_one (hf0.symm.trans hf1)
#align free_algebra.ι_ne_algebra_map FreeAlgebra.ι_ne_algebraMap

/- warning: free_algebra.ι_ne_zero -> FreeAlgebra.ι_ne_zero is a dubious translation:
lean 3 declaration is
  forall {R : Type.{u1}} [_inst_1 : CommSemiring.{u1} R] {X : Type.{u2}} [_inst_4 : Nontrivial.{u1} R] (x : X), Ne.{max (succ u1) (succ u2)} (FreeAlgebra.{u1, u2} R _inst_1 X) (FreeAlgebra.ι.{u1, u2} R _inst_1 X x) (OfNat.ofNat.{max u1 u2} (FreeAlgebra.{u1, u2} R _inst_1 X) 0 (OfNat.mk.{max u1 u2} (FreeAlgebra.{u1, u2} R _inst_1 X) 0 (Zero.zero.{max u1 u2} (FreeAlgebra.{u1, u2} R _inst_1 X) (MulZeroClass.toHasZero.{max u1 u2} (FreeAlgebra.{u1, u2} R _inst_1 X) (NonUnitalNonAssocSemiring.toMulZeroClass.{max u1 u2} (FreeAlgebra.{u1, u2} R _inst_1 X) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{max u1 u2} (FreeAlgebra.{u1, u2} R _inst_1 X) (Semiring.toNonAssocSemiring.{max u1 u2} (FreeAlgebra.{u1, u2} R _inst_1 X) (FreeAlgebra.semiring.{u1, u2} R _inst_1 X))))))))
but is expected to have type
  forall {R : Type.{u2}} [_inst_1 : CommSemiring.{u2} R] {X : Type.{u1}} [_inst_4 : Nontrivial.{u2} R] (x : X), Ne.{max (succ u2) (succ u1)} (FreeAlgebra.{u2, u1} R _inst_1 X) (FreeAlgebra.ι.{u2, u1} R _inst_1 X x) (OfNat.ofNat.{max u2 u1} (FreeAlgebra.{u2, u1} R _inst_1 X) 0 (Zero.toOfNat0.{max u2 u1} (FreeAlgebra.{u2, u1} R _inst_1 X) (MonoidWithZero.toZero.{max u2 u1} (FreeAlgebra.{u2, u1} R _inst_1 X) (Semiring.toMonoidWithZero.{max u2 u1} (FreeAlgebra.{u2, u1} R _inst_1 X) (FreeAlgebra.instSemiringFreeAlgebra.{u2, u1} R _inst_1 X)))))
Case conversion may be inaccurate. Consider using '#align free_algebra.ι_ne_zero FreeAlgebra.ι_ne_zeroₓ'. -/
@[simp]
theorem ι_ne_zero [Nontrivial R] (x : X) : ι R x ≠ 0 :=
  ι_ne_algebraMap x 0
#align free_algebra.ι_ne_zero FreeAlgebra.ι_ne_zero

/- warning: free_algebra.ι_ne_one -> FreeAlgebra.ι_ne_one is a dubious translation:
lean 3 declaration is
  forall {R : Type.{u1}} [_inst_1 : CommSemiring.{u1} R] {X : Type.{u2}} [_inst_4 : Nontrivial.{u1} R] (x : X), Ne.{max (succ u1) (succ u2)} (FreeAlgebra.{u1, u2} R _inst_1 X) (FreeAlgebra.ι.{u1, u2} R _inst_1 X x) (OfNat.ofNat.{max u1 u2} (FreeAlgebra.{u1, u2} R _inst_1 X) 1 (OfNat.mk.{max u1 u2} (FreeAlgebra.{u1, u2} R _inst_1 X) 1 (One.one.{max u1 u2} (FreeAlgebra.{u1, u2} R _inst_1 X) (AddMonoidWithOne.toOne.{max u1 u2} (FreeAlgebra.{u1, u2} R _inst_1 X) (AddCommMonoidWithOne.toAddMonoidWithOne.{max u1 u2} (FreeAlgebra.{u1, u2} R _inst_1 X) (NonAssocSemiring.toAddCommMonoidWithOne.{max u1 u2} (FreeAlgebra.{u1, u2} R _inst_1 X) (Semiring.toNonAssocSemiring.{max u1 u2} (FreeAlgebra.{u1, u2} R _inst_1 X) (FreeAlgebra.semiring.{u1, u2} R _inst_1 X))))))))
but is expected to have type
  forall {R : Type.{u2}} [_inst_1 : CommSemiring.{u2} R] {X : Type.{u1}} [_inst_4 : Nontrivial.{u2} R] (x : X), Ne.{max (succ u2) (succ u1)} (FreeAlgebra.{u2, u1} R _inst_1 X) (FreeAlgebra.ι.{u2, u1} R _inst_1 X x) (OfNat.ofNat.{max u2 u1} (FreeAlgebra.{u2, u1} R _inst_1 X) 1 (One.toOfNat1.{max u2 u1} (FreeAlgebra.{u2, u1} R _inst_1 X) (Semiring.toOne.{max u2 u1} (FreeAlgebra.{u2, u1} R _inst_1 X) (FreeAlgebra.instSemiringFreeAlgebra.{u2, u1} R _inst_1 X))))
Case conversion may be inaccurate. Consider using '#align free_algebra.ι_ne_one FreeAlgebra.ι_ne_oneₓ'. -/
@[simp]
theorem ι_ne_one [Nontrivial R] (x : X) : ι R x ≠ 1 :=
  ι_ne_algebraMap x 1
#align free_algebra.ι_ne_one FreeAlgebra.ι_ne_one

end

end FreeAlgebra

/- There is something weird in the above namespace that breaks the typeclass resolution of
`has_coe_to_sort` below. Closing it and reopening it fixes it... -/
namespace FreeAlgebra

/- warning: free_algebra.induction -> FreeAlgebra.induction is a dubious translation:
lean 3 declaration is
  forall (R : Type.{u1}) [_inst_1 : CommSemiring.{u1} R] (X : Type.{u2}) {C : (FreeAlgebra.{u1, u2} R _inst_1 X) -> Prop}, (forall (r : R), C (coeFn.{max (succ u1) (succ (max u1 u2)), max (succ u1) (succ (max u1 u2))} (RingHom.{u1, max u1 u2} R (FreeAlgebra.{u1, u2} R _inst_1 X) (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1)) (Semiring.toNonAssocSemiring.{max u1 u2} (FreeAlgebra.{u1, u2} R _inst_1 X) (FreeAlgebra.semiring.{u1, u2} R _inst_1 X))) (fun (_x : RingHom.{u1, max u1 u2} R (FreeAlgebra.{u1, u2} R _inst_1 X) (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1)) (Semiring.toNonAssocSemiring.{max u1 u2} (FreeAlgebra.{u1, u2} R _inst_1 X) (FreeAlgebra.semiring.{u1, u2} R _inst_1 X))) => R -> (FreeAlgebra.{u1, u2} R _inst_1 X)) (RingHom.hasCoeToFun.{u1, max u1 u2} R (FreeAlgebra.{u1, u2} R _inst_1 X) (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1)) (Semiring.toNonAssocSemiring.{max u1 u2} (FreeAlgebra.{u1, u2} R _inst_1 X) (FreeAlgebra.semiring.{u1, u2} R _inst_1 X))) (algebraMap.{u1, max u1 u2} R (FreeAlgebra.{u1, u2} R _inst_1 X) _inst_1 (FreeAlgebra.semiring.{u1, u2} R _inst_1 X) (FreeAlgebra.algebra.{u1, u2} R _inst_1 X)) r)) -> (forall (x : X), C (FreeAlgebra.ι.{u1, u2} R _inst_1 X x)) -> (forall (a : FreeAlgebra.{u1, u2} R _inst_1 X) (b : FreeAlgebra.{u1, u2} R _inst_1 X), (C a) -> (C b) -> (C (HMul.hMul.{max u1 u2, max u1 u2, max u1 u2} (FreeAlgebra.{u1, u2} R _inst_1 X) (FreeAlgebra.{u1, u2} R _inst_1 X) (FreeAlgebra.{u1, u2} R _inst_1 X) (instHMul.{max u1 u2} (FreeAlgebra.{u1, u2} R _inst_1 X) (Distrib.toHasMul.{max u1 u2} (FreeAlgebra.{u1, u2} R _inst_1 X) (NonUnitalNonAssocSemiring.toDistrib.{max u1 u2} (FreeAlgebra.{u1, u2} R _inst_1 X) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{max u1 u2} (FreeAlgebra.{u1, u2} R _inst_1 X) (Semiring.toNonAssocSemiring.{max u1 u2} (FreeAlgebra.{u1, u2} R _inst_1 X) (FreeAlgebra.semiring.{u1, u2} R _inst_1 X)))))) a b))) -> (forall (a : FreeAlgebra.{u1, u2} R _inst_1 X) (b : FreeAlgebra.{u1, u2} R _inst_1 X), (C a) -> (C b) -> (C (HAdd.hAdd.{max u1 u2, max u1 u2, max u1 u2} (FreeAlgebra.{u1, u2} R _inst_1 X) (FreeAlgebra.{u1, u2} R _inst_1 X) (FreeAlgebra.{u1, u2} R _inst_1 X) (instHAdd.{max u1 u2} (FreeAlgebra.{u1, u2} R _inst_1 X) (Distrib.toHasAdd.{max u1 u2} (FreeAlgebra.{u1, u2} R _inst_1 X) (NonUnitalNonAssocSemiring.toDistrib.{max u1 u2} (FreeAlgebra.{u1, u2} R _inst_1 X) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{max u1 u2} (FreeAlgebra.{u1, u2} R _inst_1 X) (Semiring.toNonAssocSemiring.{max u1 u2} (FreeAlgebra.{u1, u2} R _inst_1 X) (FreeAlgebra.semiring.{u1, u2} R _inst_1 X)))))) a b))) -> (forall (a : FreeAlgebra.{u1, u2} R _inst_1 X), C a)
but is expected to have type
  forall (R : Type.{u2}) [_inst_1 : CommSemiring.{u2} R] (X : Type.{u1}) {C : (FreeAlgebra.{u2, u1} R _inst_1 X) -> Prop}, (forall (r : R), C (FunLike.coe.{max (succ u2) (succ u1), succ u2, max (succ u2) (succ u1)} (RingHom.{u2, max u1 u2} R (FreeAlgebra.{u2, u1} R _inst_1 X) (Semiring.toNonAssocSemiring.{u2} R (CommSemiring.toSemiring.{u2} R _inst_1)) (Semiring.toNonAssocSemiring.{max u1 u2} (FreeAlgebra.{u2, u1} R _inst_1 X) (FreeAlgebra.instSemiringFreeAlgebra.{u2, u1} R _inst_1 X))) R (fun (_x : R) => (fun (x._@.Mathlib.Algebra.Hom.Group._hyg.2391 : R) => FreeAlgebra.{u2, u1} R _inst_1 X) _x) (MulHomClass.toFunLike.{max u2 u1, u2, max u2 u1} (RingHom.{u2, max u1 u2} R (FreeAlgebra.{u2, u1} R _inst_1 X) (Semiring.toNonAssocSemiring.{u2} R (CommSemiring.toSemiring.{u2} R _inst_1)) (Semiring.toNonAssocSemiring.{max u1 u2} (FreeAlgebra.{u2, u1} R _inst_1 X) (FreeAlgebra.instSemiringFreeAlgebra.{u2, u1} R _inst_1 X))) R (FreeAlgebra.{u2, u1} R _inst_1 X) (NonUnitalNonAssocSemiring.toMul.{u2} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} R (Semiring.toNonAssocSemiring.{u2} R (CommSemiring.toSemiring.{u2} R _inst_1)))) (NonUnitalNonAssocSemiring.toMul.{max u2 u1} (FreeAlgebra.{u2, u1} R _inst_1 X) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{max u2 u1} (FreeAlgebra.{u2, u1} R _inst_1 X) (Semiring.toNonAssocSemiring.{max u1 u2} (FreeAlgebra.{u2, u1} R _inst_1 X) (FreeAlgebra.instSemiringFreeAlgebra.{u2, u1} R _inst_1 X)))) (NonUnitalRingHomClass.toMulHomClass.{max u2 u1, u2, max u2 u1} (RingHom.{u2, max u1 u2} R (FreeAlgebra.{u2, u1} R _inst_1 X) (Semiring.toNonAssocSemiring.{u2} R (CommSemiring.toSemiring.{u2} R _inst_1)) (Semiring.toNonAssocSemiring.{max u1 u2} (FreeAlgebra.{u2, u1} R _inst_1 X) (FreeAlgebra.instSemiringFreeAlgebra.{u2, u1} R _inst_1 X))) R (FreeAlgebra.{u2, u1} R _inst_1 X) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} R (Semiring.toNonAssocSemiring.{u2} R (CommSemiring.toSemiring.{u2} R _inst_1))) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{max u2 u1} (FreeAlgebra.{u2, u1} R _inst_1 X) (Semiring.toNonAssocSemiring.{max u1 u2} (FreeAlgebra.{u2, u1} R _inst_1 X) (FreeAlgebra.instSemiringFreeAlgebra.{u2, u1} R _inst_1 X))) (RingHomClass.toNonUnitalRingHomClass.{max u2 u1, u2, max u2 u1} (RingHom.{u2, max u1 u2} R (FreeAlgebra.{u2, u1} R _inst_1 X) (Semiring.toNonAssocSemiring.{u2} R (CommSemiring.toSemiring.{u2} R _inst_1)) (Semiring.toNonAssocSemiring.{max u1 u2} (FreeAlgebra.{u2, u1} R _inst_1 X) (FreeAlgebra.instSemiringFreeAlgebra.{u2, u1} R _inst_1 X))) R (FreeAlgebra.{u2, u1} R _inst_1 X) (Semiring.toNonAssocSemiring.{u2} R (CommSemiring.toSemiring.{u2} R _inst_1)) (Semiring.toNonAssocSemiring.{max u1 u2} (FreeAlgebra.{u2, u1} R _inst_1 X) (FreeAlgebra.instSemiringFreeAlgebra.{u2, u1} R _inst_1 X)) (RingHom.instRingHomClassRingHom.{u2, max u2 u1} R (FreeAlgebra.{u2, u1} R _inst_1 X) (Semiring.toNonAssocSemiring.{u2} R (CommSemiring.toSemiring.{u2} R _inst_1)) (Semiring.toNonAssocSemiring.{max u1 u2} (FreeAlgebra.{u2, u1} R _inst_1 X) (FreeAlgebra.instSemiringFreeAlgebra.{u2, u1} R _inst_1 X)))))) (algebraMap.{u2, max u1 u2} R (FreeAlgebra.{u2, u1} R _inst_1 X) _inst_1 (FreeAlgebra.instSemiringFreeAlgebra.{u2, u1} R _inst_1 X) (FreeAlgebra.instAlgebraFreeAlgebraInstSemiringFreeAlgebra.{u2, u1} R _inst_1 X)) r)) -> (forall (x : X), C (FreeAlgebra.ι.{u2, u1} R _inst_1 X x)) -> (forall (a : FreeAlgebra.{u2, u1} R _inst_1 X) (b : FreeAlgebra.{u2, u1} R _inst_1 X), (C a) -> (C b) -> (C (HMul.hMul.{max u2 u1, max u2 u1, max u2 u1} (FreeAlgebra.{u2, u1} R _inst_1 X) (FreeAlgebra.{u2, u1} R _inst_1 X) (FreeAlgebra.{u2, u1} R _inst_1 X) (instHMul.{max u2 u1} (FreeAlgebra.{u2, u1} R _inst_1 X) (NonUnitalNonAssocSemiring.toMul.{max u2 u1} (FreeAlgebra.{u2, u1} R _inst_1 X) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{max u2 u1} (FreeAlgebra.{u2, u1} R _inst_1 X) (Semiring.toNonAssocSemiring.{max u2 u1} (FreeAlgebra.{u2, u1} R _inst_1 X) (FreeAlgebra.instSemiringFreeAlgebra.{u2, u1} R _inst_1 X))))) a b))) -> (forall (a : FreeAlgebra.{u2, u1} R _inst_1 X) (b : FreeAlgebra.{u2, u1} R _inst_1 X), (C a) -> (C b) -> (C (HAdd.hAdd.{max u2 u1, max u2 u1, max u2 u1} (FreeAlgebra.{u2, u1} R _inst_1 X) (FreeAlgebra.{u2, u1} R _inst_1 X) (FreeAlgebra.{u2, u1} R _inst_1 X) (instHAdd.{max u2 u1} (FreeAlgebra.{u2, u1} R _inst_1 X) (Distrib.toAdd.{max u2 u1} (FreeAlgebra.{u2, u1} R _inst_1 X) (NonUnitalNonAssocSemiring.toDistrib.{max u2 u1} (FreeAlgebra.{u2, u1} R _inst_1 X) (NonAssocSemiring.toNonUnitalNonAssocSemiring.{max u2 u1} (FreeAlgebra.{u2, u1} R _inst_1 X) (Semiring.toNonAssocSemiring.{max u2 u1} (FreeAlgebra.{u2, u1} R _inst_1 X) (FreeAlgebra.instSemiringFreeAlgebra.{u2, u1} R _inst_1 X)))))) a b))) -> (forall (a : FreeAlgebra.{u2, u1} R _inst_1 X), C a)
Case conversion may be inaccurate. Consider using '#align free_algebra.induction FreeAlgebra.inductionₓ'. -/
/-- An induction principle for the free algebra.

If `C` holds for the `algebra_map` of `r : R` into `free_algebra R X`, the `ι` of `x : X`, and is
preserved under addition and muliplication, then it holds for all of `free_algebra R X`.
-/
@[elab_as_elim]
theorem induction {C : FreeAlgebra R X → Prop}
    (h_grade0 : ∀ r, C (algebraMap R (FreeAlgebra R X) r)) (h_grade1 : ∀ x, C (ι R x))
    (h_mul : ∀ a b, C a → C b → C (a * b)) (h_add : ∀ a b, C a → C b → C (a + b))
    (a : FreeAlgebra R X) : C a :=
  by
  -- the arguments are enough to construct a subalgebra, and a mapping into it from X
  let s : Subalgebra R (FreeAlgebra R X) :=
    { carrier := C
      mul_mem' := h_mul
      add_mem' := h_add
      algebraMap_mem' := h_grade0 }
  let of : X → s := Subtype.coind (ι R) h_grade1
  -- the mapping through the subalgebra is the identity
  have of_id : AlgHom.id R (FreeAlgebra R X) = s.val.comp (lift R of) :=
    by
    ext
    simp [of, Subtype.coind]
  -- finding a proof is finding an element of the subalgebra
  convert Subtype.prop (lift R of a)
  simp [AlgHom.ext_iff] at of_id
  exact of_id a
#align free_algebra.induction FreeAlgebra.induction

end FreeAlgebra