Skip to main content

Improving Residuation in Declarative Programs

  • Conference paper
  • First Online:
Practical Aspects of Declarative Languages (PADL 2019)

Part of the book series: Lecture Notes in Computer Science ((LNPSE,volume 11372))

Included in the following conference series:

  • 377 Accesses

Abstract

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.

The research described in this paper has been partially supported by the German Federal Ministry of Education and Research (BMBF) under Grant No. 01IH15006B.

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

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 39.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Notes

  1. 1.

    http://sicstus.sics.se/.

  2. 2.

    The predicate computes the head normal form of its first argument. It can be defined by a case distinction on all function and constructor symbols in the program. The use of instead of simply flattening nested function calls is essential to implement lazy evaluation.

  3. 3.

    One could also refine the abstract domain in order to distinguish between residuation and non-ground results, but this does not seem to provide better results in practice.

  4. 4.

    https://www-ps.informatik.uni-kiel.de/~mh/webcass/.

  5. 5.

    Although the control arguments and are superfluous in non-residuating computations, we leave them in the code in order to simplify the interaction of residuating and non-residuating code. Improving this scheme is a topic for future work.

References

  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). https://doi.org/10.1007/3-540-54141-1_4

    Chapter  Google Scholar 

  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. 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)

    Article  MathSciNet  Google Scholar 

  4. Antoy, S., Echahed, R., Hanus, M.: A needed narrowing strategy. J. ACM 47(4), 776–822 (2000)

    Article  MathSciNet  Google Scholar 

  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). https://doi.org/10.1007/10720084_12

    Chapter  Google Scholar 

  6. Antoy, S., Hanus, M.: Functional logic programming. Commun. ACM 53(4), 74–85 (2010)

    Article  Google Scholar 

  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. 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). https://doi.org/10.1007/978-3-642-22531-4_1

    Chapter  Google Scholar 

  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). https://doi.org/10.1007/11737414_11

    Chapter  MATH  Google Scholar 

  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. 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. 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). https://doi.org/10.1007/978-3-642-37651-1_6

    Chapter  MATH  Google Scholar 

  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. Hanus, M., et al.: PAKCS: The Portland Aachen Kiel Curry System (2017). http://www.informatik.uni-kiel.de/~pakcs/

  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. Hanus, M. (ed.): Curry: An integrated functional logic language (vers. 0.9.0) (2016). http://www.curry-language.org

  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. 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). https://doi.org/10.1007/3-540-57186-8_79

    Chapter  Google Scholar 

  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. 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). https://doi.org/10.1007/3-540-54444-5_84

    Chapter  Google Scholar 

  21. Peyton Jones, S. (ed.): Haskell 98 Language and Libraries—The Revised Report. Cambridge University Press, Cambridge (2003)

    MATH  Google Scholar 

  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. 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). https://doi.org/10.1007/BFb0015252

    Chapter  Google Scholar 

  24. Van Roy, P., Haridi, S.: Concepts, Techniques, and Models of Computer Programming. MIT Press, Cambridge (2004)

    Google Scholar 

  25. Warren, D.H.D.: Higher-order extensions to Prolog: are they needed? Mach. Intell. 10, 441–454 (1982)

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Michael Hanus .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2019 Springer Nature Switzerland AG

About this paper

Check for updates. Verify currency and authenticity via CrossMark

Cite this paper

Hanus, M. (2019). Improving Residuation in Declarative Programs. In: Alferes, J., Johansson, M. (eds) Practical Aspects of Declarative Languages. PADL 2019. Lecture Notes in Computer Science(), vol 11372. Springer, Cham. https://doi.org/10.1007/978-3-030-05998-9_6

Download citation

  • DOI: https://doi.org/10.1007/978-3-030-05998-9_6

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-030-05997-2

  • Online ISBN: 978-3-030-05998-9

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics