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

Commit 9b1a832

Browse files
committed
feat(data/nat/prime): dvd_of_factors_subperm (#10764)
1 parent d9edeea commit 9b1a832

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/data/nat/prime.lean

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -770,6 +770,20 @@ begin
770770
rw [list.count_append, IH, add_comm, mul_comm, ←mul_succ (count p n.factors) k, mul_comm],
771771
end
772772

773+
lemma dvd_of_factors_subperm {a b : ℕ} (ha : a ≠ 0) (h : a.factors <+~ b.factors) : a ∣ b :=
774+
begin
775+
rcases b.eq_zero_or_pos with rfl | hb,
776+
{ exact dvd_zero _ },
777+
rcases a with (_|_|a),
778+
{ exact (ha rfl).elim },
779+
{ exact one_dvd _ },
780+
use (b.factors.diff a.succ.succ.factors).prod,
781+
nth_rewrite 0 ←nat.prod_factors ha.bot_lt,
782+
rw [←list.prod_append,
783+
list.perm.prod_eq $ list.subperm_append_diff_self_of_count_le $ list.subperm_ext_iff.mp h,
784+
nat.prod_factors hb]
785+
end
786+
773787
end
774788

775789
lemma succ_dvd_or_succ_dvd_of_succ_sum_dvd_mul {p : ℕ} (p_prime : prime p) {m n k l : ℕ}

0 commit comments

Comments
 (0)