| 1 |
% \iffalse meta-comment |
| 2 |
% |
| 3 |
% Copyright (C) 2013 by John Etchemendy, Dave Barker-Plummer, |
| 4 |
% and Richard Zach |
| 5 |
% ------------------------------------------------------- |
| 6 |
% |
| 7 |
% This work may be distributed and/or modified under the |
| 8 |
% conditions of the LaTeX Project Public License, either version 1.3 |
| 9 |
% of this license or (at your option) any later version. |
| 10 |
% The latest version of this license is in |
| 11 |
% http://www.latex-project.org/lppl.txt |
| 12 |
% and version 1.3 or later is part of all distributions of LaTeX |
| 13 |
% version 2005/12/01 or later. |
| 14 |
% |
| 15 |
% \fi |
| 16 |
% |
| 17 |
% \iffalse |
| 18 |
%<*driver> |
| 19 |
\ProvidesFile{lplfitch.dtx} |
| 20 |
%</driver> |
| 21 |
%<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01] |
| 22 |
%<package>\ProvidesPackage{lplfitch} |
| 23 |
%<*package> |
| 24 |
[2013/05/16 v0.9 LPL Fitch style] |
| 25 |
%</package> |
| 26 |
% |
| 27 |
%<*driver> |
| 28 |
\documentclass{ltxdoc} |
| 29 |
\usepackage{lplfitch}[2013/05/16] |
| 30 |
\usepackage{hyperref} |
| 31 |
\EnableCrossrefs |
| 32 |
\CodelineIndex |
| 33 |
\RecordChanges |
| 34 |
\begin{document} |
| 35 |
\DocInput{lplfitch.dtx} |
| 36 |
\PrintChanges |
| 37 |
\PrintIndex |
| 38 |
\end{document} |
| 39 |
%</driver> |
| 40 |
% \fi |
| 41 |
% |
| 42 |
% \CheckSum{0} |
| 43 |
% |
| 44 |
% \CharacterTable |
| 45 |
% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z |
| 46 |
% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z |
| 47 |
% Digits \0\1\2\3\4\5\6\7\8\9 |
| 48 |
% Exclamation \! Double quote \" Hash (number) \# |
| 49 |
% Dollar \$ Percent \% Ampersand \& |
| 50 |
% Acute accent \' Left paren \( Right paren \) |
| 51 |
% Asterisk \* Plus \+ Comma \, |
| 52 |
% Minus \- Point \. Solidus \/ |
| 53 |
% Colon \: Semicolon \; Less than \< |
| 54 |
% Equals \= Greater than \> Question mark \? |
| 55 |
% Commercial at \@ Left bracket \[ Backslash \\ |
| 56 |
% Right bracket \] Circumflex \^ Underscore \_ |
| 57 |
% Grave accent \` Left brace \{ Vertical bar \| |
| 58 |
% Right brace \} Tilde \~} |
| 59 |
% |
| 60 |
% |
| 61 |
% \changes{v0.1}{Aeons ago}{Initial version} |
| 62 |
% \changes{v0.9}{2012/05/16}{First public beta} |
| 63 |
% |
| 64 |
% \GetFileInfo{lplfitch.dtx} |
| 65 |
% |
| 66 |
% \DoNotIndex{\newcommand,\newenvironment} |
| 67 |
% |
| 68 |
% \title{The \textsf{lplfitch} package\thanks{This document |
| 69 |
% corresponds to \textsf{lplproof}~\fileversion, dated \filedate.}} |
| 70 |
% \author{John Etchemendy \and Dave Barker-Plummer \and Richard Zach} |
| 71 |
% |
| 72 |
% \maketitle |
| 73 |
% |
| 74 |
% \section{Introduction} |
| 75 |
% |
| 76 |
% The package |lplfitch| provides macros for typesetting natural |
| 77 |
% deduction proofs in ``Fitch'' style, with subproofs indented and |
| 78 |
% offset by scope lines. It produces proofs in the format used in the |
| 79 |
% textbook \href{http://lpl.stanford.edu/}{\textit{Language, Proof, |
| 80 |
% and Logic}} by Dave Barker-Plummer, Jon Barwise, and John |
| 81 |
% Etchemendy. The package was originally written by John |
| 82 |
% Etchemendy. The current version incorporates changes by Dave |
| 83 |
% Barker-Plummer and Richard Zach. |
| 84 |
% |
| 85 |
% \section{Fitch Proofs by Example} |
| 86 |
% \label{sect:proofs-by-example} |
| 87 |
% |
| 88 |
% In this section we will describe how to typeset the Fitch-style |
| 89 |
% natural deduction proof shown in figure~\ref{fig:example-proof}. |
| 90 |
% This proof uses all of the macros that we have developed for |
| 91 |
% typesetting proofs and therefore serves as a good illustration. |
| 92 |
% |
| 93 |
% \begin{figure} |
| 94 |
% \fitchprf{}{ |
| 95 |
% \subproof{\pline[1.]{\uni{x}{(Cube(x)\lif Small(x))}}}{ |
| 96 |
% \subproof{\pline[2.]{\exi{x}{Cube(x)}}}{ |
| 97 |
% \boxedsubproof[3.]{a}{Cube(a)}{ |
| 98 |
% \pline[4.]{Cube(a)\lif Small(a)}[\lalle{1}]\\ |
| 99 |
% \pline[5.]{Small(a)}[\life{4}{3}]\\ |
| 100 |
% \pline[6.]{\exi{x}{Small(x)}}[\lexii{5}] |
| 101 |
% } |
| 102 |
% \pline[7.]{\exi{x}{Small(x)}}[\lexie{2}{3--6}] |
| 103 |
% } |
| 104 |
% \pline[8.]{\exi{x}{Cube(x)}\lif \exi{x}{Small(x)}}[\lifi{2--7}] |
| 105 |
% } |
| 106 |
% \pline[9.]{\brokenform{(\uni{x}{(Cube(x)\lif Small(x))}\lif}{ |
| 107 |
% \formula{(\exi{x}{Cube(x)} \lif \exi{x}{Small(x)})}}}[\lifi{1--8}] |
| 108 |
% } |
| 109 |
% \caption{An Example Proof} |
| 110 |
% \label{fig:example-proof} |
| 111 |
% \end{figure} |
| 112 |
% |
| 113 |
% The commands for producing this proof are given in |
| 114 |
% figure~\ref{fig:proof-eg-cmds}. This proof is a little hard to take |
| 115 |
% in all at once, and so in the remainder of this section we will |
| 116 |
% describe the development of this proof, which we hope is of use to |
| 117 |
% readers. |
| 118 |
% |
| 119 |
%\begin{figure} |
| 120 |
%\begin{verbatim} |
| 121 |
% \fitchprf{}{ |
| 122 |
% \subproof{\pline[1.]{\uni{x}{(Cube(x)\lif Small(x))}}}{ |
| 123 |
% \subproof{\pline[2.]{\exi{x}{Cube(x)}}}{ |
| 124 |
% \boxedsubproof[3.]{a}{Cube(a)}{ |
| 125 |
% \pline[4.]{Cube(a)\lif Small(a)}[\lalle{1}]\\ |
| 126 |
% \pline[5.]{Small(a)}[\life{4}{3}]\\ |
| 127 |
% \pline[6.]{\exi{x}{Small(x)}}[\lexii{5}] |
| 128 |
% } |
| 129 |
% \pline[7.]{\exi{x}{Small(x)}}[\lexie{2}{3--6}] |
| 130 |
% } |
| 131 |
% \pline[8.]{\exi{x}{Cube(x)}\lif \exi{x}{Small(x)}}[\lifi{2--7}] |
| 132 |
% } |
| 133 |
% \pline[9.]{\brokenform{(\uni{x}{(Cube(x)\lif Small(x))}\lif}{ |
| 134 |
% \formula{(\exi{x}{Cube(x)} \lif \exi{x}{Small(x)})}}}[\lifi{1--8}] |
| 135 |
% } |
| 136 |
% \end{verbatim} |
| 137 |
% \caption{The commands for producing the proof of |
| 138 |
% figure~\ref{fig:example-proof}} |
| 139 |
% \label{fig:proof-eg-cmds} |
| 140 |
% \end{figure} |
| 141 |
% |
| 142 |
% We recommend developing the commands to typeset a proof from the |
| 143 |
% inside out, starting with the most deeply nested subproof. We also |
| 144 |
% recommend ignoring justifications until the proof is complete, |
| 145 |
% primarily for simplicity but also because the line numbers are not |
| 146 |
% known until the complete proof structure is present. |
| 147 |
% |
| 148 |
% We begin by writing the lines of the innermost subproof (lines 3--6 |
| 149 |
% of the main proof). |
| 150 |
% |
| 151 |
% \begin{quote} |
| 152 |
% \begin{tabular}{ll} |
| 153 |
% |\pline{Cube(a)}| & \formula{Cube(a)}\\ |
| 154 |
% |\pline{Cube(a)\lif Small(a)}| & \formula{Cube(a)\lif Small(a)}\\ |
| 155 |
% |\pline{Small(a)}| & \formula{Small(a)}\\ |
| 156 |
% |\pline{\exi{x}{Small(x)}}| & \formula{\exi{x}{Small(x)}} |
| 157 |
% \end{tabular} |
| 158 |
% \end{quote} |
| 159 |
% |
| 160 |
% The macro |\pline| produces a single line of the proof. The |
| 161 |
% mandatory argument to |\pline| is the formula to appear within the |
| 162 |
% step. You will notice that we have used the macro |\lif| to produce |
| 163 |
% an conditional arrow, and |\exi| to produce an existentially |
| 164 |
% quantified formula. These are members of a suite of macros that we |
| 165 |
% find convenient for producing formulae. These are described in |
| 166 |
% section~\ref{sect:formulae}. |
| 167 |
% |
| 168 |
% The |\pline| macro may only be used inside a proof context. We |
| 169 |
% construct such a context by using the |\fitchprf| macro. This macro |
| 170 |
% has two mandatory arguments, corresponding to the premises and the |
| 171 |
% body of the proof. Each argument is a list of lines, separated by a |
| 172 |
% newline (|\\|) command. We therefore embed the lines of our example |
| 173 |
% proof like this: |
| 174 |
% |
| 175 |
% \begin{verbatim} |
| 176 |
% \fitchprf{\pline{Cube(a)}}{ |
| 177 |
% \pline{Cube(a) \lif Small(a)}\\ |
| 178 |
% \pline{Small(a)}\\ |
| 179 |
% \pline{\exi{x}{Small(x)}} |
| 180 |
% }\end{verbatim} |
| 181 |
% |
| 182 |
% Typesetting a document containing this command results in |
| 183 |
% the proof: |
| 184 |
% \begin{quote} |
| 185 |
% \fitchprf{\pline{Cube(a)}}{ |
| 186 |
% \pline{Cube(a) \lif Small(a)}\\ |
| 187 |
% \pline{Small(a)}\\ |
| 188 |
% \pline{\exi{x}{Small(x)}} |
| 189 |
% } |
| 190 |
% \end{quote} |
| 191 |
% |
| 192 |
% Our next step is to embed this proof as a subproof within the larger |
| 193 |
% proof. This is simply achieved. We first change the use of |
| 194 |
% |\fitchprf| to a |\subproof| command, and then treat this as a line |
| 195 |
% of the body of another |\fitchprf| command. The result of doing |
| 196 |
% this is: |
| 197 |
% |
| 198 |
% \begin{verbatim} |
| 199 |
% \fitchprf{\pline{\exi{x}{Cube(x)}}}{ |
| 200 |
% \subproof{\pline{Cube(a)}}{ |
| 201 |
% \pline{Cube(a)\lif Small(a)}\\ |
| 202 |
% \pline{Small(a)}\\ |
| 203 |
% \pline{\exi{x}{Small(x)}} |
| 204 |
% } |
| 205 |
% \pline{\exi{x}{Small(x)}} |
| 206 |
% }\end{verbatim} |
| 207 |
% |
| 208 |
% \noindent which yields the proof: |
| 209 |
% |
| 210 |
% \begin{quote} |
| 211 |
% \fitchprf{\pline{\exi{x}{Cube(x)}}}{ |
| 212 |
% \subproof{\pline{Cube(a)}}{ |
| 213 |
% \pline{Cube(a)\lif Small(a)}\\ |
| 214 |
% \pline{Small(a)}\\ |
| 215 |
% \pline{\exi{x}{Small(x)}} |
| 216 |
% } |
| 217 |
% \pline{\exi{x}{Small(x)}} |
| 218 |
% } |
| 219 |
% \end{quote} |
| 220 |
% |
| 221 |
% \noindent The new outer |\fitchprf| has two elements in the second |
| 222 |
% argument, one of which is the subproof that we just wrote and the |
| 223 |
% second is a formula. As we embedded the subproof in the body of the |
| 224 |
% main proof we changed the command from |\fitchprf| to |\subproof|, |
| 225 |
% the definitions of these two macros are almost identical but for the |
| 226 |
% adjustment of vertical spacing after the use of a |\subproof| |
| 227 |
% command. Note that no |\\| command is required after the use of a |
| 228 |
% |\subproof| command. |
| 229 |
% |
| 230 |
% Two further applications of this technique give us the command: |
| 231 |
% |
| 232 |
% \begin{verbatim} |
| 233 |
% \fitchprf{}{ |
| 234 |
% \subproof{\pline{\uni{x}{(Cube(x)\lif Small(x))}}}{ |
| 235 |
% \subproof{\pline{\exi{x}{Cube(x)}}}{ |
| 236 |
% \subproof{\pline{Cube(a)}}{ |
| 237 |
% \pline{Cube(a)\lif Small(a)}\\ |
| 238 |
% \pline{Small(a)}\\ |
| 239 |
% \pline{\exi{x}{Small(x)}} |
| 240 |
% } |
| 241 |
% \pline{\exi{x}{Small(x)}} |
| 242 |
% } |
| 243 |
% \pline{\exi{x}{Cube(x)}\lif \exi{x}{Small(x)}} |
| 244 |
% } |
| 245 |
% \pline{\brokenform{(\uni{x}{(Cube(x)\lif Small(x))}\lif}{ |
| 246 |
% \formula{(\exi{x}{Cube(x)} \lif \exi{x}{Small(x)})}}} |
| 247 |
% } |
| 248 |
% \end{verbatim} |
| 249 |
% |
| 250 |
% \noindent which produces the proof |
| 251 |
% |
| 252 |
% \begin{quote} |
| 253 |
% \fitchprf{}{ |
| 254 |
% \subproof{\pline{\uni{x}{(Cube(x)\lif Small(x))}}}{ |
| 255 |
% \subproof{\pline{\exi{x}{Cube(x)}}}{ |
| 256 |
% \subproof{\pline{Cube(a)}}{ |
| 257 |
% \pline{Cube(a)\lif Small(a)}\\ |
| 258 |
% \pline{Small(a)}\\ |
| 259 |
% \pline{\exi{x}{Small(x)}} |
| 260 |
% } |
| 261 |
% \pline{\exi{x}{Small(x)}} |
| 262 |
% } |
| 263 |
% \pline{\exi{x}{Cube(x)}\lif \exi{x}{Small(x)}} |
| 264 |
% } |
| 265 |
% \pline{\brokenform{(\uni{x}{(Cube(x)\lif Small(x))}\lif}{ |
| 266 |
% \formula{(\exi{x}{Cube(x)} \lif \exi{x}{Small(x)})}}} |
| 267 |
% } |
| 268 |
% \end{quote} |
| 269 |
% |
| 270 |
% Notice that the last line contains a long formula, and we have used |
| 271 |
% the |\brokenform| command to typeset this formula. The |
| 272 |
% |\brokenform| command takes two arguments, the first is the first |
| 273 |
% part of the formula, which will be typeset left justified in the |
| 274 |
% space available, while the second argument contains the remaining |
| 275 |
% pieces of the formula which will appear in subsequent lines. These |
| 276 |
% lines should be separated by uses of the |\\| command, and each line |
| 277 |
% should (usually) be a |\formula|. These lines will be typeset right |
| 278 |
% justified in the available space. |
| 279 |
% |
| 280 |
% \subsection{Adding Line Numbers} |
| 281 |
% |
| 282 |
% The |\pline| command takes an optional argument which is the number |
| 283 |
% of the line within the proof. We can simply add these now that we |
| 284 |
% have all of the lines of the proof. |
| 285 |
% |
| 286 |
% \begin{verbatim} |
| 287 |
% \fitchprf{}{ |
| 288 |
% \subproof{\pline[1.]{\uni{x}{(Cube(x)\lif Small(x))}}}{ |
| 289 |
% \subproof{\pline[2.]{\exi{x}{Cube(x)}}}{ |
| 290 |
% \subproof{\pline[3.]{Cube(a)}}{ |
| 291 |
% \pline[4.]{Cube(a)\lif Small(a)}\\ |
| 292 |
% \pline[5.]{Small(a)}\\ |
| 293 |
% \pline[6.]{\exi{x}{Small(x)}} |
| 294 |
% } |
| 295 |
% \pline[7.]{\exi{x}{Small(x)}} |
| 296 |
% } |
| 297 |
% \pline[8.]{\exi{x}{Cube(x)}\lif \exi{x}{Small(x)}} |
| 298 |
% } |
| 299 |
% \pline[9.]{\brokenform{(\uni{x}{(Cube(x)\lif Small(x))}\lif}{ |
| 300 |
% \formula{(\exi{x}{Cube(x)} \lif \exi{x}{Small(x)})}}} |
| 301 |
% }\end{verbatim} |
| 302 |
% \noindent which results in the proof: |
| 303 |
% \begin{quote} |
| 304 |
% \fitchprf{}{ |
| 305 |
% \subproof{\pline[1.]{\uni{x}{(Cube(x)\lif Small(x))}}}{ |
| 306 |
% \subproof{\pline[2.]{\exi{x}{Cube(x)}}}{ |
| 307 |
% \subproof{\pline[3.]{Cube(a)}}{ |
| 308 |
% \pline[4.]{Cube(a)\lif Small(a)}\\ |
| 309 |
% \pline[5.]{Small(a)}\\ |
| 310 |
% \pline[6.]{\exi{x}{Small(x)}} |
| 311 |
% } |
| 312 |
% \pline[7.]{\exi{x}{Small(x)}} |
| 313 |
% } |
| 314 |
% \pline[8.]{\exi{x}{Cube(x)}\lif \exi{x}{Small(x)}} |
| 315 |
% } |
| 316 |
% \pline[9.]{\brokenform{(\uni{x}{(Cube(x)\lif Small(x))}\lif}{ |
| 317 |
% \formula{(\exi{x}{Cube(x)} \lif \exi{x}{Small(x)})}}} |
| 318 |
% } |
| 319 |
% \end{quote} |
| 320 |
% |
| 321 |
% In the eventual proof, a boxed constant is introduced at line~3. We |
| 322 |
% can convert the simple subproof into a boxed subproof. We use the |
| 323 |
% |\boxedsubproof| macro to achieve this. The conversion is |
| 324 |
% straightforward, we replace the first argument of the |\subproof| |
| 325 |
% command which was |{\pline[3.]{Cube(a)}}}| by the three arguments |
| 326 |
% |[3.]{a}{Cube(a)}| obtaining |
| 327 |
% |
| 328 |
% \begin{verbatim} |
| 329 |
% \boxedsubproof[3.]{a}{Cube(a)}{ |
| 330 |
% \pline[4.]{Cube(a)\lif Small(a)}\\ |
| 331 |
% \pline[5.]{Small(a)}\\ |
| 332 |
% \pline[6.]{\exi{x}{Small(x)}} |
| 333 |
% }\end{verbatim} |
| 334 |
% |
| 335 |
% \subsection{Adding Justifications} |
| 336 |
% |
| 337 |
% The final thing that we need to do to complete the desired proof is |
| 338 |
% the addition of justifications. To produce a justified line we need |
| 339 |
% to then add the optional justification argument. |
| 340 |
% |
| 341 |
% \begin{verbatim}\pline[5.]{Small(a)}[\ife{4}{3}]\end{verbatim} |
| 342 |
% |
| 343 |
% \noindent The \verb|\ife| macro produces a justification using the |
| 344 |
% $\lif$-elimination rule of the logic. This is one of a suite of |
| 345 |
% macros that we developed to produce justifications in a uniform |
| 346 |
% manner. These are described in section~\ref{sect:justifications}. |
| 347 |
% |
| 348 |
% \subsection{Command Reference} |
| 349 |
% |
| 350 |
% The |\pline| command can be used to typeset proof lines. It takes |
| 351 |
% the formula as a mandatory argument, and line number and |
| 352 |
% justification as optional arguments: |\pline|\oarg{line |
| 353 |
% number}\marg{formula}\oarg{justification}. The variant |\fpline| |
| 354 |
% works the same, except it produces a focus slider. In case you want |
| 355 |
% to typeset a line in an argument or proof that is not typeset as a |
| 356 |
% formula (e.g., plain text), use the |\tline| command. It takes a |
| 357 |
% line number as optional argument. |
| 358 |
% |
| 359 |
% \subsection{Obsolete Commands} |
| 360 |
% |
| 361 |
% The original version of |lplfitch| set lines of proofs using two |
| 362 |
% separate macros, the |\nline| and |\jline| commands. They are |
| 363 |
% superceded by the |\pline| command and are included for backward |
| 364 |
% compatibility only. |
| 365 |
% |
| 366 |
% A numbered line is produced by |\nline|, with the optional argument |
| 367 |
% the line number. A justified line is produced using the |
| 368 |
% \verb|\jline| macro, which has one mandatory and one optional |
| 369 |
% argument. The optional argument contains the justification, while |
| 370 |
% the mandatory argument must contain {\em all} of the arguments |
| 371 |
% previously given to \verb|\nline|. So the command |
| 372 |
% |
| 373 |
% \begin{verbatim}\nline[5.]{Small(a)}\end{verbatim} |
| 374 |
% |
| 375 |
% \noindent produces exactly the same output as |
| 376 |
% |
| 377 |
% \begin{verbatim}\jline{[5.]{Small(a)}}\end{verbatim} |
| 378 |
% |
| 379 |
% \noindent but notice that both the arguments to \verb|\nline| are |
| 380 |
% passed within the single argument to \verb|\jline|. To produce a |
| 381 |
% justified line using |\jline|, you would also include the |
| 382 |
% justification as an optional argument, say, |
| 383 |
% |
| 384 |
% \begin{verbatim}\jline{[5.]{Small(a)}}[\life{2}{3}]\end{verbatim} |
| 385 |
% |
| 386 |
% \section{Logical Formulae} |
| 387 |
% \label{sect:formulae} |
| 388 |
% |
| 389 |
% We set our formulae using sans-serif font and we also need to be in |
| 390 |
% math mode because the use of logical connectives. The |
| 391 |
% \verb|\formula| command takes a formula to set as its argument, and |
| 392 |
% handles both font and mode change. If the LPL convention of sans-serif |
| 393 |
% formulas is not desired, you can simly redefine |\formula| as |
| 394 |
% \begin{verbatim}\renewcommand{\formula}[1]{\ensuremath{#1}}\end{verbatim} |
| 395 |
% |
| 396 |
% Many of the commands that follow require that they are used in a |
| 397 |
% formula, or math, context. |
| 398 |
% |
| 399 |
% \subsection{Connectives} |
| 400 |
% |
| 401 |
% We introduce our own (usually) shorter names for logical |
| 402 |
% connectives. All of these commands require a formula context. |
| 403 |
% |
| 404 |
% \begin{center} |
| 405 |
% \begin{tabular}{lc} |
| 406 |
% \bf Usage & \bf Output\\ |
| 407 |
% \hline\\ |
| 408 |
% \verb|\land| & \formula{\land}\\ |
| 409 |
% \verb|\lor| & \formula{\lor}\\ |
| 410 |
% \verb|\lif| & \formula{\lif}\\ |
| 411 |
% \verb|\liff| & \formula{\liff}\\ |
| 412 |
% \verb|\lnot| & \formula{\lnot}\\ |
| 413 |
% \verb|\lfalse| & \formula{\lfalse}\\ |
| 414 |
% \verb|\lall| & \formula{\lall}\\ |
| 415 |
% \verb|\lis| & \formula{\lis} |
| 416 |
% \end{tabular} |
| 417 |
% \end{center} |
| 418 |
% |
| 419 |
% \subsection{Quantified Formulae} |
| 420 |
% |
| 421 |
% So that we don't have to think about spacing when setting quantified |
| 422 |
% formulae, we defined the commands |\exi| and |\uni|. Use |
| 423 |
% |\exi{x}{P(x)}| to obtain \formula{\exi{x}{P(x)}}, and |
| 424 |
% |\uni{x}{\exi{y}{(P(x)\lif Q(x,y))}}| for |
| 425 |
% \formula{\uni{x}{\exi{y}{(P(x)\lif Q(x,y))}}}, for example. |\exi| |
| 426 |
% and |\uni| require a formula context. |
| 427 |
% |
| 428 |
% \section{Justifications} |
| 429 |
% \label{sect:justifications} |
| 430 |
% |
| 431 |
% Here are the macros that we have developed to typeset justifications |
| 432 |
% within a proof. These do not require a formula context. |
| 433 |
% |
| 434 |
% \begin{center} |
| 435 |
% \begin{tabular}{ll} |
| 436 |
% \bf Usage & \bf Output\\ |
| 437 |
% \hline\\ |
| 438 |
% |\landi{2, 3}| &\landi{2, 3}\\ |
| 439 |
% |\lande{4}|&\lande{4}\\ |
| 440 |
% |\lori{5}| & \lori{5}\\ |
| 441 |
% |\lore{6}{7--9}{11--13}| &\lore{6}{7--9}{11--13}\\ |
| 442 |
% |\lnoti{14--15}| &\lnoti{14-15}\\ |
| 443 |
% |\lnote{16}| &\lnote{16}\\ |
| 444 |
% |\lfalsei{17}{19}| &\lfalsei{17}{19}\\ |
| 445 |
% |\lfalsee{20}|&\lfalsee{20}\\ |
| 446 |
% |\lifi{21--25}| &\lifi{21--25}\\ |
| 447 |
% |\life{27}{30}| &\life{27}{30}\\ |
| 448 |
% |\liffi{33--37}{40-50}|&\liffi{33--37}{40--50}\\ |
| 449 |
% |\liffe{55}{57}| &\liffe{55}{57}\\ |
| 450 |
% |\reit{4}|&\reit{4}\\ |
| 451 |
% |\eqi| &\eqi\\ |
| 452 |
% |\eqe{7}{11}|&\eqe{7}{11}\\ |
| 453 |
% |\lalli{9--12}|&\lalli{9--12}\\ |
| 454 |
% |\lalle{13}|&\lalle{13}\\ |
| 455 |
% |\lexii{15}| &\lexii{15}\\ |
| 456 |
% |\lexie{17}{18-30}| &\lexie{17}{18--30}\\ |
| 457 |
% \end{tabular} |
| 458 |
% \end{center} |
| 459 |
% |
| 460 |
% \section{Other Macros} |
| 461 |
% \label{sect:other-macros} |
| 462 |
% |
| 463 |
% \subsection{Arguments} |
| 464 |
% |
| 465 |
% When you want to typeset an argument, for example when setting an |
| 466 |
% exercise requiring the proof of some conclusion from a collection of |
| 467 |
% premises, you should use the |\fitcharg| command. This command |
| 468 |
% takes two arguments, both mandatory, the premise lines which are set |
| 469 |
% above the Fitch bar, and the conclusion lines, which go below. |
| 470 |
% Here's an example. The argument |
| 471 |
% |
| 472 |
%\begin{quote} |
| 473 |
% \fitcharg{\formula{P(a)}\\ \formula{Q(a)}}{\formula{S(a)}} |
| 474 |
%\end{quote} |
| 475 |
% |
| 476 |
%\noindent is typeset by the command: |
| 477 |
%\begin{verbatim}\fitcharg{ |
| 478 |
% \formula{P(a)}\\ |
| 479 |
% \formula{Q(a)} |
| 480 |
% }{ |
| 481 |
% \formula{S(a)} |
| 482 |
% }\end{verbatim} |
| 483 |
% \noindent Notice that multiple lines are separated by a use of the |
| 484 |
% \LaTeX\ command |\\|. |
| 485 |
% |
| 486 |
% \subsection{Fitch Contexts} |
| 487 |
% |
| 488 |
% The |\fitchctx| command is used for setting proof fragments which do |
| 489 |
% not include the horizontal Fitch bar. We use these, for example, |
| 490 |
% when formally describing the inference rules of our logic. The |
| 491 |
% command below, for example, typesets our description of the rule of |
| 492 |
% conditional proof. |
| 493 |
% |
| 494 |
% Notice here that we use the command |\ellipsesline| to produce a |
| 495 |
% line of the ``proof'' containing a vertical ellipses (using the |
| 496 |
% |\pline{\vdots}| results in the ellipses not being centered on the |
| 497 |
% line). |
| 498 |
% |
| 499 |
% Another new feature of this situation is the use of the |\fpline| |
| 500 |
% command. This command works just like the |\pline| command and |
| 501 |
% produces exactly what the |\pline| command would, except that a |
| 502 |
% focus slider appears to the left of the Fitch bar in question. The |
| 503 |
% |\fpline| command does not work in the argument lines of |
| 504 |
% |\fitchprf| or |\fitcharg|. |
| 505 |
% |
| 506 |
% \begin{verbatim} |
| 507 |
% \fitchctx{ |
| 508 |
% \subproof{\pline[$n$.]{P}}{ |
| 509 |
% \ellipsesline\\ |
| 510 |
% \pline[$m$.]{Q} |
| 511 |
% } |
| 512 |
% \fpline{P \lif Q}[\lifi{$n$--$m$}] |
| 513 |
% } |
| 514 |
% \end{verbatim} |
| 515 |
% |
| 516 |
% \begin{quote} |
| 517 |
% \fitchctx{ |
| 518 |
% \subproof{\pline[$n$.]{P}}{ |
| 519 |
% \ellipsesline\\ |
| 520 |
% \pline[$m$.]{Q} |
| 521 |
% } |
| 522 |
% \fpline{P \lif Q}[\lifi{$n$--$m$}] |
| 523 |
% } |
| 524 |
% \end{quote} |
| 525 |
% |
| 526 |
% \section{Other Packages} |
| 527 |
% |
| 528 |
% Two other \LaTeX{} packages provide functionality to typeset |
| 529 |
% Fitch-style proofs. They differ from |lplfitch| in that they set the |
| 530 |
% line numbers close to the left edge of the proof, while |lplfitch| |
| 531 |
% sets them close to the formula. Another difference is that subroofs |
| 532 |
% can easily be copied and work the same regardless of the depth of |
| 533 |
% nesting. |
| 534 |
% |
| 535 |
% Peter Selinger's package is |
| 536 |
% available at |
| 537 |
%\begin{quote} |
| 538 |
% \href{http://www.mathstat.dal.ca/~selinger/fitch/}{|http://www.mathstat.dal.ca/\~{ |
| 539 |
% }selinger/fitch/|}, |
| 540 |
% \end{quote} |
| 541 |
% and that by Johan Kl\"uwer at |
| 542 |
% \begin{quote} |
| 543 |
% \href{http://folk.uio.no/johanw/FitchSty.html}{|http://folk.uio.no/johanw/FitchSty.html|}. |
| 544 |
% \end{quote} |
| 545 |
% |
| 546 |
% \StopEventually{} |
| 547 |
% |
| 548 |
% \section{Implementation} |
| 549 |
% |
| 550 |
% \begin{macrocode} |
| 551 |
\NeedsTeXFormat{LaTeX2e} |
| 552 |
\ProvidesPackage{lplfitch}[2013/05/07 -- Fitch Proofs a la LPL] |
| 553 |
% \end{macrocode} |
| 554 |
% |
| 555 |
% \begin{macro}{\formula} |
| 556 |
% Typesets a formula (in math mode, letters typeset in sans-serif as in LPL |
| 557 |
% \begin{macrocode} |
| 558 |
\newcommand*{\formula}[1]{\ensuremath{\sf{#1}}} |
| 559 |
% \end{macrocode} |
| 560 |
% \end{macro} |
| 561 |
% |
| 562 |
% \subsection{Connectives and Quantifiers} |
| 563 |
% We provide convenient and short commands for logical symbols. |
| 564 |
% \begin{macrocode} |
| 565 |
\newcommand*\lif{\rightarrow} |
| 566 |
\newcommand*\liff{\leftrightarrow} |
| 567 |
\newcommand*\lfalse{\bot} |
| 568 |
\newcommand*\lall{\forall} |
| 569 |
\newcommand*\lis{\exists} |
| 570 |
% \end{macrocode} |
| 571 |
% The following provide for commands for setting quantified formulae, inserting correct space |
| 572 |
% between variable and formula. It can be redifined using |\renewcommand| if you want to use them but |
| 573 |
% want quantifiers set differently (e.g., with parentheses) |
| 574 |
% \begin{macrocode} |
| 575 |
\newcommand*{\quant}[3]{#1 #2\;#3} |
| 576 |
\newcommand*{\exi}[2]{\quant{\lis}{#1}{#2}} |
| 577 |
\newcommand*{\uni}[2]{\quant{\lall}{#1}{#2}} |
| 578 |
% \end{macrocode} |
| 579 |
% \subsection{Justifications} |
| 580 |
% |
| 581 |
% The folowing commands are used to generate justifications, e.g., |
| 582 |
% |\landi{1, 2}| produces ``\landi{1, 2}''. |
| 583 |
% \begin{macrocode} |
| 584 |
\newcommand*\intro[1]{\formula{#1\,}{\bf Intro:}} |
| 585 |
\newcommand*\elim[1]{\formula{#1\,}{\bf Elim:}} |
| 586 |
|
| 587 |
\newcommand*\landi[1]{\intro{\land} #1} |
| 588 |
\newcommand*\lande[1]{\elim{\land} #1} |
| 589 |
\newcommand*\lori[1]{\intro{\lor} #1} |
| 590 |
\newcommand*\lore[3]{\elim{\lor} #1, #2, #3} |
| 591 |
\newcommand*\lnoti[1]{\intro{\lnot} #1} |
| 592 |
\newcommand*\lnote[1]{\elim{\lnot} #1} |
| 593 |
|
| 594 |
\newcommand*\lfalsei[2]{\intro{\lfalse} #1, #2} |
| 595 |
\newcommand*\lfalsee[1]{\elim{\lfalse} #1} |
| 596 |
|
| 597 |
\newcommand*\lifi[1]{\intro{\lif} #1} |
| 598 |
\newcommand*\life[2]{\elim{\lif} #1, #2} |
| 599 |
|
| 600 |
\newcommand*\liffi[2]{\intro{\liff} #1, #2} |
| 601 |
\newcommand*\liffe[2]{\elim{\liff} #1, #2} |
| 602 |
|
| 603 |
\newcommand*\reit[1]{{\bf Reit:} #1} |
| 604 |
|
| 605 |
\newcommand*\eqi[0]{$=\,${\bf Intro}} |
| 606 |
\newcommand*\eqe[2]{\elim{=} #1, #2} |
| 607 |
|
| 608 |
\newcommand*\lalli[1]{\intro{\lall} #1} |
| 609 |
\newcommand*\lalle[1]{\elim{\lall} #1} |
| 610 |
|
| 611 |
\newcommand*\lexii[1]{\intro{\lis} #1} |
| 612 |
\newcommand*\lexie[2]{\elim{\lis} #1, #2} |
| 613 |
% \end{macrocode} |
| 614 |
% |
| 615 |
% \subsection{Dimensions} |
| 616 |
% |
| 617 |
% The following dimensions can be redefined with |\setlength| |
| 618 |
% |
| 619 |
% \begin{macro}{\fitchargwidth} |
| 620 |
% Width of formulas in arguments |
| 621 |
% \begin{macrocode} |
| 622 |
\newlength{\fitchargwidth} |
| 623 |
\setlength{\fitchargwidth}{3.5in} |
| 624 |
% \end{macrocode} |
| 625 |
% \end{macro} |
| 626 |
% |
| 627 |
% \begin{macro}{\fitchprfwidth} |
| 628 |
% Width of formulas in proofs |
| 629 |
% \begin{macrocode} |
| 630 |
\newlength{\fitchprfwidth} |
| 631 |
\setlength{\fitchprfwidth}{3.0in} |
| 632 |
% \end{macrocode} |
| 633 |
% \end{macro} |
| 634 |
% |
| 635 |
% \begin{macro}{\fitchctxwidth} |
| 636 |
% Width of formulas in Fitch contexts |
| 637 |
% \begin{macrocode} |
| 638 |
\newlength{\fitchctxwidth} |
| 639 |
\setlength{\fitchctxwidth}{1in} |
| 640 |
% \end{macrocode} |
| 641 |
% \end{macro} |
| 642 |
% |
| 643 |
% \begin{macro}{\fitchsep} |
| 644 |
% Distance between scope line and formula |
| 645 |
% \begin{macrocode} |
| 646 |
\newlength{\fitchsep} |
| 647 |
\setlength{\fitchsep}{10pt} |
| 648 |
% \end{macrocode} |
| 649 |
% \end{macro} |
| 650 |
% |
| 651 |
% \subsection{Contexts, Arguments, Proofs} |
| 652 |
% |
| 653 |
% \begin{macro}{\fitchctx} Typesets a Fitch context, e.g., specification of |
| 654 |
% a rule, in which a focus slider is typeset to the left of the conclusion |
| 655 |
% \begin{macrocode} |
| 656 |
\newcommand{\fitchctx}[1]{% |
| 657 |
\advance \fitchctxwidth by -\fitchsep% |
| 658 |
\advance \fitchctxwidth by .5pt% |
| 659 |
\begin{tabular}[t]{r@{}|p{\fitchctxwidth}@{}l} |
| 660 |
\phantom{\slider} \\[-1.75ex] |
| 661 |
#1 \\[-1.75ex] & & |
| 662 |
\end{tabular} |
| 663 |
\advance \fitchctxwidth by \fitchsep% |
| 664 |
\advance \fitchctxwidth by -.5pt% |
| 665 |
} |
| 666 |
% \end{macrocode} |
| 667 |
% \end{macro} |
| 668 |
% |
| 669 |
% \begin{macro}{\fitchprf} Typesets a fitch proof |
| 670 |
% \begin{macrocode} |
| 671 |
\newcommand{\fitchprf}[2]{% |
| 672 |
\advance \fitchprfwidth by -\fitchsep% |
| 673 |
\advance \fitchprfwidth by .5pt% |
| 674 |
\hspace*{.35em}% |
| 675 |
\begin{tabular}[t]{|p{0pt}@{}p{\fitchprfwidth}@{\hspace*{\fitchsep}}l} |
| 676 |
\multicolumn{3}{@{}l@{}}{\ }\\[-2.35ex] |
| 677 |
#1 \\ |
| 678 |
\ \\[-2.5ex] \cline{1-1}\\[-2ex] |
| 679 |
#2 \\ \multicolumn{3}{@{}l@{}} \ \\[-2.35ex] |
| 680 |
\end{tabular} |
| 681 |
\advance \fitchprfwidth by \fitchsep% |
| 682 |
} |
| 683 |
% \end{macrocode} |
| 684 |
% \end{macro} |
| 685 |
% \begin{macro}{\fitcharg} Typesets an argument (without line |
| 686 |
% numbers). Takes two arguments, the premises and conclusion lines of |
| 687 |
% the argument. |
| 688 |
% \begin{macrocode} |
| 689 |
\newcommand{\fitcharg}[2]{ |
| 690 |
\advance \fitchargwidth by -\fitchsep% |
| 691 |
\hspace*{.35em} |
| 692 |
\begin{tabular}[t]{|p{\fitchsep}@{}p{\fitchargwidth}@{}} |
| 693 |
\multicolumn{2}{@{}l@{}}{\ }\\[-2.35ex] |
| 694 |
#1 \\ |
| 695 |
\ \\[-2.5ex] \cline{1-1}\\[-2ex] |
| 696 |
#2 \\ \multicolumn{2}{@{}l@{}} \ \\[-2.35ex] |
| 697 |
\end{tabular} |
| 698 |
} |
| 699 |
% \end{macrocode} |
| 700 |
% \end{macro} |
| 701 |
% |
| 702 |
% \begin{macro}{\slider} Typesets the focus arrow. |
| 703 |
% \begin{macrocode} |
| 704 |
\newcommand*{\slider}{\mbox{$\triangleright \;$}} |
| 705 |
% \end{macrocode} |
| 706 |
% \end{macro} |
| 707 |
% |
| 708 |
% \begin{macro}{\pline} Typesets a proof line with an optional line |
| 709 |
% number (before the formula argument) and an optional justification |
| 710 |
% (after the formula argument) |
| 711 |
% \begin{macrocode} |
| 712 |
\def\pline{\@ifnextchar[\@plinenum{\@plinenum[\@empty]}} |
| 713 |
\def\@plinenum[#1]#2{\@ifnextchar[{\@plinex{#1}{#2}}{% |
| 714 |
\@plinex{#1}{#2}[\@empty]}} |
| 715 |
\def\@plinex#1#2[#3]{ & #1\formula{\; #2} & #3} |
| 716 |
% \end{macrocode} |
| 717 |
% \end{macro} |
| 718 |
% |
| 719 |
% \begin{macro}{\fpline} Like |pline| except produces a focus slider |
| 720 |
% on the left |
| 721 |
% \begin{macrocode} |
| 722 |
\newcommand*\fpline{\slider\pline} |
| 723 |
% \end{macrocode} |
| 724 |
% \end{macro} |
| 725 |
% |
| 726 |
% \begin{macro}{\tline} Typesets proof line containing text with an |
| 727 |
% optional line number. |
| 728 |
% \begin{macrocode} |
| 729 |
\newcommand*{\tline}[2][{}]{ & #1\hspace{.6em}{#2}} |
| 730 |
% \end{macrocode} |
| 731 |
% \end{macro} |
| 732 |
% |
| 733 |
% The following macros |\nline|, |\jline|, and |\fline| |
| 734 |
% are the commands provided in the original version |
| 735 |
% of |lplfitch| and are included for backwards compatibility. |
| 736 |
% \begin{macrocode} |
| 737 |
\newcommand*{\nline}[2][{}]{ & #1\formula{\;#2}} |
| 738 |
% \end{macrocode} |
| 739 |
% justified line (justification optional) |
| 740 |
% |\jline[justification]{args for line}| |
| 741 |
% \begin{macrocode} |
| 742 |
\newcommand*{\jline}[2][{}]{\nline#2 & #1} |
| 743 |
% \end{macrocode} |
| 744 |
% focused line |
| 745 |
% \begin{macrocode} |
| 746 |
\newcommand*{\fline}[1]{\slider \jline#1} |
| 747 |
% \end{macrocode} |
| 748 |
% |
| 749 |
% \begin{macro}{\ellipsesline} |
| 750 |
% Producing vertical ellipses in a line on their own. |
| 751 |
% This takes care of centering the ellipses in their line. |
| 752 |
% \begin{macrocode} |
| 753 |
\newcommand*{\ellipsesline}[0]{\nline{\;\raise.65ex\hbox{\vdots}}} |
| 754 |
% \end{macrocode} |
| 755 |
% \end{macro} |
| 756 |
% \begin{macro}{\subproof} |
| 757 |
% This command sets a subproof within a proof. |
| 758 |
% The arguments are the line before, and the lines after |
| 759 |
% the horizontal fitch bar. |
| 760 |
% \begin{macrocode} |
| 761 |
\newcommand{\subproof}[2]{&\fitchprf{#1}{#2}\\} |
| 762 |
% \end{macrocode} |
| 763 |
% \end{macro} |
| 764 |
% \begin{macro}{\boxedsubproof} |
| 765 |
% Produces a new boxed subproof. |
| 766 |
% |\boxedsubproof|\oarg{n}\marg{c}\marg{premise}\marg{body}, where |
| 767 |
% \meta{n} is the number of the premise line, \meta{c} is the |
| 768 |
% constant(s) to be boxed, \meta{premise} is the premise of the |
| 769 |
% subproof, and \meta{body} contains the lines of the subproof. |
| 770 |
% \begin{macrocode} |
| 771 |
\newcommand{\boxedsubproof}[4][{}]{ |
| 772 |
\subproof{\nline[#1]{\fbox{\formula{#2}}\;#3}}{#4} |
| 773 |
} |
| 774 |
% \end{macrocode} |
| 775 |
% \end{macro} |
| 776 |
% \begin{macro}{\brokenform} |
| 777 |
% A crude attempt at dealing with a formula which need to be broken to |
| 778 |
% fit in the proof. We take two arguments, the first line of the |
| 779 |
% formula which is left justified, and the remainder of the lines, |
| 780 |
% which are right justified. The first argument is set as a |
| 781 |
% |\formula| but the second is not (as it may contain line breaks |
| 782 |
% itself). |
| 783 |
% \begin{macrocode} |
| 784 |
\newcommand{\brokenform}[2]{ |
| 785 |
\advance\fitchprfwidth by-\fitchsep |
| 786 |
\begin{tabular}[c]{rp{\fitchprfwidth}} |
| 787 |
\multicolumn{1}{p{\fitchprfwidth}@{}}{\formula{#1}}\\ |
| 788 |
\formula{#2} |
| 789 |
\end{tabular} |
| 790 |
\advance\fitchprfwidth by\fitchsep |
| 791 |
} |
| 792 |
% \end{macrocode} |
| 793 |
% \end{macro} |
| 794 |
% |
| 795 |
% \Finale |
| 796 |
\endinput |