Skip to main content

On the Usefulness of Linear Modular Arithmetic in Constraint Programming

  • Conference paper
  • First Online:
Integration of Constraint Programming, Artificial Intelligence, and Operations Research (CPAIOR 2021)

Abstract

Linear modular constraints are a powerful class of constraints that arise naturally in cryptanalysis, checksums, hash functions, and the like. Given their importance, the past few years have witnessed the design of combinatorial solvers with native support for linear modular constraints, and the availability of such solvers has led to the emergence of new applications. While there exist global constraints in cp that consider congruence classes over domain values, linear modular arithmetic constraints have yet to appear in the global constraint catalogue despite their past investigation in the context of model counting for csps. In this work we seek to remedy the situation by advocating the integration of linear modular constraints in state-of-the-art cp solvers.

Contrary to previous belief, we conclude from an empirical investigation that Gauss-Jordan Elimination based techniques can provide an efficient and scalable way to handle linear modular constraints. On the theoretical side, we remark on the pairwise independence offered by hash functions based on linear modular constraints, and then discuss the design of hashing-based model counters for cp, supported by empirical results showing the accuracy and computational savings that can be achieved. We further demonstrate the usefulness of native support for linear modular constraints with applications to checksums and model counting.

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

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 39.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Notes

  1. 1.

    One exception is the work on bit-vector domains, involving some modular arithmetic, with applications to software verification and cryptography [1, 8, 13].

  2. 2.

    Available at https://github.com/PesantGilles/MiniCPBP.

  3. 3.

    In practice we actually implement the compact table filtering algorithm and apply it directly instead of repeatedly posting and retracting Table constraints.

  4. 4.

    For example if p is chosen as the smallest prime number larger than the domain size, as one can always find a prime between d and 2d for any \(d>1\).

References

  1. Bardin, S., Herrmann, P., Perroud, F.: An alternative to SAT-based approaches for bit-vectors. In: Esparza, J., Majumdar, R. (eds.) TACAS 2010. LNCS, vol. 6015, pp. 84–98. Springer, Heidelberg (2010). https://doi.org/10.1007/978-3-642-12002-2_7

    Chapter  MATH  Google Scholar 

  2. Beldiceanu, N., Carlsson, M., Demassey, S., Petit, T.: Global constraint catalogue: past, present and future. Constraints Int. J. 12(1), 21–62 (2007). https://doi.org/10.1007/s10601-006-9010-8

    Article  MathSciNet  MATH  Google Scholar 

  3. Carter, J.L., Wegman, M.N.: Universal classes of hash functions. In: ACM Symposium on Theory of Computing, pp. 106–112. ACM (1977)

    Google Scholar 

  4. Chakraborty, S., Meel, K.S., Mistry, R., Vardi, M.Y.: Approximate probabilistic inference via word-level counting. In: Proceedings of AAAI (2016)

    Google Scholar 

  5. Chakraborty, S., Meel, K.S., Vardi, M.Y.: A scalable approximate model counter. In: Schulte, C. (ed.) CP 2013. LNCS, vol. 8124, pp. 200–216. Springer, Heidelberg (2013). https://doi.org/10.1007/978-3-642-40627-0_18

    Chapter  Google Scholar 

  6. Chakraborty, S., Meel, K.S., Vardi, M.Y.: Algorithmic improvements in approximate counting for probabilistic inference: from linear to logarithmic SAT calls. In: Proceedings of IJCAI (2016)

    Google Scholar 

  7. Chakraborty, S., Meel, K.S., Vardi, M.Y.: On the hardness of probabilistic inference relaxations. In: Proceedings of AAAI (2019)

    Google Scholar 

  8. Chihani, Z., Marre, B., Bobot, F., Bardin, S.: Sharpening constraint programming approaches for bit-vector theory. In: Salvagnin, D., Lombardi, M. (eds.) CPAIOR 2017. LNCS, vol. 10335, pp. 3–20. Springer, Cham (2017). https://doi.org/10.1007/978-3-319-59776-8_1

    Chapter  MATH  Google Scholar 

  9. Demeulenaere, J., et al.: Compact-table: efficiently filtering table constraints with reversible sparse bit-sets. In: Rueher, M. (ed.) CP 2016. LNCS, vol. 9892, pp. 207–223. Springer, Cham (2016). https://doi.org/10.1007/978-3-319-44953-1_14

    Chapter  Google Scholar 

  10. Gomes, C.P., Sabharwal, A., Selman, B.: Model counting: a new strategy for obtaining good bounds. Proc. AAAI 21, 54–61 (2006)

    MATH  Google Scholar 

  11. Gomes, C.P., van Hoeve, W.J., Sabharwal, A.Selman, B.: Counting CSP solutions using generalized XOR constraints. In: AAAI, pp. 204–209. AAAI Press (2007)

    Google Scholar 

  12. Meel, K.S., Akshay, S.: Sparse hashing for scalable approximate model counting: theory and practice. In: Proceedings of Logic in Computer science (LICS), July 2020

    Google Scholar 

  13. Michel, L.D., Van Hentenryck, P.: Constraint satisfaction over bit-vectors. In: Milano, M. (ed.) CP 2012. LNCS, pp. 527–543. Springer, Heidelberg (2012). https://doi.org/10.1007/978-3-642-33558-7_39

    Chapter  Google Scholar 

  14. Smith, C., Gomes, C., Fernández, C.: Streamlining local search for spatially balanced Latin squares. In: Kaelbling, L.P., Saffiotti, A. (eds.) IJCAI-05, Proceedings of the Nineteenth International Joint Conference on Artificial Intelligence, Edinburgh, Scotland, UK, 30 July–5 August 2005, pp. 1539–1540. Professional Book Center (2005)

    Google Scholar 

  15. Soos, M., Gocht, S., Meel, K.S.: Tinted, detached, and lazy CNF-XOR solving and its applications to counting and sampling. In: Lahiri, S.K., Wang, C. (eds.) CAV 2020. LNCS, vol. 12224, pp. 463–484. Springer, Cham (2020). https://doi.org/10.1007/978-3-030-53288-8_22

    Chapter  Google Scholar 

  16. Soos, M., Meel, K.S.: BIRD: engineering an efficient CNF-XOR SAT solver and its applications to approximate model counting. In: Proceedings of AAAI Conference on Artificial Intelligence (AAAI), January 2019

    Google Scholar 

  17. Soos, M., Nohl, K., Castelluccia, C.: Extending SAT solvers to cryptographic problems. In: Kullmann, O. (ed.) SAT 2009. LNCS, vol. 5584, pp. 244–257. Springer, Heidelberg (2009). https://doi.org/10.1007/978-3-642-02777-2_24

    Chapter  Google Scholar 

  18. Trick, M.A.: A dynamic programming approach for consistency and propagation for knapsack constraints. Ann. OR 118(1–4), 73–84 (2003). https://doi.org/10.1023/A:1021801522545

    Article  MathSciNet  MATH  Google Scholar 

  19. Vadhan, S.P., et al.: Pseudorandomness. Found. Trends® Theor. Comput. Sci. 7(1–3), 1–336 (2012)

    Google Scholar 

  20. Valiant, L.G.: The complexity of enumeration and reliability problems. SIAM J. Comput. 8(3), 410–421 (1979)

    Article  MathSciNet  Google Scholar 

  21. Verhaeghe, H., Lecoutre, C., Deville, Y., Schaus, P.: Extending compact-table to basic smart tables. In: Beck, J.C. (ed.) CP 2017. LNCS, vol. 10416, pp. 297–307. Springer, Cham (2017). https://doi.org/10.1007/978-3-319-66158-2_19

    Chapter  Google Scholar 

Download references

Acknowledgements

We thank the anonymous reviewers for their constructive criticism which helped us improve the original version of the paper. Financial support for this research was provided in part by NSERC Discovery Grant 218028/2017 and by National Research Foundation Singapore under its NRF Fellowship Programme [NRF-NRFFAI1-2019-0004].

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Gilles Pesant .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2021 Springer Nature Switzerland AG

About this paper

Check for updates. Verify currency and authenticity via CrossMark

Cite this paper

Pesant, G., Meel, K.S., Mohammadalitajrishi, M. (2021). On the Usefulness of Linear Modular Arithmetic in Constraint Programming. In: Stuckey, P.J. (eds) Integration of Constraint Programming, Artificial Intelligence, and Operations Research. CPAIOR 2021. Lecture Notes in Computer Science(), vol 12735. Springer, Cham. https://doi.org/10.1007/978-3-030-78230-6_16

Download citation

  • DOI: https://doi.org/10.1007/978-3-030-78230-6_16

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-030-78229-0

  • Online ISBN: 978-3-030-78230-6

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics