
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{array}
\usepackage{stmaryrd}

%% xy
%%%%%%%%%%%%%%%%%%%%%%%%%%%%% xy-pic
\usepackage[all,arc,ps,dvips]{xy}
\NoRules
\SelectTips{cm}{12}
\UseTips


\let\objectstyle=\displaystyle
\let\labelstyle=\displaystyle
\newenvironment{mygraph}{
  \objectmargin={3mm}
  \labelmargin={2mm}
  \begin{graph}
   !~*{+[o]}%
 }{%
   \end{graph}
 }

%% geometry and headers

\usepackage{geometry}
\usepackage{fancyhdr}

\def\headerfooterfont{\small}          % CHOOSE the header/footer font

\newdimen\headerfooterbaselinedimen
\headerfooterfont
\headerfooterbaselinedimen=\baselineskip
\normalsize
\newlength{\headerfootertobody}
\setlength{\headerfootertobody}{0mm}   % CHOOSE the gap between the
                                       % header/footer and the main body
\newlength{\headerfootertorule}
\setlength{\headerfootertorule}{2mm}   % CHOOSE the gap between the
                                        % header/footer and the rule
\renewcommand{\footruleskip}{\headerfootertorule}
\newlength{\edgetoheaderfooter}
\setlength{\edgetoheaderfooter}{2mm}   % CHOOSE the gap between the
                                        % page's edge and the header/footer
\newlength{\geometryfootskip}
\setlength{\geometryfootskip}{\headerfootertobody}
\addtolength{\geometryfootskip}{\headerfooterbaselinedimen}

\newlength{\geometryheadheight}
\setlength{\geometryheadheight}{\headerfooterbaselinedimen}
\addtolength{\geometryheadheight}{\headerfootertorule}

\newlength{\geometrytop}
\setlength{\geometrytop}{\edgetoheaderfooter}
%\addtolength{\geometrytop}{\headerfootertorule}

\newlength{\geometryheadsep}
\setlength{\geometryheadsep}{\headerfootertobody}
\addtolength{\geometryheadsep}{-\headerfootertorule}


\newcommand{\headersetup}[1]{\headerfooterfont\raisebox{\headerfootertorule}[0pt][0pt]{#1}}%
\newcommand{\footersetup}[1]{\headerfooterfont #1}%
\ifslidegeometry
\geometry{%
  dvips, a4paper, landscape, %
  left=10mm, right=10mm,              % CHOOSE the margins
  top=\geometrytop, bottom=\edgetoheaderfooter, %
  headheight=\geometryheadheight, headsep=\geometryheadsep,
  footskip=\geometryfootskip%
}   
\else
\newcommand{\sizes}{\small}
\geometry{%
  dvips, a4paper,
  left=25mm, right=25mm,              % CHOOSE the margins
  top=\geometrytop, bottom=\edgetoheaderfooter, %
  headheight=\geometryheadheight, headsep=\geometryheadsep,
  footskip=\geometryfootskip%
}   
\fi

\renewcommand{\headrulewidth}{0mm}
\renewcommand{\footrulewidth}{0mm}
\fancyhead{\headerfooterfont }         % CHOOSE the title's header
\fancyfoot{\headerfooterfont }         % CHOOSE the title's footer


\newcommand{\setfooters}[1]{
  \renewcommand{\footrulewidth}{.3mm}%
%  \renewcommand{\headrulewidth}{.3mm}%
  \rfoot{\footersetup{\thepage}}%
  \cfoot{#1}%
  }

\pagestyle{fancy}

%% end of geometry and headers


%%% text macros
\newcommand{\pic}{$\pi$\nobreak-\nobreak calculus}
\newcommand{\lac}{$\lambda$\nobreak-\nobreak calculus}
\usepackage{xspace}
\newcommand{\ie}{i.e.\@\xspace}
\newcommand{\eg}{e.g.\@\xspace}
%%% end of text macros

%%% syntactic macros

\newcommand{\EvalCxt}{{\cal E}}

\newcommand{\wvec}{\vec{w}}
\newcommand{\xvec}{\vec{x}}
\newcommand{\yvec}{\vec{y}}
\newcommand{\zvec}{\vec{z}}

\newcommand{\newp}[2]{\newact{#1}.{#2}}  % e.g. \hide{L}{P}
\newcommand{\bangp}[1]{\bangact #1}  % e.g. \repl{P}
\newcommand{\zerop}{{\boldsymbol 0}}
\newcommand{\parp}{\mathbin{|}}
\newcommand{\matchp}[3]{\matchact{#1}{#2}.{#3}}
\newcommand{\mismatchp}[3]{\mismatchact{#1}{#2}.{#3}}

\newcommand{\taup}[1]{\tau.{#1}}

\newcommand{\outp}[3]{\outact{#1}{#2}.{#3}}                 % \outp x y P           x-y.P
\newcommand{\outact}[2]{\zoutact{#1}{#2}}                   % \outact x y           x-y

\newcommand{\polyoutp}[3]{\polyoutact{#1}{#2}.{#3}}         % \polyoutp x {y,z} P   x-<y,z>.P
\newcommand{\polyoutact}[2]{\zoutact{#1}{\langle#2\rangle}} % \polyoutact x {y,z}   x-<y,z>
\newcommand{\zoutact}[1]{\bar{#1}}                          % \zoutact x            x-
\newcommand{\zoutp}[2]{\bar{#1}.{#2}}                       % \zoutp x P            x-.P

\newcommand{\inp}[3]{\inact{#1}{#2}.{#3}}
\newcommand{\inact}[2]{\zinact{#1}({#2})}

\newcommand{\polyinp}[3]{\polyinact{#1}{#2}.{#3}}
\newcommand{\polyinact}[2]{\inact{#1}{#2}}
\newcommand{\zinp}[2]{\zinact{#1}.{#2}}
\newcommand{\zinact}[1]{#1}

\newcommand{\outlab}[2]{\outact{#1}{#2}}
\newcommand{\boutlab}[2]{\outact{#1}{(#2)}}

\newcommand{\inlab}[2]{{#1}{#2}}
\newcommand{\matchact}[2]{[{#1}={#2}]}
\newcommand{\mismatchact}[2]{[{#1}\neq{#2}]}
\newcommand{\newact}[1]{{\boldsymbol\nu}{#1}}
\newcommand{\bangact}{\text{!}}

\newcommand{\pabs}[2]{({#1}).{#2}}
\newcommand{\pconcr}[2]{{#1}\langle{#2}\rangle}

\newcommand{\sub}[2]{\{\sublet{#1}{#2}\}} % \sub x y means x for y
\newcommand{\sublet}[2]{{#1}/{#2}}
\newcommand{\multisub}[1]{\{{#1}\}}

\newcommand{\red}[1]{\mathrel{\overset{#1}{\longrightarrow}}} % e.g. \red{a}
\newcommand{\redstar}[1]{\mathrel{\smash{\overset{#1}{{\longrightarrow}}{}^{*}}}} % e.g. \redstar{}
\newcommand{\nored}[1]{\not\red{#1}} % e.g. \red{a}

\newcommand{\congsuper}{^{\circ}}

\newcommand{\barb}[1]{{\downarrow} {#1}}
\newcommand{\wbarb}[1]{{\Downarrow} {#1}}

\newcommand{\nbarb}[1]{{\not{}{\!\downarrow}} {#1}}
\newcommand{\nwbarb}[1]{{\not{}{\!\Downarrow}} {#1}}

\newcommand{\beep}{\mathbf{beep}}


\newcommand{\sublab}{_{\ell}}

\newcommand{\strongbisim}{\mathrel{\sim\sublab}}
\newcommand{\fullstrongbisim}{\mathrel{\simeq\sublab}}

\newcommand{\notstrongbisim}{\mathrel{\not\sim\sublab}}

\newcommand{\weakbisim}{\mathrel{\approx\sublab}}
\newcommand{\fullweakbisim}{\mathrel{\cong\sublab}}

\newcommand{\notweakbisim}{\mathrel{\not\approx\sublab}}

\newcommand{\strongbbisim}{\mathrel{\dot{\sim}}}
\newcommand{\strongbequiv}{\mathrel{\dot{\sim}\congsuper}}
\newcommand{\strongredbequiv}{\mathrel{{\sim}}}
\newcommand{\strongbcong}{\mathrel{\dot{\simeq}\congsuper}}
\newcommand{\strongredbcong}{\mathrel{\simeq}}

\newcommand{\weakbbisim}{\mathrel{\dot{\approx}}}
\newcommand{\weakbequiv}{\mathrel{{\dot{\approx}}\congsuper}}
\newcommand{\weakredbequiv}{\mathrel{{\approx}}}

\newcommand{\weakbcong}{\mathrel{\dot{\cong}\congsuper}}
\newcommand{\weakredbcong}{\mathrel{{\cong}}}


\newcommand{\infer}[2]{\frac{\displaystyle {#1}}{\displaystyle {#2}}}
\newcommand{\defeq}{\mathrel{\overset{\text{def}}{=}}}
\newcommand{\id}[1]{\mathit{#1}} % multi-letter identifiers
\newcommand{\RR}{\mathcal{R}}
\newcommand{\TT}{\mathcal{T}}
\newcommand{\FF}{\mathcal{F}}


\newcommand{\streq}{\equiv}

\newcommand{\strongprog}{\rightsquigarrow}

\renewcommand{\bar}{\overline}

\newcommand{\fn}[1]{\mathsf{fn}({#1})}
\newcommand{\bn}[1]{\mathsf{bn}({#1})}

\newcommand{\trans}[1]{\left\llbracket#1\right\rrbracket}
\renewcommand{\emptyset}{\varnothing}

\newcommand{\setst}{\;/\;}

\newcommand{\maketag}[1]{{\text{\sizes\sf(#1)}}}
\newcommand{\eqtag}[1]{\tag*{\maketag{#1}}}

%named processes
\newcommand{\namedprocess}[1]{\mathit{#1}}

\newcommand{\PTrue}{\namedprocess{True}}
\newcommand{\PTruebang}{\namedprocess{True'}}
\newcommand{\PFalse}{\namedprocess{False}}
\newcommand{\PFalsebang}{\namedprocess{False'}}
\newcommand{\Pboolcases}[2]{\namedprocess{cases}({#1},{#2})}
\newcommand{\Pnot}{\namedprocess{not}}

\newcommand{\PNil}{\namedprocess{Nil}}
\newcommand{\PCons}[2]{\namedprocess{Cons}({#1},{#2})}
\newcommand{\Plistcases}[2]{\namedprocess{cases}({#1},{#2})}
\newcommand{\Plistcasesmlconcr}[3]{\namedprocess{cases}%
  \begin{array}[t]{@{}l@{}l@{}}%
    (&{#1},\\
    &{#2}\\
    )\text{\rlap{$\langle{#3}\rangle$}}
  \end{array}
}   
\newcommand{\Plistcopy}{\namedprocess{copy}}
\newcommand{\Plistappend}{\namedprocess{append}}
\newcommand{\Plistrev}{\namedprocess{rev}}

%end of named processes

\newcommand{\TODO}{TODO}

\newcommand{\answer}[1]{%
  \ifanswermode
  \textbf{Answer:} #1%
  \else
  \fi
}

\usepackage{alltt}
