@@ -146,6 +146,7 @@ theorem log_eq_of_pow_le_of_lt_pow {b m n : ℕ} (h₁ : b ^ m ≤ n) (h₂ : n
146
146
exact log_of_lt h₂
147
147
· exact (log_eq_iff (Or.inl hm)).2 ⟨h₁, h₂⟩
148
148
149
+ @[simp]
149
150
theorem log_pow {b : ℕ} (hb : 1 < b) (x : ℕ) : log b (b ^ x) = x :=
150
151
log_eq_of_pow_le_of_lt_pow le_rfl (Nat.pow_lt_pow_right hb x.lt_succ_self)
151
152
@@ -156,6 +157,7 @@ theorem log_eq_one_iff {b n : ℕ} : log b n = 1 ↔ n < b * b ∧ 1 < b ∧ b
156
157
log_eq_one_iff'.trans
157
158
⟨fun h => ⟨h.2 , lt_mul_self_iff.1 (h.1 .trans_lt h.2 ), h.1 ⟩, fun h => ⟨h.2 .2 , h.1 ⟩⟩
158
159
160
+ @[simp]
159
161
theorem log_mul_base {b n : ℕ} (hb : 1 < b) (hn : n ≠ 0 ) : log b (n * b) = log b n + 1 := by
160
162
apply log_eq_of_pow_le_of_lt_pow <;> rw [pow_succ', Nat.mul_comm b]
161
163
exacts [Nat.mul_le_mul_right _ (pow_log_le_self _ hn),
@@ -172,7 +174,7 @@ theorem log_monotone {b : ℕ} : Monotone (log b) := by
172
174
exact zero_le _
173
175
· exact le_log_of_pow_le hb (pow_log_le_add_one _ _)
174
176
175
- @[mono]
177
+ @[mono, gcongr ]
176
178
theorem log_mono_right {b n m : ℕ} (h : n ≤ m) : log b n ≤ log b m :=
177
179
log_monotone h
178
180
@@ -190,7 +192,7 @@ theorem log_eq_log_succ_iff {b n : ℕ} (hb : 1 < b) (hn : n ≠ 0) :
190
192
simp only [le_antisymm_iff, and_iff_right_iff_imp]
191
193
exact fun _ ↦ log_monotone (le_add_right n 1 )
192
194
193
- @[mono]
195
+ @[mono, gcongr ]
194
196
theorem log_anti_left {b c n : ℕ} (hc : 1 < c) (hb : c ≤ b) : log b n ≤ log c n := by
195
197
rcases eq_or_ne n 0 with (rfl | hn); · rw [log_zero_right, log_zero_right]
196
198
apply le_log_of_pow_le hc
@@ -201,6 +203,12 @@ theorem log_anti_left {b c n : ℕ} (hc : 1 < c) (hb : c ≤ b) : log b n ≤ lo
201
203
theorem log_antitone_left {n : ℕ} : AntitoneOn (fun b => log b n) (Set.Ioi 1 ) := fun _ hc _ _ hb =>
202
204
log_anti_left (Set.mem_Iio.1 hc) hb
203
205
206
+ @[gcongr]
207
+ theorem log_mono {b c m n : ℕ} (hc : 1 < c) (hb : c ≤ b) (hmn : m ≤ n) :
208
+ log b m ≤ log c n := by
209
+ trans log c m <;> gcongr
210
+ assumption
211
+
204
212
@[simp]
205
213
theorem log_div_base (b n : ℕ) : log b (n / b) = log b n - 1 := by
206
214
rcases le_or_gt b 1 with hb | hb
@@ -293,6 +301,7 @@ theorem le_pow_iff_clog_le {b : ℕ} (hb : 1 < b) {x y : ℕ} : x ≤ b ^ y ↔
293
301
theorem pow_lt_iff_lt_clog {b : ℕ} (hb : 1 < b) {x y : ℕ} : b ^ y < x ↔ y < clog b x :=
294
302
lt_iff_lt_of_le_iff_le (le_pow_iff_clog_le hb)
295
303
304
+ @[simp]
296
305
theorem clog_pow (b x : ℕ) (hb : 1 < b) : clog b (b ^ x) = x :=
297
306
eq_of_forall_ge_iff fun z ↦ by rw [← le_pow_iff_clog_le hb, Nat.pow_le_pow_iff_right hb]
298
307
@@ -304,15 +313,15 @@ theorem pow_pred_clog_lt_self {b : ℕ} (hb : 1 < b) {x : ℕ} (hx : 1 < x) :
304
313
theorem le_pow_clog {b : ℕ} (hb : 1 < b) (x : ℕ) : x ≤ b ^ clog b x :=
305
314
(le_pow_iff_clog_le hb).2 le_rfl
306
315
307
- @[mono]
316
+ @[mono, gcongr ]
308
317
theorem clog_mono_right (b : ℕ) {n m : ℕ} (h : n ≤ m) : clog b n ≤ clog b m := by
309
318
rcases le_or_gt b 1 with hb | hb
310
319
· rw [clog_of_left_le_one hb]
311
320
exact zero_le _
312
321
· rw [← le_pow_iff_clog_le hb]
313
322
exact h.trans (le_pow_clog hb _)
314
323
315
- @[mono]
324
+ @[mono, gcongr ]
316
325
theorem clog_anti_left {b c n : ℕ} (hc : 1 < c) (hb : c ≤ b) : clog b n ≤ clog c n := by
317
326
rw [← le_pow_iff_clog_le (lt_of_lt_of_le hc hb)]
318
327
calc
@@ -324,6 +333,12 @@ theorem clog_monotone (b : ℕ) : Monotone (clog b) := fun _ _ => clog_mono_righ
324
333
theorem clog_antitone_left {n : ℕ} : AntitoneOn (fun b : ℕ => clog b n) (Set.Ioi 1 ) :=
325
334
fun _ hc _ _ hb => clog_anti_left (Set.mem_Iio.1 hc) hb
326
335
336
+ @[gcongr]
337
+ theorem clog_mono {b c m n : ℕ} (hc : 1 < c) (hb : c ≤ b) (hmn : m ≤ n) :
338
+ clog b m ≤ clog c n := by
339
+ trans clog b n <;> gcongr; assumption
340
+
341
+ @[simp]
327
342
theorem log_le_clog (b n : ℕ) : log b n ≤ clog b n := by
328
343
obtain hb | hb := le_or_gt b 1
329
344
· rw [log_of_left_le_one hb]
0 commit comments