A trained positive-level record hashes its first promotion group
ProvedExactPatternStream.ImplementationProof.trained_positive_hashstreaming-algorithmsstring-algorithmsword-ram
Let have lengths with , over an alphabet of size . At a positive nonfinal level of their seeded hierarchy let be the first promotion group. Assume , a placed scan at , valid initialized scan registers and record, and the stated bit and word address bounds for the two reserved hash regions. With the level’s seeded hash, the scanner reaches
The run preserves input, output and coin position. It preserves every register between 60 and the heap and the packed bits outside the second reserved hash region. At every clock it writes only to already written addresses, low registers or the guarded record area. Thus a positive-level promotion can reuse its stored seed beside earlier records.
Preamble
import Definitions.Def_ExactPatternStream_StreamingImplementation open ExactPatternStream open ExactPatternStream.ImplementationProof open DynBrooks MachineProof PackedRAM CounterProof SoundProof OnlineReport HashProof SeedRow
Formal statement
theorem ExactPatternStream.ImplementationProof.trained_positive_hash {σ K w e base start tail : ℕ} {Q : Program} (P T : List (Fin σ))
(seed : Seeds σ P.length) (hm : 1≤ P.length) (mn : P.length≤ T.length)
(hn : T.length≤2*P.length) (npos : 3≤ T.length) (alphabet : σ≤ T.length^K)
(word : 2048*(K+1)*ell T.length≤ w) (i : ℕ) (active : i+1< topIndex (seededBuild P T seed))
(coins : ℕ→BitVec w) (a : Config w) (pc : a.pc=e) (site : ScannedLearnedAt Q e) (safe : 60≤ base) :
let L:=lvl (seededBuild P T seed) (i+1)
let cap:=countHashBits σ P.length (i+1) L.c
let y:=(seededF seed L.i L.u L.v L.c (firstPromotionGroup L)).1
PositiveHashScan σ P.length (i+1) L.c base start (patternHead L) L.u L.v a →
HeaderImage a base start (trainedScanPayload seed w (i+1) L.c tail L.u L.v) →
start+2*cap<2^w → base+(start+2*cap)/w+1<2^w →
∃ t,let z:=run Q coins a t
z.pc=e+2138 ∧ (z.mem 41).toNat=(BitVec.ofBoolListBE y).toNat ∧
z.input=a.input ∧ z.output=a.output ∧ z.coinPos=a.coinPos ∧
(∀ j,60≤ j → j< base → z.mem j=a.mem j) ∧
(∀ x,x< start+cap ∨ start+2*cap≤ x → readBit z.mem base x=readBit a.mem base x) ∧
∀ s≤ t,(run Q coins a s).written⊆a.written∪(Finset.range 60∪guardedRecordArea base (start+2*cap) w) := by sorrySource
Derived word-RAM implementation lemma for P. Gawrychowski, W. Janczewski, C. Jin and J. Nelson, An Improved Streaming Algorithm for Exact Pattern Matching, STOC 2027 submission 1330, §9, Lemma 9.2, p. 29 (PDF p. 30). The instruction addresses and register conventions are specific to the accompanying Lean formalization, InProgress/Stage/TrainedPositiveHash.lean, lines 45–138, trained_positive_hash.