| 1 |
\documentclass{amsart} |
| 2 |
\usepackage{color} |
| 3 |
\usepackage{graphics} |
| 4 |
\usepackage[ND,SEQ,EQ,ML]{prftree} |
| 5 |
\usepackage{url} |
| 6 |
\usepackage{microtype} |
| 7 |
|
| 8 |
\setlength{\fboxsep}{0pt} |
| 9 |
|
| 10 |
\begin{document} |
| 11 |
\title{Proof Trees in \LaTeX} |
| 12 |
\date{} |
| 13 |
\author{Marco Benini} |
| 14 |
\address{Dipartimento di Scienza e Alta Tecnologia\\ |
| 15 |
Universit\`a degli Studi dell'Insubria\\ |
| 16 |
via Valleggio 11, I-22100 Como, Italy} |
| 17 |
\email{[email protected]} |
| 18 |
\urladdr{http://marcobenini.wordpress.com} |
| 19 |
\maketitle |
| 20 |
|
| 21 |
% -------------------------- |
| 22 |
|
| 23 |
\section{Introduction}\label{sec:introduction} |
| 24 |
Writing proofs in natural deduction or in similar, tree-like calculi, |
| 25 |
is always a challenge: from the typographical point of view, these |
| 26 |
proofs are complex objects that cannot be simply typeset using the |
| 27 |
standard \LaTeX{} commands. Thus, many packages have been developed: |
| 28 |
Sam Buss's \texttt{bussproofs.sty}, |
| 29 |
\url{http://math.ucsd.edu/~sbuss/ResearchWeb/bussproofs/}; Makoto |
| 30 |
Tatsuta's \texttt{proof.sty}, |
| 31 |
\url{http://research.nii.ac.jp/~tatsuta/proof-sty.html}; and |
| 32 |
\texttt{prooftree.sty} by Paul Taylor, |
| 33 |
\url{http://mirror.ctan.org/macros/generic/proofs/taylor}. |
| 34 |
|
| 35 |
All these packages have their merits and weaknesses. For example, |
| 36 |
Buss's package is extremely flexible but inference rules with more |
| 37 |
than five assumptions cannot be directly typeset. On the other hand, |
| 38 |
Tatsuta's package provides a very simple set of commands doing a |
| 39 |
fine job, but customisation is very limited. Taylor's package provides |
| 40 |
a natural syntax for writing proofs, but customisation is limited, and |
| 41 |
the package has an expire date. |
| 42 |
|
| 43 |
The package presented in the following provides most of the features |
| 44 |
which are already present in Buss's package, coupled with some new |
| 45 |
ones. This package uses a syntax which is closer to Tatsuta's one, but |
| 46 |
almost all the typesetting process is parametric, so that each bit of |
| 47 |
a proof can be customised at will. |
| 48 |
|
| 49 |
The graphical appearance of a proof is similar to the one obtained |
| 50 |
using Taylor's package, but the additional features allow to set up |
| 51 |
the graphical output to follow the style of some of the standard |
| 52 |
textbooks, e.g., A.S.~Troelstra and H.~Schwichtenberg, \textit{Basic |
| 53 |
Proof Theory}, Cambridge University Press (2000). |
| 54 |
|
| 55 |
% -------------------------- |
| 56 |
\clearpage |
| 57 |
\section{Basic Commands}\label{sec:basic_commands} |
| 58 |
The package is invoked by putting \verb|\usepackage{prftree.sty}| in |
| 59 |
the preamble of the document, and installation reduces to put the file |
| 60 |
\texttt{prftree.sty} somewhere in the \LaTeX{} search |
| 61 |
path.\vspace{2ex} |
| 62 |
|
| 63 |
A proof tree constructs a box with the following internal structure: |
| 64 |
\begin{center} |
| 65 |
{\setlength{\unitlength}{1em} |
| 66 |
\begin{picture}(31,6) |
| 67 |
\put(7,4){\framebox(17,2){$\mbox{assumption}_1 \cdots |
| 68 |
\mbox{assumption}_n$}} |
| 69 |
\put(6,3){\line(1,0){19}} |
| 70 |
\put(26,2){\framebox(5,2){rule name}} |
| 71 |
\put(0,2){\framebox(5,2){label}} |
| 72 |
\put(10,0){\framebox(11,2){conclusion}} |
| 73 |
\end{picture}} |
| 74 |
\end{center} |
| 75 |
In turn, each assumption is typeset as a box which has usually the |
| 76 |
shape of another proof tree, while the rule name and the label are |
| 77 |
typeset in a text box, and the conclusion in a math box. The aspect of |
| 78 |
the proof line is controlled by suitable options, as is the presence |
| 79 |
of the rule name and of the label. Options cover other aspects of the |
| 80 |
graphical rendering of a proof tree, as it will be explained |
| 81 |
later. The basic command to build a proof tree is \verb|\prftree|. |
| 82 |
|
| 83 |
For example, the proof of $A \supset \neg\neg A$ in natural deduction |
| 84 |
is: |
| 85 |
\begin{displaymath} |
| 86 |
\prftree[r]{$\scriptstyle\supset\mathrm{I}$} |
| 87 |
{\prftree[r]{$\scriptstyle\supset\mathrm{I}$} |
| 88 |
{\prftree[r]{$\scriptstyle\supset\mathrm{E}$} |
| 89 |
{\prfboundedassumption{A}} |
| 90 |
{\prfboundedassumption{\neg A}} |
| 91 |
{\bot}} |
| 92 |
{\neg\neg A}} |
| 93 |
{A \supset \neg\neg A} |
| 94 |
\end{displaymath} |
| 95 |
This proof is generated by the following \LaTeX{} code: |
| 96 |
\begin{verbatim} |
| 97 |
\begin{displaymath} |
| 98 |
\prftree[r]{$\scriptstyle\supset\mathrm{I}$} |
| 99 |
{\prftree[r]{$\scriptstyle\supset\mathrm{I}$} |
| 100 |
{\prftree[r]{$\scriptstyle\supset\mathrm{E}$} |
| 101 |
{\prfboundedassumption{A}} |
| 102 |
{\prfboundedassumption{\neg A}} |
| 103 |
{\bot}} |
| 104 |
{\neg\neg A}} |
| 105 |
{A \supset \neg\neg A} |
| 106 |
\end{displaymath} |
| 107 |
\end{verbatim} |
| 108 |
|
| 109 |
In general, the syntax of the \verb|\prftree| command is: |
| 110 |
\begin{displaymath} |
| 111 |
\verb|\prftree|[\mbox{options}] \cdots |
| 112 |
[\mbox{options}]\{\mbox{assumption}_1\} \cdots |
| 113 |
\{\mbox{assumption}_n\}\{\mbox{conclusion}\} |
| 114 |
\end{displaymath} |
| 115 |
Assumptions are optional and there may be any number of them. Each |
| 116 |
assumption may contain a proof tree, which is typeset independently: |
| 117 |
the order allows to use indentation to help reading the source. The |
| 118 |
conclusion is mandatory, and it is supposed to be a |
| 119 |
formula. |
| 120 |
|
| 121 |
Assumptions and the conclusion are typeset in a display style math |
| 122 |
environment. Options control the way the proof is generated: in the |
| 123 |
example, the \verb|r| option has been used to signal that the first |
| 124 |
argument of \verb|\prftree| is the name of the inference rule. |
| 125 |
|
| 126 |
The available options are: |
| 127 |
\begin{itemize} |
| 128 |
\item\ [\textbf{r}], [\textbf{rule}], [\textbf{by rule}], |
| 129 |
[\textbf{by}], [\textbf{right}]: the first argument after the |
| 130 |
options is the rule name, which is typeset in text mode; |
| 131 |
\item\ [\textbf{l}], [\textbf{left}], [\textbf{label}]: the first |
| 132 |
argument after the options is the label of the rule, which is |
| 133 |
typeset in text mode. If a rule name is present, the first argument |
| 134 |
is the rule name, and the second one is the label; |
| 135 |
\item\ [\textbf{straight}], [\textbf{straight line}], |
| 136 |
[\textbf{straightline}]: makes the proof line solid; |
| 137 |
\item\ [\textbf{dotted}], [\textbf{dotted line}], |
| 138 |
[\textbf{dottedline}]: makes the proof line dotted; |
| 139 |
\item\ [\textbf{dashed}], [\textbf{dashed line}], |
| 140 |
[\textbf{dashedline}]: makes the proof line dashed; |
| 141 |
\item\ [\textbf{f}], [\textbf{fancy}], [\textbf{fancy line}], |
| 142 |
[\textbf{fancyline}]: the proof line will be fancy; |
| 143 |
\item\ [\textbf{s}], [\textbf{single}], [\textbf{single line}], |
| 144 |
[\textbf{singleline}]: makes the proof line single; |
| 145 |
\item\ [\textbf{d}], [\textbf{double}], [\textbf{double line}], |
| 146 |
[\textbf{doubleline}]: makes the proof line double; |
| 147 |
\item\ [\textbf{noline}]: suppresses the proof line (prevails over all |
| 148 |
other line options); |
| 149 |
\item\ [\textbf{summary}]: renders the proof line as the summary |
| 150 |
symbol (prevails over all other line options except \textbf{noline}). |
| 151 |
\end{itemize} |
| 152 |
By default the proof line is straight and single. Options may be |
| 153 |
written in sequence, as in \verb|[r,f,d]|, which means that the proof |
| 154 |
tree will have a rule name, and the proof line will be fancy and |
| 155 |
double, or separately, as in \verb|[r][f][d]|, or even as a |
| 156 |
combination, like \verb|[r][f,d]|. Options are evaluated |
| 157 |
left-to-right, so \verb|[d,s]| is the same as \verb|[s]|, while |
| 158 |
\verb|[noline,straight,d]| is the same as \verb|[noline]|. |
| 159 |
|
| 160 |
The conjunction introduction rule illustrates the various line |
| 161 |
options: |
| 162 |
\begin{displaymath} |
| 163 |
\begin{array}{lcc@{\qquad}l} |
| 164 |
\mbox{default (single straight)} & |
| 165 |
\prftree{A}{B}{A \wedge B} & |
| 166 |
\prftree[r]{$\scriptstyle\wedge\mathrm{I}$} |
| 167 |
{A}{B}{A \wedge B} & |
| 168 |
\texttt{[straight]} \\ |
| 169 |
\mbox{double straight} & |
| 170 |
\prftree[d]{A}{B}{A \wedge B} & |
| 171 |
\prftree[d,r]{$\scriptstyle\wedge\mathrm{I}$} |
| 172 |
{A}{B}{A \wedge B} & |
| 173 |
\texttt{[double,straight]} \\ |
| 174 |
\mbox{single dotted} & |
| 175 |
\prftree[dotted]{A}{B}{A \wedge B} & |
| 176 |
\prftree[dotted,r]{$\scriptstyle\wedge\mathrm{I}$} |
| 177 |
{A}{B}{A \wedge B} & |
| 178 |
\texttt{[dotted]} \\ |
| 179 |
\mbox{double dotted} & |
| 180 |
\prftree[dotted,d]{A}{B}{A \wedge B} & |
| 181 |
\prftree[dotted,d,r]{$\scriptstyle\wedge\mathrm{I}$} |
| 182 |
{A}{B}{A \wedge B} & |
| 183 |
\texttt{[double,dotted]} \\ |
| 184 |
\mbox{single dashed} & |
| 185 |
\prftree[dashed]{A}{B}{A \wedge B} & |
| 186 |
\prftree[dashed,r]{$\scriptstyle\wedge\mathrm{I}$} |
| 187 |
{A}{B}{A \wedge B} & |
| 188 |
\texttt{[dashed]} \\ |
| 189 |
\mbox{double dashed} & |
| 190 |
\prftree[dashed,d]{A}{B}{A \wedge B} & |
| 191 |
\prftree[dashed,d,r]{$\scriptstyle\wedge\mathrm{I}$} |
| 192 |
{A}{B}{A \wedge B} & |
| 193 |
\texttt{[double,dashed]} \\ |
| 194 |
\mbox{single fancy} & |
| 195 |
\prftree[f]{A}{B}{A \wedge B} & |
| 196 |
\prftree[f,r]{$\scriptstyle\wedge\mathrm{I}$} |
| 197 |
{A}{B}{A \wedge B} & |
| 198 |
\texttt{[fancy]} \\ |
| 199 |
\mbox{double fancy} & |
| 200 |
\prftree[f,d]{A}{B}{A \wedge B} & |
| 201 |
\prftree[f,d,r]{$\scriptstyle\wedge\mathrm{I}$} |
| 202 |
{A}{B}{A \wedge B} & |
| 203 |
\texttt{[double,fancy]} \\ |
| 204 |
\mbox{noline} & |
| 205 |
\prftree[noline]{A}{B}{A \wedge B} & |
| 206 |
\prftree[noline,r]{$\scriptstyle\wedge\mathrm{I}$} |
| 207 |
{A}{B}{A \wedge B} & |
| 208 |
\texttt{[noline]} |
| 209 |
\end{array} |
| 210 |
\end{displaymath} |
| 211 |
These examples are implemented in an array whose cells have the form |
| 212 |
\begin{center} |
| 213 |
\verb|\prftree[|\emph{option}\verb|]{A}{B}{A \wedge B} &| |
| 214 |
\verb|\prftree[|\emph{option}\verb|,r]{$\scriptstyle\wedge\mathrm{I}$}| |
| 215 |
\end{center} |
| 216 |
in which the option part is the one on the right of the |
| 217 |
picture.\vspace{1ex} |
| 218 |
|
| 219 |
An assumption is a special proof tree, built by the command: |
| 220 |
\begin{displaymath} |
| 221 |
\verb|\prfassumption|\{\text{formula}\} |
| 222 |
\end{displaymath} |
| 223 |
Similarly, a bounded assumption is produced by the command: |
| 224 |
\begin{displaymath} |
| 225 |
\verb|\prfboundedassumption|\{\text{formula}\} |
| 226 |
\end{displaymath} |
| 227 |
as in the previous example. |
| 228 |
|
| 229 |
Although it is possible to type assumptions directly as argument of |
| 230 |
\verb|\prftree|, it is better to use the commands above: as explained |
| 231 |
later, since a proof tree is a box with an internal structure, the |
| 232 |
assumption commands take care of building this structure |
| 233 |
appropriately, while the direct typing does not, which may produce |
| 234 |
unexpected results.\vspace{2ex} |
| 235 |
|
| 236 |
Similarly, axioms are produced by the commands |
| 237 |
\begin{displaymath} |
| 238 |
\verb|\prfaxiom|\{\mbox{axiom}\} |
| 239 |
\end{displaymath} |
| 240 |
and |
| 241 |
\begin{displaymath} |
| 242 |
\verb|\prfbyaxiom|\{\mbox{name}\}\{\mbox{axiom}\} |
| 243 |
\end{displaymath} |
| 244 |
For example, the axiom stating that equality is reflexive, is |
| 245 |
\begin{displaymath} |
| 246 |
\begin{array}{cc} |
| 247 |
\prfaxiom{\forall x\, x = x} & |
| 248 |
\prfbyaxiom{refl}{\forall x\, x = x} |
| 249 |
\end{array} |
| 250 |
\end{displaymath} |
| 251 |
and they are generated by the \LaTeX{} code |
| 252 |
\begin{displaymath} |
| 253 |
\begin{array}{l} |
| 254 |
\verb|\prfaxiom{\forall x\, x = x}|\\ |
| 255 |
\verb|\prfbyaxiom{refl}{\forall x\, x = x}| |
| 256 |
\end{array} |
| 257 |
\end{displaymath}\vspace{-.2ex} |
| 258 |
|
| 259 |
Finally, a proof summary is used to summarise a proof. The |
| 260 |
corresponding command is: |
| 261 |
\begin{displaymath} |
| 262 |
\verb|\prfsummary|[\mbox{name}]\{\mbox{assumption}_1\} \cdots |
| 263 |
\{\mbox{assumption}_n\}\{\mbox{conclusion}\} |
| 264 |
\end{displaymath} |
| 265 |
The name of the proof is optional, while the assumptions and the |
| 266 |
conclusion are treated as in \verb|\prftree|. When present, the proof |
| 267 |
name is typeset in text mode. |
| 268 |
|
| 269 |
For example, \verb|\prfsummary{\forall x\, x = x}| produces |
| 270 |
\begin{displaymath} |
| 271 |
\prfsummary{\forall x\, x = x} |
| 272 |
\end{displaymath} |
| 273 |
while |
| 274 |
\verb|\prfsummary[name]{A(x)}{B(y)}{B(y) \wedge A(x)}| |
| 275 |
gives |
| 276 |
\begin{displaymath} |
| 277 |
\prfsummary[name]{A(x)}{B(y)}{B(y) \wedge A(x)} |
| 278 |
\end{displaymath}\vspace{-.2ex} |
| 279 |
|
| 280 |
In general, a proof tree is a \TeX{} box containing all the pieces of |
| 281 |
the tree, with strict bounds: for example, |
| 282 |
\begin{displaymath} |
| 283 |
\fbox{\prfsummary[name]{A(x)}{B(y)}{B(y) \wedge A(x)}} |
| 284 |
\end{displaymath} |
| 285 |
|
| 286 |
% -------------------------- |
| 287 |
\clearpage |
| 288 |
\section{Parameters}\label{sec:parameters} |
| 289 |
A number of parameters may be used to control the typesetting of proof |
| 290 |
trees. They may be changed globally or locally, following the usual |
| 291 |
scoping rules of \TeX{}. In this respect, remember that each |
| 292 |
assumption is typeset independently, so parameters may be changed on a |
| 293 |
sub-proof basis, as will be done in most examples.\vspace{2ex} |
| 294 |
|
| 295 |
There are various \TeX{} dimensions that influence how proofs are |
| 296 |
constructed: |
| 297 |
\begin{itemize} |
| 298 |
\item\ \verb|\prflinepadbefore| (default 0.3ex): the space between the |
| 299 |
bottom line of assumptions and the proof line |
| 300 |
\item\ \verb|\prflinepadafter| (default 0.3ex): the space between the |
| 301 |
proof line and the top of the conclusion; |
| 302 |
\item\ \verb|\prflineextra| (default 0.3em): the length which extends |
| 303 |
on the left and on the right the proof line so that it is slightly |
| 304 |
longer than the largest between the conclusion and the list of |
| 305 |
(direct) assumptions; |
| 306 |
\item\ \verb|\prflinethickness| (default 0.12ex): the thickness of the |
| 307 |
proof line; |
| 308 |
\item\ \verb|\prfemptylinethickness| (default 4 times the line |
| 309 |
thickness): in the rare case when the line is empty, but there are |
| 310 |
assumptions, this is the distance between the assumptions and the |
| 311 |
conclusion; |
| 312 |
\item\ \verb|\prfrulenameskip| (default 0.2em): the space between the |
| 313 |
proof line and the rule name; |
| 314 |
\item\ \verb|\prflabelskip| (default 0.2em): the space between the |
| 315 |
proof label and the proof line; |
| 316 |
\item\ \verb|\prfinterspace| (default .8em): the space between two |
| 317 |
subsequent assumptions in the assumption list; |
| 318 |
\item\ \verb|\prfdoublelineinterspace| (default 0.06ex): the space |
| 319 |
between the two lines of a double line. |
| 320 |
\end{itemize} |
| 321 |
|
| 322 |
For example, |
| 323 |
\begin{displaymath} |
| 324 |
\prflinepadafter=0ex |
| 325 |
\prftree[r]{$\supset$I} |
| 326 |
{\prftree[r]{$\supset$I} |
| 327 |
{\prftree[r]{$\supset$E} |
| 328 |
{\prfboundedassumption{A}} |
| 329 |
{\prfboundedassumption{\neg A}} |
| 330 |
{\bot}} |
| 331 |
{\neg\neg A}} |
| 332 |
{A \supset \neg\neg A} |
| 333 |
\end{displaymath} |
| 334 |
is typeset by |
| 335 |
\begin{verbatim} |
| 336 |
\prflinepadafter=0ex |
| 337 |
\prftree[r]{$\supset$I} |
| 338 |
{\prftree[r]{$\supset$I} |
| 339 |
{\prftree[r]{$\supset$E} |
| 340 |
{\prfboundedassumption{A}} |
| 341 |
{\prfboundedassumption{\neg A}} |
| 342 |
{\bot}} |
| 343 |
{\neg\neg A}} |
| 344 |
{A \supset \neg\neg A} |
| 345 |
\end{verbatim} |
| 346 |
|
| 347 |
Similarly, \verb|\prflineextra=-.4em| and \verb|\prfrulenameskip=.8em| |
| 348 |
produce: |
| 349 |
\begin{displaymath} |
| 350 |
{\prflineextra=-.4em |
| 351 |
\prfrulenameskip=.8em |
| 352 |
\prftree[r]{$\supset$I} |
| 353 |
{\prftree[r]{$\supset$I} |
| 354 |
{\prftree[r]{$\supset$E} |
| 355 |
{\prfboundedassumption{A}} |
| 356 |
{\prfboundedassumption{\neg A}} |
| 357 |
{\bot}} |
| 358 |
{\neg\neg A}} |
| 359 |
{A \supset \neg\neg A}} |
| 360 |
\end{displaymath} |
| 361 |
|
| 362 |
Also, \verb|\prflinethickness=3pt| and |
| 363 |
\verb|\prfdoublelineinterspace=2pt| in the upper sub-proof generate: |
| 364 |
\begin{displaymath} |
| 365 |
\prftree[r]{$\supset$I} |
| 366 |
{\prftree[r]{$\supset$I} |
| 367 |
{\prflinethickness=3pt |
| 368 |
\prfdoublelineinterspace=2pt |
| 369 |
\prftree[r,d]{$\supset$E} |
| 370 |
{\prfboundedassumption{A}} |
| 371 |
{\prfboundedassumption{\neg A}} |
| 372 |
{\bot}} |
| 373 |
{\neg\neg A}} |
| 374 |
{A \supset \neg\neg A} |
| 375 |
\end{displaymath} |
| 376 |
The corresponding code is |
| 377 |
\begin{verbatim} |
| 378 |
\prftree[r]{$\supset$I} |
| 379 |
{\prftree[r]{$\supset$I} |
| 380 |
{\prflinethickness=3pt |
| 381 |
\prfdoublelineinterspace=2pt |
| 382 |
\prftree[r,d]{$\supset$E} |
| 383 |
{\prfboundedassumption{A}} |
| 384 |
{\prfboundedassumption{\neg A}} |
| 385 |
{\bot}} |
| 386 |
{\neg\neg A}} |
| 387 |
{A \supset \neg\neg A} |
| 388 |
\end{verbatim} |
| 389 |
|
| 390 |
Line thickness does not affect dashed, dotted, and fancy lines, but |
| 391 |
interline space does: in the example, |
| 392 |
\verb|\prfdoublelineinterspace=4pt| on a fancy line produces |
| 393 |
\begin{displaymath} |
| 394 |
\prftree[r]{$\supset$I} |
| 395 |
{\prftree[r]{$\supset$I} |
| 396 |
{\prfdoublelineinterspace=4pt |
| 397 |
\prftree[r,d,f]{$\supset$E} |
| 398 |
{\prfboundedassumption{A}} |
| 399 |
{\prfboundedassumption{\neg A}} |
| 400 |
{\bot}} |
| 401 |
{\neg\neg A}} |
| 402 |
{A \supset \neg\neg A} |
| 403 |
\end{displaymath}\vspace{.2ex} |
| 404 |
|
| 405 |
Fancy lines are drawn by the \verb|\prffancyline| command. This can be |
| 406 |
redefined: as a guideline, the package defines it as |
| 407 |
\begin{verbatim} |
| 408 |
\def\prffancyline{\cleaders\hbox to .63em% |
| 409 |
{\hss\raisebox{-.5ex}[.2ex][0pt]{$\sim$}\hss}\hfill} |
| 410 |
\end{verbatim}\vspace{2ex} |
| 411 |
|
| 412 |
Label spacing works exactly as rule name spacing. Actually, it is |
| 413 |
possible to have a proof with both a label and a rule name: |
| 414 |
\begin{displaymath} |
| 415 |
\prftree[r]{$\supset$I} |
| 416 |
{\prflabelskip=.7em |
| 417 |
\prftree[r,l]{$\supset$I} |
| 418 |
{[\textsl{$\bot\mathrm{E}$ will not work here!}]} |
| 419 |
{\prftree[r]{$\supset$E} |
| 420 |
{\prfboundedassumption{A}} |
| 421 |
{\prfboundedassumption{\neg A}} |
| 422 |
{\bot}} |
| 423 |
{\neg\neg A}} |
| 424 |
{A \supset \neg\neg A} |
| 425 |
\end{displaymath} |
| 426 |
which has been typeset by |
| 427 |
\begin{verbatim} |
| 428 |
\prftree[r]{$\supset$I} |
| 429 |
{\prflabelskip=.7em |
| 430 |
\prftree[r,l]{$\supset$I} |
| 431 |
{[\textsl{$\bot\mathrm{E}$ will not work here!}]} |
| 432 |
{\prftree[r]{$\supset$E} |
| 433 |
{\prfboundedassumption{A}} |
| 434 |
{\prfboundedassumption{\neg A}} |
| 435 |
{\bot}} |
| 436 |
{\neg\neg A}} |
| 437 |
{A \supset \neg\neg A} |
| 438 |
\end{verbatim}\vspace{2ex} |
| 439 |
|
| 440 |
The \verb|\prfinterspace| controls the distance between |
| 441 |
assumptions. Specifically, this is the space between the \emph{boxes} |
| 442 |
containing two assumptions. |
| 443 |
|
| 444 |
Consider the following example |
| 445 |
\begin{displaymath} |
| 446 |
\prftree |
| 447 |
{\prftree |
| 448 |
{\prftree |
| 449 |
{\prftree |
| 450 |
{\prftree |
| 451 |
{\prfboundedassumption{A \rightarrow (B \rightarrow C)}} |
| 452 |
{\prfboundedassumption{A}} |
| 453 |
{B \rightarrow C}} |
| 454 |
{\prftree |
| 455 |
{\prfboundedassumption{A \rightarrow B}} |
| 456 |
{\prfboundedassumption{A}} |
| 457 |
{B}} |
| 458 |
{C}} |
| 459 |
{A \rightarrow C}} |
| 460 |
{(A \rightarrow B) \rightarrow (A \rightarrow C)}} |
| 461 |
{(A \rightarrow (B \rightarrow C)) \rightarrow ((A \rightarrow B) |
| 462 |
\rightarrow (A \rightarrow C))} |
| 463 |
\end{displaymath} |
| 464 |
Although the assumptions in the top line are well spaced, the two |
| 465 |
sub-proofs on the top are too close. This can be corrected in two |
| 466 |
different ways: by putting an explicit space, via \verb|\hspace|, in |
| 467 |
front of the second sub-proof, or after the first |
| 468 |
sub-proof---remember, they are just boxes |
| 469 |
\begin{displaymath} |
| 470 |
\prftree |
| 471 |
{\prftree |
| 472 |
{\prftree |
| 473 |
{\prftree |
| 474 |
{\prftree |
| 475 |
{\prfboundedassumption{A \rightarrow (B \rightarrow C)}} |
| 476 |
{\prfboundedassumption{A}} |
| 477 |
{B \rightarrow C}\hspace{1.5em}} |
| 478 |
{\prftree |
| 479 |
{\prfboundedassumption{A \rightarrow B}} |
| 480 |
{\prfboundedassumption{A}} |
| 481 |
{B}} |
| 482 |
{C}} |
| 483 |
{A \rightarrow C}} |
| 484 |
{(A \rightarrow B) \rightarrow (A \rightarrow C)}} |
| 485 |
{(A \rightarrow (B \rightarrow C)) \rightarrow ((A \rightarrow B) |
| 486 |
\rightarrow (A \rightarrow C))} |
| 487 |
\end{displaymath} |
| 488 |
otherwise, putting $\verb|\prfinterspace|=1.5\mathrm{em}$ before the |
| 489 |
sub-proof whose conclusion is $C$, one obtains the more pleasant |
| 490 |
\begin{displaymath} |
| 491 |
\prftree |
| 492 |
{\prftree |
| 493 |
{\prftree |
| 494 |
{\prfinterspace=1.5em |
| 495 |
\prftree |
| 496 |
{\prftree |
| 497 |
{\prfboundedassumption{A \rightarrow (B \rightarrow C)}} |
| 498 |
{\prfboundedassumption{A}} |
| 499 |
{B \rightarrow C}} |
| 500 |
{\prftree |
| 501 |
{\prfboundedassumption{A \rightarrow B}} |
| 502 |
{\prfboundedassumption{A}} |
| 503 |
{B}} |
| 504 |
{C}} |
| 505 |
{A \rightarrow C}} |
| 506 |
{(A \rightarrow B) \rightarrow (A \rightarrow C)}} |
| 507 |
{(A \rightarrow (B \rightarrow C)) \rightarrow ((A \rightarrow B) |
| 508 |
\rightarrow (A \rightarrow C))} |
| 509 |
\end{displaymath}\vspace{.2ex} |
| 510 |
|
| 511 |
The \verb|Strut| option of the package controls a subtle point about |
| 512 |
spacing around a proof line: assumptions and conclusion are usually |
| 513 |
typeset so that the height and the depth of their box is at least the |
| 514 |
one of \verb|\mathstrut|. In this way, adjacent proofs will have their |
| 515 |
proof lines aligned (well, whenever they don't have huge |
| 516 |
conclusions). But, as signalled by Dominic Hughes, sometimes one wants |
| 517 |
the height and the depth to be the ``real'' ones, especially when |
| 518 |
there are no characters/symbols with a positive depth: this forces the |
| 519 |
perceived space above and below the proof line to be exactly the |
| 520 |
values of \verb|\prflinepadbefore| and \verb|\prflinepadafter|. This |
| 521 |
behaviour can be achieved by calling the package with the \verb|STRUT| |
| 522 |
option. Alternatively, one may use the \verb|\prfSTRUToptionfalse| |
| 523 |
command to locally force this behaviour, and |
| 524 |
\verb|\prfSTRUToptiontrue| to return to the standard one. Similarly, |
| 525 |
the \verb|STRUTlabel| package option, together with the pair of |
| 526 |
commands \verb|\prfSTRUTlabeloptiontrue| and |
| 527 |
\verb|\prfSTRUTlabeloptionfalse|, operate on rule names and rule |
| 528 |
labels.\vspace{2ex} |
| 529 |
|
| 530 |
The rendering of bounded assumptions is modified by |
| 531 |
\verb|\prfboundedstyle|. When $\verb|\prfboundedstyle| = 0$, the |
| 532 |
format of the assumption is $[\mbox{formula}]$, which is the default |
| 533 |
behaviour; with $\verb|\prfboundedstyle| = 1$, the formula is |
| 534 |
cancelled by a horizontal line; with $\verb|\prfboundedstyle| > 1$, |
| 535 |
the custom \verb|\prfdiscargedassumption| command is invoked: |
| 536 |
\begin{displaymath} |
| 537 |
\begin{array}{c@{\qquad}c@{\qquad}c} |
| 538 |
\prfboundedassumption{A(x)} & |
| 539 |
{\prfboundedstyle=1\prfboundedassumption{A(x)}} & |
| 540 |
{\prfboundedstyle=2\prfboundedassumption{A(x)}} |
| 541 |
\end{array} |
| 542 |
\end{displaymath} |
| 543 |
|
| 544 |
The \verb|\prfdiscargedassumption| can be freely redefined. The |
| 545 |
package provides a reference implementation: |
| 546 |
\begin{verbatim} |
| 547 |
\def\prfdiscargedassumption#1{\left\langle{#1}\right\rangle} |
| 548 |
\end{verbatim}\vspace{2ex} |
| 549 |
|
| 550 |
Proof summaries are drawn according to \verb|\prfsummarystyle|. The |
| 551 |
default value is $0$, which produces a vertical dotted line. Setting |
| 552 |
$\verb|\prfsummarystyle| = 1$ produces a huge $\Pi$, while |
| 553 |
$\verb|\prfsummarystyle| = 2$ produces a $\prod$. The value $3$ uses a |
| 554 |
$\mathcal{D}$ as the derivation symbol. Values greater than $3$ force |
| 555 |
the summary to be rendered by the \verb|\prffancysummarybox| command. |
| 556 |
\begin{displaymath} |
| 557 |
\begin{array}{@{}c@{\quad}c@{\qquad}c@{\qquad}c@{}} |
| 558 |
\verb|\prfsummarystyle| = 0 & |
| 559 |
{\prfsummary{\forall x.\, x = x}} & |
| 560 |
{\prfsummary{B(x)}{A(x)}} & |
| 561 |
{\prfsummary[name]{A(y)}{D(x)}{B(x) \wedge C(x)}} \\[2ex] |
| 562 |
\verb|\prfsummarystyle| = 1 & |
| 563 |
{\prfsummarystyle1\prfsummary{\forall x.\, x = x}} & |
| 564 |
{\prfsummarystyle1\prfsummary{B(x)}{A(x)}} & |
| 565 |
{\prfsummarystyle1\prfsummary[name]{A(y)}{D(x)}{B(x) \wedge |
| 566 |
C(x)}} \\[1ex] |
| 567 |
\verb|\prfsummarystyle| = 2 & |
| 568 |
{\prfsummarystyle2\prfsummary{\forall x.\, x = x}} & |
| 569 |
{\prfsummarystyle2\prfsummary{B(x)}{A(x)}} & |
| 570 |
{\prfsummarystyle2\prfsummary[name]{A(y)}{D(x)}{B(x) \wedge |
| 571 |
C(x)}} \\[1ex] |
| 572 |
\verb|\prfsummarystyle| = 3 & |
| 573 |
{\prfsummarystyle3\prfsummary{\forall x.\, x = x}} & |
| 574 |
{\prfsummarystyle3\prfsummary{B(x)}{A(x)}} & |
| 575 |
{\prfsummarystyle3\prfsummary[name]{A(y)}{D(x)}{B(x) \wedge C(x)}} |
| 576 |
\\[1ex] |
| 577 |
\verb|\prfsummarystyle| = 4 & |
| 578 |
{\prfsummarystyle4\prfsummary{\forall x.\, x = x}} & |
| 579 |
{\prfsummarystyle4\prfsummary{B(x)}{A(x)}} & |
| 580 |
{\prfsummarystyle4\prfsummary[name]{A(y)}{D(x)}{B(x) \wedge C(x)}} |
| 581 |
\end{array} |
| 582 |
\end{displaymath} |
| 583 |
|
| 584 |
The fancy summary box is composed by the \verb|\prffancysummarybox| |
| 585 |
command. This can be modified at will. The package defines it as |
| 586 |
\begin{verbatim} |
| 587 |
\newbox\prf@@fancysummarybox\newdimen\prf@@fancysymmarylen |
| 588 |
\def\prffancysummarybox{% |
| 589 |
\sbox{\prf@@fancysummarybox}{\Huge$\bigtriangledown$}% |
| 590 |
\prf@@fancysymmarylen\ht\prf@@fancysummarybox% |
| 591 |
\advance\prf@@fancysymmarylen\dp\prf@@fancysummarybox% |
| 592 |
\sbox{\prf@@fancysummarybox}{% |
| 593 |
\raisebox{.25\prf@@fancysymmarylen}[.8\prf@@fancysymmarylen]% |
| 594 |
[0pt]{\usebox{\prf@@fancysummarybox}}}% |
| 595 |
\prf@@fancysymmarylen\wd\prf@summary@label% |
| 596 |
\ifdim\prf@@fancysymmarylen>\z@\relax% |
| 597 |
\prf@@fancysymmarylen\wd\prf@@fancysummarybox% |
| 598 |
\wd\prf@[email protected]% |
| 599 |
\hbox to\prf@@fancysymmarylen{% |
| 600 |
\usebox\prf@@fancysummarybox}\kern-.4em% |
| 601 |
\box\prf@summary@label% |
| 602 |
\else\usebox\prf@@fancysummarybox\fi} |
| 603 |
\end{verbatim}\vspace{2ex} |
| 604 |
|
| 605 |
The assumptions, conclusions, labels, and rule names are drawn using |
| 606 |
the following commands, which may be redefined: |
| 607 |
\begin{verbatim} |
| 608 |
\def\prfConclusionBox#1{% |
| 609 |
\hbox{$\displaystyle\begingroup#1\endgroup% |
| 610 |
\def\prfAssumptionBox#1{% |
| 611 |
\hbox{$\displaystyle\begingroup#1\endgroup% |
| 612 |
\ifprfSTRUToption\mathstrut\fi$}} |
| 613 |
\def\prfRuleNameBox#1{\hbox{\begingroup#1\endgroup% |
| 614 |
\ifprfSTRUTlabeloption\strut\fi}} |
| 615 |
\def\prfLabelBox#1{\hbox{\begingroup#1\endgroup% |
| 616 |
\ifprfSTRUTlabeloption\strut\fi}} |
| 617 |
\end{verbatim} |
| 618 |
It is not advisable to change these commands in a radical way, unless |
| 619 |
one understands how the graphical engine works. |
| 620 |
|
| 621 |
% ------------------------------------- |
| 622 |
\clearpage |
| 623 |
\section{Labels and References}\label{sec:references} |
| 624 |
As discharged assumptions are often hard to track in a proof, the |
| 625 |
package provides a mechanism to label them and to reference them |
| 626 |
inside a proof tree. A reference is made up of three pieces: the |
| 627 |
\emph{label}, which is the name to denote the reference inside the |
| 628 |
text, the \emph{reference value}, which is the value denoted by the |
| 629 |
label, and the \emph{anchor}, which is the graphical rendering of the |
| 630 |
value aside the labelled point of the proof. |
| 631 |
|
| 632 |
For example, |
| 633 |
\begin{displaymath} |
| 634 |
\begin{prfenv} |
| 635 |
\prftree[r]{$\supset\mathrm{I}_{\prfref<assum:A>}$} |
| 636 |
{\prftree[r]{$\supset\mathrm{I}_{\prfref<assum:not_A>}$} |
| 637 |
{\prftree[r]{$\supset$E} |
| 638 |
{\prfboundedassumption<assum:A>{A}} |
| 639 |
{\prfboundedassumption<assum:not_A>{\neg A}} |
| 640 |
{\bot}} |
| 641 |
{\neg\neg A}} |
| 642 |
{A \supset \neg\neg A} |
| 643 |
\end{prfenv} |
| 644 |
\end{displaymath} |
| 645 |
is generated by the following code |
| 646 |
\begin{verbatim} |
| 647 |
\begin{prfenv} |
| 648 |
\prftree[r]{$\supset\mathrm{I}_{\prfref<assum:A>}$} |
| 649 |
{\prftree[r]{$\supset\mathrm{I}_{\prfref<assum:not_A>}$} |
| 650 |
{\prftree[r]{$\supset$E} |
| 651 |
{\prfboundedassumption<assum:A>{A}} |
| 652 |
{\prfboundedassumption<assum:not_A>{\neg A}} |
| 653 |
{\bot}} |
| 654 |
{\neg\neg A}} |
| 655 |
{A \supset \neg\neg A} |
| 656 |
\end{prfenv} |
| 657 |
\end{verbatim} |
| 658 |
The labels are \verb|assum:A| and \verb|assum:not_A|, the reference |
| 659 |
values are $1$ and $2$, respectively, and the anchors are these values |
| 660 |
on the discharged assumptions on the top of the proof. The references |
| 661 |
to these labels are the values in the rule names.\vspace{2ex} |
| 662 |
|
| 663 |
The \verb|prfenv| environment delimits the scope of labels: the |
| 664 |
\verb|\end{prfenv}| declaration makes the labels still available |
| 665 |
for reference, but numbering of new labels will restart from |
| 666 |
$1$. Enclosing a proof tree in a \verb|prfenv| environment is not |
| 667 |
mandatory: in such case, labels will be global to the |
| 668 |
document.\vspace{2ex} |
| 669 |
|
| 670 |
Sometimes, labels require two compilation steps to be correctly |
| 671 |
generated: in fact, as \LaTeX{} labels, forward references may be |
| 672 |
undefined in the first compilation step. The package issues a warning |
| 673 |
in this case, and display a \verb|??| for the invalid reference. Also, |
| 674 |
notice how the assumption reference mechanism is analogous to \LaTeX{} |
| 675 |
labels, but it is independent from it.\vspace{2ex} |
| 676 |
|
| 677 |
A reference to a label is made by the |
| 678 |
$\verb|\prfref|\langle\mathrm{label}\rangle$ command: its argument is |
| 679 |
a label, i.e., a string of text following the same rules as the |
| 680 |
argument of the \LaTeX{} \verb|\label| command. As in the \verb|\ref| |
| 681 |
command, the resulting value has no formatting.\vspace{2ex} |
| 682 |
|
| 683 |
A labelled assumption is generated by the following commands: |
| 684 |
\begin{displaymath} |
| 685 |
\begin{array}{l} |
| 686 |
\verb|\prfassumption|\langle[\mathrm{option}]\mathrm{label}\rangle |
| 687 |
\{\mathrm{assumption}\} |
| 688 |
\\ |
| 689 |
\verb|\prfboundedassumption|\langle[\mathrm{option}] |
| 690 |
\mathrm{label}\rangle\{\mathrm{assumption}\} |
| 691 |
\end{array} |
| 692 |
\end{displaymath} |
| 693 |
The first one acts as \verb|\prfassumption| but also declares the |
| 694 |
assumption label and decorates the assumption text with the |
| 695 |
anchor. The second one does the same on bounded assumptions. |
| 696 |
|
| 697 |
The generation of labels is controlled by the option value: |
| 698 |
\begin{itemize} |
| 699 |
\item \textbf{n}, \textbf{number}, \textbf{arabic}: generates a number |
| 700 |
(default); |
| 701 |
\item \textbf{r}, \textbf{roman}: generates a lowercase roman number; |
| 702 |
\item \textbf{R}, \textbf{Roman}: generates an uppercase |
| 703 |
roman number; |
| 704 |
\item \textbf{a}, \textbf{alph}, \textbf{alpha}, \textbf{alphabetic}: |
| 705 |
produces a lowercase letter; |
| 706 |
\item \textbf{A}, \textbf{Alph}, \textbf{Alpha}, \textbf{Alphabetic}: |
| 707 |
produces an uppercase letter; |
| 708 |
\item \textbf{f}, \textbf{s}, \textbf{function}, \textbf{symbol}, |
| 709 |
\textbf{function symbol}: produces a footnote symbol, as in |
| 710 |
Section~C.8.4 of Lamport's, \textit{\LaTeX: A document preparation |
| 711 |
system}; |
| 712 |
\item \textbf{l}, \textbf{label}: tells that the label has not to be |
| 713 |
defined. This is used to generate a labelled assumption sharing the |
| 714 |
label with another one, which declares the value and the format. |
| 715 |
\end{itemize} |
| 716 |
|
| 717 |
Except for \textbf{l} and \textbf{label}, all the options are used to |
| 718 |
format the anchor following the standard \LaTeX{} way available for |
| 719 |
counters. No multiple options are allowed. |
| 720 |
|
| 721 |
For example, the disjunction elimination rule is a perfect way to |
| 722 |
illustrate the reason behind the \textbf{label} option, i.e., the need |
| 723 |
to discharge a pair of assumptions: |
| 724 |
\begin{displaymath} |
| 725 |
\begin{prfenv} |
| 726 |
\prfinterspace=1.2em |
| 727 |
\prftree[r]{$\vee\mathrm{E}_{\prfref<assum:orE>}$} |
| 728 |
{\prfsummary{\Gamma}{A \vee B}} |
| 729 |
{\prfsummary{\Gamma, |
| 730 |
\prfboundedassumption<assum:orE>{A}}{C}} |
| 731 |
{\prfsummary{\Gamma, |
| 732 |
\prfboundedassumption<[l]assum:orE>{B}}{C}}{C} |
| 733 |
\end{prfenv} |
| 734 |
\end{displaymath} |
| 735 |
\begin{verbatim} |
| 736 |
\prftree[r]{$\vee\mathrm{E}_{\prfref<assum:orE>}$} |
| 737 |
{\prfsummary{\Gamma}{A \vee B}} |
| 738 |
{\prfsummary{\Gamma, |
| 739 |
\prfboundedassumption<assum:orE>{A}}{C}} |
| 740 |
{\prfsummary{\Gamma, |
| 741 |
\prfboundedassumption<[l]assum:orE>{B}}{C}}{C} |
| 742 |
\end{verbatim} |
| 743 |
|
| 744 |
If a label is declared more than once, a warning is issued when the |
| 745 |
\textbf{label} option is not used: although this is not a mistake, it |
| 746 |
may indicate that a label is reused when it should not. |
| 747 |
|
| 748 |
The same example can be used to show how the other options work: |
| 749 |
\begin{displaymath} |
| 750 |
\renewcommand{\arraystretch}{6} |
| 751 |
\begin{array}{@{}ccc@{}} |
| 752 |
\begin{prfenv} |
| 753 |
\prfinterspace=.6em |
| 754 |
\prfsummarystyle=2 |
| 755 |
\prftree[r]{$\vee\mathrm{E}_{\prfref<assum:orEn>}$} |
| 756 |
{\prfsummary{\Gamma}{A \vee B}} |
| 757 |
{\prfsummary{\Gamma, |
| 758 |
\prfboundedassumption<[n]assum:orEn>{A}}{C}} |
| 759 |
{\prfsummary{\Gamma, |
| 760 |
\prfboundedassumption<[l]assum:orEn>{B}}{C}} |
| 761 |
{C} |
| 762 |
\end{prfenv} & |
| 763 |
\begin{prfenv} |
| 764 |
\prfinterspace=.6em |
| 765 |
\prfsummarystyle=2 |
| 766 |
\prftree[r]{$\vee\mathrm{E}_{\prfref<assum:orEr>}$} |
| 767 |
{\prfsummary{\Gamma}{A \vee B}} |
| 768 |
{\prfsummary{\Gamma, |
| 769 |
\prfboundedassumption<[r]assum:orEr>{A}}{C}} |
| 770 |
{\prfsummary{\Gamma, |
| 771 |
\prfboundedassumption<[l]assum:orEr>{B}}{C}} |
| 772 |
{C} |
| 773 |
\end{prfenv} & |
| 774 |
\begin{prfenv} |
| 775 |
\prfinterspace=.6em |
| 776 |
\prfsummarystyle=2 |
| 777 |
\prftree[r]{$\vee\mathrm{E}_{\prfref<assum:orER>}$} |
| 778 |
{\prfsummary{\Gamma}{A \vee B}} |
| 779 |
{\prfsummary{\Gamma, |
| 780 |
\prfboundedassumption<[R]assum:orER>{A}}{C}} |
| 781 |
{\prfsummary{\Gamma, |
| 782 |
\prfboundedassumption<[l]assum:orER>{B}}{C}} |
| 783 |
{C} |
| 784 |
\end{prfenv} \\ |
| 785 |
\begin{prfenv} |
| 786 |
\prfinterspace=.6em |
| 787 |
\prfsummarystyle=2 |
| 788 |
\prftree[r]{$\vee\mathrm{E}_{\prfref<assum:orEa>}$} |
| 789 |
{\prfsummary{\Gamma}{A \vee B}} |
| 790 |
{\prfsummary{\Gamma, |
| 791 |
\prfboundedassumption<[a]assum:orEa>{A}}{C}} |
| 792 |
{\prfsummary{\Gamma, |
| 793 |
\prfboundedassumption<[l]assum:orEa>{B}}{C}} |
| 794 |
{C} |
| 795 |
\end{prfenv} & |
| 796 |
\begin{prfenv} |
| 797 |
\prfinterspace=.6em |
| 798 |
\prfsummarystyle=2 |
| 799 |
\prftree[r]{$\vee\mathrm{E}_{\prfref<assum:orEA>}$} |
| 800 |
{\prfsummary{\Gamma}{A \vee B}} |
| 801 |
{\prfsummary{\Gamma, |
| 802 |
\prfboundedassumption<[A]assum:orEA>{A}}{C}} |
| 803 |
{\prfsummary{\Gamma, |
| 804 |
\prfboundedassumption<[l]assum:orEA>{B}}{C}} |
| 805 |
{C} |
| 806 |
\end{prfenv} & |
| 807 |
\begin{prfenv} |
| 808 |
\prfinterspace=.6em |
| 809 |
\prfsummarystyle=2 |
| 810 |
\prftree[r]{$\vee\mathrm{E}_{\prfref<assum:orEf>}$} |
| 811 |
{\prfsummary{\Gamma}{A \vee B}} |
| 812 |
{\prfsummary{\Gamma, |
| 813 |
\prfboundedassumption<[f]assum:orEf>{A}}{C}} |
| 814 |
{\prfsummary{\Gamma, |
| 815 |
\prfboundedassumption<[l]assum:orEf>{B}}{C}} |
| 816 |
{C} |
| 817 |
\end{prfenv} |
| 818 |
\end{array} |
| 819 |
\end{displaymath} |
| 820 |
|
| 821 |
Also, as the \verb|\prfboundedstyle| varies, the resulting proof trees |
| 822 |
are: |
| 823 |
\begin{displaymath} |
| 824 |
\begin{array}{ccc} |
| 825 |
\begin{prfenv} |
| 826 |
\prfinterspace=.6em |
| 827 |
\prfboundedstyle=0 |
| 828 |
\prfsummarystyle=4 |
| 829 |
\prftree[r]{$\vee\mathrm{E}_{\prfref<assum:AorE>}$} |
| 830 |
{\prfsummary{\Gamma}{A \vee B}} |
| 831 |
{\prfsummary{\Gamma, |
| 832 |
\prfboundedassumption<assum:AorE>{A}}{C}} |
| 833 |
{\prfsummary{\Gamma, |
| 834 |
\prfboundedassumption<[l]assum:AorE>{B}}{C}} |
| 835 |
{C} |
| 836 |
\end{prfenv} & |
| 837 |
\begin{prfenv} |
| 838 |
\prfinterspace=.6em |
| 839 |
\prfboundedstyle=1 |
| 840 |
\prfsummarystyle=4 |
| 841 |
\prftree[r]{$\vee\mathrm{E}_{\prfref<assum:BorE>}$} |
| 842 |
{\prfsummary{\Gamma}{A \vee B}} |
| 843 |
{\prfsummary{\Gamma, |
| 844 |
\prfboundedassumption<assum:BorE>{A}}{C}} |
| 845 |
{\prfsummary{\Gamma, |
| 846 |
\prfboundedassumption<[l]assum:BorE>{B}}{C}} |
| 847 |
{C} |
| 848 |
\end{prfenv} & |
| 849 |
\begin{prfenv} |
| 850 |
\prfinterspace=.6em |
| 851 |
\prfboundedstyle=2 |
| 852 |
\prfsummarystyle=4 |
| 853 |
\prftree[r]{$\vee\mathrm{E}_{\prfref<assum:CorE>}$} |
| 854 |
{\prfsummary{\Gamma}{A \vee B}} |
| 855 |
{\prfsummary{\Gamma, |
| 856 |
\prfboundedassumption<assum:CorE>{A}}{C}} |
| 857 |
{\prfsummary{\Gamma, |
| 858 |
\prfboundedassumption<[l]assum:CorE>{B}}{C}} |
| 859 |
{C} |
| 860 |
\end{prfenv} |
| 861 |
\end{array} |
| 862 |
\end{displaymath} |
| 863 |
|
| 864 |
The \verb|prfassumptioncounter| is the \LaTeX{} counter used to |
| 865 |
generate the assumption values. It contains the last used value, and |
| 866 |
initially, it is set to $0$. By modifying its value, e.g., to |
| 867 |
\verb|\setcounter{prfassumptioncounter}{1}|, |
| 868 |
\begin{displaymath} |
| 869 |
\begin{prfenv} |
| 870 |
\setcounter{prfassumptioncounter}{1} |
| 871 |
\prfsummarystyle=2 |
| 872 |
\prftree[r]{$\vee\mathrm{E}_{\prfref<assum:orEff>}$} |
| 873 |
{\prfsummary{\Gamma}{A \vee B}} |
| 874 |
{\prfsummary{\Gamma, |
| 875 |
\prfboundedassumption<[f]assum:orEff>{A}}{C}} |
| 876 |
{\prfsummary{\Gamma, |
| 877 |
\prfboundedassumption<[l]assum:orEff>{B}}{C}} |
| 878 |
{C} |
| 879 |
\end{prfenv} |
| 880 |
\end{displaymath} |
| 881 |
|
| 882 |
A labelled assumption box is graphically constructed by the package |
| 883 |
command \verb|\prflabelledassumptionbox| which can be redefined if |
| 884 |
needed. It takes two arguments: the assumption and the anchor. Its |
| 885 |
standard definition is |
| 886 |
\begin{verbatim} |
| 887 |
\def\prflabelledassumptionbox#1#2{% |
| 888 |
\setbox\prf@fancybox\hbox{${#1}$}% |
| 889 |
\prf@tmp\wd\prf@fancybox% |
| 890 |
\setbox\prf@fancybox\hbox{$\box\prf@fancybox^{#2}$}% |
| 891 |
\wd\prf@fancybox\prf@tmp% |
| 892 |
\prf@assumption{\box\prf@fancybox}} |
| 893 |
\end{verbatim} |
| 894 |
|
| 895 |
Moreover, also a labelled and bounded assumption is graphically |
| 896 |
rendered by the same command. There is just one exception: when |
| 897 |
$\verb|\prfboundedstyle| > 1$. In fact, since that style is |
| 898 |
controlled by a command that can be redefined, the same must hold for |
| 899 |
references in that style. The command which is called in this case is |
| 900 |
\verb|\prflabelleddiscargedassumption| which can be redefined if |
| 901 |
needed; its standard definition in the package is |
| 902 |
\begin{verbatim} |
| 903 |
\def\prflabelleddiscargedassumption#1#2{% |
| 904 |
\prflabelledassumptionbox{\left\langle{#1}\right\rangle}{#2}} |
| 905 |
\end{verbatim}\vspace{2ex} |
| 906 |
|
| 907 |
Also proof summaries can be labelled and referenced. The syntax |
| 908 |
extends the \verb|\prfsummary| command: |
| 909 |
\begin{displaymath} |
| 910 |
\verb|\prfsummary|\langle[\mathrm{option}]\mathrm{label}\rangle |
| 911 |
[\mathrm{name}]\{\mathrm{assumption}1\} \cdots |
| 912 |
\{\mathrm{assumption}_n\}\{\mathrm{conclusion}\} |
| 913 |
\end{displaymath} |
| 914 |
The reference argument works in the same way as the corresponding one |
| 915 |
for assumptions, and the options are the same. |
| 916 |
|
| 917 |
\begin{displaymath} |
| 918 |
\setcounter{prfsummarycounter}{0} |
| 919 |
\begin{array}{c@{\qquad}c@{\qquad}c@{\qquad}c@{\qquad}c} |
| 920 |
{\prfsummarystyle=0 |
| 921 |
\prfsummary<proof:a0>{A}{B}{A \wedge B}} & |
| 922 |
{\prfsummarystyle=1 |
| 923 |
\prfsummary<proof:a1>{A}{B}{A \wedge B}} & |
| 924 |
{\prfsummarystyle=2 |
| 925 |
\prfsummary<proof:a2>{A}{B}{A \wedge B}} & |
| 926 |
{\prfsummarystyle=3 |
| 927 |
\prfsummary<proof:a3>{A}{B}{A \wedge B}} & |
| 928 |
{\prfsummarystyle=4 |
| 929 |
\prfsummary<proof:a4>{A}{B}{A \wedge B}} |
| 930 |
\end{array} |
| 931 |
\end{displaymath} |
| 932 |
|
| 933 |
These examples have been generated by the following code snippet: |
| 934 |
\begin{verbatim} |
| 935 |
{\prfsummarystyle=X |
| 936 |
\prfsummary<proof:aX>{A}{B}{A \wedge B}} |
| 937 |
\end{verbatim} |
| 938 |
|
| 939 |
The \verb|[option]| part of the label specification is optional, and |
| 940 |
it works exactly as the option field of labelled assumptions. This is |
| 941 |
best illustrated by an example: |
| 942 |
\begin{displaymath} |
| 943 |
\setcounter{prfsummarycounter}{0} |
| 944 |
\begin{array}{cccc} |
| 945 |
{\prfsummarystyle=1 |
| 946 |
\prfsummary<[r]proof:b1>{A}{B}{A \wedge B}} & |
| 947 |
{\prfsummarystyle=1 |
| 948 |
\prfsummary<[R]proof:b2>{A}{B}{A \wedge B}} & |
| 949 |
{\prfsummarystyle=1 |
| 950 |
\prfsummary<[f]proof:b3>{A}{B}{A \wedge B}} & |
| 951 |
{\prfsummarystyle=1 |
| 952 |
\prfsummary<[a]proof:b4>{A}{B}{A \wedge B}} \\ & |
| 953 |
{\prfsummarystyle=1 |
| 954 |
\prfsummary<[A]proof:b5>{A}{B}{A \wedge B}} & |
| 955 |
{\prfsummarystyle=1 |
| 956 |
\prfsummary<[l]proof:b3>{A}{B}{A \wedge B}} & |
| 957 |
\end{array} |
| 958 |
\end{displaymath} |
| 959 |
|
| 960 |
These examples have been generated by the following code snippet: |
| 961 |
\begin{verbatim} |
| 962 |
{\prfsummarystyle=1 |
| 963 |
\prfsummary<[r]proof:bX>{A}{B}{A \wedge B}} |
| 964 |
\end{verbatim} |
| 965 |
and the last line uses the \verb|label| option.\vspace{2ex} |
| 966 |
|
| 967 |
The value of the summary labelling is controlled by the |
| 968 |
\verb|prfsummarycounter| counter, which is initially $0$ and contains |
| 969 |
the last used value. |
| 970 |
|
| 971 |
% ------------------------------------- |
| 972 |
\clearpage |
| 973 |
\section{Simplified Commands}\label{sec:simplified_commands} |
| 974 |
The basic commands illustrated so far allow to control proof trees in |
| 975 |
all aspects, but they tend to be verbose in practise. Thus, a number |
| 976 |
of abbreviations are provided to make handier the writing of proofs. |
| 977 |
Since they may collide with other packages, these macros are activated |
| 978 |
by suitable options. Multiple options can be used at the same time. |
| 979 |
|
| 980 |
\subsection{Natural deduction} |
| 981 |
By loading the package with the \verb|ND| option, the following |
| 982 |
abbreviations are available, which correspond to the inference rules |
| 983 |
of natural deduction calculi: |
| 984 |
\begin{itemize} |
| 985 |
\item \verb|\NDA|: assumption; |
| 986 |
\item \verb|\NDAL|: labelled assumption; |
| 987 |
\item \verb|\NDD|: discharged assumption; |
| 988 |
\item \verb|\NDDL|: labelled discharged assumption; |
| 989 |
\item \verb|\NDP|: generic proof tree; |
| 990 |
\item \verb|\NDAX|: a generic axiom rule; |
| 991 |
\begin{displaymath} |
| 992 |
\vcenter{\NDAX{x = x}}\enspace; |
| 993 |
\end{displaymath} |
| 994 |
\item \verb|\NDANDI|: conjunction introduction |
| 995 |
\begin{displaymath} |
| 996 |
\vcenter{\NDANDI{\NDA{A}}{\NDA{B}}{A \wedge B}}\enspace; |
| 997 |
\end{displaymath} |
| 998 |
\item \verb|\NDANDER|, \verb|\NDANDEL|, \verb|\NDANDE|: conjunction |
| 999 |
elimination right, left, and unspecified, respectively |
| 1000 |
\begin{displaymath} |
| 1001 |
\vcenter{\NDANDEL{\NDA{A \wedge B}}{\NDA{A}}} \quad |
| 1002 |
\vcenter{\NDANDER{\NDA{A \wedge B}}{\NDA{B}}}\enspace; |
| 1003 |
\end{displaymath} |
| 1004 |
\item \verb|\NDORIR|, \verb|\NDORIL|, \verb|\NDORI|: disjunction |
| 1005 |
introduction right, left, and unspecified, respectively |
| 1006 |
\begin{displaymath} |
| 1007 |
\vcenter{\NDORIL{\NDA{A}}{\NDA{A \vee B}}} \quad |
| 1008 |
\vcenter{\NDORIR{\NDA{B}}{\NDA{A \vee B}}}\enspace; |
| 1009 |
\end{displaymath} |
| 1010 |
\item \verb|\NDOREL|, \verb|\NDORE|: disjunction elimination, possibly |
| 1011 |
labelled |
| 1012 |
\begin{displaymath} |
| 1013 |
\begin{prfenv} |
| 1014 |
\vcenter{\NDOREL{ndorel:1}{\NDA{A \vee B}} |
| 1015 |
{\prfsummary{\NDDL{ndorel:1}{A}}{C}} |
| 1016 |
{\prfsummary{\NDDL{[l]ndorel:1}{B}}{C}}{C}} \quad |
| 1017 |
\vcenter{\NDORE{\NDA{A \vee B}}{\prfsummary{\NDA{A}}{C}} |
| 1018 |
{\prfsummary{\NDA{B}}{C}}{C}}\enspace; |
| 1019 |
\end{prfenv} |
| 1020 |
\end{displaymath} |
| 1021 |
\item \verb|\NDIMPIL|, \verb|\NDIMPI|: implication introduction, |
| 1022 |
possibly labelled |
| 1023 |
\begin{displaymath} |
| 1024 |
\begin{prfenv} |
| 1025 |
\vcenter{\NDIMPIL{ndimpil:1} |
| 1026 |
{\prfsummary{\NDDL{ndimpil:1}{A}}{B}} |
| 1027 |
{A \rightarrow B}} \quad |
| 1028 |
\vcenter{\NDIMPI{\prfsummary{\NDA{A}}{B}}{A \rightarrow B}} |
| 1029 |
\enspace; |
| 1030 |
\end{prfenv} |
| 1031 |
\end{displaymath} |
| 1032 |
\item \verb|\NDIMPE|: implication elimination |
| 1033 |
\begin{displaymath} |
| 1034 |
\begin{prfenv} |
| 1035 |
\vcenter{\NDIMPE{\NDA{A \rightarrow B}}{\NDA{A}}{B}}\enspace; |
| 1036 |
\end{prfenv} |
| 1037 |
\end{displaymath} |
| 1038 |
\item \verb|\NDNOTIL|, \verb|\NDNOTI|: negation introduction, possibly |
| 1039 |
labelled |
| 1040 |
\begin{displaymath} |
| 1041 |
\begin{prfenv} |
| 1042 |
\vcenter{\NDNOTIL{ndnotil:1} |
| 1043 |
{\prfsummary{\NDDL{ndnotil:1}{A}}{\bot}}{\neg A}}\quad |
| 1044 |
\vcenter{\NDNOTI{\prfsummary{\NDA{A}}{\bot}}{\neg A}}\enspace; |
| 1045 |
\end{prfenv} |
| 1046 |
\end{displaymath} |
| 1047 |
\item \verb|\NDNOTE|: negation elimination |
| 1048 |
\begin{displaymath} |
| 1049 |
\begin{prfenv} |
| 1050 |
\vcenter{\NDNOTE{\NDA{\neg A}}{\NDA{A}}{\bot}}\enspace; |
| 1051 |
\end{prfenv} |
| 1052 |
\end{displaymath} |
| 1053 |
\item \verb|\NDALLI|: universal quantifier introduction |
| 1054 |
\begin{displaymath} |
| 1055 |
\begin{prfenv} |
| 1056 |
\vcenter{\NDALLI{\NDA{A}}{\forall x.\, A}}\enspace; |
| 1057 |
\end{prfenv} |
| 1058 |
\end{displaymath} |
| 1059 |
\item \verb|\NDALLE|: universal quantifier elimination |
| 1060 |
\begin{displaymath} |
| 1061 |
\begin{prfenv} |
| 1062 |
\vcenter{\NDALLE{\NDA{\forall x.\, A}}{A[t/x]}}\enspace; |
| 1063 |
\end{prfenv} |
| 1064 |
\end{displaymath} |
| 1065 |
\item \verb|\NDEXI|: existential quantifier introduction |
| 1066 |
\begin{displaymath} |
| 1067 |
\begin{prfenv} |
| 1068 |
\vcenter{\NDEXI{\NDA{A[t/x]}}{\exists x.\, A}}\enspace; |
| 1069 |
\end{prfenv} |
| 1070 |
\end{displaymath} |
| 1071 |
\item \verb|\NDEXEL|, \verb|\NDEXE|: existential quantifier |
| 1072 |
elimination, possibly labelled |
| 1073 |
\begin{displaymath} |
| 1074 |
\begin{prfenv} |
| 1075 |
\vcenter{\NDEXEL{ndexel:1}{\NDA{\exists x.\, A}} |
| 1076 |
{\prfsummary{\NDDL{ndexel:1}{A}}{B}}{B}}\quad |
| 1077 |
\vcenter{\NDEXE{\NDA{\exists x.\, A}} |
| 1078 |
{\prfsummary{\NDA{A}}{B}}{B}}\enspace; |
| 1079 |
\end{prfenv} |
| 1080 |
\end{displaymath} |
| 1081 |
\item \verb|\NDTI|: truth introduction |
| 1082 |
\begin{displaymath} |
| 1083 |
\begin{prfenv} |
| 1084 |
\vcenter{\NDTI{\top}}\enspace; |
| 1085 |
\end{prfenv} |
| 1086 |
\end{displaymath} |
| 1087 |
\item \verb|\NDFE|: falsity elimination |
| 1088 |
\begin{displaymath} |
| 1089 |
\begin{prfenv} |
| 1090 |
\vcenter{\NDFE{\NDA{\bot}}{A}}\enspace; |
| 1091 |
\end{prfenv} |
| 1092 |
\end{displaymath} |
| 1093 |
\item \verb|\NDLEM|: law of Excluded Middle |
| 1094 |
\begin{displaymath} |
| 1095 |
\begin{prfenv} |
| 1096 |
\vcenter{\NDLEM{A \vee \neg A}}\enspace. |
| 1097 |
\end{prfenv} |
| 1098 |
\end{displaymath} |
| 1099 |
\end{itemize} |
| 1100 |
|
| 1101 |
The labels, when present, are the first argument, the rest being the |
| 1102 |
assumptions and, finally, the conclusion. The rules do not have a |
| 1103 |
fixed format, so extensions are allowed, e.g., on conjunction |
| 1104 |
elimination or disjunction introduction. |
| 1105 |
|
| 1106 |
For example, the proof |
| 1107 |
\begin{displaymath} |
| 1108 |
\begin{prfenv} |
| 1109 |
\NDOREL{simp:notA}{\NDLEM{A \vee \neg A}} |
| 1110 |
{\NDIMPI{\NDDL{[l]simp:notA}{A}}{\neg\neg A \supset A}} |
| 1111 |
{\NDIMPIL{simp:notnotA} |
| 1112 |
{\NDFE{\NDIMPE{\NDDL{simp:notnotA}{\neg\neg A}} |
| 1113 |
{\NDDL{simp:notA}{\neg A}}{\bot}}{A}} |
| 1114 |
{\neg\neg A \supset A}} |
| 1115 |
{\neg\neg A \supset A} |
| 1116 |
\end{prfenv} |
| 1117 |
\end{displaymath} |
| 1118 |
is typeset in abbreviated form by the following code |
| 1119 |
\begin{verbatim} |
| 1120 |
\NDOREL{simp:notA}{\NDLEM{A \vee \neg A}} |
| 1121 |
{\NDIMPI{\NDDL{[l]simp:notA}{A}}{\neg\neg A \supset A}} |
| 1122 |
{\NDIMPIL{simp:notnotA} |
| 1123 |
{\NDFE{\NDIMPE{\NDDL{simp:notnotA}{\neg\neg A}} |
| 1124 |
{\NDDL{simp:notA}{\neg A}}{\bot}}{A}} |
| 1125 |
{\neg\neg A \supset A}} |
| 1126 |
{\neg\neg A \supset A} |
| 1127 |
\end{verbatim}\vspace{2ex} |
| 1128 |
|
| 1129 |
\subsection{Sequents} |
| 1130 |
Similarly, by loading the package with the \verb|SEQ| option, the |
| 1131 |
following abbreviations are available, which roughly correspond to the |
| 1132 |
inference rule of sequent calculi: |
| 1133 |
\begin{itemize} |
| 1134 |
\item \verb|\SEQA|: assumption; |
| 1135 |
\item \verb|\SEQD|: bounded assumption (not normally used, but handy |
| 1136 |
to have in case of fancy calculi); |
| 1137 |
\item \verb|\SEQP|: generic proof; |
| 1138 |
\item \verb|\SEQAX|: axiom rule |
| 1139 |
\begin{displaymath} |
| 1140 |
\vcenter{\SEQAX{A \Rightarrow A}}\enspace; |
| 1141 |
\end{displaymath} |
| 1142 |
\item \verb|\SEQLF|: left falsity |
| 1143 |
\begin{displaymath} |
| 1144 |
\vcenter{\SEQLF{\bot \Rightarrow {}}}\enspace; |
| 1145 |
\end{displaymath} |
| 1146 |
\item \verb|\SEQLW|, \verb|\SEQRW|: left and right weakening |
| 1147 |
\begin{displaymath} |
| 1148 |
\vcenter{\SEQLW{\Gamma \Rightarrow \Delta}{A, \Gamma \Rightarrow |
| 1149 |
\Delta}}\quad |
| 1150 |
\vcenter{\SEQLW{\Gamma \Rightarrow \Delta}{\Gamma \Rightarrow |
| 1151 |
\Delta, A}}\enspace; |
| 1152 |
\end{displaymath} |
| 1153 |
\item \verb|\SEQLC|, \verb|\SEQRC|: left and right contraction |
| 1154 |
\begin{displaymath} |
| 1155 |
\vcenter{\SEQLC{A, A, \Gamma \Rightarrow \Delta}{A, \Gamma |
| 1156 |
\Rightarrow \Delta}}\quad |
| 1157 |
\vcenter{\SEQRC{\Gamma \Rightarrow \Delta, A, A}{\Gamma |
| 1158 |
\Rightarrow \Delta, A}}\enspace; |
| 1159 |
\end{displaymath} |
| 1160 |
\item \verb|\SEQLAND|, \verb|\SEQLANDL|, \verb|\SEQLANDR|: left |
| 1161 |
conjunction; the \verb|L| and \verb|R| variants specify which side |
| 1162 |
of the conjunction is introduced |
| 1163 |
\begin{displaymath} |
| 1164 |
\vcenter{\SEQLANDL{A, \Gamma \Rightarrow \Delta}{A \wedge B, \Gamma |
| 1165 |
\Rightarrow \Delta}}\quad |
| 1166 |
\vcenter{\SEQLANDR{B, \Gamma \Rightarrow \Delta}{A \wedge B, \Gamma |
| 1167 |
\Rightarrow \Delta}}\enspace; |
| 1168 |
\end{displaymath} |
| 1169 |
\item \verb|\SEQRAND|: right conjunction |
| 1170 |
\begin{displaymath} |
| 1171 |
\vcenter{\SEQRAND{\Gamma \Rightarrow \Delta, A}{\Gamma \Rightarrow |
| 1172 |
\Delta, B}{\Gamma \Rightarrow \Delta, A \wedge B}}\enspace; |
| 1173 |
\end{displaymath} |
| 1174 |
\item \verb|\SEQLOR|: left disjunction |
| 1175 |
\begin{displaymath} |
| 1176 |
\vcenter{\SEQLOR{A, \Gamma \Rightarrow \Delta}{B, \Gamma |
| 1177 |
\Rightarrow \Delta}{A \vee B, \Gamma \Rightarrow |
| 1178 |
\Delta}}\enspace; |
| 1179 |
\end{displaymath} |
| 1180 |
\item \verb|\SEQROR|, \verb|\SEQRORL|, \verb|\SEQRORR|: right |
| 1181 |
disjunction; the \verb|R| and \verb|L| variants specify which side |
| 1182 |
of the disjunction is introduced |
| 1183 |
\begin{displaymath} |
| 1184 |
\vcenter{\SEQRORL{\Gamma \Rightarrow \Delta, A}{\Gamma \Rightarrow |
| 1185 |
\Delta, A \vee B}}\quad |
| 1186 |
\vcenter{\SEQRORR{\Gamma \Rightarrow \Delta, B}{\Gamma \Rightarrow |
| 1187 |
\Delta, A \vee B}}\enspace; |
| 1188 |
\end{displaymath} |
| 1189 |
\item \verb|\SEQLIMP|: left implication |
| 1190 |
\begin{displaymath} |
| 1191 |
\vcenter{\SEQLIMP{\Gamma \Rightarrow \Delta, A}{B, \Gamma |
| 1192 |
\Rightarrow \Delta}{A \rightarrow B, \Gamma \Rightarrow |
| 1193 |
\Delta}}\enspace; |
| 1194 |
\end{displaymath} |
| 1195 |
\item \verb|\SEQRIMP|: right implication |
| 1196 |
\begin{displaymath} |
| 1197 |
\vcenter{\SEQRIMP{A, \Gamma \Rightarrow \Delta, B}{\Gamma |
| 1198 |
\Rightarrow, \Delta, A \rightarrow B}}\enspace; |
| 1199 |
\end{displaymath} |
| 1200 |
\item \verb|\SEQLALL|: left universal quantification |
| 1201 |
\begin{displaymath} |
| 1202 |
\vcenter{\SEQLALL{A[t/x], \Gamma \Rightarrow \Delta}{\forall x.\, |
| 1203 |
A, \Gamma \Rightarrow \Delta}}\enspace; |
| 1204 |
\end{displaymath} |
| 1205 |
\item \verb|\SEQRALL|: right universal quantification |
| 1206 |
\begin{displaymath} |
| 1207 |
\vcenter{\SEQRALL{\Gamma \Rightarrow \Delta, A}{\Gamma \Rightarrow |
| 1208 |
\Delta, \forall x.\, A}}\enspace; |
| 1209 |
\end{displaymath} |
| 1210 |
\item \verb|\SEQLEX|: left existential quantification |
| 1211 |
\begin{displaymath} |
| 1212 |
\vcenter{\SEQLEX{A, \Gamma \Rightarrow \Delta}{\exists x.\, A, |
| 1213 |
\Gamma \Rightarrow \Delta}}\enspace; |
| 1214 |
\end{displaymath} |
| 1215 |
\item \verb|\SEQREX|: right existential quantification |
| 1216 |
\begin{displaymath} |
| 1217 |
\vcenter{\SEQREX{\Gamma \Rightarrow \Delta, A[t/x]}{\Gamma |
| 1218 |
\Rightarrow \Delta, \exists x.\, A}}\enspace; |
| 1219 |
\end{displaymath} |
| 1220 |
\item \verb|\SEQCUT|: cut rule |
| 1221 |
\begin{displaymath} |
| 1222 |
\vcenter{\SEQCUT{\Gamma \Rightarrow \Delta, A}{A, \Gamma' |
| 1223 |
\Rightarrow \Delta'}{\Gamma \Gamma' \Rightarrow \Delta |
| 1224 |
\Delta'}}\enspace. |
| 1225 |
\end{displaymath} |
| 1226 |
\end{itemize} |
| 1227 |
|
| 1228 |
\subsection{Equality} |
| 1229 |
Invoking the \verb|EQ| option defines the following inference rules: |
| 1230 |
\begin{itemize} |
| 1231 |
\item \verb|\EQREFL|: reflexivity |
| 1232 |
\begin{displaymath} |
| 1233 |
\vcenter{\EQREFL{t = t}}\enspace; |
| 1234 |
\end{displaymath} |
| 1235 |
\item \verb|\EQSYM|: symmetry |
| 1236 |
\begin{displaymath} |
| 1237 |
\vcenter{\EQSYM{t = s}{s = t}}\enspace; |
| 1238 |
\end{displaymath} |
| 1239 |
\item \verb|\EQTRANS|: transitivity |
| 1240 |
\begin{displaymath} |
| 1241 |
\vcenter{\EQTRANS{t = s}{s = r}{t = r}}\enspace; |
| 1242 |
\end{displaymath} |
| 1243 |
\item \verb|\EQSUBST|: the substitution rule |
| 1244 |
\begin{displaymath} |
| 1245 |
\vcenter{\EQSUBST{t = s}{A[t/x]}{A[s/x]}}\enspace. |
| 1246 |
\end{displaymath} |
| 1247 |
\end{itemize} |
| 1248 |
|
| 1249 |
\subsection{Implication} |
| 1250 |
Since the implication symbol is usually represented either as |
| 1251 |
$\rightarrow$ or as $\supset$, the package allows to choose which |
| 1252 |
representation to use. By default, implication is $\rightarrow$, but |
| 1253 |
loading the package with the \verb|[IMP]| option switches to |
| 1254 |
$\supset$. The same effect is obtained by the commands |
| 1255 |
\verb|\prfIMPOptiontrue| (implication is $\supset$) and |
| 1256 |
\verb|prfIMPOptionfalse| (implication is $\rightarrow$). |
| 1257 |
|
| 1258 |
\subsection{Martin-L{\"o}f Type Theory and Homotopy Type Theory} |
| 1259 |
Invoking the package with the \verb|ML| option enables the support for |
| 1260 |
these type theories. This part is derived from Roberta Bonacina's PhD |
| 1261 |
dissertation, which used this package in an essential way to develop |
| 1262 |
proof trees in Homotopy Type Theory. |
| 1263 |
|
| 1264 |
Enabling the option \verb|ML| defines a number of symbols which are |
| 1265 |
useful to have. However, since they may conflict with other packages, |
| 1266 |
they can be disabled invoking the option \verb|MLnodef|. These |
| 1267 |
operators are |
| 1268 |
\begin{itemize} |
| 1269 |
\item \verb|\type|: the symbol $\type$ correctly spaced as a |
| 1270 |
mathematical binary operation; |
| 1271 |
\item \verb|\universe|: the symbol for universes; |
| 1272 |
\item \verb|\judgementaldef| and \verb|\propositionaldef|: the symbols |
| 1273 |
$\judgementaldef$ and $\propositionaldef$ spaced as mathematical |
| 1274 |
binary operations; |
| 1275 |
\item \verb|\emptytype| ($\emptytype$), \verb|\unittype| |
| 1276 |
($\unittype$), \verb|\booleantype| ($\booleantype$): these symbols |
| 1277 |
are ordinary operators typeset in mathematical boldface font; |
| 1278 |
\item \verb|\context| ($\context$), \verb|\identitytype| |
| 1279 |
($\identitytype$), \verb|\refl| ($\refl$), \verb|\axiomofchoice| |
| 1280 |
($\axiomofchoice$), \verb|\accessibility| ($\accessibility$), |
| 1281 |
\verb|\ap| ($\ap$), \verb|\apd| ($\apd$), \verb|\basepoint| |
| 1282 |
($\basepoint$), \verb|\biinv| ($\biinv$), \verb|\cardtype| |
| 1283 |
($\cardtype$), \verb|\cocone| ($\cocone$), \verb|\cons| ($\cons$), |
| 1284 |
\verb|\contr| ($\contr$), \verb|\equivtype| ($\equivtype$), |
| 1285 |
\verb|\ext| ($\ext$), \verb|\fiber| ($\fiber$), \verb|\funext| |
| 1286 |
($\funext$), \verb|\glue| ($\glue$), \verb|\happly| ($\happly$), |
| 1287 |
\verb|\hom| ($\hom$), \verb|\id| ($\id$), \verb|\idtoeqv| |
| 1288 |
($\idtoeqv$), \verb|\im| ($\im$), \verb|\idtoiso| ($\idtoiso$), |
| 1289 |
\verb|\ind| ($\ind$), \verb|\inj| ($\inj$), \verb|\inl| ($\inl$), |
| 1290 |
\verb|\inr| ($\inr$), \verb|\iscontr| ($\iscontr$), \verb|\isequiv| |
| 1291 |
($\isequiv$), \verb|\ishae| ($\ishae$), \verb|\isotoid| |
| 1292 |
($\isotoid$), \verb|\isprop| ($\isprop$), \verb|\isset| ($\isset$), |
| 1293 |
\verb|\ker| ($\ker$), \verb|\LEM| ($\LEM$), \verb|\linv| ($\linv$), |
| 1294 |
\verb|\listtype| ($\listtype$), \verb|\loopcons| ($\loopcons$), |
| 1295 |
\verb|\Map| ($\Map$), \verb|\merid| ($\merid$), \verb|\nil| |
| 1296 |
($\nil$), \verb|\ordtype| ($\ordtype$), \verb|\pair| ($\pair$), |
| 1297 |
\verb|\pred| ($\pred$), \verb|\pr| ($\pr$), \verb|\Prop| ($\Prop$), |
| 1298 |
\verb|\qinv| ($\qinv$), \verb|\rec| ($\rec$), \verb|\rinv| |
| 1299 |
($\rinv$), \verb|\seg| ($\seg$), \verb|\Set| ($\Set$), \verb|\Succ| |
| 1300 |
($\Succ$), \verb|\sup| ($\sup$), \verb|\total| ($\total$), |
| 1301 |
\verb|\transport| ($\transport$), \verb|\ua| ($\ua$), \verb|\Wtype| |
| 1302 |
($\Wtype$), \verb|\transportconst| ($\transportconst$): these |
| 1303 |
symbols are ordinary operators, typeset in the mathematical |
| 1304 |
sans-serif font; their graphical appearance is in brackets. |
| 1305 |
\end{itemize} |
| 1306 |
|
| 1307 |
The large number of inference rules is listed below: they cover the |
| 1308 |
structural part of the theories, plus most of the usual inductive |
| 1309 |
types, comprehending also some higher-order inductive types. To each |
| 1310 |
rule is associated a rule name, which is available as a command: the |
| 1311 |
convention is that the rule name is obtained appending \verb|rule| to |
| 1312 |
the name of the inference rule. In general, the command to typeset a |
| 1313 |
rule conforms to the standard name in the book \emph{Homotopy Type |
| 1314 |
Theory}. The name as typeset, is shown in brackets: |
| 1315 |
\begin{itemize} |
| 1316 |
\item \verb|\MLctxEMP| $(\scriptstyle\MLctxEMPrule)$,\\ \verb|\MLctxEXT| |
| 1317 |
$(\scriptstyle\MLctxEXTrule)$: context manipulation; |
| 1318 |
\item \verb|\MLVble| $(\scriptstyle\MLVblerule)$: variable |
| 1319 |
introduction; |
| 1320 |
\item \verb|\MLSubst| $(\scriptstyle\MLSubstrule)$, |
| 1321 |
\verb|\MLWkg| |
| 1322 |
$(\scriptstyle\MLWkgrule)$: substitution and weakening; |
| 1323 |
\item \verb|\MLEQrefl| $(\scriptstyle\MLEQreflrule)$, |
| 1324 |
\verb|\MLEQsym| $(\scriptstyle\MLEQsymrule)$, |
| 1325 |
\verb|\MLEQtrans| $(\scriptstyle\MLEQtransrule)$, \\ |
| 1326 |
\verb|\MLEQsubst| $(\scriptstyle\MLEQsubstrule)$, |
| 1327 |
\verb|\MLEQsubsteq| $(\scriptstyle\MLEQsubsteqrule)$: structural |
| 1328 |
rules about judgemental equality; |
| 1329 |
\item \verb|\MLUintro| $(\scriptstyle\MLUintrorule)$, |
| 1330 |
\verb|\MLUcumul| $(\scriptstyle\MLUcumulrule)$, |
| 1331 |
\verb|\MLUcumuleq| $(\scriptstyle\MLUcumuleqrule)$: type universe; |
| 1332 |
\item \verb|\MLpiform| $(\scriptstyle\MLpiformrule)$, |
| 1333 |
\verb|\MLpiformeq| $(\scriptstyle\MLpiformeqrule)$, \\ |
| 1334 |
\verb|\MLpiintro| $(\scriptstyle\MLpiintrorule)$, |
| 1335 |
\verb|\MLpiintroeq| $(\scriptstyle\MLpiintroeqrule)$, \\ |
| 1336 |
\verb|\MLpielim| $(\scriptstyle\MLpielimrule)$, |
| 1337 |
\verb|\MLpielimeq| $(\scriptstyle\MLpielimeqrule)$, \\ |
| 1338 |
\verb|\MLpicomp| $(\scriptstyle\MLpicomprule)$, |
| 1339 |
\verb|\MLpiuniq| $(\scriptstyle\MLpiuniqrule)$: dependent function |
| 1340 |
types; |
| 1341 |
\item \verb|\MLKintro| $(\scriptstyle\MLKintrorule)$: generic rule for |
| 1342 |
constant introduction; |
| 1343 |
\item \verb|\MLsigmaform| $(\scriptstyle\MLsigmaformrule)$, |
| 1344 |
\verb|\MLsigmaintro| $(\scriptstyle\MLsigmaintrorule)$, |
| 1345 |
\verb|\MLsigmaelim| $(\scriptstyle\MLsigmaelimrule)$, \\ |
| 1346 |
\verb|\MLsigmacomp| $(\scriptstyle\MLsigmacomprule)$, |
| 1347 |
\verb|\MLsigmauniq| $(\scriptstyle\MLsigmauniqrule)$: dependent pair |
| 1348 |
types; |
| 1349 |
\item \verb|\MLplusform| $(\scriptstyle\MLplusformrule)$, |
| 1350 |
\verb|\MLplusintrol| $(\scriptstyle\MLplusintrolrule)$, |
| 1351 |
\verb|\MLplusintror| $(\scriptstyle\MLplusintrorrule)$, \\ |
| 1352 |
\verb|\MLpluselim| $(\scriptstyle\MLpluselimrule)$, |
| 1353 |
\verb|\MLpluscompl| $(\scriptstyle\MLpluscomplrule)$, |
| 1354 |
\verb|\MLpluscompr| $(\scriptstyle\MLpluscomprrule)$, \\ |
| 1355 |
\verb|\MLplusuniq| $(\scriptstyle\MLplusuniqrule)$: coproduct types; |
| 1356 |
\item \verb|\MLzeroform| $(\scriptstyle\MLzeroformrule)$, |
| 1357 |
\verb|\MLzeroelim| $(\scriptstyle\MLzeroelimrule)$, |
| 1358 |
\verb|\MLzerouniq| $(\scriptstyle\MLzerouniqrule)$: the empty type; |
| 1359 |
\item \verb|\MLunitform| $(\scriptstyle\MLunitformrule)$, |
| 1360 |
\verb|\MLunitintro| $(\scriptstyle\MLunitintrorule)$, |
| 1361 |
\verb|\MLunitelim| $(\scriptstyle\MLunitelimrule)$, \\ |
| 1362 |
\verb|\MLunitcomp| $(\scriptstyle\MLunitcomprule)$, |
| 1363 |
\verb|\MLunituniq| $(\scriptstyle\MLunituniqrule)$: the unit type; |
| 1364 |
\item \verb|\MLnatform| $(\scriptstyle\MLnatformrule)$, |
| 1365 |
\verb|\MLnatintrozero| $(\scriptstyle\MLnatintrozerorule)$, \\ |
| 1366 |
\verb|\MLnatintrosucc| $(\scriptstyle\MLnatintrosuccrule)$, |
| 1367 |
\verb|\MLnatelim| $(\scriptstyle\MLnatelimrule)$, \\ |
| 1368 |
\verb|\MLnatcompzero| $(\scriptstyle\MLnatcompzerorule)$, |
| 1369 |
\verb|\MLnatcompsucc| $(\scriptstyle\MLnatcompsuccrule)$, \\ |
| 1370 |
\verb|\MLnatuniq| $(\scriptstyle\MLnatuniqrule)$: the natural number |
| 1371 |
type; |
| 1372 |
\item \verb|\MLidform| $(\scriptstyle\MLidformrule)$, |
| 1373 |
\verb|\MLidintro| $(\scriptstyle\MLidintrorule)$, |
| 1374 |
\verb|\MLidelim| $(\scriptstyle\MLidelimrule)$, \\ |
| 1375 |
\verb|\MLidcomp| $(\scriptstyle\MLidcomprule)$, |
| 1376 |
\verb|\MLiduniq| $(\scriptstyle\MLiduniqrule)$: identity types; |
| 1377 |
\item \verb|\MLwform| $(\scriptstyle\MLwformrule)$, |
| 1378 |
\verb|\MLwintro| $(\scriptstyle\MLwintrorule)$, |
| 1379 |
\verb|\MLwelim| $(\scriptstyle\MLwelimrule)$, \\ |
| 1380 |
\verb|\MLwcomp| $(\scriptstyle\MLwcomprule)$, |
| 1381 |
\verb|\MLwuniq| $(\scriptstyle\MLwuniqrule)$: $\mathsf{W}$ types; |
| 1382 |
\item \verb|\MLListform| $(\scriptstyle\MLListformrule)$, |
| 1383 |
\verb|\MLListintron| $(\scriptstyle\MLListintronrule)$,\\ |
| 1384 |
\verb|\MLListintroc| $(\scriptstyle\MLListintrocrule)$, |
| 1385 |
\verb|\MLListelim| $(\scriptstyle\MLListelimrule)$,\\ |
| 1386 |
\verb|\MLListcompn| $(\scriptstyle\MLListcompnrule)$, |
| 1387 |
\verb|\MLListcompc| $(\scriptstyle\MLListcompcrule)$,\\ |
| 1388 |
\verb|\MLListuniq| $(\scriptstyle\MLListuniqrule)$: |
| 1389 |
$\mathsf{List}$ types; |
| 1390 |
\item \verb|\MLfunext| $(\scriptstyle\MLfunextrule)$: function extensionality; |
| 1391 |
\item \verb|\MLuniv| $(\scriptstyle\MLunivrule)$: univalence; |
| 1392 |
\item \verb|\MLSform| $(\scriptstyle\MLSformrule)$, |
| 1393 |
\verb|\MLSintro| $(\scriptstyle\MLSintrorule)$, |
| 1394 |
\verb|\MLSelim| $(\scriptstyle\MLSelimrule)$,\\ |
| 1395 |
\verb|\MLScomp| $(\scriptstyle\MLScomprule)$, |
| 1396 |
\verb|\MLSuniq| $(\scriptstyle\MLSuniqrule)$, |
| 1397 |
\verb|\MLSpeqintro| $(\scriptstyle\MLSpeqintrorule)$,\\ |
| 1398 |
\verb|\MLSpeqcomp| $(\scriptstyle\MLSpeqcomprule)$: the |
| 1399 |
$\mathbb{S}^1$ circle type; |
| 1400 |
\item \verb|\MLIform| $(\scriptstyle\MLIformrule)$, |
| 1401 |
\verb|\MLIintroa| $(\scriptstyle\MLIintroarule)$, |
| 1402 |
\verb|\MLIintrob| $(\scriptstyle\MLIintrobrule)$, \\ |
| 1403 |
\verb|\MLIelim| $(\scriptstyle\MLIelimrule)$, |
| 1404 |
\verb|\MLIcompa| $(\scriptstyle\MLIcomparule)$, |
| 1405 |
\verb|\MLIcompb| $(\scriptstyle\MLIcompbrule)$, \\ |
| 1406 |
\verb|\MLIuniq| $(\scriptstyle\MLIuniqrule)$, |
| 1407 |
\verb|\MLIpeqintro| $(\scriptstyle\MLIpeqintrorule)$, |
| 1408 |
\verb|\MLIpeqcomp| $(\scriptstyle\MLIpeqcomprule)$: the interval |
| 1409 |
type; |
| 1410 |
\item \verb|\MLsigmaintroa| $(\scriptstyle\MLsigmaintroarule)$, |
| 1411 |
\verb|\MLsigmaintrob| $(\scriptstyle\MLsigmaintrobrule)$, \\ |
| 1412 |
\verb|\MLsigmacompa| $(\scriptstyle\MLsigmacomparule)$, |
| 1413 |
\verb|\MLsigmacompb| $(\scriptstyle\MLsigmacompbrule)$, \\ |
| 1414 |
\verb|\MLsigmapeqintro| $(\scriptstyle\MLsigmapeqintrorule)$, |
| 1415 |
\verb|\MLsigmapeqcomp| $(\scriptstyle\MLsigmapeqcomprule)$: |
| 1416 |
suspensions; |
| 1417 |
\item \verb|\MLPOform| $(\scriptstyle\MLPOformrule)$, |
| 1418 |
\verb|\MLPOintroa| $(\scriptstyle\MLPOintroarule)$, |
| 1419 |
\verb|\MLPOintrob| $(\scriptstyle\MLPOintrobrule)$, \\ |
| 1420 |
\verb|\MLPOelim| $(\scriptstyle\MLPOelimrule)$, |
| 1421 |
\verb|\MLPOcompa| $(\scriptstyle\MLPOcomparule)$, |
| 1422 |
\verb|\MLPOcompb| $(\scriptstyle\MLPOcompbrule)$, \\ |
| 1423 |
\verb|\MLPOuniq| $(\scriptstyle\MLPOuniqrule)$, |
| 1424 |
\verb|\MLPOpeqintro| $(\scriptstyle\MLPOpeqintrorule)$, |
| 1425 |
\verb|\MLPOpeqcomp| $(\scriptstyle\MLPOpeqcomprule)$: pushouts; |
| 1426 |
\item \verb|\MLTform| $(\scriptstyle\MLTformrule)$, |
| 1427 |
\verb|\MLTintro| $(\scriptstyle\MLTintrorule)$, |
| 1428 |
\verb|\MLTelim| $(\scriptstyle\MLTelimrule)$, \\ |
| 1429 |
\verb|\MLTcomp| $(\scriptstyle\MLTcomprule)$, |
| 1430 |
\verb|\MLTuniq| $(\scriptstyle\MLTuniqrule)$, |
| 1431 |
\verb|\MLTpeqintro| $(\scriptstyle\MLTpeqintrorule)$, \\ |
| 1432 |
\verb|\MLTpeqcomp| $(\scriptstyle\MLTpeqcomprule)$: truncations; |
| 1433 |
\item \verb|\MLtorusform| $(\scriptstyle\MLtorusformrule)$, |
| 1434 |
\verb|\MLtorusintro| $(\scriptstyle\MLtorusintrorule)$, |
| 1435 |
\verb|\MLtoruselim| $(\scriptstyle\MLtoruselimrule)$,\\ |
| 1436 |
\verb|\MLtoruscomp| $(\scriptstyle\MLtoruscomprule)$, |
| 1437 |
\verb|\MLtoruspeqintroa| $(\scriptstyle\MLtoruspeqintroarule)$, \\ |
| 1438 |
\verb|\MLtoruspeqintrob| $(\scriptstyle\MLtoruspeqintrobrule)$, |
| 1439 |
\verb|\MLtoruspeqintroc| $(\scriptstyle\MLtoruspeqintrocrule)$, \\ |
| 1440 |
\verb|\MLtoruspeqcompa| $(\scriptstyle\MLtoruspeqcomparule)$, |
| 1441 |
\verb|\MLtoruspeqcompb| $(\scriptstyle\MLtoruspeqcompbrule)$, \\ |
| 1442 |
\verb|\MLtoruspeqcompc| $(\scriptstyle\MLtoruspeqcompcrule)$: |
| 1443 |
the torus type. |
| 1444 |
\end{itemize} |
| 1445 |
|
| 1446 |
\subsection{Defining new inference rules} |
| 1447 |
Of course, the reader is encouraged to develop her own abbreviations |
| 1448 |
starting from the provided ones. To this aim two commands are |
| 1449 |
provided. They share the same syntax: \verb|\prfMakeInferenceRule| and |
| 1450 |
\verb|\prfMakeInferenceRuleRef| take two arguments, the first one is |
| 1451 |
the name of the command associated to the inference rule, and the |
| 1452 |
second one is used to write the rule name. For example, |
| 1453 |
\begin{center} |
| 1454 |
\verb|\prfMakeInferenceRule{NDANDI}{\mathord{\wedge}\textup{I}}| |
| 1455 |
\end{center} |
| 1456 |
is how the conjunction introduction rule is defined, and |
| 1457 |
\begin{center} |
| 1458 |
\verb| \prfMakeInferenceRuleRef{NDOREL}{\mathord{\vee}\textup{E}}| |
| 1459 |
\end{center} |
| 1460 |
is how the disjunction elimination rule is defined. The rules |
| 1461 |
generated by the \verb|Ref| variant use their first argument as the |
| 1462 |
reference to the assumption(s) they discharge. |
| 1463 |
|
| 1464 |
\subsection{Stacking proofs and assumptions} |
| 1465 |
Sometimes, a proof is too large to fit into the text width. Although |
| 1466 |
some strategies could be implemented to compress it, see the next |
| 1467 |
section, they fail in extreme cases. For example, the elimination rule |
| 1468 |
for the circle in Homotopy type theories is: |
| 1469 |
\begin{displaymath} |
| 1470 |
\MLScomp |
| 1471 |
{\Gamma, x \type \mathbb{S}^1 \vdash C \type \universe_i} |
| 1472 |
{\Gamma \vdash b \type C[\basepoint/x]} |
| 1473 |
{\Gamma \vdash \ell \type b =_{\loopcons}^{C} b} |
| 1474 |
{\Gamma \vdash p \type \mathbb{S}^1} |
| 1475 |
{\Gamma \vdash \ind_{\mathbb{S}^1}(x.\, C, b, \ell, \basepoint) |
| 1476 |
\type C[p/x]} |
| 1477 |
\end{displaymath} |
| 1478 |
typeset by |
| 1479 |
\begin{verbatim} |
| 1480 |
\MLScomp |
| 1481 |
{\Gamma, x \type \mathbb{S}^1 \vdash C \type \universe_i} |
| 1482 |
{\Gamma \vdash b \type C[\basepoint/x]} |
| 1483 |
{\Gamma \vdash \ell \type b =_{\loopcons}^{C} b} |
| 1484 |
{\Gamma \vdash p \type \mathbb{S}^1} |
| 1485 |
{\Gamma \vdash \ind_{\mathbb{S}^1}(x.\, C, b, \ell, \basepoint) |
| 1486 |
\type C[p/x]} |
| 1487 |
\end{verbatim} |
| 1488 |
It is clear that on an A5 paper, there is not enough space to write it |
| 1489 |
down. In these cases, the package provides a way to \emph{stack} the |
| 1490 |
premises of a rule, obtaining |
| 1491 |
\begin{displaymath} |
| 1492 |
\MLScomp |
| 1493 |
{\prfStackPremises |
| 1494 |
{\Gamma, x \type \mathbb{S}^1 \vdash C \type \universe_i} |
| 1495 |
{\Gamma \vdash b \type C[\basepoint/x]} } |
| 1496 |
{\prfStackPremises |
| 1497 |
{\Gamma \vdash \ell \type b =_{\loopcons}^{C} b} |
| 1498 |
{\Gamma \vdash p \type \mathbb{S}^1} } |
| 1499 |
{\Gamma \vdash \ind_{\mathbb{S}^1}(x.\, C, b, \ell, \basepoint) |
| 1500 |
\type C[p/x]} |
| 1501 |
\end{displaymath} |
| 1502 |
The corresponding \LaTeX{} code is |
| 1503 |
\begin{verbatim} |
| 1504 |
\MLScomp |
| 1505 |
{\prfStackPremises |
| 1506 |
{\Gamma, x \type \mathbb{S}^1 \vdash C \type \universe_i} |
| 1507 |
{\Gamma \vdash b \type C[\basepoint/x]} |
| 1508 |
} |
| 1509 |
{\prfStackPremises |
| 1510 |
{\Gamma \vdash \ell \type b =_{\loopcons}^{C} b} |
| 1511 |
{\Gamma \vdash p \type \mathbb{S}^1} |
| 1512 |
} |
| 1513 |
{\Gamma \vdash |
| 1514 |
\ind_{\mathbb{S}^1}(x.\, C, b, \ell, \basepoint) \type C[p/x]} |
| 1515 |
\end{verbatim} |
| 1516 |
The command |
| 1517 |
\verb|\prfStackPremises{|$a_1$\verb|}{|$\ldots$\verb|}{|$a_n$\verb|}| |
| 1518 |
takes the arguments $a_1, \ldots, a_n$ and typeset them as a proof |
| 1519 |
tree with no lines with $a_1$ on the top. |
| 1520 |
|
| 1521 |
Actually, stacking proofs is possible: |
| 1522 |
\begin{displaymath} |
| 1523 |
\MLScomp |
| 1524 |
{\prfStackPremises |
| 1525 |
{\prfsummary{\Gamma\;\context} |
| 1526 |
{\Gamma, x \type \mathbb{S}^1 \vdash \mathbb{S}^1 \type |
| 1527 |
\universe_i}} |
| 1528 |
{\prfsummary{\Gamma\;\context} |
| 1529 |
{\Gamma \vdash \basepoint \type \mathbb{S}^1}} } |
| 1530 |
{\prfStackPremises |
| 1531 |
{\prfsummary{\Gamma\;\context} |
| 1532 |
{\Gamma \vdash \ell \type \basepoint = \basepoint}} |
| 1533 |
{\prfsummary{\Gamma\;\context} |
| 1534 |
{\Gamma \vdash p \type \mathbb{S}^1}} } |
| 1535 |
{\Gamma \vdash \ind_{\mathbb{S}^1}(x.\, C, b, \ell, \basepoint) |
| 1536 |
\type C[p/x]} |
| 1537 |
\end{displaymath} |
| 1538 |
has been typeset by |
| 1539 |
\begin{verbatim} |
| 1540 |
\MLScomp |
| 1541 |
{\prfStackPremises |
| 1542 |
{\prfsummary{\Gamma\;\context} |
| 1543 |
{\Gamma, x \type \mathbb{S}^1 \vdash \mathbb{S}^1 \type |
| 1544 |
\universe_i}} |
| 1545 |
{\prfsummary{\Gamma\;\context} |
| 1546 |
{\Gamma \vdash \basepoint \type \mathbb{S}^1}} |
| 1547 |
} |
| 1548 |
{\prfStackPremises |
| 1549 |
{\prfsummary{\Gamma\;\context} |
| 1550 |
{\Gamma \vdash \ell \type \basepoint = \basepoint}} |
| 1551 |
{\prfsummary{\Gamma\;\context} |
| 1552 |
{\Gamma \vdash p \type \mathbb{S}^1}} |
| 1553 |
} |
| 1554 |
{\Gamma \vdash |
| 1555 |
\ind_{\mathbb{S}^1}(x.\, C, b, \ell, \basepoint) \type C[p/x]} |
| 1556 |
\end{verbatim} |
| 1557 |
|
| 1558 |
Since a stack is a proof tree, the parameters could be locally changed |
| 1559 |
to control its appearance. For example |
| 1560 |
\begin{displaymath} |
| 1561 |
\MLScomp |
| 1562 |
{\prfemptylinethickness20\prflinethickness |
| 1563 |
\prfStackPremises |
| 1564 |
{\Gamma, x \type \mathbb{S}^1 \vdash C \type \universe_i} |
| 1565 |
{\Gamma \vdash b \type C[\basepoint/x]} } |
| 1566 |
{\prfStackPremises |
| 1567 |
{\Gamma \vdash \ell \type b =_{\loopcons}^{C} b} |
| 1568 |
{\Gamma \vdash p \type \mathbb{S}^1} } |
| 1569 |
{\Gamma \vdash \ind_{\mathbb{S}^1}(x.\, C, b, \ell, \basepoint) |
| 1570 |
\type C[p/x]} |
| 1571 |
\end{displaymath} |
| 1572 |
makes the lines in the left stack far apart. |
| 1573 |
\begin{verbatim} |
| 1574 |
\MLScomp |
| 1575 |
{\prfemptylinethickness20\prflinethickness |
| 1576 |
\prfStackPremises |
| 1577 |
{\Gamma, x \type \mathbb{S}^1 \vdash C \type \universe_i} |
| 1578 |
{\Gamma \vdash b \type C[\basepoint/x]} } |
| 1579 |
{\prfStackPremises |
| 1580 |
{\Gamma \vdash \ell \type b =_{\loopcons}^{C} b} |
| 1581 |
{\Gamma \vdash p \type \mathbb{S}^1} } |
| 1582 |
{\Gamma \vdash \ind_{\mathbb{S}^1}(x.\, C, b, \ell, \basepoint) |
| 1583 |
\type C[p/x]} |
| 1584 |
\end{verbatim} |
| 1585 |
|
| 1586 |
Spacing in stacks of proofs is normally difficult to control: if |
| 1587 |
really sophisticated formatting is needed, it is better to consider |
| 1588 |
the following option: |
| 1589 |
\begin{displaymath} |
| 1590 |
\MLScomp |
| 1591 |
{\prfassumption{ |
| 1592 |
\begin{array}{@{}c@{\quad}c@{}} |
| 1593 |
{\prfsummary{\Gamma\;\context} |
| 1594 |
{\Gamma, x \type \mathbb{S}^1 \vdash \mathbb{S}^1 \type |
| 1595 |
\universe_i}} & |
| 1596 |
{\Gamma \vdash \ell \type \basepoint = \basepoint} \\ |
| 1597 |
{\prfsummary{\Gamma\;\context} |
| 1598 |
{\Gamma \vdash \basepoint \type \mathbb{S}^1}} & |
| 1599 |
{\Gamma \vdash p \type \mathbb{S}^1} |
| 1600 |
\end{array}}} |
| 1601 |
{\Gamma \vdash \ind_{\mathbb{S}^1}(x.\, C, b, \ell, \basepoint) |
| 1602 |
\type C[p/x]} |
| 1603 |
\end{displaymath} |
| 1604 |
which uses the \verb|array| environment |
| 1605 |
\begin{verbatim} |
| 1606 |
\MLScomp |
| 1607 |
{\prfassumption{ |
| 1608 |
\begin{array}{@{}c@{\quad}c@{}} |
| 1609 |
{\prfsummary{\Gamma\;\context} |
| 1610 |
{\Gamma, x \type \mathbb{S}^1 \vdash \mathbb{S}^1 \type |
| 1611 |
\universe_i}} & |
| 1612 |
{\Gamma \vdash \ell \type \basepoint = \basepoint} \\ |
| 1613 |
{\prfsummary{\Gamma\;\context} |
| 1614 |
{\Gamma \vdash \basepoint \type \mathbb{S}^1}} & |
| 1615 |
{\Gamma \vdash p \type \mathbb{S}^1} |
| 1616 |
\end{array}}} |
| 1617 |
{\Gamma \vdash \ind_{\mathbb{S}^1}(x.\, C, b, \ell, \basepoint) |
| 1618 |
\type C[p/x]} |
| 1619 |
\end{verbatim} |
| 1620 |
or similar ones, using the multitude of packages to format tables. By |
| 1621 |
the way, the obvious solution using stacks is |
| 1622 |
\begin{displaymath} |
| 1623 |
\MLScomp |
| 1624 |
{\prfStackPremises |
| 1625 |
{\prfsummary{\Gamma\;\context} |
| 1626 |
{\Gamma, x \type \mathbb{S}^1 \vdash \mathbb{S}^1 \type |
| 1627 |
\universe_i}} |
| 1628 |
{\prfsummary{\Gamma\;\context} |
| 1629 |
{\Gamma \vdash \basepoint \type \mathbb{S}^1}} } |
| 1630 |
{\prfStackPremises |
| 1631 |
{\prfassumption |
| 1632 |
{\Gamma \vdash \ell \type \basepoint = \basepoint}} |
| 1633 |
{\prfassumption |
| 1634 |
{\Gamma \vdash p \type \mathbb{S}^1}} } |
| 1635 |
{\Gamma \vdash \ind_{\mathbb{S}^1}(x.\, C, b, \ell, \basepoint) |
| 1636 |
\type C[p/x]} |
| 1637 |
\end{displaymath} |
| 1638 |
\begin{verbatim} |
| 1639 |
\MLScomp |
| 1640 |
{\prfStackPremises{\prfsummary{\Gamma\;\context} |
| 1641 |
{\Gamma, x \type \mathbb{S}^1 \vdash \mathbb{S}^1 \type |
| 1642 |
\universe_i}} |
| 1643 |
{\prfsummary{\Gamma\;\context} |
| 1644 |
{\Gamma \vdash \basepoint \type \mathbb{S}^1}} } |
| 1645 |
{\prfStackPremises{\prfassumption |
| 1646 |
{\Gamma \vdash \ell \type \basepoint = \basepoint}} |
| 1647 |
{\prfassumption |
| 1648 |
{\Gamma \vdash p \type \mathbb{S}^1}} } |
| 1649 |
{\Gamma \vdash \ind_{\mathbb{S}^1}(x.\, C, b, \ell, \basepoint) |
| 1650 |
\type C[p/x]} |
| 1651 |
\end{verbatim} |
| 1652 |
|
| 1653 |
%------------------------------------- |
| 1654 |
\clearpage |
| 1655 |
\section{Hints and Tricks}\label{sec:hints_and_tricks} |
| 1656 |
This section shows a few hints and tricks to use the package at its |
| 1657 |
best.\vspace{2ex} |
| 1658 |
|
| 1659 |
Consider the proof: |
| 1660 |
\begin{displaymath} |
| 1661 |
\begin{prfenv} |
| 1662 |
\NDOREL{a:notA}{\NDLEM{A \vee \neg A}} |
| 1663 |
{\NDIMPI{\NDDL{a:notA}{A}}{\neg\neg A \supset A}} |
| 1664 |
{\NDIMPIL{a:notnotA} |
| 1665 |
{\NDFE{\NDIMPE{\NDDL{a:notnotA}{\neg\neg A}} |
| 1666 |
{\NDDL{[l]a:notA}{\neg A}}{\bot}}{A}} |
| 1667 |
{\neg\neg A \supset A}} |
| 1668 |
{\neg\neg A \supset A} |
| 1669 |
\end{prfenv} |
| 1670 |
\end{displaymath} |
| 1671 |
the space between the axiom and the sub-proof of the positive case is |
| 1672 |
visually much less than the space between the positive and the |
| 1673 |
negative cases. Looking at boxes, the space is exactly the same, but |
| 1674 |
the perception is that spacing is wrong. |
| 1675 |
|
| 1676 |
We can correct this perception in two distinct ways: by adding space |
| 1677 |
between the axiom and the positive case; or, conversely, by moving the |
| 1678 |
negative case closer to the positive one. |
| 1679 |
|
| 1680 |
The first strategy yields: |
| 1681 |
\begin{displaymath} |
| 1682 |
\begin{prfenv} |
| 1683 |
\NDOREL{a:notA}{\NDLEM{A \vee \neg A}\hspace{.8em}} |
| 1684 |
{\NDIMPI{\NDDL{[l]a:notA}{A}}{\neg\neg A \supset A}} |
| 1685 |
{\NDIMPIL{a:notnotA} |
| 1686 |
{\NDFE{\NDIMPE{\NDDL{[l]a:notnotA}{\neg\neg A}} |
| 1687 |
{\NDDL{[l]a:notA}{\neg A}}{\bot}}{A}} |
| 1688 |
{\neg\neg A \supset A}} |
| 1689 |
{\neg\neg A \supset A} |
| 1690 |
\end{prfenv} |
| 1691 |
\end{displaymath} |
| 1692 |
and this effect is given by adding an appropriate \verb|\hspace| after |
| 1693 |
the axiom, as in |
| 1694 |
\begin{verbatim} |
| 1695 |
\NDOREL{a:notA}{\NDLEM{A \vee \neg A}\hspace{.4em}} |
| 1696 |
{\NDIMPI{\NDDL{[l]a:notA}{A}}{\neg\neg A \supset A}} |
| 1697 |
{\NDIMPIL{a:notnotA} |
| 1698 |
{\NDFE{\NDIMPE{\NDDL{[l]a:notnotA}{\neg\neg A}} |
| 1699 |
{\NDDL{[l]a:notA}{\neg A}}{\bot}}{A}} |
| 1700 |
{\neg\neg A \supset A}} |
| 1701 |
{\neg\neg A \supset A} |
| 1702 |
\end{verbatim} |
| 1703 |
|
| 1704 |
Adding the same space in front of the positive case is equivalent. |
| 1705 |
|
| 1706 |
The second strategy yields: |
| 1707 |
\begin{displaymath} |
| 1708 |
\begin{prfenv} |
| 1709 |
\NDOREL{a:notA}{\NDLEM{A \vee \neg A}} |
| 1710 |
{\NDIMPI{\NDDL{[l]a:notA}{A}}{\neg\neg A \supset A}} |
| 1711 |
{\hspace{-.4em}\NDIMPIL{a:notnotA} |
| 1712 |
{\NDFE{\NDIMPE{\NDDL{[l]a:notnotA}{\neg\neg A}} |
| 1713 |
{\NDDL{[l]a:notA}{\neg A}}{\bot}}{A}} |
| 1714 |
{\neg\neg A \supset A}} |
| 1715 |
{\neg\neg A \supset A} |
| 1716 |
\end{prfenv} |
| 1717 |
\end{displaymath} |
| 1718 |
Again, this is obtained by adding a negative \verb|hspace| after the |
| 1719 |
positive case, or, equivalently, before the negative one: |
| 1720 |
\begin{verbatim} |
| 1721 |
\NDOREL{a:notA}{\NDLEM{A \vee \neg A}} |
| 1722 |
{\NDIMPI{\NDDL{[l]a:notA}{A}}{\neg\neg A \supset A}} |
| 1723 |
{\hspace{-.8em}\NDIMPIL{a:notnotA} |
| 1724 |
{\NDFE{\NDIMPE{\NDDL{[l]a:notnotA}{\neg\neg A}} |
| 1725 |
{\NDDL{[l]a:notA}{\neg A}}{\bot}}{A}} |
| 1726 |
{\neg\neg A \supset A}} |
| 1727 |
{\neg\neg A \supset A} |
| 1728 |
\end{verbatim} |
| 1729 |
|
| 1730 |
In general, to make a wide proof \emph{compact}, one can appropriately |
| 1731 |
add negative spaces in front of sub-proofs so to make them closer and |
| 1732 |
letting them to overlap as boxes, but not visually, thus \emph{tiling} |
| 1733 |
the space.\vspace{2ex} |
| 1734 |
|
| 1735 |
Since proof trees are boxes, it is easy to align them on need. For |
| 1736 |
example the following proof tree, with the bounding box put in |
| 1737 |
evidence |
| 1738 |
\begin{displaymath} |
| 1739 |
\fbox{\prfsummarystyle=1 |
| 1740 |
\prfsummary{A}{B}{A \wedge B}} |
| 1741 |
\end{displaymath} |
| 1742 |
can be used wherever a box may appear. In the flow of text, it will |
| 1743 |
look like \fbox{\prfsummarystyle=1\prfsummary{A}{B}{A \wedge B}}, so |
| 1744 |
that the conclusion is aligned with the baseline. This makes easier to |
| 1745 |
align proof trees, as in |
| 1746 |
\begin{center} |
| 1747 |
\fbox{\prfsummarystyle=1 |
| 1748 |
\prfsummary{f}{g}{f \wedge g}}\qquad |
| 1749 |
\fbox{$\begin{prfenv} |
| 1750 |
\NDOREL{a:notA}{\NDLEM{A \vee \neg A}} |
| 1751 |
{\NDIMPI{\NDDL{[l]a:notA}{A}}{\neg\neg A \supset A}} |
| 1752 |
{\hspace{-.4em}\NDIMPIL{a:notnotA} |
| 1753 |
{\NDFE{\NDIMPE{\NDDL{[l]a:notnotA}{\neg\neg A}} |
| 1754 |
{\NDDL{[l]a:notA}{\neg A}}{\bot}}{A}} |
| 1755 |
{\neg\neg A \supset A}} |
| 1756 |
{\neg\neg A \supset A} |
| 1757 |
\end{prfenv}$} |
| 1758 |
\end{center} |
| 1759 |
since this is the natural way to put proofs side by side: |
| 1760 |
\begin{verbatim} |
| 1761 |
\fbox{\prfsummarystyle=1 |
| 1762 |
\prfsummary{f}{g}{f \wedge g}}\qquad |
| 1763 |
\fbox{$ |
| 1764 |
\NDOREL{a:notA}{\NDLEM{A \vee \neg A}} |
| 1765 |
{\NDIMPI{\NDDL{[l]a:notA}{A}}{\neg\neg A \supset A}} |
| 1766 |
{\hspace{-.4em}\NDIMPIL{a:notnotA} |
| 1767 |
{\NDFE{\NDIMPE{\NDDL{[l]a:notnotA}{\neg\neg A}} |
| 1768 |
{\NDDL{[l]a:notA}{\neg A}}{\bot}}{A}} |
| 1769 |
{\neg\neg A \supset A}} |
| 1770 |
{\neg\neg A \supset A}$} |
| 1771 |
\end{verbatim} |
| 1772 |
|
| 1773 |
But, if really one has to include a proof tree in the flow of text, it |
| 1774 |
is slightly better to vertically centre the box, as in |
| 1775 |
\fbox{$\vcenter{\prfsummary{A}{B}{A \wedge B}}$}. This is obtained by |
| 1776 |
\begin{verbatim} |
| 1777 |
$\vcenter{\prfsummary{A}{B}{A \wedge B}}$ |
| 1778 |
\end{verbatim} |
| 1779 |
|
| 1780 |
Of course, the result is not pleasant, because rows are far apart, |
| 1781 |
which is unavoidable because of the height of the proof tree. |
| 1782 |
|
| 1783 |
The same principle applies also to arrays of proof trees: |
| 1784 |
\begin{displaymath} |
| 1785 |
\begin{array}{lcccc} |
| 1786 |
\text{some text} & |
| 1787 |
\setcounter{prfsummarycounter}{0} |
| 1788 |
\setcounter{prfassumptioncounter}{0} |
| 1789 |
{\prfsummarystyle=1 |
| 1790 |
\prfsummary<[l]proof:b1>{A}{B}{A \wedge B}} & |
| 1791 |
{\prfsummarystyle=1 |
| 1792 |
\prfsummary<[l]proof:b2>{A}{B}{A \wedge B}} & |
| 1793 |
{\prfsummarystyle=1 |
| 1794 |
\prfsummary<[l]proof:b3>{A}{B}{A \wedge B}} & |
| 1795 |
{\prfsummarystyle=1 |
| 1796 |
\prfsummary<[l]proof:b4>{A}{B}{A \wedge B}} |
| 1797 |
\end{array} |
| 1798 |
\end{displaymath} |
| 1799 |
which has been typeset by |
| 1800 |
\begin{verbatim} |
| 1801 |
\begin{array}{lcccc} |
| 1802 |
\text{some text} & |
| 1803 |
{\prfsummarystyle=1 |
| 1804 |
\prfsummary<[l]proof:b1>{A}{B}{A \wedge B}} & |
| 1805 |
{\prfsummarystyle=1 |
| 1806 |
\prfsummary<[l]proof:b2>{A}{B}{A \wedge B}} & |
| 1807 |
{\prfsummarystyle=1 |
| 1808 |
\prfsummary<[l]proof:b3>{A}{B}{A \wedge B}} & |
| 1809 |
{\prfsummarystyle=1 |
| 1810 |
\prfsummary<[l]proof:b4>{A}{B}{A \wedge B}} |
| 1811 |
\end{array} |
| 1812 |
\end{verbatim} |
| 1813 |
vertically aligns the cells to their baselines. |
| 1814 |
|
| 1815 |
On the contrary |
| 1816 |
\begin{displaymath} |
| 1817 |
\begin{array}{lcccc} |
| 1818 |
\text{some text} & |
| 1819 |
\setcounter{prfsummarycounter}{0} |
| 1820 |
\setcounter{prfassumptioncounter}{0} |
| 1821 |
\vcenter{\prfsummarystyle=1 |
| 1822 |
\prfsummary<[l]proof:b1>{A}{B}{A \wedge B}} & |
| 1823 |
\vcenter{\prfsummarystyle=1 |
| 1824 |
\prfsummary<[l]proof:b2>{A}{B}{A \wedge B}} & |
| 1825 |
\vcenter{\prfsummarystyle=1 |
| 1826 |
\prfsummary<[l]proof:b3>{A}{B}{A \wedge B}} & |
| 1827 |
\vcenter{\prfsummarystyle=1 |
| 1828 |
\prfsummary<[l]proof:b4>{A}{B}{A \wedge B}} |
| 1829 |
\end{array} |
| 1830 |
\end{displaymath} |
| 1831 |
is much better, and it is obtained by |
| 1832 |
\begin{verbatim} |
| 1833 |
\begin{array}{lcccc} |
| 1834 |
\text{some text} & |
| 1835 |
\vcenter{\prfsummarystyle=1 |
| 1836 |
\prfsummary<[l]proof:b1>{A}{B}{A \wedge B}} & |
| 1837 |
\vcenter{\prfsummarystyle=1 |
| 1838 |
\prfsummary<[l]proof:b2>{A}{B}{A \wedge B}} & |
| 1839 |
\vcenter{\prfsummarystyle=1 |
| 1840 |
\prfsummary<[l]proof:b3>{A}{B}{A \wedge B}} & |
| 1841 |
\vcenter{\prfsummarystyle=1 |
| 1842 |
\prfsummary<[l]proof:b4>{A}{B}{A \wedge B}} |
| 1843 |
\end{array} |
| 1844 |
\end{verbatim}\vspace{2ex} |
| 1845 |
|
| 1846 |
The labelling of proof summaries is useful when a proof is very large |
| 1847 |
and there is the need to split it. The strategy is to select some |
| 1848 |
sub-proofs and to show them as summaries: instead of writing |
| 1849 |
\begin{displaymath} |
| 1850 |
\setcounter{prfsummarycounter}{0} |
| 1851 |
\setcounter{prfassumptioncounter}{0} |
| 1852 |
\NDOREL{a:notA}{\NDLEM{A \vee \neg A}} |
| 1853 |
{\NDIMPI{\NDDL{[l]a:notA}{A}}{\neg\neg A \supset A}} |
| 1854 |
{\NDIMPIL{a:notnotA} |
| 1855 |
{\NDFE{\NDIMPE{\NDDL{[l]a:notnotA}{\neg\neg A}} |
| 1856 |
{\NDDL{[l]a:notA}{\neg A}}{\bot}}{A}} |
| 1857 |
{\neg\neg A \supset A}} |
| 1858 |
{\neg\neg A \supset A} |
| 1859 |
\end{displaymath} |
| 1860 |
we may consider to define |
| 1861 |
\begin{displaymath} |
| 1862 |
\setcounter{prfsummarycounter}{0} |
| 1863 |
\setcounter{prfassumptioncounter}{0} |
| 1864 |
\mbox{Let } |
| 1865 |
\left(\vcenter{\prfsummary<[f]s:abbrev> |
| 1866 |
{\NDDL{s:notnotA}{\neg\neg A}} |
| 1867 |
{\NDAL{s:notA}{\neg A}} |
| 1868 |
{\neg\neg A \supset A}}\right) |
| 1869 |
\equiv |
| 1870 |
\left(\vcenter{\NDIMPIL{s:notnotA} |
| 1871 |
{\NDFE{\NDIMPE{\NDDL{[l]s:notnotA}{\neg\neg A}} |
| 1872 |
{\NDAL{[l]s:notA}{\neg A}}{\bot}}{A}} |
| 1873 |
{\neg\neg A \supset A}}\right) |
| 1874 |
\end{displaymath} |
| 1875 |
allowing to abbreviate the whole proof as |
| 1876 |
\begin{displaymath} |
| 1877 |
\NDOREL{s:notA}{\NDLEM{A \vee \neg A}} |
| 1878 |
{\NDIMPI{\NDDL{[l]s:notA}{A}}{\neg\neg A \supset A}} |
| 1879 |
{\hspace{-1em}\prfsummary<s:abbrev> |
| 1880 |
{\NDDL{[l]s:notnotA}{\neg\neg A}} |
| 1881 |
{\NDDL{[l]s:notA}{\neg A}} |
| 1882 |
{\neg\neg A \supset A}} |
| 1883 |
{\neg\neg A \supset A} |
| 1884 |
\end{displaymath} |
| 1885 |
|
| 1886 |
The corresponding \LaTeX{} code is |
| 1887 |
\begin{verbatim} |
| 1888 |
\setcounter{prfsummarycounter}{0} |
| 1889 |
\setcounter{prfassumptioncounter}{0} |
| 1890 |
\mbox{Let } |
| 1891 |
\left(\vcenter{\prfsummary<[f]s:abbrev> |
| 1892 |
{\NDDL{s:notnotA}{\neg\neg A}} |
| 1893 |
{\NDAL{s:notA}{\neg A}} |
| 1894 |
{\neg\neg A \supset A}}\right) |
| 1895 |
\equiv |
| 1896 |
\left(\vcenter{\NDIMPIL{s:notnotA} |
| 1897 |
{\NDFE{\NDIMPE{\NDDL{[l]s:notnotA}{\neg\neg A}} |
| 1898 |
{\NDAL{[l]s:notA}{\neg A}}{\bot}}{A}} |
| 1899 |
{\neg\neg A \supset A}}\right) |
| 1900 |
\end{verbatim} |
| 1901 |
for the definition of the proof summary, and |
| 1902 |
\begin{verbatim} |
| 1903 |
\NDOREL{s:notA}{\NDLEM{A \vee \neg A}} |
| 1904 |
{\NDIMPI{\NDDL{[l]s:notA}{A}}{\neg\neg A \supset A}} |
| 1905 |
{\hspace{-1em}\prfsummary<s:abbrev> |
| 1906 |
{\NDDL{[l]s:notnotA}{\neg\neg A}} |
| 1907 |
{\NDDL{[l]s:notA}{\neg A}} |
| 1908 |
{\neg\neg A \supset A}} |
| 1909 |
{\neg\neg A \supset A} |
| 1910 |
\end{verbatim} |
| 1911 |
for its use. |
| 1912 |
|
| 1913 |
% ------------------------------------- |
| 1914 |
\clearpage |
| 1915 |
\section{More Examples}\label{sec:examples} |
| 1916 |
This section shows a number of examples illustrating the package. See |
| 1917 |
the previous sections for the description of the features.\vspace{2ex} |
| 1918 |
|
| 1919 |
The disjunction elimination rule, with various line options: |
| 1920 |
\begin{displaymath} |
| 1921 |
\renewcommand{\arraystretch}{3.7} |
| 1922 |
\begin{array}{@{}ccc@{}} |
| 1923 |
{\prfsummarystyle=1 |
| 1924 |
\prftree{\prfsummary{\Gamma}{A \vee B}} |
| 1925 |
{\prfsummary{\Gamma, \prfboundedassumption{A}}{C}} |
| 1926 |
{\prfsummary{\Gamma, \prfboundedassumption{B}}{C}} |
| 1927 |
{C}} & |
| 1928 |
{\prfsummarystyle=1 |
| 1929 |
\prftree[r]{$\vee$E}{\prfsummary{\Gamma}{A \vee B}} |
| 1930 |
{\prfsummary{\Gamma, \prfboundedassumption{A}}{C}} |
| 1931 |
{\prfsummary{\Gamma, \prfboundedassumption{B}}{C}} |
| 1932 |
{C}} & |
| 1933 |
{\prfsummarystyle=1 |
| 1934 |
\prftree[l]{$\vee$E}{\prfsummary{\Gamma}{A \vee B}} |
| 1935 |
{\prfsummary{\Gamma, \prfboundedassumption{A}}{C}} |
| 1936 |
{\prfsummary{\Gamma, \prfboundedassumption{B}}{C}} |
| 1937 |
{C}} \\ |
| 1938 |
{\prfsummarystyle=1 |
| 1939 |
\prftree[d]{\prfsummary{\Gamma}{A \vee B}} |
| 1940 |
{\prfsummary{\Gamma, \prfboundedassumption{A}}{C}} |
| 1941 |
{\prfsummary{\Gamma, \prfboundedassumption{B}}{C}} |
| 1942 |
{C}} & |
| 1943 |
{\prfsummarystyle=1 |
| 1944 |
\prftree[r][d]{$\vee$E}{\prfsummary{\Gamma}{A \vee B}} |
| 1945 |
{\prfsummary{\Gamma, \prfboundedassumption{A}}{C}} |
| 1946 |
{\prfsummary{\Gamma, \prfboundedassumption{B}}{C}} |
| 1947 |
{C}} & |
| 1948 |
{\prfsummarystyle=1 |
| 1949 |
\prftree[l][d]{$\vee$E}{\prfsummary{\Gamma}{A \vee B}} |
| 1950 |
{\prfsummary{\Gamma, \prfboundedassumption{A}}{C}} |
| 1951 |
{\prfsummary{\Gamma, \prfboundedassumption{B}}{C}} |
| 1952 |
{C}} \\ |
| 1953 |
{\prfsummarystyle=1 |
| 1954 |
\prftree[dotted]{\prfsummary{\Gamma}{A \vee B}} |
| 1955 |
{\prfsummary{\Gamma, \prfboundedassumption{A}}{C}} |
| 1956 |
{\prfsummary{\Gamma, \prfboundedassumption{B}}{C}} |
| 1957 |
{C}} & |
| 1958 |
{\prfsummarystyle=1 |
| 1959 |
\prftree[r,dotted]{$\vee$E}{\prfsummary{\Gamma}{A \vee B}} |
| 1960 |
{\prfsummary{\Gamma, \prfboundedassumption{A}}{C}} |
| 1961 |
{\prfsummary{\Gamma, \prfboundedassumption{B}}{C}} |
| 1962 |
{C}} & |
| 1963 |
{\prfsummarystyle=1 |
| 1964 |
\prftree[l,dotted]{$\vee$E}{\prfsummary{\Gamma}{A \vee B}} |
| 1965 |
{\prfsummary{\Gamma, \prfboundedassumption{A}}{C}} |
| 1966 |
{\prfsummary{\Gamma, \prfboundedassumption{B}}{C}} |
| 1967 |
{C}} \\ |
| 1968 |
{\prfsummarystyle=1 |
| 1969 |
\prftree[d,dotted]{\prfsummary{\Gamma}{A \vee B}} |
| 1970 |
{\prfsummary{\Gamma, \prfboundedassumption{A}}{C}} |
| 1971 |
{\prfsummary{\Gamma, \prfboundedassumption{B}}{C}} |
| 1972 |
{C}} & |
| 1973 |
{\prfsummarystyle=1 |
| 1974 |
\prftree[r,d,dotted]{$\vee$E}{\prfsummary{\Gamma}{A \vee B}} |
| 1975 |
{\prfsummary{\Gamma, \prfboundedassumption{A}}{C}} |
| 1976 |
{\prfsummary{\Gamma, \prfboundedassumption{B}}{C}} |
| 1977 |
{C}} & |
| 1978 |
{\prfsummarystyle=1 |
| 1979 |
\prftree[l,d,dotted]{$\vee$E}{\prfsummary{\Gamma}{A \vee B}} |
| 1980 |
{\prfsummary{\Gamma, \prfboundedassumption{A}}{C}} |
| 1981 |
{\prfsummary{\Gamma, \prfboundedassumption{B}}{C}} |
| 1982 |
{C}} \\ |
| 1983 |
{\prfsummarystyle=1 |
| 1984 |
\prftree[dashed]{\prfsummary{\Gamma}{A \vee B}} |
| 1985 |
{\prfsummary{\Gamma, \prfboundedassumption{A}}{C}} |
| 1986 |
{\prfsummary{\Gamma, \prfboundedassumption{B}}{C}} |
| 1987 |
{C}} & |
| 1988 |
{\prfsummarystyle=1 |
| 1989 |
\prftree[r,dashed]{$\vee$E}{\prfsummary{\Gamma}{A \vee B}} |
| 1990 |
{\prfsummary{\Gamma, \prfboundedassumption{A}}{C}} |
| 1991 |
{\prfsummary{\Gamma, \prfboundedassumption{B}}{C}} |
| 1992 |
{C}} & |
| 1993 |
{\prfsummarystyle=1 |
| 1994 |
\prftree[l,dashed]{$\vee$E}{\prfsummary{\Gamma}{A \vee B}} |
| 1995 |
{\prfsummary{\Gamma, \prfboundedassumption{A}}{C}} |
| 1996 |
{\prfsummary{\Gamma, \prfboundedassumption{B}}{C}} |
| 1997 |
{C}} \\ |
| 1998 |
{\prfsummarystyle=1 |
| 1999 |
\prftree[d,dashed]{\prfsummary{\Gamma}{A \vee B}} |
| 2000 |
{\prfsummary{\Gamma, \prfboundedassumption{A}}{C}} |
| 2001 |
{\prfsummary{\Gamma, \prfboundedassumption{B}}{C}} |
| 2002 |
{C}} & |
| 2003 |
{\prfsummarystyle=1 |
| 2004 |
\prftree[d,r,dashed]{$\vee$E}{\prfsummary{\Gamma}{A \vee B}} |
| 2005 |
{\prfsummary{\Gamma, \prfboundedassumption{A}}{C}} |
| 2006 |
{\prfsummary{\Gamma, \prfboundedassumption{B}}{C}} |
| 2007 |
{C}} & |
| 2008 |
{\prfsummarystyle=1 |
| 2009 |
\prftree[d,l,dashed]{$\vee$E}{\prfsummary{\Gamma}{A \vee B}} |
| 2010 |
{\prfsummary{\Gamma, \prfboundedassumption{A}}{C}} |
| 2011 |
{\prfsummary{\Gamma, \prfboundedassumption{B}}{C}} |
| 2012 |
{C}} \\ |
| 2013 |
{\prfsummarystyle=1 |
| 2014 |
\prftree[f]{\prfsummary{\Gamma}{A \vee B}} |
| 2015 |
{\prfsummary{\Gamma, \prfboundedassumption{A}}{C}} |
| 2016 |
{\prfsummary{\Gamma, \prfboundedassumption{B}}{C}} |
| 2017 |
{C}} & |
| 2018 |
{\prfsummarystyle=1 |
| 2019 |
\prftree[r,f]{$\vee$E}{\prfsummary{\Gamma}{A \vee B}} |
| 2020 |
{\prfsummary{\Gamma, \prfboundedassumption{A}}{C}} |
| 2021 |
{\prfsummary{\Gamma, \prfboundedassumption{B}}{C}} |
| 2022 |
{C}} & |
| 2023 |
{\prfsummarystyle=1 |
| 2024 |
\prftree[l,f]{$\vee$E}{\prfsummary{\Gamma}{A \vee B}} |
| 2025 |
{\prfsummary{\Gamma, \prfboundedassumption{A}}{C}} |
| 2026 |
{\prfsummary{\Gamma, \prfboundedassumption{B}}{C}} |
| 2027 |
{C}} \\ |
| 2028 |
{\prfsummarystyle=1 |
| 2029 |
\prftree[noline]{\prfsummary{\Gamma}{A \vee B}} |
| 2030 |
{\prfsummary{\Gamma, \prfboundedassumption{A}}{C}} |
| 2031 |
{\prfsummary{\Gamma, \prfboundedassumption{B}}{C}} |
| 2032 |
{C}} & |
| 2033 |
{\prfsummarystyle=1 |
| 2034 |
\prftree[noline][r]{$\vee$E}{\prfsummary{\Gamma}{A \vee B}} |
| 2035 |
{\prfsummary{\Gamma, \prfboundedassumption{A}}{C}} |
| 2036 |
{\prfsummary{\Gamma, \prfboundedassumption{B}}{C}} |
| 2037 |
{C}} & |
| 2038 |
{\prfsummarystyle=1 |
| 2039 |
\prftree[noline][l]{$\vee$E}{\prfsummary{\Gamma}{A \vee B}} |
| 2040 |
{\prfsummary{\Gamma, \prfboundedassumption{A}}{C}} |
| 2041 |
{\prfsummary{\Gamma, \prfboundedassumption{B}}{C}} |
| 2042 |
{C}} |
| 2043 |
\end{array} |
| 2044 |
\end{displaymath} |
| 2045 |
|
| 2046 |
Proof that the Law of Excluded middle implies $\neg\neg A \supset A$: |
| 2047 |
\begin{displaymath} |
| 2048 |
\prfIMPOptiontrue |
| 2049 |
\NDORE |
| 2050 |
{\NDLEM |
| 2051 |
{A \vee \neg A}\hspace{.4em}} |
| 2052 |
{\NDIMPI |
| 2053 |
{\NDD{A}} |
| 2054 |
{\neg\neg A \supset A}} |
| 2055 |
{\NDIMPI |
| 2056 |
{\NDFE |
| 2057 |
{\NDIMPE |
| 2058 |
{\NDD{\neg\neg A}} |
| 2059 |
{\NDD{\neg A}} |
| 2060 |
{\bot}} |
| 2061 |
{A}} |
| 2062 |
{\neg\neg A \supset A}} |
| 2063 |
{\neg\neg A \supset A} |
| 2064 |
\prfIMPOptionfalse |
| 2065 |
\end{displaymath} |
| 2066 |
|
| 2067 |
Proof that the Law of Excluded middle implies $\neg\neg A \supset A$ |
| 2068 |
with labels instead of rule names, except on axioms: |
| 2069 |
\begin{displaymath} |
| 2070 |
\prftree[l]{$\scriptstyle\vee\mathrm{E}$} |
| 2071 |
{\NDLEM |
| 2072 |
{A \vee \neg A}\hspace{.6em}} |
| 2073 |
{\prftree[l]{$\scriptstyle\supset\mathrm{I}$} |
| 2074 |
{\NDD{A}} |
| 2075 |
{\neg\neg A \supset A}} |
| 2076 |
{\prftree[l]{$\scriptstyle\supset\mathrm{I}$} |
| 2077 |
{\prftree[l]{$\scriptstyle\bot\mathrm{E}$} |
| 2078 |
{\prftree[l]{$\scriptstyle\supset\mathrm{E}$} |
| 2079 |
{\NDD{\neg\neg A}} |
| 2080 |
{\NDD{\neg A}} |
| 2081 |
{\bot}} |
| 2082 |
{A}} |
| 2083 |
{\neg\neg A \supset A}} |
| 2084 |
{\neg\neg A \supset A} |
| 2085 |
\end{displaymath} |
| 2086 |
|
| 2087 |
Another simple proof in natural deduction: |
| 2088 |
\begin{displaymath} |
| 2089 |
\prftree |
| 2090 |
{\prftree |
| 2091 |
{\prftree |
| 2092 |
{\prftree |
| 2093 |
{\prftree |
| 2094 |
{\prfboundedassumption{A \rightarrow (B \rightarrow C)}} |
| 2095 |
{\prfboundedassumption{A}} |
| 2096 |
{B \rightarrow C}\hspace{2em}} |
| 2097 |
{\prftree |
| 2098 |
{\prfboundedassumption{A \rightarrow B}} |
| 2099 |
{\prfboundedassumption{A}} |
| 2100 |
{B}} |
| 2101 |
{C}} |
| 2102 |
{A \rightarrow C}} |
| 2103 |
{(A \rightarrow B) \rightarrow (A \rightarrow C)}} |
| 2104 |
{(A \rightarrow (B \rightarrow C)) \rightarrow ((A \rightarrow B) |
| 2105 |
\rightarrow (A \rightarrow C))} |
| 2106 |
\end{displaymath} |
| 2107 |
|
| 2108 |
The same proof, under the proposition-as-types interpretation: |
| 2109 |
\begin{displaymath} |
| 2110 |
\prftree |
| 2111 |
{\prftree |
| 2112 |
{\prftree |
| 2113 |
{\prftree |
| 2114 |
{\prftree |
| 2115 |
{\prfassumption{u\colon A \rightarrow (B \rightarrow C)}} |
| 2116 |
{\prfassumption{w\colon A}} |
| 2117 |
{u w\colon B \rightarrow C}\hspace{2em}} |
| 2118 |
{\prftree |
| 2119 |
{\prfassumption{v\colon A \rightarrow B}} |
| 2120 |
{\prfassumption{w\colon A}} |
| 2121 |
{v w\colon B}} |
| 2122 |
{u w(v w)\colon C}} |
| 2123 |
{\lambda w.\, u w(v w)\colon A \rightarrow C}} |
| 2124 |
{\lambda v w.\, u w(v w)\colon (A \rightarrow B) \rightarrow (A |
| 2125 |
\rightarrow C)}} |
| 2126 |
{\lambda u v w.\, u w(v w)\colon (A \rightarrow (B \rightarrow C)) |
| 2127 |
\rightarrow ((A \rightarrow B) \rightarrow (A \rightarrow C))} |
| 2128 |
\end{displaymath} |
| 2129 |
|
| 2130 |
A deduction in a sequent calculus: |
| 2131 |
\begin{displaymath} |
| 2132 |
\prfinterspace=1.2em |
| 2133 |
\prftree |
| 2134 |
{\prftree |
| 2135 |
{\prftree |
| 2136 |
{\prftree |
| 2137 |
{\prfassumption{A \Rightarrow A}} |
| 2138 |
{\prftree |
| 2139 |
{\prfassumption{A \Rightarrow A}} |
| 2140 |
{\prftree |
| 2141 |
{B \Rightarrow B} |
| 2142 |
{C \Rightarrow C} |
| 2143 |
{B, B \rightarrow C \Rightarrow C}} |
| 2144 |
{A, A \rightarrow B, B \rightarrow C \Rightarrow C}} |
| 2145 |
{A, A \rightarrow B, A \rightarrow (B \rightarrow C) |
| 2146 |
\Rightarrow C}} |
| 2147 |
{A \rightarrow B, A \rightarrow (B \rightarrow C) \Rightarrow A |
| 2148 |
\rightarrow C}} |
| 2149 |
{A \rightarrow (B \rightarrow C) \Rightarrow (A \rightarrow B) |
| 2150 |
\rightarrow (A \rightarrow C)}} |
| 2151 |
{\Rightarrow (A \rightarrow (B \rightarrow C)) \rightarrow ((A |
| 2152 |
\rightarrow B) \rightarrow (A \rightarrow C))} |
| 2153 |
\end{displaymath} |
| 2154 |
|
| 2155 |
Proof trees can be coloured, as kindly pointed out by Dominic Hughes: |
| 2156 |
\begin{displaymath} |
| 2157 |
\begin{prfenv} |
| 2158 |
\color{green}\NDIMPIL{ex6:1} |
| 2159 |
{\NDANDI |
| 2160 |
{\color{red}\NDNOTIL{ex6:2} |
| 2161 |
{\NDNOTE |
| 2162 |
{\NDDL{ex6:1}{\neg (A \vee B)}} |
| 2163 |
{\NDORIL |
| 2164 |
{\NDDL{ex6:2}{A}} |
| 2165 |
{A \vee B}} |
| 2166 |
{\bot}} |
| 2167 |
{\neg A}} |
| 2168 |
{\color{blue}\NDNOTIL{ex6:3} |
| 2169 |
{\NDNOTE |
| 2170 |
{\NDDL{[l]ex6:1}{\neg (A \vee B)}} |
| 2171 |
{\NDORIR |
| 2172 |
{\NDDL{ex6:3}{B}} |
| 2173 |
{A \vee B}} |
| 2174 |
{\bot}} |
| 2175 |
{\neg B}} |
| 2176 |
{\neg A \wedge \neg B}} |
| 2177 |
{\neg (A \vee B) \supset \neg A \wedge \neg B} |
| 2178 |
\end{prfenv} |
| 2179 |
\end{displaymath}\vspace{.2ex} |
| 2180 |
|
| 2181 |
Also. all the standard box manipulation commands can be freely applied. |
| 2182 |
The following examples are not significant for doing mathematics, but |
| 2183 |
the mechanics behind can be occasionally useful, for example, to |
| 2184 |
shrink a large proof to fit the page length: |
| 2185 |
\begin{displaymath} |
| 2186 |
\rotatebox{15}{\begin{prfenv} |
| 2187 |
\NDIMPIL{ex5:1} |
| 2188 |
{\NDANDI |
| 2189 |
{\NDNOTIL{ex5:2} |
| 2190 |
{\NDNOTE |
| 2191 |
{\NDDL{ex5:1}{\neg (A \vee B)}} |
| 2192 |
{\NDORIL |
| 2193 |
{\NDDL{ex5:2}{A}} |
| 2194 |
{A \vee B}} |
| 2195 |
{\bot}} |
| 2196 |
{\neg A}} |
| 2197 |
{\NDNOTIL{ex5:3} |
| 2198 |
{\NDNOTE |
| 2199 |
{\NDDL{[l]ex5:1}{\neg (A \vee B)}} |
| 2200 |
{\NDORIR |
| 2201 |
{\NDDL{ex5:3}{B}} |
| 2202 |
{A \vee B}} |
| 2203 |
{\bot}} |
| 2204 |
{\neg B}} |
| 2205 |
{\neg A \wedge \neg B}} |
| 2206 |
{\neg (A \vee B) \supset \neg A \wedge \neg B} |
| 2207 |
\end{prfenv}} |
| 2208 |
\end{displaymath} |
| 2209 |
\begin{displaymath} |
| 2210 |
\begin{prfenv} |
| 2211 |
\NDIMPIL{ex7:1} |
| 2212 |
{\NDANDI |
| 2213 |
{\reflectbox{\NDNOTIL{ex7:2} |
| 2214 |
{\NDNOTE |
| 2215 |
{\NDDL{ex7:1}{\neg (A \vee B)}} |
| 2216 |
{\NDORIL |
| 2217 |
{\NDDL{ex7:2}{A}} |
| 2218 |
{A \vee B}} |
| 2219 |
{\bot}} |
| 2220 |
{\neg A}}} |
| 2221 |
{\resizebox{20em}{!}{\NDNOTIL{ex7:3} |
| 2222 |
{\NDNOTE |
| 2223 |
{\NDDL{[l]ex7:1}{\neg (A \vee B)}} |
| 2224 |
{\scalebox{.7}[1]{\NDORIR |
| 2225 |
{\NDDL{ex7:3}{B}} |
| 2226 |
{A \vee B}}} |
| 2227 |
{\bot}} |
| 2228 |
{\neg B}}} |
| 2229 |
{\neg A \wedge \neg B}} |
| 2230 |
{\neg (A \vee B) \supset \neg A \wedge \neg B} |
| 2231 |
\end{prfenv} |
| 2232 |
\end{displaymath} |
| 2233 |
|
| 2234 |
% ------------------------------------- |
| 2235 |
\clearpage |
| 2236 |
\section{Fonts}\label{sec:fonts} |
| 2237 |
The package works with any font. It uses the current math fonts for |
| 2238 |
typesetting proofs, while it uses the current text font to typeset |
| 2239 |
labels and rule names. |
| 2240 |
|
| 2241 |
Care has been taken to ensure that the various dimensions and |
| 2242 |
parameters in Section~\ref{sec:parameters} are relative to the current |
| 2243 |
font, that is, technically, they are expressed with units \texttt{ex} |
| 2244 |
for vertical lengths, and \texttt{em} for horizontal lengths. Dashes |
| 2245 |
are \TeX\ rules with thickness \verb|\prflinethickness|. |
| 2246 |
|
| 2247 |
For unknown reasons, the \texttt{fontenc} package modifies slightly |
| 2248 |
the values for \texttt{ex} and \texttt{em}, thus the graphical |
| 2249 |
appearance of proof trees may vary when comparing the results obtained |
| 2250 |
by compiling with and without this package. |
| 2251 |
|
| 2252 |
In most cases, the graphical appearance of proofs is acceptable, even |
| 2253 |
changing font and size. But using fonts whose body is particularly |
| 2254 |
heavy, may result in proof lines which are too thin. In this case, the |
| 2255 |
user of the package should increment the value of |
| 2256 |
\verb|\prflinethickness|. |
| 2257 |
|
| 2258 |
The package, up to version 1.5, was designed to work with the Computer |
| 2259 |
Modern family of fonts. It worked also with other fonts, without any |
| 2260 |
major problem, but, as kindly signalled by D{\'e}mi Nollet at ENS Lyon |
| 2261 |
and universit{\'e} Paris-Diderot, dashed and dotted lines do not |
| 2262 |
behave correctly, as dashes overlap. Please, update to the latest |
| 2263 |
version of the package if you plan to use fonts different from |
| 2264 |
Computer Modern. |
| 2265 |
|
| 2266 |
% ------------------------------------- |
| 2267 |
\clearpage |
| 2268 |
\section{Internals}\label{sec:internals} |
| 2269 |
A proof tree is typeset as a \TeX{} box in horizontal mode. This means |
| 2270 |
that wherever a character can stay, so does a proof: in principle, |
| 2271 |
there is no need to put the proof in a math environment. Also, the |
| 2272 |
width of a proof is exactly the width of the box; the height of the |
| 2273 |
proof is the height of the conclusion plus the total height of all the |
| 2274 |
matter above it; the depth of the proof is the depth of the |
| 2275 |
conclusion. The proof is aligned so that the current baseline is the |
| 2276 |
baseline of the conclusion. |
| 2277 |
|
| 2278 |
For example, the proof of $g \supset \neg\neg g$ in natural deduction |
| 2279 |
is: |
| 2280 |
\begin{displaymath} |
| 2281 |
\mbox{proof} \equiv |
| 2282 |
\fbox{\prftree[r]{$\supset$I} |
| 2283 |
{\prftree[r]{$\supset$I} |
| 2284 |
{\prftree[r]{$\supset$E} |
| 2285 |
{\prfboundedassumption{g}} |
| 2286 |
{\prfboundedassumption{\neg g}} |
| 2287 |
{\bot}} |
| 2288 |
{\neg\neg g}} |
| 2289 |
{g \supset \neg\neg g}} |
| 2290 |
\end{displaymath} |
| 2291 |
The proof has been surrounded by a framebox to make evident its |
| 2292 |
bounds. Also, since the letter $g$ has a depth, the example shows how |
| 2293 |
depth in the conclusion influences the alignment of the proof with |
| 2294 |
respect to the preceding text.\vspace{2ex} |
| 2295 |
|
| 2296 |
Actually, the fundamental command in the package is \verb|\prftree|: |
| 2297 |
the commands to construct assumptions (\verb|\prfassumption| and |
| 2298 |
\verb|\prfboundedassumption|), those to generate axioms |
| 2299 |
(\verb|\prfaxiom| and \verb|\prfbyaxiom|), and \verb|\prfsummary| are |
| 2300 |
just appropriate instances.\vspace{2ex} |
| 2301 |
|
| 2302 |
The \verb|\prftree| command is composed by a parser, which takes care |
| 2303 |
of reading the various options and parameters, and by a graphical |
| 2304 |
engine, \verb|\prf@draw|, which calculates and draw the box containing |
| 2305 |
the proof tree. |
| 2306 |
|
| 2307 |
It may be useful to understand how the graphical engine works. In the |
| 2308 |
first place, each proof tree is a box with a structure: |
| 2309 |
\begin{center} |
| 2310 |
{\setlength{\unitlength}{1em} |
| 2311 |
\begin{picture}(27,6) |
| 2312 |
\put(0.8,0){\framebox(26.2,6){}} |
| 2313 |
\put(5,4){\framebox(18,1.8){$\cdots$}} |
| 2314 |
\put(5.2,4.2){\framebox(6,1.4){$\mbox{assumption}_1$}} |
| 2315 |
\put(16.8,4.2){\framebox(6,1.4){$\mbox{assumption}_n$}} |
| 2316 |
\put(7,3){\line(1,0){14}} |
| 2317 |
\put(22,2.3){\framebox(4.8,1.4){rule name}} |
| 2318 |
\put(1,2.3){\framebox(4.8,1.4){label}} |
| 2319 |
\put(8.5,0.2){\framebox(11,1.8){conclusion}} |
| 2320 |
\end{picture}} |
| 2321 |
\end{center} |
| 2322 |
|
| 2323 |
The conclusion, the proof line, and the \emph{assumption line} are |
| 2324 |
centred. The assumption line is the line whose first element is the |
| 2325 |
conclusion of the first assumption, and whose last element is the |
| 2326 |
conclusion of the last assumption, properly spaced so that all the |
| 2327 |
assumptions fit in between. The width of the proof line is calculated |
| 2328 |
as the maximum of the width of the assumption line and the conclusion, |
| 2329 |
with the rule name and the label, if present, hanging on the right and |
| 2330 |
the left, respectively. |
| 2331 |
|
| 2332 |
To calculate the assumption line, the engine keeps track of the |
| 2333 |
position of the conclusion within a proof tree, which reduces to |
| 2334 |
remember how far is the conclusion from the left margin |
| 2335 |
(\verb|Lassum|), and how far it is from the right margin |
| 2336 |
(\verb|Rassum|). So, the assumption line starts from the value of |
| 2337 |
\verb|Lassum| of the first assumption, and finishes at \verb|Rassum| |
| 2338 |
of the last assumption. |
| 2339 |
|
| 2340 |
Thus, with these values it is not difficult to figure out the |
| 2341 |
mathematics to place the various boxes around, so to combine them into |
| 2342 |
a proof tree. This is exactly what the graphical engine does. |
| 2343 |
|
| 2344 |
Unfortunately, when one writes assumptions as simple formulae, without |
| 2345 |
the \verb|\prfassumption| command, the corresponding \verb|Lassum| and |
| 2346 |
\verb|Rassum| are not set to $0$, which is the right value. In fact, |
| 2347 |
the recursive expansion of the \verb|\prf@draw| macro follows the |
| 2348 |
\emph{natural} order in the construction of the proof box, which is |
| 2349 |
extremely useful because it allows to locally modify parameters in |
| 2350 |
sub-proofs; but this order conflicts with proper rendering of |
| 2351 |
assumptions which are not proof trees. |
| 2352 |
|
| 2353 |
Also, the hints on how to put space between assumptions, see |
| 2354 |
Section~\ref{sec:hints_and_tricks}, may have strange effects: if space |
| 2355 |
is added in front of the first assumption or behind the last one, this |
| 2356 |
space makes invalid the values of \verb|Lassum| and \verb|Rassum|, |
| 2357 |
respectively, yielding hard to predict results. |
| 2358 |
|
| 2359 |
It is worth remarking that the mathematics of the graphical engine is |
| 2360 |
sound, which means that zero or negative values for the various |
| 2361 |
dimensions specified as parameters, or using \emph{bizarre} boxes in |
| 2362 |
the fancy commands, yields the expected results, as far as boxes do |
| 2363 |
not have parts which extends beyond the bounds.\vspace{2ex} |
| 2364 |
|
| 2365 |
The implementation of references mimics the implementation of |
| 2366 |
\verb|\label| and \verb|\ref| in \LaTeX. Whenever a reference is |
| 2367 |
defined, through a command with the $\langle \mathrm{label}\rangle$ as |
| 2368 |
the first argument, the reference value is created according to the |
| 2369 |
options, and it gets stored in the \texttt{.aux} file, by writing |
| 2370 |
$\verb|\prfauxvalue|\{\mathrm{label}\}\{\mathrm{value}\}$ in the |
| 2371 |
file. Then, when the source code will be recompiled, and the |
| 2372 |
\texttt{.aux} file read, this command will be executed before any |
| 2373 |
occurrence of a reference, which can be resolved. |
| 2374 |
|
| 2375 |
Most difficulties in the implementation of references lie in the way |
| 2376 |
to construct the boxes to be used in the proof tree. But, the tricky |
| 2377 |
part is the interaction with the \LaTeX{} and \TeX{} kernel for error |
| 2378 |
reporting. A small hack has been introduced to force recompilation |
| 2379 |
when the references in a proof change. |
| 2380 |
|
| 2381 |
% ------------------------------------- |
| 2382 |
\clearpage |
| 2383 |
\section{Future Features and Bugs}\label{sec:future_features} |
| 2384 |
Essentially, all the features of Buss's package have been implemented |
| 2385 |
but one: alignment of proofs according to the $\vdash$ (or equivalent) |
| 2386 |
sign. While this feature is occasionally useful in the writing of |
| 2387 |
sequent proofs, it requires some trickery in the graphical engine, so |
| 2388 |
it has been postponed for the moment.\vspace{2ex} |
| 2389 |
|
| 2390 |
Moreover, automatic compact proofs have been analysed, but not |
| 2391 |
implemented. A compact proof minimises the amount of space between |
| 2392 |
subsequent assumptions, eventually making the upper trees to overlap |
| 2393 |
as boxes, but not as typed text. |
| 2394 |
|
| 2395 |
The algorithm to obtain this result is not immediate: one should keep |
| 2396 |
track of the left and right \emph{skylines} of a proof. Comparing the |
| 2397 |
left skyline of an assumption with the right skyline of the next one, |
| 2398 |
one can calculate what is the distance between the boxes so that the |
| 2399 |
distance between the closest points in the skylines is exactly |
| 2400 |
\verb|\prfinterspace|. |
| 2401 |
|
| 2402 |
It is not simple to code such an algorithm in \TeX{}, but the real |
| 2403 |
difficulty is how to represent skylines and how to store them, since |
| 2404 |
\TeX{} provides no abstract data structures. Hence, the implementation |
| 2405 |
of this feature has been postponed to a remote future, or to the will |
| 2406 |
of a real \TeX{} magician.\vspace{2ex} |
| 2407 |
|
| 2408 |
The abbreviated commands reflect their use by the author. It is quite |
| 2409 |
possible that you want to define your own commands for inference rules |
| 2410 |
of your interest. If you think they could be of general interest, send |
| 2411 |
them by email to the author (see below) who will include them in a |
| 2412 |
future release of the package, acknowledging your contribution. |
| 2413 |
\vfill |
| 2414 |
|
| 2415 |
Although the package has been tested for a long time by now, it is |
| 2416 |
possible that a few bugs are still present. To signal a bug, please, |
| 2417 |
write an email to the author (see below), possibly attaching a sample |
| 2418 |
document which exhibit the misbehaviour, to help tracking and fixing. |
| 2419 |
\vfill |
| 2420 |
\end{document} |
| 2421 |
|
| 2422 |
%%% Local Variables: |
| 2423 |
%%% mode: latex |
| 2424 |
%%% TeX-master: t |
| 2425 |
%%% End: |