HepLean Documentation

Mathlib.CategoryTheory.EqToHom

Morphisms from equations between objects. #

When working categorically, sometimes one encounters an equation h : X = Y between objects.

Your initial aversion to this is natural and appropriate: you're in for some trouble, and if there is another way to approach the problem that won't rely on this equality, it may be worth pursuing.

You have two options:

  1. Use the equality h as one normally would in Lean (e.g. using rw and subst). This may immediately cause difficulties, because in category theory everything is dependently typed, and equations between objects quickly lead to nasty goals with eq.rec.
  2. Promote h to a morphism using eqToHom h : X ⟶ Y, or eqToIso h : X ≅ Y.

This file introduces various simp lemmas which in favourable circumstances result in the various eqToHom morphisms to drop out at the appropriate moment!

def CategoryTheory.eqToHom {C : Type u₁} [CategoryTheory.Category.{v₁, u₁} C] {X Y : C} (p : X = Y) :
X Y

An equality X = Y gives us a morphism X ⟶ Y.

It is typically better to use this, rather than rewriting by the equality then using 𝟙 _ which usually leads to dependent type theory hell.

Equations
Instances For

    Two morphisms are conjugate via eqToHom if and only if they are heterogeneously equal. Note this used to be in the Functor namespace, where it doesn't belong.

    @[simp]
    @[simp]
    @[simp]
    @[simp]
    theorem CategoryTheory.heq_comp {C : Type u_1} [CategoryTheory.Category.{u_2, u_1} C] {X Y Z X' Y' Z' : C} {f : X Y} {g : Y Z} {f' : X' Y'} {g' : Y' Z'} (eq1 : X = X') (eq2 : Y = Y') (eq3 : Z = Z') (H1 : HEq f f') (H2 : HEq g g') :
    @[simp]
    theorem CategoryTheory.eqToHom_naturality {C : Type u₁} [CategoryTheory.Category.{v₁, u₁} C] {β : Sort u_1} {f g : βC} (z : (b : β) → f b g b) {j j' : β} (w : j = j') :

    We can push eqToHom to the left through families of morphisms.

    @[simp]
    theorem CategoryTheory.eqToHom_iso_hom_naturality {C : Type u₁} [CategoryTheory.Category.{v₁, u₁} C] {β : Sort u_1} {f g : βC} (z : (b : β) → f b g b) {j j' : β} (w : j = j') :

    A variant on eqToHom_naturality that helps Lean identify the families f and g.

    @[simp]
    theorem CategoryTheory.eqToHom_iso_inv_naturality {C : Type u₁} [CategoryTheory.Category.{v₁, u₁} C] {β : Sort u_1} {f g : βC} (z : (b : β) → f b g b) {j j' : β} (w : j = j') :

    A variant on eqToHom_naturality that helps Lean identify the families f and g.

    @[simp]

    Reducible form of congrArg_mpr_hom_left

    If we (perhaps unintentionally) perform equational rewriting on the source object of a morphism, we can replace the resulting _.mpr f term by a composition with an eqToHom.

    It may be advisable to introduce any necessary eqToHom morphisms manually, rather than relying on this lemma firing.

    If we (perhaps unintentionally) perform equational rewriting on the target object of a morphism, we can replace the resulting _.mpr f term by a composition with an eqToHom.

    It may be advisable to introduce any necessary eqToHom morphisms manually, rather than relying on this lemma firing.

    def CategoryTheory.eqToIso {C : Type u₁} [CategoryTheory.Category.{v₁, u₁} C] {X Y : C} (p : X = Y) :
    X Y

    An equality X = Y gives us an isomorphism X ≅ Y.

    It is typically better to use this, rather than rewriting by the equality then using Iso.refl _ which usually leads to dependent type theory hell.

    Equations
    Instances For
      theorem CategoryTheory.Functor.ext {C : Type u₁} [CategoryTheory.Category.{v₁, u₁} C] {D : Type u₂} [CategoryTheory.Category.{v₂, u₂} D] {F G : CategoryTheory.Functor C D} (h_obj : ∀ (X : C), F.obj X = G.obj X) (h_map : ∀ (X Y : C) (f : X Y), F.map f = CategoryTheory.CategoryStruct.comp (CategoryTheory.eqToHom ) (CategoryTheory.CategoryStruct.comp (G.map f) (CategoryTheory.eqToHom )) := by aesop_cat) :
      F = G

      Proving equality between functors. This isn't an extensionality lemma, because usually you don't really want to do this.

      theorem CategoryTheory.Functor.ext_of_iso {C : Type u₁} [CategoryTheory.Category.{v₁, u₁} C] {D : Type u₂} [CategoryTheory.Category.{v₂, u₂} D] {F G : CategoryTheory.Functor C D} (e : F G) (hobj : ∀ (X : C), F.obj X = G.obj X) (happ : ∀ (X : C), e.hom.app X = CategoryTheory.eqToHom ) :
      F = G
      theorem CategoryTheory.Functor.hext {C : Type u₁} [CategoryTheory.Category.{v₁, u₁} C] {D : Type u₂} [CategoryTheory.Category.{v₂, u₂} D] {F G : CategoryTheory.Functor C D} (h_obj : ∀ (X : C), F.obj X = G.obj X) (h_map : ∀ (X Y : C) (f : X Y), HEq (F.map f) (G.map f)) :
      F = G

      Proving equality between functors using heterogeneous equality.

      theorem CategoryTheory.Functor.map_comp_heq {C : Type u₁} [CategoryTheory.Category.{v₁, u₁} C] {D : Type u₂} [CategoryTheory.Category.{v₂, u₂} D] {F G : CategoryTheory.Functor C D} {X Y Z : C} {f : X Y} {g : Y Z} (hx : F.obj X = G.obj X) (hy : F.obj Y = G.obj Y) (hz : F.obj Z = G.obj Z) (hf : HEq (F.map f) (G.map f)) (hg : HEq (F.map g) (G.map g)) :
      theorem CategoryTheory.Functor.map_comp_heq' {C : Type u₁} [CategoryTheory.Category.{v₁, u₁} C] {D : Type u₂} [CategoryTheory.Category.{v₂, u₂} D] {F G : CategoryTheory.Functor C D} {X Y Z : C} {f : X Y} {g : Y Z} (hobj : ∀ (X : C), F.obj X = G.obj X) (hmap : ∀ {X Y : C} (f : X Y), HEq (F.map f) (G.map f)) :
      theorem CategoryTheory.Functor.precomp_map_heq {C : Type u₁} [CategoryTheory.Category.{v₁, u₁} C] {D : Type u₂} [CategoryTheory.Category.{v₂, u₂} D] {E : Type u₃} [CategoryTheory.Category.{v₃, u₃} E] {F G : CategoryTheory.Functor C D} (H : CategoryTheory.Functor E C) (hmap : ∀ {X Y : C} (f : X Y), HEq (F.map f) (G.map f)) {X Y : E} (f : X Y) :
      HEq ((H.comp F).map f) ((H.comp G).map f)
      theorem CategoryTheory.Functor.postcomp_map_heq {C : Type u₁} [CategoryTheory.Category.{v₁, u₁} C] {D : Type u₂} [CategoryTheory.Category.{v₂, u₂} D] {E : Type u₃} [CategoryTheory.Category.{v₃, u₃} E] {F G : CategoryTheory.Functor C D} {X Y : C} {f : X Y} (H : CategoryTheory.Functor D E) (hx : F.obj X = G.obj X) (hy : F.obj Y = G.obj Y) (hmap : HEq (F.map f) (G.map f)) :
      HEq ((F.comp H).map f) ((G.comp H).map f)
      theorem CategoryTheory.Functor.postcomp_map_heq' {C : Type u₁} [CategoryTheory.Category.{v₁, u₁} C] {D : Type u₂} [CategoryTheory.Category.{v₂, u₂} D] {E : Type u₃} [CategoryTheory.Category.{v₃, u₃} E] {F G : CategoryTheory.Functor C D} {X Y : C} {f : X Y} (H : CategoryTheory.Functor D E) (hobj : ∀ (X : C), F.obj X = G.obj X) (hmap : ∀ {X Y : C} (f : X Y), HEq (F.map f) (G.map f)) :
      HEq ((F.comp H).map f) ((G.comp H).map f)
      theorem CategoryTheory.Functor.hcongr_hom {C : Type u₁} [CategoryTheory.Category.{v₁, u₁} C] {D : Type u₂} [CategoryTheory.Category.{v₂, u₂} D] {F G : CategoryTheory.Functor C D} (h : F = G) {X Y : C} (f : X Y) :
      HEq (F.map f) (G.map f)

      This is not always a good idea as a @[simp] lemma, as we lose the ability to use results that interact with F, e.g. the naturality of a natural transformation.

      In some files it may be appropriate to use attribute [local simp] eqToHom_map, however.

      See the note on eqToHom_map regarding using this as a simp lemma.

      theorem CategoryTheory.dcongr_arg {C : Type u₁} [CategoryTheory.Category.{v₁, u₁} C] {ι : Type u_2} {F G : ιC} (α : (i : ι) → F i G i) {i j : ι} (h : i = j) :