Bridges between BitString.equivFin and binary numeral views #
Cslib.BitString.equivFin n numbers n-bit strings Fin n → Bool with 0 as the least
significant coordinate. This module connects equivFin n to the list-based numeral views
Cslib.BitString.lsbValue (least significant bit first) and Cslib.BitString.binaryValue (most
significant bit first), as well as Nat.ofBits and Nat.testBit, without adding a
BitString.Basic dependency to the list-level modules BitString.Counter or
BitString.List.Binary.
Main results #
Cslib.BitString.val_equivFin_eq_ofBits:equivFinagrees withNat.ofBits.Cslib.BitString.equivFin_symm_apply: thei-th bit of(equivFin n).symm kis(k : ℕ).testBit i.Cslib.BitString.lsbValue_ofFn: reading the bits of ann-bit word in order gives its number inequivFin n.Cslib.BitString.binaryValue_reverse_ofFn: reading the reversed list of bits of ann-bit word gives its number inequivFin n.
equivFin agrees with Nat.ofBits on n-bit words.
Reading the bits of an input, least significant first, gives its number in the order of
BitString.equivFin.