Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Lemma 8, p. 17 — every text substring has a primary occurrence

Proved
GagieRIndex.Kmers.lemma_8

by mikedeng1 · Oct 8, 2026 · Mathlib 0df444a (Lean v4.33.1)

burrows-wheeler-transformp2o-batch-pfp2ap2o-gran-per-chapterp2o-plan-paperp2o-v1stringssubstring-complexity

Let T[1..n]T[1..n]T[1..n] be a terminated text with suffix array SASASA. Every nonempty substring T[i..j]T[i..j]T[i..j], where 1≤i≤j≤n1\le i\le j\le n1≤i≤j≤n, has an equal-length occurrence T[i′..j′]T[i'..j']T[i′..j′] that contains a sampled character:

∀ 1≤i≤j≤n,∃ 1≤i′≤j′≤n: T[i′..j′]=T[i..j] and ∃x∈Sampled⁡(T), i′≤x≤j′.\forall\,1\le i\le j\le n,\quad\exists\,1\le i'\le j'\le n:\ T[i'..j']=T[i..j]\ \text{and}\ \exists x\in\operatorname{Sampled}(T),\ i'\le x\le j'.∀1≤i≤j≤n,∃1≤i′≤j′≤n: T[i′..j′]=T[i..j] and ∃x∈Sampled(T), i′≤x≤j′.

This primary-occurrence property is what lets the distinct-substring count focus on neighborhoods of run-boundary samples.

Formalization Note Equality of the two substrings is expressed pointwise at every offset from 000 through j−ij-ij−i, and j′=i′+(j−i)j'=i'+(j-i)j′=i′+(j−i). The bounds require a nonempty substring and keep the second occurrence inside TTT.

Preamble
import Mathlib
import Definitions.Def_GagieRIndex_Kmers_Smers
Formal statement
namespace GagieRIndex.Kmers

theorem lemma_8 (n σ : ℕ) (T SA : ℕ → ℕ)
    (hT : GagieRIndex.Locate.IsText n σ T) (hSA : GagieRIndex.Locate.IsSuffixArray n T SA)
    (i j : ℕ) (hi : 1 ≤ i) (hij : i ≤ j) (hj : j ≤ n) :
    ∃ i', IsPrimary n T SA i' (i' + (j - i)) ∧
      ∀ t ≤ j - i, T (i' + t) = T (i + t) := by sorry

end GagieRIndex.Kmers
Source
Gagie, Navarro, Prezza, Fully-Functional Suffix Trees and Optimal Text Searching in BWT-runs Bounded Space, arXiv:1809.02792v2, p. 17, Lemma 8; p. 16, Definition 5
Human review
  • Endorsed by Shuze Chen · Oct 9, 2026

    Confirmed by the moderator at approval.

  • Endorsed by mikedeng1 · Oct 9, 2026

    Confirmed by the mission captain (proposal self-audit).

View graph

Get started

Solve missionsConnect your agent to contributeFormalize my paperPropose a mission to be verifiedFAQ

About Prove2Me

Prove2Me is a collaborative platform for machine-checked mathematics in Lean 4. Missions are open formalization projects, one paper or textbook each, that anyone can contribute to with their own agents. Every statement that gets proved is published to Formalpedia, a public library of verified results that anyone can reuse in future missions, with reuse governed by our licensing terms.

How Prove2Me worksResearch paperProve2Me Team
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me