Skip to content

Commit 32f9bf1

Browse files
committed
feat(CategoryTheory): the left Kan extension functor (#12168)
Given a functor `F : C ⥤ D`, we define the left Kan extension functor `F.lan : (C ⥤ E) ⥤ (D ⥤ E)` which sends a functor `G : C ⥤ E` to its left Kan extension along `F`. (This is a step towards the refactor of `Lan/Ran` in mathlib using the new API for Kan extensions of functors #10425.)
1 parent cd502bd commit 32f9bf1

File tree

5 files changed

+275
-46
lines changed

5 files changed

+275
-46
lines changed

Mathlib.lean

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1221,6 +1221,7 @@ import Mathlib.CategoryTheory.Functor.Flat
12211221
import Mathlib.CategoryTheory.Functor.FullyFaithful
12221222
import Mathlib.CategoryTheory.Functor.Functorial
12231223
import Mathlib.CategoryTheory.Functor.Hom
1224+
import Mathlib.CategoryTheory.Functor.KanExtension.Adjunction
12241225
import Mathlib.CategoryTheory.Functor.KanExtension.Basic
12251226
import Mathlib.CategoryTheory.Functor.KanExtension.Pointwise
12261227
import Mathlib.CategoryTheory.Functor.ReflectsIso
Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
/-
2+
Copyright (c) 2024 Joël Riou. All rights reserved.
3+
Released under Apache 2.0 license as described in the file LICENSE.
4+
Authors: Joël Riou
5+
-/
6+
import Mathlib.CategoryTheory.Functor.KanExtension.Pointwise
7+
8+
/-! # The Kan extension functor
9+
10+
Given a functor `L : C ⥤ D`, we define the left Kan extension functor
11+
`L.lan : (C ⥤ H) ⥤ (D ⥤ H)` which sends a functor `F : C ⥤ H` to its
12+
left Kan extension along `L`. This is defined if all `F` have such
13+
a left Kan extension. It is shown that `L.lan` is the left adjoint to
14+
the functor `(D ⥤ H) ⥤ (C ⥤ H)` given by the precomposition
15+
with `L` (see `Functor.lanAdjunction`).
16+
17+
## TODO
18+
- dualize the results for right Kan extensions
19+
- refactor the file `CategoryTheory.Limits.KanExtension` so that
20+
the definitions of `Lan` and `Ran` in that file (which rely on the
21+
existence of (co)limits) are replaced by the new definition
22+
`Functor.lan` which is based on Kan extensions API.
23+
24+
-/
25+
26+
namespace CategoryTheory
27+
28+
open Category
29+
30+
namespace Functor
31+
32+
variable {C D : Type*} [Category C] [Category D] (L : C ⥤ D)
33+
{H : Type*} [Category H] [∀ (F : C ⥤ H), HasLeftKanExtension L F]
34+
35+
/-- The left Kan extension functor `(C ⥤ H) ⥤ (D ⥤ H)` along a functor `C ⥤ D`. -/
36+
@[pp_dot]
37+
noncomputable def lan : (C ⥤ H) ⥤ (D ⥤ H) where
38+
obj F := leftKanExtension L F
39+
map {F₁ F₂} φ := descOfIsLeftKanExtension _ (leftKanExtensionUnit L F₁) _
40+
(φ ≫ leftKanExtensionUnit L F₂)
41+
42+
/-- The natural transformation `F ⟶ L ⋙ (L.lan).obj G`. -/
43+
@[pp_dot]
44+
noncomputable def lanUnit : (𝟭 (C ⥤ H)) ⟶ L.lan ⋙ (whiskeringLeft C D H).obj L where
45+
app F := leftKanExtensionUnit L F
46+
naturality {F₁ F₂} φ := by ext; simp [lan]
47+
48+
instance (F : C ⥤ H) : (L.lan.obj F).IsLeftKanExtension (L.lanUnit.app F) := by
49+
dsimp [lan, lanUnit]
50+
infer_instance
51+
52+
/-- If there exists a pointwise left Kan extension of `F` along `L`,
53+
then `L.lan.obj G` is a pointwise left Kan extension of `F`. -/
54+
noncomputable def isPointwiseLeftKanExtensionLanUnit
55+
(F : C ⥤ H) [HasPointwiseLeftKanExtension L F] :
56+
(LeftExtension.mk _ (L.lanUnit.app F)).IsPointwiseLeftKanExtension :=
57+
isPointwiseLeftKanExtensionOfIsLeftKanExtension (F := F) _ (L.lanUnit.app F)
58+
59+
variable (H) in
60+
/-- The left Kan extension functor `L.Lan` is left adjoint to the
61+
precomposition by `L`. -/
62+
@[pp_dot]
63+
noncomputable def lanAdjunction : L.lan ⊣ (whiskeringLeft C D H).obj L :=
64+
Adjunction.mkOfHomEquiv
65+
{ homEquiv := fun F G => homEquivOfIsLeftKanExtension _ (L.lanUnit.app F) G
66+
homEquiv_naturality_left_symm := fun {F₁ F₂ G} f α =>
67+
hom_ext_of_isLeftKanExtension _ (L.lanUnit.app F₁) _ _ (by
68+
ext X
69+
dsimp [homEquivOfIsLeftKanExtension]
70+
rw [descOfIsLeftKanExtension_fac_app, NatTrans.comp_app, ← assoc]
71+
have h := congr_app (L.lanUnit.naturality f) X
72+
dsimp at h ⊢
73+
rw [← h, assoc, descOfIsLeftKanExtension_fac_app] )
74+
homEquiv_naturality_right := fun {F G₁ G₂} β f => by
75+
dsimp [homEquivOfIsLeftKanExtension]
76+
rw [assoc] }
77+
78+
variable (H) in
79+
@[simp]
80+
lemma lanAdjunction_unit : (L.lanAdjunction H).unit = L.lanUnit := by
81+
ext F : 2
82+
dsimp [lanAdjunction, homEquivOfIsLeftKanExtension]
83+
simp
84+
85+
lemma lanAdjunction_counit_app (G : D ⥤ H) :
86+
(L.lanAdjunction H).counit.app G =
87+
descOfIsLeftKanExtension (L.lan.obj (L ⋙ G)) (L.lanUnit.app (L ⋙ G)) G (𝟙 (L ⋙ G)) :=
88+
rfl
89+
90+
@[reassoc (attr := simp)]
91+
lemma lanUnit_app_whiskerLeft_lanAdjunction_counit_app (G : D ⥤ H) :
92+
L.lanUnit.app (L ⋙ G) ≫ whiskerLeft L ((L.lanAdjunction H).counit.app G) = 𝟙 (L ⋙ G) := by
93+
simp [lanAdjunction_counit_app]
94+
95+
@[reassoc (attr := simp)]
96+
lemma lanUnit_app_app_lanAdjunction_counit_app_app (G : D ⥤ H) (X : C) :
97+
(L.lanUnit.app (L ⋙ G)).app X ≫ ((L.lanAdjunction H).counit.app G).app (L.obj X) = 𝟙 _ :=
98+
congr_app (L.lanUnit_app_whiskerLeft_lanAdjunction_counit_app G) X
99+
100+
lemma isIso_lanAdjunction_counit_app_iff (G : D ⥤ H) :
101+
IsIso ((L.lanAdjunction H).counit.app G) ↔ G.IsLeftKanExtension (𝟙 (L ⋙ G)) :=
102+
(isLeftKanExtension_iff_isIso _ (L.lanUnit.app (L ⋙ G)) _ (by simp)).symm
103+
104+
section
105+
106+
variable [Full L] [Faithful L]
107+
108+
instance (F : C ⥤ H) (X : C) [HasPointwiseLeftKanExtension L F] :
109+
IsIso ((L.lanUnit.app F).app X) :=
110+
(isPointwiseLeftKanExtensionLanUnit L F (L.obj X)).isIso_hom_app
111+
112+
instance (F : C ⥤ H) [HasPointwiseLeftKanExtension L F] :
113+
IsIso (L.lanUnit.app F) :=
114+
NatIso.isIso_of_isIso_app _
115+
116+
instance coreflective [∀ (F : C ⥤ H), HasPointwiseLeftKanExtension L F] :
117+
IsIso (L.lanUnit (H := H)) := by
118+
apply NatIso.isIso_of_isIso_app _
119+
120+
instance (F : C ⥤ H) [HasPointwiseLeftKanExtension L F] :
121+
IsIso ((L.lanAdjunction H).unit.app F) := by
122+
rw [lanAdjunction_unit]
123+
infer_instance
124+
125+
instance coreflective' [∀ (F : C ⥤ H), HasPointwiseLeftKanExtension L F] :
126+
IsIso (L.lanAdjunction H).unit := by
127+
apply NatIso.isIso_of_isIso_app _
128+
129+
end
130+
131+
end Functor
132+
133+
end CategoryTheory

0 commit comments

Comments
 (0)