Skip to main content

Default rules for Curry*


In functional logic programs, rules are applicable independently of textual order, i.e., any rule can potentially be used to evaluate an expression. This is similar to logic languages and contrary to functional languages, e.g., Haskell enforces a strict sequential interpretation of rules. However, in some situations it is convenient to express alternatives by means of compact default rules. Although default rules are often used in functional programs, the non-deterministic nature of functional logic programs does not allow to directly transfer this concept from functional to functional logic languages in a meaningful way. In this paper, we propose a new concept of default rules for Curry that supports a programming style similar to functional programming while preserving the core properties of functional logic programming, i.e., completeness, non-determinism, and logic-oriented use of functions. We discuss the basic concept and propose an implementation which exploits advanced features of functional logic languages.

Hide All

This is an extended version of a paper presented at the international symposium on Practical Aspects of Declarative Languages (PADL 2016), invited as a rapid communication in TPLP. The authors acknowledge the assistance of the conference program chairs Marco Gavanelli and John Reppy.

Hide All
Antoy, S. 1992. Definitional trees. In Proc. of the 3rd International Conference on Algebraic and Logic Programming, Springer LNCS, Berlin Heidelberg, vol. 632, 143157.
Antoy, S. 1997. Optimal non-deterministic functional logic computations. In Proc. of 6th Int'l Conf. on Algebraic and Logic Programming (ALP'97), LNCS, vol. 1298. Springer, Southampton, UK, 1630.
Antoy, S., Echahed, R. and Hanus, M. 2000. A needed narrowing strategy. Journal of the ACM 47, 4, 776822.
Antoy, S. and Hanus, M. 2005. Declarative programming with function patterns. In Proceedings of the International Symposium on Logic-based Program Synthesis and Transformation (LOPSTR'05), Springer LNCS, Berlin Heidelberg, vol. 3901, 622.
Antoy, S. and Hanus, M. 2006. Overlapping rules and logic variables in functional logic programs. In Proc. of the 22nd International Conference on Logic Programming (ICLP 2006). Springer LNCS, Berlin Heidelberg, vol. 4079, 87101.
Antoy, S. and Hanus, M. 2009. Set functions for functional logic programming. In Proc. of the 11th ACM SIGPLAN International Conference on Principles and Practice of Declarative Programming (PPDP'09), ACM Press, 7382.
Antoy, S. and Hanus, M. 2010. Functional logic programming. Communications of the ACM 53, 4, 7485.
Antoy, S. and Hanus, M. 2014. Curry without success. In Proc. of the 23rd International Workshop on Functional and (Constraint) Logic Programming (WFLP 2014). CEUR Workshop Proceedings, Aachen, vol. 1335., 140–154.
Antoy, S. and Middeldorp, A. 1996. A sequential strategy. Theoretical Computer Science 165, 7595.
Berry, G. 1976. Bottom-up computation of recursive programs. Informatique Théorique et Applications, vol. 10, 4782.
Brassel, B., Hanus, M. and Huch, F. 2004. Encapsulating non-determinism in functional logic computations. Journal of Functional and Logic Programming 2004, 6.
Brassel, B., Hanus, M., Peemöller, B. and Reck, F. 2011. KiCS2: A new compiler from Curry to Haskell. In Proc. of the 20th International Workshop on Functional and (Constraint) Logic Programming (WFLP 2011), Springer LNCS, Berlin Heidelberg, vol. 6816, 118.
Christiansen, J., Hanus, M., Reck, F. and Seidel, D. 2013. A semantics for weakly encapsulated search in functional logic programs. In Proc. of the 15th International Symposium on Principle and Practice of Declarative Programming (PPDP'13), ACM Press, New York, 4960.
Deransart, P., Ed-Dbali, A. and Cervoni, L. 1996. Prolog - The Standard: Reference Manual. Springer, Berlin Heidelberg.
González-Moreno, J., Hortalá-González, M., López-Fraguas, F. and Rodríguez-Artalejo, M. 1999. An approach to declarative programming based on a rewriting logic. Journal of Logic Programming 40, 4787.
Hanus, M. 2011. Declarative processing of semistructured web data. In Technical Communications of the 27th International Conference on Logic Programming, Leibniz International Proceedings in Informatics (LIPIcs), Schloss Dagstuhl - Leibniz-Zentrum für Informatik, Dagstuhl (Germany) vol. 11, 198208.
Hanus, M. 2013. Functional logic programming: From theory to Curry. In Programming Logics - Essays in Memory of Harald Ganzinger., Springer LNCS, Berlin Heidelberg, vol. 7797, 123168.
Hanus, M. Ed. 2016. Curry: An integrated functional logic language (vers. 0.9.0). Available at
Hanus, M., Antoy, S., Brassel, B., Engelke, M., Höppner, K., Koj, J., Niederau, P., Sadre, R. and Steiner, F. 2016. PAKCS: The Portland Aachen Kiel Curry System. Available at
López-Fraguas, F. and Sánchez-Hernández, J. 2004. A proof theoretic approach to failure in functional logic programming. Theory and Practice of Logic Programming 4, 1, 4174.
Moreno-Navarro, J. 1994. Default rules: An extension of constructive negation for narrowing-based languages. In Proc. 11th International Conference on Logic Programming, MIT Press, Cambridge (USA) 535549.
O'Donnell, M. J. 1977. Computing in Systems Described by Equations, LNCS, vol. 58, Springer, Berlin Heidelberg.
Peyton, Jones, S. Ed. 2003. Haskell 98 Language and Libraries—The Revised Report. Cambridge University Press, Cambridge.
Reddy, U. 1985. Narrowing as the operational semantics of functional languages. In Proc. IEEE Internat. Symposium on Logic Programming, IEEE-CS, Boston, 138151.
Sánchez-Hernández, J. 2006. Constructive failure in functional-logic programming: From theory to implementation. Journal of Universal Computer Science 12, 11, 15741593.
Slagle, J. 1974. Automated theorem-proving for theories with simplifiers, commutativity, and associativity. Journal of the ACM 21, 4, 622642.
Recommend this journal

Email your librarian or administrator to recommend adding this journal to your organisation's collection.

Theory and Practice of Logic Programming
  • ISSN: 1471-0684
  • EISSN: 1475-3081
  • URL: /core/journals/theory-and-practice-of-logic-programming
Please enter your name
Please enter a valid email address
Who would you like to send this to? *



Full text views

Total number of HTML views: 0
Total number of PDF views: 0 *
Loading metrics...

Abstract views

Total abstract views: 0 *
Loading metrics...

* Views captured on Cambridge Core between <date>. This data will be updated every 24 hours.

Usage data cannot currently be displayed