Create a claim environment for nested claims inside theorem proofs using thmtools

Consider the following declarations:

\usepackage{amsmath, amsthm, amssymb, thmtools}

\declaretheorem[numberwithin = section]{theorem}
\declaretheorem[sibling = theorem, style = definition]{definition}
\declaretheorem[sibling = theorem]{lemma}
\declaretheorem[sibling = theorem]{proposition}
\declaretheorem[sibling = theorem]{remark}


I want to create a claim theorem which will be used for defining a claim inside the proof of a Theorem. For example,

\begin{proposition}
\begin{proof}
\begin{claim}
first claim
\begin{proof}
proof of first claim
\end{proof}
\end{claim}
\begin{claim}
second claim
\begin{proof}
proof of second claim
\end{proof}
\end{claim}
\end{proof}
\end{proposition}


The first claim should be automatically labeled as "Claim 1", the second claim as "Claim 2", and so on. The text in the proof should be indented such that it's clear where the proof of the individual claim ends without the presence of a q.e.d. symbol.

How can we achieve this? I'm new to latex, so please bear with me.

EDIT: The result should like this:

\begin{theorem}
Text
\begin{proof}[Proof\textup:\nopunct]
Some part of the proof of the main theorem ...\newline
\;\;\;\;\textbf{Claim 1:} Text\newline
\;\;\;\;\textit{Proof}: Line 1\newline
\;\;\;\;Line 2\newline
\;\;\;\;Last Line\newline
\;\;\;\;\;\;\;\;\textbf{Claim 1.1:} Text\newline
\;\;\;\;\;\;\;\;\textit{Proof}: Line 1\newline
\;\;\;\;\;\;\;\;Line 2\newline
\;\;\;\;\;\;\;\;Last Line\newline
continuation of main theorem proof ...
\end{proof}
\end{theorem}


The claim numbering should restart by 1 inside every new theorem proof. Moreover, the claim and its proof should be indented (like $\;\;\;\;$ would do inside an equation). If there is a further claim inside a claim, it should be numbered Claim 1.1 and again be indented (but this time with respect to the environmental claim). How can we do this?

• Please provide a complete (but small) working example, rather than just code snippets. – Steven B. Segletes Apr 4 '19 at 10:13
• @StevenB.Segletes I have no working example, since I don't know how I need to declare the "claim" environment. – 0xbadf00d Apr 4 '19 at 10:36

I think that you are looking for output that looks something like this:

Assuming so, then the code below does this.

\documentclass{article}

\usepackage{amsmath, amsthm, amssymb, thmtools}

\declaretheorem[numberwithin = section]{theorem}
\declaretheorem[sibling = theorem, style = definition]{definition}
\declaretheorem[sibling = theorem]{lemma}
\declaretheorem[sibling = theorem]{proposition}
\declaretheorem[sibling = theorem]{remark}

\usepackage{enumitem,xparse}
\newlist{Claim}{description}{2}
\setlist[Claim]{labelindent=2em,leftmargin=*}
\newif\ifInsideClaim
\newcounter{claim}[theorem]
\newcounter{cclaim}[claim]
\renewcommand\theclaim{\arabic{claim}}
\renewcommand\thecclaim{\arabic{claim}.\arabic{cclaim}}
\let\originalqedsymbol\qedsymbol
\newenvironment{claim}{%
% disable qed symbol if there is no star
\let\qedsymbol\relax%
\ifInsideClaim% we have a nested environment
\refstepcounter{cclaim}%
\let\theclaimcounter\thecclaim%
\else%
\refstepcounter{claim}%
\let\theclaimcounter\theclaim%
\InsideClaimtrue%
\fi%
\Claim\item[\textbf{Claim \theclaimcounter:}]%
}{\endClaim\InsideClaimfalse\let\qedsymbol\originalqedsymbol}

\begin{document}

\begin{proposition}
A  proposition.
\end{proposition}
\begin{proof}
Start the proof.
\begin{claim}
first claim
\begin{proof}
proof of first claim
\end{proof}
\begin{claim}
first subclaim
\begin{proof}
proof of first subclaim
\end{proof}
\end{claim}
\end{claim}
\begin{claim}
Second claim
\begin{proof}
Proof of second claim
\end{proof}
\end{claim}
\end{proof}

\end{document}


Here is a quick explanation of how this works:

• I have defined two counters claim and cclaim for the claim environment and the subclaim environment, respectively. The claim counter is numbered "inside" theorem and the cclaim counter inside the claim counter so that they are reset whenever their paraent counter changes.
• I have defined a claim environment and a boolean variable \ifInClaim to detect when the claim environement is nested. The code only allows claims and subclaims. It would be easy enough to allow further nesting but I doubt that you or your readers would want this.
• To achieve the requested indentation I have used the enumitem package (and each claim environment is secretly a description environment in disguise). You can easily adjust the indentation of the claim environments by changing 2em and 4em in the \setlist lines of the code.
• Edit The qedsymbol is disabled during the claim environments by setting \qedsymbol equal to \relax and then restoring it to the original value at the end of the proof.

EDIT

Here is a slight variation of the code to allow three levels of subclaims. Rather than using the switch \ifInClaim and counters claim and cclaim the code below has counters claimi, claimii, and claimiii as well as a claimlevel. From memory this is similar to how nested enumerate environments are done (although, I am sure that these are done more efficiently...). It would be easy enough to extend the new framework to arbitrary levels of nesting, provided that you have wide enough paper.

Here is the new output:

...and here is the revised code:

\documentclass{article}

\usepackage{amsmath, amsthm, amssymb, thmtools, etoolbox}

\declaretheorem[numberwithin = section]{theorem}
\declaretheorem[sibling = theorem, style = definition]{definition}
\declaretheorem[sibling = theorem]{lemma}
\declaretheorem[sibling = theorem]{proposition}
\declaretheorem[sibling = theorem]{remark}

\usepackage{enumitem,xparse}
\newlist{Claim}{description}{3}% allow 3 levels of nesting
\setlist[Claim]{labelindent=2em,leftmargin=*}

\newcounter{claimlevel}% records nesting level
\newcounter{claimi}[theorem] % claim counters for each nesting level
\newcounter{claimii}[claimi]
\newcounter{claimiii}[claimii]
\renewcommand\theclaimi{\arabic{claimi}}
\renewcommand\theclaimii{\theclaimi.\arabic{claimii}}
\renewcommand\theclaimiii{\theclaimii.\arabic{claimiii}}
\let\originalqedsymbol\qedsymbol
\newenvironment{claim}{%
% disable qed symbol if there is no star
\let\qedsymbol\relax%
\stepcounter{claimlevel}
\refstepcounter{claim\roman{claimlevel}}%
\Claim\item[\textbf{Claim \csuse{theclaim\roman{claimlevel}}:}]%

\begin{document}

\begin{proposition}
A  proposition.
\end{proposition}
\begin{proof}
Start the proof.
\begin{claim}
first claim
\begin{proof}
proof of first claim
\end{proof}
\begin{claim}
first subclaim
\begin{proof}
proof of first subclaim
\end{proof}
\begin{claim}
first subsubclaim
\begin{proof}
proof of first subsubclaim
\end{proof}
\end{claim}
\end{claim}
\end{claim}
\begin{claim}
Second claim
\begin{proof}
Proof of second claim
\end{proof}
\end{claim}
\end{proof}

\end{document}

• The original question says that "the proof of the individual claim ends without the presence of a q.e.d. symbol." This makes sense -- the multiplicity of tombstones becomes confusing, especially the "extra" one following on the line after the end of the proof text. – barbara beeton Jun 5 '19 at 18:02
• @barbarabeeton Thanks. I also thought that this looked strange but I missed the requirement. I'll update. – user30471 Jun 5 '19 at 21:57
• @0xbadf00d I had a look at overleaf and I see the same issue. Looking at the log files overleaf is still using TeXLive 2017 and, more importantly, version 3.5.2 of enumitem. If you download enumitem.sty from ctan (using the link that I just gave), and add it to your overleaf project this will fix the problem. (With the updated version of enumitem.sty the MWE compiles without errors, but there is always a chance that the current version of enumitem.sty may be incompatible with other parts of the TeX installation on overleaf...) – user30471 Jun 8 '19 at 6:32
• @0xbadf00d The easiest way to do this is with a slightly different design: rather than using \ifInsideCClaim it would be better to define claim counters claimi, claimii, claimiii etc and then you would need to use \newlist{Claim}{description}{3}. I'll edit. – user30471 Jun 27 '19 at 23:37