A theorem and its proof in different places

I have a couple of theorems, proofs of which are quite boring and longish. I would like to place theorem formulations in a usual place and stack up the proofs at the end of the chapter. How to do this?

In particular I would like to:

• keep the original theorem numbering - the same number should be visible in both places, where the theorem is formulated originally, and at the end of the chapter,
• if possible, copy the original formulation of the theorem right before the proof is given without having to write the text twice
• Do you care if there is a new proof environment generated that you use at a different location to where you define the theorem? Or is the intent that you specify the theorem & proof in one location of the chapter, and the proof printing is automatically postponed until the end of the chapter? – Werner Feb 21 '12 at 21:20
• @Werner I don't really care about how the proof & theorem are generated. I actually think having them in one place would be easier to manage. I think you might have a point here. – julkiewicz Feb 21 '12 at 23:34

Here's a MWE that demonstrates how the answers package can be used in this context. It preserves all of the numbering, as requested in your first bullet. Sadly I haven't managed to copy the original formulation of the theorem (your second bullet); perhaps someone else will be able to build from this though.

\documentclass{article}

\usepackage{lipsum}

% open prooffile.tex
\Opensolutionfile{prooffile}
\Newassociation{myproof}{myProof}{prooffile}

% new theorem for demonstration
\newtheorem{mytheorem}{Theorem}

\begin{document}

\section{The theorems\ldots}
\begin{mytheorem}
\lipsum[1]
\begin{myproof}
This proves everything!

\lipsum[2]
\end{myproof}
\end{mytheorem}

% close prooffile.tex
\Closesolutionfile{prooffile}

\clearpage
\section{The proofs!}
% can renew the environment to your liking
\renewenvironment{myProof}[1]{{\bfseries Proof of Theorem #1}}{}

\IfFileExists{prooffile.tex}{\input{prooffile.tex}}{}

\end{document}

• Happily there is also \usepackage[nosolutionfiles]{answers}. I will test this today. – julkiewicz Feb 22 '12 at 8:20
• @julkiewicz yes indeed, a very useful option during construction! – cmhughes Feb 22 '12 at 17:08

If you want to have the same theorem appear twice, with the same numbering, the thm-restate package does what you want. http://www.ctan.org/tex-archive/macros/latex/exptl/thmtools You essentially define a new command that produces the theorem, and choose one instance that chooses the number for it.