File: Mathlib/Data/Nat/Log.lean

full_name: Nat.log
code: /-- `log b n`, is the logarithm of natural number `n` in base `b`. It returns the largest `k : ℕ`
such that `b^k ≤ n`, so if `b^k = n`, it returns exactly `k`. -/
@[pp_nodot]
def log (b : ℕ) : ℕ → ℕ
  
goal: ℕ → ℕ

full_name: Nat.log_eq_zero_iff
code: @[simp]
theorem log_eq_zero_iff {b n : ℕ} : log b n = 0 ↔ n < b ∨ b ≤ 1 
goal: Nat.log b n = 0 ↔ n < b ∨ b ≤ 1

full_name: Nat.log_of_lt
code: theorem log_of_lt {b n : ℕ} (hb : n < b) : log b n = 0 
goal: Nat.log b n = 0

full_name: Nat.log_of_left_le_one
code: theorem log_of_left_le_one {b : ℕ} (hb : b ≤ 1) (n) : log b n = 0 
goal: Nat.log b n = 0

full_name: Nat.log_pos_iff
code: @[simp]
theorem log_pos_iff {b n : ℕ} : 0 < log b n ↔ b ≤ n ∧ 1 < b 
goal: 0 < Nat.log b n ↔ b ≤ n ∧ 1 < b

full_name: Nat.log_pos
code: theorem log_pos {b n : ℕ} (hb : 1 < b) (hbn : b ≤ n) : 0 < log b n 
goal: 0 < Nat.log b n

full_name: Nat.log_of_one_lt_of_le
code: theorem log_of_one_lt_of_le {b n : ℕ} (h : 1 < b) (hn : b ≤ n) : log b n = log b (n / b) + 1 
goal: Nat.log b n = Nat.log b (n / b) + 1

full_name: Nat.log_zero_left
code: @[simp] lemma log_zero_left : ∀ n, log 0 n = 0 
goal: Nat.log 0 n = 0

full_name: Nat.log_zero_right
code: @[simp]
theorem log_zero_right (b : ℕ) : log b 0 = 0 
goal: Nat.log b 0 = 0

full_name: Nat.log_one_left
code: @[simp]
theorem log_one_left : ∀ n, log 1 n = 0 
goal: Nat.log 1 n = 0

full_name: Nat.log_one_right
code: @[simp]
theorem log_one_right (b : ℕ) : log b 1 = 0 
goal: Nat.log b 1 = 0

full_name: Nat.pow_le_iff_le_log
code: /-- `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. -/
theorem pow_le_iff_le_log {b : ℕ} (hb : 1 < b) {x y : ℕ} (hy : y ≠ 0) :
    b ^ x ≤ y ↔ x ≤ log b y 
goal: b ^ x ≤ y ↔ x ≤ Nat.log b y

full_name: Nat.lt_pow_iff_log_lt
code: theorem lt_pow_iff_log_lt {b : ℕ} (hb : 1 < b) {x y : ℕ} (hy : y ≠ 0) : y < b ^ x ↔ log b y < x 
goal: y < b ^ x ↔ Nat.log b y < x

full_name: Nat.pow_le_of_le_log
code: theorem pow_le_of_le_log {b x y : ℕ} (hy : y ≠ 0) (h : x ≤ log b y) : b ^ x ≤ y 
goal: b ^ x ≤ y

full_name: Nat.le_log_of_pow_le
code: theorem le_log_of_pow_le {b x y : ℕ} (hb : 1 < b) (h : b ^ x ≤ y) : x ≤ log b y 
goal: x ≤ Nat.log b y

full_name: Nat.pow_log_le_self
code: theorem pow_log_le_self (b : ℕ) {x : ℕ} (hx : x ≠ 0) : b ^ log b x ≤ x 
goal: b ^ Nat.log b x ≤ x

full_name: Nat.log_lt_of_lt_pow
code: theorem log_lt_of_lt_pow {b x y : ℕ} (hy : y ≠ 0) : y < b ^ x → log b y < x 
goal: y < b ^ x → Nat.log b y < x

full_name: Nat.lt_pow_of_log_lt
code: theorem lt_pow_of_log_lt {b x y : ℕ} (hb : 1 < b) : log b y < x → y < b ^ x 
goal: Nat.log b y < x → y < b ^ x

full_name: Nat.lt_pow_succ_log_self
code: theorem lt_pow_succ_log_self {b : ℕ} (hb : 1 < b) (x : ℕ) : x < b ^ (log b x).succ 
goal: x < b ^ (Nat.log b x).succ

full_name: Nat.log_eq_iff
code: theorem log_eq_iff {b m n : ℕ} (h : m ≠ 0 ∨ 1 < b ∧ n ≠ 0) :
    log b n = m ↔ b ^ m ≤ n ∧ n < b ^ (m + 1) 
goal: Nat.log b n = m ↔ b ^ m ≤ n ∧ n < b ^ (m + 1)

full_name: Nat.log_eq_of_pow_le_of_lt_pow
code: theorem log_eq_of_pow_le_of_lt_pow {b m n : ℕ} (h₁ : b ^ m ≤ n) (h₂ : n < b ^ (m + 1)) :
    log b n = m 
goal: Nat.log b n = m

full_name: Nat.log_pow
code: theorem log_pow {b : ℕ} (hb : 1 < b) (x : ℕ) : log b (b ^ x) = x 
goal: Nat.log b (b ^ x) = x

full_name: Nat.log_eq_one_iff'
code: theorem log_eq_one_iff' {b n : ℕ} : log b n = 1 ↔ b ≤ n ∧ n < b * b 
goal: Nat.log b n = 1 ↔ b ≤ n ∧ n < b * b

full_name: Nat.log_eq_one_iff
code: theorem log_eq_one_iff {b n : ℕ} : log b n = 1 ↔ n < b * b ∧ 1 < b ∧ b ≤ n 
goal: Nat.log b n = 1 ↔ n < b * b ∧ 1 < b ∧ b ≤ n

full_name: Nat.log_mul_base
code: theorem log_mul_base {b n : ℕ} (hb : 1 < b) (hn : n ≠ 0) : log b (n * b) = log b n + 1 
goal: Nat.log b (n * b) = Nat.log b n + 1

full_name: Nat.pow_log_le_add_one
code: theorem pow_log_le_add_one (b : ℕ) : ∀ x, b ^ log b x ≤ x + 1
  
goal: b ^ Nat.log b x ≤ x + 1

full_name: Nat.log_monotone
code: theorem log_monotone {b : ℕ} : Monotone (log b) 
goal: Monotone (Nat.log b)

full_name: Nat.log_mono_right
code: @[mono]
theorem log_mono_right {b n m : ℕ} (h : n ≤ m) : log b n ≤ log b m 
goal: Nat.log b n ≤ Nat.log b m

full_name: Nat.log_anti_left
code: @[mono]
theorem log_anti_left {b c n : ℕ} (hc : 1 < c) (hb : c ≤ b) : log b n ≤ log c n 
goal: Nat.log b n ≤ Nat.log c n

full_name: Nat.log_antitone_left
code: theorem log_antitone_left {n : ℕ} : AntitoneOn (fun b => log b n) (Set.Ioi 1) 
goal: AntitoneOn (fun b => Nat.log b n) (Set.Ioi 1)

full_name: Nat.log_div_base
code: @[simp]
theorem log_div_base (b n : ℕ) : log b (n / b) = log b n - 1 
goal: Nat.log b (n / b) = Nat.log b n - 1

full_name: Nat.log_div_mul_self
code: @[simp]
theorem log_div_mul_self (b n : ℕ) : log b (n / b * b) = log b n 
goal: Nat.log b (n / b * b) = Nat.log b n

full_name: Nat.add_pred_div_lt
code: theorem add_pred_div_lt {b n : ℕ} (hb : 1 < b) (hn : 2 ≤ n) : (n + b - 1) / b < n 
goal: (n + b - 1) / b < n

full_name: Nat.clog
code: /-- `clog b n`, is the upper logarithm of natural number `n` in base `b`. It returns the smallest
`k : ℕ` such that `n ≤ b^k`, so if `b^k = n`, it returns exactly `k`. -/
@[pp_nodot]
def clog (b : ℕ) : ℕ → ℕ
  
goal: ℕ → ℕ

full_name: Nat.clog_of_left_le_one
code: theorem clog_of_left_le_one {b : ℕ} (hb : b ≤ 1) (n : ℕ) : clog b n = 0 
goal: Nat.clog b n = 0

full_name: Nat.clog_of_right_le_one
code: theorem clog_of_right_le_one {n : ℕ} (hn : n ≤ 1) (b : ℕ) : clog b n = 0 
goal: Nat.clog b n = 0

full_name: Nat.clog_zero_left
code: @[simp] lemma clog_zero_left (n : ℕ) : clog 0 n = 0 
goal: Nat.clog 0 n = 0

full_name: Nat.clog_zero_right
code: @[simp] lemma clog_zero_right (b : ℕ) : clog b 0 = 0 
goal: Nat.clog b 0 = 0

full_name: Nat.clog_one_left
code: @[simp]
theorem clog_one_left (n : ℕ) : clog 1 n = 0 
goal: Nat.clog 1 n = 0

full_name: Nat.clog_one_right
code: @[simp]
theorem clog_one_right (b : ℕ) : clog b 1 = 0 
goal: Nat.clog b 1 = 0

full_name: Nat.clog_of_two_le
code: theorem clog_of_two_le {b n : ℕ} (hb : 1 < b) (hn : 2 ≤ n) :
    clog b n = clog b ((n + b - 1) / b) + 1 
goal: Nat.clog b n = Nat.clog b ((n + b - 1) / b) + 1

full_name: Nat.clog_pos
code: theorem clog_pos {b n : ℕ} (hb : 1 < b) (hn : 2 ≤ n) : 0 < clog b n 
goal: 0 < Nat.clog b n

full_name: Nat.clog_eq_one
code: theorem clog_eq_one {b n : ℕ} (hn : 2 ≤ n) (h : n ≤ b) : clog b n = 1 
goal: Nat.clog b n = 1

full_name: Nat.le_pow_iff_clog_le
code: /-- `clog b` and `pow b` form a Galois connection. -/
theorem le_pow_iff_clog_le {b : ℕ} (hb : 1 < b) {x y : ℕ} : x ≤ b ^ y ↔ clog b x ≤ y 
goal: x ≤ b ^ y ↔ Nat.clog b x ≤ y

full_name: Nat.pow_lt_iff_lt_clog
code: theorem pow_lt_iff_lt_clog {b : ℕ} (hb : 1 < b) {x y : ℕ} : b ^ y < x ↔ y < clog b x 
goal: b ^ y < x ↔ y < Nat.clog b x

full_name: Nat.clog_pow
code: theorem clog_pow (b x : ℕ) (hb : 1 < b) : clog b (b ^ x) = x 
goal: Nat.clog b (b ^ x) = x

full_name: Nat.pow_pred_clog_lt_self
code: theorem pow_pred_clog_lt_self {b : ℕ} (hb : 1 < b) {x : ℕ} (hx : 1 < x) :
    b ^ (clog b x).pred < x 
goal: b ^ (Nat.clog b x).pred < x

full_name: Nat.le_pow_clog
code: theorem le_pow_clog {b : ℕ} (hb : 1 < b) (x : ℕ) : x ≤ b ^ clog b x 
goal: x ≤ b ^ Nat.clog b x

full_name: Nat.clog_mono_right
code: @[mono]
theorem clog_mono_right (b : ℕ) {n m : ℕ} (h : n ≤ m) : clog b n ≤ clog b m 
goal: Nat.clog b n ≤ Nat.clog b m

full_name: Nat.clog_anti_left
code: @[mono]
theorem clog_anti_left {b c n : ℕ} (hc : 1 < c) (hb : c ≤ b) : clog b n ≤ clog c n 
goal: Nat.clog b n ≤ Nat.clog c n

full_name: Nat.clog_monotone
code: theorem clog_monotone (b : ℕ) : Monotone (clog b) 
goal: Monotone (Nat.clog b)

full_name: Nat.clog_antitone_left
code: theorem clog_antitone_left {n : ℕ} : AntitoneOn (fun b : ℕ => clog b n) (Set.Ioi 1) 
goal: AntitoneOn (fun b => Nat.clog b n) (Set.Ioi 1)

full_name: Nat.log_le_clog
code: theorem log_le_clog (b n : ℕ) : log b n ≤ clog b n 
goal: Nat.log b n ≤ Nat.clog b n