Opening a long-key group record at its evaluator entry
ProvedExactPatternStream.ImplementationProof.open_long_entrystreaming-algorithmsstring-algorithmsword-ram
Let a decoded group record represent the first child labels, with trigger and countdown already known. Assume the encoded key is longer than the hash width, the register and stack arguments identify this row, and the address and arena bounds hold. A new group enters the normalization code at when its decoded root is zero. The other entry is . On every coin tape either starting configuration reaches a state satisfying
The row represents the same seed, child prefix, control state and flags. The run preserves the caller state and memory outside the permitted row and register area. This result allows new and partially consumed groups to enter the same long-key evaluator.
Preamble
import Definitions.Def_ExactPatternStream_StreamingImplementation open ExactPatternStream open ExactPatternStream.ImplementationProof open DynBrooks MachineProof PackedRAM HashProof CounterProof GroupReader
Formal statement
theorem ExactPatternStream.ImplementationProof.open_long_entry {w σ m n base start e pos : ℕ} {seed : Seeds σ m} {L : Level} {xs : List Label}
{q : TriggerState L.c} {r : Fin (L.c+2)} {Q : Program} {bytes : List Bool} {a : Config w} {arena : Finset ℕ}
(ω : ℕ→BitVec w) (x : Label) (d : GroupDecoded (n:=n) (base:=base) (start:=start) seed L (xs.take pos) q r a bytes)
(long : hashB σ m<(L.c+2)*levelBits σ m L.i) (geometry : GroupOpenBounds w σ m n base start L arena)
(pc : a.pc=(if d.root=0 then e else e+442)) (site : NormalizedCodeAt Q e (normalizeLongCode e))
(row : TextParsedRow σ m L.i L.c base start (packedLabelWord w σ m L.i x) a.mem)
(stack : PadParameters w (kCnt σ m) base (groupBankOffset σ m start L) (slotBits (kCnt σ m) n) (Nat.clog 2 (L.c+2)) a)
(arity : (a.mem 33).toNat=L.c+2) :
let g:=packedLongTrace (w:=w) (n:=n) seed L xs q r d.done d.spare
∃ b : Config w,Reach Q ω a b ∧ b.pc=e+442 ∧ GroupOpenFrame base start (countPayloadBits σ m n L.i L.c) arena a b ∧
g.Ready base start pos b := by sorrySource
Derived word-RAM implementation lemma for Gawrychowski, Janczewski, Jin and Nelson, An Improved Streaming Algorithm for Exact Pattern Matching, STOC 2027 submission 1330, §9, Lemma 9.2, p. 29 (PDF p. 30). Accompanying Lean formalization, InProgress/Stage/PatternPassOpenLong.lean, lines 8–64.