Refunctionalization at work

First-order programs are desired in a variety of settings and for a variety of reasons. Their coming into existence in first-order form may be unplanned or it could be the deliberate result of a form of “firstification” such as closure conversion, (super)combinator conversion, or defunctionalization. In the latter case, they are higher-order programs in disguise, just as iterative programs with accumulators are often recursive programs in disguise. This talk is about Reynolds's defunctionalization [1, 2]. Over the last few years, we have observed that a number of existing first-order programs turn out to be in the range of defunctionalization, and therefore they directly correspond to higher-order programs, even though they were designed independently of any higher-order representation. Not all first-order programs, however, are in defunctionalized form. The goal of this talk is to refine our earlier characterization of what it means to be in defunctionalized form [3], and to investigate how one can tease a first-order program into defunctionalized form. On the way, we present a variety of independently known programs that are in (or can be teased into) defunctionalized form, and we exhibit their functional counterpart—a process we refer to as ‘refunctionalization' since it is a left inverse of defunctionalization.

[1]  Benjamin Grégoire,et al.  A compiled implementation of strong reduction , 2002, ICFP '02.

[2]  Olivier Danvy,et al.  Defunctionalization at work , 2001, PPDP '01.

[3]  Otto C. Juelich,et al.  On the recursive programming techniques , 1964, CACM.

[4]  CrégutPierre Strongly reducing variants of the Krivine abstract machine , 2007 .

[5]  Olivier Danvy,et al.  A functional correspondence between evaluators and abstract machines , 2003, PPDP '03.

[6]  John C. Reynolds,et al.  Definitional Interpreters for Higher-Order Programming Languages , 1972, ACM '72.

[7]  Andrew P. Tolmach,et al.  From ML to Ada: Strongly-typed language interoperability via source translation , 1998, Journal of Functional Programming.

[8]  Jean-Christophe Filliâtre,et al.  Producing all ideals of a forest, functionally , 2003, Journal of Functional Programming.

[9]  Olivier Danvy,et al.  On the equivalence between small-step and big-step abstract machines: a simple application of lightweight fusion , 2007, Inf. Process. Lett..

[10]  Olivier Danvy,et al.  On the static and dynamic extents of delimited continuations , 2005, Sci. Comput. Program..

[11]  John C. Reynolds,et al.  The discoveries of continuations , 1993, LISP Symb. Comput..

[12]  Pierre Crégut,et al.  Strongly reducing variants of the Krivine abstract machine , 2007, High. Order Symb. Comput..

[13]  John Hughes,et al.  A Novel Representation of Lists and its Application to the Function "reverse" , 1986, Inf. Process. Lett..

[14]  Edsger W. Dijkstra,et al.  Go To Statement Considered Harmful , 2022, Software Pioneers.

[15]  Kwangkeun Yi,et al.  EDUCATIONAL PEARL: ‘Proof-directed debugging’ revisited for a first-order version , 2006, Journal of Functional Programming.

[16]  Olivier Danvy,et al.  On proving syntactic properties of CPS programs , 1999 .

[17]  Johan Munk,et al.  A Study of Syntactic and Semantic Artifacts and its Application to Lambda Definability, Strong Normalization, and Weak Normalization in the Presence of... , 2008 .

[18]  Olin Shivers,et al.  Control-flow analysis of higher-order languages of taming lambda , 1991 .

[19]  Olivier Danvy,et al.  From Interpreter to Logic Engine by Defunctionalization , 2003, LOPSTR.

[20]  Lasse Nielsen,et al.  A Denotational Investigation of Defunctionalization , 2000 .

[21]  David A. Schmidt State transition machines for lambda calculus expressions , 1980, Semantics-Directed Compiler Generation.

[22]  Thomas Johnsson,et al.  Lambda Lifting: Treansforming Programs to Recursive Equations , 1985, FPCA.

[23]  John C. Reynolds,et al.  Definitional Interpreters Revisited , 1998, High. Order Symb. Comput..

[24]  Luca Aceto,et al.  Characteristic Formulae: From Automata to Logic , 2007, Bull. EATCS.

[25]  Jr. Guy L. Steele,et al.  Rabbit: A Compiler for Scheme , 1978 .

[26]  Jooyong Lee A Case for Dynamic Reverse-code Generation , 2007 .

[27]  Olivier Danvy,et al.  A functional correspondence between call-by-need evaluators and lazy abstract machines , 2003, Inf. Process. Lett..

[28]  Olivier Danvy,et al.  On Barron and Strachey's cartesian product function , 2007, ICFP '07.

[29]  Peter Henderson,et al.  A lazy evaluator , 1976, POPL.

[30]  Olivier Danvy,et al.  A Dynamic Continuation-Passing Style for Dynamic Delimited Continuations , 2005 .

[31]  David A. Schmidt State-transition machines for lambda-calculus expressions , 2007, High. Order Symb. Comput..

[32]  Lasse R. Nielsen,et al.  Refocusing in Reduction Semantics , 2004 .

[33]  Olivier Danvy,et al.  There and Back Again , 2005, Fundam. Informaticae.

[34]  Olivier Danvy,et al.  On one-pass CPS transformations , 2002, Journal of Functional Programming.

[35]  Luca Aceto,et al.  Ready to Preorder: Get Your BCCSP Axiomatization for Free! , 2007, CALCO.

[36]  William H. Burge,et al.  Recursive Programming Techniques , 1975 .

[37]  Olivier Danvy,et al.  Back to direct style II: first-class continuations , 1992, LFP '92.

[38]  John C. Reynolds Definitional Interpreters for Higher-Order Programming Languages , 1998, High. Order Symb. Comput..

[39]  Søren B. Lassen,et al.  A complete, co-inductive syntactic theory of sequential control and state , 2007, POPL '07.

[40]  O. Danvy,et al.  A Syntactic Correspondence between Context-Sensitive Calculi and Abstract Machines , 2005 .

[41]  Christopher Dutchyn,et al.  Specializing continuations a model for dynamic join points , 2007, FOAL.

[42]  Matthias Felleisen,et al.  Control operators, the SECD-machine, and the λ-calculus , 1987, Formal Description of Programming Concepts.

[43]  Matthias Felleisen,et al.  The theory and practice of first-class prompts , 1988, POPL '88.

[44]  James Hook,et al.  Type-driven defunctionalization , 1997, ICFP '97.

[45]  Peter Claussen Theories of programming languages , 2000, SOEN.

[46]  Robert Harper,et al.  Proof-directed debugging , 1999, Journal of Functional Programming.

[47]  Mitchell Wand,et al.  A scheme for a higher-level semantic algebra , 1986 .

[48]  Piotr Sankowski,et al.  Dynamic normal forms and dynamic characteristic polynomial , 2008, Theor. Comput. Sci..

[49]  Olivier Danvy A Rational Deconstruction of Landin's SECD Machine , 2004, IFL.

[50]  Charles Consel,et al.  A tour of Schism: a partial evaluation system for higher-order applicative languages , 1993, PEPM '93.

[51]  Suresh Jagannathan,et al.  Flow-Directed Closure Conversion for Typed Languages , 2000, ESOP.

[52]  François Pottier,et al.  Polymorphic typed defunctionalization and concretization , 2006, High. Order Symb. Comput..

[53]  Martin Lange,et al.  Temporal Logics Beyond Regularity , 2007 .

[54]  Urban Boquist,et al.  Code Optimisation Techniques for Lazy Functional Languages , 1999 .

[55]  Pierre Lescanne,et al.  From λσ to λν: a journey through calculi of explicit substitutions , 1994, POPL '94.

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

[57]  Joyce L. Vedral,et al.  Functional Programming Languages and Computer Architecture , 1989, Lecture Notes in Computer Science.

[58]  Anders Møller Static Analysis for Event-Based XML Processing , 2008, PLAN-X.

[59]  Luca Aceto,et al.  On the Existence of a Finite Base for Complete Trace Equivalence over BPA with Interrupt , 2007, Bull. EATCS.

[60]  Olivier Danvy,et al.  Abstracting control , 1990, LISP and Functional Programming.

[61]  Olivier Danvy,et al.  A Rational Deconstruction of Landin's J Operator , 2005, IFL.

[62]  Matthias Felleisen Reflections on Landins's J-Operator: A Partly Historical Note , 1987, Comput. Lang..

[63]  Pierre-Louis Curien Categorical Combinators, Sequential Algorithms, and Functional Programming , 1993, Progress in Theoretical Computer Science.

[64]  Matthias Felleisen,et al.  Automatically Restructuring Programs for the Web , 2004, Automated Software Engineering.

[65]  Fabrizio Grandoni,et al.  Optimal Resilient Dynamic Dictionaries , 2007, ESA.

[66]  David A. Schmidt State-transition machines, revisited , 2007, High. Order Symb. Comput..

[67]  Olivier Danvy,et al.  A functional correspondence between monadic evaluators and abstract machines for languages with computational effects , 2003, Theor. Comput. Sci..

[68]  Olivier Danvy,et al.  Lambda-Lifting in Quadratic Time , 2002, J. Funct. Log. Program..

[69]  J. C. FLUGEL,et al.  My Life , 1940, Nature.

[70]  Matthias Felleisen,et al.  A Tail-Recursive Semantics for Stack Inspections , 2003, ESOP.

[71]  Olivier Danvy,et al.  Representing Control: a Study of the CPS Transformation , 1992, Mathematical Structures in Computer Science.

[72]  Anindya Banerjee,et al.  Design and Correctness of Program Transformations Based on Control-Flow Analysis , 2001, TACS.

[73]  Dariusz Biernacki,et al.  The Theory and Practice of Programming Languages with Delimited Continuations , 2007 .

[74]  Olivier Danvy,et al.  A concrete framework for environment machines , 2005, TOCL.

[75]  Werner E. Kluge Abstract Computing Machines - A Lambda Calculus Perspective , 2005, Texts in Theoretical Computer Science. An EATCS Series.

[76]  Matthias Felleisen,et al.  Programming languages and lambda calculi , 1989 .

[77]  Olivier Danvy,et al.  An Operational Foundation for Delimited Continuations in the CPS Hierarchy , 2005, Log. Methods Comput. Sci..

[78]  Olivier Danvy,et al.  From Interpreter to Logic Engine by Defunctionalization , 2003 .