Proactive Full-Child Split Subprogram (splitChildCode) #
Internal Word-RAM subroutine used privately by InsertLoop (never re-exported publicly by
CslibFrontier.DataStructure.BTree.WordRAM): splits a full (2 * t - 1)-key child c of a
non-full internal parent u at child index slot, shifting parent keys/values/children and
promoting the median key into u (memSplitChild).
Split full child rChild = c of non-full internal parent rCur = u at child slot rSlot
(memSplitChild).
theorem Cslib.DataStructure.BTree.WordRAM.splitChildCode_spec {w base capNodes t u m slot c cnt : ℕ} {x : WordRAM.Data 20} (ht : 2 ≤ t) (hu_lt : u < cnt) (hc_lt : c < cnt) (huc : u ≠ c) (hcap : cnt + 1 ≤ capNodes) (hm_le : m ≤ 2 * t - 2) (hslot : slot ≤ m) (hbdd : WordRAM.Data.Bounded w x) (hfit : WordRAM.Fits w (base + arenaWords t capNodes)) (hz0 : x.regs rZero = 0) (ho : x.regs rOne = 1) (hbase : x.regs Reg.rBase = base) (hdeg : x.regs Reg.rDeg = t) (hstride : x.regs rStride = 6 * t) (hcur : x.regs rCur = u) (hnk : x.regs rNumK = m) (hslot_reg : x.regs rSlot = slot) (hchild : x.regs rChild = c) (hcnt : x.regs rCnt = cnt) :
∃ (y : WordRAM.Data 20),
WordRAM.ExecWithin w splitChildCode x y (75 * t + 115) ∧ WordRAM.Data.Bounded w y ∧ y.mem = memSplitChild base t u m slot c cnt x.mem ∧ WordRAM.Modifies { base := base, length := arenaWords t capNodes }.footprint x.mem y.mem ∧ y.regs rZero = 0 ∧ y.regs rOne = 1 ∧ y.regs Reg.rBase = base ∧ y.regs Reg.rDeg = t ∧ y.regs rStride = 6 * t ∧ y.regs Reg.rKey = x.regs Reg.rKey ∧ y.regs Reg.rVal = x.regs Reg.rVal ∧ y.regs rActive = x.regs rActive ∧ y.regs rCur = u ∧ y.regs rSlot = slot ∧ y.regs rChild = c ∧ y.regs rNumK = m + 1 ∧ y.regs rCnt = cnt + 1
Specification of splitChildCode, realizing memSplitChild base t u m slot c cnt in
75 * t + 115 instructions.
theorem Cslib.DataStructure.BTree.WordRAM.keyAt_memSplitChild_gt {base t u m slot c cnt i : ℕ} {mem : ℕ → ℕ} (ht : 2 ≤ t) (hm_le : m ≤ 2 * t - 2) (hslot : slot ≤ m) (huc : u ≠ c) (huz : u ≠ cnt) (hge : slot + 1 ≤ i) (hi : i < m + 1) :
Parent keys strictly after slot shift right by 1 under memSplitChild.