Hostname: page-component-84b7d79bbc-g5fl4 Total loading time: 0 Render date: 2024-08-04T13:19:47.873Z Has data issue: false hasContentIssue false

Default rules for Curry*

Published online by Cambridge University Press:  01 July 2016

SERGIO ANTOY
Affiliation:
Computer Science Dept., Portland State University, Oregon, USA (e-mail: antoy@cs.pdx.edu)
MICHAEL HANUS
Affiliation:
Computer Science Dept., Portland State University, Oregon, USA (e-mail: antoy@cs.pdx.edu)

Abstract

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.

Type
Regular Papers
Copyright
Copyright © Cambridge University Press 2016 

Access options

Get access to the full version of this content by using one of the access options below. (Log in options will check for institutional or personal access. Content may require purchase if you do not have access.)

Footnotes

*

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.

References

Antoy, S. 1992. Definitional trees. In Proc. of the 3rd International Conference on Algebraic and Logic Programming, Springer LNCS, Berlin Heidelberg, vol. 632, 143157.Google Scholar
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.Google Scholar
Antoy, S., Echahed, R. and Hanus, M. 2000. A needed narrowing strategy. Journal of the ACM 47, 4, 776822.Google Scholar
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.Google Scholar
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.Google Scholar
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.Google Scholar
Antoy, S. and Hanus, M. 2010. Functional logic programming. Communications of the ACM 53, 4, 7485.CrossRefGoogle Scholar
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. CEUR-WS.org, 140–154.Google Scholar
Antoy, S. and Middeldorp, A. 1996. A sequential strategy. Theoretical Computer Science 165, 7595.Google Scholar
Berry, G. 1976. Bottom-up computation of recursive programs. Informatique Théorique et Applications, vol. 10, 4782.Google Scholar
Brassel, B., Hanus, M. and Huch, F. 2004. Encapsulating non-determinism in functional logic computations. Journal of Functional and Logic Programming 2004, 6.Google Scholar
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.Google Scholar
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.Google Scholar
Deransart, P., Ed-Dbali, A. and Cervoni, L. 1996. Prolog - The Standard: Reference Manual. Springer, Berlin Heidelberg.Google Scholar
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.CrossRefGoogle Scholar
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.Google Scholar
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.Google Scholar
Hanus, M. Ed. 2016. Curry: An integrated functional logic language (vers. 0.9.0). Available at http://www.curry-language.org.Google Scholar
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 http://www.informatik.uni-kiel.de/~pakcs/.Google Scholar
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.Google Scholar
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.Google Scholar
O'Donnell, M. J. 1977. Computing in Systems Described by Equations, LNCS, vol. 58, Springer, Berlin Heidelberg.Google Scholar
Peyton, Jones, S. Ed. 2003. Haskell 98 Language and Libraries—The Revised Report. Cambridge University Press, Cambridge.Google Scholar
Reddy, U. 1985. Narrowing as the operational semantics of functional languages. In Proc. IEEE Internat. Symposium on Logic Programming, IEEE-CS, Boston, 138151.Google Scholar
Sánchez-Hernández, J. 2006. Constructive failure in functional-logic programming: From theory to implementation. Journal of Universal Computer Science 12, 11, 15741593.Google Scholar
Slagle, J. 1974. Automated theorem-proving for theories with simplifiers, commutativity, and associativity. Journal of the ACM 21, 4, 622642.Google Scholar