Certified SWAR Top-Down Proactive-Split B+-Tree Insertion (btreeInsertGenProg) #
Assembles ensureAndSplitRootGenProg, descendSplitLoopGenProg, and finishLeafInsertGenProg
into btreeInsertGenProg with its O(1) (≤ 2426) specification and Realizes .exact
certificate.
Main definitions #
Cslib.DataStructure.Dictionary.WordRAM.SuccinctWhp.btreeInsertGenProg: parameter-freeMemory.Progimplementation ofbtreeInsert.
Main results #
Cslib.DataStructure.Dictionary.WordRAM.SuccinctWhp.btreeInsertGenProg_spec: exact refinement,memoryCost ≤ 2426,ValidProg,ValidWhpSlicepreservation, and slice/segment frame laws.Cslib.DataStructure.Dictionary.WordRAM.SuccinctWhp.realizes_btreeInsertGen:Realizes .exactcertificate with zero local work.
@[irreducible]
Parameter-free btreeInsert (d = ((((cp, base), sIdx), q), val)), factored cleanly into
ensureAndSplitRootGenProg, descendSplitLoopGenProg, and finishLeafInsertGenProg.
theorem Cslib.DataStructure.Dictionary.WordRAM.SuccinctWhp.btreeInsertGenProg_spec {c U V w n_max base sIdx insCount q val : ℕ} {sl : SuccinctWhp.BTreeSlice} {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) (hrep : BTreeSliceMemRep base c U V w n_max sIdx sl s.mem) (hv : SuccinctWhp.ValidWhpSlice n_max insCount sl 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)
sl q val;
s'.frontier = s.frontier ∧ WordRAM.Realization.memoryCost prog s ≤ 2426 ∧ Succinct.ValidProg w (base + SuccinctWhp.largeSpaceWhp c U V w n_max) s prog ∧ BTreeSliceMemRep base c U V w n_max sIdx sl' s'.mem ∧ SuccinctWhp.ValidWhpSlice n_max (insCount + 1) sl' (Function.update mapFn q (some val)) ∧ (∀ sIdx' < 3 * SuccinctWhp.numBucketsWhp n_max,
sIdx' ≠ sIdx →
∀ (sl₂ : SuccinctWhp.BTreeSlice),
BTreeSliceMemRep base c U V w n_max sIdx' sl₂ s.mem →
BTreeSliceMemRep base c U V w n_max sIdx' sl₂ s'.mem) ∧ (∀ idx < 16 * SuccinctWhp.numBucketsWhp n_max,
idx ≠ 16 * (sIdx / 3) + 10 + 2 * (sIdx % 3) →
idx ≠ 16 * (sIdx / 3) + 11 + 2 * (sIdx % 3) →
BitPackedArray.readPacked (base + offBktMeta c U V w n_max) (SuccinctBucket.globalPtrBits n_max) w
s'.mem idx = BitPackedArray.readPacked (base + offBktMeta c U V w n_max) (SuccinctBucket.globalPtrBits n_max) w
s.mem idx) ∧ ∀ (a : ℕ),
a < base + offBktMeta c U V w n_max ∨ base + offFbStart c U V w n_max ≤ a ∧ a < base + offBtMeta c U V w n_max ∨ base + offTrieChild0 c U V w n_max ≤ a →
s'.mem a = s.mem a