AngouriMath
ByPriority(AngouriMath.Core.Transformations.Matching.MatchedRule[])
Method (no overloads)
Summary
subsumes — the more specific one first — keeping declaration order everywhere else.
Remarks
first-match-wins, so where two rules both fire at a node and disagree, whichever comes
first decides the answer. Where one pattern subsumes the other that decision is not a
preference: the general rule would swallow the special one and the special one would
never fire at all, so the specific rule has to be tried first. That was maintained by
hand and written in a comment on one set;
Subsumes(AngouriMath.Core.Transformations.Matching.MatchPattern) computes it, and this applies it.
opinion about 28 of them — spread across eight sets,
already declared first. None is mutual. So this orders what was already ordered; what
it adds is that inserting a general rule above a specific one no longer silently
reverses an answer.
stays readable as well as correct.
which must precede it. Subsumption is conservative, so most pairs constrain nothing and
fall through to declaration order. It cannot cycle — a cycle would need each of two
rules to be strictly more general than the other — but a cycle is emitted in
declaration order rather than trusted not to happen, because a sort that silently drops
a rule would be a set quietly missing a rewrite.
Angouri © 2019-2023 · Project's repo · Site's repo · Octicons · Transparency · 4378 pages online