Documentation

CslibFrontier.Languages.Probabilistic.Oracle.Tabulate

Tabulating an oracle on a list of points #

ProbOracleComp.tabulate q ps queries the oracle at q p for each point p of the list ps, in order, and returns the table of answers, with 0 at points outside the list. Against a fixed function the table is that function on the list (interpret_tabulate), and the program makes at most ps.length queries, one per list entry (isQueryBounded_tabulate). More generally, its cost under any per-query weight is at most the sum of the entry costs (isCostBounded_tabulate), and when ps has no duplicates and a projection f ∘ q is injective, at most one query lands on each fibre of f (isCostBounded_tabulate_eq). A reduction that needs an oracle's values on a known finite set of points, for example every PRF input used by a construction, reads them all up front this way and then runs without further queries.

Main definitions #

Main results #

def Cslib.ProbOracleComp.tabulate {P Query R : Type} [DecidableEq P] [Zero R] (q : P → Query) :
List P → ProbOracleComp (fun (x : Query) => R) (P → R)

Query the oracle at q p for each p in ps, in order, and return the table p ↦ answer, which is 0 off the list.

theorem Cslib.ProbOracleComp.interpret_tabulate {P Query R : Type} [DecidableEq P] [Zero R] {m : Type → Type u_1} [Monad m] [LawfulMonad m] (random : (n : ℕ) → m (Fin (n + 1))) (f : Query → R) (q : P → Query) (ps : List P) :
OracleComp.interpret (OracleComp.sumHandler random fun (x : Query) => pure (f x)) (tabulate q ps) = pure fun (p : P) => if p ∈ ps then f (q p) else 0

Against a fixed function f, tabulation returns f ∘ q on the list and 0 off it, in every lawful monad supplying the private coins.

theorem Cslib.ProbOracleComp.isCostBounded_tabulate {P Query R : Type} [DecidableEq P] [Zero R] (cost : Query → ℕ) (q : P → Query) (ps : List P) :
OracleComp.IsCostBounded (Sum.elim (fun (x : ℕ) => 0) cost) (tabulate q ps) (List.map (cost ∘ q) ps).sum

Tabulation costs at most the sum of the query costs of the list entries.

theorem Cslib.ProbOracleComp.isCostBounded_tabulate_eq {P Query R : Type} [DecidableEq P] [Zero R] {T : Type} [DecidableEq T] (f : Query → T) (q : P → Query) {ps : List P} (hps : ps.Nodup) (hq : Function.Injective (f ∘ q)) (t : T) :
OracleComp.IsCostBounded (Sum.elim (fun (x : ℕ) => 0) fun (x : Query) => if f x = t then 1 else 0) (tabulate q ps) (if ∃ p ∈ ps, f (q p) = t then 1 else 0)

When ps has no duplicates and f ∘ q is injective, at most one tabulated query has image t under f.

theorem Cslib.ProbOracleComp.isCostBounded_tabulate_le_one {P Query R : Type} [DecidableEq P] [Zero R] {T : Type} [DecidableEq T] (f : Query → T) (q : P → Query) {ps : List P} (hps : ps.Nodup) (hq : Function.Injective (f ∘ q)) (t : T) :
OracleComp.IsCostBounded (Sum.elim (fun (x : ℕ) => 0) fun (x : Query) => if f x = t then 1 else 0) (tabulate q ps) 1

Uniform 1-bound form of isCostBounded_tabulate_eq: when ps has no duplicates and f ∘ q is injective, at most one tabulated query has image t under f for every t.

theorem Cslib.ProbOracleComp.isQueryBounded_tabulate {P Query R : Type} [DecidableEq P] [Zero R] (q : P → Query) (ps : List P) :

Tabulation makes at most ps.length external queries, one per list entry.