ArticleslgStudy

science

Rewrite order

Rewrite order is a science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Rewrite order rather than just read about it. In short: In theoretical computer science, in particular in automated reasoning about formal equations, reduction orderings are used to prevent endless loops. Rewrite orders, and, in turn, rewrite relations, are generalizations of this concept that have turned out to be useful in theoretical investigations.

Rewrite order — main illustration
Rewrite order — illustration

Key takeaways

  • Rewrite order belongs to science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Rewrite order to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Rewrite order from memory before moving on to harder problems.

Reference excerpt

In theoretical computer science, in particular in automated reasoning about formal equations, reduction orderings are used to prevent endless loops. 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 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 program, and may be using the rule set { x+0 → x , 0+x → x , x*0 → 0, 0*x → 0, x*1 → x , 1*x → x }. 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 (→) 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σ]p→u[rσ]p for all terms l, r, u, each path p of u, and each substitution σ. If (→) is also irreflexive and transitive, then it is called a rewrite ordering, or rewrite preorder. If the latter (→) is moreover well-founded, it is called a reduction ordering, or a reduction preorder. Given a binary relation R, its rewrite closure is the smallest rewrite relation containing R. A transitive and reflexive rewrite relation that contains the subterm ordering is called a simplification ordering.

Properties The converse, the symmetric closure, the reflexive closure, and the transitive closure of a rewrite relation is again a rewrite relation, as are the union and the intersection of two rewrite relations. The converse of a rewrite order is again a rewrite order. While rewrite orders exist that are total on the set of ground terms ("ground-total" for short), no rewrite order can be total on the set of all terms. A term rewriting system {l1::=r1,...,ln::=rn, ...} is terminating if its rules are a subset of a reduction ordering. Conversely, for every terminating term rewriting system, the transitive closure of (::=) is a reduction ordering, which need not be extendable to a ground-total one, however. For example, the ground term rewriting system { f(a)::=f(b), g(b)::=g(a) } is terminating, but can be shown so using a reduction ordering only if the constants a and b are incomparable. A ground-total and well-founded rewrite ordering necessarily contains the proper subterm relation on ground terms. Conversely, a rewrite ordering that contains the subterm relation is necessarily well-founded, when the set of function symbols is finite. A finite term rewriting system {l1::=r1,...,ln::=rn, ...} is terminating if its rules are subset of the strict part of a simplification ordering.

Notes

References Nachum Dershowitz; Jean-Pierre Jouannaud (1990). "Rewrite Systems". In Jan van Leeuwen (ed.). Formal Models and Semantics. Handbook of Theoretical Computer Science. Vol. B. Elsevier. pp. 243–320. doi:10.1016/B978-0-444-88074-1.50011-1. ISBN 9780444880741.

Illustrations

Rewrite order: Rewriting s to t by a rule l::=r. If l and r are related by a rewrite relation, so are s and t. A simplification ordering always relates l and s, and similarly r and t.
Rewriting s to t by a rule l::=r. If l and r are related by a rewrite relation, so are s and t. A simplification ordering always relates l and s, and similarly r and t.

Worked examples

Example 1 — a first encounter with Rewrite order

Start with the simplest possible case. Write down what Rewrite order claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Rewrite order before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Rewrite order ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Rewrite order

In research
Rewrite order appears in science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Rewrite order in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Rewrite order is common in secondary-school and first-year university syllabi. It links to neighbouring topics Order theory, Rewriting systems, so understanding it makes those chapters shorter.
In everyday life
Look for Rewrite order outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Rewrite order” →

Affiliate

Preply — study more efficiently by working with a personal tutor. 50% off.

How to study Rewrite order in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Rewrite order means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Rewrite order out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Rewrite order in simple terms?

In theoretical computer science, in particular in automated reasoning about formal equations, reduction orderings are used to prevent endless loops. Rewrite orders, and, in turn, rewrite relations, are generalizations of this concept that have turned out to be useful in theoretical investigations.

Why does Rewrite order matter?

Because it connects several science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Rewrite order?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Rewrite order.

Tags

  • Order theory
  • Rewriting systems

Keep exploring