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
Tax calculation will be finalised at checkout
Purchases are for personal use only
Learn about institutional subscriptionsReferences
Ackermann, W.F.: Die Widerspruchsfreiheit der allgemeinen Mengenlhere. Mathematische Annalen 114, 305–315 (1937)
Barendregt, H.P.: The Lambda Calculus Its Syntax and Semantics, vol. 103, 2, revised edn. Elsevier, North Holland (1984)
Bodini, O., Gardy, D., Gittenberger, B.: Lambda-terms of bounded unary height. In: ANALCO, pp. 23–32. SIAM (2011)
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)
Cegielski, P., Richard, D.: On arithmetical first-order theories allowing encoding and decoding of lists. Theor. Comput. Sci. 222(1–2), 55–75 (1999)
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
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)
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)
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)
Grygiel, K., Idziak, P.M., Zaionc, M.: How big is BCI fragment of BCK logic. J. Log. Comput. 23(3), 673–691 (2013)
Grygiel, K., Lescanne, P.: Counting and generating lambda terms. J. Funct. Program. 23(5), 594–628 (2013)
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)
Kamareddine, F.: Reviewing the classical and the de Bruijn notation for calculus and pure type systems. J. Logic Comput. 11(3), 363–394 (2001)
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)
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
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
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)
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)
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)
Stanley, R.P.: Enumerative Combinatorics. Wadsworth Publishing Co., Belmont (1986)
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)
Tarau, P.: A generic numbering system based on catalan families of combinatorial objects. CoRR abs/1406.1796 (2014)
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
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)
Tarau, P.: Computing with catalan families, generically. In: Gavanelli, M., Reppy, J. (eds.) PADL’16. LNCS. Springer, St. Petersburg, Florida, USA (2016)
Vytiniotis, D., Kennedy, A.: Functional pearl: every bit counts. ICFP 2010 : The 15th ACM SIGPLAN International Conference on Functional Programming, ACM Press, September 2010
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
Corresponding author
Editor information
Editors and Affiliations
Rights 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)