Articles
A Narrowing-based Instantiation Rule for Rewriting-based Fold/Unfold Transformations

https://doi.org/10.1016/S1571-0661(04)80698-4Get rights and content
Under a Creative Commons license
open access

Abstract

In this paper we show how to transfer some developments done in the field of functionallogic programming (FLP) to a pure functional setting (FP). More exactly, we propose a complete fold/unfold based transformation system for optimizing lazy functional programs. Our main contribution is the definition of a safe instantiation rule which is used to enable effective unfolding steps based on rewriting. Since instantiation has been traditionally considered problematic in FP, we take advantage of previous experiences in the more general setting of FLP where instantiation is naturally embedded into an unfolding rule based on narrowing. Inspired by the so called needed narrowing strategy, our instantiation rule inherits the best properties of this refinement of narrowing. Our proposal optimizes previous approaches (that require more transformation effort) defined in the specialized literature of pure FP by anticipating bindings on unifiers used to instantiate a given program rule and by generating redexes at different positions on instantiated rules in order to enable subsequent unfolding steps. As a consequence, our correct/complete technique avoids redundant rules and preserves the natural structure of programs.

Keywords

Rewriting
Narrowing
Instantiation
Fold/Unfold

Cited by (0)

1

This work has been partially supported by CICYT under grant TIC 2001-2705-C03-03 and by Acción Integrada Hispano-Alemana HA03-100.