The Hadamard code #
The Hadamard code (or Walsh–Hadamard code) encodes a bit string x : ι → Bool as the truth
table of the function a ↦ x ⬝ᵥ a, the dot product in the Boolean ring Bool, that is, the inner
product modulo two (BitString.hadamardCode). Bit strings add coordinatewise through the same
ring structure, and the code is bilinear (BitString.hadamardCode_add,
BitString.hadamardCode_add_left). Its codewords are exactly the parities, hence exactly the
linear Boolean functions (BitString.exists_eq_hadamardCode_iff). Two distinct codewords of n
bits differ on half of the 2 ^ n inputs (BitString.two_mul_hammingDist_hadamardCode), so for
n ≥ 1 the Hadamard code has minimum distance 2 ^ (n - 1)
(BitString.minDist_range_hadamardCode).
A function f that is close to a parity can be self-corrected: to read the parity at x, read
f at a uniformly random y and at x + y, both uniformly distributed, and add the two bits
(BitString.selfCorrect). If f differs from the parity on an ε fraction of the inputs, this
returns the parity's value at x with probability at least 1 - 2ε, whatever x is
(BitString.one_sub_two_mul_le_expect_selfCorrect). For the Hadamard code this is a two-query
local decoder: the i-th bit of the message is read off at the i-th unit vector
(BitString.one_sub_two_mul_le_expect_selfCorrect_eq_apply). A word within relative distance
δ < 1/4 of a codeword determines the codeword (BitString.eq_of_hammingDist_hadamardCode_le)
O'Donnell, Section 1.6, Arora and Barak, Chapters 11 and 19.
Main definitions #
Cslib.BitString.selfCorrect: the two-query self-corrected read of a Boolean function.Cslib.BitString.hadamardCode: the Hadamard encoding of a bit string.
Main results #
Cslib.BitString.hadamardCode_eq_parityOn: a codeword is a parity.Cslib.BitString.card_filter_selfCorrect_ne_le,Cslib.BitString.one_sub_two_mul_le_expect_selfCorrect: local correctability of parities.Cslib.BitString.exists_eq_hadamardCode_iff: the codewords are the linear functions.Cslib.BitString.hadamardCode_injective,Cslib.BitString.two_mul_hammingDist_hadamardCode,Cslib.BitString.minDist_range_hadamardCode: the Hadamard code is injective with relative distance one half and minimum distance2 ^ (n - 1).Cslib.BitString.eq_of_hammingDist_hadamardCode_le: unique decoding below distance1/4.Cslib.BitString.one_sub_two_mul_le_expect_selfCorrect_eq_apply: local decoding with two queries.
References #
Self-correction #
The self-corrected read of f at x with randomness y: the exclusive or of f y and
f (x + y). For uniformly random y, both points read are uniformly random, and on a parity the
read is exact (selfCorrect_parityOn).
Instances For
Self-correction reads a parity exactly.
Local correctability of parities, counting version: the self-corrected read of f at x
differs from the parity on S at x for at most twice as many y as there are inputs on which
f differs from that parity.
Local correctability of parities: if f differs from the parity on S on at most an ε
fraction of the inputs, then for every x, self-correction at x returns the parity's value at
x with probability at least 1 - 2ε over a uniformly random y
O'Donnell, Proposition 1.31.
The Hadamard code #
The Hadamard encoding of x: the Boolean function sending a to the dot product x ⬝ᵥ a in
the Boolean ring Bool, the inner product of x and a modulo two
Arora and Barak, Section 11.5.
Instances For
The Hadamard codeword of x at a is the dot product x ⬝ᵥ a.
A Hadamard codeword is the parity of the bits at the positions where the message is
true.
The inner product is symmetric.
Hadamard codewords are linear.
The Hadamard code is linear.
Self-correction reads a Hadamard codeword exactly.
The parity on S is the Hadamard encoding of the indicator of S.
The value of a Hadamard codeword at the i-th unit vector is the i-th bit of the
message.
The Hadamard code is injective.
The Hadamard code has relative distance one half: the encodings of distinct bit strings differ on exactly half of the inputs.
Unique decoding: a Boolean function within relative distance δ < 1/4 of the encodings
of x and of y forces x = y.
Local correction for the Hadamard code: if f is within relative distance ε of the
encoding of x, then for every a, self-correction at a returns the codeword's value at a
with probability at least 1 - 2ε.
Local decoding of the Hadamard code with two queries: if f is within relative distance
ε of the encoding of x, then self-correction at the i-th unit vector returns x i with
probability at least 1 - 2ε Arora and Barak, Section 11.5.
The distance of the Hadamard code. For messages of n ≥ 1 bits, the Hadamard code has
minimum distance 2 ^ (n - 1): half of its length 2 ^ n.