Documentation

CslibFrontier.Crypto.Primitives.PRG.Nisan.Bits

Nisan's generator on bit strings #

With the blocks the bit strings of length n and the Toeplitz hash family over Bool (Cslib.BitString.isPairwiseIndependentHash_toeplitzHash_bool), Nisan's generator Cslib.Crypto.PRG.Nisan.bitGenerator n k stretches a seed of n + k (3 n - 1) bits (Cslib.Crypto.PRG.Nisan.card_bitSeed) into 2 ^ k n bits, the 2 ^ k blocks of Cslib.Crypto.PRG.Nisan.blocks concatenated in order by Cslib.BitString.blocksEquiv.symm. A read-once branching program on 2 ^ k n bits regroups into a program on 2 ^ k blocks of n bits with the same states (Cslib.BranchingPrograms.ReadOnceProgram.blocks), so the generator fools read-once branching programs of width w on bits with error (2 ^ k - 1) w / (2 √(2 ^ n)) (Cslib.Crypto.PRG.Nisan.secure_bitGenerator). For n = 2 (k + a + d) this is at most 2 ^ (-d) for width up to 2 ^ a (Cslib.Crypto.PRG.Nisan.secure_bitGenerator_of_le): O((k + a + d) k) seed bits fool programs of length 2 ^ k n, width 2 ^ a and error 2 ^ (-d). For width w, length R and error ε, this is the seed length O(log (w R / ε) log R) of Nisan's generator [Nis92], Arora and Barak, Theorem 16.48, Vadhan, Section 8.2.1, the parametrized seed length of Hatami and Hoza, Theorem 3.8, which the remark after that theorem attributes to Nisan as well.

Main definitions #

Main results #

References #

@[reducible, inline]

The seeds of Nisan's generator on bit strings of length n with k hash seeds: a block of n bits and k seeds of the Toeplitz hash, each a Toeplitz matrix of 2 n - 1 bits and an offset of n bits.

theorem Cslib.Crypto.PRG.Nisan.card_bitSeed (n k : ℕ) :
Fintype.card (BitSeed n k) = 2 ^ (n + k * (3 * n - 1))

The seed length of Nisan's generator on bit strings: n + k (3 n - 1) bits.

Nisan's generator on bit strings: the 2 ^ k blocks of n bits of Nisan's generator with the Toeplitz hash family over Bool, concatenated in order.

theorem Cslib.Crypto.PRG.Nisan.abs_dens_eval_bitGenerator_sub_le {S : Type u_1} [Fintype S] (n k : ℕ) (P : BranchingPrograms.ReadOnceProgram (2 ^ k * n) S Bool) :
|↑{z : BitSeed n k | P.eval ((bitGenerator n k) z) = true}.dens - ↑{y : BitString (2 ^ k * n) | P.eval y = true}.dens| ≤ (2 ^ k - 1) * ↑(Fintype.card S) / (2 * √(2 ^ n))

Nisan's generator on bit strings fools read-once branching programs with any states [Nis92]: for every read-once branching program P on 2 ^ k n bits with a finite set S of states, the probability that P accepts the output of bitGenerator n k on a uniform seed differs from the probability that it accepts a uniform bit string by at most (2 ^ k - 1) |S| / (2 √(2 ^ n)).

theorem Cslib.Crypto.PRG.Nisan.secure_bitGenerator (n k w : ℕ) :
(bitGenerator n k).Secure (IsReadOnceTest w) ((2 ^ k - 1) * ↑w / (2 * NNReal.sqrt (2 ^ n)))

Nisan's generator on bit strings fools read-once branching programs [Nis92]: no read-once branching program of width w on 2 ^ k n bits distinguishes the output of bitGenerator n k from a uniform bit string with advantage more than (2 ^ k - 1) w / (2 √(2 ^ n)).

theorem Cslib.Crypto.PRG.Nisan.secure_bitGenerator_two_mul (m k w : ℕ) :
(bitGenerator (2 * m) k).Secure (IsReadOnceTest w) ((2 ^ k - 1) * ↑w / 2 ^ (m + 1))

Nisan's generator on bit strings of even length: for n = 2 m, the advantage of read-once branching programs of width w is at most (2 ^ k - 1) w / 2 ^ (m + 1).

theorem Cslib.Crypto.PRG.Nisan.secure_bitGenerator_of_le (k a d w : ℕ) (hw : w ≤ 2 ^ a) :
(bitGenerator (2 * (k + a + d)) k).Secure (IsReadOnceTest w) (2 ^ d)⁻¹

The parameters of Nisan's generator [Nis92]: with blocks of n = 2 (k + a + d) bits, Nisan's generator on bit strings stretches O((k + a + d) k) seed bits into 2 ^ k n bits that fool every read-once branching program of width at most 2 ^ a with error 2 ^ (-d).