The Safe Lambda Calculus

  • William Blum
  • C. -H. Luke Ong
Part of the Lecture Notes in Computer Science book series (LNCS, volume 4583)


Safety is a syntactic condition of higher-order grammars that constrains occurrences of variables in the production rules according to their type-theoretic order. In this paper, we introduce the safe lambda calculus, which is obtained by transposing (and generalizing) the safety condition to the setting of the simply-typed lambda calculus. In contrast to the original definition of safety, our calculus does not constrain types (to be homogeneous). We show that in the safe lambda calculus, there is no need to rename bound variables when performing substitution, as variable capture is guaranteed not to happen. We also propose an adequate notion of β-reduction that preserves safety. In the same vein as Schwichtenberg’s 1976 characterization of the simply-typed lambda calculus, we show that the numeric functions representable in the safe lambda calculus are exactly the multivariate polynomials; thus conditional is not definable. Finally we give a game-semantic analysis of safety: We show that safe terms are denoted by P-incrementally justified strategies. Consequently pointers in the game semantics of safe λ-terms are only necessary from order 4 onwards.


Computation Tree Numeric Function Multivariate Polynomial Safe Term Lambda Calculus 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Abramsky, S.: Semantics via game theory. In: Marktoberdorf International Summer School, Lecture slides (2001)Google Scholar
  2. 2.
    Abramsky, S., McCusker, G.: Game semantics. In: Schwichtenberg, H., Berger, U. (eds.) Logic and Computation. Proceedings of the 1997 Marktoberdorf Summer School. LNCS, Springer, Heidelberg (1998)Google Scholar
  3. 3.
    Aehlig, K., de Miranda, J.G., Ong, C.-H.L.: Safety is not a restriction at level 2 for string languages. Technical report, University of Oxford, Oxford (2004)Google Scholar
  4. 4.
    Aho, A.V.: Indexed grammars – an extension of context-free grammars. J. ACM 15(4), 647–671 (1968)zbMATHCrossRefGoogle Scholar
  5. 5.
    Caucal, D.: On infinite terms having a decidable monadic theory. pp. 165–176 (2002)Google Scholar
  6. 6.
    Damm, W.: The IO- and OI-hierarchy. TCS 20, 95–207 (1982)zbMATHCrossRefGoogle Scholar
  7. 7.
    Damm, W., Goerdt, A.: An automata-theoretical characterization of the OI-hierarchy. Information and Control 71(1-2), 1–32 (1986)zbMATHCrossRefGoogle Scholar
  8. 8.
    de Miranda, J.G.: Structures generated by higher-order grammars and the safety constraint. Dphil thesis, University of Oxford (2006)Google Scholar
  9. 9.
    Ghica, D.R., McCusker, G.: Reasoning about idealized algol using regular languages. In: Welzl, E., Montanari, U., Rolim, J.D.P. (eds.) ICALP 2000. LNCS, vol. 1853, pp. 103–116. Springer, Heidelberg (2000)Google Scholar
  10. 10.
    Hague, M., Murawski, A.S., Ong, C.-H.L., Serre, O.: Collapsible pushdown automata and recursive schemes, p. 13, preprint (November 2006)Google Scholar
  11. 11.
    Hyland, J.M.E., Ong, C.-H.L.: On full abstraction for PCF: I, II, and III. Information and Computation 163(2), 285–408 (2000)zbMATHCrossRefGoogle Scholar
  12. 12.
    Knapik, T., Niwiński, D., Urzyczyn, P.: Higher-order pushdown trees are easy. In: Nielsen, M., Engberg, U. (eds.) ETAPS 2002 and FOSSACS 2002. LNCS, vol. 2303, pp. 205–222. Springer, Heidelberg (2002)CrossRefGoogle Scholar
  13. 13.
    Leivant, D., Marion, J.-Y.: Lambda calculus characterizations of poly-time. In: Bezem, M., Groote, J.F. (eds.) TLCA 1993. LNCS, vol. 664, pp. 274–288. Springer, Heidelberg (1993)CrossRefGoogle Scholar
  14. 14.
    Maslov, A.N.: The hierarchy of indexed languages of an arbitrary level. Soviet Math. Dokl. 15, 1170–1174 (1974)zbMATHGoogle Scholar
  15. 15.
    Maslov, A.N.: Multilevel stack automata. Problems of Information Transmission 12, 38–43 (1976)Google Scholar
  16. 16.
    Murawski, A.: On program equivalence in languages with ground-type references. In: Proceedings 18th Annual IEEE Symposium on Logic in Computer Science, June 22-25, 2003, pp. 108–117 (2003)Google Scholar
  17. 17.
    Murawski, A.S., Walukiewicz, I.: Third-order idealized algol with iteration is decidable. In: Sassone, V. (ed.) FOSSACS 2005. LNCS, vol. 3441, pp. 202–218. Springer, Heidelberg (2005)Google Scholar
  18. 18.
    Ong, C.-H.L.: An approach to deciding observational equivalence of algol-like languages. Ann. Pure Appl. Logic 130(1-3), 125–171 (2004)zbMATHCrossRefGoogle Scholar
  19. 19.
    Ong, C.-H.L.: On model-checking trees generated by higher-order recursion schemes. In: Proceedings of IEEE Symposium on Logic in Computer Science, IEEE Computer Society Press, Los Alamitos, Extended abstract (2006)Google Scholar
  20. 20.
    Reynolds, J.C.: The essence of algol. In: de Bakker, J.W., van Vliet, J.C. (eds.) Algorithmic Languages. IFIP, pp. 345–372. North-Holland, Amsterdam (1981)Google Scholar
  21. 21.
    Schwichtenberg, H.: Definierbare funktionen im lambda-kalkul mit typen. Archiv Logik Grundlagenforsch 17, 113–114 (1976)zbMATHCrossRefGoogle Scholar

Copyright information

© Springer Berlin Heidelberg 2007

Authors and Affiliations

  • William Blum
    • 1
  • C. -H. Luke Ong
    • 1
  1. 1.Oxford University Computing Laboratory, Wolfson Building, Parks Road, Oxford OX1 3QDEngland

Personalised recommendations