
\usepackage{amsmath,textcomp}
%\usepackage{epsf,shortlst,graphicx,color,amsmath,amssymb}
\usepackage{epsf,graphicx,color,amsmath,amssymb}
\usepackage[dvips]{hyperref}%\url{http://www.google.com}

%\def\coursenumber{CS 294-2}
\def\coursenumber{C191}
\def\class{Quantum Computation}
%\def\semester{Spring 2007}
%\def\semester{Fall 2010}
\def\semester{Spring 2017}
\def\instructor{Vazirani}

%% The lecture number is set using e.g. \lecture{6} in the file header
%% \lecturenumber should be used in all sections, theorems, equations, etc.

\newcount\lecturenumber
\def\lecture#1{\global\lecturenumber=#1}


\def\endproofmark{$\Box$}
\newenvironment{proof}{\par{\bf Proof}:}{\endproofmark}


\newcount\axiomnumber
\axiomnumber=0
\newenvironment{axiom}[1]{\par\global\advance\axiomnumber by 1
{\bf Axiom \the\lecturenumber.\the\axiomnumber\ (#1)}:
\begingroup}%
{\endgroup}

\newcount\defnnumber
\defnnumber=0
\newenvironment{defn}[1]{\par\global\advance\defnnumber by 1
{\bf Definition \the\lecturenumber.\the\defnnumber\ (#1)}:
\begingroup}%
{\endgroup}



\newcount\theoremnumber
\theoremnumber=0
\newenvironment{theorem}{\par\global\advance\theoremnumber by 1
{\bf Theorem \the\lecturenumber.\the\theoremnumber}:
\begingroup\em}%
{\endgroup}

\newcount\lemmanumber
\lemmanumber=0
\newenvironment{lemma}{\par\global\advance\lemmanumber by 1
{\bf Lemma \the\lecturenumber.\the\lemmanumber}:
\begingroup\em}%
{\endgroup}

\newskip\saveskip
\newskip\saveindent
\saveskip=\baselineskip

%macros for use in assignments and exams
\def\q#1#2{{\bf\item (#1 pts.)\quad #2}}
\def\qns#1{{\bf\item #1}}
\def\tf{{\it True/false}: }
\def\mp{{\it Multiple choice}: }

\def\tab{\hbox{\kern10pt}}

\textheight=9in
\textwidth=6.5in
\topmargin=-.75in
\oddsidemargin=0.25in
\evensidemargin=0.25in
\parindent=0pt
\parskip=5pt
\itemsep=-1pt
\floatsep 9pt plus 2pt minus 3pt
\intextsep 9pt plus 2pt minus 3pt
\textfloatsep=9pt plus 2pt minus 3pt
\renewcommand{\baselinestretch}{1.0}
\font\dunhd=cmdunh10 scaled \magstep4
\font\dunhc=cmdunh10 scaled \magstep3
\font\dunhb=cmdunh10 scaled \magstep2
\font\dunha=cmdunh10 scaled \magstep1
\date{}

%%%
% Header setup: The \header command sets up all the variables for the new style header.
%  For example, \header{1}{8/26/03}{Qubits, Measurements}
%%
\newcommand{\header}[3]{\lecture{#1} \def\lecturenum{#1} \def\title{Lecture #1} \def\lecturedate{#2} \def\lecturetitle{#3}}

\def\maketitle{%
 \begingroup
 \newpage
 \global\@topnum\z@ \@maketitle
 \thispagestyle{myheadings}
 \endgroup
 \setcounter{footnote}{0}
 \let\maketitle\relax
 \let\@maketitle\relax}

% new header style (modified 9/4)
\def\@maketitle{\newpage
\hrule height6pt \vskip .7em
\makebox[1.1in][l]{\dunha \coursenumber}             %% for long titles, comment out this line..
{
\qquad                                               %% and this one..
\dunhb \lecturetitle \hfill \dunha \lecturedate}
\vskip-0.1in
%\makebox[1.1in][l]{\dunha \coursenumber}\quad       %% and uncomment this line
\makebox[1.5in][l]{\dunha \semester}
{\hfill \dunhb Lecture \lecturenum \par}
\vskip 0.6em
\hrule height6pt
 \par
 \vskip .5em}

% original header style
\def\@oldmaketitle{\newpage
\hrule height6pt \vskip .7em
\makebox[1.5in][l]{\dunha \coursenumber}
{\dunhb \class \hfill \ }
\vskip-0.1in
\makebox[1.5in][l]{\dunha \semester}
{\dunhb \instructor \hfill \dunhc \title \par}
\vskip 0.6em
\hrule height6pt
 \par
 \vskip .5em}

\def\section{\@startsection {section}{1}{\z@}{-3.0ex plus -.6ex minus
    -.2ex}{1.3ex plus .1ex}{\dunhb}}
\def\subsection{\@startsection{subsection}{2}{\z@}{-1.6ex plus -.5ex minus
   -.1ex}{0.9ex plus .1ex}{\dunha}}

%%%%%% page headings

\def\foottext{\begin{footnotesize}\coursenumber, \semester, \title \hfill\qquad\thepage\end{footnotesize}}

\def\ps@myheadings{\let\@mkboth\@gobbletwo
\def\@oddfoot{\foottext}%
\def\@evenfoot{\foottext}%
\def\@evenhead{}\def\@oddhead{}}

\pagestyle{myheadings}

%%%%%% Figures

\def\fig#1{\centerline{\epsffile{#1}}}
\def\twofig#1#2{%
\noindent\epsfxsize=0.48\textwidth
\noindent \epsffile{#1}\hfill
\epsfxsize=0.48\textwidth
\epsffile{#2}\\
\makebox[0.48\textwidth]{(a)}\hfill\makebox[0.48\textwidth]{(b)}%
}


%%%%%% cross references
\newcommand{\chapref}[1]{Chapter~\ref{#1}}
\newcommand{\secref}[1]{Section~\ref{#1}}
\newcommand{\figref}[1]{Figure~\ref{#1}}
\newcommand{\tabref}[1]{Table~\ref{#1}}
\newcommand{\exref}[1]{Exercise~\ref{#1}}
%\newcommand{\eqref}[1]{Equation~(\ref{#1})}
\newcommand{\partref}[1]{Part~\ref{#1}}
\newcommand{\appref}[1]{Appendix~\ref{#1}}
\newcommand{\sideref}[1]{the sidebar titled #1}
\newcommand{\pgref}[1]{page~\pageref{#1}}

%%%%%% additional symbols or names for them

%\newcommand{\implies}{\:\;{\Rightarrow}\:\;}
\newcommand{\impliessymbol}{\Rightarrow}
\newcommand{\entails}{\models}
\newcommand{\lequiv}{\;\;{\Leftrightarrow}\;\;}
\newcommand{\lequivsymbol}{\Leftrightarrow}
\newcommand{\xor}{\not\lequiv}
\newcommand{\All}[1]{\forall\,#1\;\;}
\newcommand{\Exi}[1]{\exists\,#1\;\;}
\newcommand{\Exii}[1]{\exists!\,#1\;\;}% -pnorvig
\newcommand{\Iot}[2]{\iota\,#1\,#2}
\newcommand{\Lam}[2]{\lambda #1\;#2}
\newcommand{\Qua}[3]{[#1\,#2\;#3]}

\def\<{\langle}
\def\>{\rangle}

\newcommand{\union}{{\,{\cup}\,}}
\newcommand{\elt}{{\,{\in}\,}}  %%%cuts down on spacing
\newcommand{\eq}{{\,{=}\,}}     %%%cuts down on spacing
\def\stimes{{\,\times\,}}       %%%cuts down on spacing

\def\ceil#1{\lceil #1 \rceil}
\def\floor#1{\lfloor #1 \rfloor}

%\def\cents{\mbox{c}}
%\AtBeginDocument{\def\cents{\hbox{\rm\rlap{\hspace{.07ex}$/$}c}}}
\newcommand{\cents}{\text{\textcent{}}}
\def\cons{{}\bullet{}}

%%%%%% bold font in math mode; this sucks but is simplest for now
\newcommand{\mbf}[1]{\mbox{{\bfseries #1}}}
\newcommand{\smbf}[1]{\mbox{{\scriptsize\bfseries #1}}}

\def\N{\mbf{N}}
\def\X{\mbf{X}}
\def\x{\mbf{x}}
\def\sx{\smbf{x}}
\def\Y{\mbf{Y}}
\def\y{\mbf{y}}
\def\sy{\smbf{y}}
\def\E{\mbf{E}}
\def\e{\mbf{e}}
\def\T{\mbf{T}}
\def\O{\mbf{O}}
\def\se{\smbf{e}}
\def\Z{\mbf{Z}}
\def\z{\mbf{z}}
\def\sz{\smbf{z}}
\def\F{\mbf{F}}
\def\f{\mbf{f}}
\def\A{\mbf{A}}
\def\P{\mbf{P}}
\def\B{\mbf{B}}
\def\b{\mbf{b}}
\def\m{\mbf{m}}
\def\I{\mbf{I}}
\def\ones{\mbf{1}}
\def\ev{\mbf{ev}}
\def\fv{\mbf{ev}}
\def\sv{\mbf{sv}}
\def\C{{\cal C}}

%%%math definitions

\newcommand{\ket}[1]{\textsf{\big{|}} #1 \textsf{\big{>}}\,}
\newcommand{\bra}[1]{\textsf{\big{<}} #1 \textsf{\big{|}}\,}
\newcommand{\braket}[2]{\textsf{\big{<}} #1 \textsf{\big{|\,}} #2\textsf{\big{>}}}
\newcommand{\ketbra}[2]{\textsf{\big{|}} #1 \textsf{\big{>}}\textsf{\big{<}} #2\textsf{\big{|}}}

\def\tbra #1{\langle #1\vert}
\def\tket #1{\vert #1\rangle}
\def\tbraket #1#2{\langle #1 \vert #2\rangle}
\def\tketbra #1#2{\vert #1\rangle \! \langle #2\vert}
\def\sub #1{\!_#1\!}

\newcommand{\condexpect}[3]{E_{#1}\!\left[\,#2\ \vrule\ #3\,\right]}
\renewcommand{\d}{\textrm{ d}}
%\newcommand{\elt}{\in}
\newcommand{\inter}{\cup}
\renewcommand{\mod}[1]{\hbox{ mod $#1$}}
\newcommand{\grad}[2]{{\nabla{#1}}_{#2}}
\newcommand{\trace}[1]{\rm{Tr({#1})}}
\renewcommand{\det}[1]{\rm{Det({#1})}}
\newcommand{\elec}{\textit{$ e^-~ $}}
\newcommand{\prob}[1]{\Pr\left\{#1\right\}}
\newcommand{\condprob}[2]{\Pr\left\{#1 \; \vrule \; #2\right\}}
\newcommand{\deriv}[2]{\frac{\d #1}{\d #2}}
\newcommand{\derivp}[2]{\left( \frac{\d #1}{\d #2} \right)}
\newcommand{\pderiv}[2]{\frac{\partial #1}{\partial #2}}
\newcommand{\pderivp}[2]{\left( \frac{\partial #1}{\partial #2} \right)}
\newcommand{\st}{\hbox{ s.t. }}

\newcommand{\abs}[1]{\lvert#1\rvert}
\newcommand{\norm}[1]{\lVert#1\rVert}
\newcommand{\set}[1]{\left\{#1\right\}}
\def\tensor{\otimes}

\newcommand{\bea}{\begin{eqnarray*}}
\newcommand{\eea}{\end{eqnarray*}}
\newcommand{\beq}{\begin{equation*}}
\newcommand{\eeq}{\end{equation*}}


%%%%%% for notes (either in margin or not to appear at all)
%\newcommand{\comment}[1]{\marginpar{\scriptsize #1}}
\newcommand{\comment}[1]{}
\newcommand{\secondedition}[1]{}

\reversemarginpar %% puts into left margin

%%%%%% special keywords are marked in the margin
%% Can be turned off if desired



\newlength{\marginlineskip}
\newlength{\marginwidth}
\setlength{\marginlineskip}{3.5pt}
\setlength{\marginwidth}{\marginparwidth}
\addtolength{\marginwidth}{\marginparsep}

\newlength{\savelineskip}
\newcommand{\term}[1]{{\bfseries #1}}% maybe put into index,glossary too?
\newcommand{\newterm}[1]{%
{\bfseries #1}%
\marginalnote{#1}}% maybe put into index,glossary too?

\newcommand{\marginalnote}[1]{\yesmarginalnote{#1}}

\newcommand{\yesmarginalnote}[1]{%
\setlength{\savelineskip}{\baselineskip}%
\marginpar{%
\raisebox{0pt}[0pt][0pt]{\parbox[c]{\marginparwidth}{\begin{flushleft} {\nt \uppercase{#1}}%
\setlength{\baselineskip}{\marginlineskip}%
\end{flushleft}}}}% % end marginpar
\setlength{\baselineskip}{\savelineskip}%
}

\newcommand{\nomarginalnote}[1]{}  %%% [[check this - seems wrong]]

\font\nt=phvrrn scaled 625 %% margin notes

\usepackage{times,latexsym,mathptmx,comment}

\def\mdw@dots#1{\ensuremath{\mathpalette\mdw@dots@i{#1}}}
\def\mdw@dots@i#1#2{%
  \setbox\z@\hbox{$#1\mskip1.8mu$}%
  \dimen@\wd\z@%
  \setbox\z@\hbox{$#1.$}%
  #2%
}
\def\Ddots{%
  \mdw@dots{\mathinner{%
    \mkern1mu%
    \raise\dimen@\vbox{\kern7\dimen@\copy\z@}%
    \mkern2mu%
    \raise4\dimen@\copy\z@%
    \mkern2mu%
    \raise7\dimen@\box\z@%
    \mkern1mu%
  }}%
}

