Theorem: Nat.le_pow_iff_clog_le
File: Mathlib/Data/Nat/Log.lean

tactic: induction' x using Nat.strong_induction_on with x ih generalizing y
state_before: b : ℕ
hb : 1 < b
x y : ℕ
⊢ x ≤ b ^ y ↔ clog b x ≤ y
state_after: case h
b : ℕ
hb : 1 < b
x : ℕ
ih : ∀ m < x, ∀ {y : ℕ}, m ≤ b ^ y ↔ clog b m ≤ y
y : ℕ
⊢ x ≤ b ^ y ↔ clog b x ≤ y

tactic: cases y
state_before: case h
b : ℕ
hb : 1 < b
x : ℕ
ih : ∀ m < x, ∀ {y : ℕ}, m ≤ b ^ y ↔ clog b m ≤ y
y : ℕ
⊢ x ≤ b ^ y ↔ clog b x ≤ y
state_after: case h.zero
b : ℕ
hb : 1 < b
x : ℕ
ih : ∀ m < x, ∀ {y : ℕ}, m ≤ b ^ y ↔ clog b m ≤ y
⊢ x ≤ b ^ 0 ↔ clog b x ≤ 0

case h.succ
b : ℕ
hb : 1 < b
x : ℕ
ih : ∀ m < x, ∀ {y : ℕ}, m ≤ b ^ y ↔ clog b m ≤ y
n✝ : ℕ
⊢ x ≤ b ^ (n✝ + 1) ↔ clog b x ≤ n✝ + 1

tactic: have b_pos : 0 < b := zero_lt_of_lt hb
state_before: case h.succ
b : ℕ
hb : 1 < b
x : ℕ
ih : ∀ m < x, ∀ {y : ℕ}, m ≤ b ^ y ↔ clog b m ≤ y
n✝ : ℕ
⊢ x ≤ b ^ (n✝ + 1) ↔ clog b x ≤ n✝ + 1
state_after: case h.succ
b : ℕ
hb : 1 < b
x : ℕ
ih : ∀ m < x, ∀ {y : ℕ}, m ≤ b ^ y ↔ clog b m ≤ y
n✝ : ℕ
b_pos : 0 < b
⊢ x ≤ b ^ (n✝ + 1) ↔ clog b x ≤ n✝ + 1

tactic: rw [clog]
state_before: case h.succ
b : ℕ
hb : 1 < b
x : ℕ
ih : ∀ m < x, ∀ {y : ℕ}, m ≤ b ^ y ↔ clog b m ≤ y
n✝ : ℕ
b_pos : 0 < b
⊢ x ≤ b ^ (n✝ + 1) ↔ clog b x ≤ n✝ + 1
state_after: case h.succ
b : ℕ
hb : 1 < b
x : ℕ
ih : ∀ m < x, ∀ {y : ℕ}, m ≤ b ^ y ↔ clog b m ≤ y
n✝ : ℕ
b_pos : 0 < b
⊢ x ≤ b ^ (n✝ + 1) ↔ (if h : 1 < b ∧ 1 < x then clog b ((x + b - 1) / b) + 1 else 0) ≤ n✝ + 1

tactic: split_ifs with h
state_before: case h.succ
b : ℕ
hb : 1 < b
x : ℕ
ih : ∀ m < x, ∀ {y : ℕ}, m ≤ b ^ y ↔ clog b m ≤ y
n✝ : ℕ
b_pos : 0 < b
⊢ x ≤ b ^ (n✝ + 1) ↔ (if h : 1 < b ∧ 1 < x then clog b ((x + b - 1) / b) + 1 else 0) ≤ n✝ + 1
state_after: case pos
b : ℕ
hb : 1 < b
x : ℕ
ih : ∀ m < x, ∀ {y : ℕ}, m ≤ b ^ y ↔ clog b m ≤ y
n✝ : ℕ
b_pos : 0 < b
h : 1 < b ∧ 1 < x
⊢ x ≤ b ^ (n✝ + 1) ↔ clog b ((x + b - 1) / b) + 1 ≤ n✝ + 1

case neg
b : ℕ
hb : 1 < b
x : ℕ
ih : ∀ m < x, ∀ {y : ℕ}, m ≤ b ^ y ↔ clog b m ≤ y
n✝ : ℕ
b_pos : 0 < b
h : ¬(1 < b ∧ 1 < x)
⊢ x ≤ b ^ (n✝ + 1) ↔ 0 ≤ n✝ + 1

tactic: rw [Nat.pow_zero]
state_before: case h.zero
b : ℕ
hb : 1 < b
x : ℕ
ih : ∀ m < x, ∀ {y : ℕ}, m ≤ b ^ y ↔ clog b m ≤ y
⊢ x ≤ b ^ 0 ↔ clog b x ≤ 0
state_after: case h.zero
b : ℕ
hb : 1 < b
x : ℕ
ih : ∀ m < x, ∀ {y : ℕ}, m ≤ b ^ y ↔ clog b m ≤ y
⊢ x ≤ 1 ↔ clog b x ≤ 0

tactic: refine ⟨fun h => (clog_of_right_le_one h b).le, ?_⟩
state_before: case h.zero
b : ℕ
hb : 1 < b
x : ℕ
ih : ∀ m < x, ∀ {y : ℕ}, m ≤ b ^ y ↔ clog b m ≤ y
⊢ x ≤ 1 ↔ clog b x ≤ 0
state_after: case h.zero
b : ℕ
hb : 1 < b
x : ℕ
ih : ∀ m < x, ∀ {y : ℕ}, m ≤ b ^ y ↔ clog b m ≤ y
⊢ clog b x ≤ 0 → x ≤ 1

tactic: simp_rw [← not_lt]
state_before: case h.zero
b : ℕ
hb : 1 < b
x : ℕ
ih : ∀ m < x, ∀ {y : ℕ}, m ≤ b ^ y ↔ clog b m ≤ y
⊢ clog b x ≤ 0 → x ≤ 1
state_after: case h.zero
b : ℕ
hb : 1 < b
x : ℕ
ih : ∀ m < x, ∀ {y : ℕ}, m ≤ b ^ y ↔ clog b m ≤ y
⊢ ¬0 < clog b x → ¬1 < x

tactic: contrapose!
state_before: case h.zero
b : ℕ
hb : 1 < b
x : ℕ
ih : ∀ m < x, ∀ {y : ℕ}, m ≤ b ^ y ↔ clog b m ≤ y
⊢ ¬0 < clog b x → ¬1 < x
state_after: case h.zero
b : ℕ
hb : 1 < b
x : ℕ
ih : ∀ m < x, ∀ {y : ℕ}, m ≤ b ^ y ↔ clog b m ≤ y
⊢ 1 < x → 0 < clog b x

tactic: exact clog_pos hb
state_before: case h.zero
b : ℕ
hb : 1 < b
x : ℕ
ih : ∀ m < x, ∀ {y : ℕ}, m ≤ b ^ y ↔ clog b m ≤ y
⊢ 1 < x → 0 < clog b x
state_after: no goals

tactic: rw [Nat.add_le_add_iff_right, ← ih ((x + b - 1) / b) (add_pred_div_lt hb h.2),
  Nat.div_le_iff_le_mul_add_pred b_pos, Nat.mul_comm b, ← Nat.pow_succ,
  Nat.add_sub_assoc (Nat.succ_le_of_lt b_pos), Nat.add_le_add_iff_right]
state_before: case pos
b : ℕ
hb : 1 < b
x : ℕ
ih : ∀ m < x, ∀ {y : ℕ}, m ≤ b ^ y ↔ clog b m ≤ y
n✝ : ℕ
b_pos : 0 < b
h : 1 < b ∧ 1 < x
⊢ x ≤ b ^ (n✝ + 1) ↔ clog b ((x + b - 1) / b) + 1 ≤ n✝ + 1
state_after: no goals

tactic: exact iff_of_true ((not_lt.1 (not_and.1 h hb)).trans <| succ_le_of_lt <| Nat.pow_pos b_pos)
  (zero_le _)
state_before: case neg
b : ℕ
hb : 1 < b
x : ℕ
ih : ∀ m < x, ∀ {y : ℕ}, m ≤ b ^ y ↔ clog b m ≤ y
n✝ : ℕ
b_pos : 0 < b
h : ¬(1 < b ∧ 1 < x)
⊢ x ≤ b ^ (n✝ + 1) ↔ 0 ≤ n✝ + 1
state_after: no goals