| 1 |
% \iffalse meta-comment |
| 2 |
% |
| 3 |
% |
| 4 |
% Copyright (C) 2019 by Richard Zach <[email protected]> |
| 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 |
% This work has the LPPL maintenance status `maintained'. |
| 16 |
% |
| 17 |
% The Current Maintainer of this work is Richard Zach. |
| 18 |
% |
| 19 |
% This work consists of the files bussproofs-pextra.dtx, |
| 20 |
% bussproofs-extra.ins, bussproofs-extra.sty |
| 21 |
% |
| 22 |
% \fi |
| 23 |
% |
| 24 |
% \iffalse |
| 25 |
%<*driver> |
| 26 |
\ProvidesFile{bussproofs-extra.dtx} |
| 27 |
%</driver> |
| 28 |
%<package>\NeedsTeXFormat{LaTeX2e} |
| 29 |
%<package>\ProvidesPackage{bussproofs-extra} |
| 30 |
%<package> [2019/05/31 0.4 Extra commands for bussproofs.sty] |
| 31 |
%<*driver> |
| 32 |
\documentclass{ltxdoc} |
| 33 |
|
| 34 |
\usepackage{bussproofs-extra} |
| 35 |
\usepackage[colorlinks,allcolors=blue]{hyperref} |
| 36 |
\usepackage{calc} |
| 37 |
|
| 38 |
\renewcommand{\fCenter}{\ensuremath{\,{\to}\,}} |
| 39 |
|
| 40 |
\EnableCrossrefs |
| 41 |
\RecordChanges |
| 42 |
\begin{document} |
| 43 |
\DocInput{bussproofs-extra.dtx} |
| 44 |
\PrintChanges |
| 45 |
\end{document} |
| 46 |
%</driver> |
| 47 |
% \fi |
| 48 |
% |
| 49 |
% \CheckSum{0} |
| 50 |
% |
| 51 |
% \CharacterTable |
| 52 |
% {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 |
| 53 |
% 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 |
| 54 |
% Digits \0\1\2\3\4\5\6\7\8\9 |
| 55 |
% Exclamation \! Double quote \" Hash (number) \# |
| 56 |
% Dollar \$ Percent \% Ampersand \& |
| 57 |
% Acute accent \' Left paren \( Right paren \) |
| 58 |
% Asterisk \* Plus \+ Comma \, |
| 59 |
% Minus \- Point \. Solidus \/ |
| 60 |
% Colon \: Semicolon \; Less than \< |
| 61 |
% Equals \= Greater than \> Question mark \? |
| 62 |
% Commercial at \@ Left bracket \[ Backslash \\ |
| 63 |
% Right bracket \] Circumflex \^ Underscore \_ |
| 64 |
% Grave accent \` Left brace \{ Vertical bar \| |
| 65 |
% Right brace \} Tilde \~} |
| 66 |
% |
| 67 |
% |
| 68 |
% \changes{v0.4}{2019/05/31}{Better implementation of line labels; add |
| 69 |
% shortDeduce; style deduce lines} |
| 70 |
% \changes{v0.3}{2019/04/04}{Rename to bussproofs-extra.sty} |
| 71 |
% \changes{v0.2}{2014/10/16}{Fixed bug in dotsdDeduce, added examples} |
| 72 |
% \changes{v0.1}{2014/04/26}{Initial version with deduce, linelabel functionality} |
| 73 |
% |
| 74 |
% \GetFileInfo{bussproofs-extra.sty} |
| 75 |
% |
| 76 |
% \DoNotIndex{\newcommand,\newenvironment} |
| 77 |
% |
| 78 |
% |
| 79 |
% \title{The \textsf{bussproofs-extra} package\thanks{This document |
| 80 |
% corresponds to \textsf{bussproofs-extra}~\fileversion, dated \filedate.}} |
| 81 |
% \author{\href{http://richardzach.org/}{Richard Zach}} |
| 82 |
% \date{} |
| 83 |
% |
| 84 |
% \maketitle |
| 85 |
% |
| 86 |
% \section{Introduction} |
| 87 |
% |
| 88 |
% The \textsf{bussproofs-extra} package provides additional functionality for |
| 89 |
% the proof tree typesetting package |
| 90 |
% \href{http://math.ucsd.edu/~sbuss/ResearchWeb/bussproofs/}{\textsf{bussproofs}} |
| 91 |
% by Sam Buss. It is experimental and tested only with v.1.1, and |
| 92 |
% only in \LaTeX{} mode with upward-growing trees. |
| 93 |
% Functionality provided includes: |
| 94 |
% |
| 95 |
% \begin{enumerate} |
| 96 |
% \item |\Deduce$| and |\DeduceC| commands, which work much |
| 97 |
% like |\Infer| commands but indicate missing parts of a proof. |
| 98 |
% \item Multiple styles for typesetting the result of |\Deduce|, |
| 99 |
% including |
| 100 |
% \begin{enumerate} |
| 101 |
% \item |\straightDeduce|, which produces vertical dots |
| 102 |
% \item |\branchDeduce|, which produces diagonal plus vertical dots |
| 103 |
% \item |\ddotsDeduce|, which produces diagonal dots from top left |
| 104 |
% to bottom right |
| 105 |
% \item |\dotsdDeduce|, which produces diagonal dots from top right |
| 106 |
% to bottom left |
| 107 |
% \item |\shortDeduce|, which is like |\straightDeduce| but half the length |
| 108 |
% \end{enumerate} |
| 109 |
% |\straightDeduce| is the default. It can be changed by redefining |
| 110 |
% |\alwaysDeduce|. |
| 111 |
% \item |\LeftLineLabel| and |\RightLineLabel| commands which |
| 112 |
% work like |\LeftLabel| and |\RightLabel| but place a label |
| 113 |
% next to the conclusion of an inference/deduction instead of the score |
| 114 |
% line. |
| 115 |
% \item |\LeftSubproofLabel| and |\RightSubproofLabel| commands which |
| 116 |
% work like |\LeftLabel| and |\RightLabel| but place a label |
| 117 |
% next to the entire preceding subproof with a curly brace. |
| 118 |
% \end{enumerate} |
| 119 |
% |
| 120 |
% Here's what these deductions look like: |
| 121 |
% |
| 122 |
% \begin{center} |
| 123 |
% \begin{tabular}{@{}cccc@{}} |
| 124 |
% \fbox{\AxiomC{$A$} |
| 125 |
% \straightDeduce |
| 126 |
% \DeduceC{$B$} |
| 127 |
% \DisplayProof} & |
| 128 |
% \fbox{\AxiomC{$A$} |
| 129 |
% \branchDeduce |
| 130 |
% \DeduceC{$B$} |
| 131 |
% \DisplayProof} & |
| 132 |
% \fbox{\AxiomC{$A$} |
| 133 |
% \ddotsDeduce |
| 134 |
% \DeduceC{$B$} |
| 135 |
% \DisplayProof} & |
| 136 |
% \fbox{\AxiomC{$A$} |
| 137 |
% \dotsdDeduce |
| 138 |
% \DeduceC{$B$} |
| 139 |
% \DisplayProof} \\ \\ |
| 140 |
% \fbox{\Axiom$A \fCenter B$ |
| 141 |
% \straightDeduce |
| 142 |
% \Deduce$A \lor C \fCenter B$ |
| 143 |
% \DisplayProof} & |
| 144 |
% \fbox{\Axiom$A \fCenter B$ |
| 145 |
% \branchDeduce |
| 146 |
% \Deduce$A \lor C \fCenter B$ |
| 147 |
% \DisplayProof} & |
| 148 |
% \fbox{\Axiom$A \fCenter B$ |
| 149 |
% \ddotsDeduce |
| 150 |
% \Deduce$A \lor C \fCenter B$ |
| 151 |
% \DisplayProof} & |
| 152 |
% \fbox{\Axiom$A \fCenter B$ |
| 153 |
% \dotsdDeduce |
| 154 |
% \Deduce$A \lor C \fCenter B$ |
| 155 |
% \DisplayProof} |
| 156 |
% \\ \\ |
| 157 |
% \texttt{straightDeduce} & |
| 158 |
% \texttt{branchDeduce} & |
| 159 |
% \texttt{ddotsDeduce} & |
| 160 |
% \texttt{dotsdDeduce} |
| 161 |
% \end{tabular} |
| 162 |
% \end{center} |
| 163 |
% |
| 164 |
% |
| 165 |
% The most up-to-date version of this package is available at the |
| 166 |
% \href{https://github.com/OpenLogicProject/bussproofs-extra}{Open Logic |
| 167 |
% Project github site}, where you can file bug reports as well. |
| 168 |
% |
| 169 |
% \subsection{Example} |
| 170 |
% |
| 171 |
% \begin{verbatim} |
| 172 |
% \begin{prooftree} |
| 173 |
% \AxiomC{} |
| 174 |
% \RightLabel{$\pi_1(a)$} |
| 175 |
% \Deduce$\Gamma_1 \fCenter \Theta_1, F(a)$ |
| 176 |
% \RightLabel{$\forall$R} |
| 177 |
% \UnaryInf$\Gamma_1 \fCenter \Theta_1, \forall x\,F(x)$ |
| 178 |
% \ddotsDeduce |
| 179 |
% \RightLabel{$\pi_1'$} |
| 180 |
% \Deduce$\Gamma \fCenter \Theta, \forall x\,F(x)$ |
| 181 |
% \AxiomC{} |
| 182 |
% \RightLabel{$\pi_2$} |
| 183 |
% \Deduce$F(n), \Delta_1 \fCenter \Lambda_1$ |
| 184 |
% \RightLabel{$\forall$L} |
| 185 |
% \UnaryInf$\forall x\,F(x), \Delta_1 \fCenter \Lambda_1$ |
| 186 |
% \dotsdDeduce |
| 187 |
% \RightLabel{$\pi_2'$} |
| 188 |
% \Deduce$\forall x\,F(x), \Delta \fCenter \Lambda$ |
| 189 |
% \RightLabel{cut} |
| 190 |
% \BinaryInf$\Gamma, \Delta \fCenter \Theta, \Lambda$ |
| 191 |
% \RightLabel{$\pi_4$} |
| 192 |
% \branchDeduce |
| 193 |
% \Deduce$\Pi \fCenter \Xi$ |
| 194 |
% \end{prooftree} |
| 195 |
% \end{verbatim} |
| 196 |
% produces this: |
| 197 |
% \begin{prooftree} |
| 198 |
% \AxiomC{} |
| 199 |
% \RightLabel{$\pi_1(a)$} |
| 200 |
% \Deduce$\Gamma_1 \fCenter \Theta_1, F(a)$ |
| 201 |
% \RightLabel{$\forall$R} |
| 202 |
% \UnaryInf$\Gamma_1 \fCenter \Theta_1, \forall x\,F(x)$ |
| 203 |
% \ddotsDeduce |
| 204 |
% \RightLabel{$\pi_1'$} |
| 205 |
% \Deduce$\Gamma \fCenter \Theta, \forall x\,F(x)$ |
| 206 |
% \AxiomC{} |
| 207 |
% \RightLabel{$\pi_2$} |
| 208 |
% \Deduce$F(n), \Delta_1 \fCenter \Lambda_1$ |
| 209 |
% \RightLabel{$\forall$L} |
| 210 |
% \UnaryInf$\forall x\,F(x), \Delta_1 \fCenter \Lambda_1$ |
| 211 |
% \dotsdDeduce |
| 212 |
% \RightLabel{$\pi_2'$} |
| 213 |
% \Deduce$\forall x\,F(x), \Delta \fCenter \Lambda$ |
| 214 |
% \RightLabel{cut} |
| 215 |
% \BinaryInf$\Gamma, \Delta \fCenter \Theta, \Lambda$ |
| 216 |
% \RightLabel{$\pi_4$} |
| 217 |
% \branchDeduce |
| 218 |
% \Deduce$\Pi \fCenter \Xi$ |
| 219 |
% \end{prooftree} |
| 220 |
|
| 221 |
% It is also possible to label entire subproofs on the left and on the right. |
| 222 |
% \begin{verbatim} |
| 223 |
% \begin{prooftree} |
| 224 |
% \AxiomC{} |
| 225 |
% \Deduce$\Gamma \fCenter \Delta$ |
| 226 |
% \LeftLineLabel{$S_1$} |
| 227 |
% \Deduce$\Gamma \fCenter \Delta, A$ |
| 228 |
% \LeftSubproofLabel{$\pi$} |
| 229 |
% \AxiomC{} |
| 230 |
% \Deduce$\Gamma' \fCenter \Delta'$ |
| 231 |
% \LeftLineLabel{$S_2$} |
| 232 |
% \Deduce$A, \Gamma' \fCenter \Delta'$ |
| 233 |
% \RightSubproofLabel{$\pi'$} |
| 234 |
% \RightLabel{cut} |
| 235 |
% \LeftLineLabel{$S_3$} |
| 236 |
% \BinaryInf$\Gamma, \Gamma' \fCenter \Delta, \Delta'$ |
| 237 |
% \Deduce$\Pi \fCenter \Lambda$ |
| 238 |
% \end{prooftree} |
| 239 |
% \end{verbatim} |
| 240 |
% \begin{prooftree} |
| 241 |
% \AxiomC{} |
| 242 |
% \Deduce$\Gamma \fCenter \Delta$ |
| 243 |
% \Deduce$\Gamma \fCenter \Delta, A$ |
| 244 |
% \LeftSubproofLabel{$\pi$} |
| 245 |
% \AxiomC{} |
| 246 |
% \Deduce$\Gamma' \fCenter \Delta'$ |
| 247 |
% \Deduce$A, \Gamma' \fCenter \Delta'$ |
| 248 |
% \RightSubproofLabel{$\pi'$} |
| 249 |
% \RightLabel{cut} |
| 250 |
% \BinaryInf$\Gamma, \Gamma' \fCenter \Delta, \Delta'$ |
| 251 |
% \Deduce$\Pi \fCenter \Lambda$ |
| 252 |
% \end{prooftree} |
| 253 |
% |
| 254 |
% The |\LeftLineLabel| and |\RightLineLabel| commands add labels to |
| 255 |
% the sequent or formula produced by the following |\Axiom|, |\XxxxInf|, |
| 256 |
% and |\Deduce| command. |
| 257 |
% \begin{prooftree} |
| 258 |
% \LeftLineLabel{$S_1$} |
| 259 |
% \RightLineLabel{$S_1$} |
| 260 |
% \Axiom$\phantom{A, {}}\Gamma \fCenter \Delta$ |
| 261 |
% \LeftLineLabel{$S_2$} |
| 262 |
% \RightLineLabel{$S_2$} |
| 263 |
% \UnaryInf$A, \Gamma \fCenter \Delta, B$ |
| 264 |
% \LeftLineLabel{$S_3$} |
| 265 |
% \Deduce$\Pi \fCenter \Lambda$ |
| 266 |
% \LeftLineLabel{$S_1'$} |
| 267 |
% \AxiomC{\makebox[\widthof{$A \lor B$}][c]{$A$}} |
| 268 |
% \LeftLineLabel{$S_2'$} |
| 269 |
% \UnaryInfC{$A \lor B$} |
| 270 |
% \LeftLineLabel{$S_3'$} |
| 271 |
% \DeduceC{$C$} |
| 272 |
% \LeftLineLabel{$S_4$} |
| 273 |
% \BinaryInf$\Pi \fCenter \Lambda$ |
| 274 |
% \RightLineLabel{$S_5$} |
| 275 |
% \UnaryInf$\Pi \fCenter \Lambda$ |
| 276 |
% \end{prooftree} |
| 277 |
% If the sequent or formula is itself a premise of an |\XxxInf| |
| 278 |
% command and the conclusion is longer, this may produce a less |
| 279 |
% than optimal result, as the label is produced before the score |
| 280 |
% line below (compare the left and right labels of the top left |
| 281 |
% sequent above). In that case you may want to insert extra space |
| 282 |
% using |\phantom|, or use |\makebox| and the |\widthof| command |
| 283 |
% of the |calc| package for the |XxxC| variants of the commands |
| 284 |
% (see the top right formula below) as in the |\Axiom| commands |
| 285 |
% below. |
| 286 |
% \begin{verbatim} |
| 287 |
% \begin{prooftree} |
| 288 |
% \LeftLineLabel{$S_1$} |
| 289 |
% \RightLineLabel{$S_1$} |
| 290 |
% \Axiom$\phantom{A, {}}\Gamma \fCenter \Delta$ |
| 291 |
% \LeftLineLabel{$S_2$} |
| 292 |
% \RightLineLabel{$S_2$} |
| 293 |
% \UnaryInf$A, \Gamma \fCenter \Delta, B$ |
| 294 |
% \LeftLineLabel{$S_3$} |
| 295 |
% \Deduce$\Pi \fCenter \Lambda$ |
| 296 |
% \LeftLineLabel{$S_1'$} |
| 297 |
% \AxiomC{\makebox[\widthof{$A \lor B$}][c]{$A$}} |
| 298 |
% \LeftLineLabel{$S_2'$} |
| 299 |
% \UnaryInfC{$A \lor B$} |
| 300 |
% \LeftLineLabel{$S_3'$} |
| 301 |
% \DeduceC{$C$} |
| 302 |
% \LeftLineLabel{$S_4$} |
| 303 |
% \BinaryInf$\Pi \fCenter \Lambda$ |
| 304 |
% \RightLineLabel{$S_5$} |
| 305 |
% \UnaryInf$\Pi \fCenter \Lambda$ |
| 306 |
% \end{prooftree} |
| 307 |
% \end{verbatim} |
| 308 |
% |
| 309 |
% \StopEventually{} |
| 310 |
% |
| 311 |
% \section{Implementation} |
| 312 |
% |
| 313 |
% \subsection{Setup} |
| 314 |
% |
| 315 |
% We require \textsf{bussproofs} (obviously) and and \textsf{tikz} for |
| 316 |
% drawing things. |
| 317 |
% |
| 318 |
% \begin{macrocode} |
| 319 |
\RequirePackage{bussproofs} |
| 320 |
\RequirePackage{tikz} |
| 321 |
% \end{macrocode} |
| 322 |
% \subsection{Dimensions and boxes} |
| 323 |
% |
| 324 |
% \textsf{bussproofs} aligns sequents at the right end of the sequent |
| 325 |
% arrow, so we need to remember by how much to correct to get |
| 326 |
% deductions to the middle of sequents. For |\ddotsDeduce| and |
| 327 |
% |\dotsdDeduce| (diagonal) styles, the upper and lower sequents will be |
| 328 |
% displaced. |
| 329 |
% \begin{macrocode} |
| 330 |
\newdimen\CenterCorrection |
| 331 |
\newdimen\DiagCorrection |
| 332 |
% \end{macrocode} |
| 333 |
% We need two boxes to hold the left and right line labels. |
| 334 |
% \begin{macrocode} |
| 335 |
\newbox\myBoxLLL |
| 336 |
\newbox\myBoxRLL |
| 337 |
% \end{macrocode} |
| 338 |
% \subsection{Deduce Styles} |
| 339 |
% |
| 340 |
% The following commands set the style for the next |\Deduce| |
| 341 |
% command. |\straightDeduce| produces a simple vertical line of dots, |
| 342 |
% and |\shortDeduce| a line of half that length. |
| 343 |
% |\branchDeduce| produces centered branching (Takeuti/Gentzen-style) |
| 344 |
% dots, |\ddotsDeduce| left-to-right diagonal dots, and |\dotsdDeduce| |
| 345 |
% right-to-left diagonal dots. They do this by redefining the |
| 346 |
% |\fDeduce| command which produces the dots and sets up the |
| 347 |
% dimensions. The TikZ style |deduceLine| is used as argument to the |
| 348 |
% |\draw| command and can be redefined for other line styles as well |
| 349 |
% (e.g., smaller dots or closer spacing). |
| 350 |
% \begin{macrocode} |
| 351 |
\tikzset{ |
| 352 |
deduceLine/.style = {line width=1.1pt, loosely dotted}} |
| 353 |
|
| 354 |
\def\straightDeduce{% |
| 355 |
\gdef\fDeduce{\tikz\draw[deduceLine] (0,0) -- (0,1);} |
| 356 |
\global\DiagCorrection=0pt |
| 357 |
\ignorespaces |
| 358 |
} |
| 359 |
|
| 360 |
\def\shortDeduce{% |
| 361 |
\gdef\fDeduce{\tikz\draw[deduceLine] (0,0) -- (0,.5);} |
| 362 |
\global\DiagCorrection=0pt |
| 363 |
\ignorespaces |
| 364 |
} |
| 365 |
|
| 366 |
\def\branchDeduce{% |
| 367 |
\gdef\fDeduce{\begin{tikzpicture} |
| 368 |
\draw[deduceLine] (0,0) -- (0,1); |
| 369 |
\draw[deduceLine] (-.5,.5) -- (0,0); |
| 370 |
\draw[deduceLine] (.5,.5) -- (0,0); |
| 371 |
\end{tikzpicture}} |
| 372 |
\global\DiagCorrection=0pt |
| 373 |
\ignorespaces |
| 374 |
} |
| 375 |
|
| 376 |
\def\ddotsDeduce{% |
| 377 |
\gdef\fDeduce{\begin{tikzpicture} |
| 378 |
\draw[deduceLine] (0,1) -- (1,0); |
| 379 |
\end{tikzpicture}} |
| 380 |
\setbox\myBoxA=\hbox{\fDeduce} |
| 381 |
\global\DiagCorrection=-\wd\myBoxA |
| 382 |
\ignorespaces |
| 383 |
} |
| 384 |
|
| 385 |
\def\dotsdDeduce{% |
| 386 |
\gdef\fDeduce{\begin{tikzpicture} |
| 387 |
\draw[deduceLine] (1,1) -- (0,0); |
| 388 |
\end{tikzpicture}} |
| 389 |
\setbox\myBoxA=\hbox{\fDeduce} |
| 390 |
\global\DiagCorrection=\wd\myBoxA |
| 391 |
\ignorespaces |
| 392 |
} |
| 393 |
% \end{macrocode} |
| 394 |
% The |\alwaysDeduce| command is used to (re)set the |
| 395 |
% deduce style to a default and is executed every time a deduction is |
| 396 |
% typeset. It can be redefined to change the default deduce style. |
| 397 |
% \begin{macrocode} |
| 398 |
\def\alwaysDeduce{\straightDeduce} |
| 399 |
\straightDeduce |
| 400 |
% \end{macrocode} |
| 401 |
% \subsection{\texttt{\textbackslash Deduce\$} and |
| 402 |
% \texttt{\textbackslash DeduceC}} |
| 403 |
% |
| 404 |
% |\Deduce$| and |\DeduceC| are the commands to actually produce the |
| 405 |
% deductions. They are used and work just like |\UnaryInf$| and |
| 406 |
% |\UnaryInfC|. |
| 407 |
% \begin{macrocode} |
| 408 |
\def\Deduce$#1\fCenter#2${% |
| 409 |
\prepUnary% |
| 410 |
\buildConclusion{#1}{#2}% |
| 411 |
\setbox\myBoxA=\hbox{\fCenter}% |
| 412 |
\global\CenterCorrection=-.5\wd\myBoxA |
| 413 |
\joinDeduce% |
| 414 |
\resetInferenceDefaults% |
| 415 |
\ignorespaces% |
| 416 |
} |
| 417 |
|
| 418 |
\def\DeduceC#1{ |
| 419 |
\prepUnary% |
| 420 |
\buildConclusionC{#1}% |
| 421 |
\global\CenterCorrection=0pt |
| 422 |
\joinDeduce% |
| 423 |
\resetInferenceDefaults% |
| 424 |
\ignorespaces% |
| 425 |
} |
| 426 |
% \end{macrocode} |
| 427 |
% \section{Typesetting the Deduction} |
| 428 |
% |
| 429 |
% |\joinDeduce| aligns and joins |\curBox| and |\myBoxC| into a single |
| 430 |
% |vbox|. |\curBox| holds the upper proof, |\curScoreStart| is |
| 431 |
% distance to where the line below the premise would start, |
| 432 |
% |\curScoreCenter| is distance from left edge of score to the |
| 433 |
% alignment point, and |\curScoreEnd| is width of the score line. |
| 434 |
% \begin{macrocode} |
| 435 |
|
| 436 |
\def\joinDeduce{% |
| 437 |
\global\advance\curCenter by -\hypKernAmt% |
| 438 |
% \end{macrocode} |
| 439 |
% If center of premise is left of center of conclusion move upper box |
| 440 |
% to right by difference, else move lower box right by difference |
| 441 |
% \begin{macrocode} |
| 442 |
\ifnum\curCenter<\newCenter% |
| 443 |
\displace=\newCenter% |
| 444 |
\advance \displace by -\curCenter% |
| 445 |
\kernUpperBox% |
| 446 |
\else% |
| 447 |
\displace=\curCenter% |
| 448 |
\advance \displace by -\newCenter% |
| 449 |
\kernLowerBox% |
| 450 |
\fi% |
| 451 |
% \end{macrocode} |
| 452 |
% For |\ddotsDeduce|, move lower box right; for |\dotsdDeduce|, move |
| 453 |
% upper box right; then set |\curCenter| to align with horizontal center |
| 454 |
% of dots. |
| 455 |
% \begin{macrocode} |
| 456 |
\ifnum\DiagCorrection<0% |
| 457 |
\displace=-\DiagCorrection |
| 458 |
\kernLowerBox% |
| 459 |
\else |
| 460 |
\displace=\DiagCorrection |
| 461 |
\kernUpperBox% |
| 462 |
\fi% |
| 463 |
\advance\curCenter by-.5\DiagCorrection |
| 464 |
% \end{macrocode} |
| 465 |
% Now we draw the deduction. |
| 466 |
% \begin{macrocode} |
| 467 |
\buildDeduce% |
| 468 |
% \end{macrocode} |
| 469 |
% Put the deduction and labels into a box. |
| 470 |
% \begin{macrocode} |
| 471 |
\buildScoreLabels% |
| 472 |
% \end{macrocode} |
| 473 |
% Put everything into a new box and compute the dimensions for the |
| 474 |
% next |\Deduce| or |\XxxxInf|. |
| 475 |
% \begin{macrocode} |
| 476 |
\ifx\rootAtBottomFlag\myTrue% |
| 477 |
\buildRootBottom% |
| 478 |
\else% |
| 479 |
\buildRootTop% |
| 480 |
\fi% |
| 481 |
\global \curScoreStart=\newScoreStart% |
| 482 |
\global \curScoreEnd=\newScoreEnd% |
| 483 |
\global \curCenter=\newCenter% |
| 484 |
} |
| 485 |
% \end{macrocode} |
| 486 |
% |\buildDeduce| does for |\DeduceX| what |\buildInf| does for |
| 487 |
% |\XxxInf|: put the deduction bit (dots) into a box and set the |
| 488 |
% dimensions properly. |
| 489 |
% \begin{macrocode} |
| 490 |
|
| 491 |
\def\buildDeduce{% |
| 492 |
\global\setbox \myBoxD =% |
| 493 |
\hbox{\fDeduce}% |
| 494 |
\displace = \wd\myBoxD % find width of vdots |
| 495 |
% \end{macrocode} |
| 496 |
% set start and end of current score to left and right of the box |
| 497 |
% holding the deduction. |
| 498 |
% \begin{macrocode} |
| 499 |
\global\curScoreStart = \curCenter% |
| 500 |
\global\advance\curScoreStart by -.5\displace% |
| 501 |
\global\curScoreEnd = \curCenter% |
| 502 |
\global\advance\curScoreEnd by .5\displace% |
| 503 |
\global\advance\curScoreStart by\CenterCorrection |
| 504 |
\global\advance\curScoreEnd by\CenterCorrection |
| 505 |
} |
| 506 |
% \end{macrocode} |
| 507 |
% \subsection{Line Labels} |
| 508 |
% |
| 509 |
% |\LeftLineLabel| and |\RightLineLabel| set the label to place to the |
| 510 |
% left or right, respectively, of the conclusion of the next |\Axiom|, |
| 511 |
% |\XxxInf| or |\Deduce| command. They are aligned with the text |
| 512 |
% produced by |\LeftLabel| and |\RightLabel| (i.e., the distance to |
| 513 |
% the line is $|\ScoreOverhang| + |\labelSpacing|$. |
| 514 |
% \begin{macrocode} |
| 515 |
|
| 516 |
\def\LeftLineLabel#1{% |
| 517 |
\global\def\displayLeftLineLabel{% |
| 518 |
{#1\hskip\labelSpacing}} |
| 519 |
\ignorespaces} |
| 520 |
|
| 521 |
\def\RightLineLabel#1{% |
| 522 |
\global\def\displayRightLineLabel{% |
| 523 |
{\hskip\labelSpacing #1}} |
| 524 |
\ignorespaces} |
| 525 |
|
| 526 |
\global\let\displayLeftLineLabel\relax |
| 527 |
\global\let\displayRightLineLabel\relax |
| 528 |
% \end{macrocode} |
| 529 |
% |
| 530 |
% \subsection{Subproof Labels} |
| 531 |
% Sometimes you'd like to lable entire subproofs. This is done with |
| 532 |
% commands |\LeftSubproofLabel| and |\RightSubproofLabel|. |
| 533 |
% \begin{macrocode} |
| 534 |
|
| 535 |
\def\LeftSubproofLabel#1{% |
| 536 |
\global\setbox\curBox = |
| 537 |
\hbox{\vbox to \ht\curBox{% |
| 538 |
\vfil |
| 539 |
\llap{#1$\left\{\vrule height .5\ht\curBox width 0pt\right.$}% |
| 540 |
\vfil}\box\curBox}% |
| 541 |
} |
| 542 |
|
| 543 |
\def\RightSubproofLabel#1{% |
| 544 |
\displace=\ht\curBox |
| 545 |
\global\setbox\curBox = |
| 546 |
\hbox{\box\curBox\vbox to \displace{% |
| 547 |
\vfil |
| 548 |
\rlap{$\left.\vrule height .5\displace width 0pt\right\}$#1}% |
| 549 |
\vfil}}% |
| 550 |
} |
| 551 |
% \end{macrocode} |
| 552 |
% \subsection{Patched commands from \textsf{bussproofs}} |
| 553 |
% |
| 554 |
% Some commands from \textsf{bussproofs.sty} have to be redefined to include |
| 555 |
% |bussproofs-extra| functionality. Added/changed lines are indicated by a |
| 556 |
% |%bpextra| comment |
| 557 |
% \begin{macrocode} |
| 558 |
\def\resetInferenceDefaults{% |
| 559 |
\global\def\theHypSeparation{\defaultHypSeparation}% |
| 560 |
\global\setbox\myBoxLL=\hbox{\defaultLeftLabel}% |
| 561 |
\global\setbox\myBoxRL=\hbox{\defaultRightLabel}% |
| 562 |
\global\def\buildScore{\alwaysBuildScore}% |
| 563 |
\global\def\theScoreFiller{\alwaysScoreFiller}% |
| 564 |
% reset line labels to nothing %bpextra |
| 565 |
\global\let\displayLeftLineLabel\relax %bpextra |
| 566 |
\global\let\displayRightLineLabel\relax %bpextra |
| 567 |
% reset to defaul deduce style %bpextra |
| 568 |
\alwaysDeduce %bpextra |
| 569 |
\gdef\hypKernAmt{0pt}% Restore to zero kerning. |
| 570 |
} |
| 571 |
|
| 572 |
\def\Axiom$#1\fCenter#2${% |
| 573 |
% Get level and correct names set. |
| 574 |
\prepAxiom% |
| 575 |
% Define the boxes |
| 576 |
% bpextra -- add line labels |
| 577 |
\setbox\myBoxA=\hbox{$\mathord{#1}\fCenter\mathord{\relax}$}% |
| 578 |
\setbox\myBoxB=\hbox{$#2$}% %bpextra |
| 579 |
\setbox\myBoxLLL=\hbox{\displayLeftLineLabel}% %bpextra |
| 580 |
\setbox\myBoxRLL=\hbox{\displayRightLineLabel}% %bpextra |
| 581 |
\global\setbox\curBox=% |
| 582 |
\hbox{\unhcopy\myBoxLLL%bpextra |
| 583 |
\hskip\ScoreOverhangLeft\relax |
| 584 |
\unhcopy\myBoxA |
| 585 |
\unhcopy\myBoxB |
| 586 |
\hskip\ScoreOverhangRight |
| 587 |
\unhcopy\myBoxRLL}%bpextra |
| 588 |
% Set the relevant dimensions for the boxes |
| 589 |
\global\curScoreStart=0pt \relax |
| 590 |
\global\curScoreEnd=\wd\curBox \relax |
| 591 |
\global\curCenter=\wd\myBoxA \relax %bpextra |
| 592 |
\global\advance \curCenter by \ScoreOverhangLeft% |
| 593 |
% bpextra adjust by dimensions of labels |
| 594 |
\global\advance \curCenter by \wd\myBoxLLL%bpextra |
| 595 |
\global\advance\curScoreStart by \wd\myBoxLLL%bpextra |
| 596 |
\global\advance\curScoreEnd by -\wd\myBoxRLL%bpextra |
| 597 |
% reset line labels to nothing %bpextra |
| 598 |
\global\let\displayLeftLineLabel\relax %bpextra |
| 599 |
\global\let\displayRightLineLabel\relax %bpextra |
| 600 |
\ignorespaces |
| 601 |
} |
| 602 |
|
| 603 |
\def\AxiomC#1{ % Note argument not in math mode |
| 604 |
% Get level and correct names set. |
| 605 |
\prepAxiom% |
| 606 |
% Define the box. |
| 607 |
\setbox\myBoxA=\hbox{#1}% |
| 608 |
\setbox\myBoxLLL=\hbox{\displayLeftLineLabel}% %bpextra |
| 609 |
\setbox\myBoxRLL=\hbox{\displayRightLineLabel}% %bpextra |
| 610 |
\global\setbox\curBox =% |
| 611 |
\hbox{\unhcopy\myBoxLLL%bpextra |
| 612 |
\hskip\ScoreOverhangLeft\relax% |
| 613 |
\unhcopy\myBoxA |
| 614 |
\hskip\ScoreOverhangRight\relax |
| 615 |
\unhcopy\myBoxRLL}% %bpextra |
| 616 |
% Set the relevant dimensions for the boxes |
| 617 |
\global\curScoreStart=0pt \relax |
| 618 |
\global\curScoreEnd=\wd\curBox \relax |
| 619 |
\global\curCenter=.5\wd\myBoxA \relax %bpextra |
| 620 |
\global\advance \curCenter by \ScoreOverhangLeft% |
| 621 |
% bpextra adjust by dimensions of labels |
| 622 |
\global\advance \curCenter by \wd\myBoxLLL%bpextra |
| 623 |
\global\advance\curScoreStart by \wd\myBoxLLL%bpextra |
| 624 |
\global\advance\curScoreEnd by -\wd\myBoxRLL%bpextra |
| 625 |
% reset line labels to nothing %bpextra |
| 626 |
\global\let\displayLeftLineLabel\relax %bpextra |
| 627 |
\global\let\displayRightLineLabel\relax %bpextra |
| 628 |
\ignorespaces |
| 629 |
} |
| 630 |
|
| 631 |
\def\buildConclusion#1#2{% Build lower sequent w/ center at \fCenter position. |
| 632 |
% Define the boxes |
| 633 |
\setbox\myBoxA=\hbox{$\mathord{#1}\fCenter\mathord{\relax}$}% |
| 634 |
\setbox\myBoxB=\hbox{$#2$}% |
| 635 |
\setbox\myBoxLLL=\hbox{\displayLeftLineLabel}% %bpextra |
| 636 |
\setbox\myBoxRLL=\hbox{\displayRightLineLabel}% %bpextra |
| 637 |
% Put them together in \myBoxC |
| 638 |
\setbox\myBoxC =% |
| 639 |
\hbox{\unhcopy\myBoxLLL%bpextra |
| 640 |
\hskip\ScoreOverhangLeft\relax% |
| 641 |
\unhcopy\myBoxA\unhcopy\myBoxB |
| 642 |
\hskip\ScoreOverhangRight |
| 643 |
\unhcopy\myBoxRLL}% %bpextra |
| 644 |
% Calculate the center of the \myBoxC string. |
| 645 |
\newScoreStart=0pt \relax% |
| 646 |
\newCenter=\wd\myBoxA \relax% |
| 647 |
\advance \newCenter by \ScoreOverhangLeft% |
| 648 |
\newScoreEnd=\wd\myBoxC% |
| 649 |
% bpextra adjust by dimensions of labels |
| 650 |
\global\advance\newCenter by \wd\myBoxLLL%bpextra |
| 651 |
\global\advance\newScoreStart by \wd\myBoxLLL%bpextra |
| 652 |
\global\advance\newScoreEnd by -\wd\myBoxRLL%bpextra |
| 653 |
% reset line labels to nothing %bpextra |
| 654 |
\global\let\displayLeftLineLabel\relax %bpextra |
| 655 |
\global\let\displayRightLineLabel\relax %bpextra |
| 656 |
} |
| 657 |
|
| 658 |
\def\buildConclusionC#1{% Build lower sequent w/o \fCenter present. |
| 659 |
% Define the box. |
| 660 |
\setbox\myBoxA=\hbox{#1}% |
| 661 |
\setbox\myBoxLLL=\hbox{\displayLeftLineLabel}% %bpextra |
| 662 |
\setbox\myBoxRLL=\hbox{\displayRightLineLabel}% %bpextra |
| 663 |
\setbox\myBoxC =% |
| 664 |
\hbox{\unhcopy\myBoxLLL%bpextra |
| 665 |
\hskip\ScoreOverhangLeft\relax% |
| 666 |
\unhcopy\myBoxA |
| 667 |
\hskip\ScoreOverhangRight |
| 668 |
\unhcopy\myBoxRLL}%bpextra |
| 669 |
% Calculate kerning to line up centers |
| 670 |
\newScoreStart=0pt \relax% |
| 671 |
\newCenter=.5\wd\myBoxA \relax% bpextra |
| 672 |
\newScoreEnd=\wd\myBoxC% |
| 673 |
\advance \newCenter by \ScoreOverhangLeft% |
| 674 |
% bpextra adjust by dimensions of labels |
| 675 |
\global\advance\newCenter by \wd\myBoxLLL%bpextra |
| 676 |
\global\advance\newScoreStart by \wd\myBoxLLL%bpextra |
| 677 |
\global\advance\newScoreEnd by -\wd\myBoxRLL%bpextra |
| 678 |
% reset line labels to nothing %bpextra |
| 679 |
\global\let\displayLeftLineLabel\relax %bpextra |
| 680 |
\global\let\displayRightLineLabel\relax %bpextra |
| 681 |
} |
| 682 |
% \end{macrocode} |
| 683 |
% \Finale |
| 684 |
% \PrintChanges |
| 685 |
\endinput |