Temporal preconditions of recursive procedures
The meaning of an imperative program is defined to be the precondition of the executions as a function of proposed behaviour. In the case of Dijkstra's weakest precondition, the proposed behaviour is termination in a state with a given postcondition. For the temporal predicate transformers of Lukkien, the proposed behaviour is specified in terms of predicates on the intermediate states. For example, for a command c and predicates p, q and r, the predicate wto.p.q.c.r is the precondition such that, for every execution sequence of c, a state in which p holds is eventually followed by a state in which q holds or by termination in a state in which r holds.
We present these precondition functions for a language with operators for sequential composition, unbounded demonic choice and recursive procedures. Recursion is interpreted by means of extreme fixpoints. The treatment of “eventually” is a straightforward generalization of the ordinary wp-calculus. For the treatment of “leads-to”, the new concept of accumulator turns out to be useful. The proofs of Lukkien's healthiness laws lead to insights in fixpoint induction. Some of the laws require the recursion to be guarded. It is shown that unfolding of the declaration preserves the semantics.
Keywordsweakest precondition recursive procedure leads-to eventually healthiness law guarded recursion unfolding
Unable to display preview. Download preview PDF.
- [KW]R.J.R. Back, J. von Wright: Refinement calculus, Part I: Sequential Nondeterministic Programs. In: J.W. de Bakker, W.-P. de Roever, G. Rozenberg (eds.): Stepwise Refinement of Distributed Systems. Lecture Notes in Computer Science 430 (Springer, Berlin, 1990) pp. 42–66.Google Scholar
- [Bak]J.W. de Bakker: Mathematical theory of program correctness. Prentice-Hall, 1980. [CM] K.M. Chandy, J. Misra : Parallel Program Design, A Foundation (Addison-Wesley, 1988).Google Scholar
- [Di]E.W. Dijkstra: A discipline of programming. Prentice-Hall 1976.Google Scholar
- [DS]E.W. Dijkstra, C.S. Scholten: Predicate calculus and program semantics. Springer V. 1990.Google Scholar
- [H1]W.H. Hesselink: Programs, Recursion and Unbounded Choice, predicate transformation semantics and transformation rules. Cambridge University Press 1992.Google Scholar
- [H2]W.H. Hesselink: Nondeterminacy and recursion via stacks and queues. Computing Science Notes Groningen CS 9109.Google Scholar
- [Lu]J.J. Lukkien: Parallel Program Design and Generalized Weakest Preconditions. Thesis, Groningen, 1991.Google Scholar
- [LS]J.J. Lukkien, J.L.A. van de Snepscheut: Weakest preconditions for progress. Formal Aspects of Computing 4 (1992) 195–236.Google Scholar
- [Mrg]C. Morgan: Programming from Specifications. Prentice Hall, 1990.Google Scholar
- [MG]C. Morgan, P.H.B. Gardiner: Data refinement by calculation. Acta Informatica 27 (1990) 481–503.Google Scholar
- [Mo1]J.M. Morris: A theoretical basis for stepwise refinement and the programming calculus. Science of Comp. Programming 9 (1987) 287–306.Google Scholar
- [Mo2]J.M. Morris: Temporal predicate transformers and fair termination. Acta Informatica 27 (1990) 287–313.Google Scholar