Formal Aspects of Computing

, Volume 2, Issue 1, pp 60–104 | Cite as

Command algebras, recursion and program transformation

  • Wim H. Hesselink
Article

Abstract

Dijkstra's language of guarded commands is extended with recursion and transformed into algebra. The semantics is expressed in terms of weakest preconditions and weakest liberal preconditions. Extreme fixed points are used to deal with recursion. Unbounded nondeterminacy is allowed. The algebraic setting enables us to develop efficient transformation rules for recursive procedures. The main result is an algebraic version of the rule of computational induction. In this version, certain parts of the programs are restricted to finite nondeterminacy. It is shown that without this restriction the rule would not be valid. Some applications of the rule are presented. In particular, we prove the correctness of an iterative stack implementation of a class of simple recursive procedures.

Key words

Command algebra Computational induction Fixpoint Lattice Non-determinacy/nondeterminism Program transformation Recursive procedure (or recursion) Semantic equivalence Semantics Stack Weakest precondition 

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. [Apt81]
    Apt, K. R.: Ten Years of Hoare's Logic. A Survey — Part 1. ACMTransactions on Programming Languages and Systems,3, 431–483 (1981).Google Scholar
  2. [Bac87]
    Back, R. J. R.: A calculus of refinements for program derivations.Dept. Comp. Sci. Abo Finland, Ser. A,54, (1987).Google Scholar
  3. [BBK87]
    Baeten, J. C. M., Bergstra, J. A. and Klop, J. W.: On the consistency of Koomen's fair abstraction rule.Theoretical Computer Science,51, 129–176 (1987).CrossRefGoogle Scholar
  4. [Bak80]
    Bakker, J. W. de:Mathematical Theory of Program Correctness, Prentice-Hall, 1980.Google Scholar
  5. [BaW81]
    Bauer, F. L. and Wossner H.:Algorithmische Sprache und Programmentwicklung, Springer-Verlag, 1981.Google Scholar
  6. [Dij76]
    Dijkstra, E. W.:A Discipline of Programming, Prentice-Hall, 1976.Google Scholar
  7. [Dij82]
    Dijkstra, E. W.:Selected Writings on Computing: a Personal Perspective, Springer-Verlag, 1982.Google Scholar
  8. [DiS90]
    Dijkstra, E. W. and Scholten, C. S.:Predicate Calculus and Program Semantics, Springer-Verlag (1990).Google Scholar
  9. [Gri81]
    Gries, D.:The Science of Programming., Springer-Verlag, 1981.Google Scholar
  10. [Hes88a]
    Hesselink, W. H.: Interpretations of Recursion Under Unbounded Nondeterminacy.Theoretical Computer Sceience,59, 211–234 (1988).Google Scholar
  11. [Hes89a]
    Hesselink, W. H.: Predicate Transformer Semantics of General Recursion (WHH 8).Acta Informatica,26, 309–332 (1989).Google Scholar
  12. [Hes88b]
    Hesselink, W. H.: An Algebraic Calculus of Commands (WHH 13). Tech. Rep. CS 8808, Groningen University, 1988.Google Scholar
  13. [Hes89b]
    Hesselink, W. H.: Modalities of Nondeterminacy. Draft, September 1989.Google Scholar
  14. [Hoa71]
    Hoare, C. A. R.: Procedures and Parameters: an Axiomatic Approach. In:Symposium on Semantics of Algorithmic Languages, E. Engeler (ed.), Lecture Notes in Math. 188, pp. 102–116, Springer-Verlag, 1971.Google Scholar
  15. [Hoa78]
    Hoare, C. A. R.: Some Properties of Predicate Transformers.J. ACM,25, 461–480 (1978).Google Scholar
  16. [Kel55]
    Kelley, J. L.:General Topology. Van Nostrand, 1955.Google Scholar
  17. [Lak76]
    Lakatos, I.:Proofs and Refutations: the Logic of Mathematical Discovery J. Worrall and E. Zahar, (eds), Cambridge University Press, 1976.Google Scholar
  18. [Man74]
    Manna, Z.:Mathematical Theory of Computation. McGraw-Hill, 1974.Google Scholar
  19. [Mor87]
    Morgan, C. C.: Data Refinement by Miracles.Information Processing Letters,26, 243–246 (1987/88).Google Scholar
  20. [MoG88]
    Morgan, C. C. and Gardiner, P. H. B.: Data refinement by calculation. Draft, July 1988.Google Scholar
  21. [Nel87]
    Nelson, G.: A generalization of Dijkstra's Calculus. ACM Transactions on Programming Languages and Systems11, 517–561 (1989).Google Scholar
  22. [TaZ71]
    Takeuti, G. and Zaring, W. M.:Introduction to Axiomatic Set Theory. Graduate texts in mathematics 1, Springer-Verlag, 1971.Google Scholar

Copyright information

© BCS 1990

Authors and Affiliations

  • Wim H. Hesselink
    • 1
  1. 1.Department of Computing ScienceRijksuniversiteit GroningenAV GroningenNetherlands

Personalised recommendations