Measuring the Effectiveness of Partial Evaluation in Functional Logic Languages

  • Elvira Albert
  • Germán Vidal
  • Sergio Antoy
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 2042)


We introduce a framework for assessing the effectiveness of partial evaluators in functional logic languages. Our framework is based on properties of the rewrite system that models a functional logic program. Consequently, our assessment is independent of any specific language implementation or computing environment. We define several criteria for measuring the cost of a computation: number of steps, number of function applications, and pattern matching effort. Most importantly, we express the cost of each criterion by means of recurrence equations over algebraic data types, which can be automatically inferred from the partial evaluation process itself. In some cases, the equations can be solved by transforming their arguments from arbitrary data types to natural numbers. In other cases, it is possible to estimate the improvement of a partial evaluation by analyzing the associated cost recurrence equations.


Logic Program Residual Program Recurrence Equation Partial Evaluation Cost Criterion 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    A. V. Aho, J. E. Hopcroft, and J. D. Ullman. The Design and Analysis of Computer Algorithms. Addison-Wesley, Reading, MA, 1974.Google Scholar
  2. 2.
    E. Albert, M. Alpuente, M. Falaschi, and G. Vidal. Indy User’s Manual. Technical Report DSIC-II/12/98, UPV, 1998.Google Scholar
  3. 3.
    E. Albert, S. Antoy, and G. Vidal. A Formal Approach to Reasoning about the Effectiveness of Partial Evaluation. Technical Report DSIC, UPV, 2000. Available from URL:
  4. 4.
    E. Albert, M. Hanus, and G. Vidal. 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’2000), pages 381–398. Springer LNAI 1955, 2000.Google Scholar
  5. 5.
    M. Alpuente, M. Falaschi, and G. Vidal. Partial Evaluation of Functional Logic Programs. ACM Transactions on Programming Languages and Systems, 20(4):768–844, 1998.CrossRefGoogle Scholar
  6. 6.
    M. Alpuente, M. Hanus, S. Lucas, and G. Vidal. Specialization of Functional Logic Programs Based on Needed Narrowing. ACM Sigplan Notices, 34(9):273–283, 1999.CrossRefGoogle Scholar
  7. 7.
    T. Amtoft. Properties of Unfolding-based Meta-level Systems. In Proc. of PEPM’91, pages 243–254. ACM Press, 1991.Google Scholar
  8. 8.
    L. O. Andersen and C. K. Gomard. Speedup Analysis in Partial Evaluation: Preliminary Results. In Proc. of PEPM’92, pages 1–7. Yale University, 1992.Google Scholar
  9. 9.
    S. Antoy. Definitional trees. In Proc. of the 3rd Int’l Conference on Algebraic and Logic Programming (ALP’92), pages 143–157. Springer LNCS 632, 1992.CrossRefGoogle Scholar
  10. 10.
    S. Antoy, R. Echahed, and M. Hanus. A Needed Narrowing Strategy. Journal of the ACM, 47(4):776–822, 2000.CrossRefMathSciNetGoogle Scholar
  11. 11.
    F. Baader and T. Nipkow. Term Rewriting and All That. Cambridge University Press, 1998.Google Scholar
  12. 12.
    C. Consel and O. Danvy. Tutorial notes on Partial Evaluation. In Proc. of the Annual Symp. on Principles of Programming Languages (POPL’93), pages 493–501. ACM, New York, 1993.CrossRefGoogle Scholar
  13. 13.
    S. K. Debray and N. W. Lin. Cost Analysis of Logic Programs. ACM Transactions on Programming Languages and Systems, 15(5):826–975, 1993.CrossRefGoogle Scholar
  14. 14.
    J. Gallagher. Tutorial on Specialisation of Logic Programs. In Proc. of PEPM’93, pages 88–98. ACM, New York, 1993.Google Scholar
  15. 15.
    E. Giovannetti, G. Levi, C. Moiso, and C. Palamidessi. Kernel Leaf: A Logic plus Functional Language. Journal of Computer and System Sciences, 42:363–377, 1991.CrossRefGoogle Scholar
  16. 16.
    M. Hanus. The Integration of Functions into Logic Programming: From Theory to Practice. Journal of Logic Programming, 19&20:583–628, 1994.CrossRefMathSciNetGoogle Scholar
  17. 17.
    M. Hanus (ed.). Curry: An Integrated Functional Logic Language. Available at, 2000.
  18. 18.
    G. Huet and J. J. Lévy. Computations in orthogonal rewriting systems, Part I + II. In J. L. Lassez and G. D. Plotkin, editors, Computational Logic-Essays in Honor of Alan Robinson, pages 395–443, 1992.Google Scholar
  19. 19.
    M. P. Jones and A. Reid. The Hugs 98 User Manual. Available at, 1998.
  20. 20.
    N. D. Jones. Partial Evaluation, Self-Application and Types. In M. S. Paterson, editor, Proc. of 17th Int’l Colloquium on Automata, Languages and Programming (ICALP’90), pages 639–659. Springer LNCS 443, 1990.CrossRefGoogle Scholar
  21. 21.
    N. D. Jones, C. K. Gomard, and P. Sestoft. Partial Evaluation and Automatic Program Generation. Prentice-Hall, Englewood Cliffs, NJ, 1993.zbMATHGoogle Scholar
  22. 22.
    Laura Lafave. A Constraint-based Partial Evaluator for Functional Logic Programs and its Application. PhD thesis, University of Bristol, 1999.Google Scholar
  23. 23.
    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. of the Joint Int’l Conf. and Symp. on Logic Programming (JICSLP’96), pages 319–332. The MIT Press, Cambridge, MA, 1996.Google Scholar
  24. 24.
    Y. A. Liu and G. Gomez. Automatic Accurate Time-Bound Analysis for High-Level Languages. In Proc. of ACM SIGPLAN Workshop on Languages, Compilers, and Tools for Embedded Systems, pages 31–40. Springer LNCS 1474, 1998.Google Scholar
  25. 25.
    J. W. Lloyd and J. C. Shepherdson. Partial Evaluation in Logic Programming. Journal of Logic Programming, 11:217–242, 1991.CrossRefzbMATHMathSciNetGoogle Scholar
  26. 26.
    R. Loogen, F. López-Fraguas, and M. Rodríguez-Artalejo. A Demand Driven Computation Strategy for Lazy Narrowing. In Proc. of 5th Int’l Symp. on Programming Language Implementation and Logic Programming (PLILP’93), pages 184–200. Springer LNCS 714, 1993.Google Scholar
  27. 27.
    F. J. López-Fraguas and J. Sánchez-Hernández. TOY: A Multiparadigm Declarative System. In Proc. of the 10th Int’l Conf. on Rewriting Techniques and Applications (RTA’99), pages 244–247. Springer LNCS 1631, 1999.Google Scholar
  28. 28.
    J. J. Moreno-Navarro and M. Rodríguez-Artalejo. Logic Programming with Functions and Predicates: The language Babel. Journal of Logic Programming, 12(3):191–224, 1992.zbMATHCrossRefGoogle Scholar
  29. 29.
    F. Nielson. A Formal Type System for Comparing Partial Evaluators. In Proc. of the Int’l Workshop on Partial Evaluation and Mixed Computation, pages 349–384. N-H, 1988.Google Scholar
  30. 30.
    M. Rosendahl. Automatic Complexity Analysis. In Proc. of the Int’l Conf. on Functional Programming Languages and Computer Architecture, pages 144–156, New York, NY, 1989. ACM.Google Scholar
  31. 31.
    D. Sands. A Naive Time Analysis and its Theory of Cost Equivalence. Journal of Logic and Computation, 5(4):495–541, 1995.zbMATHCrossRefMathSciNetGoogle Scholar
  32. 32.
    D. Sands. Total Correctness by Local Improvement in the Transformation of Functional Programs. ACM Transactions on Programming Languages and Systems, 18(2):175–234, March 1996.CrossRefGoogle Scholar
  33. 33.
    P. M. Sansom and S. L. Peyton-Jones. Formally Based Profiling for Higher-Order Functional Languages. ACM Transactions on Programming Languages and Systems, 19(2):334–385, 1997.CrossRefGoogle Scholar
  34. 34.
    M. H. Sørensen. 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 Scholar
  35. 35.
    M. H. Sørensen, R. Glück, and N. D. Jones. A Positive Supercompiler. Journal of Functional Programming, 6(6):811–838, 1996.zbMATHCrossRefGoogle Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2001

Authors and Affiliations

  • Elvira Albert
    • 1
  • Germán Vidal
    • 1
  • Sergio Antoy
    • 2
  1. 1.DSICTechnical University of ValenciaSpain
  2. 2.Department of Computer SciencePortland State UniversityUSA

Personalised recommendations