One public pattern read runs the row scan to its receiver
ProvedExactPatternStream.ImplementationProof.public_pattern_scan_from_read_betweenexact-pattern-matchingstreaming-algorithmsword-ram
For each polynomial alphabet exponent , a sufficiently large multiple of suffices for the word width. Consider a pattern prefix with a positive live row height. Suppose the packed rows, sink and machine registers have the prescribed entry values, and each visited row realizes its specified update. Feeding the next encoded pattern symbol runs the scan to the receiver, produces the expected count and carried label, and updates the packed rows. The output, coin cursor and listed caller registers are preserved. Every write before the receiver lies in the allowed arena.
Preamble
import Definitions.Def_ExactPatternStream_StreamingImplementation open ExactPatternStream open ExactPatternStream.ImplementationProof open DynBrooks MachineProof PackedRAM CounterProof SoundProof OnlineReport
Formal statement
theorem ExactPatternStream.ImplementationProof.public_pattern_scan_from_read_between (k : ℕ) : ∃ C : ℕ,∀ {σ w e j h p : ℕ} {Q : Program}
(P T : List (Fin σ)) (seed : Seeds σ P.length) (hm : 1≤ P.length) (mn : P.length≤ T.length) (twice : T.length≤2*P.length)
(hn : 3≤ T.length) (alpha : σ≤ T.length^k) (wide : C*ell T.length≤ w)
(atWord : j< P.length) (pos : 0< h) (live : h≤ topIndex (seededBuild P T seed)) (row : ℕ→Program)
(read : ∀ i< trainingInputCode.length,Q[e+i]?=trainingInputCode[i]?)
(site : PatternSweepAt Q (e+2) row) (ω : ℕ→BitVec w) (c : Config w) (pc : c.pc=e)
(fs : PatternBank LaneMemory) (height : fs.length=h) (q : Probe) (d : ℕ×ZMod p) (active : q.locked=false)
(payload : ℕ→List Bool) (initial : ℕ→ℕ) (before after : TextRowMeaning LaneMemory),
let m:=P.length
let n:=T.length
let B:=seededBuild P T seed
let widths:=fun i=>(lvl B i).w
let counts:=trainedCounts B
let bank:=fun cut=> PatternPackedRows P T seed h (mixedTextMeaning before after cut) (w:=w)
let arena:=trainedParentArena w σ m n B h
let x:=P[j]
let pkt:=textPacket ((2^w-1)/2) fs (some (.raw x.val)) 0
let f:=feed c [(streamWords P T).getD j 0]
let enc:=packedLabelWord w σ m h
PatternPassStorage P T seed h c payload initial → TrainingSinkRep enc (q,d,false) c →
c.mem 8=1 → c.written⊆arena →
(∀ i f,fs[i]?=some f → padWidth f.item=widths i ∧ before i f (payload i)) →
(∀ ls stage rest tot,TextVisit ((2^w-1)/2) fs (.raw x.val) ls (stage::rest) none tot →
∀ i f,(ls++stage::rest)[i]?=some f → ls.length ≤ i → ∀ bits,before i f bits → after i f bits) →
(∀ ls stage rest a tot,TextVisit ((2^w-1)/2) fs (.raw x.val) ls (stage::rest) (some a) tot →
let pcRow:=patternScanEntry (e+2)+82
TextRowEvaluatorBetween Q ω σ m n (promotionHeapBase w σ m) h ((2^w-1)/2) pcRow (pcRow+(row pcRow).length)
counts widths (bank ls.length) (bank (ls.length+1)) arena ls stage rest a tot) →
∃ t,let z:=run Q ω f t
z.pc=patternScanReceiver (e+2) row ∧ z.input=[] ∧ z.output=c.output ∧ z.coinPos=c.coinPos ∧
TrainingSinkRep enc (q,d,false) z ∧ (z.mem 230).toNat=pkt.2.1 ∧ TextCarry σ m h pkt.2.2 z.mem ∧
(z.mem 18).toNat=x.val+1 ∧
(∃ new,PatternPassStorage P T seed h z new initial ∧
∀ i st,pkt.1[i]?=some st → padWidth st.item=widths i ∧ after i st (new i)) ∧
(∀ r,r=8 ∨ r=13 ∨ r=14 ∨ r=15 ∨ r=16 ∨ r=17 ∨ r=32 ∨ r=170 ∨ r=172 → z.mem r=c.mem r) ∧
∀ v≤ t,(run Q ω f v).written⊆arena := 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.PatternPublicScanBetween, declaration public_pattern_scan_from_read_between.