cat#
Implements free dagger categories and functors.
We can create boxes with objects as domain and codomain:
>>> x, y, z = Ob('x'), Ob('y'), Ob('z')
>>> f, g, h = Box('f', x, y), Box('g', y, z), Box('h', z, x)
We can create arbitrary arrows with composition:
>>> arrow = Arrow(x, x, [f, g, h])
>>> assert arrow == f >> g >> h == h << g << f
We can create dagger functors from the free category to itself:
>>> ob = {x: z, y: y, z: x}
>>> ar = {f: g[::-1], g: f[::-1], h: h[::-1]}
>>> F = Functor(ob, ar)
>>> assert F(arrow) == (h >> f >> g)[::-1]
|
Defines an object in a free category, only distinguished by its name. |
|
Defines an arrow in a free dagger category. |
|
Defines the identity arrow on dom, i.e. with an empty list of boxes. |
|
Defines a box as an arrow with the list of only itself as boxes. |
|
Implements enrichment over monoids, i.e. formal sums of diagrams. |
|
A unary operator on homsets. |
|
Defines a dagger functor which can be applied to objects and arrows. |
This is raised whenever we try to build an invalid arrow. |