Documentation

CslibFrontier.DataStructure.Dictionary.SubconstantRedundancy.TreeDelete

Quotient-Recovering Deletion (Algorithm 3) in the Multi-Level Dictionary Tree #

This file formalizes Algorithm 3 (deleteAndGetQuotient) and normal-path deletion (normalDeleteMem) of Tianxiao Li, Jingxun Liang, Huacheng Yu, and Renfei Zhou, Dynamic Dictionary with Subconstant Wasted Bits per Key ([LiLiangYuZhou2024, Section 5.3, Algorithm 3]; arXiv:2310.20536v1, PDF p. 31 / printed p. 30).

Main definitions #

Main results #

References #

Section 2: Algorithm 3 (deleteAndGetQuotient) and normalDeleteMem #

Algorithm 3 (DeleteAndGetQuotient, [LiLiangYuZhou2024, Section 5.3], PDF p. 31 / printed p. 30): recursively deletes z_id from levels 1 .. ℓ along u's ancestor path while maintaining full capacity at levels 2 .. ℓ via waiting-list replacement and returning (st', z_quot^[ℓ], z_val).

structure Cslib.DataStructure.Dictionary.SubconstantRedundancy.TreeSchedule.TreeState.DeletePrefixPost {P : TreeSchedule} (scheme : DynamicMatching.Scheme (2 ^ P.idBits P.depth) (P.nLow P.depth)) (st st' : P.TreeState) (d : P.PaddedDict) (storeLvl storeLvl' : Fin P.paddedUniv → ℕ) (ℓ : ℕ) (hℓ : ℓ ≤ P.depth) (z : Fin P.paddedUniv) :

Inductive prefix postcondition of deleteAndGetQuotient at level ℓ (1 ≤ ℓ ≤ depth).

theorem Cslib.DataStructure.Dictionary.SubconstantRedundancy.TreeSchedule.TreeState.deleteAndGetQuotient_spec {P : TreeSchedule} {scheme : DynamicMatching.Scheme (2 ^ P.idBits P.depth) (P.nLow P.depth)} {st : P.TreeState} {d : P.PaddedDict} {storeLvl : Fin P.paddedUniv → ℕ} (hwf : WellFormedPadded scheme st d storeLvl) (ℓ : ℕ) (h1 : 1 ≤ ℓ) (hℓ : ℓ ≤ P.depth) (u : Fin (P.numNodes ℓ)) (z : Fin P.paddedUniv) (vz : Fin P.valBound) :
d z = some vz → st.seeds.nodeAt ℓ hℓ z = u → storeLvl z ≤ ℓ → (∀ (j : ℕ), 2 ≤ j → ∀ (hj : j ≤ ℓ), P.nLow j < (st.seeds.activeAt (P.paddedDom d) j ⋯ (P.ancestorAt hj u)).card) → match deleteAndGetQuotient scheme st ℓ h1 hℓ u (st.seeds.idAt ℓ h1 hℓ z) with | (st', quot, val) => quot = st.seeds.quotAt ℓ h1 hℓ z ∧ val = vz ∧ ∃ (storeLvl' : Fin P.paddedUniv → ℕ), DeletePrefixPost scheme st st' d storeLvl storeLvl' ℓ hℓ z

Algorithm 3 correctness (deleteAndGetQuotient_spec): for any active key z at (ℓ, u) with storeLvl z ≤ ℓ whose ancestors at levels 2 .. ℓ strictly exceed nLow j, deleteAndGetQuotient returns (quotAt ℓ z, v_z) and establishes DeletePrefixPost up to ℓ.

Normal-path deletion of an active internal key z ∈ P.paddedDom d, invoking Algorithm 3 starting at the leaf (depth, nodeAt depth z) (Section 5.3, PDF p. 31 / printed p. 30). Carries a member-only contract (z ∈ P.paddedDom d on a WellFormedPadded state; Algorithm 3 routes by compressed ID and is not a no-op on absent keys or malformed states).

theorem Cslib.DataStructure.Dictionary.SubconstantRedundancy.TreeSchedule.TreeState.wellFormedPadded_normalDeleteMem {P : TreeSchedule} {scheme : DynamicMatching.Scheme (2 ^ P.idBits P.depth) (P.nLow P.depth)} {st : P.TreeState} {d : P.PaddedDict} {storeLvl : Fin P.paddedUniv → ℕ} (hwf : WellFormedPadded scheme st d storeLvl) {z : Fin P.paddedUniv} (hz : z ∈ P.paddedDom d) (hgood' : st.seeds.AllGoodSeeds ((P.paddedDom d).erase z)) :
(normalDeleteMem scheme st z).sentCount = st.sentCount ∧ (normalDeleteMem scheme st z).seeds = st.seeds ∧ ∃ (storeLvl' : Fin P.paddedUniv → ℕ), WellFormedPadded scheme (normalDeleteMem scheme st z) (Function.update d z none) storeLvl'

Normal-path deletion preserves WellFormedPadded whenever z ∈ P.paddedDom d and all current node seeds remain good on (P.paddedDom d).erase z.