Normal form (abstract rewriting) explained

In abstract rewriting,[1] an object is in normal form if it cannot be rewritten any further, i.e. it is irreducible. Depending on the rewriting system, an object may rewrite to several normal forms or none at all. Many properties of rewriting systems relate to normal forms.

Definitions

Stated formally, if (A,→) is an abstract rewriting system, xA is in normal form if no yA exists such that xy, i.e. x is an irreducible term.

An object a is weakly normalizing if there exists at least one particular sequence of rewrites starting from a that eventually yields a normal form. A rewriting system has the weak normalization property or is (weakly) normalizing (WN) if every object is weakly normalizing. An object a is strongly normalizing if every sequence of rewrites starting from a eventually terminates with a normal form. An abstract rewriting system is strongly normalizing, terminating, noetherian, or has the (strong) normalization property (SN), if each of its objects is strongly normalizing.[2]

A rewriting system has the normal form property (NF) if for all objects a and normal forms b, b can be reached from a by a series of rewrites and inverse rewrites only if a reduces to b. A rewriting system has the unique normal form property (UN) if for all normal forms a, bS, a can be reached from b by a series of rewrites and inverse rewrites only if a is equal to b. A rewriting system has the unique normal form property with respect to reduction (UN) if for every term reducing to normal forms a and b, a is equal to b.[3]

Results

This section presents some well known results. First, SN implies WN.[4]

Confluence (abbreviated CR) implies NF implies UN implies UN.[3] The reverse implications do not generally hold. is UN but not UN as b=e and b,e are normal forms. is UN but not NF as b=c, c is a normal form, and b does not reduce to c. is NF as there are no normal forms, but not CR as a reduces to b and c, and b,c have no common reduct.

WN and UN imply confluence. Hence CR, NF, UN, and UN coincide if WN holds.[5]

Examples

One example is that simplifying arithmetic expressions produces a number - in arithmetic, all numbers are normal forms. A remarkable fact is that all arithmetic expressions have a unique value, so the rewriting system is strongly normalizing and confluent:[6]

(3 + 5) * (1 + 2) ⇒ 8 * (1 + 2) ⇒ 8 * 3 ⇒ 24

(3 + 5) * (1 + 2) ⇒ (3 + 5) * 3 ⇒ 3*3 + 5*3 ⇒ 9 + 5*3 ⇒ 9 + 15 ⇒ 24

Examples of non-normalizing systems (not weakly or strongly) include counting to infinity (1 ⇒ 2 ⇒ 3 ⇒ ...) and loops such as the transformation function of the Collatz conjecture (1 ⇒ 2 ⇒ 4 ⇒ 1 ⇒ ..., it is an open problem if there are any other loops of the Collatz transformation).[7] Another example is the single-rule system, which has no normalizing properties since from any term, e.g. r(4,2) a single rewrite sequence starts, viz. r(4,2) → r(2,4) → r(4,2) → r(2,4) → ..., which is infinitely long. This leads to the idea of rewriting "modulo commutativity" where a term is in normal form if no rules but commutativity apply.[8]

The system (pictured) is an example of a weakly normalizing but not strongly normalizing system. a and d are normal forms, and b and c can be reduced to a or d, but the infinite reduction bcbc → ... means that neither b nor c is strongly normalizing.

Untyped lambda calculus

The pure untyped lambda calculus does not satisfy the strong normalization property, and not even the weak normalization property. Consider the term

λx.xxx

(application is left associative). It has the following rewrite rule: For any term

t

,

(λx.xxx)tttt

But consider what happens when we apply

λx.xxx

to itself:

\begin{align} (λx.xxx)(λx.xxx) &(λx.xxx)(λx.xxx)(λx.xxx) \\ &(λx.xxx)(λx.xxx)(λx.xxx)(λx.xxx) \\ &(λx.xxx)(λx.xxx)(λx.xxx)(λx.xxx)(λx.xxx) \\ &  … \end{align}

Therefore, the term

(λx.xxx)(λx.xxx)

is not strongly normalizing. And this is the only reduction sequence, hence it is not weakly normalizing either.

Typed lambda calculus

Various systems of typed lambda calculus including thesimply typed lambda calculus, Jean-Yves Girard's System F, and Thierry Coquand's calculus of constructions are strongly normalizing.

A lambda calculus system with the normalization property can be viewed as a programming language with the property that every program terminates. Although this is a very useful property, it has a drawback: a programming language with the normalization property cannot be Turing complete, otherwise one could solve the halting problem by seeing if the program type checks. This means that there are computable functions that cannot be defined in the simply typed lambda calculus, and similarly for the calculus of constructions and System F. A typical example is that of a self-interpreter in a total programming language.[9]

See also

Notes and References

  1. Book: . . Term Rewriting and All That . 1998 . . 9780521779203 .
  2. Book: Ohlebusch . Enno . Rewriting Techniques and Applications . Church-Rosser theorems for abstract reduction modulo an equivalence relation . Lecture Notes in Computer Science . 1998 . 1379 . 18 . 10.1007/BFb0052358 . 978-3-540-64301-2 . https://books.google.com/books?id=ESr6CAAAQBAJ&pg=PA18.
  3. Klop . J.W. . de Vrijer . R.C. . Unique normal forms for lambda calculus with surjective pairing . Information and Computation . February 1989 . 80 . 2 . 97–113 . 10.1016/0890-5401(89)90014-X . free .
  4. Web site: logic - What is the difference between strong normalization and weak normalization in the context of rewrite systems? . Computer Science Stack Exchange . 12 September 2021.
  5. Book: Ohlebusch . Enno . Advanced Topics in Term Rewriting . 17 April 2013 . Springer Science & Business Media . 978-1-4757-3661-8 . 13–14 . en.
  6. Book: Terese . Term rewriting systems . 2003 . Cambridge University Press . Cambridge, UK . 0-521-39115-6 . 1.
  7. Book: Terese . Term rewriting systems . 2003 . Cambridge University Press . Cambridge, UK . 0-521-39115-6 . 2.
  8. Book: Nachum. Dershowitz. Jean-Pierre. Jouannaud. 6. Rewrite Systems. Handbook of Theoretical Computer Science. 1990. B. Elsevier. Jan van Leeuwen. Jan van Leeuwen. 10.1.1.64.3114. 0-444-88074-7. 9–10.
  9. Book: Riolo . Rick . Worzel . William P. . Kotanchek . Mark . Genetic Programming Theory and Practice XII . 4 June 2015 . Springer . 978-3-319-16030-6. 59 . 8 September 2021 . en.