Skip to content

Commit

Permalink
feat(category_theory/kernels): missing instances (#7204)
Browse files Browse the repository at this point in the history


Co-authored-by: Scott Morrison <scott.morrison@gmail.com>
  • Loading branch information
semorrison and semorrison committed Apr 16, 2021
1 parent 9d1ab69 commit 148760e
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions src/category_theory/limits/shapes/kernels.lean
Expand Up @@ -236,14 +236,18 @@ def kernel_comp_mono {X Y Z : C} (f : X ⟶ Y) (g : Y ⟶ Z) [has_kernel f] [mon
{ hom := kernel.lift _ (kernel.ι _) (by { rw [←cancel_mono g], simp, }),
inv := kernel.lift _ (kernel.ι _) (by simp), }

-- TODO provide an instance `[has_kernel (f ≫ g)]` from `[is_iso f] [has_kernel g]`
instance has_kernel_iso_comp {X Y Z : C} (f : X ⟶ Y) (g : Y ⟶ Z) [is_iso f] [has_kernel g] :
has_kernel (f ≫ g) :=
{ exists_limit :=
⟨{ cone := kernel_fork.of_ι (kernel.ι g ≫ inv f) (by simp),
is_limit := is_limit_aux _ (λ s, kernel.lift _ (s.ι ≫ f) (by tidy)) (by tidy)
(λ s m w, by { simp_rw [←w], ext, simp, }), }⟩ }

/--
When `f` is an isomorphism, the kernel of `f ≫ g` is isomorphic to the kernel of `g`.
-/
@[simps]
def kernel_is_iso_comp {X Y Z : C} (f : X ⟶ Y) (g : Y ⟶ Z)
[has_kernel (f ≫ g)] [is_iso f] [has_kernel g] :
def kernel_is_iso_comp {X Y Z : C} (f : X ⟶ Y) (g : Y ⟶ Z) [is_iso f] [has_kernel g] :
kernel (f ≫ g) ≅ kernel g :=
{ hom := kernel.lift _ (kernel.ι _ ≫ f) (by simp),
inv := kernel.lift _ (kernel.ι _ ≫ inv f) (by simp), }
Expand Down Expand Up @@ -470,14 +474,20 @@ lemma cokernel_not_iso_of_nonzero (w : f ≠ 0) : (is_iso (cokernel.π f)) → f

-- TODO the remainder of this section has obvious generalizations to `has_coequalizer f g`.

-- TODO provide an instance `[has_cokernel (f ≫ g)]` from `[has_cokernel f] [is_iso g]`
instance has_cokernel_comp_iso {X Y Z : C} (f : X ⟶ Y) (g : Y ⟶ Z) [has_cokernel f] [is_iso g] :
has_cokernel (f ≫ g) :=
{ exists_colimit :=
⟨{ cocone := cokernel_cofork.of_π (inv g ≫ cokernel.π f) (by simp),
is_colimit := is_colimit_aux _ (λ s, cokernel.desc _ (g ≫ s.π)
(by { rw [←category.assoc, cokernel_cofork.condition], }))
(by tidy)
(λ s m w, by { simp_rw [←w], ext, simp, }), }⟩ }

/--
When `g` is an isomorphism, the cokernel of `f ≫ g` is isomorphic to the cokernel of `f`.
-/
@[simps]
def cokernel_comp_is_iso {X Y Z : C} (f : X ⟶ Y) (g : Y ⟶ Z)
[has_cokernel (f ≫ g)] [has_cokernel f] [is_iso g] :
def cokernel_comp_is_iso {X Y Z : C} (f : X ⟶ Y) (g : Y ⟶ Z) [has_cokernel f] [is_iso g] :
cokernel (f ≫ g) ≅ cokernel f :=
{ hom := cokernel.desc _ (inv g ≫ cokernel.π f) (by simp),
inv := cokernel.desc _ (g ≫ cokernel.π (f ≫ g)) (by rw [←category.assoc, cokernel.condition]), }
Expand Down

0 comments on commit 148760e

Please sign in to comment.