A Transformation System for Lazy Functional Logic Programs

  • María Alpuente
  • Moreno Falaschi
  • Ginés Moreno
  • Germán Vidal
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 1722)

Abstract

Needed narrowing is a complete operational principle for modern declarative languages which integrate the best features of (lazy) functional and logic programming. We define a transformation methodology for functional logic programs based on needed narrowing. We provide (strong) correctness results for the transformation system w.r.t. the set of computed values and answer substitutions and show that the prominent properties of needed narrowing -namely, the optimality w.r.t. the length of derivations and the number of computed solutions- carry over to the transformation process and the transformed programs. We illustrate the power of the system by taking on in our setting two well-known transformation strategies (composition and tupling). We also provide an implementation of the transformation system which, by means of some experimental results, highlights the benefits of our approach.

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. 1.
    Alpuente, M., Falaschi, M., Ferri, C., Moreno, G., Vidal, G., Ziliotto, I.: The Transformation System SYNTH. Technical report DSIC-II/16/99, DSIC (1999), Available from http://www.dsic.upv.es/users/elp/papers.html
  2. 2.
    Alpuente, M., Falaschi, M., Moreno, G., Vidal, G.: Safe Folding/Unfolding with Conditional Narrowing. In: Hanus, M., Heering, J., Meinke, K. (eds.) ALP 1997 and HOA 1997. LNCS, vol. 1298, pp. 1–15. Springer, Heidelberg (1997)CrossRefGoogle Scholar
  3. 3.
    Alpuente, M., Falaschi, M., Moreno, G., Vidal, G.: A Transformation System for Lazy Functional Logic Programs. Technical report, DSIC, UPV (1999), Available from http://www.dsic.upv.es/users/elp/papers.html
  4. 4.
    Antoy, S.: Definitional Trees. In: Kirchner, H., Levi, G. (eds.) ALP 1992. LNCS, vol. 632, pp. 143–157. Springer, Heidelberg (1992)CrossRefGoogle Scholar
  5. 5.
    Antoy, S., Echahed, R., Hanus, M.: A Needed Narrowing Strategy. In: Proc. 21st ACM Symp. on Principles of Programming Languages, pp. 268–279 (1994)Google Scholar
  6. 6.
    Baader, F., Nipkow, T.: Term Rewriting and All That. Cambridge University Press, Cambridge (1998)Google Scholar
  7. 7.
    Bossi, A., Cocco, N.: Basic Transformation Operations which preserve Computed Answer Substitutions of Logic Programs. JLP 16, 47–87 (1993)MATHCrossRefMathSciNetGoogle Scholar
  8. 8.
    Burstall, R.M., Darlington, J.: A Transformation System for Developing Recursive Programs. Journal of the ACM 24(1), 44–67 (1977)MATHCrossRefMathSciNetGoogle Scholar
  9. 9.
    Chin, W.: Towards an Automated Tupling Strategy. In: Proc. of Partial Evaluation and Semantics-Based Program Manipulation, pp. 119–132. ACM Press, New York (1993)Google Scholar
  10. 10.
    Chin, W., Goh, A., Khoo, S.: Effiective Optimisation of Multiple Traversals in Lazy Languages. In: Proc. of PEPM 1999 (Technical Report BRICS-NS-99-1), University of Aarhus, DK, pp. 119–130 (1999)Google Scholar
  11. 11.
    Darlington, J.: Program transformation. In: Functional Programming and its Applications, pp. 193–215. Cambridge University Press, Cambridge (1982)Google Scholar
  12. 12.
    Feather, M.S.: A Survey and Classification of some Program Transformation Approaches and Techniques. In: IFIP 1987, pp. 165–195 (1987)Google Scholar
  13. 13.
    Gardner, P.A., Shepherdson, J.C.: Unfold/fold Transformation of Logic Programs. In: Lassez, J.L., Plotkin, G. (eds.) Computational Logic, Essays in Honor of Alan Robinson, pp. 565–583. The MIT Press, Cambridge (1991)Google Scholar
  14. 14.
    Hanus, M.: The Integration of Functions into Logic Programming: From Theory to Practice. Journal of Logic Programming 19&20, 583–628 (1994)CrossRefMathSciNetGoogle Scholar
  15. 15.
    Hanus, M.: A Unified Computation Model for Functional and Logic Programming. In: Proc. of the 24th ACM POPL, pp. 80–93. ACM, New York (1997)Google Scholar
  16. 16.
    Hanus, M., Kuchen, H., Moreno-Navarro, J.J.: Curry: A Truly Functional Logic Language. In: Proc. ILPS 1995 Workshop on Visions for the Future of Logic Programming, pp. 95–107 (1995)Google Scholar
  17. 17.
    Hanus, M. (ed.): Curry: An Integrated Functional Logic Language (1999), Available at http://www-i2.informatik.rwth-aachen.de/~hanus/curry
  18. 18.
    Huet, G., Lévy, J.J.: Computations in Orthogonal Rewriting Systems, Part I + II. In: Lassez, J.L., Plotkin, G.D. (eds.) Computational Logic - Essays in Honor of Alan Robinson, pp. 395–443 (1992)Google Scholar
  19. 19.
    Johnsson, T.: Lambda Lifting: Transforming Programs to Recursive Equations. In: FPLCA 1985. LNCS, pp. 190–203. Springer, Heidelberg (1985)Google Scholar
  20. 20.
    Kawamura, T., Kanamori, T.: Preservation of Stronger Equivalence in Unfold/ Fold Logic Program Transformation. In: TCS, vol. 75, pp. 139–156 (1990)Google Scholar
  21. 21.
    Maher, M.J.: A Transformation System for Deductive Database Modules with Perfect Model Semantics. Theoretical Computer Science 110(2), 377–403 (1993)MATHCrossRefMathSciNetGoogle Scholar
  22. 22.
    Moreno-Navarro, J.J., Rodríguez-Artalejo, M.: Logic Programming with Functions and Predicates: The language Babel. JLP 12(3), 191–224 (1992)MATHCrossRefGoogle Scholar
  23. 23.
    Pettorossi, A., Proietti, M.: Transformation of Logic Programs: Foundations and Techniques. Journal of Logic Programming 19&20, 261–320 (1994)CrossRefMathSciNetGoogle Scholar
  24. 24.
    Pettorossi, A., Proietti, M.: Rules and Strategies for Transforming Functional and Logic Programs. ACM Computing Surveys 28(2), 360–414 (1996)CrossRefGoogle Scholar
  25. 25.
    Roychoudhury, A., Narayan Kumar, K., Ramakrishnan, C.R., Ramakrishnan, I.V.: A Parameterized Unfold/Fold Transformation Framework for Definite Logic Programs. In: Nadathur, G. (ed.) PPDP 1999. LNCS, vol. 1702. Springer, Heidelberg (1999) (to appear)CrossRefGoogle Scholar
  26. 26.
    Sands, D.: Total Correctness by Local Improvement in the Transformation of Functional Programs. ACM ToPLaS 18(2), 175–234 (1996)CrossRefMathSciNetGoogle Scholar
  27. 27.
    Scherlis, W.L.: Program Improvement by Internal Specialization. In: Proc. of 8th ACM POPL, pp. 41–49. ACM Press, New York (1981)Google Scholar
  28. 28.
    Tamaki, H., Sato, T.: Unfold/Fold Transformations of Logic Programs. In: Tärnlund, S. (ed.) Proc. of 2nd ICLP, pp. 127–139 (1984)Google Scholar
  29. 29.
    Wadler, P.L.: Listlessness is better than Laziness. Ph.D. Thesis, Computer Science Department, CMU-CS-85-171, Carnegie Mellon Univertsity, Pittsburgh, PA (1985)Google Scholar
  30. 30.
    Wadler, P.L.: Deforestation: Transforming programs to eliminate trees. Theoretical Computer Science 73, 231–248 (1990)MATHCrossRefMathSciNetGoogle Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 1999

Authors and Affiliations

  • María Alpuente
    • 1
  • Moreno Falaschi
    • 2
  • Ginés Moreno
    • 3
  • Germán Vidal
    • 1
  1. 1.DSICUPVValenciaSpain
  2. 2.Dip. Mat. e InformaticaU. UdineUdineItaly
  3. 3.Dep. InformáticaUCLMAlbaceteSpain

Personalised recommendations