|
| 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 | +! This file was ported from Lean 3 source module category_theory.limits.shapes.reflexive |
| 7 | +! leanprover-community/mathlib commit d6814c584384ddf2825ff038e868451a7c956f31 |
| 8 | +! Please do not edit these lines, except to modify the commit id |
| 9 | +! if you have ported upstream changes. |
| 10 | +-/ |
| 11 | +import Mathlib.CategoryTheory.Limits.Shapes.Equalizers |
| 12 | +import Mathlib.CategoryTheory.Limits.Shapes.KernelPair |
| 13 | + |
| 14 | +/-! |
| 15 | +# Reflexive coequalizers |
| 16 | +
|
| 17 | +We define reflexive pairs as a pair of morphisms which have a common section. We say a category has |
| 18 | +reflexive coequalizers if it has coequalizers of all reflexive pairs. |
| 19 | +Reflexive coequalizers often enjoy nicer properties than general coequalizers, and feature heavily |
| 20 | +in some versions of the monadicity theorem. |
| 21 | +
|
| 22 | +We also give some examples of reflexive pairs: for an adjunction `F ⊣ G` with counit `ε`, the pair |
| 23 | +`(FGε_B, ε_FGB)` is reflexive. If a pair `f,g` is a kernel pair for some morphism, then it is |
| 24 | +reflexive. |
| 25 | +
|
| 26 | +# TODO |
| 27 | +* If `C` has binary coproducts and reflexive coequalizers, then it has all coequalizers. |
| 28 | +* If `T` is a monad on cocomplete category `C`, then `Algebra T` is cocomplete iff it has reflexive |
| 29 | + coequalizers. |
| 30 | +* If `C` is locally cartesian closed and has reflexive coequalizers, then it has images: in fact |
| 31 | + regular epi (and hence strong epi) images. |
| 32 | +-/ |
| 33 | + |
| 34 | + |
| 35 | +namespace CategoryTheory |
| 36 | + |
| 37 | +universe v v₂ u u₂ |
| 38 | + |
| 39 | +variable {C : Type u} [Category.{v} C] |
| 40 | + |
| 41 | +variable {D : Type u₂} [Category.{v₂} D] |
| 42 | + |
| 43 | +variable {A B : C} {f g : A ⟶ B} |
| 44 | + |
| 45 | +/-- The pair `f g : A ⟶ B` is reflexive if there is a morphism `B ⟶ A` which is a section for both. |
| 46 | +-/ |
| 47 | +class IsReflexivePair (f g : A ⟶ B) : Prop where |
| 48 | + common_section' : ∃ s : B ⟶ A, s ≫ f = 𝟙 B ∧ s ≫ g = 𝟙 B |
| 49 | +#align category_theory.is_reflexive_pair CategoryTheory.IsReflexivePair |
| 50 | + |
| 51 | +-- porting note: added theorem, because of unsupported infer kinds |
| 52 | +theorem IsReflexivePair.common_section (f g : A ⟶ B) [IsReflexivePair f g]: |
| 53 | + ∃ s : B ⟶ A, s ≫ f = 𝟙 B ∧ s ≫ g = 𝟙 B := IsReflexivePair.common_section' |
| 54 | + |
| 55 | +/-- |
| 56 | +The pair `f g : A ⟶ B` is coreflexive if there is a morphism `B ⟶ A` which is a retraction for both. |
| 57 | +-/ |
| 58 | +class IsCoreflexivePair (f g : A ⟶ B) : Prop where |
| 59 | + common_retraction' : ∃ s : B ⟶ A, f ≫ s = 𝟙 A ∧ g ≫ s = 𝟙 A |
| 60 | +#align category_theory.is_coreflexive_pair CategoryTheory.IsCoreflexivePair |
| 61 | + |
| 62 | +-- porting note: added theorem, because of unsupported infer kinds |
| 63 | +theorem IsCoreflexivePair.common_retraction (f g : A ⟶ B) [IsCoreflexivePair f g]: |
| 64 | + ∃ s : B ⟶ A, f ≫ s = 𝟙 A ∧ g ≫ s = 𝟙 A := IsCoreflexivePair.common_retraction' |
| 65 | + |
| 66 | +theorem IsReflexivePair.mk' (s : B ⟶ A) (sf : s ≫ f = 𝟙 B) (sg : s ≫ g = 𝟙 B) : |
| 67 | + IsReflexivePair f g := |
| 68 | + ⟨⟨s, sf, sg⟩⟩ |
| 69 | +#align category_theory.is_reflexive_pair.mk' CategoryTheory.IsReflexivePair.mk' |
| 70 | + |
| 71 | +theorem IsCoreflexivePair.mk' (s : B ⟶ A) (fs : f ≫ s = 𝟙 A) (gs : g ≫ s = 𝟙 A) : |
| 72 | + IsCoreflexivePair f g := |
| 73 | + ⟨⟨s, fs, gs⟩⟩ |
| 74 | +#align category_theory.is_coreflexive_pair.mk' CategoryTheory.IsCoreflexivePair.mk' |
| 75 | + |
| 76 | +/-- Get the common section for a reflexive pair. -/ |
| 77 | +noncomputable def commonSection (f g : A ⟶ B) [IsReflexivePair f g] : B ⟶ A := |
| 78 | + (IsReflexivePair.common_section f g).choose |
| 79 | +#align category_theory.common_section CategoryTheory.commonSection |
| 80 | + |
| 81 | +@[reassoc (attr := simp)] |
| 82 | +theorem section_comp_left (f g : A ⟶ B) [IsReflexivePair f g] : commonSection f g ≫ f = 𝟙 B := |
| 83 | + (IsReflexivePair.common_section f g).choose_spec.1 |
| 84 | +#align category_theory.section_comp_left CategoryTheory.section_comp_left |
| 85 | + |
| 86 | +@[reassoc (attr := simp)] |
| 87 | +theorem section_comp_right (f g : A ⟶ B) [IsReflexivePair f g] : commonSection f g ≫ g = 𝟙 B := |
| 88 | + (IsReflexivePair.common_section f g).choose_spec.2 |
| 89 | +#align category_theory.section_comp_right CategoryTheory.section_comp_right |
| 90 | + |
| 91 | +/-- Get the common retraction for a coreflexive pair. -/ |
| 92 | +noncomputable def commonRetraction (f g : A ⟶ B) [IsCoreflexivePair f g] : B ⟶ A := |
| 93 | + (IsCoreflexivePair.common_retraction f g).choose |
| 94 | +#align category_theory.common_retraction CategoryTheory.commonRetraction |
| 95 | + |
| 96 | +@[reassoc (attr := simp)] |
| 97 | +theorem left_comp_retraction (f g : A ⟶ B) [IsCoreflexivePair f g] : |
| 98 | + f ≫ commonRetraction f g = 𝟙 A := |
| 99 | + (IsCoreflexivePair.common_retraction f g).choose_spec.1 |
| 100 | +#align category_theory.left_comp_retraction CategoryTheory.left_comp_retraction |
| 101 | + |
| 102 | +@[reassoc (attr := simp)] |
| 103 | +theorem right_comp_retraction (f g : A ⟶ B) [IsCoreflexivePair f g] : |
| 104 | + g ≫ commonRetraction f g = 𝟙 A := |
| 105 | + (IsCoreflexivePair.common_retraction f g).choose_spec.2 |
| 106 | +#align category_theory.right_comp_retraction CategoryTheory.right_comp_retraction |
| 107 | + |
| 108 | +/-- If `f,g` is a kernel pair for some morphism `q`, then it is reflexive. -/ |
| 109 | +theorem IsKernelPair.isReflexivePair {R : C} {f g : R ⟶ A} {q : A ⟶ B} (h : IsKernelPair q f g) : |
| 110 | + IsReflexivePair f g := |
| 111 | + IsReflexivePair.mk' _ (h.lift' _ _ rfl).2.1 (h.lift' _ _ _).2.2 |
| 112 | +#align category_theory.is_kernel_pair.is_reflexive_pair CategoryTheory.IsKernelPair.isReflexivePair |
| 113 | + |
| 114 | +-- This shouldn't be an instance as it would instantly loop. |
| 115 | +/-- If `f,g` is reflexive, then `g,f` is reflexive. -/ |
| 116 | +theorem IsReflexivePair.swap [IsReflexivePair f g] : IsReflexivePair g f := |
| 117 | + IsReflexivePair.mk' _ (section_comp_right f g) (section_comp_left f g) |
| 118 | +#align category_theory.is_reflexive_pair.swap CategoryTheory.IsReflexivePair.swap |
| 119 | + |
| 120 | +-- This shouldn't be an instance as it would instantly loop. |
| 121 | +/-- If `f,g` is coreflexive, then `g,f` is coreflexive. -/ |
| 122 | +theorem IsCoreflexivePair.swap [IsCoreflexivePair f g] : IsCoreflexivePair g f := |
| 123 | + IsCoreflexivePair.mk' _ (right_comp_retraction f g) (left_comp_retraction f g) |
| 124 | +#align category_theory.is_coreflexive_pair.swap CategoryTheory.IsCoreflexivePair.swap |
| 125 | + |
| 126 | +variable {F : C ⥤ D} {G : D ⥤ C} (adj : F ⊣ G) |
| 127 | + |
| 128 | +/-- For an adjunction `F ⊣ G` with counit `ε`, the pair `(FGε_B, ε_FGB)` is reflexive. -/ |
| 129 | +instance (B : D) : |
| 130 | + IsReflexivePair (F.map (G.map (adj.counit.app B))) (adj.counit.app (F.obj (G.obj B))) := |
| 131 | + IsReflexivePair.mk' (F.map (adj.unit.app (G.obj B))) |
| 132 | + (by |
| 133 | + rw [← F.map_comp, adj.right_triangle_components] |
| 134 | + apply F.map_id) |
| 135 | + adj.left_triangle_components |
| 136 | + |
| 137 | +namespace Limits |
| 138 | + |
| 139 | +variable (C) |
| 140 | + |
| 141 | +/-- `C` has reflexive coequalizers if it has coequalizers for every reflexive pair. -/ |
| 142 | +class HasReflexiveCoequalizers : Prop where |
| 143 | + has_coeq : ∀ ⦃A B : C⦄ (f g : A ⟶ B) [IsReflexivePair f g], HasCoequalizer f g |
| 144 | +#align category_theory.limits.has_reflexive_coequalizers CategoryTheory.Limits.HasReflexiveCoequalizers |
| 145 | + |
| 146 | +/-- `C` has coreflexive equalizers if it has equalizers for every coreflexive pair. -/ |
| 147 | +class HasCoreflexiveEqualizers : Prop where |
| 148 | + has_eq : ∀ ⦃A B : C⦄ (f g : A ⟶ B) [IsCoreflexivePair f g], HasEqualizer f g |
| 149 | +#align category_theory.limits.has_coreflexive_equalizers CategoryTheory.Limits.HasCoreflexiveEqualizers |
| 150 | + |
| 151 | +attribute [instance] HasReflexiveCoequalizers.has_coeq |
| 152 | + |
| 153 | +attribute [instance] HasCoreflexiveEqualizers.has_eq |
| 154 | + |
| 155 | +theorem hasCoequalizer_of_common_section [HasReflexiveCoequalizers C] {A B : C} {f g : A ⟶ B} |
| 156 | + (r : B ⟶ A) (rf : r ≫ f = 𝟙 _) (rg : r ≫ g = 𝟙 _) : HasCoequalizer f g := by |
| 157 | + letI := IsReflexivePair.mk' r rf rg |
| 158 | + infer_instance |
| 159 | +#align category_theory.limits.has_coequalizer_of_common_section CategoryTheory.Limits.hasCoequalizer_of_common_section |
| 160 | + |
| 161 | +theorem hasEqualizer_of_common_retraction [HasCoreflexiveEqualizers C] {A B : C} {f g : A ⟶ B} |
| 162 | + (r : B ⟶ A) (fr : f ≫ r = 𝟙 _) (gr : g ≫ r = 𝟙 _) : HasEqualizer f g := by |
| 163 | + letI := IsCoreflexivePair.mk' r fr gr |
| 164 | + infer_instance |
| 165 | +#align category_theory.limits.has_equalizer_of_common_retraction CategoryTheory.Limits.hasEqualizer_of_common_retraction |
| 166 | + |
| 167 | +/-- If `C` has coequalizers, then it has reflexive coequalizers. -/ |
| 168 | +instance (priority := 100) hasReflexiveCoequalizers_of_hasCoequalizers [HasCoequalizers C] : |
| 169 | + HasReflexiveCoequalizers C where has_coeq A B f g _ := by infer_instance |
| 170 | +#align category_theory.limits.has_reflexive_coequalizers_of_has_coequalizers CategoryTheory.Limits.hasReflexiveCoequalizers_of_hasCoequalizers |
| 171 | + |
| 172 | +/-- If `C` has equalizers, then it has coreflexive equalizers. -/ |
| 173 | +instance (priority := 100) hasCoreflexiveEqualizers_of_hasEqualizers [HasEqualizers C] : |
| 174 | + HasCoreflexiveEqualizers C where has_eq A B f g _ := by infer_instance |
| 175 | +#align category_theory.limits.has_coreflexive_equalizers_of_has_equalizers CategoryTheory.Limits.hasCoreflexiveEqualizers_of_hasEqualizers |
| 176 | + |
| 177 | +end Limits |
| 178 | + |
| 179 | +open Limits |
| 180 | + |
| 181 | +end CategoryTheory |
0 commit comments