Small-Regime Array, In-Place Slot Permutation, and CSR Fallback Model #
This module develops three pure building blocks for the with-high-probability fixed-capacity
succinct dynamic dictionary (Cslib.DataStructure.Dictionary.SuccinctWhp):
- Small-regime deterministic array (
SmallDictState): whenn_max < whpThreshold c, the dictionary stores up ton_max(present, key, value)triples scanned inn_max < whpThreshold cdeterministic steps (failureProb = 0). - In-place cycle-following slot rearrangement (
permuteByTarget): rearrangesqArrandvArrin place acrossn_maxphysical slots along any injective partial map{s < n_max | active s} → Fin n_max, using a single 1-bitactivemarker array and fixedn_max-iteration loops. BothfastMode → fallbackModecompaction andfallbackMode → fastModeself-healing instantiate this single primitive. - Compressed-sparse-row (
CsrState) fallback dictionary and overflow-freeGoodSeedOnStatechecker: stores arbitrary bucket loads(X_0, …, X_{M - 1})(∑ X_b ≤ n_max) in1 · OPT + o(n_max)bits via bucket prefix sumsfbStart[0 .. M]plus Feistel quotients and values, with exactDynamic.steprefinement for every seedθand an overflow-free decision procedure forGoodSeedOnState.
Main definitions #
Cslib.DataStructure.Dictionary.SuccinctWhp.SmallDictState,smallScan,smallQuery,smallInsert,smallDelete,ValidSmallState: deterministic small-regime dictionary model.Cslib.DataStructure.Dictionary.SuccinctWhp.permuteByTarget: in-place cycle-following slot rearrangement.Cslib.DataStructure.Dictionary.SuccinctWhp.CsrState,csrQuery,csrInsert,csrDelete,ValidCsrState,checkBalancedBucketNat,checkGoodSeedOnState: CSR fallback dictionary and self-healing eligibility checker.
Main results #
Cslib.DataStructure.Dictionary.SuccinctWhp.smallQuery_spec,smallInsert_spec,smallDelete_spec: exactDynamic.steprefinement in the small regime.Cslib.DataStructure.Dictionary.SuccinctWhp.permuteByTarget_spec: exact in-place bijection specification ofpermuteByTarget.Cslib.DataStructure.Dictionary.SuccinctWhp.csrQuery_spec,csrInsert_spec,csrDelete_spec,checkGoodSeedOnState_spec: exactDynamic.steprefinement in CSR fallback mode and exact equivalence withGoodSeedOnState.
Section 1: Small-regime deterministic dictionary (n_max < whpThreshold c) #
Pure state of the small-regime bit-packed array dictionary (0 .. n_max - 1).
Occupancy bit (
0= empty, non-zero = active) at sloti < n_max.Stored key
< Uat sloti < n_max.Stored value
< Vat sloti < n_max.
Single step of the n_max-slot scan at index i, maintaining (foundIdx1, freeIdx1) where 0
encodes none and idx + 1 encodes some idx.
Prefix scan over 0 .. k - 1 returning (foundIdx1, freeIdx1).
Small-regime lookup of u_val.
Small-regime insertion / overwrite of (u_val, v_val).
Small-regime deletion of u_val.
Representation invariant relating SmallDictState to dict : Dictionary.State U.
Small-regime lookup matches dict u.
Small-regime deletion preserves ValidSmallState and refines Function.update dict u none.
Small-regime insertion preserves ValidSmallState and refines
Function.update dict u (some v) whenever Dynamic.valid V n_max dict (.insert u v).
Section 2: In-place cycle-following slot rearrangement (permuteByTarget) #
State tuple (running, curDest, curQ, curV, act, qArr, vArr) for permuteInnerStep.
Single step of a cycle-following chain along dest.
Run k steps of permuteInnerStep.
Exact in-place permutation theorem (permuteByTarget_spec):
if dest is injective on A₀ = {s < n_max | act₀ s = true} and maps A₀ into < n_max, then
permuteByTarget places (q₀ s, v₀ s) at dest s for every s ∈ A₀ while preserving global
value bounds (Q_bnd, V_bnd).
Compressed-sparse-row bucket fallback state over M = numBucketsWhp n_max Feistel buckets.
Stored Feistel quotients
< 2 ^ quotBitsWhp U n_max.Stored values
< V.
Exact bucket-slice bijection for ValidCsrState: for every b : Fin (numBucketsWhp n_max),
(Dictionary.dom dict).filter (feistelBucket = b) has cardinality
csr.fbStart (b + 1) - csr.fbStart b, and #(Dictionary.dom dict) = csr.fbStart M.
CSR fallback lookup matches dict u for every seed h1.
CSR fallback deletion preserves ValidCsrState and refines Function.update dict u none for
every seed h1.
CSR fallback insertion preserves ValidCsrState and refines
Function.update dict u (some v) whenever n_max ≤ U and
Dynamic.valid V n_max dict (.insert u v).
Overflow-free single-bucket load-balance test (M * X_b ≤ N + M * δ ∧ N ≤ M * X_b + M * δ)
using only division and remainder < max (N + 1) M.
csrBucketOfIdx depends only on fbStart 0 .. fbStart k.
Check all buckets 0 .. k - 1 for
checkBalancedBucketNat M δ N (fbStart (b + 1) - fbStart b).
Exact soundness and completeness of checkGoodSeedOnState:
for any ValidCsrState, (checkGoodSeedOnState c U n_max θ csr).1 = true ↔ GoodSeedOnState c U n_max θ dict, and when true, (checkGoodSeedOnState ...).2 b is a valid
collision-free salt < sMaxWhp c n_max for every bucket b.