Skip to content

Commit f1919fd

Browse files
committed
feat(CategoryTheory/Monoidal): add lemmas for the whiskerings (#9995)
Extracted from #6307.
1 parent c6cc35e commit f1919fd

7 files changed

Lines changed: 132 additions & 28 deletions

File tree

Mathlib/CategoryTheory/Bicategory/Basic.lean

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -193,19 +193,19 @@ attribute [simp]
193193
variable {B : Type u} [Bicategory.{w, v} B] {a b c d e : B}
194194

195195
@[reassoc (attr := simp)]
196-
theorem hom_inv_whiskerLeft (f : a ⟶ b) {g h : b ⟶ c} (η : g ≅ h) :
196+
theorem whiskerLeft_hom_inv (f : a ⟶ b) {g h : b ⟶ c} (η : g ≅ h) :
197197
f ◁ η.hom ≫ f ◁ η.inv = 𝟙 (f ≫ g) := by rw [← whiskerLeft_comp, hom_inv_id, whiskerLeft_id]
198-
#align category_theory.bicategory.hom_inv_whisker_left CategoryTheory.Bicategory.hom_inv_whiskerLeft
198+
#align category_theory.bicategory.hom_inv_whisker_left CategoryTheory.Bicategory.whiskerLeft_hom_inv
199199

200200
@[reassoc (attr := simp)]
201201
theorem hom_inv_whiskerRight {f g : a ⟶ b} (η : f ≅ g) (h : b ⟶ c) :
202202
η.hom ▷ h ≫ η.inv ▷ h = 𝟙 (f ≫ h) := by rw [← comp_whiskerRight, hom_inv_id, id_whiskerRight]
203203
#align category_theory.bicategory.hom_inv_whisker_right CategoryTheory.Bicategory.hom_inv_whiskerRight
204204

205205
@[reassoc (attr := simp)]
206-
theorem inv_hom_whiskerLeft (f : a ⟶ b) {g h : b ⟶ c} (η : g ≅ h) :
206+
theorem whiskerLeft_inv_hom (f : a ⟶ b) {g h : b ⟶ c} (η : g ≅ h) :
207207
f ◁ η.inv ≫ f ◁ η.hom = 𝟙 (f ≫ h) := by rw [← whiskerLeft_comp, inv_hom_id, whiskerLeft_id]
208-
#align category_theory.bicategory.inv_hom_whisker_left CategoryTheory.Bicategory.inv_hom_whiskerLeft
208+
#align category_theory.bicategory.inv_hom_whisker_left CategoryTheory.Bicategory.whiskerLeft_inv_hom
209209

210210
@[reassoc (attr := simp)]
211211
theorem inv_hom_whiskerRight {f g : a ⟶ b} (η : f ≅ g) (h : b ⟶ c) :

Mathlib/CategoryTheory/Bicategory/Functor.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -530,7 +530,7 @@ def mkOfOplax (F : OplaxFunctor B C) (F' : F.PseudoCore) : Pseudofunctor B C :=
530530
map₂_associator := fun f g h => by
531531
dsimp
532532
rw [F'.mapCompIso_hom (f ≫ g) h, F'.mapCompIso_hom f g, ← F.map₂_associator_assoc, ←
533-
F'.mapCompIso_hom f (g ≫ h), ← F'.mapCompIso_hom g h, hom_inv_whiskerLeft_assoc,
533+
F'.mapCompIso_hom f (g ≫ h), ← F'.mapCompIso_hom g h, whiskerLeft_hom_inv_assoc,
534534
hom_inv_id, comp_id] }
535535
#align category_theory.pseudofunctor.mk_of_oplax CategoryTheory.Pseudofunctor.mkOfOplax
536536

Mathlib/CategoryTheory/Monoidal/Category.lean

Lines changed: 73 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,79 @@ end MonoidalCategory
222222
open scoped MonoidalCategory
223223
open MonoidalCategory
224224

225-
variable (C : Type u) [𝒞 : Category.{v} C] [MonoidalCategory C]
225+
variable {C : Type u} [𝒞 : Category.{v} C] [MonoidalCategory C]
226+
227+
namespace MonoidalCategory
228+
229+
@[reassoc (attr := simp)]
230+
theorem whiskerLeft_hom_inv (X : C) {Y Z : C} (f : Y ≅ Z) :
231+
X ◁ f.hom ≫ X ◁ f.inv = 𝟙 (X ⊗ Y) := by
232+
simp [← id_tensorHom, ← tensor_comp]
233+
234+
@[reassoc (attr := simp)]
235+
theorem hom_inv_whiskerRight {X Y : C} (f : X ≅ Y) (Z : C) :
236+
f.hom ▷ Z ≫ f.inv ▷ Z = 𝟙 (X ⊗ Z) := by
237+
simp [← tensorHom_id, ← tensor_comp]
238+
239+
@[reassoc (attr := simp)]
240+
theorem whiskerLeft_inv_hom (X : C) {Y Z : C} (f : Y ≅ Z) :
241+
X ◁ f.inv ≫ X ◁ f.hom = 𝟙 (X ⊗ Z) := by
242+
simp [← id_tensorHom, ← tensor_comp]
243+
244+
@[reassoc (attr := simp)]
245+
theorem inv_hom_whiskerRight {X Y : C} (f : X ≅ Y) (Z : C) :
246+
f.inv ▷ Z ≫ f.hom ▷ Z = 𝟙 (Y ⊗ Z) := by
247+
simp [← tensorHom_id, ← tensor_comp]
248+
249+
@[reassoc (attr := simp)]
250+
theorem whiskerLeft_hom_inv' (X : C) {Y Z : C} (f : Y ⟶ Z) [IsIso f] :
251+
X ◁ f ≫ X ◁ inv f = 𝟙 (X ⊗ Y) := by
252+
simp [← id_tensorHom, ← tensor_comp]
253+
254+
@[reassoc (attr := simp)]
255+
theorem hom_inv_whiskerRight' {X Y : C} (f : X ⟶ Y) [IsIso f] (Z : C) :
256+
f ▷ Z ≫ inv f ▷ Z = 𝟙 (X ⊗ Z) := by
257+
simp [← tensorHom_id, ← tensor_comp]
258+
259+
@[reassoc (attr := simp)]
260+
theorem whiskerLeft_inv_hom' (X : C) {Y Z : C} (f : Y ⟶ Z) [IsIso f] :
261+
X ◁ inv f ≫ X ◁ f = 𝟙 (X ⊗ Z) := by
262+
simp [← id_tensorHom, ← tensor_comp]
263+
264+
@[reassoc (attr := simp)]
265+
theorem inv_hom_whiskerRight' {X Y : C} (f : X ⟶ Y) [IsIso f] (Z : C) :
266+
inv f ▷ Z ≫ f ▷ Z = 𝟙 (Y ⊗ Z) := by
267+
simp [← tensorHom_id, ← tensor_comp]
268+
269+
/-- The left whiskering of an isomorphism is an isomorphism. -/
270+
@[simps]
271+
def whiskerLeftIso (X : C) {Y Z : C} (f : Y ≅ Z) : X ⊗ Y ≅ X ⊗ Z where
272+
hom := X ◁ f.hom
273+
inv := X ◁ f.inv
274+
275+
instance whiskerLeft_isIso (X : C) {Y Z : C} (f : Y ⟶ Z) [IsIso f] : IsIso (X ◁ f) :=
276+
IsIso.of_iso (whiskerLeftIso X (asIso f))
277+
278+
@[simp]
279+
theorem inv_whiskerLeft (X : C) {Y Z : C} (f : Y ⟶ Z) [IsIso f] :
280+
inv (X ◁ f) = X ◁ inv f := by
281+
aesop_cat
282+
283+
/-- The right whiskering of an isomorphism is an isomorphism. -/
284+
@[simps!]
285+
def whiskerRightIso {X Y : C} (f : X ≅ Y) (Z : C) : X ⊗ Z ≅ Y ⊗ Z where
286+
hom := f.hom ▷ Z
287+
inv := f.inv ▷ Z
288+
289+
instance whiskerRight_isIso {X Y : C} (f : X ⟶ Y) (Z : C) [IsIso f] : IsIso (f ▷ Z) :=
290+
IsIso.of_iso (whiskerRightIso (asIso f) Z)
291+
292+
@[simp]
293+
theorem inv_whiskerRight {X Y : C} (f : X ⟶ Y) (Z : C) [IsIso f] :
294+
inv (f ▷ Z) = inv f ▷ Z := by
295+
aesop_cat
296+
297+
end MonoidalCategory
226298

227299
/-- The tensor product of two isomorphisms is an isomorphism. -/
228300
@[simps]

Mathlib/CategoryTheory/Monoidal/Center.lean

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,14 @@ theorem tensor_β (X Y : Center C) (U : C) :
248248
rfl
249249
#align category_theory.center.tensor_β CategoryTheory.Center.tensor_β
250250

251+
@[simp]
252+
theorem whiskerLeft_f (X : Center C) {Y₁ Y₂ : Center C} (f : Y₁ ⟶ Y₂) : (X ◁ f).f = X.1 ◁ f.f :=
253+
id_tensorHom X.1 f.f
254+
255+
@[simp]
256+
theorem whiskerRight_f {X₁ X₂ : Center C} (f : X₁ ⟶ X₂) (Y : Center C) : (f ▷ Y).f = f.f ▷ Y.1 :=
257+
tensorHom_id f.f Y.1
258+
251259
@[simp]
252260
theorem tensor_f {X₁ Y₁ X₂ Y₂ : Center C} (f : X₁ ⟶ Y₁) (g : X₂ ⟶ Y₂) : (f ⊗ g).f = f.f ⊗ g.f :=
253261
rfl
@@ -337,12 +345,7 @@ open BraidedCategory
337345
/-- Auxiliary construction for `ofBraided`. -/
338346
@[simps]
339347
def ofBraidedObj (X : C) : Center C :=
340-
⟨X, {
341-
β := fun Y => β_ X Y
342-
monoidal := fun U U' => by
343-
rw [Iso.eq_inv_comp, ← Category.assoc, ← Category.assoc, Iso.eq_comp_inv, Category.assoc,
344-
Category.assoc]
345-
exact hexagon_forward X U U' }⟩
348+
⟨X, { β := fun Y => β_ X Y}⟩
346349
#align category_theory.center.of_braided_obj CategoryTheory.Center.ofBraidedObj
347350

348351
variable (C)

Mathlib/CategoryTheory/Monoidal/Linear.lean

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,13 @@ variable [MonoidalCategory C]
3232
/-- A category is `MonoidalLinear R` if tensoring is `R`-linear in both factors.
3333
-/
3434
class MonoidalLinear [MonoidalPreadditive C] : Prop where
35-
tensor_smul : ∀ {W X Y Z : C} (f : W ⟶ X) (r : R) (g : Y ⟶ Z), f ⊗ r • g = r • (f ⊗ g) := by
35+
whiskerLeft_smul : ∀ (X : C) {Y Z : C} (r : R) (f : Y ⟶ Z) , 𝟙 X ⊗ (r • f) = r • (𝟙 X ⊗ f) := by
3636
aesop_cat
37-
smul_tensor : ∀ {W X Y Z : C} (r : R) (f : WX) (g : Y ⟶ Z), r • f ⊗ g = r • (f ⊗ g) := by
37+
smul_whiskerRight : ∀ (r : R) {Y Z : C} (f : YZ) (X : C), (r • f)𝟙 X = r • (f ⊗ 𝟙 X) := by
3838
aesop_cat
3939
#align category_theory.monoidal_linear CategoryTheory.MonoidalLinear
4040

41-
attribute [simp] MonoidalLinear.tensor_smul MonoidalLinear.smul_tensor
41+
attribute [simp] MonoidalLinear.whiskerLeft_smul MonoidalLinear.smul_whiskerRight
4242

4343
variable {C}
4444
variable [MonoidalPreadditive C] [MonoidalLinear R C]
@@ -60,16 +60,16 @@ ensures that the domain is linear monoidal. -/
6060
theorem monoidalLinearOfFaithful {D : Type*} [Category D] [Preadditive D] [Linear R D]
6161
[MonoidalCategory D] [MonoidalPreadditive D] (F : MonoidalFunctor D C) [Faithful F.toFunctor]
6262
[F.toFunctor.Additive] [F.toFunctor.Linear R] : MonoidalLinear R D :=
63-
{ tensor_smul := by
64-
intros W X Y Z f r g
63+
{ whiskerLeft_smul := by
64+
intros X Y Z r f
6565
apply F.toFunctor.map_injective
66-
simp only [F.toFunctor.map_smul r (f ⊗ g), F.toFunctor.map_smul r g, F.map_tensor,
67-
MonoidalLinear.tensor_smul, Linear.smul_comp, Linear.comp_smul]
68-
smul_tensor := by
69-
intros W X Y Z r f g
66+
rw [F.map_whiskerLeft]
67+
simp
68+
smul_whiskerRight := by
69+
intros r X Y f Z
7070
apply F.toFunctor.map_injective
71-
simp only [F.toFunctor.map_smul r (f ⊗ g), F.toFunctor.map_smul r f, F.map_tensor,
72-
MonoidalLinear.smul_tensor, Linear.smul_comp, Linear.comp_smul] }
71+
rw [F.map_whiskerRight]
72+
simp }
7373
#align category_theory.monoidal_linear_of_faithful CategoryTheory.monoidalLinearOfFaithful
7474

7575
end CategoryTheory

Mathlib/CategoryTheory/Monoidal/OfHasFiniteProducts.lean

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,14 @@ theorem tensorHom {W X Y Z : C} (f : W ⟶ X) (g : Y ⟶ Z) : f ⊗ g = Limits.p
8282
rfl
8383
#align category_theory.monoidal_of_has_finite_products.tensor_hom CategoryTheory.monoidalOfHasFiniteProducts.tensorHom
8484

85+
@[simp]
86+
theorem whiskerLeft (X : C) {Y Z : C} (f : Y ⟶ Z) : X ◁ f = Limits.prod.map (𝟙 X) f :=
87+
rfl
88+
89+
@[simp]
90+
theorem whiskerRight {X Y : C} (f : X ⟶ Y) (Z : C) : f ▷ Z = Limits.prod.map f (𝟙 Z) :=
91+
rfl
92+
8593
@[simp]
8694
theorem leftUnitor_hom (X : C) : (λ_ X).hom = Limits.prod.snd :=
8795
rfl
@@ -179,6 +187,14 @@ theorem tensorHom {W X Y Z : C} (f : W ⟶ X) (g : Y ⟶ Z) : f ⊗ g = Limits.c
179187
rfl
180188
#align category_theory.monoidal_of_has_finite_coproducts.tensor_hom CategoryTheory.monoidalOfHasFiniteCoproducts.tensorHom
181189

190+
@[simp]
191+
theorem whiskerLeft (X : C) {Y Z : C} (f : Y ⟶ Z) : X ◁ f = Limits.coprod.map (𝟙 X) f :=
192+
rfl
193+
194+
@[simp]
195+
theorem whiskerRight {X Y : C} (f : X ⟶ Y) (Z : C) : f ▷ Z = Limits.coprod.map f (𝟙 Z) :=
196+
rfl
197+
182198
@[simp]
183199
theorem leftUnitor_hom (X : C) : (λ_ X).hom = coprod.desc (initial.to X) (𝟙 _) :=
184200
rfl

Mathlib/Tactic/CategoryTheory/Coherence.lean

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,14 @@ instance LiftHom_comp {X Y Z : C} [LiftObj X] [LiftObj Y] [LiftObj Z] (f : X ⟶
8888
[LiftHom f] [LiftHom g] : LiftHom (f ≫ g) where
8989
lift := LiftHom.lift f ≫ LiftHom.lift g
9090

91+
instance liftHom_WhiskerLeft (X : C) [LiftObj X] {Y Z : C} [LiftObj Y] [LiftObj Z]
92+
(f : Y ⟶ Z) [LiftHom f] : LiftHom (X ◁ f) where
93+
lift := LiftObj.lift X ◁ LiftHom.lift f
94+
95+
instance liftHom_WhiskerRight {X Y : C} (f : X ⟶ Y) [LiftObj X] [LiftObj Y] [LiftHom f]
96+
{Z : C} [LiftObj Z] : LiftHom (f ▷ Z) where
97+
lift := LiftHom.lift f ▷ LiftObj.lift Z
98+
9199
instance LiftHom_tensor {W X Y Z : C} [LiftObj W] [LiftObj X] [LiftObj Y] [LiftObj Z]
92100
(f : W ⟶ X) (g : Y ⟶ Z) [LiftHom f] [LiftHom g] : LiftHom (f ⊗ g) where
93101
lift := LiftHom.lift f ⊗ LiftHom.lift g
@@ -109,19 +117,24 @@ namespace MonoidalCoherence
109117
instance refl (X : C) [LiftObj X] : MonoidalCoherence X X := ⟨𝟙 _⟩
110118

111119
@[simps]
112-
instance tensor (X Y Z : C) [LiftObj X] [LiftObj Y] [LiftObj Z] [MonoidalCoherence Y Z] :
120+
instance whiskerLeft (X Y Z : C) [LiftObj X] [LiftObj Y] [LiftObj Z] [MonoidalCoherence Y Z] :
113121
MonoidalCoherence (X ⊗ Y) (X ⊗ Z) :=
114122
⟨𝟙 X ⊗ MonoidalCoherence.hom⟩
115123

124+
@[simps]
125+
instance whiskerRight (X Y Z : C) [LiftObj X] [LiftObj Y] [LiftObj Z] [MonoidalCoherence X Y] :
126+
MonoidalCoherence (X ⊗ Z) (Y ⊗ Z) :=
127+
⟨MonoidalCoherence.hom ⊗ 𝟙 Z⟩
128+
116129
@[simps]
117130
instance tensor_right (X Y : C) [LiftObj X] [LiftObj Y] [MonoidalCoherence (𝟙_ C) Y] :
118131
MonoidalCoherence X (X ⊗ Y) :=
119-
⟨(ρ_ X).inv ≫ (𝟙 X ⊗ MonoidalCoherence.hom)⟩
132+
⟨(ρ_ X).inv ≫ (X ◁ MonoidalCoherence.hom)⟩
120133

121134
@[simps]
122135
instance tensor_right' (X Y : C) [LiftObj X] [LiftObj Y] [MonoidalCoherence Y (𝟙_ C)] :
123136
MonoidalCoherence (X ⊗ Y) X :=
124-
⟨(𝟙 X ⊗ MonoidalCoherence.hom) ≫ (ρ_ X).hom⟩
137+
⟨(X ◁ MonoidalCoherence.hom) ≫ (ρ_ X).hom⟩
125138

126139
@[simps]
127140
instance left (X Y : C) [LiftObj X] [LiftObj Y] [MonoidalCoherence X Y] :
@@ -199,7 +212,7 @@ example {W X Y Z : C} (f : W ⟶ (X ⊗ Y) ⊗ Z) : W ⟶ X ⊗ (Y ⊗ Z) := f
199212

200213
example {U V W X Y : C} (f : U ⟶ V ⊗ (W ⊗ X)) (g : (V ⊗ W) ⊗ X ⟶ Y) :
201214
f ⊗≫ g = f ≫ (α_ _ _ _).inv ≫ g := by
202-
simp [monoidalComp]
215+
simp [MonoidalCategory.tensorHom_def, monoidalComp]
203216

204217
end lifting
205218

@@ -227,7 +240,7 @@ def mkProjectMapExpr (e : Expr) : TermElabM Expr := do
227240
/-- Coherence tactic for monoidal categories. -/
228241
def monoidal_coherence (g : MVarId) : TermElabM Unit := g.withContext do
229242
withOptions (fun opts => synthInstance.maxSize.set opts
230-
(max 256 (synthInstance.maxSize.get opts))) do
243+
(max 512 (synthInstance.maxSize.get opts))) do
231244
-- TODO: is this `dsimp only` step necessary? It doesn't appear to be in the tests below.
232245
let (ty, _) ← dsimp (← g.getType) (← Simp.Context.ofNames [] true)
233246
let some (_, lhs, rhs) := (← whnfR ty).eq? | exception g "Not an equation of morphisms."

0 commit comments

Comments
 (0)