Skip to main content
Log in

The co-invariant generator: An aid in deriving loop bodies

  • Published:
Formal Aspects of Computing

Abstract

Given a loop invariant,I, and an assignment,α, which decreases the variant, we define a constructive function, cg, called the co-invariant generator, which has the property thatIΛ cg (α, I) ⇒ wp (α, I), where wp (α, I) is the weakest precondition forα to establish I. Several results about the co-invariant generator are proved, important special cases are considered, and a non-trivial example of its use in deriving the body of a loop is given. We also define a function which performs a related constructive action on terms formed from binary operations. The coinvariant generator makes a useful contribution to formalising and automating a key step in program derivation.

This is a preview of subscription content, log in via an institution to check access.

Access this article

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Similar content being viewed by others

References

  1. Backhouse, R. C.:Program Construction and Verification, Prentice Hall, London, 1986.

    Google Scholar 

  2. Dijkstra, E. W.:A Discipline of Programming, Prentice-Hall, Englewood Cliffs, N.J. 1976.

    MATH  Google Scholar 

  3. Dijkstra, E. W. and Feijen, W. H. J.:A Method of Programming, Addison-Wesley, Wokingham, England, 1988.

    MATH  Google Scholar 

  4. Dromey, R. G.: Derivation of Sorting Algorithms from a Specification.The Computer Journal,30, 512–518 (1987).

    Article  MATH  Google Scholar 

  5. Dromey, R. G.:Program Derivation, Addison-Wesley, Sydney, 1989.

    MATH  Google Scholar 

  6. Dromey, R. G. and Billington, D.: Stepwise Program Derivation. Research Report43, School of Computing and Information Technology, Griffith University, Nathan, Brisbane, Queensland, 4111, Australia, 1991

    Google Scholar 

  7. Enderton, H. B.:Elements of Set Theory, Academic Press, Orlando, 1977.

    MATH  Google Scholar 

  8. Fitting, M.:First-Order Logic and Automated Theorem Proving, Springer-Verlag, New York, 1990.

    Book  MATH  Google Scholar 

  9. Gries, D.:The Science of Programming, Springer-Verlag, New York, 1981.

    Book  MATH  Google Scholar 

  10. Gries, D.: A Note on a Standard Strategy for Developing Loop Invariants and Loops.Science of Computer Programming,2, 207–217 (1982).

    Article  MATH  MathSciNet  Google Scholar 

  11. Kaldewaij, A.:Programming: The Derivation of Algorithms, Prentice Hall, New York, 1990.

    Google Scholar 

  12. Nerode, A. and Shore, R. A.:Logic for Applications, Springer-Verlag, New York, 1993.

    Book  MATH  Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to David Billington.

Electronic supplementary material

Rights and permissions

Reprints and permissions

About this article

Check for updates. Verify currency and authenticity via CrossMark

Cite this article

Billington, D., Dromey, R.G. The co-invariant generator: An aid in deriving loop bodies. Formal Aspects of Computing 8, 108–126 (1996). https://doi.org/10.1007/BF01211053

Download citation

  • Received:

  • Accepted:

  • Published:

  • Issue Date:

  • DOI: https://doi.org/10.1007/BF01211053

Keywords

Navigation