Documentation

CslibFrontier.DataStructure.Dictionary.WordRAM.SuccinctWhpFastBaseProg.Lookup

Fast-Mode Coordinate Lookup (fastFindLocBqGenProg) and Value Query (fastQueryGenProg) #

This module implements worst-case O_c(1) fast-mode coordinate lookup and value query Memory.Prog subroutines and their Realizes .exact certificates on FastMemRep, probing buf curEp, buf oldEp (when rebStage ≤ 3), and liveSlice[b] with key verification via matchesKeyGenProg.

Main definitions #

Main results #

Read-only program specifications #

Section 1: Key Verification and Candidate Probe Helpers #

Section 2: ValidFastMemPre, fastFindLocBqGenProg, and fastQueryGenProg #

Shared memory-state precondition for foreground fast-mode operations under ValidFastState.

@[irreducible]

Inner lookup helper given precomputed (b, q_val) (d = (((wp, base), (b, q_val)), u_val)).

theorem Cslib.DataStructure.Dictionary.WordRAM.SuccinctWhp.fastFindLocBqGenProg_spec {c U V w n_max base : ℕ} {θ : SuccinctWhp.SeedWhp c U n_max} {fs : SuccinctWhp.FastState} {dict : State U} {s : Memory.State} (henv : WhpLargeEnv c U V w n_max w base) (hseed : SeedWhpMemRep base c U w n_max θ s.mem) (hrep : FastMemRep base c U V w n_max fs s.mem) (hv : SuccinctWhp.ValidFastState c U V n_max θ fs dict) (u : Fin U) :
have b := FeistelQuotient.feistelBucket (SuccinctWhp.bWhp n_max) (SuccinctWhp.bktHash c U n_max θ.1) ↑u; have q_val := FeistelQuotient.keyQuotient (SuccinctWhp.bWhp n_max) ↑u; have prog := fastFindLocBqGenProg (((mkWhpParams c U V w n_max, base), b, q_val), ↑u); (Memory.spec 0).clientState s prog = s ∧ ((Memory.spec 0).clientResult s prog = match SuccinctWhp.fastFindLoc c U n_max θ fs u with | some loc => (1, loc) | none => (0, 0)) ∧ WordRAM.Realization.memoryCost prog s ≤ 4 * SuccinctWhp.cTabWhp c + hashEvalCostWhp c + 304 ∧ Succinct.ValidProg w (base + SuccinctWhp.largeSpaceWhp c U V w n_max) s prog
@[irreducible]

Fast-mode value query fastQueryGenProg (d = ((wp, base), u_val)), returning (1, val) or (0, 0) in O_c(1) worst-case memory operations without mutating memory.

theorem Cslib.DataStructure.Dictionary.WordRAM.SuccinctWhp.fastQueryGenProg_spec {c U V w n_max base : ℕ} {θ : SuccinctWhp.SeedWhp c U n_max} {fs : SuccinctWhp.FastState} {dict : State U} {s : Memory.State} (henv : WhpLargeEnv c U V w n_max w base) (hseed : SeedWhpMemRep base c U w n_max θ s.mem) (hrep : FastMemRep base c U V w n_max fs s.mem) (hv : SuccinctWhp.ValidFastState c U V n_max θ fs dict) (u : Fin U) :
have prog := fastQueryGenProg ((mkWhpParams c U V w n_max, base), ↑u); (Memory.spec 0).clientState s prog = s ∧ ((Memory.spec 0).clientResult s prog = match SuccinctWhp.fastQuery c U n_max θ fs u with | some v => (1, v) | none => (0, 0)) ∧ WordRAM.Realization.memoryCost prog s ≤ 4 * SuccinctWhp.cTabWhp c + 2 * hashEvalCostWhp c + 308 ∧ Succinct.ValidProg w (base + SuccinctWhp.largeSpaceWhp c U V w n_max) s prog