Bubble#
- class discopy.monoidal.Bubble(*args, drawing_name=None, draw_as_frame=None, draw_as_square=None, draw_vertically=False, **kwargs)[source]#
Bases:
discopy.cat.Bubble
,Box
A bubble is a box with diagrams
args
inside and an optional pair of typesdom
andcod
.- Parameters:
args (Diagram) – The diagrams inside the bubble.
drawing_name (str) – The label to use when drawing, empty by default.
draw_as_square (bool) – Whether to draw the bubble as a square.
draw_as_frame (bool) – Whether to draw the bubble as a frame.
draw_vertically (bool) – Whether to draw the frame slots vertically.
kwargs – Passed to
cat.Bubble
.
- Raises:
ValueError – When dom is None but all the args have the same dom.
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 ** 3, cod=y, draw_as_square=True) >> g).bubble() >>> d.draw(path='docs/_static/monoidal/bubble-example.png')
>>> b = Bubble(f, g, h >> h[::-1], dom=x, cod=y @ y) >>> b.draw(path='docs/_static/monoidal/bubble-multiple-args.png')
>>> b = Bubble(f, g, h, dom=x, cod=y @ y, draw_vertically=True) >>> b.draw(path='docs/_static/monoidal/frame-vertical-args.png')