Analysis of modular arithmetic

  • Authors:
  • Markus Müller-Olm;Helmut Seidl

  • Affiliations:
  • Westfälische Wilhelms-Universität Münster, Münster, Germany;TU München, München, Germany

  • Venue:
  • ACM Transactions on Programming Languages and Systems (TOPLAS) - Special Issue ESOP'05
  • Year:
  • 2007

Quantified Score

Hi-index 0.00

Visualization

Abstract

We consider integer arithmetic modulo a power of 2 as providedby mainstream programming languages like Java or standardimplementations of C. The difficulty here is that, for w 1, the ring Zm of integers modulom = 2w has zero divisors and thus cannotbe embedded into a field. Not withstanding that, we present intra-and interprocedural algorithms for inferring for every programpoint u affine relations between program variables valid atu. If conditional branching is replaced withnondeterministic branching, our algorithms are not only sound butalso complete in that they detect all valid affinerelations in a natural class of programs. Moreover, they run intime linear in the program size and polynomial in the number ofprogram variables and can be implemented by using the same modularinteger arithmetic as the target language to be analyzed. We alsoindicate how our analysis can be extended to deal with equalityguards, even in an interprocedural setting.