%%% ====================================================================
%%% @LaTeX-file{
%%%   filename  = "amsthdoc.tex",
%%%   version   = "2.20",
%%%   date      = "2004/08/03",
%%%   time      = "15:02:46 EDT",
%%%   checksum  = "15807 374 1763 14655",
%%%   author    = "American Mathematical Society",
%%%   copyright = "Copyright 1999, 2004 American Mathematical Society,
%%%                all rights reserved.  Copying of this file is
%%%                authorized only if either:
%%%                (1) you make absolutely no changes to your copy,
%%%                including name; OR
%%%                (2) if you do make changes, you first rename it
%%%                to some other name.",
%%%   address   = "American Mathematical Society,
%%%                Technical Support,
%%%                Publications Technical Group,
%%%                201 Charles Street,
%%%                Providence, RI 02904,
%%%                USA",
%%%   telephone = "401-455-4080 or (in the USA and Canada)
%%%                800-321-4AMS (321-4267)",
%%%   FAX       = "401-331-3842",
%%%   email     = "tech-support@ams.org (Internet)",
%%%   codetable = "ISO/ASCII",
%%%   supported = "yes",
%%%   keywords  = "latex, theorem, proof, amsthm",
%%%   abstract  = "This file is the User's Guide for the amsthm
%%%                package.",
%%%   docstring = "The checksum field above contains a CRC-16
%%%                checksum as the first value, followed by the
%%%                equivalent of the standard UNIX wc (word
%%%                count) utility output of lines, words, and
%%%                characters.  This is produced by Robert
%%%                Solovay's checksum utility.",
%%% }
%%% ====================================================================
\documentclass[twoside]{article}
\pagestyle{myheadings}

% Use the same version numbers as for the amslatex instructions.
\def\instrversion{2.20}
\def\instrdate{August 2004}

\title{Using the \pkg{amsthm} Package}
\author{Version \instrversion, \instrdate\\American Mathematical Society}
\date{}

\providecommand{\qq}[1]{\textquotedblleft#1\textquotedblright}
\providecommand{\mdash}{\textemdash\penalty\hyphenpenalty}

% Embedded \index commands are a legacy from the time when this
% documentation was part of amsldoc. Since they don't hurt anything,
% let's leave them in. Maybe they will become useful again in the
% future. [mjd,2000/06/06]

\chardef\bslchar=`\\ % p. 424, TeXbook
\newcommand{\ntt}{%
  \fontfamily\ttdefault \fontseries\mddefault \fontshape\updefault
  \selectfont
}
\DeclareRobustCommand{\cn}[1]{{\ntt\bslchar#1}}
\DeclareRobustCommand{\cls}[1]{{\ntt#1}}
\DeclareRobustCommand{\pkg}[1]{{\ntt#1}}
\DeclareRobustCommand{\opt}[1]{{\ntt#1}}
\DeclareRobustCommand{\env}[1]{{\ntt#1}}
\DeclareRobustCommand{\fn}[1]{{\ntt#1}}

\providecommand{\qedsymbol}{\leavevmode
  \hbox to.77778em{%
  \hfil\vrule
  \vbox to.675em{\hrule width.6em\vfil\hrule}%
  \vrule\hfil}}

%%  Provide a meta-command facility; provide an alternate escape
%%  character so it can be used within the verbatim environment.

\catcode`\|=0
\begingroup \catcode`\>=13 % in LaTeX2e verbatim env makes > active
\gdef\?#1>{{\normalfont$\langle$\textup{#1}$\rangle$}}
\gdef\0{\relax}
\endgroup
\def\<#1>{{\normalfont$\langle$\textup{#1}$\rangle$}}
\def\ntnote#1{{\normalfont$^{#1}$}}

\hfuzz4pt \vbadness9999 \hbadness5000
\def\latex/{{\protect\LaTeX}}

\setlength{\textwidth}{210mm}\addtolength{\textwidth}{-2in}
\setlength{\oddsidemargin}{39pt}
\setlength{\evensidemargin}{39pt}
\addtolength{\textwidth}{-2\oddsidemargin}

\begin{document}
\maketitle
\markboth{USING THE \pkg{amsthm} PACKAGE}{USING THE \pkg{amsthm} PACKAGE}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\section{Introduction}

\begin{sloppypar}
The \pkg{amsthm} package provides an enhanced version of \latex/'s
\cn{newtheorem} command for defining theorem-like environments. The
enhanced \cn{newtheorem} recognizes a
\cn{theoremstyle} specification (as in Mittelbach's \pkg{theorem}
package) and has a \verb'*' form for defining unnumbered environments. The
\pkg{amsthm} package also defines a \env{proof} environment that
automatically adds a QED symbol at the end. AMS document classes
incorporate the \pkg{amsthm} package, so everything described here
applies to them as well.
\end{sloppypar}

If the \pkg{amsthm} package is used with a non-AMS document class and
with the \pkg{amsmath} package, \pkg{amsthm} must be loaded
\emph{after} \pkg{amsmath}, not before.

Examples are given in the file \fn{thmtest.tex}.  For best understanding,
examine the output side-by-side with the input.


\section{The \cn{newtheorem} command}

In mathematical research articles and books, theorems\index{theorems}
and proofs\index{proofs} are among the most common elements, but authors
also use many others that fall in the same general class: lemmas,
propositions, axioms, corollaries, conjectures, definitions, remarks,
cases, steps, and so forth. It is natural to handle these elements as
\latex/ environments, but document classes do not
provide predefined environments for theorem-like elements because
(a)~that would make it difficult for authors to exercise the necessary
control over the automatic numbering, and (b)~the variety of such
elements is so wide that it's not possible for a document class to
provide every one that will ever be needed. Instead there is a command
\cn{newtheorem}, similar in effect to \cn{newenvironment}, that makes it
easy for authors to set up the elements required for a particular
document.

The \cn{newtheorem} command has two mandatory arguments; the first one
is the environment name that the author would like to use for this
element; the second one is the heading text. For example,
\begin{verbatim}
\newtheorem{lem}{Lemma}
\end{verbatim}
means that instances in the document of
\begin{verbatim}
\begin{lem} Text text ... \end{lem}
\end{verbatim}
will produce
\[\makebox[.8\columnwidth]{%
  \textbf{Lemma 1.} \textit{Text text \dots}\hfill}\]
where the heading consists of the specified text \qq{Lemma} and an
automatically generated number and punctuation.

If \cn{newtheorem*} is used instead of \cn{newtheorem} in this
example, numbers will not be generated automatically for
any of the lemmas in the document. This form of the command can be
useful if you have only one lemma and don't want it to be
numbered; more often, though, it is used to produce a special named
variant of one of the common theorem types. For example, if you have a
lemma that should be labeled \qq{Klein's Lemma}, then the statement
\begin{verbatim}
\newtheorem*{KL}{Klein's Lemma}
\end{verbatim}
would allow you to write
\begin{verbatim}
\begin{KL} Text text ... \end{KL}
\end{verbatim}
and get the desired output.

Sometimes additional information is desired in the heading of a
theorem or lemma, often because it is cited from another source.
An optional argument is used to provide this information:
\begin{verbatim}
\begin{lem}[Alinhac-Lerner \cite{a-l}]
\end{verbatim}
yielding the output
\[\makebox[.8\columnwidth]{%
  \textbf{Lemma 2.} (Alinhac-Lerner [1]). \textit{Text text \dots}\hfill}\]


\section{Numbering modifications}

In addition to the two mandatory arguments, \cn{newtheorem} has two
mutually exclusive optional arguments. These affect the
sequencing\index{theorems!numbering} and hierarchy of the numbering.

By default each kind of theorem-like environment is numbered
independently. Thus if you have three lemmas and two theorems
interspersed, they will be numbered something like this: Lemma 1, Lemma
2, Theorem 1, Lemma 3, Theorem 2. If you want lemmas and theorems to
share the same numbering sequence\mdash Lemma 1, Lemma 2, Theorem 3, Lemma
4, Theorem 5\mdash then you should indicate the desired relationship as
follows:
\begin{verbatim}
\newtheorem{thm}{Theorem}
\newtheorem{lem}[thm]{Lemma}
\end{verbatim}
The optional argument \verb'[thm]' in the second statement means that
the \texttt{lem} environment should share the \texttt{thm} numbering
sequence instead of having its own independent sequence.

To have a theorem environment numbered subordinately within a
sectional unit\mdash e.g., to get propositions numbered Proposition 2.1,
Proposition 2.2, and so on in Section~2\mdash put the name of the parent
unit in square brackets in final position:
\begin{verbatim}
\newtheorem{prop}{Proposition}[section]
\end{verbatim}
With the optional argument \verb'[section]', the \verb'prop' counter
will be reset to 0 whenever the parent counter \verb'section' is
incremented, and the proposition label will have the section number
prepended.

Note that theorem numbering is not accomplished by the same method
as the \cn{numberwithin} facility of \pkg{amsmath}, so an attempt to
use that to relate theorem numbers to equation numbers will not work
in the expected way.  A method for accomplishing that, as well as
some other variations, is given in the AMS Author FAQ \cite{AF},
in the section on \qq{Theorems in AMS-\LaTeX}.


\section{Changing styles for theorem-like environments}

\subsection{The \cn{theoremstyle} command}

The \pkg{amsthm} package supports the notion of a current theorem style,
which determines what will be produced by a given \cn{newtheorem}
command. The three theorem styles provided\mdash
\verb'plain',\index{plain theo@\texttt{plain} theorem style}\relax
\index{definition theo@\texttt{definition} theorem style}\relax
\index{remark theo@\texttt{remark} theorem style} \verb'definition',
and \verb'remark'\mdash specify different degrees of
visual emphasis corresponding to their relative importance. The
details of this typographical treatment may vary depending on the
document class, but typically the \verb'plain' style produces italic
body text, while the other two styles produce roman body text.

If no \cn{theoremstyle} command is given, the style used will be
\texttt{plain}. To specify different styles,
divide your \cn{new\-theorem} commands into groups and preface each
group with the appropriate \cn{theo\-rem\-style}. Some examples:
\begin{verbatim}
\theoremstyle{plain}% default
\newtheorem{thm}{Theorem}[section]
\newtheorem{lem}[thm]{Lemma}
\newtheorem{prop}[thm]{Proposition}
\newtheorem*{cor}{Corollary}
\newtheorem*{KL}{Klein's Lemma}

\theoremstyle{definition}
\newtheorem{defn}{Definition}[section]
\newtheorem{conj}{Conjecture}[section]
\newtheorem{exmp}{Example}[section]

\theoremstyle{remark}
\newtheorem*{rem}{Remark}
\newtheorem*{note}{Note}
\newtheorem{case}{Case}
\end{verbatim}

The following list summarizes the types of structures which are
normally associated with each theorem style.

\smallskip
\begin{tabular}{ll}
 \relax\env{plain} & Theorem, Lemma, Corollary, Proposition, Conjecture, \\
                   & Criterion, Algorithm \\
 \relax\env{definition} \quad & Definition, Condition, Problem, Example \\
 \relax\env{remark} & Remark, Note, Notation, Claim, Summary, \\
                    & Acknowledgment, Case, Conclusion
\end{tabular}

\subsection{Number swapping}

A common style variation is to have the theorem number at the beginning
of the heading instead of at the end, for example \qq{1.4 Theorem}
instead of \qq{Theorem 1.4}.  As this variation is usually applied
to all \cn{theoremstyle}s, it is done by
placing a \cn{swapnumbers} command at the beginning of the list of
\cn{newtheorem} statements that should be affected. For example:
\begin{verbatim}
\swapnumbers
\theoremstyle{plain}
\newtheorem{thm}{Theorem}
\theoremstyle{remark}
\newtheorem{rem}{Remark}
\end{verbatim}

In AMS document classes, when numbers are swapped, the style of the
numbers matches that of section headings; this may not be the same
style as the rest of the theorem heading.

\subsection{New theorem styles}

The \pkg{amsthm} package provides a \cn{newtheoremstyle} command
to aid in the creation of custom styles, should the three predefined
styles prove insufficient.  The following example illustrates the use
of the \cn{newtheoremstyle} command.
\begin{verbatim}
\newtheoremstyle{note}%  |?name>
  {3pt}%      |?Space above>
  {3pt}%      |?Space below>
  {}%         |?Body font>
  {}%         |?Indent amount>|ntnote1
  {\itshape}% |?Theorem head font>
  {:}%        |?Punctuation after theorem head>
  {.5em}%     |?Space after theorem head>|ntnote2
  {}%         |?Theorem head spec (can be left empty, meaning `normal')>
\end{verbatim}
\noindent
\ntnote1 Indent amount: empty = no indent, \cn{parindent} = normal
 paragraph indent

\noindent
\ntnote2 Space after theorem head: \verb+{ }+ = normal interword space;
 \cn{newline} = linebreak

\smallskip
Apply the new theorem style in the same manner as the predefined ones.
For examples, see the file \fn{thmtest.tex}.


\section{Proofs}

A predefined \env{proof} environment provided by the \pkg{amsthm}
package produces the heading \qq{Proof} with appropriate spacing and
punctuation. The proof environment is primarily intended for short
proofs, no more than a page or two in length; longer proofs are
usually better done as a separate \cn{section} or \cn{subsection} in
your document.

An optional argument of the proof environment allows you to substitute
a different name for the standard \qq{Proof\/}. If you want
the proof heading to be, say, \qq{Proof of the Main Theorem}, then write
\begin{verbatim}
\begin{proof}[Proof of the Main Theorem]
\end{verbatim}

A QED symbol, \qedsymbol, is automatically appended at the end of
a \env{proof} environment. To substitute a different end-of-proof
symbol, use \cn{renewcommand} to redefine the command \cn{qedsymbol}.
For a long proof done as a subsection or section instead of with the
\env{proof} environment, you can obtain the symbol and the usual
amount of preceding space by using \cn{qed}.

Placement of the QED symbol can be problematic if the last part of
a \env{proof} environment is a displayed equation or list environment
or something of that nature. In that case put a \cn{qedhere} command at
the place where the QED symbol should appear, for example,
\begin{verbatim}
\begin{proof}
...
\begin{equation}
G(t)=L\gamma!\,t^{-\gamma}+t^{-\delta}\eta(t) \qedhere
\end{equation}
\end{proof}
\end{verbatim}
When used with the \pkg{amsmath} package, version 2 or later, \cn{qedhere}
will position the QED symbol flush right; with earlier versions, the
symbol will be spaced a quad away from the end of the text or display.

If \cn{qedhere} produces an error message in an equation, try using
\verb'\mbox{\qedhere}' instead.

\begin{thebibliography}{[AF]}

\bibitem[AF]{AF} AMS Author FAQ,
\texttt{http://www.ams.org/authors/author-faq.html}

\end{thebibliography}

\end{document}
