Skip to main content
Log in

A Quantifier-Elimination Based Heuristic for Automatically Generating Inductive Assertions for Programs

  • Published:
Journal of Systems Science and Complexity Aims and scope Submit manuscript

Abstract

A method using quantifier-elimination is proposed for automatically generating program invariants/inductive assertions. Given a program, inductive assertions, hypothesized as parameterized formulas in a theory, are associated with program locations. Parameters in inductive assertions are discovered by generating constraints on parameters by ensuring that an inductive assertion is indeed preserved by all execution paths leading to the associated location of the program. The method can be used to discover loop invariants–properties of variables that remain invariant at the entry of a loop. The parameterized formula can be successively refined by considering execution paths one by one; heuristics can be developed for determining the order in which the paths are considered. Initialization of program variables as well as the precondition and postcondition, if available, can also be used to further refine the hypothesized invariant. The method does not depend on the availability of the precondition and postcondition of a program. Constraints on parameters generated in this way are solved for possible values of parameters. If no solution is possible, this means that an invariant of the hypothesized form is not likely to exist for the loop under the assumptions/approximations made to generate the associated verification condition. Otherwise, if the parametric constraints are solvable, then under certain conditions on methods for generating these constraints, the strongest possible invariant of the hypothesized form can be generated from most general solutions of the parametric constraints. The approach is illustrated using the logical languages of conjunction of polynomial equations as well as Presburger arithmetic for expressing assertions.

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. B. Elspas, M. W. Green, K. N. Levitt, and R. J. Waldinger, Research in Interactive Program-Proving Techniques, Stanford Research Institute, Menlo Park, California, USA, May 1972.

  2. S. German and B. Wegbreit, A synthesizer of inductive assertions, IEEE Transactions on Software Engineering, 1975, 1(1): 68–75.

    Google Scholar 

  3. S. Katz and Z. Manna, Logical analysis of programs, Communications of the ACM, 1976, 19(4): 188–206.

    Article  Google Scholar 

  4. P. Cousot and R. Cousot, 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, Los Angeles, California, ACM Press, New York, NY, 1977, 238–252.

  5. P. Cousot and N. Halbwachs, Automatic discovery of linear restraints among variables of a program, in Conference Record of the Fifth Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, Tucson, Arizona, ACM Press, New York, NY, 1978, 84–97.

  6. M. Müller-Olm and H. Seidl, Polynomial constants are decidable, in 9th Static Analysis Symposium (SAS) (LNCS 2477), Springer-Verlag, 2002.

  7. M. Müller-Olm and H. Seidl, Precise interprocedural analysis through linear algebra, in Symposium on Principles of Programming Languages, 2004, 330–341.

  8. E. Rodríguez-Carbonell and D. Kapur, An abstract interpretation approach for automatic generation of polynomial invariants, in 11th Symposium on Static Analysis (SAS) (LNCS 3148), Verona, Italy, Springer-Verlag, August 2004, 280–295.

  9. W. Wu, On the decision problem and the mechanization of theorem proving in elementary geometry, Scientia Sinica, 1978, 21: 150–172.

    Google Scholar 

  10. W. Wu, Basic principles of mechanical theorem proving in geometries, J. of Automated Reasoning, 1986, 2: 221–252.

    Article  Google Scholar 

  11. S. C. Chou, Mechanical Geometry Theorem Proving, D. Reidel Publishing Company, Dordrecht, Netherlands, 1988.

  12. D. Kapur, Geometry theorem proving using Hilbert’s Nullstellensatz, in Proc. 1986 Symposium on Symbolic and Algebraic Computation (SYMSAC 86), 1986, 202–208.

  13. D. Kapur, A refutational approach to Geometry theorem proving, Artificial Intelligence, 1988, 37: 61–93.

    Article  Google Scholar 

  14. B. Wegbreit, The synthesis of loop predicates, Communications of the ACM, 1974, 17(2): 102–112.

    Article  Google Scholar 

  15. B. Wegbreit, Property extraction in well-founded property sets, IEEE Transactions on Software Engineering, 1975, 1(3): 270–285.

    Google Scholar 

  16. M. Karr, Affine relationships among variables of a program, Acta Informatica, 1976, 6: 133–151.

    Article  Google Scholar 

  17. M. A. Colón, S. Sankaranarayanan, and H. B. Sipma, Linear invariant generation using non-linear constraint solving, in Computer-Aided Verification (CAV 2003), Lecture Notes in Computer Science, Springer Verlag, 2003, 2725: 420–432.

  18. E. Rodríguez-Carbonell and D. Kapur, Automatic generation of polynomial loop invariants: Algebraic foundations, in Intl. Symp. on Symbolic and Algebraic Computation (ISSAC), Santander, Spain, July 2004, 266–273.

  19. E. Rodríguez-Carbonell and D. Kapur, Automatic generation of polynomial loop invariants for imperative programs, in Intl. Colloquium on Theoretical Aspects of Computing (ICTAC 2004) (LNCS 3407), China, Springer-Verlag, Feb. 2005, 325–340.

  20. S. Sankaranarayanan, H. B. Sipma, and Z. Manna, Non-linear loop invariant generation using Gröbner Bases, in Symp. on Principles of Programming Languages, 2004, 318–329.

  21. D. Kapur, An approach for solving systems of parametric polynomial equations, in Principles and Practices of Constraint Programming (ed. by Saraswat and Van Hentenryck), MIT Press, 1995, 217–244.

  22. V. Weispfenning, A Comprehensive Gröbner Basis Algorithm, J. of Symbolic Computation, July 1992, 14: 1–29.

  23. H. Enderton, Mathematical Logic, An Introduction, Academic Press, 1992.

  24. D. Kapur and X. Nie, Reasoning about numbers in Tecton, in Proceedings 8th International Symposium on Methodologies for Intelligent Systems (ISMIS’94), October 1994, 57–70.

  25. D. Kapur and H. Zhang, An overview of rewrite rule laboratory (RRL), Journal of Computer and Mathematics with Applications, 1995, 29: 91–114.

    Article  Google Scholar 

  26. R. Loos and V. Weispfenning, Applying linear quantifier elimination, Computer Journal, 1993, 36(5): 450–462.

    Article  Google Scholar 

  27. A. Lasaruk and T. Sturm, Weak quantifier elimination for the full linear theory of the integers – A uniform generalization of Presburger arithmetic, Technical Report, MIP-0604, University of Passau, April 2006.

  28. A. Schrijver, Theory of Linear and Integer Programming, John Wiley, 1998.

  29. V. Weispfenning, Complexity and uniformity of elimination in Presburger arithmetic, in Intl. Symp. on Symbolic and Algebraic Computation (ISSAC), Maui, US, July 1997, 48–53.

  30. V. Weispfenning, The complexity of almost linear Diophantine problems, Journal of Symbolic Computation, 1990, 10: 395–403.

    Google Scholar 

  31. G. Collins and H. Hong, Partial cylindrical algebraic decomposition for quantifier elimination, Journal of Symbolic Computation, 1991, 12(3): 299–328.

    Article  Google Scholar 

  32. A. Doltzmann and T. Sturm, REDLOG: Computer algebra meets computer logic, MIP-9603, Technical Report, University of Passau, Sep. 1996.

  33. H. Hong, et al., http://www.cs.usna.edu/~qepcad/B/WhatisQEPCAD.html.

  34. A. Doltzmann, T. Sturm, and V. Weispfenning, Real quantifier elimination in practice, Technical Report, MIP-9720, University of Passau, Dec. 1997.

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Deepak Kapur.

Additional information

This research was partially supported by an National Science Foundation (NSF), Information Technology Research (ITR) award CCR-0113611 and an NSF award CCR-0203051.

Rights and permissions

Reprints and permissions

About this article

Cite this article

Kapur, D. A Quantifier-Elimination Based Heuristic for Automatically Generating Inductive Assertions for Programs. Jrl Syst Sci & Complex 19, 307–330 (2006). https://doi.org/10.1007/s11424-006-0307-x

Download citation

  • Received:

  • Issue Date:

  • DOI: https://doi.org/10.1007/s11424-006-0307-x

Key Words

Navigation