Nat

Contents

Nat#

class discopy.abc.Nat(n=0)[source]#

Bases: Monoid[Nat]

Nat is the free monoid on one generator, i.e. the natural numbers with addition as tensor. It is also a sequence over its unary encoding: __len__() gives back the natural number itself and slicing reads it off as a sequence of 1’s, e.g. Nat(3)[:1] == Nat(1).

Parameters:

n (int) – The natural number.