Advertisement

Formal Verification of the Correspondence Between Call-by-Need and Call-by-Name

Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 10818)

Abstract

We formalize the call-by-need evaluation of \(\lambda \)-calculus (with no recursive bindings) and prove its correspondence with call-by-name, using the Coq proof assistant.

It has been long argued that there is a gap between the high-level abstraction of non-strict languages—namely, call-by-name evaluation—and their actual call-by-need implementations. Although a number of proofs have been given to bridge this gap, they are not necessarily suitable for stringent, mechanized verification because of the use of a global heap, “graph-based” techniques, or “marked reduction”. Our technical contributions are twofold: (1) we give a simpler proof based on two forms of standardization, adopting de Bruijn indices for representation of (non-recursive) variable bindings along with Ariola and Felleisen’s small-step semantics, and (2) we devise a technique to significantly simplify the formalization by eliminating the notion of evaluation contexts—which have been considered essential for the call-by-need calculus—from the definitions.

Notes

Acknowledgments

We thank the anonymous reviewers for valuable comments and suggestions. This work was partially supported by JSPS KAKENHI Grant Number 15H02681 and 16K12409.

References

  1. 1.
    Abramsky, S.: The lazy lambda calculus. In: Turner, D.A. (ed.) Research Topics in Functional Programming, pp. 65–116. Addison-Wesley Publishing Co., Boston (1990)Google Scholar
  2. 2.
    Accattoli, B., Barenbaum, P., Mazza, D.: Distilling abstract machines. In: Jeuring, J., Chakravarty, M.M.T. (eds.) Proceedings of the 19th ACM SIGPLAN International Conference on Functional Programming, Gothenburg, Sweden, 1–3 September 2014, pp. 363–376. ACM (2014)Google Scholar
  3. 3.
    Ariola, Z.M., Blom, S.: Cyclic lambda calculi. In: Abadi, M., Ito, T. (eds.) TACS 1997. LNCS, vol. 1281, pp. 77–106. Springer, Heidelberg (1997).  https://doi.org/10.1007/BFb0014548CrossRefGoogle Scholar
  4. 4.
    Ariola, Z.M., Felleisen, M.: The call-by-need lambda calculus. J. Funct. Program. 7(3), 265–301 (1997)MathSciNetCrossRefGoogle Scholar
  5. 5.
    Barendregt, H.P.: The Lambda Calculus: Its Syntax and Semantics. Studies in Logic and the Foundations of Mathematics, vol. 103, Revised edn. North-Holland, New York (1984)MATHGoogle Scholar
  6. 6.
    Breitner, J.: The adequacy of Launchbury’s natural semantics for lazy evaluation. J. Funct. Program. 28, e1 (2018)MathSciNetCrossRefGoogle Scholar
  7. 7.
    Chang, S., Felleisen, M.: The call-by-need lambda calculus, revisited. In: Seidl, H. (ed.) ESOP 2012. LNCS, vol. 7211, pp. 128–147. Springer, Heidelberg (2012).  https://doi.org/10.1007/978-3-642-28869-2_7CrossRefGoogle Scholar
  8. 8.
    Chlipala, A.: Parametric higher-order abstract syntax for mechanized semantics. In: Hook, J., Thiemann, P. (eds.) Proceeding of the 13th ACM SIGPLAN International Conference on Functional Programming, ICFP 2008, Victoria, BC, Canada, 20–28 September 2008, pp. 143–156. ACM (2008)Google Scholar
  9. 9.
    Crégut, P.: Omega: a solver of quantifier-free problems in Presburger arithmetic. In: The Coq Proof Assistant Reference Manual, Version 8.7.0 (2017)Google Scholar
  10. 10.
    de Bruijn, N.G.: Lambda calculus notation with nameless dummies, a tool for automatic formula manipulation, with application to the Church-Rosser theorem. Indagation. Math. (Proc.) 75(5), 381–392 (1972)MathSciNetCrossRefGoogle Scholar
  11. 11.
    Fairbairn, J., Wray, S.: Tim: a simple, lazy abstract machine to execute supercombinators. In: Kahn, G. (ed.) FPCA 1987. LNCS, vol. 274, pp. 34–45. Springer, Heidelberg (1987).  https://doi.org/10.1007/3-540-18317-5_3CrossRefGoogle Scholar
  12. 12.
    Goldfarb, W.D.: The undecidability of the second-order unification problem. Theor. Comput. Sci. 13, 225–230 (1981)MathSciNetCrossRefGoogle Scholar
  13. 13.
    Gordon, A.D.: A mechanisation of name-carrying syntax up to alpha-conversion. In: Joyce, J.J., Seger, C.-J.H. (eds.) HUG 1993. LNCS, vol. 780, pp. 413–425. Springer, Heidelberg (1994).  https://doi.org/10.1007/3-540-57826-9_152CrossRefGoogle Scholar
  14. 14.
    Johnsson, T.: Efficient compilation of lazy evaluation. In: Deusen, M.S.V., Graham, S.L. (eds.) Proceedings of the 1984 SIGPLAN Symposium on Compiler Construction, Montreal, Canada, 17–22 June 1984, pp. 58–69. ACM (1984)Google Scholar
  15. 15.
    Kesner, D.: Reasoning about call-by-need by means of types. In: Jacobs, B., Löding, C. (eds.) FoSSaCS 2016. LNCS, vol. 9634, pp. 424–441. Springer, Heidelberg (2016).  https://doi.org/10.1007/978-3-662-49630-5_25CrossRefMATHGoogle Scholar
  16. 16.
    Launchbury, J.: A natural semantics for lazy evaluation. In: Deusen, M.S.V., Lang, B. (eds.) Conference Record of the Twentieth Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, Charleston, South Carolina, USA, January 1993, pp. 144–154. ACM Press (1993)Google Scholar
  17. 17.
    Maraist, J., Odersky, M., Wadler, P.: The call-by-need lambda calculus. J. Funct. Program. 8(3), 275–317 (1998)MathSciNetCrossRefGoogle Scholar
  18. 18.
    McBride, C., McKinna, J.: Functional pearl: I am not a number-I am a free variable. In: Nilsson, H. (ed.) Proceedings of the ACM SIGPLAN Workshop on Haskell, Haskell 2004, Snowbird, UT, USA, 22–22 September 2004, pp. 1–9. ACM (2004)Google Scholar
  19. 19.
    McKinna, J., Pollack, R.: Some lambda calculus and type theory formalized. J. Autom. Reason. 23(3–4), 373–409 (1999)MathSciNetCrossRefGoogle Scholar
  20. 20.
    Ong, C.L.: Fully abstract models of the lazy lambda calculus. In: 29th Annual Symposium on Foundations of Computer Science, White Plains, New York, USA, 24–26 October 1988, pp. 368–376. IEEE Computer Society (1988)Google Scholar
  21. 21.
    Peyton Jones, S.L.: Implementing lazy functional languages on stock hardware: the spineless tagless G-machine. J. Funct. Program. 2(2), 127–202 (1992)CrossRefGoogle Scholar
  22. 22.
    Pfenning, F., Elliott, C.: Higher-order abstract syntax. In: Wexelblat, R.L. (ed.) Proceedings of the ACM SIGPLAN 1988 Conference on Programming Language Design and Implementation (PLDI), Atlanta, Georgia, USA, 22–24 June 1988, pp. 199–208. ACM (1988)Google Scholar
  23. 23.
    Schäfer, S., Tebbi, T., Smolka, G.: Autosubst: reasoning with de Bruijn terms and parallel substitutions. In: Urban, C., Zhang, X. (eds.) ITP 2015. LNCS, vol. 9236, pp. 359–374. Springer, Cham (2015).  https://doi.org/10.1007/978-3-319-22102-1_24CrossRefGoogle Scholar
  24. 24.
    Sestoft, P.: Deriving a lazy abstract machine. J. Funct. Program. 7(3), 231–264 (1997)MathSciNetCrossRefGoogle Scholar
  25. 25.
    Urban, C.: Nominal techniques in Isabelle/HOL. J. Autom. Reason. 40(4), 327–356 (2008)MathSciNetCrossRefGoogle Scholar
  26. 26.
    Vassena, M., Breitner, J., Russo, A.: Securing concurrent lazy programs against information leakage. In: 30th IEEE Computer Security Foundations Symposium, CSF 2017, Santa Barbara, CA, USA, 21–25 August 2017, pp. 37–52 (2017)Google Scholar
  27. 27.
    Wadsworth, C.P.: Semantics and pragmatics of the lambda calculus. Ph.D. thesis, Oxford University (1971)Google Scholar

Copyright information

© Springer International Publishing AG, part of Springer Nature 2018

Authors and Affiliations

  1. 1.Tohoku UniversitySendaiJapan

Personalised recommendations