%THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{proof}
\usepackage{hyperref}
\newtheorem{lemma}{Lemma}
\newtheorem{corr}{Corollary}
\newenvironment{hint}{\noindent{\bf (Hint)}}{}
\newtheorem{thm}{Theorem}
\newtheorem{definition}{Definition}
\newtheorem{task}{Task}
\newtheorem{bonus}{Bonus Task}

\newif\ifsol

\newcommand{\makehwtitle}[4]
{{\centering\Large\textbf{Homework #1: #2}
    \normalsize\\
15-814: Types and Programming Languages\\
Fall 2015\\
TA: Evan Cavallo (ecavallo@cs.cmu.edu)\\
\ifsol \solcolor \textbf{SOLUTIONS} \normalcolor \\ \fi \vspace{0.5cm}%
Out: #3\\
Due: #4\\
}}

\newenvironment{proof}{\trivlist \item[\hskip \labelsep{\bf
Proof:}]}{\hfill$\Box$ \endtrivlist}

\newenvironment{sol}{
\trivlist \item[\hskip \labelsep{\bf
Solution:}]}{\endtrivlist}

\newcommand{\solution}[1]{\ifsol \begin{sol} #1 \end{sol} \fi}

\newcommand{\taskpts}[1]{[#1]}

\newenvironment{includeintemplate}{}{}
\newenvironment{noinclude}{}{}
\newcommand{\rulename}[1]{\text{\textsc{(#1)}}}
\newcommand{\einfer}[3]
        {\begin{equation}\label{eq:#1}\infer[]{#2}{#3}\end{equation}}

\allowdisplaybreaks       %mildly permissible to break up displayed equations
%% Propositions
\newtheorem{prop}{Proposition}

%% General
\newcommand{\textbsf}[1]{\textbf{\textsf{#1}}}
\newcommand{\Lang}[1]{\textbsf{#1}}
\newcommand{\kw}[1]{\ensuremath{\mathtt{#1}}}
\newcommand{\kwop}[1]{\ensuremath{\mathop{\mathtt{#1}}}}
\newcommand{\kwbin}[1]{\ensuremath{\mathbin{\mathtt{#1}}}}
\newcommand{\step}{\mapsto}
\newcommand{\G}{\Gamma}
\newcommand{\D}{\Delta}
\newcommand{\xv}{\vec{x}}
\newcommand{\entails}{\vdash}
\newcommand{\xvars}{\mathcal{X}}
\newcommand{\cdparens}[1]{\kw{(}{#1}\kw{)}}
\newcommand{\cdsqbracks}[1]{\kw{[}{#1}\kw{]}}
\newcommand{\cdcubracks}[1]{\kw{\{}{#1}\kw{\}}}
\newcommand{\OpAST}[2]{{#1}\cdparens{#2}}
\newcommand{\AbsAST}[2]{{#1}\cddot{#2}}
\newcommand{\OpABT}[2]{{#1}\cdparens{#2}}
\newcommand{\OpABTp}[3]{{#1}\cdcubracks{#2}\cdparens{#3}}
\newcommand{\OpABTpp}[4]{{#1}\cdcubracks{#2}\cdsqbracks{#3}\cdparens{#4}}
\newcommand{\OpABTn}[2]{{#1}\cdsqbracks{#2}}
\newcommand{\OpABTnn}[3]{{#1}\cdsqbracks{#2}\cdsqbracks{#3}}
\newcommand{\AbsABT}[2]{{#1}\cddot{#2}}
\newcommand{\pairff}[2]{{#1}\mathbin{\hookrightarrow}{#2}}
\newcommand{\eqdef}{\mathrel{\triangleq}}
\newcommand{\stepsto}{\mapsto}
\newcommand{\val}{\;\mathsf{val}}
\newcommand{\lequiv}[1]{\sim_{#1}}

%% Types
\newcommand{\tunit}{\mathtt{unit}}
\newcommand{\tsum}[2]{#1 + #2}
\newcommand{\tprod}[2]{#1 \times #2}
\newcommand{\tarrow}[2]{#1 \rightarrow #2}

%% Expressions
\newcommand{\lam}[3]{\lambda #1{:}#2. #3}
\newcommand{\ap}[2]{#1\; #2}
\newcommand{\inl}[1]{\OpABTp{\kw{in}}{l}{#1}}
\newcommand{\inr}[1]{\OpABTp{\kw{in}}{r}{#1}}
\newcommand{\caseop}{\kw{case}}
\newcommand{\ecase}[5]{\caseop\; #1\; \{#2. #3; #4. #5\}}
\newcommand{\eprod}[2]{\langle #1, #2 \rangle}
\newcommand{\triv}{\langle \rangle}
\newcommand{\projl}[1]{\kw{fst}\; #1}
\newcommand{\projr}[1]{\kw{snd}\; #1}

%% Nats and streams
\newcommand{\langns}{\Lang{LNS}}
\newcommand{\tnat}{\kw{nat}}
\newcommand{\zero}{\kw{z}}
\newcommand{\z}{\zero}
\newcommand{\sucop}{\kw{s}}
\newcommand{\suc}[1]{\OpAST{\sucop}{#1}}
\newcommand{\recop}{\kw{rec}}
\newcommand{\rec}[4]{\OpABT{\recop}{#1; #2; #3. #4}}
\newcommand{\altrecop}{\kw{rec'}}
\newcommand{\altrec}[5]{\OpABT{\altrecop}{#1; #2; #3. #4. #5}}
\newcommand{\natof}[1]{\overline{#1}}

\newcommand{\tstream}{\kw{stream}}
\newcommand{\hdop}{\kw{hd}}
\newcommand{\hd}[1]{\OpABT{\hdop}{#1}}
\newcommand{\tlop}{\kw{tl}}
\newcommand{\tl}[1]{\OpABT{\tlop}{#1}}
\newcommand{\strgenop}{\kw{strgen}}
\newcommand{\strgen}[5]{\strgenop\; #1\;
  \{\pairff{\hd{#2}}{#3} \mid \pairff{\tl{#4}}{#5}\}}

%% Generic programming
\newcommand{\fmapop}{\kw{map}}
\newcommand{\fmap}[2]{\OpABTp{\fmapop}{#1}{#2}}
\newcommand{\pos}{\; \mathsf{pos}}

%%Inductive and coinductive types
\newcommand{\langic}{\Lang{M}}
\newcommand{\tind}[2]{\mu #1. #2}
\newcommand{\tcoi}[2]{\nu #1. #2}
\newcommand{\tbool}{\kw{bool}}
\newcommand{\true}{\kw{true}}
\newcommand{\false}{\kw{false}}
\newcommand{\foldop}{\kw{fold}}
\newcommand{\fold}[2]{\OpABTp{\foldop}{#1}{#2}}
\newcommand{\grecop}{\kw{rec}}
\newcommand{\grec}[4]{\OpABTp{\grecop}{#1}{#2. #3; #4}}
\newcommand{\unfoldop}{\kw{unfold}}
\newcommand{\unfold}[2]{\OpABTp{\unfoldop}{#1}{#2}}
\newcommand{\genop}{\kw{gen}}
\newcommand{\gen}[4]{\OpABTp{\genop}{#1}{#2. #3; #4}}

\newcommand{\suspop}{\kw{susp}}
\newcommand{\tsusp}[1]{\suspop(#1)}
\newcommand{\susp}[1]{\OpABT{\suspop}{#1}}
\newcommand{\forceop}{\kw{force}}
\newcommand{\force}[1]{\OpABT{\forceop}{#1}}
\newcommand{\fixs}[2]{\OpABT{\fixop}{#1 . #2}}

%% Recursive Types
\newcommand{\langfpc}{\Lang{FPC}}
\newcommand{\tparr}[2]{#1 \rightharpoonup #2}
\newcommand{\trec}[2]{\OpABT{\kw{rec}}{#1 . #2}}
\newcommand{\fixop}{\kw{fix}}
\newcommand{\efix}[3]{\OpABTp{\fixop}{#1}{#2 . #3}}
\newcommand{\dummy}{\_}
\newcommand{\foldnp}[1]{\OpABT{\foldop}{#1}}
\newcommand{\unfoldnp}[1]{\OpABT{\unfoldop}{#1}}

%% Self-reference
\newcommand{\selfop}{\kw{self}}
\newcommand{\tself}[1]{\selfop(#1)}
\newcommand{\eself}[3]{\OpABTp{\selfop}{#1}{#2 . #3}}
\newcommand{\unrollop}{\kw{unroll}}
\newcommand{\unroll}[1]{\OpABT{\unrollop}{#1}}
\newcommand{\tlprod}[1]{\langle #1 \rangle}
\newcommand{\tlpair}[2]{\kw{#1} \hookrightarrow #2}
\newcommand{\elprod}[1]{\langle #1 \rangle}
\newcommand{\elpair}[2]{\kw{#1} \hookrightarrow #2}
\newcommand{\projname}[2]{#1 \cdot \mathtt{#2}}

%% PCF
\newcommand{\langpcf}{\Lang{PCF}}
\newcommand{\ifzop}{\kw{ifz}}
\newcommand{\ifz}[4]{\OpABT{\ifzop}{#1; #2; #3. #4}}
\newcommand{\Goedel}{G\"{o}del}
\newcommand{\gn}[1]{\lceil #1 \rceil}

%% System F
%%System F
\newcommand{\systemf}{System \Lang{F}}
\newcommand{\texists}[2]{\exists #1. #2}
\newcommand{\tforall}[2]{\forall #1. #2}
\newcommand{\tlam}[2]{\Lambda #1. #2}
