All non-trivial variants of 3-LDT are equivalent

01/05/2020
by   Bartłomiej Dudek, et al.
0

The popular 3-SUM conjecture states that there is no strongly subquadratic time algorithm for checking if a given set of integers contains three distinct elements that sum up to zero. A closely related problem is to check if a given set of integers contains distinct x_1, x_2, x_3 such that x_1+x_2=2x_3. This can be reduced to 3-SUM in almost-linear time, but surprisingly a reverse reduction establishing 3-SUM hardness was not known. We provide such a reduction, thus resolving an open question of Erickson. In fact, we consider a more general problem called 3-LDT parameterized by integer parameters α_1, α_2, α_3 and t. In this problem, we need to check if a given set of integers contains distinct elements x_1, x_2, x_3 such that α_1 x_1+α_2 x_2 +α_3 x_3 = t. For some combinations of the parameters, every instance of this problem is a NO-instance or there exists a simple almost-linear time algorithm. We call such variants trivial. We prove that all non-trivial variants of 3-LDT are equivalent under subquadratic reductions. Our main technical contribution is an efficient deterministic procedure based on the famous Behrend's construction that partitions a given set of integers into few subsets that avoid a chosen linear equation.

READ FULL TEXT VIEW PDF

Authors

page 1

page 2

page 3

page 4

12/21/2021

Efficient reductions and algorithms for variants of Subset Sum

Given (a_1, …, a_n, t) ∈ℤ_≥ 0^n + 1, the Subset Sum problem (𝖲𝖲𝖴𝖬) is to...
07/24/2018

A Note on Clustering Aggregation

We consider the clustering aggregation problem in which we are given a s...
04/30/2018

A Subquadratic Algorithm for 3XOR

Given a set X of n binary words of equal length w, the 3XOR problem asks...
02/15/2018

A Faster FPTAS for #Knapsack

Given a set W = {w_1,..., w_n} of non-negative integer weights and an in...
10/09/2018

Contraction-Based Sparsification in Near-Linear Time

Recently, Kawarabayashi and Thorup presented the first deterministic edg...
10/20/2017

Kernelization Lower Bounds for Finding Constant Size Subgraphs

Kernelization is an important tool in parameterized algorithmics. The go...
09/09/2020

Deterministic Linear Time Constrained Triangulation using Simplified Earcut

Triangulation algorithms that conform to a set of non-intersecting input...
This week in AI

Get the week's most popular data science and artificial intelligence research sent straight to your inbox every Saturday.

1 Introduction

The well-known 3-SUM problem is to decide, given a set of integers, whether any three distinct elements of sum up to zero. This can be easily solved in quadratic time by first sorting and then scanning the sorted sequence with two pointers. For many years no faster algorithm was known, and it was conjectured that no significantly faster algorithm exists. This assumption led to strong lower bounds for multiple problems in computational geometry [28] and, more recently, became a central problem in the field of fine-grained complexity [43]. Furthermore, it has been proven that in some restricted models of computation 3-SUM requires time [24, 5].

However, in 2014 Grønlund and Pettie [32]

proved that the decision tree complexity of 3-

SUM is only , which ruled out any almost quadratic-time lower bounds in the decision tree model. This was later improved by Gold and Sharir to  [29] and finally to by Kane et al. [34]. The upper bounds for the decision tree model were later used to design a series of algorithms for a harder version of 3-SUM where the set can contain real numbers. Grønlund and Pettie [32] derived an time randomized algorithm and an time deterministic algorithm for the real RAM model. The deterministic bound was soon improved to by Gold and Sharir [29] and (independently) Freund [27] and then to by Chan [16]. These results immediately imply similar bounds for the integer version of 3-SUM. In the word RAM model with machine words of size , Baran et al. [11] provided an algorithm with expected time.

Even though asymptotically faster than , these algorithms are not strongly subquadratic, meaning working in time, for some . This motivates the popular modern version of the conjecture, which is that the 3-SUM problem cannot be solved in time (even in expectation), for any , on the word RAM model with words of size  [38]. By now we have multiple examples of other problems that can be shown to be hard assuming this conjecture, especially in geometry [28, 19, 25, 8, 42, 18, 4, 10, 9, 13, 26, 15, 37], but also in dynamic data structures [2, 35, 38], string algorithms [3, 7], finding exact weight subgraphs [45, 1] and finally in partial matrix multiplication and reporting variants of convolution [30].

In particular, it is well-known that the 3-SUM problem defined above is subquadratically equivalent to its 3-partite variant, where we are given three sets containing integers each, and must decide whether there is , , and such that . To reduce 3-partite 3-SUM to 1-partite, we can add a multiple of some sufficiently big number to all elements in every set and take the union, for example:

is chosen so that the only possibility for the three elements of to sum up to 0 is that they correspond to three elements belonging to distinct sets , , and . To show the reduction from -partite 3-SUM to 3-partite, a natural approach would be to take . However, this approach does not quite work as in the -partite variant we desire to be distinct. In the folklore reduction, this technicality is overcome using the so-called color-coding technique by Alon et al. [6].

A natural generalization of 3-SUM is -variate linear degeneracy testing, or -LDT [5]. In this problem, we are given a set of integers, integer parameters and , and must decide whether there are distinct numbers such that . Similar to 3-SUM, the -LDT problem can be considered in the -partite variant as well.

A particularly natural variant of the -partite -LDT problem is as follows: given a set of numbers, are there three distinct such that ? Following Erickson [23], we call this problem AVERAGE. It is easy to see that AVERAGE reduces to instances of 3-partite 3-SUM where the -th instance consists of the sets where (and ). However, a reverse reduction seems more elusive and in fact according to Erickson [23] it is not known whether AVERAGE is 3-SUM-hard111Also see https://cs.stackexchange.com/questions/10681/is-detecting-doubly-arithmetic-progressions-3sum-hard/10725#10725. This suggests the following question.

Question 1.0.

Can we design a reduction from 3-SUM to AVERAGE? Or is AVERAGE easier than 3-SUM?

A more ambitious question would be to provide a complete characterisation of all variants of 3-LDT parameterized by . We know that in the restricted 3-linear decision tree model solving every variant where all coefficients are nonzero requires quadratic time [24, 5], but by now we know that this model is not necessarily the most appropriate for such problems.

Question 1.0.

Which variants of 3-LDT are easier than others? Or are they all equivalent?

Formal definitions of 3-Ldt, 3-Sum, and Average.

We are interested in connecting the complexity of AVERAGE and more generally speaking any variant of 3-LDT to the 3-SUM conjecture, and so from now on assume that the input consists of integers. 3-SUM is widely believed to be hard even for polynomial universes, because one can always hash down the universe to while maintaining the expected running time [38] (although a deterministic reduction is not known). In fact, the so-called strong 3-SUM conjecture stipulates that there is no subquadratic time algorithm even if the universe is . A similar randomized reduction can be applied to any variant of the 3-LDT problem, so for concreteness we will assume that the universe is and work with the following formulation:

1-partite 3-LDT Parameters: Integer coefficients and . Input: Set of size . Output: Are there distinct such that ?

3-partite 3-LDT Parameters: Integer coefficients and . Input: Sets of size . Output: Are there such that ?

The 3-SUM problem is defined as 3-LDT, where or depending on the partity, and . The AVERAGE problem, introduced by Erickson [22], is defined as 3-LDT, where .

Our contribution and techniques.

We start by introducing a definition that plays a crucial role in the characterization of the 3-LDT variants.

Definition 1.0.

We call a variant of the 3-LDT problem trivial, if either

  1. Any of the coefficients is zero, or

  2. and

and otherwise non-trivial.

Notice that if any of the coefficients is 0, then we need to find at most two numbers satisfying a linear relation, which can be done in total time by first sorting and then scanning the sorted sequence with two pointers. Also, if both and then every instance of such a variant is a NO-instance, and we can return the answer in constant time. Our main contribution is a series of deterministic subquadratic reductions establishing the following theorem.

Theorem 1.1.

All non-trivial variants (1- and 3-partite) of 3-LDT are subquadratic-equivalent.

In particular, this implies the following.

Corollary 1.2.

AVERAGE is subquadratic-equivalent to 3-SUM.

Thus, we completely resolve both Question 1 and Question 1.

To design the most interesting of our reductions, from to , we need the following notion. We call a set progression-free if it contains no non-trivial arithmetic progression, that is, three distinct elements such that . Erdős and Turan [21] introduced the question of exhibiting a dense subset with such a property, and presented a construction with elements. This was improved by Salem and Spencer [40] to , and then again by Behrend [14] to . More recently, Elkin [20] showed how to construct a set consisting of elements. One could naturally ask for a dense subset that avoids a certain linear equation , where are positive integers. Indeed, it turns out that Behrend’s argument works with minor modifications also for such equations [39, Theorem 2.3]. We use Behrend’s set to partition an arbitrary set into a small number of progression-free sets. The main idea is that we can deterministically choose a shift so that the intersection of Behrend’s set and a given set is a large progression-free set, which is always possible due to the density of Behrend’s set.

Related work.

Surprisingly few reductions to 3-SUM are known. It is known that 3-SUM is equivalent to convolution 3-SUM [38], which is widely used in the proofs of 3-SUM-hardness. In addition, Jafargholi and Viola [33] showed that solving 3-SUM in time for some would lead to a surprising algorithm for triangle listing.

Other variants of 3-SUM have been also considered. Among them are clustered 3-SUM and 3-SUM for monotone sets in 2D that are surprisingly solvable in truly subquadratic time [17]; algebraic 3-SUM, a generalization which replaces the sum function by a constant-degree polynomial [12]; and 3-SUM in which, given three sets one needs to return  [32, 11]. An interesting generalisation of the 3-SUM conjecture states that there is no algorithm preprocessing two lists of elements in time and answering queries “Does belong to ?” in time. Very recently, this conjecture was falsified in two independent papers [36, 31].

2 Preliminaries

Notation.

Below we use the following notation: denotes the triple , when omitting superscript in the sum we mean all possible values of ; ; is the image of over ; adding a number to a set denotes adding the number to all elements from the set . All numbers in the considered problems and reductions are integer. All reductions, unless said otherwise, are deterministic.

Subquadratic reductions.

We provide the formal definition of a subquadratic reduction:

Definition 2.0 (cf. [44]).

Let and be computational problems with a common size measure on inputs. We say that there is a subquadratic reduction from to if there is an algorithm with oracle access to , such that for every there is satisfying three properties:

  1. For every instance of , solves the problem on .

  2. runs in time on instances of size .

  3. For every instance of of size , let be the size of the th oracle call to in . Then .

We use the notation to denote the existence of a subquadratic reduction from to . If and , we say that and are subquadratic-equivalent.

Size of the universe.

Some of our reductions increase the size of the universe by a constant factor. This is possibly an issue, as in any instance of 3-LDT on numbers we want to keep the universe . To mitigate this, in Section 4 we design a simple reduction that decreases the size of the universe by a constant factor.

We start with the following preliminary lemma.

Lemma 2.1.

All non-trivial 3-partite variants of 3-LDT are subquadratic-equivalent.

Proof.

We need to show a reduction between any two non-trivial 3-partite variants of 3-LDT. To this end, we establish three reductions: , and for all possible and . Reductions between other variants can be obtained by combining at most three of the above.

  1. . We have because is a non-trivial variant of 3-LDT, so by the Chinese remainder theorem there exist an integer triple such that . Given the three sets we construct an instance of consisting of three sets where . Then there is satisfying iff there is satisfying .

  2. as above but subtracting the terms.

  3. . Define so that is an integer. In the reduction we set .∎

By the above lemma, to prove Theorem 1.1 we only need to establish an equivalence between 1- and 3-partite variants with the same coefficients and . To show , we can apply the folklore reduction from -partite 3-SUM to -partite 3-SUM based on the color-coding technique of Alon et al. [6]. As a corollary, we obtain the following result (we provide the proof in the appendix for completeness).

Theorem 2.2.

For all coefficients and , we have .

3 From 3-partite to 1-partite

In this section, we show how to reduce an arbitrary non-trivial 3-partite variant of 3-LDT to a 1-partite one with the same coefficients and .

Let be a sufficiently big number to be fixed later. We would like to construct the set by setting , where are coefficients chosen so as to ensure that all triples consisting of distinct elements from satisfying also satisfy that corresponds to an element of , for .

Combination is a function encoding that corresponds to an element of , for every . For example, suppose that comes from set and and from , then and . The desired combination of elements from satisfying a triple is the identity (), so in particular we want to forbid using more than one number from the same set (). However, some coefficients from might be equal, so we need also to allow combinations in which we permute the elements with the same values of . This is formalized in the following definition.

Definition 3.0.

For any coefficients , we call a combination allowed if , and otherwise we call it forbidden. In addition, if for some fixed , for all we have , then we call the combination constant.

Now we show that it is always possible to find a triple which excludes solutions from most of the forbidden combinations. Clearly, we need to ensure that in the allowed combination the -part cancels out, so we require that .

Lemma 3.1.

For any triple of nonzero coefficients there exists a triple of nonzero coefficients such that and for every non-constant forbidden combination  we have .

Proof.

Consider the 3-dimensional space . The set of all triples such that spans a plane there. There are less than non-constant forbidden combinations and each of them gives an equation that must be avoided, which also corresponds to a forbidden plane . By the definition of a forbidden combination , we have . Next, as we need all the coefficients to be nonzero, we add forbidden planes , for . Clearly, because the coefficients are nonzero. Then let be the set of all forbidden planes. Now we need to show that .

Clearly all planes contain the origin . Consider an arbitrary line that does not pass through the origin and contains infinitely many points with all coordinates rational. For example, we can take the line passing through and . Observe that for any , , because otherwise there would be three non-collinear points (two from and ) belonging to two distinct planes and . Hence is either empty or a point. Recall that there is a constant number of planes in . Then contains some point with rational coordinates, because there are infinitely many such points on . This gives us a point in that belongs to and does not belong to any . By scaling its coordinates, we obtain . ∎

The case of .

First we show the reduction for the case of .

Lemma 3.2.

Assume . Any non-trivial 3-partite variant of 3-LDT with coefficients and can be subquadratically reduced to a 1-partite one with the same coefficients and .

Proof.

From Lemma 2.1, we know that , so it suffices to show that . By the Chinese remainder theorem, we can choose an integer triple such that , and apply Lemma 3.1 on to obtain . We construct the set as follows:

where is a sufficiently big constant such that the absolute value of any linear combination of ’s or ’s with coefficients is smaller than (formally, we can take ). If there is a triple such that and , then by the choice of and we have , where .

Now consider a triple such that and . Let , where . By the definition of and the fact that , it holds that , and . We will show that is an allowed combination which guarantees that is a valid solution of .

By Lemma 3.1, implies that the combination is either constant or allowed. If is constant, i.e. for some fixed , for all , from we have and therefore as . It implies , hence cannot be constant and is allowed. ∎

The case of .

For we would like to proceed as in the proof of Lemma 3.2. We apply Lemma 3.1 on to obtain and construct the set . This is enough to exclude all non-constant forbidden combinations and, if , also the constant combinations. However, if then we cannot exclude the constant combinations. In other words, no matter what the chosen ’s are we are not able to exclude the solutions that use three distinct elements corresponding to the elements of the same set . This suggests that we should partition each of the sets into a few sets that contain no triple of distinct elements such that .

Definition 3.2.

For any , a set is -free if no three distinct elements satisfy .

Lemma 3.3.

For any , there exists a collection of -free sets where and .

Proof.

By the result of Behrend [14], there exists a -free set of size for . In other words, this set contains no three elements forming an arithmetic progression. As mentioned by Ruzsa [39, Theorem 2.3], this construction can be modified for any parameters in such a way that is -free at the expense of setting .

Next, we choose numbers from uniformly at random and create sets . For every

, the probability that

is , so the probability that is at most for sufficiently large . By the union bound, there exists a collection of sets with the sought properties. ∎

We now explain how to partition the sets into a few sets that contain no triple consisting of distinct elements such that . Recall that it suffices to focus on the case . In this case, the sets should not contain a triple consisting of distinct elements such that , where and is a permutation of .

We put , and and consider the sets of Lemma 3.3. We shift the sets by so that they cover while preserving that they are -free. We partition every set into subsets such that every is -free. We have . We reduce the instance of 3-LDT to instances of by considering all possible combinations of the subsets. To show that the reduction is subquadratic, we must analyze the sizes of the obtained instances. As for any , for all . Hence, to prove the following theorem it remains to show how to efficiently (and deterministically) construct the sets .

Theorem 3.4.

For all nonzero coefficients , we have .

3.1 Derandomization and efficient implementation of Lemma 3.3

Since , we cannot compute the set and the sets explicitly. Instead, we will construct a family of -free sets with a guarantee that at least one of them is large, and we will show that for any sets and we can efficiently construct the shift which maximizes . Behrend’s existential proof actually implies the following statement:

Lemma 3.5 (cf. [14, 39]).

For any there exist -free sets such that and for some .

Proof.

(Sketch, see the appendix for details.) Let be the smallest power of two larger than . Let and . The sets , , are defined as follows:

The sets are -free and at least one of them is larger than . ∎

Consider a set . To partition into a small number of -free sets, we will show how to efficiently find and such that is large. By iterating this procedure on the remaining part of sufficiently many times, we will obtain the desired partition. We will start by showing two technical lemmas.

Note that given and there is a deterministic algorithm that can check if in constant space and time, as it is enough to represent a number in base and check the conditions of Lemma 3.5. We will also exploit the following generalization of this algorithm:

Lemma 3.6.

For any , , and , there is a deterministic algorithm that calculates in time and space.

Proof.

Recall from Lemma 3.5 that for some integer . We must compute the number of such that . Let , where . Then the base- representation of possible numbers has either (if ) or (if ) digits, where each digit is in .

Let . To compute , we will use a dynamic programming algorithm over the digits of . Let be the number of ’s from such that all least significant digits of are smaller than , their sum of squares is and there is a carry to the -th digit of . Clearly, and for the remaining entries. Then:

where is the digit that will appear at the -th position of after adding and the carry to , and carrying to the ()-th position. This way we process the least significant digits of . Next, if is greater than , we need to check all possible remaining bits of . For this purpose we iterate over and all possible carries to the -th digit of . Finally, we need to verify that the first digits of are smaller than and choose the appropriate value of to lookup from the dynamic program.

The dynamic program has states and requires computation time per state. As and , in total the algorithm uses time and space. ∎

We now show how to use the above algorithm to compute the optimal shift for the given sets and .

Lemma 3.7.

For any , we can deterministically find such that in time.

Proof.

First, we shift all elements of by and then we need to find . We will use the method of conditional expectations setting the bits of from the most significant to the least. Let be the smallest number such that . We will narrow down the set of possible values maintaining the following invariant:

where goes from to and is a variable accumulating all the bits of found so far. In the beginning we have and . For each such that , we have

To compute the -th bit of , we compare the two right-hand terms, choose the bit corresponding to the larger one and accumulate it in . Then, the above expected value does not decrease, so the invariant is preserved. After steps we obtain

and is the value of with the desired properties. Finally, we need to show how to efficiently compute the conditional expectation:

which can be calculated with queries about for different values of . As we compute the conditional expectation times, the time complexity follows. ∎

To sum up, we obtain that any subset of can be efficiently partitioned into few -free sets.

Theorem 3.8.

For any and set , it is possible to construct sets such that every is -free and . The construction is deterministic and runs in time.

Proof.

We consider every set as a candidate for the largest set among . For each candidate , we iteratively choose the next value of using Lemma 3.7 and then extract from a -free subset equal to the intersection of and . Having extracted subsets, we stop. If is empty, we obtain a partition of into at most -free sets. See Algorithm 1 for more details.

Let us show that the algorithm does return a partition of into at most -free sets. By Lemma 3.5, there exists such that . Lemma 3.7 guarantees that for this value of , the size of decreases by a factor of in each iteration. Therefore, after iterations, the size of will become .∎

1:function Partition()
2:     for  do
3:         
4:         
5:         for  do
6:              find for and
7:              
8:              for  do
9:                  if  then
10:                                                        
11:              .append()
12:                        
13:         if  then
14:              return               
Algorithm 1 Partitioning a set into -free sets.

4 Decreasing the size of the universe

In some of the above reductions we might increase the size of the universe by a constant factor. This is possibly an issue, because some conjectures assume a particular upper bound on its size, say or even . In this section we show how to decrease the size of universe by a constant factor by reducing to a constant number of instances on a smaller universe of the same variant of 3-LDT. We first run the procedure from the following lemma to decrease the universe and only then apply the reduction.

Lemma 4.1.

Let be any parameter. We can reduce an instance of any variant of over to a constant number of instances of the same variant of 3-LDT over .

Proof.

We assume to be large enough. Let be the largest multiple of smaller than . We divide numbers from sets into buckets of size where the -th bucket consists of elements from for . We will choose the bucket containing and represent as . For each of the  triples of the buckets, we create the following instance of 3-LDT over a smaller universe by setting for and