%%%%%
%%%%%  THIS FILE MUST BE CALLED basics.sty
%%%%%


% basics.sty
% Jerry Seligman's basic LaTeX preamble


% Numbered italic paragraphs

\newtheorem{thm}{Theorem}[section]
\newtheorem{prop}[thm]{Proposition}
\newtheorem{lem}[thm]{Lemma}
\newtheorem{cor}[thm]{Corollary}
\newtheorem{claim}[thm]{Claim}

% Numbered roman paragraphs

\newtheorem{defn2}[thm]{Definition}
\newtheorem{con2}[thm]{Construction}

\newenvironment{defn}{\begin{defn2}\rm}{\end{defn2}}
\newenvironment{con}{\begin{con2}\rm}{\end{con2}}

% Numbered exercises

\newtheorem{exer2}{Exercise}[section]
\newenvironment{exer}{\begin{exer2}\small\rm}{\end{exer2}\rm\normalsize} 

% Numbered  axioms and examples

%\newcounter{axno}
%\newcommand{\ax}[1]{\begin{trivlist}\setlength{\leftmargin}{\leftmargini}
%                        \refstepcounter{axno}\item[](\theaxno) \it #1
%                   \end{trivlist}}


\newcounter{exampleno}
\newenvironment{example}{\begin{trivlist}\setlength{\leftmargin}{\leftmargini}\refstepcounter{exampleno}\item[](\theexampleno) \it}
{\end{trivlist}}



% Non-numbered paragraphs

\newenvironment{proof}{\begin{trivlist}\item[]{\sc Proof:}\rm}{\hfill {\sc qed}\end{trivlist}} 

\newenvironment{proofof}[1]{\begin{trivlist}\item[]{\sc Proof of #1:}\rm}{\hfill {\sc qed}\end{trivlist}} 

\newenvironment{notation}{\begin{trivlist}\item[]{\bf Notation.}}{\end{trivlist}} 


% Claims and proofs of claims inside a proof
   
   % Use claim only inside a proof and start always with subclaim1. 
   % Then the claims are numbered inside the proof. 

\newtheorem{subclaim2}{Claim}

\newenvironment{subclaim}{\begin{subclaim2}\rm}{\end{subclaim2}\rm} 
\newenvironment{subclaim1}{\setcounter{subclaim2}{0}\begin{subclaim2}\rm}{\end{subclaim2}\rm}


\newenvironment{pfsubclaim}{\begin{trivlist}\item[]{\sc Proof of Claim:}}{\end{trivlist}} 


% EPS figures 

\newcommand{\postscript}[2]
        {\setlength{\epsfxsize}{#2\hsize}
                \centerline{\epsfbox{#1}}}


\newcommand{\myfig}[2]{
\begin{figure}
\postscript{#1.eps}{0}
\caption{#2\label{#1}}
\end{figure}}

   % and the \labelp version (see Labelling, below)

\newcommand{\myfigp}[2]{
\begin{figure}
\postscript{#1.eps}{0}
\caption{#2\labelp{#1}}
\end{figure}}


   % special command for my Mac setup
   % Mac EPS file is filename.meps (includes screen image)
   % plain EPS file is filename.eps 

\newcommand{\mymacfig}[2]{
\begin{figure}
\postscript{#1.meps}{0}
\caption{#2\label{#1}}
\end{figure}}

   % and the \labelp version (see Labelling, below)

\newcommand{\mymacfigp}[2]{
\begin{figure}
\postscript{#1.meps}{0}
\caption{#2\labelp{#1}}
\end{figure}}



% Labelling

   % use \labelp instead of \label and it is printed in the margin 
   % (good for editing)

\newif\ifShowLabels
\ShowLabelstrue
\newdimen\theight
\def\TeXref#1{%
\leavevmode\vadjust{\setbox0=\hbox{{\tt
\quad\quad #1}}%
\theight=\ht0
\advance\theight by \dp0
\advance\theight by \lineskip
\kern -\theight \vbox to
\theight{\rightline{\rlap{\box0}}%
\vss}%
}}%

\newcommand{\labelp}[1]{\label{#1}%
\ifShowLabels \TeXref{{#1}} \fi}


% Spacing

   % a little space
\newcommand{\gap}{\hspace*{1em}}

   % to give a break (centered * * * )
\newcommand{\breakie}{\begin{center} \mbox{{}} \\\mbox{ * * *} \\ \mbox{{}} \\ \end{center} }

% Quotes

\newcommand{\cq}[1]{\raisebox{.3ex}{$\ulcorner\!\!$} #1 \raisebox{.3ex}{$\!\!\urcorner$}}
\newcommand{\cqbox}[1]{\raisebox{.3ex}{$\ulcorner\!\!\!\!$} #1 \raisebox{.3ex}{$\!\!\!\!\urcorner$}}

% Math and logic symbols

\newcommand{\tuple}[1]{\langle #1 \rangle}
\newcommand{\set}[2]{\{ #1 \: | \: #2 \}}
\newcommand{\valof}[1]{{[}\!{[} #1 {]}\!{]}}
\newcommand{\entails}{\vdash}
\newcommand{\diff}{\makebox[4em]{\rm iff}}
\newcommand{\dif}{\makebox[2em]{\rm if}}
\newcommand{\dthen}{\makebox[3em]{\rm then}}

\newcommand{\forces}{\mbox{${\scriptstyle \mid\! \mid}\! -$}} 
\newcommand{\notforces}{\mbox{${\scriptstyle \mid \! /\!\!\!\!\!\!\mid}\! -$}} 
\newcommand{\ul}[1]{\underline{#1}}
\newcommand{\ol}[1]{\overline{#1}}

% old definitions
% \newcommand{\tuple}[1]{\mbox{$\langle #1 \rangle$}}
% \newcommand{\SStuple}[1]{\mbox{$\scriptstyle\langle #1 \rangle$}}
% \newcommand{\set}[2]{\mbox{$\{ #1 \: | \: #2 \}$}}
% \newcommand{\SSset}[2]{\mbox{$\scriptstyle\{ #1 \: | \: #2 \}$}}
% \newcommand{\lsem}{{[}\!{[}}
% \newcommand{\rsem}{{]}\!{]}}

% Math operators

\newcommand\operatorname[1]{\mathop {\rm #1}\nolimits} 

\newcommand\dom{\operatorname{dom}}
\newcommand\rng{\operatorname{rng}}
\newcommand\Pow{\operatorname{\cal P}} 
\newcommand\pow{\operatorname{pow}}


% Greek letter abbreviations

\newcommand{\al}{\alpha}
\newcommand{\be}{\beta}
\newcommand{\ga}{\gamma}
\newcommand{\de}{\delta}
\newcommand{\si}{\sigma}
\newcommand{\Ga}{\Gamma}
\newcommand{\De}{\Delta}
\newcommand{\Si}{\Sigma}

% Definition by cases

\newcommand{\defbycases}[1]{\mbox{$
\left\{ \begin{array}{ll}
          #1
    \end{array} \right.$}}
    %The argument should consist of xxx & if yyy \\ etc.

