Projection#

class discopy.closed.Projection(arg, index)[source]#

Bases: Compound

The projection onto one factor of a term with a Product type, which evaluation interprets by discarding the other factors.

Parameters:
  • arg (Term) – The term to project from, with a product type as codomain.

  • index (int) – The index of the factor to project onto.

Example

>>> X, Y = Ty("X"), Ty("Y")
>>> x, y = Variable("x", X), Variable("y", Y)
>>> assert Projection(Tuple(x, y), 1).cod == Y
property name#

The term as printed, computed once from its parts when first read.

property constants#

The constants of the term, in order of occurrence.