%
% misc stuff
%

% Definition and extra stuff
\newtheorem{definition}{Definition}
%\newtheorem{claim}{Claim}
\newtheorem{theorem}{Theorem}
\newtheorem{proof}{Proof}

\newcommand{\ma}[1]{\ensuremath{#1}\xspace}

% Usage: \newfun\A\fB{C}
% \A{} will produce C is \sf
% \fB{x} will produce C(x) with the C() is \sf and x in math mode
\newcommand\newfun[3]{
\newcommand#1{\mbox{\sf #3}}
\newcommand#2[1]{\mbox{\sf #3(\ma{##1})}}}

\newcommand\newfunb[3]{
\newcommand#1{\mbox{\sf #3}}
\newcommand#2[2]{\mbox{\sf #3(\ma{##1,##2})}}}

% Usage: \newmeta\G{H}
% \G{} will produce H in math mode
\newcommand\newmeta[2]{\def#1##1{\ma{#2_{##1}}}}
\newcommand\newmega[2]{\def#1##1{\ma{#2^{\tiny{##1}}}}}

\newmeta\A{A}
\newmeta\a{a}
\newmeta\b{b}
\newmeta\c{c}
\newmeta\d{d}
\newmeta\G{G}
\newmeta\C{C}
\newmeta\D{D}
\newmeta\I{I}
\newmeta\S{S}
\newmeta\n{n}
\newmeta\o{o}
\newmeta\e{e}
\newmeta\k{k}
\newmeta\l{l}
\newmeta\p{p}
\newmeta\q{q}
\newmeta\r{r}
\newmega\R{R}
\newmeta\s{s}
\newmeta\t{t}
\newmeta\v{v}
\newmeta\x{x}
\newmeta\y{y}




% operators
\newcommand{\Union}{~\ensuremath\text{\tt |}~}
\newcommand{\Intersect}{~\ensuremath\text{\tt \&}~}
\newcommand{\Neg}{~\ensuremath\text{\tt !}~}
\newcommand\join[2]{\ma{#1 \cdot #2}}
\def\demjoin{\join}
\newcommand\dempath[2]{\ma{ [#1,#2]}}
\newcommand\demand[2]{\ma{#1 \Intersect #2}}
\newcommand\demunion[2]{\ma{#1 \Union #2}}
\newcommand\demneg[1]{\ma{\mathtt{!} #1}}
\newcommand\demflow[1]{\ma{\mathtt{flow}(#1)}}
\def\reduce{\downarrow}
\def\conv{\rightarrow}

% from Karl
\newcommand\sink{\mbox{Rome-node}}


% Misc
\def\etal{{\it et al.}\xspace}
\newcommand\question[1]{{\footnote ???: #1}}
\def\code{\texttt}

\def\sep{\;\;|\;\;}
\newcommand\sel{\; \; \sep \; \;}
\newfun\WF\fWF{WF}
\newfunb\FIRSTf\fFIRST{FIRST}
\newfun\Source\fSource{Source}
\newfun\Super\fSuper{Super}
\newfun\SEL\fSEL{SEL}
\newfun\Target\fTarget{Target}
\newfun\Graph\fGraph{Graph}
\newcommand\PG{{PG}}
\newfun\Prog\fProg{P}
\newfun\Method\fMethod{M}
\newfun\Paths\fPaths{Paths$_{\Phi}$}
\newfun\PathSet\fPathSet{PathSet$_{\Phi}$}
\newfun\notvia\fnotvia{not}
\newfun\PathCompletion\fPathCompletion{PathCompletion}

\newfun\Refine\fRefine{Refine}
\newfun\Repr\fRepr{Repr}
\newfun\Why\fWhy{Why}
\newfun\Objects\fObjects{Objects}
\newfun\where\fwhere{where}

\newfun\NoShortcut\fNoShortcut{NoShortcut}
\newfun\NoZigzag\fNoZigzag{NoZigzag}
\newfun\MinReq\fMinReq{MinReq}
\newfun\Linear\fLinear{Linear}

\newfun\Abstract\fAbstract{Abstract}
\newfun\Edges\fEdges{Edges}
\newfun\Comp\fComp{Comp}
\newfun\Leaf\fLeaf{Leaf}
\newfun\Subclass\fSubclass{Subclass}
\newfun\Reduce\fReduce{Reduce}
\newfun\Select\fSelect{Select}
\newfun\Car\fCar{Car}
\newfun\Cdr\fCdr{Cdr}
\newfun\Class\fClass{Class}
\newfun\Main\fMain{Main}
\newfun\Run\fRun{Run}
\newfun\Traverse\fTraverse{Traverse}
\newfun\Execute\fExecute{Execute}
\newfun\Language\fLanguage{Language}
\newcommand\interval[1]{\langle{#1}\rangle}
%\def\edge#1#2#3{#1\stackrel{#2}{\imp}#3}
\newcommand\edge[2]{\ma{(#1,#2)}}
\newcommand\edgeb[3]{\ma{(#1,#2,#3)}}
\newcommand\demedge[2]{\ma{(#1,#2)}}
\newcommand\demedgel[3]{\ma{(#1,#2)_{#3}}}
\newcommand\demedgeb[3]{\ma{(#1,#2,#3)}}
\def\imp{\rightarrow}
\def\MARK{$+$}
\def\shortcut{short cut}

\def\LL{{\cal L}}
\newcommand{\ANN}[1]{\footnote {#1}}
%\newcommand{\ANN}[1]{{\tiny ({#1})}}
%\newcommand{\ANN}[1]{{\Large ({#1})}}

%\newtheorem{theorem}{Theorem}
%\newtheorem{lemma}[theorem]{Lemma}
%\newenvironment{proof}{\begin{trivlist}\item[]\hspace{\parindent}%
%                      {\em Proof.}}{\qed\end{trivlist}}
\def\qed{\mbox{}~\hfill~$\Box$}

\newcommand{\irule}[2]%
    {\mkern-2mu\displaystyle\frac{#1}{\vphantom{,}#2}\mkern-2mu}
\newcommand{\air}{\hspace{0.8cm}}

%alternation edge
\def \ae{\ifmmode \Longrightarrow \else $\Longrightarrow$ \fi}


% Specific for this paper
\newcommand\mathlit[1]{\ma{\mbox{{\tt #1}}}}
\def\mt{\mathlit}
\def\XPfrag{\ma{\mbox{XP}^{\tiny{\{*,//\}}}}}
\newfun\class\fclass{class}
\newfunb\ef\fe{$e$}
\newfun\rootf\froot{root}
\newfun\result\fresult{result}
\newfun\nodes\fnodes{nodes}
\newfun\Q\fQ{$Q$}
\newfun\Lf\fL{$L$}
\newfun\h\fh{h}
\newfun\labeling\flabeling{$\lambda$}
\newfun\head\fhead{head}
\newfunb\tail\ftail{tail}
\newfun\namemap\fnamemap{$\mathcal{N}$}
\newfun\B\fB{$\mathcal{B}$}
\newfunb\TG\fTG{$TG$}
\newfunb\EP\fEP{$EP$}

\newcommand\fP[3]{\ma{P_{#1}(#2,#3)}}
\newcommand\Strat[1]{\ma{\mathcal{#1}}}

\newcommand\path[1]{\ma{\langle {#1} \rangle}}

\newcommand\todo[1]{\footnote{TODO: #1}}
\newcommand\term[1]{{\em #1}}

\def\TMA{\ma{TMA}}
\def\L{\ma{\mathcal{L}}}

\newcommand\codeblock[1]{
\begin{quote}
\begin{alltt}
#1
\end{alltt}
\end{quote}
}

\newcommand\dtd[1]{
$$
\begin{array}{rcl}
#1
\end{array}
$$
}
\newcommand\dtdl[2]{#1 &\rightarrow& #2\\}

\newcommand\bnf[1]{
$$
\begin{array}{rcl}
#1
\end{array}
$$
}
\newcommand\bnfl[2]{#1 &::=& #2\\}
\newcommand\bnfo[1]{&|& #1\\}


\newcommand\hasa[2]{\ma{#1 \rightarrow_{hasA} #2}}
\newcommand\isa[2]{\ma{#1 \rightarrow_{isA} #2}}

\newcommand\inbetween[3]{\ma{#1 \; (\le #2 \ge) \; #3}}
\def\PCDATA{\mathlit{\#PCDATA}}
\def\slash{\mathlit{/}\xspace}
\def\slashslash{\mathlit{//}\xspace}
\def\hasaedge{hasa-edge}
\def\isaedge{isa-edge}
\newcommand\transf[1]{\ma{#1^\prime}}

