Documentation

CslibFrontier.DataStructure.CellProbe.Randomized.ObliviousSequence

Oblivious-Sequence Cell-Probe Implementations and Zero-Error Yao Averaging #

This file connects state-free oblivious-sequence specifications (Cslib.DataStructure.ObliviousSequenceSpec) to randomized cell-probe schemes (Cslib.CellProbe.Randomized.Scheme, [Mil99]) and provides the DataStructure-level averaging (coin-fixing) corollaries, the easy direction of Yao's principle [Yao77], for zero-error (Las Vegas) schemes against oblivious operation sequences:

  1. ObliviousSequenceImpl: certifies that P : Cslib.CellProbe.Randomized.Scheme S.Op S.Result cells w satisfies S.Contract ops ((P.runSeq ops).map Prod.fst) and P.expectedSeqProbes ops ≤ initPotential + (ops.map charge).sum on every S.ValidOpSeq ops (covering both zero-error contracts via D.toObliviousSequenceSpec s₀ and bounded-error Monte Carlo contracts via general ObliviousSequenceSpec), with cell padding padCells and contract weakening weaken.
  2. State-transition lift (StateTransitionImpl.toObliviousSequenceImpl): canonically embeds any Randomized.StateTransitionImpl (and any deterministic CellProbe.StateTransitionImpl) whose charge is bounded by opCharge : D.Op → ℕ into ObliviousSequenceImpl.
  3. Averaging (easy) direction of Yao's principle [Yao77] for zero-error schemes on oblivious sequences: wraps Scheme.exists_det_indexedScheme_le_expectedSeqProbes and Scheme.exists_det_scheme_le_expectedSeqProbes over D.toObliviousSequenceSpec s₀ on deterministic specifications ([D.HasStepFn f]):
    • Parameterized over an explicit finite opsAlphabet : Finset D.Op and horizon : ℕ, with correctSeqs separated from hardDist, so infinite operation types such as Dictionary.Op U (carrying v : ℕ) work directly without [Fintype D.Op]; bounded-error Monte Carlo schemes and adaptive sequence adversaries are out of scope.
    • Fixing per-operation coins yields a step-indexed Cslib.CellProbe.IndexedScheme (the time-aware relaxation with a free step clock outside cell memory), so any deterministic cell-probe lower bound paired with exists_det_indexedScheme_le_expectedSeqProbes must hold against step-indexed IndexedSchemes.
    • In the random initial memory / coin-free steps specialization (IsCoinFree, where randomness lives only in P.init and operations observe it only by probing cells), exists_det_scheme_le_expectedSeqProbes produces a time-invariant Cslib.CellProbe.Scheme without opsAlphabet or horizon.

Main definitions #

Main results #

References #

ObliviousSequenceImpl: randomized cell-probe implementation of ObliviousSequenceSpec #

Certified randomized cell-probe implementation of S : ObliviousSequenceSpec in cells cells of w-bit words (cells * w bits total).

def Cslib.DataStructure.CellProbe.Randomized.ObliviousSequenceImpl.weaken {cells w : ℕ} {S : ObliviousSequenceSpec} {P : CellProbe.Randomized.Scheme S.Op S.Result cells w} (C : ObliviousSequenceImpl S P) {ValidOpSeq' : List S.Op → Prop} {Contract' : List S.Op → PMF (List (Sigma S.Result)) → Prop} (hV : ∀ (ops : List S.Op), ValidOpSeq' ops → S.ValidOpSeq ops) (hC : ∀ (ops : List S.Op) (μ : PMF (List (Sigma S.Result))), S.ValidOpSeq ops → S.Contract ops μ → Contract' ops μ) :
ObliviousSequenceImpl (S.weaken ValidOpSeq' Contract') P

Transport an ObliviousSequenceImpl along ObliviousSequenceSpec.weaken.

@[simp]
theorem Cslib.DataStructure.CellProbe.Randomized.ObliviousSequenceImpl.weaken_initPotential {cells w : ℕ} {S : ObliviousSequenceSpec} {P : CellProbe.Randomized.Scheme S.Op S.Result cells w} (C : ObliviousSequenceImpl S P) {ValidOpSeq' : List S.Op → Prop} {Contract' : List S.Op → PMF (List (Sigma S.Result)) → Prop} (hV : ∀ (ops : List S.Op), ValidOpSeq' ops → S.ValidOpSeq ops) (hC : ∀ (ops : List S.Op) (μ : PMF (List (Sigma S.Result))), S.ValidOpSeq ops → S.Contract ops μ → Contract' ops μ) :
@[simp]
theorem Cslib.DataStructure.CellProbe.Randomized.ObliviousSequenceImpl.weaken_charge {cells w : ℕ} {S : ObliviousSequenceSpec} {P : CellProbe.Randomized.Scheme S.Op S.Result cells w} (C : ObliviousSequenceImpl S P) {ValidOpSeq' : List S.Op → Prop} {Contract' : List S.Op → PMF (List (Sigma S.Result)) → Prop} (hV : ∀ (ops : List S.Op), ValidOpSeq' ops → S.ValidOpSeq ops) (hC : ∀ (ops : List S.Op) (μ : PMF (List (Sigma S.Result))), S.ValidOpSeq ops → S.Contract ops μ → Contract' ops μ) :
(C.weaken hV hC).charge = C.charge

Canonical embeddings of StateTransitionImpl into ObliviousSequenceImpl #

def Cslib.DataStructure.CellProbe.Randomized.StateTransitionImpl.toObliviousSequenceImpl {cells w : ℕ} {D : StateTransitionSpec} {P : CellProbe.Randomized.Scheme D.Op D.Result cells w} {s₀ : D.State} (C : StateTransitionImpl D P s₀) (opCharge : D.Op → ℕ := C.charge s₀) (hcharge : ∀ (s : D.State) (o : D.Op), D.valid s o → C.charge s o ≤ opCharge o := by intros; first | exact le_rfl | simp) :

Canonical embedding of any relational Randomized.StateTransitionImpl into ObliviousSequenceImpl over D.toObliviousSequenceSpec s₀, given a state-independent operation charge bound opCharge : D.Op → ℕ with ∀ s o, D.valid s o → C.charge s o ≤ opCharge o.

@[simp]
theorem Cslib.DataStructure.CellProbe.Randomized.StateTransitionImpl.toObliviousSequenceImpl_initPotential {cells w : ℕ} {D : StateTransitionSpec} {P : CellProbe.Randomized.Scheme D.Op D.Result cells w} {s₀ : D.State} (C : StateTransitionImpl D P s₀) (opCharge : D.Op → ℕ) (hcharge : ∀ (s : D.State) (o : D.Op), D.valid s o → C.charge s o ≤ opCharge o) :
@[simp]
theorem Cslib.DataStructure.CellProbe.Randomized.StateTransitionImpl.toObliviousSequenceImpl_charge {cells w : ℕ} {D : StateTransitionSpec} {P : CellProbe.Randomized.Scheme D.Op D.Result cells w} {s₀ : D.State} (C : StateTransitionImpl D P s₀) (opCharge : D.Op → ℕ) (hcharge : ∀ (s : D.State) (o : D.Op), D.valid s o → C.charge s o ≤ opCharge o) :
(C.toObliviousSequenceImpl opCharge hcharge).charge = opCharge
noncomputable def Cslib.DataStructure.CellProbe.StateTransitionImpl.toObliviousSequenceImpl {cells w : ℕ} {D : StateTransitionSpec} {P : CellProbe.Scheme D.Op D.Result cells w} {s₀ : D.State} (C : StateTransitionImpl D P s₀) (opCharge : D.Op → ℕ := C.charge s₀) (hcharge : ∀ (s : D.State) (o : D.Op), D.valid s o → C.charge s o ≤ opCharge o := by intros; first | exact le_rfl | simp) :

Canonical embedding of any deterministic CellProbe.StateTransitionImpl into Randomized.ObliviousSequenceImpl over D.toObliviousSequenceSpec s₀.

@[simp]
theorem Cslib.DataStructure.CellProbe.StateTransitionImpl.toObliviousSequenceImpl_initPotential {cells w : ℕ} {D : StateTransitionSpec} {P : CellProbe.Scheme D.Op D.Result cells w} {s₀ : D.State} (C : StateTransitionImpl D P s₀) (opCharge : D.Op → ℕ) (hcharge : ∀ (s : D.State) (o : D.Op), D.valid s o → C.charge s o ≤ opCharge o) :
@[simp]
theorem Cslib.DataStructure.CellProbe.StateTransitionImpl.toObliviousSequenceImpl_charge {cells w : ℕ} {D : StateTransitionSpec} {P : CellProbe.Scheme D.Op D.Result cells w} {s₀ : D.State} (C : StateTransitionImpl D P s₀) (opCharge : D.Op → ℕ) (hcharge : ∀ (s : D.State) (o : D.Op), D.valid s o → C.charge s o ≤ opCharge o) :
(C.toObliviousSequenceImpl opCharge hcharge).charge = opCharge

Averaging (easy) direction of Yao's principle [Yao77] for zero-error schemes #

theorem Cslib.DataStructure.CellProbe.Randomized.exists_det_indexedScheme_le_expectedSeqProbes {D : StateTransitionSpec} {f : D.State → (o : D.Op) → D.State × D.Result o} [D.HasStepFn f] [DecidableEq D.Op] [(o : D.Op) → Inhabited (D.Result o)] {cells w : ℕ} (s₀ : D.State) (P : CellProbe.Randomized.Scheme D.Op D.Result cells w) (opsAlphabet : Finset D.Op) (horizon : ℕ) (correctSeqs : Set (List D.Op)) (hcorrectSeqs : ∀ ops ∈ correctSeqs, D.ValidHistory s₀ ops ∧ ops.length ≤ horizon ∧ ∀ o ∈ ops, o ∈ opsAlphabet) (hcorr : ∀ ops ∈ correctSeqs, (D.toObliviousSequenceSpec s₀).Contract ops (PMF.map Prod.fst (P.runSeq ops))) (hardDist : PMF (List D.Op)) (hhardDist : ∀ ops ∈ hardDist.support, ops.length ≤ horizon ∧ ∀ o ∈ ops, o ∈ opsAlphabet) :
∃ D_det ∈ (P.indexedSchemeLaw horizon opsAlphabet).support, (∀ ops ∈ correctSeqs, (D_det.runSeq ops).1 = (D.run s₀ ops).2) ∧ ∑' (ops : List D.Op), hardDist ops * ↑(D_det.seqProbes ops) ≤ ∑' (ops : List D.Op), hardDist ops * P.expectedSeqProbes ops

Averaging (coin-fixing) argument, the easy direction of Yao's principle [Yao77], for zero-error schemes on oblivious sequences (IndexedScheme over explicit finite opsAlphabet): Suppose D : StateTransitionSpec is deterministic ([D.HasStepFn f]), opsAlphabet : Finset D.Op is a finite set of admissible operations, correctSeqs is any set of admissible histories (D.ValidHistory s₀ ops) of length ≤ horizon over opsAlphabet on which P satisfies the zero-error contract (D.toObliviousSequenceSpec s₀).Contract ops ((P.runSeq ops).map Prod.fst) (bounded-error Monte Carlo schemes and adaptive sequence adversaries are out of scope), and hardDist : PMF (List D.Op) is any sequence distribution supported on sequences of length ≤ horizon over opsAlphabet.

Then there exists a deterministic D_det in (P.indexedSchemeLaw horizon opsAlphabet).support (the time-aware relaxation with a free step clock outside cell memory; deterministic lower bounds paired with this theorem must hold against step-indexed IndexedSchemes) that returns the canonical transcript (D.run s₀ ops).2 on all ops ∈ correctSeqs and incurs expected probes over hardDist at most that of P.

theorem Cslib.DataStructure.CellProbe.Randomized.exists_det_indexedScheme_le_expectedSeqProbes_of_fintype {D : StateTransitionSpec} {f : D.State → (o : D.Op) → D.State × D.Result o} [D.HasStepFn f] [Fintype D.Op] [DecidableEq D.Op] [(o : D.Op) → Inhabited (D.Result o)] {cells w : ℕ} (s₀ : D.State) (P : CellProbe.Randomized.Scheme D.Op D.Result cells w) (horizon : ℕ) (correctSeqs : Set (List D.Op)) (hcorrectSeqs : ∀ ops ∈ correctSeqs, D.ValidHistory s₀ ops ∧ ops.length ≤ horizon) (hcorr : ∀ ops ∈ correctSeqs, (D.toObliviousSequenceSpec s₀).Contract ops (PMF.map Prod.fst (P.runSeq ops))) (hardDist : PMF (List D.Op)) (hhardDist : ∀ ops ∈ hardDist.support, ops.length ≤ horizon) :
∃ D_det ∈ (P.indexedSchemeLaw horizon Finset.univ).support, (∀ ops ∈ correctSeqs, (D_det.runSeq ops).1 = (D.run s₀ ops).2) ∧ ∑' (ops : List D.Op), hardDist ops * ↑(D_det.seqProbes ops) ≤ ∑' (ops : List D.Op), hardDist ops * P.expectedSeqProbes ops

[Fintype D.Op] convenience corollary of exists_det_indexedScheme_le_expectedSeqProbes, instantiating opsAlphabet := Finset.univ.

theorem Cslib.DataStructure.CellProbe.Randomized.exists_det_scheme_le_expectedSeqProbes {D : StateTransitionSpec} {f : D.State → (o : D.Op) → D.State × D.Result o} [D.HasStepFn f] {cells w : ℕ} (s₀ : D.State) (P : CellProbe.Randomized.Scheme D.Op D.Result cells w) (hstep : ∀ (o : D.Op), (P.step o).IsCoinFree) (correctSeqs : Set (List D.Op)) (hcorrectSeqs : ∀ ops ∈ correctSeqs, D.ValidHistory s₀ ops) (hcorr : ∀ ops ∈ correctSeqs, (D.toObliviousSequenceSpec s₀).Contract ops (PMF.map Prod.fst (P.runSeq ops))) (hardDist : PMF (List D.Op)) :
∃ D_det ∈ (P.schemeLaw hstep).support, (∀ ops ∈ correctSeqs, (D_det.runSeq ops).1 = (D.run s₀ ops).2) ∧ ∑' (ops : List D.Op), hardDist ops * ↑(D_det.seqProbes ops) ≤ ∑' (ops : List D.Op), hardDist ops * P.expectedSeqProbes ops

Random initial memory / coin-free steps averaging argument [Yao77] (CellProbe.Scheme): when randomness lives only in initial memory P.init and per-operation trees draw no private coins (∀ o, (P.step o).IsCoinFree, so operations observe P.init only by probing cells), zero-error averaging over D.toObliviousSequenceSpec s₀ produces a time-invariant deterministic D_det : Cslib.CellProbe.Scheme D.Op D.Result cells w in (P.schemeLaw hstep).support without requiring [DecidableEq D.Op], [∀ o, Inhabited (D.Result o)], opsAlphabet, or horizon.

theorem Cslib.DataStructure.CellProbe.Randomized.ObliviousSequenceImpl.exists_det_indexedScheme {D : StateTransitionSpec} {f : D.State → (o : D.Op) → D.State × D.Result o} [D.HasStepFn f] [DecidableEq D.Op] [(o : D.Op) → Inhabited (D.Result o)] {cells w : ℕ} {s₀ : D.State} {P : CellProbe.Randomized.Scheme D.Op D.Result cells w} (C : ObliviousSequenceImpl (D.toObliviousSequenceSpec s₀) P) (opsAlphabet : Finset D.Op) (horizon : ℕ) (correctSeqs : Set (List D.Op)) (hcorrectSeqs : ∀ ops ∈ correctSeqs, D.ValidHistory s₀ ops ∧ ops.length ≤ horizon ∧ ∀ o ∈ ops, o ∈ opsAlphabet) (hardDist : PMF (List D.Op)) (hhardDist : ∀ ops ∈ hardDist.support, D.ValidHistory s₀ ops ∧ ops.length ≤ horizon ∧ ∀ o ∈ ops, o ∈ opsAlphabet) :
∃ D_det ∈ (P.indexedSchemeLaw horizon opsAlphabet).support, (∀ ops ∈ correctSeqs, (D_det.runSeq ops).1 = (D.run s₀ ops).2) ∧ ∑' (ops : List D.Op), hardDist ops * ↑(D_det.seqProbes ops) ≤ ↑C.initPotential + ∑' (ops : List D.Op), hardDist ops * ↑(List.map C.charge ops).sum

Zero-error Yao averaging (easy direction [Yao77]) packaged directly for an ObliviousSequenceImpl (D.toObliviousSequenceSpec s₀) P on a deterministic specification ([D.HasStepFn f]): produces a step-indexed IndexedScheme (in the time-aware relaxation with a free step clock) correct on correctSeqs with expected probes bounded by C's amortized budget.

theorem Cslib.DataStructure.CellProbe.Randomized.ObliviousSequenceImpl.le_expected_charge_of_det_indexedScheme {D : StateTransitionSpec} {f : D.State → (o : D.Op) → D.State × D.Result o} [D.HasStepFn f] {cells w : ℕ} {s₀ : D.State} {P : CellProbe.Randomized.Scheme D.Op D.Result cells w} (C : ObliviousSequenceImpl (D.toObliviousSequenceSpec s₀) P) (opsAlphabet : Finset D.Op) (horizon : ℕ) (correctSeqs : Set (List D.Op)) (hcorrectSeqs : ∀ ops ∈ correctSeqs, D.ValidHistory s₀ ops ∧ ops.length ≤ horizon ∧ ∀ o ∈ ops, o ∈ opsAlphabet) (hardDist : PMF (List D.Op)) (hhardDist : ∀ ops ∈ hardDist.support, D.ValidHistory s₀ ops ∧ ops.length ≤ horizon ∧ ∀ o ∈ ops, o ∈ opsAlphabet) {L : ENNReal} (hlb : ∀ (D_det : CellProbe.IndexedScheme D.Op D.Result cells w), (∀ ops ∈ correctSeqs, (D_det.runSeq ops).1 = (D.run s₀ ops).2) → L ≤ ∑' (ops : List D.Op), hardDist ops * ↑(D_det.seqProbes ops)) :
L ≤ ↑C.initPotential + ∑' (ops : List D.Op), hardDist ops * ↑(List.map C.charge ops).sum

Lower-bound transfer for ObliviousSequenceImpl (D.toObliviousSequenceSpec s₀) P: any distributional lower bound L proved against all deterministic step-indexed IndexedSchemes correct on correctSeqs transfers directly to C.initPotential + E_{hardDist}[sum charge].

theorem Cslib.DataStructure.CellProbe.Randomized.StateTransitionImpl.exists_det_indexedScheme {D : StateTransitionSpec} {f : D.State → (o : D.Op) → D.State × D.Result o} [D.HasStepFn f] [DecidableEq D.Op] [(o : D.Op) → Inhabited (D.Result o)] {cells w : ℕ} {s₀ : D.State} {P : CellProbe.Randomized.Scheme D.Op D.Result cells w} (C : StateTransitionImpl D P s₀) (opsAlphabet : Finset D.Op) (horizon : ℕ) (correctSeqs : Set (List D.Op)) (hcorrectSeqs : ∀ ops ∈ correctSeqs, D.ValidHistory s₀ ops ∧ ops.length ≤ horizon ∧ ∀ o ∈ ops, o ∈ opsAlphabet) (hardDist : PMF (List D.Op)) (hhardDist : ∀ ops ∈ hardDist.support, D.ValidHistory s₀ ops ∧ ops.length ≤ horizon ∧ ∀ o ∈ ops, o ∈ opsAlphabet) :
∃ D_det ∈ (P.indexedSchemeLaw horizon opsAlphabet).support, (∀ ops ∈ correctSeqs, (D_det.runSeq ops).1 = (D.run s₀ ops).2) ∧ ∑' (ops : List D.Op), hardDist ops * ↑(D_det.seqProbes ops) ≤ ↑C.initPotential + ∑' (ops : List D.Op), hardDist ops * ↑(D.totalCost C.charge s₀ ops)

Zero-error Yao averaging (easy direction [Yao77]) packaged directly for a Randomized.StateTransitionImpl D P s₀ on a deterministic specification ([D.HasStepFn f]), producing a step-indexed IndexedScheme (in the time-aware relaxation with a free step clock) bounded by C.initPotential + E_{hardDist}[D.totalCost C.charge s₀ ops].

theorem Cslib.DataStructure.CellProbe.Randomized.StateTransitionImpl.exists_det_scheme {D : StateTransitionSpec} {f : D.State → (o : D.Op) → D.State × D.Result o} [D.HasStepFn f] {cells w : ℕ} {s₀ : D.State} {P : CellProbe.Randomized.Scheme D.Op D.Result cells w} (C : StateTransitionImpl D P s₀) (hstep : ∀ (o : D.Op), (P.step o).IsCoinFree) (correctSeqs : Set (List D.Op)) (hcorrectSeqs : ∀ ops ∈ correctSeqs, D.ValidHistory s₀ ops) (hardDist : PMF (List D.Op)) (hhardDist : ∀ ops ∈ hardDist.support, D.ValidHistory s₀ ops) :
∃ D_det ∈ (P.schemeLaw hstep).support, (∀ ops ∈ correctSeqs, (D_det.runSeq ops).1 = (D.run s₀ ops).2) ∧ ∑' (ops : List D.Op), hardDist ops * ↑(D_det.seqProbes ops) ≤ ↑C.initPotential + ∑' (ops : List D.Op), hardDist ops * ↑(D.totalCost C.charge s₀ ops)

Random initial memory / coin-free steps averaging specialization [Yao77] for Randomized.StateTransitionImpl D P s₀ ([D.HasStepFn f]), returning a time-invariant Cslib.CellProbe.Scheme without opsAlphabet or horizon.

theorem Cslib.DataStructure.CellProbe.Randomized.StateTransitionImpl.le_expected_totalCost_of_det_indexedScheme {D : StateTransitionSpec} {f : D.State → (o : D.Op) → D.State × D.Result o} [D.HasStepFn f] {cells w : ℕ} {s₀ : D.State} {P : CellProbe.Randomized.Scheme D.Op D.Result cells w} (C : StateTransitionImpl D P s₀) (opsAlphabet : Finset D.Op) (horizon : ℕ) (correctSeqs : Set (List D.Op)) (hcorrectSeqs : ∀ ops ∈ correctSeqs, D.ValidHistory s₀ ops ∧ ops.length ≤ horizon ∧ ∀ o ∈ ops, o ∈ opsAlphabet) (hardDist : PMF (List D.Op)) (hhardDist : ∀ ops ∈ hardDist.support, D.ValidHistory s₀ ops ∧ ops.length ≤ horizon ∧ ∀ o ∈ ops, o ∈ opsAlphabet) {L : ENNReal} (hlb : ∀ (D_det : CellProbe.IndexedScheme D.Op D.Result cells w), (∀ ops ∈ correctSeqs, (D_det.runSeq ops).1 = (D.run s₀ ops).2) → L ≤ ∑' (ops : List D.Op), hardDist ops * ↑(D_det.seqProbes ops)) :
L ≤ ↑C.initPotential + ∑' (ops : List D.Op), hardDist ops * ↑(D.totalCost C.charge s₀ ops)

Lower-bound transfer for Randomized.StateTransitionImpl D P s₀: any distributional lower bound L proved against all deterministic step-indexed IndexedSchemes correct on correctSeqs transfers directly to C.initPotential + E_{hardDist}[D.totalCost C.charge s₀ ops].