|
| 1 | +/- |
| 2 | +Copyright (c) 2025 Robin Carlier. All rights reserved. |
| 3 | +Released under Apache 2.0 license as described in the file LICENSE. |
| 4 | +Authors: Robin Carlier |
| 5 | +-/ |
| 6 | +import Mathlib.CategoryTheory.Monoidal.ExternalProduct |
| 7 | +import Mathlib.CategoryTheory.Functor.KanExtension.Pointwise |
| 8 | + |
| 9 | +/-! |
| 10 | +# Day convolution monoidal structure |
| 11 | +
|
| 12 | +Given functors `F G : C ⥤ V` between two monoidal categories, |
| 13 | +this file defines a typeclass `DayConvolution` on functors `F` `G` that contains |
| 14 | +a functor `F ⊛ G`, as well as the required data to exhibit `F ⊛ G` as a pointwise |
| 15 | +left Kan extension of `F ⊠ G` (see `CategoryTheory/Monoidal/ExternalProduct` for the definition) |
| 16 | +along the tensor product of `C`. Such a functor is called a Day convolution of `F` and `G`, and |
| 17 | +although we do not show it yet, this operation defines a monoidal structure on `C ⥤ V`. |
| 18 | +
|
| 19 | +We also define a typeclass `DayConvolutionUnit` on a functor `U : C ⥤ V` that bundle the data |
| 20 | +required to make it a unit for the Day convolution monoidal structure: said data is that of |
| 21 | +a map `𝟙_ V ⟶ U.obj (𝟙_ C)` that exhibits `U` as a pointwise left Kan extension of |
| 22 | +`fromPUnit (𝟙_ V)` along `fromPUnit (𝟙_ C)`. |
| 23 | +
|
| 24 | +## References |
| 25 | +- [nLab page: Day convolution](https://ncatlab.org/nlab/show/Day+convolution) |
| 26 | +
|
| 27 | +## TODOs (@robin-carlier) |
| 28 | +- Define associators and unitors, prove the pentagon and triangle identities. |
| 29 | +- Braided/symmetric case. |
| 30 | +- Case where `V` is closed. |
| 31 | +- Define a typeclass `DayConvolutionMonoidalCategory` extending `MonoidalCategory` |
| 32 | +- Characterization of lax monoidal functors out of a day convolution monoidal category. |
| 33 | +- Case `V = Type u` and its universal property. |
| 34 | +
|
| 35 | +-/ |
| 36 | + |
| 37 | +universe v₁ v₂ v₃ v₄ v₅ u₁ u₂ u₃ u₄ u₅ |
| 38 | + |
| 39 | +namespace CategoryTheory.MonoidalCategory |
| 40 | +open scoped ExternalProduct |
| 41 | + |
| 42 | +noncomputable section |
| 43 | + |
| 44 | +variable {C : Type u₁} [Category.{v₁} C] {V : Type u₂} [Category.{v₂} V] |
| 45 | + [MonoidalCategory C] [MonoidalCategory V] |
| 46 | + |
| 47 | +/-- A `DayConvolution` structure on functors `F G : C ⥤ V` is the data of |
| 48 | +a functor `F ⊛ G : C ⥤ V`, along with a unit `F ⊠ G ⟶ tensor C ⋙ F ⊛ G` |
| 49 | +that exhibits this functor as a pointwise left Kan extension of `F ⊠ G` along |
| 50 | +`tensor C`. This is a `class` used to prove various property of such extensions, |
| 51 | +but registering global instances of this class is probably a bad idea. -/ |
| 52 | +class DayConvolution (F G : C ⥤ V) where |
| 53 | + /-- The chosen convolution between the functors. Denoted `F ⊛ G`. -/ |
| 54 | + convolution : C ⥤ V |
| 55 | + /-- The chosen convolution between the functors. -/ |
| 56 | + unit (F) (G) : F ⊠ G ⟶ tensor C ⋙ convolution |
| 57 | + /-- The transformation `unit` exhibits `F ⊛ G` as a pointwise left Kan extension |
| 58 | + of `F ⊠ G` along `tensor C`. -/ |
| 59 | + isPointwiseLeftKanExtensionUnit (F G) : |
| 60 | + (Functor.LeftExtension.mk (convolution) unit).IsPointwiseLeftKanExtension |
| 61 | + |
| 62 | +namespace DayConvolution |
| 63 | + |
| 64 | +section |
| 65 | + |
| 66 | +/-- A notation for the Day convolution of two functors. -/ |
| 67 | +scoped infixr:80 " ⊛ " => convolution |
| 68 | + |
| 69 | +variable (F G : C ⥤ V) |
| 70 | + |
| 71 | +instance leftKanExtension [DayConvolution F G] : |
| 72 | + (F ⊛ G).IsLeftKanExtension (unit F G) := |
| 73 | + isPointwiseLeftKanExtensionUnit F G|>.isLeftKanExtension |
| 74 | + |
| 75 | +variable {F G} |
| 76 | + |
| 77 | +/-- Two day convolution structures on the same functors gives an isomorphic functor. -/ |
| 78 | +def uniqueUpToIso (h : DayConvolution F G) (h' : DayConvolution F G) : |
| 79 | + h.convolution ≅ h'.convolution := |
| 80 | + Functor.leftKanExtensionUnique h.convolution h.unit h'.convolution h'.unit |
| 81 | + |
| 82 | +@[reassoc (attr := simp)] |
| 83 | +lemma unit_uniqueUpToIso_hom (h : DayConvolution F G) (h' : DayConvolution F G) : |
| 84 | + h.unit ≫ CategoryTheory.whiskerLeft (tensor C) (h.uniqueUpToIso h').hom = h'.unit := by |
| 85 | + simp [uniqueUpToIso] |
| 86 | + |
| 87 | +@[reassoc (attr := simp)] |
| 88 | +lemma unit_uniqueUpToIso_inv (h : DayConvolution F G) (h' : DayConvolution F G) : |
| 89 | + h'.unit ≫ CategoryTheory.whiskerLeft (tensor C) (h.uniqueUpToIso h').inv = h.unit := by |
| 90 | + simp [uniqueUpToIso] |
| 91 | + |
| 92 | +variable (F G) [DayConvolution F G] |
| 93 | + |
| 94 | +section unit |
| 95 | + |
| 96 | +variable {x x' y y' : C} |
| 97 | + |
| 98 | +@[reassoc (attr := simp)] |
| 99 | +lemma unit_naturality (f : x ⟶ x') (g : y ⟶ y') : |
| 100 | + (F.map f ⊗ₘ G.map g) ≫ (unit F G).app (x', y') = |
| 101 | + (unit F G).app (x, y) ≫ (F ⊛ G).map (f ⊗ₘ g) := by |
| 102 | + simpa [tensorHom_def] using (unit F G).naturality ((f, g) : (x, y) ⟶ (x', y')) |
| 103 | + |
| 104 | +variable (y) in |
| 105 | +@[reassoc (attr := simp)] |
| 106 | +lemma whiskerRight_comp_unit_app (f : x ⟶ x') : |
| 107 | + F.map f ▷ G.obj y ≫ (unit F G).app (x', y) = |
| 108 | + (unit F G).app (x, y) ≫ (F ⊛ G).map (f ▷ y) := by |
| 109 | + simpa [tensorHom_def] using (unit F G).naturality ((f, 𝟙 _) : (x, y) ⟶ (x', y)) |
| 110 | + |
| 111 | +variable (x) in |
| 112 | +@[reassoc (attr := simp)] |
| 113 | +lemma whiskerLeft_comp_unit_app (g : y ⟶ y') : |
| 114 | + F.obj x ◁ G.map g ≫ (unit F G).app (x, y') = |
| 115 | + (unit F G).app (x, y) ≫ (F ⊛ G).map (x ◁ g) := by |
| 116 | + simpa [tensorHom_def] using (unit F G).naturality ((𝟙 _, g) : (x, y) ⟶ (x, y')) |
| 117 | + |
| 118 | +end unit |
| 119 | + |
| 120 | +variable {F G} |
| 121 | + |
| 122 | +section map |
| 123 | + |
| 124 | +variable {F' G' : C ⥤ V} [DayConvolution F' G'] |
| 125 | + |
| 126 | +/-- The morphism between day convolutions (provided they exist) induced by a pair of morphisms. -/ |
| 127 | +def map (f : F ⟶ F') (g : G ⟶ G') : F ⊛ G ⟶ F' ⊛ G' := |
| 128 | + Functor.descOfIsLeftKanExtension (F ⊛ G) (unit F G) (F' ⊛ G') <| |
| 129 | + (externalProductBifunctor C C V).map ((f, g) : (F, G) ⟶ (F', G')) ≫ unit F' G' |
| 130 | + |
| 131 | +variable (f : F ⟶ F') (g : G ⟶ G') (x y : C) |
| 132 | + |
| 133 | +@[reassoc (attr := simp)] |
| 134 | +lemma unit_app_map_app : |
| 135 | + (unit F G).app (x, y) ≫ (map f g).app (x ⊗ y : C) = |
| 136 | + (f.app x ⊗ₘ g.app y) ≫ (unit F' G').app (x, y) := by |
| 137 | + simpa [tensorHom_def] using |
| 138 | + (Functor.descOfIsLeftKanExtension_fac_app (F ⊛ G) (unit F G) (F' ⊛ G') <| |
| 139 | + (externalProductBifunctor C C V).map ((f, g) : (F, G) ⟶ (F', G')) ≫ unit F' G') (x, y) |
| 140 | + |
| 141 | +end map |
| 142 | + |
| 143 | +variable (F G) |
| 144 | + |
| 145 | +/-- The universal property of left Kan extensions characterizes the functor |
| 146 | +corepresented by `F ⊛ G`. -/ |
| 147 | +@[simps!] |
| 148 | +def corepresentableBy : |
| 149 | + (whiskeringLeft _ _ _).obj (tensor C) ⋙ coyoneda.obj (.op <| F ⊠ G)|>.CorepresentableBy |
| 150 | + (F ⊛ G) where |
| 151 | + homEquiv := Functor.homEquivOfIsLeftKanExtension _ (unit F G) _ |
| 152 | + homEquiv_comp := by aesop |
| 153 | + |
| 154 | +/-- Use the fact that `(F ⊛ G).obj c` is a colimit to characterize morphisms out of it at a |
| 155 | +point. -/ |
| 156 | +theorem convolution_hom_ext_at (c : C) {v : V} {f g : (F ⊛ G).obj c ⟶ v} |
| 157 | + (h : ∀ {x y : C} (u : x ⊗ y ⟶ c), |
| 158 | + (unit F G).app (x, y) ≫ (F ⊛ G).map u ≫ f = (unit F G).app (x, y) ≫ (F ⊛ G).map u ≫ g) : |
| 159 | + f = g := |
| 160 | + ((isPointwiseLeftKanExtensionUnit F G) c).hom_ext (fun j ↦ by simpa using h j.hom) |
| 161 | + |
| 162 | +end |
| 163 | + |
| 164 | +end DayConvolution |
| 165 | + |
| 166 | +/-- A `DayConvolutionUnit` structure on a functor `C ⥤ V` is the data of a pointwise |
| 167 | +left Kan extension of `fromPUnit (𝟙_ V)` along `fromPUnit (𝟙_ C)`. Again, this is |
| 168 | +made a class to ease proofs when constructing `DayConvolutionMonoidalCategory` structures, but one |
| 169 | +should avoid registering it globally. -/ |
| 170 | +class DayConvolutionUnit (F : C ⥤ V) where |
| 171 | + /-- A "canonical" structure map `𝟙_ V ⟶ F.obj (𝟙_ C)` that defines a natural transformation |
| 172 | + `fromPUnit (𝟙_ V) ⟶ fromPUnit (𝟙_ C) ⋙ F`. -/ |
| 173 | + can : 𝟙_ V ⟶ F.obj (𝟙_ C) |
| 174 | + /-- The canonical map `𝟙_ V ⟶ F.obj (𝟙_ C)` exhibits `F` as a pointwise left kan extension |
| 175 | + of `fromPUnit.{0} 𝟙_ V` along `fromPUnit.{0} 𝟙_ C`. -/ |
| 176 | + isPointwiseLeftKanExtensionCan : Functor.LeftExtension.mk F |
| 177 | + ({app _ := can} : Functor.fromPUnit.{0} (𝟙_ V) ⟶ |
| 178 | + Functor.fromPUnit.{0} (𝟙_ C) ⋙ F)|>.IsPointwiseLeftKanExtension |
| 179 | + |
| 180 | +namespace DayConvolutionUnit |
| 181 | + |
| 182 | +variable (U : C ⥤ V) [DayConvolutionUnit U] |
| 183 | +open scoped DayConvolution |
| 184 | + |
| 185 | +/-- A shorthand for the natural transformation of functors out of PUnit defined by |
| 186 | +the canonical morphism `𝟙_ V ⟶ U.obj (𝟙_ C)` when `U` is a unit for Day convolution. -/ |
| 187 | +abbrev φ : Functor.fromPUnit.{0} (𝟙_ V) ⟶ Functor.fromPUnit.{0} (𝟙_ C) ⋙ U where |
| 188 | + app _ := can |
| 189 | + |
| 190 | +/-- Since a convolution unit is a pointwise left Kan extension, maps out of it at |
| 191 | +any object are uniquely characterized. -/ |
| 192 | +lemma hom_ext {c : C} {v : V} {g h : U.obj c ⟶ v} |
| 193 | + (e : ∀ f : 𝟙_ C ⟶ c, can ≫ U.map f ≫ g = can ≫ U.map f ≫ h) : |
| 194 | + g = h := by |
| 195 | + apply (isPointwiseLeftKanExtensionCan c).hom_ext |
| 196 | + intro j |
| 197 | + simpa using e j.hom |
| 198 | + |
| 199 | +end DayConvolutionUnit |
| 200 | + |
| 201 | +end |
| 202 | + |
| 203 | +end CategoryTheory.MonoidalCategory |
0 commit comments