\newcommand{\spc}{\hspace{2mm}}
\newcommand{\TooL}{TooL}
\newcommand{\TL}{TL}
\newcommand{\TML}{TML}
\newcommand{\TSP}{TSP}

\newcommand{\leaveout}[1]{}

% double quotes
\newcommand{\dq}{\verb$"$}

% emphasize
\newcommand{\e}[1]{{\em #1\/}}

% program text embedded within main document text
\newcommand{\p}[1]{{\small\sf{}#1}}

% program keyword
\newcommand{\k}[1]{\mbox{\bf #1}}

% english text
\newcommand{\engl}[1]{\mbox{\em #1}}


%%% define environment xple and commands xbegin, xmiddle, xend for program examples:
% \begin{xple} TEXT \end{xple}
% Typeset TEXT as a programming language example:
% Obey linebreaks and multiple spaces, use sans-serif font
\def\@xple{\small\sf\trivlist \leftmargin1cm \item[]\if@minipage\else\vskip\parskip\fi
\leftskip\parindent
%\leftskip\@totalleftmargin 
\rightskip\z@
\topsep\z@\partopsep\z@\parskip\z@\parsep\z@\itemsep\z@   % ## FM
\parindent\z@\parfillskip\@flushglue\parskip\z@
\@tempswafalse \def\par{\if@tempswa\hbox{}\fi\@tempswatrue\@@par}
\obeylines}

\def\xple{\@xple \frenchspacing\@vobeyspaces}
\let\endxple=\endtrivlist

% Grammar Definition:
\newcommand{\gbegin}{\renewcommand{\arraystretch}{1.2}
\begin{tabular}{rcl}}
\newcommand{\gend}{\end{tabular} \vspace{3ex}}

\newcommand{\xbegin}{\begin{tabular}{ll} \begin{minipage}[t]{5cm}\begin{xple}\sf}
\newcommand{\xmiddle}{\end{xple} \end{minipage} &
 \begin{minipage}[t]{8cm} \begin{xple}\sf}
\newcommand{\xend}{\end{xple} \end{minipage} \end{tabular} \vspace{3ex}}

\renewcommand{\xbegin}{\begin{tabular}{ll} \begin{minipage}[t]{6cm}\begin{xple}\sf}
\renewcommand{\xmiddle}{\end{xple} \end{minipage} &
 \begin{minipage}[t]{10cm} \begin{xple}\sf}
\renewcommand{\xend}{\end{xple} \end{minipage} \end{tabular} \vspace{0ex}}

\newcommand{\xxbegin}{\begin{tabular}{lll}\mbox\bgroup}
\newcommand{\xxmiddle}{\egroup&}
\newcommand{\xxcomment}{&\begin{xple}\sf}
\newcommand{\xxcommentend}{\end{xple}\end{tabular}}
\newcommand{\xxend}{\end{tabular}}

% Defintions and Referencing:
\newcommand{\define}[2]
  {\begin{tabular}{l}{\small\sl[#1]} \\ #2 \\ \ \end{tabular}}
\newcommand{\refdef}[1]{{\small[#1]}}
\newcommand{\refpar}[1]{$\S~\!$\ref{#1}}

% Environments;
\newcounter{bspcount}[section]
\newenvironment{bsp}{\begin{trivlist}\stepcounter{bspcount}\item[]{\bf Beispiel~\thesection.\thebspcount:}}{$\Box$\end{trivlist}}

% Framed and centered figures:
\newcommand{\framedcenter}[1]{\framebox{\parbox{\textwidth}{\centering#1}}}

% Replace Bullets by Triangles:
\renewcommand{\labelitemi}{$\triangleright$}

% Spacing:
\newcommand{\medspc}{\hspace{1 ex}}
\newcommand{\bigspc}{\hspace{2.5 ex}}

% substitute each #2 in #1 by #3
\newcommand{\substitute}[3]{{#1}[#2 \Leftarrow #3]}

% General:
\newcommand{\NAT}{{\cal Z}}

\newcommand{\finitemap}[2]{#1 \stackrel{fin}{\longrightarrow} #2}
\newcommand{\mapdomain}[1]{Dom(#1)}
\newcommand{\maprange}[1]{Ran(#1)}
\newcommand{\mapelement}[2]{#1 \mapsto #2}
\newcommand{\makemap}[1]{\{ #1 \}}
\newcommand{\mapupdate}[2]{#1 + #2}

% ------------------------------------------Syntax
\newcommand{\synopt}[1]{$[$ #1 $]$}
\newcommand{\synbrack}[1]{$($ #1 $)$}
\newcommand{\synrep}[1]{$\{$ #1 $\}$}
\newcommand{\synquot}[1]{\mbox{\verb$"${\rm{#1}}\verb$"$}}


% LaTeX commands and definitions for TooL type rules


\renewcommand{\dots}{\!..}


% Substitutions:
% substitute each #2 in #1 by #3
\newcommand{\subst}[3]{{#1}[#2/#3]}
\newcommand{\substbind}[2]{#1\{\Leftarrow #2\}}


\newcommand{\judge}[2]{#1 \,\vdash\, #2}
\newcommand{\lettype}{\mbox{$\,=$}}
\newcommand{\hastype}{\mbox{$\,\,:\,$}}
\newcommand{\subtype}{\mbox{$\,<:\,$}}
\newcommand{\matchtype}{\mbox{\,$<\!\!\!*\!\!:\,$}}
\newcommand{\hassig}{\,::\,}
\newcommand{\subsig}{\,<::\,}
\newcommand{\subsigval}{\stackrel{\mbox{\it val}}{\sig}}
\newcommand{\equals}{\mbox{$\,=\,$}}

\newcommand{\sig}{\:\: \mbox{\it sig} \, }
\newcommand{\type}{\:\: \mbox{\it type} \, }

\newcommand{\seq}[1]{\mbox{$#1\;$}}
\newcommand{\issig}[1]{#1 \sig}
\newcommand{\istype}[1]{#1 \type}
\newcommand{\emptybind}{\oslash}
\newcommand{\emptysig}{\oslash}

\newcommand{\Nil}{\mbox{\bf Nil} \, }
\newcommand{\nil}{\mbox{\bf nil} \, }
\newcommand{\self}{\mbox{\it self} \, }
\newcommand{\super}{\mbox{\it super} \, }
\newcommand{\Self}{\mbox{\it Self} \, }

\newcommand{\upto}{,\dots,\,}
\newcommand{\Dom}{\, \mbox{\it Dom}}

\newcommand{\suite}[1]{\mbox{\{$#1$\}}}
\newcommand{\Interface}[4]{\mbox{\bf Interface }#1(#2;#3)#4}
\newcommand{\Class}[4]{\mbox{\bf Class }#1(#2;#3)#4}
\newcommand{\class}[5]{\mbox{\bf class }#1(#2;#3)(#4)#5}
\newcommand{\Mth}[2]{\mbox{\bf Method}(#1)#2}
\newcommand{\mth}[2]{\mbox{\bf method}(#1)#2}

\newcommand{\CPLempty}{\oslash}
\newcommand{\CPLcons}[2]{#1,#2}
\newcommand{\CPL}[2]{#2 = \mbox{\bf CPL}(#1)}

\newcommand{\twolines}[2]{\vtop{\hbox{$#1$}\hbox{$#2$}}}
\newcommand{\threelines}[3]{\vtop{\hbox{$#1$}\hbox{$#2$}\hbox{$#3$}}}

%\newcommand{\update}[2]{\mbox{\bf update} \; #1 \; \mbox{\bf by} \; #2}
%\newcommand{\extend}[2]{\mbox{\bf extend} \; #1 \; \mbox{\bf with} \; #2}
%\newcommand{\inherit}[2]{\mbox{\bf inherit} \; #1 \; \mbox{\bf in} \; #2}

% \send{selector}{receiver}{args}
\newcommand{\send}[3]{\mbox{{\bf send}($#1$,$#2$,$#3$)}}

\newcommand{\typerule}[3]{ \raggedright
  $
  \begin{array}{l}
  \mbox{{\it [#1]}} \\
  \begin{array}{c}
   #2 \\[0.2ex]
   \hline
   #3 \rule{0cm}{2.5ex}
  \end{array}
  \end{array} $
}


\newcommand{\whereby}[1]{  \raggedright
  \vbox{
    
    \mbox{$
      \begin{array}{l}
      \mbox{\it where} \quad #1
      \end{array} $}}}
