Skip to content

Commit dbc8158

Browse files
committed
chore: address unusedHavesSuffices warning
1 parent 88370d7 commit dbc8158

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

Mathlib/Data/Nat/Log.lean

+9-10
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,10 @@ namespace Nat
3030
such that `b^k ≤ n`, so if `b^k = n`, it returns exactly `k`. -/
3131
--@[pp_nodot] porting note: unknown attribute
3232
def log (b : ℕ) : ℕ → ℕ
33-
| n =>
34-
if h : b ≤ n ∧ 1 < b then
35-
have : n / b < n := div_lt_self ((Nat.zero_lt_one.trans h.2).trans_le h.1) h.2
36-
log b (n / b) + 1
37-
else 0
33+
| n => if h : b ≤ n ∧ 1 < b then log b (n / b) + 1 else 0
34+
decreasing_by
35+
have : n / b < n := div_lt_self ((Nat.zero_lt_one.trans h.2).trans_le h.1) h.2
36+
decreasing_trivial
3837
#align nat.log Nat.log
3938

4039
@[simp]
@@ -238,11 +237,11 @@ theorem add_pred_div_lt {b n : ℕ} (hb : 1 < b) (hn : 2 ≤ n) : (n + b - 1) /
238237
`k : ℕ` such that `n ≤ b^k`, so if `b^k = n`, it returns exactly `k`. -/
239238
--@[pp_nodot]
240239
def clog (b : ℕ) : ℕ → ℕ
241-
| n =>
242-
if h : 1 < b ∧ 1 < n then
243-
have : (n + b - 1) / b < n := add_pred_div_lt h.1 h.2
244-
clog b ((n + b - 1) / b) + 1
245-
else 0
240+
| n => if h : 1 < b ∧ 1 < n then clog b ((n + b - 1) / b) + 1 else 0
241+
decreasing_by
242+
have : (n + b - 1) / b < n := add_pred_div_lt h.1 h.2
243+
decreasing_trivial
244+
246245
#align nat.clog Nat.clog
247246

248247
theorem clog_of_left_le_one {b : ℕ} (hb : b ≤ 1) (n : ℕ) : clog b n = 0 := by

0 commit comments

Comments
 (0)