Documentation

CslibFrontier.Crypto.Primitives.PRG.Deterministic

Deterministic tests of generators #

The experiments of Attack Game 3.1 [BS23] against a deterministic test are densities: a test accepts the output of a generator on a uniform seed with probability the density of the seeds whose output it accepts (Cslib.Crypto.PRG.Generator.toReal_realExperiment_pure), and a uniform string with the density of the strings it accepts (Cslib.Crypto.PRG.Generator.toReal_idealExperiment_pure). On bit strings the advantage is the difference of the two counts, scaled by the numbers of seeds and strings (Cslib.Crypto.PRG.Generator.advantage_pure_eq).

Main results #

References #

theorem Cslib.Crypto.PRG.Generator.toReal_realExperiment_pure {Seed : Type u_1} {Output : Type u_2} [Fintype Seed] [Nonempty Seed] (G : Generator Seed Output) (test : Output → Bool) :
((G.realExperiment fun (y : Output) => PMF.pure (test y)) true).toReal = ↑{z : Seed | test (G z) = true}.dens

A deterministic test accepts the output of a generator on a uniform seed with probability the density of the seeds on which it accepts.

theorem Cslib.Crypto.PRG.Generator.toReal_idealExperiment_pure {Output : Type u_2} [Fintype Output] [Nonempty Output] (test : Output → Bool) :
((idealExperiment fun (y : Output) => PMF.pure (test y)) true).toReal = ↑{y : Output | test y = true}.dens

A deterministic test accepts a uniform string with probability the density of the strings it accepts.

theorem Cslib.Crypto.PRG.Generator.toReal_realExperiment_sub_toReal_idealExperiment_not {Seed : Type u_1} {Output : Type u_2} [Fintype Seed] [Nonempty Seed] [Fintype Output] [Nonempty Output] (G : Generator Seed Output) {test : Output → Bool} (havoid : ∀ (z : Seed), test (G z) = false) :
((G.realExperiment fun (y : Output) => PMF.pure !test y) true).toReal - ((idealExperiment fun (y : Output) => PMF.pure !test y) true).toReal = ↑{y : Output | test y = true}.dens

Dense tests that avoid a generator. If a deterministic test accepts no output of G, its negation accepts outputs of G with probability exceeding that of uniform strings by exactly the density of the strings the test accepts.

theorem Cslib.Crypto.PRG.Generator.advantage_pure_eq {k L : ℕ} (Gk : Generator (BitString k) (BitString L)) (test : BitString L → Bool) :
(Gk.advantage fun (y : BitString L) => PMF.pure (test y)) = |↑{z : BitString k | test (Gk z) = true}.card / 2 ^ k - ↑{y : BitString L | test y = true}.card / 2 ^ L|

The advantage of a deterministic test is the difference of the fractions of seeds and of strings it accepts.