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

Commit 798c61b

Browse files
committed
feat(data/nat/prime): eq_prime_pow_of_dvd_least_prime_pow (#2791)
Proves ```lean lemma eq_prime_pow_of_dvd_least_prime_pow (a p k : ℕ) (pp : prime p) (h₁ : ¬(a ∣ p^k)) (h₂ : a ∣ p^(k+1)) : a = p^(k+1) ```
1 parent 85f08ec commit 798c61b

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed

src/data/nat/basic.lean

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -957,6 +957,25 @@ strict_mono.lt_iff_lt (pow_right_strict_mono k)
957957
lemma pow_right_injective {x : ℕ} (k : 2 ≤ x) : function.injective (nat.pow x) :=
958958
strict_mono.injective (pow_right_strict_mono k)
959959

960+
lemma pow_dvd_pow_iff_pow_le_pow {k l : ℕ} : Π {x : ℕ} (w : 0 < x), x^k ∣ x^l ↔ x^k ≤ x^l
961+
| (x+1) w :=
962+
begin
963+
split,
964+
{ intro a, exact le_of_dvd (pow_pos (succ_pos x) l) a, },
965+
{ intro a, cases x with x,
966+
{ simp only [one_pow], },
967+
{ have le := (pow_le_iff_le_right (le_add_left _ _)).mp a,
968+
use (x+2)^(l-k),
969+
rw [←nat.pow_add, add_comm k, nat.sub_add_cancel le], } }
970+
end
971+
972+
/-- If `1 < x`, then `x^k` divides `x^l` if and only if `k` is at most `l`. -/
973+
lemma pow_dvd_pow_iff_le_right {x k l : ℕ} (w : 1 < x) : x^k ∣ x^l ↔ k ≤ l :=
974+
by rw [pow_dvd_pow_iff_pow_le_pow (lt_of_succ_lt w), pow_le_iff_le_right w]
975+
976+
lemma pow_dvd_pow_iff_le_right' {b k l : ℕ} : (b+2)^k ∣ (b+2)^l ↔ k ≤ l :=
977+
pow_dvd_pow_iff_le_right (nat.lt_of_sub_eq_succ rfl)
978+
960979
lemma pow_left_strict_mono {m : ℕ} (k : 1 ≤ m) : strict_mono (λ (x : ℕ), x^m) :=
961980
λ _ _ h, pow_lt_pow_of_lt_left h k
962981

src/data/nat/prime.lean

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -460,6 +460,20 @@ begin
460460
rw e, exact pow_dvd_pow _ l } }
461461
end
462462

463+
/--
464+
If `p` is prime,
465+
and `a` doesn't divide `p^k`, but `a` does divide `p^(k+1)`
466+
then `a = p^(k+1)`.
467+
-/
468+
lemma eq_prime_pow_of_dvd_least_prime_pow
469+
{a p k : ℕ} (pp : prime p) (h₁ : ¬(a ∣ p^k)) (h₂ : a ∣ p^(k+1)) :
470+
a = p^(k+1) :=
471+
begin
472+
obtain ⟨l, ⟨h, rfl⟩⟩ := (dvd_prime_pow pp).1 h₂,
473+
congr,
474+
exact le_antisymm h (not_le.1 ((not_congr (pow_dvd_pow_iff_le_right (prime.one_lt pp))).1 h₁)),
475+
end
476+
463477
section
464478
open list
465479

0 commit comments

Comments
 (0)