Abstract
Program verification is usually done by adding specifications and invariants to the program and then proving that the verification conditions are all true. This makes program verification an alternative to or a complement to testing. We study here an another approach to program construction, which we refer to as invariant based programming, where we start by formulating the specifications and the internal loop invariants for the program, before we write the program code itself. The correctness of the code is then easy to check at the same time as one is constructing it. In this approach, program verification becomes a complement to coding rather than to testing. The purpose is to produce programs and software that are correct by construction. We present a new kind of diagrams, nested invariant diagrams, where program specifications and invariants (rather than the control) provide the main organizing structure. Nesting of invariants provide an extension hierarchy that allows us to express the invariants in a very compact manner. We study the feasibility of formulating specifications and loop invariants before the code itself has been written. We propose that a systematic use of figures, in combination with a rough idea of the intended behavior of the algorithm, makes it rather straightforward to formulate the invariants needed for the program, to construct the code around these invariants and to check that the resulting program is indeed correct.
This is a preview of subscription content, log in via an institution.
Buying options
Tax calculation will be finalised at checkout
Purchases are for personal use only
Learn about institutional subscriptionsPreview
Unable to display preview. Download preview PDF.
References
Back, R., Myreen, M.: Tool support for invariant based programming. In: Proceedings of the 12th Asia-Pacific Software Engineering Conference, Taipei, Taiwan (December 2005)
Back, R.-J.: Program construction by situation analysis. Research Report 6, Computing Centre, University of Helsinki, Helsinki, Finland (1978)
Back, R.-J.: Exception handling with multi-exit statements. In: Hoffmann, H.J. (ed.) 6th Fachtagung Programmiersprachen und Programmentwicklungen, Darmstadt. Informatik Fachberichte, vol. 25, pp. 71–82. Springer, Heidelberg (1980)
Back, R.-J.: Invariant based programs and their correctness. In: Biermann, W., Guiho, G., Kodratoff, Y. (eds.) Automatic Program Construction Techniques, pp. 223–242. MacMillan Publishing Company, Basingstoke (1983)
Barnett, M., Leino, K.R.M., Schulte, W.: The spec-sharp programming system: An overview. In: Barthe, G., Burdy, L., Huisman, M., Lanet, J.-L., Muntean, T. (eds.) CASSIS 2004. LNCS, vol. 3362, pp. 49–69. Springer, Heidelberg (2005)
Burdy, L., Cheon, Y., Cok, D.R., Ernst, M.D., Kiniry, J.R., Leavens, G.T., Leino, K.R.M., Poll, E.: An overview of jml tools and applications. Software Tools for Technology Transfer 7(3) (June 2005)
Dijkstra, E.W.: A constructive approach to the problem of program correctness. BIT 8, 174–186 (1968)
Dijkstra, E.W.: Notes on structured programming. In: Dahl, O.-J., Hoare, C.A.R., Dijkstra, E.W. (eds.) Structured Programming. Academic Press, New York (1972)
Dijkstra, E.W.: A Discipline of Programming. Prentice-Hall, Englewood Cliffs (1976)
Fowler, M.: UML Distilled. Addison-Wesley, Reading (1999)
Harel, D.: State charts: a visual formalism for complex systems. Science of Computer Programming 8, 231–274 (1987)
Hehner, E.: Do considered od: a contribution to the programming calculus. Acta Informatica 11, 287–304 (1979)
Leino, K.R.M., Nelson, G.: An extended static checker for modula-3. In: Koskimies, K. (ed.) CC 1998. LNCS, vol. 1383, pp. 302–305. Springer, Heidelberg (1998)
Nelson, G.: Techniques for Program Verification. PhD thesis, Stanford University (1980)
Owre, S., Shankar, N., Rushby, J.: Pvs: A prototype verification system. In: Kapur, D. (ed.) CADE 1992. LNCS, vol. 607. Springer, Heidelberg (1992)
Reynolds, J.C.: Programming with transition diagrams. In: Gries, D. (ed.) Programming Methodology. Springer, Berlin (1978)
van Emden, M.H.: Programming with verification conditions. IEEE Transactions on Software Engineering SE-5 (1979)
Van Rossum, G., Drake Jr., F.L.: The Python Tutorial - An Introduction to Python. Network Theory Ltd. (2003)
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2006 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Back, RJ. (2006). Invariant Based Programming. In: Donatelli, S., Thiagarajan, P.S. (eds) Petri Nets and Other Models of Concurrency - ICATPN 2006. ICATPN 2006. Lecture Notes in Computer Science, vol 4024. Springer, Berlin, Heidelberg. https://doi.org/10.1007/11767589_1
Download citation
DOI: https://doi.org/10.1007/11767589_1
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-34699-9
Online ISBN: 978-3-540-34700-2
eBook Packages: Computer ScienceComputer Science (R0)