A binary counter #
A word of fixed length is a counter, read least significant bit first (Cslib.BitString.lsbValue).
Increment (Cslib.BitString.increment) flips the trailing ones of the least significant end and
the first zero, discarding the final carry, so it keeps the length and wraps around from the word
of ones to the word of zeros. Counting from the word of m zeros enumerates the words of length
m in order of value (Cslib.BitString.iterate_increment), each reached at its value
(Cslib.BitString.iterate_increment_lsbValue). Exhaustive searches in polynomial space enumerate
their candidates in this way, storing only the current one.
Main definitions #
Cslib.BitString.increment: binary increment, least significant bit first.Cslib.BitString.lsbValue: the value of a word, least significant bit first.
Main results #
Cslib.BitString.lsbValue_increment: increment adds one below the largest value.Cslib.BitString.lsbValue_injective: words of the same length are determined by their values.Cslib.BitString.iterate_increment,Cslib.BitString.iterate_increment_lsbValue: counting from zero enumerates the words of a length.Cslib.BitString.lsbValue_eq_foldr_bit:lsbValueis a right fold ofNat.bit.
The value of a word in binary, least significant bit first.
Instances For
The word of zeros has value 0.
The word of ones has the largest value.