# Refinement calculus, part I: Sequential nondeterministic programs

## Abstract

A lattice theoretic framework for the calculus of program refinement is presented. Specifications and program statements are combined into a single (infinitary) language of commands which permits miraculous, angelic and demonic statements to be used in the description of program behavior. The weakest precondition calculus is extended to cover this larger class of statements and a game-theoretic interpretation is given for these constructs. The language is complete, in the sense that every monotonic predicate transformer can be expressed in it. The usual program constructs can be defined as derived notions in this language. The notion of inverse statements is defined and its use in formalizing the notion of data refinement is shown.

## Key words

Stepwise refinement weakest preconditions angelic nondeterminism demonic non-determinism miraculous statements data refinement inverse statements total correctness lattices specification methods## Preview

Unable to display preview. Download preview PDF.

## References

- [1]R. J. R. Back.
*On the Correctness of Refinement Steps in Program Development*. PhD thesis, Department of Computer Science, University of Helsinki, Helsinki, 1978. Report A-1978-4.Google Scholar - [2]R. J. R. Back.
*Correctness Preserving Program Refinements: Proof Theory and Applications*, volume 131 of*Mathematical Center Tracts*. Mathematical Centre, Amsterdam, 1980.Google Scholar - [3]R. J. R. Back. On correct refinement of programs.
*J. Computer and Systems Sciences*, 23(1):49–68, August 1981.Google Scholar - [4]R. J. R. Back. Procedural abstraction in the refinement calculus. Reports on computer science and mathematics 55, Åbo Akademi, 1987.Google Scholar
- [5]R. J. R. Back. A calculus of refinements for program derivations.
*Acta Informatica*, 25:593–624, 1988.CrossRefGoogle Scholar - [6]R. J. R. Back. Changing data representation in the refinement calculus. In
*21st Hawaii International Conference on System Sciences*, January 1989. Also available as Åbo Akademi reports on computer science and mathematics no. 68, 1988.Google Scholar - [7]R. J. R. Back. Refining atomicity in parallel algorithms. In
*PARLE Conference on Parallel Architectures and Languages Europe*, volume 366 of*Lecture Notes in Computer Science*, Eindhoven, the Netherlands, June 1989. Springer Verlag. Also available as Åbo Akademi reports on computer science and mathematics no. 57, 1988.Google Scholar - [8]R. J. R. Back and K. Sere. Refinement of action systems. In
*Mathematics of Program Construction*, volume 375 of*Lecture Notes in Computer Science*, Groningen, The Netherlands, June 1989. Springer-Verlag.Google Scholar - [9]R. J. R. Back and J. von Wright. Combining angels, demons and miracles in program specifications. Reports on computer science and mathematics 86, Åbo Akademi, 1989.Google Scholar
- [10]R. J. R. Back and J. von Wright. Command lattices, variable environments and data refinement. Reports on computer science and mathematics (in preparation), Åbo Akademi, 1989.Google Scholar
- [11]R. J. R. Back and J. von Wright. Duality in specification languages: a lattice-theoretical approach. Reports on computer science and mathematics 77, Åbo Akademi, 1989. To appear in Acta Informatica.Google Scholar
- [12]R. J. R. Back and J. von Wright. A lattice-theoretical basis for a specification language. In
*Mathematics of Program Construction*, volume 375 of*Lecture Notes in Computer Science*, Groningen, The Netherlands, June 1989. Springer-Verlag.Google Scholar - [13]R. J. R. Back and J. von Wright. Statement inversion and strongest postcondition. Reports on computer science and mathematics (in preparation), Åbo Akademi, 1989.Google Scholar
- [14]G. Birkhoff.
*Lattice Theory*. American Mathematical Society, Providence, 1961.Google Scholar - [15]R. M. Burstall and J. Darlington. Some transformations for developing recursive programs.
*J. ACM*, 24(1):44–67, 1977.CrossRefGoogle Scholar - [16]W. Chen and J. T. Udding. Towards a calculus of data refinement. In
*Mathematics of Program Construction*, volume 375 of*Lecture Notes in Computer Science*, Groningen, The Netherlands, June 1989. Springer-Verlag.Google Scholar - [17]J. W. de Bakker.
*Mathematical Theory of Program Correctness*. Prentice-Hall, 1980.Google Scholar - [18]E. W. Dijkstra. Notes on structured programming. In E. D. Dahl, O.J. and C. Hoare, editors,
*Structured Programming*. Academic Press, 1971.Google Scholar - [19]E. W. Dijkstra.
*A Discipline of Programming*. Prentice-Hall International, 1976.Google Scholar - [20]P. Gardiner and C. C. Morgan. Data refinement of predicate transformers. Manuscript (to appear in Theoretical Computer Science), 1988.Google Scholar
- [21]S. L. Gerhart. Correctness preserving program transformations. In
*Proc. 2nd ACM Conference of Principles of Programming Languages*, pages 54–66, 1975.Google Scholar - [22]G. Grätzer.
*General Lattice Theory*. Birkhäuser Verlag, Basel, 1978.Google Scholar - [23]D. Gries.
*The Science of Programming*. Springer-Verlag, New York, 1981.Google Scholar - [24]P. Guerreiro. Another characterization of weakest preconditions. In
*Lecture Notes in Computer Science 137*. Springer-Verlag, 1982.Google Scholar - [25]W. H. Hesselink. An algebraic calculus of commands. Report CS 8808, Department of Mathematics and Computer Science, University of Groningen, 1988.Google Scholar
- [26]W. H. Hesselink. Command algebras, recursion and program transformation. Report CS 8812, Department of Mathematics and Computer Science, University of Groningen, 1988.Google Scholar
- [27]C. A. R. Hoare. Proofs of correctness of data representation.
*Acta Informatica*, 1(4):271–281, 1972.CrossRefGoogle Scholar - [28]C. A. R. Hoare, I. J. Hayes, J. He, C. C. Morgan, A. W. Roscoe, J. W. Sanders, I. H. Sorensen, J. Spivey, and A. Sufrin. Laws of programming.
*Communications of the ACM*, 30(8):672–686, August 1987.CrossRefGoogle Scholar - [29]C. C. Morgan. Data refinement by miracles.
*Information Processing Letters*, 26:243–246, January 1988.MathSciNetGoogle Scholar - [30]C. C. Morgan. The specification statement.
*ACM Transactions on Programming Languages and Systems*, 10(3):403–419, July 1988.Google Scholar - [31]C. C. Morgan. Programming from specifications. Manuscript, 1989.Google Scholar
- [32]C. C. Morgan. Types and invariants in the refinement calculus. In
*Mathematics of Program Construction*, volume 375 of*Lecture Notes in Computer Science*, Groningen, The Netherlands, June 1989. Springer-Verlag.Google Scholar - [33]C. C. Morgan and P. Gardiner. Data refinement by calculation. Technical report, Programming Research Group, Oxford University, 1988.Google Scholar
- [34]J. M. Morris. A theoretical basis for stepwise refinement and the programming calculus.
*Science of Computer Programming*, 9:287–306, 1987.CrossRefGoogle Scholar - [35]J. M. Morris. Laws of data refinement.
*Acta Informatica*, 26:287–308, 1989.Google Scholar - [36]G. Nelson. A generalization of Dijkstra's calculus. Tech. Rep 16, Digital Systems Research Center, Palo Alto, Calif., April 1987.Google Scholar
- [37]N. Wirth. Program development by stepwise refinement.
*Communications of the ACM*, 14:221–227, 1971.CrossRefGoogle Scholar