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

Commit 6e64492

Browse files
feat(ring_theory/multiplicity): Equality of factorization, multiplicity, and padic_val_nat (#12033)
Proves `multiplicity_eq_factorization : multiplicity p n = n.factorization p` for prime `p` and `n ≠ 0` and uses this to golf the proof of `padic_val_nat_eq_factorization : padic_val_nat p n = n.factorization p`.
1 parent 9307f5b commit 6e64492

File tree

2 files changed

+10
-19
lines changed

2 files changed

+10
-19
lines changed

src/number_theory/padics/padic_norm.lean

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -473,26 +473,12 @@ protected lemma padic_val_nat.div' {p : ℕ} [p_prime : fact p.prime] :
473473
{ exact hc } },
474474
end
475475

476-
lemma padic_val_nat_eq_factorization (p : ℕ) [hp : fact p.prime] :
477-
∀ (n : ℕ), padic_val_nat p n = n.factorization p
478-
| 0 := by simp
479-
| 1 := by simp
480-
| (m + 2) :=
481-
let n := m + 2 in
482-
let q := min_fac n in
483-
have hq : fact q.prime := ⟨min_fac_prime (show m + 21, by linarith)⟩,
484-
have wf : n / q < n := nat.div_lt_self (nat.succ_pos _) hq.1.one_lt,
476+
lemma padic_val_nat_eq_factorization (p n : ℕ) [hp : fact p.prime] :
477+
padic_val_nat p n = n.factorization p :=
485478
begin
486-
rw [←factors_count_eq, factors_add_two],
487-
show padic_val_nat p n = list.count p (q :: (factors (n / q))),
488-
rw [list.count_cons', factors_count_eq, ← padic_val_nat_eq_factorization],
489-
split_ifs with h,
490-
{ have hp : p ∣ n := h.symm ▸ nat.min_fac_dvd n,
491-
rw [←h, padic_val_nat.div hp],
492-
exact (tsub_eq_iff_eq_add_of_le $ one_le_padic_val_nat_of_dvd (by linarith) hp).mp rfl, },
493-
{ suffices : p.coprime q,
494-
{ rw [padic_val_nat.div' this (min_fac_dvd n), add_zero] },
495-
rwa nat.coprime_primes hp.1 hq.1, },
479+
by_cases hn : n = 0, { subst hn, simp },
480+
rw @padic_val_nat_def p _ n hn,
481+
simp [@multiplicity_eq_factorization n p hp.elim hn],
496482
end
497483

498484
open_locale big_operators

src/ring_theory/multiplicity.lean

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ Authors: Robert Y. Lewis, Chris Hughes
66
import algebra.associated
77
import algebra.big_operators.basic
88
import ring_theory.valuation.basic
9+
import data.nat.factorization
910

1011
/-!
1112
# Multiplicity of a divisor
@@ -485,4 +486,8 @@ begin
485486
exact hp this
486487
end
487488

489+
lemma multiplicity_eq_factorization {n p : ℕ} (pp : p.prime) (hn : n ≠ 0) :
490+
multiplicity p n = n.factorization p :=
491+
multiplicity.eq_coe_iff.mpr ⟨pow_factorization_dvd n p, pow_succ_factorization_not_dvd hn pp⟩
492+
488493
end nat

0 commit comments

Comments
 (0)