Weighted Limits¶
Limits and colimits weighted by enrichment in V-categories.
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))
In our finite setting, these reduce to end/coend computations:
{W, D} = ∫_j [W(j), D(j)] (weighted limit)
W ⊗_J D = ∫^j W(j) ⊗ D(j) (weighted colimit)
where [-, -] denotes the internal hom in V and ⊗ the tensor.
This module provides:
Weight — a V-valued presheaf (weight functor)
Diagram — a finite diagram of objects/morphisms
weighted_limit() — compute {W, D}
weighted_colimit() — compute W ⊗_J D
representable_weight() — weight represented by an object
terminal_weight() — constant weight at the unit
Weight
dataclass
¶
Weight(values: Tensor, quantale: Quantale | None = None)
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 quantale's lattice) to each index.
Holds a torch.Tensor of values; not a value type.
| PARAMETER | DESCRIPTION |
|---|---|
values
|
A 1D tensor of shape (|J|,) with values in L (the quantale's lattice). W(j) = values[j].
TYPE:
|
quantale
|
The enrichment algebra. Defaults to PRODUCT_FUZZY.
TYPE:
|
Diagram
¶
Bases: Model
A finite diagram of morphisms sharing a common domain or codomain.
For weighted limits, this is a collection of morphisms D(j): X → A_j for each index j (cone-shaped). For weighted colimits, this is a collection of morphisms D(j): A_j → X for each index j (cocone-shaped).
In the simplest case (discrete diagram), this is just a tuple of objects with no connecting morphisms.
| ATTRIBUTE | DESCRIPTION |
|---|---|
objects |
The objects A_j in the diagram, one per index j.
TYPE:
|
weighted_limit
¶
Compute the weighted limit {W, D} for a discrete diagram.
For a discrete diagram (no connecting morphisms), the weighted limit reduces to:
{W, D} = ∫_j [W(j), D(j)] = ⋀_j [W(j), D(j)]
where [w, x] is the internal hom in the quantale (residuation):
[w, x] = sup{v : w ⊗ v ≤ x}
For the product-fuzzy quantale, [w, x] = min(1, x/w) when w > 0, and the unit when w = 0.
For discrete diagrams with objects A_0, ..., A_{n-1}, this computes a tensor of shape (∏_j |A_j|,) representing the weighted product.
| PARAMETER | DESCRIPTION |
|---|---|
weight
|
The weight W with values W(j) for each j.
TYPE:
|
diagram
|
The diagram of objects.
TYPE:
|
quantale
|
The enrichment algebra. Defaults to PRODUCT_FUZZY.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
The weighted limit tensor. For discrete diagrams, shape is the meet of identity tensors scaled by the weights. |
Source code in src/quivers/enriched/weighted_limits.py
104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 | |
weighted_colimit
¶
Compute the weighted colimit W ⊗_J D for a discrete diagram.
For a discrete diagram, the weighted colimit reduces to:
W ⊗_J D = ∫^j W(j) ⊗ D(j) = ⋁_j W(j) ⊗ D(j)
This is the join (existential) over j of the tensor product of the weight value with the identity at each object.
| PARAMETER | DESCRIPTION |
|---|---|
weight
|
The weight W with values W(j) for each j.
TYPE:
|
diagram
|
The diagram of objects.
TYPE:
|
quantale
|
The enrichment algebra. Defaults to PRODUCT_FUZZY.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
The weighted colimit tensor. |
Source code in src/quivers/enriched/weighted_limits.py
193 194 195 196 197 198 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 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 | |
weighted_limit_morphisms
¶
weighted_limit_morphisms(weight: Weight, morphisms: Sequence[Morphism], quantale: Quantale | None = None) -> 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:
|
quantale
|
The enrichment algebra. Defaults to PRODUCT_FUZZY.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
The weighted limit tensor. |
Source code in src/quivers/enriched/weighted_limits.py
261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 | |
weighted_colimit_morphisms
¶
weighted_colimit_morphisms(weight: Weight, morphisms: Sequence[Morphism], quantale: Quantale | None = None) -> 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:
|
quantale
|
The enrichment algebra. Defaults to PRODUCT_FUZZY.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Tensor
|
The weighted colimit tensor. |
Source code in src/quivers/enriched/weighted_limits.py
316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 | |
representable_weight
¶
representable_weight(index_set: FinSet, represented_at: int, quantale: Quantale | None = None) -> 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:
|
quantale
|
The enrichment algebra. Defaults to PRODUCT_FUZZY.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Weight
|
The representable weight at k. |
Source code in src/quivers/enriched/weighted_limits.py
366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 | |
terminal_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:
|
quantale
|
The enrichment algebra. Defaults to PRODUCT_FUZZY.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Weight
|
The terminal weight. |
Source code in src/quivers/enriched/weighted_limits.py
399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 | |