Using an Abstract Representation to Specialize Functional Logic Programs

  • Elvira Albert
  • Michael Hanus
  • Germán Vidal
Conference paper
Part of the Lecture Notes in Artificial Intelligence book series (LNCS, volume 1955)


This paper introduces a novel approach for the specialization of functional logic languages. We consider a maximally simplified abstract representation of programs (which still contains all the necessary information) and define a non-standard semantics for these programs. Both things mixed together allow us to design a simple and concise partial evaluation method for modern functional logic languages, avoiding several limitations of previous approaches. Moreover, since these languages can be automatically translated into the abstract representation, our technique is widely applicable. In order to assess the practicality of our approach, we have developed a partial evaluation tool for the multi-paradigm language Curry. The partial evaluator is written in Curry itself and has been tested on an extensive benchmark suite (even a meta-interpreter). To the best of our knowledge, this is the first purely declarative partial evaluator for a functional logic language.


Abstract Representation Operational Semantic Partial Evaluation Case Expression Partial Evaluator 
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.
    E. Albert, M. Alpuente, M. Falaschi, and G. Vidal. Indy User’s Manual. Technical report, UPV, 1998. Available from URL: 396, 396
  2. 2.
    E. Albert, M. Alpuente, M. Hanus, and G. Vidal. A Partial Evaluation Framework for Curry Programs. In Proc. of the 6th Int'l Conf. on Logic for Programming and Automated Reasoning, LPAR’99, pages 376–395. Springer LNAI 1705, 1999. 382, 382, 383, 390, 390, 390, 390Google Scholar
  3. 3.
    E. Albert, M. Hanus, and G. Vidal. Using an Abstract Representation to Specialize Functional Logic Programs. Technical report, UPV, 2000. Available from URL: 383, 386, 392, 396, 396
  4. 4.
    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. 381, 381, 382, 382, 382, 383, 384, 392, 393, 396, 396CrossRefGoogle Scholar
  5. 5.
    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. 382Google Scholar
  6. 6.
    S. Antoy, R. Echahed, and M. Hanus. A Needed Narrowing Strategy. Journal of the ACM, 2000 (to appear). Previous version in Proc. of POPL’94, pages 268–279. 382Google Scholar
  7. 7.
    A. Bondorf. A Self-Applicable Partial Evaluator for Term Rewriting Systems. In Proc. of TAPSOFT’89, pages 81–95. Springer LNCS 352, 1989. 382Google Scholar
  8. 8.
    M. Bruynooghe, D. De Schreye, and B. Martens. A General Criterion for Avoiding Infinite Unfolding. New Generation Computing, 11(1):47–79, 1992. 392zbMATHCrossRefGoogle Scholar
  9. 9.
    C. Consel and O. Danvy. Tutorial notes on Partial Evaluation. In Proc. ACM Symp. on Principles of Programming Languages, pages 493–501, 1993. 381Google Scholar
  10. 10.
    D. De Schreye, R. Glück, J. Jørgensen, M. Leuschel, B. Martens, and M. H. Sørensen. Conjunctive Partial Deduction: Foundations, Control, Algorihtms, and Experiments. Journal of Logic Programming, 41(2&3):231–277, 1999. 382zbMATHCrossRefMathSciNetGoogle Scholar
  11. 11.
    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. 383Google Scholar
  12. 12.
    J. Gallagher. Tutorial on Specialisation of Logic Programs. In Proc. of Partial Evaluation and Semantics-Based Program Manipulation, pages 88–98. ACM, New York, 1993. 381, 391, 392Google Scholar
  13. 13.
    R. Glück and M. H. Sørensen. A Roadmap to Metacomputation by Supercompilation. In Partial Evaluation. Int'l Dagstuhl Seminar, pages 137–160. Springer LNCS 1110, 1996. 382Google 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. 382, 383CrossRefMathSciNetGoogle Scholar
  15. 15.
    M. Hanus. A unified computation model for functional and logic programming. In Proc. of POPL’97, pages 80–93. ACM, New York, 1997. 382, 385Google Scholar
  16. 16.
    M. Hanus. Distributed Programming in a Multi-Paradigm Declarative Language. In Proc. of PPDP’99, pages 376–395. Springer LNCS 1702, 1999. 395Google Scholar
  17. 17.
    M. Hanus. A Functional Logic Programming Approach to Graphical User Interfaces. In Int'l Workshop on Practical Aspects of Declarative Languages, pages 47–62. Springer LNCS 1753, 2000. 395Google Scholar
  18. 18.
    M. Hanus and C. Prehofer. Higher-Order Narrowing with Definitional Trees. Journal of Functional Programming, 9(1):33–75, 1999. 383, 383, 383, 385, 386, 386, 386, 386, 386zbMATHCrossRefMathSciNetGoogle Scholar
  19. 19.
    M. Hanus (ed.). Curry: An Integrated Functional Logic Language. Available at, 2000. 383, 385, 395
  20. 20.
    M. Hanus, S. Antoy, J. Koj, P. Niederau, R. Sadre, and F. Steiner. PAKCS 1.2: User Manual. Available at, 2000. 383, 396
  21. 21.
    N. D. Jones, C. K. Gomard, and P. Sestoft. Partial Evaluation and Automatic Program Generation. Prentice-Hall, Englewood Cliffs, NJ, 1993. 381, 382, 382Google Scholar
  22. 22.
    Laura Lafave. A Constraint-based Partial Evaluator for Functional Logic Programs and its Application. PhD thesis, Department of Computer Science, University of Bristol, 1998. 381Google Scholar
  23. 23.
    M. Leuschel. On the Power of Homeomorphic Embedding for Online Termination. In G. Levi, editor, Proc. of SAS’98, pages 230–245. Springer LNCS 1503, 1998. 392, 393Google Scholar
  24. 24.
    J. W. Lloyd and J. C. Shepherdson. Partial Evaluation in Logic Programming. Journal of Logic Programming, 11:217–242, 1991. 381, 381CrossRefMathSciNetzbMATHGoogle Scholar
  25. 25.
    A. P. Nemytykh, V. A. Pinchuk, and V. F. Turchin. A Self-Applicable Supercompiler. In Proc. of Dagstuhl Sem. on Part. Evaluation, pages 322–337. Springer LNCS 1110, 1996. 382Google Scholar
  26. 26.
    M. H. Sørensen and R. Glück. An Algorithm of Generalization in Positive Supercompilation. In Proc. of ILPS’95, pages 465–479. MIT Press, 1995. 392Google Scholar
  27. 27.
    M. H. Sørensen, R. Glück, and N. D. Jones. A Positive Supercompiler. Journal of Functional Programming, 6(6):811–838, 1996. 381, 382, 389, 389zbMATHGoogle Scholar
  28. 28.
    P. L. Wadler. Deforestation: Transforming programs to eliminate trees. Theoretical Computer Science, 73:231–248, 1990. 381, 389zbMATHCrossRefMathSciNetGoogle Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2000

Authors and Affiliations

  • Elvira Albert
    • 1
  • Michael Hanus
    • 2
  • Germán Vidal
    • 1
  1. 1.DSICUPVValenciaSpain
  2. 2.Institut für InformatikCAU KielKielGermany

Personalised recommendations