Documentation

CslibFrontier.Crypto.Primitives.PRG.NisanWigderson.BitPolynomial

The bit-indexed polynomial design #

Carmosino, Impagliazzo, Kabanets and Kolokolova's AC⁰[p] construction of Nisan–Wigderson designs (§3.1 and the proof of Theorem 3.6, pp. 10:11–10:13) [CIKK16] indexes the blocks by bit strings. The string i : BitString ℓ names the polynomial A_i(x) = ∑_t i_t x^t with coefficients 0 and 1 (Cslib.Crypto.PRG.NisanWigderson.bitPoly). The universe is split into n rows, each a copy of the field F. Block i takes, from row j, the cell in the column numbered by A_i(r_j), for fixed distinct points r_j ∈ F. Distinct strings give distinct polynomials of degree less than ℓ, which agree at fewer than ℓ points, so two blocks share at most ℓ - 1 cells. The cells are numbered row-major, so the bits of a seed in block i, in increasing order of position, are read row by row (Cslib.Crypto.PRG.NisanWigderson.Design.restrict_bitPolynomial).

Unlike Cslib.Crypto.PRG.NisanWigderson.Design.polynomial, which numbers points and blocks in some unspecified order, every numbering here is explicit. That is what lets a circuit compute the design. Over a field of characteristic two with an additive encoding by bits, each bit of A_i(r_j) is a parity of the bits of i over a set fixed by r_j (Cslib.Crypto.PRG.NisanWigderson.bits_bitPoly_eq_parityOn); this is the linear map of the proof of Theorem 3.6, which uses the hard-coded matrix r_j ^ t.

The instance Cslib.Crypto.PRG.NisanWigderson.Design.binaryPolynomial n ℓ uses the explicit binary field Cslib.BinaryField e with e = binaryFieldDegree n = max 1 ⌈log₂ n⌉. So n ≤ 2 ^ e ≤ 2 n (Cslib.Crypto.PRG.NisanWigderson.le_two_pow_binaryFieldDegree, Cslib.Crypto.PRG.NisanWigderson.two_pow_binaryFieldDegree_le), and the points r_j are the field elements numbered j < n. Its seed has n · 2 ^ e ≤ 2 n² bits (Cslib.Crypto.PRG.NisanWigderson.Design.seedLength_binaryPolynomial_le).

This differs from the source in these ways:

Main definitions #

Main results #

References #

def Cslib.Crypto.PRG.NisanWigderson.bitPoly {F : Type u_1} [Field F] {ℓ : ℕ} (i : BitString ℓ) (x : F) :
F

The polynomial A_i(x) = ∑_t i_t x ^ t whose coefficients are the bits of i, evaluated at x [CarmosinoImpagliazzoKabanetsKolokolova2016, proof of Theorem 3.6].

theorem Cslib.Crypto.PRG.NisanWigderson.bitPoly_eq_sum_mul {F : Type u_1} [Field F] {ℓ : ℕ} (i : BitString ℓ) (x : F) :
bitPoly i x = ∑ t : Fin ℓ, (if i t = true then 1 else 0) * x ^ ↑t

bitPoly i is the polynomial of polynomialBlock with coefficients 1 where i is true and 0 elsewhere.

theorem Cslib.Crypto.PRG.NisanWigderson.bits_bitPoly_eq_parityOn {F : Type u_1} [Field F] {ℓ e : ℕ} (bits : F ≃+ BitString e) (i : BitString ℓ) (x : F) (c : Fin e) :
bits (bitPoly i x) c = parityOn {t : Fin ℓ | bits (x ^ ↑t) c = true} i

Each bit of A_i(x) is a parity of i. For an additive encoding of F by bits, bit c of bitPoly i x is the parity of i on the exponents t for which bit c of x ^ t is set. In a circuit this is one parity gate per bit, with the set fixed by x [CarmosinoImpagliazzoKabanetsKolokolova2016, proof of Theorem 3.6].

def Cslib.Crypto.PRG.NisanWigderson.bitPolyBlock {F : Type u_1} [Field F] {ℓ n q : ℕ} (r : Fin n → F) (num : F ≃ Fin q) (i : BitString ℓ) :
Finset (Fin (n * q))

Block i of the bit-indexed polynomial design: from each row j < n, the cell in the column numbered by A_i(r_j). Cells are numbered row-major, so (j, v) is cell v + q j.

theorem Cslib.Crypto.PRG.NisanWigderson.mem_bitPolyBlock {F : Type u_1} [Field F] {ℓ n q : ℕ} {r : Fin n → F} {num : F ≃ Fin q} {i : BitString ℓ} {p : Fin (n * q)} :

A cell (j, v) lies in block i when its column v is the number of A_i(r_j).

@[simp]
theorem Cslib.Crypto.PRG.NisanWigderson.card_bitPolyBlock {F : Type u_1} [Field F] {ℓ n q : ℕ} {r : Fin n → F} {num : F ≃ Fin q} (i : BitString ℓ) :
(bitPolyBlock r num i).card = n

Each block has one cell in each of the n rows.

theorem Cslib.Crypto.PRG.NisanWigderson.card_bitPolyBlock_inter_le {F : Type u_1} [Field F] {ℓ n q : ℕ} {r : Fin n → F} {num : F ≃ Fin q} (hr : Function.Injective r) {i i' : BitString ℓ} (h : i ≠ i') :
(bitPolyBlock r num i ∩ bitPolyBlock r num i').card ≤ ℓ - 1

Distinct blocks share at most ℓ - 1 cells, for distinct points r_j. A shared cell in row j is a point r_j where the two polynomials agree. The polynomials are distinct and of degree less than ℓ, so this holds for at most ℓ - 1 points (card_polynomialBlock_inter_le) [CarmosinoImpagliazzoKabanetsKolokolova2016, proof of Theorem 3.6, p. 10:12].

def Cslib.Crypto.PRG.NisanWigderson.Design.bitPolynomial {F : Type u_1} [Field F] {n q : ℕ} (ℓ : ℕ) (r : Fin n ↪ F) (num : F ≃ Fin q) :
Design (n * q) n (ℓ - 1) (2 ^ ℓ)

The bit-indexed polynomial design [CarmosinoImpagliazzoKabanetsKolokolova2016, §3.1 and the proof of Theorem 3.6]: an (n q, n, ℓ - 1)-design with 2 ^ ℓ blocks. Block i < 2 ^ ℓ is bitPolyBlock r num of the bit string numbered i by BitString.equivFin (least significant bit first).

theorem Cslib.Crypto.PRG.NisanWigderson.Design.block_bitPolynomial {F : Type u_1} [Field F] {ℓ n q : ℕ} {num : F ≃ Fin q} {r : Fin n ↪ F} (i : Fin (2 ^ ℓ)) :
(bitPolynomial ℓ r num).block i = bitPolyBlock (⇑r) num ((BitString.equivFin ℓ).symm i)

Block i of Design.bitPolynomial is bitPolyBlock of the bit string numbered i.

theorem Cslib.Crypto.PRG.NisanWigderson.Design.restrict_bitPolynomial {F : Type u_1} [Field F] {ℓ n q : ℕ} {num : F ≃ Fin q} {r : Fin n ↪ F} {α : Type u_2} (i : Fin (2 ^ ℓ)) (z : Fin (n * q) → α) (j : Fin n) :
(bitPolynomial ℓ r num).restrict i z j = z (finProdFinEquiv (j, num (bitPoly ((BitString.equivFin ℓ).symm i) (r j))))

Reading a seed in block i: its bit in row j is the seed's bit in that row, in the column numbered by A_i(r_j). The cells are numbered row-major, so increasing position is increasing row.

The instance over the explicit binary field #

The degree e = max 1 ⌈log₂ n⌉ of the binary field for n rows: the least positive e with n ≤ 2 ^ e.

The field has at most 2 n elements, for n ≥ 1.

The degree is at most n, for n ≥ 1.

noncomputable def Cslib.Crypto.PRG.NisanWigderson.binaryFieldNum {e : ℕ} (he : e ≠ 0) :

The numbering BinaryField e ≃ Fin (2 ^ e) of the field elements by their bits, least significant first.

The number of a field element is the number of its bits.

The points r_j, j < n: the elements of BinaryField (binaryFieldDegree n) numbered j.

The point r_j is the field element whose bits number j.

noncomputable def Cslib.Crypto.PRG.NisanWigderson.Design.binaryPolynomial (n ℓ : ℕ) :
Design (n * 2 ^ binaryFieldDegree n) n (ℓ - 1) (2 ^ ℓ)

The bit-indexed polynomial design over the explicit binary field [CarmosinoImpagliazzoKabanetsKolokolova2016, §3.1]: an (n 2 ^ e, n, ℓ - 1)-design with 2 ^ ℓ blocks, e = binaryFieldDegree n. Its points are the field elements numbered 0, …, n - 1, and its columns are numbered by the bits of the field elements.

The binary instance is the bit-indexed polynomial design at its points and column numbering.

Membership in a block of the binary instance. Cell (j, v) lies in block i exactly when, for every c, bit c of v is the parity of i on the exponents t with bit c of r_j ^ t set. This is the test of [CarmosinoImpagliazzoKabanetsKolokolova2016, Theorem 3.6].

theorem Cslib.Crypto.PRG.NisanWigderson.Design.restrict_binaryPolynomial {ℓ n : ℕ} {α : Type u_2} (i : BitString ℓ) (z : Fin (n * 2 ^ binaryFieldDegree n) → α) (j : Fin n) (v : Fin (2 ^ binaryFieldDegree n)) (hv : ∀ (c : Fin (binaryFieldDegree n)), (BitString.equivFin (binaryFieldDegree n)).symm v c = parityOn {t : Fin ℓ | (BinaryField.equivBits ⋯) ((binaryFieldPoints n) j ^ ↑t) c = true} i) :

Reading a seed in block i of the binary instance. Row j contributes the cell whose column v has the bits of A_i(r_j). Bit c of A_i(r_j) is the parity of i on the exponents t with bit c of r_j ^ t set (bits_bitPoly_eq_parityOn). So the bit is the seed bit of the unique column v that has, for every c, bit c equal to that parity: the cell of block i in row j (Design.mem_block_binaryPolynomial_iff).

The seed of the binary instance has at most 2 n² bits.