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
isPRO
thenDiagram
will automatically turn anyn: int
intoPRO(n)
. ThusPRO
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