1

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}

And here is the output: The proof itself does not reference the theorem. Also, when I refer to it, the section number is used.

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

  1. Replace the "proof" string that begins the proof to state "Proof of Theorem 1.2", and have this reflected in the references, or
  2. Name the proof Proof 1, then the next one Proof 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?

1
  1. Update the title of the proof by supplying the appropriate reference as an optional argument:

    enter image description here

    \documentclass{article}
    
    \usepackage{amsmath,amssymb,amsthm}
    \newtheorem{thm}{Theorem}[section]
    \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}[Proof of Theorem~\ref{thm:oddSquares}]
    We prove the statement directly. Since $n$ is odd, we have that there exists an 
    integer~$k$ such that $n = 2k + 1$. Subsequently, $n^2 = (2k + 1)^2 = 4k^2 + 4k + 1 = 
    2k(2k + 2) + 1 = 2r + 1$, where $r = 2k + 1$. Therefore,~$n^2$ is odd.
    \end{proof}
    
    \end{document}
    
  2. You can create an automated proof-numbering mechanism by adding to your preamble

    \newcounter{proof}
    \renewcommand{\proofname}{\refstepcounter{proof}Proof~\theproof}
    

    This will number your proofs sequentially as Proof 1, Proof 2, ... and allow you to reference them as well.

    If you don't want an automated numbering, I'd suggest using

    \begin{proof}[Proof~1]
      <first proof>
    \end{proof}
    
    ...
    
    \begin{proof}[Proof~2]
      <second proof>
    \end{proof}
    
    ...
    
  • Thanks. This is telling me that the two approaches are essentially complementary to each other: either you refer to the theorem from the proof, or to the proof easily from the text. I can live with this. – Jason Jun 17 '16 at 3:06
  • In addition to this, I found that using \hyperref instead of \ref allows one to link to a label without supplying a numbering that might otherwise be troublesome (e.g, in my case, a proof number that reflected neither the theorem nor some arbitrary numbering of the proofs themselves). – Jason Jun 17 '16 at 14:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.