Bit Indices #
Given n : ℕ, we define Nat.bitIndices n, which is the List of indices of 1s in the
binary expansion of n. If s : Finset ℕ and n = ∑ i ∈ s, 2 ^ i, then
Nat.bitIndices n is the sorted list of elements of s.
The lemma sum_map_two_pow_bitIndices proves that summing 2 ^ i over this list gives n.
This is used in Combinatorics.colex to construct a bijection equivBitIndices : ℕ ≃ Finset ℕ.
TODO #
Relate the material in this file to Nat.digits and Nat.bits.
The function which maps each natural number ∑ i ∈ s, 2 ^ i to the list of
elements of s in increasing order.
Equations
Instances For
Alias of Nat.sum_map_two_pow_bitIndices.
Together with Nat.sum_map_bitIndices_two_pow, this implies a bijection between ℕ and Finset ℕ.
See Finset.equivBitIndices for this bijection.
Alias of Nat.bitIndices_sum_map_two_pow.
Together with Nat.sum_map_bitIndices_two_pow, this implies a bijection between ℕ and Finset ℕ.
See Finset.equivBitIndices for this bijection.