PRO#

class discopy.monoidal.PRO(n=0)[source]#

Bases: discopy.monoidal.Ty

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

Parameters

n (int) – The length of the PRO type.

Example

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

Note

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

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

alias of PRO