Rewriting modulo AC, the standard relation →_{R/AC}: t rewrites to t' when t is AC-equivalent
to some u that takes one base step to u', with u' AC-equivalent to t'.
Equations
- MeTTaIL.AC.RewStepModAC acOp p t t' = ∃ (u : MeTTaIL.AST) (u' : MeTTaIL.AST), MeTTaIL.AC.ACEq acOp t u ∧ MeTTaIL.RewStep p u u' ∧ MeTTaIL.AC.ACEq acOp u' t'
Instances For
One step of rewriting modulo AC: canonicalise, take a base step, recanonicalise.
Equations
- MeTTaIL.AC.oneStepAC acOp p t = Option.map (MeTTaIL.AC.canon acOp) (MeTTaIL.oneStep p (MeTTaIL.AC.canon acOp t))
Instances For
The engine is well-defined on AC-equivalence classes: AC-equivalent inputs give identical results.
This is the coherence the canonical form provides, since canon is constant on each class.
Soundness: every step the modulo-AC engine takes is a genuine →_{R/AC} step. The input is
AC-equivalent to its canonical form, the base engine takes a real RewStep there, and the output is
the recanonicalised reduct, AC-equivalent to that reduct.
Fuel-bounded normalization modulo AC: iterate the modulo-AC step.
Equations
- MeTTaIL.AC.evalAC acOp p 0 x✝ = x✝
- MeTTaIL.AC.evalAC acOp p n.succ x✝ = match MeTTaIL.AC.oneStepAC acOp p x✝ with | some t' => MeTTaIL.AC.evalAC acOp p n t' | none => x✝
Instances For
Soundness of the modulo-AC normalizer: its result is reachable from the input by →_{R/AC} steps.
A term is normal modulo AC for this engine when no modulo-AC step applies, equivalently when its canonical form is a base normal form.
Equations
- MeTTaIL.AC.IsNormalModAC acOp p t = (MeTTaIL.AC.oneStepAC acOp p t = none)
Instances For
Completeness: when the engine acts, and coherence #
The engine takes a step exactly when the canonical form has a base redex. Whether that captures every
→_{R/AC} step is the coherence question: the canonical form must not lose a redex that some other
AC-representative has. CoherentAC names that condition, and under it the engine is complete.
The engine takes a step exactly when the canonical form has a base redex. No coherence assumption is needed for this characterization; it follows from base-engine completeness on the canonical form.
Being normal modulo AC means the canonical form has no base redex anywhere.
Every base redex gives a genuine context rewrite (the easy half of the engine/relation bridge).
Coherence of a presentation with AC: canonicalising never loses a redex that some AC-equivalent term
has. This is the condition (Maude's coherence) under which the canonical-form strategy is complete:
it makes the canonical form a redex-maximal representative of its AC-equivalence class. It is an
assumed side-condition, not established here for arbitrary presentations (a syntactic criterion
guaranteeing it is future work); coherentAC_of_no_rewrites shows it is at least satisfiable, so the
completeness result below is conditional but not vacuous.
Equations
- MeTTaIL.AC.CoherentAC acOp p = ∀ (t u : MeTTaIL.AST), MeTTaIL.AC.ACEq acOp t u → MeTTaIL.hasRedex p u = true → MeTTaIL.hasRedex p (MeTTaIL.AC.canon acOp t) = true
Instances For
Completeness under the assumed coherence side-condition CoherentAC: if any AC-representative of t
has a redex, the modulo-AC engine takes a step. With exists_rewStep_of_hasRedex this says the engine
never stalls while some AC-equivalent term can still be rewritten. The result is conditional on
coherence, which is assumed rather than proven in general (see CoherentAC).
Coherence is satisfiable: a presentation with no rewrite rules is coherent, vacuously, since nothing
is reducible. So CoherentAC is a consistent side-condition rather than an empty one, and
oneStepAC_complete is a real (if conditional) completeness statement.