Truly Subquadratic 3SUM and Truly Subcubic APSP via Triangles in Sparse Lopsided Graphs
Abstract
We give the first polynomial improvements over the textbook algorithms for SUM and All-Pairs Shortest Paths (APSP): we show how to deterministically solve SUM on integers of polynomial size in time and APSP on directed -vertex graphs with polynomially bounded integer weights in time. This refutes the SUM and APSP hypotheses. Using known reductions, we also refute the real-valued versions of the SUM and APSP hypotheses, the Exact Triangle hypothesis, the Zero-Weight -Clique hypotheses, and the three rectangular hinted Online Matrix–Vector conjectures of van den Brand, Nanongkai, and Saranurak, and we give polynomial speedups for a variety of other problems. All of these results follow from a single new algorithm for thin matrix products. Let be an integer matrix and a integer matrix with , and let be any set of at most positions. We compute the entries , , in operations, which is polynomially less than the time needed to write down or to compute inner products one by one. We design this algorithm by modifying a variant of Coppersmith's rectangular matrix multiplication algorithm, built from a ten-multiplication identity of Schönhage, to perform only the operations needed for the entries in , and show that few operations are needed. Interpreted as a graph algorithm, this solves the All-Edges Sparse Triangle problem in truly subquadratic time on sparse lopsided tripartite graphs where two parts have vertices but one part has vertices for . By known reductions, Exact Triangle, and hence SUM and APSP, reduce to this problem. We also give a data structure version that answers queries for single entries of , not known in advance.
Claude, an AI model developed by Anthropic, discovered the algorithm that refutes the 3SUM, APSP, and Exact Triangle hypotheses. The authors then worked to understand, simplify, strengthen, and extend the algorithm, derive additional consequences, and make the presentation accessible. See “Acknowledgments and Methodology” for how the result was found and shared with the authors. The authors take full responsibility for this paper.
Claude also verified this paper’s main results using the Lean 4 proof assistant with the Mathlib library.
Introduction
Since its inception, algorithms research has sought the fastest possible algorithm for every problem it considers. Powerful techniques have been developed, from variants of dynamic programming to surprising algebraic tools such as the Fast Fourier Transform [65] and fast matrix multiplication [147]. Yet for many problems, these techniques have not sufficed. Some examples include:
3SUM: Given numbers, decide whether three of them sum to 0. This is a classical problem with a long history, and it is central to computational geometry (see [92]). Despite many decades of research, the -time algorithm taught in algorithms classes has only been sped up by polylogarithmic factors [35, 94, 55].
All-Pairs Shortest Paths (APSP): Given an edge-weighted graph on vertices with no negative cycles, compute the shortest-path distance between every pair of vertices. Classical algorithms such as Johnson’s [107] and Floyd and Warshall’s [85, 162] solve APSP in time. After a long line of work [87, 150, 76, 97, 151, 152, 173, 52, 98, 53, 102], the fastest known algorithm [166] only shaves a subpolynomial, factor off the cubic running time.
Directed Unweighted APSP: The version of APSP in -vertex directed unweighted graphs. The fastest known algorithm, by Zwick [172], runs in time with the current bounds for rectangular matrix multiplication [10], and beyond improvements to the matrix multiplication bounds, it has not been improved for more than two decades. If the exponent of matrix multiplication is 2, the best known running time for this problem [14, 172] is still only .
Tree Edit Distance: Given two rooted, ordered, labeled trees with vertices, and costs for deleting, inserting, and relabeling vertices, find the cheapest sequence of such operations that transforms one tree into the other. Tree Edit Distance is used, for instance, to compare RNA secondary structures and XML documents. The fastest known algorithms for this problem [75, 133] run in cubic time, up to subpolynomial improvements. Only when all costs are equal to 1 are truly subcubic algorithms known [127, 74, 133].
Online Set Disjointness: Preprocess sets and over a universe of size , so that given and one can quickly decide whether , or, in the counting version, return . Essentially only two straightforward solutions are known: (1) to compute all answers in advance, which fast rectangular matrix multiplication does in time when [64, 161], and (2) to store the sets and compute each intersection at query time in time. Set Disjointness data structures have been studied extensively [50, 116, 89, 155, 119], mostly for sets of small total size over a large universe.
CNF-SAT: Given a Boolean formula in conjunctive normal form over variables and clauses, is there an assignment to the variables that satisfies all clauses? The brute-force algorithm solves CNF-SAT in time. There are slightly faster algorithms when the width of the clauses is bounded by a constant independent of [144, 136, 99]. However, no -time algorithm is known.
Orthogonal Vectors (OV): Given Boolean vectors in dimensions, are two of them orthogonal? The brute-force algorithm solves OV in time, and only subpolynomial improvements are known: the fastest algorithms [29, 66] run in time.
The apparent lack of progress on problems such as these led to new theories of hardness: NP-completeness [61, 110] for problems with no known polynomial-time algorithm, and fine-grained complexity (FGC) [154, 45] for problems whose best known algorithms were stuck at essentially the straightforward running time. Both theories relate problems via reductions. FGC focuses on improvements in the exponent: a fine-grained reduction from problem to problem with respect to running times and implies that an -time algorithm for for some can be converted into an -time algorithm for for some .
Fine-grained complexity took three of the problems from our list above and postulated that the state-of-the-art algorithms cannot be beaten: in the word RAM model of computation with -bit words, APSP with polynomially bounded integer weights requires time (the “APSP hypothesis” [140, 157, 159, 26]), 3SUM on integers of polynomial size requires time (the “3SUM hypothesis” [92, 136]), and there is no such that CNF-SAT on variables and clauses can be solved in time (the “Strong Exponential Time Hypothesis,” SETH [103, 104, 50]).
Through fine-grained reductions, FGC built a web of relations among problems, and within it, classes of problems that are equivalent to each other (see the surveys [154, 45]). For a large variety of problems for which no improved running times had been obtained in decades, FGC pointed to reasons: they are 3SUM-hard, APSP-hard, SETH-hard, or worse. In other words, to improve the known algorithms, one knew which obstacle needed to be overcome.
For instance, many problems are known to be equivalent to APSP under fine-grained reductions. Either all of the following problems are solvable in truly subcubic time, meaning in time for some constant (truly subquadratic is defined similarly), or none of them is: the -product of two matrices and (defined by ) [87, 19]1, Negative Triangle and Second Shortest Simple Path [157, 159], Graph Radius [30, 17], Tree Edit Distance [39, 133], and many other problems [157, 159, 138, 30, 17], more of which are listed below, after Figure 1. Perhaps surprisingly, it is also known [66] that solving APSP in truly subcubic time would give a polynomially faster algorithm for directed unweighted APSP as well, and the corresponding hypotheses are in fact equivalent [82]2 (albeit conditionally), even though the longstanding running times of the two problems are different: for APSP and for directed unweighted APSP (if ).

Figure 1. Problems affected by our algorithm, which solves the problem in the orange box (Lopsided All-Edges Sparse Triangle) directly. The problems inside each of the three thick-bordered blue boxes (3SUM class, Exact Triangle, and APSP class) are pairwise equivalent under fine-grained reductions (for MonoConvolution, whose baseline is , this means time), and we omit the arrows between them. Problems in gray boxes are reached from 3SUM, APSP, or Exact Triangle only by one-way reductions, so our result gives no faster algorithms for them, but these reductions no longer give evidence of hardness. The new algorithms are deterministic except where marked. Citations are to the reductions; for the problems in the top rows, the cited papers contain many more problems of the same kind.
Similar reductions and equivalences are also known for 3SUM: all nontrivial 3-linear degeneracy tests are equivalent to 3SUM [73], and many other problems are 3SUM-hard (e.g., many problems in computational geometry [92, 36, 146, 18], and some string problems [6, 26, 116]).
CNF-SAT reduces to Orthogonal Vectors [163], so that unless SETH is refuted, OV requires time. SETH also implies fine-grained hardness for many exponential-time problems [50].
Both 3SUM and APSP reduce to the Exact Triangle problem (given a tripartite graph with integer edge weights, is there a triangle whose three weights sum to zero?) [158, 157, 159]. Through Exact Triangle, both reduce to online Set Disjointness (from the list above), and even to its offline version, in which the query pairs are given in advance together with the sets [160, 71]; for 3SUM, direct reductions are also known [136, 116, 109, 1]. In graph terms, offline Set Disjointness is the All-Edges Sparse Triangle problem: given a graph with edges, decide for every edge whether it lies in a triangle.
All-Edges Sparse Triangle thus inherits the hardness of both 3SUM and APSP, and it is in turn the source of the conditional lower bounds for Set Disjointness data structures, dynamic graph problems, and other problems [136, 26, 116, 90]. Many came to regard it as one of the most reliably hard problems in fine-grained complexity, and the evidence seemed good.
All-Edges Sparse Triangle can be solved in time just by listing all triangles [105, 60], and a high-degree/low-degree split combined with matrix multiplication [14] improves this to , where is the matrix multiplication exponent.3 Even if , this is . On the graphs the reductions produce, which have vertices of degree about , this equals the brute-force running time conjectured to be optimal. Matrix multiplication only seemed useful for dealing with dense inputs, whereas these instances ask for a sparse set of outputs, and it seemed plausible that no technique could do better.
However, a reduction from to , proved in order to show that is hard, is also an algorithm for whenever turns out to be easy. In this paper we give a new algorithm for a lopsided version of All-Edges Sparse Triangle, in which the graph is tripartite and one of the three parts is significantly smaller than the other two. Most known reductions to All-Edges Sparse Triangle can be slightly modified to produce such instances.
As a consequence, all of the problems in the list above (and many more), except for CNF-SAT and Orthogonal Vectors, have polynomially faster algorithms than before:
3SUM: deterministic time for integers of polynomial size (Theorem 22), and for real numbers, a Las Vegas algorithm with expected time whose only operations on real numbers are comparisons, additions, and subtractions (Theorem 35).
APSP: deterministic time for polynomially bounded integer weights, and the same bound for the -product (Theorem 22), and for real weights, Las Vegas algorithms with expected time, again using only comparisons, additions, and subtractions on real numbers (Theorem 35).
Directed Unweighted APSP: a deterministic algorithm running in time for some constant , where is defined by , and is the exponent of multiplying an by an matrix. Note that is the longstanding running time of Zwick’s algorithm. This is the first improvement over Zwick’s algorithm that does not come from faster rectangular matrix multiplication, and it refutes the Directed Unweighted APSP hypothesis [66, 68, 84] (Theorem 34).
Tree Edit Distance: time for polynomially bounded integer costs via the tight reduction of [39].
Online Set Disjointness: for , a deterministic data structure whose preprocessing time is polynomially less than and whose query time is polynomially less
than , and which returns , so that it solves the counting version as well. For , the preprocessing takes time and the queries take time (Theorem 3).
The APSP and 3SUM hypotheses are therefore refuted, and so are several other hypotheses of fine-grained complexity. Figure 1 summarizes the problems affected, and in Section 1.2 below we list many more new algorithmic results. All of these results follow from one algorithm, for computing a given sparse set of entries of the product of two thin matrices, which we describe in the next subsection.
We view this as a great success for fine-grained complexity. The hypotheses were made to be tested. The reductions and connections between problems have always been the focus of fine-grained complexity, and these connections persist whether or not the problems turn out to be hard. The web of reductions that was interpreted to imply hardness is exactly what turns a single new algorithm into faster algorithms for a myriad of problems at once. This also opens a number of research directions in fine-grained complexity, algorithm design, and algebraic complexity; we discuss some in Section 6.
All-Edges Sparse Triangle
In this paper we present a simple algebraic technique that solves All-Edges Sparse Triangle in time, for a constant , on sparse tripartite graphs with two parts of vertices and a third part of at most vertices. In matrix language it computes a prescribed sparse set of entries of a dense product of thin matrices. We call a product of an matrix by a matrix thin when is a small power of , and, given a set of positions of the product, we call these positions, and the entries of the product at them, wanted. Unlike in usual fast matrix multiplication algorithms, the wanted entries are a sparse subset of the full matrix product, and our new algorithm critically exploits this. A matrix multiplication algorithm computes all entries of the product whether they are wanted or not, and thus takes time, whereas ours is faster than this. Our theorem is as follows.
Theorem 1 (see Corollary 26 and Theorem 25). Let , let and have entries of absolute value , and let be any set of positions. The entries , , can be computed deterministically in operations on -bit integers. More generally, for every and every there is a such that, whenever and , the task takes operations.
For comparison, when , computing each wanted entry one by one as an inner product costs , and computing the whole product with Coppersmith’s rectangular matrix multiplication algorithm [62] costs . Our algorithm is faster than either of these, and uses polynomially less than one operation per entry of the full product.
The algorithm builds on Coppersmith’s algorithm [62] for rectangular matrix multiplication, which makes use of an algebraic identity of Schönhage [143]. The high-level idea is to carefully analyze the inner workings of Coppersmith’s algorithm to see which operations are no longer needed since they are only used to compute output entries outside of . This approach would not work effectively for most known matrix multiplication algorithms,4 but it turns out that Schönhage’s identity has sparsity and combinatorial properties we can take advantage of to make this work. See Section 2 for a more detailed overview.
Coppersmith’s paper [62] contains two algorithms. The first algorithm achieves an running time for matrix multiplication (for matrices with bit entries). We do not use this algorithm here, but it has been extensively used before, both in the previous fastest APSP algorithm by Williams [166] and to design the fastest fine-grained algorithms for a number of problems using the polynomial method [164, 30, 29, 66, 16, 8]. Our approach instead builds on the second algorithm in [62], which only achieves an running time (and not ) for matrix multiplication for some constant ; these factors become insignificant in our setting of polynomial savings. Subsequent work on rectangular matrix multiplication has mostly followed this second approach [63, 120, 124, 161] achieving the current bound . In order to take advantage of the wanted set, we will modify Coppersmith’s second algorithm quite differently from prior work, in a way which ultimately achieves the worse bound .
Computing the wanted entries of a thin matrix product is equivalent to the counting version of Lopsided All-Edges Sparse Triangle (if and are the two biadjacency matrices, then is the number of middle vertices adjacent to both and ), so it solves the detection variant as well. In a tripartite graph with two parts of vertices and a middle part of vertices, our algorithm counts the triangles through each of prescribed pairs of outer vertices in time for , which is for , and, whenever , in truly subquadratic time for every (Corollary 16 and Theorem 25).
Known reductions
It is known that 3SUM [136, 116], Exact Triangle and hence APSP [66], and even their real-valued versions [?], all reduce to Lopsided All-Edges Sparse Triangle. In matrix terms, this detection version is a Boolean matrix problem, and it is also known as offline Set Disjointness [116, 66].
The published reductions are mostly randomized, since the hypotheses were stated for randomized algorithms, but some have been derandomized: the reductions from 3SUM [51, 84], including the reduction of [116] to offline Set Disjointness [84], and the reduction from Exact Triangle to the standard balanced case of All-Edges Sparse Triangle, by Chan and Xu [71]. We show that the reduction from Exact Triangle to the lopsided case can also be made deterministic by hashing the weights modulo a prime chosen with fast matrix multiplication and building the instances as Chan and Xu [71] do (Section 3.2), so we refute both hypotheses deterministically.
With randomization, we refute the hypotheses in their most general form, where the inputs are real numbers. The reduction of Chan, Vassilevska Williams, and Xu [?] from the real-valued problems to sparse triangle problems (which was designed as a hardness argument) uses only additions, subtractions, and comparisons (via Fredman’s trick [87]), so combined with our algorithm it gives Las Vegas algorithms for the real-valued versions of 3SUM and APSP (Section 5.2). Unlike the reductions for integer inputs, which need only the detection version, the reduction of [?] that we use is to the counting version of Lopsided All-Edges Sparse Triangle, which asks for the number of triangles through each prescribed pair, and which our Theorem 5 also solves. Chan, Vassilevska Williams, and Xu [?] also give a reduction to the Boolean version of All-Edges Sparse Triangle, but it is tight only from real APSP, not from real 3SUM or Exact Triangle.
Theorem 2 (Theorems 19, 22, and 35). On a word RAM with -bit words, deterministic algorithms solve the following problems, where all numbers in the input are integers of absolute value :
Exact Triangle on -vertex graphs in time,
APSP on directed -vertex graphs with no negative cycles in time,
the -product of two matrices in time, and
3SUM on numbers in time.
In the real RAM in which the only operations allowed on real numbers are comparisons, additions, and subtractions, Las Vegas algorithms solve the following problems on real inputs:
3SUM on numbers in expected time,
APSP in expected time,
the -product in expected time, and
Exact Triangle in expected time.
Lower bounds are known for the above problems in some restricted models of computation: over the semiring, straight-line programs need operations [111] and path-comparison algorithms need time [112], and 3-linear decision trees for 3SUM need depth [79], [4].
Our algorithms are not in these restricted models, since the known reductions remove the weights (by hashing, or by Fredman’s trick for real inputs), and we then count triangles in unweighted graphs using integer matrix multiplication.
We remark that there already was some indication that some of these models were too restricted, as for instance recent work [113] showed that 6-linear decision trees of depth suffice to solve 3SUM, and similar strong bounds are known for Exact Triangle. (See the paragraph on unaffected conjectures below for more on this.)
Data structure version, and hinted Online Matrix–Vector. Our algorithm for computing the wanted entries of a thin matrix product can also be converted into a data structure. We strengthen Theorem 1 as follows (Section 4):
Theorem 3 (see Theorem 24 and Corollary 26). Let , and let , have entries of absolute value . The pair can be preprocessed deterministically in time, polynomially less than the size of the product. After this, any single entry can be computed deterministically in time, polynomially less than . More generally, for every and every there is a such that, whenever , the pair can be preprocessed in time, after which any single entry can be computed in time.
The bounds of Theorem 1 follow by asking queries to the data structure. This allows us to refute the hinted Online Matrix–Vector (OMv) conjectures of van den Brand, Nanongkai, and Saranurak [155] in the regime of thin hints, i.e., for very rectangular matrices. In the OMv problem, one is given an Boolean matrix , and then vectors arrive one at a time, each of which must be multiplied by before the next one arrives. The OMv conjecture [100] asserts that this requires total time, and it implies tight lower bounds for many dynamic problems. In the hinted versions, the algorithm gets a hint before the vector arrives. For instance, in -hinted Mv, is an matrix and the hint is a matrix , one of whose columns will be the vector. One can then either compute all of by fast matrix multiplication as soon as the hint arrives, or wait and compute one matrix–vector product in time, and van den Brand et al. [155] conjecture that no algorithm is polynomially faster than both. Our data structure is faster than both when the hint is thin:
Theorem 4 (Corollary 40). The -hinted Mv, Mv-hinted Mv, and uMv-hinted uMv conjectures of [155] (Conjectures 5.2, 5.7, and 5.12 there) are refuted in the regime of thin hints. For hint dimension with , the phase after the hint takes time and the phase after the vector time, against the conjectured and . Correspondingly, the uMv version, whose two hints have dimensions and , fails for . All three fail, with smaller savings, for every (for the uMv version, ).
The main conditional lower bounds of [155] for dynamic matrix inverse use the conjectures at , far from the thin regime, and are unaffected. The bounds that are affected are those for the tail end of the update–query trade-offs with the fastest queries. These had established the conditional optimality of the dynamic matrix inverse algorithms of Sankowski [141] and of [155] when queries are fast, and these no longer have a believable conditional lower bound. Neither do other results whose lower bounds were based on this end of the trade-offs, e.g., for partially dynamic distance oracles [HLS24] and dynamic attention [156] (Section 5.4).
More new algorithms. Figure 1 shows the reductions involved. In addition to the results listed above, composing known reductions with our algorithms for Exact Triangle, 3SUM, APSP, and the -product ((2)) gives polynomially faster algorithms for many other problems. We next list some examples. Throughout, the numbers in the input are integers of absolute value polynomial in the input size, is the number of vertices, matrix rows, or input elements, and our algorithms are deterministic unless stated otherwise.
The APSP class. Negative Triangle, which asks whether an edge-weighted graph has a triangle of negative total weight, is arguably the simplest problem of the subcubic equivalence class of APSP [157, 159]; the fact that it is equivalent to APSP made many other reductions possible. The APSP subcubic equivalence class also contains Minimum Weight Cycle (with nonnegative weights) [138, 157, 159], Replacement Paths (for each edge of a shortest – path, the length of a shortest – path avoiding it) and Second Shortest Simple Path in directed graphs [157, 159], Radius, Median, and (for unique shortest paths) Betweenness Centrality [14], Metricity (does a given matrix satisfy the triangle inequality?) and -Product Verification (is for given matrices , , and ?) [157, 159], Tree Edit Distance [39], Maximum Subarray (the contiguous submatrix of an matrix with the largest sum of entries) [TT00, BDT16], the Wiener Index (returning the sum of all distances in a graph) [LVW18], computing
the number of witnesses for every entry of the (min, +)-product [68] and a variety of parity versions of many of the mentioned problems [12]. We give the first truly subcubic algorithms for all of these problems, and for Diameter and many other problems which reduce to APSP but may not be known to be equivalent.
The 3SUM class. The subquadratic equivalence class of 3SUM contains the variant with three input sets , , and (is there , , with ?) and GeomBase (given points with integer coordinates on the three horizontal lines , , and , is there a non-horizontal line through three of them?) [92], All-Numbers 3SUM (for every input number, decide whether it is part of a solution) [157, 159] (the reduction becomes deterministic with the self-reductions of [126, 91], as noted in [84]), Convolution-3SUM (do satisfy for some ?) [136, 51], and every nontrivial variant of 3-Linear Degeneracy Testing (are there distinct input numbers with , for fixed integers ?), such as 3AP, the case (do three of the numbers form an arithmetic progression?) [73]. The counting version #3SUM is also in the class [68, 83]; see the last item below. We give the first truly subquadratic algorithms for all of these problems.
The 3SUM class also contains MonoConvolution, a “colored” version of Boolean convolution: given three integer sequences of length , determine for every index whether there is a with . Lincoln, Polak, and Vassilevska Williams [123], Theorems 7 and 8 show that MonoConvolution is fine-grained equivalent to 3SUM: an -time algorithm for 3SUM gives an -time algorithm for MonoConvolution. Our approach gives time for MonoConvolution, improving on the previous time of [123].
The (min, +)-convolution class. The (min, +)-convolution of two sequences and of integers is defined as the sequence with for all . This convolution version of APSP is fine-grained reducible to both the (min, +)-product [44] and 3SUM [44, 59]. Problems equivalent to (min, +)-convolution include Superadditivity Testing (is for all ?), Maximum Consecutive Subsums (for every , the largest sum of consecutive elements), and Tree Sparsity (a subtree with vertices of maximum weight in a vertex-weighted tree) [59]. We give the first truly subquadratic algorithms for all of these problems, refuting the (min, +)-convolution hypothesis [44, 59]. (This would have been possible by refuting either the APSP or the 3SUM hypothesis, and we refute both.)
Knapsack and Approximate Subset Sum. Both 0/1 and Unbounded Knapsack, with items and capacity , reduce to (min, +)-convolution [59]. So does approximating Subset Sum to within a factor , which is in fact equivalent to it: an algorithm for (min, +)-convolution in time gives a randomized approximation scheme in time [44]. For 0/1 Knapsack, the best known bound in terms of and the largest item weight is [46, 106]. We give the first algorithms running in time, and the first approximation scheme running in time, for a constant . Only the algorithm for Unbounded Knapsack is deterministic.
Zero-, Min-, and Max-Weight -Clique. For a constant , find vertices of an edge-weighted graph whose edge weights sum to zero, or to the minimum or maximum possible value. Due to the now classical reduction of Nešetřil and Poljak [132]
-Clique to triangle detection, our new Exact Triangle algorithm immediately implies the first algorithms running in time for an (Section 5.3), refuting the weighted -Clique hypotheses [7, 125, 36].
3XOR. Given three lists of vectors in , where , decide whether there are vectors , , and , one from each list, with , where denotes the bitwise XOR. This is a well-studied variant of 3SUM [108, 77]. It is not known to reduce to 3SUM, but the same approach works for it as well, so we give the first truly subquadratic algorithm (Remark 23).
Counting versions. Counting the zero-weight triangles of an Exact Triangle instance, or the solutions of a 3SUM instance, is equivalent to the decision problem [68], and for 3SUM the equivalence also holds under deterministic reductions [83]. Similarly, counting the witnesses of each entry of the -product is equivalent to computing the -product [68]. We give the first truly subcubic algorithms for #Exact Triangle and for counting the witnesses of the -product, and the first truly subquadratic algorithm for #3SUM. See [68, 83] for applications.
For problems that are only known to be 3SUM-hard or APSP-hard, such as many of the geometric problems of [92] and the dynamic problems of [135, 26, 116], we get no faster algorithms, since the reductions go the other way. For instance, it is now open whether one can find three collinear points among points in the plane in truly subquadratic time.
Relationships to some unaffected conjectures. While we refute various hypotheses, their underlying problems are all similar in nature. We outline how a few other important problems with fine-grained hypotheses differ from 3SUM, Exact Triangle, and APSP, signaling that refuting them might require other techniques.
We begin with CNF-SAT and Orthogonal Vectors (OV). Neither of these problems is known to reduce to All-Edges Sparse Triangle or similar problems. CNF-SAT and Exact Triangle are known to both reduce to certain triangle problems (Matching Triangles and Triangle Collection [28]), but these triangle problems concern the triangles in each of about color triples in dense node-colored graphs, and our techniques do not appear to work there.
Unlike CNF-SAT and Orthogonal Vectors, 3SUM, APSP, and Exact Triangle have long been known to have fast algorithms in certain more powerful models.
3SUM (and more generally -SUM) and also Exact Triangle have very efficient linear decision trees. Following a long line of work [130, 79, 15, 93, 97, 98, 53, 118], it is now known [113] that for every , -SUM has -linear decision trees of depth , and Exact Triangle in -edge graphs has 6-linear decision trees of depth . APSP has decision trees of depth [87]. No such results are known for CNF-SAT and OV.
3SUM, Exact Triangle, and APSP also all have fast nondeterministic and co-nondeterministic algorithms. A nondeterministic algorithm for a decision problem verifies a proof for YES, and a co-nondeterministic algorithm verifies a given proof for NO. Carmosino et al. [50] showed that 3SUM can be solved nondeterministically and co-nondeterministically in time, and Exact Triangle and APSP in time. The best known co-nondeterministic algorithms for CNF-SAT and OV are no better than the known deterministic ones, and [50] postulate NSETH, the hypothesis that CNF-SAT requires time even for co-nondeterministic algorithms. They then prove that if NSETH is true, then there cannot be a deterministic (or zero-error randomized) fine-grained reduction from CNF-SAT or OV to 3SUM, APSP, or Exact Triangle. In fact, our algorithm shows that if there were a deterministic fine-grained reduction from CNF-SAT or OV to 3SUM, APSP, or Exact Triangle, then SETH (and not merely NSETH) is false.
Interestingly, the issues posed by co-nondeterminism disappear in the Merlin–Arthur world where randomization is allowed. CNF-SAT [165], 3SUM, and APSP [3] all have vastly improved Merlin–Arthur protocols: the verification time for CNF-SAT (indeed for counting its satisfying assignments) is , for 3SUM it is , and for APSP it is .
While we obtain a polynomial improvement for 3SUM, we are unable to do so for -SUM for . 3SUM reduces to -SUM, but no reduction in the other direction is known, and although -SUM reduces to exact-weight subgraph problems [21, 23], whose baseline we improve (Section 5.3), those reductions can only give -SUM algorithms far slower than the baseline.
The same holds for -XOR for and for the 3SUM-Indexing conjecture [115], [115], [88] . Ultimately, we believe that one good reason for the lack of progress on is that -SUM for is not known to have fine-grained self-reductions. This has been a major obstacle in designing reductions from -SUM and is also a major obstacle in designing algorithms for it. (The same goes for -XOR for .)
Combinatorial algorithms. The new algorithms are algebraic and potentially impractical in their current form: the constants hidden in the are enormous, and the exponents can likely be improved. One might ask whether there are practical or “combinatorial” algorithms for these problems, similar to how one talks about combinatorial Boolean Matrix Multiplication (BMM). The known algorithms for combinatorial BMM, including the Four Russians [9], the bounds of [34], [54], [169], and the recent bound of Abboud, Fischer, Kelley, Lovett, and Meka [11], save only a subpolynomial factor, and no truly subcubic combinatorial algorithm is known. We do not know whether such algorithms exist. Most FGC reductions are combinatorial, so one could refocus the hypotheses to be about combinatorial algorithms [157, 159, 26].
Other parameter regimes. Even without considering combinatorial algorithms, one might also ask whether All-Edges Sparse Triangle can be solved faster in every regime of how large the three parts are. Our technique (due to the identity we use) needs the middle part to have at most vertices, whereas prior reductions have focused on different regimes.
For instance, the balanced sparse case of All-Edges Sparse Triangle introduced by Pătraşcu [135] has as input a tripartite graph with roughly equal parts and edges overall. Most known fine-grained reductions produce such balanced instances and give conditional lower bounds of .
Another case of interest is where the tripartite graph has two parts of size and one part of size and edges overall. Solving this version in time, even only for triangle detection (and not even for the all-edge version), would have consequences for girth approximation in undirected unweighted graphs [139].
Even faster algorithms. Our focus in this paper is to give the simplest presentation of our new algorithm for thin matrix products, and show how known reductions to All-Edges Sparse Triangle combine with this to give all the polynomial speedups mentioned above. In particular, over the course of this project, with Claude we generated some algorithms whose exponents are slightly better than the ones we present here, but which are significantly more complicated. We intentionally did not include them in this paper. See also the discussion in Section 6 and footnote 10.
Organization. In Section 2 we give the main matrix algorithm. In Section 3 we derive the algorithms for Exact Triangle, 3SUM, and APSP from it, by using or slightly modifying known reductions. In Section 4 we give the data structure version of our matrix algorithm, proving Theorems 1 and 3. In Section 5 we present reductions to achieve the other algorithmic results discussed above. Finally, in Section 6 we discuss future directions.
Quickly computing certain entries of a thin matrix product
We now present our main new algorithm, for computing a subset of the output entries of a thin matrix product. We call such a matrix product thin since the input matrices are highly rectangular. We work in the standard word RAM model with -bit words, and thus count operations on -bit integers.
Theorem 5. Let be a power of four and . Given as input matrices and , whose entries are integers of absolute value at most , as well as a set of at most positions of an matrix, the entries , , can be computed deterministically in time .
We call the positions in , and the entries of at them, wanted. We emphasize that , , and may be arbitrary dense matrices, and no structure is assumed about the set other than its size .
We have aimed to present this section in a way that is accessible to nonexperts. Some details in Theorem 5, such as the exponent 18, are chosen to simplify the presentation in this section while still proving a version sufficient to refute the 3SUM and APSP hypotheses. Later, in Section 4, we present a stronger data structure version that has improved parameter trade-offs.
Notably, while the language of tensors and bilinear complexity naturally describes much of our algorithm and the prior work it builds on, we deliberately avoid that language here. This is in part so that a reader unfamiliar with that background may still follow, but also because our arguments here will focus on sparsity and combinatorial properties of our algorithms and algebraic identities that are often intentionally abstracted away in tensor language.
Sections 2.1–2.3 present an exposition of the relevant prior work that we directly build on, especially Strassen [147], Schönhage [143], and Coppersmith [62], and no prior understanding of those works is assumed. The main new idea of this paper is then presented in Section 2.4.
Technique overview. Strassen’s algorithm multiplies matrices by applying a small identity (seven products for multiplying matrices) recursively. In that algorithm, the multiplications happen at the leaves of a recursion tree, and the additions that prepare the leaves (the “encoding phase”) and assemble the result (the “decoding phase”) are comparatively cheap. We do the same with an identity of Schönhage that computes, simultaneously, two small rectangular matrix products. Applied at levels of recursion, the identity computes matrix products at once. In order to multiply and using this, we cut them into smaller blocks, and then simultaneously multiply many pairs of blocks using Schönhage’s identity (Section 2.3).
The new idea (Section 2.4) is to visit only the leaves of the recursion tree that the wanted entries from need. A priori, it is not clear that this reduces the number of leaves by much, or that the encoding and decoding phases stay cheap. Both nonetheless turn out to hold, for two reasons.
First, we observe that the additions in the encoding phase that prepare the leaves depend on alone or on alone (as is the case in all tensor rank decompositions). Since each block is multiplied with every block, we only need to compute these additions once for each block and may share them among many calls to our algorithm (and similarly for ). One reason for the requirement is to ensure that this total cost will be negligible (Section 2.4.1).
Second, we prune the recursion tree, and make a recursive call only when one of its outputs is wanted by . This way, the running time is governed by the union of the sets of leaves that the wanted entries need. Most of the analysis goes into bounding this union (Section 2.4.3). We will see that every output entry has a private leaf that no other entry needs, but that all its other leaves are shared by many entries. We will characterize each leaf by how often one needs to pick each of the two matrix products from Schönhage’s identity to get to it in the recursion tree, and find a trade-off: choosing one of the matrix products leads to a relatively small number of leaves, while choosing the other increases how many output entries share each leaf. Balancing the two, we will find that a set of wanted entries only needs about leaves in all, and paying operations per leaf gives Theorem 5.
Strassen’s recursive algorithm
We use the recursive approach for multiplying matrices introduced by Strassen [147]. We begin by recalling his algorithm for intuition. The key behind his algorithm is an identity that shows how to multiply two matrices and using only seven multiplications instead of eight. It forms seven products, each of a linear combination of the entries of with a linear combination of the entries of , and then obtains each entry of as a linear combination of those seven products. Recall that, writing and , the seven products are
and the product is
To use this identity to multiply matrices for larger , we interpret and as block matrices (whose entries are matrices), then multiply them as in the identity, i.e., we form seven pairs of linear combinations of the blocks of and of , recursively multiply each pair, and then assemble the four blocks of from the seven results. When , the recursion tree (Figure 2) has levels, and leaves, one for each choice of one of the seven products at each level. The multiplications take place at the leaves, meaning there are multiplications in total. We call the additions on the way down, which prepare the leaves and are computed from alone and from alone, the encoding, and those on the way up, which assemble the product, the decoding.

Figure 2. Strassen’s recursion on matrices, , showing the first two levels of calls below the root.
To calculate the total cost of Strassen’s algorithm, we also need to count the additions and subtractions at the internal vertices of the recursion tree. At depth of the recursion tree, there are internal vertices. Both on the way down and on the way up the tree, the algorithm must compute linear combinations of matrices at each of these vertices, which uses operations. The total across the whole tree is therefore , a geometric series dominated by its last term, so the additions only increase the running time by a constant factor. This phenomenon is prevalent in recursive matrix multiplication algorithms, although in the new algorithm we develop in Section 2.4 below, this same argument will no longer apply, and we will need to count the additions and subtractions more carefully.
Schönhage’s identity for an inner product and an outer product
While we will still use Strassen’s recursive approach here, we will replace his identity with another one due to Schönhage [143]. In this subsection we give the notation to introduce this identity and explain its usefulness.
It will be convenient to write such identities as trilinear polynomials.5 As an example, we first show how to write Strassen’s identity from Section 2.1 in this way. Introduce four output variables , one for each entry of the product , and multiply each of the seven products of Strassen’s identity above by the signed sum of the output variables of the entries where it appeared in the decoding phase. For instance, appears in the formulas for and , so it is multiplied by , and appears in the formula for with a minus sign and in the formula for , so it is multiplied by . Strassen’s identity then reads
where are the products of two linear forms from (1). Now the coefficient of on the right-hand side is the entry that we want, and its coefficient on the left-hand side is the combination of the seven products that computes it, such as $S_1 + S_4 - S_5 + S_7 for . This polynomial identity thus records the linear combinations and products to be formed, as well as the combinations that assemble the outputs from them.
We will next present Schönhage’s identity in the same way. Recall that the outer product of two vectors and consists of the nine numbers , and the inner product of two vectors and is the single number . These are special cases of matrix products: the outer product is multiplying a matrix times a matrix, and the inner product is multiplying a matrix times a matrix. (We index the and variables with rather than to set up nicer notation for and in Lemma 6 below.)
Separately computing the inner product and outer product would use multiplications. However, Schönhage [143], §6, eq. (6.3), with showed that they can be computed (along with some error terms that will turn out to be harmless) using only 10 multiplications. The fact that this is possible even when the inner and outer products are on disjoint sets of variables is surprising, and refuted a border rank version of the “direct sum conjecture for tensor rank” [148].
We call the seven left variables and the seven right variables. We will also use ten output variables (for ) and , one for each of the ten quantities we aim to compute, namely, the coefficients of the output variables in the polynomial
As a notational helper to state the identity, we introduce two matrices and of linear forms. These are formed by starting with the matrices of the ’s and of the ’s, then extending them to matrices so that every column of and every row of sums to zero:
Notice that is the desired inner product.
Schönhage’s identity has ten terms, which we name (for , corresponding to the entries of and ) and . Each term is the product of a linear form in the left variables, a linear form in the right variables, and a linear form in the output variables. These linear forms are as follows:
Lemma 6. Summing over the ten terms,
Proof. We compute the coefficient of each output variable on the left-hand side. The coefficient of comes only from the term , and it is . The coefficient of is . In this expression, the products cancel, and the cross terms sum to since the rows of and the columns of sum to zero. What remains is , as desired.
Lemma 6 is the key identity we will use. It computes our desired plus an error polynomial . Before moving on to our algorithm, we make two structural observations about the identity that we will use below.
Our first observation will be used to handle the error . We call the variables of the inner product, , , and , inner, and those of the outer product, , , and , outer. Notice that every monomial of consists only of inner variables () or only of outer variables (). Meanwhile, every monomial of has an outer output variable together with an inner left or right variable. We will use this observation to show that is harmless in our algorithm in Lemma 9 below.6
Our second observation concerns the pattern of output variables in our identity, and will be used to take advantage of the sparsity of the set of wanted entries in our final algorithm. We say that a term contributes to an output variable if appears in . We see that every term contributes to , and only contributes to . (The decoding layer of Figure 3 below will also illustrate this.) The fact that only one term contributes to each will eventually help us to reduce how many products we need to compute when we only need certain output entries. Since the forms are all sums of output variables (without any minus signs or other coefficients), it follows that for each output variable , its coefficient on the left-hand side of the identity is , where the sum is over the terms contributing to .

Figure 3. One level of the recursion, the analog of one step of Strassen’s algorithm. In step (2), each of the ten terms combines at most three of the seven slices into (solid lines: , dashed: ). For instance, and . The same is done to with the forms . In step (3), the ten pairs are multiplied by recursive calls, . In step (4), the slice of the output is , and the slice is the sum of all ten, because every term contributes to .
Rectangular matrix multiplication using Schönhage's identity
In this subsection, we apply Schönhage’s identity recursively to derive an algorithm for rectangular matrix multiplication (computing all the output entries, not just a small subset). Our approach is similar to Coppersmith’s algorithm [62], although we will make modifications that worsen some parameters of the algorithm in exchange for preserving some of the combinatorial and structural properties of Schönhage’s identity that we will use below.
The recursion
Schönhage’s identity computes two matrix products, the outer product and the inner product, on disjoint sets of variables. We will see that applying it to levels of recursion therefore involves matrix products, one for each way of choosing the outer or the inner product at each level. A choice with the inner product at of the levels, and the outer product at the other levels, corresponds to the product of a matrix and a matrix. (We will focus on a setting of much smaller than so that these are thin matrix products.) In this subsection, we set up notation for the arrays that the recursion works on and state the recursion, then in Section 2.3.2 we will describe precisely what it computes.
The inputs and outputs of our algorithm will be arrays that contain the entries of many different matrices concatenated together. (Later in Section 2.3.4 we will use this algorithm as a subroutine to multiply a single pair of matrices.) We will index the entries of these arrays by strings of variables of Schönhage’s identity. Whether each variable is an inner or outer variable will tell us which of the matrix products the array entry corresponds to, and the specific variables will tell us which entry of the matrix it corresponds to.
A left string of length is a string of left variables, and we call its variable at level . An array on the left strings of length assigns an integer to each that is a left string of length . The array has entries in total (since there are 7 left variables). We define right strings, output strings, and arrays on them in the same way. For instance, an array on the output strings of length has entries (since there are 10 output variables).
For a term and a left variable , let denote the coefficient of in , and define similarly for right variables . Recall from Schönhage’s identity that, for each term , at most three of the seven values are nonzero since each has at most three monomials, and similarly for the seven values .
Just as Strassen’s algorithm cuts matrices into blocks, we cut an array on strings of length into slices according to the variable at level 1: the slice of at a left variable is the array on the strings of length given by . Thus, consists of its seven slices, just as a block matrix consists of its blocks. We similarly define the slices of an array on right strings, and of an array on output strings.
The recursion Full, for arrays on the left and right strings of length , returns an array on the output strings of length :
(1) If , return the number .
(2) For each term of Schönhage’s identity, form and .
(3) For each term , recursively compute .
(4) Return the array whose slices are and .
For , Full is one application of Schönhage’s identity: step (2) evaluates the linear forms and at the seven numbers and the seven numbers , step (3) multiplies the two values for each , and step (4) sums the products into the ten outputs as the forms prescribe. In the terms of Section 2.1, step (2) is the encoding and step (4) the decoding.
The calls of Full form a recursion tree. We refer to the call reached by choosing the terms at levels as the vertex , a string of terms. It is at depth , and its input arrays are on strings of length . The root is the vertex with , and the leaves, the vertices at depth , are the multiplications performed in step (1).
Let us now count the operations performed by this algorithm. At depth there are vertices (since Schönhage’s identity has 10 terms), each with two input arrays of entries and an output array of entries. Step (2) takes operations at a vertex, and step (4) takes operations. Hence, Full uses operations in total, which is not much more than the multiplications. Of this, the encodings, step (2), account for only operations, and the decodings, step (4), for the rest.
Unraveling the recursion computation
In this subsection, we carefully work out which two numbers are multiplied at the leaf , and what is returned by . For a leaf let
where the sums are over all left strings and all right strings of length . We extend the relation “contributes to” of Section 2.2 from terms to vertices: a vertex contributes to an output string if contributes to at every level . Thus the leaf contributes to if at every level where (but may be arbitrary at the levels where ). Let be the array on the output strings of length given by
Lemma 7. At the leaf , multiplies by , and it returns .
Proof. By induction on (see Figure 3). For , the only leaf is the empty string , and and , as the products over the levels are empty, so step (1) multiplies them and returns . For , step (2) is the encoding: since , for every leaf we have
and similarly . Thus, by induction, the leaf multiplies by , and , summed over the contributing to . Step (4) is the decoding: the leaves contributing to are the with contributing to and contributing to , so agrees with (2).
Since one application of the identity computes the coefficients of , we expect that recursive applications should compute products of such coefficients. For a left variable , a right variable , and an output variable , let
the coefficient of the monomial on the left-hand side of the identity. By Lemma 6, it is also the coefficient of in , and we know that .
Lemma 8. For all arrays and every output string ,
the sum over all left strings and right strings .
Proof. By the definitions of and , the coefficient of in (2) is , summed over the leaves contributing to . These are the leaves whose term at level contributes to , independently for each , so this sum of products is the product of sums
by (3).
We will use both descriptions of : Lemma 8 to read matrix products off it (Section 2.3.3), and the sum over leaves in (2) to skip the leaves that do not contribute to the wanted entries (Section 2.4).
Batch computation of multiple matrix products
We now explain the claim from the beginning of Section 2.3.1, that our recursive algorithm is simultaneously computing many matrix products. We will also show that the error is harmless, using the fact that each of its monomials uses an outer output variable, but at least one inner input variable.
The inner set of a left string is the set of levels at which it has a (as opposed to an ). It will tell us which of the matrix products the string belongs to. Similarly, the inner set of a right string is the set of levels at which it has a (as opposed to a ), and the inner set of an output string is the set of levels at which it has (as opposed to a ). The inner part of a string is the string of its variables at the levels of its inner set, in the order of the levels, and its outer part is the string of its variables at the other levels. A string is determined by its inner set, its outer part, and its inner part.
Fix , and let and . Of the matrix products, one for each set of levels at which the inner product is chosen, we will use only the products with , and set the inputs of the others to zero. As we now make precise, the product for such a multiplies an matrix by a matrix: the outer levels, with three left and three right outer variables each, give its rows and columns, and the inner levels, with four left and four right inner variables each, give the terms of the sum in each of its entries. (To prove Theorem 5, we will ultimately set , a choice we will explain in Section 2.4.3 below.)
We will index the rows and columns of the matrices in these products by strings of variables. For an matrix, we index its rows by the strings of outer left variables, and its columns by the strings of inner left variables. Similarly, for a matrix, we index its rows by the strings of inner right variables, and its columns by the strings of outer right variables. To multiply an matrix by a matrix , we match the column of indexed by the string with the row of indexed by the string with the same indices, so that the entry of in row and column is
where the sum is over all the strings of inner left variables. Thus, the rows of the product are indexed by the strings of outer left variables and its columns by the strings of outer right variables.
Let be a subset of of size . As above, the outer part of a left string with inner set is a row of an matrix and its inner part is a column, so the left strings with inner set index the entries of such a matrix. For an matrix we write for its entry at the row and the column of . Similarly, the right strings with inner set index the entries of a matrix , the row given by the inner part of and the column by the outer part, and we write for this entry. Finally, the output strings with inner set index the entries of the product : if the variables of at the levels outside are , in the order of the levels, then the row of is the string and its column is the string , and we write for the entry there (Figure 4).

Figure 4. From strings to matrix entries, for and . A string whose inner set is has an inner variable (, , or ) at the two levels of and an outer one at the other four. One run of Full computes all products , one for each subset of size 2.
We can now check that Full, which returns Mult, really computes these products. For each of the subsets of of size , let be any matrix and be any matrix. Let the input arrays and be these matrices laid side by side, by setting
for all the left strings and the right strings whose inner set has exactly elements, and , at every other string.
Lemma 9. For the input arrays above and every output string whose inner set has exactly elements,
Proof. By Lemma 8, is the sum, over all left strings and right strings , of , where is the coefficient of in . We determine which summands can be nonzero. First, requires the inner sets of and to have exactly elements. Next, at a level we have , and the only monomials of that contain are , with coefficient . So for some . Thus and have an inner variable at every level of , and their inner sets are therefore exactly . Finally, at a level we have for some , and and are outer. The left string :
outer part : the row of in , inner part : its column, so indexes an entry of
right string :
inner part : the row of in , outer part : its column, so indexes an entry of
output string :
row and column , read off from its , so indexes an entry of
levels (shaded: the inner set )
only monomial of that contains and no inner variable is , with coefficient 1, so .
Hence, the summands that remain are those where has inner set , the row of as its outer part, and some inner part , and where has inner set , the column of as its outer part, and the inner part with the same indices as . There is one such summand for each of the strings , and its coefficient is 1. Their sum is .
To summarize: one run of Full, which uses multiplications, computes all of the products . The products can be completely independent: we are free to plug in any choices for and and the algorithm will give us all products. In the next subsection we will end up plugging in the same matrix for different copies (and ).
Tiling the product by products of shape
We now use our algorithm, which performs simultaneous multiplications of an matrix with a matrix, in order to do a single multiplication of an matrix with a matrix . For our parameter setting, , so we can do this with a simple tiling approach. Tiling enlarges only the outer dimensions, so it handles a smaller inner dimension than Coppersmith’s algorithm from the same identity (at best rather than [62]). We use it because each entry of is then a single output of a single run of Full, rather than a linear combination of many outputs as in Coppersmith’s algorithm. We will take advantage of this in our algorithm below (Section 2.4).
We cut into row blocks of consecutive rows and into column blocks of consecutive columns. Thus, consists of all the products of a row block by a column block, each an by product, and one run of Full computes such products at once. We use each run on a grid of block products, where : we group the row blocks into bands of consecutive blocks, and similarly the column blocks, and we call a row band together with a column band a tile (Figure 5). Each tile is one run of Full. We fix distinct subsets of of size , one for each block product of the grid, the same in every tile. In a tile, let and be the row block and the column block of the block product with subset , and let for the other subsets . Then one run of Full computes all block products of the tile (Lemma 9), and running it on every tile computes all of .

Figure 5. The tiling, drawn for and . A block product, a row block of times a column block of , holds entries of . A tile, a band of row blocks together with a band of column blocks, is one run of Full, which computes its block products, each with its own subset ( shown in the highlighted tile).
We pair the blocks in a grid like this, rather than arbitrarily, so that the left input array of a tile depends only on its row band and the right one only on its column band. This will let us share their encodings among tiles in Section 2.4.1 below. (To make the bands fit, we first pad to a multiple of with zero rows of and zero columns of , which at most doubles since , as we will see in Section 2.4.4.)
Before moving on, let us compute the number of operations performed by this algorithm. Let denote the number of output entries among all products of a tile. Since , there are tiles. Thus, recalling the operation count of a single tile from Section 2.3.1, the whole product takes operations, that is, per entry of . One can calculate that this is in total when , but about for our choice . We nonetheless choose , and in Section 2.4.3 below we explain why this is needed for our sparsity arguments.
Extracting only the desired entries
In this subsection, we present the main new idea of this paper. Our goal is now to compute only the wanted entries of , i.e., those at the positions in , which is a set of size . We will modify the algorithm of Section 2.3 in two ways. First, we will observe that the encoding (step (2)) of each input array depends only on that array and not the other, and that each input array is shared by many tiles (defined in Section 2.3.4), so we can compute each encoding only once and share it among those tiles (Section 2.4.1). Second, we will prune the recursion tree for the multiplication and decoding steps (steps (3) and (4)), by skipping a recursive call whenever none of its outputs leads to an output entry from (Section 2.4.2). Finally we will analyze the algorithm by counting the leaves that are reached (Section 2.4.3), and adding up the costs (Section 2.4.4).
Sharing the encoding
The two numbers and multiplied at a leaf depend on alone and on alone, respectively, so we will compute them once per input array rather than once per tile. The encoding of is the array of the numbers , indexed by the leaves . This is the array that the encoding steps of Full compute from . To compute it, we run Full with left out and without step (4): by Lemma 7, the left number at the leaf is , and the leaf stores it. This takes operations, the cost of the encoding in Section 2.3.1. The encoding of , the array of the numbers , is computed in the same way.
We compute the encodings of the input arrays of all row bands and all column bands (defined in Section 2.3.4), arrays of numbers in all, and every tile reads its two encodings from these. It is important that these encodings are shared, since an encoding has numbers, more than the entries of the products of a tile, so encoding every tile separately would cost more than one operation per entry of the entire matrix product (even before focusing on ). Since each encoding is computed only once per band, the encodings are used by all tiles. Each one costs , independently of . The assumption makes this cost negligible (as we will compute in Section 2.4.4).
Skipping the calls that are not needed
Once the encodings are computed as above, we can skip that phase of Full. Instead, each leaf reads its two numbers from the encodings, and each call only performs the decoding of step (4). We now modify Full so that each call computes only the outputs that are wanted from it, i.e., the outputs that lead to entries in . We will implement this by passing to each call the set of the outputs that are wanted from it.
More precisely, the outputs of the vertex (defined in Section 2.3.1) are indexed by output strings of length , and is a set of such strings. If is the set passed to the root (in the final algorithm, this will be the set of output strings of the wanted entries of the tile), we will see in Lemma 10 that will consist of the suffixes of the strings to which the vertex contributes (as defined in Section 2.3.2). Sets of output strings have slices like arrays (see Section 2.3.1): for a set of output strings and an output variable , the slice is the set of output strings with , and an array on assigns an integer to each string of .
Our modified version of the recursive algorithm Full, which we call Pruned, is as follows. , for a set of output strings of length , returns the array returned by the vertex of , restricted to the strings in :
If , then look up and from the precomputed encodings (Section 2.4.1) and return for the leaf .
For each term of Schönhage’s identity, let be the union of the slices over the to which contributes, i.e., and .
For each term of Schönhage’s identity with , compute , an array on .
Return the array on whose slices are and , restricted to and to . (These restrictions make sense, since and for every , by step (2).)
Let us confirm which leaves visits. Recall from (2) that is the sum of over the leaves contributing to (as defined in Section 2.3.2), i.e., those that choose at every level where has , and may choose any term at levels where has . For a set of output strings of length , we write for the set of leaves that contribute to some output string of .
Lemma 10. Let and be input arrays, and let be a set of output strings of length . Called at the root, returns restricted to . The leaves it visits are exactly those of , and the sets passed to the calls it makes have total size at most .
Proof. The values are correct by induction on : each is the array of the corresponding child of restricted to , so step (4) is step (4) of restricted to .
Recall that consists of the last variables of each string in such that contributes to the first variable of that string. Thus, an induction on shows that the set passed to the vertex consists of the suffixes of the strings of to which the vertex contributes, and furthermore that the vertex is called if and only if this set is nonempty. This means a leaf is visited if and only if it contributes to some string of .
For the total size, map each suffix in the set passed to a vertex to the leaf that extends by picking at the levels where the suffix has and by picking where it has . By the previous paragraph, the vertex contributes to some string of with this suffix, and then so does this leaf, so the leaf is in . The leaf determines the vertex and the suffix. This means the sets passed to the vertices at each of the depths have total size at most .
In other words, each call is made at most once, no matter how many strings of depend on it, and the running time depends on the size of the union of the sets of leaves contributing to the strings of , rather than the sum of their sizes. It remains to bound this union.
Few leaves contribute to a sparse set of entries
In our final algorithm, which we present below in Section 2.4.4, the set passed to will consist only of the output strings we have been focusing on, i.e., output strings of length whose inner sets (defined in Section 2.3.3) have exactly elements, so that they index the entries of the products (Lemma 9). There are such output strings (with as defined in Section 2.3.4), and in this subsection all output strings are of this kind.
Our focus in this subsection is on counting how many leaves the algorithm visits. A single output string has leaves contributing to it. This may appear problematic, since it is more than the multiplications that computing that output entry directly, as an inner product, would take. Because of this, it is important that we do not simply count the leaves of each output string of separately. Instead, we will find that most leaves contributing to an output string also contribute to many other output strings, and there are few such leaves in total.
Let us begin by classifying leaves by how many levels they choose at (as opposed to one of the s). As we mentioned above, the leaves contributing to an output string with inner set are the leaves that choose any term at each of the levels of , but at every level outside where the output string has . We call the one that chooses at every level of the private leaf of the output string. The private leaf contributes to no other output string, since an output string with a different inner set requires a term other than at some level of , and an output string with the same inner set but a different outer part (a different at some level outside ) requires a different term there.
To describe how close a leaf is to being a private leaf, we define the order of a leaf as minus the number of levels at which it chooses . A leaf contributing to an output string chooses only at levels of the output string’s inner set, so its order is at least 0. Since is the only term that serves the inner product alone, this is the classification described in the technique overview: the order of a leaf contributing to an output string is the number of levels of the string’s inner set at which the leaf takes one of the terms shared with the outer product. The only leaf of order 0 contributing to an output string is its private leaf. Beyond this, exactly
leaves of order contribute to an output string, namely its private leaf with replaced by one of the nine other terms at of the levels of (Figure 6).

Figure 6. The leaves contributing to one output string, drawn for , , and the output string of Figure 4. A leaf is written as the string of terms it chose, level by level. A leaf of order is the private leaf with replaced by one of the nine terms (shown as a generic in the shaded cells) at exactly levels. Leaves of higher order are more numerous per output string, but each is shared by more output strings: a leaf that chose at levels contributes to one output string for each set of size containing those levels, of them. At this makes them fewer in all, by (5).
The total number of leaves of order in the entire recursion tree is
since we can choose the levels with and one of the nine other terms at every other level. In particular, since the leaves of order 0 are exactly the private leaves, and there is one per output string. A leaf of order contributes to output strings, one for each inner set of size that contains the levels at which it chooses . Indeed, , as both sides count the pairs of an output string and a leaf of order contributing to it. Finally, if , then for we have
As in the technique overview, leaves of higher order are more numerous per output string, but each of them is shared by more output strings, and by (5) there are fewer of them in all. Below, we count all the leaves of order , whether or not they contribute to a string of , and this count will be small enough since the decrease geometrically. By the ratio in (5), this requires to be well below : at , the choice that computes the whole product cheaply (Section 2.3.4), the ratio would be close to 1 for small , so the would stay about instead of decreasing, and the count would give no saving. A small also makes small compared with (about ), and since a tile must fit into the product, must be a large power of . Together with the cost of the encodings (Section 2.4.4), this is why Theorem 5 assumes .
From now on, we fix , so that and . Recall that , so and .
Lemma 11. For every set of output strings whose inner sets have exactly elements,
and if , then .
Proof. We bound the number of leaves of order in in two ways: by , charging each output string of for its leaves of order , and by , the number of all leaves of order . Since every leaf of has an order , summing the smaller of the two over gives the first inequality. (Summed on their own, gives , the cost of computing each output string of by itself, and gives less than by (5), the cost of computing all output strings.) Neither nor depends on which output strings are in .
For the second inequality, let . We use for the orders and for the orders (Figure 7). The orders contribute at most by (5). The orders contribute at most , and since for ,

Figure 7. The count of Lemma 11, schematically. The leaves of order in number at most : the bound grows with up to (more leaves of higher order contribute to each output string), and the bound shrinks geometrically (there are fewer leaves of higher order). The proof splits at , which is not necessarily where the two bounds cross, and it bounds the total by the shaded area.
since . Adding the two parts gives the second inequality.
Since and , the second inequality of Lemma 11 says that
Consider a tile in which entries are wanted. (This is the density of Theorem 5, which allows wanted entries out of .) Then , and the bound says that only leaves contribute to the wanted entries of the tile. This is a factor below the number of output entries of the tile, and far below the multiplications that computing each wanted entry directly, as an inner product, would take. Next in Section 2.4.4 we sum the number of leaves over all the tiles, and we will use the fact that the bound is linear in , meaning the total is the same no matter how the wanted entries are spread over the tiles.
Proof of Theorem 5
We finally put everything together to state and analyze our algorithm. As before, set and .
Two consequences of . We use the assumption twice, each time to check that is large enough compared with a quantity that grows exponentially in . Since , we compare -th powers by comparing their bases.
First, the tiling of Section 2.3.4 requires that so that it does not lose too much when padding, since it pads to a multiple of . This holds: using the general bound , we have , so , as , and hence . This means the padding at most doubles , and we continue to write for the padded size.
Second, the encoding phase of the algorithm (Section 2.4.1) has a cost that does not depend on at all, and we need to ensure it is not too large. Recall that we perform encodings, which use operations each. To afford them within our budget of operations, we need
This also holds: , so .
The algorithm. We compute the encodings of all row bands and column bands (Section 2.4.1). Each wanted position lies in one tile and is indexed by one output string of , the string whose inner set is the subset of the block product containing and whose row and column are those of within that block product (Sections 2.3.3 and 2.3.4). For each tile , let be the set of the output strings of the wanted positions in . Then, for each tile with , we run , and report, for each , the value at its output string. This is correct by Lemmas 9 and 10.
The cost. By (6), the encodings cost operations. Each position of lands in one set , so , and there are at most tiles, so . A call of with a set takes operations, since each of its steps handles each string of a constant number of times and a string has length (we store the sets as sorted lists, so that a slice is a segment and a union of slices is a merge). By Lemma 10, the total number of operations per leaf of is thus . Thus, by Lemma 11 summed over the tiles, the pruned recursions use
operations, no matter how is distributed among the tiles. The remaining minutiae, which list the subsets, locate the output strings, and sort the sets , take operations per subset, per tile, and per position of , which is in all (as , there are at most tiles, , and ). Finally, since and , the total operation count is , as desired.
Word size. Every number the algorithm handles is an integer of magnitude . The input entries are of this size, by assumption. Every number in an encoding, or formed on the way to one, is a combination of at most input entries, as step (2) only adds and subtracts slices, and every value computed by is a sum of at most products of two encoded numbers (Lemma 7), where by (6). Indices and list positions are at most the number of words in use, also . Hence every integer has bits, as desired. □
Remark 12 (comparison with related techniques). Prior work on matrix multiplication typically counts only multiplications, since they are usually a dominant cost for the algorithm, whereas in our algorithm, the additions need to be dealt with carefully. Our encodings (Section 2.4.1) are Yates’ algorithm for Kronecker powers [168, 93], as is standard in recursive matrix multiplication algorithms. The pruned recursion of Section 2.4.2 is an analog of FFT pruning [128, 142], of trimmed Möbius inversion [40], and, transposed, of sparse evaluation of Kronecker-power circuits [22], which builds on [167]. The new part along these lines in this paper is the count of Section 2.4.3, which shows that the pruned recursion visits few leaves.
Exact Triangle reduces to computing certain entries of a thin matrix product
This section derives the faster deterministic algorithms for Exact Triangle (given a tripartite graph with integer weights on its edges, is there a triangle whose three weights sum to zero?), 3SUM, and APSP from our new matrix theorem. Theorem 5 already suffices for this, and its stronger form in Section 4, Corollary 26, gives the running times stated in the introduction. Later, in Section 5, we will similarly derive our other algorithmic results.
Almost nothing in this section is new. We will apply known reductions from fine-grained complexity theory, due to Pătraşcu [135], Kopelowitz, Pettie, and Porat [116], Vassilevska Williams and Williams [158, 157, 159], Vassilevska Williams and Xu [160], Chan and He [51], Chan and Xu [71], and Fischer, Kaliciak, and Polak [84]. We go into some detail rather than just citing these known results for two main reasons. First, the theorem statements in the literature do not quite match the parameter regime of the matrix theorem, and obtaining exactly the matrix shapes that our algorithm needs requires slight modifications of the known constructions. Second, for one step, the reduction from Exact Triangle to the lopsided triangle problem, the only known reduction that achieves the parameters we need is randomized [160], and the known deterministic one [71] targets the balanced problem. We will make a small modification to achieve a deterministic reduction, using a known tool [84]. The reductions from 3SUM and APSP to Exact Triangle are deterministic already, and we cite them as they are. Thus, all the steps are deterministic, and so we ultimately design deterministic algorithms for all these problems. In Figure 8 we give an overview of the relevant reductions.

Figure 8. The reductions of this section. Each arrow is a reduction, labeled with the prior work it follows and with the statement here that proves it. Each box gives two running times: the first follows from Theorem 5, and the second from its stronger form, Corollary 26. We reprove only the reduction from Exact Triangle to Lopsided All-Edges Sparse Triangle, deterministically and for the parameters of the matrix theorem; the reductions from 3SUM and APSP are cited as they are. The running times in the two bottom boxes assume and .
We remind the reader of some basics from fine-grained complexity that we will use here. A reduction from a problem to a problem is an algorithm for that builds instances of , solves them using an oracle (an algorithm for that it treats as a constant time black box), and does some extra work. We will typically state three things about it: how many instances it builds, of what size, and how much extra time it uses. Composed with an algorithm for , it is an algorithm for , whose running time is the extra time plus the total time to solve on each instance created. Such a reduction can be interpreted as conferring hardness (if is hard then so is ) or as an algorithmic tool (a faster algorithm for gives one for ). Here we will use the second interpretation to design our algorithms.
The particular types of reductions we focus on are fine-grained reductions. Here, for two problems and and two time bounds , , an -fine-grained reduction from to is an algorithm that solves any -sized instance of by making oracle calls to instances of of some sizes where for every there is an s.t. and so that solves in time. In other words, if had an time algorithm, then replacing the oracle calls by calls to the algorithm, due to the inequality above, we would get an time algorithm for .
Section 3.1 restates Theorem 5 and Corollary 26 in the language of graphs. Section 3.2 reproves the reduction from Exact Triangle to the lopsided problem in a deterministic way. It hashes the weights modulo a small prime (in place of the random hash functions of earlier reductions: almost-linear hashing in the reductions from 3SUM [135, 116], and a random map into a large prime field in [160]), chooses the prime deterministically by counting false positives, as in the 3SUM reduction of Fischer, Kaliciak, and Polak [84], and builds the instances and searches for witnesses as in Chan and Xu [71]. The false positive counting in [84] is accomplished using the FFT; here, similar to prior work (e.g., [32]), for Exact Triangle we compute the count by multiplying two matrices whose entries are polynomials of low degree which can be done efficiently using fast matrix multiplication. Section 3.3 combines this reduction with Theorem 5 and Corollary 26 to solve Exact Triangle in truly subcubic time. Section 3.4 restates the reductions from 3SUM and APSP to Exact Triangle [158, 157, 159, 51] with their overheads, and applies them.
The Lopsided All-Edges Sparse Triangle problem
We define a lopsided (rectangular) version of the well-studied problem All-Edges Sparse Triangle. When viewed in graph terms, Theorem 5 counts the triangles through prescribed pairs of vertices in a tripartite graph whose middle part is small, and thus in particular can be used to solve All-Edges Sparse Triangle in such graphs.
Definition 13 (Lopsided All-Edges Sparse Triangle, Lop-AE-SparseTri(, )). We are given an unweighted undirected tripartite graph with two parts and of vertices each and a middle part of at most vertices, with arbitrary edges in and . Let be the set of edges between and . Decide, for every edge , whether it lies in a triangle with some vertex of , that is, whether and have a common neighbor in .
In this notation, the usual All-Edges Sparse Triangle problem is the balanced case (after the standard reduction to tripartite graphs), except that one asks about every edge of the graph, not only those between and , and that the running time is measured in terms of the number of edges. We think of as being polynomially smaller than and as polynomially smaller than , so the instance is sparse in this sense. The brute-force algorithm solves Lop-AE-SparseTri(, ) in time. If , then, since [161],7 fast rectangular matrix multiplication can solve the problem in time even when . We will beat both and for and with a constant , and this will suffice to refute both the 3SUM and the APSP hypotheses.
Some of the known reductions, such as those from the real-valued problems in Section 5.2, reduce to the counting version of All-Edges Sparse Triangle, which asks for the number of triangles through each edge; we define the lopsided version.
Definition 14 (Lopsided All-Edges Sparse Triangle Counting, #Lop-AE-SparseTri(, )). This is the same problem as Lop-AE-SparseTri(, ), except that for every edge (, ) we ask for the number of triangles it lies in, that is, the number of common neighbors of and in .
In matrix language, let and be the biadjacency matrices of the edges between and and between and , that is, if and only if and are adjacent, and if and only if and are adjacent (padded with zeros if has fewer than vertices). Then Lop-AE-SparseTri(, ) asks for the entries of the Boolean product of and at the positions in , and #Lop-AE-SparseTri(, ) asks for the corresponding entries of the product of and $Y over the integers. In the language of Section 2, is the set of wanted positions, and we call its elements the query pairs.
The counting version #Lop-AE-SparseTri(, ) is also equivalent, up to polylogarithmic factors, to the problem of Theorem 5 and Corollary 26, that is, to computing the wanted entries , , of a thin matrix product, for matrices and whose entries have absolute value .8
Besides asking for the wanted entries of a Boolean thin matrix product, the detection version Lop-AE-SparseTri(, ) can also be viewed as offline Set Disjointness (see, e.g., [116, 160]): the sets are the neighborhoods in of the vertices of and , over a universe of at most elements, and a query pair (, ) asks whether the sets of and are disjoint. The reductions below (mostly from prior work) produce at most query pairs and sets of at most elements, which is the regime of [116] and of [160], Corollary 3.12.
With the above discussion in mind, Theorem 5 gives the following.
Corollary 15. Let be a power of four with , and consider an instance of #Lop-AE-SparseTri(, ) or of Lop-AE-SparseTri(, ) with query pairs. If , then the instance can be solved deterministically in time. In general, splitting into sets of at most query pairs solves it deterministically in time
Proof. Apply Theorem 5 with to the two biadjacency matrices: the entries , , are the numbers of common neighbors, and they are nonzero exactly for the query pairs that lie in a triangle. For larger , apply the theorem to each of at most pieces.
The data structure of Section 4 improves the saving to (Corollary 26), and gives the following.
Corollary 16. Let , and consider an instance of #Lop-AE-SparseTri(, ) or of Lop-AE-SparseTri(, ) with query pairs. It can be solved deterministically in time.
Proof. This is Corollary 26 with , applied to the two biadjacency matrices as above.
For , which is what the reductions below produce, the running time in Corollary 16 is .
The reduction of Section 3.2 is stated for an arbitrary , with the number of oracle calls and the additional time as functions of and a free parameter , and Section 3.3 chooses and .
A deterministic reduction from Exact Triangle to Lop-AE-SparseTri
Exact Triangle. An instance of Exact Triangle (also called Zero-Weight Triangle, and sometimes “Love Triangle” [94]) consists of a complete tripartite graph on vertex parts of vertices each, and an integer weight on every edge, with for some constant . Let . A zero triangle is a triangle with , and the task is to decide whether one exists. As is standard, an instance on an arbitrary -vertex graph reduces to this form by taking three copies of the vertex set and giving every missing edge the weight , which lies in no zero triangle (this replaces by ), and the search version, which asks the algorithm to find a zero triangle if one exists, is equivalent to the decision version via a simple self-reduction (the reduction below finds one anyway).
Theorem 17 (Exact Triangle to Lop-AE-SparseTri, deterministically). Let , and let be an integer. Exact Triangle on vertices per part with weights of absolute value at most reduces deterministically to at most instances of Lop-AE-SparseTri, each with at most query pairs, plus additional time, where is the matrix multiplication exponent [10]. The reduction is non-adaptive: it produces all the instances before it makes any oracle call, so they can be solved in any order, or all together.
The parameter trades the number of instances against the cost of the search for witnesses in the last step of the proof (the term ); Section 3.3 balances the two. The oracle returns at most answers per instance, and the time to read them is counted as part of the oracle calls, rather than as additional time.
Proof. The proof has three steps: we hash the weights modulo a prime, build the instances, and search for witnesses.
Hashing modulo a prime. We reduce the weights modulo a prime , chosen deterministically. This size of fits the instances below: a piece of of up to vertices, paired with the labels, gives a middle part of at most vertices, and the pairs fall into residue classes of about pairs on average, which is the number of query pairs that an instance may have. A false positive of is a triple with and ; let denote the number of false positives of . For every prime in the range we count the triples with . This number is the number of false positives plus , the number of zero triangles, which does not depend on . Each is computed by a standard trick for small weights [14, 172]: let and be matrices over the ring , so that the coefficient of in is the number of with ; then is the sum over the pairs of the coefficient of in . Computing takes ring operations, or with Strassen’s algorithm [147], each of them word operations, so time over the fewer than primes in the range. (Any matrix multiplication algorithm fast enough to make this term negligible suffices. For our choice of , Strassen’s algorithm already does, and keeps the reduction potentially practical.9
We select the prime with the smallest count, which is also the prime with the fewest false positives, and call it . To bound , note that a triple with is a false positive exactly of the primes in the range that divide . Since and these primes are at least , there are at most of them. Hence the numbers of false positives of all the primes in the range add up to at most . By the prime number theorem there are primes in the range, and is at most the average over them, so, as in [84], , since for .
The instances. As in [71], let and split into pieces of at most vertices each, so that . For let be the set of edges with , and cut it into chunks of at most query pairs. There are at most chunks in all. For each chunk and each piece form the instance of Lop-AE-SparseTri with query pairs and middle part , of size at most , whose middle vertices are pairs (vertex, label) as in [71], with
Within the chunk, the condition has become the equality of a label of and a label of , so a query pair has a common neighbor if and only if some has . There are at most instances, since because , and because and we may assume , and they are produced non-adaptively, since is chosen before any of them. Writing them down costs : the two bipartite graphs of an instance have entries, and the chunks are computed once and shared by the pieces.
Witnesses. For every query pair that the oracle accepts, scan the piece of its instance for a with , as in the exhaustive search of [71]. A zero triangle is always found, since its lies in some piece and makes the oracle accept its pair. We stop as soon as a zero triangle is found. A failed scan, of a piece for a pair , contains a with but , that is, a false positive of , and distinct scans contain distinct false positives, so there are at most failed scans, and the scans cost .
Remark 18 (Comparison with [71] and [160]). We emulate the instances and the witness search of Chan and Xu [71], Section 3. The difference is in how the pairs are grouped so that the condition on becomes an equality of labels. For exact integer weights, takes too many values to group by, so Chan and Xu group the pairs by a reference witness with known , which they find by a recursion on the bits of the weights, and use Fredman’s trick. Their labels are exact and there are no false positives. After hashing, takes only values, so we can group by it directly, in a single round of instances instead of a recursion. The labels take only values, so the middle part is small, but in exchange, this introduces false positives. Vassilevska Williams and Xu [160] also hash, but by a random map into a large prime field, with and the vertex weights random, followed by a split of the field into intervals. With residues in place of their intervals, the block of our instance for and is their graph , and our instance puts the graphs with the same side by side. They use randomness to bound the degrees and the false positives through each edge, which their listing step needs [160], whereas the scans above need only the total number of false positives, controlled by the choice of .
Exact Triangle in truly subcubic time
Theorem 19 (Exact Triangle). Let and . For every constant , Exact Triangle on vertices per part with integer weights of absolute value at most can be solved by a deterministic algorithm in time using Theorem 5 (via Corollary 15), and in time using Corollary 26 (via Corollary 16).
Proof. Assume is larger than a constant depending on (smaller instances are solved by brute force). In both cases we apply Theorem 17, whose instances have at most query pairs each, and solve every instance by a corollary of Section 3.1. The values of below balance the cost of the instances against that of the scans (Remark 20).
By Theorem 5. Let be the largest power of four with , so that , and let . Solve every instance by Corollary 15, which applies because . The instances cost each, so in all, the scans cost , the choice of costs with Strassen’s algorithm, and building the instances costs . Finally , so the time is .
By Corollary 26. Let and , and solve every instance by Corollary 16, which applies because . The instances cost , the scans , the choice of costs with Strassen’s algorithm, and building the instances costs . Finally gives , so the time is .
Remark 20. With and a saving per instance, the instances cost and the scans , up to logarithmic factors. They balance at , that is, at for the saving of Theorem 5 and at for the saving of Corollary 26. Any improvement of these savings improves the final exponent directly, and the factor in it comes from the assumption of these theorems. Any other algorithm for Lop-AE-SparseTri can be plugged into Theorem 17 in the same way. With the straightforward algorithm ( per instance, since every vertex of has neighbors in the middle part) the reduction recovers the brute-force bound up to a logarithmic factor.
3SUM and APSP reduce to Exact Triangle
The reductions here are known and deterministic. We recall them in the form we use, and then apply Theorem 19, with its bound , , when it uses Corollary 26.
Theorem 21 (Known reductions). For every constant : (a) (3SUM) on integers of absolute value at most reduces deterministically, in time, to instances of Exact Triangle on vertices per part with weights of absolute value [51, 158].
(b) ((min, +)-product and APSP) If a deterministic algorithm solves Exact Triangle on vertices per part with weights of absolute value at most , for a suitable constant , in time with nondecreasing, then the (min, +)-product of two integer matrices with entries of absolute value at most can be computed deterministically in time, and APSP on directed -vertex graphs with integer weights of absolute value at most and no negative cycles in time [157, 159, 158].
Using the above known reductions we solve both 3SUM and APSP polynomially faster:
Theorem 22 (3SUM and APSP). Let be a constant. Using Theorem 5 (through Theorem 19), deterministic algorithms solve on integers of absolute value at most in time, and the (min, +)-product of two integer matrices with entries of absolute value at most , as well as APSP on directed -vertex graphs with integer weights of absolute value at most and no negative cycles, in time. Using Corollary 26 instead, the times are and .
Proof. Plug Theorem 19 into Theorem 21. With the bound of Theorem 19, the cost for 3SUM is
and for the (min, +)-product and APSP, with , for which is nondecreasing, it is
With the bound instead, the cost for 3SUM is
and for the (min, +)-product and APSP, with , it is
Remark 23 (3XOR). The same approach as for 3SUM gives a deterministic truly subquadratic algorithm for 3XOR (given three lists of vectors in , find one vector from each list such that the three XOR to zero [108, 77]), using linear hash functions over whose rows are chosen one at a time from an -biased set [13] by the method of conditional expectations.
The matrix theorem in general: a data structure
In this section, we extend our algorithm from Section 2 in two directions. First, we turn it into a data structure. After preprocessing and in less time than it takes to write down , the data structure answers a query for any single entry of , not known in advance, in time polynomially smaller than the operations that it would take to compute that entry as an inner product. Second, we let the parameters of our construction vary. This will give larger time savings than , and trade-offs between the time savings, how thin the product must be, the query time, and the density of the set of wanted entries. We assume that the reader is familiar with Section 2, whose notation we use throughout, although we will begin with a brief reminder of the relevant notions.
In Section 4.1, we state the main results, Theorems 24 and 25, with explicit parameter examples in Table 2, as well as Corollary 26, the instance of Theorem 24 that our reductions in Sections 3 and 5 use. In Section 4.2, we will introduce the key new idea, the partial sums that our data structure stores, which we call boxes. In Section 4.3, we will then give the data structure in terms of the parameters (listed in Table 1), and finally we will set the parameters in Section 4.4.
| symbol | meaning | in Section 2 | in this section |
| , | the number of inner levels, and the inner dimension of the product | ||
| , | the number of levels of the recursion, and its ratio to | , | |
| the number of rows of a row block, and of columns of a column block | |||
| the number of products of a tile, one for each set of levels | |||
| the number of output entries of a tile | |||
| the number of leaves of order contributing to one output entry | |||
| the number of leaves of order in a tile | |||
| the decay rate of the : , see (7) | |||
| the switching order: a query reads the leaves of order below , and the preprocessing puts the others into boxes; in Section 2, the order at which the count of Lemma 11 splits | , | ||
| the preprocessing, or the whole computation when is given in advance, takes time | see Table 2 | ||
| the results hold for | |||
| a query takes time | no queries | see Table 2 | |
| the set of wanted entries has | see Table 2 |
Table 1. The parameters of our construction. The last two columns give their values or bounds in Section 2 and in this section. Where these columns are empty, the parameter is given by the formula in the first column in both sections. In this section, and are and rounded up to integers, and the bound is defined in Section 4.4.
| ratio | \multicolumn{6}{c}{Theorem 24: the data structure for query time , } | \multicolumn{5}{c}{Theorem 25: the wanted entries for , } | ||||||||||
| 0.10 | 0.25 | 0.43 | 0.50 | 0.75 | 0.90 | 0.10 | 0.25 | 0.50 | 0.75 | 1.00 | ||
| 40 | 0.029 | 0.0205 | 0.0608 | 0.1175 | 0.1429 | 0.2417 | 0.3095 | 0.0166 | 0.0473 | 0.1060 | 0.1720 | 0.2442 |
| 21 | 0.056 | 0.0112 | 0.0331 | 0.0640 | 0.0778 | 0.1316 | 0.1685 | 0.0099 | 0.0286 | 0.0653 | 0.1074 | 0.1546 |
| 19 | 0.062 | 0.0097 | 0.0287 | 0.0555 | 0.0675 | 0.1142 | 0.1463 | 0.0087 | 0.0253 | 0.0578 | 0.0954 | 0.1379 |
| 15 | 0.079 | 0.0061 | 0.0183 | 0.0354 | 0.0430 | 0.0728 | 0.0932 | 0.0057 | 0.0168 | 0.0389 | 0.0646 | 0.0941 |
| 12 | 0.099 | 0.0028 | 0.0083 | 0.0160 | 0.0195 | 0.0330 | 0.0423 | 0.0027 | 0.0080 | 0.0186 | 0.0312 | 0.0459 |
| 10.5 | 0.114 | 0.0007 | 0.0022 | 0.0043 | 0.0052 | 0.0089 | 0.0114 | 0.0007 | 0.0022 | 0.0052 | 0.0087 | 0.0129 |
Table 2. Explicit parameters for Theorems 24 and 25. Each row is a choice of the ratio . The parameter is determined by and says how thin the product must be, i.e., every entry of the row holds whenever . On the left, the columns correspond to a choice of , and the numerical entry is a value for which Theorem 24 holds, meaning that after preprocessing, a query takes time. On the right, the columns correspond to a choice of , and the numerical entry is a value for which Theorem 25 holds, meaning that any wanted entries take time. On the left side, the column uses the switching order of Section 2 (more precisely, ), and its two bold entries are Theorem 5 (, where ) and Corollary 26 (). A larger gives a larger but a smaller , and a slower query or a sparser allows a larger . We round all values down, and we will explain how we compute them in Section 4.4.
Notions from Section 2. We keep the recursion, the tiling, and the encodings of Sections 2.3 and 2.4.1, and we use the terminology of Sections 2.3.2 and 2.4.3 as defined there: the leaves contributing to an output string, its private leaf, the order of a leaf, and the counts and . For convenience, we briefly recall these notions here.
A leaf is a string of terms of Schönhage’s identity, where is the term chosen at level of the recursion (Section 2.3.1). Throughout this section, we compare levels by their indices: we say that level is lower than level if , so that the lowest level is the first level of the recursion.
An output string with inner set has the variable at each of the levels of , and one of the variables at every other level. It indexes the entry of the product (Section 2.3.3).
A leaf contributes to if it chooses at every level where has , while it may choose any of the ten terms at the levels of , where has (Section 2.3.2).
The private leaf of is the leaf contributing to that chooses at every level of (Section 2.4.3).
The order of a leaf is minus the number of levels at which it chooses . For a leaf contributing to , this is the number of levels of at which it chooses a term other than (Section 2.4.3).
A tile consists of a band of row blocks of together with a band of column blocks of (Section 2.3.4), and the encoding of a band is the array of the numbers , or , computed from its input array (Section 2.4.1). We will recall both in more detail in Section 4.3.
As in Section 2.4.3, all output strings in this section have inner sets of exactly elements, so that they index the entries of the products of a tile, and we will use that . For a leaf of a tile with input arrays and , we call the *product at . We read its two factors from the encodings of the tile (Section 2.4.1), and by (2) and Lemma 9, is the sum of the products at the leaves contributing to . The one change from Section 2 is that is now any integer with , and we call the ratio.
Technique overview. The pruned recursion of Section 2.4 needs to know in advance, since it visits exactly the leaves that the wanted entries need. When the queries arrive one at a time, we must instead prepare for every possible output entry.
Recall that our preprocessing must take less time than it takes to write down . This means it stores fewer than one number per entry of , so each number that it stores must be useful for many different entries. Meanwhile, a query must take far fewer than the operations that it would take to compute the entry directly as an inner product. In Section 2, the running time had three parts: the leaves of small order, the leaves of large order, and the encodings (Lemma 11 and Section 2.4.4). Our data structure will divide these parts between the queries and the preprocessing. Each output entry uses only a few of the leaves of small order, so a query may just read them one by one. By contrast, each output entry may use many leaves of large order, but there are not too many such leaves in total, and each of them is shared by many output entries. Thus, in preprocessing we will add them up in advance, in groups which can be quickly summed during queries. The preprocessing also computes the encodings, once.
The leaves contributing to an output string form a cube: at each level of the inner set of the output string, they choose any of the ten terms, and at each other level, they agree with the private leaf of the output string. Every one of these leaves, other than the private leaf, also contributes to other output entries. We will therefore add up parts of every cube in advance, into what we call boxes (which are themselves smaller cubes), so that a query adds up a few box values instead of products. For this we need a rule that cuts every cube into few boxes, with each of its leaves of large order in exactly one of them; we will prove this for our rule in Lemma 27. We will make sure that the definition of a box does not refer to the output entry, so that the same box serves many output entries, which keeps the total number of boxes small, as we will show in Lemma 29.
We also need to compute all the boxes of a tile quickly in preprocessing, and here we will use dynamic programming. Since a box is a cube, it has a fixed term at some levels, and its other levels are free, meaning all ten terms are allowed there. Fixing each of the ten terms in turn at the highest free level splits the box into ten smaller boxes, and its value is the sum of their values. Thus, in Lemma 29, we will compute the boxes from the smallest up, each from the values of smaller boxes computed before.
The order at which a query switches from leaves to boxes, which we call the switching order, trades off the query time (about ) against the preprocessing time (about boxes per entry of the product, where is the rate at which the decay). The ratio (which we fixed to be 19 in Section 2, but we now allow to vary) trades off the time savings against how thin the product must be. While a larger makes smaller, it also makes the encodings larger relative to , so that computing them stays within the time bound only when is a larger power of . With and , we will get the instance of Corollary 26, and pushing down toward 10 will give the upper limit for of our technique, namely (Corollary 31).
The results
In this section, we design a data structure with the following guarantee. Let .
Theorem 24. For every , and every , there is a such that the following holds. Given as input matrices and , where , whose entries are integers of absolute value at most , we can preprocess them deterministically in time and space, after which any single entry can be computed deterministically in time.
The constant gives the upper limit for of our technique, and we will explain where it comes from in Section 4.4 below (after the proof of Corollary 31). To achieve the general form of the matrix theorem, where we know the positions in advance as in Section 2, we simply ask the data structure one query per position. Setting the parameters to balance the preprocessing time and the total time for all the queries gives the following.
Theorem 25. For every and every there is a such that the following holds. Given as input matrices and , where , whose entries are integers of absolute value at most , as well as a set of at most positions of an matrix, the entries , , can be computed deterministically in time .
The logarithmic factors in both theorems can be removed by halving and applying Theorem 24 with in place of ; for the bounds are trivial.
In Table 2, we list several parameter settings for Theorems 24 and 25. Theorem 5 is the entry , , applied to a set of wanted entries (that is, ). We next state explicitly the parameter setting that we use in the introduction and in our reductions in Sections 3 and 5. It is the entry , of Table 2, whose switching order is , as in Section 2, with the logarithmic factors absorbed into the exponents.
Corollary 26. Let , and let and have entries of absolute value at most . We can preprocess them deterministically in time and space, after which any single entry can be computed deterministically in time. Hence, for every set of positions of an matrix, the entries , , can be computed deterministically in time, which is whenever .
Boxes
In this subsection, we define the boxes and prove two important facts about them. Intuitively, a box is a group of leaves that is shared by many output strings. In preprocessing we will add up the products at the leaves of each box, and then that value can help to answer many queries. In terms of the switching order , we will ensure that the boxes of an output string partition its leaves of order at least , and that there are only of them. We will thus see, in Lemmas 27 and 28, that every output entry is the sum of a few products and a few values of boxes.
Cubes. A cube is a string of symbols, each of which is one of the ten terms of Schönhage’s identity or a star . Its leaves are the leaves obtained by replacing each star by any of the ten terms, so a cube with stars has leaves, and a cube without stars is a single leaf.
The value of a cube is the sum of the products at its leaves,
Every output entry is the value of a cube. Indeed, recall that the entry of an output string with inner set is the sum of the products at the leaves contributing to . These are the leaves of the cube of , the cube that has a star at each level where has (the levels of ) and the term at each level where has , so that . In Figure 6, this cube is all the rows taken together. Figure 9 shows the cube of an output string, and the boxes defined next, in the recursion tree of a small example.

Figure 9. The cube and the boxes of the output string in the recursion tree, for and switching order . Since has at levels 1 and 3, its inner set is (so ). A query for reads the private leaf, which has order , and the values of the boxes of , which contain the other 99 leaves (of orders 1 and 2). A box with a star is not a subtree: it consists of the same leaf of every subtree.
We will cut the cube of every output string into parts that are again cubes, in a way where each leaf of the cube lies in exactly one part, so that
and the value of a part will be shared by all the output strings that have it as a part. In Lemma 28 below, we will prove this equation for the parts that we will choose. There will be two kinds of parts. Each leaf of small order will be a part on its own (recall that a single leaf is a cube without stars), whereas the leaves of large order will be grouped together into larger parts, which we call boxes.
The definition of a box. The order of a leaf tells us how widely it is shared between output entries. Recall that the order is minus the number of levels at which the leaf chooses , so that leaves of order contribute to an output string, and that a leaf of larger order contributes to more output strings. Throughout, we fix the switching order , an integer with . The boxes will collect the leaves of order at least , i.e., the leaves that choose at most times, and a query will read the leaves of order below one by one (Section 4.3).
Before giving the formal definition, we describe the idea informally and give some examples. Consider an output string with inner set , and a leaf of order at least contributing to . To find the box of , we look at the levels of one at a time, from the highest down, and we stop as soon as we have seen levels at which chooses a term other than . The box of then agrees with everywhere, except that it has a star at every level of below the level where we stopped. For instance, let and as in Figure 10, and suppose that chooses the terms at the four levels of . We see at level and at level , and we stop there, so the box of is (in the first row of the figure). This box contains along with the 99 other leaves that differ from only at the levels and . Similarly, for a leaf that chooses the terms , we stop at level , so its box is (in the second row of the figure). Since a box has stars at the levels that we did not reach, it contains many leaves. Moreover, although we described the box of in terms of , the definition of a box below does not refer to an output string, and the same box serves many output strings.

Figure 10. The boxes of an output string for and , drawn at the four levels of its inner set (at every other level, they have the term of the private leaf of ). Here stands for one of the nine terms other than , and * for all ten terms. Each row is one of the six sets of levels and stands for the boxes of , one for each choice of the two terms . Read from right to left, a row stops at its second , and the levels to the left of it, those of , carry stars. On the right are the sets of levels at which the leaves of such a box choose , and the number of its leaves. Every set of at most two levels appears in exactly one row (Lemma 27), so these boxes contain each of the leaves of order at least 2 contributing to exactly once.
A box is a cube such that (i) at most of its symbols are or stars, and (ii) every star is at a lower level than every . That is, the symbols and stars of a box, read in increasing order of the levels, are
and its other symbols are among the nine terms . A leaf of chooses at the levels where has and possibly at some of its star levels, and hence at most Winvalid? times by (i), so a box only contains leaves of order at least . By (ii), a box is obtained from a leaf of order at least by replacing its lowest symbols (rather than an arbitrary subset of them) by stars. Therefore, each leaf yields at most boxes, one for each value of , which keeps their total number small, as we will show in Lemma 29. Boxes of this shape suffice: we will prove in Lemmas 27 and 28 that the leaves of order at least of an output string can be split among of them. (We will see below that the boxes of an output string all have exactly symbols that are or stars. We nonetheless allow fewer in the definition of a box, since boxes with fewer such symbols will arise as intermediate values in the dynamic program of Lemma 29.)
It is important here that a star stands for all ten terms, included, so that one box collects leaves of several orders (from to , for a box with stars and symbols ). This is needed for fast queries. If a star stood only for the nine terms , then every box would fix the set of levels at which its leaves choose , so an output string would need a separate box for each subset of of size at most . That would be about boxes when is small, so a query would take about time, which gives no saving below when there are queries.
The boxes of an output string. We now make precise the informal rule above for finding the box of a leaf, and describe all the boxes of an output string with inner set . Let be a leaf of order at least contributing to , whose box we found above by going through the levels of from the highest down (Figure 10). In symbols, let
(the levels at which chooses ),
( padded from the bottom),
(the levels that we have not reached).
Since the order of is , the set has exactly levels, namely, all the levels of except the at which we saw a term other than . We define by the same formula for every , with if . It is the longest initial segment of contained in . ( stands for zero, since these are the levels where chooses , and stands for free, since these are the levels where the box has a star.)
For with , let be the set of the cubes with
Every cube in is a box: it satisfies condition (i) of the definition because it has symbols or stars, and condition (ii) because its stars are below its symbols , since is an initial segment of . When is the set defined above from a leaf , the box of is the one in with the terms of at the levels of . Since a box of has stars at the levels of , it contains the leaves with any terms there, of which there are . Notice that the set depends on (since it depends on and on the terms at the levels outside ), but we omit this from the notation since will always be clear from context. We call the boxes in these sets, over all with , the boxes of .
There is another way to describe the boxes of , in terms of the leaves of order exactly contributing to . For such a leaf, consider the lowest level of at which it chooses a term other than , and replace its by a star at every lower level of (or at every level of , if ). The result is a box of , and each box of arises exactly once in this way. This means that has exactly boxes.
Every leaf of order at least lies in exactly one box. A leaf contributing to that chooses at the set of levels is a leaf of a box of if and only if it chooses at every level of and at no level of , that is,
Furthermore, it is a leaf of exactly one of these boxes, namely, the one with its terms at the levels of . We will see in the following lemma that, for , exactly one satisfies this condition, namely padded from the bottom. Thus every leaf of order at least lands in exactly one box.
Lemma 27. Let be a set of levels, and let . For every with , there is exactly one set with and
namely together with the lowest levels of .
Proof. Let with and . We show that holds if and only if consists of the lowest levels of , which determines . If , then both conditions hold: , so , and is all of . Otherwise, let be the lowest level of . Then consists of the levels of below , so says that every level of is below . Since is the disjoint union of and , and every level of is at least , this holds if and only if consists of the lowest levels of .
Lemma 28. Let be an output string, with inner set . The leaves of order at least contributing to are exactly the leaves of the boxes in , the union over all with , and each of them is a leaf of exactly one of these boxes. Hence
a sum of products and values of boxes.
Proof. Every leaf of a box of agrees with the private leaf of outside , so it contributes to , and it chooses at most times, so its order is at least . Conversely, a leaf contributing to , of order at least , chooses at a set of at most levels, and as we saw above, it is a leaf of a box of if and only if , and then of exactly one such box. By Lemma 27, exactly one satisfies this condition. The desired equation follows, since is the sum of the products at the leaves contributing to . Finally, leaves of order contribute to , and there are sets with boxes each, i.e., boxes in all (as many as the leaves of order exactly contributing to , although they cover its leaves of every order from to ).
The data structure, in terms of the parameters
In this subsection, we assemble the boxes into our data structure and bound its costs in terms of the parameters , , and . We will then choose settings for the parameters in Section 4.4. We begin by recalling two notions from Section 2 that the data structure builds on.
The tiling of Section 2.3.4 cuts the product into tiles. A row block is consecutive rows of , a column block is consecutive columns of , and a tile is a band of consecutive row blocks together with a band of consecutive column blocks. One run of the recursion computes all block products of a tile at once, each as the product for its own subset . The encodings of Section 2.4.1 are the arrays of the numbers , one for each leaf , computed from the input array of a row band, and similarly the numbers computed from the input array of a column band. We compute an encoding once per band and share it among all the tiles that use that band, and the product at a leaf of a tile is the product of its two encoded numbers.
Our data structure consists of three components:
the list of the subsets assigned to the block products of a tile (recall that this list is the same for every tile),
the encodings of all row bands and all column bands, and
for every tile, the values of all its boxes (the boxes are the same strings in every tile, but their values depend on the input arrays of the tile).
To answer a query for an entry , the data structure performs the following three steps:
Find the tile that contains , the subset of its block product, and the output string of .
Add up the products at the leaves of order below contributing to , by reading the two factors of each product from the encodings of the tile.
Add to this the values of the boxes of , which are stored for the tile.
By Lemma 28, the result is . We will give the details of the query, as well as the preprocessing, in the proof of Theorem 30 below.
The encodings are indexed by the leaves (Section 2.4.1), and for each tile we store its boxes, with their values, in a standard trie on their strings of symbols. Thus reading the product at a leaf, or looking up or inserting a box, takes operations.
We will next show that there are at most times as many boxes as there are leaves of order at least , and that the dynamic program described in the technique overview computes their values (a box with stars being the sum of ten boxes with stars).
Lemma 29. There are at most boxes. Given the two encodings of a tile, we can compute the values of all these boxes, and store them in the trie for that tile, in time and space per box.
Proof. The count. A box in which of the symbols are or stars is obtained from a leaf of order (namely the leaf we get by replacing its stars with ) by turning the lowest symbols of that leaf into stars, for some . Thus, such a box can be specified by choosing the levels of these symbols, the number , and a term other than at each of the other levels. There are hence such boxes, and summing over gives the upper bound on the number of boxes.
The values. We compute the values of the boxes in increasing order of their number of stars. The boxes without stars are the leaves with at most symbols , and the value of each of them is the product of its two numbers in the encodings.
For a box with stars, let be the highest level at which has a star. The leaves of are the leaves of the ten strings obtained by replacing that star by a term , and each of these strings is again a box, with stars. Indeed, if , then the number of symbols that are or stars stays the same, and the new at level is above all the remaining stars. If is any other term, then that number decreases by one, and every star is still below every . Thus conditions (i) and (ii) in the definition of a box hold in both cases. (We expand the highest star because replacing a lower star by would leave a star above a , which is not a box.) Hence we compute
with ten lookups in the trie, in operations. Generating the boxes with stars and inserting them into the trie also takes operations per box, and adds at most vertices per box.
See Figure 7 for an illustration of these counts (in that figure, the switching order is set to ). At every order , the pruned recursion of Section 2.4 visits at most leaves of order in a tile whose wanted output strings form the set (see the proof of Lemma 11), the smaller of the two bounds at that order. The data structure cannot do this, since is not known in advance. Instead, a query computes products at every order , and looks up boxes at the order . The data structure also stores at most boxes per tile, even if they are not used by a query. The preprocessing time is therefore dominated by the sum , and hence by how fast the decay. Let
which is less than 1 since . It plays the role of in (5): for ,
The closer the ratio is to 10, the closer is to 1, and the more boxes the preprocessing has to compute. This is one side of the trade-off mentioned at the beginning of this section between the time savings and how thin the product must be.
We can now bound the costs. The theorem below assumes that . Since a tile spans rows and as many columns of the product , this ensures that a tile fits inside , so padding to a multiple of at most doubles it. We checked the same requirement in Section 2.4.4, where it was the first of the two consequences of . Here it will also follow, in Section 4.4, from the requirement that computing the encodings takes at most time, since .
Theorem 30. Let , , , , and . Given as input matrices and , whose entries are integers of absolute value at most , we can preprocess them deterministically in time and space
After this, any single entry can be computed deterministically in time. In particular, for every set of positions of an matrix, the entries , , can be computed deterministically in time
The constants hidden in the depend only on the exponent in .
Proof. Preprocessing. We tile the product as in Section 2.3.4, padding to a multiple of , which at most doubles it since , and we store the subsets, in operations. We then form and encode the input arrays of all row bands and column bands, at most of them since . Each has at most nonzero entries, so we form it in operations, and its encoding takes operations (Section 2.4.1). This is the last term of (8). Finally, we compute the values of all the boxes of each of the at most tiles, where is the number of output entries of a tile. By Lemma 29, this takes time and space per tile, and by (7), which gives the first term.
Query. Given , we find its tile from the bands of row and column , the subset of its block product, and its output string (whose variables at the levels outside we read off the row and column of within the block product), all in operations (Section 2.4.4). We then compute as the sum in Lemma 28, which has two parts.
The first part is the sum of the products at the leaves of order below contributing to . Each of these leaves is obtained from the private leaf of , which has at every level of , by picking fewer than of those levels and replacing with one of the nine other terms at each of them. We enumerate them, and for each such leaf we look up its two numbers and in the encodings of the tile and multiply them. The second part is the sum of the values of the boxes of : for every with and every box of , we look up its value in the trie of the tile. In all, these are numbers, and we find each of them in operations, including forming its leaf or its box from the private leaf. Enumerating them also takes operations per number. By Section 2.4.4, the sum is . For a set , we ask queries, which gives (9).
Word size. As in Section 2.4.4, every number in an encoding is a sum of entries of the input array with coefficients , and every value we compute is a sum of at most products of two such numbers. Since and , we have , so, as in Section 2.4.4, all the values are in absolute value, and every integer we use has bits.
Choosing the parameters
We now choose the parameters in Theorem 30 and prove the results of Section 4.1. In other words, we do the arithmetic and bookkeeping to derive the explicit exponents from Theorem 30. We first do the calculation in full for a single choice of the parameters, and , which proves Corollary 26. We then say what changes for other choices, which gives Theorems 24 and 25 and the entries of Table 2.
Proof of Corollary 26. Setting up. Let , and pad the inner dimension to with zero columns of and zero rows of . This changes no entry of , and it changes by a factor less than 4, which only affects the constants. So from now on , and since the original was larger than , the assumption now reads . Let and . We will apply Theorem 30 with these parameters, and we will verify its condition below, in the step on the encodings.
Boxes. We have , so , and since , also , where . Hence the first term of (8) is .
Queries. A query reads numbers, and we bound this sum as in the proof of Lemma 11. Since for , and ,
where . Hence a query takes time.
Encodings. It remains to show that the last term of (8) is at most , and that . Both follow from
the first by rearranging, and the second because and . As in Section 2.4.4, we compare -th powers by comparing their bases. We have , , and , and the standard bound gives . Hence the left-hand side of (10) is at most , where
We now use the assumption . Its base is larger than by a factor of more than 1.63. Since , the inequality (10) therefore holds whenever , which is the case for all . (For , is bounded by a constant, and the corollary holds trivially.)
Conclusion. For , Theorem 30 thus applies. The preprocessing takes time and space, and a query takes time. Since and the exponents and are positive, we have and , which gives the bounds and of the corollary. The bound for a set follows by asking queries.
Other choices of the parameters. The numbers 21 and did not play a special role in this proof, and the same calculation works with and for any constants and $0<\theta<0.9$. This gives Corollary 31 below, which we use for the left half of Table 2, with the of the row and the that gives the of the column ( for $q=0.43). To state it, let be the entropy function (with natural logarithms), let
be the general form of the base above, and let
Corollary 31. Let and , let , and let
Given as input matrices and whose entries are integers of absolute value at most , where and , with as in (11), we can preprocess them deterministically in time and space, after which any single entry can be computed deterministically in time. The constants hidden in the depend on , , and .
Moreover, increases to as decreases to 10.
Proof. We repeat the proof of Corollary 26 with and . After the padding, the assumption now reads . For the boxes, gives . For the queries, the same calculation with in place of 8, where because , gives . For the encodings, the same bound on the binomial coefficient, , shows that the left-hand side of (10) is . As says that , the inequality (10) thus holds once exceeds a constant depending on , , and , and for smaller the corollary again holds trivially.
Finally, a direct calculation shows that for , increases with and tends to as decreases to 10, by the identity . Hence increases to .
Where comes from. The identity says that , the largest term of the binomial expansion of , is up to polynomial factors. So at a tile has output entries, as many as the recursion has leaves, and the encodings cost , which is below exactly when .
Proof of Theorem 24. Let and . Choose with (Corollary 31), and then small enough that and . This is possible since, as , the first expression tends to 0 and the second to . Corollary 31 with these and gives the theorem.
Proof of Theorem 25. Apply Theorem 24 with , and ask one query for each position of . As , this takes time, where .
With Corollary 31 in place of Theorem 24, the same argument gives explicit exponents, which we use for the right half of Table 2, with the at which . The of a row of the table is the smallest over its entries.
Corollary 32. Let , , , , , , , and be as in Corollary 31, and let . For every set of at most positions of an matrix, the entries , , can be computed deterministically in time
a saving of , up to logarithmic factors, over the size of the product.
Further reductions
This section presents the remaining algorithmic results of the introduction: directed unweighted APSP (Section 5.1), the real-valued versions of 3SUM, APSP, and Exact Triangle (Section 5.2), the weighted -Clique problems (Section 5.3), and the refutation of the rectangular hinted OMv conjectures of van den Brand, Nanongkai, and Saranurak [155] (Section 5.4). Each result but the last composes a known reduction with the algorithms of Sections 3 and 4; the last applies the data structure of Section 4 directly. We cite the reduction we use in each case and modify it only where our parameter regime requires it, saying what changes.
What we use. We recall the three results of Sections 3 and 4 that the reductions plug into.
Exact Triangle (Section 3.2) asks whether a complete tripartite graph with parts of vertices and integer edge weights of absolute value at most has a triangle of weight zero. Theorem 19 solves it deterministically in time, where and , and Theorem 22 derives from this a deterministic -time algorithm for the -product of two matrices with integer entries of absolute value .
Lop-AE-SparseTri and #Lop-AE-SparseTri (Definitions 13 and 14) are given a tripartite graph with parts and of vertices and a middle part of at most vertices, together with a set of query pairs , and ask for every query pair in whether and have a common neighbor in the middle part, or for the counting version, how many they have. Corollary 16 solves both deterministically in time when . Theorem 17 reduces Exact Triangle to Lop-AE-SparseTri deterministically by hashing the weights modulo a prime.
Corollary 26 is the data structure behind Corollary 16. Given and with and entries of absolute value , it preprocesses them deterministically in time, after which it computes any entry of in time. Section 5.2 applies it to matrices whose entries are not 0/1, and Section 5.4 uses its queries online.
The algorithms of Sections 5.1, 5.3, and 5.4 are deterministic. Those of Section 5.2 are randomized (Las Vegas), because the reductions of [?] that they use as black boxes are randomized.
Directed APSP with small integer weights
Let denote the exponent of multiplying an matrix by an matrix, and let be the solution of . Then , since , and by the bounds of [10]. Zwick’s algorithm [172] solves APSP in directed unweighted graphs in time, and the Directed Unweighted APSP hypothesis [66, ?, 82] asserts that no algorithm is polynomially faster. We refute this in Theorem 34.
We revisit Theorem 3.1 of Chan, Vassilevska Williams, and Xu [66], which is just a presentation of Zwick’s algorithm [172] as a reduction. Zwick’s algorithm is typically used in its randomized form because the proof is simple, so the reduction in [66] was stated in its randomized form. However, following an argument by Yuster and Zwick [171], Section 8, the reduction has a deterministic version as well:
Theorem 33 (Zwick’s algorithm as a deterministic reduction [172, 67]). If the -product of an matrix by an matrix, both with integer entries of absolute value at most , can be computed in time for a constant , then APSP in directed -vertex graphs with integer weights of absolute value polylog and no negative cycles can be solved in time for a constant that depends on and . If the algorithm for the product is deterministic, then so is the algorithm for APSP.
The randomized proof of [67] follows the randomized version of Zwick’s algorithm, which takes random samples of vertices to hit the long shortest paths, so the algorithm that it produces is randomized. Zwick [172], Sections 6 and 7 also gives a deterministic version of his algorithm, which constructs the hitting sets (his bridging sets) from witnesses of the products by a greedy hitting-set computation, within the same running time up to polylogarithmic factors, and Yuster and Zwick [170], Section 8 announce, without details, a faster deterministic construction of bridging sets for their distance oracle. Zwick’s construction lists a path with vertices for each of the pairs, which is more than the reduction can afford when is large. We therefore give a deterministic version of the reduction, which lists only walks with an endpoint in the previous hitting set, in the spirit of [170]. We believe that this is likely what Yuster and Zwick [170] had in mind.
Proof of Theorem 33. The deterministic algorithm follows the randomized reduction, with two changes. It constructs the hitting sets deterministically, by a hierarchy of bridging sets in the manner of Zwick [172], Section 6, and it computes the distances that this construction needs only to and from small sets of vertices, like the distance oracle of Yuster and Zwick [170]. The hypothesized algorithm for the -product is used only for the values of its products. (This is convenient but not essential: the witness-finding method of Seidel [145] and Alon, Galil, Margalit, and Naor [15, 91], derandomized by Alon and Naor [24] and applied to -products by Zwick [172], Lemma 3.3, uses the product algorithm only on submatrices, so any deterministic algorithm for the product can be made to return witnesses at a polylogarithmic cost.) The price is a factor in the running time, for an arbitrarily small constant , which the polynomial saving of the hypothesis absorbs. Throughout, is the largest absolute weight, which is polylogarithmic, and hides polylogarithmic factors.
Bridges. For vertices and , let be the distance from to , and let be the smallest number of edges on a shortest path from to . Every subpath of a shortest path with the fewest edges is again a shortest path with the fewest edges. For a threshold and a constant , a set is a -bridge if every pair with has a shortest walk from to that passes through a vertex of and has at most edges. This is Zwick’s strong bridging set with a constant-factor slack in the number of edges, and with walks in place of paths because a shortest walk may run around zero-weight cycles. Let (so is tiny!) and for . We shall construct -bridges with , starting with and , where is a constant that depends only on . The slack grows by a constant factor from each level to the next. This is why the levels are a factor apart, so that there are only of them, rather than a factor apart as in Zwick’s algorithm.
The tables . The distances to and from small sets of vertices are computed by the following routine. Given the bridges , a set of target vertices, and a horizon with , the routine returns two tables, and , with three properties: every finite entry is the weight of a walk that the routine represents explicitly, as described next; every represented walk has edges, with a constant that depends on ; and the entry for is whenever . The products in the routine are computed with the deterministic -product algorithm with witnesses of [172], which finds the witnesses deterministically by the method of [24]. A witness of an entry of a product is an index at which its minimum is attained, and we store it with the entry. The walk that the entry represents is then the concatenation of the walks represented by the entries and of the two factors, and it is listed, when needed, by following the stored witnesses recursively down to the entries of the weight matrix, which represent single edges; this takes time, because the walk is a concatenation of such entries. For a product in which one dimension is and the other two are at most , with entries of absolute value at most , that algorithm takes time, by cutting the product into square products.
The routine for level takes the weight matrix with zeroes on the diagonal and squares it times, with the entries larger than replaced by , and keeps the rows and columns of . The routine for level first calls the routine for level with the target set and the horizon . This call is okay, because and . Let be the pair of tables that it returns; they have exact distances for the pairs with , and they have the entries of and . Let be the smallest power of two above , and set the diagonal of to zero. The routine computes, by repeated squaring,
where is the -product and the minimum is entrywise, and it computes symmetrically.
The entry for a pair with and is exact. To see this, take a shortest path from to with the fewest edges, and cut it into blocks of edges followed by a remainder of fewer than edges. Each block is a shortest path with the fewest edges between its endpoints, so the bridge property of replaces it by a shortest walk between the same endpoints that has at most edges and passes through a vertex of ; choose one such vertex in each block. The result is a shortest walk from to through at most chosen vertices of , in which , the chosen vertices, and are consecutively at most edges apart. The table is exact on these consecutive pairs, so the product above finds . The represented walks have edges, since those of have edges and at most of them are concatenated. Every product of the routine has one dimension , the two others , and entries , so it takes time, and the recursion has levels.
The stages. The algorithm maintains a matrix of distance estimates, initially the weight matrix with zeros on the diagonal, and runs one stage for each level until . The stage for level computes the tables , then the -product
and takes its entrywise minimum with the matrix of estimates. Then, if , it constructs from the walks represented in , as described below. The product fixes every pair with : by the bridge property of , gives with and , so both and are exact. The stages thus find all distances, and every estimate is the weight of a walk, so none is too small.
The cost of the stages. Let . The product of the stage for level has middle dimension and entries . Cutting into groups of vertices turns it into products of an matrix by an matrix with entries . Up to this grouping, these are the products of the randomized reduction, and the analysis of [66] applies to them. Fix a small constant . When , the middle dimension has , and fast rectangular matrix multiplication computes the product in time [172], for a constant , by the convexity of , since and . When , the naive algorithm computes it in time. In between, the middle dimension is at most and the entries are ; we cut the middle dimension into at most pieces of columns and pad each piece to an instance with rows, so that its entries fit the range of the hypothesis, and the hypothesized algorithm computes it in time. With small enough, the product of every stage takes time, for a constant that depends on and .
The next bridge. Let . The bridge is read off the walks represented in , and this is where the small target set pays off. These are walks with edges each, so listing them all takes time, whereas listing a path for every pair of vertices, as Zwick’s construction does, would take time, which exceeds our budget at the large scales. From each listed walk, erase the cycles, and keep the resulting path if it has at least edges. Let be a greedy hitting set of the vertex sets of the kept paths, each of which has more than vertices. It has vertices by the analysis of the greedy heuristic [122, 56], and it is computed in time linear in the total size of the sets, up to a logarithmic factor.
This is an -bridge for a constant that depends only on . Consider first a pair with . The bridge gives with and , so the entries of for and are exact, and the two walks that represent them are shortest walks. A cycle on a shortest walk has weight zero, so the two paths obtained by erasing the cycles are still shortest, and their concatenation is a shortest walk from to with edges. This walk has at least edges, since otherwise erasing its cycles would give a shortest path from to with fewer than edges. So one of the two paths has at least edges and was kept, and contains one of its vertices, which lies on the concatenated walk. For a pair with , apply this to the first edges of a shortest path from to with the fewest edges, and keep the rest of that path; the walk obtained has at most edges.
Running time. There are stages. Each computes its tables in time, its product in time, and its bridge in time. Choosing smaller than both and gives the running time for a constant , and every step is deterministic.
We compose the known reduction with the deterministic -product algorithm of Theorem 22.
Theorem 34 (Directed unweighted APSP). There is a constant such that APSP in directed unweighted -vertex graphs, and more generally in directed -vertex graphs with integer weights of absolute value at most and no negative cycles, for any constant , can be solved in time by a deterministic algorithm.
Proof. Cut the matrix into blocks of consecutive rows, and the matrix into blocks of consecutive columns. The -product then consists of products of two matrices, one for each pair of blocks. Their entries have absolute value , because , so Theorem 22 computes each of them in time, and all of them in time. This is for any constant , so [8] applies, in the deterministic form of Theorem 33, since the algorithm of Theorem 22 is deterministic.
3SUM, APSP, and Exact Triangle with real inputs
Theorem 35 (Real inputs). In the real RAM in which the only operations allowed on real numbers are comparisons, additions, and subtractions, Las Vegas algorithms solve the following problems on real inputs: 3SUM on numbers in expected time, and the -product of two matrices, APSP with no negative cycles, and Exact Triangle in expected time. The bounds also hold with probability for any constant .
The reductions are by Chan, Vassilevska Williams, and Xu [?], who reduce the real-valued problems to the counting version of All-Edges Sparse Triangle on graphs with edges (and real APSP also to the Boolean version). Our version of All-Edges Sparse Triangle in Corollary 16 needs lopsided sparse graphs. To deal with this slight change, we follow the reductions of [?] down to the point where the All-Edges Sparse Triangle oracle is called, and change the call. At that point, the reductions only need the oracle to compute comparison counts, which we define next. These come from Fredman’s trick [87]: if and only if . This turns a comparison of two sums into a comparison of a number that depends only on the row against a number that depends only on the column.
We first define comparison counts, then restate the reductions of [?] as reductions to comparison counts (Lemma 36), and then solve the comparison counts problem: following [?], Lemma 37 reduces it to the wanted entries of one thin matrix product using Matoušek’s technique for the dominance product [129], and Corollary 38 applies Corollary 26 to that product. The proof of Theorem 35 then adds up the running times. The only randomized steps are in the reductions of [?], and the algorithms never output a wrong answer, so they are Las Vegas.
Comparison counts. We are given row lists: for every , a list of at most real numbers , where each has a color associated with it.
Similarly, we are given column lists: for every , a list of at most real numbers , each again with a color associated with it.
Given a set of (row, column) pairs, we want, for every , the number
The reductions. We follow the reductions of [?] down to their two counting problems [?], Problems 4.1 and 4.5, which we define in the proof of Lemma 36 below, and turn every call of a counting problem into comparison counts, in place of the triangle-counting instances of [?], Lemmas 4.3 and 4.7. Throughout, is a parameter, which the proof of Theorem 35 chooses.
Lemma 36 (after Chan, Vassilevska Williams, and Xu [?]). Let .
(a) The -product of two real matrices, APSP with real edge weights and no negative cycles on vertices, and Exact Triangle with real weights on vertices reduce, with Las Vegas randomization, to counting calls and further time. A counting call consists of comparison counts, each with row lists and column lists of at most numbers, with at most one number of each color in a list, and with pair sets satisfying ; forming its lists costs subtractions.
(b) SUM on real numbers reduces, with Las Vegas randomization, to polylogarithmically many comparison counts, each with row lists and column lists of at most numbers, all of the same color, and a pair set of size , and further time; forming the lists of a comparison count costs subtractions.
A comparison count may have in place of . The only operations on real numbers performed by the reductions are comparisons, additions, and subtractions.
Proof. (a) -product, APSP, and Exact Triangle. Let . As in [67], Section 3.2, cut into blocks of consecutive columns, and into the corresponding blocks of consecutive rows. For each pair we solve [67], Problem 3.2: find, for every , the predecessor and the successor of among the sums , where a sum equal to counts as its predecessor. For Exact Triangle, , , and , and there is a triangle of weight zero if and only if, in some block, some is its own predecessor. For the -product of and , we take every smaller than all the sums, for instance . Then the successor of in a block is the smallest sum of the block, and the product is the entrywise minimum over the blocks, which costs comparisons. APSP with real weights and no negative cycles can be computed by successive squaring of the weight matrix, performing such products.
Fix a pair . We solve the following counting problem [67], Problem 4.1: we are given a pivot for every and a subset , and we must count, for every , the indices with ; a call of the problem may also have in place of .
By Lemmas 3.4 and 4.2 of [67], the problem for one pair reduces, with Las Vegas randomization, to polylogarithmically many calls of the counting problem, and further time: Lemma 3.4 finds the predecessors and successors by a randomized search that repeatedly asks, for every , for a sum strictly between two given sums, and Lemma 4.2 finds these sums by counting, for each of the two given sums, the sums below it, and by sampling at random. Lemma 4.3 of [67] turns a call into triangle-counting instances; we turn it into comparison counts instead.
Following [67], we group the pairs by their pivot, . For , let the row list consist of the numbers , , each with color , and let the column list consist of the numbers , , again with color .
By Fredman’s trick, if and only if , where both numbers in the latter comparison have color .
Thus the count of a pair is the comparison count of these lists with . Forming the lists costs us subtractions for each . Over the pairs , and the products in the case of APSP, this gives counting calls and additional time, which includes the comparisons of the entrywise minimum.
(b) 3SUM. Let be sets of reals, the problem asks whether for some , , and . The 3SUM version with one set and reduces to this version in the standard way.
Now, sort and , and cut them into consecutive blocks and of numbers each, writing for the -th number of . Here the counting problem [67] is the following: we are given a set of quadruples , and we must count, for every , the pairs with ; again, a call may have in place of , and it may restrict and to subsets of . By Section 3.3 and Lemmas 3.9 and 4.6 of [67], 3SUM reduces, with Las Vegas randomization, to polylogarithmically many calls of this counting problem, and additional time. By Fredman’s trick, the condition is . So a call is one comparison count: the rows are the pairs and the columns are the pairs , the row list consists of the numbers , , the column list of the numbers , , all numbers have the same color, and . A restriction of or of deletes numbers from the lists. Forming the lists can be done using subtractions.
Solving comparison counts. In the comparison counts of Lemma 36(a), every list has at most one number of each color, so that is the number of colors with , where is the number of color in and the one in (a color missing from either list is skipped); this is the dominance product of the matrix and the matrix at the positions in . In those of Lemma 36(b), all numbers have the same color, and is the number of pairs between the two lists. Merging the two sorted lists of every pair in takes time. To improve on this, we utilize Matoušek’s technique for the dominance product [129], which counts the pairs that lie in different blocks of the sorted order by one thin matrix product, and the pairs in the same block directly.
Lemma 37 (after Matoušek [129]). Let be an integer and . Given row lists and column lists as above and a set , we can build matrices and and compute integers , , with
deterministically in time. The only operations on real numbers are the comparisons made when sorting the numbers of each color. The same holds with in place of in the definition of .
Proof. For each color , sort the numbers of color of all the lists, and break ties so that, among equal numbers, those from column lists precede those from row lists. Let be the position of in this order. For from a row list and from a column list of the same color, holds if and only if . (For , we reverse the tie-breaking rule.) Cut the order into blocks of consecutive positions, and let . Then holds if and only if either , or and . As in Matoušek’s algorithm, we count the pairs of the first kind, which lie in different blocks, by a matrix product, and the pairs of the second kind, which lie in the same block, by brute force.
Different blocks. The lists contain at most numbers in all, so there are at most pairs (color, block), and we index the columns of and the rows of by these pairs, padding with zeros if needed. Let be the number of numbers of color in that lie in block , and let be the number of numbers of color in that lie in a block after . Then is the number of pairs of the same color with , as required, and the entries of and are between 0 and because a list has at most numbers. We use comparisons to sort and then fill in and in time.
Same block. For every color and block , let be the numbers of row lists in the block, each with its row, and let be the numbers of column lists in the block, each with its column, so that . For every with whose row and column form a pair (this can be tested via a binary search in after it is sorted), we add 1 to . Then counts the pairs of the second kind. Since and there are at most blocks, we enumerate at most pairs . Together with sorting and outputting the integers , this takes time.
Corollary 38. Let , and let be larger than a suitable constant. Given row lists and column lists as above and a set , the counts , , with or with , can be computed deterministically in
time, by an algorithm whose only operations on real numbers are comparisons.
Proof. Apply Lemma 37 with , so that , and pad the product to the inner dimension with zero columns of and zero rows of . Since , we have , so , and Corollary 26 with and computes for all deterministically in time. Here and .
Since , and , the time of Lemma 37 itself is
Proof of Theorem 35. Let , apply Lemma 36 with this , and answer every comparison count by Corollary 38.
-product, APSP, and Exact Triangle. By Corollary 38, the comparison counts of a counting call cost
since , , and ; forming the lists costs . So the counting calls of Lemma 36(a) cost
expected time, and its additional time is .
3SUM. By Corollary 38, a comparison count of Lemma 36(b) costs
so 3SUM can also be solved in expected time.
Las Vegas, and high probability. The reductions of [67] never return a wrong answer and Corollary 38 is deterministic, so the output is always correct, and only the running time is random. The bounds also hold with probability for any constant : we stop a run that exceeds twice the bound on its expected time and start again, and runs all fail with probability at most .
Zero-Weight, Min-Weight, and Max-Weight -Clique
The classical reduction of Nešetřil and Poljak [132] from -Clique to triangle detection turns the weighted -Clique problems into Exact Triangle instances with vertices per part (after fixing vertices when ), so Theorem 19 gives:
Corollary 39 (Weighted -Clique). Let and be constants. Given a complete -partite graph with parts of vertices and integer edge weights of absolute value at most , deterministic algorithms decide in time whether some -clique, with one vertex in each part, has total edge weight zero, and find a -clique of minimum, or of maximum, total edge weight.
Proof. We apply the classical reduction from -Clique to triangle detection of Nešetřil and Poljak [132]. When is divisible by 3, the reduction is simple. Split the parts into three groups of parts each, and build a tripartite graph whose vertices in the th part (for ) are the -cliques of the original graph with one vertex in each part of the th group, with an edge between two such cliques when together they form a -clique. Since the original graph is complete -partite, every choice of one vertex from each part of a group is a -clique, and any two such cliques from different groups form a -clique, so is simply the complete tripartite graph with vertices per part. The triangles of correspond bijectively to the -cliques of the original graph with one vertex in each part.
When is not divisible by 3, let . We enumerate the ways of fixing one vertex in each of the first parts, and for each of them we build as above from the remaining parts; now the triangles of correspond to the -cliques through the fixed vertices. In both cases has vertices per part, and we index its parts by .
We give edge weights so that a triangle and its -clique have the same weight. Let be a vertex of in part and a vertex in part . The weight of the edge of is the total weight of the edges of the original graph between a vertex of and a vertex of , of the edges inside , of the edges between and the fixed vertices, and, if and , of the edge between the two fixed vertices. The edges inside and the edges between and the fixed vertices are not counted here; they are counted in the edge from to part . In this way every edge of a -clique is counted exactly once over the three edges of its triangle, so there is no double-counting and the weights agree. The weight of an edge of has absolute value at most for .
Theorem 19 decides whether has a triangle of weight zero in time, with the constants of that theorem. By [158], Theorem 3.3, finding a maximum weight triangle costs times as much, and a minimum weight triangle is a maximum weight triangle for the negated weights. Since , the logarithmic factors are absorbed, so each graph costs time, and the graphs together cost .
Consequently, the Zero-Weight, Min-Weight, and Max-Weight -Clique hypotheses [21], [125, 36] with polynomially bounded weights are refuted, also on general graphs, by the standard reduction to the complete -partite form.
Three conjectures of van den Brand, Nanongkai, and Saranurak
Van den Brand, Nanongkai, and Saranurak [155] propose three “hinted” variants of the Online Matrix–Vector conjecture [100], which they use to prove matching lower bounds for the running times of their dynamic matrix inverse algorithms. All three are over the Boolean semiring, allow polynomial preprocessing time in the first phase, and have parameters and for constants . We write for the exponent of multiplying an matrix by an matrix. Each conjecture asserts that no algorithm simultaneously beats all of its listed bounds, for any .
-hinted Mv (Definition 5.1 and Conjecture 5.2 of [155]). Phase 1: an matrix . Phase 2: a matrix . Phase 3: an index , after which the algorithm outputs , the product of and column of . Bounds conjectured to be impossible to achieve simultaneously: for Phase 2 and for Phase 3.
-hinted Mv (Definition 5.6 and Conjecture 5.7 of [155]). Phase 1: and . Phase 2: a vector of column indices. Phase 3: an index , after which the algorithm outputs , where is the matrix whose -th column is column of . Bounds conjectured to be impossible to achieve simultaneously: for Phase 2 and for Phase 3.
-hinted (Definition 5.11 and Conjecture 5.12 of [155]). Phase 1: , , and . Phase 2: . Phase 3: . Phase 4: indices and , after which the algorithm outputs , where is the submatrix of with the rows and the columns . Bounds conjectured to be impossible to achieve simultaneously: for Phase 2, for Phase 3, and for Phase 4.
The two obvious algorithms are to multiply everything out with fast matrix multiplication as soon as the hint arrives, or to wait and compute one matrix–vector product at the end, and the conjectures say that no algorithm is polynomially faster than both of these. The main lower bounds of [155], for dynamic matrix inverse with column updates and row queries and with element updates and element queries, use the conjectures at and at , where they match the algorithms of [155]. For thin hints, the conjectures are false, because the data structure of Corollary 26 is faster than both obvious algorithms.
Corollary 40 (Hinted OMv). Conjectures 5.2 and 5.7 of [155] fail for every : Phase 2 takes time and Phase 3 takes time. Conjecture 5.12 fails for every : Phase 3 takes time and Phase 4 takes *time, with polynomial Phase 1 and a Phase 2 that only stores .
More generally, Conjectures 5.2 and 5.7 fail for every , and Conjecture 5.12 fails for every . In each case the phases beat the conjectured bounds whatever the value of , since and because of the input and output sizes.
Proof. We compute over with matrices; a Boolean entry is 1 exactly when the corresponding integer entry is positive. Let be the inner dimension. For we have , so Corollary 26 applies with .
Conjecture 5.2 of [155]. In Phase 2, we preprocess and by Corollary 26, in time. In Phase 3, the entries of column of are queries, which take time.
Conjecture 5.7 of [155]. The proof is the same, with and , which are both known in Phase 2 ( may have repeated columns, which do not affect the argument). Phase 1 only reads its input.
Conjecture 5.12 of [155]. Let , an matrix, and , a matrix, which are both known in Phase 3, with the inner dimension . Cut the rows of into blocks of rows, and preprocess each of the products of a block with , which are products of a matrix by a matrix, by Corollary 26. It applies because when . So Phase 3 costs time. In Phase 4, is a sum of at most entries of , which are queries and take time. Phase 2 only stores .
General . Let , and fix with . By Corollary 31, with and chosen as in the proof of Theorem 24 for , there is, after absorbing the logarithmic factors, a such that, since , the arguments above go through with Phase 2 in time and Phase 3 in time. For Conjecture 5.12, we use the same blocks, which requires , that is, for some .
We conclude this section by discussing which results of [155] rely on the conjectures in the refuted regime. From Conjectures 5.2 and 5.7, [155] derive trade-offs between the worst-case update time and query time of dynamic algorithms, for every : either or . These trade-offs cover the dynamic matrix product, inverse, and adjoint problems with column updates and row queries (Theorem 5.3 and Corollary 5.5 in [155]) or with element updates and row queries (Theorem 5.8 and Corollary 5.9 in [155]), and dynamic transitive closure and DAG path counting with vertex or edge updates and source queries (Corollaries 5.4 and 5.10 in [155]). For element or pair queries, the condition becomes (Corollaries 5.9 and 5.10 in [155]).
The main bounds, such as for column updates and row queries, balance the two terms at . For this setting, the current best upper bound on is strictly greater than 2, so the products are far from thin enough for our construction, and these bounds are still supported by the unrefuted forms of the conjectures. The same holds for the bounds from Conjecture 5.12 in [155], such as for dynamic determinant, rank, and bipartite perfect matching (Corollaries 5.15 and 5.16 in [155]), since Corollary 40 refutes Conjecture 5.12 in [155] only for , far from the at which these bounds are proved.
For , however, where , the trade-offs say that an update requires time unless a row or source query takes time, or, in the versions with element or pair queries, unless such a query takes time; Corollary 40 refutes the forms of the conjectures that would imply these trade-offs. This is the end of the trade-offs with the fastest queries, where they match the algorithms of [141], [155], such as element updates in time with element queries in time [141], Theorem 3]. For small , these algorithms are no longer known to be conditionally optimal.
The same goes for results that rely on this end of the trade-offs. Haeupler, Long, and Saranurak [101] cite Corollary 5.10 of [155] as showing that incremental and decremental distance oracles with approximation factor below cannot have worst-case update time and query time . With queries this fast, ruling out update time needs Conjecture 5.7 of [155] for some , so new evidence of hardness would be needed for , although the remaining cases of the conjecture still rule out update time . Van den Brand, Song, and Zhou [156] show that their data structure for dynamic attention, with amortized update time , is conditionally optimal for every under a variant of Conjecture 5.7 of [155] in which Phase 2 gives a matrix with at most nonzero entries instead of the vector . Our proof applies to this variant as well, since after Phase 2 the product again has inner dimension at most , so this lower bound needs a new hypothesis for .
Conclusion
We believe our results open exciting research directions in both algorithm design and complexity theory, and we highlight a few here.
Fine-grained complexity. An important message from our paper is that the fine-grained reductions that FGC has built up are incredibly valuable, and that it is even more important to design more reductions to enable further algorithm design and improved conditional hardness.
Which hypotheses should take the place of 3SUM and APSP? As discussed in the introduction, one possibility is to restrict these hypotheses to combinatorial algorithms [157, 154, 26], motivated by the search for more practical algorithms or practical hardness. Another possibility is the hypothesis that the balanced case of All-Edges Sparse Triangle, with edges, needs time. Our algorithms do not speed up this balanced case, and since it is the target of several lower-bound reductions from 3SUM and Exact Triangle [136, 116, 160, 71], the hypothesis still gives many problems evidence of hardness. Is it possible that the lopsided version has a faster algorithm but the balanced version does not?
More broadly, the complexity of the many problems that are only known to be 3SUM-hard or APSP-hard, rather than equivalent to 3SUM or APSP, is now open (the gray boxes of Figure 1); we get no faster algorithms for them, since the reductions go the other way. For instance, can one decide in truly subquadratic time whether points in the plane contain three on a line [92]? As far as we know, the fastest known running time is still , without even any polylogarithmic improvements. A similar question arises for the hypotheses that our results say nothing about, such as -SUM for , 3SUM-Indexing, OMv (without hints), and Orthogonal Vectors. Do ideas like ours help to speed up algorithms for any of them?
Our new technique gives a way to deal with sparsity, at least in lopsided instances. Much work has gone into algorithms for sparse matrix multiplication [171, 25, 137, 2, 38, 82, 95]. However, our techniques do not seem to give new algorithms for sparse matrix multiplication. Is improving upon the known algorithms for this problem hard, or is there another technique that could help here? This question is related to the balanced version of All-Edges Sparse Triangle.
What are the true exponents of 3SUM, APSP, and the many other problems of Figure 1 that now have faster algorithms? Our exponents can certainly be improved, and one place to gain is the reductions. Each of our algorithms composes known reductions with the matrix theorem, and many reductions lose a constant fraction of the saving in the exponent. For instance, the reduction from Exact Triangle to Lopsided All-Edges Sparse Triangle keeps only half of the saving in the exponent, and the reductions from 3SUM and APSP to Exact Triangle keep a half and a third (Section 3). These reductions, like most fine-grained reductions, were designed to prove hardness, where it only matters that they keep some polynomial saving. Now that they are being used as algorithms, how much they keep is more important. Which of them can be improved? Are there more efficient reductions from all these different problems to Lopsided All-Edges Sparse Triangle, or to thin matrix products themselves, that skip the intermediate problems?10
Some of these losses cannot be removed by reductions alone. Sheffield, Vassilevska Williams, and Xi [149] show that the loss of a third in the reduction from the all-edges version of a triangle problem to its detection version [157, 159] is optimal for black-box reductions, those that work for every relation on the three edge weights at once, so a tighter reduction must use the structure of the particular problem. The loss can still be avoided on the algorithmic side, as in the footnote: our algorithm for Exact Triangle solves the all-edges version at no extra cost, as all known algorithms for triangle problems do [149]. Our reductions are not black-box in this sense either: the reduction from Exact Triangle to Lopsided All-Edges Sparse Triangle hashes the weights modulo a prime, which uses the additive structure of the problem, so the barriers of [149] say nothing against improving the half that it loses. The same paper also gives new black-box reductions among triangle, listing, and matrix problems, and such reductions are now of algorithmic interest as well.
Beyond the reductions, all of our algorithms use the same matrix theorem, and a different technique might give improvements such as better exponents, combinatorial or practical algorithms, or algorithms for All-Edges Sparse Triangle with a middle part larger than , such as the that arises in an approach to girth approximation [139].
Algebraic algorithm design. Any improvement to the matrix theorem carries over to all the other speedups we achieve here. We do not know the true complexity of computing a set of entries of a thin product , as a function of and . In particular, to handle , one could look for new base identities that compute longer inner products per multiplication than Schönhage’s, perhaps by computer search [84, 114, 134], or ask whether other known identities, such as border rank expressions for the Coppersmith–Winograd tensor [69], which underlie the current bounds on and [161, 10, 72], can be used in the same way. It is not immediately clear how to make use of other tensors, since our analysis uses specific properties of Schönhage’s identity, such as its sparsity and the way the leaves of its recursion are shared among the output entries (Section 2.4). If other tensors cannot be used in this way, it would be interesting to understand why. For instance, even if the rank or border rank of a tensor is known, it might be that we need to find different rank or border rank expressions to use, similar to work on improving leading constants of matrix multiplication algorithms (see, e.g., [36, 118, 33, 31, 131]).
Acknowledgments and Methodology
How the result was originally found and shared with the authors. An Anthropic employee used an internal research model to investigate open problems in the theory of cryptography. One of them was about cryptographic constructions based on the average-case hardness of Zero--Clique [121, 20]. Claude was tasked with verifying and improving the constructions, but instead developed this algorithm, first for the average case, then for the worst case. The session used 16M output tokens with no human input.
Anthropic shared the algorithm with the authors in September 2026 under a confidentiality agreement, offered compensation, and provided access to the public version of Claude.
Shared algorithm. The algorithm that was shared with the authors is essentially the algorithm in Section 2, although presented differently and with other numerical parameters. A different reduction from Exact Triangle to the problem of Section 2 was also shared, although the authors did not include it here, and instead used known reductions to All-Edges Sparse Triangle, which suffice and strengthen the connection. The authors derived the data structure version in Section 4 and its connection with Hinted OMv.
Lean certification. After the paper was completely written, Anthropic used an internal research model to certify this paper’s main results using the Lean 4 proof assistant with the Mathlib library. The formalization is available at https://github.com/anthropics/formal-math/tree/main/3sum-apsp. The following are formalized there: Theorem 19 (Exact Triangle in time), Theorem 22 (3SUM in time, and the -product and APSP in time), and the Zero-Weight case of Corollary 39 (Zero-Weight -Clique in time for every ). All lemmas and prior results that these statements rely on are also formalized there.
Further acknowledgments. The authors used Claude to help with writing, figure creation, and checking mathematical details throughout this project. They have attempted to make the entire paper accessible and well-written, and take full responsibility for its contents.
The authors’ contribution to this publication was done in their individual capacities, not in connection with their duties or responsibilities to Columbia University or to MIT. Any opinions expressed in this work are opinions of the authors; they are not official positions or endorsements of Columbia University or of MIT, and do not represent the research of the authors at Columbia University or MIT.
References
- [1][ABF23] Amir Abboud, Karl Bringmann, and Nick Fischer. Stronger 3-SUM lower bounds for approximate distance oracles via additive combinatorics. In Proc. 55th ACM Symposium on Theory of Computing (STOC 2023), pages 391–404, 2023.
- [2][ABFK24] Amir Abboud, Karl Bringmann, Nick Fischer, and Marvin Künnemann. The time complexity of fully sparse matrix multiplication. In Proc. 35th ACM-SIAM Symposium on Discrete Algorithms (SODA 2024), pages 4670–4703, 2024.arxiv.org/abs/2309.06317
- [3]Amir Abboud, Karl Bringmann, Seri Khoury, and Or Zamir. Hardness of approximation in P via short cycle removal: Cycle detection, distance oracles, and beyond. In Proc. 54th ACM Symposium on Theory of Computing (STOC 2022), pages 1487–1500, 2022. Full version: arXiv:2204.10465.arxiv.org/abs/2204.10465
- [4]Nir Ailon and Bernard Chazelle. Lower bounds for linear degeneracy testing. Journal of the ACM, 52(2):157–171, 2005.
- [6]Amihood Amir, Timothy M. Chan, Moshe Lewenstein, and Noa Lewenstein. On hardness of jumbled indexing. In Proc. 41st International Colloquium on Automata, Languages, and Programming (ICALP 2014), volume 8572 of LNCS, pages 114–125, 2014.arxiv.org/abs/1405.0189
- [7]Josh Alman, Timothy M. Chan, and Ryan Williams. Polynomial representations of threshold functions and algorithmic applications. In Proc. 57th IEEE Symposium on Foundations of Computer Science (FOCS 2016), pages 467–476, 2016.arxiv.org/abs/1608.04355
- [8]Josh Alman, Timothy M. Chan, and R. Ryan Williams. Faster deterministic and Las Vegas algorithms for offline approximate nearest neighbors in high dimensions. In Proc. 31st ACM-SIAM Symposium on Discrete Algorithms (SODA 2020), pages 637–649, 2020.
- [9]Vladimir L. Arlazarov, Efim A. Dinic, Mikhail A. Kronrod, and Igor A. Faradžev. On economical construction of the transitive closure of an oriented graph. Soviet Mathematics Doklady, 11:1209–1210, 1970.
- [10]Josh Alman, Ran Duan, Virginia Vassilevska Williams, Yinzhan Xu, Zixuan Xu, and Renfei Zhou. More asymmetry yields faster matrix multiplication. In Proc. 36th ACM-SIAM Symposium on Discrete Algorithms (SODA 2025), pages 2005–2039, 2025.arxiv.org/abs/2404.16349
- [11]Amir Abboud, Nick Fischer, Zander Kelley, Shachar Lovett, and Raghu Meka. New graph decompositions and combinatorial Boolean matrix multiplication algorithms. In Proc. 56th ACM Symposium on Theory of Computing (STOC 2024), pages 935–943, 2024.arxiv.org/abs/2311.09095
- [12]Amir Abboud, Shon Feller, and Oren Weimann. On the fine-grained complexity of parity problems. In Proc. 47th International Colloquium on Automata, Languages, and Programming (ICALP 2020), volume 168 of LIPIcs, pages 5:1–5:19, 2020.arxiv.org/abs/2002.07415
- [13]Noga Alon, Oded Goldreich, Johan Håstad, and René Peralta. Simple constructions of almost k-wise independent random variables. Random Structures & Algorithms, 3(3):289–304, 1992.DOI
- [14]Noga Alon, Zvi Galil, and Oded Margalit. On the exponent of the all pairs shortest path problem. Journal of Computer and System Sciences, 54(2):255–262, 1997.DOI
- [15]Noga Alon, Zvi Galil, Oded Margalit, and Moni Naor. Witnesses for Boolean matrix multiplication and for shortest paths. In Proc. 33rd IEEE Symposium on Foundations of Computer Science (FOCS 1992), pages 417–426, 1992.DOI
- [16]Amir Abboud, Fabrizio Grandoni, and Virginia Vassilevska Williams. Subcubic equivalences between graph centrality problems, APSP and diameter. In Proc. 26th ACM-SIAM Symposium on Discrete Algorithms (SODA 2015), pages 1681–1697, 2015.
- [17]Amir Abboud, Fabrizio Grandoni, and Virginia Vassilevska Williams. Subcubic equivalences between graph centrality problems, APSP, and diameter. ACM Transactions on Algorithms, 19(1):3:1–3:30, 2023.
- [18]Boris Aronov and Sariel Har-Peled. On approximating the depth and related problems. SIAM Journal on Computing, 38(3):899–921, 2008.
- [19]Alfred V. Aho, John E. Hopcroft, and Jeffrey D. Ullman. The Design and Analysis of Computer Algorithms. Addison-Wesley, 1974.
- [20]Josh Alman, Yizhi Huang, and Kevin Yeo. Fine-grained complexity in a world without cryptography. In Advances in Cryptology – EUROCRYPT 2025, Part VII, volume 15607 of LNCS, pages 375–405, 2025.DOI
- [21]Amir Abboud and Kevin Lewi. Exact weight subgraphs and the k-sum conjecture. In Proc. 40th International Colloquium on Automata, Languages, and Programming (ICALP 2013), volume 7965 of LNCS, pages 1–12, 2013.arxiv.org/abs/1304.7558
- [22]Josh Alman and Baitian Li. Kronecker powers, orthogonal vectors, and the asymptotic spectrum. In Proc. 66th IEEE Symposium on Foundations of Computer Science (FOCS 2025), pages 1411–1441, 2025. arXiv:2509.14489.arxiv.org/abs/2509.14489
- [23]Amir Abboud, Kevin Lewi, and Ryan Williams. Losing weight by gaining edges. In Proc. 22nd European Symposium on Algorithms (ESA 2014), volume 8737 of LNCS, pages 1–12, 2014.arxiv.org/abs/1311.3054
- [24]Noga Alon and Moni Naor. Derandomization, witnesses for Boolean matrix multiplication and construction of perfect hash functions. Algorithmica, 16(4–5):434–449, 1996.
- [25]Rasmus Resen Amossen and Rasmus Pagh. Faster join-projects and sparse matrix multiplications. In Proc. 12th International Conference on Database Theory (ICDT 2009), pages 121–126, 2009.
- [26]Amir Abboud and Virginia Vassilevska Williams. Popular conjectures imply strong lower bounds for dynamic problems. In Proc. 55th IEEE Symposium on Foundations of Computer Science (FOCS 2014), pages 434–443, 2014.arxiv.org/abs/1402.0054
- [28]Amir Abboud, Virginia Vassilevska Williams, and Huacheng Yu. Matching triangles and basing hardness on an extremely popular conjecture. In Proc. 47th ACM Symposium on Theory of Computing (STOC 2015), pages 41–50, 2015.
- [29]Josh Alman and Ryan Williams. Probabilistic polynomials and Hamming nearest neighbors. In Proc. 56th IEEE Symposium on Foundations of Computer Science (FOCS 2015), pages 136–150, 2015.DOI
- [30]Amir Abboud, Ryan Williams, and Huacheng Yu. More applications of the polynomial method to algorithm design. In Proc. 26th ACM-SIAM Symposium on Discrete Algorithms (SODA 2015), pages 218–230, 2015.
- [31]Josh Alman and Hantao Yu. Improving the leading constant of matrix multiplication. In Proc. 36th ACM-SIAM Symposium on Discrete Algorithms (SODA 2025), pages 1933–1971, 2025.arxiv.org/abs/2410.20538
- [32]Noga Alon, Raphael Yuster, and Uri Zwick. Finding and counting given length cycles. Algorithmica, 17(3):209–223, 1997.
- [33]Austin R. Benson and Grey Ballard. A framework for practical parallel fast matrix multiplication. In Proc. 20th ACM SIGPLAN Symposium on Principles and Practice of Parallel Programming (PPoPP 2015), pages 42–53, 2015.
- [34]David Bremner, Timothy M. Chan, Erik D. Demaine, Jeff Erickson, Ferran Hurtado, John Iacono, Stefan Langerman, Mihai Pătrașcu, and Perouz Tasslakian. Necklaces, convolutions, and X + Y. Algorithmica, 69(2):294–314, 2014.
- [35]Ilya Baran, Erik D. Demaine, and Mihai Pătrașcu. Subquadratic algorithms for 3SUM. Algorithmica, 50(4):584–596, 2008.
- [36]Arturs Backurs, Nishanth Dikkala, and Christos Tzamos. Tight hardness results for maximum weight rectangles. In Proc. 43rd International Colloquium on Automata, Languages, and Programming (ICALP 2016), volume 55 of LIPIcs, pages 81:1–81:13, 2016.arxiv.org/abs/1602.05837
- [38]Huck Bennett, Karthik Gajulapalli, Alexander Golovnev, and Evelyn Warton. Output-sparse matrix multiplication using compressed sensing. In Approximation, Randomization, and Combinatorial Optimization. Algorithms and Techniques (APPROX/RANDOM 2026), volume 392 of LIPIcs, pages 40:1–40:20, 2026. Full version: arXiv:2508.10250.arxiv.org/abs/2508.10250
- [39]Karl Bringmann, Paweł Gawrychowski, Shay Mozes, and Oren Weimann. Tree edit distance cannot be computed in strongly subcubic time (unless APSP can). ACM Transactions on Algorithms, 16(4):48:1–48:22, 2020.
- [40]Andreas Björklund, Thore Husfeldt, Petteri Kaski, and Mikko Koivisto. Trimmed Moebius inversion and graphs of bounded degree. Theory of Computing Systems, 47(3):637–654, 2010.
- [42]Dario Bini. Relations between exact and approximate bilinear algorithms. Applications. Calcolo, 17:87–97, 1980.DOI
- [44]Karl Bringmann and Vasileios Nakos. A fine-grained perspective on approximating subset sum and partition. In Proc. 32nd ACM-SIAM Symposium on Discrete Algorithms (SODA 2021), pages 1797–1815, 2021.arxiv.org/abs/1912.12529
- [45]Karl Bringmann. Fine-grained complexity theory (tutorial). In Proc. 36th International Symposium on Theoretical Aspects of Computer Science (STACS 2019), volume 126 of LIPIcs, pages 4:1–4:7, 2019.DOI
- [46]Karl Bringmann. Knapsack with small items in near-quadratic time. In Proc. 56th ACM Symposium on Theory of Computing (STOC 2024), pages 259–270, 2024.arxiv.org/abs/2308.03075
- [50]Marco L. Carmosino, Jiawei Gao, Russell Impagliazzo, Ivan Mihajlin, Ramamohan Paturi, and Stefan Schneider. Nondeterministic extensions of the strong exponential time hypothesis and consequences for non-reducibility. In Proc. 7th ACM Conference on Innovations in Theoretical Computer Science (ITCS 2016), pages 261–270, 2016.
- [51]Timothy M. Chan and Qizheng He. Reducing 3SUM to convolution-3SUM. In Proc. 3rd SIAM Symposium on Simplicity in Algorithms (SOSA 2020), pages 1–7, 2020.DOI
- [52]Timothy M. Chan. All-pairs shortest paths with real weights in O(n³/log n) time. Algorithmica, 50(2):236–243, 2008. Preliminary version in WADS 2005.
- [53]Timothy M. Chan. More algorithms for all-pairs shortest paths in weighted graphs. SIAM Journal on Computing, 39(5):2075–2089, 2010.
- [54]Timothy M. Chan. Speeding up the four Russians algorithm by about one more logarithmic factor. In Proc. 26th ACM-SIAM Symposium on Discrete Algorithms (SODA 2015), pages 212–217, 2015.DOI
- [55]Timothy M. Chan. More logarithmic-factor speedups for 3SUM, (median,+)-convolution, and some geometric 3SUM-hard problems. ACM Transactions on Algorithms, 16(1):7:1–7:23, 2020.
- [56]Vašek Chvátal. A greedy heuristic for the set-covering problem. Mathematics of Operations Research, 4(3):233–235, 1979.DOI
- [59]Marek Cygan, Marcin Mucha, Karol Węgrzycki, and Michał Włodarczyk. On problems equivalent to (min,+)-convolution. ACM Transactions on Algorithms, 15(1):14:1–14:25, 2019.
- [60]Norishige Chiba and Takao Nishizeki. Arboricity and subgraph listing algorithms. SIAM Journal on Computing, 14(1):210–223, 1985.DOI
- [61]Stephen A. Cook. The complexity of theorem-proving procedures. In Proc. 3rd ACM Symposium on Theory of Computing (STOC 1971), pages 151–158, 1971.DOI
- [62]Don Coppersmith. Rapid multiplication of rectangular matrices. SIAM Journal on Computing, 11(3):467–471, 1982.DOI
- [63]Don Coppersmith. Rectangular matrix multiplication revisited. Journal of Complexity, 13(1):42–49, 1997.DOI
- [64]Hagai Cohen and Ely Porat. Fast set intersection and two-patterns matching. Theoretical Computer Science, 411(40–42):3795–3800, 2010.
- [65]James W. Cooley and John W. Tukey. An algorithm for the machine calculation of complex Fourier series. Mathematics of Computation, 19(90):297–301, 1965.
- [66]Timothy M. Chan, Virginia Vassilevska Williams, and Yinzhan Xu. Algorithms, reductions and equivalences for small weight variants of all-pairs shortest paths. In Proc. 48th International Colloquium on Automata, Languages, and Programming (ICALP 2021), volume 198 of LIPIcs, pages 47:1–47:21, 2021. Full version: arXiv:2102.06181, whose numbering we follow.arxiv.org/abs/2102.06181
- [67]Timothy M. Chan, Virginia Vassilevska Williams, and Yinzhan Xu. Hardness for triangle problems under even more believable hypotheses: Reductions from real APSP, real 3SUM, and OV. In Proc. 54th ACM Symposium on Theory of Computing (STOC 2022), pages 1501–1514, 2022. Full version: arXiv:2203.08356, whose numbering we follow.arxiv.org/abs/2203.08356
- [68]Timothy M. Chan, Virginia Vassilevska Williams, and Yinzhan Xu. Fredman’s trick meets dominance product: Fine-grained complexity of unweighted APSP, 3SUM counting, and more. In Proc. 55th ACM Symposium on Theory of Computing (STOC 2023), pages 419–432, 2023.arxiv.org/abs/2303.14572
- [69]Don Coppersmith and Shmuel Winograd. Matrix multiplication via arithmetic progressions. Journal of Symbolic Computation, 9(3):251–280, 1990.
- [71]Timothy M. Chan and Yinzhan Xu. Simpler reductions from exact triangle. In Proc. 7th SIAM Symposium on Simplicity in Algorithms (SOSA 2024), pages 28–38, 2024.arxiv.org/abs/2310.11575
- [72]Emilien Dupont, Marvin Eisenberger, Borislav Kozlovskii, Abbas Mehrabian, Francisco J. R. Ruiz, Abigail See, Renfei Zhou, Josh Alman, Virginia Vassilevska Williams, and Matej Balog. Improving the matrix multiplication exponent with modern optimization and AlphaEvolve. arXiv:2608.16884, 2026.arxiv.org/abs/2608.16884
- [73]Bartłomiej Dudek, Paweł Gawrychowski, and Tatiana Starikovskaya. All non-trivial variants of 3-LDT are equivalent. In Proc. 52nd ACM Symposium on Theory of Computing (STOC 2020), pages 974–981, 2020.DOI
- [74]Lech Duraj, Krzysztof Kleiner, Adam Polak, and Virginia Vassilevska Williams. Equivalences between triangle and range query problems. In Proc. 31st ACM-SIAM Symposium on Discrete Algorithms (SODA 2020), pages 30–47, 2020.DOI
- [75]Erik D. Demaine, Shay Mozes, Benjamin Rossman, and Oren Weimann. An optimal decomposition algorithm for tree edit distance. ACM Transactions on Algorithms, 6(1):2:1–2:19, 2009.
- [76]Włodzimierz Dobosiewicz. A more efficient algorithm for the min-plus multiplication. International Journal of Computer Mathematics, 32(1–2):49–60, 1990.DOI
- [77]Martin Dietzfelbinger, Philipp Schlag, and Stefan Walzer. A subquadratic algorithm for 3XOR. In Proc. 43rd International Symposium on Mathematical Foundations of Computer Science (MFCS 2018), volume 117 of LIPIcs, pages 59:1–59:15, 2018.arxiv.org/abs/1804.11086
- [79]Jeff Erickson. Lower bounds for linear satisfiability problems. Chicago Journal of Theoretical Computer Science, 1999(8), 1999.
- [82]Nick Fischer. Universe reduction for APSP: Equivalence of three fine-grained hypotheses. In Proc. 58th ACM Symposium on Theory of Computing (STOC 2026), pages 922–932, 2026.
- [83]Nick Fischer, Ce Jin, and Yinzhan Xu. New applications of 3SUM-counting in fine-grained complexity and pattern matching. In Proc. 36th ACM-SIAM Symposium on Discrete Algorithms (SODA 2025), pages 4547–4595, 2025.arxiv.org/abs/2410.20764
- [84]Nick Fischer, Piotr Kaliciak, and Adam Polak. Deterministic 3SUM-hardness. In Proc. 15th Innovations in Theoretical Computer Science Conference (ITCS 2024), volume 287 of LIPIcs, pages 49:1–49:24, 2024. Full version: arXiv:2310.12913, whose numbering we follow.arxiv.org/abs/2310.12913
- [85]Robert W. Floyd. Algorithm 97: Shortest path. Communications of the ACM, 5(6):345, 1962.DOI
- [87]Michael L. Fredman. New bounds on the complexity of the shortest path problem. SIAM Journal on Computing, 5(1):83–89, 1976.DOI
- [88]Alexander Golovnev, Siyao Guo, Thibaut Horel, Sunoo Park, and Vinod Vaikuntanathan. Data structures meet cryptography: 3SUM with preprocessing. In Proc. 52nd ACM Symposium on Theory of Computing (STOC 2020), pages 294–307, 2020.DOI
- [89]Isaac Goldstein, Tsvi Kopelowitz, Moshe Lewenstein, and Ely Porat. Conditional lower bounds for space/time tradeoffs. In Proc. 15th Algorithms and Data Structures Symposium (WADS 2017), volume 10389 of LNCS, pages 421–436, 2017.DOI
- [90]Isaac Goldstein, Moshe Lewenstein, and Ely Porat. On the hardness of set disjointness and set intersection with bounded universe. In Proc. 30th International Symposium on Algorithms and Computation (ISAAC 2019), volume 149 of LIPIcs, pages 7:1–7:22, 2019.arxiv.org/abs/1910.00831
- [91]Zvi Galil and Oded Margalit. Witnesses for Boolean matrix multiplication and for transitive closure. Journal of Complexity, 9(2):201–221, 1993.DOI
- [92]Anka Gajentaan and Mark H. Overmars. On a class of O(n²) problems in computational geometry. Computational Geometry: Theory and Applications, 5(3):165–185, 1995.
- [93]Irving J. Good. The interaction algorithm and practical Fourier analysis. Journal of the Royal Statistical Society, Series B, 20(2):361–372, 1958.
- [94]Allan Grønlund and Seth Pettie. Threesomes, degenerates, and love triangles. Journal of the ACM, 65(4):22:1–22:25, 2018.
- [95]Omar Graia. Optimal deterministic fully sparse matrix multiplication. arXiv:2608.18496, 2026.arxiv.org/abs/2608.18496
- [97]Yijie Han. Improved algorithm for all pairs shortest paths. Information Processing Letters, 91(5):245–250, 2004.DOI
- [98]Yijie Han. An O(n³(log log n/ log n)⁵⧸⁴) time algorithm for all pairs shortest path. Algorithmica, 51(4):428–434, 2008. Preliminary version in ESA 2006.DOI
- [99]Timon Hertli. 3-SAT faster and simpler—unique-SAT bounds for PPSZ hold in general. SIAM Journal on Computing, 43(2):718–729, 2014.
- [100]Monika Henzinger, Sebastian Krinninger, Danupon Nanongkai, and Thatchaphol Saranurak. Unifying and strengthening hardness for dynamic problems via the online matrix-vector multiplication conjecture. In Proc. 47th ACM Symposium on Theory of Computing (STOC 2015), pages 21–30, 2015.DOI
- [101]Bernhard Haeupler, Yaowei Long, and Thatchaphol Saranurak. Dynamic deterministic constant-approximate distance oracles with nᵋ worst-case update time. In Proc. 65th IEEE Symposium on Foundations of Computer Science (FOCS 2024), pages 2033–2044, 2024.
- [102]Yijie Han and Tadao Takaoka. An O(n³ log log n/ log² n) time algorithm for all pairs shortest paths. Journal of Discrete Algorithms, 38–41:9–19, 2016. Preliminary version in SWAT 2012.
- [103]Russell Impagliazzo and Ramamohan Paturi. On the complexity of k-SAT. Journal of Computer and System Sciences, 62(2):367–375, 2001.DOI
- [104]Russell Impagliazzo, Ramamohan Paturi, and Francis Zane. Which problems have strongly exponential complexity? Journal of Computer and System Sciences, 63(4):512–530, 2001.
- [105]Alon Itai and Michael Rodeh. Finding a minimum circuit in a graph. SIAM Journal on Computing, 7(4):413–423, 1978.
- [106]Ce Jin. 0-1 knapsack in nearly quadratic time. In Proc. 56th ACM Symposium on Theory of Computing (STOC 2024), pages 271–282, 2024.arxiv.org/abs/2308.04093
- [107]Donald B. Johnson. Efficient algorithms for shortest paths in sparse networks. Journal of the ACM, 24(1):1–13, 1977.DOI
- [108]Zahra Jafargoli and Emanuele Viola. 3SUM, 3XOR, triangles. Algorithmica, 74(1):326–343, 2016.
- [109]Ce Jin and Yinzhan Xu. Removing additive structure in 3SUM-based reductions. In Proc. 55th ACM Symposium on Theory of Computing (STOC 2023), pages 405–418, 2023.
- [110]Richard M. Karp. Reducibility among combinatorial problems. In Complexity of Computer Computations, pages 85–103. Plenum Press, 1972.
- [111]Leslie Robert Kerr. The Effect of Algebraic Structure on the Computational Complexity of Matrix Multiplication. PhD thesis, Cornell University, 1970.
- [113]Daniel M. Kane, Shachar Lovett, and Shay Moran. Near-optimal linear decision trees for k-SUM and related problems. Journal of the ACM, 66(3):16:1–16:18, 2019.
- [114]Manuel Kauers and Jakob Moosbauer. Flip graphs for matrix multiplication. In Proc. 48th International Symposium on Symbolic and Algebraic Computation (ISSAC 2023), pages 381–388, 2023.arxiv.org/abs/2212.01175
- [115]Tsvi Kopelowitz and Ely Porat. The strong 3SUM-INDEXING conjecture is false. arXiv:1907.11206, 2019.arxiv.org/abs/1907.11206
- [116]Tsvi Kopelowitz, Seth Pettie, and Ely Porat. Higher lower bounds from the 3SUM conjecture. In Proc. 27th ACM-SIAM Symposium on Discrete Algorithms (SODA 2016), pages 1272–1287, 2016.
- [118]Elaye Karstadt and Oded Schwartz. Matrix multiplication, a little faster. Journal of the ACM, 67(1):1:1–1:31, 2020. Preliminary version in SPAA 2017.
- [119]Tsvi Kopelowitz and Virginia Vassilevska Williams. Towards optimal set-disjointness and set-intersection data structures. In Proc. 47th International Colloquium on Automata, Languages, and Programming (ICALP 2020), volume 168 of LIPIcs, pages 74:1–74:16, 2020.
- [120]François Le Gall. Faster algorithms for rectangular matrix multiplication. In Proc. 53rd IEEE Symposium on Foundations of Computer Science (FOCS 2012), pages 514–523, 2012.DOI
- [121]Rio LaVigne, Andrea Lincoln, and Virginia Vassilevska Williams. Public-key cryptography in the fine-grained setting. In Advances in Cryptology – CRYPTO 2019, Part III, volume 11694 of LNCS, pages 605–635, 2019.DOI
- [122]László Lovász. On the ratio of optimal integral and fractional covers. Discrete Mathematics, 13(4):383–390, 1975.DOI
- [123]Andrea Lincoln, Adam Polak, and Virginia Vassilevska Williams. Monochromatic triangles, intermediate matrix products, and convolutions. In Proc. 11th Innovations in Theoretical Computer Science Conference (ITCS 2020), volume 151 of LIPIcs, pages 53:1–53:18, 2020. Full version: arXiv:2009.14479, whose statement of Theorem 8 we follow.DOI
- [124]François Le Gall and Florent Urrutia. Improved rectangular matrix multiplication using powers of the Coppersmith–Winograd tensor. In Proc. 29th ACM-SIAM Symposium on Discrete Algorithms (SODA 2018), pages 1029–1046, 2018.DOI
- [125]Andrea Lincoln, Virginia Vassilevska Williams, and R. Ryan Williams. Tight hardness for shortest cycles and paths in sparse graphs. In Proc. 29th ACM-SIAM Symposium on Discrete Algorithms (SODA 2018), pages 1236–1252, 2018.arxiv.org/abs/1712.08147
- [126]Andrea Lincoln, Virginia Vassilevska Williams, Joshua R. Wang, and R. Ryan Williams. Deterministic time-space trade-offs for k-SUM. In Proc. 43rd International Colloquium on Automata, Languages, and Programming (ICALP 2016), volume 55 of LIPIcs, pages 58:1–58:14, 2016.DOI
- [127]Xiao Mao. Breaking the cubic barrier for (unweighted) tree edit distance. In Proc. 62nd IEEE Symposium on Foundations of Computer Science (FOCS 2021), pages 792–803, 2021. Journal version: SIAM J. Comput., pp. FOCS21-195–FOCS21-223, 2023.arxiv.org/abs/2106.02026
- [128]John D. Markel. FFT pruning. IEEE Transactions on Audio and Electroacoustics, 19(4):305–311, 1971.DOI
- [129]Jiří Matoušek. Computing dominances in Eⁿ. Information Processing Letters, 38(5):277–278, 1991.DOI
- [130]Friedhelm Meyer auf der Heide. A polynomial linear search algorithm for the n-dimensional knapsack problem. Journal of the ACM, 31(3):668–676, 1984.
- [131]Erik Mårtensson and Paul Stankovski Wagner. The number of the beast: Reducing additions in fast matrix multiplication algorithms for dimensions up to 666. In Proc. SIAM Conference on Applied and Computational Discrete Algorithms (ACDA 2025), pages 47–60, 2025.DOI
- [132]Jaroslav Nešetřil and Svatopluk Poljak. On the complexity of the subgraph problem. Commentationes Mathematicae Universitatis Carolinae, 26(2):415–419, 1985.
- [133]Jakob Nogler, Adam Polak, Barna Saha, Virginia Vassilevska Williams, Yinzhan Xu, and Christopher Ye. Faster weighted and unweighted tree edit distance and APSP equivalence. In Proc. 57th ACM Symposium on Theory of Computing (STOC 2025), pages 2167–2178, 2025.arxiv.org/abs/2411.06502
- [134]Alexander Novikov, Ngân Vũ, Marvin Eisenberger, Emilien Dupont, Po-Sen Huang, Adam Zsolt Wagner, Sergey Shirobokov, Borislav Kozlovskii, Francisco J. R. Ruiz, Abbas Mehrabian, M. Pawan Kumar, Abigail See, Swarat Chaudhuri, George Holland, Alex Davies, Sebastian Nowozin, Pushmeet Kohli, and Matej Balog. AlphaEvolve: A coding agent for scientific and algorithmic discovery. arXiv:2506.13131, 2025.arxiv.org/abs/2506.13131
- [135]Mihai Pătraşcu. Towards polynomial lower bounds for dynamic problems. In Proc. 42nd ACM Symposium on Theory of Computing (STOC 2010), pages 603–610, 2010.DOI
- [136]Ramamohan Paturi, Pavel Pudlák, Michael E. Saks, and Francis Zane. An improved exponential-time algorithm for k-SAT. Journal of the ACM, 52(3):337–364, 2005.
- [137]Rasmus Pagh and Morten Stöckel. The input/output complexity of sparse matrix multiplication. In Proc. 22nd European Symposium on Algorithms (ESA 2014), volume 8737 of LNCS, pages 750–761, 2014.arxiv.org/abs/1403.3551
- [138]Liam Roditty and Virginia Vassilevska Williams. Minimum weight cycles and triangles: Equivalences and algorithms. In Proc. 52nd IEEE Symposium on Foundations of Computer Science (FOCS 2011), pages 180–189, 2011.
- [139]Liam Roditty and Virginia Vassilevska Williams. Subquadratic time approximation algorithms for the girth. In Proc. 23rd ACM-SIAM Symposium on Discrete Algorithms (SODA 2012), pages 833–845, 2012.
- [140]Liam Roditty and Uri Zwick. On dynamic shortest paths problems. In Proc. 12th European Symposium on Algorithms (ESA 2004), volume 3221 of LNCS, pages 580–591, 2004. Journal version: Algorithmica 61(2):389–401, 2011.
- [141]Piotr Sankowski. Dynamic transitive closure via dynamic matrix inverse. In Proc. 45th IEEE Symposium on Foundations of Computer Science (FOCS 2004), pages 509–517, 2004.DOI
- [142]Henrik V. Sorensen and C. Sidney Burrus. Efficient computation of the DFT with only a subset of input or output points. IEEE Transactions on Signal Processing, 41(3):1184–1200, 1993.DOI
- [143]Arnold Schönhage. Partial and total matrix multiplication. SIAM Journal on Computing, 10(3):434–455, 1981.DOI
- [144]Uwe Schöning. A probabilistic algorithm for k-SAT and constraint satisfaction problems. In Proc. 40th IEEE Symposium on Foundations of Computer Science (FOCS 1999), pages 410–414, 1999.
- [145]Raimund Seidel. On the all-pairs-shortest-path problem in unweighted undirected graphs. Journal of Computer and System Sciences, 51(3):400–403, 1995.
- [146]Michael Soss, Jeff Erickson, and Mark H. Overmars. Preprocessing chains for fast dihedral rotations is hard or even impossible. Computational Geometry: Theory and Applications, 26(3):235–246, 2003.
- [147]Volker Strassen. Gaussian elimination is not optimal. Numerische Mathematik, 13:354–356, 1969.DOI
- [148]Volker Strassen. Vermeidung von Divisionen. Journal für die reine und angewandte Mathematik, 264:184–202, 1973.DOI
- [149]Nathan Sheffield, Virginia Vassilevska Williams, and Zoe Xi. The limits of black-box reductions for all-pairs triangle detection. In Proc. 38th ACM-SIAM Symposium on Discrete Algorithms (SODA 2027), 2027. To appear. Full version: arXiv:2608.19092.
- [150]Tadao Takaoka. A new upper bound on the complexity of the all pairs shortest path problem. Information Processing Letters, 43(4):195–199, 1992.
- [151]Tadao Takaoka. A faster algorithm for the all-pairs shortest path problem and its application. In Proc. 10th International Computing and Combinatorics Conference (COCOON 2004), volume 3106 of LNCS, pages 278–289, 2004.DOI
- [152]Tadao Takaoka. An O(n^3 log log n / log n) time algorithm for the all-pairs shortest path problem. Information Processing Letters, 96(5):155–161, 2005.DOI
- [154]Virginia Vassilevska Williams. On some fine-grained questions in algorithms and complexity. In Proceedings of the International Congress of Mathematicians (ICM 2018), pages 3447–3487. World Scientific, 2018.DOI
- [155]Jan van den Brand, Danupop Nanongkai, and Thatchaphol Saranurak. Dynamic matrix inverse: Improved algorithms and matching conditional lower bounds. In Proc. 60th IEEE Symposium on Foundations of Computer Science (FOCS 2019), pages 456–480, 2019. Full version: arXiv:1905.05067.arxiv.org/abs/1905.05067
- [156]Jan van den Brand, Zhao Song, and Tianyi Zhou. Algorithm and hardness for dynamic attention maintenance in large language models. In Proc. 41st International Conference on Machine Learning (ICML 2024), volume 235 of PMLR, pages 49008–49028, 2024.arxiv.org/abs/2304.02207
- [157]Virginia Vassilevska Williams and Ryan Williams. Subcubic equivalences between path, matrix and triangle problems. In Proc. 51st IEEE Symposium on Foundations of Computer Science (FOCS 2010), pages 645–654, 2010.
- [158]Virginia Vassilevska Williams and Ryan Williams. Finding, minimizing, and counting weighted subgraphs. SIAM Journal on Computing, 42(3):831–854, 2013.
- [159]Virginia Vassilevska Williams and R. Ryan Williams. Subcubic equivalences between path, matrix, and triangle problems. Journal of the ACM, 65(5):27:1–27:38, 2018.
- [160]Virginia Vassilevska Williams and Yinzhan Xu. Monochromatic triangles, triangle listing and APSP. In Proc. 61st IEEE Symposium on Foundations of Computer Science (FOCS 2020), pages 786–797, 2020. Full version: arXiv:2007.09318, whose numbering we follow.arxiv.org/abs/2007.09318
- [161]Virginia Vassilevska Williams, Yinzhan Xu, Zixuan Xu, and Renfei Zhou. New bounds for matrix multiplication: From alpha to omega. In Proc. 35th ACM-SIAM Symposium on Discrete Algorithms (SODA 2024), pages 3792–3835, 2024.arxiv.org/abs/2307.07970
- [162]Stephen Warshall. A theorem on Boolean matrices. Journal of the ACM, 9(1):11–12, 1962.DOI
- [163]Ryan Williams. A new algorithm for optimal 2-constraint satisfaction and its implications. Theoretical Computer Science, 348(2–3):357–365, 2005.DOI
- [164]R. Ryan Williams. The polynomial method in circuit complexity applied to algorithm design (invited talk). In Proc. 34th International Conference on Foundation of Software Technology and Theoretical Computer Science (FSTTCS 2014), volume 29 of LIPIcs, pages 47–60, 2014.DOI
- [165]R. Ryan Williams. Strong ETH breaks with Merlin and Arthur: Short, non-interactive proofs of batch evaluation. In Proc. 31st Computational Complexity Conference (CCC 2016), volume 50 of LIPIcs, pages 2:1–2:17, 2016.arxiv.org/abs/1601.04743
- [166]R. Ryan Williams. Faster all-pairs shortest paths via circuit complexity. SIAM Journal on Computing, 47(5):1965–1985, 2018.
- [167]R. Ryan Williams. The orthogonal vectors conjecture and non-uniform circuit lower bounds. In Proc. 65th IEEE Symposium on Foundations of Computer Science (FOCS 2024), pages 1372–1387, 2024. ECCC TR24-142.DOI
- [168]Frank Yates. The design and analysis of factorial experiments. Technical Communication 35, Imperial Bureau of Soil Science, Harpenden, 1937.
- [169]Huacheng Yu. An improved combinatorial algorithm for Boolean matrix multiplication. Information and Computation, 261:240–247, 2018.
- [170]Raphael Yuster and Uri Zwick. Answering distance queries in directed graphs using fast matrix multiplication. In Proc. 46th IEEE Symposium on Foundations of Computer Science (FOCS 2005), pages 389–396, 2005.DOI
- [171]Raphael Yuster and Uri Zwick. Fast sparse matrix multiplication. ACM Transactions on Algorithms, 1(1):2–13, 2005.
- [172]Uri Zwick. All pairs shortest paths using bridging sets and rectangular matrix multiplication. Journal of the ACM, 49(3):289–317, 2002.
- [173]Uri Zwick. A slightly improved sub-cubic algorithm for the all pairs shortest paths problem with real edge lengths. Algorithmica, 46(2):181–192, 2006. Preliminary version in ISAAC 2004.