|
ABSTRACT
The goal of program transformation is to improve efficiency while preserving meaning. One of the best known transformation techniques is Burstall and Darlington's unfold-fold method. Unfortunately the unfold-fold method itself guarantees neither improvement in efficiency nor total-correctness. The correctness problem for unfold-fold is an instance of a strictly more general problem: transformation by locally equivalence-preserving steps does not necessarily preserve (global) equivalence.This paper presents a condition for the total correctness of transformations on recursive programs, which, for the first time, deals with higher-order functional languages (both strict and non-strict) including lazy data structures. The main technical result is an improvement theorem which says that if the local transformation steps are guided by certain optimisation concerns (a fairly natural condition for a transformation, then correctness of the transformation follows.The improvement theorem makes essential use of a formalised improvement-theory; as a rather pleasing corollary it also guarantees that the transformed program is a formal improvement over the original. The theorem has immediate practical consequences:• It is a powerful tool for proving the correctness of existing transformation methods for higher-order functional programs, without having to ignore crucial factors such as memoization or folding. We have applied the theorem to obtain a particularly simple proof of correctness for a higher-order variant of deforestation.• It yields a simple syntactic method for guiding and constraining the unfold/fold method in the general case so that total correctness (and improvement) is always guaranteed.
REFERENCES
Note: OCR errors may be found in this Reference List extracted from the full text article. ACM has opted to expose the complete List rather than only correct and linked references.
| |
Abr90
|
|
| |
Amt92
|
|
| |
BCE92a
|
|
| |
BCE92b
|
|
 |
BD77
|
|
| |
Bir84
|
R. Bird. Using circular programs to eliminate multiple traversals of data. A cta Informat#ca, 21:239-250, 1984.
|
| |
BK83
|
G. Boudol and L. Kott. Recursion induction principle revisited. Theoretical Computer Science, 22:135-173, 1983.
|
| |
CK93
|
C. Consel and S. Khoo. On-line and off-line partial evaluation: Semantic specification and correctness proofs. Technical report, Yale University, April 1993.
|
| |
Cou79
|
B. Courcell. Infinite trees in normal form and recursive equations having a unique solution. Mathematical Systems Theory, 13:131-180, 1979.
|
| |
Cou86
|
B. Courcelle. Equivalences and transformations of regular systems--applications to recursive program schemes and grammars. Theoretical Computer Science, 42:1-122, 1986.
|
| |
FFK87
|
|
 |
Gom92
|
|
| |
GS91
|
P. Gardner and j. Shepherdson. Unfold/fold transformations of logic programs. In J.-L. Lassez and G. Plotkin, editors, Computational Logic: Essays in Honor of Alan Robinson. 1991.
|
| |
How89
|
|
| |
JGS93
|
|
| |
KF86
|
T. Kanamori and H. Fujita. Unfold/fold transformation of logic programs with counters. Technical Report ICOT Tech Report TR-179, Mitsubishi Electric Corp., 1986.
|
| |
Kot78
|
L. Kott. About transformation system: A theoretical study. In B. Robinet, editor, Program Transformations, pages 232-247. Dunod, 1978.
|
| |
Kot80
|
|
| |
Kot85
|
|
| |
Mah89
|
M. Maher. Correctness of a logic program transformation system. Technical report, IBM - Watson Research Center, 1987 (revised 1989).
|
| |
Mil77
|
R. Milner. Fully abstract models of the typed A- calculus. Theoretical Computer Science, 4, 1977.
|
| |
Mil89
|
|
| |
MW79
|
Z. Manna and R. Waldinger. Synthesis: Dreams -+ programs. Transactions on Programming Languages and Systems, 5(4), 1979.
|
| |
Pal93
|
J. Palsberg. Correctness of binding time analysis. Journal of Functional Programming, 3(3), 1993.
|
| |
Plo75
|
G.D. Plotkin. Call-by-name, Call-by-value and the A-calculus. Theoretical Computer Science, 1(1):125-159, 1975.
|
 |
PP91
|
|
| |
PP93
|
A. Pettorossi and M Proietti. Transformation of logic programs: Foundations and techniques. Technical Report R 369, CNR Istituto di Analisi dei Sistemi ed Informatica, Rome, November 1993.
|
| |
Red89
|
|
| |
RFJ89
|
|
| |
San91
|
|
| |
San93
|
D. Sands. A naive time analysis and its theory of cost equivalence. TOPPS report D-173, DIKU, 1993. To appear: Journal of Logic and Computation.
|
| |
San94
|
D. Sands. Total correctness and improvement in the transformation of functional programs. DIKU, University of Copenhagen, Unpublished (53 pages), May 1994.
|
| |
Sat90
|
|
| |
Sch80
|
|
 |
Sch81
|
|
| |
Sek93
|
H. Seki. Unfold/fold transformation of general logic programs for the well-founded semantics, jr. Logic Programming, 16:5-23, 1993.
|
| |
TS84
|
H. Tamaki and T. Sato. Unfold/fold transformation of logic programs. In S. Tarnlund, editor, 2nd International Logic Programming Conference, pages 127-138, 1984.
|
 |
Tur86
|
|
| |
Wad90
|
|
| |
Wan93
|
M. Wand. Specifying the correctness of binding time analysis. Journal of Functional Programming, 3(3), 1993.
|
| |
Zhu94
|
Hong Zhu. How powerful are folding/unfolding transformations? J. Functwnal Programing, 4(1):89-112, January 1994.
|
|