Complete pattern scan from reachable child evaluations
ProvedExactPatternStream.ImplementationProof.counted_pattern_from_childrenexact-pattern-matchingstreaming-algorithmsword-ram
Let be the pattern and text, with lengths , , over an alphabet of size . The machine uses words of bits.
For sufficiently large word width, fix the seeds, tape and the two row routines. Suppose the pattern is nonconstant, the first newly learned row has its prescribed meaning, and the first read, last change and later lock callbacks meet their contracts. Correct evaluation at each child visited by the pattern scan gives the prescribed live state at each pattern prefix after the first change and the learned exit 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.counted_pattern_from_children (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) (Kread Klast Klock : ℕ),
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 cb:=3312+sweep.length
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 Kread ω (s,a) → PublicFinalChange P T hm Q read Klast ω (s,a) →
PublicPrefixLockHandoff P T Q cb (cb+2858) Klock ω (s,a) →
PatternChildKernels P T s a ω Q row meaning →
(∀ 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.AlternatePatternKernelClosure, declaration counted_pattern_from_children.