Randomized Cell-Probe State-Transition Implementations #
This file extends Cslib.DataStructure.CellProbe.StateTransitionImpl to randomized cell-probe
schemes (Cslib.CellProbe.Randomized.Scheme; deterministic cell-probe model from [Mil99],
§1.2, internal-coin randomized trees) implementing relational state-transition
specifications (Cslib.DataStructure.StateTransitionSpec, [CLRS09], Section 17.3;
[MU17], Sections 2.1 and 2.3).
A Cslib.DataStructure.CellProbe.Randomized.StateTransitionImpl D P s₀ couples cell-probe
execution with a latent seed type Seed : Type, a reference distribution seedLaw : PMF Seed up to
density factor seedSlack : ℝ≥0∞, a seed-coupled invariant rep, and an addition-only ℝ≥0∞
amortized-in-expectation probe inequality:
- Both initial-memory randomness (
P.init : PMF (Mem cells w)) and per-operation internal coin flips (P.step o : RandProbeTree cells w (D.Result o)) are supported; CoupledOutcomecarries the returnedresultexplicitly so that the step marginal equation((P.step o).run t.mem).map Prod.fst = (μ_step t).map CoupledOutcome.resultMemholds directly withoutClassical.choice;singleState : Prop(defaultFalsefor general relational specifications;TrueinofFnfor deterministic specifications[D.HasStepFn f]) prevents adaptive correlation between the abstract state and latent seed when needed by oblivious-adversary structures.
Main definitions #
Cslib.DataStructure.CellProbe.Randomized.CoupledState,Cslib.DataStructure.CellProbe.Randomized.CoupledOutcome,Cslib.DataStructure.CellProbe.Randomized.CoupledOutcome.toCoupledState,Cslib.DataStructure.CellProbe.Randomized.CoupledOutcome.resultMem,Cslib.DataStructure.CellProbe.Randomized.TraceState: named state, step-outcome, and transcript bundles for coupled distributional analysis.Cslib.DataStructure.CellProbe.Randomized.StateTransitionImpl: certified randomized cell-probe implementation ofD : StateTransitionSpecfrom initial states₀.Cslib.DataStructure.CellProbe.Randomized.StateTransitionImpl.ofFn: constructor for deterministic specifications ([D.HasStepFn f]).Cslib.DataStructure.CellProbe.Randomized.StateTransitionImpl.padCells: cell-space monotonicity (cells ≤ cells') viaCslib.CellProbe.Randomized.Scheme.padCells.Cslib.DataStructure.CellProbe.StateTransitionImpl.toRandomized: canonical embedding of any deterministicCellProbe.StateTransitionImplintoRandomized.StateTransitionImpl.
Main results #
Cslib.CellProbe.Randomized.Scheme.runFrom_cons_fst,Cslib.CellProbe.Randomized.Scheme.runFrom_append_fst,Cslib.CellProbe.Randomized.Scheme.expectedProbesFrom_cons,Cslib.CellProbe.Randomized.Scheme.expectedProbesFrom_append: structural decomposition ofRandomized.Scheme.runFromandexpectedProbesFrom.Cslib.DataStructure.CellProbe.Randomized.StateTransitionImpl.seq_expected_amortized: multi-operation coupled transcript and expected-amortized probe telescope over any demonically admissible sequenceD.ValidOpSeq s₀ ops.Cslib.DataStructure.CellProbe.Randomized.StateTransitionImpl.contract_runSeq: zero-error transcript correctness(D.toObliviousSequenceSpec s₀).Contract ops ((P.runSeq ops).map Prod.fst)onD.ValidOpSeq s₀ ops.Cslib.DataStructure.CellProbe.Randomized.StateTransitionImpl.expectedSeqProbes_le_of_opCharge: expected sequence probe bound under a state-independent operation charge boundopCharge.Cslib.DataStructure.CellProbe.Randomized.StateTransitionImpl.seq_expected_amortized_ofFn,Cslib.DataStructure.CellProbe.Randomized.StateTransitionImpl.expectedSeqProbes_le_ofFn: specialization to deterministic specifications ([D.HasStepFn f]), certifying exact concentration on(D.run s₀ ops).2andP.expectedSeqProbes ops ≤ C.initPotential + D.totalCost C.charge s₀ ops.
References #
- P. B. Miltersen, Cell Probe Complexity — a Survey, §1.2
- T. H. Cormen, C. E. Leiserson, R. L. Rivest and C. Stein, Introduction to Algorithms, Section 17.3
- M. Mitzenmacher and E. Upfal, Probability and Computing: Randomization and Probabilistic Techniques in Algorithms and Data Analysis, Sections 2.1 and 2.3
Coupled state, step-outcome, and transcript bundles #
Coupled latent seed, abstract specification state, and concrete cell-probe memory Mem cells w
for relational randomized cell-probe analysis.
- seed : Seed
Latent random seed.
- state : State
Abstract specification state.
- mem : CellProbe.Mem cells w
Concrete cell-probe memory (
cellswords ofwbits).
Coupled post-step outcome pairing the updated latent seed, abstract post-state, post-memory, and
returned observation. Carrying result explicitly makes the marginal equation
((P.step o).run t.mem).map Prod.fst = (μ_step t).map CoupledOutcome.resultMem syntactic without
Classical.choice.
- seed : Seed
Updated latent random seed.
- state : State
Updated abstract specification state.
- mem : CellProbe.Mem cells w
Updated concrete cell-probe memory.
- result : Result
Observation returned by the operation.
Forget result to obtain the post-step CoupledState.
Extract (q.result, q.mem) for comparison against ((P.step o).run m).map Prod.fst.
Coupled state augmented with an accumulated relational transcript D.Transcript.
- seed : Seed
Current latent random seed.
- state : D.State
Current abstract specification state.
- mem : CellProbe.Mem cells w
Current concrete cell-probe memory.
- trace : D.Transcript
Accumulated relational execution transcript from
s₀.
Randomized cell-probe StateTransitionImpl #
Certified randomized cell-probe implementation of a relational D : StateTransitionSpec from
initial state s₀ over P : Cslib.CellProbe.Randomized.Scheme D.Op D.Result cells w.
- Seed : Type
Latent random seed type (
Unitwhen no persistent seed is needed). Reference distribution over latent seeds.
- seedSlack : ENNReal
Marginal density slack factor (
1when the seed marginal is exact). Finiteness of
seedSlack.- initPotential : ℕ
Upper bound on initial concrete potential (
0when unamortized). Amortized expected probe charge per operation.
Seed-indexed representation invariant linking
Seed,D.State, andMem cells w.Seed-indexed nonnegative integer potential (
0when worst-case / unamortized).- singleState : Prop
Whether
step_execrequires the pre-state distributionνto concentrate on a single abstract state (Falseby default;TrueinStateTransitionImpl.ofFn). - init_exec : ∃ (ν₀ : PMF (self.Seed × CellProbe.Mem cells w)), PMF.map Prod.snd ν₀ = P.init ∧ (∀ (θ : self.Seed), (PMF.map Prod.fst ν₀) θ ≤ self.seedSlack * self.seedLaw θ) ∧ ∀ p ∈ ν₀.support, self.rep p.1 s₀ p.2 ∧ self.potential p.1 p.2 ≤ self.initPotential
Coupled initialization distribution witnessing
P.init, seed-marginal control,rep, andpotential ≤ initPotentialats₀. - step_exec (o : D.Op) (ν : PMF (CoupledState self.Seed D.State cells w)) : (self.singleState → ∃ (s : D.State), ∀ t ∈ ν.support, t.state = s) → (∀ (θ : self.Seed), (PMF.map CoupledState.seed ν) θ ≤ self.seedSlack * self.seedLaw θ) → (∀ t ∈ ν.support, D.valid t.state o ∧ self.rep t.seed t.state t.mem) → ∃ (μ_step : CoupledState self.Seed D.State cells w → PMF (CoupledOutcome self.Seed D.State (D.Result o) cells w)), (∀ t ∈ ν.support, PMF.map Prod.fst ((P.step o).run t.mem) = PMF.map CoupledOutcome.resultMem (μ_step t) ∧ ∀ q ∈ (μ_step t).support, D.step t.state o q.state q.result ∧ self.rep q.seed q.state q.mem) ∧ (∀ (θ' : self.Seed), (PMF.map CoupledOutcome.seed (ν.bind μ_step)) θ' ≤ self.seedSlack * self.seedLaw θ') ∧ (self.singleState → ∃ (s' : D.State), ∀ q ∈ (ν.bind μ_step).support, q.state = s') ∧ ∑' (t : CoupledState self.Seed D.State cells w), ν t * ((P.step o).expectedProbes t.mem + ∑' (q : CoupledOutcome self.Seed D.State (D.Result o) cells w), (μ_step t) q * ↑(self.potential q.seed q.mem)) ≤ ∑' (t : CoupledState self.Seed D.State cells w), ν t * (↑(self.charge t.state o) + ↑(self.potential t.seed t.mem))
Coupled one-step execution of
P.step ofrom any coupled distributionν, matching the(result, postMem)marginal of(P.step o).run t.mem, angelically witnessingD.step, preserving seed-marginal control andsingleState, and satisfying the addition-onlyℝ≥0∞amortized-in-expectation probe inequality.
Deterministic-to-randomized lifting #
Canonical embedding of any deterministic CellProbe.StateTransitionImpl into
CellProbe.Randomized.StateTransitionImpl over Randomized.Scheme.ofDeterministic P
(Seed := Unit, seedLaw := PMF.pure (), seedSlack := 1).
Construct a Randomized.StateTransitionImpl on a functional specification ([D.HasStepFn f]),
setting singleState := True and reasoning over PMF (Seed × Mem cells w).
Cell padding (cells ≤ cells') #
Lift a Randomized.StateTransitionImpl from cells cells to cells' cells (cells ≤ cells')
via Cslib.CellProbe.Randomized.Scheme.padCells, preserving initPotential and charge.
Sequence-level expected-amortized probe bounds and transcript contracts #
First-component (transcript, postMem) decomposition of Randomized.Scheme.runFrom across
ops₁ ++ ops₂.
Multi-operation expected-amortized sequence theorem (seq_expected_amortized).
For any demonically admissible operation sequence D.ValidOpSeq s₀ ops, executing P from
P.init admits a coupled transcript-and-state distribution ν_final whose label marginal equals
(P.runSeq ops).map Prod.fst, whose support elements are valid relational transcripts of ops
ending in represented states, and whose expected total transcript charge plus C.initPotential
bounds P.expectedSeqProbes ops plus expected final potential.
Zero-error transcript correctness of P.runSeq ops in D.toObliviousSequenceSpec s₀ across any
demonically admissible sequence D.ValidOpSeq s₀ ops.
When C.charge s o ≤ opCharge o on admissible inputs, P.expectedSeqProbes ops is bounded by
C.initPotential + (ops.map opCharge).sum for every ops satisfying D.ValidOpSeq s₀ ops.
Sequence-level expected-amortized theorem on deterministic specifications
(D.HasStepFn f). Across any admissible history D.ValidHistory s₀ ops, P.runSeq ops
satisfies the zero-error contract (D.toObliviousSequenceSpec s₀).Contract ops (concentrating
every supported output trace on (D.run s₀ ops).2) and satisfies
P.expectedSeqProbes ops ≤ C.initPotential + D.totalCost C.charge s₀ ops.
Expected sequence probes of P across any admissible history D.ValidHistory s₀ ops on a
deterministic specification ([D.HasStepFn f]) is at most
C.initPotential + D.totalCost C.charge s₀ ops.