Documentation

CslibFrontier.DataStructure.Dictionary.WordRAM.SuccinctWhpBTreeProg.DescendSplit

Top-Down Proactive-Splitting Descent (descendSplitLoopGenProg) #

Implements and certifies phase 2 of btreeInsertGenProg: descending from a non-full internal node to a guaranteed non-full leaf via Realizes.iterate₀, proactively splitting any full child along the search path.

Bounded iterate loop refining descendSplitToLeaf (d = (((((cp, base), sIdx), q), (alloc, cur)), fuel)).

Precondition for descendSplitLoopGenProg (d = (((((cp, base), sIdx), q), (alloc, cur)), fuel)).

theorem Cslib.DataStructure.Dictionary.WordRAM.SuccinctWhp.descendSplitLoopGenProg_spec {isRoot : Bool} {c U V w n_max base sIdx q cur fuel lo hi : ℕ} {sl : SuccinctWhp.BTreeSlice} {mapFn : ℕ → Option ℕ} {T : SuccinctWhp.BTreeTree} {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) (halloc_fuel : sl.alloc + fuel ≤ SuccinctWhp.nSliceWhp n_max) (hrt : T.rootIdx = cur) (hnf : SuccinctWhp.metaCount (sl.nodes cur).metaWord < 2 * SuccinctWhp.tMinWhp n_max - 1) (hht_le : T.height ≤ fuel) (hqlo : lo ≤ q) (hqhi : q ≤ hi) (hhi : hi < 2 ^ SuccinctWhp.fpBitsWhp n_max) (hv : SuccinctWhp.ValidSubtree isRoot (SuccinctWhp.fpBitsWhp n_max) (SuccinctWhp.valLaneBitsWhp n_max) (SuccinctWhp.tMinWhp n_max) sl.alloc sl.nodes lo hi mapFn T) :
have d0 := (((mkWhpCoreParams c U V w n_max, base), sIdx), q); have prog := descendSplitLoopGenProg ((d0, sl.alloc, cur), fuel); have p := SuccinctWhp.descendSplitToLeaf (SuccinctWhp.fpBitsWhp n_max) (SuccinctWhp.valLaneBitsWhp n_max) (SuccinctWhp.tMinWhp n_max) fuel sl cur q; have s' := (Memory.spec 0).clientState s prog; s'.frontier = s.frontier ∧ (Memory.spec 0).clientResult s prog = (p.1.alloc, p.2) ∧ WordRAM.Realization.memoryCost prog s ≤ 52 * fuel ∧ Succinct.ValidProg w (base + SuccinctWhp.largeSpaceWhp c U V w n_max) s prog ∧ DescendSplitLoopGenPre w ((d0, sl.alloc, cur), fuel) s ∧ BTreeSliceMemRep base c U V w n_max sIdx p.1 s'.mem ∧ (∃ (isR : Bool) (cntL : ℕ) (loL : ℕ) (hiL : ℕ), cntL < 2 * SuccinctWhp.tMinWhp n_max - 1 ∧ loL ≤ q ∧ q ≤ hiL ∧ hiL < 2 ^ SuccinctWhp.fpBitsWhp n_max ∧ SuccinctWhp.ValidSubtree isR (SuccinctWhp.fpBitsWhp n_max) (SuccinctWhp.valLaneBitsWhp n_max) (SuccinctWhp.tMinWhp n_max) p.1.alloc p.1.nodes loL hiL mapFn (SuccinctWhp.BTreeTree.leaf p.2 cntL)) ∧ (∀ 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