Sound Specialization in the Presence of Computational Effects

Moggi's computational lambda calculus λc is a well-established model of computation. We define a two-level version λc of the computational lambda calculus and demonstrate that it is an inevitable description for sound specialization. We implement the calculus in terms of a standard two-level lambda calculus via a continuation-passing style transformation. This transformation is sound and complete with respect to λc; it forms a reflection in the two-level lambda calculus of λc. As a practical ramification of this work we show that several published specialization algorithms are unsound and develop a sound specializer similar to continuation-based specializers.

[1]  Brian A. Davey,et al.  An Introduction to Lattices and Order , 1989 .

[2]  Programming Languages: Implementations, Logics and Programs , 1995, Lecture Notes in Computer Science.

[3]  P. Wadler,et al.  A Reeection on Call-by-value , 1996 .

[4]  Olivier Danvy,et al.  Continuation-based partial evaluation , 1994, LFP '94.

[5]  Flemming Nielson,et al.  Two-level functional languages , 1992, Cambridge tracts in theoretical computer science.

[6]  Anders Bondorf,et al.  Improving binding times without explicit CPS-conversion , 1992, LFP '92.

[7]  Robin Milner,et al.  Definition of standard ML , 1990 .

[8]  Olivier Danvy,et al.  Back to Direct Style , 1992, Sci. Comput. Program..

[9]  Anders Bondorf,et al.  Efficient Analysis for Realistic Off-Line Partial Evaluation , 1993, J. Funct. Program..

[10]  StatePeter Thiemann Partial Evaluation for Higher-Order Languages with , 1996 .

[11]  J. Davenport Editor , 1960 .

[12]  Olivier Danvy,et al.  A generic account of continuation-passing styles , 1994, POPL '94.

[13]  Carsten K. Gomard A self-applicable partial evaluator for the lambda calculus: correctness and pragmatics , 1992, TOPL.

[14]  Peter Sestoft,et al.  Partial evaluation and automatic program generation , 1993, Prentice Hall international series in computer science.

[15]  Philip Wadler,et al.  A reflection on call-by-value , 1997, TOPL.

[16]  Eugenio Moggi,et al.  Computational lambda-calculus and monads , 1989, [1989] Proceedings. Fourth Annual Symposium on Logic in Computer Science.

[17]  M. Felleisen,et al.  Reasoning about programs in continuation-passing style , 1993 .

[18]  Henk Barendregt,et al.  The Lambda Calculus: Its Syntax and Semantics , 1985 .

[19]  Eddy Bevers,et al.  CPS transformation after binding-time analysis , 1995 .

[20]  J. Jørgensen,et al.  Efficient Analyses for Realistic Off-Line Partial Evaluation : Extended Version , 1993 .

[21]  Anders Bondorf,et al.  A self-applicable partial evaluator for the lambda calculus , 1990, Proceedings. 1990 International Conference on Computer Languages.

[22]  Jonathan Rees,et al.  Revised3 report on the algorithmic language scheme , 1986, SIGP.

[23]  Anders Bondorf,et al.  Improving CPS-Based Partial Evaluation: Writing Cogen by Hand , 1994, PEPM.

[24]  Amr Sabry,et al.  The essence of compiling with continuations , 1993, PLDI '93.

[25]  Rowan Davies,et al.  A temporal-logic approach to binding-time analysis , 1995, Proceedings 11th Annual IEEE Symposium on Logic in Computer Science.

[26]  A. P. Ershov,et al.  A Formal Type System for Comparing Partial Evaluators , 1988 .

[27]  Robert Glück,et al.  Efficient Multi-level Generating Extensions for Program Specialization , 1995, PLILP.

[28]  Simon L. Peyton Jones,et al.  Imperative functional programming , 1993, POPL '93.

[29]  Olivier Danvy,et al.  For a Better Support of Static Data Flow , 1991, FPCA.

[30]  Frank Pfenning,et al.  A modal analysis of staged computation , 1996, POPL '96.

[31]  Anders Bondorf,et al.  Automatic Autoprojection of Recursive Equations with Global Variables and Abstract Data Types , 1991, Sci. Comput. Program..

[32]  Olivier Danvy,et al.  A computational formalization for partial evaluation , 1996, Mathematical Structures in Computer Science.

[33]  Mitchell Wand,et al.  Specifying the correctness of binding-time analysis , 1993, POPL '93.

[34]  Peter Thiemann Cogen in six lines , 1996, ICFP '96.

[35]  Gordon D. Plotkin,et al.  Call-by-Name, Call-by-Value and the lambda-Calculus , 1975, Theor. Comput. Sci..

[36]  Jens Palsberg,et al.  Correctness of binding-time analysis , 1993, Journal of Functional Programming.

[37]  E. de Boer,et al.  Reflections on reflections. , 1980, The Journal of the Acoustical Society of America.

[38]  John Hatcliff,et al.  Mechanically Verifying the Correctness of an Offline Partial Evaluator , 1995, PLILP.

[39]  Eugenio Moggi,et al.  A categorical account of two-level languages , 1997, MFPS.