Documentation

CslibFrontier.Crypto.Primitives.PRG.NisanWigderson.Circuit

The Nisan–Wigderson generator fools small circuits #

This file adds circuit sizes to the reconstruction of Cslib.Crypto.PRG.NisanWigderson.exists_dependsOn_half_add_div_le_card_nextBitGuess_eq. The function reconstructed from a deterministic test runs the test on i functions of at most a input bits each, on constants, and possibly negates the result. A function of at most a input bits costs at most 2 ^ a (2 a + 3) + 1 De Morgan gates (Cslib.Circuits.Boolean.complexity_le_of_dependsOn), so if the test is computed with S gates, the reconstructed function is computed with at most S + m (2 ^ a (2 a + 3) + 1) + 1 gates (exists_complexity_le_half_add_div_le_card_eq). Contrapositively, if no circuit of that size agrees with f on a 1 / 2 + ε / m fraction of the inputs, then no test computed with S gates accepts outputs of the generator with probability ε more than uniform strings (toReal_realExperiment_sub_toReal_idealExperiment_lt). The same bound holds for the guess of every trial of the randomized reconstruction, not just for one good choice (complexity_trialGuess_le). Gates are counted as in Cslib.Circuits.complexity over the De Morgan basis, constants and negations included.

A learner that runs a trial does not know f; it knows only the answers to its queries (Cslib.Crypto.PRG.NisanWigderson.trialPoints). The same bound holds for a single circuit that reads those answers from input wires (complexity_trialGuess_answers_le). Each earlier output bit selects its answer by the at most a overlap bits of the input (Cslib.Circuits.Boolean.complexity_select_le), so the number of answer wires does not enter the bound.

Main results #

References #

The guess of the predictor built from a test, with fixed random choices and with the first i bits computed by functions of complexity at most B ≥ 1, costs at most the test, m * B, and one gate. The functions may have any number of inputs.

The guess of every trial is a small circuit. For every choice t of the random choices of the reconstruction, the guess built from the test has De Morgan circuit complexity at most that of the test plus m * (2 ^ a * (2 * a + 3) + 1) + 1.

theorem Cslib.Crypto.PRG.NisanWigderson.complexity_trialGuess_answers_le {ℓ n a m : ℕ} (D : Design ℓ n a m) (test : BooleanFunction m) (t : Trial ℓ m) {q : ℕ} (hq : (trialPoints D t).length ≤ q) :
∃ (F : BooleanFunction (q + n)), Circuits.complexity Circuits.Boolean.interpretation (Circuits.single F) ≤ Circuits.complexity Circuits.Boolean.interpretation (Circuits.single test) + m * (2 ^ a * (2 * a + 3) + 1) + 1 ∧ ∀ (f : BooleanFunction n) (z : Fin q → Bool), (∀ (i : Fin q) (hi : ↑i < (trialPoints D t).length), z i = f (trialPoints D t)[↑i]) → ∀ (x : Fin n → Bool), trialGuess D f test t x = F (Fin.append z x)

The guess of every trial, reading its queries from input wires. If the trial t makes at most q queries, one De Morgan circuit F on q + n inputs, with the same size bound as complexity_trialGuess_le, computes the guess for every hard function f: on inputs z ++ x where z i is the value of f at the i-th query, F outputs the guess at x. The remaining answer bits are ignored. Output bit j reads the answer selected by the at most a bits of x in D.overlap t.pos j (Cslib.Circuits.Boolean.complexity_select_le).

theorem Cslib.Crypto.PRG.NisanWigderson.exists_complexity_le_half_add_div_le_card_eq {ℓ n a m : ℕ} (D : Design ℓ n a m) (f : BooleanFunction n) (test : BooleanFunction m) (hm : 0 < m) {ε : ℝ} (hε : ε ≤ (((generator D f).realExperiment fun (y : Fin m → Bool) => PMF.pure (test y)) true).toReal - ((Generator.idealExperiment fun (y : BitString m) => PMF.pure (test y)) true).toReal) :

The Nisan–Wigderson reconstruction with circuits Arora and Barak, Chapter 20. If 0 < m and a deterministic test accepts outputs of the generator with probability at least ε more than uniform strings, then some function g on n bits agrees with f on at least a 1 / 2 + ε / m fraction of the inputs and has De Morgan circuit complexity at most that of the test plus m * (2 ^ a * (2 * a + 3) + 1) + 1.

theorem Cslib.Crypto.PRG.NisanWigderson.toReal_realExperiment_sub_toReal_idealExperiment_lt {ℓ n a m : ℕ} (D : Design ℓ n a m) (f : BooleanFunction n) (hm : 0 < m) {ε : ℝ} {S : ℕ} (hf : ∀ (g : BooleanFunction n), Circuits.complexity Circuits.Boolean.interpretation (Circuits.single g) ≤ S + m * (2 ^ a * (2 * a + 3) + 1) + 1 → ↑{x : BitString n | g x = f x}.card / 2 ^ n < 1 / 2 + ε / ↑m) (test : BooleanFunction m) (htest : Circuits.complexity Circuits.Boolean.interpretation (Circuits.single test) ≤ S) :
(((generator D f).realExperiment fun (y : Fin m → Bool) => PMF.pure (test y)) true).toReal - ((Generator.idealExperiment fun (y : BitString m) => PMF.pure (test y)) true).toReal < ε

The Nisan–Wigderson generator fools small circuits Arora and Barak, Chapter 20. Let 0 < m. If every function on n bits of complexity at most S + m * (2 ^ a * (2 * a + 3) + 1) + 1 agrees with f on less than a 1 / 2 + ε / m fraction of the inputs, then every test of complexity at most S accepts outputs of the generator with probability less than ε more than uniform strings.