Enum mm0b_parser::UnifyCmd [−][src]
Expand description
Unify commands appear in the header data for a def
or axiom
/theorem
.
They are executed by the ProofCmd::Thm
command in order to perform
substitutions. The state of the unify stack machine is:
MS: Stack<StackEl>
: The main stack, calledS
in theProofCmd
documentation. Since a unification is called as a subroutine during a proof command, the main stack is available, but most operations don’t use it.S: Stack<Expr>
: The unify stack, which contains expressions from the target context that are being destructured.H: Vec<Expr>
: The unify heap, also known as the substitution. This is initialized with the expressions that the target context would like to substitute for the variable names in the theorem being applied, but it can be extended in order to support substitutions with sharing as well as dummy variables.
Variants
UTerm t: S, (t e1 ... en) --> S, en, ..., e1
USave: H; S, e --> H, e; S, e
UTermSave t = USave; UTerm t:
H; S, (t e1 ... en) --> H, (t e1 ... en); S, en, ..., e1
Pop an element from the stack, ensure that the head is t
, then
push the n
arguments to the term (in reverse order, so that they
are dealt with in the correct order in the command stream).
UTermSave
does the same thing but saves the term to the unify heap
before the destructuring.
Fields of Term
Ref(u32)
URef i: H; S, Hi --> H; S
Get the i
-th element from the unify heap (the substitution),
and match it against the head of the unify stack.
Tuple Fields of Ref
0: u32
Dummy(SortId)
UDummy s: H; S, x --> H, x; S (where x:s)
Pop a variable from the unify stack (ensure that it is a name of the appropriate sort) and push it to the heap (ensure that it is distinct from everything else in the substitution).
Tuple Fields of Dummy
0: SortId
UHyp (UThm mode): MS, |- e; S --> MS; S, e
UHyp (UThmEnd mode): HS, e; S --> HS; S, e
UHyp
is a command that is used in theorem declarations to indicate that
we are about to read a hypothesis. There are two contexts where we read
this, when we are first declaring the theorem and check the statement (UThmEnd
mode),
and later when we are applying the theorem and have to apply a substitution (UThm
mode).
When we are applying the theorem, we have |- e
on the main stack, and we
pop that and load the expression onto the unify stack.
When we are checking a theorem, we have been pushing hypotheses onto the
hypothesis stack, so we pop it from there instead.
Implementations
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for UnifyCmd
impl UnwindSafe for UnifyCmd
Blanket Implementations
Mutably borrows from an owned value. Read more