Kan Extensions¶
left_kan and right_kan compute Kan extensions
along a function between finite sets (an ObjectMap, such as a Projection or an Inclusion),
the special case of a Kan extension along a functor between discrete categories
(Mac Lane, 1998; Kelly, 1982). The left extension
joins the weights over each fiber, the set of elements that map to one point, and the right
extension meets them, in the lattice of an IdempotentSemiring. Along a projection that forgets a coordinate, the left extension is thus
the reduction over that coordinate.
kan_extensions
¶
Kan extensions along functions between finite sets.
A morphism R: A → B over an algebra V is a V-valued matrix, which is a functor from the discrete category A to the category of V-valued presheaves on B. For a function p: A → A' between discrete categories and V a complete lattice, the left and right Kan extensions along p are pointwise joins and meets over the fibres of p [Mac Lane (1998), §X.3; Kelly (1982), §4]:
(Lan_p R)(a', b) = ⋁{R(a, b) : p(a) = a'}
(Ran_p R)(a', b) = ⋀{R(a, b) : p(a) = a'}
An empty fibre gives the least element ⊥ for Lan and the greatest ⊤
for Ran. This is the discrete special case of a Kan extension; the
formulas are the Kan extensions only when ⋁ and ⋀ are the join and
meet of V's order, so the functions require an IdempotentSemiring
algebra, whose join is idempotent and whose meet is the infimum of its
order. They satisfy the adjunctions
Lan_p R ≤ S ⟺ R ≤ S ∘ p S ∘ p ≤ R ⟺ S ≤ Ran_p R
for every S: A' → B. Marginalization over an idempotent semiring is the left Kan extension along a projection π: A₁×...×Aₙ → A_{i₁}×...×A_{iₖ}.
This module provides the abstract ObjectMap (a function between
finite sets) with Projection and Inclusion, and the left_kan and
right_kan functions.
References
Mac Lane, S. (1998). Categories for the Working Mathematician (2nd ed.). Springer. doi:10.1007/978-1-4757-4721-8
Kelly, G. M. (1982). Basic Concepts of Enriched Category Theory. Cambridge University Press. Reprinted in Reprints in Theory and Applications of Categories, 10 (2005). TAC reprint
ObjectMap
¶
Bases: ABC
An abstract deterministic map between finite sets.
Represents a function p: A → A' at the element level, used as the map along which to compute Kan extensions.
apply
abstractmethod
¶
Map a source index to a target index.
| PARAMETER | DESCRIPTION |
|---|---|
source_idx
|
An element of A as a multi-index.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
tuple[int, ...]
|
The corresponding element of A'. |
Source code in src/quivers/enriched/kan_extensions.py
fiber_indices
¶
Return all source indices that map to the given target index.
| PARAMETER | DESCRIPTION |
|---|---|
target_idx
|
An element of A'.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
list[tuple[int, ...]]
|
All a ∈ A such that p(a) = target_idx. |
Source code in src/quivers/enriched/kan_extensions.py
Projection
¶
Projection(product: ProductSet, keep_indices: tuple[int, ...])
Bases: ObjectMap
Projection from a product to a subset of its components.
Given ProductSet(A₁, ..., Aₙ), projects onto the components at the specified indices: π(a₁, ..., aₙ) = (a_{i₁}, ..., a_{iₖ}).
| PARAMETER | DESCRIPTION |
|---|---|
product
|
The source product set.
TYPE:
|
keep_indices
|
Indices of the components to keep (0-based).
TYPE:
|
Source code in src/quivers/enriched/kan_extensions.py
drop_indices
property
¶
Indices of the dropped (marginalized) components.
apply
¶
Project by keeping only the selected component indices.
Source code in src/quivers/enriched/kan_extensions.py
Inclusion
¶
Inclusion(coproduct: CoproductSet, component_index: int)
Bases: ObjectMap
Coproduct inclusion ι_k: Aₖ → A₁ + ... + Aₙ.
Embeds the k-th component of a CoproductSet into the full set.
| PARAMETER | DESCRIPTION |
|---|---|
coproduct
|
The target coproduct set.
TYPE:
|
component_index
|
Which component to include (0-based).
TYPE:
|
Source code in src/quivers/enriched/kan_extensions.py
apply
¶
left_kan
¶
left_kan(morph: Morphism, along: ObjectMap, algebra: Algebra | None = None) -> ObservedMorphism
Left Kan extension of a morphism along a function.
Computes (Lan_p R)(a', b) = ⋁{R(a, b) : p(a) = a'}, which is ⊥
over an empty fibre.
| PARAMETER | DESCRIPTION |
|---|---|
morph
|
The morphism R: A → B.
TYPE:
|
along
|
The function p: A → A'.
TYPE:
|
algebra
|
The algebra, an
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
ObservedMorphism
|
The left Kan extension Lan_p(R): A' → B. |
| RAISES | DESCRIPTION |
|---|---|
TypeError
|
If the algebra is not an |
Source code in src/quivers/enriched/kan_extensions.py
right_kan
¶
right_kan(morph: Morphism, along: ObjectMap, algebra: Algebra | None = None) -> ObservedMorphism
Right Kan extension of a morphism along a function.
Computes (Ran_p R)(a', b) = ⋀{R(a, b) : p(a) = a'}, which is ⊤
over an empty fibre.
| PARAMETER | DESCRIPTION |
|---|---|
morph
|
The morphism R: A → B.
TYPE:
|
along
|
The function p: A → A'.
TYPE:
|
algebra
|
The algebra, an
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
ObservedMorphism
|
The right Kan extension Ran_p(R): A' → B. |
| RAISES | DESCRIPTION |
|---|---|
TypeError
|
If the algebra is not an |
Source code in src/quivers/enriched/kan_extensions.py
Cited sources¶
Saunders Mac Lane. Categories for the Working Mathematician. Volume 5 of Graduate Texts in Mathematics. Springer, 2 edition, 1998. URL: https://link.springer.com/book/10.1007/978-1-4757-4721-8, doi:10.1007/978-1-4757-4721-8.
G. M. Kelly. Basic Concepts of Enriched Category Theory. Cambridge University Press, 1982. Reprinted in Reprints in Theory and Applications of Categories 10 (2005), 1–136. URL: https://www.tac.mta.ca/tac/reprints/articles/10/tr10abs.html.