Documentation

CslibFrontier.DataStructure.Dictionary.SubconstantRedundancy.TreeBuild

Subtree Good-Seed Existence and Canonical Multi-Level Tree Construction #

This file formalizes good-seed existence (exists_goodSubtreeSeeds, exists_allGoodSeeds, exists_allGoodSeeds_localized_pair) and canonical bottom-up tree construction (buildTreeFromSeeds) 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.5]; arXiv:2310.20536v1, PDF pp. 27–30 and 34 / printed pp. 26–29 and 33).

Main definitions #

Main results #

References #

Section 1: Good-seed existence on subtrees (exists_goodSubtreeSeeds) #

theorem Cslib.DataStructure.Dictionary.SubconstantRedundancy.TreeSchedule.exists_goodSubtreeSeeds_pair {P : TreeSchedule} (hcr : P.ConcentrationReady) (base : P.SeedAssignment) {S₁ S₂ : Finset (Fin P.paddedUniv)} (hcard₁ : P.nLow 0 ≤ S₁.card ∧ S₁.card ≤ P.nHigh 0) (hcard₂ : P.nLow 0 ≤ S₂.card ∧ S₂.card ≤ P.nHigh 0) {ℓ₀ : ℕ} (hℓ₀ : ℓ₀ ≤ P.depth) (u₀ : Fin (P.numNodes ℓ₀)) (hanc₁ : ∀ (j : ℕ) (hj : j < ℓ₀), P.IsGoodNodeSeed j (base.seed j ⋯ (P.ancestorAt ⋯ u₀)) (base.primSetAt S₁ j ⋯ (P.ancestorAt ⋯ u₀))) (hanc₂ : ∀ (j : ℕ) (hj : j < ℓ₀), P.IsGoodNodeSeed j (base.seed j ⋯ (P.ancestorAt ⋯ u₀)) (base.primSetAt S₂ j ⋯ (P.ancestorAt ⋯ u₀))) :
∃ (seeds' : P.SeedAssignment), (∀ (j : ℕ) (hj : j ≤ P.depth) (v : Fin (P.numNodes j)), ¬P.InSubtree ℓ₀ u₀ j v → seeds'.seed j hj v = base.seed j hj v) ∧ ∀ (j : ℕ) (hj : j ≤ P.depth) (v : Fin (P.numNodes j)), P.InSubtree ℓ₀ u₀ j v → P.IsGoodNodeSeed j (seeds'.seed j hj v) (seeds'.primSetAt S₁ j hj v) ∧ P.IsGoodNodeSeed j (seeds'.seed j hj v) (seeds'.primSetAt S₂ j hj v)

Paired subtree good-seed existence (existence of validated subtree seeds for Algorithm 4; uniform sampling and failed-seed rejection are Stage 3): whenever #S₁, #S₂ ∈ [nLow 0, nHigh 0] and all strict ancestors j < ℓ₀ of u₀ have good seeds in base on both S₁ and S₂, there exists seeds' agreeing with base outside InSubtree ℓ₀ u₀ whose every node in InSubtree ℓ₀ u₀ satisfies IsGoodNodeSeed on both S₁ and S₂.

theorem Cslib.DataStructure.Dictionary.SubconstantRedundancy.TreeSchedule.exists_goodSubtreeSeeds {P : TreeSchedule} (hcr : P.ConcentrationReady) (base : P.SeedAssignment) {S : Finset (Fin P.paddedUniv)} (hcard0 : P.nLow 0 ≤ S.card ∧ S.card ≤ P.nHigh 0) {ℓ₀ : ℕ} (hℓ₀ : ℓ₀ ≤ P.depth) (u₀ : Fin (P.numNodes ℓ₀)) (hanc₀ : ∀ (j : ℕ) (hj : j < ℓ₀), P.IsGoodNodeSeed j (base.seed j ⋯ (P.ancestorAt ⋯ u₀)) (base.primSetAt S j ⋯ (P.ancestorAt ⋯ u₀))) :
∃ (seeds' : P.SeedAssignment), (∀ (j : ℕ) (hj : j ≤ P.depth) (v : Fin (P.numNodes j)), ¬P.InSubtree ℓ₀ u₀ j v → seeds'.seed j hj v = base.seed j hj v) ∧ ∀ (j : ℕ) (hj : j ≤ P.depth) (v : Fin (P.numNodes j)), P.InSubtree ℓ₀ u₀ j v → P.IsGoodNodeSeed j (seeds'.seed j hj v) (seeds'.primSetAt S j hj v)

Subtree good-seed existence on a single set S (for Algorithm 4 subtree reconstruction; uniform sampling and failed-seed rejection are Stage 3).

Global good-seed existence for any S with #S ∈ [nLow 0, nHigh 0].

theorem Cslib.DataStructure.Dictionary.SubconstantRedundancy.TreeSchedule.exists_allGoodSeeds_localized_pair {P : TreeSchedule} (hcr : P.ConcentrationReady) (base : P.SeedAssignment) {S S' : Finset (Fin P.paddedUniv)} (hbase : base.AllGoodSeeds S) (hcard0' : P.nLow 0 ≤ S'.card ∧ S'.card ≤ P.nHigh 0) {ℓ₀ : ℕ} (hℓ₀ : ℓ₀ ≤ P.depth) (u₀ : Fin (P.numNodes ℓ₀)) (hdiff : ∀ (x : Fin P.paddedUniv), (x ∈ S' ↔ x ∈ S) ∨ base.nodeAt ℓ₀ hℓ₀ x = u₀) (hbelow : ∀ (j : ℕ) (hj : j < ℓ₀) (w : Fin (P.numNodes j)), P.IsGoodNodeSeed j (base.seed j ⋯ w) (base.primSetAt S' j ⋯ w)) :
∃ (seeds' : P.SeedAssignment), (∀ (j : ℕ) (hj : j ≤ P.depth) (v : Fin (P.numNodes j)), ¬P.InSubtree ℓ₀ u₀ j v → seeds'.seed j hj v = base.seed j hj v) ∧ seeds'.AllGoodSeeds S ∧ seeds'.AllGoodSeeds S'

Simultaneous pre/post-update localized subtree seed repair: if base.AllGoodSeeds S, S' agrees with S off u₀, #S' ∈ [nLow 0, nHigh 0], and all levels < ℓ₀ remain good on S', resampling only InSubtree ℓ₀ u₀ yields seeds' simultaneously good on both S and S' so rehashSubtree can run on S followed by the normal-path update to S'.

Section 2: Canonical bottom-up storage levels and buildTreeFromSeeds #

Canonical bottom-up storage-level function Fin P.paddedUniv → ℕ for (seeds, S, hgood).

Construct a single RootNode from (d, seeds, storeLvl).

@[simp]
theorem Cslib.DataStructure.Dictionary.SubconstantRedundancy.TreeSchedule.seed_buildRootOfStoreLvl {P : TreeSchedule} (d : P.PaddedDict) (seeds : P.SeedAssignment) (storeLvl : Fin P.paddedUniv → ℕ) (u₁ : Fin (P.numNodes 1)) :
(buildRootOfStoreLvl d seeds storeLvl u₁).seed = seeds.seed 1 ⋯ u₁
@[simp]
theorem Cslib.DataStructure.Dictionary.SubconstantRedundancy.TreeSchedule.dom_buildRootOfStoreLvl {P : TreeSchedule} (d : P.PaddedDict) (seeds : P.SeedAssignment) (hgood : seeds.AllGoodSeeds (P.paddedDom d)) {storeLvl : Fin P.paddedUniv → ℕ} (hvsl : ValidStoreLvl seeds (P.paddedDom d) storeLvl) (u₁ : Fin (P.numNodes 1)) :
(buildRootOfStoreLvl d seeds storeLvl u₁).table.tableMeta.dom = Finset.image (seeds.idAt 1 ⋯ ⋯) ({x ∈ seeds.activeAt (P.paddedDom d) 1 ⋯ u₁ | storeLvl x = 1})
theorem Cslib.DataStructure.Dictionary.SubconstantRedundancy.TreeSchedule.query_buildRootOfStoreLvl {P : TreeSchedule} {d : P.PaddedDict} {seeds : P.SeedAssignment} (hgood : seeds.AllGoodSeeds (P.paddedDom d)) {storeLvl : Fin P.paddedUniv → ℕ} (hvsl : ValidStoreLvl seeds (P.paddedDom d) storeLvl) (u₁ : Fin (P.numNodes 1)) {x : Fin P.paddedUniv} {v : Fin P.valBound} (hdx : d x = some v) (hnx : seeds.nodeAt 1 ⋯ x = u₁) (hsl : storeLvl x = 1) :
(buildRootOfStoreLvl d seeds storeLvl u₁).table.query (seeds.idAt 1 ⋯ ⋯ x) = some (seeds.quotAt 1 ⋯ ⋯ x, v)
noncomputable def Cslib.DataStructure.Dictionary.SubconstantRedundancy.TreeSchedule.buildInnerOfStoreLvl {P : TreeSchedule} (d : P.PaddedDict) (seeds : P.SeedAssignment) (hgood : seeds.AllGoodSeeds (P.paddedDom d)) {storeLvl : Fin P.paddedUniv → ℕ} (hvsl : ValidStoreLvl seeds (P.paddedDom d) storeLvl) (ℓ : ℕ) (h2 : 2 ≤ ℓ) (hlt : ℓ < P.depth) (u : Fin (P.numNodes ℓ)) :
P.InnerNode ℓ

Construct a single InnerNode ℓ from (d, seeds, hgood, storeLvl).

@[simp]
theorem Cslib.DataStructure.Dictionary.SubconstantRedundancy.TreeSchedule.seed_buildInnerOfStoreLvl {P : TreeSchedule} (d : P.PaddedDict) (seeds : P.SeedAssignment) (hgood : seeds.AllGoodSeeds (P.paddedDom d)) {storeLvl : Fin P.paddedUniv → ℕ} (hvsl : ValidStoreLvl seeds (P.paddedDom d) storeLvl) (ℓ : ℕ) (h2 : 2 ≤ ℓ) (hlt : ℓ < P.depth) (u : Fin (P.numNodes ℓ)) :
(buildInnerOfStoreLvl d seeds hgood hvsl ℓ h2 hlt u).seed = seeds.seed ℓ ⋯ u
@[simp]
theorem Cslib.DataStructure.Dictionary.SubconstantRedundancy.TreeSchedule.dom_buildInnerOfStoreLvl {P : TreeSchedule} (d : P.PaddedDict) (seeds : P.SeedAssignment) (hgood : seeds.AllGoodSeeds (P.paddedDom d)) {storeLvl : Fin P.paddedUniv → ℕ} (hvsl : ValidStoreLvl seeds (P.paddedDom d) storeLvl) (ℓ : ℕ) (h2 : 2 ≤ ℓ) (hlt : ℓ < P.depth) (u : Fin (P.numNodes ℓ)) :
(buildInnerOfStoreLvl d seeds hgood hvsl ℓ h2 hlt u).table.tableMeta.dom = Finset.image (seeds.idAt ℓ ⋯ ⋯) ({x ∈ seeds.activeAt (P.paddedDom d) ℓ ⋯ u | storeLvl x = ℓ})
theorem Cslib.DataStructure.Dictionary.SubconstantRedundancy.TreeSchedule.card_dom_buildInnerOfStoreLvl {P : TreeSchedule} (d : P.PaddedDict) (seeds : P.SeedAssignment) (hgood : seeds.AllGoodSeeds (P.paddedDom d)) {storeLvl : Fin P.paddedUniv → ℕ} (hvsl : ValidStoreLvl seeds (P.paddedDom d) storeLvl) (ℓ : ℕ) (h2 : 2 ≤ ℓ) (hlt : ℓ < P.depth) (u : Fin (P.numNodes ℓ)) :
(buildInnerOfStoreLvl d seeds hgood hvsl ℓ h2 hlt u).table.tableMeta.dom.card = P.tableCap ℓ
theorem Cslib.DataStructure.Dictionary.SubconstantRedundancy.TreeSchedule.query_buildInnerOfStoreLvl {P : TreeSchedule} {d : P.PaddedDict} {seeds : P.SeedAssignment} (hgood : seeds.AllGoodSeeds (P.paddedDom d)) {storeLvl : Fin P.paddedUniv → ℕ} (hvsl : ValidStoreLvl seeds (P.paddedDom d) storeLvl) {ℓ : ℕ} (h1 : 1 ≤ ℓ) (h2 : 2 ≤ ℓ) (hlt : ℓ < P.depth) (u : Fin (P.numNodes ℓ)) {x : Fin P.paddedUniv} {v : Fin P.valBound} (hdx : d x = some v) (hnx : seeds.nodeAt ℓ ⋯ x = u) (hsl : storeLvl x = ℓ) :
(buildInnerOfStoreLvl d seeds hgood hvsl ℓ h2 hlt u).table.query (seeds.idAt ℓ h1 ⋯ x) = some (seeds.quotAt ℓ h1 ⋯ x, v)
@[simp]
theorem Cslib.DataStructure.Dictionary.SubconstantRedundancy.TreeSchedule.wait_dom_buildInnerOfStoreLvl {P : TreeSchedule} (d : P.PaddedDict) (seeds : P.SeedAssignment) (hgood : seeds.AllGoodSeeds (P.paddedDom d)) {storeLvl : Fin P.paddedUniv → ℕ} (hvsl : ValidStoreLvl seeds (P.paddedDom d) storeLvl) (ℓ : ℕ) (h2 : 2 ≤ ℓ) (hlt : ℓ < P.depth) (u : Fin (P.numNodes ℓ)) :
(buildInnerOfStoreLvl d seeds hgood hvsl ℓ h2 hlt u).wait.dom = Finset.image (seeds.idAt ℓ ⋯ ⋯) ({x ∈ seeds.activeAt (P.paddedDom d) ℓ ⋯ u | storeLvl x < ℓ})
theorem Cslib.DataStructure.Dictionary.SubconstantRedundancy.TreeSchedule.wait_lookup_buildInnerOfStoreLvl {P : TreeSchedule} {d : P.PaddedDict} {seeds : P.SeedAssignment} (hgood : seeds.AllGoodSeeds (P.paddedDom d)) {storeLvl : Fin P.paddedUniv → ℕ} (hvsl : ValidStoreLvl seeds (P.paddedDom d) storeLvl) {ℓ : ℕ} (h2 : 2 ≤ ℓ) (hlt : ℓ < P.depth) (u : Fin (P.numNodes ℓ)) {x : Fin P.paddedUniv} (hx : x ∈ seeds.activeAt (P.paddedDom d) ℓ ⋯ u) (hsl : storeLvl x < ℓ) :
(buildInnerOfStoreLvl d seeds hgood hvsl ℓ h2 hlt u).wait.lookup (seeds.idAt ℓ ⋯ ⋯ x) = some (seeds.idAt (ℓ - 1) ⋯ ⋯ x)

Build a full TreeState from any d : P.PaddedDict, sentCount : ℕ, and seeds satisfying seeds.AllGoodSeeds (P.paddedDom d).

@[simp]
theorem Cslib.DataStructure.Dictionary.SubconstantRedundancy.TreeSchedule.seeds_buildTreeFromSeeds {P : TreeSchedule} (scheme : DynamicMatching.Scheme (2 ^ P.idBits P.depth) (P.nLow P.depth)) (d : P.PaddedDict) (sentCount : ℕ) (seeds : P.SeedAssignment) (hgood : seeds.AllGoodSeeds (P.paddedDom d)) :
(P.buildTreeFromSeeds scheme d sentCount seeds hgood).seeds = seeds
@[simp]
theorem Cslib.DataStructure.Dictionary.SubconstantRedundancy.TreeSchedule.sentCount_buildTreeFromSeeds {P : TreeSchedule} (scheme : DynamicMatching.Scheme (2 ^ P.idBits P.depth) (P.nLow P.depth)) (d : P.PaddedDict) (sentCount : ℕ) (seeds : P.SeedAssignment) (hgood : seeds.AllGoodSeeds (P.paddedDom d)) :
(P.buildTreeFromSeeds scheme d sentCount seeds hgood).sentCount = sentCount

buildTreeFromSeeds establishes WellFormedPadded.