Documentation

CslibFrontier.DataStructure.Dictionary.SubconstantRedundancy.TreeCore

Multi-Level Dictionary Tree State, Section 5.6 Metadata, and Subtree Capacity Laws #

This file defines the pure multi-level state TreeState, uniform node accessors, Section 5.6 DFS subtree metadata extraction, the WellFormedPadded / WellFormed representation invariants, and exact subtree/waiting-list/root capacity laws for the subconstant-redundancy 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).

Main definitions #

Main results #

References #

noncomputable def Cslib.DataStructure.Dictionary.SubconstantRedundancy.takeFinset {α : Type u_1} [LinearOrder α] (A : Finset α) (m : ℕ) (hm : m ≤ A.card) :

Canonical m-element prefix subset of A : Finset α when m ≤ #A.

Section 1: Typed (quot, val) interface on LeafNode #

@[reducible, inline]

Active I_depth-bit ID set stored in a fixed-capacity LeafNode.

Look up (quot, val) of k in a LeafNode using scheme.

Bulk-encode a LeafNode from an exact nLow depth-subset S and payload map f.

@[simp]
theorem Cslib.DataStructure.Dictionary.SubconstantRedundancy.TreeSchedule.LeafNode.seed_ofFinset {P : TreeSchedule} (scheme : DynamicMatching.Scheme (2 ^ P.idBits P.depth) (P.nLow P.depth)) (seed : P.NodeSeed P.depth) (wait : WaitingList (P.idBits P.depth) (P.idBits (P.depth - 1)) (P.waitCap P.depth)) (S : Finset (Fin (2 ^ P.idBits P.depth))) (hS : S.card = P.nLow P.depth) (f : Fin (2 ^ P.idBits P.depth) → Fin (P.quotUniv P.depth) × Fin P.valBound) :
(ofFinset scheme seed wait S hS f).leafMeta.seed = seed
@[simp]
theorem Cslib.DataStructure.Dictionary.SubconstantRedundancy.TreeSchedule.LeafNode.wait_ofFinset {P : TreeSchedule} (scheme : DynamicMatching.Scheme (2 ^ P.idBits P.depth) (P.nLow P.depth)) (seed : P.NodeSeed P.depth) (wait : WaitingList (P.idBits P.depth) (P.idBits (P.depth - 1)) (P.waitCap P.depth)) (S : Finset (Fin (2 ^ P.idBits P.depth))) (hS : S.card = P.nLow P.depth) (f : Fin (2 ^ P.idBits P.depth) → Fin (P.quotUniv P.depth) × Fin P.valBound) :
(ofFinset scheme seed wait S hS f).leafMeta.wait = wait
@[simp]
theorem Cslib.DataStructure.Dictionary.SubconstantRedundancy.TreeSchedule.LeafNode.dom_ofFinset {P : TreeSchedule} (scheme : DynamicMatching.Scheme (2 ^ P.idBits P.depth) (P.nLow P.depth)) (seed : P.NodeSeed P.depth) (wait : WaitingList (P.idBits P.depth) (P.idBits (P.depth - 1)) (P.waitCap P.depth)) (S : Finset (Fin (2 ^ P.idBits P.depth))) (hS : S.card = P.nLow P.depth) (f : Fin (2 ^ P.idBits P.depth) → Fin (P.quotUniv P.depth) × Fin P.valBound) :
(ofFinset scheme seed wait S hS f).dom = S
@[simp]
theorem Cslib.DataStructure.Dictionary.SubconstantRedundancy.TreeSchedule.LeafNode.query_ofFinset {P : TreeSchedule} (scheme : DynamicMatching.Scheme (2 ^ P.idBits P.depth) (P.nLow P.depth)) (seed : P.NodeSeed P.depth) (wait : WaitingList (P.idBits P.depth) (P.idBits (P.depth - 1)) (P.waitCap P.depth)) (S : Finset (Fin (2 ^ P.idBits P.depth))) (hS : S.card = P.nLow P.depth) (f : Fin (2 ^ P.idBits P.depth) → Fin (P.quotUniv P.depth) × Fin P.valBound) (k : Fin (2 ^ P.idBits P.depth)) :
query scheme (ofFinset scheme seed wait S hS f) k = if k ∈ S then some (f k) else none

Overwrite (quot, val) of k in place when k ∈ ln.dom; an absent key k ∉ ln.dom is never inserted, leaving ln.dom and all queries unchanged.

@[simp]
theorem Cslib.DataStructure.Dictionary.SubconstantRedundancy.TreeSchedule.LeafNode.query_overwrite {P : TreeSchedule} (scheme : DynamicMatching.Scheme (2 ^ P.idBits P.depth) (P.nLow P.depth)) (ln : P.LeafNode) (k : Fin (2 ^ P.idBits P.depth)) (qv : Fin (P.quotUniv P.depth) × Fin P.valBound) (hk : k ∈ ln.dom) (k' : Fin (2 ^ P.idBits P.depth)) :
query scheme (overwrite scheme ln k qv) k' = Function.update (query scheme ln) k (some qv) k'
def Cslib.DataStructure.Dictionary.SubconstantRedundancy.TreeSchedule.LeafNode.replace {P : TreeSchedule} (scheme : DynamicMatching.Scheme (2 ^ P.idBits P.depth) (P.nLow P.depth)) (ln : P.LeafNode) (wait' : WaitingList (P.idBits P.depth) (P.idBits (P.depth - 1)) (P.waitCap P.depth)) (k_old k_new : Fin (2 ^ P.idBits P.depth)) (qv_new : Fin (P.quotUniv P.depth) × Fin P.valBound) (hold : k_old ∈ ln.dom) (hnew : k_new ∉ ln.dom.erase k_old) :

Replace k_old ∈ ln.dom with (k_new, qv_new) (Algorithm 3 Branch 2 at a leaf) while simultaneously updating the leaf's waiting list to wait'.

@[simp]
theorem Cslib.DataStructure.Dictionary.SubconstantRedundancy.TreeSchedule.LeafNode.dom_replace {P : TreeSchedule} (scheme : DynamicMatching.Scheme (2 ^ P.idBits P.depth) (P.nLow P.depth)) (ln : P.LeafNode) (wait' : WaitingList (P.idBits P.depth) (P.idBits (P.depth - 1)) (P.waitCap P.depth)) (k_old k_new : Fin (2 ^ P.idBits P.depth)) (qv_new : Fin (P.quotUniv P.depth) × Fin P.valBound) (hold : k_old ∈ ln.dom) (hnew : k_new ∉ ln.dom.erase k_old) :
(replace scheme ln wait' k_old k_new qv_new hold hnew).dom = insert k_new (ln.dom.erase k_old)
@[simp]
theorem Cslib.DataStructure.Dictionary.SubconstantRedundancy.TreeSchedule.LeafNode.query_replace {P : TreeSchedule} (scheme : DynamicMatching.Scheme (2 ^ P.idBits P.depth) (P.nLow P.depth)) (ln : P.LeafNode) (wait' : WaitingList (P.idBits P.depth) (P.idBits (P.depth - 1)) (P.waitCap P.depth)) (k_old k_new : Fin (2 ^ P.idBits P.depth)) (qv_new : Fin (P.quotUniv P.depth) × Fin P.valBound) (hold : k_old ∈ ln.dom) (hnew : k_new ∉ ln.dom.erase k_old) (k' : Fin (2 ^ P.idBits P.depth)) :
query scheme (replace scheme ln wait' k_old k_new qv_new hold hnew) k' = Function.update (Function.update (query scheme ln) k_old none) k_new (some qv_new) k'

Section 2: TreeState, uniform node accessors, and Section 5.6 subtree metadata #

Pure multi-level forest state of the Section 5 subconstant-redundancy dictionary tree.

Note: StorageTable and inline root values here are pure mathematical abstractions of the Section 5 data structure whose layout bit budget is arithmetically bounded by totalTreeBits (proved in BitBudget.lean), rather than an explicit Word-RAM bit-packing encoding.

@[simp]
theorem Cslib.DataStructure.Dictionary.SubconstantRedundancy.TreeSchedule.TreeState.seeds_inner {P : TreeSchedule} (st : P.TreeState) {ℓ : ℕ} (h2 : 2 ≤ ℓ) (hlt : ℓ < P.depth) (hℓ : ℓ ≤ P.depth) (u : Fin (P.numNodes ℓ)) :
st.seeds.seed ℓ hℓ u = (st.inner ℓ h2 hlt u).seed
@[simp]
theorem Cslib.DataStructure.Dictionary.SubconstantRedundancy.TreeSchedule.TreeState.seeds_withSentCount {P : TreeSchedule} (st : P.TreeState) (sc : ℕ) :
{ topSeed := st.topSeed, roots := st.roots, inner := st.inner, leaves := st.leaves, sentCount := sc }.seeds = st.seeds

Active I_ℓ-bit ID domain stored directly at node (ℓ, u) (1 ≤ ℓ ≤ depth).

@[simp]
theorem Cslib.DataStructure.Dictionary.SubconstantRedundancy.TreeSchedule.TreeState.nodeDom_inner {P : TreeSchedule} (st : P.TreeState) {ℓ : ℕ} (h1 : 1 ≤ ℓ) (h2 : 2 ≤ ℓ) (hlt : ℓ < P.depth) (hℓ : ℓ ≤ P.depth) (u : Fin (P.numNodes ℓ)) :
st.nodeDom ℓ h1 hℓ u = (st.inner ℓ h2 hlt u).table.tableMeta.dom
def Cslib.DataStructure.Dictionary.SubconstantRedundancy.TreeSchedule.TreeState.nodeQuery {P : TreeSchedule} (scheme : DynamicMatching.Scheme (2 ^ P.idBits P.depth) (P.nLow P.depth)) (st : P.TreeState) (ℓ : ℕ) (_h1 : 1 ≤ ℓ) (hℓ : ℓ ≤ P.depth) (u : Fin (P.numNodes ℓ)) (k : Fin (2 ^ P.idBits ℓ)) :

Look up (quot, val) at node (ℓ, u) (1 ≤ ℓ ≤ depth) for compressed ID k.

@[simp]
theorem Cslib.DataStructure.Dictionary.SubconstantRedundancy.TreeSchedule.TreeState.nodeQuery_one {P : TreeSchedule} (scheme : DynamicMatching.Scheme (2 ^ P.idBits P.depth) (P.nLow P.depth)) (st : P.TreeState) (h1 : 1 ≤ 1) (hℓ : 1 ≤ P.depth) (u : Fin (P.numNodes 1)) (k : Fin (2 ^ P.idBits 1)) :
nodeQuery scheme st 1 h1 hℓ u k = (st.roots u).table.query k
@[simp]
theorem Cslib.DataStructure.Dictionary.SubconstantRedundancy.TreeSchedule.TreeState.nodeQuery_inner {P : TreeSchedule} (scheme : DynamicMatching.Scheme (2 ^ P.idBits P.depth) (P.nLow P.depth)) (st : P.TreeState) {ℓ : ℕ} (h1 : 1 ≤ ℓ) (h2 : 2 ≤ ℓ) (hlt : ℓ < P.depth) (hℓ : ℓ ≤ P.depth) (u : Fin (P.numNodes ℓ)) (k : Fin (2 ^ P.idBits ℓ)) :
nodeQuery scheme st ℓ h1 hℓ u k = (st.inner ℓ h2 hlt u).table.query k
@[simp]
theorem Cslib.DataStructure.Dictionary.SubconstantRedundancy.TreeSchedule.TreeState.nodeQuery_depth {P : TreeSchedule} (scheme : DynamicMatching.Scheme (2 ^ P.idBits P.depth) (P.nLow P.depth)) (st : P.TreeState) (h1 : 1 ≤ P.depth) (hℓ : P.depth ≤ P.depth) (u : Fin (P.numNodes P.depth)) (k : Fin (2 ^ P.idBits P.depth)) :
nodeQuery scheme st P.depth h1 hℓ u k = LeafNode.query scheme (st.leaves u) k
theorem Cslib.DataStructure.Dictionary.SubconstantRedundancy.TreeSchedule.TreeState.nodeQuery_eq_none_of_notMem {P : TreeSchedule} (scheme : DynamicMatching.Scheme (2 ^ P.idBits P.depth) (P.nLow P.depth)) (st : P.TreeState) {ℓ : ℕ} (h1 : 1 ≤ ℓ) (hℓ : ℓ ≤ P.depth) (u : Fin (P.numNodes ℓ)) {k : Fin (2 ^ P.idBits ℓ)} (hk : k ∉ st.nodeDom ℓ h1 hℓ u) :
nodeQuery scheme st ℓ h1 hℓ u k = none
def Cslib.DataStructure.Dictionary.SubconstantRedundancy.TreeSchedule.TreeState.nodeWait {P : TreeSchedule} (st : P.TreeState) (ℓ : ℕ) (h2 : 2 ≤ ℓ) (hℓ : ℓ ≤ P.depth) (u : Fin (P.numNodes ℓ)) :
WaitingList (P.idBits ℓ) (P.idBits (ℓ - 1)) (P.waitCap ℓ)

Waiting list at node (ℓ, u) (2 ≤ ℓ ≤ depth).

@[simp]
theorem Cslib.DataStructure.Dictionary.SubconstantRedundancy.TreeSchedule.TreeState.nodeWait_inner {P : TreeSchedule} (st : P.TreeState) {ℓ : ℕ} (h2 : 2 ≤ ℓ) (hlt : ℓ < P.depth) (hℓ : ℓ ≤ P.depth) (u : Fin (P.numNodes ℓ)) :
st.nodeWait ℓ h2 hℓ u = (st.inner ℓ h2 hlt u).wait
def Cslib.DataStructure.Dictionary.SubconstantRedundancy.TreeSchedule.TreeState.updateInner {P : TreeSchedule} (st : P.TreeState) (ℓ₀ : ℕ) (h2₀ : 2 ≤ ℓ₀) (hlt₀ : ℓ₀ < P.depth) (u₀ : Fin (P.numNodes ℓ₀)) (nd : P.InnerNode ℓ₀) :

Update a single inner node (ℓ₀, u₀) (2 ≤ ℓ₀ < depth) in st.

theorem Cslib.DataStructure.Dictionary.SubconstantRedundancy.TreeSchedule.TreeState.inner_updateInner_of_ne {P : TreeSchedule} (st : P.TreeState) {ℓ₀ : ℕ} (h2₀ : 2 ≤ ℓ₀) (hlt₀ : ℓ₀ < P.depth) (u₀ : Fin (P.numNodes ℓ₀)) (nd : P.InnerNode ℓ₀) {ℓ : ℕ} (h2 : 2 ≤ ℓ) (hlt : ℓ < P.depth) (u : Fin (P.numNodes ℓ)) (hdiff : ∀ (h_eq : ℓ = ℓ₀), h_eq ▸ u ≠ u₀) :
(st.updateInner ℓ₀ h2₀ hlt₀ u₀ nd).inner ℓ h2 hlt u = st.inner ℓ h2 hlt u
theorem Cslib.DataStructure.Dictionary.SubconstantRedundancy.TreeSchedule.TreeState.seeds_updateInner_of_seed_eq {P : TreeSchedule} (st : P.TreeState) {ℓ₀ : ℕ} (h2₀ : 2 ≤ ℓ₀) (hlt₀ : ℓ₀ < P.depth) (u₀ : Fin (P.numNodes ℓ₀)) (nd : P.InnerNode ℓ₀) (hs : nd.seed = (st.inner ℓ₀ h2₀ hlt₀ u₀).seed) :
(st.updateInner ℓ₀ h2₀ hlt₀ u₀ nd).seeds = st.seeds
theorem Cslib.DataStructure.Dictionary.SubconstantRedundancy.TreeSchedule.TreeState.nodeDom_updateRoot_other {P : TreeSchedule} (st : P.TreeState) (u₀ : Fin (P.numNodes 1)) (nd : P.RootNode) {ℓ : ℕ} (h1 : 1 ≤ ℓ) (hℓ : ℓ ≤ P.depth) (u : Fin (P.numNodes ℓ)) (hdiff : ∀ (h_eq : ℓ = 1), h_eq ▸ u ≠ u₀) :
(st.updateRoot u₀ nd).nodeDom ℓ h1 hℓ u = st.nodeDom ℓ h1 hℓ u
theorem Cslib.DataStructure.Dictionary.SubconstantRedundancy.TreeSchedule.TreeState.nodeQuery_updateRoot_other {P : TreeSchedule} (scheme : DynamicMatching.Scheme (2 ^ P.idBits P.depth) (P.nLow P.depth)) (st : P.TreeState) (u₀ : Fin (P.numNodes 1)) (nd : P.RootNode) {ℓ : ℕ} (h1 : 1 ≤ ℓ) (hℓ : ℓ ≤ P.depth) (u : Fin (P.numNodes ℓ)) (k : Fin (2 ^ P.idBits ℓ)) (hdiff : ∀ (h_eq : ℓ = 1), h_eq ▸ u ≠ u₀) :
nodeQuery scheme (st.updateRoot u₀ nd) ℓ h1 hℓ u k = nodeQuery scheme st ℓ h1 hℓ u k
@[simp]
theorem Cslib.DataStructure.Dictionary.SubconstantRedundancy.TreeSchedule.TreeState.nodeWait_updateRoot {P : TreeSchedule} (st : P.TreeState) (u₀ : Fin (P.numNodes 1)) (nd : P.RootNode) {ℓ : ℕ} (h2 : 2 ≤ ℓ) (hℓ : ℓ ≤ P.depth) (u : Fin (P.numNodes ℓ)) :
(st.updateRoot u₀ nd).nodeWait ℓ h2 hℓ u = st.nodeWait ℓ h2 hℓ u
theorem Cslib.DataStructure.Dictionary.SubconstantRedundancy.TreeSchedule.TreeState.nodeDom_updateInner_other {P : TreeSchedule} (st : P.TreeState) {ℓ₀ : ℕ} (h2₀ : 2 ≤ ℓ₀) (hlt₀ : ℓ₀ < P.depth) (u₀ : Fin (P.numNodes ℓ₀)) (nd : P.InnerNode ℓ₀) {ℓ : ℕ} (h1 : 1 ≤ ℓ) (hℓ : ℓ ≤ P.depth) (u : Fin (P.numNodes ℓ)) (hdiff : ∀ (h_eq : ℓ = ℓ₀), h_eq ▸ u ≠ u₀) :
(st.updateInner ℓ₀ h2₀ hlt₀ u₀ nd).nodeDom ℓ h1 hℓ u = st.nodeDom ℓ h1 hℓ u
theorem Cslib.DataStructure.Dictionary.SubconstantRedundancy.TreeSchedule.TreeState.nodeQuery_updateInner_other {P : TreeSchedule} (scheme : DynamicMatching.Scheme (2 ^ P.idBits P.depth) (P.nLow P.depth)) (st : P.TreeState) {ℓ₀ : ℕ} (h2₀ : 2 ≤ ℓ₀) (hlt₀ : ℓ₀ < P.depth) (u₀ : Fin (P.numNodes ℓ₀)) (nd : P.InnerNode ℓ₀) {ℓ : ℕ} (h1 : 1 ≤ ℓ) (hℓ : ℓ ≤ P.depth) (u : Fin (P.numNodes ℓ)) (k : Fin (2 ^ P.idBits ℓ)) (hdiff : ∀ (h_eq : ℓ = ℓ₀), h_eq ▸ u ≠ u₀) :
nodeQuery scheme (st.updateInner ℓ₀ h2₀ hlt₀ u₀ nd) ℓ h1 hℓ u k = nodeQuery scheme st ℓ h1 hℓ u k
theorem Cslib.DataStructure.Dictionary.SubconstantRedundancy.TreeSchedule.TreeState.nodeWait_updateInner_other {P : TreeSchedule} (st : P.TreeState) {ℓ₀ : ℕ} (h2₀ : 2 ≤ ℓ₀) (hlt₀ : ℓ₀ < P.depth) (u₀ : Fin (P.numNodes ℓ₀)) (nd : P.InnerNode ℓ₀) {ℓ : ℕ} (h2 : 2 ≤ ℓ) (hℓ : ℓ ≤ P.depth) (u : Fin (P.numNodes ℓ)) (hdiff : ∀ (h_eq : ℓ = ℓ₀), h_eq ▸ u ≠ u₀) :
(st.updateInner ℓ₀ h2₀ hlt₀ u₀ nd).nodeWait ℓ h2 hℓ u = st.nodeWait ℓ h2 hℓ u
theorem Cslib.DataStructure.Dictionary.SubconstantRedundancy.TreeSchedule.TreeState.nodeDom_updateLeaf_other {P : TreeSchedule} (st : P.TreeState) (u₀ : Fin (P.numNodes P.depth)) (ln : P.LeafNode) {ℓ : ℕ} (h1 : 1 ≤ ℓ) (hℓ : ℓ ≤ P.depth) (u : Fin (P.numNodes ℓ)) (hdiff : ∀ (h_eq : ℓ = P.depth), h_eq ▸ u ≠ u₀) :
(st.updateLeaf u₀ ln).nodeDom ℓ h1 hℓ u = st.nodeDom ℓ h1 hℓ u
theorem Cslib.DataStructure.Dictionary.SubconstantRedundancy.TreeSchedule.TreeState.nodeQuery_updateLeaf_other {P : TreeSchedule} (scheme : DynamicMatching.Scheme (2 ^ P.idBits P.depth) (P.nLow P.depth)) (st : P.TreeState) (u₀ : Fin (P.numNodes P.depth)) (ln : P.LeafNode) {ℓ : ℕ} (h1 : 1 ≤ ℓ) (hℓ : ℓ ≤ P.depth) (u : Fin (P.numNodes ℓ)) (k : Fin (2 ^ P.idBits ℓ)) (hdiff : ∀ (h_eq : ℓ = P.depth), h_eq ▸ u ≠ u₀) :
nodeQuery scheme (st.updateLeaf u₀ ln) ℓ h1 hℓ u k = nodeQuery scheme st ℓ h1 hℓ u k
theorem Cslib.DataStructure.Dictionary.SubconstantRedundancy.TreeSchedule.TreeState.nodeWait_updateLeaf_other {P : TreeSchedule} (st : P.TreeState) (u₀ : Fin (P.numNodes P.depth)) (ln : P.LeafNode) {ℓ : ℕ} (h2 : 2 ≤ ℓ) (hℓ : ℓ ≤ P.depth) (u : Fin (P.numNodes ℓ)) (hdiff : ∀ (h_eq : ℓ = P.depth), h_eq ▸ u ≠ u₀) :
(st.updateLeaf u₀ ln).nodeWait ℓ h2 hℓ u = st.nodeWait ℓ h2 hℓ u

Tagged node metadata item (Section 5.6, PDF pp. 35–36 / printed pp. 34–35) for DFS pre-order subtree metadata packing in Word-RAM M4.

Project the Section 5.6 metadata of node (ℓ, u) (1 ≤ ℓ ≤ depth), excluding inner/root (quot, val) payload arrays and leaf spillover memory slots.

@[irreducible]

DFS pre-order metadata traversal of the subtree rooted at (ℓ, u) (1 ≤ ℓ ≤ depth), matching Section 5.6 contiguous subtree metadata blocks (ℓ ≥ 2).

theorem Cslib.DataStructure.Dictionary.SubconstantRedundancy.TreeSchedule.TreeState.mem_dfsSubtreeMeta_iff {P : TreeSchedule} (st : P.TreeState) {ℓ : ℕ} (h1 : 1 ≤ ℓ) (hℓ : ℓ ≤ P.depth) (u : Fin (P.numNodes ℓ)) (item : NodeMetaItem P) :
item ∈ st.dfsSubtreeMeta ℓ h1 hℓ u ↔ ∃ (j : ℕ) (hj1 : 1 ≤ j) (hjd : j ≤ P.depth) (v : Fin (P.numNodes j)), P.InSubtree ℓ u j v ∧ st.nodeMeta j hj1 hjd v = item

dfsSubtreeMeta covers every descendant in InSubtree ℓ u (Section 5.6): an item appears in st.dfsSubtreeMeta ℓ h1 hℓ u iff it is st.nodeMeta j hj1 hjd v for some node (j, v) in the subtree rooted at (ℓ, u).

theorem Cslib.DataStructure.Dictionary.SubconstantRedundancy.TreeSchedule.TreeState.length_dfsSubtreeMeta {P : TreeSchedule} (st : P.TreeState) {ℓ : ℕ} (h1 : 1 ≤ ℓ) (hℓ : ℓ ≤ P.depth) (u : Fin (P.numNodes ℓ)) :
(st.dfsSubtreeMeta ℓ h1 hℓ u).length = ∑ j ∈ Finset.Icc ℓ P.depth, P.numNodes j / P.numNodes ℓ

Exact subtree node count of dfsSubtreeMeta (Section 5.6): the DFS pre-order metadata block rooted at (ℓ, u) contains ∑ j ∈ Icc ℓ depth, numNodes j / numNodes ℓ node entries, matching the per-level multiplicity in TreeSchedule.subtreeMetaBits.

Total number of keys currently stored in level-1 root tables across all N_1 roots.

Section 3: WellFormedPadded, WellFormed, and exact subtree capacity laws #

Internal multi-level representation invariant on st : P.TreeState with respect to a sentinel-padded dictionary d : P.PaddedDict and per-key storage-level map storeLvl : Fin P.paddedUniv → ℕ (Sections 5.2–5.5).

External representation invariant coupling st : P.TreeState to dict : Dictionary.State P.univ via sentinel padding (Section 4, Footnote 5 & Section 5.2).

theorem Cslib.DataStructure.Dictionary.SubconstantRedundancy.TreeSchedule.TreeState.activeAt_filter_card_eq_sum_children {P : TreeSchedule} (seeds : P.SeedAssignment) (S : Finset (Fin P.paddedUniv)) {ℓ : ℕ} (hlt : ℓ < P.depth) (u : Fin (P.numNodes ℓ)) (p : Fin P.paddedUniv → Prop) [DecidablePred p] :
(Finset.filter p (seeds.activeAt S ℓ ⋯ u)).card = ∑ b : Fin (2 ^ P.branchBits ℓ), (Finset.filter p (seeds.activeAt S (ℓ + 1) hlt ((P.childNodeEquiv ℓ) (u, b)))).card

Active keys routed to (ℓ, u) partition disjointly across its 2 ^ branchBits ℓ children.

Per-key storage-level assignment validity on S with respect to seeds.

theorem Cslib.DataStructure.Dictionary.SubconstantRedundancy.TreeSchedule.ValidStoreLvl.subtree_card_eq_nLow {P : TreeSchedule} {seeds : P.SeedAssignment} {S : Finset (Fin P.paddedUniv)} {storeLvl : Fin P.paddedUniv → ℕ} (hvsl : ValidStoreLvl seeds S storeLvl) {ℓ : ℕ} (h2 : 2 ≤ ℓ) (hℓ : ℓ ≤ P.depth) (u : Fin (P.numNodes ℓ)) :
{x ∈ seeds.activeAt S ℓ hℓ u | ℓ ≤ storeLvl x}.card = P.nLow ℓ
theorem Cslib.DataStructure.Dictionary.SubconstantRedundancy.TreeSchedule.ValidStoreLvl.wait_card_le {P : TreeSchedule} {seeds : P.SeedAssignment} {S : Finset (Fin P.paddedUniv)} {storeLvl : Fin P.paddedUniv → ℕ} (hgood : seeds.AllGoodSeeds S) (hvsl : ValidStoreLvl seeds S storeLvl) {ℓ : ℕ} (h2 : 2 ≤ ℓ) (hℓ : ℓ ≤ P.depth) (u : Fin (P.numNodes ℓ)) :
(Finset.image (seeds.idAt ℓ ⋯ hℓ) ({x ∈ seeds.activeAt S ℓ hℓ u | storeLvl x < ℓ})).card ≤ P.waitCap ℓ
theorem Cslib.DataStructure.Dictionary.SubconstantRedundancy.TreeSchedule.ValidStoreLvl.root_card_le {P : TreeSchedule} {seeds : P.SeedAssignment} {S : Finset (Fin P.paddedUniv)} {storeLvl : Fin P.paddedUniv → ℕ} (hgood : seeds.AllGoodSeeds S) (hvsl : ValidStoreLvl seeds S storeLvl) (u₁ : Fin (P.numNodes 1)) :
(Finset.image (seeds.idAt 1 ⋯ ⋯) ({x ∈ seeds.activeAt S 1 ⋯ u₁ | storeLvl x = 1})).card ≤ P.tableCap 1
theorem Cslib.DataStructure.Dictionary.SubconstantRedundancy.TreeSchedule.TreeState.subtree_stored_card_eq_nLow {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) {ℓ : ℕ} (h2 : 2 ≤ ℓ) (hℓ : ℓ ≤ P.depth) (u : Fin (P.numNodes ℓ)) :
{x ∈ st.seeds.activeAt (P.paddedDom d) ℓ hℓ u | ℓ ≤ storeLvl x}.card = P.nLow ℓ

Every node (ℓ, u) at level 2 ≤ ℓ ≤ depth stores identically P.nLow ℓ keys in its subtree (storeLvl x ≥ ℓ).

theorem Cslib.DataStructure.Dictionary.SubconstantRedundancy.TreeSchedule.TreeState.card_nodeWait_dom_eq {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) {ℓ : ℕ} (h2 : 2 ≤ ℓ) (hℓ : ℓ ≤ P.depth) (u : Fin (P.numNodes ℓ)) :
(st.nodeWait ℓ h2 hℓ u).dom.card = (st.seeds.activeAt (P.paddedDom d) ℓ hℓ u).card - P.nLow ℓ

Exact waiting-list cardinality identity at any node (ℓ, u) (2 ≤ ℓ ≤ depth): #(nodeWait ℓ u).dom = #(activeAt ℓ u) - nLow ℓ.

Exact root storage-table cardinality identity at any root u₁ (ℓ = 1): #(roots u₁).table.tableMeta.dom + B_1 * nLow 2 = #(activeAt 1 u₁).

Active keys stored across all N_1 root tables never exceed P.rootValPoolCap.