Improving Residuation in Declarative Programs

  • Michael HanusEmail author
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 11372)


Residuation is an operational principle to evaluate functions in logic-oriented languages. Residuation delays function calls until the arguments are sufficiently instantiated in order to evaluate the function deterministically. It has been proposed as an alternative to the non-deterministic narrowing principle and is useful to connect externally defined operations. Residuation can be implemented in Prolog systems supporting coroutining, but this comes with a price: the coroutining mechanism causes a considerable overhead even if it is not used. To overcome this dilemma, we propose a compile-time analysis which approximates the run-time residuation behavior. Based on the results of this analysis, we improve an existing implementation of residuation and evaluate the potential efficiency gains by a number of benchmarks.


  1. 1.
    Aït-Kaci, H.: An overview of life. In: Schmidt, J.W., Stogny, A.A. (eds.) EWDW 1990. LNCS, vol. 504, pp. 42–58. Springer, Heidelberg (1991). Scholar
  2. 2.
    Aït-Kaci, H., Lincoln, P., Nasr, R.: Le fun: logic, equations, and functions. In: Proceedings of the 4th IEEE International Symposium on Logic Programming, San Francisco, pp. 17–23 (1987)Google Scholar
  3. 3.
    Albert, E., Hanus, M., Huch, F., Oliver, J., Vidal, G.: Operational semantics for declarative multi-paradigm languages. J. Symb. Comput. 40(1), 795–829 (2005)MathSciNetCrossRefGoogle Scholar
  4. 4.
    Antoy, S., Echahed, R., Hanus, M.: A needed narrowing strategy. J. ACM 47(4), 776–822 (2000)MathSciNetCrossRefGoogle Scholar
  5. 5.
    Antoy, S., Hanus, M.: Compiling multi-paradigm declarative programs into Prolog. In: Kirchner, H., Ringeissen, C. (eds.) FroCoS 2000. LNCS (LNAI), vol. 1794, pp. 171–185. Springer, Heidelberg (2000). Scholar
  6. 6.
    Antoy, S., Hanus, M.: Functional logic programming. Commun. ACM 53(4), 74–85 (2010)CrossRefGoogle Scholar
  7. 7.
    Bonnier, S., Maluszynski, J.: Towards a clean amalgamation of logic programs with external procedures. In: Proceedings of the 5th Conference on Logic Programming and 5th Symposium on Logic Programming, Seattle, pp. 311–326. MIT Press, Cambridge (1988)Google Scholar
  8. 8.
    Braßel, B., Hanus, M., Peemöller, B., Reck, F.: KiCS2: a new compiler from Curry to Haskell. In: Kuchen, H. (ed.) WFLP 2011. LNCS, vol. 6816, pp. 1–18. Springer, Heidelberg (2011). Scholar
  9. 9.
    Casas, A., Cabeza, D., Hermenegildo, M.V.: A syntactic approach to combining functional notation, lazy evaluation, and higher-order in LP systems. In: Hagiya, M., Wadler, P. (eds.) FLOPS 2006. LNCS, vol. 3945, pp. 146–162. Springer, Heidelberg (2006). Scholar
  10. 10.
    Hanus, M.: On the completeness of residuation. In: Proceedings of the 1992 Joint International Conference and Symposium on Logic Programming, pp. 192–206. MIT Press, Cambridge (1992)Google Scholar
  11. 11.
    Hanus, M.: A unified computation model for functional and logic programming. In: Proceedings of the 24th ACM Symposium on Principles of Programming Languages, pp. 80–93 (1997)Google Scholar
  12. 12.
    Hanus, M.: Functional logic programming: from theory to Curry. In: Voronkov, A., Weidenbach, C. (eds.) Programming Logics. LNCS, vol. 7797, pp. 123–168. Springer, Heidelberg (2013). Scholar
  13. 13.
    Hanus, M.: Semantic versioning checking in a declarative package manager. In: Technical Communications of the 33rd International Conference on Logic Programming (ICLP 2017), Open Access Series in Informatics (OASIcs), pp. 6:1–6:16. Schloss Dagstuhl - Leibniz-Zentrum fuer Informatik (2017)Google Scholar
  14. 14.
    Hanus, M., et al.: PAKCS: The Portland Aachen Kiel Curry System (2017).
  15. 15.
    Hanus, M., Skrlac, F.: A modular and generic analysis server system for functional logic programs. In: Proceedings of the ACM SIGPLAN 2014 Workshop on Partial Evaluation and Program Manipulation (PEPM 2014), pp. 181–188. ACM Press (2014)Google Scholar
  16. 16.
    Hanus, M. (ed.): Curry: An integrated functional logic language (vers. 0.9.0) (2016).
  17. 17.
    Lloyd, J.W.: Combining functional and logic programming languages. In: Proceedings of the International Logic Programming Symposium, pp. 43–57 (1994)Google Scholar
  18. 18.
    Loogen, R., Fraguas, F.L., Artalejo, M.R.: A demand driven computation strategy for lazy narrowing. In: Bruynooghe, M., Penjam, J. (eds.) PLILP 1993. LNCS, vol. 714, pp. 184–200. Springer, Heidelberg (1993). Scholar
  19. 19.
    Marriott, K., Søndergaard, H., Dart, P.: A characterization of non-floundering logic programs. In: Proceedings of the 1990 North American Conference on Logic Programming, pp. 661–680. MIT Press, Cambridge (1990)Google Scholar
  20. 20.
    Naish, L.: Adding equations to NU-Prolog. In: Maluszyński, J., Wirsing, M. (eds.) PLILP 1991. LNCS, vol. 528, pp. 15–26. Springer, Heidelberg (1991). Scholar
  21. 21.
    Peyton Jones, S. (ed.): Haskell 98 Language and Libraries—The Revised Report. Cambridge University Press, Cambridge (2003)zbMATHGoogle Scholar
  22. 22.
    Reynolds, J.C.: Definitional interpreters for higher-order programming languages. In: Proceedings of the ACM Annual Conference, pp. 717–740. ACM Press (1972)Google Scholar
  23. 23.
    Smolka, G.: The Oz programming model. In: van Leeuwen, J. (ed.) Computer Science Today: Recent Trends and Developments. LNCS, vol. 1000, pp. 324–343. Springer, Heidelberg (1995). Scholar
  24. 24.
    Van Roy, P., Haridi, S.: Concepts, Techniques, and Models of Computer Programming. MIT Press, Cambridge (2004)Google Scholar
  25. 25.
    Warren, D.H.D.: Higher-order extensions to Prolog: are they needed? Mach. Intell. 10, 441–454 (1982)Google Scholar

Copyright information

© Springer Nature Switzerland AG 2019

Authors and Affiliations

  1. 1.Institut für Informatik, CAU KielKielGermany

Personalised recommendations