Weighted Limits¶
A weighted limit of a diagram describes the
compatible ways of mapping into it, with a weight saying how much each object of the diagram
contributes (Kelly, 1982). For a family of parallel morphisms \(f_j : A \to B\) indexed by a
finite set \(J\) and a weight \(W\), the weighted limit is the pointwise meet
\(\bigwedge_j [W(j), f_j]\) of residua and the weighted colimit the pointwise join
\(\bigvee_j W(j) \otimes f_j\). weighted_limit_morphisms and weighted_colimit_morphisms
compute them when the Algebra is an IdempotentSemiring, so that its values form a complete
lattice, and the results then have the universal property
(weighted limits).
weighted_limits
¶
Weighted (co)limits for V-enriched categories.
In a V-enriched category, the correct notion of limit is the weighted limit. Given a V-functor D: J → C (diagram) and a V-functor W: J → V (weight), the weighted limit {W, D} is characterized by:
C(X, {W, D}) ≅ [J, V](W, C(X, D-))
and the weighted colimit W ⊗_J D by:
C(W ⊗_J D, X) ≅ [J, V](W, C(D-, X))
For a discrete indexing set J and a diagram of parallel morphisms f_j: A → B, viewed as objects of the V-category of V-valued matrices A → B (the power V^{A×B}, complete when V is a complete lattice), these reduce to the pointwise end and coend
{W, f} = ⋀_j [W(j), f_j] (weighted limit)
W ⊗_J f = ⋁_j W(j) ⊗ f_j (weighted colimit)
where [-, -] is V's residuum (internal hom) [Kelly (1982), §3]. They
are characterized by g ≤ {W, f} ⟺ W(j) ⊗ g ≤ f_j for every j, and
W ⊗_J f ≤ g ⟺ W(j) ⊗ f_j ≤ g for every j, which needs V to be an
IdempotentSemiring with its IdempotentSemiring.residuum.
This module provides:
Weight — a V-valued weight on a finite set
weighted_limit_morphisms() — compute {W, f}
weighted_colimit_morphisms() — compute W ⊗_J f
representable_weight() — weight represented by an index
terminal_weight() — constant weight at the unit
References
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
Weight
didactic-model
¶
Weight(*, values: Tensor = field(opaque=True, extras=OPAQUE_BY_IDENTITY), algebra: IdempotentSemiring = field(opaque=True, extras=OPAQUE_BY_IDENTITY))
Bases: ValueModel
A V-valued presheaf on a finite indexing category.
Represents a weight functor W: J → V where J is a finite set of indices, and W assigns a V-value (scalar in the algebra's lattice) to each index.
The tensor and algebra are held by identity. Immutable record updates retain the live tensor and its autograd history.
| PARAMETER | DESCRIPTION |
|---|---|
values
|
A 1D tensor of shape (|J|,) with values in L (the algebra's lattice). W(j) = values[j].
TYPE:
|
algebra
|
The enrichment algebra, a complete lattice.
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
ValidationError
|
If |
weighted_limit_morphisms
¶
weighted_limit_morphisms(weight: Weight, morphisms: Sequence[Morphism], algebra: IdempotentSemiring) -> Tensor
Compute a weighted limit from a family of morphisms.
Given morphisms f_j: X → A_j and weights W(j), computes the weighted meet:
result[x, ...] = ⋀_j [W(j), f_j(x, ...)]
This is the tensor-level computation of the weighted limit of a cone.
| PARAMETER | DESCRIPTION |
|---|---|
weight
|
The weight W.
TYPE:
|
morphisms
|
The morphisms f_j comprising the cone.
TYPE:
|
algebra
|
The enrichment algebra, a complete lattice.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
The weighted limit tensor. |
| RAISES | DESCRIPTION |
|---|---|
TypeError
|
If the algebra is not an |
ValueError
|
If the weight and the family differ in size or the family is empty. |
Source code in src/quivers/enriched/weighted_limits.py
weighted_colimit_morphisms
¶
weighted_colimit_morphisms(weight: Weight, morphisms: Sequence[Morphism], algebra: IdempotentSemiring) -> Tensor
Compute a weighted colimit from a family of morphisms.
Given morphisms f_j: A_j → X and weights W(j), computes the weighted join:
result[..., x] = ⋁_j W(j) ⊗ f_j(..., x)
| PARAMETER | DESCRIPTION |
|---|---|
weight
|
The weight W.
TYPE:
|
morphisms
|
The morphisms f_j comprising the cocone.
TYPE:
|
algebra
|
The enrichment algebra, a complete lattice.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
The weighted colimit tensor. |
| RAISES | DESCRIPTION |
|---|---|
TypeError
|
If the algebra is not an |
ValueError
|
If the weight and the family differ in size or the family is empty. |
Source code in src/quivers/enriched/weighted_limits.py
representable_weight
¶
representable_weight(index_set: FinSet, represented_at: int, algebra: IdempotentSemiring) -> Weight
Create a representable weight (Yoneda-style).
The representable weight at index k is W(j) = I if j == k, and W(j) = ⊥ otherwise. Weighted limits with representable weights recover evaluation: {y(k), D} ≅ D(k).
| PARAMETER | DESCRIPTION |
|---|---|
index_set
|
The indexing set J.
TYPE:
|
represented_at
|
The representing index k.
TYPE:
|
algebra
|
The enrichment algebra, a complete lattice.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Weight
|
The representable weight at k. |
| RAISES | DESCRIPTION |
|---|---|
TypeError
|
If the algebra is not an |
Source code in src/quivers/enriched/weighted_limits.py
terminal_weight
¶
terminal_weight(index_set: FinSet, algebra: IdempotentSemiring) -> Weight
Create the terminal (constant unit) weight.
W(j) = I for all j. Weighted limits with the terminal weight recover ordinary (conical) limits.
| PARAMETER | DESCRIPTION |
|---|---|
index_set
|
The indexing set J.
TYPE:
|
algebra
|
The enrichment algebra, a complete lattice.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Weight
|
The terminal weight. |
| RAISES | DESCRIPTION |
|---|---|
TypeError
|
If the algebra is not an |
Source code in src/quivers/enriched/weighted_limits.py
Cited sources¶
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.