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):
- Deterministic
WordRAM.StateTransitionImpl(toCellProbe,toCellProbeWide,simInit): Usesrep_supportedandpotential_supportedwithzeroOutsideso no extra read-footprint hypothesis is required onWordRAM.StateTransitionImpl; pre-operation initialization is packed intoScheme.initat0operation probes, andsimInit(in standardw-bit layout) additionally simulatesP.initFreshfrom zeroed cell memory in at mostC.initTime + persistentRegCount Pprobes. - 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 flatp_op : WordRAM.Program B rwithout wrappingSubroutineCode. - 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 overopsAlphabetup toM_corr(without[Fintype D.Op]), and takingη → 0eliminates truncation slack completely from the contrapositive Word-RAM lower bound. - 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-treeExecRandon arbitraryObliviousSequenceSpecs (including Monte Carlo contracts), standard-layout buffered zero-error simulation, and both standard- and wide-layout contrapositive lower-bound transfers onD.toObliviousSequenceSpec s₀.
Main definitions #
Cslib.DataStructure.WordRAM.StateTransitionImpl.toCellProbe,Cslib.DataStructure.WordRAM.StateTransitionImpl.toCellProbeWide,Cslib.DataStructure.WordRAM.StateTransitionImpl.simInit: deterministicStateTransitionImplsimulation bridges and fresh-initializer probe tree.Cslib.DataStructure.CellProbe.prepareFlatRegs,Cslib.DataStructure.CellProbe.ExecFlatProgramOps,Cslib.DataStructure.CellProbe.flatStateDist,Cslib.DataStructure.CellProbe.flatExpectedBodyTime,Cslib.DataStructure.CellProbe.flatExpectedTime: flat(ν₀, p_op)multi-operation Las Vegas execution contract, plus boundary state distribution and intrinsic expected running times on certifiedExecFlatProgramOpshistories.Cslib.DataStructure.WordRAM.Randomized.ExecStepsRand,Cslib.DataStructure.WordRAM.Randomized.ObliviousSequenceImpl.HasFiniteExecRand: finite-treeExecRandstep witness for exact zero-slack oblivious-sequence simulation.
Main results #
Cslib.DataStructure.CellProbe.ExecFlatProgramOps.tighten_actualBodyTime,Cslib.DataStructure.CellProbe.flatExpectedTime_eq_add_length: checked actual-time tightening bridge showing every certifiedExecFlatProgramOpsadmits the exact intrinsic expected non-haltbody instruction countflatExpectedBodyTime(≤ T_ops), preserving coupled distributions and correctness.Cslib.DataStructure.CellProbe.exists_cellProbe_of_flatPrograms,Cslib.DataStructure.CellProbe.exists_cellProbeWide_of_flatPrograms,Cslib.DataStructure.CellProbe.flat_wordRAM_lower_bound_of_det_cellProbe,Cslib.DataStructure.CellProbe.flat_wordRAM_lower_bound_of_det_cellProbe_wide: flat-program simulation and contrapositive lower-bound transfer.Cslib.DataStructure.WordRAM.Randomized.StateTransitionImpl.exists_cellProbe_lasVegas,Cslib.DataStructure.WordRAM.Randomized.StateTransitionImpl.exists_cellProbeWide_lasVegas,Cslib.DataStructure.CellProbe.wordRAM_lower_bound_of_det_cellProbe_lower_bound,Cslib.DataStructure.CellProbe.wordRAM_lower_bound_of_det_cellProbe_wide: Las VegasStateTransitionImplsimulation andη-free contrapositive Word-RAM lower-bound transfer over an explicitopsAlphabet : Finset D.Op(plus_of_fintypecorollaries).Cslib.DataStructure.WordRAM.Randomized.ObliviousSequenceImpl.exists_cellProbe_of_execRand,Cslib.DataStructure.WordRAM.Randomized.ObliviousSequenceImpl.exists_cellProbe_lasVegas,Cslib.DataStructure.CellProbe.oblivious_wordRAM_lower_bound_of_det_cellProbe,Cslib.DataStructure.CellProbe.oblivious_wordRAM_lower_bound_of_det_cellProbe_wide:ObliviousSequenceImplsimulation and contrapositive lower-bound transfer.
References #
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.
1. Deterministic WordRAM.StateTransitionImpl → CellProbe.StateTransitionImpl #
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.
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).
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.
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 #
Load operation arguments encode o into input registers (input i = true), preserving
persistent registers (input i = false) and all of x.mem.
Multi-operation distributional execution of a flat WordRAM.Program B r over a deterministic
state-transition specification D : StateTransitionSpec ([D.HasStepFn f]).
- nil {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)} (s : D.State) (ν : PMF (Latent × WordRAM.Data r)) : ExecFlatProgramOps D Latent w base space p_op input encode decode s [] ν ν 0
- cons {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)} {s : D.State} {o : D.Op} {ops : List D.Op} {ν ν_final : PMF (Latent × WordRAM.Data r)} {μ_step : Latent × WordRAM.Data r → PMF (Latent × ℕ × WordRAM.Data r)} {T_step : Latent × WordRAM.Data r → ENNReal} {T_rest : ENNReal} : (∀ p ∈ ν.support, (∀ (i : Fin r), input i = true → WordRAM.Fits w (encode o i)) ∧ CellProbe.ExecProgramDist w p_op (prepareFlatRegs input encode o p.2) (PMF.map Prod.snd (μ_step p)) (T_step p + 1) ∧ ∀ (ℓ : Latent) (outVal : ℕ) (y : WordRAM.Data r), (ℓ, outVal, y) ∈ (μ_step p).support → WordRAM.Data.Bounded w y ∧ decode o outVal y.regs = some (D.stepFn s o).2 ∧ WordRAM.Modifies { base := base, length := space }.footprint p.2.mem y.mem) → ExecFlatProgramOps D Latent w base space p_op input encode decode (D.stepFn s o).1 ops (ν.bind fun (p : Latent × WordRAM.Data r) => PMF.map (fun (x : Latent × ℕ × WordRAM.Data r) => match x with | (ℓ, fst, y) => (ℓ, y)) (μ_step p)) ν_final T_rest → ExecFlatProgramOps D Latent w base space p_op input encode decode s (o :: ops) ν ν_final (∑' (p : Latent × WordRAM.Data r), ν p * T_step p + T_rest)
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.
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.
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.
Running any WordRAM.Program from an active state ⟨0, x⟩ takes expected time at least 1.
Total expected executed instructions (flatExpectedTime, including each operation's terminal
halt step) equal flatExpectedBodyTime + ops.length.
The non-halt body instruction expectation flatExpectedBodyTime never exceeds the total
executed instruction expectation flatExpectedTime.
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.
Any admissible ExecFlatProgramOps budget T_ops dominates the exact expected body-instruction
count flatExpectedBodyTime w p_op input encode (ν.map Prod.snd) ops.
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.
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).
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).
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]).
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 #
Compile a structured ExecStepsOfFn derivation on C to ExecFlatProgramOps on
P.code.program P.output.
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.
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.
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.
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).
[Finite D.Op] convenience specialization of
wordRAM_lower_bound_of_det_cellProbe_lower_bound, instantiating opsAlphabet := Finset.univ.
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.
[Finite D.Op] convenience specialization of wordRAM_lower_bound_of_det_cellProbe_wide.
4. WordRAM.Randomized.ObliviousSequenceImpl simulation and lower-bound transfer #
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.
- nil {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)} (ν : PMF (SeqOutcome Latent S.Result r_ds)) : ExecStepsRand P S Latent w base space encode decode [] ν ν 0
- cons {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)} {o : S.Op} {ops : List S.Op} {ν ν_final : PMF (SeqOutcome Latent S.Result r_ds)} {mc : SeqOutcome Latent S.Result r_ds → ProbComp (WordRAM.Data r_ds × ℕ)} {μ_step : SeqOutcome Latent S.Result r_ds → PMF (StepOutcome Latent (S.Result o) r_ds)} {T_rest : ENNReal} : (∀ t ∈ ν.support, WordRAM.Data.Bounded w t.data ∧ (∀ (i : Fin r_ds), P.input i = true → WordRAM.Fits w (encode o i)) ∧ WordRAM.ExecRand w P.code (P.prepare encode o t.data) (mc t) ∧ PMF.map Prod.fst (mc t).eval = PMF.map StepOutcome.data (μ_step t) ∧ ∀ q ∈ (μ_step t).support, WordRAM.Data.Bounded w q.data ∧ decode o q.data.regs = some q.result ∧ WordRAM.Modifies { base := base, length := space }.footprint t.data.mem q.data.mem) → ExecStepsRand P S Latent w base space encode decode ops (ν.bind fun (t : SeqOutcome Latent S.Result r_ds) => PMF.map (t.appendStep o) (μ_step t)) ν_final T_rest → ExecStepsRand P S Latent w base space encode decode (o :: ops) ν ν_final ((∑' (t : SeqOutcome Latent S.Result r_ds), ν t * (mc t).expect fun (z : WordRAM.Data r_ds × ℕ) => ↑z.2) + T_rest)
Every finite-tree ExecStepsRand trace embeds directly into ExecSteps via
ExecCodeDist.of_execRand.
Predicate asserting that every admissible sequence on C : ObliviousSequenceImpl executes via
finite ExecRand computation trees (ExecStepsRand).
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.
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]).
Standard w-bit Las Vegas simulation of any zero-error ObliviousSequenceImpl over
D.toObliviousSequenceSpec s₀.
Contrapositive Word-RAM lower-bound transfer for certified resource budgets of zero-error
ObliviousSequenceImpls (standard w-bit layout, 0 η-loss, no [Fintype D.Op]).
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]).