Nisan's generator for read-once branching programs #
Nisan's generator [Nis92] stretches a seed consisting of a block x : X and k seeds
h₁, …, h_k of a pairwise independent family h i : X → X into 2 ^ k blocks
(Cslib.Crypto.PRG.Nisan.blocks):
G₀(x) = x, G_{k+1}(x; h₁, …, h_{k+1}) = G_k(x; h₂, …, h_{k+1}) ++ G_k(h₁ x; h₂, …, h_{k+1}).
So block b = (b₁ … b_k) in binary is h_k^{b_k} (⋯ (h₂^{b₂} (h₁^{b₁} x))), the first seed
choosing the most significant bit and acting first. The recursion peels off the first hash seed;
presentations that peel off the last one, G_k(x; h₁, …, h_k) = G_{k-1}(x; h₁, …, h_{k-1}) ++ G_{k-1}(h_k x; h₁, …, h_{k-1}), define the same generator on the reversed tuple of hash seeds
(h_k, …, h₁), which is uniform exactly when (h₁, …, h_k) is. For every read-once branching
program of width w and length 2 ^ k over the alphabet X, its acceptance probabilities on the
output of the generator, for a uniform seed, and on uniform words differ by at most
(2 ^ k - 1) w / (2 √|X|) (Cslib.Crypto.PRG.Nisan.abs_dens_eval_blocks_sub_le), and the same
holds for every time-dependent transition function δ with w states, run as the indexed fold
List.foldlIdx δ (Cslib.Crypto.PRG.Nisan.abs_dens_foldlIdx_blocks_sub_le).
As a generator (Cslib.Crypto.PRG.Nisan.generator), it is secure against the tests computed by
read-once branching programs of width w (Cslib.Crypto.PRG.IsReadOnceTest) with that error
(Cslib.Crypto.PRG.Nisan.secure_generator). With X the bit strings of length n and the
Toeplitz hash family, seeds of O(n k) bits fool programs on 2 ^ k n bits
(CslibFrontier.Crypto.Primitives.PRG.Nisan.Bits): for width w, length R and error ε this is
the seed length O(log (w R / ε) log R) of Nisan's theorem Arora and Barak, Theorem
16.48, Vadhan, Section 8.2.1; in this parametrized form it is the
seed length of Hatami and Hoza, Theorem 3.8, which the remark after that theorem
attributes to Nisan as well.
Proof #
For a fixed sequence of hash seeds, the run of the program from time t on the 2 ^ k blocks
generated from a uniform x is a random walk on the states; let G_t be its transition matrix and
U_t the transition matrix of the run on 2 ^ k uniform letters. For every probability vector π
on the states, the expected ℓ¹ error 𝔼 ‖π (G_t - U_t)‖₁ over the hash seeds is at most
(2 ^ k - 1) w / √|X|, by induction on k. For k + 1, the run splits into two halves of 2 ^ k
blocks, generated from x and from h₁ x with the same seeds h₂, …, h_{k+1}. With these fixed,
the event that the first half moves u to m and the event that the second half moves m to v
are sets A and B of blocks, and the hash mixing lemma
(Cslib.Probability.IsPairwiseIndependentHash.expect_abs_dens_filter_apply_mem_sub_le) shows that
h₁ correlates the two halves of the run by at most √(μ(A) μ(B) / |X|) on average. By
Cauchy–Schwarz these terms sum to at most w / √|X| over the pairs (m, v). The errors of the
two halves are bounded by induction: the second with the start distribution π U_t, since the
first half then has distribution exactly π U_t. Acceptance probabilities differ by at most half
the ℓ¹ distance of the final-state distributions. This is Nisan's hashing argument [Nis92],
in expectation form. Unlike Hatami and Hoza, Section 3.2, which iterates a
derandomized product through the Impagliazzo–Nisan–Wigderson generator, the two halves here reuse
the same hash seeds, so the induction runs over all start distributions with the lower seeds fixed.
Main definitions #
Cslib.Crypto.PRG.Nisan.blocks: the2 ^ kblocks of Nisan's generator.Cslib.Crypto.PRG.Nisan.generator: Nisan's generator, as a generator.Cslib.Crypto.PRG.IsReadOnceTest: the tests computed by read-once branching programs of widthw.
Main results #
Cslib.Crypto.PRG.Nisan.blocks_apply_eq_foldl: one block of the generator, from the binary digits of its index.Cslib.Crypto.PRG.Nisan.abs_dens_foldlIdx_blocks_sub_le: Nisan's generator fools time-dependent transition functions withwstates.Cslib.Crypto.PRG.Nisan.dens_hashSeeds_far_le: for most hash seeds, the generated blocks fool the transition function from every start state, inℓ¹.Cslib.Crypto.PRG.Nisan.abs_dens_eval_blocks_sub_le: Nisan's generator fools read-once branching programs of widthw.Cslib.Crypto.PRG.Nisan.secure_generator: it is secure against read-once branching programs.
References #
The tests on words of length L over X computed by read-once branching programs of width
w, that is with the states Fin w. As admissible adversaries of
Cslib.Crypto.PRG.Generator.Secure, they express security against computations of length L with
log w bits of memory reading their input once, in order.
The generator #
The 2 ^ k blocks of Nisan's generator with the hash family h, on the block x and the
hash seeds hs: one block x for k = 0, and for k + 1 the blocks for x followed by the
blocks for h (hs 0) x, both with the seeds hs 1, …, hs k.
A block of Nisan's generator on its own: block j applies, in order of the hash seeds, the
hash h (hs ℓ) exactly at the levels ℓ for which bit k - 1 - ℓ of j is set, the first seed
choosing the most significant bit. So one block costs k hash evaluations, not 2 ^ k.
Transition probabilities #
The junction bound #
The induction #
Fooling read-once branching programs #
Nisan's generator fools time-dependent transition functions [Nis92]: for a pairwise
independent family h i : X → X, every transition function δ with states S, start state s₀
and accepting states F, the probability that the run on the 2 ^ k blocks of Nisan's generator
with a uniform seed accepts differs from the probability that the run on 2 ^ k uniform letters
accepts by at most (2 ^ k - 1) |S| / (2 √|X|).
Most hash seeds of Nisan's generator are good: for a pairwise independent family
h i : X → X and every transition function δ with states S, the fraction of the hash seeds
hs for which, from some start state s, the distribution of the end state of the run on the
generated blocks (for a uniform block x, with the hash seeds hs fixed) is ε-far in ℓ¹ from
the distribution of the end state of the run on 2 ^ k uniform letters is at most
|S| ((2 ^ k - 1) |S| / √|X|) / ε. This is Markov's inequality and a union bound over the start
states, applied to the expectation bound of the proof of
Cslib.Crypto.PRG.Nisan.abs_dens_foldlIdx_blocks_sub_le. It is the form of the generator that the
Saks–Zhou iteration consumes, with the hash seeds fixed and the block averaged
(Cslib.Probability.SaksZhou.dens_entryFarSet_nisanPow_le).
Nisan's generator fools read-once branching programs [Nis92]: for a pairwise independent
family h i : X → X and every read-once branching program P of length 2 ^ k over X with
states S, the probability that P accepts the output of Nisan's generator on a uniform seed
differs from the probability that it accepts a uniform word by at most
(2 ^ k - 1) |S| / (2 √|X|).
Nisan's generator is secure against read-once branching programs [Nis92]: for a
pairwise independent family h i : X → X, no read-once branching program of width w and length
2 ^ k distinguishes the output of Nisan's generator with k hash seeds from a uniform word with
advantage more than (2 ^ k - 1) w / (2 √|X|).