Skip to main content

A Size-Proportionate Bijective Encoding of Lambda Terms as Catalan Objects Endowed with Arithmetic Operations

  • Conference paper
  • First Online:

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

Abstract

We describe a size-proportionate bijection between lambda terms in a compressed de Bruijn notation and the Catalan family of combinatorial objects implemented as a Haskell type class, that has as instances binary trees and multiway-trees with empty leaves, as well as standard bitstring-represented natural numbers.

By building on previous work that defines arithmetic operations on instances of this family, we extend lambda calculus with efficient arithmetic operations.

At the same time, operations like normalization of lambda terms are made available to members of the Catalan family of combinatorial objects.

As a practical application to software testing we derive a mechanism for generating large random lambda terms from Rémy’s algorithm for efficient generation of random binary trees.

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

References

  1. Ackermann, W.F.: Die Widerspruchsfreiheit der allgemeinen Mengenlhere. Mathematische Annalen 114, 305–315 (1937)

    Article  MathSciNet  MATH  Google Scholar 

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

    MATH  Google Scholar 

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

    Google Scholar 

  4. de Bruijn, N.G.: 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  MathSciNet  MATH  Google Scholar 

  5. Cegielski, P., Richard, D.: On arithmetical first-order theories allowing encoding and decoding of lists. Theor. Comput. Sci. 222(1–2), 55–75 (1999)

    Article  MathSciNet  MATH  Google Scholar 

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

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

    Google Scholar 

  8. Fetscher, B., Claessen, K., Pałka, M., Hughes, J., Findler, R.B.: Making random judgments: automatically generating well-typed terms from the definition of a type-system. In: Vitek, J. (ed.) ESOP 2015. LNCS, vol. 9032, pp. 383–405. Springer, Heidelberg (2015)

    Chapter  Google Scholar 

  9. Gödel, K.: Über formal unentscheidbare Sätze der principia mathematica und verwandter systeme I. Monatshefte für Mathematik und Physik 38, 173–198 (1931)

    Article  MATH  Google Scholar 

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

    Article  MathSciNet  MATH  Google Scholar 

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

    Article  MathSciNet  MATH  Google Scholar 

  12. Hartmanis, J., Baker, T.P.: On simple Goedel numberings and translations. In: Loeckx, J. (ed.) ICALP. Lecture Notes in Computer Science, vol. 14, pp. 301–316. Springer, Berlin Heidelberg (1974)

    Google Scholar 

  13. Kamareddine, F.: Reviewing the classical and the de Bruijn notation for calculus and pure type systems. J. Logic Comput. 11(3), 363–394 (2001)

    Article  MathSciNet  MATH  Google Scholar 

  14. Knuth, D.E.: The Art of Computer Programming, Volume 4, Fascicle 4: Generating All Trees-History of Combinatorial Generation (Art of Computer Programming). Addison-Wesley Professional, Boston (2006)

    Google Scholar 

  15. Kobayashi, N., Matsuda, K., Shinohara, A.: Functional programs as compressed data. In: ACM SIGPLAN 2012 Workshop on Partial Evaluation and Program Manipulation, ACM Press, January 2012

    Google Scholar 

  16. Lisi, M.: Some remarks on the Cantor pairing function. Le Matematiche 62(1), 55–65 (2007). http://www.dmi.unict.it/ojs/index.php/lematematiche/article/view/14

    MathSciNet  MATH  Google Scholar 

  17. Palka, M.H., Claessen, K., Russo, A., Hughes, J.: Testing an optimising compiler by generating random lambda terms. In: Proceedings of the 6th International Workshop on Automation of Software Test, AST 2011, pp. 91–97. ACM, New York, NY, USA (2011)

    Google Scholar 

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

    Google Scholar 

  19. 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 

  20. Stanley, R.P.: Enumerative Combinatorics. Wadsworth Publishing Co., Belmont (1986)

    Book  MATH  Google Scholar 

  21. Tarau, P.: Compact serialization of prolog terms (with catalan skeletons, cantor tupling and gödel numberings). Theor. Pract. Logic Program. 13(4–5), 847–861 (2013)

    Article  MathSciNet  MATH  Google Scholar 

  22. Tarau, P.: A generic numbering system based on catalan families of combinatorial objects. CoRR abs/1406.1796 (2014)

  23. Tarau, P.: On a uniform representation of combinators, arithmetic, Lambda terms and types. In: Albert, E. (ed.) PPDP 2015: Proceedings of the 17th international ACM SIGPLAN Symposium on Principles and Practice of Declarative Programming, pp. 244–255. ACM, New York, NY, USA, July 2015

    Google Scholar 

  24. Tarau, P.: Ranking/unranking of Lambda terms with compressed de Bruijn Indices. In: Kerber, M., Carette, J., Kaliszyk, C., Rabe, F., Sorge, V. (eds.) CICM 2015. LNCS, vol. 9150, pp. 118–133. Springer, Heidelberg (2015)

    Chapter  Google Scholar 

  25. Tarau, P.: Computing with catalan families, generically. In: Gavanelli, M., Reppy, J. (eds.) PADL’16. LNCS. Springer, St. Petersburg, Florida, USA (2016)

    Google Scholar 

  26. Vytiniotis, D., Kennedy, A.: Functional pearl: every bit counts. ICFP 2010 : The 15th ACM SIGPLAN International Conference on Functional Programming, ACM Press, September 2010

    Google Scholar 

Download references

Acknowledgement

This research has been supported by NSF grant 1423324. We thanks the reviewers of PADL’16 for their constructive suggestions and comments.

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

© 2016 Springer International Publishing Switzerland

About this paper

Cite this paper

Tarau, P. (2016). A Size-Proportionate Bijective Encoding of Lambda Terms as Catalan Objects Endowed with Arithmetic Operations. 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_7

Download citation

  • DOI: https://doi.org/10.1007/978-3-319-28228-2_7

  • 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)

Publish with us

Policies and ethics