|
| 1 | +/- |
| 2 | +Copyright (c) 2025 Joël Riou. All rights reserved. |
| 3 | +Released under Apache 2.0 license as described in the file LICENSE. |
| 4 | +Authors: Joël Riou |
| 5 | +-/ |
| 6 | +import Mathlib.CategoryTheory.Bicategory.Adjunction.Mate |
| 7 | +import Mathlib.CategoryTheory.Bicategory.Functor.Pseudofunctor |
| 8 | + |
| 9 | +/-! |
| 10 | +# The bicategory of adjunctions in a bicategory |
| 11 | +
|
| 12 | +Given a bicategory `B`, we construct a bicategory `Adj B` that has essentially |
| 13 | +the same objects as `B` but whose `1`-morphisms are adjunctions (in the same |
| 14 | +direction as the left adjoints), and `2`-morphisms are tuples of mate maps |
| 15 | +between the left and right adjoints (where the map between right |
| 16 | +adjoints is in the opposite direction). |
| 17 | +
|
| 18 | +Certain pseudofunctors to the bicategory `Adj Cat` are analogous to bifibered categories: |
| 19 | +in various contexts, this may be used in order to formalize the properties of |
| 20 | +both pullback and pushforward functors. |
| 21 | +
|
| 22 | +## References |
| 23 | +
|
| 24 | +* https://ncatlab.org/nlab/show/2-category+of+adjunctions |
| 25 | +* https://ncatlab.org/nlab/show/transformation+of+adjoints |
| 26 | +* https://ncatlab.org/nlab/show/mate |
| 27 | +
|
| 28 | +-/ |
| 29 | + |
| 30 | +universe w v u |
| 31 | + |
| 32 | +namespace CategoryTheory |
| 33 | + |
| 34 | +namespace Bicategory |
| 35 | + |
| 36 | +/-- |
| 37 | +The bicategory that has the same objects as a bicategory `B`, in which `1`-morphisms |
| 38 | +are adjunctions (in the same direction as the left adjoints), |
| 39 | +and `2`-morphisms are tuples of mate maps between the left and right |
| 40 | +adjoints (where the map between right adjoints is in the opposite direction). |
| 41 | +-/ |
| 42 | +structure Adj (B : Type u) [Bicategory.{w, v} B] where |
| 43 | + /-- If `a : Adj B`, `a.obj : B` is the underlying object of the bicategory `B`. -/ |
| 44 | + obj : B |
| 45 | + |
| 46 | +variable {B : Type u} [Bicategory.{w, v} B] |
| 47 | + |
| 48 | +namespace Adj |
| 49 | + |
| 50 | +@[simp] lemma mk_obj (b : Adj B) : mk b.obj = b := rfl |
| 51 | + |
| 52 | +section |
| 53 | + |
| 54 | +variable (a b : B) |
| 55 | + |
| 56 | +/-- |
| 57 | +Given two objects `a` and `b` in a bicategory, |
| 58 | +this is the type of adjunctions between `a` and `b`. |
| 59 | +-/ |
| 60 | +structure Hom where |
| 61 | + /-- the left adjoint -/ |
| 62 | + {l : a ⟶ b} |
| 63 | + /-- the right adjoint -/ |
| 64 | + {r : b ⟶ a} |
| 65 | + /-- the adjunction -/ |
| 66 | + adj : l ⊣ r |
| 67 | + |
| 68 | +end |
| 69 | + |
| 70 | +@[simps! id_l id_r id_adj comp_l comp_r comp_adj] |
| 71 | +instance : CategoryStruct (Adj B) where |
| 72 | + Hom a b := Hom a.obj b.obj |
| 73 | + id a := .mk (Adjunction.id a.obj) |
| 74 | + comp f g := .mk (f.adj.comp g.adj) |
| 75 | + |
| 76 | +variable {a b c d : Adj B} |
| 77 | + |
| 78 | +/-- A morphism between two adjunctions consists of a tuple of mate maps. -/ |
| 79 | +@[ext] |
| 80 | +structure Hom₂ (α β : a ⟶ b) where |
| 81 | + /-- the morphism between left adjoints -/ |
| 82 | + τl : α.l ⟶ β.l |
| 83 | + /-- the morphism in the opposite direction between right adjoints -/ |
| 84 | + τr : β.r ⟶ α.r |
| 85 | + conjugateEquiv_τl : conjugateEquiv β.adj α.adj τl = τr := by aesop_cat |
| 86 | + |
| 87 | +lemma Hom₂.conjugateEquiv_symm_τr {α β : a ⟶ b} (p : Hom₂ α β) : |
| 88 | + (conjugateEquiv β.adj α.adj).symm p.τr = p.τl := by |
| 89 | + rw [← Hom₂.conjugateEquiv_τl, Equiv.symm_apply_apply] |
| 90 | + |
| 91 | +@[simps!] |
| 92 | +instance : CategoryStruct (a ⟶ b) where |
| 93 | + Hom α β := Hom₂ α β |
| 94 | + id α := |
| 95 | + { τl := 𝟙 _ |
| 96 | + τr := 𝟙 _ } |
| 97 | + comp {a b c} x y := |
| 98 | + { τl := x.τl ≫ y.τl |
| 99 | + τr := y.τr ≫ x.τr |
| 100 | + conjugateEquiv_τl := by |
| 101 | + simp [← conjugateEquiv_comp c.adj b.adj a.adj y.τl x.τl, |
| 102 | + Hom₂.conjugateEquiv_τl] } |
| 103 | + |
| 104 | +attribute [reassoc] comp_τl comp_τr |
| 105 | + |
| 106 | +@[ext] |
| 107 | +lemma hom₂_ext {α β : a ⟶ b} {x y : α ⟶ β} (hl : x.τl = y.τl) : x = y := |
| 108 | + Hom₂.ext hl (by simp only [← Hom₂.conjugateEquiv_τl, hl]) |
| 109 | + |
| 110 | +instance : Category (a ⟶ b) where |
| 111 | + |
| 112 | +/-- Constructor for isomorphisms between 1-morphisms in the bicategory `Adj B`. -/ |
| 113 | +@[simps] |
| 114 | +def iso₂Mk {α β : a ⟶ b} (el : α.l ≅ β.l) (er : β.r ≅ α.r) |
| 115 | + (h : conjugateEquiv β.adj α.adj el.hom = er.hom) : |
| 116 | + α ≅ β where |
| 117 | + hom := |
| 118 | + { τl := el.hom |
| 119 | + τr := er.hom |
| 120 | + conjugateEquiv_τl := h } |
| 121 | + inv := |
| 122 | + { τl := el.inv |
| 123 | + τr := er.inv |
| 124 | + conjugateEquiv_τl := by |
| 125 | + rw [← cancel_mono er.hom, Iso.inv_hom_id, ← h, |
| 126 | + conjugateEquiv_comp, Iso.hom_inv_id, conjugateEquiv_id] } |
| 127 | + |
| 128 | +namespace Bicategory |
| 129 | + |
| 130 | +/-- The associator in the bicategory `Adj B`. -/ |
| 131 | +@[simps!] |
| 132 | +def associator (α : a ⟶ b) (β : b ⟶ c) (γ : c ⟶ d) : (α ≫ β) ≫ γ ≅ α ≫ β ≫ γ := |
| 133 | + iso₂Mk (α_ _ _ _) (α_ _ _ _) (conjugateEquiv_associator_hom _ _ _) |
| 134 | + |
| 135 | +/-- The left unitor in the bicategory `Adj B`. -/ |
| 136 | +@[simps!] |
| 137 | +def leftUnitor (α : a ⟶ b) : 𝟙 a ≫ α ≅ α := |
| 138 | + iso₂Mk (λ_ _) (ρ_ _).symm |
| 139 | + (by simpa using conjugateEquiv_id_comp_right_apply α.adj α.adj (𝟙 _)) |
| 140 | + |
| 141 | +/-- The right unitor in the bicategory `Adj B`. -/ |
| 142 | +@[simps!] |
| 143 | +def rightUnitor (α : a ⟶ b) : α ≫ 𝟙 b ≅ α := |
| 144 | + iso₂Mk (ρ_ _) (λ_ _).symm |
| 145 | + (by simpa using conjugateEquiv_comp_id_right_apply α.adj α.adj (𝟙 _)) |
| 146 | + |
| 147 | +/-- The left whiskering in the bicategory `Adj B`. -/ |
| 148 | +@[simps] |
| 149 | +def whiskerLeft (α : a ⟶ b) {β β' : b ⟶ c} (y : β ⟶ β') : α ≫ β ⟶ α ≫ β' where |
| 150 | + τl := _ ◁ y.τl |
| 151 | + τr := y.τr ▷ _ |
| 152 | + conjugateEquiv_τl := by |
| 153 | + simp [conjugateEquiv_whiskerLeft, Hom₂.conjugateEquiv_τl] |
| 154 | + |
| 155 | +/-- The right whiskering in the bicategory `Adj B`. -/ |
| 156 | +@[simps] |
| 157 | +def whiskerRight {α α' : a ⟶ b} (x : α ⟶ α') (β : b ⟶ c) : α ≫ β ⟶ α' ≫ β where |
| 158 | + τl := x.τl ▷ _ |
| 159 | + τr := _ ◁ x.τr |
| 160 | + conjugateEquiv_τl := by |
| 161 | + simp [conjugateEquiv_whiskerRight, Hom₂.conjugateEquiv_τl] |
| 162 | + |
| 163 | +end Bicategory |
| 164 | + |
| 165 | +attribute [local simp] whisker_exchange |
| 166 | + |
| 167 | +@[simps! whiskerRight_τr whiskerRight_τl whiskerLeft_τr whiskerLeft_τl |
| 168 | + associator_hom_τr associator_inv_τr associator_hom_τl associator_inv_τl |
| 169 | + leftUnitor_hom_τr leftUnitor_inv_τr leftUnitor_hom_τl leftUnitor_inv_τl |
| 170 | + rightUnitor_hom_τr rightUnitor_inv_τr rightUnitor_hom_τl rightUnitor_inv_τl] |
| 171 | +instance : Bicategory (Adj B) where |
| 172 | + whiskerLeft := Bicategory.whiskerLeft |
| 173 | + whiskerRight := Bicategory.whiskerRight |
| 174 | + associator := Bicategory.associator |
| 175 | + leftUnitor := Bicategory.leftUnitor |
| 176 | + rightUnitor := Bicategory.rightUnitor |
| 177 | + |
| 178 | +/-- The forget pseudofunctor from `Adj B` to `B`. -/ |
| 179 | +@[simps] |
| 180 | +def forget₁ : Pseudofunctor (Adj B) B where |
| 181 | + obj a := a.obj |
| 182 | + map x := x.l |
| 183 | + map₂ α := α.τl |
| 184 | + mapId _ := Iso.refl _ |
| 185 | + mapComp _ _ := Iso.refl _ |
| 186 | + |
| 187 | +-- TODO: define `forget₂` which sends an adjunction to its right adjoint functor |
| 188 | + |
| 189 | +/-- Given an isomorphism between two 1-morphisms in `Adj B`, this is the |
| 190 | +underlying isomorphisms between the left adjoints. -/ |
| 191 | +@[simps] |
| 192 | +def lIso {a b : Adj B} {adj₁ adj₂ : a ⟶ b} (e : adj₁ ≅ adj₂) : adj₁.l ≅ adj₂.l where |
| 193 | + hom := e.hom.τl |
| 194 | + inv := e.inv.τl |
| 195 | + hom_inv_id := by rw [← comp_τl, e.hom_inv_id, id_τl] |
| 196 | + inv_hom_id := by rw [← comp_τl, e.inv_hom_id, id_τl] |
| 197 | + |
| 198 | +/-- Given an isomorphism between two 1-morphisms in `Adj B`, this is the |
| 199 | +underlying isomorphisms between the right adjoints. -/ |
| 200 | +@[simps] |
| 201 | +def rIso {a b : Adj B} {adj₁ adj₂ : a ⟶ b} (e : adj₁ ≅ adj₂) : adj₁.r ≅ adj₂.r where |
| 202 | + hom := e.inv.τr |
| 203 | + inv := e.hom.τr |
| 204 | + hom_inv_id := by rw [← comp_τr, e.hom_inv_id, id_τr] |
| 205 | + inv_hom_id := by rw [← comp_τr, e.inv_hom_id, id_τr] |
| 206 | + |
| 207 | +end Adj |
| 208 | + |
| 209 | +end Bicategory |
| 210 | + |
| 211 | +end CategoryTheory |
0 commit comments