Signs of sums of bits and sign correlations #
In the two-element Boolean ring, where a + b = (a ^^ b), the sign of a sum of bits is the product
of their signs (BitString.signVal_sum), and the value of a product of bits is the product of
their values (BitString.bitVal_prod).
The sign correlation ∑ x, signVal (f x) * signVal (g x) of two words f g : X → Bool counts
the positions where they agree minus those where they differ. It is
2 #{x | f x = g x} - |X| (BitString.sum_signVal_mul_signVal_eq_two_mul_card_sub) and
|X| - 2 d(f, g) for the Hamming distance d (BitString.sum_signVal_mul_signVal_eq_card_sub)
[O'Donnell, Section 1.4][ODonnell2014]. So f agrees with g on at least a 1 / 2 + ε fraction
of the positions exactly when their correlation is at least 2 ε |X|.
Main results #
Cslib.BitString.signVal_sum: the sign of a sum of bits is the product of their signs.Cslib.BitString.bitVal_prod: the value of a product of bits is the product of their values.Cslib.BitString.sum_signVal_mul_signVal_eq_two_mul_card_sub,Cslib.BitString.sum_signVal_mul_signVal_eq_card_sub: the sign correlation of two words by agreements and by Hamming distance.
References #
- [R. O'Donnell, Analysis of Boolean Functions][ODonnell2014]
Correlation counts agreements: the sign correlation of two words is twice the number of positions where they agree, minus the number of positions.
Correlation is the length minus twice the distance: the sign correlation of two words is the number of positions minus twice their Hamming distance.