From e4706d41e752274662eb0e393e68e0dbcc617a61 Mon Sep 17 00:00:00 2001 From: Mark Date: Sun, 22 Oct 2023 20:19:24 -0700 Subject: [PATCH] Fixed a few errors --- Advanced/Lambda Calculus/parts/00 intro.tex | 25 ++++++++++++--------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/Advanced/Lambda Calculus/parts/00 intro.tex b/Advanced/Lambda Calculus/parts/00 intro.tex index 5d028dc..101a96e 100755 --- a/Advanced/Lambda Calculus/parts/00 intro.tex +++ b/Advanced/Lambda Calculus/parts/00 intro.tex @@ -178,7 +178,6 @@ Reduce the following expressions. \par \textbf{Solution for $(I~I)$:}\par Recall that $I = \lm x.x$. First, we rewrite the left $I$ to get $(\lm x . x )~I$. \par Applying this function by replacing $x$ with $I$, we get $I$: - $$ I ~ I = (\lm x . \tzm{b}x )~\tzm{a}I = @@ -193,11 +192,7 @@ Reduce the following expressions. \par \draw[->,gray,shorten >=5pt,shorten <=3pt] (a.center) to (b.east); \end{tikzpicture} - $$ - \vspace{0.5mm} - - So, $I~I$ reduces to itself. This makes sense, since the identity - function doesn't change its input! + $$\null \end{examplesolution} @@ -214,11 +209,20 @@ Rewrite the following expressions with as few parentheses as possible, without c Remember that lambda calculus is left-associative. \vspace{2mm} \begin{itemize}[itemsep=2mm] - \item $(\lm x. (\lm y. \lm (z. ((xz)(yz)))))$ + \item $(\lm x. (\lm y. \lm z. ((xz)(yz))))$ \item $((ab)(cd))((ef)(gh))$ \item $(\lm x. ((\lm y.(yx))(\lm v.v)z)u) (\lm w.w)$ \end{itemize} +\begin{solution} + $(\lm x. ((\lm y.(yx))(\lm v.v)z)u) (\lm w.w) \implies (\lm x. (\lm y.yx) (\lm v.v)~z~u) \lm w.w$ + + \vspace{2mm} + + It's important that a function's output (everything after the dot) will continue until we hit a close-paren. + This is why we need the parentheses in the above example. +\end{solution} + \vfill \pagebreak @@ -317,17 +321,18 @@ We've already seen this on the previous page: $K$ takes an input $x$ and uses it You can think of $K$ as a \say{factory} that constructs functions using the input we provide. \problem{} -Let $C = \lm f. \Bigl[\lm g. \Bigl( \lm x. [~ g(f(x)) ~] \Bigr)\Bigr]$. For now, we'll call it the \say{composer.} +Let $C = \lm f. \Bigl[\lm g. \Bigl( \lm x. [~ f(g(x)) ~] \Bigr)\Bigr]$. For now, we'll call it the \say{composer.} \par +\note[Note]{We could also call $C$ the \say{right-associator.} Why?} \vspace{1mm} -Note that $C$ has three \say{layers} of curry: it makes a function ($\lm g$) that makes another function ($\lm x$). \par +$C$ has three \say{layers} of curry: it makes a function ($\lm g$) that makes another function ($\lm x$). \par If we look closely, we'll find that $C$ pretends to take three arguments. \vspace{1mm} What does $C$ do? Evaluate $(C~a~b~x)$ for arbitary expressions $a, b,$ and $x$. \par -\hint{Place parentheses first. Remember, function application is left-associative.} +\hint{Evaluate $(C~a)$ first. Remember, function application is left-associative.} \vfill