Top-Down Split-Only SWAR B+-Tree Insertion and ValidWhpSlice Bundle #
This module completes the functional correctness and excess-key split-potential proof for
descendSplitToLeaf and btreeInsert and packages the slice-level ValidWhpSlice invariant
specialized to SuccinctWhp parameters.
Main definitions #
Cslib.DataStructure.Dictionary.SuccinctWhp.ValidWhpSlice: slice-level ordered-map and excess-key split-potential invariant specialized to(fpBitsWhp n_max, valLaneBitsWhp n_max, tMinWhp n_max).
Main results #
Cslib.DataStructure.Dictionary.SuccinctWhp.btreeInsert_subtree_spec: top-level subtree specification ofbtreeInsert.Cslib.DataStructure.Dictionary.SuccinctWhp.ValidSubtree.node_bits_lt: packed single-word bit-width bounds onmetaWord,keysWord, andvalsWordfor every node of a valid subtree.Cslib.DataStructure.Dictionary.SuccinctWhp.validWhpSlice_zero,Cslib.DataStructure.Dictionary.SuccinctWhp.ValidWhpSlice.lookup_eq,Cslib.DataStructure.Dictionary.SuccinctWhp.ValidWhpSlice.delete_spec,Cslib.DataStructure.Dictionary.SuccinctWhp.ValidWhpSlice.update_spec,Cslib.DataStructure.Dictionary.SuccinctWhp.ValidWhpSlice.insert_spec: exact ordered-map refinement and preservation ofValidWhpSliceacross initialization and all four operations.Cslib.DataStructure.Dictionary.SuccinctWhp.ValidWhpSlice.alloc_and_height_lt: everyValidWhpSlicewithinsCount ≤ 8 * (slabScale n_max) ^ 12atwhpThreshold c ≤ n_maxsatisfiessl.alloc + hMaxBTree + 4 < nSliceWhp n_maxand unpacks (when1 ≤ sl.alloc) to aValidSubtreewitness of height< hMaxBTreewhose nodes satisfy packed single-word bit-width bounds.
References #
Section 1: Inductive correctness and potential bound for descendSplitToLeaf #
Lanes and child intervals after wordInsertAt #
Splitting child r of a branch inserts the promoted separator at key lane r and the new right
child at value lane r + 1. The right half then sits at position r.succ and the old child k
(the left half when k = r) at position r.succ.succAbove k.
Section 2: Full btreeInsert specification and ValidSlice invariant #
Top-level subtree specification of btreeInsert on an already-initialized slice (1 ≤ alloc):
increases height by at most 1 and excess-key split potential (tMin - 2) * (alloc - 1) + 2 * pot
by at most 2.
Every node inside a ValidSubtree automatically satisfies the packed bit-width bounds whenever
1 ≤ tMin and 4 * tMin ≤ 2 ^ metaBits.
Section 3: Concrete SuccinctWhpParams instantiation (ValidWhpSlice) #
Self-contained SuccinctWhp slice invariant coupling BTreeSlice (alloc = 0 empty or
1 ≤ alloc rooted ValidSubtree) with insertion count insCount at capacity n_max.
Unallocated slice (alloc = 0) satisfies ValidWhpSlice for the empty map.
64 ≤ nSliceWhp n_max unconditionally.
Bounded allocation, height, and packed-word eliminator
(ValidWhpSlice.alloc_and_height_lt): Whenever whpThreshold c ≤ n_max and
insCount ≤ 8 * (slabScale n_max) ^ 12, any ValidWhpSlice n_max insCount sl mapFn has
sl.alloc + hMaxBTree + 4 < nSliceWhp n_max and unpacks either to
sl.alloc = 0 ∧ mapFn = fun _ => none or to a rooted ValidSubtree spine T of height
< hMaxBTree whose nodes fit within (nodeMetaBitsWhp, keysWordBitsWhp, valsWordBitsWhp).
Lookup on a ValidWhpSlice returns mapFn q for every q < 2 ^ fpBitsWhp n_max.
Deletion on a ValidWhpSlice preserves ValidWhpSlice at the same insCount.
In-place value update on a ValidWhpSlice preserves ValidWhpSlice at the same insCount.
Insertion on a ValidWhpSlice produces a ValidWhpSlice at insCount + 1 with alloc < nSliceWhp n_max.