Abstract
We consider integer arithmetic modulo a power of 2 as provided by mainstream programming languages like Java or standard implementations of C. The difficulty here is that the ring ℤ m of integers modulo m = 2w, w > 1, has zero divisors and thus cannot be embedded into a field. Not withstanding that, we present intra- and inter-procedural algorithms for inferring for every program point u, affine relations between program variables valid at u. Our algorithms are not only sound but also complete in that they detect all valid affine relations. Moreover, they run in time linear in the program size and polynomial in the number of program variables and can be implemented by using the same modular integer arithmetic as the target language to be analyzed.
Chapter PDF
Similar content being viewed by others
References
Cousot, P., Halbwachs, N.: Automatic Discovery of Linear Restraints among Variables of a Program. In: 5th ACM Symp. on Principles of Programming Languages (POPL), pp. 84–97 (1978)
Gosling, J., Joy, B., Steele, G.: The Java Language Specification. Addison-Wesley, Reading (1996)
Granger, P.: Static Analysis of Linear Congruence Equalities among Variables of a Program. In: Abramsky, S. (ed.) CAAP 1991 and TAPSOFT 1991. LNCS, vol. 493, pp. 169–192. Springer, Heidelberg (1991)
Gulwani, S., Necula, G.: Discovering Affine Equalities Using Random Interpretation. In: 30th ACM Symp. on Principles of Programming Languages (POPL), pp. 74–84 (2003)
Hafner, J., McCurley, K.: Asymptotically Fast Triangularization of Matrices over Rings. SIAM J. of Computing 20(6), 1068–1083 (1991)
Karr, M.: Affine Relationships Among Variables of a Program. Acta Informatica 6, 133–151 (1976)
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)
Müller-Olm, M., Seidl, H.: A Note on Karr’s Algorithm. In: Díaz, J., Karhumäki, J., Lepistö, A., Sannella, D. (eds.) ICALP 2004. LNCS, vol. 3142, pp. 1016–1028. Springer, Heidelberg (2004)
Müller-Olm, M., Seidl, H.: Computing Polynomial Program Invariants. Information Processing Letters (IPL) 91(5), 233–244 (2004)
Müller-Olm, M., Seidl, H.: Interprocedural Analysis of Modular Arithmetic. Technical Report 789, Fachbereich Informatik, Universität Dortmund (2004)
Müller-Olm, M., Seidl, H.: Precise Interprocedural Analysis through Linear Algebra. In: 31st ACM Symp. on Principles of Programming Languages (POPL), pp. 330–341 (2004)
Reps, T., Schwoon, S., Jha, S.: Weighted Pushdown Systems and their Application to Interprocedural Dataflow Analysis. In: Cousot, R. (ed.) SAS 2003. LNCS, vol. 2694, pp. 189–213. Springer, Heidelberg (2003)
Storjohann, A.: Algorithms for Matrix Canonical Forms. PhD thesis, ETH Zürich, Diss. ETH No. 13922 (2000)
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2005 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Müller-Olm, M., Seidl, H. (2005). Analysis of Modular Arithmetic. In: Sagiv, M. (eds) Programming Languages and Systems. ESOP 2005. Lecture Notes in Computer Science, vol 3444. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-540-31987-0_5
Download citation
DOI: https://doi.org/10.1007/978-3-540-31987-0_5
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-25435-5
Online ISBN: 978-3-540-31987-0
eBook Packages: Computer ScienceComputer Science (R0)