Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.

Commit e355933

Browse files
committed
chore(category_theory/limits): remove unnecessary typeclass arguments (#4141)
Ongoing cleanup post #3995. Previously we couldn't construct things like `instance : has_kernel (0 : X \hom Y)`, because it wouldn't have agreed definitionally with more general instances. Now we can. Co-authored-by: Scott Morrison <scott.morrison@gmail.com>
1 parent bd385fb commit e355933

File tree

2 files changed

+32
-22
lines changed

2 files changed

+32
-22
lines changed

src/category_theory/limits/shapes/equalizers.lean

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -507,19 +507,24 @@ is_iso_limit_cone_parallel_pair_of_eq ((cancel_epi _).1 (fork.condition c)) h
507507

508508
end
509509

510+
instance : has_equalizer f f :=
511+
has_limit.mk
512+
{ cone := id_fork rfl,
513+
is_limit := is_limit_id_fork rfl }
514+
510515
/-- The equalizer inclusion for `(f, f)` is an isomorphism. -/
511-
instance equalizer.ι_of_self [has_equalizer f f] : is_iso (equalizer.ι f f) :=
516+
instance equalizer.ι_of_self : is_iso (equalizer.ι f f) :=
512517
equalizer.ι_of_eq rfl
513518

514519
/-- The equalizer of a morphism with itself is isomorphic to the source. -/
515-
def equalizer.iso_source_of_self [has_equalizer f f] : equalizer f f ≅ X :=
520+
def equalizer.iso_source_of_self : equalizer f f ≅ X :=
516521
as_iso (equalizer.ι f f)
517522

518-
@[simp] lemma equalizer.iso_source_of_self_hom [has_equalizer f f] :
523+
@[simp] lemma equalizer.iso_source_of_self_hom :
519524
(equalizer.iso_source_of_self f).hom = equalizer.ι f f :=
520525
rfl
521526

522-
@[simp] lemma equalizer.iso_source_of_self_inv [has_equalizer f f] :
527+
@[simp] lemma equalizer.iso_source_of_self_inv :
523528
(equalizer.iso_source_of_self f).inv = equalizer.lift (𝟙 X) (by simp) :=
524529
rfl
525530

@@ -643,19 +648,24 @@ is_iso_colimit_cocone_parallel_pair_of_eq ((cancel_mono _).1 (cofork.condition c
643648

644649
end
645650

651+
instance : has_coequalizer f f :=
652+
has_colimit.mk
653+
{ cocone := id_cofork rfl,
654+
is_colimit := is_colimit_id_cofork rfl }
655+
646656
/-- The coequalizer projection for `(f, f)` is an isomorphism. -/
647-
instance coequalizer.π_of_self [has_coequalizer f f] : is_iso (coequalizer.π f f) :=
657+
instance coequalizer.π_of_self : is_iso (coequalizer.π f f) :=
648658
coequalizer.π_of_eq rfl
649659

650660
/-- The coequalizer of a morphism with itself is isomorphic to the target. -/
651-
def coequalizer.iso_target_of_self [has_coequalizer f f] : coequalizer f f ≅ Y :=
661+
def coequalizer.iso_target_of_self : coequalizer f f ≅ Y :=
652662
(as_iso (coequalizer.π f f)).symm
653663

654-
@[simp] lemma coequalizer.iso_target_of_self_hom [has_coequalizer f f] :
664+
@[simp] lemma coequalizer.iso_target_of_self_hom :
655665
(coequalizer.iso_target_of_self f).hom = coequalizer.desc (𝟙 Y) (by simp) :=
656666
rfl
657667

658-
@[simp] lemma coequalizer.iso_target_of_self_inv [has_coequalizer f f] :
668+
@[simp] lemma coequalizer.iso_target_of_self_inv :
659669
(coequalizer.iso_target_of_self f).inv = coequalizer.π f f :=
660670
rfl
661671

src/category_theory/limits/shapes/kernels.lean

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ import category_theory.limits.shapes.zero
88
/-!
99
# Kernels and cokernels
1010
11-
In a category with zero morphisms, the kernel of a morphism `f : X ⟶ Y` is the equalizer of `f`
12-
and `0 : X ⟶ Y`. (Similarly the cokernel is the coequalizer.)
11+
In a category with zero morphisms, the kernel of a morphism `f : X ⟶ Y` is
12+
the equalizer of `f` and `0 : X ⟶ Y`. (Similarly the cokernel is the coequalizer.)
1313
1414
The basic definitions are
1515
* `kernel : (X ⟶ Y) → C`
@@ -177,21 +177,21 @@ def kernel.lift' {W : C} (k : W ⟶ X) (h : k ≫ f = 0) : {l : W ⟶ kernel f /
177177
⟨kernel.lift f k h, kernel.lift_ι _ _ _⟩
178178

179179
/-- Every kernel of the zero morphism is an isomorphism -/
180-
instance kernel.ι_zero_is_iso [has_kernel (0 : X ⟶ Y)] :
180+
instance kernel.ι_zero_is_iso :
181181
is_iso (kernel.ι (0 : X ⟶ Y)) :=
182182
equalizer.ι_of_self _
183183

184184
lemma eq_zero_of_epi_kernel [epi (kernel.ι f)] : f = 0 :=
185185
(cancel_epi (kernel.ι f)).1 (by simp)
186186

187187
/-- The kernel of a zero morphism is isomorphic to the source. -/
188-
def kernel_zero_iso_source [has_kernel (0 : X ⟶ Y)] : kernel (0 : X ⟶ Y) ≅ X :=
188+
def kernel_zero_iso_source : kernel (0 : X ⟶ Y) ≅ X :=
189189
equalizer.iso_source_of_self 0
190190

191-
@[simp] lemma kernel_zero_iso_source_hom [has_kernel (0 : X ⟶ Y)] :
191+
@[simp] lemma kernel_zero_iso_source_hom :
192192
kernel_zero_iso_source.hom = kernel.ι (0 : X ⟶ Y) := rfl
193193

194-
@[simp] lemma kernel_zero_iso_source_inv [has_kernel (0 : X ⟶ Y)] :
194+
@[simp] lemma kernel_zero_iso_source_inv :
195195
kernel_zero_iso_source.inv = kernel.lift (0 : X ⟶ Y) (𝟙 X) (by simp) := rfl
196196

197197
/-- If two morphisms are known to be equal, then their kernels are isomorphic. -/
@@ -328,7 +328,7 @@ section
328328
variables (X Y)
329329

330330
/-- The kernel morphism of a zero morphism is an isomorphism -/
331-
def kernel.ι_of_zero [has_kernel (0 : X ⟶ Y)] : is_iso (kernel.ι (0 : X ⟶ Y)) :=
331+
def kernel.ι_of_zero : is_iso (kernel.ι (0 : X ⟶ Y)) :=
332332
equalizer.ι_of_self _
333333

334334
end
@@ -436,21 +436,21 @@ def cokernel.desc' {W : C} (k : Y ⟶ W) (h : f ≫ k = 0) :
436436
⟨cokernel.desc f k h, cokernel.π_desc _ _ _⟩
437437

438438
/-- The cokernel of the zero morphism is an isomorphism -/
439-
instance cokernel.π_zero_is_iso [has_colimit (parallel_pair (0 : X ⟶ Y) 0)] :
439+
instance cokernel.π_zero_is_iso :
440440
is_iso (cokernel.π (0 : X ⟶ Y)) :=
441441
coequalizer.π_of_self _
442442

443443
lemma eq_zero_of_mono_cokernel [mono (cokernel.π f)] : f = 0 :=
444444
(cancel_mono (cokernel.π f)).1 (by simp)
445445

446446
/-- The cokernel of a zero morphism is isomorphic to the target. -/
447-
def cokernel_zero_iso_target [has_cokernel (0 : X ⟶ Y)] : cokernel (0 : X ⟶ Y) ≅ Y :=
447+
def cokernel_zero_iso_target : cokernel (0 : X ⟶ Y) ≅ Y :=
448448
coequalizer.iso_target_of_self 0
449449

450-
@[simp] lemma cokernel_zero_iso_target_hom [has_cokernel (0 : X ⟶ Y)] :
450+
@[simp] lemma cokernel_zero_iso_target_hom :
451451
cokernel_zero_iso_target.hom = cokernel.desc (0 : X ⟶ Y) (𝟙 Y) (by simp) := rfl
452452

453-
@[simp] lemma cokernel_zero_iso_target_inv [has_cokernel (0 : X ⟶ Y)] :
453+
@[simp] lemma cokernel_zero_iso_target_inv :
454454
cokernel_zero_iso_target.inv = cokernel.π (0 : X ⟶ Y) := rfl
455455

456456
/-- If two morphisms are known to be equal, then their cokernels are isomorphic. -/
@@ -580,7 +580,7 @@ section
580580
variables (X Y)
581581

582582
/-- The cokernel of a zero morphism is an isomorphism -/
583-
def cokernel.π_of_zero [has_cokernel (0 : X ⟶ Y)] :
583+
def cokernel.π_of_zero :
584584
is_iso (cokernel.π (0 : X ⟶ Y)) :=
585585
coequalizer.π_of_self _
586586

@@ -646,11 +646,11 @@ variables (C : Type u) [category.{v} C]
646646

647647
variables [has_zero_morphisms C]
648648

649-
/-- `has_kernels` represents a choice of kernel for every morphism -/
649+
/-- `has_kernels` represents the existence of kernels for every morphism. -/
650650
class has_kernels : Prop :=
651651
(has_limit : Π {X Y : C} (f : X ⟶ Y), has_kernel f)
652652

653-
/-- `has_cokernels` represents a choice of cokernel for every morphism -/
653+
/-- `has_cokernels` represents the existence of cokernels for every morphism. -/
654654
class has_cokernels : Prop :=
655655
(has_colimit : Π {X Y : C} (f : X ⟶ Y), has_cokernel f)
656656

0 commit comments

Comments
 (0)