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

Commit c7d6a8e

Browse files
feat(ring_theory/unique_factorization_domain): descending chain condition for divisibility (#4031)
Defines the strict divisibility relation `dvd_not_unit` Defines class `wf_dvd_monoid`, indicating that `dvd_not_unit` is well-founded Provides instances of `wf_dvd_monoid` Prepares to refactor `unique_factorization_domain` as a predicate extending `wf_dvd_monoid` Co-authored-by: Aaron Anderson <65780815+awainverse@users.noreply.github.com> Co-authored-by: Vierkantor <vierkantor@vierkantor.com>
1 parent 851e83e commit c7d6a8e

File tree

8 files changed

+230
-92
lines changed

8 files changed

+230
-92
lines changed

src/algebra/associated.lean

Lines changed: 58 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ lemma is_unit_of_dvd_one [comm_monoid α] : ∀a ∣ 1, is_unit (a:α)
3535
| a ⟨b, eq⟩ := ⟨units.mk_of_mul_eq_one a b eq.symm, rfl⟩
3636

3737
lemma dvd_and_not_dvd_iff [comm_cancel_monoid_with_zero α] {x y : α} :
38-
x ∣ y ∧ ¬y ∣ x ↔ x ≠ 0 ∧ ∃ d : α, ¬ is_unit d ∧ y = x * d :=
38+
x ∣ y ∧ ¬y ∣ x ↔ dvd_not_unit x y :=
3939
⟨λ ⟨⟨d, hd⟩, hyx⟩, ⟨λ hx0, by simpa [hx0] using hyx, ⟨d,
4040
mt is_unit_iff_dvd_one.1 (λ ⟨e, he⟩, hyx ⟨e, by rw [hd, mul_assoc, ← he, mul_one]⟩), hd⟩⟩,
4141
λ ⟨hx0, d, hdu, hdx⟩, ⟨⟨d, hdx⟩, λ ⟨e, he⟩, hdu (is_unit_of_dvd_one _
@@ -367,6 +367,9 @@ iff.intro
367367
(assume h a, h _)
368368
(assume h a, quotient.induction_on a h)
369369

370+
theorem mk_surjective [monoid α] : function.surjective (@associates.mk α _) :=
371+
forall_associated.2 (λ a, ⟨a, rfl⟩)
372+
370373
instance [monoid α] : has_one (associates α) := ⟨⟦ 1 ⟧⟩
371374

372375
theorem one_eq_mk_one [monoid α] : (1 : associates α) = associates.mk 1 := rfl
@@ -547,6 +550,55 @@ begin
547550
rw [mk_mul_mk, mk_dvd_mk, mk_dvd_mk, mk_dvd_mk],
548551
end
549552

553+
theorem irreducible_mk (a : α) : irreducible (associates.mk a) ↔ irreducible a :=
554+
begin
555+
simp only [irreducible, is_unit_mk],
556+
apply and_congr iff.rfl,
557+
split,
558+
{ rintro h x y rfl,
559+
simpa [is_unit_mk] using h (associates.mk x) (associates.mk y) rfl },
560+
{ intros h x y,
561+
refine quotient.induction_on₂ x y (assume x y a_eq, _),
562+
rcases quotient.exact a_eq.symm with ⟨u, a_eq⟩,
563+
rw mul_assoc at a_eq,
564+
show is_unit (associates.mk x) ∨ is_unit (associates.mk y),
565+
simpa [is_unit_mk] using h _ _ a_eq.symm }
566+
end
567+
568+
theorem mk_dvd_not_unit_mk_iff {a b : α} :
569+
dvd_not_unit (associates.mk a) (associates.mk b) ↔
570+
dvd_not_unit a b :=
571+
begin
572+
rw [dvd_not_unit, dvd_not_unit, ne, ne, mk_eq_zero],
573+
apply and_congr_right, intro ane0,
574+
split,
575+
{ contrapose!, rw forall_associated,
576+
intros h x hx hbax,
577+
rw [mk_mul_mk, mk_eq_mk_iff_associated] at hbax,
578+
cases hbax with u hu,
579+
apply h (x * ↑u⁻¹),
580+
{ rw is_unit_mk at hx,
581+
rw is_unit_iff_of_associated,
582+
apply hx,
583+
use u,
584+
simp, },
585+
simp [← mul_assoc, ← hu] },
586+
{ rintro ⟨x, ⟨hx, rfl⟩⟩,
587+
use associates.mk x,
588+
simp [is_unit_mk, mk_mul_mk, hx], }
589+
end
590+
591+
theorem dvd_not_unit_of_lt {a b : associates α} (hlt : a < b) :
592+
dvd_not_unit a b :=
593+
begin
594+
split, { rintro rfl, apply not_lt_of_le _ hlt, apply dvd_zero },
595+
rcases hlt with ⟨⟨x, rfl⟩, ndvd⟩,
596+
refine ⟨x, _, rfl⟩,
597+
contrapose! ndvd,
598+
rcases ndvd with ⟨u, rfl⟩,
599+
simp,
600+
end
601+
550602
end comm_monoid_with_zero
551603

552604
section comm_cancel_monoid_with_zero
@@ -579,27 +631,11 @@ theorem prod_eq_zero_iff [nontrivial α] {s : multiset (associates α)} :
579631
multiset.induction_on s (by simp) $
580632
assume a s, by simp [mul_eq_zero, @eq_comm _ 0 a] {contextual := tt}
581633

582-
theorem irreducible_mk_iff (a : α) : irreducible (associates.mk a) ↔ irreducible a :=
583-
begin
584-
simp [irreducible, is_unit_mk],
585-
apply and_congr iff.rfl,
586-
split,
587-
{ assume h x y eq,
588-
have : is_unit (associates.mk x) ∨ is_unit (associates.mk y),
589-
from h _ _ (by rw [eq]; refl),
590-
simpa [is_unit_mk] },
591-
{ refine assume h x y, quotient.induction_on₂ x y (assume x y eq, _),
592-
rcases quotient.exact eq.symm with ⟨u, eq⟩,
593-
have : a = x * (y * u), by rwa [mul_assoc, eq_comm] at eq,
594-
show is_unit (associates.mk x) ∨ is_unit (associates.mk y),
595-
simpa [is_unit_mk] using h _ _ this }
596-
end
597-
598634
theorem irreducible_iff_prime_iff :
599635
(∀ a : α, irreducible a ↔ prime a) ↔ (∀ a : (associates α), irreducible a ↔ prime a) :=
600636
begin
601637
rw forall_associated, split;
602-
intros h a; have ha := h a; rw irreducible_mk_iff at *; rw prime_mk at *; exact ha,
638+
intros h a; have ha := h a; rw irreducible_mk at *; rw prime_mk at *; exact ha,
603639
end
604640

605641
lemma eq_of_mul_eq_mul_left :
@@ -619,10 +655,6 @@ lemma le_of_mul_le_mul_left (a b c : associates α) (ha : a ≠ 0) :
619655
a * b ≤ a * c → b ≤ c
620656
| ⟨d, hd⟩ := ⟨d, eq_of_mul_eq_mul_left a _ _ ha $ by rwa ← mul_assoc⟩
621657

622-
lemma le_of_mul_le_mul_right (a b c : associates α) (hb : b ≠ 0) :
623-
a * b ≤ c * b → a ≤ c :=
624-
(mul_comm b a) ▸ (mul_comm b c) ▸ (le_of_mul_le_mul_left b a c hb)
625-
626658
lemma one_or_eq_of_le_of_prime :
627659
∀(p m : associates α), prime p → m ≤ p → (m = 1 ∨ m = p)
628660
| _ m ⟨hp0, hp1, h⟩ ⟨d, rfl⟩ :=
@@ -644,6 +676,10 @@ instance : comm_cancel_monoid_with_zero (associates α) :=
644676
mul_right_cancel_of_ne_zero := eq_of_mul_eq_mul_right,
645677
.. (infer_instance : comm_monoid_with_zero (associates α)) }
646678

679+
theorem dvd_not_unit_iff_lt {a b : associates α} :
680+
dvd_not_unit a b ↔ a < b :=
681+
dvd_and_not_dvd_iff.symm
682+
647683
end comm_cancel_monoid_with_zero
648684

649685
end associates

src/algebra/divisibility.lean

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,3 +222,23 @@ by { rcases hu with ⟨u, rfl⟩, apply units.mul_left_dvd, }
222222
end comm_monoid
223223

224224
end is_unit
225+
226+
section comm_monoid_with_zero
227+
228+
variable [comm_monoid_with_zero α]
229+
230+
/-- `dvd_not_unit a b` expresses that `a` divides `b` "strictly", i.e. that `b` divided by `a` is not a unit. -/
231+
def dvd_not_unit (a b : α) : Prop := a ≠ 0 ∧ ∃ x, ¬is_unit x ∧ b = a * x
232+
233+
lemma dvd_not_unit_of_dvd_of_not_dvd {a b : α} (hd : a ∣ b) (hnd : ¬ b ∣ a) :
234+
dvd_not_unit a b :=
235+
begin
236+
split,
237+
{ rintro rfl, exact hnd (dvd_zero _) },
238+
{ rcases hd with ⟨c, rfl⟩,
239+
refine ⟨c, _, rfl⟩,
240+
rintro ⟨u, rfl⟩,
241+
simpa using hnd }
242+
end
243+
244+
end comm_monoid_with_zero

src/field_theory/splitting_field.lean

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ lemma exists_root_of_splits {f : polynomial α} (hs : splits i f) (hf0 : degree
130130
∃ x, eval₂ i x f = 0 :=
131131
if hf0 : f = 0 then37, by simp [hf0]⟩
132132
else
133-
let ⟨g, hg⟩ := is_noetherian_ring.exists_irreducible_factor
133+
let ⟨g, hg⟩ := wf_dvd_monoid.exists_irreducible_factor
134134
(show ¬ is_unit (f.map i), from mt is_unit_iff_degree_eq_zero.1 (by rwa degree_map))
135135
(map_ne_zero hf0) in
136136
let ⟨x, hx⟩ := exists_root_of_degree_eq_one (hs.resolve_left hf0 hg.1 hg.2) in
@@ -143,7 +143,7 @@ lemma exists_multiset_of_splits {f : polynomial α} : splits i f →
143143
suffices splits (ring_hom.id _) (f.map i) → ∃ s : multiset β, f.map i =
144144
(C (f.map i).leading_coeff) * (s.map (λ a : β, (X : polynomial β) - C a)).prod,
145145
by rwa [splits_map_iff, leading_coeff_map i] at this,
146-
is_noetherian_ring.irreducible_induction_on (f.map i)
146+
wf_dvd_monoid.induction_on_irreducible (f.map i)
147147
(λ _, ⟨{37}, by simp [i.map_zero]⟩)
148148
(λ u hu _, ⟨0,
149149
by conv_lhs { rw eq_C_of_degree_eq_zero (is_unit_iff_degree_eq_zero.1 hu) };
@@ -328,8 +328,8 @@ end
328328
theorem factor_dvd_of_not_is_unit {f : polynomial α} (hf1 : ¬is_unit f) : factor f ∣ f :=
329329
begin
330330
by_cases hf2 : f = 0, { rw hf2, exact dvd_zero _ },
331-
rw [factor, dif_pos (is_noetherian_ring.exists_irreducible_factor hf1 hf2)],
332-
exact (classical.some_spec $ is_noetherian_ring.exists_irreducible_factor hf1 hf2).2
331+
rw [factor, dif_pos (wf_dvd_monoid.exists_irreducible_factor hf1 hf2)],
332+
exact (classical.some_spec $ wf_dvd_monoid.exists_irreducible_factor hf1 hf2).2
333333
end
334334

335335
theorem factor_dvd_of_degree_ne_zero {f : polynomial α} (hf : f.degree ≠ 0) : factor f ∣ f :=

src/ring_theory/ideal/basic.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ theorem mem_span_pair {x y z : α} :
255255
by simp [mem_span_insert, mem_span_singleton', @eq_comm _ _ z]
256256

257257
lemma span_singleton_lt_span_singleton [integral_domain β] {x y : β} :
258-
span ({x} : set β) < span ({y} : set β) ↔ y ≠ 0 ∧ ∃ d : β, ¬ is_unit d ∧ x = y * d :=
258+
span ({x} : set β) < span ({y} : set β) ↔ dvd_not_unit y x :=
259259
by rw [lt_iff_le_not_le, span_singleton_le_span_singleton, span_singleton_le_span_singleton,
260260
dvd_and_not_dvd_iff]
261261

src/ring_theory/noetherian.lean

Lines changed: 0 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -451,56 +451,6 @@ theorem is_noetherian_ring_of_ring_equiv (R) [comm_ring R] {S} [comm_ring S]
451451
(f : R ≃+* S) [is_noetherian_ring R] : is_noetherian_ring S :=
452452
is_noetherian_ring_of_surjective R S f.to_ring_hom f.to_equiv.surjective
453453

454-
namespace is_noetherian_ring
455-
456-
variables {R : Type*} [integral_domain R] [is_noetherian_ring R]
457-
open associates nat
458-
459-
local attribute [elab_as_eliminator] well_founded.fix
460-
461-
lemma well_founded_dvd_not_unit : well_founded (λ a b : R, a ≠ 0 ∧ ∃ x, ¬is_unit x ∧ b = a * x) :=
462-
by simp only [ideal.span_singleton_lt_span_singleton.symm];
463-
exact inv_image.wf (λ a, ideal.span ({a} : set R)) (well_founded_submodule_gt _ _)
464-
465-
lemma exists_irreducible_factor {a : R} (ha : ¬ is_unit a) (ha0 : a ≠ 0) :
466-
∃ i, irreducible i ∧ i ∣ a :=
467-
(irreducible_or_factor a ha).elim (λ hai, ⟨a, hai, dvd_refl _⟩)
468-
(well_founded.fix
469-
well_founded_dvd_not_unit
470-
(λ a ih ha ha0 ⟨x, y, hx, hy, hxy⟩,
471-
have hx0 : x ≠ 0, from λ hx0, ha0 (by rw [← hxy, hx0, zero_mul]),
472-
(irreducible_or_factor x hx).elim
473-
(λ hxi, ⟨x, hxi, hxy ▸ by simp⟩)
474-
(λ hxf, let ⟨i, hi⟩ := ih x ⟨hx0, y, hy, hxy.symm⟩ hx hx0 hxf in
475-
⟨i, hi.1, dvd.trans hi.2 (hxy ▸ by simp)⟩)) a ha ha0)
476-
477-
@[elab_as_eliminator] lemma irreducible_induction_on {P : R → Prop} (a : R)
478-
(h0 : P 0) (hu : ∀ u : R, is_unit u → P u)
479-
(hi : ∀ a i : R, a ≠ 0 → irreducible i → P a → P (i * a)) :
480-
P a :=
481-
by haveI := classical.dec; exact
482-
well_founded.fix well_founded_dvd_not_unit
483-
(λ a ih, if ha0 : a = 0 then ha0.symm ▸ h0
484-
else if hau : is_unit a then hu a hau
485-
else let ⟨i, hii, ⟨b, hb⟩⟩ := exists_irreducible_factor hau ha0 in
486-
have hb0 : b ≠ 0, from λ hb0, by simp * at *,
487-
hb.symm ▸ hi _ _ hb0 hii (ih _ ⟨hb0, i,
488-
hii.1, by rw [hb, mul_comm]⟩))
489-
a
490-
491-
lemma exists_factors (a : R) : a ≠ 0
492-
∃f : multiset R, (∀b ∈ f, irreducible b) ∧ associated a f.prod :=
493-
is_noetherian_ring.irreducible_induction_on a
494-
(λ h, (h rfl).elim)
495-
(λ u hu _, ⟨0, by simp [associated_one_iff_is_unit, hu]⟩)
496-
(λ a i ha0 hii ih hia0,
497-
let ⟨s, hs⟩ := ih ha0 in
498-
⟨i::s, ⟨by clear _let_match; finish,
499-
by rw multiset.prod_cons;
500-
exact associated_mul_mul (by refl) hs.2⟩⟩)
501-
502-
end is_noetherian_ring
503-
504454
namespace submodule
505455
variables {R : Type*} {A : Type*} [comm_ring R] [ring A] [algebra R A]
506456
variables (M N : submodule R A)

src/ring_theory/polynomial/basic.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ namespace polynomial
413413

414414
theorem exists_irreducible_of_degree_pos {R : Type u} [integral_domain R] [is_noetherian_ring R]
415415
{f : polynomial R} (hf : 0 < f.degree) : ∃ g, irreducible g ∧ g ∣ f :=
416-
is_noetherian_ring.exists_irreducible_factor
416+
wf_dvd_monoid.exists_irreducible_factor
417417
(λ huf, ne_of_gt hf $ degree_eq_zero_of_is_unit huf)
418418
(λ hf0, not_lt_of_lt hf $ hf0.symm ▸ (@degree_zero R _).symm ▸ with_bot.bot_lt_coe _)
419419

src/ring_theory/principal_ideal_domain.lean

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -163,15 +163,13 @@ open_locale classical
163163

164164
/-- `factors a` is a multiset of irreducible elements whose product is `a`, up to units -/
165165
noncomputable def factors (a : R) : multiset R :=
166-
if h : a = 0 thenelse classical.some
167-
(is_noetherian_ring.exists_factors a h)
166+
if h : a = 0 thenelse classical.some (wf_dvd_monoid.exists_factors a h)
168167

169168
lemma factors_spec (a : R) (h : a ≠ 0) :
170169
(∀b∈factors a, irreducible b) ∧ associated a (factors a).prod :=
171170
begin
172171
unfold factors, rw [dif_neg h],
173-
exact classical.some_spec
174-
(is_noetherian_ring.exists_factors a h)
172+
exact classical.some_spec (wf_dvd_monoid.exists_factors a h)
175173
end
176174

177175
lemma ne_zero_of_mem_factors {R : Type v} [integral_domain R] [is_principal_ideal_ring R] {a b : R}

0 commit comments

Comments
 (0)