Optimal inner-product approximation with a nonlinear gate budget #
The inner product of two n-bit strings is their sum of pairwise products over the Boolean ring.
Its sign has a flat Fourier spectrum of magnitude 2⁻ⁿ. A circuit with m nonaffine binary
gates has Fourier norm at most 2ᵐ, including circuits that freely reuse intermediate values.
Its absolute correlation with inner product is therefore at most 2ᵐ / 2ⁿ.
This bound is exact for m ≤ n. Compute the products on any m coordinate pairs and XOR them.
The remaining independent pairs each contribute a factor 1/2 to correlation. Thus the greatest
correlation attainable over the full binary basis with at most m nonaffine gates is 2ᵐ / 2ⁿ.
Equivalently, the optimal fraction of correct answers is (1 + 2ᵐ / 2ⁿ) / 2.
The cost counts nonaffine gates, with affine gates, constants and output wires free. There is no
restriction on total size, depth or reuse. These are bounds on nonlinear cost, not superlinear
lower bounds on unrestricted total circuit size. All statements include m = 0 and n = 0.
Main results #
Cslib.Circuits.Circuit.abs_correlation_innerProduct_le: the upper bound for any Boolean basis of fan-in at most two.Cslib.Circuits.Boolean.isGreatest_innerProduct_correlation: the exact optimum over the full binary basis, with an attaining circuit.
A circuit on 2n inputs with m nonaffine binary gates has absolute correlation at most
2ᵐ / 2ⁿ with inner product, even with unlimited affine gates and arbitrary sharing.
Among full-binary-basis circuits with at most m ≤ n nonaffine gates, the largest
correlation with the n-pair inner product is exactly 2ᵐ / 2ⁿ. The witness computes any m
of the pairwise products and XORs them; all affine operations are free.