Outermost Ground Termination

Olivier Fissore, Isabelle Gnaedig, Hélène Kirchner
2004 Electronical Notes in Theoretical Computer Science  
We propose a semi-automatic inductive process to prove termination of outermost rewriting on ground term algebras. The method is based on an abstraction mechanism, schematizing normalisation of subterms, and on narrowing, schematizing reductions on ground terms. The induction ordering is not needed a priori, but is a solution of constraints set along the proof. Our method applies in particular to systems that are non-terminating for the standard strategy nor even for the lazy strategy. a term
more » ... writing system and the evaluation of a query consists of rewriting a ground expression. In such a context, one needs more specific termination proof tools than those previously cited, allowing one to prove termination under specific reduction strategies. There are still few results in this domain, although the need is important. To our knowledge, methods have only been given for the innermost strategy [1, 14] , the context-sensitive rewriting including particular kinds of local strategies [21] , and general local strategies [10] . The outermost strategy for evaluating expressions in the context of programming is essentially used when one knows that computations can be nonterminating. The intuition suggests that rewriting a term at the highest possible position gives more chance than with another strategy to lead to an irreducible form. Indeed, outermost rewriting may succeed when innermost fails, as illustrated by the expression second(dec(1), 0), with the rewrite rules second(x, y) → y and dec(x) → dec(x − 1) on integers. Innermost rewriting fails to terminate, because it first evaluates dec(1) into dec(0), dec(−1), and so on. Outermost rewriting, however, gives 0 in one rewriting step. Moreover, outermost derivations are often shorter : in our example, to reduce second(u, v), one does not need to reduce u, which can lead to infinite computations or, at least, to a useless evaluation. This advantage makes the outermost strategy an interesting strategy for rule-based languages, by allowing the interpreters to be more efficient, as well as for theorem proving, by allowing the rewriting-based proofs to be shorter. Outermost computations are of interest in particular for functional languages like Miranda, Haskell, or Clean, where interpreters or compilers generally involve a strategy for call by name. Often, lazy evaluation is used instead: labelling operators in terms as lazy or eager, it consists in reducing the eager subterms only when their reduction allows a reduction step higher in the term [23] . However, lazy evaluation may diverge while the outermost computation terminates, which gives an additional motivation for studying outermost termination. For instance, let us consider the evaluation of the expression inf (0) with the following two rules : cons (x, cons(y, z)) → big, inf (x)→ cons(x, inf (s(x))). Evaluated in a lazy manner, inf (0) is reduced to cons(0, inf(s(0))), and then, since application of the first rule fails, the sub-expression inf (s(0)) has to be evaluated before considering the whole expression, which leads to an infinite evaluation. Evaluated in an outermost manner, inf (0) is also reduced to cons(0, inf(s(0))), but then inf (s(0)) is reduced to cons(s(0), inf(s(s(0)))), and then the whole expression is reduced to big. Although not generally used with the rule-based evaluation process, the outermost strategy could be of interest for languages like Maude, OBJ or ELAN, for the previous efficiency reasons. A better knowledge of this strategy w.r.t. more usual ones in this context, like the innermost or local strategies, would be interesting, and could help to choose the good one when program-
doi:10.1016/s1571-0661(05)82535-6 fatcat:s576puihdfbmpof5xgjtk2mi3u