Skip to main content

Computing Preconditions and Postconditions of While Loops

  • Conference paper
Theoretical Aspects of Computing – ICTAC 2011 (ICTAC 2011)

Part of the book series: Lecture Notes in Computer Science ((LNTCS,volume 6916))

Included in the following conference series:

Abstract

Weakest preconditions were introduced by Dijkstra as a tool to define the semantics of programming constructs, and thereby as a means to prove the correctness of programs; the dual concept of strongest postcondition was introduced subsequently as an alternative means for the same ends. In this paper, we present and discuss a method to compute weakest preconditions and strongest postconditions of while loops in a C-like programming language; to this effect, we use the concept of invariant relation. Whereas the task of computing weakest preconditions and strongest postconditions of while loops is usually approached by limiting the number of iterations and applying successive sequential compositions, invariant relations afford us a crisper, closed form solution.

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

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 54.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 69.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. Barnett, M., Rustan Leino, K.: Weakest precondition of unstructured programs. In: Proceedings, Sixth ACM SIGPLAN-SIGSOFT Workshop on Program Analysis for Software Tools and Engineering, Lisbon, Portugal (2005)

    Google Scholar 

  2. Berghammer, R.: Soundness of a purely syntactical formalization of weakest preconditions. Electronic Notes in Theoretical Computer Science. Elsevier Science Publisher, Amsterdam (2000)

    MATH  Google Scholar 

  3. Boudriga, N., Elloumi, F., Mili, A.: The lattice of specifications: Applications to a specification methodology. Formal Aspects of Computing 4, 544–571 (1992)

    Article  MATH  Google Scholar 

  4. Brumley, D., Wang, H., Jha, S., Song, D.: Creating vulnerability signatures using weakest preconditions. In: Proceedings, 20th Computer Security Foundations Symposium, Venice, Italy, pp. 311–325 (2007)

    Google Scholar 

  5. Cavalcanti, A., Naumann, D.: A weakest precondition semantics for refinement of object oriented programs. IEEE Transactions on Software Engineering 26(8), 713–728 (2000)

    Article  Google Scholar 

  6. Costa, M., Castro, M., Zhou, L., Zhang, L., Peinado, M.: Bouncer: Securing software by blocking bad input. In: Proceedings, ACM Symposium on Operating Systems Principles (October 2007)

    Google Scholar 

  7. Dijkstra, E.W.: Guarded commands, non dterminacy, and formal derivation of programs. Communications of the ACM 18(8), 453–457 (1975)

    Article  MathSciNet  MATH  Google Scholar 

  8. Dijkstra, E.W.: A Discipline of Programming. Prentice-Hall, Englewood Cliffs (1976)

    MATH  Google Scholar 

  9. Flanagan, C., Qadeer, S.: Predicate abstraction for software verification. In: Proceedings, POPL 2002: The 29th SIGPLAN-SIGACT Symposium on Principles of Programming Languages (2002)

    Google Scholar 

  10. Flanagan, C., Saxe, J.B.: Avoiding exponential explosion: Generating compact verification conditions. In: Proceedings, Symposium on Principles of Programming Languages (2001)

    Google Scholar 

  11. Gannod, G.C., Cheng, B.H.C.: Strongest postcondition semantics as the formal basis for reverse engineering. In: Proceedings, Second Working Conference on Reverse Engineering, Toronto, Ontario, Canada, pp. 188–197 (1995)

    Google Scholar 

  12. Gries, D.: The Science of programming. Springer, Heidelberg (1981)

    Book  MATH  Google Scholar 

  13. Grigore, R., Charles, J., Fairmichael, F., Kiniry, J.: Strongest postcondition of unstructured programs. In: Proceedings of the 11th International Workshop on Formal Techniques for Java-like Programs (2009)

    Google Scholar 

  14. Gulwani, S., Srivastava, S., Venkatesan, R.: Program analysis as constraint solving. In: Proceedings, PLDI 2008: ACM SIGPLAN 2008 Conference on Programming Languages and their Implementation, Tuscon, AZ (2008)

    Google Scholar 

  15. Hoare, C.A.R.: An axiomatic basis for computer programming. Communications of the ACM 12(10), 576–583 (1969)

    Article  MATH  Google Scholar 

  16. Jager, I., Brumley, D.: Efficient directionless weakest preconditions. Technical Report CMU-CyLab-10-002, Carnegie Mellon University (February 2010)

    Google Scholar 

  17. Leino, K.R.M.: Efficient weakest preconditions. Information Processing Letters 93(6), 281–288 (2005)

    Article  MathSciNet  MATH  Google Scholar 

  18. Leino, K.R.: Towards reliable modular programs. Technical report, California Institute of Technology, Pasadena, CA (1995)

    Google Scholar 

  19. Louhichi, A., Mraihi, O., Jilani, L.L., Mili, A.: Invariant assertions, invariant relations and invariant functions. In: Proceedings, 2nd International Workshop on Invariant Generation, York, UK (2009)

    Google Scholar 

  20. Manna, Z.: A Mathematical Theory of Computation. McGraw-Hill, New York (1974)

    MATH  Google Scholar 

  21. Mili, A., Aharon, S., Nadkarni, C.: Mathematics for reasoning about loop. Science of Computer Programming, 989–1020 (2009)

    Google Scholar 

  22. Morgan, C.C.: Programming from Specifications. International Series in Computer Sciences. Prentice Hall, London (1998)

    MATH  Google Scholar 

  23. Necula, G.C.: Proof carrying code. In: Proceedings, Symposium on Principles of Programming Languages (1997)

    Google Scholar 

  24. Rauch, N.: Precondition generation for a Java subset. In: Proceedings, FM-TOOLS 2002: The Fifth Workshop on Tools for System Design and Verification, Reisensberg, Germany (2002)

    Google Scholar 

  25. von Oheimb, D.: Analyzing java in isabelle/hol: Formalization, type safety, and hoare logic. Technical report, Technische Universitaet Muenchen (2001)

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2011 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Mraihi, O., Ghardallou, W., Louhichi, A., Labed Jilani, L., Bsaies, K., Mili, A. (2011). Computing Preconditions and Postconditions of While Loops. In: Cerone, A., Pihlajasaari, P. (eds) Theoretical Aspects of Computing – ICTAC 2011. ICTAC 2011. Lecture Notes in Computer Science, vol 6916. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-642-23283-1_13

Download citation

  • DOI: https://doi.org/10.1007/978-3-642-23283-1_13

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-642-23282-4

  • Online ISBN: 978-3-642-23283-1

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics