Box

Box#

class discopy.rigid.Box(name, dom, cod, data=None, z=0, **params)[source]#

Bases: discopy.closed.Box, Diagram

A rigid box is a closed box in a rigid diagram.

Parameters:
  • name (str) – The name of the box.

  • dom (T) – The domain of the box, i.e. its input.

  • cod (T) – The codomain of the box, i.e. its output.

  • z – The winding number of the box, i.e. the number of half-turn rotations.

Example

>>> a, b = Ty('a'), Ty('b')
>>> f = Box('f', a, b.l @ b)
>>> assert f.l.z == -1 and f.z == 0 and f.r.z == 1
>>> assert f.r.l == f == f.l.r
>>> assert f.l.l != f != f.r.r
property is_transpose#

Whether the box is an odd rotation of a generator.