About substitution of free occurances: can we have a substitution of an entire expression(function, application), or just of a variable:
Example:
- Current expression \x.\y.(y, z)
- Expression to be replaced: \y.(y z) with p so we will have \x.p.
Is it possible?
Yes, it is possible. One way is to consider the substitution of occurrences. An occurrence is a string over the set
{1,2,3}, and for every lambda-termM, the sub-expressionM/uat occurrenceuis defined as:M/[]=MM/0u=N/u, ifM=\x. NM/1u=P/u, ifM=PQM/2u=Q/u, ifM=PQ(I use the symbol
[]to denote the empty string.)Now define the substitution
M[u := N]as the term obtained from replacing the occurrenceuwithNinM. I've seen this kind of substitution in some of P.-L. Curien work.