Journal of Computer Science and Technology

, Volume 8, Issue 2, pp 147–154

# Two new strategies for developing loop invariants and their applications

• Xue Jinyun
Regular Papers

## Abstract

The loop invariants take a very important role in the design, proof and derivation of the algorithmic program. We point out the limitations of the traditional standard strategy for developing loop invariants, and propose two new strategies for proving the existing algorithmic program and developing new ones. The strategies use recurrence as vehicle and integrate some effective methods of designing algorithms, e. g. Dynamic Programming, Greedy and Divide- Conquer, into the recurrence relation of problem solving sequence. This lets us get straightforward an approach for solving a variety of complicated problems, and makes the standard proof and formal derivation of their algorithmic programs possible. We show the method and advantages of applying the strategies with several typical nontrivial examples.

## Key words

Loop invariant standard proof and formal derivation of program recurrence relation algorithm design

## Preview

Unable to display preview. Download preview PDF.

## References

1. [1]
Dijkstra, E. W., A Discipline of Programming. Prentice Hall, Englewood Cliffs, 1976.
2. [2]
Dijkstra, E. W. and van Gasteren, A. J. M. A simple fixpoint argument without the restriction to continuity.Acta Informatica, 1986, 23, 1–7.
3. [3]
Gries, D., The Science of Programming. Springer Verlag, New York, 1981.
4. [4]
Gries, D., A note on a standard strategy for developing loop invariants and loops.Science of Computer Programming, 1982, 2, 207–214.
5. [5]
Gries, D. and Xue, Jinyun, Generating a Random Cyclic Permutation.BIT, 1988, 28, 569–572.
6. [6]
Gries, D. and Wadkins, J., An Introduction to Proofs of Program Correctness for Teacher of College-level Introduction, Programming Courses. TR90-1102, Dept. of CS, Cornell Univ., 1990.Google Scholar
7. [7]
Harel, D., Algorithmics: The Spirit of Computing. Addison-Wesley, 108–109, 1987.Google Scholar
8. [8]
Denning, P., A debate on teaching computing science.CACM., 1989, 32, 1397–1414.Google Scholar
9. [9]
Linger, R. C., Mills, H. D. and Witt, B. I., Structured Programming: Theory and Practice. Reading, Mass, Addison-Wesley, 1979.
10. [10]
Manna, Z. and Waldinger, R., Synthesizer: Dream⇒ Program.IEEE Transaction on Software Engineering, 1979, 5, 294–328.
11. [11]
Remmers, J., A technique for developing loop invariants.Information Processing Letters, 1984, 18, 137–139.
12. [12]
Xue, Jinyun and Gries, D., Developing a linear algorithm for cubing a cycle permutation.Science of Computer Programming, 1988, 11, 161–165.
13. [13]
Li Zhaoren, A formal method of programming and the experimental system.Chinese Journal of Computers, 1985, 8(1), 8–18.Google Scholar
14. [14]
Xue, Jinyun, On Loop Invariant and Its Developing Techniques. Proceedings of China 4th Conference On Software Engneering, 1991. (in Chinese).Google Scholar
15. [15]
Aho, A., Hopcroft, J. and Ullman, J., Data Structures and Algorithms. Addison-Wesley Publishing Company, 1983.Google Scholar