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][ODonnell2014], 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.parity_snoc: appending a bit exclusive-ors it into 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.Cslib.foldl_bne_eq_parity: foldingxor(bne) over a list of bits computesparity.
References #
- [R. O'Donnell, Analysis of Boolean Functions][ODonnell2014]
The parity function on n bits.
Equations
Instances For
The parity on s, as an additive map from bit strings to bits.
Equations
- Cslib.parityOnAddMonoidHom s = { toFun := Cslib.parityOn s, map_zero' := ⋯, map_add' := ⋯ }
Instances For
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][ODonnell2014].