Documentation

Regex.Data.Nat

@[irreducible]
def Nat.popcount (n : Nat) :
Equations
Instances For
    @[simp]
    theorem Nat.popcount_ne {n : Nat} (h : n 0) :
    n.popcount = (n / 2).popcount + n % 2
    theorem Nat.popcount_odd {n : Nat} (h : n.testBit 0 = true) :
    n.popcount = (n / 2).popcount + 1
    theorem Nat.popcount_even {n : Nat} (h : ¬n.testBit 0 = true) :
    theorem Nat.popcount_le_of_lt_pow {n w : Nat} (h : n < 2 ^ w) :
    @[simp]
    theorem Nat.one_shiftLeft_mod_two_pow {n w : Nat} (h : n < w) :
    1 <<< n % 2 ^ w = 1 <<< n