forked from leanprover-community/mathlib4
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMonoidal.lean
More file actions
247 lines (203 loc) · 9.13 KB
/
Copy pathMonoidal.lean
File metadata and controls
247 lines (203 loc) · 9.13 KB
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
/-
Copyright (c) 2024 Dagur Asgeirsson. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Dagur Asgeirsson, Jack McKoen, Joël Riou
-/
module
public import Mathlib.Algebra.Category.ModuleCat.Presheaf.Colimits
public import Mathlib.Algebra.Category.ModuleCat.Monoidal.Closed
/-!
# The monoidal category structure on presheaves of modules
Given a presheaf of commutative rings `R : Cᵒᵖ ⥤ CommRingCat`, we construct
the monoidal category structure on the category of presheaves of modules
`PresheafOfModules (R ⋙ forget₂ _ _)`. The tensor product `M₁ ⊗ M₂` is defined
as the presheaf of modules which sends `X : Cᵒᵖ` to `M₁.obj X ⊗ M₂.obj X`.
## Notes
This contribution was created as part of the AIM workshop
"Formalizing algebraic geometry" in June 2024.
-/
@[expose] public section
open CategoryTheory MonoidalCategory BraidedCategory Category Limits
universe v u v₁ u₁
variable {C : Type*} [Category* C] {R : Cᵒᵖ ⥤ CommRingCat.{u}}
instance (X : Cᵒᵖ) : CommRing ((R ⋙ forget₂ _ RingCat).obj X) :=
inferInstanceAs (CommRing (R.obj X))
namespace PresheafOfModules
namespace Monoidal
variable (M₁ M₂ M₃ M₄ : PresheafOfModules.{u} (R ⋙ forget₂ _ _))
set_option backward.isDefEq.respectTransparency false in
/-- Auxiliary definition for `tensorObj`. -/
noncomputable def tensorObjMap {X Y : Cᵒᵖ} (f : X ⟶ Y) : M₁.obj X ⊗ M₂.obj X ⟶
(ModuleCat.restrictScalars (R.map f).hom).obj (M₁.obj Y ⊗ M₂.obj Y) :=
ModuleCat.MonoidalCategory.tensorLift (fun m₁ m₂ ↦ M₁.map f m₁ ⊗ₜ M₂.map f m₂)
(by
intro m₁ m₁' m₂
dsimp +instances
rw [map_add, TensorProduct.add_tmul])
(by intro a m₁ m₂; dsimp; erw [M₁.map_smul]; rfl)
(by
intro m₁ m₂ m₂'
dsimp +instances
rw [map_add, TensorProduct.tmul_add])
(by intro a m₁ m₂; dsimp; erw [M₂.map_smul, TensorProduct.tmul_smul (r := R.map f a)]; rfl)
set_option backward.isDefEq.respectTransparency false in
/-- The tensor product of two presheaves of modules. -/
@[simps obj]
noncomputable def tensorObj : PresheafOfModules (R ⋙ forget₂ _ _) where
obj X := M₁.obj X ⊗ M₂.obj X
map f := tensorObjMap M₁ M₂ f
map_id X := ModuleCat.MonoidalCategory.tensor_ext (by
intro m₁ m₂
dsimp [tensorObjMap]
simp
rfl) -- `ModuleCat.restrictScalarsId'App_inv_apply` doesn't get picked up due to type mismatch
map_comp f g := ModuleCat.MonoidalCategory.tensor_ext (by
intro m₁ m₂
dsimp [tensorObjMap]
simp +instances)
variable {M₁ M₂ M₃ M₄}
set_option backward.isDefEq.respectTransparency false in
@[simp]
lemma tensorObj_map_tmul {X Y : Cᵒᵖ} (f : X ⟶ Y) (m₁ : M₁.obj X) (m₂ : M₂.obj X) :
DFunLike.coe (α := (M₁.obj X ⊗ M₂.obj X :))
(β := fun _ ↦ (ModuleCat.restrictScalars (R.map f).hom).obj (M₁.obj Y ⊗ M₂.obj Y))
(ModuleCat.Hom.hom (R := ↑(R.obj X)) ((tensorObj M₁ M₂).map f)) (m₁ ⊗ₜ[R.obj X] m₂) =
M₁.map f m₁ ⊗ₜ[R.obj Y] M₂.map f m₂ := rfl
set_option backward.isDefEq.respectTransparency false in
/-- The tensor product of two morphisms of presheaves of modules. -/
@[simps]
noncomputable def tensorHom (f : M₁ ⟶ M₂) (g : M₃ ⟶ M₄) : tensorObj M₁ M₃ ⟶ tensorObj M₂ M₄ where
app X := f.app X ⊗ₘ g.app X
naturality {X Y} φ := ModuleCat.MonoidalCategory.tensor_ext (fun m₁ m₃ ↦ by
dsimp
rw [tensorObj_map_tmul]
-- Need `erw` because of the type mismatch in `map` and the tensor product.
erw [ModuleCat.MonoidalCategory.tensorHom_tmul, tensorObj_map_tmul]
rw [naturality_apply, naturality_apply]
simp)
end Monoidal
open Monoidal
set_option backward.isDefEq.respectTransparency false in
open ModuleCat.MonoidalCategory in
noncomputable instance monoidalCategoryStruct :
MonoidalCategoryStruct (PresheafOfModules.{u} (R ⋙ forget₂ _ _)) where
tensorObj := tensorObj
whiskerLeft _ _ _ g := tensorHom (𝟙 _) g
whiskerRight f _ := tensorHom f (𝟙 _)
tensorHom := tensorHom
tensorUnit := unit _
associator M₁ M₂ M₃ := isoMk (fun _ ↦ α_ _ _ _)
(fun _ _ _ ↦ ModuleCat.MonoidalCategory.tensor_ext₃' (by intros; rfl))
leftUnitor M := Iso.symm (isoMk (fun _ ↦ (λ_ _).symm) (fun X Y f ↦ by
ext m
dsimp [CommRingCat.forgetToRingCat_obj]
erw [leftUnitor_inv_apply, leftUnitor_inv_apply, tensorObj_map_tmul, (R.map f).hom.map_one]
rfl))
rightUnitor M := Iso.symm (isoMk (fun _ ↦ (ρ_ _).symm) (fun X Y f ↦ by
ext m
dsimp [CommRingCat.forgetToRingCat_obj]
erw [rightUnitor_inv_apply, rightUnitor_inv_apply, tensorObj_map_tmul, (R.map f).hom.map_one]
rfl))
set_option backward.isDefEq.respectTransparency false in
noncomputable instance monoidalCategory :
MonoidalCategory (PresheafOfModules.{u} (R ⋙ forget₂ _ _)) where
tensorHom_def _ _ := by ext1; apply tensorHom_def
id_tensorHom_id _ _ := by ext1; apply id_tensorHom_id
tensorHom_comp_tensorHom _ _ _ _ := by ext1; apply tensorHom_comp_tensorHom
whiskerLeft_id M₁ M₂ := by
ext1 X
apply MonoidalCategory.whiskerLeft_id (C := ModuleCat (R.obj X))
id_whiskerRight _ _ := by
ext1 X
apply MonoidalCategory.id_whiskerRight (C := ModuleCat (R.obj X))
associator_naturality _ _ _ := by ext1; apply associator_naturality
leftUnitor_naturality _ := by ext1; apply leftUnitor_naturality
rightUnitor_naturality _ := by ext1; apply rightUnitor_naturality
pentagon _ _ _ _ := by ext1; apply pentagon
triangle _ _ := by ext1; apply triangle
open BraidedCategory
noncomputable instance symmetricCategory :
SymmetricCategory (PresheafOfModules.{u} (R ⋙ forget₂ _ _)) where
braiding M₁ M₂ :=
isoMk (fun X ↦ braiding (C := ModuleCat (R.obj X)) (M₁.obj X) (M₂.obj X))
(fun _ _ f ↦ ModuleCat.MonoidalCategory.tensor_ext (fun _ _ ↦ rfl))
braiding_naturality_right _ _ _ _ := by
ext : 1
exact ModuleCat.MonoidalCategory.tensor_ext (fun _ _ ↦ rfl)
braiding_naturality_left _ _ := by
ext : 1
exact ModuleCat.MonoidalCategory.tensor_ext (fun _ _ ↦ rfl)
hexagon_forward _ _ _ := by
ext : 1
apply hexagon_forward (C := ModuleCat (R.obj _))
hexagon_reverse _ _ _ := by
ext : 1
apply hexagon_reverse (C := ModuleCat (R.obj _))
symmetry _ _ := by
ext : 1
apply SymmetricCategory.symmetry (C := ModuleCat (R.obj _))
section
variable (M₁ M₂ M₃ M₄ : PresheafOfModules.{u} (R ⋙ forget₂ _ _))
lemma tensorObj_obj (X : Cᵒᵖ) :
(M₁ ⊗ M₂).obj X =
MonoidalCategory.tensorObj (C := ModuleCat (R.obj X)) (M₁.obj X) (M₂.obj X) := rfl
attribute [local simp] tensorObj_obj
variable {M₂ M₃} in
@[simp]
lemma whiskerLeft_app (f : M₂ ⟶ M₃) (X : Cᵒᵖ) :
dsimp% (M₁ ◁ f).app X = whiskerLeft (C := ModuleCat (R.obj X)) (M₁.obj X) (f.app X) :=
rfl
variable {M₁ M₂} in
@[simp]
lemma whiskerRight_app (f : M₁ ⟶ M₂) (M₃ : PresheafOfModules.{u} (R ⋙ forget₂ _ _)) (X : Cᵒᵖ) :
dsimp% (f ▷ M₃).app X = whiskerRight (C := ModuleCat (R.obj X)) (f.app X) (M₃.obj X) := rfl
variable {M₁ M₂ M₃ M₄} in
@[simp]
lemma tensorHom_app (f : M₁ ⟶ M₂) (g : M₃ ⟶ M₄) (X : Cᵒᵖ) :
dsimp% (f ⊗ₘ g).app X =
MonoidalCategory.tensorHom (C := ModuleCat (R.obj X)) (f.app X) (g.app X) := rfl
@[simp]
lemma leftUnitor_hom_app (X : Cᵒᵖ) :
dsimp% (λ_ M₁).hom.app X = (leftUnitor (C := ModuleCat (R.obj X)) (M₁.obj X)).hom :=
rfl
@[simp]
lemma leftUnitor_inv_app (X : Cᵒᵖ) :
dsimp% (λ_ M₁).inv.app X = (leftUnitor (C := ModuleCat (R.obj X)) (M₁.obj X)).inv := by
rfl
@[simp]
lemma rightUnitor_hom_app (X : Cᵒᵖ) :
dsimp% (ρ_ M₁).hom.app X = (rightUnitor (C := ModuleCat (R.obj X)) (M₁.obj X)).hom :=
rfl
@[simp]
lemma rightUnitor_inv_app (X : Cᵒᵖ) :
dsimp% (ρ_ M₁).inv.app X = (rightUnitor (C := ModuleCat (R.obj X)) (M₁.obj X)).inv :=
rfl
@[simp]
lemma associator_hom_app (X : Cᵒᵖ) :
(α_ M₁ M₂ M₃).hom.app X =
(associator (C := ModuleCat (R.obj X)) (M₁.obj X) (M₂.obj X) (M₃.obj X)).hom :=
rfl
@[simp]
lemma associator_inv_app (X : Cᵒᵖ) :
(α_ M₁ M₂ M₃).inv.app X =
(associator (C := ModuleCat (R.obj X)) (M₁.obj X) (M₂.obj X) (M₃.obj X)).inv :=
rfl
@[simp]
lemma braiding_hom_app (X : Cᵒᵖ) :
dsimp% (braiding M₁ M₂).hom.app X =
(braiding (C := ModuleCat (R.obj X)) (M₁.obj X) (M₂.obj X)).hom := by
rfl
@[simp]
lemma braiding_inv_app (X : Cᵒᵖ) :
dsimp% (braiding M₁ M₂).inv.app X =
(braiding (C := ModuleCat (R.obj X)) (M₁.obj X) (M₂.obj X)).inv := rfl
end
instance (F : PresheafOfModules.{u} (R ⋙ forget₂ _ _)) :
PreservesColimitsOfSize.{u, u} (tensorLeft F) where
preservesColimitsOfShape := ⟨⟨fun hc ↦ ⟨evaluationJointlyReflectsColimits _ _
(fun X ↦ isColimitOfPreserves (tensorLeft (show ModuleCat (R.obj X) from F.obj X))
(isColimitOfPreserves (evaluation _ X) hc))⟩⟩⟩
instance (F : PresheafOfModules.{u} (R ⋙ forget₂ _ _)) :
PreservesColimitsOfSize.{u, u} (tensorRight F) :=
preservesColimits_of_natIso (tensorLeftIsoTensorRight F)
end PresheafOfModules