The parity function #
parityOn s x says whether an odd number of the bits of x : ι → Bool in s are true, and
parity n is the parity of all n bits. These are the parity functions χ_S of
O'Donnell, Chapter 1, with values in Bool rather than ±1.
In the Boolean ring Bool, where a + b = (a ^^ b), the parity on s is the sum of the bits in
s (parityOn_eq_sum), so it splits over disjoint unions (parityOn_union), the parity on a
symmetric difference is the exclusive or of the parities (parityOn_symmDiff), and it is additive
for the coordinatewise sum of bit strings (parityOn_add, bundled as parityOnAddMonoidHom). Bit
strings are added with +, under which each is its own negative (BooleanRing.add_self), and
single bits with ^^. Flipping one of the bits negates the parity (parityOn_update_not), so
the parity of a nonempty set of bits is not constant and depends on each of them; being additive,
it then takes each value on exactly half of the inputs (card_filter_parityOn_eq).
Main definitions #
Cslib.parityOn: the parity of the bits in a set, andCslib.parityOnAddMonoidHomthe same as an additive map.Cslib.parity: the parity of all bits.
Main results #
Cslib.parityOn_eq_sum: the parity is the sum of the bits in the Boolean ring.Cslib.parityOn_singleton: the parity on a singleton{i}isx i.Cslib.parityOn_union,Cslib.parityOn_sdiff,Cslib.parityOn_biUnion: the parity of a disjoint union, set difference, and disjoint indexed union.Cslib.parityOn_symmDiff: the parity of a symmetric difference.Cslib.parityOn_add,Cslib.BitString.exists_eq_parityOn_iff: the parities are the linear Boolean functions.Cslib.parity_update_not: flipping any bit flips the parity.Cslib.card_filter_parityOn_eq,Cslib.dens_filter_parityOn_eq: the parity on a nonempty set takes each value on half of the inputs.Cslib.card_filter_parity_eq_true: parity ofn ≥ 1bits is true on2 ^ (n - 1)inputs.
References #
parityOnAddMonoidHom s evaluates to parityOn s.
Changing a bit outside s does not change the parity on s.
The parity of a union of pairwise disjoint blocks is the parity of the parities of the blocks.
Flipping one of the bits negates the parity.
Parities of nonempty sets are balanced: the parity on a nonempty set of bits takes each value on half of the inputs. Being additive, it has fibers of equal size.
Parities of nonempty sets are balanced: the parity on a nonempty set of bits takes each value with probability one half at a uniformly random input.
The linear Boolean functions are the parities: a Boolean function turns sums of bit strings into the exclusive or of its values exactly when it is the parity of some set of coordinates O'Donnell, Definition 1.28.