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