A training tick identifies a consecutive interval of parse events
ProvedExactPatternStream.ImplementationProof.public_pattern_event_positionexact-pattern-matchingstreaming-algorithmsword-ram
After pattern characters, suppose the training state is ready to read the next symbol . At its current top level, the canonical event stream separates into the events already seen, the leaf for followed by the events delivered by the row sweep, and the remaining suffix. Folding the previously seen completions reconstructs the stored probe. Folding the previously seen leaves reconstructs the residual fingerprint. The current width is the canonical width of this level.
Preamble
import Definitions.Def_ExactPatternStream_StreamingImplementation open ExactPatternStream open ExactPatternStream.ImplementationProof open OnlineReport SoundProof CompletenessProof Dispatch MachineProof
Formal statement
theorem ExactPatternStream.ImplementationProof.public_pattern_event_position {σ p : ℕ} (P T : List (Fin σ)) (seed : Seeds σ P.length)
(a : ZMod p) (hm : 1≤ P.length) (mn : P.length≤ T.length) (twice : T.length≤2*P.length)
(j : ℕ) (hj : j< P.length) (fs : PatternBank LaneMemory) (rows : List LearnedRow) (top : TopRegisters p) :
let initial : TrainingState LaneMemory p := .reading [] [] ⟨P.length+2,0,1,.symbol .guard,(0,0)⟩
let state:=((P.take j).map Fin.val).foldl (trainingTick (canonicalRowInstaller seed T.length) a) initial
let B:=seededBuild P T seed
let L:=lvl B top.index
let x:=P[j].val
let packet:=(packetSweep fs (some (.raw x))).2
state=.reading fs rows top → top.index≤ topIndex B ∧ top.width=L.w ∧ ∃ seen later : TrainingEvents,
patternTail L=seen++(.leaf (.one (.sym x))::(packet.trace++later)) ∧
top.probe=(seen.filterMap LevelEvent.done?).foldl probeRead (.symbol (patternHead L)) ∧
top.digest=(seen.map LevelEvent.leaf?).foldl (patternStep a) (0,0) := by sorrySource
Gawrychowski, Janczewski, Jin and Nelson, An Improved Streaming Algorithm for Exact Pattern Matching, STOC 2027 submission 1330, section 9, Lemma 9.2, pp. 27–29 (PDF pp. 28–30). Derived implementation result in Stage.TrainingPrefixPosition, declaration public_pattern_event_position.