Sum

Sum#

class discopy.monoidal.Sum(terms, dom=None, cod=None)[source]#

Bases: discopy.cat.Sum, Box

A sum is a tuple of diagrams terms with the same domain and codomain.

Parameters:
  • terms (tuple[Diagram, ...]) – The terms of the formal sum.

  • dom (Ty) – The domain of the formal sum.

  • cod (Ty) – The codomain of the formal sum.

Example

>>> f = Box('f', 'x', 'x')
>>> print(f @ (f + f))
(f @ x >> x @ f) + (f @ x >> x @ f)
to_drawing(functor_factory=None)#

Called before Diagram.draw().

Return type:

Drawing