Contracts and Specifications for Functional Logic Programming

  • Sergio Antoy
  • Michael Hanus
Part of the Lecture Notes in Computer Science book series (LNCS, volume 7149)


The expressive power of functional logic languages supports high-level specifications as well as efficient implementations of problems in the same language. If specifications are executable, they can be used both as initial prototypical implementations and as contracts for checking the reliable execution of implementations intended to satisfy the specification. In this paper, we propose a practical framework to support this general approach to coding. We discuss the notions of specifications and contracts for functional logic programming and present a tool that supports the development of declarative programs based on these notions.


Logic Programming Input List Transformation Tool Functional Logic Declarative Programming 
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.
    Antoy, S., Echahed, R., Hanus, M.: A needed narrowing strategy. Journal of the ACM 47(4), 776–822 (2000)MathSciNetCrossRefzbMATHGoogle Scholar
  2. 2.
    Antoy, S., Hanus, M.: Set functions for functional logic programming. In: Proceedings of the 11th ACM SIGPLAN International Conference on Principles and Practice of Declarative Programming (PPDP 2009), pp. 73–82. ACM Press (2009)Google Scholar
  3. 3.
    Antoy, S., Hanus, M.: Functional logic programming. Communications of the ACM 53(4), 74–85 (2010)CrossRefGoogle Scholar
  4. 4.
    Antoy, S., Hanus, M.: A transformation tool for functional logic program development. In: Proc. of the 24th Workshop on (Constraint) Logic Programming (WLP 2010), pp. 23–33. German University of Cairo (2010)Google Scholar
  5. 5.
    Bauer, F.L., Broy, M., Gnatz, R., Hesse, W., Krieg-Brückner, B., Partsch, H., Pepper, P., Wössner, H.: Towards a wide spectrum language to support program specification and program development. ACM SIGPLAN Notices 13(12), 15–24 (1978)CrossRefzbMATHGoogle Scholar
  6. 6.
    Braßel, B., Hanus, M., Huch, F.: Encapsulating non-determinism in functional logic computations. Journal of Functional and Logic Programming (July 2004)Google Scholar
  7. 7.
    Chitil, O., McNeill, D., Runciman, C.: Lazy Assertions. In: Trinder, P., Michaelson, G.J., Peña, R. (eds.) IFL 2003. LNCS, vol. 3145, pp. 1–19. Springer, Heidelberg (2004)CrossRefGoogle Scholar
  8. 8.
    Christiansen, J., Fischer, S.: EasyCheck — Test Data for Free. In: Garrigue, J., Hermenegildo, M.V. (eds.) FLOPS 2008. LNCS, vol. 4989, pp. 322–336. Springer, Heidelberg (2008)CrossRefGoogle Scholar
  9. 9.
    Degen, M., Thiemann, P., Wehr, S.: True lies: Lazy contracts for lazy languages (faithfulness is better than laziness). In: 4. Arbeitstagung Programmiersprachen (ATPS 2009), LNI. vol. 154, pages 370, 2946–2259. Springer (2009)Google Scholar
  10. 10.
    Dimoulas, C., Pucella, R., Felleisen, M.: Future contracts. In: Proceedings of the 11th ACM SIGPLAN International Conference on Principles and Practice of Declarative Programming (PPDP 2009), pp. 195–206. ACM Press (2009)Google Scholar
  11. 11.
    Echahed, R., Janodet, J.-C.: On constructor-based graph rewriting systems. Research report imag 985-i, IMAG-LSR, CNRS, Grenoble (1997)Google Scholar
  12. 12.
    Echahed, R., Janodet, J.-C.: Admissible graph rewriting and narrowing. In: Proc. Joint International Conference and Symposium on Logic Programming (JICSLP 1998), pp. 325–340 (1998)Google Scholar
  13. 13.
    Fischer, S., Kuchen, H.: Systematic generation of glass-box test cases for functional logic programs. In: Proceedings of the 9th ACM SIGPLAN International Conference on Principles and Practice of Declarative Programming (PPDP 2007), pp. 75–89. ACM Press (2007)Google Scholar
  14. 14.
    González-Moreno, J.C., Hortalá-González, M.T., López-Fraguas, F.J., Rodríguez-Artalejo, M.: An approach to declarative programming based on a rewriting logic. Journal of Logic Programming 40, 47–87 (1999)MathSciNetCrossRefzbMATHGoogle Scholar
  15. 15.
    Hanus, M.: Multi-paradigm Declarative Languages. In: Dahl, V., Niemelä, I. (eds.) ICLP 2007. LNCS, vol. 4670, pp. 45–75. Springer, Heidelberg (2007)CrossRefGoogle Scholar
  16. 16.
    Hanus, M.: Lazy and Enforceable Assertions for Functional Logic Programs. In: Mariño, J. (ed.) WFLP 2010. LNCS, vol. 6559, pp. 84–100. Springer, Heidelberg (2011)CrossRefGoogle Scholar
  17. 17.
    Hanus, M. (ed.): Curry: An integrated functional logic language, vers. 0.8.2 (2006),
  18. 18.
    Hussmann, H.: Nondeterministic algebraic specifications and nonconfluent term rewriting. Journal of Logic Programming 12, 237–255 (1992)MathSciNetCrossRefzbMATHGoogle Scholar
  19. 19.
    López-Fraguas, F.J., Rodríguez-Hortalá, J., Sánchez-Hernández, J.: A simple rewrite notion for call-time choice semantics. In: Proceedings of the 9th ACM SIGPLAN International Conference on Principles and Practice of Declarative Programming (PPDP 2007), pp. 197–208. ACM Press (2007)Google Scholar
  20. 20.
    Mera, E., Lopez-García, P., Hermenegildo, M.: Integrating Software Testing and Run-Time Checking in an Assertion Verification Framework. In: Hill, P.M., Warren, D.S. (eds.) ICLP 2009. LNCS, vol. 5649, pp. 281–295. Springer, Heidelberg (2009)CrossRefGoogle Scholar
  21. 21.
    Meyer, B.: Object-oriented Software Construction, 2nd edn. Prentice Hall (1997)Google Scholar
  22. 22.
    Okasaki, C.: Purely Functional Data Structures. Cambridge University Press (1998)Google Scholar
  23. 23.
    Peyton Jones, S. (ed.): Haskell 98 Language and Libraries—The Revised Report. Cambridge University Press (2003)Google Scholar
  24. 24.
    Puebla, G., Bueno, F., Hermenegildo, M.: An Assertion Language for Constraint Logic Programs. In: Deransart, P., Małuszyński, J. (eds.) DiSCiPl 1999. LNCS, vol. 1870, pp. 23–62. Springer, Heidelberg (2000)CrossRefGoogle Scholar
  25. 25.
    Xu, D.N.: Extended static checking for Haskell. In: Proc. of the 36th ACM SIGPLAN Workshop on Haskell (Haskell 2006), pp. 48–59 (2006)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2012

Authors and Affiliations

  • Sergio Antoy
    • 1
  • Michael Hanus
    • 2
  1. 1.Computer Science Dept.Portland State UniversityOregonU.S.A.
  2. 2.Institut für InformatikCAU KielKielGermany

Personalised recommendations