Extended unification algorithms for the integration of functional programming into logic programming
The Journal of Logic Programming
1) m' if u= A. (2) f(m, ,..., m,[u+m'] ,..., mJ if m=f(m, ,..., m, ,..., m,) and u=i.u with iEN+. Example 2. Let m = f (g( X, a), b). Then m[l +f(a, a)] =f(f(a, a>, b). DeJinition 4. The depth of an occurrence u is the integer dp(u) defined as follows: dp(u) = 1~1, where lul is the length of the string u. We can now define the notions of term-rewriting systems, reduction, and normal form. EXTENDED UNIFICATION ALGORITHMS 203 Dejkition 5. A term-rewriting system  is a set of pairs of terms
... = Q2, such that V(Q,) c V(\k,). Dejinition 6. The term m reduces to the term n at occurrence u in the term-rewriting system R (in symbols m * u,Rn) if and only if there exist \k,a Q2" a substitution 0, and u E O(m) such that m/u=O(\k,) and n=m[u+@(Q,)], where O(X) is the application of the substitution 0 to the term X. When there is no ambiguity we will denote this reduction by m 3 n. Definition 7. We will denote by G R the reflexive and transitive closure of the relation aR . We call it derivation, and if m G Rn, we say that n derives from in R. m Definition 8. A term m is in normal form in R iff there is no n such that m *R n. Definition 9. If m z Rn and n is in normal form in R, then n is a normal form of m in R. We define now the notions of confluent and noetherian systems. DeJinition 10. A term-rewriting system R is noetherian if there is no infinite derivation m,* ..a *rni* ..a in R. Definition 11. A term-rewriting system R is confluent' if for all m, m" m2 such that m G m, and m&m" there exists m' such that m, G m' and rnzG m'. DeJinition 12. A term-rewriting system R is said to be a canonical term-rewriting system iff it is noetherian and confluent. Note that in a canonical term-rewriting system each term m has a unique normal form, which is noted by R(m) [or red(m)]  . A term can be reduced in different ways, depending on the choice of the occurrence to be matched with a rewrite rule. We will define two strategies for this purpose: innermost and outermost. .An equivalent characterization of confluence is the so-called Church-Rosser property  .