Theorem 1.1 — for , bits and one-sided error at most
ProvedExactPatternStream.theorem_1_1fingerprintingp2o-gran-per-chapterp2o-plan-paperp2o-strengthenedp2o-v1pattern-matchingrandomized-algorithmsstreaming-algorithmsstring-algorithms
Exact Pattern Matching with can be solved by a streaming algorithm with space complexity bits and one-sided error probability at most .
Precisely: for every there are one program and constants such that, for every alphabet size and all , with , , , with word size :
- Space. At most bits are used, on every coin tape at every step.
- On time. No answer comes before is processed; then exactly one for each character, before the next is delivered.
- Completion. With probability , every character is processed.
- One-sided. On every coin tape, whenever , the answer for is YES.
- Correct. With probability at least , all answers are correct together.
This improves the bits of Porat–Porat and Breslauer–Galil for , against an lower bound.
Differences from the source:
- reading: "a streaming algorithm" and "space complexity", with no named model → one
DynBrooks.Program, word size , bits per cell ever written, with a coin tape it cannot rewind; reason: the authors' disclosure says an uncharged seed was their earlier, weaker result, so every kept random bit must be charged, and a finite-state automaton per input size would hide workspace in its transition function - generalization: , with solved "deterministically" (footnote 1) → every with ; reason: it includes the footnote's case; are excluded only because is undefined and
- encoding: , → , then , then the input; ; reason: later constants would admit storing the input
- reading: in the error and in the space → ; reason: is the strongest bound among bases , and §7 uses base
- encoding: rejection sampling, "at most two trials on average" → the run completes almost surely, a separate clause; reason: a sampler with no worst-case bound has non-terminating runs on a null set of tapes
- encoding: answers YES/NO, , known → words /, symbols for
Fin σ, and as the first words read; reason: the same task
Preamble
import Mathlib import Definitions.Def_DynBrooks_Machine import Definitions.Def_ExactPatternStream_Strings import Definitions.Def_ExactPatternStream_StreamRun open MeasureTheory
Formal statement
namespace ExactPatternStream
/-- Gawrychowski, Janczewski, Jin, Nelson, *An Improved Streaming Algorithm for Exact Pattern Matching* (preprint, STOC 2027 submission, sha256 351218cb…), Theorem 1.1, p.2 (PDF 3), with the task of §1, p.1 (PDF 2).
Exact Pattern Matching with `n ≤ 2m` is solved by one streaming program with `O(log n log log n)` bits and one-sided error probability at most `1/log n`: for every polynomial alphabet bound, for all `1 ≤ m ≤ n ≤ 2m` with `n ≥ 3`, (1) charged space is at most `K log₂ n log₂ log₂ n` on every tape at every step; (2) no answer comes before `T[m-1]` is processed, and then one per character, before the next is delivered; (3) the run almost surely completes; (4) at every occurrence, on every tape, the answer is YES; (5) all answers are correct together with probability at least `1 - 1/log₂ n`.
**Formalization Note.** The paper names no machine. A program is a `DynBrooks.Program`: it cannot rewind its coin tape, so every random bit it keeps is in a charged cell. Word size `w = cw · ℓ(n)`, space `w · |cells ever written|`. `Q, cw, K` come after `k` and **before** the input. `n, m, |Σ|` are delivered as the first words; symbols are `1..σ` in the stream; YES is `1`, NO is `0`. `P, T` are fixed before the coins. A hypothesis that symbols fit in a word is not needed: `σ ≤ n^k` and `cw` follows `k`. A word of `0` bits cannot output `1`, so `cw = 0` fails (4). Rejection sampling has no worst-case bound, so runs may not complete on a null set of tapes, which is clause (3). `n ≥ 3` is where the printed bounds make sense: `1/log₂ 1` is undefined, and `log₂ 2 · log₂ log₂ 2 = 0`. Time is not bounded: Theorem 1.1 has no time clause. -/
theorem theorem_1_1 : ∀ k : ℕ, ∃ (Q : DynBrooks.Program) (cw K : ℕ),
∀ (σ : ℕ) (P T : List (Fin σ)),
1 ≤ P.length → P.length ≤ T.length → T.length ≤ 2 * P.length → 3 ≤ T.length →
σ ≤ T.length ^ k →
let m := P.length
let n := T.length
let w := cw * ell n
let B : ℝ := (K : ℝ) * Real.logb 2 n * Real.logb 2 (Real.logb 2 n)
(∀ (ω : ℕ → BitVec w) (t : ℕ),
(spaceBits w (DynBrooks.run Q ω (startConfig w P T) t) : ℝ) ≤ B) ∧
(∀ (ω : ℕ → BitVec w) (j : ℕ) (c : DynBrooks.Config w), j < m + n →
streamState Q P T ω j = some c → ∀ t : ℕ,
(spaceBits w (DynBrooks.run Q ω (DynBrooks.feed c [(streamWords P T).getD j 0]) t) : ℝ) ≤ B) ∧
(∀ (ω : ℕ → BitVec w) (j : ℕ) (c : DynBrooks.Config w), j ≤ m + n →
streamState Q P T ω j = some c → c.output.length = (j + 1) - 2 * m) ∧
ProbAtLeast (DynBrooks.coinMeasure w)
{ω | ∀ j ≤ m + n, (streamState Q P T ω j).isSome} 1 ∧
(∀ (ω : ℕ → BitVec w) (i : ℕ) (c : DynBrooks.Config w), m ≤ i + 1 → i < n → EndsAt P T i →
streamState Q P T ω (m + i + 1) = some c → c.output[i + 1 - m]? = some 1) ∧
ProbAtLeast (DynBrooks.coinMeasure w)
{ω | ∃ c, streamState Q P T ω (m + n) = some c ∧ c.output = truthList P T}
(ENNReal.ofReal (1 - 1 / Real.logb 2 n)) := by sorry
end ExactPatternStream
Source
Gawrychowski, Janczewski, Jin, Nelson, An Improved Streaming Algorithm for Exact Pattern Matching (preprint, STOC 2027 submission, sha256 351218cb…), Theorem 1.1, p.2 (PDF 3), with the task on p.1 (PDF 2)
Human review
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.