Uniform binary strings #
Uniform sampling from Fin n → Bool, represented as a list. The recursive equations connect
this finite uniform distribution to a program drawing one independent fair bit at a time.
Main definitions #
Cslib.BitString.uniformList: uniform fixed-length words represented as lists.
Main results #
Cslib.BitString.uniformList_succ,Cslib.BitString.uniformList_add: independent decomposition.Cslib.BitString.mem_support_uniformList_iff: support is exactly the requested length.Cslib.BitString.uniformList_map_of_bijective: length-preserving permutations preserve uniformity.Cslib.BitString.uniformList_map_apply: the probability of a value under a map of a uniform word is the fraction of words of that length mapping to it.
References #
Adapted from Cslib/Probability/BitString.lean on the cslib crypto branch at
5ff69ca93402e7c947208dc56396d6d86203ccd8, placed in the shared bit-string namespace.
The uniform distribution on words of 0 bits is the point mass at the empty word.
A uniform nonempty string consists of a fair first bit and an independent uniform tail.
Concatenating independent uniform words gives a uniform word of the combined length.
Appending one independent fair bit gives a uniform word one bit longer.
Every sampled word has exactly the requested length.
Splitting a uniform tape gives two independent tapes, also when either length is zero.
A prefix of a uniform word is uniform, with no condition on the discarded suffix.
A length-preserving permutation sends a uniform word to a uniform word of the same length. This is a distributional fact and makes no assumption about computing the inverse.
The probability of a value of a function of a uniform word is the fraction of the words of that length giving it.