%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Course/Semester Specifics

\newcommand{\coursenumber}{6.042J/18.062J}
\newcommand{\coursetitle}{Mathematics for Computer Science}
\newcommand{\courseprofessors}{Professors Nancy Lynch and Srinivas Devadas}

\newcommand{\collaborationnote}{%
  \begin{fminipage}
    {\bf Remember} to include a \emph{collaboration statement} on the
    front page of your solutions.  \\
    (See Handout 1, \emph{Course Information}.)
  \end{fminipage}
  }

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Added by karger
\newif\ifshowsolutions
\showsolutionsfalse
\newcommand{\solution}[1]{\ifshowsolutions #1 \fi}
\newcommand{\askaboutsolutions}{
\typein[\answer]{Include solutions? (y/n) }
\def\yes{y}
\ifx\answer\yes
  \typeout{}
  \typeout{Solutions *INCLUDED*.} 
  \showsolutionstrue
\else
  \typeout{}
  \typeout{Solutions *NOT INCLUDED*.} 
  \showsolutionsfalse
\fi
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%macro for reusing question and solution file
\def\querysol#1#2#3#4#5#6{
\ifshowsolutions
  \draftcopyName{Solutions}{155}
%
  \newcommand{\handoutlabel}{#4}
  \newcommand{\handouttitle}{#5}
  \newcommand{\handoutdate}{#6}
  \handout{#4}{#5}{#6}
  \newcommand{\collaboration}{}
  \newcommand{\titlebar}{#5}
%
\else 
  \newcommand{\handoutlabel}{#1}
  \newcommand{\handouttitle}{#2}
  \newcommand{\handoutdate}{#3}
  \handout{#1}{#2}{#3}
  \newcommand{\titlebar}{#2}
%
\fi
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% latex2e packages used

\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsfonts}
\usepackage{amsthm}

\usepackage{xspace}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Cross-references for handout numbers.

\input{/a/class/6.042/fall00/handouts/handout-numbers}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Page format commands

\setlength{\parindent}{0in}                     % Paragraph Indentation
\setlength{\parskip}{0.3\baselineskip}          % Interparagraph Spacing

\hoffset        = -1.0 in
\voffset        = -1.0 in

\paperheight    = 11.0 in
\paperwidth     =  8.5 in

\topmargin      = 0.75 in
\headheight     = \baselineskip
\headsep        = \baselineskip
\footskip       = 1.00 in
\textheight     = \paperheight
\addtolength{\textheight}{-\topmargin}
\addtolength{\textheight}{-\headheight}
\addtolength{\textheight}{-\headsep}
\addtolength{\textheight}{-\footskip}

\textwidth      = \paperwidth
\oddsidemargin  = 1.0 in
\evensidemargin = 1.0 in
\addtolength{\textwidth}{-\oddsidemargin}
\addtolength{\textwidth}{-\evensidemargin}

\linewidth      = \textwidth

\newcommand{\printlayout}{%
  \typeout{----------------------- LaTeX Page Layout Parameters}
  \typeout{\string\paperwidth\space\space\the\paperwidth}
  \typeout{\string\paperheight\space\the\paperheight}
  \typeout{\string\textwidth\space\space\the\textwidth}
  \typeout{\string\textheight\space\the\textheight}
  \typeout{\string\oddsidemargin\space\space\the\oddsidemargin}
  \typeout{\string\evensidemargin\space\the\evensidemargin}
  \typeout{\string\topmargin\space\space\the\topmargin}
  \typeout{\string\headheight\space\the\headheight}
  \typeout{\string\headsep\space\the\headsep}
  \typeout{\string\footskip\space\space\space\the\footskip}
  \typeout{\string\marginparwidth\space\the\marginparwidth}
  \typeout{\string\marginparsep\space\space\space\the\marginparsep}
  \typeout{\string\hoffset\space\the\hoffset}
  \typeout{\string\voffset\space\the\voffset}
  \typeout{(1in=72.27pt, 1cm=28.45pt)}
  \typeout{-----------------------------------------}%
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% various macros

\newcommand{\true}{\textup{\texttt{true}}\xspace}
\newcommand{\false}{\textup{\texttt{false}}\xspace}
\newcommand{\True}{\textup{\texttt{True}}\xspace}
\newcommand{\False}{\textup{\texttt{False}}\xspace}
\newcommand{\Bool}{\textup{\texttt{Bool}}\xspace}
\newcommand{\bool}{\textup{\texttt{Bool}}\xspace}
\newcommand{\apriori}{\textit{a~priori}\xspace~}
\newcommand{\aposter}{\textit{a~posteriori}\xspace~}
\newcommand{\etal}{\textit{et~al}.\@\xspace}
\newcommand{\ie}{\textit{i.e.}\xspace,\xspace}
\newcommand{\eg}{\textit{e.g.}\xspace,\xspace}
\newcommand{\etc}{\textit{etc}.\@\xspace}

\renewcommand{\And}{\wedge}
\newcommand{\Or}{\vee}
\newcommand{\AND}{\bigwedge}
\newcommand{\OR}{\bigvee}
\newcommand{\union}{\cup}
\newcommand{\composition}{\circ}
\newcommand{\intersect}{\cap}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\makeatother

\newcommand{\problem}{%
  \stepcounter{problem}\paragraph{Problem~\theproblem}}
\newcommand{\problempart}{%
  \stepcounter{problempart}\paragraph{\theproblempart}}

%\newcommand{\problempart}{\addtocounter{problempart}{1}\item}
%\newcommand{\problem}{\let\oralwrit=\noprefix
%       \item \let\@currentlabel=\theproblem}
%\newcommand{\oproblem}{\let\oralwrit=\oralprefix
%       \item \let\@currentlabel=\theproblem}
%\newcommand{\wproblem}{\let\oralwrit=\writprefix
%       \item \let\@currentlabel=\theproblem}



%\def\reading{\paragraph{\textbf{Reading assignment:}}}

% I'd suggest we mark changes we've made in the macros for each other
% up here. BDT 1/28/94

% I changed the \choose macro (which takes two arguments) to 
% \Choose. This way \choose still acts like \over. BDT 1/28/94

%%% oral, written, and no prefix commands added to ``problems''
%%% environment 1/94. BDT
%%% \pnumset sets the problem counter. added 2/2/94 BDT

%%% added definition of \remove for commenting large sections
%%% changed for spring 96 term 1/31/96 JK

\newcommand{\remove}[1]{}

\newcommand{\ms}[1]{%
        \relax\ifmmode
                \mathord{\mathcode`\-="702D\it #1\mathcode`\-="2200}%
        \else
                $\mathord{\mathcode`\-="702D\it #1\mathcode`\-="2200}$%
        \fi
}

\newlength{\toppush}
\setlength{\toppush}{3\headheight}
\addtolength{\toppush}{\headsep}

% Generates a framed minipage with its width as an optional argument.
% If the width is not specified, \linewidth is used.

\newsavebox{\fminibox}
\newlength{\fminilength}
\newenvironment{fminipage}[1][\linewidth]%
{% begin fminipage
  \setlength{\fminilength}{#1}
  \addtolength{\fminilength}{-2\fboxsep}
  \addtolength{\fminilength}{-2\fboxrule}
  \begin{lrbox}{\fminibox}\begin{minipage}{\fminilength}}%
{% end fminipage
  \end{minipage}\end{lrbox}\noindent\fbox{\usebox{\fminibox}}}

% Usage: \htitle{handoutnumber}{title}{dateout}

\newcommand{\htitle}[3]{%
  \mbox{}\vspace*{-\headheight}\mbox{}\vspace*{-\headsep}\mbox{}\newline
  \noindent\parbox{\textwidth}{% begin parbox
    Massachusetts Institute of Technology \hfill Handout #1 \newline%
    \coursenumber : \coursetitle \hfill #3 \newline%
    \courseprofessors\hfill\mbox{} \newline%
    \mbox{}\hrulefill\mbox{}%
    }% end parbox
  \mbox{}\newline
  \bigskip
  \begin{center}
    {\Large\bf #2}
  \end{center}
  \bigskip
  }

% Usage: \handout{refname}{title}{dateout}

\newcommand{\htitlewithouttitle}[2]{%
  \noindent\vspace*{-\toppush}\newline%
  \noindent\parbox{\textwidth}{%
    \coursenumber : \coursetitle
    \hfill Massachusetts Institute of Technology\newline
    Handout #1\hfill#2\mbox{}\newline
    \mbox{}\hrulefill\mbox{}%
    }% end parbox
  \vspace*{1ex}\mbox{}\newline%
  }

\newcommand{\handout}[3]{%
  \thispagestyle{empty}
  \mbox{}\vspace*{-\headheight}\mbox{}\vspace*{-\headsep}\mbox{}\newline
  \markboth{Handout \protect\ref{#1}: #2}{Handout \protect\ref{#1}: #2}
  \pagestyle{myheadings}%
  \htitle{\protect\ref{#1}}{#2}{#3}
  }

\newcommand{\handoutwithouttitle}[2]{\thispagestyle{empty}
 \markboth{Handout \protect\ref{#1}}{Handout \protect\ref{#1}}
 \pagestyle{myheadings}\htitlewithouttitle{\protect\ref{#1}}{#2}}

% Create the header for problem sets and solutions.
% Usage: \Pset{<problem-set-number>}{<out-date>}{<due-date>}
%        \Psol{<problem-set-number>}{<out-date>}
%
\newcounter{problemsetnum}

\newcommand{\pset}[3]
{\setcounter{problemsetnum}{#1}
\handout{ps#1}{Problem Set #1}{#2}
\centerline{{\bf Due: #3.}}
\bigskip
}

\newcommand{\tutprobn}[3]
{\setcounter{problemsetnum}{#1}
\handout{tutprobs#1}{Problems for Tutorial #1 (#2)}{#3}
}


\newcommand{\tutn}[3]
{\setcounter{problemsetnum}{#1}
\handout{tut#1}{Notes for Tutorial #1 (#2)}{#3}
}


\newcommand{\psol}[2]
{\setcounter{problemsetnum}{#1}
\handout{sol#1}{Problem Set #1 Solutions}{#2}
}

\newcommand{\qsol}[2]
{\setcounter{problemsetnum}{#1}
\handout{qsol#1}{Quiz #1 Solutions}{#2}
}

\newcommand{\quizinfo}[2]
{\setcounter{problemsetnum}{#1}
\handout{quizinfo#1}{Quiz #1 Information}{#2}
}

\newcommand{\pquiz}[2]
{\setcounter{problemsetnum}{#1}
\handout{pquiz#1}{Practice Quiz #1}{#2}
}

\newcommand{\pquizsol}[2]
{\setcounter{problemsetnum}{#1}
\handout{pquizsol#1}{Practice Quiz #1 Solutions}{#2}
}

\newcommand{\exam}[2]{% parameters: exam name, date
 \thispagestyle{empty}
 \markboth{\coursenumber #1}{\coursenumber #1}
 \pagestyle{myheadings}\examtitle{#1}{#2}
 \renewcommand{\theproblem}{\arabic{problem}}
}

\newcommand{\examinitials}[2]{% parameters: exam name, date
 \thispagestyle{empty}
 \markboth{\coursenumber\ #1}{\coursenumber\ #1\hspace{1in}
Name:\underline{\hspace{2.5in}} }
 \pagestyle{myheadings}\examtitle{#1}{#2}
 \renewcommand{\theproblem}{Problem \arabic{problem}}
}

\makeatletter
\newcommand{\exambooklet}[2]{% parameters: exam name, date
 \thispagestyle{empty}
 \markboth{\coursenumber #1}{\coursenumber #1}
 \pagestyle{myheadings}\examtitle{#1}{#2}
 \renewcommand{\theproblem}{Problem \arabic{problem}}
\renewcommand{\problem}{%
  \stepcounter{problem}\newpage
  \markboth{\coursenumber\ #1, \theproblem}{\coursenumber\ #1, \theproblem}
  \paragraph{Problem~\theproblem}
  }
}
\makeatother


\newcommand{\examtitle}[2]{\noindent\vspace*{-\toppush}\newline\parbox{6.5in}
{Massachusetts Institute of Technology
\hfill #1\newline
\coursenumber : \coursetitle\hfill#2\newline
\courseprofessors\hfill\vspace*{-.5ex}
\newline
\mbox{}\hrulefill\mbox{}}\vspace*{1ex}\mbox{}\newline
\begin{center}{\Large\bf #1}\end{center}}

\newcommand{\points}[1]{\hspace{3pt}[#1 points]\hspace{8pt}}

\newcommand{\pr}[1]{\mbox{Pr}(#1)}


\newcommand{\For}{{\bf for} }
\newcommand{\To}{{\bf to} }
\newcommand{\By}{{\bf by} }
\newcommand{\Downto}{{\bf downto} }
\newcommand{\While}{{\bf while} }
\newcommand{\Repeat}{\>\>{\bf repeat}\'}
\newcommand{\Until}{\>\>{\bf until}\'}
\newcommand{\If}{{\bf if} }
\newcommand{\Then}{\>{\bf then}\>}
\newcommand{\Else}{\>{\bf else}\>}
\newcommand{\ElseIf}{{\bf elseif} }
\newcommand{\ElseNoIf}{{\bf else} }
\newcommand{\Do}{\>\>{\bf do}\'}
\newcommand{\Return}{{\bf return} }
\newcommand{\Comment}{$\!\rhd$ }
\newcommand{\Inparallel}{{\bf in parallel} }    %This should be flushed
\newcommand{\Goto}{{\bf goto} }
\newcommand{\Error}{{\bf error} } % optionally followed by string argument

%\renewcommand{\cases}[1]{\left\{ \begin{array}{ll}#1\end{array}\right.}
\newcommand{\cif}[1]{\mbox{if $#1$}}
\newcommand{\cwhen}[1]{\mbox{when $#1$}}

%%%     oral, written, and no prefix commands added late 1/94 BDT
%%%     \pnumset sets the problem counter. added 2/2/94 BDT

\newcommand{\pnumset}[1]
  {\setcounter{problem}{#1}\addtocounter{problem}{-1}}

\newcounter{problem}
\newcounter{problempart}[problem]

%% \theproblem changed at ARM's request. -- dmj, 2/21/96

%\newcommand{\theproblem}{Problem \oralwrit\theproblemsetnum-\arabic{problem}}

\renewcommand{\theproblem}{\arabic{problem}}
\renewcommand{\theproblempart}{(\alph{problempart})}

%\makeatletter
%\newcounter{problemsection}
%\newcommand{\problemsection}{%
%  \stepcounter{problemsection}
%  \noindent\textbf{Problem~\theproblemsection\@addpunct{.}\ignorespaces}}
%\makeatother

\makeatletter
\newcounter {problemsection}
\newcounter {subproblemsection}[problemsection]
\renewcommand\theproblemsection    {Problem~\@arabic\c@problemsection}
\renewcommand\thesubproblemsection {(\@alph\c@subproblemsection)}
\newcommand\problemsection{%
  \@startsection{problemsection}%
  {1}%
  {\z@}%
  {3.25ex \@plus1ex \@minus.2ex}%
  {-1em}%
  {\normalfont\normalsize\bfseries}}
\newcommand\subproblemsection{%
  \@startsection{subproblemsection}%
  {2}%
  {\z@}%
  {3.25ex \@plus1ex \@minus .2ex}%
  {-1em}%
  {\normalfont\normalsize\bfseries}}
\newcommand*\l@problemsection{\@dottedtocline{4}{7.0em}{4.1em}}
\newcommand*\l@subproblemsection{\@dottedtocline{5}{10em}{5em}}
\makeatother

\makeatletter
\newcommand{\noprefix}{}
\newcommand{\oralprefix}{O}
\newcommand{\writprefix}{W}

\def\@ppartlabel#1{#1\enskip}

\newenvironment{problems}{
        \begin{list}{{\bf \theproblem.}}
        {\setlength{\leftmargin}{0em}
         \setlength{\rightmargin}{0em}
         \setlength{\labelwidth}{0em}
         \setlength{\itemsep}{.3in}
%added ARM 4/1/98:
         \setlength{\parskip}{\medskipamount}
        %\setlength{\labelsep}{0em}
        \let\makelabel\@ppartlabel
%%  
%%  Added to make problem numbering consecutive, per ARM's request. --
%%  dmj, 2/21/96
%%  
         \count@=\c@problem
         \usecounter{problem}%
         \setcounter{problem}{\count@}%
        }}{\end{list}}

% CL'00: renewed the environment problems to do nothing...

\renewenvironment{problems}{}{}

%%  Bleach.  Kludge on top of kludge on top of kludge....

\def\enumerate{%
  \ifnum \@enumdepth >\thr@@\@toodeep\else
    \advance\@enumdepth\@ne
    \edef\@enumctr{enum\romannumeral\the\@enumdepth}%
      \expandafter
      \list
        \csname label\@enumctr\endcsname
        {\usecounter\@enumctr\def\makelabel##1{\hss\llap{##1}\enskip}}%
  \fi}



\newenvironment{problemparts}
{% begin environment
  \setcounter{problempart}{0}
  \begin{list}{{\bf (\alph{problempart})}}
    {%
      \setlength{\leftmargin}{0em}
      %% added ARM 4/1/98:
      \setlength{\parskip}{\medskipamount}
      \setlength{\rightmargin}{0em} \setlength{\labelwidth}{0em}
      %\setlength{\labelsep}{0em}
      \let\makelabel\@ppartlabel
      }%
    }
{% end environment
  \end{list}}
  
% CL'00: renewed the definition of the problemparts env. to do nothing

\renewenvironment{problemparts}{}{}

\makeatother

\newenvironment{testproblemparts}
{% begin environment
  \setcounter{problempart}{0}
  \begin{list}{{\bf (\alph{problempart})}}
    {\setlength{\leftmargin}{2.5em}
                                %added ARM 4/1/98:
      \setlength{\parskip}{\medskipamount}
      \setlength{\rightmargin}{2.5em}
      \setlength{\itemsep}{2in}      
      %\setlength{\labelsep}{0.5em}
      }}
{% end environment 
  \end{list}}

\newcommand{\bparts}{\begin{problemparts}}
\newcommand{\eparts}{\end{problemparts}}
\newcommand{\ppart}{\problempart}

  \newcounter{exercisenum}
  \newcommand{\theexercise}{Exercise \theproblemsetnum-\arabic{exercisenum}}
  \newenvironment{exercises}{
        \begin{list}{{\bf \theexercise. \hspace*{0.5em}}}
        {\setlength{\leftmargin}{0em}
         \setlength{\rightmargin}{0em}
%added ARM 4/1/98:
         \setlength{\parskip}{\medskipamount}
         \setlength{\labelwidth}{0em}
         %\setlength{\labelsep}{0em}
        \usecounter{exercisenum}}}{\end{list}}

\makeatletter
\newcommand{\exercise}{\item \let\@currentlabel=\theexercise}
\makeatother

\newcounter{exercisepartnum}[exercisenum]
%\newcommand{\problem}[1]{\medskip\mbox{}\newline\noindent{\bf Problem #1.}\hspace*{1em}}
%\newcommand{\exercise}[1]{\medskip\mbox{}\newline\noindent{\bf Exercise #1.}\hspace*{1em}}

\newenvironment{exerciseparts}{
        \begin{list}{{\bf (\alph{exercisepartnum})}}
        {\setlength{\leftmargin}{2.5em}
%added ARM 4/1/98:
         \setlength{\parskip}{\medskipamount}
         \setlength{\rightmargin}{2.5em}
         %\setlength{\labelsep}{0.5em}
         }}{\end{list}}
\newcommand{\exercisepart}{\addtocounter{exercisepartnum}{1}\item}


% Macros to make captions print with small type and 'Figure xx' in bold.
\makeatletter

\def\fnum@figure{{\bf Figure \thefigure}}
\def\fnum@table{{\bf Table \thetable}}

%% \let\@mycaption\caption

%\long\def\@mycaption#1[#2]#3{\addcontentsline{\csname
%  ext@#1\endcsname}{#1}{\protect\numberline{\csname 
%  the#1\endcsname}{\ignorespaces #2}}\par
%  \begingroup
%    \@parboxrestore
%    \small
%    \@makecaption{\csname fnum@#1\endcsname}{\ignorespaces #3}\par
%  \endgroup}
%\def\mycaption{\refstepcounter\@captype \@dblarg{\@mycaption\@captype}}
%\makeatother
\let\mycaption\caption
%\newcommand{\figcaption}[1]{\mycaption[]{#1}}

\newcounter{totalcaptions}
\newcounter{totalart}

\newcommand{\figcaption}[1]{\addtocounter{totalcaptions}{1}\caption[]{#1}}

% \psfigures determines what to do for figures:
%       0 means just leave vertical space
%       1 means put a vertical rule and the figure name
%       2 means insert the PostScript version of the figure
%       3 means put the figure name flush left or right
\newcommand{\psfigures}{0}
\newcommand{\spacefigures}{\renewcommand{\psfigures}{0}}
\newcommand{\rulefigures}{\renewcommand{\psfigures}{1}}
\newcommand{\macfigures}{\renewcommand{\psfigures}{2}}
\newcommand{\namefigures}{\renewcommand{\psfigures}{3}}

\newcommand{\figpart}[1]{{\bf (#1)}\nolinebreak[2]\relax}
\newcommand{\figparts}[2]{{\bf (#1)--(#2)}\nolinebreak[2]\relax}


\macfigures     % STATE

% When calling \figspace, make sure to leave a blank line afterward!!
% \widefigspace is for figures that are more than 28pc wide.
\newlength{\halffigspace} \newlength{\wholefigspace}
\newlength{\figruleheight} \newlength{\figgap}
\newcommand{\setfiglengths}{\ifnum\psfigures=1\setlength{\figruleheight}{\hruleheight}\setlength{\figgap}{1em}\else\setlength{\figruleheight}{0pt}\setlength{\figgap}{0em}\fi}
\newcommand{\figspace}[2]{\ifnum\psfigures=0\leavefigspace{#1}\else%
\setfiglengths%
\setlength{\wholefigspace}{#1}\setlength{\halffigspace}{.5\wholefigspace}%
\rule[-\halffigspace]{\figruleheight}{\wholefigspace}\hspace{\figgap}#2\fi}
\newlength{\widefigspacewidth}
% Make \widefigspace put the figure flush right on the text page.
\newcommand{\widefigspace}[2]{
\ifnum\psfigures=0\leavefigspace{#1}\else%
\setfiglengths%
\setlength{\widefigspacewidth}{28pc}%
\addtolength{\widefigspacewidth}{-\figruleheight}%
\setlength{\wholefigspace}{#1}\setlength{\halffigspace}{.5\wholefigspace}%
\makebox[\widefigspacewidth][r]{#2\hspace{\figgap}}\rule[-\halffigspace]{\figruleheight}{\wholefigspace}\fi}
\newcommand{\leavefigspace}[1]{\setlength{\wholefigspace}{#1}\setlength{\halffigspace}{.5\wholefigspace}\rule[-\halffigspace]{0em}{\wholefigspace}}

% Commands for including figures with macpsfig.
% To use these commands, documentstyle ``macpsfig'' must be specified.
\newlength{\macfigfill}
\makeatother
\newlength{\bbx}
\newlength{\bby}
\newcommand{\macfigure}[5]{\addtocounter{totalart}{1}
\ifnum\psfigures=2%
\setlength{\bbx}{#2}\addtolength{\bbx}{#4}%
\setlength{\bby}{#3}\addtolength{\bby}{#5}%
\begin{flushleft}
\ifdim#4>28pc\setlength{\macfigfill}{#4}\addtolength{\macfigfill}{-28pc}\hspace*{-\macfigfill}\fi%
\mbox{\psfig{figure=./#1.ps,%
bbllx=#2,bblly=#3,bburx=\bbx,bbury=\bby}}
\end{flushleft}%
\else\ifdim#4>28pc\widefigspace{#5}{#1}\else\figspace{#5}{#1}\fi\fi}
\makeatletter

\newlength{\savearraycolsep}
\newcommand{\narrowarray}[1]{\setlength{\savearraycolsep}{\arraycolsep}\setlength{\arraycolsep}{#1\arraycolsep}}
\newcommand{\normalarray}{\setlength{\arraycolsep}{\savearraycolsep}}

\newcommand{\hint}{\emph{Hint}: }


% macros from clrmac.tex inserted by mb

\def\@startline{\global\@curtabmar\@nxttabmar\relax
   \global\@curtab\@curtabmar\setbox\@curline\hbox
    {}\@startfield\global\lifalse\strut}

% Macros from /th/u/clr/mac.tex

\newcommand{\set}[1]{\left\{ #1 \right\}}
\newcommand{\abs}[1]{\left| #1\right|}
\newcommand{\card}[1]{\left| #1\right|}
\newcommand{\floor}[1]{\left\lfloor #1 \right\rfloor}
\newcommand{\ceil}[1]{\left\lceil #1 \right\rceil}
\newcommand{\paren}[1]{\left( #1 \right)}
\newcommand{\ang}[1]{\ifmmode{\left\langle #1 \right\rangle}
   \else{$\left\langle${#1}$\right\rangle$}\fi}
        % the \if allows use outside mathmode,
        % but will swallow following space there!
\newcommand{\prob}[1]{\Pr\left\{ #1 \right\}}
\newcommand{\Var}{\mathop{\rm Var}\nolimits}
\newcommand{\expect}[1]{{\rm E}\left[ #1 \right]}
\newcommand{\expectsq}[1]{{\rm E}^2\left[ #1 \right]}
\newcommand{\variance}[1]{{\rm Var}\left[ #1 \right]}
\newcommand{\varsq}[1]{{\rm Var}^2\left[ #1 \right]}

%%%I like the old choose! BDT 1/28/94
%\renewcommand{\choose}[2]{{{#1}\atopwithdelims(){#2}}}
\newcommand{\Choose}[2]{{{#1}\atopwithdelims(){#2}}}

\def\pmod#1{\allowbreak\mkern12mu({\rm mod}\,\,#1)}
\newcommand{\matx}[2]{\left(\begin{array}{*{#1}{c}}#2\end{array}\right)}
\newcommand{\Adj}{\mathop{\rm Adj}\nolimits}

\def\typeproblemset{problemset}

\ifx\handouttype\typeproblemset
  \newtheorem{theorem}{Theorem}[problem]
  \newtheorem*{theorem*}{Theorem}
\else
  \newtheorem{theorem}{Theorem}[section]
  \newtheorem*{theorem*}{Theorem}
\fi

\newtheorem{lemma}[theorem]{Lemma}
\newtheorem*{lemma*}{Lemma}

\newtheorem{falsethm}[theorem]{False Theorem}
\newtheorem*{falsethm*}{False Theorem}

\newtheorem{corollary}[theorem]{Corollary}
\newtheorem*{corollary*}{Corollary}

\newtheorem{claim}[theorem]{Claim}
\newtheorem*{claim*}{Claim}

\newtheorem{xample}{Example}

\newtheorem{defin}[theorem]{Definition}
\newtheorem*{defin*}{Definition}

\newtheorem{definition}[theorem]{Definition}
\newtheorem*{definition*}{Definition}

\newtheorem{axiom}[theorem]{Axiom}
\newtheorem*{axiom*}{Axiom}

\newtheorem{fact}{Fact}

\newenvironment{example}{\begin{xample}\rm}{\end{xample}}
%\newenvironment{example}{\begin{fact}\rm}{\end{fact}}

%               \newcommand{\proof}{
%\newenvironment{proof}{\par{\noindent\em Proof.}\hspace{1em}\setlength{\parindent}{3ex}}{\qed}

\renewenvironment{proof}[1][\proofname]{\par
  \normalfont
  \topsep6\p@\@plus6\p@ \trivlist
  \item[\hskip\labelsep\bfseries
    #1\@addpunct{.}]~~\ignorespaces
}{%
  \qed\endtrivlist
}

% CL, spring'00

%\newcommand{\solutionname}{Solution}
%\newenvironment{solution}[1][\solutionname]{%
%  \par
%  \normalfont
%  \topsep6\p@\@plus6\p@ \trivlist
%  \item[\hskip\labelsep\bfseries
%    #1\@addpunct{.}]~~\ignorespaces
%}{%
%\mbox{} \\
%\mbox{}\hrulefill\hspace*{1ex}\ignorespaces%
%\raisebox{-0.25\baselineskip}{$\square$}%
%\hspace*{1ex}\ignorespaces\hrulefill%
%\nopagebreak%
%}

%\renewcommand{\solution}[1]{%
%  \begin{solution}
%    #1
%  \end{solution}
%  }

%\newenvironment{proof}{%
%    \par
%    {\noindent\em Proof.}\hspace{1em}%
%    \setlength{\parindent}{0pt}%
%    \upshape
%}{\qed}

%\newenvironment{remark}{\par{\noindent\bf Remark.}\hspace{1em}\setlength{\parindent}{3ex}}{\qed}
\newenvironment{remark}{\par{\noindent\bf Remark.}\hspace{1em}\setlength{\parindent}{0pt}}{\qed}
\def\squarebox#1{\hbox to #1{\hfill\vbox to #1{\vfill}}}
%\newcommand{\qedbox}{\vbox{\hrule\hbox{\vrule\squarebox{.667em}\vrule}\hrule}}
\newcommand{\qedbox}{\rule{1.2ex}{1.2ex}}
\renewcommand{\qed}{\nopagebreak\mbox{}\hfill\qedbox\smallskip}
\newcommand{\eqnref}[1]{(\protect\ref{#1})}
\newcommand{\thm}{\begin{theorem}}
\newcommand{\ethm}{\end{theorem}}
\newcommand{\lem}{\begin{lemma}}
\newcommand{\elem}{\end{lemma}}
\newcommand{\pf}{\begin{proof}}
\newcommand{\epf}{\end{proof}}

\newcommand{\twodots}{\mathinner{\ldotp\ldotp}}
\newcommand{\fourdots}{$\mathinner{\ldotp\ldotp\ldotp\ldotp}$}

%%% command for putting definitions into boldface
% New style for defined terms, as of 2/23/88, redefined by THC.
\newcommand{\defn}[1]{{\bf #1}}
\newcommand{\defi}[1]{{\bf #1}}

\newcommand{\const}[1]{\ifmmode\mathord{\mathcode`-="702D\sc #1\mathcode`\-="2200}\else$\mathord{\mathcode`-="702D\sc #1\mathcode`\-="2200}$\fi}

%\newcommand{\ckt}[1]{\ifmmode\mathord{\mathcode`-="702D\sc #1\mathcode`\-="2200}\else$\mathord{\mathcode`-="702D\sc #1\mathcode`\-="2200}$\fi}
\newcommand{\ckt}[1]{\ifmmode \sc #1\else$\sc #1$\fi}
\newcommand{\id}[1]{\mbox{\it #1}}
\newcommand{\proc}[1]{%
\ifmmode\mathord{\mathcode`-="702D\sc#1\mathcode`\-="2200}\else{\sc#1}\fi}
\newcommand{\procdecl}[1]{\proc{#1}\vrule width0pt height0pt depth 7pt \relax}
\newcommand{\func}[1]{\ifmmode\mathop{\mathcode`-="702D\rm #1\mathcode`\-="2200}\nolimits\else$\mathop{\mathcode`-="702D\rm #1\mathcode`\-="2200}\nolimits$\fi}

\newif\ifcodeinbox

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% The Code environment %%%

%% The following commands are so we can automatically number and symbolically reference
%% lines.
%% The ``codelinenumber'' counter counts the current line number
\newcounter{codelinenumber}
%% The \zeroli command zeros the line number counter
\newcommand{\zeroli}{\setcounter{codelinenumber}0}
%% The \li command bumps the counter, outputs it, and skips some space
%% It also GLOBALLY sets the value of \@currentlabel, so that the \label
%% commands on the same line work OK.  The problem otherwise is that Latex
%% uses groups on each field of a line in tabbing mode, and this causes
%% \@currentlabel to get reset as soon as a field ends (e.g. at the \').
%% Now, the label can appear after the \\, as in
%%      \li \>\>$x\gets y$ \\ \label{li:assign-x}
%%

\def\@startline{\global\@curtabmar\@nxttabmar\relax
   \global\@curtab\@curtabmar\setbox\@curline\hbox
    {}\@startfield\global\lifalse\strut}

\newenvironment{code}{\global\codeinboxtrue%
\setbox\strutbox\hbox{\vrule height 9pt depth 4pt width0pt}%
\noindent\begin{tabbing}%
\zeroli\setlength{\tabbingsep}{1em}
\hspace*{1em}\=999\ifdoubledigit9\fi
\=\ {\bf if} \={\bf then} \={\bf if} \={\bf then}
        \={\bf if} \={\bf then} \={\bf if} \={\bf then} \={\bf if} \={\bf then}
        \={\bf if} \=\+\+\kill}{\end{tabbing}\global\codeinboxfalse}

\newif\ifdoubledigit
\newcommand{\codebox}[1]{\setbox0=\vbox{\begin{code}#1\end{code}}
\ifnum\c@codelinenumber>9\global\doubledigittrue\else\doubledigitfalse\fi
\vskip1sp\noindent\hskip-14pt%% 
\parbox{\textwidth}{\begin{code}\protect#1\end{code}}\global\let\@currentlabel=\thechapter}

\newif\ifli
\newcommand{\li}{\global\litrue\stepcounter{codelinenumber}%
\ifdoubledigit%
\hbox to8pt{\hss\thecodelinenumber\hskip5pt}\else%
\hbox to8pt{\hskip-1pt\thecodelinenumber\hss}\fi%
\xdef\@currentlabel{\p@codelinenumber\thecodelinenumber}\'}

\newcommand{\marginnote}[1]{\marginpar{\raggedright{\footnotesize #1}}\ignorespaces}

\newcommand{\reals}{{\mathbb{R}}}
\newcommand{\ints}{{\mathbb{Z}}}
\newcommand{\integers}{{\mathbb{Z}}}
\newcommand{\naturals}{{\mathbb{N}}}
\newcommand{\nat}{\naturals}
\newcommand{\nats}{\naturals}
\newcommand{\rationals}{{\mathbb{Q}}}
\newcommand{\complex}{{\mathbb{C}}}
\newcommand{\complexes}{{\mathbb{C}}}

\newcommand{\w}{\omega}                 %% for fft chapter

%\newcommand{\implies}{\Rightarrow}     %% already defined in amstex
%\newcommand{\divides}{\mid}
%\newcommand{\mod}[1]{(\mbox{mod } #1)}

\newenvironment{closeitemize}{\begin{list}%
{$\bullet$}%
{\setlength{\itemsep}{-0.2\baselineskip}%
\setlength{\topsep}{0.2\baselineskip}}}%
{\end{list}}


\long\gdef\boxit#1{\dimen200 = \hsize \advance\dimen200 by -7pt
\begingroup\vbox{\hrule \hbox to \hsize{\vrule\kern3pt
      \vbox{\hsize \dimen200 \kern3pt#1\kern3pt}\hfil \kern3pt\vrule}\hrule}\endgroup}
 
\newlength{\myfigwidth}
\setlength{\myfigwidth}{\columnwidth}
\addtolength{\myfigwidth}{-2ex}  %made this wider -- CS

\newcommand{\boxtext}[1]{\setlength{\myfigwidth}{\columnwidth}\addtolength{\myfigwidth}{-2ex}\boxit{\vspace*{.1ex}\begin{minipage}{\myfigwidth}#1\end{minipage}\\[.1ex]}}

%% Code imported from 6044.sty

\makeatletter

\newtoks\old@everyhbox

\def\Code{%
    \leavevmode
    \old@everyhbox=\expandafter{\the\everyhbox}%
    \everyhbox=\expandafter{%
        \the\everyhbox
        \tt\frenchspacing
        \catcode`\#=12
        \global\everyhbox=\expandafter{\the\old@everyhbox}%
    }%
    \hbox
}

\let\rulesto\longrightarrow

\newcommand{\proves}{%
    \@ifnextchar [{\@proves}{\@proves[]}%
}

\newcommand{\@proves}[1]{% provability (cf. \models)
    \if!#1!
        \vdash
    \else
        \mathrel{\mathop{\vdash}\limits_{#1}}%
    \fi
}

\long\def\@makefntext#1{%
    \parindent 0em%
    \noindent
    \@makefnmark#1
}

\makeatother

\endinput


% Local Variables: 
% mode: latex
% TeX-master: t
% End: 
