l3lab/ntp-mathlib huggingface dataset:
/-- Reflexive (crude) monadicity theorem. If `G` has a right adjoint, `D` has and `G` preserves
reflexive coequalizers and `G` reflects isomorphisms, then `G` is monadic.
-/
def monadicOfHasPreservesReflexiveCoequalizersOfReflectsIsomorphisms : MonadicRightAdjoint G := by
  letI i : IsRightAdjoint (comparison (Adjunction.ofRightAdjoint G)) :=
    ⟨_, comparisonAdjunction⟩
  constructor
  let _ : ∀ X : (Adjunction.ofRightAdjoint G).toMonad.Algebra,
      IsIso ((Adjunction.ofRightAdjoint
                (comparison (Adjunction.ofRightAdjoint G))).unit.app X) := by
    intro X
    apply
      @isIso_of_reflects_iso _ _ _ _ _ _ _ (Monad.forget (Adjunction.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✝² : HasReflexiveCoequalizers D
inst✝¹ : ReflectsIsomorphisms G
inst✝ : PreservesColimitOfIsReflexivePair 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]
/-- Reflexive (crude) monadicity theorem. If `G` has a right adjoint, `D` has and `G` preserves
reflexive coequalizers and `G` reflects isomorphisms, then `G` is monadic.
-/
def monadicOfHasPreservesReflexiveCoequalizersOfReflectsIsomorphisms : MonadicRightAdjoint G := by
  letI i : IsRightAdjoint (comparison (Adjunction.ofRightAdjoint G)) :=
    ⟨_, comparisonAdjunction⟩
  constructor
  let _ : ∀ X : (Adjunction.ofRightAdjoint G).toMonad.Algebra,
      IsIso ((Adjunction.ofRightAdjoint
                (comparison (Adjunction.ofRightAdjoint G))).unit.app X) := by
    intro X
    apply
      @isIso_of_reflects_iso _ _ _ _ _ _ _ (Monad.forget (Adjunction.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✝² : HasReflexiveCoequalizers D
inst✝¹ : ReflectsIsomorphisms G
inst✝ : PreservesColimitOfIsReflexivePair 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
/-- Reflexive (crude) monadicity theorem. If `G` has a right adjoint, `D` has and `G` preserves
reflexive coequalizers and `G` reflects isomorphisms, then `G` is monadic.
-/
def monadicOfHasPreservesReflexiveCoequalizersOfReflectsIsomorphisms : MonadicRightAdjoint G := by
  letI i : IsRightAdjoint (comparison (Adjunction.ofRightAdjoint G)) :=
    ⟨_, comparisonAdjunction⟩
  constructor
  let _ : ∀ X : (Adjunction.ofRightAdjoint G).toMonad.Algebra,
      IsIso ((Adjunction.ofRightAdjoint
                (comparison (Adjunction.ofRightAdjoint G))).unit.app X) := by
    intro X
    apply
      @isIso_of_reflects_iso _ _ _ _ _ _ _ (Monad.forget (Adjunction.ofRightAdjoint G).toMonad) ?_ _
    · change IsIso (comparisonAdjunction.unit.app X).f
      rw [comparisonAdjunction_unit_f]
      change
        IsIso
          (IsColimit.coconePointUniqueUpToIso (beckCoequalizer X)
              (unitColimitOfPreservesCoequalizer X)).hom
      

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✝² : HasReflexiveCoequalizers D
inst✝¹ : ReflectsIsomorphisms G
inst✝ : PreservesColimitOfIsReflexivePair G
i : IsRightAdjoint (comparison adj) := { left := leftAdjointComparison, adj := comparisonAdjunction }
X : Algebra (toMonad adj)
⊢ IsIso (IsColimit.coconePointUniqueUpToIso (beckCoequalizer X) (unitColimitOfPreservesCoequalizer X)).hom

Next tactic:
apply IsIso.of_iso (IsColimit.coconePointUniqueUpToIso _ _)
/-- Reflexive (crude) monadicity theorem. If `G` has a right adjoint, `D` has and `G` preserves
reflexive coequalizers and `G` reflects isomorphisms, then `G` is monadic.
-/
def monadicOfHasPreservesReflexiveCoequalizersOfReflectsIsomorphisms : MonadicRightAdjoint G := by
  letI i : IsRightAdjoint (comparison (Adjunction.ofRightAdjoint G)) :=
    ⟨_, comparisonAdjunction⟩
  constructor
  let _ : ∀ X : (Adjunction.ofRightAdjoint G).toMonad.Algebra,
      IsIso ((Adjunction.ofRightAdjoint
                (comparison (Adjunction.ofRightAdjoint G))).unit.app X) := by
    intro X
    apply
      @isIso_of_reflects_iso _ _ _ _ _ _ _ (Monad.forget (Adjunction.ofRightAdjoint G).toMonad) ?_ _
    · change IsIso (comparisonAdjunction.unit.app X).f
      rw [comparisonAdjunction_unit_f]
      change
        IsIso
          (IsColimit.coconePointUniqueUpToIso (beckCoequalizer X)
              (unitColimitOfPreservesCoequalizer X)).hom
      apply IsIso.of_iso (IsColimit.coconePointUniqueUpToIso _ _)
  

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✝² : HasReflexiveCoequalizers D
inst✝¹ : ReflectsIsomorphisms G
inst✝ : PreservesColimitOfIsReflexivePair G
i : IsRightAdjoint (comparison adj) := { left := leftAdjointComparison, adj := comparisonAdjunction }
x✝ : ∀ (X : Algebra (toMonad adj)), IsIso ((ofRightAdjoint (comparison adj)).unit.app X) :=
  fun X => isIso_of_reflects_iso ((ofRightAdjoint (comparison adj)).unit.app X) (forget (toMonad adj))
⊢ IsEquivalence (comparison adj)

Next tactic:
let _ : ∀ Y : D,
      IsIso ((ofRightAdjoint (comparison (Adjunction.ofRightAdjoint G))).counit.app Y) := by
    intro Y
    change IsIso (comparisonAdjunction.counit.app Y)
    rw [comparisonAdjunction_counit_app]
    -- Porting note: passing instances through
    change IsIso (IsColimit.coconePointUniqueUpToIso _ ?_).hom
    infer_instance
    -- Porting note: passing instances through
    apply @counitCoequalizerOfReflectsCoequalizer _ _ _ _ _ _ _ ?_
    apply reflectsColimitOfReflectsIsomorphisms
/-- Reflexive (crude) monadicity theorem. If `G` has a right adjoint, `D` has and `G` preserves
reflexive coequalizers and `G` reflects isomorphisms, then `G` is monadic.
-/
def monadicOfHasPreservesReflexiveCoequalizersOfReflectsIsomorphisms : MonadicRightAdjoint G := by
  letI i : IsRightAdjoint (comparison (Adjunction.ofRightAdjoint G)) :=
    ⟨_, comparisonAdjunction⟩
  constructor
  let _ : ∀ X : (Adjunction.ofRightAdjoint G).toMonad.Algebra,
      IsIso ((Adjunction.ofRightAdjoint
                (comparison (Adjunction.ofRightAdjoint G))).unit.app X) := by
    intro X
    apply
      @isIso_of_reflects_iso _ _ _ _ _ _ _ (Monad.forget (Adjunction.ofRightAdjoint G).toMonad) ?_ _
    · change IsIso (comparisonAdjunction.unit.app X).f
      rw [comparisonAdjunction_unit_f]
      change
        IsIso
          (IsColimit.coconePointUniqueUpToIso (beckCoequalizer X)
              (unitColimitOfPreservesCoequalizer X)).hom
      apply IsIso.of_iso (IsColimit.coconePointUniqueUpToIso _ _)
  let _ : ∀ Y : D,
      IsIso ((ofRightAdjoint (comparison (Adjunction.ofRightAdjoint G))).counit.app Y) := 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✝² : HasReflexiveCoequalizers D
inst✝¹ : ReflectsIsomorphisms G
inst✝ : PreservesColimitOfIsReflexivePair G
i : IsRightAdjoint (comparison adj) := { left := leftAdjointComparison, adj := comparisonAdjunction }
x✝ : ∀ (X : Algebra (toMonad adj)), IsIso ((ofRightAdjoint (comparison adj)).unit.app X) :=
  fun X => isIso_of_reflects_iso ((ofRightAdjoint (comparison adj)).unit.app X) (forget (toMonad adj))
⊢ ∀ (Y : D), IsIso ((ofRightAdjoint (comparison adj)).counit.app Y)

Next tactic:
intro Y
/-- Reflexive (crude) monadicity theorem. If `G` has a right adjoint, `D` has and `G` preserves
reflexive coequalizers and `G` reflects isomorphisms, then `G` is monadic.
-/
def monadicOfHasPreservesReflexiveCoequalizersOfReflectsIsomorphisms : MonadicRightAdjoint G := by
  letI i : IsRightAdjoint (comparison (Adjunction.ofRightAdjoint G)) :=
    ⟨_, comparisonAdjunction⟩
  constructor
  let _ : ∀ X : (Adjunction.ofRightAdjoint G).toMonad.Algebra,
      IsIso ((Adjunction.ofRightAdjoint
                (comparison (Adjunction.ofRightAdjoint G))).unit.app X) := by
    intro X
    apply
      @isIso_of_reflects_iso _ _ _ _ _ _ _ (Monad.forget (Adjunction.ofRightAdjoint G).toMonad) ?_ _
    · change IsIso (comparisonAdjunction.unit.app X).f
      rw [comparisonAdjunction_unit_f]
      change
        IsIso
          (IsColimit.coconePointUniqueUpToIso (beckCoequalizer X)
              (unitColimitOfPreservesCoequalizer X)).hom
      apply IsIso.of_iso (IsColimit.coconePointUniqueUpToIso _ _)
  let _ : ∀ Y : D,
      IsIso ((ofRightAdjoint (comparison (Adjunction.ofRightAdjoint G))).counit.app Y) := by
    intro Y
    

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✝² : HasReflexiveCoequalizers D
inst✝¹ : ReflectsIsomorphisms G
inst✝ : PreservesColimitOfIsReflexivePair G
i : IsRightAdjoint (comparison adj) := { left := leftAdjointComparison, adj := comparisonAdjunction }
x✝ : ∀ (X : Algebra (toMonad adj)), IsIso ((ofRightAdjoint (comparison adj)).unit.app X) :=
  fun X => isIso_of_reflects_iso ((ofRightAdjoint (comparison adj)).unit.app X) (forget (toMonad adj))
Y : D
⊢ IsIso ((ofRightAdjoint (comparison adj)).counit.app Y)

Next tactic:
change IsIso (comparisonAdjunction.counit.app Y)
/-- Reflexive (crude) monadicity theorem. If `G` has a right adjoint, `D` has and `G` preserves
reflexive coequalizers and `G` reflects isomorphisms, then `G` is monadic.
-/
def monadicOfHasPreservesReflexiveCoequalizersOfReflectsIsomorphisms : MonadicRightAdjoint G := by
  letI i : IsRightAdjoint (comparison (Adjunction.ofRightAdjoint G)) :=
    ⟨_, comparisonAdjunction⟩
  constructor
  let _ : ∀ X : (Adjunction.ofRightAdjoint G).toMonad.Algebra,
      IsIso ((Adjunction.ofRightAdjoint
                (comparison (Adjunction.ofRightAdjoint G))).unit.app X) := by
    intro X
    apply
      @isIso_of_reflects_iso _ _ _ _ _ _ _ (Monad.forget (Adjunction.ofRightAdjoint G).toMonad) ?_ _
    · change IsIso (comparisonAdjunction.unit.app X).f
      rw [comparisonAdjunction_unit_f]
      change
        IsIso
          (IsColimit.coconePointUniqueUpToIso (beckCoequalizer X)
              (unitColimitOfPreservesCoequalizer X)).hom
      apply IsIso.of_iso (IsColimit.coconePointUniqueUpToIso _ _)
  let _ : ∀ Y : D,
      IsIso ((ofRightAdjoint (comparison (Adjunction.ofRightAdjoint G))).counit.app Y) := by
    intro Y
    change IsIso (comparisonAdjunction.counit.app Y)
    

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✝² : HasReflexiveCoequalizers D
inst✝¹ : ReflectsIsomorphisms G
inst✝ : PreservesColimitOfIsReflexivePair G
i : IsRightAdjoint (comparison adj) := { left := leftAdjointComparison, adj := comparisonAdjunction }
x✝ : ∀ (X : Algebra (toMonad adj)), IsIso ((ofRightAdjoint (comparison adj)).unit.app X) :=
  fun X => isIso_of_reflects_iso ((ofRightAdjoint (comparison adj)).unit.app X) (forget (toMonad adj))
Y : D
⊢ IsIso (comparisonAdjunction.counit.app Y)

Next tactic:
rw [comparisonAdjunction_counit_app]
/-- Reflexive (crude) monadicity theorem. If `G` has a right adjoint, `D` has and `G` preserves
reflexive coequalizers and `G` reflects isomorphisms, then `G` is monadic.
-/
def monadicOfHasPreservesReflexiveCoequalizersOfReflectsIsomorphisms : MonadicRightAdjoint G := by
  letI i : IsRightAdjoint (comparison (Adjunction.ofRightAdjoint G)) :=
    ⟨_, comparisonAdjunction⟩
  constructor
  let _ : ∀ X : (Adjunction.ofRightAdjoint G).toMonad.Algebra,
      IsIso ((Adjunction.ofRightAdjoint
                (comparison (Adjunction.ofRightAdjoint G))).unit.app X) := by
    intro X
    apply
      @isIso_of_reflects_iso _ _ _ _ _ _ _ (Monad.forget (Adjunction.ofRightAdjoint G).toMonad) ?_ _
    · change IsIso (comparisonAdjunction.unit.app X).f
      rw [comparisonAdjunction_unit_f]
      change
        IsIso
          (IsColimit.coconePointUniqueUpToIso (beckCoequalizer X)
              (unitColimitOfPreservesCoequalizer X)).hom
      apply IsIso.of_iso (IsColimit.coconePointUniqueUpToIso _ _)
  let _ : ∀ Y : D,
      IsIso ((ofRightAdjoint (comparison (Adjunction.ofRightAdjoint G))).counit.app Y) := by
    intro Y
    change IsIso (comparisonAdjunction.counit.app Y)
    rw [comparisonAdjunction_counit_app]
    -- 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✝² : HasReflexiveCoequalizers D
inst✝¹ : ReflectsIsomorphisms G
inst✝ : PreservesColimitOfIsReflexivePair G
i : IsRightAdjoint (comparison adj) := { left := leftAdjointComparison, adj := comparisonAdjunction }
x✝ : ∀ (X : Algebra (toMonad adj)), IsIso ((ofRightAdjoint (comparison adj)).unit.app X) :=
  fun X => isIso_of_reflects_iso ((ofRightAdjoint (comparison adj)).unit.app X) (forget (toMonad adj))
Y : D
⊢ IsIso
    (colimit.desc (parallelPair (F.map (G.map (adj.counit.app Y))) (adj.counit.app (F.obj (G.obj Y)))) (counitCofork Y))

Next tactic:
change IsIso (IsColimit.coconePointUniqueUpToIso _ ?_).hom
/-- Reflexive (crude) monadicity theorem. If `G` has a right adjoint, `D` has and `G` preserves
reflexive coequalizers and `G` reflects isomorphisms, then `G` is monadic.
-/
def monadicOfHasPreservesReflexiveCoequalizersOfReflectsIsomorphisms : MonadicRightAdjoint G := by
  letI i : IsRightAdjoint (comparison (Adjunction.ofRightAdjoint G)) :=
    ⟨_, comparisonAdjunction⟩
  constructor
  let _ : ∀ X : (Adjunction.ofRightAdjoint G).toMonad.Algebra,
      IsIso ((Adjunction.ofRightAdjoint
                (comparison (Adjunction.ofRightAdjoint G))).unit.app X) := by
    intro X
    apply
      @isIso_of_reflects_iso _ _ _ _ _ _ _ (Monad.forget (Adjunction.ofRightAdjoint G).toMonad) ?_ _
    · change IsIso (comparisonAdjunction.unit.app X).f
      rw [comparisonAdjunction_unit_f]
      change
        IsIso
          (IsColimit.coconePointUniqueUpToIso (beckCoequalizer X)
              (unitColimitOfPreservesCoequalizer X)).hom
      apply IsIso.of_iso (IsColimit.coconePointUniqueUpToIso _ _)
  let _ : ∀ Y : D,
      IsIso ((ofRightAdjoint (comparison (Adjunction.ofRightAdjoint G))).counit.app Y) := by
    intro Y
    change IsIso (comparisonAdjunction.counit.app Y)
    rw [comparisonAdjunction_counit_app]
    -- Porting note: passing instances through
    change IsIso (IsColimit.coconePointUniqueUpToIso _ ?_).hom
    

Proof state:
case refine_2
C : Type u₁
D : Type u₂
inst✝⁵ : Category.{v₁, u₁} C
inst✝⁴ : Category.{v₁, u₂} D
G : D ⥤ C
inst✝³ : IsRightAdjoint G
inst✝² : HasReflexiveCoequalizers D
inst✝¹ : ReflectsIsomorphisms G
inst✝ : PreservesColimitOfIsReflexivePair G
i : IsRightAdjoint (comparison adj) := { left := leftAdjointComparison, adj := comparisonAdjunction }
x✝ : ∀ (X : Algebra (toMonad adj)), IsIso ((ofRightAdjoint (comparison adj)).unit.app X) :=
  fun X => isIso_of_reflects_iso ((ofRightAdjoint (comparison adj)).unit.app X) (forget (toMonad adj))
Y : D
⊢ IsIso
    (IsColimit.coconePointUniqueUpToIso
        (colimit.isColimit (parallelPair (F.map (G.map (adj.counit.app Y))) (adj.counit.app (F.obj (G.obj Y)))))
        ?refine_1).hom
case refine_1
C : Type u₁
D : Type u₂
inst✝⁵ : Category.{v₁, u₁} C
inst✝⁴ : Category.{v₁, u₂} D
G : D ⥤ C
inst✝³ : IsRightAdjoint G
inst✝² : HasReflexiveCoequalizers D
inst✝¹ : ReflectsIsomorphisms G
inst✝ : PreservesColimitOfIsReflexivePair G
i : IsRightAdjoint (comparison adj) := { left := leftAdjointComparison, adj := comparisonAdjunction }
x✝ : ∀ (X : Algebra (toMonad adj)), IsIso ((ofRightAdjoint (comparison adj)).unit.app X) :=
  fun X => isIso_of_reflects_iso ((ofRightAdjoint (comparison adj)).unit.app X) (forget (toMonad adj))
Y : D
⊢ IsColimit (counitCofork Y)

Next tactic:
infer_instance
/-- Reflexive (crude) monadicity theorem. If `G` has a right adjoint, `D` has and `G` preserves
reflexive coequalizers and `G` reflects isomorphisms, then `G` is monadic.
-/
def monadicOfHasPreservesReflexiveCoequalizersOfReflectsIsomorphisms : MonadicRightAdjoint G := by
  letI i : IsRightAdjoint (comparison (Adjunction.ofRightAdjoint G)) :=
    ⟨_, comparisonAdjunction⟩
  constructor
  let _ : ∀ X : (Adjunction.ofRightAdjoint G).toMonad.Algebra,
      IsIso ((Adjunction.ofRightAdjoint
                (comparison (Adjunction.ofRightAdjoint G))).unit.app X) := by
    intro X
    apply
      @isIso_of_reflects_iso _ _ _ _ _ _ _ (Monad.forget (Adjunction.ofRightAdjoint G).toMonad) ?_ _
    · change IsIso (comparisonAdjunction.unit.app X).f
      rw [comparisonAdjunction_unit_f]
      change
        IsIso
          (IsColimit.coconePointUniqueUpToIso (beckCoequalizer X)
              (unitColimitOfPreservesCoequalizer X)).hom
      apply IsIso.of_iso (IsColimit.coconePointUniqueUpToIso _ _)
  let _ : ∀ Y : D,
      IsIso ((ofRightAdjoint (comparison (Adjunction.ofRightAdjoint G))).counit.app Y) := by
    intro Y
    change IsIso (comparisonAdjunction.counit.app Y)
    rw [comparisonAdjunction_counit_app]
    -- Porting note: passing instances through
    change IsIso (IsColimit.coconePointUniqueUpToIso _ ?_).hom
    infer_instance
    -- Porting note: passing instances through
    

Proof state:
case refine_1
C : Type u₁
D : Type u₂
inst✝⁵ : Category.{v₁, u₁} C
inst✝⁴ : Category.{v₁, u₂} D
G : D ⥤ C
inst✝³ : IsRightAdjoint G
inst✝² : HasReflexiveCoequalizers D
inst✝¹ : ReflectsIsomorphisms G
inst✝ : PreservesColimitOfIsReflexivePair G
i : IsRightAdjoint (comparison adj) := { left := leftAdjointComparison, adj := comparisonAdjunction }
x✝ : ∀ (X : Algebra (toMonad adj)), IsIso ((ofRightAdjoint (comparison adj)).unit.app X) :=
  fun X => isIso_of_reflects_iso ((ofRightAdjoint (comparison adj)).unit.app X) (forget (toMonad adj))
Y : D
⊢ IsColimit (counitCofork Y)

Next tactic:
apply @counitCoequalizerOfReflectsCoequalizer _ _ _ _ _ _ _ ?_
/-- Reflexive (crude) monadicity theorem. If `G` has a right adjoint, `D` has and `G` preserves
reflexive coequalizers and `G` reflects isomorphisms, then `G` is monadic.
-/
def monadicOfHasPreservesReflexiveCoequalizersOfReflectsIsomorphisms : MonadicRightAdjoint G := by
  letI i : IsRightAdjoint (comparison (Adjunction.ofRightAdjoint G)) :=
    ⟨_, comparisonAdjunction⟩
  constructor
  let _ : ∀ X : (Adjunction.ofRightAdjoint G).toMonad.Algebra,
      IsIso ((Adjunction.ofRightAdjoint
                (comparison (Adjunction.ofRightAdjoint G))).unit.app X) := by
    intro X
    apply
      @isIso_of_reflects_iso _ _ _ _ _ _ _ (Monad.forget (Adjunction.ofRightAdjoint G).toMonad) ?_ _
    · change IsIso (comparisonAdjunction.unit.app X).f
      rw [comparisonAdjunction_unit_f]
      change
        IsIso
          (IsColimit.coconePointUniqueUpToIso (beckCoequalizer X)
              (unitColimitOfPreservesCoequalizer X)).hom
      apply IsIso.of_iso (IsColimit.coconePointUniqueUpToIso _ _)
  let _ : ∀ Y : D,
      IsIso ((ofRightAdjoint (comparison (Adjunction.ofRightAdjoint G))).counit.app Y) := by
    intro Y
    change IsIso (comparisonAdjunction.counit.app Y)
    rw [comparisonAdjunction_counit_app]
    -- Porting note: passing instances through
    change IsIso (IsColimit.coconePointUniqueUpToIso _ ?_).hom
    infer_instance
    -- Porting note: passing instances through
    apply @counitCoequalizerOfReflectsCoequalizer _ _ _ _ _ _ _ ?_
    

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✝² : HasReflexiveCoequalizers D
inst✝¹ : ReflectsIsomorphisms G
inst✝ : PreservesColimitOfIsReflexivePair G
i : IsRightAdjoint (comparison adj) := { left := leftAdjointComparison, adj := comparisonAdjunction }
x✝ : ∀ (X : Algebra (toMonad adj)), IsIso ((ofRightAdjoint (comparison adj)).unit.app X) :=
  fun X => isIso_of_reflects_iso ((ofRightAdjoint (comparison adj)).unit.app X) (forget (toMonad adj))
Y : D
⊢ ReflectsColimit (parallelPair (F.map (G.map (adj.counit.app Y))) (adj.counit.app (F.obj (G.obj Y)))) G

Next tactic:
apply reflectsColimitOfReflectsIsomorphisms
/-- Reflexive (crude) monadicity theorem. If `G` has a right adjoint, `D` has and `G` preserves
reflexive coequalizers and `G` reflects isomorphisms, then `G` is monadic.
-/
def monadicOfHasPreservesReflexiveCoequalizersOfReflectsIsomorphisms : MonadicRightAdjoint G := by
  letI i : IsRightAdjoint (comparison (Adjunction.ofRightAdjoint G)) :=
    ⟨_, comparisonAdjunction⟩
  constructor
  let _ : ∀ X : (Adjunction.ofRightAdjoint G).toMonad.Algebra,
      IsIso ((Adjunction.ofRightAdjoint
                (comparison (Adjunction.ofRightAdjoint G))).unit.app X) := by
    intro X
    apply
      @isIso_of_reflects_iso _ _ _ _ _ _ _ (Monad.forget (Adjunction.ofRightAdjoint G).toMonad) ?_ _
    · change IsIso (comparisonAdjunction.unit.app X).f
      rw [comparisonAdjunction_unit_f]
      change
        IsIso
          (IsColimit.coconePointUniqueUpToIso (beckCoequalizer X)
              (unitColimitOfPreservesCoequalizer X)).hom
      apply IsIso.of_iso (IsColimit.coconePointUniqueUpToIso _ _)
  let _ : ∀ Y : D,
      IsIso ((ofRightAdjoint (comparison (Adjunction.ofRightAdjoint G))).counit.app Y) := by
    intro Y
    change IsIso (comparisonAdjunction.counit.app Y)
    rw [comparisonAdjunction_counit_app]
    -- Porting note: passing instances through
    change IsIso (IsColimit.coconePointUniqueUpToIso _ ?_).hom
    infer_instance
    -- Porting note: passing instances through
    apply @counitCoequalizerOfReflectsCoequalizer _ _ _ _ _ _ _ ?_
    apply reflectsColimitOfReflectsIsomorphisms
  

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✝² : HasReflexiveCoequalizers D
inst✝¹ : ReflectsIsomorphisms G
inst✝ : PreservesColimitOfIsReflexivePair G
i : IsRightAdjoint (comparison adj) := { left := leftAdjointComparison, adj := comparisonAdjunction }
x✝¹ : ∀ (X : Algebra (toMonad adj)), IsIso ((ofRightAdjoint (comparison adj)).unit.app X) :=
  fun X => isIso_of_reflects_iso ((ofRightAdjoint (comparison adj)).unit.app X) (forget (toMonad adj))
x✝ : ∀ (Y : D), IsIso ((ofRightAdjoint (comparison adj)).counit.app Y) :=
  fun Y =>
    let_fun this :=
      Eq.mpr (_root_.id (comparisonAdjunction_counit_app Y ▸ Eq.refl (IsIso (comparisonAdjunction.counit.app Y))))
        (let_fun this := inferInstance;
        this);
    this
⊢ IsEquivalence (comparison adj)

Next tactic:
exact Adjunction.isRightAdjointToIsEquivalence
@[continuity]
theorem Continuous.matrix_det [Fintype n] [DecidableEq n] [CommRing R] [TopologicalRing R]
    {A : X → Matrix n n R} (hA : Continuous A) : Continuous fun x => (A x).det := by
  

Proof state:
X : Type u_1
α : Type u_2
l : Type u_3
m : Type u_4
n : Type u_5
p : Type u_6
S : Type u_7
R : Type u_8
m' : l → Type u_9
n' : l → Type u_10
inst✝⁵ : TopologicalSpace X
inst✝⁴ : TopologicalSpace R
inst✝³ : Fintype n
inst✝² : DecidableEq n
inst✝¹ : CommRing R
inst✝ : TopologicalRing R
A : X → Matrix n n R
hA : Continuous A
⊢ Continuous fun x => det (A x)

Next tactic:
simp_rw [Matrix.det_apply]
@[continuity]
theorem Continuous.matrix_det [Fintype n] [DecidableEq n] [CommRing R] [TopologicalRing R]
    {A : X → Matrix n n R} (hA : Continuous A) : Continuous fun x => (A x).det := by
  simp_rw [Matrix.det_apply]
  

Proof state:
X : Type u_1
α : Type u_2
l : Type u_3
m : Type u_4
n : Type u_5
p : Type u_6
S : Type u_7
R : Type u_8
m' : l → Type u_9
n' : l → Type u_10
inst✝⁵ : TopologicalSpace X
inst✝⁴ : TopologicalSpace R
inst✝³ : Fintype n
inst✝² : DecidableEq n
inst✝¹ : CommRing R
inst✝ : TopologicalRing R
A : X → Matrix n n R
hA : Continuous A
⊢ Continuous fun x => Finset.sum Finset.univ fun σ => Equiv.Perm.sign σ • Finset.prod Finset.univ fun i => A x (σ i) i

Next tactic:
refine' continuous_finset_sum _ fun l _ => Continuous.const_smul _ _