Substitution#
- class discopy.closed.Substitution(inside)[source]#
Bases:
builtins.objectThe simultaneous, capture-avoiding substitution of terms for variables.
- Parameters:
inside (Dict[Variable, Term]) – The term substituted for each variable, of the same type.
Example
>>> X, Y = Ty("X"), Ty("Y") >>> f, x, y = (X >> Y)("f"), Variable("x", X), Variable("y", X) >>> assert Substitution({x: y})(X(lambda y: f(x))) == X(lambda y_: f(y))