l3lab/ntp-mathlib huggingface dataset:
/-- The natural bijection between `α → Π i, δ i` and `Π i, α → δ i`, upgraded to a uniform
isomorphism between `α →ᵤ[𝔖] (Π i, δ i)` and `Π i, α →ᵤ[𝔖] δ i`. -/
protected def uniformEquivPiComm : (α →ᵤ[𝔖] ((i:ι) → δ i)) ≃ᵤ ((i:ι) → α →ᵤ[𝔖] δ i) :=
  -- Denote `φ` this bijection. We want to show that
  -- `comap φ (Π i, 𝒱(α, δ i, 𝔖, uδ i)) = 𝒱(α, (Π i, δ i), 𝔖, (Π i, uδ i))`.
  -- But `Π i, uδ i` is defined as `⨅ i, comap (eval i) (uδ i)`, so we just have to apply
  -- `UniformOnFun.iInf_eq` and `UniformOnFun.comap_eq`,
  -- which leaves us to check that some square commutes.
  -- We could also deduce this from `UniformFun.uniformEquivPiComm`, but it turns out
  -- to be more annoying.
  @Equiv.toUniformEquivOfUniformInducing (α →ᵤ[𝔖] ((i:ι) → δ i)) ((i:ι) → α →ᵤ[𝔖] δ i)
      _ _ (Equiv.piComm _) $ by
    constructor
    change comap (Prod.map Function.swap Function.swap) _ = _
    erw [← uniformity_comap]
    congr
    rw [Pi.uniformSpace, UniformSpace.ofCoreEq_toCore, Pi.uniformSpace,
      UniformSpace.ofCoreEq_toCore, UniformSpace.comap_iInf, UniformOnFun.iInf_eq]
    refine' iInf_congr fun i => _
    rw [← UniformSpace.comap_comap, UniformOnFun.comap_eq]
    

Proof state:
case comap_uniformity.h.e_2.h
α : Type u_1
β : Type u_2
γ : Type u_3
ι : Type u_4
s s' : Set α
x : α
p : Filter ι
g : ι → α
inst✝¹ : UniformSpace β
𝔖 : Set (Set α)
δ : ι → Type u_5
inst✝ : (i : ι) → UniformSpace (δ i)
i : ι
⊢ UniformSpace.comap ((fun a => a i) ∘ Function.swap) (uniformSpace α (δ i) 𝔖) =
    UniformSpace.comap (fun x => (fun a => a i) ∘ x) (uniformSpace α (δ i) 𝔖)

Next tactic:
rfl
/-- The "main pair" for an algebra `(A, α)` is the pair of morphisms `(F α, ε_FA)`. It is always a
reflexive pair, and will be used to construct the left adjoint to the comparison functor and show it
is an equivalence.
-/
instance main_pair_reflexive (A : (adj).toMonad.Algebra) :
    IsReflexivePair ((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)
⊢ IsReflexivePair (F.map A.a) (adj.counit.app (F.obj A.A))

Next tactic:
apply IsReflexivePair.mk' ((F).map ((adj).unit.app _)) _ _
/-- The "main pair" for an algebra `(A, α)` is the pair of morphisms `(F α, ε_FA)`. It is always a
reflexive pair, and will be used to construct the left adjoint to the comparison functor and show it
is an equivalence.
-/
instance main_pair_reflexive (A : (adj).toMonad.Algebra) :
    IsReflexivePair ((F).map A.a) ((adj).counit.app ((F).obj A.A)) := by
  apply IsReflexivePair.mk' ((F).map ((adj).unit.app _)) _ _
  · 

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)
⊢ F.map (adj.unit.app A.A) ≫ F.map A.a = 𝟙 (F.obj ((𝟭 C).obj A.A))

Next tactic:
rw [← (F).map_comp, ← (F).map_id]
/-- The "main pair" for an algebra `(A, α)` is the pair of morphisms `(F α, ε_FA)`. It is always a
reflexive pair, and will be used to construct the left adjoint to the comparison functor and show it
is an equivalence.
-/
instance main_pair_reflexive (A : (adj).toMonad.Algebra) :
    IsReflexivePair ((F).map A.a) ((adj).counit.app ((F).obj A.A)) := by
  apply IsReflexivePair.mk' ((F).map ((adj).unit.app _)) _ _
  · rw [← (F).map_comp, ← (F).map_id]
    

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)
⊢ F.map (adj.unit.app A.A ≫ A.a) = F.map (𝟙 ((𝟭 C).obj A.A))

Next tactic:
exact congr_arg (F).map A.unit
/-- The "main pair" for an algebra `(A, α)` is the pair of morphisms `(F α, ε_FA)`. It is always a
reflexive pair, and will be used to construct the left adjoint to the comparison functor and show it
is an equivalence.
-/
instance main_pair_reflexive (A : (adj).toMonad.Algebra) :
    IsReflexivePair ((F).map A.a) ((adj).counit.app ((F).obj A.A)) := by
  apply IsReflexivePair.mk' ((F).map ((adj).unit.app _)) _ _
  · rw [← (F).map_comp, ← (F).map_id]
    exact congr_arg (F).map A.unit
  · 

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)
⊢ F.map (adj.unit.app A.A) ≫ adj.counit.app (F.obj A.A) = 𝟙 (F.obj ((𝟭 C).obj A.A))

Next tactic:
rw [(adj).left_triangle_components]
/-- The "main pair" for an algebra `(A, α)` is the pair of morphisms `(F α, ε_FA)`. It is always a
reflexive pair, and will be used to construct the left adjoint to the comparison functor and show it
is an equivalence.
-/
instance main_pair_reflexive (A : (adj).toMonad.Algebra) :
    IsReflexivePair ((F).map A.a) ((adj).counit.app ((F).obj A.A)) := by
  apply IsReflexivePair.mk' ((F).map ((adj).unit.app _)) _ _
  · rw [← (F).map_comp, ← (F).map_id]
    exact congr_arg (F).map A.unit
  · rw [(adj).left_triangle_components]
    

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)
⊢ 𝟙 (F.obj A.A) = 𝟙 (F.obj ((𝟭 C).obj A.A))

Next tactic:
rfl
/--
We have a bijection of homsets which will be used to construct the left adjoint to the comparison
functor.
-/
@[simps!]
def comparisonLeftAdjointHomEquiv (A : (adj).toMonad.Algebra) (B : D)
    [HasCoequalizer ((F).map A.a) ((adj).counit.app ((F).obj A.A))] :
    (comparisonLeftAdjointObj A ⟶ B) ≃ (A ⟶ (comparison adj).obj B) :=
  calc
    (comparisonLeftAdjointObj A ⟶ B) ≃ { f : (F).obj A.A ⟶ B // _ } :=
      Cofork.IsColimit.homIso (colimit.isColimit _) B
    _ ≃ { g : A.A ⟶ G.obj B // G.map ((F).map g) ≫ G.map ((adj).counit.app B) = A.a ≫ 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
A : Algebra (Adjunction.toMonad adj)
B : D
inst✝ : HasCoequalizer (F.map A.a) (adj.counit.app (F.obj A.A))
⊢ { f // F.map A.a ≫ f = adj.counit.app (F.obj A.A) ≫ f } ≃
    { g // G.map (F.map g) ≫ G.map (adj.counit.app B) = A.a ≫ g }

Next tactic:
refine' ((adj).homEquiv _ _).subtypeEquiv _
/--
We have a bijection of homsets which will be used to construct the left adjoint to the comparison
functor.
-/
@[simps!]
def comparisonLeftAdjointHomEquiv (A : (adj).toMonad.Algebra) (B : D)
    [HasCoequalizer ((F).map A.a) ((adj).counit.app ((F).obj A.A))] :
    (comparisonLeftAdjointObj A ⟶ B) ≃ (A ⟶ (comparison adj).obj B) :=
  calc
    (comparisonLeftAdjointObj A ⟶ B) ≃ { f : (F).obj A.A ⟶ B // _ } :=
      Cofork.IsColimit.homIso (colimit.isColimit _) B
    _ ≃ { g : A.A ⟶ G.obj B // G.map ((F).map g) ≫ G.map ((adj).counit.app B) = A.a ≫ g } := by
      refine' ((adj).homEquiv _ _).subtypeEquiv _
      

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)
B : D
inst✝ : HasCoequalizer (F.map A.a) (adj.counit.app (F.obj A.A))
⊢ ∀ (a : F.obj A.A ⟶ B),
    F.map A.a ≫ a = adj.counit.app (F.obj A.A) ≫ a ↔
      G.map (F.map ((Adjunction.homEquiv adj A.A B) a)) ≫ G.map (adj.counit.app B) =
        A.a ≫ (Adjunction.homEquiv adj A.A B) a

Next tactic:
intro f
/--
We have a bijection of homsets which will be used to construct the left adjoint to the comparison
functor.
-/
@[simps!]
def comparisonLeftAdjointHomEquiv (A : (adj).toMonad.Algebra) (B : D)
    [HasCoequalizer ((F).map A.a) ((adj).counit.app ((F).obj A.A))] :
    (comparisonLeftAdjointObj A ⟶ B) ≃ (A ⟶ (comparison adj).obj B) :=
  calc
    (comparisonLeftAdjointObj A ⟶ B) ≃ { f : (F).obj A.A ⟶ B // _ } :=
      Cofork.IsColimit.homIso (colimit.isColimit _) B
    _ ≃ { g : A.A ⟶ G.obj B // G.map ((F).map g) ≫ G.map ((adj).counit.app B) = A.a ≫ g } := by
      refine' ((adj).homEquiv _ _).subtypeEquiv _
      intro 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
A : Algebra (Adjunction.toMonad adj)
B : D
inst✝ : HasCoequalizer (F.map A.a) (adj.counit.app (F.obj A.A))
f : F.obj A.A ⟶ B
⊢ F.map A.a ≫ f = adj.counit.app (F.obj A.A) ≫ f ↔
    G.map (F.map ((Adjunction.homEquiv adj A.A B) f)) ≫ G.map (adj.counit.app B) =
      A.a ≫ (Adjunction.homEquiv adj A.A B) f

Next tactic:
rw [← ((adj).homEquiv _ _).injective.eq_iff, Adjunction.homEquiv_naturality_left,
        (adj).homEquiv_unit, (adj).homEquiv_unit, G.map_comp]
/--
We have a bijection of homsets which will be used to construct the left adjoint to the comparison
functor.
-/
@[simps!]
def comparisonLeftAdjointHomEquiv (A : (adj).toMonad.Algebra) (B : D)
    [HasCoequalizer ((F).map A.a) ((adj).counit.app ((F).obj A.A))] :
    (comparisonLeftAdjointObj A ⟶ B) ≃ (A ⟶ (comparison adj).obj B) :=
  calc
    (comparisonLeftAdjointObj A ⟶ B) ≃ { f : (F).obj A.A ⟶ B // _ } :=
      Cofork.IsColimit.homIso (colimit.isColimit _) B
    _ ≃ { g : A.A ⟶ G.obj B // G.map ((F).map g) ≫ G.map ((adj).counit.app B) = A.a ≫ g } := by
      refine' ((adj).homEquiv _ _).subtypeEquiv _
      intro f
      rw [← ((adj).homEquiv _ _).injective.eq_iff, Adjunction.homEquiv_naturality_left,
        (adj).homEquiv_unit, (adj).homEquiv_unit, G.map_comp]
      

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)
B : D
inst✝ : HasCoequalizer (F.map A.a) (adj.counit.app (F.obj A.A))
f : F.obj A.A ⟶ B
⊢ A.a ≫ adj.unit.app A.A ≫ G.map f =
      adj.unit.app ((Adjunction.toMonad adj).toFunctor.obj A.A) ≫ G.map (adj.counit.app (F.obj A.A)) ≫ G.map f ↔
    G.map (F.map (adj.unit.app A.A ≫ G.map f)) ≫ G.map (adj.counit.app B) = A.a ≫ adj.unit.app A.A ≫ G.map f

Next tactic:
dsimp
/--
We have a bijection of homsets which will be used to construct the left adjoint to the comparison
functor.
-/
@[simps!]
def comparisonLeftAdjointHomEquiv (A : (adj).toMonad.Algebra) (B : D)
    [HasCoequalizer ((F).map A.a) ((adj).counit.app ((F).obj A.A))] :
    (comparisonLeftAdjointObj A ⟶ B) ≃ (A ⟶ (comparison adj).obj B) :=
  calc
    (comparisonLeftAdjointObj A ⟶ B) ≃ { f : (F).obj A.A ⟶ B // _ } :=
      Cofork.IsColimit.homIso (colimit.isColimit _) B
    _ ≃ { g : A.A ⟶ G.obj B // G.map ((F).map g) ≫ G.map ((adj).counit.app B) = A.a ≫ g } := by
      refine' ((adj).homEquiv _ _).subtypeEquiv _
      intro f
      rw [← ((adj).homEquiv _ _).injective.eq_iff, Adjunction.homEquiv_naturality_left,
        (adj).homEquiv_unit, (adj).homEquiv_unit, G.map_comp]
      dsimp
      

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)
B : D
inst✝ : HasCoequalizer (F.map A.a) (adj.counit.app (F.obj A.A))
f : F.obj A.A ⟶ B
⊢ A.a ≫ adj.unit.app A.A ≫ G.map f = adj.unit.app (G.obj (F.obj A.A)) ≫ G.map (adj.counit.app (F.obj A.A)) ≫ G.map f ↔
    G.map (F.map (adj.unit.app A.A ≫ G.map f)) ≫ G.map (adj.counit.app B) = A.a ≫ adj.unit.app A.A ≫ G.map f

Next tactic:
rw [(adj).right_triangle_components_assoc, ← G.map_comp, (F).map_comp, Category.assoc,
        (adj).counit_naturality, (adj).left_triangle_components_assoc]
/--
We have a bijection of homsets which will be used to construct the left adjoint to the comparison
functor.
-/
@[simps!]
def comparisonLeftAdjointHomEquiv (A : (adj).toMonad.Algebra) (B : D)
    [HasCoequalizer ((F).map A.a) ((adj).counit.app ((F).obj A.A))] :
    (comparisonLeftAdjointObj A ⟶ B) ≃ (A ⟶ (comparison adj).obj B) :=
  calc
    (comparisonLeftAdjointObj A ⟶ B) ≃ { f : (F).obj A.A ⟶ B // _ } :=
      Cofork.IsColimit.homIso (colimit.isColimit _) B
    _ ≃ { g : A.A ⟶ G.obj B // G.map ((F).map g) ≫ G.map ((adj).counit.app B) = A.a ≫ g } := by
      refine' ((adj).homEquiv _ _).subtypeEquiv _
      intro f
      rw [← ((adj).homEquiv _ _).injective.eq_iff, Adjunction.homEquiv_naturality_left,
        (adj).homEquiv_unit, (adj).homEquiv_unit, G.map_comp]
      dsimp
      rw [(adj).right_triangle_components_assoc, ← G.map_comp, (F).map_comp, Category.assoc,
        (adj).counit_naturality, (adj).left_triangle_components_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
A : Algebra (Adjunction.toMonad adj)
B : D
inst✝ : HasCoequalizer (F.map A.a) (adj.counit.app (F.obj A.A))
f : F.obj A.A ⟶ B
⊢ A.a ≫ adj.unit.app A.A ≫ G.map f = G.map f ↔ G.map f = A.a ≫ adj.unit.app A.A ≫ G.map f

Next tactic:
apply eq_comm
/--
We have a bijection of homsets which will be used to construct the left adjoint to the comparison
functor.
-/
@[simps!]
def comparisonLeftAdjointHomEquiv (A : (adj).toMonad.Algebra) (B : D)
    [HasCoequalizer ((F).map A.a) ((adj).counit.app ((F).obj A.A))] :
    (comparisonLeftAdjointObj A ⟶ B) ≃ (A ⟶ (comparison adj).obj B) :=
  calc
    (comparisonLeftAdjointObj A ⟶ B) ≃ { f : (F).obj A.A ⟶ B // _ } :=
      Cofork.IsColimit.homIso (colimit.isColimit _) B
    _ ≃ { g : A.A ⟶ G.obj B // G.map ((F).map g) ≫ G.map ((adj).counit.app B) = A.a ≫ g } := by
      refine' ((adj).homEquiv _ _).subtypeEquiv _
      intro f
      rw [← ((adj).homEquiv _ _).injective.eq_iff, Adjunction.homEquiv_naturality_left,
        (adj).homEquiv_unit, (adj).homEquiv_unit, G.map_comp]
      dsimp
      rw [(adj).right_triangle_components_assoc, ← G.map_comp, (F).map_comp, Category.assoc,
        (adj).counit_naturality, (adj).left_triangle_components_assoc]
      apply eq_comm
    _ ≃ (A ⟶ (comparison adj).obj B) :=
      { toFun := fun g =>
          { f := _
            h := g.prop }
        invFun := fun f => ⟨f.f, f.h⟩
        left_inv := fun 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
A : Algebra (Adjunction.toMonad adj)
B : D
inst✝ : HasCoequalizer (F.map A.a) (adj.counit.app (F.obj A.A))
g : { g // G.map (F.map g) ≫ G.map (adj.counit.app B) = A.a ≫ g }
⊢ (fun f =>
        { val := f.f,
          property := (_ : (Adjunction.toMonad adj).toFunctor.map f.f ≫ ((comparison adj).obj B).a = A.a ≫ f.f) })
      ((fun g => Algebra.Hom.mk ↑g) g) =
    g

Next tactic:
ext
/--
We have a bijection of homsets which will be used to construct the left adjoint to the comparison
functor.
-/
@[simps!]
def comparisonLeftAdjointHomEquiv (A : (adj).toMonad.Algebra) (B : D)
    [HasCoequalizer ((F).map A.a) ((adj).counit.app ((F).obj A.A))] :
    (comparisonLeftAdjointObj A ⟶ B) ≃ (A ⟶ (comparison adj).obj B) :=
  calc
    (comparisonLeftAdjointObj A ⟶ B) ≃ { f : (F).obj A.A ⟶ B // _ } :=
      Cofork.IsColimit.homIso (colimit.isColimit _) B
    _ ≃ { g : A.A ⟶ G.obj B // G.map ((F).map g) ≫ G.map ((adj).counit.app B) = A.a ≫ g } := by
      refine' ((adj).homEquiv _ _).subtypeEquiv _
      intro f
      rw [← ((adj).homEquiv _ _).injective.eq_iff, Adjunction.homEquiv_naturality_left,
        (adj).homEquiv_unit, (adj).homEquiv_unit, G.map_comp]
      dsimp
      rw [(adj).right_triangle_components_assoc, ← G.map_comp, (F).map_comp, Category.assoc,
        (adj).counit_naturality, (adj).left_triangle_components_assoc]
      apply eq_comm
    _ ≃ (A ⟶ (comparison adj).obj B) :=
      { toFun := fun g =>
          { f := _
            h := g.prop }
        invFun := fun f => ⟨f.f, f.h⟩
        left_inv := fun g => by ext; 

Proof state:
case a
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)
B : D
inst✝ : HasCoequalizer (F.map A.a) (adj.counit.app (F.obj A.A))
g : { g // G.map (F.map g) ≫ G.map (adj.counit.app B) = A.a ≫ g }
⊢ ↑((fun f =>
          { val := f.f,
            property := (_ : (Adjunction.toMonad adj).toFunctor.map f.f ≫ ((comparison adj).obj B).a = A.a ≫ f.f) })
        ((fun g => Algebra.Hom.mk ↑g) g)) =
    ↑g

Next tactic:
rfl
/--
We have a bijection of homsets which will be used to construct the left adjoint to the comparison
functor.
-/
@[simps!]
def comparisonLeftAdjointHomEquiv (A : (adj).toMonad.Algebra) (B : D)
    [HasCoequalizer ((F).map A.a) ((adj).counit.app ((F).obj A.A))] :
    (comparisonLeftAdjointObj A ⟶ B) ≃ (A ⟶ (comparison adj).obj B) :=
  calc
    (comparisonLeftAdjointObj A ⟶ B) ≃ { f : (F).obj A.A ⟶ B // _ } :=
      Cofork.IsColimit.homIso (colimit.isColimit _) B
    _ ≃ { g : A.A ⟶ G.obj B // G.map ((F).map g) ≫ G.map ((adj).counit.app B) = A.a ≫ g } := by
      refine' ((adj).homEquiv _ _).subtypeEquiv _
      intro f
      rw [← ((adj).homEquiv _ _).injective.eq_iff, Adjunction.homEquiv_naturality_left,
        (adj).homEquiv_unit, (adj).homEquiv_unit, G.map_comp]
      dsimp
      rw [(adj).right_triangle_components_assoc, ← G.map_comp, (F).map_comp, Category.assoc,
        (adj).counit_naturality, (adj).left_triangle_components_assoc]
      apply eq_comm
    _ ≃ (A ⟶ (comparison adj).obj B) :=
      { toFun := fun g =>
          { f := _
            h := g.prop }
        invFun := fun f => ⟨f.f, f.h⟩
        left_inv := fun g => by ext; rfl
        right_inv := fun f => 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)
B : D
inst✝ : HasCoequalizer (F.map A.a) (adj.counit.app (F.obj A.A))
f : A ⟶ (comparison adj).obj B
⊢ (fun g => Algebra.Hom.mk ↑g)
      ((fun f =>
          { val := f.f,
            property := (_ : (Adjunction.toMonad adj).toFunctor.map f.f ≫ ((comparison adj).obj B).a = A.a ≫ f.f) })
        f) =
    f

Next tactic:
ext
/--
We have a bijection of homsets which will be used to construct the left adjoint to the comparison
functor.
-/
@[simps!]
def comparisonLeftAdjointHomEquiv (A : (adj).toMonad.Algebra) (B : D)
    [HasCoequalizer ((F).map A.a) ((adj).counit.app ((F).obj A.A))] :
    (comparisonLeftAdjointObj A ⟶ B) ≃ (A ⟶ (comparison adj).obj B) :=
  calc
    (comparisonLeftAdjointObj A ⟶ B) ≃ { f : (F).obj A.A ⟶ B // _ } :=
      Cofork.IsColimit.homIso (colimit.isColimit _) B
    _ ≃ { g : A.A ⟶ G.obj B // G.map ((F).map g) ≫ G.map ((adj).counit.app B) = A.a ≫ g } := by
      refine' ((adj).homEquiv _ _).subtypeEquiv _
      intro f
      rw [← ((adj).homEquiv _ _).injective.eq_iff, Adjunction.homEquiv_naturality_left,
        (adj).homEquiv_unit, (adj).homEquiv_unit, G.map_comp]
      dsimp
      rw [(adj).right_triangle_components_assoc, ← G.map_comp, (F).map_comp, Category.assoc,
        (adj).counit_naturality, (adj).left_triangle_components_assoc]
      apply eq_comm
    _ ≃ (A ⟶ (comparison adj).obj B) :=
      { toFun := fun g =>
          { f := _
            h := g.prop }
        invFun := fun f => ⟨f.f, f.h⟩
        left_inv := fun g => by ext; rfl
        right_inv := fun f => by 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
A : Algebra (Adjunction.toMonad adj)
B : D
inst✝ : HasCoequalizer (F.map A.a) (adj.counit.app (F.obj A.A))
f : A ⟶ (comparison adj).obj B
⊢ ((fun g => Algebra.Hom.mk ↑g)
        ((fun f =>
            { val := f.f,
              property := (_ : (Adjunction.toMonad adj).toFunctor.map f.f ≫ ((comparison adj).obj B).a = A.a ≫ f.f) })
          f)).f =
    f.f

Next tactic:
rfl
/-- Construct the adjunction to the comparison functor.
-/
def leftAdjointComparison
    [∀ A : (adj).toMonad.Algebra, HasCoequalizer ((F).map A.a)
      ((adj).counit.app ((F).obj A.A))] :
    (adj).toMonad.Algebra ⥤ D := 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))
⊢ Algebra (Adjunction.toMonad adj) ⥤ D

Next tactic:
refine'
    Adjunction.leftAdjointOfEquiv (G := comparison adj)
      (F_obj := fun A => comparisonLeftAdjointObj A) (fun A B => _) _
/-- Construct the adjunction to the comparison functor.
-/
def leftAdjointComparison
    [∀ A : (adj).toMonad.Algebra, HasCoequalizer ((F).map A.a)
      ((adj).counit.app ((F).obj A.A))] :
    (adj).toMonad.Algebra ⥤ D := by
  refine'
    Adjunction.leftAdjointOfEquiv (G := comparison adj)
      (F_obj := fun A => comparisonLeftAdjointObj A) (fun A B => _) _
  · 

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✝ : ∀ (A : Algebra (Adjunction.toMonad adj)), HasCoequalizer (F.map A.a) (adj.counit.app (F.obj A.A))
A : Algebra (Adjunction.toMonad adj)
B : D
⊢ ((fun A => comparisonLeftAdjointObj A) A ⟶ B) ≃ (A ⟶ (comparison adj).obj B)

Next tactic:
apply comparisonLeftAdjointHomEquiv
/-- Construct the adjunction to the comparison functor.
-/
def leftAdjointComparison
    [∀ A : (adj).toMonad.Algebra, HasCoequalizer ((F).map A.a)
      ((adj).counit.app ((F).obj A.A))] :
    (adj).toMonad.Algebra ⥤ D := by
  refine'
    Adjunction.leftAdjointOfEquiv (G := comparison adj)
      (F_obj := fun A => comparisonLeftAdjointObj A) (fun A B => _) _
  · apply comparisonLeftAdjointHomEquiv
  · 

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✝ : ∀ (A : Algebra (Adjunction.toMonad adj)), HasCoequalizer (F.map A.a) (adj.counit.app (F.obj A.A))
⊢ ∀ (X : Algebra (Adjunction.toMonad adj)) (Y Y' : D) (g : Y ⟶ Y') (h : (fun A => comparisonLeftAdjointObj A) X ⟶ Y),
    ((fun A B => comparisonLeftAdjointHomEquiv A B) X Y') (h ≫ g) =
      ((fun A B => comparisonLeftAdjointHomEquiv A B) X Y) h ≫ (comparison adj).map g

Next tactic:
intro A B B' g h
/-- Construct the adjunction to the comparison functor.
-/
def leftAdjointComparison
    [∀ A : (adj).toMonad.Algebra, HasCoequalizer ((F).map A.a)
      ((adj).counit.app ((F).obj A.A))] :
    (adj).toMonad.Algebra ⥤ D := by
  refine'
    Adjunction.leftAdjointOfEquiv (G := comparison adj)
      (F_obj := fun A => comparisonLeftAdjointObj A) (fun A B => _) _
  · apply comparisonLeftAdjointHomEquiv
  · intro A B B' g h
    

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✝ : ∀ (A : Algebra (Adjunction.toMonad adj)), HasCoequalizer (F.map A.a) (adj.counit.app (F.obj A.A))
A : Algebra (Adjunction.toMonad adj)
B B' : D
g : B ⟶ B'
h : (fun A => comparisonLeftAdjointObj A) A ⟶ B
⊢ ((fun A B => comparisonLeftAdjointHomEquiv A B) A B') (h ≫ g) =
    ((fun A B => comparisonLeftAdjointHomEquiv A B) A B) h ≫ (comparison adj).map g

Next tactic:
ext1
/-- Construct the adjunction to the comparison functor.
-/
def leftAdjointComparison
    [∀ A : (adj).toMonad.Algebra, HasCoequalizer ((F).map A.a)
      ((adj).counit.app ((F).obj A.A))] :
    (adj).toMonad.Algebra ⥤ D := by
  refine'
    Adjunction.leftAdjointOfEquiv (G := comparison adj)
      (F_obj := fun A => comparisonLeftAdjointObj A) (fun A B => _) _
  · apply comparisonLeftAdjointHomEquiv
  · intro A B B' g h
    ext1
    -- Porting note: the goal was previously closed by the following, which succeeds until
    -- `Category.assoc`.
    -- dsimp [comparisonLeftAdjointHomEquiv]
    -- rw [← (adj).homEquiv_naturality_right, Category.assoc]
    

Proof state:
case refine'_2.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))
A : Algebra (Adjunction.toMonad adj)
B B' : D
g : B ⟶ B'
h : (fun A => comparisonLeftAdjointObj A) A ⟶ B
⊢ (((fun A B => comparisonLeftAdjointHomEquiv A B) A B') (h ≫ g)).f =
    (((fun A B => comparisonLeftAdjointHomEquiv A B) A B) h ≫ (comparison adj).map g).f

Next tactic:
simp [Cofork.IsColimit.homIso]