Documentation

Complexity.Foundations.Data.BitString.ShortWords

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 #

Main results #

There are 2 ^ n binary strings of length n.

There are 2 ^ n - 1 binary strings of length below n.

theorem Cslib.BitString.exists_length_eq_notMem (Q : List (List Bool)) (n : ℕ) (hQ : Q.length < 2 ^ n) :
∃ (w : List Bool), w.length = n ∧ w ∉ Q

Fewer than 2 ^ n words leave a word of length n unused.

noncomputable def Cslib.BitString.shortWords (L : ℕ) :

The binary words of length at most L.

Instances For
    @[simp]

    A word lies in shortWords L exactly when its length is at most L.

    The empty word lies in shortWords L.

    theorem Cslib.BitString.card_shortWords (L : ℕ) :
    (shortWords L).card = 2 ^ (L + 1) - 1

    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.