ABSTRACT
The standard implementation technique for lazy functional languages is call-by-need, which ensures that an argument to a function in any given call is evaluated at most once. A significant problem with call-by-need is that it is difficult -- even for compiler writers -- to predict the effects of program transformations. The traditional theories for lazy functional languages are based on call-by-name models, and offer no help in determining which transformations do indeed optimize a program.In this article we present an operational theory for call-by-need, based upon an improvement ordering on programs: M is improved by N if in all program-contexts C, when C[M] terminates then C[N] terminates at least as cheaply.We show that this improvement relation satisfies a "context lemma", and supports a rich inequational theory, subsuming the call-by-need lambda calculi of Ariola et al. [AFM+95]. The reduction-based call-by-need calculi are inadequate as a theory of lazy-program transformation since they only permit transformations which speed up programs by at most a constant factor (a claim we substantiate); we go beyond the various reduction-based calculi for call-by-need by providing powerful proof rules for recursion, including syntactic continuity -- the basis of fixed-point-induction style reasoning, and an improvement theorem, suitable for arguing the correctness and safety of recursion-based program transformations.
- AB97.Z.M. Ariola and S. Blom, Cyclic lambda calculi, Proc. TACS'97, LNCS, vol. 1281, Springer-Verlag, February 1997, pp. 77-106. Google ScholarDigital Library
- AB98.Z.M. Ariola and S. Blom, Lambda calculi plus letrec, Tech. report, Dept. of Computer Science, University of Oregon, 1998, Extended version of {AB97}; submitted for publication.Google Scholar
- AF97.Z.M. Ariola and M. Felleisen, The call-byneed lambda calculus, Journal of Functional Programming 7 (1997), no. 3, 265-301. Google ScholarDigital Library
- AFM+95.Z. Ariola, M. Felleisen, J. Maraist, M. Odersky, and P. Wadler, A call.by.need lambda calculus, Proc. POPL'95, the 22nd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, ACM Press, January 1995, pp. 233-246. Google ScholarDigital Library
- AK97.Z.M. Ariola and J. W. Klop, Lambda calculus with explicit recursion, Information and Computation 139 (1997), no. 2, 154-233. Google ScholarDigital Library
- AO93.S. Abramsky and C.-H. L. Ong, Full abstraction in the lazy lambda calculus, Information and Computation 105 (1993), 159-267. Google ScholarDigital Library
- BLR96.Z.-E.-A. Benaissa, P. Lescanne, and K. H. Rose, Modeling sharing and recursion for weak reduction strategies using explicit substitution, Proc. PLILP'96, the 8th International Symposium on Programming Languages, Implementations, Logics, and Programs, LNCS~ vol. 1140, Springer-Verlag, 1996, pp. 393-407. Google ScholarDigital Library
- Cur91.P.-L. Curien, An abstract framework for environment machines, Theoretical Computer Science 82 (1991), no. 2, 389-402. Google ScholarDigital Library
- Fie90.J. Field, On laziness and optimality in lambda interpreters: Tools for specification and analysis, Proc. POPL'90, the 17th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, ACM Press, January 1990, pp. 1-15. Google ScholarDigital Library
- GP98.A.D. Gordon and A. M. eitts (eds.), Higher Order Operational Techniques in Semantics, Publications of the Newton institute, Cambridge University Press, 1998. Google ScholarDigital Library
- Gus98.J. Gustavsson, A type based sharing analysis for update avoidance and optimisation, Proc. ICFP'98, the 3~a ACM SIGPLAN International Conference on Functional Programming, September 1998, pp. 39-50. Google ScholarDigital Library
- HM95.J. Hughes and A. K. Moran, Making choices lazily, Proc. FPCA'95, ACM Conference on Functional Programming Languages and Computer Architecture, ACM Press, June 1995, pp. 108-119. Google ScholarDigital Library
- Jef93.A. Jeffrey, A fully abstract semantics for concurrent graph reduction, Tech. Report 93:12, School of Cognitive and Computing Sciences, University of Sussex, 1993.Google Scholar
- Jef94.A. Jeffrey, A fully abstract semantics for concurrent graph reduction, Proc. LICS'94, the 9th IEEE Symposium on Logic in Computer Science, IEEE Computer Society Press, July 1994, pp. 82-91.Google ScholarCross Ref
- Jos89.M.B. Josephs, The semantics of lazy functional languages, Theoretical Computer Science 68 (1989), no. 1, 105-111. Google ScholarDigital Library
- Las98.S.B. Lassen, Relational reasoning about func. tions and nondeterminism, Ph.D. thesis, Department of Computer Science, University of Aarhus, May 1998.Google Scholar
- Lau93.J. Launchbury, A natural semantics for lazy evaluation, Proc. POPL'93, the 20th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, ACM Press, January 1993, pp. 144-154. Google ScholarDigital Library
- Mar91.L. Maranget, Optimal derivations in weak lambda-calculi and in orthogonal term rewriting systems, Proc. POPL'91, the 18th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, ACM Press, January 1991, pp. 255-269. Google ScholarDigital Library
- MFP91.E. Meijer, M. Fokkinga, and R. Paterson, Functional programming with bananas, lenses, envelopes and barbed wire, Proc. FPCA'91, ACM Conference on Functional Programming Languages and Computer Architecture (J. Hughes, ed.), LNCS, vol. 523, Springer-Verlag, August 1991, pp. 124-144. Google ScholarDigital Library
- Mil77.R. Milner, Fully abstract models of the typed A-calculus, Theoretical Computer Science 4 (1977), 1-22.Google ScholarCross Ref
- MOW98.J. Maraist, M. Odersky, and P. Wadler, The call by need lambda calculus, Journal of Functional Programming 8 (1998), no. 3, 275-317. Google ScholarDigital Library
- MST96.I.A. Mason, S. F. Smith, and C. L. Talcott, From operational semantics to domain theory, Information and Computation 128 (1996), no. 1, 26-47. Google ScholarDigital Library
- Nie96.J. Niehren, Functional computation as concurrent computation, Proc. POPL'96, the 23~ ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, ACM Press, January 1996, pp. 333-343. Google ScholarDigital Library
- Pit97a.A. M. Pitts, Operational semantics for program equivalence, March 1997, Invited talk at MFPS XIII, the 13th Conference on Mathematical Foundations of Programming Semantics, slides available at http://www.cl.cam.ac.uk/users/ap/talks/ mfpsg7.ps.gz.Google Scholar
- Pit97b.A.M. Pitts, Operationally-based theories of program equivalence, Semantics and Logics of Computation (P. Dybjer and A. M. Pitts, eds.), Publications of the Newton Institute, Cambridge University Press, 1997, pp. 241- 298.Google Scholar
- PJPS96.S. Peyton Jones, W. Partain, and A. Santos, Let-floating: moving bindings to give .faster programs, Proc. ICFP'96, the 1~L ACM SIGPLAN International Conference on Functional Programming, ACM Press, May 1996, pp. 1-12. Google ScholarDigital Library
- PJS98.S. Peyton Jones and A. Santos, A transformation-based optimiser for Haskell, Science of Computer Programming 32 (1998), no. 1-3, 3-47. Google ScholarDigital Library
- Ros96.K.H. Rose, Operational reduction models for functional programming languages, Ph.D. thesis, DIKU, University of Copenhagen, Denmark, February 1996, available as DIKU report 96/1.Google Scholar
- San91.D. Sands, Operational theories of improvement in functional languages (extended abstract), Proc. 1991 Glasgow Functional Programming Workshop, Workshops in Computing Series, Springer-Verlag, August 1991, pp. 298-311. Google ScholarDigital Library
- San95.D. Sands, A halve time analysis and its theory of cost equivalence, Journal of Logic and Computation 5 (1995), no. 4, 495-541.Google ScholarCross Ref
- San96.D. Sands, Total correctness by local improvement in the transformation o/functional program, ACM Transactions on Programming Languages and Systems (TOPLAS) 18 (1996), no. 2, 175-234. Google ScholarDigital Library
- San97.D. Sands, From SOS rules to proof principles: An operational metatheory for .functional languages, Proc. POPL'97, the 24~h ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, ACM Press, January 1997. Google ScholarDigital Library
- San98.D. Sands, Improvement theory and its applications, In Gordon and Pitts {GP98}, pp. 275- 306. Google ScholarDigital Library
- Ses97.P. Sestoft, Deriving a lazy abstract machine, Journal of Functional Programming 7 (1997), no. 3, 231-264. Google ScholarDigital Library
- Smi91.S.F. Smith, From operational to denorational semantics, Proc. MFPS VII, the 7~u Conference on Mathematical Foundations of Programming Semantics (S. Brookes, M. Main, A. Melton, M. Mislove, and D. Schmidt, eds.), LNCS, vol. 598, Springer- Verlag, March 1991, pp. 54-76. Google ScholarDigital Library
- SPI96.J. Seaman and S. Purushothaman Iyer, An operational semantics of sharing in lazy eval' nation, Science of Computer Programming 27 (1996), no. 3, 289-322. Google ScholarDigital Library
- SPJ97.P. Sansom and S. Peyton Jones, Formallybased profiling }or higher-order functional languages, ACM Transactions on Programming Languages and Systems (TOPLAS) 19 (1997), no. 1, 334-385. Google ScholarDigital Library
- TH98.M. Tullsen and P. Hudak, An intermediate meta-language /or program transformation, YALEU/DCS/RR 1154, Yale University, June 1998.Google Scholar
- TWM95.D. N. Turner, P. Wadler, and C. Mossin, Once upon a type, Proc. FPCA'95, ACM Conference on Functional Programming Languages and Computer Architecture, ACM Press, June 1995, pp. 1-11. Google ScholarDigital Library
- Wad88.P. Wadler, The concatenate vanishes, Tech. report, University of Glasgow (UK), 1988, appeared as a note on an FP electronic mailing list, December 1987.Google Scholar
- Wad90.P. Wadler, Deforestation: Transforming programs to eliminate trees, Theoretical Computer Science 73 (1990), 231-248. Google ScholarDigital Library
- Yos93.N. Yoshida, Optimal reduction in weaklambda-calculus with shared environments, Proc. FPCA'93, ACM Conference on Functional Programming Languages and Computer Architecture, ACM Press, June 1993, pp. 243-254. Google ScholarDigital Library
Index Terms
- Improvement in a lazy context: an operational theory for call-by-need
Recommendations
Connection Tableaux with Lazy Paramodulation
It is well known that the connection refinement of clause tableaux with paramodulation is incomplete (even with weak connections). In this paper, we present a new connection tableau calculus for logic with equality. This calculus is based on a lazy form ...
Connection tableaux with lazy paramodulation
IJCAR'06: Proceedings of the Third international joint conference on Automated ReasoningIt is well-known that the connection refinement of clause tableaux with paramodulation is incomplete (even with weak connections). In this paper, we present a new connection tableau calculus for logic with equality. This calculus is based on a lazy form ...
Lazy evaluation and delimited control
POPL '09: Proceedings of the 36th annual ACM SIGPLAN-SIGACT symposium on Principles of programming languagesThe call-by-need lambda calculus provides an equational framework for reasoning syntactically about lazy evaluation. This paper examines its operational characteristics.
By a series of reasoning steps, we systematically unpack the standard-order ...
Comments