Diagram#
- class discopy.balanced.Diagram(inside, dom, cod, _scan=True)[source]#
Bases:
discopy.braided.Diagram,discopy.traced.Diagram,discopy.abc.BalancedCategoryA balanced diagram is a braided diagram with
Twist.- 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.
Note
By default, our balanced diagrams are traced. Although not every balanced category embeds faithfully into a traced one (see the nLab), the free balanced category does have the desired cancellation property and it does in fact embed faithfully into the free balanced traced category.
- classmethod twist(dom)[source]#
The twist on an object.
Note
This calls
twist_factory.
- to_braided(width=None)[source]#
Doubles every object and sends the twist to the braid.
- Parameters:
width (float) – The width of a ribbon, i.e. the gap between the two wires encoding each object, defaults to the
ribbon_widthindiscopy.config.DRAWING_DEFAULT. Set to0to return the diagram as is, i.e. without doubling it into dual rails.
Example
>>> x = Ty('x') >>> braided_twist = Diagram.twist(x).to_braided()
>>> Equation(Twist(x), braided_twist, symbol='$\\mapsto$').draw( ... wire_labels=False, ... path="docs/_static/balanced/twist_dual_rail.svg")
- dual_rail_factory#
alias of
DualRail
- trace_factory#
alias of
Trace