Fast-Mode SWAR B+-Tree Slice and Epoch-Buffer FastStateStep Wrappers #
This module lifts the certified SWAR B+-tree slice operations (SuccinctWhpBTreeProg) and
character-trie epoch buffer operations (SuccinctWhpBufferTrieProg) into FastStateStep
transitions on FastMemRep:
fastStep_of_bufEpFrame,bufDeleteGenProg_fastStep,bufInsertGenProg_fastStep.resetBTreeSliceGenProg_fastStep,btreeDeleteGenProg_fastStep,btreeUpdateGenProg_fastStep,btreeInsertGenProg_fastStep.
Main results #
theorem Cslib.DataStructure.Dictionary.WordRAM.SuccinctWhp.fastStep_of_bufEpFrame {base c U V w n_max ep : ℕ} {θ : SuccinctWhp.SeedWhp c U n_max} {fs : SuccinctWhp.FastState} {tr' : SuccinctWhp.BufTrie} {s s' : Memory.State} (hw : 0 < w) (hep : ep = 0 ∨ ep = 1) (hfr : s'.frontier = s.frontier) (hseed : SeedWhpMemRep base c U w n_max θ s.mem) (hrep : FastMemRep base c U V w n_max fs s.mem) (htr' : BufTrieMemRep base c U V w n_max ep tr' s'.mem) (hbfr : BufEpFrame base c U V w n_max ep s.mem s'.mem) :
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 := Function.update fs.buf ep tr', 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'
Lift any BufEpFrame + BufTrieMemRep update on ep ∈ {0, 1} into FastStateStep.
B+-Tree Slice FastStateStep Wrappers #
theorem Cslib.DataStructure.Dictionary.WordRAM.SuccinctWhp.resetBTreeSliceGenProg_fastStep {c U V w n_max base sIdx : ℕ} {θ : SuccinctWhp.SeedWhp c U n_max} {fs : SuccinctWhp.FastState} {s : Memory.State} (henv : WhpLargeEnv c U V w n_max w base) (hsIdx : sIdx < 3 * SuccinctWhp.numBucketsWhp 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 := resetBTreeSliceGenProg ((mkWhpCoreParams c U V w n_max, base), sIdx);
have s' := (Memory.spec 0).clientState s prog;
WordRAM.Realization.memoryCost prog s = 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 := Function.update fs.slices sIdx (SuccinctWhp.resetBTreeSlice (fs.slices sIdx)), 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'
theorem Cslib.DataStructure.Dictionary.WordRAM.SuccinctWhp.btreeDeleteGenProg_fastStep {c U V w n_max base sIdx insCount q : ℕ} {θ : SuccinctWhp.SeedWhp c U n_max} {fs : SuccinctWhp.FastState} {mapFn : ℕ → Option ℕ} {s : Memory.State} (henv : WhpLargeEnv c U V w n_max w base) (hsIdx : sIdx < 3 * SuccinctWhp.numBucketsWhp n_max) (hins : insCount ≤ 8 * FeistelQuotient.slabScale n_max ^ 12) (hseed : SeedWhpMemRep base c U w n_max θ s.mem) (hrep : FastMemRep base c U V w n_max fs s.mem) (hv : SuccinctWhp.ValidWhpSlice n_max insCount (fs.slices sIdx) mapFn) (hq : q < 2 ^ SuccinctWhp.fpBitsWhp n_max) :
have prog := btreeDeleteGenProg (((mkWhpCoreParams c U V w n_max, base), sIdx), q);
have s' := (Memory.spec 0).clientState s prog;
have sl' :=
SuccinctWhp.btreeDelete (SuccinctWhp.fpBitsWhp n_max) (SuccinctWhp.valLaneBitsWhp n_max) (SuccinctWhp.tMinWhp n_max)
(fs.slices sIdx) q;
WordRAM.Realization.memoryCost prog s ≤ 274 ∧ 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 := Function.update fs.slices sIdx sl', 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'
theorem Cslib.DataStructure.Dictionary.WordRAM.SuccinctWhp.btreeUpdateGenProg_fastStep {c U V w n_max base sIdx insCount q newVal : ℕ} {θ : SuccinctWhp.SeedWhp c U n_max} {fs : SuccinctWhp.FastState} {mapFn : ℕ → Option ℕ} {s : Memory.State} (henv : WhpLargeEnv c U V w n_max w base) (hsIdx : sIdx < 3 * SuccinctWhp.numBucketsWhp n_max) (hins : insCount ≤ 8 * FeistelQuotient.slabScale n_max ^ 12) (hseed : SeedWhpMemRep base c U w n_max θ s.mem) (hrep : FastMemRep base c U V w n_max fs s.mem) (hv : SuccinctWhp.ValidWhpSlice n_max insCount (fs.slices sIdx) mapFn) (hq : q < 2 ^ SuccinctWhp.fpBitsWhp n_max) (hval : newVal < 2 ^ SuccinctWhp.valLaneBitsWhp n_max) :
have prog := btreeUpdateGenProg ((((mkWhpCoreParams c U V w n_max, base), sIdx), q), newVal);
have s' := (Memory.spec 0).clientState s prog;
have sl' :=
SuccinctWhp.btreeUpdate (SuccinctWhp.fpBitsWhp n_max) (SuccinctWhp.valLaneBitsWhp n_max) (SuccinctWhp.tMinWhp n_max)
(fs.slices sIdx) q newVal;
WordRAM.Realization.memoryCost prog s ≤ 274 ∧ 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 := Function.update fs.slices sIdx sl', 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'
theorem Cslib.DataStructure.Dictionary.WordRAM.SuccinctWhp.btreeInsertGenProg_fastStep {c U V w n_max base sIdx insCount q val : ℕ} {θ : SuccinctWhp.SeedWhp c U n_max} {fs : SuccinctWhp.FastState} {mapFn : ℕ → Option ℕ} {s : Memory.State} (henv : WhpLargeEnv c U V w n_max w base) (hsIdx : sIdx < 3 * SuccinctWhp.numBucketsWhp n_max) (hins : insCount ≤ 8 * FeistelQuotient.slabScale n_max ^ 12) (hseed : SeedWhpMemRep base c U w n_max θ s.mem) (hrep : FastMemRep base c U V w n_max fs s.mem) (hv : SuccinctWhp.ValidWhpSlice n_max insCount (fs.slices sIdx) mapFn) (hq : q < 2 ^ SuccinctWhp.fpBitsWhp n_max) (hval : val < 2 ^ SuccinctWhp.valLaneBitsWhp n_max) :
have prog := btreeInsertGenProg ((((mkWhpCoreParams c U V w n_max, base), sIdx), q), val);
have s' := (Memory.spec 0).clientState s prog;
have sl' :=
SuccinctWhp.btreeInsert (SuccinctWhp.fpBitsWhp n_max) (SuccinctWhp.valLaneBitsWhp n_max) (SuccinctWhp.tMinWhp n_max)
(fs.slices sIdx) q val;
WordRAM.Realization.memoryCost prog s ≤ 2426 ∧ 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 := Function.update fs.slices sIdx sl', 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'
BufTrie FastStateStep Wrappers #
theorem Cslib.DataStructure.Dictionary.WordRAM.SuccinctWhp.bufDeleteGenProg_fastStep {c U V w n_max base ep rKey : ℕ} {θ : SuccinctWhp.SeedWhp c U n_max} {fs : SuccinctWhp.FastState} {mapFn : ℕ → Option (ℕ × ℕ)} {s : Memory.State} (henv : WhpLargeEnv c U V w n_max w base) (hep : ep = 0 ∨ ep = 1) (hseed : SeedWhpMemRep base c U w n_max θ s.mem) (hrep : FastMemRep base c U V w n_max fs s.mem) (hv : SuccinctWhp.ValidBufTrie (SuccinctWhp.cTabWhp c) (SuccinctWhp.bCharWhp n_max) (fs.buf ep) mapFn) :
have prog := bufDeleteGenProg (((mkWhpCoreParams c U V w n_max, base), ep), rKey);
have s' := (Memory.spec 0).clientState s prog;
have tr' := SuccinctWhp.bufDelete (SuccinctWhp.cTabWhp c) (SuccinctWhp.bCharWhp n_max) (fs.buf ep) rKey;
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 := Function.update fs.buf ep tr', 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'
theorem Cslib.DataStructure.Dictionary.WordRAM.SuccinctWhp.bufInsertGenProg_fastStep {c U V w n_max base ep rKey b loc : ℕ} {θ : SuccinctWhp.SeedWhp c U n_max} {fs : SuccinctWhp.FastState} {mapFn : ℕ → Option (ℕ × ℕ)} {s : Memory.State} (henv : WhpLargeEnv c U V w n_max w base) (hep : ep = 0 ∨ ep = 1) (hseed : SeedWhpMemRep base c U w n_max θ s.mem) (hrep : FastMemRep base c U V w n_max fs s.mem) (hv : SuccinctWhp.ValidBufTrie (SuccinctWhp.cTabWhp c) (SuccinctWhp.bCharWhp n_max) (fs.buf ep) mapFn) (hna_cap : (fs.buf ep).nodeAlloc + SuccinctWhp.cTabWhp c ≤ SuccinctWhp.maxTrieNodesWhp c n_max) (hia_cap : (fs.buf ep).itemAlloc < SuccinctWhp.qEpochWhp n_max) (hb : b < SuccinctWhp.numBucketsWhp n_max) (hloc : loc < SuccinctWhp.totalLocalCoordsWhp n_max) :
have prog := bufInsertGenProg ((((mkWhpCoreParams c U V w n_max, base), ep), rKey), b, loc);
have s' := (Memory.spec 0).clientState s prog;
have tr' := SuccinctWhp.bufInsert (SuccinctWhp.cTabWhp c) (SuccinctWhp.bCharWhp n_max) (fs.buf ep) rKey b loc;
WordRAM.Realization.memoryCost prog s ≤ 20 * SuccinctWhp.cTabWhp c + 24 ∧ 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 := Function.update fs.buf ep tr', 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'