## Safe Folding/Unfolding with Conditional Narrowing (1997)

### Cached

### Download Links

- [www.dsic.upv.es]
- [www.dsic.upv.es]
- [users.dsic.upv.es]
- [users.dsic.upv.es]
- [ftp.dsic.upv.es]
- DBLP

### Other Repositories/Bibliography

Venue: | PROC. OF THE INTERNATIONAL CONFERENCE ON ALGEBRAIC AND LOGIC PROGRAMMING, ALP'97, SOUTHAMPTON (ENGLAND |

Citations: | 11 - 9 self |

### BibTeX

@INPROCEEDINGS{Alpuente97safefolding/unfolding,

author = {Maria Alpuente and Moreno Falaschi and Gines Moreno and German Vidal},

title = {Safe Folding/Unfolding with Conditional Narrowing},

booktitle = {PROC. OF THE INTERNATIONAL CONFERENCE ON ALGEBRAIC AND LOGIC PROGRAMMING, ALP'97, SOUTHAMPTON (ENGLAND},

year = {1997},

pages = {1--15},

publisher = {Springer LNCS}

}

### OpenURL

### Abstract

Functional logic languages with a complete operational semantics are based on narrowing, a generalization of term rewriting where unification replaces matching. In this paper, we study the semantic properties of a general transformation technique called unfolding in the context of functional logic languages. Unfolding a program is defined as the application of narrowing steps to the calls in the program rules in some appropriate form. We show that, unlike the case of pure logic or pure functional programs, where unfolding is correct w.r.t. practically all available semantics, unrestricted unfolding using narrowing does not preserve program meaning, even when we consider the weakest notion of semantics the program can be given. We single out the conditions which guarantee that an equivalent program w.r.t. the semantics of computed answers is produced. Then, we study the combination of this technique with a folding transformation rule in the case of innermost conditional narrowing, and prove that the resulting transformation still preserves the computed answer semantics of the initial program, under the usual conditions for the completeness of innermost conditional narrowing. We also discuss a relationship between unfold/fold transformations and partial evaluation of functional logic programs.

### Citations

749 | Rewrite systems
- Dershowitz, Jouannaud
- 1990
(Show Context)
Citation Context ...nstructors) and F is the set of defined function symbols. For CTRS R, r < R denotes that r is a new variant of a rule in R. For more details on term rewriting and functional logic programming consult =-=[10, 15, 17, 19]. Given a progra-=-m R, an equational goal g conditionally narrows into a goal clause g ′ (in symbols4 g θ ❀ g ′ ), iff: 1. there exists u ∈ Ō(g), a standardised apart variant (λ → ρ ⇐ C) < R and a subst... |

570 | A Transformation System for Developing Recursive Programs
- M, Darlington
- 1977
(Show Context)
Citation Context ...del of the program, i.e. the set of all ground equations which hold in the underlying theory [17]. The folding and unfolding transformations, which were first introduced by Burstall and Darlington in =-=[7]-=- for functional programs, are the most basic and powerful techniques for a framework to transform programs. Unfolding is essentially the replacement of a call by its body, with appropriate substitutio... |

566 | Term rewriting systems
- Klop
- 1992
(Show Context)
Citation Context ...nstructors) and F is the set of defined function symbols. For CTRS R, r < R denotes that r is a new variant of a rule in R. For more details on term rewriting and functional logic programming consult =-=[10, 15, 17, 19]. Given a progra-=-m R, an equational goal g conditionally narrows into a goal clause g ′ (in symbols4 g θ ❀ g ′ ), iff: 1. there exists u ∈ Ō(g), a standardised apart variant (λ → ρ ⇐ C) < R and a subst... |

453 | Termination of Rewriting
- Dershowitz
- 1985
(Show Context)
Citation Context ... there, the manipulations induced to allow folding/unfolding are often more complex than simple instantiation and involve auxiliary function definition and induction. Finally, the forward closures of =-=[9]-=- produce a kind of unfolding of program rules which is used to formulate conditions for the termination of the program. This paper is organized as follows. Section 2 formalizes the conditional narrowi... |

334 | Functional logic programming: From theory to Curry
- Hanus
- 2013
(Show Context)
Citation Context ...d partial evaluation of functional logic programs. 1 Introduction The problem of integration of functional and logic programming is an important challenge for research in declarative programming (see =-=[15]-=- for a recent survey). A functional logic program can be seen as a Conditional Term Rewriting System (CTRS for short), i.e. a set of conditional equations where the equation in the conclusion is impli... |

240 |
Partial evaluation in logic programming
- Lloyd, Shepherdson
- 1987
(Show Context)
Citation Context ...f the PE-based, generalized unfolding operation is based on the idea of partially evaluating the program w.r.t. the lhs’s of the heads of program rules. The inspiration for this definition comes fro=-=m [22]. -=-In [4], a general framework for partial evaluation of functional logic programs is defined which is based on building partial narrowing trees for the goal and extracting the specialized definition —... |

212 |
Unfold/fold transformation of logic programs
- Tamaki, Sato
- 1984
(Show Context)
Citation Context ...alent function call. For functional programs, folding and unfolding steps involve only pattern matching. The fold/unfold transformation approach was first adapted to logic programs by Tamaki and Sato =-=[28]-=- by replacing matching with unification in the transformation rules. A lot of literature has been devoted to proving the correctness of unfold/fold systems w.r.t. the various semantics proposed for fu... |

138 | Transformation of logic programs: Foundations and techniques
- Pettorossi, Proietti
- 1994
(Show Context)
Citation Context ... the transformation rules. A lot of literature has been devoted to proving the correctness of unfold/fold systems w.r.t. the various semantics proposed for functional programs [7, 20], logic programs =-=[18, 25, 27, 28]-=-, and constraint logic programs [12]. However, to the best of our knowledge, these techniques have not been studied for functional logic programs so far. The purpose of this paper is to consider unfol... |

110 |
Narrowing as the operational semantics of functional languages", Unpublished report
- Reddy
- 1985
(Show Context)
Citation Context ...ons hold for all theories we consider in this paper. The computation mechanism of functional logic languages is based on narrowing, an evaluation mechanism that uses unification for parameter passing =-=[26]. Nar-=-rowing solves equations by computing unifiers with respect to a given CTRS (which we call ‘program’). O(t) and Ō(t) denote the set of occurrences and the set of nonvariable occurrences of a term ... |

92 |
SLOG: A logic programming language interpreter based on clausal superposition and rewriting
- Fribourg
- 1985
(Show Context)
Citation Context ...ons corresponding to the successful innermost conditional narrowing derivations for g in R. Note that all answers computed by innermost conditional narrowing are normalized since they are constructor =-=[13]. For-=- a goal g and CB-CD, canonical program R, innermost conditional narrowing is complete w.r.t. ground constructor solutions σ satisfying that Var(g) ⊆ Dom(σ). This means that, given σ, there is a c... |

80 | Narrowing-driven partial evaluation of functional logic programs
- Alpuente, Falaschi, et al.
- 1996
(Show Context)
Citation Context ...modified transformation (generalized unfolding) can be formulated in terms of partial evaluation. As a consequence, the conditions to ensure completeness of the partial evaluation process (defined in =-=[4]-=-) can be used to formalize a sufficient condition for the completeness of unfolding w.r.t. the computed answers for unrestricted narrowing. Note that this is different from the case of pure logic prog... |

55 |
Equational logic programming
- Hölldobler
- 1987
(Show Context)
Citation Context ...he instantiated goal. The standard declarative semantics of a program E is given by the least Herbrand E-model of the program, i.e. the set of all ground equations which hold in the underlying theory =-=[17]-=-. The folding and unfolding transformations, which were first introduced by Burstall and Darlington in [7] for functional programs, are the most basic and powerful techniques for a framework to transf... |

44 | Completeness Results for Basic Narrowing
- Middeldorp, Hamoen
- 1994
(Show Context)
Citation Context ...quivalent, definitions of conditional narrowing, like the one that substitutes single equations by true as soon as they syntactically unify (instead of requiring the unification of the whole sequence =-=[23]-=-), would lead to generalized unfolding definitions that always reproduce the unfolded rule. Definition 6 Generalized unfolding of a program w.r.t. a rule. The generalized unfolding of a program R w.r.... |

39 | Lazy Narrowing: Strong Completeness and Eager Variable Elimination, Theoretical Computer Science 167(1,2 - Middeldorp, Okui, et al. - 1996 |

35 |
Narrowing vs. SLD-resolution
- Bosco, Giovannetti, et al.
- 1988
(Show Context)
Citation Context ...vial equation. A flat equation is an equation of the form f(x1,...,xn) = xn+1 or xn = xn+1, where xi �= xj for all i �= j. Any goal g can be transformed into an equivalent one, flat(g), which is f=-=lat [5]. Definition -=-16. Let R be a program. Then, O◭ θ ∗ (R) = {(f(x1,...,xn) = xn+1)θ | f(x1,...,xn) = xn+1 ❀◭ true in R, and (f/n) ∈ Σ }. The following theorem asserts that the computed answer substitution... |

30 |
de Waal. A conceptual embedding of folding into partial deduction: Towards a maximal integration
- Leuschel, Schreye, et al.
- 1996
(Show Context)
Citation Context ...(g), if R is ultralinear. Partial evaluation and the unfold/fold transformational approaches have been developed rather independently. Recently, their relation has been the subject of some discussion =-=[21, 25, 27]-=-. In essence, PE is a strict subset of the unfold/fold transformation in which unfolding is the only basic transformation rule. Only a limited form of implicit folding is obtained by imposing the clos... |

29 |
Preservation of Stronger Equivalence in Unfold/Fold Logic Programming Transformation
- Kawamura, Kanamori
- 1988
(Show Context)
Citation Context ... the transformation rules. A lot of literature has been devoted to proving the correctness of unfold/fold systems w.r.t. the various semantics proposed for functional programs [7, 20], logic programs =-=[18, 25, 27, 28]-=-, and constraint logic programs [12]. However, to the best of our knowledge, these techniques have not been studied for functional logic programs so far. The purpose of this paper is to consider unfol... |

26 |
Basic transformation operations which preserve computed answer substitutions of logic programs
- Bossi, Cocco
- 1993
(Show Context)
Citation Context ...rogram clause in all possible ways. Transformation typically proceeds in a ‘step-by-step’ fashion: a call is unfolded, then the clause is deleted from the program and replaced by the unfolded clau=-=ses [6, 18, 25, 27, 28]-=-. This technique is safe for the least Herbrand model semantics [28], for the semantics of computed answer substitutions [6, 18], and also preserves the finite failure [25, 27]. In this section we fir... |

25 | Deductive and Inductive Synthesis of Equational Programs
- Dershowitz, Reddy
- 1993
(Show Context)
Citation Context ...rrowing or SLD–resolution steps. No claim is made in [8] for any sort of completeness of the transformations and, indeed, some restrictions for the application of the rules are necessary to obtain i=-=t [11, 20]-=-. Another closely related approach is that of [11], which formulates a rewrite-based technique for the synthesis of functional programs which makes use of the rule of instantiation. However, there, th... |

21 | On Extra Variables in (Equational) Logic Programming
- Hanus
- 1995
(Show Context)
Citation Context ...itional programs (where it is known as right-linearity). For conditional programs, we plan to study whether the (weaker) conditions for the completeness of a sharing-based implementation of narrowing =-=[16]-=-, where terms are represented by graphs and all occurrences of the same variable are shared, are sufficient to get rid of the ultra-linearity condition. Theorem 10 Strong correctness. Let R be a confl... |

20 |
Unfold/Fold Transformation of General Logic Programs for the Well-founded Semantics
- Seki
- 1993
(Show Context)
Citation Context ... the transformation rules. A lot of literature has been devoted to proving the correctness of unfold/fold systems w.r.t. the various semantics proposed for functional programs [7, 20], logic programs =-=[18, 25, 27, 28]-=-, and constraint logic programs [12]. However, to the best of our knowledge, these techniques have not been studied for functional logic programs so far. The purpose of this paper is to consider unfol... |

18 | Efficient Implementation of Narrowing and Rewriting
- Hanus
- 1991
(Show Context)
Citation Context ...cient evaluation mechanism thanks to ⋆ This work has been partially supported by CICYT under grant TIC 95-0433-C03-03 and by HCM project CONSOLE.sthe deterministic reduction of functional expression=-=s [14, 15]-=-. The operational semantics is usually based on some variant of narrowing, an execution mechanism which consists of the instantiation of goal variables followed by a reduction step on the instantiated... |

14 |
Unfold/fold program transformation
- Kott
- 1985
(Show Context)
Citation Context ...hing with unification in the transformation rules. A lot of literature has been devoted to proving the correctness of unfold/fold systems w.r.t. the various semantics proposed for functional programs =-=[7, 20]-=-, logic programs [18, 25, 27, 28], and constraint logic programs [12]. However, to the best of our knowledge, these techniques have not been studied for functional logic programs so far. The purpose o... |

11 |
A program development methodology based on a unified approach to execution and transformation
- Darlington, Pull
- 1988
(Show Context)
Citation Context ...lding expansions of the initial program. In the literature, we found only three explicit formulations of fold/unfold rules for functional logic programs, which are based on some form of narrowing. In =-=[8]-=-, Darlington and Pull showed how instantiation (an operation of the Burstall/Darlington framework which introduces an instance of an existing equation) can be embedded into unfolding steps to get the ... |

7 | A Compositional Semantic Basis for the Analysis of Equational Horn Programs
- Alpuente, Falaschi, et al.
- 1996
(Show Context)
Citation Context ...y unification of the equations in the goal with the equations in the denotation. We note that this property is a kind of ANDcompositionality which does not hold for unrestricted conditional narrowing =-=[3]-=-. We assume that the equations in the denotation are renamed apart. Equations in the goal have to be flattened first, i.e. subterms have to be unnested so that the term structure is directly accessibl... |

4 | A Compositional Semantics for Conditional Term Rewriting Systems
- Alpuente, Falaschi, et al.
- 1994
(Show Context)
Citation Context ...omputed answer substitutions for g in R can be determined by ‘executing’ flat(g) in the program O ◭ (R) by syntactic unification, as if the equality symbol were an ordinary predicate. We note th=-=at in [2]-=- a similar operational semantics was defined for basic conditional narrowing. 5.2 Unfolding Semantics Now we introduce an unfolding semantics for functional logic programs, based on the unfolding tran... |

4 |
Modular Transformations of CLP Programs
- Etalle, Gabbrielli
- 1995
(Show Context)
Citation Context ...as been devoted to proving the correctness of unfold/fold systems w.r.t. the various semantics proposed for functional programs [7, 20], logic programs [18, 25, 27, 28], and constraint logic programs =-=[12]-=-. However, to the best of our knowledge, these techniques have not been studied for functional logic programs so far. The purpose of this paper is to consider unfold/fold transformations which preserv... |