## Proving the Correctness of Recursion-Based Automatic Program Transformations (1996)

Venue: | Theoretical Computer Science |

Citations: | 31 - 4 self |

### BibTeX

@INPROCEEDINGS{Sands96provingthe,

author = {David Sands},

title = {Proving the Correctness of Recursion-Based Automatic Program Transformations},

booktitle = {Theoretical Computer Science},

year = {1996},

pages = {681--695},

publisher = {Springer-Verlag}

}

### Years of Citing Articles

### OpenURL

### Abstract

This paper shows how the Improvement Theorem---a semantic condition

### Citations

639 |
Partial Evaluation and Automatic Program Generation. Available online: http://www.itu.dk/people/sestoft/pebook
- Jones, Gomard, et al.
- 1993
(Show Context)
Citation Context ...e of the techniques known from Turchin's supercompiler. 1 Introduction Transformation of recursive programs Source-to-source transformation methods for functional programs, such as partial evaluation =-=[15]-=- and deforestations[38,3], perform equivalence preserving modifications to the definitions in a given program. These methods fall in to a class which has been called generative set transformations [23... |

570 | A Transformation System for Developing Recursive Programs
- Burstall, Darlington
- 1976
(Show Context)
Citation Context ...tions built from a small set of rules which gain their power from their compound and selective application. The classic example of this (informal) class is Burstall and Darlington's unfoldfold method =-=[2]-=-; many automatic transformations of this class can be viewed as specialised instances of unfold-fold rules. 1 This is a revised and extended version of a paper which appears in the proceedings of TAPS... |

536 |
The Implementation of Functional Programming Languages
- Jones
- 1987
(Show Context)
Citation Context ... semantics is used to define an evaluation relation + (a partial function) between closed expressions and the "values" of computations. The set of values, following the standard terminology =-=(see e.g. [25]-=-), are called weak head normal forms. The weak head normal forms, w; w 1 ; w 2 ; : : : 2 whnf are just the constructor-expressions c(e), and the Closures, as given by the following grammar: w = c(e) j... |

400 | Deforestation: Transforming programs to eliminate trees
- Wadler
- 1990
(Show Context)
Citation Context ...wn from Turchin's supercompiler. 1 Introduction Transformation of recursive programs Source-to-source transformation methods for functional programs, such as partial evaluation [15] and deforestations=-=[38,3]-=-, perform equivalence preserving modifications to the definitions in a given program. These methods fall in to a class which has been called generative set transformations [23]: transformations built ... |

239 | The lazy lambda calculus
- Abramsky
- 1990
(Show Context)
Citation Context ... use is the standard Morris-style contextual ordering, or observational approximationssee e.g. [26].The notion of "observation" we take is just the fact of convergence, as in the lazy lambda=-= calculus [1]-=-. Operational equivalence equates two expressions if and only if in all closing contexts they give rise to the same observation -- i.e. either they both converge, or they both diverge. Definition 4 (i... |

239 |
Partial evaluation in logic programming
- Lloyd, Shepherdson
- 1991
(Show Context)
Citation Context ...author's knowledge, the only other correctness proofs for automatic transformations of recursive programs which use some form of folding are in the study of related logic-program transformation, e.g. =-=[18]-=- [16]. For an extensive comparison of the improvement theorem with other general techniques for correct transformations, see [30]. 1.1 Overview Section 2 introduces the syntax, operational semantics a... |

220 |
Call-by-name, call-by-value, and the #-calculus
- Plotkin
- 1975
(Show Context)
Citation Context ...efine the standard notions of operational approximation and equivalence. The operational approximation we use is the standard Morris-style contextual ordering, or observational approximationssee e.g. =-=[26].The notio-=-n of "observation" we take is just the fact of convergence, as in the lazy lambda calculus [1]. Operational equivalence equates two expressions if and only if in all closing contexts they gi... |

213 |
Unfold/fold transformations of logic programs
- Tamaki, Sato
- 1984
(Show Context)
Citation Context ...roved program. Proof. From the previous proposition, the basic steps are all in the improvement relation. Clearly they are also operational equivalences. Taking a "virtual" view of the trans=-=formation [TS84]-=- in which we consider that the initial definitions of the new functions (introduced by the transformation steps) are already present at the beginning of the transformation, then the folding steps are ... |

195 | A short cut to deforestation - Gill, Launchbury, et al. - 1993 |

168 | The concept of a supercompiler
- Turchin
- 1986
(Show Context)
Citation Context ...nd more powerful transformations. The more "powerful " methods which are also covered by these generalisations include a sourcelevel representation of Turchin's driving, as found in the supe=-=rcompiler [35]-=-. An essential component of all of these transformations is the ability to create new recursive structures. We provide what we believe to be the first correctness proof for any of this class of transf... |

116 |
A syntactic theory of sequential control
- Felleisen, Friedman, et al.
- 1987
(Show Context)
Citation Context ...j Closures Closures = x:e j fe 1 : : : e k (0sk ! ff f ) The operational semantics is call-by-name, and + is defined in terms of a one-step evaluation relation using the notion of a reduction context =-=[6]-=-. If e+w for some closed expression e then we say that e evaluates to w. We say that e converges, and sometimes write e+ if there exists a w such that e+w. Otherwise we say that e diverges. We make no... |

112 | A fold for all seasons
- Sheard, Fegaras
- 1993
(Show Context)
Citation Context ...stemming from the fact that, in addition to the case-reduction context, the language now has an application reduction context (IR e), plus an 6 Non recursion based approaches to deforestation [GLJ93] =-=[SF93] d-=-o not encounter this problem, but cannot handle recursive definitions. additional set of weak head normal forms---the partially applied functions. A similar generalisation is given by Nielsen and S�... |

104 |
Program transformation systems
- Partsch, Steinbrueggen
- 1983
(Show Context)
Citation Context ...15] and deforestations[38,3], perform equivalence preserving modifications to the definitions in a given program. These methods fall in to a class which has been called generative set transformations =-=[23]-=-: transformations built from a small set of rules which gain their power from their compound and selective application. The classic example of this (informal) class is Burstall and Darlington's unfold... |

95 | Equality in lazy computation systems
- Howe
- 1989
(Show Context)
Citation Context .... The characterisation we use says that two expressions are in the improvement relation if and only if they are contained in a certain kind of simulation relation. This is a form of context lemma eg. =-=[1,14]-=-, and the proof of the characterisation uses previous technical results concerning a more general class of improvement relations [27]. Definition 12 A relation IR on closed expressions is an improveme... |

72 | Rules and Strategies for Transforming Functional and Logic Programs
- Pettorossi, Proietti
- 1996
(Show Context)
Citation Context ...formations on logic programs) have this capability via a process of selectively memoising previously encountered expressions, and introducing recursion according to a "d'ej`a vu " principle =-=[15]. See [24]-=- for an overview of transformation strategies which fit this style. The Problem of Correctness Program transformations performed by a tool such as an optimising compiler should preserve the extensiona... |

63 | Occam’s Razor in Metacomputation: the Notion of a Perfect Process Tree
- Glück, Klimov
- 1993
(Show Context)
Citation Context ...d by T into a finite graph, by collapsing equivalent nodes. For deforestation, nodes 19 are considered equivalent if they are are equivalence up to variable renaming (so-called "identical folding=-=" in [9]). See for-=- example Ferguson and Wadler's account of folding in deforestation [7], and related descriptions of folding for "process trees" in [9]. Wadler originally argued that the expression level tra... |

61 | Total correctness by local improvement in the transformation of functional programs
- Sands
- 1996
(Show Context)
Citation Context ...folding are in the study of related logic-program transformation, e.g. [18] [16]. For an extensive comparison of the improvement theorem with other general techniques for correct transformations, see =-=[30]-=-. 1.1 Overview Section 2 introduces the syntax, operational semantics and definitions of operational approximation and equivalence for a higher-order functional language. Section 3 provides the defini... |

44 | Partial Deduction and Driving are Equivalent
- Glück, Sørensen
- 1994
(Show Context)
Citation Context ...ifference is that the stepwise transformation has the ability to terminate more quickly, and produce more compact definitions. An illustrative example, too involved to reproduce here, can be found in =-=[10][x6 (cf. f-=-ootnote 4)]. The "theoretical" difference is that the stepwise deforestation algorithm is not deterministic. We do not consider this to be a problem of the formulation, since we will show th... |

43 |
An introduction to partial deduction
- Komorowski
- 1992
(Show Context)
Citation Context ...r's knowledge, the only other correctness proofs for automatic transformations of recursive programs which use some form of folding are in the study of related logic-program transformation, e.g. [18] =-=[16]-=-. For an extensive comparison of the improvement theorem with other general techniques for correct transformations, see [30]. 1.1 Overview Section 2 introduces the syntax, operational semantics and de... |

35 |
Safe fusion of functional expressions II: Further improvements
- Chin
- 1994
(Show Context)
Citation Context ...r of Figure 4. Instead we use global recursion, by allowing the transformation steps to introduce new top-level definitions. This approach is already common in describing deforestation, see e.g. [13] =-=[4]-=-. First we modify rule (s1) to introduce a call to a new function: (s1 0 ) IR[fse] ; f \Pisy wheresy =sfv(IR[fse]) and f \Pi is a new function given by f \Pisy \Delta = IR[e f fx :=seg] Now we can add... |

34 |
Automatic Methods for Program Transformation
- Chin
- 1990
(Show Context)
Citation Context ...wn from Turchin's supercompiler. 1 Introduction Transformation of recursive programs Source-to-source transformation methods for functional programs, such as partial evaluation [15] and deforestations=-=[38,3]-=-, perform equivalence preserving modifications to the definitions in a given program. These methods fall in to a class which has been called generative set transformations [23]: transformations built ... |

34 |
A self-applicable partial evaluator for the lambda calculus: correctness and pragmatics
- Gomard
- 1992
(Show Context)
Citation Context ...en occurs because the correctness issues studied relate to the transformation algorithm rather than the correctness of the resulting program. For example, studies of correctness in partial evaluation =-=[11]-=-[22][39] ignore the memoisation aspects entirely and deal with the orthogonal issue of the correctness of binding time analysis, which controls where transformation occurs in a program. Transformation... |

21 |
Infinite trees in normal form and recursive equations having a unique solution
- Courcelle
- 1979
(Show Context)
Citation Context ...y associated with "transformation by equivalence": Theorem 8 (Partial Correctness) If e i = e 0 i for all i 2 I, then g i ! f i , i 2 I. This is the "standard" partial correctness =-=result (see eg. [17][5]-=-) associated with e.g. unfold-fold transformations. It follows easily from a least fixed-point theorem for ! (the full details for this language can be found in [30]) since the f are easily shown to b... |

21 | When will deforestation stop
- Ferguson, Wadler
- 1988
(Show Context)
Citation Context ...odes 19 are considered equivalent if they are are equivalence up to variable renaming (so-called "identical folding" in [9]). See for example Ferguson and Wadler's account of folding in defo=-=restation [7], and rela-=-ted descriptions of folding for "process trees" in [9]. Wadler originally argued that the expression level transformation is obviously correct (since it essentially uses just unfolding, and ... |

21 | Operational theories of improvement in functional languages
- Sands
- 1991
(Show Context)
Citation Context ...definition of improvement. We could, for example, additionally count the number of primitive functions called. Such variations might be used to give additional information about transformations. (See =-=[27]-=- for further examples). However, the fact that we count the number of recursive function calls in the definition of improvement is essential to the Improvement Theorem; the Theorem does not hold if we... |

20 | Total correctness by local improvement in program transformation
- Sands
- 1995
(Show Context)
Citation Context ...n, in Principle To obtain total correctness without losing the local, stepwise character of program transformation, it is clear that a stronger condition than extensional equivalence is necessary. In =-=[29]-=- we presented such a condition, improvement. The Improvement Theorem states that if the local steps of a transformation are improvements, in a formal sense, then the transformation will be correct, an... |

20 |
Towards unifying partial evaluation, deforestation, supercompilation, and GPC
- S��rensen, Gluck, et al.
- 1994
(Show Context)
Citation Context ...lar with respect to the transformation steps. Section 7 illustrates the robustness of the proof by considering a number of further generalisations, including the "positive supercompilation" =-=rule from [33]-=-. 2 Preliminaries We summarise some of the notation used in specifying the language and its operational semantics. The subject of this study will be an untyped higherorder non-strict functional langua... |

19 | P.: Deforestation for higher-order functions
- Marlow, Wadler
- 1992
(Show Context)
Citation Context ...problem of proving correctness, we will present a modification of the transformation rules which makes folding explicit. 4.1 Explicit Memoisation and Folding Some earlier explicit accounts of folding =-=[7,19]-=- have taken the declarative view mentioned above. 5 Firstly, the infinite expression-tree produced by T [[ ]] is annotated with expressions; if e annotates some expression-tree t, then t (ignoring ann... |

17 | Deforestation for Higher-Order Functional Programs
- Marlow
- 1996
(Show Context)
Citation Context ...tion reduction context (IR e), plus an additional set of weak head normal forms---the partially applied functions. More recent higher-order generalisations are due to Hamilton [12] and also to Marlow =-=[20]; notably -=-both Hamilton and Marlow give a grammar of terms (a "treeless form ") which is used to characterise a set of expressions for which their respective algorithms always terminates. Following [2... |

16 |
About Transformation System: A Theoretical Study”, 3ème Colloque International sur la Programmation
- Kott
- 1978
(Show Context)
Citation Context ...perty associated with "transformation by equivalence": Theorem 8 (Partial Correctness) If e i = e 0 i for all i 2 I, then g i ! f i , i 2 I. This is the "standard" partial correctn=-=ess result (see eg. [17]-=-[5]) associated with e.g. unfold-fold transformations. It follows easily from a least fixed-point theorem for ! (the full details for this language can be found in [30]) since the f are easily shown t... |

14 | A grammar-based dataflow analysis to stop deforestation - S��rensen - 1994 |

12 |
Extending deforestation for first order functional programs
- Hamilton, Jones
- 1992
(Show Context)
Citation Context ...manner of Figure 4. Instead we use global recursion, by allowing the transformation steps to introduce new top-level definitions. This approach is already common in describing deforestation, see e.g. =-=[13]-=- [4]. First we modify rule (s1) to introduce a call to a new function: (s1 0 ) IR[fse] ; f \Pisy wheresy =sfv(IR[fse]) and f \Pi is a new function given by f \Pisy \Delta = IR[e f fx :=seg] Now we can... |

11 |
Turchin's Supercompiler Revisited: An Operational Theory of Positive Information Propagation
- Srensen
- 1994
(Show Context)
Citation Context ...E ::= [ ] j case E of pat 1 : e 1 : : : pat n : e n : With this generalisation, the contexts E are now just the reduction contexts for this first-order language (an observation first made explicit in =-=[31]-=-). The first step in our strategy for generalising to the higher-order case is to use the reduction contexts for this language, i.e.: IR = [ ] j case IR of c 1 (x 1 ) : e 1 : : : c n (x n ) : e n j IR... |

9 | On-line and off-line partial evaluation: Semantics specifications and correctness proofs
- Consel, Khoo
- 1995
(Show Context)
Citation Context ...correctness issues studied relate to the transformation algorithm rather than the correctness of the resulting program. For example, studies of correctness in partial evaluation [Gom92][Pal93][Wan93] =-=[CK93]-=- ignore the memoisation aspects entirely and deal with the orthogonal issue of the correctness of binding time analysis, which controls where transformation occurs in a program. Transformations consid... |

8 |
Correctness of binding time analysis
- Palsberg
- 1993
(Show Context)
Citation Context ...ccurs because the correctness issues studied relate to the transformation algorithm rather than the correctness of the resulting program. For example, studies of correctness in partial evaluation [11]=-=[22]-=-[39] ignore the memoisation aspects entirely and deal with the orthogonal issue of the correctness of binding time analysis, which controls where transformation occurs in a program. Transformations co... |

6 | Call-by-name CPS-translation as a binding-time improvement
- Nielsen, rensen
- 1995
(Show Context)
Citation Context ...ich is used to characterise a set of expressions for which their respective algorithms always terminates. Following [28], this style of stepwise transformation has been adopted by Nielsen and Srensen =-=[21] in a stud-=-y of the relationship between deforestation and partial evaluation. They define a class of passive contexts (what they also call "dead contexts") which makes their analog of ; deterministic.... |

6 |
Correct Higher-Order Program Transformations
- Steckler
- 1994
(Show Context)
Citation Context ...sation aspects entirely and deal with the orthogonal issue of the correctness of binding time analysis, which controls where transformation occurs in a program. Transformations considered by Steckler =-=[34]-=- are quite orthogonal to the ones studied here, since they concern local optimisations which are justified by global data-flow properties of the program in which they are performed. To the author's kn... |

4 | The algorithm of generalization - Turchin - 1988 |

2 | Specifying the correctness of binding time analysis - Wand - 1993 |

1 |
Deforestation for higher order functional programs
- Hamilton
- 1995
(Show Context)
Citation Context ...guage now has an application reduction context (IR e), plus an additional set of weak head normal forms---the partially applied functions. More recent higher-order generalisations are due to Hamilton =-=[12] and also -=-to Marlow [20]; notably both Hamilton and Marlow give a grammar of terms (a "treeless form ") which is used to characterise a set of expressions for which their respective algorithms always ... |

1 |
An algorithm for generalization in positive supercompolation
- Srensen, Gluck
- 1995
(Show Context)
Citation Context ...n can prevent interesting transformation from occurring. Too little, and it can be hard to ensure termination. The question of when and where to generalise is beyond the scope of this paper. See e.g. =-=[36,31,32]-=- [36]. 7.3 Adding Laws In principle, any strong improvement laws e 0ss e 1 , can be added, and correctness follows providing that the law is domain independent of the definitions thus transformed. As ... |

1 |
The concatenate vanishes. University of Glasgow. Unpublished (preliminary version circulated on the FP mailing list
- Wadler
- 1987
(Show Context)
Citation Context ... \Delta pat n : e n ) y s case e of pat 1 : (append e 1 y) \Delta \Delta \Delta pat n : (append e n y) Along these lines we can enable transformations which yield non-linear speedups (see for example =-=[37]-=-), in contrast to the transformations considered so far, and the following generalisation. 7.4 Driving and Positive Supercompilation In terms of transformational power (but ignoring termination issues... |

1 |
S��rensen Deforestation, partial exaluation and evaluation orders. Unpublished
- Nielsen, Heine
- 1994
(Show Context)
Citation Context ...encounter this problem, but cannot handle recursive definitions. additional set of weak head normal forms---the partially applied functions. A similar generalisation is given by Nielsen and S��ren=-=sen [NH94]-=-, where they study the relationship to partial evaluation. For reasons of space we do not present the original recursive formulation of the deforestation algorithm. 5.1 Stepwise Deforestation For the ... |

1 |
Call-by-name, Callby -value and the -calculus
- Plotkin
- 1975
(Show Context)
Citation Context ... we define the standard notions of operational approximation and equivalence. The operational approximation we use is the standard Morris-style contextual ordering, or observational approximation eg. =-=[Plo75].The notio-=-n of "observation" we take is just the fact of convergence, as in the lazy lambda calculus [Abr90]. Operational equivalence equates two expressions if and only if in all closing contexts the... |