\DeclareMathAlphabet{\mathpzc}{OT1}{pzc}{m}{it}

\newcommand{\lecture}[1]{%
\title{\vspace{-.5in}#1}
\author{Ross Tate}
}
\newcommand{\homework}[1]{%
\title{\vspace{-.5in}#1}
\author{Ross Tate}
}

\newtheorem*{theorem}{Theorem}
\theoremstyle{definition}
\newtheorem*{definition}{Definition}
\newtheorem*{example}{Example}
\newtheorem{exercise}{Exercise}
\theoremstyle{remark}
\newtheorem*{notation}{Notation}
\newtheorem*{remark}{Remark}

\newcommand{\Type}{\mathtt{Type}}
\newcommand{\TYPE}[1]{\mathtt{Type}_{#1}}
\newcommand{\Prop}{\mathtt{Prop}}

\newcommand{\prf}[1]{\mathfrak{#1}}
\newcommand{\noprf}{\centerdot}

\newcommand{\alg}[1]{\mathcal{#1}}

\newcommand{\True}{\mathtt{true}}
\newcommand{\False}{\mathtt{false}}

\newcommand{\N}{\mathbb{N}}
\newcommand{\Z}{\mathbb{Z}}
\newcommand{\R}{\mathbb{R}}
\newcommand{\B}{\mathbb{B}}
\newcommand{\true}{\mathbb{t}}
\newcommand{\false}{\mathbb{f}}
\newcommand{\List}{\mathbb{L}}
\newcommand{\Multiset}{\mathbb{M}}
\newcommand{\Finset}{\mathbb{S}}
\newcommand{\Set}{\mathbb{P}}

\newcommand{\append}{\mathop{+\!+}}
\newcommand{\nil}{[~]}

\newcommand{\cocomp}{\mathop{;}}
\newcommand{\id}{\mo{id}}
\newcommand{\inv}{{\text{-}1}}

\newcommand{\imply}{\Rightarrow}

\newcommand{\cat}[1]{\mathbf{#1}}
\newcommand{\ob}[1]{\mathpzc{#1}}
\newcommand{\mo}[1]{\mathpzc{#1}}

\renewcommand{\to}{\mathrel{\chemarrow}}
\newcommand{\xto}[1]{\xrightarrow{#1}}
\newcommand{\xfrom}[1]{\xleftarrow{#1}}
\newcommand{\mto}{\rightarrow}
\newcommand{\mfrom}{\leftarrow}
\newcommand{\xmto}[1]{\xrightarrow{#1}}
\newextarrow{\xtwomto}{{5}{5}{5}{5}}{\bigRelbar\bigRelbar{\bigtwoarrowsright{\shortrightarrow}{\shortrightarrow}}}
\newextarrow{\xiso}{{5}{5}{5}{5}}{{\bigtwoarrowsleft{\relbar}{\shortleftarrow}}\bigRelbar{\bigtwoarrowsright{\shortrightarrow}{\relbar}}}

\newcommand{\mono}{\hookrightarrow}
\newextarrow{\xmono}{{10}{10}{10}{10}}{\lhook\relbar\shortrightarrow}

\newcommand{\ltor}{\shortrightarrow}
\newcommand{\rtol}{\shortleftarrow}

\newcommand{\nto}{\Rightarrow}
\newcommand{\expto}{\rightarrowtriangle}
\newcommand{\adjto}{\dashv}

\newcommand{\select}[4]{\mathtt{select~}#1\mathtt{~from~}#2\mathtt{~in~}#3\mathtt{~using~}#4}

\newcommand{\bang}{\mathord{\langle \rangle}}

\pgfdeclareshape{marrow}
{
 \inheritbehindbackgroundpath[from=isosceles triangle]
 \inheritbackgroundpath[from=isosceles triangle]
 \inheritbeforebackgroundpath[from=isosceles triangle]
 \inheritbehindforegroundpath[from=isosceles triangle]
 \inheritforegroundpath[from=isosceles triangle]
 \inheritbeforeforegroundpath[from=isosceles triangle]
 \inheritsavedanchors[from=isosceles triangle]
 \inheritanchorborder[from=isosceles triangle]
 \anchor{center}{
  \trianglepoints
  \pgfpointadd{\pgfpointscale{.5}{\pgfpointadd{\centerpoint}{\pgfmathrotatepointaround{\apexanchor}{\pgfpointorigin}{\rotate}}}}{\pgfpointscale{.5}{\pgfpointadd{\pgfpointscale{.5}{\pgfpointadd{\centerpoint}{\pgfmathrotatepointaround{\lowerleftanchor}{\pgfpointorigin}{\rotate}}}}{\pgfpointscale{.5}{\pgfpointadd{\centerpoint}{\pgfmathrotatepointaround{\lowerrightanchor}{\pgfpointorigin}{\rotate}}}}}}
 }
 \anchor{out}{%
  \trianglepoints%
	\pgfpointadd{\centerpoint}{\pgfmathrotatepointaround{\apexanchor}{\pgfpointorigin}{\rotate}}
 }%
 \newcommand{\inanchor}[2]{
  \anchor{#1}{
   \trianglepoints
	 \pgfpointadd{\pgfpointscale{#2}{\pgfpointadd{\centerpoint}{\pgfmathrotatepointaround{\lowerleftanchor}{\pgfpointorigin}{\rotate}}}}{\pgfpointscale{1-#2}{\pgfpointadd{\centerpoint}{\pgfmathrotatepointaround{\lowerrightanchor}{\pgfpointorigin}{\rotate}}}}
  }
 }
 \inanchor{in11}{.5}
 \inanchor{in12}{.3}
 \inanchor{in22}{.7}
 \inanchor{in13}{.15}
 \inanchor{in23}{.5}
 \inanchor{in33}{.85}
 \inanchor{in14}{.1}
 \inanchor{in24}{.35}
 \inanchor{in34}{.65}
 \inanchor{in44}{.9}
 \inanchor{in15}{.1}
 \inanchor{in25}{.3}
 \inanchor{in35}{.5}
 \inanchor{in45}{.7}
 \inanchor{in55}{.9}
}
\newcommand{\marrow}[2]{node[marrow,draw,name=#1,isosceles triangle stretches=true,minimum height=1cm,minimum width=1cm] {${#2}$}}

\newcommand{\twocell}[6][1.5cm]{
\!\!
\begin{tikzpicture}[baseline=(c1.base)]
\node(c1) at (0,0) {$#2$};
\node(c2) at (#1,0) {$#3$};
\draw[->] (c1) to[bend right=30] node(f1)[near start]{} node[below]{$#4$} (c2);
\draw[->] (c1) to[bend left=30] node(f2)[near start]{} node[above]{$#5$} (c2);
\draw[double,double equal sign distance,-implies] (f1) -- node[right]{$#6$} (f2);
\end{tikzpicture}
\!\!
}

\newcommand{\unlabeledtwocell}[5][1cm]{
\!\!
\begin{tikzpicture}[baseline=(c1.base)]
\node(c1) at (0,0) {$#2$};
\node(c2) at (#1,0) {$#3$};
\draw[->] (c1) to[bend right=30] node(f1){} node[below]{$#4$} (c2);
\draw[->] (c1) to[bend left=30] node(f2){} node[above]{$#5$} (c2);
\draw[double,double equal sign distance,-implies] (f1) -- (f2);
\end{tikzpicture}
\!\!
}