# thmtools: theorem VI.2.1* = dual of theorem VI.2.1

I'm writing out a collection of theorems and their proofs corresponding to several theorems that appear without proof (or with only minimal proof sketches) in a published book. I am using thmtools to specify the theorem and proof environments.

Of course, it is important that the numbering of the theorems in my write-up matches the numbering of the corresponding theorems in the original text. Many of the theorems in this book come in "dual pairs", and the book uses the typographic convention illustrated by this example: Theorem VI.2.1* is the theorem dual to theorem VI.2.1.

Is there some way to define (through thmtools) a "dual theorem" environment that would produce the correct "starred" theorem number for it?

Edit: FWIW, here's the definition I'm using for my theorem environment:

\declaretheoremstyle[%
spaceabove=4ex%
]{thmstyle}
\declaretheorem[%
name={Theorem},%
numberwithin=section,%
style=thmstyle,%
]{thm}


P.S. it would be insanely cool if this environment could also automatically produce the statement of the dual theorem based on the statement of the original theorem, and even the proof from the original proof, but that would really be pushing the LaTeX envelope... :)

Edit2: Here's my attempt to implement egreg's suggestion:

%% the following block is meant to replace egreg's original
%%     \newtheorem*{dualthm*}{Theorem \dualnumber\rlap{*}}
\declaretheorem[%
name={Theorem \dualnumber\rlap{*}},%
style=thmstyle,%   %% see earlier Edit for the definition of thmstyle
unnumbered,%
]{dualtheorem}

%% dualthm below is almost identical to egreg's dualthm, except that
%% it refers to \dualtheorem instead of \dualthm*.
\newenvironment{dualthm}[1]
{\newcommand\dualnumber{\ref{#1}}\begin{dualtheorem}}
{\end{dualtheorem}}


Unfortunately, it fails with:

! Undefined control sequence.
\thmt@thmname ->Theorem \dualnumber
\rlap {*}
l.50 ]{dualtheorem}

?


I understand (I think) what egreg's scheme is doing, but I don't see how to translate it to thmtools, since, unlike newtheorem*, thmtool's declaretheorem apparently won't allow a mention of an undefined symbol in its specification. BTW, I tried multiple variants of the above, all of which failed for one reason or another. Then again, I'm a rank n00b at this, so it is very likely that I am missing something obvious. If so, please let me know.

-
I'm slightly confused. It sounds to me like you want [restate=...] and the restated version is marked by having its number starred? (What happens to subordinate equation numbers? I can't even remember what thmtools does in that case, I hate restate that much :D ) – Ulrich Schwarz Sep 14 '11 at 12:35
See edited answer for the thmtools code. Yours is as good, but lacks a predefinition for \dualnumber. – egreg Sep 18 '11 at 15:50
@egreg: thanks, that did the trick! – kjo Sep 18 '11 at 17:03

It should be easy to adapt the following scheme to thmtools

\documentclass[a4paper]{book}
\usepackage{amsthm}
\newtheorem{thm}{Theorem}[chapter]
\newtheorem*{dualthm*}{Theorem \dualnumber\rlap{*}}
\newenvironment{dualthm}[1]
{\newcommand\dualnumber{\ref{#1}}\begin{dualthm*}}
{\end{dualthm*}}

\begin{document}
\mainmatter
\chapter{One}
\section{One}
\begin{thm}\label{one}
$a=b$
\end{thm}
\begin{dualthm}{one}
$b=a$
\end{dualthm}
\end{document}


So dualthm is not really a "theorem-like" environment, but the subsidiary dualthm* is, but as a numberless theorem. The numbering is obtained via \ref defining each time the temporary command \dualnumber.

For automatically dualizing a statement one should know what kind of duality is involved. If it's the boolean algebra duality, maybe it can be done; duality in projective spaces is quite harder.

# Edit

Here's a way to adapt the above code to thmtools

\let\dualnumber\relax
\declaretheorem[%
name={Theorem \dualnumber\rlap{*}},%
style=thmstyle,%
unnumbered,%
]{dualthm*}

\newenvironment{dualthm}[1]
{\newcommand\dualnumber{\ref{#1}}\begin{dualthm*}}
{\end{dualthm*}}


For technical reasons, \dualnumber should have a definition before using it in \declaretheorem.

-
On the other hand, for category theory it'd be easy: \let\rightarrow=\leftarrow – Loop Space Sep 13 '11 at 12:22
@Andrew: good point. But what about Xy-pic diagrams? :) – egreg Sep 13 '11 at 12:26
I use TikZ nowadays so it would be \tikzset{dual/.style={<-}}. – Loop Space Sep 13 '11 at 16:57