Documentation

CslibFrontier.Languages.Probabilistic.RandomOracle.QueryHit

Query-membership equivalence between lazy memoization and eager random-oracle logs #

For an adaptive probabilistic client querying a uniform random function Q → V on finite Q and nonempty finite V, testing whether a target point s : Q appears among the keys of the association-list cache produced by memoize has the same distribution as sampling an eager table table ← uniformOfFintype (Q → V) and testing whether s appears in the runLog transcript.

Main results #

theorem Cslib.RandomOracle.runWith_memoize_mem_eq_eager_runLog {Q V α : Type} [Fintype Q] [DecidableEq Q] [Fintype V] [Nonempty V] (M : ProbOracleComp (fun (x : Q) => V) α) (s : Q) :
PMF.map (fun (x : α × List (Q × V)) => match x with | (fst, c) => decide (s ∈ List.map Prod.fst c)) (ProbOracleComp.runWith (memoize fun (x : Q) => Probability.PMF.uniformOfFintype V) M []) = (Probability.PMF.uniformOfFintype (Q → V)).bind fun (table : Q → V) => PMF.map (fun (x : α × List (Q × V)) => match x with | (fst, log) => decide (s ∈ List.map Prod.fst log)) (M.runLog fun (q : Q) => pure (table q)).eval

Testing whether s : Q belongs to the cached keys of a lazy memoize run from [] against uniformOfFintype V has the same distribution as sampling an eager table table ← uniformOfFintype (Q → V) and testing whether s belongs to the runLog query log.