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

%\usepackage{mypdftex}
\usepackage{proof}
%\usepackage{array}
%
%
%%
%% Various shorthands
%%
%\def\i{\item}
%\def\ib{\item[$\bullet$]}
%\def\ie{\item[\theenumi.]}
%\def\io{\item[]\hskip -\labelsep
%               \hskip -\labelwidth
%}
%
%\def\iv#1{\null\vspace{#1}\item}  %Move an item vertically
%
%\def\bi{\begin{itemize}}
%\def\ei{\end{itemize}}
%\def\be{\begin{enumerate}}
%\def\ee{\end{enumerate}}
%
%
%\def\starttracing{\tracingmacros=2\tracingcommands=2}
%\def\stoptracing{\tracingmacros=0\tracingcommands=0}
%
%\def\lecturenumber{}
%\def\slidefooter{\slideoverline{2pt}{\textwidth}{4pt}%
%                 {\tiny
%                  \rlap{UC Berkeley, CS263} \hfil
%                  Lecture \lecturenumber \hfil
%                  \llap{\theslide}}}
%\def\slideheader{}
%
%\def\slidetitle{%
%   \ifx\slidetitletext\undefined\else
%     \ifslide@title
%       \slideunderline{4pt}{\textwidth}{6pt}{%
%                  \parbox{\textwidth}%
%                         {\begin{center}\Large\baselineskip=34\p@
%                                \slidetitletext
%                          \end{center}}}%
%    \vskip 20pt plus 10pt minus 10pt\relax
%   \fi\fi}
% 
%\ifx\ifslide@header\undefined\else
%  \setkeys{Slide}{footer=true,header=false,title=true,label=$\bullet$}
%\fi
%
%
\newcounter{exercise}
\setcounter{exercise}{0}

\def\exercise{\addtocounter{exercise}{1}%
              \paragraph{Exercise \theexercise:}}


\def\answer{\addtocounter{exercise}{1}%
            \@ifnextchar[{\@answer}{\@answer[\theexercise]}}
\def\@answer[#1]{%
       \setcounter{exercise}{#1}%
       \paragraph{Solution of exercise \theexercise:}}

%
%\newenvironment{proof}[1][]{%
%\vskip \abovedisplayskip\setlength\parindent{-5mm}%
%{\sc Proof#1: }\setlength\parindent{0mm}\setlength\parskip{2mm}\leftskip 5mm}
%{\ifhmode\newline\else\leavevmode\fi\hbox{}\hfill$\square$\hspace{1cm}%
%\vskip \belowdisplayskip}
%
\newtheorem{lemma}{Lemma}
\newtheorem{theorem}{Theorem}
%\newtheorem{corollary}{Corollary}
%
%%
%% Macros
%%
%
%
%
% Notation for sets of the form {...|...} :
% Eg: \set{x \in N | x>0}  becomes:
% \left\{\left.\,  x \in N \:\right\origbar\: x>0 \,\right\}
% set brackets and | grow to fit the size if their contents.
% Also works for \set{x,y,z}
%
\def\@set#1{\@@set#1\@endset\@gobblebar|\@gobblebar\@endset}
\def\@gobblebar|\@gobblebar\@endset{\relax}
\def\@endset\@gobblebar{\relax}
\def\@@gobblebar{\@gobblebar}

\def\@@set#1|#2\@endset{%
  \def\tmp@set{#2}%
  \ifx\tmp@set\@@gobblebar % We have a set of the form {x,...,y}
    \@grpstart\,#1\,\@grpend%
  \else                  % We have a set of the form {x | P(x)}
    \@grpstart\, #1 \:\left| \: #2 \,\@grpend\right.%
  \fi}

\def\set{\@grpbrace}
\def\grp{\futurelet\@next\@grp}
\def\@grp{%
  \immediate\write16{The meaning of next is \meaning\@next.}%
  \ifx\@next[%
      \def\@next{\@grpbracket}%
  \else\ifx\@next<%
      \def\@next{\@grpangle}%
  \else
      \def\@next{\@grpbrace}%
  \fi\fi
  \@next}
\def\@grpbrace#1{\def\@grpstart{\left\{}%
                 \def\@grpend{\right\}}%
                 \@set{#1}}
\def\@grpbracket[#1]{\def\@grpstart{\left[}%
                     \def\@grpend{\right]}%
                     \@set{#1}}
\def\@grpangle<#1>{\def\@grpstart{\left\langle}%
                   \def\@grpend{\right\rangle}%
                   \@set{#1}}

\def\grpdelim#1#2#3{\def\@grpstart{\left#1}%
                    \def\@grpend{\right#2}%
                    \@set{#3}}

%
%% Two dots. Appropriate for ranges
%\def\rdots{\mathinner{\ldotp\ldotp}}
%
%%
%% Notation for substitutions e/x. Raises e and lowers x
%%
%\def\sfrac#1#2{{}^{\displaystyle #1}\!\!\diagup\!_{\displaystyle #2}}
%
%
%\def\inferLineSkip{6pt}         %For proof.sty
%
%%
%% Labelling hypotheses
%\def\labhyp#1#2{\deduce{#1}{#2}}
%
%
%\def\cD{{\cal D}}
%\def\cE{{\cal E}}
%\def\cF{{\cal F}}
%\def\cG{{\cal G}}
%\def\cH{{\cal H}}
%\def\Dom{{\mathit Dom}}
%
\newcommand{\bb}[1]{{\mathbb #1}}
\def\col{\mathrel{:}}
\def\arr{\rightarrow}
\def\Arr{\Rightarrow}
\def\parr{\rightharpoonup}
\def\darr{\Downarrow}

%
\let\t=\texttt
\def\aand{\mathrel{\wedge}}
\def\oor{\mathrel{\vee}}
\def\implies{\mathrel{\Rightarrow}}
%\def\iff{\mathrel{\Leftrightarrow}}
\def\bnfas{\mathrel{::=}}
\def\bnfalt{\mathrel{|}}
%\newcommand{\comp}{\mathrel\circ}
\newcommand{\sem}[1]{[\![\,#1\,]\!]}
\newcommand{\lub}{\bigsqcup}
%\newcommand{\glb}{\sqcap}
%
\def\powerset{{\cal{P}}}
%\def\FV{{\mathit FV}}
%
\newcommand{\po}{\sqsubseteq}
%
%\newcommand{\asem}[1]{{\cal A}\sem{#1}}
%\newcommand{\bsem}[1]{{\cal B}\sem{#1}}
%\newcommand{\csem}[1]{{\cal C}\sem{#1}}
%
%\newcommand\nat{{\rm\bf nat}}
%\newcommand\bool{{\rm\bf bool}}
%\newcommand\true{{\tt true}}
%\newcommand\false{{\tt false}}
%\newcommand\loc{{\rm\bf L}}
%\newcommand\aexp{{\rm\bf Aexp}}
%\newcommand\bexp{{\rm\bf Bexp}}
%\newcommand\com{{\rm\bf Com}}
%\newcommand\ass{\mathrel{:=}}
%\newcommand\ifthenelse[3]{{\tt if}\;#1\;{\tt then}\;#2\;{\tt else}\;#3}
%\newcommand\whiledo[2]{{\tt while}\;#1\;{\tt do}\;#2}
%\newcommand\repeatuntil[2]{{\tt repeat}\;#1\;{\tt until}\;#2}
%
%\newcommand\letin[2]{\t{let}\;#1\;\t{in}\;#2}
%
%
%\def\<#1>{\left\langle #1\right\rangle}
%
%\def\smod{\sigma \models}
%\newcommand\hoare[3]{\set{#1} #2 \set{#3}}
%
%\renewcommand\wp{{\mathit wp}}
%
%\def\mc{\multicolumn}
%\def\stype{\mathrel{<:}}
%
%\def\sbar#1{\left|#1\right|}
%\def\dbar{\grpdelim{\|}{\|}}
%
%\def\absop#1{\mathop{\overline{#1}}}
