Documentation

CslibFrontier.DataStructure.Dictionary.WordRAM.ResizableSuccinct.Dispatch

In-Epoch Operational Dispatcher on the Resizable Word RAM #

This module formalizes the in-epoch operational dispatcher of the resizable succinct dynamic dictionary on the word-granular Resizable Word RAM (Cslib.WordRAM.Resizable), wiring the RealizesBounded .exact (¬ReadsWidth) subroutines from Accessors.lean, SlotOps.lean, BucketOps.lean, and RuntimeReducedKWise.lean into parameter-free native RCode .exact rEpoch operational dispatchers:

  1. Parameter-Free Native Dispatchers (inEpochQueryCode, inEpochInsertCode, inEpochDeleteCode, inEpochOpCode): Relocatable RCode .exact rEpoch programs independent of (U, V, w, N, n, base):
    • inEpochQueryCode: reads n from base + 6, returns none in O(1) steps when n = 0, and otherwise loads HashParams/CompParams from [base + 8, base + 63), reconstructs x.frontier into rFr, evaluates h_q, and runs compQueryWithHashGenProg;
    • inEpochInsertCode: searches (b, m) via compInsertSearchWithHashGenProg, updates the existing slot in place via compWritePhysValGenProg on a hit, and on a miss grows the item stream by Δ ≤ 2 zeroed words via growZeroCode, appends the new slot via compInsertAppendNewGenProg, and increments n at base + 6;
    • inEpochDeleteCode: returns immediately when n = 0, and otherwise executes two-phase deletion (compDeletePrepWithHashGenProg, second hash evaluation on q_last, and compDeleteFinishWithHashGenProg), shrinking the item stream by Δ ≤ 2 words via shrinkCode and decrementing n at base + 6 when found = 1;
    • inEpochOpCode: unified per-operation dispatcher branching on rTag.
  2. Operational Invariant, 1 · OPT Peak Space, and Expected Amortized $O(1)$ Cost:

Main definitions #

Main results #

References #

Section 1: Native RCode .exact rEpoch Operational Dispatchers #

In-epoch query operational code (RCode .exact rEpoch, parameter-free): loads n from base + 6, returns none when n = 0, and otherwise runs compQueryWithHashGenProg to write (rOutTag, rOutVal).

In-epoch insert operational code (RCode .exact rEpoch, parameter-free): searches (b, m) via compInsertSearchWithHashGenProg, overwrites the value in place on a hit, and on a miss grows [0, frontier) by Δ ≤ 2 zeroed words (growZeroCode), appends the new entry (compInsertAppendNewGenProg), and increments n at base + 6.

In-epoch delete operational code (RCode .exact rEpoch, parameter-free): no-op when n = 0, and otherwise runs two-phase deletion (compDeletePrepWithHashGenProg, second hash evaluation on q_last, and compDeleteFinishWithHashGenProg), shrinking [0, frontier) by Δ ≤ 2 words (shrinkCode) and decrementing n at base + 6 on a hit.

Unified parameter-free in-epoch operational dispatcher (RCode .exact rEpoch): branches on rTag between inEpochQueryCode (0), inEpochInsertCode (1), and inEpochDeleteCode (2).

Section 2: Width-Independence (¬inEpochOpCode.ReadsWidth) #

Section 3: Per-Operation Execution and Main Certificates #

Section 4: Main Operational Execution, 1 · OPT PeakFrontierLe, and O(1) Expectation #

theorem Cslib.DataStructure.Dictionary.WordRAM.ResizableSuccinct.inEpochOpCode_active_demonicExec {U V w N n n_init base : ℕ} {θ : Succinct.QuotHashSeed U N} {s_abs : State U} (o : Dynamic.Op U) {x : WordRAM.Resizable.RData rEpoch} (hx : WordRAM.Resizable.RData.Bounded w x) (hn : 0 < n) (hev : EpochValid U n N) (hval : InEpochValid V N s_abs o) (hfr : x.frontier = base + compactedEpochWords U V w N n) (hsplit : CompactedSplitRep base (base + offCompItems U w N) U V w N n n_init θ s_abs { mem := x.mem, frontier := x.frontier }) (hbase : x.regs rBase = base) (harg : argMatch o x.regs) (hfit : WordRAM.Fits w (base + inEpochPeakWords V w N n s_abs o)) :
have s_abs' := ((Dynamic.spec U V U).stepFn s_abs o).1; have n' := (dom s_abs').card; ∃ (y : WordRAM.Resizable.RData rEpoch) (steps : ℕ), (WordRAM.Resizable.RDemonicExec w (base + inEpochPeakWords V w N n s_abs o) inEpochOpCode x steps fun (x : WordRAM.Resizable.RData rEpoch) => x = y) ∧ decode o y.regs = some ((Dynamic.spec U V U).stepFn s_abs o).2 ∧ WordRAM.Resizable.RData.Bounded w y ∧ y.frontier = base + compactedEpochWords U V w N n' ∧ CompactedSplitRep base (base + offCompItems U w N) U V w N n' n_init θ s_abs' { mem := y.mem, frontier := y.frontier } ∧ y.regs rBase = base ∧ (∀ addr < base, y.mem addr = x.mem addr) ∧ steps + inEpochPotential U w N base y ≤ inEpochPotential U w N base x + inEpochBaseCharge + 12 * inEpochFactor * SuccinctBucket.probeExcess N (Succinct.qStage1 U N θ.1) (Succinct.polyStage2 U N) θ.2 (dom s_abs) (opKey o)

Active-Epoch Seeded Operational Execution (inEpochOpCode_active_demonicExec): For any active epoch (0 < n, latent seed θ : QuotHashSeed U N) and any o : Dynamic.Op U satisfying InEpochValid V N s_abs o, inEpochOpCode executes deterministically in steps instructions, keeps the hardware frontier ≤ base + inEpochPeakWords V w N n s_abs o at every step, decodes the exact Dynamic.spec result, preserves CompactedSplitRep at the same latent seed θ, preserves rBase and caller memory < base, and satisfies the potential-amortized step bound steps + Φ(y) ≤ Φ(x) + inEpochBaseCharge + (12 * inEpochFactor) * probeExcess.

theorem Cslib.DataStructure.Dictionary.WordRAM.ResizableSuccinct.inEpochOpCode_demonicExec {U V w N n n_init base : ℕ} {s_abs : State U} (o : Dynamic.Op U) {x : WordRAM.Resizable.RData rEpoch} (hrep : CompactedRep U V w N n n_init base s_abs x) (hval : InEpochValid V N s_abs o) (hbase : x.regs rBase = base) (harg : argMatch o x.regs) (hfit : WordRAM.Fits w (base + inEpochPeakWords V w N n s_abs o)) :
have s_abs' := ((Dynamic.spec U V U).stepFn s_abs o).1; have n' := (dom s_abs').card; ∃ (y : WordRAM.Resizable.RData rEpoch) (steps : ℕ), (WordRAM.Resizable.RDemonicExec w (base + inEpochPeakWords V w N n s_abs o) inEpochOpCode x steps fun (x : WordRAM.Resizable.RData rEpoch) => x = y) ∧ decode o y.regs = some ((Dynamic.spec U V U).stepFn s_abs o).2 ∧ CompactedRep U V w N n' n_init base s_abs' y ∧ y.regs rBase = base ∧ ∀ addr < base, y.mem addr = x.mem addr

In-Epoch Compacted Representation Execution (inEpochOpCode_demonicExec): For every resting CompactedRep U V w N n n_init base s_abs x (both n = 0 and 0 < n) and every o : Dynamic.Op U satisfying InEpochValid V N s_abs o, inEpochOpCode executes without faulting under peak hardware frontier base + inEpochPeakWords V w N n s_abs o, returns the Dynamic.spec output via decode o, and preserves CompactedRep, rBase, and caller memory < base.

theorem Cslib.DataStructure.Dictionary.WordRAM.ResizableSuccinct.inEpochOpCode_execRCodeDist {U V w N n n_init base : ℕ} {s_abs : State U} (o : Dynamic.Op U) {x : WordRAM.Resizable.RData rEpoch} (hrep : CompactedRep U V w N n n_init base s_abs x) (hval : InEpochValid V N s_abs o) (hbase : x.regs rBase = base) (harg : argMatch o x.regs) (hfit : WordRAM.Fits w (base + inEpochPeakWords V w N n s_abs o)) :
have s_abs' := ((Dynamic.spec U V U).stepFn s_abs o).1; have n' := (dom s_abs').card; ∃ (y : WordRAM.Resizable.RData rEpoch) (steps : ℕ), WordRAM.Resizable.ExecRCodeDist w inEpochOpCode x (PMF.pure y) (↑steps) (base + Dynamic.succinctWords 1355 441 U V w (max n n')) ∧ decode o y.regs = some ((Dynamic.spec U V U).stepFn s_abs o).2 ∧ CompactedRep U V w N n' n_init base s_abs' y ∧ y.regs rBase = base ∧ ∀ addr < base, y.mem addr = x.mem addr

In-Epoch Distributional Execution (inEpochOpCode_execRCodeDist): Lifts inEpochOpCode_demonicExec directly to ExecRCodeDist, certifying fault-freedom across all adaptive adversaries, exact CompactedRep preservation, and 1 · OPT peak hardware frontier bounded by base + Dynamic.succinctWords 1355 441 U V w (max n n').

theorem Cslib.DataStructure.Dictionary.WordRAM.ResizableSuccinct.inEpochOpCode_peakFrontierLe {U V w N n n_init base : ℕ} {s_abs : State U} (o : Dynamic.Op U) {x : WordRAM.Resizable.RData rEpoch} (hrep : CompactedRep U V w N n n_init base s_abs x) (hval : InEpochValid V N s_abs o) (hbase : x.regs rBase = base) (harg : argMatch o x.regs) (hfit : WordRAM.Fits w (base + inEpochPeakWords V w N n s_abs o)) :
WordRAM.Resizable.PeakFrontierLe w (base + Dynamic.succinctWords 1355 441 U V w (max n (dom ((Dynamic.spec U V U).stepFn s_abs o).1).card)) (inEpochOpCode.program rOutTag) { pc := 0, data := x }

Stepwise 1 · OPT Hardware-Frontier Certificate (inEpochOpCode_peakFrontierLe): Throughout execution of inEpochOpCode.program rOutTag on any valid in-epoch operation, the active hardware word frontier never exceeds base + Dynamic.succinctWords 1355 441 U V w (max n n').

theorem Cslib.DataStructure.Dictionary.WordRAM.ResizableSuccinct.inEpochOpCode_expected_amortized {U V w N n n_init base : ℕ} {s_abs : State U} (o : Dynamic.Op U) (xOf : Succinct.QuotHashSeed U N → WordRAM.Resizable.RData rEpoch) (hn : 0 < n) (hev : EpochValid U n N) (hval : InEpochValid V N s_abs o) (hfit : WordRAM.Fits w (base + inEpochPeakWords V w N n s_abs o)) (hx_bdd : ∀ (θ : Succinct.QuotHashSeed U N), WordRAM.Resizable.RData.Bounded w (xOf θ)) (hx_fr : ∀ (θ : Succinct.QuotHashSeed U N), (xOf θ).frontier = base + compactedEpochWords U V w N n) (hx_split : ∀ (θ : Succinct.QuotHashSeed U N), CompactedSplitRep base (base + offCompItems U w N) U V w N n n_init θ s_abs { mem := (xOf θ).mem, frontier := (xOf θ).frontier }) (hx_base : ∀ (θ : Succinct.QuotHashSeed U N), (xOf θ).regs rBase = base) (hx_arg : ∀ (θ : Succinct.QuotHashSeed U N), argMatch o (xOf θ).regs) :
have s_abs' := ((Dynamic.spec U V U).stepFn s_abs o).1; have n' := (dom s_abs').card; have μ := Probability.PMF.uniformOfFintype (Succinct.QuotHashSeed U N); ∃ (yOf : Succinct.QuotHashSeed U N → WordRAM.Resizable.RData rEpoch) (stepsOf : Succinct.QuotHashSeed U N → ℕ), (∀ (θ : Succinct.QuotHashSeed U N), (WordRAM.Resizable.RDemonicExec w (base + inEpochPeakWords V w N n s_abs o) inEpochOpCode (xOf θ) (stepsOf θ) fun (x : WordRAM.Resizable.RData rEpoch) => x = yOf θ) ∧ decode o (yOf θ).regs = some ((Dynamic.spec U V U).stepFn s_abs o).2 ∧ WordRAM.Resizable.RData.Bounded w (yOf θ) ∧ (yOf θ).frontier = base + compactedEpochWords U V w N n' ∧ CompactedSplitRep base (base + offCompItems U w N) U V w N n' n_init θ s_abs' { mem := (yOf θ).mem, frontier := (yOf θ).frontier } ∧ (yOf θ).regs rBase = base ∧ ∀ addr < base, (yOf θ).mem addr = (xOf θ).mem addr) ∧ ∑' (θ : Succinct.QuotHashSeed U N), μ θ * ↑(stepsOf θ + inEpochPotential U w N base (yOf θ)) ≤ ∑' (θ : Succinct.QuotHashSeed U N), μ θ * ↑(inEpochPotential U w N base (xOf θ)) + ↑inEpochCharge

Uniform-Seed $O(1)$ Expected Amortized In-Epoch Bound (inEpochOpCode_expected_amortized): For any seed-indexed family xOf : QuotHashSeed U N → RData rEpoch representing s_abs in an active epoch (0 < n, EpochValid U n N, InEpochValid V N s_abs o), inEpochOpCode transitions each xOf θ to yOf θ in stepsOf θ instructions with expected amortized cost at most the parameter-free constant inEpochCharge under PMF.uniformOfFintype (QuotHashSeed U N).