%% 6046preamble.tex
%% this should be included with a command like
%% \input{6046preamble.tex}

\usepackage{amssymb,amsfonts,amsmath,mathrsfs} 

%
% Set lengths
%

\setlength{\oddsidemargin}{.25in}
\setlength{\evensidemargin}{.25in}
\setlength{\textwidth}{6in}
\setlength{\topmargin}{-0.4in}
\setlength{\textheight}{8.5in}

%
% mathify-- ensure argument is in math mode
%

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


%
% Impressive box to go at the top of the first page
%

\def\subjnum{18.440}
\def\subjname{Algorithms}


\newcommand{\handout}[5]{
  \renewcommand{\thepage}{#1-\arabic{page}}
  \noindent
  \begin{center}
    \framebox{
      \vbox{
        \hbox to 5.78in { {\bf \subjnum} {\bf \hfill #2} }
        \vspace{4mm}
        \hbox to 5.78in { {\Large \hfill #5  \hfill} }
        \vspace{2mm}
        \hbox to 5.78in { #3 \hfill #4 }
        }
      }
  \end{center}
  \vspace*{4mm}
  }

\newcommand{\lecture}[4]{\handout{#1}{#2}{Lecturer:
    #3}{Scribe: #4}{Lecture #1}}

\newcommand{\homework}[4]{\handout{#1}{#2}{#3}{#4}{Homework #1}}
\newcommand{\pset}[4]{\handout{#1}{#2}{#3}{#4}{Problem Set #1}}

\newcommand{\recitation}[4]{\handout{#1}{#2}{#3}{#4}{Recitation #1}}

%
% Useful symbols
%

\newcommand{\qed}{\rule{7pt}{7pt}}
\newcommand{\ihat}{\hat{\imath}}
\newcommand{\jhat}{\hat{\jmath}}
\newcommand{\Nat}{\bf N}                               % natural numbers
\newcommand{\Int}{\mathbf{Z}}                             % integers
\newcommand{\Bool}{\it Bool}                   % booleans
\newcommand{\true}{\tt t}
\newcommand{\false}{\tt f}
\newcommand{\I}{\cal I}                                % interpretations
\newcommand{\M}{\cal M}                         % meaning functions
\newcommand{\A}{\cal A}                         % arithmetic interpretation
\newcommand{\B}{\cal B}                         % binary word interpretation
\newcommand{\TIME}{\mathop{\rm TIME}\nolimits}
\newcommand{\NTIME}{\mathop{\rm NTIME}\nolimits}
\newcommand{\SPACE}{\mathop{\rm SPACE}\nolimits}
\newcommand{\NSPACE}{\mathop{\rm NSPACE}\nolimits}
\newcommand{\union}{\cup}
\newcommand{\intersect}{\cap}
%\newcommand{\implies}{\Rightarrow}

% 
% Useful functions
%

\newcommand{\abs}[1]{\mathify{\left| #1 \right|}}
\renewcommand{\Pr}[1]{\mathify{\mbox{Pr}\left[#1\right]}}
\newcommand{\Exp}[1]{\mathify{\mbox{Exp}\left[#1\right]}}
\newcommand{\set}[1]{\mathify{\left\{ #1 \right\}}}
\newcommand{\cset}[2]{\set{#1\ :\ #2}}  % a conditional notation to define sets
\newcommand{\lset}[2]{\set{#1,\ldots,#2}} % set {from,...,to}
\newcommand{\suchthat}{\vert}
\newcommand{\st}{\suchthat}
%
% For pseudo-code
%

\newcommand{\FOR}{{\bf for}}
\newcommand{\TO}{{\bf to}}
\newcommand{\DO}{{\bf do}}
\newcommand{\WHILE}{{\bf while}}
\newcommand{\AND}{{\bf and}}
\newcommand{\IF}{{\bf if}}
\newcommand{\THEN}{{\bf then}}
\newcommand{\ELSE}{{\bf else}}



%
% Useful environments-- theorem-like
%


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

%
% Useful environments for proofs
%

\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{algorithm}{\noindent{\bf Algorithm:}\hspace*{1em}}{\qed\bigskip}
\newenvironment{ppart}[1]{\noindent{\bf #1:\hspace*{1em}}}{\bigskip\vspace{.1in}}
 
\newenvironment{pssec}[1]{\noindent{\bf #1:}\hspace*{1em}}{\bigskip\paragraph{}}
%\newenvironment{remark}{\noindent{\bf Remark:}\hspace*{1em}}{\bigskip}

%
% abbreviations
%
\newcommand{\ie}{\em i.e.}
\newcommand{\etc}{\em etc.}
\newcommand{\eg}{\em e.g.}
\newcommand{\wlogg}{\em w.l.o.g.}
\newcommand{\cf}{\em cf.}
\newcommand{\viz}{\em viz.}

\newcommand{\eqdef}{\stackrel{\rm def}{=}}       % ``equals by definition''
\newcommand{\hint}{{\em Hint}:\ }              % for in-line hints
\newcommand{\note}{{\em Note}:\ }              % for in-line notes
\newcommand{\remark}{{\em Remark}\/:\ }              % for in-line remarks  



%
% 6.045/theocomp specific symbols
%

\newcommand{\bigO}O
\newcommand{\emptystring}{\epsilon}              % empty string
\def\P{{\cal P}}
\def\NP{{\cal NP}}
\def\PP{{\cal BPP}}
\def\IP{{\cal IP}}
\def\RP{{\cal RP}}
\newcommand{\bit}{\set{0,1}}
\newcommand{\strings}{\bit^*}

%
% problems and subproblems
%


\newcounter{problem}
%\newcounter{subproblem}[problem]
\newcounter{subproblem}
\renewcommand{\theproblem}{\arabic{problem}}
\renewcommand{\thesubproblem}{\arabic{subproblem}}
\newenvironment{problem} {\stepcounter{problem} \textbf{Problem
    \theproblem}:\paragraph{}}
 {\vspace{.1in}}
\newenvironment{subproblem} {\stepcounter{subproblem} 
    \thesubproblem :} {}
\newenvironment{solution} {\textbf{Solution
    \theproblem}:} {\vspace{.1in}}

% 
% machines
%
\newcommand{\rep}[1]{\left\langle #1 \right\rangle}

\newcommand{\R}{\mathbb{R}}
\newcommand{\Z}{\mathbb{Z}}
\newcommand{\Q}{\mathbb{Q}}
\newcommand{\C}{\mathbb{C}}
\newcommand{\N}{\mathbb{N}}
\newcommand{\J}{\mathbb{J}}
\newcommand{\riemann}{\mathscr{R}}
\newcommand{\E}[1]{\mathrm{E}\left[ #1 \right]}
\newcommand{\Var}{\mathrm{Var}\,}


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