l3lab/ntp-mathlib huggingface dataset:
lemma mk₅_surjective (X : ComposableArrows C 5) :
    ∃ (X₀ X₁ X₂ X₃ X₄ X₅ : C) (f₀ : X₀ ⟶ X₁) (f₁ : X₁ ⟶ X₂) (f₂ : X₂ ⟶ X₃)
      (f₃ : X₃ ⟶ X₄) (f₄ : X₄ ⟶ X₅), X = mk₅ f₀ f₁ f₂ f₃ f₄ :=
  ⟨_, _, _, _, _, _, X.map' 0 1, X.map' 1 2, X.map' 2 3, X.map' 3 4, X.map' 4 5,
    ext₅ rfl rfl rfl rfl rfl rfl (by simp) (by simp) (by simp) (by 

Proof state:
C : Type u_1
inst✝ : Category.{u_2, u_1} C
n m : ℕ
F G : ComposableArrows C n
X : ComposableArrows C 5
⊢ map' X 3 4 =
    eqToHom (_ : obj' X 3 = obj' X 3) ≫
      map' (mk₅ (map' X 0 1) (map' X 1 2) (map' X 2 3) (map' X 3 4) (map' X 4 5)) 3 4 ≫
        eqToHom (_ : obj' (mk₅ (map' X 0 1) (map' X 1 2) (map' X 2 3) (map' X 3 4) (map' X 4 5)) 4 = obj' X 4)

Next tactic:
simp
lemma mk₅_surjective (X : ComposableArrows C 5) :
    ∃ (X₀ X₁ X₂ X₃ X₄ X₅ : C) (f₀ : X₀ ⟶ X₁) (f₁ : X₁ ⟶ X₂) (f₂ : X₂ ⟶ X₃)
      (f₃ : X₃ ⟶ X₄) (f₄ : X₄ ⟶ X₅), X = mk₅ f₀ f₁ f₂ f₃ f₄ :=
  ⟨_, _, _, _, _, _, X.map' 0 1, X.map' 1 2, X.map' 2 3, X.map' 3 4, X.map' 4 5,
    ext₅ rfl rfl rfl rfl rfl rfl (by simp) (by simp) (by simp) (by simp) (by 

Proof state:
C : Type u_1
inst✝ : Category.{u_2, u_1} C
n m : ℕ
F G : ComposableArrows C n
X : ComposableArrows C 5
⊢ map' X 4 5 =
    eqToHom (_ : obj' X 4 = obj' X 4) ≫
      map' (mk₅ (map' X 0 1) (map' X 1 2) (map' X 2 3) (map' X 3 4) (map' X 4 5)) 4 5 ≫
        eqToHom (_ : obj' (mk₅ (map' X 0 1) (map' X 1 2) (map' X 2 3) (map' X 3 4) (map' X 4 5)) 5 = obj' X 5)

Next tactic:
simp
/-- For a reflective functor `i` (with left adjoint `L`), with unit `η`, we have `η_iL = iL η`.
-/
theorem unit_obj_eq_map_unit [Reflective i] (X : C) :
    (ofRightAdjoint i).unit.app (i.obj ((leftAdjoint i).obj X)) =
      i.map ((leftAdjoint i).map ((ofRightAdjoint i).unit.app X)) := by
  

Proof state:
C : Type u₁
D : Type u₂
E : Type u₃
inst✝³ : Category.{v₁, u₁} C
inst✝² : Category.{v₂, u₂} D
inst✝¹ : Category.{v₃, u₃} E
i : D ⥤ C
inst✝ : Reflective i
X : C
⊢ (ofRightAdjoint i).unit.app (i.obj ((leftAdjoint i).obj X)) =
    i.map ((leftAdjoint i).map ((ofRightAdjoint i).unit.app X))

Next tactic:
rw [← cancel_mono (i.map ((ofRightAdjoint i).counit.app ((leftAdjoint i).obj X))), ←
    i.map_comp]
/-- For a reflective functor `i` (with left adjoint `L`), with unit `η`, we have `η_iL = iL η`.
-/
theorem unit_obj_eq_map_unit [Reflective i] (X : C) :
    (ofRightAdjoint i).unit.app (i.obj ((leftAdjoint i).obj X)) =
      i.map ((leftAdjoint i).map ((ofRightAdjoint i).unit.app X)) := by
  rw [← cancel_mono (i.map ((ofRightAdjoint i).counit.app ((leftAdjoint i).obj X))), ←
    i.map_comp]
  

Proof state:
C : Type u₁
D : Type u₂
E : Type u₃
inst✝³ : Category.{v₁, u₁} C
inst✝² : Category.{v₂, u₂} D
inst✝¹ : Category.{v₃, u₃} E
i : D ⥤ C
inst✝ : Reflective i
X : C
⊢ (ofRightAdjoint i).unit.app (i.obj ((leftAdjoint i).obj X)) ≫
      i.map ((ofRightAdjoint i).counit.app ((leftAdjoint i).obj X)) =
    i.map ((leftAdjoint i).map ((ofRightAdjoint i).unit.app X) ≫ (ofRightAdjoint i).counit.app ((leftAdjoint i).obj X))

Next tactic:
simp
/--
When restricted to objects in `D` given by `i : D ⥤ C`, the unit is an isomorphism. In other words,
`η_iX` is an isomorphism for any `X` in `D`.
More generally this applies to objects essentially in the reflective subcategory, see
`Functor.essImage.unit_isIso`.
-/
instance isIso_unit_obj [Reflective i] {B : D} : IsIso ((ofRightAdjoint i).unit.app (i.obj B)) := by
  

Proof state:
C : Type u₁
D : Type u₂
E : Type u₃
inst✝³ : Category.{v₁, u₁} C
inst✝² : Category.{v₂, u₂} D
inst✝¹ : Category.{v₃, u₃} E
i : D ⥤ C
inst✝ : Reflective i
B : D
⊢ IsIso ((ofRightAdjoint i).unit.app (i.obj B))

Next tactic:
have : (ofRightAdjoint i).unit.app (i.obj B) = inv (i.map ((ofRightAdjoint i).counit.app B)) := by
    rw [← comp_hom_eq_id]
    apply (ofRightAdjoint i).right_triangle_components
/--
When restricted to objects in `D` given by `i : D ⥤ C`, the unit is an isomorphism. In other words,
`η_iX` is an isomorphism for any `X` in `D`.
More generally this applies to objects essentially in the reflective subcategory, see
`Functor.essImage.unit_isIso`.
-/
instance isIso_unit_obj [Reflective i] {B : D} : IsIso ((ofRightAdjoint i).unit.app (i.obj B)) := by
  have : (ofRightAdjoint i).unit.app (i.obj B) = inv (i.map ((ofRightAdjoint i).counit.app B)) := by
    

Proof state:
C : Type u₁
D : Type u₂
E : Type u₃
inst✝³ : Category.{v₁, u₁} C
inst✝² : Category.{v₂, u₂} D
inst✝¹ : Category.{v₃, u₃} E
i : D ⥤ C
inst✝ : Reflective i
B : D
⊢ (ofRightAdjoint i).unit.app (i.obj B) = inv (i.map ((ofRightAdjoint i).counit.app B))

Next tactic:
rw [← comp_hom_eq_id]
/--
When restricted to objects in `D` given by `i : D ⥤ C`, the unit is an isomorphism. In other words,
`η_iX` is an isomorphism for any `X` in `D`.
More generally this applies to objects essentially in the reflective subcategory, see
`Functor.essImage.unit_isIso`.
-/
instance isIso_unit_obj [Reflective i] {B : D} : IsIso ((ofRightAdjoint i).unit.app (i.obj B)) := by
  have : (ofRightAdjoint i).unit.app (i.obj B) = inv (i.map ((ofRightAdjoint i).counit.app B)) := by
    rw [← comp_hom_eq_id]
    

Proof state:
C : Type u₁
D : Type u₂
E : Type u₃
inst✝³ : Category.{v₁, u₁} C
inst✝² : Category.{v₂, u₂} D
inst✝¹ : Category.{v₃, u₃} E
i : D ⥤ C
inst✝ : Reflective i
B : D
⊢ (ofRightAdjoint i).unit.app (i.obj B) ≫ i.map ((ofRightAdjoint i).counit.app B) = 𝟙 ((𝟭 C).obj (i.obj B))

Next tactic:
apply (ofRightAdjoint i).right_triangle_components
/--
When restricted to objects in `D` given by `i : D ⥤ C`, the unit is an isomorphism. In other words,
`η_iX` is an isomorphism for any `X` in `D`.
More generally this applies to objects essentially in the reflective subcategory, see
`Functor.essImage.unit_isIso`.
-/
instance isIso_unit_obj [Reflective i] {B : D} : IsIso ((ofRightAdjoint i).unit.app (i.obj B)) := by
  have : (ofRightAdjoint i).unit.app (i.obj B) = inv (i.map ((ofRightAdjoint i).counit.app B)) := by
    rw [← comp_hom_eq_id]
    apply (ofRightAdjoint i).right_triangle_components
  

Proof state:
C : Type u₁
D : Type u₂
E : Type u₃
inst✝³ : Category.{v₁, u₁} C
inst✝² : Category.{v₂, u₂} D
inst✝¹ : Category.{v₃, u₃} E
i : D ⥤ C
inst✝ : Reflective i
B : D
this : (ofRightAdjoint i).unit.app (i.obj B) = inv (i.map ((ofRightAdjoint i).counit.app B))
⊢ IsIso ((ofRightAdjoint i).unit.app (i.obj B))

Next tactic:
rw [this]
/--
When restricted to objects in `D` given by `i : D ⥤ C`, the unit is an isomorphism. In other words,
`η_iX` is an isomorphism for any `X` in `D`.
More generally this applies to objects essentially in the reflective subcategory, see
`Functor.essImage.unit_isIso`.
-/
instance isIso_unit_obj [Reflective i] {B : D} : IsIso ((ofRightAdjoint i).unit.app (i.obj B)) := by
  have : (ofRightAdjoint i).unit.app (i.obj B) = inv (i.map ((ofRightAdjoint i).counit.app B)) := by
    rw [← comp_hom_eq_id]
    apply (ofRightAdjoint i).right_triangle_components
  rw [this]
  

Proof state:
C : Type u₁
D : Type u₂
E : Type u₃
inst✝³ : Category.{v₁, u₁} C
inst✝² : Category.{v₂, u₂} D
inst✝¹ : Category.{v₃, u₃} E
i : D ⥤ C
inst✝ : Reflective i
B : D
this : (ofRightAdjoint i).unit.app (i.obj B) = inv (i.map ((ofRightAdjoint i).counit.app B))
⊢ IsIso (inv (i.map ((ofRightAdjoint i).counit.app B)))

Next tactic:
exact IsIso.inv_isIso
/-- If `A` is essentially in the image of a reflective functor `i`, then `η_A` is an isomorphism.
This gives that the "witness" for `A` being in the essential image can instead be given as the
reflection of `A`, with the isomorphism as `η_A`.

(For any `B` in the reflective subcategory, we automatically have that `ε_B` is an iso.)
-/
theorem Functor.essImage.unit_isIso [Reflective i] {A : C} (h : A ∈ i.essImage) :
    IsIso ((ofRightAdjoint i).unit.app A) := by
  

Proof state:
C : Type u₁
D : Type u₂
E : Type u₃
inst✝³ : Category.{v₁, u₁} C
inst✝² : Category.{v₂, u₂} D
inst✝¹ : Category.{v₃, u₃} E
i : D ⥤ C
inst✝ : Reflective i
A : C
h : A ∈ essImage i
⊢ IsIso ((ofRightAdjoint i).unit.app A)

Next tactic:
suffices (ofRightAdjoint i).unit.app A = h.getIso.inv ≫
      (ofRightAdjoint i).unit.app (i.obj (Functor.essImage.witness h)) ≫
      (leftAdjoint i ⋙ i).map h.getIso.hom by
    rw [this]
    infer_instance
/-- If `A` is essentially in the image of a reflective functor `i`, then `η_A` is an isomorphism.
This gives that the "witness" for `A` being in the essential image can instead be given as the
reflection of `A`, with the isomorphism as `η_A`.

(For any `B` in the reflective subcategory, we automatically have that `ε_B` is an iso.)
-/
theorem Functor.essImage.unit_isIso [Reflective i] {A : C} (h : A ∈ i.essImage) :
    IsIso ((ofRightAdjoint i).unit.app A) := by
  suffices (ofRightAdjoint i).unit.app A = h.getIso.inv ≫
      (ofRightAdjoint i).unit.app (i.obj (Functor.essImage.witness h)) ≫
      (leftAdjoint i ⋙ i).map h.getIso.hom by
    

Proof state:
C : Type u₁
D : Type u₂
E : Type u₃
inst✝³ : Category.{v₁, u₁} C
inst✝² : Category.{v₂, u₂} D
inst✝¹ : Category.{v₃, u₃} E
i : D ⥤ C
inst✝ : Reflective i
A : C
h : A ∈ essImage i
this :
  (ofRightAdjoint i).unit.app A =
    (getIso h).inv ≫ (ofRightAdjoint i).unit.app (i.obj (witness h)) ≫ (leftAdjoint i ⋙ i).map (getIso h).hom
⊢ IsIso ((ofRightAdjoint i).unit.app A)

Next tactic:
rw [this]
/-- If `A` is essentially in the image of a reflective functor `i`, then `η_A` is an isomorphism.
This gives that the "witness" for `A` being in the essential image can instead be given as the
reflection of `A`, with the isomorphism as `η_A`.

(For any `B` in the reflective subcategory, we automatically have that `ε_B` is an iso.)
-/
theorem Functor.essImage.unit_isIso [Reflective i] {A : C} (h : A ∈ i.essImage) :
    IsIso ((ofRightAdjoint i).unit.app A) := by
  suffices (ofRightAdjoint i).unit.app A = h.getIso.inv ≫
      (ofRightAdjoint i).unit.app (i.obj (Functor.essImage.witness h)) ≫
      (leftAdjoint i ⋙ i).map h.getIso.hom by
    rw [this]
    

Proof state:
C : Type u₁
D : Type u₂
E : Type u₃
inst✝³ : Category.{v₁, u₁} C
inst✝² : Category.{v₂, u₂} D
inst✝¹ : Category.{v₃, u₃} E
i : D ⥤ C
inst✝ : Reflective i
A : C
h : A ∈ essImage i
this :
  (ofRightAdjoint i).unit.app A =
    (getIso h).inv ≫ (ofRightAdjoint i).unit.app (i.obj (witness h)) ≫ (leftAdjoint i ⋙ i).map (getIso h).hom
⊢ IsIso ((getIso h).inv ≫ (ofRightAdjoint i).unit.app (i.obj (witness h)) ≫ (leftAdjoint i ⋙ i).map (getIso h).hom)

Next tactic:
infer_instance
/-- If `A` is essentially in the image of a reflective functor `i`, then `η_A` is an isomorphism.
This gives that the "witness" for `A` being in the essential image can instead be given as the
reflection of `A`, with the isomorphism as `η_A`.

(For any `B` in the reflective subcategory, we automatically have that `ε_B` is an iso.)
-/
theorem Functor.essImage.unit_isIso [Reflective i] {A : C} (h : A ∈ i.essImage) :
    IsIso ((ofRightAdjoint i).unit.app A) := by
  suffices (ofRightAdjoint i).unit.app A = h.getIso.inv ≫
      (ofRightAdjoint i).unit.app (i.obj (Functor.essImage.witness h)) ≫
      (leftAdjoint i ⋙ i).map h.getIso.hom by
    rw [this]
    infer_instance
  

Proof state:
C : Type u₁
D : Type u₂
E : Type u₃
inst✝³ : Category.{v₁, u₁} C
inst✝² : Category.{v₂, u₂} D
inst✝¹ : Category.{v₃, u₃} E
i : D ⥤ C
inst✝ : Reflective i
A : C
h : A ∈ essImage i
⊢ (ofRightAdjoint i).unit.app A =
    (getIso h).inv ≫ (ofRightAdjoint i).unit.app (i.obj (witness h)) ≫ (leftAdjoint i ⋙ i).map (getIso h).hom

Next tactic:
rw [← NatTrans.naturality]
/-- If `A` is essentially in the image of a reflective functor `i`, then `η_A` is an isomorphism.
This gives that the "witness" for `A` being in the essential image can instead be given as the
reflection of `A`, with the isomorphism as `η_A`.

(For any `B` in the reflective subcategory, we automatically have that `ε_B` is an iso.)
-/
theorem Functor.essImage.unit_isIso [Reflective i] {A : C} (h : A ∈ i.essImage) :
    IsIso ((ofRightAdjoint i).unit.app A) := by
  suffices (ofRightAdjoint i).unit.app A = h.getIso.inv ≫
      (ofRightAdjoint i).unit.app (i.obj (Functor.essImage.witness h)) ≫
      (leftAdjoint i ⋙ i).map h.getIso.hom by
    rw [this]
    infer_instance
  rw [← NatTrans.naturality]
  

Proof state:
C : Type u₁
D : Type u₂
E : Type u₃
inst✝³ : Category.{v₁, u₁} C
inst✝² : Category.{v₂, u₂} D
inst✝¹ : Category.{v₃, u₃} E
i : D ⥤ C
inst✝ : Reflective i
A : C
h : A ∈ essImage i
⊢ (ofRightAdjoint i).unit.app A = (getIso h).inv ≫ (𝟭 C).map (getIso h).hom ≫ (ofRightAdjoint i).unit.app A

Next tactic:
simp
/-- If `η_A` is a split monomorphism, then `A` is in the reflective subcategory. -/
theorem mem_essImage_of_unit_isSplitMono [Reflective i] {A : C}
    [IsSplitMono ((ofRightAdjoint i).unit.app A)] : A ∈ i.essImage := by
  

Proof state:
C : Type u₁
D : Type u₂
E : Type u₃
inst✝⁴ : Category.{v₁, u₁} C
inst✝³ : Category.{v₂, u₂} D
inst✝² : Category.{v₃, u₃} E
i : D ⥤ C
inst✝¹ : Reflective i
A : C
inst✝ : IsSplitMono ((ofRightAdjoint i).unit.app A)
⊢ A ∈ Functor.essImage i

Next tactic:
let η : 𝟭 C ⟶ leftAdjoint i ⋙ i := (ofRightAdjoint i).unit
/-- If `η_A` is a split monomorphism, then `A` is in the reflective subcategory. -/
theorem mem_essImage_of_unit_isSplitMono [Reflective i] {A : C}
    [IsSplitMono ((ofRightAdjoint i).unit.app A)] : A ∈ i.essImage := by
  let η : 𝟭 C ⟶ leftAdjoint i ⋙ i := (ofRightAdjoint i).unit
  

Proof state:
C : Type u₁
D : Type u₂
E : Type u₃
inst✝⁴ : Category.{v₁, u₁} C
inst✝³ : Category.{v₂, u₂} D
inst✝² : Category.{v₃, u₃} E
i : D ⥤ C
inst✝¹ : Reflective i
A : C
inst✝ : IsSplitMono ((ofRightAdjoint i).unit.app A)
η : 𝟭 C ⟶ leftAdjoint i ⋙ i := (ofRightAdjoint i).unit
⊢ A ∈ Functor.essImage i

Next tactic:
haveI : IsIso (η.app (i.obj ((leftAdjoint i).obj A))) :=
    Functor.essImage.unit_isIso ((i.obj_mem_essImage _))
/-- If `η_A` is a split monomorphism, then `A` is in the reflective subcategory. -/
theorem mem_essImage_of_unit_isSplitMono [Reflective i] {A : C}
    [IsSplitMono ((ofRightAdjoint i).unit.app A)] : A ∈ i.essImage := by
  let η : 𝟭 C ⟶ leftAdjoint i ⋙ i := (ofRightAdjoint i).unit
  haveI : IsIso (η.app (i.obj ((leftAdjoint i).obj A))) :=
    Functor.essImage.unit_isIso ((i.obj_mem_essImage _))
  

Proof state:
C : Type u₁
D : Type u₂
E : Type u₃
inst✝⁴ : Category.{v₁, u₁} C
inst✝³ : Category.{v₂, u₂} D
inst✝² : Category.{v₃, u₃} E
i : D ⥤ C
inst✝¹ : Reflective i
A : C
inst✝ : IsSplitMono ((ofRightAdjoint i).unit.app A)
η : 𝟭 C ⟶ leftAdjoint i ⋙ i := (ofRightAdjoint i).unit
this : IsIso (η.app (i.obj ((leftAdjoint i).obj A)))
⊢ A ∈ Functor.essImage i

Next tactic:
have : Epi (η.app A) := by
    refine @epi_of_epi _ _ _ _ _ (retraction (η.app A)) (η.app A) ?_
    rw [show retraction _ ≫ η.app A = _ from η.naturality (retraction (η.app A))]
    apply epi_comp (η.app (i.obj ((leftAdjoint i).obj A)))
/-- If `η_A` is a split monomorphism, then `A` is in the reflective subcategory. -/
theorem mem_essImage_of_unit_isSplitMono [Reflective i] {A : C}
    [IsSplitMono ((ofRightAdjoint i).unit.app A)] : A ∈ i.essImage := by
  let η : 𝟭 C ⟶ leftAdjoint i ⋙ i := (ofRightAdjoint i).unit
  haveI : IsIso (η.app (i.obj ((leftAdjoint i).obj A))) :=
    Functor.essImage.unit_isIso ((i.obj_mem_essImage _))
  have : Epi (η.app A) := by
    

Proof state:
C : Type u₁
D : Type u₂
E : Type u₃
inst✝⁴ : Category.{v₁, u₁} C
inst✝³ : Category.{v₂, u₂} D
inst✝² : Category.{v₃, u₃} E
i : D ⥤ C
inst✝¹ : Reflective i
A : C
inst✝ : IsSplitMono ((ofRightAdjoint i).unit.app A)
η : 𝟭 C ⟶ leftAdjoint i ⋙ i := (ofRightAdjoint i).unit
this : IsIso (η.app (i.obj ((leftAdjoint i).obj A)))
⊢ Epi (η.app A)

Next tactic:
refine @epi_of_epi _ _ _ _ _ (retraction (η.app A)) (η.app A) ?_
/-- If `η_A` is a split monomorphism, then `A` is in the reflective subcategory. -/
theorem mem_essImage_of_unit_isSplitMono [Reflective i] {A : C}
    [IsSplitMono ((ofRightAdjoint i).unit.app A)] : A ∈ i.essImage := by
  let η : 𝟭 C ⟶ leftAdjoint i ⋙ i := (ofRightAdjoint i).unit
  haveI : IsIso (η.app (i.obj ((leftAdjoint i).obj A))) :=
    Functor.essImage.unit_isIso ((i.obj_mem_essImage _))
  have : Epi (η.app A) := by
    refine @epi_of_epi _ _ _ _ _ (retraction (η.app A)) (η.app A) ?_
    

Proof state:
C : Type u₁
D : Type u₂
E : Type u₃
inst✝⁴ : Category.{v₁, u₁} C
inst✝³ : Category.{v₂, u₂} D
inst✝² : Category.{v₃, u₃} E
i : D ⥤ C
inst✝¹ : Reflective i
A : C
inst✝ : IsSplitMono ((ofRightAdjoint i).unit.app A)
η : 𝟭 C ⟶ leftAdjoint i ⋙ i := (ofRightAdjoint i).unit
this : IsIso (η.app (i.obj ((leftAdjoint i).obj A)))
⊢ Epi (retraction (η.app A) ≫ η.app A)

Next tactic:
rw [show retraction _ ≫ η.app A = _ from η.naturality (retraction (η.app A))]
/-- If `η_A` is a split monomorphism, then `A` is in the reflective subcategory. -/
theorem mem_essImage_of_unit_isSplitMono [Reflective i] {A : C}
    [IsSplitMono ((ofRightAdjoint i).unit.app A)] : A ∈ i.essImage := by
  let η : 𝟭 C ⟶ leftAdjoint i ⋙ i := (ofRightAdjoint i).unit
  haveI : IsIso (η.app (i.obj ((leftAdjoint i).obj A))) :=
    Functor.essImage.unit_isIso ((i.obj_mem_essImage _))
  have : Epi (η.app A) := by
    refine @epi_of_epi _ _ _ _ _ (retraction (η.app A)) (η.app A) ?_
    rw [show retraction _ ≫ η.app A = _ from η.naturality (retraction (η.app A))]
    

Proof state:
C : Type u₁
D : Type u₂
E : Type u₃
inst✝⁴ : Category.{v₁, u₁} C
inst✝³ : Category.{v₂, u₂} D
inst✝² : Category.{v₃, u₃} E
i : D ⥤ C
inst✝¹ : Reflective i
A : C
inst✝ : IsSplitMono ((ofRightAdjoint i).unit.app A)
η : 𝟭 C ⟶ leftAdjoint i ⋙ i := (ofRightAdjoint i).unit
this : IsIso (η.app (i.obj ((leftAdjoint i).obj A)))
⊢ Epi (η.app ((leftAdjoint i ⋙ i).obj A) ≫ (leftAdjoint i ⋙ i).map (retraction (η.app A)))

Next tactic:
apply epi_comp (η.app (i.obj ((leftAdjoint i).obj A)))
/-- If `η_A` is a split monomorphism, then `A` is in the reflective subcategory. -/
theorem mem_essImage_of_unit_isSplitMono [Reflective i] {A : C}
    [IsSplitMono ((ofRightAdjoint i).unit.app A)] : A ∈ i.essImage := by
  let η : 𝟭 C ⟶ leftAdjoint i ⋙ i := (ofRightAdjoint i).unit
  haveI : IsIso (η.app (i.obj ((leftAdjoint i).obj A))) :=
    Functor.essImage.unit_isIso ((i.obj_mem_essImage _))
  have : Epi (η.app A) := by
    refine @epi_of_epi _ _ _ _ _ (retraction (η.app A)) (η.app A) ?_
    rw [show retraction _ ≫ η.app A = _ from η.naturality (retraction (η.app A))]
    apply epi_comp (η.app (i.obj ((leftAdjoint i).obj A)))
  

Proof state:
C : Type u₁
D : Type u₂
E : Type u₃
inst✝⁴ : Category.{v₁, u₁} C
inst✝³ : Category.{v₂, u₂} D
inst✝² : Category.{v₃, u₃} E
i : D ⥤ C
inst✝¹ : Reflective i
A : C
inst✝ : IsSplitMono ((ofRightAdjoint i).unit.app A)
η : 𝟭 C ⟶ leftAdjoint i ⋙ i := (ofRightAdjoint i).unit
this✝ : IsIso (η.app (i.obj ((leftAdjoint i).obj A)))
this : Epi (η.app A)
⊢ A ∈ Functor.essImage i

Next tactic:
skip
/-- If `η_A` is a split monomorphism, then `A` is in the reflective subcategory. -/
theorem mem_essImage_of_unit_isSplitMono [Reflective i] {A : C}
    [IsSplitMono ((ofRightAdjoint i).unit.app A)] : A ∈ i.essImage := by
  let η : 𝟭 C ⟶ leftAdjoint i ⋙ i := (ofRightAdjoint i).unit
  haveI : IsIso (η.app (i.obj ((leftAdjoint i).obj A))) :=
    Functor.essImage.unit_isIso ((i.obj_mem_essImage _))
  have : Epi (η.app A) := by
    refine @epi_of_epi _ _ _ _ _ (retraction (η.app A)) (η.app A) ?_
    rw [show retraction _ ≫ η.app A = _ from η.naturality (retraction (η.app A))]
    apply epi_comp (η.app (i.obj ((leftAdjoint i).obj A)))
  skip
  

Proof state:
C : Type u₁
D : Type u₂
E : Type u₃
inst✝⁴ : Category.{v₁, u₁} C
inst✝³ : Category.{v₂, u₂} D
inst✝² : Category.{v₃, u₃} E
i : D ⥤ C
inst✝¹ : Reflective i
A : C
inst✝ : IsSplitMono ((ofRightAdjoint i).unit.app A)
η : 𝟭 C ⟶ leftAdjoint i ⋙ i := (ofRightAdjoint i).unit
this✝ : IsIso (η.app (i.obj ((leftAdjoint i).obj A)))
this : Epi (η.app A)
⊢ A ∈ Functor.essImage i

Next tactic:
haveI := isIso_of_epi_of_isSplitMono (η.app A)
/-- If `η_A` is a split monomorphism, then `A` is in the reflective subcategory. -/
theorem mem_essImage_of_unit_isSplitMono [Reflective i] {A : C}
    [IsSplitMono ((ofRightAdjoint i).unit.app A)] : A ∈ i.essImage := by
  let η : 𝟭 C ⟶ leftAdjoint i ⋙ i := (ofRightAdjoint i).unit
  haveI : IsIso (η.app (i.obj ((leftAdjoint i).obj A))) :=
    Functor.essImage.unit_isIso ((i.obj_mem_essImage _))
  have : Epi (η.app A) := by
    refine @epi_of_epi _ _ _ _ _ (retraction (η.app A)) (η.app A) ?_
    rw [show retraction _ ≫ η.app A = _ from η.naturality (retraction (η.app A))]
    apply epi_comp (η.app (i.obj ((leftAdjoint i).obj A)))
  skip
  haveI := isIso_of_epi_of_isSplitMono (η.app A)
  

Proof state:
C : Type u₁
D : Type u₂
E : Type u₃
inst✝⁴ : Category.{v₁, u₁} C
inst✝³ : Category.{v₂, u₂} D
inst✝² : Category.{v₃, u₃} E
i : D ⥤ C
inst✝¹ : Reflective i
A : C
inst✝ : IsSplitMono ((ofRightAdjoint i).unit.app A)
η : 𝟭 C ⟶ leftAdjoint i ⋙ i := (ofRightAdjoint i).unit
this✝¹ : IsIso (η.app (i.obj ((leftAdjoint i).obj A)))
this✝ : Epi (η.app A)
this : IsIso (η.app A)
⊢ A ∈ Functor.essImage i

Next tactic:
exact mem_essImage_of_unit_isIso A
/-- The description of the inverse of the bijection `unitCompPartialBijectiveAux`. -/
theorem unitCompPartialBijectiveAux_symm_apply [Reflective i] {A : C} {B : D}
    (f : i.obj ((leftAdjoint i).obj A) ⟶ i.obj B) :
    (unitCompPartialBijectiveAux _ _).symm f = (ofRightAdjoint i).unit.app A ≫ f := by
  

Proof state:
C : Type u₁
D : Type u₂
E : Type u₃
inst✝³ : Category.{v₁, u₁} C
inst✝² : Category.{v₂, u₂} D
inst✝¹ : Category.{v₃, u₃} E
i : D ⥤ C
inst✝ : Reflective i
A : C
B : D
f : i.obj ((leftAdjoint i).obj A) ⟶ i.obj B
⊢ (unitCompPartialBijectiveAux A B).symm f = (ofRightAdjoint i).unit.app A ≫ f

Next tactic:
simp [unitCompPartialBijectiveAux]
@[simp]
theorem unitCompPartialBijective_symm_apply [Reflective i] (A : C) {B : C} (hB : B ∈ i.essImage)
    (f) : (unitCompPartialBijective A hB).symm f = (ofRightAdjoint i).unit.app A ≫ f := by
  

Proof state:
C : Type u₁
D : Type u₂
E : Type u₃
inst✝³ : Category.{v₁, u₁} C
inst✝² : Category.{v₂, u₂} D
inst✝¹ : Category.{v₃, u₃} E
i : D ⥤ C
inst✝ : Reflective i
A B : C
hB : B ∈ Functor.essImage i
f : i.obj ((leftAdjoint i).obj A) ⟶ B
⊢ (unitCompPartialBijective A hB).symm f = (ofRightAdjoint i).unit.app A ≫ f

Next tactic:
simp [unitCompPartialBijective, unitCompPartialBijectiveAux_symm_apply]
theorem unitCompPartialBijective_symm_natural [Reflective i] (A : C) {B B' : C} (h : B ⟶ B')
    (hB : B ∈ i.essImage) (hB' : B' ∈ i.essImage) (f : i.obj ((leftAdjoint i).obj A) ⟶ B) :
    (unitCompPartialBijective A hB').symm (f ≫ h) = (unitCompPartialBijective A hB).symm f ≫ h := by
  

Proof state:
C : Type u₁
D : Type u₂
E : Type u₃
inst✝³ : Category.{v₁, u₁} C
inst✝² : Category.{v₂, u₂} D
inst✝¹ : Category.{v₃, u₃} E
i : D ⥤ C
inst✝ : Reflective i
A B B' : C
h : B ⟶ B'
hB : B ∈ Functor.essImage i
hB' : B' ∈ Functor.essImage i
f : i.obj ((leftAdjoint i).obj A) ⟶ B
⊢ (unitCompPartialBijective A hB').symm (f ≫ h) = (unitCompPartialBijective A hB).symm f ≫ h

Next tactic:
simp
theorem unitCompPartialBijective_natural [Reflective i] (A : C) {B B' : C} (h : B ⟶ B')
    (hB : B ∈ i.essImage) (hB' : B' ∈ i.essImage) (f : A ⟶ B) :
    (unitCompPartialBijective A hB') (f ≫ h) = unitCompPartialBijective A hB f ≫ h := by
  

Proof state:
C : Type u₁
D : Type u₂
E : Type u₃
inst✝³ : Category.{v₁, u₁} C
inst✝² : Category.{v₂, u₂} D
inst✝¹ : Category.{v₃, u₃} E
i : D ⥤ C
inst✝ : Reflective i
A B B' : C
h : B ⟶ B'
hB : B ∈ Functor.essImage i
hB' : B' ∈ Functor.essImage i
f : A ⟶ B
⊢ (unitCompPartialBijective A hB') (f ≫ h) = (unitCompPartialBijective A hB) f ≫ h

Next tactic:
rw [← Equiv.eq_symm_apply, unitCompPartialBijective_symm_natural A h, Equiv.symm_apply_apply]
/-- The counit isomorphism of the equivalence `D ≌ i.EssImageSubcategory` given
by `equivEssImageOfReflective` when the functor `i` is reflective. -/
def equivEssImageOfReflective_counitIso_app [Reflective i] (X : Functor.EssImageSubcategory i) :
    ((Functor.essImageInclusion i ⋙ leftAdjoint i) ⋙ Functor.toEssImage i).obj X ≅ X := by
  

Proof state:
C : Type u₁
D : Type u₂
E : Type u₃
inst✝³ : Category.{v₁, u₁} C
inst✝² : Category.{v₂, u₂} D
inst✝¹ : Category.{v₃, u₃} E
i : D ⥤ C
inst✝ : Reflective i
X : Functor.EssImageSubcategory i
⊢ ((Functor.essImageInclusion i ⋙ leftAdjoint i) ⋙ Functor.toEssImage i).obj X ≅ X

Next tactic:
refine' Iso.symm (@asIso _ _ X _ ((ofRightAdjoint i).unit.app X.obj) ?_)