|
| 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