Compositional distributional execution (ExecRCodeDist) on the Resizable Word RAM #
Structured distributional execution (ExecRCodeDist) and its compilation (toExecRProgramDist) to
flat clocked adaptive-adversary execution (ExecRProgramDist) for the word-granular
Resizable Word RAM (Cslib.WordRAM.Resizable).
ExecRCodeDist w c x μ T L_peak couples an adversary-independent fallthrough distribution
μ : PMF (RData r) with an expected instruction bound T : ℝ≥0∞ and an every-step peak hardware
frontier bound L_peak : ℕ. Deterministic big-step RDemonicExec certificates (including
single-word .shrink, the derived Θ(k + 1) subroutines growDirtyCode, growZeroCode, and
shrinkCode, and by realize segments lifted via RDemonicExec.of_execBounded) lift
via ExecRCodeDist.of_demonicExec, compose with .rand, .seq, .branch, .loop_bounded, and
.loop_geometric, transfer along basis simulations (mapSimulates), and compile via
ExecRCodeDist.toExecRProgramDist to ExecRProgramDist w (c.program out) out x μ (T + 1) L_peak.
Main definitions #
Cslib.WordRAM.Resizable.ExecRCodeDist: compositional structured execution certificate onRCode B rwith expected step boundT : ℝ≥0∞and peak hardware frontier boundL_peak : ℕ(publicly re-exportingClockedandLoopDist).Cslib.WordRAM.Resizable.ExecRandBounded: frontier-bounded exact randomized execution of a fixed-memoryCode B rprogram, recordingOp.BoundedAccess L o xon every data instruction.
Main results #
Cslib.WordRAM.Resizable.ExecRCodeDist.loop_bounded: rankedK-iteration boundedwhilerule.Cslib.WordRAM.Resizable.ExecRCodeDist.mapSimulates: basis-simulation transport.Cslib.WordRAM.Resizable.ExecRCodeDist.toExecRProgramDist: compilesc.program outtoExecRProgramDistwith fault-freedom,PeakFrontierLe,expectedTimeDemonic ≤ T + 1, and exact halting-state distributionμ.Cslib.WordRAM.Resizable.ExecRCodeDist.of_execRandBounded,Cslib.WordRAM.Resizable.ExecRCodeDist.of_execRandBounded_rename,Cslib.WordRAM.Resizable.ExecRCodeDist.of_execRandBounded_rename_le: lift frontier-boundedWordRAM.Coderandomized executions (directly or along an injective register map) intoExecRCodeDist.
References #
- [KLZ26] William Kuszmaul, Jingxun Liang, and Renfei Zhou, Succinct Dynamic
Rank/Select: Bypassing the Tree-Structure Bottleneck, SODA 2026 (
arXiv:2510.19175v1, Section 5.1, PDF pp. 16–20 / printed pp. 15–19). - [MU17] Michael Mitzenmacher and Eli Upfal, Probability and Computing, 2nd ed., Cambridge University Press, 2017, Sections 2.1, 2.3, and 2.4.
Compositional distributional execution (ExecRCodeDist) #
Compositional Distributional Execution on the Resizable Word RAM (ExecRCodeDist).
ExecRCodeDist w c x μ T L_peak: at word width w starting from x : RData r, running structured
program c : RCode B r executes without faulting across all adaptive adversaries adv : RAdv r,
keeps the hardware frontier ≤ L_peak at every intermediate step, realizes adversary-independent
fallthrough distribution μ : PMF (RData r) at pc + c.size, and uses at most T : ℝ≥0∞
expected instructions.
- of_demonicExec {B : Basis} {r w L_peak n : ℕ} {c : RCode B r} {x y : RData r} : (RDemonicExec w L_peak c x n fun (x : RData r) => x = y) → ExecRCodeDist w c x (PMF.pure y) (↑n) L_peak
- rand {B : Basis} {r w L_peak : ℕ} {dst src : Fin r} {x : RData r} : x.frontier ≤ L_peak → Fits w (x.regs src) → ExecRCodeDist w (RCode.rand dst src) x (PMF.map (fun (k : Fin (x.regs src + 1)) => x.set dst ↑k) (ProbComp.unifFin (x.regs src)).eval) 1 L_peak
- mono {B : Basis} {r w L_peak : ℕ} {c : RCode B r} {x : RData r} {μ : PMF (RData r)} {T T' : ENNReal} : ExecRCodeDist w c x μ T L_peak → T ≤ T' → ExecRCodeDist w c x μ T' L_peak
- mono_peak {B : Basis} {r w L₁ L₂ : ℕ} {c : RCode B r} {x : RData r} {μ : PMF (RData r)} {T : ENNReal} : L₁ ≤ L₂ → ExecRCodeDist w c x μ T L₁ → ExecRCodeDist w c x μ T L₂
- seq {B : Basis} {r w L_peak : ℕ} {c₁ c₂ : RCode B r} {x : RData r} {μ₁ : PMF (RData r)} {μ₂ : RData r → PMF (RData r)} {T₁ : ENNReal} {T₂ : RData r → ENNReal} : ExecRCodeDist w c₁ x μ₁ T₁ L_peak → (∀ y ∈ μ₁.support, ExecRCodeDist w c₂ y (μ₂ y) (T₂ y) L_peak) → ExecRCodeDist w (c₁.seq c₂) x (μ₁.bind μ₂) (T₁ + ∑' (y : RData r), μ₁ y * T₂ y) L_peak
- branch_pos {B : Basis} {r w L_peak : ℕ} {cond : Cond r} {pos neg : RCode B r} {x : RData r} {μ : PMF (RData r)} {T : ENNReal} : cond.Holds x.toData → ExecRCodeDist w pos x μ T L_peak → ExecRCodeDist w (RCode.branch cond pos neg) x μ (T + 1) L_peak
- branch_neg {B : Basis} {r w L_peak : ℕ} {cond : Cond r} {pos neg : RCode B r} {x : RData r} {μ : PMF (RData r)} {T : ENNReal} : ¬cond.Holds x.toData → ExecRCodeDist w neg x μ T L_peak → ExecRCodeDist w (RCode.branch cond pos neg) x μ (T + 2) L_peak
- loop_iter {B : Basis} {r w L_peak : ℕ} {cond : Cond r} {body : RCode B r} {x : RData r} {μ₁ : PMF (RData r)} {μ₂ : RData r → PMF (RData r)} {T₁ : ENNReal} {T₂ : RData r → ENNReal} : cond.Holds x.toData → ExecRCodeDist w body x μ₁ T₁ L_peak → (∀ y ∈ μ₁.support, ExecRCodeDist w (RCode.loop cond body) y (μ₂ y) (T₂ y) L_peak) → ExecRCodeDist w (RCode.loop cond body) x (μ₁.bind μ₂) (T₁ + 2 + ∑' (y : RData r), μ₁ y * T₂ y) L_peak
- loop_geometric {B : Basis} {r w L_peak : ℕ} {cond : Cond r} {body : RCode B r} (I Q : RData r → Prop) {μ_body : RData r → PMF (RData r)} {T_body : RData r → ENNReal} {B_body p_exit : ENNReal} {x : RData r} : 0 < p_exit → p_exit ≠ ⊤ → (∀ (z : RData r), I z → cond.Holds z.toData → ExecRCodeDist w body z (μ_body z) (T_body z) L_peak) → (∀ (z : RData r), I z → cond.Holds z.toData → T_body z ≤ B_body) → (∀ (z : RData r), I z → cond.Holds z.toData → ∀ y ∈ (μ_body z).support, RLoopStateInv cond I Q y) → (∀ (z : RData r), I z → cond.Holds z.toData → p_exit ≤ (μ_body z).toOuterMeasure {y : RData r | ¬cond.Holds y.toData}) → (∀ (z : RData r), ¬cond.Holds z.toData → Q z → z.frontier ≤ L_peak) → RLoopStateInv cond I Q x → ExecRCodeDist w (RCode.loop cond body) x (loopExitRPMF cond μ_body x) ((B_body + 2) / p_exit + 2) L_peak
Ranked worst-case K-iteration while loop rule for ExecRCodeDist.
Transport ExecRCodeDist along any defined-evaluation basis simulation φ : B.Simulates B'.
Finite-horizon Bellman inequality for ExecRCodeDist inside any containing
p : RProgram B r.
Full-horizon Bellman inequality for ExecRCodeDist.
Horizon-bounded safety and peak-frontier propagation for ExecRCodeDist.
Halting-reachability propagation for ExecRCodeDist.
Main Structured-to-Flat Resizable Word RAM Compilation (toExecRProgramDist).
Every ExecRCodeDist w c x μ T L_peak certificate compiles via c.program out to
ExecRProgramDist w (c.program out) out x μ (T + 1) L_peak.
Lifting frontier-bounded randomized WordRAM.Code executions (ExecRandBounded) #
Frontier-bounded randomized big-step execution of a structured Code B r. Mirrors
Cslib.WordRAM.ExecRand while recording Op.BoundedAccess L o x on every data instruction,
allowing any non-allocating randomized subroutine to lift directly to ExecRCodeDist on
RCode.ofCode c (and across injective register renamings c.rename f).
- op {B : Basis} {r w L : ℕ} {o : Op B r} {x y : Data r} : Op.BoundedAccess L o x → Op.eval w o x = some y → ExecRandBounded w L (Code.op o) x (pure (y, 1))
A data instruction whose memory access stays strictly below
Ltakes1step. - rand {B : Basis} {r w L : ℕ} {dst src : Fin r} {x : Data r} : Fits w (x.regs src) →
ExecRandBounded w L (Code.rand dst src) x do
let k ← ProbComp.unifFin (x.regs src)
pure (x.set dst ↑k, 1)
Random uniform draw
rand dst srctakes1step with no memory access. - seq {B : Basis} {r w L : ℕ} {c₁ c₂ : Code B r} {x : Data r} {m₁ : ProbComp (Data r × ℕ)} {m₂ : Data r → ProbComp (Data r × ℕ)} : ExecRandBounded w L c₁ x m₁ →
(∀ z ∈ OracleComp.support m₁, ExecRandBounded w L c₂ z.1 (m₂ z.1)) →
ExecRandBounded w L (c₁.seq c₂) x do
let z₁ ← m₁
let z₂ ← m₂ z₁.1
pure (z₂.1, z₁.2 + z₂.2)
Sequencing composes bounded-access randomized executions via monadic
bind. - branch_pos {B : Basis} {r w L : ℕ} {cond : Cond r} {pos neg : Code B r} {x : Data r} {m : ProbComp (Data r × ℕ)} : cond.Holds x →
ExecRandBounded w L pos x m →
ExecRandBounded w L (Code.branch cond pos neg) x ((fun (z : Data r × ℕ) => (z.1, z.2 + 1)) <$> m)
Positive branch of a conditional adds
1step. - branch_neg {B : Basis} {r w L : ℕ} {cond : Cond r} {pos neg : Code B r} {x : Data r} {m : ProbComp (Data r × ℕ)} : ¬cond.Holds x →
ExecRandBounded w L neg x m →
ExecRandBounded w L (Code.branch cond pos neg) x ((fun (z : Data r × ℕ) => (z.1, z.2 + 2)) <$> m)
Negative branch of a conditional adds
2steps. - loop_exit {B : Basis} {r w L : ℕ} {cond : Cond r} {body : Code B r} {x : Data r} : ¬cond.Holds x → ExecRandBounded w L (Code.loop cond body) x (pure (x, 2))
Exiting a while loop takes
2steps. - loop_iter {B : Basis} {r w L : ℕ} {cond : Cond r} {body : Code B r} {x : Data r} {m₁ : ProbComp (Data r × ℕ)} {m₂ : Data r → ProbComp (Data r × ℕ)} : cond.Holds x →
ExecRandBounded w L body x m₁ →
(∀ z ∈ OracleComp.support m₁, ExecRandBounded w L (Code.loop cond body) z.1 (m₂ z.1)) →
ExecRandBounded w L (Code.loop cond body) x do
let z₁ ← m₁
let z₂ ← m₂ z₁.1
pure (z₂.1, z₁.2 + z₂.2 + 2)
One iteration of a while loop followed by the rest adds
z₁.2 + z₂.2 + 2steps.
Embed a deterministic frontier-bounded execution ExecBoundedExact as a point-mass
ExecRandBounded.
Prepend a register-only deterministic Exec onto an ExecRandBounded.
A rand instruction followed by a frontier-bounded deterministic ExecBoundedExact suffix.
Rename registers in an ExecRandBounded execution along an injective map f.
Lift a frontier-bounded randomized execution ExecRandBounded w L c x.toData m directly into
ExecRCodeDist on RCode.ofCode c with unchanged hardware frontier x.frontier.
Lift a frontier-bounded randomized execution ExecRandBounded w L c (x.toData.comap f) m along
any injective register renaming f : Fin r → Fin r' directly into ExecRCodeDist on
RCode.ofCode (c.rename f), preserving x.frontier.
Worst-case step-bound specialization of ExecRCodeDist.of_execRandBounded_rename.