A lock reached by a pattern prefix has a valid machine handoff
ProvedExactPatternStream.ImplementationProof.public_prefix_lock_handoffstreaming-algorithmsstring-algorithmsword-ram
Let a pattern and text over a finite alphabet have lengths . Fix the hierarchy seeds, a residual field element of nonzero modulus, a program, word width, tape and two addresses for a lock callback and its dispatcher. Assume the machine implements its lock handoff for a live level with the prescribed data, bounds and sampler cursor. Then the same handoff applies when the current state has been reached by training on an actual pattern prefix and the next character triggers a lock.
From the encoded row and callback state, the program transfers to the dispatcher with correct successor probe, row contents and sampler cursor. It preserves the required counters and stream state, and satisfies the specified arena and intermediate space bounds.
Preamble
import Definitions.Def_ExactPatternStream_StreamingImplementation open ExactPatternStream open ExactPatternStream.ImplementationProof open DynBrooks MachineProof PackedRAM CounterProof HashProof SoundProof OnlineReport SeedRow MeasureTheory
Formal statement
theorem ExactPatternStream.ImplementationProof.public_prefix_lock_handoff {σ w pr : ℕ} [NeZero pr] {P T : List (Fin σ)}
(hm : 1≤ P.length) (mn : P.length≤ T.length) (twice : T.length≤2*P.length)
{Q : Program} {callback dispatch K : ℕ} {ω : Tape w} {s : Seeds σ P.length × ZMod pr}
(gate : PublicLockHandoff P T Q callback dispatch K ω s) :
PublicPrefixLockHandoff P T Q callback dispatch K ω s := by sorrySource
Derived word-RAM implementation lemma for Gawrychowski, Janczewski, Jin and Nelson, An Improved Streaming Algorithm for Exact Pattern Matching, STOC 2027 submission 1330, §9, Lemma 9.2, p. 29 (PDF p. 30). Accompanying Lean formalization, InProgress/Stage/AlternatePublicLock.lean, lines 42–55.