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.
Similar content being viewed by others
References
Apt, K.R., Plotkin, G.D.: Countable nondeterminism and random assignment. J. ACM 33 (4) 724–767 (1986)
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
Back, R.J.R.: Correctness preserving program refinements: proof theory and applications. Mathematical Center Tracts 131, Mathematical Centre, Amsterdam 1980
Back, R.J.R.: Proving total correctness of nondeterministic programs in infinitary logic. Acta Informatica 15 233–250 (1981)
Back, R.J.R.: On correct refinement of programs. J. Comput. Syst. Sci. 23 (1), 49–68 (1981)
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
Back, R.J.R.: Procedural abstraction in the refinement calculus. Reports on Computer Science and Mathematics no. 55, 1987, Abo Akademi
Back, R.J.R.: Derivation of a dag marking algorithm in the refinement calculus (in preparation)
deBakker, J.: Mathematical theory of program correctness, Englewood Cliffs: Prentice-Hall 1980
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
Berlioux, P., Bizard, P.: Algorithms; the construction, proof and analysis of programs. New York: Wiley 1986
Boom, H.J.: A weaker precondition for loops. TOPLAS 4 (4), 668–677 (1982)
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
Burstall, R.M., Darlington, J.: Some transformations for developing recursive programs. J. ACM 24 (1) 44–67 (1977)
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
Dijkstra, E.W.: A discipline of programming. Englewood Cliffs: Prentice Hall 1976
Dijkstra, E.W., Gasteren, A.J.M.: A simple fixpoint argument without the restriction to continuity. Acta Informatica 23 1–7 (1986)
Gries, D.: The science of programming. Berlin Heidelberg New York: Springer 1981
Hehner, E.: Do considered od: a contribution to the programming calculus. Acta Informatica 11, 287–304 (1979)
Hehner, E.: The logic of programming. Englewood Cliffs: Prentice-Hall 1984
Hehner, E.: Predicative programming, part I. CACM 27 (2) 134–143 (1984)
Hoare, C.A.R.: An axiomatic basis for computer programming. CACM 12 (10) 576–580 (1969)
Hoare, C.A.R.: Proof of a program: FIND. CACM 14, 39–45 (1971)
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
Morgan, C.: The specification statement. Manuscript 1986
Morris, J.: A theoretical basis for stepwise refinement and the programming calculus. Sci. Comput. Programming 9 287–306 (1987)
Jacobs, D., Gries, D.: General correctness. A unification of partial and total correctness. Acta Informatica 22 (1) 67–84 (1985)
Partsch, H., Steinbrugge, R.: Program transformation systems. ACM Comput. Surv. 15, 199–236 (1983)
Plotkin, G.D.: A powerdomain construction. SIAM J. Comput. 5 (3) 452–487 (1976)
Plotkin, G.D.: Structural approach to operational semantics. Tech. report DAIMI FN-19, Comp. Science Department, Aarhus University, 1981
Reynolds, J.C.: The craft of programming. Englewood Cliffs: Prentice-Hall 1981
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
Smyth, M.B.: Power domains. J. Comput. Syst. Sci. 16, 23–36 (1978)
Wirth, N.: Program development by stepwise refinement. CACM 14 221–227 (1971)
Author information
Authors and Affiliations
Rights 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
Received:
Issue Date:
DOI: https://doi.org/10.1007/BF00291051