Legend:
Library
Module
Module type
Parameter
Class
Class type
Evaluation and conversion.
Preliminary remarks. We define the head-structure of a term t as:
λx:_,h if t=λx:a,u and h is the head-structure of u
Π if t=Πx:a,u
h _ if t=uv and h is the head-structure of u
? if t=?Mt1,..,tn (and ?M is not instantiated)
t itself otherwise (TYPE, KIND, x, f)
A term t is in head-normal form (hnf) if its head-structure is invariant by reduction.
A term t is in weak head-normal form (whnf) if it is an abstration or if it is in hnf. In particular, a term in head-normal form is in weak head-normal form.
A term t is in strong normal form (snf) if it cannot be reduced further.
tree_walk p tr ctx stk tries to apply a rewrite rule by matching the stack stk against the decision tree tr in context ctx. The resulting state of the abstract machine is returned in case of success. Even if matching fails, the stack stk may be imperatively updated since a reduction step taken in elements of the stack is preserved (this is done using TRef). Fresh metavariables generated by unification rules with extra pattern variables are added in p.