Documentation

CslibFrontier.DataStructure.CellProbe.OfWordRAM

Word-RAM-to-Cell-Probe Data-Structure Simulation Bridges and Lower-Bound Transfer #

This file lifts the program-level Word-RAM-to-cell-probe simulators of CslibFrontier.Computability.CellProbe.OfWordRAM (deterministic cell-probe model and constant-register RAM lower-bound note in [Mil99], §1.2, pp. 1–2; multi-register spilling, wide-cell packing, zeroOutside framing, and Las Vegas truncation are local library constructions) to the relational and oblivious-sequence data-structure Impl hierarchies (Cslib.DataStructure.WordRAM → Cslib.DataStructure.CellProbe, [CLRS09], Section 17.3). Combining these bridges with the zero-error averaging direction of Yao's principle [Yao77] transfers deterministic step-indexed IndexedScheme lower bounds against zero-error implementations on oblivious sequences: the StateTransitionImpl and ObliviousSequenceImpl transfers lower-bound the certified potential-amortized resource budget (initPotential + E[totalCost charge + overhead · length] and initPotential + E[(ops.map charge).sum + overhead · length]), while the flat (ν₀, p_op) transfers directly lower-bound expected ExecFlatProgramOps instructions (E[timeBound ops + overhead · length]). Bounded-error (Monte Carlo) and adaptive-adversary cell-probe lower-bound transfers remain separate directions.

Four simulation and transfer layers are provided across the standard w-bit layout (space + persistentRegCount P cells of width w, additive overhead 2 * persistentRegCount P, which equals 0 extra cells and 0 extra probes when ∀ i, P.input i = true) and, for the main implementation and lower-bound transfer theorems, the wide-cell single-spill layout (space + 1 cells of width wideSubroutineWidth P w, additive overhead at most 2 regardless of register count r):

  1. Deterministic WordRAM.StateTransitionImpl (toCellProbe, toCellProbeWide, simInit): Uses rep_supported and potential_supported with zeroOutside so no extra read-footprint hypothesis is required on WordRAM.StateTransitionImpl; pre-operation initialization is packed into Scheme.init at 0 operation probes, and simInit (in standard w-bit layout) additionally simulates P.initFresh from zeroed cell memory in at most C.initTime + persistentRegCount P probes.
  2. Flat (ν₀, p_op) pairs (ExecFlatProgramOps, exists_cellProbe_of_flatPrograms, exists_cellProbeWide_of_flatPrograms, flat_wordRAM_lower_bound_of_det_cellProbe, flat_wordRAM_lower_bound_of_det_cellProbe_wide): Direct multi-operation Las Vegas bridge coupling an initial state distribution ν₀ with a flat p_op : WordRAM.Program B r without wrapping SubroutineCode.
  3. Randomized Las Vegas WordRAM.Randomized.StateTransitionImpl (exists_cellProbe_lasVegas, exists_cellProbeWide_lasVegas, wordRAM_lower_bound_of_det_cellProbe_lower_bound, wordRAM_lower_bound_of_det_cellProbe_wide): Buffered finite-horizon truncation preserves 100% zero-error transcript correctness on all admissible histories over opsAlphabet up to M_corr (without [Fintype D.Op]), and taking η → 0 eliminates truncation slack completely from the contrapositive Word-RAM lower bound.
  4. Randomized WordRAM.Randomized.ObliviousSequenceImpl (exists_cellProbe_of_execRand, exists_cellProbe_lasVegas, oblivious_wordRAM_lower_bound_of_det_cellProbe, oblivious_wordRAM_lower_bound_of_det_cellProbe_wide): Exact zero-slack standard-layout simulation for finite-tree ExecRand on arbitrary ObliviousSequenceSpecs (including Monte Carlo contracts), standard-layout buffered zero-error simulation, and both standard- and wide-layout contrapositive lower-bound transfers on D.toObliviousSequenceSpec s₀.

Main definitions #

Main results #

References #

0. Shared ENNReal, worst-case horizon, and initial-state helpers #

theorem Cslib.DataStructure.CellProbe.le_of_forall_pos_le_add_mul {LB R : ENNReal} {M : ℕ} (h : ∀ {η : ENNReal}, 0 < η → LB ≤ R + η * ↑M) :
LB ≤ R

Eliminate arbitrary per-step truncation slack η > 0 in ℝ≥0∞: if LB ≤ R + η * M holds for every 0 < η, then LB ≤ R.

theorem Cslib.DataStructure.CellProbe.expectedProbesFrom_le_mul {Op : Type u_1} {Result : Op → Type} {cells w : ℕ} (Q : CellProbe.Randomized.Scheme Op Result cells w) (W : ENNReal) (hW : ∀ (o : Op) (m : CellProbe.Mem cells w), (Q.step o).expectedProbes m ≤ W) (ops : List Op) (m : CellProbe.Mem cells w) :
Q.expectedProbesFrom m ops ≤ ↑ops.length * W

If every single-operation tree of Q has expected probes at most W on every memory, then Q.expectedProbesFrom m ops ≤ ops.length * W on every memory m.

Construct a canonical zeroed-memory initial Data r_ds for a zero-parameter SubroutineCode B r_ds 0 from Fits w base alone.

theorem Cslib.DataStructure.CellProbe.mkInitData0_spec {B : WordRAM.Basis} {r_ds w base : ℕ} (P : WordRAM.SubroutineCode B r_ds 0) (params : Fin 0 → ℕ) (hfit_base : WordRAM.Fits w base) :
WordRAM.Data.Bounded w (mkInitData0 P base) ∧ (mkInitData0 P base).regs P.frontierReg = base ∧ (∀ (j : Fin 0), (mkInitData0 P base).regs (P.initParams j) = params j) ∧ ∀ (a : ℕ), (mkInitData0 P base).mem a = 0

1. Deterministic WordRAM.StateTransitionImpl → CellProbe.StateTransitionImpl #

noncomputable def Cslib.DataStructure.WordRAM.StateTransitionImpl.toCellProbeLayout {B : WordRAM.Basis} {r_ds k_init w base : ℕ} {P : WordRAM.SubroutineCode B r_ds k_init} {D : StateTransitionSpec} [(o : D.Op) → Inhabited (D.Result o)] {params : Fin k_init → ℕ} {s₀ : D.State} (C : StateTransitionImpl P D w base params s₀) {regCells wCell : ℕ} (L : CellProbe.RegLayout r_ds P.input base C.space w regCells wCell) {d₀ : WordRAM.Data r_ds} (hd₀ : WordRAM.Data.Bounded w d₀) (hfr : d₀.regs P.frontierReg = base) (hpar : ∀ (j : Fin k_init), d₀.regs (P.initParams j) = params j) :
(P_cp : CellProbe.Scheme D.Op D.Result (C.space + regCells) wCell) × { C_cp : CellProbe.StateTransitionImpl D P_cp s₀ // C_cp.initPotential = C.initPotential ∧ ∀ (s : D.State) (o : D.Op), C_cp.charge s o = C.charge s o + L.overhead }

Unified deterministic WordRAM.StateTransitionImpl → CellProbe.StateTransitionImpl simulation over an arbitrary RegLayout: uses rep_supported and potential_supported with zeroOutside so no extra read-footprint hypothesis is needed on C.

noncomputable def Cslib.DataStructure.WordRAM.StateTransitionImpl.toCellProbe {B : WordRAM.Basis} {r_ds k_init w base : ℕ} {P : WordRAM.SubroutineCode B r_ds k_init} {D : StateTransitionSpec} [(o : D.Op) → Inhabited (D.Result o)] {params : Fin k_init → ℕ} {s₀ : D.State} (C : StateTransitionImpl P D w base params s₀) {d₀ : WordRAM.Data r_ds} (hd₀ : WordRAM.Data.Bounded w d₀) (hfr : d₀.regs P.frontierReg = base) (hpar : ∀ (j : Fin k_init), d₀.regs (P.initParams j) = params j) :

Bridge 1 (Deterministic WordRAM.StateTransitionImpl.toCellProbe): Any deterministic WordRAM.StateTransitionImpl using C.space words and persistentRegCount P persistent registers induces a deterministic CellProbe.StateTransitionImpl on C.space + persistentRegCount P cells of width w with initPotential = C.initPotential and per-operation probe charge C.charge s o + 2 * persistentRegCount P (0 extra cells and 0 extra probes when ∀ i, P.input i = true).

noncomputable def Cslib.DataStructure.WordRAM.StateTransitionImpl.simInit {B : WordRAM.Basis} {r_ds k_init w base : ℕ} {P : WordRAM.SubroutineCode B r_ds k_init} {D : StateTransitionSpec} {params : Fin k_init → ℕ} {s₀ : D.State} (C : StateTransitionImpl P D w base params s₀) (d₀ : WordRAM.Data r_ds) :

Fresh-initializer cell-probe tree for (C.toCellProbe hd₀ hfr hpar).1: starting from zeroed cell memory fun _ => 0, simulates P.initFresh in at most C.initTime + persistentRegCount P cell probes and leaves (C.toCellProbe hd₀ hfr hpar).1.init in memory.

theorem Cslib.DataStructure.WordRAM.StateTransitionImpl.simInit_spec {B : WordRAM.Basis} {r_ds k_init w base : ℕ} {P : WordRAM.SubroutineCode B r_ds k_init} {D : StateTransitionSpec} [(o : D.Op) → Inhabited (D.Result o)] {params : Fin k_init → ℕ} {s₀ : D.State} (C : StateTransitionImpl P D w base params s₀) {d₀ : WordRAM.Data r_ds} (hd₀ : WordRAM.Data.Bounded w d₀) (hfr : d₀.regs P.frontierReg = base) (hpar : ∀ (j : Fin k_init), d₀.regs (P.initParams j) = params j) :
noncomputable def Cslib.DataStructure.WordRAM.StateTransitionImpl.toCellProbeWide {B : WordRAM.Basis} {r_ds k_init w base : ℕ} {P : WordRAM.SubroutineCode B r_ds k_init} {D : StateTransitionSpec} [(o : D.Op) → Inhabited (D.Result o)] {params : Fin k_init → ℕ} {s₀ : D.State} (C : StateTransitionImpl P D w base params s₀) {d₀ : WordRAM.Data r_ds} (hd₀ : WordRAM.Data.Bounded w d₀) (hfr : d₀.regs P.frontierReg = base) (hpar : ∀ (j : Fin k_init), d₀.regs (P.initParams j) = params j) :

Wide-Cell Deterministic Bridge (WordRAM.StateTransitionImpl.toCellProbeWide): Packs all persistentRegCount P persistent registers into 1 wide cell of width wideSubroutineWidth P w := max (persistentRegCount P) 1 * w over C.space + 1 cells, paying at most 2 additive probes per operation (0 when persistentRegCount P = 0) regardless of r_ds.

2. Flat (p_init, p_op) Las Vegas simulation and contrapositive lower-bound transfer #

def Cslib.DataStructure.CellProbe.prepareFlatRegs {Op : Type u_1} {r : ℕ} (input : Fin r → Bool) (encode : Op → Fin r → ℕ) (o : Op) (x : WordRAM.Data r) :

Load operation arguments encode o into input registers (input i = true), preserving persistent registers (input i = false) and all of x.mem.

theorem Cslib.DataStructure.CellProbe.unpack_pack_eq_prepareFlatRegs {Op : Type u_1} {r S regCells w wCell base : ℕ} {input : Fin r → Bool} (L : CellProbe.RegLayout r input base S w regCells wCell) (encode : Op → Fin r → ℕ) (o : Op) {x : WordRAM.Data r} (hx_bdd : WordRAM.Data.Bounded w x) (hx_out : ∀ a ∉ { base := base, length := S }.footprint, x.mem a = 0) :
L.unpack (encode o) (L.pack x) = prepareFlatRegs input encode o x
inductive Cslib.DataStructure.CellProbe.ExecFlatProgramOps {B : WordRAM.Basis} {r : ℕ} (D : StateTransitionSpec) {f : D.State → (o : D.Op) → D.State × D.Result o} [D.HasStepFn f] (Latent : Type z) (w base space : ℕ) (p_op : WordRAM.Program B r) (input : Fin r → Bool) (encode : D.Op → Fin r → ℕ) (decode : (o : D.Op) → ℕ → (Fin r → ℕ) → Option (D.Result o)) :
D.State → List D.Op → PMF (Latent × WordRAM.Data r) → PMF (Latent × WordRAM.Data r) → ENNReal → Prop

Multi-operation distributional execution of a flat WordRAM.Program B r over a deterministic state-transition specification D : StateTransitionSpec ([D.HasStepFn f]).

noncomputable def Cslib.DataStructure.CellProbe.flatStateDist {B : WordRAM.Basis} {r : ℕ} {Op : Type u_1} (w : ℕ) (p_op : WordRAM.Program B r) (input : Fin r → Bool) (encode : Op → Fin r → ℕ) :
PMF (WordRAM.Data r) → List Op → PMF (WordRAM.Data r)

Machine-state distribution PMF (Data r) obtained by folding the limiting halting law of p_op over ops from initial state distribution ρ. On any certified ExecFlatProgramOps history, every step halts with mass 1 and this coincides with the exact final Data r marginal (ExecFlatProgramOps.tighten_actualBodyTime); on uncertified steps whose halting mass is below 1 (e.g., an empty program []), a private fallback point mass keeps the transition total.

noncomputable def Cslib.DataStructure.CellProbe.flatExpectedBodyTime {B : WordRAM.Basis} {r : ℕ} {Op : Type u_1} (w : ℕ) (p_op : WordRAM.Program B r) (input : Fin r → Bool) (encode : Op → Fin r → ℕ) :
PMF (WordRAM.Data r) → List Op → ENNReal

Expected non-halt body-instruction count accumulated along flatStateDist when running flat program p_op on ops from initial state distribution ρ : PMF (Data r). On any certified ExecFlatProgramOps history, every step halts with mass 1 and this equals the exact intrinsic expected body-instruction count (expectedTime - 1 summed across the exact step marginals, independent of any caller-supplied time budget T, latent variable Latent, or proof witness; see ExecFlatProgramOps.tighten_actualBodyTime). On uncertified histories with halting mass below 1, subsequent steps advance through the private fallback point mass.

noncomputable def Cslib.DataStructure.CellProbe.flatExpectedTime {B : WordRAM.Basis} {r : ℕ} {Op : Type u_1} (w : ℕ) (p_op : WordRAM.Program B r) (input : Fin r → Bool) (encode : Op → Fin r → ℕ) :
PMF (WordRAM.Data r) → List Op → ENNReal

Expected total executed Word-RAM instruction count (including each operation's terminal halt step) accumulated along flatStateDist when running p_op on ops from ρ : PMF (Data r). Equals the exact total expected executed instruction count on certified ExecFlatProgramOps histories (flatExpectedTime_eq_add_length); on uncertified histories with halting mass below 1, subsequent steps advance through the private fallback point mass.

theorem Cslib.DataStructure.CellProbe.one_le_expectedTime {B : WordRAM.Basis} {r : ℕ} (w : ℕ) (p_op : WordRAM.Program B r) (x : WordRAM.Data r) :
1 ≤ WordRAM.expectedTime w p_op { pc := 0, data := x }

Running any WordRAM.Program from an active state ⟨0, x⟩ takes expected time at least 1.

theorem Cslib.DataStructure.CellProbe.flatExpectedTime_eq_add_length {B : WordRAM.Basis} {r : ℕ} {Op : Type u_1} (w : ℕ) (p_op : WordRAM.Program B r) (input : Fin r → Bool) (encode : Op → Fin r → ℕ) (ρ : PMF (WordRAM.Data r)) (ops : List Op) :
flatExpectedTime w p_op input encode ρ ops = flatExpectedBodyTime w p_op input encode ρ ops + ↑ops.length

Total expected executed instructions (flatExpectedTime, including each operation's terminal halt step) equal flatExpectedBodyTime + ops.length.

theorem Cslib.DataStructure.CellProbe.flatExpectedBodyTime_le_flatExpectedTime {B : WordRAM.Basis} {r : ℕ} {Op : Type u_1} (w : ℕ) (p_op : WordRAM.Program B r) (input : Fin r → Bool) (encode : Op → Fin r → ℕ) (ρ : PMF (WordRAM.Data r)) (ops : List Op) :
flatExpectedBodyTime w p_op input encode ρ ops ≤ flatExpectedTime w p_op input encode ρ ops

The non-halt body instruction expectation flatExpectedBodyTime never exceeds the total executed instruction expectation flatExpectedTime.

theorem Cslib.DataStructure.CellProbe.ExecFlatProgramOps.tighten_actualBodyTime {B : WordRAM.Basis} {r w base space : ℕ} {D : StateTransitionSpec} {f : D.State → (o : D.Op) → D.State × D.Result o} [D.HasStepFn f] {Latent : Type z} {p_op : WordRAM.Program B r} {input : Fin r → Bool} {encode : D.Op → Fin r → ℕ} {decode : (o : D.Op) → ℕ → (Fin r → ℕ) → Option (D.Result o)} {s : D.State} {ops : List D.Op} {ν ν_final : PMF (Latent × WordRAM.Data r)} {T_ops : ENNReal} (hex : ExecFlatProgramOps D Latent w base space p_op input encode decode s ops ν ν_final T_ops) :
ExecFlatProgramOps D Latent w base space p_op input encode decode s ops ν ν_final (flatExpectedBodyTime w p_op input encode (PMF.map Prod.snd ν) ops) ∧ flatExpectedBodyTime w p_op input encode (PMF.map Prod.snd ν) ops ≤ T_ops ∧ PMF.map Prod.snd ν_final = flatStateDist w p_op input encode (PMF.map Prod.snd ν) ops

Actual-time tightening bridge: any certified ExecFlatProgramOps derivation from ν to ν_final with admissible budget T_ops also witnesses ExecFlatProgramOps with the exact intrinsic expected non-halt body-instruction count flatExpectedBodyTime w p_op input encode (ν.map Prod.snd) ops (preserving the exact coupled initial/final distributions (ν, ν_final), intermediate transitions, and zero-error decode/framing correctness), dominates it (flatExpectedBodyTime ... ≤ T_ops), and evolves the Data r marginal along flatStateDist.

theorem Cslib.DataStructure.CellProbe.ExecFlatProgramOps.flatExpectedBodyTime_le {B : WordRAM.Basis} {r w base space : ℕ} {D : StateTransitionSpec} {f : D.State → (o : D.Op) → D.State × D.Result o} [D.HasStepFn f] {Latent : Type z} {p_op : WordRAM.Program B r} {input : Fin r → Bool} {encode : D.Op → Fin r → ℕ} {decode : (o : D.Op) → ℕ → (Fin r → ℕ) → Option (D.Result o)} {s : D.State} {ops : List D.Op} {ν ν_final : PMF (Latent × WordRAM.Data r)} {T_ops : ENNReal} (hex : ExecFlatProgramOps D Latent w base space p_op input encode decode s ops ν ν_final T_ops) :
flatExpectedBodyTime w p_op input encode (PMF.map Prod.snd ν) ops ≤ T_ops

Any admissible ExecFlatProgramOps budget T_ops dominates the exact expected body-instruction count flatExpectedBodyTime w p_op input encode (ν.map Prod.snd) ops.

theorem Cslib.DataStructure.CellProbe.exists_cellProbeLayout_of_flatPrograms {B : WordRAM.Basis} {r regCells wCell w base space : ℕ} {input : Fin r → Bool} {D : StateTransitionSpec} {f : D.State → (o : D.Op) → D.State × D.Result o} [D.HasStepFn f] [(o : D.Op) → Inhabited (D.Result o)] {Latent : Type z} (s₀ : D.State) (L : CellProbe.RegLayout r input base space w regCells wCell) (p_op : WordRAM.Program B r) (encode : D.Op → Fin r → ℕ) (decode : (o : D.Op) → ℕ → (Fin r → ℕ) → Option (D.Result o)) (ν₀ : PMF (Latent × WordRAM.Data r)) (hsupp₀ : ∀ p ∈ ν₀.support, WordRAM.Data.Bounded w p.2 ∧ ∀ a ∉ { base := base, length := space }.footprint, p.2.mem a = 0) (opsAlphabet : Finset D.Op) (M_corr : ℕ) {η : ENNReal} (hη : 0 < η) :
∃ (P_cp : CellProbe.Randomized.Scheme D.Op D.Result (space + regCells) wCell), ∀ (ops : List D.Op) {ν_final : PMF (Latent × WordRAM.Data r)} {T_ops : ENNReal}, D.ValidHistory s₀ ops → ops.length ≤ M_corr → (∀ o ∈ ops, o ∈ opsAlphabet) → T_ops ≠ ⊤ → ExecFlatProgramOps D Latent w base space p_op input encode decode s₀ ops ν₀ ν_final T_ops → (D.toObliviousSequenceSpec s₀).Contract ops (PMF.map Prod.fst (P_cp.runSeq ops)) ∧ P_cp.expectedSeqProbes ops ≤ T_ops + (↑L.overhead + η) * ↑ops.length

Uniform layout-parametric cell-probe simulation of a flat (ν₀, p_op) Las Vegas Word-RAM program pair: constructs a single P_cp outside ∀ ops that is 100% zero-error on all histories over opsAlphabet of length ≤ M_corr admitting a finite-time ExecFlatProgramOps derivation, with P_cp.expectedSeqProbes ops ≤ T_ops + (L.overhead + η) * ops.length.

theorem Cslib.DataStructure.CellProbe.exists_cellProbe_of_flatPrograms {B : WordRAM.Basis} {r w base space : ℕ} {input : Fin r → Bool} {D : StateTransitionSpec} {f : D.State → (o : D.Op) → D.State × D.Result o} [D.HasStepFn f] [(o : D.Op) → Inhabited (D.Result o)] {Latent : Type z} (s₀ : D.State) (p_op : WordRAM.Program B r) (encode : D.Op → Fin r → ℕ) (decode : (o : D.Op) → ℕ → (Fin r → ℕ) → Option (D.Result o)) (ν₀ : PMF (Latent × WordRAM.Data r)) (hsupp₀ : ∀ p ∈ ν₀.support, WordRAM.Data.Bounded w p.2 ∧ ∀ a ∉ { base := base, length := space }.footprint, p.2.mem a = 0) (opsAlphabet : Finset D.Op) (M_corr : ℕ) {η : ENNReal} (hη : 0 < η) :
∃ (P_cp : CellProbe.Randomized.Scheme D.Op D.Result (space + CellProbe.persCount input) w), ∀ (ops : List D.Op) {ν_final : PMF (Latent × WordRAM.Data r)} {T_ops : ENNReal}, D.ValidHistory s₀ ops → ops.length ≤ M_corr → (∀ o ∈ ops, o ∈ opsAlphabet) → T_ops ≠ ⊤ → ExecFlatProgramOps D Latent w base space p_op input encode decode s₀ ops ν₀ ν_final T_ops → (D.toObliviousSequenceSpec s₀).Contract ops (PMF.map Prod.fst (P_cp.runSeq ops)) ∧ P_cp.expectedSeqProbes ops ≤ T_ops + (↑(2 * CellProbe.persCount input) + η) * ↑ops.length

Standard w-bit cell-probe simulation of a flat (ν₀, p_op) Las Vegas Word-RAM program pair over space + persCount input cells (0 extra cells and 0 overhead when ∀ i, input i = true).

theorem Cslib.DataStructure.CellProbe.exists_cellProbeWide_of_flatPrograms {B : WordRAM.Basis} {r w base space : ℕ} {input : Fin r → Bool} {D : StateTransitionSpec} {f : D.State → (o : D.Op) → D.State × D.Result o} [D.HasStepFn f] [(o : D.Op) → Inhabited (D.Result o)] {Latent : Type z} (s₀ : D.State) (p_op : WordRAM.Program B r) (encode : D.Op → Fin r → ℕ) (decode : (o : D.Op) → ℕ → (Fin r → ℕ) → Option (D.Result o)) (ν₀ : PMF (Latent × WordRAM.Data r)) (hsupp₀ : ∀ p ∈ ν₀.support, WordRAM.Data.Bounded w p.2 ∧ ∀ a ∉ { base := base, length := space }.footprint, p.2.mem a = 0) (opsAlphabet : Finset D.Op) (M_corr : ℕ) {η : ENNReal} (hη : 0 < η) :
∃ (P_cp : CellProbe.Randomized.Scheme D.Op D.Result (space + 1) (CellProbe.wideWidth input w)), ∀ (ops : List D.Op) {ν_final : PMF (Latent × WordRAM.Data r)} {T_ops : ENNReal}, D.ValidHistory s₀ ops → ops.length ≤ M_corr → (∀ o ∈ ops, o ∈ opsAlphabet) → T_ops ≠ ⊤ → ExecFlatProgramOps D Latent w base space p_op input encode decode s₀ ops ν₀ ν_final T_ops → (D.toObliviousSequenceSpec s₀).Contract ops (PMF.map Prod.fst (P_cp.runSeq ops)) ∧ P_cp.expectedSeqProbes ops ≤ T_ops + (↑(if CellProbe.persCount input = 0 then 0 else 2) + η) * ↑ops.length

Wide-cell (space + 1 cells of width wideWidth input w) simulation of a flat (ν₀, p_op) Las Vegas Word-RAM program pair (≤ 2 additive probes per operation regardless of r).

theorem Cslib.DataStructure.CellProbe.flat_wordRAM_lower_bound_of_det_cellProbe {B : WordRAM.Basis} {r w base space S_max : ℕ} {input : Fin r → Bool} {D : StateTransitionSpec} {f : D.State → (o : D.Op) → D.State × D.Result o} [D.HasStepFn f] {Latent : Type z} (s₀ : D.State) (hspace : space + CellProbe.persCount input ≤ S_max) (p_op : WordRAM.Program B r) (encode : D.Op → Fin r → ℕ) (decode : (o : D.Op) → ℕ → (Fin r → ℕ) → Option (D.Result o)) (ν₀ : PMF (Latent × WordRAM.Data r)) (hsupp₀ : ∀ p ∈ ν₀.support, WordRAM.Data.Bounded w p.2 ∧ ∀ a ∉ { base := base, length := space }.footprint, p.2.mem a = 0) (opsAlphabet : Finset D.Op) (M_corr : ℕ) (correctSeqs : Set (List D.Op)) (hcorrectSeqs : ∀ ops ∈ correctSeqs, D.ValidHistory s₀ ops ∧ ops.length ≤ M_corr ∧ ∀ o ∈ ops, o ∈ opsAlphabet) (hex_corr : ∀ ops ∈ correctSeqs, ∃ (ν_final : PMF (Latent × WordRAM.Data r)) (T_ops : ENNReal), T_ops ≠ ⊤ ∧ ExecFlatProgramOps D Latent w base space p_op input encode decode s₀ ops ν₀ ν_final T_ops) (hardDist : PMF (List D.Op)) (hhardDist : ∀ ops ∈ hardDist.support, D.ValidHistory s₀ ops ∧ ops.length ≤ M_corr ∧ ∀ o ∈ ops, o ∈ opsAlphabet) (timeBound : List D.Op → ENNReal) (hex_hard : ∀ ops ∈ hardDist.support, ∃ (ν_final : PMF (Latent × WordRAM.Data r)), ∃ T_ops ≤ timeBound ops, T_ops ≠ ⊤ ∧ ExecFlatProgramOps D Latent w base space p_op input encode decode s₀ ops ν₀ ν_final T_ops) {LB : ENNReal} (hlb : ∀ (D_det : CellProbe.IndexedScheme D.Op D.Result S_max w), (∀ ops ∈ correctSeqs, (D_det.runSeq ops).1 = (D.run s₀ ops).2) → LB ≤ ∑' (ops : List D.Op), hardDist ops * ↑(D_det.seqProbes ops)) :
LB ≤ ∑' (ops : List D.Op), hardDist ops * (timeBound ops + ↑(2 * CellProbe.persCount input) * ↑ops.length)

Contrapositive Word-RAM lower-bound transfer for flat (ν₀, p_op) programs (standard w-bit cell layout over S_max ≥ space + persCount input cells, 0 η-loss, no [Fintype D.Op]).

theorem Cslib.DataStructure.CellProbe.flat_wordRAM_lower_bound_of_det_cellProbe_wide {B : WordRAM.Basis} {r w base space S_max : ℕ} {input : Fin r → Bool} {D : StateTransitionSpec} {f : D.State → (o : D.Op) → D.State × D.Result o} [D.HasStepFn f] {Latent : Type z} (s₀ : D.State) (hspace : space + 1 ≤ S_max) (p_op : WordRAM.Program B r) (encode : D.Op → Fin r → ℕ) (decode : (o : D.Op) → ℕ → (Fin r → ℕ) → Option (D.Result o)) (ν₀ : PMF (Latent × WordRAM.Data r)) (hsupp₀ : ∀ p ∈ ν₀.support, WordRAM.Data.Bounded w p.2 ∧ ∀ a ∉ { base := base, length := space }.footprint, p.2.mem a = 0) (opsAlphabet : Finset D.Op) (M_corr : ℕ) (correctSeqs : Set (List D.Op)) (hcorrectSeqs : ∀ ops ∈ correctSeqs, D.ValidHistory s₀ ops ∧ ops.length ≤ M_corr ∧ ∀ o ∈ ops, o ∈ opsAlphabet) (hex_corr : ∀ ops ∈ correctSeqs, ∃ (ν_final : PMF (Latent × WordRAM.Data r)) (T_ops : ENNReal), T_ops ≠ ⊤ ∧ ExecFlatProgramOps D Latent w base space p_op input encode decode s₀ ops ν₀ ν_final T_ops) (hardDist : PMF (List D.Op)) (hhardDist : ∀ ops ∈ hardDist.support, D.ValidHistory s₀ ops ∧ ops.length ≤ M_corr ∧ ∀ o ∈ ops, o ∈ opsAlphabet) (timeBound : List D.Op → ENNReal) (hex_hard : ∀ ops ∈ hardDist.support, ∃ (ν_final : PMF (Latent × WordRAM.Data r)), ∃ T_ops ≤ timeBound ops, T_ops ≠ ⊤ ∧ ExecFlatProgramOps D Latent w base space p_op input encode decode s₀ ops ν₀ ν_final T_ops) {LB : ENNReal} (hlb : ∀ (D_det : CellProbe.IndexedScheme D.Op D.Result S_max (CellProbe.wideWidth input w)), (∀ ops ∈ correctSeqs, (D_det.runSeq ops).1 = (D.run s₀ ops).2) → LB ≤ ∑' (ops : List D.Op), hardDist ops * ↑(D_det.seqProbes ops)) :
LB ≤ ∑' (ops : List D.Op), hardDist ops * (timeBound ops + ↑(if CellProbe.persCount input = 0 then 0 else 2) * ↑ops.length)

Wide-cell contrapositive Word-RAM lower-bound transfer for flat (ν₀, p_op) programs (S_max ≥ space + 1 cells of width wideWidth input w, ≤ 2 additive probes per operation regardless of r, 0 η-loss, no [Fintype D.Op]).

3. WordRAM.Randomized.StateTransitionImpl Las Vegas simulation and lower-bound transfer #

theorem Cslib.DataStructure.WordRAM.Randomized.StateTransitionImpl.ExecStepsOfFn.toExecFlatProgramOps {B : WordRAM.Basis} {r_ds k_init w base : ℕ} {P : WordRAM.SubroutineCode B r_ds k_init} {D : StateTransitionSpec} {f : D.State → (o : D.Op) → D.State × D.Result o} [D.HasStepFn f] {params : Fin k_init → ℕ} {s₀ : D.State} (C : StateTransitionImpl P D w base params s₀) {s : D.State} {ops : List D.Op} {ν ν_final : PMF (C.Seed × WordRAM.Data r_ds)} {T_ops : ENNReal} (hex : C.ExecStepsOfFn s ops ν ν_final T_ops) (hv : D.ValidHistory s ops) :
CellProbe.ExecFlatProgramOps D C.Seed w base C.space (P.code.program P.output) P.input C.encode (fun (o : D.Op) (x : ℕ) (regs : Fin r_ds → ℕ) => C.decode o regs) s ops ν ν_final T_ops

Compile a structured ExecStepsOfFn derivation on C to ExecFlatProgramOps on P.code.program P.output.

theorem Cslib.DataStructure.WordRAM.Randomized.StateTransitionImpl.exists_init_and_flat_steps {B : WordRAM.Basis} {r_ds k_init w base : ℕ} {P : WordRAM.SubroutineCode B r_ds k_init} {D : StateTransitionSpec} {f : D.State → (o : D.Op) → D.State × D.Result o} [D.HasStepFn f] {params : Fin k_init → ℕ} {s₀ : D.State} (C : StateTransitionImpl P D w base params s₀) {d₀ : WordRAM.Data r_ds} (hd₀ : WordRAM.Data.Bounded w d₀) (hfr : d₀.regs P.frontierReg = base) (hpar : ∀ (j : Fin k_init), d₀.regs (P.initParams j) = params j) :
∃ (ν₀ : PMF (C.Seed × WordRAM.Data r_ds)), (∀ p ∈ ν₀.support, WordRAM.Data.Bounded w p.2 ∧ ∀ a ∉ { base := base, length := C.space }.footprint, p.2.mem a = 0) ∧ ∀ (ops : List D.Op), D.ValidHistory s₀ ops → ∃ (ν_final : PMF (C.Seed × WordRAM.Data r_ds)), ∃ T_ops ≤ ↑C.initPotential + ↑(D.totalCost C.charge s₀ ops), T_ops ≠ ⊤ ∧ CellProbe.ExecFlatProgramOps D C.Seed w base C.space (P.code.program P.output) P.input C.encode (fun (o : D.Op) (x : ℕ) (regs : Fin r_ds → ℕ) => C.decode o regs) s₀ ops ν₀ ν_final T_ops

Initialize a WordRAM.Randomized.StateTransitionImpl from zeroed memory starting at d₀, returning the initial coupled distribution ν₀ and certified finite ExecFlatProgramOps executions bounded by C.initPotential + D.totalCost C.charge s₀ ops along every valid history ops.

theorem Cslib.DataStructure.WordRAM.Randomized.StateTransitionImpl.exists_cellProbe_lasVegas {B : WordRAM.Basis} {r_ds k_init w base : ℕ} {P : WordRAM.SubroutineCode B r_ds k_init} {D : StateTransitionSpec} {f : D.State → (o : D.Op) → D.State × D.Result o} [D.HasStepFn f] {params : Fin k_init → ℕ} {s₀ : D.State} [(o : D.Op) → Inhabited (D.Result o)] (C : StateTransitionImpl P D w base params s₀) {d₀ : WordRAM.Data r_ds} (hd₀ : WordRAM.Data.Bounded w d₀) (hfr : d₀.regs P.frontierReg = base) (hpar : ∀ (j : Fin k_init), d₀.regs (P.initParams j) = params j) (opsAlphabet : Finset D.Op) (M_corr : ℕ) {η : ENNReal} (hη : 0 < η) :
∃ (P_cp : CellProbe.Randomized.Scheme D.Op D.Result (C.space + CellProbe.persistentRegCount P) w), ∀ (ops : List D.Op), D.ValidHistory s₀ ops → ops.length ≤ M_corr → (∀ o ∈ ops, o ∈ opsAlphabet) → (D.toObliviousSequenceSpec s₀).Contract ops (PMF.map Prod.fst (P_cp.runSeq ops)) ∧ P_cp.expectedSeqProbes ops ≤ ↑C.initPotential + ↑(D.totalCost C.charge s₀ ops) + (↑(2 * CellProbe.persistentRegCount P) + η) * ↑ops.length

Bridge 3 (Las Vegas WordRAM.Randomized.StateTransitionImpl → CellProbe.Randomized.Scheme, standard w-bit layout): Uniformly over all admissible histories over opsAlphabet of length ≤ M_corr (without [Fintype D.Op]), buffered finite-horizon simulation produces a single P_cp on C.space + persistentRegCount P cells of width w preserving 100% zero-error transcript correctness with expected probes at most C.initPotential + D.totalCost C.charge s₀ ops + (2 * persistentRegCount P + η) * ops.length.

theorem Cslib.DataStructure.WordRAM.Randomized.StateTransitionImpl.exists_cellProbeWide_lasVegas {B : WordRAM.Basis} {r_ds k_init w base : ℕ} {P : WordRAM.SubroutineCode B r_ds k_init} {D : StateTransitionSpec} {f : D.State → (o : D.Op) → D.State × D.Result o} [D.HasStepFn f] {params : Fin k_init → ℕ} {s₀ : D.State} [(o : D.Op) → Inhabited (D.Result o)] (C : StateTransitionImpl P D w base params s₀) {d₀ : WordRAM.Data r_ds} (hd₀ : WordRAM.Data.Bounded w d₀) (hfr : d₀.regs P.frontierReg = base) (hpar : ∀ (j : Fin k_init), d₀.regs (P.initParams j) = params j) (opsAlphabet : Finset D.Op) (M_corr : ℕ) {η : ENNReal} (hη : 0 < η) :
∃ (P_cp : CellProbe.Randomized.Scheme D.Op D.Result (C.space + 1) (CellProbe.wideSubroutineWidth P w)), ∀ (ops : List D.Op), D.ValidHistory s₀ ops → ops.length ≤ M_corr → (∀ o ∈ ops, o ∈ opsAlphabet) → (D.toObliviousSequenceSpec s₀).Contract ops (PMF.map Prod.fst (P_cp.runSeq ops)) ∧ P_cp.expectedSeqProbes ops ≤ ↑C.initPotential + ↑(D.totalCost C.charge s₀ ops) + (↑(if CellProbe.persistentRegCount P = 0 then 0 else 2) + η) * ↑ops.length

Wide-Cell Las Vegas Bridge (exists_cellProbeWide_lasVegas): Packs all persistent registers into 1 cell of width wideSubroutineWidth P w over C.space + 1 cells, incurring at most 2 + η additive probes per operation regardless of r_ds.

theorem Cslib.DataStructure.CellProbe.wordRAM_lower_bound_of_det_cellProbe_lower_bound {B : WordRAM.Basis} {r_ds k_init w base S_max : ℕ} {P : WordRAM.SubroutineCode B r_ds k_init} {D : StateTransitionSpec} {f : D.State → (o : D.Op) → D.State × D.Result o} [D.HasStepFn f] {params : Fin k_init → ℕ} {s₀ : D.State} (C : WordRAM.Randomized.StateTransitionImpl P D w base params s₀) {d₀ : WordRAM.Data r_ds} (hd₀ : WordRAM.Data.Bounded w d₀) (hfr : d₀.regs P.frontierReg = base) (hpar : ∀ (j : Fin k_init), d₀.regs (P.initParams j) = params j) (hspace : C.space + CellProbe.persistentRegCount P ≤ S_max) (opsAlphabet : Finset D.Op) (M_corr : ℕ) (correctSeqs : Set (List D.Op)) (hcorrectSeqs : ∀ ops ∈ correctSeqs, D.ValidHistory s₀ ops ∧ ops.length ≤ M_corr ∧ ∀ o ∈ ops, o ∈ opsAlphabet) (hardDist : PMF (List D.Op)) (hhardDist : ∀ ops ∈ hardDist.support, D.ValidHistory s₀ ops ∧ ops.length ≤ M_corr ∧ ∀ o ∈ ops, o ∈ opsAlphabet) {LB : ENNReal} (hlb : ∀ (D_det : CellProbe.IndexedScheme D.Op D.Result S_max w), (∀ ops ∈ correctSeqs, (D_det.runSeq ops).1 = (D.run s₀ ops).2) → LB ≤ ∑' (ops : List D.Op), hardDist ops * ↑(D_det.seqProbes ops)) :
LB ≤ ↑C.initPotential + ∑' (ops : List D.Op), hardDist ops * (↑(D.totalCost C.charge s₀ ops) + ↑(2 * CellProbe.persistentRegCount P) * ↑ops.length)

Contrapositive Deterministic-Cell-Probe-to-Word-RAM Lower-Bound Transfer (wordRAM_lower_bound_of_det_cellProbe_lower_bound, standard w-bit layout): Any distributional probe lower bound LB proved against deterministic step-indexed IndexedScheme D.Op D.Result S_max ws that are zero-error on correctSeqs (histories of length ≤ M_corr over opsAlphabet, without [Fintype D.Op]) transfers to the certified potential-amortized resource budget (initPotential + E[totalCost charge + overhead · length]) of every zero-error WordRAM.Randomized.StateTransitionImpl against hardDist with C.space + persistentRegCount P ≤ S_max and zero η truncation loss (0 extra cells and 0 extra probes per operation when ∀ i, P.input i = true).

theorem Cslib.DataStructure.CellProbe.wordRAM_lower_bound_of_det_cellProbe_of_fintype {B : WordRAM.Basis} {r_ds k_init w base S_max : ℕ} {P : WordRAM.SubroutineCode B r_ds k_init} {D : StateTransitionSpec} [Finite D.Op] {f : D.State → (o : D.Op) → D.State × D.Result o} [D.HasStepFn f] {params : Fin k_init → ℕ} {s₀ : D.State} (C : WordRAM.Randomized.StateTransitionImpl P D w base params s₀) {d₀ : WordRAM.Data r_ds} (hd₀ : WordRAM.Data.Bounded w d₀) (hfr : d₀.regs P.frontierReg = base) (hpar : ∀ (j : Fin k_init), d₀.regs (P.initParams j) = params j) (hspace : C.space + CellProbe.persistentRegCount P ≤ S_max) (M_corr : ℕ) (correctSeqs : Set (List D.Op)) (hcorrectSeqs : ∀ ops ∈ correctSeqs, D.ValidHistory s₀ ops ∧ ops.length ≤ M_corr) (hardDist : PMF (List D.Op)) (hhardDist : ∀ ops ∈ hardDist.support, D.ValidHistory s₀ ops ∧ ops.length ≤ M_corr) {LB : ENNReal} (hlb : ∀ (D_det : CellProbe.IndexedScheme D.Op D.Result S_max w), (∀ ops ∈ correctSeqs, (D_det.runSeq ops).1 = (D.run s₀ ops).2) → LB ≤ ∑' (ops : List D.Op), hardDist ops * ↑(D_det.seqProbes ops)) :
LB ≤ ↑C.initPotential + ∑' (ops : List D.Op), hardDist ops * (↑(D.totalCost C.charge s₀ ops) + ↑(2 * CellProbe.persistentRegCount P) * ↑ops.length)

[Finite D.Op] convenience specialization of wordRAM_lower_bound_of_det_cellProbe_lower_bound, instantiating opsAlphabet := Finset.univ.

theorem Cslib.DataStructure.CellProbe.wordRAM_lower_bound_of_det_cellProbe_wide {B : WordRAM.Basis} {r_ds k_init w base S_max : ℕ} {P : WordRAM.SubroutineCode B r_ds k_init} {D : StateTransitionSpec} {f : D.State → (o : D.Op) → D.State × D.Result o} [D.HasStepFn f] {params : Fin k_init → ℕ} {s₀ : D.State} (C : WordRAM.Randomized.StateTransitionImpl P D w base params s₀) {d₀ : WordRAM.Data r_ds} (hd₀ : WordRAM.Data.Bounded w d₀) (hfr : d₀.regs P.frontierReg = base) (hpar : ∀ (j : Fin k_init), d₀.regs (P.initParams j) = params j) (hspace : C.space + 1 ≤ S_max) (opsAlphabet : Finset D.Op) (M_corr : ℕ) (correctSeqs : Set (List D.Op)) (hcorrectSeqs : ∀ ops ∈ correctSeqs, D.ValidHistory s₀ ops ∧ ops.length ≤ M_corr ∧ ∀ o ∈ ops, o ∈ opsAlphabet) (hardDist : PMF (List D.Op)) (hhardDist : ∀ ops ∈ hardDist.support, D.ValidHistory s₀ ops ∧ ops.length ≤ M_corr ∧ ∀ o ∈ ops, o ∈ opsAlphabet) {LB : ENNReal} (hlb : ∀ (D_det : CellProbe.IndexedScheme D.Op D.Result S_max (CellProbe.wideSubroutineWidth P w)), (∀ ops ∈ correctSeqs, (D_det.runSeq ops).1 = (D.run s₀ ops).2) → LB ≤ ∑' (ops : List D.Op), hardDist ops * ↑(D_det.seqProbes ops)) :
LB ≤ ↑C.initPotential + ∑' (ops : List D.Op), hardDist ops * (↑(D.totalCost C.charge s₀ ops) + 2 * ↑ops.length)

Wide-Cell Contrapositive Word-RAM Lower-Bound Transfer (wordRAM_lower_bound_of_det_cellProbe_wide): Transfers any deterministic step-indexed cell-probe lower bound at cell width wideSubroutineWidth P w := max (persistentRegCount P) 1 * w and space S_max ≥ C.space + 1 to the certified potential-amortized resource budget of any zero-error r_ds-register WordRAM.Randomized.StateTransitionImpl against hardDist with at most 2 additive probes per operation and zero η truncation loss.

theorem Cslib.DataStructure.CellProbe.wordRAM_lower_bound_of_det_cellProbe_wide_of_fintype {B : WordRAM.Basis} {r_ds k_init w base S_max : ℕ} {P : WordRAM.SubroutineCode B r_ds k_init} {D : StateTransitionSpec} [Finite D.Op] {f : D.State → (o : D.Op) → D.State × D.Result o} [D.HasStepFn f] {params : Fin k_init → ℕ} {s₀ : D.State} (C : WordRAM.Randomized.StateTransitionImpl P D w base params s₀) {d₀ : WordRAM.Data r_ds} (hd₀ : WordRAM.Data.Bounded w d₀) (hfr : d₀.regs P.frontierReg = base) (hpar : ∀ (j : Fin k_init), d₀.regs (P.initParams j) = params j) (hspace : C.space + 1 ≤ S_max) (M_corr : ℕ) (correctSeqs : Set (List D.Op)) (hcorrectSeqs : ∀ ops ∈ correctSeqs, D.ValidHistory s₀ ops ∧ ops.length ≤ M_corr) (hardDist : PMF (List D.Op)) (hhardDist : ∀ ops ∈ hardDist.support, D.ValidHistory s₀ ops ∧ ops.length ≤ M_corr) {LB : ENNReal} (hlb : ∀ (D_det : CellProbe.IndexedScheme D.Op D.Result S_max (CellProbe.wideSubroutineWidth P w)), (∀ ops ∈ correctSeqs, (D_det.runSeq ops).1 = (D.run s₀ ops).2) → LB ≤ ∑' (ops : List D.Op), hardDist ops * ↑(D_det.seqProbes ops)) :
LB ≤ ↑C.initPotential + ∑' (ops : List D.Op), hardDist ops * (↑(D.totalCost C.charge s₀ ops) + 2 * ↑ops.length)

[Finite D.Op] convenience specialization of wordRAM_lower_bound_of_det_cellProbe_wide.

4. WordRAM.Randomized.ObliviousSequenceImpl simulation and lower-bound transfer #

inductive Cslib.DataStructure.WordRAM.Randomized.ExecStepsRand {B : WordRAM.Basis} {r_ds k_init : ℕ} (P : WordRAM.SubroutineCode B r_ds k_init) (S : ObliviousSequenceSpec) (Latent : Type z) (w base space : ℕ) (encode : S.Op → Fin r_ds → ℕ) (decode : (o : S.Op) → (Fin r_ds → ℕ) → Option (S.Result o)) :
List S.Op → PMF (SeqOutcome Latent S.Result r_ds) → PMF (SeqOutcome Latent S.Result r_ds) → ENNReal → Prop

Finite-tree ExecRand step witness for an ObliviousSequenceImpl: strengthens ExecSteps by witnessing a finite ProbComp (Data r_ds × ℕ) computation mc t (ExecRand) on each step rather than an unbounded ExecCodeDist loop, enabling exact zero-slack RandProbeTree simulation on arbitrary (including Monte Carlo) ObliviousSequenceSpecs.

theorem Cslib.DataStructure.WordRAM.Randomized.ExecStepsRand.toExecSteps {B : WordRAM.Basis} {r_ds k_init : ℕ} {P : WordRAM.SubroutineCode B r_ds k_init} {S : ObliviousSequenceSpec} {Latent : Type z} {w base space : ℕ} {encode : S.Op → Fin r_ds → ℕ} {decode : (o : S.Op) → (Fin r_ds → ℕ) → Option (S.Result o)} {ops : List S.Op} {ν ν_final : PMF (SeqOutcome Latent S.Result r_ds)} {T_ops : ENNReal} (h : ExecStepsRand P S Latent w base space encode decode ops ν ν_final T_ops) :
ExecSteps P S Latent w base space encode decode ops ν ν_final T_ops

Every finite-tree ExecStepsRand trace embeds directly into ExecSteps via ExecCodeDist.of_execRand.

def Cslib.DataStructure.WordRAM.Randomized.ObliviousSequenceImpl.HasFiniteExecRand {B : WordRAM.Basis} {r_ds k_init w base : ℕ} {P : WordRAM.SubroutineCode B r_ds k_init} {S : ObliviousSequenceSpec} {params : Fin k_init → ℕ} (C : ObliviousSequenceImpl P S w base params) :

Predicate asserting that every admissible sequence on C : ObliviousSequenceImpl executes via finite ExecRand computation trees (ExecStepsRand).

theorem Cslib.DataStructure.WordRAM.Randomized.ObliviousSequenceImpl.exists_cellProbe_of_execRand {B : WordRAM.Basis} {r_ds k_init w base : ℕ} {P : WordRAM.SubroutineCode B r_ds k_init} {S : ObliviousSequenceSpec} [(o : S.Op) → Inhabited (S.Result o)] {params : Fin k_init → ℕ} (C : ObliviousSequenceImpl P S w base params) {d₀ : WordRAM.Data r_ds} (hd₀ : WordRAM.Data.Bounded w d₀) (hfr : d₀.regs P.frontierReg = base) (hpar : ∀ (j : Fin k_init), d₀.regs (P.initParams j) = params j) (hfin : C.HasFiniteExecRand) :

Bridge 2 (ObliviousSequenceImpl.exists_cellProbe_of_execRand, exact finite-tree simulation): When C : ObliviousSequenceImpl satisfies C.HasFiniteExecRand, C induces a CellProbe.Randomized.ObliviousSequenceImpl on C.space + persistentRegCount P cells of width w reproducing the exact transcript distribution (S.Contract ops holds on arbitrary — including Monte Carlo — ObliviousSequenceSpecs with 0 error distortion and 0 η-loss) and per-operation probe charge C.charge o + 2 * persistentRegCount P.

theorem Cslib.DataStructure.WordRAM.Randomized.ObliviousSequenceImpl.exists_cellProbeLayout_lasVegas {B : WordRAM.Basis} {r_ds k_init regCells wCell w base : ℕ} {P : WordRAM.SubroutineCode B r_ds k_init} {D : StateTransitionSpec} [(o : D.Op) → Inhabited (D.Result o)] {params : Fin k_init → ℕ} {s₀ : D.State} (C : ObliviousSequenceImpl P (D.toObliviousSequenceSpec s₀) w base params) (L : CellProbe.RegLayout r_ds P.input base C.space w regCells wCell) {d₀ : WordRAM.Data r_ds} (hd₀ : WordRAM.Data.Bounded w d₀) (hfr : d₀.regs P.frontierReg = base) (hpar : ∀ (j : Fin k_init), d₀.regs (P.initParams j) = params j) (opsAlphabet : Finset D.Op) (M_corr : ℕ) {η : ENNReal} (hη : 0 < η) :
∃ (P_cp : CellProbe.Randomized.Scheme D.Op D.Result (C.space + regCells) wCell), ∀ (ops : List D.Op), D.ValidOpSeq s₀ ops → ops.length ≤ M_corr → (∀ o ∈ ops, o ∈ opsAlphabet) → (D.toObliviousSequenceSpec s₀).Contract ops (PMF.map Prod.fst (P_cp.runSeq ops)) ∧ P_cp.expectedSeqProbes ops ≤ ↑C.initPotential + ↑(List.map C.charge ops).sum + (↑L.overhead + η) * ↑ops.length

Layout-parametric buffered Las Vegas simulation of any ObliviousSequenceImpl over D.toObliviousSequenceSpec s₀ (even for nondeterministic relational D, without [D.HasStepFn f] or [Fintype D.Op]).

theorem Cslib.DataStructure.WordRAM.Randomized.ObliviousSequenceImpl.exists_cellProbe_lasVegas {B : WordRAM.Basis} {r_ds k_init w base : ℕ} {P : WordRAM.SubroutineCode B r_ds k_init} {D : StateTransitionSpec} [(o : D.Op) → Inhabited (D.Result o)] {params : Fin k_init → ℕ} {s₀ : D.State} (C : ObliviousSequenceImpl P (D.toObliviousSequenceSpec s₀) w base params) {d₀ : WordRAM.Data r_ds} (hd₀ : WordRAM.Data.Bounded w d₀) (hfr : d₀.regs P.frontierReg = base) (hpar : ∀ (j : Fin k_init), d₀.regs (P.initParams j) = params j) (opsAlphabet : Finset D.Op) (M_corr : ℕ) {η : ENNReal} (hη : 0 < η) :
∃ (P_cp : CellProbe.Randomized.Scheme D.Op D.Result (C.space + CellProbe.persistentRegCount P) w), ∀ (ops : List D.Op), D.ValidOpSeq s₀ ops → ops.length ≤ M_corr → (∀ o ∈ ops, o ∈ opsAlphabet) → (D.toObliviousSequenceSpec s₀).Contract ops (PMF.map Prod.fst (P_cp.runSeq ops)) ∧ P_cp.expectedSeqProbes ops ≤ ↑C.initPotential + ↑(List.map C.charge ops).sum + (↑(2 * CellProbe.persistentRegCount P) + η) * ↑ops.length

Standard w-bit Las Vegas simulation of any zero-error ObliviousSequenceImpl over D.toObliviousSequenceSpec s₀.

theorem Cslib.DataStructure.CellProbe.oblivious_wordRAM_lower_bound_of_det_cellProbe {B : WordRAM.Basis} {r_ds k_init w base S_max : ℕ} {P : WordRAM.SubroutineCode B r_ds k_init} {D : StateTransitionSpec} {f : D.State → (o : D.Op) → D.State × D.Result o} [D.HasStepFn f] {params : Fin k_init → ℕ} {s₀ : D.State} (C : WordRAM.Randomized.ObliviousSequenceImpl P (D.toObliviousSequenceSpec s₀) w base params) {d₀ : WordRAM.Data r_ds} (hd₀ : WordRAM.Data.Bounded w d₀) (hfr : d₀.regs P.frontierReg = base) (hpar : ∀ (j : Fin k_init), d₀.regs (P.initParams j) = params j) (hspace : C.space + CellProbe.persistentRegCount P ≤ S_max) (opsAlphabet : Finset D.Op) (M_corr : ℕ) (correctSeqs : Set (List D.Op)) (hcorrectSeqs : ∀ ops ∈ correctSeqs, D.ValidHistory s₀ ops ∧ ops.length ≤ M_corr ∧ ∀ o ∈ ops, o ∈ opsAlphabet) (hardDist : PMF (List D.Op)) (hhardDist : ∀ ops ∈ hardDist.support, D.ValidHistory s₀ ops ∧ ops.length ≤ M_corr ∧ ∀ o ∈ ops, o ∈ opsAlphabet) {LB : ENNReal} (hlb : ∀ (D_det : CellProbe.IndexedScheme D.Op D.Result S_max w), (∀ ops ∈ correctSeqs, (D_det.runSeq ops).1 = (D.run s₀ ops).2) → LB ≤ ∑' (ops : List D.Op), hardDist ops * ↑(D_det.seqProbes ops)) :
LB ≤ ↑C.initPotential + ∑' (ops : List D.Op), hardDist ops * (↑(List.map C.charge ops).sum + ↑(2 * CellProbe.persistentRegCount P) * ↑ops.length)

Contrapositive Word-RAM lower-bound transfer for certified resource budgets of zero-error ObliviousSequenceImpls (standard w-bit layout, 0 η-loss, no [Fintype D.Op]).

theorem Cslib.DataStructure.CellProbe.oblivious_wordRAM_lower_bound_of_det_cellProbe_wide {B : WordRAM.Basis} {r_ds k_init w base S_max : ℕ} {P : WordRAM.SubroutineCode B r_ds k_init} {D : StateTransitionSpec} {f : D.State → (o : D.Op) → D.State × D.Result o} [D.HasStepFn f] {params : Fin k_init → ℕ} {s₀ : D.State} (C : WordRAM.Randomized.ObliviousSequenceImpl P (D.toObliviousSequenceSpec s₀) w base params) {d₀ : WordRAM.Data r_ds} (hd₀ : WordRAM.Data.Bounded w d₀) (hfr : d₀.regs P.frontierReg = base) (hpar : ∀ (j : Fin k_init), d₀.regs (P.initParams j) = params j) (hspace : C.space + 1 ≤ S_max) (opsAlphabet : Finset D.Op) (M_corr : ℕ) (correctSeqs : Set (List D.Op)) (hcorrectSeqs : ∀ ops ∈ correctSeqs, D.ValidHistory s₀ ops ∧ ops.length ≤ M_corr ∧ ∀ o ∈ ops, o ∈ opsAlphabet) (hardDist : PMF (List D.Op)) (hhardDist : ∀ ops ∈ hardDist.support, D.ValidHistory s₀ ops ∧ ops.length ≤ M_corr ∧ ∀ o ∈ ops, o ∈ opsAlphabet) {LB : ENNReal} (hlb : ∀ (D_det : CellProbe.IndexedScheme D.Op D.Result S_max (CellProbe.wideSubroutineWidth P w)), (∀ ops ∈ correctSeqs, (D_det.runSeq ops).1 = (D.run s₀ ops).2) → LB ≤ ∑' (ops : List D.Op), hardDist ops * ↑(D_det.seqProbes ops)) :
LB ≤ ↑C.initPotential + ∑' (ops : List D.Op), hardDist ops * (↑(List.map C.charge ops).sum + 2 * ↑ops.length)

Wide-cell contrapositive Word-RAM lower-bound transfer for certified resource budgets of zero-error ObliviousSequenceImpls (S_max ≥ C.space + 1 cells of width wideSubroutineWidth P w, at most 2 additive probes per operation regardless of r_ds, 0 η-loss, no [Fintype D.Op]).