l3lab/ntp-mathlib huggingface dataset:
/-- This is a cofork which is helpful for establishing monadicity: the morphism from the Beck
coequalizer to this cofork is the unit for the adjunction on the comparison functor.
-/
@[simps! pt]
def unitCofork (A : (adj).toMonad.Algebra)
    [HasCoequalizer ((F).map A.a) ((adj).counit.app ((F).obj A.A))] :
    Cofork (G.map ((F).map A.a)) (G.map ((adj).counit.app ((F).obj A.A))) :=
  Cofork.ofπ (G.map (coequalizer.π ((F).map A.a) ((adj).counit.app ((F).obj A.A))))
    (by
      

Proof state:
C : Type u₁
D : Type u₂
inst✝³ : Category.{v₁, u₁} C
inst✝² : Category.{v₁, u₂} D
G : D ⥤ C
inst✝¹ : IsRightAdjoint G
A : Algebra (Adjunction.toMonad adj)
inst✝ : HasCoequalizer (F.map A.a) (adj.counit.app (F.obj A.A))
⊢ G.map (F.map A.a) ≫ G.map (coequalizer.π (F.map A.a) (adj.counit.app (F.obj A.A))) =
    G.map (adj.counit.app (F.obj A.A)) ≫ G.map (coequalizer.π (F.map A.a) (adj.counit.app (F.obj A.A)))

Next tactic:
change _ = G.map _ ≫ _
/-- This is a cofork which is helpful for establishing monadicity: the morphism from the Beck
coequalizer to this cofork is the unit for the adjunction on the comparison functor.
-/
@[simps! pt]
def unitCofork (A : (adj).toMonad.Algebra)
    [HasCoequalizer ((F).map A.a) ((adj).counit.app ((F).obj A.A))] :
    Cofork (G.map ((F).map A.a)) (G.map ((adj).counit.app ((F).obj A.A))) :=
  Cofork.ofπ (G.map (coequalizer.π ((F).map A.a) ((adj).counit.app ((F).obj A.A))))
    (by
      change _ = G.map _ ≫ _
      

Proof state:
C : Type u₁
D : Type u₂
inst✝³ : Category.{v₁, u₁} C
inst✝² : Category.{v₁, u₂} D
G : D ⥤ C
inst✝¹ : IsRightAdjoint G
A : Algebra (Adjunction.toMonad adj)
inst✝ : HasCoequalizer (F.map A.a) (adj.counit.app (F.obj A.A))
⊢ G.map (F.map A.a) ≫ G.map (coequalizer.π (F.map A.a) (adj.counit.app (F.obj A.A))) =
    G.map (adj.counit.app (F.obj A.A)) ≫ G.map (coequalizer.π (F.map A.a) (adj.counit.app (F.obj A.A)))

Next tactic:
rw [← G.map_comp, coequalizer.condition, G.map_comp]
theorem comparisonAdjunction_unit_f
    [∀ A : (adj).toMonad.Algebra, HasCoequalizer ((F).map A.a)
      ((adj).counit.app ((F).obj A.A))]
    (A : (adj).toMonad.Algebra) :
    (comparisonAdjunction.unit.app A).f = (beckCoequalizer A).desc (unitCofork A) := by
  

Proof state:
C : Type u₁
D : Type u₂
inst✝³ : Category.{v₁, u₁} C
inst✝² : Category.{v₁, u₂} D
G : D ⥤ C
inst✝¹ : IsRightAdjoint G
inst✝ : ∀ (A : Algebra (Adjunction.toMonad adj)), HasCoequalizer (F.map A.a) (adj.counit.app (F.obj A.A))
A : Algebra (Adjunction.toMonad adj)
⊢ (comparisonAdjunction.unit.app A).f = IsColimit.desc (beckCoequalizer A) (unitCofork A)

Next tactic:
apply Limits.Cofork.IsColimit.hom_ext (beckCoequalizer A)
theorem comparisonAdjunction_unit_f
    [∀ A : (adj).toMonad.Algebra, HasCoequalizer ((F).map A.a)
      ((adj).counit.app ((F).obj A.A))]
    (A : (adj).toMonad.Algebra) :
    (comparisonAdjunction.unit.app A).f = (beckCoequalizer A).desc (unitCofork A) := by
  apply Limits.Cofork.IsColimit.hom_ext (beckCoequalizer A)
  

Proof state:
C : Type u₁
D : Type u₂
inst✝³ : Category.{v₁, u₁} C
inst✝² : Category.{v₁, u₂} D
G : D ⥤ C
inst✝¹ : IsRightAdjoint G
inst✝ : ∀ (A : Algebra (Adjunction.toMonad adj)), HasCoequalizer (F.map A.a) (adj.counit.app (F.obj A.A))
A : Algebra (Adjunction.toMonad adj)
⊢ Cofork.π (beckCofork A) ≫ (comparisonAdjunction.unit.app A).f =
    Cofork.π (beckCofork A) ≫ IsColimit.desc (beckCoequalizer A) (unitCofork A)

Next tactic:
rw [Cofork.IsColimit.π_desc]
theorem comparisonAdjunction_unit_f
    [∀ A : (adj).toMonad.Algebra, HasCoequalizer ((F).map A.a)
      ((adj).counit.app ((F).obj A.A))]
    (A : (adj).toMonad.Algebra) :
    (comparisonAdjunction.unit.app A).f = (beckCoequalizer A).desc (unitCofork A) := by
  apply Limits.Cofork.IsColimit.hom_ext (beckCoequalizer A)
  rw [Cofork.IsColimit.π_desc]
  

Proof state:
C : Type u₁
D : Type u₂
inst✝³ : Category.{v₁, u₁} C
inst✝² : Category.{v₁, u₂} D
G : D ⥤ C
inst✝¹ : IsRightAdjoint G
inst✝ : ∀ (A : Algebra (Adjunction.toMonad adj)), HasCoequalizer (F.map A.a) (adj.counit.app (F.obj A.A))
A : Algebra (Adjunction.toMonad adj)
⊢ Cofork.π (beckCofork A) ≫ (comparisonAdjunction.unit.app A).f = Cofork.π (unitCofork A)

Next tactic:
dsimp only [beckCofork_π, unitCofork_π]
theorem comparisonAdjunction_unit_f
    [∀ A : (adj).toMonad.Algebra, HasCoequalizer ((F).map A.a)
      ((adj).counit.app ((F).obj A.A))]
    (A : (adj).toMonad.Algebra) :
    (comparisonAdjunction.unit.app A).f = (beckCoequalizer A).desc (unitCofork A) := by
  apply Limits.Cofork.IsColimit.hom_ext (beckCoequalizer A)
  rw [Cofork.IsColimit.π_desc]
  dsimp only [beckCofork_π, unitCofork_π]
  

Proof state:
C : Type u₁
D : Type u₂
inst✝³ : Category.{v₁, u₁} C
inst✝² : Category.{v₁, u₂} D
G : D ⥤ C
inst✝¹ : IsRightAdjoint G
inst✝ : ∀ (A : Algebra (Adjunction.toMonad adj)), HasCoequalizer (F.map A.a) (adj.counit.app (F.obj A.A))
A : Algebra (Adjunction.toMonad adj)
⊢ A.a ≫ (comparisonAdjunction.unit.app A).f = G.map (coequalizer.π (F.map A.a) (adj.counit.app (F.obj A.A)))

Next tactic:
rw [comparisonAdjunction_unit_f_aux, ← (adj).homEquiv_naturality_left A.a, coequalizer.condition,
    (adj).homEquiv_naturality_right, (adj).homEquiv_unit, Category.assoc]
theorem comparisonAdjunction_unit_f
    [∀ A : (adj).toMonad.Algebra, HasCoequalizer ((F).map A.a)
      ((adj).counit.app ((F).obj A.A))]
    (A : (adj).toMonad.Algebra) :
    (comparisonAdjunction.unit.app A).f = (beckCoequalizer A).desc (unitCofork A) := by
  apply Limits.Cofork.IsColimit.hom_ext (beckCoequalizer A)
  rw [Cofork.IsColimit.π_desc]
  dsimp only [beckCofork_π, unitCofork_π]
  rw [comparisonAdjunction_unit_f_aux, ← (adj).homEquiv_naturality_left A.a, coequalizer.condition,
    (adj).homEquiv_naturality_right, (adj).homEquiv_unit, Category.assoc]
  

Proof state:
C : Type u₁
D : Type u₂
inst✝³ : Category.{v₁, u₁} C
inst✝² : Category.{v₁, u₂} D
G : D ⥤ C
inst✝¹ : IsRightAdjoint G
inst✝ : ∀ (A : Algebra (Adjunction.toMonad adj)), HasCoequalizer (F.map A.a) (adj.counit.app (F.obj A.A))
A : Algebra (Adjunction.toMonad adj)
⊢ adj.unit.app ((Adjunction.toMonad adj).toFunctor.obj A.A) ≫
      G.map (adj.counit.app (F.obj A.A)) ≫ G.map (coequalizer.π (F.map A.a) (adj.counit.app (F.obj A.A))) =
    G.map (coequalizer.π (F.map A.a) (adj.counit.app (F.obj A.A)))

Next tactic:
apply (adj).right_triangle_components_assoc
theorem comparisonAdjunction_counit_app
    [∀ A : (adj).toMonad.Algebra, HasCoequalizer ((F).map A.a) ((adj).counit.app ((F).obj A.A))]
    (B : D) : (comparisonAdjunction (G := G)).counit.app B = colimit.desc _ (counitCofork B) := by
  

Proof state:
C : Type u₁
D : Type u₂
inst✝³ : Category.{v₁, u₁} C
inst✝² : Category.{v₁, u₂} D
G : D ⥤ C
inst✝¹ : IsRightAdjoint G
inst✝ : ∀ (A : Algebra (Adjunction.toMonad adj)), HasCoequalizer (F.map A.a) (adj.counit.app (F.obj A.A))
B : D
⊢ comparisonAdjunction.counit.app B =
    colimit.desc (parallelPair (F.map (G.map (adj.counit.app B))) (adj.counit.app (F.obj (G.obj B)))) (counitCofork B)

Next tactic:
apply coequalizer.hom_ext
theorem comparisonAdjunction_counit_app
    [∀ A : (adj).toMonad.Algebra, HasCoequalizer ((F).map A.a) ((adj).counit.app ((F).obj A.A))]
    (B : D) : (comparisonAdjunction (G := G)).counit.app B = colimit.desc _ (counitCofork B) := by
  apply coequalizer.hom_ext
  

Proof state:
case h
C : Type u₁
D : Type u₂
inst✝³ : Category.{v₁, u₁} C
inst✝² : Category.{v₁, u₂} D
G : D ⥤ C
inst✝¹ : IsRightAdjoint G
inst✝ : ∀ (A : Algebra (Adjunction.toMonad adj)), HasCoequalizer (F.map A.a) (adj.counit.app (F.obj A.A))
B : D
⊢ coequalizer.π (F.map ((comparison adj).obj B).a) (adj.counit.app (F.obj ((comparison adj).obj B).A)) ≫
      comparisonAdjunction.counit.app B =
    coequalizer.π (F.map ((comparison adj).obj B).a) (adj.counit.app (F.obj ((comparison adj).obj B).A)) ≫
      colimit.desc (parallelPair (F.map (G.map (adj.counit.app B))) (adj.counit.app (F.obj (G.obj B)))) (counitCofork B)

Next tactic:
change
    coequalizer.π _ _ ≫ coequalizer.desc (((adj).homEquiv _ B).symm (𝟙 _)) _ =
      coequalizer.π _ _ ≫ coequalizer.desc _ _
/--
If `G` is monadic, it creates colimits of `G`-split pairs. This is the "boring" direction of Beck's
monadicity theorem, the converse is given in `monadicOfCreatesGSplitCoequalizers`.
-/
def createsGSplitCoequalizersOfMonadic [MonadicRightAdjoint G] ⦃A B⦄ (f g : A ⟶ B)
    [G.IsSplitPair f g] : CreatesColimit (parallelPair f g) G := by
  

Proof state:
C : Type u₁
D : Type u₂
inst✝³ : Category.{v₁, u₁} C
inst✝² : Category.{v₁, u₂} D
G : D ⥤ C
inst✝¹ : MonadicRightAdjoint G
A B : D
f g : A ⟶ B
inst✝ : Functor.IsSplitPair G f g
⊢ CreatesColimit (parallelPair f g) G

Next tactic:
apply (config := {allowSynthFailures := true}) monadicCreatesColimitOfPreservesColimit
/--
If `G` is monadic, it creates colimits of `G`-split pairs. This is the "boring" direction of Beck's
monadicity theorem, the converse is given in `monadicOfCreatesGSplitCoequalizers`.
-/
def createsGSplitCoequalizersOfMonadic [MonadicRightAdjoint G] ⦃A B⦄ (f g : A ⟶ B)
    [G.IsSplitPair f g] : CreatesColimit (parallelPair f g) G := by
  apply (config := {allowSynthFailures := true}) monadicCreatesColimitOfPreservesColimit
    -- Porting note: oddly (config := {allowSynthFailures := true}) had no effect here and below
  · 

Proof state:
case inst
C : Type u₁
D : Type u₂
inst✝³ : Category.{v₁, u₁} C
inst✝² : Category.{v₁, u₂} D
G : D ⥤ C
inst✝¹ : MonadicRightAdjoint G
A B : D
f g : A ⟶ B
inst✝ : Functor.IsSplitPair G f g
⊢ PreservesColimit (parallelPair f g ⋙ G) (leftAdjoint G ⋙ G)

Next tactic:
apply @preservesColimitOfIsoDiagram _ _ _ _ _ _ _ _ _ (diagramIsoParallelPair.{v₁} _).symm ?_
/--
If `G` is monadic, it creates colimits of `G`-split pairs. This is the "boring" direction of Beck's
monadicity theorem, the converse is given in `monadicOfCreatesGSplitCoequalizers`.
-/
def createsGSplitCoequalizersOfMonadic [MonadicRightAdjoint G] ⦃A B⦄ (f g : A ⟶ B)
    [G.IsSplitPair f g] : CreatesColimit (parallelPair f g) G := by
  apply (config := {allowSynthFailures := true}) monadicCreatesColimitOfPreservesColimit
    -- Porting note: oddly (config := {allowSynthFailures := true}) had no effect here and below
  · apply @preservesColimitOfIsoDiagram _ _ _ _ _ _ _ _ _ (diagramIsoParallelPair.{v₁} _).symm ?_
    

Proof state:
C : Type u₁
D : Type u₂
inst✝³ : Category.{v₁, u₁} C
inst✝² : Category.{v₁, u₂} D
G : D ⥤ C
inst✝¹ : MonadicRightAdjoint G
A B : D
f g : A ⟶ B
inst✝ : Functor.IsSplitPair G f g
⊢ PreservesColimit
    (parallelPair ((parallelPair f g ⋙ G).map WalkingParallelPairHom.left)
      ((parallelPair f g ⋙ G).map WalkingParallelPairHom.right))
    (leftAdjoint G ⋙ G)

Next tactic:
dsimp
/--
If `G` is monadic, it creates colimits of `G`-split pairs. This is the "boring" direction of Beck's
monadicity theorem, the converse is given in `monadicOfCreatesGSplitCoequalizers`.
-/
def createsGSplitCoequalizersOfMonadic [MonadicRightAdjoint G] ⦃A B⦄ (f g : A ⟶ B)
    [G.IsSplitPair f g] : CreatesColimit (parallelPair f g) G := by
  apply (config := {allowSynthFailures := true}) monadicCreatesColimitOfPreservesColimit
    -- Porting note: oddly (config := {allowSynthFailures := true}) had no effect here and below
  · apply @preservesColimitOfIsoDiagram _ _ _ _ _ _ _ _ _ (diagramIsoParallelPair.{v₁} _).symm ?_
    dsimp
    

Proof state:
C : Type u₁
D : Type u₂
inst✝³ : Category.{v₁, u₁} C
inst✝² : Category.{v₁, u₂} D
G : D ⥤ C
inst✝¹ : MonadicRightAdjoint G
A B : D
f g : A ⟶ B
inst✝ : Functor.IsSplitPair G f g
⊢ PreservesColimit (parallelPair (G.map f) (G.map g)) (leftAdjoint G ⋙ G)

Next tactic:
infer_instance
/--
If `G` is monadic, it creates colimits of `G`-split pairs. This is the "boring" direction of Beck's
monadicity theorem, the converse is given in `monadicOfCreatesGSplitCoequalizers`.
-/
def createsGSplitCoequalizersOfMonadic [MonadicRightAdjoint G] ⦃A B⦄ (f g : A ⟶ B)
    [G.IsSplitPair f g] : CreatesColimit (parallelPair f g) G := by
  apply (config := {allowSynthFailures := true}) monadicCreatesColimitOfPreservesColimit
    -- Porting note: oddly (config := {allowSynthFailures := true}) had no effect here and below
  · apply @preservesColimitOfIsoDiagram _ _ _ _ _ _ _ _ _ (diagramIsoParallelPair.{v₁} _).symm ?_
    dsimp
    infer_instance
  · 

Proof state:
case inst
C : Type u₁
D : Type u₂
inst✝³ : Category.{v₁, u₁} C
inst✝² : Category.{v₁, u₂} D
G : D ⥤ C
inst✝¹ : MonadicRightAdjoint G
A B : D
f g : A ⟶ B
inst✝ : Functor.IsSplitPair G f g
⊢ PreservesColimit ((parallelPair f g ⋙ G) ⋙ leftAdjoint G ⋙ G) (leftAdjoint G ⋙ G)

Next tactic:
apply @preservesColimitOfIsoDiagram _ _ _ _ _ _ _ _ _ (diagramIsoParallelPair.{v₁} _).symm ?_
/--
If `G` is monadic, it creates colimits of `G`-split pairs. This is the "boring" direction of Beck's
monadicity theorem, the converse is given in `monadicOfCreatesGSplitCoequalizers`.
-/
def createsGSplitCoequalizersOfMonadic [MonadicRightAdjoint G] ⦃A B⦄ (f g : A ⟶ B)
    [G.IsSplitPair f g] : CreatesColimit (parallelPair f g) G := by
  apply (config := {allowSynthFailures := true}) monadicCreatesColimitOfPreservesColimit
    -- Porting note: oddly (config := {allowSynthFailures := true}) had no effect here and below
  · apply @preservesColimitOfIsoDiagram _ _ _ _ _ _ _ _ _ (diagramIsoParallelPair.{v₁} _).symm ?_
    dsimp
    infer_instance
  · apply @preservesColimitOfIsoDiagram _ _ _ _ _ _ _ _ _ (diagramIsoParallelPair.{v₁} _).symm ?_
    

Proof state:
C : Type u₁
D : Type u₂
inst✝³ : Category.{v₁, u₁} C
inst✝² : Category.{v₁, u₂} D
G : D ⥤ C
inst✝¹ : MonadicRightAdjoint G
A B : D
f g : A ⟶ B
inst✝ : Functor.IsSplitPair G f g
⊢ PreservesColimit
    (parallelPair (((parallelPair f g ⋙ G) ⋙ leftAdjoint G ⋙ G).map WalkingParallelPairHom.left)
      (((parallelPair f g ⋙ G) ⋙ leftAdjoint G ⋙ G).map WalkingParallelPairHom.right))
    (leftAdjoint G ⋙ G)

Next tactic:
dsimp
/--
If `G` is monadic, it creates colimits of `G`-split pairs. This is the "boring" direction of Beck's
monadicity theorem, the converse is given in `monadicOfCreatesGSplitCoequalizers`.
-/
def createsGSplitCoequalizersOfMonadic [MonadicRightAdjoint G] ⦃A B⦄ (f g : A ⟶ B)
    [G.IsSplitPair f g] : CreatesColimit (parallelPair f g) G := by
  apply (config := {allowSynthFailures := true}) monadicCreatesColimitOfPreservesColimit
    -- Porting note: oddly (config := {allowSynthFailures := true}) had no effect here and below
  · apply @preservesColimitOfIsoDiagram _ _ _ _ _ _ _ _ _ (diagramIsoParallelPair.{v₁} _).symm ?_
    dsimp
    infer_instance
  · apply @preservesColimitOfIsoDiagram _ _ _ _ _ _ _ _ _ (diagramIsoParallelPair.{v₁} _).symm ?_
    dsimp
    

Proof state:
C : Type u₁
D : Type u₂
inst✝³ : Category.{v₁, u₁} C
inst✝² : Category.{v₁, u₂} D
G : D ⥤ C
inst✝¹ : MonadicRightAdjoint G
A B : D
f g : A ⟶ B
inst✝ : Functor.IsSplitPair G f g
⊢ PreservesColimit (parallelPair (G.map ((leftAdjoint G).map (G.map f))) (G.map ((leftAdjoint G).map (G.map g))))
    (leftAdjoint G ⋙ G)

Next tactic:
infer_instance
/-- To show `G` is a monadic right adjoint, we can show it preserves and reflects `G`-split
coequalizers, and `C` has them.
-/
def monadicOfHasPreservesReflectsGSplitCoequalizers [HasCoequalizerOfIsSplitPair G]
    [PreservesColimitOfIsSplitPair G] [ReflectsColimitOfIsSplitPair G] : MonadicRightAdjoint G := by
  

Proof state:
C : Type u₁
D : Type u₂
inst✝⁵ : Category.{v₁, u₁} C
inst✝⁴ : Category.{v₁, u₂} D
G : D ⥤ C
inst✝³ : IsRightAdjoint G
inst✝² : HasCoequalizerOfIsSplitPair G
inst✝¹ : PreservesColimitOfIsSplitPair G
inst✝ : ReflectsColimitOfIsSplitPair G
⊢ MonadicRightAdjoint G

Next tactic:
let i : IsRightAdjoint (comparison (ofRightAdjoint G)) := ⟨_, comparisonAdjunction⟩
/-- To show `G` is a monadic right adjoint, we can show it preserves and reflects `G`-split
coequalizers, and `C` has them.
-/
def monadicOfHasPreservesReflectsGSplitCoequalizers [HasCoequalizerOfIsSplitPair G]
    [PreservesColimitOfIsSplitPair G] [ReflectsColimitOfIsSplitPair G] : MonadicRightAdjoint G := by
  let i : IsRightAdjoint (comparison (ofRightAdjoint G)) := ⟨_, comparisonAdjunction⟩
  

Proof state:
C : Type u₁
D : Type u₂
inst✝⁵ : Category.{v₁, u₁} C
inst✝⁴ : Category.{v₁, u₂} D
G : D ⥤ C
inst✝³ : IsRightAdjoint G
inst✝² : HasCoequalizerOfIsSplitPair G
inst✝¹ : PreservesColimitOfIsSplitPair G
inst✝ : ReflectsColimitOfIsSplitPair G
i : IsRightAdjoint (comparison adj) := { left := leftAdjointComparison, adj := comparisonAdjunction }
⊢ MonadicRightAdjoint G

Next tactic:
constructor
/-- To show `G` is a monadic right adjoint, we can show it preserves and reflects `G`-split
coequalizers, and `C` has them.
-/
def monadicOfHasPreservesReflectsGSplitCoequalizers [HasCoequalizerOfIsSplitPair G]
    [PreservesColimitOfIsSplitPair G] [ReflectsColimitOfIsSplitPair G] : MonadicRightAdjoint G := by
  let i : IsRightAdjoint (comparison (ofRightAdjoint G)) := ⟨_, comparisonAdjunction⟩
  constructor
  

Proof state:
case eqv
C : Type u₁
D : Type u₂
inst✝⁵ : Category.{v₁, u₁} C
inst✝⁴ : Category.{v₁, u₂} D
G : D ⥤ C
inst✝³ : IsRightAdjoint G
inst✝² : HasCoequalizerOfIsSplitPair G
inst✝¹ : PreservesColimitOfIsSplitPair G
inst✝ : ReflectsColimitOfIsSplitPair G
i : IsRightAdjoint (comparison adj) := { left := leftAdjointComparison, adj := comparisonAdjunction }
⊢ IsEquivalence (comparison adj)

Next tactic:
let _ : ∀ X : (ofRightAdjoint G).toMonad.Algebra,
      IsIso ((ofRightAdjoint (comparison (ofRightAdjoint G))).unit.app X) := by
    intro X
    -- Porting note: passing instances through
    apply @isIso_of_reflects_iso _ _ _ _ _ _ _ (Monad.forget (ofRightAdjoint G).toMonad) ?_ _
    · change IsIso (comparisonAdjunction.unit.app X).f
      rw [comparisonAdjunction_unit_f]
      change
        IsIso
          (IsColimit.coconePointUniqueUpToIso (beckCoequalizer X)
              (unitColimitOfPreservesCoequalizer X)).hom
      refine' IsIso.of_iso (IsColimit.coconePointUniqueUpToIso _ _)
/-- To show `G` is a monadic right adjoint, we can show it preserves and reflects `G`-split
coequalizers, and `C` has them.
-/
def monadicOfHasPreservesReflectsGSplitCoequalizers [HasCoequalizerOfIsSplitPair G]
    [PreservesColimitOfIsSplitPair G] [ReflectsColimitOfIsSplitPair G] : MonadicRightAdjoint G := by
  let i : IsRightAdjoint (comparison (ofRightAdjoint G)) := ⟨_, comparisonAdjunction⟩
  constructor
  let _ : ∀ X : (ofRightAdjoint G).toMonad.Algebra,
      IsIso ((ofRightAdjoint (comparison (ofRightAdjoint G))).unit.app X) := by
    

Proof state:
C : Type u₁
D : Type u₂
inst✝⁵ : Category.{v₁, u₁} C
inst✝⁴ : Category.{v₁, u₂} D
G : D ⥤ C
inst✝³ : IsRightAdjoint G
inst✝² : HasCoequalizerOfIsSplitPair G
inst✝¹ : PreservesColimitOfIsSplitPair G
inst✝ : ReflectsColimitOfIsSplitPair G
i : IsRightAdjoint (comparison adj) := { left := leftAdjointComparison, adj := comparisonAdjunction }
⊢ ∀ (X : Algebra (toMonad adj)), IsIso ((ofRightAdjoint (comparison adj)).unit.app X)

Next tactic:
intro X
/-- To show `G` is a monadic right adjoint, we can show it preserves and reflects `G`-split
coequalizers, and `C` has them.
-/
def monadicOfHasPreservesReflectsGSplitCoequalizers [HasCoequalizerOfIsSplitPair G]
    [PreservesColimitOfIsSplitPair G] [ReflectsColimitOfIsSplitPair G] : MonadicRightAdjoint G := by
  let i : IsRightAdjoint (comparison (ofRightAdjoint G)) := ⟨_, comparisonAdjunction⟩
  constructor
  let _ : ∀ X : (ofRightAdjoint G).toMonad.Algebra,
      IsIso ((ofRightAdjoint (comparison (ofRightAdjoint G))).unit.app X) := by
    intro X
    -- Porting note: passing instances through
    

Proof state:
C : Type u₁
D : Type u₂
inst✝⁵ : Category.{v₁, u₁} C
inst✝⁴ : Category.{v₁, u₂} D
G : D ⥤ C
inst✝³ : IsRightAdjoint G
inst✝² : HasCoequalizerOfIsSplitPair G
inst✝¹ : PreservesColimitOfIsSplitPair G
inst✝ : ReflectsColimitOfIsSplitPair G
i : IsRightAdjoint (comparison adj) := { left := leftAdjointComparison, adj := comparisonAdjunction }
X : Algebra (toMonad adj)
⊢ IsIso ((ofRightAdjoint (comparison adj)).unit.app X)

Next tactic:
apply @isIso_of_reflects_iso _ _ _ _ _ _ _ (Monad.forget (ofRightAdjoint G).toMonad) ?_ _
/-- To show `G` is a monadic right adjoint, we can show it preserves and reflects `G`-split
coequalizers, and `C` has them.
-/
def monadicOfHasPreservesReflectsGSplitCoequalizers [HasCoequalizerOfIsSplitPair G]
    [PreservesColimitOfIsSplitPair G] [ReflectsColimitOfIsSplitPair G] : MonadicRightAdjoint G := by
  let i : IsRightAdjoint (comparison (ofRightAdjoint G)) := ⟨_, comparisonAdjunction⟩
  constructor
  let _ : ∀ X : (ofRightAdjoint G).toMonad.Algebra,
      IsIso ((ofRightAdjoint (comparison (ofRightAdjoint G))).unit.app X) := by
    intro X
    -- Porting note: passing instances through
    apply @isIso_of_reflects_iso _ _ _ _ _ _ _ (Monad.forget (ofRightAdjoint G).toMonad) ?_ _
    · 

Proof state:
C : Type u₁
D : Type u₂
inst✝⁵ : Category.{v₁, u₁} C
inst✝⁴ : Category.{v₁, u₂} D
G : D ⥤ C
inst✝³ : IsRightAdjoint G
inst✝² : HasCoequalizerOfIsSplitPair G
inst✝¹ : PreservesColimitOfIsSplitPair G
inst✝ : ReflectsColimitOfIsSplitPair G
i : IsRightAdjoint (comparison adj) := { left := leftAdjointComparison, adj := comparisonAdjunction }
X : Algebra (toMonad adj)
⊢ IsIso ((forget (toMonad adj)).map ((ofRightAdjoint (comparison adj)).unit.app X))

Next tactic:
change IsIso (comparisonAdjunction.unit.app X).f
/-- To show `G` is a monadic right adjoint, we can show it preserves and reflects `G`-split
coequalizers, and `C` has them.
-/
def monadicOfHasPreservesReflectsGSplitCoequalizers [HasCoequalizerOfIsSplitPair G]
    [PreservesColimitOfIsSplitPair G] [ReflectsColimitOfIsSplitPair G] : MonadicRightAdjoint G := by
  let i : IsRightAdjoint (comparison (ofRightAdjoint G)) := ⟨_, comparisonAdjunction⟩
  constructor
  let _ : ∀ X : (ofRightAdjoint G).toMonad.Algebra,
      IsIso ((ofRightAdjoint (comparison (ofRightAdjoint G))).unit.app X) := by
    intro X
    -- Porting note: passing instances through
    apply @isIso_of_reflects_iso _ _ _ _ _ _ _ (Monad.forget (ofRightAdjoint G).toMonad) ?_ _
    · change IsIso (comparisonAdjunction.unit.app X).f
      

Proof state:
C : Type u₁
D : Type u₂
inst✝⁵ : Category.{v₁, u₁} C
inst✝⁴ : Category.{v₁, u₂} D
G : D ⥤ C
inst✝³ : IsRightAdjoint G
inst✝² : HasCoequalizerOfIsSplitPair G
inst✝¹ : PreservesColimitOfIsSplitPair G
inst✝ : ReflectsColimitOfIsSplitPair G
i : IsRightAdjoint (comparison adj) := { left := leftAdjointComparison, adj := comparisonAdjunction }
X : Algebra (toMonad adj)
⊢ IsIso (comparisonAdjunction.unit.app X).f

Next tactic:
rw [comparisonAdjunction_unit_f]
/-- To show `G` is a monadic right adjoint, we can show it preserves and reflects `G`-split
coequalizers, and `C` has them.
-/
def monadicOfHasPreservesReflectsGSplitCoequalizers [HasCoequalizerOfIsSplitPair G]
    [PreservesColimitOfIsSplitPair G] [ReflectsColimitOfIsSplitPair G] : MonadicRightAdjoint G := by
  let i : IsRightAdjoint (comparison (ofRightAdjoint G)) := ⟨_, comparisonAdjunction⟩
  constructor
  let _ : ∀ X : (ofRightAdjoint G).toMonad.Algebra,
      IsIso ((ofRightAdjoint (comparison (ofRightAdjoint G))).unit.app X) := by
    intro X
    -- Porting note: passing instances through
    apply @isIso_of_reflects_iso _ _ _ _ _ _ _ (Monad.forget (ofRightAdjoint G).toMonad) ?_ _
    · change IsIso (comparisonAdjunction.unit.app X).f
      rw [comparisonAdjunction_unit_f]
      

Proof state:
C : Type u₁
D : Type u₂
inst✝⁵ : Category.{v₁, u₁} C
inst✝⁴ : Category.{v₁, u₂} D
G : D ⥤ C
inst✝³ : IsRightAdjoint G
inst✝² : HasCoequalizerOfIsSplitPair G
inst✝¹ : PreservesColimitOfIsSplitPair G
inst✝ : ReflectsColimitOfIsSplitPair G
i : IsRightAdjoint (comparison adj) := { left := leftAdjointComparison, adj := comparisonAdjunction }
X : Algebra (toMonad adj)
⊢ IsIso (IsColimit.desc (beckCoequalizer X) (unitCofork X))

Next tactic:
change
        IsIso
          (IsColimit.coconePointUniqueUpToIso (beckCoequalizer X)
              (unitColimitOfPreservesCoequalizer X)).hom