Skip to main content

The Head Condition and Polymorphic Recursion

  • Conference paper
  • First Online:
Functional and Logic Programming (FLOPS 2002)

Part of the book series: Lecture Notes in Computer Science ((LNCS,volume 2441))

Included in the following conference series:

  • 252 Accesses

Abstract

In typed logic programming, the head condition states that for each clause defining a predicate p, the arguments of the clause head must have the declared type of p, rather than a proper polymorphic instance. In typed functional programming, polymorphic recursion means that in a recursive definition of a function f, the recursive call to f uses a type which is a proper instance of the declared type of f. We show that both notions are also meaningful in the respectively other paradigm. We observe a symmetry between the head condition and the “monomorphic recursion condition” (meaning absence of polymorphic recursion). We discuss arguments for and against each condition in both paradigms.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 39.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. K.R. Apt. From Logic Programming to Prolog. Prentice Hall, 1997. 262, 268

    Google Scholar 

  2. A. Bossi, M. Gabbrielli, G. Levi, and M. Martelli. The s-semantics approach: theory and applications. Journal of Logic Programming, 19/20:149–197, 1994. 269, 271

    Article  MathSciNet  Google Scholar 

  3. M. Codish. Efficient goal directed bottom-up evaluation of logic programs. Journal of Logic Programming, 38(3):355–370, 1999. 271

    Article  MATH  MathSciNet  Google Scholar 

  4. P. Cousot and R. Cousot. Abstract interpretation: A unified lattice model for static analysis of programs by construction or approximation of fixpoints. In Proceedings of the 4th Symposium on Principles of Programming Languages, pages 238–252. ACM Press, 1977. 269

    Google Scholar 

  5. B. Demoen, M. García de la Banda, W. Harvey, K. Marriott, and P. Stuckey. An overview of HAL. In J. Jaffar, editor, Proc. of Principles and Practice of Constraint Programming, volume 1713 of LNCS, pages 174–188. Springer-Verlag, 1999. 259

    Google Scholar 

  6. P. Deransart and J.-G. Smaus. Subject reduction of logic programs as proof-theoretic property. Journal of Functional and Logic Programming, 2002(2), 2002. 260, 263, 267, 270, 271

    Google Scholar 

  7. C.V. Hall, K. Hammond, S.L. Peyton Jones, and P. Wadler. Type classes in Haskell. ACM Transactions on Programming Languages and Systems, 18(2):109–138, 1996. 264

    Article  Google Scholar 

  8. M. Hanus. Logic Programming with Type Specifications, chapter 3, pages 91–140. 1992. In [21]. 259, 260, 263

    Google Scholar 

  9. F. Henglein. Type inference with polymorphic recursion. ACM Transactions on Programming Languages and Systems, 15(2):253–289, 1993. 259, 260, 264, 266, 269

    Article  Google Scholar 

  10. P.M. Hill and J.W. Lloyd. The Gödel Programming Language. MIT Press, 1994. 259

    Google Scholar 

  11. P. M. Hill and R.W. Topor. A Semantics for Typed Logic Programs, chapter 1, pages 1–61. 1992. In [21]. 259, 260, 261, 263, 270, 271

    Google Scholar 

  12. S. Kahrs. Limits of ML-definability. In H. Kuchen and S.D. Swierstra, editors, Proceedings of the 8th Symposium on Programming Language Implementations and Logic Programming, volume 1140of LNCS, pages 17–31. Springer-Verlag, 1996. 259, 260, 267, 268, 271, 272

    Google Scholar 

  13. A. J. Kfoury, J. Tiuryn, and P. Urzyczyn. Type reconstruction in the presence of polymorphic recursion. ACM Transactions on Programming Languages and Systems, 15(2):290–311, 1993. Title wrongly given in table of contents: Type recursion in the presence of polymorphic recursion. 259, 260, 261, 264, 265, 266

    Article  Google Scholar 

  14. T.K. Lakshman and U. S. Reddy. Typed Prolog: A semantic reconstruction of the Mycroft-O’Keefe type system. In V. Saraswat and K. Ueda, editors, Proceedings of the 1991 International Symposium on Logic Programming, pages 202–217. MIT Press, 1991. 259, 260, 266, 267

    Google Scholar 

  15. P. Louvet and O. Ridoux. Parametric polymorphism for Typed Prolog and λProlog. In H. Kuchen and S.D. Swierstra, editors, Proceedings of the 8th Symposium on Programming Language Implementations and Logic Programming, volume 1140 of LNCS, pages 47–61. Springer-Verlag, 1996. 259, 260, 263

    Google Scholar 

  16. A. Mycroft. Polymorphic type schemes and recursive definitions. In M. Paul and B. Robinet, editors, International Symposium on Programming, volume 167 of LNCS, pages 217–228. Springer-Verlag, 1984. 260, 267

    Google Scholar 

  17. G. Nadathur and F. Pfenning. Types in Higher-Order Logic Programming, chapter 9, pages 245–283. 1992. In [21]. 260, 263

    Google Scholar 

  18. C. Okasaki. Catenable double-ended queues. In Proceedings of the International Conference on Functional Programming, volume 32(8) of SIGPLAN Notices, pages 66–74. ACM Press, 1997. 260, 267

    Article  Google Scholar 

  19. L.C. Paulson. ML for the Working Programmer. Cambridge University Press, 1996. 259

    Google Scholar 

  20. S. Peyton Jones and J. Hughes (eds.). Report on the Programming Language Haskell 98, 1999. Available via http://www.haskell.org. 264, 267

  21. F. Pfenning, editor. Types in Logic Programming. MIT Press, 1992. 273, 274

    Google Scholar 

  22. O. Ridoux and P. Boizumault. Typed static analysis: Application to the groundness analysis of Typed Prolog. Journal of Functional and Logic Programming, 2001(1), 2001. 269

    Google Scholar 

  23. J.-G. Smaus. Analysis of polymorphically typed logic programs using ACI-unification. In R. Nieuwenhuis and A. Voronkov, editors, Proceedings of the 8th International Conference on Logic for Programming, Artificial Intelligence and Reasoning, volume 2250 of LNAI, pages 280–295. Springer-Verlag, 2001. 269

    Google Scholar 

  24. Z. Somogyi, F. Henderson, and T. Conway. The execution algorithm of Mercury, an efficient purely declarative logic programming language. Journal of Logic Programming, 29(1–3):17–64, 1996. 259

    Article  MATH  Google Scholar 

  25. S. Thompson. Miranda: The Craft of Functional Programming. Addison-Wesley, 1995. 259

    Google Scholar 

  26. S. Thompson. Haskell: The Craft of Functional Programming. Addison-Wesley, 1999. Second Edition. 259

    Google Scholar 

  27. P. Wadler. Theorems for free! In Proceedings of the 4th Conference on Functional Programming Languages and Computer Architecture, pages 347–359. ACM, 1989. 263, 264, 269

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2002 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Smaus, JG. (2002). The Head Condition and Polymorphic Recursion. In: Hu, Z., Rodríguez-Artalejo, M. (eds) Functional and Logic Programming. FLOPS 2002. Lecture Notes in Computer Science, vol 2441. Springer, Berlin, Heidelberg. https://doi.org/10.1007/3-540-45788-7_16

Download citation

  • DOI: https://doi.org/10.1007/3-540-45788-7_16

  • Published:

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-540-44233-2

  • Online ISBN: 978-3-540-45788-6

  • eBook Packages: Springer Book Archive

Publish with us

Policies and ethics