Testing quadratic equations with the Hadamard code #
A system of quadratic equations over the two-element field in the unknowns x : ι → Bool can be
written as ⟨x ⊗ x, A e⟩ = b e for e : κ, where x ⊗ x : ι × ι → Bool is the tensor product
of x with itself (BitString.tensor, the outer product Matrix.vecMulVec x x read on pairs of
coordinates), and ⟨·, ·⟩ is the inner product modulo two, the dot product in the Boolean ring
Bool. Bit strings add coordinatewise in the same ring, and the tensor product is bilinear
(BitString.tensor_add_left, BitString.tensor_add_right). A proof that the system has a
solution x consists of two tables: the Hadamard encodings f of x and g of x ⊗ x. Since
⟨x ⊗ x, y ⊗ z⟩ = ⟨x, y⟩ ⟨x, z⟩ (BitString.hadamardCode_tensor_tensor), the tables can be
checked with a constant number of queries, every value being read by self-correction
Arora and Barak, Section 11.5:
- the linearity test on
fand ong(BitString.blrAcceptance): passing it, a table is close to the encoding of some bit string; - the tensor test (
BitString.tensorTestAcceptance), comparinggaty ⊗ zwith the product offatyand atzfor uniformly randomyandz: whengencodesw ≠ x ⊗ x, the encodings disagree on at least a quarter of the pairs (BitString.one_div_four_le_expect_hadamardCode_tensor), so the test rejects with probability at least1/4less the probability that a read is wrong (BitString.eq_tensor_of_lt_tensorTestAcceptance); - the equation test (
BitString.equationTestAcceptance), comparinggat the sum of a uniformly random set of theA ewith the sum of the correspondingb e: whengencodes somewviolating an equation, a random set of equations has a violated sum with probability one half (BitString.hadamardCode_eq_of_lt_equationTestAcceptance).
Together they make the Hadamard tester: the encodings of a solution pass all four tests with
probability one, and tables passing them with high enough probability certify that the system is
solvable, by a solution that f encodes
(BitString.exists_forall_hadamardCode_tensor_eq_of_le_blrAcceptance).
Main definitions #
Cslib.BitString.tensor: the tensor product of two bit strings.Cslib.BitString.tensorTestAcceptance: the acceptance probability of the tensor test.Cslib.BitString.equationTestAcceptance: the acceptance probability of the equation test.
Main results #
Cslib.BitString.hadamardCode_tensor_tensor: the inner product of tensor products is the product of the inner products.Cslib.BitString.one_div_four_le_expect_hadamardCode_tensor: a nonzero bilinear form is nonzero on at least a quarter of the pairs.Cslib.BitString.tensorTestAcceptance_hadamardCode,Cslib.BitString.eq_tensor_of_lt_tensorTestAcceptance: completeness and soundness of the tensor test.Cslib.BitString.equationTestAcceptance_hadamardCode,Cslib.BitString.hadamardCode_eq_of_lt_equationTestAcceptance: completeness and soundness of the equation test.Cslib.BitString.exists_forall_hadamardCode_tensor_eq_of_le_blrAcceptance: soundness of the Hadamard tester for quadratic equations.
References #
Tensor products #
The tensor product of bit strings x and y: the outer product Matrix.vecMulVec x y in the
Boolean ring Bool, read on pairs of coordinates, so its bit at (i, j) is x i && y j.
Instances For
The Hadamard encoding of the tensor square of x, read at a unit vector, is a product of two
bits of x.
A nonzero bilinear form is nonzero on a quarter of the pairs: if M is not all false,
then ⟨M, y ⊗ z⟩ = 1 with probability at least 1/4 over uniformly random y and z.
Union bounds #
The tensor test #
The acceptance probability of the tensor test on tables f and g: the probability, over
independent uniformly random y, z, r, s and t, that the self-corrected read of g at
y ⊗ z with randomness t is the product of the self-corrected reads of f at y with
randomness r and at z with randomness s.
Instances For
Completeness of the tensor test: the encodings of x and of x ⊗ x pass it with
probability one.
Soundness of the tensor test: if f and g are within relative distances ε and ε'
of the encodings of x and of w, and the test accepts with probability more than
3/4 + 4ε + 2ε', then w = x ⊗ x.
The equation test #
The acceptance probability of the equation test on a table g, for the linear equations
⟨w, A e⟩ = b e in w: the probability, over independent uniformly random k and t, that the
self-corrected read of g at the sum of the A e for the e with k e = true, with randomness
t, is the sum of the corresponding b e.
Instances For
Completeness of the equation test: the encoding of a solution of the equations passes it with probability one.
Soundness of the equation test: if g is within relative distance ε of the encoding of
w, and the test accepts with probability more than 1/2 + 2ε, then w solves the
equations.
The Hadamard tester #
Soundness of the Hadamard tester for quadratic equations: if tables f and g pass the
linearity test with probabilities at least 1 - ε and 1 - ε', the tensor test with probability
more than 3/4 + 4ε + 2ε', and the equation test for A and b with probability more than
1/2 + 2ε', then f is within relative distance ε of the encoding of a solution x of the
quadratic equations ⟨x ⊗ x, A e⟩ = b e.