You are on page 1of 0

SAT-Driven Prime Factorization

Christopher S. Dalton
Dr. Dan Ventura, Computer Science, College of Physical and Mathematical Science
Objective of the Project
In this project we will seek to develop a polynomial-time prime factorization algorithm,
focusing primarily on large products of two primes. We will reduce their factorization to Boolean
satisfiability and solve it by joining truth tables.
Importance of the Project
In the middle of the 20th century, computer scientists hit a brick wall. For years, the
fledgling field had been able to come up with clever solutions to difficult problems in computing,
but now they had stumbled on some hard problems. Solving these problems could take
computers geologic amounts of time. These problems belonged to the complexity class that is
now known as NP-complete. NP-complete is the set of the toughest problems within a class
called NP. Unlike problems in the class P (another class within NP composed of easy problems
like adding, sorting, etc.), mathematicians and computer scientists could not find a way to solve
NP-complete problems in polynomial time, meaning quickly.
Prime factorization is the problem of finding prime numbers that multiply into a given
composite number. There is not a known algorithm that accomplishes this task in sub-
exponential time. The prime factorization problem has revolutionized computer security and
been a part of making the Internet what it is today. Thanks to the apparent difficulty of this
problem, remote computers can encrypt and share sensitive data over public communication
lines without ever having exchanged keys privately. This is crucial in credit card transactions and
many other online activities. In almost all modern Internet security, the key to encrypting data
contains the product of two prime numbers, and the key to decrypting that data is a function of
the primes themselves. A web server can easily pick two large prime numbers, multiply them
together, and publish the result as part of a public encryption key. As long as it keeps its prime
factors private, it will be the only computer on the net capable of understanding the secure
communications from its clients ... unless somebody can factor the public key. The question is
still open whether or not prime factorization is in P. Weve gambled our digital security on the
belief that it cant be done in polynomial time. If it can, we need to adopt a new method of
cryptography. Furthermore, a SAT- driven polynomial-time prime factorization algorithm could
be a step towards resolving the P vs. NP question (one of the most famous in all of computer
science and mathematics).
Proposal
In 1971 Stephen Cook released a paper entitled The Complexity of Theorem-Proving
Procedures. In this paper he showed that any problem in NP can be reduced to Boolean
satisfiability. If Boolean satisfiability can be solved quickly, any NP problem can (Cook, 1971).
Boolean satisfiability (also known as SAT) is the problem of finding true/false variable
assignments that satisfy a logical expression. In this project we will work to factor numbers by
1
satisfying Boolean expressions. These particular SAT problems will have many special
properties (for example, SAT problems that represent the factorization of products of two primes
can have exactly one solution). I have already written the algorithm that will convert prime
factorization problems to SAT instances. Before creating the algorithm, I searched the Internet to
learn how to do it, but found very little. I ended up having to figure it out mostly on my own,
which may suggest that reducing to SAT is a little-explored novel approach to prime
factorization.
I have been thinking about the SAT-solving algorithm we will implement for close to a
year now. It first rewrites each clause in the Boolean expression as a truth table. Once these
tables have been created, the solution to the SAT instance is well-defined and can be found by
computing the join of all the tables. The Boolean expressions generated from prime factorization
will be guaranteed to yield base tables that fit in a reasonable amount of space, but during the
join operations their size can grow exponentially. The meat of this project will be finding a way
of joining these tables in polynomial space and time.
One possible solution to joining the truth tables that we will focus on is to detect and
weed out false solutions. The join operation does not produce a unique factorization, so its
possible to remove false solutions by joining two tables and then dividing the result back into its
original two components. Doing this iteratively can greatly reduce the memory footprint. Since
the SAT problems we will be focusing on will have only one solution, we could theoretically
clean out all but one row from each truth table. If this can be done, the problem is solved.
We will also focus on the possibility of compacting the space used by the tables. Tick
marks are a poor choice for expressing large integers; it can be done in much less space by a
product of primes or, even better, a string of digits. Likewise, instead of just enumerating rows,
any truth table generated by our algorithm can be expressed in a logarithmic amount of space by
a product of irreducible truth tables under the join operation. Finding a way to compactly define
these tables while still giving them polynomial-time usability would make prime factorization in
sub-exponential time possible.
Anticipated Academic Outcome
It is our goal to finish this project with formal proofs, a program that is very good at
factoring numbers, and a publication offering new insights on prime factorization and Boolean
satisfiability.
Qualifications
I am in the final year of my Bachelors Degree in Computer Science. For the past 8 years
I have worked as a programmer. While I love all aspects of computing, I am particularly
passionate about algorithm design. In one of my classes, we learned that traditional division
requires O(n
2
) time. Later that semester I found a way to perform divides in O(n log
2
n) time. In
January 2010 I figured out how to reduce prime factorization problems to SAT instances.
Afterward I spent a lot of time working on a SAT solver. I got to the point of solving nontrivial
instances with around 500 variables and 5,000 clauses in under 4 seconds on my commodity
home PC. I am fascinated by difficult problems in computing and am excited to apply everything
Ive thought about in proofs and a SAT-driven prime factorization program.
2
Dr. Ventura is an Associate Professor of Computer Science at BYU. He teaches both
undergraduate and graduate level theory courses that include computational complexity (the sets
P, NP, NP-complete, etc.). His research interests include machine learning, artificial intelligence
and computational creativity.
Project Timetable
Formalize a proof on truth table joining and dene all aspects of the
algorithm
2-5 weeks
Wrap up the reduction from prime factorization to SAT into a stand-
alone program
1 day
Create a parser for conjunctive normal form SAT les 1 day
Make a truth table class with schema, joining, individual bit access, etc 1 week
Implement the truth table joining algorithm 1 week
Search for more algorithmic and mathematical optimizations/proofs 2-3 weeks
Improve the performance by expanding to multiple CPU cores and the
GPU
2 weeks
Benchmark our solver against well-known/state-of-the-art SAT solvers
and factorizers
2 weeks
Fit with BYUs Mission
This project seeks to assist children who struggle with special challenges, hopefully
increasing the knowledge and research regarding how we can best help them progress. At the
same time, it provides an enriching experience for the students involved, exposing us to ways in
which we can gear our studies towards lifelong learning and service.
Scholarly Sources
Bahmann, Helge, & Schatte, Peter. (2001). Analysis of Some Elementary Algorithms for Prime
Factorization. Computing, 66(1), 91.
Cook, Stephen. (1971). The Complexity of Theorem Proving Procedures. Proceedings of the
Third Annual ACM Symposium on Theory of Computing. pp. 151158.
Garey, Michael R., & Johnson, David S. (1979). Computers and Intractibility: A Guide to the
Theory of NP-Completeness. W.H. Freeman and Company, New York.
Fortnow, Lance, & Aaronson, Scott. (2009). The Status of the P versus NP Problem.
Communications of the ACM, 52(9), 78-86.
3

You might also like