Documentation

CslibFrontier.Crypto.Game.CloseTo.RandomOracle

The visible effect of one overwritten oracle entry #

The result of a memoized oracle computation can change only if it queries the overwritten key. The comparison projects away the private cache and charges the query probability in the unmodified execution. It includes overwriting an existing entry with a different value.

Main results #

This is an original application of the existing identical-until-bad and random-oracle laws.

theorem Cslib.RandomOracle.closeTo_run_interpret_memoize_cons {Query Value α : Type} [DecidableEq Query] (distribution : Query → PMF Value) (target : Query) (value : Value) (program : OracleComp (fun (x : Query) => Value) α) (cache : List (Query × Value)) :
Probability.CloseTo (PMF.map Prod.fst ((OracleComp.interpret (memoize distribution) program).run ((target, value) :: cache))) (PMF.map Prod.fst ((OracleComp.interpret (memoize distribution) program).run cache)) (((OracleComp.interpret (OracleComp.withTranscript (memoize distribution)) program).run (cache, [])).toOuterMeasure {(fst, fst_1, trace) : α × List (Query × Value) × OracleComp.Transcript fun (a : Query) => Value | ∃ entry ∈ trace, entry.fst = target})

Prepending one entry changes the visible result law by at most the probability that the unmodified execution queries its key. The final private caches are not compared.

theorem Cslib.RandomOracle.entry_mem_iff_lookup_isSome {Query Value : Type} [DecidableEq Query] (tr : List ((_ : Query) × Value)) (target : Query) :
(∃ entry ∈ tr, entry.fst = target) ↔ (List.lookup target (List.map (fun (entry : (_ : Query) × Value) => (entry.fst, entry.snd)) tr)).isSome = true

Transcript query membership agrees with key lookup on the pair projection.

Game.advantage bounds for adaptive random-oracle programming #

theorem Cslib.RandomOracle.coe_advantage_lazyProgramHandler_overwriteProgramHandler_choose_two_le {Query α Req Digest Log : Type} {Reply Coins : Req → Type} [BEq Query] [LawfulBEq Query] (dist : PMF Digest) (active : Req → Bool) (inactive : (req : Req) → active req = false → Log → PMF (Reply req × Log)) (samplePre : (req : Req) → PMF (Coins req)) (point : (req : Req) → Coins req → Query) (finish : (req : Req) → Coins req → Digest → Log → Reply req × Log) {δ : ENNReal} (hminEnt : ∀ (req : Req), active req = true → ∀ (q : Query), (PMF.map (point req) (samplePre req)) q ≤ δ) {program : OracleComp (OracleSpec.sum Reply fun (x : Query) => Digest) α} {q_S q_H : ℕ} (hqS : OracleComp.IsCostBounded (Sum.elim (fun (x : Req) => 1) fun (x : Query) => 0) program q_S) (hqH : OracleComp.IsCostBounded (Sum.elim (fun (x : Req) => 0) fun (x : Query) => 1) program q_H) (cache : List (Query × Digest)) (log : Log) (next : α × List (Query × Digest) × Log → Crypto.Game) :
↑(Crypto.Game.advantage (((OracleComp.interpret (lazyProgramHandler dist active inactive samplePre point finish) program).run (cache, log)).bind next) (((OracleComp.interpret (overwriteProgramHandler dist active inactive samplePre point finish) program).run (cache, log)).bind next)) ≤ ↑(q_S * cache.length + q_S * q_H + q_S.choose 2) * δ

Sharpened adaptive RO programming Game.advantage bound in ℝ≥0∞ (OracleComp): postprocessing lazyProgramHandler vs. overwriteProgramHandler by next changes the game's acceptance probability by at most (q_S * cache.length + q_S * q_H + q_S.choose 2) * δ.

theorem Cslib.RandomOracle.advantage_lazyProgramHandler_overwriteProgramHandler_choose_two_le {Query α Req Digest Log : Type} {Reply Coins : Req → Type} [BEq Query] [LawfulBEq Query] (dist : PMF Digest) (active : Req → Bool) (inactive : (req : Req) → active req = false → Log → PMF (Reply req × Log)) (samplePre : (req : Req) → PMF (Coins req)) (point : (req : Req) → Coins req → Query) (finish : (req : Req) → Coins req → Digest → Log → Reply req × Log) {δ : NNReal} (hminEnt : ∀ (req : Req), active req = true → ∀ (q : Query), (PMF.map (point req) (samplePre req)) q ≤ ↑δ) {program : OracleComp (OracleSpec.sum Reply fun (x : Query) => Digest) α} {q_S q_H : ℕ} (hqS : OracleComp.IsCostBounded (Sum.elim (fun (x : Req) => 1) fun (x : Query) => 0) program q_S) (hqH : OracleComp.IsCostBounded (Sum.elim (fun (x : Req) => 0) fun (x : Query) => 1) program q_H) (cache : List (Query × Digest)) (log : Log) (next : α × List (Query × Digest) × Log → Crypto.Game) :
Crypto.Game.advantage (((OracleComp.interpret (lazyProgramHandler dist active inactive samplePre point finish) program).run (cache, log)).bind next) (((OracleComp.interpret (overwriteProgramHandler dist active inactive samplePre point finish) program).run (cache, log)).bind next) ≤ ↑(q_S * cache.length + q_S * q_H + q_S.choose 2) * δ

Sharpened adaptive RO programming Game.advantage bound in ℝ≥0 (OracleComp).

theorem Cslib.RandomOracle.advantage_lazyProgramHandler_overwriteProgramHandler_le {Query α Req Digest Log : Type} {Reply Coins : Req → Type} [BEq Query] [LawfulBEq Query] (dist : PMF Digest) (active : Req → Bool) (inactive : (req : Req) → active req = false → Log → PMF (Reply req × Log)) (samplePre : (req : Req) → PMF (Coins req)) (point : (req : Req) → Coins req → Query) (finish : (req : Req) → Coins req → Digest → Log → Reply req × Log) {δ : NNReal} (hminEnt : ∀ (req : Req), active req = true → ∀ (q : Query), (PMF.map (point req) (samplePre req)) q ≤ ↑δ) {program : OracleComp (OracleSpec.sum Reply fun (x : Query) => Digest) α} {q_S q_H : ℕ} (hqS : OracleComp.IsCostBounded (Sum.elim (fun (x : Req) => 1) fun (x : Query) => 0) program q_S) (hqH : OracleComp.IsCostBounded (Sum.elim (fun (x : Req) => 0) fun (x : Query) => 1) program q_H) (cache : List (Query × Digest)) (log : Log) (next : α × List (Query × Digest) × Log → Crypto.Game) :
Crypto.Game.advantage (((OracleComp.interpret (lazyProgramHandler dist active inactive samplePre point finish) program).run (cache, log)).bind next) (((OracleComp.interpret (overwriteProgramHandler dist active inactive samplePre point finish) program).run (cache, log)).bind next) ≤ ↑(q_S * (cache.length + q_S + q_H)) * δ

Rectangular adaptive RO programming Game.advantage bound in ℝ≥0 (OracleComp): (q_S * (cache.length + q_S + q_H)) * δ form.

theorem Cslib.RandomOracle.advantage_runWith_lazyProgramHandler_overwriteProgramHandler_choose_two_le {Query α Req Digest Log : Type} {Reply Coins : Req → Type} [BEq Query] [LawfulBEq Query] (dist : PMF Digest) (active : Req → Bool) (inactive : (req : Req) → active req = false → Log → PMF (Reply req × Log)) (samplePre : (req : Req) → PMF (Coins req)) (point : (req : Req) → Coins req → Query) (finish : (req : Req) → Coins req → Digest → Log → Reply req × Log) {δ : NNReal} (hminEnt : ∀ (req : Req), active req = true → ∀ (q : Query), (PMF.map (point req) (samplePre req)) q ≤ ↑δ) {program : ProbOracleComp (OracleSpec.sum Reply fun (x : Query) => Digest) α} {q_S q_H : ℕ} (hqS : OracleComp.IsCostBounded (Sum.elim (fun (x : ℕ) => 0) (Sum.elim (fun (x : Req) => 1) fun (x : Query) => 0)) program q_S) (hqH : OracleComp.IsCostBounded (Sum.elim (fun (x : ℕ) => 0) (Sum.elim (fun (x : Req) => 0) fun (x : Query) => 1)) program q_H) (cache : List (Query × Digest)) (log : Log) (next : α × List (Query × Digest) × Log → Crypto.Game) :
Crypto.Game.advantage ((ProbOracleComp.runWith (lazyProgramHandler dist active inactive samplePre point finish) program (cache, log)).bind next) ((ProbOracleComp.runWith (overwriteProgramHandler dist active inactive samplePre point finish) program (cache, log)).bind next) ≤ ↑(q_S * cache.length + q_S * q_H + q_S.choose 2) * δ

Sharpened adaptive RO programming Game.advantage bound in ℝ≥0 (ProbOracleComp.runWith).