Counting binary words #
The binary words of length at most L form a finite set shortWords L with 2 ^ (L + 1) - 1
elements: the words of length m are the 2 ^ m lists List.ofFn r for r : Fin m → Bool, and
∑ m ≤ L, 2 ^ m = 2 ^ (L + 1) - 1. In particular, a list of fewer than 2 ^ n words
leaves some word of length n unused.
Main definitions #
Cslib.BitString.shortWords: the binary words of length at mostL.
Main results #
Cslib.BitString.encard_setOf_length_eq: there are2 ^ nwords of lengthn.Cslib.BitString.encard_setOf_length_lt_add_one: there are2 ^ n - 1words of length belown.Cslib.BitString.exists_length_eq_notMem: fewer than2 ^ nwords leave a word of lengthnunused.Cslib.BitString.mem_shortWords: membership is the length bound.Cslib.BitString.card_shortWords: there are2 ^ (L + 1) - 1such words.Cslib.BitString.card_shortWords_lt: in particular fewer than2 ^ (L + 1).
@[simp]
A word lies in shortWords L exactly when its length is at most L.
The empty word lies in shortWords L.
There are 2 ^ (L + 1) - 1 binary words of length at most L.
There are fewer than 2 ^ (L + 1) binary words of length at most L.