Uniform sampling at a prescribed parity #
Sampling all but the final bit uniformly and completing the parity gives the uniform law on that parity fiber. The existing XOR-sampling law is moved here unchanged. The fixed-parity law also applies to binary syndrome distributions.
Main definitions #
Cslib.BitString.uniformParity: the uniform distribution on words with a prescribed parity.
Main results #
Cslib.Probability.PMF.uniformOfFintype_map_parityComplete: parity completion is uniform.Cslib.BitString.mem_support_uniformParity: exactly the prescribed parity fiber is supported.
theorem Cslib.Probability.PMF.uniformOfFintype_map_parityComplete (c : Bool) (j : ℕ) (h : {b : BitString (j + 1) | parity (j + 1) b = c}.Nonempty) :
PMF.map (BitString.parityComplete c) (uniformOfFintype (BitString j)) = uniformOfFinset {b : BitString (j + 1) | parity (j + 1) b = c} h
Completing uniform bits to parity c gives a uniform bit string of parity c.
theorem Cslib.BitString.uniformParity_eq_map (b : Bool) (j : ℕ) :
uniformParity (j + 1) b = PMF.map (parityComplete b) (Probability.PMF.uniformOfFintype (BitString j))
Parity completion supplies an exact sampler for the uniform fixed-parity law.