skip to main content
article
Free Access

Specialization of lazy functional logic programs

Authors Info & Claims
Published:01 December 1997Publication History
Skip Abstract Section

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.

References

  1. 1 M. Alpuente, M. Falaschi, P. Juli~in, and G. Vidal. Callby-Name Partial Evaluation of Functional Logic Programs. TR DSIC-II/34/96, U.P. Valencia, 1996. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. 2 M. Alpuente, M. Falaschi, and G. Vidal. Narrowingdriven Partial Evaluation of Functional Logic Programs. In H. Riis Nielson, editor, Proc. of the 6th European Syrup. on Programming, ESOP'96, pages 45-61. Springer LNCS 1058, 1996. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. 3 M. Alpuente, M. Falaschi, and G. Vidal. Narrowingdriven Specialization of Functional Logic Programs. TR DSIC-II/33/96, U.P. Valencia. Extended and revised version of {2}. Available from URL htt.p://www.dsic.upv.es/users/elp/papers.html, 1996. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. 4 S. Antoy, R. Echahed, and M. Hanus. A Needed Narrowing Strategy. In Proc. 21st ACM Syrup. o~ Principles of Programming Langttages, Portland, pages 268- 279, 1994. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. 5 K. Benkerimi and P.M. Hill. Supporting Transformations for the Partial Evaluation of Logic Programs. Journal of Logic and Computation, 3(5):469-486, 1993.Google ScholarGoogle Scholar
  6. 6 J.A. Bergstra and J.W. Klop. Conditional Rewrite Rules: confluence and termination. Journal of Computer and System Sciences, 32:323-362, 1986. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. 7 D. Bert and R. Echahed. Design and implementation of a generic, logic and functional programming language. In Proc. of First European Symp. on Programming, ESOP'86, pages 119-132. Springer LNCS 213, 1986. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. 8 R.M. Burstall and J. Darlington. A Transformation System for Developing Recursive Programs. Journal of the ACM, 24(1):44-67, 1977. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. 9 W. Chin. Towards an Automated Tupfing Strategy. In Proc. of Partial Evaluation and Semantics-Based Pro. 9ram Manipulation, Copenhagen, Denmark, June 1993, pages 119-132. ACM, New York, 1993. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. 10 N. Dershowitz and J.-P. Jouannaud. Rewrite Systems. In J. van Leeuwen, editor, Handbook of Theoretical Computer Science, volume B: Formal Models and Semantics, pages 243-320. Elsevier, Amsterdam, 1990. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. 11 L. Fribourg. SLOG: a logic programming language interpreter based on clausal superposition and rewriting. In Proc. of Second IEEE lnt'l Syrup. on Logic Programming, pages 172-185. IEEE, New York, 1985.Google ScholarGoogle Scholar
  12. 12 J. Gallagher. TutoriM on Specialisation of Logic Programs. In Proc. of Partial Evaluation and Semantics- Based Program Manipulation, Copenhagen, Denmark, June 1993, pages 88-98. ACM, New York, 1993. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. 13 J. Gallagher and M. Bruynooghe. Sonde Low-Level Source Transformations for Logic Programs. In M. Bruynooghe, editor, Proc. of 2nd Workshop on Meta-Programmin9 ir~ Logic, pages 229-246. Department of Computer Science, K U Leuven, Belgium, 1990.Google ScholarGoogle Scholar
  14. 14 E. Giovannetti, G. Levi, C. Moiso, and C. Palamidessi. Kernel Leaf: A Logic plus Functional Language. Journal of Computer and System Sciences, 42, 1991. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. 15 R. Gliick and M.H. S~rensen. Partial Deduction and Driving are Equivalent. In P~vc. lnt7 Syrup. on Programming Language Implementation and Logic Programming, PLILP'94. pages 165-181. Springer LNCS 844, 1994. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. 16 M. Hanus. Compiling Logic Programs with Equality. In Proc. of 2nd lnt'l Workshop on Programming Language implementation and Logic Programming, pages 387-401. Springer LNCS 456, 1990. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. 17 M. Hanus. Combining Lazy Narrowing with Simpfification. In Proc. of 6th lnt'l Syrup. on Programming Language Implementation and Logic P~vyramming, pages 370-384. Springer LNCS 844, 1994. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. 18 M. Hanus. The Integration of Functions into Logic Progtamming: From Theory to Practice. Journal of Logic Programming, 19&20:583-628, 1994.Google ScholarGoogle Scholar
  19. 19 M. Hanus. On Extra Variables in (.Equational) Logic Programming. In Proc. o} 20th Int'l Conf. on Logic Pro- 9ramming, pages 665-678. The MIT Press, Cambridge, MA, 1995.Google ScholarGoogle Scholar
  20. 20 M. Hanus, H. Kuchen, and J.J. Moreno-Navarro. Curry: A Truly Functional Logic Language. In Proc. ILPS'95 Workshop on Visions }or the Future of Logic Programming, pages 95-107, 1995.Google ScholarGoogle Scholar
  21. 21 S. HSlldobler. Foundations of Equational Logic Pro- 9ramming. Springer LNAI 353, 1989. Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. 22 J.M. Hullot. Canonical Forms and Unification. In Proc of 5th Int'l Conj. on Automated Deduction, pages 318- 334. Springer LNCS 87, 1980. Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. 23 H. Hussman. Unification in Conditional-Equational Theories. in Proc. European Conf. on Computer Algebra EUROCAL'85, pages 543-553. Springer LNCS 204, 1985. Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. 24 N.D. Jones. The Essence of Program Transformation by Partial Evaluation and Driving. In N.D. Jones, M. Hagiya, and M. Sato, editors, Logic, Language and Computation, pages 206-224. Springer LNCS 792, 1994.Google ScholarGoogle Scholar
  25. 25 N.D. Jones, C.K. Gomard, and P. Sestoft. Partial Evaluation and Automatic Program Generation. Prentice- Hall, Englewood Cliffs, N J, 1993. Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. 26 J.W. Klop. Term Rewriting Systems. In S. Abramsky, D. Gabbay, and T. Maibaum, editors, Handbook of Logic in Computer Science, volume I, pages 1-112. Oxford University Press, 1992. Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. 27 D.E. Knuth, J.H. Morris, and V.R. Pratt. Fast Pattern Matching in Strings. SlAM Journal o} Computation, 6(2):323-350, 1977.Google ScholarGoogle ScholarCross RefCross Ref
  28. 28 J. B. Kruskal. The Theory of Well-Quasi-Ordering: A Frequently Discovered Concept. Journal of Combinatorial Theory, A(13):297-305, 1972.Google ScholarGoogle Scholar
  29. 29 H. Kuchen, R. Loogen, J.J. Moreno-Navarro, and M. Rodriguez-Artalejo. Lazy Narrowing in a Graph Machine. In Proc. of the lnt'l Con}. on Algebraic and Logic Programming, volume 463 of Lecture Notes in Computer Science, pages 298-317, 1990. Google ScholarGoogle ScholarDigital LibraryDigital Library
  30. 30 J.-L. Lassez, M. J. Maher, and K. Marriott. Unification Revisited. In J. Minker, editor, Foundations o} Deductive Databases and Logic Programming, pages 587-625. Morgan K~ufmann, Los Altos, Ca., 1988. Google ScholarGoogle ScholarDigital LibraryDigital Library
  31. 31 M. Leuschel and B. Martens. Global Control for Partial Deduction through Characteristic Atoms and Global Trees. Technical Report CW-220, Department of Computer Science, K.U. Leuven, Belgium, December 1995.Google ScholarGoogle Scholar
  32. 32 M. Leuschel, D. De Schreye, and A. de Waal. A Conceptual Embedding of Folding into Partial Deduction: Towards a Maximal Integration. In M. Maher, editor, Proc. o} the Joint International Conference and Symposium on Logic Programming JICSLP'96, pages 319- 332. The MIT Press, Cambridge, MA, 1996.Google ScholarGoogle Scholar
  33. 33 M. Leuschel and M.H. S~rensen. Redundant Argument Filtering of Logic Programs. In Proc. of Int'l Workshop on Logic Programming Synthesis and Transformation, LOPSTR'96. To appear in Springer LNCS, 1996. Google ScholarGoogle ScholarDigital LibraryDigital Library
  34. 34 J.W. Lloyd and J.C. Shepherdson. Partial Evaluation in Logic Programming. Journal of Logic Programming, 11'217-242, 1991. Google ScholarGoogle ScholarDigital LibraryDigital Library
  35. 35 R. Loogen, F. L6pez-Fraguas, and M. Rodriguez- Artalejo. A Demand Driven Computation Strategy for Lazy Narrowing. In J. Penjam and M. Bruynooghe, editors, Proc. of PLILP'93, Tallinn (Estonia), pages 184-200. Springer LNCS 714, 1993. Google ScholarGoogle ScholarDigital LibraryDigital Library
  36. 36 B. Martens and J. Gallagher. Ensuring Global Termination of Partial Deduction while Allowing Flexible Polyvariance. In L. Sterling, editor, Proc. of ICLP'95, pages 597-611. MIT Press, 1995.Google ScholarGoogle Scholar
  37. 37 A. Middeldorp and E. Hamoen. Completeness Results for Basic Narrowing. Applicable Algebra in Engineering, Communication and Computing, 5:213-253, 1994.Google ScholarGoogle ScholarCross RefCross Ref
  38. 38 A. Middeldorp and S. Okui. A Deterministic Lazy Narrowing Calculus. In Proc. o} the Fuji Int'l Workshop on Functional and Logic Programming, pages 104-118. World Scientific, 1995.Google ScholarGoogle Scholar
  39. 39 J.J. Moreno-Navarro and M. Rodriguez-Artalejo. Logic Programming with Functions and Predicates: The language Babel. Journal o,f Logic Programming, 12(3):191- 224, 1992. Google ScholarGoogle ScholarDigital LibraryDigital Library
  40. 40 U.S. {teddy. Narrowing as the Operational Semantics of Functional Languages. In Proc. of Second 1EEE Int'l Syrup. on Logic Programming, pages 138-151. IEEE, New York, 1985.Google ScholarGoogle Scholar
  41. 41 P. R~ty. Improving basic narrowing techniques. In Proc. of the Conf. on Rewriting Techniques and Applications, pages 228-241. Springer LNCS 256, 1987. Google ScholarGoogle ScholarDigital LibraryDigital Library
  42. 42 M.H. Sorensen. Turchin's Supercompiler Revisited: An Operational Theory of Positive Information Propagation. Technical Report 94/7, Master's Thesis, DIKU, University of Copenhagen, Denmark, 1994.Google ScholarGoogle Scholar
  43. 43 M.H. Sorensen and R. Gltick. An Algorithm of Generalization in Positive Supercompilation. In J.W. Lloyd, editor, Proc. of ILPS'95, pages 465-479. The MIT Press, Cambridge, MA, 1995.Google ScholarGoogle Scholar
  44. 44 M.H. S0rensen, R. Giiick, and N.D. Jones. A Positive Supercompiler. Journal of Functional Programming, 1996. To ~ppear.Google ScholarGoogle Scholar
  45. 45 V.F. Turchin. Program Transformation by Supercompilation. In H. Ganzinger and N.D.}ones, editors, Programs as Data Objects, 1985, pages 257-281. Springer LNCS 217, 1986. Google ScholarGoogle ScholarDigital LibraryDigital Library
  46. 46 V.F. Turchin. The Algorithm of Generalization in the Supercompiler. In D. Bjorner, A.P. Ershov, and N.D. Jones, editors, Proc. of the lnt7 Workshop on Partial Evaluation and Mixed Computation, pages 531-549. North-Holland, Amsterdam, 1988.Google ScholarGoogle Scholar
  47. 47 P.L. Wadler. Deforestation: transforming programs to eliminate trees. In Proc of the European Syrup. on Programming, ESOP'S& pages 344-358. Springer LNCS 300, 1988. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Specialization of lazy functional logic programs

                Recommendations

                Comments

                Login options

                Check if you have access through your login credentials or your institution to get full access on this article.

                Sign in

                Full Access

                • Published in

                  cover image ACM SIGPLAN Notices
                  ACM SIGPLAN Notices  Volume 32, Issue 12
                  Dec. 1997
                  217 pages
                  ISSN:0362-1340
                  EISSN:1558-1160
                  DOI:10.1145/258994
                  Issue’s Table of Contents
                  • cover image ACM Conferences
                    PEPM '97: Proceedings of the 1997 ACM SIGPLAN symposium on Partial evaluation and semantics-based program manipulation
                    December 1997
                    217 pages
                    ISBN:0897919173
                    DOI:10.1145/258993

                  Copyright © 1997 ACM

                  Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

                  Publisher

                  Association for Computing Machinery

                  New York, NY, United States

                  Publication History

                  • Published: 1 December 1997

                  Check for updates

                  Qualifiers

                  • article

                PDF Format

                View or Download as a PDF file.

                PDF

                eReader

                View online with eReader.

                eReader