| 1 |
%% fitchdoc.tex |
| 2 |
%% Macros for Fitch-style natural deduction (documentation) |
| 3 |
%% Copyright 2002-2023 Peter Selinger |
| 4 |
% |
| 5 |
% This work may be distributed and/or modified under the |
| 6 |
% conditions of the LaTeX Project Public License, either version 1.3 |
| 7 |
% of this license or (at your option) any later version. |
| 8 |
% The latest version of this license is in |
| 9 |
% https://www.latex-project.org/lppl.txt |
| 10 |
% and version 1.3c or later is part of all distributions of LaTeX |
| 11 |
% version 2008 or later. |
| 12 |
% |
| 13 |
% This work has the LPPL maintenance status `maintained'. |
| 14 |
% |
| 15 |
% The Current Maintainer of this work is Richard Zach <[email protected]> |
| 16 |
% |
| 17 |
% This work consists of the files fitch.sty and fitchdoc.tex. |
| 18 |
|
| 19 |
% Original Author: Peter Selinger, Dalhousie University |
| 20 |
% Created: Jan 14, 2002 |
| 21 |
% Modified: Dec 17, 2023 |
| 22 |
% Version: 1.0 |
| 23 |
% Copyright: (C) 2002-2023 Peter Selinger, Richard Zach |
| 24 |
% Filename: fitch.sty |
| 25 |
% Documentation: fitchdoc.tex |
| 26 |
% https://github.com/OpenLogicProject/fitch/ |
| 27 |
|
| 28 |
\documentclass{ltxdoc} |
| 29 |
|
| 30 |
\usepackage{fitch,graphicx,showexpl} |
| 31 |
|
| 32 |
\lstset{% |
| 33 |
basicstyle=\ttfamily\small, |
| 34 |
commentstyle=\itshape\ttfamily\small, |
| 35 |
showspaces=false, |
| 36 |
showstringspaces=false, |
| 37 |
breaklines=true, |
| 38 |
breakautoindent=true, |
| 39 |
captionpos=t |
| 40 |
} |
| 41 |
|
| 42 |
\addtolength{\oddsidemargin}{-1cm} |
| 43 |
\addtolength{\textwidth}{2cm} |
| 44 |
|
| 45 |
\newcommand\NewIn[1]{\leavevmode |
| 46 |
\marginpar{\hfill\fbox{\fbox{New in #1}}\hspace*{1em}}\ignorespaces} |
| 47 |
|
| 48 |
\title{\texttt{fitch.sty}: Fitch-style natural deduction macros} |
| 49 |
|
| 50 |
\author{Peter Selinger\\Dalhousie University \and Richard |
| 51 |
Zach\\University of Calgary\thanks{The current maintainer of this |
| 52 |
package is \href{https://richardzach.org}{Richard Zach}. The package |
| 53 |
repository is at \url{https://github.com/OpenLogicProject/fitch/}, |
| 54 |
where you can also report any |
| 55 |
\href{https://github.com/OpenLogicProject/fitch/issues}{issues} with |
| 56 |
it.}} |
| 57 |
|
| 58 |
\date{Version 1.0\\ December 17, 2023} |
| 59 |
|
| 60 |
\begin{document} |
| 61 |
\maketitle |
| 62 |
|
| 63 |
\section{Overview} |
| 64 |
|
| 65 |
This document describes how to use the {\tt fitch.sty} macros for |
| 66 |
typesetting Fitch-style natural deduction derivations. To load the |
| 67 |
macros, simply put |\usepackage{fitch}| into the preamble of your |
| 68 |
{\LaTeX} file. |
| 69 |
|
| 70 |
Here is a natural deduction derivation, together with the code that |
| 71 |
produced it: |
| 72 |
|
| 73 |
\begin{LTXexample} |
| 74 |
$\begin{nd} |
| 75 |
\hypo {1} {P\vee Q} |
| 76 |
\hypo {2} {\neg Q} |
| 77 |
\open |
| 78 |
\hypo {3} {P} |
| 79 |
\have {4} {P} \r{3} |
| 80 |
\close |
| 81 |
\open |
| 82 |
\hypo {aa} {Q} |
| 83 |
\have {6} {\neg Q} \r{2} |
| 84 |
\have {7} {\bot} \ne{aa,6} |
| 85 |
\have {8} {P} \be{7} |
| 86 |
\close |
| 87 |
\have {9} {P} \oe{1,3-4,aa-8} |
| 88 |
\end{nd}$ |
| 89 |
\end{LTXexample} |
| 90 |
|
| 91 |
A derivation consists of \emph{lines}, and each line contains a {\em |
| 92 |
line label} and a \emph{formula}. Some lines also carry a {\em |
| 93 |
justification}. Moreover, each line is either a \emph{hypothesis} or a |
| 94 |
\emph{derived formula}. Usually, derived formulas carry a |
| 95 |
justification, whereas hypotheses do not; however, the macros do not |
| 96 |
enforce this. |
| 97 |
|
| 98 |
Proofs set using |fitch.sty| will have lines numbered automatically in |
| 99 |
the output. It is possible to override the automatic numbering (see |
| 100 |
Section~\ref{subsec-customline}). You can refer to line numbers in the |
| 101 |
text using |\ndref| (see Section~\ref{subsec-ndref}). Various |
| 102 |
dimensions, formatting of justifications and line references, and the |
| 103 |
shorthand macros used to produce rule names can be customized (see |
| 104 |
Section~\ref{sec-customization}). |
| 105 |
|
| 106 |
\NewIn{1.0} Several new commands and customization options have been |
| 107 |
introduced in v1.0. It is mostly backwards compatible with earlier |
| 108 |
versions, but see section~\ref{compat}. In particular, if you |
| 109 |
redefined any internal |fitch| commands, you will have to change |nd*| |
| 110 |
to |nd@|. |
| 111 |
|
| 112 |
\section{Usage}\label{sec-usage} |
| 113 |
|
| 114 |
\DescribeEnv{nd}\DescribeEnv{nd} Derivations are typeset |
| 115 |
inside the |nd| environment. By default, the standard |array| |
| 116 |
environment is used to do this, so the |nd| environment must must be |
| 117 |
used in math mode, i.e., it should be surrounded by |$...$| or |
| 118 |
|\[...\]|. |
| 119 |
|
| 120 |
\NewIn{1.0} The environment |fitchproof| typesets the proof on its own |
| 121 |
in text, not math mode. Proofs will be set flush left, with the |
| 122 |
default |\partopsep| spacing surrounding lists added. You do not have |
| 123 |
to insert |$| to switch to math mode for |fitchproof|---by default. |
| 124 |
However, it only works if you generate proofs using the |tabular| |
| 125 |
environment, e.g., by loading |fitch| with the |arrayenv=tabular| |
| 126 |
option. |
| 127 |
|
| 128 |
\DescribeMacro{\hypo}\DescribeMacro{\have} |
| 129 |
The commands |\hypo| and |\have| are used |
| 130 |
to typeset one line of the derivation; |\hypo| is used for |
| 131 |
hypotheses, and |\have| for derived formulas. Both commands take |
| 132 |
a label and a formula as an argument. Note that the labels used to |
| 133 |
identify lines in the derivation need not be actual line numbers; for |
| 134 |
instance, in the above example, we used the label $aa$ instead of $5$. |
| 135 |
In the output, lines are automatically numbered consecutively. Labels |
| 136 |
may not contain any punctuation characters or spaces. |
| 137 |
|
| 138 |
\DescribeMacro{\open}\DescribeMacro{\close} |
| 139 |
Subderivations are opened and closed with the commands |\open| and |
| 140 |
|\close|. Finally, the following commands are provided for |
| 141 |
annotating lines with justifications: |
| 142 |
\begin{center} |
| 143 |
\begin{tabular}[t]{@{}ll@{}} |
| 144 |
|\r| & reiteration \\ |
| 145 |
|\ii| & implication introduction \\ |
| 146 |
|\ie| & implication elimination \\ |
| 147 |
|\ai| & and introduction \\ |
| 148 |
|\ae| & and elimination \\ |
| 149 |
|\oi| & or introduction \\ |
| 150 |
|\oe| & or elimination |
| 151 |
\end{tabular} |
| 152 |
\qquad |
| 153 |
\begin{tabular}[t]{ll} |
| 154 |
|\ni| & not introduction \\ |
| 155 |
|\ne| & not elimination \\ |
| 156 |
|\be| & bottom elimination \\ |
| 157 |
|\nne| & double negation elimination \\ |
| 158 |
|\Ai| & forall introduction \\ |
| 159 |
|\Ae| & forall elimination \\ |
| 160 |
|\Ei| & exists introduction \\ |
| 161 |
|\Ee| & exists elimination \\ |
| 162 |
\end{tabular} |
| 163 |
\end{center} |
| 164 |
\NewIn{1.0} These commands and what they produce can be customized, |
| 165 |
see Section~\ref{sec-customization}. |
| 166 |
|
| 167 |
Each such command takes a \emph{reference list} as an argument. A |
| 168 |
reference list is a string made from labels, commas, and hyphens, for |
| 169 |
instance |1,3a-3b,4a-4d|. |
| 170 |
|
| 171 |
\section{Details} |
| 172 |
|
| 173 |
\subsection{Guards} |
| 174 |
|
| 175 |
Some natural deduction derivations with quantifiers use \emph{guards}, as in |
| 176 |
the following example: |
| 177 |
|
| 178 |
\begin{LTXexample} |
| 179 |
$ |
| 180 |
\begin{nd} |
| 181 |
\hypo {1} {\exists x\forall y.P(x,y)} |
| 182 |
\open[v] |
| 183 |
\open[u] |
| 184 |
\hypo {2} {\forall y.P(u,y)} |
| 185 |
\have {3} {P(u,v)} \Ae{2} |
| 186 |
\have {4} {\exists x.P(x,v)} \Ei{3} |
| 187 |
\close |
| 188 |
\have {5} {\exists x.P(x,v)} \Ee{1,2-5} |
| 189 |
\close |
| 190 |
\have {6} {\forall y\exists x.P(x,y)} \Ai{2-5} |
| 191 |
\end{nd} |
| 192 |
$ |
| 193 |
\end{LTXexample} |
| 194 |
|
| 195 |
The guards $v$ and $u$ in line 2 were typeset by giving optional |
| 196 |
arguments to the |\open| commands of the respective |
| 197 |
subderivations. |
| 198 |
|
| 199 |
\DescribeMacro{\guard} |
| 200 |
For most purposes, the above way of specifying guards is sufficient. |
| 201 |
However, there is another method, which allows a more flexible |
| 202 |
placement of guards: before any line, you can give the command |
| 203 |
|\guard{u}| to add a guard $u$ to the top-level subderivation at |
| 204 |
that line, or |\guard[n]{u}| to add a guard to the $n$th |
| 205 |
enclosing subderivation at that line. Thus, the above example could |
| 206 |
have also been typeset by inserting the two commands |\guard{u}| and |
| 207 |
|\guard[2]{v}| just after the second |\open| statement. |
| 208 |
|
| 209 |
% For backward compatibility, there is a third way of specifying guards |
| 210 |
% by giving an optional second argument to the |\hypo| and |
| 211 |
% |\have| commands. The use of this feature is discouraged. |
| 212 |
|
| 213 |
\subsection{Label and reference list details}\label{subsec-ndref} |
| 214 |
|
| 215 |
Labels for lines given to the |\have| and |\hypo| commands need not be |
| 216 |
numeric, although the package will \emph{output} them as consecutive |
| 217 |
numbers (see Section~\ref{subsec-customline} for how to adjust the |
| 218 |
numbering). Labels, however, may not contain commas, periods, |
| 219 |
semicolons, hyphens, parentheses, or spaces. In a reference list, |
| 220 |
spaces are ignored (even within a label!), whereas commas, periods, |
| 221 |
semicolons, parentheses, and hyphens are copied to the output. All |
| 222 |
other characters are interpreted as part of a label. Attempting to |
| 223 |
reference a label which has not been previously defined by any |\hypo| |
| 224 |
or |\have| command produces a \NewIn{0.6} warning message of the form: |
| 225 |
\begin{verbatim} |
| 226 |
! Package fitch Warning: Undefined line reference: lab17. |
| 227 |
\end{verbatim} |
| 228 |
(In earlier versions, this resulted in an error, not a warning.) |
| 229 |
|
| 230 |
\DescribeMacro{\ndref} |
| 231 |
Labels defined in an |nd| environment can be referenced in the |
| 232 |
text with the |\ndref| command. This command takes a reference |
| 233 |
list as an argument, and produces the corresponding output. However, |
| 234 |
it is only possible to reference labels \emph{after} the corresponding |
| 235 |
derivation has been typeset. There is currently no convenient way of |
| 236 |
defining forward references. Also, if a label is used more than once, |
| 237 |
|\ndref| will always refer to the most recent time it was used. |
| 238 |
|
| 239 |
\subsection{Generic justifications} |
| 240 |
|
| 241 |
\DescribeMacro{\by} |
| 242 |
Non-standard justifications can be created with the |\by| |
| 243 |
command. This command takes two arguments: a name and a reference |
| 244 |
list. For instance, the command |\by{De Morgan}{lab3,lab4}| might |
| 245 |
produce the output ``\mbox{De Morgan, 3, 4}''. Note that the justification |
| 246 |
is typeset in text mode. |
| 247 |
|
| 248 |
In the default justification format, a comma is automatically inserted |
| 249 |
between the name and the reference list, unless the reference list is |
| 250 |
empty. The formatting of justifications can be changed, see |
| 251 |
Section~\ref{sec-customization}. If the second argument (the reference |
| 252 |
list) is empty, only the first argument (without formatting or |
| 253 |
punctuation) is printed. \NewIn{1.0} If the first argument is empty, |
| 254 |
only the reference list is printed. |
| 255 |
|
| 256 |
Since the |\by| command outputs its first argument without additional |
| 257 |
formatting when the second argument is empty, you can use |\by{...}{}| |
| 258 |
to produce arbitrary text in the justification. You can use the |
| 259 |
|\ndref| command here. |
| 260 |
\begin{LTXexample} |
| 261 |
$ |
| 262 |
\begin{nd} |
| 263 |
\hypo {a} {A \Rightarrow B} |
| 264 |
\by{Premise}{} |
| 265 |
\hypo {b} {A} \by{Premise}{} |
| 266 |
\have {c} {B} |
| 267 |
\by{\ndref{a,b} |
| 268 |
(but \emph{how?})}{} |
| 269 |
\have {d} {A \wedge B} \by{}{b,c} |
| 270 |
\end{nd} |
| 271 |
$ |
| 272 |
\end{LTXexample} |
| 273 |
|
| 274 |
\subsection{Scope} |
| 275 |
|
| 276 |
The commands |\hypo|, |\have|, |\open|, |\close|, |\by|, |\r|, |\ii|, and so |
| 277 |
forth are only available inside an |nd| environment. These commands |
| 278 |
may have a different meaning elsewhere in the same document. The only |
| 279 |
commands provided by the |fitch.sty| package which are visible |
| 280 |
outside an |nd| environment are the command |\ndref| described in |
| 281 |
Section~\ref{subsec-ndref}, the commands |\ndrules|, |\ndjustformat|, |
| 282 |
|\ndrefformat|, and |\nddim|, and the dimension |\ndindent| described |
| 283 |
in Section~\ref{sec-customization}. |
| 284 |
|
| 285 |
\subsection{Breaking it across pages}\label{subsec-break} |
| 286 |
|
| 287 |
\DescribeEnv{ndresume} |
| 288 |
\DescribeEnv{fitchproof*} |
| 289 |
The |nd| environment is derived from the {\LaTeX} |array| |
| 290 |
environment, and thus it does not break across pages automatically. |
| 291 |
However, if a derivation is too long to fit on a single page, it is |
| 292 |
possible to split it manually into physically independent, but |
| 293 |
logically consecutive subparts. For this purpose, the |ndresume| |
| 294 |
environment is provided to continue a previously interrupted |
| 295 |
derivation. |
| 296 |
\NewIn{1.0} The environment |fitchproof*| works the same way, except typesets the |
| 297 |
proof just like the |fitchproof| environment (no need for math mode, |
| 298 |
flush left, spacing before and after). However, like |fitchproof|, it |
| 299 |
requires the |arrayenv=tabular| option. Here is an example: |
| 300 |
|
| 301 |
\begin{LTXexample} |
| 302 |
\begin{fitchproof}[arrayenv=tabular] |
| 303 |
\hypo {1} {P\vee Q} |
| 304 |
\hypo {2} {\neg Q} |
| 305 |
\open |
| 306 |
\hypo {3} {P} |
| 307 |
\have {4} {P} \r{3} |
| 308 |
\close |
| 309 |
\open |
| 310 |
\hypo {aa} {Q} |
| 311 |
\have {6} {\neg Q} \r{2} |
| 312 |
\end{fitchproof} |
| 313 |
Derivations can be interrupted and |
| 314 |
resumed at any point. |
| 315 |
\begin{fitchproof*}[arrayenv=tabular] |
| 316 |
\have {7} {\bot} \ne{aa,6} |
| 317 |
\have {8} {P} \be{7} |
| 318 |
\close |
| 319 |
\have {9} {P} \oe{1,3-4,aa-8} |
| 320 |
\end{fitchproof*} |
| 321 |
\end{LTXexample} |
| 322 |
|
| 323 |
\NewIn{1.0} You can also have derivations break across pages |
| 324 |
automatically. In order to do this, you have to load the |
| 325 |
\href{https://ctan.org/pkg/longtable}{|longtable|} package, and load |
| 326 |
|fitch| with the |arrayenv=longtable| option. Since the |longtable| |
| 327 |
environment works in text (not math) mode, you should then only use |
| 328 |
|fitchproof|, or the |nd| environment but \emph{not} in text mode. |
| 329 |
Note that the |longtable| package does not work in 2-column mode or |
| 330 |
inside a |multicolumn| environment. You can always produce a proof |
| 331 |
inside a |multicolumn| environment by passing |arrayenv=tabular| as an |
| 332 |
option to the |nd| or |fitchproof| environment. |
| 333 |
|
| 334 |
|
| 335 |
\subsection{Custom line numbers}\label{subsec-customline} |
| 336 |
|
| 337 |
One often needs to write derivation schemas, rather than derivations. |
| 338 |
This often requires the use of symbolic constants such as $n$, $n+1$, |
| 339 |
etc, instead of actual line numbers. The |\have| and |\hypo| |
| 340 |
commands have an optional first argument which is a symbolic constant. |
| 341 |
For instance, |\have[n]| will cause the current line to be |
| 342 |
numbered with the symbolic constant $n$. Subsequent lines are |
| 343 |
automatically numbered $n+1$ etc. An initial offset can be given as a |
| 344 |
second optional argument, as in |\have[n][-1]|, which will cause |
| 345 |
the current line to be numbered $n-1$, the following line $n$, etc. In |
| 346 |
an explicit offset is given, the symbolic constant can also be absent: |
| 347 |
for instance, the command |\have[][7]| resets the current line |
| 348 |
number to $7$. The following example illustrates this behavior: |
| 349 |
|
| 350 |
\begin{LTXexample} |
| 351 |
$ |
| 352 |
\begin{nd}[justsep=1em] |
| 353 |
\hypo {1} {P\vee Q} |
| 354 |
\open |
| 355 |
\hypo {2} {P} |
| 356 |
\have [\vdots] {3} {\vdots} |
| 357 |
\have [n][-1] {4} {A\wedge B} |
| 358 |
\close |
| 359 |
\open |
| 360 |
\hypo {5} {Q} |
| 361 |
\have [\vdots] {6} {\vdots} |
| 362 |
\have [m] {7} {A\wedge B} |
| 363 |
\close |
| 364 |
\have {8} {A\wedge B} |
| 365 |
\oe{1,2-(4),5-7} |
| 366 |
\have [\vdots] {9} {\vdots} |
| 367 |
\have [][100] {10} {A} \ae{8} |
| 368 |
\end{nd} |
| 369 |
$ |
| 370 |
\end{LTXexample} |
| 371 |
|
| 372 |
Note that in the justification for line $m+1$, parentheses had to be |
| 373 |
put around the label $4$. There is currently no way of doing this |
| 374 |
automatically. |
| 375 |
|
| 376 |
{\bf Exercise.} How does one typeset an empty line number? |
| 377 |
|
| 378 |
{\bf Solution.} Since |\have[]| has a special meaning as explained |
| 379 |
above, we need to use |\have[~]| instead. |
| 380 |
|
| 381 |
\subsection{Continuation lines}\label{subsec-continuation} |
| 382 |
|
| 383 |
Sometimes one has to typeset a very long formula that does not fit on |
| 384 |
a single line. As of version 0.5 of the {\tt fitch.sty} macros, it is |
| 385 |
possible to break a formula into several lines using |\\| as a |
| 386 |
line separator. Continuation lines are automatically indented, as |
| 387 |
shown in the following example. |
| 388 |
|
| 389 |
\begin{LTXexample} |
| 390 |
$ |
| 391 |
\begin{nd} |
| 392 |
\hypo{1} {A\wedge B} |
| 393 |
\hypo{2} {A\wedge B\Rightarrow{} \\ |
| 394 |
C\wedge D} |
| 395 |
\have{3} {C\wedge D} \ie{1,2} |
| 396 |
\have{4} {A\wedge B\wedge{} \\ |
| 397 |
C\wedge D} \ai{1,3} |
| 398 |
\end{nd} |
| 399 |
$ |
| 400 |
\end{LTXexample} |
| 401 |
|
| 402 |
\DescribeMacro{\hypocont} |
| 403 |
\DescribeMacro{\havecont} |
| 404 |
Alternatively, the |\havecont| and |\hypocont| commands can |
| 405 |
be used to specify each continuation line separately, as the following |
| 406 |
example illustrates. |
| 407 |
|
| 408 |
\begin{LTXexample} |
| 409 |
$ |
| 410 |
\begin{nd} |
| 411 |
\hypo{1} {A\wedge B} |
| 412 |
\hypo{2} {A\wedge B\Rightarrow{}} |
| 413 |
\hypocont {C\wedge D} |
| 414 |
\have{3} {C\wedge D} \ie{1,2} |
| 415 |
\have{4} {A\wedge B\wedge{}} \ai{1,3} |
| 416 |
\havecont {C\wedge D} |
| 417 |
\end{nd} |
| 418 |
$ |
| 419 |
\end{LTXexample} |
| 420 |
|
| 421 |
This latter style gives slightly more flexibility in the placement of |
| 422 |
justifications, since each line and continuation line can have its own |
| 423 |
justification and its own guard (via the |\guard| command). It |
| 424 |
also allows a derivation to be interrupted between a line and its |
| 425 |
continuation, as discussed in Section~\ref{subsec-break}. |
| 426 |
|
| 427 |
\section{Customization}\label{sec-customization} |
| 428 |
|
| 429 |
The relative sizes of the various elements of a natural deduction |
| 430 |
proof are preset to reasonable values depending on the size of the |
| 431 |
currently selected font. However, it will sometimes be necessary to |
| 432 |
customize these dimensions. The customizable dimensions are given in |
| 433 |
the following diagram. |
| 434 |
\begin{center} |
| 435 |
\includegraphics{fitchdoc-dimen} |
| 436 |
\end{center} |
| 437 |
In addition, \meta{linethickness} determines the thickness of scope |
| 438 |
lines, and \meta{cindent} the extra indentation of continuation lines |
| 439 |
(as discussed in Section~\ref{subsec-continuation}). The default |
| 440 |
dimensions are: |
| 441 |
\begin{center} |
| 442 |
\begin{tabular}{ll@{\qquad}ll} |
| 443 |
\meta{height} & 4.5ex & |
| 444 |
\meta{topheight} & 3.5ex\\ |
| 445 |
\meta{depth} & 1.5ex & |
| 446 |
\meta{labelsep} & 1em\\ |
| 447 |
\meta{indent} & 1.6em & |
| 448 |
\meta{hsep} & .5em\\ |
| 449 |
\meta{justsep} & 2.5em & |
| 450 |
\meta{linethickness} & .2mm\\ |
| 451 |
\meta{cindent} & 1em |
| 452 |
\end{tabular} |
| 453 |
\end{center} |
| 454 |
|
| 455 |
\NewIn{1.0} To change these default dimensions, pass a list of |
| 456 |
key-value pairs as package options, as optional arguments to the |
| 457 |
|nd| or |fitchproof| environment, or use the |\setkeys| |
| 458 |
command: |
| 459 |
\begin{verbatim} |
| 460 |
\usepackage[justsep=1em]{fitch} |
| 461 |
\begin{nd}[rules=myrules] |
| 462 |
\begin{fitchproof}[linethickness=1pt] |
| 463 |
\setkeys{fitch}{hsep=1em,indent=1em}\end{verbatim} |
| 464 |
|
| 465 |
In addition, the macros used to generate the table containing the |
| 466 |
proof, to format justifications, format line number references, and to |
| 467 |
initialize macros to produce justifications in the proof can be |
| 468 |
customized: |
| 469 |
\begin{center} |
| 470 |
\begin{tabular}{ll} |
| 471 |
option & default\\\hline |
| 472 |
|rules=|\meta{macroname} & |ndrules|\\ |
| 473 |
|justformat=|\meta{macroname} & |ndjustformat|\\ |
| 474 |
|refformat=|\meta{macroname} & |ndrefformat|\\ |
| 475 |
|arrayenv=|\meta{envname} & |array| |
| 476 |
\end{tabular} |
| 477 |
\end{center} |
| 478 |
For compatibility with earlier versions of |fitch.sty|, the default |
| 479 |
for \meta{arrayenv} is |array|, i.e., the table containing the proof |
| 480 |
is generated using an |array| environment, and must therefore occur |
| 481 |
inside math mode. The |fitchproof| and |fitchproof*| environments |
| 482 |
assume that you use a text table command instead, such as |tabular|. |
| 483 |
Hence, you should \emph{not} use |fitchproof| in math mode, and you |
| 484 |
must use the option |arrayenv=tabular| (when loading |fitch|, as an |
| 485 |
optional argument to |fitchproof|, or using |
| 486 |
|\setkeys{fitch}{arrayenv=tabular}|. Any other table environment that |
| 487 |
takes the same table format argument as |array| and |tabular| can be |
| 488 |
used here, e.g., the |longtable| environment from the |longtable| |
| 489 |
package (which must be loaded separately). |
| 490 |
|
| 491 |
The package defines the macros |
| 492 |
\DescribeMacro{\ndrules}\cmd{\ndrules}, which defines the rule |
| 493 |
macros given at the end of Section~\ref{sec-usage}, using |
| 494 |
\begin{verbatim} |
| 495 |
\def\ndrules{% |
| 496 |
\def\ii{\by{$\Rightarrow$I}}% |
| 497 |
\def\ie{\by{$\Rightarrow$E}}% |
| 498 |
\def\Ai{\by{$\forall$I}}% |
| 499 |
\def\Ae{\by{$\forall$E}}% |
| 500 |
\def\Ei{\by{$\exists$I}}% |
| 501 |
\def\Ee{\by{$\exists$E}}% |
| 502 |
\def\ai{\by{$\wedge$I}}% |
| 503 |
\def\ae{\by{$\wedge$E}}% |
| 504 |
\def\ai{\by{$\wedge$I}}% |
| 505 |
\def\ae{\by{$\wedge$E}}% |
| 506 |
\def\oi{\by{$\vee$I}}% |
| 507 |
\def\oe{\by{$\vee$E}}% |
| 508 |
\def\ni{\by{$\neg$I}}% |
| 509 |
\def\ne{\by{$\neg$E}}% |
| 510 |
\def\be{\by{$\bot$E}}% |
| 511 |
\def\nne{\by{$\neg\neg$E}}% |
| 512 |
\def\r{\by{R}}} |
| 513 |
\end{verbatim} |
| 514 |
\DescribeMacro{\ndjustformat} |
| 515 |
The macro \cmd{\ndjustformat} is defined as |
| 516 |
\begin{verbatim} |
| 517 |
\newcommand{\ndjustformat}[2]{#1, #2} |
| 518 |
\end{verbatim} |
| 519 |
The first argument takes the rule name, the second the reference list. |
| 520 |
It is used to typeset the justification. |
| 521 |
|
| 522 |
\DescribeMacro{\ndrefformat} |
| 523 |
The macro \cmd{\ndrefformat} is defined as |
| 524 |
\begin{verbatim} |
| 525 |
\newcommand{\ndrefformat}[1]{#1} |
| 526 |
\end{verbatim} |
| 527 |
It is used to typeset the line numbers in justifications. |
| 528 |
|
| 529 |
\cmd{\ndrules}, \cmd{\ndjustformat}, and \cmd{\ndrefformat} can |
| 530 |
be redefined using \cmd{\renewcommand}, or you can define your own |
| 531 |
commands to provide the rule names, the justification format, and line |
| 532 |
number format, and pass the names (without initial |\|) as an option |
| 533 |
to the \cmd{\usepackage} or individual \cmd{\nd} or \cmd{\fitchproof} |
| 534 |
commands. |
| 535 |
\begin{LTXexample} |
| 536 |
\newcommand{\myjust}[2] |
| 537 |
{#2 by \textsf{#1}} |
| 538 |
\newcommand{\myrules}{ |
| 539 |
\ndrules % include standard rules |
| 540 |
\def\ds{\by{DS}}} |
| 541 |
\renewcommand{\ndrefformat}[1]{(#1)} |
| 542 |
$ |
| 543 |
\begin{nd}[rules=myrules, |
| 544 |
justformat=myjust, |
| 545 |
indent=1.5cm, |
| 546 |
linethickness=1.5pt, |
| 547 |
justsep=1cm] |
| 548 |
\hypo {1} {A\vee B} |
| 549 |
\hypo {2} {\neg B} |
| 550 |
\open |
| 551 |
\hypo {a} {B} |
| 552 |
\have {3} {A} \ds{1,2} |
| 553 |
\have {b} {A \wedge B} \ai{a,3} |
| 554 |
\end{nd} |
| 555 |
$ |
| 556 |
\end{LTXexample} |
| 557 |
|
| 558 |
The boolean option |outerline| can be set to false to suppress the |
| 559 |
leftmost scope line. This may be useful when printing inference rules, |
| 560 |
e.g., |
| 561 |
\begin{LTXexample} |
| 562 |
$ |
| 563 |
\begin{nd}[outerline=false, |
| 564 |
labelsep=0pt] |
| 565 |
\open |
| 566 |
\hypo [n]{1} {A} |
| 567 |
\have [~]{2} {\raisebox{-1ex}{\vdots}} |
| 568 |
\have [m]{3} {B} |
| 569 |
\close |
| 570 |
\have [~]{b} {A \Rightarrow B} \ii{1-3} |
| 571 |
\end{nd} |
| 572 |
$ |
| 573 |
\end{LTXexample} |
| 574 |
|
| 575 |
\section{Obsolete commands and backwards compatibility}\label{compat} |
| 576 |
|
| 577 |
\DescribeMacro{\nddim} |
| 578 |
The dimensions can also be changed with the |
| 579 |
|\nddim| command. The syntax of the command is as follows: |
| 580 |
\begin{center} |
| 581 |
\cmd{\nddim}\marg{height}\marg{topheight}\marg{depth}\marg{labelsep} |
| 582 |
\marg{indent}\marg{hsep}\marg{justsep}\marg{linethickness}, |
| 583 |
\end{center} |
| 584 |
where each of the eight parameters is a dimension. This still works, |
| 585 |
but using the key-value pair options is the preferred method. |
| 586 |
|
| 587 |
\NewIn{1.0}\DescribeMacro{\ndindent} In versions before v1.0, the recommended way |
| 588 |
to change the extra indentation used on continuation lines was to |
| 589 |
change dimension |\ndindent| directly using |\setlength|. As of v1.0, |
| 590 |
you should use the |cindent| option instead. |
| 591 |
|
| 592 |
The original code ``hid'' the internal macros by naming |
| 593 |
them |\nd*...|. In v1.0 this has been changed to the standard |
| 594 |
|\nd@...|. Any low-level redefinition of |fitch| internals that uses |
| 595 |
|*| will break in v1.0. |
| 596 |
|
| 597 |
\section{Other comments} |
| 598 |
|
| 599 |
The goal was to design a flexible package which would not impose any |
| 600 |
constraints on the form of derivations, while making typesetting easy. |
| 601 |
With this package, it is in fact possible to typeset incomplete, |
| 602 |
ill-formed, or invalid derivations. Sometimes it is pedagogically necessary |
| 603 |
to do so. |
| 604 |
|
| 605 |
There are no arbitrary limits on the size or nesting depth of a derivation, |
| 606 |
except for the obvious requirement of fitting horizontally on the |
| 607 |
printed page. |
| 608 |
|
| 609 |
\section{Copyright and license} |
| 610 |
|
| 611 |
This document and the accompanying |fitch.sty| macros are {\copyright} |
| 612 |
2002--2023 by Peter Selinger and Richard Zach and distributed under |
| 613 |
the terms of the \href{https://www.latex-project.org/lppl/}{LPPL}. |
| 614 |
|
| 615 |
\end{document} |