Skip to main content

On k-colored Lambda Terms and Their Skeletons

  • Conference paper
  • First Online:
Practical Aspects of Declarative Languages (PADL 2018)

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

Included in the following conference series:

Abstract

The paper describes an application of logic programming to the modeling of difficult combinatorial properties of lambda terms, with focus on the class of simply typed terms.

Lambda terms in de Bruijn notation are Motzkin trees (also called binary-unary trees) with indices at their leaves counting up on the path to the root the steps to their lambda binder.

As a generalization of affine lambda terms, we introduce k-colored lambda terms obtained by labeling their lambda nodes with counts of the variables they bind. We define the skeleton of a k-colored lambda term as the Motzkin tree obtained by erasing the de Bruijn indices labeling its leaves. A new bijection between 2-colored skeletons and binary trees reveals their connection to the Catalan family of combinatorial objects.

After a statistical study of properties of k-colored lambda terms and their skeletons, we focus on the case of simply-typed closed k-colored lambda terms for which a new combinatorial generation algorithm is given and some interesting relations between maximal coloring, size of type expressions and typability are explored.

The paper is structured as a literate Prolog program to facilitate an easily replicable, concise and declarative expression of our concepts and algorithms.

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 44.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 60.00
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.

    Functional programmers might notice here the analogy with the use of monads encapsulating state changes with constructs like Haskell’s do notation.

References

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

  2. Kostrzycka, Z., Zaionc, M.: Asymptotic densities in logic and type theory. Stud. Logica. 88(3), 385–403 (2008)

    Article  MathSciNet  MATH  Google Scholar 

  3. Tarau, P.: A hiking trip through the orders of magnitude: deriving efficient generators for closed simply-typed lambda terms and normal forms. In: Hermenegildo, M.V., Lopez-Garcia, P. (eds.) LOPSTR 2016. LNCS, vol. 10184, pp. 240–255. Springer, Cham (2017). https://doi.org/10.1007/978-3-319-63139-4_14. Best paper award

    Chapter  Google Scholar 

  4. Bendkowski, M., Grygiel, K., Tarau, P.: Boltzmann samplers for closed simply-typed lambda terms. In: Lierler, Y., Taha, W. (eds.) PADL 2017. LNCS, vol. 10137, pp. 120–135. Springer, Cham (2017). https://doi.org/10.1007/978-3-319-51676-9_8

    Chapter  Google Scholar 

  5. Wielemaker, J., Schrijvers, T., Triska, M., Lager, T.: SWI-Prolog. Program. Theor. Pract. Logic 12, 67–96 (2012)

    Article  MathSciNet  MATH  Google Scholar 

  6. Deutsch, E., Shapiro, L.W.: A bijection between ordered trees and 2-motzkin paths and its many consequences. Discrete Math. 256(3), 655–670 (2002)

    Article  MathSciNet  MATH  Google Scholar 

  7. Rémy, J.L.: Un procédé itératif de dénombrement d’arbres binaires et son application à leur génération aléatoire. RAIRO - Theor. Inf. Appl. Informatique Théorique et Applications 19(2), 179–195 (1985)

    Article  MATH  Google Scholar 

  8. 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, July 2015

    Google Scholar 

  9. Lescanne, P.: Quantitative aspects of linear and affine closed lambda terms. CoRR abs/1702.03085 (2017)

    Google Scholar 

  10. Bodini, O., Tarau, P.: On Uniquely Closable and Uniquely Typable Skeletons of Lambda Terms. CoRR abs/1709.04302, September 2017

    Google Scholar 

  11. Tarau, P.: On logic programming representations of lambda terms: de bruijn indices, compression, type inference, combinatorial generation, normalization. In: Pontelli, E., Son, T.C. (eds.) PADL 2015. LNCS, vol. 9131, pp. 115–131. Springer, Cham (2015). https://doi.org/10.1007/978-3-319-19686-2_9

    Chapter  Google Scholar 

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

    MATH  Google Scholar 

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

    Google Scholar 

  14. Lescanne, P.: On counting untyped lambda terms. Theoret. Comput. Sci. 474, 80–97 (2013)

    Article  MathSciNet  MATH  Google Scholar 

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

    Article  MathSciNet  MATH  Google Scholar 

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

  17. Bodini, O., Gardy, D., Jacquot, A.: Asymptotics and random sampling for BCI and BCK lambda terms. Theoret. Comput. Sci. 502, 227–238 (2013)

    Article  MathSciNet  MATH  Google Scholar 

  18. Genitrini, A., Kozik, J., Zaionc, M.: Intuitionistic vs. classical tautologies, quantitative comparison. In: Miculan, M., Scagnetto, I., Honsell, F. (eds.) TYPES 2007. LNCS, vol. 4941, pp. 100–109. Springer, Heidelberg (2008). https://doi.org/10.1007/978-3-540-68103-8_7

    Chapter  Google Scholar 

Download references

Acknowledgement

This research has been supported by NSF grant 1423324. We thank the reviewers of PADL’18 for their careful reading of the paper and their valuable suggestions to improve its presentation. We thank the participants of the CLA’2017 workshop (https://cla.tcs.uj.edu.pl/programme.html) for illuminating discussions and their comments on our talk covering the main ideas of this paper.

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

© 2018 Springer International Publishing AG

About this paper

Check for updates. Verify currency and authenticity via CrossMark

Cite this paper

Tarau, P. (2018). On k-colored Lambda Terms and Their Skeletons. In: Calimeri, F., Hamlen, K., Leone, N. (eds) Practical Aspects of Declarative Languages. PADL 2018. Lecture Notes in Computer Science(), vol 10702. Springer, Cham. https://doi.org/10.1007/978-3-319-73305-0_8

Download citation

  • DOI: https://doi.org/10.1007/978-3-319-73305-0_8

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-319-73304-3

  • Online ISBN: 978-3-319-73305-0

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics