Skip to main content

Normal-order reduction grammars*


We present an algorithm which, for given n, generates an unambiguous regular tree grammar defining the set of combinatory logic terms, over the set {S, K} of primitive combinators, requiring exactly n normal-order reduction steps to normalize. As a consequence of Curry and Feys's standardization theorem, our reduction grammars form a complete syntactic characterization of normalizing combinatory logic terms. Using them, we provide a recursive method of constructing ordinary generating functions counting the number of SK-combinators reducing in n normal-order reduction steps. Finally, we investigate the size of generated grammars giving a primitive recursive upper bound.

Hide All

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

Hide All
Abramowitz, M. & Stegun, I. (1972) Handbook of Mathematical Functions, with Formulas, Graphs, and Mathematical Tables. Dover Publications.
Barendregt, H. P. (1984) The Lambda Calculus, Its Syntax and Semantics. vol. 103. North Holland.
Bendkowski, M. (2016) Normal-Order Reduction Grammars–Haskell Implementation. Available at:, Last accessed 03.01.2017.
Bendkowski, M., Grygiel, K. & Zaionc, M. (2015) Asymptotic properties of combinatory logic. In Theory and Applications of Models of Computation, Jain, R., Jain, S. & Stephan, F. (eds), Lecture Notes in Computer Science, vol. 9076. Springer International Publishing, pp. 6272.
Bendkowski, M., Grygiel, K., Lescanne, P. & Zaionc, M. (2016) A natural counting of lambda terms. In SOFSEM 2016: Theory and Practice of Computer Science, Freivalds, R. M., Engels, G. & Catania, B. (eds), Lecture Notes in Computer Science, vol. 9587. Springer International Publishing, pp. 183194.
Bernadet, A. & Lengrand, S. J. (2013) Non-idempotent intersection types and strong normalisation. Log. Methods Comput. Sci. 9 (4), 146.
Bodini, O., Gardy, D., Gittenberger, B. & Gołebiewski, Z. (2015) On the Number of Unary-Binary Tree-Like Structures with Restrictions on the Unary Height. arXiv:1510.01167.
Comon, H., Dauchet, M., Gilleron, R., Löding, C., Jacquemard, F., Lugiez, D., Tison, S. & Tommasi, M. (2007) Tree Automata Techniques and Applications. Available at: October, 12th 2007.
Curry, H. B. (1930) Grundlagen der kombinatorischen Logik. Am. J. Math. 52 (3), 509536.
Curry, H. B. & Feys, R. (1958) Combinatory Logic, vol. 1. Amsterdam: North Holland.
David, R., Grygiel, K., Kozik, J., Raffalli, C., Theyssier, G. & Zaionc, M. (2013) Asymptotically almost all λ-terms are strongly normalizing. Log. Methods Comput. Sci. 9 (1), 130.
Duchon, P., Flajolet, P., Louchard, G., & Schaeffer, G. (2004) Boltzmann samplers for the random generation of combinatorial structures. Comb. Probab. Comput. 13, 2004.
Flajolet, P. & Sedgewick, R. (2009) Analytic Combinatorics, 1 edn. New York, NY, USA: Cambridge University Press.
Gittenberger, B. & Gołebiewski, Z. (2016) On the number of lambda terms with prescribed size of their De Bruijn representation. In Proceedings of 33rd Symposium on Theoretical Aspects of Computer Science, STACS 2016, February 17–20, 2016, Orléans, France, Ollinger, N. & Vollmer, H. (eds), LIPIcs, vol. 47. Schloss Dagstuhl - Leibniz-Zentrum für Informatik, pp. 40:140:13.
Grygiel, K. & Lescanne, P. (2013) Counting and generating lambda terms. J. Funct. Program. 23 (5), 594628.
Grygiel, K. & Lescanne, P. (2015) Counting and generating terms in the binary lambda calculus. J. Funct. Program. 25, e24 (25 pages).
Pałka, M., Claessen, K., Russo, A. & Hughes, J. (2011) Testing an optimising compiler by generating random lambda terms. In Proceedings of the 6th International Workshop on Automation of Software Test, AST 2011, Waikiki, Honolulu, HI, USA, May 23–24, 2011, Bertolino, A., Foster, H. & Li, J. (eds). ACM.
Schönfinkel, M. (1924) Über die Bausteine der mathematischen Logik. Math. Ann. 92 (3), 305316.
Turner, D. (1979) A new implementation technique for applicative languages. Softw.: Pract. Exp. 9 (1), 3149.
Turner, D. (1986) An overview of Miranda. SIGPLAN Not. 21 (12), 158166.
Wolfram Research, Inc. (2015) Mathematica Version 10.3. Champaign, Illinois.
Recommend this journal

Email your librarian or administrator to recommend adding this journal to your organisation's collection.

Journal of Functional Programming
  • ISSN: 0956-7968
  • EISSN: 1469-7653
  • URL: /core/journals/journal-of-functional-programming
Please enter your name
Please enter a valid email address
Who would you like to send this to? *


Full text views

Total number of HTML views: 1
Total number of PDF views: 59 *
Loading metrics...

Abstract views

Total abstract views: 315 *
Loading metrics...

* Views captured on Cambridge Core between 17th January 2017 - 22nd June 2018. This data will be updated every 24 hours.

Normal-order reduction grammars*

Submit a response


No Discussions have been published for this article.


Reply to: Submit a response

Your details

Conflicting interests

Do you have any conflicting interests? *