The approach is analogous to the approach of ToughSAT. For a high level overview, the algorithm works like this:
Input: N=pq, with unknown primes p and q.
- n← bitlength(N)
- Take 2n variables for the binary representation of p and q and write:
xn−1xn−2...x1x0⋅yn−1yn−2...y1y0Then apply the school method for multiplying two integers. - This multiplication creates a list of equations that heavily depend on each other.
- Replace each equation with an equivalent formula that only uses the boolean operators "and" and "or".
- Transform the boolean formula to a 3CNF
Assume we have N=15, then the first step of the school method yields the following 16 values:
x3 x2 x1 x0 * y3 y2 y1 y0 =
-------------------------------------------------------------
x3ANDy3 x2ANDy3 x1ANDy3 x0ANDy3
x3ANDy2 x2ANDy2 x1ANDy2 x0ANDy2
x3ANDy1 x2ANDy1 x1ANDy1 x0ANDy1
x3ANDy0 x2ANDy0 x1ANDy0 x0ANDy0
-------------------------------------------------------------
pp3,3 pp2,3 pp1,3 pp0,3
pp3,2 pp2,2 pp1,2 pp0,2
pp3,1 pp2,1 pp1,1 pp0,1
pp3,0 pp2,0 pp1,0 pp0,0
In particular, if you trace the output of the ToughSAT implementation, you will find exactly the variables as shown here.
So the 2⋅4 variables from the two factors p and q are increased by the 16 variables ppi,j that represent the "and" of the binary positions i of p and j of q. Next, the school method for multiplication says that we have to add the results column wise (e.g. pp0,1 + pp1,0 = ts1,0 carry: cr1,0):
Total variables: 24
pp3,3 pp2,3 pp1,3 pp0,3 cr0,1
pp3,2 pp2,2 pp1,2 pp0,2
pp3,1 pp2,1 pp1,1
pp3,0 pp2,0
ts0,1
------------------------------------------------------------- +2 vars
cr0,2
pp3,3 pp2,3 pp1,3 pp0,3
pp3,2 pp2,2 pp1,2
pp3,1 pp2,1 ts0,2
pp3,0 pp2,0 ts0,1
------------------------------------------------------------- +2 vars
cr0,3
pp3,3 pp2,3 pp1,3
pp3,2 pp2,2
pp3,1 ts0,3
pp2,1 ts0,2
pp3,0 pp2,0 ts0,1 pp0,0
------------------------------------------------------------- +2 vars
cr0,4
pp3,3 pp2,3
pp3,2 ts0,4
pp2,2 ts0,3
pp3,1 pp2,1 ts0,2
pp3,0 pp2,0 ts0,1 pp0,0
------------------------------------------------------------- +2 vars
cr0,4
pp3,3 pp2,3 cr1,1
pp3,2 ts0,4
pp2,2 ts0,3
pp3,1
ts1,1
------------------------------------------------------------- +2 vars
cr1,2
cr0,4
pp3,3 pp2,3
pp3,2 ts0,4
ts1,2 pp2,0 ts0,1 pp0,0
------------------------------------------------------------- +2 vars
cr1,3 cr0,4
pp3,3
ts1,3 ts1,2 ts0,3
ts1,1 ts0,2
pp2,0 ts0,1 pp0,0
------------------------------------------------------------- +2 vars
cr1,4
ts1,4 ts0,4
ts1,2 ts0,3
ts1,1 ts0,2
pp2,0 ts0,1 pp0,0
------------------------------------------------------------- +2 vars
cr1,4 ts1,4 cr0,4
ts1,3
ts0,4 cr2,2
ts1,2 ts0,3
ts1,1
ts2,2
------------------------------------------------------------- +2 vars
cr1,4 ts1,4 cr0,4
ts1,3 cr2,3
ts0,4
ts1,2
ts2,3
------------------------------------------------------------- +2 vars
cr2,4
cr1,4 ts1,4 cr0,4
ts1,3
ts2,4
------------------------------------------------------------- +2 vars
cr2,5
cr1,4 ts1,4
ts2,5
------------------------------------------------------------- +2 vars
cr2,6
cr1,4
ts2,6
------------------------------------------------------------- +2 vars
ts2,7
<-cr2,7
------------------------------------------------------------- +2 vars
Final:
cr2,7 ts2.7 ts2,6 ts2,5 ts2,4 ts2,3 ts2,2 ts0,1 pp0,0
Total variables: 52
The final 9 variables must be set equal to the product N=15 in question, that is cr2,2ts2,7ts2,7ts2,5ts2,4ts2,3ts2,2ts0,1pp0,0000001111falsefalsefalsefalsefalsetruetruetruetrue
Hence, for those 9 variables we already know the truth values.
The equations that were created during the process are of one of the following forms:
- x1=x2andx3, e.g., pp0,0 = x0 and y0
- x1=x2+x3,carry→x4, e.g., ts2,6 = cr2,5 + ts1,4 carry:cr2,6
- x1=x2+x3+x4,carry→x5, e.g., ts2,5 = cr2,4 + cr0,4 + ts1,3 carry:cr2,5
We have to remove the "=" and "+" operators and replace them with only "and" and "or".
For type 1. equations we use:
x1=x2andx3⇔(x1or−x2or−x3)and(−x1orx2)and(−x1orx3)ˆ=(x1∨−x2∨−x3)∧(−x1∨x2)∧(−x1∨x3)
So we get 3 clauses from one type 1 equation.
For type 2. equations we use:
x1=x2+x3,carry→x4ˆ=(−x1∨x2∨x3)∧(−x1∨−x2∨−x3)∧(x1∨x2∨−x3)∧(x1∨−x2∨x3)∧(−x1∨−x2∨x3)∧(x1∨x2∨−x3)∧(−x2∨−x3∨x4)∧(x2∨x3∨−x4)∧(x2∨−x4)∧(x3∨−x4)
So we get 10 clauses from one type 2 equation.
For type 3. equations we use:
x1=x2+x3+x4,carry→x5ˆ=(−x1∨x2∨x3∨x4)∧(x1∨−x2∨−x3∨x4)∧(−x1∨−x2∨x3∨−x4)∧(−x1∨x2∨−x3∨−x4)∧(x1∨−x2∨−x3∨−x4)∧(x1∨x2∨x3∨−x4)∧(x1∨x2∨−x3∨x4)∧(x1∨−x2∨x3∨x4)∧(−x2∨−x3∨x5)∧(−x2∨−x4∨x5)∧(−x3∨−x4∨x5)∧(x2∨x3∨−x5)∧(x2∨x4∨−x5)∧(x3∨x4∨−x5)
So we get 14 clauses from one type 3 equation.
# The Phase Transition #
The number of variables and clauses could be roughly estimated by: We have 2n variables for xn−1 to x0 and yn−1 to y0. This yields n2 variables for each combination. Further, an addition yields two new variables and reduces the amount summands (mostly) by −1. The n2 are reduced until ≈2n remain. Therefore we need n2−2n=n(n−2) additions, hence we get 2n(n−2) variables this way. So in total we have #vars=2n+n2+2n(n−2)=3n2−2n∈O(n2)
The number of clauses could be roughly estimated by: From the n2 variables that result from the "and" equations we get 3n2 clauses. We have ϵ variables that come from the + equations with 2 summands and (1−ϵ) variables that come from the + equations with 3 summands. In total this are n(n−2). Thus we get
#clauses3n2+10ϵn(n−2)+14(1−ϵ)n(n−2)=3n2+10ϵn2−20ϵn+14(1−ϵ)n2−28(1−ϵ)n=3n2+10ϵn2−20ϵn+14n2−14ϵn2−28n+28ϵn=17n2−4ϵn2+8ϵn−28n
For ϵ=0 we have #clauses=17n2−28n and for ϵ=1 we have #clauses=13n2−20n.
Phase Transition. The phase transition for SAT tells how the ratio of clauses and variables of a formula is related to the satisfiability of the formula. For a ratio between 3.5<#clauses#variables<4.5
SAT instances are mostly hard. For larger ratios they are nearly always non satisfiable and a smaller ratio gives formulas that can be easily satisfied.
In the case of the factoring approach shown above, we have #vars=3n2−2n and #clauses=13n2−20n or #clauses=17n2−28n respectively. If we neglect the small linear terms we get the ratio:
4.3≤13n23n2≤17n23n2≤5.6
which shows, that the resulting SAT instances will probably be hard. Note that such a created instance is always satisfiable.
No comments:
Post a Comment