Question

Given the following expression :

((λx.λx.xx) (λx.xzx)) (λy.yy)

I want to find its normal form using beta reduction.

My calculation :

((λx.λx.xx) (λx.xzx)) (λy.yy) ->
((λx.xzx)(λx.xzx)) (λy.yy) -> ((λx.xzx)z(λx.xzx)) (λy.yy) ->
(zzz (λx.xzx)) (λy.yy) -> ?

But how can I continue from here :

(zzz (λx.xzx)) (λy.yy) -> ?

Thanks

Was it helpful?

Solution

Using \ to represent λ:

((\x.\x.xx) (\x.xzx)) (\y.yy) =
= ((*\x*.\x.xx) *(\x.xzx)*) (\y.yy) =
= (\x.( (\x.xzx) (\x.xzx) )) (\y.yy) =
= (\x.( (*\x*.xzx) *(\x.xzx)* )) (\y.yy) =
= (\x.( (\x.xzx) z (\x.xzx) )) (\y.yy) =
= (\x.( ( (\x.xzx) z) (\x.xzx) )) (\y.yy) =
= (\x.( ( (*\x*.xzx) *z*) (\x.xzx) )) (\y.yy) =
= (\x.( ( (zzz) (\x.xzx) ) (\y.yy) =
= (*\x*.( ( (zzz) *(\x.xzx)* ) (\y.yy) =
= (zzz) (\x.( (\y.yy) z (\y.yy) )) =
= (zzz) (\x.( ((\y.yy) z) (\y.yy) )) =
= (zzz) (\x.( ((*\y*.yy) *z*) (\y.yy) )) =
= (zzz) (\x.( (zz) (\y.yy) )) =
= (zzz) (\x.(zz)(\y.yy))

And there's no further application available here -- at least, as long as you don't have definitions for z.

Notice, also, that there is an x definition in the final expansion, which you might've suppressed during your calculations.

All the variables (λx . λx . xx) have in common in the expression:

((*λx*.*λx*.xx) (λx.xzx)) (λy.yy)

are their names. They're different variables nonetheless.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top