Narrowing-driven partial evaluation of functional logic programs

  • M. Alpuente
  • M. Falaschi
  • G. Vidal
Contributed Papers
Part of the Lecture Notes in Computer Science book series (LNCS, volume 1058)

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. Formal methods of transformation of functional logic programs can be based on this well-established operational semantics. In this paper, we present a partial evaluation scheme for functional logic languages based on an automatic unfolding algorithm which builds narrowing trees. We study the semantic properties of the transformation and the conditions under which the technique terminates, is sound and complete, and is also generally applicable to a wide class of programs. We illustrate our method with several examples and discuss the relation with Supercompilation and Partial Evaluation. To the best of our knowledge, this is the first formal approach to partial evaluation of functional logic programs.

References

  1. 1.
    M. Alpuente, M. Falaschi, and G. Levi. Incremental Constraint Satisfaction for Equational Logic Programming. Theoretical Computer Science, 142:27–57, 1995.Google Scholar
  2. 2.
    M. Alpuente, M. Falaschi, and G. Vidal. Narrowing-driven specialization of Functional Logic Programs. Technical Report DSIC-II/27/95, UPV, 1995.Google Scholar
  3. 3.
    P. Arenas, A. Gil, and F. López. Combining Lazy Narrowing with Disequality Constraints. In Proc. of PLILP'94, pages 385–399. Springer LNCS 844, 1994.Google Scholar
  4. 4.
    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 Scholar
  5. 5.
    R.M. Burstall and J. Darlington. A Transformation System for Developing Recursive Programs. Journal of the ACM, 24(1):44–67, 1977.CrossRefGoogle Scholar
  6. 6.
    J. Darlington and H. Pull. A Program Development Methodology Based on a Unified Approach to Execution and Transformation. In D. Bjørner, A.P. Ershov, and N.D. Jones, editors, Proc. of the Int'l Workshop on Partial Evaluation and Mixed Computation, pages 117–131. North-Holland, Amsterdam, 1988.Google Scholar
  7. 7.
    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 Scholar
  8. 8.
    L. Fribourg. SLOG: a logic programming language interpreter based on clausal superposition and rewriting. In Proc. of Second IEEE Int'l Symp. on Logic Programming, pages 172–185. IEEE, New York, 1985.Google Scholar
  9. 9.
    Y. Futamura. Partial Evaluation of Computation Process — An Approach to a Compiler-Compiler. Systems, Computers, Controls, 2(5):45–50, 1971.Google Scholar
  10. 10.
    J. Gallagher. Tutorial on Specialisation of Logic Programs. In Proc. of PEPM'93, pages 88–98. ACM, New York, 1993.Google Scholar
  11. 11.
    J. Gallagher and M. Bruynooghe. Some Low-Level Source Transformations for Logic Programs. In M. Bruynooghe, editor, Proc. of 2nd Workshop on Meta-Programming in Logic, pages 229–246. Department of Computer Science, KU Leuven, Belgium, 1990.Google Scholar
  12. 12.
    R. Glück and M.H. Sørensen. Partial Deduction and Driving are Equivalent. In Proc. of PLILP'94, pages 165–181. Springer LNCS 844, 1994.Google Scholar
  13. 13.
    M. Hanus. Combining Lazy Narrowing with Simplification. In Proc. of PLILP'94, pages 370–384. Springer LNCS 844, 1994.Google Scholar
  14. 14.
    M. Hanus. The Integration of Functions into Logic Programming: From Theory to Practice. Journal of Logic Programming, 19&20:583–628, 1994.Google Scholar
  15. 15.
    S. Hölldobler. Foundations of Equational Logic Programming. Springer LNAI 353, 1989.Google Scholar
  16. 16.
    J.M. Hullot. Canonical Forms and Unification. In Proc of 5th Int'l Conf. on Automated Deduction, pages 318–334. Springer LNCS 87, 1980.Google Scholar
  17. 17.
    H. Hussmann. Unification in Conditional-Equational Theories. In Proc. of EUROCAL'85, pages 543–553. Springer LNCS 204, 1985.Google Scholar
  18. 18.
    J. Jaffar and J.-L. Lassez. Constraint Logic Programming. In Proc. of 14th Annual ACM Symp. on Principles of Programming Languages, pages 111–119. ACM, 1987.Google Scholar
  19. 19.
    N.D. Jones, C.K. Gomard, and P. Sestoft. Partial Evaluation and Automatic Program Generation. Prentice-Hall, Englewood Cliffs, NJ, 1993.Google Scholar
  20. 20.
    D.E. Knuth, J.H. Morris, and V.R. Pratt. Fast Pattern Matching in Strings. SIAM Journal of Computation, 6(2):323–350, 1977.Google Scholar
  21. 21.
    J.-L. Lassez, M. J. Maher, and K. Marriott. Unification Revisited. In J. Minker, editor, Foundations of Deductive Databases and Logic Programming, pages 587–625. Morgan Kaufmann, Los Altos, Ca., 1988.Google Scholar
  22. 22.
    M. Leuschel and D. De Schreye. An Almost Perfect Abstraction Operator for Partial Deduction. Technical Report CW-199, Department of Computer Science, K.U. Leuven, Belgium, December 1994.Google Scholar
  23. 23.
    G. Levi and F. Sirovich. Proving Program Properties, Symbolic Evaluation and Logi0cal Procedural Semantics. In Proc. of MFCS'75, pages 294–301. Springer LNCS 32, 1975.Google Scholar
  24. 24.
    J.W. Lloyd and J.C. Shepherdson. Partial Evaluation in Logic Programming. Journal of Logic Programming, 11:217–242, 1991.Google Scholar
  25. 25.
    B. Martens and J. Gallagher. Ensuring Global Termination of Partial Deduction while Allowing Flexible Polyvariance. In K. Furukawa and K. Ueda, editors, Proc. of ICLP'95, pages 597–611, 1995.Google Scholar
  26. 26.
    A. Middeldorp and E. Hamoen. Completeness Results for Basic Narrowing. Applicable Algebra in Engineering, Communication and Computing, 5:213–253, 1994.Google Scholar
  27. 27.
    U.S. Reddy. Narrowing as the Operational Semantics of Functional Languages. In Proc. of Second IEEE Int'l Symp. on Logic Programming, pages 138–151. IEEE, New York, 1985.Google Scholar
  28. 28.
    P. Sestoft and H. Søndergaard. A bibliography on partial evaluation. Sigplan Notices, 23(2):19–27, Feb 1988.Google Scholar
  29. 29.
    M.H. Sørensen and R. Glück. Generalization in Positive Supercompilation. In J.W. Lloyd, editor, Proc. of ILPS'95, 1995.Google Scholar
  30. 30.
    M.H. Sørensen, R. Glück, and N.D. Jones. Towards Unifying Partial Evaluation, Deforestation, Supercompilation, and GPC. In D. Sannella, editor, Proc. of ESOP'94, pages 485–500. Springer LNCS 788, 1994.Google Scholar
  31. 31.
    V.F. Turchin. The Concept of a Supercompiler. ACM Transactions on Programming Languages and Systems, 8(3):292–325, July 1986.CrossRefGoogle Scholar
  32. 32.
    V.F. Turchin. The Algorithm of Generalization in the Supercompiler. In D. Bjørner, A.P. Ershov, and N.D. Jones, editors, Proc. of the Int'l Workshop on Partial Evaluation and Mixed Computation, pages 531–549. North-Holland, Amsterdam, 1988.Google Scholar

Copyright information

© Springer-Verlag 1996

Authors and Affiliations

  • M. Alpuente
    • 1
  • M. Falaschi
    • 2
  • G. Vidal
    • 1
  1. 1.DSICUniversidad Politécnica de ValenciaValenciaSpain
  2. 2.Dipartimento di Matematica e InformaticaUniversità di UdineUdineItaly

Personalised recommendations