Skip to content

Commit 1bb4553

Browse files
feat: add UniqueFactorizationMonoid.pow_dvd_pow_iff_dvd (leanprover-community#38175)
1 parent 451c573 commit 1bb4553

1 file changed

Lines changed: 27 additions & 0 deletions

File tree

Mathlib/RingTheory/UniqueFactorizationDomain/Multiplicity.lean

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,4 +149,31 @@ lemma finprod_pow_count_eq_of_subsingleton_units [Subsingleton Rˣ] {x : R} (hx
149149

150150
end multiplicity
151151

152+
lemma dvd_iff_emultiplicity_le {a b : R} (ha : a ≠ 0) :
153+
a ∣ b ↔ ∀ p : R, Prime p → emultiplicity p a ≤ emultiplicity p b := by
154+
classical
155+
refine ⟨fun h _ _ ↦ emultiplicity_le_emultiplicity_of_dvd_right h, fun h ↦ ?_⟩
156+
by_cases hb : b = 0
157+
· simp_all
158+
letI : NormalizationMonoid R := UniqueFactorizationMonoid.normalizationMonoid
159+
rw [dvd_iff_normalizedFactors_le_normalizedFactors ha hb, Multiset.le_iff_count]
160+
intro q
161+
by_cases hq : q ∈ normalizedFactors a
162+
· have hqprime : Prime q := prime_of_normalized_factor q hq
163+
have h1 := emultiplicity_eq_count_normalizedFactors hqprime.irreducible ha
164+
have h2 := emultiplicity_eq_count_normalizedFactors hqprime.irreducible hb
165+
rw [normalize_normalized_factor q hq] at h1 h2
166+
simpa [h1, h2] using h q hqprime
167+
· simp [Multiset.count_eq_zero_of_notMem hq]
168+
169+
lemma pow_dvd_pow_iff_dvd {a b : R} {n : ℕ} (hn : n ≠ 0) : a ^ n ∣ b ^ n ↔ a ∣ b := by
170+
by_cases ha : a = 0
171+
· simp [ha, hn]
172+
refine ⟨?_, fun h ↦ pow_dvd_pow_of_dvd h n⟩
173+
rw [dvd_iff_emultiplicity_le (pow_ne_zero n ha), dvd_iff_emultiplicity_le ha]
174+
intro H p hp
175+
have := H p hp
176+
rwa [emultiplicity_pow hp, emultiplicity_pow hp,
177+
ENat.mul_le_mul_left_iff (by exact_mod_cast hn) (ENat.coe_ne_top _)] at this
178+
152179
end UniqueFactorizationMonoid

0 commit comments

Comments
 (0)