based on plain type theory/set theory:
based on dependent type theory/homotopy type theory:
For monoidal category theory:
projects for formalization of mathematics with proof assistants:
Archive of Formal Proofs (using Isabelle)
ForMath project (using Coq)
UniMath project (using Coq)
Xena project (using Lean)
Historical projects that died out:
category with duals (list of them)
dualizable object (what they have)
ribbon category, a.k.a. tortile category
monoidal dagger-category?
DisCoPy is a toolbox for computing with string diagrams, monoidal categories and strong monoidal functors in Python. It is available on GitHub.
The name stands for Distributional Compositional Python, indeed the package was first intended as an implementation of the DisCoCat models of natural language.
The core data structure is Diagram
, an implementation of string diagrams in the free premonoidal category.
Fix a monoidal signature $\Sigma = \Sigma_1 \xrightarrow{\text{dom}, \text{cod}} \Sigma_0^\star$ for a set of boxes $\Sigma_1$, a set of objects $\Sigma_0$ and its free monoid $\Sigma_0^\star$, we write $f \colon s \to t$ for $f \in \Sigma_1$ whenever $\text{dom}(f) = s$ and $\text{cod}(f) = t$. Let $L(\Sigma) = \Sigma_0^\star \times \Sigma_1 \times \Sigma_0^\star$, a layer is a triple $l = (u, f \colon s \to t, v) \in L(\Sigma)$, where we define $\text{dom}(l) = u s v$ and $\text{cod}(l) = u t v$. It is depicted, in string diagram-notation, as:
The set of diagrams $D(\Sigma)$ is the set of arrows in the free category generated by the layers $L(\Sigma)$, considered as a directed graph. Concretely, $d$ is given by a length $\text{len}(d) = n \in \mathbb{N}$, a domain $\text{dom}(d) \in \Sigma_0^\star$ and a list of layers $\layers(d) = (d_1, \dots, d_n) \in L(\Sigma)^n$ such that $\text{dom}(d) = \text{dom}(d_0)$ and $\text{cod}(d_i) = \text{dom}(d_{i + 1})$ for each $i \leq n$. The codomain of a diagram is the codomain of its last layer $\cod(d) = \cod(d_n)$.
Note that in order to define a diagram uniquely, its layers have more data than necessary. It is enough to specify a list $\boxes(d) \in \Sigma_1^n$ of generators together with a list $\offsets(d) \in \N^n$: the number of wires on the left of each box. This is the definition used in Delpeuch and Vicary (2018), Globular, homotopy.io as well as DisCoPy.
We can define identity, composition and tensor of diagrams in terms of this combinatorial encoding:
d0 >> d1
or d1 << d0
.d0 @ d1 == d0 @ Id(d1.dom) >> Id(d0.cod) @ d1
.Diagrams in the free monoidal category can be seen as premonoidal diagrams quotiented by the interchanger, i.e. the naturality equation for the monoidal product: $f \otimes 1_c \circ 1_b \otimes g = 1_a \otimes g \circ f \otimes 1_d$ for all $f : a \to b$ and $g : c \to d$. Diagrams in the free rigid monoidal category can be seen as monoidal diagrams quotiented by the snake equations. In practice, these quotients are computed by calling Diagram.normal_form
.
Diagrams are equipped with an involution Diagram.dagger
that implements dagger categories. Furthermore, formal sums of diagrams can also be composed and tensored, making all the diagams enriched in monoids. DisCoPy also implements the syntax for diagrams in the free cartesian monoidal category and biclosed monoidal category, although their normal form is not yet implemented.
Diagrams can be evaluated in concrete monoidal categories by applying Functor
instances to them.
Let $\mathcal{F} : \text{MonSig} \to \text{MonCat}$ be the functor that sends a monoidal signature to its free monoidal category, and its right adjoint $\mathcal{U} : \text{MonCat} \to \text{MonSig}$ the forgetful functor. From the free-forgetful adjunction, we get that monoidal functor $F : \mathcal{F}(\Sigma) \to S$ from a free monoidal category generated by a signature $\Sigma$ into some monoidal category $S$ is uniquely defined by a morphism of signature $F : \Sigma \to \mathcal{U}(S)$. That is, in order to define a functor $F : \mathcal{F}(\Sigma) \to S$, it’s enough to define two mappings $F_0 : \Sigma_0 \to \text{Ob}(S)$ and $F_1 : \Sigma_1 \to \text{Ar}(S)$ which commute with $\text{dom}$ and $\text{cod}$.
Concretely, a DisCoPy functor is defined by F = Functor(ob, ar)
where ob
and ar
are mappings from generating object to types and from box to diagram respectively. These mappings can be either given as Python dictionaries if they have finite domains or as Python functions otherwise. Once its image for each generating object and each box is given, F
can be applied to arbitrary diagrams. Optional arguments ob_factory
and ar_factory
can be used to define functors with arbitrary categories as codomain. By default DisCoPy functors are endofunctors from the free category to itself, i.e. they send diagrams to diagrams.
Currently, DisCoPy implements strong monoidal functors into:
the category of matrices in arbitrary semirings, including finite dimensional vector spaces and finite relations,
the category of quantum circuits?,
the category of Python functions.
Diagrams can be used to encode derivations in a formal grammar. Indeed, the first use case of DisCoPy was to apply monoidal diagrams to these grammar diagrams in order to compute their semantics. Currently, DisCoPy can handle the following frameworks:
Giovanni de Felice, Alexis Toumi, Bob Coecke. DisCoPy: Monoidal Categories in Python. Applied Category Theory, 2020. (arXiv:2005.02975l)
Konstantinos Meichanetzidis, Stefano Gogioso, Giovanni De Felice, Nicolò Chiappori, Alexis Toumi, Bob Coecke. Quantum Natural Language Processing on Near-Term Quantum Computers. Quantum physics & logic, 2020. (arXiv:2005.04147)
Delpeuch, Antonin, and Jamie Vicary, Normalization for planar string diagrams and a quadratic equivalence algorithm. arXiv preprint arXiv:1804.07832 (2018).
DisCoPy’s documentation. discopy.readthedocs.io
DisCoPy’s repository. github.com/oxford-quantum-group/discopy
Last revised on December 9, 2020 at 09:15:12. See the history of this page for a list of all contributions to it.