%! TEX root = LC.tex % vim: tw=50 % 13/11/2024 11AM \begin{fclemma}[] \label{lemma:2.1.6} % Lemma 2.1.6 Assuming: - $M \tob N$ Then: $M^{\tstar} \tobev N^{\tstar}$. \end{fclemma} \begin{proof} Induction over the structure of $M$. We'll leave the easier cases as exercises, and focus on when $M$ is a \gls{redex}, or when $M = P_1 P_2$, where $P_1$ is not a \gls{lab} and $N = Q_1 P_2$ with $P_1 \tob Q_1$. Suppose that $M = (\lambda x . P_1) P_2$ is a \gls{redex}. Then there are three possibilities for $N$. \begin{enumerate}[(1)] \item $N = P_1\subst[x \defeq P_2]$: here $M^{\tstar} \tobev N^{\tstar}$ by the previous lemma. \item $N = (\lambda x . Q_1) P_2$, where $P_1 \tob Q_1$: here $N^{\tstar} = Q_1^{\tstar} \subst[x \defeq P_2^{\tstar}]$. By the induction hypothesis, $P_1^{\tstar} \tobev Q_1^{\tstar}$, so \[ M^{\tstar} = P_1^{\tstar} \subst[x \defeq P_2^{\tstar}] \tobev Q_1^{\tstar} \subst[x \defeq P_2^{\tstar}] = N .\] \item $N = (\lambda x . Q_1) Q_2$, where $P_2 \tob Q_2$: is similar. \end{enumerate} Now suppose $M = P_1 P_2$, where $P_1$ is not a \gls{lab}, and $N = Q_1 P_2$ with $P_1 \tob Q_1$. Here $M^{\tstar} = P_1^{\tstar} P_2^{\tstar}$. If $Q_1$ is not a \gls{lab}, the result is clear. So let $Q_1 = \lambda y . R$. Applying the induction hypothesis to $P_1 \tob \lambda y . R$, we get $P_1^{\tstar} \tobev \lambda y . R^{\tstar}$. Thus \[ M^{\tstar} = P_1 ^{\tstar} P_2^{\tstar} \tobev (\lambda y . R^{\tstar}) P_2^{\tstar} \tob R^{\tstar} \subst[y \defeq P_2^{\tstar}] = N^{\tstar} . \qedhere \] \end{proof} \begin{fccoro}[] % Corollary 2.1.7 If $M \tobev N$, then $M^{\tstar} \tob N^{\tstar}$. \end{fccoro} \begin{proof} Induction over the length of the chain $M \tobev N$, using \cref{lemma:2.1.6}. \end{proof} Applying this multiple times, $M \tobev N$ implies $M^{\tstar[n]} \tobev N^{\tstar[n]}$ for all $n < \omega$. \begin{fcthm}[] \label{thm:2.1.8} % Theorem 2.1.8 Assuming: - $M$ $\beta$-\gls{red} to $N$ in $n$ steps Then: $N \tobev M^{\tstar[n]}$. \end{fcthm} \begin{proof} By induction over $n$. The base case is clear, as $n = 0$ implies $M = N$. For $n > 0$, there is a \gls{uterm} $R$ with $M \tob R \to_{(n - 1)\beta} N$. By induction hypothesis, $N \tobev R^{\tstar[n - 1]}$. Since $M \tob R$, we have $R \tobev M^{\tstar}$ by \cref{lemma:2.1.4}. Thus we get $R^{\tstar[n - 1]} \tobev M^{\tstar[n]}$ by the previous observation. Putting it all together: \[ N \tobev R^{\tstar[n - 1]} \tobev M^{\tstar[n]} . \qedhere \] \end{proof} \begin{fcthm}[Church, Rosser, 1936] % Theorem 2.1.9 Assuming: - $M, N_1, N_2$ are \glspl{ulterm} such that $M \tobev N_1, N_2$ Then: there is a \gls{ulterm} $N$ such that $N_1, N_2 \tobev N$. \end{fcthm} \begin{proof} Say $M \to_{r\beta} N_1$, $M \to_{s\beta} N_2$. Without loss of generality, say $r \le s$. By \cref{thm:2.1.8}, we have that $N_1 \tobev M^{\tstar[r]}$ and $N_2 \tobev M^{\tstar[s]}$. But $M^{\tstar[r]} \tobev M^{\tstar[s]}$ by successive applications of \cref{lemma:2.1.4} (as $r \le s$). So take $N = M^{\tstar[s]}$. \end{proof} Reminder of the picture to think of: \begin{picmath} \begin{tikzcd} & M \ar[ld, "s\beta", swap] \ar[rd, "r\beta"] \\ N_2 \ar[rdd, two heads, "\beta", swap] & & N_1 \ar[d, two heads, "\beta"] \\ & & M^{r*} \ar[ld, two heads, "\beta"] \\ & M^{s*} \end{tikzcd} \end{picmath} This has some important consequences: \begin{itemize} \item If $M \equivb N$, then they $\tobev$ to the same \gls{uterm}; \item If the \gls{bnf} of a \gls{uterm} exists, it is unique; \item We can use this to show that two \glspl{uterm} are not $\beta$-equivalent. \end{itemize} \begin{example*} $\lambda x . x$ and $\lambda x . \lambda y . x$ are different \glspl{uterm} in \gls{bnf}, so they can't be $\beta$-equivalent. \end{example*} \begin{fcdefn}[Church numeral] \glsnoundefn{cn}{Church numeral}{Church numerals}% \glssymboldefn{cn}% % Definition 2.1.10 Let $n$ be a natural number. Its corresponding \emph{Church numeral} $c_n$ is the \gls{ulterm} $c_n \defeq \lambda s . \lambda z . s^n(z)$, where $s^n(z)$ denotes \[ \ub{s(s(\ldots(s}_{\text{$n$ times}}z)\ldots) .\] \end{fcdefn} \begin{example} % Example 2.1.11 $\cn_0 = \lambda s . \lambda z . z$ is the `function' that takes $s$ to the identity map. $\cn_1 = \lambda s . \lambda z . \lambda s(z)$ is the `function' that takes $s$ to itself. $\cn_2 = \lambda s . \lambda z . ss(z)$ takes a function $s$ to its $2$-fold composite $z \mapsto s(s(z))$. \end{example} \begin{fcdefn}[lambda-definability] % Definition 2.1.2 \glsadjdefn{ldef}{$\lambda$-definable}{function}% \glsnoundefn{ldefine}{$\lambda$-define}{$\lambda$-defines}% A partial function $f : \Nbb^k \to \Nbb$ is \emph{$\lambda$-definable} if there is a \gls{ulterm} $F$ such that $F \cn_{n_1} \ldots \cn_{n_k} \equivb \cn_{f(n_1, \ldots, n_k)}$. \end{fcdefn} \begin{fcprop}[Rosser] % Proposition 2.1.3 Define the following \gls{ulterm}: \begin{citems} \item $A_+ \defeq \lambda x . \lambda y . \lambda s . \lambda z . xs(ys(z))$, \item $A_* \defeq \lambda x . \lambda y . \lambda s . x(ys)$, \item $A_e \defeq \lambda x . \lambda y . yx$. \end{citems} Then for all $n, m \in \Nbb$: \begin{citems} \item $A_+ \cn_n \cn_m \equivb \cn_{n + m}$; \item $A_* \cn_n \cn_m \equivb \cn_{nm}$; \item $A_e \cn_n \cn_m \equivb \cn_{n^m}$ if $m > 0$. \end{citems} \end{fcprop}