Documentation

CslibFrontier.DataStructure.Dictionary.WordRAM.SuccinctWhpBTreeProg.SplitOps

Shared Node-Split Primitives and Opaque Call Wrappers for btreeInsertGenProg #

Provides bit-width bounds on splitFullNode, the 3-node + alloc frame theorem threeNodeWrites_and_alloc_sliceRep, and @[irreducible] call wrappers (writeNodeOpProg, splitNodeOpProg, wordInsertOpProg, writeSplitFourOpProg) shared across root-split, proactive-split descent, and leaf insertion.

theorem Cslib.DataStructure.Dictionary.WordRAM.SuccinctWhp.threeNodeWrites_and_alloc_sliceRep {c U V w n_max base sIdx newA idx1 idx2 idx3 : ℕ} {sl : SuccinctWhp.BTreeSlice} {nd1 nd2 nd3 : SuccinctWhp.BTreeNode} {s : Memory.State} (henv : WhpLargeEnv c U V w n_max w base) (hsIdx : sIdx < 3 * SuccinctWhp.numBucketsWhp n_max) (hrep : BTreeSliceMemRep base c U V w n_max sIdx sl s.mem) (hnewA_hi : newA ≤ SuccinctWhp.nSliceWhp n_max) (hu1 : idx1 < newA) (hu2 : idx2 < newA) (hu3 : idx3 < newA) (hcov : ∀ v < newA, v < sl.alloc ∨ v = idx1 ∨ v = idx2 ∨ v = idx3) (hm1 : nd1.metaWord < 2 ^ SuccinctWhp.nodeMetaBitsWhp n_max) (hk1 : nd1.keysWord < 2 ^ SuccinctWhp.keysWordBitsWhp n_max) (hv1 : nd1.valsWord < 2 ^ SuccinctWhp.valsWordBitsWhp n_max) (hm2 : nd2.metaWord < 2 ^ SuccinctWhp.nodeMetaBitsWhp n_max) (hk2 : nd2.keysWord < 2 ^ SuccinctWhp.keysWordBitsWhp n_max) (hv2 : nd2.valsWord < 2 ^ SuccinctWhp.valsWordBitsWhp n_max) (hm3 : nd3.metaWord < 2 ^ SuccinctWhp.nodeMetaBitsWhp n_max) (hk3 : nd3.keysWord < 2 ^ SuccinctWhp.keysWordBitsWhp n_max) (hv3 : nd3.valsWord < 2 ^ SuccinctWhp.valsWordBitsWhp n_max) :
have p0 := (mkWhpCoreParams c U V w n_max, base); have prog := do writeBTreeNodeGenProg (((p0, sIdx), idx1), nd1.metaWord, nd1.keysWord, nd1.valsWord) writeBTreeNodeGenProg (((p0, sIdx), idx2), nd2.metaWord, nd2.keysWord, nd2.valsWord) writeBTreeNodeGenProg (((p0, sIdx), idx3), nd3.metaWord, nd3.keysWord, nd3.valsWord) writeSliceAllocGenProg ((p0, sIdx), newA); have nodes3 := Function.update (Function.update (Function.update sl.nodes idx1 nd1) idx2 nd2) idx3 nd3; have s' := (Memory.spec 0).clientState s prog; s'.frontier = s.frontier ∧ WordRAM.Realization.memoryCost prog s = 40 ∧ Succinct.ValidProg w (base + SuccinctWhp.largeSpaceWhp c U V w n_max) s prog ∧ BTreeSliceMemRep base c U V w n_max sIdx { alloc := newA, root := sl.root, nodes := nodes3 } s'.mem ∧ (∀ 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) → 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

Shared 4-write frame lemma for proactive root/child splits: writing 3 nodes (idx1, nd1), (idx2, nd2), (idx3, nd3) below newA followed by writeSliceAllocGenProg establishes BTreeSliceMemRep for the updated slice and frames all other slices, other bktMeta fields, and outside segments.

@[irreducible]

Opaque call wrapper for writeBTreeNodeGenProg so multi-write subroutines do not cause exponential state unfolding inside realize.

@[irreducible]

Opaque call wrapper for wordInsertAtGenProg.

@[irreducible]

Opaque 4-write split helper (3 node writes + writeSliceAlloc) so ensureAndSplitRootGenProg and descendSplitStepGenProg perform only a single subroutine reindexing instead of four.