module Cat.Functor.Kan.Base where
private
variable
: Level
o ℓ : Precategory o ℓ
C C' D E
: ∀ {o ℓ} (C : Precategory o ℓ) → Level
cat-lvl {a} {b} _ = a ⊔ b
cat-lvl
: ∀ {o ℓ o' ℓ' o'' ℓ''} {C : Precategory o ℓ} {C' : Precategory o' ℓ'} {D : Precategory o'' ℓ''}
kan-lvl → Functor C D → Functor C C' → Level
{a} {b} {c} {d} {e} {f} _ _ = a ⊔ b ⊔ c ⊔ d ⊔ e ⊔ f
kan-lvl
open _=>_
Left Kan extensions🔗
Suppose we have a functor and a functor — perhaps to be thought of as a full subcategory inclusion, where is a completion of but the situation applies just as well to any pair of functors — which naturally fit into a commutative diagram
but as we can see this is a particularly sad commutative diagram; it’s crying out for a third edge
extending to a functor If there exists an universal such extension (we’ll define what “universal” means in just a second), we call it the left Kan extension of along and denote it Such extensions do not come for free (in a sense they’re pretty hard to come by), but concept of Kan extension can be used to rephrase the definition of both limit and adjoint functor.
A left Kan extension is equipped with a natural transformation witnessing the (“directed”) commutativity of the triangle (so that it need not commute on-the-nose) which is universal among such transformations; Meaning that if is another functor with a transformation there is a unique natural transformation which commutes with
Note that in general the triangle commutes “weakly”, but when is fully faithful and is cocomplete, genuinely extends in that is a natural isomorphism.
record
(p : Functor C C') (F : Functor C D) (L : Functor C' D) (eta : F => L F∘ p)
is-lan : Type (kan-lvl p F) where
field
Universality of eta
is witnessed
by the following fields, which essentially say that, in the diagram
below (assuming
has a natural transformation
witnessing the same “directed commutativity” that
does for
the 2-cell exists and is unique.
: {M : Functor C' D} (α : F => M F∘ p) → L => M
σ : {M : Functor C' D} {α : F => M F∘ p} → (σ α ◂ p) ∘nt eta ≡ α
σ-comm : {M : Functor C' D} {α : F => M F∘ p} {σ' : L => M}
σ-uniq → α ≡ (σ' ◂ p) ∘nt eta
→ σ α ≡ σ'
σ-uniq₂: {M : Functor C' D} (α : F => M F∘ p) {σ₁' σ₂' : L => M}
→ α ≡ (σ₁' ◂ p) ∘nt eta
→ α ≡ (σ₂' ◂ p) ∘nt eta
→ σ₁' ≡ σ₂'
= sym (σ-uniq p) ∙ σ-uniq q
σ-uniq₂ β p q
σ-uniqp: ∀ {M₁ M₂ : Functor C' D}
→ {α₁ : F => M₁ F∘ p} {α₂ : F => M₂ F∘ p}
→ (q : M₁ ≡ M₂)
→ PathP (λ i → F => q i F∘ p) α₁ α₂
→ PathP (λ i → L => q i) (σ α₁) (σ α₂)
= Nat-pathp refl q λ c' i →
σ-uniqp q r {M = q i} (r i) .η c'
σ
open _=>_ eta
We also provide a bundled form of this data.
record Lan (p : Functor C C') (F : Functor C D) : Type (kan-lvl p F) where
field
: Functor C' D
Ext : F => Ext F∘ p
eta : is-lan p F Ext eta
has-lan
module Ext = Func Ext
open is-lan has-lan public
Right Kan extensions🔗
Our choice of universal property in the section above isn’t the only choice; we could instead require a terminal solution to the lifting problem, instead of an initial one. We can picture the terminal situation using the following diagram.
Note the same warnings about “weak, directed” commutativity as for left Kan extensions apply here, too. Rather than either of the triangles commuting on the nose, we have natural transformations witnessing their commutativity.
record is-ran
(p : Functor C C') (F : Functor C D) (Ext : Functor C' D)
(eps : Ext F∘ p => F)
: Type (kan-lvl p F) where
no-eta-equality
field
: {M : Functor C' D} (α : M F∘ p => F) → M => Ext
σ : {M : Functor C' D} {β : M F∘ p => F} → eps ∘nt (σ β ◂ p) ≡ β
σ-comm : {M : Functor C' D} {β : M F∘ p => F} {σ' : M => Ext}
σ-uniq → β ≡ eps ∘nt (σ' ◂ p)
→ σ β ≡ σ'
open _=>_ eps renaming (η to ε)
σ-uniq₂: {M : Functor C' D} (β : M F∘ p => F) {σ₁' σ₂' : M => Ext}
→ β ≡ eps ∘nt (σ₁' ◂ p)
→ β ≡ eps ∘nt (σ₂' ◂ p)
→ σ₁' ≡ σ₂'
= sym (σ-uniq p) ∙ σ-uniq q
σ-uniq₂ β p q
record Ran (p : Functor C C') (F : Functor C D) : Type (kan-lvl p F) where
no-eta-equality
field
: Functor C' D
Ext : Ext F∘ p => F
eps : is-ran p F Ext eps
has-ran
module Ext = Func Ext
open is-ran has-ran public
module _ {p : Functor C C'} {F : Functor C D} {G : Functor C' D} {eta : F => G F∘ p} where
: is-prop (is-lan p F G eta)
is-lan-is-prop = path where
is-lan-is-prop a b module a = is-lan a
module b = is-lan b
: {M : Functor _ _} (α : F => M F∘ p) → a.σ α ≡ b.σ α
σ≡ = ext (a.σ-uniq (sym b.σ-comm) ηₚ_)
σ≡ α
open is-lan
: a ≡ b
path .σ α = σ≡ α i
path i .σ-comm {α = α} =
path i (λ i → Nat-is-set ((σ≡ α i ◂ p) ∘nt eta) α)
is-prop→pathp (a.σ-comm {α = α}) (b.σ-comm {α = α})
i.σ-uniq {α = α} β =
path i (λ i → Nat-is-set (σ≡ α i) _)
is-prop→pathp (a.σ-uniq β) (b.σ-uniq β)
i
instance
: ∀ {k} → H-Level (is-lan p F G eta) (suc k)
H-Level-is-lan = prop-instance is-lan-is-prop
H-Level-is-lan
module _ {p : Functor C C'} {F : Functor C D} {G : Functor C' D} {eps : G F∘ p => F} where
: is-prop (is-ran p F G eps)
is-ran-is-prop = path where
is-ran-is-prop a b module a = is-ran a
module b = is-ran b
: {M : Functor _ _} (α : M F∘ p => F) → a.σ α ≡ b.σ α
σ≡ = ext (a.σ-uniq (sym b.σ-comm) ηₚ_)
σ≡ α
open is-ran
: a ≡ b
path .σ α = σ≡ α i
path i .σ-comm {β = α} =
path i (λ i → Nat-is-set (eps ∘nt (σ≡ α i ◂ p)) α)
is-prop→pathp (a.σ-comm {β = α}) (b.σ-comm {β = α})
i.σ-uniq {β = α} γ =
path i (λ i → Nat-is-set (σ≡ α i) _)
is-prop→pathp (a.σ-uniq γ) (b.σ-uniq γ)
i
instance
: ∀ {k} → H-Level (is-ran p F G eps) (suc k)
H-Level-is-ran = prop-instance is-ran-is-prop H-Level-is-ran
Preservation and reflection of Kan extensions🔗
Let be the left Kan extension of along and suppose that is a functor. We can “apply” to all the data of the Kan extension, obtaining the following diagram.
This looks like yet another Kan extension diagram, but it may not be universal! If this diagram is a left Kan extension, we say that preserves
module _
{p : Functor C C'} {F : Functor C D} {G : Functor C' D} {eta : F => G F∘ p} where
: (H : Functor D E) → is-lan p F G eta → Type _
preserves-is-lan _ =
preserves-is-lan H (H F∘ F) (H F∘ G) (nat-assoc-to (H ▸ eta)) is-lan p
In the diagram above, the 2-cell is simply the whiskering Unfortunately, proof assistants; our definition of whiskering lands in but we require a natural transformation to
We say that a Kan extension is absolute if it is preserved by all functors out of An important class of examples is given by adjoint functors.
: is-lan p F G eta → Typeω
is-absolute-lan =
is-absolute-lan lan {o ℓ : Level} {E : Precategory o ℓ} (H : Functor D E) → preserves-is-lan H lan
module _
{p : Functor C C'} {F : Functor C D} {G : Functor C' D} {eps : G F∘ p => F} where
We can define dual notions for right Kan extensions as well.
: (H : Functor D E) → is-ran p F G eps → Type _
preserves-is-ran _ =
preserves-is-ran H (H F∘ F) (H F∘ G) (nat-assoc-from (H ▸ eps))
is-ran p
: is-ran p F G eps → Typeω
is-absolute-ran =
is-absolute-ran ran {o ℓ : Level} {E : Precategory o ℓ} (H : Functor D E) → preserves-is-ran H ran
module _ (p : Functor C C') (F : Functor C D) where
preserves-lan: (H : Functor D E)
→ Type _
=
preserves-lan H ∀ {G : Functor C' D} {eta : F => G F∘ p}
→ (lan : is-lan p F G eta)
→ preserves-is-lan H lan
preserves-ran: (H : Functor D E)
→ Type _
=
preserves-ran H ∀ {G : Functor C' D} {eps : G F∘ p => F}
→ (ran : is-ran p F G eps)
→ preserves-is-ran H ran
It may also be the case that is already a Kan extension of along We say that reflects this Kan extension if is a also an extension of along
reflects-lan: (H : Functor D E)
→ Type _
=
reflects-lan H ∀ {G : Functor C' D} {eta : F => G F∘ p}
→ is-lan p (H F∘ F) (H F∘ G) (nat-assoc-to (H ▸ eta))
→ is-lan p F G eta
reflects-ran: (H : Functor D E)
→ Type _
=
reflects-ran H ∀ {G : Functor C' D} {eps : G F∘ p => F}
→ is-ran p (H F∘ F) (H F∘ G) (nat-assoc-from (H ▸ eps))
→ is-ran p F G eps
Lifting and creation of Kan extensions🔗
While the notions of lifted and created limits are commonplace in the literature on category theory, their evident generalisations to Kan extensions are less often encountered. We define those here, but refer the reader to the page about limits for more details.
module _ (H : Functor D E) {p : Functor C C'} {F : Functor C D} where
Given a Kan extension of along we say that lifts this extension if there is a Kan extension of along that is preserved by
record lifts-lan (lan : Lan p (H F∘ F)) : Type (kan-lvl p F ⊔ cat-lvl E) where
no-eta-equality
field
: Lan p F
lifted : preserves-is-lan H (Lan.has-lan lifted)
preserved
record lifts-ran (ran : Ran p (H F∘ F)) : Type (kan-lvl p F ⊔ cat-lvl E) where
no-eta-equality
field
: Ran p F
lifted : preserves-is-ran H (Ran.has-ran lifted) preserved
module _ (H : Functor D E) (p : Functor C C') (F : Functor C D) where
We say that creates Kan extensions of along if it lifts them and reflects them.
record creates-lan : Type (kan-lvl p F ⊔ cat-lvl E) where
no-eta-equality
field
: (lan : Lan p (H F∘ F)) → lifts-lan H lan
has-lifts-lan : reflects-lan p F H
reflects
record creates-ran : Type (kan-lvl p F ⊔ cat-lvl E) where
no-eta-equality
field
: (ran : Ran p (H F∘ F)) → lifts-ran H ran
has-lifts-ran : reflects-ran p F H reflects
module _ (p : Functor C C') (H : Functor D E) where
: Type _
lifts-lan-along =
lifts-lan-along ∀ {F : Functor C D} (lan : Lan p (H F∘ F))
→ lifts-lan H lan
: Type _
creates-lan-along =
creates-lan-along ∀ {F : Functor C D}
→ creates-lan H p F
: Type _
lifts-ran-along =
lifts-ran-along ∀ {F : Functor C D} (ran : Ran p (H F∘ F))
→ lifts-ran H ran
: Type _
creates-ran-along =
creates-ran-along ∀ {F : Functor C D}
→ creates-ran H p F
to-ran: ∀ {p : Functor C C'} {F : Functor C D} {L : Functor C' D} {eps : L F∘ p => F}
→ is-ran p F L eps
→ Ran p F
{L = L} ran .Ran.Ext = L
to-ran {eps = eps} ran .Ran.eps = eps
to-ran .Ran.has-ran = ran
to-ran ran
to-lan: ∀ {p : Functor C C'} {F : Functor C D} {L : Functor C' D} {eta : F => L F∘ p}
→ is-lan p F L eta
→ Lan p F
{L = L} lan .Lan.Ext = L
to-lan {eta = eta} lan .Lan.eta = eta
to-lan .Lan.has-lan = lan to-lan lan