Additional lemmas for natural number bit operations #
This file contains general-purpose lemmas about Nat.testBit, Nat.bitIndices,
and sums of powers of 2 that are used throughout the formalization.
Main results #
Nat.testBit_iff_mem_bitIndices:n.testBit i = true ↔ i ∈ n.bitIndicesNat.testBit_finset_sum_pow_two: For a finsetsof natural numbers,(∑ i ∈ s, 2^i).testBit j ↔ j ∈ sNat.testBit_sum_pow_two_fin: Same forFinset (Fin k)
These lemmas connect the bit representation of natural numbers with finset membership, which is fundamental for binary encoding arguments.
n.testBit i = true if and only if i appears in n.bitIndices.
This connects the pointwise bit test with the list of set bit positions.