Bits of successors, predecessors and packed fields #
Incrementing a number flips bit q exactly when all lower bits are one, and decrementing a
positive number flips it exactly when all lower bits are zero. A number packed from fields of
fixed widths has, in each window of bits, the bits of the corresponding field.
Main results #
Nat.testBit_add_one_eq_xor,Nat.testBit_sub_one_eq_xor: the bits ofc + 1andc - 1.Nat.testBit_add_one_eq_ite_forall,Nat.testBit_add_one_of_lowest: lower-bit prefix and lowest-zero forms ofNat.testBit_add_one_eq_xor.Nat.testBit_sub_two_pow,Nat.eq_two_pow_of_testBit: removing a set bit, and the numbers with a single set bit.Nat.testBit_add_four_mul: the bits of a two-bit tag followed by a payload.Nat.testBit_add_two_pow_mul_add_two_pow_mul: the bits of three packed fields.