Circular Tail-to-Dense Compaction Bijection, Key Reconstruction, and CompactedRep #
This module defines the circular tail-to-dense bijection (denseOfCirc, WindowInv,
TailDenseInv), direct $O(1)$ owner-bucket and logical-slot recovery on dense slots d ∈ [0, n)
(ownerBucketOfDense, logicalIdxOfDense), and the array-coupling invariants (WindowCoupled,
FixedCoupled) for the resizable succinct dynamic dictionary of Bender, Farach-Colton,
J. Kuszmaul and W. Kuszmaul, SOSA 2024.
Design #
- Circular
[b_win, b_win + n_win)tail window (denseOfCirc,WindowInv): Active full-slab slotsphys < gm 0 * slabSize Nmap directly to dense indexd = phys. Active tail slotsphys = N - 1 - t(t < gm 1) store a circular residuec = td t < M(M = maxTailItems N) and resolve tod = denseOfCirc M b_win c ∈ [b_win, b_win + n_win), with inversedt (d % M) = t. Shiftingb_winby± 1(winGrowLeft,winShrinkLeft) or resizingn_winby± 1(winGrowRight,winShrinkRight) updates only $O(1)$ entries of(td, dt)without reindexing untouched tail items. - Array-level coupling (
WindowCoupled,FixedCoupled):WindowCoupledseparatesmetaBasefromitemBaseso both resting in-epoch states and single-tape epoch migration (Zone 1 metadata + Zone 3 shared item arena) couple directly to the fixed-capacitySuccinctarray extractors (gmAt,lmAt,quotAt,valAt).
Main definitions #
Cslib.DataStructure.Dictionary.WordRAM.ResizableSuccinct.denseOfCirc,WindowInv,TailDenseInv,canonTD,canonDT,denseOfPhys,physByBase,winGrowRight,winGrowLeft,winShrinkRight,winShrinkLeft: circular tail-to-dense bijection and $O(1)$ window updates.Cslib.DataStructure.Dictionary.WordRAM.ResizableSuccinct.ownerBucketOfDense,logicalIdxOfDense: $O(1)$ owner-bucket and logical-slot recovery on dense slotsd ∈ [0, n).Cslib.DataStructure.Dictionary.WordRAM.ResizableSuccinct.ghostW,WindowCoupled,FixedCoupled: fixed-capacity array coupling invariants.
Main results #
winGrowRight_spec,winGrowLeft_spec,winShrinkRight_spec,winShrinkLeft_spec,physByBase_winGrowRight,physByBase_winGrowLeft,physByBase_winShrinkRight,physByBase_winShrinkLeft: invariant preservation and slot-mapping laws for window transitions.ownerBucketOfDense_lt_and_slotOf,denseOfPhys_slotOf_lt_and_inv,physOfDense_eq_slotOf_owner: exact bijection between dense slots and active bucket slots.
References #
Section 1: Circular Tail-to-Dense Window Bijection (denseOfCirc, WindowInv) #
Recover the unique d ∈ [base_tail, base_tail + M) with d % M = c (for 0 < M, c < M).
Circular tail-to-dense bijection invariant on [b, b + n) modulo M.
Canonical td mapping (b + t) % M for initial / rebuilt epochs.
Canonical dt mapping (c + M - b % M) % M for initial / rebuilt epochs.
Map a physical slot phys < N to its dense index d < n:
when bucketBits N = 0, phys; else phys on full slabs < gm 0 * slabSize N and
denseOfCirc (maxTailItems N) (gm 0 * slabSize N) (td (N - 1 - phys)) on tail slots.
Resting specialization physByBase N (gm 0 * slabSize N) dt.
Section 2: Direct $O(1)$ Bucket-Owner and Logical-Slot Inversion on Dense Indices #
Under SlotStoreInv N gm and TailDenseInv N (gm 0) (gm 1) td dt, every dense index
d < epochTotalSlots N gm maps via (ownerBucketOfDense, logicalIdxOfDense) to a valid active
bucket slot (b, j) with denseOfPhys N gm td (slotOf N gm b j) = d.
Section 3: Fixed-Capacity Array Coupling Invariants (WindowCoupled, FixedCoupled) #
Ghost word width w + 16 used for the mathematical fixed-capacity reference state s_fix,
ensuring Fits (ghostW w) (Succinct.space U V (ghostW w) N) for all N ≤ U ≤ 2 ^ w.
Coupling invariant between a fixed-capacity state s_fix (at base = 0, ghostW w)
and a compacted state s at (metaBase, itemBase) over window [b_win, b_win + n_win).
- gm_eq : compGmAt metaBase U w N s.mem = Succinct.gmAt 0 U V (ghostW w) N (epochHashSpace U (ghostW w) N) s_fix.mem
- lm_eq : compLmAt metaBase U w N s.mem = Succinct.lmAt 0 U V (ghostW w) N (epochHashSpace U (ghostW w) N) s_fix.mem
- quot_eq (d : ℕ) : d < m_items → compQuotAt itemBase U V w N m_items s.mem d = Succinct.quotAt 0 U (ghostW w) N (epochHashSpace U (ghostW w) N) s_fix.mem (physByBase N b_win (compDTAt metaBase U w N s.mem) d)
- val_eq (d : ℕ) : d < m_items → compValAt itemBase U V w N m_items s.mem d = Succinct.valAt 0 U V (ghostW w) N (epochHashSpace U (ghostW w) N) s_fix.mem (physByBase N b_win (compDTAt metaBase U w N s.mem) d)
Resting window coupling (b_win = gm 0 * slabSize N, and n_win = gm 1 when
0 < bucketBits N).