\documentclass[11pt]{article}

\input{hw8-macros.tex}
\toggletrue{sol}

\title{15-814 Homework 8}
\author{YOUR NAME HERE}

\begin{document}
\maketitle

\begin{task}[0 points]
  How long did you spend on this assignment?
  Please list the questions that you discussed with classmates using the whiteboard policy.
\end{task}
\begin{solution}
\end{solution}

\begin{task}[10 points, WB]
  Give an exponentiation function
  \[
    \ms{exp} : \Tbin \to \Tbox{(\Tbin \to \Tbin)}
  \]
  where the first argument of type $\Tbin$ is the exponent and the other argument is the base.
\end{task}
\begin{solution}
\end{solution}

\begin{task}[10 points, WB]
  Give a multiplication function
  \[
    \ms{mult} : \Tbin \to \Tbox{(\Tbin \to \Tbin)}.
  \]
  If this cannot be done, briefly explain why.
\end{task}
\begin{solution}
\end{solution}

\begin{task}[10 points, WB]
  For each of the following types $\tau$, define a closed term $\ms{lift}_\tau : \tau \to \Tbox{\tau}$ satisfying $ v \kleene (\ms{eval} \circ \ms{lift}_\tau)(v)$ for all values $v : \tau$.
  If this cannot be done for a particular $\tau$, briefly and informally explain why.
  \begin{enumerate}
  \item $\tau = \Tbin$,
  \item $\tau = \Teprod{\Tbin}{\Tbin}$, and
  \item $\tau = \Tlprod{\Tbin}{\Tbin}$.
  \end{enumerate}
\end{task}
\begin{solution}
\end{solution}

\begin{task}[10 points, WB]
  Annotate the following proof with proof terms:
  \[
    \infer[\Iimp^f]{
      \fillmein[] : (B \limplies C) \limplies (A \limplies B) \limplies (A \limplies C)
    }{
      \infer[\Iimp^g]{
        \fillmein[] : (A \limplies B) \limplies (A \limplies C)
      }{
        \infer[\Iimp^a]{
          \fillmein[] : A \limplies C
        }{
          \infer[\Eimp]{
            \fillmein[] : C
          }{
            \infer[f]{\fillmein[] : B \limplies C}{\mathstrut}
            &
            \infer[\Eimp]{
              \fillmein[] : B
            }{
              \infer[g]{\fillmein[] : A \limplies B}{\mathstrut}
              &
              \infer[a]{\fillmein[] : A}{\mathstrut}
            }
          }
        }
      }
    }
  \]
\end{task}
\begin{solution}
\end{solution}

\begin{task}[10 points, WB]
  For each of the following proof terms witnessing the proposition $(\ltrue \land \ltrue) \limplies (\lfalse \lor \ltrue) \limplies (\ltrue \land \ltrue)$, give the corresponding natural deduction proof.
  \begin{enumerate}
  \item $\lambda x. \lambda y.\lpair{\outl x}{\lunit}$,
  \item $\lambda x.\lambda y.\bscase{y}{w}{\zcase{w}}{v}{\lpair{v}{v}}$.
  \end{enumerate}
  Make sure to label all of your inferences with the names of the rule you used ($\Iimp^x$, $x$, $\Eimp$, $\Iand$, $\Eand_1$, $\Eand_2$, $\Ior_1$, etc.).
\end{task}
\begin{solution}
\end{solution}

\begin{task}[10 points, WB]
  For each of the following proof terms, give the most general proposition it witnesses:
  \begin{enumerate}
  \item $\lambda x. \lambda y.\lpair{\outl x}{\lunit}$,
  \item $\lambda x.\lambda y.\bscase{y}{w}{\zcase{w}}{v}{\lpair{v}{v}}$.
  \end{enumerate}
\end{task}
\begin{solution}
\end{solution}

\end{document}