Documentation

CslibFrontier.Crypto.Computational.PseudorandomFunction.PrefixFree

Prefix-free word-oracle distinguishers #

This module records word-oracle queries and expresses prefix-free admissibility against deterministic oracles of the declared reply width. Invalid queries are ignored by the prefix condition, and repeated identical valid queries are allowed.

To apply [BS23], Definition 4.5 (printed p. 152), one must also show that every query is nonempty and belongs to the PRF input domain.

Main definitions #

References #

def Cslib.Crypto.WordPrefixFree (valid : List Bool → Bool) (queries : List (List Bool)) :

A query list is prefix-free on valid when no valid query is a prefix of a distinct valid query ([BS23], Section 4.6.1, Definition 4.5, printed p. 152). Repeated identical queries are allowed.

noncomputable def Cslib.Crypto.wordQueryRunDist {α : Type} (oracle : List Bool → List Bool) :

Distribution of (output, query_log) pairs when program interacts with a deterministic word oracle oracle, recording word requests in chronological order.

@[simp]
theorem Cslib.Crypto.wordQueryRunDist_pure {α : Type} (oracle : List Bool → List Bool) (a : α) :

Returning a value records no external queries.

theorem Cslib.Crypto.wordQueryRunDist_sample_bind {α β : Type} (oracle : List Bool → List Bool) (sampler : ProbComp α) (next : α → Probability.WordOracleComp Unit β) :
(wordQueryRunDist oracle do let a ← ProbOracleComp.sample sampler next a) = sampler.eval.bind fun (a : α) => wordQueryRunDist oracle (next a)

A private sample affects the continuation but contributes no external query to the log.

theorem Cslib.Crypto.wordQueryRunDist_query_bind {α : Type} (oracle : List Bool → List Bool) (word : List Bool) (next : List Bool → Probability.WordOracleComp Unit α) :
(wordQueryRunDist oracle do let reply ← ProbOracleComp.query ((), word) next reply) = PMF.map (fun (x : α × List (List Bool)) => match x with | (a, log) => (a, word :: log)) (wordQueryRunDist oracle (next (oracle word)))

An external word query adds its request to the front of the continuation's log.

Forgetting the query log gives the ordinary run against the deterministic oracle.

theorem Cslib.Crypto.wordQueryRunDist_apply_eq_of_agree {α : Type} {oracle oracle' : List Bool → List Bool} (program : Probability.WordOracleComp Unit α) (result : α × List (List Bool)) (hagree : ∀ query ∈ result.2, oracle query = oracle' query) :
(wordQueryRunDist oracle program) result = (wordQueryRunDist oracle' program) result

The probability of a particular output and query log depends only on how the oracle answers the queries in that log, even when further queries depend on earlier replies.

theorem Cslib.Crypto.wordQueryRunDist_mapM_query_pure {α β : Type} (oracle : List Bool → List Bool) (queries : List (List Bool)) (read : List Bool → β) (finish : List β → α) :
(wordQueryRunDist oracle do let replies ← List.mapM (fun (word : List Bool) => read <$> ProbOracleComp.query ((), word)) queries pure (finish replies)) = PMF.pure (finish (List.map (read ∘ oracle) queries), queries)

Querying a fixed list of words records exactly that list. Against a deterministic oracle, processing the replies and then returning a value is also deterministic.

def Cslib.Crypto.IsPrefixFreeOn {α : Type} (valid : List Bool → Bool) (outLen : ℕ) (program : Probability.WordOracleComp Unit α) :

IsPrefixFreeOn valid outLen program holds when, against every deterministic word oracle that maps valid words to outLen-bit replies and invalid words to [], every supported query log of program satisfies WordPrefixFree valid. This is the domain-relative prefix condition from [BS23], Definition 4.5 (printed p. 152), which additionally requires every query to be nonempty and in the input domain.

def Cslib.Crypto.IsPrefixFreeOraclePPT (valid : ℕ → List Bool → Bool) (outLen : ℕ → ℕ) (adversary : OracleDistinguisher) :

Uniform strict oracle-PPT distinguishers whose queries are prefix-free on valid n with outLen n-bit valid replies at every security parameter n, in the sense of IsPrefixFreeOn.

theorem Cslib.Crypto.isPrefixFreeOn_of_fixedLength {α : Type} {valid : List Bool → Bool} {outLen : ℕ} (heqLen : ∀ (x y : List Bool), valid x = true → valid y = true → x.length = y.length) (program : Probability.WordOracleComp Unit α) :
IsPrefixFreeOn valid outLen program

Every program is prefix-free on a fixed-length domain, since equal-length prefixes are equal.

theorem Cslib.Crypto.isPrefixFreeOn_of_isQueryBounded_one {α : Type} (valid : List Bool → Bool) (outLen : ℕ) {program : Probability.WordOracleComp Unit α} (hq : ProbOracleComp.IsQueryBounded program 1) :
IsPrefixFreeOn valid outLen program

Every program making at most one query is prefix-free on every domain.

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

Prefix-free uniform computational pseudorandom function over valid ([BS23], Section 4.6.1, Definition 4.5, printed p. 152, and Section 6.4, printed p. 226): deterministic polynomial-time evaluation, output length outLen, and indistinguishability against the domain-relative class IsPrefixFreeOraclePPT valid outLen.