forked from leanprover-community/mathlib4
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPredicate.lean
More file actions
547 lines (438 loc) · 22.8 KB
/
Copy pathPredicate.lean
File metadata and controls
547 lines (438 loc) · 22.8 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
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
/-
Copyright (c) 2022 Joël Riou. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Joël Riou
-/
module
public import Mathlib.CategoryTheory.Localization.Construction
/-!
# Predicate for localized categories
In this file, a predicate `L.IsLocalization W` is introduced for a functor `L : C ⥤ D`
and `W : MorphismProperty C`: it expresses that `L` identifies `D` with the localized
category of `C` with respect to `W` (up to equivalence).
We introduce a universal property `StrictUniversalPropertyFixedTarget L W E` which
states that `L` inverts the morphisms in `W` and that all functors `C ⥤ E` inverting
`W` uniquely factor as a composition of `L ⋙ G` with `G : D ⥤ E`. Such universal
properties are inputs for the constructor `IsLocalization.mk'` for `L.IsLocalization W`.
When `L : C ⥤ D` is a localization functor for `W : MorphismProperty` (i.e. when
`[L.IsLocalization W]` holds), for any category `E`, there is
an equivalence `FunctorEquivalence L W E : (D ⥤ E) ≌ (W.FunctorsInverting E)`
that is induced by the composition with the functor `L`. When two functors
`F : C ⥤ E` and `F' : D ⥤ E` correspond via this equivalence, we shall say
that `F'` lifts `F`, and the associated isomorphism `L ⋙ F' ≅ F` is the
datum that is part of the class `Lifting L W F F'`. The functions
`liftNatTrans` and `liftNatIso` can be used to lift natural transformations
and natural isomorphisms between functors.
-/
@[expose] public section
noncomputable section
namespace CategoryTheory
open Category Functor
variable {C D : Type*} [Category* C] [Category* D] (L : C ⥤ D) (W : MorphismProperty C) (E : Type*)
[Category* E]
namespace Functor
/-- The predicate expressing that, up to equivalence, a functor `L : C ⥤ D`
identifies the category `D` with the localized category of `C` with respect
to `W : MorphismProperty C`. -/
class IsLocalization : Prop where
/-- the functor inverts the given `MorphismProperty` -/
inverts : W.IsInvertedBy L
/-- the induced functor from the constructed localized category is an equivalence -/
isEquivalence : IsEquivalence (Localization.Construction.lift L inverts)
instance q_isLocalization : W.Q.IsLocalization W where
inverts := W.Q_inverts
isEquivalence := by
suffices Localization.Construction.lift W.Q W.Q_inverts = 𝟭 _ by
rw [this]
infer_instance
apply Localization.Construction.uniq
simp only [Localization.Construction.fac]
rfl
end Functor
namespace Localization
/-- This universal property states that a functor `L : C ⥤ D` inverts morphisms
in `W` and that all functors `D ⥤ E` (for a fixed category `E`) uniquely factor
through `L`. -/
structure StrictUniversalPropertyFixedTarget where
/-- the functor `L` inverts `W` -/
inverts : W.IsInvertedBy L
/-- any functor `C ⥤ E` which inverts `W` can be lifted as a functor `D ⥤ E` -/
lift : ∀ (F : C ⥤ E) (_ : W.IsInvertedBy F), D ⥤ E
/-- there is a factorisation involving the lifted functor -/
fac : ∀ (F : C ⥤ E) (hF : W.IsInvertedBy F), L ⋙ lift F hF = F
/-- uniqueness of the lifted functor -/
uniq : ∀ (F₁ F₂ : D ⥤ E) (_ : L ⋙ F₁ = L ⋙ F₂), F₁ = F₂
/-- The localized category `W.Localization` that was constructed satisfies
the universal property of the localization. -/
@[simps]
def strictUniversalPropertyFixedTargetQ : StrictUniversalPropertyFixedTarget W.Q W E where
inverts := W.Q_inverts
lift := Construction.lift
fac := Construction.fac
uniq := Construction.uniq
instance : Inhabited (StrictUniversalPropertyFixedTarget W.Q W E) :=
⟨strictUniversalPropertyFixedTargetQ _ _⟩
/-- When `W` consists of isomorphisms, the identity satisfies the universal property
of the localization. -/
@[simps]
def strictUniversalPropertyFixedTargetId (hW : W ≤ MorphismProperty.isomorphisms C) :
StrictUniversalPropertyFixedTarget (𝟭 C) W E where
inverts _ _ f hf := hW f hf
lift F _ := F
fac F hF := by
cases F
rfl
uniq F₁ F₂ eq := by
cases F₁
cases F₂
exact eq
end Localization
namespace Functor
theorem IsLocalization.mk' (h₁ : Localization.StrictUniversalPropertyFixedTarget L W D)
(h₂ : Localization.StrictUniversalPropertyFixedTarget L W W.Localization) :
IsLocalization L W :=
{ inverts := h₁.inverts
isEquivalence := IsEquivalence.mk' (h₂.lift W.Q W.Q_inverts)
(eqToIso (Localization.Construction.uniq _ _ (by
simp only [← Functor.assoc, Localization.Construction.fac, h₂.fac, Functor.comp_id])))
(eqToIso (h₁.uniq _ _ (by
simp only [← Functor.assoc, h₂.fac, Localization.Construction.fac, Functor.comp_id]))) }
theorem IsLocalization.for_id (hW : W ≤ MorphismProperty.isomorphisms C) : (𝟭 C).IsLocalization W :=
IsLocalization.mk' _ _ (Localization.strictUniversalPropertyFixedTargetId W _ hW)
(Localization.strictUniversalPropertyFixedTargetId W _ hW)
end Functor
namespace Localization
variable [L.IsLocalization W]
theorem inverts : W.IsInvertedBy L :=
(inferInstance : L.IsLocalization W).inverts
/-- The isomorphism `L.obj X ≅ L.obj Y` that is deduced from a morphism `f : X ⟶ Y` which
belongs to `W`, when `L.IsLocalization W`. -/
@[simps! hom]
def isoOfHom {X Y : C} (f : X ⟶ Y) (hf : W f) : L.obj X ≅ L.obj Y :=
haveI : IsIso (L.map f) := inverts L W f hf
asIso (L.map f)
@[reassoc (attr := simp)]
lemma isoOfHom_hom_inv_id {X Y : C} (f : X ⟶ Y) (hf : W f) :
L.map f ≫ (isoOfHom L W f hf).inv = 𝟙 _ :=
(isoOfHom L W f hf).hom_inv_id
@[reassoc (attr := simp)]
lemma isoOfHom_inv_hom_id {X Y : C} (f : X ⟶ Y) (hf : W f) :
(isoOfHom L W f hf).inv ≫ L.map f = 𝟙 _ :=
(isoOfHom L W f hf).inv_hom_id
@[simp]
lemma isoOfHom_id_inv (X : C) (hX : W (𝟙 X)) :
(isoOfHom L W (𝟙 X) hX).inv = 𝟙 _ := by
rw [← cancel_mono (isoOfHom L W (𝟙 X) hX).hom, Iso.inv_hom_id, id_comp,
isoOfHom_hom, Functor.map_id]
variable {W}
lemma Construction.wIso_eq_isoOfHom {X Y : C} (f : X ⟶ Y) (hf : W f) :
Construction.wIso f hf = isoOfHom W.Q W f hf := by ext; rfl
lemma Construction.wInv_eq_isoOfHom_inv {X Y : C} (f : X ⟶ Y) (hf : W f) :
Construction.wInv f hf = (isoOfHom W.Q W f hf).inv :=
congr_arg Iso.inv (wIso_eq_isoOfHom f hf)
instance : (Localization.Construction.lift L (inverts L W)).IsEquivalence :=
(inferInstance : L.IsLocalization W).isEquivalence
variable (W)
/-- A chosen equivalence of categories `W.Localization ≅ D` for a functor
`L : C ⥤ D` which satisfies `L.IsLocalization W`. This shall be used in
order to deduce properties of `L` from properties of `W.Q`. -/
def equivalenceFromModel : W.Localization ≌ D :=
(Localization.Construction.lift L (inverts L W)).asEquivalence
/-- Via the equivalence of categories `equivalenceFromModel L W : W.Localization ≌ D`,
one may identify the functors `W.Q` and `L`. -/
def qCompEquivalenceFromModelFunctorIso : W.Q ⋙ (equivalenceFromModel L W).functor ≅ L :=
eqToIso (Construction.fac _ _)
/-- Via the equivalence of categories `equivalenceFromModel L W : W.Localization ≌ D`,
one may identify the functors `L` and `W.Q`. -/
def compEquivalenceFromModelInverseIso : L ⋙ (equivalenceFromModel L W).inverse ≅ W.Q :=
calc
L ⋙ (equivalenceFromModel L W).inverse ≅ _ :=
isoWhiskerRight (qCompEquivalenceFromModelFunctorIso L W).symm _
_ ≅ W.Q ⋙ (equivalenceFromModel L W).functor ⋙ (equivalenceFromModel L W).inverse :=
(associator _ _ _)
_ ≅ W.Q ⋙ 𝟭 _ := isoWhiskerLeft _ (equivalenceFromModel L W).unitIso.symm
_ ≅ W.Q := rightUnitor _
theorem essSurj (W) [L.IsLocalization W] : L.EssSurj :=
⟨fun X =>
⟨(Construction.objEquiv W).invFun ((equivalenceFromModel L W).inverse.obj X),
Nonempty.intro
((qCompEquivalenceFromModelFunctorIso L W).symm.app _ ≪≫
(equivalenceFromModel L W).counitIso.app X)⟩⟩
/-- The functor `(D ⥤ E) ⥤ W.functors_inverting E` induced by the composition
with a localization functor `L : C ⥤ D` with respect to `W : MorphismProperty C`. -/
def whiskeringLeftFunctor : (D ⥤ E) ⥤ W.FunctorsInverting E :=
ObjectProperty.lift _ ((whiskeringLeft _ _ E).obj L)
(MorphismProperty.IsInvertedBy.of_comp W L (inverts L W))
set_option backward.isDefEq.respectTransparency false in
instance : (whiskeringLeftFunctor L W E).IsEquivalence := by
let iso : (whiskeringLeft (MorphismProperty.Localization W) D E).obj
(equivalenceFromModel L W).functor ⋙
(Construction.whiskeringLeftEquivalence W E).functor ≅ whiskeringLeftFunctor L W E :=
NatIso.ofComponents (fun F => eqToIso (by
ext
change (W.Q ⋙ Localization.Construction.lift L (inverts L W)) ⋙ F = L ⋙ F
rw [Construction.fac])) (fun τ => by
ext
dsimp [Construction.whiskeringLeftEquivalence, equivalenceFromModel, whiskerLeft]
rw [ObjectProperty.eqToHom_hom, ObjectProperty.eqToHom_hom, eqToHom_app, eqToHom_app,
eqToHom_refl, eqToHom_refl]
dsimp
rw [comp_id, id_comp]
rfl)
exact Functor.isEquivalence_of_iso iso
/-- The equivalence of categories `(D ⥤ E) ≌ (W.FunctorsInverting E)` induced by
the composition with a localization functor `L : C ⥤ D` with respect to
`W : MorphismProperty C`. -/
def functorEquivalence : D ⥤ E ≌ W.FunctorsInverting E :=
(whiskeringLeftFunctor L W E).asEquivalence
set_option linter.overlappingInstances false in
/-- The functor `(D ⥤ E) ⥤ (C ⥤ E)` given by the composition with a localization
functor `L : C ⥤ D` with respect to `W : MorphismProperty C`. -/
@[nolint unusedArguments]
def whiskeringLeftFunctor' [L.IsLocalization W] (E : Type*) [Category* E] :
(D ⥤ E) ⥤ C ⥤ E :=
(whiskeringLeft C D E).obj L
theorem whiskeringLeftFunctor'_eq :
whiskeringLeftFunctor' L W E = Localization.whiskeringLeftFunctor L W E ⋙ inducedFunctor _ :=
rfl
variable {E} in
@[simp]
theorem whiskeringLeftFunctor'_obj (F : D ⥤ E) : (whiskeringLeftFunctor' L W E).obj F = L ⋙ F :=
rfl
instance : (whiskeringLeftFunctor' L W E).Full := by
rw [whiskeringLeftFunctor'_eq]
apply @Functor.Full.comp _ _ _ _ _ _ _ _ ?_ ?_
· infer_instance
apply InducedCategory.full -- why is it not found automatically ???
instance : (whiskeringLeftFunctor' L W E).Faithful := by
rw [whiskeringLeftFunctor'_eq]
apply @Functor.Faithful.comp _ _ _ _ _ _ _ _ ?_ ?_
· infer_instance
apply InducedCategory.faithful -- why is it not found automatically ???
lemma full_whiskeringLeft (L : C ⥤ D) (W) [L.IsLocalization W] (E : Type*) [Category* E] :
((whiskeringLeft C D E).obj L).Full :=
inferInstanceAs (whiskeringLeftFunctor' L W E).Full
lemma faithful_whiskeringLeft (L : C ⥤ D) (W) [L.IsLocalization W] (E : Type*) [Category* E] :
((whiskeringLeft C D E).obj L).Faithful :=
inferInstanceAs (whiskeringLeftFunctor' L W E).Faithful
/-- The precomposition with a localization functor gives fully faithful functors
between functor categories. -/
def fullyFaithfulWhiskeringLeft (L : C ⥤ D) (W) [L.IsLocalization W] (E : Type*) [Category* E] :
((whiskeringLeft C D E).obj L).FullyFaithful := by
have := full_whiskeringLeft L W E
have := faithful_whiskeringLeft L W E
exact FullyFaithful.ofFullyFaithful _
variable {E}
theorem natTrans_ext (L : C ⥤ D) (W) [L.IsLocalization W] {F₁ F₂ : D ⥤ E} {τ τ' : F₁ ⟶ F₂}
(h : ∀ X : C, τ.app (L.obj X) = τ'.app (L.obj X)) : τ = τ' := by
haveI := essSurj L W
ext Y
rw [← cancel_epi (F₁.map (L.objObjPreimageIso Y).hom), τ.naturality, τ'.naturality, h]
/-- When `L : C ⥤ D` is a localization functor for `W : MorphismProperty C` and
`F : C ⥤ E` is a functor, we shall say that `F' : D ⥤ E` lifts `F` if the obvious diagram
is commutative up to an isomorphism. -/
class Lifting (L : C ⥤ D) (W : MorphismProperty C) (F : C ⥤ E) (F' : D ⥤ E) where
/-- the isomorphism relating the localization functor and the two other given functors -/
iso (L W F F') : L ⋙ F' ≅ F
variable {W}
/-- Given a localization functor `L : C ⥤ D` for `W : MorphismProperty C` and
a functor `F : C ⥤ E` which inverts `W`, this is a choice of functor
`D ⥤ E` which lifts `F`. -/
def lift (F : C ⥤ E) (hF : W.IsInvertedBy F) (L : C ⥤ D) [L.IsLocalization W] : D ⥤ E :=
(functorEquivalence L W E).inverse.obj ⟨F, hF⟩
instance liftingLift (F : C ⥤ E) (hF : W.IsInvertedBy F) (L : C ⥤ D) [L.IsLocalization W] :
Lifting L W F (lift F hF L) :=
⟨(inducedFunctor _).mapIso ((functorEquivalence L W E).counitIso.app ⟨F, hF⟩)⟩
/-- The canonical isomorphism `L ⋙ lift F hF L ≅ F` for any functor `F : C ⥤ E`
which inverts `W`, when `L : C ⥤ D` is a localization functor for `W`. -/
def fac (F : C ⥤ E) (hF : W.IsInvertedBy F) (L : C ⥤ D) [L.IsLocalization W] :
L ⋙ lift F hF L ≅ F :=
Lifting.iso L W F _
instance liftingConstructionLift (F : C ⥤ D) (hF : W.IsInvertedBy F) :
Lifting W.Q W F (Construction.lift F hF) :=
⟨eqToIso (Construction.fac F hF)⟩
variable (W)
/-- Given a localization functor `L : C ⥤ D` for `W : MorphismProperty C`,
if `(F₁' F₂' : D ⥤ E)` are functors which lift functors `(F₁ F₂ : C ⥤ E)`,
a natural transformation `τ : F₁ ⟶ F₂` uniquely lifts to a natural transformation `F₁' ⟶ F₂'`. -/
def liftNatTrans (F₁ F₂ : C ⥤ E) (F₁' F₂' : D ⥤ E) [Lifting L W F₁ F₁'] [Lifting L W F₂ F₂']
(τ : F₁ ⟶ F₂) : F₁' ⟶ F₂' :=
(whiskeringLeftFunctor' L W E).preimage
((Lifting.iso L W F₁ F₁').hom ≫ τ ≫ (Lifting.iso L W F₂ F₂').inv)
@[simp]
theorem liftNatTrans_app (F₁ F₂ : C ⥤ E) (F₁' F₂' : D ⥤ E) [Lifting L W F₁ F₁'] [Lifting L W F₂ F₂']
(τ : F₁ ⟶ F₂) (X : C) :
(liftNatTrans L W F₁ F₂ F₁' F₂' τ).app (L.obj X) =
(Lifting.iso L W F₁ F₁').hom.app X ≫ τ.app X ≫ (Lifting.iso L W F₂ F₂').inv.app X :=
congr_app (Functor.map_preimage (whiskeringLeftFunctor' L W E) _) X
set_option backward.isDefEq.respectTransparency false in
@[reassoc (attr := simp)]
theorem comp_liftNatTrans (F₁ F₂ F₃ : C ⥤ E) (F₁' F₂' F₃' : D ⥤ E) [h₁ : Lifting L W F₁ F₁']
[h₂ : Lifting L W F₂ F₂'] [h₃ : Lifting L W F₃ F₃'] (τ : F₁ ⟶ F₂) (τ' : F₂ ⟶ F₃) :
liftNatTrans L W F₁ F₂ F₁' F₂' τ ≫ liftNatTrans L W F₂ F₃ F₂' F₃' τ' =
liftNatTrans L W F₁ F₃ F₁' F₃' (τ ≫ τ') :=
natTrans_ext L W fun X => by
simp only [NatTrans.comp_app, liftNatTrans_app, assoc, Iso.inv_hom_id_app_assoc]
@[simp]
theorem liftNatTrans_id (F : C ⥤ E) (F' : D ⥤ E) [h : Lifting L W F F'] :
liftNatTrans L W F F F' F' (𝟙 F) = 𝟙 F' :=
natTrans_ext L W fun X => by
simp only [liftNatTrans_app, NatTrans.id_app, id_comp, Iso.hom_inv_id_app]
rfl
/-- Given a localization functor `L : C ⥤ D` for `W : MorphismProperty C`,
if `(F₁' F₂' : D ⥤ E)` are functors which lift functors `(F₁ F₂ : C ⥤ E)`,
a natural isomorphism `τ : F₁ ⟶ F₂` lifts to a natural isomorphism `F₁' ⟶ F₂'`. -/
@[simps]
def liftNatIso (F₁ F₂ : C ⥤ E) (F₁' F₂' : D ⥤ E) [h₁ : Lifting L W F₁ F₁'] [h₂ : Lifting L W F₂ F₂']
(e : F₁ ≅ F₂) : F₁' ≅ F₂' where
hom := liftNatTrans L W F₁ F₂ F₁' F₂' e.hom
inv := liftNatTrans L W F₂ F₁ F₂' F₁' e.inv
namespace Lifting
@[simps]
instance compRight {E' : Type*} [Category* E'] (F : C ⥤ E) (F' : D ⥤ E) [Lifting L W F F']
(G : E ⥤ E') : Lifting L W (F ⋙ G) (F' ⋙ G) :=
⟨isoWhiskerRight (iso L W F F') G⟩
@[simps]
instance id : Lifting L W L (𝟭 D) :=
⟨rightUnitor L⟩
@[simps]
instance compLeft (F : D ⥤ E) : Localization.Lifting L W (L ⋙ F) F := ⟨Iso.refl _⟩
/-- Given a localization functor `L : C ⥤ D` for `W : MorphismProperty C`,
if `F₁' : D ⥤ E` lifts a functor `F₁ : C ⥤ D`, then a functor `F₂'` which
is isomorphic to `F₁'` also lifts a functor `F₂` that is isomorphic to `F₁`. -/
@[simps, implicit_reducible]
def ofIsos {F₁ F₂ : C ⥤ E} {F₁' F₂' : D ⥤ E} (e : F₁ ≅ F₂) (e' : F₁' ≅ F₂') [Lifting L W F₁ F₁'] :
Lifting L W F₂ F₂' :=
⟨isoWhiskerLeft L e'.symm ≪≫ iso L W F₁ F₁' ≪≫ e⟩
end Lifting
end Localization
namespace Functor
namespace IsLocalization
open Localization
theorem of_iso {L₁ L₂ : C ⥤ D} (e : L₁ ≅ L₂) [L₁.IsLocalization W] : L₂.IsLocalization W := by
have h := Localization.inverts L₁ W
rw [MorphismProperty.IsInvertedBy.iff_of_iso W e] at h
let F₁ := Localization.Construction.lift L₁ (Localization.inverts L₁ W)
let F₂ := Localization.Construction.lift L₂ h
exact
{ inverts := h
isEquivalence := Functor.isEquivalence_of_iso (liftNatIso W.Q W L₁ L₂ F₁ F₂ e) }
/-- If `L : C ⥤ D` is a localization for `W : MorphismProperty C`, then it is also
the case of a functor obtained by post-composing `L` with an equivalence of categories. -/
theorem of_equivalence_target {E : Type*} [Category* E] (L' : C ⥤ E) (eq : D ≌ E)
[L.IsLocalization W] (e : L ⋙ eq.functor ≅ L') : L'.IsLocalization W := by
have h : W.IsInvertedBy L' := by
rw [← MorphismProperty.IsInvertedBy.iff_of_iso W e]
exact MorphismProperty.IsInvertedBy.of_comp W L (Localization.inverts L W) eq.functor
let F₁ := Localization.Construction.lift L (Localization.inverts L W)
let F₂ := Localization.Construction.lift L' h
let e' : F₁ ⋙ eq.functor ≅ F₂ := liftNatIso W.Q W (L ⋙ eq.functor) L' _ _ e
exact
{ inverts := h
isEquivalence := Functor.isEquivalence_of_iso e' }
instance (F : D ⥤ E) [F.IsEquivalence] [L.IsLocalization W] :
(L ⋙ F).IsLocalization W :=
of_equivalence_target L W _ F.asEquivalence (Iso.refl _)
lemma of_isEquivalence (L : C ⥤ D) (W : MorphismProperty C)
(hW : W ≤ MorphismProperty.isomorphisms C) [IsEquivalence L] :
L.IsLocalization W := by
haveI : (𝟭 C).IsLocalization W := for_id W hW
exact of_equivalence_target (𝟭 C) W L L.asEquivalence L.leftUnitor
end IsLocalization
end Functor
namespace Localization
variable {D₁ D₂ : Type _} [Category* D₁] [Category* D₂] (L₁ : C ⥤ D₁) (L₂ : C ⥤ D₂)
(W' : MorphismProperty C) [L₁.IsLocalization W'] [L₂.IsLocalization W']
/-- If `L₁ : C ⥤ D₁` and `L₂ : C ⥤ D₂` are two localization functors for the
same `MorphismProperty C`, this is an equivalence of categories `D₁ ≌ D₂`. -/
def uniq : D₁ ≌ D₂ :=
(equivalenceFromModel L₁ W').symm.trans (equivalenceFromModel L₂ W')
lemma uniq_symm : (uniq L₁ L₂ W').symm = uniq L₂ L₁ W' := by
dsimp [uniq, Equivalence.trans]
ext <;> aesop
/-- The functor of equivalence of localized categories given by `Localization.uniq` is
compatible with the localization functors. -/
def compUniqFunctor : L₁ ⋙ (uniq L₁ L₂ W').functor ≅ L₂ :=
calc
L₁ ⋙ (uniq L₁ L₂ W').functor ≅ (L₁ ⋙ (equivalenceFromModel L₁ W').inverse) ⋙
(equivalenceFromModel L₂ W').functor := (associator _ _ _).symm
_ ≅ W'.Q ⋙ (equivalenceFromModel L₂ W').functor :=
isoWhiskerRight (compEquivalenceFromModelInverseIso L₁ W') _
_ ≅ L₂ := qCompEquivalenceFromModelFunctorIso L₂ W'
/-- The inverse functor of equivalence of localized categories given by `Localization.uniq` is
compatible with the localization functors. -/
def compUniqInverse : L₂ ⋙ (uniq L₁ L₂ W').inverse ≅ L₁ := compUniqFunctor L₂ L₁ W'
instance : Lifting L₁ W' L₂ (uniq L₁ L₂ W').functor := ⟨compUniqFunctor L₁ L₂ W'⟩
instance : Lifting L₂ W' L₁ (uniq L₁ L₂ W').inverse := ⟨compUniqInverse L₁ L₂ W'⟩
/-- If `L₁ : C ⥤ D₁` and `L₂ : C ⥤ D₂` are two localization functors for the
same `MorphismProperty C`, any functor `F : D₁ ⥤ D₂` equipped with an isomorphism
`L₁ ⋙ F ≅ L₂` is isomorphic to the functor of the equivalence given by `uniq`. -/
def isoUniqFunctor (F : D₁ ⥤ D₂) (e : L₁ ⋙ F ≅ L₂) :
F ≅ (uniq L₁ L₂ W').functor :=
letI : Lifting L₁ W' L₂ F := ⟨e⟩
liftNatIso L₁ W' L₂ L₂ F (uniq L₁ L₂ W').functor (Iso.refl L₂)
set_option backward.isDefEq.respectTransparency false in
lemma morphismProperty_eq_top [L.IsLocalization W] (P : MorphismProperty D) [P.RespectsIso]
[P.IsMultiplicative] (h₁ : ∀ ⦃X Y : C⦄ (f : X ⟶ Y), P (L.map f))
(h₂ : ∀ ⦃X Y : C⦄ (f : X ⟶ Y) (hf : W f), P (isoOfHom L W f hf).inv) :
P = ⊤ := by
let e := compUniqFunctor W.Q L W
have hP : P.inverseImage (uniq W.Q L W).functor = ⊤ :=
Construction.morphismProperty_eq_top _
(fun _ _ f ↦ (P.arrow_mk_iso_iff
(((Functor.mapArrowFunctor _ _).mapIso e).app (Arrow.mk f))).2 (h₁ f))
(fun X Y f hf ↦ by
refine (P.arrow_mk_iso_iff (Arrow.isoMk (e.app _) (e.app _) ?_)).2 (h₂ f hf)
dsimp
rw [Construction.wInv_eq_isoOfHom_inv, ← cancel_mono (isoOfHom L W f hf).hom,
assoc, assoc, Iso.inv_hom_id, comp_id, isoOfHom_hom, ← NatTrans.naturality,
Functor.comp_map, ← Functor.map_comp_assoc,
isoOfHom_inv_hom_id, map_id, id_comp])
rw [← P.map_inverseImage_eq_of_isEquivalence (uniq W.Q L W).functor, hP,
MorphismProperty.map_top_eq_top_of_essSurj_of_full]
lemma isGroupoid [L.IsLocalization ⊤] :
IsGroupoid D := by
rw [isGroupoid_iff_isomorphisms_eq_top]
exact morphismProperty_eq_top L ⊤ _
(fun _ _ f ↦ inverts L ⊤ _ (by simp))
(fun _ _ f hf ↦ Iso.isIso_inv _)
instance : IsGroupoid (⊤ : MorphismProperty C).Localization :=
isGroupoid <| MorphismProperty.Q ⊤
/-- Localization of a category with respect to all morphisms results in a groupoid. -/
@[instance_reducible]
def groupoid : Groupoid (⊤ : MorphismProperty C).Localization :=
Groupoid.ofIsGroupoid
end Localization
section
variable {X Y : C} (f g : X ⟶ Y)
/-- The property that two morphisms become equal in the localized category. -/
def AreEqualizedByLocalization : Prop := W.Q.map f = W.Q.map g
lemma areEqualizedByLocalization_iff [L.IsLocalization W] :
AreEqualizedByLocalization W f g ↔ L.map f = L.map g := by
dsimp [AreEqualizedByLocalization]
constructor
· intro h
let e := Localization.compUniqFunctor W.Q L W
rw [← NatIso.naturality_1 e f, ← NatIso.naturality_1 e g]
dsimp
rw [h]
· intro h
let e := Localization.compUniqFunctor L W.Q W
rw [← NatIso.naturality_1 e f, ← NatIso.naturality_1 e g]
dsimp
rw [h]
namespace AreEqualizedByLocalization
lemma mk (L : C ⥤ D) [L.IsLocalization W] (h : L.map f = L.map g) :
AreEqualizedByLocalization W f g :=
(areEqualizedByLocalization_iff L W f g).2 h
variable {W f g}
lemma map_eq (h : AreEqualizedByLocalization W f g) (L : C ⥤ D) [L.IsLocalization W] :
L.map f = L.map g :=
(areEqualizedByLocalization_iff L W f g).1 h
lemma map_eq_of_isInvertedBy (h : AreEqualizedByLocalization W f g)
(F : C ⥤ D) (hF : W.IsInvertedBy F) :
F.map f = F.map g := by
simp [← NatIso.naturality_1 (Localization.fac F hF W.Q), h.map_eq W.Q]
end AreEqualizedByLocalization
end
end CategoryTheory