Diagram#

class discopy.closed.Diagram(inside, dom, cod, _scan=True)[source]#

Bases: discopy.markov.Diagram, discopy.biclosed.Diagram, discopy.abc.ClosedCategory

A 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)

ob#

alias of Ty

to_compact()[source]#

Open the curry bubbles into coevaluation and feedback, which stays a Diagram as a closed category is traced: each curry becomes its argument followed by Coeval, 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:

Diagram

coeval_factory#

alias of Coeval

copy_factory#

alias of Copy

curry_factory#

alias of Curry

discard_factory#

alias of Discard

eval_factory#

alias of Eval

factory#

alias of Diagram

functor_factory#

alias of Functor

permutation_factory#

alias of Permutation

sum_factory#

alias of Sum

swap_factory#

alias of Swap

trace_factory#

alias of Trace