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.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
References
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)
Berghammer, R.: Soundness of a purely syntactical formalization of weakest preconditions. Electronic Notes in Theoretical Computer Science. Elsevier Science Publisher, Amsterdam (2000)
Boudriga, N., Elloumi, F., Mili, A.: The lattice of specifications: Applications to a specification methodology. Formal Aspects of Computing 4, 544–571 (1992)
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)
Cavalcanti, A., Naumann, D.: A weakest precondition semantics for refinement of object oriented programs. IEEE Transactions on Software Engineering 26(8), 713–728 (2000)
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)
Dijkstra, E.W.: Guarded commands, non dterminacy, and formal derivation of programs. Communications of the ACM 18(8), 453–457 (1975)
Dijkstra, E.W.: A Discipline of Programming. Prentice-Hall, Englewood Cliffs (1976)
Flanagan, C., Qadeer, S.: Predicate abstraction for software verification. In: Proceedings, POPL 2002: The 29th SIGPLAN-SIGACT Symposium on Principles of Programming Languages (2002)
Flanagan, C., Saxe, J.B.: Avoiding exponential explosion: Generating compact verification conditions. In: Proceedings, Symposium on Principles of Programming Languages (2001)
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)
Gries, D.: The Science of programming. Springer, Heidelberg (1981)
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)
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)
Hoare, C.A.R.: An axiomatic basis for computer programming. Communications of the ACM 12(10), 576–583 (1969)
Jager, I., Brumley, D.: Efficient directionless weakest preconditions. Technical Report CMU-CyLab-10-002, Carnegie Mellon University (February 2010)
Leino, K.R.M.: Efficient weakest preconditions. Information Processing Letters 93(6), 281–288 (2005)
Leino, K.R.: Towards reliable modular programs. Technical report, California Institute of Technology, Pasadena, CA (1995)
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)
Manna, Z.: A Mathematical Theory of Computation. McGraw-Hill, New York (1974)
Mili, A., Aharon, S., Nadkarni, C.: Mathematics for reasoning about loop. Science of Computer Programming, 989–1020 (2009)
Morgan, C.C.: Programming from Specifications. International Series in Computer Sciences. Prentice Hall, London (1998)
Necula, G.C.: Proof carrying code. In: Proceedings, Symposium on Principles of Programming Languages (1997)
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)
von Oheimb, D.: Analyzing java in isabelle/hol: Formalization, type safety, and hoare logic. Technical report, Technische Universitaet Muenchen (2001)
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights 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)