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

Commit 7c8dc2a

Browse files
b-mehtakim-emmergify[bot]
authored
feat(category_theory/limits): construct equalizers from pullbacks and products (#2124)
* construct equalizers from pullbacks and products * ... * changes from review * Add docstrings * golf proofs a little * linter Co-authored-by: Scott Morrison <scott@tqft.net> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
1 parent 7cffe25 commit 7c8dc2a

File tree

2 files changed

+100
-0
lines changed

2 files changed

+100
-0
lines changed

src/category_theory/category/default.lean

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,16 @@ section
9090
variables {C : Type u} [𝒞 : category.{v} C] {X Y Z : C}
9191
include 𝒞
9292

93+
/-- postcompose an equation between morphisms by another morphism -/
94+
lemma eq_whisker {f g : X ⟶ Y} (w : f = g) (h : Y ⟶ Z) : f ≫ h = g ≫ h :=
95+
by rw w
96+
/-- precompose an equation between morphisms by another morphism -/
97+
lemma whisker_eq (f : X ⟶ Y) {g h : Y ⟶ Z} (w : g = h) : f ≫ g = f ≫ h :=
98+
by rw w
99+
100+
infixr ` =≫ `:80 := eq_whisker
101+
infixr ` ≫= `:80 := whisker_eq
102+
93103
lemma eq_of_comp_left_eq {f g : X ⟶ Y} (w : ∀ {Z : C} (h : Y ⟶ Z), f ≫ h = g ≫ h) : f = g :=
94104
by { convert w (𝟙 Y), tidy }
95105
lemma eq_of_comp_right_eq {f g : Y ⟶ Z} (w : ∀ {X : C} (h : X ⟶ Y), h ≫ f = h ≫ g) : f = g :=
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
/-
2+
Copyright (c) 2020 Bhavik Mehta. All rights reserved.
3+
Released under Apache 2.0 license as described in the file LICENSE.
4+
Authors: Bhavik Mehta
5+
-/
6+
7+
import category_theory.limits.shapes.equalizers
8+
import category_theory.limits.shapes.binary_products
9+
import category_theory.limits.shapes.pullbacks
10+
11+
/-!
12+
# Constructing equalizers from pullbacks and binary products.
13+
14+
If a category has pullbacks and binary products, then it has equalizers.
15+
16+
TODO: provide the dual result.
17+
-/
18+
universes v u
19+
20+
open category_theory category_theory.category
21+
22+
namespace category_theory.limits
23+
24+
variables {C : Type u} [𝒞 : category.{v} C] [has_binary_products.{v} C] [has_pullbacks.{v} C]
25+
include 𝒞
26+
27+
-- We hide the "implementation details" inside a namespace
28+
namespace has_equalizers_of_pullbacks_and_binary_products
29+
30+
/-- Define the equalizing object -/
31+
@[reducible]
32+
def construct_equalizer (F : walking_parallel_pair ⥤ C) : C :=
33+
pullback (prod.lift (𝟙 _) (F.map walking_parallel_pair_hom.left))
34+
(prod.lift (𝟙 _) (F.map walking_parallel_pair_hom.right))
35+
36+
/-- Define the equalizing morphism -/
37+
abbreviation pullback_fst (F : walking_parallel_pair ⥤ C) :
38+
construct_equalizer F ⟶ F.obj walking_parallel_pair.zero :=
39+
pullback.fst
40+
41+
lemma pullback_fst_eq_pullback_snd (F : walking_parallel_pair ⥤ C) :
42+
pullback_fst F = pullback.snd :=
43+
by convert pullback.condition =≫ limits.prod.fst; simp
44+
45+
/-- Define the equalizing cone -/
46+
@[reducible]
47+
def equalizer_cone (F : walking_parallel_pair ⥤ C) : cone F :=
48+
cone.of_fork
49+
(fork.of_ι (pullback_fst F)
50+
(begin
51+
conv_rhs { rw pullback_fst_eq_pullback_snd, },
52+
convert pullback.condition =≫ limits.prod.snd using 1; simp
53+
end))
54+
55+
/-- Show the equalizing cone is a limit -/
56+
def equalizer_cone_is_limit (F : walking_parallel_pair ⥤ C) : is_limit (equalizer_cone F) :=
57+
{ lift :=
58+
begin
59+
intro c, apply pullback.lift (c.π.app _) (c.π.app _),
60+
apply limit.hom_ext,
61+
rintro (_ | _); simp
62+
end,
63+
fac' :=
64+
begin
65+
rintros c (_ | _),
66+
{ simp, refl },
67+
{ simp, exact c.w _ }
68+
end,
69+
uniq' :=
70+
begin
71+
intros c _ J,
72+
have J0 := J walking_parallel_pair.zero, simp at J0,
73+
apply pullback.hom_ext,
74+
{ rwa limit.lift_π },
75+
{ erw [limit.lift_π, ← J0, pullback_fst_eq_pullback_snd] }
76+
end }
77+
78+
end has_equalizers_of_pullbacks_and_binary_products
79+
80+
open has_equalizers_of_pullbacks_and_binary_products
81+
/-- Any category with pullbacks and binary products, has equalizers. -/
82+
-- This is not an instance, as it is not always how one wants to construct equalizers!
83+
def has_equalizers_of_pullbacks_and_binary_products :
84+
has_equalizers.{v} C :=
85+
{ has_limits_of_shape :=
86+
{ has_limit := λ F,
87+
{ cone := equalizer_cone F,
88+
is_limit := equalizer_cone_is_limit F } } }
89+
90+
end category_theory.limits

0 commit comments

Comments
 (0)