Fixed Kestrel problems
This commit is contained in:
parent
b0bb202225
commit
2cd4b4e548
@ -2,43 +2,41 @@
|
|||||||
|
|
||||||
\definition{}
|
\definition{}
|
||||||
A \textit{free variable} in a $\lm$-expression is a variable that isn't bound to any input. \par
|
A \textit{free variable} in a $\lm$-expression is a variable that isn't bound to any input. \par
|
||||||
For example, $b$ is a free variable in $\lm a. b$. The same is true of $\star$ in any of the previous pages.
|
For example, $b$ is a free variable in $(\lm a.a)~b$.
|
||||||
|
|
||||||
A \textit{combinator} is a function with no free variables.
|
\definition{Combinators}
|
||||||
|
A \textit{combinator} is a lambda expression with no free variables.
|
||||||
|
|
||||||
|
\vspace{1mm}
|
||||||
|
|
||||||
\definition{The Kestrel}
|
|
||||||
|
|
||||||
Notable combinators are often named after birds.\hspace{-0.5ex}\footnotemark{} We've already met a few: \par
|
Notable combinators are often named after birds.\hspace{-0.5ex}\footnotemark{} We've already met a few: \par
|
||||||
The \textit{Idiot}, $I = \lm a.a$ \par
|
The \textit{Idiot}, $I = \lm a.a$ \par
|
||||||
The \textit{Mockingbird}, $M = \lm f.ff$ \par
|
The \textit{Mockingbird}, $M = \lm f.ff$ \par
|
||||||
The \textit{Cardinal}, $C = \lm fgx.(~ f(g(x)) ~)$
|
The \textit{Cardinal}, $C = \lm fgx.(~ f(g(x)) ~)$
|
||||||
|
The \textit{Kestrel}, $K = \lm ab . a$
|
||||||
\footnotetext{Raymond Smullyan's \textit{To Mock a Mockingbird} is responsible for this.}
|
|
||||||
|
|
||||||
\vspace{2ex}
|
|
||||||
|
|
||||||
Another notable combinator is $K$, the \textit{Kestrel}:
|
|
||||||
$$
|
|
||||||
K = \lm ab . a
|
|
||||||
$$
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
\problem{}
|
\problem{}
|
||||||
What does the Kestrel do? Explain in plain English. \par
|
If we give the Kestrel two arguments, it does something interesting: \par
|
||||||
\hint{What is $(K~\heartsuit~\star)$?}
|
It selects the first and rejects the second. \par
|
||||||
|
Convince yourself of this fact by evaluating $(K~\heartsuit~\star)$.
|
||||||
|
|
||||||
\vspace{2cm}
|
\vfill
|
||||||
|
|
||||||
\problem{}
|
\problem{}<kitedef>
|
||||||
Reduce $(K~I)$ to derive the \textit{Kite}. How does the Kite compare to the Kestrel? \par
|
Modify the Kestrel so that it selects its \textbf{second} argument and rejects the first. \par
|
||||||
We'll call the Kite KI.
|
|
||||||
|
|
||||||
\begin{solution}
|
\begin{solution}
|
||||||
$\text{KI} = \lm ab . b$.
|
$\lm ab . b$.
|
||||||
\end{solution}
|
\end{solution}
|
||||||
|
|
||||||
|
\vfill
|
||||||
|
|
||||||
|
\problem{}
|
||||||
|
We'll call the combinator from \ref{kitedef} the \textit{Kite}, $KI$. \par
|
||||||
|
Show that we can also obtain the kite by evaluating $(K~I)$.
|
||||||
|
|
||||||
|
|
||||||
\vfill
|
\vfill
|
||||||
\pagebreak
|
\pagebreak
|
Loading…
x
Reference in New Issue
Block a user