Skip to main content
Log in

Generation of correctness conditions for imperative programs

  • Published:
Programming and Computer Software Aims and scope Submit manuscript

Abstract

Verification of imperative programs in the sense of Floyd-Hoare is an approach to proving correctness of programs annotated by preconditions, postconditions, and loop invariants. It is based on generation of correctness conditions. In the structured deterministic case, the problem of generation of correctness conditions seems trivial, since it is solved by a syntax-driven algorithm, the complexity of which linearly depends on the number of control constructs. Vice versa, in the unstructured nondeterministic case, it seems a priori clear that the complexity of generation of the correctness conditions exponentially depends on the number of statements in the program. In the paper, an efficient and complete algorithm for the generation of the correctness conditions is presented and justified. It can be used both in the structured deterministic and unstructured nondeterministic cases. The algorithm complexity linearly depends on the number of control constructs and/or program statements.

This is a preview of subscription content, log in via an institution to check access.

Access this article

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Similar content being viewed by others

References

  1. Hoare, C.A.R., The Verifying Compiler: A Grand Challenge for Computing Research, in Lecture Notes in Computer Science (Proc. of Conf. “Perspectives of System Informatics” (PSI 2003)), 2003, vol. 2890, pp. 103–111.

    Google Scholar 

  2. Floyd, R.W., Assigning Meanings to Programs, in Mathematical Aspects of Computer Science (Proc. of Symp. in Applied Mathematics), 1967, vol. 19, pp. 19–32.

    MathSciNet  Google Scholar 

  3. Hoare, C.A.R. and Wirth, N., An Axiomatic Definition of the Programming Language PASCAL, Acta Informatica, 1973, no. 2, pp. 335–355.

  4. Dijkstra, E.W., A Discipline of Programming, Englewood Cliffs (USA): Prentice-Hall, 1976. Translated under the title Distsiplina programmirovaniya, Moscow: Mir, 1978.

    MATH  Google Scholar 

  5. Flanagan, C. and Saxe, J.B., Avoiding Exponential Explosion: Generating Compact Verification Conditions, Proc. of the 28th ACM SIGPLAN-SIGACT Symp. on Principles of Programming Languages, 2001, pp. 193–205.

  6. Barnett, M. and Leino, K.R.M., Weakest Precondition of Unstructured Programs, Proc. of Workshop on Program Analysis for Software Tools and Engineering (PASTE), 2005, pp. 82–87.

  7. Bodin, E.V., Kalinina, N.A., and Shilov, N.V., Verifying Compiler F@BOOL@. Part I: General Description of the F@BOOL@ Project and Its Relation to Component Programming. Mini-NIL: Prototype of the Language of Virtual Machine of the F@BOOL@ Project, Preprint of Ershov Inst. of Information Systems, Siberian Division, Russ. Acad. Sci., Novosibirsk, 2005, no. 131.

  8. Bodin, E.V., Kalinina, N.A., and Shilov, N.V., Verifying Compiler F@BOOL@. Part II: Logical Annotations in the Mini-NIL Language and Their Static and Dynamic Semantics, Preprint of Ershov Inst. of Information Systems, Siberian Division, Russ. Acad. Sci., Novosibirsk, 2006, no. 138.

  9. Anureev, I.S., Bodin, E.V., and Shilov, N.V., Efficient Generation of Verification Conditions for Nondeterministic Unstructured Programs, Bulletin Novosibirsk Computing Center, 2007, vol. 26, pp. 39–63.

    Google Scholar 

  10. Nepomniaschy, V.A., Anureev, I.S., Dubranovskii, A.V., and Promsky, A.V., Towards Verification of C# Programs: A Three-Level Approach, Programmirovanie, 2006, no. 4, pp. 4–20 [Programming Comput. Software (Engl. Transl.), 2006, vol. 32, no. 4, pp. 190–202].

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to N. V. Shilov.

Additional information

Original Russian Text © N.V. Shilov, I.S. Anureev, E.V. Bodin, 2008, published in Programmirovanie, 2008, Vol. 34, No. 6.

Rights and permissions

Reprints and permissions

About this article

Cite this article

Shilov, N.V., Anureev, I.S. & Bodin, E.V. Generation of correctness conditions for imperative programs. Program Comput Soft 34, 307–321 (2008). https://doi.org/10.1134/S0361768808060029

Download citation

  • Received:

  • Published:

  • Issue Date:

  • DOI: https://doi.org/10.1134/S0361768808060029

Keywords

Navigation