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 uses of functions. We discuss the basic concept and sketch an initial implementation of it which exploits advanced features of functional logic languages.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Notes
- 1.
Note that Curry requires the explicit declaration of free variables, as x in the rule of dup, to ensure checkable redundancy.
- 2.
We consider only conditional rules since an unconditional rule can be regarded as a conditional rule with condition True.
References
Antoy, S.: Definitional trees. In: Kirchner, H., Levi, G. (eds.) ALP 1992. LNCS, vol. 632, pp. 143–157. Springer, Heidelberg (1992)
Antoy, S.: Optimal non-deterministic functional logic computations. In: Hanus, M., Heering, J., Meinke, K. (eds.) ALP/HOA 1997. LNCS, vol. 1298, pp. 16–30. Springer, Heidelberg (1997)
Antoy, S., Echahed, R., Hanus, M.: A needed narrowing strategy. J. ACM 47(4), 776–822 (2000)
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)
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)
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)
Antoy, S., Hanus, M.: Functional logic programming. Commun. ACM 53(4), 74–85 (2010)
Antoy, S., Hanus, M.: Curry without success. In: Proceedings of the 23rd International Workshop on Functional and (Constraint) Logic Programming (WFLP 2014). CEUR Workshop Proceedings, vol. 1335, pp. 140–154. CEUR-WS.org (2014)
Braßel, B., Hanus, M., Huch, F.: Encapsulating non-determinism in functional logic computations. J. Funct. Logic Program. 2004(6) (2004)
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)
Christiansen, J., Hanus, M., Reck, F., Seidel, D.: A semantics for weakly encapsulated search in functional logic programs. In: Proceedings of the 15th International Symposium on Principle and Practice of Declarative Programming (PPDP 2013), pp. 49–60. ACM Press (2013)
Deransart, P., Ed-Dbali, A., Cervoni, L.: Prolog - The Standard: Reference Manual. Springer, Heidelberg (1996)
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. J. Logic Program. 40, 47–87 (1999)
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)
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)
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 (2015). http://www.informatik.uni-kiel.de/~pakcs/
Hanus, M. (ed.): Curry: An integrated functional logic language (vers. 0.8.3) (2012). http://www.curry-language.org
Krauss, A.: Pattern minimization problems over recursive data types. In: Proceedings of the 13th ACM SIGPLAN International Conference on Functional Programming (ICFP 2008), pp. 267–274. ACM Press (2008)
López-Fraguas, F.J., Sánchez-Hernández, J.: A proof theoretic approach to failure in functional logic programming. Theory Pract. Logic Program. 4(1), 41–74 (2004)
Moreno-Navarro, J.J.: Default rules: an extension of constructive negation for narrowing-based languages. In: Proceedings of Eleventh International Conference on Logic Programming, pp. 535–549. MIT Press (1994)
Peyton Jones, S. (ed.): Haskell 98 Language and Libraries—The Revised Report. Cambridge University Press, Cambridge (2003)
Reddy, U.S.: Narrowing as the operational semantics of functional languages. In: Proceedings of IEEE International Symposium on Logic Programming, Boston, pp. 138–151 (1985)
Sánchez-Hernández, J.: Constructive failure in functional-logic programming: from theory to implementation. J. Univ. Comput. Sci. 12(11), 1574–1593 (2006)
Slagle, J.R.: Automated theorem-proving for theories with simplifiers, commutativity, and associativity. J. ACM 21(4), 622–642 (1974)
Acknowledgements
The authors are grateful to Sandra Dylus for her suggestions to improve this paper. This material is based in part upon work supported by the National Science Foundation under Grant No. 1317249.
Author information
Authors and Affiliations
Corresponding author
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2016 Springer International Publishing Switzerland
About this paper
Cite this paper
Antoy, S., Hanus, M. (2016). Default Rules for Curry. In: Gavanelli, M., Reppy, J. (eds) Practical Aspects of Declarative Languages. PADL 2016. Lecture Notes in Computer Science(), vol 9585. Springer, Cham. https://doi.org/10.1007/978-3-319-28228-2_5
Download citation
DOI: https://doi.org/10.1007/978-3-319-28228-2_5
Published:
Publisher Name: Springer, Cham
Print ISBN: 978-3-319-28227-5
Online ISBN: 978-3-319-28228-2
eBook Packages: Computer ScienceComputer Science (R0)