The 3Sum problem is as follows: given a set of numbers , do there exist such that ? There is a nearly trivial classical algorithm that solves this problem in time . More advanced algorithms give only a logarithmic improvement to this quadratic complexity [JP14]. It is conjectured that no classical algorithm can solve 3Sum problem in time.
Many problems in computational geometry (for example, determining whether a given set of points contains points that lie on a line) also seem to require time classically. Gajentaan and Overmars [GO95] showed that the 3Sum problem can be embedded into them. This implies that they cannot be solved in time, unless the 3Sum problem can also be solved in time. Such problems are called 3Sum-Hard. Besides 3 points on a line, examples of 3Sum-Hard problems include determining whether a given set of points contain points that lie on a line, determining whether a given set of triangles covers given polygon, and determining whether a given set of axis-parallel segments are separable with a line into two nonempty subsets [GO95].
Quantum computing allows designing quantum algorithms that outperform classical algorithms. One such example is Grover search [Gro96] which achieves quadratic speedup over classical exhaustive search and can be used as a subroutine to speedup more complicated problems [ABI19, MSS05].
In particular, the 3Sum problem can be solved by a quantum algorithm in time, by a fairly simple application of Grover search procedure. Indeed, we can do an exhaustive search over pairs and look for using some data structure (for example, we can use a balanced search tree). However, a direct application of Grover search does not give a quadratic speedup for many geometrical 3Sum-Hard class problems. For example, if we need to determine whether a set of points contain three points that lie on the same line, we need to search for all possible triplets of points, which results in time quantum algorithm [Fur08].
In this paper we combine quantum effects with more sophisticated geometric techniques to design a quantum algorithm with complexity for Point-On-3-Lines problem. We use ideas from this algorithm to solve many other 3Sum-Hard problems in time .
Related work. The he 3Sum problem has been studied in the context of query complexity and it can be solved with queries, as it is a special case of the subset finding problem of Childs and Eisenberg [CE05] in which one has to find constant-size subset of an -element set, with satisfying a certain property. A matching quantum query lower bound is known [BS13]. However, the subset finding algorithm of [CE05] does not have a time-efficient implementation in the general case. Some special cases (for example, the element distinctness and -distinctness algorithms of [Amb07]) can be implemented efficiently but no efficient implementation is known for the 3-SUM case.
are special cases of a quadratic speedup for hitting times of Markov chains[Sze04, AGJK19, AGJ19]. It is unlikely that these methods will lead to a quantum algorithm that is more than quadratically faster than the best classical algorithm.
More generally, we conjecture that the 3Sum problem cannot be solved in quantum time in the QRAM model, neither with methods based on subset finding nor any oher approach. This could serve as a basis for a quantum version of fine-grained complexity, similarly to recent quantum fine grained lower bounds of [ACL19, BPS19] based on quantum versions of Strong Exponential Time Hypothesis (SETH).
Here we define problems we focus on in this paper. All of them belong to 3Sum-Hard class. [GO95]
Point-On-3-Lines: Given a set of lines in the plane, is there a point that lies on at least three of them? [GO95]
3-Points-On-Line: Given a a set of points in the plane, is there a line that contains at least three points? [GO95]
Triangles-Cover-Triangle: Given a set of triangles in the plane, does their union contain another given triangle? [GO95]
Point-Covering: Given a set of half-planes and a number , determine whether there is a point that is covered by at least half-planes. [GO95]
Segment-Separator: Given a set of vertical line segments, does there exists a non vertical line that does not intersect any of given segments and contaisn at least one given segment in each of two half-planes? [GO95]
Visibility-Between-Segments: Given a set of vertical line segments and two particular line segments and , determine whether there is a point on and a point on , such that segment between these two points doesn’t intersect any segment from . [GO95]
We also define General-Covering problem. We will design quantum algorithm for this problem with complexity and then reduce many 3Sum-Hard problems to this problem.
General-Covering: We are given a set of strips and angles (angle is defined as an infinite area between two non-parallel lines (see Figure 2)) in the plane. The task is to find a point that satisfies the following conditions:
the point is an intersection of two angle or strip boundary lines ( and may be boundary lines of two different angles/strips);
the point does not belong to the interior of any angle or strip;
the point satisfies a given predicate that can be computed in time.
We assume a query model in which the query returns the description of the object (point, line, strip, triangle, etc.), given . The description consists of several numbers that specify the object (e.g. coordinates of a point or values of coefficients in the equation that specifies a line). In the quantum case, we can query superpositions of indices . The input to quantum query consists of two registers, with one register holding and the other register provides the space for . The query transformation acts as . In particular, given a superposition in which , applying gives the state . Applying to gives the state in which the descriptions are erased from the second register.
Our algorithms work in the commonly used QRAM (quantum random access memory) model of computation [GLM08] which assumes quantum memory can be accessed in a superposition. QRAM has the property that any time- classical algorithm that uses random access memory can be invoked as a subroutine for a quantum algorithm in time . We can thus use primitives for quantum search (e.g., Grover’s quantum search or Amplitude amplification) with conditions checking which requires data stored in a random access memory.
We will use two well known quantum procedures in our algorithm.
(Grover search) [KG97] Given a set of elements and a boolean function . The task is to find such that . There is a bounded-error quantum procedure that solves this problem using quantum queries.
(Amplitude amplification) [BHMT02] Let
be a quantum procedure with one-sided error and success probability at least. Then, there is a quantum procedure that solves the same problem with success probability invoking times. Note that any constant success probability can be achieved with repeating Amplitude Amplification constantly many times.
We will also use the following well known computational geometry algorithm.
(Arrangement of lines) [CGL85] Given a set of lines in the plane, we can compute partition of the plane formed by those lines in time .
We will also use point-line dualization for problem reductions. Point-line dualization is a plane transformation that maps points to lines and lines to points in the following way:
Line is mapped to point
Point is mapped to line
One may note, that the following properties are true:
If point lie on one non-vertical line, then lines meet at one point.
If non-vertical lines meet at one point, then points lie on one line.
Points from vertical line segment are mapped to a strip.
Points from non-vertical line segment are mapped to an angle.
3 Point on three lines
In this part we describe a quantum algorithm which solves Point-On-3-Lines problem in time, improving over the time quantum algorithm of Furrow [Fur08]. The idea behind our algorithm is as follows. Suppose we are given a set of lines in the plane. From this set we randomly pick lines. Those lines split plane into no more than regions. Each line from set intersects regions. So, on average, a region contains lines crossing that region.
These facts give an opportunity to design a quantum algorithm that improves over the complexity of simple quantum search (as in Furrow’s algorithm [Fur08]). If we have a point , then we can decide if belongs to some line from using quantum time. To do so, we need to find a region which contains point and check if belongs to a line which crosses that region. For finding the region, time suffices. Checking if belongs to a line from can be done by Grover’s search over lines that cross this region. For this, time suffices.
If we need to find three lines that intersect in one point, we run Grover search over all pairs of lines . For each pair, we find the intersection point and check if point belongs to a third line using algorithm described earlier. If the subdivision of the plane into regions can be done in time , this algorithm runs in time . Setting gives . But we can find even better algorithm. After dividing the plane into regions, instead of searching for an intersection point of three lines, we search for a region which has this point (search is done using Grover search) and we recursively apply algorithm to find the intersection point of three lines inside that region. We can then add more levels of recursion to decrease the complexity further. We now describe the final algorithm (in which we recurse at the optimal choice of and the number of levels of recursion grows with ).
Let be the given set of lines in a plane. Let be a subset of containing exactly lines. Lines in divide plane into convex (possibly infinite) polygons. We arbitrarily triangulate regions, which are bounded by at least lines. This results in a subdivision of the plane into regions where each region is bounded by at most segments (see Figure 3). Let .
We start with the following three observations:
If after the triangulation we get regions: , then
If is the number of faces bounded by lines before the triangulation, then
The last inequality holds because is equal to twice the total number of line segments before the triangulation (because each line segment is on the boundary of two faces, one on each side) and the number of line segments is at most (because each of lines is split by the other lines into at most segments). ∎
Sets can be built classically in time .
We can construct regions in time using Theorem 2.3. We build by iterating through each line from and checking whether the line intersects region . This step takes time . ∎
If is chosen uniformly at random, then
Let be an arbitrary line (possibly not from the set ). Lines from set intersect line in points in this order (if two lines and intersect in the same point, then ). We note that , since some lines from might be parallel to . We color a point with white color if the corresponding line from is in the set . Otherwise we color the point with black color. We define and we assume that , since otherwise lemma is obviously true.
We say that a line is bad, if there exists index , such that is black for all . The probability of being bad can be upper bounded as follows
Consider set which consists of lines from and lines that pass through at least two intersection points of lines from . Then, every edge of every region lies on a line that belongs to (because is either a segment of one of original lines from or is created during the triangulation and, in the second case, both endpoints of are intersection points of two lines from ) Since there are at most intersection points of lines from , we have and
To finish the proof, it is enough to see that the fact that doesn’t contain bad line implies for all . Indeed, if no lines in is bad, then each side of each region contains less than black points. Since a black point corresponds to a line which intersects a region and each region is bounded by at most three segments, the region is intersected by no more than lines from .
There is a bounded error quantum algorithm for Point-On-3-Lines problem, that runs in time .
The algorithm has a parameter and allowable error probability . The algorithm consists of a recursive procedure that takes a set of lines as input and returns lines from the set which intersects at one point or tells that there are no such lines.
The recursive procedure can be described as follows. If the input set contains less than lines, we solve Point-On-3-Lines classically in time . Otherwise, we split the plane into regions with random lines from and build sets . If there are three lines that intersect at one point, then this point is located in one of the regions (if this point is on the boundary of a region, then this point can be found during the construction of sets ). We use amplitude amplification to find the region which contains intersection point of three lines and recursively apply the procedure to lines from .
Suppose that contains three lines that intersect at one point. If , the algorithm finds those lines with certainty.
Let . The probability that for some and the algorithm returns an error is less than .
By executing amplitude amplification (running times), we can reduce probability of not finding the lines to .
So, finds desired three lines with probability at least .
If is a runtime of , then:
If , then:
There are problems on recursion level for some constant and each problem size is at most .
If , then
4 Other 3SUM hard problems
In this section, we show how it is possible to apply plane separation ideas, described in the previous section, to speed up other 3-Sum-Hard problems defined in [GO95].
This problem is dual to the Point-On-3-Lines problem [GO95], and so is solvable with the same quantum algorithm in time , as described in the previous section.
The given strips and angles form lines. We divide the plane into regions by randomly choosing out of those lines, similarly to the algorithm described in the previous section. A region and a strip/angle can be in one of the following relations: the strip/angle fully covers the region, the strip/angle partly covers the region or the strip/angle has no common points with the region. We can identify all regions that are fully covered by some strip/angle in time . For regions that are not fully covered by some strip/angle, we identify the set of strips and angles which cross that region. Non covered regions may contain the desired intersection point, but this intersection point is formed by the lines that are boundary lines of the strips/angles in the set . Similarly to the algorithm Point-On-3-Lines, our task is divided into tasks, each of which involved objects. The time complexity is
Similarly to the analysis of Point-On-3-Lines problem, we get .
This problem is just the special case of the General-Covering problem with the predicate being true if the point is located inside the given box. Then, the point from General-Covering problem corresponds to an uncovered point in Strips-Cover-Box problem. So, Strips-Cover-Box can also be solved in time .
The given triangles consist of segments. We extend each segment to a line and separate the plane into regions, similarly to the Point-On-3-Lines problem with randomly chosen lines. A triangle and a region can be in one of the following relations: the triangle fully covers the region, the triangle partly covers the region or the triangle has no common point with the region. We can identify all regions that are fully covered by some triangle in time . All other regions may contain a point which is not covered by any triangle. Similarly to the Point-On-3-Lines problem, we search for the region which contains that point. Note that, if a triangle partly covers the region , then at least one of the segments that form this triangle is in . So, we can finish our algorithm, just as in General-Covering problem, with the predicate being true, if the point is located inside the triangle that must be covered.
The given half-planes are specified by lines. We separate the plane into regions, similarly to the Point-On-3-Lines problem, by randomly choosing out of given lines. For each region we compute the number of half-planes that fully cover this region. This takes time. To determine if there exists a point that is covered by at least half-planes, we need to tell, if there exists a point inside a region that is covered by at least half-planes from . As in the General-Covering problem, the algorithm takes time.
We dualize the given vertical segments, to get strips. We need to find a point that does not belong to any of the strips and has the property that the corresponding line in the initial plane intersects two given segments and . This problem is just the special case of the General-Covering problem, where the predicate is true if the line corresponding to intersects two given segments and . Just like in the General-Covering problem, this problem can also be solved in time.
This problem can be solved in exactly the same way as the Visibility-Between-Segments problem, with the only difference being the predicate . Now this predicate is true, if the line corresponding to a point separates the given segments in the way required for the Segment-Separator problem. Since is the intersection point of two lines in the dual plane, the line, corresponding to the point , must go through two endpoints of two different given segments. So, is false, if the corresponding line goes through an edge of the convex hull of the endpoints of given segments. This can be detemined in time , after we precompute the convex hull in time . This results in an time quantum algorithm.
- [ABI19] Andris Ambainis, Kaspars Balodis, Jānis Iraids, Martins Kokainis, Krišjānis Prūsis, and Jevgēnijs Vihrovs. Quantum speedups for exponential-time dynamic programming algorithms. In Proceedings of the Thirtieth Annual ACM-SIAM Symposium on Discrete Algorithms, SODA ’19, pages 1783–1793, Philadelphia, PA, USA, 2019. Society for Industrial and Applied Mathematics.
- [ACL19] Scott Aaronson, Nai-Hui Chia, Han-Hsuan Lin, Chunhao Wang, and Ruizhe Zhang. On the quantum complexity of closest pair and related problems. CoRR, abs/1911.01973, 2019.
- [AGJ19] Simon Apers, András Gilyén, and Stacey Jeffery. A unified framework of quantum walk search. CoRR, abs/1912.04233, 2019.
- [AGJK19] Andris Ambainis, András Gilyén, Stacey Jeffery, and Martins Kokainis. Quadratic speedup for finding marked vertices by quantum walks. CoRR, abs/1903.07493, 2019.
- [Amb07] Andris Ambainis. Quantum walk algorithm for element distinctness. SIAM J. Comput., 37(1):210–239, 2007.
Gilles Brassard, Peter Hoyer, Michele Mosca, and Alain Tapp.
Quantum amplitude amplification and estimation.Contemporary Mathematics, 305:53–74, 2002.
- [BPS19] Harry Buhrman, Subhasree Patro, and Florian Speelman. The quantum strong exponential-time hypothesis. CoRR, abs/1911.05686, 2019.
- [BS13] Aleksandrs Belovs and Robert Spalek. Adversary lower bound for the k-sum problem. In Robert D. Kleinberg, editor, Innovations in Theoretical Computer Science, ITCS ’13, Berkeley, CA, USA, January 9-12, 2013, pages 323–328. ACM, 2013.
- [CE05] Andrew M. Childs and Jason M. Eisenberg. Quantum algorithms for subset finding. Quantum Information & Computation, 5(7):593–604, 2005.
- [CGL85] Bernard Chazelle, Leo J. Guibas, and D. T. Lee. The power of geometric duality. BIT Numerical Mathematics, 25, 1985.
- [Fur08] Bartholomew Furrow. A panoply of quantum algorithms. Quantum Information & Computation, 8(8):834–859, 2008.
- [GLM08] Vittorio Giovannetti, Seth Lloyd, and Lorenzo Maccone. Quantum random access memory. Physical review letters, 100:160501, 04 2008.
- [GO95] Anka Gajentaan and Mark H. Overmars. On a class of o(n2) problems in computational geometry. Comput. Geom., 5:165–185, 1995.
Lov K. Grover.
A fast quantum mechanical algorithm for database search.
Proceedings of the Twenty-eighth Annual ACM Symposium on Theory of Computing, STOC ’96, pages 212–219, New York, NY, USA, 1996. ACM.
- [JP14] Allan Grønlund Jørgensen and Seth Pettie. Threesomes, degenerates, and love triangles. CoRR, abs/1404.0799, 2014.
- [KG97] Lov K. Grover. Framework for fast quantum mechanical algorithms. Conference Proceedings of the Annual ACM Symposium on Theory of Computing, 80, 12 1997.
- [MSS05] Frédéric Magniez, Miklos Santha, and Mario Szegedy. Quantum algorithms for the triangle problem. In Proceedings of the Sixteenth Annual ACM-SIAM Symposium on Discrete Algorithms, SODA ’05, pages 1109–1117, Philadelphia, PA, USA, 2005. Society for Industrial and Applied Mathematics.
- [Sze04] Mario Szegedy. Quantum speed-up of markov chain based algorithms. In 45th Symposium on Foundations of Computer Science (FOCS 2004), 17-19 October 2004, Rome, Italy, Proceedings, pages 32–41. IEEE Computer Society, 2004.