source stringlengths 17 118 | lean4 stringlengths 0 335k |
|---|---|
.lake/packages/mathlib/Mathlib/CategoryTheory/Abelian/LeftDerived.lean | import Mathlib.Algebra.Homology.Additive
import Mathlib.CategoryTheory.Abelian.Projective.Resolution
/-!
# Left-derived functors
We define the left-derived functors `F.leftDerived n : C ⥤ D` for any additive functor `F`
out of a category with projective resolutions.
We first define a functor
`F.leftDerivedToHomotopyCategory : C ⥤ HomotopyCategory D (ComplexShape.down ℕ)` which is
`projectiveResolutions C ⋙ F.mapHomotopyCategory _`. We show that if `X : C` and
`P : ProjectiveResolution X`, then `F.leftDerivedToHomotopyCategory.obj X` identifies
to the image in the homotopy category of the functor `F` applied objectwise to `P.complex`
(this isomorphism is `P.isoLeftDerivedToHomotopyCategoryObj F`).
Then, the left-derived functors `F.leftDerived n : C ⥤ D` are obtained by composing
`F.leftDerivedToHomotopyCategory` with the homology functors on the homotopy category.
Similarly we define natural transformations between left-derived functors coming from
natural transformations between the original additive functors,
and show how to compute the components.
## Main results
* `Functor.isZero_leftDerived_obj_projective_succ`: projective objects have no higher
left derived functor.
* `NatTrans.leftDerived`: the natural isomorphism between left derived functors
induced by natural transformation.
* `Functor.fromLeftDerivedZero`: the natural transformation `F.leftDerived 0 ⟶ F`,
which is an isomorphism when `F` is right exact (i.e. preserves finite colimits),
see also `Functor.leftDerivedZeroIsoSelf`.
## TODO
* refactor `Functor.leftDerived` (and `Functor.rightDerived`) when the necessary
material enters mathlib: derived categories, injective/projective derivability
structures, existence of derived functors from derivability structures.
Eventually, we shall get a right derived functor
`F.leftDerivedFunctorMinus : DerivedCategory.Minus C ⥤ DerivedCategory.Minus D`,
and `F.leftDerived` shall be redefined using `F.leftDerivedFunctorMinus`.
-/
universe v u
namespace CategoryTheory
open Category Limits
variable {C : Type u} [Category.{v} C] {D : Type*} [Category D]
[Abelian C] [HasProjectiveResolutions C] [Abelian D]
/-- When `F : C ⥤ D` is an additive functor, this is
the functor `C ⥤ HomotopyCategory D (ComplexShape.down ℕ)` which
sends `X : C` to `F` applied to a projective resolution of `X`. -/
noncomputable def Functor.leftDerivedToHomotopyCategory (F : C ⥤ D) [F.Additive] :
C ⥤ HomotopyCategory D (ComplexShape.down ℕ) :=
projectiveResolutions C ⋙ F.mapHomotopyCategory _
/-- If `P : ProjectiveResolution Z` and `F : C ⥤ D` is an additive functor, this is
an isomorphism between `F.leftDerivedToHomotopyCategory.obj X` and the complex
obtained by applying `F` to `P.complex`. -/
noncomputable def ProjectiveResolution.isoLeftDerivedToHomotopyCategoryObj {X : C}
(P : ProjectiveResolution X) (F : C ⥤ D) [F.Additive] :
F.leftDerivedToHomotopyCategory.obj X ≅
(F.mapHomologicalComplex _ ⋙ HomotopyCategory.quotient _ _).obj P.complex :=
(F.mapHomotopyCategory _).mapIso P.iso ≪≫
(F.mapHomotopyCategoryFactors _).app P.complex
@[reassoc]
lemma ProjectiveResolution.isoLeftDerivedToHomotopyCategoryObj_inv_naturality
{X Y : C} (f : X ⟶ Y) (P : ProjectiveResolution X) (Q : ProjectiveResolution Y)
(φ : P.complex ⟶ Q.complex) (comm : φ.f 0 ≫ Q.π.f 0 = P.π.f 0 ≫ f)
(F : C ⥤ D) [F.Additive] :
(P.isoLeftDerivedToHomotopyCategoryObj F).inv ≫ F.leftDerivedToHomotopyCategory.map f =
(F.mapHomologicalComplex _ ⋙ HomotopyCategory.quotient _ _).map φ ≫
(Q.isoLeftDerivedToHomotopyCategoryObj F).inv := by
dsimp [Functor.leftDerivedToHomotopyCategory, isoLeftDerivedToHomotopyCategoryObj]
rw [assoc, ← Functor.map_comp, iso_inv_naturality f P Q φ comm, Functor.map_comp]
erw [(F.mapHomotopyCategoryFactors (ComplexShape.down ℕ)).inv.naturality_assoc]
rfl
@[reassoc]
lemma ProjectiveResolution.isoLeftDerivedToHomotopyCategoryObj_hom_naturality
{X Y : C} (f : X ⟶ Y) (P : ProjectiveResolution X) (Q : ProjectiveResolution Y)
(φ : P.complex ⟶ Q.complex) (comm : φ.f 0 ≫ Q.π.f 0 = P.π.f 0 ≫ f)
(F : C ⥤ D) [F.Additive] :
F.leftDerivedToHomotopyCategory.map f ≫ (Q.isoLeftDerivedToHomotopyCategoryObj F).hom =
(P.isoLeftDerivedToHomotopyCategoryObj F).hom ≫
(F.mapHomologicalComplex _ ⋙ HomotopyCategory.quotient _ _).map φ := by
dsimp
rw [← cancel_epi (P.isoLeftDerivedToHomotopyCategoryObj F).inv, Iso.inv_hom_id_assoc,
isoLeftDerivedToHomotopyCategoryObj_inv_naturality_assoc f P Q φ comm F,
Iso.inv_hom_id, comp_id]
/-- The left derived functors of an additive functor. -/
noncomputable def Functor.leftDerived (F : C ⥤ D) [F.Additive] (n : ℕ) : C ⥤ D :=
F.leftDerivedToHomotopyCategory ⋙ HomotopyCategory.homologyFunctor D _ n
/-- We can compute a left derived functor using a chosen projective resolution. -/
noncomputable def ProjectiveResolution.isoLeftDerivedObj {X : C} (P : ProjectiveResolution X)
(F : C ⥤ D) [F.Additive] (n : ℕ) :
(F.leftDerived n).obj X ≅
(HomologicalComplex.homologyFunctor D _ n).obj
((F.mapHomologicalComplex _).obj P.complex) :=
(HomotopyCategory.homologyFunctor D _ n).mapIso
(P.isoLeftDerivedToHomotopyCategoryObj F) ≪≫
(HomotopyCategory.homologyFunctorFactors D (ComplexShape.down ℕ) n).app _
@[reassoc]
lemma ProjectiveResolution.isoLeftDerivedObj_hom_naturality
{X Y : C} (f : X ⟶ Y) (P : ProjectiveResolution X) (Q : ProjectiveResolution Y)
(φ : P.complex ⟶ Q.complex) (comm : φ.f 0 ≫ Q.π.f 0 = P.π.f 0 ≫ f)
(F : C ⥤ D) [F.Additive] (n : ℕ) :
(F.leftDerived n).map f ≫ (Q.isoLeftDerivedObj F n).hom =
(P.isoLeftDerivedObj F n).hom ≫
(F.mapHomologicalComplex _ ⋙ HomologicalComplex.homologyFunctor _ _ n).map φ := by
dsimp [isoLeftDerivedObj, Functor.leftDerived]
rw [assoc, ← Functor.map_comp_assoc,
ProjectiveResolution.isoLeftDerivedToHomotopyCategoryObj_hom_naturality f P Q φ comm F,
Functor.map_comp, assoc]
erw [(HomotopyCategory.homologyFunctorFactors D (ComplexShape.down ℕ) n).hom.naturality]
rfl
@[reassoc]
lemma ProjectiveResolution.isoLeftDerivedObj_inv_naturality
{X Y : C} (f : X ⟶ Y) (P : ProjectiveResolution X) (Q : ProjectiveResolution Y)
(φ : P.complex ⟶ Q.complex) (comm : φ.f 0 ≫ Q.π.f 0 = P.π.f 0 ≫ f)
(F : C ⥤ D) [F.Additive] (n : ℕ) :
(P.isoLeftDerivedObj F n).inv ≫ (F.leftDerived n).map f =
(F.mapHomologicalComplex _ ⋙ HomologicalComplex.homologyFunctor _ _ n).map φ ≫
(Q.isoLeftDerivedObj F n).inv := by
rw [← cancel_mono (Q.isoLeftDerivedObj F n).hom, assoc, assoc,
ProjectiveResolution.isoLeftDerivedObj_hom_naturality f P Q φ comm F n,
Iso.inv_hom_id_assoc, Iso.inv_hom_id, comp_id]
/-- The higher derived functors vanish on projective objects. -/
lemma Functor.isZero_leftDerived_obj_projective_succ
(F : C ⥤ D) [F.Additive] (n : ℕ) (X : C) [Projective X] :
IsZero ((F.leftDerived (n + 1)).obj X) := by
refine IsZero.of_iso ?_ ((ProjectiveResolution.self X).isoLeftDerivedObj F (n + 1))
erw [← HomologicalComplex.exactAt_iff_isZero_homology]
exact ShortComplex.exact_of_isZero_X₂ _ (F.map_isZero (by apply isZero_zero))
/-- We can compute a left derived functor on a morphism using a descent of that morphism
to a chain map between chosen projective resolutions.
-/
theorem Functor.leftDerived_map_eq (F : C ⥤ D) [F.Additive] (n : ℕ) {X Y : C} (f : X ⟶ Y)
{P : ProjectiveResolution X} {Q : ProjectiveResolution Y} (g : P.complex ⟶ Q.complex)
(w : g ≫ Q.π = P.π ≫ (ChainComplex.single₀ C).map f) :
(F.leftDerived n).map f =
(P.isoLeftDerivedObj F n).hom ≫
(F.mapHomologicalComplex _ ⋙ HomologicalComplex.homologyFunctor _ _ n).map g ≫
(Q.isoLeftDerivedObj F n).inv := by
rw [← cancel_mono (Q.isoLeftDerivedObj F n).hom,
ProjectiveResolution.isoLeftDerivedObj_hom_naturality f P Q g _ F n,
assoc, assoc, Iso.inv_hom_id, comp_id]
rw [← HomologicalComplex.comp_f, w, HomologicalComplex.comp_f,
ChainComplex.single₀_map_f_zero]
/-- The natural transformation
`F.leftDerivedToHomotopyCategory ⟶ G.leftDerivedToHomotopyCategory` induced by
a natural transformation `F ⟶ G` between additive functors. -/
noncomputable def NatTrans.leftDerivedToHomotopyCategory
{F G : C ⥤ D} [F.Additive] [G.Additive] (α : F ⟶ G) :
F.leftDerivedToHomotopyCategory ⟶ G.leftDerivedToHomotopyCategory :=
Functor.whiskerLeft _ (NatTrans.mapHomotopyCategory α (ComplexShape.down ℕ))
lemma ProjectiveResolution.leftDerivedToHomotopyCategory_app_eq
{F G : C ⥤ D} [F.Additive] [G.Additive] (α : F ⟶ G) {X : C} (P : ProjectiveResolution X) :
(NatTrans.leftDerivedToHomotopyCategory α).app X =
(P.isoLeftDerivedToHomotopyCategoryObj F).hom ≫
(HomotopyCategory.quotient _ _).map
((NatTrans.mapHomologicalComplex α _).app P.complex) ≫
(P.isoLeftDerivedToHomotopyCategoryObj G).inv := by
rw [← cancel_mono (P.isoLeftDerivedToHomotopyCategoryObj G).hom, assoc, assoc,
Iso.inv_hom_id, comp_id]
dsimp [isoLeftDerivedToHomotopyCategoryObj, Functor.mapHomotopyCategoryFactors,
NatTrans.leftDerivedToHomotopyCategory]
rw [assoc]
erw [id_comp, comp_id]
obtain ⟨β, hβ⟩ := (HomotopyCategory.quotient _ _).map_surjective (iso P).hom
rw [← hβ]
dsimp
simp only [← Functor.map_comp, NatTrans.mapHomologicalComplex_naturality]
rfl
@[simp]
lemma NatTrans.leftDerivedToHomotopyCategory_id (F : C ⥤ D) [F.Additive] :
NatTrans.leftDerivedToHomotopyCategory (𝟙 F) = 𝟙 _ := rfl
@[simp, reassoc]
lemma NatTrans.leftDerivedToHomotopyCategory_comp {F G H : C ⥤ D} (α : F ⟶ G) (β : G ⟶ H)
[F.Additive] [G.Additive] [H.Additive] :
NatTrans.leftDerivedToHomotopyCategory (α ≫ β) =
NatTrans.leftDerivedToHomotopyCategory α ≫
NatTrans.leftDerivedToHomotopyCategory β := rfl
/-- The natural transformation between left-derived functors induced by a natural transformation. -/
noncomputable def NatTrans.leftDerived
{F G : C ⥤ D} [F.Additive] [G.Additive] (α : F ⟶ G) (n : ℕ) :
F.leftDerived n ⟶ G.leftDerived n :=
Functor.whiskerRight (NatTrans.leftDerivedToHomotopyCategory α) _
@[simp]
theorem NatTrans.leftDerived_id (F : C ⥤ D) [F.Additive] (n : ℕ) :
NatTrans.leftDerived (𝟙 F) n = 𝟙 (F.leftDerived n) := by
dsimp only [leftDerived]
simp only [leftDerivedToHomotopyCategory_id, Functor.whiskerRight_id']
rfl
@[simp, reassoc]
theorem NatTrans.leftDerived_comp {F G H : C ⥤ D} [F.Additive] [G.Additive] [H.Additive]
(α : F ⟶ G) (β : G ⟶ H) (n : ℕ) :
NatTrans.leftDerived (α ≫ β) n = NatTrans.leftDerived α n ≫ NatTrans.leftDerived β n := by
simp [NatTrans.leftDerived]
namespace ProjectiveResolution
/-- A component of the natural transformation between left-derived functors can be computed
using a chosen projective resolution. -/
lemma leftDerived_app_eq
{F G : C ⥤ D} [F.Additive] [G.Additive] (α : F ⟶ G) {X : C} (P : ProjectiveResolution X)
(n : ℕ) : (NatTrans.leftDerived α n).app X =
(P.isoLeftDerivedObj F n).hom ≫
(HomologicalComplex.homologyFunctor D (ComplexShape.down ℕ) n).map
((NatTrans.mapHomologicalComplex α _).app P.complex) ≫
(P.isoLeftDerivedObj G n).inv := by
dsimp [NatTrans.leftDerived, isoLeftDerivedObj]
rw [ProjectiveResolution.leftDerivedToHomotopyCategory_app_eq α P,
Functor.map_comp, Functor.map_comp, assoc]
erw [← (HomotopyCategory.homologyFunctorFactors D (ComplexShape.down ℕ) n).hom.naturality_assoc
((NatTrans.mapHomologicalComplex α (ComplexShape.down ℕ)).app P.complex)]
simp only [Functor.comp_map, Iso.hom_inv_id_app_assoc]
/-- If `P : ProjectiveResolution X` and `F` is an additive functor, this is
the canonical morphism from the opcycles in degree `0` of
`(F.mapHomologicalComplex _).obj P.complex` to `F.obj X`. -/
noncomputable def fromLeftDerivedZero' {X : C}
(P : ProjectiveResolution X) (F : C ⥤ D) [F.Additive] :
((F.mapHomologicalComplex _).obj P.complex).opcycles 0 ⟶ F.obj X :=
HomologicalComplex.descOpcycles _ (F.map (P.π.f 0)) 1 (by simp) (by
dsimp
rw [← F.map_comp, complex_d_comp_π_f_zero, F.map_zero])
@[reassoc (attr := simp)]
lemma pOpcycles_comp_fromLeftDerivedZero' {C} [Category C] [Abelian C] {X : C}
(P : ProjectiveResolution X) (F : C ⥤ D) [F.Additive] :
HomologicalComplex.pOpcycles _ _ ≫ P.fromLeftDerivedZero' F = F.map (P.π.f 0) := by
simp [fromLeftDerivedZero']
@[reassoc]
lemma fromLeftDerivedZero'_naturality {C} [Category C] [Abelian C] {X Y : C} (f : X ⟶ Y)
(P : ProjectiveResolution X) (Q : ProjectiveResolution Y)
(φ : P.complex ⟶ Q.complex) (comm : φ.f 0 ≫ Q.π.f 0 = P.π.f 0 ≫ f)
(F : C ⥤ D) [F.Additive] :
HomologicalComplex.opcyclesMap ((F.mapHomologicalComplex _).map φ) 0 ≫
Q.fromLeftDerivedZero' F = P.fromLeftDerivedZero' F ≫ F.map f := by
simp only [← cancel_epi (HomologicalComplex.pOpcycles _ _), ← F.map_comp, comm,
HomologicalComplex.p_opcyclesMap_assoc, Functor.mapHomologicalComplex_map_f,
pOpcycles_comp_fromLeftDerivedZero', pOpcycles_comp_fromLeftDerivedZero'_assoc]
instance (F : C ⥤ D) [F.Additive] (X : C) [Projective X] :
IsIso ((ProjectiveResolution.self X).fromLeftDerivedZero' F) := by
dsimp [ProjectiveResolution.fromLeftDerivedZero']
rw [ChainComplex.isIso_descOpcycles_iff]
refine ⟨ShortComplex.Splitting.exact ?_, inferInstance⟩
exact
{ r := 0
s := 𝟙 _
f_r := (F.map_isZero (isZero_zero _)).eq_of_src _ _ }
end ProjectiveResolution
/-- The natural transformation `F.leftDerived 0 ⟶ F`. -/
noncomputable def Functor.fromLeftDerivedZero (F : C ⥤ D) [F.Additive] :
F.leftDerived 0 ⟶ F where
app X := (HomotopyCategory.homologyFunctorFactors D (ComplexShape.down ℕ) 0).hom.app _ ≫
(ChainComplex.isoHomologyι₀ _).hom ≫ (projectiveResolution X).fromLeftDerivedZero' F
naturality {X Y} f := by
dsimp [leftDerived]
rw [assoc, assoc, ← ProjectiveResolution.fromLeftDerivedZero'_naturality f
(projectiveResolution X) (projectiveResolution Y)
(ProjectiveResolution.lift f _ _) (by simp),
← HomologicalComplex.homologyι_naturality_assoc]
erw [← NatTrans.naturality_assoc]
rfl
lemma ProjectiveResolution.fromLeftDerivedZero_eq
{X : C} (P : ProjectiveResolution X) (F : C ⥤ D) [F.Additive] :
F.fromLeftDerivedZero.app X = (P.isoLeftDerivedObj F 0).hom ≫
(ChainComplex.isoHomologyι₀ _).hom ≫
P.fromLeftDerivedZero' F := by
dsimp [Functor.fromLeftDerivedZero, isoLeftDerivedObj]
have h₁ := ProjectiveResolution.fromLeftDerivedZero'_naturality
(𝟙 X) P (projectiveResolution X) (lift (𝟙 X) _ _) (by simp) F
have h₂ : (P.isoLeftDerivedToHomotopyCategoryObj F).inv =
(F.mapHomologicalComplex _ ⋙ HomotopyCategory.quotient _ _).map (lift (𝟙 X) _ _) :=
id_comp _
simp only [Functor.map_id, comp_id] at h₁
rw [assoc, ← cancel_epi ((HomotopyCategory.homologyFunctor _ _ 0).map
(P.isoLeftDerivedToHomotopyCategoryObj F).inv), ← Functor.map_comp_assoc,
Iso.inv_hom_id, Functor.map_id, id_comp, ← h₁, h₂,
← HomologicalComplex.homologyι_naturality_assoc]
erw [← NatTrans.naturality_assoc]
rfl
instance (F : C ⥤ D) [F.Additive] (X : C) [Projective X] :
IsIso (F.fromLeftDerivedZero.app X) := by
rw [(ProjectiveResolution.self X).fromLeftDerivedZero_eq F]
infer_instance
section
variable (F : C ⥤ D) [F.Additive] [PreservesFiniteColimits F]
instance {X : C} (P : ProjectiveResolution X) :
IsIso (P.fromLeftDerivedZero' F) := by
dsimp [ProjectiveResolution.fromLeftDerivedZero']
rw [ChainComplex.isIso_descOpcycles_iff, ShortComplex.exact_and_epi_g_iff_g_is_cokernel]
exact ⟨CokernelCofork.mapIsColimit _ (P.isColimitCokernelCofork) F⟩
instance (X : C) : IsIso (F.fromLeftDerivedZero.app X) := by
dsimp [Functor.fromLeftDerivedZero]
infer_instance
instance : IsIso F.fromLeftDerivedZero :=
NatIso.isIso_of_isIso_app _
namespace Functor
/-- The canonical isomorphism `F.leftDerived 0 ≅ F` when `F` is right exact
(i.e. preserves finite colimits). -/
@[simps! hom]
noncomputable def leftDerivedZeroIsoSelf : F.leftDerived 0 ≅ F :=
(asIso F.fromLeftDerivedZero)
@[reassoc (attr := simp)]
lemma leftDerivedZeroIsoSelf_hom_inv_id :
F.fromLeftDerivedZero ≫ F.leftDerivedZeroIsoSelf.inv = 𝟙 _ :=
F.leftDerivedZeroIsoSelf.hom_inv_id
@[reassoc (attr := simp)]
lemma leftDerivedZeroIsoSelf_inv_hom_id :
F.leftDerivedZeroIsoSelf.inv ≫ F.fromLeftDerivedZero = 𝟙 _ :=
F.leftDerivedZeroIsoSelf.inv_hom_id
@[reassoc (attr := simp)]
lemma leftDerivedZeroIsoSelf_hom_inv_id_app (X : C) :
F.fromLeftDerivedZero.app X ≫ F.leftDerivedZeroIsoSelf.inv.app X = 𝟙 _ :=
F.leftDerivedZeroIsoSelf.hom_inv_id_app X
@[reassoc (attr := simp)]
lemma leftDerivedZeroIsoSelf_inv_hom_id_app (X : C) :
F.leftDerivedZeroIsoSelf.inv.app X ≫ F.fromLeftDerivedZero.app X = 𝟙 _ :=
F.leftDerivedZeroIsoSelf.inv_hom_id_app X
end Functor
end
end CategoryTheory |
.lake/packages/mathlib/Mathlib/CategoryTheory/Abelian/Subobject.lean | import Mathlib.CategoryTheory.Subobject.Limits
import Mathlib.CategoryTheory.Abelian.Basic
/-!
# Equivalence between subobjects and quotients in an abelian category
-/
open CategoryTheory CategoryTheory.Limits Opposite
universe w v u
noncomputable section
namespace CategoryTheory.Abelian
variable {C : Type u} [Category.{v} C]
/-- In an abelian category, the subobjects and quotient objects of an object `X` are
order-isomorphic via taking kernels and cokernels.
Implemented here using subobjects in the opposite category,
since mathlib does not have a notion of quotient objects at the time of writing. -/
@[simps!]
def subobjectIsoSubobjectOp [Abelian C] (X : C) : Subobject X ≃o (Subobject (op X))ᵒᵈ := by
refine OrderIso.ofHomInv (cokernelOrderHom X) (kernelOrderHom X) ?_ ?_
· change (cokernelOrderHom X).comp (kernelOrderHom X) = _
refine OrderHom.ext _ _ (funext (Subobject.ind _ ?_))
intro A f hf
dsimp only [OrderHom.comp_coe, Function.comp_apply, kernelOrderHom_coe, Subobject.lift_mk,
cokernelOrderHom_coe, OrderHom.id_coe, id]
refine Subobject.mk_eq_mk_of_comm _ _
⟨?_, ?_, Quiver.Hom.unop_inj ?_, Quiver.Hom.unop_inj ?_⟩ ?_
· exact (Abelian.epiDesc f.unop _ (cokernel.condition (kernel.ι f.unop))).op
· exact (cokernel.desc _ _ (kernel.condition f.unop)).op
· rw [← cancel_epi (cokernel.π (kernel.ι f.unop))]
simp only [unop_comp, Quiver.Hom.unop_op, unop_id_op, cokernel.π_desc_assoc,
comp_epiDesc, Category.comp_id]
· simp only [← cancel_epi f.unop, unop_comp, Quiver.Hom.unop_op, unop_id, comp_epiDesc_assoc,
cokernel.π_desc, Category.comp_id]
· exact Quiver.Hom.unop_inj (by simp only [unop_comp, Quiver.Hom.unop_op, comp_epiDesc])
· change (kernelOrderHom X).comp (cokernelOrderHom X) = _
refine OrderHom.ext _ _ (funext (Subobject.ind _ ?_))
intro A f hf
dsimp only [OrderHom.comp_coe, Function.comp_apply, cokernelOrderHom_coe, Subobject.lift_mk,
kernelOrderHom_coe, OrderHom.id_coe, id, unop_op, Quiver.Hom.unop_op]
refine Subobject.mk_eq_mk_of_comm _ _ ⟨?_, ?_, ?_, ?_⟩ ?_
· exact Abelian.monoLift f _ (kernel.condition (cokernel.π f))
· exact kernel.lift _ _ (cokernel.condition f)
· simp only [← cancel_mono (kernel.ι (cokernel.π f)), Category.assoc, image.fac, monoLift_comp,
Category.id_comp]
· simp only [← cancel_mono f, Category.assoc, monoLift_comp, image.fac, Category.id_comp]
· simp only [monoLift_comp]
/-- A well-powered abelian category is also well-copowered. -/
instance wellPowered_opposite [Abelian C] [LocallySmall.{w} C] [WellPowered.{w} C] :
WellPowered.{w} Cᵒᵖ where
subobject_small X :=
(small_congr (subobjectIsoSubobjectOp (unop X)).toEquiv).1 inferInstance
end CategoryTheory.Abelian |
.lake/packages/mathlib/Mathlib/CategoryTheory/Abelian/Ext.lean | import Mathlib.Algebra.Category.ModuleCat.Abelian
import Mathlib.Algebra.Homology.Opposite
import Mathlib.CategoryTheory.Abelian.LeftDerived
import Mathlib.CategoryTheory.Abelian.Opposite
import Mathlib.CategoryTheory.Abelian.Projective.Resolution
import Mathlib.CategoryTheory.Linear.Yoneda
/-!
# Ext
We define `Ext R C n : Cᵒᵖ ⥤ C ⥤ Module R` for any `R`-linear abelian category `C`
by (left) deriving in the first argument of the bifunctor `(X, Y) ↦ ModuleCat.of R (unop X ⟶ Y)`.
## Implementation
TODO (@joelriou): When the derived category enters mathlib, the Ext groups shall be
redefined using morphisms in the derived category, and then it will be possible to
compute `Ext` using both projective or injective resolutions.
-/
noncomputable section
open CategoryTheory Limits
variable (R : Type*) [Ring R] (C : Type*) [Category C] [Abelian C] [Linear R C]
[EnoughProjectives C]
/-- `Ext R C n` is defined by deriving in
the first argument of `(X, Y) ↦ ModuleCat.of R (unop X ⟶ Y)`
(which is the second argument of `linearYoneda`).
-/
def Ext (n : ℕ) : Cᵒᵖ ⥤ C ⥤ ModuleCat R :=
Functor.flip
{ obj := fun Y => (((linearYoneda R C).obj Y).rightOp.leftDerived n).leftOp
map := fun f => ((((linearYoneda R C).map f).rightOp).leftDerived n).leftOp }
open ZeroObject
variable {R C}
/-- Given a chain complex `X` and an object `Y`, this is the cochain complex
which in degree `i` consists of the module of morphisms `X.X i ⟶ Y`. -/
@[simps! X d]
def ChainComplex.linearYonedaObj {α : Type*} [AddRightCancelSemigroup α] [One α]
(X : ChainComplex C α) (A : Type*) [Ring A] [Linear A C] (Y : C) :
CochainComplex (ModuleCat A) α :=
((((linearYoneda A C).obj Y).rightOp.mapHomologicalComplex _).obj X).unop
namespace CategoryTheory
namespace ProjectiveResolution
variable {X : C} (P : ProjectiveResolution X)
/-- `Ext` can be computed using a projective resolution. -/
def isoExt (n : ℕ) (Y : C) : ((Ext R C n).obj (Opposite.op X)).obj Y ≅
(P.complex.linearYonedaObj R Y).homology n :=
(P.isoLeftDerivedObj ((linearYoneda R C).obj Y).rightOp n).unop.symm ≪≫
(HomologicalComplex.homologyUnop _ _).symm
end ProjectiveResolution
end CategoryTheory
/-- If `X : C` is projective and `n : ℕ`, then `Ext^(n + 1) X Y ≅ 0` for any `Y`. -/
lemma isZero_Ext_succ_of_projective (X Y : C) [Projective X] (n : ℕ) :
IsZero (((Ext R C (n + 1)).obj (Opposite.op X)).obj Y) := by
refine IsZero.of_iso ?_ ((ProjectiveResolution.self X).isoExt (n + 1) Y)
rw [← HomologicalComplex.exactAt_iff_isZero_homology, HomologicalComplex.exactAt_iff]
refine ShortComplex.exact_of_isZero_X₂ _ ?_
dsimp
rw [IsZero.iff_id_eq_zero]
ext (x : _ ⟶ _)
obtain rfl : x = 0 := (HomologicalComplex.isZero_single_obj_X
(ComplexShape.down ℕ) 0 X (n + 1) (by simp)).eq_of_src _ _
rfl |
.lake/packages/mathlib/Mathlib/CategoryTheory/Abelian/Refinements.lean | import Mathlib.Algebra.Homology.ShortComplex.Exact
/-!
# Refinements
In order to prove injectivity/surjectivity/exactness properties for diagrams
in the category of abelian groups, we often need to do diagram chases.
Some of these can be carried out in more general abelian categories:
for example, a morphism `X ⟶ Y` in an abelian category `C` is a
monomorphism if and only if for all `A : C`, the induced map
`(A ⟶ X) → (A ⟶ Y)` of abelian groups is a monomorphism, i.e. injective.
Alternatively, the yoneda presheaf functor which sends `X` to the
presheaf of maps `A ⟶ X` for all `A : C` preserves and reflects
monomorphisms.
However, if `p : X ⟶ Y` is an epimorphism in `C` and `A : C`,
`(A ⟶ X) → (A ⟶ Y)` may fail to be surjective (unless `p` is a split
epimorphism).
In this file, the basic result is `epi_iff_surjective_up_to_refinements`
which states that `f : X ⟶ Y` is a morphism in an abelian category,
then it is an epimorphism if and only if for all `y : A ⟶ Y`,
there exists an epimorphism `π : A' ⟶ A` and `x : A' ⟶ X` such
that `π ≫ y = x ≫ f`. In other words, if we allow a precomposition
with an epimorphism, we may lift a morphism to `Y` to a morphism to `X`.
Following unpublished notes by George Bergman, we shall say that the
precomposition by an epimorphism `π ≫ y` is a refinement of `y`. Then,
we get that an epimorphism is a morphism that is "surjective up to refinements".
(This result is similar to the fact that a morphism of sheaves on
a topological space or a site is epi iff sections can be lifted
locally. Then, arguing "up to refinements" is very similar to
arguing locally for a Grothendieck topology (TODO: indeed,
show that it corresponds to the "refinements" topology on an
abelian category `C` that is defined by saying that
a sieve is covering if it contains an epimorphism).
Similarly, it is possible to show that a short complex in an abelian
category is exact if and only if it is exact up to refinements
(see `ShortComplex.exact_iff_exact_up_to_refinements`).
As it is outlined in the documentation of the file
`Mathlib/CategoryTheory/Abelian/Pseudoelements.lean`, the Freyd-Mitchell
embedding theorem implies the existence of a faithful and exact functor `ι`
from an abelian category `C` to the category of abelian groups. If we
define a pseudo-element of `X : C` to be an element in `ι.obj X`, one
may do diagram chases in any abelian category using these pseudo-elements.
However, using this approach would require proving this embedding theorem!
Currently, mathlib contains a weaker notion of pseudo-elements
`Mathlib/CategoryTheory/Abelian/Pseudoelements.lean`. Some theorems can be obtained
using this notion, but there is the issue that for this notion
of pseudo-elements a morphism `X ⟶ Y` in `C` is not determined by
its action on pseudo-elements (see also `Counterexamples/Pseudoelement.lean`).
On the contrary, the approach consisting of working up to refinements
does not require the introduction of other types: we only need to work
with morphisms `A ⟶ X` in `C` which we may consider as being
"sort of elements of `X`". One may carry diagram-chasing by tracking
these morphisms and sometimes introducing an auxiliary epimorphism `A' ⟶ A`.
## References
* George Bergman, A note on abelian categories – translating element-chasing proofs,
and exact embedding in abelian groups (1974)
http://math.berkeley.edu/~gbergman/papers/unpub/elem-chase.pdf
-/
namespace CategoryTheory
open Category Limits
variable {C : Type _} [Category C] [Abelian C] {X Y : C} (S : ShortComplex C)
{S₁ S₂ : ShortComplex C}
lemma epi_iff_surjective_up_to_refinements (f : X ⟶ Y) :
Epi f ↔ ∀ ⦃A : C⦄ (y : A ⟶ Y),
∃ (A' : C) (π : A' ⟶ A) (_ : Epi π) (x : A' ⟶ X), π ≫ y = x ≫ f := by
constructor
· intro _ A a
exact ⟨pullback a f, pullback.fst a f, inferInstance, pullback.snd a f, pullback.condition⟩
· intro hf
obtain ⟨A, π, hπ, a', fac⟩ := hf (𝟙 Y)
rw [comp_id] at fac
exact epi_of_epi_fac fac.symm
lemma surjective_up_to_refinements_of_epi (f : X ⟶ Y) [Epi f] {A : C} (y : A ⟶ Y) :
∃ (A' : C) (π : A' ⟶ A) (_ : Epi π) (x : A' ⟶ X), π ≫ y = x ≫ f :=
(epi_iff_surjective_up_to_refinements f).1 inferInstance y
lemma ShortComplex.exact_iff_exact_up_to_refinements :
S.Exact ↔ ∀ ⦃A : C⦄ (x₂ : A ⟶ S.X₂) (_ : x₂ ≫ S.g = 0),
∃ (A' : C) (π : A' ⟶ A) (_ : Epi π) (x₁ : A' ⟶ S.X₁), π ≫ x₂ = x₁ ≫ S.f := by
rw [S.exact_iff_epi_toCycles, epi_iff_surjective_up_to_refinements]
constructor
· intro hS A a ha
obtain ⟨A', π, hπ, x₁, fac⟩ := hS (S.liftCycles a ha)
exact ⟨A', π, hπ, x₁, by simpa only [assoc, liftCycles_i, toCycles_i] using fac =≫ S.iCycles⟩
· intro hS A a
obtain ⟨A', π, hπ, x₁, fac⟩ := hS (a ≫ S.iCycles) (by simp)
exact ⟨A', π, hπ, x₁, by simp only [← cancel_mono S.iCycles, assoc, toCycles_i, fac]⟩
variable {S}
lemma ShortComplex.Exact.exact_up_to_refinements
(hS : S.Exact) {A : C} (x₂ : A ⟶ S.X₂) (hx₂ : x₂ ≫ S.g = 0) :
∃ (A' : C) (π : A' ⟶ A) (_ : Epi π) (x₁ : A' ⟶ S.X₁), π ≫ x₂ = x₁ ≫ S.f := by
rw [ShortComplex.exact_iff_exact_up_to_refinements] at hS
exact hS x₂ hx₂
lemma ShortComplex.eq_liftCycles_homologyπ_up_to_refinements {A : C} (γ : A ⟶ S.homology) :
∃ (A' : C) (π : A' ⟶ A) (_ : Epi π) (z : A' ⟶ S.X₂) (hz : z ≫ S.g = 0),
π ≫ γ = S.liftCycles z hz ≫ S.homologyπ := by
obtain ⟨A', π, hπ, z, hz⟩ := surjective_up_to_refinements_of_epi S.homologyπ γ
refine ⟨A', π, hπ, z ≫ S.iCycles, by simp, ?_⟩
rw [hz]
congr 1
rw [← cancel_mono S.iCycles, liftCycles_i]
end CategoryTheory |
.lake/packages/mathlib/Mathlib/CategoryTheory/Abelian/Exact.lean | import Mathlib.Algebra.Homology.ImageToKernel
import Mathlib.Algebra.Homology.ShortComplex.Exact
import Mathlib.CategoryTheory.Abelian.Opposite
import Mathlib.CategoryTheory.Limits.Preserves.Shapes.Zero
import Mathlib.CategoryTheory.Limits.Preserves.Shapes.Kernels
import Mathlib.CategoryTheory.Adjunction.Limits
import Mathlib.Tactic.TFAE
/-!
# Exact sequences in abelian categories
In an abelian category, we get several interesting results related to exactness which are not
true in more general settings.
## Main results
* A short complex `S` is exact iff `imageSubobject S.f = kernelSubobject S.g`.
* If `(f, g)` is exact, then `image.ι f` has the universal property of the kernel of `g`.
* `f` is a monomorphism iff `kernel.ι f = 0` iff `Exact 0 f`, and `f` is an epimorphism iff
`cokernel.π = 0` iff `Exact f 0`.
* A faithful functor between abelian categories that preserves zero morphisms reflects exact
sequences.
* `X ⟶ Y ⟶ Z ⟶ 0` is exact if and only if the second map is a cokernel of the first, and
`0 ⟶ X ⟶ Y ⟶ Z` is exact if and only if the first map is a kernel of the second.
* A functor `F` such that for all `S`, we have `S.Exact → (S.map F).Exact` preserves both
finite limits and colimits.
-/
universe v₁ v₂ u₁ u₂
noncomputable section
open CategoryTheory Limits Preadditive
variable {C : Type u₁} [Category.{v₁} C] [Abelian C]
namespace CategoryTheory
namespace ShortComplex
variable (S : ShortComplex C)
attribute [local instance] hasEqualizers_of_hasKernels
theorem exact_iff_epi_imageToKernel' : S.Exact ↔ Epi (imageToKernel' S.f S.g S.zero) := by
rw [S.exact_iff_epi_kernel_lift]
have : factorThruImage S.f ≫ imageToKernel' S.f S.g S.zero = kernel.lift S.g S.f S.zero := by
simp only [← cancel_mono (kernel.ι _), kernel.lift_ι, imageToKernel',
Category.assoc, image.fac]
constructor
· intro
exact epi_of_epi_fac this
· intro
rw [← this]
apply epi_comp
theorem exact_iff_epi_imageToKernel : S.Exact ↔ Epi (imageToKernel S.f S.g S.zero) := by
rw [S.exact_iff_epi_imageToKernel']
apply (MorphismProperty.epimorphisms C).arrow_mk_iso_iff
exact Arrow.isoMk (imageSubobjectIso S.f).symm (kernelSubobjectIso S.g).symm
theorem exact_iff_isIso_imageToKernel : S.Exact ↔ IsIso (imageToKernel S.f S.g S.zero) := by
rw [S.exact_iff_epi_imageToKernel]
constructor
· intro
apply isIso_of_mono_of_epi
· intro
infer_instance
/-- In an abelian category, a short complex `S` is exact
iff `imageSubobject S.f = kernelSubobject S.g`.
-/
theorem exact_iff_image_eq_kernel : S.Exact ↔ imageSubobject S.f = kernelSubobject S.g := by
rw [exact_iff_isIso_imageToKernel]
constructor
· intro
exact Subobject.eq_of_comm (asIso (imageToKernel _ _ S.zero)) (by simp)
· intro h
exact ⟨Subobject.ofLE _ _ h.ge, by ext; simp, by ext; simp⟩
theorem exact_iff_of_forks {cg : KernelFork S.g} (hg : IsLimit cg) {cf : CokernelCofork S.f}
(hf : IsColimit cf) : S.Exact ↔ cg.ι ≫ cf.π = 0 := by
rw [exact_iff_kernel_ι_comp_cokernel_π_zero]
let e₁ := IsLimit.conePointUniqueUpToIso (kernelIsKernel S.g) hg
let e₂ := IsColimit.coconePointUniqueUpToIso (cokernelIsCokernel S.f) hf
have : cg.ι ≫ cf.π = e₁.inv ≫ kernel.ι S.g ≫ cokernel.π S.f ≫ e₂.hom := by
have eq₁ := IsLimit.conePointUniqueUpToIso_inv_comp (kernelIsKernel S.g) hg (.zero)
have eq₂ := IsColimit.comp_coconePointUniqueUpToIso_hom (cokernelIsCokernel S.f) hf (.one)
dsimp at eq₁ eq₂
rw [← eq₁, ← eq₂, Category.assoc]
rw [this, IsIso.comp_left_eq_zero e₁.inv, ← Category.assoc,
IsIso.comp_right_eq_zero _ e₂.hom]
variable {S}
/-- If `(f, g)` is exact, then `Abelian.image.ι S.f` is a kernel of `S.g`. -/
def Exact.isLimitImage (h : S.Exact) :
IsLimit (KernelFork.ofι (Abelian.image.ι S.f)
(Abelian.image_ι_comp_eq_zero S.zero) : KernelFork S.g) := by
rw [exact_iff_kernel_ι_comp_cokernel_π_zero] at h
exact KernelFork.IsLimit.ofι _ _
(fun u hu ↦ kernel.lift (cokernel.π S.f) u
(by rw [← kernel.lift_ι S.g u hu, Category.assoc, h, comp_zero])) (by simp)
(fun _ _ _ hm => by rw [← cancel_mono (Abelian.image.ι S.f), hm, kernel.lift_ι])
/-- If `(f, g)` is exact, then `image.ι f` is a kernel of `g`. -/
def Exact.isLimitImage' (h : S.Exact) :
IsLimit (KernelFork.ofι (Limits.image.ι S.f)
(image_ι_comp_eq_zero S.zero) : KernelFork S.g) :=
IsKernel.isoKernel _ _ h.isLimitImage (Abelian.imageIsoImage S.f).symm <| IsImage.lift_fac _ _
/-- If `(f, g)` is exact, then `Abelian.coimage.π g` is a cokernel of `f`. -/
def Exact.isColimitCoimage (h : S.Exact) :
IsColimit
(CokernelCofork.ofπ (Abelian.coimage.π S.g) (Abelian.comp_coimage_π_eq_zero S.zero) :
CokernelCofork S.f) := by
rw [exact_iff_kernel_ι_comp_cokernel_π_zero] at h
refine CokernelCofork.IsColimit.ofπ _ _
(fun u hu => cokernel.desc (kernel.ι S.g) u
(by rw [← cokernel.π_desc S.f u hu, ← Category.assoc, h, zero_comp]))
(by simp) ?_
intro _ _ _ _ hm
ext
rw [hm, cokernel.π_desc]
/-- If `(f, g)` is exact, then `factorThruImage g` is a cokernel of `f`. -/
def Exact.isColimitImage (h : S.Exact) :
IsColimit (CokernelCofork.ofπ (Limits.factorThruImage S.g)
(comp_factorThruImage_eq_zero S.zero)) :=
IsCokernel.cokernelIso _ _ h.isColimitCoimage (Abelian.coimageIsoImage' S.g) <|
(cancel_mono (Limits.image.ι S.g)).1 <| by simp
theorem exact_kernel {X Y : C} (f : X ⟶ Y) :
(ShortComplex.mk (kernel.ι f) f (by simp)).Exact :=
exact_of_f_is_kernel _ (kernelIsKernel f)
theorem exact_cokernel {X Y : C} (f : X ⟶ Y) :
(ShortComplex.mk f (cokernel.π f) (by simp)).Exact :=
exact_of_g_is_cokernel _ (cokernelIsCokernel f)
variable (S)
theorem exact_iff_exact_image_ι :
S.Exact ↔ (ShortComplex.mk (Abelian.image.ι S.f) S.g
(Abelian.image_ι_comp_eq_zero S.zero)).Exact :=
ShortComplex.exact_iff_of_epi_of_isIso_of_mono
{ τ₁ := Abelian.factorThruImage S.f
τ₂ := 𝟙 _
τ₃ := 𝟙 _ }
theorem exact_iff_exact_coimage_π :
S.Exact ↔ (ShortComplex.mk S.f (Abelian.coimage.π S.g)
(Abelian.comp_coimage_π_eq_zero S.zero)).Exact := by
symm
exact ShortComplex.exact_iff_of_epi_of_isIso_of_mono
{ τ₁ := 𝟙 _
τ₂ := 𝟙 _
τ₃ := Abelian.factorThruCoimage S.g }
end ShortComplex
section
open List in
theorem Abelian.tfae_mono {X Y : C} (f : X ⟶ Y) (Z : C) :
TFAE [Mono f, kernel.ι f = 0, (ShortComplex.mk (0 : Z ⟶ X) f zero_comp).Exact] := by
tfae_have 2 → 1 := mono_of_kernel_ι_eq_zero _
tfae_have 1 → 2
| _ => by rw [← cancel_mono f, kernel.condition, zero_comp]
tfae_have 3 ↔ 1 := ShortComplex.exact_iff_mono _ (by simp)
tfae_finish
open List in
theorem Abelian.tfae_epi {X Y : C} (f : X ⟶ Y) (Z : C) :
TFAE [Epi f, cokernel.π f = 0, (ShortComplex.mk f (0 : Y ⟶ Z) comp_zero).Exact] := by
tfae_have 2 → 1 := epi_of_cokernel_π_eq_zero _
tfae_have 1 → 2
| _ => by rw [← cancel_epi f, cokernel.condition, comp_zero]
tfae_have 3 ↔ 1 := ShortComplex.exact_iff_epi _ (by simp)
tfae_finish
end
namespace Functor
section
variable {D : Type u₂} [Category.{v₂} D] [Abelian D]
variable (F : C ⥤ D) [PreservesZeroMorphisms F]
lemma reflects_exact_of_faithful [F.Faithful] (S : ShortComplex C) (hS : (S.map F).Exact) :
S.Exact := by
rw [ShortComplex.exact_iff_kernel_ι_comp_cokernel_π_zero] at hS ⊢
dsimp at hS
apply F.zero_of_map_zero
obtain ⟨k, hk⟩ :=
kernel.lift' (F.map S.g) (F.map (kernel.ι S.g))
(by simp only [← F.map_comp, kernel.condition, CategoryTheory.Functor.map_zero])
obtain ⟨l, hl⟩ :=
cokernel.desc' (F.map S.f) (F.map (cokernel.π S.f))
(by simp only [← F.map_comp, cokernel.condition, CategoryTheory.Functor.map_zero])
rw [F.map_comp, ← hl, ← hk, Category.assoc, reassoc_of% hS, zero_comp, comp_zero]
end
end Functor
namespace Functor
open Limits Abelian
variable {A : Type u₁} {B : Type u₂} [Category.{v₁} A] [Category.{v₂} B]
variable [Abelian A] [Abelian B]
variable (L : A ⥤ B)
section
variable [L.PreservesZeroMorphisms]
variable (hL : ∀ (S : ShortComplex A), S.Exact → (S.map L).Exact)
include hL
open ZeroObject
/-- A functor which preserves exactness preserves monomorphisms. -/
theorem preservesMonomorphisms_of_map_exact : L.PreservesMonomorphisms where
preserves f hf := by
apply ((Abelian.tfae_mono (L.map f) (L.obj 0)).out 2 0).mp
refine ShortComplex.exact_of_iso ?_ (hL _ (((tfae_mono f 0).out 0 2).mp hf))
exact ShortComplex.isoMk (Iso.refl _) (Iso.refl _) (Iso.refl _)
/-- A functor which preserves exactness preserves epimorphisms. -/
theorem preservesEpimorphisms_of_map_exact : L.PreservesEpimorphisms where
preserves f hf := by
apply ((Abelian.tfae_epi (L.map f) (L.obj 0)).out 2 0).mp
refine ShortComplex.exact_of_iso ?_ (hL _ (((tfae_epi f 0).out 0 2).mp hf))
exact ShortComplex.isoMk (Iso.refl _) (Iso.refl _) (Iso.refl _)
/-- A functor which preserves the exactness of short complexes preserves homology. -/
lemma preservesHomology_of_map_exact : L.PreservesHomology where
preservesCokernels X Y f := by
have := preservesEpimorphisms_of_map_exact _ hL
apply preservesColimit_of_preserves_colimit_cocone (cokernelIsCokernel f)
apply (CokernelCofork.isColimitMapCoconeEquiv _ L).2
have : Epi ((ShortComplex.mk _ _ (cokernel.condition f)).map L).g := by
dsimp
infer_instance
exact (hL (ShortComplex.mk _ _ (cokernel.condition f))
(ShortComplex.exact_of_g_is_cokernel _ (cokernelIsCokernel f))).gIsCokernel
preservesKernels X Y f := by
have := preservesMonomorphisms_of_map_exact _ hL
apply preservesLimit_of_preserves_limit_cone (kernelIsKernel f)
apply (KernelFork.isLimitMapConeEquiv _ L).2
have : Mono ((ShortComplex.mk _ _ (kernel.condition f)).map L).f := by
dsimp
infer_instance
exact (hL (ShortComplex.mk _ _ (kernel.condition f))
(ShortComplex.exact_of_f_is_kernel _ (kernelIsKernel f))).fIsKernel
end
section
/-- A functor preserving zero morphisms, monos, and cokernels preserves homology. -/
lemma preservesHomology_of_preservesMonos_and_cokernels [PreservesZeroMorphisms L]
[PreservesMonomorphisms L] [∀ {X Y} (f : X ⟶ Y), PreservesColimit (parallelPair f 0) L] :
PreservesHomology L := by
apply preservesHomology_of_map_exact
intro S hS
let φ : (ShortComplex.mk _ _ (Abelian.comp_coimage_π_eq_zero S.zero)).map L ⟶ S.map L :=
{ τ₁ := 𝟙 _
τ₂ := 𝟙 _
τ₃ := L.map (Abelian.factorThruCoimage S.g)
comm₂₃ := by
dsimp
rw [Category.id_comp, ← L.map_comp, cokernel.π_desc] }
apply (ShortComplex.exact_iff_of_epi_of_isIso_of_mono φ).1
apply ShortComplex.exact_of_g_is_cokernel
exact CokernelCofork.mapIsColimit _ ((S.exact_iff_exact_coimage_π).1 hS).gIsCokernel L
/-- A functor preserving zero morphisms, epis, and kernels preserves homology. -/
lemma preservesHomology_of_preservesEpis_and_kernels [PreservesZeroMorphisms L]
[PreservesEpimorphisms L] [∀ {X Y} (f : X ⟶ Y), PreservesLimit (parallelPair f 0) L] :
PreservesHomology L := by
apply preservesHomology_of_map_exact
intro S hS
let φ : S.map L ⟶ (ShortComplex.mk _ _ (Abelian.image_ι_comp_eq_zero S.zero)).map L :=
{ τ₁ := L.map (Abelian.factorThruImage S.f)
τ₂ := 𝟙 _
τ₃ := 𝟙 _
comm₁₂ := by
dsimp
rw [Category.comp_id, ← L.map_comp, kernel.lift_ι] }
apply (ShortComplex.exact_iff_of_epi_of_isIso_of_mono φ).2
apply ShortComplex.exact_of_f_is_kernel
exact KernelFork.mapIsLimit _ ((S.exact_iff_exact_image_ι).1 hS).fIsKernel L
end
end Functor
end CategoryTheory |
.lake/packages/mathlib/Mathlib/CategoryTheory/Abelian/Monomorphisms.lean | import Mathlib.CategoryTheory.MorphismProperty.Limits
import Mathlib.CategoryTheory.Abelian.Basic
/-!
# Monomorphisms are stable under cobase change
In an abelian category `C`, the class of morphism
`monomorphisms C` is stable under cobase change and
`epimorphisms C` is stable under base change.
-/
universe v u
namespace CategoryTheory.Abelian
variable {C : Type u} [Category.{v} C] [Abelian C]
open MorphismProperty
instance : (monomorphisms C).IsStableUnderCobaseChange :=
IsStableUnderCobaseChange.mk' (fun _ _ _ f g _ hf ↦ by
simp only [monomorphisms.iff] at hf ⊢
infer_instance)
instance : (epimorphisms C).IsStableUnderBaseChange :=
IsStableUnderBaseChange.mk' (fun _ _ _ f g _ hf ↦ by
simp only [epimorphisms.iff] at hf ⊢
infer_instance)
end CategoryTheory.Abelian |
.lake/packages/mathlib/Mathlib/CategoryTheory/Abelian/Transfer.lean | import Mathlib.CategoryTheory.Abelian.Basic
import Mathlib.CategoryTheory.Adjunction.Limits
import Mathlib.CategoryTheory.Limits.Preserves.Shapes.AbelianImages
import Mathlib.CategoryTheory.Preadditive.Transfer
/-!
# Transferring "abelian-ness" across a functor
If `C` is an additive category, `D` is an abelian category,
we have `F : C ⥤ D` `G : D ⥤ C` (both preserving zero morphisms),
`G` is left exact (that is, preserves finite limits),
and further we have `adj : G ⊣ F` and `i : F ⋙ G ≅ 𝟭 C`,
then `C` is also abelian.
A particular example is the transfer of `Abelian` instances from a category `C` to `ShrinkHoms C`;
see `ShrinkHoms.abelian`. In this case, we also transfer the `Preadditive` structure.
See <https://stacks.math.columbia.edu/tag/03A3>
## Notes
The hypotheses, following the statement from the Stacks project,
may appear surprising: we don't ask that the counit of the adjunction is an isomorphism,
but just that we have some potentially unrelated isomorphism `i : F ⋙ G ≅ 𝟭 C`.
However Lemma A1.1.1 from [Elephant] shows that in this situation the counit itself
must be an isomorphism, and thus that `C` is a reflective subcategory of `D`.
Someone may like to formalize that lemma, and restate this theorem in terms of `Reflective`.
(That lemma has a nice string diagrammatic proof that holds in any bicategory.)
-/
noncomputable section
namespace CategoryTheory
open Limits
universe v₁ v₂ u₁ u₂
namespace AbelianOfAdjunction
variable {C : Type u₁} [Category.{v₁} C] [Preadditive C]
variable {D : Type u₂} [Category.{v₂} D] [Abelian D]
variable (F : C ⥤ D)
variable (G : D ⥤ C) [Functor.PreservesZeroMorphisms G]
/-- No point making this an instance, as it requires `i`. -/
theorem hasKernels [PreservesFiniteLimits G] (i : F ⋙ G ≅ 𝟭 C) : HasKernels C :=
{ has_limit {X Y} f := by
have : i.inv.app X ≫ G.map (F.map f) ≫ i.hom.app Y = f := by
simpa using NatIso.naturality_1 i f
rw [← this]
haveI : HasKernel (G.map (F.map f) ≫ i.hom.app _) := Limits.hasKernel_comp_mono _ _
apply Limits.hasKernel_iso_comp }
/-- No point making this an instance, as it requires `i` and `adj`. -/
theorem hasCokernels (i : F ⋙ G ≅ 𝟭 C) (adj : G ⊣ F) : HasCokernels C :=
{ has_colimit {X Y} f := by
have : PreservesColimits G := adj.leftAdjoint_preservesColimits
have : i.inv.app X ≫ G.map (F.map f) ≫ i.hom.app Y = f := by
simpa using NatIso.naturality_1 i f
rw [← this]
haveI : HasCokernel (G.map (F.map f) ≫ i.hom.app _) := Limits.hasCokernel_comp_iso _ _
apply Limits.hasCokernel_epi_comp }
end AbelianOfAdjunction
open AbelianOfAdjunction
/-- If `C` is an additive category, `D` is an abelian category,
we have `F : C ⥤ D` `G : D ⥤ C` (with `G` preserving zero morphisms),
`G` is left exact (that is, preserves finite limits),
and further we have `adj : G ⊣ F` and `i : F ⋙ G ≅ 𝟭 C`,
then `C` is also abelian. -/
@[stacks 03A3]
def abelianOfAdjunction {C : Type u₁} [Category.{v₁} C] [Preadditive C] [HasFiniteProducts C]
{D : Type u₂} [Category.{v₂} D] [Abelian D] (F : C ⥤ D)
(G : D ⥤ C) [Functor.PreservesZeroMorphisms G] [PreservesFiniteLimits G] (i : F ⋙ G ≅ 𝟭 C)
(adj : G ⊣ F) : Abelian C := by
haveI := hasKernels F G i
haveI := hasCokernels F G i adj
have : ∀ {X Y : C} (f : X ⟶ Y), IsIso (Abelian.coimageImageComparison f) := by
intro X Y f
let arrowIso : Arrow.mk (G.map (F.map f)) ≅ Arrow.mk f :=
((Functor.mapArrowFunctor _ _).mapIso i).app (Arrow.mk f)
have : PreservesColimits G := adj.leftAdjoint_preservesColimits
let iso : Arrow.mk (G.map (Abelian.coimageImageComparison (F.map f))) ≅
Arrow.mk (Abelian.coimageImageComparison f) :=
Abelian.PreservesCoimageImageComparison.iso G (F.map f) ≪≫
Abelian.coimageImageComparisonFunctor.mapIso arrowIso
rw [Arrow.isIso_iff_isIso_of_isIso iso.inv]
infer_instance
apply Abelian.ofCoimageImageComparisonIsIso
/-- If `C` is an additive category equivalent to an abelian category `D`
via a functor that preserves zero morphisms,
then `C` is also abelian.
-/
def abelianOfEquivalence {C : Type u₁} [Category.{v₁} C] [Preadditive C] [HasFiniteProducts C]
{D : Type u₂} [Category.{v₂} D] [Abelian D] (F : C ⥤ D)
[F.IsEquivalence] : Abelian C :=
abelianOfAdjunction F F.inv F.asEquivalence.unitIso.symm F.asEquivalence.symm.toAdjunction
namespace ShrinkHoms
universe w
variable {C : Type*} [Category C] [LocallySmall.{w} C]
section Preadditive
variable [Preadditive C]
variable (C)
instance preadditive : Preadditive.{w} (ShrinkHoms C) :=
.ofFullyFaithful (equivalence C).fullyFaithfulInverse
instance : (inverse C).Additive :=
(equivalence C).symm.fullyFaithfulFunctor.additive_ofFullyFaithful
instance : (functor C).Additive :=
(equivalence C).symm.additive_inverse_of_FullyFaithful
instance hasLimitsOfShape (J : Type*) [Category J]
[HasLimitsOfShape J C] : HasLimitsOfShape.{_, _, w} J (ShrinkHoms C) :=
Adjunction.hasLimitsOfShape_of_equivalence (inverse C)
instance hasFiniteLimits [HasFiniteLimits C] :
HasFiniteLimits.{w} (ShrinkHoms C) := ⟨fun _ => inferInstance⟩
end Preadditive
variable (C) in
noncomputable instance abelian [Abelian C] :
Abelian.{w} (ShrinkHoms C) := abelianOfEquivalence (inverse C)
end ShrinkHoms
namespace AsSmall
universe w v u
variable {C : Type u} [Category.{v} C]
section Preadditive
variable [Preadditive C]
variable (C)
instance preadditive : Preadditive (AsSmall.{w} C) :=
.ofFullyFaithful equiv.fullyFaithfulInverse
instance : (down (C := C)).Additive :=
equiv.symm.fullyFaithfulFunctor.additive_ofFullyFaithful
instance : (up (C := C)).Additive :=
equiv.symm.additive_inverse_of_FullyFaithful
instance hasLimitsOfShape (J : Type*) [Category J]
[HasLimitsOfShape J C] : HasLimitsOfShape.{_, _, max u v w} J (AsSmall.{w} C) :=
Adjunction.hasLimitsOfShape_of_equivalence equiv.inverse
instance hasFiniteLimits [HasFiniteLimits C] :
HasFiniteLimits (AsSmall.{w} C) := ⟨fun _ => inferInstance⟩
end Preadditive
variable (C) in
noncomputable instance abelian [Abelian C] :
Abelian (AsSmall.{w} C) := abelianOfEquivalence equiv.inverse
end AsSmall
end CategoryTheory |
.lake/packages/mathlib/Mathlib/CategoryTheory/Abelian/EpiWithInjectiveKernel.lean | import Mathlib.Algebra.Homology.ShortComplex.ShortExact
import Mathlib.CategoryTheory.MorphismProperty.Composition
/-!
# Epimorphisms with an injective kernel
In this file, we define the class of morphisms `epiWithInjectiveKernel` in an
abelian category. We show that this property of morphisms is multiplicative.
This shall be used in the file `Mathlib/Algebra/Homology/Factorizations/Basic.lean` in
order to define morphisms of cochain complexes which satisfy this property
degreewise.
-/
namespace CategoryTheory
open Category Limits ZeroObject Preadditive
variable {C : Type*} [Category C] [Abelian C]
namespace Abelian
/-- The class of morphisms in an abelian category that are epimorphisms
and have an injective kernel. -/
def epiWithInjectiveKernel : MorphismProperty C :=
fun _ _ f => Epi f ∧ Injective (kernel f)
/-- A morphism `g : X ⟶ Y` is epi with an injective kernel iff there exists a morphism
`f : I ⟶ X` with `I` injective such that `f ≫ g = 0` and
the short complex `I ⟶ X ⟶ Y` has a splitting. -/
lemma epiWithInjectiveKernel_iff {X Y : C} (g : X ⟶ Y) :
epiWithInjectiveKernel g ↔ ∃ (I : C) (_ : Injective I) (f : I ⟶ X) (w : f ≫ g = 0),
Nonempty (ShortComplex.mk f g w).Splitting := by
constructor
· rintro ⟨_, _⟩
let S := ShortComplex.mk (kernel.ι g) g (by simp)
exact ⟨_, inferInstance, _, S.zero,
⟨ShortComplex.Splitting.ofExactOfRetraction S
(S.exact_of_f_is_kernel (kernelIsKernel g)) (Injective.factorThru (𝟙 _) (kernel.ι g))
(by simp [S]) inferInstance⟩⟩
· rintro ⟨I, _, f, w, ⟨σ⟩⟩
have : IsSplitEpi g := ⟨σ.s, σ.s_g⟩
let e : I ≅ kernel g :=
IsLimit.conePointUniqueUpToIso σ.shortExact.fIsKernel (limit.isLimit _)
exact ⟨inferInstance, Injective.of_iso e inferInstance⟩
lemma epiWithInjectiveKernel_of_iso {X Y : C} (f : X ⟶ Y) [IsIso f] :
epiWithInjectiveKernel f := by
rw [epiWithInjectiveKernel_iff]
exact ⟨0, inferInstance, 0, by simp,
⟨ShortComplex.Splitting.ofIsZeroOfIsIso _ (isZero_zero C) (by assumption)⟩⟩
instance : (epiWithInjectiveKernel : MorphismProperty C).IsMultiplicative where
id_mem _ := epiWithInjectiveKernel_of_iso _
comp_mem {X Y Z} g₁ g₂ hg₁ hg₂ := by
rw [epiWithInjectiveKernel_iff] at hg₁ hg₂ ⊢
obtain ⟨I₁, _, f₁, w₁, ⟨σ₁⟩⟩ := hg₁
obtain ⟨I₂, _, f₂, w₂, ⟨σ₂⟩⟩ := hg₂
refine ⟨I₁ ⊞ I₂, inferInstance, biprod.fst ≫ f₁ + biprod.snd ≫ f₂ ≫ σ₁.s, ?_, ⟨?_⟩⟩
· ext
· simp [reassoc_of% w₁]
· simp [reassoc_of% σ₁.s_g, w₂]
· exact
{ r := σ₁.r ≫ biprod.inl + g₁ ≫ σ₂.r ≫ biprod.inr
s := σ₂.s ≫ σ₁.s
f_r := by
ext
· simp [σ₁.f_r]
· simp [reassoc_of% w₁]
· simp
· simp [reassoc_of% σ₁.s_g, σ₂.f_r]
s_g := by simp [reassoc_of% σ₁.s_g, σ₂.s_g]
id := by
dsimp
have h := g₁ ≫= σ₂.id =≫ σ₁.s
simp only [add_comp, assoc, comp_add, id_comp] at h
rw [← σ₁.id, ← h]
simp only [comp_add, add_comp, assoc, BinaryBicone.inl_fst_assoc,
BinaryBicone.inr_fst_assoc, zero_comp, comp_zero, add_zero,
BinaryBicone.inl_snd_assoc, BinaryBicone.inr_snd_assoc, zero_add]
abel }
end Abelian
end CategoryTheory |
.lake/packages/mathlib/Mathlib/CategoryTheory/Abelian/Images.lean | import Mathlib.CategoryTheory.Limits.Shapes.Kernels
/-!
# The abelian image and coimage.
In an abelian category we usually want the image of a morphism `f` to be defined as
`kernel (cokernel.π f)`, and the coimage to be defined as `cokernel (kernel.ι f)`.
We make these definitions here, as `Abelian.image f` and `Abelian.coimage f`
(without assuming the category is actually abelian),
and later relate these to the usual categorical notions when in an abelian category.
There is a canonical morphism `coimageImageComparison : Abelian.coimage f ⟶ Abelian.image f`.
Later we show that this is always an isomorphism in an abelian category,
and conversely a category with (co)kernels and finite products in which this morphism
is always an isomorphism is an abelian category.
-/
noncomputable section
universe v u
open CategoryTheory
open CategoryTheory.Limits
namespace CategoryTheory.Abelian
variable {C : Type u} [Category.{v} C] [HasZeroMorphisms C]
variable {P Q : C} (f : P ⟶ Q)
section Image
variable [HasCokernel f] [HasKernel (cokernel.π f)]
/-- The kernel of the cokernel of `f` is called the (abelian) image of `f`. -/
protected abbrev image : C :=
kernel (cokernel.π f)
/-- The inclusion of the image into the codomain. -/
protected abbrev image.ι : Abelian.image f ⟶ Q :=
kernel.ι (cokernel.π f)
/-- There is a canonical epimorphism `p : P ⟶ image f` for every `f`. -/
protected abbrev factorThruImage : P ⟶ Abelian.image f :=
kernel.lift (cokernel.π f) f <| cokernel.condition f
/-- `f` factors through its image via the canonical morphism `p`. -/
protected theorem image.fac : Abelian.factorThruImage f ≫ image.ι f = f :=
kernel.lift_ι _ _ _
instance mono_factorThruImage [Mono f] : Mono (Abelian.factorThruImage f) :=
mono_of_mono_fac <| image.fac f
end Image
section Coimage
variable [HasKernel f] [HasCokernel (kernel.ι f)]
/-- The cokernel of the kernel of `f` is called the (abelian) coimage of `f`. -/
protected abbrev coimage : C :=
cokernel (kernel.ι f)
/-- The projection onto the coimage. -/
protected abbrev coimage.π : P ⟶ Abelian.coimage f :=
cokernel.π (kernel.ι f)
/-- There is a canonical monomorphism `i : coimage f ⟶ Q`. -/
protected abbrev factorThruCoimage : Abelian.coimage f ⟶ Q :=
cokernel.desc (kernel.ι f) f <| kernel.condition f
/-- `f` factors through its coimage via the canonical morphism `p`. -/
protected theorem coimage.fac : coimage.π f ≫ Abelian.factorThruCoimage f = f :=
cokernel.π_desc _ _ _
instance epi_factorThruCoimage [Epi f] : Epi (Abelian.factorThruCoimage f) :=
epi_of_epi_fac <| coimage.fac f
end Coimage
section Comparison
variable [HasCokernel f] [HasKernel f] [HasKernel (cokernel.π f)] [HasCokernel (kernel.ι f)]
/-- The canonical map from the abelian coimage to the abelian image.
In any abelian category this is an isomorphism.
Conversely, any additive category with kernels and cokernels and
in which this is always an isomorphism, is abelian. -/
@[stacks 0107]
def coimageImageComparison : Abelian.coimage f ⟶ Abelian.image f :=
cokernel.desc (kernel.ι f) (kernel.lift (cokernel.π f) f (by simp)) (by ext; simp)
/-- An alternative formulation of the canonical map from the abelian coimage to the abelian image.
-/
def coimageImageComparison' : Abelian.coimage f ⟶ Abelian.image f :=
kernel.lift (cokernel.π f) (cokernel.desc (kernel.ι f) f (by simp)) (by ext; simp)
theorem coimageImageComparison_eq_coimageImageComparison' :
coimageImageComparison f = coimageImageComparison' f := by
ext
simp [coimageImageComparison, coimageImageComparison']
@[reassoc (attr := simp)]
theorem coimage_image_factorisation : coimage.π f ≫ coimageImageComparison f ≫ image.ι f = f := by
simp [coimageImageComparison]
end Comparison
variable [HasKernels C] [HasCokernels C]
/-- The coimage-image comparison morphism is functorial. -/
@[simps! obj map]
def coimageImageComparisonFunctor : Arrow C ⥤ Arrow C where
obj f := Arrow.mk (coimageImageComparison f.hom)
map {f g} η := Arrow.homMk
(cokernel.map _ _ (kernel.map _ _ η.left η.right (by simp)) η.left (by simp))
(kernel.map _ _ η.right (cokernel.map _ _ η.left η.right (by simp)) (by simp)) (by cat_disch)
end CategoryTheory.Abelian |
.lake/packages/mathlib/Mathlib/CategoryTheory/Abelian/FunctorCategory.lean | import Mathlib.CategoryTheory.Abelian.Basic
import Mathlib.CategoryTheory.Preadditive.FunctorCategory
import Mathlib.CategoryTheory.Limits.FunctorCategory.Finite
import Mathlib.CategoryTheory.Limits.Preserves.Shapes.Kernels
/-!
# If `D` is abelian, then the functor category `C ⥤ D` is also abelian.
-/
noncomputable section
namespace CategoryTheory
open CategoryTheory.Limits
namespace Abelian
section
universe z w v u
variable {C : Type u} [Category.{v} C]
variable {D : Type w} [Category.{z} D] [Abelian D]
namespace FunctorCategory
variable {F G : C ⥤ D} (α : F ⟶ G) (X : C)
/-- The abelian coimage in a functor category can be calculated componentwise. -/
@[simps!]
def coimageObjIso : (Abelian.coimage α).obj X ≅ Abelian.coimage (α.app X) :=
PreservesCokernel.iso ((evaluation C D).obj X) _ ≪≫
cokernel.mapIso _ _ (PreservesKernel.iso ((evaluation C D).obj X) _) (Iso.refl _)
(by
dsimp
simp only [Category.comp_id, PreservesKernel.iso_hom]
exact (kernelComparison_comp_ι _ ((evaluation C D).obj X)).symm)
/-- The abelian image in a functor category can be calculated componentwise. -/
@[simps!]
def imageObjIso : (Abelian.image α).obj X ≅ Abelian.image (α.app X) :=
PreservesKernel.iso ((evaluation C D).obj X) _ ≪≫
kernel.mapIso _ _ (Iso.refl _) (PreservesCokernel.iso ((evaluation C D).obj X) _)
(by
apply (cancel_mono (PreservesCokernel.iso ((evaluation C D).obj X) α).inv).1
simp only [Category.assoc, Iso.hom_inv_id]
dsimp
simp only [PreservesCokernel.iso_inv, Category.id_comp, Category.comp_id]
exact (π_comp_cokernelComparison _ ((evaluation C D).obj X)).symm)
theorem coimageImageComparison_app :
coimageImageComparison (α.app X) =
(coimageObjIso α X).inv ≫ (coimageImageComparison α).app X ≫ (imageObjIso α X).hom := by
ext
dsimp
dsimp [imageObjIso, coimageObjIso, cokernel.map]
simp only [coimage_image_factorisation, PreservesKernel.iso_hom, Category.assoc,
kernel.lift_ι, Category.comp_id, PreservesCokernel.iso_inv,
cokernel.π_desc_assoc, Category.id_comp]
erw [kernelComparison_comp_ι _ ((evaluation C D).obj X)]
erw [π_comp_cokernelComparison_assoc _ ((evaluation C D).obj X)]
conv_lhs => rw [← coimage_image_factorisation α]
rfl
theorem coimageImageComparison_app' :
(coimageImageComparison α).app X =
(coimageObjIso α X).hom ≫ coimageImageComparison (α.app X) ≫ (imageObjIso α X).inv := by
simp only [coimageImageComparison_app, Iso.hom_inv_id_assoc, Iso.hom_inv_id, Category.assoc,
Category.comp_id]
instance functor_category_isIso_coimageImageComparison :
IsIso (Abelian.coimageImageComparison α) := by
have : ∀ X : C, IsIso ((Abelian.coimageImageComparison α).app X) := by
intros
rw [coimageImageComparison_app']
infer_instance
apply NatIso.isIso_of_isIso_app
end FunctorCategory
noncomputable instance functorCategoryAbelian : Abelian (C ⥤ D) :=
let _ : HasKernels (C ⥤ D) := inferInstance
let _ : HasCokernels (C ⥤ D) := inferInstance
Abelian.ofCoimageImageComparisonIsIso
end
end Abelian
end CategoryTheory |
.lake/packages/mathlib/Mathlib/CategoryTheory/Abelian/NonPreadditive.lean | import Mathlib.CategoryTheory.Limits.Shapes.FiniteProducts
import Mathlib.CategoryTheory.Limits.Shapes.Kernels
import Mathlib.CategoryTheory.Limits.Shapes.NormalMono.Equalizers
import Mathlib.CategoryTheory.Abelian.Images
import Mathlib.CategoryTheory.Preadditive.Basic
/-!
# Every NonPreadditiveAbelian category is preadditive
In mathlib, we define an abelian category as a preadditive category with a zero object,
kernels and cokernels, products and coproducts and in which every monomorphism and epimorphism is
normal.
While virtually every interesting abelian category has a natural preadditive structure (which is why
it is included in the definition), preadditivity is not actually needed: Every category that has
all of the other properties appearing in the definition of an abelian category admits a preadditive
structure. This is the construction we carry out in this file.
The proof proceeds in roughly five steps:
1. Prove some results (for example that all equalizers exist) that would be trivial if we already
had the preadditive structure but are a bit of work without it.
2. Develop images and coimages to show that every monomorphism is the kernel of its cokernel.
The results of the first two steps are also useful for the "normal" development of abelian
categories, and will be used there.
3. For every object `A`, define a "subtraction" morphism `σ : A ⨯ A ⟶ A` and use it to define
subtraction on morphisms as `f - g := prod.lift f g ≫ σ`.
4. Prove a small number of identities about this subtraction from the definition of `σ`.
5. From these identities, prove a large number of other identities that imply that defining
`f + g := f - (0 - g)` indeed gives an abelian group structure on morphisms such that composition
is bilinear.
The construction is non-trivial and it is quite remarkable that this abelian group structure can
be constructed purely from the existence of a few limits and colimits. Even more remarkably,
since abelian categories admit exactly one preadditive structure (see
`subsingletonPreadditiveOfHasBinaryBiproducts`), the construction manages to exactly
reconstruct any natural preadditive structure the category may have.
## References
* [F. Borceux, *Handbook of Categorical Algebra 2*][borceux-vol2]
-/
noncomputable section
open CategoryTheory
open CategoryTheory.Limits
namespace CategoryTheory
section
universe v u
variable (C : Type u) [Category.{v} C]
/-- We call a category `NonPreadditiveAbelian` if it has a zero object, kernels, cokernels, binary
products and coproducts, and every monomorphism and every epimorphism is normal.
Notice that every such category is abelian (see `CategoryTheory.NonPreadditiveAbelian.preadditive`),
so in practice it is preferable to work directly with `Abelian`.
-/
class NonPreadditiveAbelian extends HasZeroMorphisms C, IsNormalMonoCategory C,
IsNormalEpiCategory C where
[has_zero_object : HasZeroObject C]
[has_kernels : HasKernels C]
[has_cokernels : HasCokernels C]
[has_finite_products : HasFiniteProducts C]
[has_finite_coproducts : HasFiniteCoproducts C]
attribute [instance] NonPreadditiveAbelian.has_zero_object
attribute [instance] NonPreadditiveAbelian.has_kernels
attribute [instance] NonPreadditiveAbelian.has_cokernels
attribute [instance] NonPreadditiveAbelian.has_finite_products
attribute [instance] NonPreadditiveAbelian.has_finite_coproducts
end
end CategoryTheory
open CategoryTheory
universe v u
variable {C : Type u} [Category.{v} C] [NonPreadditiveAbelian C]
namespace CategoryTheory.NonPreadditiveAbelian
section Factor
variable {P Q : C} (f : P ⟶ Q)
/-- The map `p : P ⟶ image f` is an epimorphism -/
instance : Epi (Abelian.factorThruImage f) :=
let I := Abelian.image f
let p := Abelian.factorThruImage f
let i := kernel.ι (cokernel.π f)
-- It will suffice to consider some g : I ⟶ R such that p ≫ g = 0 and show that g = 0.
NormalMonoCategory.epi_of_zero_cancel
_ fun R (g : I ⟶ R) (hpg : p ≫ g = 0) => by
-- Since C is abelian, u := ker g ≫ i is the kernel of some morphism h.
let u := kernel.ι g ≫ i
haveI hu := normalMonoOfMono u
let h := hu.g
-- By hypothesis, p factors through the kernel of g via some t.
obtain ⟨t, ht⟩ := kernel.lift' g p hpg
have fh : f ≫ h = 0 :=
calc
f ≫ h = (p ≫ i) ≫ h := (Abelian.image.fac f).symm ▸ rfl
_ = ((t ≫ kernel.ι g) ≫ i) ≫ h := ht ▸ rfl
_ = t ≫ u ≫ h := by simp only [u, Category.assoc]
_ = t ≫ 0 := hu.w ▸ rfl
_ = 0 := HasZeroMorphisms.comp_zero _ _
-- h factors through the cokernel of f via some l.
obtain ⟨l, hl⟩ := cokernel.desc' f h fh
have hih : i ≫ h = 0 :=
calc
i ≫ h = i ≫ cokernel.π f ≫ l := hl ▸ rfl
_ = 0 ≫ l := by rw [← Category.assoc, kernel.condition]
_ = 0 := zero_comp
-- i factors through u = ker h via some s.
obtain ⟨s, hs⟩ := NormalMono.lift' u i hih
have hs' : (s ≫ kernel.ι g) ≫ i = 𝟙 I ≫ i := by rw [Category.assoc, hs, Category.id_comp]
haveI : Epi (kernel.ι g) := epi_of_epi_fac ((cancel_mono _).1 hs')
-- ker g is an epimorphism, but ker g ≫ g = 0 = ker g ≫ 0, so g = 0 as required.
exact zero_of_epi_comp _ (kernel.condition g)
instance isIso_factorThruImage [Mono f] : IsIso (Abelian.factorThruImage f) :=
isIso_of_mono_of_epi <| Abelian.factorThruImage f
/-- The canonical morphism `i : coimage f ⟶ Q` is a monomorphism -/
instance : Mono (Abelian.factorThruCoimage f) :=
let I := Abelian.coimage f
let i := Abelian.factorThruCoimage f
let p := cokernel.π (kernel.ι f)
NormalEpiCategory.mono_of_cancel_zero _ fun R (g : R ⟶ I) (hgi : g ≫ i = 0) => by
-- Since C is abelian, u := p ≫ coker g is the cokernel of some morphism h.
let u := p ≫ cokernel.π g
haveI hu := normalEpiOfEpi u
let h := hu.g
-- By hypothesis, i factors through the cokernel of g via some t.
obtain ⟨t, ht⟩ := cokernel.desc' g i hgi
have hf : h ≫ f = 0 :=
calc
h ≫ f = h ≫ p ≫ i := (Abelian.coimage.fac f).symm ▸ rfl
_ = h ≫ p ≫ cokernel.π g ≫ t := ht ▸ rfl
_ = h ≫ u ≫ t := by simp only [u, Category.assoc]
_ = 0 ≫ t := by rw [← Category.assoc, hu.w]
_ = 0 := zero_comp
-- h factors through the kernel of f via some l.
obtain ⟨l, hl⟩ := kernel.lift' f h hf
have hhp : h ≫ p = 0 :=
calc
h ≫ p = (l ≫ kernel.ι f) ≫ p := hl ▸ rfl
_ = l ≫ 0 := by rw [Category.assoc, cokernel.condition]
_ = 0 := comp_zero
-- p factors through u = coker h via some s.
obtain ⟨s, hs⟩ := NormalEpi.desc' u p hhp
have hs' : p ≫ cokernel.π g ≫ s = p ≫ 𝟙 I := by rw [← Category.assoc, hs, Category.comp_id]
haveI : Mono (cokernel.π g) := mono_of_mono_fac ((cancel_epi _).1 hs')
-- coker g is a monomorphism, but g ≫ coker g = 0 = 0 ≫ coker g, so g = 0 as required.
exact zero_of_comp_mono _ (cokernel.condition g)
instance isIso_factorThruCoimage [Epi f] : IsIso (Abelian.factorThruCoimage f) :=
isIso_of_mono_of_epi _
end Factor
section CokernelOfKernel
variable {X Y : C} {f : X ⟶ Y}
/-- In a `NonPreadditiveAbelian` category, an epi is the cokernel of its kernel. More precisely:
If `f` is an epimorphism and `s` is some limit kernel cone on `f`, then `f` is a cokernel
of `Fork.ι s`. -/
def epiIsCokernelOfKernel [Epi f] (s : Fork f 0) (h : IsLimit s) :
IsColimit (CokernelCofork.ofπ f (KernelFork.condition s)) :=
IsCokernel.cokernelIso _ _
(cokernel.ofIsoComp _ _ (Limits.IsLimit.conePointUniqueUpToIso (limit.isLimit _) h)
(ConeMorphism.w (Limits.IsLimit.uniqueUpToIso (limit.isLimit _) h).hom _))
(asIso <| Abelian.factorThruCoimage f) (Abelian.coimage.fac f)
/-- In a `NonPreadditiveAbelian` category, a mono is the kernel of its cokernel. More precisely:
If `f` is a monomorphism and `s` is some colimit cokernel cocone on `f`, then `f` is a kernel
of `Cofork.π s`. -/
def monoIsKernelOfCokernel [Mono f] (s : Cofork f 0) (h : IsColimit s) :
IsLimit (KernelFork.ofι f (CokernelCofork.condition s)) :=
IsKernel.isoKernel _ _
(kernel.ofCompIso _ _ (Limits.IsColimit.coconePointUniqueUpToIso h (colimit.isColimit _))
(CoconeMorphism.w (Limits.IsColimit.uniqueUpToIso h <| colimit.isColimit _).hom _))
(asIso <| Abelian.factorThruImage f) (Abelian.image.fac f)
end CokernelOfKernel
section
/-- The composite `A ⟶ A ⨯ A ⟶ cokernel (Δ A)`, where the first map is `(𝟙 A, 0)` and the second map
is the canonical projection into the cokernel. -/
abbrev r (A : C) : A ⟶ cokernel (diag A) :=
prod.lift (𝟙 A) 0 ≫ cokernel.π (diag A)
instance mono_Δ {A : C} : Mono (diag A) :=
mono_of_mono_fac <| prod.lift_fst _ _
instance mono_r {A : C} : Mono (r A) := by
let hl : IsLimit (KernelFork.ofι (diag A) (cokernel.condition (diag A))) :=
monoIsKernelOfCokernel _ (colimit.isColimit _)
apply NormalEpiCategory.mono_of_cancel_zero
intro Z x hx
have hxx : (x ≫ prod.lift (𝟙 A) (0 : A ⟶ A)) ≫ cokernel.π (diag A) = 0 := by
rw [Category.assoc, hx]
obtain ⟨y, hy⟩ := KernelFork.IsLimit.lift' hl _ hxx
rw [KernelFork.ι_ofι] at hy
have hyy : y = 0 := by
erw [← Category.comp_id y, ← Limits.prod.lift_snd (𝟙 A) (𝟙 A), ← Category.assoc, hy,
Category.assoc, prod.lift_snd, HasZeroMorphisms.comp_zero]
haveI : Mono (prod.lift (𝟙 A) (0 : A ⟶ A)) := mono_of_mono_fac (prod.lift_fst _ _)
apply (cancel_mono (prod.lift (𝟙 A) (0 : A ⟶ A))).1
rw [← hy, hyy, zero_comp, zero_comp]
instance epi_r {A : C} : Epi (r A) := by
have hlp : prod.lift (𝟙 A) (0 : A ⟶ A) ≫ Limits.prod.snd = 0 := prod.lift_snd _ _
let hp1 : IsLimit (KernelFork.ofι (prod.lift (𝟙 A) (0 : A ⟶ A)) hlp) := by
refine Fork.IsLimit.mk _ (fun s => Fork.ι s ≫ Limits.prod.fst) ?_ ?_
· intro s
apply Limits.prod.hom_ext <;> simp
· intro s m h
haveI : Mono (prod.lift (𝟙 A) (0 : A ⟶ A)) := mono_of_mono_fac (prod.lift_fst _ _)
apply (cancel_mono (prod.lift (𝟙 A) (0 : A ⟶ A))).1
convert h
apply Limits.prod.hom_ext <;> simp
let hp2 : IsColimit (CokernelCofork.ofπ (Limits.prod.snd : A ⨯ A ⟶ A) hlp) :=
epiIsCokernelOfKernel _ hp1
apply NormalMonoCategory.epi_of_zero_cancel
intro Z z hz
have h : prod.lift (𝟙 A) (0 : A ⟶ A) ≫ cokernel.π (diag A) ≫ z = 0 := by rw [← Category.assoc, hz]
obtain ⟨t, ht⟩ := CokernelCofork.IsColimit.desc' hp2 _ h
rw [CokernelCofork.π_ofπ] at ht
have htt : t = 0 := by
rw [← Category.id_comp t]
change 𝟙 A ≫ t = 0
rw [← Limits.prod.lift_snd (𝟙 A) (𝟙 A), Category.assoc, ht, ← Category.assoc,
cokernel.condition, zero_comp]
apply (cancel_epi (cokernel.π (diag A))).1
rw [← ht, htt, comp_zero, comp_zero]
instance isIso_r {A : C} : IsIso (r A) :=
isIso_of_mono_of_epi _
/-- The composite `A ⨯ A ⟶ cokernel (diag A) ⟶ A` given by the natural projection into the cokernel
followed by the inverse of `r`. In the category of modules, using the normal kernels and
cokernels, this map is equal to the map `(a, b) ↦ a - b`, hence the name `σ` for "subtraction". -/
abbrev σ {A : C} : A ⨯ A ⟶ A :=
cokernel.π (diag A) ≫ inv (r A)
end
@[reassoc]
theorem diag_σ {X : C} : diag X ≫ σ = 0 := by rw [cokernel.condition_assoc, zero_comp]
@[reassoc (attr := simp)]
theorem lift_σ {X : C} : prod.lift (𝟙 X) 0 ≫ σ = 𝟙 X := by rw [← Category.assoc, IsIso.hom_inv_id]
@[reassoc]
theorem lift_map {X Y : C} (f : X ⟶ Y) :
prod.lift (𝟙 X) 0 ≫ Limits.prod.map f f = f ≫ prod.lift (𝟙 Y) 0 := by simp
/-- σ is a cokernel of Δ X. -/
def isColimitσ {X : C} : IsColimit (CokernelCofork.ofπ (σ : X ⨯ X ⟶ X) diag_σ) :=
cokernel.cokernelIso _ σ (asIso (r X)).symm (by rw [Iso.symm_hom, asIso_inv])
/-- This is the key identity satisfied by `σ`. -/
theorem σ_comp {X Y : C} (f : X ⟶ Y) : σ ≫ f = Limits.prod.map f f ≫ σ := by
obtain ⟨g, hg⟩ :=
CokernelCofork.IsColimit.desc' isColimitσ (Limits.prod.map f f ≫ σ) (by
rw [prod.diag_map_assoc, diag_σ, comp_zero])
suffices hfg : f = g by rw [← hg, Cofork.π_ofπ, hfg]
calc
f = f ≫ prod.lift (𝟙 Y) 0 ≫ σ := by rw [lift_σ, Category.comp_id]
_ = prod.lift (𝟙 X) 0 ≫ Limits.prod.map f f ≫ σ := by rw [lift_map_assoc]
_ = prod.lift (𝟙 X) 0 ≫ σ ≫ g := by rw [← hg, CokernelCofork.π_ofπ]
_ = g := by rw [← Category.assoc, lift_σ, Category.id_comp]
section
-- We write `f - g` for `prod.lift f g ≫ σ`.
/-- Subtraction of morphisms in a `NonPreadditiveAbelian` category. -/
def hasSub {X Y : C} : Sub (X ⟶ Y) :=
⟨fun f g => prod.lift f g ≫ σ⟩
attribute [local instance] hasSub
-- We write `-f` for `0 - f`.
/-- Negation of morphisms in a `NonPreadditiveAbelian` category. -/
def hasNeg {X Y : C} : Neg (X ⟶ Y) where
neg := fun f => 0 - f
attribute [local instance] hasNeg
-- We write `f + g` for `f - (-g)`.
/-- Addition of morphisms in a `NonPreadditiveAbelian` category. -/
def hasAdd {X Y : C} : Add (X ⟶ Y) :=
⟨fun f g => f - -g⟩
attribute [local instance] hasAdd
theorem sub_def {X Y : C} (a b : X ⟶ Y) : a - b = prod.lift a b ≫ σ := rfl
theorem add_def {X Y : C} (a b : X ⟶ Y) : a + b = a - -b := rfl
theorem neg_def {X Y : C} (a : X ⟶ Y) : -a = 0 - a := rfl
theorem sub_zero {X Y : C} (a : X ⟶ Y) : a - 0 = a := by
rw [sub_def]
conv_lhs =>
congr; congr; rw [← Category.comp_id a]
case a.g => rw [show 0 = a ≫ (0 : Y ⟶ Y) by simp]
rw [← prod.comp_lift, Category.assoc, lift_σ, Category.comp_id]
theorem sub_self {X Y : C} (a : X ⟶ Y) : a - a = 0 := by
rw [sub_def, ← Category.comp_id a, ← prod.comp_lift, Category.assoc, diag_σ, comp_zero]
theorem lift_sub_lift {X Y : C} (a b c d : X ⟶ Y) :
prod.lift a b - prod.lift c d = prod.lift (a - c) (b - d) := by
simp only [sub_def]
ext
· rw [Category.assoc, σ_comp, prod.lift_map_assoc, prod.lift_fst, prod.lift_fst, prod.lift_fst]
· rw [Category.assoc, σ_comp, prod.lift_map_assoc, prod.lift_snd, prod.lift_snd, prod.lift_snd]
theorem sub_sub_sub {X Y : C} (a b c d : X ⟶ Y) : a - c - (b - d) = a - b - (c - d) := by
rw [sub_def, ← lift_sub_lift, sub_def, Category.assoc, σ_comp, prod.lift_map_assoc]; rfl
theorem neg_sub {X Y : C} (a b : X ⟶ Y) : -a - b = -b - a := by
conv_lhs => rw [neg_def, ← sub_zero b, sub_sub_sub, sub_zero, ← neg_def]
theorem neg_neg {X Y : C} (a : X ⟶ Y) : - -a = a := by
rw [neg_def, neg_def]
conv_lhs =>
congr; rw [← sub_self a]
rw [sub_sub_sub, sub_zero, sub_self, sub_zero]
theorem add_comm {X Y : C} (a b : X ⟶ Y) : a + b = b + a := by
rw [add_def]
conv_lhs => rw [← neg_neg a]
rw [neg_def, neg_def, neg_def, sub_sub_sub]
conv_lhs =>
congr
next => skip
rw [← neg_def, neg_sub]
rw [sub_sub_sub, add_def, ← neg_def, neg_neg b, neg_def]
theorem add_neg {X Y : C} (a b : X ⟶ Y) : a + -b = a - b := by rw [add_def, neg_neg]
theorem add_neg_cancel {X Y : C} (a : X ⟶ Y) : a + -a = 0 := by rw [add_neg, sub_self]
theorem neg_add_cancel {X Y : C} (a : X ⟶ Y) : -a + a = 0 := by rw [add_comm, add_neg_cancel]
theorem neg_sub' {X Y : C} (a b : X ⟶ Y) : -(a - b) = -a + b := by
rw [neg_def, neg_def]
conv_lhs => rw [← sub_self (0 : X ⟶ Y)]
rw [sub_sub_sub, add_def, neg_def]
theorem neg_add {X Y : C} (a b : X ⟶ Y) : -(a + b) = -a - b := by rw [add_def, neg_sub', add_neg]
theorem sub_add {X Y : C} (a b c : X ⟶ Y) : a - b + c = a - (b - c) := by
rw [add_def, neg_def, sub_sub_sub, sub_zero]
theorem add_assoc {X Y : C} (a b c : X ⟶ Y) : a + b + c = a + (b + c) := by
conv_lhs =>
congr; rw [add_def]
rw [sub_add, ← add_neg, neg_sub', neg_neg]
theorem add_zero {X Y : C} (a : X ⟶ Y) : a + 0 = a := by rw [add_def, neg_def, sub_self, sub_zero]
theorem comp_sub {X Y Z : C} (f : X ⟶ Y) (g h : Y ⟶ Z) : f ≫ (g - h) = f ≫ g - f ≫ h := by
rw [sub_def, ← Category.assoc, prod.comp_lift, sub_def]
theorem sub_comp {X Y Z : C} (f g : X ⟶ Y) (h : Y ⟶ Z) : (f - g) ≫ h = f ≫ h - g ≫ h := by
rw [sub_def, Category.assoc, σ_comp, ← Category.assoc, prod.lift_map, sub_def]
theorem comp_add (X Y Z : C) (f : X ⟶ Y) (g h : Y ⟶ Z) : f ≫ (g + h) = f ≫ g + f ≫ h := by
rw [add_def, comp_sub, neg_def, comp_sub, comp_zero, add_def, neg_def]
theorem add_comp (X Y Z : C) (f g : X ⟶ Y) (h : Y ⟶ Z) : (f + g) ≫ h = f ≫ h + g ≫ h := by
rw [add_def, sub_comp, neg_def, sub_comp, zero_comp, add_def, neg_def]
/-- Every `NonPreadditiveAbelian` category is preadditive. -/
def preadditive : Preadditive C where
homGroup X Y :=
{ add_assoc := add_assoc
zero_add := neg_neg
add_zero := add_zero
neg_add_cancel := neg_add_cancel
sub_eq_add_neg f g := (add_neg f g).symm
add_comm := add_comm
nsmul := nsmulRec
zsmul := zsmulRec }
add_comp := add_comp
comp_add := comp_add
end
end CategoryTheory.NonPreadditiveAbelian |
.lake/packages/mathlib/Mathlib/CategoryTheory/Abelian/CommSq.lean | import Mathlib.CategoryTheory.Abelian.Refinements
import Mathlib.CategoryTheory.Limits.Shapes.Pullback.CommSq
import Mathlib.Algebra.Homology.CommSq
/-!
# The exact sequence attached to a pushout square
Consider a pushout square in an abelian category:
```
X₁ ⟶ X₂
| |
v v
X₃ ⟶ X₄
```
We study the associated exact sequence `X₁ ⟶ X₂ ⊞ X₃ ⟶ X₄ ⟶ 0`.
-/
universe v u
namespace CategoryTheory
open Category Limits
variable {C : Type u} [Category.{v} C] [Abelian C] {X₁ X₂ X₃ X₄ : C}
{t : X₁ ⟶ X₂} {l : X₁ ⟶ X₃} {r : X₂ ⟶ X₄} {b : X₃ ⟶ X₄}
namespace IsPushout
lemma exact_shortComplex (h : IsPushout t l r b) : h.shortComplex.Exact :=
h.shortComplex.exact_of_g_is_cokernel
h.isColimitCokernelCofork
/-- Given a pushout square in an abelian category
```
X₁ ⟶ X₂
| |
v v
X₃ ⟶ X₄
```
the morphism `X₂ ⊞ X₃ ⟶ X₄` is an epimorphism. This lemma translates this
as the existence of liftings up to refinements: a morphism `z : T ⟶ X₄`
can be written as a sum of a morphism to `X₂` and a morphism to `X₃`,
at least if we allow a precomposition with an epimorphism `π : T' ⟶ T`. -/
lemma hom_eq_add_up_to_refinements (h : IsPushout t l r b) {T : C} (x₄ : T ⟶ X₄) :
∃ (T' : C) (π : T' ⟶ T) (_ : Epi π) (x₂ : T' ⟶ X₂) (x₃ : T' ⟶ X₃),
π ≫ x₄ = x₂ ≫ r + x₃ ≫ b := by
have := h.epi_shortComplex_g
obtain ⟨T', π, _, u, hu⟩ := surjective_up_to_refinements_of_epi h.shortComplex.g x₄
refine ⟨T', π, inferInstance, u ≫ biprod.fst, u ≫ biprod.snd, ?_⟩
simp only [hu, assoc, ← Preadditive.comp_add]
congr
cat_disch
/--
Given a commutative diagram in an abelian category
```
X₁ ⟶ X₂
| | \
v v \
X₃ ⟶ X₄ \
\ \ v
\ \> X₅
\_____>
```
where the top/left square is a pushout square,
the outer square involving `X₁`, `X₂`, `X₃` and `X₅`
is a pullback square, and `X₂ ⟶ X₅` is mono,
then `X₄ ⟶ X₅` is a mono.
-/
lemma mono_of_isPullback_of_mono
(h₁ : IsPushout t l r b) {X₅ : C} {r' : X₂ ⟶ X₅} {b' : X₃ ⟶ X₅}
(h₂ : IsPullback t l r' b') (k : X₄ ⟶ X₅)
(fac₁ : r ≫ k = r') (fac₂ : b ≫ k = b') [Mono r'] : Mono k :=
Preadditive.mono_of_cancel_zero _ (fun {T₀} x₄ hx₄ ↦ by
obtain ⟨T₁, π, _, x₂, x₃, eq⟩ := hom_eq_add_up_to_refinements h₁ x₄
have fac₃ : (-x₂) ≫ r' = x₃ ≫ b' := by
rw [Preadditive.neg_comp, neg_eq_iff_add_eq_zero, ← fac₂, ← fac₁,
← assoc, ← assoc, ← Preadditive.add_comp, ← eq, assoc, hx₄, comp_zero]
obtain ⟨x₂', hx₂'⟩ : ∃ x₂', π ≫ x₄ = x₂' ≫ r := by
refine ⟨x₂ + h₂.lift (-x₂) x₃ fac₃ ≫ t, ?_⟩
rw [eq, Preadditive.add_comp, assoc, h₁.w, IsPullback.lift_snd_assoc, add_comm]
rw [← cancel_epi π, comp_zero, reassoc_of% hx₂', fac₁] at hx₄
obtain rfl := zero_of_comp_mono _ hx₄
rw [zero_comp] at hx₂'
rw [← cancel_epi π, hx₂', comp_zero])
end IsPushout
namespace IsPullback
lemma exact_shortComplex' (h : IsPullback t l r b) : h.shortComplex'.Exact :=
h.shortComplex'.exact_of_f_is_kernel
h.isLimitKernelFork
/-!
Note: if `h : IsPullback t l r b`, then `X₁ ⟶ X₂ ⊞ X₃` is a monomorphism,
which can be translated in concrete terms thanks to the lemma `IsPullback.hom_ext`:
if a morphism `f : Z ⟶ X₁` becomes zero after composing with `X₁ ⟶ X₂` and
`X₁ ⟶ X₃`, then `f = 0`. This is the reason why we do not state the dual
statement to `IsPushout.hom_eq_add_up_to_refinements`.
-/
end IsPullback
end CategoryTheory |
.lake/packages/mathlib/Mathlib/CategoryTheory/Abelian/DiagramLemmas/Four.lean | import Mathlib.Algebra.Homology.ExactSequence
import Mathlib.CategoryTheory.Abelian.Refinements
/-!
# The four and five lemmas
Consider the following commutative diagram with exact rows in an abelian category `C`:
```
A ---f--> B ---g--> C ---h--> D ---i--> E
| | | | |
α β γ δ ε
| | | | |
v v v v v
A' --f'-> B' --g'-> C' --h'-> D' --i'-> E'
```
We show:
- the "mono" version of the four lemma: if `α` is an epimorphism and `β` and `δ` are monomorphisms,
then `γ` is a monomorphism,
- the "epi" version of the four lemma: if `β` and `δ` are epimorphisms and `ε` is a monomorphism,
then `γ` is an epimorphism,
- the five lemma: if `α`, `β`, `δ` and `ε` are isomorphisms, then `γ` is an isomorphism.
## Implementation details
The diagram of the five lemmas is given by a morphism in the category `ComposableArrows C 4`
between two objects which satisfy `ComposableArrows.Exact`. Similarly, the two versions of the
four lemma are stated in terms of the category `ComposableArrows C 3`.
The five lemmas is deduced from the two versions of the four lemma. Both of these versions
are proved separately. It would be easy to deduce the epi version from the mono version
using duality, but this would require lengthy API developments for `ComposableArrows` (TODO).
## Tags
four lemma, five lemma, diagram lemma, diagram chase
-/
namespace CategoryTheory
open Category Limits Preadditive
namespace Abelian
variable {C : Type*} [Category C] [Abelian C]
open ComposableArrows
section Four
variable {R₁ R₂ : ComposableArrows C 3} (φ : R₁ ⟶ R₂)
theorem mono_of_epi_of_mono_of_mono' (hR₁ : R₁.map' 0 2 = 0)
(hR₁' : (mk₂ (R₁.map' 1 2) (R₁.map' 2 3)).Exact)
(hR₂ : (mk₂ (R₂.map' 0 1) (R₂.map' 1 2)).Exact)
(h₀ : Epi (app' φ 0)) (h₁ : Mono (app' φ 1)) (h₃ : Mono (app' φ 3)) :
Mono (app' φ 2) := by
apply mono_of_cancel_zero
intro A f₂ h₁
have h₂ : f₂ ≫ R₁.map' 2 3 = 0 := by
rw [← cancel_mono (app' φ 3 _), assoc, NatTrans.naturality, reassoc_of% h₁,
zero_comp, zero_comp]
obtain ⟨A₁, π₁, _, f₁, hf₁⟩ := (hR₁'.exact 0).exact_up_to_refinements f₂ h₂
dsimp at hf₁
have h₃ : (f₁ ≫ app' φ 1) ≫ R₂.map' 1 2 = 0 := by
rw [assoc, ← NatTrans.naturality, ← reassoc_of% hf₁, h₁, comp_zero]
obtain ⟨A₂, π₂, _, g₀, hg₀⟩ := (hR₂.exact 0).exact_up_to_refinements _ h₃
obtain ⟨A₃, π₃, _, f₀, hf₀⟩ := surjective_up_to_refinements_of_epi (app' φ 0 _) g₀
have h₄ : f₀ ≫ R₁.map' 0 1 = π₃ ≫ π₂ ≫ f₁ := by
rw [← cancel_mono (app' φ 1 _), assoc, assoc, assoc, NatTrans.naturality,
← reassoc_of% hf₀, hg₀]
rfl
rw [← cancel_epi π₁, comp_zero, hf₁, ← cancel_epi π₂, ← cancel_epi π₃, comp_zero,
comp_zero, ← reassoc_of% h₄, ← R₁.map'_comp 0 1 2, hR₁, comp_zero]
theorem mono_of_epi_of_mono_of_mono (hR₁ : R₁.Exact) (hR₂ : R₂.Exact)
(h₀ : Epi (app' φ 0)) (h₁ : Mono (app' φ 1)) (h₃ : Mono (app' φ 3)) :
Mono (app' φ 2) :=
mono_of_epi_of_mono_of_mono' φ
(by simpa only [R₁.map'_comp 0 1 2] using hR₁.toIsComplex.zero 0)
(hR₁.exact 1).exact_toComposableArrows (hR₂.exact 0).exact_toComposableArrows h₀ h₁ h₃
theorem epi_of_epi_of_epi_of_mono'
(hR₁ : (mk₂ (R₁.map' 1 2) (R₁.map' 2 3)).Exact)
(hR₂ : (mk₂ (R₂.map' 0 1) (R₂.map' 1 2)).Exact) (hR₂' : R₂.map' 1 3 = 0)
(h₀ : Epi (app' φ 0)) (h₂ : Epi (app' φ 2)) (h₃ : Mono (app' φ 3)) :
Epi (app' φ 1) := by
rw [epi_iff_surjective_up_to_refinements]
intro A g₁
obtain ⟨A₁, π₁, _, f₂, h₁⟩ :=
surjective_up_to_refinements_of_epi (app' φ 2 _) (g₁ ≫ R₂.map' 1 2)
have h₂ : f₂ ≫ R₁.map' 2 3 = 0 := by
rw [← cancel_mono (app' φ 3 _), assoc, zero_comp, NatTrans.naturality, ← reassoc_of% h₁,
← R₂.map'_comp 1 2 3, hR₂', comp_zero, comp_zero]
obtain ⟨A₂, π₂, _, f₁, h₃⟩ := (hR₁.exact 0).exact_up_to_refinements _ h₂
dsimp at f₁ h₃
have h₄ : (π₂ ≫ π₁ ≫ g₁ - f₁ ≫ app' φ 1 _) ≫ R₂.map' 1 2 = 0 := by
rw [sub_comp, assoc, assoc, assoc, ← NatTrans.naturality, ← reassoc_of% h₃, h₁, sub_self]
obtain ⟨A₃, π₃, _, g₀, h₅⟩ := (hR₂.exact 0).exact_up_to_refinements _ h₄
dsimp at g₀ h₅
rw [comp_sub] at h₅
obtain ⟨A₄, π₄, _, f₀, h₆⟩ := surjective_up_to_refinements_of_epi (app' φ 0 _) g₀
refine ⟨A₄, π₄ ≫ π₃ ≫ π₂ ≫ π₁, inferInstance,
π₄ ≫ π₃ ≫ f₁ + f₀ ≫ (by exact R₁.map' 0 1), ?_⟩
rw [assoc, assoc, assoc, add_comp, assoc, assoc, assoc, NatTrans.naturality,
← reassoc_of% h₆, ← h₅, comp_sub]
dsimp
rw [add_sub_cancel]
theorem epi_of_epi_of_epi_of_mono (hR₁ : R₁.Exact) (hR₂ : R₂.Exact)
(h₀ : Epi (app' φ 0)) (h₂ : Epi (app' φ 2)) (h₃ : Mono (app' φ 3)) :
Epi (app' φ 1) :=
epi_of_epi_of_epi_of_mono' φ (hR₁.exact 1).exact_toComposableArrows
(hR₂.exact 0).exact_toComposableArrows
(by simpa only [R₂.map'_comp 1 2 3] using hR₂.toIsComplex.zero 1) h₀ h₂ h₃
end Four
section Five
variable {R₁ R₂ : ComposableArrows C 4} (hR₁ : R₁.Exact) (hR₂ : R₂.Exact) (φ : R₁ ⟶ R₂)
include hR₁ hR₂
/-- The five lemma. -/
theorem isIso_of_epi_of_isIso_of_isIso_of_mono (h₀ : Epi (app' φ 0)) (h₁ : IsIso (app' φ 1))
(h₂ : IsIso (app' φ 3)) (h₃ : Mono (app' φ 4)) : IsIso (app' φ 2) := by
dsimp at h₀ h₁ h₂ h₃
have : Mono (app' φ 2) := by
apply mono_of_epi_of_mono_of_mono (δlastFunctor.map φ) (R₁.exact_iff_δlast.1 hR₁).1
(R₂.exact_iff_δlast.1 hR₂).1 <;> dsimp <;> infer_instance
have : Epi (app' φ 2) := by
apply epi_of_epi_of_epi_of_mono (δ₀Functor.map φ) (R₁.exact_iff_δ₀.1 hR₁).2
(R₂.exact_iff_δ₀.1 hR₂).2 <;> dsimp <;> infer_instance
apply isIso_of_mono_of_epi
end Five
/-! The following "three lemmas" for morphisms in `ComposableArrows C 2` are
special cases of "four lemmas" applied to diagrams where some of the
leftmost or rightmost maps (or objects) are zero. -/
section Three
variable {R₁ R₂ : ComposableArrows C 2} (φ : R₁ ⟶ R₂)
attribute [local simp] Precomp.map
theorem mono_of_epi_of_epi_mono' (hR₁ : R₁.map' 0 2 = 0) (hR₁' : Epi (R₁.map' 1 2))
(hR₂ : R₂.Exact) (h₀ : Epi (app' φ 0)) (h₁ : Mono (app' φ 1)) :
Mono (app' φ 2) := by
let ψ : mk₃ (R₁.map' 0 1) (R₁.map' 1 2) (0 : _ ⟶ R₁.obj' 0) ⟶
mk₃ (R₂.map' 0 1) (R₂.map' 1 2) (0 : _ ⟶ R₁.obj' 0) := homMk₃ (app' φ 0) (app' φ 1)
(app' φ 2) (𝟙 _) (naturality' φ 0 1) (naturality' φ 1 2) (by simp)
refine mono_of_epi_of_mono_of_mono' ψ ?_ (exact₂_mk _ (by simp) ?_)
(hR₂.exact 0).exact_toComposableArrows h₀ h₁ (by dsimp [ψ]; infer_instance)
· dsimp
rw [← Functor.map_comp]
exact hR₁
· rw [ShortComplex.exact_iff_epi _ (by simp)]
exact hR₁'
theorem mono_of_epi_of_epi_of_mono (hR₁ : R₁.Exact) (hR₂ : R₂.Exact)
(hR₁' : Epi (R₁.map' 1 2)) (h₀ : Epi (app' φ 0)) (h₁ : Mono (app' φ 1)) :
Mono (app' φ 2) :=
mono_of_epi_of_epi_mono' φ (by simpa only [map'_comp R₁ 0 1 2] using hR₁.toIsComplex.zero 0)
hR₁' hR₂ h₀ h₁
theorem epi_of_mono_of_epi_of_mono' (hR₁ : R₁.Exact) (hR₂ : R₂.map' 0 2 = 0)
(hR₂' : Mono (R₂.map' 0 1)) (h₀ : Epi (app' φ 1)) (h₁ : Mono (app' φ 2)) :
Epi (app' φ 0) := by
let ψ : mk₃ (0 : R₁.obj' 0 ⟶ _) (R₁.map' 0 1) (R₁.map' 1 2) ⟶
mk₃ (0 : R₁.obj' 0 ⟶ _) (R₂.map' 0 1) (R₂.map' 1 2) := homMk₃ (𝟙 _) (app' φ 0) (app' φ 1)
(app' φ 2) (by simp) (naturality' φ 0 1) (naturality' φ 1 2)
refine epi_of_epi_of_epi_of_mono' ψ (hR₁.exact 0).exact_toComposableArrows
(exact₂_mk _ (by simp) ?_) ?_ (by dsimp [ψ]; infer_instance) h₀ h₁
· rw [ShortComplex.exact_iff_mono _ (by simp)]
exact hR₂'
· dsimp
rw [← Functor.map_comp]
exact hR₂
theorem epi_of_mono_of_epi_of_mono (hR₁ : R₁.Exact) (hR₂ : R₂.Exact)
(hR₂' : Mono (R₂.map' 0 1)) (h₀ : Epi (app' φ 1)) (h₁ : Mono (app' φ 2)) :
Epi (app' φ 0) :=
epi_of_mono_of_epi_of_mono' φ hR₁
(by simpa only [map'_comp R₂ 0 1 2] using hR₂.toIsComplex.zero 0) hR₂' h₀ h₁
theorem mono_of_mono_of_mono_of_mono (hR₁ : R₁.Exact)
(hR₂' : Mono (R₂.map' 0 1))
(h₀ : Mono (app' φ 0))
(h₁ : Mono (app' φ 2)) :
Mono (app' φ 1) := by
let ψ : mk₃ (0 : R₁.obj' 0 ⟶ _) (R₁.map' 0 1) (R₁.map' 1 2) ⟶
mk₃ (0 : R₁.obj' 0 ⟶ _) (R₂.map' 0 1) (R₂.map' 1 2) := homMk₃ (𝟙 _) (app' φ 0) (app' φ 1)
(app' φ 2) (by simp) (naturality' φ 0 1) (naturality' φ 1 2)
refine mono_of_epi_of_mono_of_mono' ψ (by simp)
(hR₁.exact 0).exact_toComposableArrows
(exact₂_mk _ (by simp) ?_) (by dsimp [ψ]; infer_instance) h₀ h₁
rw [ShortComplex.exact_iff_mono _ (by simp)]
exact hR₂'
theorem epi_of_epi_of_epi_of_epi (hR₂ : R₂.Exact) (hR₁' : Epi (R₁.map' 1 2))
(h₀ : Epi (app' φ 0)) (h₁ : Epi (app' φ 2)) :
Epi (app' φ 1) := by
let ψ : mk₃ (R₁.map' 0 1) (R₁.map' 1 2) (0 : _ ⟶ R₁.obj' 0) ⟶
mk₃ (R₂.map' 0 1) (R₂.map' 1 2) (0 : _ ⟶ R₁.obj' 0) := homMk₃ (app' φ 0) (app' φ 1)
(app' φ 2) (𝟙 _) (naturality' φ 0 1) (naturality' φ 1 2) (by simp)
refine epi_of_epi_of_epi_of_mono' ψ (exact₂_mk _ (by simp) ?_)
(hR₂.exact 0).exact_toComposableArrows (by simp)
h₀ h₁ (by dsimp [ψ]; infer_instance)
rw [ShortComplex.exact_iff_epi _ (by simp)]
exact hR₁'
end Three
end Abelian
namespace ShortComplex
variable {C : Type*} [Category C] [Abelian C]
variable {R₁ R₂ : ShortComplex C} (φ : R₁ ⟶ R₂)
attribute [local simp] ComposableArrows.Precomp.map
theorem mono_of_epi_of_epi_of_mono (hR₂ : R₂.Exact) (hR₁' : Epi R₁.g)
(h₀ : Epi φ.τ₁) (h₁ : Mono φ.τ₂) : Mono (φ.τ₃) :=
Abelian.mono_of_epi_of_epi_mono' (ShortComplex.mapToComposableArrows φ)
(by simp) hR₁' hR₂.exact_toComposableArrows h₀ h₁
theorem epi_of_mono_of_epi_of_mono (hR₁ : R₁.Exact)
(hR₂' : Mono R₂.f) (h₀ : Epi φ.τ₂) (h₁ : Mono φ.τ₃) : Epi φ.τ₁ :=
Abelian.epi_of_mono_of_epi_of_mono' (ShortComplex.mapToComposableArrows φ)
hR₁.exact_toComposableArrows (by simp) hR₂' h₀ h₁
theorem mono_of_mono_of_mono_of_mono (hR₁ : R₁.Exact) (hR₂' : Mono R₂.f) (h₀ : Mono φ.τ₁)
(h₁ : Mono φ.τ₃) : Mono φ.τ₂ :=
Abelian.mono_of_mono_of_mono_of_mono (ShortComplex.mapToComposableArrows φ)
hR₁.exact_toComposableArrows hR₂' h₀ h₁
theorem epi_of_epi_of_epi_of_epi (hR₂ : R₂.Exact) (hR₁' : Epi R₁.g) (h₀ : Epi φ.τ₁)
(h₁ : Epi φ.τ₃) : Epi φ.τ₂ :=
Abelian.epi_of_epi_of_epi_of_epi (ShortComplex.mapToComposableArrows φ)
hR₂.exact_toComposableArrows hR₁' h₀ h₁
end ShortComplex
end CategoryTheory |
.lake/packages/mathlib/Mathlib/CategoryTheory/Abelian/DiagramLemmas/KernelCokernelComp.lean | import Mathlib.Algebra.Homology.ShortComplex.SnakeLemma
/-!
# Long exact sequence for the kernel and cokernel of a composition
If `f : X ⟶ Y` and `g : Y ⟶ Z` are composable morphisms in an
abelian category, we construct a long exact sequence :
`0 ⟶ ker f ⟶ ker (f ≫ g) ⟶ ker g ⟶ coker f ⟶ coker (f ≫ g) ⟶ coker g ⟶ 0`.
This is obtained by applying the snake lemma to the following morphism of
exact sequences, where the rows are the obvious split exact sequences
```
0 ⟶ X ⟶ X ⊞ Y ⟶ Y ⟶ 0
|f |φ |g
v v v
0 ⟶ Y ⟶ Y ⊞ Z ⟶ Z ⟶ 0
```
and `φ` is given by the following matrix:
```
(f -𝟙 Y)
(0 g)
```
Indeed the snake lemma gives an exact sequence involving the kernels and cokernels
of the vertical maps: in order to get the expected long exact sequence, it suffices
to obtain isomorphisms `ker φ ≅ ker (f ≫ g)` and `coker φ ≅ coker (f ⋙ g)`.
-/
universe v u
namespace CategoryTheory
open Limits Category Preadditive
variable {C : Type u} [Category.{v} C] [Abelian C]
{X Y Z : C} (f : X ⟶ Y) (g : Y ⟶ Z)
namespace kernelCokernelCompSequence
/-- If `f : X ⟶ Y` and `g : Y ⟶ Z` are composable morphisms,
this is the morphism `kernel (f ≫ g) ⟶ X ⊞ Y` which
"sends `x` to `(x, f(x))`". -/
noncomputable def ι : kernel (f ≫ g) ⟶ X ⊞ Y :=
biprod.lift (kernel.ι (f ≫ g)) (kernel.ι (f ≫ g) ≫ f)
@[reassoc (attr := simp)]
lemma ι_fst : ι f g ≫ biprod.fst = kernel.ι (f ≫ g) := by simp [ι]
@[reassoc (attr := simp)]
lemma ι_snd : ι f g ≫ biprod.snd = kernel.ι (f ≫ g) ≫ f := by simp [ι]
/-- If `f : X ⟶ Y` and `g : Y ⟶ Z` are composable morphisms,
this is the morphism `X ⊞ Y ⟶ Y ⊞ Z` given by the matrix
```
(f -𝟙 Y)
(0 g)
```
-/
noncomputable def φ : X ⊞ Y ⟶ Y ⊞ Z :=
biprod.desc (f ≫ biprod.inl) (biprod.lift (-𝟙 Y) g)
@[reassoc (attr := simp)]
lemma inl_φ : biprod.inl ≫ φ f g = f ≫ biprod.inl := by simp [φ]
@[reassoc (attr := simp)]
lemma inr_φ_fst : biprod.inr ≫ φ f g ≫ biprod.fst = - 𝟙 Y := by simp [φ]
@[reassoc (attr := simp)]
lemma φ_snd : φ f g ≫ biprod.snd = biprod.snd ≫ g := by
dsimp [φ]
aesop
/-- If `f : X ⟶ Y` and `g : Y ⟶ Z` are composable morphisms,
this is the morphism `Y ⊞ Z ⟶ cokernel (f ≫ g)` which
"sends `(y, z)` to `[g(y)] + [z]`". -/
noncomputable def π : Y ⊞ Z ⟶ cokernel (f ≫ g) :=
biprod.desc (g ≫ cokernel.π (f ≫ g)) (cokernel.π (f ≫ g))
@[reassoc (attr := simp)]
lemma inl_π : biprod.inl ≫ π f g = g ≫ cokernel.π (f ≫ g) := by simp [π]
@[reassoc (attr := simp)]
lemma inr_π : biprod.inr ≫ π f g = cokernel.π (f ≫ g) := by simp [π]
@[reassoc (attr := simp)]
lemma ι_φ : ι f g ≫ φ f g = 0 := by
dsimp [ι, φ]
aesop
@[reassoc (attr := simp)]
lemma φ_π : φ f g ≫ π f g = 0 := by
dsimp [φ, π]
ext
· rw [biprod.inl_desc_assoc, assoc, biprod.inl_desc, comp_zero,
← assoc, cokernel.condition]
· simp
instance : Mono (ι f g) := mono_of_mono_fac (ι_fst f g)
instance : Epi (π f g) := epi_of_epi_fac (inr_π f g)
/-- If `f : X ⟶ Y` and `g : Y ⟶ Z` are composable morphisms,
then the kernel of `φ f g : X ⊞ Y ⟶ Y ⊞ Z` identifies
to `kernel (f ≫ g)`. -/
noncomputable def isLimit : IsLimit (KernelFork.ofι _ (ι_φ f g)) :=
KernelFork.IsLimit.ofι' _ _ (fun {A} k hk ↦ by
refine ⟨kernel.lift _ (k ≫ biprod.fst) ?_, ?_⟩
all_goals
obtain ⟨k₁, k₂, rfl⟩ := biprod.decomp_hom_to k
simp only [biprod.ext_to_iff, add_comp, assoc, inl_φ, BinaryBicone.inl_fst,
comp_id, inr_φ_fst, comp_neg, zero_comp, BinaryBicone.inl_snd, comp_zero, φ_snd,
BinaryBicone.inr_snd_assoc, zero_add, add_neg_eq_zero] at hk
obtain ⟨rfl, hk⟩ := hk
aesop)
/-- If `f : X ⟶ Y` and `g : Y ⟶ Z` are composable morphisms,
then the cokernel of `φ f g : X ⊞ Y ⟶ Y ⊞ Z` identifies
to `cokernel (f ≫ g)`. -/
noncomputable def isColimit : IsColimit (CokernelCofork.ofπ _ (φ_π f g)) :=
CokernelCofork.IsColimit.ofπ' _ _ (fun {A} k hk ↦ by
refine ⟨cokernel.desc _ (biprod.inr ≫ k) ?_, ?_⟩
all_goals
obtain ⟨k₁, k₂, rfl⟩ := biprod.decomp_hom_from k
simp only [comp_add, φ_snd_assoc, biprod.ext_from_iff, inl_φ_assoc,
BinaryBicone.inl_fst_assoc, BinaryBicone.inl_snd_assoc, zero_comp, add_zero, comp_zero,
inr_φ_fst_assoc, neg_comp, id_comp, BinaryBicone.inr_snd_assoc, neg_add_eq_zero] at hk
obtain ⟨hk, rfl⟩ := hk
aesop)
/-- The "snake input" which gives the exact sequence
`0 ⟶ ker f ⟶ ker (f ≫ g) ⟶ ker g ⟶ coker f ⟶ coker (f ≫ g) ⟶ coker g ⟶ 0`,
see `kernelCokernelCompSequence_exact`. -/
@[simps]
noncomputable def snakeInput : ShortComplex.SnakeInput C where
L₀ :=
{ f := kernel.map f (f ≫ g) (𝟙 _) g (by simp)
g := kernel.map (f ≫ g) g f (𝟙 _) (by simp)
zero := by aesop }
L₁ := ShortComplex.mk (biprod.inl : X ⟶ _) (biprod.snd : _ ⟶ Y) (by simp)
L₂ := ShortComplex.mk (biprod.inl : Y ⟶ _) (biprod.snd : _ ⟶ Z) (by simp)
L₃ :=
{ f := cokernel.map f (f ≫ g) (𝟙 _) g (by simp)
g := cokernel.map (f ≫ g) g f (𝟙 _) (by simp)
zero := by aesop }
v₀₁ :=
{ τ₁ := kernel.ι f
τ₂ := ι f g
τ₃ := kernel.ι g }
v₁₂ :=
{ τ₁ := f
τ₂ := φ f g
τ₃ := g }
v₂₃ :=
{ τ₁ := cokernel.π f
τ₂ := π f g
τ₃ := cokernel.π g }
h₀ := by
apply ShortComplex.isLimitOfIsLimitπ <;>
apply (KernelFork.isLimitMapConeEquiv _ _).2
· exact kernelIsKernel _
· exact isLimit f g
· exact kernelIsKernel _
h₃ := by
apply ShortComplex.isColimitOfIsColimitπ <;>
apply (CokernelCofork.isColimitMapCoconeEquiv _ _).2
· exact cokernelIsCokernel _
· exact isColimit f g
· exact cokernelIsCokernel _
epi_L₁_g := by dsimp; infer_instance
mono_L₂_f := by dsimp; infer_instance
L₁_exact := (ShortComplex.Splitting.ofHasBinaryBiproduct X Y).exact
L₂_exact := (ShortComplex.Splitting.ofHasBinaryBiproduct Y Z).exact
/-- If `f : X ⟶ Y` and `g : Y ⟶ Z` are composable morphisms, this
is the connecting homomorphism `kernel g ⟶ cokernel f`. -/
noncomputable def δ : kernel g ⟶ cokernel f := (snakeInput f g).δ
lemma δ_fac : δ f g = - kernel.ι g ≫ cokernel.π f := by
simpa using (snakeInput f g).δ_eq (𝟙 _) (kernel.ι g ≫ biprod.inr) (-kernel.ι g)
(by simp) (by aesop)
end kernelCokernelCompSequence
open kernelCokernelCompSequence
/-- If `f : X ⟶ Y` and `g : Y ⟶ Z` are composable morphisms in an
abelian category, this is the long exact sequence
`0 ⟶ ker f ⟶ ker (f ≫ g) ⟶ ker g ⟶ coker f ⟶ coker (f ≫ g) ⟶ coker g ⟶ 0`. -/
noncomputable abbrev kernelCokernelCompSequence : ComposableArrows C 5 :=
.mk₅ (kernel.map f (f ≫ g) (𝟙 _) g (by simp))
(kernel.map (f ≫ g) g f (𝟙 _) (by simp))
(δ f g)
(cokernel.map f (f ≫ g) (𝟙 _) g (by simp))
(cokernel.map (f ≫ g) g f (𝟙 _) (by simp))
instance : Mono ((kernelCokernelCompSequence f g).map' 0 1) := by
dsimp; infer_instance
instance : Epi ((kernelCokernelCompSequence f g).map' 4 5) := by
dsimp [ComposableArrows.Precomp.map]
infer_instance
lemma kernelCokernelCompSequence_exact :
(kernelCokernelCompSequence f g).Exact :=
(snakeInput f g).snake_lemma
end CategoryTheory |
.lake/packages/mathlib/Mathlib/CategoryTheory/Abelian/SerreClass/Basic.lean | import Mathlib.CategoryTheory.Abelian.Basic
import Mathlib.CategoryTheory.ObjectProperty.ContainsZero
import Mathlib.CategoryTheory.ObjectProperty.EpiMono
import Mathlib.CategoryTheory.ObjectProperty.Extensions
import Mathlib.Algebra.Homology.ShortComplex.ShortExact
/-!
# Serre classes
For any abelian category `C`, we introduce a type class `IsSerreClass C` for
Serre classes in `S` (also known as "Serre subcategories"). A Serre class is
a property `P : ObjectProperty C` of objects in `P` which holds for a zero object,
and is closed under subobjects, quotients and extensions.
## Future works
* Show that the localization of `C` with respect to a Serre class is an abelian category.
## References
* [Jean-Pierre Serre, *Groupes d'homotopie et classes de groupes abéliens*][serre1958]
-/
universe v v' u u'
namespace CategoryTheory
open Limits ZeroObject
variable {C : Type u} [Category.{v} C] [Abelian C] (P : ObjectProperty C)
{D : Type u'} [Category.{v'} D] [Abelian D]
namespace ObjectProperty
/-- A Serre class in an abelian category consists of predicate which
hold for the zero object and is closed under subobjects, quotients, extensions. -/
class IsSerreClass : Prop extends P.ContainsZero,
P.IsClosedUnderSubobjects, P.IsClosedUnderQuotients,
P.IsClosedUnderExtensions where
variable [P.IsSerreClass]
example : P.IsClosedUnderIsomorphisms := inferInstance
instance : (⊤ : ObjectProperty C).IsSerreClass where
instance : IsSerreClass (IsZero (C := C)) where
lemma prop_iff_of_shortExact {S : ShortComplex C} (hS : S.ShortExact) :
P S.X₂ ↔ P S.X₁ ∧ P S.X₃ :=
⟨fun h ↦ ⟨P.prop_X₁_of_shortExact hS h, P.prop_X₃_of_shortExact hS h⟩,
fun h ↦ P.prop_X₂_of_shortExact hS h.1 h.2⟩
lemma prop_X₂_of_exact {S : ShortComplex C} (hS : S.Exact)
(h₁ : P S.X₁) (h₃ : P S.X₃) : P S.X₂ := by
let d := S.homologyData
have := hS.epi_f' d.left
have := hS.mono_g' d.right
exact (P.prop_X₂_of_shortExact (hS.shortExact d)
(P.prop_of_epi d.left.f' h₁) (P.prop_of_mono d.right.g' h₃) :)
instance (F : D ⥤ C) [PreservesFiniteLimits F]
[PreservesFiniteColimits F] :
(P.inverseImage F).IsSerreClass where
end ObjectProperty
end CategoryTheory |
.lake/packages/mathlib/Mathlib/CategoryTheory/Abelian/SerreClass/Bousfield.lean | import Mathlib.CategoryTheory.Abelian.SerreClass.MorphismProperty
import Mathlib.CategoryTheory.Localization.Bousfield
/-!
# Bousfield localizations with respect to Serre classes
If `G : D ⥤ C` is an exact functor between abelian categories,
with a fully faithful right adjoint `F`, then `G` identifies
`C` to the localization of `D` with respect to the
class of morphisms `G.kernel.isoModSerre`, i.e. `D`
is the localization of `C` with respect to the Serre class
`G.kernel` consisting of the objects in `D`
that are sent to a zero object by `G`.
(We also translate this in terms of a left Bousfield localization.)
-/
namespace CategoryTheory
open Localization Limits MorphismProperty
variable {C D : Type*} [Category C] [Category D]
[Abelian C] [Abelian D] (G : D ⥤ C)
[PreservesFiniteLimits G] [PreservesFiniteColimits G]
namespace Abelian
lemma isoModSerre_kernel_eq_inverseImage_isomorphisms :
G.kernel.isoModSerre = (isomorphisms C).inverseImage G := by
ext X Y f
refine ⟨(G.kernel.isoModSerre_isInvertedBy_iff G).2 (by rfl) _, fun hf ↦ ?_⟩
simp only [inverseImage_iff, isomorphisms.iff] at hf
constructor
· exact KernelFork.IsLimit.isZero_of_mono
(KernelFork.mapIsLimit _ (kernelIsKernel f) G)
· exact CokernelCofork.IsColimit.isZero_of_epi
(CokernelCofork.mapIsColimit _ (cokernelIsCokernel f) G)
variable {G}
lemma isoModSerre_kernel_eq_leftBousfield_W_of_rightAdjoint
{F : C ⥤ D} (adj : G ⊣ F) [F.Full] [F.Faithful] :
G.kernel.isoModSerre = LeftBousfield.W (· ∈ Set.range F.obj) := by
rw [LeftBousfield.W_eq_inverseImage_isomorphisms adj,
isoModSerre_kernel_eq_inverseImage_isomorphisms]
lemma isLocalization_isoModSerre_kernel_of_leftAdjoint
{F : C ⥤ D} (adj : G ⊣ F) [F.Full] [F.Faithful] :
G.IsLocalization G.kernel.isoModSerre := by
rw [isoModSerre_kernel_eq_inverseImage_isomorphisms G]
exact adj.isLocalization
end Abelian
end CategoryTheory |
.lake/packages/mathlib/Mathlib/CategoryTheory/Abelian/SerreClass/MorphismProperty.lean | import Mathlib.CategoryTheory.Abelian.SerreClass.Basic
import Mathlib.CategoryTheory.Abelian.DiagramLemmas.KernelCokernelComp
import Mathlib.CategoryTheory.MorphismProperty.Composition
import Mathlib.CategoryTheory.MorphismProperty.Retract
import Mathlib.CategoryTheory.MorphismProperty.IsInvertedBy
/-!
# The class of isomorphisms modulo a Serre class
Let `C` be an abelian category and `P : ObjectProperty C` a Serre class.
We define `P.isoModSerre : MorphismProperty C`, which is the class of
morphisms `f` such that `kernel f` and `cokernel f` satisfy `P`.
We show that `P.isoModSerre` is multiplicative, satisfies the two out
of three property and is stable under retracts. (Similarly, we define
`P.monoModSerre` and `P.epiModSerre`.)
## TODO
* show that a localized category with respect to `P.isoModSerre` is abelian.
-/
universe v v' u u'
namespace CategoryTheory
open Category Limits ZeroObject MorphismProperty
variable {C : Type u} [Category.{v} C] [Abelian C]
{D : Type u'} [Category.{v'} D] [Abelian D]
namespace ObjectProperty
variable (P : ObjectProperty C)
/-- The class of monomorphisms modulo a Serre class: given a
Serre class `P : ObjectProperty C`, this is the class of morphisms `f`
such that `kernel f` satisfies `P`. -/
@[nolint unusedArguments]
def monoModSerre [P.IsSerreClass] : MorphismProperty C :=
fun _ _ f ↦ P (kernel f)
/-- The class of epimorphisms modulo a Serre class: given a
Serre class `P : ObjectProperty C`, this is the class of morphisms `f`
such that `cokernel f` satisfies `P`. -/
@[nolint unusedArguments]
def epiModSerre [P.IsSerreClass] : MorphismProperty C :=
fun _ _ f ↦ P (cokernel f)
/-- The class of isomorphisms modulo a Serre class: given a
Serre class `P : ObjectProperty C`, this is the class of morphisms `f`
such that `kernel f` and `cokernel f` satisfy `P`. -/
@[nolint unusedArguments]
def isoModSerre [P.IsSerreClass] : MorphismProperty C :=
P.monoModSerre ⊓ P.epiModSerre
variable [P.IsSerreClass]
lemma monoModSerre_iff {X Y : C} (f : X ⟶ Y) :
P.monoModSerre f ↔ P (kernel f) := Iff.rfl
lemma monomorphisms_le_monoModSerre : monomorphisms C ≤ P.monoModSerre :=
fun _ _ f (_ : Mono f) ↦ P.prop_of_isZero (isZero_kernel_of_mono f)
lemma monoModSerre_of_mono {X Y : C} (f : X ⟶ Y) [Mono f] :
P.monoModSerre f :=
P.monomorphisms_le_monoModSerre f (monomorphisms.infer_property f)
lemma epiModSerre_iff {X Y : C} (f : X ⟶ Y) :
P.epiModSerre f ↔ P (cokernel f) := Iff.rfl
lemma epimorphisms_le_epiModSerre : epimorphisms C ≤ P.epiModSerre :=
fun _ _ f (_ : Epi f) ↦ P.prop_of_isZero (isZero_cokernel_of_epi f)
lemma epiModSerre_of_epi {X Y : C} (f : X ⟶ Y) [Epi f] :
P.epiModSerre f :=
P.epimorphisms_le_epiModSerre f (epimorphisms.infer_property f)
lemma isoModSerre_iff {X Y : C} (f : X ⟶ Y) :
P.isoModSerre f ↔ P.monoModSerre f ∧ P.epiModSerre f := Iff.rfl
lemma isoModSerre_iff_of_mono {X Y : C} (f : X ⟶ Y) [Mono f] :
P.isoModSerre f ↔ P.epiModSerre f := by
have := P.monoModSerre_of_mono f
rw [isoModSerre_iff]
tauto
lemma isoModSerre_iff_of_epi {X Y : C} (f : X ⟶ Y) [Epi f] :
P.isoModSerre f ↔ P.monoModSerre f := by
have := P.epiModSerre_of_epi f
rw [isoModSerre_iff]
tauto
lemma isoModSerre_of_mono {X Y : C} (f : X ⟶ Y) [Mono f] (hf : P.epiModSerre f) :
P.isoModSerre f := by
rwa [isoModSerre_iff_of_mono]
lemma isoModSerre_of_epi {X Y : C} (f : X ⟶ Y) [Epi f] (hf : P.monoModSerre f) :
P.isoModSerre f := by
rwa [isoModSerre_iff_of_epi]
lemma isomorphisms_le_isoModSerre : isomorphisms C ≤ P.isoModSerre :=
fun _ _ f (_ : IsIso f) ↦ ⟨P.monoModSerre_of_mono f, P.epiModSerre_of_epi f⟩
lemma isoModSerre_of_isIso {X Y : C} (f : X ⟶ Y) [IsIso f] : P.isoModSerre f :=
P.isomorphisms_le_isoModSerre f (isomorphisms.infer_property f)
instance : P.monoModSerre.IsMultiplicative where
id_mem _ := P.monoModSerre_of_mono _
comp_mem f g hf hg :=
P.prop_X₂_of_exact ((kernelCokernelCompSequence_exact f g).exact 0) hf hg
instance : P.epiModSerre.IsMultiplicative where
id_mem _ := P.epiModSerre_of_epi _
comp_mem f g hf hg :=
P.prop_X₂_of_exact ((kernelCokernelCompSequence_exact f g).exact 3) hf hg
instance : P.isoModSerre.IsMultiplicative := by
dsimp only [isoModSerre]
infer_instance
instance : P.monoModSerre.IsStableUnderRetracts where
of_retract {X' Y' X Y} f' f h hf :=
P.prop_of_mono (kernel.map f' f h.left.i h.right.i (by simp)) hf
instance : P.epiModSerre.IsStableUnderRetracts where
of_retract {X' Y' X Y} f' f h hf :=
P.prop_of_epi (cokernel.map f f' h.left.r h.right.r (by simp)) hf
instance : P.isoModSerre.IsStableUnderRetracts := by
dsimp only [isoModSerre]
infer_instance
instance : P.isoModSerre.HasTwoOutOfThreeProperty where
of_postcomp f g hg hfg :=
⟨P.prop_of_mono (kernel.map f (f ≫ g) (𝟙 _) g (by simp)) hfg.1,
P.prop_X₂_of_exact ((kernelCokernelCompSequence_exact f g).exact 2) hg.1 hfg.2⟩
of_precomp f g hf hfg :=
⟨P.prop_X₂_of_exact ((kernelCokernelCompSequence_exact f g).exact 1) hfg.1 hf.2,
P.prop_of_epi (cokernel.map (f ≫ g) g f (𝟙 _) (by simp)) hfg.2⟩
lemma le_kernel_of_isoModSerre_isInvertedBy (F : C ⥤ D) [F.PreservesZeroMorphisms]
(hF : P.isoModSerre.IsInvertedBy F) :
P ≤ F.kernel := by
intro X hX
let f : 0 ⟶ X := 0
have := hF _ ((P.isoModSerre_iff_of_mono f).2
((P.prop_iff_of_iso cokernelZeroIsoTarget).2 hX))
exact (asIso (F.map f)).isZero_iff.1 (F.map_isZero (isZero_zero C))
lemma isoModSerre_isInvertedBy_iff (F : C ⥤ D)
[PreservesFiniteLimits F] [PreservesFiniteColimits F] :
P.isoModSerre.IsInvertedBy F ↔ P ≤ F.kernel := by
refine ⟨P.le_kernel_of_isoModSerre_isInvertedBy F, fun hF X Y f ⟨h₁, h₂⟩ ↦ ?_⟩
have : Mono (F.map f) :=
(((ShortComplex.mk _ _ (kernel.condition f)).exact_of_f_is_kernel
(kernelIsKernel f)).map F).mono_g (((hF _ h₁).eq_of_src _ _))
have : Epi (F.map f) :=
(((ShortComplex.mk _ _ (cokernel.condition f)).exact_of_g_is_cokernel
(cokernelIsCokernel f)).map F).epi_f (((hF _ h₂).eq_of_tgt _ _))
exact isIso_of_mono_of_epi (F.map f)
end ObjectProperty
end CategoryTheory |
.lake/packages/mathlib/Mathlib/CategoryTheory/Abelian/GrothendieckCategory/ColimCoyoneda.lean | import Mathlib.CategoryTheory.Abelian.GrothendieckCategory.Subobject
import Mathlib.CategoryTheory.Limits.FunctorCategory.EpiMono
import Mathlib.CategoryTheory.MorphismProperty.Limits
/-!
# Morphisms to a colimit in a Grothendieck abelian category
Let `C : Type u` be an abelian category `[Category.{v} C]` which
satisfies `IsGrothendieckAbelian.{w} C`. We may expect
that all the objects `X : C` are `κ`-presentable for some regular
cardinal `κ`. However, we only prove a weaker result (which
is enough in order to obtain the existence of enough
injectives (TODO)): let `κ` be a big enough regular
cardinal `κ` such that if `Y : J ⥤ C` is a functor from
a `κ`-filtered category, and `c : Cocone Y` is a colimit cocone,
then the map from the colimit of the types `X ⟶ Y j` to
`X ⟶ c.pt` is injective, and it is bijective under the
additional assumption that for any map `f : j ⟶ j'` in `J`,
`Y.map f` is a monomorphism, see
`IsGrothendieckAbelian.preservesColimit_coyoneda_obj_of_mono`.
-/
universe w v u
namespace CategoryTheory
open Limits Opposite
attribute [local instance] IsFiltered.isConnected
namespace IsGrothendieckAbelian
variable {C : Type u} [Category.{v} C] [Abelian C] [IsGrothendieckAbelian.{w} C]
{X : C} {J : Type w} [SmallCategory J]
namespace IsPresentable
variable {Y : J ⥤ C} {c : Cocone Y} (hc : IsColimit c)
namespace injectivity₀
variable {j₀ : J} (y : X ⟶ Y.obj j₀) (hy : y ≫ c.ι.app j₀ = 0)
/-!
Given `y : X ⟶ Y.obj j₀`, we introduce a natural
transformation `g : X ⟶ Y.obj t.right` for `t : Under j₀`.
We consider the kernel of this morphism: we have a natural exact sequence
`kernel (g y) ⟶ X ⟶ Y.obj t.right` for all `t : Under j₀`. Under the
assumption that the composition `y ≫ c.ι.app j₀ : X ⟶ c.pt` is zero,
we get that after passing to the colimit, the right map `X ⟶ c.pt` is
zero, which implies that the left map `f : colimit (kernel (g y)) ⟶ X`
is an epimorphism (see `epi_f`). If `κ` is a regular cardinal that is
bigger than the cardinality of `Subobject X` and `J` is `κ`-filtered,
it follows that for some `φ : j₀ ⟶ j` in `Under j₀`,
the inclusion `(kernel.ι (g y)).app j` is an isomorphism,
which implies that `y ≫ Y.map φ = 0` (see the lemma `injectivity₀`).
-/
/-- The natural transformation `X ⟶ Y.obj t.right` for `t : Under j₀`
that is induced by `y : X ⟶ Y.obj j₀`. -/
@[simps]
def g : (Functor.const _).obj X ⟶ Under.forget j₀ ⋙ Y where
app t := y ≫ Y.map t.hom
naturality t₁ t₂ f := by
dsimp
simp only [Category.id_comp, Category.assoc, ← Functor.map_comp, Under.w]
/-- The obvious morphism `colimit (kernel (g y)) ⟶ X` (which is an epimorphism
if `J` is filtered, see `epi_f`.). -/
noncomputable def f : colimit (kernel (g y)) ⟶ X :=
IsColimit.map (colimit.isColimit _) (constCocone _ X) (kernel.ι _)
lemma hf (j : Under j₀) :
colimit.ι (kernel (g y)) j ≫ f y = (kernel.ι (g y)).app j :=
(IsColimit.ι_map _ _ _ _).trans (by simp)
variable {y} in
include hc hy in
lemma epi_f [IsFiltered J] : Epi (f y) := by
exact (colim.exact_mapShortComplex
((ShortComplex.mk _ _ (kernel.condition (g y))).exact_of_f_is_kernel
(kernelIsKernel (g y)))
(colimit.isColimit _) (isColimitConstCocone _ _)
((Functor.Final.isColimitWhiskerEquiv (Under.forget j₀) c).symm hc) (f y) 0
(fun j ↦ by simpa using hf y j)
(fun _ ↦ by simpa using hy.symm)).epi_f rfl
/-- The kernel of `g y` gives a family of subobjects of `X` indexed by `Under j₀`, and
we consider it as a functor `Under j₀ ⥤ MonoOver X`. -/
@[simps]
noncomputable def F : Under j₀ ⥤ MonoOver X where
obj j := MonoOver.mk' ((kernel.ι (g y)).app j)
map {j j'} f := MonoOver.homMk ((kernel (g y)).map f)
end injectivity₀
section
variable {κ : Cardinal.{w}} [hκ : Fact κ.IsRegular] [IsCardinalFiltered J κ]
(hXκ : HasCardinalLT (Subobject X) κ)
include hXκ hc
open injectivity₀ in
lemma injectivity₀ {j₀ : J} (y : X ⟶ Y.obj j₀) (hy : y ≫ c.ι.app j₀ = 0) :
∃ (j : J) (φ : j₀ ⟶ j), y ≫ Y.map φ = 0 := by
have := isFiltered_of_isCardinalFiltered J κ
obtain ⟨j, h⟩ := exists_isIso_of_functor_from_monoOver (F y) hXκ _
(colimit.isColimit (kernel (g y))) (f y) (fun j ↦ by simpa using hf y j)
(epi_f hc hy)
dsimp at h
refine ⟨j.right, j.hom, ?_⟩
simpa only [← cancel_epi ((kernel.ι (g y)).app j), comp_zero]
using NatTrans.congr_app (kernel.condition (g y)) j
lemma injectivity (j₀ : J) (y₁ y₂ : X ⟶ Y.obj j₀)
(hy : y₁ ≫ c.ι.app j₀ = y₂ ≫ c.ι.app j₀) :
∃ (j : J) (φ : j₀ ⟶ j), y₁ ≫ Y.map φ = y₂ ≫ Y.map φ := by
obtain ⟨j, φ, hφ⟩ := injectivity₀ hc hXκ (y₁ - y₂)
(by rw [Preadditive.sub_comp, sub_eq_zero, hy])
exact ⟨j, φ, by simpa only [Preadditive.sub_comp, sub_eq_zero] using hφ⟩
end
namespace surjectivity
variable (z : X ⟶ c.pt)
/-!
Let `z : X ⟶ c.pt` (where `c` is a colimit cocone for `Y : J ⥤ C`).
We consider the pullback of `c.ι` and of the constant
map `(Functor.const J).map z`. If we assume that `c.ι` is a monomorphism,
then this pullback evaluated at `j : J` can be identified to a subobject of `X`
(this is the inverse image by `z` of `Y.obj j` considered as a subobject of `c.pt`).
This corresponds to a functor `F z : J ⥤ MonoOver X`, and when taking the colimit
(computed in `C`), we obtain an epimorphism
`f z : colimit (pullback c.ι ((Functor.const J).map z)) ⟶ X`
when `J` is filtered (see `epi_f`). If `κ` is a regular cardinal that is
bigger than the cardinality of `Subobject X` and `J` is `κ`-filtered,
we deduce that `z` factors as `X ⟶ Y.obj j ⟶ c.pt` for some `j`
(see the lemma `surjectivity`).
-/
/-- The functor `J ⥤ MonoOver X` which sends `j : J` to the inverse image by `z : X ⟶ c.pt`
of the subobject `Y.obj j` of `c.pt`; it is defined here as the object in `MonoOver X`
corresponding to the monomorphism
`(pullback.snd c.ι ((Functor.const _).map z)).app j`. -/
@[simps]
noncomputable def F [Mono c.ι] : J ⥤ MonoOver X where
obj j := MonoOver.mk' ((pullback.snd c.ι ((Functor.const _).map z)).app j)
map {j j'} f := MonoOver.homMk ((pullback c.ι ((Functor.const _).map z)).map f)
/-- The canonical map `colimit (pullback c.ι ((Functor.const J).map z)) ⟶ X`,
which is an isomorphism when `J` is filtered, see `isIso_f`. -/
noncomputable def f : colimit (pullback c.ι ((Functor.const J).map z)) ⟶ X :=
colimit.desc _ (Cocone.mk X
{ app j := (pullback.snd c.ι ((Functor.const _).map z)).app j })
lemma hf (j : J) :
colimit.ι (pullback c.ι ((Functor.const J).map z)) j ≫ f z =
(pullback.snd c.ι ((Functor.const J).map z)).app j :=
colimit.ι_desc _ _
include hc
lemma isIso_f [IsFiltered J] : IsIso (f z) := by
refine ((MorphismProperty.isomorphisms C).arrow_mk_iso_iff ?_).1
(MorphismProperty.of_isPullback
((IsPullback.of_hasPullback c.ι ((Functor.const _).map z)).map colim) ?_)
· refine Arrow.isoMk (Iso.refl _)
(IsColimit.coconePointUniqueUpToIso (colimit.isColimit _) (isColimitConstCocone J X)) ?_
dsimp
ext j
rw [Category.id_comp, ι_colimMap_assoc, colimit.comp_coconePointUniqueUpToIso_hom,
constCocone_ι, NatTrans.id_app, Category.comp_id]
apply hf
· refine ((MorphismProperty.isomorphisms C).arrow_mk_iso_iff ?_).2
(inferInstanceAs (IsIso (𝟙 c.pt)))
exact Arrow.isoMk (IsColimit.coconePointUniqueUpToIso (colimit.isColimit Y) hc)
(IsColimit.coconePointUniqueUpToIso (colimit.isColimit _)
(isColimitConstCocone J c.pt))
lemma epi_f [IsFiltered J] : Epi (f z) := by
have := isIso_f hc z
infer_instance
end surjectivity
include hc in
open surjectivity in
lemma surjectivity [∀ (j j' : J) (φ : j ⟶ j'), Mono (Y.map φ)]
{κ : Cardinal.{w}} [hκ : Fact κ.IsRegular] [IsCardinalFiltered J κ]
(hXκ : HasCardinalLT (Subobject X) κ) (z : X ⟶ c.pt) :
∃ (j₀ : J) (y : X ⟶ Y.obj j₀), z = y ≫ c.ι.app j₀ := by
have := isFiltered_of_isCardinalFiltered J κ
have := hc.mono_ι_app_of_isFiltered
have := NatTrans.mono_of_mono_app c.ι
obtain ⟨j, _⟩ := exists_isIso_of_functor_from_monoOver (F z) hXκ _
(colimit.isColimit _) (f z) (hf z) (epi_f hc z)
refine ⟨j, inv ((F z).obj j).obj.hom ≫ (pullback.fst c.ι _).app j, ?_⟩
dsimp
rw [Category.assoc, IsIso.eq_inv_comp, ← NatTrans.comp_app, pullback.condition,
NatTrans.comp_app, Functor.const_map_app]
end IsPresentable
open IsPresentable in
/-- If `X` is an object in a Grothendieck abelian category, then
the functor `coyoneda.obj (op X)` commutes with colimits corresponding
to diagrams of monomorphisms indexed by `κ`-filtered categories
for a big enough regular cardinal `κ`. -/
lemma preservesColimit_coyoneda_obj_of_mono
(Y : J ⥤ C) {κ : Cardinal.{w}} [hκ : Fact κ.IsRegular]
[IsCardinalFiltered J κ] (hXκ : HasCardinalLT (Subobject X) κ)
[∀ (j j' : J) (φ : j ⟶ j'), Mono (Y.map φ)] :
PreservesColimit Y ((coyoneda.obj (op X))) where
preserves {c} hc := ⟨by
have := isFiltered_of_isCardinalFiltered J κ
exact Types.FilteredColimit.isColimitOf' _ _
(surjectivity hc hXκ) (injectivity hc hXκ)⟩
end IsGrothendieckAbelian
end CategoryTheory |
.lake/packages/mathlib/Mathlib/CategoryTheory/Abelian/GrothendieckCategory/EnoughInjectives.lean | import Mathlib.CategoryTheory.Abelian.CommSq
import Mathlib.CategoryTheory.Abelian.GrothendieckCategory.ColimCoyoneda
import Mathlib.CategoryTheory.Abelian.GrothendieckCategory.Monomorphisms
import Mathlib.CategoryTheory.Abelian.Monomorphisms
import Mathlib.CategoryTheory.Preadditive.Injective.LiftingProperties
import Mathlib.CategoryTheory.SmallObject.Basic
import Mathlib.CategoryTheory.Subobject.HasCardinalLT
import Mathlib.Order.TransfiniteIteration
/-!
# Grothendieck abelian categories have enough injectives
Let `C` be a Grothendieck abelian category. In this file, we formalize
the theorem by Grothendieck that `C` has enough injectives.
We recall that injective objects can be characterized in terms of
lifting properties (see the file `Preadditive.Injective.LiftingProperties`):
an object `I : C` is injective iff the morphism `I ⟶ 0` has the right lifting
property with respect to all monomorphisms.
The main technical lemma in this file is the lemma
`generatingMonomorphisms_rlp` which states that
if `G` is a generator of `C`, then a morphism `X ⟶ Y` has the right
lifting property with respect to the inclusions of subobjects of `G`
iff it has the right lifting property with respect to all
monomorphisms. Then, we can apply the small object argument
to the family of morphisms `generatingMonomorphisms G`
which consists of the inclusions of subobjects of `G`. When it is
applied to the morphism `X ⟶ 0`, the factorization given by the
small object is a factorization `X ⟶ I ⟶ 0` where `I` is
injective (because `I ⟶ 0` has the expected right lifting properties),
and `X ⟶ I` is a monomorphism because it is a transfinite composition
of monomorphisms (this uses the axiom AB5).
The proof of the technical lemma `generatingMonomorphisms_rlp` that
was formalized is not exactly the same as in the mathematical literature.
Assume that `p : X ⟶ Y` has the lifting property with respect to
monomorphisms in the family `generatingMonomorphisms G`.
We would like to show that `p` has the right lifting property with
respect to any monomorphism `i : A ⟶ B`. In various sources,
given a commutative square with `i` on the left and `p` on the right,
the ordered set of subobjects `A'` of `B` containing `A` equipped
with a lifting `A' ⟶ X` is introduced. The existence of a lifting `B ⟶ X`
is usually obtained by applying Zorn's lemma in this situation.
Here, we split the argument into two separate facts:
* any monomorphism `A ⟶ B` is a transfinite composition of pushouts of monomorphisms in
`generatingMonomorphisms G` (see `generatingMonomorphisms.exists_transfiniteCompositionOfShape`);
* the class of morphisms that have the left lifting property with respect to `p` is stable under
transfinite composition (see the file `SmallObject.TransfiniteCompositionLifting`).
## References
- [Alexander Grothendieck, *Sur quelques points d'algèbre homologique*][grothendieck-1957]
-/
universe w v u
namespace CategoryTheory
open Category Limits ZeroObject
variable {C : Type u} [Category.{v} C]
namespace IsGrothendieckAbelian
/-- Given an object `G : C`, this is the family of morphisms in `C`
given by the inclusions of all subobjects of `G`. If `G` is a separator,
and `C` is a Grothendieck abelian category, then any monomorphism in `C`
is a transfinite composition of pushouts of monomorphisms in this family
(see `generatingMonomorphisms.exists_transfiniteCompositionOfShape`). -/
def generatingMonomorphisms (G : C) : MorphismProperty C :=
MorphismProperty.ofHoms (fun (X : Subobject G) ↦ X.arrow)
instance (G : C) [Small.{w} (Subobject G)] :
MorphismProperty.IsSmall.{w} (generatingMonomorphisms G) := by
dsimp [generatingMonomorphisms]
infer_instance
lemma generatingMonomorphisms_le_monomorphisms (G : C) :
generatingMonomorphisms G ≤ MorphismProperty.monomorphisms C := by
rintro _ _ _ ⟨X⟩
exact inferInstanceAs (Mono _)
variable (G : C)
lemma isomorphisms_le_pushouts_generatingMonomorphisms [HasZeroMorphisms C] :
MorphismProperty.isomorphisms C ≤ (generatingMonomorphisms G).pushouts :=
MorphismProperty.isomorphisms_le_pushouts _
(fun _ ↦ ⟨_, _, _, ⟨⊤⟩, 0, inferInstance⟩)
variable [Abelian C]
namespace generatingMonomorphisms
variable {G} (hG : IsSeparator G)
include hG
/-- If `p : X ⟶ Y` is a monomorphism that is not an isomorphism, there exists
a subobject `X'` of `Y` containing `X` (but different from `X`) such that
the inclusion `X ⟶ X'` is a pushout of a monomorphism in the family
`generatingMonomorphisms G`. -/
lemma exists_pushouts
{X Y : C} (p : X ⟶ Y) [Mono p] (hp : ¬ IsIso p) :
∃ (X' : C) (i : X ⟶ X') (p' : X' ⟶ Y) (_ : (generatingMonomorphisms G).pushouts i)
(_ : ¬ IsIso i) (_ : Mono p'), i ≫ p' = p := by
rw [hG.isDetector.isIso_iff_of_mono] at hp
simp only [ObjectProperty.singleton_iff, Function.Surjective, Functor.flip_obj_obj,
yoneda_obj_obj, Functor.flip_obj_map, forall_eq', not_forall, not_exists] at hp
-- `f : G ⟶ Y` is a monomorphism the image of which is not contained in `X`
obtain ⟨f, hf⟩ := hp
-- we use the subobject `X'` of `Y` that is generated by the images of `p : X ⟶ Y`
-- and `f : G ⟶ Y`: this is the pushout of `p` and `f` along their pullback
refine ⟨pushout (pullback.fst p f) (pullback.snd p f), pushout.inl _ _,
pushout.desc p f pullback.condition,
⟨_, _, _, (Subobject.underlyingIso _).hom ≫ pullback.fst _ _,
pushout.inr _ _, ⟨Subobject.mk (pullback.snd p f)⟩,
(IsPushout.of_hasPushout (pullback.fst p f) (pullback.snd p f)).of_iso
((Subobject.underlyingIso _).symm) (Iso.refl _) (Iso.refl _)
(Iso.refl _) (by simp) (by simp) (by simp) (by simp)⟩, ?_, ?_, by simp⟩
· intro h
rw [isIso_iff_yoneda_map_bijective] at h
obtain ⟨a, ha⟩ := (h G).2 (pushout.inr _ _)
exact hf a (by simpa using ha =≫ pushout.desc p f pullback.condition)
· exact (IsPushout.of_hasPushout _ _).mono_of_isPullback_of_mono
(IsPullback.of_hasPullback p f) _ (by simp) (by simp)
lemma exists_larger_subobject {X : C} (A : Subobject X) (hA : A ≠ ⊤) :
∃ (A' : Subobject X) (h : A < A'),
(generatingMonomorphisms G).pushouts (Subobject.ofLE A A' h.le) := by
induction A using Subobject.ind with | _ f
obtain ⟨X', i, p', hi, hi', hp', fac⟩ := exists_pushouts hG f
(by simpa only [Subobject.isIso_iff_mk_eq_top] using hA)
refine ⟨Subobject.mk p', Subobject.mk_lt_mk_of_comm i fac hi',
(MorphismProperty.arrow_mk_iso_iff _ ?_).2 hi⟩
refine Arrow.isoMk (Subobject.underlyingIso f) (Subobject.underlyingIso p') ?_
dsimp
simp only [← cancel_mono p', assoc, fac,
Subobject.underlyingIso_hom_comp_eq_mk, Subobject.ofLE_arrow]
variable {X : C}
open Classical in
/-- Assuming `G : C` is a generator, `X : C`, and `A : Subobject X`,
this is a subobject of `X` which is `⊤` if `A = ⊤`, and otherwise
it is a larger subobject given by the lemma `exists_larger_subobject`.
The inclusion of `A` in `largerSubobject hG A` is a pushout of
a monomorphism in the family `generatingMonomorphisms G`
(see `pushouts_ofLE_le_largerSubobject`). -/
noncomputable def largerSubobject (A : Subobject X) : Subobject X :=
if hA : A = ⊤ then ⊤ else (exists_larger_subobject hG A hA).choose
variable (X) in
@[simp]
lemma largerSubobject_top : largerSubobject hG (⊤ : Subobject X) = ⊤ := dif_pos rfl
lemma lt_largerSubobject (A : Subobject X) (hA : A ≠ ⊤) :
A < largerSubobject hG A := by
dsimp only [largerSubobject]
rw [dif_neg hA]
exact (exists_larger_subobject hG A hA).choose_spec.choose
lemma le_largerSubobject (A : Subobject X) :
A ≤ largerSubobject hG A := by
by_cases hA : A = ⊤
· subst hA
simp only [largerSubobject_top, le_refl]
· exact (lt_largerSubobject hG A hA).le
lemma pushouts_ofLE_le_largerSubobject (A : Subobject X) :
(generatingMonomorphisms G).pushouts
(Subobject.ofLE _ _ (le_largerSubobject hG A)) := by
by_cases hA : A = ⊤
· subst hA
have := (Subobject.isIso_arrow_iff_eq_top (largerSubobject hG (⊤ : Subobject X))).2 (by simp)
exact (MorphismProperty.arrow_mk_iso_iff _
(Arrow.isoMk (asIso (Subobject.arrow _)) (asIso (Subobject.arrow _)) (by simp))).2
(isomorphisms_le_pushouts_generatingMonomorphisms G (𝟙 X)
(MorphismProperty.isomorphisms.infer_property _))
· refine (MorphismProperty.arrow_mk_iso_iff _ ?_).1
(exists_larger_subobject hG A hA).choose_spec.choose_spec
exact Arrow.isoMk (Iso.refl _)
(Subobject.isoOfEq _ _ ((by simp [largerSubobject, dif_neg hA])))
variable [IsGrothendieckAbelian.{w} C]
lemma top_mem_range (A₀ : Subobject X) {J : Type w} [LinearOrder J] [OrderBot J] [SuccOrder J]
[WellFoundedLT J] (hJ : HasCardinalLT (Subobject X) (Cardinal.mk J)) :
∃ (j : J), transfiniteIterate (largerSubobject hG) j A₀ = ⊤ :=
top_mem_range_transfiniteIterate (largerSubobject hG) A₀ (lt_largerSubobject hG) (by simp)
(fun h ↦ by simpa [hasCardinalLT_iff_cardinal_mk_lt] using hJ.of_injective _ h)
lemma exists_ordinal (A₀ : Subobject X) :
∃ (o : Ordinal.{w}) (j : o.toType), transfiniteIterate (largerSubobject hG) j A₀ = ⊤ := by
let κ := Order.succ (Cardinal.mk (Shrink.{w} (Subobject X)))
have : OrderBot κ.ord.toType := Ordinal.toTypeOrderBot (by
simp only [ne_eq, Cardinal.ord_eq_zero]
apply Cardinal.succ_ne_zero)
exact ⟨κ.ord, top_mem_range hG A₀ (lt_of_lt_of_le (Order.lt_succ _) (by simp [κ]))⟩
section
variable (A₀ : Subobject X) (J : Type w) [LinearOrder J] [OrderBot J] [SuccOrder J]
[WellFoundedLT J]
/-- Let `C` be a Grothendieck abelian category with a generator (`hG`),
`X : C`, `A₀ : Subobject X`. Let `J` be a well-ordered type. This is
the functor `J ⥤ MonoOver X` which corresponds to the evaluation
at `A₀` of the transfinite iteration of the map
`largerSubobject hG : Subobject X → Subobject X`. -/
@[simps]
noncomputable def functorToMonoOver : J ⥤ MonoOver X where
obj j := MonoOver.mk' (transfiniteIterate (largerSubobject hG) j A₀).arrow
map {j j'} f := MonoOver.homMk (Subobject.ofLE _ _
(monotone_transfiniteIterate _ _ (le_largerSubobject hG) (leOfHom f)))
/-- The functor `J ⥤ C` induced by `functorToMonoOver hG A₀ J : J ⥤ MonoOver X`. -/
noncomputable abbrev functor : J ⥤ C :=
functorToMonoOver hG A₀ J ⋙ MonoOver.forget _ ⋙ Over.forget _
instance : (functor hG A₀ J).IsWellOrderContinuous where
nonempty_isColimit m hm := ⟨by
have := hm.nonempty_Iio.to_subtype
let c := (Set.principalSegIio m).cocone (functorToMonoOver hG A₀ J ⋙ MonoOver.forget _)
have : Mono c.pt.hom := by dsimp [c]; infer_instance
apply IsGrothendieckAbelian.isColimitMapCoconeOfSubobjectMkEqISup
((Set.principalSegIio m).monotone.functor ⋙ functorToMonoOver hG A₀ J) c
dsimp [c]
simp only [Subobject.mk_arrow]
exact transfiniteIterate_limit (largerSubobject hG) A₀ m hm⟩
variable {J} in
/-- For any `j`, the map `(functor hG A₀ J).map (homOfLE bot_le : ⊥ ⟶ j)`
is a transfinite composition of pushouts of monomorphisms in the
family `generatingMonomorphisms G`. -/
noncomputable def transfiniteCompositionOfShapeMapFromBot (j : J) :
(generatingMonomorphisms G).pushouts.TransfiniteCompositionOfShape (Set.Iic j)
((functor hG A₀ J).map (homOfLE bot_le : ⊥ ⟶ j)) where
F := (Set.initialSegIic j).monotone.functor ⋙ functor hG A₀ J
isoBot := Iso.refl _
incl :=
{ app k := (functor hG A₀ J).map (homOfLE k.2)
naturality k k' h := by simp [MonoOver.forget] }
isColimit := colimitOfDiagramTerminal isTerminalTop _
map_mem k hk := by
dsimp [MonoOver.forget]
convert pushouts_ofLE_le_largerSubobject hG
(transfiniteIterate (largerSubobject hG) k.1 A₀) using 2
all_goals
rw [Set.Iic.succ_eq_of_not_isMax hk,
transfiniteIterate_succ _ _ _ (Set.not_isMax_coe _ hk)]
end
variable {A : C} {f : A ⟶ X} [Mono f]
/-- If `transfiniteIterate (largerSubobject hG) j (Subobject.mk f) = ⊤`,
then the monomorphism `f` is a transfinite composition of pushouts of
monomorphisms in the family `generatingMonomorphisms G`. -/
noncomputable def transfiniteCompositionOfShapeOfEqTop
{J : Type w} [LinearOrder J] [OrderBot J] [SuccOrder J] [WellFoundedLT J] {j : J}
(hj : transfiniteIterate (largerSubobject hG) j (Subobject.mk f) = ⊤) :
(generatingMonomorphisms G).pushouts.TransfiniteCompositionOfShape (Set.Iic j) f := by
let t := transfiniteIterate (largerSubobject hG) j (Subobject.mk f)
have := (Subobject.isIso_arrow_iff_eq_top t).2 hj
apply (transfiniteCompositionOfShapeMapFromBot hG (Subobject.mk f) j).ofArrowIso
refine Arrow.isoMk ((Subobject.isoOfEq _ _ (transfiniteIterate_bot _ _) ≪≫
Subobject.underlyingIso f)) (asIso t.arrow) ?_
dsimp [MonoOver.forget]
rw [assoc, Subobject.underlyingIso_hom_comp_eq_mk, Subobject.ofLE_arrow,
Subobject.ofLE_arrow]
variable (f)
/-- Let `C` be a Grothendieck abelian category. Assume that `G : C` is a generator
of `C`. Then, any morphism in `C` is a transfinite composition of pushouts
of monomorphisms in the family `generatingMonomorphisms G` which consists
of the inclusions of the subobjects of `G`. -/
lemma exists_transfiniteCompositionOfShape :
∃ (J : Type w) (_ : LinearOrder J) (_ : OrderBot J) (_ : SuccOrder J)
(_ : WellFoundedLT J),
Nonempty ((generatingMonomorphisms G).pushouts.TransfiniteCompositionOfShape J f) := by
obtain ⟨o, j, hj⟩ := exists_ordinal hG (Subobject.mk f)
letI : OrderBot o.toType := Ordinal.toTypeOrderBot (by
simpa only [← Ordinal.toType_nonempty_iff_ne_zero] using Nonempty.intro j)
exact ⟨_, _, _, _, _, ⟨transfiniteCompositionOfShapeOfEqTop hG hj⟩⟩
end generatingMonomorphisms
open MorphismProperty
variable {G}
lemma generatingMonomorphisms_rlp [IsGrothendieckAbelian.{w} C] (hG : IsSeparator G) :
(generatingMonomorphisms G).rlp = (monomorphisms C).rlp := by
apply le_antisymm
· intro X Y p hp A B i (_ : Mono i)
obtain ⟨J, _, _, _, _, ⟨h⟩⟩ :=
generatingMonomorphisms.exists_transfiniteCompositionOfShape hG i
exact transfiniteCompositionsOfShape_le_llp_rlp _ _ _ h.mem _ (by simpa)
· exact antitone_rlp (generatingMonomorphisms_le_monomorphisms _)
open MorphismProperty
variable [IsGrothendieckAbelian.{w} C]
instance : HasSmallObjectArgument.{w} (generatingMonomorphisms G) := by
obtain ⟨κ, hκ', hκ⟩ := HasCardinalLT.exists_regular_cardinal.{w} (Subobject G)
have : Fact κ.IsRegular := ⟨hκ'⟩
letI := Cardinal.toTypeOrderBot hκ'.ne_zero
exact ⟨κ, inferInstance, inferInstance,
{ preservesColimit {A B X Y} i hi f hf := by
let hf' : (monomorphisms C).TransfiniteCompositionOfShape κ.ord.toType f :=
{ toTransfiniteCompositionOfShape := hf.toTransfiniteCompositionOfShape
map_mem j hj := by
have := (hf.attachCells j hj).pushouts_coproducts
simp only [ofHoms_homFamily] at this
refine (?_ : _ ≤ monomorphisms C) _ this
simp only [pushouts_le_iff, coproducts_le_iff]
exact generatingMonomorphisms_le_monomorphisms G }
have (j j' : κ.ord.toType) (φ : j ⟶ j') : Mono (hf'.F.map φ) := hf'.mem_map φ
apply preservesColimit_coyoneda_obj_of_mono (Y := hf'.F) (κ := κ)
obtain ⟨S⟩ := hi
exact Subobject.hasCardinalLT_of_mono hκ S.arrow }⟩
lemma llp_rlp_monomorphisms (hG : IsSeparator G) :
(monomorphisms C).rlp.llp = monomorphisms C := by
refine le_antisymm ?_ (le_llp_rlp _)
rw [← generatingMonomorphisms_rlp hG, llp_rlp_of_hasSmallObjectArgument]
trans (transfiniteCompositions.{w} (coproducts.{w} (monomorphisms C)).pushouts).retracts
· apply retracts_monotone
apply transfiniteCompositions_monotone
apply pushouts_monotone
apply coproducts_monotone
apply generatingMonomorphisms_le_monomorphisms
· simp
instance : HasFunctorialFactorization (monomorphisms C) (monomorphisms C).rlp := by
have hG := isSeparator_separator C
rw [← generatingMonomorphisms_rlp hG, ← llp_rlp_monomorphisms hG,
← generatingMonomorphisms_rlp hG]
infer_instance
/-- A (functorial) factorization of any morphisms in a Grothendieck abelian category
as a monomorphism followed by a morphism which has the right lifting property
with respect to all monomorphisms. -/
noncomputable abbrev monoMapFactorizationDataRlp {X Y : C} (f : X ⟶ Y) :
MapFactorizationData (monomorphisms C) (monomorphisms C).rlp f :=
(functorialFactorizationData _ _).factorizationData f
instance {X Y : C} (f : X ⟶ Y) :
Mono (monoMapFactorizationDataRlp f).i :=
(monoMapFactorizationDataRlp f).hi
instance {X : C} : Injective (monoMapFactorizationDataRlp (0 : X ⟶ 0)).Z := by
let fac := (monoMapFactorizationDataRlp (0 : X ⟶ 0))
simpa only [injective_iff_rlp_monomorphisms_zero,
(isZero_zero C).eq_of_tgt fac.p 0] using fac.hp
/-- A Grothendieck abelian category has enough injectives. -/
@[stacks 079H]
instance enoughInjectives : EnoughInjectives C where
presentation X := ⟨{ J := _, f := (monoMapFactorizationDataRlp (0 : X ⟶ 0)).i }⟩
end IsGrothendieckAbelian
end CategoryTheory |
.lake/packages/mathlib/Mathlib/CategoryTheory/Abelian/GrothendieckCategory/Coseparator.lean | import Mathlib.CategoryTheory.Abelian.GrothendieckCategory.EnoughInjectives
import Mathlib.CategoryTheory.Generator.Abelian
/-!
# Grothendieck categories have a coseparator
-/
universe w v u
namespace CategoryTheory.IsGrothendieckAbelian
variable {C : Type u} [Category.{v} C] [Abelian C] [IsGrothendieckAbelian.{w} C]
instance : HasCoseparator C := by
suffices HasCoseparator (ShrinkHoms C) from
HasCoseparator.of_equivalence (ShrinkHoms.equivalence.{w} C).symm
obtain ⟨G, -, hG⟩ := Abelian.has_injective_coseparator (separator (ShrinkHoms C))
(isSeparator_separator _)
exact ⟨G, hG⟩
end CategoryTheory.IsGrothendieckAbelian |
.lake/packages/mathlib/Mathlib/CategoryTheory/Abelian/GrothendieckCategory/Basic.lean | import Mathlib.CategoryTheory.Abelian.GrothendieckAxioms.Basic
import Mathlib.CategoryTheory.Abelian.Subobject
import Mathlib.CategoryTheory.Abelian.Transfer
import Mathlib.CategoryTheory.Adjunction.AdjointFunctorTheorems
import Mathlib.CategoryTheory.Limits.HasLimits
/-!
# Grothendieck categories
This file defines Grothendieck categories and proves basic facts about them.
## Definitions
A Grothendieck category according to the Stacks project is an abelian category provided that it
has `AB5` and a separator. However, this definition is not invariant under equivalences of
categories. Therefore, if `C` is an abelian category, the class `IsGrothendieckAbelian.{w} C` has a
weaker definition that is also satisfied for categories that are merely equivalent to a
Grothendieck category in the former strict sense.
## Theorems
The invariance under equivalences of categories is established in
`IsGrothendieckAbelian.of_equivalence`.
In particular, `ShrinkHoms.isGrothendieckAbelian C` shows that `ShrinkHoms C` satisfies our
definition of a Grothendieck category after shrinking its hom sets, which coincides with the strict
definition in this case.
Relevant implications of `IsGrothendieckAbelian` are established in
`IsGrothendieckAbelian.hasLimits` and `IsGrothendieckAbelian.hasColimits`.
## References
* [Stacks: Grothendieck's AB conditions](https://stacks.math.columbia.edu/tag/079A)
-/
namespace CategoryTheory
open Limits
universe w v u w₂ v₂ u₂
variable (C : Type u) [Category.{v} C] (D : Type u₂) [Category.{v₂} D]
/--
If `C` is an abelian category, we shall say that it satisfies `IsGrothendieckAbelian.{w} C`
if it is locally small (relative to `w`), has exact filtered colimits of size `w` (AB5) and has a
separator.
If `[Category.{v} C]` and `w = v`, this means that `C` satisfies `AB5` and has a separator;
general results about Grothendieck abelian categories can be
reduced to this case using the instance `ShrinkHoms.isGrothendieckAbelian` below.
The introduction of the auxiliary universe `w` shall be needed for certain
applications to categories of sheaves. That the present definition still preserves essential
properties of Grothendieck categories is ensured by `IsGrothendieckAbelian.of_equivalence`,
which shows that every instance for `C` implies an instance for `ShrinkHoms C` with hom sets in
`Type w`.
-/
@[stacks 079B, pp_with_univ]
class IsGrothendieckAbelian [Abelian C] : Prop where
locallySmall : LocallySmall.{w} C := by infer_instance
hasFilteredColimitsOfSize : HasFilteredColimitsOfSize.{w, w} C := by infer_instance
ab5OfSize : AB5OfSize.{w, w} C := by infer_instance
hasSeparator : HasSeparator C := by infer_instance
attribute [instance] IsGrothendieckAbelian.locallySmall
IsGrothendieckAbelian.hasFilteredColimitsOfSize IsGrothendieckAbelian.ab5OfSize
IsGrothendieckAbelian.hasSeparator
variable {C} {D} in
theorem IsGrothendieckAbelian.of_equivalence [Abelian C] [Abelian D]
[IsGrothendieckAbelian.{w} C] (α : C ≌ D) : IsGrothendieckAbelian.{w} D := by
have hasFilteredColimits : HasFilteredColimitsOfSize.{w, w, v₂, u₂} D :=
⟨fun _ _ _ => Adjunction.hasColimitsOfShape_of_equivalence α.inverse⟩
refine ⟨?_, hasFilteredColimits, ?_, ?_⟩
· exact locallySmall_of_faithful α.inverse
· refine ⟨fun _ _ _ => ?_⟩
exact HasExactColimitsOfShape.of_codomain_equivalence _ α
· exact HasSeparator.of_equivalence α
instance ShrinkHoms.isGrothendieckAbelian [Abelian C] [IsGrothendieckAbelian.{w} C] :
IsGrothendieckAbelian.{w, w} (ShrinkHoms C) :=
IsGrothendieckAbelian.of_equivalence <| ShrinkHoms.equivalence C
section Instances
variable [Abelian C] [IsGrothendieckAbelian.{w} C]
instance IsGrothendieckAbelian.hasColimits : HasColimitsOfSize.{w, w} C :=
has_colimits_of_finite_and_filtered
instance IsGrothendieckAbelian.hasLimits : HasLimitsOfSize.{w, w} C :=
have : HasLimits.{w, u} (ShrinkHoms C) := hasLimits_of_hasColimits_of_hasSeparator
Adjunction.has_limits_of_equivalence (ShrinkHoms.equivalence C |>.functor)
instance IsGrothendieckAbelian.wellPowered : WellPowered.{w} C :=
wellPowered_of_equiv.{w} (ShrinkHoms.equivalence.{w} C).symm
instance IsGrothendieckAbelian.ab4OfSize : AB4OfSize.{w} C := by
have : HasFiniteBiproducts C := HasFiniteBiproducts.of_hasFiniteProducts
apply AB4.of_AB5
end Instances
end CategoryTheory |
.lake/packages/mathlib/Mathlib/CategoryTheory/Abelian/GrothendieckCategory/Subobject.lean | import Mathlib.CategoryTheory.Abelian.GrothendieckAxioms.Colim
import Mathlib.CategoryTheory.Abelian.GrothendieckCategory.Basic
import Mathlib.CategoryTheory.Presentable.IsCardinalFiltered
import Mathlib.CategoryTheory.Subobject.Lattice
/-!
# Subobjects in Grothendieck abelian categories
We study the complete lattice of subjects of `X : C`
when `C` is a Grothendieck abelian category. In particular,
for a functor `F : J ⥤ MonoOver X` from a filtered category,
we relate the colimit of `F` (computed in `C`) and the
supremum of the subobjects corresponding to the objects
in the image of `F`.
-/
universe w v' v u' u
namespace CategoryTheory
open Limits
namespace IsGrothendieckAbelian
attribute [local instance] IsFiltered.isConnected
variable {C : Type u} [Category.{v} C] [Abelian C] [IsGrothendieckAbelian.{w} C]
{X : C} {J : Type w} [SmallCategory J] (F : J ⥤ MonoOver X)
section
variable [IsFiltered J] {c : Cocone (F ⋙ MonoOver.forget _ ⋙ Over.forget _)}
(hc : IsColimit c) (f : c.pt ⟶ X) (hf : ∀ (j : J), c.ι.app j ≫ f = (F.obj j).obj.hom)
include hc hf
/-- If `C` is a Grothendieck abelian category, `X : C`, if `F : J ⥤ MonoOver X` is a
functor from a filtered category `J`, `c` is a colimit cocone for the corresponding
functor `J ⥤ C`, and `f : c.pt ⟶ X` is induced by the inclusions,
then `f` is a monomorphism. -/
lemma mono_of_isColimit_monoOver : Mono f := by
let α : F ⋙ MonoOver.forget _ ⋙ Over.forget _ ⟶ (Functor.const _).obj X :=
{ app j := (F.obj j).obj.hom
naturality _ _ f := (F.map f).w }
have := NatTrans.mono_of_mono_app α
exact colim.map_mono' α hc (isColimitConstCocone J X) f (by simpa using hf)
/-- If `C` is a Grothendieck abelian category, `X : C`, if `F : J ⥤ MonoOver X` is a
functor from a filtered category `J`, the colimit of `F` (computed in `C`) gives
a subobject of `F` which is a supremum of the subobjects corresponding to
the objects in the image of the functor `F`. -/
lemma subobjectMk_of_isColimit_eq_iSup :
haveI := mono_of_isColimit_monoOver F hc f hf
Subobject.mk f = ⨆ j, Subobject.mk (F.obj j).obj.hom := by
haveI := mono_of_isColimit_monoOver F hc f hf
apply le_antisymm
· rw [le_iSup_iff]
intro s H
induction s using Subobject.ind with | _ g
let c' : Cocone (F ⋙ MonoOver.forget _ ⋙ Over.forget _) := Cocone.mk _
{ app j := Subobject.ofMkLEMk _ _ (H j)
naturality j j' f := by
dsimp
simpa only [← cancel_mono g, Category.assoc, Subobject.ofMkLEMk_comp,
Category.comp_id] using MonoOver.w (F.map f) }
exact Subobject.mk_le_mk_of_comm (hc.desc c')
(hc.hom_ext (fun j ↦ by rw [hc.fac_assoc c' j, hf, Subobject.ofMkLEMk_comp]))
· rw [iSup_le_iff]
intro j
exact Subobject.mk_le_mk_of_comm (c.ι.app j) (hf j)
end
/-- Let `X : C` be an object in a Grothendieck abelian category,
`F : J ⥤ MonoOver X` a functor from a filtered category, `c` a cocone for
the composition `F ⋙ MonoOver.forget _ : J ⥤ Over X`. We assume
that `c.pt.hom : c.pt.left ⟶ X` is a monomorphism and that the corresponding
subobject of `X` is the supremum of the subobjects given by `(F.obj j).obj.hom`,
then `c` becomes a colimit cocone after the application of
the forget functor `Over X ⥤ C`. (See also `subobjectMk_of_isColimit_eq_iSup`.) -/
noncomputable def isColimitMapCoconeOfSubobjectMkEqISup
[IsFiltered J] (c : Cocone (F ⋙ MonoOver.forget _)) [Mono c.pt.hom]
(h : Subobject.mk c.pt.hom = ⨆ j, Subobject.mk (F.obj j).obj.hom) :
IsColimit ((Over.forget _).mapCocone c) := by
let f : colimit (F ⋙ MonoOver.forget X ⋙ Over.forget X) ⟶ X :=
colimit.desc _ (Cocone.mk X
{ app j := (F.obj j).obj.hom
naturality {j j'} g := by simp [MonoOver.forget] })
haveI := mono_of_isColimit_monoOver F (colimit.isColimit _) f (by simp [f])
have := subobjectMk_of_isColimit_eq_iSup F (colimit.isColimit _) f (by simp [f])
rw [← h] at this
refine IsColimit.ofIsoColimit (colimit.isColimit _)
(Cocones.ext (Subobject.isoOfMkEqMk _ _ this) (fun j ↦ ?_))
rw [← cancel_mono (c.pt.hom)]
dsimp
rw [Category.assoc, Subobject.ofMkLEMk_comp, Over.w]
apply colimit.ι_desc
/-- If `C` is a Grothendieck abelian category, `X : C`, if `F : J ⥤ MonoOver X` is a
functor from a `κ`-filtered category `J` with `κ` a regular cardinal such
that `HasCardinalLT (Subobject X) κ`, and if the colimit of `F` (computed in `C`)
maps epimorphically onto `X`, then there exists `j : J` such that `(F.obj j).obj.hom`
is an isomorphism. -/
lemma exists_isIso_of_functor_from_monoOver
{κ : Cardinal.{w}} [hκ : Fact κ.IsRegular] [IsCardinalFiltered J κ]
(hXκ : HasCardinalLT (Subobject X) κ)
(c : Cocone (F ⋙ MonoOver.forget _ ⋙ Over.forget _)) (hc : IsColimit c)
(f : c.pt ⟶ X) (hf : ∀ (j : J), c.ι.app j ≫ f = (F.obj j).obj.hom) (h : Epi f) :
∃ (j : J), IsIso (F.obj j).obj.hom := by
have := isFiltered_of_isCardinalFiltered J κ
have := mono_of_isColimit_monoOver F hc f hf
rw [Subobject.epi_iff_mk_eq_top f,
subobjectMk_of_isColimit_eq_iSup F hc f hf] at h
let s (j : J) : Subobject X := Subobject.mk (F.obj j).obj.hom
have h' : Function.Surjective (fun (j : J) ↦ (⟨s j, _, rfl⟩ : Set.range s)) := by
rintro ⟨_, j, rfl⟩
exact ⟨j, rfl⟩
obtain ⟨σ, hσ⟩ := h'.hasRightInverse
have hs : HasCardinalLT (Set.range s) κ :=
hXκ.of_injective (f := Subtype.val) Subtype.val_injective
refine ⟨IsCardinalFiltered.max σ hs, ?_⟩
rw [Subobject.isIso_iff_mk_eq_top, ← top_le_iff, ← h, iSup_le_iff]
intro j
let t : Set.range s := ⟨_, j, rfl⟩
trans Subobject.mk (F.obj (σ t)).obj.hom
· exact (hσ t).symm.le
· exact MonoOver.subobjectMk_le_mk_of_hom
(F.map (IsCardinalFiltered.toMax σ hs t))
end IsGrothendieckAbelian
end CategoryTheory |
.lake/packages/mathlib/Mathlib/CategoryTheory/Abelian/GrothendieckCategory/Monomorphisms.lean | import Mathlib.CategoryTheory.Abelian.GrothendieckCategory.Basic
import Mathlib.CategoryTheory.Abelian.GrothendieckAxioms.Colim
import Mathlib.CategoryTheory.MorphismProperty.TransfiniteComposition
/-!
# Monomorphisms in Grothendieck abelian categories
In this file, we show that in a Grothendieck abelian category,
monomorphisms are stable under transfinite composition.
-/
universe w v u
namespace CategoryTheory
namespace IsGrothendieckAbelian
open MorphismProperty
instance {C : Type u} [Category.{v} C] [Abelian C] [IsGrothendieckAbelian.{w} C] :
IsStableUnderTransfiniteComposition.{w} (monomorphisms C) := by
infer_instance
end IsGrothendieckAbelian
end CategoryTheory |
.lake/packages/mathlib/Mathlib/CategoryTheory/Abelian/GrothendieckCategory/ModuleEmbedding/Opposite.lean | import Mathlib.CategoryTheory.Abelian.Yoneda
import Mathlib.CategoryTheory.Generator.Abelian
import Mathlib.CategoryTheory.Abelian.GrothendieckCategory.EnoughInjectives
/-!
# Embedding opposites of Grothendieck categories
If `C` is Grothendieck abelian and `F : D ⥤ Cᵒᵖ` is a functor from a small category, we construct
an object `G : Cᵒᵖ` such that `preadditiveCoyonedaObj G : Cᵒᵖ ⥤ ModuleCat (End G)ᵐᵒᵖ` is faithful
and exact and its precomposition with `F` is full if `F` is.
-/
universe v u
open CategoryTheory Limits Opposite ZeroObject
namespace CategoryTheory.Abelian.IsGrothendieckAbelian
variable {C : Type u} [Category.{v} C] {D : Type v} [SmallCategory D] (F : D ⥤ Cᵒᵖ)
namespace OppositeModuleEmbedding
variable [Abelian C] [IsGrothendieckAbelian.{v} C]
variable (C) in
private noncomputable def projectiveSeparator : Cᵒᵖ :=
(has_projective_separator (coseparator Cᵒᵖ) (isCoseparator_coseparator Cᵒᵖ)).choose
private instance : Projective (projectiveSeparator C) :=
(has_projective_separator (coseparator Cᵒᵖ) (isCoseparator_coseparator Cᵒᵖ)).choose_spec.1
private theorem isSeparator_projectiveSeparator : IsSeparator (projectiveSeparator C) :=
(has_projective_separator (coseparator Cᵒᵖ) (isCoseparator_coseparator Cᵒᵖ)).choose_spec.2
private noncomputable def generator : Cᵒᵖ :=
∐ (fun (X : D) => ∐ fun (_ : projectiveSeparator C ⟶ F.obj X) => projectiveSeparator C)
private theorem exists_epi (X : D) : ∃ f : generator F ⟶ F.obj X, Epi f := by
classical
refine ⟨Sigma.desc (Pi.single X (𝟙 _)) ≫ Sigma.desc (fun f => f), ?_⟩
have h := (isSeparator_iff_epi (projectiveSeparator C)).1
isSeparator_projectiveSeparator (F.obj X)
suffices Epi (Sigma.desc (Pi.single X (𝟙 _))) from epi_comp' this h
exact SplitEpi.epi ⟨Sigma.ι (fun (X : D) => ∐ fun _ => projectiveSeparator C) X, by simp⟩
private instance : Projective (generator F) := by
rw [generator]
infer_instance
private theorem isSeparator [Nonempty D] : IsSeparator (generator F) := by
apply isSeparator_sigma_of_isSeparator _ Classical.ofNonempty
apply isSeparator_sigma_of_isSeparator _ 0
exact isSeparator_projectiveSeparator
/-- Given a functor `F : D ⥤ Cᵒᵖ`, where `C` is Grothendieck abelian, this is a ring `R` such that
`Cᵒᵖ` has a nice embedding into `ModuleCat (EmbeddingRing F)`; see
`OppositeModuleEmbedding.embedding`. -/
def EmbeddingRing : Type v := (End (generator F))ᵐᵒᵖ
noncomputable instance : Ring (EmbeddingRing F) :=
inferInstanceAs <| Ring (End (generator F))ᵐᵒᵖ
/-- This is a functor `embedding F : Cᵒᵖ ⥤ ModuleCat (EmbeddingRing F)`. We have that `embedding F`
is faithful and preserves finite limits and colimits. Furthermore, `F ⋙ embedding F` is full. -/
noncomputable def embedding : Cᵒᵖ ⥤ ModuleCat.{v} (EmbeddingRing F) :=
preadditiveCoyonedaObj (generator F)
instance faithful_embedding [Nonempty D] : (embedding F).Faithful :=
(isSeparator_iff_faithful_preadditiveCoyonedaObj _).1 (isSeparator F)
instance full_embedding [Nonempty D] [F.Full] : (F ⋙ embedding F).Full :=
full_comp_preadditiveCoyonedaObj _ (isSeparator F) (exists_epi F)
instance preservesFiniteLimits_embedding : PreservesFiniteLimits (embedding F) := by
rw [embedding]
apply preservesFiniteLimits_of_preservesFiniteLimitsOfSize
infer_instance
instance preservesFiniteColimits_embedding : PreservesFiniteColimits (embedding F) := by
apply preservesFiniteColimits_preadditiveCoyonedaObj_of_projective
end OppositeModuleEmbedding
end CategoryTheory.Abelian.IsGrothendieckAbelian |
.lake/packages/mathlib/Mathlib/CategoryTheory/Abelian/GrothendieckCategory/ModuleEmbedding/GabrielPopescu.lean | import Mathlib.Algebra.Category.ModuleCat.Injective
import Mathlib.CategoryTheory.Abelian.GrothendieckAxioms.Connected
import Mathlib.CategoryTheory.Abelian.GrothendieckCategory.Coseparator
import Mathlib.CategoryTheory.Preadditive.Injective.Preserves
import Mathlib.CategoryTheory.Preadditive.LiftToFinset
import Mathlib.CategoryTheory.Preadditive.Yoneda.Limits
/-!
# The Gabriel-Popescu theorem
We prove the following Gabriel-Popescu theorem: if `C` is a Grothendieck abelian category and
`G` is a separator, then the functor `preadditiveCoyonedaObj G : C ⥤ ModuleCat (End G)ᵐᵒᵖ` sending
`X` to `Hom(G, X)` is fully faithful and has an exact left adjoint.
We closely follow the elementary proof given by Barry Mitchell.
## Future work
The left adjoint `tensorObj G` actually exists as soon as `C` is cocomplete and additive, so the
construction could be generalized.
The theorem as stated here implies that `C` is a Serre quotient of `ModuleCat (End R)ᵐᵒᵖ`.
## References
* [Barry Mitchell, *A quick proof of the Gabriel-Popesco theorem*][mitchell1981]
-/
universe v u
open CategoryTheory Limits Abelian
namespace CategoryTheory.IsGrothendieckAbelian
variable {C : Type u} [Category.{v} C] [Abelian C] [IsGrothendieckAbelian.{v} C]
instance {G : C} : (preadditiveCoyonedaObj G).IsRightAdjoint :=
isRightAdjoint_of_preservesLimits_of_isCoseparating.{v} (isCoseparator_coseparator _) _
/-- The left adjoint of the functor `Hom(G, ·)`, which can be thought of as `· ⊗ G`. -/
noncomputable def tensorObj (G : C) : ModuleCat (End G)ᵐᵒᵖ ⥤ C :=
(preadditiveCoyonedaObj G).leftAdjoint
/-- The tensor-hom adjunction `(· ⊗ G) ⊣ Hom(G, ·)`. -/
noncomputable def tensorObjPreadditiveCoyonedaObjAdjunction (G : C) :
tensorObj G ⊣ preadditiveCoyonedaObj G :=
Adjunction.ofIsRightAdjoint _
instance {G : C} : (tensorObj G).IsLeftAdjoint :=
(tensorObjPreadditiveCoyonedaObjAdjunction G).isLeftAdjoint
namespace GabrielPopescuAux
open CoproductsFromFiniteFiltered
/-- This is the map `⨁ₘ G ⟶ A` induced by `M ⟶ Hom(G, A)`. -/
noncomputable def d {G A : C} {M : ModuleCat (End G)ᵐᵒᵖ}
(g : M ⟶ ModuleCat.of (End G)ᵐᵒᵖ (G ⟶ A)) : ∐ (fun (_ : M) => G) ⟶ A :=
Sigma.desc fun (m : M) => g m
@[reassoc]
theorem ι_d {G A : C} {M : ModuleCat (End G)ᵐᵒᵖ} (g : M ⟶ ModuleCat.of (End G)ᵐᵒᵖ (G ⟶ A)) (m : M) :
Sigma.ι _ m ≫ d g = g.hom m := by
simp [d]
attribute [local instance] IsFiltered.isConnected in
/-- This is the "Lemma" in [mitchell1981]. -/
theorem kernel_ι_d_comp_d {G : C} (hG : IsSeparator G) {A B : C} {M : ModuleCat (End G)ᵐᵒᵖ}
(g : M ⟶ ModuleCat.of (End G)ᵐᵒᵖ (G ⟶ A)) (hg : Mono g)
(f : M ⟶ ModuleCat.of (End G)ᵐᵒᵖ (G ⟶ B)) :
kernel.ι (d g) ≫ d f = 0 := by
refine (isColimitFiniteSubproductsCocone (fun (_ : M) => G)).pullback_zero_ext (fun F => ?_)
dsimp only [liftToFinsetObj_obj, Discrete.functor_obj_eq_as, finiteSubcoproductsCocone_pt,
Functor.const_obj_obj]
classical
rw [finiteSubcoproductsCocone_ι_app_eq_sum, ← pullback.condition_assoc]
refine (Preadditive.isSeparator_iff G).1 hG _ (fun h => ?_)
rw [Preadditive.comp_sum_assoc, Preadditive.comp_sum_assoc, Preadditive.sum_comp]
simp only [Category.assoc, ι_d]
let r (x : F) : (End G)ᵐᵒᵖ := MulOpposite.op (h ≫ pullback.fst _ _ ≫ Sigma.π _ x)
suffices ∑ x ∈ F.attach, r x • f.hom x.1.as = 0 by simpa [End.smul_left, r] using this
simp only [← LinearMap.map_smul, ← map_sum]
suffices ∑ x ∈ F.attach, r x • x.1.as = 0 by simp [this]
simp only [← g.hom.map_eq_zero_iff ((ModuleCat.mono_iff_injective _).1 hg), map_sum, map_smul]
simp only [← ι_d g, End.smul_left, MulOpposite.unop_op, Category.assoc, r]
simp [← Preadditive.comp_sum, ← Preadditive.sum_comp', pullback.condition_assoc]
theorem exists_d_comp_eq_d {G : C} (hG : IsSeparator G) {A} (B : C) [Injective B]
{M : ModuleCat (End G)ᵐᵒᵖ} (g : M ⟶ ModuleCat.of (End G)ᵐᵒᵖ (G ⟶ A)) (hg : Mono g)
(f : M ⟶ ModuleCat.of (End G)ᵐᵒᵖ (G ⟶ B)) : ∃ (l : A ⟶ B), d g ≫ l = d f := by
let l₁ : image (d g) ⟶ B := epiDesc (factorThruImage (d g)) (d f) (by
rw [← kernelFactorThruImage_hom_comp_ι, Category.assoc, kernel_ι_d_comp_d hG _ hg, comp_zero])
let l₂ : A ⟶ B := Injective.factorThru l₁ (Limits.image.ι (d g))
refine ⟨l₂, ?_⟩
simp only [l₂, l₁]
conv_lhs => congr; rw [← Limits.image.fac (d g)]
simp [-Limits.image.fac]
end GabrielPopescuAux
open GabrielPopescuAux
/-- Faithfulness follows because `G` is a separator, see
`isSeparator_iff_faithful_preadditiveCoyonedaObj`. -/
theorem GabrielPopescu.full (G : C) (hG : IsSeparator G) : (preadditiveCoyonedaObj G).Full where
map_surjective {A B} f := by
have := (isSeparator_iff_epi G).1 hG A
have h := kernel_ι_d_comp_d hG (𝟙 _) inferInstance f
simp only [ModuleCat.hom_id, LinearMap.id_coe, id_eq, d] at h
refine ⟨epiDesc _ _ h, ?_⟩
ext q
simpa [-comp_epiDesc] using Sigma.ι _ q ≫= comp_epiDesc _ _ h
theorem GabrielPopescu.preservesInjectiveObjects (G : C) (hG : IsSeparator G) :
(preadditiveCoyonedaObj G).PreservesInjectiveObjects where
injective_obj {B} hB := by
rw [← Module.injective_iff_injective_object]
simp only [preadditiveCoyonedaObj_obj_carrier, preadditiveCoyonedaObj_obj_isAddCommGroup,
preadditiveCoyonedaObj_obj_isModule]
refine Module.Baer.injective (fun M g => ?_)
have h := exists_d_comp_eq_d hG B (ModuleCat.ofHom
⟨⟨fun i => i.1.unop, by cat_disch⟩, by cat_disch⟩) ?_ (ModuleCat.ofHom g)
· obtain ⟨l, hl⟩ := h
refine ⟨((preadditiveCoyonedaObj G).map l).hom ∘ₗ
(Preadditive.homSelfLinearEquivEndMulOpposite G).symm.toLinearMap, ?_⟩
intro f hf
simpa [d] using Sigma.ι _ ⟨f, hf⟩ ≫= hl
· rw [ModuleCat.mono_iff_injective]
cat_disch
/-- Right exactness follows because `tensorObj G` is a left adjoint. -/
theorem GabrielPopescu.preservesFiniteLimits (G : C) (hG : IsSeparator G) :
PreservesFiniteLimits (tensorObj G) := by
have := preservesInjectiveObjects G hG
have : (tensorObj G).PreservesMonomorphisms :=
(tensorObj G).preservesMonomorphisms_of_adjunction_of_preservesInjectiveObjects
(tensorObjPreadditiveCoyonedaObjAdjunction G)
have : PreservesBinaryBiproducts (tensorObj G) :=
preservesBinaryBiproducts_of_preservesBinaryCoproducts _
have : (tensorObj G).Additive := Functor.additive_of_preservesBinaryBiproducts _
have : (tensorObj G).PreservesHomology :=
(tensorObj G).preservesHomology_of_preservesMonos_and_cokernels
exact (tensorObj G).preservesFiniteLimits_of_preservesHomology
end CategoryTheory.IsGrothendieckAbelian |
.lake/packages/mathlib/Mathlib/CategoryTheory/Abelian/GrothendieckAxioms/Indization.lean | import Mathlib.CategoryTheory.Abelian.GrothendieckAxioms.FunctorCategory
import Mathlib.CategoryTheory.Abelian.GrothendieckAxioms.Types
import Mathlib.CategoryTheory.Abelian.Indization
import Mathlib.CategoryTheory.Limits.Indization.Category
import Mathlib.CategoryTheory.Generator.Indization
import Mathlib.CategoryTheory.Abelian.GrothendieckCategory.Basic
/-!
# AB axioms in the category of ind-objects
We show that `Ind C` satisfies Grothendieck's axiom AB5 if `C` has finite limits and deduce that
`Ind C` is Grothendieck abelian if `C` is small and abelian.
-/
universe v u
namespace CategoryTheory.Limits
section
variable {C : Type u} [Category.{v} C]
instance {J : Type v} [SmallCategory J] [IsFiltered J] [HasFiniteLimits C] :
HasExactColimitsOfShape J (Ind C) :=
HasExactColimitsOfShape.domain_of_functor J (Ind.inclusion C)
instance [HasFiniteLimits C] : AB5 (Ind C) where
ofShape _ _ _ := inferInstance
end
section
variable {C : Type u} [SmallCategory C] [Abelian C]
instance isGrothendieckAbelian_ind : IsGrothendieckAbelian.{u} (Ind C) where
hasSeparator := ⟨⟨_, Ind.isSeparator_range_yoneda⟩⟩
end
end CategoryTheory.Limits |
.lake/packages/mathlib/Mathlib/CategoryTheory/Abelian/GrothendieckAxioms/Basic.lean | import Mathlib.Algebra.Homology.ShortComplex.ExactFunctor
import Mathlib.CategoryTheory.Abelian.FunctorCategory
import Mathlib.CategoryTheory.Limits.Constructions.Filtered
import Mathlib.CategoryTheory.Limits.Preserves.FunctorCategory
import Mathlib.CategoryTheory.Limits.Shapes.Countable
import Mathlib.Logic.Equiv.List
/-!
# Grothendieck Axioms
This file defines some of the Grothendieck Axioms for abelian categories, and proves
basic facts about them.
## Definitions
- `HasExactColimitsOfShape J C` -- colimits of shape `J` in `C` are exact.
- The dual of the above definitions, called `HasExactLimitsOfShape`.
- `AB4` -- coproducts are exact (this is formulated in terms of `HasExactColimitsOfShape`).
- `AB5` -- filtered colimits are exact (this is formulated in terms of `HasExactColimitsOfShape`).
## Theorems
- The implication from `AB5` to `AB4` is established in `AB4.ofAB5`.
- That `HasExactColimitsOfShape J C` is invariant under equivalences in both parameters is shown
in `HasExactColimitsOfShape.of_domain_equivalence` and
`HasExactColimitsOfShape.of_codomain_equivalence`.
## Remarks
For `AB4` and `AB5`, we only require left exactness as right exactness is automatic.
A comparison with Grothendieck's original formulation of the properties can be found in the
comments of the linked Stacks page.
Exactness as the preservation of short exact sequences is introduced in
`CategoryTheory.Abelian.Exact`.
We do not require `Abelian` in the definition of `AB4` and `AB5` because these classes represent
individual axioms. An `AB4` category is an _abelian_ category satisfying `AB4`, and similarly for
`AB5`.
## References
* [Stacks: Grothendieck's AB conditions](https://stacks.math.columbia.edu/tag/079A)
-/
namespace CategoryTheory
open Limits Functor
attribute [instance] comp_preservesFiniteLimits comp_preservesFiniteColimits
universe w w' w₂ w₂' v v' v'' u u' u''
variable (C : Type u) [Category.{v} C]
/--
A category `C` is said to have exact colimits of shape `J` provided that colimits of shape `J`
exist and are exact (in the sense that they preserve finite limits).
-/
class HasExactColimitsOfShape (J : Type u') [Category.{v'} J] (C : Type u) [Category.{v} C]
[HasColimitsOfShape J C] where
/-- Exactness of `J`-shaped colimits stated as `colim : (J ⥤ C) ⥤ C` preserving finite limits. -/
preservesFiniteLimits : PreservesFiniteLimits (colim (J := J) (C := C))
/--
A category `C` is said to have exact limits of shape `J` provided that limits of shape `J`
exist and are exact (in the sense that they preserve finite colimits).
-/
class HasExactLimitsOfShape (J : Type u') [Category.{v'} J] (C : Type u) [Category.{v} C]
[HasLimitsOfShape J C] where
/-- Exactness of `J`-shaped limits stated as `lim : (J ⥤ C) ⥤ C` preserving finite colimits. -/
preservesFiniteColimits : PreservesFiniteColimits (lim (J := J) (C := C))
attribute [instance] HasExactColimitsOfShape.preservesFiniteLimits
HasExactLimitsOfShape.preservesFiniteColimits
variable {C} in
/--
Pull back a `HasExactColimitsOfShape J` along a functor which preserves and reflects finite limits
and preserves colimits of shape `J`
-/
lemma HasExactColimitsOfShape.domain_of_functor {D : Type*} (J : Type*) [Category J] [Category D]
[HasColimitsOfShape J C] [HasColimitsOfShape J D] [HasExactColimitsOfShape J D]
(F : C ⥤ D) [PreservesFiniteLimits F] [ReflectsFiniteLimits F] [HasFiniteLimits C]
[PreservesColimitsOfShape J F] : HasExactColimitsOfShape J C where
preservesFiniteLimits := { preservesFiniteLimits I := { preservesLimit {G} := {
preserves {c} hc := by
constructor
apply isLimitOfReflects F
refine (IsLimit.equivOfNatIsoOfIso (isoWhiskerLeft G (preservesColimitNatIso F).symm)
((_ ⋙ colim).mapCone c) _ ?_) (isLimitOfPreserves _ hc)
exact Cones.ext ((preservesColimitNatIso F).symm.app _)
fun i ↦ (preservesColimitNatIso F).inv.naturality _ } } }
variable {C} in
/--
Pull back a `HasExactLimitsOfShape J` along a functor which preserves and reflects finite colimits
and preserves limits of shape `J`
-/
lemma HasExactLimitsOfShape.domain_of_functor {D : Type*} (J : Type*) [Category D] [Category J]
[HasLimitsOfShape J C] [HasLimitsOfShape J D] [HasExactLimitsOfShape J D]
(F : C ⥤ D) [PreservesFiniteColimits F] [ReflectsFiniteColimits F] [HasFiniteColimits C]
[PreservesLimitsOfShape J F] : HasExactLimitsOfShape J C where
preservesFiniteColimits := { preservesFiniteColimits I := { preservesColimit {G} := {
preserves {c} hc := by
constructor
apply isColimitOfReflects F
refine (IsColimit.equivOfNatIsoOfIso (isoWhiskerLeft G (preservesLimitNatIso F).symm)
((_ ⋙ lim).mapCocone c) _ ?_) (isColimitOfPreserves _ hc)
refine Cocones.ext ((preservesLimitNatIso F).symm.app _) fun i ↦ ?_
simp only [Functor.comp_obj, lim_obj, Functor.mapCocone_pt, isoWhiskerLeft_inv, Iso.symm_inv,
Cocones.precompose_obj_pt, whiskeringRight_obj_obj, Functor.const_obj_obj,
Cocones.precompose_obj_ι, NatTrans.comp_app, whiskerLeft_app, preservesLimitNatIso_hom_app,
Functor.mapCocone_ι_app, Functor.comp_map, whiskeringRight_obj_map, lim_map, Iso.app_hom,
Iso.symm_hom, preservesLimitNatIso_inv_app, Category.assoc]
rw [← Iso.eq_inv_comp]
exact (preservesLimitNatIso F).inv.naturality _ } } }
/--
Transport a `HasExactColimitsOfShape` along an equivalence of the shape.
Note: When `C` has finite limits, this lemma holds with the equivalence replaced by a final
functor, see `hasExactColimitsOfShape_of_final` below.
-/
lemma HasExactColimitsOfShape.of_domain_equivalence {J J' : Type*} [Category J] [Category J']
(e : J ≌ J') [HasColimitsOfShape J C] [HasExactColimitsOfShape J C] :
haveI : HasColimitsOfShape J' C := hasColimitsOfShape_of_equivalence e
HasExactColimitsOfShape J' C :=
haveI : HasColimitsOfShape J' C := hasColimitsOfShape_of_equivalence e
⟨preservesFiniteLimits_of_natIso (Functor.Final.colimIso e.functor)⟩
variable {C} in
lemma HasExactColimitsOfShape.of_codomain_equivalence (J : Type*) [Category J] {D : Type*}
[Category D] (e : C ≌ D) [HasColimitsOfShape J C] [HasExactColimitsOfShape J C] :
haveI : HasColimitsOfShape J D := Adjunction.hasColimitsOfShape_of_equivalence e.inverse
HasExactColimitsOfShape J D := by
haveI : HasColimitsOfShape J D := Adjunction.hasColimitsOfShape_of_equivalence e.inverse
refine ⟨⟨fun _ _ _ => ⟨@fun K => ?_⟩⟩⟩
refine preservesLimit_of_natIso K (?_ : e.congrRight.inverse ⋙ colim ⋙ e.functor ≅ colim)
apply e.symm.congrRight.fullyFaithfulFunctor.preimageIso
exact isoWhiskerLeft (_ ⋙ colim) e.unitIso.symm ≪≫ (preservesColimitNatIso e.inverse).symm
/--
Transport a `HasExactLimitsOfShape` along an equivalence of the shape.
Note: When `C` has finite colimits, this lemma holds with the equivalence replaced by a initial
functor, see `hasExactLimitsOfShape_of_initial` below.
-/
lemma HasExactLimitsOfShape.of_domain_equivalence {J J' : Type*} [Category J] [Category J']
(e : J ≌ J') [HasLimitsOfShape J C] [HasExactLimitsOfShape J C] :
haveI : HasLimitsOfShape J' C := hasLimitsOfShape_of_equivalence e
HasExactLimitsOfShape J' C :=
haveI : HasLimitsOfShape J' C := hasLimitsOfShape_of_equivalence e
⟨preservesFiniteColimits_of_natIso (Functor.Initial.limIso e.functor)⟩
variable {C} in
lemma HasExactLimitsOfShape.of_codomain_equivalence (J : Type*) [Category J] {D : Type*}
[Category D] (e : C ≌ D) [HasLimitsOfShape J C] [HasExactLimitsOfShape J C] :
haveI : HasLimitsOfShape J D := Adjunction.hasLimitsOfShape_of_equivalence e.inverse
HasExactLimitsOfShape J D := by
haveI : HasLimitsOfShape J D := Adjunction.hasLimitsOfShape_of_equivalence e.inverse
refine ⟨⟨fun _ _ _ => ⟨@fun K => ?_⟩⟩⟩
refine preservesColimit_of_natIso K (?_ : e.congrRight.inverse ⋙ lim ⋙ e.functor ≅ lim)
apply e.symm.congrRight.fullyFaithfulFunctor.preimageIso
exact isoWhiskerLeft (_ ⋙ lim) e.unitIso.symm ≪≫ (preservesLimitNatIso e.inverse).symm
namespace Adjunction
variable {C} {D : Type u''} [Category.{v''} D] {F : C ⥤ D} {G : D ⥤ C}
/-- Let `adj : F ⊣ G` be an adjunction, with `G : D ⥤ C` reflective.
Assume that `D` has finite limits and `F` commutes to them.
If `C` has exact colimits of shape `J`, then `D` also has exact colimits of shape `J`. -/
lemma hasExactColimitsOfShape (adj : F ⊣ G) [G.Full] [G.Faithful]
(J : Type u') [Category.{v'} J] [HasColimitsOfShape J C] [HasColimitsOfShape J D]
[HasExactColimitsOfShape J C] [HasFiniteLimits D] [PreservesFiniteLimits F] :
HasExactColimitsOfShape J D where
preservesFiniteLimits := ⟨fun K _ _ ↦ ⟨fun {H} ↦ by
have : PreservesLimitsOfSize.{0, 0} G := adj.rightAdjoint_preservesLimits
have : PreservesColimitsOfSize.{v', u'} F := adj.leftAdjoint_preservesColimits
let e : (whiskeringRight J D C).obj G ⋙ colim ⋙ F ≅ colim :=
isoWhiskerLeft _ (preservesColimitNatIso F) ≪≫ (Functor.associator _ _ _).symm ≪≫
isoWhiskerRight (whiskeringRightObjCompIso G F) _ ≪≫
isoWhiskerRight ((whiskeringRight J D D).mapIso (asIso adj.counit)) _ ≪≫
isoWhiskerRight whiskeringRightObjIdIso _ ≪≫ colim.leftUnitor
exact preservesLimit_of_natIso _ e⟩⟩
/-- Let `adj : F ⊣ G` be an adjunction, with `F : C ⥤ D` coreflective.
Assume that `C` has finite colimits and `G` commutes to them.
If `D` has exact limits of shape `J`, then `C` also has exact limits of shape `J`. -/
lemma hasExactLimitsOfShape (adj : F ⊣ G) [F.Full] [F.Faithful]
(J : Type u') [Category.{v'} J] [HasLimitsOfShape J C] [HasLimitsOfShape J D]
[HasExactLimitsOfShape J D] [HasFiniteColimits C] [PreservesFiniteColimits G] :
HasExactLimitsOfShape J C where
preservesFiniteColimits:= ⟨fun K _ _ ↦ ⟨fun {H} ↦ by
have : PreservesLimitsOfSize.{v', u'} G := adj.rightAdjoint_preservesLimits
have : PreservesColimitsOfSize.{0, 0} F := adj.leftAdjoint_preservesColimits
let e : (whiskeringRight J _ _).obj F ⋙ lim ⋙ G ≅ lim :=
isoWhiskerLeft _ (preservesLimitNatIso G) ≪≫
(Functor.associator _ _ _).symm ≪≫
isoWhiskerRight (whiskeringRightObjCompIso F G) _ ≪≫
isoWhiskerRight ((whiskeringRight J C C).mapIso (asIso adj.unit).symm) _ ≪≫
isoWhiskerRight whiskeringRightObjIdIso _ ≪≫ lim.leftUnitor
exact preservesColimit_of_natIso _ e⟩⟩
end Adjunction
/--
A category `C` which has coproducts is said to have `AB4` of size `w` provided that
coproducts of size `w` are exact.
-/
@[pp_with_univ]
class AB4OfSize [HasCoproducts.{w} C] where
ofShape (α : Type w) : HasExactColimitsOfShape (Discrete α) C
attribute [instance] AB4OfSize.ofShape
/--
A category `C` which has coproducts is said to have `AB4` provided that
coproducts are exact.
-/
@[stacks 079B]
abbrev AB4 [HasCoproducts C] := AB4OfSize.{v} C
lemma AB4OfSize_shrink [HasCoproducts.{max w w'} C] [AB4OfSize.{max w w'} C] :
haveI : HasCoproducts.{w} C := hasCoproducts_shrink.{w, w'}
AB4OfSize.{w} C :=
haveI := hasCoproducts_shrink.{w, w'} (C := C)
⟨fun J ↦ HasExactColimitsOfShape.of_domain_equivalence C
(Discrete.equivalence Equiv.ulift : Discrete (ULift.{w'} J) ≌ _)⟩
instance (priority := 100) [HasCoproducts.{w} C] [AB4OfSize.{w} C] :
haveI : HasCoproducts.{0} C := hasCoproducts_shrink
AB4OfSize.{0} C := AB4OfSize_shrink C
/-- A category `C` which has products is said to have `AB4Star` (in literature `AB4*`)
provided that products are exact. -/
@[pp_with_univ, stacks 079B]
class AB4StarOfSize [HasProducts.{w} C] where
ofShape (α : Type w) : HasExactLimitsOfShape (Discrete α) C
attribute [instance] AB4StarOfSize.ofShape
/-- A category `C` which has products is said to have `AB4Star` (in literature `AB4*`)
provided that products are exact. -/
abbrev AB4Star [HasProducts C] := AB4StarOfSize.{v} C
lemma AB4StarOfSize_shrink [HasProducts.{max w w'} C] [AB4StarOfSize.{max w w'} C] :
haveI : HasProducts.{w} C := hasProducts_shrink.{w, w'}
AB4StarOfSize.{w} C :=
haveI := hasProducts_shrink.{w, w'} (C := C)
⟨fun J ↦ HasExactLimitsOfShape.of_domain_equivalence C
(Discrete.equivalence Equiv.ulift : Discrete (ULift.{w'} J) ≌ _)⟩
instance (priority := 100) [HasProducts.{w} C] [AB4StarOfSize.{w} C] :
haveI : HasProducts.{0} C := hasProducts_shrink
AB4StarOfSize.{0} C := AB4StarOfSize_shrink C
/--
A category `C` which has countable coproducts is said to have countable `AB4` provided that
countable coproducts are exact.
-/
class CountableAB4 [HasCountableCoproducts C] where
ofShape (α : Type) [Countable α] : HasExactColimitsOfShape (Discrete α) C
instance (priority := 100) [HasCoproducts.{0} C] [AB4OfSize.{0} C] : CountableAB4 C :=
⟨inferInstance⟩
/--
A category `C` which has countable coproducts is said to have countable `AB4Star` provided that
countable products are exact.
-/
class CountableAB4Star [HasCountableProducts C] where
ofShape (α : Type) [Countable α] : HasExactLimitsOfShape (Discrete α) C
instance (priority := 100) [HasProducts.{0} C] [AB4StarOfSize.{0} C] : CountableAB4Star C :=
⟨inferInstance⟩
attribute [instance] CountableAB4.ofShape CountableAB4Star.ofShape
/--
A category `C` which has filtered colimits of a given size is said to have `AB5` of that size
provided that these filtered colimits are exact.
`AB5OfSize.{w, w'} C` means that `C` has exact colimits of shape `J : Type w'` with
`Category.{w} J` such that `J` is filtered.
-/
@[pp_with_univ]
class AB5OfSize [HasFilteredColimitsOfSize.{w, w'} C] where
ofShape (J : Type w') [Category.{w} J] [IsFiltered J] : HasExactColimitsOfShape J C
attribute [instance] AB5OfSize.ofShape
/--
A category `C` which has filtered colimits is said to have `AB5` provided that
filtered colimits are exact.
-/
@[stacks 079B]
abbrev AB5 [HasFilteredColimits C] := AB5OfSize.{v, v} C
lemma AB5OfSize_of_univLE [HasFilteredColimitsOfSize.{w₂, w₂'} C] [UnivLE.{w, w₂}]
[UnivLE.{w', w₂'}] [AB5OfSize.{w₂, w₂'} C] :
haveI : HasFilteredColimitsOfSize.{w, w'} C := hasFilteredColimitsOfSize_of_univLE.{w}
AB5OfSize.{w, w'} C := by
haveI : HasFilteredColimitsOfSize.{w, w'} C := hasFilteredColimitsOfSize_of_univLE.{w}
constructor
intro J _ _
haveI := IsFiltered.of_equivalence ((ShrinkHoms.equivalence.{w₂} J).trans <|
Shrink.equivalence.{w₂', w₂} (ShrinkHoms.{w'} J))
exact HasExactColimitsOfShape.of_domain_equivalence _ ((ShrinkHoms.equivalence.{w₂} J).trans <|
Shrink.equivalence.{w₂', w₂} (ShrinkHoms.{w'} J)).symm
lemma AB5OfSize_shrink [HasFilteredColimitsOfSize.{max w w₂, max w' w₂'} C]
[AB5OfSize.{max w w₂, max w' w₂'} C] :
haveI : HasFilteredColimitsOfSize.{w, w'} C := hasFilteredColimitsOfSize_shrink
AB5OfSize.{w, w'} C :=
AB5OfSize_of_univLE C
/--
A category `C` which has cofiltered limits is said to have `AB5Star` (in literature `AB5*`)
provided that cofiltered limits are exact.
-/
@[pp_with_univ, stacks 079B]
class AB5StarOfSize [HasCofilteredLimitsOfSize.{w, w'} C] where
ofShape (J : Type w') [Category.{w} J] [IsCofiltered J] : HasExactLimitsOfShape J C
attribute [instance] AB5StarOfSize.ofShape
/--
A category `C` which has cofiltered limits is said to have `AB5Star` (in literature `AB5*`)
provided that cofiltered limits are exact.
-/
abbrev AB5Star [HasCofilteredLimits C] := AB5StarOfSize.{v, v} C
lemma AB5StarOfSize_of_univLE [HasCofilteredLimitsOfSize.{w₂, w₂'} C] [UnivLE.{w, w₂}]
[UnivLE.{w', w₂'}] [AB5StarOfSize.{w₂, w₂'} C] :
haveI : HasCofilteredLimitsOfSize.{w, w'} C := hasCofilteredLimitsOfSize_of_univLE.{w}
AB5StarOfSize.{w, w'} C := by
haveI : HasCofilteredLimitsOfSize.{w, w'} C := hasCofilteredLimitsOfSize_of_univLE.{w}
constructor
intro J _ _
haveI := IsCofiltered.of_equivalence ((ShrinkHoms.equivalence.{w₂} J).trans <|
Shrink.equivalence.{w₂', w₂} (ShrinkHoms.{w'} J))
exact HasExactLimitsOfShape.of_domain_equivalence _ ((ShrinkHoms.equivalence.{w₂} J).trans <|
Shrink.equivalence.{w₂', w₂} (ShrinkHoms.{w'} J)).symm
lemma AB5StarOfSize_shrink [HasCofilteredLimitsOfSize.{max w w₂, max w' w₂'} C]
[AB5StarOfSize.{max w w₂, max w' w₂'} C] :
haveI : HasCofilteredLimitsOfSize.{w, w'} C := hasCofilteredLimitsOfSize_shrink
AB5StarOfSize.{w, w'} C :=
AB5StarOfSize_of_univLE C
/-- `HasExactColimitsOfShape` can be "pushed forward" along final functors -/
lemma hasExactColimitsOfShape_of_final [HasFiniteLimits C] {J J' : Type*} [Category J] [Category J']
(F : J ⥤ J') [F.Final] [HasColimitsOfShape J' C] [HasColimitsOfShape J C]
[HasExactColimitsOfShape J C] : HasExactColimitsOfShape J' C where
preservesFiniteLimits :=
letI : PreservesFiniteLimits ((whiskeringLeft J J' C).obj F) := ⟨fun _ ↦ inferInstance⟩
letI := comp_preservesFiniteLimits ((whiskeringLeft J J' C).obj F) colim
preservesFiniteLimits_of_natIso (Functor.Final.colimIso F)
/-- `HasExactLimitsOfShape` can be "pushed forward" along initial functors -/
lemma hasExactLimitsOfShape_of_initial [HasFiniteColimits C] {J J' : Type*} [Category J]
[Category J'] (F : J ⥤ J') [F.Initial] [HasLimitsOfShape J' C] [HasLimitsOfShape J C]
[HasExactLimitsOfShape J C] : HasExactLimitsOfShape J' C where
preservesFiniteColimits :=
letI : PreservesFiniteColimits ((whiskeringLeft J J' C).obj F) := ⟨fun _ ↦ inferInstance⟩
letI := comp_preservesFiniteColimits ((whiskeringLeft J J' C).obj F) lim
preservesFiniteColimits_of_natIso (Functor.Initial.limIso F)
section AB4OfAB5
variable {α : Type w} [HasZeroMorphisms C] [HasFiniteBiproducts C] [HasFiniteLimits C]
open CoproductsFromFiniteFiltered
instance preservesFiniteLimits_liftToFinset : PreservesFiniteLimits (liftToFinset C α) :=
preservesFiniteLimits_of_evaluation _ fun I =>
letI : PreservesFiniteLimits (colim (J := Discrete I) (C := C)) :=
preservesFiniteLimits_of_natIso HasBiproductsOfShape.colimIsoLim.symm
letI : PreservesFiniteLimits ((whiskeringLeft (Discrete I) (Discrete α) C).obj
(Discrete.functor fun x ↦ ↑x)) :=
⟨fun J _ _ => whiskeringLeft_preservesLimitsOfShape J _⟩
letI : PreservesFiniteLimits ((whiskeringLeft (Discrete I) (Discrete α) C).obj
(Discrete.functor (·.val)) ⋙ colim) :=
comp_preservesFiniteLimits _ _
preservesFiniteLimits_of_natIso (liftToFinsetEvaluationIso I).symm
variable (J : Type*)
/--
`HasExactColimitsOfShape (Finset (Discrete J)) C` implies `HasExactColimitsOfShape (Discrete J) C`
-/
lemma hasExactColimitsOfShape_discrete_of_hasExactColimitsOfShape_finset_discrete
[HasColimitsOfShape (Discrete J) C] [HasColimitsOfShape (Finset (Discrete J)) C]
[HasExactColimitsOfShape (Finset (Discrete J)) C] : HasExactColimitsOfShape (Discrete J) C where
preservesFiniteLimits :=
letI : PreservesFiniteLimits (liftToFinset C J ⋙ colim) :=
comp_preservesFiniteLimits _ _
preservesFiniteLimits_of_natIso (liftToFinsetColimIso)
attribute [local instance] hasCoproducts_of_finite_and_filtered in
/-- A category with finite biproducts and finite limits is AB4 if it is AB5. -/
lemma AB4.of_AB5 [HasFilteredColimitsOfSize.{w, w} C]
[AB5OfSize.{w, w} C] : AB4OfSize.{w} C where
ofShape _ := hasExactColimitsOfShape_discrete_of_hasExactColimitsOfShape_finset_discrete _ _
/--
A category with finite biproducts and finite limits has countable AB4 if sequential colimits are
exact.
-/
lemma CountableAB4.of_countableAB5 [HasColimitsOfShape ℕ C] [HasExactColimitsOfShape ℕ C]
[HasCountableCoproducts C] : CountableAB4 C where
ofShape J :=
have : HasColimitsOfShape (Finset (Discrete J)) C :=
Functor.Final.hasColimitsOfShape_of_final
(IsFiltered.sequentialFunctor (Finset (Discrete J)))
have := hasExactColimitsOfShape_of_final C (IsFiltered.sequentialFunctor (Finset (Discrete J)))
hasExactColimitsOfShape_discrete_of_hasExactColimitsOfShape_finset_discrete _ _
end AB4OfAB5
section AB4StarOfAB5Star
variable {α : Type w} [HasZeroMorphisms C] [HasFiniteBiproducts C] [HasFiniteColimits C]
open ProductsFromFiniteCofiltered
instance preservesFiniteColimits_liftToFinset : PreservesFiniteColimits (liftToFinset C α) :=
preservesFiniteColimits_of_evaluation _ fun ⟨I⟩ =>
letI : PreservesFiniteColimits (lim (J := Discrete I) (C := C)) :=
preservesFiniteColimits_of_natIso HasBiproductsOfShape.colimIsoLim
letI : PreservesFiniteColimits ((whiskeringLeft (Discrete I) (Discrete α) C).obj
(Discrete.functor fun x ↦ ↑x)) := ⟨fun _ _ _ => inferInstance⟩
letI : PreservesFiniteColimits ((whiskeringLeft (Discrete I) (Discrete α) C).obj
(Discrete.functor (·.val)) ⋙ lim) :=
comp_preservesFiniteColimits _ _
preservesFiniteColimits_of_natIso (liftToFinsetEvaluationIso _ _ I).symm
variable (J : Type*)
/--
`HasExactLimitsOfShape (Finset (Discrete J))ᵒᵖ C` implies `HasExactLimitsOfShape (Discrete J) C`
-/
lemma hasExactLimitsOfShape_discrete_of_hasExactLimitsOfShape_finset_discrete_op
[HasLimitsOfShape (Discrete J) C] [HasLimitsOfShape (Finset (Discrete J))ᵒᵖ C]
[HasExactLimitsOfShape (Finset (Discrete J))ᵒᵖ C] :
HasExactLimitsOfShape (Discrete J) C where
preservesFiniteColimits :=
letI : PreservesFiniteColimits (ProductsFromFiniteCofiltered.liftToFinset C J ⋙ lim) :=
comp_preservesFiniteColimits _ _
preservesFiniteColimits_of_natIso (ProductsFromFiniteCofiltered.liftToFinsetLimIso _ _)
attribute [local instance] hasProducts_of_finite_and_cofiltered in
/-- A category with finite biproducts and finite limits is AB4 if it is AB5. -/
lemma AB4Star.of_AB5Star [HasCofilteredLimitsOfSize.{w, w} C] [AB5StarOfSize.{w, w} C] :
AB4StarOfSize.{w} C where
ofShape _ := hasExactLimitsOfShape_discrete_of_hasExactLimitsOfShape_finset_discrete_op _ _
/--
A category with finite biproducts and finite limits has countable AB4* if sequential limits are
exact.
-/
lemma CountableAB4Star.of_countableAB5Star [HasLimitsOfShape ℕᵒᵖ C] [HasExactLimitsOfShape ℕᵒᵖ C]
[HasCountableProducts C] : CountableAB4Star C where
ofShape J :=
have : HasLimitsOfShape (Finset (Discrete J))ᵒᵖ C :=
Functor.Initial.hasLimitsOfShape_of_initial
(IsFiltered.sequentialFunctor (Finset (Discrete J))).op
have := hasExactLimitsOfShape_of_initial C
(IsFiltered.sequentialFunctor (Finset (Discrete J))).op
hasExactLimitsOfShape_discrete_of_hasExactLimitsOfShape_finset_discrete_op _ _
end AB4StarOfAB5Star
/--
Checking exactness of colimits of shape `Discrete ℕ` and `Discrete J` for finite `J` is enough for
countable AB4.
-/
lemma CountableAB4.of_hasExactColimitsOfShape_nat_and_finite [HasCountableCoproducts C]
[HasFiniteLimits C] [∀ (J : Type) [Finite J], HasExactColimitsOfShape (Discrete J) C]
[HasExactColimitsOfShape (Discrete ℕ) C] :
CountableAB4 C where
ofShape J := by
by_cases h : Finite J
· infer_instance
· have : Infinite J := ⟨h⟩
let _ := Encodable.ofCountable J
let _ := Denumerable.ofEncodableOfInfinite J
exact hasExactColimitsOfShape_of_final C (Discrete.equivalence (Denumerable.eqv J)).inverse
/--
Checking exactness of limits of shape `Discrete ℕ` and `Discrete J` for finite `J` is enough for
countable AB4*.
-/
lemma CountableAB4Star.of_hasExactLimitsOfShape_nat_and_finite [HasCountableProducts C]
[HasFiniteColimits C] [∀ (J : Type) [Finite J], HasExactLimitsOfShape (Discrete J) C]
[HasExactLimitsOfShape (Discrete ℕ) C] :
CountableAB4Star C where
ofShape J := by
by_cases h : Finite J
· infer_instance
· have : Infinite J := ⟨h⟩
let _ := Encodable.ofCountable J
let _ := Denumerable.ofEncodableOfInfinite J
exact hasExactLimitsOfShape_of_initial C (Discrete.equivalence (Denumerable.eqv J)).inverse
section EpiMono
open Functor
section
variable [HasZeroMorphisms C] [HasFiniteBiproducts C]
noncomputable instance hasExactColimitsOfShape_discrete_finite (J : Type*) [Finite J] :
HasExactColimitsOfShape (Discrete J) C where
preservesFiniteLimits := preservesFiniteLimits_of_natIso HasBiproductsOfShape.colimIsoLim.symm
noncomputable instance hasExactLimitsOfShape_discrete_finite {J : Type*} [Finite J] :
HasExactLimitsOfShape (Discrete J) C where
preservesFiniteColimits := preservesFiniteColimits_of_natIso HasBiproductsOfShape.colimIsoLim
/--
Checking AB of shape `Discrete ℕ` is enough for countable AB4, provided that the category has
finite biproducts and finite limits.
-/
lemma CountableAB4.of_hasExactColimitsOfShape_nat [HasFiniteLimits C] [HasCountableCoproducts C]
[HasExactColimitsOfShape (Discrete ℕ) C] : CountableAB4 C := by
apply (config := { allowSynthFailures := true })
CountableAB4.of_hasExactColimitsOfShape_nat_and_finite
exact fun _ ↦ inferInstance
/--
Checking AB* of shape `Discrete ℕ` is enough for countable AB4*, provided that the category has
finite biproducts and finite colimits.
-/
lemma CountableAB4Star.of_hasExactLimitsOfShape_nat [HasFiniteColimits C]
[HasCountableProducts C] [HasExactLimitsOfShape (Discrete ℕ) C] : CountableAB4Star C := by
apply (config := { allowSynthFailures := true })
CountableAB4Star.of_hasExactLimitsOfShape_nat_and_finite
exact fun _ ↦ inferInstance
end
variable [Abelian C] (J : Type u') [Category.{v'} J]
attribute [local instance] preservesBinaryBiproducts_of_preservesBinaryCoproducts
preservesBinaryBiproducts_of_preservesBinaryProducts
/--
If `colim` of shape `J` into an abelian category `C` preserves monomorphisms, then `C` has AB of
shape `J`.
-/
lemma hasExactColimitsOfShape_of_preservesMono [HasColimitsOfShape J C]
[PreservesMonomorphisms (colim (J := J) (C := C))] : HasExactColimitsOfShape J C where
preservesFiniteLimits := by
apply (config := { allowSynthFailures := true }) preservesFiniteLimits_of_preservesHomology
· exact preservesHomology_of_preservesMonos_and_cokernels _
· exact additive_of_preservesBinaryBiproducts _
/--
If `lim` of shape `J` into an abelian category `C` preserves epimorphisms, then `C` has AB* of
shape `J`.
-/
lemma hasExactLimitsOfShape_of_preservesEpi [HasLimitsOfShape J C]
[PreservesEpimorphisms (lim (J := J) (C := C))] : HasExactLimitsOfShape J C where
preservesFiniteColimits := by
apply (config := { allowSynthFailures := true }) preservesFiniteColimits_of_preservesHomology
· exact preservesHomology_of_preservesEpis_and_kernels _
· exact additive_of_preservesBinaryBiproducts _
end EpiMono
end CategoryTheory |
.lake/packages/mathlib/Mathlib/CategoryTheory/Abelian/GrothendieckAxioms/Sheaf.lean | import Mathlib.CategoryTheory.Abelian.GrothendieckAxioms.FunctorCategory
import Mathlib.CategoryTheory.Abelian.GrothendieckCategory.Basic
import Mathlib.CategoryTheory.Generator.Sheaf
import Mathlib.CategoryTheory.Sites.Abelian
import Mathlib.CategoryTheory.Sites.Equivalence
/-!
# AB axioms in sheaf categories
If `J` is a Grothendieck topology on a small category `C : Type v`,
and `A : Type u₁` (with `Category.{v} A`) is a Grothendieck abelian category,
then `Sheaf J A` is a Grothendieck abelian category.
-/
universe v v₁ v₂ u u₁ u₂
namespace CategoryTheory
open Limits
namespace Sheaf
variable {C : Type u} {A : Type u₁} {K : Type u₂}
[Category.{v} C] [Category.{v₁} A] [Category.{v₂} K]
(J : GrothendieckTopology C)
section
/- The two instances in this section apply in very rare situations, as they assume
that the forgetful functor from sheaves to presheaves commutes with certain colimits.
This does apply for sheaves for the extensive topology --- condensed modules over a
ring are examples of such sheaves. -/
variable [HasWeakSheafify J A]
instance [HasFiniteLimits A] [HasColimitsOfShape K A] [HasExactColimitsOfShape K A]
[PreservesColimitsOfShape K (sheafToPresheaf J A)] : HasExactColimitsOfShape K (Sheaf J A) :=
HasExactColimitsOfShape.domain_of_functor K (sheafToPresheaf J A)
instance [HasFiniteColimits A] [HasLimitsOfShape K A] [HasExactLimitsOfShape K A]
[PreservesFiniteColimits (sheafToPresheaf J A)] : HasExactLimitsOfShape K (Sheaf J A) :=
HasExactLimitsOfShape.domain_of_functor K (sheafToPresheaf J A)
end
instance hasFilteredColimitsOfSize
[HasSheafify J A] [HasFilteredColimitsOfSize.{v₂, u₂} A] :
HasFilteredColimitsOfSize.{v₂, u₂} (Sheaf J A) where
HasColimitsOfShape K := by infer_instance
instance hasExactColimitsOfShape [HasFiniteLimits A] [HasSheafify J A]
[HasColimitsOfShape K A] [HasExactColimitsOfShape K A] :
HasExactColimitsOfShape K (Sheaf J A) :=
(sheafificationAdjunction J A).hasExactColimitsOfShape K
instance ab5ofSize [HasFiniteLimits A] [HasSheafify J A]
[HasFilteredColimitsOfSize.{v₂, u₂} A] [AB5OfSize.{v₂, u₂} A] :
AB5OfSize.{v₂, u₂} (Sheaf J A) where
ofShape K _ _ := by infer_instance
instance {C : Type v} [SmallCategory.{v} C] (J : GrothendieckTopology C)
(A : Type u₁) [Category.{v} A] [Abelian A] [IsGrothendieckAbelian.{v} A]
[HasSheafify J A] : IsGrothendieckAbelian.{v} (Sheaf J A) where
attribute [local instance] hasSheafifyEssentiallySmallSite in
lemma isGrothendieckAbelian_of_essentiallySmall
{C : Type u₂} [Category.{v} C] [EssentiallySmall.{v} C]
(J : GrothendieckTopology C)
(A : Type u₁) [Category.{v} A] [Abelian A] [IsGrothendieckAbelian.{v} A]
[HasSheafify ((equivSmallModel C).inverse.inducedTopology J) A] :
IsGrothendieckAbelian.{v} (Sheaf J A) :=
IsGrothendieckAbelian.of_equivalence
((equivSmallModel C).inverse.sheafInducedTopologyEquivOfIsCoverDense J A)
end Sheaf
end CategoryTheory |
.lake/packages/mathlib/Mathlib/CategoryTheory/Abelian/GrothendieckAxioms/Connected.lean | import Mathlib.CategoryTheory.Abelian.GrothendieckAxioms.Basic
import Mathlib.CategoryTheory.Limits.Connected
import Mathlib.CategoryTheory.Limits.Shapes.Pullback.CommSq
import Mathlib.CategoryTheory.Limits.FunctorCategory.Shapes.Pullbacks
/-!
# Pulling back connected colimits
If `c` is a cocone over a functor `J ⥤ C` and `f : X ⟶ c.pt`, then for every `j : J` we can take
the pullback of `c.ι.app j` and `f`. This gives a new cocone with cone point `X`. We show that if
`c` is a colimit cocone, then this is again a colimit cocone as long as `J` is connected and `C`
has exact colimits of shape `J`.
From this we deduce a `hom_ext` principle for morphisms factoring through a colimit. Usually, we
only get `hom_ext` for morphisms *from* a colimit, so this is something a bit special.
The connectedness assumption on `J` is necessary: take `C` to be the category of abelian groups,
let `f : ℤ → ℤ ⊕ ℤ` be the diagonal map, and let `g := 𝟙 (ℤ ⊕ ℤ)`. Then the hypotheses of
`IsColimit.pullback_zero_ext` are satisfied, but `f ≫ g` is not zero.
-/
universe w' w v u
namespace CategoryTheory.Limits
variable {J : Type w} [Category.{w'} J] [IsConnected J] {C : Type u} [Category.{v} C]
/--
If `c` is a cocone over a functor `J ⥤ C` and `f : X ⟶ c.pt`, then for every `j : J` we can take
the pullback of `c.ι.app j` and `f`. This gives a new cocone with cone point `X`, and this cocone
is again a colimit cocone as long as `J` is connected and `C` has exact colimits of shape `J`.
-/
noncomputable def IsColimit.pullbackOfHasExactColimitsOfShape [HasPullbacks C]
[HasColimitsOfShape J C] [HasExactColimitsOfShape J C] {F : J ⥤ C} {c : Cocone F}
(hc : IsColimit c) {X : C} (f : X ⟶ c.pt) :
IsColimit (Cocone.mk _ (pullback.snd c.ι ((Functor.const J).map f))) := by
suffices IsIso (colimMap (pullback.snd c.ι ((Functor.const J).map f))) from
Cocone.isColimitOfIsIsoColimMapι _
have hpull := colim.map_isPullback (IsPullback.of_hasPullback c.ι ((Functor.const J).map f))
dsimp only [colim_obj, colim_map] at hpull
have := hc.isIso_colimMap_ι
apply hpull.isIso_snd_of_isIso
/-- Detecting equality of morphisms factoring through a connected colimit by pulling back along
the inclusions of the colimit. -/
theorem IsColimit.pullback_hom_ext [HasPullbacks C] [HasColimitsOfShape J C]
[HasExactColimitsOfShape J C] {F : J ⥤ C} {c : Cocone F} (hc : IsColimit c) {X Y : C}
{f : X ⟶ c.pt} {g h : c.pt ⟶ Y}
(hf : ∀ j, pullback.snd (c.ι.app j) f ≫ f ≫ g = pullback.snd (c.ι.app j) f ≫ f ≫ h) :
f ≫ g = f ≫ h := by
refine (hc.pullbackOfHasExactColimitsOfShape f).hom_ext (fun j => ?_)
rw [← cancel_epi (pullbackObjIso _ _ _).inv]
simpa using hf j
/-- Detecting vanishing of a morphism factoring through a connected colimit by pulling back along
the inclusions of the colimit. -/
theorem IsColimit.pullback_zero_ext [HasZeroMorphisms C] [HasPullbacks C] [HasColimitsOfShape J C]
[HasExactColimitsOfShape J C] {F : J ⥤ C} {c : Cocone F} (hc : IsColimit c) {X Y : C}
{f : X ⟶ c.pt} {g : c.pt ⟶ Y} (hf : ∀ j, pullback.snd (c.ι.app j) f ≫ f ≫ g = 0) :
f ≫ g = 0 := by
suffices f ≫ g = f ≫ 0 by simpa
exact hc.pullback_hom_ext (by simpa using hf)
/--
If `c` is a cone over a functor `J ⥤ C` and `f : c.pt ⟶ X`, then for every `j : J` we can take
the pushout of `c.π.app j` and `f`. This gives a new cone with cone point `X`, and this cone is
again a limit cone as long as `J` is connected and `C` has exact limits of shape `J`.
-/
noncomputable def IsLimit.pushoutOfHasExactLimitsOfShape [HasPushouts C]
[HasLimitsOfShape J C] [HasExactLimitsOfShape J C] {F : J ⥤ C} {c : Cone F}
(hc : IsLimit c) {X : C} (f : c.pt ⟶ X) :
IsLimit (Cone.mk _ (pushout.inr c.π ((Functor.const J).map f))) := by
suffices IsIso (limMap (pushout.inr c.π ((Functor.const J).map f))) from
Cone.isLimitOfIsIsoLimMapπ _
have hpush := lim.map_isPushout (IsPushout.of_hasPushout c.π ((Functor.const J).map f))
dsimp only [lim_obj, lim_map] at hpush
have := hc.isIso_limMap_π
apply hpush.isIso_inr_of_isIso
/-- Detecting equality of morphisms factoring through a connected limit by pushing out along
the projections of the limit. -/
theorem IsLimit.pushout_hom_ext [HasPushouts C] [HasLimitsOfShape J C]
[HasExactLimitsOfShape J C] {F : J ⥤ C} {c : Cone F} (hc : IsLimit c) {X Y : C}
{g h : Y ⟶ c.pt} {f : c.pt ⟶ X}
(hf : ∀ j, g ≫ f ≫ pushout.inr (c.π.app j) f = h ≫ f ≫ pushout.inr (c.π.app j) f) :
g ≫ f = h ≫ f := by
refine (hc.pushoutOfHasExactLimitsOfShape f).hom_ext (fun j => ?_)
rw [← cancel_mono (pushoutObjIso _ _ _).hom]
simpa using hf j
/-- Detecting vanishing of a morphism factoring though a connected limit by pushing out along the
projections of the limit. -/
theorem IsLimit.pushout_zero_ext [HasZeroMorphisms C] [HasPushouts C] [HasLimitsOfShape J C]
[HasExactLimitsOfShape J C] {F : J ⥤ C} {c : Cone F} (hc : IsLimit c) {X Y : C}
{g : Y ⟶ c.pt} {f : c.pt ⟶ X} (hf : ∀ j, g ≫ f ≫ pushout.inr (c.π.app j) f = 0) :
g ≫ f = 0 := by
suffices g ≫ f = 0 ≫ f by simpa
exact hc.pushout_hom_ext (by simpa using hf)
end CategoryTheory.Limits |
.lake/packages/mathlib/Mathlib/CategoryTheory/Abelian/GrothendieckAxioms/Types.lean | import Mathlib.CategoryTheory.Limits.FilteredColimitCommutesFiniteLimit
import Mathlib.CategoryTheory.Abelian.GrothendieckAxioms.Basic
/-!
# The category of types satisfies Grothendieck's AB5 axiom
This is of course just the well-known fact that filtered colimits commute with finite limits in
the category of types.
-/
universe v
namespace CategoryTheory.Limits
instance : AB5 (Type v) where
ofShape _ _ _ := ⟨inferInstance⟩
end CategoryTheory.Limits |
.lake/packages/mathlib/Mathlib/CategoryTheory/Abelian/GrothendieckAxioms/FunctorCategory.lean | import Mathlib.CategoryTheory.Abelian.GrothendieckAxioms.Basic
/-!
# AB axioms in functor categories
This file proves that, when the relevant limits and colimits exist, exactness of limits and
colimits carries over from `A` to the functor category `C ⥤ A`
-/
namespace CategoryTheory
open CategoryTheory Limits Opposite
variable {A C J : Type*} [Category A] [Category C] [Category J]
instance [HasColimitsOfShape J A] [HasExactColimitsOfShape J A] [HasFiniteLimits A] :
HasExactColimitsOfShape J (C ⥤ A) where
preservesFiniteLimits := { preservesFiniteLimits _ := inferInstance }
instance [HasLimitsOfShape J A] [HasExactLimitsOfShape J A] [HasFiniteColimits A] :
HasExactLimitsOfShape J (C ⥤ A) where
preservesFiniteColimits := { preservesFiniteColimits _ := inferInstance }
end CategoryTheory |
.lake/packages/mathlib/Mathlib/CategoryTheory/Abelian/GrothendieckAxioms/Colim.lean | import Mathlib.CategoryTheory.Filtered.Final
import Mathlib.CategoryTheory.Limits.Connected
import Mathlib.CategoryTheory.MorphismProperty.Limits
import Mathlib.CategoryTheory.Abelian.GrothendieckAxioms.Basic
/-!
# Exactness of colimits
In this file, we shall study exactness properties of colimits.
First, we translate the assumption that `colim : (J ⥤ C) ⥤ C`
preserves monomorphisms (resp. preserves epimorphisms, resp. is exact)
into statements involving arbitrary cocones instead of the ones
given by the colimit API. We also show that when an inductive system
involves only monomorphisms, then the "inclusion" morphism
into the colimit is also a monomorphism (assuming `J`
is filtered and `C` satisfies AB5).
-/
universe v' v u' u
namespace CategoryTheory
variable {C : Type u} [Category.{v} C] {J : Type u'} [Category.{v'} J]
namespace Limits
/-- Assume that `colim : (J ⥤ C) ⥤ C` preserves monomorphisms, and
`φ : X₁ ⟶ X₂` is a monomorphism in `J ⥤ C`, then if `f : c₁.pt ⟶ c₂.pt` is a morphism
between the points of colimit cocones for `X₁` and `X₂` in such a way that `f`
identifies to `colim.map φ`, then `f` is a monomorphism. -/
lemma colim.map_mono' [HasColimitsOfShape J C]
[(colim : (J ⥤ C) ⥤ C).PreservesMonomorphisms]
{X₁ X₂ : J ⥤ C} (φ : X₁ ⟶ X₂) [Mono φ]
{c₁ : Cocone X₁} (hc₁ : IsColimit c₁) {c₂ : Cocone X₂} (hc₂ : IsColimit c₂)
(f : c₁.pt ⟶ c₂.pt) (hf : ∀ j, c₁.ι.app j ≫ f = φ.app j ≫ c₂.ι.app j) : Mono f := by
refine ((MorphismProperty.monomorphisms C).arrow_mk_iso_iff ?_).2
(inferInstanceAs (Mono (colim.map φ)))
exact Arrow.isoMk
(IsColimit.coconePointUniqueUpToIso hc₁ (colimit.isColimit _))
(IsColimit.coconePointUniqueUpToIso hc₂ (colimit.isColimit _))
(hc₁.hom_ext (fun j ↦ by
dsimp
rw [IsColimit.comp_coconePointUniqueUpToIso_hom_assoc,
colimit.cocone_ι, ι_colimMap, reassoc_of% (hf j),
IsColimit.comp_coconePointUniqueUpToIso_hom, colimit.cocone_ι]))
/-- Assume that `φ : X₁ ⟶ X₂` is a natural transformation in `J ⥤ C` which
consists of epimorphisms, then if `f : c₁.pt ⟶ c₂.pt` is a morphism
between the points of cocones `c₁` and `c₂` for `X₁` and `X₂`, in such
a way that `c₂` is colimit and `f` is compatible with `φ`, then `f` is an epimorphism. -/
lemma colim.map_epi'
{X₁ X₂ : J ⥤ C} (φ : X₁ ⟶ X₂) [∀ j, Epi (φ.app j)]
(c₁ : Cocone X₁) {c₂ : Cocone X₂} (hc₂ : IsColimit c₂)
(f : c₁.pt ⟶ c₂.pt) (hf : ∀ j, c₁.ι.app j ≫ f = φ.app j ≫ c₂.ι.app j) : Epi f where
left_cancellation {Z} g₁ g₂ h := hc₂.hom_ext (fun j ↦ by
rw [← cancel_epi (φ.app j), ← reassoc_of% hf, h, reassoc_of% hf])
attribute [local instance] IsFiltered.isConnected
/-- Assume that a functor `X : J ⥤ C` maps any morphism to a monomorphism,
that `J` is filtered. Then the "inclusion" map `c.ι.app j₀` of a colimit cocone for `X`
is a monomorphism if `colim : (Under j₀ ⥤ C) ⥤ C` preserves monomorphisms
(e.g. when `C` satisfies AB5). -/
lemma IsColimit.mono_ι_app_of_isFiltered
{X : J ⥤ C} [∀ (j j' : J) (φ : j ⟶ j'), Mono (X.map φ)]
{c : Cocone X} (hc : IsColimit c) [IsFiltered J] (j₀ : J)
[HasColimitsOfShape (Under j₀) C]
[(colim : (Under j₀ ⥤ C) ⥤ C).PreservesMonomorphisms] :
Mono (c.ι.app j₀) := by
let f : (Functor.const _).obj (X.obj j₀) ⟶ Under.forget j₀ ⋙ X :=
{ app j := X.map j.hom
naturality _ _ g := by
dsimp
simp only [Category.id_comp, ← X.map_comp, Under.w] }
have := NatTrans.mono_of_mono_app f
exact colim.map_mono' f (isColimitConstCocone _ _)
((Functor.Final.isColimitWhiskerEquiv _ _).symm hc) (c.ι.app j₀) (by cat_disch)
section
variable [HasColimitsOfShape J C] [HasExactColimitsOfShape J C] [HasZeroMorphisms C]
(S : ShortComplex (J ⥤ C)) (hS : S.Exact)
{c₁ : Cocone S.X₁} (hc₁ : IsColimit c₁) (c₂ : Cocone S.X₂) (hc₂ : IsColimit c₂)
(c₃ : Cocone S.X₃) (hc₃ : IsColimit c₃)
(f : c₁.pt ⟶ c₂.pt) (g : c₂.pt ⟶ c₃.pt)
(hf : ∀ j, c₁.ι.app j ≫ f = S.f.app j ≫ c₂.ι.app j)
(hg : ∀ j, c₂.ι.app j ≫ g = S.g.app j ≫ c₃.ι.app j)
/-- Given `S : ShortComplex (J ⥤ C)` and (colimit) cocones for `S.X₁`, `S.X₂`,
`S.X₃` equipped with suitable data, this is the induced
short complex `c₁.pt ⟶ c₂.pt ⟶ c₃.pt`. -/
@[simps]
def colim.mapShortComplex : ShortComplex C :=
ShortComplex.mk f g (hc₁.hom_ext (fun j ↦ by
dsimp
rw [reassoc_of% (hf j), hg j, comp_zero, ← NatTrans.comp_app_assoc, S.zero,
zero_app, zero_comp]))
variable {S c₂ c₃}
include hc₂ hc₃ hS in
/-- Assuming `HasExactColimitsOfShape J C`, this lemma rephrases the exactness
of the functor `colim : (J ⥤ C) ⥤ C` by saying that if `S : ShortComplex (J ⥤ C)`
is exact, then the short complex obtained by taking the colimits is exact,
where we allow the replacement of the chosen colimit cocones of the
colimit API by arbitrary colimit cocones. -/
lemma colim.exact_mapShortComplex :
(mapShortComplex S hc₁ c₂ c₃ f g hf hg).Exact := by
refine (ShortComplex.exact_iff_of_iso ?_).2 (hS.map colim)
refine ShortComplex.isoMk
(IsColimit.coconePointUniqueUpToIso hc₁ (colimit.isColimit _))
(IsColimit.coconePointUniqueUpToIso hc₂ (colimit.isColimit _))
(IsColimit.coconePointUniqueUpToIso hc₃ (colimit.isColimit _))
(hc₁.hom_ext (fun j ↦ ?_)) (hc₂.hom_ext (fun j ↦ ?_))
· dsimp
rw [IsColimit.comp_coconePointUniqueUpToIso_hom_assoc,
colimit.cocone_ι, ι_colimMap, reassoc_of% (hf j),
IsColimit.comp_coconePointUniqueUpToIso_hom, colimit.cocone_ι]
· dsimp
rw [IsColimit.comp_coconePointUniqueUpToIso_hom_assoc,
colimit.cocone_ι, ι_colimMap, reassoc_of% (hg j),
IsColimit.comp_coconePointUniqueUpToIso_hom, colimit.cocone_ι]
end
end Limits
namespace MorphismProperty
open Limits
open MorphismProperty
variable (J C) in
instance isStableUnderColimitsOfShape_monomorphisms
[HasColimitsOfShape J C] [(colim : (J ⥤ C) ⥤ C).PreservesMonomorphisms] :
(monomorphisms C).IsStableUnderColimitsOfShape J where
condition X₁ X₂ c₁ c₂ hc₁ hc₂ f hf φ hφ := by
have (j : J) : Mono (f.app j) := hf _
have := NatTrans.mono_of_mono_app f
apply colim.map_mono' f hc₁ hc₂ φ (by simp [hφ])
instance [HasCoproducts.{u'} C] [AB4OfSize.{u'} C] :
IsStableUnderCoproducts.{u'} (monomorphisms C) where
instance [HasFilteredColimitsOfSize.{v', u'} C] [AB5OfSize.{v', u'} C] :
IsStableUnderFilteredColimits.{v', u'} (monomorphisms C) where
isStableUnderColimitsOfShape J _ _ := by infer_instance
end MorphismProperty
end CategoryTheory |
.lake/packages/mathlib/Mathlib/CategoryTheory/Abelian/Projective/Basic.lean | import Mathlib.CategoryTheory.Abelian.Exact
import Mathlib.CategoryTheory.Preadditive.Yoneda.Projective
import Mathlib.CategoryTheory.Preadditive.Yoneda.Limits
import Mathlib.Algebra.Category.ModuleCat.EpiMono
import Mathlib.Algebra.Homology.ShortComplex.ExactFunctor
/-!
# Projective objects in abelian categories
In an abelian category, an object `P` is projective iff the functor
`preadditiveCoyonedaObj (op P)` preserves finite colimits.
-/
universe v u
namespace CategoryTheory
open Limits Projective Opposite
variable {C : Type u} [Category.{v} C] [Abelian C]
/-- The preadditive Co-Yoneda functor on `P` preserves homology if `P` is projective. -/
noncomputable instance preservesHomology_preadditiveCoyonedaObj_of_projective
(P : C) [hP : Projective P] :
(preadditiveCoyonedaObj P).PreservesHomology := by
haveI := (projective_iff_preservesEpimorphisms_preadditiveCoyonedaObj P).mp hP
apply Functor.preservesHomology_of_preservesEpis_and_kernels
/-- The preadditive Co-Yoneda functor on `P` preserves finite colimits if `P` is projective. -/
noncomputable instance preservesFiniteColimits_preadditiveCoyonedaObj_of_projective
(P : C) [hP : Projective P] :
PreservesFiniteColimits (preadditiveCoyonedaObj P) := by
apply Functor.preservesFiniteColimits_of_preservesHomology
/-- An object is projective if its preadditive Co-Yoneda functor preserves finite colimits. -/
theorem projective_of_preservesFiniteColimits_preadditiveCoyonedaObj (P : C)
[hP : PreservesFiniteColimits (preadditiveCoyonedaObj P)] : Projective P := by
rw [projective_iff_preservesEpimorphisms_preadditiveCoyonedaObj]
have := Functor.preservesHomologyOfExact (preadditiveCoyonedaObj P)
infer_instance
end CategoryTheory |
.lake/packages/mathlib/Mathlib/CategoryTheory/Abelian/Projective/Dimension.lean | import Mathlib.Algebra.Homology.DerivedCategory.Ext.EnoughProjectives
import Mathlib.CategoryTheory.Abelian.Exact
import Mathlib.Data.ENat.Lattice
/-!
# Projective dimension
In an abelian category `C`, we shall say that `X : C` has projective dimension `< n`
if all `Ext X Y i` vanish when `n ≤ i`. This defines a type class
`HasProjectiveDimensionLT X n`. We also define a type class
`HasProjectiveDimensionLE X n` as an abbreviation for
`HasProjectiveDimensionLT X (n + 1)`.
(Note that the fact that `X` is a zero object is equivalent to the condition
`HasProjectiveDimensionLT X 0`, but this cannot be expressed in terms of
`HasProjectiveDimensionLE`.)
We also define the projective dimension in `WithBot ℕ∞` as `projectiveDimension`,
`projectiveDimension X = ⊥` iff `X` is zero and acts in common sense in the non-negative values.
-/
universe w v u
namespace CategoryTheory
open Abelian Limits ZeroObject
variable {C : Type u} [Category.{v} C] [Abelian C]
/-- An object `X` in an abelian category has projective dimension `< n` if
all `Ext X Y i` vanish when `n ≤ i`. See also `HasProjectiveDimensionLE`.
(Do not use the `subsingleton'` field directly. Use the constructor
`HasProjectiveDimensionLT.mk`, and the lemmas `hasProjectiveDimensionLT_iff` and
`Ext.eq_zero_of_hasProjectiveDimensionLT`.) -/
class HasProjectiveDimensionLT (X : C) (n : ℕ) : Prop where mk' ::
subsingleton' (i : ℕ) (hi : n ≤ i) ⦃Y : C⦄ :
letI := HasExt.standard C
Subsingleton (Ext.{max u v} X Y i)
/-- An object `X` in an abelian category has projective dimension `≤ n` if
all `Ext X Y i` vanish when `n + 1 ≤ i` -/
abbrev HasProjectiveDimensionLE (X : C) (n : ℕ) : Prop :=
HasProjectiveDimensionLT X (n + 1)
namespace HasProjectiveDimensionLT
variable [HasExt.{w} C] (X : C) (n : ℕ)
lemma subsingleton [hX : HasProjectiveDimensionLT X n] (i : ℕ) (hi : n ≤ i) (Y : C) :
Subsingleton (Ext.{w} X Y i) := by
letI := HasExt.standard C
have := hX.subsingleton' i hi
exact Ext.chgUniv.{w, max u v}.symm.subsingleton
variable {X n} in
lemma mk (hX : ∀ (i : ℕ) (_ : n ≤ i) ⦃Y : C⦄, ∀ (e : Ext X Y i), e = 0) :
HasProjectiveDimensionLT X n where
subsingleton' i hi Y := by
have : Subsingleton (Ext X Y i) := ⟨fun e₁ e₂ ↦ by simp only [hX i hi]⟩
letI := HasExt.standard C
exact Ext.chgUniv.{max u v, w}.symm.subsingleton
end HasProjectiveDimensionLT
lemma Abelian.Ext.eq_zero_of_hasProjectiveDimensionLT [HasExt.{w} C]
{X Y : C} {i : ℕ} (e : Ext X Y i) (n : ℕ) [HasProjectiveDimensionLT X n]
(hi : n ≤ i) : e = 0 :=
(HasProjectiveDimensionLT.subsingleton X n i hi Y).elim _ _
section
variable (X : C) (n : ℕ)
lemma hasProjectiveDimensionLT_iff [HasExt.{w} C] :
HasProjectiveDimensionLT X n ↔
∀ (i : ℕ) (_ : n ≤ i) ⦃Y : C⦄, ∀ (e : Ext X Y i), e = 0 :=
⟨fun _ _ hi _ e ↦ e.eq_zero_of_hasProjectiveDimensionLT n hi,
HasProjectiveDimensionLT.mk⟩
variable {X} in
lemma Limits.IsZero.hasProjectiveDimensionLT_zero (hX : IsZero X) :
HasProjectiveDimensionLT X 0 := by
letI := HasExt.standard C
rw [hasProjectiveDimensionLT_iff]
intro i hi Y e
rw [← e.mk₀_id_comp, hX.eq_of_src (𝟙 X) 0, Ext.mk₀_zero, Ext.zero_comp]
instance : HasProjectiveDimensionLT (0 : C) 0 :=
(isZero_zero C).hasProjectiveDimensionLT_zero
lemma isZero_of_hasProjectiveDimensionLT_zero [HasProjectiveDimensionLT X 0] : IsZero X := by
letI := HasExt.standard C
rw [IsZero.iff_id_eq_zero]
apply Ext.homEquiv₀.symm.injective
simpa only [Ext.homEquiv₀_symm_apply, Ext.mk₀_zero]
using Abelian.Ext.eq_zero_of_hasProjectiveDimensionLT _ 0 (by rfl)
lemma hasProjectiveDimensionLT_zero_iff_isZero : HasProjectiveDimensionLT X 0 ↔ IsZero X :=
⟨fun _ ↦ isZero_of_hasProjectiveDimensionLT_zero X, fun h ↦ h.hasProjectiveDimensionLT_zero⟩
lemma hasProjectiveDimensionLT_of_ge (m : ℕ) (h : n ≤ m)
[HasProjectiveDimensionLT X n] :
HasProjectiveDimensionLT X m := by
letI := HasExt.standard C
rw [hasProjectiveDimensionLT_iff]
intro i hi Y e
exact e.eq_zero_of_hasProjectiveDimensionLT n (by cutsat)
instance [HasProjectiveDimensionLT X n] (k : ℕ) :
HasProjectiveDimensionLT X (n + k) :=
hasProjectiveDimensionLT_of_ge X n (n + k) (by cutsat)
instance [HasProjectiveDimensionLT X n] (k : ℕ) :
HasProjectiveDimensionLT X (k + n) :=
hasProjectiveDimensionLT_of_ge X n (k + n) (by cutsat)
instance [HasProjectiveDimensionLT X n] :
HasProjectiveDimensionLT X n.succ :=
inferInstanceAs (HasProjectiveDimensionLT X (n + 1))
instance [Projective X] : HasProjectiveDimensionLT X 1 := by
letI := HasExt.standard C
rw [hasProjectiveDimensionLT_iff]
intro i hi Y e
obtain _ | i := i
· simp at hi
· exact e.eq_zero_of_projective
lemma projective_iff_subsingleton_ext_one [HasExt.{w} C] {X : C} :
Projective X ↔ ∀ ⦃Y : C⦄, Subsingleton (Ext X Y 1) := by
refine ⟨fun h ↦ HasProjectiveDimensionLT.subsingleton X 1 1 (by rfl),
fun h ↦ ⟨fun f g _ ↦ ?_⟩⟩
obtain ⟨φ, hφ⟩ :=
Ext.covariant_sequence_exact₃ _ { exact := ShortComplex.exact_kernel g }
(Ext.mk₀ f) (zero_add 1) (by subsingleton)
obtain ⟨φ, rfl⟩ := Ext.homEquiv₀.symm.surjective φ
exact ⟨φ, Ext.homEquiv₀.symm.injective (by simpa using hφ)⟩
lemma projective_iff_hasProjectiveDimensionLT_one (X : C) :
Projective X ↔ HasProjectiveDimensionLT X 1 := by
letI := HasExt.standard C
exact ⟨fun _ ↦ inferInstance, fun _ ↦ projective_iff_subsingleton_ext_one.2
(HasProjectiveDimensionLT.subsingleton X 1 1 (by rfl))⟩
end
lemma Retract.hasProjectiveDimensionLT {X Y : C} (h : Retract X Y) (n : ℕ)
[HasProjectiveDimensionLT Y n] :
HasProjectiveDimensionLT X n := by
letI := HasExt.standard C
rw [hasProjectiveDimensionLT_iff]
intro i hi T x
rw [← x.mk₀_id_comp, ← h.retract, ← Ext.mk₀_comp_mk₀,
Ext.comp_assoc_of_second_deg_zero,
((Ext.mk₀ h.r).comp x (zero_add i)).eq_zero_of_hasProjectiveDimensionLT n hi,
Ext.comp_zero]
lemma hasProjectiveDimensionLT_of_iso {X X' : C} (e : X ≅ X') (n : ℕ)
[HasProjectiveDimensionLT X n] :
HasProjectiveDimensionLT X' n :=
e.symm.retract.hasProjectiveDimensionLT n
namespace ShortComplex
namespace ShortExact
variable {S : ShortComplex C} (hS : S.ShortExact) (n : ℕ)
include hS
-- In the following lemmas, the parameters `HasProjectiveDimensionLT` are
-- explicit as it is unlikely we may infer them, unless the short complex `S`
-- was declared reducible
lemma hasProjectiveDimensionLT_X₂ (h₁ : HasProjectiveDimensionLT S.X₁ n)
(h₃ : HasProjectiveDimensionLT S.X₃ n) :
HasProjectiveDimensionLT S.X₂ n := by
letI := HasExt.standard C
rw [hasProjectiveDimensionLT_iff]
intro i hi Y x₂
obtain ⟨x₃, rfl⟩ := Ext.contravariant_sequence_exact₂ hS _ x₂
(Ext.eq_zero_of_hasProjectiveDimensionLT _ n hi)
rw [x₃.eq_zero_of_hasProjectiveDimensionLT n hi, Ext.comp_zero]
lemma hasProjectiveDimensionLT_X₃ (h₁ : HasProjectiveDimensionLT S.X₁ n)
(h₂ : HasProjectiveDimensionLT S.X₂ (n + 1)) :
HasProjectiveDimensionLT S.X₃ (n + 1) := by
letI := HasExt.standard C
rw [hasProjectiveDimensionLT_iff]
rintro (_ | i) hi Y x₃
· simp at hi
· obtain ⟨x₁, rfl⟩ := Ext.contravariant_sequence_exact₃ hS _ x₃
(Ext.eq_zero_of_hasProjectiveDimensionLT _ (n + 1) hi) (add_comm _ _)
rw [x₁.eq_zero_of_hasProjectiveDimensionLT n (by cutsat), Ext.comp_zero]
lemma hasProjectiveDimensionLT_X₁ (h₂ : HasProjectiveDimensionLT S.X₂ n)
(h₃ : HasProjectiveDimensionLT S.X₃ (n + 1)) :
HasProjectiveDimensionLT S.X₁ n := by
letI := HasExt.standard C
rw [hasProjectiveDimensionLT_iff]
intro i hi Y x₁
obtain ⟨x₂, rfl⟩ := Ext.contravariant_sequence_exact₁ hS _ x₁ (add_comm _ _)
(Ext.eq_zero_of_hasProjectiveDimensionLT _ (n + 1) (by cutsat))
rw [x₂.eq_zero_of_hasProjectiveDimensionLT n (by cutsat), Ext.comp_zero]
lemma hasProjectiveDimensionLT_X₃_iff (n : ℕ) (h₂ : Projective S.X₂) :
HasProjectiveDimensionLT S.X₃ (n + 2) ↔ HasProjectiveDimensionLT S.X₁ (n + 1) :=
⟨fun _ ↦ hS.hasProjectiveDimensionLT_X₁ (n + 1) inferInstance inferInstance,
fun _ ↦ hS.hasProjectiveDimensionLT_X₃ (n + 1) inferInstance inferInstance⟩
end ShortExact
end ShortComplex
instance (X Y : C) (n : ℕ) [HasProjectiveDimensionLT X n]
[HasProjectiveDimensionLT Y n] :
HasProjectiveDimensionLT (X ⊞ Y) n :=
(ShortComplex.Splitting.ofHasBinaryBiproduct X Y).shortExact.hasProjectiveDimensionLT_X₂ n
(by assumption) (by assumption)
end CategoryTheory
section ProjectiveDimension
namespace CategoryTheory
variable {C : Type u} [Category.{v, u} C] [Abelian C]
/-- The projective dimension of an object in an abelian category. -/
noncomputable def projectiveDimension (X : C) : WithBot ℕ∞ :=
sInf {n : WithBot ℕ∞ | ∀ (i : ℕ), n < i → HasProjectiveDimensionLT X i}
lemma projectiveDimension_eq_of_iso {X Y : C} (e : X ≅ Y) :
projectiveDimension X = projectiveDimension Y := by
simp only [projectiveDimension]
congr! 5
exact ⟨fun h ↦ hasProjectiveDimensionLT_of_iso e _,
fun h ↦ hasProjectiveDimensionLT_of_iso e.symm _⟩
lemma Retract.projectiveDimension_le {X Y : C} (h : Retract X Y) :
projectiveDimension X ≤ projectiveDimension Y :=
sInf_le_sInf_of_subset_insert_top (fun n hn ↦ by
simp only [Set.mem_setOf_eq, not_top_lt, IsEmpty.forall_iff, implies_true,
Set.insert_eq_of_mem] at hn ⊢
intro i hi
have := hn i hi
exact h.hasProjectiveDimensionLT i)
lemma projectiveDimension_lt_iff {X : C} {n : ℕ} :
projectiveDimension X < n ↔ HasProjectiveDimensionLT X n := by
refine ⟨fun h ↦ ?_, fun h ↦ sInf_lt_iff.2 ?_⟩
· have : projectiveDimension X ∈ _ := csInf_mem ⟨⊤, by simp⟩
simp only [Set.mem_setOf_eq] at this
exact this _ h
· obtain _ | n := n
· exact ⟨⊥, fun _ _ ↦ hasProjectiveDimensionLT_of_ge _ 0 _ (by simp), by decide⟩
· exact ⟨n, fun i hi ↦ hasProjectiveDimensionLT_of_ge _ (n + 1) _ (by simpa using hi),
by simp [WithBot.lt_add_one_iff]⟩
lemma projectiveDimension_le_iff (X : C) (n : ℕ) :
projectiveDimension X ≤ n ↔ HasProjectiveDimensionLE X n := by
simp [← projectiveDimension_lt_iff, ← WithBot.lt_add_one_iff]
lemma projectiveDimension_ge_iff (X : C) (n : ℕ) :
n ≤ projectiveDimension X ↔ ¬ HasProjectiveDimensionLT X n := by
rw [← not_iff_not, not_le, not_not, projectiveDimension_lt_iff]
lemma projectiveDimension_eq_bot_iff (X : C) :
projectiveDimension X = ⊥ ↔ Limits.IsZero X := by
rw [← hasProjectiveDimensionLT_zero_iff_isZero, ← projectiveDimension_lt_iff,
Nat.cast_zero, ← WithBot.lt_coe_bot, bot_eq_zero', WithBot.coe_zero]
lemma projectiveDimension_ne_top_iff (X : C) :
projectiveDimension X ≠ ⊤ ↔ ∃ n, HasProjectiveDimensionLE X n := by
generalize hd : projectiveDimension X = d
induction d with
| bot =>
simp only [ne_eq, bot_ne_top, not_false_eq_true, true_iff]
exact ⟨0, by simp [← projectiveDimension_le_iff, hd]⟩
| coe d =>
induction d with
| top =>
by_contra!
simp only [WithBot.coe_top, ne_eq, not_true_eq_false, false_and, true_and, false_or] at this
obtain ⟨n, hn⟩ := this
rw [← projectiveDimension_le_iff, hd, WithBot.coe_top, top_le_iff] at hn
exact ENat.coe_ne_top _ ((WithBot.coe_eq_coe).1 hn)
| coe d =>
simp only [ne_eq, WithBot.coe_eq_top, ENat.coe_ne_top, not_false_eq_true, true_iff]
exact ⟨d, by simpa only [← projectiveDimension_le_iff] using hd.le⟩
end CategoryTheory
end ProjectiveDimension |
.lake/packages/mathlib/Mathlib/CategoryTheory/Abelian/Projective/Resolution.lean | import Mathlib.CategoryTheory.Preadditive.Projective.Resolution
import Mathlib.Algebra.Homology.HomotopyCategory
import Mathlib.Tactic.SuppressCompilation
/-!
# Abelian categories with enough projectives have projective resolutions
## Main results
When the underlying category is abelian:
* `CategoryTheory.ProjectiveResolution.lift`: Given `P : ProjectiveResolution X` and
`Q : ProjectiveResolution Y`, any morphism `X ⟶ Y` admits a lifting to a chain map
`P.complex ⟶ Q.complex`. It is a lifting in the sense that `P.ι` intertwines the lift and
the original morphism, see `CategoryTheory.ProjectiveResolution.lift_commutes`.
* `CategoryTheory.ProjectiveResolution.liftHomotopy`: Any two such descents are homotopic.
* `CategoryTheory.ProjectiveResolution.homotopyEquiv`: Any two projective resolutions of the same
object are homotopy equivalent.
* `CategoryTheory.projectiveResolutions`: If every object admits a projective resolution, we can
construct a functor `projectiveResolutions C : C ⥤ HomotopyCategory C (ComplexShape.down ℕ)`.
* `CategoryTheory.exact_d_f`: `Projective.d f` and `f` are exact.
* `CategoryTheory.ProjectiveResolution.of`: Hence, starting from an epimorphism `P ⟶ X`, where `P`
is projective, we can apply `Projective.d` repeatedly to obtain a projective resolution of `X`.
-/
suppress_compilation
noncomputable section
universe v u
namespace CategoryTheory
variable {C : Type u} [Category.{v} C]
open Category Limits Projective
namespace ProjectiveResolution
section
variable [HasZeroObject C] [HasZeroMorphisms C]
/-- Auxiliary construction for `lift`. -/
def liftFZero {Y Z : C} (f : Y ⟶ Z) (P : ProjectiveResolution Y) (Q : ProjectiveResolution Z) :
P.complex.X 0 ⟶ Q.complex.X 0 :=
Projective.factorThru (P.π.f 0 ≫ f) (Q.π.f 0)
end
section Abelian
variable [Abelian C]
lemma exact₀ {Z : C} (P : ProjectiveResolution Z) :
(ShortComplex.mk _ _ P.complex_d_comp_π_f_zero).Exact :=
ShortComplex.exact_of_g_is_cokernel _ P.isColimitCokernelCofork
/-- Auxiliary construction for `lift`. -/
def liftFOne {Y Z : C} (f : Y ⟶ Z) (P : ProjectiveResolution Y) (Q : ProjectiveResolution Z) :
P.complex.X 1 ⟶ Q.complex.X 1 :=
Q.exact₀.liftFromProjective (P.complex.d 1 0 ≫ liftFZero f P Q) (by simp [liftFZero])
@[simp]
theorem liftFOne_zero_comm {Y Z : C} (f : Y ⟶ Z) (P : ProjectiveResolution Y)
(Q : ProjectiveResolution Z) :
liftFOne f P Q ≫ Q.complex.d 1 0 = P.complex.d 1 0 ≫ liftFZero f P Q := by
apply Q.exact₀.liftFromProjective_comp
/-- Auxiliary construction for `lift`. -/
def liftFSucc {Y Z : C} (P : ProjectiveResolution Y) (Q : ProjectiveResolution Z) (n : ℕ)
(g : P.complex.X n ⟶ Q.complex.X n) (g' : P.complex.X (n + 1) ⟶ Q.complex.X (n + 1))
(w : g' ≫ Q.complex.d (n + 1) n = P.complex.d (n + 1) n ≫ g) :
Σ' g'' : P.complex.X (n + 2) ⟶ Q.complex.X (n + 2),
g'' ≫ Q.complex.d (n + 2) (n + 1) = P.complex.d (n + 2) (n + 1) ≫ g' :=
⟨(Q.exact_succ n).liftFromProjective
(P.complex.d (n + 2) (n + 1) ≫ g') (by simp [w]),
(Q.exact_succ n).liftFromProjective_comp _ _⟩
/-- A morphism in `C` lift to a chain map between projective resolutions. -/
def lift {Y Z : C} (f : Y ⟶ Z) (P : ProjectiveResolution Y) (Q : ProjectiveResolution Z) :
P.complex ⟶ Q.complex :=
ChainComplex.mkHom _ _ (liftFZero f _ _) (liftFOne f _ _) (liftFOne_zero_comm f P Q)
fun n ⟨g, g', w⟩ => ⟨(liftFSucc P Q n g g' w).1, (liftFSucc P Q n g g' w).2⟩
/-- The resolution maps intertwine the lift of a morphism and that morphism. -/
@[reassoc (attr := simp)]
theorem lift_commutes {Y Z : C} (f : Y ⟶ Z) (P : ProjectiveResolution Y)
(Q : ProjectiveResolution Z) : lift f P Q ≫ Q.π = P.π ≫ (ChainComplex.single₀ C).map f := by
ext
simp [lift, liftFZero, liftFOne]
@[reassoc (attr := simp)]
lemma lift_commutes_zero {Y Z : C} (f : Y ⟶ Z)
(P : ProjectiveResolution Y) (Q : ProjectiveResolution Z) :
(lift f P Q).f 0 ≫ Q.π.f 0 = P.π.f 0 ≫ f :=
(HomologicalComplex.congr_hom (lift_commutes f P Q) 0).trans (by simp)
/-- An auxiliary definition for `liftHomotopyZero`. -/
def liftHomotopyZeroZero {Y Z : C} {P : ProjectiveResolution Y} {Q : ProjectiveResolution Z}
(f : P.complex ⟶ Q.complex) (comm : f ≫ Q.π = 0) : P.complex.X 0 ⟶ Q.complex.X 1 :=
Q.exact₀.liftFromProjective (f.f 0) (congr_fun (congr_arg HomologicalComplex.Hom.f comm) 0)
@[reassoc (attr := simp)]
lemma liftHomotopyZeroZero_comp {Y Z : C} {P : ProjectiveResolution Y} {Q : ProjectiveResolution Z}
(f : P.complex ⟶ Q.complex) (comm : f ≫ Q.π = 0) :
liftHomotopyZeroZero f comm ≫ Q.complex.d 1 0 = f.f 0 :=
Q.exact₀.liftFromProjective_comp _ _
/-- An auxiliary definition for `liftHomotopyZero`. -/
def liftHomotopyZeroOne {Y Z : C} {P : ProjectiveResolution Y} {Q : ProjectiveResolution Z}
(f : P.complex ⟶ Q.complex) (comm : f ≫ Q.π = 0) :
P.complex.X 1 ⟶ Q.complex.X 2 :=
(Q.exact_succ 0).liftFromProjective (f.f 1 - P.complex.d 1 0 ≫ liftHomotopyZeroZero f comm)
(by rw [Preadditive.sub_comp, assoc, HomologicalComplex.Hom.comm,
liftHomotopyZeroZero_comp, sub_self])
@[reassoc (attr := simp)]
lemma liftHomotopyZeroOne_comp {Y Z : C} {P : ProjectiveResolution Y} {Q : ProjectiveResolution Z}
(f : P.complex ⟶ Q.complex) (comm : f ≫ Q.π = 0) :
liftHomotopyZeroOne f comm ≫ Q.complex.d 2 1 =
f.f 1 - P.complex.d 1 0 ≫ liftHomotopyZeroZero f comm :=
(Q.exact_succ 0).liftFromProjective_comp _ _
/-- An auxiliary definition for `liftHomotopyZero`. -/
def liftHomotopyZeroSucc {Y Z : C} {P : ProjectiveResolution Y} {Q : ProjectiveResolution Z}
(f : P.complex ⟶ Q.complex) (n : ℕ) (g : P.complex.X n ⟶ Q.complex.X (n + 1))
(g' : P.complex.X (n + 1) ⟶ Q.complex.X (n + 2))
(w : f.f (n + 1) = P.complex.d (n + 1) n ≫ g + g' ≫ Q.complex.d (n + 2) (n + 1)) :
P.complex.X (n + 2) ⟶ Q.complex.X (n + 3) :=
(Q.exact_succ (n + 1)).liftFromProjective (f.f (n + 2) - P.complex.d _ _ ≫ g') (by simp [w])
@[reassoc (attr := simp)]
lemma liftHomotopyZeroSucc_comp {Y Z : C} {P : ProjectiveResolution Y} {Q : ProjectiveResolution Z}
(f : P.complex ⟶ Q.complex) (n : ℕ) (g : P.complex.X n ⟶ Q.complex.X (n + 1))
(g' : P.complex.X (n + 1) ⟶ Q.complex.X (n + 2))
(w : f.f (n + 1) = P.complex.d (n + 1) n ≫ g + g' ≫ Q.complex.d (n + 2) (n + 1)) :
liftHomotopyZeroSucc f n g g' w ≫ Q.complex.d (n + 3) (n + 2) =
f.f (n + 2) - P.complex.d _ _ ≫ g' :=
(Q.exact_succ (n + 1)).liftFromProjective_comp _ _
/-- Any lift of the zero morphism is homotopic to zero. -/
def liftHomotopyZero {Y Z : C} {P : ProjectiveResolution Y} {Q : ProjectiveResolution Z}
(f : P.complex ⟶ Q.complex) (comm : f ≫ Q.π = 0) : Homotopy f 0 :=
Homotopy.mkInductive _ (liftHomotopyZeroZero f comm) (by simp )
(liftHomotopyZeroOne f comm) (by simp) fun n ⟨g, g', w⟩ =>
⟨liftHomotopyZeroSucc f n g g' w, by simp⟩
/-- Two lifts of the same morphism are homotopic. -/
def liftHomotopy {Y Z : C} (f : Y ⟶ Z) {P : ProjectiveResolution Y} {Q : ProjectiveResolution Z}
(g h : P.complex ⟶ Q.complex) (g_comm : g ≫ Q.π = P.π ≫ (ChainComplex.single₀ C).map f)
(h_comm : h ≫ Q.π = P.π ≫ (ChainComplex.single₀ C).map f) : Homotopy g h :=
Homotopy.equivSubZero.invFun (liftHomotopyZero _ (by simp [g_comm, h_comm]))
/-- The lift of the identity morphism is homotopic to the identity chain map. -/
def liftIdHomotopy (X : C) (P : ProjectiveResolution X) :
Homotopy (lift (𝟙 X) P P) (𝟙 P.complex) := by
apply liftHomotopy (𝟙 X) <;> simp
/-- The lift of a composition is homotopic to the composition of the lifts. -/
def liftCompHomotopy {X Y Z : C} (f : X ⟶ Y) (g : Y ⟶ Z) (P : ProjectiveResolution X)
(Q : ProjectiveResolution Y) (R : ProjectiveResolution Z) :
Homotopy (lift (f ≫ g) P R) (lift f P Q ≫ lift g Q R) := by
apply liftHomotopy (f ≫ g) <;> simp
-- We don't care about the actual definitions of these homotopies.
/-- Any two projective resolutions are homotopy equivalent. -/
def homotopyEquiv {X : C} (P Q : ProjectiveResolution X) :
HomotopyEquiv P.complex Q.complex where
hom := lift (𝟙 X) P Q
inv := lift (𝟙 X) Q P
homotopyHomInvId := (liftCompHomotopy (𝟙 X) (𝟙 X) P Q P).symm.trans <| by
simpa [id_comp] using liftIdHomotopy _ _
homotopyInvHomId := (liftCompHomotopy (𝟙 X) (𝟙 X) Q P Q).symm.trans <| by
simpa [id_comp] using liftIdHomotopy _ _
@[reassoc (attr := simp)]
theorem homotopyEquiv_hom_π {X : C} (P Q : ProjectiveResolution X) :
(homotopyEquiv P Q).hom ≫ Q.π = P.π := by simp [homotopyEquiv]
@[reassoc (attr := simp)]
theorem homotopyEquiv_inv_π {X : C} (P Q : ProjectiveResolution X) :
(homotopyEquiv P Q).inv ≫ P.π = Q.π := by simp [homotopyEquiv]
end Abelian
end ProjectiveResolution
/-- An arbitrarily chosen projective resolution of an object. -/
abbrev projectiveResolution (Z : C) [HasZeroObject C]
[HasZeroMorphisms C] [HasProjectiveResolution Z] :
ProjectiveResolution Z :=
(HasProjectiveResolution.out (Z := Z)).some
variable (C)
variable [Abelian C]
section
variable [HasProjectiveResolutions C]
/-- Taking projective resolutions is functorial,
if considered with target the homotopy category
(`ℕ`-indexed chain complexes and chain maps up to homotopy).
-/
def projectiveResolutions : C ⥤ HomotopyCategory C (ComplexShape.down ℕ) where
obj X := (HomotopyCategory.quotient _ _).obj (projectiveResolution X).complex
map f := (HomotopyCategory.quotient _ _).map (ProjectiveResolution.lift f _ _)
map_id X := by
rw [← (HomotopyCategory.quotient _ _).map_id]
apply HomotopyCategory.eq_of_homotopy
apply ProjectiveResolution.liftIdHomotopy
map_comp f g := by
rw [← (HomotopyCategory.quotient _ _).map_comp]
apply HomotopyCategory.eq_of_homotopy
apply ProjectiveResolution.liftCompHomotopy
variable {C}
/-- If `P : ProjectiveResolution X`, then the chosen `(projectiveResolutions C).obj X`
is isomorphic (in the homotopy category) to `P.complex`. -/
def ProjectiveResolution.iso {X : C} (P : ProjectiveResolution X) :
(projectiveResolutions C).obj X ≅
(HomotopyCategory.quotient _ _).obj P.complex :=
HomotopyCategory.isoOfHomotopyEquiv (homotopyEquiv _ _)
@[reassoc]
lemma ProjectiveResolution.iso_inv_naturality {X Y : C} (f : X ⟶ Y)
(P : ProjectiveResolution X) (Q : ProjectiveResolution Y)
(φ : P.complex ⟶ Q.complex) (comm : φ.f 0 ≫ Q.π.f 0 = P.π.f 0 ≫ f) :
P.iso.inv ≫ (projectiveResolutions C).map f =
(HomotopyCategory.quotient _ _).map φ ≫ Q.iso.inv := by
apply HomotopyCategory.eq_of_homotopy
apply liftHomotopy f
all_goals
cat_disch
@[reassoc]
lemma ProjectiveResolution.iso_hom_naturality {X Y : C} (f : X ⟶ Y)
(P : ProjectiveResolution X) (Q : ProjectiveResolution Y)
(φ : P.complex ⟶ Q.complex) (comm : φ.f 0 ≫ Q.π.f 0 = P.π.f 0 ≫ f) :
(projectiveResolutions C).map f ≫ Q.iso.hom =
P.iso.hom ≫ (HomotopyCategory.quotient _ _).map φ := by
rw [← cancel_epi (P.iso).inv, iso_inv_naturality_assoc f P Q φ comm,
Iso.inv_hom_id_assoc, Iso.inv_hom_id, comp_id]
end
variable [EnoughProjectives C]
variable {C} in
theorem exact_d_f {X Y : C} (f : X ⟶ Y) :
(ShortComplex.mk (d f) f (by simp)).Exact := by
let α : ShortComplex.mk (d f) f (by simp) ⟶ ShortComplex.mk (kernel.ι f) f (by simp) :=
{ τ₁ := Projective.π _
τ₂ := 𝟙 _
τ₃ := 𝟙 _ }
rw [ShortComplex.exact_iff_of_epi_of_isIso_of_mono α]
apply ShortComplex.exact_of_f_is_kernel
apply kernelIsKernel
namespace ProjectiveResolution
/-!
Our goal is to define `ProjectiveResolution.of Z : ProjectiveResolution Z`.
The `0`-th object in this resolution will just be `Projective.over Z`,
i.e. an arbitrarily chosen projective object with a map to `Z`.
After that, we build the `n+1`-st object as `Projective.syzygies`
applied to the previously constructed morphism,
and the map from the `n`-th object as `Projective.d`.
-/
variable {C}
variable (Z : C)
-- The construction of the projective resolution `of` would be very, very slow
-- if it were not broken into separate definitions and lemmas
/-- Auxiliary definition for `ProjectiveResolution.of`. -/
def ofComplex : ChainComplex C ℕ :=
ChainComplex.mk' (Projective.over Z) (Projective.syzygies (Projective.π Z))
(Projective.d (Projective.π Z)) (fun f => ⟨_, Projective.d f, by simp⟩)
lemma ofComplex_d_1_0 :
(ofComplex Z).d 1 0 = d (Projective.π Z) := by
simp [ofComplex]
lemma ofComplex_exactAt_succ (n : ℕ) :
(ofComplex Z).ExactAt (n + 1) := by
rw [HomologicalComplex.exactAt_iff' _ (n + 1 + 1) (n + 1) n (by simp) (by simp)]
dsimp [ofComplex, HomologicalComplex.sc', HomologicalComplex.shortComplexFunctor',
ChainComplex.mk', ChainComplex.mk]
simp only [ChainComplex.of_d]
-- TODO: this should just be apply exact_d_f so something is missing
match n with
| 0 => apply exact_d_f
| n + 1 => apply exact_d_f
instance (n : ℕ) : Projective ((ofComplex Z).X n) := by
obtain (_ | _ | _ | n) := n <;> apply Projective.projective_over
/-- In any abelian category with enough projectives,
`ProjectiveResolution.of Z` constructs an projective resolution of the object `Z`.
-/
irreducible_def of : ProjectiveResolution Z where
complex := ofComplex Z
π := (ChainComplex.toSingle₀Equiv _ _).symm ⟨Projective.π Z, by
rw [ofComplex_d_1_0, assoc, kernel.condition, comp_zero]⟩
quasiIso := ⟨fun n => by
cases n
· rw [ChainComplex.quasiIsoAt₀_iff, ShortComplex.quasiIso_iff_of_zeros']
· dsimp
refine (ShortComplex.exact_and_epi_g_iff_of_iso ?_).2
⟨exact_d_f (Projective.π Z), by dsimp; infer_instance⟩
exact ShortComplex.isoMk (Iso.refl _) (Iso.refl _) (Iso.refl _)
(by simp [ofComplex]) (by simp)
all_goals rfl
· rw [quasiIsoAt_iff_exactAt']
· apply ofComplex_exactAt_succ
· apply ChainComplex.exactAt_succ_single_obj⟩
instance (priority := 100) (Z : C) : HasProjectiveResolution Z where out := ⟨of Z⟩
instance (priority := 100) : HasProjectiveResolutions C where out _ := inferInstance
end ProjectiveResolution
end CategoryTheory |
.lake/packages/mathlib/Mathlib/CategoryTheory/Abelian/Injective/Basic.lean | import Mathlib.CategoryTheory.Abelian.Exact
import Mathlib.CategoryTheory.Preadditive.Injective.Basic
import Mathlib.CategoryTheory.Preadditive.Yoneda.Limits
import Mathlib.CategoryTheory.Preadditive.Yoneda.Injective
import Mathlib.Algebra.Homology.ShortComplex.ExactFunctor
/-!
# Injective objects in abelian categories
* Objects in an abelian categories are injective if and only if the preadditive Yoneda functor
on them preserves finite colimits.
-/
noncomputable section
open CategoryTheory Limits Injective Opposite
universe v u
namespace CategoryTheory
variable {C : Type u} [Category.{v} C] [Abelian C]
/-- The preadditive Yoneda functor on `J` preserves homology if `J` is injective. -/
instance preservesHomology_preadditiveYonedaObj_of_injective (J : C) [hJ : Injective J] :
(preadditiveYonedaObj J).PreservesHomology := by
letI := (injective_iff_preservesEpimorphisms_preadditive_yoneda_obj' J).mp hJ
apply Functor.preservesHomology_of_preservesEpis_and_kernels
/-- The preadditive Yoneda functor on `J` preserves colimits if `J` is injective. -/
instance preservesFiniteColimits_preadditiveYonedaObj_of_injective (J : C) [hP : Injective J] :
PreservesFiniteColimits (preadditiveYonedaObj J) := by
apply Functor.preservesFiniteColimits_of_preservesHomology
/-- An object is injective if its preadditive Yoneda functor preserves finite colimits. -/
theorem injective_of_preservesFiniteColimits_preadditiveYonedaObj (J : C)
[hP : PreservesFiniteColimits (preadditiveYonedaObj J)] : Injective J := by
rw [injective_iff_preservesEpimorphisms_preadditive_yoneda_obj']
have := Functor.preservesHomologyOfExact (preadditiveYonedaObj J)
infer_instance
end CategoryTheory |
.lake/packages/mathlib/Mathlib/CategoryTheory/Abelian/Injective/Dimension.lean | import Mathlib.Algebra.Homology.DerivedCategory.Ext.EnoughInjectives
import Mathlib.CategoryTheory.Abelian.Exact
import Mathlib.Data.ENat.Lattice
/-!
# Injective dimension
In an abelian category `C`, we shall say that `X : C` has Injective dimension `< n`
if all `Ext Y X i` vanish when `n ≤ i`. This defines a type class
`HasInjectiveDimensionLT X n`. We also define a type class
`HasInjectiveDimensionLE X n` as an abbreviation for
`HasInjectiveDimensionLT X (n + 1)`.
(Note that the fact that `X` is a zero object is equivalent to the condition
`HasInjectiveDimensionLT X 0`, but this cannot be expressed in terms of
`HasInjectiveDimensionLE`.)
We also define the Injective dimension in `WithBot ℕ∞` as `injectiveDimension`,
`injectiveDimension X = ⊥` iff `X` is zero and acts in common sense in the non-negative values.
-/
universe w v u
namespace CategoryTheory
open Abelian Limits ZeroObject
variable {C : Type u} [Category.{v} C] [Abelian C]
/-- An object `X` in an abelian category has Injective dimension `< n` if
all `Ext X Y i` vanish when `n ≤ i`. See also `HasInjectiveDimensionLE`.
(Do not use the `subsingleton'` field directly. Use the constructor
`HasInjectiveDimensionLT.mk`, and the lemmas `hasInjectiveDimensionLT_iff` and
`Ext.eq_zero_of_hasInjectiveDimensionLT`.) -/
class HasInjectiveDimensionLT (X : C) (n : ℕ) : Prop where mk' ::
subsingleton' (i : ℕ) (hi : n ≤ i) ⦃Y : C⦄ :
letI := HasExt.standard C
Subsingleton (Ext.{max u v} Y X i)
/-- An object `X` in an abelian category has Injective dimension `≤ n` if
all `Ext X Y i` vanish when `n + 1 ≤ i` -/
abbrev HasInjectiveDimensionLE (X : C) (n : ℕ) : Prop :=
HasInjectiveDimensionLT X (n + 1)
namespace HasInjectiveDimensionLT
variable [HasExt.{w} C] (X : C) (n : ℕ)
lemma subsingleton [hX : HasInjectiveDimensionLT X n] (i : ℕ) (hi : n ≤ i) (Y : C) :
Subsingleton (Ext.{w} Y X i) := by
letI := HasExt.standard C
have := hX.subsingleton' i hi
exact Ext.chgUniv.{w, max u v}.symm.subsingleton
variable {X n} in
lemma mk (hX : ∀ (i : ℕ) (_ : n ≤ i) ⦃Y : C⦄, ∀ (e : Ext Y X i), e = 0) :
HasInjectiveDimensionLT X n where
subsingleton' i hi Y := by
have : Subsingleton (Ext Y X i) := ⟨fun e₁ e₂ ↦ by simp only [hX i hi]⟩
letI := HasExt.standard C
exact Ext.chgUniv.{max u v, w}.symm.subsingleton
end HasInjectiveDimensionLT
lemma Abelian.Ext.eq_zero_of_hasInjectiveDimensionLT [HasExt.{w} C]
{X Y : C} {i : ℕ} (e : Ext Y X i) (n : ℕ) [HasInjectiveDimensionLT X n]
(hi : n ≤ i) : e = 0 :=
(HasInjectiveDimensionLT.subsingleton X n i hi Y).elim _ _
section
variable (X : C) (n : ℕ)
lemma hasInjectiveDimensionLT_iff [HasExt.{w} C] :
HasInjectiveDimensionLT X n ↔
∀ (i : ℕ) (_ : n ≤ i) ⦃Y : C⦄, ∀ (e : Ext Y X i), e = 0 :=
⟨fun _ _ hi _ e ↦ e.eq_zero_of_hasInjectiveDimensionLT n hi,
HasInjectiveDimensionLT.mk⟩
variable {X} in
lemma Limits.IsZero.hasInjectiveDimensionLT_zero (hX : IsZero X) :
HasInjectiveDimensionLT X 0 := by
letI := HasExt.standard C
rw [hasInjectiveDimensionLT_iff]
intro i hi Y e
rw [← e.comp_mk₀_id, hX.eq_zero_of_tgt (𝟙 X), Ext.mk₀_zero, Ext.comp_zero]
instance : HasInjectiveDimensionLT (0 : C) 0 :=
(isZero_zero C).hasInjectiveDimensionLT_zero
lemma isZero_of_hasInjectiveDimensionLT_zero [HasInjectiveDimensionLT X 0] : IsZero X := by
letI := HasExt.standard C
rw [IsZero.iff_id_eq_zero]
apply Ext.homEquiv₀.symm.injective
simpa only [Ext.homEquiv₀_symm_apply, Ext.mk₀_zero]
using Abelian.Ext.eq_zero_of_hasInjectiveDimensionLT _ 0 (by rfl)
lemma hasInjectiveDimensionLT_zero_iff_isZero : HasInjectiveDimensionLT X 0 ↔ IsZero X :=
⟨fun _ ↦ isZero_of_hasInjectiveDimensionLT_zero X, fun h ↦ h.hasInjectiveDimensionLT_zero⟩
lemma hasInjectiveDimensionLT_of_ge (m : ℕ) (h : n ≤ m)
[HasInjectiveDimensionLT X n] :
HasInjectiveDimensionLT X m := by
letI := HasExt.standard C
rw [hasInjectiveDimensionLT_iff]
intro i hi Y e
exact e.eq_zero_of_hasInjectiveDimensionLT n (by cutsat)
instance [HasInjectiveDimensionLT X n] (k : ℕ) :
HasInjectiveDimensionLT X (n + k) :=
hasInjectiveDimensionLT_of_ge X n (n + k) (by cutsat)
instance [HasInjectiveDimensionLT X n] (k : ℕ) :
HasInjectiveDimensionLT X (k + n) :=
hasInjectiveDimensionLT_of_ge X n (k + n) (by cutsat)
instance [HasInjectiveDimensionLT X n] :
HasInjectiveDimensionLT X n.succ :=
inferInstanceAs (HasInjectiveDimensionLT X (n + 1))
instance [Injective X] : HasInjectiveDimensionLT X 1 := by
letI := HasExt.standard C
rw [hasInjectiveDimensionLT_iff]
intro i hi Y e
obtain _ | i := i
· simp at hi
· exact e.eq_zero_of_injective
lemma injective_iff_subsingleton_ext_one [HasExt.{w} C] {X : C} :
Injective X ↔ ∀ ⦃Y : C⦄, Subsingleton (Ext Y X 1) := by
refine ⟨fun h ↦ HasInjectiveDimensionLT.subsingleton X 1 1 (by rfl),
fun h ↦ ⟨fun f g _ ↦ ?_⟩⟩
obtain ⟨φ, hφ⟩ := Ext.contravariant_sequence_exact₁ { exact := ShortComplex.exact_cokernel g } _
(Ext.mk₀ f) (zero_add 1) (by subsingleton)
obtain ⟨φ, rfl⟩ := Ext.homEquiv₀.symm.surjective φ
exact ⟨φ, Ext.homEquiv₀.symm.injective (by simpa using hφ)⟩
lemma injective_iff_hasInjectiveDimensionLT_one (X : C) :
Injective X ↔ HasInjectiveDimensionLT X 1 := by
letI := HasExt.standard C
exact ⟨fun _ ↦ inferInstance, fun _ ↦ injective_iff_subsingleton_ext_one.2
(HasInjectiveDimensionLT.subsingleton X 1 1 (by rfl))⟩
end
lemma Retract.hasInjectiveDimensionLT {X Y : C} (h : Retract X Y) (n : ℕ)
[HasInjectiveDimensionLT Y n] :
HasInjectiveDimensionLT X n := by
letI := HasExt.standard C
rw [hasInjectiveDimensionLT_iff]
intro i hi T x
rw [← x.comp_mk₀_id, ← h.retract, ← Ext.mk₀_comp_mk₀, ← Ext.comp_assoc_of_second_deg_zero,
(x.comp (Ext.mk₀ h.i) (add_zero i)).eq_zero_of_hasInjectiveDimensionLT n hi, Ext.zero_comp]
lemma hasInjectiveDimensionLT_of_iso {X X' : C} (e : X ≅ X') (n : ℕ)
[HasInjectiveDimensionLT X n] :
HasInjectiveDimensionLT X' n :=
e.symm.retract.hasInjectiveDimensionLT n
namespace ShortComplex
namespace ShortExact
variable {S : ShortComplex C} (hS : S.ShortExact) (n : ℕ)
include hS
-- In the following lemmas, the parameters `HasInjectiveDimensionLT` are
-- explicit as it is unlikely we may infer them, unless the short complex `S`
-- was declared reducible
lemma hasInjectiveDimensionLT_X₂ (h₁ : HasInjectiveDimensionLT S.X₁ n)
(h₃ : HasInjectiveDimensionLT S.X₃ n) :
HasInjectiveDimensionLT S.X₂ n := by
letI := HasExt.standard C
rw [hasInjectiveDimensionLT_iff]
intro i hi Y x₂
obtain ⟨x₃, rfl⟩ := Ext.covariant_sequence_exact₂ _ hS x₂
(Ext.eq_zero_of_hasInjectiveDimensionLT _ n hi)
rw [x₃.eq_zero_of_hasInjectiveDimensionLT n hi, Ext.zero_comp]
lemma hasInjectiveDimensionLT_X₁ (h₁ : HasInjectiveDimensionLT S.X₃ n)
(h₂ : HasInjectiveDimensionLT S.X₂ (n + 1)) :
HasInjectiveDimensionLT S.X₁ (n + 1) := by
letI := HasExt.standard C
rw [hasInjectiveDimensionLT_iff]
rintro (_ | i) hi Y x₃
· simp at hi
· obtain ⟨x₁, rfl⟩ := Ext.covariant_sequence_exact₁ _ hS x₃
(Ext.eq_zero_of_hasInjectiveDimensionLT _ (n + 1) hi) rfl
rw [x₁.eq_zero_of_hasInjectiveDimensionLT n (by cutsat), Ext.zero_comp]
lemma hasInjectiveDimensionLT_X₃ (h₂ : HasInjectiveDimensionLT S.X₂ n)
(h₃ : HasInjectiveDimensionLT S.X₁ (n + 1)) :
HasInjectiveDimensionLT S.X₃ n := by
letI := HasExt.standard C
rw [hasInjectiveDimensionLT_iff]
intro i hi Y x₁
obtain ⟨x₂, rfl⟩ := Ext.covariant_sequence_exact₃ _ hS x₁ (add_comm _ _)
(Ext.eq_zero_of_hasInjectiveDimensionLT _ (n + 1) (by cutsat))
rw [x₂.eq_zero_of_hasInjectiveDimensionLT n (by cutsat), Ext.zero_comp]
lemma hasInjectiveDimensionLT_X₃_iff (n : ℕ) (h₂ : Injective S.X₂) :
HasInjectiveDimensionLT S.X₃ (n + 1) ↔ HasInjectiveDimensionLT S.X₁ (n + 2) :=
⟨fun _ ↦ hS.hasInjectiveDimensionLT_X₁ (n + 1) inferInstance inferInstance,
fun _ ↦ hS.hasInjectiveDimensionLT_X₃ (n + 1) inferInstance inferInstance⟩
end ShortExact
end ShortComplex
instance (X Y : C) (n : ℕ) [HasInjectiveDimensionLT X n]
[HasInjectiveDimensionLT Y n] :
HasInjectiveDimensionLT (X ⊞ Y) n :=
(ShortComplex.Splitting.ofHasBinaryBiproduct X Y).shortExact.hasInjectiveDimensionLT_X₂ n
(by assumption) (by assumption)
end CategoryTheory
section InjectiveDimension
namespace CategoryTheory
variable {C : Type u} [Category.{v, u} C] [Abelian C]
/-- The injective dimension of an object in an abelian category. -/
noncomputable def injectiveDimension (X : C) : WithBot ℕ∞ :=
sInf {n : WithBot ℕ∞ | ∀ (i : ℕ), n < i → HasInjectiveDimensionLT X i}
lemma injectiveDimension_eq_of_iso {X Y : C} (e : X ≅ Y) :
injectiveDimension X = injectiveDimension Y := by
simp only [injectiveDimension]
congr! 5
exact ⟨fun h ↦ hasInjectiveDimensionLT_of_iso e _,
fun h ↦ hasInjectiveDimensionLT_of_iso e.symm _⟩
lemma Retract.injectiveDimension_le {X Y : C} (h : Retract X Y) :
injectiveDimension X ≤ injectiveDimension Y :=
sInf_le_sInf_of_subset_insert_top (fun n hn ↦ by
simp only [Set.mem_setOf_eq, not_top_lt, IsEmpty.forall_iff, implies_true,
Set.insert_eq_of_mem] at hn ⊢
intro i hi
have := hn i hi
exact h.hasInjectiveDimensionLT i)
lemma injectiveDimension_lt_iff {X : C} {n : ℕ} :
injectiveDimension X < n ↔ HasInjectiveDimensionLT X n := by
refine ⟨fun h ↦ ?_, fun h ↦ sInf_lt_iff.2 ?_⟩
· have : injectiveDimension X ∈ _ := csInf_mem ⟨⊤, by simp⟩
simp only [Set.mem_setOf_eq] at this
exact this _ h
· obtain _ | n := n
· exact ⟨⊥, fun _ _ ↦ hasInjectiveDimensionLT_of_ge _ 0 _ (by simp), by decide⟩
· exact ⟨n, fun i hi ↦ hasInjectiveDimensionLT_of_ge _ (n + 1) _ (by simpa using hi),
by simp [WithBot.lt_add_one_iff]⟩
lemma injectiveDimension_le_iff (X : C) (n : ℕ) :
injectiveDimension X ≤ n ↔ HasInjectiveDimensionLE X n := by
simp [← injectiveDimension_lt_iff, ← WithBot.lt_add_one_iff]
lemma injectiveDimension_ge_iff (X : C) (n : ℕ) :
n ≤ injectiveDimension X ↔ ¬ HasInjectiveDimensionLT X n := by
rw [← not_iff_not, not_le, not_not, injectiveDimension_lt_iff]
lemma injectiveDimension_eq_bot_iff (X : C) :
injectiveDimension X = ⊥ ↔ Limits.IsZero X := by
rw [← hasInjectiveDimensionLT_zero_iff_isZero, ← injectiveDimension_lt_iff,
Nat.cast_zero, ← WithBot.lt_coe_bot, bot_eq_zero', WithBot.coe_zero]
lemma injectiveDimension_ne_top_iff (X : C) :
injectiveDimension X ≠ ⊤ ↔ ∃ n, HasInjectiveDimensionLE X n := by
generalize hd : injectiveDimension X = d
induction d with
| bot =>
simp only [ne_eq, bot_ne_top, not_false_eq_true, true_iff]
exact ⟨0, by simp [← injectiveDimension_le_iff, hd]⟩
| coe d =>
induction d with
| top =>
by_contra!
simp only [WithBot.coe_top, ne_eq, not_true_eq_false, false_and, true_and, false_or] at this
obtain ⟨n, hn⟩ := this
rw [← injectiveDimension_le_iff, hd, WithBot.coe_top, top_le_iff] at hn
exact ENat.coe_ne_top _ ((WithBot.coe_eq_coe).1 hn)
| coe d =>
simp only [ne_eq, WithBot.coe_eq_top, ENat.coe_ne_top, not_false_eq_true, true_iff]
exact ⟨d, by simpa only [← injectiveDimension_le_iff] using hd.le⟩
end CategoryTheory
end InjectiveDimension |
.lake/packages/mathlib/Mathlib/CategoryTheory/Abelian/Injective/Resolution.lean | import Mathlib.CategoryTheory.Preadditive.Injective.Resolution
import Mathlib.Algebra.Homology.HomotopyCategory
import Mathlib.Data.Set.Subsingleton
import Mathlib.Tactic.AdaptationNote
/-!
# Abelian categories with enough injectives have injective resolutions
## Main results
When the underlying category is abelian:
* `CategoryTheory.InjectiveResolution.desc`: Given `I : InjectiveResolution X` and
`J : InjectiveResolution Y`, any morphism `X ⟶ Y` admits a descent to a chain map
`J.cocomplex ⟶ I.cocomplex`. It is a descent in the sense that `I.ι` intertwines the descent and
the original morphism, see `CategoryTheory.InjectiveResolution.desc_commutes`.
* `CategoryTheory.InjectiveResolution.descHomotopy`: Any two such descents are homotopic.
* `CategoryTheory.InjectiveResolution.homotopyEquiv`: Any two injective resolutions of the same
object are homotopy equivalent.
* `CategoryTheory.injectiveResolutions`: If every object admits an injective resolution, we can
construct a functor `injectiveResolutions C : C ⥤ HomotopyCategory C`.
* `CategoryTheory.exact_f_d`: `f` and `Injective.d f` are exact.
* `CategoryTheory.InjectiveResolution.of`: Hence, starting from a monomorphism `X ⟶ J`, where `J`
is injective, we can apply `Injective.d` repeatedly to obtain an injective resolution of `X`.
-/
noncomputable section
open CategoryTheory Category Limits
universe v u
namespace CategoryTheory
variable {C : Type u} [Category.{v} C]
open Injective
namespace InjectiveResolution
section
variable [HasZeroObject C] [HasZeroMorphisms C]
/-- Auxiliary construction for `desc`. -/
def descFZero {Y Z : C} (f : Z ⟶ Y) (I : InjectiveResolution Y) (J : InjectiveResolution Z) :
J.cocomplex.X 0 ⟶ I.cocomplex.X 0 :=
factorThru (f ≫ I.ι.f 0) (J.ι.f 0)
end
section Abelian
variable [Abelian C]
lemma exact₀ {Z : C} (I : InjectiveResolution Z) :
(ShortComplex.mk _ _ I.ι_f_zero_comp_complex_d).Exact :=
ShortComplex.exact_of_f_is_kernel _ I.isLimitKernelFork
/-- Auxiliary construction for `desc`. -/
def descFOne {Y Z : C} (f : Z ⟶ Y) (I : InjectiveResolution Y) (J : InjectiveResolution Z) :
J.cocomplex.X 1 ⟶ I.cocomplex.X 1 :=
J.exact₀.descToInjective (descFZero f I J ≫ I.cocomplex.d 0 1)
(by dsimp; simp only [← assoc, descFZero]; simp [assoc])
@[simp]
theorem descFOne_zero_comm {Y Z : C} (f : Z ⟶ Y) (I : InjectiveResolution Y)
(J : InjectiveResolution Z) :
J.cocomplex.d 0 1 ≫ descFOne f I J = descFZero f I J ≫ I.cocomplex.d 0 1 := by
apply J.exact₀.comp_descToInjective
/-- Auxiliary construction for `desc`. -/
def descFSucc {Y Z : C} (I : InjectiveResolution Y) (J : InjectiveResolution Z) (n : ℕ)
(g : J.cocomplex.X n ⟶ I.cocomplex.X n) (g' : J.cocomplex.X (n + 1) ⟶ I.cocomplex.X (n + 1))
(w : J.cocomplex.d n (n + 1) ≫ g' = g ≫ I.cocomplex.d n (n + 1)) :
Σ' g'' : J.cocomplex.X (n + 2) ⟶ I.cocomplex.X (n + 2),
J.cocomplex.d (n + 1) (n + 2) ≫ g'' = g' ≫ I.cocomplex.d (n + 1) (n + 2) :=
⟨(J.exact_succ n).descToInjective
(g' ≫ I.cocomplex.d (n + 1) (n + 2)) (by simp [reassoc_of% w]),
(J.exact_succ n).comp_descToInjective _ _⟩
/-- A morphism in `C` descends to a chain map between injective resolutions. -/
def desc {Y Z : C} (f : Z ⟶ Y) (I : InjectiveResolution Y) (J : InjectiveResolution Z) :
J.cocomplex ⟶ I.cocomplex :=
CochainComplex.mkHom _ _ (descFZero f _ _) (descFOne f _ _) (descFOne_zero_comm f I J).symm
fun n ⟨g, g', w⟩ => ⟨(descFSucc I J n g g' w.symm).1, (descFSucc I J n g g' w.symm).2.symm⟩
/-- The resolution maps intertwine the descent of a morphism and that morphism. -/
@[reassoc (attr := simp)]
theorem desc_commutes {Y Z : C} (f : Z ⟶ Y) (I : InjectiveResolution Y)
(J : InjectiveResolution Z) : J.ι ≫ desc f I J = (CochainComplex.single₀ C).map f ≫ I.ι := by
ext
simp [desc, descFOne, descFZero]
@[reassoc (attr := simp)]
lemma desc_commutes_zero {Y Z : C} (f : Z ⟶ Y)
(I : InjectiveResolution Y) (J : InjectiveResolution Z) :
J.ι.f 0 ≫ (desc f I J).f 0 = f ≫ I.ι.f 0 :=
(HomologicalComplex.congr_hom (desc_commutes f I J) 0).trans (by simp)
-- Now that we've checked this property of the descent, we can seal away the actual definition.
/-- An auxiliary definition for `descHomotopyZero`. -/
def descHomotopyZeroZero {Y Z : C} {I : InjectiveResolution Y} {J : InjectiveResolution Z}
(f : I.cocomplex ⟶ J.cocomplex) (comm : I.ι ≫ f = 0) : I.cocomplex.X 1 ⟶ J.cocomplex.X 0 :=
I.exact₀.descToInjective (f.f 0) (congr_fun (congr_arg HomologicalComplex.Hom.f comm) 0)
@[reassoc (attr := simp)]
lemma comp_descHomotopyZeroZero {Y Z : C} {I : InjectiveResolution Y} {J : InjectiveResolution Z}
(f : I.cocomplex ⟶ J.cocomplex) (comm : I.ι ≫ f = 0) :
I.cocomplex.d 0 1 ≫ descHomotopyZeroZero f comm = f.f 0 :=
I.exact₀.comp_descToInjective _ _
/-- An auxiliary definition for `descHomotopyZero`. -/
def descHomotopyZeroOne {Y Z : C} {I : InjectiveResolution Y} {J : InjectiveResolution Z}
(f : I.cocomplex ⟶ J.cocomplex) (comm : I.ι ≫ f = (0 : _ ⟶ J.cocomplex)) :
I.cocomplex.X 2 ⟶ J.cocomplex.X 1 :=
(I.exact_succ 0).descToInjective (f.f 1 - descHomotopyZeroZero f comm ≫ J.cocomplex.d 0 1)
(by rw [Preadditive.comp_sub, comp_descHomotopyZeroZero_assoc f comm,
HomologicalComplex.Hom.comm, sub_self])
@[reassoc (attr := simp)]
lemma comp_descHomotopyZeroOne {Y Z : C} {I : InjectiveResolution Y} {J : InjectiveResolution Z}
(f : I.cocomplex ⟶ J.cocomplex) (comm : I.ι ≫ f = (0 : _ ⟶ J.cocomplex)) :
I.cocomplex.d 1 2 ≫ descHomotopyZeroOne f comm =
f.f 1 - descHomotopyZeroZero f comm ≫ J.cocomplex.d 0 1 :=
(I.exact_succ 0).comp_descToInjective _ _
/-- An auxiliary definition for `descHomotopyZero`. -/
def descHomotopyZeroSucc {Y Z : C} {I : InjectiveResolution Y} {J : InjectiveResolution Z}
(f : I.cocomplex ⟶ J.cocomplex) (n : ℕ) (g : I.cocomplex.X (n + 1) ⟶ J.cocomplex.X n)
(g' : I.cocomplex.X (n + 2) ⟶ J.cocomplex.X (n + 1))
(w : f.f (n + 1) = I.cocomplex.d (n + 1) (n + 2) ≫ g' + g ≫ J.cocomplex.d n (n + 1)) :
I.cocomplex.X (n + 3) ⟶ J.cocomplex.X (n + 2) :=
(I.exact_succ (n + 1)).descToInjective (f.f (n + 2) - g' ≫ J.cocomplex.d _ _) (by
dsimp
rw [Preadditive.comp_sub, ← HomologicalComplex.Hom.comm, w, Preadditive.add_comp,
Category.assoc, Category.assoc, HomologicalComplex.d_comp_d, comp_zero,
add_zero, sub_self])
@[reassoc (attr := simp)]
lemma comp_descHomotopyZeroSucc {Y Z : C} {I : InjectiveResolution Y} {J : InjectiveResolution Z}
(f : I.cocomplex ⟶ J.cocomplex) (n : ℕ) (g : I.cocomplex.X (n + 1) ⟶ J.cocomplex.X n)
(g' : I.cocomplex.X (n + 2) ⟶ J.cocomplex.X (n + 1))
(w : f.f (n + 1) = I.cocomplex.d (n + 1) (n + 2) ≫ g' + g ≫ J.cocomplex.d n (n + 1)) :
I.cocomplex.d (n+2) (n+3) ≫ descHomotopyZeroSucc f n g g' w =
f.f (n + 2) - g' ≫ J.cocomplex.d _ _ :=
(I.exact_succ (n + 1)).comp_descToInjective _ _
/-- Any descent of the zero morphism is homotopic to zero. -/
def descHomotopyZero {Y Z : C} {I : InjectiveResolution Y} {J : InjectiveResolution Z}
(f : I.cocomplex ⟶ J.cocomplex) (comm : I.ι ≫ f = 0) : Homotopy f 0 :=
Homotopy.mkCoinductive _ (descHomotopyZeroZero f comm) (by simp)
(descHomotopyZeroOne f comm) (by simp) (fun n ⟨g, g', w⟩ =>
⟨descHomotopyZeroSucc f n g g' (by simp only [w, add_comm]), by simp⟩)
/-- Two descents of the same morphism are homotopic. -/
def descHomotopy {Y Z : C} (f : Y ⟶ Z) {I : InjectiveResolution Y} {J : InjectiveResolution Z}
(g h : I.cocomplex ⟶ J.cocomplex) (g_comm : I.ι ≫ g = (CochainComplex.single₀ C).map f ≫ J.ι)
(h_comm : I.ι ≫ h = (CochainComplex.single₀ C).map f ≫ J.ι) : Homotopy g h :=
Homotopy.equivSubZero.invFun (descHomotopyZero _ (by simp [g_comm, h_comm]))
/-- The descent of the identity morphism is homotopic to the identity cochain map. -/
def descIdHomotopy (X : C) (I : InjectiveResolution X) :
Homotopy (desc (𝟙 X) I I) (𝟙 I.cocomplex) := by
apply descHomotopy (𝟙 X) <;> simp
/-- The descent of a composition is homotopic to the composition of the descents. -/
def descCompHomotopy {X Y Z : C} (f : X ⟶ Y) (g : Y ⟶ Z) (I : InjectiveResolution X)
(J : InjectiveResolution Y) (K : InjectiveResolution Z) :
Homotopy (desc (f ≫ g) K I) (desc f J I ≫ desc g K J) := by
apply descHomotopy (f ≫ g) <;> simp
-- We don't care about the actual definitions of these homotopies.
/-- Any two injective resolutions are homotopy equivalent. -/
def homotopyEquiv {X : C} (I J : InjectiveResolution X) :
HomotopyEquiv I.cocomplex J.cocomplex where
hom := desc (𝟙 X) J I
inv := desc (𝟙 X) I J
homotopyHomInvId := (descCompHomotopy (𝟙 X) (𝟙 X) I J I).symm.trans <| by
simpa [id_comp] using descIdHomotopy _ _
homotopyInvHomId := (descCompHomotopy (𝟙 X) (𝟙 X) J I J).symm.trans <| by
simpa [id_comp] using descIdHomotopy _ _
@[reassoc (attr := simp)]
theorem homotopyEquiv_hom_ι {X : C} (I J : InjectiveResolution X) :
I.ι ≫ (homotopyEquiv I J).hom = J.ι := by simp [homotopyEquiv]
@[reassoc (attr := simp)]
theorem homotopyEquiv_inv_ι {X : C} (I J : InjectiveResolution X) :
J.ι ≫ (homotopyEquiv I J).inv = I.ι := by simp [homotopyEquiv]
end Abelian
end InjectiveResolution
section
variable [Abelian C]
/-- An arbitrarily chosen injective resolution of an object. -/
abbrev injectiveResolution (Z : C) [HasInjectiveResolution Z] : InjectiveResolution Z :=
(HasInjectiveResolution.out (Z := Z)).some
variable (C)
variable [HasInjectiveResolutions C]
/-- Taking injective resolutions is functorial,
if considered with target the homotopy category
(`ℕ`-indexed cochain complexes and chain maps up to homotopy).
-/
def injectiveResolutions : C ⥤ HomotopyCategory C (ComplexShape.up ℕ) where
obj X := (HomotopyCategory.quotient _ _).obj (injectiveResolution X).cocomplex
map f := (HomotopyCategory.quotient _ _).map (InjectiveResolution.desc f _ _)
map_id X := by
rw [← (HomotopyCategory.quotient _ _).map_id]
apply HomotopyCategory.eq_of_homotopy
apply InjectiveResolution.descIdHomotopy
map_comp f g := by
rw [← (HomotopyCategory.quotient _ _).map_comp]
apply HomotopyCategory.eq_of_homotopy
apply InjectiveResolution.descCompHomotopy
variable {C}
/-- If `I : InjectiveResolution X`, then the chosen `(injectiveResolutions C).obj X`
is isomorphic (in the homotopy category) to `I.cocomplex`. -/
def InjectiveResolution.iso {X : C} (I : InjectiveResolution X) :
(injectiveResolutions C).obj X ≅
(HomotopyCategory.quotient _ _).obj I.cocomplex :=
HomotopyCategory.isoOfHomotopyEquiv (homotopyEquiv _ _)
@[reassoc]
lemma InjectiveResolution.iso_hom_naturality {X Y : C} (f : X ⟶ Y)
(I : InjectiveResolution X) (J : InjectiveResolution Y)
(φ : I.cocomplex ⟶ J.cocomplex) (comm : I.ι.f 0 ≫ φ.f 0 = f ≫ J.ι.f 0) :
(injectiveResolutions C).map f ≫ J.iso.hom =
I.iso.hom ≫ (HomotopyCategory.quotient _ _).map φ := by
apply HomotopyCategory.eq_of_homotopy
apply descHomotopy f
all_goals aesop
@[reassoc]
lemma InjectiveResolution.iso_inv_naturality {X Y : C} (f : X ⟶ Y)
(I : InjectiveResolution X) (J : InjectiveResolution Y)
(φ : I.cocomplex ⟶ J.cocomplex) (comm : I.ι.f 0 ≫ φ.f 0 = f ≫ J.ι.f 0) :
I.iso.inv ≫ (injectiveResolutions C).map f =
(HomotopyCategory.quotient _ _).map φ ≫ J.iso.inv := by
rw [← cancel_mono (J.iso).hom, Category.assoc, iso_hom_naturality f I J φ comm,
Iso.inv_hom_id_assoc, Category.assoc, Iso.inv_hom_id, Category.comp_id]
end
section
variable [Abelian C] [EnoughInjectives C]
theorem exact_f_d {X Y : C} (f : X ⟶ Y) :
(ShortComplex.mk f (d f) (by simp)).Exact := by
let α : ShortComplex.mk f (cokernel.π f) (by simp) ⟶ ShortComplex.mk f (d f) (by simp) :=
{ τ₁ := 𝟙 _
τ₂ := 𝟙 _
τ₃ := Injective.ι _ }
rw [← ShortComplex.exact_iff_of_epi_of_isIso_of_mono α]
apply ShortComplex.exact_of_g_is_cokernel
apply cokernelIsCokernel
end
namespace InjectiveResolution
/-!
Our goal is to define `InjectiveResolution.of Z : InjectiveResolution Z`.
The `0`-th object in this resolution will just be `Injective.under Z`,
i.e. an arbitrarily chosen injective object with a map from `Z`.
After that, we build the `n+1`-st object as `Injective.syzygies`
applied to the previously constructed morphism,
and the map from the `n`-th object as `Injective.d`.
-/
variable [Abelian C] [EnoughInjectives C] (Z : C)
-- The construction of the injective resolution `of` would be very, very slow
-- if it were not broken into separate definitions and lemmas
/-- Auxiliary definition for `InjectiveResolution.of`. -/
def ofCocomplex : CochainComplex C ℕ :=
CochainComplex.mk' (Injective.under Z) (Injective.syzygies (Injective.ι Z))
(Injective.d (Injective.ι Z)) fun f => ⟨_, Injective.d f, by simp⟩
lemma ofCocomplex_d_0_1 :
(ofCocomplex Z).d 0 1 = d (Injective.ι Z) := by
simp [ofCocomplex]
lemma ofCocomplex_exactAt_succ (n : ℕ) :
(ofCocomplex Z).ExactAt (n + 1) := by
rw [HomologicalComplex.exactAt_iff' _ n (n + 1) (n + 1 + 1) (by simp) (by simp)]
dsimp [ofCocomplex, CochainComplex.mk', CochainComplex.mk, HomologicalComplex.sc',
HomologicalComplex.shortComplexFunctor']
simp only [CochainComplex.of_d]
match n with
| 0 => apply exact_f_d ((CochainComplex.mkAux _ _ _
(d (Injective.ι Z)) (d (d (Injective.ι Z))) _ _ 0).f)
| n + 1 => apply exact_f_d ((CochainComplex.mkAux _ _ _
(d (Injective.ι Z)) (d (d (Injective.ι Z))) _ _ (n + 1)).f)
instance (n : ℕ) : Injective ((ofCocomplex Z).X n) := by
obtain (_ | _ | _ | n) := n <;> apply Injective.injective_under
/-- In any abelian category with enough injectives,
`InjectiveResolution.of Z` constructs an injective resolution of the object `Z`.
-/
irreducible_def of : InjectiveResolution Z where
cocomplex := ofCocomplex Z
ι := (CochainComplex.fromSingle₀Equiv _ _).symm ⟨Injective.ι Z,
by rw [ofCocomplex_d_0_1, cokernel.condition_assoc, zero_comp]⟩
quasiIso := ⟨fun n => by
cases n
· rw [CochainComplex.quasiIsoAt₀_iff, ShortComplex.quasiIso_iff_of_zeros]
· refine (ShortComplex.exact_and_mono_f_iff_of_iso ?_).2
⟨exact_f_d (Injective.ι Z), by dsimp; infer_instance⟩
exact ShortComplex.isoMk (Iso.refl _) (Iso.refl _) (Iso.refl _) (by simp)
(by simp [ofCocomplex])
all_goals rfl
· rw [quasiIsoAt_iff_exactAt]
· apply ofCocomplex_exactAt_succ
· apply CochainComplex.exactAt_succ_single_obj⟩
instance (priority := 100) (Z : C) : HasInjectiveResolution Z where out := ⟨of Z⟩
instance (priority := 100) : HasInjectiveResolutions C where out _ := inferInstance
end InjectiveResolution
end CategoryTheory |
.lake/packages/mathlib/Mathlib/CategoryTheory/Monoidal/Yoneda.lean | import Mathlib.CategoryTheory.Monoidal.Mon_
deprecated_module (since := "2025-05-11") |
.lake/packages/mathlib/Mathlib/CategoryTheory/Monoidal/NaturalTransformation.lean | import Mathlib.CategoryTheory.Adjunction.FullyFaithful
import Mathlib.CategoryTheory.Monoidal.Functor
import Mathlib.CategoryTheory.ObjectProperty.FullSubcategory
/-!
# Monoidal natural transformations
Natural transformations between (lax) monoidal functors must satisfy
an additional compatibility relation with the tensorators:
`F.μ X Y ≫ app (X ⊗ Y) = (app X ⊗ app Y) ≫ G.μ X Y`.
-/
open CategoryTheory
universe v₁ v₂ v₃ v₄ u₁ u₂ u₃ u₄
open CategoryTheory.Category
open CategoryTheory.Functor
namespace CategoryTheory
open MonoidalCategory
variable {C : Type u₁} [Category.{v₁} C] [MonoidalCategory C]
{D : Type u₂} [Category.{v₂} D] [MonoidalCategory D]
{E : Type u₃} [Category.{v₃} E] [MonoidalCategory E]
{E' : Type u₄} [Category.{v₄} E'] [MonoidalCategory E']
variable {F₁ F₂ F₃ : C ⥤ D} (τ : F₁ ⟶ F₂) [F₁.LaxMonoidal] [F₂.LaxMonoidal] [F₃.LaxMonoidal]
namespace NatTrans
open Functor.LaxMonoidal
/-- A natural transformation between (lax) monoidal functors is monoidal if it satisfies
`ε F ≫ τ.app (𝟙_ C) = ε G` and `μ F X Y ≫ app (X ⊗ Y) = (app X ⊗ₘ app Y) ≫ μ G X Y`. -/
class IsMonoidal : Prop where
unit : ε F₁ ≫ τ.app (𝟙_ C) = ε F₂ := by cat_disch
tensor (X Y : C) : μ F₁ _ _ ≫ τ.app (X ⊗ Y) = (τ.app X ⊗ₘ τ.app Y) ≫ μ F₂ _ _ := by cat_disch
namespace IsMonoidal
attribute [reassoc (attr := simp)] unit tensor
instance id : IsMonoidal (𝟙 F₁) where
instance comp (τ' : F₂ ⟶ F₃) [IsMonoidal τ] [IsMonoidal τ'] :
IsMonoidal (τ ≫ τ') where
instance hcomp {G₁ G₂ : D ⥤ E} [G₁.LaxMonoidal] [G₂.LaxMonoidal] (τ' : G₁ ⟶ G₂)
[IsMonoidal τ] [IsMonoidal τ'] : IsMonoidal (τ ◫ τ') where
unit := by
simp only [comp_obj, comp_ε, hcomp_app, assoc, naturality_assoc, unit_assoc, ← map_comp, unit]
tensor X Y := by
simp only [comp_obj, comp_μ, hcomp_app, assoc, naturality_assoc,
tensor_assoc, ← tensorHom_comp_tensorHom, μ_natural_assoc]
simp only [← map_comp, tensor]
instance (F : C ⥤ D) [F.LaxMonoidal] : NatTrans.IsMonoidal F.leftUnitor.hom where
instance (F : C ⥤ D) [F.LaxMonoidal] : NatTrans.IsMonoidal F.rightUnitor.hom where
instance (F : C ⥤ D) (G : D ⥤ E) (H : E ⥤ E') [F.LaxMonoidal] [G.LaxMonoidal] [H.LaxMonoidal] :
NatTrans.IsMonoidal (Functor.associator F G H).hom where
unit := by
simp only [comp_obj, comp_ε, assoc, Functor.map_comp, associator_hom_app, comp_id,
Functor.comp_map]
tensor X Y := by
simp only [comp_obj, comp_μ, associator_hom_app, Functor.comp_map, map_comp,
comp_id, tensorHom_id, id_whiskerRight, assoc, id_comp]
end IsMonoidal
instance {F G : C ⥤ D} {H K : C ⥤ E} (α : F ⟶ G) (β : H ⟶ K)
[F.LaxMonoidal] [G.LaxMonoidal] [IsMonoidal α]
[H.LaxMonoidal] [K.LaxMonoidal] [IsMonoidal β] :
IsMonoidal (NatTrans.prod' α β) where
unit := by
ext
· rw [prod_comp_fst, prod'_ε_fst, prod'_ε_fst, prod'_app_fst, IsMonoidal.unit]
· rw [prod_comp_snd, prod'_ε_snd, prod'_ε_snd, prod'_app_snd, IsMonoidal.unit]
tensor X Y := by
ext
· simp only [prod_comp_fst, prod'_μ_fst, prod'_app_fst,
prodMonoidal_tensorHom, IsMonoidal.tensor]
· simp only [prod_comp_snd, prod'_μ_snd, prod'_app_snd,
prodMonoidal_tensorHom, IsMonoidal.tensor]
end NatTrans
namespace Iso
variable (e : F₁ ≅ F₂) [NatTrans.IsMonoidal e.hom]
instance : NatTrans.IsMonoidal e.inv where
unit := by rw [← NatTrans.IsMonoidal.unit (τ := e.hom), assoc, hom_inv_id_app, comp_id]
tensor X Y := by
rw [← cancel_mono (e.hom.app (X ⊗ Y)), assoc, assoc, inv_hom_id_app, comp_id,
NatTrans.IsMonoidal.tensor, MonoidalCategory.tensorHom_comp_tensorHom_assoc,
inv_hom_id_app, inv_hom_id_app, tensorHom_id, id_whiskerRight, id_comp]
end Iso
namespace Adjunction
variable {F : C ⥤ D} {G : D ⥤ C} (adj : F ⊣ G)
open Functor.LaxMonoidal Functor.OplaxMonoidal Functor.Monoidal
namespace IsMonoidal
variable [F.Monoidal] [G.LaxMonoidal] [adj.IsMonoidal]
instance : NatTrans.IsMonoidal adj.unit where
unit := by
dsimp
rw [id_comp, ← unit_app_unit_comp_map_η adj, assoc, Monoidal.map_η_ε]
dsimp
rw [comp_id]
tensor X Y := by
dsimp
rw [← unit_app_tensor_comp_map_δ_assoc, id_comp, Monoidal.map_δ_μ, comp_id]
instance : NatTrans.IsMonoidal adj.counit where
unit := by
dsimp
rw [assoc, map_ε_comp_counit_app_unit adj, ε_η]
tensor X Y := by
dsimp
rw [assoc, map_μ_comp_counit_app_tensor, μ_δ_assoc, comp_id]
end IsMonoidal
namespace Equivalence
variable (e : C ≌ D) [e.functor.Monoidal] [e.inverse.Monoidal] [e.IsMonoidal]
instance : NatTrans.IsMonoidal e.unit :=
inferInstanceAs (NatTrans.IsMonoidal e.toAdjunction.unit)
instance : NatTrans.IsMonoidal e.counit :=
inferInstanceAs (NatTrans.IsMonoidal e.toAdjunction.counit)
end Equivalence
end Adjunction
namespace LaxMonoidalFunctor
/-- The type of monoidal natural transformations between (bundled) lax monoidal functors. -/
structure Hom (F G : LaxMonoidalFunctor C D) where
/-- the natural transformation between the underlying functors -/
hom : F.toFunctor ⟶ G.toFunctor
isMonoidal : NatTrans.IsMonoidal hom := by infer_instance
attribute [instance] Hom.isMonoidal
instance : Category (LaxMonoidalFunctor C D) where
Hom := Hom
comp α β := ⟨α.1 ≫ β.1, by have := α.2; have := β.2; infer_instance⟩
id _ := ⟨𝟙 _, inferInstance⟩
@[simp]
lemma id_hom (F : LaxMonoidalFunctor C D) : Hom.hom (𝟙 F) = 𝟙 _ := rfl
@[reassoc, simp]
lemma comp_hom {F G H : LaxMonoidalFunctor C D} (α : F ⟶ G) (β : G ⟶ H) :
(α ≫ β).hom = α.hom ≫ β.hom := rfl
@[ext]
lemma hom_ext {F G : LaxMonoidalFunctor C D} {α β : F ⟶ G} (h : α.hom = β.hom) : α = β := by
cases α; cases β; subst h; rfl
/-- Constructor for morphisms in the category `LaxMonoidalFunctor C D`. -/
@[simps]
def homMk {F G : LaxMonoidalFunctor C D} (f : F.toFunctor ⟶ G.toFunctor) [NatTrans.IsMonoidal f] :
F ⟶ G := ⟨f, inferInstance⟩
/-- Constructor for isomorphisms in the category `LaxMonoidalFunctor C D`. -/
@[simps]
def isoMk {F G : LaxMonoidalFunctor C D} (e : F.toFunctor ≅ G.toFunctor)
[NatTrans.IsMonoidal e.hom] :
F ≅ G where
hom := homMk e.hom
inv := homMk e.inv
open Functor.LaxMonoidal
/-- Constructor for isomorphisms between lax monoidal functors. -/
@[simps!]
def isoOfComponents {F G : LaxMonoidalFunctor C D} (e : ∀ X, F.obj X ≅ G.obj X)
(naturality : ∀ {X Y : C} (f : X ⟶ Y), F.map f ≫ (e Y).hom = (e X).hom ≫ G.map f := by
cat_disch)
(unit : ε F.toFunctor ≫ (e (𝟙_ C)).hom = ε G.toFunctor := by cat_disch)
(tensor : ∀ X Y, μ F.toFunctor X Y ≫ (e (X ⊗ Y)).hom =
((e X).hom ⊗ₘ (e Y).hom) ≫ μ G.toFunctor X Y := by cat_disch) :
F ≅ G :=
@isoMk _ _ _ _ _ _ _ _ (NatIso.ofComponents e naturality) (by constructor <;> assumption)
end LaxMonoidalFunctor
namespace Functor.Monoidal
/--
Transporting a monoidal structure along a natural isomorphism of functors makes the isomorphism
a monoidal natural transformation.
-/
lemma natTransIsMonoidal_of_transport {F G : C ⥤ D} [F.Monoidal] (e : F ≅ G) :
letI : G.Monoidal := transport e
e.hom.IsMonoidal := by
letI G.Monoidal := transport e
refine ⟨rfl, fun X Y ↦ ?_⟩
simp [transport_μ, tensorHom_comp_tensorHom_assoc]
end Functor.Monoidal
end CategoryTheory |
.lake/packages/mathlib/Mathlib/CategoryTheory/Monoidal/ExternalProduct.lean | import Mathlib.CategoryTheory.Monoidal.ExternalProduct.Basic
deprecated_module (since := "2025-06-19") |
.lake/packages/mathlib/Mathlib/CategoryTheory/Monoidal/Transport.lean | import Mathlib.CategoryTheory.Monoidal.NaturalTransformation
/-!
# Transport a monoidal structure along an equivalence.
When `C` and `D` are equivalent as categories,
we can transport a monoidal structure on `C` along the equivalence as
`CategoryTheory.Monoidal.transport`, obtaining a monoidal structure on `D`.
More generally, we can transport the lawfulness of a monoidal structure along a suitable faithful
functor, as `CategoryTheory.Monoidal.induced`.
The comparison is analogous to the difference between `Equiv.monoid` and
`Function.Injective.monoid`.
We then upgrade the original functor and its inverse to monoidal functors
with respect to the new monoidal structure on `D`.
-/
universe v₁ v₂ u₁ u₂
open CategoryTheory
open CategoryTheory.Category
open CategoryTheory.MonoidalCategory
namespace CategoryTheory.Monoidal
variable {C : Type u₁} [Category.{v₁} C] [MonoidalCategory.{v₁} C]
variable {D : Type u₂} [Category.{v₂} D]
/-- The data needed to induce a `MonoidalCategory` via the functor `F`; namely, pre-existing
definitions of `⊗`, `𝟙_`, `▷`, `◁` that are preserved by `F`.
-/
structure InducingFunctorData [MonoidalCategoryStruct D] (F : D ⥤ C) where
/-- Analogous to `CategoryTheory.LaxMonoidalFunctor.μIso` -/
μIso : ∀ X Y,
F.obj X ⊗ F.obj Y ≅ F.obj (X ⊗ Y)
whiskerLeft_eq : ∀ (X : D) {Y₁ Y₂ : D} (f : Y₁ ⟶ Y₂),
F.map (X ◁ f) = (μIso _ _).inv ≫ (F.obj X ◁ F.map f) ≫ (μIso _ _).hom := by
cat_disch
whiskerRight_eq : ∀ {X₁ X₂ : D} (f : X₁ ⟶ X₂) (Y : D),
F.map (f ▷ Y) = (μIso _ _).inv ≫ (F.map f ▷ F.obj Y) ≫ (μIso _ _).hom := by
cat_disch
tensorHom_eq : ∀ {X₁ Y₁ X₂ Y₂ : D} (f : X₁ ⟶ Y₁) (g : X₂ ⟶ Y₂),
F.map (f ⊗ₘ g) = (μIso _ _).inv ≫ (F.map f ⊗ₘ F.map g) ≫ (μIso _ _).hom := by
cat_disch
/-- Analogous to `CategoryTheory.LaxMonoidalFunctor.εIso` -/
εIso : 𝟙_ _ ≅ F.obj (𝟙_ _)
associator_eq : ∀ X Y Z : D,
F.map (α_ X Y Z).hom =
(((μIso _ _).symm ≪≫ ((μIso _ _).symm ⊗ᵢ .refl _))
≪≫ α_ (F.obj X) (F.obj Y) (F.obj Z)
≪≫ ((.refl _ ⊗ᵢ μIso _ _) ≪≫ μIso _ _)).hom := by
cat_disch
leftUnitor_eq : ∀ X : D,
F.map (λ_ X).hom =
(((μIso _ _).symm ≪≫ (εIso.symm ⊗ᵢ .refl _)) ≪≫ λ_ (F.obj X)).hom := by
cat_disch
rightUnitor_eq : ∀ X : D,
F.map (ρ_ X).hom =
(((μIso _ _).symm ≪≫ (.refl _ ⊗ᵢ εIso.symm)) ≪≫ ρ_ (F.obj X)).hom := by
cat_disch
/--
Induce the lawfulness of the monoidal structure along an faithful functor of (plain) categories,
where the operations are already defined on the destination type `D`.
The functor `F` must preserve all the data parts of the monoidal structure between the two
categories.
-/
def induced [MonoidalCategoryStruct D] (F : D ⥤ C) [F.Faithful]
(fData : InducingFunctorData F) :
MonoidalCategory.{v₂} D where
tensorHom_def {X₁ Y₁ X₂ Y₂} f g := F.map_injective <| by
rw [fData.tensorHom_eq, Functor.map_comp, fData.whiskerRight_eq, fData.whiskerLeft_eq]
simp only [tensorHom_def, assoc, Iso.hom_inv_id_assoc]
id_tensorHom_id X₁ X₂ := F.map_injective <| by cases fData; cat_disch
tensorHom_comp_tensorHom f₁ f₂ g₁ g₂ := F.map_injective <| by cases fData; cat_disch
whiskerLeft_id X Y := F.map_injective <| by simp [fData.whiskerLeft_eq]
id_whiskerRight X Y := F.map_injective <| by simp [fData.whiskerRight_eq]
triangle X Y := F.map_injective <| by cases fData; cat_disch
pentagon W X Y Z := F.map_injective <| by
simp only [Functor.map_comp, fData.whiskerRight_eq, fData.associator_eq, Iso.trans_assoc,
Iso.trans_hom, Iso.symm_hom, tensorIso_hom, Iso.refl_hom, tensorHom_id, id_tensorHom,
comp_whiskerRight, whisker_assoc, assoc, fData.whiskerLeft_eq, whiskerLeft_comp,
Iso.hom_inv_id_assoc, whiskerLeft_hom_inv_assoc, hom_inv_whiskerRight_assoc,
Iso.inv_hom_id_assoc, Iso.cancel_iso_inv_left]
slice_lhs 5 6 =>
rw [← whiskerLeft_comp, hom_inv_whiskerRight]
rw [whisker_exchange_assoc]
simp
leftUnitor_naturality {X Y : D} f := F.map_injective <| by
simp [fData.leftUnitor_eq, fData.whiskerLeft_eq, whisker_exchange_assoc]
rightUnitor_naturality {X Y : D} f := F.map_injective <| by
simp [fData.rightUnitor_eq, fData.whiskerRight_eq, ← whisker_exchange_assoc]
associator_naturality {X₁ X₂ X₃ Y₁ Y₂ Y₃} f₁ f₂ f₃ := F.map_injective <| by
simp [fData.tensorHom_eq, fData.associator_eq, tensorHom_def, whisker_exchange_assoc]
/-- A faithful functor equipped with a `InducingFunctorData` structure is monoidal. -/
def fromInducedCoreMonoidal [MonoidalCategoryStruct D] (F : D ⥤ C) [F.Faithful]
(fData : InducingFunctorData F) :
letI := induced F fData
F.CoreMonoidal := by
letI := induced F fData
exact
{ εIso := fData.εIso
μIso := fData.μIso
μIso_hom_natural_left := fun _ ↦ by simp [fData.whiskerRight_eq]
μIso_hom_natural_right := fun _ ↦ by simp [fData.whiskerLeft_eq]
associativity := fun _ _ _ ↦ by simp [fData.associator_eq]
left_unitality := fun _ ↦ by simp [fData.leftUnitor_eq]
right_unitality := fun _ ↦ by simp [fData.rightUnitor_eq] }
instance fromInducedMonoidal [MonoidalCategoryStruct D] (F : D ⥤ C) [F.Faithful]
(fData : InducingFunctorData F) :
letI := induced F fData
F.Monoidal :=
letI := induced F fData
(fromInducedCoreMonoidal F fData).toMonoidal
/-- Transport a monoidal structure along an equivalence of (plain) categories.
-/
@[simps -isSimp]
def transportStruct (e : C ≌ D) : MonoidalCategoryStruct.{v₂} D where
tensorObj X Y := e.functor.obj (e.inverse.obj X ⊗ e.inverse.obj Y)
whiskerLeft X _ _ f := e.functor.map (e.inverse.obj X ◁ e.inverse.map f)
whiskerRight f X := e.functor.map (e.inverse.map f ▷ e.inverse.obj X)
tensorHom f g := e.functor.map (e.inverse.map f ⊗ₘ e.inverse.map g)
tensorUnit := e.functor.obj (𝟙_ C)
associator X Y Z :=
e.functor.mapIso
(whiskerRightIso (e.unitIso.app _).symm _ ≪≫
α_ (e.inverse.obj X) (e.inverse.obj Y) (e.inverse.obj Z) ≪≫
whiskerLeftIso _ (e.unitIso.app _))
leftUnitor X :=
e.functor.mapIso ((whiskerRightIso (e.unitIso.app _).symm _) ≪≫ λ_ (e.inverse.obj X)) ≪≫
e.counitIso.app _
rightUnitor X :=
e.functor.mapIso ((whiskerLeftIso _ (e.unitIso.app _).symm) ≪≫ ρ_ (e.inverse.obj X)) ≪≫
e.counitIso.app _
attribute [local simp] transportStruct in
/-- Transport a monoidal structure along an equivalence of (plain) categories.
-/
def transport (e : C ≌ D) : MonoidalCategory.{v₂} D :=
letI : MonoidalCategoryStruct.{v₂} D := transportStruct e
induced e.inverse
{ μIso := fun _ _ => e.unitIso.app _
εIso := e.unitIso.app _ }
/-- A type synonym for `D`, which will carry the transported monoidal structure. -/
@[nolint unusedArguments]
def Transported (_ : C ≌ D) := D
instance (e : C ≌ D) : Category (Transported e) := (inferInstance : Category D)
instance Transported.instMonoidalCategoryStruct (e : C ≌ D) :
MonoidalCategoryStruct (Transported e) :=
transportStruct e
instance Transported.instMonoidalCategory (e : C ≌ D) : MonoidalCategory (Transported e) :=
transport e
instance (e : C ≌ D) : Inhabited (Transported e) :=
⟨𝟙_ _⟩
section
variable (e : C ≌ D)
/-- We upgrade the equivalence of categories `e : C ≌ D` to a monoidal category
equivalence `C ≌ Transported e`. -/
abbrev equivalenceTransported : C ≌ Transported e := e
instance : (equivalenceTransported e).inverse.Monoidal := by
dsimp only [Transported.instMonoidalCategory]
infer_instance
instance : (equivalenceTransported e).symm.functor.Monoidal :=
inferInstanceAs (equivalenceTransported e).inverse.Monoidal
noncomputable instance : (equivalenceTransported e).functor.Monoidal :=
(equivalenceTransported e).symm.inverseMonoidal
noncomputable instance : (equivalenceTransported e).symm.inverse.Monoidal :=
inferInstanceAs (equivalenceTransported e).functor.Monoidal
instance : (equivalenceTransported e).symm.IsMonoidal := by
infer_instance
/-- The unit isomorphism upgrades to a monoidal isomorphism. -/
instance : NatTrans.IsMonoidal (equivalenceTransported e).unit :=
inferInstanceAs (NatTrans.IsMonoidal (equivalenceTransported e).symm.counitIso.inv)
/-- The counit isomorphism upgrades to a monoidal isomorphism. -/
instance : NatTrans.IsMonoidal (equivalenceTransported e).counit :=
inferInstanceAs (NatTrans.IsMonoidal (equivalenceTransported e).symm.unitIso.inv)
end
end CategoryTheory.Monoidal |
.lake/packages/mathlib/Mathlib/CategoryTheory/Monoidal/Opposite.lean | import Mathlib.CategoryTheory.Monoidal.Functor
import Mathlib.Tactic.CategoryTheory.Monoidal.PureCoherence
/-!
# Monoidal opposites
We write `Cᵐᵒᵖ` for the monoidal opposite of a monoidal category `C`.
-/
universe v₁ v₂ u₁ u₂
variable {C : Type u₁}
namespace CategoryTheory
open CategoryTheory.MonoidalCategory
/-- The type of objects of the opposite (or "reverse") monoidal category.
Use the notation `Cᴹᵒᵖ`. -/
structure MonoidalOpposite (C : Type u₁) where
/-- The object of `MonoidalOpposite C` that represents `x : C`. -/ mop ::
/-- The object of `C` represented by `x : MonoidalOpposite C`. -/ unmop : C
namespace MonoidalOpposite
@[inherit_doc]
notation:max C "ᴹᵒᵖ" => MonoidalOpposite C
theorem mop_injective : Function.Injective (mop : C → Cᴹᵒᵖ) := @mop.inj C
theorem unmop_injective : Function.Injective (unmop : Cᴹᵒᵖ → C) :=
fun _ _ h => congrArg mop h
theorem mop_inj_iff (x y : C) : mop x = mop y ↔ x = y := mop_injective.eq_iff
@[simp]
theorem unmop_inj_iff (x y : Cᴹᵒᵖ) : unmop x = unmop y ↔ x = y := unmop_injective.eq_iff
@[simp]
theorem mop_unmop (X : Cᴹᵒᵖ) : mop (unmop X) = X := rfl
-- can't be simp bc after putting the lhs in whnf it's `X = X`
theorem unmop_mop (X : C) : unmop (mop X) = X := rfl
instance monoidalOppositeCategory [Category.{v₁} C] : Category Cᴹᵒᵖ where
Hom X Y := (unmop X ⟶ unmop Y)ᴹᵒᵖ
id X := mop (𝟙 (unmop X))
comp f g := mop (unmop f ≫ unmop g)
end MonoidalOpposite
end CategoryTheory
open CategoryTheory
open CategoryTheory.MonoidalOpposite
variable [Category.{v₁} C]
/-- The monoidal opposite of a morphism `f : X ⟶ Y` is just `f`, thought of as `mop X ⟶ mop Y`. -/
def Quiver.Hom.mop {X Y : C} (f : X ⟶ Y) : mop X ⟶ mop Y := MonoidalOpposite.mop f
/-- We can think of a morphism `f : mop X ⟶ mop Y` as a morphism `X ⟶ Y`. -/
def Quiver.Hom.unmop {X Y : Cᴹᵒᵖ} (f : X ⟶ Y) : unmop X ⟶ unmop Y := MonoidalOpposite.unmop f
namespace Quiver.Hom
open MonoidalOpposite renaming mop → mop', unmop → unmop'
theorem mop_inj {X Y : C} :
Function.Injective (Quiver.Hom.mop : (X ⟶ Y) → (mop' X ⟶ mop' Y)) :=
fun _ _ H => congr_arg Quiver.Hom.unmop H
theorem unmop_inj {X Y : Cᴹᵒᵖ} :
Function.Injective (Quiver.Hom.unmop : (X ⟶ Y) → (unmop' X ⟶ unmop' Y)) :=
fun _ _ H => congr_arg Quiver.Hom.mop H
@[simp]
theorem unmop_mop {X Y : C} {f : X ⟶ Y} : f.mop.unmop = f :=
rfl
@[simp]
theorem mop_unmop {X Y : Cᴹᵒᵖ} {f : X ⟶ Y} : f.unmop.mop = f :=
rfl
end Quiver.Hom
namespace CategoryTheory
@[simp]
theorem mop_comp {X Y Z : C} {f : X ⟶ Y} {g : Y ⟶ Z} :
(f ≫ g).mop = f.mop ≫ g.mop := rfl
@[simp]
theorem mop_id {X : C} : (𝟙 X).mop = 𝟙 (mop X) := rfl
@[simp]
theorem unmop_comp {X Y Z : Cᴹᵒᵖ} {f : X ⟶ Y} {g : Y ⟶ Z} :
(f ≫ g).unmop = f.unmop ≫ g.unmop := rfl
@[simp]
theorem unmop_id {X : Cᴹᵒᵖ} : (𝟙 X).unmop = 𝟙 (unmop X) := rfl
@[simp]
theorem unmop_id_mop {X : C} : (𝟙 (mop X)).unmop = 𝟙 X := rfl
@[simp]
theorem mop_id_unmop {X : Cᴹᵒᵖ} : (𝟙 (unmop X)).mop = 𝟙 X := rfl
-- aesop prefers this lemma as a safe apply over Quiver.Hom.unmop_inj
lemma MonoidalOpposite.hom_ext {x y : Cᴹᵒᵖ} {f g : x ⟶ y} (h : f.unmop = g.unmop) :
f = g :=
Quiver.Hom.unmop_inj h
variable (C)
/-- The identity functor on `C`, viewed as a functor from `C` to its monoidal opposite. -/
@[simps obj map] -- need to specify `obj, map` or else we generate `mopFunctor_obj_unmop`
def mopFunctor : C ⥤ Cᴹᵒᵖ := Functor.mk mop .mop
/-- The identity functor on `C`, viewed as a functor from the monoidal opposite of `C` to `C`. -/
@[simps obj map] -- not necessary but the symmetry with `mopFunctor` looks nicer
def unmopFunctor : Cᴹᵒᵖ ⥤ C := Functor.mk unmop .unmop
variable {C}
namespace Iso
/-- An isomorphism in `C` gives an isomorphism in `Cᴹᵒᵖ`. -/
abbrev mop {X Y : C} (f : X ≅ Y) : mop X ≅ mop Y := (mopFunctor C).mapIso f
/-- An isomorphism in `Cᴹᵒᵖ` gives an isomorphism in `C`. -/
abbrev unmop {X Y : Cᴹᵒᵖ} (f : X ≅ Y) : unmop X ≅ unmop Y := (unmopFunctor C).mapIso f
end Iso
namespace IsIso
instance {X Y : C} (f : X ⟶ Y) [IsIso f] : IsIso f.mop :=
(mopFunctor C).map_isIso f
instance {X Y : Cᴹᵒᵖ} (f : X ⟶ Y) [IsIso f] : IsIso f.unmop :=
(unmopFunctor C).map_isIso f
end IsIso
variable [MonoidalCategory.{v₁} C]
open Opposite MonoidalCategory Functor LaxMonoidal OplaxMonoidal
instance monoidalCategoryOp : MonoidalCategory Cᵒᵖ where
tensorObj X Y := op (unop X ⊗ unop Y)
whiskerLeft X _ _ f := (X.unop ◁ f.unop).op
whiskerRight f X := (f.unop ▷ X.unop).op
tensorHom f g := (f.unop ⊗ₘ g.unop).op
tensorHom_def _ _ := Quiver.Hom.unop_inj (tensorHom_def' _ _)
tensorHom_comp_tensorHom _ _ _ _ := Quiver.Hom.unop_inj <| by simp
tensorUnit := op (𝟙_ C)
associator X Y Z := (α_ (unop X) (unop Y) (unop Z)).symm.op
leftUnitor X := (λ_ (unop X)).symm.op
rightUnitor X := (ρ_ (unop X)).symm.op
associator_naturality f g h := Quiver.Hom.unop_inj <| by simp
leftUnitor_naturality f := Quiver.Hom.unop_inj <| by simp
rightUnitor_naturality f := Quiver.Hom.unop_inj <| by simp
triangle X Y := Quiver.Hom.unop_inj <| by dsimp; monoidal_coherence
pentagon W X Y Z := Quiver.Hom.unop_inj <| by dsimp; monoidal_coherence
section OppositeLemmas
@[simp] lemma op_tensorObj (X Y : C) : op (X ⊗ Y) = op X ⊗ op Y := rfl
@[simp] lemma unop_tensorObj (X Y : Cᵒᵖ) : unop (X ⊗ Y) = unop X ⊗ unop Y := rfl
@[simp] lemma op_tensorUnit : op (𝟙_ C) = 𝟙_ Cᵒᵖ := rfl
@[simp] lemma unop_tensorUnit : unop (𝟙_ Cᵒᵖ) = 𝟙_ C := rfl
@[simp] lemma op_tensorHom {X₁ Y₁ X₂ Y₂ : C} (f : X₁ ⟶ Y₁) (g : X₂ ⟶ Y₂) :
(f ⊗ₘ g).op = f.op ⊗ₘ g.op := rfl
@[simp] lemma unop_tensorHom {X₁ Y₁ X₂ Y₂ : Cᵒᵖ} (f : X₁ ⟶ Y₁) (g : X₂ ⟶ Y₂) :
(f ⊗ₘ g).unop = f.unop ⊗ₘ g.unop := rfl
@[simp] lemma op_whiskerLeft (X : C) {Y Z : C} (f : Y ⟶ Z) :
(X ◁ f).op = op X ◁ f.op := rfl
@[simp] lemma unop_whiskerLeft (X : Cᵒᵖ) {Y Z : Cᵒᵖ} (f : Y ⟶ Z) :
(X ◁ f).unop = unop X ◁ f.unop := rfl
@[simp] lemma op_whiskerRight {X Y : C} (f : X ⟶ Y) (Z : C) :
(f ▷ Z).op = f.op ▷ op Z := rfl
@[simp] lemma unop_whiskerRight {X Y : Cᵒᵖ} (f : X ⟶ Y) (Z : Cᵒᵖ) :
(f ▷ Z).unop = f.unop ▷ unop Z := rfl
@[simp] lemma op_associator (X Y Z : C) :
(α_ X Y Z).op = (α_ (op X) (op Y) (op Z)).symm := rfl
@[simp] lemma unop_associator (X Y Z : Cᵒᵖ) :
(α_ X Y Z).unop = (α_ (unop X) (unop Y) (unop Z)).symm := rfl
@[simp] lemma op_hom_associator (X Y Z : C) :
(α_ X Y Z).hom.op = (α_ (op X) (op Y) (op Z)).inv := rfl
@[simp] lemma unop_hom_associator (X Y Z : Cᵒᵖ) :
(α_ X Y Z).hom.unop = (α_ (unop X) (unop Y) (unop Z)).inv := rfl
@[simp] lemma op_inv_associator (X Y Z : C) :
(α_ X Y Z).inv.op = (α_ (op X) (op Y) (op Z)).hom := rfl
@[simp] lemma unop_inv_associator (X Y Z : Cᵒᵖ) :
(α_ X Y Z).inv.unop = (α_ (unop X) (unop Y) (unop Z)).hom := rfl
@[simp] lemma op_leftUnitor (X : C) : (λ_ X).op = (λ_ (op X)).symm := rfl
@[simp] lemma unop_leftUnitor (X : Cᵒᵖ) : (λ_ X).unop = (λ_ (unop X)).symm := rfl
@[simp] lemma op_hom_leftUnitor (X : C) : (λ_ X).hom.op = (λ_ (op X)).inv := rfl
@[simp] lemma unop_hom_leftUnitor (X : Cᵒᵖ) : (λ_ X).hom.unop = (λ_ (unop X)).inv := rfl
@[simp] lemma op_inv_leftUnitor (X : C) : (λ_ X).inv.op = (λ_ (op X)).hom := rfl
@[simp] lemma unop_inv_leftUnitor (X : Cᵒᵖ) : (λ_ X).inv.unop = (λ_ (unop X)).hom := rfl
@[simp] lemma op_rightUnitor (X : C) : (ρ_ X).op = (ρ_ (op X)).symm := rfl
@[simp] lemma unop_rightUnitor (X : Cᵒᵖ) : (ρ_ X).unop = (ρ_ (unop X)).symm := rfl
@[simp] lemma op_hom_rightUnitor (X : C) : (ρ_ X).hom.op = (ρ_ (op X)).inv := rfl
@[simp] lemma unop_hom_rightUnitor (X : Cᵒᵖ) : (ρ_ X).hom.unop = (ρ_ (unop X)).inv := rfl
@[simp] lemma op_inv_rightUnitor (X : C) : (ρ_ X).inv.op = (ρ_ (op X)).hom := rfl
@[simp] lemma unop_inv_rightUnitor (X : Cᵒᵖ) : (ρ_ X).inv.unop = (ρ_ (unop X)).hom := rfl
end OppositeLemmas
theorem op_tensor_op {W X Y Z : C} (f : W ⟶ X) (g : Y ⟶ Z) : f.op ⊗ₘ g.op = (f ⊗ₘ g).op := rfl
theorem unop_tensor_unop {W X Y Z : Cᵒᵖ} (f : W ⟶ X) (g : Y ⟶ Z) :
f.unop ⊗ₘ g.unop = (f ⊗ₘ g).unop := rfl
instance monoidalCategoryMop : MonoidalCategory Cᴹᵒᵖ where
tensorObj X Y := mop (unmop Y ⊗ unmop X)
whiskerLeft X _ _ f := (f.unmop ▷ X.unmop).mop
whiskerRight f X := (X.unmop ◁ f.unmop).mop
tensorHom f g := (g.unmop ⊗ₘ f.unmop).mop
tensorHom_def _ _ := Quiver.Hom.unmop_inj (tensorHom_def' _ _)
tensorHom_comp_tensorHom _ _ _ _ := Quiver.Hom.unmop_inj <| by simp
tensorUnit := mop (𝟙_ C)
associator X Y Z := (α_ (unmop Z) (unmop Y) (unmop X)).symm.mop
leftUnitor X := (ρ_ (unmop X)).mop
rightUnitor X := (λ_ (unmop X)).mop
associator_naturality f g h := Quiver.Hom.unmop_inj <| by simp
leftUnitor_naturality f := Quiver.Hom.unmop_inj <| by simp
rightUnitor_naturality f := Quiver.Hom.unmop_inj <| by simp
triangle X Y := Quiver.Hom.unmop_inj <| by dsimp; monoidal_coherence
pentagon W X Y Z := Quiver.Hom.unmop_inj <| by dsimp; monoidal_coherence
-- it would be nice if we could autogenerate all of these somehow
section MonoidalOppositeLemmas
@[simp] lemma mop_tensorObj (X Y : C) : mop (X ⊗ Y) = mop Y ⊗ mop X := rfl
@[simp] lemma unmop_tensorObj (X Y : Cᴹᵒᵖ) : unmop (X ⊗ Y) = unmop Y ⊗ unmop X := rfl
@[simp] lemma mop_tensorUnit : mop (𝟙_ C) = 𝟙_ Cᴹᵒᵖ := rfl
@[simp] lemma unmop_tensorUnit : unmop (𝟙_ Cᴹᵒᵖ) = 𝟙_ C := rfl
@[simp] lemma mop_tensorHom {X₁ Y₁ X₂ Y₂ : C} (f : X₁ ⟶ Y₁) (g : X₂ ⟶ Y₂) :
(f ⊗ₘ g).mop = g.mop ⊗ₘ f.mop := rfl
@[simp] lemma unmop_tensorHom {X₁ Y₁ X₂ Y₂ : Cᴹᵒᵖ} (f : X₁ ⟶ Y₁) (g : X₂ ⟶ Y₂) :
(f ⊗ₘ g).unmop = g.unmop ⊗ₘ f.unmop := rfl
@[simp] lemma mop_whiskerLeft (X : C) {Y Z : C} (f : Y ⟶ Z) :
(X ◁ f).mop = f.mop ▷ mop X := rfl
@[simp] lemma unmop_whiskerLeft (X : Cᴹᵒᵖ) {Y Z : Cᴹᵒᵖ} (f : Y ⟶ Z) :
(X ◁ f).unmop = f.unmop ▷ unmop X := rfl
@[simp] lemma mop_whiskerRight {X Y : C} (f : X ⟶ Y) (Z : C) :
(f ▷ Z).mop = mop Z ◁ f.mop := rfl
@[simp] lemma unmop_whiskerRight {X Y : Cᴹᵒᵖ} (f : X ⟶ Y) (Z : Cᴹᵒᵖ) :
(f ▷ Z).unmop = unmop Z ◁ f.unmop := rfl
@[simp] lemma mop_associator (X Y Z : C) :
(α_ X Y Z).mop = (α_ (mop Z) (mop Y) (mop X)).symm := rfl
@[simp] lemma unmop_associator (X Y Z : Cᴹᵒᵖ) :
(α_ X Y Z).unmop = (α_ (unmop Z) (unmop Y) (unmop X)).symm := rfl
@[simp] lemma mop_hom_associator (X Y Z : C) :
(α_ X Y Z).hom.mop = (α_ (mop Z) (mop Y) (mop X)).inv := rfl
@[simp] lemma unmop_hom_associator (X Y Z : Cᴹᵒᵖ) :
(α_ X Y Z).hom.unmop = (α_ (unmop Z) (unmop Y) (unmop X)).inv := rfl
@[simp] lemma mop_inv_associator (X Y Z : C) :
(α_ X Y Z).inv.mop = (α_ (mop Z) (mop Y) (mop X)).hom := rfl
@[simp] lemma unmop_inv_associator (X Y Z : Cᴹᵒᵖ) :
(α_ X Y Z).inv.unmop = (α_ (unmop Z) (unmop Y) (unmop X)).hom := rfl
@[simp] lemma mop_leftUnitor (X : C) : (λ_ X).mop = (ρ_ (mop X)) := rfl
@[simp] lemma unmop_leftUnitor (X : Cᴹᵒᵖ) : (λ_ X).unmop = ρ_ (unmop X) := rfl
@[simp] lemma mop_hom_leftUnitor (X : C) : (λ_ X).hom.mop = (ρ_ (mop X)).hom := rfl
@[simp] lemma unmop_hom_leftUnitor (X : Cᴹᵒᵖ) : (λ_ X).hom.unmop = (ρ_ (unmop X)).hom := rfl
@[simp] lemma mop_inv_leftUnitor (X : C) : (λ_ X).inv.mop = (ρ_ (mop X)).inv := rfl
@[simp] lemma unmop_inv_leftUnitor (X : Cᴹᵒᵖ) : (λ_ X).inv.unmop = (ρ_ (unmop X)).inv := rfl
@[simp] lemma mop_rightUnitor (X : C) : (ρ_ X).mop = (λ_ (mop X)) := rfl
@[simp] lemma unmop_rightUnitor (X : Cᴹᵒᵖ) : (ρ_ X).unmop = λ_ (unmop X) := rfl
@[simp] lemma mop_hom_rightUnitor (X : C) : (ρ_ X).hom.mop = (λ_ (mop X)).hom := rfl
@[simp] lemma unmop_hom_rightUnitor (X : Cᴹᵒᵖ) : (ρ_ X).hom.unmop = (λ_ (unmop X)).hom := rfl
@[simp] lemma mop_inv_rightUnitor (X : C) : (ρ_ X).inv.mop = (λ_ (mop X)).inv := rfl
@[simp] lemma unmop_inv_rightUnitor (X : Cᴹᵒᵖ) : (ρ_ X).inv.unmop = (λ_ (unmop X)).inv := rfl
end MonoidalOppositeLemmas
variable (C)
/-- The (identity) equivalence between `C` and its monoidal opposite. -/
@[simps] def MonoidalOpposite.mopEquiv : C ≌ Cᴹᵒᵖ where
functor := mopFunctor C
inverse := unmopFunctor C
unitIso := Iso.refl _
counitIso := Iso.refl _
/-- The (identity) equivalence between `Cᴹᵒᵖ` and `C`. -/
@[simps!] def MonoidalOpposite.unmopEquiv : Cᴹᵒᵖ ≌ C := (mopEquiv C).symm
/-- The equivalence between `C` and its monoidal opposite's monoidal opposite. -/
@[simps!] def MonoidalOpposite.mopMopEquivalence : Cᴹᵒᵖᴹᵒᵖ ≌ C :=
.trans (MonoidalOpposite.unmopEquiv Cᴹᵒᵖ) (MonoidalOpposite.unmopEquiv C)
@[simps!]
instance MonoidalOpposite.mopMopEquivalenceFunctorMonoidal :
(MonoidalOpposite.mopMopEquivalence C).functor.Monoidal where
ε := 𝟙 _
δ X Y := 𝟙 _
μ X Y := 𝟙 _
η := 𝟙 _
ε_η := Category.comp_id _
η_ε := Category.comp_id _
μ_δ X Y := Category.comp_id _
δ_μ X Y := Category.comp_id _
@[simps!]
instance MonoidalOpposite.mopMopEquivalenceInverseMonoidal :
(MonoidalOpposite.mopMopEquivalence C).inverse.Monoidal where
ε := 𝟙 _
δ X Y := 𝟙 _
μ X Y := 𝟙 _
η := 𝟙 _
ε_η := Category.comp_id _
η_ε := Category.comp_id _
μ_δ X Y := Category.comp_id _
δ_μ X Y := Category.comp_id _
instance : (mopMopEquivalence C).IsMonoidal where
leftAdjoint_ε := by
simp [ε, η, Adjunction.homEquiv, mopMopEquivalence, Equivalence.trans, unmopEquiv, ε]
leftAdjoint_μ X Y := by
simp [μ, δ, Adjunction.homEquiv, mopMopEquivalence, Equivalence.trans, unmopEquiv, μ]
/-- The identification `mop X ⊗ mop Y = mop (Y ⊗ X)` as a natural isomorphism. -/
@[simps!]
def MonoidalOpposite.tensorIso :
tensor Cᴹᵒᵖ ≅ (unmopFunctor C).prod (unmopFunctor C) ⋙
Prod.swap C C ⋙ tensor C ⋙ mopFunctor C :=
Iso.refl _
variable {C}
/-- The identification `X ⊗ - = mop (- ⊗ unmop X)` as a natural isomorphism. -/
@[simps!]
def MonoidalOpposite.tensorLeftIso (X : Cᴹᵒᵖ) :
tensorLeft X ≅ unmopFunctor C ⋙ tensorRight (unmop X) ⋙ mopFunctor C :=
Iso.refl _
/-- The identification `mop X ⊗ - = mop (- ⊗ X)` as a natural isomorphism. -/
@[simps!]
def MonoidalOpposite.tensorLeftMopIso (X : C) :
tensorLeft (mop X) ≅ unmopFunctor C ⋙ tensorRight X ⋙ mopFunctor C :=
Iso.refl _
/-- The identification `unmop X ⊗ - = unmop (mop - ⊗ X)` as a natural isomorphism. -/
@[simps!]
def MonoidalOpposite.tensorLeftUnmopIso (X : Cᴹᵒᵖ) :
tensorLeft (unmop X) ≅ mopFunctor C ⋙ tensorRight X ⋙ unmopFunctor C :=
Iso.refl _
/-- The identification `- ⊗ X = mop (unmop X ⊗ -)` as a natural isomorphism. -/
@[simps!]
def MonoidalOpposite.tensorRightIso (X : Cᴹᵒᵖ) :
tensorRight X ≅ unmopFunctor C ⋙ tensorLeft (unmop X) ⋙ mopFunctor C :=
Iso.refl _
/-- The identification `- ⊗ mop X = mop (- ⊗ unmop X)` as a natural isomorphism. -/
@[simps!]
def MonoidalOpposite.tensorRightMopIso (X : C) :
tensorRight (mop X) ≅ unmopFunctor C ⋙ tensorLeft X ⋙ mopFunctor C :=
Iso.refl _
/-- The identification `- ⊗ unmop X = unmop (X ⊗ mop -)` as a natural isomorphism. -/
@[simps!]
def MonoidalOpposite.tensorRightUnmopIso (X : Cᴹᵒᵖ) :
tensorRight (unmop X) ≅ mopFunctor C ⋙ tensorLeft X ⋙ unmopFunctor C :=
Iso.refl _
@[simps]
instance monoidalOpOp : (opOp C).Monoidal where
ε := 𝟙 _
η := 𝟙 _
μ X Y := 𝟙 _
δ X Y := 𝟙 _
ε_η := Category.comp_id _
η_ε := Category.comp_id _
μ_δ X Y := Category.comp_id _
δ_μ X Y := Category.comp_id _
@[simps]
instance monoidalUnopUnop : (unopUnop C).Monoidal where
ε := 𝟙 _
η := 𝟙 _
μ X Y := 𝟙 _
δ X Y := 𝟙 _
ε_η := Category.comp_id _
η_ε := Category.comp_id _
μ_δ X Y := Category.comp_id _
δ_μ X Y := Category.comp_id _
instance : (opOpEquivalence C).functor.Monoidal := monoidalUnopUnop
instance : (opOpEquivalence C).inverse.Monoidal := monoidalOpOp
@[deprecated (since := "2025-06-08")] alias opOp_ε := monoidalOpOp_ε
@[deprecated (since := "2025-06-08")] alias opOp_η := monoidalOpOp_η
@[deprecated (since := "2025-06-08")] alias unopUnop_ε := monoidalUnopUnop_ε
@[deprecated (since := "2025-06-08")] alias unopUnop_η := monoidalUnopUnop_η
@[deprecated (since := "2025-06-08")] alias opOp_μ := monoidalOpOp_μ
@[deprecated (since := "2025-06-08")] alias opOp_δ := monoidalOpOp_δ
@[deprecated (since := "2025-06-08")] alias unopUnop_μ := monoidalUnopUnop_μ
@[deprecated (since := "2025-06-08")] alias unopUnop_δ := monoidalUnopUnop_δ
instance : (opOpEquivalence C).IsMonoidal where
leftAdjoint_ε := by simp [Adjunction.homEquiv, opOpEquivalence]
leftAdjoint_μ := by simp [Adjunction.homEquiv, opOpEquivalence]
end CategoryTheory |
.lake/packages/mathlib/Mathlib/CategoryTheory/Monoidal/Category.lean | import Mathlib.CategoryTheory.EqToHom
import Mathlib.CategoryTheory.Functor.Trifunctor
import Mathlib.CategoryTheory.Products.Basic
/-!
# Monoidal categories
A monoidal category is a category equipped with a tensor product, unitors, and an associator.
In the definition, we provide the tensor product as a pair of functions
* `tensorObj : C → C → C`
* `tensorHom : (X₁ ⟶ Y₁) → (X₂ ⟶ Y₂) → ((X₁ ⊗ X₂) ⟶ (Y₁ ⊗ Y₂))`
and allow use of the overloaded notation `⊗` for both.
The unitors and associator are provided componentwise.
The tensor product can be expressed as a functor via `tensor : C × C ⥤ C`.
The unitors and associator are gathered together as natural
isomorphisms in `leftUnitor_nat_iso`, `rightUnitor_nat_iso` and `associator_nat_iso`.
Some consequences of the definition are proved in other files after proving the coherence theorem,
e.g. `(λ_ (𝟙_ C)).hom = (ρ_ (𝟙_ C)).hom` in `CategoryTheory.Monoidal.CoherenceLemmas`.
## Implementation notes
In the definition of monoidal categories, we also provide the whiskering operators:
* `whiskerLeft (X : C) {Y₁ Y₂ : C} (f : Y₁ ⟶ Y₂) : X ⊗ Y₁ ⟶ X ⊗ Y₂`, denoted by `X ◁ f`,
* `whiskerRight {X₁ X₂ : C} (f : X₁ ⟶ X₂) (Y : C) : X₁ ⊗ Y ⟶ X₂ ⊗ Y`, denoted by `f ▷ Y`.
These are products of an object and a morphism (the terminology "whiskering"
is borrowed from 2-category theory). The tensor product of morphisms `tensorHom` can be defined
in terms of the whiskerings. There are two possible such definitions, which are related by
the exchange property of the whiskerings. These two definitions are accessed by `tensorHom_def`
and `tensorHom_def'`. By default, `tensorHom` is defined so that `tensorHom_def` holds
definitionally.
If you want to provide `tensorHom` and define `whiskerLeft` and `whiskerRight` in terms of it,
you can use the alternative constructor `CategoryTheory.MonoidalCategory.ofTensorHom`.
The whiskerings are useful when considering simp-normal forms of morphisms in monoidal categories.
### Simp-normal form for morphisms
Rewriting involving associators and unitors could be very complicated. We try to ease this
complexity by putting carefully chosen simp lemmas that rewrite any morphisms into the simp-normal
form defined below. Rewriting into simp-normal form is especially useful in preprocessing
performed by the `coherence` tactic.
The simp-normal form of morphisms is defined to be an expression that has the minimal number of
parentheses. More precisely,
1. it is a composition of morphisms like `f₁ ≫ f₂ ≫ f₃ ≫ f₄ ≫ f₅` such that each `fᵢ` is
either a structural morphism (morphisms made up only of identities, associators, unitors)
or a non-structural morphism, and
2. each non-structural morphism in the composition is of the form `X₁ ◁ X₂ ◁ X₃ ◁ f ▷ X₄ ▷ X₅`,
where each `Xᵢ` is an object that is not the identity or a tensor and `f` is a non-structural
morphism that is not the identity or a composite.
Note that `X₁ ◁ X₂ ◁ X₃ ◁ f ▷ X₄ ▷ X₅` is actually `X₁ ◁ (X₂ ◁ (X₃ ◁ ((f ▷ X₄) ▷ X₅)))`.
Currently, the simp lemmas don't rewrite `𝟙 X ⊗ₘ f` and `f ⊗ₘ 𝟙 Y` into `X ◁ f` and `f ▷ Y`,
respectively, since it requires a huge refactoring. We hope to add these simp lemmas soon.
## References
* Tensor categories, Etingof, Gelaki, Nikshych, Ostrik,
http://www-math.mit.edu/~etingof/egnobookfinal.pdf
* <https://stacks.math.columbia.edu/tag/0FFK>.
-/
universe v u
open CategoryTheory.Category
open CategoryTheory.Iso
namespace CategoryTheory
/-- Auxiliary structure to carry only the data fields of (and provide notation for)
`MonoidalCategory`. -/
class MonoidalCategoryStruct (C : Type u) [𝒞 : Category.{v} C] where
/-- curried tensor product of objects -/
tensorObj : C → C → C
/-- left whiskering for morphisms -/
whiskerLeft (X : C) {Y₁ Y₂ : C} (f : Y₁ ⟶ Y₂) : tensorObj X Y₁ ⟶ tensorObj X Y₂
/-- right whiskering for morphisms -/
whiskerRight {X₁ X₂ : C} (f : X₁ ⟶ X₂) (Y : C) : tensorObj X₁ Y ⟶ tensorObj X₂ Y
/-- Tensor product of identity maps is the identity: `𝟙 X₁ ⊗ₘ 𝟙 X₂ = 𝟙 (X₁ ⊗ X₂)` -/
-- By default, it is defined in terms of whiskerings.
tensorHom {X₁ Y₁ X₂ Y₂ : C} (f : X₁ ⟶ Y₁) (g : X₂ ⟶ Y₂) : (tensorObj X₁ X₂ ⟶ tensorObj Y₁ Y₂) :=
whiskerRight f X₂ ≫ whiskerLeft Y₁ g
/-- The tensor unity in the monoidal structure `𝟙_ C` -/
tensorUnit (C) : C
/-- The associator isomorphism `(X ⊗ Y) ⊗ Z ≃ X ⊗ (Y ⊗ Z)` -/
associator : ∀ X Y Z : C, tensorObj (tensorObj X Y) Z ≅ tensorObj X (tensorObj Y Z)
/-- The left unitor: `𝟙_ C ⊗ X ≃ X` -/
leftUnitor : ∀ X : C, tensorObj tensorUnit X ≅ X
/-- The right unitor: `X ⊗ 𝟙_ C ≃ X` -/
rightUnitor : ∀ X : C, tensorObj X tensorUnit ≅ X
namespace MonoidalCategory
export MonoidalCategoryStruct
(tensorObj whiskerLeft whiskerRight tensorHom tensorUnit associator leftUnitor rightUnitor)
end MonoidalCategory
namespace MonoidalCategory
/-- Notation for `tensorObj`, the tensor product of objects in a monoidal category -/
scoped infixr:70 " ⊗ " => MonoidalCategoryStruct.tensorObj
/-- Notation for the `whiskerLeft` operator of monoidal categories -/
scoped infixr:81 " ◁ " => MonoidalCategoryStruct.whiskerLeft
/-- Notation for the `whiskerRight` operator of monoidal categories -/
scoped infixl:81 " ▷ " => MonoidalCategoryStruct.whiskerRight
/-- Notation for `tensorHom`, the tensor product of morphisms in a monoidal category -/
scoped infixr:70 " ⊗ₘ " => MonoidalCategoryStruct.tensorHom
-- TODO: Try setting this notation to `⊗` if the elaborator is improved and performs
-- better than currently on overloaded notations.
/-- Notation for `tensorUnit`, the two-sided identity of `⊗` -/
scoped notation "𝟙_ " C:arg => MonoidalCategoryStruct.tensorUnit C
/-- Notation for the monoidal `associator`: `(X ⊗ Y) ⊗ Z ≃ X ⊗ (Y ⊗ Z)` -/
scoped notation "α_" => MonoidalCategoryStruct.associator
/-- Notation for the `leftUnitor`: `𝟙_C ⊗ X ≃ X` -/
scoped notation "λ_" => MonoidalCategoryStruct.leftUnitor
/-- Notation for the `rightUnitor`: `X ⊗ 𝟙_C ≃ X` -/
scoped notation "ρ_" => MonoidalCategoryStruct.rightUnitor
/-- The property that the pentagon relation is satisfied by four objects
in a category equipped with a `MonoidalCategoryStruct`. -/
def Pentagon {C : Type u} [Category.{v} C] [MonoidalCategoryStruct C]
(Y₁ Y₂ Y₃ Y₄ : C) : Prop :=
(α_ Y₁ Y₂ Y₃).hom ▷ Y₄ ≫ (α_ Y₁ (Y₂ ⊗ Y₃) Y₄).hom ≫ Y₁ ◁ (α_ Y₂ Y₃ Y₄).hom =
(α_ (Y₁ ⊗ Y₂) Y₃ Y₄).hom ≫ (α_ Y₁ Y₂ (Y₃ ⊗ Y₄)).hom
end MonoidalCategory
open MonoidalCategory
/--
In a monoidal category, we can take the tensor product of objects, `X ⊗ Y` and of morphisms
`f ⊗ₘ g`.
Tensor product does not need to be strictly associative on objects, but there is a
specified associator, `α_ X Y Z : (X ⊗ Y) ⊗ Z ≅ X ⊗ (Y ⊗ Z)`. There is a tensor unit `𝟙_ C`,
with specified left and right unitor isomorphisms `λ_ X : 𝟙_ C ⊗ X ≅ X` and `ρ_ X : X ⊗ 𝟙_ C ≅ X`.
These associators and unitors satisfy the pentagon and triangle equations. -/
@[stacks 0FFK]
-- Porting note: The Mathport did not translate the temporary notation
class MonoidalCategory (C : Type u) [𝒞 : Category.{v} C] extends MonoidalCategoryStruct C where
tensorHom_def {X₁ Y₁ X₂ Y₂ : C} (f : X₁ ⟶ Y₁) (g : X₂ ⟶ Y₂) :
f ⊗ₘ g = (f ▷ X₂) ≫ (Y₁ ◁ g) := by
cat_disch
/-- Tensor product of identity maps is the identity: `𝟙 X₁ ⊗ₘ 𝟙 X₂ = 𝟙 (X₁ ⊗ X₂)` -/
id_tensorHom_id : ∀ X₁ X₂ : C, 𝟙 X₁ ⊗ₘ 𝟙 X₂ = 𝟙 (X₁ ⊗ X₂) := by cat_disch
/--
Composition of tensor products is tensor product of compositions:
`(f₁ ⊗ₘ f₂) ≫ (g₁ ⊗ₘ g₂) = (f₁ ≫ g₁) ⊗ₘ (f₂ ≫ g₂)`
-/
tensorHom_comp_tensorHom :
∀ {X₁ Y₁ Z₁ X₂ Y₂ Z₂ : C} (f₁ : X₁ ⟶ Y₁) (f₂ : X₂ ⟶ Y₂) (g₁ : Y₁ ⟶ Z₁) (g₂ : Y₂ ⟶ Z₂),
(f₁ ⊗ₘ f₂) ≫ (g₁ ⊗ₘ g₂) = (f₁ ≫ g₁) ⊗ₘ (f₂ ≫ g₂) := by
cat_disch
whiskerLeft_id : ∀ (X Y : C), X ◁ 𝟙 Y = 𝟙 (X ⊗ Y) := by
cat_disch
id_whiskerRight : ∀ (X Y : C), 𝟙 X ▷ Y = 𝟙 (X ⊗ Y) := by
cat_disch
/-- Naturality of the associator isomorphism: `(f₁ ⊗ₘ f₂) ⊗ₘ f₃ ≃ f₁ ⊗ₘ (f₂ ⊗ₘ f₃)` -/
associator_naturality :
∀ {X₁ X₂ X₃ Y₁ Y₂ Y₃ : C} (f₁ : X₁ ⟶ Y₁) (f₂ : X₂ ⟶ Y₂) (f₃ : X₃ ⟶ Y₃),
((f₁ ⊗ₘ f₂) ⊗ₘ f₃) ≫ (α_ Y₁ Y₂ Y₃).hom = (α_ X₁ X₂ X₃).hom ≫ (f₁ ⊗ₘ (f₂ ⊗ₘ f₃)) := by
cat_disch
/--
Naturality of the left unitor, commutativity of `𝟙_ C ⊗ X ⟶ 𝟙_ C ⊗ Y ⟶ Y` and `𝟙_ C ⊗ X ⟶ X ⟶ Y`
-/
leftUnitor_naturality :
∀ {X Y : C} (f : X ⟶ Y), 𝟙_ _ ◁ f ≫ (λ_ Y).hom = (λ_ X).hom ≫ f := by
cat_disch
/--
Naturality of the right unitor: commutativity of `X ⊗ 𝟙_ C ⟶ Y ⊗ 𝟙_ C ⟶ Y` and `X ⊗ 𝟙_ C ⟶ X ⟶ Y`
-/
rightUnitor_naturality :
∀ {X Y : C} (f : X ⟶ Y), f ▷ 𝟙_ _ ≫ (ρ_ Y).hom = (ρ_ X).hom ≫ f := by
cat_disch
/--
The pentagon identity relating the isomorphism between `X ⊗ (Y ⊗ (Z ⊗ W))` and `((X ⊗ Y) ⊗ Z) ⊗ W`
-/
pentagon :
∀ W X Y Z : C,
(α_ W X Y).hom ▷ Z ≫ (α_ W (X ⊗ Y) Z).hom ≫ W ◁ (α_ X Y Z).hom =
(α_ (W ⊗ X) Y Z).hom ≫ (α_ W X (Y ⊗ Z)).hom := by
cat_disch
/--
The identity relating the isomorphisms between `X ⊗ (𝟙_ C ⊗ Y)`, `(X ⊗ 𝟙_ C) ⊗ Y` and `X ⊗ Y`
-/
triangle :
∀ X Y : C, (α_ X (𝟙_ _) Y).hom ≫ X ◁ (λ_ Y).hom = (ρ_ X).hom ▷ Y := by
cat_disch
attribute [reassoc] MonoidalCategory.tensorHom_def
attribute [reassoc, simp] MonoidalCategory.whiskerLeft_id
attribute [reassoc, simp] MonoidalCategory.id_whiskerRight
attribute [reassoc (attr := simp)] MonoidalCategory.tensorHom_comp_tensorHom
attribute [reassoc] MonoidalCategory.associator_naturality
attribute [reassoc] MonoidalCategory.leftUnitor_naturality
attribute [reassoc] MonoidalCategory.rightUnitor_naturality
attribute [reassoc (attr := simp)] MonoidalCategory.pentagon
attribute [reassoc (attr := simp)] MonoidalCategory.triangle
namespace MonoidalCategory
variable {C : Type u} [𝒞 : Category.{v} C] [MonoidalCategory C]
@[simp]
theorem id_tensorHom (X : C) {Y₁ Y₂ : C} (f : Y₁ ⟶ Y₂) :
𝟙 X ⊗ₘ f = X ◁ f := by
simp [tensorHom_def]
@[simp]
theorem tensorHom_id {X₁ X₂ : C} (f : X₁ ⟶ X₂) (Y : C) :
f ⊗ₘ 𝟙 Y = f ▷ Y := by
simp [tensorHom_def]
@[reassoc, simp]
theorem whiskerLeft_comp (W : C) {X Y Z : C} (f : X ⟶ Y) (g : Y ⟶ Z) :
W ◁ (f ≫ g) = W ◁ f ≫ W ◁ g := by
simp [← id_tensorHom]
@[reassoc, simp]
theorem id_whiskerLeft {X Y : C} (f : X ⟶ Y) :
𝟙_ C ◁ f = (λ_ X).hom ≫ f ≫ (λ_ Y).inv := by
rw [← assoc, ← leftUnitor_naturality]; simp
@[reassoc, simp]
theorem tensor_whiskerLeft (X Y : C) {Z Z' : C} (f : Z ⟶ Z') :
(X ⊗ Y) ◁ f = (α_ X Y Z).hom ≫ X ◁ Y ◁ f ≫ (α_ X Y Z').inv := by
simp only [← id_tensorHom]
rw [← assoc, ← associator_naturality]
simp
@[reassoc, simp]
theorem comp_whiskerRight {W X Y : C} (f : W ⟶ X) (g : X ⟶ Y) (Z : C) :
(f ≫ g) ▷ Z = f ▷ Z ≫ g ▷ Z := by
simp [← tensorHom_id]
@[reassoc, simp]
theorem whiskerRight_id {X Y : C} (f : X ⟶ Y) :
f ▷ 𝟙_ C = (ρ_ X).hom ≫ f ≫ (ρ_ Y).inv := by
rw [← assoc, ← rightUnitor_naturality]; simp
@[reassoc, simp]
theorem whiskerRight_tensor {X X' : C} (f : X ⟶ X') (Y Z : C) :
f ▷ (Y ⊗ Z) = (α_ X Y Z).inv ≫ f ▷ Y ▷ Z ≫ (α_ X' Y Z).hom := by
simp only [← tensorHom_id]
rw [associator_naturality]
simp
@[reassoc, simp]
theorem whisker_assoc (X : C) {Y Y' : C} (f : Y ⟶ Y') (Z : C) :
(X ◁ f) ▷ Z = (α_ X Y Z).hom ≫ X ◁ f ▷ Z ≫ (α_ X Y' Z).inv := by
simp only [← id_tensorHom, ← tensorHom_id]
rw [← assoc, ← associator_naturality]
simp
@[reassoc]
theorem whisker_exchange {W X Y Z : C} (f : W ⟶ X) (g : Y ⟶ Z) :
W ◁ g ≫ f ▷ Z = f ▷ Y ≫ X ◁ g := by
simp [← id_tensorHom, ← tensorHom_id]
@[reassoc]
theorem tensorHom_def' {X₁ Y₁ X₂ Y₂ : C} (f : X₁ ⟶ Y₁) (g : X₂ ⟶ Y₂) :
f ⊗ₘ g = X₁ ◁ g ≫ f ▷ Y₂ :=
whisker_exchange f g ▸ tensorHom_def f g
@[reassoc]
theorem whiskerLeft_comp_tensorHom {V W X Y Z : C} (f : V ⟶ W) (g : X ⟶ Y) (h : Y ⟶ Z) :
(V ◁ g) ≫ (f ⊗ₘ h) = f ⊗ₘ (g ≫ h) := by
simp [tensorHom_def']
@[reassoc]
theorem whiskerRight_comp_tensorHom {V W X Y Z : C} (f : X ⟶ Y) (g : Y ⟶ Z) (h : V ⟶ W) :
(f ▷ V) ≫ (g ⊗ₘ h) = (f ≫ g) ⊗ₘ h := by
simp [tensorHom_def]
@[reassoc]
theorem tensorHom_comp_whiskerLeft {V W X Y Z : C} (f : V ⟶ W) (g : X ⟶ Y) (h : Y ⟶ Z) :
(f ⊗ₘ g) ≫ (W ◁ h) = f ⊗ₘ (g ≫ h) := by
simp [tensorHom_def]
@[reassoc]
theorem tensorHom_comp_whiskerRight {V W X Y Z : C} (f : X ⟶ Y) (g : Y ⟶ Z) (h : V ⟶ W) :
(f ⊗ₘ h) ≫ (g ▷ W) = (f ≫ g) ⊗ₘ h := by
simp [tensorHom_def, whisker_exchange]
@[reassoc] lemma leftUnitor_inv_comp_tensorHom {X Y Z : C} (f : 𝟙_ C ⟶ Y) (g : X ⟶ Z) :
(λ_ X).inv ≫ (f ⊗ₘ g) = g ≫ (λ_ Z).inv ≫ f ▷ Z := by simp [tensorHom_def']
@[reassoc] lemma rightUnitor_inv_comp_tensorHom {X Y Z : C} (f : X ⟶ Y) (g : 𝟙_ C ⟶ Z) :
(ρ_ X).inv ≫ (f ⊗ₘ g) = f ≫ (ρ_ Y).inv ≫ Y ◁ g := by simp [tensorHom_def]
@[reassoc (attr := simp)]
theorem whiskerLeft_hom_inv (X : C) {Y Z : C} (f : Y ≅ Z) :
X ◁ f.hom ≫ X ◁ f.inv = 𝟙 (X ⊗ Y) := by
rw [← whiskerLeft_comp, hom_inv_id, whiskerLeft_id]
@[reassoc (attr := simp)]
theorem hom_inv_whiskerRight {X Y : C} (f : X ≅ Y) (Z : C) :
f.hom ▷ Z ≫ f.inv ▷ Z = 𝟙 (X ⊗ Z) := by
rw [← comp_whiskerRight, hom_inv_id, id_whiskerRight]
@[reassoc (attr := simp)]
theorem whiskerLeft_inv_hom (X : C) {Y Z : C} (f : Y ≅ Z) :
X ◁ f.inv ≫ X ◁ f.hom = 𝟙 (X ⊗ Z) := by
rw [← whiskerLeft_comp, inv_hom_id, whiskerLeft_id]
@[reassoc (attr := simp)]
theorem inv_hom_whiskerRight {X Y : C} (f : X ≅ Y) (Z : C) :
f.inv ▷ Z ≫ f.hom ▷ Z = 𝟙 (Y ⊗ Z) := by
rw [← comp_whiskerRight, inv_hom_id, id_whiskerRight]
@[reassoc (attr := simp)]
theorem whiskerLeft_hom_inv' (X : C) {Y Z : C} (f : Y ⟶ Z) [IsIso f] :
X ◁ f ≫ X ◁ inv f = 𝟙 (X ⊗ Y) := by
rw [← whiskerLeft_comp, IsIso.hom_inv_id, whiskerLeft_id]
@[reassoc (attr := simp)]
theorem hom_inv_whiskerRight' {X Y : C} (f : X ⟶ Y) [IsIso f] (Z : C) :
f ▷ Z ≫ inv f ▷ Z = 𝟙 (X ⊗ Z) := by
rw [← comp_whiskerRight, IsIso.hom_inv_id, id_whiskerRight]
@[reassoc (attr := simp)]
theorem whiskerLeft_inv_hom' (X : C) {Y Z : C} (f : Y ⟶ Z) [IsIso f] :
X ◁ inv f ≫ X ◁ f = 𝟙 (X ⊗ Z) := by
rw [← whiskerLeft_comp, IsIso.inv_hom_id, whiskerLeft_id]
@[reassoc (attr := simp)]
theorem inv_hom_whiskerRight' {X Y : C} (f : X ⟶ Y) [IsIso f] (Z : C) :
inv f ▷ Z ≫ f ▷ Z = 𝟙 (Y ⊗ Z) := by
rw [← comp_whiskerRight, IsIso.inv_hom_id, id_whiskerRight]
/-- The left whiskering of an isomorphism is an isomorphism. -/
@[simps]
def whiskerLeftIso (X : C) {Y Z : C} (f : Y ≅ Z) : X ⊗ Y ≅ X ⊗ Z where
hom := X ◁ f.hom
inv := X ◁ f.inv
instance whiskerLeft_isIso (X : C) {Y Z : C} (f : Y ⟶ Z) [IsIso f] : IsIso (X ◁ f) :=
(whiskerLeftIso X (asIso f)).isIso_hom
@[simp]
theorem inv_whiskerLeft (X : C) {Y Z : C} (f : Y ⟶ Z) [IsIso f] :
inv (X ◁ f) = X ◁ inv f := by
cat_disch
@[simp]
lemma whiskerLeftIso_refl (W X : C) :
whiskerLeftIso W (Iso.refl X) = Iso.refl (W ⊗ X) :=
Iso.ext (whiskerLeft_id W X)
@[simp]
lemma whiskerLeftIso_trans (W : C) {X Y Z : C} (f : X ≅ Y) (g : Y ≅ Z) :
whiskerLeftIso W (f ≪≫ g) = whiskerLeftIso W f ≪≫ whiskerLeftIso W g :=
Iso.ext (whiskerLeft_comp W f.hom g.hom)
@[simp]
lemma whiskerLeftIso_symm (W : C) {X Y : C} (f : X ≅ Y) :
(whiskerLeftIso W f).symm = whiskerLeftIso W f.symm := rfl
/-- The right whiskering of an isomorphism is an isomorphism. -/
@[simps!]
def whiskerRightIso {X Y : C} (f : X ≅ Y) (Z : C) : X ⊗ Z ≅ Y ⊗ Z where
hom := f.hom ▷ Z
inv := f.inv ▷ Z
instance whiskerRight_isIso {X Y : C} (f : X ⟶ Y) (Z : C) [IsIso f] : IsIso (f ▷ Z) :=
(whiskerRightIso (asIso f) Z).isIso_hom
@[simp]
theorem inv_whiskerRight {X Y : C} (f : X ⟶ Y) (Z : C) [IsIso f] :
inv (f ▷ Z) = inv f ▷ Z := by
cat_disch
@[simp]
lemma whiskerRightIso_refl (X W : C) :
whiskerRightIso (Iso.refl X) W = Iso.refl (X ⊗ W) :=
Iso.ext (id_whiskerRight X W)
@[simp]
lemma whiskerRightIso_trans {X Y Z : C} (f : X ≅ Y) (g : Y ≅ Z) (W : C) :
whiskerRightIso (f ≪≫ g) W = whiskerRightIso f W ≪≫ whiskerRightIso g W :=
Iso.ext (comp_whiskerRight f.hom g.hom W)
@[simp]
lemma whiskerRightIso_symm {X Y : C} (f : X ≅ Y) (W : C) :
(whiskerRightIso f W).symm = whiskerRightIso f.symm W := rfl
/-- The tensor product of two isomorphisms is an isomorphism. -/
@[simps]
def tensorIso {X Y X' Y' : C} (f : X ≅ Y)
(g : X' ≅ Y') : X ⊗ X' ≅ Y ⊗ Y' where
hom := f.hom ⊗ₘ g.hom
inv := f.inv ⊗ₘ g.inv
hom_inv_id := by simp [Iso.hom_inv_id, Iso.hom_inv_id]
inv_hom_id := by simp [Iso.inv_hom_id, Iso.inv_hom_id]
/-- Notation for `tensorIso`, the tensor product of isomorphisms -/
scoped infixr:70 " ⊗ᵢ " => tensorIso
-- TODO: Try setting this notation to `⊗` if the elaborator is improved and performs
-- better than currently on overloaded notations.
theorem tensorIso_def {X Y X' Y' : C} (f : X ≅ Y) (g : X' ≅ Y') :
f ⊗ᵢ g = whiskerRightIso f X' ≪≫ whiskerLeftIso Y g :=
Iso.ext (tensorHom_def f.hom g.hom)
theorem tensorIso_def' {X Y X' Y' : C} (f : X ≅ Y) (g : X' ≅ Y') :
f ⊗ᵢ g = whiskerLeftIso X g ≪≫ whiskerRightIso f Y' :=
Iso.ext (tensorHom_def' f.hom g.hom)
instance tensor_isIso {W X Y Z : C} (f : W ⟶ X) [IsIso f] (g : Y ⟶ Z) [IsIso g] : IsIso (f ⊗ₘ g) :=
(asIso f ⊗ᵢ asIso g).isIso_hom
@[simp]
theorem inv_tensor {W X Y Z : C} (f : W ⟶ X) [IsIso f] (g : Y ⟶ Z) [IsIso g] :
inv (f ⊗ₘ g) = inv f ⊗ₘ inv g := by
simp [tensorHom_def, whisker_exchange]
variable {W X Y Z : C}
theorem whiskerLeft_dite {P : Prop} [Decidable P]
(X : C) {Y Z : C} (f : P → (Y ⟶ Z)) (f' : ¬P → (Y ⟶ Z)) :
X ◁ (if h : P then f h else f' h) = if h : P then X ◁ f h else X ◁ f' h := by
split_ifs <;> rfl
theorem dite_whiskerRight {P : Prop} [Decidable P]
{X Y : C} (f : P → (X ⟶ Y)) (f' : ¬P → (X ⟶ Y)) (Z : C) :
(if h : P then f h else f' h) ▷ Z = if h : P then f h ▷ Z else f' h ▷ Z := by
split_ifs <;> rfl
theorem tensor_dite {P : Prop} [Decidable P] {W X Y Z : C} (f : W ⟶ X) (g : P → (Y ⟶ Z))
(g' : ¬P → (Y ⟶ Z)) : (f ⊗ₘ if h : P then g h else g' h) =
if h : P then f ⊗ₘ g h else f ⊗ₘ g' h := by split_ifs <;> rfl
theorem dite_tensor {P : Prop} [Decidable P] {W X Y Z : C} (f : W ⟶ X) (g : P → (Y ⟶ Z))
(g' : ¬P → (Y ⟶ Z)) : (if h : P then g h else g' h) ⊗ₘ f =
if h : P then g h ⊗ₘ f else g' h ⊗ₘ f := by split_ifs <;> rfl
@[simp]
theorem whiskerLeft_eqToHom (X : C) {Y Z : C} (f : Y = Z) :
X ◁ eqToHom f = eqToHom (congr_arg₂ tensorObj rfl f) := by
cases f
simp only [whiskerLeft_id, eqToHom_refl]
@[simp]
theorem eqToHom_whiskerRight {X Y : C} (f : X = Y) (Z : C) :
eqToHom f ▷ Z = eqToHom (congr_arg₂ tensorObj f rfl) := by
cases f
simp only [id_whiskerRight, eqToHom_refl]
@[reassoc]
theorem associator_naturality_left {X X' : C} (f : X ⟶ X') (Y Z : C) :
f ▷ Y ▷ Z ≫ (α_ X' Y Z).hom = (α_ X Y Z).hom ≫ f ▷ (Y ⊗ Z) := by simp
@[reassoc]
theorem associator_inv_naturality_left {X X' : C} (f : X ⟶ X') (Y Z : C) :
f ▷ (Y ⊗ Z) ≫ (α_ X' Y Z).inv = (α_ X Y Z).inv ≫ f ▷ Y ▷ Z := by simp
@[reassoc]
theorem whiskerRight_tensor_symm {X X' : C} (f : X ⟶ X') (Y Z : C) :
f ▷ Y ▷ Z = (α_ X Y Z).hom ≫ f ▷ (Y ⊗ Z) ≫ (α_ X' Y Z).inv := by simp
@[reassoc]
theorem associator_naturality_middle (X : C) {Y Y' : C} (f : Y ⟶ Y') (Z : C) :
(X ◁ f) ▷ Z ≫ (α_ X Y' Z).hom = (α_ X Y Z).hom ≫ X ◁ f ▷ Z := by simp
@[reassoc]
theorem associator_inv_naturality_middle (X : C) {Y Y' : C} (f : Y ⟶ Y') (Z : C) :
X ◁ f ▷ Z ≫ (α_ X Y' Z).inv = (α_ X Y Z).inv ≫ (X ◁ f) ▷ Z := by simp
@[reassoc]
theorem whisker_assoc_symm (X : C) {Y Y' : C} (f : Y ⟶ Y') (Z : C) :
X ◁ f ▷ Z = (α_ X Y Z).inv ≫ (X ◁ f) ▷ Z ≫ (α_ X Y' Z).hom := by simp
@[reassoc]
theorem associator_naturality_right (X Y : C) {Z Z' : C} (f : Z ⟶ Z') :
(X ⊗ Y) ◁ f ≫ (α_ X Y Z').hom = (α_ X Y Z).hom ≫ X ◁ Y ◁ f := by simp
@[reassoc]
theorem associator_inv_naturality_right (X Y : C) {Z Z' : C} (f : Z ⟶ Z') :
X ◁ Y ◁ f ≫ (α_ X Y Z').inv = (α_ X Y Z).inv ≫ (X ⊗ Y) ◁ f := by simp
@[reassoc]
theorem tensor_whiskerLeft_symm (X Y : C) {Z Z' : C} (f : Z ⟶ Z') :
X ◁ Y ◁ f = (α_ X Y Z).inv ≫ (X ⊗ Y) ◁ f ≫ (α_ X Y Z').hom := by simp
@[reassoc]
theorem leftUnitor_inv_naturality {X Y : C} (f : X ⟶ Y) :
f ≫ (λ_ Y).inv = (λ_ X).inv ≫ _ ◁ f := by simp
@[reassoc]
theorem id_whiskerLeft_symm {X X' : C} (f : X ⟶ X') :
f = (λ_ X).inv ≫ 𝟙_ C ◁ f ≫ (λ_ X').hom := by
simp only [id_whiskerLeft, assoc, inv_hom_id, comp_id, inv_hom_id_assoc]
@[reassoc]
theorem rightUnitor_inv_naturality {X X' : C} (f : X ⟶ X') :
f ≫ (ρ_ X').inv = (ρ_ X).inv ≫ f ▷ _ := by simp
@[reassoc]
theorem whiskerRight_id_symm {X Y : C} (f : X ⟶ Y) :
f = (ρ_ X).inv ≫ f ▷ 𝟙_ C ≫ (ρ_ Y).hom := by
simp
theorem whiskerLeft_iff {X Y : C} (f g : X ⟶ Y) : 𝟙_ C ◁ f = 𝟙_ C ◁ g ↔ f = g := by simp
theorem whiskerRight_iff {X Y : C} (f g : X ⟶ Y) : f ▷ 𝟙_ C = g ▷ 𝟙_ C ↔ f = g := by simp
/-! The lemmas in the next section are true by coherence,
but we prove them directly as they are used in proving the coherence theorem. -/
section
@[reassoc (attr := simp)]
theorem pentagon_inv :
W ◁ (α_ X Y Z).inv ≫ (α_ W (X ⊗ Y) Z).inv ≫ (α_ W X Y).inv ▷ Z =
(α_ W X (Y ⊗ Z)).inv ≫ (α_ (W ⊗ X) Y Z).inv :=
eq_of_inv_eq_inv (by simp)
@[reassoc (attr := simp)]
theorem pentagon_inv_inv_hom_hom_inv :
(α_ W (X ⊗ Y) Z).inv ≫ (α_ W X Y).inv ▷ Z ≫ (α_ (W ⊗ X) Y Z).hom =
W ◁ (α_ X Y Z).hom ≫ (α_ W X (Y ⊗ Z)).inv := by
rw [← cancel_epi (W ◁ (α_ X Y Z).inv), ← cancel_mono (α_ (W ⊗ X) Y Z).inv]
simp
@[reassoc (attr := simp)]
theorem pentagon_inv_hom_hom_hom_inv :
(α_ (W ⊗ X) Y Z).inv ≫ (α_ W X Y).hom ▷ Z ≫ (α_ W (X ⊗ Y) Z).hom =
(α_ W X (Y ⊗ Z)).hom ≫ W ◁ (α_ X Y Z).inv :=
eq_of_inv_eq_inv (by simp)
@[reassoc (attr := simp)]
theorem pentagon_hom_inv_inv_inv_inv :
W ◁ (α_ X Y Z).hom ≫ (α_ W X (Y ⊗ Z)).inv ≫ (α_ (W ⊗ X) Y Z).inv =
(α_ W (X ⊗ Y) Z).inv ≫ (α_ W X Y).inv ▷ Z := by
simp [← cancel_epi (W ◁ (α_ X Y Z).inv)]
@[reassoc (attr := simp)]
theorem pentagon_hom_hom_inv_hom_hom :
(α_ (W ⊗ X) Y Z).hom ≫ (α_ W X (Y ⊗ Z)).hom ≫ W ◁ (α_ X Y Z).inv =
(α_ W X Y).hom ▷ Z ≫ (α_ W (X ⊗ Y) Z).hom :=
eq_of_inv_eq_inv (by simp)
@[reassoc (attr := simp)]
theorem pentagon_hom_inv_inv_inv_hom :
(α_ W X (Y ⊗ Z)).hom ≫ W ◁ (α_ X Y Z).inv ≫ (α_ W (X ⊗ Y) Z).inv =
(α_ (W ⊗ X) Y Z).inv ≫ (α_ W X Y).hom ▷ Z := by
rw [← cancel_epi (α_ W X (Y ⊗ Z)).inv, ← cancel_mono ((α_ W X Y).inv ▷ Z)]
simp
@[reassoc (attr := simp)]
theorem pentagon_hom_hom_inv_inv_hom :
(α_ W (X ⊗ Y) Z).hom ≫ W ◁ (α_ X Y Z).hom ≫ (α_ W X (Y ⊗ Z)).inv =
(α_ W X Y).inv ▷ Z ≫ (α_ (W ⊗ X) Y Z).hom :=
eq_of_inv_eq_inv (by simp)
@[reassoc (attr := simp)]
theorem pentagon_inv_hom_hom_hom_hom :
(α_ W X Y).inv ▷ Z ≫ (α_ (W ⊗ X) Y Z).hom ≫ (α_ W X (Y ⊗ Z)).hom =
(α_ W (X ⊗ Y) Z).hom ≫ W ◁ (α_ X Y Z).hom := by
simp [← cancel_epi ((α_ W X Y).hom ▷ Z)]
@[reassoc (attr := simp)]
theorem pentagon_inv_inv_hom_inv_inv :
(α_ W X (Y ⊗ Z)).inv ≫ (α_ (W ⊗ X) Y Z).inv ≫ (α_ W X Y).hom ▷ Z =
W ◁ (α_ X Y Z).inv ≫ (α_ W (X ⊗ Y) Z).inv :=
eq_of_inv_eq_inv (by simp)
@[reassoc (attr := simp)]
theorem triangle_assoc_comp_right (X Y : C) :
(α_ X (𝟙_ C) Y).inv ≫ ((ρ_ X).hom ▷ Y) = X ◁ (λ_ Y).hom := by
rw [← triangle, Iso.inv_hom_id_assoc]
@[reassoc (attr := simp)]
theorem triangle_assoc_comp_right_inv (X Y : C) :
(ρ_ X).inv ▷ Y ≫ (α_ X (𝟙_ C) Y).hom = X ◁ (λ_ Y).inv := by
simp [← cancel_mono (X ◁ (λ_ Y).hom)]
@[reassoc (attr := simp)]
theorem triangle_assoc_comp_left_inv (X Y : C) :
(X ◁ (λ_ Y).inv) ≫ (α_ X (𝟙_ C) Y).inv = (ρ_ X).inv ▷ Y := by
simp [← cancel_mono ((ρ_ X).hom ▷ Y)]
/-- We state it as a simp lemma, which is regarded as an involved version of
`id_whiskerRight X Y : 𝟙 X ▷ Y = 𝟙 (X ⊗ Y)`.
-/
@[reassoc, simp]
theorem leftUnitor_whiskerRight (X Y : C) :
(λ_ X).hom ▷ Y = (α_ (𝟙_ C) X Y).hom ≫ (λ_ (X ⊗ Y)).hom := by
rw [← whiskerLeft_iff, whiskerLeft_comp, ← cancel_epi (α_ _ _ _).hom, ←
cancel_epi ((α_ _ _ _).hom ▷ _), pentagon_assoc, triangle, ← associator_naturality_middle, ←
comp_whiskerRight_assoc, triangle, associator_naturality_left]
@[reassoc, simp]
theorem leftUnitor_inv_whiskerRight (X Y : C) :
(λ_ X).inv ▷ Y = (λ_ (X ⊗ Y)).inv ≫ (α_ (𝟙_ C) X Y).inv :=
eq_of_inv_eq_inv (by simp)
@[reassoc, simp]
theorem whiskerLeft_rightUnitor (X Y : C) :
X ◁ (ρ_ Y).hom = (α_ X Y (𝟙_ C)).inv ≫ (ρ_ (X ⊗ Y)).hom := by
rw [← whiskerRight_iff, comp_whiskerRight, ← cancel_epi (α_ _ _ _).inv, ←
cancel_epi (X ◁ (α_ _ _ _).inv), pentagon_inv_assoc, triangle_assoc_comp_right, ←
associator_inv_naturality_middle, ← whiskerLeft_comp_assoc, triangle_assoc_comp_right,
associator_inv_naturality_right]
@[reassoc, simp]
theorem whiskerLeft_rightUnitor_inv (X Y : C) :
X ◁ (ρ_ Y).inv = (ρ_ (X ⊗ Y)).inv ≫ (α_ X Y (𝟙_ C)).hom :=
eq_of_inv_eq_inv (by simp)
@[reassoc]
theorem leftUnitor_tensor_hom (X Y : C) :
(λ_ (X ⊗ Y)).hom = (α_ (𝟙_ C) X Y).inv ≫ (λ_ X).hom ▷ Y := by simp
@[deprecated (since := "2025-06-24")] alias leftUnitor_tensor := leftUnitor_tensor_hom
@[reassoc]
theorem leftUnitor_tensor_inv (X Y : C) :
(λ_ (X ⊗ Y)).inv = (λ_ X).inv ▷ Y ≫ (α_ (𝟙_ C) X Y).hom := by simp
@[reassoc]
theorem rightUnitor_tensor_hom (X Y : C) :
(ρ_ (X ⊗ Y)).hom = (α_ X Y (𝟙_ C)).hom ≫ X ◁ (ρ_ Y).hom := by simp
@[deprecated (since := "2025-06-24")] alias rightUnitor_tensor := rightUnitor_tensor_hom
@[reassoc]
theorem rightUnitor_tensor_inv (X Y : C) :
(ρ_ (X ⊗ Y)).inv = X ◁ (ρ_ Y).inv ≫ (α_ X Y (𝟙_ C)).inv := by simp
end
@[reassoc]
theorem associator_inv_naturality {X Y Z X' Y' Z' : C} (f : X ⟶ X') (g : Y ⟶ Y') (h : Z ⟶ Z') :
(f ⊗ₘ g ⊗ₘ h) ≫ (α_ X' Y' Z').inv = (α_ X Y Z).inv ≫ ((f ⊗ₘ g) ⊗ₘ h) := by
simp [tensorHom_def]
@[reassoc, simp]
theorem associator_conjugation {X X' Y Y' Z Z' : C} (f : X ⟶ X') (g : Y ⟶ Y') (h : Z ⟶ Z') :
(f ⊗ₘ g) ⊗ₘ h = (α_ X Y Z).hom ≫ (f ⊗ₘ g ⊗ₘ h) ≫ (α_ X' Y' Z').inv := by
rw [associator_inv_naturality, hom_inv_id_assoc]
@[reassoc]
theorem associator_inv_conjugation {X X' Y Y' Z Z' : C} (f : X ⟶ X') (g : Y ⟶ Y') (h : Z ⟶ Z') :
f ⊗ₘ g ⊗ₘ h = (α_ X Y Z).inv ≫ ((f ⊗ₘ g) ⊗ₘ h) ≫ (α_ X' Y' Z').hom := by
rw [associator_naturality, inv_hom_id_assoc]
-- TODO these next two lemmas aren't so fundamental, and perhaps could be removed
-- (replacing their usages by their proofs).
@[reassoc]
theorem id_tensor_associator_naturality {X Y Z Z' : C} (h : Z ⟶ Z') :
(𝟙 (X ⊗ Y) ⊗ₘ h) ≫ (α_ X Y Z').hom = (α_ X Y Z).hom ≫ (𝟙 X ⊗ₘ 𝟙 Y ⊗ₘ h) := by
rw [← id_tensorHom_id, associator_naturality]
@[reassoc]
theorem id_tensor_associator_inv_naturality {X Y Z X' : C} (f : X ⟶ X') :
(f ⊗ₘ 𝟙 (Y ⊗ Z)) ≫ (α_ X' Y Z).inv = (α_ X Y Z).inv ≫ ((f ⊗ₘ 𝟙 Y) ⊗ₘ 𝟙 Z) := by
rw [← id_tensorHom_id, associator_inv_naturality]
@[reassoc]
theorem hom_inv_id_tensor {V W X Y Z : C} (f : V ≅ W) (g : X ⟶ Y) (h : Y ⟶ Z) :
(f.hom ⊗ₘ g) ≫ (f.inv ⊗ₘ h) = (𝟙 V ⊗ₘ g) ≫ (𝟙 V ⊗ₘ h) := by simp
@[reassoc]
theorem inv_hom_id_tensor {V W X Y Z : C} (f : V ≅ W) (g : X ⟶ Y) (h : Y ⟶ Z) :
(f.inv ⊗ₘ g) ≫ (f.hom ⊗ₘ h) = (𝟙 W ⊗ₘ g) ≫ (𝟙 W ⊗ₘ h) := by simp
@[reassoc]
theorem tensor_hom_inv_id {V W X Y Z : C} (f : V ≅ W) (g : X ⟶ Y) (h : Y ⟶ Z) :
(g ⊗ₘ f.hom) ≫ (h ⊗ₘ f.inv) = (g ⊗ₘ 𝟙 V) ≫ (h ⊗ₘ 𝟙 V) := by simp
@[reassoc]
theorem tensor_inv_hom_id {V W X Y Z : C} (f : V ≅ W) (g : X ⟶ Y) (h : Y ⟶ Z) :
(g ⊗ₘ f.inv) ≫ (h ⊗ₘ f.hom) = (g ⊗ₘ 𝟙 W) ≫ (h ⊗ₘ 𝟙 W) := by simp
@[reassoc]
theorem hom_inv_id_tensor' {V W X Y Z : C} (f : V ⟶ W) [IsIso f] (g : X ⟶ Y) (h : Y ⟶ Z) :
(f ⊗ₘ g) ≫ (inv f ⊗ₘ h) = (𝟙 V ⊗ₘ g) ≫ (𝟙 V ⊗ₘ h) := by simp
@[reassoc]
theorem inv_hom_id_tensor' {V W X Y Z : C} (f : V ⟶ W) [IsIso f] (g : X ⟶ Y) (h : Y ⟶ Z) :
(inv f ⊗ₘ g) ≫ (f ⊗ₘ h) = (𝟙 W ⊗ₘ g) ≫ (𝟙 W ⊗ₘ h) := by simp
@[reassoc]
theorem tensor_hom_inv_id' {V W X Y Z : C} (f : V ⟶ W) [IsIso f] (g : X ⟶ Y) (h : Y ⟶ Z) :
(g ⊗ₘ f) ≫ (h ⊗ₘ inv f) = (g ⊗ₘ 𝟙 V) ≫ (h ⊗ₘ 𝟙 V) := by simp
@[reassoc]
theorem tensor_inv_hom_id' {V W X Y Z : C} (f : V ⟶ W) [IsIso f] (g : X ⟶ Y) (h : Y ⟶ Z) :
(g ⊗ₘ inv f) ≫ (h ⊗ₘ f) = (g ⊗ₘ 𝟙 W) ≫ (h ⊗ₘ 𝟙 W) := by simp
/--
A constructor for monoidal categories that requires `tensorHom` instead of `whiskerLeft` and
`whiskerRight`.
-/
abbrev ofTensorHom [MonoidalCategoryStruct C]
(id_tensorHom_id : ∀ X₁ X₂ : C, tensorHom (𝟙 X₁) (𝟙 X₂) = 𝟙 (tensorObj X₁ X₂) := by
cat_disch)
(id_tensorHom : ∀ (X : C) {Y₁ Y₂ : C} (f : Y₁ ⟶ Y₂), tensorHom (𝟙 X) f = whiskerLeft X f := by
cat_disch)
(tensorHom_id : ∀ {X₁ X₂ : C} (f : X₁ ⟶ X₂) (Y : C), tensorHom f (𝟙 Y) = whiskerRight f Y := by
cat_disch)
(tensorHom_comp_tensorHom :
∀ {X₁ Y₁ Z₁ X₂ Y₂ Z₂ : C} (f₁ : X₁ ⟶ Y₁) (f₂ : X₂ ⟶ Y₂) (g₁ : Y₁ ⟶ Z₁) (g₂ : Y₂ ⟶ Z₂),
(f₁ ⊗ₘ f₂) ≫ (g₁ ⊗ₘ g₂) = (f₁ ≫ g₁) ⊗ₘ (f₂ ≫ g₂) := by
cat_disch)
(associator_naturality :
∀ {X₁ X₂ X₃ Y₁ Y₂ Y₃ : C} (f₁ : X₁ ⟶ Y₁) (f₂ : X₂ ⟶ Y₂) (f₃ : X₃ ⟶ Y₃),
tensorHom (tensorHom f₁ f₂) f₃ ≫ (associator Y₁ Y₂ Y₃).hom =
(associator X₁ X₂ X₃).hom ≫ tensorHom f₁ (tensorHom f₂ f₃) := by
cat_disch)
(leftUnitor_naturality :
∀ {X Y : C} (f : X ⟶ Y),
tensorHom (𝟙 (𝟙_ C)) f ≫ (leftUnitor Y).hom = (leftUnitor X).hom ≫ f := by
cat_disch)
(rightUnitor_naturality :
∀ {X Y : C} (f : X ⟶ Y),
tensorHom f (𝟙 (𝟙_ C)) ≫ (rightUnitor Y).hom = (rightUnitor X).hom ≫ f := by
cat_disch)
(pentagon :
∀ W X Y Z : C,
tensorHom (associator W X Y).hom (𝟙 Z) ≫
(associator W (tensorObj X Y) Z).hom ≫ tensorHom (𝟙 W) (associator X Y Z).hom =
(associator (tensorObj W X) Y Z).hom ≫ (associator W X (tensorObj Y Z)).hom := by
cat_disch)
(triangle :
∀ X Y : C,
(associator X (𝟙_ C) Y).hom ≫ tensorHom (𝟙 X) (leftUnitor Y).hom =
tensorHom (rightUnitor X).hom (𝟙 Y) := by
cat_disch) :
MonoidalCategory C where
tensorHom_def := by intros; simp [← id_tensorHom, ← tensorHom_id, tensorHom_comp_tensorHom]
whiskerLeft_id := by intros; simp [← id_tensorHom, ← id_tensorHom_id]
id_whiskerRight := by intros; simp [← tensorHom_id, id_tensorHom_id]
pentagon := by intros; simp [← id_tensorHom, ← tensorHom_id, pentagon]
triangle := by intros; simp [← id_tensorHom, ← tensorHom_id, triangle]
@[reassoc]
theorem comp_tensor_id (f : W ⟶ X) (g : X ⟶ Y) : f ≫ g ⊗ₘ 𝟙 Z = (f ⊗ₘ 𝟙 Z) ≫ (g ⊗ₘ 𝟙 Z) := by
simp
@[reassoc]
theorem id_tensor_comp (f : W ⟶ X) (g : X ⟶ Y) : 𝟙 Z ⊗ₘ f ≫ g = (𝟙 Z ⊗ₘ f) ≫ (𝟙 Z ⊗ₘ g) := by
simp
@[reassoc]
theorem id_tensor_comp_tensor_id (f : W ⟶ X) (g : Y ⟶ Z) : (𝟙 Y ⊗ₘ f) ≫ (g ⊗ₘ 𝟙 X) = g ⊗ₘ f := by
simp [tensorHom_def']
@[reassoc]
theorem tensor_id_comp_id_tensor (f : W ⟶ X) (g : Y ⟶ Z) : (g ⊗ₘ 𝟙 W) ≫ (𝟙 Z ⊗ₘ f) = g ⊗ₘ f := by
simp [tensorHom_def]
theorem tensor_left_iff {X Y : C} (f g : X ⟶ Y) : 𝟙 (𝟙_ C) ⊗ₘ f = 𝟙 (𝟙_ C) ⊗ₘ g ↔ f = g := by simp
theorem tensor_right_iff {X Y : C} (f g : X ⟶ Y) : f ⊗ₘ 𝟙 (𝟙_ C) = g ⊗ₘ 𝟙 (𝟙_ C) ↔ f = g := by simp
section
variable (C)
attribute [local simp] whisker_exchange
/-- The tensor product expressed as a functor. -/
@[simps]
def tensor : C × C ⥤ C where
obj X := X.1 ⊗ X.2
map {X Y : C × C} (f : X ⟶ Y) := f.1 ⊗ₘ f.2
/-- The left-associated triple tensor product as a functor. -/
def leftAssocTensor : C × C × C ⥤ C where
obj X := (X.1 ⊗ X.2.1) ⊗ X.2.2
map {X Y : C × C × C} (f : X ⟶ Y) := (f.1 ⊗ₘ f.2.1) ⊗ₘ f.2.2
@[simp]
theorem leftAssocTensor_obj (X) : (leftAssocTensor C).obj X = (X.1 ⊗ X.2.1) ⊗ X.2.2 :=
rfl
@[simp]
theorem leftAssocTensor_map {X Y} (f : X ⟶ Y) :
(leftAssocTensor C).map f = (f.1 ⊗ₘ f.2.1) ⊗ₘ f.2.2 :=
rfl
/-- The right-associated triple tensor product as a functor. -/
def rightAssocTensor : C × C × C ⥤ C where
obj X := X.1 ⊗ X.2.1 ⊗ X.2.2
map {X Y : C × C × C} (f : X ⟶ Y) := f.1 ⊗ₘ f.2.1 ⊗ₘ f.2.2
@[simp]
theorem rightAssocTensor_obj (X) : (rightAssocTensor C).obj X = X.1 ⊗ X.2.1 ⊗ X.2.2 :=
rfl
@[simp]
theorem rightAssocTensor_map {X Y} (f : X ⟶ Y) :
(rightAssocTensor C).map f = f.1 ⊗ₘ f.2.1 ⊗ₘ f.2.2 :=
rfl
/-- The tensor product bifunctor `C ⥤ C ⥤ C` of a monoidal category. -/
@[simps]
def curriedTensor : C ⥤ C ⥤ C where
obj X :=
{ obj := fun Y => X ⊗ Y
map := fun g => X ◁ g }
map f :=
{ app := fun Y => f ▷ Y }
variable {C}
/-- Tensoring on the left with a fixed object, as a functor. -/
abbrev tensorLeft (X : C) : C ⥤ C := (curriedTensor C).obj X
/-- Tensoring on the right with a fixed object, as a functor. -/
abbrev tensorRight (X : C) : C ⥤ C := (curriedTensor C).flip.obj X
variable (C)
/-- The functor `fun X ↦ 𝟙_ C ⊗ X`. -/
abbrev tensorUnitLeft : C ⥤ C := tensorLeft (𝟙_ C)
/-- The functor `fun X ↦ X ⊗ 𝟙_ C`. -/
abbrev tensorUnitRight : C ⥤ C := tensorRight (𝟙_ C)
-- We can express the associator and the unitors, given componentwise above,
-- as natural isomorphisms.
/-- The associator as a natural isomorphism. -/
@[simps!]
def associatorNatIso : leftAssocTensor C ≅ rightAssocTensor C :=
NatIso.ofComponents (fun _ => MonoidalCategory.associator _ _ _)
/-- The left unitor as a natural isomorphism. -/
@[simps!]
def leftUnitorNatIso : tensorUnitLeft C ≅ 𝟭 C :=
NatIso.ofComponents MonoidalCategory.leftUnitor
/-- The right unitor as a natural isomorphism. -/
@[simps!]
def rightUnitorNatIso : tensorUnitRight C ≅ 𝟭 C :=
NatIso.ofComponents MonoidalCategory.rightUnitor
/-- The associator as a natural isomorphism between trifunctors `C ⥤ C ⥤ C ⥤ C`. -/
@[simps!]
def curriedAssociatorNatIso :
bifunctorComp₁₂ (curriedTensor C) (curriedTensor C) ≅
bifunctorComp₂₃ (curriedTensor C) (curriedTensor C) :=
NatIso.ofComponents (fun X₁ => NatIso.ofComponents (fun X₂ => NatIso.ofComponents
(fun X₃ => α_ X₁ X₂ X₃)))
section
variable {C}
/-- Tensoring on the left with `X ⊗ Y` is naturally isomorphic to
tensoring on the left with `Y`, and then again with `X`.
-/
def tensorLeftTensor (X Y : C) : tensorLeft (X ⊗ Y) ≅ tensorLeft Y ⋙ tensorLeft X :=
NatIso.ofComponents (associator _ _) fun {Z} {Z'} f => by simp
@[simp]
theorem tensorLeftTensor_hom_app (X Y Z : C) :
(tensorLeftTensor X Y).hom.app Z = (associator X Y Z).hom :=
rfl
@[simp]
theorem tensorLeftTensor_inv_app (X Y Z : C) :
(tensorLeftTensor X Y).inv.app Z = (associator X Y Z).inv := by simp [tensorLeftTensor]
variable (C)
/-- Tensoring on the left, as a functor from `C` into endofunctors of `C`.
TODO: show this is an op-monoidal functor.
-/
abbrev tensoringLeft : C ⥤ C ⥤ C := curriedTensor C
instance : (tensoringLeft C).Faithful where
map_injective {X} {Y} f g h := by
injections h
replace h := congr_fun h (𝟙_ C)
simpa using h
/-- Tensoring on the right, as a functor from `C` into endofunctors of `C`.
We later show this is a monoidal functor.
-/
abbrev tensoringRight : C ⥤ C ⥤ C := (curriedTensor C).flip
instance : (tensoringRight C).Faithful where
map_injective {X} {Y} f g h := by
injections h
replace h := congr_fun h (𝟙_ C)
simpa using h
variable {C}
/-- Tensoring on the right with `X ⊗ Y` is naturally isomorphic to
tensoring on the right with `X`, and then again with `Y`.
-/
def tensorRightTensor (X Y : C) : tensorRight (X ⊗ Y) ≅ tensorRight X ⋙ tensorRight Y :=
NatIso.ofComponents (fun Z => (associator Z X Y).symm) fun {Z} {Z'} f => by simp
@[simp]
theorem tensorRightTensor_hom_app (X Y Z : C) :
(tensorRightTensor X Y).hom.app Z = (associator Z X Y).inv :=
rfl
@[simp]
theorem tensorRightTensor_inv_app (X Y Z : C) :
(tensorRightTensor X Y).inv.app Z = (associator Z X Y).hom := by simp [tensorRightTensor]
end
end
section
universe v₁ v₂ u₁ u₂
variable (C₁ : Type u₁) [Category.{v₁} C₁] [MonoidalCategory.{v₁} C₁]
variable (C₂ : Type u₂) [Category.{v₂} C₂] [MonoidalCategory.{v₂} C₂]
attribute [local simp] associator_naturality leftUnitor_naturality rightUnitor_naturality pentagon
@[simps! tensorObj tensorHom tensorUnit whiskerLeft whiskerRight associator]
instance prodMonoidal : MonoidalCategory (C₁ × C₂) where
tensorObj X Y := (X.1 ⊗ Y.1, X.2 ⊗ Y.2)
tensorHom f g := (f.1 ⊗ₘ g.1, f.2 ⊗ₘ g.2)
whiskerLeft X _ _ f := (whiskerLeft X.1 f.1, whiskerLeft X.2 f.2)
whiskerRight f X := (whiskerRight f.1 X.1, whiskerRight f.2 X.2)
tensorHom_def := by simp [tensorHom_def]
tensorUnit := (𝟙_ C₁, 𝟙_ C₂)
associator X Y Z := (α_ X.1 Y.1 Z.1).prod (α_ X.2 Y.2 Z.2)
leftUnitor := fun ⟨X₁, X₂⟩ => (λ_ X₁).prod (λ_ X₂)
rightUnitor := fun ⟨X₁, X₂⟩ => (ρ_ X₁).prod (ρ_ X₂)
@[simp]
theorem prodMonoidal_leftUnitor_hom_fst (X : C₁ × C₂) :
((λ_ X).hom : 𝟙_ _ ⊗ X ⟶ X).1 = (λ_ X.1).hom := by
cases X
rfl
@[simp]
theorem prodMonoidal_leftUnitor_hom_snd (X : C₁ × C₂) :
((λ_ X).hom : 𝟙_ _ ⊗ X ⟶ X).2 = (λ_ X.2).hom := by
cases X
rfl
@[simp]
theorem prodMonoidal_leftUnitor_inv_fst (X : C₁ × C₂) :
((λ_ X).inv : X ⟶ 𝟙_ _ ⊗ X).1 = (λ_ X.1).inv := by
cases X
rfl
@[simp]
theorem prodMonoidal_leftUnitor_inv_snd (X : C₁ × C₂) :
((λ_ X).inv : X ⟶ 𝟙_ _ ⊗ X).2 = (λ_ X.2).inv := by
cases X
rfl
@[simp]
theorem prodMonoidal_rightUnitor_hom_fst (X : C₁ × C₂) :
((ρ_ X).hom : X ⊗ 𝟙_ _ ⟶ X).1 = (ρ_ X.1).hom := by
cases X
rfl
@[simp]
theorem prodMonoidal_rightUnitor_hom_snd (X : C₁ × C₂) :
((ρ_ X).hom : X ⊗ 𝟙_ _ ⟶ X).2 = (ρ_ X.2).hom := by
cases X
rfl
@[simp]
theorem prodMonoidal_rightUnitor_inv_fst (X : C₁ × C₂) :
((ρ_ X).inv : X ⟶ X ⊗ 𝟙_ _).1 = (ρ_ X.1).inv := by
cases X
rfl
@[simp]
theorem prodMonoidal_rightUnitor_inv_snd (X : C₁ × C₂) :
((ρ_ X).inv : X ⟶ X ⊗ 𝟙_ _).2 = (ρ_ X.2).inv := by
cases X
rfl
end
end MonoidalCategory
namespace NatTrans
variable {J : Type*} [Category J] {C : Type*} [Category C] [MonoidalCategory C]
{F G F' G' : J ⥤ C} (α : F ⟶ F') (β : G ⟶ G')
@[reassoc]
lemma tensor_naturality {X Y X' Y' : J} (f : X ⟶ Y) (g : X' ⟶ Y') :
(F.map f ⊗ₘ G.map g) ≫ (α.app Y ⊗ₘ β.app Y') =
(α.app X ⊗ₘ β.app X') ≫ (F'.map f ⊗ₘ G'.map g) := by simp
@[reassoc]
lemma whiskerRight_app_tensor_app {X Y : J} (f : X ⟶ Y) (X' : J) :
F.map f ▷ G.obj X' ≫ (α.app Y ⊗ₘ β.app X') =
(α.app X ⊗ₘ β.app X') ≫ F'.map f ▷ (G'.obj X') := by
simpa using tensor_naturality α β f (𝟙 X')
@[reassoc]
lemma whiskerLeft_app_tensor_app {X' Y' : J} (f : X' ⟶ Y') (X : J) :
F.obj X ◁ G.map f ≫ (α.app X ⊗ₘ β.app Y') =
(α.app X ⊗ₘ β.app X') ≫ F'.obj X ◁ G'.map f := by
simpa using tensor_naturality α β (𝟙 X) f
end NatTrans
section ObjectProperty
/-- The restriction of a monoidal category along an object property
that's closed under the monoidal structure. -/
-- See note [reducible non-instances]
abbrev MonoidalCategory.fullSubcategory
{C : Type u} [Category.{v} C] [MonoidalCategory C] (P : ObjectProperty C)
(tensorUnit : P (𝟙_ C))
(tensorObj : ∀ X Y, P X → P Y → P (X ⊗ Y)) :
MonoidalCategory P.FullSubcategory where
tensorObj X Y := ⟨X.1 ⊗ Y.1, tensorObj X.1 Y.1 X.2 Y.2⟩
whiskerLeft X _ _ f := X.1 ◁ f
whiskerRight f X := MonoidalCategoryStruct.whiskerRight (C := C) f X.1
tensorHom f g := MonoidalCategoryStruct.tensorHom (C := C) f g
tensorUnit := ⟨𝟙_ C, tensorUnit⟩
associator X Y Z := P.fullyFaithfulι.preimageIso (α_ X.1 Y.1 Z.1)
leftUnitor X := P.fullyFaithfulι.preimageIso (λ_ X.1)
rightUnitor X := P.fullyFaithfulι.preimageIso (ρ_ X.1)
tensorHom_def := tensorHom_def (C := C)
id_tensorHom_id X Y := id_tensorHom_id X.1 Y.1
tensorHom_comp_tensorHom := tensorHom_comp_tensorHom (C := C)
whiskerLeft_id X Y := MonoidalCategory.whiskerLeft_id X.1 Y.1
id_whiskerRight X Y := MonoidalCategory.id_whiskerRight X.1 Y.1
associator_naturality := associator_naturality (C := C)
leftUnitor_naturality := leftUnitor_naturality (C := C)
rightUnitor_naturality := rightUnitor_naturality (C := C)
pentagon W X Y Z := pentagon W.1 X.1 Y.1 Z.1
triangle X Y := triangle X.1 Y.1
end ObjectProperty
end CategoryTheory |
.lake/packages/mathlib/Mathlib/CategoryTheory/Monoidal/Discrete.lean | import Mathlib.Algebra.Group.Hom.Defs
import Mathlib.CategoryTheory.Discrete.Basic
import Mathlib.CategoryTheory.Monoidal.NaturalTransformation
/-!
# Monoids as discrete monoidal categories
The discrete category on a monoid is a monoidal category.
Multiplicative morphisms induced monoidal functors.
-/
universe u u'
open CategoryTheory Discrete MonoidalCategory
variable (M : Type u) [Monoid M]
namespace CategoryTheory
@[to_additive (attr := simps tensorObj_as leftUnitor rightUnitor associator) Discrete.addMonoidal]
instance Discrete.monoidal : MonoidalCategory (Discrete M) where
tensorUnit := Discrete.mk 1
tensorObj X Y := Discrete.mk (X.as * Y.as)
whiskerLeft X _ _ f := eqToHom (by rw [eq_of_hom f])
whiskerRight f X := eqToHom (by rw [eq_of_hom f])
tensorHom f g := eqToHom (by rw [eq_of_hom f, eq_of_hom g])
leftUnitor X := Discrete.eqToIso (one_mul X.as)
rightUnitor X := Discrete.eqToIso (mul_one X.as)
associator _ _ _ := Discrete.eqToIso (mul_assoc _ _ _)
@[to_additive (attr := simp) Discrete.addMonoidal_tensorUnit_as]
lemma Discrete.monoidal_tensorUnit_as : (𝟙_ (Discrete M)).as = 1 := rfl
variable {M} {N : Type u'} [Monoid N]
/-- A multiplicative morphism between monoids gives a monoidal functor between the corresponding
discrete monoidal categories.
-/
@[to_additive Discrete.addMonoidalFunctor]
def Discrete.monoidalFunctor (F : M →* N) : Discrete M ⥤ Discrete N :=
Discrete.functor (fun X ↦ Discrete.mk (F X))
@[to_additive (attr := simp) Discrete.addMonoidalFunctor_obj]
lemma Discrete.monoidalFunctor_obj (F : M →* N) (m : M) :
(Discrete.monoidalFunctor F).obj (Discrete.mk m) = Discrete.mk (F m) := rfl
@[to_additive Discrete.addMonoidalFunctorMonoidal]
instance Discrete.monoidalFunctorMonoidal (F : M →* N) :
(Discrete.monoidalFunctor F).Monoidal :=
Functor.CoreMonoidal.toMonoidal
{ εIso := Discrete.eqToIso F.map_one.symm
μIso := fun m₁ m₂ ↦ Discrete.eqToIso (F.map_mul _ _).symm }
open Functor.LaxMonoidal Functor.OplaxMonoidal
@[to_additive Discrete.addMonoidalFunctor_ε]
lemma Discrete.monoidalFunctor_ε (F : M →* N) :
ε (monoidalFunctor F) = Discrete.eqToHom F.map_one.symm := rfl
@[to_additive Discrete.addMonoidalFunctor_η]
lemma Discrete.monoidalFunctor_η (F : M →* N) :
η (monoidalFunctor F) = Discrete.eqToHom F.map_one := rfl
@[to_additive Discrete.addMonoidalFunctor_μ]
lemma Discrete.monoidalFunctor_μ (F : M →* N) (m₁ m₂ : Discrete M) :
μ (monoidalFunctor F) m₁ m₂ = Discrete.eqToHom (F.map_mul _ _).symm := rfl
@[to_additive Discrete.addMonoidalFunctor_δ]
lemma Discrete.monoidalFunctor_δ (F : M →* N) (m₁ m₂ : Discrete M) :
δ (monoidalFunctor F) m₁ m₂ = Discrete.eqToHom (F.map_mul _ _) := rfl
/-- An additive morphism between add_monoids gives a
monoidal functor between the corresponding discrete monoidal categories. -/
add_decl_doc Discrete.addMonoidalFunctor
variable {K : Type u} [Monoid K]
/-- The monoidal natural isomorphism corresponding to composing two multiplicative morphisms.
-/
@[to_additive Discrete.addMonoidalFunctorComp
/-- The monoidal natural isomorphism corresponding to
composing two additive morphisms. -/]
def Discrete.monoidalFunctorComp (F : M →* N) (G : N →* K) :
Discrete.monoidalFunctor F ⋙ Discrete.monoidalFunctor G ≅
Discrete.monoidalFunctor (G.comp F) := Iso.refl _
@[to_additive Discrete.addMonoidalFunctorComp_isMonoidal]
instance Discrete.monoidalFunctorComp_isMonoidal (F : M →* N) (G : N →* K) :
NatTrans.IsMonoidal (Discrete.monoidalFunctorComp F G).hom where
unit := by
dsimp only [comp_ε, monoidalFunctorComp, Iso.refl, Discrete.monoidalFunctor_ε]
simp [eqToHom_map]
tensor _ _ := by
dsimp only [comp_μ, monoidalFunctorComp, Iso.refl, Discrete.monoidalFunctor_μ]
simp [eqToHom_map]
end CategoryTheory |
.lake/packages/mathlib/Mathlib/CategoryTheory/Monoidal/Grp_.lean | import Mathlib.CategoryTheory.Monoidal.Cartesian.Mon_
import Mathlib.CategoryTheory.Limits.Shapes.Pullback.CommSq
import Mathlib.CategoryTheory.Limits.ExactFunctor
/-!
# The category of groups in a Cartesian monoidal category
We define group objects in Cartesian monoidal categories.
We show that the associativity diagram of a group object is always Cartesian and deduce that
morphisms of group objects commute with taking inverses.
We show that a finite-product-preserving functor takes group objects to group objects.
-/
universe v₁ v₂ v₃ u₁ u₂ u₃ u
open CategoryTheory Category Limits MonoidalCategory CartesianMonoidalCategory Mon MonObj
namespace CategoryTheory
variable {C : Type u₁} [Category.{v₁} C] [CartesianMonoidalCategory.{v₁} C]
/-- A group object internal to a cartesian monoidal category. Also see the bundled `Grp`. -/
class GrpObj (X : C) extends MonObj X where
/-- The inverse in a group object -/
inv : X ⟶ X
left_inv (X) : lift inv (𝟙 X) ≫ mul = toUnit _ ≫ one := by cat_disch
right_inv (X) : lift (𝟙 X) inv ≫ mul = toUnit _ ≫ one := by cat_disch
@[deprecated (since := "2025-09-13")] alias Grp_Class := GrpObj
namespace MonObj
@[inherit_doc] scoped notation "ι" => GrpObj.inv
@[inherit_doc] scoped notation "ι["G"]" => GrpObj.inv (X := G)
end MonObj
namespace GrpObj
attribute [reassoc (attr := simp)] left_inv right_inv
@[simps inv]
instance : GrpObj (𝟙_ C) where
inv := 𝟙 (𝟙_ C)
end GrpObj
variable (C) in
/-- A group object in a Cartesian monoidal category. -/
structure Grp where
/-- The underlying object in the ambient monoidal category -/
X : C
[grp : GrpObj X]
@[deprecated (since := "2025-10-13")] alias Grp_ := Grp
attribute [instance] Grp.grp
namespace Grp
/-- A group object is a monoid object. -/
@[simps -isSimp X]
abbrev toMon (A : Grp C) : Mon C := ⟨A.X⟩
@[deprecated (since := "2025-09-15")] alias toMon_ := toMon
variable (C) in
/-- The trivial group object. -/
@[simps!]
def trivial : Grp C :=
{ Mon.trivial C with grp := inferInstanceAs (GrpObj (𝟙_ C)) }
instance : Inhabited (Grp C) where
default := trivial C
@[deprecated (since := "2025-06-15")] alias mk' := mk
instance : Category (Grp C) :=
InducedCategory.category Grp.toMon
@[simp]
theorem id_hom (A : Grp C) : Mon.Hom.hom (𝟙 A) = 𝟙 A.X :=
rfl
@[simp]
theorem comp_hom {R S T : Grp C} (f : R ⟶ S) (g : S ⟶ T) :
Mon.Hom.hom (f ≫ g) = f.hom ≫ g.hom :=
rfl
@[ext]
theorem hom_ext {A B : Grp C} (f g : A ⟶ B) (h : f.hom = g.hom) : f = g :=
Mon.Hom.ext h
@[simp]
lemma id' (A : Grp C) : (𝟙 A : A.toMon ⟶ A.toMon) = 𝟙 (A.toMon) := rfl
@[simp]
lemma comp' {A₁ A₂ A₃ : Grp C} (f : A₁ ⟶ A₂) (g : A₂ ⟶ A₃) :
((f ≫ g : A₁ ⟶ A₃) : A₁.toMon ⟶ A₃.toMon) = @CategoryStruct.comp (Mon C) _ _ _ _ f g := rfl
end Grp
namespace GrpObj
variable {G X : C} [GrpObj G]
variable {A : C} {B : C}
@[reassoc (attr := simp)]
theorem lift_comp_inv_right [GrpObj B] (f : A ⟶ B) :
lift f (f ≫ ι) ≫ μ = toUnit _ ≫ η := by
have := f ≫= right_inv B
rwa [comp_lift_assoc, comp_id, reassoc_of% toUnit_unique (f ≫ toUnit B) (toUnit A)] at this
@[reassoc]
theorem lift_inv_comp_right [GrpObj A] [GrpObj B] (f : A ⟶ B) [IsMonHom f] :
lift f (ι ≫ f) ≫ μ = toUnit _ ≫ η := by
have := right_inv A =≫ f
rwa [assoc, IsMonHom.mul_hom, assoc, IsMonHom.one_hom, lift_map_assoc, id_comp] at this
@[reassoc (attr := simp)]
theorem lift_comp_inv_left [GrpObj B] (f : A ⟶ B) :
lift (f ≫ ι) f ≫ μ = toUnit _ ≫ η := by
have := f ≫= left_inv B
rwa [comp_lift_assoc, comp_id, reassoc_of% toUnit_unique (f ≫ toUnit B) (toUnit A)] at this
@[reassoc]
theorem lift_inv_comp_left [GrpObj A] [GrpObj B] (f : A ⟶ B) [IsMonHom f] :
lift (ι ≫ f) f ≫ μ = toUnit _ ≫ η := by
have := left_inv A =≫ f
rwa [assoc, IsMonHom.mul_hom, assoc, IsMonHom.one_hom, lift_map_assoc, id_comp] at this
theorem eq_lift_inv_left [GrpObj B] (f g h : A ⟶ B) :
f = lift (g ≫ ι) h ≫ μ ↔ lift g f ≫ μ = h := by
refine ⟨?_, ?_⟩ <;> (rintro rfl; simp [← lift_lift_assoc])
theorem lift_inv_left_eq [GrpObj B] (f g h : A ⟶ B) :
lift (f ≫ ι) g ≫ μ = h ↔ g = lift f h ≫ μ := by
rw [eq_comm, eq_lift_inv_left, eq_comm]
theorem eq_lift_inv_right [GrpObj B] (f g h : A ⟶ B) :
f = lift g (h ≫ ι) ≫ μ ↔ lift f h ≫ μ = g := by
refine ⟨?_, ?_⟩ <;> (rintro rfl; simp [lift_lift_assoc])
theorem lift_inv_right_eq [GrpObj B] (f g h : A ⟶ B) :
lift f (g ≫ ι) ≫ μ = h ↔ f = lift h g ≫ μ := by
rw [eq_comm, eq_lift_inv_right, eq_comm]
theorem lift_left_mul_ext [GrpObj B] {f g : A ⟶ B} (i : A ⟶ B)
(h : lift f i ≫ μ = lift g i ≫ μ) : f = g := by
rwa [← eq_lift_inv_right, lift_lift_assoc, lift_comp_inv_right, lift_comp_one_right] at h
@[reassoc (attr := simp)]
theorem inv_comp_inv (A : C) [GrpObj A] : ι ≫ ι = 𝟙 A := by
apply lift_left_mul_ext ι[A]
rw [right_inv, ← comp_toUnit_assoc ι, ← left_inv, comp_lift_assoc, Category.comp_id]
/-- Transfer `GrpObj` along an isomorphism. -/
-- Note: The simps lemmas are not tagged simp because their `#discr_tree_simp_key` are too generic.
@[simps! -isSimp]
abbrev ofIso (e : G ≅ X) : GrpObj X where
toMonObj := .ofIso e
inv := e.inv ≫ ι[G] ≫ e.hom
left_inv := by simp [MonObj.ofIso]
right_inv := by simp [MonObj.ofIso]
instance (A : C) [GrpObj A] : IsIso ι[A] := ⟨ι, by simp, by simp⟩
/-- For `inv ≫ inv = 𝟙` see `inv_comp_inv`. -/
@[simp]
theorem inv_inv (A : C) [GrpObj A] : CategoryTheory.inv ι = ι[A] := by
rw [eq_comm, ← CategoryTheory.inv_comp_eq_id, IsIso.inv_inv, inv_comp_inv]
@[reassoc]
theorem mul_inv [BraidedCategory C] (A : C) [GrpObj A] :
μ ≫ ι = (β_ A A).hom ≫ (ι ⊗ₘ ι) ≫ μ := by
apply lift_left_mul_ext μ
nth_rw 2 [← Category.comp_id μ]
rw [← comp_lift, Category.assoc, left_inv, ← Category.assoc (β_ A A).hom,
← lift_snd_fst, lift_map, lift_lift_assoc]
nth_rw 2 [← Category.id_comp μ]
rw [← lift_fst_snd, ← lift_lift_assoc (fst A A ≫ _), lift_comp_inv_left, lift_comp_one_left,
lift_comp_inv_left, comp_toUnit_assoc]
@[reassoc]
theorem tensorHom_inv_inv_mul [BraidedCategory C] (A : C) [GrpObj A] :
(ι[A] ⊗ₘ ι[A]) ≫ μ = (β_ A A).hom ≫ μ ≫ ι := by
rw [mul_inv A, SymmetricCategory.symmetry_assoc]
@[reassoc]
lemma mul_inv_rev [BraidedCategory C] (G : C) [GrpObj G] :
μ ≫ ι = (ι[G] ⊗ₘ ι) ≫ (β_ _ _).hom ≫ μ := by simp [tensorHom_inv_inv_mul]
/-- The map `(· * f)`. -/
@[simps]
def mulRight {A : C} [GrpObj A] (f : 𝟙_ C ⟶ A) : A ≅ A where
hom := lift (𝟙 _) (toUnit _ ≫ f) ≫ μ
inv := lift (𝟙 _) (toUnit _ ≫ f ≫ ι) ≫ μ
hom_inv_id := by simp [comp_lift_assoc, lift_lift_assoc, ← comp_lift]
inv_hom_id := by simp [comp_lift_assoc, lift_lift_assoc, ← comp_lift]
@[simp]
lemma mulRight_one (A : C) [GrpObj A] : mulRight η[A] = Iso.refl A := by
ext; simp
/-- The associativity diagram of a group object is Cartesian.
In fact, any monoid object whose associativity diagram is Cartesian can be made into a group object
(we do not prove this in this file), so we should expect that many properties of group objects
follow from this result. -/
theorem isPullback (A : C) [GrpObj A] :
IsPullback (μ ▷ A) ((α_ A A A).hom ≫ (A ◁ μ)) μ μ where
w := by simp
isLimit' := Nonempty.intro <| PullbackCone.IsLimit.mk _
(fun s => lift
(lift
(s.snd ≫ fst _ _)
(lift (s.snd ≫ fst _ _ ≫ ι) (s.fst ≫ fst _ _) ≫ μ))
(s.fst ≫ snd _ _))
(by
refine fun s => CartesianMonoidalCategory.hom_ext _ _ ?_ (by simp)
simp only [lift_whiskerRight, lift_fst]
rw [← lift_lift_assoc, ← assoc, lift_comp_inv_right, lift_comp_one_left])
(by
refine fun s => CartesianMonoidalCategory.hom_ext _ _ (by simp) ?_
simp only [lift_lift_associator_hom_assoc, lift_whiskerLeft, lift_snd]
have : lift (s.snd ≫ fst _ _ ≫ ι) (s.fst ≫ fst _ _) ≫ μ =
lift (s.snd ≫ snd _ _) (s.fst ≫ snd _ _ ≫ ι) ≫ μ := by
rw [← assoc s.fst, eq_lift_inv_right, lift_lift_assoc, ← assoc s.snd, lift_inv_left_eq,
lift_comp_fst_snd, lift_comp_fst_snd, s.condition]
rw [this, lift_lift_assoc, ← assoc, lift_comp_inv_left, lift_comp_one_right])
(by
intro s m hm₁ hm₂
refine CartesianMonoidalCategory.hom_ext _ _ (CartesianMonoidalCategory.hom_ext _ _ ?_ ?_) ?_
· simpa using hm₂ =≫ fst _ _
· have h : m ≫ fst _ _ ≫ fst _ _ = s.snd ≫ fst _ _ := by simpa using hm₂ =≫ fst _ _
have := hm₁ =≫ fst _ _
simp only [assoc, whiskerRight_fst, lift_fst, lift_snd] at this ⊢
rw [← assoc, ← lift_comp_fst_snd (m ≫ _), assoc, assoc, h] at this
rwa [← assoc s.snd, eq_lift_inv_left]
· simpa using hm₁ =≫ snd _ _)
/-- Morphisms of group objects preserve inverses. -/
@[reassoc (attr := simp)]
theorem inv_hom [GrpObj A] [GrpObj B] (f : A ⟶ B) [IsMonHom f] : ι ≫ f = f ≫ ι := by
suffices lift (lift f (ι ≫ f)) f =
lift (lift f (f ≫ ι)) f by simpa using (this =≫ fst _ _) =≫ snd _ _
apply (isPullback B).hom_ext <;> apply CartesianMonoidalCategory.hom_ext <;>
simp [lift_inv_comp_right, lift_inv_comp_left]
lemma toMonObj_injective {X : C} :
Function.Injective (@GrpObj.toMonObj C ‹_› ‹_› X) := by
intro h₁ h₂ e
suffices h₁.inv = h₂.inv by cases h₁; congr!
apply lift_left_mul_ext (𝟙 _)
rw [left_inv]
convert @left_inv _ _ _ _ h₁ using 2
exacts [congr(($e.symm).mul), congr(($e.symm).one)]
@[deprecated (since := "2025-09-09")] alias toMon_Class_injective := toMonObj_injective
@[ext]
lemma ext {X : C} (h₁ h₂ : GrpObj X) (H : h₁.toMonObj = h₂.toMonObj) : h₁ = h₂ :=
GrpObj.toMonObj_injective H
namespace tensorObj
variable [BraidedCategory C] {G H : C} [GrpObj G] [GrpObj H]
@[simps inv]
instance : GrpObj (G ⊗ H) where
inv := ι ⊗ₘ ι
end GrpObj.tensorObj
namespace Grp
section
variable (C)
/-- The forgetful functor from group objects to monoid objects. -/
@[simps! obj_X]
def forget₂Mon : Grp C ⥤ Mon C :=
inducedFunctor Grp.toMon
@[deprecated (since := "2025-09-15")] alias forget₂Mon_ := forget₂Mon
/-- The forgetful functor from group objects to monoid objects is fully faithful. -/
def fullyFaithfulForget₂Mon : (forget₂Mon C).FullyFaithful :=
fullyFaithfulInducedFunctor _
@[deprecated (since := "2025-09-15")] alias fullyFaithfulForget₂Mon_ := fullyFaithfulForget₂Mon
instance : (forget₂Mon C).Full := InducedCategory.full _
instance : (forget₂Mon C).Faithful := InducedCategory.faithful _
variable {C}
@[simp]
theorem forget₂Mon_obj_one (A : Grp C) : η[((forget₂Mon C).obj A).X] = η[A.X] :=
rfl
@[simp]
theorem forget₂Mon_obj_mul (A : Grp C) : μ[((forget₂Mon C).obj A).X] = μ[A.X] :=
rfl
@[simp]
theorem forget₂Mon_map_hom {A B : Grp C} (f : A ⟶ B) : ((forget₂Mon C).map f).hom = f.hom :=
rfl
variable (C)
/-- The forgetful functor from group objects to the ambient category. -/
@[simps!]
def forget : Grp C ⥤ C :=
forget₂Mon C ⋙ Mon.forget C
instance : (forget C).Faithful where
@[simp]
theorem forget₂Mon_comp_forget : forget₂Mon C ⋙ Mon.forget C = forget C := rfl
instance {G H : Grp C} {f : G ⟶ H} [IsIso f] : IsIso f.hom :=
inferInstanceAs <| IsIso <| (forget C).map f
end
/-- Construct an isomorphism of group objects by giving a monoid isomorphism between the underlying
objects. -/
@[simps!]
def mkIso' {G H : C} (e : G ≅ H) [GrpObj G] [GrpObj H] [IsMonHom e.hom] : mk G ≅ mk H :=
(fullyFaithfulForget₂Mon C).preimageIso (Mon.mkIso' e)
/-- Construct an isomorphism of group objects by giving an isomorphism between the underlying
objects and checking compatibility with unit and multiplication only in the forward direction. -/
@[simps!]
abbrev mkIso {G H : Grp C} (e : G.X ≅ H.X) (one_f : η[G.X] ≫ e.hom = η[H.X] := by cat_disch)
(mul_f : μ[G.X] ≫ e.hom = (e.hom ⊗ₘ e.hom) ≫ μ[H.X] := by cat_disch) : G ≅ H :=
have : IsMonHom e.hom := ⟨one_f, mul_f⟩
mkIso' e
instance uniqueHomFromTrivial (A : Grp C) : Unique (trivial C ⟶ A) :=
Mon.uniqueHomFromTrivial A.toMon
instance : HasInitial (Grp C) :=
hasInitial_of_unique (trivial C)
/-! ### `Grp C` is cartesian-monoidal -/
variable [BraidedCategory C] {G H H₁ H₂ : Grp C}
@[simps! tensorObj_X tensorHom_hom]
instance instMonoidalCategoryStruct : MonoidalCategoryStruct (Grp C) where
tensorObj G H := ⟨G.X ⊗ H.X⟩
tensorHom := tensorHom (C := Mon C)
whiskerRight f G := whiskerRight (C := Mon C) f G.toMon
whiskerLeft G _ _ f := MonoidalCategoryStruct.whiskerLeft (C := Mon C) G.toMon f
tensorUnit := ⟨𝟙_ C⟩
associator X Y Z :=
(Grp.fullyFaithfulForget₂Mon C).preimageIso (associator X.toMon Y.toMon Z.toMon)
leftUnitor G := (Grp.fullyFaithfulForget₂Mon C).preimageIso (leftUnitor G.toMon)
rightUnitor G := (Grp.fullyFaithfulForget₂Mon C).preimageIso (rightUnitor G.toMon)
@[simp] lemma tensorUnit_X : (𝟙_ (Grp C)).X = 𝟙_ C := rfl
@[simp] lemma tensorUnit_one : η[(𝟙_ (Grp C)).X] = η[𝟙_ C] := rfl
@[simp] lemma tensorUnit_mul : μ[(𝟙_ (Grp C)).X] = μ[𝟙_ C] := rfl
@[simp] lemma tensorObj_one (G H : Grp C) : η[(G ⊗ H).X] = η[G.X ⊗ H.X] := rfl
@[simp] lemma tensorObj_mul (G H : Grp C) : μ[(G ⊗ H).X] = μ[G.X ⊗ H.X] := rfl
@[simp] lemma whiskerLeft_hom {G H : Grp C} (f : G ⟶ H) (I : Grp C) :
(f ▷ I).hom = f.hom ▷ I.X := rfl
@[simp] lemma whiskerRight_hom (G : Grp C) {H I : Grp C} (f : H ⟶ I) :
(G ◁ f).hom = G.X ◁ f.hom := rfl
@[simp] lemma leftUnitor_hom_hom (G : Grp C) : (λ_ G).hom.hom = (λ_ G.X).hom := rfl
@[simp] lemma leftUnitor_inv_hom (G : Grp C) : (λ_ G).inv.hom = (λ_ G.X).inv := rfl
@[simp] lemma rightUnitor_hom_hom (G : Grp C) : (ρ_ G).hom.hom = (ρ_ G.X).hom := rfl
@[simp] lemma rightUnitor_inv_hom (G : Grp C) : (ρ_ G).inv.hom = (ρ_ G.X).inv := rfl
@[simp] lemma associator_hom_hom (G H I : Grp C) : (α_ G H I).hom.hom = (α_ G.X H.X I.X).hom := rfl
@[simp] lemma associator_inv_hom (G H I : Grp C) : (α_ G H I).inv.hom = (α_ G.X H.X I.X).inv := rfl
instance instMonoidalCategory : MonoidalCategory (Grp C) where
tensorHom_def := by intros; ext; simp [tensorHom_def]
triangle _ _ := by ext; exact triangle _ _
instance instCartesianMonoidalCategory : CartesianMonoidalCategory (Grp C) where
isTerminalTensorUnit :=
.ofUniqueHom (fun G ↦ toUnit G.toMon) fun G f ↦ by ext; exact toUnit_unique ..
fst G H := fst G.toMon H.toMon
snd G H := snd G.toMon H.toMon
tensorProductIsBinaryProduct G H :=
BinaryFan.IsLimit.mk _ (fun {T} f g ↦ .mk (lift f.hom g.hom))
(by aesop_cat) (by aesop_cat) (by aesop_cat)
fst_def G H := Mon.Hom.ext <| fst_def _ _
snd_def G H := Mon.Hom.ext <| snd_def _ _
@[simp] lemma lift_hom (f : G ⟶ H₁) (g : G ⟶ H₂) : (lift f g).hom = lift f.hom g.hom := rfl
@[simp] lemma fst_hom (G H : Grp C) : (fst G H).hom = fst G.X H.X := rfl
@[simp] lemma snd_hom (G H : Grp C) : (snd G H).hom = snd G.X H.X := rfl
@[simps]
instance : (forget₂Mon C).Monoidal where
ε := 𝟙 _
«μ» G H := 𝟙 _
«η» := 𝟙 _
δ G H := 𝟙 _
attribute [local simp] MonObj.tensorObj.mul_def mul_eq_mul comp_mul in
instance instBraidedCategory : BraidedCategory (Grp C) :=
.ofFaithful (forget₂Mon C) fun G H ↦ Grp.mkIso (β_ G.X H.X)
@[simp] lemma braiding_hom_hom (G H : Grp C) : (β_ G H).hom.hom = (β_ G.X H.X).hom := rfl
@[simp] lemma braiding_inv_hom (G H : Grp C) : (β_ G H).inv.hom = (β_ G.X H.X).inv := rfl
end Grp
variable
{D : Type u₂} [Category.{v₂} D] [CartesianMonoidalCategory D]
{E : Type u₃} [Category.{v₃} E] [CartesianMonoidalCategory E]
namespace Functor
variable {F F' : C ⥤ D} {G : D ⥤ E}
section Monoidal
variable [F.Monoidal] [F'.Monoidal] [G.Monoidal]
open scoped Obj
/-- The image of a group object under a monoidal functor is a group object. -/
abbrev grpObjObj {G : C} [GrpObj G] : GrpObj (F.obj G) where
inv := F.map ι
left_inv := by
simp [← Functor.map_id, Functor.Monoidal.lift_μ_assoc,
Functor.Monoidal.toUnit_ε_assoc, ← Functor.map_comp]
right_inv := by
simp [← Functor.map_id, Functor.Monoidal.lift_μ_assoc,
Functor.Monoidal.toUnit_ε_assoc, ← Functor.map_comp]
scoped[CategoryTheory.Obj] attribute [instance] CategoryTheory.Functor.grpObjObj
@[reassoc, simp] lemma obj.ι_def {G : C} [GrpObj G] : ι[F.obj G] = F.map ι := rfl
open Monoidal
variable (F) in
/-- A finite-product-preserving functor takes group objects to group objects. -/
@[simps!]
def mapGrp : Grp C ⥤ Grp D where
obj A := .mk (F.obj A.X)
map f := F.mapMon.map f
protected instance Faithful.mapGrp [F.Faithful] : F.mapGrp.Faithful where
map_injective hfg := F.mapMon.map_injective hfg
protected instance Full.mapGrp [F.Full] [F.Faithful] : F.mapGrp.Full where
map_surjective := F.mapMon.map_surjective
/-- If `F : C ⥤ D` is a fully faithful monoidal functor, then
`GrpCat(F) : GrpCat C ⥤ GrpCat D` is fully faithful too. -/
@[simps]
protected def FullyFaithful.mapGrp (hF : F.FullyFaithful) : F.mapGrp.FullyFaithful where
preimage f := .mk <| hF.preimage f.hom
@[simp]
theorem mapGrp_id_one (A : Grp C) :
η[((𝟭 C).mapGrp.obj A).X] = 𝟙 _ ≫ η[A.X] :=
rfl
@[simp]
theorem mapGrp_id_mul (A : Grp C) :
μ[((𝟭 C).mapGrp.obj A).X] = 𝟙 _ ≫ μ[A.X] :=
rfl
@[simp]
theorem comp_mapGrp_one (A : Grp C) :
η[((F ⋙ G).mapGrp.obj A).X] = LaxMonoidal.ε (F ⋙ G) ≫ (F ⋙ G).map η[A.X] :=
rfl
@[simp]
theorem comp_mapGrp_mul (A : Grp C) :
μ[((F ⋙ G).mapGrp.obj A).X] = LaxMonoidal.μ (F ⋙ G) _ _ ≫ (F ⋙ G).map μ[A.X] :=
rfl
/-- The identity functor is also the identity on group objects. -/
@[simps!]
def mapGrpIdIso : mapGrp (𝟭 C) ≅ 𝟭 (Grp C) :=
NatIso.ofComponents fun X ↦ Grp.mkIso (.refl _)
/-- The composition functor is also the composition on group objects. -/
@[simps!]
def mapGrpCompIso : (F ⋙ G).mapGrp ≅ F.mapGrp ⋙ G.mapGrp :=
NatIso.ofComponents fun X ↦ Grp.mkIso (.refl _)
/-- Natural transformations between functors lift to group objects. -/
@[simps!]
def mapGrpNatTrans (f : F ⟶ F') : F.mapGrp ⟶ F'.mapGrp where
app X := .mk' (f.app _)
/-- Natural isomorphisms between functors lift to group objects. -/
@[simps!]
def mapGrpNatIso (e : F ≅ F') : F.mapGrp ≅ F'.mapGrp :=
NatIso.ofComponents fun X ↦ Grp.mkIso (e.app _)
attribute [local instance] Monoidal.ofChosenFiniteProducts in
/-- `mapGrp` is functorial in the left-exact functor. -/
@[simps]
noncomputable def mapGrpFunctor : (C ⥤ₗ D) ⥤ Grp C ⥤ Grp D where
obj F := F.1.mapGrp
map {F G} α := { app A := .mk' (α.app A.X) }
/-- Pullback a group object along a fully faithful monoidal functor. -/
@[simps]
abbrev FullyFaithful.grpObj (hF : F.FullyFaithful) (X : C) [GrpObj (F.obj X)] :
GrpObj X where
__ := hF.monObj X
inv := hF.preimage ι[F.obj X]
left_inv := hF.map_injective <| by
simp [FullyFaithful.monObj, OplaxMonoidal.η_of_cartesianMonoidalCategory]
right_inv := hF.map_injective <| by
simp [FullyFaithful.monObj, OplaxMonoidal.η_of_cartesianMonoidalCategory]
@[deprecated (since := "2025-09-13")] alias FullyFaithful.grp_Class := FullyFaithful.grpObj
attribute [local simp] MonObj.ofIso_one MonObj.ofIso_mul in
/-- The essential image of a full and faithful functor between cartesian-monoidal categories is the
same on group objects as on objects. -/
@[simp] lemma essImage_mapGrp [F.Full] [F.Faithful] {G : Grp D} :
F.mapGrp.essImage G ↔ F.essImage G.X where
mp := by rintro ⟨H, ⟨e⟩⟩; exact ⟨H.X, ⟨(Grp.forget _).mapIso e⟩⟩
mpr := by
rintro ⟨H, ⟨e⟩⟩
let : GrpObj (F.obj H) := .ofIso e.symm
let : GrpObj H := (FullyFaithful.ofFullyFaithful F).grpObj H
refine ⟨⟨H⟩, ⟨Grp.mkIso e ?_ ?_⟩⟩ <;> simp
end Monoidal
section Braided
variable [BraidedCategory C] [BraidedCategory D] (F : C ⥤ D) [F.Braided]
open Monoidal LaxMonoidal
noncomputable instance mapGrp.instMonoidal : F.mapGrp.Monoidal :=
Functor.CoreMonoidal.toMonoidal
{ εIso := (Grp.fullyFaithfulForget₂Mon _).preimageIso (εIso F.mapMon)
μIso X Y := (Grp.fullyFaithfulForget₂Mon _).preimageIso (μIso F.mapMon X.toMon Y.toMon)
μIso_hom_natural_left f Z := by convert μ_natural_left F.mapMon f Z.toMon using 1
μIso_hom_natural_right Z f := by convert μ_natural_right F.mapMon Z.toMon f using 1
associativity X Y Z := by convert associativity F.mapMon X.toMon Y.toMon Z.toMon using 1
left_unitality X := by convert left_unitality F.mapMon X.toMon using 1
right_unitality X := by convert right_unitality F.mapMon X.toMon using 1 }
noncomputable instance mapGrp.instBraided : F.mapGrp.Braided where
braided X Y := by convert Braided.braided (F := F.mapMon) X.toMon Y.toMon using 1
end Braided
end Functor
open Functor
namespace Adjunction
variable {F : C ⥤ D} {G : D ⥤ C} (a : F ⊣ G) [F.Monoidal] [G.Monoidal]
/-- An adjunction of monoidal functors lifts to an adjunction of their lifts to group objects. -/
@[simps] def mapGrp : F.mapGrp ⊣ G.mapGrp where
unit := mapGrpIdIso.inv ≫ mapGrpNatTrans a.unit ≫ mapGrpCompIso.hom
counit := mapGrpCompIso.inv ≫ mapGrpNatTrans a.counit ≫ mapGrpIdIso.hom
end Adjunction
namespace Equivalence
variable (e : C ≌ D) [e.functor.Monoidal] [e.inverse.Monoidal]
/-- An equivalence of categories lifts to an equivalence of their group objects. -/
@[simps] def mapGrp : Grp C ≌ Grp D where
functor := e.functor.mapGrp
inverse := e.inverse.mapGrp
unitIso := mapGrpIdIso.symm ≪≫ mapGrpNatIso e.unitIso ≪≫ mapGrpCompIso
counitIso := mapGrpCompIso.symm ≪≫ mapGrpNatIso e.counitIso ≪≫ mapGrpIdIso
end CategoryTheory.Equivalence |
.lake/packages/mathlib/Mathlib/CategoryTheory/Monoidal/Subcategory.lean | import Mathlib.CategoryTheory.Monoidal.Braided.Basic
import Mathlib.CategoryTheory.Monoidal.Linear
import Mathlib.CategoryTheory.Monoidal.Transport
import Mathlib.CategoryTheory.Preadditive.AdditiveFunctor
import Mathlib.CategoryTheory.Linear.LinearFunctor
import Mathlib.CategoryTheory.Closed.Monoidal
/-!
# Full monoidal subcategories
Given a monoidal category `C` and a property of objects `P : ObjectProperty C`
that is monoidal (i.e. it holds for the unit and is stable by `⊗`),
we can put a monoidal structure on `P.FullSubcategory` (the category
structure is defined in `Mathlib/CategoryTheory/ObjectProperty/FullSubcategory.lean`).
When `C` is also braided/symmetric, the full monoidal subcategory also inherits the
braided/symmetric structure.
## TODO
* Add monoidal/braided versions of `ObjectProperty.Lift`
-/
universe u v
namespace CategoryTheory
open MonoidalCategory
variable {C : Type u} [Category.{v} C] [MonoidalCategory C]
namespace ObjectProperty
/-- Given three properties of objects `P₁`, `P₂`, and `Q` in a monoidal
category `C`, we say `TensorLE P₁ P₂ Q` holds if the tensor product
of an object in `P₁` and an object `P₂` is necessary in `Q`,
see also `ObjectProperty.IsMonoidal`. -/
class TensorLE (P₁ P₂ Q : ObjectProperty C) : Prop where
prop_tensor (X₁ X₂ : C) (h₁ : P₁ X₁) (h₂ : P₂ X₂) : Q (X₁ ⊗ X₂)
lemma prop_tensor {P₁ P₂ Q : ObjectProperty C} [TensorLE P₁ P₂ Q]
{X₁ X₂ : C} (h₁ : P₁ X₁) (h₂ : P₂ X₂) : Q (X₁ ⊗ X₂) :=
TensorLE.prop_tensor _ _ h₁ h₂
/-- This is the property that `P : ObjectProperty C` holds
for the unit of the monoidal category structure. -/
class ContainsUnit (P : ObjectProperty C) : Prop where
prop_unit : P (𝟙_ C)
lemma prop_unit (P : ObjectProperty C) [ContainsUnit P] : P (𝟙_ C) :=
ContainsUnit.prop_unit
/-- If `C` is a monoidal category, we say that `P : ObjectProperty C`
is monoidal if it is stable by tensor product and holds for the unit. -/
class IsMonoidal (P : ObjectProperty C) : Prop extends
ContainsUnit P, TensorLE P P P where
/-- A property of objects is a monoidal closed if it is closed under taking internal homs
-/
class IsMonoidalClosed (P : ObjectProperty C) [MonoidalClosed C] : Prop where
prop_ihom (X Y : C) : P X → P Y → P ((ihom X).obj Y) := by cat_disch
lemma prop_ihom (P : ObjectProperty C) [MonoidalClosed C] [P.IsMonoidalClosed]
{X Y : C} (hX : P X) (hY : P Y) : P ((ihom X).obj Y) :=
IsMonoidalClosed.prop_ihom _ _ hX hY
variable (P : ObjectProperty C) [P.IsMonoidal]
@[simps]
instance : MonoidalCategoryStruct P.FullSubcategory where
tensorObj X Y := ⟨X.1 ⊗ Y.1, prop_tensor X.2 Y.2⟩
whiskerLeft X _ _ f := X.1 ◁ f
whiskerRight {X₁ X₂} (f : X₁.1 ⟶ X₂.1) Y := (f ▷ Y.1 :)
tensorHom f g := f ⊗ₘ g
tensorUnit := ⟨𝟙_ C, P.prop_unit⟩
associator X Y Z := P.isoMk (α_ X.1 Y.1 Z.1)
leftUnitor X := P.isoMk (λ_ X.1)
rightUnitor X := P.isoMk (ρ_ X.1)
/--
When `P : ObjectProperty C` is monoidal, the full subcategory for `P` inherits the
monoidal structure of `C`.
-/
instance fullMonoidalSubcategory : MonoidalCategory (FullSubcategory P) :=
Monoidal.induced P.ι
{ μIso _ _ := Iso.refl _
εIso := Iso.refl _ }
/-- The forgetful monoidal functor from a full monoidal subcategory into the original category
("forgetting" the condition).
-/
instance monoidalι : P.ι.Monoidal :=
Functor.CoreMonoidal.toMonoidal
{ εIso := Iso.refl _
μIso := fun _ _ ↦ Iso.refl _ }
open Functor.LaxMonoidal Functor.OplaxMonoidal
@[simp] lemma ι_ε : ε P.ι = 𝟙 _ := rfl
@[simp] lemma ι_η : ε P.ι = 𝟙 _ := rfl
@[simp] lemma ι_μ (X Y : FullSubcategory P) : μ P.ι X Y = 𝟙 _ := rfl
@[simp] lemma ι_δ (X Y : FullSubcategory P) : δ P.ι X Y = 𝟙 _ := rfl
section
variable [Preadditive C]
instance [MonoidalPreadditive C] : MonoidalPreadditive P.FullSubcategory :=
monoidalPreadditive_of_faithful P.ι
variable (R : Type*) [Ring R] [Linear R C]
instance [MonoidalPreadditive C] [MonoidalLinear R C] : MonoidalLinear R P.FullSubcategory :=
.ofFaithful R P.ι
end
section
variable {P} {P' : ObjectProperty C} [P'.IsMonoidal] (h : P ≤ P')
/-- An inequality `P ≤ P'` between monoidal properties of objects induces
a monoidal functor between full monoidal subcategories. -/
instance : (ιOfLE h).Monoidal :=
Functor.CoreMonoidal.toMonoidal
{ εIso := Iso.refl _
μIso := fun _ _ ↦ Iso.refl _ }
@[simp] lemma ιOfLE_ε : ε (ιOfLE h) = 𝟙 _ := rfl
@[simp] lemma ιOfLE_η : η (ιOfLE h) = 𝟙 _ := rfl
@[simp] lemma ιOfLE_μ (X Y : P.FullSubcategory) : μ (ιOfLE h) X Y = 𝟙 _ := rfl
@[simp] lemma ιOfLE_δ (X Y : FullSubcategory P) : δ (ιOfLE h) X Y = 𝟙 _ := rfl
end
section Braided
variable [BraidedCategory C]
/-- The braided structure on a full subcategory inherited by the braided structure on `C`.
-/
instance fullBraidedSubcategory : BraidedCategory (FullSubcategory P) :=
.ofFaithful P.ι fun X Y ↦ P.isoMk (β_ X.1 Y.1)
/-- The forgetful braided functor from a full braided subcategory into the original category
("forgetting" the condition).
-/
instance : P.ι.Braided where
variable {P}
/-- An inequality `P ≤ P'` between monoidal properties of objects induces
a braided functor between full braided subcategories. -/
instance {P' : ObjectProperty C} [P'.IsMonoidal] (h : P ≤ P') :
(ιOfLE h).Braided where
end Braided
section Symmetric
variable [SymmetricCategory C]
instance fullSymmetricSubcategory : SymmetricCategory P.FullSubcategory :=
.ofFaithful P.ι
end Symmetric
section Closed
variable [MonoidalClosed C] [P.IsMonoidalClosed]
instance fullMonoidalClosedSubcategory : MonoidalClosed (FullSubcategory P) where
closed X :=
{ rightAdj := P.lift (P.ι ⋙ ihom X.1)
fun Y => P.prop_ihom X.2 Y.2
adj :=
{ unit :=
{ app := fun Y => (ihom.coev X.1).app Y.1
naturality := fun _ _ f => ihom.coev_naturality X.1 f }
counit :=
{ app := fun Y => (ihom.ev X.1).app Y.1
naturality := fun _ _ f => ihom.ev_naturality X.1 f }
left_triangle_components := fun X ↦
by simp [FullSubcategory.comp_def, FullSubcategory.id_def]
right_triangle_components := fun Y ↦
by simp [FullSubcategory.comp_def, FullSubcategory.id_def] } }
@[simp]
theorem ihom_obj (X Y : P.FullSubcategory) :
((ihom X).obj Y).obj = (ihom X.obj).obj Y.obj :=
rfl
@[simp]
theorem ihom_map (X : P.FullSubcategory) {Y Z : P.FullSubcategory}
(f : Y ⟶ Z) : (ihom X).map f = (ihom X.obj).map f :=
rfl
end Closed
end ObjectProperty
end CategoryTheory |
.lake/packages/mathlib/Mathlib/CategoryTheory/Monoidal/Conv.lean | import Mathlib.CategoryTheory.Monoidal.Comon_
/-!
# The convolution monoid.
When `M : Comon C` and `N : Mon C`, the morphisms `M.X ⟶ N.X` form a monoid (in Type).
-/
universe v₁ u₁
namespace CategoryTheory
open MonoidalCategory
open MonObj ComonObj
variable {C : Type u₁} [Category.{v₁} C] [MonoidalCategory C]
/--
The morphisms in `C` between the underlying objects of a pair of bimonoids in `C` naturally has a
(set-theoretic) monoid structure. -/
def Conv (M N : C) : Type v₁ := M ⟶ N
namespace Conv
variable {M : C} {N : C} [ComonObj M] [MonObj N]
instance : One (Conv M N) where
one := ε[M] ≫ η[N]
theorem one_eq : (1 : Conv M N) = ε[M] ≫ η[N] := rfl
instance : Mul (Conv M N) where
mul := fun f g => Δ[M] ≫ f ▷ M ≫ N ◁ g ≫ μ[N]
theorem mul_eq (f g : Conv M N) : f * g = Δ[M] ≫ f ▷ M ≫ N ◁ g ≫ μ[N] := rfl
instance : Monoid (Conv M N) where
one_mul f := by simp [one_eq, mul_eq, ← whisker_exchange_assoc]
mul_one f := by simp [one_eq, mul_eq, ← whisker_exchange_assoc]
mul_assoc f g h := by
simp only [mul_eq]
simp only [comp_whiskerRight, whisker_assoc, Category.assoc,
MonoidalCategory.whiskerLeft_comp]
slice_lhs 7 8 =>
rw [← whisker_exchange]
slice_rhs 2 3 =>
rw [← whisker_exchange]
simp
end Conv
end CategoryTheory |
.lake/packages/mathlib/Mathlib/CategoryTheory/Monoidal/Skeleton.lean | import Mathlib.CategoryTheory.Monoidal.Braided.Basic
import Mathlib.CategoryTheory.Monoidal.Transport
import Mathlib.CategoryTheory.Skeletal
/-!
# The monoid on the skeleton of a monoidal category
The skeleton of a monoidal category is a monoid.
## Main results
* `Skeleton.instMonoid`, for monoidal categories.
* `Skeleton.instCommMonoid`, for braided monoidal categories.
-/
namespace CategoryTheory
open MonoidalCategory
universe v u
variable {C : Type u} [Category.{v} C] [MonoidalCategory C]
/-- If `C` is monoidal and skeletal, it is a monoid.
See note [reducible non-instances]. -/
abbrev monoidOfSkeletalMonoidal (hC : Skeletal C) : Monoid C where
mul X Y := (X ⊗ Y : C)
one := (𝟙_ C : C)
one_mul X := hC ⟨λ_ X⟩
mul_one X := hC ⟨ρ_ X⟩
mul_assoc X Y Z := hC ⟨α_ X Y Z⟩
/-- If `C` is braided and skeletal, it is a commutative monoid. -/
def commMonoidOfSkeletalBraided [BraidedCategory C] (hC : Skeletal C) : CommMonoid C :=
{ monoidOfSkeletalMonoidal hC with mul_comm := fun X Y => hC ⟨β_ X Y⟩ }
namespace Skeleton
/-- The skeleton of a monoidal category has a monoidal structure itself, induced by the equivalence.
-/
noncomputable instance instMonoidalCategory : MonoidalCategory (Skeleton C) :=
Monoidal.transport (skeletonEquivalence C).symm
/--
The skeleton of a monoidal category can be viewed as a monoid, where the multiplication is given by
the tensor product, and satisfies the monoid axioms since it is a skeleton.
-/
noncomputable instance instMonoid : Monoid (Skeleton C) :=
monoidOfSkeletalMonoidal (skeleton_isSkeleton _).skel
theorem mul_eq (X Y : Skeleton C) : X * Y = toSkeleton (X.out ⊗ Y.out) := rfl
theorem one_eq : (1 : Skeleton C) = toSkeleton (𝟙_ C) := rfl
theorem toSkeleton_tensorObj (X Y : C) : toSkeleton (X ⊗ Y) = toSkeleton X * toSkeleton Y :=
let φ := (skeletonEquivalence C).symm.unitIso.app; Quotient.sound ⟨φ X ⊗ᵢ φ Y⟩
/-- The skeleton of a braided monoidal category has a braided monoidal structure itself, induced by
the equivalence. -/
noncomputable instance instBraidedCategory [BraidedCategory C] : BraidedCategory (Skeleton C) :=
(BraidedCategory.ofFullyFaithful
(Monoidal.equivalenceTransported (skeletonEquivalence C).symm).inverse:)
/--
The skeleton of a braided monoidal category can be viewed as a commutative monoid, where the
multiplication is given by the tensor product, and satisfies the monoid axioms since it is a
skeleton.
-/
noncomputable instance instCommMonoid [BraidedCategory C] : CommMonoid (Skeleton C) :=
commMonoidOfSkeletalBraided (skeleton_isSkeleton _).skel
end Skeleton
end CategoryTheory |
.lake/packages/mathlib/Mathlib/CategoryTheory/Monoidal/OfHasFiniteProducts.lean | import Mathlib.CategoryTheory.Monoidal.Cartesian.Basic
import Mathlib.CategoryTheory.Limits.Preserves.Shapes.BinaryProducts
import Mathlib.CategoryTheory.Limits.Preserves.Shapes.Terminal
/-!
# The natural monoidal structure on any category with finite (co)products.
A category with a monoidal structure provided in this way
is sometimes called a (co-)Cartesian category,
although this is also sometimes used to mean a finitely complete category.
(See <https://ncatlab.org/nlab/show/cartesian+category>.)
As this works with either products or coproducts,
and sometimes we want to think of a different monoidal structure entirely,
we don't set up either construct as an instance.
## TODO
Once we have cocartesian-monoidal categories, replace `monoidalOfHasFiniteCoproducts` and
`symmetricOfHasFiniteCoproducts` with `CocartesianMonoidalCategory.ofHasFiniteCoproducts`.
-/
universe v u
noncomputable section
namespace CategoryTheory
variable (C : Type u) [Category.{v} C] {X Y : C}
open CategoryTheory.Limits
section
/-- A category with a terminal object and binary products has a natural monoidal structure. -/
@[deprecated CartesianMonoidalCategory.ofHasFiniteProducts (since := "2025-10-19")]
def monoidalOfHasFiniteProducts [HasTerminal C] [HasBinaryProducts C] : MonoidalCategory C :=
have : HasFiniteProducts C := hasFiniteProducts_of_has_binary_and_terminal
let +nondep : CartesianMonoidalCategory C := .ofHasFiniteProducts
inferInstance
end
namespace monoidalOfHasFiniteProducts
variable [HasTerminal C] [HasBinaryProducts C]
attribute [local instance] monoidalOfHasFiniteProducts
open scoped MonoidalCategory
@[deprecated CartesianMonoidalCategory.toUnit_unique (since := "2025-10-19")]
theorem unit_ext {X : C} (f g : X ⟶ 𝟙_ C) : f = g := terminal.hom_ext f g
@[deprecated CartesianMonoidalCategory.hom_ext (since := "2025-10-19")]
theorem tensor_ext {X Y Z : C} (f g : X ⟶ Y ⊗ Z)
(w₁ : f ≫ prod.fst = g ≫ prod.fst) (w₂ : f ≫ prod.snd = g ≫ prod.snd) : f = g :=
Limits.prod.hom_ext w₁ w₂
@[deprecated "This is an implementation detail." (since := "2025-10-19"), simp]
theorem tensorUnit : 𝟙_ C = ⊤_ C := rfl
@[deprecated "This is an implementation detail." (since := "2025-10-19"), simp]
theorem tensorObj (X Y : C) : X ⊗ Y = (X ⨯ Y) :=
rfl
@[deprecated CartesianMonoidalCategory.leftUnitor_hom (since := "2025-10-19"), simp]
theorem leftUnitor_hom (X : C) : (λ_ X).hom = Limits.prod.snd :=
rfl
@[deprecated CartesianMonoidalCategory.rightUnitor_hom (since := "2025-10-19"), simp]
theorem rightUnitor_hom (X : C) : (ρ_ X).hom = Limits.prod.fst :=
rfl
@[deprecated "Use the `CartesianMonoidalCategory.associator_hom_...` lemmas"
(since := "2025-10-19"), simp]
theorem associator_hom (X Y Z : C) :
(α_ X Y Z).hom =
prod.lift (Limits.prod.fst ≫ Limits.prod.fst)
(prod.lift (Limits.prod.fst ≫ Limits.prod.snd) Limits.prod.snd) :=
rfl
@[deprecated "Use the `CartesianMonoidalCategory.associator_inv_...` lemmas"
(since := "2025-10-19")]
theorem associator_inv (X Y Z : C) :
(α_ X Y Z).inv =
prod.lift (prod.lift prod.fst (prod.snd ≫ prod.fst)) (prod.snd ≫ prod.snd) :=
rfl
set_option linter.deprecated false in
@[deprecated CartesianMonoidalCategory.associator_hom_fst (since := "2025-10-19")]
theorem associator_hom_fst (X Y Z : C) :
(α_ X Y Z).hom ≫ prod.fst = prod.fst ≫ prod.fst := by simp [associator_hom]
set_option linter.deprecated false in
@[deprecated CartesianMonoidalCategory.associator_hom_snd_fst (since := "2025-10-19")]
theorem associator_hom_snd_fst (X Y Z : C) :
(α_ X Y Z).hom ≫ prod.snd ≫ prod.fst = prod.fst ≫ prod.snd := by simp [associator_hom]
set_option linter.deprecated false in
@[deprecated CartesianMonoidalCategory.associator_hom_snd_snd (since := "2025-10-19")]
theorem associator_hom_snd_snd (X Y Z : C) :
(α_ X Y Z).hom ≫ prod.snd ≫ prod.snd = prod.snd := by simp [associator_hom]
set_option linter.deprecated false in
@[deprecated CartesianMonoidalCategory.associator_inv_fst_fst (since := "2025-10-19")]
theorem associator_inv_fst_fst (X Y Z : C) :
(α_ X Y Z).inv ≫ prod.fst ≫ prod.fst = prod.fst := by simp [associator_inv]
set_option linter.deprecated false in
@[deprecated CartesianMonoidalCategory.associator_inv_fst_snd (since := "2025-10-19")]
theorem associator_inv_fst_snd (X Y Z : C) :
(α_ X Y Z).inv ≫ prod.fst ≫ prod.snd = prod.snd ≫ prod.fst := by simp [associator_inv]
set_option linter.deprecated false in
@[deprecated CartesianMonoidalCategory.associator_inv_snd (since := "2025-10-19")]
theorem associator_inv_snd (X Y Z : C) :
(α_ X Y Z).inv ≫ prod.snd = prod.snd ≫ prod.snd := by simp [associator_inv]
end monoidalOfHasFiniteProducts
section
attribute [local instance] monoidalOfHasFiniteProducts
open MonoidalCategory
set_option linter.deprecated false in
/-- The monoidal structure coming from finite products is symmetric.
-/
@[deprecated CartesianMonoidalCategory.toSymmetricCategory (since := "2025-10-19"), simps!]
def symmetricOfHasFiniteProducts [HasTerminal C] [HasBinaryProducts C] : SymmetricCategory C :=
have : HasFiniteProducts C := hasFiniteProducts_of_has_binary_and_terminal
let : CartesianMonoidalCategory C := .ofHasFiniteProducts
let +nondep : BraidedCategory C := .ofCartesianMonoidalCategory
inferInstance
end
section
/-- A category with an initial object and binary coproducts has a natural monoidal structure. -/
def monoidalOfHasFiniteCoproducts [HasInitial C] [HasBinaryCoproducts C] : MonoidalCategory C :=
letI : MonoidalCategoryStruct C := {
tensorObj := fun X Y ↦ X ⨿ Y
whiskerLeft := fun _ _ _ g ↦ Limits.coprod.map (𝟙 _) g
whiskerRight := fun {_ _} f _ ↦ Limits.coprod.map f (𝟙 _)
tensorHom := fun f g ↦ Limits.coprod.map f g
tensorUnit := ⊥_ C
associator := coprod.associator
leftUnitor := fun P ↦ coprod.leftUnitor P
rightUnitor := fun P ↦ coprod.rightUnitor P
}
.ofTensorHom
(pentagon := coprod.pentagon)
(triangle := coprod.triangle)
(associator_naturality := @coprod.associator_naturality _ _ _)
end
namespace monoidalOfHasFiniteCoproducts
variable [HasInitial C] [HasBinaryCoproducts C]
attribute [local instance] monoidalOfHasFiniteCoproducts
open scoped MonoidalCategory
@[simp]
theorem tensorObj (X Y : C) : X ⊗ Y = (X ⨿ Y) :=
rfl
@[simp]
theorem tensorHom {W X Y Z : C} (f : W ⟶ X) (g : Y ⟶ Z) : f ⊗ₘ g = Limits.coprod.map f g :=
rfl
@[simp]
theorem whiskerLeft (X : C) {Y Z : C} (f : Y ⟶ Z) : X ◁ f = Limits.coprod.map (𝟙 X) f :=
rfl
@[simp]
theorem whiskerRight {X Y : C} (f : X ⟶ Y) (Z : C) : f ▷ Z = Limits.coprod.map f (𝟙 Z) :=
rfl
@[simp]
theorem leftUnitor_hom (X : C) : (λ_ X).hom = coprod.desc (initial.to X) (𝟙 _) :=
rfl
@[simp]
theorem rightUnitor_hom (X : C) : (ρ_ X).hom = coprod.desc (𝟙 _) (initial.to X) :=
rfl
@[simp]
theorem leftUnitor_inv (X : C) : (λ_ X).inv = Limits.coprod.inr :=
rfl
@[simp]
theorem rightUnitor_inv (X : C) : (ρ_ X).inv = Limits.coprod.inl :=
rfl
-- We don't mark this as a simp lemma, even though in many particular
-- categories the right-hand side will simplify significantly further.
-- For now, we'll plan to create specialised simp lemmas in each particular category.
theorem associator_hom (X Y Z : C) :
(α_ X Y Z).hom =
coprod.desc (coprod.desc coprod.inl (coprod.inl ≫ coprod.inr)) (coprod.inr ≫ coprod.inr) :=
rfl
theorem associator_inv (X Y Z : C) :
(α_ X Y Z).inv =
coprod.desc (coprod.inl ≫ coprod.inl) (coprod.desc (coprod.inr ≫ coprod.inl) coprod.inr) :=
rfl
end monoidalOfHasFiniteCoproducts
section
attribute [local instance] monoidalOfHasFiniteCoproducts
open MonoidalCategory
/-- The monoidal structure coming from finite coproducts is symmetric.
-/
@[simps]
def symmetricOfHasFiniteCoproducts [HasInitial C] [HasBinaryCoproducts C] :
SymmetricCategory C where
braiding := Limits.coprod.braiding
braiding_naturality_left f g := by simp
braiding_naturality_right f g := by simp
hexagon_forward X Y Z := by dsimp [monoidalOfHasFiniteCoproducts.associator_hom]; simp
hexagon_reverse X Y Z := by dsimp [monoidalOfHasFiniteCoproducts.associator_inv]; simp
symmetry X Y := by simp
end
namespace monoidalOfHasFiniteProducts
variable {C}
variable {D : Type*} [Category D] (F : C ⥤ D)
[HasTerminal C] [HasBinaryProducts C]
[HasTerminal D] [HasBinaryProducts D]
set_option linter.deprecated false in
attribute [local simp] associator_hom_fst
@[deprecated Functor.OplaxMonoidal.ofChosenFiniteProducts (since := "2025-10-19")]
instance :
have : HasFiniteProducts C := hasFiniteProducts_of_has_binary_and_terminal
have : HasFiniteProducts D := hasFiniteProducts_of_has_binary_and_terminal
let : CartesianMonoidalCategory C := .ofHasFiniteProducts
let : CartesianMonoidalCategory D := .ofHasFiniteProducts
F.OplaxMonoidal := by extract_lets; exact .ofChosenFiniteProducts F
open Functor.OplaxMonoidal
@[deprecated "No replacement" (since := "2025-10-19")]
lemma η_eq :
have : HasFiniteProducts C := hasFiniteProducts_of_has_binary_and_terminal
have : HasFiniteProducts D := hasFiniteProducts_of_has_binary_and_terminal
let : CartesianMonoidalCategory C := .ofHasFiniteProducts
let : CartesianMonoidalCategory D := .ofHasFiniteProducts
η F = terminalComparison F := rfl
@[deprecated "No replacement" (since := "2025-10-19")]
lemma δ_eq (X Y : C) :
have : HasFiniteProducts C := hasFiniteProducts_of_has_binary_and_terminal
have : HasFiniteProducts D := hasFiniteProducts_of_has_binary_and_terminal
let : CartesianMonoidalCategory C := .ofHasFiniteProducts
let : CartesianMonoidalCategory D := .ofHasFiniteProducts
δ F X Y = prodComparison F X Y := rfl
variable [PreservesLimit (Functor.empty.{0} C) F]
[PreservesLimitsOfShape (Discrete WalkingPair) F]
set_option linter.deprecated false in
@[deprecated inferInstance (since := "2025-10-19")]
instance :
have : HasFiniteProducts C := hasFiniteProducts_of_has_binary_and_terminal
have : HasFiniteProducts D := hasFiniteProducts_of_has_binary_and_terminal
let : CartesianMonoidalCategory C := .ofHasFiniteProducts
let : CartesianMonoidalCategory D := .ofHasFiniteProducts
IsIso (η F) := by dsimp [η_eq]; infer_instance
set_option linter.deprecated false in
@[deprecated inferInstance (since := "2025-10-19")]
instance (X Y : C) :
have : HasFiniteProducts C := hasFiniteProducts_of_has_binary_and_terminal
have : HasFiniteProducts D := hasFiniteProducts_of_has_binary_and_terminal
let : CartesianMonoidalCategory C := .ofHasFiniteProducts
let : CartesianMonoidalCategory D := .ofHasFiniteProducts
IsIso (δ F X Y) := by dsimp [δ_eq]; infer_instance
/-- Promote a functor that preserves finite products to a monoidal functor between
categories equipped with the monoidal category structure given by finite products. -/
@[deprecated Functor.Monoidal.ofChosenFiniteProducts (since := "2025-10-19")]
instance :
have : HasFiniteProducts C := hasFiniteProducts_of_has_binary_and_terminal
have : HasFiniteProducts D := hasFiniteProducts_of_has_binary_and_terminal
let : CartesianMonoidalCategory C := .ofHasFiniteProducts
let : CartesianMonoidalCategory D := .ofHasFiniteProducts
F.Monoidal := by extract_lets; exact .ofOplaxMonoidal F
end monoidalOfHasFiniteProducts
end CategoryTheory |
.lake/packages/mathlib/Mathlib/CategoryTheory/Monoidal/Mod_.lean | import Mathlib.CategoryTheory.Monoidal.Mon_
import Mathlib.CategoryTheory.Monoidal.Action.Basic
/-!
# The category of module objects over a monoid object.
-/
universe v₁ v₂ u₁ u₂
open CategoryTheory MonoidalCategory MonObj
namespace CategoryTheory
variable {C : Type u₁} [Category.{v₁} C] [MonoidalCategory.{v₁} C]
{D : Type u₂} [Category.{v₂} D] [MonoidalLeftAction C D]
section ModObj
open MonObj
variable (M : C) [MonObj M]
open scoped MonoidalLeftAction
/-- Given an action of a monoidal category `C` on a category `D`,
an action of a monoid object `M` in `C` on an object `X` in `D` is the data of a
map `smul : M ⊙ₗ X ⟶ X` that satisfies unitality and associativity with
multiplication.
See `MulAction` for the non-categorical version. -/
class ModObj (X : D) where
/-- The action map -/
smul : M ⊙ₗ X ⟶ X
/-- The identity acts trivially. -/
one_smul' (X) : η ⊵ₗ X ≫ smul = (λₗ X).hom := by cat_disch
/-- The action map is compatible with multiplication. -/
mul_smul' (X) : μ ⊵ₗ X ≫ smul = (αₗ M M X).hom ≫ M ⊴ₗ smul ≫ smul := by cat_disch
@[deprecated (since := "2025-09-14")] alias Mod_Class := ModObj
attribute [reassoc] ModObj.mul_smul' ModObj.one_smul'
@[inherit_doc] scoped[CategoryTheory.MonObj] notation "γ" => ModObj.smul
@[inherit_doc] scoped[CategoryTheory.MonObj] notation "γ["Y"]" => ModObj.smul (X := Y)
@[inherit_doc] scoped[CategoryTheory.MonObj] notation "γ["N","Y"]" =>
ModObj.smul (M := N) (X := Y)
variable {M}
namespace ModObj
@[reassoc (attr := simp)]
theorem one_smul (X : D) [ModObj M X] :
η ⊵ₗ X ≫ γ[M,X] = (λₗ[C] X).hom :=
ModObj.one_smul' X
@[reassoc (attr := simp)]
theorem mul_smul (X : D) [ModObj M X] :
μ ⊵ₗ X ≫ γ = (αₗ M M X).hom ≫ M ⊴ₗ γ ≫ γ := ModObj.mul_smul' X
theorem assoc_flip (X : D) [ModObj M X] : M ⊴ₗ γ ≫ γ =
(αₗ M M X).inv ≫ μ[M] ⊵ₗ X ≫ γ := by
simp
variable (M) in
/-- The action of a monoid object on itself. -/
-- See note [reducible non-instances]
abbrev regular : ModObj M M where
smul := μ
attribute [local instance] regular in
@[simp] lemma smul_eq_mul (M : C) [MonObj M] : γ[M, M] = μ[M] := rfl
/-- If `C` acts monoidally on `D`, then every object of `D` is canonically a
module over the trivial monoid. -/
@[simps]
instance (X : D) : ModObj (𝟙_ C) X where
smul := (λₗ _).hom
@[ext]
theorem ext {X : C} (h₁ h₂ : ModObj M X) (H : h₁.smul = h₂.smul) :
h₁ = h₂ := by
cases h₁
cases h₂
subst H
rfl
end ModObj
end ModObj
open scoped ModObj MonoidalLeftAction
variable (A : C) [MonObj A]
/-- A morphism in `D` is a morphism of `A`-module objects if it commutes with
the action maps -/
class IsMod_Hom {M N : D} [ModObj A M] [ModObj A N] (f : M ⟶ N) where
smul_hom : γ[M] ≫ f = A ⊴ₗ f ≫ γ[N] := by cat_disch
attribute [reassoc (attr := simp)] IsMod_Hom.smul_hom
variable {M N O : D} [ModObj A M] [ModObj A N] [ModObj A O]
instance : IsMod_Hom A (𝟙 M) where
instance (f : M ⟶ N) (g : N ⟶ O) [IsMod_Hom A f] [IsMod_Hom A g] :
IsMod_Hom A (f ≫ g) where
instance (f : M ≅ N) [IsMod_Hom A f.hom] :
IsMod_Hom A f.inv where
smul_hom := by simp [Iso.comp_inv_eq]
variable (D) in
/-- A module object for a monoid object in a monoidal category acting on the
ambient category. -/
structure Mod_ (A : C) [MonObj A] where
/-- The underlying object in the ambient category -/
X : D
[mod : ModObj A X]
attribute [instance] Mod_.mod
namespace Mod_
variable {A : C} [MonObj A] (M : Mod_ D A)
theorem assoc_flip : A ⊴ₗ γ ≫ γ = (αₗ A A M.X).inv ≫ μ ⊵ₗ M.X ≫ γ := by simp
/-- A morphism of module objects. -/
@[ext]
structure Hom (M N : Mod_ D A) where
/-- The underlying morphism -/
hom : M.X ⟶ N.X
[isMod_Hom : IsMod_Hom A hom]
attribute [instance] Hom.isMod_Hom
/-- An alternative constructor for `Hom`,
taking a morphism without a [isMod_Hom] instance, as well as the relevant
equality to put such an instance. -/
@[simps!]
def Hom.mk' {M N : Mod_ D A} (f : M.X ⟶ N.X)
(smul_hom : γ[M.X] ≫ f = A ⊴ₗ f ≫ γ[N.X] := by cat_disch) : Hom M N :=
letI : IsMod_Hom A f := ⟨smul_hom⟩
⟨f⟩
/-- An alternative constructor for `Hom`,
taking a morphism without a [isMod_Hom] instance, between objects with
a `ModObj` instance (rather than bundled as `Mod_`),
as well as the relevant equality to put such an instance. -/
@[simps!]
def Hom.mk'' {M N : D} [ModObj A M] [ModObj A N] (f : M ⟶ N)
(smul_hom : γ[M] ≫ f = A ⊴ₗ f ≫ γ[N] := by cat_disch) :
Hom (.mk (A := A) M) (.mk (A := A) N) :=
letI : IsMod_Hom A f := ⟨smul_hom⟩
⟨f⟩
/-- The identity morphism on a module object. -/
@[simps]
def id (M : Mod_ D A) : Hom M M where hom := 𝟙 M.X
instance homInhabited (M : Mod_ D A) : Inhabited (Hom M M) :=
⟨id M⟩
/-- Composition of module object morphisms. -/
@[simps]
def comp {M N O : Mod_ D A} (f : Hom M N) (g : Hom N O) :
Hom M O where
hom := f.hom ≫ g.hom
instance : Category (Mod_ D A) where
Hom M N := Hom M N
id := id
comp f g := comp f g
@[ext]
lemma hom_ext {M N : Mod_ D A} (f₁ f₂ : M ⟶ N) (h : f₁.hom = f₂.hom) :
f₁ = f₂ :=
Hom.ext h
@[simp]
theorem id_hom' (M : Mod_ D A) : (𝟙 M : M ⟶ M).hom = 𝟙 M.X := by
rfl
@[simp]
theorem comp_hom' {M N K : Mod_ D A} (f : M ⟶ N) (g : N ⟶ K) :
(f ≫ g).hom = f.hom ≫ g.hom :=
rfl
variable (A)
/-- A monoid object as a module over itself. -/
@[simps]
def regular : Mod_ C A :=
letI : ModObj A A := .regular A
⟨A⟩
instance : Inhabited (Mod_ C A) :=
⟨regular A⟩
/-- The forgetful functor from module objects to the ambient category. -/
@[simps]
def forget : Mod_ D A ⥤ D where
obj A := A.X
map f := f.hom
section comap
variable {A B : C} [MonObj A] [MonObj B] (f : A ⟶ B) [IsMonHom f]
open MonoidalLeftAction in
/-- When `M` is a `B`-module in `D` and `f : A ⟶ B` is a morphism of internal
monoid objects, `M` inherits an `A`-module structure via
"restriction of scalars", i.e `γ[A, M] = f.hom ⊵ₗ M ≫ γ[B, M]`. -/
@[simps!]
def scalarRestriction (M : D) [ModObj B M] : ModObj A M where
smul := f ⊵ₗ M ≫ γ[B, M]
one_smul' := by
rw [← comp_actionHomLeft_assoc]
rw [IsMonHom.one_hom, ModObj.one_smul]
mul_smul' := by
-- oh, for homotopy.io in a widget!
slice_rhs 2 3 => rw [action_exchange]
simp only [actionHomLeft_action_assoc, Category.assoc, Iso.hom_inv_id_assoc,
actionHomRight_comp]
slice_rhs 4 6 => rw [ModObj.assoc_flip]
slice_rhs 2 4 => rw [← whiskerLeft_actionHomLeft]
slice_rhs 1 2 => rw [← comp_actionHomLeft]
rw [← comp_actionHomLeft, Category.assoc, ← comp_actionHomLeft_assoc,
IsMonHom.mul_hom, tensorHom_def, Category.assoc]
open MonoidalLeftAction in
/-- If `g : M ⟶ N` is a `B`-linear morphisms of `B`-modules, then it induces an
`A`-linear morphism when `M` and `N` have an `A`-module structure obtained
by restricting scalars along a monoid morphism `A ⟶ B`. -/
lemma scalarRestriction_hom
(M N : D) [ModObj B M] [ModObj B N] (g : M ⟶ N) [IsMod_Hom B g] :
letI := scalarRestriction f M
letI := scalarRestriction f N
IsMod_Hom A g :=
letI := scalarRestriction f M
letI := scalarRestriction f N
{ smul_hom := by
dsimp
slice_rhs 1 2 => rw [action_exchange]
slice_rhs 2 3 => rw [← IsMod_Hom.smul_hom]
rw [Category.assoc] }
/-- A morphism of monoid objects induces a "restriction" or "comap" functor
between the categories of module objects.
-/
@[simps]
def comap {A B : C} [MonObj A] [MonObj B] (f : A ⟶ B) [IsMonHom f] :
Mod_ D B ⥤ Mod_ D A where
obj M :=
letI := scalarRestriction f M.X
⟨M.X⟩
map {M N} g :=
letI := scalarRestriction_hom f M.X N.X g.hom
⟨g.hom⟩
-- Lots more could be said about `comap`, e.g. how it interacts with
-- identities, compositions, and equalities of monoid object morphisms.
end comap
end Mod_
end CategoryTheory |
.lake/packages/mathlib/Mathlib/CategoryTheory/Monoidal/Bimod.lean | import Mathlib.CategoryTheory.Bicategory.Basic
import Mathlib.CategoryTheory.Monoidal.Mon_
import Mathlib.CategoryTheory.Limits.Preserves.Shapes.Equalizers
/-!
# The category of bimodule objects over a pair of monoid objects.
-/
universe v₁ v₂ u₁ u₂
open CategoryTheory
open CategoryTheory.MonoidalCategory MonObj
variable {C : Type u₁} [Category.{v₁} C] [MonoidalCategory.{v₁} C]
section
open CategoryTheory.Limits
variable [HasCoequalizers C]
section
variable [∀ X : C, PreservesColimitsOfSize.{0, 0} (tensorLeft X)]
theorem id_tensor_π_preserves_coequalizer_inv_desc {W X Y Z : C} (f g : X ⟶ Y) (h : Z ⊗ Y ⟶ W)
(wh : (Z ◁ f) ≫ h = (Z ◁ g) ≫ h) :
(Z ◁ coequalizer.π f g) ≫
(PreservesCoequalizer.iso (tensorLeft Z) f g).inv ≫ coequalizer.desc h wh =
h :=
map_π_preserves_coequalizer_inv_desc (tensorLeft Z) f g h wh
theorem id_tensor_π_preserves_coequalizer_inv_colimMap_desc {X Y Z X' Y' Z' : C} (f g : X ⟶ Y)
(f' g' : X' ⟶ Y') (p : Z ⊗ X ⟶ X') (q : Z ⊗ Y ⟶ Y') (wf : (Z ◁ f) ≫ q = p ≫ f')
(wg : (Z ◁ g) ≫ q = p ≫ g') (h : Y' ⟶ Z') (wh : f' ≫ h = g' ≫ h) :
(Z ◁ coequalizer.π f g) ≫
(PreservesCoequalizer.iso (tensorLeft Z) f g).inv ≫
colimMap (parallelPairHom (Z ◁ f) (Z ◁ g) f' g' p q wf wg) ≫ coequalizer.desc h wh =
q ≫ h :=
map_π_preserves_coequalizer_inv_colimMap_desc (tensorLeft Z) f g f' g' p q wf wg h wh
end
section
variable [∀ X : C, PreservesColimitsOfSize.{0, 0} (tensorRight X)]
theorem π_tensor_id_preserves_coequalizer_inv_desc {W X Y Z : C} (f g : X ⟶ Y) (h : Y ⊗ Z ⟶ W)
(wh : (f ▷ Z) ≫ h = (g ▷ Z) ≫ h) :
(coequalizer.π f g ▷ Z) ≫
(PreservesCoequalizer.iso (tensorRight Z) f g).inv ≫ coequalizer.desc h wh =
h :=
map_π_preserves_coequalizer_inv_desc (tensorRight Z) f g h wh
theorem π_tensor_id_preserves_coequalizer_inv_colimMap_desc {X Y Z X' Y' Z' : C} (f g : X ⟶ Y)
(f' g' : X' ⟶ Y') (p : X ⊗ Z ⟶ X') (q : Y ⊗ Z ⟶ Y') (wf : (f ▷ Z) ≫ q = p ≫ f')
(wg : (g ▷ Z) ≫ q = p ≫ g') (h : Y' ⟶ Z') (wh : f' ≫ h = g' ≫ h) :
(coequalizer.π f g ▷ Z) ≫
(PreservesCoequalizer.iso (tensorRight Z) f g).inv ≫
colimMap (parallelPairHom (f ▷ Z) (g ▷ Z) f' g' p q wf wg) ≫ coequalizer.desc h wh =
q ≫ h :=
map_π_preserves_coequalizer_inv_colimMap_desc (tensorRight Z) f g f' g' p q wf wg h wh
end
end
/-- A bimodule object for a pair of monoid objects, all internal to some monoidal category. -/
structure Bimod (A B : Mon C) where
/-- The underlying monoidal category -/
X : C
/-- The left action of this bimodule object -/
actLeft : A.X ⊗ X ⟶ X
one_actLeft : η ▷ X ≫ actLeft = (λ_ X).hom := by cat_disch
left_assoc :
μ ▷ X ≫ actLeft = (α_ A.X A.X X).hom ≫ A.X ◁ actLeft ≫ actLeft := by cat_disch
/-- The right action of this bimodule object -/
actRight : X ⊗ B.X ⟶ X
actRight_one : X ◁ η ≫ actRight = (ρ_ X).hom := by cat_disch
right_assoc :
X ◁ μ ≫ actRight = (α_ X B.X B.X).inv ≫ actRight ▷ B.X ≫ actRight := by
cat_disch
middle_assoc :
actLeft ▷ B.X ≫ actRight = (α_ A.X X B.X).hom ≫ A.X ◁ actRight ≫ actLeft := by
cat_disch
attribute [reassoc (attr := simp)] Bimod.one_actLeft Bimod.actRight_one Bimod.left_assoc
Bimod.right_assoc Bimod.middle_assoc
namespace Bimod
variable {A B : Mon C} (M : Bimod A B)
/-- A morphism of bimodule objects. -/
@[ext]
structure Hom (M N : Bimod A B) where
/-- The morphism between `M`'s monoidal category and `N`'s monoidal category -/
hom : M.X ⟶ N.X
left_act_hom : M.actLeft ≫ hom = (A.X ◁ hom) ≫ N.actLeft := by cat_disch
right_act_hom : M.actRight ≫ hom = (hom ▷ B.X) ≫ N.actRight := by cat_disch
attribute [reassoc (attr := simp)] Hom.left_act_hom Hom.right_act_hom
/-- The identity morphism on a bimodule object. -/
@[simps]
def id' (M : Bimod A B) : Hom M M where hom := 𝟙 M.X
instance homInhabited (M : Bimod A B) : Inhabited (Hom M M) :=
⟨id' M⟩
/-- Composition of bimodule object morphisms. -/
@[simps]
def comp {M N O : Bimod A B} (f : Hom M N) (g : Hom N O) : Hom M O where hom := f.hom ≫ g.hom
instance : Category (Bimod A B) where
Hom M N := Hom M N
id := id'
comp f g := comp f g
@[ext]
lemma hom_ext {M N : Bimod A B} (f g : M ⟶ N) (h : f.hom = g.hom) : f = g :=
Hom.ext h
@[simp]
theorem id_hom' (M : Bimod A B) : (𝟙 M : Hom M M).hom = 𝟙 M.X :=
rfl
@[simp]
theorem comp_hom' {M N K : Bimod A B} (f : M ⟶ N) (g : N ⟶ K) :
(f ≫ g : Hom M K).hom = f.hom ≫ g.hom :=
rfl
/-- Construct an isomorphism of bimodules by giving an isomorphism between the underlying objects
and checking compatibility with left and right actions only in the forward direction.
-/
@[simps]
def isoOfIso {X Y : Mon C} {P Q : Bimod X Y} (f : P.X ≅ Q.X)
(f_left_act_hom : P.actLeft ≫ f.hom = (X.X ◁ f.hom) ≫ Q.actLeft)
(f_right_act_hom : P.actRight ≫ f.hom = (f.hom ▷ Y.X) ≫ Q.actRight) : P ≅ Q where
hom :=
{ hom := f.hom }
inv :=
{ hom := f.inv
left_act_hom := by
rw [← cancel_mono f.hom, Category.assoc, Category.assoc, Iso.inv_hom_id, Category.comp_id,
f_left_act_hom, ← Category.assoc, ← whiskerLeft_comp, Iso.inv_hom_id,
whiskerLeft_id, Category.id_comp]
right_act_hom := by
rw [← cancel_mono f.hom, Category.assoc, Category.assoc, Iso.inv_hom_id, Category.comp_id,
f_right_act_hom, ← Category.assoc, ← comp_whiskerRight, Iso.inv_hom_id,
id_whiskerRight, Category.id_comp] }
hom_inv_id := by ext; dsimp; rw [Iso.hom_inv_id]
inv_hom_id := by ext; dsimp; rw [Iso.inv_hom_id]
variable (A)
/-- A monoid object as a bimodule over itself. -/
@[simps]
def regular : Bimod A A where
X := A.X
actLeft := μ
actRight := μ
instance : Inhabited (Bimod A A) :=
⟨regular A⟩
/-- The forgetful functor from bimodule objects to the ambient category. -/
def forget : Bimod A B ⥤ C where
obj A := A.X
map f := f.hom
open CategoryTheory.Limits
variable [HasCoequalizers C]
namespace TensorBimod
variable {R S T : Mon C} (P : Bimod R S) (Q : Bimod S T)
/-- The underlying object of the tensor product of two bimodules. -/
noncomputable def X : C :=
coequalizer (P.actRight ▷ Q.X) ((α_ _ _ _).hom ≫ (P.X ◁ Q.actLeft))
section
variable [∀ X : C, PreservesColimitsOfSize.{0, 0} (tensorLeft X)]
/-- Left action for the tensor product of two bimodules. -/
noncomputable def actLeft : R.X ⊗ X P Q ⟶ X P Q :=
(PreservesCoequalizer.iso (tensorLeft R.X) _ _).inv ≫
colimMap
(parallelPairHom _ _ _ _
((α_ _ _ _).inv ≫ ((α_ _ _ _).inv ▷ _) ≫ (P.actLeft ▷ S.X ▷ Q.X))
((α_ _ _ _).inv ≫ (P.actLeft ▷ Q.X))
(by
dsimp
simp only [Category.assoc]
slice_lhs 1 2 => rw [associator_inv_naturality_middle]
slice_rhs 3 4 => rw [← comp_whiskerRight, middle_assoc, comp_whiskerRight]
simp)
(by
dsimp
slice_lhs 1 1 => rw [whiskerLeft_comp]
slice_lhs 2 3 => rw [associator_inv_naturality_right]
slice_lhs 3 4 => rw [whisker_exchange]
simp))
theorem whiskerLeft_π_actLeft :
(R.X ◁ coequalizer.π _ _) ≫ actLeft P Q =
(α_ _ _ _).inv ≫ (P.actLeft ▷ Q.X) ≫ coequalizer.π _ _ := by
erw [map_π_preserves_coequalizer_inv_colimMap (tensorLeft _)]
simp only [Category.assoc]
theorem one_act_left' : (η ▷ _) ≫ actLeft P Q = (λ_ _).hom := by
refine (cancel_epi ((tensorLeft _).map (coequalizer.π _ _))).1 ?_
dsimp [X]
slice_lhs 1 2 => rw [whisker_exchange]
slice_lhs 2 3 => rw [whiskerLeft_π_actLeft]
slice_lhs 1 2 => rw [associator_inv_naturality_left]
slice_lhs 2 3 => rw [← comp_whiskerRight, one_actLeft]
slice_rhs 1 2 => rw [leftUnitor_naturality]
monoidal
theorem left_assoc' :
(μ ▷ _) ≫ actLeft P Q = (α_ R.X R.X _).hom ≫ (R.X ◁ actLeft P Q) ≫ actLeft P Q := by
refine (cancel_epi ((tensorLeft _).map (coequalizer.π _ _))).1 ?_
dsimp [X]
slice_lhs 1 2 => rw [whisker_exchange]
slice_lhs 2 3 => rw [whiskerLeft_π_actLeft]
slice_lhs 1 2 => rw [associator_inv_naturality_left]
slice_lhs 2 3 => rw [← comp_whiskerRight, left_assoc, comp_whiskerRight, comp_whiskerRight]
slice_rhs 1 2 => rw [associator_naturality_right]
slice_rhs 2 3 =>
rw [← whiskerLeft_comp, whiskerLeft_π_actLeft,
whiskerLeft_comp, whiskerLeft_comp]
slice_rhs 4 5 => rw [whiskerLeft_π_actLeft]
slice_rhs 3 4 => rw [associator_inv_naturality_middle]
monoidal
end
section
variable [∀ X : C, PreservesColimitsOfSize.{0, 0} (tensorRight X)]
/-- Right action for the tensor product of two bimodules. -/
noncomputable def actRight : X P Q ⊗ T.X ⟶ X P Q :=
(PreservesCoequalizer.iso (tensorRight T.X) _ _).inv ≫
colimMap
(parallelPairHom _ _ _ _
((α_ _ _ _).hom ≫ (α_ _ _ _).hom ≫ (P.X ◁ S.X ◁ Q.actRight) ≫ (α_ _ _ _).inv)
((α_ _ _ _).hom ≫ (P.X ◁ Q.actRight))
(by
dsimp
slice_lhs 1 2 => rw [associator_naturality_left]
slice_lhs 2 3 => rw [← whisker_exchange]
simp)
(by
dsimp
simp only [comp_whiskerRight, whisker_assoc, Category.assoc, Iso.inv_hom_id_assoc]
slice_lhs 3 4 =>
rw [← whiskerLeft_comp, middle_assoc, whiskerLeft_comp]
simp))
theorem π_tensor_id_actRight :
(coequalizer.π _ _ ▷ T.X) ≫ actRight P Q =
(α_ _ _ _).hom ≫ (P.X ◁ Q.actRight) ≫ coequalizer.π _ _ := by
erw [map_π_preserves_coequalizer_inv_colimMap (tensorRight _)]
simp only [Category.assoc]
theorem actRight_one' : (_ ◁ η) ≫ actRight P Q = (ρ_ _).hom := by
refine (cancel_epi ((tensorRight _).map (coequalizer.π _ _))).1 ?_
dsimp [X]
slice_lhs 1 2 => rw [← whisker_exchange]
slice_lhs 2 3 => rw [π_tensor_id_actRight]
slice_lhs 1 2 => rw [associator_naturality_right]
slice_lhs 2 3 => rw [← whiskerLeft_comp, actRight_one]
simp
theorem right_assoc' :
(_ ◁ μ) ≫ actRight P Q =
(α_ _ T.X T.X).inv ≫ (actRight P Q ▷ T.X) ≫ actRight P Q := by
refine (cancel_epi ((tensorRight _).map (coequalizer.π _ _))).1 ?_
dsimp [X]
slice_lhs 1 2 => rw [← whisker_exchange]
slice_lhs 2 3 => rw [π_tensor_id_actRight]
slice_lhs 1 2 => rw [associator_naturality_right]
slice_lhs 2 3 => rw [← whiskerLeft_comp, right_assoc,
whiskerLeft_comp, whiskerLeft_comp]
slice_rhs 1 2 => rw [associator_inv_naturality_left]
slice_rhs 2 3 => rw [← comp_whiskerRight, π_tensor_id_actRight, comp_whiskerRight,
comp_whiskerRight]
slice_rhs 4 5 => rw [π_tensor_id_actRight]
simp
end
section
variable [∀ X : C, PreservesColimitsOfSize.{0, 0} (tensorLeft X)]
variable [∀ X : C, PreservesColimitsOfSize.{0, 0} (tensorRight X)]
theorem middle_assoc' :
(actLeft P Q ▷ T.X) ≫ actRight P Q =
(α_ R.X _ T.X).hom ≫ (R.X ◁ actRight P Q) ≫ actLeft P Q := by
refine (cancel_epi ((tensorLeft _ ⋙ tensorRight _).map (coequalizer.π _ _))).1 ?_
dsimp [X]
slice_lhs 1 2 => rw [← comp_whiskerRight, whiskerLeft_π_actLeft, comp_whiskerRight,
comp_whiskerRight]
slice_lhs 3 4 => rw [π_tensor_id_actRight]
slice_lhs 2 3 => rw [associator_naturality_left]
slice_rhs 1 2 => rw [associator_naturality_middle]
slice_rhs 2 3 => rw [← whiskerLeft_comp, π_tensor_id_actRight,
whiskerLeft_comp, whiskerLeft_comp]
slice_rhs 4 5 => rw [whiskerLeft_π_actLeft]
slice_rhs 3 4 => rw [associator_inv_naturality_right]
slice_rhs 4 5 => rw [whisker_exchange]
simp
end
end TensorBimod
section
variable [∀ X : C, PreservesColimitsOfSize.{0, 0} (tensorLeft X)]
variable [∀ X : C, PreservesColimitsOfSize.{0, 0} (tensorRight X)]
/-- Tensor product of two bimodule objects as a bimodule object. -/
@[simps]
noncomputable def tensorBimod {X Y Z : Mon C} (M : Bimod X Y) (N : Bimod Y Z) : Bimod X Z where
X := TensorBimod.X M N
actLeft := TensorBimod.actLeft M N
actRight := TensorBimod.actRight M N
one_actLeft := TensorBimod.one_act_left' M N
actRight_one := TensorBimod.actRight_one' M N
left_assoc := TensorBimod.left_assoc' M N
right_assoc := TensorBimod.right_assoc' M N
middle_assoc := TensorBimod.middle_assoc' M N
/-- Left whiskering for morphisms of bimodule objects. -/
@[simps]
noncomputable def whiskerLeft {X Y Z : Mon C} (M : Bimod X Y) {N₁ N₂ : Bimod Y Z} (f : N₁ ⟶ N₂) :
M.tensorBimod N₁ ⟶ M.tensorBimod N₂ where
hom :=
colimMap
(parallelPairHom _ _ _ _ (_ ◁ f.hom) (_ ◁ f.hom)
(by rw [whisker_exchange])
(by
simp only [Category.assoc, tensor_whiskerLeft, Iso.inv_hom_id_assoc,
Iso.cancel_iso_hom_left]
slice_lhs 1 2 => rw [← whiskerLeft_comp, Hom.left_act_hom]
simp))
left_act_hom := by
refine (cancel_epi ((tensorLeft _).map (coequalizer.π _ _))).1 ?_
dsimp
slice_lhs 1 2 => rw [TensorBimod.whiskerLeft_π_actLeft]
slice_lhs 3 4 => rw [ι_colimMap, parallelPairHom_app_one]
slice_rhs 1 2 => rw [← whiskerLeft_comp, ι_colimMap, parallelPairHom_app_one,
whiskerLeft_comp]
slice_rhs 2 3 => rw [TensorBimod.whiskerLeft_π_actLeft]
slice_rhs 1 2 => rw [associator_inv_naturality_right]
slice_rhs 2 3 => rw [whisker_exchange]
simp
right_act_hom := by
refine (cancel_epi ((tensorRight _).map (coequalizer.π _ _))).1 ?_
dsimp
slice_lhs 1 2 => rw [TensorBimod.π_tensor_id_actRight]
slice_lhs 3 4 => rw [ι_colimMap, parallelPairHom_app_one]
slice_lhs 2 3 => rw [← whiskerLeft_comp, Hom.right_act_hom]
slice_rhs 1 2 =>
rw [← comp_whiskerRight, ι_colimMap, parallelPairHom_app_one, comp_whiskerRight]
slice_rhs 2 3 => rw [TensorBimod.π_tensor_id_actRight]
simp
/-- Right whiskering for morphisms of bimodule objects. -/
@[simps]
noncomputable def whiskerRight {X Y Z : Mon C} {M₁ M₂ : Bimod X Y} (f : M₁ ⟶ M₂) (N : Bimod Y Z) :
M₁.tensorBimod N ⟶ M₂.tensorBimod N where
hom :=
colimMap
(parallelPairHom _ _ _ _ (f.hom ▷ _ ▷ _) (f.hom ▷ _)
(by rw [← comp_whiskerRight, Hom.right_act_hom, comp_whiskerRight])
(by
slice_lhs 2 3 => rw [whisker_exchange]
simp))
left_act_hom := by
refine (cancel_epi ((tensorLeft _).map (coequalizer.π _ _))).1 ?_
dsimp
slice_lhs 1 2 => rw [TensorBimod.whiskerLeft_π_actLeft]
slice_lhs 3 4 => rw [ι_colimMap, parallelPairHom_app_one]
slice_lhs 2 3 => rw [← comp_whiskerRight, Hom.left_act_hom]
slice_rhs 1 2 => rw [← whiskerLeft_comp, ι_colimMap, parallelPairHom_app_one, whiskerLeft_comp]
slice_rhs 2 3 => rw [TensorBimod.whiskerLeft_π_actLeft]
slice_rhs 1 2 => rw [associator_inv_naturality_middle]
simp
right_act_hom := by
refine (cancel_epi ((tensorRight _).map (coequalizer.π _ _))).1 ?_
dsimp
slice_lhs 1 2 => rw [TensorBimod.π_tensor_id_actRight]
slice_lhs 3 4 => rw [ι_colimMap, parallelPairHom_app_one]
slice_lhs 2 3 => rw [whisker_exchange]
slice_rhs 1 2 => rw [← comp_whiskerRight, ι_colimMap, parallelPairHom_app_one,
comp_whiskerRight]
slice_rhs 2 3 => rw [TensorBimod.π_tensor_id_actRight]
simp
end
namespace AssociatorBimod
variable [∀ X : C, PreservesColimitsOfSize.{0, 0} (tensorLeft X)]
variable [∀ X : C, PreservesColimitsOfSize.{0, 0} (tensorRight X)]
variable {R S T U : Mon C} (P : Bimod R S) (Q : Bimod S T) (L : Bimod T U)
/-- An auxiliary morphism for the definition of the underlying morphism of the forward component of
the associator isomorphism. -/
noncomputable def homAux : (P.tensorBimod Q).X ⊗ L.X ⟶ (P.tensorBimod (Q.tensorBimod L)).X :=
(PreservesCoequalizer.iso (tensorRight L.X) _ _).inv ≫
coequalizer.desc ((α_ _ _ _).hom ≫ (P.X ◁ coequalizer.π _ _) ≫ coequalizer.π _ _)
(by
dsimp; dsimp [TensorBimod.X]
slice_lhs 1 2 => rw [associator_naturality_left]
slice_lhs 2 3 => rw [← whisker_exchange]
slice_lhs 3 4 => rw [coequalizer.condition]
slice_lhs 2 3 => rw [associator_naturality_right]
slice_lhs 3 4 =>
rw [← whiskerLeft_comp, TensorBimod.whiskerLeft_π_actLeft, whiskerLeft_comp]
simp)
/-- The underlying morphism of the forward component of the associator isomorphism. -/
noncomputable def hom :
((P.tensorBimod Q).tensorBimod L).X ⟶ (P.tensorBimod (Q.tensorBimod L)).X :=
coequalizer.desc (homAux P Q L)
(by
dsimp [homAux]
refine (cancel_epi ((tensorRight _ ⋙ tensorRight _).map (coequalizer.π _ _))).1 ?_
dsimp [TensorBimod.X]
slice_lhs 1 2 => rw [← comp_whiskerRight, TensorBimod.π_tensor_id_actRight,
comp_whiskerRight, comp_whiskerRight]
slice_lhs 3 5 => rw [π_tensor_id_preserves_coequalizer_inv_desc]
slice_lhs 2 3 => rw [associator_naturality_middle]
slice_lhs 3 4 =>
rw [← whiskerLeft_comp, coequalizer.condition,
whiskerLeft_comp, whiskerLeft_comp]
slice_rhs 1 2 => rw [associator_naturality_left]
slice_rhs 2 3 => rw [← whisker_exchange]
slice_rhs 3 5 => rw [π_tensor_id_preserves_coequalizer_inv_desc]
simp)
theorem hom_left_act_hom' :
((P.tensorBimod Q).tensorBimod L).actLeft ≫ hom P Q L =
(R.X ◁ hom P Q L) ≫ (P.tensorBimod (Q.tensorBimod L)).actLeft := by
dsimp; dsimp [hom, homAux]
refine (cancel_epi ((tensorLeft _).map (coequalizer.π _ _))).1 ?_
simp only [curriedTensor_obj_map]
slice_lhs 1 2 => rw [TensorBimod.whiskerLeft_π_actLeft]
slice_lhs 3 4 => rw [coequalizer.π_desc]
slice_rhs 1 2 => rw [← whiskerLeft_comp, coequalizer.π_desc, whiskerLeft_comp]
refine (cancel_epi ((tensorRight _ ⋙ tensorLeft _).map (coequalizer.π _ _))).1 ?_
dsimp; dsimp [TensorBimod.X]
slice_lhs 1 2 => rw [associator_inv_naturality_middle]
slice_lhs 2 3 =>
rw [← comp_whiskerRight, TensorBimod.whiskerLeft_π_actLeft,
comp_whiskerRight, comp_whiskerRight]
slice_lhs 4 6 => rw [π_tensor_id_preserves_coequalizer_inv_desc]
slice_lhs 3 4 => rw [associator_naturality_left]
slice_rhs 1 3 =>
rw [← whiskerLeft_comp, ← whiskerLeft_comp, π_tensor_id_preserves_coequalizer_inv_desc,
whiskerLeft_comp, whiskerLeft_comp]
slice_rhs 3 4 => erw [TensorBimod.whiskerLeft_π_actLeft P (Q.tensorBimod L)]
slice_rhs 2 3 => erw [associator_inv_naturality_right]
slice_rhs 3 4 => erw [whisker_exchange]
monoidal
theorem hom_right_act_hom' :
((P.tensorBimod Q).tensorBimod L).actRight ≫ hom P Q L =
(hom P Q L ▷ U.X) ≫ (P.tensorBimod (Q.tensorBimod L)).actRight := by
dsimp; dsimp [hom, homAux]
refine (cancel_epi ((tensorRight _).map (coequalizer.π _ _))).1 ?_
simp only [Functor.flip_obj_map, curriedTensor_map_app]
slice_lhs 1 2 => rw [TensorBimod.π_tensor_id_actRight]
slice_lhs 3 4 => rw [coequalizer.π_desc]
slice_rhs 1 2 => rw [← comp_whiskerRight, coequalizer.π_desc, comp_whiskerRight]
refine (cancel_epi ((tensorRight _ ⋙ tensorRight _).map (coequalizer.π _ _))).1 ?_
dsimp; dsimp [TensorBimod.X]
slice_lhs 1 2 => rw [associator_naturality_left]
slice_lhs 2 3 => rw [← whisker_exchange]
slice_lhs 3 5 => rw [π_tensor_id_preserves_coequalizer_inv_desc]
slice_lhs 2 3 => rw [associator_naturality_right]
slice_rhs 1 3 =>
rw [← comp_whiskerRight, ← comp_whiskerRight, π_tensor_id_preserves_coequalizer_inv_desc,
comp_whiskerRight, comp_whiskerRight]
slice_rhs 3 4 => erw [TensorBimod.π_tensor_id_actRight P (Q.tensorBimod L)]
slice_rhs 2 3 => erw [associator_naturality_middle]
dsimp
slice_rhs 3 4 =>
rw [← whiskerLeft_comp, TensorBimod.π_tensor_id_actRight, whiskerLeft_comp, whiskerLeft_comp]
monoidal
/-- An auxiliary morphism for the definition of the underlying morphism of the inverse component of
the associator isomorphism. -/
noncomputable def invAux : P.X ⊗ (Q.tensorBimod L).X ⟶ ((P.tensorBimod Q).tensorBimod L).X :=
(PreservesCoequalizer.iso (tensorLeft P.X) _ _).inv ≫
coequalizer.desc ((α_ _ _ _).inv ≫ (coequalizer.π _ _ ▷ L.X) ≫ coequalizer.π _ _)
(by
dsimp; dsimp [TensorBimod.X]
slice_lhs 1 2 => rw [associator_inv_naturality_middle]
rw [← Iso.inv_hom_id_assoc (α_ _ _ _) (P.X ◁ Q.actRight), comp_whiskerRight]
slice_lhs 3 4 =>
rw [← comp_whiskerRight, Category.assoc, ← TensorBimod.π_tensor_id_actRight,
comp_whiskerRight]
slice_lhs 4 5 => rw [coequalizer.condition]
slice_lhs 3 4 => rw [associator_naturality_left]
slice_rhs 1 2 => rw [whiskerLeft_comp]
slice_rhs 2 3 => rw [associator_inv_naturality_right]
slice_rhs 3 4 => rw [whisker_exchange]
simp)
/-- The underlying morphism of the inverse component of the associator isomorphism. -/
noncomputable def inv :
(P.tensorBimod (Q.tensorBimod L)).X ⟶ ((P.tensorBimod Q).tensorBimod L).X :=
coequalizer.desc (invAux P Q L)
(by
dsimp [invAux]
refine (cancel_epi ((tensorLeft _).map (coequalizer.π _ _))).1 ?_
dsimp [TensorBimod.X]
slice_lhs 1 2 => rw [whisker_exchange]
slice_lhs 2 4 => rw [id_tensor_π_preserves_coequalizer_inv_desc]
slice_lhs 1 2 => rw [associator_inv_naturality_left]
slice_lhs 2 3 =>
rw [← comp_whiskerRight, coequalizer.condition, comp_whiskerRight, comp_whiskerRight]
slice_rhs 1 2 => rw [associator_naturality_right]
slice_rhs 2 3 =>
rw [← whiskerLeft_comp, TensorBimod.whiskerLeft_π_actLeft,
whiskerLeft_comp, whiskerLeft_comp]
slice_rhs 4 6 => rw [id_tensor_π_preserves_coequalizer_inv_desc]
slice_rhs 3 4 => rw [associator_inv_naturality_middle]
monoidal)
theorem hom_inv_id : hom P Q L ≫ inv P Q L = 𝟙 _ := by
dsimp [hom, homAux, inv, invAux]
apply coequalizer.hom_ext
slice_lhs 1 2 => rw [coequalizer.π_desc]
refine (cancel_epi ((tensorRight _).map (coequalizer.π _ _))).1 ?_
simp only [Functor.flip_obj_map, curriedTensor_map_app]
slice_lhs 1 3 => rw [π_tensor_id_preserves_coequalizer_inv_desc]
slice_lhs 3 4 => rw [coequalizer.π_desc]
slice_lhs 2 4 => rw [id_tensor_π_preserves_coequalizer_inv_desc]
slice_lhs 1 3 => rw [Iso.hom_inv_id_assoc]
dsimp only [TensorBimod.X]
slice_rhs 2 3 => rw [Category.comp_id]
rfl
theorem inv_hom_id : inv P Q L ≫ hom P Q L = 𝟙 _ := by
dsimp [hom, homAux, inv, invAux]
apply coequalizer.hom_ext
slice_lhs 1 2 => rw [coequalizer.π_desc]
refine (cancel_epi ((tensorLeft _).map (coequalizer.π _ _))).1 ?_
simp only [curriedTensor_obj_map]
slice_lhs 1 3 => rw [id_tensor_π_preserves_coequalizer_inv_desc]
slice_lhs 3 4 => rw [coequalizer.π_desc]
slice_lhs 2 4 => rw [π_tensor_id_preserves_coequalizer_inv_desc]
slice_lhs 1 3 => rw [Iso.inv_hom_id_assoc]
dsimp only [TensorBimod.X]
slice_rhs 2 3 => rw [Category.comp_id]
rfl
end AssociatorBimod
namespace LeftUnitorBimod
variable {R S : Mon C} (P : Bimod R S)
/-- The underlying morphism of the forward component of the left unitor isomorphism. -/
noncomputable def hom : TensorBimod.X (regular R) P ⟶ P.X :=
coequalizer.desc P.actLeft (by dsimp; rw [Category.assoc, left_assoc])
/-- The underlying morphism of the inverse component of the left unitor isomorphism. -/
noncomputable def inv : P.X ⟶ TensorBimod.X (regular R) P :=
(λ_ P.X).inv ≫ (η[R.X] ▷ _) ≫ coequalizer.π _ _
theorem hom_inv_id : hom P ≫ inv P = 𝟙 _ := by
dsimp only [hom, inv, TensorBimod.X]
ext; dsimp
slice_lhs 1 2 => rw [coequalizer.π_desc]
slice_lhs 1 2 => rw [leftUnitor_inv_naturality]
slice_lhs 2 3 => rw [whisker_exchange]
slice_lhs 3 3 => rw [← Iso.inv_hom_id_assoc (α_ R.X R.X P.X) (R.X ◁ P.actLeft)]
slice_lhs 4 6 => rw [← Category.assoc, ← coequalizer.condition]
slice_lhs 2 3 => rw [associator_inv_naturality_left]
slice_lhs 3 4 => rw [← comp_whiskerRight, MonObj.one_mul]
slice_rhs 1 2 => rw [Category.comp_id]
monoidal
theorem inv_hom_id : inv P ≫ hom P = 𝟙 _ := by
dsimp [hom, inv]
slice_lhs 3 4 => rw [coequalizer.π_desc]
rw [one_actLeft, Iso.inv_hom_id]
variable [∀ X : C, PreservesColimitsOfSize.{0, 0} (tensorLeft X)]
variable [∀ X : C, PreservesColimitsOfSize.{0, 0} (tensorRight X)]
theorem hom_left_act_hom' :
((regular R).tensorBimod P).actLeft ≫ hom P = (R.X ◁ hom P) ≫ P.actLeft := by
dsimp; dsimp [hom, TensorBimod.actLeft, regular]
refine (cancel_epi ((tensorLeft _).map (coequalizer.π _ _))).1 ?_
dsimp
slice_lhs 1 4 => rw [id_tensor_π_preserves_coequalizer_inv_colimMap_desc]
slice_lhs 2 3 => rw [left_assoc]
slice_rhs 1 2 => rw [← whiskerLeft_comp, coequalizer.π_desc]
rw [Iso.inv_hom_id_assoc]
theorem hom_right_act_hom' :
((regular R).tensorBimod P).actRight ≫ hom P = (hom P ▷ S.X) ≫ P.actRight := by
dsimp; dsimp [hom, TensorBimod.actRight, regular]
refine (cancel_epi ((tensorRight _).map (coequalizer.π _ _))).1 ?_
dsimp
slice_lhs 1 4 => rw [π_tensor_id_preserves_coequalizer_inv_colimMap_desc]
slice_rhs 1 2 => rw [← comp_whiskerRight, coequalizer.π_desc]
slice_rhs 1 2 => rw [middle_assoc]
simp only [Category.assoc]
end LeftUnitorBimod
namespace RightUnitorBimod
variable {R S : Mon C} (P : Bimod R S)
/-- The underlying morphism of the forward component of the right unitor isomorphism. -/
noncomputable def hom : TensorBimod.X P (regular S) ⟶ P.X :=
coequalizer.desc P.actRight (by dsimp; rw [Category.assoc, right_assoc, Iso.hom_inv_id_assoc])
/-- The underlying morphism of the inverse component of the right unitor isomorphism. -/
noncomputable def inv : P.X ⟶ TensorBimod.X P (regular S) :=
(ρ_ P.X).inv ≫ (_ ◁ η[S.X]) ≫ coequalizer.π _ _
theorem hom_inv_id : hom P ≫ inv P = 𝟙 _ := by
dsimp only [hom, inv, TensorBimod.X]
ext; dsimp
slice_lhs 1 2 => rw [coequalizer.π_desc]
slice_lhs 1 2 => rw [rightUnitor_inv_naturality]
slice_lhs 2 3 => rw [← whisker_exchange]
slice_lhs 3 4 => rw [coequalizer.condition]
slice_lhs 2 3 => rw [associator_naturality_right]
slice_lhs 3 4 => rw [← whiskerLeft_comp, MonObj.mul_one]
slice_rhs 1 2 => rw [Category.comp_id]
monoidal
theorem inv_hom_id : inv P ≫ hom P = 𝟙 _ := by
dsimp [hom, inv]
slice_lhs 3 4 => rw [coequalizer.π_desc]
rw [actRight_one, Iso.inv_hom_id]
variable [∀ X : C, PreservesColimitsOfSize.{0, 0} (tensorLeft X)]
variable [∀ X : C, PreservesColimitsOfSize.{0, 0} (tensorRight X)]
theorem hom_left_act_hom' :
(P.tensorBimod (regular S)).actLeft ≫ hom P = (R.X ◁ hom P) ≫ P.actLeft := by
dsimp; dsimp [hom, TensorBimod.actLeft, regular]
refine (cancel_epi ((tensorLeft _).map (coequalizer.π _ _))).1 ?_
dsimp
slice_lhs 1 4 => rw [id_tensor_π_preserves_coequalizer_inv_colimMap_desc]
slice_lhs 2 3 => rw [middle_assoc]
slice_rhs 1 2 => rw [← whiskerLeft_comp, coequalizer.π_desc]
rw [Iso.inv_hom_id_assoc]
theorem hom_right_act_hom' :
(P.tensorBimod (regular S)).actRight ≫ hom P = (hom P ▷ S.X) ≫ P.actRight := by
dsimp; dsimp [hom, TensorBimod.actRight, regular]
refine (cancel_epi ((tensorRight _).map (coequalizer.π _ _))).1 ?_
dsimp
slice_lhs 1 4 => rw [π_tensor_id_preserves_coequalizer_inv_colimMap_desc]
slice_lhs 2 3 => rw [right_assoc]
slice_rhs 1 2 => rw [← comp_whiskerRight, coequalizer.π_desc]
rw [Iso.hom_inv_id_assoc]
end RightUnitorBimod
variable [∀ X : C, PreservesColimitsOfSize.{0, 0} (tensorLeft X)]
variable [∀ X : C, PreservesColimitsOfSize.{0, 0} (tensorRight X)]
/-- The associator as a bimodule isomorphism. -/
noncomputable def associatorBimod {W X Y Z : Mon C} (L : Bimod W X) (M : Bimod X Y)
(N : Bimod Y Z) : (L.tensorBimod M).tensorBimod N ≅ L.tensorBimod (M.tensorBimod N) :=
isoOfIso
{ hom := AssociatorBimod.hom L M N
inv := AssociatorBimod.inv L M N
hom_inv_id := AssociatorBimod.hom_inv_id L M N
inv_hom_id := AssociatorBimod.inv_hom_id L M N } (AssociatorBimod.hom_left_act_hom' L M N)
(AssociatorBimod.hom_right_act_hom' L M N)
/-- The left unitor as a bimodule isomorphism. -/
noncomputable def leftUnitorBimod {X Y : Mon C} (M : Bimod X Y) : (regular X).tensorBimod M ≅ M :=
isoOfIso
{ hom := LeftUnitorBimod.hom M
inv := LeftUnitorBimod.inv M
hom_inv_id := LeftUnitorBimod.hom_inv_id M
inv_hom_id := LeftUnitorBimod.inv_hom_id M } (LeftUnitorBimod.hom_left_act_hom' M)
(LeftUnitorBimod.hom_right_act_hom' M)
/-- The right unitor as a bimodule isomorphism. -/
noncomputable def rightUnitorBimod {X Y : Mon C} (M : Bimod X Y) : M.tensorBimod (regular Y) ≅ M :=
isoOfIso
{ hom := RightUnitorBimod.hom M
inv := RightUnitorBimod.inv M
hom_inv_id := RightUnitorBimod.hom_inv_id M
inv_hom_id := RightUnitorBimod.inv_hom_id M } (RightUnitorBimod.hom_left_act_hom' M)
(RightUnitorBimod.hom_right_act_hom' M)
theorem whiskerLeft_id_bimod {X Y Z : Mon C} {M : Bimod X Y} {N : Bimod Y Z} :
whiskerLeft M (𝟙 N) = 𝟙 (M.tensorBimod N) := by
ext
apply Limits.coequalizer.hom_ext
dsimp only [tensorBimod_X, whiskerLeft_hom, id_hom']
simp only [whiskerLeft_id, ι_colimMap, parallelPair_obj_one,
parallelPairHom_app_one, Category.id_comp]
erw [Category.comp_id]
theorem id_whiskerRight_bimod {X Y Z : Mon C} {M : Bimod X Y} {N : Bimod Y Z} :
whiskerRight (𝟙 M) N = 𝟙 (M.tensorBimod N) := by
ext
apply Limits.coequalizer.hom_ext
dsimp only [tensorBimod_X, whiskerRight_hom, id_hom']
simp only [id_whiskerRight, ι_colimMap, parallelPair_obj_one,
parallelPairHom_app_one, Category.id_comp]
erw [Category.comp_id]
theorem whiskerLeft_comp_bimod {X Y Z : Mon C} (M : Bimod X Y) {N P Q : Bimod Y Z} (f : N ⟶ P)
(g : P ⟶ Q) : whiskerLeft M (f ≫ g) = whiskerLeft M f ≫ whiskerLeft M g := by
ext
apply Limits.coequalizer.hom_ext
simp
theorem id_whiskerLeft_bimod {X Y : Mon C} {M N : Bimod X Y} (f : M ⟶ N) :
whiskerLeft (regular X) f = (leftUnitorBimod M).hom ≫ f ≫ (leftUnitorBimod N).inv := by
dsimp [tensorHom, regular, leftUnitorBimod]
ext
apply coequalizer.hom_ext
dsimp
slice_lhs 1 2 => rw [ι_colimMap, parallelPairHom_app_one]
dsimp [LeftUnitorBimod.hom]
slice_rhs 1 2 => rw [coequalizer.π_desc]
dsimp [LeftUnitorBimod.inv]
slice_rhs 1 2 => rw [Hom.left_act_hom]
slice_rhs 2 3 => rw [leftUnitor_inv_naturality]
slice_rhs 3 4 => rw [whisker_exchange]
slice_rhs 4 4 => rw [← Iso.inv_hom_id_assoc (α_ X.X X.X N.X) (X.X ◁ N.actLeft)]
slice_rhs 5 7 => rw [← Category.assoc, ← coequalizer.condition]
slice_rhs 3 4 => rw [associator_inv_naturality_left]
slice_rhs 4 5 => rw [← comp_whiskerRight, MonObj.one_mul]
have : (λ_ (X.X ⊗ N.X)).inv ≫ (α_ (𝟙_ C) X.X N.X).inv ≫ ((λ_ X.X).hom ▷ N.X) = 𝟙 _ := by
monoidal
grind
theorem comp_whiskerLeft_bimod {W X Y Z : Mon C} (M : Bimod W X) (N : Bimod X Y)
{P P' : Bimod Y Z} (f : P ⟶ P') :
whiskerLeft (M.tensorBimod N) f =
(associatorBimod M N P).hom ≫
whiskerLeft M (whiskerLeft N f) ≫ (associatorBimod M N P').inv := by
dsimp [tensorHom, tensorBimod, associatorBimod]
ext
apply coequalizer.hom_ext
dsimp
slice_lhs 1 2 => rw [ι_colimMap, parallelPairHom_app_one]
dsimp [TensorBimod.X, AssociatorBimod.hom]
slice_rhs 1 2 => rw [coequalizer.π_desc]
dsimp [AssociatorBimod.homAux, AssociatorBimod.inv]
refine (cancel_epi ((tensorRight _).map (coequalizer.π _ _))).1 ?_
simp only [Functor.flip_obj_map, curriedTensor_map_app]
slice_rhs 1 3 => rw [π_tensor_id_preserves_coequalizer_inv_desc]
slice_rhs 3 4 => rw [ι_colimMap, parallelPairHom_app_one]
slice_rhs 2 3 => rw [← whiskerLeft_comp, ι_colimMap, parallelPairHom_app_one]
slice_rhs 3 4 => rw [coequalizer.π_desc]
dsimp [AssociatorBimod.invAux]
slice_rhs 2 2 => rw [whiskerLeft_comp]
slice_rhs 3 5 => rw [id_tensor_π_preserves_coequalizer_inv_desc]
slice_rhs 2 3 => rw [associator_inv_naturality_right]
slice_rhs 1 3 => rw [Iso.hom_inv_id_assoc]
slice_lhs 1 2 => rw [← whisker_exchange]
rfl
theorem comp_whiskerRight_bimod {X Y Z : Mon C} {M N P : Bimod X Y} (f : M ⟶ N) (g : N ⟶ P)
(Q : Bimod Y Z) : whiskerRight (f ≫ g) Q = whiskerRight f Q ≫ whiskerRight g Q := by
ext
apply Limits.coequalizer.hom_ext
simp
theorem whiskerRight_id_bimod {X Y : Mon C} {M N : Bimod X Y} (f : M ⟶ N) :
whiskerRight f (regular Y) = (rightUnitorBimod M).hom ≫ f ≫ (rightUnitorBimod N).inv := by
dsimp [tensorHom, regular, rightUnitorBimod]
ext
apply coequalizer.hom_ext
dsimp
slice_lhs 1 2 => rw [ι_colimMap, parallelPairHom_app_one]
dsimp [RightUnitorBimod.hom]
slice_rhs 1 2 => rw [coequalizer.π_desc]
dsimp [RightUnitorBimod.inv]
slice_rhs 1 2 => rw [Hom.right_act_hom]
slice_rhs 2 3 => rw [rightUnitor_inv_naturality]
slice_rhs 3 4 => rw [← whisker_exchange]
slice_rhs 4 5 => rw [coequalizer.condition]
slice_rhs 3 4 => rw [associator_naturality_right]
slice_rhs 4 5 => rw [← whiskerLeft_comp, MonObj.mul_one]
simp
theorem whiskerRight_comp_bimod {W X Y Z : Mon C} {M M' : Bimod W X} (f : M ⟶ M') (N : Bimod X Y)
(P : Bimod Y Z) :
whiskerRight f (N.tensorBimod P) =
(associatorBimod M N P).inv ≫
whiskerRight (whiskerRight f N) P ≫ (associatorBimod M' N P).hom := by
dsimp [tensorHom, tensorBimod, associatorBimod]
ext
apply coequalizer.hom_ext
dsimp
slice_lhs 1 2 => rw [ι_colimMap, parallelPairHom_app_one]
dsimp [TensorBimod.X, AssociatorBimod.inv]
slice_rhs 1 2 => rw [coequalizer.π_desc]
dsimp [AssociatorBimod.invAux, AssociatorBimod.hom]
refine (cancel_epi ((tensorLeft _).map (coequalizer.π _ _))).1 ?_
simp only [curriedTensor_obj_map]
slice_rhs 1 3 => rw [id_tensor_π_preserves_coequalizer_inv_desc]
slice_rhs 3 4 => rw [ι_colimMap, parallelPairHom_app_one]
slice_rhs 2 3 => rw [← comp_whiskerRight, ι_colimMap, parallelPairHom_app_one]
slice_rhs 3 4 => rw [coequalizer.π_desc]
dsimp [AssociatorBimod.homAux]
slice_rhs 2 2 => rw [comp_whiskerRight]
slice_rhs 3 5 => rw [π_tensor_id_preserves_coequalizer_inv_desc]
slice_rhs 2 3 => rw [associator_naturality_left]
slice_rhs 1 3 => rw [Iso.inv_hom_id_assoc]
slice_lhs 1 2 => rw [whisker_exchange]
rfl
theorem whisker_assoc_bimod {W X Y Z : Mon C} (M : Bimod W X) {N N' : Bimod X Y} (f : N ⟶ N')
(P : Bimod Y Z) :
whiskerRight (whiskerLeft M f) P =
(associatorBimod M N P).hom ≫
whiskerLeft M (whiskerRight f P) ≫ (associatorBimod M N' P).inv := by
dsimp [tensorHom, tensorBimod, associatorBimod]
ext
apply coequalizer.hom_ext
dsimp
slice_lhs 1 2 => rw [ι_colimMap, parallelPairHom_app_one]
dsimp [AssociatorBimod.hom]
slice_rhs 1 2 => rw [coequalizer.π_desc]
dsimp [AssociatorBimod.homAux]
refine (cancel_epi ((tensorRight _).map (coequalizer.π _ _))).1 ?_
simp only [Functor.flip_obj_map, curriedTensor_map_app]
slice_lhs 1 2 => rw [← comp_whiskerRight, ι_colimMap, parallelPairHom_app_one]
slice_rhs 1 3 => rw [π_tensor_id_preserves_coequalizer_inv_desc]
slice_rhs 3 4 => rw [ι_colimMap, parallelPairHom_app_one]
slice_rhs 2 3 => rw [← whiskerLeft_comp, ι_colimMap, parallelPairHom_app_one]
dsimp [AssociatorBimod.inv]
slice_rhs 3 4 => rw [coequalizer.π_desc]
dsimp [AssociatorBimod.invAux]
slice_rhs 2 2 => rw [whiskerLeft_comp]
slice_rhs 3 5 => rw [id_tensor_π_preserves_coequalizer_inv_desc]
simp
theorem whisker_exchange_bimod {X Y Z : Mon C} {M N : Bimod X Y} {P Q : Bimod Y Z} (f : M ⟶ N)
(g : P ⟶ Q) : whiskerLeft M g ≫ whiskerRight f Q =
whiskerRight f P ≫ whiskerLeft N g := by
ext
apply coequalizer.hom_ext
dsimp
slice_lhs 1 2 => rw [ι_colimMap, parallelPairHom_app_one]
slice_lhs 2 3 => rw [ι_colimMap, parallelPairHom_app_one]
slice_lhs 1 2 => rw [whisker_exchange]
simp
theorem pentagon_bimod {V W X Y Z : Mon C} (M : Bimod V W) (N : Bimod W X) (P : Bimod X Y)
(Q : Bimod Y Z) :
whiskerRight (associatorBimod M N P).hom Q ≫
(associatorBimod M (N.tensorBimod P) Q).hom ≫
whiskerLeft M (associatorBimod N P Q).hom =
(associatorBimod (M.tensorBimod N) P Q).hom ≫
(associatorBimod M N (P.tensorBimod Q)).hom := by
dsimp [associatorBimod]
ext
apply coequalizer.hom_ext
dsimp
dsimp only [AssociatorBimod.hom]
slice_lhs 1 2 => rw [ι_colimMap, parallelPairHom_app_one]
slice_lhs 2 3 => rw [coequalizer.π_desc]
slice_rhs 1 2 => rw [coequalizer.π_desc]
dsimp [AssociatorBimod.homAux]
refine (cancel_epi ((tensorRight _).map (coequalizer.π _ _))).1 ?_
dsimp
slice_lhs 1 2 => rw [← comp_whiskerRight, coequalizer.π_desc]
slice_rhs 1 3 => rw [π_tensor_id_preserves_coequalizer_inv_desc]
slice_rhs 3 4 => rw [coequalizer.π_desc]
refine (cancel_epi ((tensorRight _ ⋙ tensorRight _).map (coequalizer.π _ _))).1 ?_
dsimp
slice_lhs 1 2 =>
rw [← comp_whiskerRight, π_tensor_id_preserves_coequalizer_inv_desc, comp_whiskerRight,
comp_whiskerRight]
slice_lhs 3 5 => rw [π_tensor_id_preserves_coequalizer_inv_desc]
dsimp only [TensorBimod.X]
slice_lhs 2 3 => rw [associator_naturality_middle]
slice_lhs 5 6 => rw [ι_colimMap, parallelPairHom_app_one]
slice_lhs 4 5 => rw [← whiskerLeft_comp, coequalizer.π_desc]
slice_lhs 3 4 =>
rw [← whiskerLeft_comp, π_tensor_id_preserves_coequalizer_inv_desc,
whiskerLeft_comp, whiskerLeft_comp]
slice_rhs 1 2 => rw [associator_naturality_left]
slice_rhs 2 3 => rw [← whisker_exchange]
slice_rhs 3 5 => rw [π_tensor_id_preserves_coequalizer_inv_desc]
slice_rhs 2 3 => rw [associator_naturality_right]
monoidal
theorem triangle_bimod {X Y Z : Mon C} (M : Bimod X Y) (N : Bimod Y Z) :
(associatorBimod M (regular Y) N).hom ≫ whiskerLeft M (leftUnitorBimod N).hom =
whiskerRight (rightUnitorBimod M).hom N := by
dsimp [associatorBimod, leftUnitorBimod, rightUnitorBimod]
ext
apply coequalizer.hom_ext
dsimp
dsimp [AssociatorBimod.hom]
slice_lhs 1 2 => rw [coequalizer.π_desc]
dsimp [AssociatorBimod.homAux]
slice_rhs 1 2 => rw [ι_colimMap, parallelPairHom_app_one]
dsimp [RightUnitorBimod.hom]
refine (cancel_epi ((tensorRight _).map (coequalizer.π _ _))).1 ?_
dsimp [regular]
slice_lhs 1 3 => rw [π_tensor_id_preserves_coequalizer_inv_desc]
slice_lhs 3 4 => rw [ι_colimMap, parallelPairHom_app_one]
dsimp [LeftUnitorBimod.hom]
slice_lhs 2 3 => rw [← whiskerLeft_comp, coequalizer.π_desc]
slice_rhs 1 2 => rw [← comp_whiskerRight, coequalizer.π_desc]
slice_rhs 1 2 => rw [coequalizer.condition]
simp only [Category.assoc]
/-- The bicategory of algebras (monoids) and bimodules, all internal to some monoidal category. -/
noncomputable def monBicategory : Bicategory (Mon C) where
Hom X Y := Bimod X Y
homCategory X Y := (inferInstance : Category (Bimod X Y))
id X := regular X
comp M N := tensorBimod M N
whiskerLeft L _ _ f := whiskerLeft L f
whiskerRight f N := whiskerRight f N
associator := associatorBimod
leftUnitor := leftUnitorBimod
rightUnitor := rightUnitorBimod
whiskerLeft_id _ _ := whiskerLeft_id_bimod
whiskerLeft_comp M _ _ _ f g := whiskerLeft_comp_bimod M f g
id_whiskerLeft := id_whiskerLeft_bimod
comp_whiskerLeft M N _ _ f := comp_whiskerLeft_bimod M N f
id_whiskerRight _ _ := id_whiskerRight_bimod
comp_whiskerRight f g Q := comp_whiskerRight_bimod f g Q
whiskerRight_id := whiskerRight_id_bimod
whiskerRight_comp := whiskerRight_comp_bimod
whisker_assoc M _ _ f P := whisker_assoc_bimod M f P
whisker_exchange := whisker_exchange_bimod
pentagon := pentagon_bimod
triangle := triangle_bimod
end Bimod |
.lake/packages/mathlib/Mathlib/CategoryTheory/Monoidal/Linear.lean | import Mathlib.CategoryTheory.Linear.LinearFunctor
import Mathlib.CategoryTheory.Monoidal.Preadditive
/-!
# Linear monoidal categories
A monoidal category is `MonoidalLinear R` if it is monoidal preadditive and
tensor product of morphisms is `R`-linear in both factors.
-/
namespace CategoryTheory
open CategoryTheory.Limits
open CategoryTheory.MonoidalCategory
variable (R : Type*) [Semiring R]
variable (C : Type*) [Category C] [Preadditive C] [Linear R C]
variable [MonoidalCategory C]
/-- A category is `MonoidalLinear R` if tensoring is `R`-linear in both factors.
-/
class MonoidalLinear [MonoidalPreadditive C] : Prop where
whiskerLeft_smul : ∀ (X : C) {Y Z : C} (r : R) (f : Y ⟶ Z), X ◁ (r • f) = r • (X ◁ f) := by
cat_disch
smul_whiskerRight : ∀ (r : R) {Y Z : C} (f : Y ⟶ Z) (X : C), (r • f) ▷ X = r • (f ▷ X) := by
cat_disch
attribute [simp] MonoidalLinear.whiskerLeft_smul MonoidalLinear.smul_whiskerRight
variable {C}
variable [MonoidalPreadditive C] [MonoidalLinear R C]
instance tensorLeft_linear (X : C) : (tensorLeft X).Linear R where
instance tensorRight_linear (X : C) : (tensorRight X).Linear R where
instance tensoringLeft_linear (X : C) : ((tensoringLeft C).obj X).Linear R where
instance tensoringRight_linear (X : C) : ((tensoringRight C).obj X).Linear R where
/-- A faithful linear monoidal functor to a linear monoidal category
ensures that the domain is linear monoidal. -/
theorem MonoidalLinear.ofFaithful {D : Type*} [Category D] [Preadditive D] [Linear R D]
[MonoidalCategory D] [MonoidalPreadditive D] (F : D ⥤ C) [F.Monoidal] [F.Faithful]
[F.Linear R] : MonoidalLinear R D :=
{ whiskerLeft_smul := by
intro X Y Z r f
apply F.map_injective
rw [Functor.Monoidal.map_whiskerLeft]
simp
smul_whiskerRight := by
intro r X Y f Z
apply F.map_injective
rw [Functor.Monoidal.map_whiskerRight]
simp }
@[deprecated (since := "2025-10-17")] alias monoidalLinearOfFaithful := MonoidalLinear.ofFaithful
end CategoryTheory |
.lake/packages/mathlib/Mathlib/CategoryTheory/Monoidal/Preadditive.lean | import Mathlib.CategoryTheory.Preadditive.AdditiveFunctor
import Mathlib.CategoryTheory.Monoidal.Functor
/-!
# Preadditive monoidal categories
A monoidal category is `MonoidalPreadditive` if it is preadditive and tensor product of morphisms
is linear in both factors.
-/
noncomputable section
namespace CategoryTheory
open CategoryTheory.Limits
open CategoryTheory.MonoidalCategory
variable (C : Type*) [Category C] [Preadditive C] [MonoidalCategory C]
/-- A category is `MonoidalPreadditive` if tensoring is additive in both factors.
Note we don't `extend Preadditive C` here, as `Abelian C` already extends it,
and we'll need to have both typeclasses sometimes.
-/
class MonoidalPreadditive : Prop where
whiskerLeft_zero : ∀ {X Y Z : C}, X ◁ (0 : Y ⟶ Z) = 0 := by cat_disch
zero_whiskerRight : ∀ {X Y Z : C}, (0 : Y ⟶ Z) ▷ X = 0 := by cat_disch
whiskerLeft_add : ∀ {X Y Z : C} (f g : Y ⟶ Z), X ◁ (f + g) = X ◁ f + X ◁ g := by cat_disch
add_whiskerRight : ∀ {X Y Z : C} (f g : Y ⟶ Z), (f + g) ▷ X = f ▷ X + g ▷ X := by cat_disch
attribute [simp] MonoidalPreadditive.whiskerLeft_zero MonoidalPreadditive.zero_whiskerRight
attribute [simp] MonoidalPreadditive.whiskerLeft_add MonoidalPreadditive.add_whiskerRight
variable {C}
variable [MonoidalPreadditive C]
namespace MonoidalPreadditive
-- The priority setting will not be needed when we replace `𝟙 X ⊗ₘ f` by `X ◁ f`.
@[simp (low)]
theorem tensor_zero {W X Y Z : C} (f : W ⟶ X) : f ⊗ₘ (0 : Y ⟶ Z) = 0 := by
simp [tensorHom_def]
-- The priority setting will not be needed when we replace `f ⊗ₘ 𝟙 X` by `f ▷ X`.
@[simp (low)]
theorem zero_tensor {W X Y Z : C} (f : Y ⟶ Z) : (0 : W ⟶ X) ⊗ₘ f = 0 := by
simp [tensorHom_def]
theorem tensor_add {W X Y Z : C} (f : W ⟶ X) (g h : Y ⟶ Z) : f ⊗ₘ (g + h) = f ⊗ₘ g + f ⊗ₘ h := by
simp [tensorHom_def]
theorem add_tensor {W X Y Z : C} (f g : W ⟶ X) (h : Y ⟶ Z) : (f + g) ⊗ₘ h = f ⊗ₘ h + g ⊗ₘ h := by
simp [tensorHom_def]
end MonoidalPreadditive
instance tensorLeft_additive (X : C) : (tensorLeft X).Additive where
instance tensorRight_additive (X : C) : (tensorRight X).Additive where
instance tensoringLeft_additive (X : C) : ((tensoringLeft C).obj X).Additive where
instance tensoringRight_additive (X : C) : ((tensoringRight C).obj X).Additive where
/-- A faithful additive monoidal functor to a monoidal preadditive category
ensures that the domain is monoidal preadditive. -/
theorem monoidalPreadditive_of_faithful {D} [Category D] [Preadditive D] [MonoidalCategory D]
(F : D ⥤ C) [F.Monoidal] [F.Faithful] [F.Additive] :
MonoidalPreadditive D :=
{ whiskerLeft_zero := by
intros
apply F.map_injective
simp [Functor.Monoidal.map_whiskerLeft]
zero_whiskerRight := by
intros
apply F.map_injective
simp [Functor.Monoidal.map_whiskerRight]
whiskerLeft_add := by
intros
apply F.map_injective
simp only [Functor.Monoidal.map_whiskerLeft, Functor.map_add, Preadditive.comp_add,
Preadditive.add_comp, MonoidalPreadditive.whiskerLeft_add]
add_whiskerRight := by
intros
apply F.map_injective
simp only [Functor.Monoidal.map_whiskerRight, Functor.map_add, Preadditive.comp_add,
Preadditive.add_comp, MonoidalPreadditive.add_whiskerRight] }
theorem whiskerLeft_sum (P : C) {Q R : C} {J : Type*} (s : Finset J) (g : J → (Q ⟶ R)) :
P ◁ ∑ j ∈ s, g j = ∑ j ∈ s, P ◁ g j :=
map_sum ((tensoringLeft C).obj P).mapAddHom g s
theorem sum_whiskerRight {Q R : C} {J : Type*} (s : Finset J) (g : J → (Q ⟶ R)) (P : C) :
(∑ j ∈ s, g j) ▷ P = ∑ j ∈ s, g j ▷ P :=
map_sum ((tensoringRight C).obj P).mapAddHom g s
theorem tensor_sum {P Q R S : C} {J : Type*} (s : Finset J) (f : P ⟶ Q) (g : J → (R ⟶ S)) :
(f ⊗ₘ ∑ j ∈ s, g j) = ∑ j ∈ s, f ⊗ₘ g j := by
simp only [tensorHom_def, whiskerLeft_sum, Preadditive.comp_sum]
theorem sum_tensor {P Q R S : C} {J : Type*} (s : Finset J) (f : P ⟶ Q) (g : J → (R ⟶ S)) :
(∑ j ∈ s, g j) ⊗ₘ f = ∑ j ∈ s, g j ⊗ₘ f := by
simp only [tensorHom_def, sum_whiskerRight, Preadditive.sum_comp]
-- In a closed monoidal category, this would hold because
-- `tensorLeft X` is a left adjoint and hence preserves all colimits.
-- In any case it is true in any preadditive category.
instance (X : C) : PreservesFiniteBiproducts (tensorLeft X) where
preserves {J} :=
let ⟨_⟩ := nonempty_fintype J
{ preserves := fun {f} =>
{ preserves := fun {b} i => ⟨isBilimitOfTotal _ (by
dsimp
simp_rw [← id_tensorHom]
simp only [tensorHom_comp_tensorHom, Category.comp_id, ← tensor_sum, ← id_tensorHom_id,
IsBilimit.total i])⟩ } }
instance (X : C) : PreservesFiniteBiproducts (tensorRight X) where
preserves {J} :=
let ⟨_⟩ := nonempty_fintype J
{ preserves := fun {f} =>
{ preserves := fun {b} i => ⟨isBilimitOfTotal _ (by
dsimp
simp_rw [← tensorHom_id]
simp only [tensorHom_comp_tensorHom, Category.comp_id, ← sum_tensor, ← id_tensorHom_id,
IsBilimit.total i])⟩ } }
variable [HasFiniteBiproducts C]
/-- The isomorphism showing how tensor product on the left distributes over direct sums. -/
def leftDistributor {J : Type} [Finite J] (X : C) (f : J → C) : X ⊗ ⨁ f ≅ ⨁ fun j => X ⊗ f j :=
(tensorLeft X).mapBiproduct f
theorem leftDistributor_hom {J : Type} [Fintype J] (X : C) (f : J → C) :
(leftDistributor X f).hom =
∑ j : J, (X ◁ biproduct.π f j) ≫ biproduct.ι (fun j => X ⊗ f j) j := by
classical
ext
dsimp [leftDistributor, Functor.mapBiproduct, Functor.mapBicone]
erw [biproduct.lift_π]
simp only [Preadditive.sum_comp, Category.assoc, biproduct.ι_π, comp_dite, comp_zero,
Finset.sum_dite_eq', Finset.mem_univ, ite_true, eqToHom_refl, Category.comp_id]
theorem leftDistributor_inv {J : Type} [Fintype J] (X : C) (f : J → C) :
(leftDistributor X f).inv = ∑ j : J, biproduct.π _ j ≫ (X ◁ biproduct.ι f j) := by
classical
ext
dsimp [leftDistributor, Functor.mapBiproduct, Functor.mapBicone]
simp only [Preadditive.comp_sum, biproduct.ι_π_assoc, dite_comp, zero_comp,
Finset.sum_dite_eq, Finset.mem_univ, ite_true, eqToHom_refl, Category.id_comp,
biproduct.ι_desc]
@[reassoc (attr := simp)]
theorem leftDistributor_hom_comp_biproduct_π {J : Type} [Finite J] (X : C) (f : J → C) (j : J) :
(leftDistributor X f).hom ≫ biproduct.π _ j = X ◁ biproduct.π _ j := by
classical
cases nonempty_fintype J
simp [leftDistributor_hom, Preadditive.sum_comp, biproduct.ι_π, comp_dite]
@[reassoc (attr := simp)]
theorem biproduct_ι_comp_leftDistributor_hom {J : Type} [Finite J] (X : C) (f : J → C) (j : J) :
(X ◁ biproduct.ι _ j) ≫ (leftDistributor X f).hom = biproduct.ι (fun j => X ⊗ f j) j := by
classical
cases nonempty_fintype J
simp [leftDistributor_hom, Preadditive.comp_sum, ← whiskerLeft_comp_assoc,
biproduct.ι_π, whiskerLeft_dite, dite_comp]
@[reassoc (attr := simp)]
theorem leftDistributor_inv_comp_biproduct_π {J : Type} [Finite J] (X : C) (f : J → C) (j : J) :
(leftDistributor X f).inv ≫ (X ◁ biproduct.π _ j) = biproduct.π _ j := by
classical
cases nonempty_fintype J
simp [leftDistributor_inv, Preadditive.sum_comp, ← whiskerLeft_comp,
biproduct.ι_π, whiskerLeft_dite, comp_dite]
@[reassoc (attr := simp)]
theorem biproduct_ι_comp_leftDistributor_inv {J : Type} [Finite J] (X : C) (f : J → C) (j : J) :
biproduct.ι _ j ≫ (leftDistributor X f).inv = X ◁ biproduct.ι _ j := by
classical
cases nonempty_fintype J
simp [leftDistributor_inv, Preadditive.comp_sum, biproduct.ι_π_assoc, dite_comp]
theorem leftDistributor_assoc {J : Type} [Finite J] (X Y : C) (f : J → C) :
(asIso (𝟙 X) ⊗ᵢ leftDistributor Y f) ≪≫ leftDistributor X _ =
(α_ X Y (⨁ f)).symm ≪≫ leftDistributor (X ⊗ Y) f ≪≫ biproduct.mapIso fun _ => α_ X Y _ := by
classical
cases nonempty_fintype J
ext
simp only [Category.comp_id, Category.assoc, eqToHom_refl, Iso.trans_hom, Iso.symm_hom,
asIso_hom, comp_zero, comp_dite, Preadditive.sum_comp, Preadditive.comp_sum, tensor_sum,
id_tensor_comp, tensorIso_hom, leftDistributor_hom, biproduct.mapIso_hom, biproduct.ι_map,
biproduct.ι_π, Finset.sum_dite_irrel, Finset.sum_dite_eq', Finset.sum_const_zero]
simp_rw [← id_tensorHom]
simp only [← id_tensor_comp, biproduct.ι_π]
simp only [id_tensor_comp, tensor_dite, comp_dite]
simp
/-- The isomorphism showing how tensor product on the right distributes over direct sums. -/
def rightDistributor {J : Type} [Finite J] (f : J → C) (X : C) : (⨁ f) ⊗ X ≅ ⨁ fun j => f j ⊗ X :=
(tensorRight X).mapBiproduct f
theorem rightDistributor_hom {J : Type} [Fintype J] (f : J → C) (X : C) :
(rightDistributor f X).hom =
∑ j : J, (biproduct.π f j ▷ X) ≫ biproduct.ι (fun j => f j ⊗ X) j := by
classical
ext
dsimp [rightDistributor, Functor.mapBiproduct, Functor.mapBicone]
erw [biproduct.lift_π]
simp only [Preadditive.sum_comp, Category.assoc, biproduct.ι_π, comp_dite, comp_zero,
Finset.sum_dite_eq', Finset.mem_univ, eqToHom_refl, Category.comp_id, ite_true]
theorem rightDistributor_inv {J : Type} [Fintype J] (f : J → C) (X : C) :
(rightDistributor f X).inv = ∑ j : J, biproduct.π _ j ≫ (biproduct.ι f j ▷ X) := by
classical
ext
dsimp [rightDistributor, Functor.mapBiproduct, Functor.mapBicone]
simp only [biproduct.ι_desc, Preadditive.comp_sum, biproduct.ι_π_assoc, dite_comp,
zero_comp, Finset.sum_dite_eq, Finset.mem_univ, eqToHom_refl, Category.id_comp, ite_true]
@[reassoc (attr := simp)]
theorem rightDistributor_hom_comp_biproduct_π {J : Type} [Finite J] (f : J → C) (X : C) (j : J) :
(rightDistributor f X).hom ≫ biproduct.π _ j = biproduct.π _ j ▷ X := by
classical
cases nonempty_fintype J
simp [rightDistributor_hom, Preadditive.sum_comp, biproduct.ι_π, comp_dite]
@[reassoc (attr := simp)]
theorem biproduct_ι_comp_rightDistributor_hom {J : Type} [Finite J] (f : J → C) (X : C) (j : J) :
(biproduct.ι _ j ▷ X) ≫ (rightDistributor f X).hom = biproduct.ι (fun j => f j ⊗ X) j := by
classical
cases nonempty_fintype J
simp [rightDistributor_hom, Preadditive.comp_sum, ← comp_whiskerRight_assoc, biproduct.ι_π,
dite_whiskerRight, dite_comp]
@[reassoc (attr := simp)]
theorem rightDistributor_inv_comp_biproduct_π {J : Type} [Finite J] (f : J → C) (X : C) (j : J) :
(rightDistributor f X).inv ≫ (biproduct.π _ j ▷ X) = biproduct.π _ j := by
classical
cases nonempty_fintype J
simp [rightDistributor_inv, Preadditive.sum_comp, ← comp_whiskerRight,
biproduct.ι_π, dite_whiskerRight, comp_dite]
@[reassoc (attr := simp)]
theorem biproduct_ι_comp_rightDistributor_inv {J : Type} [Finite J] (f : J → C) (X : C) (j : J) :
biproduct.ι _ j ≫ (rightDistributor f X).inv = biproduct.ι _ j ▷ X := by
classical
cases nonempty_fintype J
simp [rightDistributor_inv, Preadditive.comp_sum, biproduct.ι_π_assoc,
dite_comp]
theorem rightDistributor_assoc {J : Type} [Finite J] (f : J → C) (X Y : C) :
(rightDistributor f X ⊗ᵢ asIso (𝟙 Y)) ≪≫ rightDistributor _ Y =
α_ (⨁ f) X Y ≪≫ rightDistributor f (X ⊗ Y) ≪≫ biproduct.mapIso fun _ => (α_ _ X Y).symm := by
classical
cases nonempty_fintype J
ext
simp only [Category.comp_id, Category.assoc, eqToHom_refl, Iso.symm_hom, Iso.trans_hom,
asIso_hom, comp_zero, comp_dite, Preadditive.sum_comp, Preadditive.comp_sum, sum_tensor,
comp_tensor_id, tensorIso_hom, rightDistributor_hom, biproduct.mapIso_hom, biproduct.ι_map,
biproduct.ι_π, Finset.sum_dite_irrel, Finset.sum_dite_eq', Finset.sum_const_zero,
Finset.mem_univ, if_true]
simp_rw [← tensorHom_id]
simp only [← comp_tensor_id, biproduct.ι_π, dite_tensor, comp_dite]
simp
theorem leftDistributor_rightDistributor_assoc {J : Type _} [Finite J]
(X : C) (f : J → C) (Y : C) :
(leftDistributor X f ⊗ᵢ asIso (𝟙 Y)) ≪≫ rightDistributor _ Y =
α_ X (⨁ f) Y ≪≫
(asIso (𝟙 X) ⊗ᵢ rightDistributor _ Y) ≪≫
leftDistributor X _ ≪≫ biproduct.mapIso fun _ => (α_ _ _ _).symm := by
classical
cases nonempty_fintype J
ext
simp only [Category.comp_id, Category.assoc, eqToHom_refl, Iso.symm_hom, Iso.trans_hom,
asIso_hom, comp_zero, comp_dite, Preadditive.sum_comp, Preadditive.comp_sum, sum_tensor,
tensor_sum, comp_tensor_id, tensorIso_hom, leftDistributor_hom, rightDistributor_hom,
biproduct.mapIso_hom, biproduct.ι_map, biproduct.ι_π, Finset.sum_dite_irrel,
Finset.sum_dite_eq', Finset.sum_const_zero, Finset.mem_univ, if_true]
simp_rw [← tensorHom_id, ← id_tensorHom]
simp only [← comp_tensor_id, ← id_tensor_comp_assoc, Category.assoc, biproduct.ι_π, comp_dite,
dite_comp, tensor_dite, dite_tensor]
simp
@[ext]
theorem leftDistributor_ext_left {J : Type} [Finite J] {X Y : C} {f : J → C} {g h : X ⊗ ⨁ f ⟶ Y}
(w : ∀ j, (X ◁ biproduct.ι f j) ≫ g = (X ◁ biproduct.ι f j) ≫ h) : g = h := by
classical
cases nonempty_fintype J
apply (cancel_epi (leftDistributor X f).inv).mp
ext
simp [w]
@[ext]
theorem leftDistributor_ext_right {J : Type} [Finite J] {X Y : C} {f : J → C} {g h : X ⟶ Y ⊗ ⨁ f}
(w : ∀ j, g ≫ (Y ◁ biproduct.π f j) = h ≫ (Y ◁ biproduct.π f j)) : g = h := by
classical
cases nonempty_fintype J
apply (cancel_mono (leftDistributor Y f).hom).mp
ext
simp [w]
-- One might wonder how many iterated tensor products we need simp lemmas for.
-- The answer is two: this lemma is needed to verify the pentagon identity.
@[ext]
theorem leftDistributor_ext₂_left {J : Type} [Finite J]
{X Y Z : C} {f : J → C} {g h : X ⊗ (Y ⊗ ⨁ f) ⟶ Z}
(w : ∀ j, (X ◁ (Y ◁ biproduct.ι f j)) ≫ g = (X ◁ (Y ◁ biproduct.ι f j)) ≫ h) :
g = h := by
apply (cancel_epi (α_ _ _ _).hom).mp
ext
simp [w]
@[ext]
theorem leftDistributor_ext₂_right {J : Type} [Finite J]
{X Y Z : C} {f : J → C} {g h : X ⟶ Y ⊗ (Z ⊗ ⨁ f)}
(w : ∀ j, g ≫ (Y ◁ (Z ◁ biproduct.π f j)) = h ≫ (Y ◁ (Z ◁ biproduct.π f j))) :
g = h := by
apply (cancel_mono (α_ _ _ _).inv).mp
ext
simp [w]
@[ext]
theorem rightDistributor_ext_left {J : Type} [Finite J]
{f : J → C} {X Y : C} {g h : (⨁ f) ⊗ X ⟶ Y}
(w : ∀ j, (biproduct.ι f j ▷ X) ≫ g = (biproduct.ι f j ▷ X) ≫ h) : g = h := by
classical
cases nonempty_fintype J
apply (cancel_epi (rightDistributor f X).inv).mp
ext
simp [w]
@[ext]
theorem rightDistributor_ext_right {J : Type} [Finite J]
{f : J → C} {X Y : C} {g h : X ⟶ (⨁ f) ⊗ Y}
(w : ∀ j, g ≫ (biproduct.π f j ▷ Y) = h ≫ (biproduct.π f j ▷ Y)) : g = h := by
classical
cases nonempty_fintype J
apply (cancel_mono (rightDistributor f Y).hom).mp
ext
simp [w]
@[ext]
theorem rightDistributor_ext₂_left {J : Type} [Finite J]
{f : J → C} {X Y Z : C} {g h : ((⨁ f) ⊗ X) ⊗ Y ⟶ Z}
(w : ∀ j, ((biproduct.ι f j ▷ X) ▷ Y) ≫ g = ((biproduct.ι f j ▷ X) ▷ Y) ≫ h) :
g = h := by
apply (cancel_epi (α_ _ _ _).inv).mp
ext
simp [w]
@[ext]
theorem rightDistributor_ext₂_right {J : Type} [Finite J]
{f : J → C} {X Y Z : C} {g h : X ⟶ ((⨁ f) ⊗ Y) ⊗ Z}
(w : ∀ j, g ≫ ((biproduct.π f j ▷ Y) ▷ Z) = h ≫ ((biproduct.π f j ▷ Y) ▷ Z)) :
g = h := by
apply (cancel_mono (α_ _ _ _).hom).mp
ext
simp [w]
end CategoryTheory |
.lake/packages/mathlib/Mathlib/CategoryTheory/Monoidal/Center.lean | import Mathlib.CategoryTheory.Monoidal.Braided.Basic
import Mathlib.CategoryTheory.Functor.ReflectsIso.Basic
/-!
# Half braidings and the Drinfeld center of a monoidal category
We define `Center C` to be pairs `⟨X, b⟩`, where `X : C` and `b` is a half-braiding on `X`.
We show that `Center C` is braided monoidal,
and provide the monoidal functor `Center.forget` from `Center C` back to `C`.
## Implementation notes
Verifying the various axioms directly requires tedious rewriting.
Using the `slice` tactic may make the proofs marginally more readable.
More exciting, however, would be to make possible one of the following options:
1. Integration with homotopy.io / globular to give "picture proofs".
2. The monoidal coherence theorem, so we can ignore associators
(after which most of these proofs are trivial).
3. Automating these proofs using `rewrite_search` or some relative.
In this file, we take the second approach using the monoidal composition `⊗≫` and the
`coherence` tactic.
-/
universe v v₁ v₂ v₃ u u₁ u₂ u₃
noncomputable section
namespace CategoryTheory
open MonoidalCategory Functor.LaxMonoidal Functor.OplaxMonoidal
variable {C : Type u₁} [Category.{v₁} C] [MonoidalCategory C]
/-- A half-braiding on `X : C` is a family of isomorphisms `X ⊗ U ≅ U ⊗ X`,
monoidally natural in `U : C`.
Thinking of `C` as a 2-category with a single `0`-morphism, these are the same as natural
transformations (in the pseudo- sense) of the identity 2-functor on `C`, which send the unique
`0`-morphism to `X`.
-/
structure HalfBraiding (X : C) where
/-- The family of isomorphisms `X ⊗ U ≅ U ⊗ X` -/
β : ∀ U, X ⊗ U ≅ U ⊗ X
monoidal : ∀ U U', (β (U ⊗ U')).hom =
(α_ _ _ _).inv ≫
((β U).hom ▷ U') ≫ (α_ _ _ _).hom ≫ (U ◁ (β U').hom) ≫ (α_ _ _ _).inv := by
cat_disch
naturality : ∀ {U U'} (f : U ⟶ U'), (X ◁ f) ≫ (β U').hom = (β U).hom ≫ (f ▷ X) := by
cat_disch
attribute [reassoc, simp] HalfBraiding.monoidal -- the reassoc lemma is redundant as a simp lemma
attribute [simp, reassoc] HalfBraiding.naturality
variable (C)
/-- The Drinfeld center of a monoidal category `C` has as objects pairs `⟨X, b⟩`, where `X : C`
and `b` is a half-braiding on `X`.
-/
def Center :=
Σ X : C, HalfBraiding X
namespace Center
variable {C}
/-- A morphism in the Drinfeld center of `C`. -/
@[ext]
structure Hom (X Y : Center C) where
/-- The underlying morphism between the first components of the objects involved -/
f : X.1 ⟶ Y.1
comm : ∀ U, (f ▷ U) ≫ (Y.2.β U).hom = (X.2.β U).hom ≫ (U ◁ f) := by cat_disch
attribute [reassoc (attr := simp)] Hom.comm
instance : Quiver (Center C) where
Hom := Hom
@[ext]
theorem ext {X Y : Center C} (f g : X ⟶ Y) (w : f.f = g.f) : f = g := by
cases f; cases g; congr
instance : Category (Center C) where
id X := { f := 𝟙 X.1 }
comp f g := { f := f.f ≫ g.f }
@[simp]
theorem id_f (X : Center C) : Hom.f (𝟙 X) = 𝟙 X.1 :=
rfl
@[simp]
theorem comp_f {X Y Z : Center C} (f : X ⟶ Y) (g : Y ⟶ Z) : (f ≫ g).f = f.f ≫ g.f :=
rfl
/-- Construct an isomorphism in the Drinfeld center from
a morphism whose underlying morphism is an isomorphism.
-/
@[simps]
def isoMk {X Y : Center C} (f : X ⟶ Y) [IsIso f.f] : X ≅ Y where
hom := f
inv := ⟨inv f.f,
fun U => by simp [← cancel_epi (f.f ▷ U), ← comp_whiskerRight_assoc,
← MonoidalCategory.whiskerLeft_comp] ⟩
instance isIso_of_f_isIso {X Y : Center C} (f : X ⟶ Y) [IsIso f.f] : IsIso f := by
change IsIso (isoMk f).hom
infer_instance
/-- Auxiliary definition for the `MonoidalCategory` instance on `Center C`. -/
@[simps]
def tensorObj (X Y : Center C) : Center C :=
⟨X.1 ⊗ Y.1,
{ β := fun U =>
α_ _ _ _ ≪≫
(whiskerLeftIso X.1 (Y.2.β U)) ≪≫ (α_ _ _ _).symm ≪≫
(whiskerRightIso (X.2.β U) Y.1) ≪≫ α_ _ _ _
monoidal := fun U U' => by
dsimp only [Iso.trans_hom, whiskerLeftIso_hom, Iso.symm_hom, whiskerRightIso_hom]
simp only [HalfBraiding.monoidal]
-- We'd like to commute `X.1 ◁ U ◁ (HalfBraiding.β Y.2 U').hom`
-- and `((HalfBraiding.β X.2 U).hom ▷ U' ▷ Y.1)` past each other.
-- We do this with the help of the monoidal composition `⊗≫` and the `coherence` tactic.
calc
_ = 𝟙 _ ⊗≫
X.1 ◁ (HalfBraiding.β Y.2 U).hom ▷ U' ⊗≫
(_ ◁ (HalfBraiding.β Y.2 U').hom ≫
(HalfBraiding.β X.2 U).hom ▷ _) ⊗≫
U ◁ (HalfBraiding.β X.2 U').hom ▷ Y.1 ⊗≫ 𝟙 _ := by monoidal
_ = _ := by rw [whisker_exchange]; monoidal
naturality := fun {U U'} f => by
dsimp only [Iso.trans_hom, whiskerLeftIso_hom, Iso.symm_hom, whiskerRightIso_hom]
calc
_ = 𝟙 _ ⊗≫
(X.1 ◁ (Y.1 ◁ f ≫ (HalfBraiding.β Y.2 U').hom)) ⊗≫
(HalfBraiding.β X.2 U').hom ▷ Y.1 ⊗≫ 𝟙 _ := by monoidal
_ = 𝟙 _ ⊗≫
X.1 ◁ (HalfBraiding.β Y.2 U).hom ⊗≫
(X.1 ◁ f ≫ (HalfBraiding.β X.2 U').hom) ▷ Y.1 ⊗≫ 𝟙 _ := by
rw [HalfBraiding.naturality]; monoidal
_ = _ := by rw [HalfBraiding.naturality]; monoidal }⟩
@[reassoc]
theorem whiskerLeft_comm (X : Center C) {Y₁ Y₂ : Center C} (f : Y₁ ⟶ Y₂) (U : C) :
(X.1 ◁ f.f) ▷ U ≫ ((tensorObj X Y₂).2.β U).hom =
((tensorObj X Y₁).2.β U).hom ≫ U ◁ X.1 ◁ f.f := by
dsimp only [tensorObj_fst, tensorObj_snd_β, Iso.trans_hom, whiskerLeftIso_hom,
Iso.symm_hom, whiskerRightIso_hom]
calc
_ = 𝟙 _ ⊗≫
X.fst ◁ (f.f ▷ U ≫ (HalfBraiding.β Y₂.snd U).hom) ⊗≫
(HalfBraiding.β X.snd U).hom ▷ Y₂.fst ⊗≫ 𝟙 _ := by monoidal
_ = 𝟙 _ ⊗≫
X.fst ◁ (HalfBraiding.β Y₁.snd U).hom ⊗≫
((X.fst ⊗ U) ◁ f.f ≫ (HalfBraiding.β X.snd U).hom ▷ Y₂.fst) ⊗≫ 𝟙 _ := by
rw [f.comm]; monoidal
_ = _ := by rw [whisker_exchange]; monoidal
/-- Auxiliary definition for the `MonoidalCategory` instance on `Center C`. -/
def whiskerLeft (X : Center C) {Y₁ Y₂ : Center C} (f : Y₁ ⟶ Y₂) :
tensorObj X Y₁ ⟶ tensorObj X Y₂ where
f := X.1 ◁ f.f
comm U := whiskerLeft_comm X f U
@[reassoc]
theorem whiskerRight_comm {X₁ X₂ : Center C} (f : X₁ ⟶ X₂) (Y : Center C) (U : C) :
f.f ▷ Y.1 ▷ U ≫ ((tensorObj X₂ Y).2.β U).hom =
((tensorObj X₁ Y).2.β U).hom ≫ U ◁ f.f ▷ Y.1 := by
dsimp only [tensorObj_fst, tensorObj_snd_β, Iso.trans_hom, whiskerLeftIso_hom,
Iso.symm_hom, whiskerRightIso_hom]
calc
_ = 𝟙 _ ⊗≫
(f.f ▷ (Y.fst ⊗ U) ≫ X₂.fst ◁ (HalfBraiding.β Y.snd U).hom) ⊗≫
(HalfBraiding.β X₂.snd U).hom ▷ Y.fst ⊗≫ 𝟙 _ := by monoidal
_ = 𝟙 _ ⊗≫
X₁.fst ◁ (HalfBraiding.β Y.snd U).hom ⊗≫
(f.f ▷ U ≫ (HalfBraiding.β X₂.snd U).hom) ▷ Y.fst ⊗≫ 𝟙 _ := by
rw [← whisker_exchange]; monoidal
_ = _ := by rw [f.comm]; monoidal
/-- Auxiliary definition for the `MonoidalCategory` instance on `Center C`. -/
def whiskerRight {X₁ X₂ : Center C} (f : X₁ ⟶ X₂) (Y : Center C) :
tensorObj X₁ Y ⟶ tensorObj X₂ Y where
f := f.f ▷ Y.1
comm U := whiskerRight_comm f Y U
/-- Auxiliary definition for the `MonoidalCategory` instance on `Center C`. -/
@[simps]
def tensorHom {X₁ Y₁ X₂ Y₂ : Center C} (f : X₁ ⟶ Y₁) (g : X₂ ⟶ Y₂) :
tensorObj X₁ X₂ ⟶ tensorObj Y₁ Y₂ where
f := f.f ⊗ₘ g.f
comm U := by
rw [tensorHom_def, comp_whiskerRight_assoc, whiskerLeft_comm, whiskerRight_comm_assoc,
MonoidalCategory.whiskerLeft_comp]
section
/-- Auxiliary definition for the `MonoidalCategory` instance on `Center C`. -/
@[simps]
def tensorUnit : Center C :=
⟨𝟙_ C, { β := fun U => λ_ U ≪≫ (ρ_ U).symm }⟩
/-- Auxiliary definition for the `MonoidalCategory` instance on `Center C`. -/
def associator (X Y Z : Center C) : tensorObj (tensorObj X Y) Z ≅ tensorObj X (tensorObj Y Z) :=
isoMk ⟨(α_ X.1 Y.1 Z.1).hom, fun U => by simp⟩
/-- Auxiliary definition for the `MonoidalCategory` instance on `Center C`. -/
def leftUnitor (X : Center C) : tensorObj tensorUnit X ≅ X :=
isoMk ⟨(λ_ X.1).hom, fun U => by simp⟩
/-- Auxiliary definition for the `MonoidalCategory` instance on `Center C`. -/
def rightUnitor (X : Center C) : tensorObj X tensorUnit ≅ X :=
isoMk ⟨(ρ_ X.1).hom, fun U => by simp⟩
end
section
attribute [local simp] associator_naturality leftUnitor_naturality rightUnitor_naturality pentagon
attribute [local simp] Center.associator Center.leftUnitor Center.rightUnitor
attribute [local simp] Center.whiskerLeft Center.whiskerRight Center.tensorHom
instance : MonoidalCategory (Center C) where
tensorObj X Y := tensorObj X Y
tensorHom f g := tensorHom f g
tensorHom_def := by intros; ext; simp [tensorHom_def]
whiskerLeft X _ _ f := whiskerLeft X f
whiskerRight f Y := whiskerRight f Y
tensorUnit := tensorUnit
associator := associator
leftUnitor := leftUnitor
rightUnitor := rightUnitor
@[simp]
theorem tensor_fst (X Y : Center C) : (X ⊗ Y).1 = X.1 ⊗ Y.1 :=
rfl
@[simp]
theorem tensor_β (X Y : Center C) (U : C) :
(X ⊗ Y).2.β U =
α_ _ _ _ ≪≫
(whiskerLeftIso X.1 (Y.2.β U)) ≪≫ (α_ _ _ _).symm ≪≫
(whiskerRightIso (X.2.β U) Y.1) ≪≫ α_ _ _ _ :=
rfl
@[simp]
theorem whiskerLeft_f (X : Center C) {Y₁ Y₂ : Center C} (f : Y₁ ⟶ Y₂) : (X ◁ f).f = X.1 ◁ f.f :=
rfl
@[simp]
theorem whiskerRight_f {X₁ X₂ : Center C} (f : X₁ ⟶ X₂) (Y : Center C) : (f ▷ Y).f = f.f ▷ Y.1 :=
rfl
@[simp]
theorem tensor_f {X₁ Y₁ X₂ Y₂ : Center C} (f : X₁ ⟶ Y₁) (g : X₂ ⟶ Y₂) : (f ⊗ₘ g).f = f.f ⊗ₘ g.f :=
rfl
@[simp]
theorem tensorUnit_β (U : C) : (𝟙_ (Center C)).2.β U = λ_ U ≪≫ (ρ_ U).symm :=
rfl
@[simp]
theorem associator_hom_f (X Y Z : Center C) : Hom.f (α_ X Y Z).hom = (α_ X.1 Y.1 Z.1).hom :=
rfl
@[simp]
theorem associator_inv_f (X Y Z : Center C) : Hom.f (α_ X Y Z).inv = (α_ X.1 Y.1 Z.1).inv := by
apply Iso.inv_ext' -- Porting note (https://github.com/leanprover-community/mathlib4/issues/11041): Originally `ext`
rw [← associator_hom_f, ← comp_f, Iso.hom_inv_id]; rfl
@[simp]
theorem leftUnitor_hom_f (X : Center C) : Hom.f (λ_ X).hom = (λ_ X.1).hom :=
rfl
@[simp]
theorem leftUnitor_inv_f (X : Center C) : Hom.f (λ_ X).inv = (λ_ X.1).inv := by
apply Iso.inv_ext' -- Porting note (https://github.com/leanprover-community/mathlib4/issues/11041): Originally `ext`
rw [← leftUnitor_hom_f, ← comp_f, Iso.hom_inv_id]; rfl
@[simp]
theorem rightUnitor_hom_f (X : Center C) : Hom.f (ρ_ X).hom = (ρ_ X.1).hom :=
rfl
@[simp]
theorem rightUnitor_inv_f (X : Center C) : Hom.f (ρ_ X).inv = (ρ_ X.1).inv := by
apply Iso.inv_ext' -- Porting note (https://github.com/leanprover-community/mathlib4/issues/11041): Originally `ext`
rw [← rightUnitor_hom_f, ← comp_f, Iso.hom_inv_id]; rfl
end
section
variable (C)
/-- The forgetful monoidal functor from the Drinfeld center to the original category. -/
@[simps]
def forget : Center C ⥤ C where
obj X := X.1
map f := f.f
instance : (forget C).Monoidal :=
Functor.CoreMonoidal.toMonoidal
{ εIso := Iso.refl _
μIso := fun _ _ ↦ Iso.refl _}
@[simp] lemma forget_ε : ε (forget C) = 𝟙 _ := rfl
@[simp] lemma forget_η : η (forget C) = 𝟙 _ := rfl
variable {C}
@[simp] lemma forget_μ (X Y : Center C) : μ (forget C) X Y = 𝟙 _ := rfl
@[simp] lemma forget_δ (X Y : Center C) : δ (forget C) X Y = 𝟙 _ := rfl
instance : (forget C).ReflectsIsomorphisms where
reflects f i := by dsimp at i; change IsIso (isoMk f).hom; infer_instance
end
/-- Auxiliary definition for the `BraidedCategory` instance on `Center C`. -/
@[simps!]
def braiding (X Y : Center C) : X ⊗ Y ≅ Y ⊗ X :=
isoMk
⟨(X.2.β Y.1).hom, fun U => by
dsimp
simp only [Category.assoc]
rw [← IsIso.inv_comp_eq, IsIso.Iso.inv_hom, ← HalfBraiding.monoidal_assoc,
← HalfBraiding.naturality_assoc, HalfBraiding.monoidal]
simp⟩
instance braidedCategoryCenter : BraidedCategory (Center C) where
braiding := braiding
-- `cat_disch` handles the hexagon axioms
section
variable [BraidedCategory C]
open BraidedCategory
/-- Auxiliary construction for `ofBraided`. -/
@[simps]
def ofBraidedObj (X : C) : Center C :=
⟨X, { β := fun Y => β_ X Y}⟩
variable (C)
/-- The functor lifting a braided category to its center, using the braiding as the half-braiding.
-/
@[simps]
def ofBraided : C ⥤ Center C where
obj := ofBraidedObj
map f :=
{ f
comm := fun U => braiding_naturality_left f U }
instance : (ofBraided C).Monoidal :=
Functor.CoreMonoidal.toMonoidal
{ εIso :=
{ hom := { f := 𝟙 _ }
inv := { f := 𝟙 _ } }
μIso := fun _ _ ↦
{ hom := { f := 𝟙 _ }
inv := { f := 𝟙 _ } } }
@[simp] lemma ofBraided_ε_f : (ε (ofBraided C)).f = 𝟙 _ := rfl
@[simp] lemma ofBraided_η_f : (η (ofBraided C)).f = 𝟙 _ := rfl
variable {C}
@[simp] lemma ofBraided_μ_f (X Y : C) : (μ (ofBraided C) X Y).f = 𝟙 _ := rfl
@[simp] lemma ofBraided_δ_f (X Y : C) : (δ (ofBraided C) X Y).f = 𝟙 _ := rfl
end
end Center
end CategoryTheory |
.lake/packages/mathlib/Mathlib/CategoryTheory/Monoidal/CommGrp_.lean | import Mathlib.CategoryTheory.Monoidal.Grp_
import Mathlib.CategoryTheory.Monoidal.CommMon_
/-!
# The category of commutative groups in a Cartesian monoidal category
-/
universe v₁ v₂ v₃ u₁ u₂ u₃
open CategoryTheory Category Limits MonoidalCategory CartesianMonoidalCategory Mon Grp CommMon
open MonObj
namespace CategoryTheory
variable (C : Type u₁) [Category.{v₁} C] [CartesianMonoidalCategory.{v₁} C] [BraidedCategory C]
/-- A commutative group object internal to a Cartesian monoidal category. -/
structure CommGrp where
/-- The underlying object in the ambient monoidal category -/
X : C
[grp : GrpObj X]
[comm : IsCommMonObj X]
@[deprecated (since := "2025-10-13")] alias CommGrp_ := CommGrp
attribute [instance] CommGrp.grp CommGrp.comm
namespace CommGrp
variable {C}
/-- A commutative group object is a group object. -/
@[simps -isSimp X]
abbrev toGrp (A : CommGrp C) : Grp C := ⟨A.X⟩
@[deprecated (since := "2025-10-13")] alias toGrp_ := toGrp
/-- A commutative group object is a commutative monoid object. -/
@[simps X]
def toCommMon (A : CommGrp C) : CommMon C := ⟨A.X⟩
@[deprecated (since := "2025-09-15")] alias toCommMon_ := toCommMon
/-- A commutative group object is a monoid object. -/
abbrev toMon (A : CommGrp C) : Mon C := (toCommMon A).toMon
@[deprecated (since := "2025-09-15")] alias toMon_ := toMon
variable (C) in
/-- The trivial commutative group object. -/
@[simps!]
def trivial : CommGrp C := { X := 𝟙_ C }
instance : Inhabited (CommGrp C) where
default := trivial C
instance : Category (CommGrp C) :=
InducedCategory.category CommGrp.toGrp
omit [BraidedCategory C] in
@[simp]
theorem id_hom (A : Grp C) : Mon.Hom.hom (𝟙 A) = 𝟙 A.X :=
rfl
@[simp]
theorem comp_hom {R S T : CommGrp C} (f : R ⟶ S) (g : S ⟶ T) :
Mon.Hom.hom (f ≫ g) = f.hom ≫ g.hom :=
rfl
@[ext]
theorem hom_ext {A B : CommGrp C} (f g : A ⟶ B) (h : f.hom = g.hom) : f = g :=
Mon.Hom.ext h
@[simp]
lemma id' (A : CommGrp C) : (𝟙 A : A.toMon ⟶ A.toMon) = 𝟙 (A.toMon) := rfl
@[simp]
lemma comp' {A₁ A₂ A₃ : CommGrp C} (f : A₁ ⟶ A₂) (g : A₂ ⟶ A₃) :
((f ≫ g : A₁ ⟶ A₃) : A₁.toMon ⟶ A₃.toMon) = @CategoryStruct.comp (Mon C) _ _ _ _ f g := rfl
section
variable (C)
/-- The forgetful functor from commutative group objects to group objects. -/
@[simps! obj_X]
def forget₂Grp : CommGrp C ⥤ Grp C :=
inducedFunctor CommGrp.toGrp
@[deprecated (since := "2025-10-13")] alias forget₂Grp_ := forget₂Grp
/-- The forgetful functor from commutative group objects to group objects is fully faithful. -/
def fullyFaithfulForget₂Grp : (forget₂Grp C).FullyFaithful :=
fullyFaithfulInducedFunctor _
@[deprecated (since := "2025-10-13")] alias fullyFaithfulForget₂Grp_ := fullyFaithfulForget₂Grp
instance : (forget₂Grp C).Full := InducedCategory.full _
instance : (forget₂Grp C).Faithful := InducedCategory.faithful _
@[simp]
theorem forget₂Grp_obj_one (A : CommGrp C) : η[((forget₂Grp C).obj A).X] = η[A.X] :=
rfl
@[simp]
theorem forget₂Grp_obj_mul (A : CommGrp C) : μ[((forget₂Grp C).obj A).X] = μ[A.X] :=
rfl
@[simp]
theorem forget₂Grp_map_hom {A B : CommGrp C} (f : A ⟶ B) : ((forget₂Grp C).map f).hom = f.hom :=
rfl
/-- The forgetful functor from commutative group objects to commutative monoid objects. -/
@[simps! obj_X]
def forget₂CommMon : CommGrp C ⥤ CommMon C :=
inducedFunctor CommGrp.toCommMon
@[deprecated (since := "2025-09-15")] alias forget₂CommMon_ := forget₂CommMon
/-- The forgetful functor from commutative group objects to commutative monoid objects is fully
faithful. -/
def fullyFaithfulForget₂CommMon : (forget₂CommMon C).FullyFaithful :=
fullyFaithfulInducedFunctor _
@[deprecated (since := "2025-09-15")]
alias fullyFaithfulForget₂CommMon_ := fullyFaithfulForget₂CommMon
instance : (forget₂CommMon C).Full := InducedCategory.full _
instance : (forget₂CommMon C).Faithful := InducedCategory.faithful _
@[simp]
theorem forget₂CommMon_obj_one (A : CommGrp C) : η[((forget₂CommMon C).obj A).X] = η[A.X] :=
rfl
@[simp]
theorem forget₂CommMon_obj_mul (A : CommGrp C) : μ[((forget₂CommMon C).obj A).X] = μ[A.X] :=
rfl
@[simp]
theorem forget₂CommMon_map_hom {A B : CommGrp C} (f : A ⟶ B) :
((forget₂CommMon C).map f).hom = f.hom :=
rfl
/-- The forgetful functor from commutative group objects to the ambient category. -/
@[simps!]
def forget : CommGrp C ⥤ C :=
forget₂Grp C ⋙ Grp.forget C
instance : (forget C).Faithful where
@[simp]
theorem forget₂Grp_comp_forget : forget₂Grp C ⋙ Grp.forget C = forget C := rfl
@[simp]
theorem forget₂CommMon_comp_forget : forget₂CommMon C ⋙ CommMon.forget C = forget C := rfl
instance {G H : CommGrp C} {f : G ⟶ H} [IsIso f] : IsIso f.hom :=
inferInstanceAs <| IsIso <| (forget C).map f
end
/-- Construct an isomorphism of commutative group objects by giving a monoid isomorphism between the
underlying objects. -/
@[simps!]
def mkIso' {G H : C} (e : G ≅ H) [GrpObj G] [IsCommMonObj G] [GrpObj H] [IsCommMonObj H]
[IsMonHom e.hom] : mk G ≅ mk H :=
(fullyFaithfulForget₂Grp C).preimageIso (Grp.mkIso' e)
/-- Construct an isomorphism of group objects by giving an isomorphism between the underlying
objects and checking compatibility with unit and multiplication only in the forward direction. -/
abbrev mkIso {G H : CommGrp C} (e : G.X ≅ H.X) (one_f : η[G.X] ≫ e.hom = η[H.X] := by cat_disch)
(mul_f : μ[G.X] ≫ e.hom = (e.hom ⊗ₘ e.hom) ≫ μ[H.X] := by cat_disch) : G ≅ H :=
have : IsMonHom e.hom := ⟨one_f, mul_f⟩
mkIso' e
instance uniqueHomFromTrivial (A : CommGrp C) : Unique (trivial C ⟶ A) :=
Mon.uniqueHomFromTrivial A.toMon
instance : HasInitial (CommGrp C) :=
hasInitial_of_unique (trivial C)
end CommGrp
variable {C}
{D : Type u₂} [Category.{v₂} D] [CartesianMonoidalCategory D] [BraidedCategory D]
{E : Type u₃} [Category.{v₃} E] [CartesianMonoidalCategory E] [BraidedCategory E]
namespace Functor
variable {F F' : C ⥤ D} [F.Braided] [F'.Braided] {G : D ⥤ E} [G.Braided]
open Monoidal
variable (F) in
/-- A finite-product-preserving functor takes commutative group objects to commutative group
objects. -/
@[simps!]
def mapCommGrp : CommGrp C ⥤ CommGrp D where
obj A :=
{ F.mapGrp.obj A.toGrp with
comm :=
{ mul_comm := by
dsimp
rw [← Functor.LaxBraided.braided_assoc, ← Functor.map_comp, IsCommMonObj.mul_comm] } }
map f := F.mapMon.map f
map_id X := show F.mapMon.map (𝟙 X.toGrp.toMon) = _ by cat_disch
protected instance Faithful.mapCommGrp [F.Faithful] : F.mapCommGrp.Faithful where
map_injective hfg := F.mapMon.map_injective hfg
protected instance Full.mapCommGrp [F.Full] [F.Faithful] : F.mapCommGrp.Full where
map_surjective := F.mapMon.map_surjective
/-- If `F : C ⥤ D` is a fully faithful monoidal functor, then
`CommGrpCat(F) : CommGrpCat C ⥤ CommGrpCat D` is fully faithful too. -/
@[simps]
protected def FullyFaithful.mapCommGrp (hF : F.FullyFaithful) : F.mapGrp.FullyFaithful where
preimage f := .mk <| hF.preimage f.hom
@[simp]
theorem mapCommGrp_id_one (A : CommGrp C) :
η[((𝟭 C).mapCommGrp.obj A).X] = 𝟙 _ ≫ η[A.X] :=
rfl
@[simp]
theorem mapCommpGrp_id_mul (A : CommGrp C) :
μ[((𝟭 C).mapCommGrp.obj A).X] = 𝟙 _ ≫ μ[A.X] :=
rfl
@[simp]
theorem comp_mapCommGrp_one (A : CommGrp C) :
η[((F ⋙ G).mapCommGrp.obj A).X] = LaxMonoidal.ε (F ⋙ G) ≫ (F ⋙ G).map η[A.X] :=
rfl
@[simp]
theorem comp_mapCommGrp_mul (A : CommGrp C) :
μ[((F ⋙ G).mapCommGrp.obj A).X] = LaxMonoidal.μ (F ⋙ G) _ _ ≫ (F ⋙ G).map μ[A.X] :=
rfl
/-- The identity functor is also the identity on commutative group objects. -/
@[simps!]
def mapCommGrpIdIso : mapCommGrp (𝟭 C) ≅ 𝟭 (CommGrp C) :=
NatIso.ofComponents (fun X ↦ CommGrp.mkIso (.refl _) (by simp)
(by simp))
/-- The composition functor is also the composition on commutative group objects. -/
@[simps!]
def mapCommGrpCompIso : (F ⋙ G).mapCommGrp ≅ F.mapCommGrp ⋙ G.mapCommGrp :=
NatIso.ofComponents fun X ↦ CommGrp.mkIso (.refl _)
/-- Natural transformations between functors lift to commutative group objects. -/
@[simps!]
def mapCommGrpNatTrans (f : F ⟶ F') : F.mapCommGrp ⟶ F'.mapCommGrp where
app X := .mk' (f.app _)
/-- Natural isomorphisms between functors lift to commutative group objects. -/
@[simps!]
def mapCommGrpNatIso (e : F ≅ F') : F.mapCommGrp ≅ F'.mapCommGrp :=
NatIso.ofComponents fun X ↦ CommGrp.mkIso (e.app _)
attribute [local instance] Functor.Braided.ofChosenFiniteProducts in
/-- `mapCommGrp` is functorial in the left-exact functor. -/
@[simps]
noncomputable def mapCommGrpFunctor : (C ⥤ₗ D) ⥤ CommGrp C ⥤ CommGrp D where
obj F := F.1.mapCommGrp
map {F G} α := { app A := .mk' (α.app A.X) }
end Functor
open Functor
namespace Adjunction
variable {F : C ⥤ D} {G : D ⥤ C} (a : F ⊣ G) [F.Braided] [G.Braided]
/-- An adjunction of braided functors lifts to an adjunction of their lifts to commutative group
objects. -/
@[simps] noncomputable def mapCommGrp : F.mapCommGrp ⊣ G.mapCommGrp where
unit := mapCommGrpIdIso.inv ≫ mapCommGrpNatTrans a.unit ≫ mapCommGrpCompIso.hom
counit := mapCommGrpCompIso.inv ≫ mapCommGrpNatTrans a.counit ≫ mapCommGrpIdIso.hom
end Adjunction
namespace Equivalence
variable (e : C ≌ D) [e.functor.Braided] [e.inverse.Braided]
/-- An equivalence of categories lifts to an equivalence of their commutative group objects. -/
@[simps] noncomputable def mapCommGrp : CommGrp C ≌ CommGrp D where
functor := e.functor.mapCommGrp
inverse := e.inverse.mapCommGrp
unitIso := mapCommGrpIdIso.symm ≪≫ mapCommGrpNatIso e.unitIso ≪≫ mapCommGrpCompIso
counitIso := mapCommGrpCompIso.symm ≪≫ mapCommGrpNatIso e.counitIso ≪≫ mapCommGrpIdIso
end CategoryTheory.Equivalence |
.lake/packages/mathlib/Mathlib/CategoryTheory/Monoidal/End.lean | import Mathlib.CategoryTheory.Monoidal.Functor
/-!
# Endofunctors as a monoidal category.
We give the monoidal category structure on `C ⥤ C`,
and show that when `C` itself is monoidal, it embeds via a monoidal functor into `C ⥤ C`.
## TODO
Can we use this to show coherence results, e.g. a cheap proof that `λ_ (𝟙_ C) = ρ_ (𝟙_ C)`?
I suspect this is harder than is usually made out.
-/
universe v u
namespace CategoryTheory
open Functor.LaxMonoidal Functor.OplaxMonoidal Functor.Monoidal
variable (C : Type u) [Category.{v} C]
/-- The category of endofunctors of any category is a monoidal category,
with tensor product given by composition of functors
(and horizontal composition of natural transformations).
Note: due to the fact that composition of functors in mathlib is reversed compared to the
one usually found in the literature, this monoidal structure is in fact the monoidal
opposite of the one usually considered in the literature.
-/
def endofunctorMonoidalCategory : MonoidalCategory (C ⥤ C) where
tensorObj F G := F ⋙ G
whiskerLeft X _ _ F := Functor.whiskerLeft X F
whiskerRight F X := Functor.whiskerRight F X
tensorHom α β := α ◫ β
tensorUnit := 𝟭 C
associator F G H := Functor.associator F G H
leftUnitor F := Functor.leftUnitor F
rightUnitor F := Functor.rightUnitor F
open CategoryTheory.MonoidalCategory
attribute [local instance] endofunctorMonoidalCategory
@[simp] theorem endofunctorMonoidalCategory_tensorUnit_obj (X : C) :
(𝟙_ (C ⥤ C)).obj X = X := rfl
@[simp] theorem endofunctorMonoidalCategory_tensorUnit_map {X Y : C} (f : X ⟶ Y) :
(𝟙_ (C ⥤ C)).map f = f := rfl
@[simp] theorem endofunctorMonoidalCategory_tensorObj_obj (F G : C ⥤ C) (X : C) :
(F ⊗ G).obj X = G.obj (F.obj X) := rfl
@[simp] theorem endofunctorMonoidalCategory_tensorObj_map (F G : C ⥤ C) {X Y : C} (f : X ⟶ Y) :
(F ⊗ G).map f = G.map (F.map f) := rfl
@[simp] theorem endofunctorMonoidalCategory_tensorMap_app
{F G H K : C ⥤ C} {α : F ⟶ G} {β : H ⟶ K} (X : C) :
(α ⊗ₘ β).app X = β.app (F.obj X) ≫ K.map (α.app X) := rfl
@[simp] theorem endofunctorMonoidalCategory_whiskerLeft_app
{F H K : C ⥤ C} {β : H ⟶ K} (X : C) :
(F ◁ β).app X = β.app (F.obj X) := rfl
@[simp] theorem endofunctorMonoidalCategory_whiskerRight_app
{F G H : C ⥤ C} {α : F ⟶ G} (X : C) :
(α ▷ H).app X = H.map (α.app X) := rfl
@[simp] theorem endofunctorMonoidalCategory_associator_hom_app (F G H : C ⥤ C) (X : C) :
(α_ F G H).hom.app X = 𝟙 _ := rfl
@[simp] theorem endofunctorMonoidalCategory_associator_inv_app (F G H : C ⥤ C) (X : C) :
(α_ F G H).inv.app X = 𝟙 _ := rfl
@[simp] theorem endofunctorMonoidalCategory_leftUnitor_hom_app (F : C ⥤ C) (X : C) :
(λ_ F).hom.app X = 𝟙 _ := rfl
@[simp] theorem endofunctorMonoidalCategory_leftUnitor_inv_app (F : C ⥤ C) (X : C) :
(λ_ F).inv.app X = 𝟙 _ := rfl
@[simp] theorem endofunctorMonoidalCategory_rightUnitor_hom_app (F : C ⥤ C) (X : C) :
(ρ_ F).hom.app X = 𝟙 _ := rfl
@[simp] theorem endofunctorMonoidalCategory_rightUnitor_inv_app (F : C ⥤ C) (X : C) :
(ρ_ F).inv.app X = 𝟙 _ := rfl
namespace MonoidalCategory
variable [MonoidalCategory C]
/-- Tensoring on the right gives a monoidal functor from `C` into endofunctors of `C`.
-/
instance : (tensoringRight C).Monoidal :=
Functor.CoreMonoidal.toMonoidal
{ εIso := (rightUnitorNatIso C).symm
μIso := fun X Y => (Functor.isoWhiskerRight (curriedAssociatorNatIso C)
((evaluation C (C ⥤ C)).obj X ⋙ (evaluation C C).obj Y)) }
@[simp] lemma tensoringRight_ε :
ε (tensoringRight C) = (rightUnitorNatIso C).inv := rfl
@[simp] lemma tensoringRight_η :
η (tensoringRight C) = (rightUnitorNatIso C).hom := rfl
@[simp] lemma tensoringRight_μ (X Y : C) (Z : C) :
(μ (tensoringRight C) X Y).app Z = (α_ Z X Y).hom := rfl
@[simp] lemma tensoringRight_δ (X Y : C) (Z : C) :
(δ (tensoringRight C) X Y).app Z = (α_ Z X Y).inv := rfl
end MonoidalCategory
variable {C}
variable {M : Type*} [Category M] [MonoidalCategory M] (F : M ⥤ (C ⥤ C))
@[reassoc (attr := simp)]
theorem μ_δ_app (i j : M) (X : C) [F.Monoidal] :
(μ F i j).app X ≫ (δ F i j).app X = 𝟙 _ :=
(μIso F i j).hom_inv_id_app X
@[reassoc (attr := simp)]
theorem δ_μ_app (i j : M) (X : C) [F.Monoidal] :
(δ F i j).app X ≫ (μ F i j).app X = 𝟙 _ :=
(μIso F i j).inv_hom_id_app X
@[reassoc (attr := simp)]
theorem ε_η_app (X : C) [F.Monoidal] : (ε F).app X ≫ (η F).app X = 𝟙 _ :=
(εIso F).hom_inv_id_app X
@[reassoc (attr := simp)]
theorem η_ε_app (X : C) [F.Monoidal] : (η F).app X ≫ (ε F).app X = 𝟙 _ :=
(εIso F).inv_hom_id_app X
@[reassoc (attr := simp)]
theorem ε_naturality {X Y : C} (f : X ⟶ Y) [F.LaxMonoidal] :
(ε F).app X ≫ (F.obj (𝟙_ M)).map f = f ≫ (ε F).app Y :=
((ε F).naturality f).symm
@[reassoc (attr := simp)]
theorem η_naturality {X Y : C} (f : X ⟶ Y) [F.OplaxMonoidal] :
(η F).app X ≫ (𝟙_ (C ⥤ C)).map f = (η F).app X ≫ f := by
simp
@[reassoc (attr := simp)]
theorem μ_naturality {m n : M} {X Y : C} (f : X ⟶ Y) [F.LaxMonoidal] :
(F.obj n).map ((F.obj m).map f) ≫ (μ F m n).app Y = (μ F m n).app X ≫ (F.obj _).map f :=
(μ F m n).naturality f
-- This is a simp lemma in the reverse direction via `NatTrans.naturality`.
@[reassoc]
theorem δ_naturality {m n : M} {X Y : C} (f : X ⟶ Y) [F.OplaxMonoidal] :
(δ F m n).app X ≫ (F.obj n).map ((F.obj m).map f) =
(F.obj _).map f ≫ (δ F m n).app Y := by simp
-- This is not a simp lemma since it could be proved by the lemmas later.
@[reassoc]
theorem μ_naturality₂ {m n m' n' : M} (f : m ⟶ m') (g : n ⟶ n') (X : C) [F.LaxMonoidal] :
(F.map g).app ((F.obj m).obj X) ≫ (F.obj n').map ((F.map f).app X) ≫ (μ F m' n').app X =
(μ F m n).app X ≫ (F.map (f ⊗ₘ g)).app X := by
have := congr_app (μ_natural F f g) X
dsimp at this
simpa using this
@[reassoc (attr := simp)]
theorem μ_naturalityₗ {m n m' : M} (f : m ⟶ m') (X : C) [F.LaxMonoidal] :
(F.obj n).map ((F.map f).app X) ≫ (μ F m' n).app X =
(μ F m n).app X ≫ (F.map (f ▷ n)).app X := by
rw [← tensorHom_id, ← μ_naturality₂ F f (𝟙 n) X]
simp
@[reassoc (attr := simp)]
theorem μ_naturalityᵣ {m n n' : M} (g : n ⟶ n') (X : C) [F.LaxMonoidal] :
(F.map g).app ((F.obj m).obj X) ≫ (μ F m n').app X =
(μ F m n).app X ≫ (F.map (m ◁ g)).app X := by
rw [← id_tensorHom, ← μ_naturality₂ F (𝟙 m) g X]
simp
@[reassoc (attr := simp)]
theorem δ_naturalityₗ {m n m' : M} (f : m ⟶ m') (X : C) [F.OplaxMonoidal] :
(δ F m n).app X ≫ (F.obj n).map ((F.map f).app X) =
(F.map (f ▷ n)).app X ≫ (δ F m' n).app X :=
congr_app (δ_natural_left F f n) X
@[reassoc (attr := simp)]
theorem δ_naturalityᵣ {m n n' : M} (g : n ⟶ n') (X : C) [F.OplaxMonoidal] :
(δ F m n).app X ≫ (F.map g).app ((F.obj m).obj X) =
(F.map (m ◁ g)).app X ≫ (δ F m n').app X :=
congr_app (δ_natural_right F m g) X
@[reassoc]
theorem left_unitality_app (n : M) (X : C) [F.LaxMonoidal] :
(F.obj n).map ((ε F).app X) ≫ (μ F (𝟙_ M) n).app X ≫ (F.map (λ_ n).hom).app X = 𝟙 _ :=
congr_app (left_unitality F n).symm X
@[simp, reassoc]
theorem obj_ε_app (n : M) (X : C) [F.Monoidal] :
(F.obj n).map ((ε F).app X) = (F.map (λ_ n).inv).app X ≫ (δ F (𝟙_ M) n).app X := by
rw [map_leftUnitor_inv]
dsimp
simp only [Category.id_comp, Category.assoc, μ_δ_app, endofunctorMonoidalCategory_tensorObj_obj,
Category.comp_id]
@[simp, reassoc]
theorem obj_η_app (n : M) (X : C) [F.Monoidal] :
(F.obj n).map ((η F).app X) = (μ F (𝟙_ M) n).app X ≫ (F.map (λ_ n).hom).app X := by
rw [← cancel_mono ((F.obj n).map ((ε F).app X)), ← Functor.map_comp]
simp
@[reassoc]
theorem right_unitality_app (n : M) (X : C) [F.Monoidal] :
(ε F).app ((F.obj n).obj X) ≫ (μ F n (𝟙_ M)).app X ≫ (F.map (ρ_ n).hom).app X = 𝟙 _ :=
congr_app (Functor.LaxMonoidal.right_unitality F n).symm X
@[simp]
theorem ε_app_obj (n : M) (X : C) [F.Monoidal] :
(ε F).app ((F.obj n).obj X) = (F.map (ρ_ n).inv).app X ≫ (δ F n (𝟙_ M)).app X := by
rw [map_rightUnitor_inv]
dsimp
simp only [Category.id_comp, Category.assoc, μ_δ_app,
endofunctorMonoidalCategory_tensorObj_obj, Category.comp_id]
@[simp]
theorem η_app_obj (n : M) (X : C) [F.Monoidal] :
(η F).app ((F.obj n).obj X) = (μ F n (𝟙_ M)).app X ≫ (F.map (ρ_ n).hom).app X := by
rw [map_rightUnitor]
dsimp
simp only [Category.comp_id, μ_δ_app_assoc]
@[reassoc]
theorem associativity_app (m₁ m₂ m₃ : M) (X : C) [F.LaxMonoidal] :
(F.obj m₃).map ((μ F m₁ m₂).app X) ≫
(μ F (m₁ ⊗ m₂) m₃).app X ≫ (F.map (α_ m₁ m₂ m₃).hom).app X =
(μ F m₂ m₃).app ((F.obj m₁).obj X) ≫ (μ F m₁ (m₂ ⊗ m₃)).app X := by
have := congr_app (associativity F m₁ m₂ m₃) X
dsimp at this
simpa using this
@[simp, reassoc]
theorem obj_μ_app (m₁ m₂ m₃ : M) (X : C) [F.Monoidal] :
(F.obj m₃).map ((μ F m₁ m₂).app X) =
(μ F m₂ m₃).app ((F.obj m₁).obj X) ≫
(μ F m₁ (m₂ ⊗ m₃)).app X ≫
(F.map (α_ m₁ m₂ m₃).inv).app X ≫ (δ F (m₁ ⊗ m₂) m₃).app X := by
rw [← associativity_app_assoc]
simp
@[simp, reassoc]
theorem obj_μ_inv_app (m₁ m₂ m₃ : M) (X : C) [F.Monoidal] :
(F.obj m₃).map ((δ F m₁ m₂).app X) =
(μ F (m₁ ⊗ m₂) m₃).app X ≫
(F.map (α_ m₁ m₂ m₃).hom).app X ≫
(δ F m₁ (m₂ ⊗ m₃)).app X ≫ (δ F m₂ m₃).app ((F.obj m₁).obj X) := by
rw [map_associator]
dsimp
simp only [Category.id_comp, Category.assoc, μ_δ_app_assoc, μ_δ_app,
endofunctorMonoidalCategory_tensorObj_obj, Category.comp_id]
@[reassoc (attr := simp)]
theorem obj_zero_map_μ_app {m : M} {X Y : C} (f : X ⟶ (F.obj m).obj Y) [F.Monoidal] :
(F.obj (𝟙_ M)).map f ≫ (μ F m (𝟙_ M)).app _ =
(η F).app _ ≫ f ≫ (F.map (ρ_ m).inv).app _ := by
rw [← cancel_epi ((ε F).app _), ← cancel_mono ((δ F _ _).app _)]
simp
@[simp]
theorem obj_μ_zero_app (m₁ m₂ : M) (X : C) [F.Monoidal] :
(μ F (𝟙_ M) m₂).app ((F.obj m₁).obj X) ≫ (μ F m₁ (𝟙_ M ⊗ m₂)).app X ≫
(F.map (α_ m₁ (𝟙_ M) m₂).inv).app X ≫ (δ F (m₁ ⊗ 𝟙_ M) m₂).app X =
(μ F (𝟙_ M) m₂).app ((F.obj m₁).obj X) ≫
(F.map (λ_ m₂).hom).app ((F.obj m₁).obj X) ≫ (F.obj m₂).map ((F.map (ρ_ m₁).inv).app X) := by
rw [← obj_η_app_assoc, ← Functor.map_comp]
simp
/-- If `m ⊗ n ≅ 𝟙_M`, then `F.obj m` is a left inverse of `F.obj n`. -/
@[simps!]
noncomputable def unitOfTensorIsoUnit (m n : M) (h : m ⊗ n ≅ 𝟙_ M) [F.Monoidal] :
F.obj m ⋙ F.obj n ≅ 𝟭 C :=
μIso F m n ≪≫ F.mapIso h ≪≫ (εIso F).symm
/-- If `m ⊗ n ≅ 𝟙_M` and `n ⊗ m ≅ 𝟙_M` (subject to some commuting constraints),
then `F.obj m` and `F.obj n` forms a self-equivalence of `C`. -/
@[simps]
noncomputable def equivOfTensorIsoUnit (m n : M) (h₁ : m ⊗ n ≅ 𝟙_ M) (h₂ : n ⊗ m ≅ 𝟙_ M)
(H : h₁.hom ▷ m ≫ (λ_ m).hom = (α_ m n m).hom ≫ m ◁ h₂.hom ≫ (ρ_ m).hom) [F.Monoidal] :
C ≌ C where
functor := F.obj m
inverse := F.obj n
unitIso := (unitOfTensorIsoUnit F m n h₁).symm
counitIso := unitOfTensorIsoUnit F n m h₂
functor_unitIso_comp X := by
dsimp
simp only [μ_naturalityᵣ_assoc, μ_naturalityₗ_assoc, η_app_obj, Category.assoc,
obj_μ_inv_app, Functor.map_comp, δ_μ_app_assoc, obj_ε_app,
unitOfTensorIsoUnit_inv_app]
simp only [← NatTrans.comp_app, ← F.map_comp, ← H, inv_hom_whiskerRight_assoc,
Iso.inv_hom_id, Functor.map_id, NatTrans.id_app]
end CategoryTheory |
.lake/packages/mathlib/Mathlib/CategoryTheory/Monoidal/CommComon_.lean | import Mathlib.CategoryTheory.Monoidal.Comon_
import Mathlib.CategoryTheory.Monoidal.Braided.Basic
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
/-!
# The category of commutative comonoids in a braided monoidal category.
We define the category of commutative comonoid objects in a braided monoidal category `C`.
## Main definitions
* `CommComon C` - The bundled structure of commutative comonoid objects
## Tags
comonoid, commutative, braided
-/
universe v₁ v₂ v₃ u₁ u₂ u₃ u
namespace CategoryTheory
open MonoidalCategory ComonObj Functor
variable {C : Type u₁} [Category.{v₁} C] [MonoidalCategory.{v₁} C] [BraidedCategory.{v₁} C]
variable (C) in
/-- A commutative comonoid object internal to a monoidal category. -/
structure CommComon where
/-- The underlying object in the ambient monoidal category -/
X : C
[comon : ComonObj X]
[comm : IsCommComonObj X]
attribute [instance] CommComon.comon CommComon.comm
namespace CommComon
/-- A commutative comonoid object is a comonoid object. -/
@[simps X]
def toComon (A : CommComon C) : Comon C := ⟨A.X⟩
section
attribute [local instance] ComonObj.instTensorUnit in
/-- The trivial comonoid on the unit object is commutative. -/
instance instCommComonObjUnit : IsCommComonObj (𝟙_ C) where
comul_comm := by simp [← unitors_equal]
end
attribute [local instance] ComonObj.instTensorUnit in
variable (C) in
/-- The trivial commutative comonoid object. We later show this is initial in `CommComon C`. -/
@[simps!]
def trivial : CommComon C := mk (𝟙_ C)
instance : Inhabited (CommComon C) :=
⟨trivial C⟩
variable {M : CommComon C}
instance : Category (CommComon C) :=
InducedCategory.category CommComon.toComon
@[simp]
theorem id_hom (A : CommComon C) : Comon.Hom.hom (𝟙 A) = 𝟙 A.X :=
rfl
@[simp]
theorem comp_hom {R S T : CommComon C} (f : R ⟶ S) (g : S ⟶ T) :
Comon.Hom.hom (f ≫ g) = f.hom ≫ g.hom :=
rfl
@[ext]
lemma hom_ext {A B : CommComon C} (f g : A ⟶ B) (h : f.hom = g.hom) : f = g :=
Comon.Hom.ext h
section
variable (C)
/-- The forgetful functor from commutative comonoid objects to comonoid objects. -/
@[simps!]
def forget₂Comon : CommComon C ⥤ Comon C :=
inducedFunctor _
end
end CommComon
end CategoryTheory |
.lake/packages/mathlib/Mathlib/CategoryTheory/Monoidal/CoherenceLemmas.lean | import Mathlib.Tactic.CategoryTheory.Monoidal.PureCoherence
/-!
# Lemmas which are consequences of monoidal coherence
These lemmas are all proved `by coherence`.
## Future work
Investigate whether these lemmas are really needed,
or if they can be replaced by use of the `coherence` tactic.
-/
open CategoryTheory Category Iso
namespace CategoryTheory.MonoidalCategory
variable {C : Type*} [Category C] [MonoidalCategory C]
-- See Proposition 2.2.4 of <http://www-math.mit.edu/~etingof/egnobookfinal.pdf>
@[reassoc]
theorem leftUnitor_tensor_hom'' (X Y : C) :
(α_ (𝟙_ C) X Y).hom ≫ (λ_ (X ⊗ Y)).hom = (λ_ X).hom ⊗ₘ 𝟙 Y := by
simp
@[deprecated (since := "2025-06-24")] alias leftUnitor_tensor'' := leftUnitor_tensor_hom''
@[reassoc]
theorem leftUnitor_tensor_hom' (X Y : C) :
(λ_ (X ⊗ Y)).hom = (α_ (𝟙_ C) X Y).inv ≫ ((λ_ X).hom ⊗ₘ 𝟙 Y) := by
simp
@[deprecated (since := "2025-06-24")] alias leftUnitor_tensor' := leftUnitor_tensor_hom'
@[reassoc]
theorem leftUnitor_tensor_inv' (X Y : C) :
(λ_ (X ⊗ Y)).inv = ((λ_ X).inv ⊗ₘ 𝟙 Y) ≫ (α_ (𝟙_ C) X Y).hom := by simp
@[reassoc]
theorem id_tensor_rightUnitor_inv (X Y : C) : 𝟙 X ⊗ₘ (ρ_ Y).inv = (ρ_ _).inv ≫ (α_ _ _ _).hom := by
simp
@[reassoc]
theorem leftUnitor_inv_tensor_id (X Y : C) : (λ_ X).inv ⊗ₘ 𝟙 Y = (λ_ _).inv ≫ (α_ _ _ _).inv := by
simp
@[reassoc]
theorem pentagon_inv_inv_hom (W X Y Z : C) :
(α_ W (X ⊗ Y) Z).inv ≫ ((α_ W X Y).inv ⊗ₘ 𝟙 Z) ≫ (α_ (W ⊗ X) Y Z).hom =
(𝟙 W ⊗ₘ (α_ X Y Z).hom) ≫ (α_ W X (Y ⊗ Z)).inv := by
simp
theorem unitors_equal : (λ_ (𝟙_ C)).hom = (ρ_ (𝟙_ C)).hom := by
monoidal_coherence
theorem unitors_inv_equal : (λ_ (𝟙_ C)).inv = (ρ_ (𝟙_ C)).inv := by
monoidal_coherence
@[reassoc]
theorem pentagon_hom_inv {W X Y Z : C} :
(α_ W X (Y ⊗ Z)).hom ≫ (𝟙 W ⊗ₘ (α_ X Y Z).inv) =
(α_ (W ⊗ X) Y Z).inv ≫ ((α_ W X Y).hom ⊗ₘ 𝟙 Z) ≫ (α_ W (X ⊗ Y) Z).hom := by
simp
@[reassoc]
theorem pentagon_inv_hom (W X Y Z : C) :
(α_ (W ⊗ X) Y Z).inv ≫ ((α_ W X Y).hom ⊗ₘ 𝟙 Z) =
(α_ W X (Y ⊗ Z)).hom ≫ (𝟙 W ⊗ₘ (α_ X Y Z).inv) ≫ (α_ W (X ⊗ Y) Z).inv := by
simp
end CategoryTheory.MonoidalCategory |
.lake/packages/mathlib/Mathlib/CategoryTheory/Monoidal/DayConvolution.lean | import Mathlib.CategoryTheory.Monoidal.ExternalProduct.KanExtension
import Mathlib.CategoryTheory.Products.Associator
/-!
# Day convolution monoidal structure
Given functors `F G : C ⥤ V` between two monoidal categories,
this file defines a typeclass `DayConvolution` on functors `F` `G` that contains
a functor `F ⊛ G`, as well as the required data to exhibit `F ⊛ G` as a pointwise
left Kan extension of `F ⊠ G` (see `Mathlib/CategoryTheory/Monoidal/ExternalProduct/Basic.lean`
for the definition) along the tensor product of `C`.
Such a functor is called a Day convolution of `F` and `G`, and
although we do not show it yet, this operation defines a monoidal structure on `C ⥤ V`.
We also define a typeclass `DayConvolutionUnit` on a functor `U : C ⥤ V` that bundle the data
required to make it a unit for the Day convolution monoidal structure: said data is that of
a map `𝟙_ V ⟶ U.obj (𝟙_ C)` that exhibits `U` as a pointwise left Kan extension of
`fromPUnit (𝟙_ V)` along `fromPUnit (𝟙_ C)`.
The main way to assert that a given monoidal category structure on a category `D`
arises as a "Day convolution monoidal structure" is given by the typeclass
`LawfulDayConvolutionMonoidalCategoryStruct C V D`, which bundles the data and
equations needed to exhibit `D` as a monoidal full subcategory of `C ⥤ V` if
the latter were to have the Day convolution monoidal structure. The definition
`monoidalOfLawfulDayConvolutionMonoidalCategoryStruct` promotes (under suitable
assumptions on `V`) a `LawfulDayConvolutionMonoidalCategoryStruct C V D` to
a monoidal structure.
## References
- [nLab page: Day convolution](https://ncatlab.org/nlab/show/Day+convolution)
## TODOs (@robin-carlier)
- Type alias for `C ⥤ V` with a `LawfulDayConvolutionMonoidalCategoryStruct`.
- Characterization of lax monoidal functors out of a Day convolution monoidal category.
- Case `V = Type u` and its universal property.
-/
universe v₁ v₂ v₃ v₄ v₅ u₁ u₂ u₃ u₄ u₅
namespace CategoryTheory.MonoidalCategory
open scoped ExternalProduct
noncomputable section
variable {C : Type u₁} [Category.{v₁} C] {V : Type u₂} [Category.{v₂} V]
[MonoidalCategory C] [MonoidalCategory V]
/-- A `DayConvolution` structure on functors `F G : C ⥤ V` is the data of
a functor `F ⊛ G : C ⥤ V`, along with a unit `F ⊠ G ⟶ tensor C ⋙ F ⊛ G`
that exhibits this functor as a pointwise left Kan extension of `F ⊠ G` along
`tensor C`. This is a `class` used to prove various property of such extensions,
but registering global instances of this class is probably a bad idea. -/
class DayConvolution (F G : C ⥤ V) where
/-- The chosen convolution between the functors. Denoted `F ⊛ G`. -/
convolution : C ⥤ V
/-- The chosen convolution between the functors. -/
unit (F) (G) : F ⊠ G ⟶ tensor C ⋙ convolution
/-- The transformation `unit` exhibits `F ⊛ G` as a pointwise left Kan extension
of `F ⊠ G` along `tensor C`. -/
isPointwiseLeftKanExtensionUnit (F G) :
(Functor.LeftExtension.mk (convolution) unit).IsPointwiseLeftKanExtension
namespace DayConvolution
open scoped Prod
section
/-- A notation for the Day convolution of two functors. -/
scoped infixr:80 " ⊛ " => convolution
variable (F G : C ⥤ V)
instance leftKanExtension [DayConvolution F G] :
(F ⊛ G).IsLeftKanExtension (unit F G) :=
isPointwiseLeftKanExtensionUnit F G |>.isLeftKanExtension
variable {F G}
/-- Two Day convolution structures on the same functors gives an isomorphic functor. -/
def uniqueUpToIso (h : DayConvolution F G) (h' : DayConvolution F G) :
h.convolution ≅ h'.convolution :=
Functor.leftKanExtensionUnique h.convolution h.unit h'.convolution h'.unit
@[reassoc (attr := simp)]
lemma unit_uniqueUpToIso_hom (h : DayConvolution F G) (h' : DayConvolution F G) :
h.unit ≫ Functor.whiskerLeft (tensor C) (h.uniqueUpToIso h').hom = h'.unit := by
simp [uniqueUpToIso]
@[reassoc (attr := simp)]
lemma unit_uniqueUpToIso_inv (h : DayConvolution F G) (h' : DayConvolution F G) :
h'.unit ≫ Functor.whiskerLeft (tensor C) (h.uniqueUpToIso h').inv = h.unit := by
simp [uniqueUpToIso]
variable (F G) [DayConvolution F G]
section unit
variable {x x' y y' : C}
@[reassoc (attr := simp)]
lemma unit_naturality (f : x ⟶ x') (g : y ⟶ y') :
(F.map f ⊗ₘ G.map g) ≫ (unit F G).app (x', y') =
(unit F G).app (x, y) ≫ (F ⊛ G).map (f ⊗ₘ g) := by
simpa [tensorHom_def] using (unit F G).naturality (f ×ₘ g)
variable (y) in
@[reassoc (attr := simp)]
lemma whiskerRight_comp_unit_app (f : x ⟶ x') :
F.map f ▷ G.obj y ≫ (unit F G).app (x', y) =
(unit F G).app (x, y) ≫ (F ⊛ G).map (f ▷ y) := by
simpa [tensorHom_def] using (unit F G).naturality (f ×ₘ 𝟙 _)
variable (x) in
@[reassoc (attr := simp)]
lemma whiskerLeft_comp_unit_app (g : y ⟶ y') :
F.obj x ◁ G.map g ≫ (unit F G).app (x, y') =
(unit F G).app (x, y) ≫ (F ⊛ G).map (x ◁ g) := by
simpa [tensorHom_def] using (unit F G).naturality (𝟙 _ ×ₘ g)
end unit
variable {F G}
section map
variable {F' G' : C ⥤ V} [DayConvolution F' G']
/-- The morphism between Day convolutions (provided they exist) induced by a pair of morphisms. -/
def map (f : F ⟶ F') (g : G ⟶ G') : F ⊛ G ⟶ F' ⊛ G' :=
Functor.descOfIsLeftKanExtension (F ⊛ G) (unit F G) (F' ⊛ G') <|
(externalProductBifunctor C C V).map (f ×ₘ g) ≫ unit F' G'
variable (f : F ⟶ F') (g : G ⟶ G') (x y : C)
@[reassoc (attr := simp)]
lemma unit_app_map_app :
(unit F G).app (x, y) ≫ (map f g).app (x ⊗ y : C) =
(f.app x ⊗ₘ g.app y) ≫ (unit F' G').app (x, y) := by
simpa [tensorHom_def] using
(Functor.descOfIsLeftKanExtension_fac_app (F ⊛ G) (unit F G) (F' ⊛ G') <|
(externalProductBifunctor C C V).map (f ×ₘ g) ≫ unit F' G') (x, y)
end map
variable (F G)
/-- The universal property of left Kan extensions characterizes the functor
corepresented by `F ⊛ G`. -/
@[simps!]
def corepresentableBy :
(Functor.whiskeringLeft _ _ _).obj (tensor C) ⋙ coyoneda.obj (.op <| F ⊠ G) |>.CorepresentableBy
(F ⊛ G) where
homEquiv := Functor.homEquivOfIsLeftKanExtension _ (unit F G) _
homEquiv_comp := by aesop
/-- Use the fact that `(F ⊛ G).obj c` is a colimit to characterize morphisms out of it at a
point. -/
theorem convolution_hom_ext_at (c : C) {v : V} {f g : (F ⊛ G).obj c ⟶ v}
(h : ∀ {x y : C} (u : x ⊗ y ⟶ c),
(unit F G).app (x, y) ≫ (F ⊛ G).map u ≫ f = (unit F G).app (x, y) ≫ (F ⊛ G).map u ≫ g) :
f = g :=
((isPointwiseLeftKanExtensionUnit F G) c).hom_ext (fun j ↦ by simpa using h j.hom)
section associator
open Functor
variable (H : C ⥤ V) [DayConvolution G H] [DayConvolution F (G ⊛ H)] [DayConvolution (F ⊛ G) H]
[∀ (v : V) (d : C), Limits.PreservesColimitsOfShape
(CostructuredArrow (tensor C) d) (tensorLeft v)]
[∀ (v : V) (d : C), Limits.PreservesColimitsOfShape
(CostructuredArrow (tensor C) d) (tensorRight v)]
open MonoidalCategory.ExternalProduct
instance : (F ⊠ G ⊛ H).IsLeftKanExtension <|
extensionUnitRight (G ⊛ H) (unit G H) F :=
(isPointwiseLeftKanExtensionExtensionUnitRight _ _ _ <|
isPointwiseLeftKanExtensionUnit G H).isLeftKanExtension
instance : ((F ⊛ G) ⊠ H).IsLeftKanExtension <|
extensionUnitLeft (F ⊛ G) (unit F G) H :=
(isPointwiseLeftKanExtensionExtensionUnitLeft _ _ _ <|
isPointwiseLeftKanExtensionUnit F G).isLeftKanExtension
/-- The `CorepresentableBy` structure asserting that the Type-valued functor
`Y ↦ (F ⊠ G ⊠ H ⟶ (𝟭 C).prod (tensor C) ⋙ tensor C ⋙ Y)` is corepresented by
`F ⊛ G ⊛ H`. -/
@[simps]
def corepresentableBy₂ :
(whiskeringLeft _ _ _).obj (tensor C) ⋙
(whiskeringLeft _ _ _).obj ((𝟭 C).prod (tensor C)) ⋙
coyoneda.obj (.op <| F ⊠ G ⊠ H) |>.CorepresentableBy (F ⊛ G ⊛ H) where
homEquiv :=
(corepresentableBy F (G ⊛ H)).homEquiv.trans <|
Functor.homEquivOfIsLeftKanExtension _ (extensionUnitRight (G ⊛ H) (unit G H) F) _
homEquiv_comp := by aesop
/-- The `CorepresentableBy` structure asserting that the Type-valued functor
`Y ↦ ((F ⊠ G) ⊠ H ⟶ (tensor C).prod (𝟭 C) ⋙ tensor C ⋙ Y)` is corepresented by
`(F ⊛ G) ⊛ H`. -/
@[simps]
def corepresentableBy₂' :
(whiskeringLeft _ _ _).obj (tensor C) ⋙
(whiskeringLeft _ _ _).obj ((tensor C).prod (𝟭 C)) ⋙
coyoneda.obj (.op <| (F ⊠ G) ⊠ H) |>.CorepresentableBy ((F ⊛ G) ⊛ H) where
homEquiv :=
(corepresentableBy (F ⊛ G) H).homEquiv.trans <|
Functor.homEquivOfIsLeftKanExtension _ (extensionUnitLeft (F ⊛ G) (unit F G) H) _
homEquiv_comp := by aesop
/-- The isomorphism of functors between
`((F ⊠ G) ⊠ H ⟶ (tensor C).prod (𝟭 C) ⋙ tensor C ⋙ -)` and
`(F ⊠ G ⊠ H ⟶ (𝟭 C).prod (tensor C) ⋙ tensor C ⋙ -)` that corresponds to the associator
isomorphism for Day convolution through `corepresentableBy₂` and `corepresentableBy₂`. -/
@[simps!]
def associatorCorepresentingIso :
(whiskeringLeft _ _ _).obj (tensor C) ⋙
(whiskeringLeft _ _ _).obj ((tensor C).prod (𝟭 C)) ⋙
coyoneda.obj (.op <| (F ⊠ G) ⊠ H) ≅
(whiskeringLeft _ _ _).obj (tensor C) ⋙
(whiskeringLeft _ _ _).obj ((𝟭 C).prod (tensor C)) ⋙
coyoneda.obj (.op <| F ⊠ G ⊠ H) :=
calc
_ ≅ (whiskeringLeft _ _ _).obj (tensor C) ⋙
(whiskeringLeft _ _ _).obj ((tensor C).prod (𝟭 C)) ⋙
(whiskeringLeft _ _ _).obj (prod.associativity C C C).inverse ⋙
coyoneda.obj (.op <| (prod.associativity C C C).inverse ⋙ (F ⊠ G) ⊠ H) :=
isoWhiskerLeft _ (isoWhiskerLeft _
(NatIso.ofComponents fun _ ↦ Equiv.toIso <|
(prod.associativity C C C).congrLeft.fullyFaithfulFunctor.homEquiv))
_ ≅ (whiskeringLeft _ _ _).obj
((prod.associativity C C C).inverse ⋙ (tensor C).prod (𝟭 C) ⋙ tensor C) ⋙
coyoneda.obj (.op <| (prod.associativity C C C).inverse ⋙ (F ⊠ G) ⊠ H) :=
.refl _
_ ≅ (whiskeringLeft _ _ _).obj ((𝟭 C).prod (tensor C) ⋙ tensor C) ⋙
coyoneda.obj (.op <| (prod.associativity C C C).inverse ⋙ (F ⊠ G) ⊠ H) :=
isoWhiskerRight ((whiskeringLeft _ _ _).mapIso <| NatIso.ofComponents (fun _ ↦ α_ _ _ _)) _
_ ≅ (whiskeringLeft _ _ _).obj ((𝟭 C).prod (tensor C) ⋙ tensor C) ⋙
coyoneda.obj (.op <| F ⊠ G ⊠ H) :=
isoWhiskerLeft _ <|
coyoneda.mapIso <| Iso.op <| NatIso.ofComponents (fun _ ↦ α_ _ _ _ |>.symm)
/-- The associator isomorphism for Day convolution -/
def associator : (F ⊛ G) ⊛ H ≅ F ⊛ G ⊛ H :=
corepresentableBy₂' F G H |>.ofIso (associatorCorepresentingIso F G H) |>.uniqueUpToIso <|
corepresentableBy₂ F G H
/-- Characterizing the forward direction of the associator isomorphism
with respect to the unit transformations. -/
@[reassoc (attr := simp)]
lemma associator_hom_unit_unit (x y z : C) :
(unit F G).app (x, y) ▷ (H.obj z) ≫
(unit (F ⊛ G) H).app (x ⊗ y, z) ≫
(associator F G H).hom.app ((x ⊗ y) ⊗ z) =
(α_ _ _ _).hom ≫
(F.obj x ◁ (unit G H).app (y, z)) ≫
(unit F (G ⊛ H)).app (x, y ⊗ z) ≫
(F ⊛ G ⊛ H).map (α_ _ _ _).inv := by
have := congrArg (fun t ↦ t.app ((x, y), z)) <|
(corepresentableBy₂' F G H).homEquiv.rightInverse_symm <|
(corepresentableBy₂ F G H |>.ofIso
(associatorCorepresentingIso F G H).symm |>.homEquiv (𝟙 _))
dsimp [associator, Coyoneda.fullyFaithful, corepresentableBy₂,
corepresentableBy₂', Functor.CorepresentableBy.ofIso, corepresentableBy₂,
Functor.corepresentableByEquiv, associatorCorepresentingIso] at this ⊢
simp only [whiskerLeft_id, Category.comp_id, Category.assoc] at this
simp only [Category.assoc, this]
simp [Functor.FullyFaithful.homEquiv, Equivalence.fullyFaithfulFunctor, prod.associativity]
/-- Characterizing the inverse direction of the associator
with respect to the unit transformations -/
@[reassoc (attr := simp)]
lemma associator_inv_unit_unit (x y z : C) :
F.obj x ◁ (unit G H).app (y, z) ≫
(unit F (G ⊛ H)).app (x, y ⊗ z) ≫
(associator F G H).inv.app (x ⊗ y ⊗ z) =
(α_ (F.obj x) (G.obj y) (H.obj z)).inv ≫ (unit F G).app (x, y) ▷ H.obj z ≫
(unit (F ⊛ G) H).app (x ⊗ y, z) ≫
((F ⊛ G) ⊛ H).map (α_ x y z).hom := by
have := congrArg (fun t ↦ t.app (x, y, z)) <|
(corepresentableBy₂ F G H).homEquiv.rightInverse_symm <|
(corepresentableBy₂' F G H |>.ofIso
(associatorCorepresentingIso F G H) |>.homEquiv (𝟙 _))
dsimp [associator, Coyoneda.fullyFaithful, corepresentableBy₂,
corepresentableBy₂', Functor.CorepresentableBy.ofIso, corepresentableBy₂,
Functor.corepresentableByEquiv, associatorCorepresentingIso] at this ⊢
simp only [whiskerRight_tensor, id_whiskerRight, Category.id_comp, Iso.inv_hom_id] at this
simp only [this]
simp [Functor.FullyFaithful.homEquiv, Equivalence.fullyFaithfulFunctor, prod.associativity]
variable {F G H} in
theorem associator_naturality {F' G' H' : C ⥤ V}
[DayConvolution F' G'] [DayConvolution G' H']
[DayConvolution F' (G' ⊛ H')] [DayConvolution (F' ⊛ G') H']
(f : F ⟶ F') (g : G ⟶ G') (h : H ⟶ H') :
map (map f g) h ≫
(associator F' G' H').hom =
(associator F G H).hom ≫ map f (map g h) := by
apply (corepresentableBy₂' F G H) |>.homEquiv.injective
dsimp
ext
simp only [externalProductBifunctor_obj_obj, Functor.comp_obj, Functor.prod_obj, tensor_obj,
Functor.id_obj, Functor.homEquivOfIsLeftKanExtension_apply_app,
externalProductBifunctor_map_app, Functor.leftUnitor_inv_app, whiskerLeft_id, Category.comp_id,
corepresentableBy_homEquiv_apply_app, NatTrans.comp_app, unit_app_map_app_assoc]
rw [associator_hom_unit_unit_assoc]
simp only [tensorHom_def, Category.assoc, externalProductBifunctor_obj_obj, tensor_obj,
NatTrans.naturality, unit_app_map_app_assoc]
rw [← comp_whiskerRight_assoc, unit_app_map_app]
simp only [Functor.comp_obj, tensor_obj, comp_whiskerRight, Category.assoc]
rw [← whisker_exchange_assoc, associator_hom_unit_unit, whisker_exchange_assoc,
← MonoidalCategory.whiskerLeft_comp_assoc, unit_app_map_app]
simp [tensorHom_def]
section pentagon
variable [∀ (v : V) (d : C × C),
Limits.PreservesColimitsOfShape (CostructuredArrow ((tensor C).prod (𝟭 C)) d) (tensorRight v)]
lemma pentagon (H K : C ⥤ V)
[DayConvolution G H] [DayConvolution (F ⊛ G) H] [DayConvolution F (G ⊛ H)]
[DayConvolution H K] [DayConvolution G (H ⊛ K)] [DayConvolution (G ⊛ H) K]
[DayConvolution ((F ⊛ G) ⊛ H) K] [DayConvolution (F ⊛ G) (H ⊛ K)]
[DayConvolution (F ⊛ G ⊛ H) K] [DayConvolution F (G ⊛ H ⊛ K)]
[DayConvolution F ((G ⊛ H) ⊛ K)] :
map (associator F G H).hom (𝟙 K) ≫
(associator F (G ⊛ H) K).hom ≫ map (𝟙 F) (associator G H K).hom =
(associator (F ⊛ G) H K).hom ≫ (associator F G (H ⊛ K)).hom := by
-- We repeatedly apply the fact that the functors are left Kan extensions
apply Functor.hom_ext_of_isLeftKanExtension (α := unit ((F ⊛ G) ⊛ H) K)
apply Functor.hom_ext_of_isLeftKanExtension
(α := extensionUnitLeft ((F ⊛ G) ⊛ H) (unit (F ⊛ G) H) K)
have : (((F ⊛ G) ⊠ H) ⊠ K).IsLeftKanExtension
(α := extensionUnitLeft ((F ⊛ G) ⊠ H)
(extensionUnitLeft _ (unit F G) H) K) :=
isPointwiseLeftKanExtensionExtensionUnitLeft _ _ _
(isPointwiseLeftKanExtensionExtensionUnitLeft _ _ _
(isPointwiseLeftKanExtensionUnit F G)) |>.isLeftKanExtension
apply Functor.hom_ext_of_isLeftKanExtension (α := extensionUnitLeft ((F ⊛ G) ⊠ H)
(extensionUnitLeft _ (unit F G) H) K)
-- And then we compute...
ext ⟨⟨⟨i, j⟩, k⟩, l⟩
have aux :
((unit F G).app (i, j) ⊗ₘ (unit H K).app (k, l)) ≫
(unit (F ⊛ G) (H ⊛ K)).app ((i ⊗ j), (k ⊗ l)) =
(α_ (F.obj i) (G.obj j) (H.obj k ⊗ K.obj l)).hom ≫
F.obj i ◁ G.obj j ◁ (unit H K).app (k, l) ≫ F.obj i ◁ (unit G (H ⊛ K)).app (j, (k ⊗ l)) ≫
(unit F (G ⊛ H ⊛ K)).app (i, (j ⊗ k ⊗ l)) ≫ (F ⊛ G ⊛ H ⊛ K).map (α_ i j (k ⊗ l)).inv ≫
(associator F G (H ⊛ K)).inv.app ((i ⊗ j) ⊗ k ⊗ l) := by
conv_rhs => simp only [Functor.comp_obj, tensor_obj, NatTrans.naturality,
associator_inv_unit_unit_assoc, externalProductBifunctor_obj_obj, Iso.map_hom_inv_id,
Category.comp_id]
simp only [tensor_whiskerLeft_symm, Category.assoc, Iso.hom_inv_id_assoc,
← tensorHom_def'_assoc]
dsimp
simp only [MonoidalCategory.whiskerLeft_id, Category.comp_id, unit_app_map_app_assoc,
externalProductBifunctor_obj_obj, NatTrans.id_app, tensorHom_id, associator_hom_unit_unit_assoc,
tensor_obj, NatTrans.naturality]
conv_rhs =>
simp only [whiskerRight_tensor_symm_assoc, Iso.inv_hom_id_assoc, ← tensorHom_def_assoc]
rw [reassoc_of% aux]
simp only [Iso.inv_hom_id_app_assoc, ← comp_whiskerRight_assoc, associator_hom_unit_unit F G H]
simp only [Functor.comp_obj, tensor_obj, comp_whiskerRight, whisker_assoc, Category.assoc,
whiskerRight_comp_unit_app_assoc (F ⊛ G ⊛ H) K l (α_ i j k).inv,
NatTrans.naturality_assoc, NatTrans.naturality, associator_hom_unit_unit_assoc,
externalProductBifunctor_obj_obj, unit_app_map_app_assoc, NatTrans.id_app, id_tensorHom,
Iso.inv_hom_id_assoc, ← MonoidalCategory.whiskerLeft_comp_assoc, associator_hom_unit_unit]
simp [← Functor.map_comp, pentagon_inv, pentagon_assoc]
end pentagon
end associator
end
end DayConvolution
/-- A `DayConvolutionUnit` structure on a functor `C ⥤ V` is the data of a pointwise
left Kan extension of `fromPUnit (𝟙_ V)` along `fromPUnit (𝟙_ C)`. Again, this is
made a class to ease proofs when constructing `DayConvolutionMonoidalCategory` structures, but one
should avoid registering it globally. -/
class DayConvolutionUnit (F : C ⥤ V) where
/-- A "canonical" structure map `𝟙_ V ⟶ F.obj (𝟙_ C)` that defines a natural transformation
`fromPUnit (𝟙_ V) ⟶ fromPUnit (𝟙_ C) ⋙ F`. -/
can : 𝟙_ V ⟶ F.obj (𝟙_ C)
/-- The canonical map `𝟙_ V ⟶ F.obj (𝟙_ C)` exhibits `F` as a pointwise left kan extension
of `fromPUnit.{0} 𝟙_ V` along `fromPUnit.{0} 𝟙_ C`. -/
isPointwiseLeftKanExtensionCan : Functor.LeftExtension.mk F
({app _ := can} : Functor.fromPUnit.{0} (𝟙_ V) ⟶
Functor.fromPUnit.{0} (𝟙_ C) ⋙ F) |>.IsPointwiseLeftKanExtension
namespace DayConvolutionUnit
variable (U : C ⥤ V) [DayConvolutionUnit U]
open scoped DayConvolution
open ExternalProduct Functor
/-- A shorthand for the natural transformation of functors out of PUnit defined by
the canonical morphism `𝟙_ V ⟶ U.obj (𝟙_ C)` when `U` is a unit for Day convolution. -/
abbrev φ : Functor.fromPUnit.{0} (𝟙_ V) ⟶ Functor.fromPUnit.{0} (𝟙_ C) ⋙ U where
app _ := can
/-- Since a convolution unit is a pointwise left Kan extension, maps out of it at
any object are uniquely characterized. -/
lemma hom_ext {c : C} {v : V} {g h : U.obj c ⟶ v}
(e : ∀ f : 𝟙_ C ⟶ c, can ≫ U.map f ≫ g = can ≫ U.map f ≫ h) :
g = h := by
apply (isPointwiseLeftKanExtensionCan c).hom_ext
intro j
simpa using e j.hom
variable (F : C ⥤ V)
[∀ (v : V) (d : C), Limits.PreservesColimitsOfShape
(CostructuredArrow (Functor.fromPUnit.{0} (𝟙_ C)) d) (tensorLeft v)]
[∀ (v : V) (d : C), Limits.PreservesColimitsOfShape
(CostructuredArrow (Functor.fromPUnit.{0} (𝟙_ C)) d) (tensorRight v)]
instance : (F ⊠ U).IsLeftKanExtension <| extensionUnitRight U (φ U) F :=
isPointwiseLeftKanExtensionExtensionUnitRight
U (φ U) F isPointwiseLeftKanExtensionCan |>.isLeftKanExtension
instance : (U ⊠ F).IsLeftKanExtension <| extensionUnitLeft U (φ U) F :=
isPointwiseLeftKanExtensionExtensionUnitLeft
U (φ U) F isPointwiseLeftKanExtensionCan |>.isLeftKanExtension
/-- A `CorepresentableBy` structure that characterizes maps out of `U ⊛ F`
by leveraging the fact that `U ⊠ F` is a left Kan extension of `(fromPUnit 𝟙_ V) ⊠ F`. -/
@[simps]
def corepresentableByLeft [DayConvolution U F] :
(whiskeringLeft _ _ _).obj (tensor C) ⋙
(whiskeringLeft _ _ _).obj ((Functor.fromPUnit.{0} (𝟙_ C)).prod (𝟭 C)) ⋙
coyoneda.obj (.op <| Functor.fromPUnit.{0} (𝟙_ V) ⊠ F) |>.CorepresentableBy (U ⊛ F) where
homEquiv :=
Functor.homEquivOfIsLeftKanExtension _ (DayConvolution.unit U F) _ |>.trans <|
Functor.homEquivOfIsLeftKanExtension _ (extensionUnitLeft U (φ U) F) _
homEquiv_comp := by aesop
/-- A `CorepresentableBy` structure that characterizes maps out of `F ⊛ U` by
leveraging the fact that `F ⊠ U` is a left Kan extension of `F ⊠ (fromPUnit 𝟙_ V)`. -/
@[simps]
def corepresentableByRight [DayConvolution F U] :
(whiskeringLeft _ _ _).obj (tensor C) ⋙
(whiskeringLeft _ _ _).obj ((𝟭 C).prod (Functor.fromPUnit.{0} (𝟙_ C))) ⋙
coyoneda.obj (.op <| F ⊠ Functor.fromPUnit.{0} (𝟙_ V)) |>.CorepresentableBy (F ⊛ U) where
homEquiv :=
Functor.homEquivOfIsLeftKanExtension _ (DayConvolution.unit F U) _ |>.trans <|
Functor.homEquivOfIsLeftKanExtension _ (extensionUnitRight U (φ U) F) _
homEquiv_comp := by aesop
/-- The isomorphism of corepresentable functors that defines the left unitor for
Day convolution. -/
@[simps!]
def leftUnitorCorepresentingIso :
(whiskeringLeft _ _ _).obj (tensor C) ⋙
(whiskeringLeft _ _ _).obj ((Functor.fromPUnit.{0} (𝟙_ C)).prod (𝟭 C)) ⋙
coyoneda.obj (.op <| Functor.fromPUnit.{0} (𝟙_ V) ⊠ F) ≅
coyoneda.obj (.op <| F) := by
calc
_ ≅ (whiskeringLeft _ _ _).obj (tensor C) ⋙
(whiskeringLeft _ _ _).obj ((Functor.fromPUnit.{0} (𝟙_ C)).prod (𝟭 C)) ⋙
(whiskeringLeft _ _ _).obj (prod.leftUnitorEquivalence C).inverse ⋙
coyoneda.obj (.op <|
(prod.leftUnitorEquivalence C).inverse ⋙ Functor.fromPUnit.{0} (𝟙_ V) ⊠ F) :=
isoWhiskerLeft _ (isoWhiskerLeft _
(NatIso.ofComponents fun _ ↦ Equiv.toIso <|
(prod.leftUnitorEquivalence C).congrLeft.fullyFaithfulFunctor.homEquiv))
_ ≅ (whiskeringLeft _ _ _).obj
((prod.leftUnitorEquivalence C).inverse ⋙ (Functor.fromPUnit.{0} (𝟙_ C)).prod (𝟭 C) ⋙
tensor C) ⋙
coyoneda.obj (.op <|
(prod.leftUnitorEquivalence C).inverse ⋙ Functor.fromPUnit.{0} (𝟙_ V) ⊠ F) :=
.refl _
_ ≅ (whiskeringLeft _ _ _).obj (𝟭 _) ⋙ coyoneda.obj (.op <|
(prod.leftUnitorEquivalence C).inverse ⋙ Functor.fromPUnit.{0} (𝟙_ V) ⊠ F) :=
isoWhiskerRight ((whiskeringLeft _ _ _).mapIso <| NatIso.ofComponents fun _ ↦ λ_ _) _
_ ≅ _ := coyoneda.mapIso <| Iso.op <| NatIso.ofComponents fun _ ↦ (λ_ _).symm
/-- The isomorphism of corepresentable functors that defines the right unitor for
Day convolution. -/
@[simps!]
def rightUnitorCorepresentingIso :
(whiskeringLeft _ _ _).obj (tensor C) ⋙
(whiskeringLeft _ _ _).obj ((𝟭 C).prod (Functor.fromPUnit.{0} (𝟙_ C))) ⋙
coyoneda.obj (.op <| F ⊠ Functor.fromPUnit.{0} (𝟙_ V)) ≅
coyoneda.obj (.op <| F) := by
calc
_ ≅ (whiskeringLeft _ _ _).obj (tensor C) ⋙
(whiskeringLeft _ _ _).obj ((𝟭 C).prod (Functor.fromPUnit.{0} (𝟙_ C))) ⋙
(whiskeringLeft _ _ _).obj (prod.rightUnitorEquivalence C).inverse ⋙
coyoneda.obj (.op <|
(prod.rightUnitorEquivalence C).inverse ⋙ F ⊠ Functor.fromPUnit.{0} (𝟙_ V)) :=
isoWhiskerLeft _ (isoWhiskerLeft _
(NatIso.ofComponents fun _ ↦ Equiv.toIso <|
(prod.rightUnitorEquivalence C).congrLeft.fullyFaithfulFunctor.homEquiv))
_ ≅ (whiskeringLeft _ _ _).obj
((prod.rightUnitorEquivalence C).inverse ⋙
((𝟭 C).prod (Functor.fromPUnit.{0} (𝟙_ C))) ⋙ tensor C) ⋙
coyoneda.obj (.op <|
(prod.rightUnitorEquivalence C).inverse ⋙ F ⊠ Functor.fromPUnit.{0} (𝟙_ V)) :=
.refl _
_ ≅ (whiskeringLeft _ _ _).obj (𝟭 _) ⋙ coyoneda.obj (.op <|
(prod.rightUnitorEquivalence C).inverse ⋙ F ⊠ Functor.fromPUnit.{0} (𝟙_ V)) :=
isoWhiskerRight ((whiskeringLeft _ _ _).mapIso <| NatIso.ofComponents fun _ ↦ ρ_ _) _
_ ≅ _ := coyoneda.mapIso <| Iso.op <| NatIso.ofComponents fun _ ↦ (ρ_ _).symm
/-- The left unitor isomorphism for Day convolution. -/
def leftUnitor [DayConvolution U F] : U ⊛ F ≅ F :=
corepresentableByLeft U F |>.ofIso (leftUnitorCorepresentingIso F) |>.uniqueUpToIso
<| Functor.corepresentableByEquiv.symm (.refl _)
/-- The right unitor isomorphism for Day convolution. -/
def rightUnitor [DayConvolution F U] : F ⊛ U ≅ F :=
corepresentableByRight U F |>.ofIso (rightUnitorCorepresentingIso F) |>.uniqueUpToIso
<| Functor.corepresentableByEquiv.symm (.refl _)
section
omit [∀ (v : V) (d : C), Limits.PreservesColimitsOfShape
(CostructuredArrow (Functor.fromPUnit.{0} (𝟙_ C)) d) (tensorLeft v)]
variable [DayConvolution U F]
/-- Characterizing the forward direction of `leftUnitor` via the universal maps. -/
@[reassoc (attr := simp)]
lemma leftUnitor_hom_unit_app (y : C) :
can ▷ F.obj y ≫ (DayConvolution.unit U F).app (𝟙_ C, y) ≫
(leftUnitor U F).hom.app (𝟙_ C ⊗ y) =
(λ_ (F.obj y)).hom ≫ F.map (λ_ y).inv := by
have := congrArg (fun t ↦ t.app (.mk PUnit.unit, y)) <|
(corepresentableByLeft U F).homEquiv.rightInverse_symm <|
((leftUnitorCorepresentingIso F).symm.hom.app F) (𝟙 _)
dsimp [leftUnitor, Coyoneda.fullyFaithful, corepresentableByLeft,
leftUnitorCorepresentingIso, Functor.CorepresentableBy.ofIso,
Functor.corepresentableByEquiv] at this ⊢
simp only [whiskerLeft_id, Category.comp_id] at this
simp only [Category.comp_id, this]
simp [prod.leftUnitorEquivalence, Equivalence.congrLeft, Equivalence.fullyFaithfulFunctor,
Functor.FullyFaithful.homEquiv]
@[simp, reassoc]
lemma leftUnitor_inv_app (x : C) :
(leftUnitor U F).inv.app x =
(λ_ (F.obj x)).inv ≫ can ▷ F.obj x ≫ (DayConvolution.unit U F).app (𝟙_ C, x) ≫
(U ⊛ F).map (λ_ x).hom := by
dsimp [leftUnitor, Coyoneda.fullyFaithful, corepresentableByLeft,
leftUnitorCorepresentingIso, Functor.CorepresentableBy.ofIso,
Functor.corepresentableByEquiv]
simp [prod.leftUnitorEquivalence, Equivalence.congrLeft, Equivalence.fullyFaithfulFunctor,
Functor.FullyFaithful.homEquiv]
variable {F} in
@[reassoc (attr := simp)]
lemma leftUnitor_naturality {G : C ⥤ V} [DayConvolution U G] (f : F ⟶ G) :
DayConvolution.map (𝟙 _) f ≫ (leftUnitor U G).hom =
(leftUnitor U F).hom ≫ f := by
apply Functor.hom_ext_of_isLeftKanExtension _ (DayConvolution.unit _ _) _
apply Functor.hom_ext_of_isLeftKanExtension _ (extensionUnitLeft U (φ U) F) _
ext
simp [← whisker_exchange_assoc]
end
section
omit [∀ (v : V) (d : C), Limits.PreservesColimitsOfShape
(CostructuredArrow (Functor.fromPUnit.{0} (𝟙_ C)) d) (tensorRight v)]
variable [DayConvolution F U]
/-- Characterizing the forward direction of `rightUnitor` via the universal maps. -/
@[reassoc (attr := simp)]
lemma rightUnitor_hom_unit_app (x : C) :
F.obj x ◁ can ≫ (DayConvolution.unit F U).app (x, 𝟙_ C) ≫
(rightUnitor U F).hom.app (x ⊗ 𝟙_ C) =
(ρ_ _).hom ≫ F.map (ρ_ x).inv := by
have := congrArg (fun t ↦ t.app (x, .mk PUnit.unit)) <|
(corepresentableByRight U F).homEquiv.rightInverse_symm <|
((rightUnitorCorepresentingIso F).symm.hom.app F) (𝟙 _)
dsimp [rightUnitor, Coyoneda.fullyFaithful, corepresentableByRight,
rightUnitorCorepresentingIso, Functor.CorepresentableBy.ofIso,
Functor.corepresentableByEquiv] at this ⊢
simp only [MonoidalCategory.whiskerRight_id, Category.id_comp, Iso.hom_inv_id,
Category.comp_id] at this
simp only [Category.comp_id, this]
simp [prod.rightUnitorEquivalence, Equivalence.congrLeft, Equivalence.fullyFaithfulFunctor,
Functor.FullyFaithful.homEquiv]
@[simp, reassoc]
lemma rightUnitor_inv_app (x : C) :
(rightUnitor U F).inv.app x =
(ρ_ (F.obj x)).inv ≫ F.obj x ◁ can ≫ (DayConvolution.unit F U).app (x, 𝟙_ C) ≫
(F ⊛ U).map (ρ_ x).hom := by
dsimp [rightUnitor, Coyoneda.fullyFaithful, corepresentableByRight,
rightUnitorCorepresentingIso, Functor.CorepresentableBy.ofIso,
Functor.corepresentableByEquiv]
simp [prod.rightUnitorEquivalence, Equivalence.congrLeft, Equivalence.fullyFaithfulFunctor,
Functor.FullyFaithful.homEquiv]
variable {F} in
@[reassoc (attr := simp)]
lemma rightUnitor_naturality {G : C ⥤ V} [DayConvolution G U] (f : F ⟶ G) :
DayConvolution.map f (𝟙 _) ≫ (rightUnitor U G).hom =
(rightUnitor U F).hom ≫ f := by
apply Functor.hom_ext_of_isLeftKanExtension _ (DayConvolution.unit _ _) _
apply Functor.hom_ext_of_isLeftKanExtension _ (extensionUnitRight U (φ U) F) _
ext
simp [whisker_exchange_assoc]
end
end DayConvolutionUnit
section triangle
open DayConvolution
open DayConvolutionUnit
open ExternalProduct
variable [∀ (v : V) (d : C), Limits.PreservesColimitsOfShape
(CostructuredArrow (tensor C) d) (tensorLeft v)]
[∀ (v : V) (d : C), Limits.PreservesColimitsOfShape
(CostructuredArrow (tensor C) d) (tensorRight v)]
[∀ (v : V) (d : C), Limits.PreservesColimitsOfShape
(CostructuredArrow (Functor.fromPUnit.{0} <| 𝟙_ C) d) (tensorLeft v)]
[∀ (v : V) (d : C), Limits.PreservesColimitsOfShape
(CostructuredArrow (Functor.fromPUnit.{0} <| 𝟙_ C) d) (tensorRight v)]
[∀ (v : V) (d : C × C), Limits.PreservesColimitsOfShape
(CostructuredArrow ((𝟭 C).prod <| Functor.fromPUnit.{0} <| 𝟙_ C) d) (tensorRight v)]
lemma DayConvolution.triangle (F G U : C ⥤ V) [DayConvolutionUnit U]
[DayConvolution F U] [DayConvolution U G]
[DayConvolution F (U ⊛ G)] [DayConvolution (F ⊛ U) G] [DayConvolution F G] :
(DayConvolution.associator F U G).hom ≫
DayConvolution.map (𝟙 F) (DayConvolutionUnit.leftUnitor U G).hom =
DayConvolution.map (DayConvolutionUnit.rightUnitor U F).hom (𝟙 G) := by
apply Functor.hom_ext_of_isLeftKanExtension _ (DayConvolution.unit _ _) _
apply Functor.hom_ext_of_isLeftKanExtension
(α := extensionUnitLeft (F ⊛ U) (DayConvolution.unit F U) G)
have : (F ⊠ U) ⊠ G |>.IsLeftKanExtension
(α := extensionUnitLeft (F ⊠ U) (extensionUnitRight U (DayConvolutionUnit.φ U) F) G) :=
isPointwiseLeftKanExtensionExtensionUnitLeft (F ⊠ U) _ G
(isPointwiseLeftKanExtensionExtensionUnitRight U (DayConvolutionUnit.φ U) F <|
DayConvolutionUnit.isPointwiseLeftKanExtensionCan (F := U)) |>.isLeftKanExtension
apply Functor.hom_ext_of_isLeftKanExtension
(α := extensionUnitLeft (F ⊠ U) (extensionUnitRight U (DayConvolutionUnit.φ U) F) G)
ext
dsimp
simp only [MonoidalCategory.whiskerRight_id, Category.id_comp, Iso.hom_inv_id, whisker_assoc,
MonoidalCategory.whiskerLeft_id, Category.comp_id,
DayConvolution.associator_hom_unit_unit_assoc, externalProductBifunctor_obj_obj, tensor_obj,
NatTrans.naturality, unit_app_map_app_assoc, NatTrans.id_app, id_tensorHom,
Category.assoc, Iso.inv_hom_id_assoc, unit_app_map_app, Functor.comp_obj,
tensorHom_id, Iso.cancel_iso_hom_left]
simp only [← MonoidalCategory.whiskerLeft_comp_assoc, leftUnitor_hom_unit_app,
associator_inv_naturality_middle_assoc, ← comp_whiskerRight_assoc, rightUnitor_hom_unit_app]
simp [← Functor.map_comp]
end triangle
section
variable (C : Type u₁) [Category.{v₁} C] (V : Type u₂) [Category.{v₂} V]
[MonoidalCategory C] [MonoidalCategory V]
/-- The class `DayConvolutionMonoidalCategory C V D` bundles the necessary data to
turn a monoidal category `D` into a monoidal full subcategory of a category of
functors `C ⥤ V` endowed with a Day convolution monoidal structure.
The design of this class is to bundle a fully faithful functor into `C ⥤ V` with
left extensions on its values representing the fact that it maps tensors products
in `D` to Day convolutions, and furthermore ask that this data is "lawful", i.e that
once realized in the functor category, the objects behave like the corresponding ones
in the category `C ⥤ V`. -/
class LawfulDayConvolutionMonoidalCategoryStruct
(C : Type u₁) [Category.{v₁} C] (V : Type u₂) [Category.{v₂} V]
[MonoidalCategory C] [MonoidalCategory V]
(D : Type u₃) [Category.{v₃} D] [MonoidalCategoryStruct D] where
/-- a functor that interprets element of `D` as functors `C ⥤ V` -/
ι (C V D) : D ⥤ C ⥤ V
/-- a natural transformation `ι.obj d ⊠ ι.obj d' ⟶ tensor C ⋙ ι.obj (d ⊗ d')` -/
convolutionExtensionUnit (C) (V) (d d' : D) :
ι.obj d ⊠ ι.obj d' ⟶ tensor C ⋙ ι.obj (d ⊗ d')
/-- `convolutionUnitUnit` exhibits `ι.obj (d ⊗ d')` as a left Ken extension of
`ι.obj d ⊠ ι.obj d'` along `tensor C`. -/
isPointwiseLeftKanExtensionConvolutionExtensionUnit (d d' : D) :
(Functor.LeftExtension.mk _ <|
convolutionExtensionUnit d d').IsPointwiseLeftKanExtension
/-- a map `𝟙_ V ⟶ (ι.obj <| 𝟙_ D).obj (𝟙_ C)`, that we think of as defining a
natural transformation
`fromPUnit.{0} (𝟙_ V) ⟶ Functor.fromPUnit.{0} (𝟙_ C) ⋙ (ι.obj <| 𝟙_ D)`. -/
unitUnit (C) (V) (D) : 𝟙_ V ⟶ (ι.obj <| 𝟙_ D).obj (𝟙_ C)
/-- the natural transformation induced by `unitUnit` exhibits
`(ι.obj <| 𝟙_ D).obj (𝟙_ C)` as a left Kan extension of `fromPUnit.{0} (𝟙_ V)` as a
along `fromPUnit.{0} (𝟙_ C)`. -/
isPointwiseLeftKanExtensionUnitUnit (C) (V) (D) :
Functor.LeftExtension.mk _
({app _ := unitUnit} : Functor.fromPUnit.{0} (𝟙_ V) ⟶
Functor.fromPUnit.{0} (𝟙_ C) ⋙ (ι.obj <| 𝟙_ D))|>.IsPointwiseLeftKanExtension
/-- The field `ι` interprets an element of `D` as a functor `C ⥤ V`. -/
faithful_ι : ι.Faithful := by infer_instance
convolutionExtensionUnit_comp_ι_map_tensorHom_app (C) (V) {d₁ d₂ d₁' d₂' : D}
(f₁ : d₁ ⟶ d₁') (f₂ : d₂ ⟶ d₂') (x y : C) :
(convolutionExtensionUnit d₁ d₂).app (x, y) ≫
(ι.map (f₁ ⊗ₘ f₂)).app (x ⊗ y) =
((ι.map f₁).app x ⊗ₘ (ι.map f₂).app y) ≫
(convolutionExtensionUnit d₁' d₂').app (x, y)
convolutionExtensionUnit_comp_ι_map_whiskerLeft_app (V)
(d₁ : D) {d₂ d₂' : D}
(f₂ : d₂ ⟶ d₂') (x y : C) :
(convolutionExtensionUnit d₁ d₂).app (x, y) ≫
(ι.map (d₁ ◁ f₂)).app (x ⊗ y) =
((ι.obj d₁).obj x ◁ (ι.map f₂).app y) ≫
(convolutionExtensionUnit d₁ d₂').app (x, y)
convolutionExtensionUnit_comp_ι_map_whiskerRight_app (C) (V)
{d₁ d₁': D} (f₁ : d₁ ⟶ d₁') (d₂ : D) (x y : C) :
(convolutionExtensionUnit d₁ d₂).app (x, y) ≫
(ι.map (f₁ ▷ d₂)).app (x ⊗ y) =
((ι.map f₁).app x ▷ (ι.obj d₂).obj y) ≫
(convolutionExtensionUnit d₁' d₂).app (x, y)
associator_hom_unit_unit (V) (d d' d'': D) (x y z : C) :
(convolutionExtensionUnit d d').app (x, y) ▷ (ι.obj d'').obj z ≫
(convolutionExtensionUnit (d ⊗ d') d'').app (x ⊗ y, z) ≫
(ι.map (α_ d d' d'').hom).app ((x ⊗ y) ⊗ z) =
(α_ _ _ _).hom ≫
((ι.obj d).obj x ◁ (convolutionExtensionUnit d' d'').app (y, z)) ≫
(convolutionExtensionUnit d (d' ⊗ d'')).app (x, y ⊗ z) ≫
(ι.obj (d ⊗ d' ⊗ d'')).map (α_ _ _ _).inv
leftUnitor_hom_unit_app (V) (d : D) (y : C) :
unitUnit ▷ (ι.obj d).obj y ≫
(convolutionExtensionUnit (𝟙_ D) d).app
(𝟙_ C, y) ≫
(ι.map (λ_ d).hom).app (𝟙_ C ⊗ y) =
(λ_ ((ι.obj d).obj y)).hom ≫ (ι.obj d).map (λ_ y).inv
rightUnitor_hom_unit_app (V) (d : D) (y : C) :
(ι.obj d).obj y ◁ unitUnit ≫
(convolutionExtensionUnit d (𝟙_ D)).app (y, 𝟙_ C) ≫
(ι.map (ρ_ d).hom).app (y ⊗ 𝟙_ C) =
(ρ_ _).hom ≫ (ι.obj d).map (ρ_ y).inv
namespace LawfulDayConvolutionMonoidalCategoryStruct
attribute [instance] faithful_ι
variable (D : Type u₃) [Category.{v₃} D] [MonoidalCategoryStruct D]
[LawfulDayConvolutionMonoidalCategoryStruct C V D]
open scoped DayConvolution
/-- In a `LawfulDayConvolutionMonoidalCategoryStruct`, `ι.obj (d ⊗ d')` is a
Day convolution of `(ι C V).obj d` and `(ι C V).d'`. -/
def convolution (d d' : D) :
DayConvolution (ι C V D|>.obj d) (ι C V D|>.obj d') where
convolution := (ι C V D).obj (d ⊗ d')
unit := convolutionExtensionUnit C V d d'
isPointwiseLeftKanExtensionUnit :=
isPointwiseLeftKanExtensionConvolutionExtensionUnit d d'
attribute [local instance] convolution
/-- In a `LawfulDayConvolutionMonoidalCategoryStruct`, `ι.obj (d ⊗ d' ⊗ d'')`
is a (triple) Day convolution of `(ι C V).obj d`, `(ι C V).obj d'` and
`(ι C V).obj d''`. -/
def convolution₂ (d d' d'' : D) :
DayConvolution (ι C V D|>.obj d) ((ι C V D|>.obj d') ⊛ (ι C V D|>.obj d'')) :=
convolution C V D _ _
/-- In a `LawfulDayConvolutionMonoidalCategoryStruct`, `ι.obj ((d ⊗ d') ⊗ d'')`
is a (triple) Day convolution of `(ι C V).obj d`, `(ι C V).obj d'` and
`(ι C V).obj d''`. -/
def convolution₂' (d d' d'' : D) :
DayConvolution ((ι C V D|>.obj d) ⊛ (ι C V D|>.obj d')) (ι C V D|>.obj d'') :=
convolution C V D _ _
attribute [local instance] convolution₂ convolution₂'
lemma ι_map_tensorHom_hom_eq_tensorHom
{d₁ d₂ : D} {d₁' d₂' : D}
(f : d₁ ⟶ d₂) (f' : d₁' ⟶ d₂') :
(ι C V D).map (f ⊗ₘ f') =
DayConvolution.map (ι C V D|>.map f) (ι C V D|>.map f') := by
apply DayConvolution.corepresentableBy
(ι C V D|>.obj d₁) (ι C V D|>.obj d₁')|>.homEquiv.injective
dsimp
ext ⟨x, y⟩
simp only [externalProductBifunctor_obj_obj, Functor.comp_obj, tensor_obj,
DayConvolution.corepresentableBy_homEquiv_apply_app,
DayConvolution.unit_app_map_app]
exact convolutionExtensionUnit_comp_ι_map_tensorHom_app C V _ _ _ _
open DayConvolution in
lemma ι_map_associator_hom_eq_associator_hom (d d' d'')
[∀ (v : V) (d : C), Limits.PreservesColimitsOfShape
(CostructuredArrow (tensor C) d) (tensorLeft v)]
[∀ (v : V) (d : C), Limits.PreservesColimitsOfShape
(CostructuredArrow (tensor C) d) (tensorRight v)] :
(ι C V D).map (α_ d d' d'').hom =
(DayConvolution.associator
(ι C V D|>.obj d) (ι C V D|>.obj d') (ι C V D|>.obj d'')).hom := by
apply corepresentableBy₂'
(ι C V D|>.obj d) (ι C V D|>.obj d') (ι C V D|>.obj d'')|>.homEquiv.injective
dsimp
ext ⟨⟨x, y⟩, z⟩
simp only [externalProductBifunctor_obj_obj, Functor.comp_obj, Functor.prod_obj,
tensor_obj, Functor.id_obj, Functor.homEquivOfIsLeftKanExtension_apply_app,
externalProductBifunctor_map_app, Functor.leftUnitor_inv_app, whiskerLeft_id,
Category.comp_id, corepresentableBy_homEquiv_apply_app,
DayConvolution.associator_hom_unit_unit]
exact associator_hom_unit_unit V _ _ _ _ _ _
/-- In a `LawfulDayConvolutionMonoidalCategoryStruct`, `ι.obj (𝟙_ D)`
is a Day convolution unit. -/
def convolutionUnit : DayConvolutionUnit (ι C V D|>.obj <| 𝟙_ D) where
can := unitUnit _ _ _
isPointwiseLeftKanExtensionCan := isPointwiseLeftKanExtensionUnitUnit _ _ _
attribute [local instance] convolutionUnit
open DayConvolutionUnit in
lemma ι_map_leftUnitor_hom_eq_leftUnitor_hom (d : D)
[∀ (v : V) (d : C), Limits.PreservesColimitsOfShape
(CostructuredArrow (Functor.fromPUnit.{0} <| 𝟙_ C) d) (tensorRight v)] :
(ι C V D).map (λ_ d).hom =
(DayConvolutionUnit.leftUnitor
(ι C V D|>.obj <| 𝟙_ D) (ι C V D|>.obj d)).hom := by
apply corepresentableByLeft
(ι C V D|>.obj <| 𝟙_ D) (ι C V D|>.obj d)|>.homEquiv.injective
dsimp
ext ⟨_, x⟩
dsimp [corepresentableByLeft]
simp only [whiskerLeft_id, Category.comp_id,
DayConvolutionUnit.leftUnitor_hom_unit_app]
exact leftUnitor_hom_unit_app V d x
open DayConvolutionUnit in
lemma ι_map_rightUnitor_hom_eq_rightUnitor_hom (d : D)
[∀ (v : V) (d : C), Limits.PreservesColimitsOfShape
(CostructuredArrow (Functor.fromPUnit.{0} <| 𝟙_ C) d) (tensorLeft v)] :
(ι C V D).map (ρ_ d).hom =
(DayConvolutionUnit.rightUnitor
(ι C V D|>.obj <| 𝟙_ D) (ι C V D|>.obj d)).hom := by
apply corepresentableByRight
(ι C V D|>.obj <| 𝟙_ D) (ι C V D|>.obj d)|>.homEquiv.injective
dsimp
ext ⟨x, _⟩
dsimp [corepresentableByRight]
simp only [id_whiskerRight, Category.id_comp,
DayConvolutionUnit.rightUnitor_hom_unit_app]
exact rightUnitor_hom_unit_app V d x
end LawfulDayConvolutionMonoidalCategoryStruct
open LawfulDayConvolutionMonoidalCategoryStruct in
attribute [local instance] convolution convolution₂ convolution₂' convolutionUnit in
open DayConvolution DayConvolutionUnit in
/-- We can promote a `LawfulDayConvolutionMonoidalCategoryStruct` to a monoidal category,
note that every non-prop data is already here, so this is just about showing that they
satisfy the axioms of a monoidal category. -/
def monoidalOfLawfulDayConvolutionMonoidalCategoryStruct
(D : Type u₃) [Category.{v₃} D]
[MonoidalCategoryStruct D]
[LawfulDayConvolutionMonoidalCategoryStruct C V D]
[∀ (v : V) (d : C), Limits.PreservesColimitsOfShape
(CostructuredArrow (tensor C) d) (tensorLeft v)]
[∀ (v : V) (d : C), Limits.PreservesColimitsOfShape
(CostructuredArrow (tensor C) d) (tensorRight v)]
[∀ (v : V) (d : C), Limits.PreservesColimitsOfShape
(CostructuredArrow (Functor.fromPUnit.{0} <| 𝟙_ C) d) (tensorLeft v)]
[∀ (v : V) (d : C), Limits.PreservesColimitsOfShape
(CostructuredArrow (Functor.fromPUnit.{0} <| 𝟙_ C) d) (tensorRight v)]
[∀ (v : V) (d : C × C),
Limits.PreservesColimitsOfShape
(CostructuredArrow ((𝟭 C).prod <| Functor.fromPUnit.{0} <| 𝟙_ C) d)
(tensorRight v)]
[∀ (v : V) (d : C × C),
Limits.PreservesColimitsOfShape
(CostructuredArrow ((tensor C).prod (𝟭 C)) d) (tensorRight v)] :
MonoidalCategory D :=
MonoidalCategory.ofTensorHom
(id_tensorHom_id := fun x y => by
apply Functor.Faithful.map_injective (F := ι C V D)
simp only [ι_map_tensorHom_hom_eq_tensorHom, Functor.map_id]
apply (DayConvolution.corepresentableBy
(ι C V D|>.obj _) (ι C V D|>.obj _)).homEquiv.injective
dsimp
ext ⟨_, _⟩
simp only [externalProductBifunctor_obj_obj, Functor.comp_obj, tensor_obj,
corepresentableBy_homEquiv_apply_app, unit_app_map_app, NatTrans.id_app,
tensorHom_id, id_whiskerRight, Category.id_comp]
dsimp [DayConvolution.convolution]
simp)
(tensorHom_comp_tensorHom := fun _ _ _ _ => by
apply Functor.Faithful.map_injective (F := ι C V D)
simp only [ι_map_tensorHom_hom_eq_tensorHom, Functor.map_comp]
apply (corepresentableBy (ι C V D|>.obj _) (ι C V D|>.obj _)).homEquiv.injective
dsimp
ext ⟨_, _⟩
simp)
(id_tensorHom := fun x {y₁ y₂} f => by
apply Functor.Faithful.map_injective (F := ι C V D)
simp only [ι_map_tensorHom_hom_eq_tensorHom]
apply (corepresentableBy (ι C V D|>.obj _) (ι C V D|>.obj _)).homEquiv.injective
dsimp
ext ⟨x, y⟩
dsimp
simp only [Functor.map_id, unit_app_map_app, Functor.comp_obj, tensor_obj,
NatTrans.id_app, id_tensorHom]
dsimp [unit]
rw [convolutionExtensionUnit_comp_ι_map_whiskerLeft_app])
(tensorHom_id := fun x {y₁ y₂} f => by
apply Functor.Faithful.map_injective (F := ι C V D)
simp only [ι_map_tensorHom_hom_eq_tensorHom]
apply (corepresentableBy (ι C V D|>.obj _) (ι C V D|>.obj _)).homEquiv.injective
dsimp
ext ⟨x, y⟩
dsimp
simp only [Functor.map_id, DayConvolution.unit_app_map_app, Functor.comp_obj,
tensor_obj, NatTrans.id_app, tensorHom_id]
dsimp [DayConvolution.unit]
rw [convolutionExtensionUnit_comp_ι_map_whiskerRight_app])
(associator_naturality := fun f₁ f₂ f₃ => by
apply Functor.Faithful.map_injective (F := ι C V D)
simp only [Functor.map_comp, ι_map_associator_hom_eq_associator_hom,
ι_map_tensorHom_hom_eq_tensorHom]
exact DayConvolution.associator_naturality
((ι C V D).map f₁) ((ι C V D).map f₂) ((ι C V D).map f₃))
(leftUnitor_naturality := fun f => by
apply Functor.Faithful.map_injective (F := ι C V D)
simp only [Functor.map_comp, ι_map_tensorHom_hom_eq_tensorHom, Functor.map_id]
rw [ι_map_leftUnitor_hom_eq_leftUnitor_hom,
ι_map_leftUnitor_hom_eq_leftUnitor_hom]
exact DayConvolutionUnit.leftUnitor_naturality
(ι C V D|>.obj <| 𝟙_ D) (ι C V D|>.map f))
(rightUnitor_naturality := fun f => by
apply Functor.Faithful.map_injective (F := ι C V D)
simp only [Functor.map_comp, ι_map_tensorHom_hom_eq_tensorHom, Functor.map_id]
rw [ι_map_rightUnitor_hom_eq_rightUnitor_hom, ι_map_rightUnitor_hom_eq_rightUnitor_hom]
exact DayConvolutionUnit.rightUnitor_naturality
(ι C V D|>.obj <| 𝟙_ D) (ι C V D|>.map f))
(pentagon := fun a b c d => by
apply Functor.Faithful.map_injective (F := ι C V D)
simp only [Functor.map_comp, Functor.map_id, ι_map_tensorHom_hom_eq_tensorHom,
ι_map_associator_hom_eq_associator_hom]
-- this is a bit painful...
letI : DayConvolution
(((ι C V D|>.obj a) ⊛ (ι C V D|>.obj b)) ⊛ (ι C V D|>.obj c))
(ι C V D|>.obj d) :=
convolution C V D _ _
letI : DayConvolution
((ι C V D|>.obj a) ⊛ (ι C V D|>.obj b))
((ι C V D|>.obj c) ⊛ (ι C V D|>.obj d)) :=
convolution C V D _ _
letI : DayConvolution
((ι C V D|>.obj a) ⊛ ((ι C V D|>.obj b) ⊛ (ι C V D|>.obj c)))
(ι C V D|>.obj d) :=
convolution C V D _ _
letI : DayConvolution
(ι C V D|>.obj a)
((ι C V D|>.obj b) ⊛ ((ι C V D|>.obj c) ⊛ (ι C V D|>.obj d))) :=
convolution C V D _ _
letI : DayConvolution
(ι C V D|>.obj a)
(((ι C V D|>.obj b) ⊛ (ι C V D|>.obj c)) ⊛ (ι C V D|>.obj d)) :=
convolution C V D _ _
exact DayConvolution.pentagon
(ι C V D|>.obj a) (ι C V D|>.obj b) (ι C V D|>.obj c) (ι C V D|>.obj d))
(triangle := fun a b => by
apply Functor.Faithful.map_injective (F := ι C V D)
simp only [Functor.map_comp, Functor.map_id, ι_map_tensorHom_hom_eq_tensorHom,
ι_map_associator_hom_eq_associator_hom, ι_map_leftUnitor_hom_eq_leftUnitor_hom,
ι_map_rightUnitor_hom_eq_rightUnitor_hom]
exact DayConvolution.triangle
(ι C V D|>.obj a) (ι C V D|>.obj b) (ι C V D|>.obj <| 𝟙_ D))
/-! In what follows, we give a constructor for `LawfulDayConvolutionMonoidalCategoryStruct`
that does not assume a pre-existing `MonoidalCategoryStruct` and builds one from
the data of suitable convolutions, while giving definitional control over
as many parameters as we can. -/
/-- An `InducedLawfulDayConvolutionMonoidalCategoryStructCore C V D` bundles the
core data needed to construct a full `LawfulDayConvolutionMonoidalCategoryStructCore`.
We’re making this a class so that it can act as a "proxy" for inferring `DayConvolution`
instances (which is all the more important that we are modifying the instances given in the
constructor to get better ones defeq-wise). As this object is purely about the internals
of definitions of Day convolutions monoidal structures, it is advised to not register
this class globally. -/
class InducedLawfulDayConvolutionMonoidalCategoryStructCore
(C : Type u₁) [Category.{v₁} C] (V : Type u₂) [Category.{v₂} V]
[MonoidalCategory C] [MonoidalCategory V]
(D : Type u₃) [Category.{v₃} D] where
/-- A functor that interprets elements of `D` as functors `C ⥤ V`. -/
ι (C V D) : D ⥤ C ⥤ V
/-- The functor `ι` is fully faithful. -/
fullyFaithulι : ι.FullyFaithful
/-- Candidate function for the tensor product of objects. -/
tensorObj (C) (V) : D → D → D
/-- First candidate Day convolutions between objects.
Note that the name here is primed as in fact, we will use the other fields
in this class to produce convolutions with more controlled defeq properties. -/
convolutions' : ∀ (d d' : D), DayConvolution (ι.obj d) (ι.obj d')
/-- Isomorphisms that exhibits the essential image of `ι` as closed under day
convolution. -/
tensorObjIsoConvolution (C) (V) : ∀ (d d' : D),
ι.obj (tensorObj d d') ≅ (convolutions' d d').convolution
/-- Candidate component of units for the `LawfulDayConvolutionMonoidalCategoryStruct`,
this defaults to the ones deduced by `convolutions'` and `tensorObjIsoConvolution`. -/
convolutionUnitApp (V) :
∀ (d d' : D) (x y : C),
(ι.obj d).obj x ⊗ (ι.obj d').obj y ⟶ (ι.obj (tensorObj d d')).obj (x ⊗ y) :=
fun d d' x y =>
(convolutions' d d').unit.app (x, y) ≫
(tensorObjIsoConvolution d d').inv.app (x ⊗ y)
/-- Lawfulness of `convolutionUnitApp`. -/
convolutionUnitApp_eq (V) :
∀ (d d' : D) (x y : C),
convolutionUnitApp d d' x y =
(convolutions' d d').unit.app (x, y) ≫
(tensorObjIsoConvolution d d').inv.app (x ⊗ y) := by
cat_disch
/-- Candidate `tensorHom`. This defaults to the one that corresponds to
`DayConvolution.map` through `convolutions'`. -/
tensorHom :
∀ {d₁ d₂ : D} {d₁' d₂' : D},
(d₁ ⟶ d₂) → (d₁' ⟶ d₂') → (tensorObj d₁ d₁' ⟶ tensorObj d₂ d₂') :=
fun {d₁ d₂} {d₁' d₂' : D} f f' => fullyFaithulι.preimage <|
(tensorObjIsoConvolution d₁ d₁').hom ≫
(DayConvolution.map (ι.map f) (ι.map f')) ≫ (tensorObjIsoConvolution d₂ d₂').inv
/-- Lawfulness of `tensorHom`. -/
tensorHom_eq :
∀ {d₁ d₂ : D} {d₁' d₂' : D} (f : d₁ ⟶ d₂) (f' : d₁' ⟶ d₂'),
ι.map (tensorHom f f') = (tensorObjIsoConvolution d₁ d₁').hom ≫
(DayConvolution.map (ι.map f) (ι.map f')) ≫
(tensorObjIsoConvolution d₂ d₂').inv := by
cat_disch
/-- Candidate tensor unit. -/
tensorUnit (C) (V) (D) : D
/-- DayConvolutionUnit structure on the candidate. -/
tensorUnitConvolutionUnit : DayConvolutionUnit (ι.obj tensorUnit)
namespace InducedLawfulDayConvolutionMonoidalCategoryStructCore
attribute [local instance] tensorUnitConvolutionUnit
section
variable (D : Type u₃) [Category.{v₃} D]
[InducedLawfulDayConvolutionMonoidalCategoryStructCore C V D]
variable {D} in
/-- With the data of chosen isomorphic objects to given day convolutions,
and provably equal unit maps through these isomorphisms,
we can transform a given family of Day convolutions to one with
convolutions definitionally equals to the given objects, and component of units
definitionally equal to the provided map family. -/
def convolutions (d d' : D) :
DayConvolution ((ι C V D).obj d) ((ι C V D).obj d') where
convolution := (ι C V D).obj (tensorObj C V d d')
unit :=
{ app x := convolutionUnitApp V d d' x.1 x.2
naturality := by
intros
simp only [convolutionUnitApp_eq, Category.assoc, NatTrans.naturality_assoc]
simp }
isPointwiseLeftKanExtensionUnit :=
Functor.LeftExtension.isPointwiseLeftKanExtensionEquivOfIso
(StructuredArrow.isoMk
(tensorObjIsoConvolution C V d d').symm
(by
ext ⟨x, y⟩
simp [convolutionUnitApp_eq V d d' x y]))
(convolutions' d d'|>.isPointwiseLeftKanExtensionUnit)
attribute [local instance] convolutions
variable
[∀ (v : V) (d : C), Limits.PreservesColimitsOfShape
(CostructuredArrow (tensor C) d) (tensorLeft v)]
[∀ (v : V) (d : C), Limits.PreservesColimitsOfShape
(CostructuredArrow (tensor C) d) (tensorRight v)]
[∀ (v : V) (d : C), Limits.PreservesColimitsOfShape
(CostructuredArrow (Functor.fromPUnit.{0} <| 𝟙_ C) d) (tensorRight v)]
[∀ (v : V) (d : C), Limits.PreservesColimitsOfShape
(CostructuredArrow (Functor.fromPUnit.{0} <| 𝟙_ C) d) (tensorLeft v)]
open scoped DayConvolution
/-- Given a fully faithful functor `ι : C ⥤ V ⥤ D`,
a family of Day convolutions, candidate functions for `tensorObj` and `tensorHom`,
suitable isomorphisms
`ι.obj (tensorObj d d') ≅ ι.obj (tensorObj d) ⊛ ι.obj (tensorObj d')`
that behave in a lawful way with respect to the chosen Day convolutions, we can
construct a `MonoidalCategoryStruct` on `D`. -/
abbrev mkMonoidalCategoryStruct : MonoidalCategoryStruct D where
tensorObj := tensorObj C V
tensorHom := tensorHom
tensorUnit := tensorUnit C V D
whiskerLeft x {_ _} f := tensorHom (𝟙 x) f
whiskerRight f x := tensorHom f (𝟙 x)
associator x y z :=
-- To make this work we use the better instance `convolutions`
letI : DayConvolution (ι C V D|>.obj x) ((ι C V D|>.obj y) ⊛ (ι C V D|>.obj z)) :=
convolutions C V _ _
letI : DayConvolution ((ι C V D|>.obj x) ⊛ (ι C V D|>.obj y)) (ι C V D|>.obj z) :=
convolutions C V _ _
fullyFaithulι.preimageIso <|
DayConvolution.associator (ι C V D|>.obj x) (ι C V D|>.obj y) (ι C V D|>.obj z)
leftUnitor x :=
letI : DayConvolution (ι C V D|>.obj <| tensorUnit C V D) (ι C V D|>.obj x) :=
convolutions C V _ _
fullyFaithulι.preimageIso <|
DayConvolutionUnit.leftUnitor (ι C V D|>.obj <| tensorUnit C V D) (ι C V D|>.obj x)
rightUnitor x :=
letI : DayConvolution (ι C V D|>.obj x) (ι C V D|>.obj <| tensorUnit C V D) :=
convolutions C V _ _
fullyFaithulι.preimageIso <|
DayConvolutionUnit.rightUnitor (ι C V D|>.obj <| tensorUnit C V D) (ι C V D|>.obj x)
lemma id_tensorHom (x : D) {y y' : D} (f : y ⟶ y') :
letI := mkMonoidalCategoryStruct C V D
(𝟙 x) ⊗ₘ f = x ◁ f :=
rfl
lemma tensorHom_id {x x' : D} (f : x ⟶ x') (y : D) :
letI := mkMonoidalCategoryStruct C V D
f ⊗ₘ (𝟙 y) = f ▷ y :=
rfl
lemma ι_map_tensorHom_eq {d₁ d₁' d₂ d₂' : D} (f : d₁ ⟶ d₂) (f' : d₁' ⟶ d₂') :
letI := mkMonoidalCategoryStruct C V D
(ι C V D).map (f ⊗ₘ f') =
DayConvolution.map ((ι C V D).map f) ((ι C V D).map f') := by
dsimp [mkMonoidalCategoryStruct]
rw [tensorHom_eq]
apply (convolutions C V d₁ d₁').corepresentableBy.homEquiv.injective
dsimp
ext ⟨u₁, u₂⟩
dsimp
simp only [DayConvolution.unit_app_map_app, Functor.comp_obj, tensor_obj]
simp [convolutions, convolutionUnitApp_eq]
/-- The monoidal category struct constructed in `DayConvolution.mkMonoidalCategoryStruct` extends
to a `LawfulDayConvolutionMonoidalCategoryStruct`. -/
def mkLawfulDayConvolutionMonoidalCategoryStruct :
letI : MonoidalCategoryStruct D := mkMonoidalCategoryStruct C V D
LawfulDayConvolutionMonoidalCategoryStruct C V D :=
letI : MonoidalCategoryStruct D := mkMonoidalCategoryStruct C V D
{ ι := ι C V D
faithful_ι := fullyFaithulι.faithful
convolutionExtensionUnit d d' :=
(convolutions C V d d').unit
isPointwiseLeftKanExtensionConvolutionExtensionUnit d d' :=
(convolutions C V d d').isPointwiseLeftKanExtensionUnit
unitUnit := tensorUnitConvolutionUnit.can
isPointwiseLeftKanExtensionUnitUnit :=
tensorUnitConvolutionUnit.isPointwiseLeftKanExtensionCan
convolutionExtensionUnit_comp_ι_map_tensorHom_app := by
intros d₁ d₁' d₂ d₂' f f' x y
simp [ι_map_tensorHom_eq C V D f f']
convolutionExtensionUnit_comp_ι_map_whiskerLeft_app := by
intros d₁ d₂ d₂' f x y
simp [← id_tensorHom, ι_map_tensorHom_eq C V D]
convolutionExtensionUnit_comp_ι_map_whiskerRight_app := by
intros
simp [← tensorHom_id, ι_map_tensorHom_eq C V D]
associator_hom_unit_unit d₁ d₂ d₃ x₁ x₂ x₃ := by
simp only [externalProductBifunctor_obj_obj, Functor.comp_obj, tensor_obj, associator,
Functor.FullyFaithful.preimageIso_hom, Functor.FullyFaithful.map_preimage]
letI : DayConvolution (ι C V D|>.obj d₁) ((ι C V D|>.obj d₂) ⊛ (ι C V D|>.obj d₃)) :=
convolutions C V _ _
letI : DayConvolution ((ι C V D|>.obj d₁) ⊛ (ι C V D|>.obj d₂)) (ι C V D|>.obj d₃) :=
convolutions C V _ _
apply DayConvolution.associator_hom_unit_unit
leftUnitor_hom_unit_app _ _ := by
simp only [Functor.comp_obj, tensor_obj, leftUnitor,
Functor.FullyFaithful.preimageIso_hom, Functor.FullyFaithful.map_preimage]
apply DayConvolutionUnit.leftUnitor_hom_unit_app
rightUnitor_hom_unit_app _ _ := by
simp only [Functor.comp_obj, tensor_obj, rightUnitor,
Functor.FullyFaithful.preimageIso_hom, Functor.FullyFaithful.map_preimage]
apply DayConvolutionUnit.rightUnitor_hom_unit_app }
end
variable {C V} in
/-- Given a fully faithful functor `ι : D ⥤ C ⥤ V` and mere existence of Day convolutions of
`ι.obj d` and `ι.obj d'` such that the convolution remains in the essential image of `ι`,
construct an `InducedLawfulDayConvolutionMonoidalCategoryStructCore` by letting all other
data be the generic ones from the `HasPointwiseLeftKanExtension` API. -/
noncomputable def ofHasDayConvolutions
{D : Type u₃} [Category.{v₃} D]
(ι : D ⥤ C ⥤ V)
(ffι : ι.FullyFaithful)
[hasDayConvolution : ∀ (d d' : D),
(tensor C).HasPointwiseLeftKanExtension (ι.obj d ⊠ ι.obj d')]
(essImageDayConvolution : ∀ (d d' : D),
ι.essImage <| (tensor C).pointwiseLeftKanExtension (ι.obj d ⊠ ι.obj d'))
[hasDayConvolutionUnit :
(Functor.fromPUnit.{0} <| 𝟙_ C).HasPointwiseLeftKanExtension
(Functor.fromPUnit.{0} <| 𝟙_ V)]
(essImageDayConvolutionUnit :
ι.essImage <|
(Functor.fromPUnit.{0} <| 𝟙_ C).pointwiseLeftKanExtension
(Functor.fromPUnit.{0} <| 𝟙_ V)) :
InducedLawfulDayConvolutionMonoidalCategoryStructCore C V D where
ι := ι
fullyFaithulι := ffι
tensorObj := fun d d' ↦ essImageDayConvolution d d'|>.witness
convolutions' := fun d d' ↦
{ convolution := (tensor C).pointwiseLeftKanExtension (ι.obj d ⊠ ι.obj d')
unit := (tensor C).pointwiseLeftKanExtensionUnit (ι.obj d ⊠ ι.obj d')
isPointwiseLeftKanExtensionUnit :=
(tensor C).pointwiseLeftKanExtensionIsPointwiseLeftKanExtension (ι.obj d ⊠ ι.obj d') }
tensorObjIsoConvolution := fun d d' => Functor.essImage.getIso _
tensorUnit := essImageDayConvolutionUnit.witness
tensorUnitConvolutionUnit :=
{ can :=
((Functor.fromPUnit.{0} <| 𝟙_ C).pointwiseLeftKanExtensionUnit
(Functor.fromPUnit.{0} <| 𝟙_ V)).app (.mk PUnit.unit) ≫
(essImageDayConvolutionUnit.getIso.inv.app (𝟙_ C))
isPointwiseLeftKanExtensionCan :=
Functor.LeftExtension.isPointwiseLeftKanExtensionEquivOfIso
(StructuredArrow.isoMk
(essImageDayConvolutionUnit.getIso).symm)
(Functor.pointwiseLeftKanExtensionIsPointwiseLeftKanExtension
(Functor.fromPUnit.{0} <| 𝟙_ C)
(Functor.fromPUnit.{0} <| 𝟙_ V))}
end InducedLawfulDayConvolutionMonoidalCategoryStructCore
section
variable {C V}
{D : Type u₃} [Category.{v₃} D]
(ι : D ⥤ C ⥤ V)
(ffι : ι.FullyFaithful)
[hasDayConvolution : ∀ (d d' : D),
(tensor C).HasPointwiseLeftKanExtension (ι.obj d ⊠ ι.obj d')]
(essImageDayConvolution : ∀ (d d' : D),
ι.essImage <| (tensor C).pointwiseLeftKanExtension (ι.obj d ⊠ ι.obj d'))
[hasDayConvolutionUnit :
(Functor.fromPUnit.{0} <| 𝟙_ C).HasPointwiseLeftKanExtension
(Functor.fromPUnit.{0} <| 𝟙_ V)]
(essImageDayConvolutionUnit :
ι.essImage <|
(Functor.fromPUnit.{0} <| 𝟙_ C).pointwiseLeftKanExtension
(Functor.fromPUnit.{0} <| 𝟙_ V))
[∀ (v : V) (d : C), Limits.PreservesColimitsOfShape
(CostructuredArrow (tensor C) d) (tensorLeft v)]
[∀ (v : V) (d : C), Limits.PreservesColimitsOfShape
(CostructuredArrow (tensor C) d) (tensorRight v)]
[∀ (v : V) (d : C), Limits.PreservesColimitsOfShape
(CostructuredArrow (Functor.fromPUnit.{0} <| 𝟙_ C) d) (tensorLeft v)]
[∀ (v : V) (d : C), Limits.PreservesColimitsOfShape
(CostructuredArrow (Functor.fromPUnit.{0} <| 𝟙_ C) d) (tensorRight v)]
[∀ (v : V) (d : C × C),
Limits.PreservesColimitsOfShape
(CostructuredArrow ((𝟭 C).prod <| Functor.fromPUnit.{0} <| 𝟙_ C) d)
(tensorRight v)]
[∀ (v : V) (d : C × C),
Limits.PreservesColimitsOfShape
(CostructuredArrow ((tensor C).prod (𝟭 C)) d) (tensorRight v)]
/-- Under suitable assumptions on existence of relevant Kan extensions and preservation
of relevant colimits by the tensor product of `V`, we can define a `MonoidalCategory D`
from the data of a fully faithful functor `ι : D ⥤ C ⥤ V` whose essential image
contains a Day convolution unit and is stable under binary Day convolutions. -/
noncomputable def monoidalOfHasDayConvolutions : MonoidalCategory D :=
letI induced : InducedLawfulDayConvolutionMonoidalCategoryStructCore C V D :=
.ofHasDayConvolutions ι ffι essImageDayConvolution essImageDayConvolutionUnit
letI := induced.mkMonoidalCategoryStruct
letI : LawfulDayConvolutionMonoidalCategoryStruct C V D :=
induced.mkLawfulDayConvolutionMonoidalCategoryStruct
monoidalOfLawfulDayConvolutionMonoidalCategoryStruct C V D
open InducedLawfulDayConvolutionMonoidalCategoryStructCore in
/-- The monoidal category constructed via `monoidalOfHasDayConvolutions` has a canonical
`LawfulDayConvolutionMonoidalCategoryStruct C V D`. -/
noncomputable def lawfulDayConvolutionMonoidalCategoryStructOfHasDayConvolutions :
letI := monoidalOfHasDayConvolutions
ι ffι essImageDayConvolution essImageDayConvolutionUnit
LawfulDayConvolutionMonoidalCategoryStruct C V D :=
letI : InducedLawfulDayConvolutionMonoidalCategoryStructCore C V D :=
.ofHasDayConvolutions ι ffι essImageDayConvolution essImageDayConvolutionUnit
letI := monoidalOfHasDayConvolutions
ι ffι essImageDayConvolution essImageDayConvolutionUnit
mkLawfulDayConvolutionMonoidalCategoryStruct C V D
end
end
end
end CategoryTheory.MonoidalCategory |
.lake/packages/mathlib/Mathlib/CategoryTheory/Monoidal/Hopf_.lean | import Mathlib.CategoryTheory.Monoidal.Bimon_
import Mathlib.CategoryTheory.Monoidal.Conv
/-!
# The category of Hopf monoids in a braided monoidal category.
## TODO
* Show that in a Cartesian monoidal category Hopf monoids are exactly group objects.
* Show that `Hopf (ModuleCat R) ≌ HopfAlgCat R`.
-/
noncomputable section
universe v₁ v₂ u₁ u₂ u
open CategoryTheory MonoidalCategory
namespace CategoryTheory
variable {C : Type u₁} [Category.{v₁} C] [MonoidalCategory.{v₁} C] [BraidedCategory C]
open scoped MonObj ComonObj
/--
A Hopf monoid in a braided category `C` is a bimonoid object in `C` equipped with an antipode.
-/
class HopfObj (X : C) extends BimonObj X where
/-- The antipode is an endomorphism of the underlying object of the Hopf monoid. -/
antipode : X ⟶ X
antipode_left (X) : Δ ≫ antipode ▷ X ≫ μ = ε ≫ η := by cat_disch
antipode_right (X) : Δ ≫ X ◁ antipode ≫ μ = ε ≫ η := by cat_disch
@[deprecated (since := "2025-09-14")] alias Hopf_Class := HopfObj
namespace HopfObj
@[inherit_doc] scoped notation "𝒮" => HopfObj.antipode
@[inherit_doc] scoped notation "𝒮["M"]" => HopfObj.antipode (X := M)
attribute [reassoc (attr := simp)] antipode_left antipode_right
end HopfObj
variable (C)
/--
A Hopf monoid in a braided category `C` is a bimonoid object in `C` equipped with an antipode.
-/
structure Hopf where
/-- The underlying object in the ambient monoidal category -/
X : C
[hopf : HopfObj X]
@[deprecated (since := "2025-09-15")] alias Hopf_ := Hopf
attribute [instance] Hopf.hopf
namespace Hopf
variable {C}
/-- A Hopf monoid is a bimonoid. -/
def toBimon (A : Hopf C) : Bimon C := .mk' A.X
@[deprecated (since := "2025-09-15")] alias toBimon_ := toBimon
/--
Morphisms of Hopf monoids are just morphisms of the underlying bimonoids.
In fact they automatically intertwine the antipodes, proved below.
-/
instance : Category (Hopf C) :=
inferInstanceAs <| Category (InducedCategory (Bimon C) Hopf.toBimon)
end Hopf
namespace HopfObj
variable {C}
/-- Morphisms of Hopf monoids intertwine the antipodes. -/
theorem hom_antipode {A B : C} [HopfObj A] [HopfObj B] (f : A ⟶ B) [IsBimonHom f] :
f ≫ 𝒮 = 𝒮 ≫ f := by
-- We show these elements are equal by exhibiting an element in the convolution algebra
-- between `A` (as a comonoid) and `B` (as a monoid),
-- such that the LHS is a left inverse, and the RHS is a right inverse.
apply left_inv_eq_right_inv
(M := Conv A B)
(a := f)
· rw [Conv.mul_eq, Conv.one_eq]
simp only [comp_whiskerRight, Category.assoc]
slice_lhs 3 4 =>
rw [← whisker_exchange]
slice_lhs 2 3 =>
rw [← tensorHom_def]
slice_lhs 1 2 =>
rw [← IsComonHom.hom_comul f]
slice_lhs 2 4 =>
rw [antipode_left]
slice_lhs 1 2 =>
rw [IsComonHom.hom_counit]
· rw [Conv.mul_eq, Conv.one_eq]
simp only [whiskerLeft_comp, Category.assoc]
slice_lhs 2 3 =>
rw [← whisker_exchange]
slice_lhs 3 4 =>
rw [← tensorHom_def]
slice_lhs 3 4 =>
rw [← IsMonHom.mul_hom]
slice_lhs 1 3 =>
rw [antipode_right]
slice_lhs 2 3 =>
rw [IsMonHom.one_hom]
@[reassoc (attr := simp)]
theorem one_antipode (A : C) [HopfObj A] : η[A] ≫ 𝒮[A] = η[A] := by
have := (rfl : η[A] ≫ Δ[A] ≫ (𝒮[A] ▷ A) ≫ μ[A] = _)
conv at this =>
rhs
rw [antipode_left]
rw [Bimon.one_comul_assoc, tensorHom_def_assoc, unitors_inv_equal,
← rightUnitor_inv_naturality_assoc, whisker_exchange_assoc, ← rightUnitor_inv_naturality_assoc,
rightUnitor_inv_naturality_assoc] at this
simpa
@[reassoc (attr := simp)]
theorem antipode_counit (A : C) [HopfObj A] : 𝒮[A] ≫ ε[A] = ε[A] := by
have := (rfl : Δ[A] ≫ (𝒮[A] ▷ A) ≫ μ[A] ≫ ε[A] = _)
conv at this =>
rhs
rw [antipode_left_assoc]
rw [Bimon.mul_counit, tensorHom_def', Category.assoc, ← whisker_exchange_assoc] at this
simpa [unitors_equal]
/-!
## The antipode is an antihomomorphism with respect to both the monoid and comonoid structures.
-/
theorem antipode_comul₁ (A : C) [HopfObj A] :
Δ[A] ≫
𝒮[A] ▷ A ≫
Δ[A] ▷ A ≫
(α_ A A A).hom ≫
A ◁ A ◁ Δ[A] ≫
A ◁ (α_ A A A).inv ≫
A ◁ (β_ A A).hom ▷ A ≫
A ◁ (α_ A A A).hom ≫
(α_ A A (A ⊗ A)).inv ≫
(μ[A] ⊗ₘ μ[A]) =
ε[A] ≫ (λ_ (𝟙_ C)).inv ≫ (η[A] ⊗ₘ η[A]) := by
slice_lhs 3 5 =>
rw [← associator_naturality_right, ← Category.assoc, ← tensorHom_def]
slice_lhs 3 9 =>
rw [Bimon.compatibility]
slice_lhs 1 3 =>
rw [antipode_left]
simp [MonObj.tensorObj.one_def]
/--
Auxiliary calculation for `antipode_comul`.
This calculation calls for some ASCII art out of This Week's Finds.
```
| |
n n
| \ / |
| / |
| / \ |
| | S S
| | \ /
| | /
| | / \
\ / \ /
v v
\ /
v
|
```
We move the left antipode up through the crossing,
the right antipode down through the crossing,
the right multiplication down across the strand,
reassociate the comultiplications,
then use `antipode_right` then `antipode_left` to simplify.
-/
theorem antipode_comul₂ (A : C) [HopfObj A] :
Δ[A] ≫
Δ[A] ▷ A ≫
(α_ A A A).hom ≫
A ◁ A ◁ Δ[A] ≫
A ◁ A ◁ (β_ A A).hom ≫
A ◁ A ◁ (𝒮[A] ⊗ₘ 𝒮[A]) ≫
A ◁ (α_ A A A).inv ≫
A ◁ (β_ A A).hom ▷ A ≫
A ◁ (α_ A A A).hom ≫
(α_ A A (A ⊗ A)).inv ≫
(μ[A] ⊗ₘ μ[A]) =
ε[A] ≫ (λ_ (𝟙_ C)).inv ≫ (η[A] ⊗ₘ η[A]) := by
-- We should write a version of `slice_lhs` that zooms through whiskerings.
slice_lhs 6 6 =>
simp only [tensorHom_def', whiskerLeft_comp]
slice_lhs 7 8 =>
rw [← whiskerLeft_comp, associator_inv_naturality_middle, whiskerLeft_comp]
slice_lhs 8 9 =>
rw [← whiskerLeft_comp, ← comp_whiskerRight, BraidedCategory.braiding_naturality_right,
comp_whiskerRight, whiskerLeft_comp]
slice_lhs 9 10 =>
rw [← whiskerLeft_comp, associator_naturality_left, whiskerLeft_comp]
slice_lhs 5 6 =>
rw [← whiskerLeft_comp, ← whiskerLeft_comp, ← BraidedCategory.braiding_naturality_left,
whiskerLeft_comp, whiskerLeft_comp]
slice_lhs 11 12 =>
rw [tensorHom_def', ← Category.assoc, ← associator_inv_naturality_right]
slice_lhs 10 11 =>
rw [← whiskerLeft_comp, ← whisker_exchange, whiskerLeft_comp]
slice_lhs 6 10 =>
simp only [← whiskerLeft_comp]
rw [← BraidedCategory.hexagon_reverse_assoc, Iso.inv_hom_id_assoc,
← BraidedCategory.braiding_naturality_left]
simp only [whiskerLeft_comp]
rw [ComonObj.comul_assoc_flip_assoc, Iso.inv_hom_id_assoc]
slice_lhs 2 3 =>
simp only [← whiskerLeft_comp]
rw [ComonObj.comul_assoc]
simp only [whiskerLeft_comp]
slice_lhs 3 7 =>
simp only [← whiskerLeft_comp]
rw [← associator_naturality_middle_assoc, Iso.hom_inv_id_assoc]
simp only [← comp_whiskerRight]
rw [antipode_right]
simp only [comp_whiskerRight]
simp only [whiskerLeft_comp]
slice_lhs 2 3 =>
simp only [← whiskerLeft_comp]
rw [ComonObj.counit_comul]
simp only [whiskerLeft_comp]
slice_lhs 3 4 =>
simp only [← whiskerLeft_comp]
rw [BraidedCategory.braiding_naturality_left]
simp only [whiskerLeft_comp]
slice_lhs 4 5 =>
simp only [← whiskerLeft_comp]
rw [whisker_exchange]
simp only [whiskerLeft_comp]
slice_lhs 5 7 =>
rw [associator_inv_naturality_right_assoc, whisker_exchange]
simp only [braiding_tensorUnit_left,
whiskerLeft_comp, whiskerLeft_rightUnitor_inv,
whiskerRight_id, whiskerLeft_rightUnitor, Category.assoc, Iso.hom_inv_id_assoc,
Iso.inv_hom_id_assoc, whiskerLeft_inv_hom_assoc, antipode_right_assoc]
rw [rightUnitor_inv_naturality_assoc, tensorHom_def]
monoidal
theorem antipode_comul (A : C) [HopfObj A] :
𝒮[A] ≫ Δ[A] = Δ[A] ≫ (β_ _ _).hom ≫ (𝒮[A] ⊗ₘ 𝒮[A]) := by
-- Again, it is a "left inverse equals right inverse" argument in the convolution monoid.
apply left_inv_eq_right_inv
(M := Conv A (A ⊗ A))
(a := Δ[A])
· rw [Conv.mul_eq, Conv.one_eq]
simp only [comp_whiskerRight, tensor_whiskerLeft, MonObj.tensorObj.mul_def, Category.assoc,
MonObj.tensorObj.one_def]
simp only [tensorμ]
simp only [Category.assoc, Iso.inv_hom_id_assoc]
exact antipode_comul₁ A
· rw [Conv.mul_eq, Conv.one_eq]
simp only [whiskerLeft_comp, tensor_whiskerLeft, Category.assoc, Iso.inv_hom_id_assoc,
MonObj.tensorObj.mul_def, MonObj.tensorObj.one_def]
simp only [tensorμ]
simp only [Category.assoc, Iso.inv_hom_id_assoc]
exact antipode_comul₂ A
theorem mul_antipode₁ (A : C) [HopfObj A] :
(Δ[A] ⊗ₘ Δ[A]) ≫
(α_ A A (A ⊗ A)).hom ≫
A ◁ (α_ A A A).inv ≫
A ◁ (β_ A A).hom ▷ A ≫
(α_ A (A ⊗ A) A).inv ≫
(α_ A A A).inv ▷ A ≫
μ[A] ▷ A ▷ A ≫
𝒮[A] ▷ A ▷ A ≫
(α_ A A A).hom ≫
A ◁ μ[A] ≫
μ[A] =
(ε[A] ⊗ₘ ε[A]) ≫ (λ_ (𝟙_ C)).hom ≫ η[A] := by
slice_lhs 8 9 =>
rw [associator_naturality_left]
slice_lhs 9 10 =>
rw [← whisker_exchange]
slice_lhs 7 8 =>
rw [associator_naturality_left]
slice_lhs 8 9 =>
rw [← tensorHom_def]
simp
/--
Auxiliary calculation for `mul_antipode`.
```
|
n
/ \
| n
| / \
| S S
| \ /
n /
/ \ / \
| / |
\ / \ /
v v
| |
```
We move the leftmost multiplication up, so we can reassociate.
We then move the rightmost comultiplication under the strand,
and simplify using `antipode_right`.
-/
theorem mul_antipode₂ (A : C) [HopfObj A] :
(Δ[A] ⊗ₘ Δ[A]) ≫
(α_ A A (A ⊗ A)).hom ≫
A ◁ (α_ A A A).inv ≫
A ◁ (β_ A A).hom ▷ A ≫
(α_ A (A ⊗ A) A).inv ≫
(α_ A A A).inv ▷ A ≫
μ[A] ▷ A ▷ A ≫
(α_ A A A).hom ≫
A ◁ (β_ A A).hom ≫
A ◁ (𝒮[A] ⊗ₘ 𝒮[A]) ≫
A ◁ μ[A] ≫ μ[A] =
(ε[A] ⊗ₘ ε[A]) ≫ (λ_ (𝟙_ C)).hom ≫ η[A] := by
slice_lhs 7 8 =>
rw [associator_naturality_left]
slice_lhs 8 9 =>
rw [← whisker_exchange]
slice_lhs 9 10 =>
rw [← whisker_exchange]
slice_lhs 11 12 =>
rw [MonObj.mul_assoc_flip]
slice_lhs 10 11 =>
rw [associator_inv_naturality_left]
slice_lhs 11 12 =>
simp only [← comp_whiskerRight]
rw [MonObj.mul_assoc]
simp only [comp_whiskerRight]
rw [tensorHom_def]
rw [tensor_whiskerLeft _ _ (β_ A A).hom]
rw [pentagon_inv_inv_hom_hom_inv_assoc]
slice_lhs 7 8 =>
rw [Iso.inv_hom_id]
rw [Category.id_comp]
slice_lhs 5 7 =>
simp only [← whiskerLeft_comp]
rw [← BraidedCategory.hexagon_forward]
simp only [whiskerLeft_comp]
simp only [tensor_whiskerLeft, Category.assoc, Iso.inv_hom_id_assoc, pentagon_inv_inv_hom_inv_inv,
whisker_assoc, MonObj.mul_assoc, whiskerLeft_inv_hom_assoc]
slice_lhs 3 4 =>
simp only [← whiskerLeft_comp]
rw [BraidedCategory.braiding_naturality_right]
simp only [whiskerLeft_comp]
rw [tensorHom_def']
simp only [whiskerLeft_comp]
slice_lhs 5 6 =>
simp only [← whiskerLeft_comp]
rw [← associator_naturality_right]
simp only [whiskerLeft_comp]
slice_lhs 4 5 =>
simp only [← whiskerLeft_comp]
rw [← whisker_exchange]
simp only [whiskerLeft_comp]
slice_lhs 5 9 =>
simp only [← whiskerLeft_comp]
rw [associator_inv_naturality_middle_assoc, Iso.hom_inv_id_assoc]
simp only [← comp_whiskerRight]
rw [antipode_right]
simp only [comp_whiskerRight]
simp only [whiskerLeft_comp]
slice_lhs 6 7 =>
simp only [← whiskerLeft_comp]
rw [MonObj.one_mul]
simp only [whiskerLeft_comp]
slice_lhs 3 4 =>
simp only [← whiskerLeft_comp]
rw [← BraidedCategory.braiding_naturality_left]
simp only [whiskerLeft_comp]
slice_lhs 4 5 =>
simp only [← whiskerLeft_comp]
rw [← BraidedCategory.braiding_naturality_right]
simp only [whiskerLeft_comp]
rw [← associator_naturality_middle_assoc]
simp only [braiding_tensorUnit_right, whiskerLeft_comp]
slice_lhs 6 7 =>
simp only [← whiskerLeft_comp]
rw [Iso.inv_hom_id]
simp only [whiskerLeft_comp]
simp only [whiskerLeft_id, Category.id_comp]
slice_lhs 5 6 =>
rw [whiskerLeft_rightUnitor, Category.assoc, ← rightUnitor_naturality]
rw [associator_inv_naturality_right_assoc, Iso.hom_inv_id_assoc]
slice_lhs 3 4 =>
rw [whisker_exchange]
slice_lhs 1 3 =>
simp only [← comp_whiskerRight]
rw [antipode_right]
simp only [comp_whiskerRight]
slice_lhs 2 3 =>
rw [← whisker_exchange]
slice_lhs 1 2 =>
dsimp
rw [← tensorHom_def]
slice_lhs 2 3 =>
rw [rightUnitor_naturality]
monoidal
theorem mul_antipode (A : C) [HopfObj A] :
μ[A] ≫ 𝒮[A] = (𝒮[A] ⊗ₘ 𝒮[A]) ≫ (β_ _ _).hom ≫ μ[A] := by
-- Again, it is a "left inverse equals right inverse" argument in the convolution monoid.
apply left_inv_eq_right_inv
(M := Conv (A ⊗ A) A)
(a := μ[A])
· -- Unfold the algebra structure in the convolution monoid,
-- then `simp?, simp only [tensor_μ], simp?`.
rw [Conv.mul_eq, Conv.one_eq]
simp only [Comon.tensorObj_comul, whiskerRight_tensor, comp_whiskerRight, Category.assoc,
Comon.tensorObj_counit]
simp only [tensorμ]
simp only [Category.assoc, pentagon_hom_inv_inv_inv_inv_assoc]
exact mul_antipode₁ A
· rw [Conv.mul_eq, Conv.one_eq]
simp only [Comon.tensorObj_comul, whiskerRight_tensor,
BraidedCategory.braiding_naturality_assoc, whiskerLeft_comp, Category.assoc,
Comon.tensorObj_counit]
simp only [tensorμ]
simp only [Category.assoc, pentagon_hom_inv_inv_inv_inv_assoc]
exact mul_antipode₂ A
/--
In a commutative Hopf algebra, the antipode squares to the identity.
-/
theorem antipode_antipode (A : C) [HopfObj A] (comm : (β_ _ _).hom ≫ μ[A] = μ[A]) :
𝒮[A] ≫ 𝒮[A] = 𝟙 A := by
-- Again, it is a "left inverse equals right inverse" argument in the convolution monoid.
apply left_inv_eq_right_inv
(M := Conv A A)
(a := 𝒮[A])
· -- Unfold the algebra structure in the convolution monoid,
-- then `simp?`.
rw [Conv.mul_eq, Conv.one_eq]
simp only [comp_whiskerRight, Category.assoc]
rw [← comm, ← tensorHom_def_assoc, ← mul_antipode]
simp
· rw [Conv.mul_eq, Conv.one_eq]
simp
end HopfObj
end CategoryTheory |
.lake/packages/mathlib/Mathlib/CategoryTheory/Monoidal/CommMon_.lean | import Mathlib.CategoryTheory.Monoidal.Braided.Basic
import Mathlib.CategoryTheory.Monoidal.Mon_
/-!
# The category of commutative monoids in a braided monoidal category.
-/
universe v₁ v₂ v₃ u₁ u₂ u₃ u
open CategoryTheory MonoidalCategory MonObj
namespace CategoryTheory
variable {C : Type u₁} [Category.{v₁} C] [MonoidalCategory.{v₁} C] [BraidedCategory.{v₁} C]
variable (C) in
/-- A commutative monoid object internal to a monoidal category.
-/
structure CommMon where
/-- The underlying object in the ambient monoidal category -/
X : C
[mon : MonObj X]
[comm : IsCommMonObj X]
@[deprecated (since := "2025-09-15")] alias CommMon_ := CommMon
attribute [instance] CommMon.mon CommMon.comm
namespace CommMon
/-- A commutative monoid object is a monoid object. -/
@[simps X]
def toMon (A : CommMon C) : Mon C := ⟨A.X⟩
@[deprecated (since := "2025-09-15")] alias toMon_ := toMon
variable (C) in
/-- The trivial commutative monoid object. We later show this is initial in `CommMon C`.
-/
@[simps!]
def trivial : CommMon C := { X := 𝟙_ C }
instance : Inhabited (CommMon C) :=
⟨trivial C⟩
variable {M : CommMon C}
instance : Category (CommMon C) :=
InducedCategory.category CommMon.toMon
@[simp]
theorem id_hom (A : CommMon C) : Mon.Hom.hom (𝟙 A) = 𝟙 A.X :=
rfl
@[simp]
theorem comp_hom {R S T : CommMon C} (f : R ⟶ S) (g : S ⟶ T) :
Mon.Hom.hom (f ≫ g) = f.hom ≫ g.hom :=
rfl
@[ext]
lemma hom_ext {A B : CommMon C} (f g : A ⟶ B) (h : f.hom = g.hom) : f = g :=
Mon.Hom.ext h
@[simp]
lemma id' (A : CommMon C) : (𝟙 A : A.toMon ⟶ A.toMon) = 𝟙 (A.toMon) := rfl
@[simp]
lemma comp' {A₁ A₂ A₃ : CommMon C} (f : A₁ ⟶ A₂) (g : A₂ ⟶ A₃) :
((f ≫ g : A₁ ⟶ A₃) : A₁.toMon ⟶ A₃.toMon) = @CategoryStruct.comp (Mon C) _ _ _ _ f g := rfl
section
variable (C)
/-- The forgetful functor from commutative monoid objects to monoid objects. -/
@[simps! obj_X]
def forget₂Mon : CommMon C ⥤ Mon C :=
inducedFunctor CommMon.toMon
@[deprecated (since := "2025-09-15")] alias forget₂Mon_ := forget₂Mon
/-- The forgetful functor from commutative monoid objects to monoid objects
is fully faithful. -/
def fullyFaithfulForget₂Mon : (forget₂Mon C).FullyFaithful :=
fullyFaithfulInducedFunctor _
-- The `Full, Faithful` instances should be constructed by a deriving handler.
-- https://github.com/leanprover-community/mathlib4/issues/380
@[deprecated (since := "2025-09-15")] alias fullyFaithfulForget₂Mon_ := fullyFaithfulForget₂Mon
instance : (forget₂Mon C).Full := InducedCategory.full _
instance : (forget₂Mon C).Faithful := InducedCategory.faithful _
@[simp]
theorem forget₂Mon_obj_one (A : CommMon C) : η[((forget₂Mon C).obj A).X] = η[A.X] :=
rfl
@[simp]
theorem forget₂Mon_obj_mul (A : CommMon C) : μ[((forget₂Mon C).obj A).X] = μ[A.X] :=
rfl
@[simp]
theorem forget₂Mon_map_hom {A B : CommMon C} (f : A ⟶ B) : ((forget₂Mon C).map f).hom = f.hom :=
rfl
/-- The forgetful functor from commutative monoid objects to the ambient category. -/
@[simps!]
def forget : CommMon C ⥤ C :=
forget₂Mon C ⋙ Mon.forget C
instance : (forget C).Faithful where
@[simp]
theorem forget₂Mon_comp_forget : forget₂Mon C ⋙ Mon.forget C = forget C := rfl
instance {M N : CommMon C} {f : M ⟶ N} [IsIso f] : IsIso f.hom :=
inferInstanceAs <| IsIso <| (forget C).map f
end
/-- Construct an isomorphism of commutative monoid objects by giving a monoid isomorphism between
the underlying objects. -/
@[simps!]
def mkIso' {M N : C} (e : M ≅ N) [MonObj M] [IsCommMonObj M] [MonObj N] [IsCommMonObj N]
[IsMonHom e.hom] : mk M ≅ mk N :=
(fullyFaithfulForget₂Mon C).preimageIso (Mon.mkIso' e)
/-- Construct an isomorphism of commutative monoid objects by giving an isomorphism between the
underlying objects and checking compatibility with unit and multiplication only in the forward
direction. -/
@[simps!]
abbrev mkIso {M N : CommMon C} (e : M.X ≅ N.X) (one_f : η[M.X] ≫ e.hom = η[N.X] := by cat_disch)
(mul_f : μ[M.X] ≫ e.hom = (e.hom ⊗ₘ e.hom) ≫ μ[N.X] := by cat_disch) : M ≅ N :=
have : IsMonHom e.hom := ⟨one_f, mul_f⟩
mkIso' e
instance uniqueHomFromTrivial (A : CommMon C) : Unique (trivial C ⟶ A) :=
Mon.uniqueHomFromTrivial A.toMon
open CategoryTheory.Limits
instance : HasInitial (CommMon C) :=
hasInitial_of_unique (trivial C)
end CommMon
variable
{D : Type u₂} [Category.{v₂} D] [MonoidalCategory D] [BraidedCategory D]
{E : Type u₃} [Category.{v₃} E] [MonoidalCategory E] [BraidedCategory E]
{F F' : C ⥤ D} {G : D ⥤ E}
namespace Functor
section LaxBraided
variable [F.LaxBraided] [F'.LaxBraided] [G.LaxBraided]
open scoped Obj
instance isCommMonObj_obj {M : C} [MonObj M] [IsCommMonObj M] : IsCommMonObj (F.obj M) where
mul_comm := by
dsimp; rw [← Functor.LaxBraided.braided_assoc, ← Functor.map_comp, IsCommMonObj.mul_comm]
variable (F) in
/-- A lax braided functor takes commutative monoid objects to commutative monoid objects.
That is, a lax braided functor `F : C ⥤ D` induces a functor `CommMon C ⥤ CommMon D`.
-/
@[simps!]
def mapCommMon : CommMon C ⥤ CommMon D where
obj A :=
{ F.mapMon.obj A.toMon with
comm :=
{ mul_comm := by
dsimp
rw [← Functor.LaxBraided.braided_assoc, ← Functor.map_comp, IsCommMonObj.mul_comm] } }
map f := F.mapMon.map f
@[simp]
theorem mapCommMon_id_one (A : CommMon C) :
η[((𝟭 C).mapCommMon.obj A).X] = 𝟙 _ ≫ η[A.X] :=
rfl
@[simp]
theorem mapCommMon_id_mul (A : CommMon C) :
μ[((𝟭 C).mapCommMon.obj A).X] = 𝟙 _ ≫ μ[A.X] :=
rfl
@[simp]
theorem comp_mapCommMon_one (A : CommMon C) :
η[((F ⋙ G).mapCommMon.obj A).X] = LaxMonoidal.ε (F ⋙ G) ≫ (F ⋙ G).map η[A.X] :=
rfl
@[simp]
theorem comp_mapCommMon_mul (A : CommMon C) :
μ[((F ⋙ G).mapCommMon.obj A).X] = LaxMonoidal.μ (F ⋙ G) _ _ ≫ (F ⋙ G).map μ[A.X] :=
rfl
/-- The identity functor is also the identity on commutative monoid objects. -/
@[simps!]
def mapCommMonIdIso : mapCommMon (𝟭 C) ≅ 𝟭 (CommMon C) :=
NatIso.ofComponents fun X ↦ CommMon.mkIso (.refl _)
/-- The composition functor is also the composition on commutative monoid objects. -/
@[simps!]
def mapCommMonCompIso : (F ⋙ G).mapCommMon ≅ F.mapCommMon ⋙ G.mapCommMon :=
NatIso.ofComponents fun X ↦ CommMon.mkIso (.refl _)
variable (C D) in
/-- `mapCommMon` is functorial in the lax braided functor. -/
@[simps]
def mapCommMonFunctor : LaxBraidedFunctor C D ⥤ CommMon C ⥤ CommMon D where
obj F := F.mapCommMon
map α := { app A := .mk' (α.hom.app A.X) }
map_comp _ _ := rfl
protected instance Faithful.mapCommMon [F.Faithful] : F.mapCommMon.Faithful where
map_injective hfg := F.mapMon.map_injective hfg
/-- Natural transformations between functors lift to monoid objects. -/
@[simps!]
def mapCommMonNatTrans (f : F ⟶ F') [NatTrans.IsMonoidal f] : F.mapCommMon ⟶ F'.mapCommMon where
app X := .mk' (f.app _)
/-- Natural isomorphisms between functors lift to monoid objects. -/
@[simps!]
def mapCommMonNatIso (e : F ≅ F') [NatTrans.IsMonoidal e.hom] : F.mapCommMon ≅ F'.mapCommMon :=
NatIso.ofComponents fun X ↦ CommMon.mkIso (e.app _)
end LaxBraided
section Braided
variable [F.Braided]
protected instance Full.mapCommMon [F.Full] [F.Faithful] : F.mapCommMon.Full where
map_surjective := F.mapMon.map_surjective
/-- If `F : C ⥤ D` is a fully faithful monoidal functor, then
`CommMonCat(F) : CommMonCat C ⥤ CommMonCat D` is fully faithful too. -/
@[simps]
protected def FullyFaithful.mapCommMon (hF : F.FullyFaithful) : F.mapCommMon.FullyFaithful where
preimage f := .mk <| hF.preimage f.hom
end Braided
end Functor
open Functor
namespace Adjunction
variable {F : C ⥤ D} {G : D ⥤ C} (a : F ⊣ G) [F.Braided] [G.LaxBraided] [a.IsMonoidal]
/-- An adjunction of braided functors lifts to an adjunction of their lifts to commutative monoid
objects. -/
@[simps] def mapCommMon : F.mapCommMon ⊣ G.mapCommMon where
unit := mapCommMonIdIso.inv ≫ mapCommMonNatTrans a.unit ≫ mapCommMonCompIso.hom
counit := mapCommMonCompIso.inv ≫ mapCommMonNatTrans a.counit ≫ mapCommMonIdIso.hom
end Adjunction
namespace Equivalence
/-- An equivalence of categories lifts to an equivalence of their commutative monoid objects. -/
@[simps]
def mapCommMon (e : C ≌ D) [e.functor.Braided] [e.inverse.Braided] [e.IsMonoidal] :
CommMon C ≌ CommMon D where
functor := e.functor.mapCommMon
inverse := e.inverse.mapCommMon
unitIso := mapCommMonIdIso.symm ≪≫ mapCommMonNatIso e.unitIso ≪≫ mapCommMonCompIso
counitIso := mapCommMonCompIso.symm ≪≫ mapCommMonNatIso e.counitIso ≪≫ mapCommMonIdIso
end Equivalence
namespace CommMon
open LaxBraidedFunctor
namespace EquivLaxBraidedFunctorPUnit
variable (C) in
/-- Implementation of `CommMon.equivLaxBraidedFunctorPUnit`. -/
@[simps]
def laxBraidedToCommMon : LaxBraidedFunctor (Discrete PUnit.{u + 1}) C ⥤ CommMon C where
obj F := (F.mapCommMon : CommMon _ ⥤ CommMon C).obj (trivial (Discrete PUnit.{u+1}))
map α := ((Functor.mapCommMonFunctor (Discrete PUnit) C).map α).app _
/-- Implementation of `CommMon.equivLaxBraidedFunctorPUnit`. -/
@[simps!]
def commMonToLaxBraidedObj (A : CommMon C) :
Discrete PUnit.{u + 1} ⥤ C := (Functor.const _).obj A.X
instance (A : CommMon C) : (commMonToLaxBraidedObj A).LaxMonoidal where
ε := η[A.X]
«μ» _ _ := μ[A.X]
open Functor.LaxMonoidal
@[simp]
lemma commMonToLaxBraidedObj_ε (A : CommMon C) :
ε (commMonToLaxBraidedObj A) = η[A.X] := rfl
@[simp]
lemma commMonToLaxBraidedObj_μ (A : CommMon C) (X Y) :
«μ» (commMonToLaxBraidedObj A) X Y = μ[A.X] := rfl
instance (A : CommMon C) : (commMonToLaxBraidedObj A).LaxBraided where
variable (C)
/-- Implementation of `CommMon.equivLaxBraidedFunctorPUnit`. -/
@[simps]
def commMonToLaxBraided : CommMon C ⥤ LaxBraidedFunctor (Discrete PUnit.{u + 1}) C where
obj A := LaxBraidedFunctor.of (commMonToLaxBraidedObj A)
map f :=
{ hom := { app := fun _ => f.hom }
isMonoidal := { } }
/-- Implementation of `CommMon.equivLaxBraidedFunctorPUnit`. -/
@[simps!]
def unitIso :
𝟭 (LaxBraidedFunctor (Discrete PUnit.{u + 1}) C) ≅
laxBraidedToCommMon C ⋙ commMonToLaxBraided C :=
NatIso.ofComponents
(fun F ↦ LaxBraidedFunctor.isoOfComponents (fun _ ↦ F.mapIso (eqToIso (by ext))))
(fun f ↦ by ext ⟨⟨⟩⟩; dsimp; simp)
@[simp]
theorem counitIso_aux_one (A : CommMon C) :
η[((commMonToLaxBraided C ⋙ laxBraidedToCommMon C).obj A).X] = η[A.X] ≫ 𝟙 _ :=
rfl
@[simp]
theorem counitIso_aux_mul (A : CommMon C) :
μ[((commMonToLaxBraided C ⋙ laxBraidedToCommMon C).obj A).X] = μ[A.X] ≫ 𝟙 _ :=
rfl
/-- Implementation of `CommMon.equivLaxBraidedFunctorPUnit`. -/
@[simps!]
def counitIso : commMonToLaxBraided C ⋙ laxBraidedToCommMon C ≅ 𝟭 (CommMon C) :=
NatIso.ofComponents (fun F ↦ mkIso (Iso.refl _))
end EquivLaxBraidedFunctorPUnit
open EquivLaxBraidedFunctorPUnit
/-- Commutative monoid objects in `C` are "just" braided lax monoidal functors from the trivial
braided monoidal category to `C`.
-/
@[simps]
def equivLaxBraidedFunctorPUnit : LaxBraidedFunctor (Discrete PUnit.{u + 1}) C ≌ CommMon C where
functor := laxBraidedToCommMon C
inverse := commMonToLaxBraided C
unitIso := unitIso C
counitIso := counitIso C
end CommMon
end CategoryTheory |
.lake/packages/mathlib/Mathlib/CategoryTheory/Monoidal/Functor.lean | import Mathlib.CategoryTheory.Monoidal.Category
import Mathlib.CategoryTheory.Adjunction.FullyFaithful
import Mathlib.CategoryTheory.Products.Basic
/-!
# (Lax) monoidal functors
A lax monoidal functor `F` between monoidal categories `C` and `D`
is a functor between the underlying categories equipped with morphisms
* `ε : 𝟙_ D ⟶ F.obj (𝟙_ C)` (called the unit morphism)
* `μ X Y : (F.obj X) ⊗ (F.obj Y) ⟶ F.obj (X ⊗ Y)` (called the tensorator, or strength).
satisfying various axioms. This is implemented as a typeclass `F.LaxMonoidal`.
Similarly, we define the typeclass `F.OplaxMonoidal`. For these oplax monoidal functors,
we have similar data `η` and `δ`, but with morphisms in the opposite direction.
A monoidal functor (`F.Monoidal`) is defined here as the combination of `F.LaxMonoidal`
and `F.OplaxMonoidal`, with the additional conditions that `ε`/`η` and `μ`/`δ` are
inverse isomorphisms.
We show that the composition of (lax) monoidal functors gives a (lax) monoidal functor.
See `Mathlib/CategoryTheory/Monoidal/NaturalTransformation.lean` for monoidal natural
transformations.
We show in `Mathlib.CategoryTheory.Monoidal.Mon_` that lax monoidal functors take monoid objects
to monoid objects.
## References
See <https://stacks.math.columbia.edu/tag/0FFL>.
-/
universe v₁ v₂ v₃ v₁' u₁ u₂ u₃ u₁'
namespace CategoryTheory
open Category Functor MonoidalCategory
variable {C : Type u₁} [Category.{v₁} C] [MonoidalCategory.{v₁} C]
{D : Type u₂} [Category.{v₂} D] [MonoidalCategory.{v₂} D]
{E : Type u₃} [Category.{v₃} E] [MonoidalCategory.{v₃} E]
{C' : Type u₁'} [Category.{v₁'} C']
namespace Functor
-- The direction of `left_unitality` and `right_unitality` as simp lemmas may look strange:
-- remember the rule of thumb that component indices of natural transformations
-- "weigh more" than structural maps.
-- (However by this argument `associativity` is currently stated backwards!)
/-- A functor `F : C ⥤ D` between monoidal categories is lax monoidal if it is
equipped with morphisms `ε : 𝟙_ D ⟶ F.obj (𝟙_ C)` and `μ X Y : F.obj X ⊗ F.obj Y ⟶ F.obj (X ⊗ Y)`,
satisfying the appropriate coherences. -/
@[ext]
class LaxMonoidal (F : C ⥤ D) where
/-- the unit morphism of a lax monoidal functor -/
ε (F) : 𝟙_ D ⟶ F.obj (𝟙_ C)
/-- the tensorator of a lax monoidal functor -/
μ (F) : ∀ X Y : C, F.obj X ⊗ F.obj Y ⟶ F.obj (X ⊗ Y)
μ_natural_left (F) :
∀ {X Y : C} (f : X ⟶ Y) (X' : C),
F.map f ▷ F.obj X' ≫ μ Y X' = μ X X' ≫ F.map (f ▷ X') := by
cat_disch
μ_natural_right (F) :
∀ {X Y : C} (X' : C) (f : X ⟶ Y),
F.obj X' ◁ F.map f ≫ μ X' Y = μ X' X ≫ F.map (X' ◁ f) := by
cat_disch
/-- associativity of the tensorator -/
associativity (F) :
∀ X Y Z : C,
μ X Y ▷ F.obj Z ≫ μ (X ⊗ Y) Z ≫ F.map (α_ X Y Z).hom =
(α_ (F.obj X) (F.obj Y) (F.obj Z)).hom ≫ F.obj X ◁ μ Y Z ≫ μ X (Y ⊗ Z) := by
cat_disch
-- unitality
left_unitality (F) :
∀ X : C, (λ_ (F.obj X)).hom = ε ▷ F.obj X ≫ μ (𝟙_ C) X ≫ F.map (λ_ X).hom := by
cat_disch
right_unitality (F) :
∀ X : C, (ρ_ (F.obj X)).hom = F.obj X ◁ ε ≫ μ X (𝟙_ C) ≫ F.map (ρ_ X).hom := by
cat_disch
namespace LaxMonoidal
attribute [reassoc (attr := simp)] μ_natural_left μ_natural_right
associativity
attribute [simp, reassoc] right_unitality left_unitality
section
variable (F : C ⥤ D) [F.LaxMonoidal]
@[reassoc (attr := simp)]
theorem μ_natural {X Y X' Y' : C} (f : X ⟶ Y) (g : X' ⟶ Y') :
(F.map f ⊗ₘ F.map g) ≫ μ F Y Y' = μ F X X' ≫ F.map (f ⊗ₘ g) := by
simp [tensorHom_def]
@[reassoc (attr := simp)]
theorem left_unitality_inv (X : C) :
(λ_ (F.obj X)).inv ≫ ε F ▷ F.obj X ≫ μ F (𝟙_ C) X = F.map (λ_ X).inv := by
rw [Iso.inv_comp_eq, left_unitality, Category.assoc, Category.assoc, ← F.map_comp,
Iso.hom_inv_id, F.map_id, comp_id]
@[reassoc (attr := simp)]
theorem right_unitality_inv (X : C) :
(ρ_ (F.obj X)).inv ≫ F.obj X ◁ ε F ≫ μ F X (𝟙_ C) = F.map (ρ_ X).inv := by
rw [Iso.inv_comp_eq, right_unitality, Category.assoc, Category.assoc, ← F.map_comp,
Iso.hom_inv_id, F.map_id, comp_id]
@[reassoc (attr := simp)]
theorem associativity_inv (X Y Z : C) :
F.obj X ◁ μ F Y Z ≫ μ F X (Y ⊗ Z) ≫ F.map (α_ X Y Z).inv =
(α_ (F.obj X) (F.obj Y) (F.obj Z)).inv ≫ μ F X Y ▷ F.obj Z ≫ μ F (X ⊗ Y) Z := by
rw [Iso.eq_inv_comp, ← associativity_assoc, ← F.map_comp, Iso.hom_inv_id,
F.map_id, comp_id]
@[reassoc]
lemma ε_tensorHom_comp_μ {X : C} {Y : D} (f : Y ⟶ F.obj X) :
(ε F ⊗ₘ f) ≫ μ F (𝟙_ C) X = 𝟙_ D ◁ f ≫ (λ_ (F.obj X)).hom ≫ F.map (λ_ X).inv := by
simp [tensorHom_def']
@[reassoc]
lemma tensorHom_ε_comp_μ {X : C} {Y : D} (f : Y ⟶ F.obj X) :
(f ⊗ₘ ε F) ≫ μ F X (𝟙_ C) = f ▷ 𝟙_ D ≫ (ρ_ (F.obj X)).hom ≫ F.map (ρ_ X).inv := by
simp [tensorHom_def]
@[reassoc]
lemma tensorUnit_whiskerLeft_comp_leftUnitor_hom {X : C} {Y : D} (f : Y ⟶ F.obj X) :
𝟙_ D ◁ f ≫ (λ_ (F.obj X)).hom = (ε F ⊗ₘ f) ≫ μ F (𝟙_ C) X ≫ F.map (λ_ X).hom := by
simp [tensorHom_def']
@[reassoc]
lemma whiskerRight_tensorUnit_comp_rightUnitor_hom {X : C} {Y : D} (f : Y ⟶ F.obj X) :
f ▷ 𝟙_ D ≫ (ρ_ (F.obj X)).hom = (f ⊗ₘ ε F) ≫ μ F X (𝟙_ C) ≫ F.map (ρ_ X).hom := by
simp [tensorHom_def]
@[reassoc]
lemma μ_whiskerRight_comp_μ (X Y Z : C) :
μ F X Y ▷ F.obj Z ≫ μ F (X ⊗ Y) Z = (α_ (F.obj X) (F.obj Y) (F.obj Z)).hom ≫
F.obj X ◁ μ F Y Z ≫ μ F X (Y ⊗ Z) ≫ F.map (α_ X Y Z).inv := by
rw [← associativity_assoc, ← F.map_comp, Iso.hom_inv_id, map_id, Category.comp_id]
@[reassoc]
lemma whiskerLeft_μ_comp_μ (X Y Z : C) :
F.obj X ◁ μ F Y Z ≫ μ F X (Y ⊗ Z) = (α_ (F.obj X) (F.obj Y) (F.obj Z)).inv ≫
μ F X Y ▷ F.obj Z ≫ μ F (X ⊗ Y) Z ≫ F.map (α_ X Y Z).hom := by
rw [associativity, Iso.inv_hom_id_assoc]
end
section
variable {F : C ⥤ D}
/- unit morphism -/
(ε : 𝟙_ D ⟶ F.obj (𝟙_ C))
/- tensorator -/
(μ : ∀ X Y : C, F.obj X ⊗ F.obj Y ⟶ F.obj (X ⊗ Y))
(μ_natural :
∀ {X Y X' Y' : C} (f : X ⟶ Y) (g : X' ⟶ Y'),
(F.map f ⊗ₘ F.map g) ≫ μ Y Y' = μ X X' ≫ F.map (f ⊗ₘ g) := by
cat_disch)
/- associativity of the tensorator -/
(associativity :
∀ X Y Z : C,
(μ X Y ⊗ₘ 𝟙 (F.obj Z)) ≫ μ (X ⊗ Y) Z ≫ F.map (α_ X Y Z).hom =
(α_ (F.obj X) (F.obj Y) (F.obj Z)).hom ≫ (𝟙 (F.obj X) ⊗ₘ μ Y Z) ≫ μ X (Y ⊗ Z) := by
cat_disch)
/- unitality -/
(left_unitality :
∀ X : C, (λ_ (F.obj X)).hom = (ε ⊗ₘ 𝟙 (F.obj X)) ≫ μ (𝟙_ C) X ≫ F.map (λ_ X).hom := by
cat_disch)
(right_unitality :
∀ X : C, (ρ_ (F.obj X)).hom = (𝟙 (F.obj X) ⊗ₘ ε) ≫ μ X (𝟙_ C) ≫ F.map (ρ_ X).hom := by
cat_disch)
/--
A constructor for lax monoidal functors whose axioms are described by `tensorHom` instead of
`whiskerLeft` and `whiskerRight`.
-/
def ofTensorHom : F.LaxMonoidal where
ε := ε
μ := μ
μ_natural_left := fun f X' => by
simp_rw [← tensorHom_id, ← F.map_id, μ_natural]
μ_natural_right := fun X' f => by
simp_rw [← id_tensorHom, ← F.map_id, μ_natural]
associativity := fun X Y Z => by
simp_rw [← tensorHom_id, ← id_tensorHom, associativity]
left_unitality := fun X => by
simp_rw [← tensorHom_id, left_unitality]
right_unitality := fun X => by
simp_rw [← id_tensorHom, right_unitality]
end
@[simps]
instance id : (𝟭 C).LaxMonoidal where
ε := 𝟙 _
μ _ _ := 𝟙 _
section
variable (F : C ⥤ D) (G : D ⥤ E)
variable [F.LaxMonoidal] [G.LaxMonoidal]
@[simps]
instance comp : (F ⋙ G).LaxMonoidal where
ε := ε G ≫ G.map (ε F)
μ X Y := μ G _ _ ≫ G.map (μ F X Y)
μ_natural_left _ _ := by
simp_rw [comp_obj, F.comp_map, μ_natural_left_assoc, assoc, ← G.map_comp, μ_natural_left]
μ_natural_right _ _ := by
simp_rw [comp_obj, F.comp_map, μ_natural_right_assoc, assoc, ← G.map_comp, μ_natural_right]
associativity _ _ _ := by
dsimp
simp_rw [comp_whiskerRight, assoc, μ_natural_left_assoc, MonoidalCategory.whiskerLeft_comp,
assoc, μ_natural_right_assoc, ← associativity_assoc, ← G.map_comp, associativity]
end
end LaxMonoidal
/-- A functor `F : C ⥤ D` between monoidal categories is oplax monoidal if it is
equipped with morphisms `η : F.obj (𝟙_ C) ⟶ 𝟙 _D` and `δ X Y : F.obj (X ⊗ Y) ⟶ F.obj X ⊗ F.obj Y`,
satisfying the appropriate coherences. -/
@[ext]
class OplaxMonoidal (F : C ⥤ D) where
/-- the counit morphism of a lax monoidal functor -/
η (F) : F.obj (𝟙_ C) ⟶ 𝟙_ D
/-- the cotensorator of an oplax monoidal functor -/
δ (F) : ∀ X Y : C, F.obj (X ⊗ Y) ⟶ F.obj X ⊗ F.obj Y
δ_natural_left (F) :
∀ {X Y : C} (f : X ⟶ Y) (X' : C),
δ X X' ≫ F.map f ▷ F.obj X' = F.map (f ▷ X') ≫ δ Y X' := by
cat_disch
δ_natural_right (F) :
∀ {X Y : C} (X' : C) (f : X ⟶ Y),
δ X' X ≫ F.obj X' ◁ F.map f = F.map (X' ◁ f) ≫ δ X' Y := by
cat_disch
/-- associativity of the tensorator -/
oplax_associativity (F) :
∀ X Y Z : C,
δ (X ⊗ Y) Z ≫ δ X Y ▷ F.obj Z ≫ (α_ (F.obj X) (F.obj Y) (F.obj Z)).hom =
F.map (α_ X Y Z).hom ≫ δ X (Y ⊗ Z) ≫ F.obj X ◁ δ Y Z := by
cat_disch
-- unitality
oplax_left_unitality (F) :
∀ X : C, (λ_ (F.obj X)).inv = F.map (λ_ X).inv ≫ δ (𝟙_ C) X ≫ η ▷ F.obj X := by
cat_disch
oplax_right_unitality (F) :
∀ X : C, (ρ_ (F.obj X)).inv = F.map (ρ_ X).inv ≫ δ X (𝟙_ C) ≫ F.obj X ◁ η := by
cat_disch
namespace OplaxMonoidal
attribute [reassoc (attr := simp)] δ_natural_left δ_natural_right
@[reassoc (attr := simp)]
alias associativity := oplax_associativity
@[simp, reassoc]
alias left_unitality := oplax_left_unitality
@[simp, reassoc]
alias right_unitality := oplax_right_unitality
section
variable (F : C ⥤ D) [F.OplaxMonoidal]
@[reassoc (attr := simp)]
theorem δ_natural {X Y X' Y' : C} (f : X ⟶ Y) (g : X' ⟶ Y') :
δ F X X' ≫ (F.map f ⊗ₘ F.map g) = F.map (f ⊗ₘ g) ≫ δ F Y Y' := by
simp [tensorHom_def]
@[reassoc (attr := simp)]
theorem left_unitality_hom (X : C) :
δ F (𝟙_ C) X ≫ η F ▷ F.obj X ≫ (λ_ (F.obj X)).hom = F.map (λ_ X).hom := by
rw [← Category.assoc, ← Iso.eq_comp_inv, left_unitality, ← Category.assoc,
← F.map_comp, Iso.hom_inv_id, F.map_id, id_comp]
@[reassoc (attr := simp)]
theorem right_unitality_hom (X : C) :
δ F X (𝟙_ C) ≫ F.obj X ◁ η F ≫ (ρ_ (F.obj X)).hom = F.map (ρ_ X).hom := by
rw [← Category.assoc, ← Iso.eq_comp_inv, right_unitality, ← Category.assoc,
← F.map_comp, Iso.hom_inv_id, F.map_id, id_comp]
@[reassoc (attr := simp)]
theorem associativity_inv (X Y Z : C) :
δ F X (Y ⊗ Z) ≫ F.obj X ◁ δ F Y Z ≫ (α_ (F.obj X) (F.obj Y) (F.obj Z)).inv =
F.map (α_ X Y Z).inv ≫ δ F (X ⊗ Y) Z ≫ δ F X Y ▷ F.obj Z := by
rw [← Category.assoc, Iso.comp_inv_eq, Category.assoc, Category.assoc, associativity,
← Category.assoc, ← F.map_comp, Iso.inv_hom_id, F.map_id, id_comp]
@[reassoc]
lemma δ_comp_η_tensorHom {X : C} {Y : D} (f : F.obj X ⟶ Y) :
δ F (𝟙_ C) X ≫ (η F ⊗ₘ f) = F.map (λ_ X).hom ≫ (λ_ (F.obj X)).inv ≫ 𝟙_ D ◁ f := by
simp [tensorHom_def]
@[reassoc]
lemma δ_comp_tensorHom_η {X : C} {Y : D} (f : F.obj X ⟶ Y) :
δ F X (𝟙_ C) ≫ (f ⊗ₘ η F) = F.map (ρ_ X).hom ≫ (ρ_ (F.obj X)).inv ≫ f ▷ 𝟙_ D := by
simp [tensorHom_def']
@[reassoc]
lemma δ_comp_δ_whiskerRight (X Y Z : C) :
δ F (X ⊗ Y) Z ≫ δ F X Y ▷ F.obj Z = F.map (α_ X Y Z).hom ≫
δ F X (Y ⊗ Z) ≫ F.obj X ◁ δ F Y Z ≫ (α_ (F.obj X) (F.obj Y) (F.obj Z)).inv := by
rw [← associativity_assoc, Iso.hom_inv_id, Category.comp_id]
@[reassoc]
lemma δ_comp_whiskerLeft_δ (X Y Z : C) :
δ F X (Y ⊗ Z) ≫ F.obj X ◁ δ F Y Z = F.map (α_ X Y Z).inv ≫
δ F (X ⊗ Y) Z ≫ δ F X Y ▷ F.obj Z ≫ (α_ (F.obj X) (F.obj Y) (F.obj Z)).hom := by
rw [associativity, ← F.map_comp_assoc, Iso.inv_hom_id, Functor.map_id, Category.id_comp]
end
@[simps]
instance id : (𝟭 C).OplaxMonoidal where
η := 𝟙 _
δ _ _ := 𝟙 _
section
variable (F : C ⥤ D) (G : D ⥤ E) [F.OplaxMonoidal] [G.OplaxMonoidal]
@[simps]
instance comp : (F ⋙ G).OplaxMonoidal where
η := G.map (η F) ≫ η G
δ X Y := G.map (δ F X Y) ≫ δ G _ _
δ_natural_left {X Y} f X' := by
dsimp
rw [assoc, δ_natural_left, ← G.map_comp_assoc, δ_natural_left, map_comp, assoc]
δ_natural_right _ _ := by
dsimp
rw [assoc, δ_natural_right, ← G.map_comp_assoc, δ_natural_right, map_comp, assoc]
oplax_associativity X Y Z := by
dsimp
rw [comp_whiskerRight, assoc, assoc, assoc, δ_natural_left_assoc, associativity,
← G.map_comp_assoc, ← G.map_comp_assoc, assoc, associativity, map_comp, map_comp,
assoc, assoc, MonoidalCategory.whiskerLeft_comp, δ_natural_right_assoc]
end
end OplaxMonoidal
open LaxMonoidal OplaxMonoidal
/-- A functor between monoidal categories is monoidal if it is lax and oplax monoidals,
and both data give inverse isomorphisms. -/
@[ext]
class Monoidal (F : C ⥤ D) extends F.LaxMonoidal, F.OplaxMonoidal where
ε_η (F) : ε ≫ η = 𝟙 _ := by cat_disch
η_ε (F) : η ≫ ε = 𝟙 _ := by cat_disch
μ_δ (F) (X Y : C) : μ X Y ≫ δ X Y = 𝟙 _ := by cat_disch
δ_μ (F) (X Y : C) : δ X Y ≫ μ X Y = 𝟙 _ := by cat_disch
namespace Monoidal
attribute [reassoc (attr := simp)] ε_η η_ε μ_δ δ_μ
section
variable (F : C ⥤ D) [F.Monoidal]
/-- The isomorphism `𝟙_ D ≅ F.obj (𝟙_ C)` when `F` is a monoidal functor. -/
@[simps]
def εIso : 𝟙_ D ≅ F.obj (𝟙_ C) where
hom := ε F
inv := η F
/-- The isomorphism `F.obj X ⊗ F.obj Y ≅ F.obj (X ⊗ Y)` when `F` is a monoidal functor. -/
@[simps]
def μIso (X Y : C) : F.obj X ⊗ F.obj Y ≅ F.obj (X ⊗ Y) where
hom := μ F X Y
inv := δ F X Y
instance : IsIso (ε F) := (εIso F).isIso_hom
instance : IsIso (η F) := (εIso F).isIso_inv
instance (X Y : C) : IsIso (μ F X Y) := (μIso F X Y).isIso_hom
instance (X Y : C) : IsIso (δ F X Y) := (μIso F X Y).isIso_inv
@[reassoc (attr := simp)]
lemma map_ε_η (G : D ⥤ C') : G.map (ε F) ≫ G.map (η F) = 𝟙 _ :=
(εIso F).map_hom_inv_id G
@[reassoc (attr := simp)]
lemma map_η_ε (G : D ⥤ C') : G.map (η F) ≫ G.map (ε F) = 𝟙 _ :=
(εIso F).map_inv_hom_id G
@[reassoc (attr := simp)]
lemma map_μ_δ (G : D ⥤ C') (X Y : C) : G.map (μ F X Y) ≫ G.map (δ F X Y) = 𝟙 _ :=
(μIso F X Y).map_hom_inv_id G
@[reassoc (attr := simp)]
lemma map_δ_μ (G : D ⥤ C') (X Y : C) : G.map (δ F X Y) ≫ G.map (μ F X Y) = 𝟙 _ :=
(μIso F X Y).map_inv_hom_id G
@[reassoc (attr := simp)]
lemma whiskerRight_ε_η (T : D) : ε F ▷ T ≫ η F ▷ T = 𝟙 _ := by
rw [← MonoidalCategory.comp_whiskerRight, ε_η, id_whiskerRight]
@[reassoc (attr := simp)]
lemma whiskerRight_η_ε (T : D) : η F ▷ T ≫ ε F ▷ T = 𝟙 _ := by
rw [← MonoidalCategory.comp_whiskerRight, η_ε, id_whiskerRight]
@[reassoc (attr := simp)]
lemma whiskerRight_μ_δ (X Y : C) (T : D) : μ F X Y ▷ T ≫ δ F X Y ▷ T = 𝟙 _ := by
rw [← MonoidalCategory.comp_whiskerRight, μ_δ, id_whiskerRight]
@[reassoc (attr := simp)]
lemma whiskerRight_δ_μ (X Y : C) (T : D) : δ F X Y ▷ T ≫ μ F X Y ▷ T = 𝟙 _ := by
rw [← MonoidalCategory.comp_whiskerRight, δ_μ, id_whiskerRight]
@[reassoc (attr := simp)]
lemma whiskerLeft_ε_η (T : D) : T ◁ ε F ≫ T ◁ η F = 𝟙 _ := by
rw [← MonoidalCategory.whiskerLeft_comp, ε_η, MonoidalCategory.whiskerLeft_id]
@[reassoc (attr := simp)]
lemma whiskerLeft_η_ε (T : D) : T ◁ η F ≫ T ◁ ε F = 𝟙 _ := by
rw [← MonoidalCategory.whiskerLeft_comp, η_ε, MonoidalCategory.whiskerLeft_id]
@[reassoc (attr := simp)]
lemma whiskerLeft_μ_δ (X Y : C) (T : D) : T ◁ μ F X Y ≫ T ◁ δ F X Y = 𝟙 _ := by
rw [← MonoidalCategory.whiskerLeft_comp, μ_δ, MonoidalCategory.whiskerLeft_id]
@[reassoc (attr := simp)]
lemma whiskerLeft_δ_μ (X Y : C) (T : D) : T ◁ δ F X Y ≫ T ◁ μ F X Y = 𝟙 _ := by
rw [← MonoidalCategory.whiskerLeft_comp, δ_μ, MonoidalCategory.whiskerLeft_id]
@[reassoc]
theorem map_tensor {X Y X' Y' : C} (f : X ⟶ Y) (g : X' ⟶ Y') :
F.map (f ⊗ₘ g) = δ F X X' ≫ (F.map f ⊗ₘ F.map g) ≫ μ F Y Y' := by simp
@[reassoc]
theorem map_whiskerLeft (X : C) {Y Z : C} (f : Y ⟶ Z) :
F.map (X ◁ f) = δ F X Y ≫ F.obj X ◁ F.map f ≫ μ F X Z := by simp
@[reassoc]
theorem map_whiskerRight {X Y : C} (f : X ⟶ Y) (Z : C) :
F.map (f ▷ Z) = δ F X Z ≫ F.map f ▷ F.obj Z ≫ μ F Y Z := by simp
@[reassoc]
theorem map_associator (X Y Z : C) :
F.map (α_ X Y Z).hom =
δ F (X ⊗ Y) Z ≫ δ F X Y ▷ F.obj Z ≫
(α_ (F.obj X) (F.obj Y) (F.obj Z)).hom ≫ F.obj X ◁ μ F Y Z ≫ μ F X (Y ⊗ Z) := by
rw [← LaxMonoidal.associativity F, whiskerRight_δ_μ_assoc, δ_μ_assoc]
@[reassoc]
theorem map_associator_inv (X Y Z : C) :
F.map (α_ X Y Z).inv =
δ F X (Y ⊗ Z) ≫ F.obj X ◁ δ F Y Z ≫
(α_ (F.obj X) (F.obj Y) (F.obj Z)).inv ≫ μ F X Y ▷ F.obj Z ≫ μ F (X ⊗ Y) Z := by
rw [← cancel_epi (F.map (α_ X Y Z).hom), Iso.map_hom_inv_id, map_associator,
assoc, assoc, assoc, assoc, OplaxMonoidal.associativity_inv_assoc,
whiskerRight_δ_μ_assoc, δ_μ, comp_id, LaxMonoidal.associativity_inv,
Iso.hom_inv_id_assoc, whiskerRight_δ_μ_assoc, δ_μ]
@[reassoc]
theorem map_leftUnitor (X : C) :
F.map (λ_ X).hom = δ F (𝟙_ C) X ≫ η F ▷ F.obj X ≫ (λ_ (F.obj X)).hom := by simp
@[reassoc]
theorem map_leftUnitor_inv (X : C) :
F.map (λ_ X).inv = (λ_ (F.obj X)).inv ≫ ε F ▷ F.obj X ≫ μ F (𝟙_ C) X := by simp
@[reassoc]
theorem map_rightUnitor (X : C) :
F.map (ρ_ X).hom = δ F X (𝟙_ C) ≫ F.obj X ◁ η F ≫ (ρ_ (F.obj X)).hom := by simp
@[reassoc]
theorem map_rightUnitor_inv (X : C) :
F.map (ρ_ X).inv = (ρ_ (F.obj X)).inv ≫ F.obj X ◁ ε F ≫ μ F X (𝟙_ C) := by simp
@[simp] lemma inv_η : CategoryTheory.inv (η F) = ε F := by
rw [← εIso_hom, ← Iso.comp_inv_eq_id, εIso_inv, IsIso.inv_hom_id]
@[simp] lemma inv_ε : CategoryTheory.inv (ε F) = η F := by simp [← inv_η]
@[simp] lemma inv_μ (X Y : C) : CategoryTheory.inv (μ F X Y) = δ F X Y := by
rw [← Monoidal.μIso_inv, ← CategoryTheory.IsIso.inv_eq_inv]
simp only [IsIso.inv_inv, IsIso.Iso.inv_inv, μIso_hom]
@[simp] lemma inv_δ (X Y : C) : CategoryTheory.inv (δ F X Y) = μ F X Y := by simp [← inv_μ]
/-- The tensorator as a natural isomorphism. -/
@[simps!]
def μNatIso :
Functor.prod F F ⋙ tensor D ≅ tensor C ⋙ F :=
NatIso.ofComponents (fun _ ↦ μIso F _ _)
/-- Monoidal functors commute with left tensoring up to isomorphism -/
@[simps!]
def commTensorLeft (X : C) :
F ⋙ tensorLeft (F.obj X) ≅ tensorLeft X ⋙ F :=
NatIso.ofComponents (fun Y => μIso F X Y)
/-- Monoidal functors commute with right tensoring up to isomorphism -/
@[simps!]
def commTensorRight (X : C) :
F ⋙ tensorRight (F.obj X) ≅ tensorRight X ⋙ F :=
NatIso.ofComponents (fun Y => μIso F Y X)
end
instance : (𝟭 C).Monoidal where
variable (F : C ⥤ D) (G : D ⥤ E)
instance [F.Monoidal] [G.Monoidal] : (F ⋙ G).Monoidal where
ε_η := by simp
η_ε := by simp
μ_δ _ _ := by simp
δ_μ _ _ := by simp
lemma toLaxMonoidal_injective : Function.Injective
(@Monoidal.toLaxMonoidal _ _ _ _ _ _ _ : F.Monoidal → F.LaxMonoidal) := by
intro a b eq
ext1
· exact congr(($eq).ε)
· exact congr(($eq).μ)
· rw [← cancel_epi (εIso _).hom]
rw [εIso_hom, ε_η, ← @ε_η _ _ _ _ _ _ _ a, ← εIso_hom]
exact congr(($eq.symm).ε ≫ _)
· ext
rw [← cancel_epi (μIso F _ _).hom]
rw [μIso_hom, μ_δ, ← @μ_δ _ _ _ _ _ _ _ a, ← μIso_hom]
exact congr(($eq.symm).μ _ _ ≫ _)
lemma toOplaxMonoidal_injective : Function.Injective
(@Monoidal.toOplaxMonoidal _ _ _ _ _ _ _ : F.Monoidal → F.OplaxMonoidal) := by
intro a b eq
ext1
· rw [← cancel_mono (εIso _).inv]
rw [εIso_inv, ε_η, ← @ε_η _ _ _ _ _ _ _ a, ← εIso_inv]
exact congr(_ ≫ ($eq.symm).η)
· ext
rw [← cancel_mono (μIso F _ _).inv]
rw [μIso_inv, μ_δ, ← @μ_δ _ _ _ _ _ _ _ a, ← μIso_inv]
exact congr(_ ≫ ($eq.symm).δ _ _)
· exact congr(($eq).η)
· exact congr(($eq).δ)
end Monoidal
variable (F : C ⥤ D)
/-- Structure which is a helper in order to show that a functor is monoidal. It
consists of isomorphisms `εIso` and `μIso` such that the morphisms `.hom` induced
by these isomorphisms satisfy the axioms of lax monoidal functors. -/
structure CoreMonoidal where
/-- unit morphism -/
εIso : 𝟙_ D ≅ F.obj (𝟙_ C)
/-- tensorator -/
μIso : ∀ X Y : C, F.obj X ⊗ F.obj Y ≅ F.obj (X ⊗ Y)
μIso_hom_natural_left :
∀ {X Y : C} (f : X ⟶ Y) (X' : C),
F.map f ▷ F.obj X' ≫ (μIso Y X').hom = (μIso X X').hom ≫ F.map (f ▷ X') := by
cat_disch
μIso_hom_natural_right :
∀ {X Y : C} (X' : C) (f : X ⟶ Y),
F.obj X' ◁ F.map f ≫ (μIso X' Y).hom = (μIso X' X).hom ≫ F.map (X' ◁ f) := by
cat_disch
/-- associativity of the tensorator -/
associativity :
∀ X Y Z : C,
(μIso X Y).hom ▷ F.obj Z ≫ (μIso (X ⊗ Y) Z).hom ≫ F.map (α_ X Y Z).hom =
(α_ (F.obj X) (F.obj Y) (F.obj Z)).hom ≫ F.obj X ◁ (μIso Y Z).hom ≫
(μIso X (Y ⊗ Z)).hom := by
cat_disch
-- unitality
left_unitality :
∀ X : C, (λ_ (F.obj X)).hom = εIso.hom ▷ F.obj X ≫ (μIso (𝟙_ C) X).hom ≫ F.map (λ_ X).hom := by
cat_disch
right_unitality :
∀ X : C, (ρ_ (F.obj X)).hom = F.obj X ◁ εIso.hom ≫ (μIso X (𝟙_ C)).hom ≫ F.map (ρ_ X).hom := by
cat_disch
namespace CoreMonoidal
attribute [reassoc (attr := simp)] μIso_hom_natural_left
μIso_hom_natural_right associativity
attribute [reassoc] left_unitality right_unitality
variable {F} (h : F.CoreMonoidal)
/-- The lax monoidal functor structure induced by a `Functor.CoreMonoidal` structure. -/
@[simps -isSimp]
def toLaxMonoidal : F.LaxMonoidal where
ε := h.εIso.hom
μ X Y := (h.μIso X Y).hom
left_unitality := h.left_unitality
right_unitality := h.right_unitality
/-- The oplax monoidal functor structure induced by a `Functor.CoreMonoidal` structure. -/
@[simps -isSimp]
def toOplaxMonoidal : F.OplaxMonoidal where
η := h.εIso.inv
δ X Y := (h.μIso X Y).inv
δ_natural_left _ _ := by
rw [← cancel_epi (h.μIso _ _).hom, Iso.hom_inv_id_assoc,
← h.μIso_hom_natural_left_assoc, Iso.hom_inv_id, comp_id]
δ_natural_right _ _ := by
rw [← cancel_epi (h.μIso _ _).hom, Iso.hom_inv_id_assoc,
← h.μIso_hom_natural_right_assoc, Iso.hom_inv_id, comp_id]
oplax_associativity X Y Z := by
rw [← cancel_epi (h.μIso (X ⊗ Y) Z).hom, Iso.hom_inv_id_assoc,
← cancel_epi ((h.μIso X Y).hom ▷ F.obj Z), hom_inv_whiskerRight_assoc,
associativity_assoc, Iso.hom_inv_id_assoc, whiskerLeft_hom_inv, comp_id]
oplax_left_unitality _ := by
rw [← cancel_epi (λ_ _).hom, Iso.hom_inv_id, h.left_unitality, assoc, assoc,
Iso.map_hom_inv_id_assoc, Iso.hom_inv_id_assoc,hom_inv_whiskerRight]
oplax_right_unitality _ := by
rw [← cancel_epi (ρ_ _).hom, Iso.hom_inv_id, h.right_unitality, assoc, assoc,
Iso.map_hom_inv_id_assoc, Iso.hom_inv_id_assoc, whiskerLeft_hom_inv]
attribute [local simp] toLaxMonoidal_ε toLaxMonoidal_μ toOplaxMonoidal_η toOplaxMonoidal_δ in
/-- The monoidal functor structure induced by a `Functor.CoreMonoidal` structure. -/
@[simps! toLaxMonoidal toOplaxMonoidal]
def toMonoidal : F.Monoidal where
toLaxMonoidal := h.toLaxMonoidal
toOplaxMonoidal := h.toOplaxMonoidal
variable (F)
/-- The `Functor.CoreMonoidal` structure given by a lax monoidal functor such
that `ε` and `μ` are isomorphisms. -/
noncomputable def ofLaxMonoidal [F.LaxMonoidal] [IsIso (ε F)] [∀ X Y, IsIso (μ F X Y)] :
F.CoreMonoidal where
εIso := asIso (ε F)
μIso X Y := asIso (μ F X Y)
/-- The `Functor.CoreMonoidal` structure given by an oplax monoidal functor such
that `η` and `δ` are isomorphisms. -/
@[simps]
noncomputable def ofOplaxMonoidal [F.OplaxMonoidal] [IsIso (η F)] [∀ X Y, IsIso (δ F X Y)] :
F.CoreMonoidal where
εIso := (asIso (η F)).symm
μIso X Y := (asIso (δ F X Y)).symm
associativity X Y Z := by
simp [← cancel_epi (δ F X Y ▷ F.obj Z), ← cancel_epi (δ F (X ⊗ Y) Z)]
left_unitality X := by simp [← cancel_epi (λ_ (F.obj X)).inv]
right_unitality X := by simp [← cancel_epi (ρ_ (F.obj X)).inv]
end CoreMonoidal
/-- The `Functor.Monoidal` structure given by a lax monoidal functor such
that `ε` and `μ` are isomorphisms. -/
noncomputable def Monoidal.ofLaxMonoidal
[F.LaxMonoidal] [IsIso (ε F)] [∀ X Y, IsIso (μ F X Y)] :=
(CoreMonoidal.ofLaxMonoidal F).toMonoidal
/-- The `Functor.Monoidal` structure given by an oplax monoidal functor such
that `η` and `δ` are isomorphisms. -/
noncomputable def Monoidal.ofOplaxMonoidal
[F.OplaxMonoidal] [IsIso (η F)] [∀ X Y, IsIso (δ F X Y)] :=
(CoreMonoidal.ofOplaxMonoidal F).toMonoidal
section Prod
variable (F : C ⥤ D) (G : E ⥤ C') [MonoidalCategory C']
section
variable [F.LaxMonoidal] [G.LaxMonoidal]
instance : (prod F G).LaxMonoidal where
ε := (ε F, ε G)
μ X Y := (μ F _ _, μ G _ _)
μ_natural_left _ _ := by
ext
all_goals
simp only [prod_obj, prodMonoidal_tensorObj, prod_map,
prodMonoidal_whiskerRight, prod_comp, μ_natural_left]
μ_natural_right _ _ := by
ext
all_goals
simp only [prod_obj, prodMonoidal_tensorObj, prod_map, prodMonoidal_whiskerLeft, prod_comp,
μ_natural_right]
associativity _ _ _ := by
ext
all_goals
simp only [prod_obj, prodMonoidal_tensorObj, prodMonoidal_whiskerRight,
prodMonoidal_associator, Iso.prod_hom, prod_map, prod_comp,
LaxMonoidal.associativity, prodMonoidal_whiskerLeft]
left_unitality _ := by
ext
all_goals
simp only [prodMonoidal_tensorUnit, prod_obj, prodMonoidal_tensorObj,
prodMonoidal_leftUnitor_hom_fst, LaxMonoidal.left_unitality, prodMonoidal_whiskerRight,
prod_map, prodMonoidal_leftUnitor_hom_snd, prod_comp]
right_unitality _ := by
ext
all_goals
simp only [prod_obj, prodMonoidal_tensorUnit, prodMonoidal_tensorObj,
prodMonoidal_rightUnitor_hom_fst, LaxMonoidal.right_unitality, prodMonoidal_whiskerLeft,
prod_map, prodMonoidal_rightUnitor_hom_snd, prod_comp]
@[simp] lemma prod_ε_fst : (ε (prod F G)).1 = ε F := rfl
@[simp] lemma prod_ε_snd : (ε (prod F G)).2 = ε G := rfl
@[simp] lemma prod_μ_fst (X Y : C × E) : (μ (prod F G) X Y).1 = μ F _ _ := rfl
@[simp] lemma prod_μ_snd (X Y : C × E) : (μ (prod F G) X Y).2 = μ G _ _ := rfl
end
section
variable [F.OplaxMonoidal] [G.OplaxMonoidal]
instance : (prod F G).OplaxMonoidal where
η := (η F, η G)
δ X Y := (δ F _ _, δ G _ _)
@[simp] lemma prod_η_fst : (η (prod F G)).1 = η F := rfl
@[simp] lemma prod_η_snd : (η (prod F G)).2 = η G := rfl
@[simp] lemma prod_δ_fst (X Y : C × E) : (δ (prod F G) X Y).1 = δ F _ _ := rfl
@[simp] lemma prod_δ_snd (X Y : C × E) : (δ (prod F G) X Y).2 = δ G _ _ := rfl
end
instance [F.Monoidal] [G.Monoidal] : (prod F G).Monoidal where
ε_η := by ext <;> apply Monoidal.ε_η
η_ε := by ext <;> apply Monoidal.η_ε
μ_δ _ _ := by ext <;> apply Monoidal.μ_δ
δ_μ _ _ := by ext <;> apply Monoidal.δ_μ
end Prod
instance : (diag C).Monoidal :=
CoreMonoidal.toMonoidal
{ εIso := Iso.refl _
μIso := fun _ _ ↦ Iso.refl _ }
@[simp] lemma diag_ε : ε (diag C) = 𝟙 _ := rfl
@[simp] lemma diag_η : η (diag C) = 𝟙 _ := rfl
@[simp] lemma diag_μ (X Y : C) : μ (diag C) X Y = 𝟙 _ := rfl
@[simp] lemma diag_δ (X Y : C) : δ (diag C) X Y = 𝟙 _ := rfl
section Prod'
variable (F : C ⥤ D) (G : C ⥤ E)
section
variable [F.LaxMonoidal] [G.LaxMonoidal]
/-- The functor `C ⥤ D × E` obtained from two lax monoidal functors is lax monoidal. -/
instance LaxMonoidal.prod' : (prod' F G).LaxMonoidal :=
inferInstanceAs (diag C ⋙ prod F G).LaxMonoidal
@[simp] lemma prod'_ε_fst : (ε (prod' F G)).1 = ε F := by
change _ ≫ F.map (𝟙 _) = _
rw [Functor.map_id, Category.comp_id]
rfl
@[simp] lemma prod'_ε_snd : (ε (prod' F G)).2 = ε G := by
change _ ≫ G.map (𝟙 _) = _
rw [Functor.map_id, Category.comp_id]
rfl
@[simp] lemma prod'_μ_fst (X Y : C) : (μ (prod' F G) X Y).1 = μ F X Y := by
change _ ≫ F.map (𝟙 _) = _
rw [Functor.map_id, Category.comp_id]
rfl
@[simp] lemma prod'_μ_snd (X Y : C) : (μ (prod' F G) X Y).2 = μ G X Y := by
change _ ≫ G.map (𝟙 _) = _
rw [Functor.map_id, Category.comp_id]
rfl
end
section
variable [F.OplaxMonoidal] [G.OplaxMonoidal]
/-- The functor `C ⥤ D × E` obtained from two oplax monoidal functors is oplax monoidal. -/
instance OplaxMonoidal.prod' : (prod' F G).OplaxMonoidal :=
inferInstanceAs (diag C ⋙ prod F G).OplaxMonoidal
@[simp] lemma prod'_η_fst : (η (prod' F G)).1 = η F := by
change F.map (𝟙 _) ≫ _ = _
rw [Functor.map_id, Category.id_comp]
rfl
@[simp] lemma prod'_η_snd : (η (prod' F G)).2 = η G := by
change G.map (𝟙 _) ≫ _ = _
rw [Functor.map_id, Category.id_comp]
rfl
@[simp] lemma prod'_δ_fst (X Y : C) : (δ (prod' F G) X Y).1 = δ F X Y := by
change F.map (𝟙 _) ≫ _ = _
rw [Functor.map_id, Category.id_comp]
rfl
@[simp] lemma prod'_δ_snd (X Y : C) : (δ (prod' F G) X Y).2 = δ G X Y := by
change G.map (𝟙 _) ≫ _ = _
rw [Functor.map_id, Category.id_comp]
rfl
end
@[deprecated (since := "2025-06-08")] alias prod_comp_fst := CategoryTheory.prod_comp_fst
@[deprecated (since := "2025-06-08")] alias prod_comp_snd := CategoryTheory.prod_comp_snd
-- TODO: when clearing these deprecations, remove the `CategoryTheory.` in the proof below.
/-- The functor `C ⥤ D × E` obtained from two monoidal functors is monoidal. -/
instance Monoidal.prod' [F.Monoidal] [G.Monoidal] :
(prod' F G).Monoidal where
-- automation should work, but it is terribly slow
ε_η := by
ext
· simp only [CategoryTheory.prod_comp_fst, prod'_ε_fst, prod'_η_fst, ε_η,
prodMonoidal_tensorUnit, prod_id]
· simp only [CategoryTheory.prod_comp_snd, prod'_ε_snd, prod'_η_snd, ε_η,
prodMonoidal_tensorUnit, prod_id]
η_ε := by
ext
· simp only [CategoryTheory.prod_comp_fst, prod'_ε_fst, prod'_η_fst, η_ε,
prod_id, prod'_obj]
· simp only [CategoryTheory.prod_comp_snd, prod'_ε_snd, prod'_η_snd, η_ε,
prod_id, prod'_obj]
μ_δ _ _ := by
ext
· simp only [CategoryTheory.prod_comp_fst, prod'_μ_fst, prod'_δ_fst, μ_δ,
prod'_obj, prodMonoidal_tensorObj, prod_id]
· simp only [CategoryTheory.prod_comp_snd, prod'_μ_snd, prod'_δ_snd, μ_δ,
prod'_obj, prodMonoidal_tensorObj, prod_id]
δ_μ _ _ := by
ext
· simp only [CategoryTheory.prod_comp_fst, prod'_μ_fst, prod'_δ_fst, δ_μ,
prod'_obj, prod_id]
· simp only [CategoryTheory.prod_comp_snd, prod'_μ_snd, prod'_δ_snd, δ_μ,
prod'_obj, prod_id]
end Prod'
end Functor
namespace Adjunction
variable {F : C ⥤ D} {G : D ⥤ C} (adj : F ⊣ G)
open Functor.OplaxMonoidal Functor.LaxMonoidal
section LaxMonoidal
variable [F.OplaxMonoidal]
/-- The right adjoint of an oplax monoidal functor is lax monoidal. -/
@[simps]
def rightAdjointLaxMonoidal : G.LaxMonoidal where
ε := adj.homEquiv _ _ (η F)
μ X Y := adj.homEquiv _ _ (δ F _ _ ≫ (adj.counit.app X ⊗ₘ adj.counit.app Y))
μ_natural_left {X Y} f X' := by
simp only [Adjunction.homEquiv_apply, ← adj.unit_naturality_assoc, ← G.map_comp, assoc,
← δ_natural_left_assoc F]
suffices F.map (G.map f) ▷ F.obj (G.obj X') ≫ _ =
(adj.counit.app X ⊗ₘ adj.counit.app X') ≫ _ by rw [this]
simpa using NatTrans.whiskerRight_app_tensor_app adj.counit adj.counit (f := f) X'
μ_natural_right {X' Y'} X g := by
simp only [Adjunction.homEquiv_apply, ← adj.unit_naturality_assoc, ← G.map_comp,
assoc, ← δ_natural_right_assoc F]
suffices F.obj (G.obj X) ◁ F.map (G.map g) ≫ _ =
(adj.counit.app X ⊗ₘ adj.counit.app X') ≫ _ by rw [this]
simpa using NatTrans.whiskerLeft_app_tensor_app adj.counit adj.counit (f := g) _
associativity X Y Z := (adj.homEquiv _ _).symm.injective (by
simp only [homEquiv_unit, comp_obj, map_comp, comp_whiskerRight, assoc, homEquiv_counit,
counit_naturality, id_obj, counit_naturality_assoc, left_triangle_components_assoc,
MonoidalCategory.whiskerLeft_comp]
rw [← δ_natural_left_assoc, ← δ_natural_left_assoc, ← δ_natural_left_assoc]
haveI := @NatTrans.whiskerRight_app_tensor_app_assoc _ _ _ _ _ _ _ _ _ adj.counit adj.counit
dsimp only [id_obj, comp_obj, Functor.comp_map, Functor.id_map] at this
rw [this, this, tensorHom_def, assoc, ← comp_whiskerRight_assoc,
left_triangle_components, id_whiskerRight, id_comp,
whisker_exchange_assoc, whisker_exchange_assoc, ← tensorHom_def_assoc,
associator_naturality, OplaxMonoidal.associativity_assoc]
rw [← δ_natural_right_assoc, ← δ_natural_right_assoc, ← δ_natural_right_assoc]
nth_rw 4 [tensorHom_def]
rw [← whisker_exchange, ← MonoidalCategory.whiskerLeft_comp_assoc,
← MonoidalCategory.whiskerLeft_comp_assoc,
← MonoidalCategory.whiskerLeft_comp_assoc, assoc, assoc,
counit_naturality, counit_naturality_assoc, left_triangle_components_assoc,
MonoidalCategory.whiskerLeft_comp, assoc, tensorHom_def, whisker_exchange])
left_unitality X := (adj.homEquiv _ _).symm.injective (by
rw [homEquiv_counit, homEquiv_counit, homEquiv_unit, homEquiv_unit, comp_whiskerRight,
map_comp, map_comp, map_comp, map_comp, map_comp, map_comp, assoc, assoc, assoc, assoc,
assoc, counit_naturality, counit_naturality_assoc, counit_naturality_assoc,
left_triangle_components_assoc, ← δ_natural_left_assoc, ← δ_natural_left_assoc,
tensorHom_def, assoc, ← MonoidalCategory.comp_whiskerRight_assoc,
← MonoidalCategory.comp_whiskerRight_assoc, assoc, counit_naturality,
left_triangle_components_assoc, id_whiskerLeft, assoc, assoc, Iso.inv_hom_id, comp_id,
left_unitality_hom_assoc])
right_unitality X := (adj.homEquiv _ _).symm.injective (by
rw [homEquiv_counit, homEquiv_unit, MonoidalCategory.whiskerLeft_comp, homEquiv_unit,
homEquiv_counit, map_comp, map_comp, map_comp, map_comp, map_comp, map_comp,
assoc, assoc, assoc, assoc, assoc, counit_naturality, counit_naturality_assoc,
counit_naturality_assoc, left_triangle_components_assoc, ← δ_natural_right_assoc,
← δ_natural_right_assoc, tensorHom_def, assoc, ← whisker_exchange_assoc,
← MonoidalCategory.whiskerLeft_comp_assoc, ← MonoidalCategory.whiskerLeft_comp_assoc,
assoc, counit_naturality, left_triangle_components_assoc, MonoidalCategory.whiskerRight_id,
assoc, assoc, Iso.inv_hom_id, comp_id, right_unitality_hom_assoc])
/-- When `adj : F ⊣ G` is an adjunction, with `F` oplax monoidal and `G` lax-monoidal,
this typeclass expresses compatibilities between the adjunction and the (op)lax
monoidal structures. -/
class IsMonoidal [G.LaxMonoidal] : Prop where
leftAdjoint_ε : ε G = adj.homEquiv _ _ (η F) := by cat_disch
leftAdjoint_μ (X Y : D) :
μ G X Y = adj.homEquiv _ _ (δ F _ _ ≫ (adj.counit.app X ⊗ₘ adj.counit.app Y)) := by cat_disch
instance :
letI := adj.rightAdjointLaxMonoidal
adj.IsMonoidal := by
letI := adj.rightAdjointLaxMonoidal
constructor
· rfl
· intro _ _
rfl
variable [G.LaxMonoidal] [adj.IsMonoidal]
@[reassoc]
lemma unit_app_unit_comp_map_η : adj.unit.app (𝟙_ C) ≫ G.map (η F) = ε G :=
Adjunction.IsMonoidal.leftAdjoint_ε.symm
@[reassoc]
lemma unit_app_tensor_comp_map_δ (X Y : C) :
adj.unit.app (X ⊗ Y) ≫ G.map (δ F X Y) = (adj.unit.app X ⊗ₘ adj.unit.app Y) ≫ μ G _ _ := by
rw [IsMonoidal.leftAdjoint_μ (adj := adj), homEquiv_unit]
dsimp
simp [← adj.unit_naturality_assoc, ← Functor.map_comp, ← δ_natural_assoc]
@[reassoc]
lemma map_ε_comp_counit_app_unit : F.map (ε G) ≫ adj.counit.app (𝟙_ D) = η F := by
rw [IsMonoidal.leftAdjoint_ε (adj := adj), homEquiv_unit, map_comp,
assoc, counit_naturality, left_triangle_components_assoc]
@[reassoc]
lemma map_μ_comp_counit_app_tensor (X Y : D) :
F.map (μ G X Y) ≫ adj.counit.app (X ⊗ Y) =
δ F _ _ ≫ (adj.counit.app X ⊗ₘ adj.counit.app Y) := by
rw [IsMonoidal.leftAdjoint_μ (adj := adj), homEquiv_unit]
simp
instance : (Adjunction.id (C := C)).IsMonoidal where
leftAdjoint_ε := by simp [id, homEquiv]
leftAdjoint_μ := by simp [id, homEquiv]
instance isMonoidal_comp {F' : D ⥤ E} {G' : E ⥤ D} (adj' : F' ⊣ G')
[F'.OplaxMonoidal] [G'.LaxMonoidal] [adj'.IsMonoidal] : (adj.comp adj').IsMonoidal where
leftAdjoint_ε := by
dsimp [homEquiv]
rw [← adj.unit_app_unit_comp_map_η, ← adj'.unit_app_unit_comp_map_η,
assoc, comp_unit_app, assoc, ← Functor.map_comp,
← adj'.unit_naturality_assoc, ← map_comp, ← map_comp]
leftAdjoint_μ X Y := by
apply ((adj.comp adj').homEquiv _ _).symm.injective
dsimp only [comp_obj, comp_μ, id_obj, comp_δ]
rw [Equiv.symm_apply_apply]
dsimp [homEquiv]
rw [comp_counit_app, comp_counit_app, comp_counit_app, assoc, ← tensorHom_comp_tensorHom,
δ_natural_assoc]
dsimp
rw [← adj'.map_μ_comp_counit_app_tensor, ← map_comp_assoc, ← map_comp_assoc,
← map_comp_assoc, ← adj.map_μ_comp_counit_app_tensor, assoc,
F.map_comp_assoc, counit_naturality]
end LaxMonoidal
section Monoidal
variable [F.Monoidal] [G.Monoidal] [adj.IsMonoidal]
@[reassoc]
lemma ε_comp_map_ε : ε G ≫ G.map (ε F) = adj.unit.app (𝟙_ C) := by
simp [← adj.unit_app_unit_comp_map_η]
@[reassoc]
lemma map_η_comp_η : F.map (η G) ≫ η F = adj.counit.app (𝟙_ D) := by
simp [← adj.map_ε_comp_counit_app_unit]
end Monoidal
end Adjunction
namespace Equivalence
variable (e : C ≌ D)
instance [e.inverse.Monoidal] : e.symm.functor.Monoidal := inferInstanceAs (e.inverse.Monoidal)
instance [e.functor.Monoidal] : e.symm.inverse.Monoidal := inferInstanceAs (e.functor.Monoidal)
/-- If a monoidal functor `F` is an equivalence of categories then its inverse is also monoidal. -/
noncomputable def inverseMonoidal [e.functor.Monoidal] : e.inverse.Monoidal := by
letI := e.toAdjunction.rightAdjointLaxMonoidal
have : IsIso (LaxMonoidal.ε e.inverse) := by
simp only [this, Adjunction.rightAdjointLaxMonoidal_ε, Adjunction.homEquiv_unit]
infer_instance
have : ∀ (X Y : D), IsIso (LaxMonoidal.μ e.inverse X Y) := fun X Y ↦ by
simp only [Adjunction.rightAdjointLaxMonoidal_μ, Adjunction.homEquiv_unit]
infer_instance
apply Monoidal.ofLaxMonoidal
/-- An equivalence of categories involving monoidal functors is monoidal if the underlying
adjunction satisfies certain compatibilities with respect to the monoidal functor data. -/
abbrev IsMonoidal [e.functor.Monoidal] [e.inverse.Monoidal] : Prop := e.toAdjunction.IsMonoidal
example [e.functor.Monoidal] : letI := e.inverseMonoidal; e.IsMonoidal := inferInstance
variable [e.functor.Monoidal] [e.inverse.Monoidal] [e.IsMonoidal]
open Functor.LaxMonoidal Functor.OplaxMonoidal
@[reassoc]
lemma unitIso_hom_app_comp_inverse_map_η_functor :
e.unitIso.hom.app (𝟙_ C) ≫ e.inverse.map (η e.functor) = ε e.inverse :=
e.toAdjunction.unit_app_unit_comp_map_η
@[reassoc]
lemma unitIso_hom_app_tensor_comp_inverse_map_δ_functor (X Y : C) :
e.unitIso.hom.app (X ⊗ Y) ≫ e.inverse.map (δ e.functor X Y) =
(e.unitIso.hom.app X ⊗ₘ e.unitIso.hom.app Y) ≫ μ e.inverse _ _ :=
e.toAdjunction.unit_app_tensor_comp_map_δ X Y
@[reassoc]
lemma functor_map_ε_inverse_comp_counitIso_hom_app :
e.functor.map (ε e.inverse) ≫ e.counitIso.hom.app (𝟙_ D) = η e.functor :=
e.toAdjunction.map_ε_comp_counit_app_unit
@[reassoc]
lemma functor_map_μ_inverse_comp_counitIso_hom_app_tensor (X Y : D) :
e.functor.map (μ e.inverse X Y) ≫ e.counitIso.hom.app (X ⊗ Y) =
δ e.functor _ _ ≫ (e.counitIso.hom.app X ⊗ₘ e.counitIso.hom.app Y) :=
e.toAdjunction.map_μ_comp_counit_app_tensor X Y
@[reassoc]
lemma counitIso_inv_app_comp_functor_map_η_inverse :
e.counitIso.inv.app (𝟙_ D) ≫ e.functor.map (η e.inverse) = ε e.functor := by
rw [← cancel_epi (η e.functor), Monoidal.η_ε, ← functor_map_ε_inverse_comp_counitIso_hom_app,
Category.assoc, Iso.hom_inv_id_app_assoc, Monoidal.map_ε_η]
@[reassoc]
lemma counitIso_inv_app_tensor_comp_functor_map_δ_inverse (X Y : C) :
e.counitIso.inv.app (e.functor.obj X ⊗ e.functor.obj Y) ≫
e.functor.map (δ e.inverse (e.functor.obj X) (e.functor.obj Y)) =
μ e.functor X Y ≫ e.functor.map (e.unitIso.hom.app X ⊗ₘ e.unitIso.hom.app Y) := by
rw [← cancel_epi (δ e.functor _ _), Monoidal.δ_μ_assoc]
apply e.inverse.map_injective
simp [← cancel_epi (e.unitIso.hom.app (X ⊗ Y)), Functor.map_comp,
unitIso_hom_app_tensor_comp_inverse_map_δ_functor_assoc]
@[reassoc]
lemma unit_app_comp_inverse_map_η_functor :
e.unit.app (𝟙_ C) ≫ e.inverse.map (η e.functor) = ε e.inverse :=
e.toAdjunction.unit_app_unit_comp_map_η
@[reassoc]
lemma unit_app_tensor_comp_inverse_map_δ_functor (X Y : C) :
e.unit.app (X ⊗ Y) ≫ e.inverse.map (δ e.functor X Y) =
(e.unit.app X ⊗ₘ e.unitIso.hom.app Y) ≫ μ e.inverse _ _ :=
e.toAdjunction.unit_app_tensor_comp_map_δ X Y
@[reassoc (attr := simp)]
lemma functor_map_ε_inverse_comp_counit_app :
e.functor.map (ε e.inverse) ≫ e.counit.app (𝟙_ D) = η e.functor :=
e.toAdjunction.map_ε_comp_counit_app_unit
@[reassoc]
lemma functor_map_μ_inverse_comp_counit_app_tensor (X Y : D) :
e.functor.map (μ e.inverse X Y) ≫ e.counit.app (X ⊗ Y) =
δ e.functor _ _ ≫ (e.counit.app X ⊗ₘ e.counit.app Y) :=
e.toAdjunction.map_μ_comp_counit_app_tensor X Y
@[reassoc]
lemma counitInv_app_comp_functor_map_η_inverse :
e.counitInv.app (𝟙_ D) ≫ e.functor.map (η e.inverse) = ε e.functor := by
rw [← cancel_epi (η e.functor), Monoidal.η_ε, ← functor_map_ε_inverse_comp_counitIso_hom_app,
Category.assoc, Iso.hom_inv_id_app_assoc, Monoidal.map_ε_η]
@[reassoc]
lemma counitInv_app_tensor_comp_functor_map_δ_inverse (X Y : C) :
e.counitInv.app (e.functor.obj X ⊗ e.functor.obj Y) ≫
e.functor.map (δ e.inverse (e.functor.obj X) (e.functor.obj Y)) =
μ e.functor X Y ≫ e.functor.map (e.unitIso.hom.app X ⊗ₘ e.unitIso.hom.app Y) :=
counitIso_inv_app_tensor_comp_functor_map_δ_inverse e X Y
@[reassoc (attr := simp)]
lemma ε_comp_map_ε : ε e.inverse ≫ e.inverse.map (ε e.functor) = e.unit.app (𝟙_ C) :=
e.toAdjunction.ε_comp_map_ε
@[reassoc (attr := simp)]
lemma map_η_comp_η : e.functor.map (η e.inverse) ≫ η e.functor = e.counit.app (𝟙_ D) :=
e.toAdjunction.map_η_comp_η
instance : (refl (C := C)).functor.Monoidal := inferInstanceAs (𝟭 C).Monoidal
instance : (refl (C := C)).inverse.Monoidal := inferInstanceAs (𝟭 C).Monoidal
/-- The obvious auto-equivalence of a monoidal category is monoidal. -/
instance isMonoidal_refl : (Equivalence.refl (C := C)).IsMonoidal :=
inferInstanceAs (Adjunction.id (C := C)).IsMonoidal
/-- The inverse of a monoidal category equivalence is also a monoidal category equivalence. -/
instance isMonoidal_symm [e.inverse.Monoidal] [e.IsMonoidal] :
e.symm.IsMonoidal where
leftAdjoint_ε := by
simp only [toAdjunction, Adjunction.homEquiv_unit]
dsimp [symm]
rw [counitIso_inv_app_comp_functor_map_η_inverse]
leftAdjoint_μ X Y := by
simp only [toAdjunction, Adjunction.homEquiv_unit]
dsimp [symm]
rw [map_comp, counitIso_inv_app_tensor_comp_functor_map_δ_inverse_assoc]
simp [← map_comp]
section
variable (e' : D ≌ E)
instance [e'.functor.Monoidal] : (e.trans e').functor.Monoidal :=
inferInstanceAs (e.functor ⋙ e'.functor).Monoidal
instance [e'.inverse.Monoidal] : (e.trans e').inverse.Monoidal :=
inferInstanceAs (e'.inverse ⋙ e.inverse).Monoidal
/-- The composition of two monoidal category equivalences is monoidal. -/
instance isMonoidal_trans [e'.functor.Monoidal] [e'.inverse.Monoidal] [e'.IsMonoidal] :
(e.trans e').IsMonoidal := by
dsimp [Equivalence.IsMonoidal]
rw [trans_toAdjunction]
infer_instance
end
end Equivalence
variable (C D)
/-- Bundled version of lax monoidal functors. This type is equipped with a category
structure in `CategoryTheory.Monoidal.NaturalTransformation`. -/
structure LaxMonoidalFunctor extends C ⥤ D where
laxMonoidal : toFunctor.LaxMonoidal := by infer_instance
namespace LaxMonoidalFunctor
attribute [instance] laxMonoidal
variable {C D}
/-- Constructor for `LaxMonoidalFunctor C D`. -/
@[simps toFunctor]
def of (F : C ⥤ D) [F.LaxMonoidal] : LaxMonoidalFunctor C D where
toFunctor := F
end LaxMonoidalFunctor
namespace Functor.Monoidal
variable {C D}
/--
Auxiliary definition for `Functor.Monoidal.transport`
-/
@[simps!]
def coreMonoidalTransport {F G : C ⥤ D} [F.Monoidal] (i : F ≅ G) : G.CoreMonoidal where
εIso := εIso F ≪≫ i.app _
μIso X Y := tensorIso (i.symm.app _) (i.symm.app _) ≪≫ μIso F X Y ≪≫ i.app _
μIso_hom_natural_left _ _ := by simp [NatTrans.whiskerRight_app_tensor_app_assoc]
μIso_hom_natural_right _ _ := by simp [NatTrans.whiskerLeft_app_tensor_app_assoc]
associativity X Y Z := by
simp only [Iso.trans_hom, tensorIso_hom, Iso.app_hom, Iso.symm_hom, μIso_hom, comp_whiskerRight,
Category.assoc, MonoidalCategory.whiskerLeft_comp]
rw [← i.hom.naturality, map_associator_assoc, Functor.OplaxMonoidal.associativity_assoc,
whiskerLeft_δ_μ_assoc, δ_μ_assoc]
simp only [← Category.assoc]
congr 1
slice_lhs 3 4 =>
rw [← tensorHom_id, tensorHom_comp_tensorHom]
simp only [Iso.hom_inv_id_app, Category.id_comp, id_tensorHom]
simp only [Category.assoc]
rw [← whisker_exchange_assoc]
simp only [tensor_whiskerLeft, Functor.LaxMonoidal.associativity, Category.assoc,
Iso.inv_hom_id_assoc]
rw [← tensorHom_id, associator_naturality_assoc]
simp [← id_tensorHom, -tensorHom_id]
left_unitality X := by
simp only [Iso.trans_hom, εIso_hom, Iso.app_hom, ← tensorHom_id, tensorIso_hom, Iso.symm_hom,
μIso_hom, Category.assoc, tensorHom_comp_tensorHom_assoc, Iso.hom_inv_id_app,
Category.comp_id, Category.id_comp]
rw [← i.hom.naturality, ← Category.comp_id (i.inv.app X),
← Category.id_comp (Functor.LaxMonoidal.ε F), ← tensorHom_comp_tensorHom]
simp
right_unitality X := by
simp only [Iso.trans_hom, εIso_hom, Iso.app_hom, ← id_tensorHom, tensorIso_hom, Iso.symm_hom,
μIso_hom, Category.assoc, tensorHom_comp_tensorHom_assoc, Category.id_comp,
Iso.hom_inv_id_app, Category.comp_id]
rw [← i.hom.naturality, ← Category.comp_id (i.inv.app X),
← Category.id_comp (Functor.LaxMonoidal.ε F), ← tensorHom_comp_tensorHom]
simp
/--
Transport the structure of a monoidal functor along a natural isomorphism of functors.
-/
def transport {F G : C ⥤ D} [F.Monoidal] (i : F ≅ G) : G.Monoidal :=
(coreMonoidalTransport i).toMonoidal
@[reassoc]
lemma transport_ε {F G : C ⥤ D} [F.Monoidal] (i : F ≅ G) : letI := transport i
LaxMonoidal.ε G = LaxMonoidal.ε F ≫ i.hom.app (𝟙_ C) :=
rfl
@[reassoc]
lemma transport_η {F G : C ⥤ D} [F.Monoidal] (i : F ≅ G) : letI := transport i
OplaxMonoidal.η G = i.inv.app (𝟙_ C) ≫ OplaxMonoidal.η F :=
rfl
@[reassoc]
lemma transport_μ {F G : C ⥤ D} [F.Monoidal] (i : F ≅ G) (X Y : C) : letI := transport i
LaxMonoidal.μ G X Y = (i.inv.app X ⊗ₘ i.inv.app Y) ≫ LaxMonoidal.μ F X Y ≫ i.hom.app (X ⊗ Y) :=
rfl
@[reassoc]
lemma transport_δ {F G : C ⥤ D} [F.Monoidal] (i : F ≅ G) (X Y : C) : letI := transport i
OplaxMonoidal.δ G X Y =
i.inv.app (X ⊗ Y) ≫ OplaxMonoidal.δ F X Y ≫ (i.hom.app X ⊗ₘ i.hom.app Y) :=
coreMonoidalTransport_μIso_inv _ _ _
end Functor.Monoidal
end CategoryTheory |
.lake/packages/mathlib/Mathlib/CategoryTheory/Monoidal/Multifunctor.lean | import Mathlib.CategoryTheory.Monoidal.Functor
/-!
# Constructing monoidal functors from natural transformations between multifunctors
This file provides alternative constructors for (op/lax) monoidal functors, given tensorators
`μ : F - ⊗ F - ⟶ F (- ⊗ -)` / `δ : F (- ⊗ -) ⟶ F - ⊗ F -` as natural transformations between
bifunctors. The associativity conditions are phrased as equalities of natural transformations
between trifunctors `(F - ⊗ F -) ⊗ F - ⟶ F (- ⊗ (- ⊗ -))` / `F ((- ⊗ -) ⊗ -) ⟶ F - ⊗ (F - ⊗ F -)`,
and the unitality conditions are phrased as equalities of natural transformation between functors.
Once we have more API for quadrifunctors, we can add constructors for monoidal category structures
by phrasing the pentagon axiom as an equality of natural transformations between quadrifunctors.
-/
namespace CategoryTheory
variable {C : Type*} [Category C] [MonoidalCategory C]
{D : Type*} [Category D] [MonoidalCategory D]
namespace MonoidalCategory
open Functor
/-- The bifunctor `(F -) ⊗ -`. -/
abbrev curriedTensorInsertFunctor₁ (F : C ⥤ D) : C ⥤ D ⥤ D :=
(((whiskeringLeft₂ _).obj F).obj (𝟭 D)).obj (curriedTensor D)
/-- The bifunctor `- ⊗ (F -)`. -/
abbrev curriedTensorInsertFunctor₂ (F : C ⥤ D) : D ⥤ C ⥤ D :=
(((whiskeringLeft₂ _).obj (𝟭 D)).obj F).obj (curriedTensor D)
/-- The bifunctor `F - ⊗ F -`. -/
abbrev curriedTensorPre (F : C ⥤ D) : C ⥤ C ⥤ D :=
(whiskeringLeft₂ _).obj F |>.obj F |>.obj (curriedTensor D)
/-- The bifunctor `F (- ⊗ -)`. -/
abbrev curriedTensorPost (F : C ⥤ D) : C ⥤ C ⥤ D :=
(Functor.postcompose₂.obj F).obj (curriedTensor C)
/-- The trifunctor `(F - ⊗ F -) ⊗ F -`. -/
abbrev curriedTensorPrePre (F : C ⥤ D) : C ⥤ C ⥤ C ⥤ D :=
bifunctorComp₁₂ (curriedTensorPre F) (curriedTensorInsertFunctor₂ F)
/-- The trifunctor `F - ⊗ (F - ⊗ F -)`. -/
abbrev curriedTensorPrePre' (F : C ⥤ D) : C ⥤ C ⥤ C ⥤ D :=
bifunctorComp₂₃ (curriedTensorInsertFunctor₁ F) (curriedTensorPre F)
/-- The trifunctor `F (- ⊗ -) ⊗ F -`. -/
abbrev curriedTensorPostPre (F : C ⥤ D) : C ⥤ C ⥤ C ⥤ D :=
bifunctorComp₁₂ (curriedTensor C) (curriedTensorPre F)
/-- The trifunctor `F - ⊗ F (- ⊗ -)`. -/
abbrev curriedTensorPrePost (F : C ⥤ D) : C ⥤ C ⥤ C ⥤ D :=
bifunctorComp₂₃ (curriedTensorPre F) (curriedTensor C)
/-- The trifunctor `F ((- ⊗ -) ⊗ -)` -/
abbrev curriedTensorPostPost (F : C ⥤ D) : C ⥤ C ⥤ C ⥤ D :=
bifunctorComp₁₂ (curriedTensor C) (curriedTensorPost F)
/-- The trifunctor `F (- ⊗ (- ⊗ -))` -/
abbrev curriedTensorPostPost' (F : C ⥤ D) : C ⥤ C ⥤ C ⥤ D :=
bifunctorComp₂₃ (curriedTensorPost F) (curriedTensor C)
end MonoidalCategory
open MonoidalCategory
namespace Functor.LaxMonoidal
/-!
## Lax monoidal functors
Given a unit morphism `ε : 𝟙_ D ⟶ F.obj (𝟙_ C))` and a tensorator `μ : F - ⊗ F - ⟶ F (- ⊗ -)`
such that the diagrams below commute, we define
`CategoryTheory.Functor.LaxMonoidal.ofBifunctor : F.LaxMonoidal`.
### Associativity hexagon
```
(F - ⊗ F -) ⊗ F -
/ \
v v
F (- ⊗ -) ⊗ F - F - ⊗ (F - ⊗ F -)
| |
v v
F ((- ⊗ -) ⊗ -) F - ⊗ F (- ⊗ -)
\ /
v v
F (- ⊗ (- ⊗ -))
```
### Left unitality square
```
𝟙 ⊗ F - ⟶ F 𝟙 ⊗ F -
| |
v v
F ← F (𝟙 ⊗ -)
```
### Right unitality square
```
F - ⊗ 𝟙 ⟶ F - ⊗ F 𝟙
| |
v v
F ← F (- ⊗ 𝟙)
```
-/
namespace ofBifunctor
/--
The top left map in the associativity hexagon.
-/
@[simps!]
def firstMap₁ {F : C ⥤ D} (μ : curriedTensorPre F ⟶ curriedTensorPost F) :
curriedTensorPrePre F ⟶ curriedTensorPostPre F :=
(bifunctorComp₁₂Functor.map μ).app (curriedTensorInsertFunctor₂ F)
/--
The middle left map in the associativity hexagon.
-/
@[simps!]
def firstMap₂ {F : C ⥤ D} (μ : curriedTensorPre F ⟶ curriedTensorPost F) :
(curriedTensorPostPre F) ⟶ curriedTensorPostPost F :=
(bifunctorComp₁₂Functor.obj _).map μ
/--
The bottom left map in the associativity hexagon.
-/
@[simps!]
def firstMap₃ (F : C ⥤ D) : curriedTensorPostPost F ⟶ curriedTensorPostPost' F :=
(postcompose₃.obj _).map (curriedAssociatorNatIso _).hom
/--
The composition of the left maps in the associativity hexagon.
-/
@[simps!]
def firstMap {F : C ⥤ D} (μ : curriedTensorPre F ⟶ curriedTensorPost F) :
curriedTensorPrePre F ⟶ curriedTensorPostPost' F :=
firstMap₁ μ ≫ firstMap₂ μ ≫ firstMap₃ F
/--
The top right map in the associativity hexagon.
-/
@[simps!]
def secondMap₁ (F : C ⥤ D) : curriedTensorPrePre F ⟶ curriedTensorPrePre' F :=
((((whiskeringLeft₃ D).obj F).obj F).obj F).map (curriedAssociatorNatIso D).hom
/--
The middle right map in the associativity hexagon.
-/
@[simps!]
def secondMap₂ {F : C ⥤ D} (μ : curriedTensorPre F ⟶ curriedTensorPost F) :
curriedTensorPrePre' F ⟶ curriedTensorPrePost F :=
(bifunctorComp₂₃Functor.obj _).map μ
/--
The bottom right map in the associativity hexagon.
-/
@[simps!]
def secondMap₃ {F : C ⥤ D} (μ : curriedTensorPre F ⟶ curriedTensorPost F) :
curriedTensorPrePost F ⟶ curriedTensorPostPost' F :=
(bifunctorComp₂₃Functor.map μ).app _
/--
The composition of the right maps in the associativity hexagon.
-/
@[simps!]
def secondMap {F : C ⥤ D} (μ : curriedTensorPre F ⟶ curriedTensorPost F) :
curriedTensorPrePre F ⟶ curriedTensorPostPost' F :=
secondMap₁ F ≫ secondMap₂ μ ≫ secondMap₃ μ
/--
The left map in the left unitality square.
-/
@[simps!]
def leftMapₗ (F : C ⥤ D) : F ⋙ tensorUnitLeft D ⟶ F :=
whiskerLeft F (leftUnitorNatIso D).hom
/--
The top map in the left unitality square.
-/
@[simps!]
def topMapₗ {F : C ⥤ D} (ε : 𝟙_ D ⟶ F.obj (𝟙_ C)) :
F ⋙ tensorUnitLeft D ⟶ (curriedTensorPre F).obj (𝟙_ C) :=
whiskerLeft F ((curriedTensor _).map ε )
/--
The bottom map in the left unitality square.
-/
@[simps!]
def bottomMapₗ (F : C ⥤ D) : (curriedTensor C).obj (𝟙_ C) ⋙ F ⟶ F :=
whiskerRight (leftUnitorNatIso C).hom F
/--
The left map in the right unitality square.
-/
@[simps!]
def leftMapᵣ (F : C ⥤ D) : F ⋙ tensorUnitRight D ⟶ F :=
whiskerLeft F (rightUnitorNatIso D).hom
/--
The top map in the right unitality square.
-/
@[simps!]
def topMapᵣ {F : C ⥤ D} (ε : 𝟙_ D ⟶ F.obj (𝟙_ C)) :
F ⋙ tensorUnitRight D ⟶ (curriedTensorPre F).flip.obj (𝟙_ C) :=
whiskerLeft F ((curriedTensor _).flip.map ε)
/--
The bottom map in the right unitality square.
-/
@[simps!]
def bottomMapᵣ (F : C ⥤ D) : (curriedTensor C).flip.obj (𝟙_ C) ⋙ F ⟶ F :=
whiskerRight (rightUnitorNatIso C).hom F
end ofBifunctor
open ofBifunctor
variable {F : C ⥤ D}
/- unit morphism -/
(ε : 𝟙_ D ⟶ F.obj (𝟙_ C))
/- tensorator as a morphism of bifunctors -/
(μ : curriedTensorPre F ⟶ curriedTensorPost F)
/- the associativity hexagon commutes -/
(associativity : firstMap μ = secondMap μ)
/- the left unitality square commutes -/
(left_unitality : leftMapₗ F = topMapₗ ε ≫ μ.app (𝟙_ C) ≫ bottomMapₗ F)
/- the right unitality square commutes -/
(right_unitality : leftMapᵣ F =
topMapᵣ ε ≫ ((flipFunctor _ _ _).map μ).app (𝟙_ C) ≫ bottomMapᵣ F)
/--
`F` is lax monoidal given a unit morphism `ε : 𝟙_ D ⟶ F.obj (𝟙_ C))` and a tensorator
`μ : F - ⊗ F - ⟶ F (- ⊗ -)` as a natural transformation between bifunctors, satisfying the
relevant compatibilities.
-/
def ofBifunctor : F.LaxMonoidal where
ε := ε
μ X Y := (μ.app X).app Y
μ_natural_left f X := NatTrans.congr_app (μ.naturality f) X
μ_natural_right X f := (μ.app X).naturality f
associativity X Y Z :=
NatTrans.congr_app (NatTrans.congr_app (NatTrans.congr_app associativity X) Y) Z
left_unitality X := NatTrans.congr_app left_unitality X
right_unitality X := NatTrans.congr_app right_unitality X
end LaxMonoidal
namespace OplaxMonoidal
/-!
## Oplax monoidal functors
Given a counit morphism `η : F.obj (𝟙_ C)) ⟶ 𝟙_ D` and a tensorator `δ : F (- ⊗ -) ⟶ F - ⊗ F -`
such that the diagrams below commute, we define
`CategoryTheory.Functor.OplaxMonoidal.ofBifunctor : F.OplaxMonoidal`.
### Oplax associativity hexagon
```
F ((- ⊗ -) ⊗ -)
/ \
v v
F (- ⊗ -) ⊗ F - F (- ⊗ (- ⊗ -))
| |
v v
(F - ⊗ F -) ⊗ F - F - ⊗ F (- ⊗ -)
\ /
v v
F - ⊗ (F - ⊗ F -)
```
### Oplax left unitality square
```
F ⟶ F (𝟙 ⊗ -)
| |
v v
𝟙 ⊗ F - ← F 𝟙 ⊗ F -
```
### Oplax right unitality square
```
F ⟶ F (- ⊗ 𝟙)
| |
v v
F - ⊗ 𝟙 ← F - ⊗ F 𝟙
```
-/
namespace ofBifunctor
/--
The top left map in the oplax associativity hexagon.
-/
@[simps!]
def firstMap₁ {F : C ⥤ D} (δ : curriedTensorPost F ⟶ curriedTensorPre F) :
curriedTensorPostPost F ⟶ curriedTensorPostPre F :=
(bifunctorComp₁₂Functor.obj (curriedTensor C)).map δ
/--
The middle left map in the oplax associativity hexagon.
-/
@[simps!]
def firstMap₂ {F : C ⥤ D} (δ : curriedTensorPost F ⟶ curriedTensorPre F) :
(curriedTensorPostPre F) ⟶ curriedTensorPrePre F :=
(bifunctorComp₁₂Functor.map δ).app (curriedTensorInsertFunctor₂ F)
/--
The bottom left map in the oplax associativity hexagon.
-/
@[simps!]
def firstMap₃ (F : C ⥤ D) : curriedTensorPrePre F ⟶ curriedTensorPrePre' F :=
((((whiskeringLeft₃ D).obj F).obj F).obj F).map (curriedAssociatorNatIso D).hom
/--
The composition of the three left maps in the oplax associativity hexagon.
-/
@[simps!]
def firstMap {F : C ⥤ D} (δ : curriedTensorPost F ⟶ curriedTensorPre F) :
curriedTensorPostPost F ⟶ curriedTensorPrePre' F :=
firstMap₁ δ ≫ firstMap₂ δ ≫ firstMap₃ F
/--
The top right map in the oplax associativity hexagon.
-/
@[simps!]
def secondMap₁ (F : C ⥤ D) : curriedTensorPostPost F ⟶ curriedTensorPostPost' F :=
(postcompose₃.obj _).map (curriedAssociatorNatIso _).hom
/--
The middle right map in the oplax associativity hexagon.
-/
@[simps!]
def secondMap₂ {F : C ⥤ D} (δ : curriedTensorPost F ⟶ curriedTensorPre F) :
curriedTensorPostPost' F ⟶ curriedTensorPrePost F :=
(bifunctorComp₂₃Functor.map δ).app _
/--
The bottom right map in the oplax associativity hexagon.
-/
@[simps!]
def secondMap₃ {F : C ⥤ D} (δ : curriedTensorPost F ⟶ curriedTensorPre F) :
curriedTensorPrePost F ⟶ curriedTensorPrePre' F :=
(bifunctorComp₂₃Functor.obj (curriedTensorInsertFunctor₁ F)).map δ
/--
The composition of the three right maps in the oplax associativity hexagon.
-/
@[simps!]
def secondMap {F : C ⥤ D} (δ : curriedTensorPost F ⟶ curriedTensorPre F) :
curriedTensorPostPost F ⟶ curriedTensorPrePre' F :=
secondMap₁ F ≫ secondMap₂ δ ≫ secondMap₃ δ
/--
The left map in the oplax left unitality square.
-/
@[simps!]
def leftMapₗ (F : C ⥤ D) : F ⟶ F ⋙ tensorUnitLeft D :=
whiskerLeft F (leftUnitorNatIso D).inv
/--
The top map in the oplax left unitality square.
-/
@[simps!]
def topMapₗ (F : C ⥤ D) : F ⟶ (curriedTensor C).obj (𝟙_ C) ⋙ F :=
whiskerRight (leftUnitorNatIso C).inv F
/--
The bottom map in the oplax left unitality square.
-/
@[simps!]
def bottomMapₗ {F : C ⥤ D} (η : F.obj (𝟙_ C) ⟶ 𝟙_ D) :
(curriedTensorPre F).obj (𝟙_ C) ⟶ F ⋙ tensorUnitLeft D :=
whiskerLeft F ((curriedTensor _).map η)
/--
The left map in the oplax right unitality square.
-/
@[simps!]
def leftMapᵣ (F : C ⥤ D) : F ⟶ F ⋙ tensorUnitRight D :=
whiskerLeft F (rightUnitorNatIso D).inv
/--
The top map in the oplax right unitality square.
-/
@[simps!]
def topMapᵣ (F : C ⥤ D) : F ⟶ (curriedTensor C).flip.obj (𝟙_ C) ⋙ F :=
whiskerRight (rightUnitorNatIso C).inv F
/--
The bottom map in the oplax right unitality square.
-/
@[simps!]
def bottomMapᵣ {F : C ⥤ D} (η : F.obj (𝟙_ C) ⟶ 𝟙_ D) :
(curriedTensorPre F).flip.obj (𝟙_ C) ⟶ F ⋙ tensorUnitRight D :=
whiskerLeft F ((curriedTensor _).flip.map η)
end ofBifunctor
open ofBifunctor
variable {F : C ⥤ D}
/- counit morphism -/
(η : F.obj (𝟙_ C) ⟶ 𝟙_ D)
/- tensorator as a morphism of bifunctors -/
(δ : curriedTensorPost F ⟶ curriedTensorPre F)
/- the oplax associativity hexagon commutes -/
(oplax_associativity : firstMap δ = secondMap δ)
/- the oplax left unitality square commutes -/
(oplax_left_unitality : leftMapₗ F = topMapₗ F ≫ δ.app (𝟙_ C) ≫ bottomMapₗ η)
/- the oplax right unitality square commutes -/
(oplax_right_unitality : leftMapᵣ F =
topMapᵣ F ≫ ((flipFunctor _ _ _).map δ).app (𝟙_ C) ≫ bottomMapᵣ η)
/--
`F` is oplax monoidal given a counit morphism `η : F.obj (𝟙_ C) ⟶ 𝟙_ D` and a tensorator
`δ : F (- ⊗ -) ⟶ F - ⊗ F -` as a natural transformation between bifunctors, satisfying the
relevant compatibilities.
-/
def ofBifunctor : F.OplaxMonoidal where
η := η
δ X Y := (δ.app X).app Y
δ_natural_left f X := (NatTrans.congr_app (δ.naturality f) X).symm
δ_natural_right X f := ((δ.app X).naturality f).symm
oplax_associativity X Y Z :=
NatTrans.congr_app (NatTrans.congr_app (NatTrans.congr_app oplax_associativity X) Y) Z
oplax_left_unitality X := NatTrans.congr_app oplax_left_unitality X
oplax_right_unitality X := NatTrans.congr_app oplax_right_unitality X
end OplaxMonoidal
open LaxMonoidal.ofBifunctor OplaxMonoidal.ofBifunctor
namespace Monoidal
variable {F : C ⥤ D}
/- unit morphism -/
(ε : 𝟙_ D ⟶ F.obj (𝟙_ C))
/- lax tensorator as a morphism of bifunctors -/
(μ : curriedTensorPre F ⟶ curriedTensorPost F)
/- the lax associativity hexagon commutes -/
(associativity : firstMap μ = secondMap μ)
/- the lax left unitality square commutes -/
(left_unitality : LaxMonoidal.ofBifunctor.leftMapₗ F = topMapₗ ε ≫ μ.app (𝟙_ C) ≫ bottomMapₗ F)
/- the lax right unitality square commutes -/
(right_unitality : LaxMonoidal.ofBifunctor.leftMapᵣ F =
topMapᵣ ε ≫ ((flipFunctor _ _ _).map μ).app (𝟙_ C) ≫ bottomMapᵣ F)
/- counit morphism -/
(η : F.obj (𝟙_ C) ⟶ 𝟙_ D)
/- oplax tensorator as a morphism of bifunctors -/
(δ : curriedTensorPost F ⟶ curriedTensorPre F)
/- the oplax associativity hexagon commutes -/
(oplax_associativity : firstMap δ = secondMap δ)
/- the left unitality square commutes -/
(oplax_left_unitality : OplaxMonoidal.ofBifunctor.leftMapₗ F =
topMapₗ F ≫ δ.app (𝟙_ C) ≫ bottomMapₗ η)
/- the right unitality square commutes -/
(oplax_right_unitality : OplaxMonoidal.ofBifunctor.leftMapᵣ F =
topMapᵣ F ≫ ((flipFunctor _ _ _).map δ).app (𝟙_ C) ≫ bottomMapᵣ η)
/--
`F` is monoidal given a co/unit morphisms `ε/η : 𝟙_ D ↔ F.obj (𝟙_ C)` and tensorators
`μ / δ : F - ⊗ F - ↔ F (- ⊗ -)` as natural transformations between bifunctors, satisfying the
relevant compatibilities.
-/
def ofBifunctor (ε_η : ε ≫ η = 𝟙 _) (η_ε : η ≫ ε = 𝟙 _) (μ_δ : μ ≫ δ = 𝟙 _)
(δ_μ : δ ≫ μ = 𝟙 _) : F.Monoidal where
toLaxMonoidal := .ofBifunctor ε μ associativity left_unitality right_unitality
toOplaxMonoidal := .ofBifunctor η δ oplax_associativity oplax_left_unitality oplax_right_unitality
ε_η := ε_η
η_ε := η_ε
μ_δ X Y := NatTrans.congr_app ((NatTrans.congr_app μ_δ) X) Y
δ_μ X Y := NatTrans.congr_app ((NatTrans.congr_app δ_μ) X) Y
end Monoidal
namespace CoreMonoidal
variable {F : C ⥤ D}
/- unit isomorphism -/
(ε : 𝟙_ D ≅ F.obj (𝟙_ C))
/- tensorator as an isomorphism of bifunctors -/
(μ : curriedTensorPre F ≅ curriedTensorPost F)
/- the associativity hexagon commutes -/
(associativity : firstMap μ.hom = secondMap μ.hom)
/- the left unitality square commutes -/
(left_unitality : LaxMonoidal.ofBifunctor.leftMapₗ F =
topMapₗ ε.hom ≫ μ.hom.app (𝟙_ C) ≫ bottomMapₗ F)
/- the right unitality square commutes -/
(right_unitality : LaxMonoidal.ofBifunctor.leftMapᵣ F =
topMapᵣ ε.hom ≫ ((flipFunctor _ _ _).map μ.hom).app (𝟙_ C) ≫ bottomMapᵣ F)
/--
`F` is monoidal given a unit isomorphism `ε : 𝟙_ D ≅ F.obj (𝟙_ C)` and a tensorator isomorphism
`μ : F - ⊗ F - ≅ F (- ⊗ -)` as a natural isomorphism between bifunctors, satisfying the
relevant compatibilities.
-/
def ofBifunctor : F.CoreMonoidal where
εIso := ε
μIso X Y := (μ.app X).app Y
μIso_hom_natural_left f X := NatTrans.congr_app (μ.hom.naturality f) X
μIso_hom_natural_right X f := (μ.hom.app X).naturality f
associativity X Y Z :=
NatTrans.congr_app (NatTrans.congr_app (NatTrans.congr_app associativity X) Y) Z
left_unitality X := NatTrans.congr_app left_unitality X
right_unitality X := NatTrans.congr_app right_unitality X
end CategoryTheory.Functor.CoreMonoidal |
.lake/packages/mathlib/Mathlib/CategoryTheory/Monoidal/Limits.lean | import Mathlib.CategoryTheory.Monoidal.Limits.Basic
deprecated_module (since := "2025-08-13") |
.lake/packages/mathlib/Mathlib/CategoryTheory/Monoidal/Comon_.lean | import Mathlib.CategoryTheory.Monoidal.Mon_
import Mathlib.CategoryTheory.Monoidal.Braided.Opposite
import Mathlib.CategoryTheory.Monoidal.Transport
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
/-!
# The category of comonoids in a monoidal category.
We define comonoids in a monoidal category `C`,
and show that they are equivalently monoid objects in the opposite category.
We construct the monoidal structure on `Comon C`, when `C` is braided.
An oplax monoidal functor takes comonoid objects to comonoid objects.
That is, a oplax monoidal functor `F : C ⥤ D` induces a functor `Comon C ⥤ Comon D`.
## TODO
* Comonoid objects in `C` are "just"
oplax monoidal functors from the trivial monoidal category to `C`.
-/
universe v₁ v₂ u₁ u₂ u
open CategoryTheory MonoidalCategory
namespace CategoryTheory
variable {C : Type u₁} [Category.{v₁} C] [MonoidalCategory.{v₁} C]
/-- A comonoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called a "coalgebra object".
-/
class ComonObj (X : C) where
/-- The counit morphism of a comonoid object. -/
counit : X ⟶ 𝟙_ C
/-- The comultiplication morphism of a comonoid object. -/
comul : X ⟶ X ⊗ X
counit_comul (X) : comul ≫ counit ▷ X = (λ_ X).inv := by cat_disch
comul_counit (X) : comul ≫ X ◁ counit = (ρ_ X).inv := by cat_disch
comul_assoc (X) : comul ≫ X ◁ comul = comul ≫ (comul ▷ X) ≫ (α_ X X X).hom := by cat_disch
namespace ComonObj
@[inherit_doc] scoped notation "Δ" => ComonObj.comul
@[inherit_doc] scoped notation "Δ["M"]" => ComonObj.comul (X := M)
@[inherit_doc] scoped notation "ε" => ComonObj.counit
@[inherit_doc] scoped notation "ε["M"]" => ComonObj.counit (X := M)
attribute [reassoc (attr := simp)] counit_comul comul_counit comul_assoc
/-- The canonical comonoid structure on the monoidal unit.
This is not a global instance to avoid conflicts with other comonoid structures. -/
@[simps]
def instTensorUnit (C : Type u₁) [Category.{v₁} C] [MonoidalCategory.{v₁} C] : ComonObj (𝟙_ C) where
counit := 𝟙 _
comul := (λ_ _).inv
counit_comul := by simp
comul_counit := by monoidal_coherence
comul_assoc := by monoidal_coherence
end ComonObj
open scoped ComonObj
variable {M N O : C} [ComonObj M] [ComonObj N] [ComonObj O]
/-- The property that a morphism between comonoid objects is a comonoid morphism. -/
class IsComonHom (f : M ⟶ N) : Prop where
hom_counit (f) : f ≫ ε = ε := by cat_disch
hom_comul (f) : f ≫ Δ = Δ ≫ (f ⊗ₘ f) := by cat_disch
@[deprecated (since := "2025-09-15")] alias IsComon_Hom := IsComonHom
attribute [reassoc (attr := simp)] IsComonHom.hom_counit IsComonHom.hom_comul
instance : IsComonHom (𝟙 M) where
instance (f : M ⟶ N) (g : N ⟶ O) [IsComonHom f] [IsComonHom g] : IsComonHom (f ≫ g) where
instance (f : M ≅ N) [IsComonHom f.hom] : IsComonHom f.inv where
hom_counit := by simp [Iso.inv_comp_eq]
hom_comul := by simp [Iso.inv_comp_eq]
instance (f : M ⟶ N) [IsComonHom f] [IsIso f] : IsComonHom (inv f) where
variable (C) in
/-- A comonoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called a "coalgebra object".
-/
structure Comon where
/-- The underlying object of a comonoid object. -/
X : C
[comon : ComonObj X]
@[deprecated (since := "2025-09-15")] alias Comon_ := Comon
attribute [instance] Comon.comon
namespace Comon
attribute [local instance] ComonObj.instTensorUnit in
variable (C) in
/-- The trivial comonoid object. We later show this is terminal in `Comon C`.
-/
@[simps!]
def trivial : Comon C := mk (𝟙_ C)
instance : Inhabited (Comon C) :=
⟨trivial C⟩
end Comon
namespace ComonObj
variable {M : C} [ComonObj M]
@[reassoc (attr := simp)]
theorem counit_comul_hom {Z : C} (f : M ⟶ Z) : Δ[M] ≫ (ε[M] ⊗ₘ f) = f ≫ (λ_ Z).inv := by
rw [leftUnitor_inv_naturality, tensorHom_def, counit_comul_assoc]
@[reassoc (attr := simp)]
theorem comul_counit_hom {Z : C} (f : M ⟶ Z) : Δ[M] ≫ (f ⊗ₘ ε[M]) = f ≫ (ρ_ Z).inv := by
rw [rightUnitor_inv_naturality, tensorHom_def', comul_counit_assoc]
@[reassoc]
theorem comul_assoc_flip (X : C) [ComonObj X] :
Δ ≫ Δ ▷ X = Δ ≫ X ◁ Δ ≫ (α_ X X X).inv := by
simp
end ComonObj
namespace Comon
open MonObj ComonObj
/-- A morphism of comonoid objects. -/
@[ext]
structure Hom (M N : Comon C) where
/-- The underlying morphism of a morphism of comonoid objects. -/
hom : M.X ⟶ N.X
[isComonHom_hom : IsComonHom hom]
attribute [instance] Hom.isComonHom_hom
/-- Construct a morphism `M ⟶ N` of `Comon C` from a map `f : M ⟶ N` and a `IsComonHom f`
instance. -/
abbrev Hom.mk' {M N : Comon C} (f : M.X ⟶ N.X)
(f_counit : f ≫ ε[N.X] = ε[M.X] := by cat_disch)
(f_comul : f ≫ Δ[N.X] = Δ[M.X] ≫ (f ⊗ₘ f) := by cat_disch) :
Hom M N :=
have : IsComonHom f := ⟨f_counit, f_comul⟩
.mk f
/-- The identity morphism on a comonoid object. -/
@[simps]
def id (M : Comon C) : Hom M M where
hom := 𝟙 M.X
instance homInhabited (M : Comon C) : Inhabited (Hom M M) :=
⟨id M⟩
/-- Composition of morphisms of monoid objects. -/
@[simps]
def comp {M N O : Comon C} (f : Hom M N) (g : Hom N O) : Hom M O where
hom := f.hom ≫ g.hom
instance : Category (Comon C) where
Hom M N := Hom M N
id := id
comp f g := comp f g
instance {M N : Comon C} (f : M ⟶ N) : IsComonHom f.hom := inferInstanceAs (IsComonHom f.hom)
@[ext] lemma ext {X Y : Comon C} {f g : X ⟶ Y} (w : f.hom = g.hom) : f = g := Hom.ext w
@[simp] theorem id_hom' (M : Comon C) : (𝟙 M : Hom M M).hom = 𝟙 M.X := rfl
@[simp]
theorem comp_hom' {M N K : Comon C} (f : M ⟶ N) (g : N ⟶ K) : (f ≫ g).hom = f.hom ≫ g.hom :=
rfl
section
variable (C)
/-- The forgetful functor from comonoid objects to the ambient category. -/
@[simps]
def forget : Comon C ⥤ C where
obj A := A.X
map f := f.hom
end
instance forget_faithful : (@forget C _ _).Faithful where
instance {A B : Comon C} (f : A ⟶ B) [e : IsIso ((forget C).map f)] : IsIso f.hom := e
/-- The forgetful functor from comonoid objects to the ambient category reflects isomorphisms. -/
instance : (forget C).ReflectsIsomorphisms where
reflects f e :=
⟨⟨{ hom := inv f.hom }, by cat_disch⟩⟩
/-- Construct an isomorphism of comonoids by giving an isomorphism between the underlying objects
and checking compatibility with counit and comultiplication only in the forward direction.
-/
@[simps]
def mkIso' {M N : Comon C} (f : M.X ≅ N.X) [IsComonHom f.hom] : M ≅ N where
hom := Hom.mk f.hom
inv := Hom.mk f.inv
/-- Construct an isomorphism of comonoids by giving an isomorphism between the underlying objects
and checking compatibility with counit and comultiplication only in the forward direction.
-/
@[simps]
def mkIso {M N : Comon C} (f : M.X ≅ N.X) (f_counit : f.hom ≫ ε[N.X] = ε[M.X] := by cat_disch)
(f_comul : f.hom ≫ Δ[N.X] = Δ[M.X] ≫ (f.hom ⊗ₘ f.hom) := by cat_disch) : M ≅ N :=
have : IsComonHom f.hom := ⟨f_counit, f_comul⟩
⟨⟨f.hom⟩, ⟨f.inv⟩, by cat_disch, by cat_disch⟩
@[simps]
instance uniqueHomToTrivial (A : Comon C) : Unique (A ⟶ trivial C) where
default.hom := ε[A.X]
default.isComonHom_hom.hom_comul := by simp [unitors_inv_equal]
uniq f := by
ext
rw [← Category.comp_id f.hom]
dsimp only [trivial_X]
rw [← trivial_comon_counit, IsComonHom.hom_counit]
open CategoryTheory.Limits
instance : HasTerminal (Comon C) :=
hasTerminal_of_unique (trivial C)
open Opposite
/-- Auxiliary definition for `ComonToMonOpOpObj`. -/
abbrev ComonToMonOpOpObjMon (A : Comon C) : MonObj (op A.X) where
one := ε[A.X].op
mul := Δ[A.X].op
one_mul := by
rw [← op_whiskerRight, ← op_comp, counit_comul]
rfl
mul_one := by
rw [← op_whiskerLeft, ← op_comp, comul_counit]
rfl
mul_assoc := by
rw [← op_inv_associator, ← op_whiskerRight, ← op_comp, ← op_whiskerLeft, ← op_comp,
comul_assoc_flip, op_comp, op_comp_assoc]
rfl
@[deprecated (since := "2025-09-15")] alias Comon_ToMon_OpOpObjMon := ComonToMonOpOpObjMon
/--
Turn a comonoid object into a monoid object in the opposite category.
-/
@[simps] def ComonToMonOpOpObj (A : Comon C) : Mon Cᵒᵖ where
X := op A.X
mon := ComonToMonOpOpObjMon A
@[deprecated (since := "2025-09-15")] alias Comon_ToMon_OpOpObj := ComonToMonOpOpObj
variable (C) in
/--
The contravariant functor turning comonoid objects into monoid objects in the opposite category.
-/
@[simps] def ComonToMonOpOp : Comon C ⥤ (Mon Cᵒᵖ)ᵒᵖ where
obj A := op (ComonToMonOpOpObj A)
map := fun f => op <|
{ hom := f.hom.op
isMonHom_hom.one_hom := by apply Quiver.Hom.unop_inj; simp
isMonHom_hom.mul_hom := by apply Quiver.Hom.unop_inj; simp }
@[deprecated (since := "2025-09-15")] alias Comon_ToMon_OpOp := ComonToMonOpOp
/-- Auxiliary definition for `MonOpOpToComonObj`. -/
abbrev MonOpOpToComonObjComon (A : Mon Cᵒᵖ) : ComonObj (unop A.X) where
counit := η[A.X].unop
comul := μ[A.X].unop
counit_comul := by rw [← unop_whiskerRight, ← unop_comp, MonObj.one_mul]; rfl
comul_counit := by rw [← unop_whiskerLeft, ← unop_comp, MonObj.mul_one]; rfl
comul_assoc := by
rw [← unop_whiskerRight, ← unop_whiskerLeft, ← unop_comp_assoc, ← unop_comp,
MonObj.mul_assoc_flip]
rfl
@[deprecated (since := "2025-09-15")] alias Mon_OpOpToComonObjComon := MonOpOpToComonObjComon
/--
Turn a monoid object in the opposite category into a comonoid object.
-/
@[simps] def MonOpOpToComonObj (A : Mon Cᵒᵖ) : Comon C where
X := unop A.X
comon := MonOpOpToComonObjComon A
@[deprecated (since := "2025-09-15")] alias Mon_OpOpToComonObj := MonOpOpToComonObj
variable (C)
/--
The contravariant functor turning monoid objects in the opposite category into comonoid objects.
-/
@[simps]
def MonOpOpToComon : (Mon Cᵒᵖ)ᵒᵖ ⥤ Comon C where
obj A := MonOpOpToComonObj (unop A)
map := fun f =>
{ hom := f.unop.hom.unop
isComonHom_hom.hom_counit := by apply Quiver.Hom.op_inj; simp
isComonHom_hom.hom_comul := by apply Quiver.Hom.op_inj; simp [op_tensorHom] }
@[deprecated (since := "2025-09-15")] alias Mon_OpOpToComon_ := MonOpOpToComon
/--
Comonoid objects are contravariantly equivalent to monoid objects in the opposite category.
-/
@[simps]
def Comon_EquivMon_OpOp : Comon C ≌ (Mon Cᵒᵖ)ᵒᵖ where
functor := ComonToMonOpOp C
inverse := MonOpOpToComon C
unitIso := NatIso.ofComponents fun _ => .refl _
counitIso := NatIso.ofComponents fun _ => .refl _
/--
Comonoid objects in a braided category form a monoidal category.
This definition is via transporting back and forth to monoids in the opposite category.
-/
@[simps!]
instance monoidal [BraidedCategory C] : MonoidalCategory (Comon C) :=
Monoidal.transport (Comon_EquivMon_OpOp C).symm
variable {C} [BraidedCategory C]
theorem tensorObj_X (A B : Comon C) : (A ⊗ B).X = A.X ⊗ B.X := rfl
instance (A B : C) [ComonObj A] [ComonObj B] : ComonObj (A ⊗ B) :=
inferInstanceAs <| ComonObj (Comon.mk A ⊗ Comon.mk B).X
@[simp]
theorem tensorObj_counit (A B : C) [ComonObj A] [ComonObj B] :
ε[A ⊗ B] = (ε[A] ⊗ₘ ε[B]) ≫ (λ_ _).hom :=
rfl
/--
Preliminary statement of the comultiplication for a tensor product of comonoids.
This version is the definitional equality provided by transport, and not quite as good as
the version provided in `tensorObj_comul` below.
-/
theorem tensorObj_comul' (A B : C) [ComonObj A] [ComonObj B] :
Δ[A ⊗ B] =
(Δ[A] ⊗ₘ Δ[B]) ≫ (tensorμ (op A) (op B) (op A) (op B)).unop := by
rfl
/--
The comultiplication on the tensor product of two comonoids is
the tensor product of the comultiplications followed by the tensor strength
(to shuffle the factors back into order).
-/
@[simp]
theorem tensorObj_comul (A B : C) [ComonObj A] [ComonObj B] :
Δ[A ⊗ B] = (Δ[A] ⊗ₘ Δ[B]) ≫ tensorμ A A B B := by
rw [tensorObj_comul']
congr
simp only [tensorμ, unop_tensorObj, unop_op]
apply Quiver.Hom.unop_inj
dsimp [op_tensorObj, op_associator]
rw [Category.assoc, Category.assoc, Category.assoc]
/-- The forgetful functor from `Comon C` to `C` is monoidal when `C` is monoidal. -/
instance : (forget C).Monoidal :=
Functor.CoreMonoidal.toMonoidal
{ εIso := Iso.refl _
μIso := fun _ _ ↦ Iso.refl _ }
open Functor.LaxMonoidal Functor.OplaxMonoidal
@[simp] theorem forget_ε : «ε» (forget C) = 𝟙 (𝟙_ C) := rfl
@[simp] theorem forget_η : «η» (forget C) = 𝟙 (𝟙_ C) := rfl
@[simp] theorem forget_μ (X Y : Comon C) : «μ» (forget C) X Y = 𝟙 (X.X ⊗ Y.X) := rfl
@[simp] theorem forget_δ (X Y : Comon C) : δ (forget C) X Y = 𝟙 (X.X ⊗ Y.X) := rfl
end Comon
namespace Functor
variable {D : Type u₂} [Category.{v₂} D] [MonoidalCategory.{v₂} D]
open OplaxMonoidal ComonObj IsComonHom
/-- The image of a comonoid object under a oplax monoidal functor is a comonoid object. -/
abbrev obj.instComonObj (A : C) [ComonObj A] (F : C ⥤ D) [F.OplaxMonoidal] :
ComonObj (F.obj A) where
counit := F.map ε[A] ≫ η F
comul := F.map Δ[A] ≫ δ F _ _
counit_comul := by
simp_rw [comp_whiskerRight, Category.assoc, δ_natural_left_assoc, left_unitality,
← F.map_comp_assoc, counit_comul]
comul_counit := by
simp_rw [MonoidalCategory.whiskerLeft_comp, Category.assoc, δ_natural_right_assoc,
right_unitality, ← F.map_comp_assoc, comul_counit]
comul_assoc := by
simp_rw [comp_whiskerRight, Category.assoc, δ_natural_left_assoc,
MonoidalCategory.whiskerLeft_comp, δ_natural_right_assoc,
← F.map_comp_assoc, comul_assoc, F.map_comp, Category.assoc, associativity]
attribute [local instance] obj.instComonObj
@[reassoc, simp] lemma obj.ε_def (F : C ⥤ D) [F.OplaxMonoidal] (X : C) [ComonObj X] :
ε[F.obj X] = F.map ε ≫ η F :=
rfl
@[reassoc, simp] lemma obj.Δ_def (F : C ⥤ D) [F.OplaxMonoidal] (X : C) [ComonObj X] :
Δ[F.obj X] = F.map Δ ≫ δ F _ _ :=
rfl
instance map.instIsComon_Hom
(F : C ⥤ D) [F.OplaxMonoidal]
{X Y : C} [ComonObj X] [ComonObj Y] (f : X ⟶ Y) [IsComonHom f] :
IsComonHom (F.map f) where
hom_counit := by dsimp; rw [← F.map_comp_assoc, hom_counit]
hom_comul := by
dsimp
rw [Category.assoc, δ_natural, ← F.map_comp_assoc, ← F.map_comp_assoc, hom_comul]
/-- A oplax monoidal functor takes comonoid objects to comonoid objects.
That is, a oplax monoidal functor `F : C ⥤ D` induces a functor `Comon C ⥤ Comon D`.
-/
@[simps]
def mapComon (F : C ⥤ D) [F.OplaxMonoidal] : Comon C ⥤ Comon D where
obj A :=
{ X := F.obj A.X }
map f :=
{ hom := F.map f.hom }
map_id A := by ext; simp
map_comp f g := by ext; simp
-- TODO We haven't yet set up the category structure on `OplaxMonoidalFunctor C D`
-- and so can't state `mapComonFunctor : OplaxMonoidalFunctor C D ⥤ Comon C ⥤ Comon D`.
end Functor
variable [BraidedCategory.{v₁} C]
/-- Predicate for a comonoid object to be commutative. -/
class IsCommComonObj (X : C) [ComonObj X] where
comul_comm (X) : Δ ≫ (β_ X X).hom = Δ := by cat_disch
open scoped ComonObj
attribute [reassoc (attr := simp)] IsCommComonObj.comul_comm
end CategoryTheory |
.lake/packages/mathlib/Mathlib/CategoryTheory/Monoidal/Tor.lean | import Mathlib.CategoryTheory.Abelian.LeftDerived
import Mathlib.CategoryTheory.Monoidal.Preadditive
/-!
# Tor, the left-derived functor of tensor product
We define `Tor C n : C ⥤ C ⥤ C`, by left-deriving in the second factor of `(X, Y) ↦ X ⊗ Y`.
For now we have almost nothing to say about it!
It would be good to show that this is naturally isomorphic to the functor obtained
by left-deriving in the first factor, instead.
For now we define `Tor'` by left-deriving in the first factor,
but showing `Tor C n ≅ Tor' C n` will require a bit more theory!
Possibly it's best to axiomatize delta functors, and obtain a unique characterisation?
-/
assert_not_exists ModuleCat.abelian
noncomputable section
open CategoryTheory.Limits
open CategoryTheory.MonoidalCategory
namespace CategoryTheory
variable (C : Type*) [Category C] [MonoidalCategory C]
[Abelian C] [MonoidalPreadditive C] [HasProjectiveResolutions C]
/-- We define `Tor C n : C ⥤ C ⥤ C` by left-deriving in the second factor of `(X, Y) ↦ X ⊗ Y`. -/
@[simps]
def Tor (n : ℕ) : C ⥤ C ⥤ C where
obj X := Functor.leftDerived ((tensoringLeft C).obj X) n
map f := NatTrans.leftDerived ((tensoringLeft C).map f) n
/-- An alternative definition of `Tor`, where we left-derive in the first factor instead. -/
@[simps! obj_obj map_app obj_map]
def Tor' (n : ℕ) : C ⥤ C ⥤ C :=
Functor.flip
{ obj := fun X => Functor.leftDerived ((tensoringRight C).obj X) n
map := fun f => NatTrans.leftDerived ((tensoringRight C).map f) n }
/-- The higher `Tor` groups for `X` and `Y` are zero if `Y` is projective. -/
lemma isZero_Tor_succ_of_projective (X Y : C) [Projective Y] (n : ℕ) :
IsZero (((Tor C (n + 1)).obj X).obj Y) := by
apply Functor.isZero_leftDerived_obj_projective_succ
/-- The higher `Tor'` groups for `X` and `Y` are zero if `X` is projective. -/
lemma isZero_Tor'_succ_of_projective (X Y : C) [Projective X] (n : ℕ) :
IsZero (((Tor' C (n + 1)).obj X).obj Y) := by
apply Functor.isZero_leftDerived_obj_projective_succ
end CategoryTheory |
.lake/packages/mathlib/Mathlib/CategoryTheory/Monoidal/Mon_.lean | import Mathlib.Algebra.Group.PUnit
import Mathlib.CategoryTheory.Monoidal.Braided.Basic
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
import Mathlib.CategoryTheory.Monoidal.Discrete
import Mathlib.CategoryTheory.Limits.Shapes.Terminal
/-!
# The category of monoids in a monoidal category.
We define monoids in a monoidal category `C` and show that the category of monoids is equivalent to
the category of lax monoidal functors from the unit monoidal category to `C`. We also show that if
`C` is braided, then the category of monoids is naturally monoidal.
## Simp set for monoid object tautologies
In this file, we also provide a simp set called `mon_tauto` whose goal is to prove all tautologies
about morphisms from some (tensor) power of `M` to `M`, where `M` is a (commutative) monoid object
in a (braided) monoidal category.
Please read the documentation in `Mathlib/Tactic/Attr/Register.lean` for full details.
## TODO
* Check that `Mon MonCat ≌ CommMonCat`, via the Eckmann-Hilton argument.
(You'll have to hook up the Cartesian monoidal structure on `MonCat` first,
available in https://github.com/leanprover-community/mathlib3/pull/3463)
* More generally, check that `Mon (Mon C) ≌ CommMon C` when `C` is braided.
* Check that `Mon TopCat ≌ [bundled topological monoids]`.
* Check that `Mon AddCommGrpCat ≌ RingCat`.
(We've already got `Mon (ModuleCat R) ≌ AlgCat R`,
in `Mathlib/CategoryTheory/Monoidal/Internal/Module.lean`.)
* Can you transport this monoidal structure to `RingCat` or `AlgCat R`?
How does it compare to the "native" one?
-/
universe w v₁ v₂ v₃ u₁ u₂ u₃ u
open Function CategoryTheory MonoidalCategory Functor.LaxMonoidal Functor.OplaxMonoidal
namespace CategoryTheory
variable {C : Type u₁} [Category.{v₁} C] [MonoidalCategory.{v₁} C]
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
class MonObj (X : C) where
/-- The unit morphism of a monoid object. -/
one : 𝟙_ C ⟶ X
/-- The multiplication morphism of a monoid object. -/
mul : X ⊗ X ⟶ X
one_mul (X) : one ▷ X ≫ mul = (λ_ X).hom := by cat_disch
mul_one (X) : X ◁ one ≫ mul = (ρ_ X).hom := by cat_disch
-- Obviously there is some flexibility stating this axiom.
-- This one has left- and right-hand sides matching the statement of `Monoid.mul_assoc`,
-- and chooses to place the associator on the right-hand side.
-- The heuristic is that unitors and associators "don't have much weight".
mul_assoc (X) : (mul ▷ X) ≫ mul = (α_ X X X).hom ≫ (X ◁ mul) ≫ mul := by cat_disch
@[deprecated (since := "2025-09-09")] alias Mon_Class := MonObj
namespace MonObj
variable {M X Y : C} [MonObj M]
@[inherit_doc] scoped notation "μ" => MonObj.mul
@[inherit_doc] scoped notation "μ["M"]" => MonObj.mul (X := M)
@[inherit_doc] scoped notation "η" => MonObj.one
@[inherit_doc] scoped notation "η["M"]" => MonObj.one (X := M)
attribute [reassoc (attr := simp)] one_mul mul_one mul_assoc
/-- Transfer `MonObj` along an isomorphism. -/
-- Note: The simps lemmas are not tagged simp because their `#discr_tree_simp_key` are too generic.
@[simps! -isSimp]
def ofIso (e : M ≅ X) : MonObj X where
one := η[M] ≫ e.hom
mul := (e.inv ⊗ₘ e.inv) ≫ μ[M] ≫ e.hom
one_mul := by
rw [← cancel_epi (λ_ X).inv]
simp only [comp_whiskerRight, tensorHom_def, Category.assoc,
hom_inv_whiskerRight_assoc]
simp [← tensorHom_def_assoc, leftUnitor_inv_comp_tensorHom_assoc]
mul_one := by
rw [← cancel_epi (ρ_ X).inv]
simp only [MonoidalCategory.whiskerLeft_comp, tensorHom_def', Category.assoc,
whiskerLeft_hom_inv_assoc, Iso.inv_hom_id]
simp [← tensorHom_def'_assoc, rightUnitor_inv_comp_tensorHom_assoc]
mul_assoc := by simpa [← id_tensorHom, ← tensorHom_id,
-associator_conjugation, associator_naturality_assoc] using
congr(((e.inv ⊗ₘ e.inv) ⊗ₘ e.inv) ≫ $(MonObj.mul_assoc M) ≫ e.hom)
@[simps]
instance : MonObj (𝟙_ C) where
one := 𝟙 _
mul := (λ_ _).hom
mul_assoc := by monoidal_coherence
mul_one := by monoidal_coherence
@[ext]
theorem ext {X : C} (h₁ h₂ : MonObj X) (H : h₁.mul = h₂.mul) : h₁ = h₂ := by
suffices h₁.one = h₂.one by cases h₁; cases h₂; subst H this; rfl
trans (λ_ _).inv ≫ (h₁.one ⊗ₘ h₂.one) ≫ h₁.mul
· simp [tensorHom_def, H, ← unitors_equal]
· simp [tensorHom_def']
end MonObj
open scoped MonObj
namespace Mathlib.Tactic.MonTauto
variable {C : Type u₁} [Category.{v₁} C] [MonoidalCategory C]
{M W X X₁ X₂ X₃ Y Y₁ Y₂ Y₃ Z Z₁ Z₂ : C} [MonObj M]
attribute [mon_tauto] Category.id_comp Category.comp_id Category.assoc
id_tensorHom_id tensorμ tensorδ
tensorHom_comp_tensorHom tensorHom_comp_tensorHom_assoc
leftUnitor_tensor_hom leftUnitor_tensor_hom_assoc
leftUnitor_tensor_inv leftUnitor_tensor_inv_assoc
rightUnitor_tensor_hom rightUnitor_tensor_hom_assoc
rightUnitor_tensor_inv rightUnitor_tensor_inv_assoc
attribute [mon_tauto ←] tensorHom_id id_tensorHom
@[reassoc (attr := mon_tauto)]
lemma associator_hom_comp_tensorHom_tensorHom (f : X₁ ⟶ X₂) (g : Y₁ ⟶ Y₂) (h : Z₁ ⟶ Z₂) :
(α_ X₁ Y₁ Z₁).hom ≫ (f ⊗ₘ g ⊗ₘ h) = ((f ⊗ₘ g) ⊗ₘ h) ≫ (α_ X₂ Y₂ Z₂).hom := by simp
@[reassoc (attr := mon_tauto)]
lemma associator_inv_comp_tensorHom_tensorHom (f : X₁ ⟶ X₂) (g : Y₁ ⟶ Y₂) (h : Z₁ ⟶ Z₂) :
(α_ X₁ Y₁ Z₁).inv ≫ ((f ⊗ₘ g) ⊗ₘ h) = (f ⊗ₘ g ⊗ₘ h) ≫ (α_ X₂ Y₂ Z₂).inv := by simp
@[reassoc (attr := mon_tauto)]
lemma associator_hom_comp_tensorHom_tensorHom_comp (f : X₁ ⟶ X₂) (g : Y₁ ⟶ Y₂) (h : Z₁ ⟶ Z₂)
(gh : Y₂ ⊗ Z₂ ⟶ W) :
(α_ X₁ Y₁ Z₁).hom ≫ (f ⊗ₘ ((g ⊗ₘ h) ≫ gh)) =
((f ⊗ₘ g) ⊗ₘ h) ≫ (α_ X₂ Y₂ Z₂).hom ≫ (𝟙 _ ⊗ₘ gh) := by simp [tensorHom_def]
@[reassoc (attr := mon_tauto)]
lemma associator_inv_comp_tensorHom_tensorHom_comp (f : X₁ ⟶ X₂) (g : Y₁ ⟶ Y₂) (h : Z₁ ⟶ Z₂)
(fg : X₂ ⊗ Y₂ ⟶ W) :
(α_ X₁ Y₁ Z₁).inv ≫ (((f ⊗ₘ g) ≫ fg) ⊗ₘ h) =
(f ⊗ₘ g ⊗ₘ h) ≫ (α_ X₂ Y₂ Z₂).inv ≫ (fg ⊗ₘ 𝟙 _) := by simp [tensorHom_def']
@[mon_tauto] lemma eq_one_mul : (λ_ M).hom = (η ⊗ₘ 𝟙 M) ≫ μ := by simp
@[mon_tauto] lemma eq_mul_one : (ρ_ M).hom = (𝟙 M ⊗ₘ η) ≫ μ := by simp
@[reassoc (attr := mon_tauto)] lemma leftUnitor_inv_one_tensor_mul (f : X₁ ⟶ M) :
(λ_ _).inv ≫ (η ⊗ₘ f) ≫ μ = f := by simp [tensorHom_def']
@[reassoc (attr := mon_tauto)] lemma rightUnitor_inv_tensor_one_mul (f : X₁ ⟶ M) :
(ρ_ _).inv ≫ (f ⊗ₘ η) ≫ μ = f := by simp [tensorHom_def]
@[reassoc (attr := mon_tauto)]
lemma mul_assoc_hom (f : X ⟶ M) :
(α_ X M M).hom ≫ (f ⊗ₘ μ) ≫ μ = ((f ⊗ₘ 𝟙 M) ≫ μ ⊗ₘ 𝟙 M) ≫ μ := by simp [tensorHom_def]
@[reassoc (attr := mon_tauto)]
lemma mul_assoc_inv (f : X ⟶ M) :
(α_ M M X).inv ≫ (μ ⊗ₘ f) ≫ μ = (𝟙 M ⊗ₘ (𝟙 M ⊗ₘ f) ≫ μ) ≫ μ := by simp [tensorHom_def']
end Mathlib.Tactic.MonTauto
variable {M N O X : C} [MonObj M] [MonObj N] [MonObj O]
/-- The property that a morphism between monoid objects is a monoid morphism. -/
class IsMonHom (f : M ⟶ N) : Prop where
one_hom (f) : η ≫ f = η := by cat_disch
mul_hom (f) : μ ≫ f = (f ⊗ₘ f) ≫ μ := by cat_disch
@[deprecated (since := "2025-09-15")] alias IsMon_Hom := IsMonHom
attribute [reassoc (attr := simp)] IsMonHom.one_hom IsMonHom.mul_hom
instance : IsMonHom (𝟙 M) where
instance (f : M ⟶ N) (g : N ⟶ O) [IsMonHom f] [IsMonHom g] : IsMonHom (f ≫ g) where
attribute [local simp] MonObj.ofIso_one MonObj.ofIso_mul in
instance isMonHom_ofIso (e : M ≅ X) : letI := MonObj.ofIso e; IsMonHom e.hom := by
letI := MonObj.ofIso e; exact { }
instance (f : M ≅ N) [IsMonHom f.hom] : IsMonHom f.inv where
one_hom := by simp [Iso.comp_inv_eq]
mul_hom := by simp [Iso.comp_inv_eq]
instance {f : M ⟶ N} [IsIso f] [IsMonHom f] : IsMonHom (asIso f).hom := ‹_›
variable (C) in
/-- A monoid object internal to a monoidal category.
When the monoidal category is preadditive, this is also sometimes called an "algebra object".
-/
structure Mon where
/-- The underlying object in the ambient monoidal category -/
X : C
[mon : MonObj X]
@[deprecated (since := "2025-09-15")] alias Mon_ := Mon
attribute [instance] Mon.mon
namespace Mon
variable (C) in
/-- The trivial monoid object. We later show this is initial in `Mon C`.
-/
@[simps!]
def trivial : Mon C := mk (𝟙_ C)
instance : Inhabited (Mon C) :=
⟨trivial C⟩
end Mon
namespace MonObj
variable {M : C} [MonObj M]
@[simp]
theorem one_mul_hom {Z : C} (f : Z ⟶ M) : (η[M] ⊗ₘ f) ≫ μ[M] = (λ_ Z).hom ≫ f := by
rw [tensorHom_def'_assoc, one_mul, leftUnitor_naturality]
@[simp]
theorem mul_one_hom {Z : C} (f : Z ⟶ M) : (f ⊗ₘ η[M]) ≫ μ[M] = (ρ_ Z).hom ≫ f := by
rw [tensorHom_def_assoc, mul_one, rightUnitor_naturality]
variable (M) in
@[reassoc]
theorem mul_assoc_flip : M ◁ μ ≫ μ = (α_ M M M).inv ≫ μ ▷ M ≫ μ := by
simp
end MonObj
namespace MonObj
/-!
In this section, we prove that the category of monoids in a braided monoidal category is monoidal.
Given two monoids `M` and `N` in a braided monoidal category `C`,
the multiplication on the tensor product `M.X ⊗ N.X` is defined in the obvious way:
it is the tensor product of the multiplications on `M` and `N`,
except that the tensor factors in the source come in the wrong order,
which we fix by pre-composing with a permutation isomorphism constructed from the braiding.
(There is a subtlety here: in fact there are two ways to do these,
using either the positive or negative crossing.)
A more conceptual way of understanding this definition is the following:
The braiding on `C` gives rise to a monoidal structure on
the tensor product functor from `C × C` to `C`.
A pair of monoids in `C` gives rise to a monoid in `C × C`,
which the tensor product functor by being monoidal takes to a monoid in `C`.
The permutation isomorphism appearing in the definition of
the multiplication on the tensor product of two monoids is
an instance of a more general family of isomorphisms
which together form a strength that equips the tensor product functor with a monoidal structure,
and the monoid axioms for the tensor product follow from the monoid axioms for the tensor factors
plus the properties of the strength (i.e., monoidal functor axioms).
The strength `tensorμ` of the tensor product functor has been defined in
`Mathlib/CategoryTheory/Monoidal/Braided.lean`.
Its properties, stated as independent lemmas in that module,
are used extensively in the proofs below.
Notice that we could have followed the above plan not only conceptually
but also as a possible implementation and
could have constructed the tensor product of monoids via `mapMon`,
but we chose to give a more explicit definition directly in terms of `tensorμ`.
To complete the definition of the monoidal category structure on the category of monoids,
we need to provide definitions of associator and unitors.
The obvious candidates are the associator and unitors from `C`,
but we need to prove that they are monoid morphisms, i.e., compatible with unit and multiplication.
These properties translate to the monoidality of the associator and unitors
(with respect to the monoidal structures on the functors they relate),
which have also been proved in `Mathlib/CategoryTheory/Monoidal/Braided.lean`.
-/
-- The proofs that associators and unitors preserve monoid units don't require braiding.
lemma one_associator {M N P : C} [MonObj M] [MonObj N] [MonObj P] :
((λ_ (𝟙_ C)).inv ≫ ((λ_ (𝟙_ C)).inv ≫ (η[M] ⊗ₘ η[N]) ⊗ₘ η[P])) ≫ (α_ M N P).hom =
(λ_ (𝟙_ C)).inv ≫ (η[M] ⊗ₘ (λ_ (𝟙_ C)).inv ≫ (η[N] ⊗ₘ η[P])) := by
simp only [Category.assoc, Iso.cancel_iso_inv_left]
slice_lhs 1 3 => rw [← Category.id_comp (η : 𝟙_ C ⟶ P), ← tensorHom_comp_tensorHom]
slice_lhs 2 3 => rw [associator_naturality]
slice_rhs 1 2 => rw [← Category.id_comp η, ← tensorHom_comp_tensorHom]
slice_lhs 1 2 => rw [tensorHom_id, ← leftUnitor_tensor_inv]
rw [← cancel_epi (λ_ (𝟙_ C)).inv]
slice_lhs 1 2 => rw [leftUnitor_inv_naturality]
simp
lemma one_leftUnitor {M : C} [MonObj M] :
((λ_ (𝟙_ C)).inv ≫ (𝟙 (𝟙_ C) ⊗ₘ η[M])) ≫ (λ_ M).hom = η := by
simp
lemma one_rightUnitor {M : C} [MonObj M] :
((λ_ (𝟙_ C)).inv ≫ (η[M] ⊗ₘ 𝟙 (𝟙_ C))) ≫ (ρ_ M).hom = η := by
simp [← unitors_equal]
section BraidedCategory
variable [BraidedCategory C]
lemma Mon_tensor_one_mul (M N : C) [MonObj M] [MonObj N] :
(((λ_ (𝟙_ C)).inv ≫ (η[M] ⊗ₘ η[N])) ▷ (M ⊗ N)) ≫
tensorμ M N M N ≫ (μ ⊗ₘ μ) =
(λ_ (M ⊗ N)).hom := by
simp only [comp_whiskerRight_assoc]
slice_lhs 2 3 => rw [tensorμ_natural_left]
slice_lhs 3 4 => rw [tensorHom_comp_tensorHom, one_mul, one_mul]
symm
exact tensor_left_unitality M N
lemma Mon_tensor_mul_one (M N : C) [MonObj M] [MonObj N] :
(M ⊗ N) ◁ ((λ_ (𝟙_ C)).inv ≫ (η[M] ⊗ₘ η[N])) ≫
tensorμ M N M N ≫ (μ[M] ⊗ₘ μ[N]) =
(ρ_ (M ⊗ N)).hom := by
simp only [whiskerLeft_comp_assoc]
slice_lhs 2 3 => rw [tensorμ_natural_right]
slice_lhs 3 4 => rw [tensorHom_comp_tensorHom, mul_one, mul_one]
symm
exact tensor_right_unitality M N
lemma Mon_tensor_mul_assoc (M N : C) [MonObj M] [MonObj N] :
((tensorμ M N M N ≫ (μ ⊗ₘ μ)) ▷ (M ⊗ N)) ≫
tensorμ M N M N ≫ (μ ⊗ₘ μ) =
(α_ (M ⊗ N : C) (M ⊗ N) (M ⊗ N)).hom ≫
((M ⊗ N : C) ◁ (tensorμ M N M N ≫ (μ ⊗ₘ μ))) ≫
tensorμ M N M N ≫ (μ ⊗ₘ μ) := by
simp only [comp_whiskerRight_assoc, whiskerLeft_comp_assoc]
slice_lhs 2 3 => rw [tensorμ_natural_left]
slice_lhs 3 4 => rw [tensorHom_comp_tensorHom, mul_assoc, mul_assoc, ← tensorHom_comp_tensorHom,
← tensorHom_comp_tensorHom]
slice_lhs 1 3 => rw [tensor_associativity]
slice_lhs 3 4 => rw [← tensorμ_natural_right]
simp
lemma mul_associator {M N P : C} [MonObj M] [MonObj N] [MonObj P] :
(tensorμ (M ⊗ N) P (M ⊗ N) P ≫
(tensorμ M N M N ≫ (μ ⊗ₘ μ) ⊗ₘ μ)) ≫
(α_ M N P).hom =
((α_ M N P).hom ⊗ₘ (α_ M N P).hom) ≫
tensorμ M (N ⊗ P) M (N ⊗ P) ≫
(μ ⊗ₘ tensorμ N P N P ≫ (μ ⊗ₘ μ)) := by
simp only [Category.assoc]
slice_lhs 2 3 => rw [← Category.id_comp μ[P], ← tensorHom_comp_tensorHom]
slice_lhs 3 4 => rw [associator_naturality]
slice_rhs 3 4 => rw [← Category.id_comp μ, ← tensorHom_comp_tensorHom]
simp only [tensorHom_id, id_tensorHom]
slice_lhs 1 3 => rw [associator_monoidal]
simp only [Category.assoc]
lemma mul_leftUnitor {M : C} [MonObj M] :
(tensorμ (𝟙_ C) M (𝟙_ C) M ≫ ((λ_ (𝟙_ C)).hom ⊗ₘ μ)) ≫ (λ_ M).hom =
((λ_ M).hom ⊗ₘ (λ_ M).hom) ≫ μ := by
rw [← Category.comp_id (λ_ (𝟙_ C)).hom, ← Category.id_comp μ, ← tensorHom_comp_tensorHom]
simp only [tensorHom_id, id_tensorHom]
slice_lhs 3 4 => rw [leftUnitor_naturality]
slice_lhs 1 3 => rw [← leftUnitor_monoidal]
simp only [Category.id_comp]
lemma mul_rightUnitor {M : C} [MonObj M] :
(tensorμ M (𝟙_ C) M (𝟙_ C) ≫ (μ ⊗ₘ (λ_ (𝟙_ C)).hom)) ≫ (ρ_ M).hom =
((ρ_ M).hom ⊗ₘ (ρ_ M).hom) ≫ μ := by
rw [← Category.id_comp μ, ← Category.comp_id (λ_ (𝟙_ C)).hom, ← tensorHom_comp_tensorHom]
simp only [tensorHom_id, id_tensorHom]
slice_lhs 3 4 => rw [rightUnitor_naturality]
slice_lhs 1 3 => rw [← rightUnitor_monoidal]
simp only [Category.id_comp]
namespace tensorObj
-- We don't want `tensorObj.one_def` to be simp as it would loop with `IsMonHom.one_hom` applied
-- to `(λ_ N.X).inv`.
@[simps -isSimp]
instance {M N : C} [MonObj M] [MonObj N] : MonObj (M ⊗ N) where
one := (λ_ (𝟙_ C)).inv ≫ (η ⊗ₘ η)
mul := tensorμ M N M N ≫ (μ ⊗ₘ μ)
one_mul := Mon_tensor_one_mul M N
mul_one := Mon_tensor_mul_one M N
mul_assoc := Mon_tensor_mul_assoc M N
end tensorObj
open IsMonHom
variable {X Y Z W : C} [MonObj X] [MonObj Y] [MonObj Z] [MonObj W]
instance {f : X ⟶ Y} {g : Z ⟶ W} [IsMonHom f] [IsMonHom g] : IsMonHom (f ⊗ₘ g) where
one_hom := by
dsimp [tensorObj.one_def]
slice_lhs 2 3 => rw [tensorHom_comp_tensorHom, one_hom, one_hom]
mul_hom := by
dsimp [tensorObj.mul_def]
slice_rhs 1 2 => rw [tensorμ_natural]
slice_lhs 2 3 => rw [tensorHom_comp_tensorHom, mul_hom, mul_hom, ← tensorHom_comp_tensorHom]
simp only [Category.assoc]
instance : IsMonHom (𝟙 X) where
instance {f : Y ⟶ Z} [IsMonHom f] : IsMonHom (X ◁ f) where
one_hom := by simpa using (inferInstanceAs <| IsMonHom (𝟙 X ⊗ₘ f)).one_hom
mul_hom := by simpa using (inferInstanceAs <| IsMonHom (𝟙 X ⊗ₘ f)).mul_hom
instance {f : X ⟶ Y} [IsMonHom f] : IsMonHom (f ▷ Z) where
one_hom := by simpa using (inferInstanceAs <| IsMonHom (f ⊗ₘ (𝟙 Z))).one_hom
mul_hom := by simpa using (inferInstanceAs <| IsMonHom (f ⊗ₘ (𝟙 Z))).mul_hom
instance : IsMonHom (α_ X Y Z).hom :=
⟨one_associator, mul_associator⟩
instance : IsMonHom (λ_ X).hom :=
⟨one_leftUnitor, mul_leftUnitor⟩
instance : IsMonHom (ρ_ X).hom :=
⟨one_rightUnitor, mul_rightUnitor⟩
lemma one_braiding (X Y : C) [MonObj X] [MonObj Y] : η ≫ (β_ X Y).hom = η := by
simp only [tensorObj.one_def, Category.assoc, BraidedCategory.braiding_naturality,
braiding_tensorUnit_right, Iso.cancel_iso_inv_left]
monoidal
end BraidedCategory
end MonObj
namespace Mon
/-- A morphism of monoid objects. -/
@[ext]
structure Hom (M N : Mon C) where
/-- The underlying morphism -/
hom : M.X ⟶ N.X
[isMonHom_hom : IsMonHom hom]
attribute [instance] Hom.isMonHom_hom
/-- Construct a morphism `M ⟶ N` of `Mon C` from a map `f : M ⟶ N` and a `IsMonHom f` instance. -/
abbrev Hom.mk' {M N : Mon C} (f : M.X ⟶ N.X)
(one_f : η ≫ f = η := by cat_disch)
(mul_f : μ ≫ f = (f ⊗ₘ f) ≫ μ := by cat_disch) : Hom M N :=
have : IsMonHom f := ⟨one_f, mul_f⟩
.mk f
/-- The identity morphism on a monoid object. -/
@[simps]
def id (M : Mon C) : Hom M M := ⟨𝟙 M.X⟩
instance homInhabited (M : Mon C) : Inhabited (Hom M M) :=
⟨id M⟩
/-- Composition of morphisms of monoid objects. -/
@[simps]
def comp {M N O : Mon C} (f : Hom M N) (g : Hom N O) : Hom M O where
hom := f.hom ≫ g.hom
instance : Category (Mon C) where
Hom M N := Hom M N
id := id
comp f g := comp f g
instance {M N : Mon C} (f : M ⟶ N) : IsMonHom f.hom := f.isMonHom_hom
@[ext]
lemma Hom.ext' {M N : Mon C} {f g : M ⟶ N} (w : f.hom = g.hom) : f = g :=
Hom.ext w
lemma hom_injective {M N : Mon C} : Injective (Hom.hom : (M ⟶ N) → (M.X ⟶ N.X)) :=
fun _ _ ↦ Hom.ext
@[simp]
theorem id_hom' (M : Mon C) : (𝟙 M : Hom M M).hom = 𝟙 M.X :=
rfl
@[simp]
theorem comp_hom' {M N K : Mon C} (f : M ⟶ N) (g : N ⟶ K) :
(f ≫ g : Hom M K).hom = f.hom ≫ g.hom :=
rfl
section
variable (C)
/-- The forgetful functor from monoid objects to the ambient category. -/
@[simps]
def forget : Mon C ⥤ C where
obj A := A.X
map f := f.hom
end
instance forget_faithful : (forget C).Faithful where
instance {A B : Mon C} (f : A ⟶ B) [e : IsIso ((forget C).map f)] : IsIso f.hom :=
e
/-- The forgetful functor from monoid objects to the ambient category reflects isomorphisms. -/
instance : (forget C).ReflectsIsomorphisms where
reflects f e := ⟨⟨.mk' (inv f.hom), by cat_disch⟩⟩
instance {M N : Mon C} {f : M ⟶ N} [IsIso f] : IsIso f.hom :=
inferInstanceAs <| IsIso <| (forget C).map f
/-- Construct an isomorphism of monoid objects by giving a monoid isomorphism between the underlying
objects. -/
@[simps]
def mkIso' {M N : C} [MonObj M] [MonObj N] (e : M ≅ N) [IsMonHom e.hom] : mk M ≅ mk N where
hom := Hom.mk e.hom
inv := Hom.mk e.inv
/-- Construct an isomorphism of monoid objects by giving an isomorphism between the underlying
objects and checking compatibility with unit and multiplication only in the forward direction. -/
@[simps!]
abbrev mkIso {M N : Mon C} (e : M.X ≅ N.X) (one_f : η[M.X] ≫ e.hom = η[N.X] := by cat_disch)
(mul_f : μ[M.X] ≫ e.hom = (e.hom ⊗ₘ e.hom) ≫ μ[N.X] := by cat_disch) : M ≅ N :=
have : IsMonHom e.hom := ⟨one_f, mul_f⟩
mkIso' e
@[simps]
instance uniqueHomFromTrivial (A : Mon C) : Unique (trivial C ⟶ A) where
default.hom := η[A.X]
default.isMonHom_hom.mul_hom := by simp [unitors_equal]
uniq f := by
ext
rw [← Category.id_comp f.hom]
dsimp only [trivial_X]
rw [← trivial_mon_one, IsMonHom.one_hom]
open CategoryTheory.Limits
instance : HasInitial (Mon C) :=
hasInitial_of_unique (Mon.trivial C)
section BraidedCategory
variable [BraidedCategory C]
@[simps! tensorObj_X tensorHom_hom]
instance monMonoidalStruct : MonoidalCategoryStruct (Mon C) where
tensorObj M N := ⟨M.X ⊗ N.X⟩
tensorHom f g := Hom.mk (f.hom ⊗ₘ g.hom)
whiskerRight f Y := Hom.mk (f.hom ▷ Y.X)
whiskerLeft X _ _ g := Hom.mk (X.X ◁ g.hom)
tensorUnit := ⟨𝟙_ C⟩
associator M N P := mkIso' <| associator M.X N.X P.X
leftUnitor M := mkIso' <| leftUnitor M.X
rightUnitor M := mkIso' <| rightUnitor M.X
@[simp] lemma tensorUnit_X : (𝟙_ (Mon C)).X = 𝟙_ C := rfl
@[simp] lemma tensorUnit_one : η[(𝟙_ (Mon C)).X] = 𝟙 (𝟙_ C) := rfl
@[simp] lemma tensorUnit_mul : μ[(𝟙_ (Mon C)).X] = (λ_ (𝟙_ C)).hom := rfl
@[simp]
lemma tensorObj_one (X Y : Mon C) : η[(X ⊗ Y).X] = (λ_ (𝟙_ C)).inv ≫ (η[X.X] ⊗ₘ η[Y.X]) := rfl
@[simp] lemma tensorObj_mul (X Y : Mon C) :
μ[(X ⊗ Y).X] = tensorμ X.X Y.X X.X Y.X ≫ (μ[X.X] ⊗ₘ μ[Y.X]) := rfl
@[simp]
lemma whiskerLeft_hom {X Y : Mon C} (f : X ⟶ Y) (Z : Mon C) : (f ▷ Z).hom = f.hom ▷ Z.X := rfl
@[simp]
lemma whiskerRight_hom (X : Mon C) {Y Z : Mon C} (f : Y ⟶ Z) : (X ◁ f).hom = X.X ◁ f.hom := rfl
@[simp] lemma leftUnitor_hom_hom (X : Mon C) : (λ_ X).hom.hom = (λ_ X.X).hom := rfl
@[simp] lemma leftUnitor_inv_hom (X : Mon C) : (λ_ X).inv.hom = (λ_ X.X).inv := rfl
@[simp] lemma rightUnitor_hom_hom (X : Mon C) : (ρ_ X).hom.hom = (ρ_ X.X).hom := rfl
@[simp] lemma rightUnitor_inv_hom (X : Mon C) : (ρ_ X).inv.hom = (ρ_ X.X).inv := rfl
@[simp] lemma associator_hom_hom (X Y Z : Mon C) : (α_ X Y Z).hom.hom = (α_ X.X Y.X Z.X).hom := rfl
@[simp] lemma associator_inv_hom (X Y Z : Mon C) : (α_ X Y Z).inv.hom = (α_ X.X Y.X Z.X).inv := rfl
@[simp] lemma tensor_one (M N : Mon C) : η[(M ⊗ N).X] = (λ_ (𝟙_ C)).inv ≫ (η[M.X] ⊗ₘ η[N.X]) := rfl
@[simp]
lemma tensor_mul (M N : Mon C) : μ[(M ⊗ N).X] = tensorμ M.X N.X M.X N.X ≫ (μ[M.X] ⊗ₘ μ[N.X]) := rfl
instance monMonoidal : MonoidalCategory (Mon C) where
tensorHom_def := by intros; ext; simp [tensorHom_def]
-- We don't want `tensorObj.one_def` to be simp as it would loop with `IsMonHom.one_hom` applied
-- to `(λ_ N.X).inv`.
@[simps! -isSimp]
instance {M N : C} [MonObj M] [MonObj N] : MonObj (M ⊗ N) :=
inferInstanceAs <| MonObj (Mon.mk M ⊗ Mon.mk N).X
variable (C)
/-- The forgetful functor from `Mon C` to `C` is monoidal when `C` is monoidal. -/
instance : (forget C).Monoidal :=
Functor.CoreMonoidal.toMonoidal
{ εIso := Iso.refl _
μIso _ _ := Iso.refl _ }
@[simp] lemma forget_ε : ε (forget C) = 𝟙 (𝟙_ C) := rfl
@[simp] lemma forget_η : «η» (forget C) = 𝟙 (𝟙_ C) := rfl
@[simp] lemma forget_μ (X Y : Mon C) : «μ» (forget C) X Y = 𝟙 (X.X ⊗ Y.X) := rfl
@[simp] lemma forget_δ (X Y : Mon C) : δ (forget C) X Y = 𝟙 (X.X ⊗ Y.X) := rfl
end BraidedCategory
end Mon
/-!
We next show that if `C` is symmetric, then `Mon C` is braided, and indeed symmetric.
Note that `Mon C` is *not* braided in general when `C` is only braided.
The more interesting construction is the 2-category of monoids in `C`,
bimodules between the monoids, and intertwiners between the bimodules.
When `C` is braided, that is a monoidal 2-category.
-/
section SymmetricCategory
variable [SymmetricCategory C]
namespace MonObj
lemma mul_braiding (X Y : C) [MonObj X] [MonObj Y] :
μ ≫ (β_ X Y).hom = ((β_ X Y).hom ⊗ₘ (β_ X Y).hom) ≫ μ := by
dsimp [tensorObj.mul_def]
simp only [tensorμ, Category.assoc, BraidedCategory.braiding_naturality,
BraidedCategory.braiding_tensor_right_hom, BraidedCategory.braiding_tensor_left_hom,
comp_whiskerRight, whisker_assoc, whiskerLeft_comp, pentagon_assoc,
pentagon_inv_hom_hom_hom_inv_assoc, Iso.inv_hom_id_assoc, whiskerLeft_hom_inv_assoc]
slice_lhs 3 4 =>
-- We use symmetry here:
rw [← whiskerLeft_comp, ← comp_whiskerRight, SymmetricCategory.symmetry]
simp only [id_whiskerRight, whiskerLeft_id, Category.id_comp, Category.assoc, pentagon_inv_assoc,
Iso.hom_inv_id_assoc]
slice_lhs 1 2 =>
rw [← associator_inv_naturality_left]
slice_lhs 2 3 =>
rw [Iso.inv_hom_id]
rw [Category.id_comp]
slice_lhs 2 3 =>
rw [← associator_naturality_right]
slice_lhs 1 2 =>
rw [← tensorHom_def]
simp only [Category.assoc]
instance {X Y : C} [MonObj X] [MonObj Y] : IsMonHom (β_ X Y).hom :=
⟨one_braiding X Y, mul_braiding X Y⟩
end MonObj
namespace Mon
instance : SymmetricCategory (Mon C) where
braiding X Y := mkIso' (β_ X.X Y.X)
@[simp] lemma braiding_hom_hom (M N : Mon C) : (β_ M N).hom.hom = (β_ M.X N.X).hom := rfl
@[simp] lemma braiding_inv_hom (M N : Mon C) : (β_ M N).inv.hom = (β_ M.X N.X).inv := rfl
end Mon
end SymmetricCategory
variable
{D : Type u₂} [Category.{v₂} D] [MonoidalCategory D]
{E : Type u₃} [Category.{v₃} E] [MonoidalCategory E]
{F F' : C ⥤ D} {G : D ⥤ E}
namespace Functor
section LaxMonoidal
variable [F.LaxMonoidal] [F'.LaxMonoidal] [G.LaxMonoidal] (X Y : C) [MonObj X] [MonObj Y]
(f : X ⟶ Y) [IsMonHom f]
/-- The image of a monoid object under a lax monoidal functor is a monoid object. -/
abbrev monObjObj : MonObj (F.obj X) where
one := ε F ≫ F.map η
mul := LaxMonoidal.μ F X X ≫ F.map μ
one_mul := by simp [← F.map_comp]
mul_one := by simp [← F.map_comp]
mul_assoc := by
simp_rw [comp_whiskerRight, Category.assoc, μ_natural_left_assoc,
MonoidalCategory.whiskerLeft_comp, Category.assoc, μ_natural_right_assoc]
slice_lhs 3 4 => rw [← F.map_comp, MonObj.mul_assoc]
simp
@[deprecated (since := "2025-09-09")] alias mon_ClassObj := monObjObj
scoped[CategoryTheory.Obj] attribute [instance] CategoryTheory.Functor.monObjObj
open scoped Obj
@[reassoc, simp] lemma obj.η_def : (η : 𝟙_ D ⟶ F.obj X) = ε F ≫ F.map η := rfl
@[reassoc, simp] lemma obj.μ_def : μ = LaxMonoidal.μ F X X ≫ F.map μ := rfl
instance map.instIsMonHom : IsMonHom (F.map f) where
one_hom := by simp [← map_comp]
mul_hom := by simp [← map_comp]
open MonObj
-- TODO: mapMod F A : Mod A ⥤ Mod (F.mapMon A)
variable (F) in
/-- A lax monoidal functor takes monoid objects to monoid objects.
That is, a lax monoidal functor `F : C ⥤ D` induces a functor `Mon C ⥤ Mon D`.
-/
@[simps]
def mapMon : Mon C ⥤ Mon D where
obj A := .mk (F.obj A.X)
map f := .mk (F.map f.hom)
@[simp]
theorem id_mapMon_one (X : Mon C) : η[((𝟭 C).mapMon.obj X).X] = 𝟙 _ ≫ η[X.X] := rfl
@[simp]
theorem id_mapMon_mul (X : Mon C) : μ[((𝟭 C).mapMon.obj X).X] = 𝟙 _ ≫ μ[X.X] := rfl
@[simp]
theorem comp_mapMon_one (X : Mon C) :
η[((F ⋙ G).mapMon.obj X).X] = ε (F ⋙ G) ≫ (F ⋙ G).map η[X.X] :=
rfl
@[simp]
theorem comp_mapMon_mul (X : Mon C) :
μ[((F ⋙ G).mapMon.obj X).X] = «μ» (F ⋙ G) _ _ ≫ (F ⋙ G).map μ[X.X] :=
rfl
/-- The identity functor is also the identity on monoid objects. -/
@[simps!]
def mapMonIdIso : mapMon (𝟭 C) ≅ 𝟭 (Mon C) :=
NatIso.ofComponents fun X ↦ Mon.mkIso (.refl _)
/-- The composition functor is also the composition on monoid objects. -/
@[simps!]
def mapMonCompIso : (F ⋙ G).mapMon ≅ F.mapMon ⋙ G.mapMon :=
NatIso.ofComponents fun X ↦ Mon.mkIso (.refl _)
protected instance Faithful.mapMon [F.Faithful] : F.mapMon.Faithful where
map_injective {_X _Y} _f _g hfg := Mon.Hom.ext <| map_injective congr(($hfg).hom)
/-- Natural transformations between functors lift to monoid objects. -/
@[simps!]
def mapMonNatTrans (f : F ⟶ F') [NatTrans.IsMonoidal f] : F.mapMon ⟶ F'.mapMon where
app X := .mk' (f.app _)
/-- Natural isomorphisms between functors lift to monoid objects. -/
@[simps!]
def mapMonNatIso (e : F ≅ F') [NatTrans.IsMonoidal e.hom] : F.mapMon ≅ F'.mapMon :=
NatIso.ofComponents fun X ↦ Mon.mkIso (e.app _)
attribute [local simp] ε_tensorHom_comp_μ_assoc in
instance [F.LaxMonoidal] : IsMonHom (ε F) where
end LaxMonoidal
section OplaxMonoidal
variable [F.OplaxMonoidal]
open scoped MonObj in
/-- Pullback a monoid object along a fully faithful oplax monoidal functor. -/
@[simps]
abbrev FullyFaithful.monObj (hF : F.FullyFaithful) (X : C) [MonObj (F.obj X)] : MonObj X where
one := hF.preimage <| OplaxMonoidal.η F ≫ η[F.obj X]
mul := hF.preimage <| OplaxMonoidal.δ F X X ≫ μ[F.obj X]
one_mul := hF.map_injective <| by simp [← δ_natural_left_assoc]
mul_one := hF.map_injective <| by simp [← δ_natural_right_assoc]
mul_assoc := hF.map_injective <| by simp [← δ_natural_left_assoc, ← δ_natural_right_assoc]
@[deprecated (since := "2025-09-09")] alias FullyFaithful.mon_Class := FullyFaithful.monObj
end OplaxMonoidal
section Monoidal
variable [F.Monoidal]
open scoped Obj
protected instance Full.mapMon [F.Full] [F.Faithful] : F.mapMon.Full where
map_surjective {X Y} f :=
let ⟨g, hg⟩ := F.map_surjective f.hom
⟨{
hom := g
isMonHom_hom.one_hom :=
F.map_injective <| by simpa [← hg, cancel_epi] using IsMonHom.one_hom f.hom
isMonHom_hom.mul_hom :=
F.map_injective <| by simpa [← hg, cancel_epi] using IsMonHom.mul_hom f.hom },
Mon.Hom.ext hg⟩
instance FullyFaithful.isMonHom_preimage (hF : F.FullyFaithful) {X Y : C}
[MonObj X] [MonObj Y] (f : F.obj X ⟶ F.obj Y) [IsMonHom f] :
IsMonHom (hF.preimage f) where
one_hom := hF.map_injective <| by simp [← obj.η_def_assoc, ← obj.η_def, ← cancel_epi (ε F)]
mul_hom := hF.map_injective <| by
simp [← obj.μ_def_assoc, ← obj.μ_def, ← μ_natural_assoc, ← cancel_epi (LaxMonoidal.μ F ..)]
/-- If `F : C ⥤ D` is a fully faithful monoidal functor, then `Mon(F) : Mon C ⥤ Mon D` is fully
faithful too. -/
@[simps]
protected def FullyFaithful.mapMon (hF : F.FullyFaithful) : F.mapMon.FullyFaithful where
preimage {X Y} f := .mk' <| hF.preimage f.hom
attribute [local simp] MonObj.ofIso_one MonObj.ofIso_mul in
open Monoidal in
/-- The essential image of a fully faithful functor between cartesian-monoidal categories is the
same on monoid objects as on objects. -/
@[simp] lemma essImage_mapMon [F.Full] [F.Faithful] {M : Mon D} :
F.mapMon.essImage M ↔ F.essImage M.X where
mp := by rintro ⟨N, ⟨e⟩⟩; exact ⟨N.X, ⟨(Mon.forget _).mapIso e⟩⟩
mpr := by
rintro ⟨N, ⟨e⟩⟩
let : MonObj (F.obj N) := .ofIso e.symm
let : MonObj N := (FullyFaithful.ofFullyFaithful F).monObj N
refine ⟨.mk N, ⟨Mon.mkIso e ?_ ?_⟩⟩ <;> simp
end Monoidal
section BraidedCategory
variable [BraidedCategory C] [BraidedCategory D] (F)
open scoped Obj
attribute [-simp] IsMonHom.one_hom_assoc in
attribute [local simp← ] tensorHom_comp_tensorHom tensorHom_comp_tensorHom_assoc in
attribute [local simp] tensorμ_comp_μ_tensorHom_μ_comp_μ_assoc MonObj.tensorObj.one_def
MonObj.tensorObj.mul_def in
instance [F.LaxBraided] (M N : C) [MonObj M] [MonObj N] : IsMonHom («μ» F M N) where
one_hom := by simp [← Functor.map_comp, leftUnitor_inv_comp_tensorHom_assoc]
attribute [-simp] IsMonHom.one_hom IsMonHom.one_hom_assoc IsMonHom.mul_hom in
attribute [local simp] ε_tensorHom_comp_μ_assoc tensorμ_comp_μ_tensorHom_μ_comp_μ_assoc
MonObj.tensorObj.one_def MonObj.tensorObj.mul_def in
instance [F.LaxBraided] : F.mapMon.LaxMonoidal where
ε := .mk (ε F)
«μ» M N := .mk («μ» F M.X N.X)
attribute [-simp] IsMonHom.one_hom IsMonHom.one_hom_assoc IsMonHom.mul_hom in
attribute [local simp← ] tensorHom_comp_tensorHom tensorHom_comp_tensorHom_assoc in
attribute [local simp] ε_tensorHom_comp_μ_assoc tensorμ_comp_μ_tensorHom_μ_comp_μ_assoc
MonObj.tensorObj.one_def MonObj.tensorObj.mul_def in
instance [F.Braided] : F.mapMon.Monoidal :=
CoreMonoidal.toMonoidal {
εIso := Mon.mkIso (Monoidal.εIso F)
μIso M N := Mon.mkIso (Monoidal.μIso F M.X N.X) <| by simp [← Functor.map_comp]
}
end BraidedCategory
variable [SymmetricCategory C] [SymmetricCategory D]
instance [F.LaxBraided] : F.mapMon.LaxBraided where
braided M N := by ext; exact Functor.LaxBraided.braided ..
instance [F.Braided] : F.mapMon.Braided where
variable (C D) in
/-- `mapMon` is functorial in the lax monoidal functor. -/
@[simps]
def mapMonFunctor : LaxMonoidalFunctor C D ⥤ Mon C ⥤ Mon D where
obj F := F.mapMon
map α := { app A := .mk' (α.hom.app A.X) }
map_comp _ _ := rfl
end Functor
open Functor
namespace Adjunction
variable {F : C ⥤ D} {G : D ⥤ C} (a : F ⊣ G) [F.Monoidal] [G.LaxMonoidal] [a.IsMonoidal]
/-- An adjunction of monoidal functors lifts to an adjunction of their lifts to monoid objects. -/
@[simps] def mapMon : F.mapMon ⊣ G.mapMon where
unit := mapMonIdIso.inv ≫ mapMonNatTrans a.unit ≫ mapMonCompIso.hom
counit := mapMonCompIso.inv ≫ mapMonNatTrans a.counit ≫ mapMonIdIso.hom
end Adjunction
namespace Equivalence
/-- An equivalence of categories lifts to an equivalence of their monoid objects. -/
@[simps]
def mapMon (e : C ≌ D) [e.functor.Monoidal] [e.inverse.Monoidal] [e.IsMonoidal] :
Mon C ≌ Mon D where
functor := e.functor.mapMon
inverse := e.inverse.mapMon
unitIso := mapMonIdIso.symm ≪≫ mapMonNatIso e.unitIso ≪≫ mapMonCompIso
counitIso := mapMonCompIso.symm ≪≫ mapMonNatIso e.counitIso ≪≫ mapMonIdIso
end Equivalence
namespace Mon
namespace EquivLaxMonoidalFunctorPUnit
variable (C) in
/-- Implementation of `Mon.equivLaxMonoidalFunctorPUnit`. -/
@[simps]
def laxMonoidalToMon : LaxMonoidalFunctor (Discrete PUnit.{w + 1}) C ⥤ Mon C where
obj F := (F.mapMon : Mon _ ⥤ Mon C).obj (trivial (Discrete PUnit))
map α := ((Functor.mapMonFunctor (Discrete PUnit) C).map α).app _
/-- Implementation of `Mon.equivLaxMonoidalFunctorPUnit`. -/
@[simps!]
def monToLaxMonoidalObj (A : Mon C) :
Discrete PUnit.{w + 1} ⥤ C := (Functor.const _).obj A.X
instance (A : Mon C) : (monToLaxMonoidalObj A).LaxMonoidal where
ε := η[A.X]
«μ» _ _ := μ[A.X]
@[simp]
lemma monToLaxMonoidalObj_ε (A : Mon C) :
ε (monToLaxMonoidalObj A) = η[A.X] := rfl
@[simp]
lemma monToLaxMonoidalObj_μ (A : Mon C) (X Y) :
«μ» (monToLaxMonoidalObj A) X Y = μ[A.X] := rfl
variable (C)
/-- Implementation of `Mon.equivLaxMonoidalFunctorPUnit`. -/
@[simps]
def monToLaxMonoidal : Mon C ⥤ LaxMonoidalFunctor (Discrete PUnit.{w + 1}) C where
obj A := LaxMonoidalFunctor.of (monToLaxMonoidalObj A)
map f :=
{ hom := { app _ := f.hom }
isMonoidal := { } }
attribute [local aesop safe tactic (rule_sets := [CategoryTheory])]
CategoryTheory.Discrete.discreteCases
/-- Implementation of `Mon.equivLaxMonoidalFunctorPUnit`. -/
@[simps!]
def unitIso :
𝟭 (LaxMonoidalFunctor (Discrete PUnit.{w + 1}) C) ≅ laxMonoidalToMon C ⋙ monToLaxMonoidal C :=
NatIso.ofComponents
(fun F ↦ LaxMonoidalFunctor.isoOfComponents (fun _ ↦ F.mapIso (eqToIso (by ext))))
/-- Auxiliary definition for `counitIso`. -/
@[simps!]
def counitIsoAux (F : Mon C) :
((monToLaxMonoidal.{w} C ⋙ laxMonoidalToMon C).obj F).X ≅ ((𝟭 (Mon C)).obj F).X :=
Iso.refl _
@[simp]
theorem monToLaxMonoidal_laxMonoidalToMon_obj_one (F : Mon C) :
η[((monToLaxMonoidal C ⋙ laxMonoidalToMon C).obj F).X] = η[F.X] ≫ 𝟙 _ :=
rfl
@[simp]
theorem monToLaxMonoidal_laxMonoidalToMon_obj_mul (F : Mon C) :
μ[((monToLaxMonoidal C ⋙ laxMonoidalToMon C).obj F).X] = μ[F.X] ≫ 𝟙 _ :=
rfl
theorem isMonHom_counitIsoAux (F : Mon C) :
IsMonHom (counitIsoAux C F).hom where
@[deprecated (since := "2025-09-15")] alias counitIsoAux_IsMon_Hom := isMonHom_counitIsoAux
/-- Implementation of `Mon.equivLaxMonoidalFunctorPUnit`. -/
@[simps!]
def counitIso : monToLaxMonoidal.{w} C ⋙ laxMonoidalToMon C ≅ 𝟭 (Mon C) :=
NatIso.ofComponents fun F ↦
letI : IsMonHom (counitIsoAux.{w} C F).hom := isMonHom_counitIsoAux C F
mkIso (counitIsoAux.{w} C F)
end EquivLaxMonoidalFunctorPUnit
open EquivLaxMonoidalFunctorPUnit
attribute [local simp] eqToIso_map
/--
Monoid objects in `C` are "just" lax monoidal functors from the trivial monoidal category to `C`.
-/
@[simps]
def equivLaxMonoidalFunctorPUnit : LaxMonoidalFunctor (Discrete PUnit.{w + 1}) C ≌ Mon C where
functor := laxMonoidalToMon C
inverse := monToLaxMonoidal C
unitIso := unitIso C
counitIso := counitIso C
end Mon
section
variable [BraidedCategory.{v₁} C]
/-- Predicate for a monoid object to be commutative. -/
class IsCommMonObj (X : C) [MonObj X] where
mul_comm (X) : (β_ X X).hom ≫ μ = μ := by cat_disch
@[deprecated (since := "2025-09-14")] alias IsCommMon := IsCommMonObj
open scoped MonObj
namespace IsCommMonObj
attribute [reassoc (attr := simp, mon_tauto)] mul_comm
variable (M) in
@[reassoc (attr := simp, mon_tauto)]
lemma mul_comm' [IsCommMonObj M] : (β_ M M).inv ≫ μ = μ := by simp [← cancel_epi (β_ M M).hom]
instance : IsCommMonObj (𝟙_ C) where
mul_comm := by dsimp; rw [braiding_leftUnitor, unitors_equal]
end IsCommMonObj
variable (M) in
@[reassoc (attr := simp)]
lemma MonObj.mul_mul_mul_comm [IsCommMonObj M] :
tensorμ M M M M ≫ (μ ⊗ₘ μ) ≫ μ = (μ ⊗ₘ μ) ≫ μ := by simp only [mon_tauto]
@[deprecated (since := "2025-09-09")] alias Mon_Class.mul_mul_mul_comm := MonObj.mul_mul_mul_comm
variable (M) in
@[reassoc (attr := simp)]
lemma MonObj.mul_mul_mul_comm' [IsCommMonObj M] :
tensorδ M M M M ≫ (μ ⊗ₘ μ) ≫ μ = (μ ⊗ₘ μ) ≫ μ := by simp only [mon_tauto]
@[deprecated (since := "2025-09-09")] alias Mon_Class.mul_mul_mul_comm' := MonObj.mul_mul_mul_comm'
end
section SymmetricCategory
variable [SymmetricCategory C] {M N W X Y Z : C} [MonObj M] [MonObj N]
instance [IsCommMonObj M] [IsCommMonObj N] : IsCommMonObj (M ⊗ N) where
mul_comm := by
simp [← IsIso.inv_comp_eq, tensorμ, ← associator_inv_naturality_left_assoc,
← associator_naturality_right_assoc, SymmetricCategory.braiding_swap_eq_inv_braiding M N,
← tensorHom_def_assoc, -whiskerRight_tensor, -tensor_whiskerLeft, MonObj.tensorObj.mul_def,
← MonoidalCategory.whiskerLeft_comp_assoc, -MonoidalCategory.whiskerLeft_comp]
end SymmetricCategory
end CategoryTheory |
.lake/packages/mathlib/Mathlib/CategoryTheory/Monoidal/FunctorCategory.lean | import Mathlib.CategoryTheory.Monoidal.Braided.Basic
import Mathlib.CategoryTheory.Functor.Category
import Mathlib.CategoryTheory.Functor.Const
/-!
# Monoidal structure on `C ⥤ D` when `D` is monoidal.
When `C` is any category, and `D` is a monoidal category,
there is a natural "pointwise" monoidal structure on `C ⥤ D`.
The initial intended application is tensor product of presheaves.
-/
universe v₁ v₂ u₁ u₂
open CategoryTheory
open CategoryTheory.MonoidalCategory
namespace CategoryTheory
variable {C : Type u₁} [Category.{v₁} C]
variable {D : Type u₂} [Category.{v₂} D] [MonoidalCategory.{v₂} D]
namespace Monoidal
namespace FunctorCategory
variable (F G F' G' : C ⥤ D)
/-- (An auxiliary definition for `functorCategoryMonoidal`.)
Tensor product of functors `C ⥤ D`, when `D` is monoidal.
-/
@[simps]
def tensorObj : C ⥤ D where
obj X := F.obj X ⊗ G.obj X
map f := F.map f ⊗ₘ G.map f
variable {F G F' G'}
variable (α : F ⟶ G) (β : F' ⟶ G')
/-- (An auxiliary definition for `functorCategoryMonoidal`.)
Tensor product of natural transformations into `D`, when `D` is monoidal.
-/
@[simps]
def tensorHom : tensorObj F F' ⟶ tensorObj G G' where
app X := α.app X ⊗ₘ β.app X
naturality X Y f := by
dsimp; rw [tensorHom_comp_tensorHom, α.naturality, β.naturality, ← tensorHom_comp_tensorHom]
/-- (An auxiliary definition for `functorCategoryMonoidal`.) -/
@[simps]
def whiskerLeft (F) (β : F' ⟶ G') : tensorObj F F' ⟶ tensorObj F G' where
app X := F.obj X ◁ β.app X
naturality X Y f := by
simp only [← id_tensorHom]
apply (tensorHom (𝟙 F) β).naturality
/-- (An auxiliary definition for `functorCategoryMonoidal`.) -/
@[simps]
def whiskerRight (F') : tensorObj F F' ⟶ tensorObj G F' where
app X := α.app X ▷ F'.obj X
naturality X Y f := by
simp only [← tensorHom_id]
apply (tensorHom α (𝟙 F')).naturality
end FunctorCategory
open CategoryTheory.Monoidal.FunctorCategory
/-- When `C` is any category, and `D` is a monoidal category,
the functor category `C ⥤ D` has a natural pointwise monoidal structure,
where `(F ⊗ G).obj X = F.obj X ⊗ G.obj X`.
-/
instance functorCategoryMonoidalStruct : MonoidalCategoryStruct (C ⥤ D) where
tensorObj F G := tensorObj F G
tensorHom α β := tensorHom α β
whiskerLeft F _ _ α := FunctorCategory.whiskerLeft F α
whiskerRight α F := FunctorCategory.whiskerRight α F
tensorUnit := (CategoryTheory.Functor.const C).obj (𝟙_ D)
leftUnitor F := NatIso.ofComponents fun X => λ_ (F.obj X)
rightUnitor F := NatIso.ofComponents fun X => ρ_ (F.obj X)
associator F G H := NatIso.ofComponents fun X => α_ (F.obj X) (G.obj X) (H.obj X)
@[simp]
theorem tensorUnit_obj {X} : (𝟙_ (C ⥤ D)).obj X = 𝟙_ D :=
rfl
@[simp]
theorem tensorUnit_map {X Y} {f : X ⟶ Y} : (𝟙_ (C ⥤ D)).map f = 𝟙 (𝟙_ D) :=
rfl
@[simp]
theorem tensorObj_obj {F G : C ⥤ D} {X} : (F ⊗ G).obj X = F.obj X ⊗ G.obj X :=
rfl
@[simp]
theorem tensorObj_map {F G : C ⥤ D} {X Y} {f : X ⟶ Y} : (F ⊗ G).map f = F.map f ⊗ₘ G.map f :=
rfl
@[simp]
theorem tensorHom_app {F G F' G' : C ⥤ D} {α : F ⟶ G} {β : F' ⟶ G'} {X} :
(α ⊗ₘ β).app X = α.app X ⊗ₘ β.app X :=
rfl
@[simp]
theorem whiskerLeft_app {F F' G' : C ⥤ D} {β : F' ⟶ G'} {X} :
(F ◁ β).app X = F.obj X ◁ β.app X :=
rfl
@[simp]
theorem whiskerRight_app {F G F' : C ⥤ D} {α : F ⟶ G} {X} :
(α ▷ F').app X = α.app X ▷ F'.obj X :=
rfl
@[simp]
theorem leftUnitor_hom_app {F : C ⥤ D} {X} :
((λ_ F).hom : 𝟙_ _ ⊗ F ⟶ F).app X = (λ_ (F.obj X)).hom :=
rfl
@[simp]
theorem leftUnitor_inv_app {F : C ⥤ D} {X} :
((λ_ F).inv : F ⟶ 𝟙_ _ ⊗ F).app X = (λ_ (F.obj X)).inv :=
rfl
@[simp]
theorem rightUnitor_hom_app {F : C ⥤ D} {X} :
((ρ_ F).hom : F ⊗ 𝟙_ _ ⟶ F).app X = (ρ_ (F.obj X)).hom :=
rfl
@[simp]
theorem rightUnitor_inv_app {F : C ⥤ D} {X} :
((ρ_ F).inv : F ⟶ F ⊗ 𝟙_ _).app X = (ρ_ (F.obj X)).inv :=
rfl
@[simp]
theorem associator_hom_app {F G H : C ⥤ D} {X} :
((α_ F G H).hom : (F ⊗ G) ⊗ H ⟶ F ⊗ G ⊗ H).app X = (α_ (F.obj X) (G.obj X) (H.obj X)).hom :=
rfl
@[simp]
theorem associator_inv_app {F G H : C ⥤ D} {X} :
((α_ F G H).inv : F ⊗ G ⊗ H ⟶ (F ⊗ G) ⊗ H).app X = (α_ (F.obj X) (G.obj X) (H.obj X)).inv :=
rfl
/-- When `C` is any category, and `D` is a monoidal category,
the functor category `C ⥤ D` has a natural pointwise monoidal structure,
where `(F ⊗ G).obj X = F.obj X ⊗ G.obj X`.
-/
instance functorCategoryMonoidal : MonoidalCategory (C ⥤ D) where
tensorHom_def := by intros; ext; simp [tensorHom_def]
pentagon F G H K := by ext X; dsimp; rw [pentagon]
section BraidedCategory
open CategoryTheory.BraidedCategory
variable [BraidedCategory.{v₂} D]
/-- When `C` is any category, and `D` is a braided monoidal category,
the natural pointwise monoidal structure on the functor category `C ⥤ D`
is also braided.
-/
instance functorCategoryBraided : BraidedCategory (C ⥤ D) where
braiding F G := NatIso.ofComponents fun _ => β_ _ _
hexagon_forward F G H := by ext X; apply hexagon_forward
hexagon_reverse F G H := by ext X; apply hexagon_reverse
example : BraidedCategory (C ⥤ D) :=
CategoryTheory.Monoidal.functorCategoryBraided
end BraidedCategory
section SymmetricCategory
open CategoryTheory.SymmetricCategory
variable [SymmetricCategory.{v₂} D]
/-- When `C` is any category, and `D` is a symmetric monoidal category,
the natural pointwise monoidal structure on the functor category `C ⥤ D`
is also symmetric.
-/
instance functorCategorySymmetric : SymmetricCategory (C ⥤ D) where
symmetry F G := by ext X; apply symmetry
end SymmetricCategory
end Monoidal
@[simps]
instance Functor.LaxMonoidal.whiskeringRight
{C D E : Type*} [Category C] [Category D] [Category E] [MonoidalCategory D]
[MonoidalCategory E] (L : D ⥤ E) [L.LaxMonoidal] :
((Functor.whiskeringRight C D E).obj L).LaxMonoidal where
ε := { app X := Functor.LaxMonoidal.ε L }
μ F G := { app X := Functor.LaxMonoidal.μ L (F.obj X) (G.obj X) }
@[simps]
instance Functor.OplaxMonoidal.whiskeringRight
{C D E : Type*} [Category C] [Category D] [Category E] [MonoidalCategory D]
[MonoidalCategory E] (L : D ⥤ E) [L.OplaxMonoidal] :
((Functor.whiskeringRight C D E).obj L).OplaxMonoidal where
η := { app X := Functor.OplaxMonoidal.η L }
δ F G := { app X := Functor.OplaxMonoidal.δ L (F.obj X) (G.obj X) }
oplax_left_unitality := by aesop
oplax_right_unitality := by aesop
instance {C D E : Type*} [Category C] [Category D] [Category E] [MonoidalCategory D]
[MonoidalCategory E] (L : D ⥤ E) [L.Monoidal] :
((Functor.whiskeringRight C D E).obj L).Monoidal where
@[deprecated (since := "2025-11-06")] alias instLaxMonoidalFunctorObjWhiskeringRight :=
Functor.LaxMonoidal.whiskeringRight
@[deprecated (since := "2025-11-06")] alias instOplaxMonoidalFunctorObjWhiskeringRight :=
Functor.OplaxMonoidal.whiskeringRight
@[deprecated (since := "2025-11-06")] alias ε_app := Functor.LaxMonoidal.whiskeringRight_ε_app
@[deprecated (since := "2025-11-06")] alias μ_app := Functor.LaxMonoidal.whiskeringRight_μ_app
@[deprecated (since := "2025-11-06")] alias η_app := Functor.OplaxMonoidal.whiskeringRight_η_app
@[deprecated (since := "2025-11-06")] alias δ_app := Functor.OplaxMonoidal.whiskeringRight_δ_app
@[simps!]
instance Functor.Monoidal.whiskeringLeft (E : Type*) [Category E] [MonoidalCategory E] (F : C ⥤ D) :
((whiskeringLeft _ _ E).obj F).Monoidal :=
CoreMonoidal.toMonoidal { εIso := Iso.refl _, μIso _ _ := Iso.refl _ }
end CategoryTheory |
.lake/packages/mathlib/Mathlib/CategoryTheory/Monoidal/Bimon_.lean | import Mathlib.CategoryTheory.Monoidal.Comon_
/-!
# The category of bimonoids in a braided monoidal category.
We define bimonoids in a braided monoidal category `C`
as comonoid objects in the category of monoid objects in `C`.
We verify that this is equivalent to the monoid objects in the category of comonoid objects.
## TODO
* Construct the category of modules, and show that it is monoidal with a monoidal forgetful functor
to `C`.
* Some form of Tannaka reconstruction:
given a monoidal functor `F : C ⥤ D` into a braided category `D`,
the internal endomorphisms of `F` form a bimonoid in presheaves on `D`,
in good circumstances this is representable by a bimonoid in `D`, and then
`C` is monoidally equivalent to the modules over that bimonoid.
-/
noncomputable section
universe v₁ v₂ u₁ u₂ u
open CategoryTheory MonoidalCategory
namespace CategoryTheory
variable {C : Type u₁} [Category.{v₁} C] [MonoidalCategory.{v₁} C] [BraidedCategory C]
open scoped MonObj ComonObj
/--
A bimonoid object in a braided category `C` is an object that is simultaneously monoid and comonoid
objects, and structure morphisms of them satisfy appropriate consistency conditions.
-/
class BimonObj (M : C) extends MonObj M, ComonObj M where
mul_comul (M) : μ[M] ≫ Δ[M] = (Δ[M] ⊗ₘ Δ[M]) ≫ tensorμ M M M M ≫ (μ[M] ⊗ₘ μ[M]) := by cat_disch
one_comul (M) : η[M] ≫ Δ[M] = η[M ⊗ M] := by cat_disch
mul_counit (M) : μ[M] ≫ ε[M] = ε[M ⊗ M] := by cat_disch
one_counit (M) : η[M] ≫ ε[M] = 𝟙 (𝟙_ C) := by cat_disch
@[deprecated (since := "2025-09-09")] alias Bimon_Class := BimonObj
namespace BimonObj
attribute [reassoc (attr := simp)] mul_comul one_comul mul_counit one_counit
end BimonObj
/-- The property that a morphism between bimonoid objects is a bimonoid morphism. -/
class IsBimonHom {M N : C} [BimonObj M] [BimonObj N] (f : M ⟶ N) : Prop extends
IsMonHom f, IsComonHom f
@[deprecated (since := "2025-09-15")] alias IsBimon_Hom := IsBimonHom
variable (C) in
/--
A bimonoid object in a braided category `C` is a comonoid object in the (monoidal)
category of monoid objects in `C`.
-/
def Bimon := Comon (Mon C)
@[deprecated (since := "2025-09-15")] alias Bimon_ := Bimon
namespace Bimon
instance : Category (Bimon C) := inferInstanceAs (Category (Comon (Mon C)))
@[ext] lemma ext {X Y : Bimon C} {f g : X ⟶ Y} (w : f.hom.hom = g.hom.hom) : f = g :=
Comon.Hom.ext (Mon.Hom.ext w)
@[simp] theorem id_hom' (M : Bimon C) : Comon.Hom.hom (𝟙 M) = 𝟙 M.X := rfl
@[simp]
theorem comp_hom' {M N K : Bimon C} (f : M ⟶ N) (g : N ⟶ K) : (f ≫ g).hom = f.hom ≫ g.hom :=
rfl
variable (C)
/-- The forgetful functor from bimonoid objects to monoid objects. -/
abbrev toMon : Bimon C ⥤ Mon C := Comon.forget (Mon C)
@[deprecated (since := "2025-09-15")] alias toMon_ := toMon
/-- The forgetful functor from bimonoid objects to the underlying category. -/
def forget : Bimon C ⥤ C := toMon C ⋙ Mon.forget C
@[simp]
theorem toMon_forget : toMon C ⋙ Mon.forget C = forget C := rfl
/-- The forgetful functor from bimonoid objects to comonoid objects. -/
@[simps!]
def toComon : Bimon C ⥤ Comon C := (Mon.forget C).mapComon
@[deprecated (since := "2025-09-15")] alias toComon_ := toComon
@[simp]
theorem toComon_forget : toComon C ⋙ Comon.forget C = forget C := rfl
variable {C} in
/-- The object level part of the forward direction of `Comon (Mon C) ≌ Mon (Comon C)` -/
@[simps]
def toMonComonObj (M : Bimon C) : Mon (Comon C) where
X := (toComon C).obj M
mon.one := .mk' η[M.X.X]
mon.mul.hom := μ[M.X.X]
mon.mul.isComonHom_hom.hom_comul := by simp
@[deprecated (since := "2025-09-15")] alias toMon_Comon_obj := toMonComonObj
/-- The forward direction of `Comon (Mon C) ≌ Mon (Comon C)` -/
@[simps]
def toMonComon : Bimon C ⥤ Mon (Comon C) where
obj := toMonComonObj
map f := .mk' ((toComon C).map f)
@[deprecated (since := "2025-09-15")] alias toMon_Comon_ := toMonComon
variable {C}
/-- Auxiliary definition for `ofMonComonObj`. -/
@[simps! X]
def ofMonComonObjX (M : Mon (Comon C)) : Mon C := (Comon.forget C).mapMon.obj M
@[deprecated (since := "2025-09-15")] alias ofMon_Comon_ObjX := ofMonComonObjX
@[simp]
theorem ofMonComonObjX_one (M : Mon (Comon C)) :
η[(ofMonComonObjX M).X] = 𝟙 (𝟙_ C) ≫ η[M.X].hom :=
rfl
@[deprecated (since := "2025-09-15")] alias ofMon_Comon_ObjX_one := ofMonComonObjX_one
@[simp]
theorem ofMonComonObjX_mul (M : Mon (Comon C)) :
μ[(ofMonComonObjX M).X] = 𝟙 (M.X.X ⊗ M.X.X) ≫ μ[M.X].hom :=
rfl
@[deprecated (since := "2025-09-15")] alias ofMon_Comon_ObjX_mul := ofMonComonObjX_mul
attribute [local instance] ComonObj.instTensorUnit in
attribute [local simp] MonObj.tensorObj.one_def MonObj.tensorObj.mul_def tensorμ in
/-- The object level part of the backward direction of `Comon (Mon C) ≌ Mon (Comon C)` -/
@[simps]
def ofMonComonObj (M : Mon (Comon C)) : Bimon C where
X := ofMonComonObjX M
comon.counit := .mk' ε[M.X.X]
comon.comul := .mk' Δ[M.X.X]
@[deprecated (since := "2025-09-15")] alias ofMon_Comon_Obj := ofMonComonObj
@[deprecated (since := "2025-09-09")] alias Mon_Class.tensorObj.mul_def := MonObj.tensorObj.mul_def
variable (C) in
/-- The backward direction of `Comon (Mon C) ≌ Mon (Comon C)` -/
@[simps]
def ofMonComon : Mon (Comon C) ⥤ Bimon C where
obj := ofMonComonObj
map f := .mk' ((Comon.forget C).mapMon.map f)
@[deprecated (since := "2025-09-15")] alias ofMon_Comon_ := ofMonComon
@[simp]
theorem toMonComon_ofMonComon_obj_one (M : Bimon C) :
η[((toMonComon C ⋙ ofMonComon C).obj M).X.X] = 𝟙 _ ≫ η[M.X.X] :=
rfl
@[deprecated (since := "2025-09-15")]
alias toMon_Comon_ofMon_Comon_obj_one := toMonComon_ofMonComon_obj_one
@[simp]
theorem toMonComon_ofMonComon_obj_mul (M : Bimon C) :
μ[((toMonComon C ⋙ ofMonComon C).obj M).X.X] = 𝟙 _ ≫ μ[M.X.X] :=
rfl
@[deprecated (since := "2025-09-15")]
alias toMon_Comon_ofMon_Comon_obj_mul := toMonComon_ofMonComon_obj_mul
/-- Auxiliary definition for `equivMonComonUnitIsoApp`. -/
@[simps!]
def equivMonComonUnitIsoAppXAux (M : Bimon C) :
M.X.X ≅ ((toMonComon C ⋙ ofMonComon C).obj M).X.X :=
Iso.refl _
@[deprecated (since := "2025-09-15")]
alias equivMon_Comon_UnitIsoAppXAux := equivMonComonUnitIsoAppXAux
instance (M : Bimon C) : IsMonHom (equivMonComonUnitIsoAppXAux M).hom where
/-- Auxiliary definition for `equivMonComonUnitIsoApp`. -/
@[simps!]
def equivMonComonUnitIsoAppX (M : Bimon C) :
M.X ≅ ((toMonComon C ⋙ ofMonComon C).obj M).X :=
Mon.mkIso (equivMonComonUnitIsoAppXAux M)
@[deprecated (since := "2025-09-15")] alias equivMon_Comon_UnitIsoAppX := equivMonComonUnitIsoAppX
instance (M : Bimon C) : IsComonHom (equivMonComonUnitIsoAppX M).hom where
/-- The unit for the equivalence `Comon (Mon C) ≌ Mon (Comon C)`. -/
@[simps!]
def equivMonComonUnitIsoApp (M : Bimon C) :
M ≅ (toMonComon C ⋙ ofMonComon C).obj M :=
Comon.mkIso' (equivMonComonUnitIsoAppX M)
@[deprecated (since := "2025-09-15")] alias equivMon_Comon_UnitIsoApp := equivMonComonUnitIsoApp
@[simp]
theorem ofMonComon_toMonComon_obj_counit (M : Mon (Comon C)) :
ε[((ofMonComon C ⋙ toMonComon C).obj M).X.X] = ε[M.X.X] ≫ 𝟙 _ :=
rfl
@[deprecated (since := "2025-09-15")]
alias ofMon_Comon_toMon_Comon_obj_counit := ofMonComon_toMonComon_obj_counit
@[simp]
theorem ofMonComon_toMonComon_obj_comul (M : Mon (Comon C)) :
Δ[((ofMonComon C ⋙ toMonComon C).obj M).X.X] = Δ[M.X.X] ≫ 𝟙 _ :=
rfl
@[deprecated (since := "2025-09-15")]
alias ofMon_Comon_toMon_Comon_obj_comul := ofMonComon_toMonComon_obj_comul
/-- Auxiliary definition for `equivMonComonCounitIsoApp`. -/
@[simps!]
def equivMonComonCounitIsoAppXAux (M : Mon (Comon C)) :
((ofMonComon C ⋙ toMonComon C).obj M).X.X ≅ M.X.X :=
Iso.refl _
@[deprecated (since := "2025-09-15")]
alias equivMon_Comon_CounitIsoAppXAux := equivMonComonCounitIsoAppXAux
instance (M : Mon (Comon C)) : IsComonHom (equivMonComonCounitIsoAppXAux M).hom where
/-- Auxiliary definition for `equivMonComonCounitIsoApp`. -/
@[simps!]
def equivMonComonCounitIsoAppX (M : Mon (Comon C)) :
((ofMonComon C ⋙ toMonComon C).obj M).X ≅ M.X :=
Comon.mkIso' (equivMonComonCounitIsoAppXAux M)
@[deprecated (since := "2025-09-15")]
alias equivMon_Comon_CounitIsoAppX := equivMonComonCounitIsoAppX
instance (M : Mon (Comon C)) : IsMonHom (equivMonComonCounitIsoAppX M).hom where
/-- The counit for the equivalence `Comon (Mon C) ≌ Mon (Comon C)`. -/
@[simps!]
def equivMonComonCounitIsoApp (M : Mon (Comon C)) :
(ofMonComon C ⋙ toMonComon C).obj M ≅ M :=
Mon.mkIso <| (equivMonComonCounitIsoAppX M)
@[deprecated (since := "2025-09-15")] alias equivMon_Comon_CounitIsoApp := equivMonComonCounitIsoApp
/-- The equivalence `Comon (Mon C) ≌ Mon (Comon C)` -/
def equivMonComon : Bimon C ≌ Mon (Comon C) where
functor := toMonComon C
inverse := ofMonComon C
unitIso := NatIso.ofComponents equivMonComonUnitIsoApp
counitIso := NatIso.ofComponents equivMonComonCounitIsoApp
@[deprecated (since := "2025-09-15")] alias equivMon_Comon_ := equivMonComon
/-! ### The trivial bimonoid -/
variable (C) in
/-- The trivial bimonoid object. -/
@[simps!]
def trivial : Bimon C := Comon.trivial (Mon C)
/-- The bimonoid morphism from the trivial bimonoid to any bimonoid. -/
@[simps]
def trivialTo (A : Bimon C) : trivial C ⟶ A :=
.mk' (default : Mon.trivial C ⟶ A.X)
/-- The bimonoid morphism from any bimonoid to the trivial bimonoid. -/
@[simps!]
def toTrivial (A : Bimon C) : A ⟶ trivial C :=
(default : @Quiver.Hom (Comon (Mon C)) _ A (Comon.trivial (Mon C)))
/-! ### Additional lemmas -/
theorem BimonObjAux_counit (M : Bimon C) :
ε[((toComon C).obj M).X] = ε[M.X].hom :=
Category.comp_id _
@[deprecated (since := "2025-09-09")] alias Bimon_ClassAux_counit := BimonObjAux_counit
theorem BimonObjAux_comul (M : Bimon C) :
Δ[((toComon C).obj M).X] = Δ[M.X].hom :=
Category.comp_id _
@[deprecated (since := "2025-09-09")] alias Bimon_ClassAux_comul := BimonObjAux_comul
instance (M : Bimon C) : BimonObj M.X.X where
counit := ε[M.X].hom
comul := Δ[M.X].hom
counit_comul := by
rw [← BimonObjAux_counit, ← BimonObjAux_comul, ComonObj.counit_comul]
comul_counit := by
rw [← BimonObjAux_counit, ← BimonObjAux_comul, ComonObj.comul_counit]
comul_assoc := by
simp_rw [← BimonObjAux_comul, ComonObj.comul_assoc]
attribute [local simp] MonObj.tensorObj.one_def in
@[reassoc]
theorem one_comul (M : C) [BimonObj M] :
η[M] ≫ Δ[M] = (λ_ _).inv ≫ (η[M] ⊗ₘ η[M]) := by
simp
@[reassoc]
theorem mul_counit (M : C) [BimonObj M] :
μ[M] ≫ ε[M] = (ε[M] ⊗ₘ ε[M]) ≫ (λ_ _).hom := by
simp
/-- Compatibility of the monoid and comonoid structures, in terms of morphisms in `C`. -/
@[reassoc (attr := simp)] theorem compatibility (M : C) [BimonObj M] :
(Δ[M] ⊗ₘ Δ[M]) ≫
(α_ _ _ (M ⊗ M)).hom ≫ M ◁ (α_ _ _ _).inv ≫
M ◁ (β_ M M).hom ▷ M ≫
M ◁ (α_ _ _ _).hom ≫ (α_ _ _ _).inv ≫
(μ[M] ⊗ₘ μ[M]) =
μ[M] ≫ Δ[M] := by
simp only [BimonObj.mul_comul, tensorμ, Category.assoc]
/-- Auxiliary definition for `Bimon.mk'`. -/
@[simps X]
def mk'X (X : C) [BimonObj X] : Mon C := { X := X }
/-- Construct an object of `Bimon C` from an object `X : C` and `BimonObj X` instance. -/
@[simps X]
def mk' (X : C) [BimonObj X] : Bimon C where
X := mk'X X
comon :=
{ counit := .mk' (ε : X ⟶ 𝟙_ C)
comul := .mk' (Δ : X ⟶ X ⊗ X) }
end Bimon
end CategoryTheory |
.lake/packages/mathlib/Mathlib/CategoryTheory/Monoidal/Cartesian/Grp_.lean | import Mathlib.Algebra.Category.Grp.Limits
import Mathlib.CategoryTheory.Monoidal.Cartesian.Mon_
import Mathlib.CategoryTheory.Monoidal.Grp_
/-!
# Yoneda embedding of `Grp C`
We show that group objects are exactly those whose yoneda presheaf is a presheaf of groups,
by constructing the yoneda embedding `Grp C ⥤ Cᵒᵖ ⥤ GrpCat.{v}` and
showing that it is fully faithful and its (essential) image is the representable functors.
-/
assert_not_exists Field
open CategoryTheory MonoidalCategory Limits Opposite CartesianMonoidalCategory MonObj
namespace CategoryTheory
universe w v u
variable {C : Type u} [Category.{v} C] [CartesianMonoidalCategory C]
{M G H X Y : C} [MonObj M] [GrpObj G] [GrpObj H]
/-- Construct a morphism `G ⟶ H` of `Grp C` C from a map `f : G ⟶ H` and a `IsMonHom f`
instance. -/
@[simps]
def Grp.homMk (f : G ⟶ H) [IsMonHom f] : .mk G ⟶ Grp.mk H := ⟨f⟩
@[deprecated (since := "2025-10-13")] alias Grp_.homMk := Grp.homMk
@[simp]
lemma Grp.homMk_hom' {G H : Grp C} (f : G ⟶ H) : homMk (G := G.X) (H := H.X) f.hom = f := rfl
@[deprecated (since := "2025-10-13")] alias Grp_.homMk_hom' := Grp.homMk_hom'
variable (X) in
/-- If `X` represents a presheaf of monoids, then `X` is a monoid object. -/
def GrpObj.ofRepresentableBy (F : Cᵒᵖ ⥤ GrpCat.{w}) (α : (F ⋙ forget _).RepresentableBy X) :
GrpObj X where
__ := MonObj.ofRepresentableBy X (F ⋙ forget₂ GrpCat MonCat) α
inv := α.homEquiv.symm (α.homEquiv (𝟙 _))⁻¹
left_inv := by
change lift (α.homEquiv.symm (α.homEquiv (𝟙 X))⁻¹) (𝟙 X) ≫
α.homEquiv.symm (α.homEquiv (fst X X) * α.homEquiv (snd X X)) =
toUnit X ≫ α.homEquiv.symm 1
apply α.homEquiv.injective
simp only [α.homEquiv_comp, Equiv.apply_symm_apply]
simp only [Functor.comp_map, ConcreteCategory.forget_map_eq_coe, map_one, map_mul]
simp only [← ConcreteCategory.forget_map_eq_coe, ← Functor.comp_map, ← α.homEquiv_comp]
simp [- Functor.comp_obj]
right_inv := by
change lift (𝟙 X) (α.homEquiv.symm (α.homEquiv (𝟙 X))⁻¹) ≫
α.homEquiv.symm (α.homEquiv (fst X X) * α.homEquiv (snd X X)) =
toUnit X ≫ α.homEquiv.symm 1
apply α.homEquiv.injective
simp only [α.homEquiv_comp, Equiv.apply_symm_apply]
simp only [Functor.comp_map, ConcreteCategory.forget_map_eq_coe, map_one, map_mul]
simp only [← ConcreteCategory.forget_map_eq_coe, ← Functor.comp_map, ← α.homEquiv_comp]
simp [- Functor.comp_obj]
@[deprecated (since := "2025-09-13")] alias Grp_Class.ofRepresentableBy := GrpObj.ofRepresentableBy
/-- If `G` is a group object, then `Hom(X, G)` has a group structure. -/
abbrev Hom.group : Group (X ⟶ G) where
inv f := f ≫ ι
inv_mul_cancel f := calc
lift (f ≫ ι) f ≫ μ
_ = (f ≫ lift ι (𝟙 G)) ≫ μ := by simp
_ = toUnit X ≫ η := by rw [Category.assoc]; simp
scoped[CategoryTheory.MonObj] attribute [instance] Hom.group
lemma Hom.inv_def (f : X ⟶ G) : f⁻¹ = f ≫ ι := rfl
variable (G) in
/-- If `G` is a group object, then `Hom(-, G)` is a presheaf of groups. -/
@[simps]
def yonedaGrpObj : Cᵒᵖ ⥤ GrpCat.{v} where
obj X := GrpCat.of (unop X ⟶ G)
map φ := GrpCat.ofHom ((yonedaMonObj G).map φ).hom
variable (G) in
/-- If `G` is a monoid object, then `Hom(-, G)` as a presheaf of monoids is represented by `G`. -/
def yonedaGrpObjRepresentableBy : (yonedaGrpObj G ⋙ forget _).RepresentableBy G :=
Functor.representableByEquiv.symm (.refl _)
variable (G) in
lemma GrpObj.ofRepresentableBy_yonedaGrpObjRepresentableBy :
ofRepresentableBy G _ (yonedaGrpObjRepresentableBy G) = ‹GrpObj G› := by
ext; change lift (fst G G) (snd G G) ≫ μ = μ; rw [lift_fst_snd, Category.id_comp]
@[deprecated (since := "2025-09-13")]
alias Grp_Class.ofRepresentableBy_yonedaGrpObjRepresentableBy :=
GrpObj.ofRepresentableBy_yonedaGrpObjRepresentableBy
variable (X) in
/-- If `X` represents a presheaf of groups `F`, then `Hom(-, X)` is isomorphic to `F` as
a presheaf of groups. -/
@[simps! hom inv]
def yonedaGrpObjIsoOfRepresentableBy (F : Cᵒᵖ ⥤ GrpCat.{v}) (α : (F ⋙ forget _).RepresentableBy X) :
letI := GrpObj.ofRepresentableBy X F α
yonedaGrpObj X ≅ F :=
letI := GrpObj.ofRepresentableBy X F α
NatIso.ofComponents (fun Y ↦ MulEquiv.toGrpIso
{ toEquiv := α.homEquiv
map_mul' :=
((yonedaMonObjIsoOfRepresentableBy X (F ⋙ forget₂ GrpCat MonCat) α).hom.app Y).hom.map_mul})
fun φ ↦ GrpCat.hom_ext <| MonoidHom.ext <| α.homEquiv_comp φ.unop
/-- The yoneda embedding of `Grp_C` into presheaves of groups. -/
@[simps]
def yonedaGrp : Grp C ⥤ Cᵒᵖ ⥤ GrpCat.{v} where
obj G := yonedaGrpObj G.X
map {G H} ψ := { app Y := GrpCat.ofHom ((yonedaMon.map ψ).app Y).hom }
@[reassoc]
lemma yonedaGrp_naturality (α : yonedaGrpObj G ⟶ yonedaGrpObj H) (f : X ⟶ Y) (g : Y ⟶ G) :
α.app _ (f ≫ g) = f ≫ α.app _ g := congr($(α.naturality f.op) g)
/-- The yoneda embedding for `Grp_C` is fully faithful. -/
def yonedaGrpFullyFaithful : yonedaGrp (C := C).FullyFaithful where
preimage {G H} α :=
yonedaMonFullyFaithful.preimage (Functor.whiskerRight α (forget₂ GrpCat MonCat))
map_preimage {G H} α := by
ext X : 3
exact congr(($(yonedaMonFullyFaithful.map_preimage (X := G.toMon) (Y := H.toMon)
(Functor.whiskerRight α (forget₂ GrpCat MonCat))).app X).hom)
preimage_map := yonedaMonFullyFaithful.preimage_map
instance : yonedaGrp (C := C).Full := yonedaGrpFullyFaithful.full
instance : yonedaGrp (C := C).Faithful := yonedaGrpFullyFaithful.faithful
lemma essImage_yonedaGrp :
yonedaGrp (C := C).essImage = (· ⋙ forget _) ⁻¹' setOf Functor.IsRepresentable := by
ext F
constructor
· rintro ⟨G, ⟨α⟩⟩
exact ⟨G.X, ⟨Functor.representableByEquiv.symm (Functor.isoWhiskerRight α (forget _))⟩⟩
· rintro ⟨X, ⟨e⟩⟩
letI := GrpObj.ofRepresentableBy X F e
exact ⟨⟨X⟩, ⟨yonedaGrpObjIsoOfRepresentableBy X F e⟩⟩
@[reassoc]
lemma GrpObj.inv_comp (f : X ⟶ G) (g : G ⟶ H) [IsMonHom g] : f⁻¹ ≫ g = (f ≫ g)⁻¹ := by
simp [Hom.inv_def]
@[deprecated (since := "2025-09-13")] alias Grp_Class.inv_comp := GrpObj.inv_comp
@[reassoc]
lemma GrpObj.div_comp (f g : X ⟶ G) (h : G ⟶ H) [IsMonHom h] :
(f / g) ≫ h = (f ≫ h) / (g ≫ h) :=
((yonedaGrp.map <| Grp.homMk h).app <| op X).hom.map_div f g
@[deprecated (since := "2025-09-13")] alias Grp_Class.div_comp := GrpObj.div_comp
@[reassoc]
lemma GrpObj.zpow_comp (f : X ⟶ G) (n : ℤ) (g : G ⟶ H) [IsMonHom g] :
(f ^ n) ≫ g = (f ≫ g) ^ n :=
((yonedaGrp.map <| Grp.homMk g).app <| op X).hom.map_zpow f n
@[deprecated (since := "2025-09-13")] alias Grp_Class.zpow_comp := GrpObj.zpow_comp
@[reassoc]
lemma GrpObj.comp_inv (f : X ⟶ Y) (g : Y ⟶ G) : f ≫ g⁻¹ = (f ≫ g)⁻¹ :=
((yonedaGrp.obj ⟨G⟩).map f.op).hom.map_inv g
@[deprecated (since := "2025-09-13")] alias Grp_Class.comp_inv := GrpObj.comp_inv
@[reassoc]
lemma GrpObj.comp_div (f : X ⟶ Y) (g h : Y ⟶ G) : f ≫ (g / h) = f ≫ g / f ≫ h :=
((yonedaGrp.obj ⟨G⟩).map f.op).hom.map_div g h
@[deprecated (since := "2025-09-13")] alias Grp_Class.comp_div := GrpObj.comp_div
@[reassoc]
lemma GrpObj.comp_zpow (f : X ⟶ Y) (g : Y ⟶ G) : ∀ n : ℤ, f ≫ g ^ n = (f ≫ g) ^ n
| (n : ℕ) => by simp [comp_pow]
| .negSucc n => by simp [comp_pow, comp_inv]
@[deprecated (since := "2025-09-13")] alias Grp_Class.comp_zpow := GrpObj.comp_zpow
lemma GrpObj.inv_eq_inv : ι = (𝟙 G)⁻¹ := by simp [Hom.inv_def]
@[reassoc (attr := simp)]
lemma GrpObj.one_inv : η[G] ≫ ι = η := by simp [GrpObj.inv_eq_inv, GrpObj.comp_inv, one_eq_one]
@[deprecated (since := "2025-09-13")] alias Grp_Class.inv_eq_inv := GrpObj.inv_eq_inv
variable [BraidedCategory C]
instance [IsCommMonObj G] : IsMonHom ι[G] where
one_hom := by simp [one_eq_one, ← Hom.inv_def]
mul_hom := by simp [GrpObj.mul_inv_rev]
attribute [local simp] Hom.inv_def in
instance [IsCommMonObj G] {f : M ⟶ G} [IsMonHom f] : IsMonHom f⁻¹ where
namespace Grp
variable {G H : Grp C} [IsCommMonObj H.X]
instance : MonObj H where
one := η[H.toMon]
mul := μ[H.toMon]
one_mul := MonObj.one_mul H.toMon
mul_one := MonObj.mul_one H.toMon
mul_assoc := MonObj.mul_assoc H.toMon
@[simp] lemma hom_one (H : Grp C) [IsCommMonObj H.X] : η[H].hom = η[H.X] := rfl
@[simp] lemma hom_mul (H : Grp C) [IsCommMonObj H.X] : μ[H].hom = μ[H.X] := rfl
namespace Hom
@[simp] lemma hom_one : (1 : G ⟶ H).hom = 1 := rfl
@[simp] lemma hom_mul (f g : G ⟶ H) : (f * g).hom = f.hom * g.hom := rfl
@[simp] lemma hom_pow (f : G ⟶ H) (n : ℕ) : (f ^ n).hom = f.hom ^ n := Mon.Hom.hom_pow ..
end Hom
attribute [local simp] mul_eq_mul GrpObj.inv_eq_inv comp_mul in
/-- A commutative group object is a group object in the category of group objects. -/
instance : GrpObj H where inv := .mk ι[H.X]
namespace Hom
@[simp] lemma hom_inv (f : G ⟶ H) : f⁻¹.hom = f.hom⁻¹ := rfl
@[simp] lemma hom_div (f g : G ⟶ H) : (f / g).hom = f.hom / g.hom := rfl
@[simp] lemma hom_zpow (f : G ⟶ H) (n : ℤ) : (f ^ n).hom = f.hom ^ n := by cases n <;> simp
end Hom
attribute [local simp] mul_eq_mul comp_mul mul_comm mul_div_mul_comm in
/-- A commutative group object is a commutative group object in the category of group objects. -/
instance : IsCommMonObj H where
instance [IsCommMonObj G.X] (f : G ⟶ H) : IsMonHom f where
one_hom := by ext; simp [Grp.instMonObj]
mul_hom := by ext; simp [Grp.instMonObj]
end Grp
/-- If `G` is a commutative group object, then `Hom(X, G)` has a commutative group structure. -/
abbrev Hom.commGroup [IsCommMonObj G] : CommGroup (X ⟶ G) where
scoped[CategoryTheory.MonObj] attribute [instance] Hom.commGroup
end CategoryTheory |
.lake/packages/mathlib/Mathlib/CategoryTheory/Monoidal/Cartesian/Mod_.lean | import Mathlib.CategoryTheory.Monoidal.Cartesian.Basic
import Mathlib.CategoryTheory.Monoidal.Mod_
/-!
# Additional results about module objects in Cartesian monoidal categories
-/
open CategoryTheory MonoidalCategory CartesianMonoidalCategory
namespace CategoryTheory
universe v u
variable {C : Type u} [Category.{v} C] [CartesianMonoidalCategory C]
attribute [local simp] leftUnitor_hom
/-- Every object is a module over a monoid object via the trivial action. -/
@[reducible] def ModObj.trivialAction (M : C) [MonObj M] (X : C) :
ModObj M X where
smul := snd M X
@[deprecated (since := "2025-09-14")] alias Mod_Class.trivialAction := ModObj.trivialAction
attribute [local instance] ModObj.trivialAction in
/-- Every object is a module over a monoid object via the trivial action. -/
@[simps]
def Mod_.trivialAction (M : Mon C) (X : C) : Mod_ C M.X where
X := X
end CategoryTheory |
.lake/packages/mathlib/Mathlib/CategoryTheory/Monoidal/Cartesian/Over.lean | import Mathlib.CategoryTheory.Monoidal.Cartesian.Basic
import Mathlib.CategoryTheory.Limits.Constructions.Over.Products
/-!
# `CartesianMonoidalCategory` for `Over X`
We provide a `CartesianMonoidalCategory (Over X)` instance via pullbacks, and provide simp lemmas
for the induced `MonoidalCategory (Over X)` instance.
-/
namespace CategoryTheory.Over
open Limits CartesianMonoidalCategory
variable {C : Type*} [Category C] [HasPullbacks C]
/-- A choice of finite products of `Over X` given by `Limits.pullback`. -/
noncomputable abbrev cartesianMonoidalCategory (X : C) : CartesianMonoidalCategory (Over X) :=
.ofChosenFiniteProducts
⟨asEmptyCone (Over.mk (𝟙 X)), IsTerminal.ofUniqueHom (fun Y ↦ Over.homMk Y.hom)
fun Y m ↦ Over.OverMorphism.ext (by simpa using m.w)⟩
fun Y Z ↦ ⟨pullbackConeEquivBinaryFan.functor.obj (pullback.cone Y.hom Z.hom),
(pullback.isLimit _ _).pullbackConeEquivBinaryFanFunctor⟩
@[deprecated (since := "2025-05-15")] alias chosenFiniteProducts := cartesianMonoidalCategory
attribute [local instance] cartesianMonoidalCategory
/-- `Over X` is braided w.r.t. the Cartesian monoidal structure given by `Limits.pullback`. -/
noncomputable abbrev braidedCategory (X : C) : BraidedCategory (Over X) :=
.ofCartesianMonoidalCategory
attribute [local instance] braidedCategory
open MonoidalCategory
variable {X : C}
@[ext]
lemma tensorObj_ext {R : C} {S T : Over X} (f₁ f₂ : R ⟶ (S ⊗ T).left)
(e₁ : f₁ ≫ pullback.fst _ _ = f₂ ≫ pullback.fst _ _)
(e₂ : f₁ ≫ pullback.snd _ _ = f₂ ≫ pullback.snd _ _) : f₁ = f₂ :=
pullback.hom_ext e₁ e₂
@[simp]
lemma tensorObj_left (R S : Over X) : (R ⊗ S).left = pullback R.hom S.hom := rfl
@[simp]
lemma tensorObj_hom (R S : Over X) : (R ⊗ S).hom = pullback.fst R.hom S.hom ≫ R.hom := rfl
@[simp]
lemma tensorUnit_left : (𝟙_ (Over X)).left = X := rfl
@[simp]
lemma tensorUnit_hom : (𝟙_ (Over X)).hom = 𝟙 X := rfl
@[simp]
lemma lift_left {R S T : Over X} (f : R ⟶ S) (g : R ⟶ T) :
(lift f g).left = pullback.lift f.left g.left (f.w.trans g.w.symm) := rfl
@[simp]
lemma toUnit_left {R : Over X} : (toUnit R).left = R.hom := rfl
@[reassoc (attr := simp)]
lemma associator_hom_left_fst (R S T : Over X) :
(α_ R S T).hom.left ≫ pullback.fst _ (pullback.fst _ _ ≫ _) =
pullback.fst _ _ ≫ pullback.fst _ _ :=
limit.lift_π _ _
@[reassoc (attr := simp)]
lemma associator_hom_left_snd_fst (R S T : Over X) :
(α_ R S T).hom.left ≫ pullback.snd _ (pullback.fst _ _ ≫ _) ≫ pullback.fst _ _ =
pullback.fst _ _ ≫ pullback.snd _ _ :=
(limit.lift_π_assoc _ _ _).trans (limit.lift_π _ _)
@[reassoc (attr := simp)]
lemma associator_hom_left_snd_snd (R S T : Over X) :
(α_ R S T).hom.left ≫ pullback.snd _ (pullback.fst _ _ ≫ _) ≫ pullback.snd _ _ =
pullback.snd _ _ :=
(limit.lift_π_assoc _ _ _).trans (limit.lift_π _ _)
@[reassoc (attr := simp)]
lemma associator_inv_left_fst_fst (R S T : Over X) :
(α_ R S T).inv.left ≫ pullback.fst (pullback.fst _ _ ≫ _) _ ≫ pullback.fst _ _ =
pullback.fst _ _ :=
(limit.lift_π_assoc _ _ _).trans (limit.lift_π _ _)
@[reassoc (attr := simp)]
lemma associator_inv_left_fst_snd (R S T : Over X) :
(α_ R S T).inv.left ≫ pullback.fst (pullback.fst _ _ ≫ _) _ ≫ pullback.snd _ _ =
pullback.snd _ _ ≫ pullback.fst _ _ :=
(limit.lift_π_assoc _ _ _).trans (limit.lift_π _ _)
@[reassoc (attr := simp)]
lemma associator_inv_left_snd (R S T : Over X) :
(α_ R S T).inv.left ≫ pullback.snd (pullback.fst _ _ ≫ _) _ =
pullback.snd _ _ ≫ pullback.snd _ _ :=
limit.lift_π _ _
@[simp]
lemma leftUnitor_hom_left (Y : Over X) :
(λ_ Y).hom.left = pullback.snd _ _ := rfl
@[reassoc (attr := simp)]
lemma leftUnitor_inv_left_fst (Y : Over X) :
(λ_ Y).inv.left ≫ pullback.fst (𝟙 X) _ = Y.hom :=
limit.lift_π _ _
@[reassoc (attr := simp)]
lemma leftUnitor_inv_left_snd (Y : Over X) :
(λ_ Y).inv.left ≫ pullback.snd (𝟙 X) _ = 𝟙 Y.left :=
limit.lift_π _ _
@[simp]
lemma rightUnitor_hom_left (Y : Over X) :
(ρ_ Y).hom.left = pullback.fst _ (𝟙 X) := rfl
@[reassoc (attr := simp)]
lemma rightUnitor_inv_left_fst (Y : Over X) :
(ρ_ Y).inv.left ≫ pullback.fst _ (𝟙 X) = 𝟙 _ :=
limit.lift_π _ _
@[reassoc (attr := simp)]
lemma rightUnitor_inv_left_snd (Y : Over X) :
(ρ_ Y).inv.left ≫ pullback.snd _ (𝟙 X) = Y.hom :=
limit.lift_π _ _
lemma whiskerLeft_left {R S T : Over X} (f : S ⟶ T) :
(R ◁ f).left = pullback.map _ _ _ _ (𝟙 _) f.left (𝟙 _) (by simp) (by simp) := rfl
@[reassoc (attr := simp)]
lemma whiskerLeft_left_fst {R S T : Over X} (f : S ⟶ T) :
(R ◁ f).left ≫ pullback.fst _ _ = pullback.fst _ _ :=
(limit.lift_π _ _).trans (Category.comp_id _)
@[reassoc (attr := simp)]
lemma whiskerLeft_left_snd {R S T : Over X} (f : S ⟶ T) :
(R ◁ f).left ≫ pullback.snd _ _ = pullback.snd _ _ ≫ f.left :=
limit.lift_π _ _
lemma whiskerRight_left {R S T : Over X} (f : S ⟶ T) :
(f ▷ R).left = pullback.map _ _ _ _ f.left (𝟙 _) (𝟙 _) (by simp) (by simp) := rfl
@[reassoc (attr := simp)]
lemma whiskerRight_left_fst {R S T : Over X} (f : S ⟶ T) :
(f ▷ R).left ≫ pullback.fst _ _ = pullback.fst _ _ ≫ f.left :=
limit.lift_π _ _
@[reassoc (attr := simp)]
lemma whiskerRight_left_snd {R S T : Over X} (f : S ⟶ T) :
(f ▷ R).left ≫ pullback.snd _ _ = pullback.snd _ _ :=
(limit.lift_π _ _).trans (Category.comp_id _)
lemma tensorHom_left {R S T U : Over X} (f : R ⟶ S) (g : T ⟶ U) :
(f ⊗ₘ g).left = pullback.map _ _ _ _ f.left g.left (𝟙 _) (by simp) (by simp) := rfl
@[reassoc (attr := simp)]
lemma tensorHom_left_fst {S U : C} {R T : Over X} (fS : S ⟶ X) (fU : U ⟶ X)
(f : R ⟶ mk fS) (g : T ⟶ mk fU) :
(f ⊗ₘ g).left ≫ pullback.fst fS fU = pullback.fst R.hom T.hom ≫ f.left :=
limit.lift_π _ _
@[reassoc (attr := simp)]
lemma tensorHom_left_snd {S U : C} {R T : Over X} (fS : S ⟶ X) (fU : U ⟶ X)
(f : R ⟶ mk fS) (g : T ⟶ mk fU) :
(f ⊗ₘ g).left ≫ pullback.snd fS fU = pullback.snd R.hom T.hom ≫ g.left :=
limit.lift_π _ _
@[simp]
lemma braiding_hom_left {R S : Over X} :
(β_ R S).hom.left = (pullbackSymmetry _ _).hom := rfl
@[simp]
lemma braiding_inv_left {R S : Over X} :
(β_ R S).inv.left = (pullbackSymmetry _ _).hom := rfl
end CategoryTheory.Over |
.lake/packages/mathlib/Mathlib/CategoryTheory/Monoidal/Cartesian/CommGrp_.lean | import Mathlib.CategoryTheory.Monoidal.Cartesian.CommMon_
import Mathlib.CategoryTheory.Monoidal.Cartesian.Grp_
import Mathlib.CategoryTheory.Monoidal.CommGrp_
/-!
# Yoneda embedding of `CommGrp C`
-/
assert_not_exists Field
open CategoryTheory MonoidalCategory Limits Opposite CartesianMonoidalCategory MonObj
namespace CategoryTheory
universe w v u
variable {C : Type u} [Category.{v} C] [CartesianMonoidalCategory C] [BraidedCategory C] {X : C}
variable (X) in
/-- Abbreviation for an unbundled commutative group object. It is a group object that is a
commutative monoid object. -/
class abbrev CommGrpObj := GrpObj X, IsCommMonObj X
@[deprecated (since := "2025-09-13")] alias CommGrp_Class := CommGrpObj
variable (X) in
/-- If `X` represents a presheaf of commutative groups, then `X` is a commutative group object. -/
def CommGrpObj.ofRepresentableBy (F : Cᵒᵖ ⥤ CommGrpCat.{w})
(α : (F ⋙ forget _).RepresentableBy X) : CommGrpObj X where
__ := GrpObj.ofRepresentableBy X (F ⋙ forget₂ CommGrpCat GrpCat) α
__ := IsCommMonObj.ofRepresentableBy X (F ⋙ forget₂ CommGrpCat CommMonCat) α
@[deprecated (since := "2025-09-13")]
alias CommGrp_Class.ofRepresentableBy := CommGrpObj.ofRepresentableBy
/-- The yoneda embedding of `CommGrp C` into presheaves of groups. -/
@[simps]
def yonedaCommGrpGrpObj (G : CommGrp C) : (Grp C)ᵒᵖ ⥤ CommGrpCat where
obj H := .of (unop H ⟶ G.toGrp)
map {H I} f := CommGrpCat.ofHom {
toFun := (f.unop ≫ ·)
map_one' := by ext; simp [Mon.Hom.hom_one]
map_mul' g h := by ext; simpa using ((yonedaGrpObj G.X).map f.unop.1.op).hom.map_mul g.hom h.hom
}
/-- The yoneda embedding of `CommGrp C` into presheaves of groups. -/
@[simps]
def yonedaCommGrpGrp : CommGrp C ⥤ (Grp C)ᵒᵖ ⥤ CommGrpCat where
obj := yonedaCommGrpGrpObj
map {X₁ X₂} ψ := {
app Y := CommGrpCat.ofHom {
toFun := (· ≫ ψ)
map_one' := by ext; simp
map_mul' f g := by
ext; simpa using ((yonedaGrp.map ψ).app (op (unop Y).X)).hom.map_mul f.hom g.hom
}
}
end CategoryTheory |
.lake/packages/mathlib/Mathlib/CategoryTheory/Monoidal/Cartesian/Basic.lean | import Mathlib.CategoryTheory.Limits.Constructions.FiniteProductsOfBinaryProducts
import Mathlib.CategoryTheory.Limits.FullSubcategory
import Mathlib.CategoryTheory.Limits.Preserves.Shapes.Terminal
import Mathlib.CategoryTheory.Monoidal.Braided.Basic
/-!
# Categories with chosen finite products
We introduce a class, `CartesianMonoidalCategory`, which bundles explicit choices
for a terminal object and binary products in a category `C`.
This is primarily useful for categories which have finite products with good
definitional properties, such as the category of types.
For better defeqs, we also extend `MonoidalCategory`.
## Implementation notes
For Cartesian monoidal categories, the oplax-monoidal/monoidal/braided structure of a functor `F`
preserving finite products is uniquely determined. See the `ofChosenFiniteProducts` declarations.
We however develop the theory for any `F.OplaxMonoidal`/`F.Monoidal`/`F.Braided` instance instead of
requiring it to be the `ofChosenFiniteProducts` one. This is to avoid diamonds: Consider
e.g. `𝟭 C` and `F ⋙ G`.
In applications requiring a finite-product-preserving functor to be
oplax-monoidal/monoidal/braided, avoid `attribute [local instance] ofChosenFiniteProducts` but
instead turn on the corresponding `ofChosenFiniteProducts` declaration for that functor only.
## Projects
- Construct an instance of chosen finite products in the category of affine scheme, using
the tensor product.
- Construct chosen finite products in other categories appearing "in nature".
-/
namespace CategoryTheory
universe v v₁ v₂ v₃ u u₁ u₂ u₃
open MonoidalCategory Limits
/-- A monoidal category is semicartesian if the unit for the tensor product is a terminal object. -/
class SemiCartesianMonoidalCategory (C : Type u) [Category.{v} C] extends MonoidalCategory C where
/-- The tensor unit is a terminal object. -/
isTerminalTensorUnit : IsTerminal (𝟙_ C)
/-- The first projection from the product. -/
fst (X Y : C) : X ⊗ Y ⟶ X
/-- The second projection from the product. -/
snd (X Y : C) : X ⊗ Y ⟶ Y
fst_def (X Y : C) : fst X Y = X ◁ isTerminalTensorUnit.from Y ≫ (ρ_ X).hom := by cat_disch
snd_def (X Y : C) : snd X Y = isTerminalTensorUnit.from X ▷ Y ≫ (λ_ Y).hom := by cat_disch
namespace SemiCartesianMonoidalCategory
variable {C : Type u} [Category.{v} C] [SemiCartesianMonoidalCategory C]
/-- The unique map to the terminal object. -/
def toUnit (X : C) : X ⟶ 𝟙_ C := isTerminalTensorUnit.from X
instance (X : C) : Unique (X ⟶ 𝟙_ C) := isTerminalEquivUnique _ _ isTerminalTensorUnit _
lemma default_eq_toUnit (X : C) : default = toUnit X := rfl
/--
This lemma follows from the preexisting `Unique` instance, but
it is often convenient to use it directly as `apply toUnit_unique` forcing
lean to do the necessary elaboration.
-/
@[ext]
lemma toUnit_unique {X : C} (f g : X ⟶ 𝟙_ _) : f = g :=
Subsingleton.elim _ _
@[simp] lemma toUnit_unit : toUnit (𝟙_ C) = 𝟙 (𝟙_ C) := toUnit_unique ..
@[reassoc (attr := simp)]
theorem comp_toUnit {X Y : C} (f : X ⟶ Y) : f ≫ toUnit Y = toUnit X :=
toUnit_unique _ _
end SemiCartesianMonoidalCategory
variable (C) in
/--
An instance of `CartesianMonoidalCategory C` bundles an explicit choice of a binary
product of two objects of `C`, and a terminal object in `C`.
Users should use the monoidal notation: `X ⊗ Y` for the product and `𝟙_ C` for
the terminal object.
-/
class CartesianMonoidalCategory (C : Type u) [Category.{v} C] extends
SemiCartesianMonoidalCategory C where
/-- The monoidal product is the categorical product. -/
tensorProductIsBinaryProduct (X Y : C) : IsLimit <| BinaryFan.mk (fst X Y) (snd X Y)
@[deprecated (since := "2025-05-15")] alias ChosenFiniteProducts := CartesianMonoidalCategory
namespace CartesianMonoidalCategory
export SemiCartesianMonoidalCategory (isTerminalTensorUnit fst snd fst_def snd_def toUnit
toUnit_unique toUnit_unit comp_toUnit comp_toUnit_assoc default_eq_toUnit)
variable {C : Type u} [Category.{v} C]
section OfChosenFiniteProducts
variable (𝒯 : LimitCone (Functor.empty.{0} C)) (ℬ : ∀ X Y : C, LimitCone (pair X Y))
{X₁ X₂ X₃ Y₁ Y₂ Y₃ Z₁ Z₂ : C}
namespace ofChosenFiniteProducts
/-- Implementation of the tensor product for `CartesianMonoidalCategory.ofChosenFiniteProducts`. -/
abbrev tensorObj (X Y : C) : C := (ℬ X Y).cone.pt
/-- Implementation of the tensor product of morphisms for
`CartesianMonoidalCategory.ofChosenFiniteProducts`. -/
abbrev tensorHom (f : X₁ ⟶ Y₁) (g : X₂ ⟶ Y₂) : tensorObj ℬ X₁ X₂ ⟶ tensorObj ℬ Y₁ Y₂ :=
(BinaryFan.IsLimit.lift' (ℬ Y₁ Y₂).isLimit ((ℬ X₁ X₂).cone.π.app ⟨.left⟩ ≫ f)
(((ℬ X₁ X₂).cone.π.app ⟨.right⟩ : (ℬ X₁ X₂).cone.pt ⟶ X₂) ≫ g)).val
lemma id_tensorHom_id (X Y : C) : tensorHom ℬ (𝟙 X) (𝟙 Y) = 𝟙 (tensorObj ℬ X Y) :=
(ℬ _ _).isLimit.hom_ext <| by rintro ⟨_ | _⟩ <;> simp [tensorHom]
@[deprecated (since := "2025-07-14")] alias tensor_id := id_tensorHom_id
lemma tensorHom_comp_tensorHom (f₁ : X₁ ⟶ Y₁) (f₂ : X₂ ⟶ Y₂) (g₁ : Y₁ ⟶ Z₁) (g₂ : Y₂ ⟶ Z₂) :
tensorHom ℬ f₁ f₂ ≫ tensorHom ℬ g₁ g₂ = tensorHom ℬ (f₁ ≫ g₁) (f₂ ≫ g₂) :=
(ℬ _ _).isLimit.hom_ext <| by rintro ⟨_ | _⟩ <;> simp [tensorHom]
lemma pentagon (W X Y Z : C) :
tensorHom ℬ (BinaryFan.associatorOfLimitCone ℬ W X Y).hom (𝟙 Z) ≫
(BinaryFan.associatorOfLimitCone ℬ W (tensorObj ℬ X Y) Z).hom ≫
tensorHom ℬ (𝟙 W) (BinaryFan.associatorOfLimitCone ℬ X Y Z).hom =
(BinaryFan.associatorOfLimitCone ℬ (tensorObj ℬ W X) Y Z).hom ≫
(BinaryFan.associatorOfLimitCone ℬ W X (tensorObj ℬ Y Z)).hom := by
dsimp [tensorHom]
apply (ℬ _ _).isLimit.hom_ext
rintro ⟨_ | _⟩
· simp
apply (ℬ _ _).isLimit.hom_ext
rintro ⟨_ | _⟩
· simp
apply (ℬ _ _).isLimit.hom_ext
rintro ⟨_ | _⟩ <;> simp
lemma triangle (X Y : C) :
(BinaryFan.associatorOfLimitCone ℬ X 𝒯.cone.pt Y).hom ≫
tensorHom ℬ (𝟙 X) (BinaryFan.leftUnitor 𝒯.isLimit (ℬ 𝒯.cone.pt Y).isLimit).hom =
tensorHom ℬ (BinaryFan.rightUnitor 𝒯.isLimit (ℬ X 𝒯.cone.pt).isLimit).hom (𝟙 Y) :=
(ℬ _ _).isLimit.hom_ext <| by rintro ⟨_ | _⟩ <;> simp
lemma leftUnitor_naturality (f : X₁ ⟶ X₂) :
tensorHom ℬ (𝟙 𝒯.cone.pt) f ≫ (BinaryFan.leftUnitor 𝒯.isLimit (ℬ 𝒯.cone.pt X₂).isLimit).hom =
(BinaryFan.leftUnitor 𝒯.isLimit (ℬ 𝒯.cone.pt X₁).isLimit).hom ≫ f := by
simp [tensorHom]
lemma rightUnitor_naturality (f : X₁ ⟶ X₂) :
tensorHom ℬ f (𝟙 𝒯.cone.pt) ≫ (BinaryFan.rightUnitor 𝒯.isLimit (ℬ X₂ 𝒯.cone.pt).isLimit).hom =
(BinaryFan.rightUnitor 𝒯.isLimit (ℬ X₁ 𝒯.cone.pt).isLimit).hom ≫ f := by
simp [tensorHom]
lemma associator_naturality (f₁ : X₁ ⟶ Y₁) (f₂ : X₂ ⟶ Y₂) (f₃ : X₃ ⟶ Y₃) :
tensorHom ℬ (tensorHom ℬ f₁ f₂) f₃ ≫ (BinaryFan.associatorOfLimitCone ℬ Y₁ Y₂ Y₃).hom =
(BinaryFan.associatorOfLimitCone ℬ X₁ X₂ X₃).hom ≫ tensorHom ℬ f₁ (tensorHom ℬ f₂ f₃) := by
dsimp [tensorHom]
apply (ℬ _ _).isLimit.hom_ext
rintro ⟨_ | _⟩
· simp
apply (ℬ _ _).isLimit.hom_ext
rintro ⟨_ | _⟩ <;> simp
end ofChosenFiniteProducts
open ofChosenFiniteProducts
/-- Construct an instance of `CartesianMonoidalCategory C` given a terminal object and limit cones
over arbitrary pairs of objects. -/
abbrev ofChosenFiniteProducts : CartesianMonoidalCategory C :=
letI : MonoidalCategoryStruct C := {
tensorUnit := 𝒯.cone.pt
tensorObj := tensorObj ℬ
tensorHom := tensorHom ℬ
whiskerLeft X {_ _} g := tensorHom ℬ (𝟙 X) g
whiskerRight {_ _} f Y := tensorHom ℬ f (𝟙 Y)
associator := BinaryFan.associatorOfLimitCone ℬ
leftUnitor X := BinaryFan.leftUnitor 𝒯.isLimit (ℬ 𝒯.cone.pt X).isLimit
rightUnitor X := BinaryFan.rightUnitor 𝒯.isLimit (ℬ X 𝒯.cone.pt).isLimit
}
{
toMonoidalCategory := .ofTensorHom
(id_tensorHom_id := id_tensorHom_id ℬ)
(tensorHom_comp_tensorHom := tensorHom_comp_tensorHom ℬ)
(pentagon := pentagon ℬ)
(triangle := triangle 𝒯 ℬ)
(leftUnitor_naturality := leftUnitor_naturality 𝒯 ℬ)
(rightUnitor_naturality := rightUnitor_naturality 𝒯 ℬ)
(associator_naturality := associator_naturality ℬ)
isTerminalTensorUnit :=
.ofUniqueHom (𝒯.isLimit.lift <| asEmptyCone ·) fun _ _ ↦ 𝒯.isLimit.hom_ext (by simp)
fst X Y := BinaryFan.fst (ℬ X Y).cone
snd X Y := BinaryFan.snd (ℬ X Y).cone
tensorProductIsBinaryProduct X Y := BinaryFan.IsLimit.mk _
(fun f g ↦ (BinaryFan.IsLimit.lift' (ℬ X Y).isLimit f g).1)
(fun f g ↦ (BinaryFan.IsLimit.lift' (ℬ X Y).isLimit f g).2.1)
(fun f g ↦ (BinaryFan.IsLimit.lift' (ℬ X Y).isLimit f g).2.2)
(fun f g m hf hg ↦
BinaryFan.IsLimit.hom_ext (ℬ X Y).isLimit (by simpa using hf) (by simpa using hg))
fst_def X Y := (((ℬ X 𝒯.cone.pt).isLimit.fac
(BinaryFan.mk _ _) ⟨.left⟩).trans (Category.comp_id _)).symm
snd_def X Y := (((ℬ 𝒯.cone.pt Y).isLimit.fac
(BinaryFan.mk _ _) ⟨.right⟩).trans (Category.comp_id _)).symm
}
omit 𝒯 in
/-- Constructs an instance of `CartesianMonoidalCategory C` given the existence of finite products
in `C`. -/
noncomputable abbrev ofHasFiniteProducts [HasFiniteProducts C] : CartesianMonoidalCategory C :=
.ofChosenFiniteProducts (getLimitCone (.empty C)) (getLimitCone <| pair · ·)
@[deprecated (since := "2025-05-08")] alias ofFiniteProducts := ofHasFiniteProducts
end OfChosenFiniteProducts
variable {C : Type u} [Category.{v} C] [CartesianMonoidalCategory C]
open MonoidalCategory
/--
Constructs a morphism to the product given its two components.
-/
def lift {T X Y : C} (f : T ⟶ X) (g : T ⟶ Y) : T ⟶ X ⊗ Y :=
(BinaryFan.IsLimit.lift' (tensorProductIsBinaryProduct X Y) f g).1
@[reassoc (attr := simp)]
lemma lift_fst {T X Y : C} (f : T ⟶ X) (g : T ⟶ Y) : lift f g ≫ fst _ _ = f :=
(BinaryFan.IsLimit.lift' (tensorProductIsBinaryProduct X Y) f g).2.1
@[reassoc (attr := simp)]
lemma lift_snd {T X Y : C} (f : T ⟶ X) (g : T ⟶ Y) : lift f g ≫ snd _ _ = g :=
(BinaryFan.IsLimit.lift' (tensorProductIsBinaryProduct X Y) f g).2.2
instance mono_lift_of_mono_left {W X Y : C} (f : W ⟶ X) (g : W ⟶ Y)
[Mono f] : Mono (lift f g) :=
mono_of_mono_fac <| lift_fst _ _
instance mono_lift_of_mono_right {W X Y : C} (f : W ⟶ X) (g : W ⟶ Y)
[Mono g] : Mono (lift f g) :=
mono_of_mono_fac <| lift_snd _ _
@[ext 1050]
lemma hom_ext {T X Y : C} (f g : T ⟶ X ⊗ Y)
(h_fst : f ≫ fst _ _ = g ≫ fst _ _)
(h_snd : f ≫ snd _ _ = g ≫ snd _ _) :
f = g :=
BinaryFan.IsLimit.hom_ext (tensorProductIsBinaryProduct X Y) h_fst h_snd
-- Similarly to `CategoryTheory.Limits.prod.comp_lift`, we do not make the `assoc` version a simp
-- lemma
@[reassoc, simp]
lemma comp_lift {V W X Y : C} (f : V ⟶ W) (g : W ⟶ X) (h : W ⟶ Y) :
f ≫ lift g h = lift (f ≫ g) (f ≫ h) := by ext <;> simp
@[simp]
lemma lift_fst_snd {X Y : C} : lift (fst X Y) (snd X Y) = 𝟙 (X ⊗ Y) := by ext <;> simp
@[simp]
lemma lift_comp_fst_snd {X Y Z : C} (f : X ⟶ Y ⊗ Z) :
lift (f ≫ fst _ _) (f ≫ snd _ _) = f := by
cat_disch
@[reassoc (attr := simp)]
lemma whiskerLeft_fst (X : C) {Y Z : C} (f : Y ⟶ Z) : X ◁ f ≫ fst _ _ = fst _ _ := by
simp [fst_def, ← whiskerLeft_comp_assoc]
@[reassoc (attr := simp)]
lemma whiskerLeft_snd (X : C) {Y Z : C} (f : Y ⟶ Z) : X ◁ f ≫ snd _ _ = snd _ _ ≫ f := by
simp [snd_def, whisker_exchange_assoc]
@[reassoc (attr := simp)]
lemma whiskerRight_fst {X Y : C} (f : X ⟶ Y) (Z : C) : f ▷ Z ≫ fst _ _ = fst _ _ ≫ f := by
simp [fst_def, ← whisker_exchange_assoc]
@[reassoc (attr := simp)]
lemma whiskerRight_snd {X Y : C} (f : X ⟶ Y) (Z : C) : f ▷ Z ≫ snd _ _ = snd _ _ := by
simp [snd_def, ← comp_whiskerRight_assoc]
@[reassoc (attr := simp)]
lemma tensorHom_fst {X₁ X₂ Y₁ Y₂ : C} (f : X₁ ⟶ X₂) (g : Y₁ ⟶ Y₂) :
(f ⊗ₘ g) ≫ fst _ _ = fst _ _ ≫ f := by simp [tensorHom_def]
@[reassoc (attr := simp)]
lemma tensorHom_snd {X₁ X₂ Y₁ Y₂ : C} (f : X₁ ⟶ X₂) (g : Y₁ ⟶ Y₂) :
(f ⊗ₘ g) ≫ snd _ _ = snd _ _ ≫ g := by simp [tensorHom_def]
@[reassoc (attr := simp)]
lemma lift_map {V W X Y Z : C} (f : V ⟶ W) (g : V ⟶ X) (h : W ⟶ Y) (k : X ⟶ Z) :
lift f g ≫ (h ⊗ₘ k) = lift (f ≫ h) (g ≫ k) := by ext <;> simp
@[simp]
lemma lift_fst_comp_snd_comp {W X Y Z : C} (g : W ⟶ X) (g' : Y ⟶ Z) :
lift (fst _ _ ≫ g) (snd _ _ ≫ g') = g ⊗ₘ g' := by ext <;> simp
@[reassoc (attr := simp)]
lemma lift_whiskerRight {X Y Z W : C} (f : X ⟶ Y) (g : X ⟶ Z) (h : Y ⟶ W) :
lift f g ≫ (h ▷ Z) = lift (f ≫ h) g := by
cat_disch
@[reassoc (attr := simp)]
lemma lift_whiskerLeft {X Y Z W : C} (f : X ⟶ Y) (g : X ⟶ Z) (h : Z ⟶ W) :
lift f g ≫ (Y ◁ h) = lift f (g ≫ h) := by
cat_disch
@[reassoc (attr := simp)]
lemma associator_hom_fst (X Y Z : C) :
(α_ X Y Z).hom ≫ fst _ _ = fst _ _ ≫ fst _ _ := by
simp [fst_def, ← whiskerLeft_rightUnitor_assoc, -whiskerLeft_rightUnitor,
← whiskerLeft_comp_assoc]
@[reassoc (attr := simp)]
lemma associator_hom_snd_fst (X Y Z : C) :
(α_ X Y Z).hom ≫ snd _ _ ≫ fst _ _ = fst _ _ ≫ snd _ _ := by
simp [fst_def, ← whiskerLeft_rightUnitor_assoc, -whiskerLeft_rightUnitor]
@[reassoc (attr := simp)]
lemma associator_hom_snd_snd (X Y Z : C) :
(α_ X Y Z).hom ≫ snd _ _ ≫ snd _ _ = snd _ _ := by
simp [snd_def, ← leftUnitor_whiskerRight_assoc, -leftUnitor_whiskerRight,
← comp_whiskerRight_assoc]
@[reassoc (attr := simp)]
lemma associator_inv_fst_fst (X Y Z : C) :
(α_ X Y Z).inv ≫ fst _ _ ≫ fst _ _ = fst _ _ := by
simp [fst_def, ← whiskerLeft_rightUnitor_assoc, -whiskerLeft_rightUnitor,
← whiskerLeft_comp_assoc]
@[reassoc (attr := simp)]
lemma associator_inv_fst_snd (X Y Z : C) :
(α_ X Y Z).inv ≫ fst _ _ ≫ snd _ _ = snd _ _ ≫ fst _ _ := by
simp [fst_def, ← whiskerLeft_rightUnitor_assoc, -whiskerLeft_rightUnitor]
@[reassoc (attr := simp)]
lemma associator_inv_snd (X Y Z : C) :
(α_ X Y Z).inv ≫ snd _ _ = snd _ _ ≫ snd _ _ := by
simp [snd_def, ← leftUnitor_whiskerRight_assoc, -leftUnitor_whiskerRight,
← comp_whiskerRight_assoc]
@[reassoc (attr := simp)]
lemma lift_lift_associator_hom {X Y Z W : C} (f : X ⟶ Y) (g : X ⟶ Z) (h : X ⟶ W) :
lift (lift f g) h ≫ (α_ Y Z W).hom = lift f (lift g h) := by
cat_disch
@[reassoc (attr := simp)]
lemma lift_lift_associator_inv {X Y Z W : C} (f : X ⟶ Y) (g : X ⟶ Z) (h : X ⟶ W) :
lift f (lift g h) ≫ (α_ Y Z W).inv = lift (lift f g) h := by
cat_disch
lemma leftUnitor_hom (X : C) : (λ_ X).hom = snd _ _ := by simp [snd_def]
lemma rightUnitor_hom (X : C) : (ρ_ X).hom = fst _ _ := by simp [fst_def]
@[reassoc (attr := simp)]
lemma leftUnitor_inv_fst (X : C) :
(λ_ X).inv ≫ fst _ _ = toUnit _ := toUnit_unique _ _
@[reassoc (attr := simp)]
lemma leftUnitor_inv_snd (X : C) :
(λ_ X).inv ≫ snd _ _ = 𝟙 X := by simp [snd_def]
@[reassoc (attr := simp)]
lemma rightUnitor_inv_fst (X : C) :
(ρ_ X).inv ≫ fst _ _ = 𝟙 X := by simp [fst_def]
@[reassoc (attr := simp)]
lemma rightUnitor_inv_snd (X : C) :
(ρ_ X).inv ≫ snd _ _ = toUnit _ := toUnit_unique _ _
@[reassoc]
lemma whiskerLeft_toUnit_comp_rightUnitor_hom (X Y : C) : X ◁ toUnit Y ≫ (ρ_ X).hom = fst X Y := by
rw [← cancel_mono (ρ_ X).inv]; aesop
@[reassoc]
lemma whiskerRight_toUnit_comp_leftUnitor_hom (X Y : C) : toUnit X ▷ Y ≫ (λ_ Y).hom = snd X Y := by
rw [← cancel_mono (λ_ Y).inv]; aesop
@[reassoc (attr := simp)]
lemma lift_leftUnitor_hom {X Y : C} (f : X ⟶ 𝟙_ C) (g : X ⟶ Y) :
lift f g ≫ (λ_ Y).hom = g := by
rw [← Iso.eq_comp_inv]
cat_disch
@[reassoc (attr := simp)]
lemma lift_rightUnitor_hom {X Y : C} (f : X ⟶ Y) (g : X ⟶ 𝟙_ C) :
lift f g ≫ (ρ_ Y).hom = f := by
rw [← Iso.eq_comp_inv]
cat_disch
/-- Universal property of the Cartesian product: Maps to `X ⊗ Y` correspond to pairs of maps to `X`
and to `Y`. -/
@[simps]
def homEquivToProd {X Y Z : C} : (Z ⟶ X ⊗ Y) ≃ (Z ⟶ X) × (Z ⟶ Y) where
toFun f := ⟨f ≫ fst _ _, f ≫ snd _ _⟩
invFun f := lift f.1 f.2
left_inv _ := by simp
right_inv _ := by simp
section BraidedCategory
variable [BraidedCategory C]
@[reassoc (attr := simp)]
theorem braiding_hom_fst (X Y : C) : (β_ X Y).hom ≫ fst _ _ = snd _ _ := by
simp [fst_def, snd_def, ← BraidedCategory.braiding_naturality_left_assoc]
@[reassoc (attr := simp)]
theorem braiding_hom_snd (X Y : C) : (β_ X Y).hom ≫ snd _ _ = fst _ _ := by
simp [fst_def, snd_def, ← BraidedCategory.braiding_naturality_right_assoc]
@[reassoc (attr := simp)]
theorem braiding_inv_fst (X Y : C) : (β_ X Y).inv ≫ fst _ _ = snd _ _ := by
simp [fst_def, snd_def, ← BraidedCategory.braiding_inv_naturality_left_assoc]
@[reassoc (attr := simp)]
theorem braiding_inv_snd (X Y : C) : (β_ X Y).inv ≫ snd _ _ = fst _ _ := by
simp [fst_def, snd_def, ← BraidedCategory.braiding_inv_naturality_right_assoc]
@[reassoc (attr := simp)]
lemma tensorμ_fst (W X Y Z : C) : tensorμ W X Y Z ≫ fst (W ⊗ Y) (X ⊗ Z) = fst W X ⊗ₘ fst Y Z := by
ext <;> simp [tensorμ]
@[reassoc (attr := simp)]
lemma tensorμ_snd (W X Y Z : C) : tensorμ W X Y Z ≫ snd (W ⊗ Y) (X ⊗ Z) = snd W X ⊗ₘ snd Y Z := by
ext <;> simp [tensorμ]
@[reassoc (attr := simp)]
lemma tensorδ_fst (W X Y Z : C) : tensorδ W X Y Z ≫ fst (W ⊗ X) (Y ⊗ Z) = fst W Y ⊗ₘ fst X Z := by
ext <;> simp [tensorδ]
@[reassoc (attr := simp)]
lemma tensorδ_snd (W X Y Z : C) : tensorδ W X Y Z ≫ snd (W ⊗ X) (Y ⊗ Z) = snd W Y ⊗ₘ snd X Z := by
ext <;> simp [tensorδ]
theorem lift_snd_fst {X Y : C} : lift (snd X Y) (fst X Y) = (β_ X Y).hom := by cat_disch
@[simp, reassoc]
lemma lift_snd_comp_fst_comp {W X Y Z : C} (g : W ⟶ X) (g' : Y ⟶ Z) :
lift (snd _ _ ≫ g') (fst _ _ ≫ g) = (β_ _ _).hom ≫ (g' ⊗ₘ g) := by cat_disch
@[reassoc (attr := simp)]
lemma lift_braiding_hom {T X Y : C} (f : T ⟶ X) (g : T ⟶ Y) :
lift f g ≫ (β_ X Y).hom = lift g f := by aesop
@[reassoc (attr := simp)]
lemma lift_braiding_inv {T X Y : C} (f : T ⟶ X) (g : T ⟶ Y) :
lift f g ≫ (β_ Y X).inv = lift g f := by aesop
-- See note [lower instance priority]
instance (priority := low) toSymmetricCategory [BraidedCategory C] : SymmetricCategory C where
/-- `CartesianMonoidalCategory` implies `BraidedCategory`.
This is not an instance to prevent diamonds. -/
def _root_.CategoryTheory.BraidedCategory.ofCartesianMonoidalCategory : BraidedCategory C where
braiding X Y := { hom := lift (snd _ _) (fst _ _), inv := lift (snd _ _) (fst _ _) }
@[deprecated (since := "2025-05-15")]
alias _root_.CategoryTheory.BraidedCategory.ofChosenFiniteProducts :=
BraidedCategory.ofCartesianMonoidalCategory
instance : Nonempty (BraidedCategory C) := ⟨.ofCartesianMonoidalCategory⟩
instance : Subsingleton (BraidedCategory C) where
allEq
| ⟨e₁, a₁, b₁, c₁, d₁⟩, ⟨e₂, a₂, b₂, c₂, d₂⟩ => by
congr
ext
· exact (@braiding_hom_fst C _ ‹_› ⟨e₁, a₁, b₁, c₁, d₁⟩ ..).trans
(@braiding_hom_fst C _ ‹_› ⟨e₂, a₂, b₂, c₂, d₂⟩ ..).symm
· exact (@braiding_hom_snd C _ ‹_› ⟨e₁, a₁, b₁, c₁, d₁⟩ ..).trans
(@braiding_hom_snd C _ ‹_› ⟨e₂, a₂, b₂, c₂, d₂⟩ ..).symm
instance : Subsingleton (SymmetricCategory C) where
allEq := by rintro ⟨_⟩ ⟨_⟩; congr; exact Subsingleton.elim _ _
end BraidedCategory
instance (priority := 100) : Limits.HasFiniteProducts C :=
letI : ∀ (X Y : C), Limits.HasLimit (Limits.pair X Y) := fun _ _ =>
.mk ⟨_, tensorProductIsBinaryProduct _ _⟩
letI : Limits.HasBinaryProducts C := Limits.hasBinaryProducts_of_hasLimit_pair _
letI : Limits.HasTerminal C := Limits.hasTerminal_of_unique (𝟙_ C)
hasFiniteProducts_of_has_binary_and_terminal
section CartesianMonoidalCategoryComparison
variable {D : Type u₁} [Category.{v₁} D] [CartesianMonoidalCategory D] (F : C ⥤ D)
variable {E : Type u₂} [Category.{v₂} E] [CartesianMonoidalCategory E] (G : D ⥤ E)
section terminalComparison
/-- When `C` and `D` have chosen finite products and `F : C ⥤ D` is any functor,
`terminalComparison F` is the unique map `F (𝟙_ C) ⟶ 𝟙_ D`. -/
abbrev terminalComparison : F.obj (𝟙_ C) ⟶ 𝟙_ D := toUnit _
@[reassoc]
lemma map_toUnit_comp_terminalComparison (A : C) :
F.map (toUnit A) ≫ terminalComparison F = toUnit _ := toUnit_unique _ _
open Limits
/-- If `terminalComparison F` is an Iso, then `F` preserves terminal objects. -/
lemma preservesLimit_empty_of_isIso_terminalComparison [IsIso (terminalComparison F)] :
PreservesLimit (Functor.empty.{0} C) F := by
apply preservesLimit_of_preserves_limit_cone isTerminalTensorUnit
apply isLimitChangeEmptyCone D isTerminalTensorUnit
exact asIso (terminalComparison F)|>.symm
/-- If `F` preserves terminal objects, then `terminalComparison F` is an isomorphism. -/
noncomputable def preservesTerminalIso [h : PreservesLimit (Functor.empty.{0} C) F] :
F.obj (𝟙_ C) ≅ 𝟙_ D :=
(isLimitChangeEmptyCone D (isLimitOfPreserves _ isTerminalTensorUnit) (asEmptyCone (F.obj (𝟙_ C)))
(Iso.refl _)).conePointUniqueUpToIso isTerminalTensorUnit
@[simp]
lemma preservesTerminalIso_hom [PreservesLimit (Functor.empty.{0} C) F] :
(preservesTerminalIso F).hom = terminalComparison F := toUnit_unique _ _
instance terminalComparison_isIso_of_preservesLimits [PreservesLimit (Functor.empty.{0} C) F] :
IsIso (terminalComparison F) := by
rw [← preservesTerminalIso_hom]
infer_instance
@[simp]
lemma preservesTerminalIso_id : preservesTerminalIso (𝟭 C) = .refl _ := by
cat_disch
@[simp]
lemma preservesTerminalIso_comp [PreservesLimit (Functor.empty.{0} C) F]
[PreservesLimit (Functor.empty.{0} D) G] [PreservesLimit (Functor.empty.{0} C) (F ⋙ G)] :
preservesTerminalIso (F ⋙ G) =
G.mapIso (preservesTerminalIso F) ≪≫ preservesTerminalIso G := by
cat_disch
end terminalComparison
section prodComparison
variable (A B : C)
/-- When `C` and `D` have chosen finite products and `F : C ⥤ D` is any functor,
`prodComparison F A B` is the canonical comparison morphism from `F (A ⊗ B)` to `F(A) ⊗ F(B)`. -/
def prodComparison (A B : C) : F.obj (A ⊗ B) ⟶ F.obj A ⊗ F.obj B :=
lift (F.map (fst A B)) (F.map (snd A B))
@[reassoc (attr := simp)]
theorem prodComparison_fst : prodComparison F A B ≫ fst _ _ = F.map (fst A B) :=
lift_fst _ _
@[reassoc (attr := simp)]
theorem prodComparison_snd : prodComparison F A B ≫ snd _ _ = F.map (snd A B) :=
lift_snd _ _
@[reassoc (attr := simp)]
theorem inv_prodComparison_map_fst [IsIso (prodComparison F A B)] :
inv (prodComparison F A B) ≫ F.map (fst _ _) = fst _ _ := by simp [IsIso.inv_comp_eq]
@[reassoc (attr := simp)]
theorem inv_prodComparison_map_snd [IsIso (prodComparison F A B)] :
inv (prodComparison F A B) ≫ F.map (snd _ _) = snd _ _ := by simp [IsIso.inv_comp_eq]
variable {A B} {A' B' : C}
/-- Naturality of the `prodComparison` morphism in both arguments. -/
@[reassoc]
theorem prodComparison_natural (f : A ⟶ A') (g : B ⟶ B') :
F.map (f ⊗ₘ g) ≫ prodComparison F A' B' =
prodComparison F A B ≫ (F.map f ⊗ₘ F.map g) := by
apply hom_ext <;>
simp only [Category.assoc, prodComparison_fst, tensorHom_fst, prodComparison_fst_assoc,
prodComparison_snd, tensorHom_snd, prodComparison_snd_assoc, ← F.map_comp]
/-- Naturality of the `prodComparison` morphism in the right argument. -/
@[reassoc]
theorem prodComparison_natural_whiskerLeft (g : B ⟶ B') :
F.map (A ◁ g) ≫ prodComparison F A B' =
prodComparison F A B ≫ (F.obj A ◁ F.map g) := by
ext <;> simp [← Functor.map_comp]
/-- Naturality of the `prodComparison` morphism in the left argument. -/
@[reassoc]
theorem prodComparison_natural_whiskerRight (f : A ⟶ A') :
F.map (f ▷ B) ≫ prodComparison F A' B =
prodComparison F A B ≫ (F.map f ▷ F.obj B) := by
ext <;> simp [← Functor.map_comp]
section
variable [IsIso (prodComparison F A B)]
/-- If the product comparison morphism is an iso, its inverse is natural in both argument. -/
@[reassoc]
theorem prodComparison_inv_natural (f : A ⟶ A') (g : B ⟶ B') [IsIso (prodComparison F A' B')] :
inv (prodComparison F A B) ≫ F.map (f ⊗ₘ g) =
(F.map f ⊗ₘ F.map g) ≫ inv (prodComparison F A' B') := by
rw [IsIso.eq_comp_inv, Category.assoc, IsIso.inv_comp_eq, prodComparison_natural]
/-- If the product comparison morphism is an iso, its inverse is natural in the right argument. -/
@[reassoc]
theorem prodComparison_inv_natural_whiskerLeft (g : B ⟶ B') [IsIso (prodComparison F A B')] :
inv (prodComparison F A B) ≫ F.map (A ◁ g) =
(F.obj A ◁ F.map g) ≫ inv (prodComparison F A B') := by
rw [IsIso.eq_comp_inv, Category.assoc, IsIso.inv_comp_eq, prodComparison_natural_whiskerLeft]
/-- If the product comparison morphism is an iso, its inverse is natural in the left argument. -/
@[reassoc]
theorem prodComparison_inv_natural_whiskerRight (f : A ⟶ A') [IsIso (prodComparison F A' B)] :
inv (prodComparison F A B) ≫ F.map (f ▷ B) =
(F.map f ▷ F.obj B) ≫ inv (prodComparison F A' B) := by
rw [IsIso.eq_comp_inv, Category.assoc, IsIso.inv_comp_eq, prodComparison_natural_whiskerRight]
end
lemma prodComparison_comp :
prodComparison (F ⋙ G) A B =
G.map (prodComparison F A B) ≫ prodComparison G (F.obj A) (F.obj B) := by
unfold prodComparison
ext <;> simp [← G.map_comp]
@[simp]
lemma prodComparison_id :
prodComparison (𝟭 C) A B = 𝟙 (A ⊗ B) := lift_fst_snd
/-- The product comparison morphism from `F(A ⊗ -)` to `FA ⊗ F-`, whose components are given by
`prodComparison`. -/
@[simps]
def prodComparisonNatTrans (A : C) :
(curriedTensor C).obj A ⋙ F ⟶ F ⋙ (curriedTensor D).obj (F.obj A) where
app B := prodComparison F A B
naturality x y f := by
apply hom_ext <;>
simp only [Functor.comp_obj, curriedTensor_obj_obj,
Functor.comp_map, curriedTensor_obj_map, Category.assoc, prodComparison_fst, whiskerLeft_fst,
prodComparison_snd, prodComparison_snd_assoc, whiskerLeft_snd, ← F.map_comp]
theorem prodComparisonNatTrans_comp :
prodComparisonNatTrans (F ⋙ G) A = Functor.whiskerRight (prodComparisonNatTrans F A) G ≫
Functor.whiskerLeft F (prodComparisonNatTrans G (F.obj A)) := by
ext; simp [prodComparison_comp]
@[simp]
lemma prodComparisonNatTrans_id :
prodComparisonNatTrans (𝟭 C) A = 𝟙 _ := by ext; simp
/-- The product comparison morphism from `F(- ⊗ -)` to `F- ⊗ F-`, whose components are given by
`prodComparison`. -/
@[simps]
def prodComparisonBifunctorNatTrans :
curriedTensor C ⋙ (Functor.whiskeringRight _ _ _).obj F ⟶
F ⋙ curriedTensor D ⋙ (Functor.whiskeringLeft _ _ _).obj F where
app A := prodComparisonNatTrans F A
naturality x y f := by
ext z
apply hom_ext <;> simp [← Functor.map_comp]
variable {E : Type u₂} [Category.{v₂} E] [CartesianMonoidalCategory E] (G : D ⥤ E)
theorem prodComparisonBifunctorNatTrans_comp : prodComparisonBifunctorNatTrans (F ⋙ G) =
Functor.whiskerRight
(prodComparisonBifunctorNatTrans F) ((Functor.whiskeringRight _ _ _).obj G) ≫
Functor.whiskerLeft F (Functor.whiskerRight (prodComparisonBifunctorNatTrans G)
((Functor.whiskeringLeft _ _ _).obj F)) := by
ext; simp [prodComparison_comp]
instance (A : C) [∀ B, IsIso (prodComparison F A B)] : IsIso (prodComparisonNatTrans F A) := by
letI : ∀ X, IsIso ((prodComparisonNatTrans F A).app X) := by assumption
apply NatIso.isIso_of_isIso_app
instance [∀ A B, IsIso (prodComparison F A B)] : IsIso (prodComparisonBifunctorNatTrans F) := by
letI : ∀ X, IsIso ((prodComparisonBifunctorNatTrans F).app X) :=
fun _ ↦ by dsimp; apply NatIso.isIso_of_isIso_app
apply NatIso.isIso_of_isIso_app
open Limits
section PreservesLimitPairs
section
variable (A B)
variable [PreservesLimit (pair A B) F]
/-- If `F` preserves the limit of the pair `(A, B)`, then the binary fan given by
`(F.map fst A B, F.map (snd A B))` is a limit cone. -/
noncomputable def isLimitCartesianMonoidalCategoryOfPreservesLimits :
IsLimit <| BinaryFan.mk (F.map (fst A B)) (F.map (snd A B)) :=
mapIsLimitOfPreservesOfIsLimit F (fst _ _) (snd _ _) <|
(tensorProductIsBinaryProduct A B).ofIsoLimit <|
isoBinaryFanMk (BinaryFan.mk (fst A B) (snd A B))
@[deprecated (since := "2025-05-15")]
alias isLimitChosenFiniteProductsOfPreservesLimits :=
isLimitCartesianMonoidalCategoryOfPreservesLimits
/-- If `F` preserves the limit of the pair `(A, B)`, then `prodComparison F A B` is an isomorphism.
-/
noncomputable def prodComparisonIso : F.obj (A ⊗ B) ≅ F.obj A ⊗ F.obj B :=
IsLimit.conePointUniqueUpToIso (isLimitCartesianMonoidalCategoryOfPreservesLimits F A B)
(tensorProductIsBinaryProduct _ _)
@[simp]
lemma prodComparisonIso_hom : (prodComparisonIso F A B).hom = prodComparison F A B :=
rfl
instance isIso_prodComparison_of_preservesLimit_pair : IsIso (prodComparison F A B) := by
rw [← prodComparisonIso_hom]
infer_instance
@[simp] lemma prodComparisonIso_id : prodComparisonIso (𝟭 C) A B = .refl _ := by ext <;> simp
@[simp]
lemma prodComparisonIso_comp [PreservesLimit (pair A B) (F ⋙ G)]
[PreservesLimit (pair (F.obj A) (F.obj B)) G] :
prodComparisonIso (F ⋙ G) A B =
G.mapIso (prodComparisonIso F A B) ≪≫ prodComparisonIso G (F.obj A) (F.obj B) := by
ext <;> simp [CartesianMonoidalCategory.prodComparison, ← G.map_comp]
end
/-- The natural isomorphism `F(A ⊗ -) ≅ FA ⊗ F-`, provided each `prodComparison F A B` is an
isomorphism (as `B` changes). -/
@[simps! hom inv]
noncomputable def prodComparisonNatIso (A : C) [∀ B, PreservesLimit (pair A B) F] :
(curriedTensor C).obj A ⋙ F ≅ F ⋙ (curriedTensor D).obj (F.obj A) :=
asIso (prodComparisonNatTrans F A)
/-- The natural isomorphism of bifunctors `F(- ⊗ -) ≅ F- ⊗ F-`, provided each
`prodComparison F A B` is an isomorphism. -/
@[simps! hom inv]
noncomputable def prodComparisonBifunctorNatIso [∀ A B, PreservesLimit (pair A B) F] :
curriedTensor C ⋙ (Functor.whiskeringRight _ _ _).obj F ≅
F ⋙ curriedTensor D ⋙ (Functor.whiskeringLeft _ _ _).obj F :=
asIso (prodComparisonBifunctorNatTrans F)
end PreservesLimitPairs
section ProdComparisonIso
/-- If `prodComparison F A B` is an isomorphism, then `F` preserves the limit of `pair A B`. -/
lemma preservesLimit_pair_of_isIso_prodComparison (A B : C)
[IsIso (prodComparison F A B)] :
PreservesLimit (pair A B) F := by
apply preservesLimit_of_preserves_limit_cone (tensorProductIsBinaryProduct A B)
refine IsLimit.equivOfNatIsoOfIso (pairComp A B F) _
((BinaryFan.mk (fst (F.obj A) (F.obj B)) (snd _ _)).extend (prodComparison F A B))
(BinaryFan.ext (by exact Iso.refl _) ?_ ?_) |>.invFun
(IsLimit.extendIso _ (tensorProductIsBinaryProduct (F.obj A) (F.obj B)))
· dsimp only [BinaryFan.fst]
simp [pairComp]
· dsimp only [BinaryFan.snd]
simp [pairComp]
/-- If `prodComparison F A B` is an isomorphism for all `A B` then `F` preserves limits of shape
`Discrete (WalkingPair)`. -/
lemma preservesLimitsOfShape_discrete_walkingPair_of_isIso_prodComparison
[∀ A B, IsIso (prodComparison F A B)] : PreservesLimitsOfShape (Discrete WalkingPair) F := by
constructor
intro K
refine @preservesLimit_of_iso_diagram _ _ _ _ _ _ _ _ _ (diagramIsoPair K).symm ?_
apply preservesLimit_pair_of_isIso_prodComparison
end ProdComparisonIso
end prodComparison
end CartesianMonoidalCategoryComparison
/-- In a cartesian monoidal category, `tensorLeft X` is naturally isomorphic `prod.functor.obj X`.
-/
noncomputable def tensorLeftIsoProd [HasBinaryProducts C] (X : C) :
MonoidalCategory.tensorLeft X ≅ prod.functor.obj X :=
NatIso.ofComponents fun Y ↦
(CartesianMonoidalCategory.tensorProductIsBinaryProduct X Y).conePointUniqueUpToIso
(limit.isLimit _)
open Limits
variable {P : ObjectProperty C}
-- TODO: Introduce `ClosedUnderFiniteProducts`?
/-- The restriction of a Cartesian-monoidal category along an object property that's closed under
finite products is Cartesian-monoidal. -/
@[simps!]
instance fullSubcategory
[P.IsClosedUnderLimitsOfShape (Discrete PEmpty)]
[P.IsClosedUnderLimitsOfShape (Discrete WalkingPair)] :
CartesianMonoidalCategory P.FullSubcategory where
__ := MonoidalCategory.fullSubcategory P
(P.prop_of_isLimit isTerminalTensorUnit (by simp))
(fun X Y hX hY ↦ P.prop_of_isLimit (tensorProductIsBinaryProduct X Y)
(by rintro (_ | _) <;> assumption))
isTerminalTensorUnit := .ofUniqueHom (fun X ↦ toUnit X.1) fun _ _ ↦ by ext
fst X Y := fst X.1 Y.1
snd X Y := snd X.1 Y.1
tensorProductIsBinaryProduct X Y :=
BinaryFan.IsLimit.mk _ (lift (C := C)) (lift_fst (C := C)) (lift_snd (C := C))
(by rintro T f g m rfl rfl; symm; exact lift_comp_fst_snd _)
fst_def X Y := fst_def X.1 Y.1
snd_def X Y := snd_def X.1 Y.1
end CartesianMonoidalCategory
open MonoidalCategory CartesianMonoidalCategory
variable
{C : Type u₁} [Category.{v₁} C] [CartesianMonoidalCategory C]
{D : Type u₂} [Category.{v₂} D] [CartesianMonoidalCategory D]
{E : Type u₃} [Category.{v₃} E] [CartesianMonoidalCategory E]
(F : C ⥤ D) (G : D ⥤ E) {X Y Z : C}
open Functor.LaxMonoidal Functor.OplaxMonoidal
open Limits (PreservesFiniteProducts)
namespace Functor.OplaxMonoidal
variable [F.OplaxMonoidal]
lemma η_of_cartesianMonoidalCategory :
η F = CartesianMonoidalCategory.terminalComparison F := toUnit_unique ..
@[reassoc (attr := simp)]
lemma δ_fst (X Y : C) :
δ F X Y ≫ fst _ _ = F.map (fst _ _) := by
trans F.map (X ◁ toUnit Y) ≫ F.map (ρ_ X).hom
· rw [← whiskerLeft_fst _ (F.map (toUnit Y)), δ_natural_right_assoc]
simp [← OplaxMonoidal.right_unitality_hom, rightUnitor_hom (F.obj X)]
· simp [← Functor.map_comp, rightUnitor_hom]
@[reassoc (attr := simp)]
lemma δ_snd (X Y : C) :
δ F X Y ≫ snd _ _ = F.map (snd _ _) := by
trans F.map (toUnit X ▷ Y) ≫ F.map (λ_ Y).hom
· rw [← whiskerRight_snd (F.map (toUnit X)), δ_natural_left_assoc]
simp [← OplaxMonoidal.left_unitality_hom, leftUnitor_hom (F.obj Y)]
· simp [← Functor.map_comp, leftUnitor_hom]
@[reassoc (attr := simp)]
lemma lift_δ (f : X ⟶ Y) (g : X ⟶ Z) : F.map (lift f g) ≫ δ F _ _ = lift (F.map f) (F.map g) := by
ext <;> simp [← map_comp]
lemma δ_of_cartesianMonoidalCategory (X Y : C) :
δ F X Y = CartesianMonoidalCategory.prodComparison F X Y := by cat_disch
variable [PreservesFiniteProducts F]
instance : IsIso (η F) :=
η_of_cartesianMonoidalCategory F ▸ terminalComparison_isIso_of_preservesLimits F
instance (X Y : C) : IsIso (δ F X Y) :=
δ_of_cartesianMonoidalCategory F X Y ▸ isIso_prodComparison_of_preservesLimit_pair F X Y
omit [F.OplaxMonoidal] in
/-- Any functor between Cartesian-monoidal categories is oplax monoidal.
This is not made an instance because it would create a diamond for the oplax monoidal structure on
the identity and composition of functors. -/
def ofChosenFiniteProducts (F : C ⥤ D) : F.OplaxMonoidal where
η := terminalComparison F
δ X Y := prodComparison F X Y
δ_natural_left f X := by ext <;> simp [← Functor.map_comp]
δ_natural_right X g := by ext <;> simp [← Functor.map_comp]
oplax_associativity _ _ _ := by ext <;> simp [← Functor.map_comp]
oplax_left_unitality _ := by ext; simp [← Functor.map_comp]
oplax_right_unitality _ := by ext; simp [← Functor.map_comp]
omit [F.OplaxMonoidal] in
/-- Any functor between Cartesian-monoidal categories is oplax monoidal in a unique way. -/
instance : Subsingleton F.OplaxMonoidal where
allEq a b := by
ext1
· exact toUnit_unique _ _
· ext1; ext1; rw [δ_of_cartesianMonoidalCategory, δ_of_cartesianMonoidalCategory]
end OplaxMonoidal
namespace Monoidal
variable [F.Monoidal] [G.Monoidal]
@[reassoc (attr := simp)]
lemma toUnit_ε (X : C) : toUnit (F.obj X) ≫ ε F = F.map (toUnit X) := by
rw [← cancel_mono (εIso F).inv]; exact toUnit_unique ..
@[reassoc (attr := simp)]
lemma lift_μ (f : X ⟶ Y) (g : X ⟶ Z) : lift (F.map f) (F.map g) ≫ μ F _ _ = F.map (lift f g) :=
(cancel_mono (μIso _ _ _).inv).1 (by simp)
@[reassoc (attr := simp)]
lemma μ_fst (X Y : C) : μ F X Y ≫ F.map (fst X Y) = fst (F.obj X) (F.obj Y) :=
(cancel_epi (μIso _ _ _).inv).1 (by simp)
@[reassoc (attr := simp)]
lemma μ_snd (X Y : C) : μ F X Y ≫ F.map (snd X Y) = snd (F.obj X) (F.obj Y) :=
(cancel_epi (μIso _ _ _).inv).1 (by simp)
attribute [-instance] Functor.LaxMonoidal.comp Functor.Monoidal.instComp in
@[reassoc]
lemma μ_comp [(F ⋙ G).Monoidal] (X Y : C) : μ (F ⋙ G) X Y = μ G _ _ ≫ G.map (μ F X Y) := by
rw [← cancel_mono (μIso _ _ _).inv]; ext <;> simp [← Functor.comp_obj, ← Functor.map_comp]
variable [PreservesFiniteProducts F]
lemma ε_of_cartesianMonoidalCategory : ε F = (preservesTerminalIso F).inv := by
change (εIso F).symm.inv = _; congr; ext
lemma μ_of_cartesianMonoidalCategory (X Y : C) : μ F X Y = (prodComparisonIso F X Y).inv := by
change (μIso F X Y).symm.inv = _; congr; ext : 1; simpa using δ_of_cartesianMonoidalCategory F X Y
attribute [local instance] Functor.OplaxMonoidal.ofChosenFiniteProducts in
omit [F.Monoidal] in
/-- A finite-product-preserving functor between Cartesian monoidal categories is monoidal.
This is not made an instance because it would create a diamond for the monoidal structure on
the identity and composition of functors. -/
noncomputable def ofChosenFiniteProducts (F : C ⥤ D) [PreservesFiniteProducts F] : F.Monoidal :=
.ofOplaxMonoidal F
instance : Subsingleton F.Monoidal := (toOplaxMonoidal_injective F).subsingleton
end Monoidal
namespace Monoidal
instance [F.Monoidal] : PreservesFiniteProducts F :=
have (A B : _) : IsIso (CartesianMonoidalCategory.prodComparison F A B) :=
δ_of_cartesianMonoidalCategory F A B ▸ inferInstance
have : IsIso (CartesianMonoidalCategory.terminalComparison F) :=
η_of_cartesianMonoidalCategory F ▸ inferInstance
have := preservesLimitsOfShape_discrete_walkingPair_of_isIso_prodComparison F
have := preservesLimit_empty_of_isIso_terminalComparison F
have := Limits.preservesLimitsOfShape_pempty_of_preservesTerminal F
.of_preserves_binary_and_terminal _
attribute [local instance] OplaxMonoidal.ofChosenFiniteProducts in
/--
A functor between Cartesian monoidal categories is monoidal iff it preserves finite products.
-/
lemma nonempty_monoidal_iff_preservesFiniteProducts :
Nonempty F.Monoidal ↔ PreservesFiniteProducts F :=
⟨fun ⟨_⟩ ↦ inferInstance, fun _ ↦ ⟨ofChosenFiniteProducts F⟩⟩
end Monoidal
namespace Braided
variable [BraidedCategory C] [BraidedCategory D]
attribute [local instance] Functor.Monoidal.ofChosenFiniteProducts in
/-- A finite-product-preserving functor between Cartesian monoidal categories is braided.
This is not made an instance because it would create a diamond for the monoidal structure on
the identity and composition of functors. -/
noncomputable def ofChosenFiniteProducts (F : C ⥤ D) [PreservesFiniteProducts F] : F.Braided where
braided X Y := by rw [← cancel_mono (Monoidal.μIso _ _ _).inv]; ext <;> simp [← F.map_comp]
instance : Subsingleton F.Braided := (Braided.toMonoidal_injective F).subsingleton
end Braided
@[deprecated (since := "2025-04-24")]
alias oplaxMonoidalOfChosenFiniteProducts := OplaxMonoidal.ofChosenFiniteProducts
@[deprecated (since := "2025-04-24")]
alias monoidalOfChosenFiniteProducts := Monoidal.ofChosenFiniteProducts
@[deprecated (since := "2025-04-24")]
alias braidedOfChosenFiniteProducts := Braided.ofChosenFiniteProducts
namespace EssImageSubcategory
variable [F.Full] [F.Faithful] [PreservesFiniteProducts F] {T X Y Z : F.EssImageSubcategory}
lemma tensor_obj (X Y : F.EssImageSubcategory) : (X ⊗ Y).obj = X.obj ⊗ Y.obj := rfl
lemma lift_def (f : T ⟶ X) (g : T ⟶ Y) : lift f g = lift (T := T.1) f g := rfl
lemma associator_hom_def (X Y Z : F.EssImageSubcategory) :
(α_ X Y Z).hom = (α_ X.obj Y.obj Z.obj).hom := rfl
lemma associator_inv_def (X Y Z : F.EssImageSubcategory) :
(α_ X Y Z).inv = (α_ X.obj Y.obj Z.obj).inv := rfl
lemma toUnit_def (X : F.EssImageSubcategory) : toUnit X = toUnit X.obj := toUnit_unique ..
end Functor.EssImageSubcategory
namespace NatTrans
variable (F G : C ⥤ D) [F.Monoidal] [G.Monoidal]
instance IsMonoidal.of_cartesianMonoidalCategory (α : F ⟶ G) : IsMonoidal α where
unit := (cancel_mono (Functor.Monoidal.εIso _).inv).1 (toUnit_unique _ _)
tensor {X Y} := by
rw [← cancel_mono (Functor.Monoidal.μIso _ _ _).inv]
rw [← cancel_epi (Functor.Monoidal.μIso _ _ _).inv]
apply CartesianMonoidalCategory.hom_ext <;> simp
end NatTrans
end CategoryTheory |
.lake/packages/mathlib/Mathlib/CategoryTheory/Monoidal/Cartesian/CommMon_.lean | import Mathlib.CategoryTheory.Monoidal.Cartesian.Mon_
/-!
# Yoneda embedding of `CommMon C`
-/
assert_not_exists MonoidWithZero
open CategoryTheory MonoidalCategory Limits Opposite CartesianMonoidalCategory MonObj
namespace CategoryTheory
universe w v u
variable {C : Type u} [Category.{v} C] [CartesianMonoidalCategory C] [BraidedCategory C] {X : C}
variable (X) in
/-- If `X` represents a presheaf of commutative monoids, then `X` is a commutative monoid object. -/
lemma IsCommMonObj.ofRepresentableBy (F : Cᵒᵖ ⥤ CommMonCat) (α : (F ⋙ forget _).RepresentableBy X) :
letI : MonObj X := .ofRepresentableBy X (F ⋙ forget₂ CommMonCat MonCat) α
IsCommMonObj X := by
letI : MonObj X := .ofRepresentableBy X (F ⋙ forget₂ CommMonCat MonCat) α
have : μ = α.homEquiv.symm (α.homEquiv (fst X X) * α.homEquiv (snd X X)) := rfl
constructor
simp_rw [this, ← α.homEquiv.apply_eq_iff_eq, α.homEquiv_comp, Functor.comp_map,
ConcreteCategory.forget_map_eq_coe, Equiv.apply_symm_apply, map_mul,
← ConcreteCategory.forget_map_eq_coe, ← Functor.comp_map, ← α.homEquiv_comp, op_tensorObj,
Functor.comp_obj, braiding_hom_fst, braiding_hom_snd, _root_.mul_comm]
@[deprecated (since := "2025-09-14")]
alias IsCommMon.ofRepresentableBy := IsCommMonObj.ofRepresentableBy
end CategoryTheory |
.lake/packages/mathlib/Mathlib/CategoryTheory/Monoidal/Cartesian/InfSemilattice.lean | import Mathlib.CategoryTheory.Limits.Preorder
import Mathlib.CategoryTheory.Monoidal.Cartesian.Basic
/-!
# The preorder category of a meet-semilattice with a greatest element is Cartesian monoidal
The preorder category of a meet-semilattice `C` with a greatest element is Cartesian monoidal.
A symmetric monoidal structure on the preorder category is automatically provided by the
instance and `CartesianMonoidalCategory.toSymmetricCategory`.
-/
namespace CategoryTheory
open Category MonoidalCategory
universe u
variable (C : Type u) [SemilatticeInf C] [OrderTop C]
namespace SemilatticeInf
/-- Cartesian monoidal structure for the preorder category of a meet-semilattice with
a greatest element. -/
noncomputable scoped instance cartesianMonoidalCategory : CartesianMonoidalCategory C :=
.ofChosenFiniteProducts ⟨_, Preorder.isTerminalTop C⟩ fun X Y ↦ ⟨_, Preorder.isLimitBinaryFan X Y⟩
/-- Braided structure for the preorder category of a meet-semilattice with a greatest element. -/
noncomputable scoped instance braidedCategory : BraidedCategory C := .ofCartesianMonoidalCategory
lemma tensorObj {C : Type u} [SemilatticeInf C] [OrderTop C] {X Y : C} : X ⊗ Y = X ⊓ Y := rfl
lemma tensorUnit {C : Type u} [SemilatticeInf C] [OrderTop C] :
𝟙_ C = ⊤ := rfl
end SemilatticeInf
end CategoryTheory |
.lake/packages/mathlib/Mathlib/CategoryTheory/Monoidal/Cartesian/Cat.lean | import Mathlib.CategoryTheory.Monoidal.Cartesian.Basic
/-!
# Chosen finite products in `Cat`
This file proves that the Cartesian product of a pair of categories agrees with the
product in `Cat`, and provides the associated `CartesianMonoidalCategory` instance.
-/
universe v u
namespace CategoryTheory
namespace Cat
open Limits
attribute [local instance] uliftCategory in
/-- The chosen terminal object in `Cat`. -/
abbrev chosenTerminal : Cat := Cat.of (ULift (ULiftHom (Discrete Unit)))
/-- The chosen terminal object in `Cat` is terminal. -/
def chosenTerminalIsTerminal : IsTerminal chosenTerminal :=
IsTerminal.ofUniqueHom (fun _ ↦ (Functor.const _).obj ⟨⟨⟨⟩⟩⟩) fun _ _ ↦ rfl
/-- The type of functors out of the chosen terminal category is equivalent to the type of objects
in the target category. TODO: upgrade to an equivalence of categories. -/
def fromChosenTerminalEquiv {C : Type u} [Category.{v} C] : Cat.chosenTerminal ⥤ C ≃ C where
toFun F := F.obj ⟨⟨()⟩⟩
invFun := (Functor.const _).obj
left_inv _ := by
apply Functor.ext
· rintro ⟨⟨⟨⟩⟩⟩ ⟨⟨⟨⟩⟩⟩ ⟨⟨⟨⟨⟩⟩⟩⟩
simp only [eqToHom_refl, Category.comp_id, Category.id_comp]
exact (Functor.map_id _ _).symm
· intro; rfl
right_inv _ := rfl
/-- The chosen product of categories `C × D` yields a product cone in `Cat`. -/
def prodCone (C D : Cat.{v, u}) : BinaryFan C D :=
.mk (P := .of (C × D)) (Prod.fst _ _) (Prod.snd _ _)
/-- The product cone in `Cat` is indeed a product. -/
def isLimitProdCone (X Y : Cat) : IsLimit (prodCone X Y) := BinaryFan.isLimitMk
(fun S => S.fst.prod' S.snd) (fun _ => rfl) (fun _ => rfl) (fun _ _ h1 h2 =>
Functor.hext
(fun _ ↦ Prod.ext (by simp [← h1]) (by simp [← h2]))
(fun _ _ _ ↦ by dsimp; rw [← h1, ← h2]; rfl))
instance : CartesianMonoidalCategory Cat :=
.ofChosenFiniteProducts ⟨_, chosenTerminalIsTerminal⟩ fun X Y ↦
{ cone := X.prodCone Y, isLimit := isLimitProdCone X Y }
instance : BraidedCategory Cat := .ofCartesianMonoidalCategory
/-- A monoidal instance for `Cat` is provided from the `CartesianMonoidalCategory` instance. -/
example : MonoidalCategory Cat := by infer_instance
/-- A symmetric monoidal instance for `Cat` is provided through
`CartesianMonoidalCategory.toSymmetricCategory`. -/
example : SymmetricCategory Cat := by infer_instance
end Cat
namespace Monoidal
open MonoidalCategory
lemma tensorObj (C : Cat) (D : Cat) : C ⊗ D = Cat.of (C × D) := rfl
lemma whiskerLeft (X : Cat) {A : Cat} {B : Cat} (f : A ⟶ B) :
X ◁ f = (𝟭 X).prod f := rfl
lemma whiskerLeft_fst (X : Cat) {A : Cat} {B : Cat} (f : A ⟶ B) :
(X ◁ f) ⋙ Prod.fst _ _ = Prod.fst _ _ := rfl
lemma whiskerLeft_snd (X : Cat) {A : Cat} {B : Cat} (f : A ⟶ B) :
(X ◁ f) ⋙ Prod.snd _ _ = Prod.snd _ _ ⋙ f := rfl
lemma whiskerRight {A : Cat} {B : Cat} (f : A ⟶ B) (X : Cat) :
f ▷ X = f.prod (𝟭 X) := rfl
lemma whiskerRight_fst {A : Cat} {B : Cat} (f : A ⟶ B) (X : Cat) :
(f ▷ X) ⋙ Prod.fst _ _ = Prod.fst _ _ ⋙ f := rfl
lemma whiskerRight_snd {A : Cat} {B : Cat} (f : A ⟶ B) (X : Cat) :
(f ▷ X) ⋙ Prod.snd _ _ = Prod.snd _ _ := rfl
lemma tensorHom {A : Cat} {B : Cat} (f : A ⟶ B) {X : Cat} {Y : Cat} (g : X ⟶ Y) :
f ⊗ₘ g = f.prod g := rfl
lemma tensorUnit : 𝟙_ Cat = Cat.chosenTerminal := rfl
lemma associator_hom (X : Cat) (Y : Cat) (Z : Cat) :
(associator X Y Z).hom = Functor.prod' (Prod.fst (X × Y) Z ⋙ Prod.fst X Y)
((Functor.prod' ((Prod.fst (X × Y) Z ⋙ Prod.snd X Y))
(Prod.snd (X × Y) Z : (X × Y) × Z ⥤ Z))) := rfl
lemma associator_inv (X : Cat) (Y : Cat) (Z : Cat) :
(associator X Y Z).inv = Functor.prod' (Functor.prod' (Prod.fst X (Y × Z) : X × (Y × Z) ⥤ X)
(Prod.snd X (Y × Z) ⋙ Prod.fst Y Z)) (Prod.snd X (Y × Z) ⋙ Prod.snd Y Z) := rfl
lemma leftUnitor_hom (C : Cat) : (λ_ C).hom = Prod.snd _ _ := rfl
lemma leftUnitor_inv (C : Cat) : (λ_ C).inv = Prod.sectR ⟨⟨⟨⟩⟩⟩ _ := rfl
lemma rightUnitor_hom (C : Cat) : (ρ_ C).hom = Prod.fst _ _ := rfl
lemma rightUnitor_inv (C : Cat) : (ρ_ C).inv = Prod.sectL _ ⟨⟨⟨⟩⟩⟩ := rfl
end CategoryTheory.Monoidal |
.lake/packages/mathlib/Mathlib/CategoryTheory/Monoidal/Cartesian/Comon_.lean | import Mathlib.CategoryTheory.Monoidal.Cartesian.Basic
import Mathlib.CategoryTheory.Monoidal.Comon_
/-!
# Comonoid objects in a Cartesian monoidal category.
The category of comonoid objects in a Cartesian monoidal category is equivalent
to the category itself, via the forgetful functor.
-/
open CategoryTheory MonoidalCategory CartesianMonoidalCategory Limits ComonObj
universe v u
noncomputable section
namespace CategoryTheory
variable (C : Type u) [Category.{v} C] [CartesianMonoidalCategory C]
attribute [local simp] leftUnitor_hom rightUnitor_hom
/--
The functor from a Cartesian monoidal category to comonoids in that category,
equipping every object with the diagonal map as a comultiplication.
-/
def cartesianComon : C ⥤ Comon C where
obj X := {
X := X
comon := {
comul := lift (𝟙 _) (𝟙 _)
counit := toUnit _
}
}
map f := .mk' f
@[deprecated (since := "2025-09-15")] alias cartesianComon_ := cartesianComon
variable {C}
@[simp] theorem counit_eq_toUnit (A : C) [ComonObj A] : ε[A] = toUnit _ := by ext
@[deprecated (since := "2025-05-09")] alias counit_eq_from := counit_eq_toUnit
@[simp] theorem comul_eq_lift (A : C) [ComonObj A] : Δ[A] = lift (𝟙 _) (𝟙 _) := by
ext
· simpa using comul_counit A =≫ fst _ _
· simpa using counit_comul A =≫ snd _ _
@[deprecated (since := "2025-05-09")] alias comul_eq_diag := comul_eq_lift
/--
Every comonoid object in a Cartesian monoidal category is equivalent to
the canonical comonoid structure on the underlying object.
-/
@[simps] def isoCartesianComon (A : Comon C) : A ≅ (cartesianComon C).obj A.X :=
{ hom := .mk' (𝟙 _)
inv := .mk' (𝟙 _) }
@[deprecated (since := "2025-09-15")] alias iso_cartesianComon_ := isoCartesianComon
/--
The category of comonoid objects in a Cartesian monoidal category is equivalent
to the category itself, via the forgetful functor.
-/
@[simps] def comonEquiv : Comon C ≌ C where
functor := Comon.forget C
inverse := cartesianComon C
unitIso := NatIso.ofComponents isoCartesianComon
counitIso := NatIso.ofComponents (fun _ => .refl _)
end CategoryTheory |
.lake/packages/mathlib/Mathlib/CategoryTheory/Monoidal/Cartesian/Mon_.lean | import Mathlib.Algebra.Category.MonCat.Limits
import Mathlib.CategoryTheory.Monoidal.Cartesian.Basic
import Mathlib.CategoryTheory.Monoidal.Mon_
/-!
# Yoneda embedding of `Mon C`
We show that monoid objects in Cartesian monoidal categories are exactly those whose yoneda presheaf
is a presheaf of monoids, by constructing the yoneda embedding `Mon C ⥤ Cᵒᵖ ⥤ MonCat.{v}` and
showing that it is fully faithful and its (essential) image is the representable functors.
-/
open CategoryTheory MonoidalCategory Limits Opposite CartesianMonoidalCategory MonObj
namespace CategoryTheory
universe w v u
variable {C D : Type*} [Category.{v} C] [CartesianMonoidalCategory C]
[Category.{w} D] [CartesianMonoidalCategory D]
{M N O X Y : C} [MonObj M] [MonObj N] [MonObj O]
namespace MonObj
instance : IsMonHom (toUnit M) where
instance : IsMonHom η[M] where
mul_hom := by simp [toUnit_unique (ρ_ (𝟙_ C)).hom (λ_ (𝟙_ C)).hom]
theorem lift_lift_assoc {A : C} {B : C} [MonObj B] (f g h : A ⟶ B) :
lift (lift f g ≫ μ) h ≫ μ = lift f (lift g h ≫ μ) ≫ μ := by
have := lift (lift f g) h ≫= mul_assoc B
rwa [lift_whiskerRight_assoc, lift_lift_associator_hom_assoc, lift_whiskerLeft_assoc] at this
@[reassoc (attr := simp)]
theorem lift_comp_one_left {A : C} {B : C} [MonObj B] (f : A ⟶ 𝟙_ C) (g : A ⟶ B) :
lift (f ≫ η) g ≫ μ = g := by
have := lift f g ≫= one_mul B
rwa [lift_whiskerRight_assoc, lift_leftUnitor_hom] at this
@[reassoc (attr := simp)]
theorem lift_comp_one_right {A : C} {B : C} [MonObj B] (f : A ⟶ B) (g : A ⟶ 𝟙_ C) :
lift f (g ≫ η) ≫ μ = f := by
have := lift f g ≫= mul_one B
rwa [lift_whiskerLeft_assoc, lift_rightUnitor_hom] at this
variable [BraidedCategory C]
attribute [local simp] tensorObj.one_def tensorObj.mul_def
instance : IsMonHom (fst M N) where
instance : IsMonHom (snd M N) where
instance {f : M ⟶ N} {g : M ⟶ O} [IsMonHom f] [IsMonHom g] : IsMonHom (lift f g) where
instance [IsCommMonObj M] : IsMonHom μ[M] where
one_hom := by simp [toUnit_unique (ρ_ (𝟙_ C)).hom (λ_ (𝟙_ C)).hom]
end MonObj
namespace Mon
variable [BraidedCategory C]
attribute [local simp] tensorObj.one_def tensorObj.mul_def in
instance : CartesianMonoidalCategory (Mon C) where
isTerminalTensorUnit := .ofUniqueHom (fun M ↦ ⟨toUnit _⟩) fun M f ↦ by ext; exact toUnit_unique ..
fst M N := .mk (fst M.X N.X)
snd M N := .mk (snd M.X N.X)
tensorProductIsBinaryProduct M N :=
BinaryFan.IsLimit.mk _ (fun {T} f g ↦ ⟨lift f.hom g.hom⟩)
(by aesop_cat) (by aesop_cat) (by aesop_cat)
fst_def M N := by ext; simp [fst_def]; congr
snd_def M N := by ext; simp [snd_def]; congr
variable {M N N₁ N₂ : Mon C}
@[simp] lemma lift_hom (f : M ⟶ N₁) (g : M ⟶ N₂) : (lift f g).hom = lift f.hom g.hom := rfl
@[simp] lemma fst_hom (M N : Mon C) : (fst M N).hom = fst M.X N.X := rfl
@[simp] lemma snd_hom (M N : Mon C) : (snd M N).hom = snd M.X N.X := rfl
/-! ### Comm monoid objects are internal monoid objects -/
/-- A commutative monoid object is a monoid object in the category of monoid objects. -/
instance [IsCommMonObj M.X] : MonObj M where
one := .mk η[M.X]
mul := .mk μ[M.X]
@[simp] lemma hom_one (M : Mon C) [IsCommMonObj M.X] : η[M].hom = η[M.X] := rfl
@[simp] lemma hom_mul (M : Mon C) [IsCommMonObj M.X] : μ[M].hom = μ[M.X] := rfl
/-- A commutative monoid object is a commutative monoid object in the category of monoid objects. -/
instance [IsCommMonObj M.X] : IsCommMonObj M where
end Mon
variable (X) in
/-- If `X` represents a presheaf of monoids, then `X` is a monoid object. -/
@[simps]
def MonObj.ofRepresentableBy (F : Cᵒᵖ ⥤ MonCat.{w}) (α : (F ⋙ forget _).RepresentableBy X) :
MonObj X where
one := α.homEquiv.symm 1
mul := α.homEquiv.symm (α.homEquiv (fst X X) * α.homEquiv (snd X X))
one_mul := by
apply α.homEquiv.injective
simp only [α.homEquiv_comp, Equiv.apply_symm_apply]
simp only [Functor.comp_map, ConcreteCategory.forget_map_eq_coe, map_mul]
simp only [← ConcreteCategory.forget_map_eq_coe, ← Functor.comp_map, ← α.homEquiv_comp]
simp only [whiskerRight_fst, whiskerRight_snd]
simp only [α.homEquiv_comp, Equiv.apply_symm_apply]
simp [leftUnitor_hom]
mul_one := by
apply α.homEquiv.injective
simp only [α.homEquiv_comp, Equiv.apply_symm_apply]
simp only [Functor.comp_map, ConcreteCategory.forget_map_eq_coe, map_mul]
simp only [← ConcreteCategory.forget_map_eq_coe, ← Functor.comp_map, ← α.homEquiv_comp]
simp only [whiskerLeft_fst, whiskerLeft_snd]
simp only [α.homEquiv_comp, Equiv.apply_symm_apply]
simp [rightUnitor_hom]
mul_assoc := by
apply α.homEquiv.injective
simp only [α.homEquiv_comp, Equiv.apply_symm_apply]
simp only [Functor.comp_map, ConcreteCategory.forget_map_eq_coe, map_mul]
simp only [← ConcreteCategory.forget_map_eq_coe, ← Functor.comp_map, ← α.homEquiv_comp]
simp only [whiskerRight_fst, whiskerRight_snd, whiskerLeft_fst,
associator_hom_fst, whiskerLeft_snd]
simp only [α.homEquiv_comp, Equiv.apply_symm_apply]
simp only [Functor.comp_map, ConcreteCategory.forget_map_eq_coe, map_mul, _root_.mul_assoc]
simp only [← ConcreteCategory.forget_map_eq_coe, ← Functor.comp_map, ← α.homEquiv_comp]
simp
@[deprecated (since := "2025-09-09")] alias Mon_Class.ofRepresentableBy := MonObj.ofRepresentableBy
@[deprecated (since := "2025-09-09")] alias Mon_ClassOfRepresentableBy := MonObj.ofRepresentableBy
/-- If `M` is a monoid object, then `Hom(X, M)` has a monoid structure. -/
abbrev Hom.monoid : Monoid (X ⟶ M) where
mul f₁ f₂ := lift f₁ f₂ ≫ μ
mul_assoc f₁ f₂ f₃ := by
change lift (lift f₁ f₂ ≫ μ) f₃ ≫ μ = lift f₁ (lift f₂ f₃ ≫ μ) ≫ μ
trans lift (lift f₁ f₂) f₃ ≫ μ ▷ M ≫ μ
· rw [← tensorHom_id, lift_map_assoc, Category.comp_id]
trans lift f₁ (lift f₂ f₃) ≫ M ◁ μ ≫ μ
· rw [MonObj.mul_assoc]
simp_rw [← Category.assoc]
congr 2
ext <;> simp
· rw [← id_tensorHom, lift_map_assoc, Category.comp_id]
one := toUnit X ≫ η
one_mul f := by
change lift (toUnit _ ≫ η) f ≫ μ = f
rw [← Category.comp_id f, ← lift_map_assoc, tensorHom_id, MonObj.one_mul,
Category.comp_id, leftUnitor_hom]
exact lift_snd _ _
mul_one f := by
change lift f (toUnit _ ≫ η) ≫ μ = f
rw [← Category.comp_id f, ← lift_map_assoc, id_tensorHom, MonObj.mul_one,
Category.comp_id, rightUnitor_hom]
exact lift_fst _ _
scoped[CategoryTheory.MonObj] attribute [instance] Hom.monoid
lemma Hom.one_def : (1 : X ⟶ M) = toUnit X ≫ η := rfl
lemma Hom.mul_def (f₁ f₂ : X ⟶ M) : f₁ * f₂ = lift f₁ f₂ ≫ μ := rfl
namespace Functor
variable (F : C ⥤ D) [F.Monoidal]
open scoped Obj
protected lemma map_mul (f g : X ⟶ M) : F.map (f * g) = F.map f * F.map g := by
simp only [Hom.mul_def, map_comp, obj.μ_def, ← Category.assoc]
congr 1
rw [← IsIso.comp_inv_eq]
ext <;> simp
@[simp] protected lemma map_one : F.map (1 : X ⟶ M) = 1 := by simp [Hom.one_def]
/-- `Functor.map` of a monoidal functor as a `MonoidHom`. -/
@[simps]
def homMonoidHom : (X ⟶ M) →* (F.obj X ⟶ F.obj M) where
toFun := F.map
map_one' := F.map_one
map_mul' := F.map_mul
/-- `Functor.map` of a fully faithful monoidal functor as a `MulEquiv`. -/
@[simps!]
def FullyFaithful.homMulEquiv (hF : F.FullyFaithful) : (X ⟶ M) ≃* (F.obj X ⟶ F.obj M) where
__ := hF.homEquiv
__ := F.homMonoidHom
end Functor
section BraidedCategory
variable [BraidedCategory C]
/-- If `M` is a commutative monoid object, then `Hom(X, M)` has a commutative monoid structure. -/
abbrev Hom.commMonoid [IsCommMonObj M] : CommMonoid (X ⟶ M) where
mul_comm f g := by simpa [-IsCommMonObj.mul_comm] using lift g f ≫= IsCommMonObj.mul_comm M
namespace Mon.Hom
variable {M N : Mon C} [IsCommMonObj N.X]
@[simp] lemma hom_one : (1 : M ⟶ N).hom = 1 := rfl
@[simp] lemma hom_mul (f g : M ⟶ N) : (f * g).hom = f.hom * g.hom := rfl
@[simp] lemma hom_pow (f : M ⟶ N) (n : ℕ) : (f ^ n).hom = f.hom ^ n := by
induction n <;> simp [pow_succ, *]
end Mon.Hom
scoped[CategoryTheory.MonObj] attribute [instance] Hom.commMonoid
end BraidedCategory
variable (M) in
/-- If `M` is a monoid object, then `Hom(-, M)` is a presheaf of monoids. -/
@[simps]
def yonedaMonObj : Cᵒᵖ ⥤ MonCat.{v} where
obj X := MonCat.of (unop X ⟶ M)
map {X Y₂} φ := MonCat.ofHom
{ toFun := (φ.unop ≫ ·)
map_one' := by
change φ.unop ≫ toUnit _ ≫ η = toUnit _ ≫ η
rw [← Category.assoc, toUnit_unique (φ.unop ≫ toUnit _)]
map_mul' f₁ f₂ := by
change φ.unop ≫ lift f₁ f₂ ≫ μ = lift (φ.unop ≫ f₁) (φ.unop ≫ f₂) ≫ μ
rw [← Category.assoc]
cat_disch }
map_id _ := MonCat.hom_ext (MonoidHom.ext Category.id_comp)
map_comp _ _ := MonCat.hom_ext (MonoidHom.ext (Category.assoc _ _))
variable (X) in
/-- If `X` represents a presheaf of monoids `F`, then `Hom(-, X)` is isomorphic to `F` as
a presheaf of monoids. -/
@[simps!]
def yonedaMonObjIsoOfRepresentableBy
(F : Cᵒᵖ ⥤ MonCat.{v}) (α : (F ⋙ forget _).RepresentableBy X) :
letI := MonObj.ofRepresentableBy X F α
yonedaMonObj X ≅ F :=
letI := MonObj.ofRepresentableBy X F α
NatIso.ofComponents (fun Y ↦ MulEquiv.toMonCatIso
{ toEquiv := α.homEquiv
map_mul' f₁ f₂ := by
change α.homEquiv (lift f₁ f₂ ≫ α.homEquiv.symm (α.homEquiv (fst X X) *
α.homEquiv (snd X X))) = α.homEquiv f₁ * α.homEquiv f₂
simp only [α.homEquiv_comp, Equiv.apply_symm_apply,
Functor.comp_map, ConcreteCategory.forget_map_eq_coe, map_mul]
simp only [← Functor.comp_map, ← ConcreteCategory.forget_map_eq_coe, ← α.homEquiv_comp]
simp }) (fun φ ↦ MonCat.hom_ext (MonoidHom.ext (α.homEquiv_comp φ.unop)))
/-- The yoneda embedding of `Mon_C` into presheaves of monoids. -/
@[simps]
def yonedaMon : Mon C ⥤ Cᵒᵖ ⥤ MonCat.{v} where
obj M := yonedaMonObj M.X
map {M N} ψ :=
{ app Y := MonCat.ofHom
{ toFun := (· ≫ ψ.hom)
map_one' := by simp [Hom.one_def, Hom.one_def]
map_mul' φ₁ φ₂ := by simp [Hom.mul_def] }
naturality {M N} φ := MonCat.hom_ext <| MonoidHom.ext fun f ↦ Category.assoc φ.unop f ψ.hom }
map_id M := NatTrans.ext <| funext fun _ ↦ MonCat.hom_ext <| MonoidHom.ext Category.comp_id
map_comp _ _ :=
NatTrans.ext <| funext fun _ ↦ MonCat.hom_ext <| MonoidHom.ext (.symm <| Category.assoc · _ _)
@[reassoc]
lemma yonedaMon_naturality (α : yonedaMonObj M ⟶ yonedaMonObj N) (f : X ⟶ Y) (g : Y ⟶ M) :
α.app _ (f ≫ g) = f ≫ α.app _ g := congr($(α.naturality f.op) g)
variable (M) in
/-- If `M` is a monoid object, then `Hom(-, M)` as a presheaf of monoids is represented by `M`. -/
def yonedaMonObjRepresentableBy : (yonedaMonObj M ⋙ forget _).RepresentableBy M :=
Functor.representableByEquiv.symm (.refl _)
variable (M) in
lemma MonObj.ofRepresentableBy_yonedaMonObjRepresentableBy :
ofRepresentableBy M _ (yonedaMonObjRepresentableBy M) = ‹_› := by
ext; change lift (fst M M) (snd M M) ≫ μ = μ; rw [lift_fst_snd, Category.id_comp]
@[deprecated (since := "2025-09-09")]
alias Mon_Class.ofRepresentableBy_yonedaMonObjRepresentableBy :=
MonObj.ofRepresentableBy_yonedaMonObjRepresentableBy
@[deprecated (since := "2025-09-09")]
alias Mon_ClassOfRepresentableBy_yonedaMonObjRepresentableBy :=
MonObj.ofRepresentableBy_yonedaMonObjRepresentableBy
/-- The yoneda embedding for `Mon_C` is fully faithful. -/
def yonedaMonFullyFaithful : yonedaMon (C := C).FullyFaithful where
preimage {M N} α :=
{ hom := α.app (op M.X) (𝟙 M.X)
isMonHom_hom.one_hom := by
dsimp only [yonedaMon_obj] at α ⊢
rw [← yonedaMon_naturality, Category.comp_id,
← Category.id_comp η[M.X], toUnit_unique (𝟙 _) (toUnit _),
← Category.id_comp η[N.X], toUnit_unique (𝟙 _) (toUnit _)]
exact (α.app _).hom.map_one
isMonHom_hom.mul_hom := by
dsimp only [yonedaMon_obj] at α ⊢
rw [← yonedaMon_naturality, Category.comp_id, ← Category.id_comp μ[M.X], ← lift_fst_snd]
refine ((α.app _).hom.map_mul _ _).trans ?_
change lift _ _ ≫ μ[N.X] = _
congr 1
ext <;> simp only [lift_fst, tensorHom_fst, lift_snd, tensorHom_snd,
← yonedaMon_naturality, Category.comp_id] }
map_preimage {M N} α := by
ext Y f
dsimp only [yonedaMon_obj, yonedaMon_map_app, MonCat.hom_ofHom]
simp_rw [← yonedaMon_naturality]
simp
preimage_map φ := Mon.Hom.ext (Category.id_comp φ.hom)
instance : yonedaMon (C := C).Full := yonedaMonFullyFaithful.full
instance : yonedaMon (C := C).Faithful := yonedaMonFullyFaithful.faithful
lemma essImage_yonedaMon :
yonedaMon (C := C).essImage = (· ⋙ forget _) ⁻¹' setOf Functor.IsRepresentable := by
ext F
constructor
· rintro ⟨M, ⟨α⟩⟩
exact ⟨M.X, ⟨Functor.representableByEquiv.symm (Functor.isoWhiskerRight α (forget _))⟩⟩
· rintro ⟨X, ⟨e⟩⟩
letI := MonObj.ofRepresentableBy X F e
exact ⟨Mon.mk X, ⟨yonedaMonObjIsoOfRepresentableBy X F e⟩⟩
@[reassoc (attr := simp)]
lemma MonObj.one_comp (f : M ⟶ N) [IsMonHom f] : (1 : X ⟶ M) ≫ f = 1 := by simp [Hom.one_def]
@[deprecated (since := "2025-09-09")] alias Mon_Class.one_comp := MonObj.one_comp
@[reassoc]
lemma MonObj.mul_comp (f₁ f₂ : X ⟶ M) (g : M ⟶ N) [IsMonHom g] :
(f₁ * f₂) ≫ g = f₁ ≫ g * f₂ ≫ g := by simp [Hom.mul_def]
@[deprecated (since := "2025-09-09")] alias Mon_Class.mul_comp := MonObj.mul_comp
@[reassoc]
lemma MonObj.pow_comp (f : X ⟶ M) (n : ℕ) (g : M ⟶ N) [IsMonHom g] :
(f ^ n) ≫ g = (f ≫ g) ^ n := by
induction n <;> simp [pow_succ, MonObj.mul_comp, *]
@[deprecated (since := "2025-09-09")] alias Mon_Class.pow_comp := MonObj.pow_comp
@[reassoc (attr := simp)]
lemma MonObj.comp_one (f : X ⟶ Y) : f ≫ (1 : Y ⟶ M) = 1 :=
((yonedaMon.obj <| .mk M).map f.op).hom.map_one
@[deprecated (since := "2025-09-09")] alias Mon_Class.comp_one := MonObj.comp_one
@[reassoc]
lemma MonObj.comp_mul (f : X ⟶ Y) (g₁ g₂ : Y ⟶ M) : f ≫ (g₁ * g₂) = f ≫ g₁ * f ≫ g₂ :=
((yonedaMon.obj <| .mk M).map f.op).hom.map_mul _ _
@[deprecated (since := "2025-09-09")] alias Mon_Class.comp_mul := MonObj.comp_mul
@[reassoc]
lemma MonObj.comp_pow (f : X ⟶ M) (n : ℕ) (h : Y ⟶ X) : h ≫ f ^ n = (h ≫ f) ^ n := by
induction n <;> simp [pow_succ, MonObj.comp_mul, *]
@[deprecated (since := "2025-09-09")] alias Mon_Class.comp_pow := MonObj.comp_pow
variable (M) in
lemma MonObj.one_eq_one : η = (1 : _ ⟶ M) :=
show _ = _ ≫ _ by rw [toUnit_unique (toUnit _) (𝟙 _), Category.id_comp]
@[deprecated (since := "2025-09-09")] alias Mon_Class.one_eq_one := MonObj.one_eq_one
variable (M) in
lemma MonObj.mul_eq_mul : μ = fst M M * snd _ _ :=
show _ = _ ≫ _ by rw [lift_fst_snd, Category.id_comp]
@[deprecated (since := "2025-09-09")] alias Mon_Class.mul_eq_mul := MonObj.mul_eq_mul
namespace Hom
/-- If `M` and `N` are isomorphic as monoid objects, then `X ⟶ M` and `X ⟶ N` are isomorphic
monoids. -/
@[simps!]
def mulEquivCongrRight (e : M ≅ N) [IsMonHom e.hom] (X : C) : (X ⟶ M) ≃* (X ⟶ N) :=
((yonedaMon.mapIso <| Mon.mkIso' e).app <| .op X).monCatIsoToMulEquiv
end Hom
end CategoryTheory |
.lake/packages/mathlib/Mathlib/CategoryTheory/Monoidal/Cartesian/FunctorCategory.lean | import Mathlib.CategoryTheory.Limits.FunctorCategory.Basic
import Mathlib.CategoryTheory.Monoidal.Cartesian.Basic
import Mathlib.CategoryTheory.Monoidal.Types.Basic
/-!
# Functor categories have chosen finite products
If `C` is a category with chosen finite products, then so is `J ⥤ C`.
-/
namespace CategoryTheory
open Limits MonoidalCategory Category CartesianMonoidalCategory
universe v
variable {J C D E : Type*} [Category J] [Category C] [Category D] [Category E]
[CartesianMonoidalCategory C] [CartesianMonoidalCategory E]
namespace Functor
variable (J C) in
/-- The chosen terminal object in `J ⥤ C`. -/
abbrev chosenTerminal : J ⥤ C := (Functor.const J).obj (𝟙_ C)
variable (J C) in
/-- The chosen terminal object in `J ⥤ C` is terminal. -/
def chosenTerminalIsTerminal : IsTerminal (chosenTerminal J C) :=
evaluationJointlyReflectsLimits _
fun _ ↦ isLimitChangeEmptyCone _ isTerminalTensorUnit _ (.refl _)
section
variable (F₁ F₂ : J ⥤ C)
/-- The chosen binary product on `J ⥤ C`. -/
@[simps]
def chosenProd : J ⥤ C where
obj j := F₁.obj j ⊗ F₂.obj j
map φ := F₁.map φ ⊗ₘ F₂.map φ
namespace chosenProd
/-- The first projection `chosenProd F₁ F₂ ⟶ F₁`. -/
def fst : chosenProd F₁ F₂ ⟶ F₁ where
app _ := CartesianMonoidalCategory.fst _ _
/-- The second projection `chosenProd F₁ F₂ ⟶ F₂`. -/
def snd : chosenProd F₁ F₂ ⟶ F₂ where
app _ := CartesianMonoidalCategory.snd _ _
/-- `Functor.chosenProd F₁ F₂` is a binary product of `F₁` and `F₂`. -/
def isLimit : IsLimit (BinaryFan.mk (fst F₁ F₂) (snd F₁ F₂)) :=
evaluationJointlyReflectsLimits _ (fun j =>
(IsLimit.postcomposeHomEquiv (mapPairIso (by exact Iso.refl _) (by exact Iso.refl _)) _).1
(IsLimit.ofIsoLimit
(tensorProductIsBinaryProduct (X := F₁.obj j) (Y := F₂.obj j))
(Cones.ext (Iso.refl _) (by rintro ⟨_ | _⟩; all_goals cat_disch))))
end chosenProd
end
instance cartesianMonoidalCategory : CartesianMonoidalCategory (J ⥤ C) :=
.ofChosenFiniteProducts ⟨_, chosenTerminalIsTerminal J C⟩
fun F₁ F₂ ↦ ⟨_, chosenProd.isLimit F₁ F₂⟩
namespace Monoidal
open CartesianMonoidalCategory
@[simp]
lemma tensorObj_obj (F₁ F₂ : J ⥤ C) (j : J) : (F₁ ⊗ F₂).obj j = (F₁.obj j) ⊗ (F₂.obj j) := rfl
@[simp]
lemma tensorObj_map (F₁ F₂ : J ⥤ C) {j j' : J} (f : j ⟶ j') :
(F₁ ⊗ F₂).map f = (F₁.map f) ⊗ₘ (F₂.map f) := rfl
@[simp]
lemma fst_app (F₁ F₂ : J ⥤ C) (j : J) : (fst F₁ F₂).app j = fst (F₁.obj j) (F₂.obj j) := rfl
@[simp]
lemma snd_app (F₁ F₂ : J ⥤ C) (j : J) : (snd F₁ F₂).app j = snd (F₁.obj j) (F₂.obj j) := rfl
@[simp]
lemma leftUnitor_hom_app (F : J ⥤ C) (j : J) :
(λ_ F).hom.app j = (λ_ (F.obj j)).hom := (leftUnitor_hom _).symm
@[simp]
lemma leftUnitor_inv_app (F : J ⥤ C) (j : J) :
(λ_ F).inv.app j = (λ_ (F.obj j)).inv := by
rw [← cancel_mono ((λ_ (F.obj j)).hom), Iso.inv_hom_id, ← leftUnitor_hom_app,
Iso.inv_hom_id_app]
@[simp]
lemma rightUnitor_hom_app (F : J ⥤ C) (j : J) :
(ρ_ F).hom.app j = (ρ_ (F.obj j)).hom := (rightUnitor_hom _).symm
@[simp]
lemma rightUnitor_inv_app (F : J ⥤ C) (j : J) :
(ρ_ F).inv.app j = (ρ_ (F.obj j)).inv := by
rw [← cancel_mono ((ρ_ (F.obj j)).hom), Iso.inv_hom_id, ← rightUnitor_hom_app,
Iso.inv_hom_id_app]
@[reassoc (attr := simp)]
lemma tensorHom_app_fst {F₁ F₁' F₂ F₂' : J ⥤ C} (f : F₁ ⟶ F₁') (g : F₂ ⟶ F₂') (j : J) :
(f ⊗ₘ g).app j ≫ fst _ _ = fst _ _ ≫ f.app j := by
change (f ⊗ₘ g).app j ≫ (fst F₁' F₂').app j = _
rw [← NatTrans.comp_app, tensorHom_fst, NatTrans.comp_app]
rfl
@[reassoc (attr := simp)]
lemma tensorHom_app_snd {F₁ F₁' F₂ F₂' : J ⥤ C} (f : F₁ ⟶ F₁') (g : F₂ ⟶ F₂') (j : J) :
(f ⊗ₘ g).app j ≫ snd _ _ = snd _ _ ≫ g.app j := by
change (f ⊗ₘ g).app j ≫ (snd F₁' F₂').app j = _
rw [← NatTrans.comp_app, tensorHom_snd, NatTrans.comp_app]
rfl
@[reassoc (attr := simp)]
lemma whiskerLeft_app_fst (F₁ : J ⥤ C) {F₂ F₂' : J ⥤ C} (g : F₂ ⟶ F₂') (j : J) :
(F₁ ◁ g).app j ≫ fst _ _ = fst _ _ :=
(tensorHom_app_fst (𝟙 F₁) g j).trans (by simp)
@[reassoc (attr := simp)]
lemma whiskerLeft_app_snd (F₁ : J ⥤ C) {F₂ F₂' : J ⥤ C} (g : F₂ ⟶ F₂') (j : J) :
(F₁ ◁ g).app j ≫ snd _ _ = snd _ _ ≫ g.app j :=
(tensorHom_app_snd (𝟙 F₁) g j)
@[reassoc (attr := simp)]
lemma whiskerRight_app_fst {F₁ F₁' : J ⥤ C} (f : F₁ ⟶ F₁') (F₂ : J ⥤ C) (j : J) :
(f ▷ F₂).app j ≫ fst _ _ = fst _ _ ≫ f.app j :=
(tensorHom_app_fst f (𝟙 F₂) j)
@[reassoc (attr := simp)]
lemma whiskerRight_app_snd {F₁ F₁' : J ⥤ C} (f : F₁ ⟶ F₁') (F₂ : J ⥤ C) (j : J) :
(f ▷ F₂).app j ≫ snd _ _ = snd _ _ :=
(tensorHom_app_snd f (𝟙 F₂) j).trans (by simp)
@[simp]
lemma associator_hom_app (F₁ F₂ F₃ : J ⥤ C) (j : J) :
(α_ F₁ F₂ F₃).hom.app j = (α_ _ _ _).hom := by
apply hom_ext
· rw [← fst_app, ← NatTrans.comp_app, associator_hom_fst]
simp
· apply hom_ext
· rw [← snd_app, ← NatTrans.comp_app, ← fst_app, ← NatTrans.comp_app, Category.assoc,
associator_hom_snd_fst]
simp
· rw [← snd_app, ← NatTrans.comp_app, ← snd_app, ← NatTrans.comp_app, Category.assoc,
associator_hom_snd_snd]
simp
@[simp]
lemma associator_inv_app (F₁ F₂ F₃ : J ⥤ C) (j : J) :
(α_ F₁ F₂ F₃).inv.app j = (α_ _ _ _).inv := by
rw [← cancel_mono ((α_ _ _ _).hom), Iso.inv_hom_id, ← associator_hom_app, Iso.inv_hom_id_app]
instance {K : Type*} [Category K] [HasColimitsOfShape K C]
[∀ X : C, PreservesColimitsOfShape K (tensorLeft X)] {F : J ⥤ C} :
PreservesColimitsOfShape K (tensorLeft F) := by
apply preservesColimitsOfShape_of_evaluation
intro k
haveI : tensorLeft F ⋙ (evaluation J C).obj k ≅ (evaluation J C).obj k ⋙ tensorLeft (F.obj k) :=
NatIso.ofComponents (fun _ ↦ Iso.refl _)
exact preservesColimitsOfShape_of_natIso this.symm
/-- A finite-products-preserving functor distributes over the tensor product of functors. -/
@[simps!]
noncomputable def tensorObjComp (F G : D ⥤ C) (H : C ⥤ E) [PreservesFiniteProducts H] :
(F ⊗ G) ⋙ H ≅ (F ⋙ H) ⊗ (G ⋙ H) :=
NatIso.ofComponents (fun X ↦ prodComparisonIso H (F.obj X) (G.obj X)) fun {X Y} f ↦ by
dsimp; ext <;> simp [← Functor.map_comp]
/-- A tensor product of representable functors is representable. -/
@[simps]
protected def RepresentableBy.tensorObj {F : Cᵒᵖ ⥤ Type v} {G : Cᵒᵖ ⥤ Type v} {X Y : C}
(h₁ : F.RepresentableBy X) (h₂ : G.RepresentableBy Y) : (F ⊗ G).RepresentableBy (X ⊗ Y) where
homEquiv {I} := homEquivToProd.trans (h₁.homEquiv.prodCongr h₂.homEquiv)
homEquiv_comp {I W} f g := by
refine Prod.ext ?_ ?_
· change h₁.homEquiv ((f ≫ g) ≫ fst X Y) = F.map f.op (h₁.homEquiv (g ≫ fst X Y))
simp [h₁.homEquiv_comp]
· change h₂.homEquiv ((f ≫ g) ≫ snd X Y) = G.map f.op (h₂.homEquiv (g ≫ snd X Y))
simp [h₂.homEquiv_comp]
end Monoidal
end Functor
end CategoryTheory |
.lake/packages/mathlib/Mathlib/CategoryTheory/Monoidal/DayConvolution/DayFunctor.lean | import Mathlib.CategoryTheory.Monoidal.DayConvolution
/-!
# Day functors
In this file, given a monoidal category `C` and a monoidal category `V`,
we define a basic type synonym `DayFunctor C V` (denoted `C ⊛⥤ D`)
for the category `C ⥤ V` and endow it with the monoidal structure coming
from Day convolution. Such a setup is necessary as by default,
the `MonoidalCategory` instance on `C ⥤ V` is the "pointwise" one,
where the tensor product of `F` and `G` is the functor `x ↦ F.obj x ⊗ G.obj x`.
## TODOs
- Given a `LawfulDayConvolutionMonoidalCategoryStruct C V D`, show that
ι induce a monoidal functor `D ⥤ (C ⊛⥤ V)`.
- Specialize to the case `V := Type _`, and prove a universal property stating
that for every monoidal category `W` with suitable colimits,
colimit-preserving monoidal functors `(Cᵒᵖ ⊛⥤ Type u) ⥤ W` are equivalent to
to monoidal functors `C ⥤ W`. Show that the Yoneda embedding is monoidal.
-/
universe v₁ v₂ v₃ u₁ u₂ u₃
namespace CategoryTheory.MonoidalCategory
open scoped ExternalProduct
noncomputable section
/-- `DayFunctor C V` is a type synonym for `C ⥤ V`, implemented as a one-field
structure. -/
structure DayFunctor
(C : Type u₁) [Category.{v₁} C] (V : Type u₂) [Category.{v₂} V]
[MonoidalCategory C] [MonoidalCategory V] where
/-- the underlying functor. -/
functor : C ⥤ V
namespace DayFunctor
/-- Notation for `DayFunctor`. -/
scoped infixr:26 " ⊛⥤ " => DayFunctor
variable {C : Type u₁} [Category.{v₁} C] {V : Type u₂} [Category.{v₂} V]
[MonoidalCategory C] [MonoidalCategory V]
lemma mk_functor (F : C ⥤ V) : (mk F).functor = F := rfl
@[simp]
lemma functor_mk (F : C ⊛⥤ V) : mk F.functor = F := rfl
/-- Morphisms of Day functors are natural transformations of the underlying
functors. -/
structure Hom (F G : C ⊛⥤ V) where
/-- the underlying natural transformation -/
natTrans : F.functor ⟶ G.functor
@[simps id_natTrans comp_natTrans]
instance : Category (C ⊛⥤ V) where
Hom := Hom
id x := .mk <| 𝟙 x.functor
comp α β := .mk <| α.natTrans ≫ β.natTrans
@[ext]
lemma hom_ext {F G : C ⊛⥤ V} {α β : F ⟶ G} (h : α.natTrans = β.natTrans) :
α = β := by
cases α
cases β
grind
variable (C V) in
/-- The tautological equivalence of categories between `C ⥤ V` and `C ⊛⥤ V`. -/
@[simps! functor_obj functor_map inverse_obj_functor inverse_map_natTrans
unitIso_hom_app unitIso_inv_app counitIso_hom_app counitIso_inv_app]
def equiv : (C ⊛⥤ V) ≌ (C ⥤ V) where
functor :=
{ obj F := F.functor
map α := α.natTrans }
inverse :=
{ obj F := .mk F
map α := .mk α }
unitIso := .refl _
counitIso := .refl _
variable
[hasDayConvolution : ∀ (F G : C ⥤ V),
(tensor C).HasPointwiseLeftKanExtension (F ⊠ G)]
[hasDayConvolutionUnit :
(Functor.fromPUnit.{0} <| 𝟙_ C).HasPointwiseLeftKanExtension
(Functor.fromPUnit.{0} <| 𝟙_ V)]
[∀ (v : V) (d : C), Limits.PreservesColimitsOfShape
(CostructuredArrow (tensor C) d) (tensorLeft v)]
[∀ (v : V) (d : C), Limits.PreservesColimitsOfShape
(CostructuredArrow (tensor C) d) (tensorRight v)]
[∀ (v : V) (d : C), Limits.PreservesColimitsOfShape
(CostructuredArrow (Functor.fromPUnit.{0} <| 𝟙_ C) d) (tensorLeft v)]
[∀ (v : V) (d : C), Limits.PreservesColimitsOfShape
(CostructuredArrow (Functor.fromPUnit.{0} <| 𝟙_ C) d) (tensorRight v)]
[∀ (v : V) (d : C × C),
Limits.PreservesColimitsOfShape
(CostructuredArrow ((𝟭 C).prod <| Functor.fromPUnit.{0} <| 𝟙_ C) d)
(tensorRight v)]
[∀ (v : V) (d : C × C),
Limits.PreservesColimitsOfShape
(CostructuredArrow ((tensor C).prod (𝟭 C)) d) (tensorRight v)]
instance : MonoidalCategory (C ⊛⥤ V) :=
monoidalOfHasDayConvolutions
(equiv C V).functor
(equiv C V).fullyFaithfulFunctor
(fun _ _ => ⟨_, ⟨equiv C V|>.counitIso.app _⟩⟩)
⟨_, ⟨equiv C V|>.counitIso.app _⟩⟩
@[simps! ι_obj ι_map]
instance : LawfulDayConvolutionMonoidalCategoryStruct C V (C ⊛⥤ V) :=
lawfulDayConvolutionMonoidalCategoryStructOfHasDayConvolutions
(equiv C V).functor
(equiv C V).fullyFaithfulFunctor
(fun _ _ => ⟨_, ⟨equiv C V|>.counitIso.app _⟩⟩)
⟨_, ⟨equiv C V|>.counitIso.app _⟩⟩
/-- The unit transformation exhibiting `(F ⊗ G).functor` as a left Kan extension of
`F.functor ⊠ G.functor` along `tensor C`. -/
def η (F G : C ⊛⥤ V) :
F.functor ⊠ G.functor ⟶ tensor C ⋙ (F ⊗ G).functor :=
LawfulDayConvolutionMonoidalCategoryStruct.convolutionExtensionUnit
C V F G
open LawfulDayConvolutionMonoidalCategoryStruct in
instance (F G : C ⊛⥤ V) : (F ⊗ G).functor.IsLeftKanExtension (η F G) :=
(isPointwiseLeftKanExtensionConvolutionExtensionUnit F G).isLeftKanExtension
open LawfulDayConvolutionMonoidalCategoryStruct in
theorem tensor_hom_ext {F G H : C ⊛⥤ V} {α β : F ⊗ G ⟶ H}
(h : ∀ (x y : C),
(η F G).app (x, y) ≫ α.natTrans.app (x ⊗ y) =
(η F G).app (x, y) ≫ β.natTrans.app (x ⊗ y)) :
α = β := by
ext : 1
apply Functor.hom_ext_of_isLeftKanExtension
(F ⊗ G).functor (η F G) _
ext ⟨x, y⟩
exact h x y
/-- A natural transformation `F.functor ⊠ G.functor ⟶ tensor C ⋙ H.functor`
defines a morphism `F ⨂ G ⟶ H`. -/
def tensorDesc {F G H : C ⊛⥤ V}
(α : F.functor ⊠ G.functor ⟶ tensor C ⋙ H.functor) :
F ⊗ G ⟶ H :=
.mk <| (F ⊗ G).functor.descOfIsLeftKanExtension (η F G) H.functor α
lemma η_comp_tensorDec {F G H : C ⊛⥤ V}
(α : F.functor ⊠ G.functor ⟶ tensor C ⋙ H.functor) :
η F G ≫ Functor.whiskerLeft _ (tensorDesc α).natTrans = α :=
Functor.descOfIsLeftKanExtension_fac _ _ _ _
@[reassoc (attr := simp)]
lemma η_comp_tensorDesc_app {F G H : C ⊛⥤ V}
(α : F.functor ⊠ G.functor ⟶ tensor C ⋙ H.functor) (x y : C) :
(η F G).app (x , y) ≫ (tensorDesc α).natTrans.app (x ⊗ y) = α.app (x, y) :=
Functor.descOfIsLeftKanExtension_fac_app _ _ _ _ _
open LawfulDayConvolutionMonoidalCategoryStruct
/-- An abstract isomorphism between `(F ⊗ G).functor` and the generic pointwise
left Kan extension of `F.functor ⊠ G.functor` along the -/
def isoPointwiseLeftKanExtension (F G : C ⊛⥤ V) :
(F ⊗ G).functor ≅
(tensor C).pointwiseLeftKanExtension (F.functor ⊠ G.functor) :=
Functor.leftKanExtensionUnique
(F ⊗ G).functor (η F G) _
((tensor C).pointwiseLeftKanExtensionUnit (F.functor ⊠ G.functor))
@[simp]
lemma η_comp_isoPointwiseLeftKanExtension_hom (F G : C ⊛⥤ V) (x y : C) :
(η F G).app (x, y) ≫ (isoPointwiseLeftKanExtension F G).hom.app (x ⊗ y) =
Limits.colimit.ι
(CostructuredArrow.proj (tensor C) (x ⊗ y) ⋙ F.functor ⊠ G.functor)
(.mk (Y := (x, y)) <| 𝟙 (x ⊗ y)) := by
simpa [η, isoPointwiseLeftKanExtension] using
Functor.descOfIsLeftKanExtension_fac_app
(F ⊗ G).functor (η F G) _
((tensor C).pointwiseLeftKanExtensionUnit (F.functor ⊠ G.functor)) (x, y)
@[simp]
lemma ι_comp_isoPointwiseLeftKanExtension_inv (F G : C ⊛⥤ V) (x y : C) :
Limits.colimit.ι
(CostructuredArrow.proj (tensor C) (x ⊗ y) ⋙ F.functor ⊠ G.functor)
(.mk (Y := (x, y)) <| 𝟙 (x ⊗ y)) ≫
(isoPointwiseLeftKanExtension F G).inv.app (x ⊗ y) =
(η F G).app (x, y) := by
simp [η, isoPointwiseLeftKanExtension]
variable (C V) in
/-- The canonical map `𝟙_ V ⟶ (𝟙_ (C ⊛⥤ V)).functor.obj (𝟙_ C)`
that exhibits `(𝟙_ (C ⊛⥤ V)).functor` as a Day convolution unit. -/
def ν : 𝟙_ V ⟶ (𝟙_ (C ⊛⥤ V)).functor.obj (𝟙_ C) :=
LawfulDayConvolutionMonoidalCategoryStruct.unitUnit C V (C ⊛⥤ V)
variable (C V) in
/-- The reinterpretation of `ν` as a natural transformation. -/
@[simps]
def νNatTrans :
Functor.fromPUnit.{0} (𝟙_ V) ⟶
Functor.fromPUnit.{0} (𝟙_ C) ⋙ (𝟙_ (C ⊛⥤ V)).functor where
app _ := ν C V
open LawfulDayConvolutionMonoidalCategoryStruct in
instance : (𝟙_ (C ⊛⥤ V)).functor.IsLeftKanExtension (νNatTrans C V) :=
isPointwiseLeftKanExtensionUnitUnit C V (C ⊛⥤ V)|>.isLeftKanExtension
lemma unit_hom_ext {F : C ⊛⥤ V} {α β : 𝟙_ (C ⊛⥤ V) ⟶ F}
(h : ν C V ≫ α.natTrans.app (𝟙_ C) = ν C V ≫ β.natTrans.app (𝟙_ C)) :
α = β := by
ext1
apply Functor.hom_ext_of_isLeftKanExtension
(𝟙_ (C ⊛⥤ V)).functor (νNatTrans C V)
ext
exact h
/-- Given `F : C ⊛⥤ V`, a morphism `𝟙_ V ⟶ F.functor.obj (𝟙_ C)` induces a
(unique) morphism `𝟙_ (C ⊛⥤ V) ⟶ F`. -/
def unitDesc {F : C ⊛⥤ V} (φ : 𝟙_ V ⟶ F.functor.obj (𝟙_ C)) :
𝟙_ (C ⊛⥤ V) ⟶ F :=
.mk <| Functor.descOfIsLeftKanExtension (𝟙_ (C ⊛⥤ V)).functor (νNatTrans C V)
F.functor { app _ := φ }
@[reassoc (attr := simp)]
lemma ν_comp_unitDesc {F : C ⊛⥤ V} (φ : 𝟙_ V ⟶ F.functor.obj (𝟙_ C)) :
ν C V ≫ (unitDesc φ).natTrans.app (𝟙_ C) = φ :=
Functor.descOfIsLeftKanExtension_fac_app (𝟙_ (C ⊛⥤ V)).functor (νNatTrans C V)
F.functor { app _ := φ } default
end DayFunctor
end
end CategoryTheory.MonoidalCategory |
.lake/packages/mathlib/Mathlib/CategoryTheory/Monoidal/DayConvolution/Braided.lean | import Mathlib.CategoryTheory.Monoidal.DayConvolution
/-!
# Braidings for Day convolution
In this file, we show that if `C` is a braided monoidal category and
`V` also a braided monoidal category, then the Day convolution monoidal structure
on `C ⥤ V` is also braided monoidal. We prove it by constructing an explicit
braiding isomorphism whenever sufficient Day convolutions exist, and we
prove that it satisfies the forward and reverse hexagon identities.
Furthermore, we show that when both `C` and `V` are symmetric monoidal
categories, then the Day convolution monoidal structure is symmetric as well.
-/
universe v₁ v₂ v₃ v₄ v₅ u₁ u₂ u₃ u₄ u₅
namespace CategoryTheory.MonoidalCategory.DayConvolution
open scoped ExternalProduct
open Opposite
noncomputable section
variable {C : Type u₁} [Category.{v₁} C] {V : Type u₂} [Category.{v₂} V]
[MonoidalCategory C] [BraidedCategory C]
[MonoidalCategory V] [BraidedCategory V]
(F G : C ⥤ V)
section
variable [DayConvolution F G] [DayConvolution G F]
/-- The natural transformation `F ⊠ G ⟶ (tensor C) ⋙ (G ⊛ F)` that corepresents
the braiding morphism `F ⊛ G ⟶ G ⊛ F`. -/
@[simps]
def braidingHomCorepresenting : F ⊠ G ⟶ tensor C ⋙ G ⊛ F where
app _ := (β_ _ _).hom ≫ (unit G F).app (_, _) ≫ (G ⊛ F).map (β_ _ _).hom
naturality {x y} f := by simp [tensorHom_def, ← Functor.map_comp]
/-- The natural transformation `F ⊠ G ⟶ (tensor C) ⋙ (G ⊛ F)` that corepresents
the braiding morphism `F ⊛ G ⟶ G ⊛ F`. -/
@[simps]
def braidingInvCorepresenting : G ⊠ F ⟶ tensor C ⋙ F ⊛ G where
app _ := (β_ _ _).inv ≫ (unit F G).app (_, _) ≫ (F ⊛ G).map (β_ _ _).inv
naturality {x y} f := by simp [tensorHom_def, ← Functor.map_comp]
/-- The braiding isomorphism for Day convolution. -/
def braiding : F ⊛ G ≅ G ⊛ F where
hom := corepresentableBy F G|>.homEquiv.symm <| braidingHomCorepresenting F G
inv := corepresentableBy G F|>.homEquiv.symm <| braidingInvCorepresenting F G
hom_inv_id := by
apply Functor.hom_ext_of_isLeftKanExtension (F ⊛ G) (unit F G)
ext
simp [-tensor_obj]
inv_hom_id := by
apply Functor.hom_ext_of_isLeftKanExtension (G ⊛ F) (unit G F)
ext
simp [-tensor_obj]
@[reassoc (attr := simp)]
lemma unit_app_braiding_hom_app (x y : C) :
(unit F G).app (x, y) ≫ (braiding F G).hom.app (x ⊗ y) =
(β_ _ _).hom ≫ (unit G F).app (_, _) ≫ (G ⊛ F).map (β_ _ _).hom := by
change
(unit F G).app (x, y) ≫ (braiding F G).hom.app ((tensor C).obj (x, y)) = _
simp [braiding, braidingHomCorepresenting, -tensor_obj]
@[reassoc (attr := simp)]
lemma unit_app_braiding_inv_app (x y : C) :
(unit G F).app (x, y) ≫ (braiding F G).inv.app (x ⊗ y) =
(β_ _ _).inv ≫ (unit F G).app (_, _) ≫ (F ⊛ G).map (β_ _ _).inv := by
change
(unit G F).app (x, y) ≫ (braiding F G).inv.app ((tensor C).obj (x, y)) = _
simp [braiding, braidingHomCorepresenting, -tensor_obj]
end
variable {F G}
@[reassoc (attr := simp)]
lemma braiding_naturality_right (H : C ⥤ V) (η : F ⟶ G)
[DayConvolution F H] [DayConvolution H F]
[DayConvolution G H] [DayConvolution H G] :
DayConvolution.map (𝟙 H) η ≫ (braiding H G).hom =
(braiding H F).hom ≫ DayConvolution.map η (𝟙 H) := by
apply Functor.hom_ext_of_isLeftKanExtension (H ⊛ F) (unit H F)
ext ⟨_, _⟩
simp
@[reassoc (attr := simp)]
lemma braiding_naturality_left (η : F ⟶ G) (H : C ⥤ V)
[DayConvolution F H] [DayConvolution H F]
[DayConvolution G H] [DayConvolution H G] :
DayConvolution.map η (𝟙 H) ≫ (braiding G H).hom =
(braiding F H).hom ≫ DayConvolution.map (𝟙 H) η := by
apply Functor.hom_ext_of_isLeftKanExtension (F ⊛ H) (unit F H)
ext ⟨_, _⟩
simp
variable
[∀ (v : V) (d : C),
Limits.PreservesColimitsOfShape (CostructuredArrow (tensor C) d) (tensorLeft v)]
[∀ (v : V) (d : C),
Limits.PreservesColimitsOfShape (CostructuredArrow (tensor C) d) (tensorRight v)]
variable (F G) in
lemma hexagon_forward (H : C ⥤ V)
[DayConvolution F G] [DayConvolution G H] [DayConvolution F (G ⊛ H)]
[DayConvolution (F ⊛ G) H] [DayConvolution H F] [DayConvolution G (H ⊛ F)]
[DayConvolution (G ⊛ H) F] [DayConvolution G F] [DayConvolution (G ⊛ F) H]
[DayConvolution F H] [DayConvolution G (F ⊛ H)] :
(associator F G H).hom ≫ (braiding F (G ⊛ H)).hom ≫ (associator G H F).hom =
(DayConvolution.map (braiding F G).hom (𝟙 H)) ≫ (associator G F H).hom ≫
(DayConvolution.map (𝟙 G) (braiding F H).hom) := by
apply Functor.hom_ext_of_isLeftKanExtension ((F ⊛ G) ⊛ H) (unit _ H)
apply Functor.hom_ext_of_isLeftKanExtension ((F ⊛ G) ⊠ H)
(ExternalProduct.extensionUnitLeft (F ⊛ G) (unit F G) H)
ext ⟨⟨x, y⟩, z⟩
dsimp
simp only [whiskerLeft_id, Category.comp_id, associator_hom_unit_unit_assoc,
externalProductBifunctor_obj_obj, tensor_obj, NatTrans.naturality_assoc,
NatTrans.naturality, unit_app_braiding_hom_app_assoc,
BraidedCategory.braiding_tensor_left_hom, Functor.map_comp, Category.assoc,
Iso.map_hom_inv_id, BraidedCategory.braiding_naturality_right_assoc,
BraidedCategory.braiding_tensor_right_hom, Iso.map_inv_hom_id_assoc,
Iso.inv_hom_id_assoc, Iso.hom_inv_id_assoc, unit_app_map_app_assoc,
NatTrans.id_app, tensorHom_id]
simp only [← comp_whiskerRight_assoc, ← whiskerLeft_comp_assoc,
unit_app_braiding_hom_app]
simp only [whiskerLeft_comp, ← Functor.map_comp, Category.assoc,
Functor.comp_obj, tensor_obj, comp_whiskerRight,
whiskerRight_comp_unit_app_assoc, NatTrans.naturality_assoc,
NatTrans.naturality, associator_hom_unit_unit_assoc,
externalProductBifunctor_obj_obj, unit_app_map_app_assoc, NatTrans.id_app,
id_tensorHom]
rw [← BraidedCategory.hexagon_reverse, ← whiskerLeft_comp_assoc]
haveI := unit_app_braiding_hom_app F H x z =≫ (H ⊛ F).map (β_ z x).inv
dsimp at this
simp only [Category.assoc, Iso.map_hom_inv_id, Category.comp_id] at this
rw [← this, whiskerLeft_comp_assoc]
simp [← Functor.map_comp]
variable (F G) in
lemma hexagon_reverse (H : C ⥤ V)
[DayConvolution F G] [DayConvolution G H] [DayConvolution F (G ⊛ H)]
[DayConvolution (F ⊛ G) H] [DayConvolution H (F ⊛ G)] [DayConvolution H F]
[DayConvolution (H ⊛ F) G] [DayConvolution H G] [DayConvolution F (H ⊛ G)]
[DayConvolution F H] [DayConvolution (F ⊛ H) G] :
(associator F G H).inv ≫ (braiding (F ⊛ G) H).hom ≫ (associator H F G).inv =
(DayConvolution.map (𝟙 F) (braiding G H).hom) ≫ (associator F H G).inv ≫
(DayConvolution.map (braiding F H).hom (𝟙 G)) := by
apply Functor.hom_ext_of_isLeftKanExtension (F ⊛ G ⊛ H) (unit _ _)
apply Functor.hom_ext_of_isLeftKanExtension (F ⊠ (G ⊛ H))
(ExternalProduct.extensionUnitRight (G ⊛ H) (unit G H) F)
ext ⟨x, y, z⟩
dsimp
simp only [whiskerRight_tensor, id_whiskerRight, Category.id_comp,
Iso.inv_hom_id, associator_inv_unit_unit_assoc,
externalProductBifunctor_obj_obj, tensor_obj, NatTrans.naturality_assoc,
NatTrans.naturality, unit_app_braiding_hom_app_assoc,
BraidedCategory.braiding_tensor_right_hom, Functor.map_comp, Category.assoc,
Iso.map_inv_hom_id, Category.comp_id,
BraidedCategory.braiding_naturality_left_assoc,
BraidedCategory.braiding_tensor_left_hom, Iso.map_hom_inv_id_assoc,
Iso.hom_inv_id_assoc, Iso.inv_hom_id_assoc, unit_app_map_app_assoc,
NatTrans.id_app, id_tensorHom]
simp only [← comp_whiskerRight_assoc, ← whiskerLeft_comp_assoc,
unit_app_braiding_hom_app]
simp [← Functor.map_comp]
congr 2
rw [← BraidedCategory.hexagon_forward, ← comp_whiskerRight_assoc]
haveI := unit_app_braiding_hom_app F H x z =≫ (H ⊛ F).map (β_ z x).inv
dsimp at this
simp only [Category.assoc, Iso.map_hom_inv_id, Category.comp_id] at this
rw [← this, comp_whiskerRight_assoc]
simp [← Functor.map_comp]
end
section
variable {C : Type u₁} [Category.{v₁} C] {V : Type u₂} [Category.{v₂} V]
[MonoidalCategory C] [SymmetricCategory C]
[MonoidalCategory V] [SymmetricCategory V]
(F G : C ⥤ V)
lemma symmetry [DayConvolution F G] [DayConvolution G F] :
(braiding F G).hom ≫ (braiding G F).hom = 𝟙 _ := by
apply Functor.hom_ext_of_isLeftKanExtension (F ⊛ G) (unit F G)
ext ⟨x, y⟩
simp [← Functor.map_comp]
end
end CategoryTheory.MonoidalCategory.DayConvolution |
.lake/packages/mathlib/Mathlib/CategoryTheory/Monoidal/DayConvolution/Closed.lean | import Mathlib.CategoryTheory.Monoidal.DayConvolution
import Mathlib.CategoryTheory.Closed.Monoidal
import Mathlib.CategoryTheory.Limits.Shapes.End
/-! # Internal homs for day convolution
Given a category `V` that is monoidal closed, a category `C` that
is monoidal, a functor `C ⥤ V`, and given the data of suitable day convolutions
and suitable ends of profunctors `c c₁ c₂ ↦ ihom (F c₁) (·.obj (c₂ ⊗ c))`,
we prove that the data of the units of the left Kan extensions that define
day convolutions and the data of the canonical morphisms to the aforementioned
ends can be organised as data that exhibit `F` as monoidal closed in `C ⥤ V` for
the Day convolution monoidal structure.
## TODOs
* When `LawfulDayConvolutionMonoidalStruct` (https://github.com/leanprover-community/mathlib4/issues/26820) lands, transport the
constructions here to produce actual `CategoryTheory.MonoidalClosed` instances.
-/
universe v₁ v₂ u₁ u₂
namespace CategoryTheory.MonoidalCategory
open scoped ExternalProduct
open Opposite Limits
noncomputable section
variable {C : Type u₁} [Category.{v₁} C] {V : Type u₂} [Category.{v₂} V]
[MonoidalCategory C] [MonoidalCategory V] [MonoidalClosed V]
/-- Given `F : C ⥤ V`, this is the functor
`G ↦ c c₁ c₂ ↦ ihom (F c₁) (G.obj (c₂ ⊗ c))`.
The internal hom functor for Day convolution `[F, -]` is naturally isomorphic
to the functor `G ↦ c ↦ end_ (c₁ c₂ ↦ ihom (F c₁) (G.obj (c₂ ⊗ c)))`, hence
this definition. -/
@[simps!]
def dayConvolutionInternalHomDiagramFunctor (F : C ⥤ V) :
(C ⥤ V) ⥤ C ⥤ Cᵒᵖ ⥤ C ⥤ V where
obj G :=
{ obj c := Functor.whiskeringLeft₂ _|>.obj F.op|>.obj
(tensorRight c ⋙ G)|>.obj MonoidalClosed.internalHom
map {c c'} f := Functor.whiskeringLeft₂ _|>.obj F.op|>.map
(Functor.whiskerRight (curriedTensor C|>.flip.map f) G)|>.app
MonoidalClosed.internalHom }
map {G G'} η :=
{ app c := Functor.whiskeringLeft₂ _|>.obj F.op|>.map
(Functor.whiskerLeft _ η) |>.app MonoidalClosed.internalHom
naturality {c c'} f := by
ext j k
dsimp
simpa [-NatTrans.naturality] using
congr_arg (ihom <| F.obj <| unop j).map (η.naturality <| k ◁ f) }
/-- `DayConvolutionInternalHom F G H` asserts that `H` is the value at `G` of
an internal hom functor of `F` for the Day convolution monoidal structure.
This is phrased as the data of a limit `CategoryTheory.Wedge`
(i.e an end) on `internalHomDiagramFunctor F|>.obj G|>.obj c` and
`c`, with tip `(H.obj G).obj c` and a compatibility condition asserting that
the functoriality of `H` identifies to the functoriality of ends. -/
structure DayConvolutionInternalHom (F : C ⥤ V) (G : C ⥤ V) (H : C ⥤ V) where
/-- The canonical projections maps -/
π (c j : C) : H.obj c ⟶ (ihom <| F.obj j).obj (G.obj <| j ⊗ c)
/-- The projections maps assemble into a wedge. -/
hπ (c : C) ⦃i j : C⦄ (f : i ⟶ j) :
π c i ≫ (ihom (F.obj i)).map (G.map <| f ▷ c) =
π c j ≫ (MonoidalClosed.pre <| F.map f).app (G.obj <| j ⊗ c)
/-- The wedge defined by `π` and `hπ` is a limit wedge, i.e `H.obj c` is
an end of `internalHomDiagramFunctor F G|>.obj c`. -/
isLimitWedge (c : C) :
IsLimit <| Wedge.mk
(F := dayConvolutionInternalHomDiagramFunctor F|>.obj G|>.obj c)
(H.obj c) (π c) (hπ c)
/-- The functoriality of `H.obj G` identifies (through
`Wedge.IsLimit.hom_ext`) with the functoriality on ends induced by
functoriality of `internalHomDiagramFunctor F|>.obj G`. -/
map_comp_π {c c' : C} (f : c ⟶ c') (j : C) :
H.map f ≫ π c' j = π c j ≫ (ihom <| F.obj j).map (G.map <| j ◁ f)
namespace DayConvolutionInternalHom
open scoped DayConvolution
attribute [reassoc (attr := simp)] map_comp_π
attribute [reassoc] hπ
variable {F : C ⥤ V} {G : C ⥤ V} {H : C ⥤ V}
/-- If we have a map `G ⟶ G'` and a `DayConvolutionInternalHom F G' H'`, then
there is a unique map `H ⟶ H'` induced by functoriality of ends and functoriality
of `internalHomDiagramFunctor F`. -/
def map (ℌ : DayConvolutionInternalHom F G H) {G' : C ⥤ V} {H' : C ⥤ V}
(f : G ⟶ G') (ℌ' : DayConvolutionInternalHom F G' H') :
H ⟶ H' where
app c := Wedge.IsLimit.lift (ℌ'.isLimitWedge c)
(fun j ↦ (ℌ.π c j) ≫
(dayConvolutionInternalHomDiagramFunctor
F|>.map f|>.app c|>.app (op j)|>.app j))
(fun ⦃j j'⦄ φ ↦ by
have := congrArg (fun t ↦ t.app j') <|
dayConvolutionInternalHomDiagramFunctor
F|>.map f|>.app c|>.naturality φ.op
dsimp at this ⊢
rw [Category.assoc, ← (ihom (F.obj j)).map_comp, ← f.naturality,
Functor.map_comp, reassoc_of% ℌ.hπ]
simp)
naturality {c c'} f := by
apply Wedge.IsLimit.hom_ext (ℌ'.isLimitWedge c')
intro j
dsimp
simp only [Category.assoc, map_comp_π]
rw [← Wedge.mk_ι
(F := dayConvolutionInternalHomDiagramFunctor F|>.obj _|>.obj c')
(H'.obj c') (ℌ'.π c') (ℌ'.hπ c'),
← Wedge.mk_ι
(F := dayConvolutionInternalHomDiagramFunctor F|>.obj _|>.obj c)
(H'.obj c) (ℌ'.π c) (ℌ'.hπ c),
Wedge.IsLimit.lift_ι (ℌ'.isLimitWedge c'),
Wedge.IsLimit.lift_ι_assoc (ℌ'.isLimitWedge c) ]
simp [← Functor.map_comp]
@[reassoc (attr := simp)]
lemma map_app_comp_π (ℌ : DayConvolutionInternalHom F G H)
{G' : C ⥤ V} {H' : C ⥤ V} (f : G ⟶ G')
(ℌ' : DayConvolutionInternalHom F G' H') (c : C) (j : C) :
(ℌ.map f ℌ').app c ≫ ℌ'.π c j =
ℌ.π c j ≫ (ihom <| F.obj j).map (f.app <| j ⊗ c) := by
dsimp [map]
rw [← Wedge.mk_ι
(F := dayConvolutionInternalHomDiagramFunctor F|>.obj _|>.obj c)
(H'.obj c) (ℌ'.π c) (ℌ'.hπ c),
Wedge.IsLimit.lift_ι (ℌ'.isLimitWedge c)]
section ev
variable [DayConvolution F H] (ℌ : DayConvolutionInternalHom F G H)
/-- Given `ℌ : DayConvolutionInternalHom F H`, if we think of `H.obj G`
as the internal hom `[F, G]`, then this is the transformation
corresponding to the component at `G` of the "evaluation" natural morphism
`F ⊛ [F, _] ⟶ 𝟭`. -/
def ev_app : F ⊛ H ⟶ G :=
DayConvolution.corepresentableBy F H|>.homEquiv.symm <|
{ app x := MonoidalClosed.uncurry <| ℌ.π x.2 x.1
naturality {x y} f := by
have := congrArg (fun t ↦ F.obj x.1 ◁ t) <| ℌ.hπ x.2 f.1
dsimp at this ⊢
simp only [whiskerLeft_comp] at this
simp only [Category.assoc, MonoidalClosed.uncurry_eq, Functor.id_obj,
← whiskerLeft_comp_assoc, map_comp_π]
simp only [whiskerLeft_comp, Category.assoc, ihom.ev_naturality,
Functor.comp_obj, curriedTensor_obj_obj, Functor.id_obj,
← whisker_exchange_assoc, tensorHom_def, Functor.map_comp,
← ihom.ev_naturality_assoc]
rw [reassoc_of% this]
simp }
@[reassoc (attr := simp)]
lemma unit_app_ev_app_app (x y : C) :
((DayConvolution.unit F H).app (x, y) ≫ (ℌ.ev_app).app (x ⊗ y)) =
MonoidalClosed.uncurry (ℌ.π y x) := by
have := Functor.descOfIsLeftKanExtension_fac_app (F ⊛ H)
(DayConvolution.unit F H) G
dsimp at this
simp [this, ev_app]
lemma ev_naturality_app {G' H' : C ⥤ V} (ℌ' : DayConvolutionInternalHom F G' H')
[DayConvolution F H'] (η : G ⟶ G') :
DayConvolution.map (𝟙 F) (ℌ.map η ℌ') ≫ ℌ'.ev_app = ℌ.ev_app ≫ η := by
apply DayConvolution.corepresentableBy F H|>.homEquiv.injective
dsimp
ext ⟨x, y⟩
simp [MonoidalClosed.uncurry_eq, ← whiskerLeft_comp_assoc]
end ev
section coev
variable {G : C ⥤ V} [DayConvolution F G]
(ℌ : DayConvolutionInternalHom F (F ⊛ G) H)
/-- Given `ℌ : DayConvolutionInternalHom F H`, if we think of `H.obj G`
as the internal hom `[F, G]`, then this is the transformation
corresponding to the component at `G` of the "coevaluation" natural morphism
`𝟭 ⟶ [F, F ⊛ _]`. -/
def coev_app : G ⟶ H where
app c :=
Wedge.IsLimit.lift (ℌ.isLimitWedge c)
(fun c' => MonoidalClosed.curry <|
(DayConvolution.unit F G).app (c', c))
(fun {c' c''} f => by
have := DayConvolution.unit_naturality F G f (𝟙 c)
simp only [Functor.map_id, tensorHom_id] at this
replace this := congrArg MonoidalClosed.curry this
simp only [MonoidalClosed.curry_natural_right] at this
dsimp
rw [← this]
simp [MonoidalClosed.curry_eq])
naturality {c c'} f := by
dsimp
apply Wedge.IsLimit.hom_ext <| ℌ.isLimitWedge c'
intro (j : C)
simp only [multicospanIndexEnd_left,
dayConvolutionInternalHomDiagramFunctor_obj_obj_obj_obj, Multifork.ofι_pt,
Wedge.mk_ι, Category.assoc, map_comp_π]
rw [← Wedge.mk_ι
(F := dayConvolutionInternalHomDiagramFunctor F|>.obj _|>.obj c)
(H.obj c) (ℌ.π c) (ℌ.hπ c),
← Wedge.mk_ι
(F := dayConvolutionInternalHomDiagramFunctor F|>.obj _|>.obj c')
(H.obj c') (ℌ.π c') (ℌ.hπ c'),
Wedge.IsLimit.lift_ι_assoc, Wedge.IsLimit.lift_ι]
have := DayConvolution.unit_naturality F G (𝟙 j) f
simp only [Functor.map_id, id_tensorHom] at this
replace this := congrArg MonoidalClosed.curry this
simp only [MonoidalClosed.curry_natural_right] at this
rw [← this]
simp [MonoidalClosed.curry_eq]
@[reassoc (attr := simp)]
lemma coev_app_π (c j : C) :
ℌ.coev_app.app c ≫ ℌ.π c j =
MonoidalClosed.curry ((DayConvolution.unit F G).app (j, c)) := by
dsimp [coev_app]
rw [← Wedge.mk_ι
(F := dayConvolutionInternalHomDiagramFunctor F|>.obj _|>.obj c)
(H.obj c) (ℌ.π c) (ℌ.hπ c),
Wedge.IsLimit.lift_ι]
lemma coev_naturality_app {G' H' : C ⥤ V} [DayConvolution F G'] (η : G ⟶ G')
(ℌ' : DayConvolutionInternalHom F (F ⊛ G') H') :
η ≫ ℌ'.coev_app =
ℌ.coev_app ≫ ℌ.map (DayConvolution.map (𝟙 _) η) ℌ' := by
ext c
dsimp
apply Wedge.IsLimit.hom_ext <| ℌ'.isLimitWedge c
intro j
apply MonoidalClosed.uncurry_injective
dsimp
simp only [Category.assoc, coev_app_π, Functor.comp_obj, tensor_obj,
map_app_comp_π, coev_app_π_assoc, MonoidalClosed.uncurry_natural_right,
MonoidalClosed.uncurry_curry, DayConvolution.unit_app_map_app,
NatTrans.id_app, id_tensorHom]
simp [MonoidalClosed.uncurry_natural_left]
end coev
theorem left_triangle_components (G : C ⥤ V) [DayConvolution F G]
(ℌ : DayConvolutionInternalHom F (F ⊛ G) H) [DayConvolution F H] :
DayConvolution.map (𝟙 F) ℌ.coev_app ≫ ℌ.ev_app = 𝟙 (F ⊛ G) := by
apply DayConvolution.corepresentableBy F G|>.homEquiv.injective
dsimp
ext ⟨x, y⟩
apply MonoidalClosed.curry_injective
simp [MonoidalClosed.curry_natural_left]
theorem right_triangle_components (G : C ⥤ V) [DayConvolution F H]
(ℌ : DayConvolutionInternalHom F G H) {H' : C ⥤ V}
(ℌ' : DayConvolutionInternalHom F (F ⊛ H) H') :
ℌ'.coev_app ≫ ℌ'.map ℌ.ev_app ℌ = 𝟙 H := by
ext c
apply Wedge.IsLimit.hom_ext <| ℌ.isLimitWedge c
intro j
apply MonoidalClosed.uncurry_injective
simp [MonoidalClosed.uncurry_natural_right]
end DayConvolutionInternalHom
end
end CategoryTheory.MonoidalCategory |
.lake/packages/mathlib/Mathlib/CategoryTheory/Monoidal/Functor/Types.lean | import Mathlib.CategoryTheory.Monoidal.Functor
import Mathlib.CategoryTheory.Monoidal.Types.Basic
import Mathlib.CategoryTheory.Types.Basic
import Mathlib.Tactic.Simps.Basic
/-!
# Convert from `Applicative` to `CategoryTheory.Functor.LaxMonoidal`
This allows us to use Lean's `Type`-based applicative functors in category theory.
-/
namespace CategoryTheory
section
variable (F : Type* → Type*) [Applicative F] [LawfulApplicative F]
attribute [local simp] map_seq seq_map_assoc
LawfulApplicative.pure_seq LawfulApplicative.seq_assoc in
/-- A lawful `Applicative` gives a category theory `LaxMonoidal` functor
between categories of types. -/
@[simps]
instance : (ofTypeFunctor F).LaxMonoidal where
ε _ : F _ := pure PUnit.unit
μ _ _ p : F _ := Prod.mk <$> p.1 <*> p.2
end
end CategoryTheory |
.lake/packages/mathlib/Mathlib/CategoryTheory/Monoidal/Types/Coyoneda.lean | import Mathlib.CategoryTheory.Monoidal.Types.Basic
import Mathlib.CategoryTheory.Monoidal.CoherenceLemmas
/-!
# `(𝟙_ C ⟶ -)` is a lax monoidal functor to `Type`
-/
universe v u
namespace CategoryTheory
open Opposite MonoidalCategory
instance (C : Type u) [Category.{v} C] [MonoidalCategory C] :
(coyoneda.obj (op (𝟙_ C))).LaxMonoidal :=
Functor.LaxMonoidal.ofTensorHom
(ε := fun _ => 𝟙 _)
(μ := fun X Y p ↦ (λ_ (𝟙_ C)).inv ≫ (p.1 ⊗ₘ p.2))
(μ_natural := by cat_disch)
(associativity := fun X Y Z => by
ext ⟨⟨f, g⟩, h⟩; dsimp at f g h
dsimp; simp only [Iso.cancel_iso_inv_left, Category.assoc]
conv_lhs =>
rw [← Category.id_comp h, ← tensorHom_comp_tensorHom, Category.assoc, associator_naturality,
← Category.assoc, unitors_inv_equal, tensorHom_id, triangle_assoc_comp_right_inv]
conv_rhs => rw [← Category.id_comp f, ← tensorHom_comp_tensorHom]
simp)
(left_unitality := by
intros
ext ⟨⟨⟩, f⟩; dsimp at f
simp)
(right_unitality := fun X => by
ext ⟨f, ⟨⟩⟩; dsimp at f
simp [unitors_inv_equal])
end CategoryTheory |
.lake/packages/mathlib/Mathlib/CategoryTheory/Monoidal/Types/Basic.lean | import Mathlib.CategoryTheory.Monoidal.Cartesian.Basic
import Mathlib.CategoryTheory.Monoidal.Functor
/-!
# The category of types is a (symmetric) monoidal category
-/
open CategoryTheory Limits MonoidalCategory
universe v u
namespace CategoryTheory
instance typesCartesianMonoidalCategory : CartesianMonoidalCategory (Type u) :=
.ofChosenFiniteProducts Types.terminalLimitCone Types.binaryProductLimitCone
instance : BraidedCategory (Type u) := .ofCartesianMonoidalCategory
theorem types_tensorObj_def {X Y : Type u} : X ⊗ Y = (X × Y) := rfl
theorem types_tensorUnit_def : 𝟙_ (Type u) = PUnit := rfl
@[simp]
theorem tensor_apply {W X Y Z : Type u} (f : W ⟶ X) (g : Y ⟶ Z) (p : W ⊗ Y) :
(f ⊗ₘ g) p = (f p.1, g p.2) :=
rfl
@[simp]
theorem whiskerLeft_apply (X : Type u) {Y Z : Type u} (f : Y ⟶ Z) (p : X ⊗ Y) :
(X ◁ f) p = (p.1, f p.2) :=
rfl
@[simp]
theorem whiskerRight_apply {Y Z : Type u} (f : Y ⟶ Z) (X : Type u) (p : Y ⊗ X) :
(f ▷ X) p = (f p.1, p.2) :=
rfl
@[simp]
theorem leftUnitor_hom_apply {X : Type u} {x : X} {p : PUnit} :
((λ_ X).hom : 𝟙_ (Type u) ⊗ X → X) (p, x) = x :=
rfl
@[simp]
theorem leftUnitor_inv_apply {X : Type u} {x : X} :
((λ_ X).inv : X ⟶ 𝟙_ (Type u) ⊗ X) x = (PUnit.unit, x) :=
rfl
@[simp]
theorem rightUnitor_hom_apply {X : Type u} {x : X} {p : PUnit} :
((ρ_ X).hom : X ⊗ 𝟙_ (Type u) → X) (x, p) = x :=
rfl
@[simp]
theorem rightUnitor_inv_apply {X : Type u} {x : X} :
((ρ_ X).inv : X ⟶ X ⊗ 𝟙_ (Type u)) x = (x, PUnit.unit) :=
rfl
@[simp]
theorem associator_hom_apply {X Y Z : Type u} {x : X} {y : Y} {z : Z} :
((α_ X Y Z).hom : (X ⊗ Y) ⊗ Z → X ⊗ Y ⊗ Z) ((x, y), z) = (x, (y, z)) :=
rfl
@[simp]
theorem associator_inv_apply {X Y Z : Type u} {x : X} {y : Y} {z : Z} :
((α_ X Y Z).inv : X ⊗ Y ⊗ Z → (X ⊗ Y) ⊗ Z) (x, (y, z)) = ((x, y), z) :=
rfl
@[simp] theorem associator_hom_apply_1 {X Y Z : Type u} {x} :
(((α_ X Y Z).hom : (X ⊗ Y) ⊗ Z → X ⊗ Y ⊗ Z) x).1 = x.1.1 :=
rfl
@[simp] theorem associator_hom_apply_2_1 {X Y Z : Type u} {x} :
(((α_ X Y Z).hom : (X ⊗ Y) ⊗ Z → X ⊗ Y ⊗ Z) x).2.1 = x.1.2 :=
rfl
@[simp] theorem associator_hom_apply_2_2 {X Y Z : Type u} {x} :
(((α_ X Y Z).hom : (X ⊗ Y) ⊗ Z → X ⊗ Y ⊗ Z) x).2.2 = x.2 :=
rfl
@[simp] theorem associator_inv_apply_1_1 {X Y Z : Type u} {x} :
(((α_ X Y Z).inv : X ⊗ Y ⊗ Z → (X ⊗ Y) ⊗ Z) x).1.1 = x.1 :=
rfl
@[simp] theorem associator_inv_apply_1_2 {X Y Z : Type u} {x} :
(((α_ X Y Z).inv : X ⊗ Y ⊗ Z → (X ⊗ Y) ⊗ Z) x).1.2 = x.2.1 :=
rfl
@[simp] theorem associator_inv_apply_2 {X Y Z : Type u} {x} :
(((α_ X Y Z).inv : X ⊗ Y ⊗ Z → (X ⊗ Y) ⊗ Z) x).2 = x.2.2 :=
rfl
@[simp]
theorem braiding_hom_apply {X Y : Type u} {x : X} {y : Y} :
((β_ X Y).hom : X ⊗ Y → Y ⊗ X) (x, y) = (y, x) :=
rfl
@[simp]
theorem braiding_inv_apply {X Y : Type u} {x : X} {y : Y} :
((β_ X Y).inv : Y ⊗ X → X ⊗ Y) (y, x) = (x, y) :=
rfl
@[simp]
theorem CartesianMonoidalCategory.lift_apply {X Y Z : Type u} {f : X ⟶ Y} {g : X ⟶ Z} {x : X} :
lift f g x = (f x, g x) :=
rfl
-- We don't yet have an API for tensor products indexed by finite ordered types,
-- but it would be nice to state how monoidal functors preserve these.
/-- If `F` is a monoidal functor out of `Type`, it takes the (n+1)st Cartesian power
of a type to the image of that type, tensored with the image of the nth Cartesian power. -/
noncomputable def MonoidalFunctor.mapPi {C : Type*} [Category C] [MonoidalCategory C]
(F : Type _ ⥤ C) [F.Monoidal] (n : ℕ) (β : Type*) :
F.obj (Fin (n + 1) → β) ≅ F.obj β ⊗ F.obj (Fin n → β) :=
Functor.mapIso _ (Fin.consEquiv _).symm.toIso ≪≫ (Functor.Monoidal.μIso F β (Fin n → β)).symm
end CategoryTheory |
.lake/packages/mathlib/Mathlib/CategoryTheory/Monoidal/ExternalProduct/KanExtension.lean | import Mathlib.CategoryTheory.Monoidal.ExternalProduct.Basic
import Mathlib.CategoryTheory.Functor.KanExtension.Pointwise
import Mathlib.CategoryTheory.Limits.Final
/-!
# Preservation of pointwise left Kan extensions by external products
We prove that if a functor `H' : D' ⥤ V` is a pointwise left Kan extension of
`H : D ⥤ V` along `L : D ⥤ D'`, and if `K : E ⥤ V` is any functor such that
for any `e : E`, the functor `tensorRight (K.obj e)` commutes with colimits of
shape `CostructuredArrow L d`, then the functor `H' ⊠ K` is a pointwise left kan extension
of `H ⊠ K` along `L.prod (𝟭 E)`.
We also prove a similar criterion to establish that `K ⊠ H'` is a pointwise left Kan
extension of `K ⊠ H` along `(𝟭 E).prod L`.
-/
universe v₁ v₂ v₃ v₄ u₁ u₂ u₃ u₄
namespace CategoryTheory.MonoidalCategory.ExternalProduct
noncomputable section
open scoped Prod
variable {V : Type u₁} [Category.{v₁} V] [MonoidalCategory V]
{D : Type u₂} {D' : Type u₃} {E : Type u₄}
[Category.{v₂} D] [Category.{v₃} D'] [Category.{v₄} E]
{H : D ⥤ V} {L : D ⥤ D'} (H' : D' ⥤ V) (α : H ⟶ L ⋙ H') (K : E ⥤ V)
/-- Given an extension `α : H ⟶ L ⋙ H'`, this is the canonical extension
`H ⊠ K ⟶ L.prod (𝟭 E) ⋙ H' ⊠ K` it induces through bifunctoriality of the external product. -/
abbrev extensionUnitLeft : H ⊠ K ⟶ L.prod (𝟭 E) ⋙ H' ⊠ K :=
(externalProductBifunctor D E V).map (α ×ₘ K.leftUnitor.inv)
/-- Given an extension `α : H ⟶ L ⋙ H'`, this is the canonical extension
`K ⊠ H ⟶ (𝟭 E).prod L ⋙ K ⊠ H'` it induces through bifunctoriality of the external product. -/
abbrev extensionUnitRight : K ⊠ H ⟶ (𝟭 E).prod L ⋙ K ⊠ H' :=
(externalProductBifunctor E D V).map (K.leftUnitor.inv ×ₘ α)
/-- If `H' : D' ⥤ V` is a pointwise left Kan extension along `L : D ⥤ D'` at `(d : D')`
and if tensoring right with an object preserves colimits in `V`,
then `H' ⊠ K : D' × E ⥤ V` is a pointwise left Kan extension along `L × (𝟭 E)` at `(d, e)`
for every `e : E`. -/
def isPointwiseLeftKanExtensionAtExtensionUnitLeft
(d : D') (P : (Functor.LeftExtension.mk H' α).IsPointwiseLeftKanExtensionAt d) (e : E)
[Limits.PreservesColimitsOfShape (CostructuredArrow L d) (tensorRight <| K.obj e)] :
Functor.LeftExtension.mk (H' ⊠ K) (extensionUnitLeft H' α K)|>.IsPointwiseLeftKanExtensionAt
(d, e) := by
set cone := Functor.LeftExtension.mk (H' ⊠ K) (extensionUnitLeft H' α K)|>.coconeAt (d, e)
let equiv := CostructuredArrow.prodEquivalence L (𝟭 E) d e|>.symm
apply Limits.IsColimit.ofWhiskerEquivalence equiv
let I : CostructuredArrow L d ⥤ (CostructuredArrow L d) × CostructuredArrow (𝟭 E) e :=
-- this definition makes it easier to prove finality of I
(prod.rightUnitorEquivalence (CostructuredArrow L d)).inverse ⋙
(𝟭 _).prod (Functor.fromPUnit.{0} <| .mk <| 𝟙 _)
letI : I.Final := by
letI : Functor.fromPUnit.{0} (.mk (𝟙 e) : CostructuredArrow (𝟭 E) e)|>.Final :=
Functor.final_fromPUnit_of_isTerminal <| CostructuredArrow.mkIdTerminal (S := 𝟭 E) (Y := e)
apply Iff.mp <| Functor.final_iff_final_comp
(F := (prod.rightUnitorEquivalence <| CostructuredArrow L d).inverse)
(G := (𝟭 _).prod <| Functor.fromPUnit.{0} (.mk (𝟙 e) : CostructuredArrow (𝟭 E) e))
infer_instance
apply Functor.Final.isColimitWhiskerEquiv I (Limits.Cocone.whisker equiv.functor cone)|>.toFun
-- through all the equivalences above, the new cocone we consider is in fact
-- `tensorRight (K.obj e)|>.mapCocone <| (Functor.LeftExtension.mk H' α).coconeAt d`
let diag_iso :
(CostructuredArrow.proj L d ⋙ H) ⋙ tensorRight (K.obj e) ≅
I ⋙ equiv.functor ⋙ CostructuredArrow.proj (L.prod <| 𝟭 E) (d, e) ⋙ H ⊠ K :=
NatIso.ofComponents (fun _ ↦ Iso.refl _)
apply Limits.IsColimit.equivOfNatIsoOfIso diag_iso
(d := Limits.Cocone.whisker I (Limits.Cocone.whisker equiv.functor cone))
(c := tensorRight (K.obj e)|>.mapCocone <| (Functor.LeftExtension.mk H' α).coconeAt d)
(Limits.Cocones.ext <| .refl _)|>.toFun
exact Limits.PreservesColimit.preserves (F := tensorRight <| K.obj e) P|>.some
/-- If `H' : D' ⥤ V` is a pointwise left Kan extension along `L : D ⥤ D'`,
and if tensoring right with an object preserves colimits in `V`
then `H' ⊠ K : D' × E ⥤ V` is a pointwise left Kan extension along `L × (𝟭 E)`. -/
def isPointwiseLeftKanExtensionExtensionUnitLeft
[∀ d : D', ∀ e : E,
Limits.PreservesColimitsOfShape (CostructuredArrow L d) (tensorRight <| K.obj e)]
(P : (Functor.LeftExtension.mk H' α).IsPointwiseLeftKanExtension) :
Functor.LeftExtension.mk (H' ⊠ K) (extensionUnitLeft H' α K)|>.IsPointwiseLeftKanExtension :=
fun ⟨d, e⟩ ↦ isPointwiseLeftKanExtensionAtExtensionUnitLeft H' α K d (P d) e
/-- If `H' : D' ⥤ V` is a pointwise left Kan extension along `L : D ⥤ D'` at `d : D'` and
if tensoring left with an object preserves colimits in `V`,
then `K ⊠ H' : D' × E ⥤ V` is a pointwise left Kan extension along `(𝟭 E) × L` at `(e, d)` for
every `e`. -/
def isPointwiseLeftKanExtensionAtExtensionUnitRight
(d : D') (P : (Functor.LeftExtension.mk H' α).IsPointwiseLeftKanExtensionAt d) (e : E)
[Limits.PreservesColimitsOfShape (CostructuredArrow L d) (tensorLeft <| K.obj e)] :
(Functor.LeftExtension.mk (K ⊠ H')
(extensionUnitRight H' α K)).IsPointwiseLeftKanExtensionAt (e, d) := by
set cone := Functor.LeftExtension.mk (K ⊠ H')
(extensionUnitRight H' α K)|>.coconeAt (e, d)
let equiv := CostructuredArrow.prodEquivalence (𝟭 E) L e d|>.symm
apply Limits.IsColimit.ofWhiskerEquivalence equiv
let I : CostructuredArrow L d ⥤ CostructuredArrow (𝟭 E) e × CostructuredArrow L d :=
-- this definition makes it easier to prove finality of I
(prod.leftUnitorEquivalence <| CostructuredArrow L d).inverse ⋙
(Functor.fromPUnit.{0} <| .mk <| 𝟙 _).prod (𝟭 _)
letI : I.Final := by
letI : Functor.fromPUnit.{0} (.mk (𝟙 e) : CostructuredArrow (𝟭 E) e)|>.Final :=
Functor.final_fromPUnit_of_isTerminal <| CostructuredArrow.mkIdTerminal (S := 𝟭 E) (Y := e)
apply Iff.mp <| Functor.final_iff_final_comp
(F := (prod.leftUnitorEquivalence <| CostructuredArrow L d).inverse)
(G := Functor.fromPUnit.{0} (.mk (𝟙 e) : CostructuredArrow (𝟭 E) e)|>.prod <| 𝟭 _)
infer_instance
apply Functor.Final.isColimitWhiskerEquiv I (Limits.Cocone.whisker equiv.functor cone)|>.toFun
-- through all the equivalences above, the new cocone we consider is in fact
-- `(tensorLeft <| K.obj e).mapCocone <| (Functor.LeftExtension.mk H' α).coconeAt d`
let diag_iso :
(CostructuredArrow.proj L d ⋙ H) ⋙ tensorLeft (K.obj e) ≅
I ⋙ equiv.functor ⋙ CostructuredArrow.proj (𝟭 E|>.prod L) (e, d) ⋙ K ⊠ H :=
NatIso.ofComponents (fun _ ↦ Iso.refl _)
apply Limits.IsColimit.equivOfNatIsoOfIso diag_iso
(d := Limits.Cocone.whisker I <| Limits.Cocone.whisker equiv.functor cone)
(c := (tensorLeft <| K.obj e).mapCocone <| (Functor.LeftExtension.mk H' α).coconeAt d)
(Limits.Cocones.ext <| .refl _)|>.toFun
exact Limits.PreservesColimit.preserves (F := tensorLeft <| K.obj e) P|>.some
/-- If `H' : D' ⥤ V` is a pointwise left Kan extension along `L : D ⥤ D'` and
if tensoring left with an object preserves colimits in `V`,
then `K ⊠ H' : D' × E ⥤ V` is a pointwise left Kan extension along `(𝟭 E) × L`. -/
def isPointwiseLeftKanExtensionExtensionUnitRight
[∀ d : D', ∀ e : E,
Limits.PreservesColimitsOfShape (CostructuredArrow L d) (tensorLeft <| K.obj e)]
(P : Functor.LeftExtension.mk H' α|>.IsPointwiseLeftKanExtension) :
Functor.LeftExtension.mk (K ⊠ H') (extensionUnitRight H' α K)|>.IsPointwiseLeftKanExtension :=
fun ⟨e, d⟩ ↦ isPointwiseLeftKanExtensionAtExtensionUnitRight H' α K d (P d) e
end
end CategoryTheory.MonoidalCategory.ExternalProduct |
.lake/packages/mathlib/Mathlib/CategoryTheory/Monoidal/ExternalProduct/Basic.lean | import Mathlib.CategoryTheory.Monoidal.FunctorCategory
import Mathlib.CategoryTheory.Functor.Currying
/-!
# External product of diagrams in a monoidal category
In a monoidal category `C`, given a pair of diagrams `K₁ : J₁ ⥤ C` and `K₂ : J₂ ⥤ C`, we
introduce the external product `K₁ ⊠ K₂ : J₁ × J₂ ⥤ C` as the bifunctor `(j₁, j₂) ↦ K₁ j₁ ⊗ K₂ j₂`.
The notation `- ⊠ -` is scoped to `MonoidalCategory.ExternalProduct`.
-/
universe v₁ v₂ v₃ v₄ u₁ u₂ u₃ u₄
namespace CategoryTheory.MonoidalCategory
open Functor
variable (J₁ : Type u₁) (J₂ : Type u₂) (C : Type u₃)
[Category.{v₁} J₁] [Category.{v₂} J₂] [Category.{v₃} C] [MonoidalCategory C]
/-- The (curried version of the) external product bifunctor: given diagrams
`K₁ : J₁ ⥤ C` and `K₂ : J₂ ⥤ C`, this is the bifunctor `j₁ ↦ j₂ ↦ K₁ j₁ ⊗ K₂ j₂`. -/
@[simps!]
def externalProductBifunctorCurried : (J₁ ⥤ C) ⥤ (J₂ ⥤ C) ⥤ J₁ ⥤ J₂ ⥤ C :=
(Functor.postcompose₂.obj <| (evaluation _ _).obj <| curriedTensor C).obj <| whiskeringLeft₂ C
/-- The external product bifunctor: given diagrams
`K₁ : J₁ ⥤ C` and `K₂ : J₂ ⥤ C`, this is the bifunctor `(j₁, j₂) ↦ K₁ j₁ ⊗ K₂ j₂`. -/
@[simps!]
def externalProductBifunctor : ((J₁ ⥤ C) × (J₂ ⥤ C)) ⥤ J₁ × J₂ ⥤ C :=
uncurry.obj <| (Functor.postcompose₂.obj <| uncurry).obj <|
externalProductBifunctorCurried J₁ J₂ C
variable {J₁ J₂ C}
/-- An abbreviation for the action of `externalProductBifunctor J₁ J₂ C` on objects. -/
abbrev externalProduct (F₁ : J₁ ⥤ C) (F₂ : J₂ ⥤ C) :=
externalProductBifunctor J₁ J₂ C|>.obj (F₁, F₂)
namespace ExternalProduct
/-- Notation for `externalProduct`.
Do `open scoped CategoryTheory.MonoidalCategory.ExternalProduct`
to bring this notation in scope. -/
scoped infixr:80 " ⊠ " => externalProduct
end ExternalProduct
open scoped ExternalProduct
variable (J₁ J₂ C)
/-- When both diagrams have the same source category, composing the external product with
the diagonal gives the pointwise functor tensor product.
Note that `(externalProductCompDiagIso _ _).app (F₁, F₂) : Functor.diag J₁ ⋙ F₁ ⊠ F₂ ≅ F₁ ⊗ F₂`
type checks. -/
@[simps!]
def externalProductCompDiagIso :
externalProductBifunctor J₁ J₁ C ⋙ (whiskeringLeft _ _ _|>.obj <| Functor.diag J₁) ≅
tensor (J₁ ⥤ C) :=
NatIso.ofComponents
(fun _ ↦ NatIso.ofComponents (fun _ ↦ Iso.refl _) (by simp [tensorHom_def]))
(fun _ ↦ by ext; simp [tensorHom_def])
/-- When `C` is braided, there is an isomorphism `Prod.swap _ _ ⋙ F₁ ⊠ F₂ ≅ F₂ ⊠ F₁`, natural
in both `F₁` and `F₂`.
Note that `(externalProductSwap _ _ _).app (F₁, F₂) : Prod.swap _ _ ⋙ F₁ ⊠ F₂ ≅ F₂ ⊠ F₁`
type checks. -/
@[simps!]
def externalProductSwap [BraidedCategory C] :
externalProductBifunctor J₁ J₂ C ⋙ (whiskeringLeft _ _ _|>.obj <| Prod.swap _ _) ≅
Prod.swap _ _ ⋙ externalProductBifunctor J₂ J₁ C :=
NatIso.ofComponents
(fun _ ↦ NatIso.ofComponents (fun _ ↦ β_ _ _) (by simp [whisker_exchange]))
(fun _ ↦ by ext; simp [whisker_exchange])
/-- A version of `externalProductSwap` phrased in terms of the curried functors. -/
@[simps!]
def externalProductFlip [BraidedCategory C] :
(Functor.postcompose₂.obj <| flipFunctor _ _ _).obj
(externalProductBifunctorCurried J₁ J₂ C) ≅
(externalProductBifunctorCurried J₂ J₁ C).flip :=
NatIso.ofComponents <| fun _ ↦ NatIso.ofComponents <|
fun _ ↦ NatIso.ofComponents <| fun _ ↦ NatIso.ofComponents (fun _ ↦ β_ _ _)
section Composition
variable {J₁ J₂ C} {I₁ : Type u₃} {I₂ : Type u₄} [Category.{v₃} I₁] [Category.{v₄} I₂]
/-- Composing `F₁ × F₂` with `G₁ ⊠ G₂` is isomorphic to `(F₁ ⋙ G₁) ⊠ (F₂ ⋙ G₂)`. -/
@[simps!]
def prodCompExternalProduct (F₁ : I₁ ⥤ J₁) (G₁ : J₁ ⥤ C) (F₂ : I₂ ⥤ J₂) (G₂ : J₂ ⥤ C) :
F₁.prod F₂ ⋙ G₁ ⊠ G₂ ≅ (F₁ ⋙ G₁) ⊠ (F₂ ⋙ G₂) := NatIso.ofComponents (fun _ ↦ Iso.refl _)
end Composition
end CategoryTheory.MonoidalCategory |
.lake/packages/mathlib/Mathlib/CategoryTheory/Monoidal/Opposite/Mon_.lean | import Mathlib.CategoryTheory.Monoidal.Opposite
import Mathlib.CategoryTheory.Monoidal.Mon_
/-!
# Monoid objects internal to monoidal opposites
In this file, we record the equivalence between `Mon C` and `Mon Cᴹᵒᵖ`.
-/
namespace MonObj
open CategoryTheory MonoidalCategory MonoidalOpposite
variable {C : Type*} [Category C] [MonoidalCategory C]
section mop
variable (M : C) [MonObj M]
/-- If `M : C` is a monoid object, then `mop M : Cᴹᵒᵖ` too. -/
@[simps!]
instance mopMonObj : MonObj (mop M) where
mul := MonObj.mul.mop
one := MonObj.one.mop
mul_one := by
apply mopEquiv C|>.fullyFaithfulInverse.map_injective
simp
one_mul := by
apply mopEquiv C|>.fullyFaithfulInverse.map_injective
simp
mul_assoc := by
apply mopEquiv C|>.fullyFaithfulInverse.map_injective
simp
variable {M} in
/-- If `f` is a morphism of monoid objects internal to `C`,
then `f.mop` is a morphism of monoid objects internal to `Cᴹᵒᵖ`. -/
instance mop_isMonHom {N : C} [MonObj N]
(f : M ⟶ N) [IsMonHom f] : IsMonHom f.mop where
mul_hom := by
apply mopEquiv C|>.fullyFaithfulInverse.map_injective
simpa [-IsMonHom.mul_hom] using IsMonHom.mul_hom f
one_hom := by
apply mopEquiv C|>.fullyFaithfulInverse.map_injective
simpa [-IsMonHom.one_hom] using IsMonHom.one_hom f
end mop
section unmop
variable (M : Cᴹᵒᵖ) [MonObj M]
/-- If `M : Cᴹᵒᵖ` is a monoid object, then `unmop M : C` too. -/
@[simps -isSimp] -- not making them simp because it causes a loop.
instance unmopMonObj : MonObj (unmop M) where
mul := MonObj.mul.unmop
one := MonObj.one.unmop
mul_one := by
apply mopEquiv C|>.fullyFaithfulFunctor.map_injective
simp
one_mul := by
apply mopEquiv C|>.fullyFaithfulFunctor.map_injective
simp
mul_assoc := by
apply mopEquiv C|>.fullyFaithfulFunctor.map_injective
simp
variable {M} in
/-- If `f` is a morphism of monoid objects internal to `Cᴹᵒᵖ`,
so is `f.unmop`. -/
instance unmop_isMonHom {N : Cᴹᵒᵖ} [MonObj N]
(f : M ⟶ N) [IsMonHom f] : IsMonHom f.unmop where
mul_hom := by
apply mopEquiv C|>.fullyFaithfulFunctor.map_injective
simpa [-IsMonHom.mul_hom] using IsMonHom.mul_hom f
one_hom := by
apply mopEquiv C|>.fullyFaithfulFunctor.map_injective
simpa [-IsMonHom.one_hom] using IsMonHom.one_hom f
end unmop
variable (C) in
/-- The equivalence of categories between monoids internal to `C`
and monoids internal to the monoidal opposite of `C`. -/
@[simps!]
def mopEquiv : Mon C ≌ Mon Cᴹᵒᵖ where
functor :=
{ obj M := ⟨mop M.X⟩
map f := ⟨f.hom.mop⟩ }
inverse :=
{ obj M := ⟨unmop M.X⟩
map f := ⟨f.hom.unmop⟩ }
unitIso := .refl _
counitIso := .refl _
/-- The equivalence of categories between monoids internal to `C`
and monoids internal to the monoidal opposite of `C` lies over
the equivalence `C ≌ Cᴹᵒᵖ` via the forgetful functors. -/
@[simps!]
def mopEquivCompForgetIso :
(mopEquiv C).functor ⋙ Mon.forget Cᴹᵒᵖ ≅
Mon.forget C ⋙ (MonoidalOpposite.mopEquiv C).functor :=
.refl _
end MonObj |
.lake/packages/mathlib/Mathlib/CategoryTheory/Monoidal/Free/Coherence.lean | import Mathlib.CategoryTheory.Monoidal.Free.Basic
import Mathlib.CategoryTheory.Discrete.Basic
/-!
# The monoidal coherence theorem
In this file, we prove the monoidal coherence theorem, stated in the following form: the free
monoidal category over any type `C` is thin.
We follow a proof described by Ilya Beylin and Peter Dybjer, which has been previously formalized
in the proof assistant ALF. The idea is to declare a normal form (with regard to association and
adding units) on objects of the free monoidal category and consider the discrete subcategory of
objects that are in normal form. A normalization procedure is then just a functor
`fullNormalize : FreeMonoidalCategory C ⥤ Discrete (NormalMonoidalObject C)`, where
functoriality says that two objects which are related by associators and unitors have the
same normal form. Another desirable property of a normalization procedure is that an object is
isomorphic (i.e., related via associators and unitors) to its normal form. In the case of the
specific normalization procedure we use we not only get these isomorphisms, but also that they
assemble into a natural isomorphism `𝟭 (FreeMonoidalCategory C) ≅ fullNormalize ⋙ inclusion`.
But this means that any two parallel morphisms in the free monoidal category factor through a
discrete category in the same way, so they must be equal, and hence the free monoidal category
is thin.
## References
* [Ilya Beylin and Peter Dybjer, Extracting a proof of coherence for monoidal categories from a
proof of normalization for monoids][beylin1996]
-/
universe u
namespace CategoryTheory
open MonoidalCategory Functor
namespace FreeMonoidalCategory
variable {C : Type u}
section
variable (C)
/-- We say an object in the free monoidal category is in normal form if it is of the form
`(((𝟙_ C) ⊗ X₁) ⊗ X₂) ⊗ ⋯`. -/
inductive NormalMonoidalObject : Type u
| unit : NormalMonoidalObject
| tensor : NormalMonoidalObject → C → NormalMonoidalObject
end
local notation "F" => FreeMonoidalCategory
local notation "N" => Discrete ∘ NormalMonoidalObject
local infixr:10 " ⟶ᵐ " => Hom
instance (x y : N C) : Subsingleton (x ⟶ y) := Discrete.instSubsingletonDiscreteHom _ _
/-- Auxiliary definition for `inclusion`. -/
@[simp]
def inclusionObj : NormalMonoidalObject C → F C
| NormalMonoidalObject.unit => unit
| NormalMonoidalObject.tensor n a => tensor (inclusionObj n) (of a)
/-- The discrete subcategory of objects in normal form includes into the free monoidal category. -/
def inclusion : N C ⥤ F C :=
Discrete.functor inclusionObj
@[simp]
theorem inclusion_obj (X : N C) :
inclusion.obj X = inclusionObj X.as :=
rfl
@[simp]
theorem inclusion_map {X Y : N C} (f : X ⟶ Y) :
inclusion.map f = eqToHom (congr_arg _ (Discrete.ext (Discrete.eq_of_hom f))) := rfl
/-- Auxiliary definition for `normalize`. -/
def normalizeObj : F C → NormalMonoidalObject C → NormalMonoidalObject C
| unit, n => n
| of X, n => NormalMonoidalObject.tensor n X
| tensor X Y, n => normalizeObj Y (normalizeObj X n)
@[simp]
theorem normalizeObj_unitor (n : NormalMonoidalObject C) : normalizeObj (𝟙_ (F C)) n = n :=
rfl
@[simp]
theorem normalizeObj_tensor (X Y : F C) (n : NormalMonoidalObject C) :
normalizeObj (X ⊗ Y) n = normalizeObj Y (normalizeObj X n) :=
rfl
/-- Auxiliary definition for `normalize`. -/
def normalizeObj' (X : F C) : N C ⥤ N C := Discrete.functor fun n ↦ ⟨normalizeObj X n⟩
section
open Hom
/-- Auxiliary definition for `normalize`. Here we prove that objects that are related by
associators and unitors map to the same normal form. -/
@[simp]
def normalizeMapAux : ∀ {X Y : F C}, (X ⟶ᵐ Y) → (normalizeObj' X ⟶ normalizeObj' Y)
| _, _, Hom.id _ => 𝟙 _
| _, _, α_hom X Y Z => by dsimp; exact Discrete.natTrans (fun _ => 𝟙 _)
| _, _, α_inv _ _ _ => by dsimp; exact Discrete.natTrans (fun _ => 𝟙 _)
| _, _, l_hom _ => by dsimp; exact Discrete.natTrans (fun _ => 𝟙 _)
| _, _, l_inv _ => by dsimp; exact Discrete.natTrans (fun _ => 𝟙 _)
| _, _, ρ_hom _ => by dsimp; exact Discrete.natTrans (fun _ => 𝟙 _)
| _, _, ρ_inv _ => by dsimp; exact Discrete.natTrans (fun _ => 𝟙 _)
| _, _, (@Hom.comp _ _ _ _ f g) => normalizeMapAux f ≫ normalizeMapAux g
| _, _, (@Hom.tensor _ T _ _ W f g) =>
Discrete.natTrans <| fun ⟨X⟩ => (normalizeMapAux g).app ⟨normalizeObj T X⟩ ≫
(normalizeObj' W).map ((normalizeMapAux f).app ⟨X⟩)
| _, _, (@Hom.whiskerLeft _ T _ W f) =>
Discrete.natTrans <| fun ⟨X⟩ => (normalizeMapAux f).app ⟨normalizeObj T X⟩
| _, _, (@Hom.whiskerRight _ T _ f W) =>
Discrete.natTrans <| fun X => (normalizeObj' W).map <| (normalizeMapAux f).app X
end
section
variable (C)
/-- Our normalization procedure works by first defining a functor `F C ⥤ (N C ⥤ N C)` (which turns
out to be very easy), and then obtain a functor `F C ⥤ N C` by plugging in the normal object
`𝟙_ C`. -/
@[simp]
def normalize : F C ⥤ N C ⥤ N C where
obj X := normalizeObj' X
map {X Y} := Quotient.lift normalizeMapAux (by cat_disch)
/-- A variant of the normalization functor where we consider the result as an object in the free
monoidal category (rather than an object of the discrete subcategory of objects in normal form). -/
@[simp]
def normalize' : F C ⥤ N C ⥤ F C :=
normalize C ⋙ (whiskeringRight _ _ _).obj inclusion
/-- The normalization functor for the free monoidal category over `C`. -/
def fullNormalize : F C ⥤ N C where
obj X := ((normalize C).obj X).obj ⟨NormalMonoidalObject.unit⟩
map f := ((normalize C).map f).app ⟨NormalMonoidalObject.unit⟩
/-- Given an object `X` of the free monoidal category and an object `n` in normal form, taking
the tensor product `n ⊗ X` in the free monoidal category is functorial in both `X` and `n`. -/
@[simp]
def tensorFunc : F C ⥤ N C ⥤ F C where
obj X := Discrete.functor fun n => inclusion.obj ⟨n⟩ ⊗ X
map f := Discrete.natTrans (fun _ => _ ◁ f)
theorem tensorFunc_map_app {X Y : F C} (f : X ⟶ Y) (n) : ((tensorFunc C).map f).app n = _ ◁ f :=
rfl
theorem tensorFunc_obj_map (Z : F C) {n n' : N C} (f : n ⟶ n') :
((tensorFunc C).obj Z).map f = inclusion.map f ▷ Z := by
cases n
cases n'
rcases f with ⟨⟨h⟩⟩
dsimp at h
subst h
simp
/-- Auxiliary definition for `normalizeIso`. Here we construct the isomorphism between
`n ⊗ X` and `normalize X n`. -/
@[simp]
def normalizeIsoApp :
∀ (X : F C) (n : N C), ((tensorFunc C).obj X).obj n ≅ ((normalize' C).obj X).obj n
| of _, _ => Iso.refl _
| unit, _ => ρ_ _
| tensor X a, n =>
(α_ _ _ _).symm ≪≫ whiskerRightIso (normalizeIsoApp X n) a ≪≫ normalizeIsoApp _ _
/-- Almost non-definitionally equal to `normalizeIsoApp`, but has a better definitional property
in the proof of `normalize_naturality`. -/
@[simp]
def normalizeIsoApp' :
∀ (X : F C) (n : NormalMonoidalObject C), inclusionObj n ⊗ X ≅ inclusionObj (normalizeObj X n)
| of _, _ => Iso.refl _
| unit, _ => ρ_ _
| tensor X Y, n =>
(α_ _ _ _).symm ≪≫ whiskerRightIso (normalizeIsoApp' X n) Y ≪≫ normalizeIsoApp' _ _
theorem normalizeIsoApp_eq :
∀ (X : F C) (n : N C), normalizeIsoApp C X n = normalizeIsoApp' C X n.as
| of _, _ => rfl
| unit, _ => rfl
| tensor X Y, n => by
rw [normalizeIsoApp, normalizeIsoApp']
rw [normalizeIsoApp_eq X n]
rw [normalizeIsoApp_eq Y ⟨normalizeObj X n.as⟩]
rfl
@[simp]
theorem normalizeIsoApp_tensor (X Y : F C) (n : N C) :
normalizeIsoApp C (X ⊗ Y) n =
(α_ _ _ _).symm ≪≫ whiskerRightIso (normalizeIsoApp C X n) Y ≪≫ normalizeIsoApp _ _ _ :=
rfl
@[simp]
theorem normalizeIsoApp_unitor (n : N C) : normalizeIsoApp C (𝟙_ (F C)) n = ρ_ _ :=
rfl
/-- Auxiliary definition for `normalizeIso`. -/
@[simps!]
def normalizeIsoAux (X : F C) : (tensorFunc C).obj X ≅ (normalize' C).obj X :=
NatIso.ofComponents (normalizeIsoApp C X)
(by
rintro ⟨X⟩ ⟨Y⟩ ⟨⟨f⟩⟩
dsimp at f
subst f
dsimp
simp)
section
variable {C}
theorem normalizeObj_congr (n : NormalMonoidalObject C) {X Y : F C} (f : X ⟶ Y) :
normalizeObj X n = normalizeObj Y n := by
rcases f with ⟨f'⟩
apply @congr_fun _ _ fun n => normalizeObj X n
clear n f
induction f' with
| comp _ _ _ _ => apply Eq.trans <;> assumption
| whiskerLeft _ _ ih => funext; apply congr_fun ih
| whiskerRight _ _ ih => funext; apply congr_arg₂ _ rfl (congr_fun ih _)
| @tensor W X Y Z _ _ ih₁ ih₂ =>
funext n
simp [congr_fun ih₁ n, congr_fun ih₂ (normalizeObj Y n)]
| _ => funext; rfl
theorem normalize_naturality (n : NormalMonoidalObject C) {X Y : F C} (f : X ⟶ Y) :
inclusionObj n ◁ f ≫ (normalizeIsoApp' C Y n).hom =
(normalizeIsoApp' C X n).hom ≫
inclusion.map (eqToHom (Discrete.ext (normalizeObj_congr n f))) := by
revert n
induction f using Hom.inductionOn
case comp f g ihf ihg => simp [ihg, reassoc_of% (ihf _)]
case whiskerLeft X' X Y f ih =>
intro n
dsimp only [normalizeObj_tensor, normalizeIsoApp', tensor_eq_tensor, Iso.trans_hom,
Iso.symm_hom, whiskerRightIso_hom, Function.comp_apply, inclusion_obj]
rw [associator_inv_naturality_right_assoc, whisker_exchange_assoc, ih]
simp
case whiskerRight X Y h η' ih =>
intro n
dsimp only [normalizeObj_tensor, normalizeIsoApp', tensor_eq_tensor, Iso.trans_hom,
Iso.symm_hom, whiskerRightIso_hom, Function.comp_apply, inclusion_obj]
rw [associator_inv_naturality_middle_assoc, ← comp_whiskerRight_assoc, ih]
have := dcongr_arg (fun x => (normalizeIsoApp' C η' x).hom) (normalizeObj_congr n h)
simp [this]
all_goals simp
end
/-- The isomorphism between `n ⊗ X` and `normalize X n` is natural (in both `X` and `n`, but
naturality in `n` is trivial and was "proved" in `normalizeIsoAux`). This is the real heart
of our proof of the coherence theorem. -/
def normalizeIso : tensorFunc C ≅ normalize' C :=
NatIso.ofComponents (normalizeIsoAux C) <| by
intro X Y f
ext ⟨n⟩
convert normalize_naturality n f using 1
any_goals dsimp; rw [normalizeIsoApp_eq]
/-- The isomorphism between an object and its normal form is natural. -/
def fullNormalizeIso : 𝟭 (F C) ≅ fullNormalize C ⋙ inclusion :=
NatIso.ofComponents
(fun X => (λ_ X).symm ≪≫ ((normalizeIso C).app X).app ⟨NormalMonoidalObject.unit⟩)
(by
intro X Y f
dsimp
rw [leftUnitor_inv_naturality_assoc, Category.assoc, Iso.cancel_iso_inv_left]
exact
congr_arg (fun f => NatTrans.app f (Discrete.mk NormalMonoidalObject.unit))
((normalizeIso.{u} C).hom.naturality f))
end
/-- The monoidal coherence theorem. -/
instance subsingleton_hom : Quiver.IsThin (F C) := fun X Y =>
⟨fun f g => by
have hfg : (fullNormalize C).map f = (fullNormalize C).map g := Subsingleton.elim _ _
have hf := NatIso.naturality_2 (fullNormalizeIso.{u} C) f
have hg := NatIso.naturality_2 (fullNormalizeIso.{u} C) g
exact hf.symm.trans (Eq.trans (by simp only [Functor.comp_map, hfg]) hg)⟩
section Groupoid
section
open Hom
/-- Auxiliary construction for showing that the free monoidal category is a groupoid. Do not use
this, use `IsIso.inv` instead. -/
def inverseAux : ∀ {X Y : F C}, (X ⟶ᵐ Y) → (Y ⟶ᵐ X)
| _, _, Hom.id X => id X
| _, _, α_hom _ _ _ => α_inv _ _ _
| _, _, α_inv _ _ _ => α_hom _ _ _
| _, _, ρ_hom _ => ρ_inv _
| _, _, ρ_inv _ => ρ_hom _
| _, _, l_hom _ => l_inv _
| _, _, l_inv _ => l_hom _
| _, _, Hom.comp f g => (inverseAux g).comp (inverseAux f)
| _, _, Hom.whiskerLeft X f => (inverseAux f).whiskerLeft X
| _, _, Hom.whiskerRight f X => (inverseAux f).whiskerRight X
| _, _, Hom.tensor f g => (inverseAux f).tensor (inverseAux g)
end
instance : Groupoid.{u} (F C) :=
{ (inferInstance : Category (F C)) with
inv := Quotient.lift (fun f => ⟦inverseAux f⟧) (by cat_disch) }
end Groupoid
end FreeMonoidalCategory
end CategoryTheory |
.lake/packages/mathlib/Mathlib/CategoryTheory/Monoidal/Free/Basic.lean | import Mathlib.CategoryTheory.Monoidal.Functor
/-!
# The free monoidal category over a type
Given a type `C`, the free monoidal category over `C` has as objects formal expressions built from
(formal) tensor products of terms of `C` and a formal unit. Its morphisms are compositions and
tensor products of identities, unitors and associators.
In this file, we construct the free monoidal category and prove that it is a monoidal category. If
`D` is a monoidal category, we construct the functor `FreeMonoidalCategory C ⥤ D` associated to
a function `C → D`.
The free monoidal category has two important properties: it is a groupoid and it is thin. The former
is obvious from the construction, and the latter is what is commonly known as the monoidal coherence
theorem. Both of these properties are proved in the file `Coherence.lean`.
-/
universe v' u u'
namespace CategoryTheory
open MonoidalCategory
variable {C : Type u}
section
variable (C)
-- Don't generate unnecessary `sizeOf_spec` or `injEq` lemmas
-- which the `simpNF` linter will complain about.
set_option genSizeOfSpec false in
set_option genInjectivity false in
/--
Given a type `C`, the free monoidal category over `C` has as objects formal expressions built from
(formal) tensor products of terms of `C` and a formal unit. Its morphisms are compositions and
tensor products of identities, unitors and associators.
-/
inductive FreeMonoidalCategory : Type u
| of : C → FreeMonoidalCategory
| unit : FreeMonoidalCategory
| tensor : FreeMonoidalCategory → FreeMonoidalCategory → FreeMonoidalCategory
deriving Inhabited
end
local notation "F" => FreeMonoidalCategory
namespace FreeMonoidalCategory
/-- Formal compositions and tensor products of identities, unitors and associators. The morphisms
of the free monoidal category are obtained as a quotient of these formal morphisms by the
relations defining a monoidal category. -/
inductive Hom : F C → F C → Type u
| id (X) : Hom X X
| α_hom (X Y Z : F C) : Hom ((X.tensor Y).tensor Z) (X.tensor (Y.tensor Z))
| α_inv (X Y Z : F C) : Hom (X.tensor (Y.tensor Z)) ((X.tensor Y).tensor Z)
| l_hom (X) : Hom (unit.tensor X) X
| l_inv (X) : Hom X (unit.tensor X)
| ρ_hom (X : F C) : Hom (X.tensor unit) X
| ρ_inv (X : F C) : Hom X (X.tensor unit)
| comp {X Y Z} (f : Hom X Y) (g : Hom Y Z) : Hom X Z
| whiskerLeft (X : F C) {Y₁ Y₂} (f : Hom Y₁ Y₂) : Hom (X.tensor Y₁) (X.tensor Y₂)
| whiskerRight {X₁ X₂} (f : Hom X₁ X₂) (Y : F C) : Hom (X₁.tensor Y) (X₂.tensor Y)
| tensor {W X Y Z} (f : Hom W Y) (g : Hom X Z) : Hom (W.tensor X) (Y.tensor Z)
local infixr:10 " ⟶ᵐ " => Hom
/-- The morphisms of the free monoidal category satisfy 21 relations ensuring that the resulting
category is in fact a category and that it is monoidal. -/
inductive HomEquiv : ∀ {X Y : F C}, (X ⟶ᵐ Y) → (X ⟶ᵐ Y) → Prop
| refl {X Y} (f : X ⟶ᵐ Y) : HomEquiv f f
| symm {X Y} (f g : X ⟶ᵐ Y) : HomEquiv f g → HomEquiv g f
| trans {X Y} {f g h : X ⟶ᵐ Y} : HomEquiv f g → HomEquiv g h → HomEquiv f h
| comp {X Y Z} {f f' : X ⟶ᵐ Y} {g g' : Y ⟶ᵐ Z} :
HomEquiv f f' → HomEquiv g g' → HomEquiv (f.comp g) (f'.comp g')
| whiskerLeft (X) {Y Z} (f f' : Y ⟶ᵐ Z) :
HomEquiv f f' → HomEquiv (f.whiskerLeft X) (f'.whiskerLeft X)
| whiskerRight {Y Z} (f f' : Y ⟶ᵐ Z) (X) :
HomEquiv f f' → HomEquiv (f.whiskerRight X) (f'.whiskerRight X)
| tensor {W X Y Z} {f f' : W ⟶ᵐ X} {g g' : Y ⟶ᵐ Z} :
HomEquiv f f' → HomEquiv g g' → HomEquiv (f.tensor g) (f'.tensor g')
| tensorHom_def {X₁ Y₁ X₂ Y₂} (f : X₁ ⟶ᵐ Y₁) (g : X₂ ⟶ᵐ Y₂) :
HomEquiv (f.tensor g) ((f.whiskerRight X₂).comp (g.whiskerLeft Y₁))
| comp_id {X Y} (f : X ⟶ᵐ Y) : HomEquiv (f.comp (Hom.id _)) f
| id_comp {X Y} (f : X ⟶ᵐ Y) : HomEquiv ((Hom.id _).comp f) f
| assoc {X Y U V : F C} (f : X ⟶ᵐ U) (g : U ⟶ᵐ V) (h : V ⟶ᵐ Y) :
HomEquiv ((f.comp g).comp h) (f.comp (g.comp h))
| id_tensorHom_id {X Y} : HomEquiv ((Hom.id X).tensor (Hom.id Y)) (Hom.id _)
| tensorHom_comp_tensorHom {X₁ Y₁ Z₁ X₂ Y₂ Z₂ : F C} (f₁ : X₁ ⟶ᵐ Y₁) (f₂ : X₂ ⟶ᵐ Y₂)
(g₁ : Y₁ ⟶ᵐ Z₁) (g₂ : Y₂ ⟶ᵐ Z₂) :
HomEquiv ((f₁.tensor f₂).comp (g₁.tensor g₂)) ((f₁.comp g₁).tensor (f₂.comp g₂))
| whiskerLeft_id (X Y) : HomEquiv ((Hom.id Y).whiskerLeft X) (Hom.id (X.tensor Y))
| id_whiskerRight (X Y) : HomEquiv ((Hom.id X).whiskerRight Y) (Hom.id (X.tensor Y))
| α_hom_inv {X Y Z} : HomEquiv ((Hom.α_hom X Y Z).comp (Hom.α_inv X Y Z)) (Hom.id _)
| α_inv_hom {X Y Z} : HomEquiv ((Hom.α_inv X Y Z).comp (Hom.α_hom X Y Z)) (Hom.id _)
| associator_naturality {X₁ X₂ X₃ Y₁ Y₂ Y₃} (f₁ : X₁ ⟶ᵐ Y₁) (f₂ : X₂ ⟶ᵐ Y₂) (f₃ : X₃ ⟶ᵐ Y₃) :
HomEquiv (((f₁.tensor f₂).tensor f₃).comp (Hom.α_hom Y₁ Y₂ Y₃))
((Hom.α_hom X₁ X₂ X₃).comp (f₁.tensor (f₂.tensor f₃)))
| ρ_hom_inv {X} : HomEquiv ((Hom.ρ_hom X).comp (Hom.ρ_inv X)) (Hom.id _)
| ρ_inv_hom {X} : HomEquiv ((Hom.ρ_inv X).comp (Hom.ρ_hom X)) (Hom.id _)
| ρ_naturality {X Y} (f : X ⟶ᵐ Y) :
HomEquiv ((f.whiskerRight unit).comp (Hom.ρ_hom Y)) ((Hom.ρ_hom X).comp f)
| l_hom_inv {X} : HomEquiv ((Hom.l_hom X).comp (Hom.l_inv X)) (Hom.id _)
| l_inv_hom {X} : HomEquiv ((Hom.l_inv X).comp (Hom.l_hom X)) (Hom.id _)
| l_naturality {X Y} (f : X ⟶ᵐ Y) :
HomEquiv ((f.whiskerLeft unit).comp (Hom.l_hom Y)) ((Hom.l_hom X).comp f)
| pentagon {W X Y Z} :
HomEquiv
(((Hom.α_hom W X Y).whiskerRight Z).comp
((Hom.α_hom W (X.tensor Y) Z).comp ((Hom.α_hom X Y Z).whiskerLeft W)))
((Hom.α_hom (W.tensor X) Y Z).comp (Hom.α_hom W X (Y.tensor Z)))
| triangle {X Y} :
HomEquiv ((Hom.α_hom X unit Y).comp ((Hom.l_hom Y).whiskerLeft X))
((Hom.ρ_hom X).whiskerRight Y)
/-- We say that two formal morphisms in the free monoidal category are equivalent if they become
equal if we apply the relations that are true in a monoidal category. Note that we will prove
that there is only one equivalence class -- this is the monoidal coherence theorem. -/
def setoidHom (X Y : F C) : Setoid (X ⟶ᵐ Y) :=
⟨HomEquiv, ⟨HomEquiv.refl, HomEquiv.symm _ _, HomEquiv.trans⟩⟩
attribute [instance] setoidHom
section
open FreeMonoidalCategory.HomEquiv
instance categoryFreeMonoidalCategory : Category.{u} (F C) where
Hom X Y := Quotient (FreeMonoidalCategory.setoidHom X Y)
id X := ⟦Hom.id X⟧
comp := Quotient.map₂ Hom.comp (fun _ _ hf _ _ hg ↦ HomEquiv.comp hf hg)
id_comp := by
rintro X Y ⟨f⟩
exact Quotient.sound (id_comp f)
comp_id := by
rintro X Y ⟨f⟩
exact Quotient.sound (comp_id f)
assoc := by
rintro W X Y Z ⟨f⟩ ⟨g⟩ ⟨h⟩
exact Quotient.sound (assoc f g h)
instance : MonoidalCategory (F C) where
tensorObj X Y := FreeMonoidalCategory.tensor X Y
tensorHom := Quotient.map₂ Hom.tensor (fun _ _ hf _ _ hg ↦ HomEquiv.tensor hf hg)
whiskerLeft X _ _ f := Quot.map (fun f ↦ Hom.whiskerLeft X f) (fun f f' ↦ .whiskerLeft X f f') f
whiskerRight f Y := Quot.map (fun f ↦ Hom.whiskerRight f Y) (fun f f' ↦ .whiskerRight f f' Y) f
tensorHom_def {W X Y Z} := by
rintro ⟨f⟩ ⟨g⟩
exact Quotient.sound (tensorHom_def _ _)
id_tensorHom_id _ _ := Quot.sound id_tensorHom_id
tensorHom_comp_tensorHom {X₁ Y₁ Z₁ X₂ Y₂ Z₂} := by
rintro ⟨f₁⟩ ⟨f₂⟩ ⟨g₁⟩ ⟨g₂⟩
exact Quotient.sound (tensorHom_comp_tensorHom _ _ _ _)
whiskerLeft_id X Y := Quot.sound (HomEquiv.whiskerLeft_id X Y)
id_whiskerRight X Y := Quot.sound (HomEquiv.id_whiskerRight X Y)
tensorUnit := FreeMonoidalCategory.unit
associator X Y Z :=
⟨⟦Hom.α_hom X Y Z⟧, ⟦Hom.α_inv X Y Z⟧, Quotient.sound α_hom_inv, Quotient.sound α_inv_hom⟩
associator_naturality {X₁ X₂ X₃ Y₁ Y₂ Y₃} := by
rintro ⟨f₁⟩ ⟨f₂⟩ ⟨f₃⟩
exact Quotient.sound (associator_naturality _ _ _)
leftUnitor X := ⟨⟦Hom.l_hom X⟧, ⟦Hom.l_inv X⟧, Quotient.sound l_hom_inv, Quotient.sound l_inv_hom⟩
leftUnitor_naturality {X Y} := by
rintro ⟨f⟩
exact Quotient.sound (l_naturality _)
rightUnitor X :=
⟨⟦Hom.ρ_hom X⟧, ⟦Hom.ρ_inv X⟧, Quotient.sound ρ_hom_inv, Quotient.sound ρ_inv_hom⟩
rightUnitor_naturality {X Y} := by
rintro ⟨f⟩
exact Quotient.sound (ρ_naturality _)
pentagon _ _ _ _ := Quotient.sound pentagon
triangle _ _ := Quotient.sound triangle
@[simp]
theorem mk_comp {X Y Z : F C} (f : X ⟶ᵐ Y) (g : Y ⟶ᵐ Z) :
⟦f.comp g⟧ = @CategoryStruct.comp (F C) _ _ _ _ ⟦f⟧ ⟦g⟧ :=
rfl
@[simp]
theorem mk_tensor {X₁ Y₁ X₂ Y₂ : F C} (f : X₁ ⟶ᵐ Y₁) (g : X₂ ⟶ᵐ Y₂) :
⟦f.tensor g⟧ = @MonoidalCategory.tensorHom (F C) _ _ _ _ _ _ ⟦f⟧ ⟦g⟧ :=
rfl
@[simp]
theorem mk_whiskerLeft (X : F C) {Y₁ Y₂ : F C} (f : Y₁ ⟶ᵐ Y₂) :
⟦f.whiskerLeft X⟧ = MonoidalCategory.whiskerLeft (C := F C) (X := X) (f := ⟦f⟧) :=
rfl
@[simp]
theorem mk_whiskerRight {X₁ X₂ : F C} (f : X₁ ⟶ᵐ X₂) (Y : F C) :
⟦f.whiskerRight Y⟧ = MonoidalCategory.whiskerRight (C := F C) (f := ⟦f⟧) (Y := Y) :=
rfl
@[simp]
theorem mk_id {X : F C} : ⟦Hom.id X⟧ = 𝟙 X :=
rfl
@[simp]
theorem mk_α_hom {X Y Z : F C} : ⟦Hom.α_hom X Y Z⟧ = (α_ X Y Z).hom :=
rfl
@[simp]
theorem mk_α_inv {X Y Z : F C} : ⟦Hom.α_inv X Y Z⟧ = (α_ X Y Z).inv :=
rfl
@[simp]
theorem mk_ρ_hom {X : F C} : ⟦Hom.ρ_hom X⟧ = (ρ_ X).hom :=
rfl
@[simp]
theorem mk_ρ_inv {X : F C} : ⟦Hom.ρ_inv X⟧ = (ρ_ X).inv :=
rfl
@[simp]
theorem mk_l_hom {X : F C} : ⟦Hom.l_hom X⟧ = (λ_ X).hom :=
rfl
@[simp]
theorem mk_l_inv {X : F C} : ⟦Hom.l_inv X⟧ = (λ_ X).inv :=
rfl
@[simp]
theorem tensor_eq_tensor {X Y : F C} : X.tensor Y = X ⊗ Y :=
rfl
@[simp]
theorem unit_eq_unit : FreeMonoidalCategory.unit = 𝟙_ (F C) :=
rfl
/-- The abbreviation for `⟦f⟧`. -/
/- This is useful since the notation `⟦f⟧` often behaves like an element of the quotient set,
but not like a morphism. This is why we need weird `@CategoryStruct.comp (F C) ...` in the
statement in `mk_comp` above. -/
abbrev homMk {X Y : F C} (f : X ⟶ᵐ Y) : X ⟶ Y := ⟦f⟧
theorem Hom.inductionOn {motive : {X Y : F C} → (X ⟶ Y) → Prop} {X Y : F C} (t : X ⟶ Y)
(id : (X : F C) → motive (𝟙 X))
(α_hom : (X Y Z : F C) → motive (α_ X Y Z).hom)
(α_inv : (X Y Z : F C) → motive (α_ X Y Z).inv)
(l_hom : (X : F C) → motive (λ_ X).hom)
(l_inv : (X : F C) → motive (λ_ X).inv)
(ρ_hom : (X : F C) → motive (ρ_ X).hom)
(ρ_inv : (X : F C) → motive (ρ_ X).inv)
(comp : {X Y Z : F C} → (f : X ⟶ Y) → (g : Y ⟶ Z) → motive f → motive g → motive (f ≫ g))
(whiskerLeft : (X : F C) → {Y Z : F C} → (f : Y ⟶ Z) → motive f → motive (X ◁ f))
(whiskerRight : {X Y : F C} → (f : X ⟶ Y) → (Z : F C) → motive f → motive (f ▷ Z)) :
motive t := by
apply Quotient.inductionOn
intro f
induction f with
| id X => exact id X
| α_hom X Y Z => exact α_hom X Y Z
| α_inv X Y Z => exact α_inv X Y Z
| l_hom X => exact l_hom X
| l_inv X => exact l_inv X
| ρ_hom X => exact ρ_hom X
| ρ_inv X => exact ρ_inv X
| comp f g hf hg => exact comp _ _ (hf ⟦f⟧) (hg ⟦g⟧)
| whiskerLeft X f hf => exact whiskerLeft X _ (hf ⟦f⟧)
| whiskerRight f X hf => exact whiskerRight _ X (hf ⟦f⟧)
| @tensor W X Y Z f g hf hg =>
have : homMk f ⊗ₘ homMk g = homMk f ▷ X ≫ Y ◁ homMk g :=
Quotient.sound (HomEquiv.tensorHom_def f g)
change motive (homMk f ⊗ₘ homMk g)
rw [this]
exact comp _ _ (whiskerRight _ _ (hf ⟦f⟧)) (whiskerLeft _ _ (hg ⟦g⟧))
section Functor
variable {D : Type u'} [Category.{v'} D] [MonoidalCategory D] (f : C → D)
/-- Auxiliary definition for `free_monoidal_category.project`. -/
def projectObj : F C → D
| FreeMonoidalCategory.of X => f X
| FreeMonoidalCategory.unit => 𝟙_ D
| FreeMonoidalCategory.tensor X Y => projectObj X ⊗ projectObj Y
section
open Hom
/-- Auxiliary definition for `FreeMonoidalCategory.project`. -/
@[simp]
def projectMapAux : ∀ {X Y : F C}, (X ⟶ᵐ Y) → (projectObj f X ⟶ projectObj f Y)
| _, _, Hom.id _ => 𝟙 _
| _, _, α_hom _ _ _ => (α_ _ _ _).hom
| _, _, α_inv _ _ _ => (α_ _ _ _).inv
| _, _, l_hom _ => (λ_ _).hom
| _, _, l_inv _ => (λ_ _).inv
| _, _, ρ_hom _ => (ρ_ _).hom
| _, _, ρ_inv _ => (ρ_ _).inv
| _, _, Hom.comp f g => projectMapAux f ≫ projectMapAux g
| _, _, Hom.whiskerLeft X p => projectObj f X ◁ projectMapAux p
| _, _, Hom.whiskerRight p X => projectMapAux p ▷ projectObj f X
| _, _, Hom.tensor f g => projectMapAux f ⊗ₘ projectMapAux g
/-- Auxiliary definition for `FreeMonoidalCategory.project`. -/
@[simp]
def projectMap (X Y : F C) : (X ⟶ Y) → (projectObj f X ⟶ projectObj f Y) :=
Quotient.lift (projectMapAux f) <| by
intro f g h
induction h with
| refl => rfl
| symm _ _ _ hfg' => exact hfg'.symm
| trans _ _ hfg hgh => exact hfg.trans hgh
| comp _ _ hf hg => dsimp only [projectMapAux]; rw [hf, hg]
| whiskerLeft _ _ _ _ hf => dsimp only [projectMapAux, projectObj]; rw [hf]
| whiskerRight _ _ _ _ hf => dsimp only [projectMapAux, projectObj]; rw [hf]
| tensor _ _ hfg hfg' => dsimp only [projectMapAux]; rw [hfg, hfg']
| tensorHom_def _ _ =>
dsimp only [projectMapAux, projectObj]; rw [MonoidalCategory.tensorHom_def]
| comp_id => dsimp only [projectMapAux]; rw [Category.comp_id]
| id_comp => dsimp only [projectMapAux]; rw [Category.id_comp]
| assoc => dsimp only [projectMapAux]; rw [Category.assoc]
| id_tensorHom_id => dsimp only [projectMapAux]; rw [MonoidalCategory.id_tensorHom_id]; rfl
| tensorHom_comp_tensorHom =>
dsimp only [projectMapAux]; rw [MonoidalCategory.tensorHom_comp_tensorHom]
| whiskerLeft_id =>
dsimp only [projectMapAux, projectObj]
rw [MonoidalCategory.whiskerLeft_id]
| id_whiskerRight =>
dsimp only [projectMapAux, projectObj]
rw [MonoidalCategory.id_whiskerRight]
| α_hom_inv => dsimp only [projectMapAux]; rw [Iso.hom_inv_id]
| α_inv_hom => dsimp only [projectMapAux]; rw [Iso.inv_hom_id]
| associator_naturality =>
dsimp only [projectMapAux]; rw [MonoidalCategory.associator_naturality]
| ρ_hom_inv => dsimp only [projectMapAux]; rw [Iso.hom_inv_id]
| ρ_inv_hom => dsimp only [projectMapAux]; rw [Iso.inv_hom_id]
| ρ_naturality =>
dsimp only [projectMapAux, projectObj]
rw [MonoidalCategory.rightUnitor_naturality]
| l_hom_inv => dsimp only [projectMapAux]; rw [Iso.hom_inv_id]
| l_inv_hom => dsimp only [projectMapAux]; rw [Iso.inv_hom_id]
| l_naturality =>
dsimp only [projectMapAux, projectObj]
rw [MonoidalCategory.leftUnitor_naturality]
| pentagon =>
dsimp only [projectMapAux, projectObj]
rw [MonoidalCategory.pentagon]
| triangle =>
dsimp only [projectMapAux, projectObj]
rw [MonoidalCategory.triangle]
end
/-- If `D` is a monoidal category and we have a function `C → D`, then we have a
monoidal functor from the free monoidal category over `C` to the category `D`. -/
def project : F C ⥤ D where
obj := projectObj f
map := projectMap f _ _
map_comp := by rintro _ _ _ ⟨_⟩ ⟨_⟩; rfl
instance : (project f).Monoidal :=
Functor.CoreMonoidal.toMonoidal
{ εIso := Iso.refl _
μIso := fun _ _ ↦ Iso.refl _
-- Porting note: `μIso_hom_natural_left` was proved in mathlib3 by tidy, using induction.
-- We probably don't expect `cat_disch` to handle this yet, see https://leanprover.zulipchat.com/#narrow/stream/287929-mathlib4/topic/Aesop.20and.20cases
μIso_hom_natural_left := fun f _ => by
induction f using Quotient.recOn
all_goals aesop
μIso_hom_natural_right := fun _ f => by
induction f using Quotient.recOn
all_goals aesop }
end Functor
end
end FreeMonoidalCategory
end CategoryTheory |
.lake/packages/mathlib/Mathlib/CategoryTheory/Monoidal/Rigid/OfEquivalence.lean | import Mathlib.CategoryTheory.Monoidal.Rigid.Basic
/-!
# Transport rigid structures over a monoidal equivalence.
-/
namespace CategoryTheory
open MonoidalCategory Functor.LaxMonoidal Functor.OplaxMonoidal
variable {C D : Type*} [Category C] [Category D] [MonoidalCategory C] [MonoidalCategory D]
(F : C ⥤ D) [F.Monoidal]
/-- Given candidate data for an exact pairing,
which is sent by a faithful monoidal functor to an exact pairing,
the equations holds automatically. -/
def ExactPairing.ofFaithful [F.Faithful] {X Y : C} (eval : Y ⊗ X ⟶ 𝟙_ C)
(coeval : 𝟙_ C ⟶ X ⊗ Y) [ExactPairing (F.obj X) (F.obj Y)]
(map_eval : F.map eval = (δ F _ _) ≫ ε_ _ _ ≫ ε F)
(map_coeval : F.map coeval = (η F) ≫ η_ _ _ ≫ μ F _ _) : ExactPairing X Y where
evaluation' := eval
coevaluation' := coeval
evaluation_coevaluation' :=
F.map_injective <| by
simp [map_eval, map_coeval, Functor.Monoidal.map_whiskerLeft,
Functor.Monoidal.map_whiskerRight]
coevaluation_evaluation' :=
F.map_injective <| by
simp [map_eval, map_coeval, Functor.Monoidal.map_whiskerLeft,
Functor.Monoidal.map_whiskerRight]
/-- Given a pair of objects which are sent by a fully faithful functor to a pair of objects
with an exact pairing, we get an exact pairing.
-/
noncomputable def ExactPairing.ofFullyFaithful [F.Full] [F.Faithful] (X Y : C)
[ExactPairing (F.obj X) (F.obj Y)] : ExactPairing X Y :=
.ofFaithful F (F.preimage (δ F _ _ ≫ ε_ _ _ ≫ (ε F)))
(F.preimage (η F ≫ η_ _ _ ≫ μ F _ _)) (by simp) (by simp)
@[deprecated (since := "2025-10-17")] alias exactPairingOfFaithful := ExactPairing.ofFaithful
@[deprecated (since := "2025-10-17")]
alias exactPairingOfFullyFaithful := ExactPairing.ofFullyFaithful
variable {F}
variable {G : D ⥤ C} (adj : F ⊣ G) [F.IsEquivalence]
noncomputable section
/-- Pull back a left dual along an equivalence. -/
def hasLeftDualOfEquivalence (X : C) [HasLeftDual (F.obj X)] :
HasLeftDual X where
leftDual := G.obj (ᘁ(F.obj X))
exact := by
letI := exactPairingCongrLeft (X := F.obj (G.obj ᘁ(F.obj X)))
(X' := ᘁ(F.obj X)) (Y := F.obj X) (adj.toEquivalence.counitIso.app ᘁ(F.obj X))
apply ExactPairing.ofFullyFaithful F
/-- Pull back a right dual along an equivalence. -/
def hasRightDualOfEquivalence (X : C) [HasRightDual (F.obj X)] :
HasRightDual X where
rightDual := G.obj ((F.obj X)ᘁ)
exact := by
letI := exactPairingCongrRight (X := F.obj X) (Y := F.obj (G.obj (F.obj X)ᘁ))
(Y' := (F.obj X)ᘁ) (adj.toEquivalence.counitIso.app (F.obj X)ᘁ)
apply ExactPairing.ofFullyFaithful F
/-- Pull back a left rigid structure along an equivalence. -/
def leftRigidCategoryOfEquivalence [LeftRigidCategory D] :
LeftRigidCategory C where leftDual X := hasLeftDualOfEquivalence adj X
/-- Pull back a right rigid structure along an equivalence. -/
def rightRigidCategoryOfEquivalence [RightRigidCategory D] :
RightRigidCategory C where rightDual X := hasRightDualOfEquivalence adj X
/-- Pull back a rigid structure along an equivalence. -/
def rigidCategoryOfEquivalence [RigidCategory D] : RigidCategory C where
leftDual X := hasLeftDualOfEquivalence adj X
rightDual X := hasRightDualOfEquivalence adj X
end
end CategoryTheory |
.lake/packages/mathlib/Mathlib/CategoryTheory/Monoidal/Rigid/Basic.lean | import Mathlib.Tactic.CategoryTheory.Monoidal.Basic
import Mathlib.CategoryTheory.Closed.Monoidal
import Mathlib.Tactic.ApplyFun
/-!
# Rigid (autonomous) monoidal categories
This file defines rigid (autonomous) monoidal categories and the necessary theory about
exact pairings and duals.
## Main definitions
* `ExactPairing` of two objects of a monoidal category
* Type classes `HasLeftDual` and `HasRightDual` that capture that a pairing exists
* The `rightAdjointMate f` as a morphism `fᘁ : Yᘁ ⟶ Xᘁ` for a morphism `f : X ⟶ Y`
* The classes of `RightRigidCategory`, `LeftRigidCategory` and `RigidCategory`
## Main statements
* `comp_rightAdjointMate`: The adjoint mates of the composition is the composition of
adjoint mates.
## Notation
* `η_` and `ε_` denote the coevaluation and evaluation morphism of an exact pairing.
* `Xᘁ` and `ᘁX` denote the right and left dual of an object, as well as the adjoint
mate of a morphism.
## Future work
* Show that `X ⊗ Y` and `Yᘁ ⊗ Xᘁ` form an exact pairing.
* Show that the left adjoint mate of the right adjoint mate of a morphism is the morphism itself.
* Simplify constructions in the case where a symmetry or braiding is present.
* Show that `ᘁ` gives an equivalence of categories `C ≅ (Cᵒᵖ)ᴹᵒᵖ`.
* Define pivotal categories (rigid categories equipped with a natural isomorphism `ᘁᘁ ≅ 𝟙 C`).
## Notes
Although we construct the adjunction `tensorLeft Y ⊣ tensorLeft X` from `ExactPairing X Y`,
this is not a bijective correspondence.
I think the correct statement is that `tensorLeft Y` and `tensorLeft X` are
module endofunctors of `C` as a right `C` module category,
and `ExactPairing X Y` is in bijection with adjunctions compatible with this right `C` action.
## References
* <https://ncatlab.org/nlab/show/rigid+monoidal+category>
## Tags
rigid category, monoidal category
-/
open CategoryTheory MonoidalCategory
universe v v₁ v₂ v₃ u u₁ u₂ u₃
noncomputable section
namespace CategoryTheory
variable {C : Type u₁} [Category.{v₁} C] [MonoidalCategory C]
/-- An exact pairing is a pair of objects `X Y : C` which admit
a coevaluation and evaluation morphism which fulfill two triangle equalities. -/
class ExactPairing (X Y : C) where
/-- Coevaluation of an exact pairing.
Do not use directly. Use `ExactPairing.coevaluation` instead. -/
coevaluation' : 𝟙_ C ⟶ X ⊗ Y
/-- Evaluation of an exact pairing.
Do not use directly. Use `ExactPairing.evaluation` instead. -/
evaluation' : Y ⊗ X ⟶ 𝟙_ C
coevaluation_evaluation' :
Y ◁ coevaluation' ≫ (α_ _ _ _).inv ≫ evaluation' ▷ Y = (ρ_ Y).hom ≫ (λ_ Y).inv := by
cat_disch
evaluation_coevaluation' :
coevaluation' ▷ X ≫ (α_ _ _ _).hom ≫ X ◁ evaluation' = (λ_ X).hom ≫ (ρ_ X).inv := by
cat_disch
namespace ExactPairing
-- Porting note: as there is no mechanism equivalent to `[]` in Lean 3 to make
-- arguments for class fields explicit,
-- we now repeat all the fields without primes.
-- See https://leanprover.zulipchat.com/#narrow/stream/287929-mathlib4/topic/Making.20variable.20in.20class.20field.20explicit
variable (X Y : C)
variable [ExactPairing X Y]
/-- Coevaluation of an exact pairing. -/
def coevaluation : 𝟙_ C ⟶ X ⊗ Y := @coevaluation' _ _ _ X Y _
/-- Evaluation of an exact pairing. -/
def evaluation : Y ⊗ X ⟶ 𝟙_ C := @evaluation' _ _ _ X Y _
@[inherit_doc] notation "η_" => ExactPairing.coevaluation
@[inherit_doc] notation "ε_" => ExactPairing.evaluation
lemma coevaluation_evaluation :
Y ◁ η_ _ _ ≫ (α_ _ _ _).inv ≫ ε_ X _ ▷ Y = (ρ_ Y).hom ≫ (λ_ Y).inv :=
coevaluation_evaluation'
lemma evaluation_coevaluation :
η_ _ _ ▷ X ≫ (α_ _ _ _).hom ≫ X ◁ ε_ _ Y = (λ_ X).hom ≫ (ρ_ X).inv :=
evaluation_coevaluation'
lemma coevaluation_evaluation'' :
Y ◁ η_ X Y ⊗≫ ε_ X Y ▷ Y = ⊗𝟙.hom := by
convert coevaluation_evaluation X Y <;> simp [monoidalComp]
lemma evaluation_coevaluation'' :
η_ X Y ▷ X ⊗≫ X ◁ ε_ X Y = ⊗𝟙.hom := by
convert evaluation_coevaluation X Y <;> simp [monoidalComp]
end ExactPairing
attribute [reassoc (attr := simp)] ExactPairing.coevaluation_evaluation
attribute [reassoc (attr := simp)] ExactPairing.evaluation_coevaluation
instance exactPairingUnit : ExactPairing (𝟙_ C) (𝟙_ C) where
coevaluation' := (ρ_ _).inv
evaluation' := (ρ_ _).hom
coevaluation_evaluation' := by monoidal_coherence
evaluation_coevaluation' := by monoidal_coherence
/-- A class of objects which have a right dual. -/
class HasRightDual (X : C) where
/-- The right dual of the object `X`. -/
rightDual : C
[exact : ExactPairing X rightDual]
/-- A class of objects which have a left dual. -/
class HasLeftDual (Y : C) where
/-- The left dual of the object `X`. -/
leftDual : C
[exact : ExactPairing leftDual Y]
attribute [instance] HasRightDual.exact
attribute [instance] HasLeftDual.exact
open ExactPairing HasRightDual HasLeftDual MonoidalCategory
#adaptation_note /-- https://github.com/leanprover/lean4/pull/4596
The overlapping notation for `leftDual` and `leftAdjointMate` become more problematic in
after https://github.com/leanprover/lean4/pull/4596, and we sometimes have to disambiguate with
e.g. `(ᘁX : C)` where previously just `ᘁX` was enough. -/
@[inherit_doc] prefix:1024 "ᘁ" => leftDual
@[inherit_doc] postfix:1024 "ᘁ" => rightDual
instance hasRightDualUnit : HasRightDual (𝟙_ C) where
rightDual := 𝟙_ C
instance hasLeftDualUnit : HasLeftDual (𝟙_ C) where
leftDual := 𝟙_ C
instance hasRightDualLeftDual {X : C} [HasLeftDual X] : HasRightDual ᘁX where
rightDual := X
instance hasLeftDualRightDual {X : C} [HasRightDual X] : HasLeftDual Xᘁ where
leftDual := X
@[simp]
theorem leftDual_rightDual {X : C} [HasRightDual X] : ᘁXᘁ = X :=
rfl
@[simp]
theorem rightDual_leftDual {X : C} [HasLeftDual X] : (ᘁX)ᘁ = X :=
rfl
/-- The right adjoint mate `fᘁ : Xᘁ ⟶ Yᘁ` of a morphism `f : X ⟶ Y`. -/
def rightAdjointMate {X Y : C} [HasRightDual X] [HasRightDual Y] (f : X ⟶ Y) : Yᘁ ⟶ Xᘁ :=
(ρ_ _).inv ≫ _ ◁ η_ _ _ ≫ _ ◁ f ▷ _ ≫ (α_ _ _ _).inv ≫ ε_ _ _ ▷ _ ≫ (λ_ _).hom
/-- The left adjoint mate `ᘁf : ᘁY ⟶ ᘁX` of a morphism `f : X ⟶ Y`. -/
def leftAdjointMate {X Y : C} [HasLeftDual X] [HasLeftDual Y] (f : X ⟶ Y) : ᘁY ⟶ ᘁX :=
(λ_ _).inv ≫ η_ (ᘁX) X ▷ _ ≫ (_ ◁ f) ▷ _ ≫ (α_ _ _ _).hom ≫ _ ◁ ε_ _ _ ≫ (ρ_ _).hom
@[inherit_doc] notation f "ᘁ" => rightAdjointMate f
@[inherit_doc] notation "ᘁ" f => leftAdjointMate f
@[simp]
theorem rightAdjointMate_id {X : C} [HasRightDual X] : (𝟙 X)ᘁ = 𝟙 (Xᘁ) := by
simp [rightAdjointMate]
@[simp]
theorem leftAdjointMate_id {X : C} [HasLeftDual X] : (ᘁ(𝟙 X)) = 𝟙 (ᘁX) := by
simp [leftAdjointMate]
theorem rightAdjointMate_comp {X Y Z : C} [HasRightDual X] [HasRightDual Y] {f : X ⟶ Y}
{g : Xᘁ ⟶ Z} :
fᘁ ≫ g =
(ρ_ (Yᘁ)).inv ≫
_ ◁ η_ X (Xᘁ) ≫ _ ◁ (f ⊗ₘ g) ≫ (α_ (Yᘁ) Y Z).inv ≫ ε_ Y (Yᘁ) ▷ _ ≫ (λ_ Z).hom :=
calc
_ = 𝟙 _ ⊗≫ (Yᘁ : C) ◁ η_ X Xᘁ ≫ Yᘁ ◁ f ▷ Xᘁ ⊗≫ (ε_ Y Yᘁ ▷ Xᘁ ≫ 𝟙_ C ◁ g) ⊗≫ 𝟙 _ := by
dsimp only [rightAdjointMate]; monoidal
_ = _ := by
rw [← whisker_exchange, tensorHom_def]; monoidal
theorem leftAdjointMate_comp {X Y Z : C} [HasLeftDual X] [HasLeftDual Y] {f : X ⟶ Y}
{g : (ᘁX) ⟶ Z} :
(ᘁf) ≫ g =
(λ_ _).inv ≫
η_ (ᘁX : C) X ▷ _ ≫ (g ⊗ₘ f) ▷ _ ≫ (α_ _ _ _).hom ≫ _ ◁ ε_ _ _ ≫ (ρ_ _).hom :=
calc
_ = 𝟙 _ ⊗≫ η_ (ᘁX : C) X ▷ (ᘁY) ⊗≫ (ᘁX) ◁ f ▷ (ᘁY) ⊗≫ ((ᘁX) ◁ ε_ (ᘁY) Y ≫ g ▷ 𝟙_ C) ⊗≫ 𝟙 _ := by
dsimp only [leftAdjointMate]; monoidal
_ = _ := by
rw [whisker_exchange, tensorHom_def']; monoidal
/-- The composition of right adjoint mates is the adjoint mate of the composition. -/
@[reassoc]
theorem comp_rightAdjointMate {X Y Z : C} [HasRightDual X] [HasRightDual Y] [HasRightDual Z]
{f : X ⟶ Y} {g : Y ⟶ Z} : (f ≫ g)ᘁ = gᘁ ≫ fᘁ := by
rw [rightAdjointMate_comp]
simp only [rightAdjointMate, comp_whiskerRight]
simp only [← Category.assoc]; congr 3; simp only [Category.assoc]
simp only [← MonoidalCategory.whiskerLeft_comp]; congr 2
symm
calc
_ = 𝟙 _ ⊗≫ (η_ Y Yᘁ ▷ 𝟙_ C ≫ (Y ⊗ Yᘁ) ◁ η_ X Xᘁ) ⊗≫ Y ◁ Yᘁ ◁ f ▷ Xᘁ ⊗≫
Y ◁ ε_ Y Yᘁ ▷ Xᘁ ⊗≫ g ▷ Xᘁ ⊗≫ 𝟙 _ := by
rw [tensorHom_def']; monoidal
_ = η_ X Xᘁ ⊗≫ (η_ Y Yᘁ ▷ (X ⊗ Xᘁ) ≫ (Y ⊗ Yᘁ) ◁ f ▷ Xᘁ) ⊗≫
Y ◁ ε_ Y Yᘁ ▷ Xᘁ ⊗≫ g ▷ Xᘁ ⊗≫ 𝟙 _ := by
rw [← whisker_exchange]; monoidal
_ = η_ X Xᘁ ⊗≫ f ▷ Xᘁ ⊗≫ (η_ Y Yᘁ ▷ Y ⊗≫ Y ◁ ε_ Y Yᘁ) ▷ Xᘁ ⊗≫ g ▷ Xᘁ ⊗≫ 𝟙 _ := by
rw [← whisker_exchange]; monoidal
_ = η_ X Xᘁ ≫ f ▷ Xᘁ ≫ g ▷ Xᘁ := by
rw [evaluation_coevaluation'']; monoidal
/-- The composition of left adjoint mates is the adjoint mate of the composition. -/
@[reassoc]
theorem comp_leftAdjointMate {X Y Z : C} [HasLeftDual X] [HasLeftDual Y] [HasLeftDual Z] {f : X ⟶ Y}
{g : Y ⟶ Z} : (ᘁf ≫ g) = (ᘁg) ≫ ᘁf := by
rw [leftAdjointMate_comp]
simp only [leftAdjointMate, MonoidalCategory.whiskerLeft_comp]
simp only [← Category.assoc]; congr 3; simp only [Category.assoc]
simp only [← comp_whiskerRight]; congr 2
symm
calc
_ = 𝟙 _ ⊗≫ ((𝟙_ C) ◁ η_ (ᘁY) Y ≫ η_ (ᘁX) X ▷ ((ᘁY) ⊗ Y)) ⊗≫ (ᘁX) ◁ f ▷ (ᘁY) ▷ Y ⊗≫
(ᘁX) ◁ ε_ (ᘁY) Y ▷ Y ⊗≫ (ᘁX) ◁ g := by
rw [tensorHom_def]; monoidal
_ = η_ (ᘁX) X ⊗≫ (((ᘁX) ⊗ X) ◁ η_ (ᘁY) Y ≫ ((ᘁX) ◁ f) ▷ ((ᘁY) ⊗ Y)) ⊗≫
(ᘁX) ◁ ε_ (ᘁY) Y ▷ Y ⊗≫ (ᘁX) ◁ g := by
rw [whisker_exchange]; monoidal
_ = η_ (ᘁX) X ⊗≫ ((ᘁX) ◁ f) ⊗≫ (ᘁX) ◁ (Y ◁ η_ (ᘁY) Y ⊗≫ ε_ (ᘁY) Y ▷ Y) ⊗≫ (ᘁX) ◁ g := by
rw [whisker_exchange]; monoidal
_ = η_ (ᘁX) X ≫ (ᘁX) ◁ f ≫ (ᘁX) ◁ g := by
rw [coevaluation_evaluation'']; monoidal
/-- Given an exact pairing on `Y Y'`,
we get a bijection on hom-sets `(Y' ⊗ X ⟶ Z) ≃ (X ⟶ Y ⊗ Z)`
by "pulling the string on the left" up or down.
This gives the adjunction `tensorLeftAdjunction Y Y' : tensorLeft Y' ⊣ tensorLeft Y`.
This adjunction is often referred to as "Frobenius reciprocity" in the
fusion categories / planar algebras / subfactors literature.
-/
def tensorLeftHomEquiv (X Y Y' Z : C) [ExactPairing Y Y'] : (Y' ⊗ X ⟶ Z) ≃ (X ⟶ Y ⊗ Z) where
toFun f := (λ_ _).inv ≫ η_ _ _ ▷ _ ≫ (α_ _ _ _).hom ≫ _ ◁ f
invFun f := Y' ◁ f ≫ (α_ _ _ _).inv ≫ ε_ _ _ ▷ _ ≫ (λ_ _).hom
left_inv f := by
calc
_ = 𝟙 _ ⊗≫ Y' ◁ η_ Y Y' ▷ X ⊗≫ ((Y' ⊗ Y) ◁ f ≫ ε_ Y Y' ▷ Z) ⊗≫ 𝟙 _ := by
monoidal
_ = 𝟙 _ ⊗≫ (Y' ◁ η_ Y Y' ⊗≫ ε_ Y Y' ▷ Y') ▷ X ⊗≫ f := by
rw [whisker_exchange]; monoidal
_ = f := by
rw [coevaluation_evaluation'']; monoidal
right_inv f := by
calc
_ = 𝟙 _ ⊗≫ (η_ Y Y' ▷ X ≫ (Y ⊗ Y') ◁ f) ⊗≫ Y ◁ ε_ Y Y' ▷ Z ⊗≫ 𝟙 _ := by
monoidal
_ = f ⊗≫ (η_ Y Y' ▷ Y ⊗≫ Y ◁ ε_ Y Y') ▷ Z ⊗≫ 𝟙 _ := by
rw [← whisker_exchange]; monoidal
_ = f := by
rw [evaluation_coevaluation'']; monoidal
/-- Given an exact pairing on `Y Y'`,
we get a bijection on hom-sets `(X ⊗ Y ⟶ Z) ≃ (X ⟶ Z ⊗ Y')`
by "pulling the string on the right" up or down.
-/
def tensorRightHomEquiv (X Y Y' Z : C) [ExactPairing Y Y'] : (X ⊗ Y ⟶ Z) ≃ (X ⟶ Z ⊗ Y') where
toFun f := (ρ_ _).inv ≫ _ ◁ η_ _ _ ≫ (α_ _ _ _).inv ≫ f ▷ _
invFun f := f ▷ _ ≫ (α_ _ _ _).hom ≫ _ ◁ ε_ _ _ ≫ (ρ_ _).hom
left_inv f := by
calc
_ = 𝟙 _ ⊗≫ X ◁ η_ Y Y' ▷ Y ⊗≫ (f ▷ (Y' ⊗ Y) ≫ Z ◁ ε_ Y Y') ⊗≫ 𝟙 _ := by
monoidal
_ = 𝟙 _ ⊗≫ X ◁ (η_ Y Y' ▷ Y ⊗≫ Y ◁ ε_ Y Y') ⊗≫ f := by
rw [← whisker_exchange]; monoidal
_ = f := by
rw [evaluation_coevaluation'']; monoidal
right_inv f := by
calc
_ = 𝟙 _ ⊗≫ (X ◁ η_ Y Y' ≫ f ▷ (Y ⊗ Y')) ⊗≫ Z ◁ ε_ Y Y' ▷ Y' ⊗≫ 𝟙 _ := by
monoidal
_ = f ⊗≫ Z ◁ (Y' ◁ η_ Y Y' ⊗≫ ε_ Y Y' ▷ Y') ⊗≫ 𝟙 _ := by
rw [whisker_exchange]; monoidal
_ = f := by
rw [coevaluation_evaluation'']; monoidal
theorem tensorLeftHomEquiv_naturality {X Y Y' Z Z' : C} [ExactPairing Y Y'] (f : Y' ⊗ X ⟶ Z)
(g : Z ⟶ Z') :
(tensorLeftHomEquiv X Y Y' Z') (f ≫ g) = (tensorLeftHomEquiv X Y Y' Z) f ≫ Y ◁ g := by
simp [tensorLeftHomEquiv]
theorem tensorLeftHomEquiv_symm_naturality {X X' Y Y' Z : C} [ExactPairing Y Y'] (f : X ⟶ X')
(g : X' ⟶ Y ⊗ Z) :
(tensorLeftHomEquiv X Y Y' Z).symm (f ≫ g) =
_ ◁ f ≫ (tensorLeftHomEquiv X' Y Y' Z).symm g := by
simp [tensorLeftHomEquiv]
theorem tensorRightHomEquiv_naturality {X Y Y' Z Z' : C} [ExactPairing Y Y'] (f : X ⊗ Y ⟶ Z)
(g : Z ⟶ Z') :
(tensorRightHomEquiv X Y Y' Z') (f ≫ g) = (tensorRightHomEquiv X Y Y' Z) f ≫ g ▷ Y' := by
simp [tensorRightHomEquiv]
theorem tensorRightHomEquiv_symm_naturality {X X' Y Y' Z : C} [ExactPairing Y Y'] (f : X ⟶ X')
(g : X' ⟶ Z ⊗ Y') :
(tensorRightHomEquiv X Y Y' Z).symm (f ≫ g) =
f ▷ Y ≫ (tensorRightHomEquiv X' Y Y' Z).symm g := by
simp [tensorRightHomEquiv]
/-- If `Y Y'` have an exact pairing,
then the functor `tensorLeft Y'` is left adjoint to `tensorLeft Y`.
-/
def tensorLeftAdjunction (Y Y' : C) [ExactPairing Y Y'] : tensorLeft Y' ⊣ tensorLeft Y :=
Adjunction.mkOfHomEquiv
{ homEquiv := fun X Z => tensorLeftHomEquiv X Y Y' Z
homEquiv_naturality_left_symm := fun f g => tensorLeftHomEquiv_symm_naturality f g
homEquiv_naturality_right := fun f g => tensorLeftHomEquiv_naturality f g }
/-- If `Y Y'` have an exact pairing,
then the functor `tensor_right Y` is left adjoint to `tensor_right Y'`.
-/
def tensorRightAdjunction (Y Y' : C) [ExactPairing Y Y'] : tensorRight Y ⊣ tensorRight Y' :=
Adjunction.mkOfHomEquiv
{ homEquiv := fun X Z => tensorRightHomEquiv X Y Y' Z
homEquiv_naturality_left_symm := fun f g => tensorRightHomEquiv_symm_naturality f g
homEquiv_naturality_right := fun f g => tensorRightHomEquiv_naturality f g }
/--
If `Y` has a left dual `ᘁY`, then it is a closed object, with the internal hom functor `Y ⟶[C] -`
given by left tensoring by `ᘁY`.
This has to be a definition rather than an instance to avoid diamonds, for example between
`category_theory.monoidal_closed.functor_closed` and
`CategoryTheory.Monoidal.functorHasLeftDual`. Moreover, in concrete applications there is often
a more useful definition of the internal hom object than `ᘁY ⊗ X`, in which case the closed
structure shouldn't come from `has_left_dual` (e.g. in the category `FinVect k`, it is more
convenient to define the internal hom as `Y →ₗ[k] X` rather than `ᘁY ⊗ X` even though these are
naturally isomorphic).
-/
def closedOfHasLeftDual (Y : C) [HasLeftDual Y] : Closed Y where
rightAdj := tensorLeft (ᘁY)
adj := tensorLeftAdjunction (ᘁY) Y
/-- `tensorLeftHomEquiv` commutes with tensoring on the right -/
theorem tensorLeftHomEquiv_tensor {X X' Y Y' Z Z' : C} [ExactPairing Y Y'] (f : X ⟶ Y ⊗ Z)
(g : X' ⟶ Z') :
(tensorLeftHomEquiv (X ⊗ X') Y Y' (Z ⊗ Z')).symm ((f ⊗ₘ g) ≫ (α_ _ _ _).hom) =
(α_ _ _ _).inv ≫ ((tensorLeftHomEquiv X Y Y' Z).symm f ⊗ₘ g) := by
simp [tensorLeftHomEquiv, tensorHom_def']
/-- `tensorRightHomEquiv` commutes with tensoring on the left -/
theorem tensorRightHomEquiv_tensor {X X' Y Y' Z Z' : C} [ExactPairing Y Y'] (f : X ⟶ Z ⊗ Y')
(g : X' ⟶ Z') :
(tensorRightHomEquiv (X' ⊗ X) Y Y' (Z' ⊗ Z)).symm ((g ⊗ₘ f) ≫ (α_ _ _ _).inv) =
(α_ _ _ _).hom ≫ (g ⊗ₘ (tensorRightHomEquiv X Y Y' Z).symm f) := by
simp [tensorRightHomEquiv, tensorHom_def]
@[simp]
theorem tensorLeftHomEquiv_symm_coevaluation_comp_whiskerLeft {Y Y' Z : C} [ExactPairing Y Y']
(f : Y' ⟶ Z) : (tensorLeftHomEquiv _ _ _ _).symm (η_ _ _ ≫ Y ◁ f) = (ρ_ _).hom ≫ f := by
calc
_ = Y' ◁ η_ Y Y' ⊗≫ ((Y' ⊗ Y) ◁ f ≫ ε_ Y Y' ▷ Z) ⊗≫ 𝟙 _ := by
dsimp [tensorLeftHomEquiv]; monoidal
_ = (Y' ◁ η_ Y Y' ⊗≫ ε_ Y Y' ▷ Y') ⊗≫ f := by
rw [whisker_exchange]; monoidal
_ = _ := by rw [coevaluation_evaluation'']; monoidal
@[simp]
theorem tensorLeftHomEquiv_symm_coevaluation_comp_whiskerRight {X Y : C} [HasRightDual X]
[HasRightDual Y] (f : X ⟶ Y) :
(tensorLeftHomEquiv _ _ _ _).symm (η_ _ _ ≫ f ▷ (Xᘁ)) = (ρ_ _).hom ≫ fᘁ := by
dsimp [tensorLeftHomEquiv, rightAdjointMate]
simp
@[simp]
theorem tensorRightHomEquiv_symm_coevaluation_comp_whiskerLeft {X Y : C} [HasLeftDual X]
[HasLeftDual Y] (f : X ⟶ Y) :
(tensorRightHomEquiv _ (ᘁY) _ _).symm (η_ (ᘁX : C) X ≫ (ᘁX : C) ◁ f) = (λ_ _).hom ≫ ᘁf := by
dsimp [tensorRightHomEquiv, leftAdjointMate]
simp
@[simp]
theorem tensorRightHomEquiv_symm_coevaluation_comp_whiskerRight {Y Y' Z : C} [ExactPairing Y Y']
(f : Y ⟶ Z) : (tensorRightHomEquiv _ Y _ _).symm (η_ Y Y' ≫ f ▷ Y') = (λ_ _).hom ≫ f :=
calc
_ = η_ Y Y' ▷ Y ⊗≫ (f ▷ (Y' ⊗ Y) ≫ Z ◁ ε_ Y Y') ⊗≫ 𝟙 _ := by
dsimp [tensorRightHomEquiv]; monoidal
_ = (η_ Y Y' ▷ Y ⊗≫ Y ◁ ε_ Y Y') ⊗≫ f := by
rw [← whisker_exchange]; monoidal
_ = _ := by
rw [evaluation_coevaluation'']; monoidal
@[simp]
theorem tensorLeftHomEquiv_whiskerLeft_comp_evaluation {Y Z : C} [HasLeftDual Z] (f : Y ⟶ ᘁZ) :
(tensorLeftHomEquiv _ _ _ _) (Z ◁ f ≫ ε_ _ _) = f ≫ (ρ_ _).inv :=
calc
_ = 𝟙 _ ⊗≫ (η_ (ᘁZ : C) Z ▷ Y ≫ ((ᘁZ) ⊗ Z) ◁ f) ⊗≫ (ᘁZ) ◁ ε_ (ᘁZ) Z := by
dsimp [tensorLeftHomEquiv]; monoidal
_ = f ⊗≫ (η_ (ᘁZ) Z ▷ (ᘁZ) ⊗≫ (ᘁZ) ◁ ε_ (ᘁZ) Z) := by
rw [← whisker_exchange]; monoidal
_ = _ := by
rw [evaluation_coevaluation'']; monoidal
@[simp]
theorem tensorLeftHomEquiv_whiskerRight_comp_evaluation {X Y : C} [HasLeftDual X] [HasLeftDual Y]
(f : X ⟶ Y) : (tensorLeftHomEquiv _ _ _ _) (f ▷ _ ≫ ε_ _ _) = (ᘁf) ≫ (ρ_ _).inv := by
dsimp [tensorLeftHomEquiv, leftAdjointMate]
simp
@[simp]
theorem tensorRightHomEquiv_whiskerLeft_comp_evaluation {X Y : C} [HasRightDual X] [HasRightDual Y]
(f : X ⟶ Y) : (tensorRightHomEquiv _ _ _ _) ((Yᘁ : C) ◁ f ≫ ε_ _ _) = fᘁ ≫ (λ_ _).inv := by
dsimp [tensorRightHomEquiv, rightAdjointMate]
simp
@[simp]
theorem tensorRightHomEquiv_whiskerRight_comp_evaluation {X Y : C} [HasRightDual X] (f : Y ⟶ Xᘁ) :
(tensorRightHomEquiv _ _ _ _) (f ▷ X ≫ ε_ X (Xᘁ)) = f ≫ (λ_ _).inv :=
calc
_ = 𝟙 _ ⊗≫ (Y ◁ η_ X Xᘁ ≫ f ▷ (X ⊗ Xᘁ)) ⊗≫ ε_ X Xᘁ ▷ Xᘁ := by
dsimp [tensorRightHomEquiv]; monoidal
_ = f ⊗≫ (Xᘁ ◁ η_ X Xᘁ ⊗≫ ε_ X Xᘁ ▷ Xᘁ) := by
rw [whisker_exchange]; monoidal
_ = _ := by
rw [coevaluation_evaluation'']; monoidal
-- Next four lemmas passing `fᘁ` or `ᘁf` through (co)evaluations.
@[reassoc]
theorem coevaluation_comp_rightAdjointMate {X Y : C} [HasRightDual X] [HasRightDual Y] (f : X ⟶ Y) :
η_ Y (Yᘁ) ≫ _ ◁ (fᘁ) = η_ _ _ ≫ f ▷ _ := by
apply_fun (tensorLeftHomEquiv _ Y (Yᘁ) _).symm
simp
@[reassoc]
theorem leftAdjointMate_comp_evaluation {X Y : C} [HasLeftDual X] [HasLeftDual Y] (f : X ⟶ Y) :
X ◁ (ᘁf) ≫ ε_ _ _ = f ▷ _ ≫ ε_ _ _ := by
apply_fun tensorLeftHomEquiv _ (ᘁX) X _
simp
@[reassoc]
theorem coevaluation_comp_leftAdjointMate {X Y : C} [HasLeftDual X] [HasLeftDual Y] (f : X ⟶ Y) :
η_ (ᘁY) Y ≫ (ᘁf) ▷ Y = η_ (ᘁX) X ≫ (ᘁX) ◁ f := by
apply_fun (tensorRightHomEquiv _ (ᘁY) Y _).symm
simp
@[reassoc]
theorem rightAdjointMate_comp_evaluation {X Y : C} [HasRightDual X] [HasRightDual Y] (f : X ⟶ Y) :
(fᘁ ▷ X) ≫ ε_ X (Xᘁ) = ((Yᘁ) ◁ f) ≫ ε_ Y (Yᘁ) := by
apply_fun tensorRightHomEquiv _ X (Xᘁ) _
simp
/-- Transport an exact pairing across an isomorphism in the first argument. -/
def exactPairingCongrLeft {X X' Y : C} [ExactPairing X' Y] (i : X ≅ X') : ExactPairing X Y where
evaluation' := Y ◁ i.hom ≫ ε_ _ _
coevaluation' := η_ _ _ ≫ i.inv ▷ Y
evaluation_coevaluation' :=
calc
_ = η_ X' Y ▷ X ⊗≫ (i.inv ▷ (Y ⊗ X) ≫ X ◁ (Y ◁ i.hom)) ⊗≫ X ◁ ε_ X' Y := by
monoidal
_ = 𝟙 _ ⊗≫ (η_ X' Y ▷ X ≫ (X' ⊗ Y) ◁ i.hom) ⊗≫
(i.inv ▷ (Y ⊗ X') ≫ X ◁ ε_ X' Y) ⊗≫ 𝟙 _ := by
rw [← whisker_exchange]; monoidal
_ = 𝟙 _ ⊗≫ i.hom ⊗≫ (η_ X' Y ▷ X' ⊗≫ X' ◁ ε_ X' Y) ⊗≫ i.inv ⊗≫ 𝟙 _ := by
rw [← whisker_exchange, ← whisker_exchange]; monoidal
_ = 𝟙 _ ⊗≫ (i.hom ≫ i.inv) ⊗≫ 𝟙 _ := by
rw [evaluation_coevaluation'']; monoidal
_ = (λ_ X).hom ≫ (ρ_ X).inv := by
rw [Iso.hom_inv_id]
monoidal
coevaluation_evaluation' := by
calc
_ = Y ◁ η_ X' Y ≫ Y ◁ (i.inv ≫ i.hom) ▷ Y ⊗≫ ε_ X' Y ▷ Y := by
monoidal
_ = Y ◁ η_ X' Y ⊗≫ ε_ X' Y ▷ Y := by
rw [Iso.inv_hom_id]; monoidal
_ = _ := by
rw [coevaluation_evaluation'']
simp
/-- Transport an exact pairing across an isomorphism in the second argument. -/
def exactPairingCongrRight {X Y Y' : C} [ExactPairing X Y'] (i : Y ≅ Y') : ExactPairing X Y where
evaluation' := i.hom ▷ X ≫ ε_ _ _
coevaluation' := η_ _ _ ≫ X ◁ i.inv
evaluation_coevaluation' := by
calc
_ = η_ X Y' ▷ X ⊗≫ X ◁ (i.inv ≫ i.hom) ▷ X ≫ X ◁ ε_ X Y' := by
monoidal
_ = η_ X Y' ▷ X ⊗≫ X ◁ ε_ X Y' := by
rw [Iso.inv_hom_id]; monoidal
_ = _ := by
rw [evaluation_coevaluation'']
simp
coevaluation_evaluation' :=
calc
_ = Y ◁ η_ X Y' ⊗≫ (Y ◁ (X ◁ i.inv) ≫ i.hom ▷ (X ⊗ Y)) ⊗≫ ε_ X Y' ▷ Y := by
monoidal
_ = 𝟙 _ ⊗≫ (Y ◁ η_ X Y' ≫ i.hom ▷ (X ⊗ Y')) ⊗≫
((Y' ⊗ X) ◁ i.inv ≫ ε_ X Y' ▷ Y) ⊗≫ 𝟙 _ := by
rw [whisker_exchange]; monoidal
_ = 𝟙 _ ⊗≫ i.hom ⊗≫ (Y' ◁ η_ X Y' ⊗≫ ε_ X Y' ▷ Y') ⊗≫ i.inv ⊗≫ 𝟙 _ := by
rw [whisker_exchange, whisker_exchange]; monoidal
_ = 𝟙 _ ⊗≫ (i.hom ≫ i.inv) ⊗≫ 𝟙 _ := by
rw [coevaluation_evaluation'']; monoidal
_ = (ρ_ Y).hom ≫ (λ_ Y).inv := by
rw [Iso.hom_inv_id]
monoidal
/-- Transport an exact pairing across isomorphisms. -/
def exactPairingCongr {X X' Y Y' : C} [ExactPairing X' Y'] (i : X ≅ X') (j : Y ≅ Y') :
ExactPairing X Y :=
haveI : ExactPairing X' Y := exactPairingCongrRight j
exactPairingCongrLeft i
/-- Right duals are isomorphic. -/
def rightDualIso {X Y₁ Y₂ : C} (p₁ : ExactPairing X Y₁) (p₂ : ExactPairing X Y₂) : Y₁ ≅ Y₂ where
hom := @rightAdjointMate C _ _ X X ⟨Y₂⟩ ⟨Y₁⟩ (𝟙 X)
inv := @rightAdjointMate C _ _ X X ⟨Y₁⟩ ⟨Y₂⟩ (𝟙 X)
hom_inv_id := by
-- Make all arguments explicit, because we want to find them by unification not synthesis.
rw [← @comp_rightAdjointMate, Category.comp_id, @rightAdjointMate_id]
rfl
inv_hom_id := by
rw [← @comp_rightAdjointMate, Category.comp_id, @rightAdjointMate_id]
rfl
/-- Left duals are isomorphic. -/
def leftDualIso {X₁ X₂ Y : C} (p₁ : ExactPairing X₁ Y) (p₂ : ExactPairing X₂ Y) : X₁ ≅ X₂ where
hom := @leftAdjointMate C _ _ Y Y ⟨X₂⟩ ⟨X₁⟩ (𝟙 Y)
inv := @leftAdjointMate C _ _ Y Y ⟨X₁⟩ ⟨X₂⟩ (𝟙 Y)
hom_inv_id := by
-- Make all arguments explicit, because we want to find them by unification not synthesis.
rw [← @comp_leftAdjointMate C, Category.comp_id, @leftAdjointMate_id]
rfl
inv_hom_id := by
rw [← @comp_leftAdjointMate C, Category.comp_id, @leftAdjointMate_id]
rfl
@[simp]
theorem rightDualIso_id {X Y : C} (p : ExactPairing X Y) : rightDualIso p p = Iso.refl Y := by
ext
simp only [rightDualIso, Iso.refl_hom, @rightAdjointMate_id]
@[simp]
theorem leftDualIso_id {X Y : C} (p : ExactPairing X Y) : leftDualIso p p = Iso.refl X := by
ext
simp only [leftDualIso, Iso.refl_hom, @leftAdjointMate_id]
/-- A right rigid monoidal category is one in which every object has a right dual. -/
class RightRigidCategory (C : Type u) [Category.{v} C] [MonoidalCategory.{v} C] where
[rightDual : ∀ X : C, HasRightDual X]
/-- A left rigid monoidal category is one in which every object has a right dual. -/
class LeftRigidCategory (C : Type u) [Category.{v} C] [MonoidalCategory.{v} C] where
[leftDual : ∀ X : C, HasLeftDual X]
attribute [instance 100] RightRigidCategory.rightDual
attribute [instance 100] LeftRigidCategory.leftDual
/-- Any left rigid category is monoidal closed, with the internal hom `X ⟶[C] Y = ᘁX ⊗ Y`.
This has to be a definition rather than an instance to avoid diamonds, for example between
`category_theory.monoidal_closed.functor_category` and
`CategoryTheory.Monoidal.leftRigidFunctorCategory`. Moreover, in concrete applications there is
often a more useful definition of the internal hom object than `ᘁY ⊗ X`, in which case the monoidal
closed structure shouldn't come the rigid structure (e.g. in the category `FinVect k`, it is more
convenient to define the internal hom as `Y →ₗ[k] X` rather than `ᘁY ⊗ X` even though these are
naturally isomorphic). -/
def monoidalClosedOfLeftRigidCategory (C : Type u) [Category.{v} C] [MonoidalCategory.{v} C]
[LeftRigidCategory C] : MonoidalClosed C where
closed X := closedOfHasLeftDual X
/-- A rigid monoidal category is a monoidal category which is left rigid and right rigid. -/
class RigidCategory (C : Type u) [Category.{v} C] [MonoidalCategory.{v} C] extends
RightRigidCategory C, LeftRigidCategory C
end CategoryTheory |
.lake/packages/mathlib/Mathlib/CategoryTheory/Monoidal/Rigid/Braided.lean | import Mathlib.CategoryTheory.Monoidal.Rigid.Basic
import Mathlib.CategoryTheory.Monoidal.Braided.Basic
/-!
# Deriving `RigidCategory` instance for braided and left/right rigid categories.
-/
open CategoryTheory Category BraidedCategory MonoidalCategory
variable {C : Type*} [Category C] [MonoidalCategory C] [BraidedCategory C] {X Y : C}
namespace CategoryTheory.BraidedCategory
/-- coevaluation_evaluation' field of `ExactPairing Y X` in a braided category -/
private theorem coevaluation_evaluation_braided' [inst : ExactPairing X Y] :
X ◁ (η_ X Y ≫ (β_ Y X).inv) ≫ (α_ X Y X).inv ≫ ((β_ X Y).hom ≫ ε_ X Y) ▷ X
= (ρ_ X).hom ≫ (λ_ X).inv := by
/- Rearrange into _ = 𝟙 _ -/
rw [Iso.eq_comp_inv, ← Iso.inv_comp_eq_id]
/- Whitney trick transcribed: https://mathoverflow.net/a/162729/493261 -/
calc
_ = 𝟙 X ⊗≫ X ◁ η_ X Y ⊗≫ (X ◁ (β_ Y X).inv ⊗≫ (β_ X Y).hom ▷ X) ⊗≫ ε_ X Y ▷ X ⊗≫ 𝟙 X := by
monoidal
_ = 𝟙 X ⊗≫ X ◁ η_ X Y ⊗≫ (𝟙 (X ⊗ X ⊗ Y) ⊗≫ (β_ X X).hom ▷ Y ⊗≫ X ◁ (β_ X Y).hom
⊗≫ (β_ Y X).inv ▷ X ⊗≫ Y ◁ (β_ X X).inv ⊗≫ 𝟙 ((Y ⊗ X) ⊗ X)) ⊗≫ ε_ X Y ▷ X ⊗≫ 𝟙 X := by
congr 3
simp only [monoidalComp, MonoidalCoherence.assoc'_iso, MonoidalCoherence.whiskerRight_iso,
MonoidalCoherence.refl_iso, whiskerRightIso_refl, Iso.refl_trans, Iso.symm_hom,
MonoidalCoherence.assoc_iso, Iso.trans_refl, comp_id, id_comp]
rw [← IsIso.eq_inv_comp]
repeat rw [← assoc]
iterate 5 rw [← IsIso.comp_inv_eq]
simpa using yang_baxter X Y X
_ = 𝟙 X ⊗≫ (X ◁ η_ X Y ≫ (β_ X (X ⊗ Y)).hom) ⊗≫ ((β_ (Y ⊗ X) X).inv ≫ ε_ X Y ▷ X) ⊗≫ 𝟙 X := by
simp [monoidalComp, braiding_tensor_right_hom, braiding_tensor_left_inv]
_ = _ := by
rw [braiding_naturality_right, ← braiding_inv_naturality_right]
simp [monoidalComp]
/-- evaluation_coevaluation' field of `ExactPairing Y X` in a braided category -/
private theorem evaluation_coevaluation_braided' [inst : ExactPairing X Y] :
(η_ X Y ≫ (β_ Y X).inv) ▷ Y ≫ (α_ Y X Y).hom ≫ Y ◁ ((β_ X Y).hom ≫ ε_ X Y) =
(λ_ Y).hom ≫ (ρ_ Y).inv := by
rw [Iso.eq_comp_inv, ← Iso.inv_comp_eq_id]
calc
_ = 𝟙 Y ⊗≫ η_ X Y ▷ Y ⊗≫ ((β_ Y X).inv ▷ Y ⊗≫ Y ◁ (β_ X Y).hom) ≫ Y ◁ ε_ X Y ⊗≫ 𝟙 Y := by
monoidal
_ = 𝟙 Y ⊗≫ η_ X Y ▷ Y ⊗≫ (𝟙 ((X ⊗ Y) ⊗ Y) ⊗≫ X ◁ (β_ Y Y).hom ⊗≫ (β_ X Y).hom ▷ Y
⊗≫ Y ◁ (β_ Y X).inv ⊗≫ (β_ Y Y).inv ▷ X ⊗≫ 𝟙 (Y ⊗ Y ⊗ X)) ⊗≫ Y ◁ ε_ X Y ⊗≫ 𝟙 Y := by
congr 3
on_goal 2 => simp [monoidalComp]
simp only [monoidalComp, MonoidalCoherence.assoc_iso, MonoidalCoherence.whiskerRight_iso,
MonoidalCoherence.refl_iso, whiskerRightIso_refl, Iso.trans_refl,
MonoidalCoherence.assoc'_iso, Iso.refl_trans, Iso.symm_hom, comp_id, id_comp]
iterate 2 rw [← IsIso.eq_inv_comp]
repeat rw [← assoc]
iterate 4 rw [← IsIso.comp_inv_eq]
simpa using (yang_baxter Y X Y).symm
_ = 𝟙 Y ⊗≫ (η_ X Y ▷ Y ≫ (β_ (X ⊗ Y) Y).hom) ⊗≫ ((β_ Y (Y ⊗ X)).inv ≫ Y ◁ ε_ X Y) ⊗≫ 𝟙 Y := by
simp [monoidalComp, braiding_tensor_left_hom, braiding_tensor_right_inv]
_ = _ := by
rw [braiding_naturality_left, ← braiding_inv_naturality_left]
simp [monoidalComp]
/-- If `X` and `Y` forms an exact pairing in a braided category, then so does `Y` and `X`
by composing the coevaluation and evaluation morphisms with associators. -/
def exactPairing_swap (X Y : C) [ExactPairing X Y] : ExactPairing Y X where
coevaluation' := η_ X Y ≫ (β_ Y X).inv
evaluation' := (β_ X Y).hom ≫ ε_ X Y
coevaluation_evaluation' := coevaluation_evaluation_braided'
evaluation_coevaluation' := evaluation_coevaluation_braided'
/-- If `X` has a right dual in a braided category, then it has a left dual. -/
def hasLeftDualOfHasRightDual [HasRightDual X] : HasLeftDual X where
leftDual := Xᘁ
exact := exactPairing_swap X Xᘁ
/-- If `X` has a left dual in a braided category, then it has a right dual. -/
def hasRightDualOfHasLeftDual [HasLeftDual X] : HasRightDual X where
rightDual := ᘁX
exact := exactPairing_swap ᘁX X
instance leftRigidCategoryOfRightRigidCategory [RightRigidCategory C] : LeftRigidCategory C where
leftDual X := hasLeftDualOfHasRightDual (X := X)
instance rightRigidCategoryOfLeftRigidCategory [LeftRigidCategory C] : RightRigidCategory C where
rightDual X := hasRightDualOfHasLeftDual (X := X)
/-- If `C` is a braided and right rigid category, then it is a rigid category. -/
instance rigidCategoryOfRightRigidCategory [RightRigidCategory C] : RigidCategory C where
rightDual := inferInstance
leftDual := inferInstance
/-- If `C` is a braided and left rigid category, then it is a rigid category. -/
instance rigidCategoryOfLeftRigidCategory [LeftRigidCategory C] : RigidCategory C where
rightDual := inferInstance
leftDual := inferInstance
end CategoryTheory.BraidedCategory |
.lake/packages/mathlib/Mathlib/CategoryTheory/Monoidal/Rigid/FunctorCategory.lean | import Mathlib.CategoryTheory.Monoidal.Rigid.Basic
import Mathlib.CategoryTheory.Monoidal.FunctorCategory
/-!
# Functors from a groupoid into a right/left rigid category form a right/left rigid category.
(Using the pointwise monoidal structure on the functor category.)
-/
noncomputable section
open CategoryTheory
open CategoryTheory.MonoidalCategory
namespace CategoryTheory.Monoidal
variable {C D : Type*} [Groupoid C] [Category D] [MonoidalCategory D]
instance functorHasRightDual [RightRigidCategory D] (F : C ⥤ D) : HasRightDual F where
rightDual :=
{ obj := fun X => (F.obj X)ᘁ
map := fun f => (F.map (inv f))ᘁ
map_comp := fun f g => by simp [comp_rightAdjointMate] }
exact :=
{ evaluation' :=
{ app := fun _ => ε_ _ _
naturality := fun X Y f => by
dsimp
rw [Category.comp_id, Functor.map_inv, ← id_tensor_comp_tensor_id, Category.assoc,
id_tensorHom, tensorHom_id,
rightAdjointMate_comp_evaluation, ← MonoidalCategory.whiskerLeft_comp_assoc,
IsIso.hom_inv_id, MonoidalCategory.whiskerLeft_id, Category.id_comp] }
coevaluation' :=
{ app := fun _ => η_ _ _
naturality := fun X Y f => by
dsimp
rw [Functor.map_inv, Category.id_comp, ← id_tensor_comp_tensor_id,
id_tensorHom, tensorHom_id, ← Category.assoc,
coevaluation_comp_rightAdjointMate, Category.assoc, ← comp_whiskerRight,
IsIso.inv_hom_id, id_whiskerRight, Category.comp_id] } }
instance rightRigidFunctorCategory [RightRigidCategory D] : RightRigidCategory (C ⥤ D) where
instance functorHasLeftDual [LeftRigidCategory D] (F : C ⥤ D) : HasLeftDual F where
leftDual :=
{ obj := fun X => ᘁ(F.obj X)
map := fun f => ᘁ(F.map (inv f))
map_comp := fun f g => by simp [comp_leftAdjointMate] }
exact :=
{ evaluation' :=
{ app := fun _ => ε_ _ _
naturality := fun X Y f => by
simp [tensorHom_def, leftAdjointMate_comp_evaluation] }
coevaluation' :=
{ app := fun _ => η_ _ _
naturality := fun X Y f => by
simp [tensorHom_def, coevaluation_comp_leftAdjointMate_assoc] } }
instance leftRigidFunctorCategory [LeftRigidCategory D] : LeftRigidCategory (C ⥤ D) where
instance rigidFunctorCategory [RigidCategory D] : RigidCategory (C ⥤ D) where
end CategoryTheory.Monoidal |
.lake/packages/mathlib/Mathlib/CategoryTheory/Monoidal/Internal/Module.lean | import Mathlib.Algebra.Category.ModuleCat.Monoidal.Basic
import Mathlib.Algebra.Category.AlgCat.Basic
import Mathlib.CategoryTheory.Monoidal.Mon_
/-!
# `Mon (ModuleCat R) ≌ AlgCat R`
The category of internal monoid objects in `ModuleCat R`
is equivalent to the category of "native" bundled `R`-algebras.
Moreover, this equivalence is compatible with the forgetful functors to `ModuleCat R`.
-/
suppress_compilation
universe v u
open CategoryTheory
open LinearMap MonObj
open scoped TensorProduct
attribute [local ext] TensorProduct.ext
namespace ModuleCat
variable {R : Type u} [CommRing R]
namespace MonModuleEquivalenceAlgebra
instance MonObj.toRing (A : ModuleCat.{u} R) [MonObj A] : Ring A :=
{ (inferInstance : AddCommGroup A) with
one := η[A] (1 : R)
mul := fun x y => μ[A] (x ⊗ₜ y)
one_mul := fun x => by
convert LinearMap.congr_fun (ModuleCat.hom_ext_iff.mp (one_mul A)) ((1 : R) ⊗ₜ x)
rw [MonoidalCategory.leftUnitor_hom_apply, one_smul]
mul_one := fun x => by
convert LinearMap.congr_fun (ModuleCat.hom_ext_iff.mp (mul_one A)) (x ⊗ₜ (1 : R))
rw [MonoidalCategory.rightUnitor_hom_apply, one_smul]
mul_assoc := fun x y z => by
convert LinearMap.congr_fun (ModuleCat.hom_ext_iff.mp (mul_assoc A)) (x ⊗ₜ y ⊗ₜ z)
left_distrib := fun x y z => by
convert μ[A].hom.map_add (x ⊗ₜ y) (x ⊗ₜ z)
rw [← TensorProduct.tmul_add]
rfl
right_distrib := fun x y z => by
convert μ[A].hom.map_add (x ⊗ₜ z) (y ⊗ₜ z)
rw [← TensorProduct.add_tmul]
rfl
zero_mul := fun x => show μ[A] _ = 0 by
rw [TensorProduct.zero_tmul, map_zero]
mul_zero := fun x => show μ[A] _ = 0 by
rw [TensorProduct.tmul_zero, map_zero] }
instance Algebra_of_Mon_ (A : ModuleCat.{u} R) [MonObj A] : Algebra R A where
algebraMap :=
{ η[A].hom with
map_zero' := η[A].hom.map_zero
map_one' := rfl
map_mul' := fun x y => by
have h := LinearMap.congr_fun (ModuleCat.hom_ext_iff.mp (one_mul A).symm) (x ⊗ₜ η[A] y)
rwa [MonoidalCategory.leftUnitor_hom_apply, ← η[A].hom.map_smul] at h }
commutes' := fun r a => by
dsimp
have h₁ := LinearMap.congr_fun (ModuleCat.hom_ext_iff.mp (one_mul A)) (r ⊗ₜ a)
have h₂ := LinearMap.congr_fun (ModuleCat.hom_ext_iff.mp (mul_one A)) (a ⊗ₜ r)
exact h₁.trans h₂.symm
smul_def' := fun r a =>
(LinearMap.congr_fun (ModuleCat.hom_ext_iff.mp (one_mul A)) (r ⊗ₜ a)).symm
@[simp]
theorem algebraMap (A : ModuleCat.{u} R) [MonObj A] (r : R) : algebraMap R A r = η[A] r :=
rfl
/-- Converting a monoid object in `ModuleCat R` to a bundled algebra.
-/
@[simps!]
def functor : Mon (ModuleCat.{u} R) ⥤ AlgCat R where
obj A := AlgCat.of R A.X
map {_ _} f := AlgCat.ofHom
{ f.hom.hom.toAddMonoidHom with
toFun := f.hom
map_one' := LinearMap.congr_fun (ModuleCat.hom_ext_iff.mp (IsMonHom.one_hom f.hom)) (1 : R)
map_mul' := fun x y =>
LinearMap.congr_fun (ModuleCat.hom_ext_iff.mp (IsMonHom.mul_hom f.hom)) (x ⊗ₜ y)
commutes' := fun r =>
LinearMap.congr_fun (ModuleCat.hom_ext_iff.mp (IsMonHom.one_hom f.hom)) r }
/-- Converting a bundled algebra to a monoid object in `ModuleCat R`.
-/
@[simps]
def inverseObj (A : AlgCat.{u} R) : MonObj (ModuleCat.of R A) where
one := ofHom <| Algebra.linearMap R A
mul := ofHom <| LinearMap.mul' R A
one_mul := by
ext : 1
-- Porting note (https://github.com/leanprover-community/mathlib4/issues/11041): `ext` did not pick up `TensorProduct.ext`
refine TensorProduct.ext <| LinearMap.ext_ring <| LinearMap.ext fun x => ?_
rw [compr₂ₛₗ_apply, compr₂ₛₗ_apply, hom_comp, LinearMap.comp_apply]
-- Porting note: this `dsimp` does nothing
-- dsimp [AlgCat.id_apply, TensorProduct.mk_apply, Algebra.linearMap_apply,
-- LinearMap.compr₂_apply, Function.comp_apply, RingHom.map_one,
-- ModuleCat.MonoidalCategory.tensorHom_tmul, AlgCat.hom_comp,
-- ModuleCat.MonoidalCategory.leftUnitor_hom_apply]
-- Porting note: because `dsimp` is not effective, `rw` needs to be changed to `erw`
dsimp
erw [LinearMap.mul'_apply, MonoidalCategory.leftUnitor_hom_apply, ← Algebra.smul_def]
dsimp
mul_one := by
ext : 1
-- Porting note (https://github.com/leanprover-community/mathlib4/issues/11041): `ext` did not pick up `TensorProduct.ext`
refine TensorProduct.ext <| LinearMap.ext fun x => LinearMap.ext_ring ?_
-- Porting note: this `dsimp` does nothing
-- dsimp only [AlgCat.id_apply, TensorProduct.mk_apply, Algebra.linearMap_apply,
-- LinearMap.compr₂_apply, Function.comp_apply, ModuleCat.MonoidalCategory.hom_apply,
-- AlgCat.coe_comp]
-- Porting note: because `dsimp` is not effective, `rw` needs to be changed to `erw`
erw [compr₂_apply, compr₂ₛₗ_apply]
simp [ModuleCat.hom_comp, LinearMap.comp_apply]
erw [LinearMap.mul'_apply, ModuleCat.MonoidalCategory.rightUnitor_hom_apply, ← Algebra.commutes,
← Algebra.smul_def]
dsimp
mul_assoc := by
ext : 1
-- Porting note (https://github.com/leanprover-community/mathlib4/issues/11041): `ext` did not pick up `TensorProduct.ext`
refine TensorProduct.ext <| TensorProduct.ext <| LinearMap.ext fun x => LinearMap.ext fun y =>
LinearMap.ext fun z => ?_
dsimp only [compr₂ₛₗ_apply, TensorProduct.mk_apply]
rw [hom_comp, LinearMap.comp_apply, hom_comp, LinearMap.comp_apply, hom_comp,
LinearMap.comp_apply]
erw [LinearMap.mul'_apply, LinearMap.mul'_apply]
dsimp only [id_coe, id_eq]
erw [TensorProduct.mk_apply, TensorProduct.mk_apply, mul'_apply, LinearMap.id_apply, mul'_apply]
simp only [_root_.mul_assoc]
attribute [local instance] inverseObj
/-- Converting a bundled algebra to a monoid object in `ModuleCat R`.
-/
@[simps]
def inverse : AlgCat.{u} R ⥤ Mon (ModuleCat.{u} R) where
obj A := { X := ModuleCat.of R A, mon := inverseObj A}
map f :=
{ hom := ofHom <| f.hom.toLinearMap
isMonHom_hom.one_hom := hom_ext <| LinearMap.ext f.hom.commutes
isMonHom_hom.mul_hom := hom_ext <| TensorProduct.ext <| LinearMap.ext₂ <| map_mul f.hom }
end MonModuleEquivalenceAlgebra
open MonModuleEquivalenceAlgebra
/-- The category of internal monoid objects in `ModuleCat R`
is equivalent to the category of "native" bundled `R`-algebras.
-/
def monModuleEquivalenceAlgebra : Mon (ModuleCat.{u} R) ≌ AlgCat R where
functor := functor
inverse := inverse
unitIso :=
NatIso.ofComponents
(fun A =>
{ hom.hom := ofHom
{ toFun := _root_.id
map_add' _ _ := rfl
map_smul' _ _ := rfl }
hom.isMonHom_hom.mul_hom := by
ext : 1
-- Porting note (https://github.com/leanprover-community/mathlib4/issues/11041): `ext` did not pick up `TensorProduct.ext`
exact TensorProduct.ext rfl
inv.hom := ofHom
{ toFun := _root_.id
map_add' := fun _ _ => rfl
map_smul' := fun _ _ => rfl }
inv.isMonHom_hom.mul_hom := by
ext : 1
-- Porting note (https://github.com/leanprover-community/mathlib4/issues/11041): `ext` did not pick up `TensorProduct.ext`
refine TensorProduct.ext ?_
rfl })
counitIso :=
NatIso.ofComponents
(fun A =>
{ hom := AlgCat.ofHom
{ toFun := _root_.id
map_zero' := rfl
map_add' := fun _ _ => rfl
map_one' := (algebraMap R A).map_one
map_mul' := fun x y => @LinearMap.mul'_apply R _ _ _ _ _ _ x y
commutes' := fun _ => rfl }
inv := AlgCat.ofHom
{ toFun := _root_.id
map_zero' := rfl
map_add' := fun _ _ => rfl
map_one' := (algebraMap R A).map_one.symm
map_mul' := fun x y => (@LinearMap.mul'_apply R _ _ _ _ _ _ x y).symm
commutes' := fun _ => rfl } })
/-- The equivalence `Mon (ModuleCat R) ≌ AlgCat R`
is naturally compatible with the forgetful functors to `ModuleCat R`.
-/
def monModuleEquivalenceAlgebraForget :
MonModuleEquivalenceAlgebra.functor ⋙ forget₂ (AlgCat.{u} R) (ModuleCat.{u} R) ≅
Mon.forget (ModuleCat.{u} R) :=
NatIso.ofComponents
(fun A =>
{ hom := ofHom
{ toFun := _root_.id
map_add' := fun _ _ => rfl
map_smul' := fun _ _ => rfl }
inv := ofHom
{ toFun := _root_.id
map_add' := fun _ _ => rfl
map_smul' := fun _ _ => rfl } })
end ModuleCat |
.lake/packages/mathlib/Mathlib/CategoryTheory/Monoidal/Internal/Limits.lean | import Mathlib.CategoryTheory.Monoidal.Internal.FunctorCategory
import Mathlib.CategoryTheory.Monoidal.Limits.Basic
import Mathlib.CategoryTheory.Limits.Preserves.Basic
/-!
# Limits of monoid objects.
If `C` has limits (of a given shape), so does `Mon C`,
and the forgetful functor preserves these limits.
(This could potentially replace many individual constructions for concrete categories,
in particular `MonCat`, `SemiRingCat`, `RingCat`, and `AlgCat R`.)
-/
open CategoryTheory Limits Monoidal MonoidalCategory
universe v u w
noncomputable section
namespace CategoryTheory
namespace Mon
variable {J : Type w} [SmallCategory J]
variable {C : Type u} [Category.{v} C] [HasLimitsOfShape J C] [MonoidalCategory.{v} C]
/-- We construct the (candidate) limit of a functor `F : J ⥤ Mon C`
by interpreting it as a functor `Mon (J ⥤ C)`,
and noting that taking limits is a lax monoidal functor,
and hence sends monoid objects to monoid objects.
-/
@[simps!]
def limit (F : J ⥤ Mon C) : Mon C :=
lim.mapMon.obj ((monFunctorCategoryEquivalence J C).inverse.obj F)
/-- Implementation of `Mon.hasLimits`: a limiting cone over a functor `F : J ⥤ Mon C`.
-/
@[simps]
def limitCone (F : J ⥤ Mon C) : Cone F where
pt := limit F
π :=
{ app := fun j => .mk' (limit.π (F ⋙ Mon.forget C) j)
naturality := fun j j' f => by ext; exact (limit.cone (F ⋙ Mon.forget C)).π.naturality f }
/-- The image of the proposed limit cone for `F : J ⥤ Mon C` under the forgetful functor
`forget C : Mon C ⥤ C` is isomorphic to the limit cone of `F ⋙ forget C`.
-/
def forgetMapConeLimitConeIso (F : J ⥤ Mon C) :
(forget C).mapCone (limitCone F) ≅ limit.cone (F ⋙ forget C) :=
Cones.ext (Iso.refl _) (by simp)
/-- Implementation of `Mon.hasLimitsOfShape`:
the proposed cone over a functor `F : J ⥤ Mon C` is a limit cone.
-/
@[simps]
def limitConeIsLimit (F : J ⥤ Mon C) : IsLimit (limitCone F) where
lift s :=
{ hom := limit.lift (F ⋙ Mon.forget C) ((Mon.forget C).mapCone s)
isMonHom_hom.mul_hom := limit.hom_ext fun j ↦ by
dsimp
simp only [Category.assoc, limit.lift_π, Functor.mapCone_pt, forget_obj,
Functor.mapCone_π_app, forget_map, IsMonHom.mul_hom, limMap_π, tensorObj_obj,
Functor.comp_obj, MonFunctorCategoryEquivalence.inverseObj_mon_mul_app, lim_μ_π_assoc,
lim_obj, tensorHom_comp_tensorHom_assoc] }
fac s h := by ext; simp
uniq s m w := by
ext1
refine limit.hom_ext (fun j => ?_)
dsimp; simp only [Mon.forget_map, limit.lift_π, Functor.mapCone_π_app]
exact congr_arg Mon.Hom.hom (w j)
instance hasLimitsOfShape [HasLimitsOfShape J C] : HasLimitsOfShape J (Mon C) where
has_limit := fun F => HasLimit.mk
{ cone := limitCone F
isLimit := limitConeIsLimit F }
instance forget_preservesLimitsOfShape : PreservesLimitsOfShape J (Mon.forget C) where
preservesLimit := fun {F} =>
preservesLimit_of_preserves_limit_cone (limitConeIsLimit F)
(IsLimit.ofIsoLimit (limit.isLimit (F ⋙ Mon.forget C)) (forgetMapConeLimitConeIso F).symm)
end Mon
end CategoryTheory |
.lake/packages/mathlib/Mathlib/CategoryTheory/Monoidal/Internal/FunctorCategory.lean | import Mathlib.CategoryTheory.Monoidal.CommMon_
import Mathlib.CategoryTheory.Monoidal.Comon_
import Mathlib.CategoryTheory.Monoidal.FunctorCategory
/-!
# `Mon (C ⥤ D) ≌ C ⥤ Mon D`
When `D` is a monoidal category,
monoid objects in `C ⥤ D` are the same thing as functors from `C` into the monoid objects of `D`.
This is formalised as:
* `monFunctorCategoryEquivalence : Mon (C ⥤ D) ≌ C ⥤ Mon D`
The intended application is that as `Ring ≌ Mon Ab` (not yet constructed!),
we have `presheaf Ring X ≌ presheaf (Mon Ab) X ≌ Mon (presheaf Ab X)`,
and we can model a module over a presheaf of rings as a module object in `presheaf Ab X`.
## Future work
Presumably this statement is not specific to monoids,
and could be generalised to any internal algebraic objects,
if the appropriate framework was available.
-/
universe v₁ v₂ u₁ u₂
open CategoryTheory MonoidalCategory MonObj ComonObj
namespace CategoryTheory.Monoidal
variable (C : Type u₁) [Category.{v₁} C]
variable (D : Type u₂) [Category.{v₂} D] [MonoidalCategory.{v₂} D]
namespace MonFunctorCategoryEquivalence
variable {C D}
/-- A monoid object in a functor category sends any object to a monoid object. -/
@[simps]
def functorObjObj (A : C ⥤ D) [MonObj A] (X : C) : Mon D where
X := A.obj X
mon :=
{ one := η[A].app X
mul := μ[A].app X
one_mul := congr_app (one_mul A) X
mul_one := congr_app (mul_one A) X
mul_assoc := congr_app (mul_assoc A) X }
/-- A monoid object in a functor category induces a functor to the category of monoid objects. -/
@[simps]
def functorObj (A : C ⥤ D) [MonObj A] : C ⥤ Mon D where
obj := functorObjObj A
map f :=
{ hom := A.map f
isMonHom_hom :=
{ one_hom := by dsimp; rw [← η[A].naturality, tensorUnit_map]; dsimp; rw [Category.id_comp]
mul_hom := by dsimp; rw [← μ[A].naturality, tensorObj_map] } }
map_id X := by ext; dsimp; rw [CategoryTheory.Functor.map_id]
map_comp f g := by ext; dsimp; rw [Functor.map_comp]
/-- Functor translating a monoid object in a functor category
to a functor into the category of monoid objects.
-/
@[simps]
def functor : Mon (C ⥤ D) ⥤ C ⥤ Mon D where
obj A := functorObj A.X
map f :=
{ app := fun X =>
{ hom := f.hom.app X
isMonHom_hom :=
{ one_hom := congr_app (IsMonHom.one_hom f.hom) X
mul_hom := congr_app (IsMonHom.mul_hom f.hom) X } } }
/-- A functor to the category of monoid objects can be translated as a monoid object
in the functor category. -/
@[simps]
def inverseObj (F : C ⥤ Mon D) : Mon (C ⥤ D) where
X := F ⋙ Mon.forget D
mon :=
{ one := { app X := η[(F.obj X).X] }
mul := { app X := μ[(F.obj X).X] } }
/-- Functor translating a functor into the category of monoid objects
to a monoid object in the functor category
-/
@[simps]
def inverse : (C ⥤ Mon D) ⥤ Mon (C ⥤ D) where
obj := inverseObj
map α := .mk'
{ app := fun X => (α.app X).hom
naturality := fun _ _ f => congr_arg Mon.Hom.hom (α.naturality f) }
/-- The unit for the equivalence `Mon (C ⥤ D) ≌ C ⥤ Mon D`.
-/
@[simps!]
def unitIso : 𝟭 (Mon (C ⥤ D)) ≅ functor ⋙ inverse :=
NatIso.ofComponents (fun A =>
{ hom := .mk' { app := fun _ => 𝟙 _ }
inv := .mk' { app := fun _ => 𝟙 _ } })
/-- The counit for the equivalence `Mon (C ⥤ D) ≌ C ⥤ Mon D`.
-/
@[simps!]
def counitIso : inverse ⋙ functor ≅ 𝟭 (C ⥤ Mon D) :=
NatIso.ofComponents (fun A =>
NatIso.ofComponents (fun X => { hom := { hom := 𝟙 _ }, inv := { hom := 𝟙 _ } }))
end MonFunctorCategoryEquivalence
open MonFunctorCategoryEquivalence
/-- When `D` is a monoidal category,
monoid objects in `C ⥤ D` are the same thing
as functors from `C` into the monoid objects of `D`.
-/
@[simps]
def monFunctorCategoryEquivalence : Mon (C ⥤ D) ≌ C ⥤ Mon D where
functor := functor
inverse := inverse
unitIso := unitIso
counitIso := counitIso
namespace ComonFunctorCategoryEquivalence
variable {C D}
/-- A comonoid object in a functor category sends any object to a comonoid object. -/
@[simps]
def functorObjObj (A : C ⥤ D) [ComonObj A] (X : C) : Comon D where
X := A.obj X
comon :=
{ counit := ε[A].app X
comul := Δ[A].app X
counit_comul := congr_app (counit_comul A) X
comul_counit := congr_app (comul_counit A) X
comul_assoc := congr_app (comul_assoc A) X }
/--
A comonoid object in a functor category induces a functor to the category of comonoid objects.
-/
@[simps]
def functorObj (A : (C ⥤ D)) [ComonObj A] : C ⥤ Comon D where
obj := functorObjObj A
map f :=
{ hom := A.map f
isComonHom_hom.hom_counit := by
dsimp; rw [ε[A].naturality, tensorUnit_map]; dsimp; rw [Category.comp_id]
isComonHom_hom.hom_comul := by dsimp; rw [Δ[A].naturality, tensorObj_map] }
map_id X := by ext; dsimp; rw [CategoryTheory.Functor.map_id]
map_comp f g := by ext; dsimp; rw [Functor.map_comp]
/-- Functor translating a comonoid object in a functor category
to a functor into the category of comonoid objects.
-/
@[simps]
def functor : Comon (C ⥤ D) ⥤ C ⥤ Comon D where
obj A := functorObj A.X
map f :=
{ app := fun X =>
{ hom := f.hom.app X
isComonHom_hom.hom_counit := congr_app (IsComonHom.hom_counit f.hom) X
isComonHom_hom.hom_comul := congr_app (IsComonHom.hom_comul f.hom) X } }
/-- A functor to the category of comonoid objects can be translated as a comonoid object
in the functor category. -/
@[simps]
def inverseObj (F : C ⥤ Comon D) : Comon (C ⥤ D) where
X := F ⋙ Comon.forget D
comon :=
{ counit := { app X := ε[(F.obj X).X] }
comul := { app X := Δ[(F.obj X).X] } }
/-- Functor translating a functor into the category of comonoid objects
to a comonoid object in the functor category
-/
@[simps]
private def inverse : (C ⥤ Comon D) ⥤ Comon (C ⥤ D) where
obj := inverseObj
map α :=
{ hom :=
{ app := fun X => (α.app X).hom
naturality := fun _ _ f => congr_arg Comon.Hom.hom (α.naturality f) }
isComonHom_hom.hom_counit := by ext x; dsimp; rw [IsComonHom.hom_counit (α.app x).hom]
isComonHom_hom.hom_comul := by ext x; dsimp; rw [IsComonHom.hom_comul (α.app x).hom] }
/-- The unit for the equivalence `Comon (C ⥤ D) ≌ C ⥤ Comon D`.
-/
@[simps!]
private def unitIso : 𝟭 (Comon (C ⥤ D)) ≅ functor ⋙ inverse :=
NatIso.ofComponents (fun A =>
{ hom := .mk' { app := fun _ => 𝟙 _ }
inv := .mk' { app := fun _ => 𝟙 _ } })
/-- The counit for the equivalence `Mon (C ⥤ D) ≌ C ⥤ Mon D`.
-/
@[simps!]
def counitIso : inverse ⋙ functor ≅ 𝟭 (C ⥤ Comon D) :=
NatIso.ofComponents (fun A =>
NatIso.ofComponents (fun X => { hom := { hom := 𝟙 _ }, inv := { hom := 𝟙 _ } }) )
end ComonFunctorCategoryEquivalence
open ComonFunctorCategoryEquivalence
/-- When `D` is a monoidal category,
comonoid objects in `C ⥤ D` are the same thing
as functors from `C` into the comonoid objects of `D`.
-/
@[simps]
def comonFunctorCategoryEquivalence : Comon (C ⥤ D) ≌ C ⥤ Comon D where
functor := functor
inverse := inverse
unitIso := unitIso
counitIso := counitIso
variable [BraidedCategory.{v₂} D]
namespace CommMonFunctorCategoryEquivalence
variable {C D}
/-- Functor translating a commutative monoid object in a functor category
to a functor into the category of commutative monoid objects.
-/
@[simps!]
def functor : CommMon (C ⥤ D) ⥤ C ⥤ CommMon D where
obj A :=
{ (monFunctorCategoryEquivalence C D).functor.obj A.toMon with
obj := fun X =>
{ ((monFunctorCategoryEquivalence C D).functor.obj A.toMon).obj X with
comm := { mul_comm := congr_app (IsCommMonObj.mul_comm A.X) X } } }
map f := { app := fun X => ((monFunctorCategoryEquivalence C D).functor.map f).app X }
/-- Functor translating a functor into the category of commutative monoid objects
to a commutative monoid object in the functor category
-/
@[simps!]
def inverse : (C ⥤ CommMon D) ⥤ CommMon (C ⥤ D) where
obj F :=
{ (monFunctorCategoryEquivalence C D).inverse.obj (F ⋙ CommMon.forget₂Mon D) with
comm := { mul_comm := by ext X; exact IsCommMonObj.mul_comm (F.obj X).X } }
map α := (monFunctorCategoryEquivalence C D).inverse.map (Functor.whiskerRight α _)
/-- The unit for the equivalence `CommMon (C ⥤ D) ≌ C ⥤ CommMon D`.
-/
@[simps!]
def unitIso : 𝟭 (CommMon (C ⥤ D)) ≅ functor ⋙ inverse :=
NatIso.ofComponents (fun A =>
{ hom := .mk' { app := fun _ => 𝟙 _ }
inv := .mk' { app := fun _ => 𝟙 _ } })
/-- The counit for the equivalence `CommMon (C ⥤ D) ≌ C ⥤ CommMon D`.
-/
@[simps!]
def counitIso : inverse ⋙ functor ≅ 𝟭 (C ⥤ CommMon D) :=
NatIso.ofComponents (fun A =>
NatIso.ofComponents (fun X => { hom := { hom := 𝟙 _ }, inv := { hom := 𝟙 _ } }) )
end CommMonFunctorCategoryEquivalence
open CommMonFunctorCategoryEquivalence
/-- When `D` is a braided monoidal category,
commutative monoid objects in `C ⥤ D` are the same thing
as functors from `C` into the commutative monoid objects of `D`.
-/
@[simps]
def commMonFunctorCategoryEquivalence : CommMon (C ⥤ D) ≌ C ⥤ CommMon D where
functor := functor
inverse := inverse
unitIso := unitIso
counitIso := counitIso
end CategoryTheory.Monoidal |
.lake/packages/mathlib/Mathlib/CategoryTheory/Monoidal/Internal/Types/Grp_.lean | import Mathlib.CategoryTheory.Monoidal.Internal.Types.Basic
import Mathlib.CategoryTheory.Monoidal.Grp_
import Mathlib.Algebra.Category.Grp.Basic
/-!
# `Grp (Type u) ≌ GrpCat.{u}`
The category of internal group objects in `Type`
is equivalent to the category of "native" bundled groups.
Moreover, this equivalence is compatible with the forgetful functors to `Type`.
-/
assert_not_exists Field
universe v u
open CategoryTheory MonObj
namespace GrpTypeEquivalenceGrp
instance grpGroup (A : Type u) [GrpObj A] : Group A :=
{ MonTypeEquivalenceMon.monMonoid A with
inv := ι[A]
inv_mul_cancel a := congr_fun (GrpObj.left_inv A) a }
/-- Converting a group object in `Type u` into a group. -/
noncomputable def functor : Grp (Type u) ⥤ GrpCat.{u} where
obj A := GrpCat.of A.X
map f := GrpCat.ofHom (MonTypeEquivalenceMon.functor.map f).hom
/-- Converting a group into a group object in `Type u`. -/
noncomputable def inverse : GrpCat.{u} ⥤ Grp (Type u) where
obj A :=
{ MonTypeEquivalenceMon.inverse.obj ((forget₂ GrpCat MonCat).obj A) with
grp :=
{ inv := ((·⁻¹) : A → A)
left_inv := by
ext x
exact inv_mul_cancel (G := A) x
right_inv := by
ext x
exact mul_inv_cancel (G := A) x } }
map f := MonTypeEquivalenceMon.inverse.map ((forget₂ GrpCat MonCat).map f)
end GrpTypeEquivalenceGrp
/-- The category of group objects in `Type u` is equivalent to the category of groups. -/
noncomputable def grpTypeEquivalenceGrp : Grp (Type u) ≌ GrpCat.{u} where
functor := GrpTypeEquivalenceGrp.functor
inverse := GrpTypeEquivalenceGrp.inverse
unitIso := Iso.refl _
counitIso := NatIso.ofComponents
(fun A => MulEquiv.toGrpIso { Equiv.refl _ with map_mul' := fun _ _ => rfl })
(by cat_disch)
/-- The equivalences `Mon (Type u) ≌ MonCat.{u}` and `Grp (Type u) ≌ GrpCat.{u}`
are naturally compatible with the forgetful functors to `MonCat` and `Mon (Type u)`.
-/
noncomputable def grpTypeEquivalenceGrpForget :
GrpTypeEquivalenceGrp.functor ⋙ forget₂ GrpCat MonCat ≅
Grp.forget₂Mon (Type u) ⋙ MonTypeEquivalenceMon.functor :=
Iso.refl _ |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.