Generation of invariants in theorema
2003
Abstract
Explicitly stated program invariants can help programmers by identifying program properties that must be preserved when modifying code. In practice, in most of the cases, however, these invariants are usually implicit. In this paper we present an alternative to expecting programmers to fully annotate code with invariants, namely a method for automatically generation of invariants from the program itself, using an implementation of a prototype verification condition generator for imperative programs. The generator is part of the Theorema system, a computer aided mathematical assistant which offers automated reasoning and computer algebra facilities. We use Hoare Logic and the weakest precondition strategy, and we propose a novel method for analyzing loop constructs by aid of algebraic computations: combinatorial summation and equational elimination. The verification conditions for programs containing loops are generated fully automatically, in a form which can be immediately used by the automatic provers of Theorema in order to check whether they hold.
References (22)
- ***. PStndfor Pascal Verifier -User Manual. Computer Science Department, Stanford University, 1979.
- J.H. Andrews. Testing using log file analysis: tools, methods and issues. In 13th Annual In- ternational Conference on Automated Software Engineering (ASE'98), October 1998. Honolulu, Hawaii.
- J. Barnes. High Integrity Software -The Spark Approach to Safety and Security. Addison-Wesley, 2003.
- S.M.German; B.Wegbreit. A synthesizer of inductive assertions . In IEEE Transactions on Software Engineering, March 1975. 1(1):68-75.
- B. Buchberger et al. The Theorema Project: A Progress Report. In M. Kerber and M. Kohlhase, editors, Calculemus 2000: Integration of Symbolic Computation and Mechanized Reasoning. A. K. Peters, Natick, Massatchussets, 2000.
- G. Futschek. Programmentwicklung und Verifikation. Springer, 1989.
- D. Gries. The Science of Programming. Springer, 1981.
- C. A. R. Hoare. An axiomatic basis for computer programming. Comm. ACM, 12, 1969.
- M. Kirchner. Program verification with the mathematical software system Theorema. Technical Report 99-16, RISC-Linz, Austria, 1999. PhD Thesis.
- D. E. Knuth. The Art of Computer Programming, volume 2 / Seminumerical Algorithms. Addison- Wesley, 2nd edition, 1969.
- L. Kovács. Program Verification using Hoare Logic. In Computer Aided Verification of Information Systemsm Romanian-Austrian Workshop, 2003. Timisoara, Romania, February 2003.
- B. Buchberger; F. Lichtenberger. Mathematics for Computer Science I -The Method of Mathe- matics. (German.). Springer, Berlin, Heidelberg, New York, 315 pages, 2nd edition, 1981. (First Edition 1980).
- M. Ward; F.W. Callis; M. Munro. The maintainer's assistant. In Proceedings of the International Conference on Software Maintenance 1989, pages 307-315, 1989. Miami, Florida.
- K. Nakagawa. Logico-Grafic Symbols in Theorema. In LMCS'02 (Logic, Mathematics, and Com- puter Science: Interactions, 2002. RISC-Linz technical report 02-60.
- M.D. Ernst; J. Cockrell; W.G.Griswold; D. Notkin. Dynamically discovering likely program in- variants to support program evaluation. Technical report, 2000. April 24.
- R.L. Graham; D.E. Knuth; O. Patashnik. Concrete Mathematics, 2nd ed. Addison-Wesley Publish- ing Company, 1989. pg. 306-330.
- L. Kovács; N. Popov. Procedural Program Verification in Theorema. In Omega-Theorema Work- shop, May 2003. Hagenberg, Austria.
- R.W.Gosper. decision procedures for indefinite hypergeometric summation. 75:40-42, 1978.
- P. Paule; M. Schorn. a Mathematica version of Zeilberger's algorithm for proving binomial coeffi- cient identities. 20(5-6):673-698, 1995.
- M.P. Ward. Program analysis by formal transformation. 39:598-618, 1996.
- B. Wegbreit. The synthesis of loop predicates. In Communication of the ACM, February 1974. 17(2):102-112.
- S. Wolfram. The Mathematica Book, 3rd ed. Wolfram Media / Cambridge University Press, 1996.