Skip to main content

Symbolic Transformation of Expressions in Modular Arithmetic

  • Conference paper
  • First Online:
Static Analysis (SAS 2023)

Part of the book series: Lecture Notes in Computer Science ((LNCS,volume 14284))

Included in the following conference series:

Abstract

We present symbolic methods to improve the precision of static analyses of modular integer expressions based on Abstract Interpretation. Like similar symbolic methods, the idea is to simplify on-the-fly arithmetic expressions before they are given to abstract transfer functions of underlying abstract domains. When manipulating fixed-length integer data types, casts and overflows generally act like modulo computations which hinder the use of symbolic techniques. The goal of this article is to formalize how modulo operations can be safely eliminated by abstracting arbitrary arithmetic expressions into sum, product, or division of linear forms with integer coefficients, while simplifying them. We provide some rules to simplify arithmetic expressions that are involved in the computation of linear interpolations, while ensuring the soundness of the transformation.

All these methods have been incorporated within the Astrée static analyzer that checks for the absence of run-time errors in embedded critical software, but also in an available toy abstract interpreter. The effects of our new abstract domain are then evaluated on several code excerpts from industrial code.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Subscribe and save

Springer+ Basic
$34.99 /Month
  • Get 10 units per month
  • Download Article/Chapter or eBook
  • 1 Unit = 1 Article or 1 Chapter
  • Cancel anytime
Subscribe now

Buy Now

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Similar content being viewed by others

Notes

  1. 1.

    that is to say for every set .

References

  1. Blanchet, B., et al.: Design and implementation of a special-purpose static program analyzer for safety-critical real-time embedded software. In: Mogensen, T.Æ., Schmidt, D.A., Sudborough, I.H. (eds.) The Essence of Computation. LNCS, vol. 2566, pp. 85–108. Springer, Heidelberg (2002). https://doi.org/10.1007/3-540-36377-7_5

    Chapter  Google Scholar 

  2. Blanchet, B., et al.: A static analyzer for large safety-critical software. In: Programming Language Design and Implementation. ACM (2003). https://doi.org/10.1145/781131.781153

  3. Boillot, J., Feret, J.: Artifact for “symbolic transformation of expressions in modular arithmetic” (2023). https://doi.org/10.5281/zenodo.8186873

  4. Cousot, P., Cousot, R.: Static determination of dynamic properties of programs. In: International Symposium on Programming. Dunod (1976). https://doi.org/10.1145/390019.808314

  5. Cousot, P., Cousot, R.: Abstract interpretation: a unified lattice model for static analysis of programs by construction or approximation of fixpoints. In: Principles of Programming Languages. ACM (1977). https://doi.org/10.1145/512950.512973

  6. Cousot, P., Cousot, R.: Abstract interpretation and application to logic programs. J. Log. Program. (1992). https://doi.org/10.1016/0743-1066(92)90030-7

    Article  MathSciNet  Google Scholar 

  7. Cousot, P., Cousot, R.: Comparing the Galois connection and widening/narrowing approaches to abstract interpretation. In: Bruynooghe, M., Wirsing, M. (eds.) PLILP 1992. LNCS, vol. 631, pp. 269–295. Springer, Heidelberg (1992). https://doi.org/10.1007/3-540-55844-6_142

    Chapter  Google Scholar 

  8. Cousot, P., Halbwachs, N.: Automatic discovery of linear restraints among variables of a program. In: Principles of Programming Languages. ACM (1978). https://doi.org/10.1145/512760.512770

  9. Cytron, R., Ferrante, J., Rosen, B.K., Wegman, M.N., Zadeck, F.K.: Efficiently computing static single assignment form and the control dependence graph. Trans. Program. Lang. Syst. 13, 451–490 (1991). https://doi.org/10.1145/115372.115320

    Article  Google Scholar 

  10. Gallois-Wong, D.: Formalisation en Coq des algorithmes de filtre numérique calculés en précision finie. (Coq formalization of digital filter algorithms computed using finite precision arithmetic). Ph.D. thesis, University of Paris-Saclay, France (2021). https://tel.archives-ouvertes.fr/tel-03202580

  11. Granger, P.: Static analysis of arithmetical congruences. Int. J. Comput. Math. 30, 165–190 (1989). https://doi.org/10.1080/00207168908803778

    Article  Google Scholar 

  12. Granger, P.: Static analysis of linear congruence equalities among variables of a program. In: Abramsky, S., Maibaum, T.S.E. (eds.) CAAP 1991. LNCS, vol. 493, pp. 169–192. Springer, Heidelberg (1991). https://doi.org/10.1007/3-540-53982-4_10

    Chapter  Google Scholar 

  13. Halbwachs, N., Péron, M.: Discovering properties about arrays in simple programs. In: Programming Language Design and Implementation. ACM (2008). https://doi.org/10.1145/1375581.1375623

  14. ISO: International Standard ISO/IEC 9899:1999. International Organization for Standardization (2007). http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1256.pdf

  15. Jeannet, B., Miné, A.: Apron: a library of numerical abstract domains for static analysis. In: Bouajjani, A., Maler, O. (eds.) CAV 2009. LNCS, vol. 5643, pp. 661–667. Springer, Heidelberg (2009). https://doi.org/10.1007/978-3-642-02658-4_52

    Chapter  Google Scholar 

  16. Journault, M., Miné, A., Monat, R., Ouadjaout, A.: Combinations of reusable abstract domains for a multilingual static analyzer. In: Chakraborty, S., Navas, J.A. (eds.) VSTTE 2019. LNCS, vol. 12031, pp. 1–18. Springer, Cham (2020). https://doi.org/10.1007/978-3-030-41600-3_1

    Chapter  Google Scholar 

  17. Logozzo, F., Fähndrich, M.: Pentagons: a weakly relational abstract domain for the efficient validation of array accesses. In: Symposium on Applied Computing. ACM (2008). https://doi.org/10.1016/j.scico.2009.04.004

  18. Masdupuy, F.: Array abstractions using semantic analysis of trapezoid congruences. In: International Conference on Supercomputing. ACM (1992). https://doi.org/10.1145/143369.143414

  19. Miné, A.: A new numerical abstract domain based on difference-bound matrices. In: Danvy, O., Filinski, A. (eds.) PADO 2001. LNCS, vol. 2053, pp. 155–172. Springer, Heidelberg (2001). https://doi.org/10.1007/3-540-44978-7_10

    Chapter  Google Scholar 

  20. Mine, A.: The octagon abstract domain. In: Proceedings Eighth Working Conference on Reverse Engineering. IEEE Computer Society (2001). https://doi.org/10.1109/WCRE.2001.957836

  21. Miné, A.: Symbolic methods to enhance the precision of numerical abstract domains. In: Emerson, E.A., Namjoshi, K.S. (eds.) VMCAI 2006. LNCS, vol. 3855, pp. 348–363. Springer, Heidelberg (2005). https://doi.org/10.1007/11609773_23

    Chapter  Google Scholar 

  22. Müller-Olm, M., Seidl, H.: Analysis of modular arithmetic. In: Sagiv, M. (ed.) ESOP 2005. LNCS, vol. 3444, pp. 46–60. Springer, Heidelberg (2005). https://doi.org/10.1007/978-3-540-31987-0_5

    Chapter  Google Scholar 

  23. Simon, A., King, A.: Taming the wrapping of integer arithmetic. In: Nielson, H.R., Filé, G. (eds.) SAS 2007. LNCS, vol. 4634, pp. 121–136. Springer, Heidelberg (2007). https://doi.org/10.1007/978-3-540-74061-2_8

    Chapter  Google Scholar 

  24. Venet, A.J.: The gauge domain: scalable analysis of linear inequality invariants. In: Madhusudan, P., Seshia, S.A. (eds.) CAV 2012. LNCS, vol. 7358, pp. 139–154. Springer, Heidelberg (2012). https://doi.org/10.1007/978-3-642-31424-7_15

    Chapter  Google Scholar 

Download references

Acknowledgements

We thank the anonymous referees for their constructive comments and suggestions. Furthermore, we extend our gratitude to Josselin Giet, Marc Chevalier and Antoine Miné for granting us permission to publish a toy abstract interpreter they created, which served as the foundation for our artifact.

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Jérôme Boillot .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2023 The Author(s), under exclusive license to Springer Nature Switzerland AG

About this paper

Check for updates. Verify currency and authenticity via CrossMark

Cite this paper

Boillot, J., Feret, J. (2023). Symbolic Transformation of Expressions in Modular Arithmetic. In: Hermenegildo, M.V., Morales, J.F. (eds) Static Analysis. SAS 2023. Lecture Notes in Computer Science, vol 14284. Springer, Cham. https://doi.org/10.1007/978-3-031-44245-2_6

Download citation

  • DOI: https://doi.org/10.1007/978-3-031-44245-2_6

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-031-44244-5

  • Online ISBN: 978-3-031-44245-2

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics