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 #
Cslib.DataStructure.Dictionary.SubconstantRedundancy.takeFinset: canonicalm-element prefix subset of aFinsetinLinearOrder.LeafNode.dom,LeafNode.query,LeafNode.ofFinset,LeafNode.overwrite,LeafNode.replace: typed(quot, val)interface overMinimap.FixedEncoded.TreeSchedule.TreeState: multi-level forest state with Section 5.6dfsSubtreeMetaprojection.TreeSchedule.TreeState.WellFormedPadded,TreeSchedule.TreeState.WellFormed: multi-level seed, capacity, storage-level partition, and waiting-list invariants.TreeSchedule.ValidStoreLvl: per-key storage-level partition validity across leaf and inner node capacities.
Main results #
TreeSchedule.TreeState.mem_dfsSubtreeMeta_iff,TreeSchedule.TreeState.length_dfsSubtreeMeta: exact descendant coverage (InSubtree ℓ u) and subtree node count (∑ j ∈ Icc ℓ depth, numNodes j / numNodes ℓ) ofdfsSubtreeMeta.TreeSchedule.TreeState.subtree_stored_card_eq_nLow: every level-ℓ(2 ≤ ℓ ≤ depth) subtree storesnLow ℓkeys in total.TreeSchedule.TreeState.card_nodeWait_dom_eq,TreeSchedule.TreeState.card_root_dom_add_eq,TreeSchedule.TreeState.rootKeyCount_le_rootValPoolCap: exact waiting-list and root-pool capacity conservation laws.
References #
Canonical m-element prefix subset of A : Finset α when m ≤ #A.
Section 1: Typed (quot, val) interface on LeafNode #
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.
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.
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'.
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.
Extract the full-forest SeedAssignment stored inside st : P.TreeState.
Active I_ℓ-bit ID domain stored directly at node (ℓ, u) (1 ≤ ℓ ≤ depth).
Look up (quot, val) at node (ℓ, u) (1 ≤ ℓ ≤ depth) for compressed ID k.
Waiting list at node (ℓ, u) (2 ≤ ℓ ≤ depth).
Update a single root node u₀ in st.
Update a single inner node (ℓ₀, u₀) (2 ≤ ℓ₀ < depth) in st.
Update a single leaf node u₀ in st.
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.
- root {P : TreeSchedule} : P.RootMeta → NodeMetaItem P
- inner {P : TreeSchedule} (ℓ : ℕ) : P.InnerMeta ℓ → NodeMetaItem P
- leaf {P : TreeSchedule} : P.LeafMeta → NodeMetaItem P
Project the Section 5.6 metadata of node (ℓ, u) (1 ≤ ℓ ≤ depth), excluding inner/root
(quot, val) payload arrays and leaf spillover memory slots.
DFS pre-order metadata traversal of the subtree rooted at (ℓ, u) (1 ≤ ℓ ≤ depth), matching
Section 5.6 contiguous subtree metadata blocks (ℓ ≥ 2).
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).
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).
Active keys routed to (ℓ, u) partition disjointly across its 2 ^ branchBits ℓ children.
Per-key storage-level assignment validity on S with respect to seeds.
Every node (ℓ, u) at level 2 ≤ ℓ ≤ depth stores identically P.nLow ℓ keys in its
subtree (storeLvl x ≥ ℓ).
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.