Abstract 1 Introduction 2 Preliminaries 3 The Upper Bounds: Overview 4 The Lower Bound References

Random Access in Grammar-Compressed Strings

Anouk Duyster ORCID Max Planck Institute for Informatics, SIC, Saarbrücken, Germany
Saarbrücken Graduate School of Computer Sciences, SIC, Saarbrücken, Germany
   Tomasz Kociumaka ORCID Max Planck Institute for Informatics, SIC, Saarbrücken, Germany
Abstract

A Random Access query to a string T asks for the character T[i] at a given position i[0..|T|). This fundamental task admits a straightforward solution with constant-time queries and 𝒪(nlogσ) bits of space when T[0..σ)n. While this is the best one can achieve in the worst case, much research has focused on the compressed setting: if T is compressible, one can hope for a much smaller data structure that still answers Random Access queries efficiently.

In this work, we investigate the grammar-compressed setting, where T is represented by a context-free grammar that produces only T. Our main result is a general trade-off that optimizes Random Access time as a function of the string length n, the grammar size (the total length of productions) g, the alphabet size σ, the data structure size M, and the word size wΩ(logn) of the word RAM model. For any data structure size M satisfying glogn<Mw<nlogσ, we show an 𝒪(M)-size data structure that answers Random Access queries in time

𝒪(lognlogσMwlogMwglogn).

We also prove a matching unconditional lower bound that holds for all parameter regimes except very small grammars (gw1+o(1)logn) and relatively small data structures (Mwglognwo(1)). The lower bound applies to word-RAM query time and, more strongly, to the worst-case cell-probe complexity of nondeterministic or bounded-error randomized query algorithms.

Previous work focused on optimizing the query time as a function of n only, achieving 𝒪(logn) time using 𝒪(g) space [Bille, Landau, Raman, Sadakane, Satti, Weimann; SIAM J. Comput. 2015] and 𝒪(lognloglogn) time using 𝒪(glogϵn) space for any constant ϵ>0 [Belazzougui, Cording, Puglisi, Tabei; ESA 2015], [Ganardi, Jeż, Lohrey; J. ACM 2021]. Our result improves upon these bounds (strictly for g=n1o(1)) and generalizes them beyond M𝒪(gpolylogn), yielding a smooth interpolation with the uncompressed setting of Mw=nlogσ bits.

Thus far, the only tight lower bound [Verbin and Yu; CPM 2013] was Ω(lognloglogn) for w=Θ(logn), nΩ(1)gn1Ω(1), and M=glogΘ(1)n. In contrast, our result yields a tight bound that accounts for all relevant parameters and is valid for almost all parameter regimes.

Our bounds remain valid for run-length grammars, where production sizes use run-length encoding. This lets us recover (and, for strings with small run-length grammars, improve) the trade-offs achieved by block trees, formulated in terms of the LZ77 size z [Belazzougui, Cáceres, Gagie, Gawrychowski, Kärkkäinen, Navarro, Ordóñez, Puglisi, Tabei; J. Comput. Syst. Sci. 2021] and substring complexity δ [Kociumaka, Navarro, Prezza; IEEE Trans. Inf. Theory 2023].

Our data structure admits an efficient deterministic construction algorithm. Beyond Random Access, its variants also support substring extraction (with optimal additive overhead 𝒪(mlogσw) for a length-m substring, provided that Mg), as well as rank and select queries.

All our results rely on novel grammar transformations that generalize contracting grammars [Ganardi; ESA 2021] and achieve the optimal trade-off between grammar size and height while enforcing extra structure crucial for constant-time navigation in the parse tree.

Keywords and phrases:
grammar-based compression, straight-line programs, random access problem
Category:
Track A: Algorithms, Complexity and Games
Copyright and License:
[Uncaptioned image] © Anouk Duyster and Tomasz Kociumaka; licensed under Creative Commons License CC-BY 4.0
2012 ACM Subject Classification:
Theory of computation Data compression
; Theory of computation Cell probe models and lower bounds
Related Version:
Full Version: https://arxiv.org/abs/2602.10864v2 [18]
Acknowledgements:
The authors thank an anonymous reviewer for exceptionally careful reading.
Editors:
Sayan Bhattacharya, Danupon Nanongkai, Michael Benedikt, and Gabriele Puppis

1 Introduction

Random Access is arguably the most basic query one can ask about a string and a fundamental building block of classic string-processing algorithms. For a string TΣ and a position i[0..|T|), it asks for the i-th character T[i]Σ of T.111We adhere to 0-based indexing of strings, that is, T=T[0]T[|T|1]. For a,b, we denote [a..b]={k:akb} and (a..b)={k:a<k<b}. Half-open integer intervals [a..b) and (a..b] are defined analogously. In the standard representation of strings as arrays, Random Access trivially takes constant time. For strings over integer alphabets Σ=[0..σ), constant-time Random Access can still be supported using a packed representation in Θ(nlogσ) bits thanks to the bit-manipulation operations available in the standard word RAM model. Up to a constant factor, this simple data structure matches the information-theoretic lower bound of nlogσ bits.222All logarithms in this work are binary unless another base is provided. More advanced tools [15] come even closer, achieving nlogσ+𝒪(log2n) bits.

The complexity landscape of Random Access queries becomes much more interesting in the compressed setting, where we aim to achieve much smaller data structures for some “compressible” strings at the price of marginally larger data structures for the remaining “incompressible” strings. Every injective function C:Σ{0,1} can be seen as a compression method, but few such functions admit an efficient query algorithm for Random Access. In particular, the most popular compressors such as arithmetic coding [27], Lempel–Ziv parsing [53], or run-length encoded Burrows–Wheeler transform [8] do not natively support Random Access in no(1) time. Since Random Access is needed for most string-processing algorithms, a lot of research has been devoted to understanding how much extra space is needed to enable such support. This question formally asks what trade-offs are possible between the data structure size and its Random Access query time, where both complexities are measured not only in terms of the length n and alphabet size σ of the input string T but also a parameter s(T) capturing the size of its compressed representation.

In this work, we focus on the so-called highly-compressible regime, where typical space complexities are of the form 𝒪(s(T)) or 𝒪(s(T)polylogn) rather than s(T)+o(n). In this setting, a clean formalization that captures many compressors is grammar-compression [46, 32]: the input string T is encoded using a context-free grammar 𝒢 that produces T and no other string. Such a grammar is a straight-line grammar (SLG) because it cannot use circular dependencies between variables or define multiple productions for the same variable. The underlying compressibility measure, denoted g(T), is the size (total production length) of the smallest grammar generating T. A long line of works has aimed to understand the complexity of Random Access in SLG-compressed strings:

SLG Random Access
Parameters: n,g,σ>0

Input: A string T[0..σ)n represented by an SLG of size at most g.

Queries: Given a position i[0..n), return T[i].

Time-space trade-offs for this problem are inherently related to the trade-offs between the grammar height (the height of the underlying parse tree, i.e., the worst-case number of productions needed to derive a given character of T) and its size. In 2002, parallel works of Charikar et al. [9] and Rytter [47] showed that if T is produced by an arbitrary SLG of size g, it is also produced by a balanced SLG of height 𝒪(logn) and size 𝒪(glogng). This immediately implies 𝒪(logn)-time Random Access using a data structure of size 𝒪(glogng).333We state all results in the word RAM model. In the introduction, we typically use word size w=Θ(log(nσ)), and we measure space complexities in machine words. Later on, we switch to bits and treat w as a separate parameter. A decade later, a breakthrough of Bille et al. [7] achieved 𝒪(logn)-time Random Access using 𝒪(g) space. On the lower-bound side, an influential work of Verbin and Yu [51] showed that an 𝒪(gpolylogn)-space data structure cannot support o(lognloglogn)-time Random Access in their hard regime. Shortly afterward, Belazzougui et al. [5] proved that 𝒪(lognloglogn) query time is achievable in 𝒪(glogϵn) space for balanced SLGs and any constant ϵ>0. In a recent milestone, Ganardi, Jeż, and Lohrey [24] showed every SLG can be balanced while keeping its size at 𝒪(g); this immediately recovers the trade-off of [7] and proves that the trade-off of [5] is valid for every SLG. More generally, one can answer Random Access queries in 𝒪(logτn) time using 𝒪(gτ) space for 2τpolylogn.

A common limitation of all these previous works is that they measure the Random Access time as a function of n only. The lower bound of [51] is only valid when nΩ(1)gn1Ω(1),444Verbin and Yu [51] also prove a separate lower bound for a particular value glog2+o(1)n, which depends on n and the data structure size Mno(1). That result only shows that the query time is at least (logn)1o(1)/logM. so we can hope for faster queries for the cases of gno(1) and, much more importantly for applications, gn1o(1). Moreover, neither the lower bound nor the upper bound applies to data structures of size exceeding 𝒪(gpolylogn). In this work, we aim to characterize what trade-offs are possible.

What is the optimal Random Access time in grammar-compressed strings, as a function of string length n, grammar size g, alphabet size σ, and data structure size M?

On the positive side, we show that, for any τ2, Random Access queries can be answered in 𝒪(logτnlogσgτlogn) time555In the introduction, we follow the convention that time complexity 𝒪(t) should be read as 𝒪(max(1,t)). using 𝒪(gτ) space. Phrased in terms of M rather than τ, this reads as follows:

Theorem 1.1.

Let 𝒢 be an SLG of size g generating a string T[0..σ)n. In the word RAM model with word size wΩ(log(nσ)), given 𝒢 and any value M with glogn<Mw<nlogσ, one can in 𝒪(Mwlogn) time construct an 𝒪(M)-size data structure supporting Random Access queries in time

𝒪(lognlogσMwlogMwglogn).

Already in the regime of 𝒪(g) space, we improve the query time from 𝒪(logn) to 𝒪(lognlogσglogn). Our time bound smoothly interpolates between logarithmic for gn1Ω(1) and constant for gΩ(nlogσlogn). Since every string can be produced by an SLG of size g𝒪(nlogσlogn), we recover the standard uncompressed bound: 𝒪(1) time using 𝒪(nlogσ) bits. Allowing more space, we generalize the trade-off of [5] beyond τpolylogn and strictly improve upon it when gn1o(1). In particular, we get 𝒪(1) query time already using 𝒪((glogn)1ϵ(nlogσ)ϵ) bits for a constant ϵ>0.

On the lower-bound side, our main result is that the query time of Theorem 1.1 is optimal for all parameter regimes except for very small grammars and relatively small data structures.

Theorem 1.2.

Consider integers n,g,σ,M,w,t>0 and a real constant ϵ>0 such that ng, nσ2, Mwglogn(wlogn)ϵ, and g25w1+ϵlogn. Suppose that, for every instance of SLG Random Access with parameters n,g,σ, there is a data structure of M w-bit machine words that answers each query by accessing t of these machine words. Then,

tΩ(lognlogσMwlogMwglogn).

This bound remains valid for nondeterministic and randomized data structures with two-sided error.

In the most studied setting of w=Θ(logn), our tight lower bound applies to all grammar sizes except glog2+o(1)n and all data structure sizes except Mglogo(1)n. As noted already in [51], log2n is a natural barrier: if glog2δn for some constant δ>0, then the query algorithm could read the entire grammar using log1δ+o(1)n memory accesses. The limitation Mglogo(1)n is shared with most static data-structure lower bounds, which typically capture space complexity only up to sub-logarithmic factors, except for a handful of isolated problems; see [35]. Whether o(logn) query time can be achieved in 𝒪(g) space remains a long-standing open problem.

Beyond SLGs.

In [10, 39], the 𝒪(logn)-time 𝒪(g)-space trade-off for SLG Random Access [7, 24] has been generalized to run-length straight-line grammars (RLSLGs) [40], which differ from SLGs in that production sizes are measured in terms of run-length encoding size rather than length. Equivalently, in RLSLGs, productions of the form ABk for k>0 are assumed to be of size one. The size of the smallest RLSLG generating T satisfies g𝗋𝗅𝖾(T)g(T), so RLSLG Random Access is at least as hard as SLG Random Access, and the lower bound of Theorem 1.2 generalizes automatically. Even though we are not aware of any previous work generalizing the trade-off of [5] to RLSLGs, in [18, Section 6] we state and prove our upper bound of Theorem 1.1 already in the stronger RLSLG variant (without any penalty).

A notable advantage of g𝗋𝗅𝖾(T) is that it is a tighter upper bound of further measures, including the LZ77 size z(T) [53] and the substring complexity δ(T) [45, 33], which satisfy δ(T)z(T)g𝗋𝗅𝖾(T)g(T). In particular, g𝗋𝗅𝖾(T)𝒪(δ(T)lognlogσδ(T)logn)𝒪(z(T)lognlogσz(T)logn), and the first of these bounds fails for g(T) [33]. Thanks to this characterization of g𝗋𝗅𝖾(T), Theorem 1.1 recovers the Random Access trade-offs of block trees formulated in [4, 33] using z(T) and δ(T), respectively. Moreover, we derive from Theorem 1.2 that these trade-offs are optimal, as functions of z(T) and δ(T), respectively, in a wide range of parameter regimes.

Corollary 1.3 (see [18, Section 9]).

For every string T[0..σ)n and all parameters dδ(T), τ2, and dτsdτlogτnlogσdlogn, there is a data structure of size 𝒪(s+dτlogτnlogσslogn) supporting Random Access queries in time 𝒪(logτnlogσslogn). This query time is optimal if nσ2, τlogϵn, and dlog2+ϵn for a constant ϵ>0, even restricted to strings satisfying dg(T)z(T)δ(T).

Beyond Random Access.

Many previous data structures for (RL)SLG Random Access support extracting not only individual characters but also substrings of T of arbitrary length m, with the additive time overhead of 𝒪(m) [7, 10, 39] or, if the substring is returned in the packed representation, 𝒪(m/logσn) [5] or 𝒪(m/logσnlogτnlogσslogn) [4, 33]. We generalize Theorem 1.1 to achieve the optimal overhead of 𝒪(m/logσn). Moreover, ours is the first solution that outputs the packed representation and comes with an efficient construction.

Theorem 1.4.

Let 𝒢 be an RLSLG of size g generating a string T[0..σ)n. In the word RAM model with word size wΩ(log(nσ)), given 𝒢 and any value M with glogn<Mw<nlogσ, one can in 𝒪(Mwlogn) time construct an 𝒪(M)-size data structure that extracts any length-m substring in time

𝒪(lognlogσMwlogMwglogn+mlogσwM+gM).

More generally, we support fast character iterators that, upon initialization at position i, can in constant time move in either direction by 𝒪(logσn) positions and output the characters at the intermediate positions. None of the previous works achieves this without amortization for σno(1).

Our approach readily generalizes to computing various aggregate information about the prefixes of T, modeled by the prefix sum problem in which every character aΣ is mapped to an element Φ(a) of a monoid. In particular, similarly to [7, 5, 24, 39, 10, 33], we support rank and select queries, asking for the number of occurrences of a given character aΣ in the prefix T[0..i) and the position of the r-th leftmost occurrence of a in T, respectively.

Theorem 1.5.

Let 𝒢 be an RLSLG of size g generating a string T[0..σ)n. In the word RAM model with wΩ(log(nσ)), given 𝒢 and any value M with glogn<Mw<n, one can in 𝒪(Mwσlogn+gσlogn) time construct an 𝒪(Mσ)-size data structure supporting rankT and selectT queries in time

𝒪(lognMwlogMwglogn).

For constant alphabet size σ, this result matches our time-space trade-off for Random Access. It is also straightforward to see that, already for σ=2, rank and select queries are at least as hard as Random Access,666For rank, note that T[i]=1 if and only if rankT,1(i)<rankT,1(i+1). For select, we map T through a morphism 010 and 101, preserving n and g up to a constant factor. The resulting string T satisfies selectT,1(i)=2i+T[i]. so our bounds remain tight for almost all parameter regimes. The only penalty that we suffer already for σ𝒪(1) is the extra 𝒪(glogn) term in the construction algorithm. As we discuss in [18, Section 8], this term arises only for select, and only when gn/log1+o(1)n. It is an artifact of our usage of Elias–Fano encoding [19, 20], which currently lacks an efficient construction from the packed input representation using variable-length gap encoding.

In general, similarly to all previous data structures in grammar-compressed space, ours suffers from a σ-factor overhead in space complexity (and construction time). Reducing this overhead, possibly at the cost of slight increase in the query time, remains a major open question. As noted in [5, Section 6], this would require breakthroughs for counting paths between DAG vertices.

1.1 Our Techniques

We prove Theorems 1.1, 1.4, and 1.5 by converting the input (RL)SLG into an equivalent shallow grammar that admits fast navigation in its parse tree. Let 𝒢 be an (RL)SLG and let A𝒜𝒢 be a symbol (variable or terminal). We write 𝗋𝗁𝗌𝒢(A) for the right-hand side of its production (a string over 𝒜𝒢) and 𝖾𝗑𝗉𝖺𝗇𝖽(A)𝒢 for its full expansion (the unique string over terminals derived from A).

Random Access can be implemented recursively. Suppose A is a variable with production AB0Bk1, and we are asked to retrieve 𝖾𝗑𝗉𝖺𝗇𝖽(A)𝒢[i]. Then there is a unique j[0..k) such that |𝖾𝗑𝗉𝖺𝗇𝖽(B0Bj1)𝒢|i<|𝖾𝗑𝗉𝖺𝗇𝖽(B0Bj)𝒢|, and the query recurses on the symbol Bj and the shifted index i|𝖾𝗑𝗉𝖺𝗇𝖽(B0Bj1)𝒢|. We denote the task of finding this j by 𝖼𝗁𝗂𝗅𝖽A. It is a rank query over the prefix sums |𝖾𝗑𝗉𝖺𝗇𝖽(B0Bj)𝒢|, asking for the number of such sums that are at most i.

Grammar balancing [24] yields grammars of height 𝒪(logn), size 𝒪(g), and production lengths k2, leading to 𝒪(logn)-time Random Access in 𝒪(g) space. To reduce the query time to 𝒪(logng), we would like to decrease the height to 𝒪(logng) by creating a new length-Θ(g) right-hand side of the starting symbol S. This is where our first obstacle appears: even if every variable A has recursion depth 𝒪(log|𝖾𝗑𝗉𝖺𝗇𝖽(A)𝒢|), a natural process starting with S and exhaustively replacing all symbols longer than ng by their right-hand sides may create a sequence of Θ(glogn) symbols, exceeding 𝒪(g) space. We avoid this by working with contracting grammars [23], where a variable B can appear on the right-hand side of a variable A only if |𝖾𝗑𝗉𝖺𝗇𝖽(B)𝒢|12|𝖾𝗑𝗉𝖺𝗇𝖽(A)𝒢|. We show in [18, Lemma 5.11] how this implies that the same process produces a sequence of 𝒪(g) symbols of length at most ng, thus reducing 𝖼𝗁𝗂𝗅𝖽S to a rank query on an 𝒪(g)-element set of prefix sums. This query can then be implemented in 𝒪(logng) time [7] or even in 𝒪(loglogng) time [3].

For a more general trade-off with 𝒪(logτng) query time, we want to similarly increase the fan-out of every other variable A to Θ(τ) so that the height becomes 𝒪(logτng)𝒪(1+logτngτ). Here, an obstacle is that we have to implement 𝖼𝗁𝗂𝗅𝖽A in constant time in order to avoid extra factors in Random Access time. This is possible for τpolylogn using fusion trees [21], which is why the previous trade-offs [5] were limited to small τ. Our key structural notion is τ-niceness ([18, Definition 5.10]): as for the start symbol, we replace 𝗋𝗁𝗌𝒢(A) by a longer right-hand side 𝗋𝗁𝗌τ(A) of 𝒪(τ) symbols of length at most 1τ|𝖾𝗑𝗉𝖺𝗇𝖽(A)𝒢| each. Crucially (see [18, Lemma 5.11]), the contracting property of 𝒢 implies a strong locality condition: any substring of 𝖾𝗑𝗉𝖺𝗇𝖽(A)𝒢 of length at most 1τ|𝖾𝗑𝗉𝖺𝗇𝖽(A)𝒢| intersects only 𝒪(logτ) consecutive symbols of 𝗋𝗁𝗌τ(A). Thus, by storing the answers to Θ(τ) evenly spaced rank queries, we reduce every 𝖼𝗁𝗂𝗅𝖽A to a rank query in a set of size 𝒪(logτ), which we answer in constant time using fusion trees (see [18, Lemma 6.1]). Combining this with a standard shortcut (storing 𝖾𝗑𝗉𝖺𝗇𝖽(A)𝒢 explicitly whenever |𝖾𝗑𝗉𝖺𝗇𝖽(A)𝒢|logσn) yields the trade-off of Theorem 1.1. The approach extends to RLSLGs once we generalize the transformation of [23] appropriately ([18, Corollary 5.8]; a parallel work [11] achieves almost the same generalization).

Substring Extraction.

To extract any substring of T with constant delay per character using an 𝒪(g)-size data structure, we could simply use the character iterators of [25] or [37], with slight adaptations to support RLSLGs and have construction time matching our Random Access. Outputting blocks of b=Θ(logσn) characters with constant delay is much more challenging; see [5]. The underlying issue is that a long variable A may contain a very short child B (even of constant expansion length), so a character-by-character traversal cannot be turned into a block-by-block traversal by local shortcuts alone. We address this by converting 𝒢 into a b-leafy grammar: leaf variables have expansion length Θ(b), while the remaining top variables have constant-size right-hand sides over top and leaf variables only. Treating leaf variables as terminals yields a grammar for a shorter string of length Θ(n/b), whose characters represent blocks of Θ(b) characters of T. Hence, standard character iterators can output one leaf per step, i.e., Θ(b) characters at a time. To preserve lengths under this reinterpretation, we lift most constructions to weighted strings, assigning each leaf a weight equal to its original expansion length. This is how we prove Theorem 1.4.

Prefix Aggregation, rank, and select.

Prefix aggregation queries can be handled similarly to Random Access: during the same root-to-leaf traversal, we maintain the monoid aggregate of the already traversed prefix, yielding 𝒪(logτngτ) time once 𝖼𝗁𝗂𝗅𝖽A is supported in constant time. The rankT,a query is the special case where each character is mapped to 0 or 1 and the aggregate is the sum. As in previous works [5, 43], for selectT,a, we first transform T so that each character encodes a block of non-a characters followed by an a, reducing select to a prefix aggregation query on the transformed string. Obtaining the bound in Theorem 1.5 (with gτlogn in the denominator) requires a succinct structure for the leaf variables; we use Elias–Fano encoding [19, 20].

Lower Bound.

We prove Theorem 1.2 in the nondeterministic cell-probe model, formulated in terms of certificates by Wang and Yin [52], as well as in the randomized cell-probe model with two-sided bounded error. We use a reduction from Blocked Lopsided Set Disjointness (BLSD) [41], extending the construction of Verbin and Yu [51] behind the lower bound discussed in Footnote 4 by introducing a tunable splitting parameter Q. The key idea is that, instead of answering a single BLSD query using one Random Access query in a highly compressible string (glog2n), we answer it using Q Random Access queries in a moderately compressible string (roughly gQlog2nQ). This simple idea not only recovers the other lower bound of [51] (for nΩ(1)gn1Ω(1)) but also readily generalizes it to almost all parameter regimes. The original proof of Verbin and Yu [51] also ultimately relies on the hardness of BLSD, but it passes through a several-step chain of reductions from [41, 51]. In the randomized setting, errors could accumulate across all Q Random Access queries, so our reduction uses an extra subroutine that repeats some queries using multiple copies of the data structure in order to derive a bounded-error communication protocol for BLSD that violates the lower bound of [41]. No such subroutine appears in [41], which is why their randomized cell-probe lower bounds only work in the zero-error models. In the nondeterministic setting, this issue disappears; the remaining annoyance, shared with the randomized setting, is the amount of calculations needed to map between all the parameters in the reduction.

1.2 Related Work

Random Access has been studied from a multitude of perspectives for dozens of compressibility measures s(T). Early milestone results provide constant-time random access to entropy-compressed strings, achieving nH0(T)+o(n) bits for binary strings [44] and nHk(T)+o(nlogσ) bits for strings over larger alphabets [48] (for k<o(logσn)); see also [26] for a survey. Unfortunately, low-order entropy does not capture large-scale repetitions, and the lower-order terms in these data structures are relatively large, which makes them unsuitable for highly compressible strings. That regime brings a whole zoo of compressibility (repetitiveness) measures; see [38] for a dedicated survey, which discusses which measures support efficient random access. In space 𝒪(s(T)polylogn), the best one can typically hope for (in highly compressible strings) is 𝒪(lognloglogn) Random Access time: see [13] for a work that generalizes the lower bound of [51] to many measures that are not bounded by 𝒪(g(T)polylogn). An exception is LZ78 [54], for which 𝒪(loglogn)-time access is possible [16]. Unfortunately, it is not known how to support Random Access queries efficiently (e.g., in no(1) time) in space proportional to the size z(T) of the LZ77 parsing or r(T) of the run-length encoded Burrows–Wheeler transform. The latter is particularly surprising given 𝒪(r(T))-space data structures supporting pattern-matching queries [22], which often makes Random Access the sole bottleneck; see [2]. There exists, however, a trade-off between Random Access time and an additive term on top of a succinct encoding of 𝗋𝗅𝖾(𝖡𝖶𝖳(T)) [50]. The lack of efficient access in 𝒪(z(T)) space motivated the introduction of more restricted variants like LZ-End [34], which support Random Access in 𝒪(polylogn) time [31], height-bounded LZ [1], bounded-access-time LZ [36], and LZBE [49]. Further works for Random Access in grammar-compressed strings include schemes providing faster access to characters that are close to static bookmarks [12] or dynamic fingers [6, 23], or located in incompressible regions [11]. Very recently, Random Access has also been studied for two-dimensional grammar-compressed strings [14].

1.3 Open Problems

The most important open problem about grammar-compressed Random Access remains whether o(logn)-time queries can be achieved in 𝒪(g) space for any gn1Ω(1). We hope that our direct reduction from BLSD will inspire renewed efforts to tackle this question from the lower-bound side. A more structured variant that seems as difficult as the general case is when each production is of length two and each expansion length is a power of two; in that case, no balancing is needed and 𝖼𝗁𝗂𝗅𝖽A queries remain trivial for every τ. With appropriate parameters, our lower bound of Theorem 1.2 only produces grammars of this form, albeit ones supporting 𝒪(lognloglogn)-time queries.

Another task stemming from the limitations of Theorem 1.2 is to understand whether SLG Random Access becomes easier for very small g (e.g., g𝒪(logn)) in the word RAM model.

Since every SLG can be encoded in 𝒪(glogg) bits, for very small grammars (gno(1)) it is also open to achieve efficient (e.g., polylogarithmic-time) Random Access queries in 𝒪(glogg) bits.

Compressibility measures closely related to g(T) pose many further interesting and long-standing problems. In particular, it is not known how to answer Random Access queries in no(1) time and in 𝒪(z(T)) or 𝒪(r(T)) space (where r(T) is the number of runs in the Burrows–Wheeler transform).

Very recently [30], Ω(lognloglogn) lower bounds for moderately compressible strings have been proved for many queries beyond Random Access, including suffix array and inverse suffix array queries. Can one generalize these lower bounds to almost all parameter regimes, similarly to Theorem 1.2? Further queries, such as Longest Common Extension and Internal Pattern Matching, are at least as hard as Random Access, so the lower bounds translate automatically. However, for those queries it remains open if the existing upper bounds [28, 29, 17] (formulated in terms of δ(T) or z(T)) can be improved for weakly compressible strings and generalized to smooth interpolations with the uncompressed setting, in the spirit of Corollary 1.3.

Finally, we leave for future work whether our techniques can help in settings where the characters at some positions are supposed to be more easily accessible than others, e.g., due to bookmarks [12] or fingers [6, 23]. Currently, we only achieve this functionality by varying character weights, but the weight needs to be the same across occurrences of the character.

2 Preliminaries

Let Σ be some finite set. Let T=t0tn1Σ. We call T a string (or sequence) of length |T|n over the alphabet Σ. We use character notation T[i]ti for i[0..|T|) and substring notation T[i..j)titj1 for 0ij|T|.

Let ak for character aΣ and integer k>0 denote the k-fold repetition of a; we also refer to it as the k-th power of a. Given any sequence Ta0k0a1k1am1km1Σ, where aiai+1 for i[0..m1) and ki>0 for i[0..m), we define its run-length encoding 𝗋𝗅𝖾(T)=(a0,k0)(a1,k1)(am1,km1). Note that |𝗋𝗅𝖾(T)|m.

Straight-Line Grammars.

We call 𝒢(𝒱𝒢,Σ𝒢,𝗋𝗁𝗌𝒢:𝒱𝒢(𝒱𝒢Σ𝒢),S,:𝒢Σ𝒢1) a weighted straight-line grammar (SLG) with variables 𝒱𝒢, terminals Σ𝒢, right-hand sides 𝗋𝗁𝗌𝒢, start symbol S𝒱𝒢Σ𝒢, and weight function 𝒢 if there is an order 𝒢 on 𝒱𝒢 such that B𝒢A holds whenever B appears in 𝗋𝗁𝗌𝒢(A). We call 𝒜𝒢𝒱𝒢Σ𝒢 the set of symbols. When clear from context we drop the subscript 𝒢. The size |𝒢| of an SLG 𝒢 is the sum of the lengths of all right-hand sides.

Straight-line grammars whose right-hand sides are stored in run-length encoded form are called run-length straight-line grammars (RLSLGs). Their semantics are unchanged; only the size is measured as the sum of the lengths of the run-length-encoded right-hand sides. Whenever we construct an (RL)SLG from another (RL)SLG, we assume that if the input is an SLG (i.e., without runs), then the output is also an SLG. Usually, we bound the size of every individual rule. Note that this size is measured differently for SLGs and RLSLGs.

The expansion of a terminal aΣ𝒢 is 𝖾𝗑𝗉𝖺𝗇𝖽(a)𝒢a. We extend expansions recursively to variables and sequences of symbols:

𝖾𝗑𝗉𝖺𝗇𝖽(A)𝒢{𝖾𝗑𝗉𝖺𝗇𝖽(𝗋𝗁𝗌(A))𝒢if A𝒱𝒢,i[0..|A|)𝖾𝗑𝗉𝖺𝗇𝖽(A[i])𝒢if A𝒜𝒢.

We say that a symbol or a sequence of symbols A expands to the string 𝖾𝗑𝗉𝖺𝗇𝖽(A)𝒢. The grammar 𝒢 produces the string 𝖾𝗑𝗉𝖺𝗇𝖽(S)𝒢. It defines the strings 𝖾𝗑𝗉𝖺𝗇𝖽(A)𝒢 for all A𝒜𝒢.

Let L𝒢{𝖾𝗑𝗉𝖺𝗇𝖽(A)𝒢:A𝒜𝒢} denote the set of strings defined by 𝒢. If L𝒢L, then we say that defines all strings defined by 𝒢. We call the function f:𝒜𝒢𝒜 a grammar homomorphism from 𝒢 to if 𝖾𝗑𝗉𝖺𝗇𝖽(A)𝒢=𝖾𝗑𝗉𝖺𝗇𝖽(f(A)) holds for every A𝒜𝒢. The existence of such a homomorphism implies L𝒢L.

If the weight function :𝒢Σ𝒢>0 is not stated explicitly, we assume it is the unit function 𝒢1. We call such a grammar unweighted. We extend the weight function recursively to variables and sequences of symbols:

A𝒢{𝗋𝗁𝗌(A)𝒢if A𝒱𝒢,i[0..|A|)A[i]𝒢if A𝒜𝒢.

For every sequence of symbols A, the property A=𝖾𝗑𝗉𝖺𝗇𝖽(A)𝒢|𝖾𝗑𝗉𝖺𝗇𝖽(A)𝒢| holds.

The height 0pt𝒢(A) of every symbol A𝒜𝒢 is also defined recursively:

0pt𝒢(A){0if AΣ𝒢,0if A𝒱𝒢 and 𝗋𝗁𝗌𝒢(A)=ε,1+maxi0pt𝒢(Ai)if A𝒱𝒢 and 𝗋𝗁𝗌𝒢(A)=A0Ak1 for k1.

Parse Trees.

We call the following directed graph the parse tree of a weighted SLG. Here, each node is a pair (A,a) consisting of a symbol A and a weighted offset a into the expansion of the start symbol.

Definition 2.1.

Let 𝒢=(𝒱,Σ,𝗋𝗁𝗌,S,) be an (RL)SLG. We call the directed graph P𝒢 the parse tree of 𝒢 if it is the smallest graph such that:

  1. 1.

    P𝒢 contains a node (S,0);

  2. 2.

    for every node u(A,a) with A𝒱 and 𝗋𝗁𝗌(A)=B0Bk1, and for every i[0..k), the parse tree P𝒢 contains a node vi(Bi,a+j=0i1Bj) and an edge (u,vi).

Note that, for every node (A,a) of the parse tree P𝒢, the height 0pt(A) is equal to the number of edges of the longest path from (A,a) to a leaf of P𝒢 (the height of the subtree rooted at (A,a)).

3 The Upper Bounds: Overview

This section overviews [18, Sections 5 to 8], which contain the upper-bound proofs behind Theorems 1.1, 1.4, and 1.5. As discussed in Section 1.1, the core theme is to transform an input grammar into a form that admits constant-time local navigation, while keeping the grammar shallow and the overall size under control. All transformations are phrased in terms of grammar homomorphisms, so they preserve expansions and let us switch to more structured grammars producing the same strings.

Random Access in Weighted Strings and Parse-Tree Viewpoint.

Most of our results are stated for strings over weighted alphabets (Σ,). In that setting, a random access query is given i[0..T) and returns T[j] for the unique position j[0..|T|) such that T[0..j)i<T[0..(j+1)). If needed, we can also output the offset T[0..j) and the position j.

Random Access in a string T produced by an (RL)SLG 𝒢 corresponds to descending the parse tree P𝒢: we maintain a node (A,a) with i[a..a+A) and repeatedly move to the child (B,b) whose interval [b..b+B) contains i, until a terminal is reached [18, Algorithm 1]. This transition step is implemented by a 𝖼𝗁𝗂𝗅𝖽A query. For 𝗋𝗁𝗌𝒢(A)=B0Bk1, 𝖼𝗁𝗂𝗅𝖽A reduces to a rank query in XA={B0Bj1:j[1..k]} on input ia; see [18, Lemma 6.1]. Thus, the overall query time is governed by (i) the per-node cost of 𝖼𝗁𝗂𝗅𝖽A and (ii) the depth of P𝒢; the goal is to optimize both.

Contracting Grammars.

The first step is to obtain a grammar in which every variable shrinks in a controlled way along parse-tree edges. Ganardi [23] introduced contracting SLGs, requiring that every child B of a variable A satisfies BA/2. He proved that every SLG 𝒢 can be homomorphically embedded into a contracting SLG of size 𝒪(|𝒢|) and production lengths bounded by some constant d. Although the final result in [23] is established for the unweighted case, the key ingredients of its proof already use weighted SLGs. In [18, Theorem 5.5], we extend the statement and the remaining arguments to fully incorporate the weighted perspective. This extension makes it easy to lift the result to RLSLGs in [18, Corollary 5.8].777A parallel independent work [11] proves the same result, albeit for unweighted RLSLGs only. We treat these results as black boxes, relying only on the constant bound d on right-hand side size (number of symbols or runs of symbols).

From Contracting to Nice.

The contracting property already implies logarithmic height h(A)𝒪(log|𝖾𝗑𝗉𝖺𝗇𝖽(A)𝒢|) for every symbol A𝒜𝒢, but to obtain the desired trade-off we need faster shrinkage. For τ>1, a child B of A is τ-heavy if B>1τA, and τ-light otherwise; see [18, Definition 5.9]. We also impose a local regularity condition that later yields 𝒪(1)-time 𝖼𝗁𝗂𝗅𝖽A implementation.

In [18, Definition 5.10], we call a variable A τ-nice if:

  1. (a)

    every variable child in 𝗋𝗁𝗌(A) is τ-light;

  2. (b)

    𝗋𝗁𝗌(A) has at most 2dτ runs (or symbols, for SLGs);

  3. (c)

    every substring X of 𝗋𝗁𝗌(A) of weight at most 1τA has at most 2dlogτ runs.

The key construction in [18, Lemma 5.11] starts from a contracting grammar and replaces 𝗋𝗁𝗌(A) by a sequence 𝗋𝗁𝗌τ(A)𝒜𝒢, obtained by exhaustively replacing all τ-heavy children with their right-hand sides. The construction runs in time 𝒪(τ) and ensures (b) and (c); its proof is an induction on logτ via the recursion ττ/2. The only difference between 𝗋𝗁𝗌τ/2(A) and 𝗋𝗁𝗌τ(A) is that τ-heavy children are replaced by their right-hand sides; thanks to the contracting property, these replacements can happen in parallel, and there are 𝒪(τ) of them in total and 𝒪(1) in a substring of weight at most 1τA. Each replacement produces at most d runs, so the bounds in (b) and (c) grow by 𝒪(dτ) and 𝒪(d) compared to τ/2.

We apply this process to all variables, with τr for the starting symbol and τv for the remaining ones, to obtain what we call a (τr,τv)-nice grammar of size 𝒪(τr+|𝒢|τv). In the resulting parse tree, the depth of every node (A,a) is at most 2+max(0,logτvS𝒢τrA); see [18, Lemma 5.14].

Leafy Grammars: Packing 𝒃 Characters per Leaf.

To exploit bit-parallelism when σ is small, we introduce b-leafy grammars; see [18, Definition 5.15]. Here variables split into: leaf variables 𝒱leaf expanding to explicit terminal strings of length in [b. .2b), and top variables 𝒱top whose right-hand sides contain only (top and leaf) variables. The top part top treats leaf variables as terminals and captures the global structure, while leaf variables store the explicit blocks (packed into 𝒪(blogσ) bits, so 𝒪(1) words for our choices of b). The construction in [18, Lemma 5.17] guarantees |top|,|𝒱leaf|𝒪(|𝒢|) and runs in time 𝒪(|𝒢|(1+blogσ/w)): we maintain only 𝒪(1) helper variables per original variable and generate each explicit block directly as a packed string. The produced top rules have a deliberately restricted form: the homomorphic image of each variable of 𝒢 with expansion length at least b is a top variable whose right-hand side consists of at most two leaf variables plus possibly a middle top variable in between, and every helper top rule has constant run-length size. This prevents the parse tree from containing long chains of tiny explicit pieces and is the structural reason why the traversal routines in [18, Section 7] can output Θ(b) characters per step.

We then combine leafiness with niceness: [18, Corollary 5.18] builds, from an unweighted RLSLG, a b-leafy grammar whose weighted top part top is (τr,τv)-nice; this is where we need the preceding niceness construction to work for weighted strings. Leafiness yields a further height reduction, giving a height bound of 3+max(0,logτvS𝒢τrb).

Constant-Time 𝗰𝗵𝗶𝗹𝗱 Queries from Niceness.

After the above transformations, the remaining algorithmic bottleneck is answering 𝖼𝗁𝗂𝗅𝖽A at a τ-nice variable A. [18, Lemma 6.1] shows that we can preprocess A in 𝒪(τ) time into 𝒪(τlogA) bits so that 𝖼𝗁𝗂𝗅𝖽A is answered in 𝒪(1) time. At a high level, we store the run-length encoding CA=𝗋𝗅𝖾(𝗋𝗁𝗌(A)) and the cumulative run boundaries PA (prefix weights of runs). Then 𝖼𝗁𝗂𝗅𝖽A((A,a),i) reduces to computing the rank of ia in the set of run boundaries plus arithmetic operations (integer division) to locate i within the run. Condition (c) in τ-niceness implies a local sparsity property: every interval of weighted length 1τA intersects only 𝒪(logτ) run boundaries. This enables a standard bucketing strategy: we partition the universe [0..A) into τ buckets, and inside each bucket store the 𝒪(logτ) boundaries in a constant-time rank structure (fusion tree [21, 42]). The total size of the τ buckets is still 𝒪(τ), so these rank structures take 𝒪(τlogA) bits in total, and they can be constructed in 𝒪(τ) total time.

Random Access: Putting It Together.

For weighted strings, [18, Lemma 6.3] constructs a (|𝒢|τ,τ)-nice grammar and the per-variable 𝖼𝗁𝗂𝗅𝖽A structures, and then answers queries by the parse-tree traversal above. The time becomes the nice height bound, namely 𝒪(max(1,logτT|𝒢|τc)) for the returned character c. For unweighted T[0..σ)n, we additionally apply the leafy transformation with b=Θ(logσn) so each leaf block fits in 𝒪(1) words (when w=Θ(logn)), yielding [18, Lemma 6.4] and the trade-off in Theorem 1.1. We also prove a weighted analog of [18, Lemma 6.4] in [18, Theorem 6.5].

Traversal and Substring Extraction.

[18, Section 7] generalizes random access to a pointer interface that supports constant-time forward/backward traversal. For weighted strings, we show how to traverse characters one by one, building upon [37]. For unweighted strings over small alphabets, we crucially exploit b-leafy grammars. The key is to apply character pointers to the weighted top string Ttop while maintaining an offset inside the current explicit leaf block; a character pointer to T is represented as “(a pointer to Ttop) + (an offset in the current block)”. Because each leaf block has length Θ(b) and is stored packed, each traversal step can return Θ(b) characters in constant time. As a result, [18, Corollary 7.10] supports extracting m consecutive characters around a position in time 𝒪(1+m/b), with construction time matching the random-access trade-off; [18, Corollary 7.11] turns this directly into substring extraction. The final bounds choose b=Θ(min(w,τlogn)/logσ), so the block operations fit in 𝒪(1) words and the additive extraction term becomes mlogσ/min(w,τlogn).

Rank/Select via Prefix Sums.

Finally, [18, Section 8] lifts the entire framework from extracting characters to computing arbitrary monoid-valued aggregates. Given a mapping Φ:Σ(𝐌,,𝟎), prefix-sum queries ask for Φ(T[0..i)). [18, Lemma 8.4 and 8.5] mirror Random Access: we store for each variable the monoid value of its expansion and combine it along the traversed path. Rank follows by instantiating Φ appropriately (mapping a queried character to 1 and the rest to 0). For select, we first transform the string so that each character encodes the number of non-occurrences between consecutive occurrences (i.e., a block of non-a characters followed by an a), reducing selectT,a to a prefix-sum query on the transformed string; see [18, Lemma 8.9]. To obtain the tightest bounds, we additionally build succinct rank/select structures for the short leaf blocks: we use constant-time rank within packed bitmasks and constant-time select in the Elias–Fano encoding ([18, Facts 8.1 and 8.2]), so the extra work and storage at leaves do not introduce additional overhead.

4 The Lower Bound

In this section, we prove cell-probe lower bounds for SLG Random Access against both nondeterministic and bounded-error randomized query algorithms. The lower bounds share the high-level structure and many steps, so we present them in parallel. We first explain the formal settings.

Any data structure problem can be modeled as a function f:𝒳×𝒴𝒵, where x𝒳 is a query, y𝒴 is an input, and f(x,y) is the correct answer. A deterministic cell-probe data structure with M cells of w bits consists of an encoding

D:𝒴({0,1}w)M

and a query algorithm that probes at most t cells. Formally, the query algorithm is given by probe functions A0,,At1 and an output function A𝗈𝗎𝗍, where

Aj:𝒳×({0,1}w)j[0..M)for j[0..t)andA𝗈𝗎𝗍:𝒳×({0,1}w)t𝒵.

For a fixed query x𝒳 and input y𝒴, the probed addresses are

ijAj(x,D(y)[i0],,D(y)[ij1])for j[0..t),

and the returned answer is

D𝗈𝗎𝗍(x,y)A𝗈𝗎𝗍(x,D(y)[i0],,D(y)[it1]).

Correctness means D𝗈𝗎𝗍(x,y)=f(x,y) for all x𝒳 and y𝒴.

In the nondeterministic cell-probe model, the query algorithm additionally receives a hint h from an unbounded domain. Equivalently, the functions A0,,At1,A𝗈𝗎𝗍, and hence also the derived outcome function D𝗈𝗎𝗍, receive h as an extra parameter. Moreover, the output function is allowed to return an extra value . Correctness requires that for every query x𝒳 and input y𝒴,

  • there exists a hint h such that D𝗈𝗎𝗍(x,y,h)=f(x,y), and

  • for every hint h, either D𝗈𝗎𝗍(x,y,h)=f(x,y) or D𝗈𝗎𝗍(x,y,h)=.

Since hints are unbounded, we may assume that a hint specifies the probed cells together with their expected contents, and the algorithm outputs as soon as one probe disagrees with the hint. Thus, a successful hint is simply a set of t cells whose contents determine the answer uniquely. This leads to the notion of certificates due to Wang and Yin [52].

Definition 4.1 (Certificates [52]).

A data structure problem f:𝒳×𝒴𝒵 has (M,w,t)-certificates if there exists a function D:𝒴({0,1}w)M such that, for every query x𝒳 and every input y𝒴, there exists a set C[0..M) with |C|=t such that, for every y𝒴, if D(y)[i]=D(y)[i] for all iC, then f(x,y)=f(x,y).

In the randomized setting, the data structure and the query algorithm share a random seed r drawn uniformly from a finite domain . Formally, both D and the functions A0,,At1,A𝗈𝗎𝗍 receive r as an extra argument. Hence the derived outcome function D𝗈𝗎𝗍 also depends on r. The correctness requirement is that, for every x𝒳 and y𝒴, we have PrrU()[D𝗈𝗎𝗍(x,y,r)=f(x,y)]23.

Definition 4.2.

A data structure problem f:𝒳×𝒴𝒵 admits an (M,w,t)-bounded-error structure if there exist a finite seed domain , an encoding D:𝒴×({0,1}w)M, probe functions Aj:𝒳××({0,1}w)j[0..M) for j[0..t), and an output function A𝗈𝗎𝗍:𝒳××({0,1}w)t𝒵 such that PrrU()[D𝗈𝗎𝗍(x,y,r)=f(x,y)]23 for every x𝒳 and y𝒴.

We will reduce Blocked Lopsided Set Disjointness to SLG Random Access. Recall that, in Lopsided Set Disjointness (LSD), the goal is to decide whether two sets X and Y over a common universe are disjoint. In the data-structure version, one of the sets, say Y, can be preprocessed, while the other set X is revealed at query time. In Blocked LSD (BLSD), the universe is partitioned into N blocks of size B, and the set X must contain exactly one element from each block. Equivalently, an instance of BLSD can be represented by functions S and T, so that, for each i[0..N), the value S(i)[0..B) specifies the unique element of X in the i-th block, whereas T(i)[0..B) specifies the intersection of Y with that block.

Blocked Lopsided Set Disjointness (BLSD) [41]
Parameters: N,B>0

Input: A function T:[0..N)2[0..B).

Queries: Given S:[0..N)[0..B), decide if there exists i[0..N) such that S(i)T(i).

Wang and Yin [52, Theorem 26] proved a certificate lower bound for 2-Blocked-LSD, which imposes an additional distinctness condition within every group of B consecutive blocks, namely S(i)S(i) whenever i/B=i/B. Since this is a more restrictive version of BLSD, it yields the following lower bound for BLSD as well:

Corollary 4.3.

Consider N,B,M,w,t>0 such that M>t, and a real constant λ>0. If BLSD with parameters N,B has (M,w,t)-certificates, then tΩ(NB1λw) or tΩ(NlogBlogMt).

For a lower bound against randomized algorithms, we interpret BLSD as a communication problem with two players: Alice, who receives S, and Bob, who receives T. Pătrașcu [41] proved asymmetric communication complexity lower bounds for this problem:

Theorem 4.4 ([41, Theorem 1.4]).

Consider N,B>0 and a real constant λ>0. In any bounded-error communication protocol for BLSD with parameters N,B, Alice sends at least Ω(NlogB) bits or Bob sends at least Ω(NB1λ) bits.

Next, we reduce BLSD to SLG Random Access. We follow the encoding of Verbin and Yu [51] with a crucial extension that allows answering a single BLSD query using several Random Access queries. The following lemma captures the original reduction of [51].

Lemma 4.5 ([51, Lemma 2]).

Let N,B>0. For every function T:[0..N)2[0..B), there exists an SLG of size at most 4NB producing a binary string V of length BN such that, for every function S:[0..N)[0..B), we have

V[i[0..N)S(i)Bi]=𝟷if and only ifi[0..N)S(i)T(i).

Our generalization splits the input BLSD instances into smaller subinstances before applying Lemma 4.5. The parameter Q controls the number of Random Access queries needed to answer one BLSD query. While keeping the compressed size of the produced string V at Θ(NB), this allows reducing the length of V from BN to QBN/Q. As a result, we obtain a smooth trade-off between storing T explicitly (NB bits) and storing the answers to all queries explicitly (BN bits).

Lemma 4.6.

Let P,Q,B>0. For every function T:[0..PQ)2[0..B), there exists an SLG of size at most 5PQB that produces a binary string V of length QBP such that, for every function S:[0..PQ)[0..B), we have

q[0..Q)V[qBP+p[0..P)S(qP+p)Bp]=𝟷if and only if i[0..PQ)S(i)T(i).

Proof.

Given a BLSD instance of PQ blocks of size B each, we split the instance into Q parts of P consecutive blocks each. Each such part, indexed with q[0..Q), corresponds to blocks i[qP..(q+1)P) and, after shifting this interval by qP, can be interpreted as a BLSD instance of size (P,B). Lemma 4.5 yields a binary string Vq of length BP produced by a grammar 𝒢q of size at most 4PB such that

Vq[p[0..P)S(qP+p)Bp]=𝟷if and only ifp[0..P)S(qP+p)T(qP+p).

The final string V is the concatenation V=q[0..Q)Vq; since Vq=V[qBP..(q+1)BP), this immediately yields the claimed equivalence. Moreover, |V|=QBP and V is produced by a grammar 𝒢 obtained by taking a disjoint union of grammars 𝒢q and introducing a new start symbol (with a production of length Q) capturing the top-level concatenation. The total size of 𝒢 is at most Q4PB+Q5PQB.

Example 4.7.

If P=Q=B=2, then the universe consists of four blocks of size two, which we split into two subinstances on blocks 0,1 and 2,3. The reduction builds a string V=V0V1 of length 222=8, where each Vq has length 4. Consider the following instance:

T(0)={1},T(1)=,T(2)={0},T(3)={1}.

Here, the first subinstance has hits exactly for (S(0),S(1)){(1,0),(1,1)}, so V0=𝟶𝟷𝟶𝟷. Likewise, the second subinstance has hits exactly for (S(2),S(3)){(0,0),(0,1),(1,1)}, so V1=𝟷𝟶𝟷𝟷. Thus, V=𝟶𝟷𝟶𝟷𝟷𝟶𝟷𝟷. For a query S:[0. .4)[0. .2), the two accessed positions are

v0=S(0)+2S(1)andv1=4+S(2)+2S(3).

For instance, if S=(1,0,1,0), then (v0,v1)=(1,5), so the BLSD answer is V[1]V[5]=𝟷𝟶=𝟷. On the other hand, if S=(0,1,1,0), then (v0,v1)=(2,5), so the BLSD answer is V[2]V[5]=𝟶𝟶=𝟶.

With this reduction, we can translate certificates for random access into certificates for BLSD.

Corollary 4.8.

Consider P,Q,B,M,w,t>0 such that MtQ. If SLG Random Access with parameters nQBP, g5PQB, and σ2 has (M,w,t)-certificates, then BLSD with parameters NPQ and B has (M,w,tQ) certificates.

Proof.

Consider a BLSD input T:[0..PQ)2[0..B) and the corresponding string V obtained using Lemma 4.6. By construction, this string is an SLG Random Access instance with parameters n=QBP, g=5PQB, and σ=2. We use the hypothetical SLG Random Access data structure for V as a data structure for BLSD queries in T. By Lemma 4.6, every BLSD query S to T can be answered using Q random access queries to V, asking for V[vq] for some positions vq[0..|V|) indexed with q[0..Q). By our assumption, for each q[0..Q), there is a certificate Cq[0..M) of size t that determines the value of V[vq]. Taking the union Cq[0..Q)Cq, padded with arbitrary elements to reach size tQM, we obtain a certificate that determines V[vq] for all q[0..Q), and hence also their disjunction. By Lemma 4.6, this disjunction is exactly the BLSD answer, that is, whether i[0..N)S(i)T(i) holds. Thus, BLSD with parameters PQ and B has (M,w,tQ)-certificates.

In order to derive a counterpart of Corollary 4.8 for bounded-error randomized data structures, extra care is needed to avoid accumulating error probabilities from multiple random access queries used to answer a single BLSD query. In [41], similar one-to-many reductions miss analogous error analysis and thus almost all cell-probe lower bounds hold only against zero-error query algorithms. The central piece that allows supporting bounded-error structures is the following abstract result.

Proposition 4.9.

Consider a bit sequence x0,,xq1 and a randomized oracle that, given any subset A[0..q), returns bits (ya)aA such that Pr[ya=xa]23 for every aA. The returned bits may be arbitrarily dependent within a single oracle call, but the randomness used by different oracle calls is independent. Then, the disjunction i[0..q)xi can be computed correctly with probability at least 23 using 𝒪(1+logq) oracle calls, where the jth oracle call is made on a subset of size 𝒪(q/2Ω(j)).

Proof.

Our high-level strategy is to maintain and gradually shrink a subset A[0..q) such that i[0..q)xi=aAxa. Each step of this process is implemented using the following subroutine:

Claim 4.10.

There exists a randomized procedure that, given a set A[0..q) and an integer ρ2, uses at most r108lnρ oracle calls, all on the set A, and returns a subset BA satisfying

|B||A|/ρandPr[iAxi=iBxi]116ρ.

Proof.

If A=, we return B=, which satisfies all requirements. Henceforth, suppose A.

We make r independent oracle calls on A. For every iA, let zi{0,1} be the majority value among the r obtained bits yi. Construct C{iA:zi=1}, and return an arbitrary subset BC of size min(|C|,|A|/ρ).

For every iA and every [0..r), let Xi,{0,1} indicate whether the -th returned bit for i is wrong. Then 𝔼[Xi,]13, and the random variables Xi,0,,Xi,r1 are independent. Since zixi implies =0r1Xi,r2, Hoeffding’s inequality yields

Pr[zixi]Pr[1r=0r1Xi,𝔼[1r=0r1Xi,]16]e2r(1/6)2=er/18.

Since r=108lnρ, we conclude that the following holds for every iA:

Pr[zixi]er/18e6lnρ=ρ6116ρ2.

If iAxi=0, then every subset BA satisfies iBxi=0=iAxi. It remains to consider the case iAxi=1. Define the set of false positives

A𝖥𝖯{iA:xi=0 and zi=1}.

Then, 𝔼[|A𝖥𝖯|]|A|16ρ2, and by Markov’s inequality,

Pr[|A𝖥𝖯||A|ρ]|A|16ρ2ρ|A|116ρ.

Moreover, for a fixed jA with xj=1, we have

Pr[zj=0]116ρ2116ρ.

Hence, with probability at least 1116ρ116ρ>116ρ, we have both zj=1 and |A𝖥𝖯|<|A|ρ. Conditioned on this event, C contains at least one true positive and strictly fewer than |A|ρ false positives. Therefore, every subset of C of size min(|C|,|A|/ρ) still contains a true positive, and so the returned set B satisfies iAxi=iBxi.

Let us continue with the proof of Proposition 4.9. We define Llog(1+logq) and construct a descending sequence of sets [0..q)A0A1AL so that, for each b[0..L), the set Ab+1 is obtained from Ab by applying Claim 4.10 with parameter ρb22b.

Since m/ρ/ρ=m/(ρρ) holds for all positive integers m,ρ,ρ>0, an induction on b[0..L] shows that

|Ab|qi=0b1ρi=q22b1

holds for every b[0..L] and, in particular,

|AL|q22L1q22log(1+logq)1=q21+logq1=1.

If AL=, we output 0. Otherwise, we make 𝒪(1) independent oracle calls on the singleton set AL, and output the majority value among the obtained estimates for the unique element of AL.

If all reduction steps succeed, then i[0..q)xi=iALxi. By Claim 4.10 and the union bound, the probability that all reduction steps succeed is at least

1b=0L116ρb116b022b>116.

The final majority vote on AL is correct with probability at least 56, after increasing the hidden constant in its 𝒪(1) repetitions if necessary. Therefore, the overall success probability is at least 11616=23.

It remains to justify the complexity bound. In batch b[0..L), the algorithm queries the set Ab, which we know to be of size 𝒪(q22b), and it makes 𝒪(logρb) oracle calls. The number of oracle calls used in the reduction steps is proportional to

b=0L1logρb=b=0L12b𝒪(2L)𝒪(logq).

Together with the final 𝒪(1) singleton calls, this gives 𝒪(1+logq) oracle calls in total.

Finally, enumerate all oracle calls in chronological order. If the sth oracle call belongs to batch b, then the first b+1 batches contain only 𝒪(2b) oracle calls in total, so s𝒪(2b), and therefore 2bΩ(s). Hence, this call is made on a subset of size 𝒪(q22b)q2Ω(s). If the sth oracle call is one of the final singleton calls, then s𝒪(1+logq), and its queried set has size 1𝒪(q/2Ω(s)), after decreasing the constant hidden in the Ω(s) exponent if necessary.

We are now ready to provide a counterpart of Corollary 4.8 for bounded-error data structures.

Corollary 4.11.

Consider P,Q,B,M,w,t>0 such that MQ. Suppose that SLG Random Access with parameters nQBP, g5PQB, and σ2 admits an (M,w,t)-bounded-error data structure. Then, BLSD with parameters NPQ and B admits a bounded-error communication protocol in which Alice sends 𝒪(tQlog2MQ) bits and Bob sends 𝒪(tQw) bits.

Proof.

Fix a BLSD input T:[0..PQ)2[0..B) held by Bob. Let V be the binary string produced from T using Lemma 4.6. This string constitutes an SLG Random Access instance with parameters n=QBP, g=5PQB, and σ=2; by assumption, it thus admits an (M,w,t)-bounded-error data structure.

For the BLSD query S:[0..PQ)[0..B), held by Alice, and for every q[0..Q), define

vqqBP+p[0..P)S(qP+p)BpandxqV[vq].

By Lemma 4.6, the BLSD answer is exactly q[0..Q)xq. Hence, by Proposition 4.9, it suffices to implement the oracle from that lemma with communication costs matching the claimed bounds.

Consider one oracle call on a subset A[0..Q). Using public randomness, Alice and Bob sample one random seed r for the data structure. Bob constructs the data structure D(V,r), and together they simulate all Random Access query executions asking for the positions vq for qA. The seed r is sampled independently for each oracle call, so different oracle calls are independent. Within one oracle call, the queried bits may be dependent, which is allowed by Proposition 4.9.

We simulate the t probe rounds in lockstep. In round [0..t), Alice knows the queried positions vq, the seed r, and all answers received in earlier rounds. Hence, she can determine the set C[0..M) of all memory cells that at least one of the queries requests in round . Since |C||A|QM, the number of possibilities for C is (M|A|)s=0|A|(Ms), so Alice can encode C using log(M|A|)𝒪(|A|log2M|A|) bits and send this encoding to Bob. Bob replies with the contents of the cells in C, in a canonical order, using 𝒪(|C|w)𝒪(|A|w) bits. After t rounds, Alice can reconstruct the outputs yq of all simulated Random Access queries for qA.

For each qA, the value yq equals xq with probability at least 23, because each simulated query is exactly one execution of the bounded-error Random Access data structure on V. Thus, this simulation realizes the oracle required by Proposition 4.9.

Consequently, Proposition 4.9 yields a bounded-error algorithm for q[0..Q)xq, and hence for the BLSD answer, that uses 𝒪(logQ) oracle calls in total. By Proposition 4.9, there exist constants C,c>0 such that the subset size aj in the jth oracle call satisfies ajCQ/2cj for each j. The total number of bits sent by Bob is therefore at most

𝒪(twjaj)𝒪(twQj=02cj)𝒪(tQw).

For Alice, the total communication is

𝒪(tjajlog2Maj).

We choose j01clog(Ce) so that ajCQ/2cjQe for every jj0 and utilize the fact that uulogQu is increasing on (0,Qe] and decreasing on [Qe,Q].

For j<j0, we use only the trivial bound ajQ to obtain

ajlog2Maj=ajlog2MQ+ajlogQajQlog2MQ+Qeloge𝒪(Qlog2MQ),

because MQ implies log2MQ1.

For jj0, we use ajCQ/2cj to obtain

ajlog2Maj=ajlog2MQ+ajlogQajCQ2cjlog2MQ+CQ(cjlogC)2cj𝒪(Q2cjlog2MQ)+𝒪(Qj2cj).

Since the series j=02cj and j=0j2cj converge, the tail contributes

𝒪(Qlog2MQ)+𝒪(Q)=𝒪(Qlog2MQ).

Adding the 𝒪(1) values of j<j0, we conclude that Alice sends 𝒪(tQlog2MQ) bits, as claimed.

We also need a technical claim about the monotonicity of SLG Random Access, proved only in the full version [18].

Lemma 4.12 ([18, Lemma 4.12]).

Consider n,g,σ,n,g,σ,M,w,t>0 with nn, gg+3logn+2, and σσ.

  • If SLG Random Access with parameters (n,g,σ) has (M,w,t)-certificates, then SLG Random Access with parameters (n,g,σ) also has (M,w,t)-certificates.

  • If SLG Random Access with parameters (n,g,σ) admits an (M,w,t)-bounded-error data structure, then SLG Random Access with parameters (n,g,σ) also admits an (M,w,t)-bounded-error data structure.

In the final step, we put everything together and change the parametrization to n,g,σ.

Theorem 4.13.

Consider integers n,g,σ,M,w,t>0 and a real constant ϵ>0 such that ng, nσ2, Mwglogn(wlogn)ϵ, and g25w1+ϵlogn.

If Random Access with parameters n, g, and σ has (M,w,t)-certificates or admits an (M,w,t)-bounded-error data structure, then

tΩ(lognglogMwglogn)Ω(lognlogσMwlogMwglogn).

Proof.

Set B1+w1+ϵ, P1+logBng, and Qg5logn5PB. Due to 1w, we have

1w1+ϵB2w1+ϵ. (1)

Moreover, 2gn implies

max(1,logBng)P1+logBng1+logng1+logn2logn. (2)

The assumption g25w1+ϵlogn, together with (1) and (2), yields

Q=g5logn5PB25w1+ϵlogn5logn20w1+ϵlogn=5w1+ϵ14w1+ϵ1. (3)

Since 12x<xx holds for x1, the assumption g25w1+ϵlogn25logn further yields

2g25PB=g15g10PBg5logn10PB<Qg5logn5PB<g5PB. (4)

Define nQBP and g5PQB. Combining (4) and (2) implies

n=QBPg5PBB1+logBng=g5PBBng=n5Pn. (5)

Moreover, (4) yields

g=5PQBg5logng3logn2. (6)

The bounds in (5) and (6) let us apply Lemma 4.12 to conclude that Random Access with parameters (n,g,2) has (M,w,t)-certificates or admits a bounded-error data structure.

If MtQ, then (4), (1), (2), and the theorem assumption Mwglogn(wlogn)ϵ imply

tMQ>5MPBg5Mw1+ϵg>Mwglog1+ϵnwϵ>logn. (7)

Since lognlogng and logMwglognϵlog(wlogn)Ω(1), this further yields

t>lognΩ(lognglogMwglogn). (8)

We may henceforth assume M>tQ. Set λϵ1+ϵ and NPQ.

If Random Access with parameters (n,g,2) has (M,w,t)-certificates, then Corollary 4.8 implies that BLSD with parameters (N,B) has (M,w,tQ)-certificates. Hence, Corollary 4.3 yields

tQΩ(NB1λw)ortQΩ(NlogBlogMtQ)Ω(NlogBlog2MQ).

If instead Random Access with parameters (n,g,2) admits an (M,w,t)-bounded-error data structure, then Corollary 4.11 yields a bounded-error communication protocol for BLSD with parameters (N,B) in which Alice sends 𝒪(tQlog2MQ) bits and Bob sends 𝒪(tQw) bits. The randomized BLSD lower bound therefore implies

tQΩ(NB1λw)ortQΩ(NlogBlog2MQ).

In either case, dividing by Q and using N=PQ, we obtain

tΩ(PB1λw)ortΩ(PlogBlog2MQ). (9)

We first handle the former case. By (1) and the definition of λ=ϵ1+ϵ, we have

B1λw(1+ϵ)(1λ)=w,

and hence (9) implies tΩ(P). Moreover, the theorem assumption gives

Mwglogn(wlogn)ϵ(wlogn)Ω(1)wΩ(1). (10)

Since (1) implies Bw𝒪(1), (10) yields logB𝒪(logMwglogn). Therefore, using (2), we obtain

tΩ(P)Ω(lognglogB)Ω(lognglogMwglogn). (11)

It remains to consider the second alternative in (9). Let us first focus on the logarithmic denominator. Due to (4), (1), and (2), we have

log2MQlog25MPBglogMlognw1+ϵg+𝒪(1)logMwglogn+log(wϵlog2n)+𝒪(1).

By (10),

log2MQlogMwglogn+log(wϵlog2n)+𝒪(1)𝒪(logMwglogn). (12)

Combining (9), (2), and (12), we conclude that

tΩ(PlogBlog2MQ)Ω(lognglogMwglogn). (13)

Equations (8), (11), and (13) together prove the first inequality in the theorem. For the second inequality, it suffices to plug in the following bound:

logng=log(nlogσMwMwglognlognlogσ)lognlogσMw, (14)

where the inequality uses the assumptions Mw>glogn and nσ2.

Note that Theorem 4.13 does not apply in the following cases:

𝒈<𝟐𝟓𝒘𝟏+ϵ𝐥𝐨𝐠𝒏.

This corresponds to very small SLGs, which do not model BLSD inputs.

𝑴𝒘<𝒈𝐥𝐨𝐠𝒏(𝒘𝐥𝐨𝐠𝒏)ϵ.

In that case, we can derive a weaker lower bound by monotonicity with respect to M (the certificate size can only increase as the data structure size decreases, with everything else unchanged). Applying the bound for Mgwϵ1log1+ϵn yields

tΩ(lognglog(wlogn)).

The same bound could have been obtained by directly adapting the proof of Theorem 4.13.

Restating Theorem 4.13 in terms of word RAM algorithms, we obtain Theorem 1.2 from the introduction. Here, we present its simplified version for the case of w=Θ(logn).

Corollary 4.14 ([18, Corollary 4.14]).

Consider integers n,g,σ,M,t>0 and a real constant ϵ>0 such that ng, nσ2 and gΩ(log2+ϵn). Suppose that, for every instance of SLG Random Access with parameters n,g,σ, there is a data structure of M machine words of Θ(logn) bits each whose query algorithm runs in time t in the word RAM model. Then

tΩ(lognglogmax(Mg,logn)).

References

  • [1] Hideo Bannai, Mitsuru Funakoshi, Diptarama Hendrian, Myuji Matsuda, and Simon J. Puglisi. Height-bounded Lempel-Ziv encodings. In 32nd Annual European Symposium on Algorithms, ESA 2024, volume 308 of LIPIcs, pages 18:1–18:18. Schloss Dagstuhl – Leibniz-Zentrum für Informatik, 2024. doi:10.4230/LIPIcs.ESA.2024.18.
  • [2] Ruben Becker, Davide Cenzato, Travis Gagie, Sung-Hwan Kim, Ragnar Groot Koerkamp, Giovanni Manzini, and Nicola Prezza. Compressing suffix trees by path decompositions. In Sayan Bhattacharya, Danupon Nanongkai, Michael Benedikt, and Gabriele Puppis, editors, 53rd International Colloquium on Automata, Languages, and Programming (ICALP 2026), volume 374 of LIPIcs, pages 24:1–24:25. Schloss Dagstuhl – Leibniz-Zentrum für Informatik, 2026. doi:10.4230/LIPIcs.ICALP.2026.24.
  • [3] Djamal Belazzougui, Paolo Boldi, and Sebastiano Vigna. Predecessor search with distance-sensitive query time, 2012. arXiv:1209.5441.
  • [4] Djamal Belazzougui, Manuel Cáceres, Travis Gagie, Pawel Gawrychowski, Juha Kärkkäinen, Gonzalo Navarro, Alberto Ordóñez Pereira, Simon J. Puglisi, and Yasuo Tabei. Block trees. Journal of Computer and System Sciences, 117:1–22, 2021. doi:10.1016/J.JCSS.2020.11.002.
  • [5] Djamal Belazzougui, Patrick Hagge Cording, Simon J. Puglisi, and Yasuo Tabei. Access, rank, and select in grammar-compressed strings. In Nikhil Bansal and Irene Finocchi, editors, 23rd Annual European Symposium on Algorithms, ESA 2015, volume 9294 of LNCS, pages 142–154. Springer, 2015. doi:10.1007/978-3-662-48350-3_13.
  • [6] Philip Bille, Anders Roy Christiansen, Patrick Hagge Cording, and Inge Li Gørtz. Finger search in grammar-compressed strings. Theory of Computing Systems, 62(8):1715–1735, 2018. doi:10.1007/S00224-017-9839-9.
  • [7] Philip Bille, Gad M. Landau, Rajeev Raman, Kunihiko Sadakane, Srinivasa Rao Satti, and Oren Weimann. Random access to grammar-compressed strings and trees. SIAM Journal on Computing, 44(3):513–539, 2015. doi:10.1137/130936889.
  • [8] Michael Burrows and David J. Wheeler. A block-sorting lossless data compression algorithm. Technical Report 124, University of Cambridge, 1994. URL: https://www.hpl.hp.com/techreports/Compaq-DEC/SRC-RR-124.pdf.
  • [9] Moses Charikar, Eric Lehman, Ding Liu, Rina Panigrahy, Manoj Prabhakaran, Amit Sahai, and Abhi Shelat. The smallest grammar problem. IEEE Transactions on Information Theory, 51(7):2554–2576, 2005. doi:10.1109/TIT.2005.850116.
  • [10] Anders Roy Christiansen, Mikko Berggren Ettienne, Tomasz Kociumaka, Gonzalo Navarro, and Nicola Prezza. Optimal-time dictionary-compressed indexes. ACM Transactions on Algorithms, 17(1):8:1–8:39, 2021. doi:10.1145/3426473.
  • [11] Ferdinando Cicalese, Zsuzsanna Lipták, Travis Gagie, Gonzalo Navarro, Nicola Prezza, and Cristian Urbina. Incongruity-sensitive access to highly compressed strings, 2026. doi:10.48550/arXiv.2602.04523.
  • [12] Patrick Hagge Cording, Paweł Gawrychowski, and Oren Weimann. Bookmarks in grammar-compressed strings. In Shunsuke Inenaga, Kunihiko Sadakane, and Tetsuya Sakai, editors, 23rd International Symposium on String Processing and Information Retrieval, SPIRE 2016, volume 9954 of LNCS, pages 153–159, 2016. doi:10.1007/978-3-319-46049-9_15.
  • [13] Rajat De and Dominik Kempa. Grammar boosting: A new technique for proving lower bounds for computation over compressed data. In David P. Woodruff, editor, 35th Annual ACM-SIAM Symposium on Discrete Algorithms, SODA 2024, pages 3376–3392. SIAM, 2024. doi:10.1137/1.9781611977912.121.
  • [14] Rajat De and Dominik Kempa. Optimal random access and conditional lower bounds for 2D compressed strings. In 37th Annual ACM-SIAM Symposium on Discrete Algorithms, SODA 2026, pages 1903–1915. Society for Industrial and Applied Mathematics, 2026. doi:10.1137/1.9781611978971.69.
  • [15] Yevgeniy Dodis, Mihai Pătraşcu, and Mikkel Thorup. Changing base without losing space. In Leonard J. Schulman, editor, 42nd Annual ACM Symposium on Theory of Computing, STOC 2010, pages 593–602. ACM, 2010. doi:10.1145/1806689.1806771.
  • [16] Akashnil Dutta, Reut Levi, Dana Ron, and Ronitt Rubinfeld. A simple online competitive adaptation of Lempel-Ziv compression with efficient random access support. In Ali Bilgin, Michael W. Marcellin, Joan Serra-Sagristà, and James A. Storer, editors, Data Compression Conference, DCC 2013, pages 113–122. IEEE, 2013. doi:10.1109/DCC.2013.19.
  • [17] Anouk Duyster and Tomasz Kociumaka. Logarithmic-time internal pattern matching queries in compressed and dynamic texts. In 31st International Symposium on String Processing and Information Retrieval, SPIRE 2024, LNCS, pages 102–117. Springer, 2024. doi:10.1007/978-3-031-72200-4_8.
  • [18] Anouk Duyster and Tomasz Kociumaka. Random access in grammar-compressed strings: Optimal trade-offs in almost all parameter regimes, 2026. arXiv:2602.10864v2.
  • [19] Peter Elias. Efficient storage and retrieval by content and address of static files. Journal of the ACM, 21(2):246–260, 1974. doi:10.1145/321812.321820.
  • [20] Robert Mario Fano. On the number of bits required to implement an associative memory. Technical report, Massachusetts Institute of Technology, 1971. URL: https://csg.csail.mit.edu/CSGArchives/memos/Memo-61.pdf.
  • [21] Michael L. Fredman and Dan E. Willard. Surpassing the information theoretic bound with fusion trees. Journal of Computer and System Sciences, 47(3):424–436, 1993. doi:10.1016/0022-0000(93)90040-4.
  • [22] Travis Gagie, Gonzalo Navarro, and Nicola Prezza. Fully functional suffix trees and optimal text searching in BWT-runs bounded space. Journal of the ACM, 67(1):2:1–2:54, 2020. doi:10.1145/3375890.
  • [23] Moses Ganardi. Compression by Contracting Straight-Line Programs. In Petra Mutzel, Rasmus Pagh, and Grzegorz Herman, editors, 29th Annual European Symposium on Algorithms, ESA 2021, volume 204 of LIPIcs, pages 45:1–45:16. Schloss Dagstuhl – Leibniz-Zentrum für Informatik, 2021. doi:10.4230/LIPIcs.ESA.2021.45.
  • [24] Moses Ganardi, Artur Jeż, and Markus Lohrey. Balancing straight-line programs. Journal of the ACM, 68(4):27:1–27:40, 2021. doi:10.1145/3457389.
  • [25] Leszek Gasieniec, Roman M. Kolpakov, Igor Potapov, and Paul Sant. Real-time traversal in grammar-based compressed files. In Data Compression Conference, DCC 2005, page 458. IEEE Computer Society, 2005. doi:10.1109/DCC.2005.78.
  • [26] Roberto Grossi. Random Access to High-Order Entropy Compressed Text, pages 199–215. Springer, 2013. doi:10.1007/978-3-642-40273-9_14.
  • [27] Paul G. Howard and Jeffrey Scott Vitter. Arithmetic coding for data compression. Proceedings of the IEEE, 82(6):857–865, 1994. doi:10.1109/5.286189.
  • [28] Tomohiro I. Longest common extensions with recompression. In Juha Kärkkäinen, Jakub Radoszewski, and Wojciech Rytter, editors, 28th Annual Symposium on Combinatorial Pattern Matching, CPM 2017, volume 78 of LIPIcs, pages 18:1–18:15. Schloss Dagstuhl – Leibniz-Zentrum für Informatik, 2017. doi:10.4230/LIPIcs.CPM.2017.18.
  • [29] Dominik Kempa and Tomasz Kociumaka. Collapsing the hierarchy of compressed data structures: Suffix arrays in optimal compressed space. In 64th Annual Symposium on Foundations of Computer Science, FOCS 2023, pages 1877–1886. IEEE, 2023. doi:10.1109/FOCS57990.2023.00114.
  • [30] Dominik Kempa and Tomasz Kociumaka. Tight lower bounds for central string queries in compressed space. In 37th Annual ACM-SIAM Symposium on Discrete Algorithms, SODA 2026, pages 1824–1840. Society for Industrial and Applied Mathematics, 2026. doi:10.1137/1.9781611978971.65.
  • [31] Dominik Kempa and Barna Saha. An upper bound and linear-space queries on the LZ-end parsing. In Joseph (Seffi) Naor and Niv Buchbinder, editors, 33rd Annual ACM-SIAM Symposium on Discrete Algorithms, SODA 2022, pages 2847–2866. SIAM, 2022. doi:10.1137/1.9781611977073.111.
  • [32] John C. Kieffer and En-Hui Yang. Grammar-based codes: A new class of universal lossless source codes. IEEE Transactions on Information Theory, 46(3):737–754, 2000. doi:10.1109/18.841160.
  • [33] Tomasz Kociumaka, Gonzalo Navarro, and Nicola Prezza. Towards a definitive compressibility measure for repetitive sequences. IEEE Transactions on Information Theory, 69(4):2074–2092, 2023. doi:10.1109/TIT.2022.3224382.
  • [34] Sebastian Kreft and Gonzalo Navarro. LZ77-like compression with fast random access. In James A. Storer and Michael W. Marcellin, editors, Data Compression Conference, DCC 2010, pages 239–248. IEEE Computer Society, 2010. doi:10.1109/DCC.2010.29.
  • [35] Kasper Green Larsen. Higher cell probe lower bounds for evaluating polynomials. In 53rd Annual Symposium on Foundations of Computer Science, FOCS 2012, pages 293–301. IEEE Computer Society, 2012. doi:10.1109/FOCS.2012.21.
  • [36] Zsuzsanna Lipták, Francesco Masillo, and Gonzalo Navarro. BAT-LZ out of hell. In 35th Annual Symposium on Combinatorial Pattern Matching, CPM 2024, volume 296 of LIPIcs, pages 21:1–21:17. Schloss Dagstuhl – Leibniz-Zentrum für Informatik, 2024. doi:10.4230/LIPIcs.CPM.2024.21.
  • [37] Markus Lohrey, Sebastian Maneth, and Carl Philipp Reh. Constant-time tree traversal and subtree equality check for grammar-compressed trees. Algorithmica, 80(7):2082–2105, 2017. doi:10.1007/s00453-017-0331-3.
  • [38] Gonzalo Navarro. Indexing highly repetitive string collections, part i: Repetitiveness measures. ACM Computing Surveys, 54(2):1–31, 2021. doi:10.1145/3434399.
  • [39] Gonzalo Navarro, Francisco Olivares, and Cristian Urbina. Balancing run-length straight-line programs. In Diego Arroyuelo and Barbara Poblete, editors, 29th International Symposium on String Processing and Information Retrieval, SPIRE 2022, volume 13617 of LNCS, pages 117–131. Springer, 2022. doi:10.1007/978-3-031-20643-6_9.
  • [40] Takaaki Nishimoto, Tomohiro I, Shunsuke Inenaga, Hideo Bannai, and Masayuki Takeda. Fully dynamic data structure for LCE queries in compressed space. In Piotr Faliszewski, Anca Muscholl, and Rolf Niedermeier, editors, 41st International Symposium on Mathematical Foundations of Computer Science, MFCS 2016, volume 58 of LIPIcs, pages 72:1–72:15. Schloss Dagstuhl – Leibniz-Zentrum für Informatik, 2016. doi:10.4230/LIPIcs.MFCS.2016.72.
  • [41] Mihai Pǎtraşcu. Unifying the landscape of cell-probe lower bounds. SIAM Journal on Computing, 40(3):827–847, 2011. doi:10.1137/09075336X.
  • [42] Mihai Pǎtraşcu and Mikkel Thorup. Dynamic integer sets with optimal rank, select, and predecessor search. In 55th Annual Symposium on Foundations of Computer Science, FOCS 2014, pages 166–175, 2014. doi:10.1109/FOCS.2014.26.
  • [43] Nicola Prezza. Optimal rank and select queries on dictionary-compressed text. In Nadia Pisanti and Solon P. Pissis, editors, 30th Annual Symposium on Combinatorial Pattern Matching, CPM 2019, volume 128 of LIPIcs, pages 4:1–4:12. Schloss Dagstuhl – Leibniz-Zentrum für Informatik, 2019. doi:10.4230/LIPIcs.CPM.2019.4.
  • [44] Rajeev Raman, Venkatesh Raman, and Srinivasa Rao Satti. Succinct indexable dictionaries with applications to encoding k-ary trees, prefix sums and multisets. ACM Transactions on Algorithms, 3(4):43, 2007. doi:10.1145/1290672.1290680.
  • [45] Sofya Raskhodnikova, Dana Ron, Ronitt Rubinfeld, and Adam D. Smith. Sublinear algorithms for approximating string compressibility. Algorithmica, 65(3):685–709, 2013. doi:10.1007/S00453-012-9618-6.
  • [46] Frank Rubin. Experiments in text file compression. Communications of the ACM, 19(11):617–623, 1976. doi:10.1145/360363.360368.
  • [47] Wojciech Rytter. Application of Lempel–Ziv factorization to the approximation of grammar-based compression. Theoretical Computer Science, 302(1–3):211–222, 2003. doi:10.1016/S0304-3975(02)00777-6.
  • [48] Kunihiko Sadakane and Roberto Grossi. Squeezing succinct data structures into entropy bounds. In 17th Annual ACM-SIAM Symposium on Discrete Algorithms, SODA 2006, pages 1230–1239. ACM Press, 2006. URL: http://dl.acm.org/citation.cfm?id=1109557.1109693.
  • [49] Hiroki Shibata, Yuto Nakashima, Yutaro Yamaguchi, and Shunsuke Inenaga. LZBE: An LZ-Style Compressor Supporting O(log n)-Time Random Access. In Philip Bille and Nicola Prezza, editors, 37th Annual Symposium on Combinatorial Pattern Matching (CPM 2026), volume 369 of LIPIcs, pages 34:1–34:18. Schloss Dagstuhl – Leibniz-Zentrum für Informatik, 2026. doi:10.4230/LIPIcs.CPM.2026.34.
  • [50] Sandip Sinha and Omri Weinstein. Local decodability of the Burrows-Wheeler transform. In 51st Annual ACM Symposium on Theory of Computing, STOC 2019, pages 744–755. ACM, 2019. doi:10.1145/3313276.3316317.
  • [51] Elad Verbin and Wei Yu. Data structure lower bounds on random access to grammar-compressed strings. In Johannes Fischer and Peter Sanders, editors, 24th Annual Symposium on Combinatorial Pattern Matching, CPM 2013, LNCS, pages 247–258. Springer, 2013. doi:10.1007/978-3-642-38905-4_24.
  • [52] Yaoyu Wang and Yitong Yin. Certificates in data structures. In 41st International Colloquium on Automata, Languages, and Programming, ICALP 2014, LNCS, pages 1039–1050. Springer, 2014. doi:10.1007/978-3-662-43948-7_86.
  • [53] Jacob Ziv and Abraham Lempel. A universal algorithm for sequential data compression. IEEE Transactions on Information Theory, 23(3):337–343, 1977. doi:10.1109/TIT.1977.1055714.
  • [54] Jacob Ziv and Abraham Lempel. Compression of individual sequences via variable-rate coding. IEEE Transactions on Information Theory, 24(5):530–536, 1978. doi:10.1109/TIT.1978.1055934.