Implementing Equational Constraints in a Functional Language

  • Bernd Braßel
  • Michael Hanus
  • Björn Peemöller
  • Fabian Reck
Part of the Lecture Notes in Computer Science book series (LNCS, volume 7752)


KiCS2 is a new system to compile functional logic programs of the source language Curry into purely functional Haskell programs. The implementation is based on the idea to represent the search space as a data structure and logic variables as operations that generate their values. This has the advantage that one can apply various, in particular, complete search strategies or even user-defined strategies to compute solutions. However, the generation of all values for logic variables might be inefficient for applications that exploit constraints on partially known values. To overcome this drawback, we propose new techniques to implement equational constraints in this framework. In particular, we show how unification modulo function evaluation and functional patterns can be added without sacrificing the efficiency of the kernel implementation.


Logic Program Logic Programming Free Variable Logic Variable Source Language 
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ït-Kaci, H.: Warren’s Abstract Machine. MIT Press (1991)Google Scholar
  2. 2.
    Antoy, S., Hanus, M.: Compiling Multi-Paradigm Declarative Programs into Prolog. In: Kirchner, H. (ed.) FroCos 2000. LNCS (LNAI), vol. 1794, pp. 171–185. Springer, Heidelberg (2000)CrossRefGoogle Scholar
  3. 3.
    Antoy, S., Hanus, M.: Functional Logic Design Patterns. In: Hu, Z., Rodríguez-Artalejo, M. (eds.) FLOPS 2002. LNCS, vol. 2441, pp. 67–87. Springer, Heidelberg (2002)CrossRefGoogle Scholar
  4. 4.
    Antoy, S., Hanus, M.: Declarative Programming with Function Patterns. In: Hill, P.M. (ed.) LOPSTR 2005. LNCS, vol. 3901, pp. 6–22. Springer, Heidelberg (2006)CrossRefGoogle Scholar
  5. 5.
    Antoy, S., Hanus, M.: Overlapping Rules and Logic Variables in Functional Logic Programs. In: Etalle, S., Truszczyński, M. (eds.) ICLP 2006. LNCS, vol. 4079, pp. 87–101. Springer, Heidelberg (2006)CrossRefGoogle Scholar
  6. 6.
    Antoy, S., Hanus, M.: Functional Logic Programming. Communications of the ACM 53(4), 74–85 (2010)CrossRefGoogle Scholar
  7. 7.
    Antoy, S., Hanus, M.: New Functional Logic Design Patterns. In: Kuchen, H. (ed.) WFLP 2011. LNCS, vol. 6816, pp. 19–34. Springer, Heidelberg (2011)CrossRefGoogle Scholar
  8. 8.
    Antoy, S., Hanus, M., Liu, J., Tolmach, A.: A Virtual Machine for Functional Logic Computations. In: Grelck, C., Huch, F., Michaelson, G.J., Trinder, P. (eds.) IFL 2004. LNCS, vol. 3474, pp. 108–125. Springer, Heidelberg (2005)CrossRefGoogle Scholar
  9. 9.
    Augustsson, L., Rittri, M., Synek, D.: On generating unique names. Journal of Functional Programming 4(1), 117–123 (1994)CrossRefGoogle Scholar
  10. 10.
    Braßel, B., Fischer, S.: From Functional Logic Programs to Purely Functional Programs Preserving Laziness. In: Scholz, S.-B., Chitil, O. (eds.) IFL 2008. LNCS, vol. 5836, pp. 25–42. Springer, Heidelberg (2011)CrossRefGoogle Scholar
  11. 11.
    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)CrossRefGoogle Scholar
  12. 12.
    Braßel, B., Huch, F.: On a Tighter Integration of Functional and Logic Programming. In: Shao, Z. (ed.) APLAS 2007. LNCS, vol. 4807, pp. 122–138. Springer, Heidelberg (2007)CrossRefGoogle Scholar
  13. 13.
    Braßel, B., Huch, F.: The Kiel Curry System KiCS. In: Seipel, D., Hanus, M., Wolf, A. (eds.) INAP/WLP 2007. LNCS (LNAI), vol. 5437, pp. 195–205. Springer, Heidelberg (2009)CrossRefGoogle Scholar
  14. 14.
    Giovannetti, E., Levi, G., Moiso, C., Palamidessi, C.: Kernel LEAF: A Logic plus Functional Language. Journal of Computer and System Sciences 42(2), 139–185 (1991)CrossRefzbMATHGoogle Scholar
  15. 15.
    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
  16. 16.
    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
  17. 17.
    Hanus, M.: Declarative Processing of Semistructured Web Data. In: Technical Communications of the 27th International Conference on Logic Programming. Leibniz International Proceedings in Informatics (LIPIcs), vol. 11, pp. 198–208 (2011)Google Scholar
  18. 18.
    Hanus, M., Antoy, S., Braßel, B., Engelke, M., Höppner, K., Koj, J., Niederau, P., Sadre, R., Steiner, F.: PAKCS: The Portland Aachen Kiel Curry System (2010),
  19. 19.
    Hanus, M., Peemöller, B., Reck, F.: Search Strategies for Functional Logic Programming. In: Proc. of the 5th Working Conference on Programming Languages (ATPS 2012), LNI, vol. 199, pp. 61–74. Springer (2012)Google Scholar
  20. 20.
    Hanus, M., Sadre, R.: An Abstract Machine for Curry and its Concurrent Implementation in Java. Journal of Functional and Logic Programming 1999(6) (1999)Google Scholar
  21. 21.
    Hanus, M. (ed.): Curry: An Integrated Functional Logic Language, Vers. 0.8.3 (2012),
  22. 22.
    Hussmann, H.: Nondeterministic Algebraic Specifications and Nonconfluent Term Rewriting. Journal of Logic Programming 12, 237–255 (1992)MathSciNetCrossRefzbMATHGoogle Scholar
  23. 23.
    López-Fraguas, F., Sánchez-Hernández, J.: TOY: A Multiparadigm Declarative System. In: Narendran, P., Rusinowitch, M. (eds.) RTA 1999. LNCS, vol. 1631, pp. 244–247. Springer, Heidelberg (1999)CrossRefGoogle Scholar
  24. 24.
    Lux, W.: Implementing Encapsulated Search for a Lazy Functional Logic Language. In: Middeldorp, A., Sato, T. (eds.) FLOPS 1999. LNCS, vol. 1722, pp. 100–113. Springer, Heidelberg (1999)CrossRefGoogle Scholar
  25. 25.
    Naish, L.: All Solutions Predicates in Prolog. In: Proc. IEEE Internat. Symposium on Logic Programming, Boston, pp. 73–77 (1985)Google Scholar
  26. 26.
    O’Donnell, M.J.: Equational Logic as a Programming Language. MIT Press (1985)Google Scholar
  27. 27.
    Peyton Jones, S. (ed.): Haskell 98 Language and Libraries—The Revised Report. Cambridge University Press (2003)Google Scholar
  28. 28.
    Reddy, U.S.: Narrowing as the Operational Semantics of Functional Languages. In: Proc. IEEE Internat. Symposium on Logic Programming, Boston, pp. 138–151 (1985)Google Scholar
  29. 29.
    Robinson, J.A.: A Machine-Oriented Logic Based on the Resolution Principle. Journal of the ACM 12(1), 23–41 (1965)CrossRefzbMATHGoogle Scholar
  30. 30.
    Schrijvers, T., Stuckey, P., Wadler, P.: Monadic Constraint Programming. Journal of Functional Programming 19(6), 663–697 (2009)MathSciNetCrossRefzbMATHGoogle Scholar
  31. 31.
    Slagle, J.R.: Automated Theorem-Proving for Theories with Simplifiers, Commutativity, and Associativity. Journal of the ACM 21(4), 622–642 (1974)MathSciNetCrossRefzbMATHGoogle Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2013

Authors and Affiliations

  • Bernd Braßel
    • 1
  • Michael Hanus
    • 1
  • Björn Peemöller
    • 1
  • Fabian Reck
    • 1
  1. 1.Institut für InformatikCAU KielKielGermany

Personalised recommendations