Toward a Definitive Compressibility Measure for Repetitive Sequences

While the <inline-formula> <tex-math notation="LaTeX">$k$ </tex-math></inline-formula>th order empirical entropy is an accepted measure of the compressibility of individual sequences on classical text collections, it is useful only for small values of <inline-formula> <tex-math notation="LaTeX">$k$ </tex-math></inline-formula> and thus fails to capture the compressibility of repetitive sequences. In the absence of an established way of quantifying the latter, ad-hoc measures like the size <inline-formula> <tex-math notation="LaTeX">$z$ </tex-math></inline-formula> of the Lempel–Ziv parse are frequently used to estimate repetitiveness. The size <inline-formula> <tex-math notation="LaTeX">$b \le z$ </tex-math></inline-formula> of the smallest bidirectional macro scheme captures better what can be achieved via copy-paste processes, though it is NP-complete to compute, and it is not monotone upon appending symbols. Recently, a more principled measure, the size <inline-formula> <tex-math notation="LaTeX">$\gamma $ </tex-math></inline-formula> of the smallest <italic>string attractor</italic>, was introduced. The measure <inline-formula> <tex-math notation="LaTeX">$\gamma \le b$ </tex-math></inline-formula> lower-bounds all the previous relevant ones, while length-<inline-formula> <tex-math notation="LaTeX">$n$ </tex-math></inline-formula> strings can be represented and efficiently indexed within space <inline-formula> <tex-math notation="LaTeX">$O\left({\gamma \log \frac {n}{\gamma }}\right)$ </tex-math></inline-formula>, which also upper-bounds many measures, including <inline-formula> <tex-math notation="LaTeX">$z$ </tex-math></inline-formula>. Although <inline-formula> <tex-math notation="LaTeX">$\gamma $ </tex-math></inline-formula> is arguably a better measure of repetitiveness than <inline-formula> <tex-math notation="LaTeX">$b$ </tex-math></inline-formula>, it is also NP-complete to compute and not monotone, and it is unknown if one can represent all strings in <inline-formula> <tex-math notation="LaTeX">$o(\gamma \log n)$ </tex-math></inline-formula> space. In this paper, we study an even smaller measure, <inline-formula> <tex-math notation="LaTeX">$\delta \le \gamma $ </tex-math></inline-formula>, which can be computed in linear time, is monotone, and allows encoding every string in <inline-formula> <tex-math notation="LaTeX">$O\left({\delta \log \frac {n}{\delta }}\right)$ </tex-math></inline-formula> space because <inline-formula> <tex-math notation="LaTeX">$z = O\left({\delta \log \frac {n}{\delta }}\right)$ </tex-math></inline-formula>. We argue that <inline-formula> <tex-math notation="LaTeX">$\delta $ </tex-math></inline-formula> better captures the compressibility of repetitive strings. Concretely, we show that (1) <inline-formula> <tex-math notation="LaTeX">$\delta $ </tex-math></inline-formula> can be strictly smaller than <inline-formula> <tex-math notation="LaTeX">$\gamma $ </tex-math></inline-formula>, by up to a logarithmic factor; (2) there are string families needing <inline-formula> <tex-math notation="LaTeX">$\Omega \left({\delta \log \frac {n}{\delta }}\right)$ </tex-math></inline-formula> space to be encoded, so this space is optimal for every <inline-formula> <tex-math notation="LaTeX">$n$ </tex-math></inline-formula> and <inline-formula> <tex-math notation="LaTeX">$\delta $ </tex-math></inline-formula>; (3) one can build run-length context-free grammars of size <inline-formula> <tex-math notation="LaTeX">$O\left({\delta \log \frac {n}{\delta }}\right)$ </tex-math></inline-formula>, whereas the smallest (non-run-length) grammar can be up to <inline-formula> <tex-math notation="LaTeX">$\Theta (\log n/\log \log n)$ </tex-math></inline-formula> times larger; and (4) within <inline-formula> <tex-math notation="LaTeX">$O\left({\delta \log \frac {n}{\delta }}\right)$ </tex-math></inline-formula> space, we can not only represent a string but also offer logarithmic-time access to its symbols, computation of substring fingerprints, and efficient indexed searches for pattern occurrences. We further refine the above results to account for the alphabet size <inline-formula> <tex-math notation="LaTeX">$\sigma $ </tex-math></inline-formula> of the string, showing that <inline-formula> <tex-math notation="LaTeX">$\Theta \left({\delta \log \frac {n\log \sigma }{\delta \log n}}\right)$ </tex-math></inline-formula> space is necessary and sufficient to represent the string and to efficiently support access, fingerprinting, and pattern matching queries.