Combining SAT Solvers with Computer Algebra Systems to Verify Combinatorial Conjectures


We present a method and an associated system, called MathCheck, that embeds the functionality of a computer algebra system (CAS) within the inner loop of a conflict-driven clause-learning SAT solver. SAT+CAS systems, à la MathCheck, can be used as an assistant by mathematicians to either find counterexamples or finitely verify open universal conjectures on any mathematical topic (e.g., graph and number theory, algebra, geometry, etc.) supported by the underlying CAS. Such a SAT+CAS system combines the efficient search routines of modern SAT solvers, with the expressive power of CAS, thus complementing both. The key insight behind the power of the SAT+CAS combination is that the CAS system can help cut down the search-space of the SAT solver, by providing learned clauses that encode theory-specific lemmas, as it searches for a counterexample to the input conjecture (just like the T in DPLL (T)). In addition, the combination enables a more efficient encoding of problems than a pure Boolean representation. In this paper, we leverage the capabilities of several different CAS, namely the SAGE, Maple, and Magma systems. As case studies, we study three long-standing open mathematical conjectures, two from graph theory regarding properties of hypercubes, and one from combinatorics about Hadamard matrices. The first conjecture states that any matching of any d-dimensional hypercube can be extended to a Hamiltonian cycle; the second states that given an edge-antipodal coloring of a hypercube there always exists a monochromatic path between two antipodal vertices; the third states that Hadamard matrices exist for all orders divisible by 4. Previous results on the graph theory conjectures have shown the conjectures true up to certain low-dimensional hypercubes, and attempts to extend them have failed until now. Using our SAT+CAS system, MathCheck, we extend these two conjectures to higher-dimensional hypercubes. Regarding Hadamard matrices, we demonstrate the advantages of SAT+CAS by constructing Williamson matrices up to order 42 (equivalently, Hadamard up to order \(4\times 42=168\)), improving the bounds up to which Williamson matrices of even order have been constructed. Prior state-of-the-art construction was only feasibly performed for odd numbers, where possible.

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

Fig. 1
Fig. 2
Fig. 3
Fig. 4
Fig. 5
Fig. 6
Fig. 7


  1. 1.

    All code and data is available at

  2. 2.

  3. 3.

    For notational convenience, we often use existential quantifiers when defining constraints; these are unrolled in the implementation. We only deal with finite graphs.

  4. 4.

    We were unable to find the original source of the results for \(d\le 4\), however the result is asserted in [22]. We also verified these results using our system.

  5. 5.

    In [63], the Hamiltonian cycle detection problem is reduced to SAT by encoding it as a permutation problem, such that if a Hamiltonian cycle exists, then the permutation extracted from the model corresponds to the cycle. In order to negate this existential check (as is needed by Formula 9), one must ensure that all permutations of the vertices do not correspond to a Hamiltonian cycle. While this can be succinctly expressed a quantified Boolean formula (QBF), a substantial number of universally quantified variables must be introduced. Hamiltonian cycle detection can also be succinctly expressed in answer set programming (ASP) [43], but similar search-space explosion problems still exist.

  6. 6.


  1. 1.

    Aloul, F.A. Markov, I.L. Sakallah, K.A.: Shatter: efficient symmetry-breaking for boolean satisfiability. In: Proceedings of the 40th Annual Design Automation Conference, pp. 836–839. ACM, (2003)

  2. 2.

    Areces, C., Déharbe, D., Pascal, F., Ezequiel, O.: SyMT: finding symmetries in SMT formulas. In: SMT Workshop 2013 11th International Workshop on Satisfiability Modulo Theories, (2013)

  3. 3.

    Audemard, G., Simon, L.: Predicting learnt clauses quality in modern SAT solvers. IJCAI 9, 399–404 (2009)

    Google Scholar 

  4. 4.

    Barrett, C., Conway, C.L., Deters, M., Hadarean, L., Jovanović, D., King, T., Reynolds, A.: CVC4. In: Gopalakrishnan, Ganesh, Qadeer, Shaz (eds.) Computer Aided Verification. Lecture Notes in Computer Science, vol. 6806, pp. 171–177. Springer, Berlin (2011)

    Google Scholar 

  5. 5.

    Bayless, S., Bayless, N., Hoos, H.H., Hu, A.J.: SAT modulo monotonic theories. In: Twenty-Ninth AAAI Conference on Artificial Intelligence, (2015)

  6. 6.

    Benhamou, B., Nabhani, T., Ostrowski, R., Saïdi, M.R.: Enhancing clause learning by symmetry in SAT solvers. In: 22nd IEEE International Conference on Tools with Artificial Intelligence (ICTAI), 2010, vol. 1, pp. 329–335. IEEE, (2010)

  7. 7.

    Biere, A., Heule, M.J.H., van Maaren, H., Walsh, T. (eds.): Handbook of satisfiability, volume 185 of frontiers in artificial intelligence and applications. IOS Press, (2009)

  8. 8.

    Bosma, W., Cannon, J., Playoust, C.: The magma algebra system I: the user language. J. Symb. Comput. 24(3), 235–265 (1997)

    MathSciNet  Article  MATH  Google Scholar 

  9. 9.

    Bouton, T., de Oliveira, D.C.B., Déharbe, D.: veriT: an open, trustable and efficient SMT-solver. In: Schmidt, R.A. (ed.) Automated Deduction: CADE-22. LNCS, vol. 5663, pp. 151–156. Springer, Berlin (2009)

    Google Scholar 

  10. 10.

    Bright, C., Ganesh, V., Heinle, A., Kotsireas, l., Nejati, S., Czarnecki, K.: MathCheck2: A SAT+CAS verifier for combinatorial conjectures. In: Computer Algebra in Scientific Computing (to appear). Springer, Berlin (2016)

  11. 11.

    Char, B.W., Fee, G.J., Geddes, K.O., Gonnet, G.H., Monagan, Michael B.: A tutorial introduction to Maple. J. Symb. Comput. 2(2), 179–200 (1986)

    Article  Google Scholar 

  12. 12.

    Chen, Y.-C., Li, K.-L.: Matchings extend to perfect matchings on hypercube networks. In: Proceedings of the International Multiconference of Engineers and Computer Scientists, vol. 1. Citeseer, (2010)

  13. 13.

    Colbourn, C.J., Dinitz, J.H. (eds.): Handbook of Combinatorial Designs. Discrete Mathematics and its Applications (Boca Raton), 2nd edn. Chapman & Hall/CRC, Boca Raton (2007)

  14. 14.

    Darga, P.T., Sakallah, K.A., Markov, I.L.: Faster symmetry discovery using sparsity of symmetries. In: Proceedings of the 45th Annual Design Automation Conference, pp. 149–154. ACM, (2008)

  15. 15.

    De Moura, L., Bjørner, N.: Z3: an efficient SMT solver. In Tools and Algorithms for the Construction and Analysis of Systems, pp. 337–340. Springer, Berlin (2008)

  16. 16.

    Déharbe, D., Fontaine, P., Merz, S., Paleo, B.W.: Exploiting symmetry in SMT problems. In: Automated deduction–CADE-23, pp. 222–236. Springer, Berlin (2011)

  17. 17.

    Devos, S., Norine, M.: Edge-antipodal colorings of cubes. Open Problems Garden (2008)

  18. 18.

    Dooms, G., Deville, Y., Dupont, P.: CP(Graph): introducing a graph computation domain in constraint programming. In: Principles and Practice of Constraint Programming-CP 2005, pp. 211–225. Springer, Berlin (2005)

  19. 19.

    Downey, R.G., Fellows, M.R.: Fundamentals of parameterized complexity, vol. 4. Springer, London (2013)

  20. 20.

    Een, N., Sörensson, N.: MiniSat: a SAT solver with conflict-clause minimization. Sat, 5:8th, (2005)

  21. 21.

    Feder, T.: Subi, Carlos: On hypercube labellings and antipodal monochromatic paths. Discrete Appl. Math. 161(10), 1421–1426 (2013)

    MathSciNet  Article  MATH  Google Scholar 

  22. 22.

    Fink, J.: Perfect matchings extend to Hamilton cycles in hypercubes. J. Comb. Theory Ser. B 97(6), 1074–1076 (2007)

    MathSciNet  Article  MATH  Google Scholar 

  23. 23.

    Fink, J.: Connectivity of matching graph of hypercube. SIAM J. Discrete Math. 23(2), 1100–1109 (2009)

    MathSciNet  Article  MATH  Google Scholar 

  24. 24.

    Frigo, M., Johnson, S.G.: The design and implementation of FFTW3. In: Proceedings of the IEEE, 93(2):216–231, (2005). Special issue on “Program Generation, Optimization, and Platform Adaptation”

  25. 25.

    Ganesh, V., Dill, D.L.: A decision procedure for bit-vectors and arrays. In: Computer Aided Verification, pp. 519–531. Springer, Berlin (2007)

  26. 26.

    Ganesh, V., O’donnell, C.W., Soos, M., Devadas, S., Rinard, M.C., Solar-Lezama, A.: Lynx: A programmatic SAT solver for the RNA-folding problem. In: Theory and Applications of Satisfiability Testing–SAT 2012, pp. 143–156. Springer, (2012)

  27. 27.

    Gebser, M., Janhunen, T., Rintanen, J.: SAT modulo graphs: Acyclicity. In: Logics in Artificial Intelligence, pp. 137–151. Springer, (2014)

  28. 28.

    Gent, I.P., Petrie, K.E., Puget, J.F.: Symmetry in constraint programming. Handbook of constraint programming, pp. 329–376, (2006)

  29. 29.

    Gent, I., Smith, P.: Symmetry breaking during search in constraint programming. Citeseer, Barbara (1999)

  30. 30.

    Gregor, P.: Perfect matchings extending on subcubes to Hamiltonian cycles of hypercubes. Discrete Math. 309(6), 1711–1713 (2009)

    MathSciNet  Article  MATH  Google Scholar 

  31. 31.

    Hadamard, J.: Résolution d’une question relative aux déterminants. Bull. Sci. Math. 17(1), 240–246 (1893)

    MATH  Google Scholar 

  32. 32.

    Hedayat, A., Wallis, W.D.: Hadamard matrices and their applications. Ann. Stat. 6(6), 1184–1238 (1978)

    MathSciNet  Article  MATH  Google Scholar 

  33. 33.

    Heule, M.J.H., Hunt, W.A., Wetzler, N.: Trimming while checking clausal proofs. In: Formal methods in computer-aided design (FMCAD), 2013, pp. 181–188. IEEE, (2013)

  34. 34.

    Heule, M.J.H., Kullmann, O., Marek, V.W.: Solving and verifying the boolean pythagorean triples problem via cube-and-conquer. arXiv preprint arXiv:1605.00723, (2016)

  35. 35.

    Holm, J., de Lichtenberg, K., Thorup, M.: Poly-logarithmic deterministic fully-dynamic algorithms for connectivity, minimum spanning tree, 2-edge, and biconnectivity. J. ACM 48(4), 723–760 (2001)

    MathSciNet  Article  MATH  Google Scholar 

  36. 36.

    Jackson, D.: Software Abstractions: Logic, Language, and Analysis. MIT Press, Cambridge (2012)

    Google Scholar 

  37. 37.

    Junttila, T., Kaski, P.: Engineering an efficient canonical labeling tool for large and sparse graphs. In: Applegate, D., Brodal, G.S., Panario, D., Sedgewick, R (eds) Proceedings of the Ninth Workshop on Algorithm Engineering and Experiments and the Fourth Workshop on Analytic Algorithms and Combinatorics, pp. 135–149. SIAM, (2007)

  38. 38.

    Konev, B., Lisitsa, A.: A SAT attack on the Erdős discrepancy conjecture. In: SAT, (2014)

  39. 39.

    Kotsireas, I.S.: Algorithms and Metaheuristics for Combinatorial Matrices. In: Handbook of Combinatorial Optimization, pp. 283–309. Springer, New York, (2013)

  40. 40.

    Kotsireas, I.S., Koukouvinos, C., Seberry, J.: Hadamard ideals and Hadamard matrices with two circulant core. Eur. J. Comb. 27(5), 658–668 (2006)

    MathSciNet  Article  MATH  Google Scholar 

  41. 41.

    Koukouvinos, C., Kounias, S.: Hadamard matrices of the Williamson type of order \(4\cdot m\), \(m=p\cdot q\) an exhaustive search for \(m=33\). Discrete Math 68(1), 45–57 (1988)

    MathSciNet  Article  MATH  Google Scholar 

  42. 42.

    Liang, J.H., Ganesh, V., Poupart, P., Czarnecki, K.: Exponential recency weighted average branching heuristic for SAT solvers. In: Schuurmans, D., Wellman, M.P. (eds), Proceedings of the Thirtieth AAAI Conference on Artificial Intelligence, February 12–17, 2016, Phoenix, Arizona, USA., pp. 3434–3440. AAAI Press, (2016)

  43. 43.

    Lifschitz, V.: What is answer set programming? AAAI 8, 1594–1597 (2008)

    Google Scholar 

  44. 44.

    Milicevic, A., Near, J.P., Kang, E., Jackson, D.: Alloy*: a general-purpose higher-order relational constraint solver. In: 37th IEEE/ACM International Conference on Software Engineering, ICSE 2015, Florence, Italy, May 16-24, 2015, Vol. 1, pp. 609–619, (2015)

  45. 45.

    Muller, D.E.: Application of Boolean algebra to switching circuit design and to error detection. Electronic Computers, Transactions of the IRE Professional Group on Electronic Computers, EC-3(3):6–12, (1954)

  46. 46.

    Nieuwenhuis, R., Oliveras, A., Tinelli, C.: Abstract DPLL and abstract DPLL modulo theories. In: Baader F., Voronkov A. (eds.) LPAR, volume 3452 of Lecture Notes in Computer Science, pp. 36–50. Springer, (2004)

  47. 47.

    Nipkow, T., Paulson, L.C., Wenzel, M.: Isabelle/HOL: a proof assistant for higher-order logic, vol. 2283. Springer Science & Business Media, (2002)

  48. 48.

    Doković, D.Z.: Williamson matrices of order 4n for n = 33, 35, 39. Discrete Math. 115(1), 267–271 (1993)

    MathSciNet  Article  MATH  Google Scholar 

  49. 49.

    Doković, D.Z., Kotsireas, I.S.: Compression of periodic complementary sequences and applications. Des. Codes Cryptogr. 74(2), 365–377 (2015)

    MathSciNet  Article  MATH  Google Scholar 

  50. 50.

    Paley, R.E.A.C.: On orthogonal matrices. J. Math. Phys. 12(1), 311–320 (1933)

    Article  MATH  Google Scholar 

  51. 51.

    Reed, I.: A class of multiple-error-correcting codes and the decoding scheme. Trans. IRE Prof. Group Inf. Theory 4(4), 38–49 (1954)

    MathSciNet  Article  Google Scholar 

  52. 52.

    Ruskey, F., Savage, C.: Hamilton cycles that extend transposition matchings in Cayley graphs of \({S}_n\). SIAM J. Discrete Math. 6(1), 152–166 (1993)

    MathSciNet  Article  MATH  Google Scholar 

  53. 53.

    Sakallah, K.A.: Symmetry and satisfiability. Handb. Satisf. 185, 289–338 (2009)

    Google Scholar 

  54. 54.

    Sebastiani, R.: Lazy satisfiability modulo theories. J. Satisf. Boolean Model. Comput. 3, 141–224 (2007)

    MathSciNet  MATH  Google Scholar 

  55. 55.

    Seberry, J.: Library of Williamson Matrices.

  56. 56.

    Sloane, N.: Library of Hadamard Matrices.

  57. 57.

    Soh, T., Le Berre, D., Roussel, S., Banbara, M., Tamura, N.: Incremental SAT-based method with native Boolean cardinality handling for the Hamiltonian cycle problem. In Logics in Artificial Intelligence, pp. 684–693. Springer, (2014)

  58. 58.

    Stein, W.A., et al.: Sage Mathematics Software (Version 6.3), (2010)

  59. 59.

    Sylvester, J.J.: Thoughts on inverse orthogonal matrices, simultaneous sign successions, and tessellated pavements in two or more colours, with applications to Newton’s rule, ornamental tile-work, and the theory of numbers. Lond. Edinb. Dublin Philos. Magaz. J. Sci. 34(232), 461–475 (1867)

    Google Scholar 

  60. 60.

    The Coq development team. The Coq proof assistant reference manual. LogiCal Project, 2004. Version 8.0

  61. 61.

    Thurley, M.: sharpSAT–counting models with advanced component caching and implicit BCP. In Theory and Applications of Satisfiability Testing–SAT 2006, pp. 424–429. Springer, (2006)

  62. 62.

    Torlak, E.: A constraint solver for software engineering: finding models and cores of large relational specifications. PhD thesis, Massachusetts Institute of Technology, (2009)

  63. 63.

    Velev, M.N., Gao, P.: Efficient SAT techniques for absolute encoding of permutation problems: Application to Hamiltonian cycles. In SARA, (2009)

  64. 64.

    Walsh, J.L.: A closed set of normal orthogonal functions. Am. J. Math. 45(1), 5–24 (1923)

    MathSciNet  Article  MATH  Google Scholar 

  65. 65.

    Stéfan van der Walt, S., Colbert, C., Varoquaux, G.: The NumPy array: a structure for efficient numerical computation. Comput. Sci. Eng. 13(2), 22–30 (2011)

    Article  Google Scholar 

  66. 66.

    Wetzler, N., Heule, M.J.H., Hunt Jr, W.A.: DRAT-trim: Efficient checking and trimming using expressive clausal proofs. In International Conference on Theory and Applications of Satisfiability Testing, pp. 422–429. Springer, (2014)

  67. 67.

    Williamson, J.: Hadamard’s determinant theorem and the sum of four squares. Duke Math. J 11(1), 65–81 (1944)

    MathSciNet  Article  MATH  Google Scholar 

  68. 68.

    Wolfram, S.: The Mathematica Book, version 4. Cambridge University Press, Cambridge (1999)

    Google Scholar 

  69. 69.

    Zulkoski, E., Ganesh, V.: SageSAT, (2015)

  70. 70.

    Zulkoski, E., Ganesh, V., Czarnecki, K.: MathCheck: A math assistant based on a combination of computer algebra systems and SAT solvers. In International Conference on Automated Deduction, Berlin, Germany, 08/2015. Springer, Berlin (2015)

Download references

Author information



Corresponding author

Correspondence to Edward Zulkoski.

Rights and permissions

Reprints and Permissions

About this article

Verify currency and authenticity via CrossMark

Cite this article

Zulkoski, E., Bright, C., Heinle, A. et al. Combining SAT Solvers with Computer Algebra Systems to Verify Combinatorial Conjectures. J Autom Reasoning 58, 313–339 (2017).

Download citation


  • Travel Salesman Problem
  • Hamiltonian Cycle
  • Computer Algebra System
  • Conjunctive Normal Form
  • Satisfiability Modulo Theory