\usepackage{mathpartir}
\usepackage{ifpdf}
\usepackage{epsfig}
\usepackage{pst-node}
\usepackage{alltt}

\newtheorem{theorem}{Theorem}
\newtheorem{lemma}{Lemma}
\newtheorem{corollary}{Corollary}
\newtheorem{definition}{Definition}
\newtheorem{proposition}{Proposition}
\newtheorem{conjecture}{Conjecture}

\ifpdf
\DeclareGraphicsRule{*}{mps}{*}{}
\else
\DeclareGraphicsRule{*}{eps}{*}{}
\fi

% BS FIXME
\newcommand\citet[1]{\cite{#1}}

\newcommand\kcfa{\texorpdfstring{$k$}{k}CFA}

%% Complexity classes
% \newcommand\ptime{\texorpdfstring{{\sc ptime}}{PTIME}}
% \newcommand\twonpda{\texorpdfstring{{\sc 2npda}}{2NPDA}}
% \newcommand\pspace{\texorpdfstring{{\sc pspace}}{PSPACE}}
% \newcommand\dtime{{\sc dtime}}
% \newcommand\ntime{{\sc ntime}}
% \newcommand\dspace{{\sc dspace}}
% \newcommand\np{\texorpdfstring{{\sc nptime}}{NPTIME}}
% \newcommand\nc{{\sc nc}}
% \newcommand\exptime{\texorpdfstring{{\sc exptime}}{EXPTIME}}
% \newcommand\logspace{\texorpdfstring{{\sc logspace}}{LOGSPACE}}

\newcommand\ptime{PTIME}
\newcommand\twonpda{2PNDA}
\newcommand\pspace{PSPACE}
\newcommand\dtime{DTIME}
\newcommand\ntime{NTIME}
\newcommand\dspace{DSPACE}
\newcommand\np{NPTIME}
\newcommand\nc{NC}
\newcommand\exptime{EXPTIME}
\newcommand\logspace{LOGSPACE}

%% CFA notation
\newcommand\Lab{\mathbf{Lab}}
\newcommand\Env{\mathbf{Env}}
\newcommand\Clos{\mathbf{Clos}}
\newcommand\CClos{\mathbf{CClos}}
\newcommand\CEnv{\mathbf{CEnv}}
\newcommand\Cache{\mathbf{Cache}}
\newcommand\ACache{\mathbf{\widehat{Cache}}}
\newcommand\Var{\mathbf{Var}}
\newcommand\Val{\mathbf{Val}}
\newcommand\Exp{\mathbf{Exp}}
\newcommand\Unit{\mathbf{Unit}}
\newcommand\Term{\mathbf{Term}}
\newcommand\cache{\widehat{\mathsf{C}}}
\newcommand\ecache{\mathsf{C}}          %% Exact cache wears no hat.
\newcommand\eenv{\mathsf{r}}
\newcommand\aenv{\hat{\mathsf{r}}}
\newcommand\env{\widehat{\rho}}
\newcommand\ce{\rho}
\newcommand\emptyenv{\bullet}
\newcommand\kmodels[2]{\models^{#1}_{#2}}
\newcommand\fv[1]{\ensuremath{\mathbf{fv}(#1)}}
\newcommand\bv[1]{\ensuremath{\mathbf{bv}(#1)}}

% Eval like functions
\newcommand\evalf[1][]{\ensuremath{\mathcal{E}{#1}}}
\newcommand\ivf{\ensuremath{\mathcal{I}}}
\newcommand\avf{\ensuremath{\mathcal{A}}}
\newcommand\eval[2][]{\ensuremath{\mathcal{E}{#1}\sem{#2}}}
\newcommand\iv[1]{\ensuremath{\mathcal{I}\sem{#1}}}
\newcommand\ev[3]{\ensuremath{\evalf\sem{#1}^{#2}_{#3}}}
\newcommand\av[4][]{\ensuremath{\avf{#1}\sem{#2}^{#3}_{#4}}}
\newcommand\avz[1]{\av[_0]{#1}\empty\empty}
\newcommand\avk[3]{\av[_k]{#1}{#2}{#3}}
\newcommand\evz[1]{\ensuremath{\mathcal{E}\sem{#1}}}

\newcommand\dom[1]{\ensuremath{\mathbf{dom}(#1)}}
\newcommand\sem[1]{\ensuremath{\llbracket #1\rrbracket}}
\newcommand\lab[1]{\ensuremath{\mathbf{lab}(#1)}}
\newcommand\restrict{\ensuremath{\!\upharpoonright\!}}
\newcommand{\loves}{\ensuremath{\vdash}}
\newcommand\unknown{\ensuremath{\mathit{unknown}}}

%% Boolean codings
\newcommand\True{\ensuremath{\mbox{\tt True}}}
\newcommand\False{\ensuremath{\mbox{\tt False}}}
\newcommand\TT{\ensuremath{\mbox{\tt tt}}}
\newcommand\FF{\ensuremath{\mbox{\tt ff}}}
\newcommand\Not{\ensuremath{\mbox{\tt Not}}}
\newcommand\Copy{\ensuremath{\mbox{\tt Copy}}}
\newcommand\Implies{\ensuremath{\mbox{\tt Implies}}}
\newcommand\AND{\ensuremath{\mbox{\tt And}}}
\newcommand\Andgate{\ensuremath{\mbox{\tt Andgate}}}
\newcommand\Or{\ensuremath{\mbox{\tt Or}}}
\newcommand\Orgate{\ensuremath{\mbox{\tt Orgate}}}
\newcommand\Notgate{\ensuremath{\mbox{\tt Notgate}}}
\newcommand\Copygate{\ensuremath{\mbox{\tt Copygate}}}
\newcommand\Implgate{\ensuremath{\mbox{\tt Impliesgate}}}

\newcommand\Widget{\ensuremath{\mbox{\tt Widget}}}
\newcommand\Extract{\ensuremath{\mbox{\tt Extract}}}
\newcommand\Null{\ensuremath{\mbox{\tt Null}}}
\newcommand\Zero{\ensuremath{\mathbf 0}}  %% bits
\newcommand\One{\ensuremath{\mathbf 1}}

\newcommand\TB{\ \ \ \ }

\newcommand\expnd{\ensuremath{\Rightarrow}}
\newcommand\cfared{\ensuremath{\Rightarrow_{\mathsf{cfa}}}}
\newcommand\vp{\leadsto}
\newcommand\lolli{\multimap}

%% Linear logic connectives
\newcommand\tensor{\otimes}
\newcommand{\parr}{\bindnasrepma}
