Natural number logarithms #
THIS FILE IS SYNCHRONIZED WITH MATHLIB4. Any changes to this file require a corresponding PR to mathlib4.
This file defines two ℕ-valued analogs of the logarithm of n with base b:
log b n: Lower logarithm, or floor log. Greatestksuch thatb^k ≤ n.clog b n: Upper logarithm, or ceil log. Leastksuch thatn ≤ b^k.
These are interesting because, for 1 < b, nat.log b and nat.clog b are respectively right and
left adjoints of nat.pow b. See pow_le_iff_le_log and le_pow_iff_clog_le.
Floor logarithm #
pow b and log b (almost) form a Galois connection. See also nat.pow_le_of_le_log and
nat.le_log_of_pow_le for individual implications under weaker assumptions.