%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
%% 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{\xv}{\vec{x}}
\newcommand{\entails}{\vdash}
\newcommand{\xvars}{\mathcal{X}}
\newcommand{\cdparens}[1]{\kw{(}{#1}\kw{)}}
\newcommand{\cdbraces}[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}\cdbraces{#2}\cdparens{#3}}
\newcommand{\OpABTpp}[4]{{#1}\cdbraces{#2}\cdbraces{#3}\cdparens{#4}}
\newcommand{\OpABTn}[2]{{#1}\cdbraces{#2}}
\newcommand{\OpABTnn}[3]{{#1}\cdbraces{#2}\cdbraces{#3}}
\newcommand{\AbsABT}[2]{{#1}\cddot{#2}}
\newcommand{\pairff}[2]{{#1}\mathbin{\hookrightarrow}{#2}}
\newcommand{\eqdef}{\mathrel{\triangleq}}

%% judgments
\newcommand{\msteps}{\mapsto^*}
\newcommand{\steps}{\mapsto}
\newcommand{\val}[1]{#1~\mathsf{val}}
\newcommand{\typeJ}[2]{#1 : #2}
\newcommand{\issubst}{\Vdash}

%% reducibility
\newcommand{\Red}{\mathsf{Red}}
\newcommand{\natredop}{\downarrow}
\newcommand{\natred}[1]{#1\; \natredop}

%% Types
\newcommand{\tunit}{\mathtt{unit}}
\newcommand{\tvoid}{\mathtt{void}}
\newcommand{\tsum}[2]{#1 + #2}
\newcommand{\tprod}[2]{#1 \times #2}
\newcommand{\tarrow}[2]{#1 \rightarrow #2}
\newcommand{\tstring}{\mathtt{string}}
\newcommand{\tint}{\mathtt{int}}

%% Expressions
\newcommand{\lam}[3]{\lambda #1{:}#2. #3}
\newcommand{\ap}[2]{#1\; #2}
\newcommand{\inl}[1]{\mathtt{l} \cdot #1}
\newcommand{\inr}[1]{\mathtt{r} \cdot #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{\abort}[2]{\kw{abort}[#1](#2)}
\newcommand{\projl}[1]{#1 \cdot \mathtt{l}}
\newcommand{\projr}[1]{#1 \cdot \mathtt{r}}

%% Nats and streams
\newcommand{\langns}{\Lang{LNS}}
\newcommand{\langt}{\Lang{T}}
\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{\tstreamop}{\kw{stream}}
\newcommand{\tstream}[1]{\tstreamop\; #1}
\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}}
\newcommand{\poly}{\; \mathsf{poly}}

%%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}}

%% 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}

\newcommand{\epack}[3]{\kw{pack}\{#1\}\{#2\}(#3)}
\newcommand{\eopen}[6]{\kw{open}\{#1\}\{#2\}(#3;#4,#5.#6)}
