Skip to main content
Log in

A calculus of refinements for program derivations

  • Published:
Acta Informatica Aims and scope Submit manuscript

Summary

A calculus of program refinements is described, to be used as a tool for the step-by-step derivation of correct programs. A derivation step is considered correct if the new program preserves the total correctness of the old program. This requirement is expressed as a relation of (correct) refinement between nondeterministic program statements. The properties of this relation are studied in detail. The usual sequential statement constructors are shown to be monotone with respect to this relation and it is shown how refinement between statements can be reduced to a proof of total correctness of the refining statement. A special emphasis is put on the correctness of replacement steps, where some component of a program is replaced by another component. A method by which assertions can be added to statements to justify replacements in specific contexts is developed. The paper extends the weakest precondition technique of Dijkstra to proving correctness of larger program derivation steps, thus providing a unified framework for the axiomatic, the stepwise refinement and the transformational approach to program construction and verification.

This is a preview of subscription content, log in via an institution to check access.

Access this article

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Institutional subscriptions

Similar content being viewed by others

References

  1. Apt, K.R., Plotkin, G.D.: Countable nondeterminism and random assignment. J. ACM 33 (4) 724–767 (1986)

    Google Scholar 

  2. Back, R.J.R.: On the correctness of refinement steps in program development (Ph.D. thesis). Report A-1978-4, Dept. of Computer Science, University of Helsinki, 1978

  3. Back, R.J.R.: Correctness preserving program refinements: proof theory and applications. Mathematical Center Tracts 131, Mathematical Centre, Amsterdam 1980

    Google Scholar 

  4. Back, R.J.R.: Proving total correctness of nondeterministic programs in infinitary logic. Acta Informatica 15 233–250 (1981)

    Google Scholar 

  5. Back, R.J.R.: On correct refinement of programs. J. Comput. Syst. Sci. 23 (1), 49–68 (1981)

    Google Scholar 

  6. Back, R.J.R., Mannila, H., Raiha, K.J.: Derivation of efficient dag marking algorithms. ACM Conference on Principles of Programming Languages, Austin, Texas 1983

  7. Back, R.J.R.: Procedural abstraction in the refinement calculus. Reports on Computer Science and Mathematics no. 55, 1987, Abo Akademi

  8. Back, R.J.R.: Derivation of a dag marking algorithm in the refinement calculus (in preparation)

  9. deBakker, J.: Mathematical theory of program correctness, Englewood Cliffs: Prentice-Hall 1980

    Google Scholar 

  10. Bauer, F.L., Broy, M., Partsch, H., Pepper, P., Wossner, H.: Systematics of transformation rules. In: Bauer, F.L., Broy, M. (eds.) Program construction. (Lect. Notes Comput. Sci., Vol. 69) Berlin Heidelberg New York: Springer 1979

    Google Scholar 

  11. Berlioux, P., Bizard, P.: Algorithms; the construction, proof and analysis of programs. New York: Wiley 1986

    Google Scholar 

  12. Boom, H.J.: A weaker precondition for loops. TOPLAS 4 (4), 668–677 (1982)

    Google Scholar 

  13. Broy, M., Pepper, P., Wirsing, M.: On relations between programs. In: Robinet, B. (ed.). International Symposium on Programming. (Lect. Notes. Comput. Sci., Vol. 83, pp. 59–78) New York: Springer 1980

    Google Scholar 

  14. Burstall, R.M., Darlington, J.: Some transformations for developing recursive programs. J. ACM 24 (1) 44–67 (1977)

    Google Scholar 

  15. Dijkstra, E.W.: Notes on structured programming. In: Dahl, O.J., Dijkstra, E.W., Hoare, C.A.R. (eds.) Structured programming. New York London: Academic Press 1971

    Google Scholar 

  16. Dijkstra, E.W.: A discipline of programming. Englewood Cliffs: Prentice Hall 1976

    Google Scholar 

  17. Dijkstra, E.W., Gasteren, A.J.M.: A simple fixpoint argument without the restriction to continuity. Acta Informatica 23 1–7 (1986)

    Google Scholar 

  18. Gries, D.: The science of programming. Berlin Heidelberg New York: Springer 1981

    Google Scholar 

  19. Hehner, E.: Do considered od: a contribution to the programming calculus. Acta Informatica 11, 287–304 (1979)

    Google Scholar 

  20. Hehner, E.: The logic of programming. Englewood Cliffs: Prentice-Hall 1984

    Google Scholar 

  21. Hehner, E.: Predicative programming, part I. CACM 27 (2) 134–143 (1984)

    Google Scholar 

  22. Hoare, C.A.R.: An axiomatic basis for computer programming. CACM 12 (10) 576–580 (1969)

    Google Scholar 

  23. Hoare, C.A.R.: Proof of a program: FIND. CACM 14, 39–45 (1971)

    Google Scholar 

  24. Hoare, C.A.R.: Programs are predicates. In: Hoare, C.A.R., Shepherdson, J.C. (eds.) Mathematical logic and programming languages, pp. 141–155. Englewood Cliffs: Prentice-Hall 1985

    Google Scholar 

  25. Morgan, C.: The specification statement. Manuscript 1986

  26. Morris, J.: A theoretical basis for stepwise refinement and the programming calculus. Sci. Comput. Programming 9 287–306 (1987)

    Google Scholar 

  27. Jacobs, D., Gries, D.: General correctness. A unification of partial and total correctness. Acta Informatica 22 (1) 67–84 (1985)

    Google Scholar 

  28. Partsch, H., Steinbrugge, R.: Program transformation systems. ACM Comput. Surv. 15, 199–236 (1983)

    Google Scholar 

  29. Plotkin, G.D.: A powerdomain construction. SIAM J. Comput. 5 (3) 452–487 (1976)

    Google Scholar 

  30. Plotkin, G.D.: Structural approach to operational semantics. Tech. report DAIMI FN-19, Comp. Science Department, Aarhus University, 1981

  31. Reynolds, J.C.: The craft of programming. Englewood Cliffs: Prentice-Hall 1981

    Google Scholar 

  32. Scott, D.: Logic with denumerably long formulas and finite strings of quantifiers. In: Addison, J., Henkin, L., Tarski, A. (eds.) Symposium on the Theory of Models. North-Holland 1965, 329–341

  33. Smyth, M.B.: Power domains. J. Comput. Syst. Sci. 16, 23–36 (1978)

    Google Scholar 

  34. Wirth, N.: Program development by stepwise refinement. CACM 14 221–227 (1971)

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Rights and permissions

Reprints and permissions

About this article

Cite this article

Back, R.J.R. A calculus of refinements for program derivations. Acta Informatica 25, 593–624 (1988). https://doi.org/10.1007/BF00291051

Download citation

  • Received:

  • Issue Date:

  • DOI: https://doi.org/10.1007/BF00291051

Keywords

Navigation