Skip to content

Commit 631f0c1

Browse files
committed
feat: dualize Pseudofunctor.CoGrothendieck results to Pseudofunctor.Grothendieck (#30071)
Continuing from #29681, dualize all definitions and lemmas in the namespace `Pseudofunctor.CoGrothendieck` to results in the namespace `Pseudofunctor.Grothendieck`. - [x] depends on: #29681 Co-authored-by: jlh18 <josephhua73@yahoo.com>
1 parent 2a03d8a commit 631f0c1

File tree

1 file changed

+118
-10
lines changed

1 file changed

+118
-10
lines changed

Mathlib/CategoryTheory/Bicategory/Grothendieck.lean

Lines changed: 118 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/-
22
Copyright (c) 2024 Calle Sönne. All rights reserved.
33
Released under Apache 2.0 license as described in the file LICENSE.
4-
Authors: Calle Sönne
4+
Authors: Calle Sönne, Joseph Hua
55
-/
66
module
77

@@ -27,14 +27,14 @@ given by projecting to the first factors, i.e.
2727
2828
## The CoGrothendieck construction
2929
30-
Given a category `𝒮` and any pseudofunctor `F` from `𝒮ᵒᵖ` to `Cat`, we associate to it a category
31-
`∫ᶜ F` (TODO: promote `CategoryStruct` to `Category` instance), defined as follows:
30+
Given a category `𝒮` and any pseudofunctor `F` from `𝒮ᵒᵖ` to `Cat`,
31+
we associate to it a category `∫ᶜ F`, defined as follows:
3232
* Objects: pairs `(S, a)` where `S` is an object of the base category and `a` is an object of the
3333
category `F(S)`.
3434
* Morphisms: morphisms `(R, b) ⟶ (S, a)` are defined as pairs `(f, h)` where `f : R ⟶ S` is a
3535
morphism in `𝒮` and `h : b ⟶ F(f)(a)`
3636
37-
The category `∫ᶜ F` is equipped with a functor `∫ᶜ F ⥤ 𝒮` (TODO: define this functor),
37+
The category `∫ᶜ F` is equipped with a functor `∫ᶜ F ⥤ 𝒮`,
3838
given by projecting to the first factors, i.e.
3939
* On objects, it sends `(S, a)` to `S`
4040
* On morphisms, it sends `(f, h)` to `f`
@@ -52,7 +52,6 @@ This is consistent with the convention for the Grothendieck construction on 1-fu
5252
pseudofunctor from `LocallyDiscrete 𝒮 ⥤ᵖ Catᵒᵖ` to `Cat`.
5353
2. Deduce the results in `CategoryTheory.Grothendieck` as a specialization of
5454
`Pseudofunctor.Grothendieck`.
55-
3. Dualize all `CoGrothendieck` results to `Grothendieck`.
5655
5756
## References
5857
[Vistoli2008] "Notes on Grothendieck Topologies, Fibered Categories and Descent Theory" by
@@ -109,6 +108,115 @@ instance categoryStruct : CategoryStruct (∫ F) where
109108
instance (X : ∫ F) : Inhabited (Hom X X) :=
110109
⟨𝟙 X⟩
111110

111+
section
112+
113+
variable {a b : ∫ F}
114+
115+
@[ext (iff := false)]
116+
lemma Hom.ext (f g : a ⟶ b) (hfg₁ : f.base = g.base)
117+
(hfg₂ : eqToHom (hfg₁ ▸ rfl) ≫ f.fiber = g.fiber) : f = g := by
118+
cases f; cases g
119+
dsimp at hfg₁ hfg₂
120+
cat_disch
121+
122+
lemma Hom.ext_iff (f g : a ⟶ b) :
123+
f = g ↔ ∃ (hfg : f.base = g.base), eqToHom (hfg ▸ rfl) ≫ f.fiber = g.fiber where
124+
mp hfg := by subst hfg; simp
125+
mpr := fun ⟨hfg₁, hfg₂⟩ => Hom.ext f g hfg₁ hfg₂
126+
127+
lemma Hom.congr {a b : ∫ F} {f g : a ⟶ b} (h : f = g) :
128+
f.fiber = eqToHom (h ▸ rfl) ≫ g.fiber := by
129+
subst h
130+
simp
131+
132+
end
133+
134+
attribute [local simp] PrelaxFunctor.map₂_eqToHom in
135+
/-- The category structure on `∫ F`. -/
136+
instance category : Category (∫ F) where
137+
toCategoryStruct := Pseudofunctor.Grothendieck.categoryStruct
138+
id_comp {a b} f := by
139+
ext
140+
· simp
141+
· simp [F.mapComp_id_left_hom_app, Strict.leftUnitor_eqToIso, ← Functor.map_comp_assoc]
142+
comp_id {a b} f := by
143+
ext
144+
· simp
145+
· simp [F.mapComp_id_right_hom_app, Strict.rightUnitor_eqToIso]
146+
assoc f g h := by
147+
ext
148+
· simp
149+
· simp [mapComp_assoc_right_hom_app_assoc, Strict.associator_eqToIso]
150+
151+
variable (F)
152+
153+
/-- The projection `∫ F ⥤ 𝒮` given by projecting both objects and homs to the first factor. -/
154+
@[simps]
155+
def forget (F : Pseudofunctor (LocallyDiscrete 𝒮) Cat.{v₂, u₂}) : ∫ F ⥤ 𝒮 where
156+
obj X := X.base
157+
map f := f.base
158+
159+
section
160+
161+
attribute [local simp]
162+
Strict.leftUnitor_eqToIso Strict.rightUnitor_eqToIso Strict.associator_eqToIso
163+
164+
variable {F} {G : Pseudofunctor (LocallyDiscrete 𝒮) Cat.{v₂, u₂}}
165+
{H : Pseudofunctor (LocallyDiscrete 𝒮) Cat.{v₂, u₂}}
166+
167+
/-- The Grothendieck construction is functorial: a strong natural transformation `α : F ⟶ G`
168+
induces a functor `Grothendieck.map : ∫ F ⥤ ∫ G`. -/
169+
@[simps!]
170+
def map (α : F ⟶ G) : ∫ F ⥤ ∫ G where
171+
obj a := {
172+
base := a.base
173+
fiber := (α.app ⟨a.base⟩).obj a.fiber }
174+
map {a b} f := {
175+
base := f.1
176+
fiber := (α.naturality f.1.toLoc).inv.app a.fiber ≫ (α.app ⟨b.base⟩).map f.2 }
177+
map_id a := by
178+
ext
179+
· dsimp
180+
· simp [StrongTrans.naturality_id_inv_app, ← map_comp]
181+
map_comp {a b c} f g := by
182+
ext
183+
· dsimp
184+
· dsimp
185+
simp only [map_comp, assoc, ← Cat.comp_map, NatTrans.naturality_assoc]
186+
simp [naturality_comp_inv_app, ← map_comp]
187+
188+
@[simp]
189+
lemma map_id_map {x y : ∫ F} (f : x ⟶ y) : (map (𝟙 F)).map f = f := by
190+
ext <;> simp
191+
192+
@[simp]
193+
theorem map_comp_forget (α : F ⟶ G) : map α ⋙ forget G = forget F := rfl
194+
195+
section
196+
197+
variable (F)
198+
199+
/-- The natural isomorphism witnessing the pseudo-unity constraint of `Grothendieck.map`. -/
200+
def mapIdIso : map (𝟙 F) ≅ 𝟭 (∫ F) :=
201+
NatIso.ofComponents (fun _ ↦ eqToIso (by cat_disch))
202+
203+
lemma map_id_eq : map (𝟙 F) = 𝟭 (∫ F) :=
204+
Functor.ext_of_iso (mapIdIso F) (fun x ↦ by simp [map]) (fun x ↦ by simp [mapIdIso])
205+
206+
end
207+
208+
/-- The natural isomorphism witnessing the pseudo-functoriality of `Grothendieck.map`. -/
209+
def mapCompIso (α : F ⟶ G) (β : G ⟶ H) : map (α ≫ β) ≅ map α ⋙ map β :=
210+
NatIso.ofComponents (fun _ ↦ eqToIso (by cat_disch)) (fun f ↦ by
211+
dsimp
212+
simp only [comp_id, id_comp]
213+
ext <;> simp)
214+
215+
lemma map_comp_eq (α : F ⟶ G) (β : G ⟶ H) : map (α ≫ β) = map α ⋙ map β :=
216+
Functor.ext_of_iso (mapCompIso α β) (fun _ ↦ by simp [map]) (fun _ ↦ by simp [mapCompIso])
217+
218+
end
219+
112220
end Grothendieck
113221

114222
/-- The type of objects in the fibered category associated to a contravariant
@@ -147,6 +255,9 @@ instance categoryStruct : CategoryStruct (∫ᶜ F) where
147255
fiber := f.fiber ≫ (F.map f.base.op.toLoc).map g.fiber ≫
148256
(F.mapComp g.base.op.toLoc f.base.op.toLoc).inv.app Z.fiber }
149257

258+
instance (X : ∫ᶜ F) : Inhabited (Hom X X) :=
259+
⟨𝟙 X⟩
260+
150261
section
151262

152263
variable {a b : ∫ᶜ F}
@@ -155,10 +266,8 @@ variable {a b : ∫ᶜ F}
155266
lemma Hom.ext (f g : a ⟶ b) (hfg₁ : f.base = g.base)
156267
(hfg₂ : f.fiber = g.fiber ≫ eqToHom (hfg₁ ▸ rfl)) : f = g := by
157268
cases f; cases g
158-
congr
159269
dsimp at hfg₁
160-
rw [← conj_eqToHom_iff_heq _ _ rfl (hfg₁ ▸ rfl)]
161-
simpa only [eqToHom_refl, id_comp] using hfg₂
270+
cat_disch
162271

163272
lemma Hom.ext_iff (f g : a ⟶ b) :
164273
f = g ↔ ∃ (hfg : f.base = g.base), f.fiber = g.fiber ≫ eqToHom (hfg ▸ rfl) where
@@ -190,8 +299,7 @@ instance category : Category (∫ᶜ F) where
190299

191300
variable (F)
192301

193-
/-- The projection `∫ᶜ F ⥤ 𝒮` given by projecting both objects and homs to the first
194-
factor. -/
302+
/-- The projection `∫ᶜ F ⥤ 𝒮` given by projecting both objects and homs to the first factor. -/
195303
@[simps]
196304
def forget (F : LocallyDiscrete 𝒮ᵒᵖ ⥤ᵖ Cat.{v₂, u₂}) : ∫ᶜ F ⥤ 𝒮 where
197305
obj X := X.base

0 commit comments

Comments
 (0)