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.
Similar content being viewed by others
References
Backhouse, R. C.:Program Construction and Verification, Prentice Hall, London, 1986.
Dijkstra, E. W.:A Discipline of Programming, Prentice-Hall, Englewood Cliffs, N.J. 1976.
Dijkstra, E. W. and Feijen, W. H. J.:A Method of Programming, Addison-Wesley, Wokingham, England, 1988.
Dromey, R. G.: Derivation of Sorting Algorithms from a Specification.The Computer Journal,30, 512–518 (1987).
Dromey, R. G.:Program Derivation, Addison-Wesley, Sydney, 1989.
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
Enderton, H. B.:Elements of Set Theory, Academic Press, Orlando, 1977.
Fitting, M.:First-Order Logic and Automated Theorem Proving, Springer-Verlag, New York, 1990.
Gries, D.:The Science of Programming, Springer-Verlag, New York, 1981.
Gries, D.: A Note on a Standard Strategy for Developing Loop Invariants and Loops.Science of Computer Programming,2, 207–217 (1982).
Kaldewaij, A.:Programming: The Derivation of Algorithms, Prentice Hall, New York, 1990.
Nerode, A. and Shore, R. A.:Logic for Applications, Springer-Verlag, New York, 1993.
Author information
Authors and Affiliations
Corresponding author
Electronic supplementary material
Rights and permissions
About this article
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
Received:
Accepted:
Published:
Issue Date:
DOI: https://doi.org/10.1007/BF01211053