Advanced handouts
Add missing file Co-authored-by: Mark <mark@betalupi.com> Co-committed-by: Mark <mark@betalupi.com>
This commit is contained in:
		
							
								
								
									
										42
									
								
								src/Advanced/Lambda Calculus/parts/01 combinators.tex
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										42
									
								
								src/Advanced/Lambda Calculus/parts/01 combinators.tex
									
									
									
									
									
										Executable file
									
								
							@ -0,0 +1,42 @@
 | 
			
		||||
\section{Combinators}
 | 
			
		||||
 | 
			
		||||
\definition{}
 | 
			
		||||
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.a)~b$.
 | 
			
		||||
 | 
			
		||||
\definition{Combinators}
 | 
			
		||||
A \textit{combinator} is a lambda expression with no free variables.
 | 
			
		||||
 | 
			
		||||
\vspace{1mm}
 | 
			
		||||
 | 
			
		||||
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{Mockingbird}, $M = \lm f.ff$ \par
 | 
			
		||||
The \textit{Cardinal}, $C = \lm fgx.(~ f(g(x)) ~)$
 | 
			
		||||
The \textit{Kestrel}, $K = \lm ab . a$
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
\problem{}
 | 
			
		||||
If we give the Kestrel two arguments, it does something interesting: \par
 | 
			
		||||
It selects the first and rejects the second. \par
 | 
			
		||||
Convince yourself of this fact by evaluating $(K~\heartsuit~\star)$.
 | 
			
		||||
 | 
			
		||||
\vfill
 | 
			
		||||
 | 
			
		||||
\problem{}<kitedef>
 | 
			
		||||
Modify the Kestrel so that it selects its \textbf{second} argument and rejects the first. \par
 | 
			
		||||
 | 
			
		||||
\begin{solution}
 | 
			
		||||
	$\lm ab . b$.
 | 
			
		||||
\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
 | 
			
		||||
\pagebreak
 | 
			
		||||
		Reference in New Issue
	
	Block a user