Ty#

class discopy.closed.Ty(*inside)[source]#

Bases: discopy.monoidal.Ty

A closed type is a monoidal type that can be exponentiated.

Parameters:

inside (Ty) – The objects inside the type.

Note

We can exponentials of types.

>>> x, y, z = Ty(*"xyz")
>>> print((x ** y) ** z)
((x ** y) ** z)

We can also distinguish left- and right-exponentials.

>>> print((x >> y) << z)
((x >> y) << z)
property is_exp#

Whether the type is an Exp object.

Example

>>> x, y = Ty('x'), Ty('y')
>>> assert (x ** y).is_exp and (x ** y @ Ty()).is_exp
property is_under#

Whether the type is an Under object.

Example

>>> x, y = Ty('x'), Ty('y')
>>> assert (x >> y).is_under and (x >> y @ Ty()).is_under
property is_over#

Whether the type is an Over object.

Example

>>> x, y = Ty('x'), Ty('y')
>>> assert (x << y).is_over and (x << y @ Ty()).is_over
factory#

alias of Ty