Kan Extensions¶
Left and right Kan extensions in enriched categories.
kan_extensions
¶
Kan extensions: generalized (re)indexing of morphisms.
The left Kan extension of a morphism R: A → B along a map p: A → A' produces a morphism Lan_p(R): A' → B via:
(Lan_p R)(a', b) = ⋁{a : p(a) = a'} R(a, b)
The right Kan extension uses meet (⋀) instead of join (⋁):
(Ran_p R)(a', b) = ⋀{a : p(a) = a'} R(a, b)
Marginalization is a special case: left Kan extension along a projection π: A₁×...×Aₙ → A_{i₁}×...×A_{iₖ}.
This module provides:
ObjectMap (abstract) — maps between finite sets
├── Projection — π: A₁×...×Aₙ → some subset of components
└── Inclusion — ι: A → A + B (coproduct injection)
left_kan() — left Kan extension
right_kan() — right Kan extension
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
¶
apply(source_idx: tuple[int, ...]) -> tuple[int, ...]
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
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | |
fiber_indices
¶
fiber_indices(target_idx: tuple[int, ...]) -> list[tuple[int, ...]]
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
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 | |
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
103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 | |
drop_indices
property
¶
drop_indices: tuple[int, ...]
Indices of the dropped (marginalized) components.
apply
¶
apply(source_idx: tuple[int, ...]) -> tuple[int, ...]
Project by keeping only the selected component indices.
Source code in src/quivers/enriched/kan_extensions.py
146 147 148 149 150 151 152 153 154 | |
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
170 171 172 173 174 175 176 177 178 179 180 181 | |
apply
¶
apply(source_idx: tuple[int, ...]) -> tuple[int, ...]
Embed into the coproduct with offset.
Source code in src/quivers/enriched/kan_extensions.py
193 194 195 196 | |
left_kan
¶
left_kan(morph: Morphism, along: ObjectMap, quantale: Quantale | None = None) -> ObservedMorphism
Left Kan extension of a morphism along an object map.
Computes: (Lan_p R)(a', b) = ⋁{a : p(a) = a'} R(a, b)
| PARAMETER | DESCRIPTION |
|---|---|
morph
|
The morphism R: A → B.
TYPE:
|
along
|
The map p: A → A'.
TYPE:
|
quantale
|
The enrichment algebra. Defaults to PRODUCT_FUZZY.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
ObservedMorphism
|
The left Kan extension Lan_p(R): A' → B. |
Source code in src/quivers/enriched/kan_extensions.py
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 | |
right_kan
¶
right_kan(morph: Morphism, along: ObjectMap, quantale: Quantale | None = None) -> ObservedMorphism
Right Kan extension of a morphism along an object map.
Computes: (Ran_p R)(a', b) = ⋀{a : p(a) = a'} R(a, b)
| PARAMETER | DESCRIPTION |
|---|---|
morph
|
The morphism R: A → B.
TYPE:
|
along
|
The map p: A → A'.
TYPE:
|
quantale
|
The enrichment algebra. Defaults to PRODUCT_FUZZY.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
ObservedMorphism
|
The right Kan extension Ran_p(R): A' → B. |
Source code in src/quivers/enriched/kan_extensions.py
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 | |