Word-RAM B-Tree Proactive Top-Down Insertion (O(t log_t n)) #
Proactive top-down B-tree insertion code insertCode and halting flat program insertProgram over
Cslib.WordRAM.Basis.standard (20 registers), following [CLRS09], Section 18.2: splits a full
root via splitRootCode and descends through non-full nodes via insertLoop, realizing
Cslib.SortedAssoc.insert k v tr.toList in O(t log_t n) Word-RAM instructions while preserving
Rep (BTree.IsWF t) and outside memory.
Main definitions #
Cslib.DataStructure.BTree.WordRAM.insertCode: structured proactive top-down B-tree insertion code overBasis.standard.Cslib.DataStructure.BTree.WordRAM.insertProgram: halting flat program (insertCode.program rBase).
Main results #
Cslib.DataStructure.BTree.WordRAM.insertCode_spec,Cslib.DataStructure.BTree.WordRAM.insertCode_log_spec,Cslib.DataStructure.BTree.WordRAM.insertProgram_spec:O(t * (tr.height + 1))andO(t log_t n)Word-RAM instruction bounds,Reppreservation,SortedAssoc.insertcorrectness, node-allocation bound, and memory framing forinsertCodeandinsertProgram.Cslib.DataStructure.BTree.WordRAM.not_readsWidth_insertCode,Cslib.DataStructure.BTree.WordRAM.isRandFree_insertCode,Cslib.DataStructure.BTree.WordRAM.not_readsWidth_insertProgram,Cslib.DataStructure.BTree.WordRAM.isRandFree_insertProgram: width-independence and determinism (rand-freedom) certificates.
References #
Insert (rKey, rVal) into the B-tree arena at rBase of minimum degree rDeg using proactive
top-down node splitting ([CLRS09], Section 18.2).
insertCode inserts (k, v) into tr in at most
(91 * t + 160) * (tr.height + 1) + (21 * t + 120) standard Word-RAM instructions, preserving
Rep (BTree.IsWF t tr'), realizing Cslib.SortedAssoc.insert k v tr.toList, allocating at most
tr.height + 2 arena nodes, and modifying only [base, base + arenaWords t capNodes).
Logarithmic O(t log_t n) Word-RAM instruction bound for insertCode.
Complete flat Word-RAM insertion program (insertCode followed by halt rBase).
insertCode does not read the runtime word width w.
insertCode is deterministic (rand-free).
insertProgram does not read the runtime word width w.
insertProgram is deterministic (rand-free).
Complete halting flat-program specification of insertProgram: runs in at most
(91 * t + 160) * (Nat.log t ((tr.size + 1) / 2) + 2) + (21 * t + 121) Word-RAM instructions
(charging the final halt), halting with base in rBase while preserving Rep on tr' with
tr'.toList = Cslib.SortedAssoc.insert k v tr.toList, bounding node allocation, and modifying only
[base, base + arenaWords t capNodes).