| 3126 |      1 | \ProvidesPackage{proof}[1995/05/22]
 | 
|  |      2 | %       proof.sty       (Proof Figure Macros)
 | 
| 3095 |      3 | %
 | 
| 3126 |      4 | %       version 2.0
 | 
|  |      5 | %       June 24, 1991
 | 
|  |      6 | %       Copyright (C) 1990,1991 Makoto Tatsuta (tatsuta@riec.tohoku.ac.jp)
 | 
|  |      7 | %
 | 
|  |      8 | %Modified for LaTeX-2e by L. C. Paulson
 | 
| 3095 |      9 | % 
 | 
|  |     10 | % This program is free software; you can redistribute it or modify
 | 
|  |     11 | % it under the terms of the GNU General Public License as published by
 | 
|  |     12 | % the Free Software Foundation; either versions 1, or (at your option)
 | 
|  |     13 | % any later version.
 | 
|  |     14 | % 
 | 
|  |     15 | % This program is distributed in the hope that it will be useful
 | 
|  |     16 | % but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
|  |     17 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
|  |     18 | % GNU General Public License for more details.
 | 
|  |     19 | %
 | 
| 3126 |     20 | %       Usage:
 | 
|  |     21 | %               In \documentstyle, specify an optional style `proof', say,
 | 
|  |     22 | %                       \documentstyle[proof]{article}.
 | 
|  |     23 | %
 | 
|  |     24 | %       The following macros are available:
 | 
| 3095 |     25 | %
 | 
| 3126 |     26 | %       In all the following macros, all the arguments such as
 | 
|  |     27 | %       <Lowers> and <Uppers> are processed in math mode.
 | 
| 3095 |     28 | %
 | 
| 3126 |     29 | %       \infer<Lower><Uppers>
 | 
|  |     30 | %               draws an inference.
 | 
| 3095 |     31 | %
 | 
| 3126 |     32 | %               Use & in <Uppers> to delimit upper formulae.
 | 
|  |     33 | %               <Uppers> consists more than 0 formulae.
 | 
| 3095 |     34 | %
 | 
| 3126 |     35 | %               \infer returns \hbox{ ... } or \vbox{ ... } and
 | 
|  |     36 | %               sets \@LeftOffset and \@RightOffset globally.
 | 
| 3095 |     37 | %
 | 
| 3126 |     38 | %       \infer[<Label>]<Lower><Uppers>
 | 
|  |     39 | %               draws an inference labeled with <Label>.
 | 
| 3095 |     40 | %
 | 
| 3126 |     41 | %       \infer*<Lower><Uppers>
 | 
|  |     42 | %               draws a many step deduction.
 | 
| 3095 |     43 | %
 | 
| 3126 |     44 | %       \infer*[<Label>]<Lower><Uppers>
 | 
|  |     45 | %               draws a many step deduction labeled with <Label>.
 | 
| 3095 |     46 | %
 | 
| 3126 |     47 | %       \infer=<Lower><Uppers>
 | 
|  |     48 | %               draws a double-ruled deduction.
 | 
| 3095 |     49 | %
 | 
| 3126 |     50 | %       \infer=[<Label>]<Lower><Uppers>
 | 
|  |     51 | %               draws a double-ruled deduction labeled with <Label>.
 | 
| 3095 |     52 | %
 | 
| 3126 |     53 | %       \deduce<Lower><Uppers>
 | 
|  |     54 | %               draws an inference without a rule.
 | 
| 3095 |     55 | %
 | 
| 3126 |     56 | %       \deduce[<Proof>]<Lower><Uppers>
 | 
|  |     57 | %               draws a many step deduction with a proof name.
 | 
|  |     58 | %
 | 
|  |     59 | %       Example:
 | 
|  |     60 | %               If you want to write
 | 
|  |     61 | %                           B C
 | 
|  |     62 | %                          -----
 | 
|  |     63 | %                      A     D
 | 
|  |     64 | %                     ----------
 | 
|  |     65 | %                         E
 | 
|  |     66 | %       use
 | 
|  |     67 | %               \infer{E}{
 | 
|  |     68 | %                       A
 | 
|  |     69 | %                       &
 | 
|  |     70 | %                       \infer{D}{B & C}
 | 
|  |     71 | %               }
 | 
| 3095 |     72 | %
 | 
|  |     73 | 
 | 
| 3126 |     74 | %       Style Parameters
 | 
| 3095 |     75 | 
 | 
| 3126 |     76 | \newdimen\inferLineSkip         \inferLineSkip=2pt
 | 
|  |     77 | \newdimen\inferLabelSkip        \inferLabelSkip=5pt
 | 
| 3095 |     78 | \def\inferTabSkip{\quad}
 | 
|  |     79 | 
 | 
| 3126 |     80 | %       Variables
 | 
| 3095 |     81 | 
 | 
| 3126 |     82 | \newdimen\@LeftOffset   % global
 | 
|  |     83 | \newdimen\@RightOffset  % global
 | 
|  |     84 | \newdimen\@SavedLeftOffset      % safe from users
 | 
| 3095 |     85 | 
 | 
|  |     86 | \newdimen\UpperWidth
 | 
|  |     87 | \newdimen\LowerWidth
 | 
|  |     88 | \newdimen\LowerHeight
 | 
|  |     89 | \newdimen\UpperLeftOffset
 | 
|  |     90 | \newdimen\UpperRightOffset
 | 
|  |     91 | \newdimen\UpperCenter
 | 
|  |     92 | \newdimen\LowerCenter
 | 
|  |     93 | \newdimen\UpperAdjust
 | 
|  |     94 | \newdimen\RuleAdjust
 | 
|  |     95 | \newdimen\LowerAdjust
 | 
|  |     96 | \newdimen\RuleWidth
 | 
|  |     97 | \newdimen\HLabelAdjust
 | 
|  |     98 | \newdimen\VLabelAdjust
 | 
|  |     99 | \newdimen\WidthAdjust
 | 
|  |    100 | 
 | 
|  |    101 | \newbox\@UpperPart
 | 
|  |    102 | \newbox\@LowerPart
 | 
|  |    103 | \newbox\@LabelPart
 | 
|  |    104 | \newbox\ResultBox
 | 
|  |    105 | 
 | 
| 3126 |    106 | %       Flags
 | 
| 3095 |    107 | 
 | 
| 3126 |    108 | \newif\if@inferRule     % whether \@infer draws a rule.
 | 
|  |    109 | \newif\if@DoubleRule    % whether \@infer draws doulbe rules.
 | 
|  |    110 | \newif\if@ReturnLeftOffset      % whether \@infer returns \@LeftOffset.
 | 
|  |    111 | \newif\if@MathSaved     % whether inner math mode where \infer or
 | 
|  |    112 |                         % \deduce appears.
 | 
| 3095 |    113 | 
 | 
| 3126 |    114 | %       Special Fonts
 | 
| 3095 |    115 | 
 | 
|  |    116 | \def\DeduceSym{\vtop{\baselineskip4\p@ \lineskiplimit\z@
 | 
|  |    117 |     \vbox{\hbox{.}\hbox{.}\hbox{.}}\hbox{.}}}
 | 
|  |    118 | 
 | 
| 3126 |    119 | %       Math Save Macros
 | 
| 3095 |    120 | %
 | 
| 3126 |    121 | %       \@SaveMath is called in the very begining of toplevel macros
 | 
|  |    122 | %       which are \infer and \deduce.
 | 
|  |    123 | %       \@RestoreMath is called in the very last before toplevel macros end.
 | 
|  |    124 | %       Remark \infer and \deduce ends calling \@infer.
 | 
|  |    125 | %TEMPORARILY DELETED BY LCP DUE TO CONFLICT WITH CLASS "amsmath.sty"
 | 
| 3095 |    126 | 
 | 
| 3126 |    127 | \def\@SaveMath{}
 | 
| 3095 |    128 | 
 | 
| 3126 |    129 | \def\@RestoreMath{}
 | 
| 3095 |    130 | 
 | 
| 3126 |    131 | %       Macros
 | 
| 3095 |    132 | 
 | 
|  |    133 | \def\@ifEmpty#1#2#3{\def\@tempa{\@empty}\def\@tempb{#1}\relax
 | 
| 3126 |    134 |         \ifx \@tempa \@tempb #2\else #3\fi }
 | 
|  |    135 | 
 | 
|  |    136 | \def\infer{\@SaveMath \@ifnextchar *{\@inferSteps}{\relax
 | 
|  |    137 |         \@ifnextchar ={\@inferDoubleRule}{\@inferOneStep}}}
 | 
| 3095 |    138 | 
 | 
| 3126 |    139 | \def\@inferOneStep{\@inferRuletrue \@DoubleRulefalse
 | 
|  |    140 |         \@ifnextchar [{\@infer}{\@infer[\@empty]}}
 | 
| 3095 |    141 | 
 | 
| 3126 |    142 | \def\@inferDoubleRule={\@inferRuletrue \@DoubleRuletrue
 | 
|  |    143 |         \@ifnextchar [{\@infer}{\@infer[\@empty]}}
 | 
| 3095 |    144 | 
 | 
|  |    145 | \def\@inferSteps*{\@ifnextchar [{\@@inferSteps}{\@@inferSteps[\@empty]}}
 | 
|  |    146 | 
 | 
|  |    147 | \def\@@inferSteps[#1]{\@deduce{#1}[\DeduceSym]}
 | 
|  |    148 | 
 | 
|  |    149 | \def\deduce{\@SaveMath \@ifnextchar [{\@deduce{\@empty}}
 | 
| 3126 |    150 |         {\@inferRulefalse \@infer[\@empty]}}
 | 
| 3095 |    151 | 
 | 
| 3126 |    152 | %       \@deduce<Proof Label>[<Proof>]<Lower><Uppers>
 | 
| 3095 |    153 | 
 | 
|  |    154 | \def\@deduce#1[#2]#3#4{\@inferRulefalse
 | 
| 3126 |    155 |         \@infer[\@empty]{#3}{\@SaveMath \@infer[{#1}]{#2}{#4}}}
 | 
| 3095 |    156 | 
 | 
| 3126 |    157 | %       \@infer[<Label>]<Lower><Uppers>
 | 
|  |    158 | %               If \@inferRuletrue, it draws a rule and <Label> is right to
 | 
|  |    159 | %               a rule. In this case, if \@DoubleRuletrue, it draws
 | 
|  |    160 | %               double rules.
 | 
|  |    161 | %
 | 
|  |    162 | %               Otherwise, draws no rule and <Label> is right to <Lower>.
 | 
| 3095 |    163 | 
 | 
|  |    164 | \def\@infer[#1]#2#3{\relax
 | 
|  |    165 | % Get parameters
 | 
| 3126 |    166 |         \if@ReturnLeftOffset \else \@SavedLeftOffset=\@LeftOffset \fi
 | 
|  |    167 |         \setbox\@LabelPart=\hbox{$#1$}\relax
 | 
|  |    168 |         \setbox\@LowerPart=\hbox{$#2$}\relax
 | 
| 3095 |    169 | %
 | 
| 3126 |    170 |         \global\@LeftOffset=0pt
 | 
|  |    171 |         \setbox\@UpperPart=\vbox{\tabskip=0pt \halign{\relax
 | 
|  |    172 |                 \global\@RightOffset=0pt \@ReturnLeftOffsettrue $##$&&
 | 
|  |    173 |                 \inferTabSkip
 | 
|  |    174 |                 \global\@RightOffset=0pt \@ReturnLeftOffsetfalse $##$\cr
 | 
|  |    175 |                 #3\cr}}\relax
 | 
|  |    176 | %                       Here is a little trick.
 | 
|  |    177 | %                       \@ReturnLeftOffsettrue(false) influences on \infer or
 | 
|  |    178 | %                       \deduce placed in ## locally
 | 
|  |    179 | %                       because of \@SaveMath and \@RestoreMath.
 | 
|  |    180 |         \UpperLeftOffset=\@LeftOffset
 | 
|  |    181 |         \UpperRightOffset=\@RightOffset
 | 
| 3095 |    182 | % Calculate Adjustments
 | 
| 3126 |    183 |         \LowerWidth=\wd\@LowerPart
 | 
|  |    184 |         \LowerHeight=\ht\@LowerPart
 | 
|  |    185 |         \LowerCenter=0.5\LowerWidth
 | 
|  |    186 | %
 | 
|  |    187 |         \UpperWidth=\wd\@UpperPart \advance\UpperWidth by -\UpperLeftOffset
 | 
|  |    188 |         \advance\UpperWidth by -\UpperRightOffset
 | 
|  |    189 |         \UpperCenter=\UpperLeftOffset
 | 
|  |    190 |         \advance\UpperCenter by 0.5\UpperWidth
 | 
| 3095 |    191 | %
 | 
| 3126 |    192 |         \ifdim \UpperWidth > \LowerWidth
 | 
|  |    193 |                 % \UpperCenter > \LowerCenter
 | 
|  |    194 |         \UpperAdjust=0pt
 | 
|  |    195 |         \RuleAdjust=\UpperLeftOffset
 | 
|  |    196 |         \LowerAdjust=\UpperCenter \advance\LowerAdjust by -\LowerCenter
 | 
|  |    197 |         \RuleWidth=\UpperWidth
 | 
|  |    198 |         \global\@LeftOffset=\LowerAdjust
 | 
|  |    199 | %
 | 
|  |    200 |         \else   % \UpperWidth <= \LowerWidth
 | 
|  |    201 |         \ifdim \UpperCenter > \LowerCenter
 | 
| 3095 |    202 | %
 | 
| 3126 |    203 |         \UpperAdjust=0pt
 | 
|  |    204 |         \RuleAdjust=\UpperCenter \advance\RuleAdjust by -\LowerCenter
 | 
|  |    205 |         \LowerAdjust=\RuleAdjust
 | 
|  |    206 |         \RuleWidth=\LowerWidth
 | 
|  |    207 |         \global\@LeftOffset=\LowerAdjust
 | 
| 3095 |    208 | %
 | 
| 3126 |    209 |         \else   % \UpperWidth <= \LowerWidth
 | 
|  |    210 |                 % \UpperCenter <= \LowerCenter
 | 
| 3095 |    211 | %
 | 
| 3126 |    212 |         \UpperAdjust=\LowerCenter \advance\UpperAdjust by -\UpperCenter
 | 
|  |    213 |         \RuleAdjust=0pt
 | 
|  |    214 |         \LowerAdjust=0pt
 | 
|  |    215 |         \RuleWidth=\LowerWidth
 | 
|  |    216 |         \global\@LeftOffset=0pt
 | 
| 3095 |    217 | %
 | 
| 3126 |    218 |         \fi\fi
 | 
| 3095 |    219 | % Make a box
 | 
| 3126 |    220 |         \if@inferRule
 | 
| 3095 |    221 | %
 | 
| 3126 |    222 |         \setbox\ResultBox=\vbox{
 | 
|  |    223 |                 \moveright \UpperAdjust \box\@UpperPart
 | 
|  |    224 |                 \nointerlineskip \kern\inferLineSkip
 | 
|  |    225 |                 \if@DoubleRule
 | 
|  |    226 |                 \moveright \RuleAdjust \vbox{\hrule width\RuleWidth
 | 
|  |    227 |                         \kern 1pt\hrule width\RuleWidth}\relax
 | 
|  |    228 |                 \else
 | 
|  |    229 |                 \moveright \RuleAdjust \vbox{\hrule width\RuleWidth}\relax
 | 
|  |    230 |                 \fi
 | 
|  |    231 |                 \nointerlineskip \kern\inferLineSkip
 | 
|  |    232 |                 \moveright \LowerAdjust \box\@LowerPart }\relax
 | 
| 3095 |    233 | %
 | 
| 3126 |    234 |         \@ifEmpty{#1}{}{\relax
 | 
| 3095 |    235 | %
 | 
| 3126 |    236 |         \HLabelAdjust=\wd\ResultBox     \advance\HLabelAdjust by -\RuleAdjust
 | 
|  |    237 |         \advance\HLabelAdjust by -\RuleWidth
 | 
|  |    238 |         \WidthAdjust=\HLabelAdjust
 | 
|  |    239 |         \advance\WidthAdjust by -\inferLabelSkip
 | 
|  |    240 |         \advance\WidthAdjust by -\wd\@LabelPart
 | 
|  |    241 |         \ifdim \WidthAdjust < 0pt \WidthAdjust=0pt \fi
 | 
| 3095 |    242 | %
 | 
| 3126 |    243 |         \VLabelAdjust=\dp\@LabelPart
 | 
|  |    244 |         \advance\VLabelAdjust by -\ht\@LabelPart
 | 
|  |    245 |         \VLabelAdjust=0.5\VLabelAdjust  \advance\VLabelAdjust by \LowerHeight
 | 
|  |    246 |         \advance\VLabelAdjust by \inferLineSkip
 | 
| 3095 |    247 | %
 | 
| 3126 |    248 |         \setbox\ResultBox=\hbox{\box\ResultBox
 | 
|  |    249 |                 \kern -\HLabelAdjust \kern\inferLabelSkip
 | 
|  |    250 |                 \raise\VLabelAdjust \box\@LabelPart \kern\WidthAdjust}\relax
 | 
| 3095 |    251 | %
 | 
| 3126 |    252 |         }\relax % end @ifEmpty
 | 
| 3095 |    253 | %
 | 
| 3126 |    254 |         \else % \@inferRulefalse
 | 
| 3095 |    255 | %
 | 
| 3126 |    256 |         \setbox\ResultBox=\vbox{
 | 
|  |    257 |                 \moveright \UpperAdjust \box\@UpperPart
 | 
|  |    258 |                 \nointerlineskip \kern\inferLineSkip
 | 
|  |    259 |                 \moveright \LowerAdjust \hbox{\unhbox\@LowerPart
 | 
|  |    260 |                         \@ifEmpty{#1}{}{\relax
 | 
|  |    261 |                         \kern\inferLabelSkip \unhbox\@LabelPart}}}\relax
 | 
|  |    262 |         \fi
 | 
| 3095 |    263 | %
 | 
| 3126 |    264 |         \global\@RightOffset=\wd\ResultBox
 | 
|  |    265 |         \global\advance\@RightOffset by -\@LeftOffset
 | 
|  |    266 |         \global\advance\@RightOffset by -\LowerWidth
 | 
|  |    267 |         \if@ReturnLeftOffset \else \global\@LeftOffset=\@SavedLeftOffset \fi
 | 
| 3095 |    268 | %
 | 
| 3126 |    269 |         \box\ResultBox
 | 
|  |    270 |         \@RestoreMath
 | 
| 3095 |    271 | }
 | 
| 3126 |    272 | \endinput
 |