Abstract
The template-based method is one of the most successful approaches to algebraic invariant synthesis. In this method, an algorithm designates a template polynomial \(p\) over program variables, generates constraints for \(p=0\) to be an invariant, and solves the generated constraints. However, this approach often suffers from an increasing template size if the degree of a template polynomial is too high.
We propose a technique to make template-based methods more efficient. Our technique is based on the following finding: If an algebraic invariant exists, then there is a specific algebraic invariant that we call a generalized homogeneous algebraic invariant that is often smaller. This finding justifies using only a smaller template that corresponds to a generalized homogeneous algebraic invariant.
Concretely, we state our finding above formally based on the abstract semantics of an imperative program proposed by Cachera et al. Then, we modify their template-based invariant synthesis so that it generates only generalized homogeneous algebraic invariants. This modification is proved to be sound. Furthermore, we also empirically demonstrate the merit of the restriction to generalized homogeneous algebraic invariants. Our implementation outperforms that of Cachera et al. for programs that require a higher-degree template.
This is a preview of subscription content, log in via an institution.
Buying options
Tax calculation will be finalised at checkout
Purchases are for personal use only
Learn about institutional subscriptionsNotes
- 1.
- 2.
Although the guard condition \(t - a \ne 0\) should be \(t - a < 0\) in a real-world numerical program, we use the current example for presentation purposes.
- 3.
The original abstract semantics of Cachera et al. [4] is defined as a transformer on ideals of polynomials; however, we formulate it here so that it operates on sets of polynomials because their invariant-synthesis algorithm depends on the choice of a generator of an ideal.
- 4.
The soundness would still hold even if we defined \(\llbracket \mathbf {if}\, p=0\, \mathbf {then}\, c_1 \, \mathbf {else}\, c_2 \rrbracket ^{\sharp }_{\mathbf{Rem}}(G)\) by \(\llbracket c_2 \rrbracket ^{\sharp }_{\mathbf{Rem}}(G) \cup \mathbf{Rem}(\llbracket c_1 \rrbracket ^{\sharp }_{\mathbf{Rem}}(G), p)\) instead of \(p \cdot \llbracket c_2 \rrbracket ^{\sharp }_{\mathbf{Rem}}(G) \cup \mathbf{Rem}(\llbracket c_1 \rrbracket ^{\sharp }_{\mathbf{Rem}}(G), p)\). The multiplier p makes the abstract semantics more precise.
- 5.
We do not discuss the termination of the procedure in this paper. See Kennedy [12, Section 5.2].
- 6.
We do not use this case in the rest of this paper.
References
Adjé, A., Garoche, P.-L., Magron, V.: Property-based polynomial invariant generation using sums-of-squares optimization. In: Blazy, S., Jensen, T. (eds.) SAS 2015. LNCS, vol. 9291, pp. 235–251. Springer, Heidelberg (2015)
Barenblatt, G.I.: Scaling, Self-Similarity, and Intermediate Asymptotics: Dimensional Analysis and Intermediate Asymptotics, vol. 14. Cambridge University Press, Cambridge (1996)
Buckingham, E.: On physically similar systems; illustrations of the use of dimensional equations. Phys. Rev. 4, 345–376 (1914)
Cachera, D., Jensen, T.P., Jobin, A., Kirchner, F.: Inference of polynomial invariants for imperative programs: a farewell to Gröbner bases. Sci. Comput. Program. 93, 89–109 (2014)
Cox, D.A., Little, J., O’Shea, D.: Ideals, Varieties, and Algorithms: An Introduction to Computational Algebraic Geometry and Commutative Algebra. Undergraduate Texts in Mathematics, 3rd edn. Springer, New York (2007)
Dai, L., Xia, B., Zhan, N.: Generating non-linear interpolants by semidefinite programming. In: Sharygina, N., Veith, H. (eds.) CAV 2013. LNCS, vol. 8044, pp. 364–380. Springer, Heidelberg (2013)
Garg, P., Löding, C., Madhusudan, P., Neider, D.: ICE: a robust framework for learning invariants. In: Biere, A., Bloem, R. (eds.) CAV 2014. LNCS, vol. 8559, pp. 69–87. Springer, Heidelberg (2014)
Gonzalez-Vega, L., Lombardi, H.: Smooth parametrizations for several cases of the Positivstellensatz. Mathematische Zeitschrift 225(3), 427–451 (1997). http://dx.doi.org/10.1007/PL00004620
Gulwani, S., Tiwari, A.: Constraint-based approach for analysis of hybrid systems. In: Gupta, A., Malik, S. (eds.) CAV 2008. LNCS, vol. 5123, pp. 190–203. Springer, Heidelberg (2008)
Hankey, A., Stanley, H.E.: Systematic application of generalized homogeneous functions to static scaling, dynamic scaling, and universality. Phys. Rev. B 6(9), 3515 (1972)
Hasuo, I., Suenaga, K.: Exercises in nonstandard static analysis of hybrid systems. In: Madhusudan, P., Seshia, S.A. (eds.) CAV 2012. LNCS, vol. 7358, pp. 462–478. Springer, Heidelberg (2012)
Kennedy, A.: Dimension types. In: ESOP 1994, pp. 348–362 (1994)
Kennedy, A.: Programming languages and dimensions. Ph.D. thesis, St. Catharine’s College, March 1996
Lankford, D., Butler, G., Brady, B.: Abelian group unification algorithms for elementary terms. Contemp. Math. 29, 193–199 (1984)
de Moura, L., Bjørner, N.S.: Z3: an efficient SMT solver. In: Ramakrishnan, C.R., Rehof, J. (eds.) TACAS 2008. LNCS, vol. 4963, pp. 337–340. Springer, Heidelberg (2008)
Müller-Olm, M., Seidl, H.: Computing polynomial program invariants. Inf. Process. Lett. 91(5), 233–244 (2004)
Neusel, M.D.: Invariant theory. The American Mathematical Society (2000)
Rodríguez-Carbonell, E.: Some programs that need polynomial invariants in order to be verified. http://www.cs.upc.edu/erodri/webpage/polynomial_invariants/list.html. Accessed 25 January 2016
Rodríguez-Carbonell, E., Kapur, D.: Generating all polynomial invariants in simple loops. J. Symb. Comput. 42(4), 443–476 (2007)
Sankaranarayanan, S., Sipma, H., Manna, Z.: Non-linear loop invariant generation using Gröbner bases. In: POPL 2004, pp. 318–329 (2004)
Somenzi, F., Bradley, A.R.: IC3: where monolithic and incremental meet. In: FMCAD 2011, pp. 3–8 (2011)
Stengle, G.: A nullstellensatz and a positivstellensatz in semialgebraic geometry. Mathematische Annalen 207(2), 87–97 (1974)
Suenaga, K., Hasuo, I.: Programming with infinitesimals: a while-language for hybrid system modeling. In: Aceto, L., Henzinger, M., Sgall, J. (eds.) ICALP 2011, Part II. LNCS, vol. 6756, pp. 392–403. Springer, Heidelberg (2011)
Suenaga, K., Sekine, H., Hasuo, I.: Hyperstream processing systems: nonstandard modeling of continuous-time signals. In: Giacobazzi, R., Cousot, R. (eds.) POPL 2013, pp. 417–430. ACM (2013)
Acknowledgment
We appreciate annonymous reviewers, Toshimitsu Ushio, Naoki Kobayashi and Atsushi Igarashi for their comments. This work is partially supported by JST PRESTO, JST CREST, KAKENHI 70633692, and in collaboration with the Toyota Motor Corporation.
Author information
Authors and Affiliations
Corresponding author
Editor information
Editors and Affiliations
A Proof of Theorem 4
A Proof of Theorem 4
To prove Theorem 4, we define renaming of parameters and constraints.
Definition 7
For an injection \(\iota : A \rightarrow A'\), we write \(\iota : (A,G,C) \preceq (A',G',C')\) if \(G' = \iota ^*(G)\) and \(C' = \iota ^*(C)\) where \(\iota ^*\) maps \(a' \in \iota (A)\) to \(\iota ^{-1}(a')\) and \(a' \in \iota (A' \backslash \iota (A))\) to \(0\).
The injection \(\iota \) gives a renaming of parameters. The relation \(\iota : (A,G,C) \preceq (A',G',C')\) reads \(G\) and \(C\) are obtained from \(G'\) and \(C'\) by renaming the parameters in \(\iota (A)\) using \(\iota \) and substituting \(0\) to those not in \(\iota (A)\).
Lemma 2
If \(\iota : (A,G,C) \preceq (A',G',C')\), then there exists \(\kappa \) such that (1) \(\kappa : \llbracket c \rrbracket ^{\sharp \mathtt {cH}}_{{\mathbf {Rem}^{\mathtt {par}}},\varGamma }(A,G,C) \preceq \llbracket c \rrbracket ^{\sharp \mathtt {c}}_{{\mathbf {Rem}^{\mathtt {par}}}}(A',G',C')\) and (2) \(\kappa \) is an extension of \(\iota \).
Proof
Induction on the structure of \(c\). \(\square \)
Proof of Theorem 4. Let \(g \in T(A_0)\) be the most general template of generalized degree \(\tau \) and degree d and \(g' \in T(A_0')\) be the most general template of degree d. Without loss of generality, we assume \(A_0 \subseteq A_0'\) and \(g' = g + g_1\) for some \(g_1 \in T(A_0' \backslash A_0)\). Let \((A, G, C) = \llbracket c \rrbracket ^{\sharp \mathtt {cH}}_{{\mathbf {Rem}^{\mathtt {par}}},\varGamma }(A_0, \{{g}\}, \emptyset )\) and \((A', G', C') = \llbracket c \rrbracket ^{\sharp \mathtt {c}}_{{\mathbf {Rem}^{\mathtt {par}}}}(A_0', \{{g'}\}, \emptyset )\). Then, from Lemma 2, there exists \(\kappa \) such that \(\kappa : (A, G, C) \preceq (A', G', C')\) and \(\kappa \) is an extension of the inclusion mapping \(\iota : A_0 \rightarrow A_0'\). Suppose \(v(g)\) is a result of \(\textsc {InvInf}^{\mathtt {H}}(c, d, \tau )\) where \(v\) is a solution to \(C \cup \{{\langle G \equiv \{{0}\} \rangle }\}\). Define a valuation \(v'\) on \(A'\) by
Then, \(v'(g') = v'(g + g_1) = v'(g)\); the second equation holds because \(v'(a')\) is constantly \(0\) on any \(a' \in A' \backslash A\). All the parameters in \(g\) are in \(A_0\) and \(\kappa \) is an identity on \(A_0\). Therefore, \(v'(g) = v(g)\). It suffices to show that \(v' \models C' \cup \{{\langle G' \equiv \{{0}\} \rangle }\}\), which indeed holds from the definition of \(v'\) since \(v \models C \cup \{{\langle G \equiv \{{0}\} \rangle }\}\) and \(C\) and \(G\) are renaming of \(C'\) and \(G'\). \(\square \)
Rights and permissions
Copyright information
© 2016 Springer-Verlag GmbH Germany
About this paper
Cite this paper
Kojima, K., Kinoshita, M., Suenaga, K. (2016). Generalized Homogeneous Polynomials for Efficient Template-Based Nonlinear Invariant Synthesis. In: Rival, X. (eds) Static Analysis. SAS 2016. Lecture Notes in Computer Science(), vol 9837. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-662-53413-7_14
Download citation
DOI: https://doi.org/10.1007/978-3-662-53413-7_14
Published:
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-662-53412-0
Online ISBN: 978-3-662-53413-7
eBook Packages: Computer ScienceComputer Science (R0)