Documentation

CslibFrontier.Computability.Probabilistic.RandomOracle.Programming

Native strict-PPT programmable random oracles #

This module implements the two semantic programming handlers from Languages.Probabilistic.RandomOracle.Programming as word programs. One state stores the memoized word random oracle together with arbitrary caller-defined log data. The exact per-call laws retain the reply, cache and log jointly, so the semantic programming bounds apply without a second probability argument.

The local resource contract separately bounds cached digest words and caller log growth. It is stronger than polynomial time of each call: repeated calls may not multiply the encoded state. The resulting certificates are uniform in the caller's runtime data. They do not charge a parameter-dependent static program or machine description; concrete families with installed program occurrences need an additional OracleTM-level description-size argument.

This is the plain-word specialization of the semantic handlers: requests, replies, coins, queries and digests are words. The native inactive callback omits the semantic proof argument active request = false; the semantic laws instantiate it as fun request _ log => ....

Main definitions #

Main results #

The two word operations of a programmable random oracle. program runs the caller-defined programming action; hash reads the memoized random oracle directly.

Instances For
    @[reducible, inline]

    Unary-rank encoding of the two operations: program has rank zero and hash rank one.

    Typed programming requests (.inl) and direct hash queries (.inr) on the two named word channels. Replies on both channels are words.

    Native state of a programmable word random oracle: an association-list cache of query/digest words and an arbitrary caller log.

    • cache : List (List Bool × List Bool)

      Memoized query/digest words. The first occurrence of a query is authoritative.

    • log : Log

      Caller-defined data updated by programming requests.

    theorem Cslib.RandomOracle.encProgrammingState_log_budget (Log : Type) (encLog : Log ↪ List Bool) {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {S✝ : γ✝ → ℕ} {g✝ : γ✝ → ProgrammingState Log} :
    Turing.MultiTapeTM.ComputableInSpace g✝ encIn✝ (encProgrammingState Log encLog) S✝ → Turing.MultiTapeTM.ComputableInSpace (fun (c : γ✝) => (g✝ c).log) encIn✝ encLog S✝
    theorem Cslib.RandomOracle.encProgrammingState_mk_deg (Log : Type) (encLog : Log ↪ List Bool) :
    Turing.MultiTapeTM.ComputableInDegree (fun (p : List (List Bool × List Bool) × Log) => { cache := p.1, log := p.2 }) (encProgrammingStateFields Log encLog) (encProgrammingState Log encLog) 1 1
    theorem Cslib.RandomOracle.encProgrammingState_cache_budget (Log : Type) (encLog : Log ↪ List Bool) {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {S✝ : γ✝ → ℕ} {g✝ : γ✝ → ProgrammingState Log} :
    @[reducible, inline]

    The tuple of the fields of encProgrammingState.

    theorem Cslib.RandomOracle.encProgrammingState_log_polyTime (Log : Type) (encLog : Log ↪ List Bool) {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {g✝ : γ✝ → ProgrammingState Log} :
    Turing.MultiTapeTM.ComputableInPolyTime g✝ encIn✝ (encProgrammingState Log encLog) → Turing.MultiTapeTM.ComputableInPolyTime (fun (c : γ✝) => (g✝ c).log) encIn✝ encLog
    theorem Cslib.RandomOracle.encProgrammingState_mk_budget (Log : Type) (encLog : Log ↪ List Bool) {γ : Type} {encIn : γ ↪ List Bool} {budget : γ → ℕ} {x0 : γ → List (List Bool × List Bool)} {x1 : γ → Log} (h0 : Turing.MultiTapeTM.ComputableInSpace x0 encIn (Probability.encMemoCache Turing.MultiTapeTM.encBits Turing.MultiTapeTM.encBits) budget) (h1 : Turing.MultiTapeTM.ComputableInSpace x1 encIn encLog budget) :
    Turing.MultiTapeTM.ComputableInSpace (fun (x : γ) => { cache := x0 x, log := x1 x }) encIn (encProgrammingState Log encLog) budget
    theorem Cslib.RandomOracle.encProgrammingState_mk_inO (Log : Type) (encLog : Log ↪ List Bool) {γ : Type} {encIn : γ ↪ List Bool} {x0 : γ → List (List Bool × List Bool)} {T0 S0 : γ → ℕ} {x1 : γ → Log} {T1 S1 : γ → ℕ} (h0 : Turing.MultiTapeTM.ComputableInO x0 encIn (Probability.encMemoCache Turing.MultiTapeTM.encBits Turing.MultiTapeTM.encBits) T0 S0) (h1 : Turing.MultiTapeTM.ComputableInO x1 encIn encLog T1 S1) :
    Turing.MultiTapeTM.ComputableInO (fun (x : γ) => { cache := x0 x, log := x1 x }) encIn (encProgrammingState Log encLog) (fun (x : γ) => T0 x + T1 x) fun (x : γ) => S0 x + S1 x

    Encoding of a programmable state: the framed cache encoding followed by the caller log. Each cache entry contains its framed query word followed by its digest word.

    def Cslib.RandomOracle.lazyProgramWordHandler {Caller Log : Type} (dist : Caller → ProbComp (List Bool)) (active : Caller → List Bool → Bool) (inactive : Caller → List Bool → Log → ProbComp (List Bool × Log)) (samplePre : Caller → List Bool → ProbComp (List Bool)) (point : Caller → List Bool → List Bool → List Bool) (finish : Caller → List Bool → List Bool → List Bool → Log → List Bool × Log) (caller : Caller) (request : ProgrammingOp × List Bool) :

    Executable lazy programmable word oracle. Active programming calls sample preimage coins, query the memoized random oracle at the computed point and update the caller log. Inactive calls run inactive; direct hash calls use the same cache.

    def Cslib.RandomOracle.overwriteProgramWordHandler {Caller Log : Type} (dist : Caller → ProbComp (List Bool)) (active : Caller → List Bool → Bool) (inactive : Caller → List Bool → Log → ProbComp (List Bool × Log)) (samplePre : Caller → List Bool → ProbComp (List Bool)) (point : Caller → List Bool → List Bool → List Bool) (finish : Caller → List Bool → List Bool → List Bool → Log → List Bool × Log) (caller : Caller) (request : ProgrammingOp × List Bool) :

    Executable freshly programmed word oracle. It differs from lazyProgramWordHandler only on active programming calls, which sample a fresh digest and prepend the computed point without a cache lookup.

    theorem Cslib.RandomOracle.eval_lazyProgramWordHandler {Caller Log : Type} (dist : Caller → ProbComp (List Bool)) (active : Caller → List Bool → Bool) (inactive : Caller → List Bool → Log → ProbComp (List Bool × Log)) (samplePre : Caller → List Bool → ProbComp (List Bool)) (point : Caller → List Bool → List Bool → List Bool) (finish : Caller → List Bool → List Bool → List Bool → Log → List Bool × Log) (caller : Caller) (request : ProgrammingOp × List Bool) (state : ProgrammingState Log) :
    (lazyProgramWordHandler dist active inactive samplePre point finish caller request state).eval = PMF.map (fun (x : List Bool × List (List Bool × List Bool) × Log) => match x with | (reply, cache, log) => (reply, { cache := cache, log := log })) (programmingCodec.wordOracle (lazyProgramHandler (dist caller).eval (active caller) (fun (req : List Bool) (x : active caller req = false) (log : Log) => (inactive caller req log).eval) (fun (req : List Bool) => (samplePre caller req).eval) (point caller) (finish caller)) request (state.cache, state.log))

    A native lazy-programming call has exactly the joint reply/cache/log law of lazyProgramHandler, through programmingCodec.

    theorem Cslib.RandomOracle.eval_overwriteProgramWordHandler {Caller Log : Type} (dist : Caller → ProbComp (List Bool)) (active : Caller → List Bool → Bool) (inactive : Caller → List Bool → Log → ProbComp (List Bool × Log)) (samplePre : Caller → List Bool → ProbComp (List Bool)) (point : Caller → List Bool → List Bool → List Bool) (finish : Caller → List Bool → List Bool → List Bool → Log → List Bool × Log) (caller : Caller) (request : ProgrammingOp × List Bool) (state : ProgrammingState Log) :
    (overwriteProgramWordHandler dist active inactive samplePre point finish caller request state).eval = PMF.map (fun (x : List Bool × List (List Bool × List Bool) × Log) => match x with | (reply, cache, log) => (reply, { cache := cache, log := log })) (programmingCodec.wordOracle (overwriteProgramHandler (dist caller).eval (active caller) (fun (req : List Bool) (x : active caller req = false) (log : Log) => (inactive caller req log).eval) (fun (req : List Bool) => (samplePre caller req).eval) (point caller) (finish caller)) request (state.cache, state.log))

    A native overwrite-programming call has exactly the joint reply/cache/log law of overwriteProgramHandler, through programmingCodec.

    theorem Cslib.RandomOracle.runWith_lazyProgramWordHandler {Caller Log α : Type} (program : Probability.WordOracleComp ProgrammingOp α) (dist : Caller → ProbComp (List Bool)) (active : Caller → List Bool → Bool) (inactive : Caller → List Bool → Log → ProbComp (List Bool × Log)) (samplePre : Caller → List Bool → ProbComp (List Bool)) (point : Caller → List Bool → List Bool → List Bool) (finish : Caller → List Bool → List Bool → List Bool → Log → List Bool × Log) (caller : Caller) (cache : List (List Bool × List Bool)) (log : Log) :
    PMF.map (fun (x : α × List (List Bool × List Bool) × Log) => match x with | (result, cache, log) => (result, { cache := cache, log := log })) (ProbOracleComp.runWith (lazyProgramHandler (dist caller).eval (active caller) (fun (request : List Bool) (x : active caller request = false) (currentLog : Log) => (inactive caller request currentLog).eval) (fun (request : List Bool) => (samplePre caller request).eval) (point caller) (finish caller)) (programmingCodec.adapt program) (cache, log)) = ProbOracleComp.runWith (fun (request : ProgrammingOp × List Bool) (state : ProgrammingState Log) => (lazyProgramWordHandler dist active inactive samplePre point finish caller request state).eval) program { cache := cache, log := log }

    Adaptive typed execution against lazyProgramHandler has exactly the joint result/cache/log law of native execution against lazyProgramWordHandler.

    theorem Cslib.RandomOracle.runWith_overwriteProgramWordHandler {Caller Log α : Type} (program : Probability.WordOracleComp ProgrammingOp α) (dist : Caller → ProbComp (List Bool)) (active : Caller → List Bool → Bool) (inactive : Caller → List Bool → Log → ProbComp (List Bool × Log)) (samplePre : Caller → List Bool → ProbComp (List Bool)) (point : Caller → List Bool → List Bool → List Bool) (finish : Caller → List Bool → List Bool → List Bool → Log → List Bool × Log) (caller : Caller) (cache : List (List Bool × List Bool)) (log : Log) :
    PMF.map (fun (x : α × List (List Bool × List Bool) × Log) => match x with | (result, cache, log) => (result, { cache := cache, log := log })) (ProbOracleComp.runWith (overwriteProgramHandler (dist caller).eval (active caller) (fun (request : List Bool) (x : active caller request = false) (currentLog : Log) => (inactive caller request currentLog).eval) (fun (request : List Bool) => (samplePre caller request).eval) (point caller) (finish caller)) (programmingCodec.adapt program) (cache, log)) = ProbOracleComp.runWith (fun (request : ProgrammingOp × List Bool) (state : ProgrammingState Log) => (overwriteProgramWordHandler dist active inactive samplePre point finish caller request state).eval) program { cache := cache, log := log }

    Adaptive typed execution against overwriteProgramHandler has exactly the joint result/cache/log law of native execution against overwriteProgramWordHandler.

    Strict-PPT certificates #

    theorem Cslib.RandomOracle.isPPTOn_lazyProgramWordHandler {Caller Log : Type} (input : Caller ↪ List Bool) (encLog : Log ↪ List Bool) (dist : Caller → ProbComp (List Bool)) (active : Caller → List Bool → Bool) (inactive : Caller → List Bool → Log → ProbComp (List Bool × Log)) (samplePre : Caller → List Bool → ProbComp (List Bool)) (point : Caller → List Bool → List Bool → List Bool) (finish : Caller → List Bool → List Bool → List Bool → Log → List Bool × Log) (hdist : Probability.IsPPTOn input Turing.MultiTapeTM.encBits dist) (hactive : Turing.MultiTapeTM.ComputableInPolyTime (fun (p : Caller × List Bool) => active p.1 p.2) (Turing.MultiTapeTM.encPair input Turing.MultiTapeTM.encBits) Turing.MultiTapeTM.encBool) (hinactive : Probability.IsPPTOn (Turing.MultiTapeTM.encPair (Turing.MultiTapeTM.encPair input Turing.MultiTapeTM.encBits) encLog) (Turing.MultiTapeTM.encPair Turing.MultiTapeTM.encBits encLog) fun (p : (Caller × List Bool) × Log) => inactive p.1.1 p.1.2 p.2) (hsamplePre : Probability.IsPPTOn (Turing.MultiTapeTM.encPair input Turing.MultiTapeTM.encBits) Turing.MultiTapeTM.encBits fun (p : Caller × List Bool) => samplePre p.1 p.2) (hpoint : Turing.MultiTapeTM.ComputableInPolyTime (fun (p : (Caller × List Bool) × List Bool) => point p.1.1 p.1.2 p.2) (Turing.MultiTapeTM.encPair (Turing.MultiTapeTM.encPair input Turing.MultiTapeTM.encBits) Turing.MultiTapeTM.encBits) Turing.MultiTapeTM.encBits) (hfinish : Turing.MultiTapeTM.ComputableInPolyTime (fun (p : (((Caller × List Bool) × List Bool) × List Bool) × Log) => finish p.1.1.1.1 p.1.1.1.2 p.1.1.2 p.1.2 p.2) (Turing.MultiTapeTM.encPair (Turing.MultiTapeTM.encPair (Turing.MultiTapeTM.encPair (Turing.MultiTapeTM.encPair input Turing.MultiTapeTM.encBits) Turing.MultiTapeTM.encBits) Turing.MultiTapeTM.encBits) encLog) (Turing.MultiTapeTM.encPair Turing.MultiTapeTM.encBits encLog)) :

    The lazy programmable word handler is strict PPT when each caller component is. The certificate charges the complete incoming and returned cache and log.

    theorem Cslib.RandomOracle.isPPTOn_overwriteProgramWordHandler {Caller Log : Type} (input : Caller ↪ List Bool) (encLog : Log ↪ List Bool) (dist : Caller → ProbComp (List Bool)) (active : Caller → List Bool → Bool) (inactive : Caller → List Bool → Log → ProbComp (List Bool × Log)) (samplePre : Caller → List Bool → ProbComp (List Bool)) (point : Caller → List Bool → List Bool → List Bool) (finish : Caller → List Bool → List Bool → List Bool → Log → List Bool × Log) (hdist : Probability.IsPPTOn input Turing.MultiTapeTM.encBits dist) (hactive : Turing.MultiTapeTM.ComputableInPolyTime (fun (p : Caller × List Bool) => active p.1 p.2) (Turing.MultiTapeTM.encPair input Turing.MultiTapeTM.encBits) Turing.MultiTapeTM.encBool) (hinactive : Probability.IsPPTOn (Turing.MultiTapeTM.encPair (Turing.MultiTapeTM.encPair input Turing.MultiTapeTM.encBits) encLog) (Turing.MultiTapeTM.encPair Turing.MultiTapeTM.encBits encLog) fun (p : (Caller × List Bool) × Log) => inactive p.1.1 p.1.2 p.2) (hsamplePre : Probability.IsPPTOn (Turing.MultiTapeTM.encPair input Turing.MultiTapeTM.encBits) Turing.MultiTapeTM.encBits fun (p : Caller × List Bool) => samplePre p.1 p.2) (hpoint : Turing.MultiTapeTM.ComputableInPolyTime (fun (p : (Caller × List Bool) × List Bool) => point p.1.1 p.1.2 p.2) (Turing.MultiTapeTM.encPair (Turing.MultiTapeTM.encPair input Turing.MultiTapeTM.encBits) Turing.MultiTapeTM.encBits) Turing.MultiTapeTM.encBits) (hfinish : Turing.MultiTapeTM.ComputableInPolyTime (fun (p : (((Caller × List Bool) × List Bool) × List Bool) × Log) => finish p.1.1.1.1 p.1.1.1.2 p.1.1.2 p.1.2 p.2) (Turing.MultiTapeTM.encPair (Turing.MultiTapeTM.encPair (Turing.MultiTapeTM.encPair (Turing.MultiTapeTM.encPair input Turing.MultiTapeTM.encBits) Turing.MultiTapeTM.encBits) Turing.MultiTapeTM.encBits) encLog) (Turing.MultiTapeTM.encPair Turing.MultiTapeTM.encBits encLog)) :

    The overwrite programmable word handler is strict PPT when each caller component is. The certificate charges the complete incoming and returned cache and log.

    Per-call resource contract #

    def Cslib.RandomOracle.ProgrammingInvariant {Caller Log : Type} (digestBound : Caller → ℕ) (logInvariant : Caller → Log → Prop) (caller : Caller) (state : ProgrammingState Log) :

    State invariant used by the programmable-oracle resource contract: cached digests satisfy the caller bound and the caller-defined log invariant holds. The representation is kept opaque; use ProgrammingInvariant.intro to establish it.

    theorem Cslib.RandomOracle.ProgrammingInvariant.intro {Caller Log : Type} (digestBound : Caller → ℕ) (logInvariant : Caller → Log → Prop) (caller : Caller) (state : ProgrammingState Log) (hcache : ∀ entry ∈ state.cache, entry.2.length ≤ digestBound caller) (hlog : logInvariant caller state.log) :
    ProgrammingInvariant digestBound logInvariant caller state

    Establish the programmable state invariant from its cache and log obligations.

    def Cslib.RandomOracle.programmingResources {Caller : Type} (digestBound : Caller → ℕ) (pointBound replyBound logGrowth : Caller → List Bool → ℕ) (caller : Caller) (request : List Bool) :

    Additive allowance for one programmable-oracle call. It charges the reply and request words, the programmed point, the sampled digest, fixed framing overhead and caller log growth.

    theorem Cslib.RandomOracle.computableInPolyTime_programmingResources {Caller : Type} (input : Caller ↪ List Bool) (digestBound : Caller → ℕ) (pointBound replyBound logGrowth : Caller → List Bool → ℕ) (hdigestBound : Turing.MultiTapeTM.ComputableInPolyTime digestBound input Turing.MultiTapeTM.encUnary) (hpointBound : Turing.MultiTapeTM.ComputableInPolyTime (fun (p : Caller × List Bool) => pointBound p.1 p.2) (Turing.MultiTapeTM.encPair input Turing.MultiTapeTM.encBits) Turing.MultiTapeTM.encUnary) (hreplyBound : Turing.MultiTapeTM.ComputableInPolyTime (fun (p : Caller × List Bool) => replyBound p.1 p.2) (Turing.MultiTapeTM.encPair input Turing.MultiTapeTM.encBits) Turing.MultiTapeTM.encUnary) (hlogGrowth : Turing.MultiTapeTM.ComputableInPolyTime (fun (p : Caller × List Bool) => logGrowth p.1 p.2) (Turing.MultiTapeTM.encPair input Turing.MultiTapeTM.encBits) Turing.MultiTapeTM.encUnary) :

    The shared per-call allowance is polynomial-time computable from certificates for its four caller-supplied bounds. This lets finite source-operation adapters take maxima of the opaque allowance at their framed payloads without duplicating its formula.

    theorem Cslib.RandomOracle.lazyProgramWordHandler_support {Caller Log : Type} (encLog : Log ↪ List Bool) (dist : Caller → ProbComp (List Bool)) (active : Caller → List Bool → Bool) (inactive : Caller → List Bool → Log → ProbComp (List Bool × Log)) (samplePre : Caller → List Bool → ProbComp (List Bool)) (point : Caller → List Bool → List Bool → List Bool) (finish : Caller → List Bool → List Bool → List Bool → Log → List Bool × Log) (digestBound : Caller → ℕ) (pointBound replyBound logGrowth : Caller → List Bool → ℕ) (logInvariant : Caller → Log → Prop) (hdist : ∀ (caller : Caller), ∀ digest ∈ (dist caller).eval.support, digest.length ≤ digestBound caller) (hpoint : ∀ (caller : Caller) (request coins : List Bool), coins ∈ (samplePre caller request).eval.support → (point caller request coins).length ≤ pointBound caller request) (hinactive : ∀ (caller : Caller) (request : List Bool) (log : Log), logInvariant caller log → ∀ result ∈ (inactive caller request log).eval.support, logInvariant caller result.2 ∧ result.1.length ≤ replyBound caller request ∧ (encLog result.2).length ≤ (encLog log).length + logGrowth caller request) (hfinish : ∀ (caller : Caller) (request coins : List Bool), coins ∈ (samplePre caller request).eval.support → ∀ (digest : List Bool), digest.length ≤ digestBound caller → ∀ (log : Log), logInvariant caller log → logInvariant caller (finish caller request coins digest log).2 ∧ (finish caller request coins digest log).1.length ≤ replyBound caller request ∧ (encLog (finish caller request coins digest log).2).length ≤ (encLog log).length + logGrowth caller request) (caller : Caller) (request : ProgrammingOp × List Bool) (state : ProgrammingState Log) (hstate : ProgrammingInvariant digestBound logInvariant caller state) (result : List Bool × ProgrammingState Log) (hresult : result ∈ (lazyProgramWordHandler dist active inactive samplePre point finish caller request state).eval.support) :
    ProgrammingInvariant digestBound logInvariant caller result.2 ∧ result.1.length ≤ programmingResources digestBound pointBound replyBound logGrowth caller request.2 ∧ ((encProgrammingState Log encLog) result.2).length ≤ ((encProgrammingState Log encLog) state).length + programmingResources digestBound pointBound replyBound logGrowth caller request.2

    Every supported lazy programmable-oracle call preserves ProgrammingInvariant, bounds the reply word and grows the complete encoded cache/log state by at most programmingResources.

    Whole-program strict-PPT certificates #

    theorem Cslib.RandomOracle.isPPTOn_run_lazyProgramWordHandler {Caller Log β : Type} (input : Caller ↪ List Bool) (output : β ↪ List Bool) (encLog : Log ↪ List Bool) (program : ℕ → List Bool → Probability.WordOracleComp ProgrammingOp β) (dist : Caller → ProbComp (List Bool)) (active : Caller → List Bool → Bool) (inactive : Caller → List Bool → Log → ProbComp (List Bool × Log)) (samplePre : Caller → List Bool → ProbComp (List Bool)) (point : Caller → List Bool → List Bool → List Bool) (finish : Caller → List Bool → List Bool → List Bool → Log → List Bool × Log) (prepare : Caller → ℕ × List Bool) (initial : Caller → ProgrammingState Log) (digestBound : Caller → ℕ) (pointBound replyBound logGrowth : Caller → List Bool → ℕ) (logInvariant : Caller → Log → Prop) (hprogram : Probability.IsOraclePPT output program) (hprepare : Turing.MultiTapeTM.ComputableInPolyTime prepare input (Turing.MultiTapeTM.encPair Turing.MultiTapeTM.encUnary Turing.MultiTapeTM.encBits)) (hhandler : Probability.IsPPTOn (Probability.encHandlerCall input encProgrammingOp (encProgrammingState Log encLog)) (Turing.MultiTapeTM.encPair Turing.MultiTapeTM.encBits (encProgrammingState Log encLog)) fun (p : Caller × (ProgrammingOp × List Bool) × ProgrammingState Log) => lazyProgramWordHandler dist active inactive samplePre point finish p.1 p.2.1 p.2.2) (hinitial : Turing.MultiTapeTM.ComputableInPolyTime initial input (encProgrammingState Log encLog)) (hdigestBound : Turing.MultiTapeTM.ComputableInPolyTime digestBound input Turing.MultiTapeTM.encUnary) (hpointBound : Turing.MultiTapeTM.ComputableInPolyTime (fun (p : Caller × List Bool) => pointBound p.1 p.2) (Turing.MultiTapeTM.encPair input Turing.MultiTapeTM.encBits) Turing.MultiTapeTM.encUnary) (hreplyBound : Turing.MultiTapeTM.ComputableInPolyTime (fun (p : Caller × List Bool) => replyBound p.1 p.2) (Turing.MultiTapeTM.encPair input Turing.MultiTapeTM.encBits) Turing.MultiTapeTM.encUnary) (hlogGrowth : Turing.MultiTapeTM.ComputableInPolyTime (fun (p : Caller × List Bool) => logGrowth p.1 p.2) (Turing.MultiTapeTM.encPair input Turing.MultiTapeTM.encBits) Turing.MultiTapeTM.encUnary) (hdist : ∀ (caller : Caller), ∀ digest ∈ (dist caller).eval.support, digest.length ≤ digestBound caller) (hpoint : ∀ (caller : Caller) (request coins : List Bool), coins ∈ (samplePre caller request).eval.support → (point caller request coins).length ≤ pointBound caller request) (hinactive : ∀ (caller : Caller) (request : List Bool) (log : Log), logInvariant caller log → ∀ result ∈ (inactive caller request log).eval.support, logInvariant caller result.2 ∧ result.1.length ≤ replyBound caller request ∧ (encLog result.2).length ≤ (encLog log).length + logGrowth caller request) (hfinish : ∀ (caller : Caller) (request coins : List Bool), coins ∈ (samplePre caller request).eval.support → ∀ (digest : List Bool), digest.length ≤ digestBound caller → ∀ (log : Log), logInvariant caller log → logInvariant caller (finish caller request coins digest log).2 ∧ (finish caller request coins digest log).1.length ≤ replyBound caller request ∧ (encLog (finish caller request coins digest log).2).length ≤ (encLog log).length + logGrowth caller request) (hinitCache : ∀ (caller : Caller), ∀ entry ∈ (initial caller).cache, entry.2.length ≤ digestBound caller) (hinitLog : ∀ (caller : Caller), logInvariant caller (initial caller).log) :
    Probability.IsPPTOn input (Turing.MultiTapeTM.encPair output (encProgrammingState Log encLog)) fun (caller : Caller) => (ProbOracleComp.runState (program (prepare caller).1 (prepare caller).2) (lazyProgramWordHandler dist active inactive samplePre point finish caller)).run (initial caller)

    Running a uniform strict oracle-PPT program against the lazy programmable word handler is strict PPT, including its final cache and log. The component bounds form a local additive storage contract. This theorem charges runtime caller data but not a parameter-dependent static description of program; such descriptions require a separate OracleTM-level size argument.

    theorem Cslib.RandomOracle.isPPTOn_run_overwriteProgramWordHandler {Caller Log β : Type} (input : Caller ↪ List Bool) (output : β ↪ List Bool) (encLog : Log ↪ List Bool) (program : ℕ → List Bool → Probability.WordOracleComp ProgrammingOp β) (dist : Caller → ProbComp (List Bool)) (active : Caller → List Bool → Bool) (inactive : Caller → List Bool → Log → ProbComp (List Bool × Log)) (samplePre : Caller → List Bool → ProbComp (List Bool)) (point : Caller → List Bool → List Bool → List Bool) (finish : Caller → List Bool → List Bool → List Bool → Log → List Bool × Log) (prepare : Caller → ℕ × List Bool) (initial : Caller → ProgrammingState Log) (digestBound : Caller → ℕ) (pointBound replyBound logGrowth : Caller → List Bool → ℕ) (logInvariant : Caller → Log → Prop) (hprogram : Probability.IsOraclePPT output program) (hprepare : Turing.MultiTapeTM.ComputableInPolyTime prepare input (Turing.MultiTapeTM.encPair Turing.MultiTapeTM.encUnary Turing.MultiTapeTM.encBits)) (hhandler : Probability.IsPPTOn (Probability.encHandlerCall input encProgrammingOp (encProgrammingState Log encLog)) (Turing.MultiTapeTM.encPair Turing.MultiTapeTM.encBits (encProgrammingState Log encLog)) fun (p : Caller × (ProgrammingOp × List Bool) × ProgrammingState Log) => overwriteProgramWordHandler dist active inactive samplePre point finish p.1 p.2.1 p.2.2) (hinitial : Turing.MultiTapeTM.ComputableInPolyTime initial input (encProgrammingState Log encLog)) (hdigestBound : Turing.MultiTapeTM.ComputableInPolyTime digestBound input Turing.MultiTapeTM.encUnary) (hpointBound : Turing.MultiTapeTM.ComputableInPolyTime (fun (p : Caller × List Bool) => pointBound p.1 p.2) (Turing.MultiTapeTM.encPair input Turing.MultiTapeTM.encBits) Turing.MultiTapeTM.encUnary) (hreplyBound : Turing.MultiTapeTM.ComputableInPolyTime (fun (p : Caller × List Bool) => replyBound p.1 p.2) (Turing.MultiTapeTM.encPair input Turing.MultiTapeTM.encBits) Turing.MultiTapeTM.encUnary) (hlogGrowth : Turing.MultiTapeTM.ComputableInPolyTime (fun (p : Caller × List Bool) => logGrowth p.1 p.2) (Turing.MultiTapeTM.encPair input Turing.MultiTapeTM.encBits) Turing.MultiTapeTM.encUnary) (hdist : ∀ (caller : Caller), ∀ digest ∈ (dist caller).eval.support, digest.length ≤ digestBound caller) (hpoint : ∀ (caller : Caller) (request coins : List Bool), coins ∈ (samplePre caller request).eval.support → (point caller request coins).length ≤ pointBound caller request) (hinactive : ∀ (caller : Caller) (request : List Bool) (log : Log), logInvariant caller log → ∀ result ∈ (inactive caller request log).eval.support, logInvariant caller result.2 ∧ result.1.length ≤ replyBound caller request ∧ (encLog result.2).length ≤ (encLog log).length + logGrowth caller request) (hfinish : ∀ (caller : Caller) (request coins : List Bool), coins ∈ (samplePre caller request).eval.support → ∀ (digest : List Bool), digest.length ≤ digestBound caller → ∀ (log : Log), logInvariant caller log → logInvariant caller (finish caller request coins digest log).2 ∧ (finish caller request coins digest log).1.length ≤ replyBound caller request ∧ (encLog (finish caller request coins digest log).2).length ≤ (encLog log).length + logGrowth caller request) (hinitCache : ∀ (caller : Caller), ∀ entry ∈ (initial caller).cache, entry.2.length ≤ digestBound caller) (hinitLog : ∀ (caller : Caller), logInvariant caller (initial caller).log) :
    Probability.IsPPTOn input (Turing.MultiTapeTM.encPair output (encProgrammingState Log encLog)) fun (caller : Caller) => (ProbOracleComp.runState (program (prepare caller).1 (prepare caller).2) (overwriteProgramWordHandler dist active inactive samplePre point finish caller)).run (initial caller)

    Running a uniform strict oracle-PPT program against the overwrite programmable word handler is strict PPT, including its final cache and log. It uses the same local additive resource contract and the same static-description-size limitation as isPPTOn_run_lazyProgramWordHandler.