Skip to main content

A Natural Counting of Lambda Terms

  • Conference paper
  • First Online:
SOFSEM 2016: Theory and Practice of Computer Science (SOFSEM 2016)

Part of the book series: Lecture Notes in Computer Science ((LNTCS,volume 9587))

Abstract

We study the sequence of numbers corresponding to \(\lambda \)-terms of given size in the model based on de Bruijn indices. It turns out that the sequence enumerates also two families of binary trees, i.e. black-white and zigzag-free ones. We provide a constructive proof of this fact by exhibiting appropriate bijections. Moreover, we investigate the asymptotic density of \(\lambda \)-terms containing an arbitrary fixed subterm, showing that strongly normalizing terms are of density 0 among all \(\lambda \)-terms.

This work was partially supported by the grant 2013/11/B/ST6/00975 founded by the Polish National Science Center.

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 EPUB and 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

Notes

  1. 1.

    We write this function \(A_1\) as a reference to the function A(x, 1) described in A105632 of the Online Encyclopedia of Integer Sequences [2].

References

  1. Bendkowski, M.: Natural counting of lambda terms - Haskell implementations (2015). https://github.com/maciej-bendkowski/natural-counting-of-lambda-terms

  2. Online Encyclopedia of Integer Sequences. http://oeis.org/

  3. Bacher, A., Bodini, O., Jacquot, A.: Exact-size sampling for Motzkin trees in linear time via Boltzmann samplers and Holonomic specification. In: Proceedings of the Meeting on Analytic Algorithmics and Combinatorics, pp. 52–61. SIAM (2013)

    Google Scholar 

  4. Bodini, O., Gardy, D., Gittenberger, B.: Lambda terms of bounded unary height. In: Proceedings of the Eighth Workshop on Analytic Algorithmics and Combinatorics, pp. 23–32 (2011). http://www.siam.org/proceedings/analco/2011/anl11_03_bodinio.pdf

  5. Claessen, K., Hughes, J.: QuickCheck: a lightweight tool for random testing of Haskell programs. In: Proceedings of the Fifth ACM SIGPLAN International Conference on Functional Programming, ICFP 2000, pp. 268–279. ACM, New York (2000)

    Google Scholar 

  6. David, R., Grygiel, K., Kozik, J., Raffalli, Ch., Theyssier, G., Zaionc, M.: Asymptotically almost all \(\lambda \)-terms are strongly normalizing. Logical Methods Comput. Sci. 9, 1–30 (2013)

    Google Scholar 

  7. Flajolet, P., Sedgewick, R.: Analytic Combinatorics. Cambridge University Press, New York (2009). ISBN:0521898064, 9780521898065

    Google Scholar 

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

    Article  MATH  MathSciNet  Google Scholar 

  9. Grygiel, K., Lescanne, P.: Counting terms in the binary lambda calculus. In: Proceedings of the 25th International Conference on Probabilistic, Combinatorial and Asymptotic Methods for the Analysis of Algorithms (2014). https://hal.inria.fr/hal-01077251

  10. Gu, N.S.S., Li, N.Y., Mansour, T.: 2-Binary trees: bijections and related issues. Discrete Math. 308(7), 1209–1221 (2008). http://dx.doi.org/10.1016/j.disc.2007.04.007

    Google Scholar 

  11. Salvy, B., Zimmermann, P.: Gfun: a Maple package for the manipulation of generating and holonomic functions in one variable. ACM Trans. Math. Softw. 2, 163–177 (1994). http://dx.doi.org/10.1145/178365.178368

    Google Scholar 

  12. Sapounakis, A., Tasoulas, I., Tsikouras, P.: Ordered trees and the inorder traversal. Discrete Math. 306(15), 1732–1741 (2006). http://dx.doi.org/10.1016/j.disc.2006.03.044

    Google Scholar 

  13. Tromp, J.: Binary lambda calculus and combinatory logic. In: Kolmogorov Complexity and Applications (2006)

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Maciej Bendkowski .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2016 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Bendkowski, M., Grygiel, K., Lescanne, P., Zaionc, M. (2016). A Natural Counting of Lambda Terms. In: Freivalds, R., Engels, G., Catania, B. (eds) SOFSEM 2016: Theory and Practice of Computer Science. SOFSEM 2016. Lecture Notes in Computer Science(), vol 9587. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-662-49192-8_15

Download citation

  • DOI: https://doi.org/10.1007/978-3-662-49192-8_15

  • Published:

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-662-49191-1

  • Online ISBN: 978-3-662-49192-8

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics