lambda expression reduces to x but how?

80 Views Asked by At

I must be missing a rule to beta reduction, because I don't understand the following reduction.

(\y.x) z 

This reduces to x. Why?

(\x.x) z 

This reduces to z. Why does the above expression reduce to x?

1

There are 1 best solutions below

0
On BEST ANSWER

To reduce (\y.x) z you "replace every instance of the lambda'ed variable (y) with the expression you're evaluating it at (z)". There are no instances of y in x, so you just get x.

Note that I'm assuming there are no ys in x. If x is some expression that does contain y that reduction would be incorrect.