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/u
at occurrenceu
is defined as:M/[]
=M
M/0u
=N/u
, ifM=\x. N
M/1u
=P/u
, ifM=PQ
M/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 occurrenceu
withN
inM
. I've seen this kind of substitution in some of P.-L. Curien work.