% This material was hacked from amsthm.sty.
% This must be loaded after any other packages (such as amsthm) which
% define "proof" environments.

% OBSOLETE:
% This package has been obsoleted by jbw-env-end-mark together with
% any package which provides a proof environment.  Better to load 
% jbw-thm, which loads amsthm, jbw-env-end-mark, and then invokes
% \FixAMSProof.  Only use it if you can't load a package with a proof
% environment such as amsthm or jbw-thm, e.g., due to conflicts with
% llncs class.

\RequirePackage{amsgen}

\let\proof=\relax
\let\endproof=\relax
\let\proofname=\relax
\let\openbox=\relax
\let\qedsymbol=\relax

% jbw: Definition of \qed taken from amsthm.sty.  My modifications were
% (1) to wrap the \DeclareRobustCommand invocation in a command, so it can
% be performed repeatedly, and (2) to change the definition of \qed so
% that it undefines itself when used.
\newcommand{\qedinit}{%
  \DeclareRobustCommand{\qed}{%
    \ifmmode % if math mode, assume display: omit penalty etc.
    \else \leavevmode\unskip\penalty9999 \hbox{}\nobreak\hfill
    \fi
    \quad\hbox{\qedsymbol}%
    \gdef\qed{}}}
% jbw: Definition of "proof" environment taken from amsthm.sty.  My
% sole modification was to make it invoke \qedinit.
\newenvironment{proof}[1][\proofname]{\par
  \normalfont
  \qedinit
  \topsep6\p@\@plus6\p@ \trivlist
  \item[\hskip\labelsep\itshape
    #1\@addpunct{.}]\ignorespaces
}{%
  \qed\endtrivlist
}

% jbw: The following definitions of \openbox, \qedsymbol, and
% \proofname are exactly as in amsthm.sty.
\newcommand{\openbox}{\leavevmode
  \hbox to.77778em{%
  \hfil\vrule
  \vbox to.675em{\hrule width.6em\vfil\hrule}%
  \vrule\hfil}}
\newcommand{\qedsymbol}{\openbox}
\newcommand{\proofname}{Proof}
