Prefix induction through all nonconstant pattern changes
ProvedExactPatternStream.ImplementationProof.pattern_all_changesexact-pattern-matchingstreaming-algorithmsword-ram
Let be the pattern and text, with lengths , , over an alphabet of size . The machine uses words of bits.
Fix a nonconstant pattern and a tape. Assume its first installed row and the public first-read and last-change states satisfy their contracts. Suppose that from every reachable prefix core after the first change, one input word produces the prescribed next state. At sufficiently large word width, the public machine has a live learned state at every remaining proper pattern prefix and exits the final prefix at the text-read address.
Preamble
import Definitions.Def_ExactPatternStream_StreamingImplementation open ExactPatternStream open ExactPatternStream.ImplementationProof open DynBrooks MachineProof PackedRAM CounterProof HashProof SoundProof OnlineReport SeedRow
Formal statement
theorem ExactPatternStream.ImplementationProof.pattern_all_changes (k : ℕ) : ∃ W : ℕ,∀ cw,W≤ cw → ∀ {σ : ℕ}
(P T : List (Fin σ)) (hm : 1≤ P.length) (mn : P.length≤ T.length) (twice : T.length≤2*P.length)
(hn : 3≤ T.length) (alpha : σ≤ T.length^k) (s : Seeds σ P.length)
(a : ZMod (residualPrime T.length P.length σ : ℕ)) (row textRow : ℕ→Program)
(meaning : ℕ→TextRowMeaning LaneMemory) (K₀ K₁ : ℕ),
let m:=P.length
let n:=T.length
let w:=cw*ell n
let p : ℕ:=residualPrime n m σ
letI : NeZero p:=⟨(residualPrime n m σ).property.ne_zero⟩
let sweep:=patternSweepProgram 3312 row
let Q:=countedPatternProgram sweep textRow
let read:=learnedReadAddress sweep
let change:=P.findIdx (fun x=> decide (x≠P[0]'hm))
∀ (ω : Tape w),P≠List.replicate m (P[0]'hm) →
PatternBornRow (w:=w) P T s (meaning (change+1)) 0 →
PublicFirstPatternRead P T hm Q K₀ ω (s,a) → PublicFinalChange P T hm Q read K₁ ω (s,a) →
(∀ j,change+1≤ j → j< m → ∀ c : Config w,c.pc=3310 → PatternPrefixCore P T s a ω (meaning j) j c →
PatternWordResult P T s a ω Q row (meaning (j+1)) j c) →
(∀ j,change+1≤ j → j< m → CountedLivePrefix P T s a ω Q meaning j) ∧
CountedLearnedExit P T s a ω Q read (meaning m) := by sorrySource
Gawrychowski, Janczewski, Jin and Nelson, An Improved Streaming Algorithm for Exact Pattern Matching, STOC 2027 submission, §9, Lemma 9.2, p. 29 (PDF p. 30). Derived implementation lemma in Stage.AlternatePatternInduction, declaration pattern_all_changes.