The next-bit test #
A generator G with m-bit outputs is unpredictable when no predictor, shown the first i bits of
a generated output, guesses bit i with probability much better than 1 / 2
Boneh and Shoup, Attack Game 3.2 and Definition 3.3. This file relates
prediction to distinguishing for arbitrary tests and predictors: the test built from a predictor has
exactly the advantage of the predictor, and the advantage of a test is at most the sum, over the
positions, of the advantages of the predictors built from it. These are steps towards the next-bit
theorem usually credited to Yao, Boneh and Shoup, Theorems 3.4 and 3.6, not that
theorem: it is about efficient adversaries, and nothing here bounds the cost of the tests and
predictors that the reductions build. The proof follows
Boneh and Shoup, Section 3.5 (see also
Arora and Barak, Chapter 9).
The proof is a hybrid argument. The k-th hybrid gives a test the first k bits of a generated
output followed by uniform bits. Running the test on the 0-th hybrid is the ideal experiment of
Attack Game 3.1 and running it on the m-th is the real experiment, so the difference of the two
acceptance probabilities telescopes into the gaps between adjacent hybrids; the hybrids and the
telescoping hold for outputs over any finite alphabet. The predictor for bit
i built from a test pads the first i bits with a uniform candidate bit and uniform later bits,
runs the test, and keeps the candidate if the test accepts and flips it otherwise. By the
distinguisher/predictor lemma Boneh and Shoup, Lemma 3.5 it is correct with
probability exactly 1 / 2 plus the i-th hybrid gap.
Here the position i is a parameter of the prediction game, whereas the adversary of Attack Game
3.2 chooses it. A predictor that chooses its position at random wins with the average of the
fixed-position probabilities, so a bound for every fixed position also bounds it. The reductions
between tests and predictors are Cslib.Crypto.PRG.nextBitPredictor and
Cslib.Crypto.PRG.predictionTest.
Main definitions #
Cslib.Crypto.PRG.guessOfDistinguisher: guess a bit with a randomized distinguisher.Cslib.Crypto.PRG.Generator.hybridDist,Cslib.Crypto.PRG.Generator.hybridExperiment,Cslib.Crypto.PRG.Generator.hybridGap: the hybrids between generated and uniform outputs.Cslib.Crypto.PRG.Generator.predictionExperiment,Cslib.Crypto.PRG.Generator.predictionAdvantage: Attack Game 3.2 at a fixed position.Cslib.Crypto.PRG.Generator.Unpredictable: concrete unpredictability against admissible predictors.Cslib.Crypto.PRG.nextBitPredictor: the predictor built from a test.Cslib.Crypto.PRG.nextBitGuess: the predictor built from a deterministic test, with its random choices fixed (Cslib.Crypto.PRG.nextBitPredictor_pure).Cslib.Crypto.PRG.predictionTest: the test built from a predictor.
Main results #
Cslib.Crypto.PRG.toReal_bind_guessOfDistinguisher: the distinguisher/predictor lemma.Cslib.Crypto.PRG.Generator.sum_hybridGap,Cslib.Crypto.PRG.Generator.exists_div_le_hybridGap: the hybrid gaps telescope, so one of them is at least the average.Cslib.Crypto.PRG.Generator.toReal_predictionExperiment_nextBitPredictor: the predictor built from a test is correct with probability1 / 2plus a hybrid gap.Cslib.Crypto.PRG.Generator.advantage_le_sum_predictionAdvantage,Cslib.Crypto.PRG.Generator.exists_half_add_div_le_predictionExperiment: a test with advantageεyields a predictor for some position with success probability1 / 2 + ε / m.Cslib.Crypto.PRG.Generator.advantage_predictionTest: the test built from a predictor has the advantage of the predictor.
The uniform next-bit theorem for strict-PPT adversaries is
Cslib.Crypto.pseudorandomGenerator_iff_nextBitUnpredictable, with the random-position form
Cslib.Crypto.pseudorandomGenerator_iff_nextBitUnpredictableRandomIndex, in
CslibFrontier.Crypto.Computational.PseudorandomGenerator.NextBit.
References #
Guess a bit with a randomized distinguisher d: draw a uniform candidate bit r, run d r,
and output r if it accepts and !r if it rejects Boneh and Shoup, Lemma 3.5.
The distinguisher/predictor lemma Boneh and Shoup, Lemma 3.5. Draw x
from μ. The guess guessOfDistinguisher (d x) equals target x with probability 1 / 2, plus
the probability that d x accepts target x, minus the probability that d x accepts an
independent uniform bit.
The k-th hybrid: the first k symbols of the generator's output on a uniform seed, followed
by independent uniform symbols. It is Hybrid m - k of
Boneh and Shoup, Section 3.5.
A test run on the 0-th hybrid is the ideal experiment of Attack Game 3.1.
A test run on the k-th hybrid with m ≤ k is the real experiment of Attack Game 3.1.
A test run on the k-th hybrid sees the first k symbols of a generated output followed by
the remaining symbols of an independent uniform string.
The i-th hybrid gap of a test: the probability that it accepts the (i + 1)-st hybrid
minus the probability that it accepts the i-th, in which symbol i is uniform instead of
generated.
The hybrid gaps of a test telescope to the probability that it accepts in the real experiment minus the probability that it accepts in the ideal experiment.
The hybrid argument. If 0 < m and a test accepts in the real experiment with probability
at least ε more than in the ideal experiment, then one of its hybrid gaps is at least
ε / m.
Attack Game 3.2 of [BS23] at the fixed position i: the predictor receives the
first i bits of the generator's output on a uniform seed, and the experiment outputs true
exactly when the predictor's guess is bit i. This is Cslib.Crypto.predictionExperiment on
G.outputDist, observing the first i bits and hiding bit i.
The prediction experiment maps the predictor's guess on each output to its correctness.
The advantage of a predictor in Attack Game 3.2 of [BS23]: the distance of its
probability of guessing bit i correctly from 1 / 2.
Concrete unpredictability against admissible predictors
Boneh and Shoup, Definition 3.3 with an explicit error: every admissible predictor
for every position has advantage at most δ. As for Cslib.Crypto.PRG.Generator.Secure, the
predicate Admissible is supplied by the caller; fun _ _ => True allows arbitrary predictors.
The predictor for bit i built from a test, following the proof of
Boneh and Shoup, Theorem 3.6. Given the first i bits x, it applies
Cslib.Crypto.PRG.guessOfDistinguisher to the distinguisher that, on a candidate bit r, runs the
test on x, followed by r at position i, followed by uniform bits.
The guess of the predictor built from a deterministic test, with its random choices fixed.
Given the first i bits x, it runs the test on x, followed by the candidate bit r at
position i, followed by the bits of u after position i, and outputs r if the test accepts
and !r otherwise.
For a deterministic test, the predictor built from it draws a uniform candidate bit r and a
uniform string u and outputs nextBitGuess test i r u x.
The predictor built from a test guesses bit i correctly with probability exactly 1 / 2
plus the i-th hybrid gap of the test.
The advantage of the predictor built from a test is the absolute value of the corresponding hybrid gap.
The advantage of a test is at most the sum, over all positions, of the advantages of the predictors built from it.
If 0 < m, then for some position the predictor built from a test has advantage at least
the advantage of the test divided by m.
A step of the next-bit theorem, in the one-sided form of
Arora and Barak, Chapter 9, for an arbitrary test: if 0 < m and a test accepts in
the real experiment with probability at least ε more than in the ideal experiment, then for some
position i the predictor built from the test guesses bit i correctly with probability at least
1 / 2 + ε / m. The cost of the predictor is not bounded here.
The test built from a predictor for bit i, following the proof of
Boneh and Shoup, Theorem 3.4: run the predictor on the first i bits and accept
exactly when its guess is bit i.
The real experiment against the test built from a predictor is the prediction experiment.