The first root record returns the seeded digest in both key-width cases
ProvedExactPatternStream.ImplementationProof.first_digest_runstreaming-algorithmsstring-algorithmsword-ram
In a machine with the root-digest code at , let the root registers decode labels and a repeat count . The packed record contains the seed and initialized payload for these labels. Assume valid encodings and the stated width, workspace and address inequalities. With , the run reaches
Input, output and coin position are preserved. Only the reserved hash work interval can change in the packed record, and the final written set stays within the initial set, the 60 low registers and the guarded record area. The first-promotion code can use the same digest register for either key width.
Preamble
import Definitions.Def_ExactPatternStream_StreamingImplementation open ExactPatternStream open ExactPatternStream.ImplementationProof open DynBrooks MachineProof PackedRAM CounterProof HashProof SoundProof OnlineReport SeedRow
Formal statement
theorem ExactPatternStream.ImplementationProof.first_digest_run {Q : Program} {w e σ m n j base : ℕ} {u v : Label}
(site : FirstDigestAt Q e) (ω : ℕ→BitVec w) (c : Config w) (pc : c.pc=e)
(dec : DecodedRoot (σ:=σ) (m:=m) (j:=j) (base:=base) c u v)
(hashWidth : (c.mem 141).toNat=hashB σ m) (labelWidth : (c.mem 142).toNat=levelBits σ m 0)
(gu : Coded σ m 0 u) (gv : Coded σ m 0 v) :
let L:=(j+2)*levelBits σ m 0
let b:=hashB σ m
let q:=hashQ b
let d:=hashRounds L b
let cap:=countHashBits σ m 0 j
let start:=(countHeader j).length
let bits:=start+countPayloadBits σ m n 0 j
∀ seed : HSeed L b, HeaderImage c base 0 (countHeader j++firstRecordPayload (w:=w) (σ:=σ) (m:=m) (L:=L) n j seed u v) →
1≤ σ → 60≤ base → levelBits σ m 0≤ w → 4≤ b → b≤ w → 4*q+2≤ w → q*(2*d)≤ cap →
(b< L → d*(4*q+2)+4*q+(d+1)*(4*q+2)≤ cap) → 2*(L+b+4)<2^w → 2*(j+1)<2^w →
start+2*cap<2^w → base+(start+2*cap)/w+1<2^w →
∃ t, let z:=run Q ω c t
z.pc=e+2186 ∧ (z.mem 41).toNat=(BitVec.ofBoolListBE (hashEval L b seed (keyOf σ m 0 (rootGroup j u v)))).toNat ∧
z.input=c.input ∧ z.output=c.output ∧ z.coinPos=c.coinPos ∧
(∀ a,a< start+cap ∨ start+2*cap≤ a → readBit z.mem base a=readBit c.mem base a) ∧
z.written⊆c.written∪(Finset.range 60∪guardedRecordArea base bits 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/FirstRecordDigest.lean, lines 46–142, first_digest_run.