AngouriMath

Navigation

← Back to list of members

Subsumes​(AngouriMath.​Core.​Transformations.​Matching.​MatchPattern)

 Method (no overloads)

Summary

Whether every expression other matches, this one matches too — so
that this pattern is the more general of the two, and a rule written on it
would swallow a rule written on other if it were tried first.

Remarks

The fact behind an ordering that is currently a comment.MatchedRules.CollapseMultipleFractions says of itself that it "is
order-dependent, since Mulf(Divf, Divf) has to be tried before
Mulf(a, Divf) or the more general rule would swallow the special one". That is
this relation, observed by hand and then maintained by hand. Computed instead, the
order it implies is derived from the patterns rather than from where somebody typed
them.
Sound in one direction only.true is a claim — every
expression the other matches, this matches — and every clause below is structural, so
the claim holds for all expressions rather than for the ones a test happened to
generate. false means not proved and never disproved:
a hole carrying a predicate is arbitrary code, an Exact literal can be equal to
a value of another runtime type (a rational that reduced to an integer), and an n-ary
Gathered pattern matches a family this does not attempt to reason about. Each of
those answers false and leaves the pair ordered by where it was
written, which is what the code did before.
It is a matching problem, not a size comparison. A hole repeated across a
pattern is an equality constraint — Mulf(a, a) matches strictly less than
Mulf(a, b) while having the same node count — so this matches this pattern
against the other as a term, carrying an assignment from this pattern's holes to
the other's subpatterns and requiring a repeated hole to be assigned consistently.
Comparing NodeCount would call those two equally general and get the
ordering wrong in the one case the ordering exists for.

























Angouri © 2019-2023 · Project's repo · Site's repo · Octicons · Transparency · 4378 pages online