A Note on Karr’s Algorithm

  • Markus Müller-Olm
  • Helmut Seidl
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 3142)


We give a simple formulation of Karr’s algorithm for computing all affine relationships in affine programs. This simplified algorithm runs in time \(\mathcal{O}(nk^{3})\) where n is the program size and k is the number of program variables assuming unit cost for arithmetic operations. This improves upon the original formulation by a factor of k. Moreover, our re-formulation avoids exponential growth of the lengths of intermediately occurring numbers (in binary representation) and uses less complicated elementary operations. We also describe a generalization that determines all polynomial relations up to degree d in time \(\mathcal{O}(nk^{3d})\).


Arithmetic Operation Complete Lattice Gaussian Elimination Program Variable Program Point 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Bagnara, R., Hill, P., Ricci, E., Zaffanella, E.: Precise Widening Operators for Convex Polyhedra. In: Cousot, R. (ed.) SAS 2003. LNCS, vol. 2694, pp. 337–354. Springer, Heidelberg (2003)CrossRefGoogle Scholar
  2. 2.
    Cousot, P., Cousot, R.: Abstract Interpretation:A Unified Lattice Model for Static Analysis of Programs by Construction or Approximation of Fixpoints. In: 4th POPL (1977)Google Scholar
  3. 3.
    Cousot, P., Halbwachs, N.: Automatic Discovery of Linear Restraints among Variables of a Program. In: 5th POPL, pp. 84–97 (1978)Google Scholar
  4. 4.
    Gulwani, S., Necula, G.: Discovering Affine Equalities Using Random Interpretation. In: 30th POPL, pp. 74–84 (2003)Google Scholar
  5. 5.
    Hecht, M.S.: Flow analysis of computer programs. Elsevier North-Holland, Amsterdam (1977)zbMATHGoogle Scholar
  6. 6.
    Karr, M.: Affine Relationships Among Variables of a Program. Acta Inf. 6, 133–151 (1976)zbMATHCrossRefMathSciNetGoogle Scholar
  7. 7.
    Leroux, J.: Algorithmique de la Vérification des Systèmes à Compteurs: Approximation et Accélération. PhD thesis, Ecole Normale Supérieure de Cachan (2003)Google Scholar
  8. 8.
    Müller-Olm, M., Rüthing, O.: The Complexity of Constant Propagation. In: Sands, D. (ed.) ESOP 2001. LNCS, vol. 2028, pp. 190–205. Springer, Heidelberg (2001)CrossRefGoogle Scholar
  9. 9.
    Müller-Olm, M., Seidl, H.: Computing Polynomial Program Invariants (2003) (submitted)Google Scholar
  10. 10.
    Müller-Olm, M., Seidl, H.: Polynomial Constants are Decidable. In: Hermenegildo, M.V., Puebla, G. (eds.) SAS 2002. LNCS, vol. 2477, pp. 4–19. Springer, Heidelberg (2002)CrossRefGoogle Scholar
  11. 11.
    Müller-Olm, M., Seidl, H.: Precise Interprocedural Analysis through Linear Algebra. In: 31st POPL, pp. 330–341 (2004)Google Scholar
  12. 12.
    Papadimitriou, C.H.: Computational Complexity. Addison-Wesley, Reading (1994)zbMATHGoogle Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2004

Authors and Affiliations

  • Markus Müller-Olm
    • 1
  • Helmut Seidl
    • 2
  1. 1.FB Informatik, LG PI 5FernUniversität HagenHagenGermany
  2. 2.Informatik, I2TU MünchenMünchenGermany

Personalised recommendations