Documentation

CslibFrontier.DataStructure.Dictionary.SubconstantRedundancy.StorageNode

Subconstant-Redundancy Pure Storage Nodes and Metadata Separation #

This file formalizes the pure node-level storage structures and Section 5.6 metadata-versus-payload separation for the multi-level dictionary tree of Tianxiao Li, Jingxun Liang, Huacheng Yu, and Renfei Zhou, Dynamic Dictionary with Subconstant Wasted Bits per Key ([LiLiangYuZhou2024, Sections 5.2 and 5.6]; arXiv:2310.20536v1, PDF pp. 27–30 and 35–36 / printed pp. 26–29 and 34–35), re-exporting the regime-switched hash-seed spaces and concentration theorems from NodeSeeds.

Main definitions #

Main results #

References #

Section 3: Pure waiting lists, storage tables, and Section 5.6 metadata separation #

Bounded waiting list storing up to cap pairs (x_id^[ℓ], x_id^[ℓ - 1]) with distinct first components ([LiLiangYuZhou2024, Section 5.2]; arXiv:2310.20536v1, PDF p. 28 / printed p. 27).

@[instance_reducible]
instance Cslib.DataStructure.Dictionary.SubconstantRedundancy.instDecidableEqWaitingList {I_cur✝ I_prev✝ cap✝ : ℕ} :
DecidableEq (WaitingList I_cur✝ I_prev✝ cap✝)
def Cslib.DataStructure.Dictionary.SubconstantRedundancy.instDecidableEqWaitingList.decEq {I_cur✝ I_prev✝ cap✝ : ℕ} (x✝ x✝¹ : WaitingList I_cur✝ I_prev✝ cap✝) :
Decidable (x✝ = x✝¹)
def Cslib.DataStructure.Dictionary.SubconstantRedundancy.WaitingList.dom {I_cur I_prev cap : ℕ} (w : WaitingList I_cur I_prev cap) :
Finset (Fin (2 ^ I_cur))

Active level-ℓ ID set present in w.

Empty waiting list.

def Cslib.DataStructure.Dictionary.SubconstantRedundancy.WaitingList.lookup {I_cur I_prev cap : ℕ} (w : WaitingList I_cur I_prev cap) (k : Fin (2 ^ I_cur)) :
Option (Fin (2 ^ I_prev))

Look up the parent ID x_id^[ℓ - 1] associated with k : Fin (2 ^ I_cur).

@[simp]
theorem Cslib.DataStructure.Dictionary.SubconstantRedundancy.WaitingList.lookup_empty {I_cur I_prev cap : ℕ} (k : Fin (2 ^ I_cur)) :
(empty I_cur I_prev cap).lookup k = none
theorem Cslib.DataStructure.Dictionary.SubconstantRedundancy.WaitingList.lookup_eq_some_iff {I_cur I_prev cap : ℕ} (w : WaitingList I_cur I_prev cap) (k : Fin (2 ^ I_cur)) (v : Fin (2 ^ I_prev)) :
theorem Cslib.DataStructure.Dictionary.SubconstantRedundancy.WaitingList.isSome_lookup_iff {I_cur I_prev cap : ℕ} (w : WaitingList I_cur I_prev cap) (k : Fin (2 ^ I_cur)) :
def Cslib.DataStructure.Dictionary.SubconstantRedundancy.WaitingList.push {I_cur I_prev cap : ℕ} (w : WaitingList I_cur I_prev cap) (k : Fin (2 ^ I_cur)) (prev : Fin (2 ^ I_prev)) (hlen : w.entries.length + 1 ≤ cap) (hk : k ∉ w.dom) :
WaitingList I_cur I_prev cap

Push a fresh (k, prev) pair onto w.

@[simp]
theorem Cslib.DataStructure.Dictionary.SubconstantRedundancy.WaitingList.dom_push {I_cur I_prev cap : ℕ} (w : WaitingList I_cur I_prev cap) (k : Fin (2 ^ I_cur)) (prev : Fin (2 ^ I_prev)) (hlen : w.entries.length + 1 ≤ cap) (hk : k ∉ w.dom) :
(w.push k prev hlen hk).dom = insert k w.dom
@[simp]
theorem Cslib.DataStructure.Dictionary.SubconstantRedundancy.WaitingList.lookup_push {I_cur I_prev cap : ℕ} (w : WaitingList I_cur I_prev cap) (k : Fin (2 ^ I_cur)) (prev : Fin (2 ^ I_prev)) (hlen : w.entries.length + 1 ≤ cap) (hk : k ∉ w.dom) (k' : Fin (2 ^ I_cur)) :
(w.push k prev hlen hk).lookup k' = Function.update w.lookup k (some prev) k'
def Cslib.DataStructure.Dictionary.SubconstantRedundancy.WaitingList.remove {I_cur I_prev cap : ℕ} (w : WaitingList I_cur I_prev cap) (k : Fin (2 ^ I_cur)) :
WaitingList I_cur I_prev cap

Remove k (if present) from w (Algorithm 3, Branch 1).

@[simp]
theorem Cslib.DataStructure.Dictionary.SubconstantRedundancy.WaitingList.dom_remove {I_cur I_prev cap : ℕ} (w : WaitingList I_cur I_prev cap) (k : Fin (2 ^ I_cur)) :
(w.remove k).dom = w.dom.erase k
@[simp]
theorem Cslib.DataStructure.Dictionary.SubconstantRedundancy.WaitingList.lookup_remove {I_cur I_prev cap : ℕ} (w : WaitingList I_cur I_prev cap) (k k' : Fin (2 ^ I_cur)) :
def Cslib.DataStructure.Dictionary.SubconstantRedundancy.WaitingList.pop {I_cur I_prev cap : ℕ} (w : WaitingList I_cur I_prev cap) (hne : w.dom.Nonempty) :
(Fin (2 ^ I_cur) × Fin (2 ^ I_prev)) × WaitingList I_cur I_prev cap

Pop the head entry (y_id^[ℓ], y_id^[ℓ - 1]) of a nonempty waiting list (Algorithm 3, Branch 2).

@[reducible, inline]
abbrev Cslib.DataStructure.Dictionary.SubconstantRedundancy.WaitingList.popEntry {I_cur I_prev cap : ℕ} (w : WaitingList I_cur I_prev cap) (hne : w.dom.Nonempty) :
Fin (2 ^ I_cur) × Fin (2 ^ I_prev)

Popped (currentId, parentId) pair returned by w.pop hne.

theorem Cslib.DataStructure.Dictionary.SubconstantRedundancy.WaitingList.lookup_pop_fst {I_cur I_prev cap : ℕ} (w : WaitingList I_cur I_prev cap) (hne : w.dom.Nonempty) :
w.lookup (w.popEntry hne).1 = some (w.popEntry hne).2
@[simp]
theorem Cslib.DataStructure.Dictionary.SubconstantRedundancy.WaitingList.dom_pop_snd {I_cur I_prev cap : ℕ} (w : WaitingList I_cur I_prev cap) (hne : w.dom.Nonempty) :
(w.pop hne).2.dom = w.dom.erase (w.popEntry hne).1
@[simp]
theorem Cslib.DataStructure.Dictionary.SubconstantRedundancy.WaitingList.lookup_pop_snd {I_cur I_prev cap : ℕ} (w : WaitingList I_cur I_prev cap) (hne : w.dom.Nonempty) (k : Fin (2 ^ I_cur)) :
(w.pop hne).2.lookup k = Function.update w.lookup (w.popEntry hne).1 none k
noncomputable def Cslib.DataStructure.Dictionary.SubconstantRedundancy.WaitingList.ofFinset {I_cur I_prev cap : ℕ} (S : Finset (Fin (2 ^ I_cur))) (hS : S.card ≤ cap) (f : Fin (2 ^ I_cur) → Fin (2 ^ I_prev)) :
WaitingList I_cur I_prev cap

Build a waiting list from a finite set S (#S ≤ cap) and parent-ID map f.

@[simp]
theorem Cslib.DataStructure.Dictionary.SubconstantRedundancy.WaitingList.dom_ofFinset {I_cur I_prev cap : ℕ} (S : Finset (Fin (2 ^ I_cur))) (hS : S.card ≤ cap) (f : Fin (2 ^ I_cur) → Fin (2 ^ I_prev)) :
(ofFinset S hS f).dom = S
@[simp]
theorem Cslib.DataStructure.Dictionary.SubconstantRedundancy.WaitingList.lookup_ofFinset {I_cur I_prev cap : ℕ} (S : Finset (Fin (2 ^ I_cur))) (hS : S.card ≤ cap) (f : Fin (2 ^ I_cur) → Fin (2 ^ I_prev)) (k : Fin (2 ^ I_cur)) :
(ofFinset S hS f).lookup k = if k ∈ S then some (f k) else none

Pure storage-table ID metadata on Fin (2 ^ I) with m slots (Section 5.6 metadata component of SuccinctBucket, corresponding to the bit budget succinctTableMetaBits I m, though modeled here as an unpacked injective partial slot assignment Fin m → Option (Fin (2 ^ I)) with ∑_{k=0}^m C(m, k) · k! · C(2^I, k) states rather than packed to that bit budget by an explicit encoding).

Metadata-only slot locator (Section 5.6): returns some i iff key k occupies slot i, without inspecting quotient or value payloads.

Inner or root storage table separating tableMeta : StorageTableMeta I m (Section 5.6 metadata) from payload : Fin m → Fin Q × Fin V ((quot, val) payload slots).

  • tableMeta : StorageTableMeta I m

    Active-ID slot metadata separated from payload values (Section 5.6).

  • payload : Fin m → Fin Q × Fin V

    Per-slot (quotient, value) payload array.

@[instance_reducible]
def Cslib.DataStructure.Dictionary.SubconstantRedundancy.instDecidableEqStorageTable.decEq {I✝ m✝ Q✝ V✝ : ℕ} (x✝ x✝¹ : StorageTable I✝ m✝ Q✝ V✝) :
Decidable (x✝ = x✝¹)

Look up (quot, val) for k : Fin (2 ^ I) via metadata-only locateSlot followed by a single payload-slot read.

Empty storage table (given 1 ≤ Q and 1 ≤ V).

@[simp]
theorem Cslib.DataStructure.Dictionary.SubconstantRedundancy.StorageTable.query_empty {I m Q V : ℕ} (hQ : 1 ≤ Q) (hV : 1 ≤ V) (k : Fin (2 ^ I)) :
(empty I m hQ hV).query k = none
def Cslib.DataStructure.Dictionary.SubconstantRedundancy.StorageTable.overwrite {I m Q V : ℕ} (tbl : StorageTable I m Q V) (k : Fin (2 ^ I)) (qv : Fin Q × Fin V) (hk : k ∈ tbl.tableMeta.dom) :
StorageTable I m Q V

Overwrite the (quot, val) payload of an existing key k ∈ tbl.tableMeta.dom in place, leaving tableMeta unchanged.

@[simp]
theorem Cslib.DataStructure.Dictionary.SubconstantRedundancy.StorageTable.tableMeta_overwrite {I m Q V : ℕ} (tbl : StorageTable I m Q V) (k : Fin (2 ^ I)) (qv : Fin Q × Fin V) (hk : k ∈ tbl.tableMeta.dom) :
(tbl.overwrite k qv hk).tableMeta = tbl.tableMeta
@[simp]
theorem Cslib.DataStructure.Dictionary.SubconstantRedundancy.StorageTable.query_overwrite {I m Q V : ℕ} (tbl : StorageTable I m Q V) (k : Fin (2 ^ I)) (qv : Fin Q × Fin V) (hk : k ∈ tbl.tableMeta.dom) (k' : Fin (2 ^ I)) :
(tbl.overwrite k qv hk).query k' = Function.update tbl.query k (some qv) k'
def Cslib.DataStructure.Dictionary.SubconstantRedundancy.StorageTable.insert {I m Q V : ℕ} (tbl : StorageTable I m Q V) (k : Fin (2 ^ I)) (qv : Fin Q × Fin V) (hlt : tbl.tableMeta.dom.card < m) (hk : k ∉ tbl.tableMeta.dom) :
StorageTable I m Q V

Insert a fresh key k ∉ tbl.tableMeta.dom when tbl.tableMeta.dom.card < m (used at root nodes ℓ = 1).

@[simp]
theorem Cslib.DataStructure.Dictionary.SubconstantRedundancy.StorageTable.dom_insert {I m Q V : ℕ} (tbl : StorageTable I m Q V) (k : Fin (2 ^ I)) (qv : Fin Q × Fin V) (hlt : tbl.tableMeta.dom.card < m) (hk : k ∉ tbl.tableMeta.dom) :
(tbl.insert k qv hlt hk).tableMeta.dom = Insert.insert k tbl.tableMeta.dom
@[simp]
theorem Cslib.DataStructure.Dictionary.SubconstantRedundancy.StorageTable.query_insert {I m Q V : ℕ} (tbl : StorageTable I m Q V) (k : Fin (2 ^ I)) (qv : Fin Q × Fin V) (hlt : tbl.tableMeta.dom.card < m) (hk : k ∉ tbl.tableMeta.dom) (k' : Fin (2 ^ I)) :
(tbl.insert k qv hlt hk).query k' = Function.update tbl.query k (some qv) k'

Delete k from tbl (used at root nodes ℓ = 1).

def Cslib.DataStructure.Dictionary.SubconstantRedundancy.StorageTable.replace {I m Q V : ℕ} (tbl : StorageTable I m Q V) (k_old k_new : Fin (2 ^ I)) (qv_new : Fin Q × Fin V) (hold : k_old ∈ tbl.tableMeta.dom) (hnew : k_new ∉ tbl.tableMeta.dom.erase k_old) :
StorageTable I m Q V

Replace an active key k_old ∈ tbl.tableMeta.dom with (k_new, qv_new) in the freed slot (Algorithm 3, Branch 2 at inner nodes 2 ≤ ℓ < depth).

@[simp]
theorem Cslib.DataStructure.Dictionary.SubconstantRedundancy.StorageTable.dom_replace {I m Q V : ℕ} (tbl : StorageTable I m Q V) (k_old k_new : Fin (2 ^ I)) (qv_new : Fin Q × Fin V) (hold : k_old ∈ tbl.tableMeta.dom) (hnew : k_new ∉ tbl.tableMeta.dom.erase k_old) :
(tbl.replace k_old k_new qv_new hold hnew).tableMeta.dom = Insert.insert k_new (tbl.tableMeta.dom.erase k_old)
@[simp]
theorem Cslib.DataStructure.Dictionary.SubconstantRedundancy.StorageTable.query_replace {I m Q V : ℕ} (tbl : StorageTable I m Q V) (k_old k_new : Fin (2 ^ I)) (qv_new : Fin Q × Fin V) (hold : k_old ∈ tbl.tableMeta.dom) (hnew : k_new ∉ tbl.tableMeta.dom.erase k_old) (k' : Fin (2 ^ I)) :
(tbl.replace k_old k_new qv_new hold hnew).query k' = Function.update (Function.update tbl.query k_old none) k_new (some qv_new) k'
noncomputable def Cslib.DataStructure.Dictionary.SubconstantRedundancy.StorageTable.ofFinset {I m Q V : ℕ} (S : Finset (Fin (2 ^ I))) (hQ : 1 ≤ Q) (hV : 1 ≤ V) (f : Fin (2 ^ I) → Fin Q × Fin V) :
StorageTable I m Q V

Bulk-initialize a storage table from S : Finset (Fin (2 ^ I)) and payload map f (used in tree construction and subtree reconstruction), materializing the first min #S m elements of S in ascending order (#S ≤ m recovers all of S).

@[simp]
theorem Cslib.DataStructure.Dictionary.SubconstantRedundancy.StorageTable.dom_ofFinset {I m Q V : ℕ} (S : Finset (Fin (2 ^ I))) (hS : S.card ≤ m) (hQ : 1 ≤ Q) (hV : 1 ≤ V) (f : Fin (2 ^ I) → Fin Q × Fin V) :
(ofFinset S hQ hV f).tableMeta.dom = S
@[simp]
theorem Cslib.DataStructure.Dictionary.SubconstantRedundancy.StorageTable.query_ofFinset {I m Q V : ℕ} (S : Finset (Fin (2 ^ I))) (hS : S.card ≤ m) (hQ : 1 ≤ Q) (hV : 1 ≤ V) (f : Fin (2 ^ I) → Fin Q × Fin V) (k : Fin (2 ^ I)) :
(ofFinset S hQ hV f).query k = if k ∈ S then some (f k) else none

Leaf metadata (Section 5.6): hash seed g_u, waiting list, and Minimap subset/spillover header, decoupled from nLow depth payload slots.

Metadata-only leaf slot locator (Section 5.6 & Lemma 3.7): returns some (spill, slotIdx) without inspecting leaf payload slots.

Leaf node (ℓ = depth) combining LeafMeta with nLow depth spillover memory slots (Minimap.FixedEncoded).

Inner-node metadata (2 ≤ ℓ < depth, Section 5.6): hash seed, waiting list, and StorageTableMeta (independent of quotUniv ℓ and valBound).

Inner node (2 ≤ ℓ < depth) combining InnerMeta with tableCap ℓ (quot, val) payload slots.

Root-node metadata (ℓ = 1, Section 5.6): hash seed and StorageTableMeta (no waiting list at ℓ = 1).

Root node (ℓ = 1), storing (quot, val) inline via StorageTable in the pure tree model (while the Section 5 layout bit budget arithmetic in BitBudget.lean accounts for a shared root value pool).

theorem Cslib.DataStructure.Dictionary.SubconstantRedundancy.TreeSchedule.rootKeys_le_rootValPoolCap (P : TreeSchedule) {rootKeys totalActive : ℕ} (hpart : P.numNodes P.depth * P.nLow P.depth + ∑ ℓ ∈ Finset.Ico 2 P.depth, P.numNodes ℓ * P.tableCap ℓ + rootKeys = totalActive) (hcap : totalActive ≤ P.cap) :
rootKeys ≤ P.rootValPoolCap

When all leaf minimaps (nLow depth keys each) and inner storage tables (tableCap ℓ keys each) are at full capacity and total active keys totalActive ≤ cap, total keys stored across all N_1 root tables never exceed P.rootValPoolCap.