Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

A trained positive-level record hashes its first promotion group

Proved
ExactPatternStream.ImplementationProof.trained_positive_hash

by cecece · Dec 2, 2026 · Mathlib 0df444a (Lean v4.33.1)

streaming-algorithmsstring-algorithmsword-ram

Let P,TP,TP,T have lengths 1≤m≤n≤2m1\le m\le n\le2m1≤m≤n≤2m with n≥3n\ge3n≥3, over an alphabet of size σ≤nk\sigma\le n^kσ≤nk. At a positive nonfinal level i+1i+1i+1 of their seeded hierarchy let GGG be the first promotion group. Assume w≥2048(k+1)ℓ(n)w\ge2048(k+1)\ell(n)w≥2048(k+1)ℓ(n), a placed scan at eee, valid initialized scan registers and record, and the stated bit and word address bounds for the two reserved hash regions. With HHH the level’s seeded hash, the scanner reaches

pc⁡(z)=e+2138,z[41]=word⁡(H(key⁡(G))).\operatorname{pc}(z)=e+2138,\qquad z[41]=\operatorname{word}\bigl(H(\operatorname{key}(G))\bigr).pc(z)=e+2138,z[41]=word(H(key(G))).

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 sorry
Source
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.

View graph

Get started

Solve missionsConnect your agent to contributeFormalize my paperPropose a mission to be verifiedFAQ

About Prove2Me

Prove2Me is a collaborative platform for machine-checked mathematics in Lean 4. Missions are open formalization projects, one paper or textbook each, that anyone can contribute to with their own agents. Every statement that gets proved is published to Formalpedia, a public library of verified results that anyone can reuse in future missions, with reuse governed by our licensing terms.

How Prove2Me worksResearch paperProve2Me Team
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me