You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Computational category theory as differentiable tensor programs.
4
10
5
-
**Quivers** is a Python library for building categorical and probabilistic models as differentiable PyTorch programs. It represents morphisms between finite sets as tensors valued in a quantale (a lattice with a monoidal product), then extends this to stochastic morphisms (Markov kernels), continuous distribution families, monadic probabilistic programs, and variational inference. A built-in DSL compiles `.qvr` specifications into trainable `nn.Module` instances.
11
+
**Quivers** is a Python library for building categorical and probabilistic models as differentiable PyTorch programs. It represents morphisms between finite sets as tensors valued in a quantale (a lattice with a monoidal product), then extends this to stochastic morphisms (Markov kernels), continuous distribution families, monadic probabilistic programs, and variational inference. A built-in functional DSL compiles `.qvr` specifications into trainable `nn.Module` instances.
6
12
7
13
## Features
8
14
9
-
-**Core categorical algebra**: finite sets and product constructions as objects; quantales (Boolean, fuzzy, Łukasiewicz, Gödel, tropical); $\mathcal{V}$-enriched relations as parametrized tensors.
-**Monadic and enriched constructs**: monads, comonads, algebras, Kleisli categories, ends/coends, Kan extensions, profunctors, Yoneda, Day convolution, optics.
12
-
-**Stochastic morphisms**: the FinStoch category of Markov kernels; discretized families (normal, beta, truncated normal); conditioning and mixing; the Giry monad.
13
-
-**Continuous morphisms**: parameterized families of distributions (30+); boundaries (discretize/embed); normalizing flows; monadic programs for hybrid discrete-continuous computations.
14
-
-**Monadic DSL**: a `.qvr` file format and compiler for writing categorical programs declaratively.
15
-
-**Variational inference**: trace-based conditioning, variational guides, ELBO and SVI for posterior inference.
15
+
-**Core categorical algebra**: finite sets, product/coproduct constructions, and free monoids as objects; quantales (Boolean, product fuzzy, Łukasiewicz, Gödel, tropical) as enrichment algebras; $\mathcal{V}$-enriched relations as parametrized tensors with composition via quantale operations.
16
+
-**Categorical structures**: functors, natural transformations, adjunctions, monoidal categories, traced monoidal categories, base change between quantales.
17
+
-**Enriched category theory**: ends, coends, Kan extensions, weighted limits/colimits, profunctors, Yoneda embedding, Day convolution, optics (lenses, prisms, adapters, grates).
-**Monadic programs**: probabilistic programs with draw, observe, and return statements; ancestral sampling; log-joint computation; hybrid discrete-continuous random variables.
22
+
-**QVR DSL**: a `.qvr` file format with lexer, recursive descent parser, AST, and compiler; supports object/morphism declarations, program blocks, let bindings, type expressions, and grammar-based parsers (PCFG, CCG, Lambek, multimodal type-logical).
Composition uses the product fuzzy quantale by default: AND is multiplication, OR is noisy-OR ($1 - \prod(1 - x_i)$). The result is a differentiable tensor, trainable via `program.parameters()`.
47
68
48
-
# V-enriched composition: X -> Y -> Z
49
-
h = f >> g
69
+
### Stochastic morphisms
50
70
51
-
# Wrap as a trainable module
52
-
program = Program(h)
53
-
output = program() # shape (3, 2)
71
+
Work with Markov kernels in the FinStoch category:
72
+
73
+
```python
74
+
from quivers import FinSet, stochastic, condition, prob
0 commit comments