%% 
%% This is file `6895.sty',
%% 
%% It includes most macros used for the CLR book
%% and some of the macros used for course handouts

\def\fileversion{1.0}
\def\filedate{2003/8/25}
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{6895}[\filedate{} macros for the 6.895 class at MIT]

\usepackage{latexsym}
\usepackage{bbm}
\usepackage[small,bf]{caption2}
\usepackage{graphics}
\usepackage{amsmath, amssymb}

%% Page size

\setlength{\oddsidemargin}{0pt}
\setlength{\evensidemargin}{0pt}
\setlength{\textwidth}{6.5in}
\setlength{\topmargin}{0in}
\setlength{\textheight}{8.5in}

%% Misc

% Some hacks to make HTML happier.
\newcommand{\vskipargs}[1]{\vskip #1}
\newcommand{\newproc}{\hrule\vskipargs{1ex plus 0.1ex minus 0.1ex}}

% Tilde for webstuff
\newcommand{\webtilde}{\raisebox{-.8ex}\~}

% Comment out chunks.
\newcommand{\punt}[1]{}
\newcommand{\remove}[1]{}

% Footnote commands.
\newcommand{\footnotenonumber}[1]{{\def\thempfn{}\footnotetext{#1}}}
\newcommand{\footnotetight}[1]{\footnote{\renewcommand\baselinestretch{1}\footnotesize #1}}

% Commands for handout headers
\newcommand{\handout}[5]{
   \renewcommand{\thepage}{#1-\arabic{page}}
   \noindent
   \begin{center}
   \framebox{
     \vbox{
       \hbox to 5.78in { {\bf 6.895 Theory of Parallel Systems} \hfill #5 }
       \vspace{4mm}
       \hbox to 5.78in { {\Large \hfill #2  \hfill} }
       \vspace{2mm}
       \hbox to 5.78in { {\it #3 \hfill #4} }
     }
   }
   \end{center}
   \vspace*{4mm}
   \newcommand{\lecturenum}{#1}
}

\newcommand{\lecturetitle}[3]{\handout{#1}{#2}{Lecturer: Charles
    Leiserson}{Scribe: #3}{Lecture #1}}
\newcommand{\guestlecturetitle}[4]{\handout{#1}{#2}{Lecturer: #4}{Scribe: #3}{Lecture #1}}

% Assorted theorem/proof environments

\newtheorem{theorem}{Theorem}
\newtheorem{corollary}[theorem]{Corollary}
\newtheorem{lemma}[theorem]{Lemma}
\newtheorem{observation}[theorem]{Observation}
\newtheorem{proposition}[theorem]{Proposition}
\newtheorem{definition}[theorem]{Definition}
\newtheorem{claim}[theorem]{Claim}
\newtheorem{fact}[theorem]{Fact}
\newtheorem{assumption}[theorem]{Assumption}

\newcommand{\qedbox}{\vbox{\hrule\hbox{\vrule\squarebox{.667em}\vrule}\hrule}}
\newcommand{\qed}{\nopagebreak\mbox{}\hfill\qedbox\smallskip}
\newcommand{\dis}{\mathop{\mbox{\rm d}}\nolimits}
\newcommand{\per}{\mathop{\mbox{\rm per}}\nolimits}
\newcommand{\area}{\mathop{\mbox{\rm area}}\nolimits}
\newcommand{\cw}{\mathop{\rm cw}\nolimits}
\newcommand{\ccw}{\mathop{\rm ccw}\nolimits}
\newcommand{\DIST}{\mathop{\mbox{\rm DIST}}\nolimits}
\newcommand{\OP}{\mathop{\mbox{\it OP}}\nolimits}
\newcommand{\OPprime}{\mathop{\mbox{\it OP}^{\,\prime}}\nolimits}
\newcommand{\ihat}{\hat{\imath}}
\newcommand{\jhat}{\hat{\jmath}}
\newcommand{\abs}[1]{\mathify{\left| #1 \right|}}

\newenvironment{proof}{\noindent{\bf Proof}\hspace*{1em}}{\qed\bigskip\\}
\newenvironment{proof-sketch}{\noindent{\bf Sketch of Proof}\hspace*{1em}}{\qed\bigskip\\}
\newenvironment{proof-idea}{\noindent{\bf Proof Idea}\hspace*{1em}}{\qed\bigskip\\}
\newenvironment{proof-of-lemma}[1]{\noindent{\bf Proof of Lemma #1}\hspace*{1em}}{\qed\bigskip\\}
\newenvironment{proof-attempt}{\noindent{\bf Proof Attempt}\hspace*{1em}}{\qed\bigskip\\}
\newenvironment{proofof}[1]{\noindent{\bf Proof} of #1:\hspace*{1em}}{\qed\bigskip\\}
\newenvironment{remark}{\noindent{\bf Remark}\hspace*{1em}}{\bigskip}

% Figure/Tables Stuff

\makeatletter
\def\fnum@figure{{\bf Figure \thefigure}}
\def\fnum@table{{\bf Table \thetable}}
\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

\newcommand{\figcaption}[1]{\mycaption[]{#1}}
\newcommand{\tabcaption}[1]{\mycaption[]{#1}}
\newcommand{\head}[1]{\chapter[Lecture \##1]{}}
\newcommand{\mathify}[1]{\ifmmode{#1}\else\mbox{$#1$}\fi}
\renewcommand{\Pr}[1]{\mathify{\mbox{Pr}\left[#1\right]}}
\newcommand{\Exp}[1]{\mathify{\mbox{Exp}\left[#1\right]}}
\newcommand{\bigO}O
\newcommand{\set}[1]{\mathify{\left\{ #1 \right\}}}
\def\half{\frac{1}{2}}

\def\implies{\Rightarrow}
\def\sizeof#1{\left| #1\right|}
\def\setof#1{\left\{ #1\right\}  }


%% Math Stuff, Symbols

% Number sets.
\newcommand{\reals}             {\mathbbm{R}}
\newcommand{\integers}          {\mathbbm{Z}}
\newcommand{\naturals}          {\mathbbm{N}}
\newcommand{\rationals}         {\mathbbm{Q}}
\newcommand{\complex}           {\mathbbm{C}}

% Useful shorthands.

\newcommand{\norm}[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{\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{\sbrace}[1]{\left[#1\right]}
\newcommand{\cbrace}[1]{\left\{#1\right\}}
\newcommand{\paren}[1]          {\left( #1 \right)}
\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]}
\renewcommand{\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}
\newcommand{\percent}[1]        {#1\%}

\newtheorem{xample}             {Example}
\newenvironment{example}        {\begin{xample}\rm}{\end{xample}}

\def\squarebox#1{\hbox to #1{\hfill\vbox to #1{\vfill}}}

\newcommand{\eqnref}[1]         {(\protect\ref{#1})}

\newcommand{\twodots}           {\mathinner{\ldotp\ldotp}}
\newcommand{\transpose}         {^{\mbox{\scriptsize \sf T}}}
\newcommand{\amortized}[1]      {\widehat{#1}}

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

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

% definitions and special styles

\newcommand{\defn}[1]           {{\textit{\textbf{\boldmath #1}}}}
\newcommand{\defi}[1]           {{\textit{\textbf{\boldmath #1\/}}}}
\newcommand{\const}[1]          {\ifmmode\mbox{\textsc{#1}}\else\textsc{#1}\fi}
\newcommand{\reduc}             {\leq_{\rm P}}
\newcommand{\lang}[1]           {\ifmmode\mathord{\mathcode`-="702D\rm#1\mathcode`\-="2200}\else{\rm#1}\fi}
\newcommand{\ckt}[1]            {\ifmmode \sc #1\else$\sc #1$\fi}
\newcommand{\id}[1]             {\ifmmode\mathit{#1}\else\textit{#1}\fi}
\newcommand{\proc}[1]           {\ifmmode\mbox{\textsc{#1}}\else\textsc{#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}
%% Code environment

\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{\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

\newcommand{\Spawn}             {{\bf spawn} }
\newcommand{\Sync}              {{\bf sync} }

%% References and Labels

\newcommand{\chaplabel}[1]  {\label{chap:#1-\lecturenum}}
\newcommand{\chapref}[1]        {Chapter~\ref{chap:#1-\lecturenum}}
\newcommand{\seclabel}[1]   {\label{sec:#1-\lecturenum}}
\newcommand{\secref}[1]         {Section~\ref{sec:#1-\lecturenum}}
\newcommand{\secreftwo}[2]      {Sections \ref{sec:#1-\lecturenum} and~\ref{sec:#2-\lecturenum}}
\newcommand{\secrefthree}[3]    {Sections \ref{sec:#1-\lecturenum}, \ref{sec:#2-\lecturenum}, and \ref{sec:#3-\lecturenum}}
\newcommand{\secreffour}[4]     {Sections \ref{sec:#1-\lecturenum}, \ref{sec:#2-\lecturenum}, \ref{sec:#3-\lecturenum}, and~\ref{sec:#4-\lecturenum}}
\newcommand{\applabel}[1]   {\label{app:#1-\lecturenum}}
\newcommand{\appref}[1]         {Appendix~\ref{app:#1-\lecturenum}}
\newcommand{\figlabel}[1]   {\label{fig:#1-\lecturenum}}
\newcommand{\figref}[1]         {Figure~\ref{fig:#1-\lecturenum}}
\newcommand{\figreftwo}[2]      {Figures \ref{fig:#1-\lecturenum}
  and~\ref{fig:#2-\lecturenum}}
\newcommand{\tablabel}[1]   {\label{tab:#1-\lecturenum}}
\newcommand{\tabref}[1]         {Table~\ref{tab:#1-\lecturenum}}
\newcommand{\stlabel}[1]    {\label{st:#1-\lecturenum}}
\newcommand{\stref}[1]          {Step~\ref{st:#1-\lecturenum}}
\newcommand{\thmlabel}[1]   {\label{thm:#1-\lecturenum}}
\newcommand{\thmref}[1]         {Theorem~\ref{thm:#1-\lecturenum}}
\newcommand{\lemlabel}[1]   {\label{lem:#1-\lecturenum}}
\newcommand{\lemref}[1]         {Lemma~\ref{lem:#1-\lecturenum}}
\newcommand{\lemreftwo}[2]      {Lemmas \ref{lem:#1-\lecturenum} and~\ref{lem:#2-\lecturenum}}
\newcommand{\lemrefthree}[3]    {Lemmas \ref{lem:#1-\lecturenum}, \ref{lem:#2-\lecturenum} and~\ref{lem:#3-\lecturenum}}
\newcommand{\corlabel}[1]   {\label{cor:#1-\lecturenum}}
\newcommand{\corref}[1]         {Corollary~\ref{cor:#1-\lecturenum}}
\newcommand{\equlabel}[1]    {\label{eq:#1-\lecturenum}}
\newcommand{\equref}[1]         {Equation~(\ref{eq:#1-\lecturenum})}
\newcommand{\equreftwo}[2]      {Equations (\ref{eq:#1-\lecturenum}) and~(\ref{eq:#2-\lecturenum})}
\newcommand{\inequlabel}[1] {\label{ineq:#1-\lecturenum}}
\newcommand{\inequref}[1]       {Inequality~(\ref{ineq:#1-\lecturenum})}
\newcommand{\inequreftwo}[2]    {Inequalities (\ref{ineq:#1-\lecturenum}) and~(\ref{ineq:#2-\lecturenum})}
\newcommand{\invlabel}[1]   {\label{inv:#1-\lecturenum}}
\newcommand{\invref}[1]         {Invariant~\ref{inv:#1-\lecturenum}}
\newcommand{\deflabel}[1]   {\label{def:#1-\lecturenum}}
\newcommand{\defref}[1]         {Definition~\ref{def:#1-\lecturenum}}
\newcommand{\proplabel}[1]  {\label{prop:#1-\lecturenum}}
\newcommand{\propref}[1]        {Property~\ref{prop:#1-\lecturenum}}
\newcommand{\caselabel}[1]  {\label{case:#1-\lecturenum}}
\newcommand{\caseref}[1]        {Case~\ref{case:#1-\lecturenum}}
\newcommand{\casereftwo}[2]     {Cases \ref{case:#1-\lecturenum} and~\ref{case:#2-\lecturenum}}
\newcommand{\lilabel}[1]   {\label{li:#1-\lecturenum}}
\newcommand{\liref}[1]          {line~\ref{li:#1-\lecturenum}}
\newcommand{\Liref}[1]          {Line~\ref{li:#1-\lecturenum}}
\newcommand{\lirefs}[2]         {lines \ref{li:#1-\lecturenum}--\ref{li:#2-\lecturenum}}
\newcommand{\Lirefs}[2]         {Lines \ref{li:#1-\lecturenum}--\ref{li:#2-\lecturenum}}
\newcommand{\lireftwo}[2]       {lines \ref{li:#1-\lecturenum} and~\ref{li:#2-\lecturenum}}
\newcommand{\lirefthree}[3]     {lines \ref{li:#1-\lecturenum}, \ref{li:#2-\lecturenum}, and~\ref{li:#3-\lecturenum}}
\newcommand{\exlabel}[1]    {\label{ex:#1-\lecturenum}}
\newcommand{\exref}[1]          {Exercise~\ref{ex:#1-\lecturenum}}
\newcommand{\princlabel}[1] {\label{prop:#1-\lecturenum}}
\newcommand{\princref}[1]       {Principle~\ref{prop:#1-\lecturenum}}

\newcommand{\leclabel}[1]   {\label{generic:#1-\lecturenum}}
\newcommand{\lecref}[1]     {\ref{generic:#1-\lecturenum}}

%% Macros to typeset problems and exercises

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

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

\newcommand{\hint}{{\em Hint:\ }}

\newcounter{problemnum}
\newcommand{\theproblem}{\noindent {\bf Problem \arabic{problemnum}.\T}}

\newenvironment{problem}{\setcounter{problempartnum}{0}
  \theproblem}{\addtocounter{problemnum}{1} \hfill \\}

\newenvironment{problems}[3]{
  \handout{}{Problems #2--#3}{}{}{#1}
  \setcounter{problemnum}{#2}}{}

\newcommand{\resetsubprobs}{\setcounter{problempartnum}{0}}

\makeatletter
%\newcommand{\problem}{\item \let\@currentlabel=\theproblem}
\makeatother

\newcounter{problempartnum}[problemnum]
\newenvironment{problempart}{\hfill \newline
  \addtocounter{problempartnum}{1}
  \noindent {\bf Problem
    \arabic{problemnum}.\alph{problempartnum}.\T}}
{\hfill \\}
  
  \newcounter{exercisenum} \newcommand{\theexercise}{Exercise
    \theproblemsetnum-\arabic{exercisenum}}
  \newenvironment{exercises}{
        \begin{list}{{\bf \theexercise. \hspace*{0.5em}}}
        {\setlength{\leftmargin}{0em}
         \setlength{\rightmargin}{0em}
         \setlength{\labelwidth}{0em}
         \setlength{\labelsep}{0em}
        \usecounter{exercisenum}}}{\end{list}}
\makeatletter
\newcommand{\exercise}{\item \let\@currentlabel=\theexercise}
\makeatother

\newcounter{exercisepartnum}[exercisenum]

\newenvironment{exerciseparts}{
        \begin{list}{{\bf (\alph{exercisepartnum})}}
        {\setlength{\leftmargin}{2.5em}
         \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.

%% New text environments

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

\newcounter{ccount}

\newenvironment{closeenum}
        {\begin{list}{\arabic{ccount}.}
        {\usecounter{ccount}\setlength{\itemsep}{-0.2\baselineskip}
         \setlength{\topsep}{0.2\baselineskip}
         \setlength{\parskip}{0pt}}}
        {\end{list}}

%% Subheadings

\newcommand{\subheading}[1]{\subsubsection*{\boldmath #1 \unboldmath}}

%% Margin notes - use \notesfalse to turn off notes.
\setlength{\marginparwidth}{0.6in}
\reversemarginpar
\newif\ifnotes
\notestrue
\newcommand{\longnote}[1]{
  \ifnotes
    {\medskip\noindent Note: \marginpar[\hfill$\Longrightarrow$]
      {$\Longleftarrow$}{#1}\medskip}
  \fi}
\newcommand{\note}[1]{
  \ifnotes
    {\marginpar{\tiny \raggedright{#1}}}
  \fi}


% \putfig{name}{caption}
% "name" should be name of figure file minus ".eps" extension.
% Reference as \figref{name}

\newcommand{\putfig}[2]{
\begin{figure}[t]
%\centerline{\mbox{\psfig{figure=#1.eps}}}
\centerline{\mbox{\includegraphics{#1.eps}}}
\caption{#2}
\label{fig:#1-\lecturenum}
\end{figure}
}

%Environment to restate a theorem with the same number.
\newenvironment{reftheorem}[1]{\begin{trivlist}\item[\hskip
\labelsep{\bf Theorem \ref{thm:#1-\lecturenum}}]\it}
{\end{trivlist}}

\newenvironment{reflemma}[1]{\begin{trivlist}\item[\hskip
\labelsep{\bf Lemma \ref{lem:#1-\lecturenum}}]\it}
{\end{trivlist}}


%% Stuff from CLR that I don't understand. -Harald
%
%
%% \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%
%
%\def\@startline{\global\@curtabmar\@nxttabmar\relax
%   \global\@curtab\@curtabmar\setbox\@curline\hbox
%    {}\@startfield\global\lifalse\strut}
%
%% Sectioning commands.
%\newcommand{\subsec}[1]{\subsection{\boldmath #1 \unboldmath}}
%\newcommand{\subheading}[1]{\subsubsection*{\boldmath #1 \unboldmath}}
%\newcommand{\subsubheading}[1]{\paragraph*{#1}}
%
%% This command would be better if it figured out the size
%\newcommand{\tight}{\renewcommand\baselinestretch{1}\normalsize}
%
%\newcommand{\Ts}{T_{{\rm S}}}
%\newcommand{\Ti}{T_\infty}
%\newcommand{\threada}{\alpha}
%\newcommand{\threadb}{\beta}
%\newcommand{\processor}{P}
%\newcommand{\cilkv}{\hbox{Cilk-5}}

\newcommand{\B}{\vspace*{-\smallskipamount}}
\newcommand{\BB}{\vspace*{-\medskipamount}}
\newcommand{\BBB}{\vspace*{-\bigskipamount}}
\newcommand{\F}{\vspace*{\smallskipamount}}
\newcommand{\FF}{\vspace*{\medskipamount}}
\newcommand{\FFF}{\vspace*{\bigskipamount}}
\newcommand{\T}{\hspace*{1em}} 
\newcommand{\TT}{\hspace*{2em}}
\newcommand{\TTT}{\hspace*{3em}} 
\newcommand{\NT}{\hspace*{-1em}}

\newenvironment{summary}{\section*{Lecture
    Summary}\begin{enumerate}}{\end{enumerate}}
\newcommand{\sumitem}[2]{\item {\em #1} \hfill \\ #2}

\newenvironment{lecture}[3]{\begin{document}
    \lecturetitle{#1}{#2}{#3}}{}
\newenvironment{guestlecture}[4]{\begin{document}
    \guestlecturetitle{#1}{#2}{#3}{#4}}{}

\newcommand{\theend}{\end{document}}





