
In
theoretical computer science
Theoretical computer science is a subfield of computer science and mathematics that focuses on the Abstraction, abstract and mathematical foundations of computation.
It is difficult to circumscribe the theoretical areas precisely. The Associati ...
, in particular in
automated reasoning
In computer science, in particular in knowledge representation and reasoning and metalogic, the area of automated reasoning is dedicated to understanding different aspects of reasoning. The study of automated reasoning helps produce computer progr ...
about formal equations, reduction orderings are used to prevent
endless loop
In computer programming, an infinite loop (or endless loop) is a sequence of instructions that, as written, will continue endlessly, unless an external intervention occurs, such as turning off power via a switch or pulling a plug. It may be inte ...
s. Rewrite orders, and, in turn, rewrite relations, are generalizations of this concept that have turned out to be useful in theoretical investigations.
Motivation
Intuitively, a reduction order ''R'' relates two
terms
Term may refer to:
Language
*Terminology, context-specific nouns or compound words
**Technical term (or ''term of art''), used by specialists in a field
***Scientific terminology, used by scientists
*Term (argumentation), part of an argument in d ...
''s'' and ''t'' if ''t'' is properly "simpler" than ''s'' in some sense.
For example, simplification of terms may be a part of a
computer algebra
In mathematics and computer science, computer algebra, also called symbolic computation or algebraic computation, is a scientific area that refers to the study and development of algorithms and software for manipulating expression (mathematics), ...
program, and may be using the rule set . In order to prove impossibility of endless loops when simplifying a term using these rules, the reduction order defined by "''sRt'' if term ''t'' is properly shorter than term ''s''" can be used; applying any rule from the set will always properly shorten the term.
In contrast, to establish termination of "distributing-out" using the rule ''x''*(''y''+''z'') → ''x''*''y''+''x''*''z'', a more elaborate reduction order will be needed, since this rule may blow up the term size due to duplication of ''x''. The theory of rewrite orders aims at helping to provide an appropriate order in such cases.
Formal definitions
Formally,
a
binary relation
In mathematics, a binary relation associates some elements of one Set (mathematics), set called the ''domain'' with some elements of another set called the ''codomain''. Precisely, a binary relation over sets X and Y is a set of ordered pairs ...
(→) on the set of
terms is called a rewrite relation if it is
closed under
contextual embedding and under
instantiation; formally: if ''l''→''r'' implies ''u''
''l''Substitution (logic)#First-order logic">σ">Substitution_(logic)#First-order_logic.html" ;"title="/a>''l''Substitution (logic)#First-order logic">σsub>''p''→''u''[''r''σ]
''p'' for all terms ''l'', ''r'', ''u'', each path ''p'' of ''u'', and each Substitution (logic)#First-order logic, substitution σ. If (→) is also irreflexive relation, irreflexive and
transitive, then it is called a rewrite ordering,
or rewrite
preorder
In mathematics, especially in order theory, a preorder or quasiorder is a binary relation that is reflexive relation, reflexive and Transitive relation, transitive. The name is meant to suggest that preorders are ''almost'' partial orders, ...
. If the latter (→) is moreover
well-founded
In mathematics, a binary relation is called well-founded (or wellfounded or foundational) on a set (mathematics), set or, more generally, a Class (set theory), class if every non-empty subset has a minimal element with respect to ; that is, t ...
, it is called a reduction ordering,
[Dershowitz, Jouannaud (1990), sect.5.1, p.270] or a reduction preorder.
Given a binary relation ''R'', its rewrite
closure is the smallest rewrite relation containing ''R''.
[Dershowitz, Jouannaud (1990), sect.2.2, p.252] A transitive and reflexive rewrite relation that contains the
subterm ordering is called a simplification ordering.
[Dershowitz, Jouannaud (1990), sect.5.2, p.274]
Properties
* The
converse, the
symmetric closure In mathematics, the symmetric closure of a binary relation R on a set X is the smallest symmetric relation
A symmetric relation is a type of binary relation. Formally, a binary relation ''R'' over a set ''X'' is symmetric if:
: \forall a, b \in ...
, the
reflexive closure In mathematics, the reflexive closure of a binary relation R on a set X is the smallest reflexive relation on X that contains R, i.e. the set R \cup \.
For example, if X is a set of distinct numbers and x R y means "x is less than y", then the refl ...
, and the
transitive closure
In mathematics, the transitive closure of a homogeneous binary relation on a set (mathematics), set is the smallest Relation (mathematics), relation on that contains and is Transitive relation, transitive. For finite sets, "smallest" can be ...
of a rewrite relation is again a rewrite relation, as are the union and the intersection of two rewrite relations.
[Dershowitz, Jouannaud (1990), sect.2.1, p.251]
* The converse of a rewrite order is again a rewrite order.
* While rewrite orders exist that are total on the set of
ground term
In mathematical logic, a ground term of a formal system is a term that does not contain any variables. Similarly, a ground formula is a formula that does not contain any variables.
In first-order logic with identity with constant symbols a ...
s ("ground-total" for short), no rewrite order can be total on the set of
all terms.
[Since ''x''<''y'' implies ''y''<''x'', since the latter is an instance of the former, for variables ''x'', ''y''.][Dershowitz, Jouannaud (1990), sect.5.1, p.272]
* A
term rewriting system
In mathematics, computer science, and logic, rewriting covers a wide range of methods of replacing subterms of a formula with other terms. Such methods may be achieved by rewriting systems (also known as rewrite systems, rewrite engines, or reduc ...
is
terminating if its rules are a subset of a reduction ordering.
[i.e. if for all ''i'', where (>) is a reduction ordering; the system need not have finitely many rules]
* Conversely, for every terminating term rewriting system, the
transitive closure
In mathematics, the transitive closure of a homogeneous binary relation on a set (mathematics), set is the smallest Relation (mathematics), relation on that contains and is Transitive relation, transitive. For finite sets, "smallest" can be ...
of (::=) is a reduction ordering,
which need not be extendable to a ground-total one, however. For example, the ground term rewriting system is terminating, but can be shown so using a reduction ordering only if the constants ''a'' and ''b'' are incomparable.
[Since e.g. implied , meaning the second rewrite rule was not decreasing.][Dershowitz, Jouannaud (1990), sect.5.1, p.271]
* A ground-total and well-founded rewrite ordering
[i.e. a ground-total reduction ordering] necessarily contains the
proper subterm relation on ground terms.
* Conversely, a rewrite ordering that contains the subterm relation
[i.e. a simplification ordering] is necessarily well-founded, when the set of function symbols is finite.
[The proof of this property is based on ]Higman's lemma
In mathematics, Higman's lemma states that the set \Sigma^* of finite sequences over a finite alphabet \Sigma, as partially ordered by the subsequence relation, is a well partial order. That is, if w_1, w_2, \ldots\in \Sigma^* is an infinite seq ...
, or, more generally, Kruskal's tree theorem
In mathematics, Kruskal's tree theorem states that the set of finite trees over a well-quasi-ordered set of labels is itself well-quasi-ordered under homeomorphic embedding.
A finitary application of the theorem gives the existence of the fast-g ...
.
* A finite term rewriting system is terminating if its rules are subset of the strict part of a simplification ordering.
[ Here: p.287; the notions are named slightly different.]
Notes
References
{{Reflist
Rewriting systems
Order theory