\documentclass[11pt]{article}

\usepackage{times,mathptm}
\pagestyle{myheadings}



\parindent 0in
\setlength{\parindent}{0in}
\setlength{\parskip}{1ex}

\topmargin -0.1in \headheight\baselineskip
\textheight 8.5in         % 1in top and bottom margin
\textwidth 6.5in        % 1in left and right margin
\oddsidemargin 0in
\evensidemargin 0in




\usepackage{amsmath}
\usepackage{amssymb}


% \setlength{\itemsep}{0pt}

\markright{\footnotesize CS 451 Programming Paradigms, Spring 2001}

\begin{document}

\section*{Project~2: Programming in ML, Prolog, and the $\lambda$-calculus --- due Monday 30 April}

Total number of points available on this project is 200. Full credit
is equivalent to 0 points. In other words, this project is entirely optional.

One goal of this  project is to establish that logic programming languages and
functional programming languages have equal expressive power, if not equal
expressive convenience. Another goal is to establish that pure $\lambda$-calculus
has equal expressive power as any functional programming languages, though
it's cumbersome to use.

In class we discussed an implementation of a unification algorithm and of
an interpreter for the Prolog core language (pure logic programming). The code
is available through the course web site.

In Project~1 you implemented an interpreter for pure $\lambda$-calculus in ML.

Tasks:

\begin{enumerate}

\item (30 pts.)

Write an interpreter $\lambda_P$ for pure $\lambda$-calculus in Prolog. 
Test, debug, and run
under SWI-Prolog, using the same $\lambda$-term reductions as in Project~1.

This should be a straightforward translation into Prolog of the program you
wrote in ML for Project~1. You may leave out the fancy input and output handling.


\item (60 pts.)

Write an interpreter ${\hat{P}}_{\lambda}$ for the Prolog core language in 
pure $\lambda$-calculus. This should be a straightforward rendering
(desugaring) of the interpreter we showed in class. 
Test, debug, and run under the interpreter for pure $\lambda$-calculus that you
wrote in Project~1, using the various Prolog programs you wrote earlier (recognizers
for regular, context-free, and context-sensitive languages).

For efficiency reasons,
it may be useful to have built-in lists in the interpreter for pure 
$\lambda$-calculus. It certainly will be useful to have strictness
anotations; since original code is in ML, most of the $\lambda$-abstractions
you write can be strict.


\item (10 pts.)

If you wrote $\lambda_P$ so that it uses features of Prolog ($P$) not present
in the Prolog core language ($\hat{P}$), for instance, the cut (\texttt{!}),
rewrite it so it doesn't, and call the result ${\lambda}_{\hat{P}}$.


\item (30 pts.)

Test, debug, and run ${\lambda}_{\hat{P}}$ on top of ${\hat{P}}_{\lambda}$.

\item (30 pts.)

Test, debug, and run ${\hat{P}}_{\lambda}$ on top of ${\lambda}_{\hat{P}}$.


\item (40 pts.)

Report your observations about the speed of various interpreters, 
ease of implementation,
syntactic representation of core-Prolog terms and $\lambda$-terms, 
etc.


\end{enumerate}

\end{document}

