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 proves that
unpredictability is equivalent to security in the sense of Attack Game 3.1, up to a factor of m in
the error. This is the next-bit theorem usually credited to Yao; 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. As in the
definition of Cslib.Crypto.PRG.Generator.Secure, admissible tests and predictors are given by
caller-supplied predicates; the reductions between them 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.Unpredictable.secure: unpredictability with errorδimplies security with errorm * δ.Cslib.Crypto.PRG.Generator.Secure.unpredictable: security with errorεimplies unpredictability with errorε.
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.
Instances For
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.
Instances For
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.
Instances For
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.
Instances For
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.
Instances For
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.
Instances For
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.
Instances For
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.
Instances For
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.
The next-bit theorem in the one-sided form of Arora and Barak, Chapter 9. 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.
Unpredictability implies security Boneh and Shoup, Theorem 3.6. If every
admissible predictor has advantage at most δ, and the predictors built from admissible tests are
admissible, then every admissible test has advantage at most m * δ.
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.
Instances For
The real experiment against the test built from a predictor is the prediction experiment.
Security implies unpredictability Boneh and Shoup, Theorem 3.4. If every
admissible test has advantage at most ε, and the tests built from admissible predictors are
admissible, then every admissible predictor has advantage at most ε.