Beispiel #1
0
 def __init__(self, name, dom, cod, **params):
     cat.Box.__init__(self, name, dom, cod, **params)
     layer = Layer(dom[0:0], self, dom[0:0])
     layers = cat.Arrow(dom, cod, [layer], _scan=False)
     Diagram.__init__(self, dom, cod, [self], [0], layers=layers)
     for attr, value in params.items():
         if attr in drawing.ATTRIBUTES:
             setattr(self, attr, value)
Beispiel #2
0
 def downgrade(self):
     """ Downcasting to :class:`discopy.monoidal.Box`. """
     box = Box.__new__(Box)
     for attr, value in self.__dict__.items():
         setattr(box, attr, value)
     dom, cod = self.dom.downgrade(), self.cod.downgrade()
     box._dom, box._cod, box._boxes = dom, cod, [box]
     layer = Layer(box._dom[0:0], box, box._dom[0:0])
     box._layers = cat.Arrow(dom, cod, [layer], _scan=False)
     return box
Beispiel #3
0
 def __init__(self, name, dom, cod, data=None, _dagger=False):
     cat.Box.__init__(self, name, dom, cod, data=data, _dagger=_dagger)
     layer = Layer(dom[0:0], self, dom[0:0])
     layers = cat.Arrow(dom, cod, [layer], _scan=False)
     Diagram.__init__(self, dom, cod, [self], [0], layers=layers)