Documentation

CslibFrontier.Languages.Probabilistic.Oracle.Run

Running an oracle program against a probabilistic oracle #

A.run O runs A : ProbOracleComp spec α as a closed probabilistic program: each private sample is a fresh uniform draw, and each external query q runs O q. A deterministic oracle f is fun q => pure (f q), so a keyed experiment reads A.run fun x => pure (F key x). Security games write the challenger's oracle this way, instead of spelling out the sum handler that interprets the program.

Main definitions #

Main results #

def Cslib.ProbOracleComp.run {Query α : Type} {spec : Query → Type} (A : ProbOracleComp spec α) (O : (q : Query) → ProbComp (spec q)) :

Run A with fresh uniform private coins, answering each external query q with O q.

@[simp]
theorem Cslib.ProbOracleComp.run_pure {Query α : Type} {spec : Query → Type} (a : α) (O : (q : Query) → ProbComp (spec q)) :
(pure a).run O = pure a

Returning a value makes no call and draws no coins.

@[simp]
theorem Cslib.ProbOracleComp.run_bind {Query α β : Type} {spec : Query → Type} (A : ProbOracleComp spec α) (next : α → ProbOracleComp spec β) (O : (q : Query) → ProbComp (spec q)) :
(A >>= next).run O = do let a ← A.run O (next a).run O

A sequenced program runs its first part, then the continuation, with the same oracle.

@[simp]
theorem Cslib.ProbOracleComp.run_map {Query α β : Type} {spec : Query → Type} (f : α → β) (A : ProbOracleComp spec α) (O : (q : Query) → ProbComp (spec q)) :
(f <$> A).run O = f <$> A.run O

Deterministic postprocessing commutes with running.

@[simp]
theorem Cslib.ProbOracleComp.run_query {Query : Type} {spec : Query → Type} (q : Query) (O : (q : Query) → ProbComp (spec q)) :
(query q).run O = O q

A single external query is answered by the oracle.

@[simp]
theorem Cslib.ProbOracleComp.run_sample {Query α : Type} {spec : Query → Type} (program : ProbComp α) (O : (q : Query) → ProbComp (spec q)) :
(sample program).run O = program

A private sample is the sampled program itself.

@[simp]
theorem Cslib.ProbOracleComp.run_simulate {Query Query' α : Type} {spec : Query → Type} {spec' : Query' → Type} (handler : (q : Query) → ProbOracleComp spec' (spec q)) (A : ProbOracleComp spec α) (O : (q : Query') → ProbComp (spec' q)) :
(simulate handler A).run O = A.run fun (q : Query) => (handler q).run O

Running a substituted program runs each handler program against the oracle, with the same fresh private coins.

theorem Cslib.ProbOracleComp.eval_run {Query α : Type} {spec : Query → Type} (A : ProbOracleComp spec α) (O : (q : Query) → ProbComp (spec q)) :

The law of a run: interpret the program at the PMF level, sampling uniformly and answering each query with the law of the oracle's reply.