Documentation

CslibFrontier.Crypto.Computational.PseudorandomFunction.ToPRG

Pseudorandom generator from a word-level pseudorandom function #

Evaluating a word-level keyed family family at ℓ n distinct inLen n-bit points x n : Fin (ℓ n) ↪ BitString (inLen n) and concatenating the resulting outLen n-bit outputs gives prgFromPRF family ℓ inLen x of length ℓ n * outLen n ([BS23], §4.4.4, Theorem 4.8, p. 138).

The word reduction prgFromPRFReduction ℓ inLen outLen x A wraps PRF.prgReduction, so certifying it via isOraclePPT_prgFromPRFReduction also certifies PRF.prgReduction. Theorem PseudorandomFunctionOver.toPRG uses PseudorandomFunctionOver rather than the fixed-width PseudorandomFunction (inLen = outLen = id), which cannot expand at seed length 0.

Main definitions #

Main results #

References #

def Cslib.Crypto.prgFromPRF (family : List Bool → List Bool → List Bool) (ℓ inLen : ℕ → ℕ) (x : (n : ℕ) → Fin (ℓ n) ↪ BitString (inLen n)) (seed : List Bool) :

Evaluate family on a seed at the ℓ seed.length distinct inLen seed.length-bit domain points x seed.length 0, ..., x seed.length (ℓ seed.length - 1) and concatenate the replies ([BS23], §4.4.4, p. 138).

theorem Cslib.Crypto.length_prgFromPRF {family : List Bool → List Bool → List Bool} {ℓ inLen outLen : ℕ → ℕ} (hlength : ∀ (key query : List Bool), query.length = inLen key.length → (family key query).length = outLen key.length) (x : (n : ℕ) → Fin (ℓ n) ↪ BitString (inLen n)) (seed : List Bool) :
(prgFromPRF family ℓ inLen x seed).length = ℓ seed.length * outLen seed.length

On a seed of length n, prgFromPRF outputs ℓ n * outLen n bits whenever family produces outLen n-bit replies on valid inLen n-bit queries.

def Cslib.Crypto.prgFromPRFReduction (ℓ inLen outLen : ℕ → ℕ) (x : (n : ℕ) → Fin (ℓ n) ↪ BitString (inLen n)) (A : Distinguisher) :

Word-level PRF reduction wrapping the finite reduction PRF.prgReduction: queries the word oracle at x n 0, ..., x n (ℓ n - 1), truncating/padding each reply to outLen n bits via BitString.ofList (outLen n), concatenates the replies, and passes them to A n.

Efficiency of the word PRF-to-PRG reduction. For every uniform strict PPT distinguisher A, prgFromPRFReduction is uniform strict oracle PPT whenever the query list and output widths are deterministic polynomial time.

theorem Cslib.Crypto.eval_prgRealGame_prgFromPRF {family : List Bool → List Bool → List Bool} {ℓ inLen outLen : ℕ → ℕ} (hlength : ∀ (key query : List Bool), query.length = inLen key.length → (family key query).length = outLen key.length) (x : (n : ℕ) → Fin (ℓ n) ↪ BitString (inLen n)) (A : Distinguisher) (n : ℕ) :
(prgRealGame (prgFromPRF family ℓ inLen x) A n).eval = (prfRealGame inLen family (prgFromPRFReduction ℓ inLen outLen x A) n).eval

Against a keyed family whose answers to inLen n-bit queries under n-bit keys have outLen n bits, the word PRG real experiment equals the word PRF real experiment of prgFromPRFReduction.

theorem Cslib.Crypto.eval_prgIdealGame_prgFromPRFReduction (ℓ inLen outLen : ℕ → ℕ) (x : (n : ℕ) → Fin (ℓ n) ↪ BitString (inLen n)) (A : Distinguisher) (n : ℕ) :
(prgIdealGame (fun (n : ℕ) => ℓ n * outLen n) A n).eval = (prfIdealGame inLen outLen (prgFromPRFReduction ℓ inLen outLen x A) n).eval

The uniform-word PRG ideal experiment equals the word PRF ideal experiment of prgFromPRFReduction.

theorem Cslib.Crypto.advantage_prgFromPRF_eq {family : List Bool → List Bool → List Bool} {ℓ inLen outLen : ℕ → ℕ} (hlength : ∀ (key query : List Bool), query.length = inLen key.length → (family key query).length = outLen key.length) (x : (n : ℕ) → Fin (ℓ n) ↪ BitString (inLen n)) (A : Distinguisher) (n : ℕ) :
Game.advantage (prgRealGame (prgFromPRF family ℓ inLen x) A n).eval (prgIdealGame (fun (n : ℕ) => ℓ n * outLen n) A n).eval = Game.advantage (prfRealGame inLen family (prgFromPRFReduction ℓ inLen outLen x A) n).eval (prfIdealGame inLen outLen (prgFromPRFReduction ℓ inLen outLen x A) n).eval

Concrete word-level advantage identity ([BS23], Theorem 4.8, p. 138): for any keyed family whose answers to inLen n-bit queries under n-bit keys have outLen n bits and any word distinguisher A, the PRG distinguishing advantage against prgFromPRF family ℓ inLen x equals the PRF distinguishing advantage of prgFromPRFReduction ℓ inLen outLen x A.

The generated distribution prgFromPRF is computationally indistinguishable from uniform words of length ℓ n * outLen n whenever family is a PseudorandomFunctionOver inLen outLen and both the distinct query list and output width are deterministic polynomial time.

theorem Cslib.Crypto.PseudorandomFunctionOver.toPRG {family : List Bool → List Bool → List Bool} {ℓ inLen outLen : ℕ → ℕ} (hfamily : PseudorandomFunctionOver inLen outLen family) (x : (n : ℕ) → Fin (ℓ n) ↪ BitString (inLen n)) (hx : Turing.MultiTapeTM.ComputableInPolyTime (fun (n : ℕ) => List.ofFn fun (i : Fin (ℓ n)) => List.ofFn ((x n) i)) Turing.MultiTapeTM.encUnary (Turing.MultiTapeTM.encList Turing.MultiTapeTM.encBits)) (hstretch : ∀ (n : ℕ), n < ℓ n * outLen n) :
PseudorandomGenerator (prgFromPRF family ℓ inLen x) fun (n : ℕ) => ℓ n * outLen n

Pseudorandom generator from a pseudorandom function ([BS23], §4.4.4, Theorem 4.8, p. 138): evaluating a PseudorandomFunctionOver inLen outLen at ℓ n efficiently computable distinct inLen n-bit inputs yields a PseudorandomGenerator of output length ℓ n * outLen n, whenever ∀ n, n < ℓ n * outLen n.