I was wondering if there's a way to make every proof automatically reference the latest theorem used in my text, or, alternatively, have proofs be labeled with ascending numbers. Allow me to demonstrate with a MWE:
\documentclass[a4paper, 12pt]{article}
\usepackage{amsmath, amssymb, amsthm}
\newtheorem{thm}{Theorem}[section]
\newtheorem{prop}[thm]{Proposition}
\newtheorem{lem}[thm]{Lemma}
\newtheorem{cor}[thm]{Corollary}
\newtheorem{defn}[thm]{Definition}
\begin{document}
\section{A section}
\begin{defn}
An integer $n$ has odd parity (equiv.: ``is odd") if and only if there exists an integer $k$ such that $n = 2k+1$. $n$ has even parity (equiv.: ``is even") if and only if it does not have odd parity.
\label{defn:oddAndEvenParity}
\end{defn}
\begin{thm}{(Squares of odds are also odd)}
If $n$ is an odd integer, then $n^2$ is also an odd integer.
\label{thm:oddSquares}
\end{thm}
\begin{cor}{(Even perfect squares have even square roots)}
If $n^2$ is an even integer, then $n$ is also even.
\label{cor:evenSquareRoots}
\end{cor}
\begin{proof}
We prove the statement directly. Since $n$ is odd, we have that there exists an integer $k$ such that $n = 2k+1$. By algebra, we have that $n^2 = (2k + 1)^2 = 4k^2 + 4k + 1 = 2\underbrace{k(2k + 2)}_{r \in \mathbb{Z}} + 1 = 2r + 1$. Therefore, $n^2$ is odd.
\label{prf:evenSquareRoots}
\end{proof}
Referring to the proof above through its label yields the section number: \ref{prf:evenSquareRoots}.
\end{document}
I could, of course, be referring to the proof of a theorem in my text by labeling the theorem instead, but a given theorem can have many different proofs. So, in this case, what I would really need would be some remedy that allows me to do one of the following
- Replace the "proof" string that begins the proof to state "Proof of Theorem 1.2", and have this reflected in the references, or
- Name the proof
Proof 1
, then the next oneProof 2
, etc.
I've found this thread that tries to do the first one but the op is using a different document class, elsarticle
. I am not familiar with that particular document class, and I have found that the newproof
package conflicts with amsthm
, which I absolutely need for my theorems, definitions, lemmas, etc. I tried some remedies by using \newtheorem
to define an alternative proof
-like environment but they all failed to do exactly what I need. Any ideas?