A tool for generating hard SAT instances (in the DIMACS format) based on the integer factoring problem. The samples directory contains some examples generated by this tool.
The main contributor:
- Sergejs Kozlovičs
Kozlovičs, S. (2022). Shared SAT Solvers and SAT Memory in Distributed Business Applications. In: Ivanovic, M., Kirikova, M., Niedrite, L. (eds) Digital Business and Intelligent Systems. Baltic DB&IS 2022. Communications in Computer and Information Science, vol 1598. Springer, Cham.
The PrimesProductToSAT.py
script generates a SAT instance from the known product
If
Since our generator uses the Karatsuba multiplication algorithm recursively, the number of bits of each factor (and, hence, the product) must be a power of 2. Thus, we may extend the length of
For known
./PrimesProductToSAT.py <p> <q>
If you know only the product
./PrimesProductToSAT.py <n> <number-of-bits-in-p> <number-of-bits-in-q>
The resulting file will be named <n>.cnf
and will be stored according to the DIMACS format (a textual format for describing SAT instances in CNF). Look at the comments in that file: you will see which SAT variables will correspond to the bits of the two factors of
Warning! If you try to simplify the generated .cnf file (e.g., by
lingeling -s
), the names of the variables may change. In that case, it would be difficult to substitute variables with the bits of the factors of$n$ .
For testing purposes, you will need the python-sat
library:
pip3 install python-sat
Then just play with Test.py
.