A presentation's reductions are head-sort-preserving when every base reduction keeps the head
category, the sort of the term's outermost constructor. This is the semantic content of the category
check in checkRewrite (which requires a rule's two sides to have compatible categories): firing a
rule does not change the head sort. An assumed side-condition here (see sortPreserving_of_no_rewrites
for satisfiability and headCat_inst_sexp for half of the discharge).
Equations
- MeTTaIL.SortPreserving p = ∀ (t t' : MeTTaIL.AST), MeTTaIL.Reduces p t t' → MeTTaIL.AST.headCat p.terms t = MeTTaIL.AST.headCat p.terms t'
Instances For
Head-sort preservation under the full context-closed relation: if base reductions keep the head
category, so does RewStep. The congruence cases hold structurally: a step inside a sexp argument
keeps the operator, hence its category; a step inside a Subst keeps the body that determines the
category.
Many-step reduction preserves the head category.
The normalizer preserves the head category: eval keeps a term at its head sort, via eval_sound.
SortPreserving is satisfiable: a presentation with no rewrite rules preserves the head sort
vacuously, since nothing reduces. So the conditional preservation theorems are not empty.
Instantiation preserves a constructor head category: substituting into a sexp-headed term keeps the
head label, hence its category. This is the right-hand-side half of the substitution lemma that would
discharge SortPreserving from a per-rule head-category check; the left-hand-side half (matching
against a constructor-headed pattern forces the same head) awaits LawfulBEq Label.