Abstract
Needed narrowing is a complete and optimal operational principle for modern declarative languages which integrate the best features of lazy functional and logic programming. We investigate the formal relation between needed narrowing and another (not so lazy) narrowing strategy which is the basis for popular implementa- tions of lazy functional logic languages. We demonstrate that needed narrowing and lazy narrowing are computationally equivalent over the class of uniform programs introduced in (16,17). We also introduce a complete refinement of lazy narrowing, called uniform lazy narrowing, which is still equivalent to needed narrowing over the aforementioned class. Since actual implementations of functional logic languages are based on the transformation of the original program into a uniform one—which is then executed using a lazy narrowing strategy—our results can be thought of as a formal basis for the correctness of these implementations. Functional logic programming (11) allows us to integrate some of the best features of the classical declarative paradigms, namely functional and logic programming. The operational semantics of the integrated languages is usually based on narrowing, an evaluation mecha- nism which combines the reduction principle of functional languages with the instantiation of unbound variables used in logic programming. Lazy evaluation is a significant feature of functional (logic) programming languages since it avoids unnecessary computations and al- lows programs to deal with infinite data structures. Due to its optimality properties, needed narrowing (5) is currently considered the best lazy narrowing strategy. It generalizes Huet and Levy's (15) call-by-need reduction in order to deal with logical variables and unification. This work investigates and clarifies the formal relation between needed narrowing and another (not so lazy) narrowing strategy which was introduced in (22)—where it is called lazy narrowing—and is the basis for the implementation of several lazy functional logic languages like, e.g., (12,16,22). Our main contributions are the following:
Published Version
Talk to us
Join us for a 30 min session where you can share your feedback and ask us any queries you have