% 6.044 macros
% to be \input after \documentstyle[11pt,twoside]{article}

% page size parameters

\setlength\itemindent{0.1in}
%\setlength\topmargin{0in}
\setlength{\itemsep}{0in}
%\setlength{\oddsidemargin}{0.4in}
%\setlength{\evensidemargin}{-0.2in}


\setlength{\topmargin}{-.2in}
\setlength\oddsidemargin{0.1in}
\setlength\evensidemargin{-0.1in}
\setlength\parindent{0.0in} 
\setlength\textwidth{6.3in}
\setlength\textheight{8.4in}
\setlength{\parskip}{\medskipamount}

\newenvironment{newmath}{\begin{displaymath}%
\setlength{\abovedisplayskip}{4pt}%
\setlength{\belowdisplayskip}{4pt}%
\setlength{\abovedisplayshortskip}{3pt}%
\setlength{\belowdisplayshortskip}{3pt} }{\end{displaymath}}

% Cross-references for handout numbers.

\makeatletter
\newcommand{\hlabel}[2]{\write\@auxout{\string\newlabel{#1}{{#2}{0}}}}
\makeatother

\input{/a/class/6.045/6045-spring-92/handouts/handouts}
  % defines handout labels


% Make \section use \large instead of \Large typeface.

\makeatletter
\def\section{\@startsection {section}{1}{\z@}{-3.25ex plus -1ex minus -.2ex}
{1.5ex plus .2ex}{\large\bf}}
\makeatother




% use \nullsec if the first thing after \handout isn't \section

\newcommand{\nullsec}{\vspace*{3.25ex plus 1ex minus .2ex}}


% header hackery

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


% \doheading{handout number}{title}{date}

\def\subjnum{6.045J/18.400J}
\def\subjname{Automata, Computability and Complexity}

\def\doheading#1#2#3{\vfill\eject\vspace*{-\toppush}%
\vbox{\hbox to\textwidth{{\bf}\subjnum: \subjname \hfil Handout #1\strut}%
\hbox to\textwidth{Profs.\ Nancy Lynch and Ronald Rivest\hfil#3\strut}%
    \hrule}}

\newcommand{\htitle}[1]{\vspace*{3.25ex plus 1ex minus .2ex}%
  \begin{center}{\Large\bf #1}\end{center}}


% page style that displays just footers
\makeatletter
\def\ps@justfooters{\let\@mkboth\@gobbletwo\def\@oddhead{}%
	\def\evenhead{}}
\makeatother

% \handout{handout label}{title}{date}

\newcommand{\handout}[3]{\thispagestyle{justfooters}%
  \markboth{\subjnum\ Handout \protect\ref{#1}: #2}%
    {\subjnum\ Handout \protect\ref{#1}: #2}%
  \pagestyle{myheadings}%
  \doheading{\protect\ref{#1}}{#2}{#3}%
  \htitle{#2}}


% \handoutwithouttitle{handout label}{date}

\newcommand{\handoutwithouttitle}[2]{\thispagestyle{justfooters}%
  \markboth{\subjnum\ Handout \protect\ref{#1}}%
    {\subjnum\ Handout \protect\ref{#1}}%
  \pagestyle{myheadings}%
  \doheading{\protect\ref{#1}}{#2}{}}


% hack to get (over) on the bottom of all following odd pages
% must be placed by hand in source text

\makeatletter
\outer\def\OVER{\def\@oddfoot{\message{OVER}\rm\hfil(over)}}
\makeatother


% enumerate environment produces lowercase roman labels in parentheses


\newcounter{ctr}

\newlength{\saveparindent}
\setlength{\saveparindent}{\parindent}
\newlength{\saveparskip}
\setlength{\saveparskip}{\parskip}

\newenvironment{newenum}{%
\begin{list}{(\arabic{ctr})}{\usecounter{ctr} \labelwidth=30pt%
\labelsep=10pt \leftmargin=40pt 
\topsep=3pt% \listparindent=22pt
 \itemsep=0pt }}{\end{list}}

\newenvironment{newitemize}{%
\begin{list}{$\bullet$}{\labelwidth=15pt%
\labelsep=7pt \leftmargin=22pt \topsep=3pt%
\setlength{\listparindent}{\saveparindent}%
\setlength{\parsep}{\saveparskip}%
\setlength{\itemsep}{3pt} }}{\end{list}}

\newenvironment{smallitemize}{%
\begin{list}{$\bullet$}{\labelwidth=13pt%
\labelsep=7pt \leftmargin=20pt \topsep=1pt%
\setlength{\listparindent}{\saveparindent}%
\setlength{\parsep}{\saveparskip}%
\setlength{\itemsep}{1pt} }}{\end{list}}

%\def\labelenumi{(\roman{enumi})}
%\def\theenumi{\roman{enumi}}

% enumalpha is just like a top-level enumerate, but produces alpha labels

\newenvironment{enumalpha}{%
	\def\labelenumi{(\alph{enumi})}%
	\def\theenumi{\alph{enumi}}%
	\begin{enumerate}}%
{	\end{enumerate}}


% fix list indentation

%\dimen0\parindent
%%\setbox0\hbox{(m)}
%%\advance\dimen0 by\wd0
%\advance\dimen0 by\labelsep
%\setlength\leftmargini{\dimen0}	% parindent %% plus room for one letter


% theorems, lemmas, and such, NOT in italic, and with PERIODS.

\makeatletter

%\def\@begintheorem#1#2{\list{}{\leftmargin=\parindent\rightmargin=\parindent}
%	\item[]{\bf #1.}\hskip 1em\relax}
%\def\@opargbegintheorem#1#2#3{\list{}{\leftmargin=\parindent\rightmargin=\parindent}
%	\item[]{\bf #3\ #1.}\hskip 1em\relax}
%\let\@endtheorem=\endlist

\def\@begintheorem#1#2{\trivlist \item[\hskip \labelsep{\bf #1\ #2.}]}
\def\@opargbegintheorem#1#2#3{\trivlist
      \item[\hskip \labelsep{\bf #1\ #2\ (#3).}]}
\def\@endtheorem{\endtrivlist}

\makeatother

\newtheorem{lemma}{Lemma}
\newtheorem{claim}{Claim}
\newtheorem{proposition}{Proposition}
\newtheorem{theorem}{Theorem}
\newtheorem{corollary}{Corollary}
\newtheorem{definition}{Definition}
\newtheorem{exercise}{Exercise}
\newtheorem{axiom}{Axiom}
\newtheorem{expression}{Expression}
\newtheorem{newexamp}{Example}
\newtheorem{newnot}{Notation}
\newtheorem{newrem}{Remark}

% things that are like theorems but without numbers

\newenvironment{remark}{\trivlist\item[]{\bf Remark.}\ }%
					   {\endtrivlist}

\newenvironment{proof}{\trivlist\item[]{\it Proof:}\ }%
					  {\QED\endtrivlist}

\newenvironment{proofsketch}{\trivlist\item[]{\it Proof Sketch:}\ }%
					  {\QED\endtrivlist}

\newenvironment{proofx}[1]{\trivlist\item[]{\it Proof \rm #1.}\ }%
						  {\QED\endtrivlist}

\newenvironment{example}{\trivlist\item[]{\bf Example.}\ }%
					    {\endtrivlist}

\newenvironment{examples}{\trivlist\item[]{\bf Examples.}\ }%
					     {\endtrivlist}

\newenvironment{lemma*}{\trivlist\item[]{\bf Lemma.}\ }%
					    {\endtrivlist}

% hack \paragraph to get spacing right

\makeatletter
\def\paragraph{\@startsection
	{paragraph}{4}{\z@}{3.25ex plus 1ex minus .2ex}{-.6em}{\normalsize\bf}}
\makeatother


% \subsection works like \paragraph, but inserts a period

\def\subsection#1{\paragraph{#1.}}



% problems and subproblems

\newcounter{problem}
\newcounter{subproblem}[problem]

\def\theproblem{\arabic{problem}}
\def\thesubproblem{\arabic{problem}(\alph{subproblem})}


% better problem macros by Alex Ishii

\makeatletter
\def\AIproblem{\@startsection
	{paragraph}{4}{\z@}{3.25ex plus 1ex minus .2ex}{-.6em}{\large\bf}}
\def\AIsubproblem{\@startsection
	{paragraph}{4}{\z@}{1.5ex plus .2ex}{-.6em}{\normalsize\bf}}
\makeatother


\def\problem#1{\refstepcounter{problem}\AIproblem{Problem \theproblem. #1 \hfil\break}}

\def\subproblem#1{\refstepcounter{subproblem}\AIsubproblem{\thesubproblem~\rm[#1].}}



% problems with point values
\def\problemp#1{\refstepcounter{problem}\paragraph
		{Problem \theproblem~\rm[#1 points].}}

% for when problem numbers must be explicitly specified (as in errata)
\def\problemx#1{\paragraph{Problem #1.}}
\def\subproblemx#1{\paragraph{#1.}}


\def\readingproblem {\paragraph{Reading for the Problem Set.}}
\def\readinglecture {\paragraph{Reading for Lectures.}}
\def\reading {\paragraph{Reading assignment.}}

\def\due{\paragraph{Due:}}
\def\reminder{\paragraph{Reminder:}}

% subproblems as lists (alternative to \subproblem paragraphs)

\dimen0\labelsep
\setbox0\hbox{\bf(m)}
\edef\subproblabelwidth{\the\wd0\relax}
\advance\dimen0 by\wd0
\edef\subprobleftmargin{\the\dimen0\relax}

\newenvironment{subproblems}{\list{\bf(\alph{subproblem})}%
								  {\usecounter{subproblem}
								   \leftmargin\subprobleftmargin
								   \labelwidth\subproblabelwidth}}%
						   {\endlist}

\newenvironment{moresubproblems}{\list{\bf(\alph{subproblem})}%
								  {\count9=\value{subproblem}%
								   \usecounter{subproblem}%
								   \setcounter{subproblem}{\count9}%
								   \leftmargin\subprobleftmargin
								   \labelwidth\subproblabelwidth}}%
						   {\endlist}

% for putting point values on subproblems

\def\itemp#1{\item{[#1 points]}}


% Plain TeX math macros
% LaTeX math mode stuff loses big, so we restore the following macros
% from Plain TeX.

\makeatletter

\def\eqalignno#1{\displ@y \tabskip\@centering
  \halign to\displaywidth{\hfil$\@lign\displaystyle{##}$\tabskip\z@skip
    &$\@lign\displaystyle{{}##}$\hfil\tabskip\@centering
    &\llap{$\@lign##$}\tabskip\z@skip\crcr
    #1\crcr}}

\def\leqalignno#1{\displ@y \tabskip\@centering
  \halign to\displaywidth{\hfil$\@lign\displaystyle{##}$\tabskip\z@skip
    &$\@lign\displaystyle{{}##}$\hfil\tabskip\@centering
    &\kern-\displaywidth\rlap{$\@lign##$}\tabskip\displaywidth\crcr
    #1\crcr}}

\def\eqalign#1{\null\,\vcenter{\openup\jot\m@th
  \ialign{\strut\hfil$\displaystyle{##}$&$\displaystyle{{}##}$\hfil
      \crcr#1\crcr}}\,}

% like \eqalign, but a full-width display
% This is a straightforward hack on \eqalignno
\def\dispalign#1{\displ@y  \tabskip\@centering
  \halign to\displaywidth{\hfil$\@lign\displaystyle{##}$\tabskip\z@skip
    &$\@lign\displaystyle{{}##}$\hfil\tabskip\@centering\cr
	#1\crcr}}

% like \eqalignno, but final field set in roman (for line-by-line comments)
\def\eqaligncmt#1{\displ@y
  \vbox{\halign{\hfil$\@lign\displaystyle{##}$
	&$\@lign\displaystyle{{}##}$\hfil
    &\qquad\qquad##\hfil\crcr
    #1\crcr}}}

\makeatother



% abbreviations

\def\ie{{\em i.e.}}
\def\etc{{\em etc.}}
\def\eg{{\em e.g.}}
\def\wlog{{\em w.l.o.g.}}
\def\cf{{\em cf.}}
\def\viz{{\em viz.}}
\def\eqdef{\stackrel{\rm def}{=}}        % ``equals by definition''
\def\hint{{\em Hint}\/:\ }		% for in-line hints
\def\note{{\em Note}\/:\ }		% for in-line notes
\def\suchthat{\! : \:}

\def\LP{Lewis \& Papadimitriou}


% notation

\newcommand{\mathify}[1]{\ifmmode{#1}\else\mbox{$#1$}\fi}
\newcommand{\Cal}[1]{\mathify{{\cal #1}}}

\def\Nat{{\bf N}}				% natural numbers
\def\Int{{\it Int}}				% integers
\def\Bool{{\it Bool}}			% booleans
\def\true{{\tt true}}
\def\false{{\tt false}}
\def\I{{\cal I}}				% interpretations
\def\M{{\cal M}}				% meaning functions
\def\A{{\cal A}}				% arithmetic interpretation
\def\B{{\cal B}}				% binary word interpretation
\def\TIME{\mathop{\rm TIME}\nolimits}
%\def\[{\lbrack\!\lbrack}        % meaning brackets
%\def\]{\rbrack\!\rbrack}
\def\is{\Leftarrow}			% defining symbol for rps functions
\def\emptystring{\mathify{e}}           % empty string
\def\psubset{\sqsubset}
\let\comp\Longrightarrow		% one-step computation

\let\to=\rightarrow				% function space
\let\pto=\leadsto				% partial function space

\let\drw=\Rightarrow			% definition of a rewrite rule
\let\rw=\longrightarrow			% rewrites relation
\def\rwtwo{\mathrel{\mathop{\kern0pt\longrightarrow}%
			\limits^{\vbox to 0pt{\vss\hbox{$\scriptstyle2$}}}}}
					% two-way rewrites relation
			% (This convoluted definition will make ^*
                        %  appear in the right spot in $\rwtwo^*$.)


\let\intersect=\cap				% set intersection
\let\union=\cup					% set union
\let\cross=\times				% cross product
\mathchardef\subset="3212		% subset
%\mathchardef\psubset="321A		% proper subset
\let\implies=\supset				% implication in wffs
\let\Land=\bigwedge				% big logical And
\let\Lor=\bigvee				% big logical Or
\let\conj=\wedge
\let\disj=\vee

\let\proves=\vdash				% provability (cf. \models)

\def\alt{\mathrel{|}}			% | as a relation for BNF alternatives

\def\th{^{\,\rm th}}			% ordinals (e.g., $1\st$)
\def\st{^{\,\rm st}}

\def\pair{\mathop{\it pair}\nolimits} % pairing
\def\pleft{\mathop{\it left}\nolimits}
\def\pright{\mathop{\it right}\nolimits}

\def\dom{\mathop{\rm domain}\nolimits}
\def\ran{\mathop{\rm range}\nolimits}

\def\bits{\{{\tt 0},{\tt 1}\}}	% for binary words (\bits^*)
\def\balph{\{{\tt a},{\tt b}\}}  % binary alphabet of two symbols

% L&S doesn't use these for sequences, so we use them for other things
\let\<=\langle					% angle brackets
\let\>=\rangle

% for use in math displays
%\def\implies{\quad\hbox{implies}\quad}  % logical implication
\def\iff{\hspace{10pt}\mbox{ iff }\hspace{10pt}} 
\def\cmt#1{\qquad\hbox{#1}}			% comment about a line

\def\arity{\mathop{\rm arity}\nolimits}

% \def\##1{\widehat{#1}}			% numerals
\def\@#1{\mathord{\hbox{\boldmath$#1$}}} % actual (not meta) variables
\def\.#1{{\rm #1}}				% roman letters in math mode

% computability
\def\redm{\leq_{\rm m}}		        % many-one reduction
\def\redp{\leq_{\rm p}}		        % poly-time reduction
\def\equivm{\equiv_{\rm m}}		% many-one equivalence
\def\redt{\leq_{\rm T}}			% Turing reduction
\def\sredt{<_{\rm T}}			% strict Turing reduction
\let\complement=\overline		% set complement
\let\blank=\#	                % blank for TM tapes
\def\sep{\hbox{\tt\$}}			% separator symbol

% QED slug (do not precede by any spaces)
\def\QED{\penalty 1000\ \raise 1pt\hbox{\vrule height6pt width6pt depth0pt}}


% stuff for Scheme code

\def\evals{\hbox{\qquad$\Longrightarrow$\qquad}}

% \activetabs makes the tab character insert \hskip\tabbingsep
{\catcode`\^^I=\active
\gdef\activetabs{\catcode'11=\active \def^^I{\hskip\tabbingsep}}}

\newenvironment{scheme}{\tt\begin{tabbing}\ignorespaces}{\end{tabbing}}

% hackery to get " to produce \tt names
% e.g., "foo" is {\tt foo}
\catcode`"=\active
\def"{\hbox\bgroup\let"=\egroup\tt}

% poor man's bold (for the stuff that \boldmath doesn't handle properly)
\def\pmb#1{\setbox0=\hbox{#1}%
	\kern-.025em\copy0\kern-\wd0
	\kern.05em\copy0\kern-\wd0
	\kern-.025em\raise.0433em\box0}


% stuff for while programs
% most people use bold, but the book uses italics for keywords

\def\If{{\it if\ }}
\def\Then{{\it then\ }}
\def\Else{{\it else\ }}
\def\Fi{{\it fi}}
\def\Cond#1#2#3{\If #1\ \Then #2\ \Else #3\ \Fi}
\def\While{{\it while\ }}
\def\Do{{\it do\ }}
\def\Od{{\it od}}
\def\Skip{{\it skip\ }}
\def\Goto{{\it goto\ }}
\def\Diverge{{\it diverge\ }}

%\newenvironment{code}{\begin{center}
%\begin{tabular}{l}}%
%					 {\end{tabular}
%\end{center}}

%\def\code{\begin{center}
%\begin{tabular}{l}}

\newcommand{\code}[1]{{\langle {#1} \rangle}}
\def\endcode{\end{tabular}
\end{center}}
\newcommand{\NP}{{\bf NP}}
\newcommand{\IP}{{\bf IP}}

%%%%%%%%%%%%%%%%%%%%%%%%Specific macros for the class (beginning):
% many one reducible:
%\newcommand{\mless}{\raisebox{-1ex}{$\stackrel{<}{\ {\scriptstyle m}\ }$}}
% many one equivalent:
%\newcommand{\meq}{\raisebox{-1ex}{$\stackrel{\equiv}{\ {\scriptstyle m}\ }$}}


%%%%%%%%%%%%%%%%%%%%%%%%Specific macros for the class (end).







\newcommand{\yields}{{\;\vdash\;}}
\newcommand{\yieldsstar}{{\;\vdash}^{\hspace{-0.8ex}*\;}}
\newcommand{\yieldsM}{\;{\vdash}_{\hspace{-1.1ex}\vspace{-.1ex}M}\;}
\newcommand{\yieldsMstar}{ \;{\vdash}^{\hspace{-0.8ex}*}_
			{\hspace{-1.1ex}\vspace{-.1ex}M}\;}



