Trouver un témoin dans la somme minkowski d'entiers


16

Soit et sous-ensembles de . Nous souhaitons trouver la somme de Minkowski .AB{0,,n}A+B={a+b | aA,bB}

χX:{0,,2n}{0,1} is a characteristic function of X if

χX(x)={1 if xX0 otherwise

Let f be the discrete convolution of χA and χB, then xA+B if and only if f(x)>0. Hence A+B can be computed in O(nlogn) time by discrete convolution via FFT.

Sometimes it is important to find out the actual pair aA and bB that sums to x. aA is called a witness of x, if there exist bB such that a+b=x. A function w:A+BA is called a witness function if w(x) is a witness of x.

Is it possible to compute a witness function in O(nlogn) time?


3
O(npolylogn) is not especially hard.
Sariel Har-Peled

2
You can use binary search. e.g., partition A into two roughly-equal-sized-sets AL,AR, and compute AL+B and AR+B; check which of those x is in; and recurse. This will get you something like O(nlg2n).
D.W.

@D.W. This can only find a witness for a single x, but we want a witness for each element in A+B. (my wording seems to be unclear, so I just updated the question)
Chao Xu

But are you interested in O(n polylog n) solution?
Sariel Har-Peled

@SarielHar-Peled yes, I'm also interested in deterministic O(npolylogn) algorithm.
Chao Xu

Réponses:


11

Here I am explaining how to get O(npolylogn) randomized running time. We need a sequence of observations:

  1. A witness of a value v is a pair of numbers (a,b)A×B such that a+b=v. Let PA(x)=iAxi and PB(x) be defined analogously. Observe that the coefficient of xv in PA(x)PB(x) is the number of witnesses there are for the value v.

  2. Assume v has a single witness (a,b)A×B, and consider the the polynomial QA(x)=iAixi. Clearly, the coefficient of xv in QA(x)PB(x) is a, and as such we now know the pair (a,va) and we are done.

  3. So, we are done with the case that there is a single witness. So consider the case that v has k witnesses (a1,b1),,(ak,bk). Let i(k)=lgk. Observe that 2i(k)1k2i(k). Next, let Rj=(Aj,Bj), for j=1,,m, for m=O(logn) be random samples, such that each element of A is choosen into Ai with probability p=1/2i(k). The probability that v has a single witness in Rj is α=(k1)p2(1p2)k1, since the witness are disjoint pairs of numbers (since the sum of each pair is v). It is easy to verify that α is a constant in (0,1) independent of the value of k. As such, it must be, with high probability, that v has a single witness in one of the samples R1,,Rm. As such, by computing the two polynomials associated with with such sample, as described above, in O(nlogn) time (per sample), using FFT, we can decide this in constant time.

  4. We are almost done. Compute the above random samples for resolutions i=1,,lgn. For each such resolution compute the random samples and associated polynomials. Also, compute the associated polynomial for A and B. This preprocessing naively takes O(nlog3n), but I suspect that being slightly more careful a logn factor should be removable.

  5. The algorithm: For every value v, compute how many witness, say k, it has in constant time, by consulting the polynomial QA(x)PB(x). Next, go to the relevant data-structure for i(k). Then, it finds the random sample that has it as a single witness, and it extract the pair that is this witness in constant time.

  6. Strangely enough, the preprocessing time is O(nlog3n), but the expected time to find the witness themselves take only O(n) time, since one can stop the search as soon as one find a witness. This suggests that this algorithm should be improveable. In particular, for i(k)lgn, the polynomials generated are very sparse, and one should be able to do much faster FFT.


12

Ok, I've been holding off since really Sariel should get credit for an answer, but I'm tired of waiting, so here is my cut at a near-linear randomized algorithm.

  • By choosing samples of n(1ϵ)i points, i=0,1,, you can get a logarithmic number of subproblems such that each sum from the original problem has constant probability of being represented uniquely in one of the subproblems (the one where the sampling cuts down the expected number of representations to near 1).
  • By repeating the sampling process a logarithmic number of times you can get all sums to have unique representations with high probability.
  • If you have a partition of A and B into two subsets, then by multiplying the numbers by four, adding 2 to the numbers in one of the subsets in A, and adding 1 to the numbers in one of the subsets in B, you can read off from the mod-4 values of the achievable sums which of the two subsets their summands come from.
  • By repeating the partition process a logarithmic number of times, using each bit position of the binary representations of the values or indices in the subproblems to select the partitions in each step, you can uniquely identify the summands of every uniquely-represented sum.

This blows up the running time by three logarithmic factors; probably that can be reduced.


3
Ha ha ;). I was in the middle of writing it, and then went to lunch...
Sariel Har-Peled

5

This answer gives a determinstic O(n polylogn) algorithm.

It appears that Sariel and David's algorithm can be derandomized through an approach similar to this paper. [2] While going through the process I found there is a more general problem that implies this result.

The k-reconstruction problem

There are hidden sets S1,,Sn{1,,m}, we have two oracles Size and Sum that take a query set Q.

  1. Size(Q) returns (|S1Q|,|S2Q|,,|SnQ|), the size of each intersection.
  2. Sum(Q) returns (sS1Qs,sS2Qs,,sSnQs), the sum of elements in each intersection.

The k-reconstruction problem asks one to find n subsets S1,,Sn such that SiSi and |Si|=min(k,|Si|) for all i.

Let f be the running time of calling the oracles, and assume f=Ω(m+n), then one can find the sets in deterministic O(fklogn polylog(m)) time. [1]

Now we can reduce the finding witness problem to 1-reconstruction problem. Here S1,,S2n{1,,2n} where Si={a|a+b=i,aA,bB}.

Define the polynomials χQ(x)=iQxi, IQ(x)=iQixi

The coefficient for xi in χQχB(x) is |SiQ| and in IQχB(x) is sSiQs. Hence the oracles take O(nlogn) time per call.

This gives us an O(n polylog(n)) time deterministic algorithm.

[1] Yonatan Aumann, Moshe Lewenstein, Noa Lewenstein, Dekel Tsur: Finding witnesses by peeling. ACM Transactions on Algorithms 7(2): 24 (2011)

[2] Noga Alon, Moni Naor: Derandomization, witnesses for Boolean matrix multiplication and construction of perfect hash functions. Algorithmica 16(4-5) (1996)

En utilisant notre site, vous reconnaissez avoir lu et compris notre politique liée aux cookies et notre politique de confidentialité.
Licensed under cc by-sa 3.0 with attribution required.