Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Lemma 8.5 — every index lies in O(log⁡n)O(\log n)O(logn) highly periodic runs ([BGS24, Lemma 8])

Proved
DynLZ77.Main.lemma_8_5

by shaygo · Nov 25, 2026 · Mathlib 0df444a (Lean v4.33.1)

combinatorics-on-wordslz77strings

Let SSS be a string of length nnn. A run S[a..b]S[a..b]S[a..b] with period p=per(S[a..b])p=\mathrm{per}(S[a..b])p=per(S[a..b]) is a maximal periodic substring: 2p≤b−a+12p\le b-a+12p≤b−a+1, S[a−1]≠S[a−1+p]S[a-1]\ne S[a-1+p]S[a−1]=S[a−1+p] and S[b+1]≠S[b+1−p]S[b+1]\ne S[b+1-p]S[b+1]=S[b+1−p] (a comparison with a position outside SSS counts as unequal). The run is highly periodic if b−a+1≥3pb-a+1\ge 3pb−a+1≥3p. There is a universal constant CCC such that every index iii of SSS lies in at most

C (1+log⁡2n)C\,(1+\log_2 n)C(1+log2​n)

highly periodic runs.

In the proof of Lemma 1.2 ("Bounding IredPer\mathrm{Ired}_{\mathrm{Per}}IredPer​"), this lemma bounds the set RZR_ZRZ​ of the two leftmost Lyndon-root positions of the highly periodic runs that contain a phrase start: ∣RZ∣=O(zlog⁡n)|R_Z|=O(z\log n)∣RZ​∣=O(zlogn).

Formalization Note. Runs are counted as pairs (a,b)∈[1..n]2(a,b)\in[1..n]^2(a,b)∈[1..n]2 with IsRun S a b (per (sub S a b)) and HighlyPeriodic (sub S a b) (definitions of DynLZ77_Main_Structure); the period of a run is determined by (a,b)(a,b)(a,b). O(log⁡n)O(\log n)O(logn) is written as C (1+log⁡2n)C\,(1+\log_2 n)C(1+log2​n) with CCC fixed before the alphabet, SSS and iii.

Preamble
import Mathlib.Analysis.SpecialFunctions.Log.Base
import Definitions.Def_DynLZ77_Main_Strings
import Definitions.Def_DynLZ77_Main_Structure

set_option autoImplicit false
Formal statement
namespace DynLZ77.Main

open Classical in
/-- **Lemma 8.5** ([BGS24, Lemma 8]). There is a universal constant `C` such that every position
`i` of a string `S` of length `n` lies in at most `C·(1 + log₂ n)` highly periodic runs, i.e. runs
`S[a..b]` with period `p = per(S[a..b])` and `b − a + 1 ≥ 3p`. -/
theorem lemma_8_5 : ∃ C : ℝ, ∀ {α : Type} [DecidableEq α] (S : List α) (i : ℕ),
    (((Finset.Icc 1 S.length ×ˢ Finset.Icc 1 S.length).filter (fun r : ℕ × ℕ =>
        IsRun S r.1 r.2 (per (sub S r.1 r.2)) ∧ HighlyPeriodic (sub S r.1 r.2) ∧
          r.1 ≤ i ∧ i ≤ r.2)).card : ℝ) ≤
      C * (1 + Real.logb 2 (S.length : ℝ)) := by sorry

end DynLZ77.Main
Source
Boneh, Fried, Golan, Kraus, Dynamic LZ77: No Space for Improvement, STOC 2027 submission (manuscript sha256 2a15e146…, https://github.com/sigact-stoc/stoc2027/releases/download/papers-2/1131.pdf), §8.1 Highly periodic words, Lyndon roots, Lemma 8.5, p. 49 (PDF 51), citing [BGS24, Lemma 8] = Boneh, Golan, Shur, String 2-Covers with No Length Restrictions, ESA 2024

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