An Abstract Interpretation Approach for Automatic Generation of Polynomial Invariants

  • Enric Rodríguez-Carbonell
  • Deepak Kapur
Part of the Lecture Notes in Computer Science book series (LNCS, volume 3148)


A method for generating polynomial invariants of imperative programs is presented using the abstract interpretation framework. It is shown that for programs with polynomial assignments, an invariant consisting of a conjunction of polynomial equalities can be automatically generated for each program point. The proposed approach takes into account tests in conditional statements as well as in loops, insofar as they can be abstracted to be polynomial equalities and disequalities. The semantics of each statement is given as a transformation on polynomial ideals. Merging of paths in a program is defined as the intersection of the polynomial ideals associated with each path. For a loop junction, a widening operator based on selecting polynomials up to a certain degree is proposed. The algorithm for finding invariants using this widening operator is shown to terminate in finitely many steps. The proposed approach has been implemented and successfully tried on many programs. A table providing details about the programs is given.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Bourdoncle, F.: Efficient Chaotic Iteration Strategies with Widenings. In: Pottosin, I.V., Bjorner, D., Broy, M. (eds.) FMP&TA 1993. LNCS, vol. 735, pp. 128–141. Springer, Heidelberg (1993)CrossRefGoogle Scholar
  2. 2.
    Bressoud, D.M.: Factorization and Primality Testing. Springer, Heidelberg (1989)MATHGoogle Scholar
  3. 3.
    Cohen, E.: Programming in the 1990s. Springer, Heidelberg (1990)MATHGoogle Scholar
  4. 4.
    Colón, M.A., Sankaranarayanan, S., Sipma, H.B.: Linear Invariant Generation Using Non-Linear Constraint Solving. In: Hunt Jr., W.A., Somenzi, F. (eds.) CAV 2003. LNCS, vol. 2725, pp. 420–432. Springer, Heidelberg (2003)CrossRefGoogle Scholar
  5. 5.
    Cousot, P., Cousot, R.: Abstract Interpretation: a Unified Lattice Model for Static Analysis of Programs by Construction or Approximation of Fixpoints. In: Conference Record of the Fourth Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, pp. 238–252 (1977)Google Scholar
  6. 6.
    Cousot, P., Halbwachs, N.: Automatic Discovery of Linear Restraints among Variables of a Program. In: Conference Record of the Fifth Annual ACM SIGPLANSIGACT Symposium on Principles of Programming Languages, pp. 84–97 (1978)Google Scholar
  7. 7.
    Cox, D., Little, J., O’Shea, D.: Ideals, Varieties and Algorithms. An Introduction to Computational Algebraic Geometry and Commutative Algebra. Springer, Heidelberg (1998)Google Scholar
  8. 8.
    Davenport, J.H., Siret, Y., Tournier, E.: Computer Algebra: Systems and Algorithms for Algebraic Computation. Academic Press, London (1988)MATHGoogle Scholar
  9. 9.
    Dershowitz, N., Manna, Z.: Inference rules for program annotation. In: Proceedings of the 3rd International Conference on Software Engineering, pp. 158–167 (1978)Google Scholar
  10. 10.
    Dijkstra, E.: A Discipline of Programming. Prentice-Hall, Englewood Cliffs (1976)MATHGoogle Scholar
  11. 11.
  12. 12.
    Grayson, D.R., Stillman, M.E.: Macaulay 2, a Software System for Research in Algebraic Geometry, Available at
  13. 13.
    Kaldewaij, A.: Programming. The Derivation of Algorithms. Prentice-Hall, Englewood Cliffs (1990)Google Scholar
  14. 14.
    Kapur, D.: A Refutational Approach to Geometry Theorem Proving. Artificial Intelligence 37, 61–93 (1988)MATHCrossRefMathSciNetGoogle Scholar
  15. 15.
    Kapur, D., Narendran, P.: An equational approach to theorem proving in firstorder predicate calculus. In: Proceedings of the Ninth International Joint Conference on Artificial Intelligence (IJCAI 1985), August 1985, pp. 1146–1153 (1985)Google Scholar
  16. 16.
    Karr, M.: Affine Relationships Among Variables of a Program. Acta Informatica 6, 133–151 (1976)MATHCrossRefMathSciNetGoogle Scholar
  17. 17.
    Knuth, D.E.: The Art of Computer Programming. Seminumerical Algorithms, vol. 2. Addison-Wesley, Reading (1969)MATHGoogle Scholar
  18. 18.
    Müller-Olm, M., Seidl, H.: Computing Interprocedurally Valid Relations in Affine Programs. In: ACM SIGPLAN Principles of Programming Languages (POPL 2004), pp. 330–341 (2004)Google Scholar
  19. 19.
    Rodríguez-Carbonell, E., Kapur, D.: An Abstract Interpretation Approach for Automatic Generation of Polynomial Invariants (extended version),
  20. 20.
    Rodríguez-Carbonell, E., Kapur, D.: Automatic Generation of Polynomial Loop Invariants: Algebraic Foundations. To appear in International Symposium on Symbolic and Algebraic Computation 2004, ISSAC 2004 (2004),
  21. 21.
    Rodríguez-Carbonell, E., Kapur, D.: Program Verification Using Automatic Generation of Polynomial Invariants,
  22. 22.
    Sankaranarayanan, S., Sipma, H.B., Manna, Z.: Non-linear Loop Invariant Generation Using Gröbner Bases. In: ACM SIGPLAN Principles of Programming Languages (POPL 2004), pp. 318–329 (2004)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2004

Authors and Affiliations

  • Enric Rodríguez-Carbonell
    • 1
  • Deepak Kapur
    • 2
  1. 1.Technical University of CataloniaBarcelona
  2. 2.University of New MexicoAlbuquerque

Personalised recommendations