Documentation

CslibFrontier.DataStructure.HashFamily.WordRAM.RuntimeReducedKWise

Runtime-Parameterized ReducedKWise Hashing on the Resizable Word RAM #

Completes the parameter-free (¬ReadsWidth) Word-RAM / Resizable Word RAM compilation of the two-stage universe-reduced $k$-wise independent polynomial hash family of [BFCKK24] (Cslib.Probability.reducedPolyHash):

Re-exports RuntimeReducedKWise.ParamsInit (HashParams, mkHashParams, initTableGenProg) and RuntimeReducedKWise.Horner.

Main definitions #

Main results #

References #

Section 1: Output limb packing and full evalHashGenProg #

Parameter-independent O(k) upper bound on memoryCost (evalHashGenProg d) s.

theorem Cslib.DataStructure.HashFamily.WordRAM.RuntimeReducedKWise.evalHashGenProg_spec {w U w₀ b b' k hashBase scratchBase : ℕ} {θ : Probability.ReducedPolySeed w₀ b b' k} {u : Fin U} {s₀ : Memory.State} (hw₀_pos : 0 < w₀) (hw₀ : w₀ ≤ w) (hU : U ≤ 2 ^ w₀) (hb' : b' ≤ w) (hk_pos : 0 < k) (hc_lt : 2 * Probability.reducedChunkBits (Probability.reducedTrinomialStep w₀ b b') < w) (hfr_h : hashBase + ReducedKWise.space w w₀ b b' k ≤ s₀.frontier) (hfit_h : WordRAM.Fits w (hashBase + ReducedKWise.space w w₀ b b' k)) (hfr_s : scratchBase + scratchWords ≤ s₀.frontier) (hfit_s : WordRAM.Fits w (scratchBase + scratchWords)) (hdisj : hashBase + ReducedKWise.space w w₀ b b' k ≤ scratchBase ∨ scratchBase + scratchWords ≤ hashBase) (hrep : ReducedKWise.Rep hashBase w w₀ b b' k θ s₀.mem) :
have hp := mkHashParams w w₀ b b' k; have prog := evalHashGenProg (hp, hashBase, scratchBase, ↑u); have s' := (Memory.spec 0).clientState s₀ prog; EvalHashGenPre w (hp, hashBase, scratchBase, ↑u) s₀ ∧ (Memory.spec w).ValidHistory s₀ ((Memory.spec w).clientHistory s₀ prog) ∧ WordRAM.Realization.memoryCost prog s₀ ≤ evalMemBound k ∧ (Memory.spec 0).clientResult s₀ prog = ↑(Probability.reducedPolyHash U w₀ b b' k θ u) ∧ s'.frontier = s₀.frontier ∧ ∀ (a : ℕ), a < scratchBase ∨ scratchBase + scratchWords ≤ a → s'.mem a = s₀.mem a

Full specification of evalHashGenProg.

Section 4: Parameter-free seed resampling (resampleHashCode) on RCode .exact r #

Parameter-free RCode .exact r subroutine resampling a uniform ReducedPolySeed w₀ b b' k.

theorem Cslib.DataStructure.HashFamily.WordRAM.RuntimeReducedKWise.not_readsWidth_resampleHashCode {r : ℕ} (rBase rMaskM rBotWords rMaskC rPtr rEnd rMask rOne rVal : Fin r) :
¬(resampleHashCode rBase rMaskM rBotWords rMaskC rPtr rEnd rMask rOne rVal).ReadsWidth
theorem Cslib.DataStructure.HashFamily.WordRAM.RuntimeReducedKWise.resampleHashCode_execRCodeDist {r w L_peak w₀ b b' k hashBase : ℕ} {rBase rMaskM rBotWords rMaskC rPtr rEnd rMask rOne rVal : Fin r} {x : WordRAM.Resizable.RData r} (hd : [rBase, rMaskM, rBotWords, rMaskC, rPtr, rEnd, rMask, rOne, rVal].Nodup) (hw₀ : w₀ ≤ w) (hc_lt : 2 * Probability.reducedChunkBits (Probability.reducedTrinomialStep w₀ b b') < w) (hL : x.frontier ≤ L_peak) (hfr : hashBase + ReducedKWise.seedWords w₀ b b' k ≤ x.frontier) (hfit : WordRAM.Fits w (hashBase + ReducedKWise.seedWords w₀ b b' k)) (hbase : x.regs rBase = hashBase) (hmaskM : x.regs rMaskM = 2 ^ (w₀ - 1) - 1) (hbot : x.regs rBotWords = k * Probability.reducedLimbCount (Probability.reducedTrinomialStep w₀ b b')) (hmaskC : x.regs rMaskC = 2 ^ Probability.reducedChunkBits (Probability.reducedTrinomialStep w₀ b b') - 1) :
∃ (μ : PMF (WordRAM.Resizable.RData r)), WordRAM.Resizable.ExecRCodeDist w (resampleHashCode rBase rMaskM rBotWords rMaskC rPtr rEnd rMask rOne rVal) x μ (↑(5 * ReducedKWise.seedWords w₀ b b' k + 11)) L_peak ∧ PMF.map (fun (y : WordRAM.Resizable.RData r) => ReducedKWise.extractSeed hashBase w₀ b b' k y.mem) μ = Probability.PMF.uniformOfFintype (Probability.ReducedPolySeed w₀ b b' k) ∧ ∀ y ∈ μ.support, y.frontier = x.frontier ∧ ReducedKWise.SeedRep hashBase w₀ b b' k (ReducedKWise.extractSeed hashBase w₀ b b' k y.mem) y.mem ∧ (∀ (a : ℕ), a < hashBase ∨ hashBase + ReducedKWise.seedWords w₀ b b' k ≤ a → y.mem a = x.mem a) ∧ ∀ j ∉ [rPtr, rEnd, rMask, rOne, rVal], y.regs j = x.regs j

Compositional ExecRCodeDist specification of resampleHashCode.