TLDR
How to throw all dirty but necessary "lemmas/proofs" in the appendix, and restate them in the main text?
I had a few attempts, and it seemed that my requests are weird.. so I would explain a bit before I ask the question.
I'm writing a mathematical paper. I view writing math arguments as writing codes: statements are "functions" and proofs are the flesh. For completeness, I want to include as much proof as I want. However, since the structure of argument is not linear, doing so must by large decreases the readability. Therefore, I want to hide the dirty things in the appendix, and quote the def/thm/proof in my main text.
Ideally, a pseudo tex code should look as follows.
Section 1
#call{main-theorem}
% nothing input here.
#endcall
.
.
Section 10
.
.
Appendix
#theorem[callable]{main-theorem}
2-1=1.
#end-theorem
To achieve this, @Bernard has pointed to thmtools for me in [1]. To achieve what I really want, I got an error, but since it's not the main topic there, I make a new question here.
Minimal example
Below is a (almost) working minimal example.
\documentclass{article}
\usepackage{thmtools, thm-restate}
\declaretheorem{theorem}
\begin{document}
%\firsteuclid*
%%% Uncommenting the above causes an error:
%%% > ! Undefined control sequence.
%%% > l.7 \firsteuclid
\begin{restatable}[Euclid]{theorem}{firsteuclid}
\label{thm:euclid}
$$1+1 = 2.$$
\end{restatable}
\firsteuclid* % This, however, works fine.
\end{document}
It compiles correctly. However, I hope that I can first call \firsteuclid* before it has been stated. An attempt fails. You can replicate that by uncommenting the commented line.
One work-around, of course, is to accept its limit, and declare statements anyway as in [2]. But I also hope that the dirty codes can all be grouped together in the source file. It will make my life much easier in the future, when I want to use them in my next paper.. again, the analogy holds: you write good codes, and use them again and again.
Question
How to throw all dirty but necessary "codes" in the appendix, and restate them in the main text?
Reference
[3] Also related.. my another attempt Delay presenting a section
