File tree 1 file changed +9
-10
lines changed
1 file changed +9
-10
lines changed Original file line number Diff line number Diff line change @@ -30,11 +30,10 @@ namespace Nat
30
30
such that `b^k ≤ n`, so if `b^k = n`, it returns exactly `k`. -/
31
31
--@[ pp_nodot ] porting note: unknown attribute
32
32
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
38
37
#align nat.log Nat.log
39
38
40
39
@[simp]
@@ -238,11 +237,11 @@ theorem add_pred_div_lt {b n : ℕ} (hb : 1 < b) (hn : 2 ≤ n) : (n + b - 1) /
238
237
`k : ℕ` such that `n ≤ b^k`, so if `b^k = n`, it returns exactly `k`. -/
239
238
--@[ pp_nodot ]
240
239
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
+
246
245
#align nat.clog Nat.clog
247
246
248
247
theorem clog_of_left_le_one {b : ℕ} (hb : b ≤ 1 ) (n : ℕ) : clog b n = 0 := by
You can’t perform that action at this time.
0 commit comments