%%%% LaTex Thesis Style Macros
%%%% Input this file befoire the \begin{document}
%%%%
%%%% G.Papadopoulos
%%%% 18 Feb 1988
%%%%

\setlength{\parskip}{\bigskipamount}

%%% Reprogramming of LaTeX default for theorems.
%%% Changes:  use \sl instead of \it, singlespaced.
\makeatletter
\def\@begintheorem#1#2{\it \trivlist \singlespacing \item[\hskip \labelsep{\bf #1\ #2}]}
\def\@opargbegintheorem#1#2#3{\it \trivlist \singlespacing
      \item[\hskip \labelsep{\bf #1\ #2\ (#3)}]}
\def\@endtheorem{\endtrivlist}
\makeatother

\newtheorem{definition}{Definition}[chapter]
\newtheorem{theorem}[definition]{Theorem}
\newtheorem{lemma}[definition]{Lemma}
\newtheorem{corollary}[definition]{Corollary}
\newtheorem{property}[definition]{Property}

% SHORT FORMS FOR ITALICIZED ``i.e.'', ``e.g.'', ``etc.''
\newcommand{\ie}{{\em i.e.,\/}}
\newcommand{\vis}{{\em vis.,\/}}
\newcommand{\eg}{{\em e.g.,\/}}
\newcommand{\etc}{{\em etc.\/}}

% DEFINITIONS FOR ILLUSTRATIONS
% One of the following two lines should be commented out!!
%\def\illfileprefix{/omitpictures/}            % to omit pictures
\def\illfileprefix{/tmp_mnt/home/jj/sakai/mit/paper/}   % to include pictures
\def\illustration#1#2{
\vbox to #2{\vfill\special{psfile=\illfileprefix#1.ps hoffset=-96 voffset=-45}}} 
\newlength{\illuswidth}
\setlength{\illuswidth}{\textwidth}
\addtolength{\illuswidth}{-7pt}
%
% \floatingfigure{ref}{height}{Caption}
%
\def\floatingfigure#1#2#3{
   \begin{figure}[htbp]
   {\parbox
       {\illuswidth}
       {\illustration{#1}{#2}
          \caption{\label{#1}
               #3}
        }
     }
    \end{figure}
}

% ENVIRONMENT FOR DEFINING FIELDS 
\newenvironment{fields}
  {\begin{list}  {}     % no item default
     {\setlength{\rightmargin}{\leftmargin} % indent text on both sides
      \addtolength{\leftmargin}{4em}        % widen left margin
      \setlength{\labelwidth}{6em}          % width of label field
      \setlength{\labelsep}{1em}            % distance from label field to text
      \setlength{\listparindent}{0em}      % no indentation
      \singlespacing
     }%
  }%
  {\end{list}}

% ENVIRONMENT FOR DEFINING STATE FUNCTIONS
\newenvironment{defstate}[1] %
  {\singlespacing \begin{tabbing}%
  \mbox{MMM}\= \sf def {\sc stickyrr}$ \,\,x\,p\,= $ \sf\=\{ \= \sf case $x$ of \= MMMMM \kill %
  \> \sf def {\sc #1}$ \,\,x\,p\, = $ \>\sf\{case $x$ of\\ %
  }%
  {\end{tabbing}}

\newenvironment{trivstate}[2]
  {\begin{tabbing}%
  \mbox{MMM}\= \sf def {\sc stickrr}$ \,\,x\,p\,= $ \= \kill%
  \> \sf def {\sc #1}$ \,\,x\,p\, = $ \>#2 \sf ; %
  }%
  {\end{tabbing}}

\newcommand{\field}[1]{\item[#1]}

\newcommand{\csp}{\mbox{$c.s_p$}}
\newcommand{\cst}{\mbox{$c.s^{\prime}$}}
\newcommand{\cstpt}{\mbox{$c.s^{\prime}_{p^{\prime}}$}}
\newcommand{\csttptt}{\mbox{$c.s^{\prime\prime}_{p^{\prime\prime}}$}}
\newcommand{\ctst}{\mbox{$c^{\prime}.s^{\prime}$}}
\newcommand{\ctstpt}{\mbox{$c^{\prime}.s^{\prime}_{p^{\prime}}$}}
\newcommand{\cctstm}{\mbox{$c^{\prime}.(s^{\prime}-1)$}}
\newcommand{\ctstmpt}{\mbox{$c^{\prime}.(s^{\prime}-1)_{p^{\prime}}$}}
\newcommand{\chshph}{\mbox{$\hat{c}.\hat{s}_{\hat{p}}$}}
\newcommand{\At}{\mbox{$A^{\prime}$}}
\newcommand{\ct}{\mbox{$c^{\prime}$}}
\newcommand{\Tt}{\mbox{$T^{\prime}$}}
\newcommand{\Xpt}{\mbox{$p^{\prime}$}}
\newcommand{\qt}{\mbox{$q^{\prime}$}}
\newcommand{\vt}{\mbox{$v^{\prime}$}}
\newcommand{\Xptt}{\mbox{$p^{\prime\prime}$}}
\newcommand{\st}{\mbox{$s^{\prime}$}}
\newcommand{\stt}{\mbox{$s^{\prime\prime}$}}
\newcommand{\Wfun}[1]{\mbox{$W_{\hbox{\scriptsize\it #1}}$}}
\newcommand{\Tfun}[1]{\mbox{$T_{\hbox{\scriptsize\it #1}}$}}

%\newcommand{\pe}{\mbox{$P\!E$}}
%\newcommand{\ip}{\mbox{$I\!P$}}
%\newcommand{\fp}{\mbox{$F\!P$}}
%\newcommand{\peipfp}{\pe,\ip,\fp}
%\newcommand{\hpe}{\mbox{$\widehat{P\!E}$}}
%\newcommand{\hip}{\mbox{$\widehat{I\!P}$}}
%\newcommand{\hfp}{\mbox{$\widehat{F\!P}$}}
%\newcommand{\hpeipfp}{\hpe,\hip,\hfp}
%\newcommand{\tpe}{\mbox{$\widetilde{P\!E}$}}
%\newcommand{\tip}{\mbox{$\widetilde{I\!P}$}}
%\newcommand{\tfp}{\mbox{$\widetilde{F\!P}$}}
%\newcommand{\tpeipfp}{\tpe,\tip,\tfp}

\newcommand{\machinst}[9]{
\begin{singlespacing}
\begin{center}
\begin{tabular}{|l l l}
\cline{1-1}
\multicolumn{1}{|l|}{\tt #1} \\
\multicolumn{1}{|l|}{\sc #2 $\Rightarrow$ #3}\\
\cline{2-3}
\multicolumn{2}{|l}{\makebox[8em]{}} & \multicolumn{1}{l|}{\makebox[12em]{}}\\
\multicolumn{2}{|l}{\sf Inputs:} & \multicolumn{1}{l|}{\sf Outputs:}\\
\multicolumn{2}{|l}{\makebox[2em]{}$\langle c.s_l,\, #4\rangle$} & 
     \multicolumn{1}{l|}{\makebox[2em]{}$#6$} \\
\multicolumn{2}{|l}{\makebox[2em]{}$\langle c.s_r,\, #5\rangle$} & 
     \multicolumn{1}{l|}{\makebox[2em]{}$#7$} \\
\multicolumn{3}{|l|}{}\\
\multicolumn{3}{|l|}{$A = $ {\em #8}} \\
\multicolumn{3}{|l|}{$T = \Tfun{#9}$} \\
\hline
\end{tabular}
\end{center}
\end{singlespacing}}

\newcommand{\monoinst}[9]{
\begin{singlespacing}
\begin{center}
\begin{tabular}{|l l l}
\cline{1-1}
\multicolumn{1}{|l|}{\tt #1} \\
\multicolumn{1}{|l|}{\sc #2 $\Rightarrow$ #3}\\
\cline{2-3}
\multicolumn{2}{|l}{\makebox[8em]{}} & \multicolumn{1}{l|}{\makebox[12em]{}}\\
\multicolumn{2}{|l}{\sf Input:} & \multicolumn{1}{l|}{\sf Outputs:}\\
\multicolumn{2}{|l}{\makebox[2em]{}$\langle c.s_l,\, #4\rangle$} & 
     \multicolumn{1}{l|}{\makebox[2em]{}$#6$} \\
\multicolumn{2}{|l}{#5} & 
     \multicolumn{1}{l|}{\makebox[2em]{}$#7$} \\
\multicolumn{3}{|l|}{}\\
\multicolumn{3}{|l|}{$A = $ {\em #8}} \\
\multicolumn{3}{|l|}{$T = \Tfun{#9}$} \\
\hline
\end{tabular}
\end{center}
\end{singlespacing}}

\newcommand{\seqinst}[9]{
\begin{singlespacing}
\begin{center}
\begin{tabular}{|l l l}
\cline{1-1}
\multicolumn{1}{|l|}{\tt #1} \\
\multicolumn{1}{|l|}{\sc #2 $\Rightarrow$ #3}\\
\cline{2-3}
\multicolumn{2}{|l}{\makebox[8em]{}} & \multicolumn{1}{l|}{\makebox[12em]{}}\\
\multicolumn{2}{|l}{\sf Input:} & \multicolumn{1}{l|}{\sf Output:}\\
\multicolumn{2}{|l}{\makebox[2em]{}$\langle c.s,\, #4\rangle$} & 
     \multicolumn{1}{l|}{\makebox[2em]{}$#5$} \\
\multicolumn{3}{|l|}{}\\
\multicolumn{3}{|l|}{$E = $ {\em #6}} \\
\multicolumn{3}{|l|}{$W = \Wfun{#7}$} \\
\multicolumn{3}{|l|}{$A = $ {\em #8}} \\
\multicolumn{3}{|l|}{$T = \Tfun{#9}$} \\
\hline
\end{tabular}
\end{center}
\end{singlespacing}}

\newcommand{\seqfork}[9]{
\begin{singlespacing}
\begin{center}
\begin{tabular}{|l l l}
\cline{1-1}
\multicolumn{1}{|l|}{\tt #1} \\
\multicolumn{1}{|l|}{\sc #2 $\Rightarrow$ #3}\\
\cline{2-3}
\multicolumn{2}{|l}{\makebox[8em]{}} & \multicolumn{1}{l|}{\makebox[12em]{}}\\
\multicolumn{2}{|l}{\sf Input:} & \multicolumn{1}{l|}{\sf Output:}\\
\multicolumn{2}{|l}{\makebox[2em]{}$\langle c.s,\, #4\rangle$} & 
     \multicolumn{1}{l|}{\makebox[2em]{}$#5$} \\
\multicolumn{2}{|l}{} & 
     \multicolumn{1}{l|}{$\langle c.(s+1),\,v\rangle$} \\
\multicolumn{3}{|l|}{}\\
\multicolumn{3}{|l|}{$E = $ {\em #6}} \\
\multicolumn{3}{|l|}{$W = \Wfun{#7}$} \\
\multicolumn{3}{|l|}{$A = $ {\em #8}} \\
\multicolumn{3}{|l|}{$T = \Tfun{#9}$} \\
\hline
\end{tabular}
\end{center}
\end{singlespacing}}

\newcommand{\quuud}[4]{{\mbox {$\langle {\mbox {\tt #1}},\,#2,\,#3,\,#4\rangle$}}}

\makeatletter
\def\nosinglespacing{\@changespacing{1.3}}
\makeatother
%\nosinglespacing
