Documentation

CslibFrontier.Foundations.Data.Nat.Clog

Ceiling logarithms of powers #

Encoding an m-tuple over an alphabet of size n in base b uses ⌈log_b (n ^ m)⌉ digits, which is at most m · ⌈log_b n⌉ (Nat.clog_pow_le_mul), the cost of encoding each coordinate separately.

Main results #

theorem Nat.clog_pow_le_mul (b n m : ℕ) :
clog b (n ^ m) ≤ m * clog b n

Ceiling logarithm of an m-th power: ⌈log_b (n ^ m)⌉ ≤ m · ⌈log_b n⌉.

theorem Nat.clog_le_self (b n : ℕ) :
clog b n ≤ n

Ceiling logarithm is bounded by its argument: ⌈log_b n⌉ ≤ n.