Loop invariants play a very important role in proving correctness of programs. In this paper, we address the problem of generating invariants of polynomial loop programs. We present a new approach, for generating polynomial equation invariants of polynomial loop programs through computing vanishing ideals of sample points. We apply rational function interpolation, based on early termination technique, to generate invariants of loop programs with symbolic initial values. Our approach avoids first-order quantifier elimination and cylindrical algebraic decomposition(CAD). An algorithm for generating polynomial invariants is proposed and some examples are given to illustrate the algorithm. Furthermore, we demonstrate on a set of loop programs with symbolic initial values that our algorithm can yield polynomial invariants with degrees high up to 15.
Loop invariant generation plays a central role in program verification. An invariant of a loop program at a location is an assertion over the program variables that is true of any program state reaching the location. Loop invariants are helpful for program analysis and verification.
Since the late seventies of the 20th century, many methods have been proposed to generate loop invariants. In (German and Wegbreit, 1975;Katz and Manna, 1976;Wegbreit, 1974Wegbreit, , 1975)), difference equation solving techniques were used to generate loop invariants. However, this technique is difficult to apply in general, since difference equations are generally hard to solve. In (Karr, 1976;Cousot and Cousot, 1977;Cousot and Halbwachs, 1978), abstract interpretation techniques were applied to finding linear equation or inequality invariants.
Based on some previous work, Müller-Olm and Seidl (Müller-Olm and Seidl, 2004a,b) generated polynomial equation invariants of loop programs with affine assignments using linear algebra techniques.
Recently, the constraint-based methods become dominant in invariant generation. These methods require to preset a template of the invariant as a polynomial equation or inequality with unknown coefficients, and the initiation and consecution conditions for the invariants generate constraints on the unknown coefficients. Then a solution to the constraint system yields invariants. In (Colón et al., 2003), Farkas’ Lemma was applied to generating linear inequality invariants using non-linear constraint solving. In (Kapur, 2004), Kapur proposed an approach based on quantifier elimination to generate polynomial equation invariants. In (Sankaranarayanan et al., 2004), the polynomial-scale consecution of inductive invariants was first defined, and the polynomial equation invariants satisfying polynomial-scale consecution were computed using an extended Gröbner basis algorithm. (Rebiha et al., 2008) proposed a complete method using multi-parametric constraints to generate polynomial invariants that satisfy polynomial-scale consecution. To generate polynomial equation or inequality invariants of loop programs with guard conditions and branches, Chen et al. (Chen et al., 2007) applied the techniques of solving semi-algebraic systems.
Rodríguez-Carbonell and Kapur (Rodríguez-Carbonell and Kapur, 2004Kapur, , 2007) ) first proved that the polynomial equation invariants have the algebraic structure of an ideal, and they proposed a fixpoint procedure for finding all polynomial equation invariants using Gröbner bases and quantifier elimination. (Kovács, 2007;Kauers and Zimmermann, 2008;Kovács, 2008) proposed complete algorithms to generate polynomial equation invariants for a restricted class of linear (P-solvable) loops.
In this paper, by computing vanishing ideals of program sample points, we present a new method for generating polynomial invariants of polynomial loop programs in which the guard conditions and assignments are polynomials in the program variables.
Recall that a multivariate polynomial in n variables with total degree bound e has at most n+e n distinct terms. Therefore, to compute the invariants with a given degree bound e, we first get no more than n+e n sample points by executing the loop program, where n is the number of program variables. Then we apply Buchberger-Möller algorithm to compute the vanishing ideal of these sample points as candidate invariants (a candidate may not be real invariant). Subsequently, the problem of verifying the candidate invariants can be translated into that of determining divisibility between multivariate polynomials, and a practical probabilistic method is presented to exclude non-invariants quickly. Finally, we can either generate the polynomial invariants or conclude that the polynomial invariants with degree ≤ e ′ do not exist, where e ′ (≤ e) is the minimal degree of the polynomials in the vanishing ideal. Moreover, rational function interpolation method, combining variable by variable interpolation with early termination technique (Kaltofen and Yang, 2007) is applied to generating invariants of loop programs with symbolic initial values.
The rest of the paper is organized as follows. In Section 2, we recall the notions of vanishing ideals for finitely many points, transition systems and (inductive) invariants. In Section 3, we present an efficient method to generate polynomial equation invariants for polynomial loop programs with initial values, and in Section 4, an algorithm and some examples are given. We conclude our results in Section 5.
This section contains a collection of definitions and facts about vanishing ideals of finitely many points.
Throughout this paper, let K be a (commutative) field of characteristic zero , K[x 1 , . . . , x n ] be the ring of polynomials in n indeterminates x 1 , . . . , x n over K, the term order σ in K[x 1 , . . . , x n ] be the graded lexicographic order, and deg(f ) denote the total degree of a polynomial
This content is AI-processed based on open access ArXiv data.