Fully-Functional Suffix Trees and Optimal Text Searching in BWT-runs Bounded Space 1: SA[p ± 1] Is Recovered From the Sample at the Phrase Start Preceding SA[p] − 1Research Paper
Motivation
Collections of genomes, versioned documents and source-code histories are highly repetitive: most of each new item is a copy of something already stored. Full-text indexes such as the suffix array and the FM-index answer pattern queries on such collections, but their size grows with the text length , not with the amount of distinct content. The number of runs in the Burrows–Wheeler transform (BWT) of the text is a standard measure of repetitiveness, and the run-length FM-index of Mäkinen and Navarro counts the occurrences of a pattern in words. Until the work of Gagie, Navarro and Prezza, however, locating those occurrences, i.e. reporting their text positions, required space proportional to for a sampling step , which defeats the purpose on repetitive data.
Timeline.
- 1994: Burrows and Wheeler introduce the transform (DEC SRC Research Report 124).
- 2000–2005: Ferragina and Manzini build the FM-index, with backward search and the LF mapping (J. ACM 52(4), 2005).
- 2005: Mäkinen and Navarro give the run-length FM-index, which counts occurrences in words (Nordic J. Computing 12(1), 2005).
- 2016–2018: Prezza (PhD thesis, Udine, 2016) and Policriti and Prezza (Algorithmica 80(7), 2018) keep one known suffix-array cell, a "toehold", during backward search.
- 2017–2020: Gagie, Navarro and Prezza show that words suffice to locate every occurrence (arXiv:1705.10382; arXiv:1809.02792; J. ACM 67(1), 2020). This mission formalizes the combinatorial core of that result.
Setting
A text is a sequence over the alphabet whose last symbol T[n]=\=1SA[1..n][1..n]T[SA[p]..n]SA[ISA[i]]=i. The BWT records the character preceding each sorted suffix, $$BWT[p]=T[SA[p]-1]\ (SA[p]>1),\qquad BWT[p]=T[n]=\\ (SA[p]=1),$$ so that is read as . The LF mapping is the counting formula , where counts BWT symbols smaller than and counts copies of in .
A run is a maximal block of equal consecutive BWT symbols, and is their number. A text position is sampled when its character is the first or last BWT character in its run (Definition 1); at most positions are sampled. Definition 3 cuts into phrases that begin exactly at the sampled positions. For a text position , the phrase head of is the greatest sampled position . The permutation (Definition 2) returns the text position in the preceding suffix-array cell, and the differential arrays are and . A text position starts a phrase of when is the first position of a run.
Formalization targets
Goal: the identity in the proof of Lemma 3
Let , let be the phrase head of , let , and let be the sample stored at . Then
and , respectively, so that is defined.
Milestones
- §2.4, p. 9. for , with .
- Lemma 12, p. 20. If , then and .
- Run-free claim, proof of Lemma 3, pp. 12–13. For , the cells are contiguous and lie in one BWT run.
- Lemma 14, p. 23. If does not start a phrase of , then and .
A companion item, from the proof of Lemma 2 (p. 12), states that a BWT interval holding both and a non- symbol contains an occurrence of at the first or last position of a run.
Significance
The goal says that the numbers , one pair per sampled position, determine the neighbours of every suffix-array cell, after one predecessor search over the sampled positions. Combined with the toehold of Lemma 2, which provides one known cell inside the interval of a pattern, it lets an index list all occurrences in space. This is the locating half of Theorem 1 of the paper. The same mechanism reappears throughout the paper: Lemma 4 generalises it to neighbours, Lemma 5 to the LCP array, and Lemmas 12 and 14 drive the access structures for and in §5.
The results are proved in the paper; none of them has a machine-checked proof. The mission contributes a formal model of suffix arrays, BWT, LF and runs that is independent of any data-structure encoding, a checked proof of the LF identity from the counting formula, and the exact correctness statement behind the -index. The handling of the wrap-around phrase (see below) is a case the paper's proof leaves implicit.
Difficulty
The obvious argument follows the three cells backwards under LF for steps. It rests on two facts that are easy to state and not routine to prove. First, must be derived from the counting formula : this is a stable-sorting argument about suffixes that begin with the same symbol, and it uses the uniqueness of \$$. Second, LF must map adjacent cells of a run to adjacent cells, and one must check that the neighbouring cells never leave the run while the middle cell walks from T[k]T[i+1]i\le k[1..k]T[i+1]T[i]qk-i$ must be tracked through natural-number arithmetic.
Formalization scope
Positions are 1-based natural numbers, as in the paper. and are functions read only on . is a hypothesis, IsSuffixArray: it maps injectively into and sorts the suffixes strictly in Lean's lexicographic order on lists. Since \=1ISA[i]0iDSADISA$ are integer-valued.
Pins and guards:
- Wrap-around phrase. If no sampled position lies in , the phrase containing began at T[n]=\$$, which is always sampled. Its head is encoded as 0T[0]\equiv T[n]q=ISA[1]$\le k$.
- Neighbours. Each half of the goal and of the run-free claim is guarded by the existence of the neighbour (, ).
- SA[LF(p)]. The identity is stated for ; for it holds only cyclically.
- Lemma 14. " within a phrase of " means that does not start a phrase of , which begin only at run-first cells. Definition 3's phrases begin at run-first and run-last cells; the two parses are kept apart.
The space and time claims of Lemmas 2–3 and Theorem 1 ( words, time on a word RAM) are out of scope; the goal is their explicit combinatorial content. Two trivializing formalizations are ruled out: defining LF as "the cell holding ", which would make milestone 1 a tautology; and defining the phrase head by iterating LF, which would build the proof into the definition. The phrase head is the maximum of the sampled positions .
A full development needs elementary facts about lexicographic order on lists, counting over finite intervals, and iterates of LF. The suffix-array and BWT layer is reusable beyond this mission; two parallel missions on the same paper share the same core definitions. Proofs of the milestones in any order are welcome, as are alternative routes, e.g. through Lemma 14 and for the left half of the goal.
Selected references
- T. Gagie, G. Navarro, N. Prezza, Fully-Functional Suffix Trees and Optimal Text Searching in BWT-runs Bounded Space, arXiv:1809.02792v2, 2019. https://arxiv.org/abs/1809.02792
- T. Gagie, G. Navarro, N. Prezza, Fully Functional Suffix Trees and Optimal Text Searching in BWT-Runs Bounded Space, J. ACM 67(1), 2020. https://doi.org/10.1145/3375890
- T. Gagie, G. Navarro, N. Prezza, Optimal-Time Text Indexing in BWT-runs Bounded Space, arXiv:1705.10382, 2017 (SODA 2018). https://arxiv.org/abs/1705.10382
- P. Ferragina, G. Manzini, Indexing Compressed Text, J. ACM 52(4):552–581, 2005. https://doi.org/10.1145/1082036.1082039
- A. Policriti, N. Prezza, LZ77 Computation Based on the Run-Length Encoded BWT, Algorithmica 80(7):1986–2011, 2018. https://doi.org/10.1007/s00453-017-0327-z
- V. Mäkinen, G. Navarro, Succinct Suffix Arrays Based on Run-Length Encoding, Nordic Journal of Computing 12(1):40–66, 2005 (no DOI).
- M. Burrows, D. J. Wheeler, A Block Sorting Lossless Data Compression Algorithm, Technical Report 124, Digital Equipment Corporation, 1994 (no DOI).