Lemma 5.2 — completeness:
ProvedExactPatternStream.lemma_5_2fingerprintingp2o-gran-per-chapterp2o-plan-paperp2o-strengthenedp2o-v1pattern-matchingrandomized-algorithmsstreaming-algorithmsstring-algorithms
Let be the set returned by , Algorithm 2. Then
for every choice of the hash functions and . There are no false negatives, on any seeds, which makes the error of the algorithm one-sided.
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: of the form (6), "specified in Section 7.3" → an arbitrary argument
F, with values ; reason: §§4–5 of the source are written for any such , and (14) is one - encoding: an alphabet → characters are natural numbers; reason: every finite alphabet embeds
- encoding: a set of positions → a
Finset ℤ; reason: is an integer subtraction, and it must not truncate - generalization: of §7.4 → an arbitrary function
fR; reason: the proof compares hashes of identical strings, so §7.4 is a special case
Preamble
import Mathlib import Definitions.Def_ExactPatternStream_Strings import Definitions.Def_ExactPatternStream_Pad import Definitions.Def_ExactPatternStream_ParseTree import Definitions.Def_ExactPatternStream_Build
Formal statement
namespace ExactPatternStream
/-- Gawrychowski, Janczewski, Jin, Nelson, *An Improved Streaming Algorithm for Exact Pattern Matching* (preprint, STOC 2027 submission, sha256 351218cb…), Lemma 5.2, p.14 (PDF 15).
Completeness: `Occ(P, T) ⊆ M` for the set `M` returned by `Match(P, T)`, Algorithm 2, for every choice of the hash functions `F_i` and `f_R`.
**Formalization Note.** The statement is deterministic: "even if the hash functions have collisions elsewhere" (p.13). `M` is a set of integers, so occurrences are cast to `ℤ`. -/
theorem lemma_5_2 {β : Type*} [DecidableEq β] (F : GroupHash) (fR : List Leaf → β) (P T : List ℕ)
(hm : 1 ≤ P.length) (hmn : P.length ≤ T.length) (hn : T.length ≤ 2 * P.length) :
∀ a ∈ occ P T, (a : ℤ) ∈ matchSet F fR P T := by sorry
end ExactPatternStream
Source
Gawrychowski, Janczewski, Jin, Nelson, An Improved Streaming Algorithm for Exact Pattern Matching (preprint, STOC 2027 submission, sha256 351218cb…), Lemma 5.2, p.14 (PDF 15)
Human review
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.