Documentation

CslibFrontier.Crypto.Computational.PseudorandomFunction.Domain

Word PRF games on a restricted input domain #

Each game uses a parameter-indexed validity predicate. The real oracle evaluates valid queries under a uniform key. The ideal oracle caches uniform fixed-width replies to valid queries. Both return the empty word for an invalid query.

Main definitions #

Main results #

References #

@[reducible, inline]
noncomputable abbrev Cslib.Crypto.cachedRandomFunctionOracle (valid : List Bool → Bool) (outLen : ℕ) :

Memoize uniform outLen-bit samples on valid queries, rejecting malformed words without altering the cache.

def Cslib.Crypto.prfOracleOn (valid : List Bool → Bool) (family : List Bool → List Bool → List Bool) (key query : List Bool) :

Keyed word oracle restricted to the message predicate valid: valid queries are evaluated under key, and invalid queries receive [].

noncomputable def Cslib.Crypto.prfRealGameOn (valid : ℕ → List Bool → Bool) (family : List Bool → List Bool → List Bool) (adversary : OracleDistinguisher) (n : ℕ) :

Real PRF experiment on the query domain valid n ([BS23], Attack Game 4.2, printed p. 132): sample a uniform n-bit key and answer valid queries with family key and invalid queries with [].

noncomputable def Cslib.Crypto.prfIdealGameOn (valid : ℕ → List Bool → Bool) (outLen : ℕ → ℕ) (adversary : OracleDistinguisher) (n : ℕ) :

Ideal PRF experiment on the query domain valid n with outLen n-bit outputs ([BS23], Attack Game 4.2, printed p. 132): answer valid queries with consistent lazy uniform outLen n-bit values and invalid queries with [].

theorem Cslib.Crypto.eval_prfRealGameOn_length_eq (inLen : ℕ → ℕ) (family : List Bool → List Bool → List Bool) (adversary : OracleDistinguisher) (n : ℕ) :
(prfRealGameOn (fun (m : ℕ) (q : List Bool) => q.length == inLen m) family adversary n).eval = (prfRealGame inLen family adversary n).eval

On fixed inLen n-bit inputs, prfRealGameOn is identical in distribution to prfRealGame.

theorem Cslib.Crypto.eval_prfIdealGameOn_eq_eager_of_codec {Q : Type} [Fintype Q] [DecidableEq Q] {valid : List Bool → Bool} {w : ℕ} (codec : OracleCodec Unit Q fun (x : Q) => BitString w) (hvalid : ∀ (query : List Bool), valid query = (codec.decodeQuery ((), query)).isSome) (hreply : ∀ (q : Q), codec.encodeReply q = { toFun := List.ofFn, inj' := ⋯ }) (program : Probability.WordOracleComp Unit Bool) :
(Prod.fst <$> (OracleComp.interpret (OracleComp.sumHandler (fun (k : ℕ) => StateT.lift (ProbComp.unifFin k)) fun (request : Unit × List Bool) => cachedRandomFunctionOracle valid w request.2) program).run []).eval = (Probability.PMF.uniformOfFintype (Q → BitString w)).bind fun (table : Q → BitString w) => ((codec.adapt program).run fun (q : Q) => pure (table q)).eval

For a finite query codec with raw fixed-width replies, the lazy domain-restricted ideal oracle has the same output law as an eagerly sampled uniform table.

theorem Cslib.Crypto.eval_prfIdealGameOn_length_eq (inLen outLen : ℕ → ℕ) (adversary : OracleDistinguisher) (n : ℕ) :
(prfIdealGameOn (fun (m : ℕ) (q : List Bool) => q.length == inLen m) outLen adversary n).eval = (prfIdealGame inLen outLen adversary n).eval

On fixed inLen n-bit inputs, prfIdealGameOn is identical in distribution to prfIdealGame.

structure Cslib.Crypto.PseudorandomFunctionOn (valid : ℕ → List Bool → Bool) (outLen : ℕ → ℕ) (family : List Bool → List Bool → List Bool) :

Uniform computational pseudorandom function over the parameter-indexed query domain valid with n-bit keys and outLen n-bit outputs ([BS23], Attack Game 4.2 and Definitions 4.2 and 4.4, printed pp. 132–133 and 139–141).