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

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.

[1]  David Gries,et al.  The Science of Programming , 1981, Text and Monographs in Computer Science.

[2]  Edsger W. Dijkstra,et al.  A method of programming , 1988 .

[3]  Anne Kaldewaij,et al.  Programming - the derivation of algorithms , 1990, Prentice Hall international series in computer science.

[4]  David Gries,et al.  A Note on a Standard Strategy for Developing Loop Invariants and Loops , 1982, Sci. Comput. Program..

[5]  Anil Nerode,et al.  Logic for Applications , 1997, Graduate Texts in Computer Science.

[6]  Edsger W. Dijkstra,et al.  A Discipline of Programming , 1976 .

[7]  H. Enderton Elements of Set Theory , 1977 .

[8]  Melvin Fitting,et al.  First-Order Logic and Automated Theorem Proving , 1990, Graduate Texts in Computer Science.

[9]  R. Geoff Dromey,et al.  Derivation of Sorting Algorithms from a Specification , 1987, Comput. J..

[10]  Roland Carl Backhouse,et al.  Program construction and verification , 1986, PHI Series in computer science.