PRO

Contents

PRO#

class discopy.monoidal.PRO(inside=0, dom=None, cod=None, _scan=True)[source]#

Bases: Ty

A PRO is a natural number n seen as a type with addition as tensor.

Parameters:
  • inside (int | tuple) – The length of the PRO type, or a tuple of generators whose length is taken.

  • dom (C0) –

  • cod (C0) –

  • _scan (bool) –

Example

>>> assert PRO(1) @ PRO(2) == PRO(3)

Note

If ob is PRO then Diagram will automatically turn any n: int into PRO(n). Thus PRO never needs to be called.

>>> @factory
... class Circuit(Diagram):
...     ob = PRO
>>> class Gate(Box, Circuit): ...
>>> CX = Gate('CX', 2, 2)
>>> assert CX @ 2 >> 2 @ CX == CX @ CX
factory#

alias of PRO