Skip to main content

On Logic Programming Representations of Lambda Terms: de Bruijn Indices, Compression, Type Inference, Combinatorial Generation, Normalization

  • Conference paper
  • First Online:

Part of the book series: Lecture Notes in Computer Science ((LNPSE,volume 9131))

Abstract

We introduce a compressed de Bruijn representation of lambda terms and define its bijections to standard representations. Compact combinatorial generation algorithms are given for several families of lambda terms, including open, closed, simply typed and linear terms as well as type inference and normal order reduction algorithms. We specify our algorithms as a literate Prolog program. In the process, we rely in creative ways on unification of logic variables, cyclic terms, backtracking and definite clause grammars.

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

Buying options

Chapter
USD   29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD   34.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD   44.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

Learn about institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. Barendregt, H.P.: The Lambda Calculus Its Syntax and Semantics, Revised edn., vol. 103. North Holland (1984)

    Google Scholar 

  2. Bruijn, N.G.D.: Lambda calculus notation with nameless dummies, a tool for automatic formula manipulation, with application to the Church-Rosser Theorem. Indagationes Mathematicae 34, 381–392 (1972)

    Article  Google Scholar 

  3. Stanley, R.P.: Enumerative Combinatorics. Wadsworth Publ. Co., Belmont (1986)

    Book  MATH  Google Scholar 

  4. Barendregt, H.P.: Lambda calculi with types. In: Handbook of Logic in Computer Science, vol. 2. Oxford University Press (1991)

    Google Scholar 

  5. Sloane, N.J.A.: The On-Line Encyclopedia of Integer Sequences (2014). Published electronically at https://oeis.org/

  6. Grygiel, K., Lescanne, P.: Counting and generating lambda terms. J. Funct. Program. 23(5), 594–628 (2013)

    Article  MATH  MathSciNet  Google Scholar 

  7. Grygiel, K., Idziak, P.M., Zaionc, M.: How big is BCI fragment of BCK logic. J. Log. Comput. 23(3), 673–691 (2013)

    Article  MATH  MathSciNet  Google Scholar 

  8. Bodini, O., Gardy, D., Gittenberger, B.: Lambda-terms of bounded unary height. In: ANALCO, pp. 23–32. SIAM (2011)

    Google Scholar 

  9. Wikipedia: Binary lambda calculus – wikipedia, the free encyclopedia (2015) [Online; accessed 20-February-2015]

    Google Scholar 

  10. Pfenning, F., Elliot, C.: Higher-order abstract syntax. In: Proceedings of the ACM SIGPLAN 1988 Conference on Programming Language Design and Implementation. PLDI 1988, New York, pp. 199–208. ACM (1988)

    Google Scholar 

  11. Sestoft, P.: Demonstrating lambda calculus reduction. In: Mogensen, T.Æ., Schmidt, D.A., Sudborough, I.H. (eds.) The Essence of Computation. LNCS, vol. 2566, pp. 420–435. Springer, Heidelberg (2002)

    Chapter  Google Scholar 

  12. David, R., Grygiel, K., Kozik, J., Raffalli, C., Theyssier, G., Zaionc, M.: Asymptotically almost all \(\lambda \)-terms are strongly normalizing. Preprint: arXiv: math. LO/0903.5505 v3 (2010)

    Google Scholar 

  13. David, R., Raffalli, C., Theyssier, G., Grygiel, K., Kozik, J., Zaionc, M.: Some properties of random lambda terms. Logical Methods in Computer Science 9(1) (2009)

    Google Scholar 

  14. Kamareddine, F.: Reviewing the Classical and the de Bruijn Notation for calculus and Pure Type Systems. Journal of Logic and Computation 11(3), 363–394 (2001)

    Article  MATH  MathSciNet  Google Scholar 

  15. Miller, D.: Unification of simply typed lambda-terms as logic programming. In: Proc. Int. Conference on Logic Programming (Paris), pp. 255–269. MIT Press (1991)

    Google Scholar 

  16. Nadathur, G., Mitchell, D.J.: System description: teyjus - a compiler and abstract machine based implementation of \(\lambda \)prolog. In: Ganzinger, H. (ed.) CADE 1999. LNCS (LNAI), vol. 1632, pp. 287–291. Springer, Heidelberg (1999)

    Chapter  Google Scholar 

  17. Miller, D., Nadathur, G.: Programming with Higher-Order Logic. Cambridge University Press, New York (2012)

    Book  MATH  Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Paul Tarau .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2015 Springer International Publishing Switzerland

About this paper

Cite this paper

Tarau, P. (2015). On Logic Programming Representations of Lambda Terms: de Bruijn Indices, Compression, Type Inference, Combinatorial Generation, Normalization. In: Pontelli, E., Son, T. (eds) Practical Aspects of Declarative Languages. PADL 2015. Lecture Notes in Computer Science(), vol 9131. Springer, Cham. https://doi.org/10.1007/978-3-319-19686-2_9

Download citation

  • DOI: https://doi.org/10.1007/978-3-319-19686-2_9

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-319-19685-5

  • Online ISBN: 978-3-319-19686-2

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics