Transforming Outermost into Context-Sensitive Rewriting

Reading time: 6 minute
...

📝 Original Info

  • Title: Transforming Outermost into Context-Sensitive Rewriting
  • ArXiv ID: 1005.5648
  • Date: 2015-07-01
  • Authors: Researchers from original ArXiv paper

📝 Abstract

We define two transformations from term rewriting systems (TRSs) to context-sensitive TRSs in such a way that termination of the target system implies outermost termination of the original system. In the transformation based on 'context extension', each outermost rewrite step is modeled by exactly one step in the transformed system. This transformation turns out to be complete for the class of left-linear TRSs. The second transformation is called `dynamic labeling' and results in smaller sized context-sensitive TRSs. Here each modeled step is adjoined with a small number of auxiliary steps. As a result state-of-the-art termination methods for context-sensitive rewriting become available for proving termination of outermost rewriting. Both transformations have been implemented in Jambox, making it the most successful tool in the category of outermost rewriting of the last edition of the annual termination competition.

💡 Deep Analysis

Deep Dive into Transforming Outermost into Context-Sensitive Rewriting.

We define two transformations from term rewriting systems (TRSs) to context-sensitive TRSs in such a way that termination of the target system implies outermost termination of the original system. In the transformation based on ‘context extension’, each outermost rewrite step is modeled by exactly one step in the transformed system. This transformation turns out to be complete for the class of left-linear TRSs. The second transformation is called `dynamic labeling’ and results in smaller sized context-sensitive TRSs. Here each modeled step is adjoined with a small number of auxiliary steps. As a result state-of-the-art termination methods for context-sensitive rewriting become available for proving termination of outermost rewriting. Both transformations have been implemented in Jambox, making it the most successful tool in the category of outermost rewriting of the last edition of the annual termination competition.

📄 Full Content

Termination is a key aspect of program correctness, and therefore a widely studied subject in term rewriting and program verification. While termination is undecidable in general, various automated techniques have been developed for proving termination. One of the most powerful techniques is the method of dependency pairs [AG00]. In [AGL06] dependency pairs for context-sensitive rewriting have been introduced, and in [AEF + 08] the dependency pair framework [GTSK04,Thi07,GL10] has been extended to context-sensitive rewriting, thereby extending the class of context-sensitive TRSs for which termination can be shown automatically. Context-sensitive rewriting [Luc98] is a restriction on term rewriting where rewriting in some fixed arguments of function symbols is disallowed. It offers a flexible paradigm to analyze properties of rewrite strategies, in particular of (lazy) evaluation strategies employed by functional programming languages.

In this paper context-sensitive rewriting is the target formalism for a transformational approach to the problem of outermost termination, that is, termination with respect to outermost rewriting. Outermost rewriting is a rewriting strategy where a redex may be contracted as long as it is not a proper subterm of another redex occurrence. The main reason for studying outermost termination is its practical relevance: lazy functional programming languages like Miranda [Tur86], Haskell [PJ03] or Clean [PvE01], are based on outermost rewriting as an evaluation strategy, and in implementations of rewrite logic such as Maude [CELM96] and CafeOBJ [FN97], outermost rewriting is an optional strategy.

To illustrate outermost rewriting, and the transformations we propose, we consider the term rewriting system R 0 consisting of the following rules:

Clearly, this system is not terminating, as witnessed by the infinite rewrite sequence:

However, R 0 is outermost terminating. Indeed, the third step in the rewrite sequence above is not an outermost step, since the contraction takes place inside another redex. The only (maximal) outermost rewrite sequence the term a admits is:

The contribution of the present paper consists of two transformations of arbitrary TRSs into context-sensitive TRSs (henceforth also called ‘µTRSs’) in such a way that rewriting in the µTRS corresponds to outermost rewriting in the original TRS. As a result, advanced termination techniques for µTRSs become available for proving outermost termination. Automated termination provers for µTRSs can directly (without modification, only preprocessing) be used for proving outermost termination. One of the transformations turns out to be complete for the class of quasi-left-linear TRSs, a generalized form of left-linear TRSs, see [RZ09]. In other words, termination of the resulting µTRS is equivalent to outermost termination of the original system.

The transformations are comprised of a variant of semantic labeling [Zan95]. In semantic labeling the function symbols in a term are labeled by the interpretation of their arguments (or a label depending on these values) according to some given semantics. We employ semantic labeling to mark symbols at redex positions, and then obtain a µTRS by defining a replacement map that disallows rewriting inside arguments of marked symbols.

We illustrate our use of semantic labeling by means of the TRS R 0 given above. We choose an algebra with values 0 and 1, indicating the presence of the symbol f:

We write f ⋆ , and say that ‘f is marked’, if the value of its argument is 1, and just f if the value is 0. The symbol a is a redex, and hence it is always marked, while b never is. If f is marked it corresponds to a redex position with respect to the rule f(f(x)) → b. For example the term f(f(f(a))) is labeled as f ⋆ (f ⋆ (f(a ⋆ ))). We obtain a µTRS by forbidding rewriting inside the argument of the symbol f ⋆ . Since a ⋆ is a constant, there is nothing to be forbidden. Hence for correctly labeled terms, rewriting inside redex occurrences is disallowed, and this corresponds to the strategy of outermost rewriting.

In order to rewrite labeled terms we have to label the rules of a TRS. Simply labeling both sides of a rule does not always work. For example, when we label the rules of R 0 using the algebra A 0 , we obtain the following µTRS:

This system has two instances of the second rule, one for each possible value assigned to the variable x. Now, despite of the fact that the original TRS is outermost terminating, the labeled system R 0 still admits an infinite rewrite sequence:

The reason is that the term f(f(a ⋆ )) is not correctly labeled, as its root symbol f should have been marked. In [Zan95] this problem is avoided by allowing labeling only with models.

Roughly speaking, an algebra is a model for a TRS R if left and right-hand sides of all rewrite rules of R have equal interpretations. However, this requirement is too strict for the purpose of marking redexes, because contraction of

…(Full text truncated)…

📸 Image Gallery

cover.png page_2.webp page_3.webp

Reference

This content is AI-processed based on ArXiv data.

Start searching

Enter keywords to search articles

↑↓
ESC
⌘K Shortcut