## Specialization of Functional Logic Programs

Citations: | 2 - 2 self |

### BibTeX

@MISC{Alpuente_specializationof,

author = {María Alpuente and Moreno Falaschi and Germán Vidal},

title = {Specialization of Functional Logic Programs},

year = {}

}

### OpenURL

### Abstract

Languages that integrate functional and logic programming with a complete operational semantics are based on narrowing, a unification-based goal-solving mechanism which subsumes the reduction principle of functional languages and the resolution principle of logic languages. In this article, we present a partial evaluation scheme for functional logic languages based on an automatic unfolding algorithm which builds narrowing trees. The method is formalized within the theoretical framework established by Lloyd and Shepherdson for the partial deduction of logic programs, which we have generalized for dealing with functional computations. A generic specialization algorithm is proposed which does not depend on the eager or lazy nature of the narrower being used. To the best of our knowledge, this is the first generic algorithm for the specialization of functional logic programs. We study the semantic properties of the transformation and the conditions under which the technique terminates, is...

### Citations

1286 | A structural approach to operational semantics
- Plotkin
- 1981
(Show Context)
Citation Context ...g) be the narrowing strategy which assigns the occurrence u of the leftmost innermost subterm of g to the goal g. We formulate innermost conditional narrowing by means of a labelled transition system =-=[52] (Goal,Sub,❀ϕ◭ ) w-=-hose transition relation ❀ϕ◭ ⊆ Goal × Sub × Goal formalizes the computation steps. In the following, we will abbreviate ❀ϕ◭ to ❀◭. Definition 5.1 Let R be a CTRS. We define the inner... |

939 | Term rewriting and all that - Baader, Nipkow - 1998 |

785 | Constraint Logic Programming
- Jaffar, Lassez
- 1987
(Show Context)
Citation Context ...e by using enviroments of positive and negative bindings (bindings which do not hold) [63, 25]. We think that we can strengthen this effect in the setting of (equational) constraint logic programming =-=[1, 35]-=- by using some kind of narrowing procedure with disunification, such as the ones defined in [2, 19, 53], in order to propagate (negative) bindings which can be gathered during transformation as (diseq... |

751 | Rewrite systems
- Dershowitz, Jouannaud
- 1992
(Show Context)
Citation Context ...ut the direction of future research. Proofs of selected theorems are given in the Appendix. 2 Preliminaries We briefly recall some known results about rewrite systems and functional logic programming =-=[16, 31, 32, 40]-=-. The definitions below are given in the one-sorted case. The extension to manysorted signatures is straightforward [51]. Throughout this paper, V will denote a countably infinite set of variables and... |

639 |
Partial Evaluation and Automatic Program Generation. Available online: http://www.itu.dk/people/sestoft/pebook
- Jones, Gomard, et al.
- 1993
(Show Context)
Citation Context ...not only constant values. Thus the mechanism of PE for logic programs results in general more powerful than for functional programs. Partial evaluation has been extensively studied both in functional =-=[13, 37, 57] and-=- in logic programming [22, 42, 46]. ∗ This work has been partially supported by CICYT under grant TIC 95-0433-C03-03. § DSIC, Universidad Politécnica de Valencia, Camino de Vera s/n, Apdo. 22012, ... |

626 |
Fast Pattern Matching in Strings
- Knuth, Moris, et al.
- 1977
(Show Context)
Citation Context ...method passes the so-called Knuth-Morris-Pratt test [26, 36], i.e. specializing a naïve pattern matcher w.r.t. a fixed pattern obtains the efficiency of the Knuth, Morris and Pratt matching algorithm=-= [41]-=-. This seems to contradict the conjecture in [26] that call-by-value transformers cannot propagate information in a way similar to that in supercompilation [63]. The relation between our method and su... |

570 | A Transformation System for Developing Recursive Programs
- Burstall, Darlington
- 1976
(Show Context)
Citation Context ...peedup for a large class of programs [60]. Two basic transformation techniques used in partial evaluation are the folding and unfolding transformations, first introduced by Burstall and Darlington in =-=[11]-=- for functional programs. Unfolding is essentially the replacement of a call by its body, with appropriate substitutions. Folding is the inverse transformation, the replacement of some piece of code b... |

565 | Term Rewriting Systems
- Klop
- 1992
(Show Context)
Citation Context ...ut the direction of future research. Proofs of selected theorems are given in the Appendix. 2 Preliminaries We briefly recall some known results about rewrite systems and functional logic programming =-=[16, 31, 32, 40]-=-. The definitions below are given in the one-sorted case. The extension to manysorted signatures is straightforward [51]. Throughout this paper, V will denote a countably infinite set of variables and... |

453 | Termination of rewriting
- Dershowitz
- 1985
(Show Context)
Citation Context ...notion of orderings in which a term that is “syntactically simpler” than another is smaller than the other. The next definition extends the homeomorphic embedding (“syntactically simpler”) rel=-=ation � [15] to nongro-=-und terms. Definition 4.1 (homeomorphic embedding relation) [59] The homeomorphic embedding relation � on terms in τ(Σ ∪ V) is defined as the smallest relation satisfying x � y for all x,y ∈... |

400 | Deforestation: Transforming programs to eliminate trees
- Wadler
- 1990
(Show Context)
Citation Context ...ven in terms of a rewriting interpreter (with the inside-out order of evaluation), but driving is embedded into the supercompiler – an outside-in metaevaluator over Refal which subsumes deforestatio=-=n [65]-=-, PE and other standard transformations of functional programming languages [60]. For example, supercompilation is able to support certain forms of theorem proving, program synthesis and program inver... |

333 | Functional Logic Programming: From Theory to Curry
- Hanus
(Show Context)
Citation Context ...i Matematica e Informatica, Università di Udine, Via delle Scienze 206, 33100 Udine, Italy. 31sIn this paper, we show that, in the context of languages that integrate functional and logic programming=-= [31]-=-, execution and specialization can be based on the unique computation mechanism of narrowing. This unified view of execution and transformation allows us to develop a simple and powerful framework for... |

290 | On completeness of narrowing strategies
- Echahed
- 1988
(Show Context)
Citation Context ...t property of a narrowing strategy ϕ is completeness, meaning that the narrowing constrained by ϕ is still complete. A survey of results about the completeness of narrowing strategies can be found i=-=n [12, 18, 51]-=-. In the case of a confluent and decreasing CTRS R, we can further improve narrowing without losing completeness by normalizing the goal before a narrowing step is applied [34]. A normalizing 35scondi... |

239 |
Partial evaluation in logic programming
- Lloyd, Shepherdson
- 1991
(Show Context)
Citation Context ...hanism of PE for logic programs results in general more powerful than for functional programs. Partial evaluation has been extensively studied both in functional [13, 37, 57] and in logic programming =-=[22, 42, 46]. ∗-=- This work has been partially supported by CICYT under grant TIC 95-0433-C03-03. § DSIC, Universidad Politécnica de Valencia, Camino de Vera s/n, Apdo. 22012, 46071 Valencia, Spain. ¶ Dipartimento ... |

236 | Tutorial notes on partial evaluation - Consel, Danvy - 1993 |

218 |
Unification revisited
- Lassez, Maher, et al.
- 1986
(Show Context)
Citation Context ...of equations E is unifiable, if there exists ϑ ∈ Sub such that for all s = t in E. sϑ ≡ tϑ. ϑ is called a unifier of E. We let mgu(E) denote the most general unifier of the equation set E (see=-=, e.g., [43]). An -=-equational Horn theory E consists of a finite set of equational Horn clauses of the form (λ = ρ) ⇐ C. The condition C is a (possibly empty) sequence e1,...,en, n ≥ 0, of equations. Variables in ... |

213 |
Unfold/fold transformations 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 =-=[61]-=- by replacing matching with unification in the transformation rules. Because of the unification mechanism, partial evaluation of logic programs is also able to propagate syntactic information on the p... |

173 | Partial evaluation of computation process an approach to a compiler-compiler. Higher Order Symbol - Futamura - 1999 |

168 | The concept of a supercompiler - Turchin - 1986 |

166 | Canonical forms and unification - Hullot - 1980 |

156 | Logic Programming with Functions and Predicates: The language Babel - Moreno-Navarro, Rodríguez-Artalejo - 1992 |

145 | Tutorial on specialisation of logic programs
- Gallagher
- 1993
(Show Context)
Citation Context ...hanism of PE for logic programs results in general more powerful than for functional programs. Partial evaluation has been extensively studied both in functional [13, 37, 57] and in logic programming =-=[22, 42, 46]. ∗-=- This work has been partially supported by CICYT under grant TIC 95-0433-C03-03. § DSIC, Universidad Politécnica de Valencia, Camino de Vera s/n, Apdo. 22012, 46071 Valencia, Spain. ¶ Dipartimento ... |

139 | Transformation of logic programs: Foundations and techniques - Pettorossi, Proietti - 1994 |

116 | The -semantics Approach: Theory and Applications
- Bossi, Gabbrielli, et al.
- 1994
(Show Context)
Citation Context ...subject of further work. Our results are also relevant for the definition of a compositional semantics for functional logic programming which is useful for modular program analysis and transformation =-=[9]-=-. To achieve such a goal, we intend to study how to define an unfolding semantics using partial evaluation with an unfolding strategy which stops derivations that reach open function symbols (i.e. sym... |

114 | Amalgamating language and metalanguage in logic programming - Bowen, Kowalski - 1982 |

110 |
Narrowing as the operational semantics of functional languages", Unpublished report
- Reddy
- 1985
(Show Context)
Citation Context ...his is the first formal approach to partial evaluation of functional logic programs. 1 Introduction Narrowing is the computation mechanism of languages that integrate functional and logic programming =-=[54]-=-. Narrowing solves equations by computing unifiers w.r.t. an equational theory usually described by means of a (conditional) term rewriting system. Function definition and evaluation are thus embedded... |

92 |
SLOG: A logic programming language interpreter based on clausal superposition and rewriting
- Fribourg
- 1985
(Show Context)
Citation Context ...narrowing strategy (or position constraint) is any well-defined criterion which obtains a smaller search space by permitting narrowing to reduce only some chosen positions, e.g. basic [33], innermost =-=[20], innerm-=-ost basic [32] or lazy narrowing [54]. Formally, a narrowing strategy ϕ is a mapping that assigns to every goal g (different from ⊤) a subset ϕ(g) of Ō(g) such that for all u ∈ ϕ(g) the goal g... |

73 | An algorithm of generalization in positive supercompilation
- Sørensen, Glück
- 1995
(Show Context)
Citation Context ...cture. The driving process does not always terminate, and it does not preserve the semantics, as it can extend the domain of functions [60]. Techniques to ensure termination of driving are studied in =-=[59, 64]-=-. The idea of [64] is to supervise the construction of the tree and, at certain moments, loop back, i.e. fold a configuration to one of the previous states, and in this way construct a finite graph. T... |

73 | Towards an automated tupling strategy - Chin - 1993 |

72 | Automated Theorem-Proving for Theories with Simpli ers - Slagle - 1974 |

63 |
A general criterion for avoiding infinite unfolding during partial deduction
- Bruynooghe, Schreye, et al.
- 1992
(Show Context)
Citation Context ...ed simultaneously. As for local termination, depth-bounds, loop-checks and well-founded orderings are some commonly used tools for controlling the unfolding during the construction of the search tree =-=[10]-=-. We will not address the details of local control in this section. We abstract from this problem by assuming that some suitable unfolding strategy is at our disposal which decides which terms to unfo... |

63 | Occam’s Razor in Metacomputation: the Notion of a Perfect Process Tree
- Glück, Klimov
- 1993
(Show Context)
Citation Context ...ndancies coming from nested loops, repeated variables, etc. Recent work by Glück and Klimov has expressed the essentials of driving in the context of a more traditional functional language with lists=-= [25]. -=-In [36], Jones put Turchin’s driving methodology on a solid semantic foundation which is not tied to any particular programming language or data structure. The driving process does not always termin... |

60 | Ensuring global termination of partial deduction while allowing flexible polyvariance - Martens, Gallagher - 1995 |

57 |
Compiling Logic Programs with Equality
- Hanus
- 1990
(Show Context)
Citation Context ...ormed by innermost conditional rewriting (i.e., a rewrite rule is applied to a term only if each of its subterms is in normal form). This simplifies our proofs and can also be efficiently implemented =-=[27, 28]-=-. In order to ensure that the normal form of a goal uniquely exists and can be computed by any strategy of rewriting, we require programs to be decreasing as well. Normalizing innermost narrowing is t... |

54 |
Foundations of equational logic programming
- Hölldobler
- 1989
(Show Context)
Citation Context ...ut the direction of future research. Proofs of selected theorems are given in the Appendix. 2 Preliminaries We briefly recall some known results about rewrite systems and functional logic programming =-=[16, 31, 32, 40]-=-. The definitions below are given in the one-sorted case. The extension to manysorted signatures is straightforward [51]. Throughout this paper, V will denote a countably infinite set of variables and... |

53 |
Partial evaluation as a means for inferencing data structures in an applicative language: A theory and implementation
- Komorowski
- 1982
(Show Context)
Citation Context ...hanism of PE for logic programs results in general more powerful than for functional programs. Partial evaluation has been extensively studied both in functional [13, 37, 57] and in logic programming =-=[22, 42, 46]. ∗-=- This work has been partially supported by CICYT under grant TIC 95-0433-C03-03. § DSIC, Universidad Politécnica de Valencia, Camino de Vera s/n, Apdo. 22012, 46071 Valencia, Spain. ¶ Dipartimento ... |

53 | Curry: A Truly Functional Logic Language - Hanus, Kuchen, et al. - 1995 |

50 | The ecce partial deduction system and the dppd library of benchmarks. Available via http://www.cs.kuleuven.ac.be/~lpai - Leuschel |

48 | Loop checking in partial deduction - Bol - 1993 |

48 | Static and dynamic semantics processing - Consel, Danvy - 1991 |

48 | Global control for partial deduction through characteristic atoms and global trees - Leuschel, Martens - 1996 |

45 | Algebraic properties of idempotent substitutions - Palamidessi - 1990 |

44 |
Design and Implementation of a Generic, Logic and Functional Programming Language
- Bert, Echahed
- 1986
(Show Context)
Citation Context ...they are usual when using types and each function is defined for all constructors of their argument types. Examples of functional logic languages following the CB-CD discipline are: SLOG [20] and LPG =-=[5, 6]. L-=-et ϕ◭(g) be the narrowing strategy which assigns the occurrence u of the leftmost innermost subterm of g to the goal g. We formulate innermost conditional narrowing by means of a labelled transitio... |

44 | Partial Deduction and Driving are Equivalent
- Glück, Sørensen
- 1994
(Show Context)
Citation Context ...e introduce an appropriate abstract operator which guarantees termination and allows us to tune the specialization of the method. We prove that our method passes the so-called Knuth-Morris-Pratt test =-=[26, 36],-=- i.e. specializing a naïve pattern matcher w.r.t. a fixed pattern obtains the efficiency of the Knuth, Morris and Pratt matching algorithm [41]. This seems to contradict the conjecture in [26] that c... |

44 | Completeness Results for Basic Narrowing - Middeldorp, Hamoen - 1994 |

43 |
The algorithm of generalization in the supercompiler
- Turchin
- 1988
(Show Context)
Citation Context ...cture. The driving process does not always terminate, and it does not preserve the semantics, as it can extend the domain of functions [60]. Techniques to ensure termination of driving are studied in =-=[59, 64]-=-. The idea of [64] is to supervise the construction of the tree and, at certain moments, loop back, i.e. fold a configuration to one of the previous states, and in this way construct a finite graph. T... |

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 ...g point of view. Many equational theories which occur in practice follow this discipline, e.g. in the specification of abstract data types. A function symbol is completely-defined (everywhere defined =-=[8]-=-) if it does not occur in any ground term in normal form, that is to say functions are reducible on all ground terms of an appropriate sort. R is said to be completely-defined (CD) if each defined fun... |

35 | Specialization of Lazy Functional Logic Programs - Alpuente, Falaschi, et al. - 1997 |

33 | A Self-Applicable Partial Evaluator for Term Rewriting Systems - Bondorf - 1989 |

33 | A Roadmap to Metacomputation by Supercompilation - Glück, Sørensen - 1996 |