Proof
Step Fields

===============================================

Step:Hyp:Ref

 Mandatory
 Must begin in column 1 of a proof text area line
 Must be a single token  i.e. no embedded whitespace
characters
 Colon ("
: ")
characters are used to separate the Step,
Hyp and Ref subfields, but can be omitted
if no remaining subfields are needed.
 Example: "
h1 " could
be a valid Step: Hyp: Ref
entry because a hypothesis should not refer to other hypotheses, and
the Proof Assistant outputs Ref
as part of Unification!

Step

 Mandatory
 Must be a positive integer except for the last step
"number", which must equal "
qed "
 Prefix with "
h " to
indicate that the step's Formula
is one of the theorem's hypotheses (the "h " is not used in subsequent Proof
Step Hyp fields.)
 Need not be assigned in numeric order (numbers are being
used to maintain semantic cohesiveness, not for doing arithmetic.)
 Must not duplicate the Step
number of any other Proof Step
 Terminate the Step
field with a Colon ("
: ") if the
Step field is to be
followed by Hyp and/or Ref fields.

Hyp

 Optional (depending on the Ref assertion's hypotheses).
 Specifies the hypotheses
needed by the theorem or axiom used to derive the Proof Step's Formula.
 The
number of hypotheses input controls the Unification search: if 2
hypotheses are input and Ref is blank (to be computed), then only
assertions with 2 Logical Hypotheses are searched during Unification.
 If present, Hyp
must be a sequence of positive integers or "
? "s separated by Comma (", ") characters with no embedded
whitespace characters.
 Do not prefix with
"
h " when referring to previous Step
that is one of the theorem's hypotheses.
 Example of multiple Hyp's
in Step
: Hyp: Ref:
"3:1,2:axmp "
 Code as null, not as space character(s) if unused (the
Ref theorem or axiom uses no
hypotheses.)
 Example of omitted Hyp field in Step
: Hyp: Ref:
"5::ax1 " (ax1
requires no hypotheses).
 Should not be input on a hypothesis Proof Step
(that is illogical, it does not compute  an hypothesis does not have
hypotheses! :)
 Terminate the Hyp
field with a Colon ("
: ") if the
Hyp field is to be
followed by a Ref field.
 Note: Hyp numbers
will be resequenced by Proof Assistant during Unification to match the
Metamath sequence of the hypotheses for the theorem or axiom.
For example, if Theorem
XYZ
has Hypotheses XYZ.1 and XYZ.2 and the user specifies the Hyp as "3,4 ", but the Proof Assistant
determines that step 4
corresponds to XYZ.1 and step 3 corresponds to XYZ.2 , then, when the proof text is
redisplayed after unification, the Hyp
field will be shown as "4,3 "
instead of "3,4 ".
The intent of this automatic resequencing is to speed up unification
processing if a repeat is requested (the Metamath Proof Engine is quite
strict about the order of hypotheses!)

Ref

 Optional
 Ref identifies the
Label of a theorem, axiom or logical hypothesis that justifies
derivation of the proof step's Formula
 or may be a "Local Ref"
(e.g. "
#1 " or "#syl.1 ") as described below.
 Ref
is output by the Proof Assistant during Unification if it finds an
assertion in the database that justifies the proof step  even if
there are unsatisfied Distinct Variable Restrictions associated with
the assertion (the Unification search continues even after a $d error,
looking for a unifying assertion that does not have a $d error, and if
no such assertion is found, a message is produced showing the
alterniative assertion choices.)
 Ref
may be input if the correct Label is known in advance, and/or if the
user wishes to override the output of Proof Assistant.
 If Ref is input
and
one or more Hyps is omitted or = "?", and/or Formula is omitted, the
"Derive" feature
is invoked  the input Ref is used to generate the missing Hyp and/or
Formula entries. (Derive operates on Derivation steps only, not on
Hypothesis steps.)
 If Ref is present
in
the Proof Text when Unification is requested, the Proof Assistant will
attempt unification with the given Ref
first. Then, and only if the given Ref
is incorrect (invalid label, does not unify, etc.), will the algorithm
go through the tedious and perhaps horribly lengthy unification search
process
to find the correct Label.
 If Ref is input
but does not
unify correctly, the program produces a message showing alternative
assertions that do unify with the step.
 For a new theorem, the
Ref s generated by Proof
Assistant for the theorem's logical hypotheses consist of the THEOREM= value suffixed with ".1 ", ".2 ", etc., in the order of the
appearance of the hypothesis Proof Steps.
 Example: for new
THEOREM=XYZ ,
the Proof Assistant generates logical hypothesis Labels = XYZ.1 , XYZ.2 ,
etc. for the Proof Steps
prefixed with "h ", based on the
order of their appearance in the proof text area. If
this is unsatisfactory, input the desired Labels in the Ref fields to override the
default Ref values (for example "maj "
and "min " are the statement
labels in set.mm for axmp 's
logical hypotheses.)
 Note
that Labels on Logical Hypotheses must be unique within the Metamath
statement label namespace (no two statements can have the same Label).
In the event that the automatically generated Labels already exist in
the database  highly unlikely  an error message will be generated
and either the database should be modified or the Theorem's label
should be changed. Likewise if the user enters just some of the Ref's and those conflict with the
database or other automatically generated Labels (moral of story is,
enter all of the Refs or none
of them ...)
 Note
also (!) that the order of logical hypotheses within a Metamath Theorem
is the order of their appearance within the database, which is not
necessarily the same as the order of their appearance within a proof.
The Proof Assistant, likewise, internally orders the hypotheses of new
theorems in the order of their appearance within the Proof Text area;
it does not alter the order of hypotheses for existing theorems. Either
way, this should have no impact on the RPN sequences of the proofs of
new theorems but those
contemplating future enhancements involving realtime updating might
want to pay attention: the order of logical hypotheses in a theorem's
frame affects the RPN sequences of proofs that refer to the theorem in question.
 "Local Ref"  as a
textediting shortcut for use by "advanced" users, a "Local Ref"
feature is provided. In the Ref field, enter "#" followed by the Ref or
Step of a previous proof step and press CtrlU (or other Unification
menu item). If there are no fields in error in the Proof Worksheet then
the proof step containing the Local Ref is deleted automatically and
any subsequent proof steps that refer to it as an hypothesis are
updated to point to the Local Ref'd step as the new hypothesis.
Note: A tutorial page has been added demonstrating the "Local Ref" feature. To use it, run
the
mmj2PaTutorial.bat batch
command while in the mmj2jar directory. Then in the Proof
Assistant GUI, use the File/Open Proof File menu item to
open file mmj2\mmj2jar\PATutorial\PageLocalRef.mmp .

Formula

 Mandatory on Hypothesis Proof steps and the 'qed'
Derivation Proof Step.
 Optional if Ref is
entered on a non'
qed '
Derivation step  Derive will attempt to generate the Formula from the Ref and Hyp input.
 Formula begins with
the first nonwhitespace token following the Step
: Hyp: Ref
string in a Proof Step statement, and continues until the next proof
text area statement begins.
 The
Formula must
begin with the Metamath file's designated mmj2 "Provable Logic Statement Type"
(default = " ", may be
overridden via a BatchMMJ2 RunParm).
 Formula is
freeform and may be spaced or indented as the user desires, and may be
continued onto as many lines as needed of the proof text area.
 Unlike formulas in a Metamath .mm file, a Proof Step Formula
may not contain embedded comments (or nonwhitespace symbols that are
not part of the formula!). Nor is the Formula terminated with "
$= " or "$. ".
 The end of a Proof Step Formula
field is designated by the start of the next Proof Assistant text area
statement, not the Metamath "
$. "
or "$= " tokens (which are not
used in the Proof Assistant GUI.)
 The Proof Assistant GUI will not alter the spacing or
indentation of a userinput Formula
except when necessary for insertion of a Ref label in the Proof Step line  or when Work
Variables are updated during unification, in which case the entire
formula is reformatted according to the current TMFF settings.
 The Formula on a
hypothesis Proof Step
statement must be the exactly the same, symbol for symbol, as the
corresponding formula in the input
Metamath .mm file/database. Likewise with the formula on the "
qed " Proof Step. (The easiest way to
accomplish this is with the File/New
menu item which preloads the hypotheses and "qed " Proof Steps.)
 Each Proof Step Formula
must be parseable using syntax axiom statements in the loaded Metamath
.mm file that are located prior to the theorem being proved or the
LOC_AFTER location. Syntactic
analysis is performed as a necessary part of
validation/unification to construct a parse tree for the Formula (this should be obvious, but
be prepared in advance for ugly error messages coughed up by mmj2's Grammar's Parser! :)
 "Work Variables" may be generated by the Derive Feature,
and can be input by the user (except in the 'qed' and hypothesis
steps). The Work Variables represent unknown subexpressions (or
variables) and have names corresponding to Type Code: "
&W1 ",
"&W2 ", etc. for Type Code "wff "; "&C1 ",
"&C2 ", ... for Type Code "class ", etc.
Refer to \mmj2jar\AnnotatedRunParms.txt for more
information  (hint: search for "WorkVar" in the file.) Also, refer to
StepUnifier.html and WorkVariables.html.
