Abstract
Call-by-need lambda calculi with letrec provide a rewriting-based operational semantics for (lazy) call-by-name functional languages. These calculi model the sharing behavior during evaluation more closely than let-based calculi that use a fixpoint combinator. However, currently the knowledge about correctness w.r.t. observational equivalence of modifying the sharing in letrec-based calculi is full of gaps. In this paper we develop a new proof method based on a calculus on infinite trees, generalizing the parallel 1-reduction, for showing correctness of instantiation operations. We demonstrate the method in the small calculus LRλ and show that copying at compile-time can be done without restrictions. We also show that the call-by-need and call-by-name strategies are equivalent w.r.t. contextual equivalence. A consequence is correctness of all the transformations like instantiation, inlining, specialization and common subexpression elimination in LRλ. The result for LRλ also gives an answer to unresolved problems in several papers and thus contributes to the knowledge about deterministic calculi with letrec.
The method also works for a calculus with case and constructors, and also with parallel or. We are also confident that the method scales up for proving correctness of copy-related transformations in non-deterministic lambda calculi if restricted to “deterministic” subterms.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
References
Abramsky, S.: The lazy lambda calculus. In: Turner, D. (ed.) Research Topics in Functional Programming, pp. 65–116. Addison-Wesley, Reading (1990)
Ariola, Z.M., Blom, S.: Cyclic lambda calculi. In: TACS, pp. 77–106, Sendai, Japan (1997)
Ariola, Z.M., Blom, S.: Skew confluence and the lambda calculus with letrec. Annals of Pure and Applied Logic 117, 95–168 (2002)
Ariola, Z.M., Felleisen, M.: The call-by-need lambda calculus. J. functional programming 7(3), 265–301 (1997)
Ariola, Z.M., Felleisen, M., Maraist, J., Odersky, M., Wadler, P.: A call-by-need lambda calculus. In: Principles of Programming Languages, San Francisco, California, pp. 233–246. ACM Press, New York (1995)
Ariola, Z.M., Klop, J.W.: Lambda calculus with explicit recursion. Information and Computation 139(2), 154–233 (1997)
Barendregt, H.P.: The Lambda Calculus. Its Syntax and Semantics. North-Holland, Amsterdam, New York (1984)
Claessen, K., Sands, D.: Observable sharing for functional circuit description. In: Thiagarajan, P.S., Yap, R. (eds.) ASIAN 1999. LNCS, vol. 1742, pp. 62–73. Springer, Heidelberg (1999)
Dezani-Ciancaglini, M., Tiuryn, J., Urzyczyn, P.: Discrimination by parallel observers: The algorithm. Information and Computation 150(2), 153–186 (1999)
Jeffrey, A.: A fully abstract semantics for concurrent graph reduction. In: Proc. LICS, pp. 82–91 (1994)
Kennaway, R., Klop, J.W., Sleep, M.R., de Vries, F.-J.: Infinitary lambda calculus. Theor. Comput. Sci. 175(1), 93–125 (1997)
Launchbury, J.: A natural semantics for lazy evaluation. In: Proc. 20th Principles of Programming Languages (1993)
Machkasova, E., Turbak, F.A.: A calculus for link-time compilation. In: ESOP 2000 (2000)
Maraist, J., Odersky, M., Wadler, P.: The call-by-need lambda calculus. J. Functional programming 8, 275–317 (1998)
Moran, A.K.D.: Call-by-name, call-by-need, and McCarthys Amb. PhD thesis, Dept. of Comp. Science, Chalmers University, Sweden (1998)
Moran, A.K.D., Sands, D., Carlsson, M.: Erratic fudgets: A semantic theory for an embedded coordination language. In: Ciancarini, P., Wolf, A.L. (eds.) COORDINATION 1999. LNCS, vol. 1594, pp. 85–102. Springer, Heidelberg (1999)
Moran, A.K.D., Sands, D., Carlsson, M.: Erratic fudgets: A semantic theory for an embedded coordination language. Sci. Comput. Program. 46(1-2), 99–135 (2003)
Peyton Jones, S.: Haskell 98 Language and Libraries. Cambridge University Press, Cambridge (2003), www.haskell.org
Plasmeijer, R., van Eekelen, M.: The concurrent Clean language report: Version 1.3 and 2.0. Technical report, Dept. of Computer Science, University of Nijmegen (2003), http://www.cs.kun.nl/~clean/
Plotkin, G.D.: Call-by-name, call-by-value, and the lambda-calculus. Theoretical Computer Science 1, 125–159 (1975)
Sabel, D., Schmidt-Schauß, M.: A call-by-need lambda-calculus with locally bottom-avoiding choice: Context lemma and correctness of transformations. Frank report 24, Inst. Informatik. J.W.G.-university Frankfurt (2006)
Schmidt-Schauß, M.: Equivalence of call-by-name and call-by-need for lambda-calculi with letrec. Frank report 25, Inst. Informatik. J.W.G.-university Frankfurt (2006)
Schmidt-Schauß, M.: Correctness of copy in calculi with letrec, case and constructors. Frank report 28, Inst. Informatik. J.W.G.-University Frankfurt (2007)
Schmidt-Schauß, M., Schütz, M., Sabel, D.: A complete proof of the safety of Nöcker’s strictness analysis. Frank report 20, Inst. Informatik. J.W.G.-University Frankfurt (2005)
Author information
Authors and Affiliations
Editor information
Rights and permissions
Copyright information
© 2007 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Schmidt-Schauß, M. (2007). Correctness of Copy in Calculi with Letrec. In: Baader, F. (eds) Term Rewriting and Applications. RTA 2007. Lecture Notes in Computer Science, vol 4533. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-540-73449-9_25
Download citation
DOI: https://doi.org/10.1007/978-3-540-73449-9_25
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-73447-5
Online ISBN: 978-3-540-73449-9
eBook Packages: Computer ScienceComputer Science (R0)