Ty

Contents

Ty#

class discopy.interaction.Ty(positive=None, negative=None)[source]#

Bases: discopy.utils.Result

An integer type is a pair of natural types.

Parameters:
  • positive (natural) – The positive half of the type.

  • negative (natural) – The negative half of the type.

Note

Integer types are parameterised by natural types, e.g.

>>> from discopy.abc import Nat
>>> assert Ty == Ty[pivotal.Ty] and Ty[Nat].natural == Nat

The prefix operator - reverses positive and negative, e.g.

>>> x, y, z = (Ty[Nat](Nat(n)) for n in (1, 2, 3))
>>> assert x @ -y @ z == Ty[Nat](Nat(1) @ Nat(3), Nat(2))
natural#

alias of Ty