The problem was indicated by the O.P. already:
proof
is a counterless environment, i.e. there is no counter connected to it, as such \label
inside proof
will grab the last \@currentlabel
, this has been modified by \refstepcounter{section}
in \section{Proofs}
, so \cref
reports section
or `appendix for this.
My approach adds a \prooflabel
that connects to the counter value of the theorem counter from the relevant label that is involved, such that Theorem 147 will provide Proof 147.
In order to simplify this, \crtcrefcountervalue
(a new addition to crossreftools
package) is applied and injected into the proofcntr
counter.
I added cleveref
names for the proofcntr
as well.
\documentclass{article}
\usepackage{etoolbox}
\usepackage{xparse}
\usepackage{amsthm}
\usepackage{hyperref}
\usepackage{cleveref}
\usepackage{crossreftools}
%%% The following lines are not necessary with crossreftools v.0.8
\makeatletter
\@ifundefined{crtcrefcountervalue}{%
\newcommand{\crt@crefundefinedcountervalue}{1977}
\newcommand{\crtrefundefinedcountervalue}[1]{\renewcommand{\crt@refundefinedcountervalue}{#1}}
\newcommand{\crtcrefcountervalue}[1]{%
\crtcrefifundefinedlabel{#1}{%
\crt@crefundefinedcountervalue%
}{%
\crtcrefnumber{#1}%
}%
}
}{}
\makeatother
\newtheorem{theorem}{Theorem}
\newcounter{proofcntr}
\crefname{proofcntr}{proof}{proofs}
\Crefname{proofcntr}{Proof}{Proofs}
\NewDocumentCommand{\prooflabel}{+m+m}{%
\setcounter{proofcntr}{\numexpr\crtcrefcountervalue{#1}-1}%
\refstepcounter{proofcntr}%
\label{#2}%
}
\begin{document}
\section{Theorems}
\begin{theorem}\label{thm:some-theorem}
This is a theorem.
\end{theorem}
For an intuition, see the proof.
For an intuition, see \cref{proof:some-theorem}, but with respect to \cref{thm:some-really-important-theorem} see the best proof ever: \cref{proof:some-really-important-theorem}
\begin{theorem}\label{thm:some-really-important-theorem}
Brontosaurs are thin at one end, thick in the middle and thin at the other end.
Source: Anne Elk (Misses).
\end{theorem}
\appendix
\section{Proofs}
\begin{proof}[Proof of \Cref{thm:some-theorem}]
\prooflabel{thm:some-theorem}{proof:some-theorem}
This is a proof.
\end{proof}
\begin{proof}[Proof of \Cref{thm:some-really-important-theorem}]
\prooflabel{thm:some-really-important-theorem}{proof:some-really-important-theorem}
The source is Anne Elk (Misses), that's enough ;-)
\end{proof}
\end{document}

\hypertarget
and\hyperlink
works as a solution, though I still have to set the caption "proof" manually.