Diagram#

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

Bases: discopy.monoidal.Diagram, discopy.abc.BiclosedCategory

A biclosed diagram is a monoidal diagram with Curry and Eval boxes.

Parameters:
  • inside (Layer) – The layers inside the diagram.

  • dom (Ty) – The domain of the diagram, i.e. its input.

  • cod (Ty) – The codomain of the diagram, i.e. its output.

ob#

alias of Ty

curry(n=1, left=True)[source]#

Wrapper around Curry called by Functor.

Parameters:
  • n – The number of atomic types to curry.

  • left – Whether to curry on the left, i.e. into Over, or on the right, i.e. into Under.

Return type:

Diagram

classmethod ev(base, exponent, left=True)[source]#

Wrapper around Eval called by Functor.

Parameters:
  • base (Ty) – The base of the exponential type to evaluate.

  • exponent (Ty) – The exponent of the exponential type to evaluate.

  • left – Whether to evaluate on the left, i.e. from Over, or on the right, i.e. from Under.

Return type:

Eval

to_compact()[source]#

Bend curry bubbles into coevaluation and feedback, which lands in CMap as a biclosed category has no trace, see discopy.cmap.CMap.to_compact().

Example

>>> x, y, z = map(Ty, "xyz")
>>> f = Box("f", x @ y, z)
>>> assert f.curry().to_compact() == (
...     f.to_map() >> CMap.ev(z, y).dagger()).trace()
Return type:

CMap[Diagram]

coeval_factory#

alias of Coeval

curry_factory#

alias of Curry

eval_factory#

alias of Eval

factory#

alias of Diagram

functor_factory#

alias of Functor

sum_factory#

alias of Sum