Lemma 7.6 — equal labels have weights within a factor
ProvedExactPatternStream.lemma_7_6fingerprintingp2o-gran-per-chapterp2o-plan-paperp2o-strengthenedp2o-v1pattern-matchingrandomized-algorithmsstreaming-algorithmsstring-algorithms
Fix a level and let , be node occurrences in and . If and have the same label, then
Weights in a label cannot be wrong by more than a factor , even under hash collisions, and this holds at all seeds.
Differences from the source:
- generalization: the standing assumptions of footnote 1 and of p.1 → every (with ) and every alphabet size; reason: the proof uses no lower bound on and no bound on (only and ), and the source case is included
- encoding: sampled once level is known → one independent uniform block per level, read through a prefix (
Seeds); reason: the same law: a prefix of an independent uniform block is uniform and independent of the lower levels - encoding: "fix any injective" codes , → the fixed binary codes of
SeededHash; reason: the source fixes one code, and nothing depends on the choice - encoding: →
Fin σ, shifted by one in the stream and in ; reason: the same alphabet
Preamble
import Mathlib import Definitions.Def_ExactPatternStream_Strings import Definitions.Def_ExactPatternStream_Pad import Definitions.Def_ExactPatternStream_ParseTree import Definitions.Def_ExactPatternStream_Build import Definitions.Def_ExactPatternStream_LinearMaps import Definitions.Def_ExactPatternStream_HashFamily import Definitions.Def_ExactPatternStream_Counters import Definitions.Def_ExactPatternStream_SeededHash
Formal statement
namespace ExactPatternStream
/-- Gawrychowski, Janczewski, Jin, Nelson, *An Improved Streaming Algorithm for Exact Pattern Matching* (preprint, STOC 2027 submission, sha256 351218cb…), Lemma 7.6, p.21 (PDF 22).
At any level `0 ≤ i ≤ h`, nodes `u` of `P_i` and `v` of `T_i` with the same label have `½ wt(leaves(u)) ≤ wt(leaves(v)) ≤ 2 wt(leaves(u))`, at all seeds.
**Formalization Note.** The labels are those of (14), with counters `k_cnt`. `Σ = Fin σ`. The threshold `m ≥ C` of footnote 1 is not needed. -/
theorem lemma_7_6 {σ : ℕ} (P T : List (Fin σ)) (hm : 1 ≤ P.length) (hmn : P.length ≤ T.length)
(hn : T.length ≤ 2 * P.length) (ω : Seeds σ P.length) :
let B := seededBuild P T ω
∀ i ≤ topIndex B, ∀ u ∈ (lvl B i).P, ∀ v ∈ (lvl B i).T, u.label = v.label →
(wt u.leaves : ℝ) / 2 ≤ (wt v.leaves : ℝ) ∧ (wt v.leaves : ℝ) ≤ 2 * (wt u.leaves : ℝ) := by sorry
end ExactPatternStream
Source
Gawrychowski, Janczewski, Jin, Nelson, An Improved Streaming Algorithm for Exact Pattern Matching (preprint, STOC 2027 submission, sha256 351218cb…), Lemma 7.6, p.21 (PDF 22)
Human review
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.