Documentation

CslibFrontier.DataStructure.WordRAM.Resizable.Randomized.ObliviousSequence

Oblivious-Sequence Resizable Word RAM Implementation Certificates #

Connects state-free oblivious-sequence specifications (Cslib.DataStructure.ObliviousSequenceSpec) to randomized subroutines on the word-granular Resizable Word RAM (Cslib.WordRAM.Resizable.ExecRCodeDist and ExecRProgramDist), accompanying the word-granular resizable memory models of [LLYZ23a], Section 2.1, and [KLZ26], Section 5.1, and adapting the bit-granular virtual-memory variant of [LLYZ24], Section 3.2, at word granularity. Expected step times sum across ops : List S.Op by linearity of expectation ([MU17], Section 2.1), tracking trajectory-dependent resting (spaceBound : List S.Op → ℕ) and peak (peakSpaceBound : List S.Op → S.Op → ℕ) word bounds while preserving caller memory [0, base).

Main definitions #

Main results #

References #

Named state, outcome, and trajectory-fit bundles #

Coupled latent state and concrete Resizable Word RAM state RData r.

  • latent : Latent

    Internal latent state (such as a hash seed or coupled relational state).

  • Concrete Resizable Word RAM register, memory, and frontier state.

structure Cslib.DataStructure.WordRAM.Resizable.Randomized.StepROutcome (Latent : Type z) (α : Type v) (r : ℕ) :
Type (max v z)

Outcome of a single oblivious subroutine operation step.

  • latent : Latent

    Updated internal latent state.

  • Updated concrete Resizable Word RAM state.

  • result : α

    Decoded observation returned by the operation.

structure Cslib.DataStructure.WordRAM.Resizable.Randomized.SeqROutcome (Latent : Type z) {Op : Type u} (Result : Op → Type v) (r : ℕ) :
Type (max u v z)

Outcome of a multi-operation oblivious sequence.

  • latent : Latent

    Current internal latent state.

  • Current concrete Resizable Word RAM state.

  • transcript : List (Sigma Result)

    Accumulated input-output transcript executed so far.

def Cslib.DataStructure.WordRAM.Resizable.Randomized.SeqROutcome.ofLatentRState {Latent : Type z} {Op : Type u} {Result : Op → Type v} {r : ℕ} (t : LatentRState Latent r) :
SeqROutcome Latent Result r

Initialize a SeqROutcome from a LatentRState with an empty transcript [].

def Cslib.DataStructure.WordRAM.Resizable.Randomized.SeqROutcome.appendStep {Latent : Type z} {Op : Type u} {Result : Op → Type v} {r : ℕ} (t : SeqROutcome Latent Result r) (o : Op) (q : StepROutcome Latent (Result o) r) :
SeqROutcome Latent Result r

Append a single operation outcome q : StepROutcome Latent (Result o) r to t.

def Cslib.DataStructure.WordRAM.Resizable.Randomized.ObliviousPeakFits {Op : Type u} (w base : ℕ) (peakSpaceBound : List Op → Op → ℕ) :
List Op → List Op → Prop

Trajectory-relative peak-frontier admissibility along remaining oblivious operations remOps after prefix prefOps.

@[simp]
theorem Cslib.DataStructure.WordRAM.Resizable.Randomized.obliviousPeakFits_nil {Op : Type u} (w base : ℕ) (peakSpaceBound : List Op → Op → ℕ) (prefOps : List Op) :
ObliviousPeakFits w base peakSpaceBound prefOps [] ↔ True
@[simp]
theorem Cslib.DataStructure.WordRAM.Resizable.Randomized.obliviousPeakFits_cons {Op : Type u} (w base : ℕ) (peakSpaceBound : List Op → Op → ℕ) (prefOps : List Op) (o : Op) (ops : List Op) :
ObliviousPeakFits w base peakSpaceBound prefOps (o :: ops) ↔ WordRAM.Fits w (base + peakSpaceBound prefOps o) ∧ ObliviousPeakFits w base peakSpaceBound (prefOps ++ [o]) ops

Multi-operation distributional execution (ExecSteps and ExecProgramSteps) #

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

Multi-operation structured distributional execution across remaining operations remOps after prefix prefOps: at each operation o, P.code executes under ExecRCodeDist within peak frontier base + peakSpaceBound prefOps o, establishes resting frontier base ≤ q.data.frontier ≤ base + spaceBound (prefOps ++ [o]) and q.data.regs P.baseReg = base, decodes q.result, preserves caller memory [0, base), and appends ⟨o, q.result⟩.

theorem Cslib.DataStructure.WordRAM.Resizable.Randomized.ExecSteps.bounded {B : WordRAM.Basis} {r_ds k_init : ℕ} {P : SubroutineCode B r_ds k_init} {S : ObliviousSequenceSpec} {Latent : Type z} {w base : ℕ} {spaceBound : List S.Op → ℕ} {peakSpaceBound : List S.Op → S.Op → ℕ} {encode : S.Op → Fin r_ds → ℕ} {decode : (o : S.Op) → (Fin r_ds → ℕ) → Option (S.Result o)} {prefOps remOps : List S.Op} {ν ν_final : PMF (SeqROutcome Latent S.Result r_ds)} {T_ops : ENNReal} (h : ExecSteps P S Latent w base spaceBound peakSpaceBound encode decode prefOps remOps ν ν_final T_ops) (hbdd : ∀ t ∈ ν.support, WordRAM.Resizable.RData.Bounded w t.data) (t : SeqROutcome Latent S.Result r_ds) :

ExecSteps preserves RData.Bounded w across all support states.

theorem Cslib.DataStructure.WordRAM.Resizable.Randomized.ExecSteps.frontier_le {B : WordRAM.Basis} {r_ds k_init : ℕ} {P : SubroutineCode B r_ds k_init} {S : ObliviousSequenceSpec} {Latent : Type z} {w base : ℕ} {spaceBound : List S.Op → ℕ} {peakSpaceBound : List S.Op → S.Op → ℕ} {encode : S.Op → Fin r_ds → ℕ} {decode : (o : S.Op) → (Fin r_ds → ℕ) → Option (S.Result o)} {prefOps remOps : List S.Op} {ν ν_final : PMF (SeqROutcome Latent S.Result r_ds)} {T_ops : ENNReal} (h : ExecSteps P S Latent w base spaceBound peakSpaceBound encode decode prefOps remOps ν ν_final T_ops) (hfr : ∀ t ∈ ν.support, base ≤ t.data.frontier ∧ t.data.frontier ≤ base + spaceBound prefOps ∧ t.data.regs P.baseReg = base) (t : SeqROutcome Latent S.Result r_ds) :
t ∈ ν_final.support → base ≤ t.data.frontier ∧ t.data.frontier ≤ base + spaceBound (prefOps ++ remOps) ∧ t.data.regs P.baseReg = base

ExecSteps establishes resting frontier bounds base ≤ t.data.frontier ≤ base + spaceBound (prefOps ++ remOps) and t.data.regs P.baseReg = base on ν_final.support.

theorem Cslib.DataStructure.WordRAM.Resizable.Randomized.ExecSteps.caller_mem {B : WordRAM.Basis} {r_ds k_init : ℕ} {P : SubroutineCode B r_ds k_init} {S : ObliviousSequenceSpec} {Latent : Type z} {w base : ℕ} {spaceBound : List S.Op → ℕ} {peakSpaceBound : List S.Op → S.Op → ℕ} {encode : S.Op → Fin r_ds → ℕ} {decode : (o : S.Op) → (Fin r_ds → ℕ) → Option (S.Result o)} {prefOps remOps : List S.Op} {ν ν_final : PMF (SeqROutcome Latent S.Result r_ds)} {T_ops : ENNReal} (h : ExecSteps P S Latent w base spaceBound peakSpaceBound encode decode prefOps remOps ν ν_final T_ops) {mem₀ : ℕ → ℕ} (h₀ : ∀ t ∈ ν.support, ∀ addr < base, t.data.mem addr = mem₀ addr) (t : SeqROutcome Latent S.Result r_ds) :
t ∈ ν_final.support → ∀ addr < base, t.data.mem addr = mem₀ addr

ExecSteps preserves caller memory [0, base) across all support states.

theorem Cslib.DataStructure.WordRAM.Resizable.Randomized.ExecSteps.mapSimulates {B B' : WordRAM.Basis} {r_ds k_init : ℕ} (φ : B.Simulates B') {P : SubroutineCode B r_ds k_init} {S : ObliviousSequenceSpec} {Latent : Type z} {w base : ℕ} {spaceBound : List S.Op → ℕ} {peakSpaceBound : List S.Op → S.Op → ℕ} {encode : S.Op → Fin r_ds → ℕ} {decode : (o : S.Op) → (Fin r_ds → ℕ) → Option (S.Result o)} {prefOps remOps : List S.Op} {ν ν_final : PMF (SeqROutcome Latent S.Result r_ds)} {T_ops : ENNReal} (h : ExecSteps P S Latent w base spaceBound peakSpaceBound encode decode prefOps remOps ν ν_final T_ops) :
ExecSteps (SubroutineCode.mapSimulates φ P) S Latent w base spaceBound peakSpaceBound encode decode prefOps remOps ν ν_final T_ops

Lift an ExecSteps derivation along a basis simulation φ : B.Simulates B'.

inductive Cslib.DataStructure.WordRAM.Resizable.Randomized.ExecProgramSteps {B : WordRAM.Basis} {r_ds k_init : ℕ} (P : SubroutineCode B r_ds k_init) (S : ObliviousSequenceSpec) (Latent : Type z) (w base : ℕ) (spaceBound : List S.Op → ℕ) (peakSpaceBound : List S.Op → S.Op → ℕ) (encode : S.Op → Fin r_ds → ℕ) (decode : (o : S.Op) → (Fin r_ds → ℕ) → Option (S.Result o)) (p_op : WordRAM.Resizable.RProgram B r_ds) (out : Fin r_ds) :
List S.Op → List S.Op → PMF (SeqROutcome Latent S.Result r_ds) → PMF (SeqROutcome Latent S.Result r_ds) → ENNReal → Prop

Multi-operation compiled flat-RProgram execution relation over ExecRProgramDist.

theorem Cslib.DataStructure.WordRAM.Resizable.Randomized.ExecSteps.toExecRProgramDist {B : WordRAM.Basis} {r_ds k_init : ℕ} {P : SubroutineCode B r_ds k_init} {S : ObliviousSequenceSpec} {Latent : Type z} {w base : ℕ} {spaceBound : List S.Op → ℕ} {peakSpaceBound : List S.Op → S.Op → ℕ} {encode : S.Op → Fin r_ds → ℕ} {decode : (o : S.Op) → (Fin r_ds → ℕ) → Option (S.Result o)} (out : Fin r_ds) {prefOps remOps : List S.Op} {ν ν_final : PMF (SeqROutcome Latent S.Result r_ds)} {T_ops : ENNReal} (h : ExecSteps P S Latent w base spaceBound peakSpaceBound encode decode prefOps remOps ν ν_final T_ops) :
ExecProgramSteps P S Latent w base spaceBound peakSpaceBound encode decode (P.opProg out) out prefOps remOps ν ν_final (T_ops + ↑remOps.length)

Compile a structured ExecSteps derivation to ExecProgramSteps ... (P.opProg out) out, charging + 1 instruction per operation for the trailing halt out.

theorem Cslib.DataStructure.WordRAM.Resizable.Randomized.ExecProgramSteps.transcript_prefix {B : WordRAM.Basis} {r_ds k_init : ℕ} {P : SubroutineCode B r_ds k_init} {S : ObliviousSequenceSpec} {Latent : Type z} {w base : ℕ} {spaceBound : List S.Op → ℕ} {peakSpaceBound : List S.Op → S.Op → ℕ} {encode : S.Op → Fin r_ds → ℕ} {decode : (o : S.Op) → (Fin r_ds → ℕ) → Option (S.Result o)} {p_op : WordRAM.Resizable.RProgram B r_ds} {out : Fin r_ds} {prefOps remOps : List S.Op} {ν ν_final : PMF (SeqROutcome Latent S.Result r_ds)} {T_prog : ENNReal} (h : ExecProgramSteps P S Latent w base spaceBound peakSpaceBound encode decode p_op out prefOps remOps ν ν_final T_prog) {t : SeqROutcome Latent S.Result r_ds} (ht : t ∈ ν.support) :
∃ u ∈ ν_final.support, t.transcript <+: u.transcript

Every support state t ∈ ν.support extends to some final support state u ∈ ν_final.support whose transcript has t.transcript as a prefix.

theorem Cslib.DataStructure.WordRAM.Resizable.Randomized.not_execProgramSteps_halt {B : WordRAM.Basis} {r_ds k_init : ℕ} {P : SubroutineCode B r_ds k_init} {S : ObliviousSequenceSpec} {Latent : Type z} {w base : ℕ} {spaceBound : List S.Op → ℕ} {peakSpaceBound : List S.Op → S.Op → ℕ} {encode : S.Op → Fin r_ds → ℕ} {decode : (o : S.Op) → (Fin r_ds → ℕ) → Option (S.Result o)} (out : Fin r_ds) {prefOps : List S.Op} {o : S.Op} {ops : List S.Op} {ν ν_final : PMF (SeqROutcome Latent S.Result r_ds)} {T_prog : ENNReal} {t : SeqROutcome Latent S.Result r_ds} (ht : t ∈ ν.support) (hbad : ∀ (a : S.Result o), decode o (P.prepare encode o t.data).regs = some a → base ≤ (P.prepare encode o t.data).frontier → (P.prepare encode o t.data).frontier ≤ base + spaceBound (prefOps ++ [o]) → ∀ u ∈ ν_final.support, t.transcript ++ [⟨o, a⟩] <+: u.transcript → False) :
¬ExecProgramSteps P S Latent w base spaceBound peakSpaceBound encode decode [WordRAM.Resizable.RInstr.halt out] out prefOps (o :: ops) ν ν_final T_prog

.halt-rejection soundness check (not_execProgramSteps_halt): a 1-instruction [.halt out] stub cannot satisfy ExecProgramSteps on (o :: ops) whenever for some t ∈ ν.support, no observation a decoded from P.prepare encode o t.data can appear at the next position of ν_final's transcripts (or when P.prepare encode o t.data violates the post-step frontier bound).

ObliviousSequenceImpl: Resizable Word RAM implementation for an ObliviousSequenceSpec #

structure Cslib.DataStructure.WordRAM.Resizable.Randomized.ObliviousSequenceImpl {B : WordRAM.Basis} {r_ds k_init : ℕ} (P : SubroutineCode B r_ds k_init) (S : ObliviousSequenceSpec) (w base : ℕ) (params : Fin k_init → ℕ) :
Type (max u v (z + 1))

Reusable Resizable Word RAM subroutine implementation certificate for a randomized data structure P : SubroutineCode B r_ds k_init realizing an oblivious-sequence specification S : DataStructure.ObliviousSequenceSpec at word width w, base address base, and runtime parameters params, with trajectory-dependent resting (spaceBound : List S.Op → ℕ) and peak (peakSpaceBound : List S.Op → S.Op → ℕ) word bounds.

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

Total operation charge summed across ops : List S.Op.

@[simp]
theorem Cslib.DataStructure.WordRAM.Resizable.Randomized.ObliviousSequenceImpl.totalCharge_nil {B : WordRAM.Basis} {r_ds k_init w base : ℕ} {P : SubroutineCode B r_ds k_init} {S : ObliviousSequenceSpec} {params : Fin k_init → ℕ} (C : ObliviousSequenceImpl P S w base params) :
@[simp]
theorem Cslib.DataStructure.WordRAM.Resizable.Randomized.ObliviousSequenceImpl.totalCharge_cons {B : WordRAM.Basis} {r_ds k_init w base : ℕ} {P : SubroutineCode B r_ds k_init} {S : ObliviousSequenceSpec} {params : Fin k_init → ℕ} (C : ObliviousSequenceImpl P S w base params) (o : S.Op) (ops : List S.Op) :
C.totalCharge (o :: ops) = C.charge o + C.totalCharge ops
@[reducible, inline]
abbrev Cslib.DataStructure.WordRAM.Resizable.Randomized.ObliviousSequenceImpl.Steps {B : WordRAM.Basis} {r_ds k_init w base : ℕ} {P : SubroutineCode B r_ds k_init} {S : ObliviousSequenceSpec} {params : Fin k_init → ℕ} (C : ObliviousSequenceImpl P S w base params) :
List S.Op → PMF (SeqROutcome C.Latent S.Result r_ds) → PMF (SeqROutcome C.Latent S.Result r_ds) → ENNReal → Prop

Specialization of ExecSteps from prefix [] to C : ObliviousSequenceImpl.

@[reducible, inline]
abbrev Cslib.DataStructure.WordRAM.Resizable.Randomized.ObliviousSequenceImpl.ProgramSteps {B : WordRAM.Basis} {r_ds k_init w base : ℕ} {P : SubroutineCode B r_ds k_init} {S : ObliviousSequenceSpec} {params : Fin k_init → ℕ} (C : ObliviousSequenceImpl P S w base params) (p_op : WordRAM.Resizable.RProgram B r_ds) (out : Fin r_ds) :
List S.Op → PMF (SeqROutcome C.Latent S.Result r_ds) → PMF (SeqROutcome C.Latent S.Result r_ds) → ENNReal → Prop

Specialization of ExecProgramSteps from prefix [] to C : ObliviousSequenceImpl.

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

Transport an ObliviousSequenceImpl certificate along φ : B.Simulates B'.

@[reducible, inline]

Lift an exact-basis ObliviousSequenceImpl certificate to Basis.standard.

theorem Cslib.DataStructure.WordRAM.Resizable.Randomized.ObliviousSequenceImpl.seq_expected {B : WordRAM.Basis} {r_ds k_init w base : ℕ} {P : SubroutineCode B r_ds k_init} {S : ObliviousSequenceSpec} {params : Fin k_init → ℕ} (C : ObliviousSequenceImpl P S w base params) {x₀ : WordRAM.Resizable.RData r_ds} (ops : List S.Op) (hx₀ : WordRAM.Resizable.RData.Bounded w x₀) (hfr₀ : x₀.frontier = base) (hpar : ∀ (j : Fin k_init), x₀.regs (P.initParams j) = params j) (hfit₀ : WordRAM.Fits w (base + C.spaceBound [])) (hv : S.ValidOpSeq ops) (hfit_ops : ObliviousPeakFits w base C.peakSpaceBound [] ops) :
∃ (ν₀ : PMF (LatentRState C.Latent r_ds)) (ν_final : PMF (SeqROutcome C.Latent S.Result r_ds)) (T_ops : ENNReal), WordRAM.Resizable.ExecRCodeDist w P.initCode x₀ (PMF.map LatentRState.data ν₀) C.initTime (base + C.spaceBound []) ∧ (∀ t ∈ ν₀.support, ∀ addr < base, t.data.mem addr = x₀.mem addr) ∧ C.Steps ops (PMF.map SeqROutcome.ofLatentRState ν₀) ν_final T_ops ∧ (∀ t ∈ ν_final.support, WordRAM.Resizable.RData.Bounded w t.data ∧ (base ≤ t.data.frontier ∧ t.data.frontier ≤ base + C.spaceBound ops ∧ t.data.regs P.baseReg = base) ∧ ∀ addr < base, t.data.mem addr = x₀.mem addr) ∧ S.Contract ops (PMF.map SeqROutcome.transcript ν_final) ∧ C.initTime + T_ops ≤ C.initTime + ↑C.initPotential + ↑(C.totalCharge ops)

End-to-end expected-time, trajectory-space, caller-prefix, and distributional correctness theorem (seq_expected).

theorem Cslib.DataStructure.WordRAM.Resizable.Randomized.ObliviousSequenceImpl.seq_toExecRProgramDist {B : WordRAM.Basis} {r_ds k_init w base : ℕ} {P : SubroutineCode B r_ds k_init} {S : ObliviousSequenceSpec} {params : Fin k_init → ℕ} (C : ObliviousSequenceImpl P S w base params) (out : Fin r_ds) {x₀ : WordRAM.Resizable.RData r_ds} (ops : List S.Op) (hx₀ : WordRAM.Resizable.RData.Bounded w x₀) (hfr₀ : x₀.frontier = base) (hpar : ∀ (j : Fin k_init), x₀.regs (P.initParams j) = params j) (hfit₀ : WordRAM.Fits w (base + C.spaceBound [])) (hv : S.ValidOpSeq ops) (hfit_ops : ObliviousPeakFits w base C.peakSpaceBound [] ops) :
∃ (ν₀ : PMF (LatentRState C.Latent r_ds)) (ν_final : PMF (SeqROutcome C.Latent S.Result r_ds)) (T_prog : ENNReal), WordRAM.Resizable.ExecRProgramDist w (P.initProg out) out x₀ (PMF.map LatentRState.data ν₀) (C.initTime + 1) (base + C.spaceBound []) ∧ (∀ t ∈ ν₀.support, ∀ addr < base, t.data.mem addr = x₀.mem addr) ∧ C.ProgramSteps (P.opProg out) out ops (PMF.map SeqROutcome.ofLatentRState ν₀) ν_final T_prog ∧ (∀ t ∈ ν_final.support, WordRAM.Resizable.RData.Bounded w t.data ∧ (base ≤ t.data.frontier ∧ t.data.frontier ≤ base + C.spaceBound ops ∧ t.data.regs P.baseReg = base) ∧ ∀ addr < base, t.data.mem addr = x₀.mem addr) ∧ S.Contract ops (PMF.map SeqROutcome.transcript ν_final) ∧ C.initTime + 1 + T_prog ≤ C.initTime + 1 + ↑C.initPotential + ↑(C.totalCharge ops) + ↑ops.length

End-to-end compiled flat-RProgram expected-time theorem (seq_toExecRProgramDist).

Coupled latent seed, current abstract state, and accumulated relational transcript prefix for embedding Cslib.DataStructure.WordRAM.Resizable.Randomized.StateTransitionImpl into ObliviousSequenceImpl.

  • seed : Seed

    Latent random seed from the underlying StateTransitionImpl.

  • state : D.State

    Current abstract state of D.

  • trace : D.Transcript

    Relational execution transcript accumulated since s₀.

theorem Cslib.DataStructure.WordRAM.Resizable.Randomized.obliviousPeakFits_iff_peakFitsHistory (D : StateTransitionSpec) {stepFn : D.State → (o : D.Op) → D.State × D.Result o} [D.HasStepFn stepFn] (w base : ℕ) (peakSpaceBound : D.State → D.Op → ℕ) (s₀ : D.State) (prefOps remOps : List D.Op) :
ObliviousPeakFits w base (fun (pref : List D.Op) (o : D.Op) => peakSpaceBound (D.run s₀ pref).1 o) prefOps remOps ↔ PeakFitsHistory w base peakSpaceBound (D.run s₀ prefOps).1 remOps

For a functional specification ([D.HasStepFn stepFn]), ObliviousPeakFits along the canonical state trajectory (D.run s₀ pref).1 agrees with PeakFitsHistory.

Canonical Embedding of StateTransitionImpl into ObliviousSequenceImpl #

noncomputable def Cslib.DataStructure.WordRAM.Resizable.Randomized.StateTransitionImpl.toObliviousSequenceImpl {B : WordRAM.Basis} {r_ds k_init w base : ℕ} {P : SubroutineCode B r_ds k_init} {D : StateTransitionSpec} {params : Fin k_init → ℕ} {s₀ : D.State} (C : StateTransitionImpl P D w base params s₀) (seqSpaceBound : List D.Op → ℕ) (seqPeakSpaceBound : List D.Op → D.Op → ℕ) (opCharge : D.Op → ℕ := C.charge s₀) (hspace : ∀ (tr : D.Transcript) (s : D.State), D.ValidTranscript s₀ tr s → C.spaceBound s ≤ seqSpaceBound tr.ops) (hpeak : ∀ (tr : D.Transcript) (s : D.State) (o : D.Op), D.ValidTranscript s₀ tr s → D.valid s o → C.peakSpaceBound s o ≤ seqPeakSpaceBound tr.ops o) (hcharge : ∀ (s : D.State) (o : D.Op), D.valid s o → C.charge s o ≤ opCharge o := by intros; exact le_rfl) :

Canonical embedding of any relational Cslib.DataStructure.WordRAM.Resizable.Randomized.StateTransitionImpl certificate into ObliviousSequenceImpl realizing D.toObliviousSequenceSpec s₀, given trajectory-indexed resting and peak word bounds (seqSpaceBound, seqPeakSpaceBound) and a state-independent operation charge opCharge : D.Op → ℕ.

noncomputable def Cslib.DataStructure.WordRAM.Resizable.Randomized.StateTransitionImpl.toObliviousSequenceImplOfFn {B : WordRAM.Basis} {r_ds k_init w base : ℕ} {P : SubroutineCode B r_ds k_init} {D : StateTransitionSpec} {params : Fin k_init → ℕ} {s₀ : D.State} (C : StateTransitionImpl P D w base params s₀) {stepFn : D.State → (o : D.Op) → D.State × D.Result o} [D.HasStepFn stepFn] (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; exact le_rfl) :

Canonical embedding of any functional Cslib.DataStructure.WordRAM.Resizable.Randomized.StateTransitionImpl certificate ([D.HasStepFn stepFn]) into ObliviousSequenceImpl using the exact canonical trajectory bounds pref ↦ C.spaceBound (D.run s₀ pref).1 and (pref, o) ↦ C.peakSpaceBound (D.run s₀ pref).1 o.

@[simp]
theorem Cslib.DataStructure.WordRAM.Resizable.Randomized.StateTransitionImpl.toObliviousSequenceImplOfFn_spaceBound {B : WordRAM.Basis} {r_ds k_init w base : ℕ} {P : SubroutineCode B r_ds k_init} {D : StateTransitionSpec} {params : Fin k_init → ℕ} {s₀ : D.State} (C : StateTransitionImpl P D w base params s₀) {stepFn : D.State → (o : D.Op) → D.State × D.Result o} [D.HasStepFn stepFn] (opCharge : D.Op → ℕ) (hcharge : ∀ (s : D.State) (o : D.Op), D.valid s o → C.charge s o ≤ opCharge o) (pref : List D.Op) :
(C.toObliviousSequenceImplOfFn opCharge hcharge).spaceBound pref = C.spaceBound (D.run s₀ pref).1
@[simp]
theorem Cslib.DataStructure.WordRAM.Resizable.Randomized.StateTransitionImpl.toObliviousSequenceImplOfFn_peakSpaceBound {B : WordRAM.Basis} {r_ds k_init w base : ℕ} {P : SubroutineCode B r_ds k_init} {D : StateTransitionSpec} {params : Fin k_init → ℕ} {s₀ : D.State} (C : StateTransitionImpl P D w base params s₀) {stepFn : D.State → (o : D.Op) → D.State × D.Result o} [D.HasStepFn stepFn] (opCharge : D.Op → ℕ) (hcharge : ∀ (s : D.State) (o : D.Op), D.valid s o → C.charge s o ≤ opCharge o) (pref : List D.Op) (o : D.Op) :
(C.toObliviousSequenceImplOfFn opCharge hcharge).peakSpaceBound pref o = C.peakSpaceBound (D.run s₀ pref).1 o
@[simp]
theorem Cslib.DataStructure.WordRAM.Resizable.Randomized.StateTransitionImpl.toObliviousSequenceImplOfFn_charge {B : WordRAM.Basis} {r_ds k_init w base : ℕ} {P : SubroutineCode B r_ds k_init} {D : StateTransitionSpec} {params : Fin k_init → ℕ} {s₀ : D.State} (C : StateTransitionImpl P D w base params s₀) {stepFn : D.State → (o : D.Op) → D.State × D.Result o} [D.HasStepFn stepFn] (opCharge : D.Op → ℕ) (hcharge : ∀ (s : D.State) (o : D.Op), D.valid s o → C.charge s o ≤ opCharge o) :
(C.toObliviousSequenceImplOfFn opCharge hcharge).charge = opCharge