Documentation

CslibFrontier.DataStructure.Dictionary.WordRAM.SuccinctWhpHashProg

Certified Memory.Prog Hash, Feistel Quotient, and Salted Fingerprint Subroutines #

This module builds parameter-free Memory.Prog subroutines over Basis.exact (certified with zero local work via realize) for all hash and one-round Feistel operations used by the WHP succinct dynamic dictionary (SuccinctWhpModel and SuccinctWhpFallback):

  1. Frontier-independent Realizes .exact wrappers around BitPackedDoubleTabulation's 4-limb oddMulModWord universe reduction and bit-packed double tabulation loop (outerLoopGenProg).
  2. HashRt and mkHashRtGenProg: compact 38-word runtime parameter bundle extracted from the 101-word (WhpParams, base) input.
  3. bktHashRtProg, feistelSplitRtProg, feistelReconstructRtProg, fpReducedKeyOptRtProg, fpOfSaltOptRtProg, rKeyOfQuotRtProg, and fpOfQuotRtProg: exact Memory.Prog refinements of bktHash, (feistelBucket, keyQuotient), feistelReconstruct, fpReducedKey, fpOfSalt, FastState.rKeyAt, and FastState.fpAt under SeedWhpMemRep, each running in O_c(1) worst-case memory operations without mutating memory.

Main definitions #

Main results #

Section 1: Frontier-Independent stage1RedGenProg and evalHashGenProg #

c-only worst-case memoryCost bound for a full bit-packed double-tabulation evaluation.

Section 2: Compact 38-Word Hash Runtime Parameter Bundle (HashRt) #

@[reducible, inline]

Compact 38-word runtime parameter bundle (hp₁, hp₂, base, U, bWhp, maskBkt, sMax, offHashFp).

Pure constructor for HashRt in the large regime.

Runtime envelope for hrt : HashRt coupled with SeedWhpMemRep.

@[irreducible]

Extract HashRt from (wp, base) : WhpParams × ℕ in 0 memory operations.

Section 3: Certified bktHash, Feistel Split/Reconstruct, fpReducedKey, fpOfSalt #

@[irreducible]

Split any u_val : ℕ into (feistelBucket, keyQuotient).

theorem Cslib.DataStructure.Dictionary.WordRAM.SuccinctWhp.feistelSplitRtProg_spec {c U V w n_max base u_val : ℕ} {θ : SuccinctWhp.SeedWhp c U n_max} {s : Memory.State} (henv : WhpLargeEnv c U V w n_max w base) (hseed : SeedWhpMemRep base c U w n_max θ s.mem) :
have prog := feistelSplitRtProg (mkHashRt c U w n_max base, u_val); have q := FeistelQuotient.keyQuotient (SuccinctWhp.bWhp n_max) u_val; have b := FeistelQuotient.feistelBucket (SuccinctWhp.bWhp n_max) (SuccinctWhp.bktHash c U n_max θ.1) u_val; (Memory.spec 0).clientState s prog = s ∧ (Memory.spec 0).clientResult s prog = (b, q) ∧ WordRAM.Realization.memoryCost prog s ≤ hashEvalCostWhp c ∧ Succinct.ValidProg w (base + SuccinctWhp.largeSpaceWhp c U V w n_max) s prog

Precondition for subroutines taking a stored quotient q < 2 ^ quotBitsWhp U n_max.

@[irreducible]

Compute if h : kv < U then fpReducedKey c U n_max θ.2 ⟨kv, h⟩ else 0 (d = (hrt, kv)).

theorem Cslib.DataStructure.Dictionary.WordRAM.SuccinctWhp.fpReducedKeyOptRtProg_spec {c U V w n_max base kv : ℕ} {θ : SuccinctWhp.SeedWhp c U n_max} {s : Memory.State} (_henv : WhpLargeEnv c U V w n_max w base) (hseed : SeedWhpMemRep base c U w n_max θ s.mem) :
have prog := fpReducedKeyOptRtProg (mkHashRt c U w n_max base, kv); (Memory.spec 0).clientState s prog = s ∧ ((Memory.spec 0).clientResult s prog = if h : kv < U then SuccinctWhp.fpReducedKey c U n_max θ.2 ⟨kv, h⟩ else 0) ∧ WordRAM.Realization.memoryCost prog s ≤ 1 ∧ Succinct.ValidProg w (base + SuccinctWhp.largeSpaceWhp c U V w n_max) s prog
@[irreducible]

Compute if hs : salt < sMaxWhp then if hu : kv < U then fpHash θ.2 ⟨salt, hs⟩ ⟨kv, hu⟩ else 0 else 0 (d = ((hrt, salt), kv)).

theorem Cslib.DataStructure.Dictionary.WordRAM.SuccinctWhp.fpOfSaltOptRtProg_spec {c U V w n_max base salt kv : ℕ} {θ : SuccinctWhp.SeedWhp c U n_max} {s : Memory.State} (henv : WhpLargeEnv c U V w n_max w base) (hseed : SeedWhpMemRep base c U w n_max θ s.mem) :
have prog := fpOfSaltOptRtProg ((mkHashRt c U w n_max base, salt), kv); (Memory.spec 0).clientState s prog = s ∧ ((Memory.spec 0).clientResult s prog = if hs : salt < SuccinctWhp.sMaxWhp c n_max then if hu : kv < U then SuccinctWhp.fpHash c U n_max θ.2 ⟨salt, hs⟩ ⟨kv, hu⟩ else 0 else 0) ∧ WordRAM.Realization.memoryCost prog s ≤ hashEvalCostWhp c ∧ Succinct.ValidProg w (base + SuccinctWhp.largeSpaceWhp c U V w n_max) s prog
@[irreducible]

Composite rKey from (b, q) (d = ((hrt, b), q) with q < 2 ^ quotBitsWhp U n_max), matching FastState.rKeyAt when q = fs.quotArr (fs.physSlot n_max b loc).

theorem Cslib.DataStructure.Dictionary.WordRAM.SuccinctWhp.rKeyOfQuotRtProg_spec {c U V w n_max base b q : ℕ} {θ : SuccinctWhp.SeedWhp c U n_max} {s : Memory.State} (henv : WhpLargeEnv c U V w n_max w base) (hseed : SeedWhpMemRep base c U w n_max θ s.mem) :
have prog := rKeyOfQuotRtProg ((mkHashRt c U w n_max base, b), q); have kv := FeistelQuotient.feistelReconstruct (SuccinctWhp.bWhp n_max) (SuccinctWhp.bktHash c U n_max θ.1) b q; (Memory.spec 0).clientState s prog = s ∧ ((Memory.spec 0).clientResult s prog = if h : kv < U then SuccinctWhp.fpReducedKey c U n_max θ.2 ⟨kv, h⟩ else 0) ∧ WordRAM.Realization.memoryCost prog s ≤ hashEvalCostWhp c + 1 ∧ Succinct.ValidProg w (base + SuccinctWhp.largeSpaceWhp c U V w n_max) s prog
@[irreducible]

Composite salted fingerprint from (((hrt, salt), b), q) (q < 2 ^ quotBitsWhp U n_max), matching FastState.fpAt when q = fs.quotArr (fs.physSlot n_max b loc).

theorem Cslib.DataStructure.Dictionary.WordRAM.SuccinctWhp.fpOfQuotRtProg_spec {c U V w n_max base salt b q : ℕ} {θ : SuccinctWhp.SeedWhp c U n_max} {s : Memory.State} (henv : WhpLargeEnv c U V w n_max w base) (hseed : SeedWhpMemRep base c U w n_max θ s.mem) :
have prog := fpOfQuotRtProg (((mkHashRt c U w n_max base, salt), b), q); have kv := FeistelQuotient.feistelReconstruct (SuccinctWhp.bWhp n_max) (SuccinctWhp.bktHash c U n_max θ.1) b q; (Memory.spec 0).clientState s prog = s ∧ ((Memory.spec 0).clientResult s prog = if hs : salt < SuccinctWhp.sMaxWhp c n_max then if hu : kv < U then SuccinctWhp.fpHash c U n_max θ.2 ⟨salt, hs⟩ ⟨kv, hu⟩ else 0 else 0) ∧ WordRAM.Realization.memoryCost prog s ≤ 2 * hashEvalCostWhp c ∧ Succinct.ValidProg w (base + SuccinctWhp.largeSpaceWhp c U V w n_max) s prog