Documentation

CslibFrontier.Crypto.Computational.Stretch.Prefix

Prefixes of the emitted PRG stream #

forwardIterate appends a reversed final seed after its emitted bits. Under the global one-bit expansion promise, taking exactly the number of rounds discards that seed. These emitted prefixes have exact length and agree across different stopping times. The complete forwardIterate output is not claimed to be prefix-consistent.

Main results #

References #

These are consequences of the existing stretch construction and security theorem. The emitted prefix is the pad used by the stream-cipher construction in [BS23], Section 3.2, Theorem 3.1, printed pp. 48–51. This module supplies the prefix prerequisite, not a cipher-security theorem or a message-domain extension.

theorem Cslib.Crypto.PRGStretch.length_take_forwardIterate {generator : List Bool → List Bool} (hlen : ∀ (s : List Bool), (generator s).length = s.length + 1) (seed : List Bool) (count : ℕ) :
(List.take count (forwardIterate generator count seed)).length = count

Taking the emitted portion discards the final seed, including at zero seed width or rounds.

theorem Cslib.Crypto.PRGStretch.take_forwardIterate_eq_flatten_emitBit {generator : List Bool → List Bool} (hlen : ∀ (s : List Bool), (generator s).length = s.length + 1) (seed : List Bool) (count : ℕ) :
List.take count (forwardIterate generator count seed) = (List.map (fun (i : ℕ) => emitBit generator (seedAt generator seed i)) (List.range count)).flatten

The emitted prefix is the output σ₁ σ₂ ⋯ σ_count of [Gol07c], Construction 8.7 (Eq. (8.8)): starting from x₀ = seed, σᵢ₊₁ is the last bit of generator xᵢ (emitBit) and xᵢ₊₁ is the rest of that output (seedStep, so xᵢ = seedAt generator seed i).

theorem Cslib.Crypto.PRGStretch.take_forwardIterate_prefix {generator : List Bool → List Bool} (hlen : ∀ (s : List Bool), (generator s).length = s.length + 1) (seed : List Bool) {count total : ℕ} (hle : count ≤ total) :
List.take count (forwardIterate generator total seed) = List.take count (forwardIterate generator count seed)

Only the emitted prefix is consistent across stopping times; the final seed is excluded.

theorem Cslib.Crypto.PRGStretch.indistinguishable_take_forwardIterate {generator : List Bool → List Bool} (hgenerator : PseudorandomGenerator generator fun (n : ℕ) => n + 1) {count : ℕ → ℕ} (hcount : Turing.MultiTapeTM.ComputableInPolyTime count Turing.MultiTapeTM.encUnary Turing.MultiTapeTM.encUnary) :
ComputationallyIndistinguishable (fun (n : ℕ) => PMF.map (fun (seed : List Bool) => List.take (count n) (forwardIterate generator (count n) seed)) (BitString.uniformList n)) fun (n : ℕ) => BitString.uniformList (count n)

Polynomially many emitted bits are pseudorandom at the original seed/security parameter. The length schedule is uniform and may be zero; no new generator-security notion is used.

theorem Cslib.Crypto.PRGStretch.pseudorandomGenerator_take_forwardIterate {generator : List Bool → List Bool} (hgenerator : PseudorandomGenerator generator fun (n : ℕ) => n + 1) {ℓ : ℕ → ℕ} (hℓ : Turing.MultiTapeTM.ComputableInPolyTime ℓ Turing.MultiTapeTM.encUnary Turing.MultiTapeTM.encUnary) (hstretch : ∀ (n : ℕ), n < ℓ n) :
PseudorandomGenerator (fun (seed : List Bool) => List.take (ℓ seed.length) (forwardIterate generator (ℓ seed.length) seed)) ℓ

Stretch amplification by emitted last bits ([Gol07c], Proposition 8.8): for a pseudorandom generator generator of stretch k + 1 and a stretch function ℓ (n < ℓ n) computable in polynomial time in unary, the generator of Construction 8.7, which outputs the last bits σ₁ ⋯ σ_ℓ(|s|) of ℓ(|s|) successive expansions of the seed s (take_forwardIterate_eq_flatten_emitBit), is a pseudorandom generator of stretch ℓ.

PseudorandomGenerator asks for one deterministic polynomial-time machine, exact output length ℓ(|s|), and indistinguishability from uniform for uniform probabilistic polynomial-time tests. Its tests (prgRealGame, prgIdealGame) also receive the seed length n in unary, while the tests of Definition 8.1 (Eq. (8.2)) see only the challenge word. This does not change the implication: on the premise, a challenge-only test recovers n = |word| - 1 from the one-bit stretch and can simulate a test that receives n; on the conclusion, a test that receives n may ignore it. So the source implication follows even when ℓ does not determine the seed length. The source's "polynomially bounded" stretch follows from computing ℓ in unary in polynomial time.