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 : C} {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
    @[simp]
    theorem CategoryTheory.eqToHom_naturality_assoc {C : Type u₁} [CategoryTheory.Category.{v₁, u₁} C] {β : Sort u_1} {f : βC} {g : βC} (z : (b : β) → f b g b) {j : β} {j' : β} (w : j = j') {Z : C} (h : g j' Z) :
    @[simp]
    theorem CategoryTheory.eqToHom_naturality {C : Type u₁} [CategoryTheory.Category.{v₁, u₁} C] {β : Sort u_1} {f : βC} {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_assoc {C : Type u₁} [CategoryTheory.Category.{v₁, u₁} C] {β : Sort u_1} {f : βC} {g : βC} (z : (b : β) → f b g b) {j : β} {j' : β} (w : j = j') {Z : C} (h : g j' Z) :
    @[simp]
    theorem CategoryTheory.eqToHom_iso_hom_naturality {C : Type u₁} [CategoryTheory.Category.{v₁, u₁} C] {β : Sort u_1} {f : βC} {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_assoc {C : Type u₁} [CategoryTheory.Category.{v₁, u₁} C] {β : Sort u_1} {f : βC} {g : βC} (z : (b : β) → f b g b) {j : β} {j' : β} (w : j = j') {Z : C} (h : f j' Z) :
    @[simp]
    theorem CategoryTheory.eqToHom_iso_inv_naturality {C : Type u₁} [CategoryTheory.Category.{v₁, u₁} C] {β : Sort u_1} {f : βC} {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.

    @[simp]

    Reducible form of congrArg_mpr_hom_right

    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 : C} {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

      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 : CategoryTheory.Functor C D} {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

      Two morphisms are conjugate via eqToHom if and only if they are heterogeneously equal.

      theorem CategoryTheory.Functor.hext {C : Type u₁} [CategoryTheory.Category.{v₁, u₁} C] {D : Type u₂} [CategoryTheory.Category.{v₂, u₂} D] {F : CategoryTheory.Functor C D} {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.congr_map {C : Type u₁} [CategoryTheory.Category.{v₁, u₁} C] {D : Type u₂} [CategoryTheory.Category.{v₂, u₂} D] (F : CategoryTheory.Functor C D) {X : C} {Y : C} {f : X Y} {g : X Y} (h : f = g) :
      F.map f = F.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 : CategoryTheory.Functor C D} {G : CategoryTheory.Functor C D} {X : C} {Y : C} {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 : CategoryTheory.Functor C D} {G : CategoryTheory.Functor C D} {X : C} {Y : C} {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 : CategoryTheory.Functor C D} {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 : E} {Y : E} (f : X Y) :
      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 : CategoryTheory.Functor C D} {G : CategoryTheory.Functor C D} {X : C} {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)) :
      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 : CategoryTheory.Functor C D} {G : CategoryTheory.Functor C D} {X : C} {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)) :
      theorem CategoryTheory.Functor.hcongr_hom {C : Type u₁} [CategoryTheory.Category.{v₁, u₁} C] {D : Type u₂} [CategoryTheory.Category.{v₂, u₂} D] {F : CategoryTheory.Functor C D} {G : CategoryTheory.Functor C D} (h : F = G) {X : C} {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.

      @[simp]
      theorem CategoryTheory.eqToIso_map_trans {C : Type u₁} [CategoryTheory.Category.{v₁, u₁} C] {D : Type u₂} [CategoryTheory.Category.{v₂, u₂} D] (F : CategoryTheory.Functor C D) {X : C} {Y : C} {Z : C} (p : X = Y) (q : Y = Z) :
      theorem CategoryTheory.dcongr_arg {C : Type u₁} [CategoryTheory.Category.{v₁, u₁} C] {ι : Type u_2} {F : ιC} {G : ιC} (α : (i : ι) → F i G i) {i : ι} {j : ι} (h : i = j) :