Skip to main content
Log in

Cost-Augmented Partial Evaluation of Functional Logic Programs

  • Published:
Higher-Order and Symbolic Computation

Abstract

We enhance the narrowing-driven partial evaluation scheme for lazy functional logic programs with the computation of symbolic costs. The enhanced scheme allows us to estimate the effects of the program transformer in a precise framework and, moreover, to quantify these effects. The considered costs are “symbolic” in the sense that they measure the number of basic operations performed during a computation rather than actual execution times. Our scheme may serve as a basis to develop speedup analyses and cost-guided transformers. A cost-augmented partial evaluator, which demonstrates the usefulness of our approach, has been implemented in the multi-paradigm language Curry.

This is a preview of subscription content, log in via an institution to check access.

Access this article

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Similar content being viewed by others

References

  1. Ager, M.S., Danvy, O., and Rohde, H. On obtaining Knuth, Morris and Pratt's string matcher by partial evaluation. In Proc. of the ASIAN Symposium on Partial Evaluation and Semantics-Based Program Manipulation (ASIA-PEPM'02), ACM Press, 2002, pp. 32-46.

  2. Albert, E., Antoy, S., and Vidal, G. Measuring the effectiveness of partial evaluation in functional logic languages. In Proc. of the 10th Int'l Workshop on Logic-Based Program Synthesis and Transformation (LOPSTR 2000), Springer LNCS 2042, 2001, pp. 103-124.

  3. Albert, E., Hanus, M., Huch, F., Olvier, J., and Vidal, G. Operational semantics for functional logic languages. In Proc. of the Int'l Workshop on Functional and (Constraint) Logic Programming (WFLP 2002), vol. 76 of Electronic Notes in Theoretical Computer Science, Elsevier Science Publishers, 2002a.

  4. Albert, E., Hanus, M., and Vidal, G. Using an abstract representation to specialize functional logic programs. In Proc. of the 7th Int'l Conf. on Logic for Programming and Automated Reasoning (LPAR'00), Springer LNAI 1955, 2000, pp. 381-398.

  5. Albert, E., Hanus, M., and Vidal, G. A practical partial evaluation scheme for multi-paradigm declarative languages. Journal of Functional and Logic Programming, 2002(1) (2002b) 1-34.

    Google Scholar 

  6. Albert, E., Hanus, M., and Vidal, G. A residualizing semantics for the partial evaluation of functional logic programs. Information Processing Letters, 85(1) (2003) 19-25.

    Google Scholar 

  7. Albert, E. and Vidal, G. The narrowing-driven approach to functional logic program specialization. New Generation Computing, 20(1) (2002a) 3-26.

    Google Scholar 

  8. Albert, E. and Vidal, G. Symbolic profiling for multi-paradigm declarative languages. In Proc. of the 11th Int'l Workshop on Logic-Based Program Synthesis and Transformation (LOPSTR'01), Springer LNCS 2372, 2002b, pp. 148-167.

  9. Alpuente, M., Falaschi, M., Julián, P., and Vidal, G. Specialization of lazy functional logic programs. In Proc. of the ACM SIGPLAN Conf. on Partial Evaluation and Semantics-Based Program Manipulation, PEPM'97, vol. 32, no. 12, of Sigplan Notices, ACM Press, New York, 1997, pp. 151-162.

    Google Scholar 

  10. Alpuente, M., Falaschi, M., and Vidal, G. Partial evaluation of functional logic programs. ACM TOPLAS, 20(4) (1998) 768-844.

    Google Scholar 

  11. Alpuente, M., Hanus, M., Lucas, S., and Vidal, G. Specialization of inductively sequential functional logic programs. In Proc. of the Fourth ACM SIGPLAN Int'l Conf. on Functional Programming (ICFP'99), vol. 34.9 of ACM Sigplan Notices, ACM Press, 1999, pp. 273-283.

  12. Amtoft, T. Properties of unfolding-based meta-level systems. In Proc. of the ACM Symp. on Partial Evaluation and Semantics-Based Program Transformation (PEPM'91), Sigplan Notices, 26(9) (1991) 243-254.

    Google Scholar 

  13. Andersen, L. and Gomard, C. Speedup analysis in partial evaluation: Preliminary results. In Proc. of the ACM Workshop on Partial Evaluation and Semantics-based Program Transformation (PEPM'92), Yale University, 1992, pp. 1-7.

  14. Antoy, S. Definitional trees. In Proc. of the 3rd Int'l Conference on Algebraic and Logic Programming (ALP'92), Springer LNCS 632, 1992, pp. 143-157.

  15. Antoy, S., Echahed, R., and Hanus, M. A needed narrowing strategy. Journal of the ACM, 47(4) (2000) 776-822.

    Google Scholar 

  16. Baader, F. and Nipkow, T. Term Rewriting and All That. Cambridge University Press, 1998.

  17. Bruynooghe, M., De Schreye, D., and Martens, B. A general criterion for avoiding infinite unfolding. New Generation Computing, 11(1) (1992) 47-79.

    Google Scholar 

  18. Burstall, R. and Darlington, J. A transformation system for developing recursive programs. Journal of the ACM, 24(1) (1977) 44-67.

    Google Scholar 

  19. Consel, C. and Danvy, O. Partial evaluation of pattern matching in strings. Information Processing Letters, 30 (1989) 79-86.

    Google Scholar 

  20. Gallagher, J. Tutorial on specialisation of logic programs. In Proc. of the ACM Symp. on Partial Evaluation and Semantics-Based Program Manipulation (PEPM'93), ACM, New York, 1993, pp. 88-98.

    Google Scholar 

  21. Giovannetti, E., Levi, G., Moiso, C., and Palamidessi, C. Kernel leaf: A logic plus functional language. Journal of Computer and System Sciences, 42 (1991) 363-377.

    Google Scholar 

  22. Hanus, M. The integration of functions into logic programming: From theory to practice. Journal of Logic Programming, 19/20 (1994) 583-628.

    Google Scholar 

  23. Hanus, M. A unified computation model for functional and logic programming. In Proc. of ACM Symp. on Principles of Programming Languages, ACM, New York, 1997, pp. 80-93.

    Google Scholar 

  24. Hanus, M. and Prehofer, C. Higher-order narrowing with definitional trees. Journal of Functional Programming, 9(1) (1999) 33-75.

    Google Scholar 

  25. Hanus, M. (Ed.). Curry: An integrated functional logic language. Available at http://www.informatik.uni-kiel.de/~mh/curry/.

  26. Hanus, M., Antoy, S., Engelke, M., Höppner, K., Koj, J., Niederau, P., Sadre, R., and Steiner, F (Eds.). PAKCS 1.5.0: The Portland Aachen Kiel Curry System User Manual', Technical report, University of Kiel, Germany, 2003.

    Google Scholar 

  27. Hortalá-González, T. and Ullán, E. An abstract machine based system for a lazy narrowing calculus. In Proc. of the 5th Int'l Symp. on Functional and Logic Programming (FLOPS 2001), Springer LNCS 2024, 2001, pp. 216-232.

  28. Huet, G. and Lévy, J. Computations in orthogonal rewriting systems, Part I + II. In Computational Logic—Essays in Honor of Alan Robinson, J. Lassez and G. Plotkin (Eds.), 1992, pp. 395-443.

  29. Jones, N., Gomard, C., and Sestoft, P. Partial Evaluation and Automatic Program Generation. Prentice-Hall, Englewood Cliffs, NJ, 1993.

    Google Scholar 

  30. Leuschel, M. On the power of homeomorphic embedding for online termination. In Proc. of the Int'l Static Analysis Symposium (SAS'98), Springer LNCS 1503, 1998, pp. 230-245.

  31. Lloyd, J. Combining functional and logic programming languages. In Proc. of the Int'l Logic Programming Symposium (ILPS'94), 1994, pp. 43-57.

  32. Lloyd, J. and Shepherdson, J. Partial evaluation in logic programming. Journal of Logic Programming, 11 (1991) 217-242.

    Google Scholar 

  33. Loogen, R., López-Fraguas, F., and Rodríguez-Artalejo, M. A demand driven computation strategy for lazy narrowing. In Proc. of PLILP'93, Springer LNCS 714, 1993, pp. 184-200.

  34. Lux, W. Münster curry v0.9.1: User's guide. Technical report, University of Münster, Germany, 2003.

    Google Scholar 

  35. Moreno-Navarro, J. and Rodríguez-Artalejo, M. Logic programming with functions and predicates: The language babel. Journal of Logic Programming, 12(3) (1992) 191-224.

    Google Scholar 

  36. Peyton Jones, S. and Santos, A. A transformation-based optimiser for haskell. Science of Computer Programming, 32(1-3) (1998) 3-47.

    Google Scholar 

  37. Reynolds, J. Definitional interpreters for higher-order programming languages. Higher-Order and Symbolic Computation, 11(4) (1998) 363-297. Reprinted from the Proceedings of the 25th ACM National Conference (1972).

    Google Scholar 

  38. Sands, D. A naive time analysis and its theory of cost equivalence. Journal of Logic and Computation, 5(4) (1995) 495-541.

    Google Scholar 

  39. Sørensen, M. and Glück, R. An algorithm of generalization in positive supercompilation. In Proc. of the Int'l Logic Programming Symposium (ILPS'95), The MIT Press, Cambridge, MA, 1995, pp. 465-479.

    Google Scholar 

  40. Sørensen, M., Glück, R., and Jones, N. A positive supercompiler. Journal of Functional Programming, 6(6) (1996) 811-838.

    Google Scholar 

  41. Vidal, G. Cost-augmented narrowing-driven specialization. In Proc. of the ACM SIGPLAN Workshop on Partial Evaluation and Semantics-Based Program Manipulation (PEPM'02), ACM Press, 2002, pp. 52-62.

  42. Wadler, P. Deforestation: Transforming programs to eliminate trees. Theoretical Computer Science, 73 (1990) 231-248.

    Google Scholar 

  43. Warren, D.H.D. Higher-order extensions to prolog—Are they needed?. In Machine Intelligence, M. Hayes-Roth and Pao (Eds.), Ellis Horwood, vol. 10, 1982.

Download references

Author information

Authors and Affiliations

Authors

Rights and permissions

Reprints and permissions

About this article

Cite this article

Vidal, G. Cost-Augmented Partial Evaluation of Functional Logic Programs. Higher-Order and Symbolic Computation 17, 7–46 (2004). https://doi.org/10.1023/B:LISP.0000029447.02190.42

Download citation

  • Issue Date:

  • DOI: https://doi.org/10.1023/B:LISP.0000029447.02190.42

Navigation