l3lab/ntp-mathlib huggingface dataset:
/-- The "free algebra" functor, sending a type `S` to the free algebra on `S`. -/
@[simps!]
def free : Type u ⥤ AlgebraCat.{u} R where
  obj S :=
    { carrier := FreeAlgebra R S
      isRing := Algebra.semiringToRing R }
  map f := FreeAlgebra.lift _ <| FreeAlgebra.ι _ ∘ f
  -- porting note: `apply FreeAlgebra.hom_ext` was `ext1`.
  map_id := by intro X; apply FreeAlgebra.hom_ext; simp only [FreeAlgebra.ι_comp_lift]; rfl
  map_comp := by
  -- porting note: `apply FreeAlgebra.hom_ext` was `ext1`.
    

Proof state:
R : Type u
inst✝ : CommRing R
M N U : ModuleCat R
⊢ ∀ {X Y Z : Type u} (f : X ⟶ Y) (g : Y ⟶ Z),
    { obj := fun S => mk (FreeAlgebra R S), map := fun {X Y} f => (FreeAlgebra.lift R) (FreeAlgebra.ι R ∘ f) }.map
        (f ≫ g) =
      { obj := fun S => mk (FreeAlgebra R S), map := fun {X Y} f => (FreeAlgebra.lift R) (FreeAlgebra.ι R ∘ f) }.map f ≫
        { obj := fun S => mk (FreeAlgebra R S), map := fun {X Y} f => (FreeAlgebra.lift R) (FreeAlgebra.ι R ∘ f) }.map g

Next tactic:
intros
/-- The "free algebra" functor, sending a type `S` to the free algebra on `S`. -/
@[simps!]
def free : Type u ⥤ AlgebraCat.{u} R where
  obj S :=
    { carrier := FreeAlgebra R S
      isRing := Algebra.semiringToRing R }
  map f := FreeAlgebra.lift _ <| FreeAlgebra.ι _ ∘ f
  -- porting note: `apply FreeAlgebra.hom_ext` was `ext1`.
  map_id := by intro X; apply FreeAlgebra.hom_ext; simp only [FreeAlgebra.ι_comp_lift]; rfl
  map_comp := by
  -- porting note: `apply FreeAlgebra.hom_ext` was `ext1`.
    intros; 

Proof state:
R : Type u
inst✝ : CommRing R
M N U : ModuleCat R
X✝ Y✝ Z✝ : Type u
f✝ : X✝ ⟶ Y✝
g✝ : Y✝ ⟶ Z✝
⊢ { obj := fun S => mk (FreeAlgebra R S), map := fun {X Y} f => (FreeAlgebra.lift R) (FreeAlgebra.ι R ∘ f) }.map
      (f✝ ≫ g✝) =
    { obj := fun S => mk (FreeAlgebra R S), map := fun {X Y} f => (FreeAlgebra.lift R) (FreeAlgebra.ι R ∘ f) }.map f✝ ≫
      { obj := fun S => mk (FreeAlgebra R S), map := fun {X Y} f => (FreeAlgebra.lift R) (FreeAlgebra.ι R ∘ f) }.map g✝

Next tactic:
apply FreeAlgebra.hom_ext
/-- The "free algebra" functor, sending a type `S` to the free algebra on `S`. -/
@[simps!]
def free : Type u ⥤ AlgebraCat.{u} R where
  obj S :=
    { carrier := FreeAlgebra R S
      isRing := Algebra.semiringToRing R }
  map f := FreeAlgebra.lift _ <| FreeAlgebra.ι _ ∘ f
  -- porting note: `apply FreeAlgebra.hom_ext` was `ext1`.
  map_id := by intro X; apply FreeAlgebra.hom_ext; simp only [FreeAlgebra.ι_comp_lift]; rfl
  map_comp := by
  -- porting note: `apply FreeAlgebra.hom_ext` was `ext1`.
    intros; apply FreeAlgebra.hom_ext; 

Proof state:
case w
R : Type u
inst✝ : CommRing R
M N U : ModuleCat R
X✝ Y✝ Z✝ : Type u
f✝ : X✝ ⟶ Y✝
g✝ : Y✝ ⟶ Z✝
⊢ ⇑({ obj := fun S => mk (FreeAlgebra R S), map := fun {X Y} f => (FreeAlgebra.lift R) (FreeAlgebra.ι R ∘ f) }.map
          (f✝ ≫ g✝)) ∘
      FreeAlgebra.ι R =
    ⇑({ obj := fun S => mk (FreeAlgebra R S), map := fun {X Y} f => (FreeAlgebra.lift R) (FreeAlgebra.ι R ∘ f) }.map
            f✝ ≫
          { obj := fun S => mk (FreeAlgebra R S), map := fun {X Y} f => (FreeAlgebra.lift R) (FreeAlgebra.ι R ∘ f) }.map
            g✝) ∘
      FreeAlgebra.ι R

Next tactic:
simp only [FreeAlgebra.ι_comp_lift]
/-- The "free algebra" functor, sending a type `S` to the free algebra on `S`. -/
@[simps!]
def free : Type u ⥤ AlgebraCat.{u} R where
  obj S :=
    { carrier := FreeAlgebra R S
      isRing := Algebra.semiringToRing R }
  map f := FreeAlgebra.lift _ <| FreeAlgebra.ι _ ∘ f
  -- porting note: `apply FreeAlgebra.hom_ext` was `ext1`.
  map_id := by intro X; apply FreeAlgebra.hom_ext; simp only [FreeAlgebra.ι_comp_lift]; rfl
  map_comp := by
  -- porting note: `apply FreeAlgebra.hom_ext` was `ext1`.
    intros; apply FreeAlgebra.hom_ext; simp only [FreeAlgebra.ι_comp_lift]; 

Proof state:
case w
R : Type u
inst✝ : CommRing R
M N U : ModuleCat R
X✝ Y✝ Z✝ : Type u
f✝ : X✝ ⟶ Y✝
g✝ : Y✝ ⟶ Z✝
⊢ FreeAlgebra.ι R ∘ (f✝ ≫ g✝) =
    ⇑((FreeAlgebra.lift R) (FreeAlgebra.ι R ∘ f✝) ≫ (FreeAlgebra.lift R) (FreeAlgebra.ι R ∘ g✝)) ∘ FreeAlgebra.ι R

Next tactic:
ext1
/-- The "free algebra" functor, sending a type `S` to the free algebra on `S`. -/
@[simps!]
def free : Type u ⥤ AlgebraCat.{u} R where
  obj S :=
    { carrier := FreeAlgebra R S
      isRing := Algebra.semiringToRing R }
  map f := FreeAlgebra.lift _ <| FreeAlgebra.ι _ ∘ f
  -- porting note: `apply FreeAlgebra.hom_ext` was `ext1`.
  map_id := by intro X; apply FreeAlgebra.hom_ext; simp only [FreeAlgebra.ι_comp_lift]; rfl
  map_comp := by
  -- porting note: `apply FreeAlgebra.hom_ext` was `ext1`.
    intros; apply FreeAlgebra.hom_ext; simp only [FreeAlgebra.ι_comp_lift]; ext1
    -- Porting node: this ↓ `erw` used to be handled by the `simp` below it
    

Proof state:
case w.h
R : Type u
inst✝ : CommRing R
M N U : ModuleCat R
X✝ Y✝ Z✝ : Type u
f✝ : X✝ ⟶ Y✝
g✝ : Y✝ ⟶ Z✝
x✝ : X✝
⊢ (FreeAlgebra.ι R ∘ (f✝ ≫ g✝)) x✝ =
    (⇑((FreeAlgebra.lift R) (FreeAlgebra.ι R ∘ f✝) ≫ (FreeAlgebra.lift R) (FreeAlgebra.ι R ∘ g✝)) ∘ FreeAlgebra.ι R) x✝

Next tactic:
erw [CategoryTheory.coe_comp]
/-- The "free algebra" functor, sending a type `S` to the free algebra on `S`. -/
@[simps!]
def free : Type u ⥤ AlgebraCat.{u} R where
  obj S :=
    { carrier := FreeAlgebra R S
      isRing := Algebra.semiringToRing R }
  map f := FreeAlgebra.lift _ <| FreeAlgebra.ι _ ∘ f
  -- porting note: `apply FreeAlgebra.hom_ext` was `ext1`.
  map_id := by intro X; apply FreeAlgebra.hom_ext; simp only [FreeAlgebra.ι_comp_lift]; rfl
  map_comp := by
  -- porting note: `apply FreeAlgebra.hom_ext` was `ext1`.
    intros; apply FreeAlgebra.hom_ext; simp only [FreeAlgebra.ι_comp_lift]; ext1
    -- Porting node: this ↓ `erw` used to be handled by the `simp` below it
    erw [CategoryTheory.coe_comp]
    

Proof state:
case w.h
R : Type u
inst✝ : CommRing R
M N U : ModuleCat R
X✝ Y✝ Z✝ : Type u
f✝ : X✝ ⟶ Y✝
g✝ : Y✝ ⟶ Z✝
x✝ : X✝
⊢ (FreeAlgebra.ι R ∘ (f✝ ≫ g✝)) x✝ =
    ((⇑((FreeAlgebra.lift R) (FreeAlgebra.ι R ∘ g✝)) ∘ ⇑((FreeAlgebra.lift R) (FreeAlgebra.ι R ∘ f✝))) ∘
        FreeAlgebra.ι R)
      x✝

Next tactic:
simp only [CategoryTheory.coe_comp, Function.comp_apply, types_comp_apply]
/-- The "free algebra" functor, sending a type `S` to the free algebra on `S`. -/
@[simps!]
def free : Type u ⥤ AlgebraCat.{u} R where
  obj S :=
    { carrier := FreeAlgebra R S
      isRing := Algebra.semiringToRing R }
  map f := FreeAlgebra.lift _ <| FreeAlgebra.ι _ ∘ f
  -- porting note: `apply FreeAlgebra.hom_ext` was `ext1`.
  map_id := by intro X; apply FreeAlgebra.hom_ext; simp only [FreeAlgebra.ι_comp_lift]; rfl
  map_comp := by
  -- porting note: `apply FreeAlgebra.hom_ext` was `ext1`.
    intros; apply FreeAlgebra.hom_ext; simp only [FreeAlgebra.ι_comp_lift]; ext1
    -- Porting node: this ↓ `erw` used to be handled by the `simp` below it
    erw [CategoryTheory.coe_comp]
    simp only [CategoryTheory.coe_comp, Function.comp_apply, types_comp_apply]
    -- Porting node: this ↓ `erw` and `rfl` used to be handled by the `simp` above
    

Proof state:
case w.h
R : Type u
inst✝ : CommRing R
M N U : ModuleCat R
X✝ Y✝ Z✝ : Type u
f✝ : X✝ ⟶ Y✝
g✝ : Y✝ ⟶ Z✝
x✝ : X✝
⊢ FreeAlgebra.ι R (g✝ (f✝ x✝)) =
    ((FreeAlgebra.lift R) (FreeAlgebra.ι R ∘ g✝)) (((FreeAlgebra.lift R) (FreeAlgebra.ι R ∘ f✝)) (FreeAlgebra.ι R x✝))

Next tactic:
erw [FreeAlgebra.lift_ι_apply, FreeAlgebra.lift_ι_apply]
/-- The "free algebra" functor, sending a type `S` to the free algebra on `S`. -/
@[simps!]
def free : Type u ⥤ AlgebraCat.{u} R where
  obj S :=
    { carrier := FreeAlgebra R S
      isRing := Algebra.semiringToRing R }
  map f := FreeAlgebra.lift _ <| FreeAlgebra.ι _ ∘ f
  -- porting note: `apply FreeAlgebra.hom_ext` was `ext1`.
  map_id := by intro X; apply FreeAlgebra.hom_ext; simp only [FreeAlgebra.ι_comp_lift]; rfl
  map_comp := by
  -- porting note: `apply FreeAlgebra.hom_ext` was `ext1`.
    intros; apply FreeAlgebra.hom_ext; simp only [FreeAlgebra.ι_comp_lift]; ext1
    -- Porting node: this ↓ `erw` used to be handled by the `simp` below it
    erw [CategoryTheory.coe_comp]
    simp only [CategoryTheory.coe_comp, Function.comp_apply, types_comp_apply]
    -- Porting node: this ↓ `erw` and `rfl` used to be handled by the `simp` above
    erw [FreeAlgebra.lift_ι_apply, FreeAlgebra.lift_ι_apply]
    

Proof state:
case w.h
R : Type u
inst✝ : CommRing R
M N U : ModuleCat R
X✝ Y✝ Z✝ : Type u
f✝ : X✝ ⟶ Y✝
g✝ : Y✝ ⟶ Z✝
x✝ : X✝
⊢ FreeAlgebra.ι R (g✝ (f✝ x✝)) = (FreeAlgebra.ι R ∘ g✝) (f✝ x✝)

Next tactic:
rfl
/-- The free/forget adjunction for `R`-algebras. -/
def adj : free.{u} R ⊣ forget (AlgebraCat.{u} R) :=
  Adjunction.mkOfHomEquiv
    { homEquiv := fun X A => (FreeAlgebra.lift _).symm
      -- Relying on `obviously` to fill out these proofs is very slow :(
      homEquiv_naturality_left_symm := by
        -- porting note: `apply FreeAlgebra.hom_ext` was `ext1`.
        

Proof state:
R : Type u
inst✝ : CommRing R
M N U : ModuleCat R
⊢ ∀ {X' X : Type u} {Y : AlgebraCat R} (f : X' ⟶ X) (g : X ⟶ (forget (AlgebraCat R)).obj Y),
    ((fun X A => (FreeAlgebra.lift R).symm) X' Y).symm (f ≫ g) =
      (free R).map f ≫ ((fun X A => (FreeAlgebra.lift R).symm) X Y).symm g

Next tactic:
intros
/-- The free/forget adjunction for `R`-algebras. -/
def adj : free.{u} R ⊣ forget (AlgebraCat.{u} R) :=
  Adjunction.mkOfHomEquiv
    { homEquiv := fun X A => (FreeAlgebra.lift _).symm
      -- Relying on `obviously` to fill out these proofs is very slow :(
      homEquiv_naturality_left_symm := by
        -- porting note: `apply FreeAlgebra.hom_ext` was `ext1`.
        intros; 

Proof state:
R : Type u
inst✝ : CommRing R
M N U : ModuleCat R
X'✝ X✝ : Type u
Y✝ : AlgebraCat R
f✝ : X'✝ ⟶ X✝
g✝ : X✝ ⟶ (forget (AlgebraCat R)).obj Y✝
⊢ ((fun X A => (FreeAlgebra.lift R).symm) X'✝ Y✝).symm (f✝ ≫ g✝) =
    (free R).map f✝ ≫ ((fun X A => (FreeAlgebra.lift R).symm) X✝ Y✝).symm g✝

Next tactic:
apply FreeAlgebra.hom_ext
/-- The free/forget adjunction for `R`-algebras. -/
def adj : free.{u} R ⊣ forget (AlgebraCat.{u} R) :=
  Adjunction.mkOfHomEquiv
    { homEquiv := fun X A => (FreeAlgebra.lift _).symm
      -- Relying on `obviously` to fill out these proofs is very slow :(
      homEquiv_naturality_left_symm := by
        -- porting note: `apply FreeAlgebra.hom_ext` was `ext1`.
        intros; apply FreeAlgebra.hom_ext; 

Proof state:
case w
R : Type u
inst✝ : CommRing R
M N U : ModuleCat R
X'✝ X✝ : Type u
Y✝ : AlgebraCat R
f✝ : X'✝ ⟶ X✝
g✝ : X✝ ⟶ (forget (AlgebraCat R)).obj Y✝
⊢ ⇑(((fun X A => (FreeAlgebra.lift R).symm) X'✝ Y✝).symm (f✝ ≫ g✝)) ∘ FreeAlgebra.ι R =
    ⇑((free R).map f✝ ≫ ((fun X A => (FreeAlgebra.lift R).symm) X✝ Y✝).symm g✝) ∘ FreeAlgebra.ι R

Next tactic:
simp only [FreeAlgebra.ι_comp_lift]
/-- The free/forget adjunction for `R`-algebras. -/
def adj : free.{u} R ⊣ forget (AlgebraCat.{u} R) :=
  Adjunction.mkOfHomEquiv
    { homEquiv := fun X A => (FreeAlgebra.lift _).symm
      -- Relying on `obviously` to fill out these proofs is very slow :(
      homEquiv_naturality_left_symm := by
        -- porting note: `apply FreeAlgebra.hom_ext` was `ext1`.
        intros; apply FreeAlgebra.hom_ext; simp only [FreeAlgebra.ι_comp_lift]; 

Proof state:
case w
R : Type u
inst✝ : CommRing R
M N U : ModuleCat R
X'✝ X✝ : Type u
Y✝ : AlgebraCat R
f✝ : X'✝ ⟶ X✝
g✝ : X✝ ⟶ (forget (AlgebraCat R)).obj Y✝
⊢ ⇑((FreeAlgebra.lift R).symm.symm (f✝ ≫ g✝)) ∘ FreeAlgebra.ι R =
    ⇑((free R).map f✝ ≫ (FreeAlgebra.lift R).symm.symm g✝) ∘ FreeAlgebra.ι R

Next tactic:
ext1
/-- The free/forget adjunction for `R`-algebras. -/
def adj : free.{u} R ⊣ forget (AlgebraCat.{u} R) :=
  Adjunction.mkOfHomEquiv
    { homEquiv := fun X A => (FreeAlgebra.lift _).symm
      -- Relying on `obviously` to fill out these proofs is very slow :(
      homEquiv_naturality_left_symm := by
        -- porting note: `apply FreeAlgebra.hom_ext` was `ext1`.
        intros; apply FreeAlgebra.hom_ext; simp only [FreeAlgebra.ι_comp_lift]; ext1
        

Proof state:
case w.h
R : Type u
inst✝ : CommRing R
M N U : ModuleCat R
X'✝ X✝ : Type u
Y✝ : AlgebraCat R
f✝ : X'✝ ⟶ X✝
g✝ : X✝ ⟶ (forget (AlgebraCat R)).obj Y✝
x✝ : X'✝
⊢ (⇑((FreeAlgebra.lift R).symm.symm (f✝ ≫ g✝)) ∘ FreeAlgebra.ι R) x✝ =
    (⇑((free R).map f✝ ≫ (FreeAlgebra.lift R).symm.symm g✝) ∘ FreeAlgebra.ι R) x✝

Next tactic:
simp only [free_map, Equiv.symm_symm, FreeAlgebra.lift_ι_apply, CategoryTheory.coe_comp,
          Function.comp_apply, types_comp_apply]
/-- The free/forget adjunction for `R`-algebras. -/
def adj : free.{u} R ⊣ forget (AlgebraCat.{u} R) :=
  Adjunction.mkOfHomEquiv
    { homEquiv := fun X A => (FreeAlgebra.lift _).symm
      -- Relying on `obviously` to fill out these proofs is very slow :(
      homEquiv_naturality_left_symm := by
        -- porting note: `apply FreeAlgebra.hom_ext` was `ext1`.
        intros; apply FreeAlgebra.hom_ext; simp only [FreeAlgebra.ι_comp_lift]; ext1
        simp only [free_map, Equiv.symm_symm, FreeAlgebra.lift_ι_apply, CategoryTheory.coe_comp,
          Function.comp_apply, types_comp_apply]
        -- Porting node: this ↓ `erw` and `rfl` used to be handled by the `simp` above
        

Proof state:
case w.h
R : Type u
inst✝ : CommRing R
M N U : ModuleCat R
X'✝ X✝ : Type u
Y✝ : AlgebraCat R
f✝ : X'✝ ⟶ X✝
g✝ : X✝ ⟶ (forget (AlgebraCat R)).obj Y✝
x✝ : X'✝
⊢ ((FreeAlgebra.lift R) (f✝ ≫ g✝)) (FreeAlgebra.ι R x✝) =
    ((FreeAlgebra.lift R) (FreeAlgebra.ι R ∘ f✝) ≫ (FreeAlgebra.lift R) g✝) (FreeAlgebra.ι R x✝)

Next tactic:
erw [FreeAlgebra.lift_ι_apply, CategoryTheory.comp_apply, FreeAlgebra.lift_ι_apply,
          Function.comp_apply, FreeAlgebra.lift_ι_apply]
/-- The free/forget adjunction for `R`-algebras. -/
def adj : free.{u} R ⊣ forget (AlgebraCat.{u} R) :=
  Adjunction.mkOfHomEquiv
    { homEquiv := fun X A => (FreeAlgebra.lift _).symm
      -- Relying on `obviously` to fill out these proofs is very slow :(
      homEquiv_naturality_left_symm := by
        -- porting note: `apply FreeAlgebra.hom_ext` was `ext1`.
        intros; apply FreeAlgebra.hom_ext; simp only [FreeAlgebra.ι_comp_lift]; ext1
        simp only [free_map, Equiv.symm_symm, FreeAlgebra.lift_ι_apply, CategoryTheory.coe_comp,
          Function.comp_apply, types_comp_apply]
        -- Porting node: this ↓ `erw` and `rfl` used to be handled by the `simp` above
        erw [FreeAlgebra.lift_ι_apply, CategoryTheory.comp_apply, FreeAlgebra.lift_ι_apply,
          Function.comp_apply, FreeAlgebra.lift_ι_apply]
        

Proof state:
case w.h
R : Type u
inst✝ : CommRing R
M N U : ModuleCat R
X'✝ X✝ : Type u
Y✝ : AlgebraCat R
f✝ : X'✝ ⟶ X✝
g✝ : X✝ ⟶ (forget (AlgebraCat R)).obj Y✝
x✝ : X'✝
⊢ (f✝ ≫ g✝) x✝ = g✝ (f✝ x✝)

Next tactic:
rfl
/-- The free/forget adjunction for `R`-algebras. -/
def adj : free.{u} R ⊣ forget (AlgebraCat.{u} R) :=
  Adjunction.mkOfHomEquiv
    { homEquiv := fun X A => (FreeAlgebra.lift _).symm
      -- Relying on `obviously` to fill out these proofs is very slow :(
      homEquiv_naturality_left_symm := by
        -- porting note: `apply FreeAlgebra.hom_ext` was `ext1`.
        intros; apply FreeAlgebra.hom_ext; simp only [FreeAlgebra.ι_comp_lift]; ext1
        simp only [free_map, Equiv.symm_symm, FreeAlgebra.lift_ι_apply, CategoryTheory.coe_comp,
          Function.comp_apply, types_comp_apply]
        -- Porting node: this ↓ `erw` and `rfl` used to be handled by the `simp` above
        erw [FreeAlgebra.lift_ι_apply, CategoryTheory.comp_apply, FreeAlgebra.lift_ι_apply,
          Function.comp_apply, FreeAlgebra.lift_ι_apply]
        rfl
      homEquiv_naturality_right := by
        

Proof state:
R : Type u
inst✝ : CommRing R
M N U : ModuleCat R
⊢ ∀ {X : Type u} {Y Y' : AlgebraCat R} (f : (free R).obj X ⟶ Y) (g : Y ⟶ Y'),
    ((fun X A => (FreeAlgebra.lift R).symm) X Y') (f ≫ g) =
      ((fun X A => (FreeAlgebra.lift R).symm) X Y) f ≫ (forget (AlgebraCat R)).map g

Next tactic:
intros
/-- The free/forget adjunction for `R`-algebras. -/
def adj : free.{u} R ⊣ forget (AlgebraCat.{u} R) :=
  Adjunction.mkOfHomEquiv
    { homEquiv := fun X A => (FreeAlgebra.lift _).symm
      -- Relying on `obviously` to fill out these proofs is very slow :(
      homEquiv_naturality_left_symm := by
        -- porting note: `apply FreeAlgebra.hom_ext` was `ext1`.
        intros; apply FreeAlgebra.hom_ext; simp only [FreeAlgebra.ι_comp_lift]; ext1
        simp only [free_map, Equiv.symm_symm, FreeAlgebra.lift_ι_apply, CategoryTheory.coe_comp,
          Function.comp_apply, types_comp_apply]
        -- Porting node: this ↓ `erw` and `rfl` used to be handled by the `simp` above
        erw [FreeAlgebra.lift_ι_apply, CategoryTheory.comp_apply, FreeAlgebra.lift_ι_apply,
          Function.comp_apply, FreeAlgebra.lift_ι_apply]
        rfl
      homEquiv_naturality_right := by
        intros; 

Proof state:
R : Type u
inst✝ : CommRing R
M N U : ModuleCat R
X✝ : Type u
Y✝ Y'✝ : AlgebraCat R
f✝ : (free R).obj X✝ ⟶ Y✝
g✝ : Y✝ ⟶ Y'✝
⊢ ((fun X A => (FreeAlgebra.lift R).symm) X✝ Y'✝) (f✝ ≫ g✝) =
    ((fun X A => (FreeAlgebra.lift R).symm) X✝ Y✝) f✝ ≫ (forget (AlgebraCat R)).map g✝

Next tactic:
ext
/-- The free/forget adjunction for `R`-algebras. -/
def adj : free.{u} R ⊣ forget (AlgebraCat.{u} R) :=
  Adjunction.mkOfHomEquiv
    { homEquiv := fun X A => (FreeAlgebra.lift _).symm
      -- Relying on `obviously` to fill out these proofs is very slow :(
      homEquiv_naturality_left_symm := by
        -- porting note: `apply FreeAlgebra.hom_ext` was `ext1`.
        intros; apply FreeAlgebra.hom_ext; simp only [FreeAlgebra.ι_comp_lift]; ext1
        simp only [free_map, Equiv.symm_symm, FreeAlgebra.lift_ι_apply, CategoryTheory.coe_comp,
          Function.comp_apply, types_comp_apply]
        -- Porting node: this ↓ `erw` and `rfl` used to be handled by the `simp` above
        erw [FreeAlgebra.lift_ι_apply, CategoryTheory.comp_apply, FreeAlgebra.lift_ι_apply,
          Function.comp_apply, FreeAlgebra.lift_ι_apply]
        rfl
      homEquiv_naturality_right := by
        intros; ext
        

Proof state:
case h
R : Type u
inst✝ : CommRing R
M N U : ModuleCat R
X✝ : Type u
Y✝ Y'✝ : AlgebraCat R
f✝ : (free R).obj X✝ ⟶ Y✝
g✝ : Y✝ ⟶ Y'✝
a✝ : X✝
⊢ ((fun X A => (FreeAlgebra.lift R).symm) X✝ Y'✝) (f✝ ≫ g✝) a✝ =
    (((fun X A => (FreeAlgebra.lift R).symm) X✝ Y✝) f✝ ≫ (forget (AlgebraCat R)).map g✝) a✝

Next tactic:
simp only [CategoryTheory.coe_comp, Function.comp_apply,
          FreeAlgebra.lift_symm_apply, types_comp_apply]
/-- The free/forget adjunction for `R`-algebras. -/
def adj : free.{u} R ⊣ forget (AlgebraCat.{u} R) :=
  Adjunction.mkOfHomEquiv
    { homEquiv := fun X A => (FreeAlgebra.lift _).symm
      -- Relying on `obviously` to fill out these proofs is very slow :(
      homEquiv_naturality_left_symm := by
        -- porting note: `apply FreeAlgebra.hom_ext` was `ext1`.
        intros; apply FreeAlgebra.hom_ext; simp only [FreeAlgebra.ι_comp_lift]; ext1
        simp only [free_map, Equiv.symm_symm, FreeAlgebra.lift_ι_apply, CategoryTheory.coe_comp,
          Function.comp_apply, types_comp_apply]
        -- Porting node: this ↓ `erw` and `rfl` used to be handled by the `simp` above
        erw [FreeAlgebra.lift_ι_apply, CategoryTheory.comp_apply, FreeAlgebra.lift_ι_apply,
          Function.comp_apply, FreeAlgebra.lift_ι_apply]
        rfl
      homEquiv_naturality_right := by
        intros; ext
        simp only [CategoryTheory.coe_comp, Function.comp_apply,
          FreeAlgebra.lift_symm_apply, types_comp_apply]
        -- Porting note: proof used to be done after this ↑ `simp`; added ↓ two lines
        

Proof state:
case h
R : Type u
inst✝ : CommRing R
M N U : ModuleCat R
X✝ : Type u
Y✝ Y'✝ : AlgebraCat R
f✝ : (free R).obj X✝ ⟶ Y✝
g✝ : Y✝ ⟶ Y'✝
a✝ : X✝
⊢ (FreeAlgebra.lift R).symm (f✝ ≫ g✝) a✝ = (forget (AlgebraCat R)).map g✝ ((FreeAlgebra.lift R).symm f✝ a✝)

Next tactic:
erw [FreeAlgebra.lift_symm_apply, FreeAlgebra.lift_symm_apply]
/-- The free/forget adjunction for `R`-algebras. -/
def adj : free.{u} R ⊣ forget (AlgebraCat.{u} R) :=
  Adjunction.mkOfHomEquiv
    { homEquiv := fun X A => (FreeAlgebra.lift _).symm
      -- Relying on `obviously` to fill out these proofs is very slow :(
      homEquiv_naturality_left_symm := by
        -- porting note: `apply FreeAlgebra.hom_ext` was `ext1`.
        intros; apply FreeAlgebra.hom_ext; simp only [FreeAlgebra.ι_comp_lift]; ext1
        simp only [free_map, Equiv.symm_symm, FreeAlgebra.lift_ι_apply, CategoryTheory.coe_comp,
          Function.comp_apply, types_comp_apply]
        -- Porting node: this ↓ `erw` and `rfl` used to be handled by the `simp` above
        erw [FreeAlgebra.lift_ι_apply, CategoryTheory.comp_apply, FreeAlgebra.lift_ι_apply,
          Function.comp_apply, FreeAlgebra.lift_ι_apply]
        rfl
      homEquiv_naturality_right := by
        intros; ext
        simp only [CategoryTheory.coe_comp, Function.comp_apply,
          FreeAlgebra.lift_symm_apply, types_comp_apply]
        -- Porting note: proof used to be done after this ↑ `simp`; added ↓ two lines
        erw [FreeAlgebra.lift_symm_apply, FreeAlgebra.lift_symm_apply]
        

Proof state:
case h
R : Type u
inst✝ : CommRing R
M N U : ModuleCat R
X✝ : Type u
Y✝ Y'✝ : AlgebraCat R
f✝ : (free R).obj X✝ ⟶ Y✝
g✝ : Y✝ ⟶ Y'✝
a✝ : X✝
⊢ (⇑(f✝ ≫ g✝) ∘ FreeAlgebra.ι R) a✝ = (forget (AlgebraCat R)).map g✝ ((⇑f✝ ∘ FreeAlgebra.ι R) a✝)

Next tactic:
rfl
/-- Build an isomorphism in the category `AlgebraCat R` from a `AlgEquiv` between `Algebra`s. -/
@[simps]
def AlgEquiv.toAlgebraIso {g₁ : Ring X₁} {g₂ : Ring X₂} {m₁ : Algebra R X₁} {m₂ : Algebra R X₂}
    (e : X₁ ≃ₐ[R] X₂) : AlgebraCat.of R X₁ ≅ AlgebraCat.of R X₂ where
  hom := (e : X₁ →ₐ[R] X₂)
  inv := (e.symm : X₂ →ₐ[R] X₁)
  hom_inv_id := by 

Proof state:
R : Type u
inst✝ : CommRing R
X₁ X₂ : Type u
g₁ : Ring X₁
g₂ : Ring X₂
m₁ : Algebra R X₁
m₂ : Algebra R X₂
e : X₁ ≃ₐ[R] X₂
⊢ ↑e ≫ ↑(symm e) = 𝟙 (AlgebraCat.of R X₁)

Next tactic:
ext x
/-- Build an isomorphism in the category `AlgebraCat R` from a `AlgEquiv` between `Algebra`s. -/
@[simps]
def AlgEquiv.toAlgebraIso {g₁ : Ring X₁} {g₂ : Ring X₂} {m₁ : Algebra R X₁} {m₂ : Algebra R X₂}
    (e : X₁ ≃ₐ[R] X₂) : AlgebraCat.of R X₁ ≅ AlgebraCat.of R X₂ where
  hom := (e : X₁ →ₐ[R] X₂)
  inv := (e.symm : X₂ →ₐ[R] X₁)
  hom_inv_id := by ext x; 

Proof state:
case w
R : Type u
inst✝ : CommRing R
X₁ X₂ : Type u
g₁ : Ring X₁
g₂ : Ring X₂
m₁ : Algebra R X₁
m₂ : Algebra R X₂
e : X₁ ≃ₐ[R] X₂
x : (forget (AlgebraCat R)).obj (AlgebraCat.of R X₁)
⊢ (↑e ≫ ↑(symm e)) x = (𝟙 (AlgebraCat.of R X₁)) x

Next tactic:
exact e.left_inv x
/-- Build an isomorphism in the category `AlgebraCat R` from a `AlgEquiv` between `Algebra`s. -/
@[simps]
def AlgEquiv.toAlgebraIso {g₁ : Ring X₁} {g₂ : Ring X₂} {m₁ : Algebra R X₁} {m₂ : Algebra R X₂}
    (e : X₁ ≃ₐ[R] X₂) : AlgebraCat.of R X₁ ≅ AlgebraCat.of R X₂ where
  hom := (e : X₁ →ₐ[R] X₂)
  inv := (e.symm : X₂ →ₐ[R] X₁)
  hom_inv_id := by ext x; exact e.left_inv x
  inv_hom_id := by 

Proof state:
R : Type u
inst✝ : CommRing R
X₁ X₂ : Type u
g₁ : Ring X₁
g₂ : Ring X₂
m₁ : Algebra R X₁
m₂ : Algebra R X₂
e : X₁ ≃ₐ[R] X₂
⊢ ↑(symm e) ≫ ↑e = 𝟙 (AlgebraCat.of R X₂)

Next tactic:
ext x
/-- Build an isomorphism in the category `AlgebraCat R` from a `AlgEquiv` between `Algebra`s. -/
@[simps]
def AlgEquiv.toAlgebraIso {g₁ : Ring X₁} {g₂ : Ring X₂} {m₁ : Algebra R X₁} {m₂ : Algebra R X₂}
    (e : X₁ ≃ₐ[R] X₂) : AlgebraCat.of R X₁ ≅ AlgebraCat.of R X₂ where
  hom := (e : X₁ →ₐ[R] X₂)
  inv := (e.symm : X₂ →ₐ[R] X₁)
  hom_inv_id := by ext x; exact e.left_inv x
  inv_hom_id := by ext x; 

Proof state:
case w
R : Type u
inst✝ : CommRing R
X₁ X₂ : Type u
g₁ : Ring X₁
g₂ : Ring X₂
m₁ : Algebra R X₁
m₂ : Algebra R X₂
e : X₁ ≃ₐ[R] X₂
x : (forget (AlgebraCat R)).obj (AlgebraCat.of R X₂)
⊢ (↑(symm e) ≫ ↑e) x = (𝟙 (AlgebraCat.of R X₂)) x

Next tactic:
exact e.right_inv x
/-- Build a `AlgEquiv` from an isomorphism in the category `AlgebraCat R`. -/
@[simps]
def toAlgEquiv {X Y : AlgebraCat R} (i : X ≅ Y) : X ≃ₐ[R] Y where
  toFun := i.hom
  invFun := i.inv
  left_inv x := by
    -- porting note: was `by tidy`
    

Proof state:
R : Type u
inst✝ : CommRing R
X₁ X₂ : Type u
X Y : AlgebraCat R
i : X ≅ Y
x : ↑X
⊢ i.inv (i.hom x) = x

Next tactic:
change (i.hom ≫ i.inv) x = x