Acta Informatica

, Volume 25, Issue 6, pp 593–624 | Cite as

A calculus of refinements for program derivations

  • R. J. R. Back
Article

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.

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. [ApPl86]
    Apt, K.R., Plotkin, G.D.: Countable nondeterminism and random assignment. J. ACM 33 (4) 724–767 (1986)Google Scholar
  2. [Ba78]
    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, 1978Google Scholar
  3. [Ba80]
    Back, R.J.R.: Correctness preserving program refinements: proof theory and applications. Mathematical Center Tracts 131, Mathematical Centre, Amsterdam 1980Google Scholar
  4. [Ba81a]
    Back, R.J.R.: Proving total correctness of nondeterministic programs in infinitary logic. Acta Informatica 15 233–250 (1981)Google Scholar
  5. [Ba81b]
    Back, R.J.R.: On correct refinement of programs. J. Comput. Syst. Sci. 23 (1), 49–68 (1981)Google Scholar
  6. [BaMaRa83]
    Back, R.J.R., Mannila, H., Raiha, K.J.: Derivation of efficient dag marking algorithms. ACM Conference on Principles of Programming Languages, Austin, Texas 1983Google Scholar
  7. [Ba87]
    Back, R.J.R.: Procedural abstraction in the refinement calculus. Reports on Computer Science and Mathematics no. 55, 1987, Abo AkademiGoogle Scholar
  8. [Ba88]
    Back, R.J.R.: Derivation of a dag marking algorithm in the refinement calculus (in preparation)Google Scholar
  9. [deB80]
    deBakker, J.: Mathematical theory of program correctness, Englewood Cliffs: Prentice-Hall 1980Google Scholar
  10. [BBPPW79]
    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 1979Google Scholar
  11. [BeBi86]
    Berlioux, P., Bizard, P.: Algorithms; the construction, proof and analysis of programs. New York: Wiley 1986Google Scholar
  12. [Bo82]
    Boom, H.J.: A weaker precondition for loops. TOPLAS 4 (4), 668–677 (1982)Google Scholar
  13. [BrPeWi80]
    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 1980Google Scholar
  14. [BuDa771]
    Burstall, R.M., Darlington, J.: Some transformations for developing recursive programs. J. ACM 24 (1) 44–67 (1977)Google Scholar
  15. [Di71]
    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 1971Google Scholar
  16. [Di76]
    Dijkstra, E.W.: A discipline of programming. Englewood Cliffs: Prentice Hall 1976Google Scholar
  17. [DiGa86]
    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. [Gr81]
    Gries, D.: The science of programming. Berlin Heidelberg New York: Springer 1981Google Scholar
  19. [He79]
    Hehner, E.: Do considered od: a contribution to the programming calculus. Acta Informatica 11, 287–304 (1979)Google Scholar
  20. [He84]
    Hehner, E.: The logic of programming. Englewood Cliffs: Prentice-Hall 1984Google Scholar
  21. [He84b]
    Hehner, E.: Predicative programming, part I. CACM 27 (2) 134–143 (1984)Google Scholar
  22. [Ho69]
    Hoare, C.A.R.: An axiomatic basis for computer programming. CACM 12 (10) 576–580 (1969)Google Scholar
  23. [Ho71]
    Hoare, C.A.R.: Proof of a program: FIND. CACM 14, 39–45 (1971)Google Scholar
  24. [Ho85]
    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 1985Google Scholar
  25. [Morg86]
    Morgan, C.: The specification statement. Manuscript 1986Google Scholar
  26. [Morr87]
    Morris, J.: A theoretical basis for stepwise refinement and the programming calculus. Sci. Comput. Programming 9 287–306 (1987)Google Scholar
  27. [JaGr85]
    Jacobs, D., Gries, D.: General correctness. A unification of partial and total correctness. Acta Informatica 22 (1) 67–84 (1985)Google Scholar
  28. [PaST83]
    Partsch, H., Steinbrugge, R.: Program transformation systems. ACM Comput. Surv. 15, 199–236 (1983)Google Scholar
  29. [Pl76]
    Plotkin, G.D.: A powerdomain construction. SIAM J. Comput. 5 (3) 452–487 (1976)Google Scholar
  30. [Pl81]
    Plotkin, G.D.: Structural approach to operational semantics. Tech. report DAIMI FN-19, Comp. Science Department, Aarhus University, 1981Google Scholar
  31. [Re81]
    Reynolds, J.C.: The craft of programming. Englewood Cliffs: Prentice-Hall 1981Google Scholar
  32. [Sc65]
    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–341Google Scholar
  33. [Sm78]
    Smyth, M.B.: Power domains. J. Comput. Syst. Sci. 16, 23–36 (1978)Google Scholar
  34. [Wi71]
    Wirth, N.: Program development by stepwise refinement. CACM 14 221–227 (1971)Google Scholar

Copyright information

© Springer-Verlag 1988

Authors and Affiliations

  • R. J. R. Back
    • 1
  1. 1.Department of Computer ScienceAbo AkademiTurkuFinland

Personalised recommendations