Diagram#
- class discopy.braided.Diagram(inside, dom, cod, _scan=True)[source]#
Bases:
discopy.monoidal.Diagram
A braided diagram is a monoidal diagram with
Braid
boxes.- Parameters:
inside (Layer) – The layers inside the diagram.
dom (monoidal.Ty) – The domain of the diagram, i.e. its input.
cod (monoidal.Ty) – The codomain of the diagram, i.e. its output.
- classmethod braid(left, right)[source]#
The diagram braiding
left
overright
.- Parameters:
- Return type:
Note
This calls
hexagon()
andbraid_factory
.
- naturality(i, left=True, down=True, braid=None)[source]#
Slide a box through a braid.
- Parameters:
i (int) – The index of the box to slide.
left – Whether to slide left or right.
down – Whether to slide down or up.
braid – The braiding method to be used.
- Return type:
Examples
>>> x, y, z = map(Ty, "xyz") >>> f = Box('f', x, y) >>> top_left = f @ z >> Braid(y, z) >>> top_right = z @ f >> Braid(z, y) >>> bot_left = Braid(z, x) >> f @ z >>> bot_right = Braid(x, z) >> z @ f >>> assert top_right.naturality(0) == bot_left >>> assert top_left.naturality(0, left=False) == bot_right >>> assert bot_right.naturality(1, down=False) == top_left >>> assert bot_left.naturality(1, left=False, down=False) == top_right