Unary Subset-Sum is in Logspace
📝 Original Info
- Title: Unary Subset-Sum is in Logspace
- ArXiv ID: 1012.1336
- Date: 2017-07-28
- Authors: Researchers from original ArXiv paper
📝 Abstract
We present a simple Logspace algorithm that solves the Unary Subset-Sum problem.💡 Deep Analysis
Deep Dive into Unary Subset-Sum is in Logspace.We present a simple Logspace algorithm that solves the Unary Subset-Sum problem.
📄 Full Content
The basic idea of our algorithm will be to make use of the generating function
x i∈S mi to compute the number of solutions to our problem modulo p for a number of different primes p (we show how to do this in Lemma 1). Pseudocode for our algorithm is follows:
There are several things that must be noted to show that this algorithm runs in logspace. First, we claim that p is never more than polynomial in size. This is because standard facts about prime numbers imply that there are at least n primes between C and poly(C, n), and each of these primes causes c to increase by at least 1. We also note that p-1 x=1 x -B n i=1 (1 + x mi ) can be computed modulo p in Logspace. This is because we can just keep track of the value of x and the current running total (modulo p) along with the space necessary to compute the next term. The product is computed again by keeping track of i and the current running product (modulo p) and whatever is necessary to compute the next term. The exponents are computed in the obvious way. Finally primality testing of poly-sized numbers can be done by repeated trial divisions in Logspace, and hence the NextPrime function can also be computed in Logspace.
In fact, this function can also be computed in TC 0 . The function is clearly an OR over possible values of p. Each input requires computing a polynomial sized sum of polynomial sized products of sums of exponentials all modulo p. As all of these operations are known to be computable in TC 0 , the composition is as well.
We now have to prove correctness of the algorithm. Let A be the number of subsets
Where again A is the number of subsets S ⊆ [n] so that i∈S m i = B.
Proof. Note that
The idea of our proof will be to interchange the order of summation and show that the terms for which i∈S m i = B cancel out.
Notice that each exponent in this sum has absolute value less than p -1. Interchanging the sums on the right hand side, we find that
We note that:
If k is a multiple of p -1, then all terms in the sum are 1 modulo p and the result follows. Otherwise, we let g be a primitive root mod p and note that instead of summing over x = 1 to p -1 we may sum over x = g ℓ for ℓ = 0 to p -2. Then
Hence this sum contributes -1 for each such S and so the final sum is -A.
We are now ready to prove correctness. If
x mi ) ≡ 0 (mod p) for some p > C, then by our Lemma, this means that A ≡ 0 (mod p). In particular, this means that A = 0, and that therefore there is some such S. Consider an integer d which is equal to the product of the primes p that have been checked so far. Then d is a product of distinct primes p so that
and d|A, which implies that A = 0, and that therefore there are no solutions. Hence our algorithm always outputs correctly.
There are some relatively simple extensions of this algorithm. For one thing, our algorithm does more than tell us whether or not A is equal to 0, but also tells us congruential information about A. We can in fact obtain more refined congruential information than is apparent from our Lemma. We can also use this along with the Chinese Remainder Theorem to compute a numerical approximation of A. Finally a slight generalization of these techniques allows us to work with m i vector valued rather than integer-valued.
We show above how to compute A modulo p for p a prime larger than C. But in fact if p is any prime and k > 1 any integer, A can be computed modulo p k in O(log((p + C) k )) space.
If p > C, then we have that
On the other hand if p ≤ C, the above expression will only count the number of subsets that give the correct sum modulo p -1. We can fix this by letting q = p ℓ for some integer ℓ so that q > C. Then for the same reasons that the above is true, it will be the c
…(Full text truncated)…
📸 Image Gallery
