Documentation

CslibFrontier.DataStructure.Dictionary.WordRAM.SuccinctWhpFastOpProg.DelRemCore

Fast Deletion Removal Core (buf, liveSlice, overmarsSlice) #

Sub-helpers for Substep 1 (fastDeleteRemove) removing u from buf 0/buf 1, liveSlice[b], and overmarsSlice[b].

Main definitions #

Main results #

@[irreducible]

Sub-helper 6.1a: delete rKey_u from buf 0 (st_del = 2) or buf 1 (st_del = 3).

theorem Cslib.DataStructure.Dictionary.WordRAM.SuccinctWhp.realizes_delRemBufGen :
WordRAM.Realization.Realizes WordRAM.Basis.exact delRemBufGenProg WordRAM.Realization.WordEncoding.encode WordRAM.Realization.WordEncoding.encode (fun (w : ℕ) (x : ((WhpCoreParams × ℕ) × ℕ) × ℕ) (s : Memory.State) => match x with | (((cp, base), st_del), snd) => ∃ (c : ℕ) (U : ℕ) (V : ℕ) (w₀ : ℕ) (n_max : ℕ) (fs : SuccinctWhp.FastState), WhpLargeEnv c U V w₀ n_max w base ∧ cp = mkWhpCoreParams c U V w₀ n_max ∧ FastMemRep base c U V w₀ n_max fs s.mem ∧ (st_del = 2 → ∃ (m0 : ℕ → Option (ℕ × ℕ)), SuccinctWhp.ValidBufTrie (SuccinctWhp.cTabWhp c) (SuccinctWhp.bCharWhp n_max) (fs.buf 0) m0) ∧ (st_del = 3 → ∃ (m1 : ℕ → Option (ℕ × ℕ)), SuccinctWhp.ValidBufTrie (SuccinctWhp.cTabWhp c) (SuccinctWhp.bCharWhp n_max) (fs.buf 1) m1)) fun (x : ((WhpCoreParams × ℕ) × ℕ) × ℕ) (x_1 : Memory.State) => 0
theorem Cslib.DataStructure.Dictionary.WordRAM.SuccinctWhp.delRemBufGenProg_fastStep {c U V w n_max base st_del rKey_u : ℕ} {θ : SuccinctWhp.SeedWhp c U n_max} {fs : SuccinctWhp.FastState} {s : Memory.State} (henv : WhpLargeEnv c U V w n_max w base) (h2 : st_del = 2 → ∃ (m0 : ℕ → Option (ℕ × ℕ)), SuccinctWhp.ValidBufTrie (SuccinctWhp.cTabWhp c) (SuccinctWhp.bCharWhp n_max) (fs.buf 0) m0) (h3 : st_del = 3 → ∃ (m1 : ℕ → Option (ℕ × ℕ)), SuccinctWhp.ValidBufTrie (SuccinctWhp.cTabWhp c) (SuccinctWhp.bCharWhp n_max) (fs.buf 1) m1) (hseed : SeedWhpMemRep base c U w n_max θ s.mem) (hrep : FastMemRep base c U V w n_max fs s.mem) :
have prog := delRemBufGenProg (((mkWhpCoreParams c U V w n_max, base), st_del), rKey_u); have s' := (Memory.spec 0).clientState s prog; have buf1 := if st_del = 2 then Function.update fs.buf 0 (SuccinctWhp.bufDelete (SuccinctWhp.cTabWhp c) (SuccinctWhp.bCharWhp n_max) (fs.buf 0) rKey_u) else if st_del = 3 then Function.update fs.buf 1 (SuccinctWhp.bufDelete (SuccinctWhp.cTabWhp c) (SuccinctWhp.bCharWhp n_max) (fs.buf 1) rKey_u) else fs.buf; WordRAM.Realization.memoryCost prog s ≤ 2 * SuccinctWhp.cTabWhp c + 8 ∧ Succinct.ValidProg w (base + SuccinctWhp.largeSpaceWhp c U V w n_max) s prog ∧ FastStateStep base c U V w n_max θ { quotArr := fs.quotArr, valArr := fs.valArr, locState := fs.locState, bktCount := fs.bktCount, bktSalt := fs.bktSalt, liveRole := fs.liveRole, liveInsCount := fs.liveInsCount, overmarsRole := fs.overmarsRole, overmarsActive := fs.overmarsActive, overmarsCursor := fs.overmarsCursor, overmarsInsCount := fs.overmarsInsCount, rebDoneFlag := fs.rebDoneFlag, rebQueued := fs.rebQueued, backPtr := fs.backPtr, poolFreeTop := fs.poolFreeTop, poolFreeStack := fs.poolFreeStack, poolOwner := fs.poolOwner, slices := fs.slices, buf := buf1, curEp := fs.curEp, epochClock := fs.epochClock, rebStage := fs.rebStage, stageCursor := fs.stageCursor, dirtyCount := fs.dirtyCount, dirtyBuckets := fs.dirtyBuckets, dirtyIdx := fs.dirtyIdx, rebCandSalt := fs.rebCandSalt, rebScanCursor := fs.rebScanCursor, rebInsCount := fs.rebInsCount, rebCollision := fs.rebCollision } s s'
@[irreducible]

Sub-helper 6.1b: delete fp_live_u from liveSlice[b] when inLiveTree holds.

theorem Cslib.DataStructure.Dictionary.WordRAM.SuccinctWhp.delRemLiveGenProg_fastStep {c U V w n_max base b st_del fp_live_u : ℕ} {θ : SuccinctWhp.SeedWhp c U n_max} {fs : SuccinctWhp.FastState} {lm : ℕ → Option ℕ} {s : Memory.State} (henv : WhpLargeEnv c U V w n_max w base) (hce : fs.curEp = 0 ∨ fs.curEp = 1) (hb : b < SuccinctWhp.numBucketsWhp n_max) (hlr : fs.liveRole b < 3) (hins : fs.liveInsCount b ≤ 8 * FeistelQuotient.slabScale n_max ^ 12) (hv_l : SuccinctWhp.ValidWhpSlice n_max (fs.liveInsCount b) (fs.slices (fs.liveSliceIdx b)) lm) (hfp : fp_live_u < 2 ^ SuccinctWhp.fpBitsWhp n_max) (hseed : SeedWhpMemRep base c U w n_max θ s.mem) (hrep : FastMemRep base c U V w n_max fs s.mem) :
have prog := delRemLiveGenProg (((mkWhpCoreParams c U V w n_max, base), b), st_del, fp_live_u); have s' := (Memory.spec 0).clientState s prog; have lIdx := fs.liveSliceIdx b; have slices1 := if SuccinctWhp.inLiveTree fs.rebStage fs.oldEp (fs.rebDoneFlag b) st_del = true then Function.update fs.slices lIdx (SuccinctWhp.btreeDelete (SuccinctWhp.fpBitsWhp n_max) (SuccinctWhp.valLaneBitsWhp n_max) (SuccinctWhp.tMinWhp n_max) (fs.slices lIdx) fp_live_u) else fs.slices; WordRAM.Realization.memoryCost prog s ≤ 280 ∧ Succinct.ValidProg w (base + SuccinctWhp.largeSpaceWhp c U V w n_max) s prog ∧ FastStateStep base c U V w n_max θ { quotArr := fs.quotArr, valArr := fs.valArr, locState := fs.locState, bktCount := fs.bktCount, bktSalt := fs.bktSalt, liveRole := fs.liveRole, liveInsCount := fs.liveInsCount, overmarsRole := fs.overmarsRole, overmarsActive := fs.overmarsActive, overmarsCursor := fs.overmarsCursor, overmarsInsCount := fs.overmarsInsCount, rebDoneFlag := fs.rebDoneFlag, rebQueued := fs.rebQueued, backPtr := fs.backPtr, poolFreeTop := fs.poolFreeTop, poolFreeStack := fs.poolFreeStack, poolOwner := fs.poolOwner, slices := slices1, buf := fs.buf, curEp := fs.curEp, epochClock := fs.epochClock, rebStage := fs.rebStage, stageCursor := fs.stageCursor, dirtyCount := fs.dirtyCount, dirtyBuckets := fs.dirtyBuckets, dirtyIdx := fs.dirtyIdx, rebCandSalt := fs.rebCandSalt, rebScanCursor := fs.rebScanCursor, rebInsCount := fs.rebInsCount, rebCollision := fs.rebCollision } s s'
@[irreducible]

Sub-helper 6.1c: delete fp_live_u from overmarsSlice[b] when active and < overmarsCursor.

theorem Cslib.DataStructure.Dictionary.WordRAM.SuccinctWhp.delRemOmGenProg_fastStep {c U V w n_max base b loc_del st_del fp_live_u : ℕ} {θ : SuccinctWhp.SeedWhp c U n_max} {fs : SuccinctWhp.FastState} {s : Memory.State} (henv : WhpLargeEnv c U V w n_max w base) (hce : fs.curEp = 0 ∨ fs.curEp = 1) (hb : b < SuccinctWhp.numBucketsWhp n_max) (hor : fs.overmarsRole b < 3) (hom_fn : fs.overmarsActive b = 1 → fs.overmarsInsCount b ≤ 8 * FeistelQuotient.slabScale n_max ^ 12 ∧ ∃ (om : ℕ → Option ℕ), SuccinctWhp.ValidWhpSlice n_max (fs.overmarsInsCount b) (fs.slices (fs.overmarsSliceIdx b)) om) (hfp : fp_live_u < 2 ^ SuccinctWhp.fpBitsWhp n_max) (hseed : SeedWhpMemRep base c U w n_max θ s.mem) (hrep : FastMemRep base c U V w n_max fs s.mem) :
have prog := delRemOmGenProg ((((mkWhpCoreParams c U V w n_max, base), b), loc_del), st_del, fp_live_u); have s' := (Memory.spec 0).clientState s prog; have omIdx := fs.overmarsSliceIdx b; have slices2 := if fs.overmarsActive b = 1 ∧ loc_del < fs.overmarsCursor b ∧ SuccinctWhp.inLiveTree fs.rebStage fs.oldEp (fs.rebDoneFlag b) st_del = true then Function.update fs.slices omIdx (SuccinctWhp.btreeDelete (SuccinctWhp.fpBitsWhp n_max) (SuccinctWhp.valLaneBitsWhp n_max) (SuccinctWhp.tMinWhp n_max) (fs.slices omIdx) fp_live_u) else fs.slices; WordRAM.Realization.memoryCost prog s ≤ 285 ∧ Succinct.ValidProg w (base + SuccinctWhp.largeSpaceWhp c U V w n_max) s prog ∧ FastStateStep base c U V w n_max θ { quotArr := fs.quotArr, valArr := fs.valArr, locState := fs.locState, bktCount := fs.bktCount, bktSalt := fs.bktSalt, liveRole := fs.liveRole, liveInsCount := fs.liveInsCount, overmarsRole := fs.overmarsRole, overmarsActive := fs.overmarsActive, overmarsCursor := fs.overmarsCursor, overmarsInsCount := fs.overmarsInsCount, rebDoneFlag := fs.rebDoneFlag, rebQueued := fs.rebQueued, backPtr := fs.backPtr, poolFreeTop := fs.poolFreeTop, poolFreeStack := fs.poolFreeStack, poolOwner := fs.poolOwner, slices := slices2, buf := fs.buf, curEp := fs.curEp, epochClock := fs.epochClock, rebStage := fs.rebStage, stageCursor := fs.stageCursor, dirtyCount := fs.dirtyCount, dirtyBuckets := fs.dirtyBuckets, dirtyIdx := fs.dirtyIdx, rebCandSalt := fs.rebCandSalt, rebScanCursor := fs.rebScanCursor, rebInsCount := fs.rebInsCount, rebCollision := fs.rebCollision } s s'