Term ordering for permutative rewriting #1266
Labels
subsystem: saw-core
Issues related to the saw-core representation or the saw-core subsystem
type: bug
Issues reporting bugs or unexpected/unwanted behavior
Milestone
This issue is a reminder that there should be a more careful choice of term ordering in support of permutative rewriting.
PR GaloisInc/saw-core#173 adds very preliminary support for rewriting with permutative rules. A rule is "permutative" if the left and right sides are instances of one another, as in, for example, a commutative law
\ x y -> f x y == f y x
. Prior to this PR, the SAW rewriter would enter an infinite loop when applying this rule, then applying it again, and again ad infinitum. The PR breaks this loop; an ordering relation is used to decide whether to apply the rule or not.Permutative rules are supported in many other proof systems, e.g. ACL2 and Isabelle. Isabell allows the user to select an ordering; some examples are in https://github.com/isabelle-prover/mirror-isabelle/blob/master/src/Pure/term_ord.ML.
The current ordering looks at the "fringe" of arguments in possibly-nested calls to a function; specifically, for a call
f x1 ... xn
orf (x1, x2 , ..., xn)
the fringe is the concatenation of the fringes of all the x_i, iff
is the top-level function, and otherwise is a singleton list of the term itself. So the fringe off (f a b) (g c)
is[a, b, g c]
. A permutative rule is applied iff the fringe of the replacement term is less than the fringe of the original term, using SAW's existing ordering on terms.This ordering has one thing going for it: the user can associate to the right or to the left, as desired, and still have a rewrite rule for commutativity. That's because reassociating does not change the fringe. Its major flaw is the lack of any theory behind it.
The text was updated successfully, but these errors were encountered: