Documentation

CslibFrontier.DataStructure.Dictionary.WordRAM.Succinct

Fixed-Capacity Succinct Dynamic Dictionary with Deletions on the Word-RAM #

This module packages the fixed-capacity succinct dynamic dictionary with deletions (insert, delete, query) over Cslib.WordRAM.Basis.exact and Cslib.WordRAM.Basis.standard as a reusable Cslib.DataStructure.WordRAM.Randomized.StateTransitionImpl certificate (Cslib.DataStructure.Dictionary.WordRAM.Succinct.impl and implStandard) for Cslib.DataStructure.Dictionary.Dynamic.spec U V n_max.

Mathematical and algorithmic design #

This implementation combines the bucket partition and fingerprint-indexed buckets of Bender, Farach-Colton, J. Kuszmaul, and W. Kuszmaul, SOSA 2024, Sections 3–4 with one-round Feistel quotienting (Arbitman, Naor, and Segev, FOCS 2010, Claim 5.7; Bender, Conway, Farach-Colton, Kuszmaul, and Tagliavini, J. ACM 2023, Section 7, arXiv pp. 31–33). It uses fixed-width full slabs with a shared tail pool (Bender, Farach-Colton, J. Kuszmaul, W. Kuszmaul, and M. Liu, STOC 2022, Sections 5.2 and 6.1, Lemma 24) together with this formalization's own micro-bucket chains and slab-hysteresis potential. Unlike Bender, Farach-Colton, J. Kuszmaul, and W. Kuszmaul, SOSA 2024, the capacity n_max is fixed without table resizing. Hashing uses explicit two-stage 3-wise independent quotient hashing rather than fully random hash functions (SOSA 2024 Section 2.1). Operations here run in O(1) expected amortized time on oblivious operation sequences fixed before initialization. By contrast, SOSA 2024 Lemma 4.3 gives worst-case O(1) queries and deletions and expected O(1) insertions at fixed capacity. SOSA 2024 Sections 5–6 prove with-high-probability bounds and add resizing.

  1. One-round Feistel quotienting (FeistelQuotient): splits each key u : Fin U into a bucketBits n_max-bit low part and a quotientBits U n_max-bit quotient q, storing only q and reconstructing u injectively within each bucket b = (h₁(q) mod 2 ^ b_bits) ⊕ (u mod 2 ^ b_bits). Storing n_max quotients of quotientBits U n_max bits and n_max values of valBits V bits uses at most Dynamic.optBits U V n_max + 5 * n_max * Dynamic.logLogFactor n_max bits (quotient_val_bits_le_optBits). We assume n_max ≤ U because keys are distinct elements of Fin U (so at most U distinct keys can coexist, and U.choose n_max = 0 when n_max > U).
  2. Slab + tail slot store (SuccinctSlotInv, SuccinctSlabOps, SuccinctTailOps): stores up to n_max active items in a single n_max-slot array (slotOf), packing full slabs of slabSize n_max = 2 ^ slabBits n_max ((slabScale n_max) ^ 2 when 0 < bucketBits n_max, else 1) items from the low end and individual tail items from the high end under gm 0 * slabSize n_max + gm 1 ≤ n_max (SlotStoreInv.multi_total_le). Per-bucket item counts depend only on the current live set, while the split between full slabs and tail items depends on history. bucketPotential pays for the lazy promotions and demotions.
  3. Two-stage universe-reduced 3-wise quotient hashing (ReducedKWise): maps quotients into (bucket, local micro-bucket) pairs using O(1) + o(n_max) / w words of seed and bit-packed Four-Russians carryless multiplication tables (hashSpace U w n_max), without any U ≤ poly(n_max) restriction.
  4. Memory.Prog + realize refinement (SuccinctProg .. SuccinctDispatch): all deterministic bucket, slab, tail, and micro-chain operations are written as parameter-free Memory.Prog subroutines compiled to WordRAM.Code via realize. They receive the 36 static parameters in registers loaded by the 36-instruction loadParamsCode prefix.

Cost model and parameter dependence #

Main definitions #

Main results #

References #

Section 1: allocSpan, initSetup, and StateTransitionImpl packaging (impl) #

theorem Cslib.DataStructure.Dictionary.WordRAM.Succinct.span_exec_succinct {U V w n_max base : ℕ} (hfit : WordRAM.Fits w (base + space U V w n_max)) {x : WordRAM.Data rSuccinct} (hfr : x.regs frontierReg = base) :
∃ (x₁ : WordRAM.Data rSuccinct), WordRAM.ExecWithin w (subroutineCode U V w n_max).allocSpan x x₁ 3 ∧ x₁.mem = x.mem ∧ x₁.regs baseReg = base ∧ x₁.regs frontierReg = base + space U V w n_max ∧ ∀ (j : Fin 0), x₁.regs ((subroutineCode U V w n_max).initParams j) = j.elim0
theorem Cslib.DataStructure.Dictionary.WordRAM.Succinct.setup_exec_succinct {U V w n_max base : ℕ} (hwf : DictParamsWf U V w n_max) (hfit : WordRAM.Fits w (base + space U V w n_max)) {x₁ : WordRAM.Data rSuccinct} (hx₁ : WordRAM.Data.Bounded w x₁) (hbase : x₁.regs baseReg = base) (hfr : x₁.regs frontierReg = base + space U V w n_max) (hz : ∀ a ∈ { base := base, length := space U V w n_max }.footprint, x₁.mem a = 0) :
∃ (ν₀ : PMF (QuotHashSeed U n_max × WordRAM.Data rSuccinct)), WordRAM.ExecCodeDist w (subroutineCode U V w n_max).initSetup x₁ (PMF.map Prod.snd ν₀) ↑(HashFamily.WordRAM.ReducedKWise.initTableSteps (qBits U n_max) (hashB n_max) (SuccinctBucket.totalMicroBits n_max) + HashFamily.WordRAM.ReducedKWise.resampleSteps (qBits U n_max) (hashB n_max) (SuccinctBucket.totalMicroBits n_max) 3) ∧ (∀ (θ : QuotHashSeed U n_max), (PMF.map Prod.fst ν₀) θ ≤ 1 * (Probability.PMF.uniformOfFintype (QuotHashSeed U n_max)) θ) ∧ ∀ p ∈ ν₀.support, p.2.regs frontierReg = base + space U V w n_max ∧ Rep U V w n_max base p.1 (empty U) p.2 ∧ potential U V w n_max base p.1 p.2 ≤ 0 ∧ WordRAM.Modifies { base := base, length := space U V w n_max }.footprint x₁.mem p.2.mem
theorem Cslib.DataStructure.Dictionary.WordRAM.Succinct.tsum_mul_probeExcess_le {U V w n_max base : ℕ} (hnU : n_max ≤ U) {s_abs : State U} (u : Fin U) (ν : PMF (QuotHashSeed U n_max × WordRAM.Data rSuccinct)) (hseed : ∀ (θ : QuotHashSeed U n_max), (PMF.map Prod.fst ν) θ ≤ 1 * (Probability.PMF.uniformOfFintype (QuotHashSeed U n_max)) θ) (hsupp : ∀ p ∈ ν.support, Rep U V w n_max base p.1 s_abs p.2) :
∑' (p : QuotHashSeed U n_max × WordRAM.Data rSuccinct), ν p * ↑(8 * opFactor * SuccinctBucket.probeExcess n_max (qStage1 U n_max p.1.1) (polyStage2 U n_max) p.1.2 (dom s_abs) u) ≤ 40 * ↑opFactor
theorem Cslib.DataStructure.Dictionary.WordRAM.Succinct.input_sReg_eq_false {U V w n_max : ℕ} {i : Fin 292} (h1 : i ≠ 244) (h2 : i ≠ 245) (h3 : i ≠ 246) :
(subroutineCode U V w n_max).input (sReg i) = false
noncomputable def Cslib.DataStructure.Dictionary.WordRAM.Succinct.impl {U V w n_max base : ℕ} (hw : 0 < w) (hnU : n_max ≤ U) (hU : WordRAM.Fits w U) (hV : WordRAM.Fits w V) (hfit : WordRAM.Fits w (base + space U V w n_max)) :

Reusable Randomized.StateTransitionImpl certificate over Basis.exact for the fixed-capacity succinct dynamic dictionary (Dynamic.spec U V n_max).

noncomputable def Cslib.DataStructure.Dictionary.WordRAM.Succinct.implStandard {U V w n_max base : ℕ} (hw : 0 < w) (hnU : n_max ≤ U) (hU : WordRAM.Fits w U) (hV : WordRAM.Fits w V) (hfit : WordRAM.Fits w (base + space U V w n_max)) :

Reusable Randomized.StateTransitionImpl certificate over Basis.standard for the fixed-capacity succinct dynamic dictionary (Dynamic.spec U V n_max).

theorem Cslib.DataStructure.Dictionary.WordRAM.Succinct.initTime_impl_le {U V w n_max base : ℕ} (hw : 0 < w) (hnU : n_max ≤ U) (hU : WordRAM.Fits w U) (hV : WordRAM.Fits w V) (hfit : WordRAM.Fits w (base + space U V w n_max)) :
(impl hw hnU hU hV hfit).initTime ≤ ↑(initSteps U n_max + 1) ∧ initSteps U n_max + 1 ≤ 31 * n_max + 1092

The total initialization time (impl hw hnU hU hV hfit).initTime is bounded by initSteps U n_max + 1 ≤ 31 * n_max + 1092.

theorem Cslib.DataStructure.Dictionary.WordRAM.Succinct.seq_expected_amortized {U V w n_max base : ℕ} (hw : 0 < w) (hnU : n_max ≤ U) (hU : WordRAM.Fits w U) (hV : WordRAM.Fits w V) (hfit : WordRAM.Fits w (base + space U V w n_max)) {x : WordRAM.Data rSuccinct} (ops : List (Dynamic.Op U)) (hx : WordRAM.Data.Bounded w x) (hfr : x.regs frontierReg = base) (hz : ∀ a ∈ { base := base, length := space U V w n_max }.footprint, x.mem a = 0) (hv : (Dynamic.spec U V n_max).ValidHistory (empty U) ops) :
∃ (ν₀ : PMF ((impl hw hnU hU hV hfit).Seed × WordRAM.Data rSuccinct)) (ν_final : PMF ((impl hw hnU hU hV hfit).Seed × WordRAM.Data rSuccinct)) (T_ops : ENNReal), WordRAM.ExecCodeDist w (subroutineCode U V w n_max).initFresh x (PMF.map Prod.snd ν₀) (impl hw hnU hU hV hfit).initTime ∧ (impl hw hnU hU hV hfit).ExecStepsOfFn (empty U) ops ν₀ ν_final T_ops ∧ (∀ (θ : (impl hw hnU hU hV hfit).Seed), (PMF.map Prod.fst ν_final) θ ≤ (Probability.PMF.uniformOfFintype (QuotHashSeed U n_max)) θ) ∧ (∀ p ∈ ν_final.support, Rep U V w n_max base p.1 ((Dynamic.spec U V n_max).run (empty U) ops).1 p.2) ∧ (impl hw hnU hU hV hfit).initTime + T_ops + ∑' (q : (impl hw hnU hU hV hfit).Seed × WordRAM.Data rSuccinct), ν_final q * ↑(potential U V w n_max base q.1 q.2) ≤ (impl hw hnU hU hV hfit).initTime + ↑(ops.length * chargeVal)

Headline multi-operation theorem (seq_expected_amortized): Starting from zeroed memory on [base, base + space U V w n_max), fresh initialization followed by any valid operation sequence ops : List (Dynamic.Op U) (ValidHistory (Dictionary.empty U) ops) preserves Rep across ops with expected total instruction count at most initTime + ops.length * chargeVal for the parameter-free O(1) operation charge chargeVal (amortized across ops). Companion theorems space_le_succinctWords and initTime_impl_le / initSteps_le establish the succinct space and linear initialization bounds.