A successful pattern promotion initializes the next parse level
ProvedExactPatternStream.ImplementationProof.public_training_promoteexact-pattern-matchingstreaming-algorithmsword-ram
Fix , the level seeds and the residual hash parameter. Suppose training has read characters and the sweep on the next character reports a promotion. The training tick appends the canonical current row to the learned row list and installs its corresponding lane. It decreases the remaining fuel by one, advances the level by one, takes the width and first pattern label from the successor level, and sets the residual state to .
Preamble
import Definitions.Def_ExactPatternStream_StreamingImplementation open ExactPatternStream open ExactPatternStream.ImplementationProof open OnlineReport SoundProof CompletenessProof MachineProof
Formal statement
theorem ExactPatternStream.ImplementationProof.public_training_promote {σ p : ℕ} (P T : List (Fin σ)) (s : 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 B:=seededBuild P T s
let L:=lvl B top.index
let D:=lvl B (top.index+1)
let init : TrainingState LaneMemory p:=.reading [] [] ⟨P.length+2,0,1,.symbol .guard,(0,0)⟩
let install:=canonicalRowInstaller s T.length
let state:=((P.take j).map Fin.val).foldl (trainingTick install a) init
let r:=trainSweep a fs top.probe top.digest P[j].val
state=.reading fs rows top → r.2.2.2=true →
trainingTick install a (.reading fs rows top) P[j].val=
.reading (r.1++[(install (hierarchyRow L)).1]) (rows++[hierarchyRow L])
⟨top.fuel-1,top.index+1,D.w,.symbol (patternHead D),(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.PublicTrainingTransition, declaration public_training_promote.