\section{Recursion} Say we want a function that computes the factorial of a positive integer. Here's one way we could define it: $$ x! = \begin{cases} x \times (x-1)! & x \neq 0 \\ 1 & x = 0 \end{cases} $$ We cannot re-create this in lambda calculus, since we aren't given a way to recursively call functions. \vspace{2mm} One could think that $A = \lm a. A~a$ is a recursive function. In fact, it is not. \par Remember that such \say{definitions} aren't formal structures in lambda calculus. \par They're just shorthand that simplifies notation. \begin{instructornote} We're talking about recursion, and \textit{computability} isn't far away. At one point or another, it may be good to give the class a precise definition of \say{computable by lambda calculus:} \vspace{4ex} Say we have a device that reduces a $\lm$ expression to $\beta$-normal form. We give it an expression, and the machine simplifies it as much as it can and spits out the result. \vspace{1ex} An algorithm is \say{computable by lambda calculus} if we can encode its input in an expression that resolves to the algorithm's output. \end{instructornote} \problem{} Write an expression that resolves to itself. \par \note{Your answer should be quite short.} \vspace{1ex} This expression is often called $\Omega$, after the last letter of the Greek alphabet. \par $\Omega$ useless on its own, but it gives us a starting point for recursion. \begin{solution} $\Omega = M~M = (\lm x . xx) (\lm x . xx)$ \vspace{1ex} An uninspired mathematician might call the Mockingbird $\omega$, \say{little omega}. \end{solution} \vfill \definition{} This is the \textit{Y-combinator}, easily the most famous $\lm$ expression. \par You may notice that it's just $\Omega$, put to work. $$ Y = \lm f . (\lm x . f(x~x))(\lm x . f(x~x)) $$ \problem{} What does this thing do? \par Evaluate $Y f$. \vfill \pagebreak