Variable#

class discopy.biclosed.Variable(name, cod)[source]#

Bases: TermBase

A variable with a string as name and a Ty.

Parameters:
  • name (str)

  • cod (Ty)

name#

The name of the variable

Type:

str

cod#

The type of the variable.

Type:

Ty

classmethod fresh(name, cod, *terms)[source]#

A variable of a given type whose name is not free in any of the terms, underscores being appended to the name until it is not.

Parameters:
  • name – The name to start from.

  • cod – The type of the variable.

  • terms – The terms in which the variable must not be free.

Example

>>> x = Ty("x")
>>> assert Variable.fresh("v", x, Variable("v", x))\
...     == Variable("v_", x)