Documentation

CslibFrontier.DataStructure.Dictionary.SubconstantRedundancy.TreeRehash

Pure Subtree Reconstruction and Local-Splice Step of Algorithm 4 #

This file formalizes the pure reconstruction and local-splice step of Algorithm 4 (Rehash(u)) under supplied validated seeds of Tianxiao Li, Jingxun Liang, Huacheng Yu, and Renfei Zhou, Dynamic Dictionary with Subconstant Wasted Bits per Key ([LiLiangYuZhou2024, Section 5.5, Algorithm 4]; arXiv:2310.20536v1, PDF p. 34 / printed p. 33).

Given replacement subtree seeds seeds' agreeing with st.seeds outside InSubtree ℓ₀ u₀ and validated by hgood' : seeds'.AllGoodSeeds (P.paddedDom d), rehashSubtree builds a canonical tree, splices InSubtree ℓ₀ u₀, updates only the ℓ₀ - 1 strict ancestor nodes (j, ancestorAt u₀) (1 ≤ j < ℓ₀), and leaves all other root trees and sibling subtrees untouched. Uniform seed sampling, failed-seed rejection, recursive Algorithm 4 sampling, and randomized-history / expected-work obligations belong to Stage 3 under #5349.

Main definitions #

Main results #

References #

Outside-subtree seed agreement helpers #

Storage-level assignment rehashStoreLvlTwo (2 ≤ ℓ₀) #

noncomputable def Cslib.DataStructure.Dictionary.SubconstantRedundancy.TreeSchedule.TreeState.rehashSubtree {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) (ℓ₀ : ℕ) (hℓ₀ : ℓ₀ ≤ P.depth) (u₀ : Fin (P.numNodes ℓ₀)) (seeds' : P.SeedAssignment) (houtside : ∀ (j : ℕ) (hj : j ≤ P.depth) (v : Fin (P.numNodes j)), ¬P.InSubtree ℓ₀ u₀ j v → seeds'.seed j hj v = st.seeds.seed j hj v) (hgood' : seeds'.AllGoodSeeds (P.paddedDom d)) :

Pure reconstruction and local-splice step of Algorithm 4 (Rehash(u₀)) under supplied validated seeds ([LiLiangYuZhou2024, Section 5.5], PDF p. 34 / printed p. 33): given replacement seeds seeds' agreeing with st.seeds outside InSubtree ℓ₀ u₀ and validated by hgood' : seeds'.AllGoodSeeds (P.paddedDom d), builds a canonical tree and splices InSubtree ℓ₀ u₀ while rebuilding only the ℓ₀ - 1 strict ancestor nodes (j, ancestorAt u₀) (1 ≤ j < ℓ₀) and leaving sibling subtrees untouched. Uniform seed sampling, failed-seed rejection, and recursive Algorithm 4 sampling remain in Stage 3 (#5349).

@[simp]
theorem Cslib.DataStructure.Dictionary.SubconstantRedundancy.TreeSchedule.TreeState.sentCount_rehashSubtree {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) (ℓ₀ : ℕ) (hℓ₀ : ℓ₀ ≤ P.depth) (u₀ : Fin (P.numNodes ℓ₀)) (seeds' : P.SeedAssignment) (houtside : ∀ (j : ℕ) (hj : j ≤ P.depth) (v : Fin (P.numNodes j)), ¬P.InSubtree ℓ₀ u₀ j v → seeds'.seed j hj v = st.seeds.seed j hj v) (hgood' : seeds'.AllGoodSeeds (P.paddedDom d)) :
(st.rehashSubtree hwf ℓ₀ hℓ₀ u₀ seeds' houtside hgood').sentCount = st.sentCount
@[simp]
theorem Cslib.DataStructure.Dictionary.SubconstantRedundancy.TreeSchedule.TreeState.seeds_rehashSubtree {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) (ℓ₀ : ℕ) (hℓ₀ : ℓ₀ ≤ P.depth) (u₀ : Fin (P.numNodes ℓ₀)) (seeds' : P.SeedAssignment) (houtside : ∀ (j : ℕ) (hj : j ≤ P.depth) (v : Fin (P.numNodes j)), ¬P.InSubtree ℓ₀ u₀ j v → seeds'.seed j hj v = st.seeds.seed j hj v) (hgood' : seeds'.AllGoodSeeds (P.paddedDom d)) :
(st.rehashSubtree hwf ℓ₀ hℓ₀ u₀ seeds' houtside hgood').seeds = seeds'
theorem Cslib.DataStructure.Dictionary.SubconstantRedundancy.TreeSchedule.TreeState.rehashSubtree_untouched_roots {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 ℓ₀)) (seeds' : P.SeedAssignment) (houtside : ∀ (j : ℕ) (hj : j ≤ P.depth) (v : Fin (P.numNodes j)), ¬P.InSubtree ℓ₀ u₀ j v → seeds'.seed j hj v = st.seeds.seed j hj v) (hgood' : seeds'.AllGoodSeeds (P.paddedDom d)) (u₁ : Fin (P.numNodes 1)) (hu₁ : u₁ ≠ P.ancestorAt h1₀ u₀) :
(st.rehashSubtree hwf ℓ₀ hℓ₀ u₀ seeds' houtside hgood').roots u₁ = st.roots u₁

Non-ancestor root trees (u₁ ≠ ancestorAt u₀, 1 ≤ ℓ₀) are untouched by rehashSubtree.

theorem Cslib.DataStructure.Dictionary.SubconstantRedundancy.TreeSchedule.TreeState.rehashSubtree_untouched_inner {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 ℓ₀)) (seeds' : P.SeedAssignment) (houtside : ∀ (j : ℕ) (hj : j ≤ P.depth) (v : Fin (P.numNodes j)), ¬P.InSubtree ℓ₀ u₀ j v → seeds'.seed j hj v = st.seeds.seed j hj v) (hgood' : seeds'.AllGoodSeeds (P.paddedDom d)) {ℓ : ℕ} (h2 : 2 ≤ ℓ) (hlt : ℓ < P.depth) (v : Fin (P.numNodes ℓ)) (hnot_sub : ¬P.InSubtree ℓ₀ u₀ ℓ v) (hnot_anc : ∀ (hlt₀ : ℓ < ℓ₀), v ≠ P.ancestorAt ⋯ u₀) :
(st.rehashSubtree hwf ℓ₀ hℓ₀ u₀ seeds' houtside hgood').inner ℓ h2 hlt v = st.inner ℓ h2 hlt v

Inner nodes outside InSubtree ℓ₀ u₀ and off u₀'s ancestor path are untouched.

theorem Cslib.DataStructure.Dictionary.SubconstantRedundancy.TreeSchedule.TreeState.rehashSubtree_untouched_leaves {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 ℓ₀)) (seeds' : P.SeedAssignment) (houtside : ∀ (j : ℕ) (hj : j ≤ P.depth) (v : Fin (P.numNodes j)), ¬P.InSubtree ℓ₀ u₀ j v → seeds'.seed j hj v = st.seeds.seed j hj v) (hgood' : seeds'.AllGoodSeeds (P.paddedDom d)) (v : Fin (P.numNodes P.depth)) (hnot_sub : ¬P.InSubtree ℓ₀ u₀ P.depth v) :
(st.rehashSubtree hwf ℓ₀ hℓ₀ u₀ seeds' houtside hgood').leaves v = st.leaves v

Leaf nodes outside InSubtree ℓ₀ u₀ (1 ≤ ℓ₀) are untouched by rehashSubtree.

theorem Cslib.DataStructure.Dictionary.SubconstantRedundancy.TreeSchedule.TreeState.wellFormedPadded_rehashSubtree {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) (ℓ₀ : ℕ) (hℓ₀ : ℓ₀ ≤ P.depth) (u₀ : Fin (P.numNodes ℓ₀)) (seeds' : P.SeedAssignment) (houtside : ∀ (j : ℕ) (hj : j ≤ P.depth) (v : Fin (P.numNodes j)), ¬P.InSubtree ℓ₀ u₀ j v → seeds'.seed j hj v = st.seeds.seed j hj v) (hgood' : seeds'.AllGoodSeeds (P.paddedDom d)) :
∃ (storeLvl' : Fin P.paddedUniv → ℕ), WellFormedPadded scheme (st.rehashSubtree hwf ℓ₀ hℓ₀ u₀ seeds' houtside hgood') d storeLvl'

Subtree reconstruction (rehashSubtree, the pure local-splice step of Algorithm 4 under supplied validated seeds) preserves WellFormedPadded.