Diagram#
- class discopy.closed.Diagram(inside, dom, cod, _scan=True)[source]#
Bases:
discopy.markov.Diagram,discopy.biclosed.Diagram,discopy.abc.ClosedCategoryA closed diagram is both a markov and a biclosed diagram.
A diagram applied to another post-composes their tensor with an Eval.
- Parameters:
inside (tuple[Layer, ...])
dom (C0)
cod (C0)
- to_compact()[source]#
Open the curry bubbles into coevaluation and feedback, which stays a
Diagramas a closed category is traced: each curry becomes its argument followed byCoeval, traced over the curried wires, and each term is evaluated first.Example
>>> x, y, z = map(Ty, "xyz") >>> f = Box("f", x @ y, z) >>> assert f.curry().to_compact() == ( ... f >> Coeval(z << y, left=True)).trace()
- Return type:
- copy_factory#
alias of
Copy
- permutation_factory#
alias of
Permutation
- swap_factory#
alias of
Swap
- trace_factory#
alias of
Trace