Documentation

Init.Data.Nat.Power2

theorem Nat.nextPowerOfTwo_dec {n power : Nat} (h₁ : power > 0) (h₂ : power < n) :
n - power * 2 < n - power

Returns the least power of two that's greater than or equal to n.

Examples:

Equations
Instances For

    A natural number n is a power of two if there exists some k : Nat such that n = 2 ^ k.

    Equations
    Instances For
      theorem Nat.pos_of_isPowerOfTwo {n : Nat} (h : n.isPowerOfTwo) :
      n > 0