Substitution of M in Beta Reduction (Lambda Calculus)

30 Views Asked by At

I am preparing for an exam where I have a Beta reduction question. The question goes as follows:

$M=(\lambda xy.x(\lambda z.xyz))(\lambda x .xz )(\lambda y.ya)$

I have been working this out and following a solution from my professor. If you notice in the photo below, I am at a point like this:

$\xrightarrow{}_\beta yz[y\leftarrow (\lambda z^\prime.(\lambda y.yz)(\lambda z.z)z^\prime)]$

From here, I assume I substitute all of $y$ with the right hand side

$\xrightarrow{}_\text{sub} (\lambda z^\prime.(\lambda y.yz)(\lambda z.z)z^\prime)z$

Notice the final $z$ initially from $yz$. In my professor's solution, she drops that final $z$. Is this a mistake? Or is it correct to drop that z?

Beta reduction problem on paper