Automatically Generating Loop Invariants Using Quantifier Elimination † -Preliminary Report-

An approach for automatically generating loop invariants using quantifier-elimination is proposed. An invariant of a loop is hypothesized as a parameterized formula. Parameters in the invariant are discovered by gen- erating constraints on the parameters by ensuring that the formula is indeed preserved by the execution path corresponding to every basic cycle of the loop. The parameterized formula can be successively refined by considering execu- tion 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 of the loop, if available, can also be used to further refine the hypothesized invariant. Constraints on parameters gener- ated in this way are solved for possible values of parameters. If no solution is possible, this means that an invariant of the hypothesized form does not exist for the loop. 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 first-order theory of polynomial equations as well as Presburger arithmetic.

[1]  Ben Wegbreit,et al.  The synthesis of loop predicates , 1974, CACM.

[2]  Steven M. German,et al.  A synthesizer of inductive assertions , 1975, IEEE Transactions on Software Engineering.

[3]  Ben Wegbreit,et al.  Property extraction in well-founded property sets , 1975, IEEE Transactions on Software Engineering.

[4]  Zohar Manna,et al.  Logical analysis of programs , 1976, CACM.

[5]  Patrick Cousot,et al.  Abstract interpretation: a unified lattice model for static analysis of programs by construction or approximation of fixpoints , 1977, POPL.

[6]  Nicolas Halbwachs,et al.  Automatic discovery of linear restraints among variables of a program , 1978, POPL.

[7]  Deepak Kapur,et al.  Geometry theorem proving using Hilbert's Nullstellensatz , 1986, SYMSAC '86.

[8]  S. Chou Mechanical Geometry Theorem Proving , 1987 .

[9]  Deepak Kapur,et al.  A Refutational Approach to Geometry Theorem Proving , 1988, Artif. Intell..

[10]  Deepak Kapur,et al.  An Overview of Rewrite Rule Laboratory (RRL) , 1989, RTA.

[11]  George E. Collins,et al.  Partial Cylindrical Algebraic Decomposition for Quantifier Elimination , 1991, J. Symb. Comput..

[12]  Deepak Kapur,et al.  An Approach for Solving Systems of Parametric Polynomial Equations , 1993 .

[13]  Rüdiger Loos,et al.  Applying Linear Quantifier Elimination , 1993, Comput. J..

[14]  Wen-tsün Wu Mechanical Theorem Proving in Geometries: Basic Principles , 1994 .

[15]  Thomas Sturm,et al.  REDLOG: computer algebra meets computer logic , 1997, SIGS.

[16]  Thomas Sturm,et al.  Real Quantifier Elimination in Practice , 1997, Algorithmic Algebra and Number Theory.

[17]  Alexander Schrijver,et al.  Theory of linear and integer programming , 1986, Wiley-Interscience series in discrete mathematics and optimization.

[18]  Markus Müller-Olm,et al.  Polynomial Constants Are Decidable , 2002, SAS.

[19]  Henny B. Sipma,et al.  Linear Invariant Generation Using Non-linear Constraint Solving , 2003, CAV.

[20]  Interprocedurally Valid Relations in Affine Prog rams , 2004 .

[21]  Michael Karr,et al.  Affine relationships among variables of a program , 1976, Acta Informatica.

[22]  Enric Rodríguez-Carbonell,et al.  Automatic Generation of Polynomial Loop Invariants: Algebraic Foundations , 2004, ISSAC '04.

[23]  Henny B. Sipma,et al.  Non-linear loop invariant generation using Gröbner bases , 2004, POPL.

[24]  Enric Rodríguez-Carbonell,et al.  An Abstract Interpretation Approach for Automatic Generation of Polynomial Invariants , 2004, SAS.

[25]  Deepak Kapur,et al.  Automatic Generation of Polynomial Loop Invariants for Imperative Programs ? , .