Bubble

Contents

Bubble#

class discopy.monoidal.Bubble(*args, dom=None, cod=None, **kwargs)[source]#

Bases: discopy.cat.Bubble, Box

A bubble is a box with a diagram arg inside and an optional pair of types dom and cod.

Parameters:
  • args (Diagram) – The diagrams inside the bubble.

  • dom (T) – The domain of the bubble, default is that of other.

  • cod (T) – The codomain of the bubble, default is that of other.

  • drawing_name (str) – The name of the bubble when drawing it.

  • draw_as_bubble (bool) – Whether to draw as a bubble or as a frame.

Examples

>>> x, y = Ty('x'), Ty('y')
>>> f, g, h = Box('f', x, y ** 3), Box('g', y, y @ y), Box('h', x, y)
>>> d = (f.bubble(dom=x @ x, cod=y) >> g).bubble()
>>> d.draw(path='docs/_static/monoidal/bubble-example.png')
../_images/bubble-example.png
>>> b = Bubble(f, g, h, dom=x, cod=y @ y)
>>> b.draw(path='docs/_static/monoidal/bubble-multiple-args.png')
../_images/bubble-multiple-args.png