An Iterative Method for Generating Loop Invariants

  • Shikun Chen
  • Zhoujun Li
  • Xiaoyu Song
  • Mengjun Li
Part of the Lecture Notes in Computer Science book series (LNCS, volume 6681)


Automatic derivation of invariants is one of the critical conundrums in the framework of the inductive program verification methodologies. This paper presents a novel and simple approach to generating polynomial equations as loop invariants. Finite difference of expressions and linear equation solving are harnessed. Unlike related work, the generated constraints are linear equalities, which can be solved efficiently. Furthermore, invariants of higher degree can be constructed in terms of those of lower degree. The case studies demonstrate the effectiveness of the approach.


program correctness loop invariant finite difference 


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Bradley, A.R., Manna, Z., Sipma, H.B.: Termination of polynomial programs. In: Cousot, R. (ed.) VMCAI 2005. LNCS, vol. 3385, pp. 113–129. Springer, Heidelberg (2005)CrossRefGoogle Scholar
  2. 2.
    Chen, Y., Xia, B., Yang, L., Zhan, N.: Generating polynomial invariants with Discoverer and Qepcad. In: Jones, C.B., Liu, Z., Woodcock, J. (eds.) Formal Methods and Hybrid Real-Time Systems. LNCS, vol. 4700, pp. 67–82. Springer, Heidelberg (2007)CrossRefGoogle Scholar
  3. 3.
    Cousot, P., Halbwachs, N.: Automatic discovery of linear restraints among variables of a program. In: Proc. POPL 1978, pp. 84–96 (1978)Google Scholar
  4. 4.
    Rodriguez-Carbonell, D.K.E.: Generating all polynomial invariants in simple loops. Journal of Symbolic Computation, 443–476 (2007)Google Scholar
  5. 5.
    Giacobazzi, R. (ed.): SAS 2004. LNCS, vol. 3148. Springer, Heidelberg (2004)MATHGoogle Scholar
  6. 6.
    Gulwani, S., Srivastava, S., Venkatesan, R.: Program analysis as constraint solving. In: Proc. PLDI 2008, pp. 281–292 (2008)Google Scholar
  7. 7.
    Kovács, L.: Reasoning algebraically about p-solvable loops. In: Ramakrishnan, C.R., Rehof, J. (eds.) TACAS 2008. LNCS, vol. 4963, pp. 249–264. Springer, Heidelberg (2008)CrossRefGoogle Scholar
  8. 8.
    Michael, H.S., Colon, A., Sankaranarayanan, S.: Linear Invariant Generation Using Non-linear Constraint Solving. In: Hunt Jr., W.A., Somenzi, F. (eds.) CAV 2003. LNCS, vol. 2725, pp. 420–433. Springer, Heidelberg (2003)CrossRefGoogle Scholar
  9. 9.
    Miné, A.: The octagon abstract domain. Higher-Order and Symbolic Computation 19(1), 31–100 (2006)MathSciNetCrossRefMATHGoogle Scholar
  10. 10.
    Müller-Olm, M., Seidl, H.: Precise interprocedural analysis through linear algebra. In: POPL, pp. 330–341 (2004a)Google Scholar
  11. 11.
    Müller-Olm, M., Seidl, H.: Computing polynomial program invariants. Inf. Process. Lett. 91(5), 233–244 (2004b)MathSciNetCrossRefMATHGoogle Scholar
  12. 12.
    Rodríguez-Carbonell, E., Kapur, D.: Automatic generation of polynomial invariants of bounded degree using abstract interpretation. Sci. Comput. Program. 64(1), 54–75 (2007)MathSciNetCrossRefMATHGoogle Scholar
  13. 13.
    Sankaranarayanan, S., Sipma, H., Manna, Z.: Non-linear loop invariant generation using gröbner bases. In: POPL, pp. 318–329 (2004)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2011

Authors and Affiliations

  • Shikun Chen
    • 1
  • Zhoujun Li
    • 2
  • Xiaoyu Song
    • 3
  • Mengjun Li
    • 1
  1. 1.School of Computer ScienceNational University of Defense TechnologyChangshaChina
  2. 2.School of ComputerBeiHang UniversityBeijingChina
  3. 3.Dept. of Electrical and Computer EngineeringPortland State UniversityPortlandUSA

Personalised recommendations