## Specialization of Lazy Functional Logic Programs (1997)

### Cached

### Download Links

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

### Other Repositories/Bibliography

Venue: | IN PROC. OF THE ACM SIGPLAN CONF. ON PARTIAL EVALUATION AND SEMANTICS-BASED PROGRAM MANIPULATION, PEPM'97, VOLUME 32, 12 OF SIGPLAN NOTICES |

Citations: | 35 - 21 self |

### BibTeX

@INPROCEEDINGS{Alpuente97specializationof,

author = {Maria Alpuente and Moreno Falaschi and Pascual Julián and German Vidal},

title = {Specialization of Lazy Functional Logic Programs},

booktitle = {IN PROC. OF THE ACM SIGPLAN CONF. ON PARTIAL EVALUATION AND SEMANTICS-BASED PROGRAM MANIPULATION, PEPM'97, VOLUME 32, 12 OF SIGPLAN NOTICES},

year = {1997},

pages = {151--162},

publisher = {ACM Press}

}

### Years of Citing Articles

### OpenURL

### Abstract

Partial evaluation is a method for program specialization based on fold/unfold transformations [8, 25]. Partial evaluation of pure functional programs uses mainly static values of given data to specialize the program [15, 44]. In logic programming, the so-called static/dynamic distinction is hardly present, whereas considerations of determinacy and choice points are far more important for control [12]. We discuss these issues in the context of a (lazy) functional logic language. We formalize a two-phase specialization method for a non-strict, first order, integrated language which makes use of lazy narrowing to specialize the program w.r.t. a goal. The basic algorithm (first phase) is formalized as an instance of the framework for the partial evaluation of functional logic programs of [2, 3], using lazy narrowing. However, the results inherited by [2, 3] mainly regard the termination of the PE method, while the (strong) soundness and completeness results must be restated for the lazy strategy. A post-processing renaming scheme (second phase) is necessary which we describe and illustrate on the well-known matching example. This phase is essential also for other non-lazy narrowing strategies, like innermost narrowing, and our method can be easily extended to these strategies. We show that our method preserves the lazy narrowing semantics and that the inclusion of simplification steps in narrowing derivations can improve control during specialization.

### Citations

751 | Rewrite systems
- Dershowitz, Jouannaud
- 1992
(Show Context)
Citation Context ... related work and Section 6 concludes. More details and missing proofs can be found in [1]. 2 Preliminaries We briefly recall some known results about rewrite systems and functional logic programming =-=[10, 18, 21, 26]. Throu-=-ghout this paper, V will denote a countably infinite set of variables and Σ denotes a set of function symbols f/n, each with a fixed associated arity n. τ(Σ ∪ V) and τ(Σ) denote the sets of ter... |

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 ...Informática, Ronda de Calatrava s/n, 13.071 Ciudad Real, Spain. E-mail: pjulian@inf-cr.uclm.es. Abstract Partial evaluation is a method for program specialization based on fold/unfold transformations=-= [8, 25]-=-. Partial evaluation of pure functional programs uses mainly static values of given data to specialize the program [15, 44]. In logic programming, the so-called static/dynamic distinction is hardly pr... |

627 |
V.R.: Fast pattern matching in strings
- Knuth, Morris, et al.
- 1977
(Show Context)
Citation Context ...called Knuth-Morris-Pratt test [15, 24], i.e. the specialization of a naïve pattern matcher w.r.t. a fixed pattern essentially obtains the efficiency of the Knuth, Morris and Pratt matching algorithm=-= [27]-=-. We show that the inclusion of a normalization process between narrowing steps not only saves time and space but also yields a better optimization strategy which does not increase the size of the pro... |

570 | A Transformation System for Developing Recursive Programs
- Burstall, Darlington
- 1976
(Show Context)
Citation Context ...Informática, Ronda de Calatrava s/n, 13.071 Ciudad Real, Spain. E-mail: pjulian@inf-cr.uclm.es. Abstract Partial evaluation is a method for program specialization based on fold/unfold transformations=-= [8, 25]-=-. Partial evaluation of pure functional programs uses mainly static values of given data to specialize the program [15, 44]. In logic programming, the so-called static/dynamic distinction is hardly pr... |

565 | Term Rewriting Systems
- Klop
- 1992
(Show Context)
Citation Context ... related work and Section 6 concludes. More details and missing proofs can be found in [1]. 2 Preliminaries We briefly recall some known results about rewrite systems and functional logic programming =-=[10, 18, 21, 26]. Throu-=-ghout this paper, V will denote a countably infinite set of variables and Σ denotes a set of function symbols f/n, each with a fixed associated arity n. τ(Σ ∪ V) and τ(Σ) denote the sets of ter... |

400 | Deforestation: Transforming programs to eliminate trees
- Wadler
- 1990
(Show Context)
Citation Context ...ta structures. It illustrates the fact that our method can eliminate intermediate data structures and turn multiple–pass programs into one–pass programs. This effect is also achieved by deforestat=-=ion [47]-=-, tupling [9] and positive supercompilation [42], among others, while standard PE generally does not get this optimization [44]. This example also shows that normalization between narrowing steps can ... |

333 | Functional Logic Programming: From Theory to Curry
- Hanus
(Show Context)
Citation Context ...term rewriting systems, lazy narrowing, partial evaluation, post-processing renaming. 1 Introduction Many proposals for the integration of functional and logic programming are based on narrowing (see =-=[18]-=- for a recent survey). Narrowing is a natural extension of the evaluation mechanism of functional languages to incorporate unification. Narrowing solves equations by computing unifiers w.r.t. an equat... |

290 | On completeness of narrowing strategies
- Echahed
- 1988
(Show Context)
Citation Context ...y means of a (conditional) term rewriting system. In order to avoid useless computations and to deal with nonterminating and nonstrict functions, lazy narrowing strategies have recently been proposed =-=[4, 29, 35, 39]-=-. One main advantage of an integrated functional logic language is the reduction of the search space by exploiting functional computations. Hence, an important improvement of (lazy) narrowing is the i... |

239 |
Partial evaluation in logic programming
- Lloyd, Shepherdson
- 1991
(Show Context)
Citation Context ...pecialization refers to the technique of how to derive a specialized instance of a program to a restricted set of inputs. Particular cases include Partial Evaluation (PE) of functional [25] and logic =-=[12, 34]-=- programs. PE of functional programs, as in [25], is usually restricted to constant (static values) propagation, whereas PE techniques for logic languages exploit unification-based information propaga... |

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., [30]). A renaming is a substi-=-tution ρ for which there exists the inverse ρ−1 such that ρρ−1 ≡ ρ−1ρ ≡ ǫ. Two terms t and t ′ are variants (of each other), if there exists a renaming ρ such that tρ ≡ t ′ . ... |

166 | Canonical forms and unification - Hullot - 1980 |

156 |
Logic Programming with Functions and Predicates: The language Babel
- Moreno-Navarro, Rodríguez-Artalejo
- 1992
(Show Context)
Citation Context ...y means of a (conditional) term rewriting system. In order to avoid useless computations and to deal with nonterminating and nonstrict functions, lazy narrowing strategies have recently been proposed =-=[4, 29, 35, 39]-=-. One main advantage of an integrated functional logic language is the reduction of the search space by exploiting functional computations. Hence, an important improvement of (lazy) narrowing is the i... |

145 | Tutorial on specialisation of logic programs
- Gallagher
- 1993
(Show Context)
Citation Context ...lize the program [15, 44]. In logic programming, the so-called static/dynamic distinction is hardly present, whereas considerations of determinacy and choice points are far more important for control =-=[12]-=-. We discuss these issues in the context of a (lazy) functional logic language. We formalize a two-phase specialization method for a non-strict, first order, integrated language which makes use of laz... |

110 | Narrowing as the operational semantics of functional languages", Unpublished report - Reddy - 1985 |

104 |
Kernel Leaf: A Logic plus Functional Language
- Giovannetti, Levi, et al.
- 1991
(Show Context)
Citation Context ...nor equations between constructors. This is a reasonable class from the functional programming point of view. Many functional logic languages follow this discipline, e.g. ALF [16], Babel [39], K-LEAF =-=[14]-=-, LPG [7], and SLOG [11]. A head normal form is a variable or a constructor-rooted term. In CB normal programs, each condition s = t in the body of a program rule has the property that t is ground con... |

95 | A Demand Driven Computation Strategy for Lazy Narrowing
- Loogen, López-Fraguas, et al.
- 1993
(Show Context)
Citation Context ...y means of a (conditional) term rewriting system. In order to avoid useless computations and to deal with nonterminating and nonstrict functions, lazy narrowing strategies have recently been proposed =-=[4, 29, 35, 39]-=-. One main advantage of an integrated functional logic language is the reduction of the search space by exploiting functional computations. Hence, an important improvement of (lazy) narrowing is the i... |

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 [22], innermost =-=[11],-=- innermost basic [21] or lazy narrowing [40]. The innermost and the lazy strategies mimic the strict and lazy evaluation known from functional programming languages. Formally, a narrowing strategy ϕ ... |

88 |
Conditional rewrite rules: Confluence and termination
- Bergstra, Klop
- 1982
(Show Context)
Citation Context ... if the terms t1, . . .,tn in the condition s1 = t1, . . .,sn = tn of each program rule are ground normal forms w.r.t. the unconditional part of the CTRS. Weakly orthogonal normal CTRSs are confluent =-=[6, 26]. A term -=-s is a normal form, if there is no term t with s →R t. We let s ↓ denote the normal form of s. A substitution σ is normalized, if xσ is a normal form for all x ∈ Dom(σ). For CTRS R, r < R den... |

80 | Narrowing-driven partial evaluation of functional logic programs
- Alpuente, Falaschi, et al.
- 1996
(Show Context)
Citation Context ...ent. Our 2smethod is also useful for non lazy narrowing strategies, such as innermost narrowing. Also in this case the resulting program must be constructor based. The extension of our method is easy =-=[1].-=- Our method passes the so-called Knuth-Morris-Pratt test [15, 24], i.e. the specialization of a naïve pattern matcher w.r.t. a fixed pattern essentially obtains the efficiency of the Knuth, Morris an... |

78 | A Positive Supercompiler
- Sørensen, Glück, et al.
- 1996
(Show Context)
Citation Context ...sed to compare the strength of specializers. This example is particularly interesting because it is a kind of transformation that neither (conventional) PE nor deforestation can perform automatically =-=[44]-=-. Partial deduction of logic programs and positive supercompilation of functional programs can pass the test [44]. Our method also performs satisfactorily on the problem, as the following example illu... |

73 |
Towards an automated tupling strategy
- Chin
- 1993
(Show Context)
Citation Context ... It illustrates the fact that our method can eliminate intermediate data structures and turn multiple–pass programs into one–pass programs. This effect is also achieved by deforestation [47], tupl=-=ing [9]-=- and positive supercompilation [42], among others, while standard PE generally does not get this optimization [44]. This example also shows that normalization between narrowing steps can be used as a ... |

73 | An algorithm of generalization in positive supercompilation
- Sørensen, Glück
- 1995
(Show Context)
Citation Context ... can achieve in a principled, non ad-hoc way, the same transformation effect as some (postunfolding) techniques that eliminate intermediate functions in the driving approach to program specialization =-=[15, 42, 43]-=-. The preference for deterministic computations is a good heuristic to avoid code explosion which is also comparable to the determinism-based criterium of [13] that explores maximal deterministic path... |

70 |
The theory of well-quasi-ordering: a frequently discovered concept
- Kruskal
(Show Context)
Citation Context ...tn) ≡ t, if and only if: 1. f ≡ g (and m ≡ n) and si � ti for all i = 1, . . .,n, or 2. s � tj, for some j, 1 ≤ j ≤ n. The embedding relation � is a well-quasi ordering of the set τ(�=-=�∪V) for finite Σ [2, 28], -=-that is, any infinite sequence of terms t1,t2, . . . with a finite number of operators is self-embedding, i.e., there are numbers j,k with j < k and tj � tk. In order to avoid an infinite sequence o... |

60 | Ensuring global termination of partial deduction while allowing flexible polyvariance
- Martens, Gallagher
- 1995
(Show Context)
Citation Context ...erms(R ′ )) where the function abstract(c,T) extends the current configuration c with (an abstraction of) the set of terms T which are not closed w.r.t. S, giving a new PE configuration. Similarly t=-=o [36]-=-, applying abstract in every iteration allows us to tune the control of polyvariance as much as needed. Also, it is within the abstract operator that the progress towards termination resides. Definiti... |

57 | Compiling Logic Programs with Equality - Hanus - 1990 |

54 |
Foundations of equational logic programming
- Hölldobler
- 1989
(Show Context)
Citation Context ... related work and Section 6 concludes. More details and missing proofs can be found in [1]. 2 Preliminaries We briefly recall some known results about rewrite systems and functional logic programming =-=[10, 18, 21, 26]. Throu-=-ghout this paper, V will denote a countably infinite set of variables and Σ denotes a set of function symbols f/n, each with a fixed associated arity n. τ(Σ ∪ V) and τ(Σ) denote the sets of ter... |

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

48 | Global control for partial deduction through characteristic atoms and global trees
- Leuschel, Martens
- 1996
(Show Context)
Citation Context ...term that is “syntactically simpler” than another is smaller than the other. The following definition extends the homeomorphic embedding (“syntactically simpler”) relation [10] to nonground te=-=rms. In [31], an e-=-xtension of this relation is defined which provides a finer handle of variables. Definition 4.1 (embedding relation [43]) The homeomorphic embedding relation � on terms in τ(Σ∪V) is defined as t... |

44 |
Design and Implementation of a Generic, Logic and Functional Programming Language
- Bert, Echahed
- 1986
(Show Context)
Citation Context ...ons between constructors. This is a reasonable class from the functional programming point of view. Many functional logic languages follow this discipline, e.g. ALF [16], Babel [39], K-LEAF [14], LPG =-=[7]-=-, and SLOG [11]. A head normal form is a variable or a constructor-rooted term. In CB normal programs, each condition s = t in the body of a program rule has the property that t is ground constructor ... |

44 | Partial Deduction and Driving are Equivalent
- Glück, Sørensen
- 1994
(Show Context)
Citation Context ...n is a method for program specialization based on fold/unfold transformations [8, 25]. Partial evaluation of pure functional programs uses mainly static values of given data to specialize the program =-=[15, 44]-=-. In logic programming, the so-called static/dynamic distinction is hardly present, whereas considerations of determinacy and choice points are far more important for control [12]. We discuss these is... |

44 | Completeness Results for Basic Narrowing
- Middeldorp, Hamoen
- 1994
(Show Context)
Citation Context ...sts a narrowing derivation s = t ❀ ⊤ such that θ ≤E σ [Var(s) ∪Var(t)]. It is well-known that the subscript E in θ ≤E σ can be dropped if we only consider completeness w.r.t. normalized =-=substitutions [37]-=-. Conditional narrowing has been shown to be a complete E-unification algorithm for theories satisfying different restrictions [18, 21, 37]. Since unrestricted narrowing has quite a large search space... |

43 |
The algorithm of generalization in the supercompiler
- Turchin
- 1988
(Show Context)
Citation Context ...basic technique for PE of logic programs was presented in [12]. Turchin’s driving transformation for functional programs achieves the same effect as the PE of logic programs, by virtue of unificatio=-=n [15, 45, 46]-=-. The PE of functional logic languages is a relatively new area of research. As far as we know, [2, 3] formalize the first PE scheme for functional logic languages which can improve the original progr... |

42 | Redundant argument filtering of logic programs
- Leuschel, Srensen
- 1996
(Show Context)
Citation Context ...ition describes renaming functions which can erase variables of the renamed calls. As noted in [32], this approach can produce incorrect transformations. A safe technique has been later introduced in =-=[33]-=-. The second difference is in the renaming of clause bodies. As we pointed out before, our renaming transformation is nondeterministic, and thus the function ren of Definition 4.3 can produce differen... |

40 | Sequentiality in orthogonal term rewriting systems - Klop, Middeldorp - 1991 |

36 | Lazy Narrowing in a Graph Machine
- Kuchen, Loogen, et al.
- 1990
(Show Context)
Citation Context |

34 | M.Rodr'iguez-Artalejo: Graph-based Implementation of a Functional Logic Language - Kuchen, Moreno-Navarro - 1990 |

32 |
The essence of program transformation by partial evaluation and driving
- Jones
- 2000
(Show Context)
Citation Context ...egies, such as innermost narrowing. Also in this case the resulting program must be constructor based. The extension of our method is easy [1]. Our method passes the so-called Knuth-Morris-Pratt test =-=[15, 24],-=- i.e. the specialization of a naïve pattern matcher w.r.t. a fixed pattern essentially obtains the efficiency of the Knuth, Morris and Pratt matching algorithm [27]. We show that the inclusion of a n... |

30 | Some low-level source transformations for logic programs
- Gallagher, Bruynooghe
(Show Context)
Citation Context ...proach to program specialization [15, 42, 43]. The preference for deterministic computations is a good heuristic to avoid code explosion which is also comparable to the determinism-based criterium of =-=[13]-=- that explores maximal deterministic paths. 1.1 Plan of the Paper The structure of the paper is as follows. Basic definitions are given in Section 2. Section 3 recalls the general scheme for the PE of... |

30 |
de Waal. A conceptual embedding of folding into partial deduction: Towards a maximal integration
- Leuschel, Schreye, et al.
- 1996
(Show Context)
Citation Context ... case of nested functions in expressions. For simple patterns, our post-unfolding renaming essentially boils down to the simpler transformation of [5]. A more closely related approach can be found in =-=[32]-=-, where conjunctions of calls (atoms) can appear in the heads of partially evaluated programs, which is somehow comparable to nested function applications. As in our framework, in [32] renaming is man... |

25 | Supporting transformations for the partial evaluation of logic programs - Benkerimi, Hill - 1993 |

25 | An algorithm of generalization in positive supercompilation - Srensen, Gluck - 1995 |

23 | A Deterministic Lazy Narrowing Calculus
- Middeldorp, Okui
- 1998
(Show Context)
Citation Context ...al partial evaluators are based on call-by-value procedures. 2 For simplicity, we have omitted the rules that reduce functions to false. We have used the simplification and eager variable elimination =-=[38] rules in-=- order to get better specialization. 15s(a) Naïve pattern matcher R: match(p,s) → loop(p,s,p,s) loop(nil,ss,op,os) → true loop(p : pp,nil,op,os) → false loop(p : pp,s : ss,op,os) → loop(pp,ss... |

21 | On Extra Variables in (Equational) Logic Programming
- Hanus
- 1995
(Show Context)
Citation Context ..., and SLOG [11]. A head normal form is a variable or a constructor-rooted term. In CB normal programs, each condition s = t in the body of a program rule has the property that t is ground constructor =-=[19]-=-. We assume that these conditions hold for all programs we consider in this paper. This requirement is also made in Babel and K-LEAF. In practice, this is not a real restriction, since we can provide ... |

19 |
Improving Basic Narrowing Techniques
- Réty
- 1987
(Show Context)
Citation Context ...zation g →∗ R g↓ followed by a narrowing step g↓ σ ❀ g ′ . The idea of exploiting deterministic computations by including normalization has been applied to almost all narrowing strategies=-=, e.g. basic [21, 41]-=-, innermost [11], innermost basic [21], and lazy narrowing [17]. Lazy narrowing reduces expressions at outermost narrowable positions. Narrowing at inner positions is performed only if it is demanded ... |

16 |
Program Transformation by Supercompilation
- Turchin
- 1986
(Show Context)
Citation Context ...basic technique for PE of logic programs was presented in [12]. Turchin’s driving transformation for functional programs achieves the same effect as the PE of logic programs, by virtue of unificatio=-=n [15, 45, 46]-=-. The PE of functional logic languages is a relatively new area of research. As far as we know, [2, 3] formalize the first PE scheme for functional logic languages which can improve the original progr... |

15 | Turchin’s supercompiler revisited - an operational theory of positive information propagation
- Sørensen
- 1996
(Show Context)
Citation Context ... can achieve in a principled, non ad-hoc way, the same transformation effect as some (postunfolding) techniques that eliminate intermediate functions in the driving approach to program specialization =-=[15, 42, 43]-=-. The preference for deterministic computations is a good heuristic to avoid code explosion which is also comparable to the determinism-based criterium of [13] that explores maximal deterministic path... |

11 | Turchin's Supercompiler Revisited: An Operational Theory of Positive Information Propagation - Srensen - 1994 |

10 | Lazy narrowing with simplification
- Hanus
- 1997
(Show Context)
Citation Context ...T TIC 95-0433-C03-03 and by HCM project CONSOLE. 1ssearch space in comparison to pure logic programs, since normalization can avoid the creation of useless choice points in sequential implementations =-=[17, 18]-=-. Program specialization refers to the technique of how to derive a specialized instance of a program to a restricted set of inputs. Particular cases include Partial Evaluation (PE) of functional [25]... |

5 | LSE narrowing for decreasing conditional term rewrite systems - Bockmayr, Werner - 1995 |

2 | Narrowing-driven specialization of Functional Logic Programs
- Alpuente, Falaschi, et al.
- 1995
(Show Context)
Citation Context ...ce of the resultant procedures thus guaranteeing the strong correctness of the transformation. We need a more involved condition. Namely, we have to consider overlaps among the specialized calls (see =-=[3]).-=- Definition 3.4 (overlap) A term s overlaps a term t if there is a nonvariable subterm s |u of s such that s |u and t unify. If s ≡ t, we require that t be unifiable with a proper nonvariable subter... |