Transformation#
- class discopy.cat.Transformation(components, dom, cod)[source]#
Bases:
discopy.abc.CategoryA (not necessarily natural) transformation between two parallel functors.
- Parameters:
Example
>>> x, y = Ob('x'), Ob('y') >>> f = Box('f', x, y) >>> F, G = Functor.id(), Functor({x: y, y: x}, {}) >>> alpha = Transformation({x: f, y: f[::-1]}, F, G) >>> assert alpha(x) == f and alpha(y) == f[::-1] >>> beta = Transformation.id(G) >>> assert (alpha >> beta)(x) == alpha(x) >> beta(x)
- classmethod id(dom)[source]#
The identity transformation on a given functor
dom, i.e. the transformation whose component at each objectxis the identity arrow ondom(x).- Parameters:
dom (Functor) – The functor on which to take the identity transformation.
- Return type:
Example
>>> x, y = Ob('x'), Ob('y') >>> F = Functor({x: y, y: x}, {}) >>> alpha = Transformation.id(F) >>> alpha(x) cat.Arrow.id(cat.Ob('y')) >>> assert alpha(x) == F.cod.id(F(x))
- then(other)[source]#
The vertical composition of a transformation with another.
- Parameters:
other (Transformation) – The other transformation with which to compose.
- Return type:
- ar#
alias of
Transformation