Iterative Path Orders Extended abstract (1)
Iterative Path Orders
1
Iterative Path Orders
Extended abstract
Jan Willem Klop
Department of Theoretical Computer Science, Vrije Universiteit,
de Boelelaan 1081a, 1081 HV Amsterdam, The Netherlands;
CWI, P.O. Box 94079, 1090 GB Amsterdam, The Netherlands;
Department of Computer Science, University of Nijmegen, Toernooiveld 1,
6525 ED Nijmegen, The Netherlands
[email protected]
Vincent van Oostrom1
Department of Philosophy, Utrecht University,
P.O.Box 80089, 3508 TB Utrecht, The Netherlands
[email protected]
Roel de Vrijer
Department of Theoretical Computer Science, Vrije Universiteit,
de Boelelaan 1081a, 1081 HV Amsterdam, The Netherlands
[email protected]
___________________________________________________________
In the first half of this paper we give an alternative version of the recursive path order
(RPO) for first-order term rewriting, which is ‘iterative’ rather than recursive. Hence the
name iterative path order (IPO).
In the second part of the paper we prove that IPO is a well-founded order, by a
simple argument familiar from Proof Theory. To this end we employ a labeled extension
of IPO.
The result is an easy to grasp and powerful termination proof technique, whose
correctness proof avoids the usual appeal to Kruskal’s Tree Theorem.
We finally argue that the method is extendible to the lexicographic case and to
the higher-order case.
The IPO method is easily seen to be as powerful as the usual RPO. In fact, the
orderings are equivalent. This result requires a fine-grained analysis of IPO, that is added
in an Appendix.
___________________________________________________________
Contents
0. Introduction.
1. Transformation rules on starred terms.
2. Application to termination; examples.
3. Transformation rules on labeled terms.
4. IPO and RPO compared.
5. Fine-structure of IPO.
6. Concluding remarks.
References.
Appendix (separate).
0. Introduction
We are concerned with proving termination (or Strong Normalization, SN) for first order term
Contact author: Vincent van Oostrom, tel. +31 30 2532761; fax +31 30 2532816.
1
15-01-2002
Iterative Path Orders
2
rewriting systems. There are various methods to do so–see Dershowitz & Jouannaud [90], Zantema
[02]. Of all these methods, probably the most well-known and most powerful is the method of
recursive path orders (RPO), developed by Dershowitz [82,87 ] on the basis of Plaisted’s precursor
of that notion, associative path orders Plaisted [78 ]. The method has been widely paraphrased and
extended.
There are two ‘problems’ with the RPO method. The first is that its definition is a somewhat
complicated recursive definition, which is not easily digested. In fact, it takes a non-trivial analysis to
demonstrate that the usual definition indeed is well-defined, as pointed out in Ferreira [96], Zantema
[02].
The second is that it is difficult to show the essential property of RPO, namely that it is a wellfounded order. The usual route is via the powerful and beautiful Kruskal Tree Theorem (KTT). (See
Kruskal [60 ].)This difficulty becomes manifest in class-room: a full treatment of KTT is often
beyond the scope of an introductory course.
In the present paper both ‘problems’ are eliminated. We give an ‘operational’ definition of
RPO using a ‘meta’-rewrite system that is neither terminating nor confluent. The definition could be
called ‘iterative’ rather than ‘recursive’, hence our name ‘iterative path orders’ (IPO).
The distinctive feature of this meta-rewrite system is the use of a marker ‘*’ with intuitive
content: ‘make this term smaller’. Thus, if t is a term of the TRS to be proved SN, then t*
ambiguously denotes some term smaller than t, in the order that we aim to define.
At this point we have only solved the first problem; the definition of IPO using the starred
terms t* is conceptually easy, certainly well-defined, and simple in its use. But we are not home-free;
it is not easy to prove that IPO is a strict p.o.; and for the well-foundedness we still need the appeal to
KTT. In the second part of the paper, this problem is overcome, as follows.
Recently we noted an extension of the IPO using terms with natural number labels instead of
‘*’, that has all the benefits of the starred terms, but in addition employs a meta-rewrite system that is
itself terminating, in contrast with the one described above. Thus the use of KTT is no longer
necessary.
The upshot is that the method is now perfectly well suited for class-room. This didactical gain
is not the only motivation however. The IPO method also may be interesting in itself, as it is readily
extendible to the setting of lexicographic or multiset 'status', and with more effort, to the higher-order
case. In addition, the IPO notion facilitates a closer analysis, as will be shown in the closing section
of this paper.
1. Transformation rules on starred terms: IPO with stars
Let Σ be a first-order signature, and > a strict partial ordering (called ‘precedence ordering’) of the
function and constant symbols of Σ. Let Σ* be a copy of Σ where every function and constant
symbol has a marker *:
Σ* = {F* | F ∈ Σ}.
15-01-2002
Iterative Path Orders
3
Now we consider the signature Σ ∪ Σ* of marked and unmarked symbols. Variables will not be
marked. Furthermore, the arity of F* equals the arity of F. Consider the following TRS ℜ on
(Σ ∪ Σ*)-terms. We will write the reduction relation of ℜ as ➝ , not the usual → that will be used
for the TRS that we intend to prove SN. We write ➝* for the transitive-reflexive closure of ➝ , and
+
➝ for the transitive closure. With T we denote Ter(Σ), the set of unmarked terms, and with T*,
Ter(Σ ∪ Σ*), the set of marked and unmarked terms. The four rules of ℜ are as in Table 1.1.
put
copy
select
F(x) ➝ F*(x)
F*(x) ➝ G(F*(x),...,F*(x))
F*(x 1 ,...,xn ) ➝ xi
down
F*(x, G(y), z) ➝ F(x, G*(y), z)
(F > G)
(1 ≤ i ≤ n)
Table 1.1. Transformation rules for IPO with stars.
Here x ≡ x1,...,xn, y ≡ y1,...,ym , z ≡ z1,...,zk are disjoint lists of pairwise different variables; in
rule copy the right-hand side has just as many copies of F*(x) as the arity of G admits; in rules put,
select F, F* are n-ary; in rule down, the arity of F, F* is n+k+1, the arity of G,G* is m. The rules
are actually rule schemes, e.g. the rule scheme down stands for all for all possibilities that respect the
arities.
1.1. NOTATION. If t ≡ F(t) with t = t1,...,tn ∈ T*, then t* ≡ F*(x).
1.2. EXAMPLE. Let Σ contain binary symbols F, H, a unary G and constants A, B with the ordering
F > H and B > A. Then we have in T* the reduction (which is rendered in Figure 1.1 in tree format):
F(A, G(B))
➝ put
F*(A, G(B))
➝ copy
H(F*(A, G(B)), F*(A, G(B)))
➝ select
H(G(B), F*(A, G(B)))
➝ put
H(G(B), F*(A, G*(B)))
➝ select
H(G(B), F*(A, B))
➝ copy
H(G(B), H(F*(A, B), F*(A, B)))
➝ select
H(G(B), H(A, F*(A, B)))
➝ select
15-01-2002
Iterative Path Orders
4
H(G(B), H(A, B))
F
A
F*
put
G
A
H
copy
F*
G
B
A
B
A
H
G
F*
B
H
select
A
F*
B
G*
A
B
G
B
G
F*
A
select
H
F*
B
B A
F*
B
H
select
A
H
A
H
G
B
G
B
H
A
B
copy
G
F*
B
G
B
put
G
F*
G
H
select
B
H
A
B
B
Figure 1.1. Reduction in ℜ (IPO with stars).
Clearly, ℜ is not CR, nor SN. For the latter, note that rule copy rewrites the left-hand side to
a context of the left-hand side.
2. Application to termination proofs; examples
Let (Σ, R) be a TRS with finite Σ. We will be especially interested in the relation ➝ restricted to the
+
+
‘real’ or ‘proper’ terms Ter(Σ). In Example 1.2 we had F(A, G(B)) ➝ H(G(B), H(A, B)). In fact,
15-01-2002
Iterative Path Orders
5
+
➝ on Ter(Σ) is the partial order that we aim to establish. It is a strict, well-founded partial order.
+
Both properties are not easily proved. Transitivity of ➝ is trivial, but acyclicity is hard: there is no
t ∈ Ter(Σ) such that t ➝ t. Note that on the auxiliary, marked terms we do have cycles as Example
+
2.1 shows.
2.1. EXAMPLE. (In the setting of Example 1.2.)
F*
A
F*
G
B
put
H
copy
A
H*
F*
G
A
B
F*
G
A
B
F*
G
A
B
F*
select
A
G
G
B
B
Figure 2.1. Cyclic reduction in ℜ.
(Note that , hence, ➝ is not SN on T* .)
+
The well-foundedness of ➝ on Ter(Σ) is even harder to show. For the moment we will put
+
these issues aside, and demonstrate the use of ➝ , to be called IPO with stars, for termination
proofs.
2.2. THEOREM. Let (Σ, R) be a TRS with finite Σ. Suppose the function and constant symbols of
Σ can be patially ordered in such a way that for the corresponding IPO ➝ we have, for every
+
reduction rule s → t of R, that s ➝ t.
+
Then (Σ, R) is SN.
+
PROOF. (1) ➝ on Ter(Σ) is a strict, well-founded partial order. (To be proved later!)
+
(2) ➝ is closed under contexts and substitutions:
s ➝ t ⇒ C[tσ] ➝ C[sσ].
+
+
15-01-2002
Iterative Path Orders
6
So, given an infinite reduction t0 → t1 → t2 → ... in R, we would have by (2) and the assumption on
reduction rules, that
+
+
+
t0 ➝ t1 ➝ t2 ➝ ...,
+
contradicting the well-foundedness of ➝ on Ter(Σ).
❑
We now give some examples of termination proofs using Theorem 2.2.
2.3. EXAMPLE. Let R be the TRS specifying addition A and multiplication M on the natural numbers
generated by zero 0 and successor S, with rules as in Table 2.1:
A(x, 0) → x
A(x, S(y)) → S(A(x, y))
M(x, 0) → 0
M(x, S(y) → A(x, M(x, y))
Table 2.1. Addition and multiplication on natural numbers.
Adopting the precedence order M > A > S, we can check that indeed for these four rules s → t we
+
have s ➝ t. E.g. for the fourth rule (see Figure 2.2):
M(x,S(y))
put
M*(x,S(y))
copy
A(M*(x,S(y)),M*(x,S(y)))
+
select
A(x,M*(x,S(y)))
down
A(x,M(x,y))
select
A(x,M(x,S*(y)))
Figure 2.2. M(x,S(y)) ➝+ A(x,M(x,y))
2.4. EXAMPLE (Dershowitz & Jouannaud [90]. Consider the string rewrite system R given by the
four rules as in Table 2.2.
15-01-2002
Iterative Path Orders
7
10 → 0001
01 → 1
11 → 0000
00 → 0
Table 2.2. String rewrite system on 0,1-words.
So we have e.g. the reduction
1101 → 100011 → 10011 → 0001011 →
001011 → 00100000 → 0000010000 → ...
To capture this string rewrite system in the framework of term rewriting, we perceive the
symbols 0,1 as unary function symbols and read the rules accordingly; e.g. 10 → 0001 is the
term rewrite rule
1(0(x)) → 0(0(0(1(x)))).
To show SN for R, we adopt the precedence order 1 > 0 and check, e.g. for the displayed
rule (dropping all brackets in the convention of association to the right- see Figure 2.3:)
10x
put
1*0x
copy
01*0x
copy
001*0x
+
copy
0001*0x
down
0001x
select
00010*x
15-01-2002
Iterative Path Orders
8
Figure 2.3. 10x ➝ + 0001x
2.5. EXAMPLE. (Primitive recursion.) Given a TRS which is IPO-terminating, and having a unary
function symbol g and a ternary function symbol h, we can define a binary function f on natural
numbers by the rules:
f(0,x) → g(0)
f(S(n),x) → h(f(n,x),n,x)
The resulting system is IPO-terminating again by taking the precedence order such that f > g and
f > h.
3. Transformation rules on labeled terms: IPO with labels
In Figure 3.1 we review in an abstract way the situation at hand. Figure 3.1(a) sets the goal: to prove
SN for the reduction relation →1. This can be done as in Figure 3.1(b), which depicts the method in
the first half of this paper: IPO with stars.
15-01-2002
Iterative Path Orders
9
(a)
Real terms with terminating (SN) reduction relation →1
(b)
Real terms together with auxiliary terms and reduction relation
→2 such that →1 is included in →2+, and such that →2+
restricted to the real terms, is SN. (NB: →2 need not be SN.)
It follows that →1 is SN. This is the situation of IPO with stars.
(c)
Real terms together with auxiliary terms and reduction relation
→3 such that →3 is SN, and →2+ = →3+, restricted to real terms.
It follows that →1 is SN. This is the situation of IPO with labels.
Figure 3.1. Proper and auxiliary terms
We will now improve that situation, as in Figure 3.1(c), by ‘refining’ IPO with stars. There,
the marker * could be seen as a quantum of energy, enabling the term t* to ‘stay alive for a while’.
But this energy quantum was unspecified. We will now assign instead of *, precise energy quanta in
the form of natural numbers. Thus we have next to the real terms Ter(Σ), labeled terms Ter(Σ l)
where
15-01-2002
Iterative Path Orders
10
Σ l = {Fk | F ∈ Σ, k ∈ N }.
In analogy with Section 1, we consider now the set Ter(Σ ∪ Σl) of labeled and unlabeled terms. As
before, the arity of Fk equals the arity of F.
Next, we consider the following TRS ℜ l on (Σ ∪ Σl)-terms. We will write the reduction
relation of ℜl as before as ➝, an overloading that will be solved by the context. The transformation
rules of ℜl are in Table 3.1:
(k ∈ N )
(F > G, k ∈ N )
(1 ≤ i ≤ n, k ∈ N)
put
copy
select
F(x) ➝ Fk(x)
F k+1 (x) ➝ G(Fk (x),...,Fk (x))
F k (x 1 ,...,xn ) ➝ xi
down
F k (x, G(y), z) ➝ F(x, G k' (y), z) (k, k' ∈ N )
Table 3.1. Transformation rules for IPO with labels.
The same arity conventions apply as for the analogous rules in Table 1.1 for IPO with stars. Our first
observation is that when we replace in Table 3.1 all k, k' by *, we arrive at the rules of Table 1.1.
Note furthermore the remarkable fact in the labeled rule down: the label k, when pushed down to the
subterm G(y), may jump to a much higher label k'!
We now arrive at the first important fact about IPO with labels, that we can paraphrase as:
IPO with stars = IPO with labels
More precisely:
3.1. THEOREM. Let t,s ∈ Ter(Σ). Then:
t ➝ stars s ⇔ t ➝ labels s.
+
+
Here ➝stars refers to the rules in Table 1.1, and ➝labels refers to the rules in Table 3.1. Let us
simplify this notation by writing ➝s and ➝l respectively.
+
PROOF. (⇐) Given a labeled reduction t ➝ l s, we replace all labels by stars *, thus arriving by our
+
observation above, at a starred reduction t ➝ s s.
15-01-2002
Iterative Path Orders
11
(⇒) Consider a starred reduction t ≡ t n ➝s t n-1 ➝ s ... ➝s t0 ≡ s. We will translate it stepwise to a
labeled reduction t' n ➝l tn-1 ➝l ... ➝l t' 0. This is done such that:
1. Each t' i is a labeled variant of ti, i.e., obtained from ti by replacing each * by some natural
number. (So, since t,s are unstarred, we again have t' n ≡ t and t' 0 ≡ s.)
2. A step t' i+1 ➝ l it'corresponds to the original step t i+1 ➝s ti by using the same rule (put,
select, etc.) to the subterm at the same position in t' i+1.
So, for example, a starred step
ti+1 ≡ H(F*(r),a*) ➝copy H(G(F*(r),F*(r),a*)) ≡ ti
will be translated to a labeled step
t' i+1 ≡ H(Fk+1(r'),a m ) ➝ copy H(G(Fk(r'),F k(r'),a m )) ≡ t' i.
This example illustrates that for the label of F in t' i+1 we have to make sure that it is not 0, since
otherwise the copy-step would be blocked.
Note that, granted this no-blocking requirement, the translation is almost determined by what is said
in 1. and 2. The only remaining choices are the labels k introduced in put-steps and the labels k'
introduced in down-steps. These choices are fixed by 3.
3. Let ti+1 ➝s ti be either a put- or a down-step. In both cases we choose for the new label in
t' i the number i.
We now have the following invariant throughout the reduction t' n ➝l tn-1 ➝l ... ➝l t' 0:
For all labels m in the term t' i we have m ≥ i.
This is easily verified. In t' n there are no labels; hence the statement is trivially true. For a label m in
t' i we have the following possibilities.
- It is copied from t' i+1, in which case we have even m ≥ i+1.
- It results by a copy-step from a label m+1 in t' i+1.
Then m+1 ≥ i+1, hence m ≥ i.
- It is introduced by a put- or a down-step. Then we have m = i.
The invariant implies that in the terms t' n , t' n-1, ... t' 1 all labels are non-zero. Hence the requirement
that a copy-step is never blocked, is fulfilled.
15-01-2002
Iterative Path Orders
12
Alternative proof of (⇒). Given a starred reduction from t to s.
We use the notion of "raising a labeling by 1". Let t be a labeled term. We can raise all its
labels by 1. That is, an occurrence of a labeled function symbol F m is replaced by Fm+1. Function
symbols without label are left untouched. So, e.g., raising the labels of the term F(G 6(x,a0)) by 1
yields the term F(G7(x,a1)). If the original labeling term was tL (with labeling L) we denote the result
by tL+1.
Also a reduction step can be raised. One easily verifies that if tL ➝ l sL' , then also tL+1 ➝ l
sL'+1 . A reduction sequence can be raised by raising all its steps.
We want to translate a starred reduction t ≡ t0 ➝s t1 ➝s ... ➝s tn ≡ s. We do this by, starting
out with t0, performing exactly the same reduction steps, only now taking each time a labeled variant.
For the rules copy and select this can be done uniquely, in an application of the rules put and down a
new label k or k' has to be chosen. Just do this arbitrarily.
There is only one potential problem: one may get stuck if one needs to use the rule copy on a
function symbol of which the label happens to be 0. Say this happens after i steps. So we have
already reached a partial result t ≡ t' 0 ➝ l ... ➝ l t' i, but the intended copy-step fromt' i is blocked.
Then just raise the whole reduction t ≡ t' 0 ➝ l ... ➝ l t' i by 1 to a reduction t ≡ t"0 ➝ l ... ➝ l t" i .
The new end term t"i has no label 0 anymore, hence the required copy-step t"i ➝ l t" i+1 can be
adjoined. And so on till n.
❑
Next we state the remarkable difference between ➝s and ➝l :
3.2. THEOREM. The rewrite relation ➝ l is SN.
PROOF. We will prove the statement
∀ l ∀F ∈ Σ ∀t1,...,tn ∈ SN Fl(t1,...,tn) ∈ SN
where t1,...,tn ∈ Ter(Σ ∪ Σl), SN is the set of strongly normalizing terms (with respect to ➝l), and l
is a label ∈ N or absent.We will prove the statement using well-founded induction to the triple
(F, (t1 ,...,tn ), l )
with a lexicographical ordering as follows:
(1) the first item in the triple refers to the well-founded precedence order of the function symbols F;
15-01-2002
Iterative Path Orders
13
(2) the second item is the ‘product order’of the well-founded orders of the ti (i = 1,...,n) that were
assumed to be SN;
(3) the third item is the label l of F in Fl(t1,...,tn); it is a natural number n or ω in case l is absent.
We have ω > n, for all n.
Now in order to prove the statement, it clearly suffices to prove that the one step reducts of
F l(t1,...,tn)are SN.
So, consider a term Fl(t1,...,tn), where by assumption the ti (i = 1,...,n) are SN. We have the
following induction hypothesis (IH):
For all terms F' l' (t' 1 ,...,t' n' ) such that t' 1 ,...,t' n' ) are SN, and of which
the triple is less than that of Fl(t1,...,tn), we have SN.
We now check successively all possible one step reducts of Fl(t1,...,tn), and prove these SN.
Case 1. The reduction step is internal:
F l(t 1 ,...,tn ) ➝ l Fl(t 1 ,...,ti' ,...,tn ).
Then the corresponding triple decreases in the second coordinate, so by IH Fl(t1,...,ti' ,...,tn) ∈ SN.
Case 2. The reduction step is
F(t 1 ,...,tn ) ➝ put Fk (t1 ,...,tn ).
Then we have a decrease in the third coordinate of the corresponding triple, since the ‘no-label’ (i.e.
ω) is greater than k.
Case 3. Fl(t1,...,tn) ➝ select ti. By assumption, ti ∈ SN.
Case 4. F k+1(t) ➝ copy G(F k(t),...,Fk(t)). Here F > G in the precedence order. By IH, the copied
arguments F k(t) of G are SN since k+1 > k. By a second application of IH, the G-term itself is SN
since F > G.
Case 5. Fk(t, G(s), r) ➝ down F(t, G k' (s), r)
(k, k' ∈ N )
By assumption, the arguments t, G(s), r are SN. So Gk' (s) is also SN, being a reduct of G(s) by the
put rule. Now F(t, G k' (s), r) is less with respect to the triple, due to a decrease in the second
15-01-2002
Iterative Path Orders
14
component. So by IH, F(t, Gk' (s), r) ∈ SN.
Having proved the statement in the beginning of the proof, we are through: a simple induction
to term formation finally shows that every term Fl(t1,...,tn)is SN. ❑
3.3. REMARK . This proof of termination is best seen as an adaptation of the proof technique
introduced by Buchholz [95]), which was later combined by Jouannaud and Rubio [99] with the
reducibility technique for λ-calculus, in order to prove termination of higher-order systems.
+
+
3.4. C OROLLARY. IPO with labels,➝ labels , and hence also IPO with stars, ➝ stars , is a strict,
❑
well-founded partial order on Ter(Σ).
4. IPO and RPO compared
+
First we show that the IPO-order ➝ is at least as strong as the RPO ➢rpo as defined e.g. in
[Zantema [2002] or rather the version with ‘product-order status’. That is, the product-extension of
➢rpo to tuples is defined as: (s 1, ..., sn) ➢rpo (t1, ..., tn) if si ➢rpo ti for some but at least one i, and
si = ti for the others. Here is the standard definition:
4.1. DEFINITION. s ➢ rpo t ⇔ s = f(s1, ..., sn) and
(1) si = t or si ➢rpo t for some 1 ≤ i ≤ n, or
(2) t = g(t1, ..., tm), s ➢ rpo ti for all 1 ≤ i ≤ m, and either
(a) f > g, or
(b) f = g and (s1, ..., sn) ➢ τ(f) rpo (t1, ..., tm )
(Here τ(f) refers to a 'status function' on the symbols f
4.2. LEMMA.
∈ Σ.)
s ➢rpo t ⇒ s ➝ t.
+
+
PROOF. Suppose s ➢rpo t with s = f(s1, ..., sn). We prove s ➝ t by induction on the derivation of
s ➢ rpo t.
• if si = t for some i, then f(s1, ..., sn) ➝ put f*(s1, ..., sn) ➝ select si.
15-01-2002
Iterative Path Orders
15
+
• if si ➢ rpo t for some i, then f(s1, ..., sn) ➝ put f*(s1, ..., sn) ➝ select si ➝ t, using IH.
• Suppose t = g(t1, ..., tm) and s ➢rpo tj for all j.
+
— If f > g, then f(s 1 , ..., s n ) ➝ put f*(s1 , ..., s n ) ➝ copy g(f*(s1 , ..., s n ) ➝ g(t1 , ..., t m), using IH
(m times) and closure of ➝ under contexts.
— If f = g, and say si ➢ rpo ti, then f(s1, ..., sn) ➝ put f*(s1, ..., sn) ➝ down
+
+
f(s 1 , ...,s i*, s n) ➝ f(s 1 ,...,t i ,...,s n ) ➝ f(s 1 ,...,ti,...,sn ), using IH 1 + k times and closure of
➝ under contexts.
❑
The converse of Lemma 4.2 holds as well. This follows from a "cut-elimination" result for
starred reduction. Details are provided in the Appendix.
5. Fine-structure of IPO
By a detailed analysis of the starred reduction relation, in the style of standardisation one can show
that along a starred reduction a function symbol needs to be marked with a * (using put or down) at
most once. This fact can be viewed as a cut-elimination result by taking the following perspective.
The unmarked symbols occurring on the left-/right-hand side of an ipo-rule are said to be
eliminated/introduced by an application of that rule. That is, copy- and down-steps introduce
unmarked function symbols, whereas put- and down-steps eliminate them. We then obtain cutelimination in the sense that there is no need to introduce a symbol by an ipo rule only to eliminate it
again later. With this result one easily shows that the IPO is a decidable ordering, and also that IPO
and RPO are equivalent. Details are included in the Appendix.
6. Concluding remarks
6.1. The lexicographic case can be accommodated in this framework. In Klop [92] it is shown how
the four rules with stars as in Table 1.1 can easily be extended with a fifth rule so that also e.g. the
TRS for Ackermann's function
A(0,x)
→ S(x)
A(S(x),0)
→ A(x,S(0))
A(S(x),S(y))
→ A(x,A(S(x),y))
can be proved terminating. This fifth rule is:
simplify left argument
15-01-2002
Iterative Path Orders
16
F*(t) ➝ F(t1*, n*(t),..., n*(t))
Example:
A(S(x),S(y))
A*(S(x),S(y))
( t = t1,...,tk (k ≥ 1); k-1 copies of n*(t) )
➝
➝
A(S*(x),A*(S(x),S(y))) ➝
A(x,A*(S(x),S(y)))
➝
A(x,A(S(x),S*(y)))
A(x,A(S(x),y)).
➝
The treatment with a labeled version, and the analogous proofs (such as SN for the labeled IPO rules)
carry over without problem.
6.2. More of a challenge is the extension of the present set-up from first-order to the higher-order
case, e.g. using the framework of HRSs (Nipkow [ 91]). For recent progress in extending the RPO
method to the higher-order case, see Jouannaud & Rubio [ 99], van Raamsdonk [ 01].
The IPO method is suitable for a generalization to the higher-order case. To substantiate this
claim, we offer a description of such a generalization, available at the URL
http://www.cwi.nl/~oostrom/hoipo.pdf. This work in progress is still tentative.
6.3. REMARK. Some well-known termination results in rewriting can easily be proved using IPO.
Namely: To show the finite developments lemma the down rule can be omitted. In fact, the labelled
rewrite system for IPO without the down rule is equivalent to the rewrite system with rules
fn+l(x) → Cm[y]
with C m a context consisting of symbols having label n and y variables among x (maybe containing
duplicates). Termination of this system corresponds exactly to the so-called finite family
developments theorem (Maranget). An adaptation to prove termination of superdevelopments (van
Raamsdonk [93] is also easy.
References
J.-P. Jouannaud and A. Rubio [1999], The higher-order recursive path ordering. In: Proc. of LICS’99, pp.402-411,
Trento, 1999.
F. Baader and T. Nipkow [1998]. Term Rewriting and All That. Cambridge University Press, Cambridge ,1998.
J.A. Bergstra and J.W. Klop [1985], Algebra of Communicating Processes with abstraction, Theor. Comp. Sci. 37
(1985) 77-121.
15-01-2002
Iterative Path Orders
17
I. Bethke, J.W. Klop, R.C. de Vrijer [2000], Descendants and origins in term rewriting, Information and Computation
159, 59-124 (2000).
W. Buchholz [1995], Proof-theoretic analysis of termination proofs, Ann. Pure Appl. Logic 75 (1995), no. 1-2, p. 5765.
N. Dershowitz and J.-P. Jouannaud [1990], Rewrite systems, Chapter 6, in: Handbook of Theoretical Computer
Science, ed. J. van Leeuwen, Volume B, Formal Models and Semantics, Elsevier Science Publishers B.V., 1990, p.
245-320.
N. Dershowitz [1982] Orderings for term rewriting systems, TCS 17(3), p.279-301.
N. Dershowitz [1987] Termination of rewriting, Journal of Symbolic Computation 3(1), p.69-116. Corrigendum in
4(3): 409-410.
J.W. Klop [1992]. Term rewriting systems. In S. Abramsky, D. Gabbay, and T. Maibaum, editors, Handbook of Logic
in Computer Science, Volume 2, chapter 1, p.1-116, Oxford University Press, 1992.
Ferreira, M.C.F. [1996]. Termination of term rewriting: well-foundedness, totality and transformations, Dissertation,
Utrecht University.
Kruskal, J.B. [1960]. Well-quasi-ordering, the Tree theorem, and Vazsonyi's conjecture, Transactions of the
American Mathematical Society 95, p. 210-225.
T. Nipkow [1991], Higher-order critical pairs. In Proc. of LICS '91, Amsterdam, p.342-349.
D.A. Plaisted [1978]. A recursively defined ordering for proving termination of term rewriting systems. Report R-78943, University of Illinois, Urbana, Illinois, 1978.
F. van Raamsdonk [1993], Confluence and superdevelopments. In: Proc. of RTA '93, (C. Kirchner, ed.), Montreal, p.
168-182, Springer LNCS 690
F. van Raamsdonk [2001], On Termination of Higher-Order rewriting, in: Proc. RTA 2001, LNCS 2051, pp.261-275,
2001, Springer-Verlag.
H. Zantema [2002], Termination, Chapter 6, in: Terese, Term Rewriting Systems.
Terese [2002], Term Rewriting Systems, to appear, CUP 2002.
15-01-2002
Iterative Path Orders
18
15-01-2002
A
Cut-elimination for ⇒∗
In this appendix we present the proof of the cut-elimination theorem for iporeduction: there is no need to ‘introduce’ a symbol by an ipo rule only to ‘eliminate’ it again later. Here the unmarked symbols occurring on the left-/righthand side of an ipo-rule are said to be eliminated/introduced by an application
of that rule. That is, copy- and down-steps introduce unmarked function symbols, whereas put- and down-steps eliminate them. Cut-elimination is shown
using a property which is similar to standardisation as found in term rewriting
([GLM92]): we show that we may sort ⇒-steps in an outside-in (with respect
to the abstract syntax tree) manner. Although our definition is the same in
spirit as the usual definition of standardness in capturing outside-in reductions,
and indeed coincides with it on the first example below, it is tailor-made for
the cut-elimination property we want to prove: since introduced symbols may
not be eliminated at all, steps really move downwards, and may not stay at the
same level as in ordinary standardisation. We will show how to transform any
ipo-reduction into a standard one, by gradually removing non-standard steps in
favour of standard ones.
Before formalising this, we need to introduce two auxiliary concepts, both
originating with the fact that trees (terms) may have several branches (subterms). Because of this it will be convenient to introduce a notion of parallel
step and an appropriate measure on parallel reductions, which will decrease
during the standardisation process.
Definition 1 A parallel ⇒-step may perform any number of ⇒-steps in parallel, i.e. contract any number of ⇒-redexes at disjoint positions in the term.
Parallel steps will be denoted by ⇛. The measure µ(R) of a parallel reduction
R of length n is the n + 1-tuple (n, mn , . . . , m1 ) where mi is the multiset of the
positions of the contracted redexes in the ith parallel step. The order on the
measure is the lexicographic product of the order on the natural numbers first
and then the multiset extension of the inverse of the prefix-order on positions.
Our measure is an adaptation of the measure as introduced in [SR90]. Note the
two reversals of order in the measure.
• The reversal of order of the mi stems from the idea of standardisation:
to remove an outermost step o from a reduction R, by permuting it up
front. This may lead, in case o is a copy-step, to duplication of the steps
inside and in front of o in R. Hence, the removal of some step (o) should
outweigh the duplication of steps in front of it; this is exactly which is
achieved by the measure.
• The reversal of the prefix-order is based on the idea that arriving at a
term by performing a step which is remote from the root, is smaller than
arriving at that term via a step closer to the root. Well-foundedness is
guaranteed by the fact that terms are finite: the position of a step toward
the term s can not be deeper than the height of s.
1
Before presenting our formalisation, of standardisation and standardness, let us
give an intuitive example.
Example 1 Let a ≻ b and f ≻ g in the precedence. Suppose we want to
transform the following ⇛-reduction R (of length 5) into standard form,
f (a) ⇒ f (a∗ ) ⇒ f (b) ⇒ f ∗ (b) ⇒ g(f ∗ (b), f ∗ (b)) ⇛ g(b, b)
Its measure is (5, [1, 2], [ǫ], [ǫ], [1], [1]), where we have used square brackets to
denote multisets, and ǫ to denote the empty (root) position.
• We observe that R is not standard since the third step, marking the underline f is outermost, whereas the first two steps are not. Hence, we should
permute the third step up front. This yields the ⇛-reduction,
standard
z
}|
{
f (a) ⇒ f ∗ (a) ⇒ f ∗ (a∗ ) ⇒ f ∗ (b) ⇒ g(f ∗ (b), f ∗ (b)) ⇛ g(b, b)
• Note that the first step is now standard, and the measure of the remaining,
non-standard, steps is (4, [1, 2], [ǫ], [1], [1]) the remaining ones are not: the
fourth step takes place outside the third and fourth steps, so they should
be permuted. This yields the reduction,
standard
}|
{
z
f (a) ⇒ f ∗ (a) ⇒ g(f ∗ (a), f ∗ (a)) ⇛ g(f ∗ (a∗ ), f ∗ (a∗ )) ⇛ g(f ∗ (b), f ∗ (b)) ⇛ g(b, b)
• Now the first two steps are standard, and the measure of the remaining
ones is (3, [1, 2], [11, 21], [11, 21]). Note how permuting a (copy) step up
front has lead to the duplication of steps in front of it. Next, note that the
reduction is still not standard since the fifth step (both redexes) is outside
both the third and fourth step. Say we select the leftmost of these first for
permutation. This yields,
standard
}|
{
z
f (a) ⇒ f ∗ (a) ⇒ g(f ∗ (a), f ∗ (a)) ⇒ g(a, f ∗ (a)) ⇒ g(a, f ∗ (a∗ )) ⇛ g(a∗ , f ∗ (b)) ⇛ g(b, b)
with measure of the non-standard part (3, [1, 2], [11, 21], [21])
• Finally, permuting the rightmost one as well yields the standard reduction,
f (a) ⇒ f ∗ (a) ⇒ g(f ∗ (a), f ∗ (a)) ⇛ g(a, a) ⇛ g(a∗ , a∗ ) ⇛ g(b, b)
Note how in the example, the measure of the non-standard part decreases in
each step.
Definition 2 A ⇛-reduction R : s ⇛∗ t from some ordinary term (without
marked symbols) to another one is standard if it is in either of the following
forms:
2
• Either all steps are internal, in the sense that nowhere in R a rule is
applied to the head symbol. This implies s = f (s1 , . . . , sn ) and t =
f (t1 , . . . , tn ), for some function symbol f , which is not involved in any reduction step of R. Then we require, for every i, the projection Ri :si ⇛∗ ti
of R onto the ith argument of f , to be a standard reduction.
• Or the reduction starts off with a head step, which therefore (s contains
no marked symbols!) must be a put-step, say resulting in f ∗ (s1 , . . . , sn ).
Then we require the rest of R to be of the following form.
1. First, we may perform any number of copy-steps. This results in a
term C[s′1 , . . . , s′m ], such that C consists entirely of symbols smaller
than f (in the precedence), and with each s′j of shape f ∗ (s1 , . . . , sn ).
2. Next, a single ⇛-step is performed, which performs either a selector a down step on each s′j .
3. After that, no steps may take place in the context C and the remaining
reductions inside the holes of C, or rather their projections, must be
of the following shape depending on the ⇒-redex contracted above it
in the previous item:
– If the step was a select-step, then the reduction must be standard,
– If the step was a down-step (hence the head symbol is marked)
then the reduction on the subterm with the marked symbol must
have the form required by item 1.
We write s ⇒std t to denote a parallel ipo-reduction from s to t which is standard.
An example illustrating the second item was already presented above. Let’s
give an example of the first item and also one showing how cuts are eliminated.
Example 2
• Assume a precedence as above. The non-head reduction
f (g(a)) ⇒ f (g ∗ (a)) ⇒ f (a) ⇒ f (a∗ ) ⇒ f (b)
is standard standard since its projection on the first (only) argument of f
is:
g(a) ⇒ g ∗ (a) ⇒ a ⇒ a∗ ⇒ b
• Suppose a ≻ b ≻ c. Then
a ⇒ a∗ ⇒ b ⇒ b∗ ⇒ c ⇒ c∗
Observe that it did not make sense to introduce b; since a is greater than c
in the precedence (by transitivity) anyway, we might have used a instead of
b to introduce c immediately. That is, we may eliminate the cut between the
second and third step, between introducing b and eliminating it, resulting
in the cut-free reduction
a ⇒ a∗ ⇒ c
3
We now show that any ipo-reduction may be transformed into a standard one.
The proof idea is to split a reduction into an initial part which is already standard and ‘insert’ the steps of the final part one-by-one into this initial part,
preserving standardness of that part. This has been illustrated by the example
above already.
Lemma 1 If s ⇒∗ t (for ordinary terms), then s ⇒std t.
Proof 1 Since every ⇒-step is a ⇛-step as well, we may assume R : s ⇛∗ t.
The proof is by induction on the size of s. We distinguish cases depending on
whether some head step is performed in R or not.
The easy case is when R contains no head-step. Then we have s = f (s1 , . . . , sn ),
t = f (t1 , . . . , tn ) and Ri :si ⇒∗ ti , for all 1 ≤ i ≤ n. By the induction hypothesis
(each si is smaller in size than s) we have Si :si ⇒std ti . Now performing each of
the standard reductions Si in parallel on each argument si of s yields a standard
reduction from s to t, using the first clause of the definition of standardness.
The difficult case is when R does contain a head step. First, we show that
this head step, which incidentally must be a put-step since s does not contain
marked symbols, can be permuted up front and after that we show that the rest
of the reduction can be put into standard form.
1. Since R contains a head step, we can decompose it uniquely into I; h; A,
where I is a reduction consisting of internal steps, h is a head step
f (s′1 , . . . , s′n ) ⇒put f ∗ (s′1 , . . . , s′n ), and A is a reduction arbitrary form.
That I is internal means that it can be written as: I : f (s1 , . . . , sn ) ⇛∗
f (s′1 , . . . , s′n ), for some f , because Ri : si ⇛∗ ti for each i. Hence, symbolically, we could denote I as f (R1 , . . . , Rn ). Note that we could have
performed the h-step immediately: s ⇒ f ∗ (s1 , . . . , sn ) ⇒∗ f (s′1 , . . . , s′n ).
Using the symbolic notation, we can transform f (R1 , . . . , Rn ); h into h̄; Ī,
with Ī = f ∗ (R1 , . . . , Rn ).
Now (at least) the first step of the resulting reduction conforms to the
definition of standardness: it is a put-step. In order to transform the rest
of the reduction into standard form, we analyse what may happen to the
marked symbol f ∗ in the course it. First note that some head-step must
be performed in Ī; A, hence in A, since the final term t does not contain
any marked symbols. The idea is that the f ∗ ‘causes’ a context of the final
term t as prescribed by the standard reduction.
2. So let’s assume that our reduction from f ∗ (s1 , . . . , sn ) to t decomposes
as P; N where P is the partial standard part (initially empty) and N the
not–known–to–be–standard part (initially the whole reduction). By partial
standard, we mean that it consists of a number of copy-steps, creating a
context C (initially empty) of symbols smaller than f , followed by a single
⇛-select/down step p on some marked symbols, directly below C (initially
performing no steps at all). One easily shows that all arguments of C, not
(yet) contracted by p must be of shape f ∗ (s1 , . . . , sn ).
4
We show that we may transform P; N into S; D[N1 , . . . , Nn ] for some
standard reduction S, as conforming to the second clause of its definition,
context D consisting of function symbols all smaller than f according to
the precedence, and non-standard reductions Ni , starting from either some
si or some s∗i (i.e. the head symbol is marked, due to an application of
a down-step above it in the parallel ipo step p). Since the size of si is
smaller than that of s, we may apply the induction hypothesis to each Ni
(‘jumping’ the first item, in case the head symbol is already marked). The
result then follows by applying either the first or the second subclause of
the third item of the definition of standardness. The proof that we may
perform such a transformation is by induction on the measure µ(N ) of the
not–known–to–be–standard part N .
3. Consider an outermost-first ipo step o in N (possibly as element of a larger
⇛-step O performing other ⇒-steps in parallel as well), taking place at
a position in C. Here by taking place in C we mean that its position is
either a position properly belonging to C or a position of one of the holes
of C where no select-step is performed by the final parallel ipo-step p. By
outermost–first we mean that it is outermost, i.e. at minimal distance to
the root, among the steps in N , and the first step in N at that position.
Hence, we can write N as T ; O; U where no step in T takes place at the
path from the root to the position of o.
Note that as long as the parallel ipo step p does not contract all redexes
below C, then such a step o must exist since the final term t does not contain any marked symbols, by assumption. We distinguish cases according
to whether the position of o is properly in C (a non-hole position), or not
(a hole position).
• Suppose o occurs in a non-hole position, i.e. at a proper position of
C. Then, by the assumption that C consists of ordinary function
symbols, o must be a put-step, since the steps in T do not affect it by
the choice of o as outermost-first step in N . Say o:E[g(u1 , . . . , um ) ⇒
g ∗ (u1 , . . . , um )]. Note that we have a cut now, since all symbols in
C had been introduced before. Again by outermost–firstness, no step
among the remaining steps in U take place on the path from the root
to the position of o. Note that since o occurs properly in C, we know
that g is smaller than f in the precedence.
Since the final term t contains no marked symbols, some step, say
v, must contract a redex at the same position as o. We distinguish
cases according to the rule applied in v.
– The rule cannot be the put-rule, since marked symbols cannot be
marked again.
– Suppose the rule is a copy-rule, so v contracts some g ∗ (u′1 , . . . , u′m )
−−−−−−−−−−→
into h(g ∗ (u′1 , . . . , u′m )). Then we might have performed this copying in P already, since h ≺ g ≺ f . More precisely, consider the
5
steps in P ; T below v, taking place from the moment g was introduced in the context C. This introduction is due to a copy-step
introducing g. Now instead of this introduction, we could have
introduced h immediately. Schematically (and roughly, since we
forget about intermediate steps):
−−−−
−
→
−−−→
−−−→
−−
−−
→
f ∗ (~s) ⇒ g(f ∗ (~s)) ⇒ g ∗ (f ∗ (~s)) ⇒ h(g ∗ (f ∗ (~s)))
is transformed into:
−−−
−
→
−−−−
−
→
−−−→
−−
−−
→
−−
−−
→
f ∗ (~s) ⇒ h(f ∗ (~s)) ⇛ h(g(f ∗ (~s))) ⇛ h(g ∗ (f ∗ (~s)))
This removes the copy-step from N , hence decreases its measure.
– Suppose the rule is a select-rule. Then we should not have performed the corresponding copy step in P at the first place. Schematically:
−−−→
−−−→
f ∗ (~s) ⇒ g(f ∗ (~s)) ⇒ g ∗ (f ∗ (~s)) ⇒ f ∗ (~s)
can just be removed (the first step from P and the latter steps
from N ). This decreases the measure.
– Suppose the rule is a down-rule. Then we could instead of performing o and v in N , simply omit o and just put a marker
directly on the symbol below g ∗ marked by v, by means of a putstep. Schematically a part of N looks like:
∗
g(u1 , . . . , um ) ⇒ g ∗ (u1 , . . . , um ) ⇒∗ g ∗ (u′1 , . . . , u′m ) ⇒down g(. . . , u′i , . . .)
This part can be transformed into
∗
g(u1 , . . . , um ) ⇒∗ g(u′1 , . . . , u′m ) ⇒put g(. . . , u′i , . . .)
This transformation decreases the measure since the initial putstep is elided from N .
• Suppose o occurs in a hole position, not among the hole positions
contracted by p yet. Then we know that the rule applies to some
subterm having either f ∗ or f as head symbol.
– In case the subterm has f as head-symbol, then there is a corresponding down-step in p. Then we know that the rule applied
in o must be a put-rule applied to f . That is, we have a cut
between a down-step introducing f and a put-step marking it.
Schematically, the situation is:
f ∗ (~s) ⇒down f (. . . , s∗i , . . .) ⇒∗ f (. . . , s′i , . . .) ⇒put f ∗ (. . . , s′i , . . .)
This can be transformed into:
f ∗ (~s) ⇒put f ∗ (. . . , s∗i , . . .) ⇒∗ f ∗ (. . . , s′i , . . .)
6
Hence we remove the down-step from the parallel step p, prefix
a put-step to N , but remove the put-step from the reduction N .
The resulting reduction N ′ still has the same length and final
term as N , but the final step(s) of N ′ are more remote from the
root than the final (put-)step of N . Hence, the measure decreases.
– In case the subterm has f ∗ as head symbol, then we distinguish
cases according to the rule applied in o.
∗ The rule applied cannot be a put rule, since marked symbols
cannot be marked again.
∗ If the rule is the copy-rule, then we can permute it into C so
to speak, and repeat on the remaining part.
∗ If the rule is the select- or the down-rule, then we can permute it and adjoin it to p, and repeat on the remaining part.
Hence, ⇒ has the cut-elimination property, in the sense that we never need
to mark (and subsequently use) a symbol introduced before. Moreover, stars
can be handled one at the time. As a consequence, we may visualise an ⇒reduction as a top-down mark-and-sweep process. At any moment during this
process, there is at most one marked symbol at any path from the root to a leaf.
Theorem 1 (cut-elimination) If s ⇒std t ⇒std u, then s ⇒std u.
Lemma 2 It is decidable (for a well-ordered precedence) whether s ⇒∗ t, for
unmarked terms s and t.
Proof 2 By the previous lemma, we only need to consider for all symbols in s
all possible introductions (combined) up to the size of t.
As a consequence we can restrict the labels needed for ‘guessing’ to the hight
of the right-hand side to check each rule. (This is not very efficient of course).
Next we use our characterisation to show that ⇒+ is the same (extensionally)
as the order ≻rpo as defined in the main text.
Lemma 3 s ≻rpo t if s ⇒+ t.
Proof 3 Suppose s ⇒+ t. We construct a proof of s ≻rpo t by induction
on the length of the reduction. By the lemma above, we may assume that for
s = f (s1 , . . . , sn ) we have s∗ ⇒+ t by a top-down mark-and-sweep procedure
(if the first marker would be put below the root, then we could simulate that
by putting a marker on the root and executing a number of down steps). The
clauses below refer to the clauses in the main text.
• If the next step is a copy step, then t = g(t1 , . . . , tn ) for f ≻ g and s∗ ⇒+ ti
for all i, hence si ≻rpo ti by IH, hence s ≻rpo t by clause (2)(a).
• If the next step is a select step to the ith argument, then either t = si and
s ≻rpo t follows by clause (1)(a) the first case, or s∗i ⇒+ t, hence by the
IH si ≻rpo t and s ≻rpo t follows by clause (1)(a) the second case.
7
• If the next step is a down step, then we have t = f (t1 , . . . , tn ) and si ⇒+ ti
for some but at least one i and si = ti for the others. Then s ≻rpo t follows
by clause (2)(b) since by the IH si ≻rpo ti for some but at least one i and
si = ti for the others, hence hs1 , . . . , sn i ≻rpo htn , . . . , tn i.
Note that the relation ⇒+ trivially is a reduction order; closure under contexts
and substitutions follows by the definition of ⇒ by means of a TRS and wellfoundedness was established above. Hence, ⇒+ is an effective witness to the
unique relation satisfying the ≻rpo -equalities in the main text.
References
[GLM92] G. Gonthier, J.-J. Lévy, and P.-A. Melliès. An abstract standardisation theorem. In Proceedings of the 7th IEEE Symposium on Logic in
Computer Science, pages 72–81, 1992.
[SR90]
R.C. Sekar and I.V. Ramakrishnan. Programming in equational logic:
Beyond strong sequentiality. In Proceedings of the 5th IEEE Symposium on Logic in Computer Science, pages 230–241, 1990.
8
1
Iterative Path Orders
Extended abstract
Jan Willem Klop
Department of Theoretical Computer Science, Vrije Universiteit,
de Boelelaan 1081a, 1081 HV Amsterdam, The Netherlands;
CWI, P.O. Box 94079, 1090 GB Amsterdam, The Netherlands;
Department of Computer Science, University of Nijmegen, Toernooiveld 1,
6525 ED Nijmegen, The Netherlands
[email protected]
Vincent van Oostrom1
Department of Philosophy, Utrecht University,
P.O.Box 80089, 3508 TB Utrecht, The Netherlands
[email protected]
Roel de Vrijer
Department of Theoretical Computer Science, Vrije Universiteit,
de Boelelaan 1081a, 1081 HV Amsterdam, The Netherlands
[email protected]
___________________________________________________________
In the first half of this paper we give an alternative version of the recursive path order
(RPO) for first-order term rewriting, which is ‘iterative’ rather than recursive. Hence the
name iterative path order (IPO).
In the second part of the paper we prove that IPO is a well-founded order, by a
simple argument familiar from Proof Theory. To this end we employ a labeled extension
of IPO.
The result is an easy to grasp and powerful termination proof technique, whose
correctness proof avoids the usual appeal to Kruskal’s Tree Theorem.
We finally argue that the method is extendible to the lexicographic case and to
the higher-order case.
The IPO method is easily seen to be as powerful as the usual RPO. In fact, the
orderings are equivalent. This result requires a fine-grained analysis of IPO, that is added
in an Appendix.
___________________________________________________________
Contents
0. Introduction.
1. Transformation rules on starred terms.
2. Application to termination; examples.
3. Transformation rules on labeled terms.
4. IPO and RPO compared.
5. Fine-structure of IPO.
6. Concluding remarks.
References.
Appendix (separate).
0. Introduction
We are concerned with proving termination (or Strong Normalization, SN) for first order term
Contact author: Vincent van Oostrom, tel. +31 30 2532761; fax +31 30 2532816.
1
15-01-2002
Iterative Path Orders
2
rewriting systems. There are various methods to do so–see Dershowitz & Jouannaud [90], Zantema
[02]. Of all these methods, probably the most well-known and most powerful is the method of
recursive path orders (RPO), developed by Dershowitz [82,87 ] on the basis of Plaisted’s precursor
of that notion, associative path orders Plaisted [78 ]. The method has been widely paraphrased and
extended.
There are two ‘problems’ with the RPO method. The first is that its definition is a somewhat
complicated recursive definition, which is not easily digested. In fact, it takes a non-trivial analysis to
demonstrate that the usual definition indeed is well-defined, as pointed out in Ferreira [96], Zantema
[02].
The second is that it is difficult to show the essential property of RPO, namely that it is a wellfounded order. The usual route is via the powerful and beautiful Kruskal Tree Theorem (KTT). (See
Kruskal [60 ].)This difficulty becomes manifest in class-room: a full treatment of KTT is often
beyond the scope of an introductory course.
In the present paper both ‘problems’ are eliminated. We give an ‘operational’ definition of
RPO using a ‘meta’-rewrite system that is neither terminating nor confluent. The definition could be
called ‘iterative’ rather than ‘recursive’, hence our name ‘iterative path orders’ (IPO).
The distinctive feature of this meta-rewrite system is the use of a marker ‘*’ with intuitive
content: ‘make this term smaller’. Thus, if t is a term of the TRS to be proved SN, then t*
ambiguously denotes some term smaller than t, in the order that we aim to define.
At this point we have only solved the first problem; the definition of IPO using the starred
terms t* is conceptually easy, certainly well-defined, and simple in its use. But we are not home-free;
it is not easy to prove that IPO is a strict p.o.; and for the well-foundedness we still need the appeal to
KTT. In the second part of the paper, this problem is overcome, as follows.
Recently we noted an extension of the IPO using terms with natural number labels instead of
‘*’, that has all the benefits of the starred terms, but in addition employs a meta-rewrite system that is
itself terminating, in contrast with the one described above. Thus the use of KTT is no longer
necessary.
The upshot is that the method is now perfectly well suited for class-room. This didactical gain
is not the only motivation however. The IPO method also may be interesting in itself, as it is readily
extendible to the setting of lexicographic or multiset 'status', and with more effort, to the higher-order
case. In addition, the IPO notion facilitates a closer analysis, as will be shown in the closing section
of this paper.
1. Transformation rules on starred terms: IPO with stars
Let Σ be a first-order signature, and > a strict partial ordering (called ‘precedence ordering’) of the
function and constant symbols of Σ. Let Σ* be a copy of Σ where every function and constant
symbol has a marker *:
Σ* = {F* | F ∈ Σ}.
15-01-2002
Iterative Path Orders
3
Now we consider the signature Σ ∪ Σ* of marked and unmarked symbols. Variables will not be
marked. Furthermore, the arity of F* equals the arity of F. Consider the following TRS ℜ on
(Σ ∪ Σ*)-terms. We will write the reduction relation of ℜ as ➝ , not the usual → that will be used
for the TRS that we intend to prove SN. We write ➝* for the transitive-reflexive closure of ➝ , and
+
➝ for the transitive closure. With T we denote Ter(Σ), the set of unmarked terms, and with T*,
Ter(Σ ∪ Σ*), the set of marked and unmarked terms. The four rules of ℜ are as in Table 1.1.
put
copy
select
F(x) ➝ F*(x)
F*(x) ➝ G(F*(x),...,F*(x))
F*(x 1 ,...,xn ) ➝ xi
down
F*(x, G(y), z) ➝ F(x, G*(y), z)
(F > G)
(1 ≤ i ≤ n)
Table 1.1. Transformation rules for IPO with stars.
Here x ≡ x1,...,xn, y ≡ y1,...,ym , z ≡ z1,...,zk are disjoint lists of pairwise different variables; in
rule copy the right-hand side has just as many copies of F*(x) as the arity of G admits; in rules put,
select F, F* are n-ary; in rule down, the arity of F, F* is n+k+1, the arity of G,G* is m. The rules
are actually rule schemes, e.g. the rule scheme down stands for all for all possibilities that respect the
arities.
1.1. NOTATION. If t ≡ F(t) with t = t1,...,tn ∈ T*, then t* ≡ F*(x).
1.2. EXAMPLE. Let Σ contain binary symbols F, H, a unary G and constants A, B with the ordering
F > H and B > A. Then we have in T* the reduction (which is rendered in Figure 1.1 in tree format):
F(A, G(B))
➝ put
F*(A, G(B))
➝ copy
H(F*(A, G(B)), F*(A, G(B)))
➝ select
H(G(B), F*(A, G(B)))
➝ put
H(G(B), F*(A, G*(B)))
➝ select
H(G(B), F*(A, B))
➝ copy
H(G(B), H(F*(A, B), F*(A, B)))
➝ select
H(G(B), H(A, F*(A, B)))
➝ select
15-01-2002
Iterative Path Orders
4
H(G(B), H(A, B))
F
A
F*
put
G
A
H
copy
F*
G
B
A
B
A
H
G
F*
B
H
select
A
F*
B
G*
A
B
G
B
G
F*
A
select
H
F*
B
B A
F*
B
H
select
A
H
A
H
G
B
G
B
H
A
B
copy
G
F*
B
G
B
put
G
F*
G
H
select
B
H
A
B
B
Figure 1.1. Reduction in ℜ (IPO with stars).
Clearly, ℜ is not CR, nor SN. For the latter, note that rule copy rewrites the left-hand side to
a context of the left-hand side.
2. Application to termination proofs; examples
Let (Σ, R) be a TRS with finite Σ. We will be especially interested in the relation ➝ restricted to the
+
+
‘real’ or ‘proper’ terms Ter(Σ). In Example 1.2 we had F(A, G(B)) ➝ H(G(B), H(A, B)). In fact,
15-01-2002
Iterative Path Orders
5
+
➝ on Ter(Σ) is the partial order that we aim to establish. It is a strict, well-founded partial order.
+
Both properties are not easily proved. Transitivity of ➝ is trivial, but acyclicity is hard: there is no
t ∈ Ter(Σ) such that t ➝ t. Note that on the auxiliary, marked terms we do have cycles as Example
+
2.1 shows.
2.1. EXAMPLE. (In the setting of Example 1.2.)
F*
A
F*
G
B
put
H
copy
A
H*
F*
G
A
B
F*
G
A
B
F*
G
A
B
F*
select
A
G
G
B
B
Figure 2.1. Cyclic reduction in ℜ.
(Note that , hence, ➝ is not SN on T* .)
+
The well-foundedness of ➝ on Ter(Σ) is even harder to show. For the moment we will put
+
these issues aside, and demonstrate the use of ➝ , to be called IPO with stars, for termination
proofs.
2.2. THEOREM. Let (Σ, R) be a TRS with finite Σ. Suppose the function and constant symbols of
Σ can be patially ordered in such a way that for the corresponding IPO ➝ we have, for every
+
reduction rule s → t of R, that s ➝ t.
+
Then (Σ, R) is SN.
+
PROOF. (1) ➝ on Ter(Σ) is a strict, well-founded partial order. (To be proved later!)
+
(2) ➝ is closed under contexts and substitutions:
s ➝ t ⇒ C[tσ] ➝ C[sσ].
+
+
15-01-2002
Iterative Path Orders
6
So, given an infinite reduction t0 → t1 → t2 → ... in R, we would have by (2) and the assumption on
reduction rules, that
+
+
+
t0 ➝ t1 ➝ t2 ➝ ...,
+
contradicting the well-foundedness of ➝ on Ter(Σ).
❑
We now give some examples of termination proofs using Theorem 2.2.
2.3. EXAMPLE. Let R be the TRS specifying addition A and multiplication M on the natural numbers
generated by zero 0 and successor S, with rules as in Table 2.1:
A(x, 0) → x
A(x, S(y)) → S(A(x, y))
M(x, 0) → 0
M(x, S(y) → A(x, M(x, y))
Table 2.1. Addition and multiplication on natural numbers.
Adopting the precedence order M > A > S, we can check that indeed for these four rules s → t we
+
have s ➝ t. E.g. for the fourth rule (see Figure 2.2):
M(x,S(y))
put
M*(x,S(y))
copy
A(M*(x,S(y)),M*(x,S(y)))
+
select
A(x,M*(x,S(y)))
down
A(x,M(x,y))
select
A(x,M(x,S*(y)))
Figure 2.2. M(x,S(y)) ➝+ A(x,M(x,y))
2.4. EXAMPLE (Dershowitz & Jouannaud [90]. Consider the string rewrite system R given by the
four rules as in Table 2.2.
15-01-2002
Iterative Path Orders
7
10 → 0001
01 → 1
11 → 0000
00 → 0
Table 2.2. String rewrite system on 0,1-words.
So we have e.g. the reduction
1101 → 100011 → 10011 → 0001011 →
001011 → 00100000 → 0000010000 → ...
To capture this string rewrite system in the framework of term rewriting, we perceive the
symbols 0,1 as unary function symbols and read the rules accordingly; e.g. 10 → 0001 is the
term rewrite rule
1(0(x)) → 0(0(0(1(x)))).
To show SN for R, we adopt the precedence order 1 > 0 and check, e.g. for the displayed
rule (dropping all brackets in the convention of association to the right- see Figure 2.3:)
10x
put
1*0x
copy
01*0x
copy
001*0x
+
copy
0001*0x
down
0001x
select
00010*x
15-01-2002
Iterative Path Orders
8
Figure 2.3. 10x ➝ + 0001x
2.5. EXAMPLE. (Primitive recursion.) Given a TRS which is IPO-terminating, and having a unary
function symbol g and a ternary function symbol h, we can define a binary function f on natural
numbers by the rules:
f(0,x) → g(0)
f(S(n),x) → h(f(n,x),n,x)
The resulting system is IPO-terminating again by taking the precedence order such that f > g and
f > h.
3. Transformation rules on labeled terms: IPO with labels
In Figure 3.1 we review in an abstract way the situation at hand. Figure 3.1(a) sets the goal: to prove
SN for the reduction relation →1. This can be done as in Figure 3.1(b), which depicts the method in
the first half of this paper: IPO with stars.
15-01-2002
Iterative Path Orders
9
(a)
Real terms with terminating (SN) reduction relation →1
(b)
Real terms together with auxiliary terms and reduction relation
→2 such that →1 is included in →2+, and such that →2+
restricted to the real terms, is SN. (NB: →2 need not be SN.)
It follows that →1 is SN. This is the situation of IPO with stars.
(c)
Real terms together with auxiliary terms and reduction relation
→3 such that →3 is SN, and →2+ = →3+, restricted to real terms.
It follows that →1 is SN. This is the situation of IPO with labels.
Figure 3.1. Proper and auxiliary terms
We will now improve that situation, as in Figure 3.1(c), by ‘refining’ IPO with stars. There,
the marker * could be seen as a quantum of energy, enabling the term t* to ‘stay alive for a while’.
But this energy quantum was unspecified. We will now assign instead of *, precise energy quanta in
the form of natural numbers. Thus we have next to the real terms Ter(Σ), labeled terms Ter(Σ l)
where
15-01-2002
Iterative Path Orders
10
Σ l = {Fk | F ∈ Σ, k ∈ N }.
In analogy with Section 1, we consider now the set Ter(Σ ∪ Σl) of labeled and unlabeled terms. As
before, the arity of Fk equals the arity of F.
Next, we consider the following TRS ℜ l on (Σ ∪ Σl)-terms. We will write the reduction
relation of ℜl as before as ➝, an overloading that will be solved by the context. The transformation
rules of ℜl are in Table 3.1:
(k ∈ N )
(F > G, k ∈ N )
(1 ≤ i ≤ n, k ∈ N)
put
copy
select
F(x) ➝ Fk(x)
F k+1 (x) ➝ G(Fk (x),...,Fk (x))
F k (x 1 ,...,xn ) ➝ xi
down
F k (x, G(y), z) ➝ F(x, G k' (y), z) (k, k' ∈ N )
Table 3.1. Transformation rules for IPO with labels.
The same arity conventions apply as for the analogous rules in Table 1.1 for IPO with stars. Our first
observation is that when we replace in Table 3.1 all k, k' by *, we arrive at the rules of Table 1.1.
Note furthermore the remarkable fact in the labeled rule down: the label k, when pushed down to the
subterm G(y), may jump to a much higher label k'!
We now arrive at the first important fact about IPO with labels, that we can paraphrase as:
IPO with stars = IPO with labels
More precisely:
3.1. THEOREM. Let t,s ∈ Ter(Σ). Then:
t ➝ stars s ⇔ t ➝ labels s.
+
+
Here ➝stars refers to the rules in Table 1.1, and ➝labels refers to the rules in Table 3.1. Let us
simplify this notation by writing ➝s and ➝l respectively.
+
PROOF. (⇐) Given a labeled reduction t ➝ l s, we replace all labels by stars *, thus arriving by our
+
observation above, at a starred reduction t ➝ s s.
15-01-2002
Iterative Path Orders
11
(⇒) Consider a starred reduction t ≡ t n ➝s t n-1 ➝ s ... ➝s t0 ≡ s. We will translate it stepwise to a
labeled reduction t' n ➝l tn-1 ➝l ... ➝l t' 0. This is done such that:
1. Each t' i is a labeled variant of ti, i.e., obtained from ti by replacing each * by some natural
number. (So, since t,s are unstarred, we again have t' n ≡ t and t' 0 ≡ s.)
2. A step t' i+1 ➝ l it'corresponds to the original step t i+1 ➝s ti by using the same rule (put,
select, etc.) to the subterm at the same position in t' i+1.
So, for example, a starred step
ti+1 ≡ H(F*(r),a*) ➝copy H(G(F*(r),F*(r),a*)) ≡ ti
will be translated to a labeled step
t' i+1 ≡ H(Fk+1(r'),a m ) ➝ copy H(G(Fk(r'),F k(r'),a m )) ≡ t' i.
This example illustrates that for the label of F in t' i+1 we have to make sure that it is not 0, since
otherwise the copy-step would be blocked.
Note that, granted this no-blocking requirement, the translation is almost determined by what is said
in 1. and 2. The only remaining choices are the labels k introduced in put-steps and the labels k'
introduced in down-steps. These choices are fixed by 3.
3. Let ti+1 ➝s ti be either a put- or a down-step. In both cases we choose for the new label in
t' i the number i.
We now have the following invariant throughout the reduction t' n ➝l tn-1 ➝l ... ➝l t' 0:
For all labels m in the term t' i we have m ≥ i.
This is easily verified. In t' n there are no labels; hence the statement is trivially true. For a label m in
t' i we have the following possibilities.
- It is copied from t' i+1, in which case we have even m ≥ i+1.
- It results by a copy-step from a label m+1 in t' i+1.
Then m+1 ≥ i+1, hence m ≥ i.
- It is introduced by a put- or a down-step. Then we have m = i.
The invariant implies that in the terms t' n , t' n-1, ... t' 1 all labels are non-zero. Hence the requirement
that a copy-step is never blocked, is fulfilled.
15-01-2002
Iterative Path Orders
12
Alternative proof of (⇒). Given a starred reduction from t to s.
We use the notion of "raising a labeling by 1". Let t be a labeled term. We can raise all its
labels by 1. That is, an occurrence of a labeled function symbol F m is replaced by Fm+1. Function
symbols without label are left untouched. So, e.g., raising the labels of the term F(G 6(x,a0)) by 1
yields the term F(G7(x,a1)). If the original labeling term was tL (with labeling L) we denote the result
by tL+1.
Also a reduction step can be raised. One easily verifies that if tL ➝ l sL' , then also tL+1 ➝ l
sL'+1 . A reduction sequence can be raised by raising all its steps.
We want to translate a starred reduction t ≡ t0 ➝s t1 ➝s ... ➝s tn ≡ s. We do this by, starting
out with t0, performing exactly the same reduction steps, only now taking each time a labeled variant.
For the rules copy and select this can be done uniquely, in an application of the rules put and down a
new label k or k' has to be chosen. Just do this arbitrarily.
There is only one potential problem: one may get stuck if one needs to use the rule copy on a
function symbol of which the label happens to be 0. Say this happens after i steps. So we have
already reached a partial result t ≡ t' 0 ➝ l ... ➝ l t' i, but the intended copy-step fromt' i is blocked.
Then just raise the whole reduction t ≡ t' 0 ➝ l ... ➝ l t' i by 1 to a reduction t ≡ t"0 ➝ l ... ➝ l t" i .
The new end term t"i has no label 0 anymore, hence the required copy-step t"i ➝ l t" i+1 can be
adjoined. And so on till n.
❑
Next we state the remarkable difference between ➝s and ➝l :
3.2. THEOREM. The rewrite relation ➝ l is SN.
PROOF. We will prove the statement
∀ l ∀F ∈ Σ ∀t1,...,tn ∈ SN Fl(t1,...,tn) ∈ SN
where t1,...,tn ∈ Ter(Σ ∪ Σl), SN is the set of strongly normalizing terms (with respect to ➝l), and l
is a label ∈ N or absent.We will prove the statement using well-founded induction to the triple
(F, (t1 ,...,tn ), l )
with a lexicographical ordering as follows:
(1) the first item in the triple refers to the well-founded precedence order of the function symbols F;
15-01-2002
Iterative Path Orders
13
(2) the second item is the ‘product order’of the well-founded orders of the ti (i = 1,...,n) that were
assumed to be SN;
(3) the third item is the label l of F in Fl(t1,...,tn); it is a natural number n or ω in case l is absent.
We have ω > n, for all n.
Now in order to prove the statement, it clearly suffices to prove that the one step reducts of
F l(t1,...,tn)are SN.
So, consider a term Fl(t1,...,tn), where by assumption the ti (i = 1,...,n) are SN. We have the
following induction hypothesis (IH):
For all terms F' l' (t' 1 ,...,t' n' ) such that t' 1 ,...,t' n' ) are SN, and of which
the triple is less than that of Fl(t1,...,tn), we have SN.
We now check successively all possible one step reducts of Fl(t1,...,tn), and prove these SN.
Case 1. The reduction step is internal:
F l(t 1 ,...,tn ) ➝ l Fl(t 1 ,...,ti' ,...,tn ).
Then the corresponding triple decreases in the second coordinate, so by IH Fl(t1,...,ti' ,...,tn) ∈ SN.
Case 2. The reduction step is
F(t 1 ,...,tn ) ➝ put Fk (t1 ,...,tn ).
Then we have a decrease in the third coordinate of the corresponding triple, since the ‘no-label’ (i.e.
ω) is greater than k.
Case 3. Fl(t1,...,tn) ➝ select ti. By assumption, ti ∈ SN.
Case 4. F k+1(t) ➝ copy G(F k(t),...,Fk(t)). Here F > G in the precedence order. By IH, the copied
arguments F k(t) of G are SN since k+1 > k. By a second application of IH, the G-term itself is SN
since F > G.
Case 5. Fk(t, G(s), r) ➝ down F(t, G k' (s), r)
(k, k' ∈ N )
By assumption, the arguments t, G(s), r are SN. So Gk' (s) is also SN, being a reduct of G(s) by the
put rule. Now F(t, G k' (s), r) is less with respect to the triple, due to a decrease in the second
15-01-2002
Iterative Path Orders
14
component. So by IH, F(t, Gk' (s), r) ∈ SN.
Having proved the statement in the beginning of the proof, we are through: a simple induction
to term formation finally shows that every term Fl(t1,...,tn)is SN. ❑
3.3. REMARK . This proof of termination is best seen as an adaptation of the proof technique
introduced by Buchholz [95]), which was later combined by Jouannaud and Rubio [99] with the
reducibility technique for λ-calculus, in order to prove termination of higher-order systems.
+
+
3.4. C OROLLARY. IPO with labels,➝ labels , and hence also IPO with stars, ➝ stars , is a strict,
❑
well-founded partial order on Ter(Σ).
4. IPO and RPO compared
+
First we show that the IPO-order ➝ is at least as strong as the RPO ➢rpo as defined e.g. in
[Zantema [2002] or rather the version with ‘product-order status’. That is, the product-extension of
➢rpo to tuples is defined as: (s 1, ..., sn) ➢rpo (t1, ..., tn) if si ➢rpo ti for some but at least one i, and
si = ti for the others. Here is the standard definition:
4.1. DEFINITION. s ➢ rpo t ⇔ s = f(s1, ..., sn) and
(1) si = t or si ➢rpo t for some 1 ≤ i ≤ n, or
(2) t = g(t1, ..., tm), s ➢ rpo ti for all 1 ≤ i ≤ m, and either
(a) f > g, or
(b) f = g and (s1, ..., sn) ➢ τ(f) rpo (t1, ..., tm )
(Here τ(f) refers to a 'status function' on the symbols f
4.2. LEMMA.
∈ Σ.)
s ➢rpo t ⇒ s ➝ t.
+
+
PROOF. Suppose s ➢rpo t with s = f(s1, ..., sn). We prove s ➝ t by induction on the derivation of
s ➢ rpo t.
• if si = t for some i, then f(s1, ..., sn) ➝ put f*(s1, ..., sn) ➝ select si.
15-01-2002
Iterative Path Orders
15
+
• if si ➢ rpo t for some i, then f(s1, ..., sn) ➝ put f*(s1, ..., sn) ➝ select si ➝ t, using IH.
• Suppose t = g(t1, ..., tm) and s ➢rpo tj for all j.
+
— If f > g, then f(s 1 , ..., s n ) ➝ put f*(s1 , ..., s n ) ➝ copy g(f*(s1 , ..., s n ) ➝ g(t1 , ..., t m), using IH
(m times) and closure of ➝ under contexts.
— If f = g, and say si ➢ rpo ti, then f(s1, ..., sn) ➝ put f*(s1, ..., sn) ➝ down
+
+
f(s 1 , ...,s i*, s n) ➝ f(s 1 ,...,t i ,...,s n ) ➝ f(s 1 ,...,ti,...,sn ), using IH 1 + k times and closure of
➝ under contexts.
❑
The converse of Lemma 4.2 holds as well. This follows from a "cut-elimination" result for
starred reduction. Details are provided in the Appendix.
5. Fine-structure of IPO
By a detailed analysis of the starred reduction relation, in the style of standardisation one can show
that along a starred reduction a function symbol needs to be marked with a * (using put or down) at
most once. This fact can be viewed as a cut-elimination result by taking the following perspective.
The unmarked symbols occurring on the left-/right-hand side of an ipo-rule are said to be
eliminated/introduced by an application of that rule. That is, copy- and down-steps introduce
unmarked function symbols, whereas put- and down-steps eliminate them. We then obtain cutelimination in the sense that there is no need to introduce a symbol by an ipo rule only to eliminate it
again later. With this result one easily shows that the IPO is a decidable ordering, and also that IPO
and RPO are equivalent. Details are included in the Appendix.
6. Concluding remarks
6.1. The lexicographic case can be accommodated in this framework. In Klop [92] it is shown how
the four rules with stars as in Table 1.1 can easily be extended with a fifth rule so that also e.g. the
TRS for Ackermann's function
A(0,x)
→ S(x)
A(S(x),0)
→ A(x,S(0))
A(S(x),S(y))
→ A(x,A(S(x),y))
can be proved terminating. This fifth rule is:
simplify left argument
15-01-2002
Iterative Path Orders
16
F*(t) ➝ F(t1*, n*(t),..., n*(t))
Example:
A(S(x),S(y))
A*(S(x),S(y))
( t = t1,...,tk (k ≥ 1); k-1 copies of n*(t) )
➝
➝
A(S*(x),A*(S(x),S(y))) ➝
A(x,A*(S(x),S(y)))
➝
A(x,A(S(x),S*(y)))
A(x,A(S(x),y)).
➝
The treatment with a labeled version, and the analogous proofs (such as SN for the labeled IPO rules)
carry over without problem.
6.2. More of a challenge is the extension of the present set-up from first-order to the higher-order
case, e.g. using the framework of HRSs (Nipkow [ 91]). For recent progress in extending the RPO
method to the higher-order case, see Jouannaud & Rubio [ 99], van Raamsdonk [ 01].
The IPO method is suitable for a generalization to the higher-order case. To substantiate this
claim, we offer a description of such a generalization, available at the URL
http://www.cwi.nl/~oostrom/hoipo.pdf. This work in progress is still tentative.
6.3. REMARK. Some well-known termination results in rewriting can easily be proved using IPO.
Namely: To show the finite developments lemma the down rule can be omitted. In fact, the labelled
rewrite system for IPO without the down rule is equivalent to the rewrite system with rules
fn+l(x) → Cm[y]
with C m a context consisting of symbols having label n and y variables among x (maybe containing
duplicates). Termination of this system corresponds exactly to the so-called finite family
developments theorem (Maranget). An adaptation to prove termination of superdevelopments (van
Raamsdonk [93] is also easy.
References
J.-P. Jouannaud and A. Rubio [1999], The higher-order recursive path ordering. In: Proc. of LICS’99, pp.402-411,
Trento, 1999.
F. Baader and T. Nipkow [1998]. Term Rewriting and All That. Cambridge University Press, Cambridge ,1998.
J.A. Bergstra and J.W. Klop [1985], Algebra of Communicating Processes with abstraction, Theor. Comp. Sci. 37
(1985) 77-121.
15-01-2002
Iterative Path Orders
17
I. Bethke, J.W. Klop, R.C. de Vrijer [2000], Descendants and origins in term rewriting, Information and Computation
159, 59-124 (2000).
W. Buchholz [1995], Proof-theoretic analysis of termination proofs, Ann. Pure Appl. Logic 75 (1995), no. 1-2, p. 5765.
N. Dershowitz and J.-P. Jouannaud [1990], Rewrite systems, Chapter 6, in: Handbook of Theoretical Computer
Science, ed. J. van Leeuwen, Volume B, Formal Models and Semantics, Elsevier Science Publishers B.V., 1990, p.
245-320.
N. Dershowitz [1982] Orderings for term rewriting systems, TCS 17(3), p.279-301.
N. Dershowitz [1987] Termination of rewriting, Journal of Symbolic Computation 3(1), p.69-116. Corrigendum in
4(3): 409-410.
J.W. Klop [1992]. Term rewriting systems. In S. Abramsky, D. Gabbay, and T. Maibaum, editors, Handbook of Logic
in Computer Science, Volume 2, chapter 1, p.1-116, Oxford University Press, 1992.
Ferreira, M.C.F. [1996]. Termination of term rewriting: well-foundedness, totality and transformations, Dissertation,
Utrecht University.
Kruskal, J.B. [1960]. Well-quasi-ordering, the Tree theorem, and Vazsonyi's conjecture, Transactions of the
American Mathematical Society 95, p. 210-225.
T. Nipkow [1991], Higher-order critical pairs. In Proc. of LICS '91, Amsterdam, p.342-349.
D.A. Plaisted [1978]. A recursively defined ordering for proving termination of term rewriting systems. Report R-78943, University of Illinois, Urbana, Illinois, 1978.
F. van Raamsdonk [1993], Confluence and superdevelopments. In: Proc. of RTA '93, (C. Kirchner, ed.), Montreal, p.
168-182, Springer LNCS 690
F. van Raamsdonk [2001], On Termination of Higher-Order rewriting, in: Proc. RTA 2001, LNCS 2051, pp.261-275,
2001, Springer-Verlag.
H. Zantema [2002], Termination, Chapter 6, in: Terese, Term Rewriting Systems.
Terese [2002], Term Rewriting Systems, to appear, CUP 2002.
15-01-2002
Iterative Path Orders
18
15-01-2002
A
Cut-elimination for ⇒∗
In this appendix we present the proof of the cut-elimination theorem for iporeduction: there is no need to ‘introduce’ a symbol by an ipo rule only to ‘eliminate’ it again later. Here the unmarked symbols occurring on the left-/righthand side of an ipo-rule are said to be eliminated/introduced by an application
of that rule. That is, copy- and down-steps introduce unmarked function symbols, whereas put- and down-steps eliminate them. Cut-elimination is shown
using a property which is similar to standardisation as found in term rewriting
([GLM92]): we show that we may sort ⇒-steps in an outside-in (with respect
to the abstract syntax tree) manner. Although our definition is the same in
spirit as the usual definition of standardness in capturing outside-in reductions,
and indeed coincides with it on the first example below, it is tailor-made for
the cut-elimination property we want to prove: since introduced symbols may
not be eliminated at all, steps really move downwards, and may not stay at the
same level as in ordinary standardisation. We will show how to transform any
ipo-reduction into a standard one, by gradually removing non-standard steps in
favour of standard ones.
Before formalising this, we need to introduce two auxiliary concepts, both
originating with the fact that trees (terms) may have several branches (subterms). Because of this it will be convenient to introduce a notion of parallel
step and an appropriate measure on parallel reductions, which will decrease
during the standardisation process.
Definition 1 A parallel ⇒-step may perform any number of ⇒-steps in parallel, i.e. contract any number of ⇒-redexes at disjoint positions in the term.
Parallel steps will be denoted by ⇛. The measure µ(R) of a parallel reduction
R of length n is the n + 1-tuple (n, mn , . . . , m1 ) where mi is the multiset of the
positions of the contracted redexes in the ith parallel step. The order on the
measure is the lexicographic product of the order on the natural numbers first
and then the multiset extension of the inverse of the prefix-order on positions.
Our measure is an adaptation of the measure as introduced in [SR90]. Note the
two reversals of order in the measure.
• The reversal of order of the mi stems from the idea of standardisation:
to remove an outermost step o from a reduction R, by permuting it up
front. This may lead, in case o is a copy-step, to duplication of the steps
inside and in front of o in R. Hence, the removal of some step (o) should
outweigh the duplication of steps in front of it; this is exactly which is
achieved by the measure.
• The reversal of the prefix-order is based on the idea that arriving at a
term by performing a step which is remote from the root, is smaller than
arriving at that term via a step closer to the root. Well-foundedness is
guaranteed by the fact that terms are finite: the position of a step toward
the term s can not be deeper than the height of s.
1
Before presenting our formalisation, of standardisation and standardness, let us
give an intuitive example.
Example 1 Let a ≻ b and f ≻ g in the precedence. Suppose we want to
transform the following ⇛-reduction R (of length 5) into standard form,
f (a) ⇒ f (a∗ ) ⇒ f (b) ⇒ f ∗ (b) ⇒ g(f ∗ (b), f ∗ (b)) ⇛ g(b, b)
Its measure is (5, [1, 2], [ǫ], [ǫ], [1], [1]), where we have used square brackets to
denote multisets, and ǫ to denote the empty (root) position.
• We observe that R is not standard since the third step, marking the underline f is outermost, whereas the first two steps are not. Hence, we should
permute the third step up front. This yields the ⇛-reduction,
standard
z
}|
{
f (a) ⇒ f ∗ (a) ⇒ f ∗ (a∗ ) ⇒ f ∗ (b) ⇒ g(f ∗ (b), f ∗ (b)) ⇛ g(b, b)
• Note that the first step is now standard, and the measure of the remaining,
non-standard, steps is (4, [1, 2], [ǫ], [1], [1]) the remaining ones are not: the
fourth step takes place outside the third and fourth steps, so they should
be permuted. This yields the reduction,
standard
}|
{
z
f (a) ⇒ f ∗ (a) ⇒ g(f ∗ (a), f ∗ (a)) ⇛ g(f ∗ (a∗ ), f ∗ (a∗ )) ⇛ g(f ∗ (b), f ∗ (b)) ⇛ g(b, b)
• Now the first two steps are standard, and the measure of the remaining
ones is (3, [1, 2], [11, 21], [11, 21]). Note how permuting a (copy) step up
front has lead to the duplication of steps in front of it. Next, note that the
reduction is still not standard since the fifth step (both redexes) is outside
both the third and fourth step. Say we select the leftmost of these first for
permutation. This yields,
standard
}|
{
z
f (a) ⇒ f ∗ (a) ⇒ g(f ∗ (a), f ∗ (a)) ⇒ g(a, f ∗ (a)) ⇒ g(a, f ∗ (a∗ )) ⇛ g(a∗ , f ∗ (b)) ⇛ g(b, b)
with measure of the non-standard part (3, [1, 2], [11, 21], [21])
• Finally, permuting the rightmost one as well yields the standard reduction,
f (a) ⇒ f ∗ (a) ⇒ g(f ∗ (a), f ∗ (a)) ⇛ g(a, a) ⇛ g(a∗ , a∗ ) ⇛ g(b, b)
Note how in the example, the measure of the non-standard part decreases in
each step.
Definition 2 A ⇛-reduction R : s ⇛∗ t from some ordinary term (without
marked symbols) to another one is standard if it is in either of the following
forms:
2
• Either all steps are internal, in the sense that nowhere in R a rule is
applied to the head symbol. This implies s = f (s1 , . . . , sn ) and t =
f (t1 , . . . , tn ), for some function symbol f , which is not involved in any reduction step of R. Then we require, for every i, the projection Ri :si ⇛∗ ti
of R onto the ith argument of f , to be a standard reduction.
• Or the reduction starts off with a head step, which therefore (s contains
no marked symbols!) must be a put-step, say resulting in f ∗ (s1 , . . . , sn ).
Then we require the rest of R to be of the following form.
1. First, we may perform any number of copy-steps. This results in a
term C[s′1 , . . . , s′m ], such that C consists entirely of symbols smaller
than f (in the precedence), and with each s′j of shape f ∗ (s1 , . . . , sn ).
2. Next, a single ⇛-step is performed, which performs either a selector a down step on each s′j .
3. After that, no steps may take place in the context C and the remaining
reductions inside the holes of C, or rather their projections, must be
of the following shape depending on the ⇒-redex contracted above it
in the previous item:
– If the step was a select-step, then the reduction must be standard,
– If the step was a down-step (hence the head symbol is marked)
then the reduction on the subterm with the marked symbol must
have the form required by item 1.
We write s ⇒std t to denote a parallel ipo-reduction from s to t which is standard.
An example illustrating the second item was already presented above. Let’s
give an example of the first item and also one showing how cuts are eliminated.
Example 2
• Assume a precedence as above. The non-head reduction
f (g(a)) ⇒ f (g ∗ (a)) ⇒ f (a) ⇒ f (a∗ ) ⇒ f (b)
is standard standard since its projection on the first (only) argument of f
is:
g(a) ⇒ g ∗ (a) ⇒ a ⇒ a∗ ⇒ b
• Suppose a ≻ b ≻ c. Then
a ⇒ a∗ ⇒ b ⇒ b∗ ⇒ c ⇒ c∗
Observe that it did not make sense to introduce b; since a is greater than c
in the precedence (by transitivity) anyway, we might have used a instead of
b to introduce c immediately. That is, we may eliminate the cut between the
second and third step, between introducing b and eliminating it, resulting
in the cut-free reduction
a ⇒ a∗ ⇒ c
3
We now show that any ipo-reduction may be transformed into a standard one.
The proof idea is to split a reduction into an initial part which is already standard and ‘insert’ the steps of the final part one-by-one into this initial part,
preserving standardness of that part. This has been illustrated by the example
above already.
Lemma 1 If s ⇒∗ t (for ordinary terms), then s ⇒std t.
Proof 1 Since every ⇒-step is a ⇛-step as well, we may assume R : s ⇛∗ t.
The proof is by induction on the size of s. We distinguish cases depending on
whether some head step is performed in R or not.
The easy case is when R contains no head-step. Then we have s = f (s1 , . . . , sn ),
t = f (t1 , . . . , tn ) and Ri :si ⇒∗ ti , for all 1 ≤ i ≤ n. By the induction hypothesis
(each si is smaller in size than s) we have Si :si ⇒std ti . Now performing each of
the standard reductions Si in parallel on each argument si of s yields a standard
reduction from s to t, using the first clause of the definition of standardness.
The difficult case is when R does contain a head step. First, we show that
this head step, which incidentally must be a put-step since s does not contain
marked symbols, can be permuted up front and after that we show that the rest
of the reduction can be put into standard form.
1. Since R contains a head step, we can decompose it uniquely into I; h; A,
where I is a reduction consisting of internal steps, h is a head step
f (s′1 , . . . , s′n ) ⇒put f ∗ (s′1 , . . . , s′n ), and A is a reduction arbitrary form.
That I is internal means that it can be written as: I : f (s1 , . . . , sn ) ⇛∗
f (s′1 , . . . , s′n ), for some f , because Ri : si ⇛∗ ti for each i. Hence, symbolically, we could denote I as f (R1 , . . . , Rn ). Note that we could have
performed the h-step immediately: s ⇒ f ∗ (s1 , . . . , sn ) ⇒∗ f (s′1 , . . . , s′n ).
Using the symbolic notation, we can transform f (R1 , . . . , Rn ); h into h̄; Ī,
with Ī = f ∗ (R1 , . . . , Rn ).
Now (at least) the first step of the resulting reduction conforms to the
definition of standardness: it is a put-step. In order to transform the rest
of the reduction into standard form, we analyse what may happen to the
marked symbol f ∗ in the course it. First note that some head-step must
be performed in Ī; A, hence in A, since the final term t does not contain
any marked symbols. The idea is that the f ∗ ‘causes’ a context of the final
term t as prescribed by the standard reduction.
2. So let’s assume that our reduction from f ∗ (s1 , . . . , sn ) to t decomposes
as P; N where P is the partial standard part (initially empty) and N the
not–known–to–be–standard part (initially the whole reduction). By partial
standard, we mean that it consists of a number of copy-steps, creating a
context C (initially empty) of symbols smaller than f , followed by a single
⇛-select/down step p on some marked symbols, directly below C (initially
performing no steps at all). One easily shows that all arguments of C, not
(yet) contracted by p must be of shape f ∗ (s1 , . . . , sn ).
4
We show that we may transform P; N into S; D[N1 , . . . , Nn ] for some
standard reduction S, as conforming to the second clause of its definition,
context D consisting of function symbols all smaller than f according to
the precedence, and non-standard reductions Ni , starting from either some
si or some s∗i (i.e. the head symbol is marked, due to an application of
a down-step above it in the parallel ipo step p). Since the size of si is
smaller than that of s, we may apply the induction hypothesis to each Ni
(‘jumping’ the first item, in case the head symbol is already marked). The
result then follows by applying either the first or the second subclause of
the third item of the definition of standardness. The proof that we may
perform such a transformation is by induction on the measure µ(N ) of the
not–known–to–be–standard part N .
3. Consider an outermost-first ipo step o in N (possibly as element of a larger
⇛-step O performing other ⇒-steps in parallel as well), taking place at
a position in C. Here by taking place in C we mean that its position is
either a position properly belonging to C or a position of one of the holes
of C where no select-step is performed by the final parallel ipo-step p. By
outermost–first we mean that it is outermost, i.e. at minimal distance to
the root, among the steps in N , and the first step in N at that position.
Hence, we can write N as T ; O; U where no step in T takes place at the
path from the root to the position of o.
Note that as long as the parallel ipo step p does not contract all redexes
below C, then such a step o must exist since the final term t does not contain any marked symbols, by assumption. We distinguish cases according
to whether the position of o is properly in C (a non-hole position), or not
(a hole position).
• Suppose o occurs in a non-hole position, i.e. at a proper position of
C. Then, by the assumption that C consists of ordinary function
symbols, o must be a put-step, since the steps in T do not affect it by
the choice of o as outermost-first step in N . Say o:E[g(u1 , . . . , um ) ⇒
g ∗ (u1 , . . . , um )]. Note that we have a cut now, since all symbols in
C had been introduced before. Again by outermost–firstness, no step
among the remaining steps in U take place on the path from the root
to the position of o. Note that since o occurs properly in C, we know
that g is smaller than f in the precedence.
Since the final term t contains no marked symbols, some step, say
v, must contract a redex at the same position as o. We distinguish
cases according to the rule applied in v.
– The rule cannot be the put-rule, since marked symbols cannot be
marked again.
– Suppose the rule is a copy-rule, so v contracts some g ∗ (u′1 , . . . , u′m )
−−−−−−−−−−→
into h(g ∗ (u′1 , . . . , u′m )). Then we might have performed this copying in P already, since h ≺ g ≺ f . More precisely, consider the
5
steps in P ; T below v, taking place from the moment g was introduced in the context C. This introduction is due to a copy-step
introducing g. Now instead of this introduction, we could have
introduced h immediately. Schematically (and roughly, since we
forget about intermediate steps):
−−−−
−
→
−−−→
−−−→
−−
−−
→
f ∗ (~s) ⇒ g(f ∗ (~s)) ⇒ g ∗ (f ∗ (~s)) ⇒ h(g ∗ (f ∗ (~s)))
is transformed into:
−−−
−
→
−−−−
−
→
−−−→
−−
−−
→
−−
−−
→
f ∗ (~s) ⇒ h(f ∗ (~s)) ⇛ h(g(f ∗ (~s))) ⇛ h(g ∗ (f ∗ (~s)))
This removes the copy-step from N , hence decreases its measure.
– Suppose the rule is a select-rule. Then we should not have performed the corresponding copy step in P at the first place. Schematically:
−−−→
−−−→
f ∗ (~s) ⇒ g(f ∗ (~s)) ⇒ g ∗ (f ∗ (~s)) ⇒ f ∗ (~s)
can just be removed (the first step from P and the latter steps
from N ). This decreases the measure.
– Suppose the rule is a down-rule. Then we could instead of performing o and v in N , simply omit o and just put a marker
directly on the symbol below g ∗ marked by v, by means of a putstep. Schematically a part of N looks like:
∗
g(u1 , . . . , um ) ⇒ g ∗ (u1 , . . . , um ) ⇒∗ g ∗ (u′1 , . . . , u′m ) ⇒down g(. . . , u′i , . . .)
This part can be transformed into
∗
g(u1 , . . . , um ) ⇒∗ g(u′1 , . . . , u′m ) ⇒put g(. . . , u′i , . . .)
This transformation decreases the measure since the initial putstep is elided from N .
• Suppose o occurs in a hole position, not among the hole positions
contracted by p yet. Then we know that the rule applies to some
subterm having either f ∗ or f as head symbol.
– In case the subterm has f as head-symbol, then there is a corresponding down-step in p. Then we know that the rule applied
in o must be a put-rule applied to f . That is, we have a cut
between a down-step introducing f and a put-step marking it.
Schematically, the situation is:
f ∗ (~s) ⇒down f (. . . , s∗i , . . .) ⇒∗ f (. . . , s′i , . . .) ⇒put f ∗ (. . . , s′i , . . .)
This can be transformed into:
f ∗ (~s) ⇒put f ∗ (. . . , s∗i , . . .) ⇒∗ f ∗ (. . . , s′i , . . .)
6
Hence we remove the down-step from the parallel step p, prefix
a put-step to N , but remove the put-step from the reduction N .
The resulting reduction N ′ still has the same length and final
term as N , but the final step(s) of N ′ are more remote from the
root than the final (put-)step of N . Hence, the measure decreases.
– In case the subterm has f ∗ as head symbol, then we distinguish
cases according to the rule applied in o.
∗ The rule applied cannot be a put rule, since marked symbols
cannot be marked again.
∗ If the rule is the copy-rule, then we can permute it into C so
to speak, and repeat on the remaining part.
∗ If the rule is the select- or the down-rule, then we can permute it and adjoin it to p, and repeat on the remaining part.
Hence, ⇒ has the cut-elimination property, in the sense that we never need
to mark (and subsequently use) a symbol introduced before. Moreover, stars
can be handled one at the time. As a consequence, we may visualise an ⇒reduction as a top-down mark-and-sweep process. At any moment during this
process, there is at most one marked symbol at any path from the root to a leaf.
Theorem 1 (cut-elimination) If s ⇒std t ⇒std u, then s ⇒std u.
Lemma 2 It is decidable (for a well-ordered precedence) whether s ⇒∗ t, for
unmarked terms s and t.
Proof 2 By the previous lemma, we only need to consider for all symbols in s
all possible introductions (combined) up to the size of t.
As a consequence we can restrict the labels needed for ‘guessing’ to the hight
of the right-hand side to check each rule. (This is not very efficient of course).
Next we use our characterisation to show that ⇒+ is the same (extensionally)
as the order ≻rpo as defined in the main text.
Lemma 3 s ≻rpo t if s ⇒+ t.
Proof 3 Suppose s ⇒+ t. We construct a proof of s ≻rpo t by induction
on the length of the reduction. By the lemma above, we may assume that for
s = f (s1 , . . . , sn ) we have s∗ ⇒+ t by a top-down mark-and-sweep procedure
(if the first marker would be put below the root, then we could simulate that
by putting a marker on the root and executing a number of down steps). The
clauses below refer to the clauses in the main text.
• If the next step is a copy step, then t = g(t1 , . . . , tn ) for f ≻ g and s∗ ⇒+ ti
for all i, hence si ≻rpo ti by IH, hence s ≻rpo t by clause (2)(a).
• If the next step is a select step to the ith argument, then either t = si and
s ≻rpo t follows by clause (1)(a) the first case, or s∗i ⇒+ t, hence by the
IH si ≻rpo t and s ≻rpo t follows by clause (1)(a) the second case.
7
• If the next step is a down step, then we have t = f (t1 , . . . , tn ) and si ⇒+ ti
for some but at least one i and si = ti for the others. Then s ≻rpo t follows
by clause (2)(b) since by the IH si ≻rpo ti for some but at least one i and
si = ti for the others, hence hs1 , . . . , sn i ≻rpo htn , . . . , tn i.
Note that the relation ⇒+ trivially is a reduction order; closure under contexts
and substitutions follows by the definition of ⇒ by means of a TRS and wellfoundedness was established above. Hence, ⇒+ is an effective witness to the
unique relation satisfying the ≻rpo -equalities in the main text.
References
[GLM92] G. Gonthier, J.-J. Lévy, and P.-A. Melliès. An abstract standardisation theorem. In Proceedings of the 7th IEEE Symposium on Logic in
Computer Science, pages 72–81, 1992.
[SR90]
R.C. Sekar and I.V. Ramakrishnan. Programming in equational logic:
Beyond strong sequentiality. In Proceedings of the 5th IEEE Symposium on Logic in Computer Science, pages 230–241, 1990.
8