# A calculus for predicative programming

## Abstract

A calculus for developing programs from specifications written as predicates that describe the relationship between the initial and final state is proposed. Such specifications are well known from the specification language Z. All elements of a simple sequential programming notation are defined in terms of predicates. Hence programs form a subset of specifications. In particular, sequential composition is defined by ‘demonic composition’, non-deterministic choice by ‘demonic disjunction’, and iteration by fixed points. Laws are derived which allow proving equivalence and refinement of specifications and programs by a series of steps. The weakest precondition calculus is also included. The approach is compared to the predicative programming approach of E. Hehner and to other refinement calculi.

## Preview

Unable to display preview. Download preview PDF.

## References

- 1.Back, R. J. R. A Calculus of Refinement for Program Derivations.
*Acta Informatica***23**(1988).Google Scholar - 2.Dijkstra, E. W.
*A Discipline of Programming*. Prentice Hall, 1976.Google Scholar - 3.Dijkstra, E. W. and C. S. Scholten.
*Predicate Calculus and Program Semantics*. Springer-Verlag, 1990.Google Scholar - 4.Gravell, A. Constructive Refinement of First Order Specifications. to appear in
*Proceedings of the 5th Refinement Workshop*, Springer-Verlag, 1992.Google Scholar - 5.Hehner, E. C. R. Predicative Programming — Parts I and II.
*Communications of the ACM***27, 2**(1984).Google Scholar - 6.Hehner, E. C. R., L. E. Gupta, and A. J. Malton. Predicative Methodology.
*Acta Informatica***23**(1986).Google Scholar - 7.Hehner, E. C. R. Termination is Timing. In J. L. A. van de Snepscheut (Ed.)
*Mathematics of Program Construction*, Springer-Verlag, 1989.Google Scholar - 8.Hoare, C. A. R. and He Jifeng. The weakest prespecification.
*Fundamenta Informaticae***9**(1986).Google Scholar - 9.Hoare, C. A. R., I. J. Hayes, He Jifeng, C. C. Morgan, A. W. Roscoe, J. W. Sanders, I. H. Sorensen, J. M. Spivey, and B. A. Sufrin. Laws of Programming.
*Communications of the ACM***30, 8**(1987).Google Scholar - 10.King, S. Z and the Refinement Calculus. In D. Bjorner, C. A. R. Hoare, J. Langmaack (Eds.)
*VDM '90: VDM and Z — Formal Methods in Software Development*Springer-Verlag, 1990.Google Scholar - 11.Morgan, C. The Specification Statement.
*ACM Transactions on Programming Languages and Systems***10, 3**(1988).Google Scholar - 12.Morgan, C.
*Programming from Specifications*. Prentice Hall, 1990.Google Scholar - 13.Morris, J. M. Programs from Specifications. In Dijkstra, E. W. (Ed.)
*Formal Development of Programs and Proofs*. Addison Wesley, 1990.Google Scholar - 14.Nelson, G. A Generalization of Dijkstra's Calculus.
*ACM Transactions on Programming Languages and Systems***11, 4**(1989).Google Scholar - 15.Spivey, J. M.
*The Z Reference Manual*. Prentice Hall, 1989.Google Scholar