Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.

Commit 16daabf

Browse files
committed
chore(algebra/group_power): golf a few proofs (#10498)
* move `pow_lt_pow_of_lt_one` and `pow_lt_pow_iff_of_lt_one` from `algebra.group_power.lemmas` to `algebra.group_power.order`; * add `strict_anti_pow`, use it to golf the proofs of the two lemmas above; * golf a few other proofs; * add `nnreal.exists_pow_lt_of_lt_one`.
1 parent 77ba0c4 commit 16daabf

File tree

4 files changed

+19
-46
lines changed

4 files changed

+19
-46
lines changed

src/algebra/group_power/lemmas.lean

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -429,39 +429,12 @@ calc 1 + (↑(n + 2) : R) * a ≤ 1 + ↑(n + 2) * a + (n * (a * a * (2 + a)) +
429429
mul_le_mul_of_nonneg_left (one_add_mul_le_pow' n) Hsq'
430430
... = (1 + a)^(n + 2) : by simp only [pow_succ, mul_assoc]
431431

432-
private lemma pow_lt_pow_of_lt_one_aux (h : 0 < a) (ha : a < 1) (i : ℕ) :
433-
∀ k : ℕ, a ^ (i + k + 1) < a ^ i
434-
| 0 :=
435-
begin
436-
rw [←one_mul (a^i), add_zero, pow_succ],
437-
exact mul_lt_mul ha (le_refl _) (pow_pos h _) zero_le_one
438-
end
439-
| (k+1) :=
440-
begin
441-
rw [←one_mul (a^i), pow_succ],
442-
apply mul_lt_mul ha _ _ zero_le_one,
443-
{ apply le_of_lt, apply pow_lt_pow_of_lt_one_aux },
444-
{ show 0 < a ^ (i + (k + 1) + 0), apply pow_pos h }
445-
end
446-
447432
private lemma pow_le_pow_of_le_one_aux (h : 0 ≤ a) (ha : a ≤ 1) (i : ℕ) :
448433
∀ k : ℕ, a ^ (i + k) ≤ a ^ i
449434
| 0 := by simp
450435
| (k+1) := by { rw [←add_assoc, ←one_mul (a^i), pow_succ],
451436
exact mul_le_mul ha (pow_le_pow_of_le_one_aux _) (pow_nonneg h _) zero_le_one }
452437

453-
lemma pow_lt_pow_of_lt_one (h : 0 < a) (ha : a < 1)
454-
{i j : ℕ} (hij : i < j) : a ^ j < a ^ i :=
455-
let ⟨k, hk⟩ := nat.exists_eq_add_of_lt hij in
456-
by rw hk; exact pow_lt_pow_of_lt_one_aux h ha _ _
457-
458-
lemma pow_lt_pow_iff_of_lt_one {n m : ℕ} (hpos : 0 < a) (h : a < 1) :
459-
a ^ m < a ^ n ↔ n < m :=
460-
begin
461-
have : strict_mono (λ (n : order_dual ℕ), a ^ (id n : ℕ)) := λ m n, pow_lt_pow_of_lt_one hpos h,
462-
exact this.lt_iff_lt
463-
end
464-
465438
lemma pow_le_pow_of_le_one (h : 0 ≤ a) (ha : a ≤ 1) {i j : ℕ} (hij : i ≤ j) :
466439
a ^ j ≤ a ^ i :=
467440
let ⟨k, hk⟩ := nat.exists_eq_add_of_le hij in

src/algebra/group_power/order.lean

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -191,20 +191,23 @@ strict_mono_pow h h2
191191
lemma pow_lt_pow_iff (h : 1 < a) : a ^ n < a ^ m ↔ n < m :=
192192
(strict_mono_pow h).lt_iff_lt
193193

194+
lemma strict_anti_pow (h₀ : 0 < a) (h₁ : a < 1) : strict_anti (λ n : ℕ, a ^ n) :=
195+
strict_anti_nat_of_succ_lt $ λ n,
196+
by simpa only [pow_succ, one_mul] using mul_lt_mul h₁ le_rfl (pow_pos h₀ n) zero_le_one
197+
198+
lemma pow_lt_pow_iff_of_lt_one (h₀ : 0 < a) (h₁ : a < 1) : a ^ m < a ^ n ↔ n < m :=
199+
(strict_anti_pow h₀ h₁).lt_iff_lt
200+
201+
lemma pow_lt_pow_of_lt_one (h : 0 < a) (ha : a < 1) {i j : ℕ} (hij : i < j) : a ^ j < a ^ i :=
202+
(pow_lt_pow_iff_of_lt_one h ha).2 hij
203+
194204
@[mono] lemma pow_le_pow_of_le_left {a b : R} (ha : 0 ≤ a) (hab : a ≤ b) : ∀ i : ℕ, a^i ≤ b^i
195205
| 0 := by simp
196206
| (k+1) := by { rw [pow_succ, pow_succ],
197207
exact mul_le_mul hab (pow_le_pow_of_le_left _) (pow_nonneg ha _) (le_trans ha hab) }
198208

199-
lemma one_lt_pow (ha : 1 < a) : ∀ {n : ℕ}, n ≠ 01 < a ^ n
200-
| 0 h := (h rfl).elim
201-
| 1 h := (pow_one a).symm.subst ha
202-
| (n + 2) h :=
203-
begin
204-
nontriviality R,
205-
rw [←one_mul (1 : R), pow_succ],
206-
exact mul_lt_mul ha (one_lt_pow (nat.succ_ne_zero _)).le zero_lt_one (zero_lt_one.trans ha).le,
207-
end
209+
lemma one_lt_pow (ha : 1 < a) {n : ℕ} (hn : n ≠ 0) : 1 < a ^ n :=
210+
pow_zero a ▸ pow_lt_pow ha (pos_iff_ne_zero.2 hn)
208211

209212
lemma pow_le_one : ∀ (n : ℕ) (h₀ : 0 ≤ a) (h₁ : a ≤ 1), a ^ n ≤ 1
210213
| 0 h₀ h₁ := (pow_zero a).le

src/algebra/order/ring.lean

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -714,16 +714,14 @@ lemma mul_le_iff_le_one_left (hb : 0 < b) : a * b ≤ b ↔ a ≤ 1 :=
714714
λ h, le_of_not_lt (mt (lt_mul_iff_one_lt_left hb).1 h.not_lt) ⟩
715715

716716
lemma mul_lt_iff_lt_one_left (hb : 0 < b) : a * b < b ↔ a < 1 :=
717-
⟨ λ h, lt_of_not_ge (mt (le_mul_iff_one_le_left hb).2 h.not_le),
718-
λ h, lt_of_not_ge (mt (le_mul_iff_one_le_left hb).1 h.not_le) ⟩
717+
lt_iff_lt_of_le_iff_le $ le_mul_iff_one_le_left hb
719718

720719
lemma mul_le_iff_le_one_right (hb : 0 < b) : b * a ≤ b ↔ a ≤ 1 :=
721720
⟨ λ h, le_of_not_lt (mt (lt_mul_iff_one_lt_right hb).2 h.not_lt),
722721
λ h, le_of_not_lt (mt (lt_mul_iff_one_lt_right hb).1 h.not_lt) ⟩
723722

724723
lemma mul_lt_iff_lt_one_right (hb : 0 < b) : b * a < b ↔ a < 1 :=
725-
⟨ λ h, lt_of_not_ge (mt (le_mul_iff_one_le_right hb).2 h.not_le),
726-
λ h, lt_of_not_ge (mt (le_mul_iff_one_le_right hb).1 h.not_le) ⟩
724+
lt_iff_lt_of_le_iff_le $ le_mul_iff_one_le_right hb
727725

728726
lemma nonpos_of_mul_nonneg_left (h : 0 ≤ a * b) (hb : b < 0) : a ≤ 0 :=
729727
le_of_not_gt (λ ha, absurd h (mul_neg_of_pos_of_neg ha hb).not_le)

src/data/real/nnreal.lean

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -488,12 +488,11 @@ section pow
488488

489489
lemma pow_antitone_exp {a : ℝ≥0} (m n : ℕ) (mn : m ≤ n) (a1 : a ≤ 1) :
490490
a ^ n ≤ a ^ m :=
491-
begin
492-
rcases le_iff_exists_add.mp mn with ⟨k, rfl⟩,
493-
rw [← mul_one (a ^ m), pow_add],
494-
refine mul_le_mul rfl.le (pow_le_one _ (zero_le a) a1) _ _;
495-
exact pow_nonneg (zero_le _) _,
496-
end
491+
pow_le_pow_of_le_one (zero_le a) a1 mn
492+
493+
lemma exists_pow_lt_of_lt_one {a b : ℝ≥0} (ha : 0 < a) (hb : b < 1) : ∃ n : ℕ, b ^ n < a :=
494+
by simpa only [← coe_pow, nnreal.coe_lt_coe]
495+
using exists_pow_lt_of_lt_one (nnreal.coe_pos.2 ha) (nnreal.coe_lt_coe.2 hb)
497496

498497
lemma exists_mem_Ico_zpow
499498
{x : ℝ≥0} {y : ℝ≥0} (hx : x ≠ 0) (hy : 1 < y) :

0 commit comments

Comments
 (0)