Function#

class discopy.python.finset.Function(inside, dom, cod)[source]#

Bases: discopy.abc.MonoidalCategory, collections.abc.Sequence

A function between finite sets encoded as a Python list.

Functions implement the standard Python sequence protocol.

Parameters:
  • inside (list[int]) – The list from range(cod) to range(dom).

  • dom (Nat) – The size of domain of the function.

  • cod (Nat) – The size of codomain of the function.

Summary

id([x])

then(other)

tensor(other)

swap(x, y)

is_swap()

Whether this is the permutation (1, 0), callable on a raw sequence as well as on a Function with a two-wire domain.

copy(x[, n])

ob#

alias of Nat

is_swap()[source]#

Whether this is the permutation (1, 0), callable on a raw sequence as well as on a Function with a two-wire domain.

Return type:

bool