Foundations for a Practical Theory of Program Refinement and Transformation

A wide spectrum language is presented, which is designed to facilitate the proof of the correctness of refinements and transformations. Two different proof methods are introduced and used to prove some fundamental transformations, including a general induction rule (Lemma 3.9) which enables transformations of recursive and iterative programs to be proved by induction on their finite truncations. A theorem for proving the correctness of recursive implementations is presented (Theorem 3.21), which provides a method for introducing a loop, without requiring the user to provide a loop invariant. A powerful, general purpose, transformation for removing or introducing recursion is described and used in a case study (Section 5) in which we take a small, but highly complex, program and apply formal transformations in order to uncover an abstract specification of the behaviour of the program. The transformation theory supports a transformation system, called FermaT, in which the applicability conditions of each transformation (and hence the correctness of the result) are mechanically verified. These results together considerably simplify the construction of viable program transformation tools; practical consequences are briefly discussed.

[1]  Cliff B. Jones,et al.  Systematic software development using VDM , 1986, Prentice Hall International Series in Computer Science.

[2]  Jacques J. Arsac,et al.  Syntactic source to source transforms and program manipulation , 1979, CACM.

[3]  Carroll Morgan,et al.  The specification statement , 1988, TOPL.

[4]  Martin P. Ward Reverse Engineering through Formal Transformation: Knuths 'Polynomial Addition' Algorithm , 1994, Comput. J..

[5]  Edsger W. Dijkstra,et al.  A Discipline of Programming , 1976 .

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

[7]  David Taylor An alternative to current looping syntax , 1984, SIGP.

[8]  Richard S. Bird,et al.  A calculus of functions for program derivation , 1990 .

[9]  C. A. R. Hoare,et al.  Laws of programming , 1987, CACM.

[10]  M. P. Ward,et al.  Program Analysis by Formal Transformation , 1996, Comput. J..

[11]  Martin Ward Proving program refinements and transformations , 1986 .

[12]  Ken Robinson,et al.  Specification statements and refinements , 1987 .

[13]  South Rd,et al.  A Practical Program Transformation System For Reverse Engineering , 1993 .

[14]  Arthur G. Duncan,et al.  Abstractions, instantiations, and proofs of marking algorithms , 1977, Artificial Intelligence and Programming Languages.

[15]  Robert D. Tennent,et al.  The denotational semantics of programming languages , 1976, CACM.

[16]  Ian J. Hayes,et al.  Specification case studies , 1987 .

[17]  T. M. Bull An introduction to the WSL program transformer , 1990, Proceedings. Conference on Software Maintenance 1990.

[18]  Martin Ward Using Formal Transformations to Construct a Component Repository , 1991 .

[19]  Friedrich L. Bauer,et al.  Formal Program Construction by Transformations-Computer-Aided, Intuition-Guided Programming , 1989, IEEE Trans. Software Eng..

[20]  Joseph M. Morris A Proof of the Schorr-Waite Algorithm , 1982 .

[21]  Friedrich L. Bauer,et al.  The Munich Project CIP, Volume II: The Program Transformation System CIP-S , 1987 .

[22]  P. Gács,et al.  Algorithms , 1992 .

[23]  Martin P. Ward,et al.  A Multipurpose Backtracking Algorithm , 1994, J. Symb. Comput..

[24]  Carroll Morgan,et al.  Programming from specifications , 1990, Prentice Hall International Series in computer science.

[25]  David Gries The Schorr-Waite Graph Marking Algorithm , 1978, Program Construction.

[26]  Friedrich L. Bauer,et al.  Algorithmic Language and Program Development , 1982, Texts and Monographs in Computer Science.

[27]  M. Majster Limits of the "algebraic" specification of abstract data types , 1977, SIGP.

[28]  William M. Waite,et al.  An efficient machine-independent procedure for garbage collection in various list structures , 1967, CACM.

[29]  Friedrich Ludwig Bauer,et al.  The wide spectrum language CIP-L , 1985 .

[30]  Ralph-Johan Back,et al.  Correctness preserving program refinements: Proof theory and applications , 1980 .

[31]  O. Helmer Languages with expressions of infinite length , 1937, Erkenntnis.

[32]  M. P. Ward Specifications from source code-alchemists' dream or practical reality? , 1994 .

[33]  Erwin Engeler,et al.  Formal languages; automata and structures , 1968 .

[34]  E. J. Younger,et al.  Inverse-engineering a simple real-time program , 1994, J. Softw. Maintenance Res. Pract..

[35]  Willem P. de Roever,et al.  On Backtracking and Greatest Fixpoints , 1977, ICALP.

[36]  Martin P. Ward Language-Oriented Programming , 1994, Softw. Concepts Tools.

[37]  Robert A. Kowalski,et al.  Algorithm = logic + control , 1979, CACM.

[38]  Martin P. Ward Abstracting a specification from code , 1993, J. Softw. Maintenance Res. Pract..

[39]  Martin P. Ward A definition of abstraction , 1995, J. Softw. Maintenance Res. Pract..

[40]  Martin Ward,et al.  Derivation of a Sorting Algorithm , 1990 .

[41]  H. Partsch,et al.  The CIP Transformation System , 1984 .

[42]  Keith H. Bennett,et al.  Formal Methods to Aid the Evolution of Software , 1995, Int. J. Softw. Eng. Knowl. Eng..

[43]  Martin Ward A Recursion Removal Theorem , 1992, Refine.

[44]  Martin P. Ward Derivation of Data Intensive Algorithms by Formal Transformation: The Schnorr-Waite Graph Marking Algorithm , 1996, IEEE Trans. Software Eng..