-
Notifications
You must be signed in to change notification settings - Fork 259
/
Monoidal.lean
646 lines (520 loc) · 30 KB
/
Monoidal.lean
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
/-
Copyright (c) 2024 Joël Riou. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Joël Riou, Kim Morrison
-/
import Mathlib.CategoryTheory.GradedObject.Unitor
import Mathlib.Tactic.CategoryTheory.Coherence
import Mathlib.CategoryTheory.GradedObject.Unitor
import Mathlib.CategoryTheory.Limits.Shapes.FiniteProducts
import Mathlib.CategoryTheory.Limits.Preserves.Finite
import Mathlib.Tactic.Linarith
import Mathlib.Data.Fintype.Prod
/-!
# The monoidal category structures on graded objects
Assuming that `C` is a monoidal category and that `I` is an additive monoid,
we introduce a partially defined tensor product on the category `GradedObject I C`:
given `X₁` and `X₂` two objects in `GradedObject I C`, we define
`GradedObject.Monoidal.tensorObj X₁ X₂` under the assumption `HasTensor X₁ X₂`
that the coproduct of `X₁ i ⊗ X₂ j` for `i + j = n` exists for any `n : I`.
Under suitable assumptions about the existence of coproducts and the
preservation of certain coproducts by the tensor products in `C`, we
obtain a monoidal category structure on `GradedObject I C`.
In particular, if `C` has finite coproducts to which the tensor
product commutes, we obtain a monoidal category structure on `GradedObject I ℕ`.
-/
universe u v₁ v₂ u₁ u₂
namespace CategoryTheory
open Limits MonoidalCategory Category
namespace Limits
variable {C : Type u₁} {D : Type u₂} [Category.{v₁} C] [Category.{v₂} D] (F : C ⥤ D)
noncomputable instance (J : Type*) [hJ : Finite J] [PreservesFiniteCoproducts F] :
PreservesColimitsOfShape (Discrete J) F := by
apply Nonempty.some
obtain ⟨n, ⟨e⟩⟩ := Finite.exists_equiv_fin J
have : PreservesColimitsOfShape (Discrete (Fin n)) F := PreservesFiniteCoproducts.preserves _
exact ⟨preservesColimitsOfShapeOfEquiv (Discrete.equivalence e.symm) F⟩
end Limits
variable {I : Type u} [AddMonoid I] {C : Type*} [Category C] [MonoidalCategory C]
namespace GradedObject
/-- The tensor product of two graded objects `X₁` and `X₂` exists if for any `n`,
the coproduct of the objects `X₁ i ⊗ X₂ j` for `i + j = n` exists. -/
abbrev HasTensor (X₁ X₂ : GradedObject I C) : Prop :=
HasMap (((mapBifunctor (curriedTensor C) I I).obj X₁).obj X₂) (fun ⟨i, j⟩ => i + j)
namespace Monoidal
/-- The tensor product of two graded objects. -/
noncomputable abbrev tensorObj (X₁ X₂ : GradedObject I C) [HasTensor X₁ X₂] :
GradedObject I C :=
mapBifunctorMapObj (curriedTensor C) (fun ⟨i, j⟩ => i + j) X₁ X₂
section
variable (X₁ X₂ : GradedObject I C) [HasTensor X₁ X₂]
/-- The inclusion of a summand in a tensor product of two graded objects. -/
noncomputable def ιTensorObj (i₁ i₂ i₁₂ : I) (h : i₁ + i₂ = i₁₂) :
X₁ i₁ ⊗ X₂ i₂ ⟶ tensorObj X₁ X₂ i₁₂ :=
ιMapBifunctorMapObj (curriedTensor C) _ _ _ _ _ _ h
variable {X₁ X₂}
@[ext]
lemma tensorObj_ext {A : C} {j : I} (f g : tensorObj X₁ X₂ j ⟶ A)
(h : ∀ (i₁ i₂ : I) (hi : i₁ + i₂ = j),
ιTensorObj X₁ X₂ i₁ i₂ j hi ≫ f = ιTensorObj X₁ X₂ i₁ i₂ j hi ≫ g) : f = g := by
apply mapObj_ext
rintro ⟨i₁, i₂⟩ hi
exact h i₁ i₂ hi
/-- Constructor for morphisms from a tensor product of two graded objects. -/
noncomputable def tensorObjDesc {A : C} {k : I}
(f : ∀ (i₁ i₂ : I) (_ : i₁ + i₂ = k), X₁ i₁ ⊗ X₂ i₂ ⟶ A) : tensorObj X₁ X₂ k ⟶ A :=
mapBifunctorMapObjDesc f
@[reassoc (attr := simp)]
lemma ι_tensorObjDesc {A : C} {k : I}
(f : ∀ (i₁ i₂ : I) (_ : i₁ + i₂ = k), X₁ i₁ ⊗ X₂ i₂ ⟶ A) (i₁ i₂ : I) (hi : i₁ + i₂ = k) :
ιTensorObj X₁ X₂ i₁ i₂ k hi ≫ tensorObjDesc f = f i₁ i₂ hi := by
apply ι_mapBifunctorMapObjDesc
end
/-- The morphism `tensorObj X₁ Y₁ ⟶ tensorObj X₂ Y₂` induced by morphisms of graded
objects `f : X₁ ⟶ X₂` and `g : Y₁ ⟶ Y₂`. -/
noncomputable def tensorHom {X₁ X₂ Y₁ Y₂ : GradedObject I C} (f : X₁ ⟶ X₂) (g : Y₁ ⟶ Y₂)
[HasTensor X₁ Y₁] [HasTensor X₂ Y₂] :
tensorObj X₁ Y₁ ⟶ tensorObj X₂ Y₂ :=
mapBifunctorMapMap _ _ f g
@[reassoc (attr := simp)]
lemma ι_tensorHom {X₁ X₂ Y₁ Y₂ : GradedObject I C} (f : X₁ ⟶ X₂) (g : Y₁ ⟶ Y₂)
[HasTensor X₁ Y₁] [HasTensor X₂ Y₂] (i₁ i₂ i₁₂ : I) (h : i₁ + i₂ = i₁₂) :
ιTensorObj X₁ Y₁ i₁ i₂ i₁₂ h ≫ tensorHom f g i₁₂ =
(f i₁ ⊗ g i₂) ≫ ιTensorObj X₂ Y₂ i₁ i₂ i₁₂ h := by
rw [MonoidalCategory.tensorHom_def, assoc]
apply ι_mapBifunctorMapMap
/-- The morphism `tensorObj X Y₁ ⟶ tensorObj X Y₂` induced by a morphism of graded objects
`φ : Y₁ ⟶ Y₂`. -/
noncomputable abbrev whiskerLeft (X : GradedObject I C) {Y₁ Y₂ : GradedObject I C} (φ : Y₁ ⟶ Y₂)
[HasTensor X Y₁] [HasTensor X Y₂] : tensorObj X Y₁ ⟶ tensorObj X Y₂ :=
tensorHom (𝟙 X) φ
/-- The morphism `tensorObj X₁ Y ⟶ tensorObj X₂ Y` induced by a morphism of graded objects
`φ : X₁ ⟶ X₂`. -/
noncomputable abbrev whiskerRight {X₁ X₂ : GradedObject I C} (φ : X₁ ⟶ X₂) (Y : GradedObject I C)
[HasTensor X₁ Y] [HasTensor X₂ Y] : tensorObj X₁ Y ⟶ tensorObj X₂ Y :=
tensorHom φ (𝟙 Y)
@[simp]
lemma tensor_id (X Y : GradedObject I C) [HasTensor X Y] :
tensorHom (𝟙 X) (𝟙 Y) = 𝟙 _ := by
dsimp [tensorHom, mapBifunctorMapMap]
simp only [Functor.map_id, NatTrans.id_app, comp_id, mapMap_id]
rfl
@[reassoc]
lemma tensor_comp {X₁ X₂ X₃ Y₁ Y₂ Y₃ : GradedObject I C} (f₁ : X₁ ⟶ X₂) (f₂ : X₂ ⟶ X₃)
(g₁ : Y₁ ⟶ Y₂) (g₂ : Y₂ ⟶ Y₃) [HasTensor X₁ Y₁] [HasTensor X₂ Y₂] [HasTensor X₃ Y₃] :
tensorHom (f₁ ≫ f₂) (g₁ ≫ g₂) = tensorHom f₁ g₁ ≫ tensorHom f₂ g₂ := by
dsimp only [tensorHom, mapBifunctorMapMap]
rw [← mapMap_comp]
apply congr_mapMap
simp
lemma tensorHom_def {X₁ X₂ Y₁ Y₂ : GradedObject I C} (f : X₁ ⟶ X₂) (g : Y₁ ⟶ Y₂)
[HasTensor X₁ Y₁] [HasTensor X₂ Y₂] [HasTensor X₂ Y₁] :
tensorHom f g = whiskerRight f Y₁ ≫ whiskerLeft X₂ g := by
rw [← tensor_comp, id_comp, comp_id]
/-- This is the addition map `I × I × I → I` for an additive monoid `I`. -/
def r₁₂₃ : I × I × I → I := fun ⟨i, j, k⟩ => i + j + k
/-- Auxiliary definition for `associator`. -/
@[reducible] def ρ₁₂ : BifunctorComp₁₂IndexData (r₁₂₃ : _ → I) where
I₁₂ := I
p := fun ⟨i₁, i₂⟩ => i₁ + i₂
q := fun ⟨i₁₂, i₃⟩ => i₁₂ + i₃
hpq := fun _ => rfl
/-- Auxiliary definition for `associator`. -/
@[reducible] def ρ₂₃ : BifunctorComp₂₃IndexData (r₁₂₃ : _ → I) where
I₂₃ := I
p := fun ⟨i₂, i₃⟩ => i₂ + i₃
q := fun ⟨i₁₂, i₃⟩ => i₁₂ + i₃
hpq _ := (add_assoc _ _ _).symm
variable (I) in
/-- Auxiliary definition for `associator`. -/
@[reducible]
def triangleIndexData : TriangleIndexData (r₁₂₃ : _ → I) (fun ⟨i₁, i₃⟩ => i₁ + i₃) where
p₁₂ := fun ⟨i₁, i₂⟩ => i₁ + i₂
p₂₃ := fun ⟨i₂, i₃⟩ => i₂ + i₃
hp₁₂ := fun _ => rfl
hp₂₃ := fun _ => (add_assoc _ _ _).symm
h₁ := add_zero
h₃ := zero_add
/-- Given three graded objects `X₁`, `X₂`, `X₃` in `GradedObject I C`, this is the
assumption that for all `i₁₂ : I` and `i₃ : I`, the tensor product functor `- ⊗ X₃ i₃`
commutes with the coproduct of the objects `X₁ i₁ ⊗ X₂ i₂` such that `i₁ + i₂ = i₁₂`. -/
abbrev _root_.CategoryTheory.GradedObject.HasGoodTensor₁₂Tensor (X₁ X₂ X₃ : GradedObject I C) :=
HasGoodTrifunctor₁₂Obj (curriedTensor C) (curriedTensor C) ρ₁₂ X₁ X₂ X₃
/-- Given three graded objects `X₁`, `X₂`, `X₃` in `GradedObject I C`, this is the
assumption that for all `i₁ : I` and `i₂₃ : I`, the tensor product functor `X₁ i₁ ⊗ -`
commutes with the coproduct of the objects `X₂ i₂ ⊗ X₃ i₃` such that `i₂ + i₃ = i₂₃`. -/
abbrev _root_.CategoryTheory.GradedObject.HasGoodTensorTensor₂₃ (X₁ X₂ X₃ : GradedObject I C) :=
HasGoodTrifunctor₂₃Obj (curriedTensor C) (curriedTensor C) ρ₂₃ X₁ X₂ X₃
section
variable (Z : C) (X₁ X₂ X₃ : GradedObject I C) [HasTensor X₁ X₂] [HasTensor X₂ X₃]
[HasTensor (tensorObj X₁ X₂) X₃] [HasTensor X₁ (tensorObj X₂ X₃)]
{Y₁ Y₂ Y₃ : GradedObject I C} [HasTensor Y₁ Y₂] [HasTensor Y₂ Y₃]
[HasTensor (tensorObj Y₁ Y₂) Y₃] [HasTensor Y₁ (tensorObj Y₂ Y₃)]
/-- The associator isomorphism for graded objects. -/
noncomputable def associator [HasGoodTensor₁₂Tensor X₁ X₂ X₃] [HasGoodTensorTensor₂₃ X₁ X₂ X₃] :
tensorObj (tensorObj X₁ X₂) X₃ ≅ tensorObj X₁ (tensorObj X₂ X₃) :=
mapBifunctorAssociator (MonoidalCategory.curriedAssociatorNatIso C) ρ₁₂ ρ₂₃ X₁ X₂ X₃
/-- The inclusion `X₁ i₁ ⊗ X₂ i₂ ⊗ X₃ i₃ ⟶ tensorObj X₁ (tensorObj X₂ X₃) j`
when `i₁ + i₂ + i₃ = j`. -/
noncomputable def ιTensorObj₃ (i₁ i₂ i₃ j : I) (h : i₁ + i₂ + i₃ = j) :
X₁ i₁ ⊗ X₂ i₂ ⊗ X₃ i₃ ⟶ tensorObj X₁ (tensorObj X₂ X₃) j :=
X₁ i₁ ◁ ιTensorObj X₂ X₃ i₂ i₃ _ rfl ≫ ιTensorObj X₁ (tensorObj X₂ X₃) i₁ (i₂ + i₃) j
(by rw [← add_assoc, h])
@[reassoc]
lemma ιTensorObj₃_eq (i₁ i₂ i₃ j : I) (h : i₁ + i₂ + i₃ = j) (i₂₃ : I) (h' : i₂ + i₃ = i₂₃) :
ιTensorObj₃ X₁ X₂ X₃ i₁ i₂ i₃ j h =
(X₁ i₁ ◁ ιTensorObj X₂ X₃ i₂ i₃ i₂₃ h') ≫
ιTensorObj X₁ (tensorObj X₂ X₃) i₁ i₂₃ j (by rw [← h', ← add_assoc, h]) := by
subst h'
rfl
/-- The inclusion `X₁ i₁ ⊗ X₂ i₂ ⊗ X₃ i₃ ⟶ tensorObj (tensorObj X₁ X₂) X₃ j`
when `i₁ + i₂ + i₃ = j`. -/
noncomputable def ιTensorObj₃' (i₁ i₂ i₃ j : I) (h : i₁ + i₂ + i₃ = j) :
(X₁ i₁ ⊗ X₂ i₂) ⊗ X₃ i₃ ⟶ tensorObj (tensorObj X₁ X₂) X₃ j :=
(ιTensorObj X₁ X₂ i₁ i₂ (i₁ + i₂) rfl ▷ X₃ i₃) ≫
ιTensorObj (tensorObj X₁ X₂) X₃ (i₁ + i₂) i₃ j h
@[reassoc]
lemma ιTensorObj₃'_eq (i₁ i₂ i₃ j : I) (h : i₁ + i₂ + i₃ = j) (i₁₂ : I)
(h' : i₁ + i₂ = i₁₂) :
ιTensorObj₃' X₁ X₂ X₃ i₁ i₂ i₃ j h =
(ιTensorObj X₁ X₂ i₁ i₂ i₁₂ h' ▷ X₃ i₃) ≫
ιTensorObj (tensorObj X₁ X₂) X₃ i₁₂ i₃ j (by rw [← h', h]) := by
subst h'
rfl
variable {X₁ X₂ X₃}
@[reassoc (attr := simp)]
lemma ιTensorObj₃_tensorHom (f₁ : X₁ ⟶ Y₁) (f₂ : X₂ ⟶ Y₂) (f₃ : X₃ ⟶ Y₃)
(i₁ i₂ i₃ j : I) (h : i₁ + i₂ + i₃ = j) :
ιTensorObj₃ X₁ X₂ X₃ i₁ i₂ i₃ j h ≫ tensorHom f₁ (tensorHom f₂ f₃) j =
(f₁ i₁ ⊗ f₂ i₂ ⊗ f₃ i₃) ≫ ιTensorObj₃ Y₁ Y₂ Y₃ i₁ i₂ i₃ j h := by
rw [ιTensorObj₃_eq _ _ _ i₁ i₂ i₃ j h _ rfl,
ιTensorObj₃_eq _ _ _ i₁ i₂ i₃ j h _ rfl, assoc, ι_tensorHom,
← id_tensorHom, ← id_tensorHom, ← MonoidalCategory.tensor_comp_assoc, ι_tensorHom,
← MonoidalCategory.tensor_comp_assoc, id_comp, comp_id]
@[reassoc (attr := simp)]
lemma ιTensorObj₃'_tensorHom (f₁ : X₁ ⟶ Y₁) (f₂ : X₂ ⟶ Y₂) (f₃ : X₃ ⟶ Y₃)
(i₁ i₂ i₃ j : I) (h : i₁ + i₂ + i₃ = j) :
ιTensorObj₃' X₁ X₂ X₃ i₁ i₂ i₃ j h ≫ tensorHom (tensorHom f₁ f₂) f₃ j =
((f₁ i₁ ⊗ f₂ i₂) ⊗ f₃ i₃) ≫ ιTensorObj₃' Y₁ Y₂ Y₃ i₁ i₂ i₃ j h := by
rw [ιTensorObj₃'_eq _ _ _ i₁ i₂ i₃ j h _ rfl,
ιTensorObj₃'_eq _ _ _ i₁ i₂ i₃ j h _ rfl, assoc, ι_tensorHom,
← tensorHom_id, ← tensorHom_id, ← MonoidalCategory.tensor_comp_assoc, id_comp,
ι_tensorHom, ← MonoidalCategory.tensor_comp_assoc, comp_id]
@[ext]
lemma tensorObj₃_ext {j : I} {A : C} (f g : tensorObj X₁ (tensorObj X₂ X₃) j ⟶ A)
[H : HasGoodTensorTensor₂₃ X₁ X₂ X₃]
(h : ∀ (i₁ i₂ i₃ : I) (hi : i₁ + i₂ + i₃ = j),
ιTensorObj₃ X₁ X₂ X₃ i₁ i₂ i₃ j hi ≫ f = ιTensorObj₃ X₁ X₂ X₃ i₁ i₂ i₃ j hi ≫ g) :
f = g := by
apply mapBifunctorBifunctor₂₃MapObj_ext (H := H)
intro i₁ i₂ i₃ hi
exact h i₁ i₂ i₃ hi
@[ext]
lemma tensorObj₃'_ext {j : I} {A : C} (f g : tensorObj (tensorObj X₁ X₂) X₃ j ⟶ A)
[H : HasGoodTensor₁₂Tensor X₁ X₂ X₃]
(h : ∀ (i₁ i₂ i₃ : I) (h : i₁ + i₂ + i₃ = j),
ιTensorObj₃' X₁ X₂ X₃ i₁ i₂ i₃ j h ≫ f = ιTensorObj₃' X₁ X₂ X₃ i₁ i₂ i₃ j h ≫ g) :
f = g := by
apply mapBifunctor₁₂BifunctorMapObj_ext (H := H)
intro i₁ i₂ i₃ hi
exact h i₁ i₂ i₃ hi
variable (X₁ X₂ X₃)
@[reassoc (attr := simp)]
lemma ιTensorObj₃'_associator_hom
[HasGoodTensor₁₂Tensor X₁ X₂ X₃] [HasGoodTensorTensor₂₃ X₁ X₂ X₃]
(i₁ i₂ i₃ j : I) (h : i₁ + i₂ + i₃ = j) :
ιTensorObj₃' X₁ X₂ X₃ i₁ i₂ i₃ j h ≫ (associator X₁ X₂ X₃).hom j =
(α_ _ _ _).hom ≫ ιTensorObj₃ X₁ X₂ X₃ i₁ i₂ i₃ j h :=
ι_mapBifunctorAssociator_hom (MonoidalCategory.curriedAssociatorNatIso C)
ρ₁₂ ρ₂₃ X₁ X₂ X₃ i₁ i₂ i₃ j h
@[reassoc (attr := simp)]
lemma ιTensorObj₃_associator_inv
[HasGoodTensor₁₂Tensor X₁ X₂ X₃] [HasGoodTensorTensor₂₃ X₁ X₂ X₃]
(i₁ i₂ i₃ j : I) (h : i₁ + i₂ + i₃ = j) :
ιTensorObj₃ X₁ X₂ X₃ i₁ i₂ i₃ j h ≫ (associator X₁ X₂ X₃).inv j =
(α_ _ _ _).inv ≫ ιTensorObj₃' X₁ X₂ X₃ i₁ i₂ i₃ j h :=
ι_mapBifunctorAssociator_inv (MonoidalCategory.curriedAssociatorNatIso C)
ρ₁₂ ρ₂₃ X₁ X₂ X₃ i₁ i₂ i₃ j h
variable {X₁ X₂ X₃}
lemma associator_naturality (f₁ : X₁ ⟶ Y₁) (f₂ : X₂ ⟶ Y₂) (f₃ : X₃ ⟶ Y₃)
[HasGoodTensor₁₂Tensor X₁ X₂ X₃] [HasGoodTensorTensor₂₃ X₁ X₂ X₃]
[HasGoodTensor₁₂Tensor Y₁ Y₂ Y₃] [HasGoodTensorTensor₂₃ Y₁ Y₂ Y₃] :
tensorHom (tensorHom f₁ f₂) f₃ ≫ (associator Y₁ Y₂ Y₃).hom =
(associator X₁ X₂ X₃).hom ≫ tensorHom f₁ (tensorHom f₂ f₃) := by aesop_cat
variable (X₁ X₂ X₃)
abbrev _root_.CategoryTheory.GradedObject.HasLeftTensor₃ObjExt (j : I) := PreservesColimit
(Discrete.functor fun (i : { i : (I × I × I) | i.1 + i.2.1 + i.2.2 = j }) ↦
(((mapTrifunctor (bifunctorComp₂₃ (curriedTensor C)
(curriedTensor C)) I I I).obj X₁).obj X₂).obj X₃ i)
((curriedTensor C).obj Z)
variable {X₁ X₂ X₃}
@[ext]
lemma left_tensor_tensorObj₃_ext {j : I} {A : C} (Z : C)
(f g : Z ⊗ tensorObj X₁ (tensorObj X₂ X₃) j ⟶ A)
[H : HasGoodTensorTensor₂₃ X₁ X₂ X₃]
[hZ : HasLeftTensor₃ObjExt Z X₁ X₂ X₃ j]
(h : ∀ (i₁ i₂ i₃ : I) (h : i₁ + i₂ + i₃ = j),
(_ ◁ ιTensorObj₃ X₁ X₂ X₃ i₁ i₂ i₃ j h) ≫ f =
(_ ◁ ιTensorObj₃ X₁ X₂ X₃ i₁ i₂ i₃ j h) ≫ g) : f = g := by
refine (@isColimitOfPreserves C _ C _ _ _ _ ((curriedTensor C).obj Z) _
(isColimitCofan₃MapBifunctorBifunctor₂₃MapObj (H := H) j) hZ).hom_ext ?_
intro ⟨⟨i₁, i₂, i₃⟩, hi⟩
exact h _ _ _ hi
end
section
variable (X₁ X₂ X₃ X₄ : GradedObject I C)
[HasTensor X₃ X₄]
[HasTensor X₂ (tensorObj X₃ X₄)]
[HasTensor X₁ (tensorObj X₂ (tensorObj X₃ X₄))]
noncomputable def ιTensorObj₄ (i₁ i₂ i₃ i₄ j : I) (h : i₁ + i₂ + i₃ + i₄ = j) :
X₁ i₁ ⊗ X₂ i₂ ⊗ X₃ i₃ ⊗ X₄ i₄ ⟶ tensorObj X₁ (tensorObj X₂ (tensorObj X₃ X₄)) j :=
(_ ◁ ιTensorObj₃ X₂ X₃ X₄ i₂ i₃ i₄ _ rfl) ≫
ιTensorObj X₁ (tensorObj X₂ (tensorObj X₃ X₄)) i₁ (i₂ + i₃ + i₄) j
(by rw [← h, ← add_assoc, ← add_assoc])
lemma ιTensorObj₄_eq (i₁ i₂ i₃ i₄ j : I) (h : i₁ + i₂ + i₃ + i₄ = j) (i₂₃₄ : I)
(hi : i₂ + i₃ + i₄ = i₂₃₄) :
ιTensorObj₄ X₁ X₂ X₃ X₄ i₁ i₂ i₃ i₄ j h =
(_ ◁ ιTensorObj₃ X₂ X₃ X₄ i₂ i₃ i₄ _ hi) ≫
ιTensorObj X₁ (tensorObj X₂ (tensorObj X₃ X₄)) i₁ i₂₃₄ j
(by rw [← hi, ← add_assoc, ← add_assoc, h]) := by
subst hi
rfl
abbrev _root_.CategoryTheory.GradedObject.HasTensor₄ObjExt :=
∀ (i₁ i₂₃₄ : I), HasLeftTensor₃ObjExt (X₁ i₁) X₂ X₃ X₄ i₂₃₄
variable {X₁ X₂ X₃ X₄}
@[ext]
lemma tensorObj₄_ext {j : I} {A : C} (f g : tensorObj X₁ (tensorObj X₂ (tensorObj X₃ X₄)) j ⟶ A)
[HasGoodTensorTensor₂₃ X₂ X₃ X₄]
[H : HasTensor₄ObjExt X₁ X₂ X₃ X₄]
(h : ∀ (i₁ i₂ i₃ i₄ : I) (h : i₁ + i₂ + i₃ + i₄ = j),
ιTensorObj₄ X₁ X₂ X₃ X₄ i₁ i₂ i₃ i₄ j h ≫ f =
ιTensorObj₄ X₁ X₂ X₃ X₄ i₁ i₂ i₃ i₄ j h ≫ g) : f = g := by
apply tensorObj_ext
intro i₁ i₂₃₄ h'
apply left_tensor_tensorObj₃_ext
intro i₂ i₃ i₄ h''
have hj : i₁ + i₂ + i₃ + i₄ = j := by simp only [← h', ← h'', add_assoc]
simpa only [assoc, ιTensorObj₄_eq X₁ X₂ X₃ X₄ i₁ i₂ i₃ i₄ j hj i₂₃₄ h''] using h i₁ i₂ i₃ i₄ hj
end
section Pentagon
variable (X₁ X₂ X₃ X₄ : GradedObject I C)
[HasTensor X₁ X₂] [HasTensor X₂ X₃] [HasTensor X₃ X₄]
[HasTensor (tensorObj X₁ X₂) X₃] [HasTensor X₁ (tensorObj X₂ X₃)]
[HasTensor (tensorObj X₂ X₃) X₄] [HasTensor X₂ (tensorObj X₃ X₄)]
[HasTensor (tensorObj (tensorObj X₁ X₂) X₃) X₄]
[HasTensor (tensorObj X₁ (tensorObj X₂ X₃)) X₄]
[HasTensor X₁ (tensorObj (tensorObj X₂ X₃) X₄)]
[HasTensor X₁ (tensorObj X₂ (tensorObj X₃ X₄))]
[HasTensor (tensorObj X₁ X₂) (tensorObj X₃ X₄)]
[HasGoodTensor₁₂Tensor X₁ X₂ X₃] [HasGoodTensorTensor₂₃ X₁ X₂ X₃]
[HasGoodTensor₁₂Tensor X₁ (tensorObj X₂ X₃) X₄]
[HasGoodTensorTensor₂₃ X₁ (tensorObj X₂ X₃) X₄]
[HasGoodTensor₁₂Tensor X₂ X₃ X₄] [HasGoodTensorTensor₂₃ X₂ X₃ X₄]
[HasGoodTensor₁₂Tensor (tensorObj X₁ X₂) X₃ X₄]
[HasGoodTensorTensor₂₃ (tensorObj X₁ X₂) X₃ X₄]
[HasGoodTensor₁₂Tensor X₁ X₂ (tensorObj X₃ X₄)]
[HasGoodTensorTensor₂₃ X₁ X₂ (tensorObj X₃ X₄)]
[HasTensor₄ObjExt X₁ X₂ X₃ X₄]
@[reassoc]
lemma whiskerLeft_whiskerLeft_associator_inv
(X Y : C) {Z₁ Z₂ : C} (f : Z₁ ⟶ Z₂) :
X ◁ Y ◁ f ≫ (α_ _ _ _).inv = (α_ _ _ _).inv ≫ _ ◁ f := by simp
@[reassoc]
lemma pentagon_inv :
tensorHom (𝟙 X₁) (associator X₂ X₃ X₄).inv ≫ (associator X₁ (tensorObj X₂ X₃) X₄).inv ≫
tensorHom (associator X₁ X₂ X₃).inv (𝟙 X₄) =
(associator X₁ X₂ (tensorObj X₃ X₄)).inv ≫ (associator (tensorObj X₁ X₂) X₃ X₄).inv := by
ext j i₁ i₂ i₃ i₄ h
dsimp
conv_lhs =>
rw [ιTensorObj₄_eq X₁ X₂ X₃ X₄ i₁ i₂ i₃ i₄ j h _ rfl, assoc, ι_tensorHom_assoc]
dsimp
rw [id_tensorHom, ← MonoidalCategory.whiskerLeft_comp_assoc, ιTensorObj₃_associator_inv,
ιTensorObj₃'_eq X₂ X₃ X₄ i₂ i₃ i₄ _ rfl _ rfl, MonoidalCategory.whiskerLeft_comp_assoc,
MonoidalCategory.whiskerLeft_comp_assoc,
← ιTensorObj₃_eq_assoc X₁ (tensorObj X₂ X₃) X₄ i₁ (i₂ + i₃) i₄ j
(by simp only [← add_assoc, h]) _ rfl, ιTensorObj₃_associator_inv_assoc,
ιTensorObj₃'_eq_assoc X₁ (tensorObj X₂ X₃) X₄ i₁ (i₂ + i₃) i₄ j
(by simp only [← add_assoc, h]) (i₁ + i₂ + i₃) (by rw [add_assoc]), ι_tensorHom]
dsimp
rw [tensorHom_id, whisker_assoc_symm_assoc, Iso.hom_inv_id_assoc,
← MonoidalCategory.comp_whiskerRight_assoc, ← MonoidalCategory.comp_whiskerRight_assoc,
← ιTensorObj₃_eq X₁ X₂ X₃ i₁ i₂ i₃ _ rfl _ rfl, ιTensorObj₃_associator_inv,
MonoidalCategory.comp_whiskerRight_assoc, MonoidalCategory.pentagon_inv_assoc]
conv_rhs =>
rw [ιTensorObj₄_eq X₁ X₂ X₃ X₄ i₁ i₂ i₃ i₄ _ _ _ rfl,
ιTensorObj₃_eq X₂ X₃ X₄ i₂ i₃ i₄ _ rfl _ rfl, assoc,
MonoidalCategory.whiskerLeft_comp_assoc,
← ιTensorObj₃_eq_assoc X₁ X₂ (tensorObj X₃ X₄) i₁ i₂ (i₃ + i₄) j
(by rw [← add_assoc, h]) (i₂ + i₃ + i₄) (by rw [add_assoc]),
ιTensorObj₃_associator_inv_assoc, whiskerLeft_whiskerLeft_associator_inv_assoc,
ιTensorObj₃'_eq_assoc X₁ X₂ (tensorObj X₃ X₄) i₁ i₂ (i₃ + i₄) j
(by rw [← add_assoc, h]) _ rfl, whisker_exchange_assoc,
← ιTensorObj₃_eq_assoc (tensorObj X₁ X₂) X₃ X₄ (i₁ + i₂) i₃ i₄ j h _ rfl,
ιTensorObj₃_associator_inv, whiskerRight_tensor_assoc, Iso.hom_inv_id_assoc,
ιTensorObj₃'_eq (tensorObj X₁ X₂) X₃ X₄ (i₁ + i₂) i₃ i₄ j h _ rfl,
← MonoidalCategory.comp_whiskerRight_assoc,
← ιTensorObj₃'_eq X₁ X₂ X₃ i₁ i₂ i₃ _ rfl _ rfl]
lemma pentagon : tensorHom (associator X₁ X₂ X₃).hom (𝟙 X₄) ≫
(associator X₁ (tensorObj X₂ X₃) X₄).hom ≫ tensorHom (𝟙 X₁) (associator X₂ X₃ X₄).hom =
(associator (tensorObj X₁ X₂) X₃ X₄).hom ≫ (associator X₁ X₂ (tensorObj X₃ X₄)).hom := by
rw [← cancel_epi (associator (tensorObj X₁ X₂) X₃ X₄).inv,
← cancel_epi (associator X₁ X₂ (tensorObj X₃ X₄)).inv, Iso.inv_hom_id_assoc,
Iso.inv_hom_id, ← pentagon_inv_assoc, ← tensor_comp_assoc, id_comp, Iso.inv_hom_id,
tensor_id, id_comp, Iso.inv_hom_id_assoc, ← tensor_comp, id_comp, Iso.inv_hom_id,
tensor_id]
end Pentagon
section TensorUnit
variable [DecidableEq I] [HasInitial C]
/-- The unit of the tensor product on graded objects is `(single₀ I).obj (𝟙_ C)`. -/
noncomputable def tensorUnit : GradedObject I C := (single₀ I).obj (𝟙_ C)
/-- The canonical isomorphism `tensorUnit 0 ≅ 𝟙_ C` -/
noncomputable def tensorUnit₀ : (tensorUnit : GradedObject I C) 0 ≅ 𝟙_ C :=
singleObjApplyIso (0 : I) (𝟙_ C)
/-- `tensorUnit i` is an initial object when `i ≠ 0`. -/
noncomputable def isInitialTensorUnitApply (i : I) (hi : i ≠ 0) :
IsInitial ((tensorUnit : GradedObject I C) i) :=
isInitialSingleObjApply _ _ _ hi
end TensorUnit
section LeftUnitor
variable [DecidableEq I] [HasInitial C]
[∀ X₂, PreservesColimit (Functor.empty.{0} C) ((curriedTensor C).flip.obj X₂)]
(X X' : GradedObject I C)
instance : HasTensor tensorUnit X :=
mapBifunctorLeftUnitor_hasMap _ _ (leftUnitorNatIso C) _ zero_add _
instance : HasMap (((mapBifunctor (curriedTensor C) I I).obj
((single₀ I).obj (𝟙_ C))).obj X) (fun ⟨i₁, i₂⟩ => i₁ + i₂) :=
(inferInstance : HasTensor tensorUnit X)
/-- The left unitor isomorphism for graded objects. -/
noncomputable def leftUnitor : tensorObj tensorUnit X ≅ X :=
mapBifunctorLeftUnitor (curriedTensor C) (𝟙_ C)
(leftUnitorNatIso C) (fun (⟨i₁, i₂⟩ : I × I) => i₁ + i₂) zero_add X
lemma leftUnitor_inv_apply (i : I) :
(leftUnitor X).inv i = (λ_ (X i)).inv ≫ tensorUnit₀.inv ▷ (X i) ≫
ιTensorObj tensorUnit X 0 i i (zero_add i) := rfl
variable {X X'}
@[reassoc (attr := simp)]
lemma leftUnitor_naturality (φ : X ⟶ X') :
tensorHom (𝟙 (tensorUnit)) φ ≫ (leftUnitor X').hom =
(leftUnitor X).hom ≫ φ := by
apply mapBifunctorLeftUnitor_naturality
end LeftUnitor
section RightUnitor
variable [DecidableEq I] [HasInitial C]
[∀ X₁, PreservesColimit (Functor.empty.{0} C) ((curriedTensor C).obj X₁)]
(X X' : GradedObject I C)
instance : HasTensor X tensorUnit :=
mapBifunctorRightUnitor_hasMap (curriedTensor C) _
(rightUnitorNatIso C) _ add_zero _
instance : HasMap (((mapBifunctor (curriedTensor C) I I).obj X).obj
((single₀ I).obj (𝟙_ C))) (fun ⟨i₁, i₂⟩ => i₁ + i₂) :=
(inferInstance : HasTensor X tensorUnit)
/-- The right unitor isomorphism for graded objects. -/
noncomputable def rightUnitor : tensorObj X tensorUnit ≅ X :=
mapBifunctorRightUnitor (curriedTensor C) (𝟙_ C)
(rightUnitorNatIso C) (fun (⟨i₁, i₂⟩ : I × I) => i₁ + i₂) add_zero X
lemma rightUnitor_inv_apply (i : I) :
(rightUnitor X).inv i = (ρ_ (X i)).inv ≫ (X i) ◁ tensorUnit₀.inv ≫
ιTensorObj X tensorUnit i 0 i (add_zero i) := rfl
variable {X X'}
@[reassoc (attr := simp)]
lemma rightUnitor_naturality (φ : X ⟶ X') :
tensorHom φ (𝟙 (tensorUnit)) ≫ (rightUnitor X').hom =
(rightUnitor X).hom ≫ φ := by
apply mapBifunctorRightUnitor_naturality
end RightUnitor
section Triangle
variable [DecidableEq I] [HasInitial C]
[∀ X₁, PreservesColimit (Functor.empty.{0} C) ((curriedTensor C).obj X₁)]
[∀ X₂, PreservesColimit (Functor.empty.{0} C)
((curriedTensor C).flip.obj X₂)]
(X₁ X₃ : GradedObject I C) [HasTensor X₁ X₃]
[HasTensor (tensorObj X₁ tensorUnit) X₃] [HasTensor X₁ (tensorObj tensorUnit X₃)]
[HasGoodTensor₁₂Tensor X₁ tensorUnit X₃] [HasGoodTensorTensor₂₃ X₁ tensorUnit X₃]
lemma triangle :
(associator X₁ tensorUnit X₃).hom ≫ tensorHom (𝟙 X₁) (leftUnitor X₃).hom =
tensorHom (rightUnitor X₁).hom (𝟙 X₃) := by
convert mapBifunctor_triangle (curriedAssociatorNatIso C) (𝟙_ C)
(rightUnitorNatIso C) (leftUnitorNatIso C) (triangleIndexData I) X₁ X₃ (by simp)
end Triangle
end Monoidal
section
variable
[∀ (X₁ X₂ : GradedObject I C), HasTensor X₁ X₂]
[∀ (X₁ X₂ X₃ : GradedObject I C), HasGoodTensor₁₂Tensor X₁ X₂ X₃]
[∀ (X₁ X₂ X₃ : GradedObject I C), HasGoodTensorTensor₂₃ X₁ X₂ X₃]
[DecidableEq I] [HasInitial C]
[∀ X₁, PreservesColimit (Functor.empty.{0} C) ((curriedTensor C).obj X₁)]
[∀ X₂, PreservesColimit (Functor.empty.{0} C) ((curriedTensor C).flip.obj X₂)]
[∀ (X₁ X₂ X₃ X₄ : GradedObject I C), HasTensor₄ObjExt X₁ X₂ X₃ X₄]
noncomputable instance monoidalCategory : MonoidalCategory (GradedObject I C) where
tensorObj X Y := Monoidal.tensorObj X Y
tensorHom f g := Monoidal.tensorHom f g
tensorHom_def f g := Monoidal.tensorHom_def f g
whiskerLeft X _ _ φ := Monoidal.whiskerLeft X φ
whiskerRight {_ _ φ Y} := Monoidal.whiskerRight φ Y
tensorUnit := Monoidal.tensorUnit
associator X₁ X₂ X₃ := Monoidal.associator X₁ X₂ X₃
associator_naturality f₁ f₂ f₃ := Monoidal.associator_naturality f₁ f₂ f₃
leftUnitor X := Monoidal.leftUnitor X
leftUnitor_naturality := Monoidal.leftUnitor_naturality
rightUnitor X := Monoidal.rightUnitor X
rightUnitor_naturality := Monoidal.rightUnitor_naturality
tensor_comp f₁ f₂ g₁ g₂ := Monoidal.tensor_comp f₁ g₁ f₂ g₂
pentagon X₁ X₂ X₃ X₄ := Monoidal.pentagon X₁ X₂ X₃ X₄
triangle X₁ X₂ := Monoidal.triangle X₁ X₂
/-variable {A : C} (X₁ X₂ X₃ X₄ Y₁ Y₂ : GradedObject I C)
noncomputable def tensorObjIso :
X₁ ⊗ X₂ ≅ mapBifunctorMapObj (curriedTensor C) (fun ⟨i, j⟩ => i + j) X₁ X₂ := Iso.refl _
noncomputable def ιTensorObj (i₁ i₂ i₁₂ : I) (h : i₁ + i₂ = i₁₂) :
X₁ i₁ ⊗ X₂ i₂ ⟶ (X₁ ⊗ X₂) i₁₂ :=
Monoidal.ιTensorObj X₁ X₂ i₁ i₂ i₁₂ h
variable {X₁ X₂ Y₁ Y₂}
@[reassoc (attr := simp)]
lemma ι_tensorHom (f : X₁ ⟶ X₂) (g : Y₁ ⟶ Y₂) (i₁ i₂ i₁₂ : I) (h : i₁ + i₂ = i₁₂) :
ιTensorObj X₁ Y₁ i₁ i₂ i₁₂ h ≫ tensorHom f g i₁₂ =
(f i₁ ⊗ g i₂) ≫ ιTensorObj X₂ Y₂ i₁ i₂ i₁₂ h := by
apply Monoidal.ι_tensorHom
variable (X₁ X₂)
@[simp]
abbrev cofanTensorFun (j : I) : { i : I × I | i.1 + i.2 = j } → C :=
fun ⟨⟨i₁, i₂⟩, _⟩ => X₁ i₁ ⊗ X₂ i₂
@[simp]
noncomputable def cofanTensor (j : I) : Cofan (cofanTensorFun X₁ X₂ j) :=
Cofan.mk ((X₁ ⊗ X₂) j) (fun ⟨⟨i₁, i₂⟩, hi⟩ => ιTensorObj X₁ X₂ i₁ i₂ j hi)
noncomputable def isColimitCofanTensor (j : I) : IsColimit (cofanTensor X₁ X₂ j) := by
apply isColimitCofanMapObj
variable {X₁ X₂}
noncomputable def descTensor {j : I} (f : ∀ (i₁ i₂ : I) (_ : i₁ + i₂ = j), X₁ i₁ ⊗ X₂ i₂ ⟶ A) :
(X₁ ⊗ X₂) j ⟶ A :=
Cofan.IsColimit.desc (isColimitCofanTensor X₁ X₂ j) (fun ⟨⟨i₁, i₂⟩, hi⟩ => f i₁ i₂ hi)
@[reassoc (attr := simp)]
lemma ι_descTensor (j : I) (f : ∀ (i₁ i₂ : I) (_ : i₁ + i₂ = j), X₁ i₁ ⊗ X₂ i₂ ⟶ A)
(i₁ i₂ : I) (hi : i₁ + i₂ = j) :
ιTensorObj X₁ X₂ i₁ i₂ j hi ≫ descTensor f = f i₁ i₂ hi := by
apply Cofan.IsColimit.fac
@[ext]
lemma tensorObj_ext {j : I} (f g : (X₁ ⊗ X₂) j ⟶ A)
(h : ∀ (i₁ i₂ : I) (hi : i₁ + i₂ = j),
ιTensorObj X₁ X₂ i₁ i₂ j hi ≫ f = ιTensorObj X₁ X₂ i₁ i₂ j hi ≫ g) : f = g :=
Monoidal.tensorObj_ext f g h-/
end
section
instance (n : ℕ) : Finite ((fun (i : ℕ × ℕ) => i.1 + i.2) ⁻¹' {n}) := by
refine Finite.of_injective (fun ⟨⟨i₁, i₂⟩, (hi : i₁ + i₂ = n)⟩ =>
((⟨i₁, by linarith⟩, ⟨i₂, by linarith⟩) : Fin (n + 1) × Fin (n + 1) )) ?_
rintro ⟨⟨i₁, i₂⟩, (hi : i₁ + i₂ = n)⟩ ⟨⟨j₁, j₂⟩, (hj : j₁ + j₂ = n)⟩ h
simpa using h
instance (n : ℕ) : Finite ({ i : (ℕ × ℕ × ℕ) | i.1 + i.2.1 + i.2.2 = n }) := by
refine Finite.of_injective (fun ⟨⟨i₁, i₂, i₃⟩, (hi : i₁ + i₂ + i₃ = n)⟩ =>
(⟨⟨i₁, by linarith⟩, ⟨i₂, by linarith⟩, ⟨i₃, by linarith⟩⟩ :
Fin (n + 1) × Fin (n + 1) × Fin (n + 1))) ?_
rintro ⟨⟨i₁, i₂, i₃⟩, hi : i₁ + i₂ + i₃ = n⟩ ⟨⟨j₁, j₂, j₃⟩, hj : j₁ + j₂ + j₃ = n⟩ h
simpa using h
noncomputable example [HasFiniteCoproducts C]
[∀ (X : C), PreservesFiniteCoproducts ((curriedTensor C).obj X)]
[∀ (X : C), PreservesFiniteCoproducts ((curriedTensor C).flip.obj X)] :
MonoidalCategory (GradedObject ℕ C) := inferInstance
end
end GradedObject
end CategoryTheory