Fast Deletion Move-Last Rebuild Slice Relocation #
Sub-helper 6.2c relocating loc_last -> loc_del in rebSlice[b] and handling Stage-2 candidate
rebuild collisions.
Main definitions #
Main results #
theorem Cslib.DataStructure.Dictionary.WordRAM.SuccinctWhp.realizes_delMoveRebGen :
WordRAM.Realization.Realizes WordRAM.Basis.exact delMoveRebGenProg WordRAM.Realization.WordEncoding.encode
WordRAM.Realization.WordEncoding.encode
(fun (w : ℕ) (x : (((WhpCoreParams × ℕ) × ℕ) × ℕ × ℕ) × (ℕ × ℕ) × ℕ) (s : Memory.State) =>
match x with
| ((((cp, base), b), loc_del, snd), (rebAct, snd_1), fp_cand_last) =>
∃ (c : ℕ) (U : ℕ) (V : ℕ) (w₀ : ℕ) (n_max : ℕ) (θ : SuccinctWhp.SeedWhp c U n_max) (fs : SuccinctWhp.FastState),
WhpLargeEnv c U V w₀ n_max w base ∧ cp = mkWhpCoreParams c U V w₀ n_max ∧ SeedWhpMemRep base c U w₀ n_max θ s.mem ∧ FastMemRep base c U V w₀ n_max fs s.mem ∧ (fs.curEp = 0 ∨ fs.curEp = 1) ∧ b < SuccinctWhp.numBucketsWhp n_max ∧ fs.rebSliceIdx b < 3 * SuccinctWhp.numBucketsWhp n_max ∧ loc_del < SuccinctWhp.totalLocalCoordsWhp n_max ∧ fp_cand_last < 2 ^ SuccinctWhp.fpBitsWhp n_max ∧ (rebAct = 1 →
fs.rebCandSalt < SuccinctWhp.sMaxWhp c n_max ∧ fs.rebInsCount < 8 * FeistelQuotient.slabScale n_max ^ 12 ∧ ∃ (rm : ℕ → Option ℕ),
SuccinctWhp.ValidWhpSlice n_max fs.rebInsCount (fs.slices (fs.rebSliceIdx b)) rm))
fun (x : (((WhpCoreParams × ℕ) × ℕ) × ℕ × ℕ) × (ℕ × ℕ) × ℕ) (x_1 : Memory.State) => 0
theorem Cslib.DataStructure.Dictionary.WordRAM.SuccinctWhp.delMoveRebGenProg_fastStep {c U V w n_max base b loc_del loc_last st_last fp_cand_last : ℕ} {rebActiveB : Bool} {θ : 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) (hrIdx : fs.rebSliceIdx b < 3 * SuccinctWhp.numBucketsWhp n_max) (hld : loc_del < SuccinctWhp.totalLocalCoordsWhp n_max) (hfp : fp_cand_last < 2 ^ SuccinctWhp.fpBitsWhp n_max) (hreb_fn :
rebActiveB = true →
fs.rebCandSalt < SuccinctWhp.sMaxWhp c n_max ∧ fs.rebInsCount < 8 * FeistelQuotient.slabScale n_max ^ 12 ∧ ∃ (rm : ℕ → Option ℕ), SuccinctWhp.ValidWhpSlice n_max fs.rebInsCount (fs.slices (fs.rebSliceIdx b)) rm) (hseed : SeedWhpMemRep base c U w n_max θ s.mem) (hrep : FastMemRep base c U V w n_max fs s.mem) :
have rebAct := if rebActiveB = true then 1 else 0;
have prog :=
delMoveRebGenProg ((((mkWhpCoreParams c U V w n_max, base), b), loc_del, loc_last), (rebAct, st_last), fp_cand_last);
have s' := (Memory.spec 0).clientState s prog;
have rIdx := fs.rebSliceIdx b;
match
if (rebActiveB && decide (st_last = 1 ∨ st_last = 2 + fs.oldEp)) = true then
if loc_last < fs.rebScanCursor then
(Function.update fs.slices rIdx
(SuccinctWhp.btreeUpdate (SuccinctWhp.fpBitsWhp n_max) (SuccinctWhp.valLaneBitsWhp n_max)
(SuccinctWhp.tMinWhp n_max) (fs.slices rIdx) fp_cand_last loc_del), fs.rebCandSalt, fs.rebScanCursor, fs.rebInsCount)
else if loc_del < fs.rebScanCursor then
match
SuccinctWhp.btreeLookup (SuccinctWhp.fpBitsWhp n_max) (SuccinctWhp.valLaneBitsWhp n_max)
(SuccinctWhp.tMinWhp n_max) (fs.slices rIdx) fp_cand_last with
| some val =>
(Function.update fs.slices rIdx (SuccinctWhp.resetBTreeSlice (fs.slices rIdx)), fs.rebCandSalt + 1, 0, 0)
| none =>
(Function.update fs.slices rIdx
(SuccinctWhp.btreeInsert (SuccinctWhp.fpBitsWhp n_max) (SuccinctWhp.valLaneBitsWhp n_max)
(SuccinctWhp.tMinWhp n_max) (fs.slices rIdx) fp_cand_last loc_del), fs.rebCandSalt, fs.rebScanCursor, fs.rebInsCount + 1)
else (fs.slices, fs.rebCandSalt, fs.rebScanCursor, fs.rebInsCount)
else (fs.slices, fs.rebCandSalt, fs.rebScanCursor, fs.rebInsCount) with
| (slices', rebCandSalt', rebScanCursor', rebInsCount') =>
WordRAM.Realization.memoryCost prog s ≤ 2696 ∧ 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 := slices', 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 := rebCandSalt',
rebScanCursor := rebScanCursor', rebInsCount := rebInsCount', rebCollision := fs.rebCollision }
s s'