Manuscript Offprint
arXiv:2610.24273Batch range mode in O(n+Q)^1.395
Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.
Abstract
We give a deterministic worst-case algorithm for exact Batched Range Mode on an arbitrary array of length n and a batch of Q intervals. The algorithm returns the mode frequency and the smallest mode identifier for each query in time
The algorithm combines virtual occurrence windows and block-boundary snapping with a query-restricted min-plus product whose first operand is column-monotone and whose second operand is row-monotone. A deterministic modular verifier uses geometric and query potentials to bound the same active regions; false modular matches are corrected by offline orthogonal range updates. The final analysis uses the sharper rectangular exponent curve of Uznański (2026), together with exact rational parameter balancing and a transfer to prime fields. The analysis covers every frequency scale and arbitrary batch sizes. Exact frequencies and the smallest mode identifiers are recovered without increasing the exponent.
1 Introduction
In Batched Range Mode, the input is an array and a list of intervals, and each interval asks for its most frequent color. We consider the exact offline problem, with no restrictions on the palette, the arrangement of occurrences, or the query intervals.
Theorem 1.1. Given an explicit array of length n and an explicit batch of Q intervals, the mode frequency and the smallest identifier among the modes of each nonempty interval can be computed in deterministic worst-case time
Empty intervals have frequency zero and no mode color. Repeated intervals are allowed. Construction of intermediate instances, input reads, and output writes are included in the bound.
Previous work. Vassilevska Williams and Xu [1] connected Batched Range Mode to structured min-plus multiplication. Gu, Polak, Vassilevska Williams, and Xu [2] developed this connection using monotone min-plus products. Chi, Duan, Xie, and Zhang [3] improved the randomized monotone primitive, and Dürr [4] extended it to rectangular dimensions; we use the corrected Batched Range Mode comparison in arXiv:2208.02862v4 rather than the erroneous numerical exponent in an earlier version. Jin, Park, Saha, and Xu [5] derandomized the monotone primitive and its downstream applications. Our product additionally uses monotonicity in both external coordinates and restricts correction to prescribed output cells. The matrix-multiplication analysis uses the rectangular exponent bound of Uznański [9], based on the square-multiplication work of OpenAI [10]. For , our bound is .
The product used here. Our first operand is monotone in its external coordinate, as is the second operand in the other external coordinate. Their min-plus product is therefore monotone in both output coordinates. We exploit this property while computing only a prescribed set E of output cells. A recursive product on E extends to a monotone candidate over the full grid using prefix maxima. This extension costs linear time in the grid size and does not require the true min-plus values elsewhere.
For the verifier, rounded blocks of the two operands define rectangles. Intersecting those rectangles with rounded candidate values gives regions that can be represented by three-dimensional boxes. The same active regions admit both a geometric bound and a bound charged to the requested cells. Combining these bounds across refinement levels is the source of the improved exponent. The modular selection follows the small-prime potential framework of Jin et al. [5]; we give the selection and correction arguments for the two potentials used here.
The Range Mode reduction uses virtual occurrence windows and a uniform grid of block boundaries. The colors in the two boundary fragments of a query are checked exactly. A witnessing color absent from those fragments has all its occurrences in the snapped interior. On that interior we use true prefix ranks, obtaining both operand monotonicities directly. This avoids a graph lifting or a completion of missing ranks.
Model and notation. We work on a word-RAM with -bit words, where . Color identifiers have bits and are totally ordered. We write for polylogarithmic factors and for factors; all dimensions and integer magnitudes in intermediate instances are polynomially bounded in . The uniform meaning of is that for every there is an algorithm of cost . We use exact ordinary matrix multiplication, fast polynomial evaluation and interpolation, and the prime-number theorem. The matrix-multiplication bounds and their finite-field implementation are justified in section 4 using the explicitly cited external matrix-multiplication results. The finite-field and word-RAM implementation is proved there. Earlier rectangular bounds appear in [6, 7]. The proof uses the cited rectangular matrix-multiplication bound as an external theorem and proves the transformations and asymptotic consequences required for the present algorithms. Rounding dimensions and cutoffs changes only constant or subpolynomial factors.
Let be a valid deterministic cost for complete ordinary multiplication of these dimensions over sufficiently large prime fields. The set is supplied as an explicit list; duplicate cells can be coalesced by sorting.
Theorem 2.1 (Two-sided monotone product). The values in (1) can be computed in deterministic time
We prove the theorem through an equality verifier. Its candidate is a full integer matrix, nondecreasing in both coordinates, with entries in . The verifier returns
The candidate need not agree with the true product outside E.
2.1 Regions and their two potentials
Fix a dyadic value . For each , partition the row indices into maximal intervals on which is constant, and partition the column indices into maximal intervals on which is constant. For each rectangle , with and , introduce one region record
for every integer
The record represents the cells in with . Some records may represent no cells. Each cell belongs to exactly one record for each . We retain empty records in the potentials so that the corner formulas below are exact.
Lemma 2.2. For , there are region records.
Proof. Fix . Since each quotient sequence is nondecreasing and the unrounded operands range over , there are quotient blocks. In each operand rectangle with opposite corners and , the number of labels is at most
Split the difference into
For a fixed column block, the first differences over distinct row blocks are nonnegative increments on disjoint row intervals, so their sum is at most 4R. Summing over the t column blocks contributes at most 4Rt. For a fixed row block, the second differences over the disjoint column blocks similarly sum to at most 4R; this contributes at most 4Rs. The total number of records for this k is therefore at most
Summing over k proves the lemma. In particular the initial geometric and query budgets can be chosen as the explicit positive rational numbers
since at most integer shifts are charged per record or requested cell and color. ☐
Associate with each record the anchor
For a fixed k, the monotone quotient sequences on both axes partition the grid into these rectangles. At any cell in such a rectangle, monotonicity of C gives
Consequently each triple belongs to exactly one region: its unique operand rectangle and the unique label . This remains true even though the potential sums include empty regions. It is this uniqueness, rather than disjointness between different colors, that will be used in the charging argument.
Write the remainders of the three entries as
The exact gap therefore satisfies
If and , choose . Then , , and . Thus every false modular equality is active at every dyadic level. When , the three remainders are zero and the anchor equals the exact gap. For a modulus , call the record active if
Two divisions test this predicate by checking whether the interval contains a nonzero integer.
Define by counting all record-shift pairs satisfying divisibility in (5), including those with . Let count the pairs with , and put . For the query potential, use
and define , , and in the same way over , , and the shifts in . Both terms are independent of .
Lemma 2.3. There are bounds
The number of active level- records containing a cell of E is at most .
Proof. There are at most shifts per record or query-color pair, so the explicit record bound from theorem 2.2 proves the first inequality, while direct counting proves the second. An active record has at least one nonzero shifted witness counted by . For each active region meeting , choose one requested cell and one shift witnessing activity. The anchor at that cell and color agrees with the region anchor. Distinct records cannot be mapped to the same triple : by the uniqueness established above, a fixed belongs to only one record at this level. Hence these witnesses inject into the query potential and the number of active nonempty regions is at most . The geometric potential independently bounds the same regions.
2.2 Computing both potentials
For this subsection fix , and write
In the ring modulo , set and . Let and retain these monomials only at the first and last indices of each column block of ; define and at the endpoints of the row blocks of . Compute
Write for the coefficient of , and similarly for the other products. Put
where . With , the query potential is
For the geometric potential, every operand rectangle contributes the cumulative weight at its upper-right corner minus the cumulative weight immediately before its lower-left corner:
To verify the identity, fix and one operand rectangle with rounded sum , and put , . Its contribution is exactly
The endpoint-masked products count this rectangle’s monomial precisely once at and once at , respectively. Summing over all and their operand rectangles gives (8). The formula counts all labels in the corner interval, including labels whose regions are empty. Likewise counts exactly the indices whose rounded sum has residue , proving (7).
The cumulative weight can be evaluated without a table of size . For ,
Each floor sum is computable in arithmetic operations by the following exact Euclidean routine. Define
for signed integer . Euclidean division and , with , yields the identity
After adding these quotient contributions, if the remaining sum is zero. Otherwise let and replace
Then repeat the quotient extraction. The replacement is valid by counting integer lattice points under : for and ,
To derive (11), count for each the indices satisfying , reverse the summations, and use for the last partial strip. In this case , so the new denominator is nonzero. After the next quotient extraction the modulus decreases as in Euclid's algorithm. This proves logarithmically many steps and supports negative coefficients through (10). Using and evaluates (9) exactly. The three polynomial products and the sums in (7) and (8) cost . For exact implementation, evaluate the ordinary polynomial product, of degree below , at field points, apply ordinary scalar matrix multiplication, interpolate, and reduce modulo . Its cyclic coefficients are counts at most . A prime characteristic greater than therefore suffices; a sieve finds a suitable prime of magnitude , where is the accuracy-dependent constant from theorem 4.1. For fixed accuracy its search cost is covered by the stated bound. The coefficient counts are recovered as integers before evaluating the weighted sums. Evaluation, interpolation, and the coefficient scans cost , covered by . All subsequent integer magnitudes have bits.
2.3 Deterministic selection and refinement
Choose and consider . We select one modulus simultaneously for the two potentials at every level. Let index these potentials, with initial bounds from (6). Choose
and sieve the family of primes in . Its size is ; bounded small instances are handled directly.
Start with and suppose for every potential. Each surviving witness is a nonzero integer divisible by , with for an absolute fixed by the polynomial bounds on instance magnitudes. For every trial prime , including one previously chosen, we have
If distinct primes from divide the nonzero integer , then
The prime-number theorem gives for all sufficiently large . The fraction of trial primes dividing any fixed quotient is thus at most for an absolute constant . Double counting the surviving witnesses proves
There are potentials, so summing the normalized inequalities and choosing one prime no worse than the mean shows that a single satisfies all contractions
where is a sufficiently large fixed integer. This is a deterministic existence argument and uses no independence assumption. Integer comparisons of squares suffice to compute ; the quantity is rational, and for sufficiently large . Bounded smaller are handled directly. This prime can be found without knowing . Compute all , let , and minimize
The prime has because the differences cancel and . For the selected prime ,
Set and . Stop when . Then , , and . Indeed,
because . Consequently
Each stage costs by the potential formulas. The pretermination values satisfy , so selection costs . All normalized comparisons are exact rational comparisons. Indeed and , so numerators and denominators have bits. The explicit positive rational budgets from theorem 2.2 satisfy every initial inequality and make the deterministic objective well-defined.
Lemma 2.4. An active region at level has an active parent at level . Each parent has at most eight children.
Proof. Write the child’s block size as and the parent’s as . Each parent operand block splits into at most two child blocks, and a parent candidate label splits into the two labels . Thus there are at most eight children. The child labels are , , and , where each is zero or one. Hence
If is divisible by with , the parent has the same witness with a shift of magnitude at most . A child containing a requested cell has a parent containing that cell.
Construct a deterministic orthogonal range tree on the points , . Its construction costs , and emptiness of a three-dimensional box is tested in polylogarithmic time. A region record represents the box
At the top level , enumerate all records and retain those that are active and nonempty on the query points. By theorem 2.2, this costs . Refine retained records only, testing their at most eight children for activity and query emptiness. Operand block splits are found by binary search; candidate corner labels have constant-time access.
By theorem 2.3 and (12), the number of retained records at level is
Summing over dyadic levels gives
For , split the sum at ; the smaller-scale query bounds and the larger-scale geometric bounds are geometric series of total . If the split lies above the top level, the query bounds alone are smaller still. For , the geometric bounds sum to .
2.4 Exact correction
One further polynomial product, using the unrounded exponents of A and B, gives
in time. At level zero, the operands and the candidate are constant on a region, and its anchor is the exact integer gap. Every false modular match belongs to an active record containing its query point, using shift zero. By theorem 2.4, that record is recovered. For each recovered record whose gap is a nonzero multiple of , add one to the correction count on its three-dimensional box. Records with zero gap are never corrected.
These box updates do not require enumerating the query points they contain. For an integer interval, use the identity
Multiplying these identities for the three coordinates of expands one update into eight signed dominance corners . A corner adds its sign to each query point with , , and . Sort corners and query points in increasing first coordinate, processing corners before queries on a tie. Maintain point additions and prefix-orthant sums on the two remaining coordinates by a deterministic coordinate-compressed, nested Fenwick tree. The offline processing and storage cost are for boxes. Thus every query obtains exactly the number of false matches. A fixed color contributes once: belongs to exactly one level-zero record, and its gap is zero or a nonzero multiple of precisely in the two respective cases. Subtracting the second count from the modular count gives , which proves (3).
Combining selection, initialization, refinement, and correction proves the verifier bound
The term covers input reads and the full candidate grid.
2.5 Recovering the product on the requested cells
Round both operands down after division by two and recursively compute their min-plus product only on E. The true product of the rounded operands is nondecreasing in both coordinates. Its requested values therefore extend consistently to
At a requested cell, every term in this maximum is at most that cell's recursive value, and the value at the cell itself is included. Thus the extension agrees with on E. A two-dimensional prefix-maximum scan constructs it in time.
For each write and , where . Thus every sum lies between twice its rounded sum and twice that sum plus two. Taking minima over proves that at each the original minimum lies in . Verify the three full-grid candidates , , and take the smallest with a positive equality count at that requested cell. An accepted value is an actual sum, and one of the candidates is the minimum. The candidates are nondecreasing in both coordinates and lie in . The base case is zero once both operands are zero. There is one recursive child per level, the requested set stays fixed, and the depth is .
Put and . In (15), choose within a constant factor of
The unrounded value is at most because and ; rounding and capping at change costs by only a constant factor. The three parameter-dependent terms are bounded by
At lower recursion levels, the dimensions and E are unchanged and the range decreases. The logarithmic recursion overhead is absorbed in , proving theorem 2.1.
3 Threshold queries by virtual windows and block snapping
Define the known-threshold problem as follows. For each query interval and positive integer threshold , decide whether some color occurs at least times in the interval. A positive answer need not yet identify the color. Group the queries by the dyadic scale
A threshold larger than the interval length is immediately false. There are scales and the total number of query records over all scales is Q.
3.1 Virtual occurrence windows
Fix one scale v and consider queries with
For an original color with occurrence positions , , create virtual windows beginning at occurrence indices , as long as at least occurrences remain. A window beginning at local index consists of occurrences and is treated as a new virtual color carrying the identifier of its original color.
There are at most virtual windows, and each original occurrence belongs to at most three windows. Hence the total number of virtual occurrences is at most 3n.
Every run of consecutive occurrences with is contained in one of these windows. If the first occurrence in the run has local index , choose the window beginning at
The run ends before the beginning index plus 3v, and the chosen beginning is valid because at least occurrences remain. Therefore, for every query interval,
The reverse implication is immediate because a window contains only occurrences of one original color. The forward implication uses a window containing k consecutive occurrences of the witnessing original color. No regularity of the occurrence distribution is required.
3.2 Exact boundary processing and snapped interiors
Choose an integer block length and let
with duplicates removed. Consecutive grid boundaries have distance at most . For a query , put and and define
If , the interior is ; otherwise let be empty. In all cases consists of at most two fragments and contains fewer than positions. When , both query boundaries lie in a single grid gap, so the whole query has length less than ; when , the two fragments together have length less than .
Build the occurrence list of every original color. For every query, inspect all positions of . For each color encountered, count its occurrences in the whole query by two binary searches in its occurrence list. Let be the largest count obtained, or zero if the fragments are empty. Repeated colors may be inspected repeatedly: the bound remains , including list construction. This processing is performed once for the entire threshold batch.
Lemma 3.1 (Snapping identity). For every positive threshold k,
Proof. Both right-hand witnesses are actual colors in I. Conversely, a witnessing color either occurs in , in which case its exact count is among the boundary counts, or has all its occurrences in J. This includes empty interiors.
For a virtual color , let be its true prefix count at coordinate , with . Use all grid boundaries as rows and as columns. Set
and reverse the column order of B. Then A has nondecreasing columns and B has nondecreasing rows. For the cell whose row is u and whose reversed column represents w,
Use theorem 2.1 only on the distinct cells requested by nonempty interiors at this scale. Store the original query identifiers and their thresholds in lists attached to the cells. Duplicate coalescing costs , and testing all thresholds afterwards costs . If there are no virtual colors, every interior threshold at this scale is false. Otherwise (18), (19), and theorem 3.1 prove exactness.
The grid has boundaries, the number of virtual colors is , and . Constructing the occurrence windows takes time. Scanning their sorted lists against the grid builds the dense rank operands in time. A full candidate grid costs and is charged to . No regularity of query endpoints or of color occurrence positions is assumed.
4 Rectangular multiplication bounds and finite-field transfer
For a real , write for the arithmetic exponent of multiplying an matrix by a matrix over the complex numbers. We use the stated rectangular exponent theorem and establish the finite-field algorithms required for the word-RAM complexity analysis.
4.1 The external rectangular multiplication theorem
Our asymptotic result uses the following external theorem. Theorem 1.1 of Uznański [9] establishes, for arithmetic matrix multiplication over C, the upper bound
This is an unconditional upper bound on , conditional only on the correctness of the cited external proof, and not a conjecture on the true exponent. Its continuous first derivative on is 0 for and for ; the second derivative on the latter interval is . In particular, is continuous, nondecreasing, and convex. Only this rectangular exponent bound is used below.
The arXiv version v4 of Dürr [4] corrects an earlier numerical comparison for Batched Range Mode. In order not to conflate historical versions, the bibliographical entry for Jin, Park, Saha, and Xu [5] identifies exactly the arXiv version used here. Neither previous numerical bound enters the proof of the present theorem.
4.2 Exact transfer and uniformity over all shapes
Lemma 4.1 (Prime-field implementation). For every there is an integer such that, for every prime and every , multiplication of an matrix by a matrix over has a deterministic algorithm costing
base-field operations. The algorithm and bound are uniform over . For polynomially bounded , word-RAM implementation introduces only polylogarithmic overhead.
Proof. Fix an accuracy smaller than . Select a finite mesh of aspect ratios on , fine enough that padding to the next larger mesh ratio raises by less than ; include and 1. At every mesh point the definition of the matrix-multiplication exponent supplies a fixed finite exact bilinear rank scheme whose recursive blocking and padding achieve its exponent with slack less than . This is the standard finite-scheme characterization of the exponent (Lemma 2.1 of [8]); for the square result it is also the recursive algorithm at the end of Section 5 of [10]. Dimensions and coefficients of these finitely many schemes depend only on the accuracy.
Their coefficient identities form finite polynomial systems over Q. A complex solution implies a solution over , by the Nullstellensatz, so all schemes can be realized over a single number field K. Choose a Q-basis of K and an integer clearing the denominators of all scheme coefficients and of the basis multiplication table. Increasing if necessary, their coefficients lie in the unital algebra
which is closed under multiplication. For , reduce this free algebra modulo . It is a c-dimensional commutative algebra over , and every exact scheme identity survives reduction. It need not be a field.
Run each whole recursive bilinear circuit in this algebra on inputs in the component of . Every addition or multiplication is simulated by a fixed number of base-field operations, using the fixed multiplication table. Correctness of the reduced identities puts the desired output in the component of ; projecting onto that component recovers the exact product. This is a constant factor on the entire circuit, rather than a factor in its rank at every recursion depth. The finite mesh makes the algebra dimension and excluded denominators independent of the input shape and size.
Padding to the next mesh point and choosing the accuracy slack sufficiently small yields the displayed bound. The finitely many constant-size schemes and algebra tables are part of the fixed algorithm for that accuracy. Modular operations on -bit quantities take polylogarithmic word-RAM time. The verifier can choose of polynomial magnitude by a sieve; all bounded small cases are absorbed by the accuracy-dependent constant. No approximate complex arithmetic is used.
5 The all-scales running time
Set
Thus , , and . This fixed rational choice provides an explicit strict certificate; the limit of the same estimates at nearby rational choices will yield . Choose the integer block length . This choice is computable exactly: if , binary search for the least integer with . The fixed exponents increase constants only, and integer arithmetic has polylogarithmic cost. Write for a scale. Constant factors and polylogarithmic overheads contribute to the exponents. The boundary processing costs once for the threshold batch.
5.1 The outer scales
For , enumerate every consecutive subwindow of every virtual color's occurrence list. Each list has length at most and their total length is at most , so there are subwindows. A subwindow from position to has weight and lies in a query exactly when and . Sort subwindows and queries by their first endpoint, sweep, and maintain prefix maxima of weights indexed by the second endpoint. This computes the maximum contained subwindow weight in time. The occurrences of a color inside a query form a consecutive subwindow, so the returned maximum is its exact virtual mode frequency and (18) supplies the threshold answers. The cost is at most . Use the original intervals at these scales; snapping is unnecessary.
For , scan the at most virtual colors for each scale query. Binary searches give each count, in time . Again use the original intervals.
5.2 The intermediate scales and exact balancing
For , use the snapped interiors and true rank operands of section 3.2. Their dimensions satisfy
The input and full-grid volumes are at most . Padding the outer dimensions and applying theorem 4.1 gives a valid ordinary multiplication cost
The aspect ratio belongs to , so the second branch of (20) gives the displayed rational formula. Also covers . In theorem 2.1, the remaining two terms have exponents at most
The function is convex and nonincreasing. Hence its maximum is , and the convex function has maximum at one of . The function is convex separately on and , so it suffices to check . The active aspect-ratio interval lies strictly above , so only the smooth branch of enters this argument.
The exact fractions in (21) satisfy
Consequently the remaining central endpoint is
All comparisons are exact rational comparisons; the terminating decimal for is exact. The following rational upper bounds suffice at all other endpoints:
| quantity | strict rational upper bound |
|---|---|
| 2h | 1.212 |
| M(d) | 1.363 |
| T3(d) | 1.374 |
| T3(h) | 1.357 |
| T2(d) | 1.379 |
| T2(h) | 1.367 |
To make the endpoint comparisons fully reproducible, the six noncentral expressions simplify to
All six expressions decrease strictly with : this is immediate for the linear terms, and for the remaining terms it follows by differentiating , whose derivative is negative. Their displayed strict rational bounds follow by clearing positive denominators. For the limiting value use the exact isolating inequality
which follows by squaring . Substituting the rational lower endpoint into the six decreasing expressions proves the same strict bounds 1.212, 1.363, 1.374, 1.357, 1.379, and 1.367 at , all below . The central identity is exact. This supplies a rational certificate of every case, without numerical floating-point assumptions.
Each upper bound is strictly smaller than . Convexity of , , and of separately on and establishes the uniform bound at every intermediate frequency scale. To obtain the sharp exponent from this bound, note that and satisfy
The strict inequalities for the other endpoints at follow from the exact rational isolation and monotonicity just established. Since all endpoint expressions are continuous for , for each fixed we may select a rational sufficiently close to that every endpoint exponent, including the boundary cost , is at most . Choose ; this is exactly computable by fixed-degree integer powering and binary search as above. Give the field operations and subpolynomial factors the remaining accuracy slack. This proves the uniform running-time exponent without requiring irrational machine operations or an unproved exponent conjecture. Convexity then proves that every term in the primitive, including construction of dense operands and candidates, costs at most at every intermediate scale.
There are only logarithmically many scales and product-recursion levels. Their input reads, query lists, and output writes are included. We obtain a deterministic known-threshold solver for arbitrary batches with
For the uniform meaning of this statement, fix a target , give the ordinary products a sufficiently small accuracy slack, and absorb the subpolynomial prime-selection overhead and logarithmic recursion factors in the remaining slack. Constants depend on , not on input dimensions, endpoints, or colors.
6 From threshold decisions to exact mode frequencies
For each global occurrence list of a color, retain the occurrences of even rank. The filtered array , in original order, has length at most . Let be the number of retained positions among the first positions of the original array. An inclusive query projects to
which is exactly the subsequence of retained positions lying in the query. Empty projected intervals have frequency zero.
Occurrences of any fixed color inside an interval have consecutive ranks in that color's global occurrence list. If the original count is f and the retained even-rank count is e, then
Let m be the maximum frequency in the filtered query and M the maximum frequency in the original query. A color attaining m supplies the lower inequality, while applying the preceding bound to every color gives
For a nonempty original query with , every color occurs at most once, so . Otherwise test threshold . If the answer is positive, then . If it is negative, test ; a positive answer gives , and a negative answer gives . Thus only two rounds of known-threshold batches are needed, internally divided into the dyadic scales already handled in section 3.
The algorithm recursively solves exactly one child instance on , keeping at most Q projected queries, and then resolves the original frequencies by the two threshold rounds. The array length decreases geometrically, so the recursion has levels. Every level costs at most , and the logarithmic factor is absorbed into . Building the filter and projecting all queries costs per level. The empty base array has mode frequency zero. By induction, every reported frequency is exact, and the total deterministic worst-case time is
7 Deterministic recovery of a mode color
7.1 A general decoding lemma
Suppose there is a deterministic algorithm that, for every explicit array of length and every batch of intervals, returns all exact mode frequencies in time for some , including the cost of constructing and reading the instance. The frequency solver proved in section 6 has exactly this property.
Lemma 7.1 (Mode-color decoding). Given such an exact frequency solver, one mode color for every query on an array of length n and a batch of Q intervals can be recovered deterministically in worst-case time
If color identifiers are totally ordered, the decoder can return the smallest identifier among all modes.
More explicitly, if the frequency solver has a uniform cost , the decoder adds at most an factor, where is the number of colors. The same argument applies to subpolynomial overhead: for every , use a uniform bound and absorb small instances and logarithmic factors. Original identifiers have bits.
7.2 Decoder algorithm
First compute the exact target frequency for every original query. Sort and compress the color identifiers deterministically in time, and build a balanced binary partition of the ordered palette. This order also fixes the canonical tie-breaking rule: always prefer the half containing smaller identifiers.
A node v of the palette tree owns a subpalette , a filtered array containing exactly the colors of in their original order, and a list of already routed queries. Each query keeps its original identifier, its target , and its endpoints in . Maintain the invariant that contains at least one mode of the original query.
Every subpalette is an interval in the root's compressed order. For local solver calls, colors may be relabeled by ranks by subtracting the beginning of that interval while keeping the map to original identifiers. This costs linear time in the filtered array, already charged, and keeps local identifiers within bits. The final canonical choice is still determined by the original order.
Split into halves and . Scan once to build filtered arrays and the prefix function
For an inclusive parent query , the projected intervals are
An interval whose left endpoint exceeds its right endpoint is empty and has mode frequency zero. Run the deterministic frequency solver on for all node queries whose left projection is nonempty. If the returned frequency is , route that query only to the left child; otherwise route it only to the right child. Equivalently, one may use the known-threshold solver to test modefreq( . The internal solver never needs to recover a color.
When a node’s palette is a singleton, that color is the answer for every query routed to the node. For nonempty original queries, , so no routed query can end up in an empty interval. Empty original queries are handled directly according to the convention in section 1.
7.3 Correctness of the decoder
Filtering preserves occurrence order. Equation (27) selects exactly the child-color occurrences that lay in the parent interval: no outside occurrence enters and no retained occurrence inside the parent interval disappears. Hence the frequency of every retained color is unchanged by projection.
At the root, is the true mode frequency. Assume the routing invariant holds at a parent node. In the left child, no color can have frequency greater than , because all left-child occurrences come from the original query. If the left solver returns , at least one original mode lies in , so routing left preserves the invariant. If it returns less than , no mode lies in ; the parent invariant then forces at least one mode into , so routing right preserves the invariant.
At a leaf, the unique remaining color therefore occurs exactly times in the original query and is a true mode. Always choosing the left half whenever it contains a mode discards only larger identifiers, so the output is the smallest identifier among all modes. No sampling, randomized hashing, isolation probability, or expected-time stopping rule is used.
7.4 Worst-case cost of the decoder
Fix one depth of the palette tree and consider all nodes carrying active queries. Their palettes are disjoint, so their arrays are filtered from disjoint color classes of the original array. Consequently
Every query is routed to exactly one node at that depth, hence
The frequency solver is called on the left child of every node with at most queries. Setting gives
For ,
For a bound with overhead, fix ; then and
Constructing both child arrays, the prefix vectors, and all projected queries costs per depth. A balanced palette partition has depths. Adding the initial frequency computation, color compression, and output writing still leaves the total within (26). Processing one depth at a time uses auxiliary space beyond the memory of the frequency solver, because arrays from completed depths can be discarded.
The same solver is valid on every filtered array and projected query batch because its guarantee is for arbitrary explicit arrays and arbitrary batches, with cost controlled by their total mass. At any depth, the batches separate by query and the arrays separate by palette, so summing local costs introduces no additional polynomial factor.
Combining section 6 and theorem 7.1 proves theorem 1.1 for both frequencies and colors. Prime selection, data structures, recursions, and query routing are all deterministic and all stated costs are worst case. The averaging argument in section 2.3 establishes the existence of a prime that is found by exhaustive deterministic evaluation.
References
[1] Virginia Vassilevska Williams and Yinzhan Xu. Truly Subcubic Min-Plus Product for Less Structured Matrices, with Applications. In Proceedings of the 2020 ACM-SIAM Symposium on Discrete Algorithms (SODA), pages 12–29. SIAM, 2020. doi:10.1137/1.9781611975994.2; arXiv:1910.04911.
[2] Yuzhou Gu, Adam Polak, Virginia Vassilevska Williams, and Yinzhan Xu. Faster Monotone Min-Plus Product, Range Mode, and Single Source Replacement Paths. In 48th International Colloquium on Automata, Languages, and Programming (ICALP 2021), volume 198 of LIPIcs, pages 75:1–75:20. Schloss Dagstuhl–Leibniz-Zentrum für Informatik, 2021. doi:10.4230/LIPIcs.ICALP.2021.75; arXiv:2105.02806.
[3] Shucheng Chi, Ran Duan, Tianle Xie, and Tianyi Zhang. Faster Min-Plus Product for Monotone Instances. In Proceedings of the 54th Annual ACM SIGACT Symposium on Theory of Computing (STOC), pages 1529–1542. ACM, 2022. doi:10.1145/3519935.3520057; arXiv:2204.04500.
[4] Anita Dürr. Improved Bounds for Rectangular Monotone Min-Plus Product and Applications. Information Processing Letters, 181:106358, 2023. doi:10.1016/j.ipl.2023.106358; corrected full version arXiv:2208.02862v4 (February 16, 2026), Table 1 and the associated correction note.
[5] Ce Jin, Jaewoo Park, Barna Saha, and Yinzhan Xu. Deterministic Monotone Min-Plus Product and Convolution. arXiv:2605.07150v2, May 29, 2026 (the exact version consulted). https://arxiv.org/abs/2605.07150v2.
[6] Virginia Vassilevska Williams, Yinzhan Xu, Zixuan Xu, and Renfei Zhou. New Bounds for Matrix Multiplication: from Alpha to Omega. In Proceedings of the 2024 Annual ACM-SIAM Symposium on Discrete Algorithms (SODA), pages 3792–3835. SIAM, 2024. doi:10.1137/1.9781611977912.134; arXiv:2307.07970.
[7] Josh Alman, Ran Duan, Virginia Vassilevska Williams, Yinzhan Xu, Zixuan Xu, and Renfei Zhou. More Asymmetry Yields Faster Matrix Multiplication. In Proceedings of the 2025 Annual ACM-SIAM Symposium on Discrete Algorithms (SODA), pages 2005–2039. SIAM, 2025. doi:10.1137/1.9781611978322.63; arXiv:2404.16349.
[8] OpenAI. Complex Matrix Multiplication Below 2.258 and Rectangular Bounds. Preprint, September 24, 2026; cited here only for the finite-scheme characterization of arithmetic exponents (Lemma 2.1). https://github.com/openai/math/blob/main/preprints/Complex-Matrix-Multiplication-Below-2.258-and-Rectangular-Bounds-September-24-2026/Complex-Matrix-Multiplication-Below-2.258-and-Rectangular-Bounds-September-24-2026.pdf.
[9] Przemysław Uznański. Rectangular Matrix Multiplication from Shared-Leg Entropy. arXiv:2610.10494v1, October 7, 2026. Theorem 1.1. https://arxiv.org/abs/2610.10494.
[10] OpenAI. An Upper Bound of 9/4 for the Matrix Multiplication Exponent. Preprint, October 2, 2026. Theorem 1.1 and Remark 5.2. https://github.com/openai/math/blob/main/preprints/Matrix-Multiplication-Nine-Fourths-October-2-2026/paper.pdf.
Use of generative AI. Generative AI tools assisted with literature searches, drafting and editing. The author takes responsibility for all mathematical claims and conclusions