Fast-Mode Guarded Insertion / Overwrite (fastInsertGenProg) #
Worst-case O_c(1) guarded insertion and overwrite program refining fastInsert and leaving
memory untouched whenever any fast-mode guard rejects.
Main definitions #
Main results #
@[irreducible]
Fast-mode guarded insertion / overwrite fastInsertGenProg
(d = (((wp, base), u_val), v_val)), returning 1 when fastInsert succeeds (FastStateStep)
and 0 without mutating memory when any fast-mode guard fires.
theorem Cslib.DataStructure.Dictionary.WordRAM.SuccinctWhp.realizes_fastInsertGen :
WordRAM.Realization.Realizes WordRAM.Basis.exact fastInsertGenProg WordRAM.Realization.WordEncoding.encode
WordRAM.Realization.WordEncoding.encode
(fun (w : ℕ) (x : ((WhpParams × ℕ) × ℕ) × ℕ) (s : Memory.State) =>
match x with
| (((wp, base), u_val), v_val) => ValidFastMemPre w wp base s ∧ u_val < wpU wp.1 ∧ v_val < wpV wp.1)
fun (x : ((WhpParams × ℕ) × ℕ) × ℕ) (x_1 : Memory.State) => 0
theorem Cslib.DataStructure.Dictionary.WordRAM.SuccinctWhp.fastInsertGenProg_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) {v_val : ℕ} (hv_v : v_val < V) :
have prog := fastInsertGenProg (((mkWhpParams c U V w n_max, base), ↑u), v_val);
have s' := (Memory.spec 0).clientState s prog;
WordRAM.Realization.memoryCost prog s ≤ 30 * SuccinctWhp.cTabWhp c + 35 * hashEvalCostWhp c + 42386 ∧ Succinct.ValidProg w (base + SuccinctWhp.largeSpaceWhp c U V w n_max) s prog ∧ match SuccinctWhp.fastInsert c U n_max θ fs u v_val with
| some fs' => (Memory.spec 0).clientResult s prog = 1 ∧ FastStateStep base c U V w n_max θ fs' s s'
| none => (Memory.spec 0).clientResult s prog = 0 ∧ s' = s