Skip to content

Commit 81b1267

Browse files
committed
feat(CategoryTheory): more API for the commutation of functors with shifts (#13757)
In this PR, it is shown that the composition of two functors which commute with shifts also commutes with shifts. The notion of natural transformation which commutes with the shifts is also introduced. This shall be used in the development of the API for the derived category #13742.
1 parent 7788d14 commit 81b1267

File tree

2 files changed

+184
-5
lines changed

2 files changed

+184
-5
lines changed

Mathlib/CategoryTheory/Shift/CommShift.lean

Lines changed: 162 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,13 +147,39 @@ end
147147

148148
namespace CommShift
149149

150-
variable (C)
151-
150+
variable (C) in
152151
instance id : CommShift (𝟭 C) A where
153152
iso := fun a => rightUnitor _ ≪≫ (leftUnitor _).symm
154153

154+
instance comp [F.CommShift A] [G.CommShift A] : (F ⋙ G).CommShift A where
155+
iso a := (Functor.associator _ _ _).symm ≪≫ isoWhiskerRight (F.commShiftIso a) _ ≪≫
156+
Functor.associator _ _ _ ≪≫ isoWhiskerLeft _ (G.commShiftIso a) ≪≫
157+
(Functor.associator _ _ _).symm
158+
zero := by
159+
ext X
160+
dsimp
161+
simp only [id_comp, comp_id, commShiftIso_zero, isoZero_hom_app, ← Functor.map_comp_assoc,
162+
assoc, Iso.inv_hom_id_app, id_obj, comp_map, comp_obj]
163+
add := fun a b => by
164+
ext X
165+
dsimp
166+
simp only [commShiftIso_add, isoAdd_hom_app]
167+
dsimp
168+
simp only [comp_id, id_comp, assoc, ← Functor.map_comp_assoc, Iso.inv_hom_id_app, comp_obj]
169+
simp only [map_comp, assoc, commShiftIso_hom_naturality_assoc]
170+
155171
end CommShift
156172

173+
lemma commShiftIso_comp_hom_app [F.CommShift A] [G.CommShift A] (a : A) (X : C) :
174+
(commShiftIso (F ⋙ G) a).hom.app X =
175+
G.map ((commShiftIso F a).hom.app X) ≫ (commShiftIso G a).hom.app (F.obj X) := by
176+
simp [commShiftIso, CommShift.iso]
177+
178+
lemma commShiftIso_comp_inv_app [F.CommShift A] [G.CommShift A] (a : A) (X : C) :
179+
(commShiftIso (F ⋙ G) a).inv.app X =
180+
(commShiftIso G a).inv.app (F.obj X) ≫ G.map ((commShiftIso F a).inv.app X) := by
181+
simp [commShiftIso, CommShift.iso]
182+
157183
variable {B}
158184

159185
lemma map_shiftFunctorComm_hom_app [F.CommShift B] (X : C) (a b : B) :
@@ -200,4 +226,138 @@ lemma map_shiftFunctorCompIsoId_inv_app [F.CommShift A] (X : C) (a b : A) (h : a
200226

201227
end Functor
202228

229+
namespace NatTrans
230+
231+
variable {C D E : Type*} [Category C] [Category D] [Category E]
232+
{F₁ F₂ F₃ : C ⥤ D} (τ : F₁ ⟶ F₂) (τ' : F₂ ⟶ F₃) (e : F₁ ≅ F₂)
233+
(G G' : D ⥤ E) (τ'' : G ⟶ G')
234+
(A : Type*) [AddMonoid A] [HasShift C A] [HasShift D A] [HasShift E A]
235+
[F₁.CommShift A] [F₂.CommShift A] [F₃.CommShift A]
236+
[G.CommShift A] [G'.CommShift A]
237+
238+
/-- If `τ : F₁ ⟶ F₂` is a natural transformation between two functors
239+
which commute with a shift by an additive monoid `A`, this typeclass
240+
asserts a compatibility of `τ` with these shifts. -/
241+
class CommShift : Prop :=
242+
comm' (a : A) : (F₁.commShiftIso a).hom ≫ whiskerRight τ _ =
243+
whiskerLeft _ τ ≫ (F₂.commShiftIso a).hom
244+
245+
namespace CommShift
246+
247+
section
248+
249+
variable {A}
250+
variable [NatTrans.CommShift τ A]
251+
252+
lemma comm (a : A) : (F₁.commShiftIso a).hom ≫ whiskerRight τ _ =
253+
whiskerLeft _ τ ≫ (F₂.commShiftIso a).hom := by
254+
apply comm'
255+
256+
@[reassoc]
257+
lemma comm_app (a : A) (X : C) :
258+
(F₁.commShiftIso a).hom.app X ≫ (τ.app X)⟦a⟧' =
259+
τ.app (X⟦a⟧) ≫ (F₂.commShiftIso a).hom.app X :=
260+
NatTrans.congr_app (comm τ a) X
261+
262+
@[reassoc]
263+
lemma shift_app (a : A) (X : C) :
264+
(τ.app X)⟦a⟧' = (F₁.commShiftIso a).inv.app X ≫
265+
τ.app (X⟦a⟧) ≫ (F₂.commShiftIso a).hom.app X := by
266+
rw [← comm_app, Iso.inv_hom_id_app_assoc]
267+
268+
@[reassoc]
269+
lemma app_shift (a : A) (X : C) :
270+
τ.app (X⟦a⟧) = (F₁.commShiftIso a).hom.app X ≫ (τ.app X)⟦a⟧' ≫
271+
(F₂.commShiftIso a).inv.app X := by
272+
erw [comm_app_assoc, Iso.hom_inv_id_app, Category.comp_id]
273+
274+
end
275+
276+
instance of_iso_inv [NatTrans.CommShift e.hom A] :
277+
NatTrans.CommShift e.inv A := ⟨fun a => by
278+
ext X
279+
dsimp
280+
rw [← cancel_epi (e.hom.app (X⟦a⟧)), e.hom_inv_id_app_assoc, ← comm_app_assoc,
281+
← Functor.map_comp, e.hom_inv_id_app, Functor.map_id]
282+
rw [Category.comp_id]⟩
283+
284+
lemma of_isIso [IsIso τ] [NatTrans.CommShift τ A] :
285+
NatTrans.CommShift (inv τ) A := by
286+
haveI : NatTrans.CommShift (asIso τ).hom A := by
287+
dsimp
288+
infer_instance
289+
change NatTrans.CommShift (asIso τ).inv A
290+
infer_instance
291+
292+
variable (F₁) in
293+
instance id : NatTrans.CommShift (𝟙 F₁) A := ⟨by aesop_cat⟩
294+
295+
instance comp [NatTrans.CommShift τ A] [NatTrans.CommShift τ' A] :
296+
NatTrans.CommShift (τ ≫ τ') A := ⟨fun a => by
297+
ext X
298+
simp [comm_app_assoc, comm_app]⟩
299+
300+
instance whiskerRight [NatTrans.CommShift τ A] :
301+
NatTrans.CommShift (whiskerRight τ G) A := ⟨fun a => by
302+
ext X
303+
simp only [Functor.comp_obj, whiskerRight_twice, comp_app,
304+
whiskerRight_app, Functor.comp_map, whiskerLeft_app,
305+
Functor.commShiftIso_comp_hom_app, Category.assoc]
306+
erw [← NatTrans.naturality]
307+
dsimp
308+
simp only [← G.map_comp_assoc, comm_app]⟩
309+
310+
variable {G G'} (F₁)
311+
312+
instance whiskerLeft [NatTrans.CommShift τ'' A] :
313+
NatTrans.CommShift (whiskerLeft F₁ τ'') A := ⟨fun a => by
314+
ext X
315+
simp only [Functor.comp_obj, comp_app, whiskerRight_app, whiskerLeft_app, whiskerLeft_twice,
316+
Functor.commShiftIso_comp_hom_app, Category.assoc, ← NatTrans.naturality_assoc, comm_app]⟩
317+
318+
end CommShift
319+
320+
end NatTrans
321+
322+
namespace Functor
323+
324+
namespace CommShift
325+
326+
variable {C D E : Type*} [Category C] [Category D]
327+
{F : C ⥤ D} {G : C ⥤ D} (e : F ≅ G)
328+
(A : Type*) [AddMonoid A] [HasShift C A] [HasShift D A]
329+
[F.CommShift A]
330+
331+
/-- If `e : F ≅ G` is an isomorphism of functors and if `F` commutes with the
332+
shift, then `G` also commutes with the shift. -/
333+
def ofIso : G.CommShift A where
334+
iso a := isoWhiskerLeft _ e.symm ≪≫ F.commShiftIso a ≪≫ isoWhiskerRight e _
335+
zero := by
336+
ext X
337+
simp only [comp_obj, F.commShiftIso_zero A, Iso.trans_hom, isoWhiskerLeft_hom,
338+
Iso.symm_hom, isoWhiskerRight_hom, NatTrans.comp_app, whiskerLeft_app,
339+
isoZero_hom_app, whiskerRight_app, assoc]
340+
erw [← e.inv.naturality_assoc, ← NatTrans.naturality,
341+
e.inv_hom_id_app_assoc]
342+
add a b := by
343+
ext X
344+
simp only [comp_obj, F.commShiftIso_add, Iso.trans_hom, isoWhiskerLeft_hom,
345+
Iso.symm_hom, isoWhiskerRight_hom, NatTrans.comp_app, whiskerLeft_app,
346+
isoAdd_hom_app, whiskerRight_app, assoc, map_comp, NatTrans.naturality_assoc,
347+
NatIso.cancel_natIso_inv_left]
348+
simp only [← Functor.map_comp_assoc, e.hom_inv_id_app_assoc]
349+
simp only [← NatTrans.naturality, comp_obj, comp_map, map_comp, assoc]
350+
351+
lemma ofIso_compatibility :
352+
letI := ofIso e A
353+
NatTrans.CommShift e.hom A := by
354+
letI := ofIso e A
355+
refine' ⟨fun a => _⟩
356+
dsimp [commShiftIso, ofIso]
357+
rw [← whiskerLeft_comp_assoc, e.hom_inv_id, whiskerLeft_id', id_comp]
358+
359+
end CommShift
360+
361+
end Functor
362+
203363
end CategoryTheory

Mathlib/CategoryTheory/Triangulated/Functor.lean

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,9 @@ open Category Limits Pretriangulated Preadditive
2525

2626
namespace Functor
2727

28-
variable {C D : Type*} [Category C] [Category D] [HasShift C ℤ] [HasShift D ℤ]
29-
(F : C ⥤ D) [F.CommShift ℤ]
28+
variable {C D E : Type*} [Category C] [Category D] [Category E]
29+
[HasShift C ℤ] [HasShift D ℤ] [HasShift E ℤ]
30+
(F : C ⥤ D) [F.CommShift ℤ] (G : D ⥤ E) [G.CommShift ℤ]
3031

3132
/-- The functor `Triangle C ⥤ Triangle D` that is induced by a functor `F : C ⥤ D`
3233
which commutes with shift by `ℤ`. -/
@@ -84,7 +85,8 @@ noncomputable def mapTriangleCommShiftIso (n : ℤ) :
8485
simp only [comp_obj, assoc, Iso.inv_hom_id_app_assoc,
8586
← Functor.map_comp, Iso.inv_hom_id_app, map_id, comp_id])) (by aesop_cat)
8687

87-
attribute [local simp] commShiftIso_zero commShiftIso_add
88+
attribute [local simp] map_zsmul comp_zsmul zsmul_comp
89+
commShiftIso_zero commShiftIso_add commShiftIso_comp_hom_app
8890
shiftFunctorAdd'_eq_shiftFunctorAdd
8991

9092
set_option maxHeartbeats 400000 in
@@ -111,6 +113,23 @@ noncomputable def mapTriangleInvRotateIso [F.Additive] :
111113
(fun T => Triangle.isoMk _ _ ((F.commShiftIso (-1 : ℤ)).symm.app _) (Iso.refl _) (Iso.refl _)
112114
(by aesop_cat) (by aesop_cat) (by aesop_cat)) (by aesop_cat)
113115

116+
/-- The canonical isomorphism `(F ⋙ G).mapTriangle ≅ F.mapTriangle ⋙ G.mapTriangle`. -/
117+
@[simps!]
118+
def mapTriangleCompIso : (F ⋙ G).mapTriangle ≅ F.mapTriangle ⋙ G.mapTriangle :=
119+
NatIso.ofComponents (fun T => Triangle.isoMk _ _ (Iso.refl _) (Iso.refl _) (Iso.refl _))
120+
121+
/-- Two isomorphic functors `F₁` and `F₂` induce isomorphic functors
122+
`F₁.mapTriangle` and `F₂.mapTriangle` if the isomorphism `F₁ ≅ F₂` is compatible
123+
with the shifts. -/
124+
@[simps!]
125+
def mapTriangleIso {F₁ F₂ : C ⥤ D} (e : F₁ ≅ F₂) [F₁.CommShift ℤ] [F₂.CommShift ℤ]
126+
[NatTrans.CommShift e.hom ℤ] : F₁.mapTriangle ≅ F₂.mapTriangle :=
127+
NatIso.ofComponents (fun T =>
128+
Triangle.isoMk _ _ (e.app _) (e.app _) (e.app _) (by simp) (by simp) (by
129+
dsimp
130+
simp only [assoc, NatTrans.CommShift.comm_app e.hom (1 : ℤ) T.obj₁,
131+
NatTrans.naturality_assoc])) (by aesop_cat)
132+
114133
end Additive
115134

116135
variable [HasZeroObject C] [HasZeroObject D] [Preadditive C] [Preadditive D]

0 commit comments

Comments
 (0)