|
| 1 | +-- Copyright (c) 2018 Scott Morrison. All rights reserved. |
| 2 | +-- Released under Apache 2.0 license as described in the file LICENSE. |
| 3 | +-- Authors: Scott Morrison, Reid Barton |
| 4 | + |
| 5 | +-- Preservation and reflection of (co)limits. |
| 6 | + |
| 7 | +import category_theory.whiskering |
| 8 | +import category_theory.limits.limits |
| 9 | + |
| 10 | +open category_theory |
| 11 | + |
| 12 | +namespace category_theory.limits |
| 13 | + |
| 14 | +universes u₁ u₂ u₃ v |
| 15 | + |
| 16 | +variables {C : Type u₁} [𝒞 : category.{u₁ v} C] |
| 17 | +variables {D : Type u₂} [𝒟 : category.{u₂ v} D] |
| 18 | +include 𝒞 𝒟 |
| 19 | + |
| 20 | +variables {J : Type v} [small_category J] {K : J ⥤ C} |
| 21 | + |
| 22 | +/- Note on "preservation of (co)limits" |
| 23 | +
|
| 24 | +There are various distinct notions of "preserving limits". The one we |
| 25 | +aim to capture here is: A functor F : C → D "preserves limits" if it |
| 26 | +sends every limit cone in C to a limit cone in D. Informally, F |
| 27 | +preserves all the limits which exist in C. |
| 28 | +
|
| 29 | +Note that: |
| 30 | +
|
| 31 | +* Of course, we do not want to require F to *strictly* take chosen |
| 32 | + limit cones of C to chosen limit cones of D. Indeed, the above |
| 33 | + definition makes no reference to a choice of limit cones so it makes |
| 34 | + sense without any conditions on C or D. |
| 35 | +
|
| 36 | +* Some diagrams in C may have no limit. In this case, there is no |
| 37 | + condition on the behavior of F on such diagrams. There are other |
| 38 | + notions (such as "flat functor") which impose conditions also on |
| 39 | + diagrams in C with no limits, but these are not considered here. |
| 40 | +
|
| 41 | +In order to be able to express the property of preserving limits of a |
| 42 | +certain form, we say that a functor F preserves the limit of a |
| 43 | +diagram K if F sends every limit cone on K to a limit cone. This is |
| 44 | +vacuously satisfied when K does not admit a limit, which is consistent |
| 45 | +with the above definition of "preserves limits". |
| 46 | +
|
| 47 | +-/ |
| 48 | + |
| 49 | +class preserves_limit (K : J ⥤ C) (F : C ⥤ D) := |
| 50 | +(preserves : Π {c : cone K}, is_limit c → is_limit (F.map_cone c)) |
| 51 | +class preserves_colimit (K : J ⥤ C) (F : C ⥤ D) := |
| 52 | +(preserves : Π {c : cocone K}, is_colimit c → is_colimit (F.map_cocone c)) |
| 53 | + |
| 54 | +@[class] def preserves_limits_of_shape (J : Type v) [small_category J] (F : C ⥤ D) := |
| 55 | +Π {K : J ⥤ C}, preserves_limit K F |
| 56 | +@[class] def preserves_colimits_of_shape (J : Type v) [small_category J] (F : C ⥤ D) := |
| 57 | +Π {K : J ⥤ C}, preserves_colimit K F |
| 58 | + |
| 59 | +@[class] def preserves_limits (F : C ⥤ D) := |
| 60 | +Π {J : Type v} {𝒥 : small_category J}, by exactI preserves_limits_of_shape J F |
| 61 | +@[class] def preserves_colimits (F : C ⥤ D) := |
| 62 | +Π {J : Type v} {𝒥 : small_category J}, by exactI preserves_colimits_of_shape J F |
| 63 | + |
| 64 | +instance preserves_limit_of_preserves_limits_of_shape (F : C ⥤ D) |
| 65 | + [H : preserves_limits_of_shape J F] : preserves_limit K F := |
| 66 | +H |
| 67 | +instance preserves_colimit_of_preserves_colimits_of_shape (F : C ⥤ D) |
| 68 | + [H : preserves_colimits_of_shape J F] : preserves_colimit K F := |
| 69 | +H |
| 70 | + |
| 71 | +instance preserves_limits_of_shape_of_preserves_limits (F : C ⥤ D) |
| 72 | + [H : preserves_limits F] : preserves_limits_of_shape J F := |
| 73 | +@H J _ |
| 74 | +instance preserves_colimits_of_shape_of_preserves_colimits (F : C ⥤ D) |
| 75 | + [H : preserves_colimits F] : preserves_colimits_of_shape J F := |
| 76 | +@H J _ |
| 77 | + |
| 78 | +instance id_preserves_limits : preserves_limits (functor.id C) := |
| 79 | +λ J 𝒥 K, by exactI ⟨λ c h, |
| 80 | + ⟨λ s, h.lift ⟨s.X, λ j, s.π.app j, λ j j' f, s.π.naturality f⟩, |
| 81 | + by cases K; rcases c with ⟨_, _, _⟩; intros s j; cases s; exact h.fac _ j, |
| 82 | + by cases K; rcases c with ⟨_, _, _⟩; intros s m w; rcases s with ⟨_, _, _⟩; exact h.uniq _ m w⟩⟩ |
| 83 | + |
| 84 | +instance id_preserves_colimits : preserves_colimits (functor.id C) := |
| 85 | +λ J 𝒥 K, by exactI ⟨λ c h, |
| 86 | + ⟨λ s, h.desc ⟨s.X, λ j, s.ι.app j, λ j j' f, s.ι.naturality f⟩, |
| 87 | + by cases K; rcases c with ⟨_, _, _⟩; intros s j; cases s; exact h.fac _ j, |
| 88 | + by cases K; rcases c with ⟨_, _, _⟩; intros s m w; rcases s with ⟨_, _, _⟩; exact h.uniq _ m w⟩⟩ |
| 89 | + |
| 90 | +section |
| 91 | +variables {E : Type u₃} [ℰ : category.{u₃ v} E] |
| 92 | +variables (F : C ⥤ D) (G : D ⥤ E) |
| 93 | + |
| 94 | +local attribute [elab_simple] preserves_limit.preserves preserves_colimit.preserves |
| 95 | + |
| 96 | +instance comp_preserves_limit [preserves_limit K F] [preserves_limit (K ⋙ F) G] : |
| 97 | + preserves_limit K (F ⋙ G) := |
| 98 | +⟨λ c h, preserves_limit.preserves G (preserves_limit.preserves F h)⟩ |
| 99 | + |
| 100 | +instance comp_preserves_colimit [preserves_colimit K F] [preserves_colimit (K ⋙ F) G] : |
| 101 | + preserves_colimit K (F ⋙ G) := |
| 102 | +⟨λ c h, preserves_colimit.preserves G (preserves_colimit.preserves F h)⟩ |
| 103 | + |
| 104 | +end |
| 105 | + |
| 106 | +/-- If F preserves one limit cone for the diagram K, |
| 107 | + then it preserves any limit cone for K. -/ |
| 108 | +def preserves_limit_of_preserves_limit_cone {F : C ⥤ D} {t : cone K} |
| 109 | + (h : is_limit t) (hF : is_limit (F.map_cone t)) : preserves_limit K F := |
| 110 | +⟨λ t' h', is_limit.of_iso_limit hF (functor.on_iso _ (is_limit.unique h h'))⟩ |
| 111 | + |
| 112 | +/-- If F preserves one colimit cocone for the diagram K, |
| 113 | + then it preserves any colimit cocone for K. -/ |
| 114 | +def preserves_colimit_of_preserves_colimit_cocone {F : C ⥤ D} {t : cocone K} |
| 115 | + (h : is_colimit t) (hF : is_colimit (F.map_cocone t)) : preserves_colimit K F := |
| 116 | +⟨λ t' h', is_colimit.of_iso_colimit hF (functor.on_iso _ (is_colimit.unique h h'))⟩ |
| 117 | + |
| 118 | +/- |
| 119 | +A functor F : C → D reflects limits if whenever the image of a cone |
| 120 | +under F is a limit cone in D, the cone was already a limit cone in C. |
| 121 | +Note that again we do not assume a priori that D actually has any |
| 122 | +limits. |
| 123 | +-/ |
| 124 | + |
| 125 | +class reflects_limit (K : J ⥤ C) (F : C ⥤ D) := |
| 126 | +(reflects : Π {c : cone K}, is_limit (F.map_cone c) → is_limit c) |
| 127 | +class reflects_colimit (K : J ⥤ C) (F : C ⥤ D) := |
| 128 | +(reflects : Π {c : cocone K}, is_colimit (F.map_cocone c) → is_colimit c) |
| 129 | + |
| 130 | +@[class] def reflects_limits_of_shape (J : Type v) [small_category J] (F : C ⥤ D) := |
| 131 | +Π {K : J ⥤ C}, reflects_limit K F |
| 132 | +@[class] def reflects_colimits_of_shape (J : Type v) [small_category J] (F : C ⥤ D) := |
| 133 | +Π {K : J ⥤ C}, reflects_colimit K F |
| 134 | + |
| 135 | +@[class] def reflects_limits (F : C ⥤ D) := |
| 136 | +Π {J : Type v} {𝒥 : small_category J}, by exactI reflects_limits_of_shape J F |
| 137 | +@[class] def reflects_colimits (F : C ⥤ D) := |
| 138 | +Π {J : Type v} {𝒥 : small_category J}, by exactI reflects_colimits_of_shape J F |
| 139 | + |
| 140 | +instance reflects_limit_of_reflects_limits_of_shape (K : J ⥤ C) (F : C ⥤ D) |
| 141 | + [H : reflects_limits_of_shape J F] : reflects_limit K F := |
| 142 | +H |
| 143 | +instance reflects_colimit_of_reflects_colimits_of_shape (K : J ⥤ C) (F : C ⥤ D) |
| 144 | + [H : reflects_colimits_of_shape J F] : reflects_colimit K F := |
| 145 | +H |
| 146 | + |
| 147 | +instance reflects_limits_of_shape_of_reflects_limits (F : C ⥤ D) |
| 148 | + [H : reflects_limits F] : reflects_limits_of_shape J F := |
| 149 | +@H J _ |
| 150 | +instance reflects_colimits_of_shape_of_reflects_colimits (F : C ⥤ D) |
| 151 | + [H : reflects_colimits F] : reflects_colimits_of_shape J F := |
| 152 | +@H J _ |
| 153 | + |
| 154 | +instance id_reflects_limits : reflects_limits (functor.id C) := |
| 155 | +λ J 𝒥 K, by exactI ⟨λ c h, |
| 156 | + ⟨λ s, h.lift ⟨s.X, λ j, s.π.app j, λ j j' f, s.π.naturality f⟩, |
| 157 | + by cases K; rcases c with ⟨_, _, _⟩; intros s j; cases s; exact h.fac _ j, |
| 158 | + by cases K; rcases c with ⟨_, _, _⟩; intros s m w; rcases s with ⟨_, _, _⟩; exact h.uniq _ m w⟩⟩ |
| 159 | + |
| 160 | +instance id_reflects_colimits : reflects_colimits (functor.id C) := |
| 161 | +λ J 𝒥 K, by exactI ⟨λ c h, |
| 162 | + ⟨λ s, h.desc ⟨s.X, λ j, s.ι.app j, λ j j' f, s.ι.naturality f⟩, |
| 163 | + by cases K; rcases c with ⟨_, _, _⟩; intros s j; cases s; exact h.fac _ j, |
| 164 | + by cases K; rcases c with ⟨_, _, _⟩; intros s m w; rcases s with ⟨_, _, _⟩; exact h.uniq _ m w⟩⟩ |
| 165 | + |
| 166 | +section |
| 167 | +variables {E : Type u₃} [ℰ : category.{u₃ v} E] |
| 168 | +variables (F : C ⥤ D) (G : D ⥤ E) |
| 169 | + |
| 170 | +instance comp_reflects_limit [reflects_limit K F] [reflects_limit (K ⋙ F) G] : |
| 171 | + reflects_limit K (F ⋙ G) := |
| 172 | +⟨λ c h, reflects_limit.reflects (reflects_limit.reflects h)⟩ |
| 173 | + |
| 174 | +instance comp_reflects_colimit [reflects_colimit K F] [reflects_colimit (K ⋙ F) G] : |
| 175 | + reflects_colimit K (F ⋙ G) := |
| 176 | +⟨λ c h, reflects_colimit.reflects (reflects_colimit.reflects h)⟩ |
| 177 | + |
| 178 | +end |
| 179 | + |
| 180 | +end category_theory.limits |
0 commit comments