Loop Invariants on Demand

  • K. Rustan M. Leino
  • Francesco Logozzo
Part of the Lecture Notes in Computer Science book series (LNCS, volume 3780)

Abstract

This paper describes a sound technique that combines the precision of theorem proving with the loop-invariant inference of abstract interpretation. The loop-invariant computations are invoked on demand when the need for a stronger loop invariant arises, which allows a gradual increase in the level of precision used by the abstract interpreter. The technique generates loop invariants that are specific to a subset of a program’s executions, achieving a dynamic and automatic form of value-based trace partitioning. Finally, the technique can be incorporated into a lemmas-on-demand theorem prover, where the loop-invariant inference happens after the generation of verification conditions.

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. 1.
    Alpern, B., Wegman, M.N., Zadeck, F.K.: Detecting equality of variables in programs. In: 15th ACM SIGPLAN Symposium on Principles of Programming Languages (POPL 1988), January 1988, pp. 1–11. ACM, New York (1988)CrossRefGoogle Scholar
  2. 2.
    Ball, T., Cook, B., Lahiri, S.K., Zhang, L.: zapato: Automatic theorem proving for predicate abstraction refinement. In: Alur, R., Peled, D.A. (eds.) CAV 2004. LNCS, vol. 3114, pp. 457–461. Springer, Heidelberg (2004)CrossRefGoogle Scholar
  3. 3.
    Ball, T., Rajamani, S.K.: Automatically validating temporal safety properties of interfaces. In: Dwyer, M.B. (ed.) SPIN 2001. LNCS, vol. 2057, pp. 103–122. Springer, Heidelberg (2001)CrossRefGoogle Scholar
  4. 4.
    Barnett, M., Leino, K.R.M.: Weakest-precondition of unstructured programs. In: 6th ACM SIGPLAN-SIGSOFT Workshop on Program Analysis for Software Tools and Engineering (PASTE 2005), ACM, New York (2005)Google Scholar
  5. 5.
    Barnett, M., Leino, K.R.M., Schulte, W.: The spec# 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)CrossRefGoogle Scholar
  6. 6.
    Barrett, C.W., Berezin, S.: CVC lite: A new implementation of the cooperating validity checker category B. In: Alur, R., Peled, D.A. (eds.) CAV 2004. LNCS, vol. 3114, pp. 515–518. Springer, Heidelberg (2004)CrossRefGoogle Scholar
  7. 7.
    Bourdoncle, F.: Abstract interpretation by dynamic partitioning. Journal of Functional Programming 2(4), 407–423 (1992)CrossRefMathSciNetGoogle Scholar
  8. 8.
    Chang, B.-Y.E., Leino, K.R.M.: Inferring object invariants. In: Proceedings of the First International Workshop on Abstract Interpretation of Object-Oriented Languages (AIOOL 2005), January 2005. Electronic Notes in Theoretical Computer Science, vol. 131. Elsevier, Amsterdam (2005)Google Scholar
  9. 9.
    Cousot, P.: The calculational design of a generic abstract interpreter. In: Broy, M., Steinbrüggen, R. (eds.) Calculational System Design. NATO ASI Series F. IOS Press, Amsterdam (1999)Google Scholar
  10. 10.
    Cousot, P., Cousot, R.: Abstract interpretation: a unified lattice model for static analysis of programs by construction or approximation of fixpoints. In: 4th ACM Symposium on Principles of Programming Languages (POPL 1977), January 1977, pp. 238–252. ACM, New York (1977)CrossRefGoogle Scholar
  11. 11.
    Cousot, P., Cousot, R.: Systematic design of program analysis frameworks. In: 6th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL 1979), pp. 269–282. ACM, New York (1979)CrossRefGoogle Scholar
  12. 12.
    Cousot, P., Halbwachs, N.: Automatic discovery of linear restraints among variables of a program. In: 5th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL 1978), pp. 84–97. ACM, New York (1978)CrossRefGoogle Scholar
  13. 13.
    de Moura, L., Rueß, H.: Lemmas on demand for satisfiability solvers. In: Fifth International Symposium on the Theory and Applications of Satisfiability Testing (SAT 2002) (May 2002)Google Scholar
  14. 14.
    DeLine, R., Leino, K.R.M.: BoogiePL: A typed procedural language for checking object-oriented programs. Technical Report 2005-70, Microsoft Research (May 2005)Google Scholar
  15. 15.
    Dijkstra, E.W.: A Discipline of Programming. Prentice Hall, Englewood Cliffs (1976)MATHGoogle Scholar
  16. 16.
    Flanagan, C., Joshi, R., Ou, X., Saxe, J.B.: Theorem proving using lazy proof explication. In: Hunt Jr., W.A., Somenzi, F. (eds.) CAV 2003. LNCS, vol. 2725, pp. 355–367. Springer, Heidelberg (2003)CrossRefGoogle Scholar
  17. 17.
    Flanagan, C., Joshi, R., Saxe, J.B.: An explicating theorem prover for quantified formulas. Technical Report HPL-2004-199, HP Labs (2004)Google Scholar
  18. 18.
    Flanagan, C., Saxe, J.B.: Avoiding exponential explosion: generating compact verification conditions. In: 28th ACM SIGPLAN Symposium on Principles of Programming Languages (POPL 2001), pp. 193–205 (2001)Google Scholar
  19. 19.
    Floyd, R.W.: Assigning meanings to programs. In: Proceedings of Symposium in Applied Mathematics. Mathematical Aspects of Computer Science, vol. 19, pp. 19–32. American Mathematical Society, Providence (1967)Google Scholar
  20. 20.
    Giacobazzi, R., Ranzato, F.: The reduced relative power operation on abstract domains. Theoretical Computer Science 216(1-2), 159–211 (1999)MATHCrossRefMathSciNetGoogle Scholar
  21. 21.
    Graf, S., Saïdi, H.: Construction of abstract state graphs via PVS. In: Grumberg, O. (ed.) CAV 1997. LNCS, vol. 1254, pp. 72–83. Springer, Heidelberg (1997)Google Scholar
  22. 22.
    Handjieva, M., Tzolovski, S.: Refining static analyses by trace-based partitioning using control flow. In: Levi, G. (ed.) SAS 1998. LNCS, vol. 1503, pp. 200–214. Springer, Heidelberg (1998)CrossRefGoogle Scholar
  23. 23.
    Henzinger, T.A., Jhala, R., Majumdar, R., McMillan, K.L.: Abstractions from proofs. In: Proceedings of POPL 2004, pp. 232–244. ACM, New York (2004)CrossRefGoogle Scholar
  24. 24.
    Henzinger, T.A., Jhala, R., Majumdar, R., Sutre, G.: Lazy abstraction. In: 29th Syposium on Principles of Programming Languages (POPL 2002), pp. 58–70. ACM Press, New York (2002)CrossRefGoogle Scholar
  25. 25.
    Hoare, C.A.R.: An axiomatic approach to computer programming. Communications of the ACM 12, 576–583 (1969)MATHCrossRefGoogle Scholar
  26. 26.
    Jeannet, B., Halbwachs, N., Raymond, P.: Dynamic partitioning in analyses of numerical properties. In: Cortesi, A., Filé, G. (eds.) SAS 1999. LNCS, vol. 1694, p. 39. Springer, Heidelberg (1999)CrossRefGoogle Scholar
  27. 27.
    Rustan, K., Leino, M.: Efficient weakest preconditions. Information Processing Letters 93(6), 281–288 (2005)MATHCrossRefMathSciNetGoogle Scholar
  28. 28.
    Leino, K.R.M., Musuvathi, M., Ou, X.: A two-tier technique for supporting quantifiers in a lazily proof-explicating theorem prover. In: Halbwachs, N., Zuck, L.D. (eds.) TACAS 2005. LNCS, vol. 3440, pp. 334–348. Springer, Heidelberg (2005)CrossRefGoogle Scholar
  29. 29.
    Leino, K.R.M., Saxe, J.B., Stata, R.: Checking Java programs via guarded commands. In: Formal Techniques for Java Programs, Technical Report 251. Fernuniversität Hagen (May 1999); Also available as Technical Note 1999-002, Compaq Systems Research CenterGoogle Scholar
  30. 30.
    Logozzo, F.: Approximating module semantics with constraints. In: Proceedings of the 19th ACM SIGAPP Symposium on Applied Computing (SAC 2004), pp. 1490–1495. ACM, New York (2004)Google Scholar
  31. 31.
    Logozzo, F.: Modular Static Analysis of Object-oriented Languages. PhD thesis, École Polytechnique (2004)Google Scholar
  32. 32.
    Mauborgne, L., Rival, X.: Trace partitioning in abstract interpretation based static analyzers. In: Sagiv, M. (ed.) ESOP 2005. LNCS, vol. 3444, pp. 5–20. Springer, Heidelberg (2005)CrossRefGoogle Scholar
  33. 33.
    Miné, A.: The octagon abstract domain. In: AST 2001 in WCRE 2001, October 2001, pp. 310–319. IEEE, Los Alamitos (2001)Google Scholar
  34. 34.
    Nelson, G.: A generalization of Dijkstra’s calculus. ACM Transactions on Programming Languages and Systems 11(4), 517–561 (1989)CrossRefGoogle Scholar
  35. 35.
    Sagiv, S., Reps, T.W., Wilhelm, R.: Parametric shape analysis via 3-valued logic. ACM Transactions on Programming Languages and Systems 24(3), 217–298 (2002)CrossRefGoogle Scholar
  36. 36.
    Yorsh, G., Reps, T.W., Sagiv, S.: Symbolically computing most-precise abstract operations for shape analysis. In: Jensen, K., Podelski, A. (eds.) TACAS 2004. LNCS, vol. 2988, pp. 530–545. Springer, Heidelberg (2004)CrossRefGoogle Scholar
  37. 37.
    Zee, K., Lam, P., Kuncak, V., Rinard, M.C.: Combining theorem proving with static analysis for data structure consistency. In: International Workshop on Software Verification and Validation (November 2004)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2005

Authors and Affiliations

  • K. Rustan M. Leino
    • 1
  • Francesco Logozzo
    • 2
  1. 1.Microsoft ResearchRedmondUSA
  2. 2.Laboratoire d’Informatique de l’École Normale SupérieureParisFrance

Personalised recommendations