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

Commit 79de90f

Browse files
alreadydoneShimon SchlessingerShimonschlessinger
committed
feat(algebra/squarefree): x is squarefree iff (x) is radical in gcd_monoid (#17002)
Define the notions of radical ideals and radical elements. Show that (under minimal assumptions): + an element is radical iff the ideal it generates is radical; + an ideal is radical iff the quotient by the ideal is reduced; + a ring is reduced iff 0 is a radical element. These are useful glues for #16998. The main theorem is `is_radical_iff_squarefree_or_zero`. The "if" direction only requires `cancel_comm_monoid_with_zero` as noted by @erdOne, and the "only if" direction depends on Cauchy induction #15880 (used to prove `is_radical_iff_pow_one_lt`). Since UFDs are GCDs, we use the main theorem to golf `unique_factorization_monoid.dvd_pow_iff_dvd_of_squarefree` whose conclusion essentially says that (x) is radical. Some unnecessary `normalization_monoid` and `nontrivial` assumptions are also removed from *squarefree.lean*. An earlier version of the PR only proved the main theorem for UFDs, and `le_dedup_self` and `normalized_factors_prod_eq` are remnants from that previous attempt; they are not used to prove the main theorem but are definitely useful lemmas to have. - [x] depends on: #15880 Co-authored-by: Shimon Schlessinger <shimonschlessinger@Eitans-MacBook-Air.local> Co-authored-by: Shimonschlessinger <Shimonschlessinger@users.noreply.github.com> Co-authored-by: Junyan Xu <junyanxu.math@gmail.com>
1 parent b9cbf57 commit 79de90f

File tree

8 files changed

+176
-78
lines changed

8 files changed

+176
-78
lines changed

src/algebra/squarefree.lean

Lines changed: 41 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -177,18 +177,53 @@ end
177177

178178
end irreducible
179179

180+
section is_radical
181+
182+
variables [cancel_comm_monoid_with_zero R]
183+
184+
theorem is_radical.squarefree {x : R} (h0 : x ≠ 0) (h : is_radical x) : squarefree x :=
185+
begin
186+
rintro z ⟨w, rfl⟩,
187+
specialize h 2 (z * w) ⟨w, by simp_rw [pow_two, mul_left_comm, ← mul_assoc]⟩,
188+
rwa [← one_mul (z * w), mul_assoc, mul_dvd_mul_iff_right, ← is_unit_iff_dvd_one] at h,
189+
rw [mul_assoc, mul_ne_zero_iff] at h0, exact h0.2,
190+
end
191+
192+
variable [gcd_monoid R]
193+
194+
theorem squarefree.is_radical {x : R} (hx : squarefree x) : is_radical x :=
195+
(is_radical_iff_pow_one_lt 2 one_lt_two).2 $ λ y hy, and.right $ (dvd_gcd_iff x x y).1
196+
begin
197+
by_cases gcd x y = 0, { rw h, apply dvd_zero },
198+
replace hy := ((dvd_gcd_iff x x _).2 ⟨dvd_rfl, hy⟩).trans gcd_pow_right_dvd_pow_gcd,
199+
obtain ⟨z, hz⟩ := gcd_dvd_left x y,
200+
nth_rewrite 0 hz at hy ⊢,
201+
rw [pow_two, mul_dvd_mul_iff_left h] at hy,
202+
obtain ⟨w, hw⟩ := hy,
203+
exact (hx z ⟨w, by rwa [mul_right_comm, ←hw]⟩).mul_right_dvd.2 dvd_rfl,
204+
end
205+
206+
theorem is_radical_iff_squarefree_or_zero {x : R} : is_radical x ↔ squarefree x ∨ x = 0 :=
207+
⟨λ hx, (em $ x = 0).elim or.inr (λ h, or.inl $ hx.squarefree h),
208+
or.rec squarefree.is_radical $ by { rintro rfl, rw zero_is_radical_iff, apply_instance }⟩
209+
210+
theorem is_radical_iff_squarefree_of_ne_zero {x : R} (h : x ≠ 0) : is_radical x ↔ squarefree x :=
211+
⟨is_radical.squarefree h, squarefree.is_radical⟩
212+
213+
end is_radical
214+
180215
namespace unique_factorization_monoid
181-
variables [cancel_comm_monoid_with_zero R] [nontrivial R] [unique_factorization_monoid R]
182-
variables [normalization_monoid R]
216+
variables [cancel_comm_monoid_with_zero R] [unique_factorization_monoid R]
183217

184-
lemma squarefree_iff_nodup_normalized_factors [decidable_eq R] {x : R} (x0 : x ≠ 0) :
185-
squarefree x ↔ multiset.nodup (normalized_factors x) :=
218+
lemma squarefree_iff_nodup_normalized_factors [normalization_monoid R] [decidable_eq R] {x : R}
219+
(x0 : x ≠ 0) : squarefree x ↔ multiset.nodup (normalized_factors x) :=
186220
begin
187221
have drel : decidable_rel (has_dvd.dvd : R → R → Prop),
188222
{ classical,
189223
apply_instance, },
190224
haveI := drel,
191225
rw [multiplicity.squarefree_iff_multiplicity_le_one, multiset.nodup_iff_count_le_one],
226+
haveI := nontrivial_of_ne x 0 x0,
192227
split; intros h a,
193228
{ by_cases hmem : a ∈ normalized_factors x,
194229
{ have ha := irreducible_of_normalized_factor _ hmem,
@@ -212,15 +247,8 @@ lemma dvd_pow_iff_dvd_of_squarefree {x y : R} {n : ℕ} (hsq : squarefree x) (h0
212247
x ∣ y ^ n ↔ x ∣ y :=
213248
begin
214249
classical,
215-
by_cases hx : x = 0,
216-
{ simp [hx, pow_eq_zero_iff (nat.pos_of_ne_zero h0)] },
217-
by_cases hy : y = 0,
218-
{ simp [hy, zero_pow (nat.pos_of_ne_zero h0)] },
219-
refine ⟨λ h, _, λ h, h.pow h0⟩,
220-
rw [dvd_iff_normalized_factors_le_normalized_factors hx (pow_ne_zero n hy),
221-
normalized_factors_pow,
222-
((squarefree_iff_nodup_normalized_factors hx).1 hsq).le_nsmul_iff_le h0] at h,
223-
rwa dvd_iff_normalized_factors_le_normalized_factors hx hy,
250+
haveI := unique_factorization_monoid.to_gcd_monoid R,
251+
exact ⟨hsq.is_radical n y, λ h, h.pow h0⟩,
224252
end
225253

226254
end unique_factorization_monoid

src/algebraic_geometry/prime_spectrum/basic.lean

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -359,15 +359,14 @@ lemma is_closed_iff_zero_locus (Z : set (prime_spectrum R)) :
359359
by rw [← is_open_compl_iff, is_open_iff, compl_compl]
360360

361361
lemma is_closed_iff_zero_locus_ideal (Z : set (prime_spectrum R)) :
362-
is_closed Z ↔ ∃ (s : ideal R), Z = zero_locus s :=
362+
is_closed Z ↔ ∃ (I : ideal R), Z = zero_locus I :=
363363
(is_closed_iff_zero_locus _).trans
364-
⟨λ x, ⟨_, x.some_spec.trans (zero_locus_span _).symm⟩, λ x, ⟨_, x.some_spec⟩⟩
364+
⟨λ ⟨s, hs⟩, ⟨_, (zero_locus_span s).substr hs⟩, λ ⟨I, hI⟩, ⟨I, hI⟩⟩
365365

366366
lemma is_closed_iff_zero_locus_radical_ideal (Z : set (prime_spectrum R)) :
367-
is_closed Z ↔ ∃ (s : ideal R), s.radical = s ∧ Z = zero_locus s :=
367+
is_closed Z ↔ ∃ (I : ideal R), I.is_radical ∧ Z = zero_locus I :=
368368
(is_closed_iff_zero_locus_ideal _).trans
369-
⟨λ x, ⟨_, ideal.radical_idem _, x.some_spec.trans (zero_locus_radical _).symm⟩,
370-
λ x, ⟨_, x.some_spec.2⟩⟩
369+
⟨λ ⟨I, hI⟩, ⟨_, I.radical_is_radical, (zero_locus_radical I).substr hI⟩, λ ⟨I, _, hI⟩, ⟨I, hI⟩⟩
371370

372371
lemma is_closed_zero_locus (s : set R) :
373372
is_closed (zero_locus s) :=
@@ -442,7 +441,7 @@ end
442441

443442
local notation `Z(` a `)` := zero_locus (a : set R)
444443

445-
lemma is_irreducible_zero_locus_iff_of_radical (I : ideal R) (hI : I.radical = I) :
444+
lemma is_irreducible_zero_locus_iff_of_radical (I : ideal R) (hI : I.is_radical) :
446445
is_irreducible (zero_locus (I : set R)) ↔ I.is_prime :=
447446
begin
448447
rw [ideal.is_prime_iff, is_irreducible],
@@ -454,22 +453,21 @@ begin
454453
{ rintros h x y, exact h _ _ ⟨x, rfl⟩ ⟨y, rfl⟩ },
455454
{ rintros h _ _ ⟨x, rfl⟩ ⟨y, rfl⟩, exact h x y } },
456455
{ simp_rw [← zero_locus_inf, subset_zero_locus_iff_le_vanishing_ideal,
457-
vanishing_ideal_zero_locus_eq_radical, hI],
456+
vanishing_ideal_zero_locus_eq_radical, hI.radical],
458457
split,
459458
{ intros h x y h',
460459
simp_rw [← set_like.mem_coe, ← set.singleton_subset_iff, ← ideal.span_le],
461460
apply h,
462-
rw [← hI, ← ideal.radical_le_radical_iff, ideal.radical_inf, ← ideal.radical_mul,
463-
ideal.radical_le_radical_iff, hI, ideal.span_mul_span],
464-
simpa [ideal.span_le] using h' },
461+
simpa [← hI.radical_le_iff, ideal.radical_inf, ← ideal.radical_mul,
462+
hI.radical_le_iff, ideal.span_mul_span, ideal.span_le] using h' },
465463
{ simp_rw [or_iff_not_imp_left, set_like.not_le_iff_exists],
466464
rintros h s t h' ⟨x, hx, hx'⟩ y hy,
467465
exact h (h' ⟨ideal.mul_mem_right _ _ hx, ideal.mul_mem_left _ _ hy⟩) hx' } } }
468466
end
469467

470468
lemma is_irreducible_zero_locus_iff (I : ideal R) :
471469
is_irreducible (zero_locus (I : set R)) ↔ I.radical.is_prime :=
472-
(zero_locus_radical I) ▸ is_irreducible_zero_locus_iff_of_radical _ I.radical_idem
470+
(zero_locus_radical I) ▸ is_irreducible_zero_locus_iff_of_radical _ I.radical_is_radical
473471

474472
instance [is_domain R] : irreducible_space (prime_spectrum R) :=
475473
begin
@@ -484,12 +482,12 @@ begin
484482
rw [← h₂.closure_eq, ← zero_locus_vanishing_ideal_eq_closure,
485483
is_irreducible_zero_locus_iff] at h₁,
486484
use ⟨_, h₁⟩,
487-
obtains, hs, rfl⟩ := (is_closed_iff_zero_locus_radical_ideal _).mp h₂,
485+
obtainI, hI, rfl⟩ := (is_closed_iff_zero_locus_radical_ideal _).mp h₂,
488486
rw is_generic_point_iff_forall_closed h₂,
489487
intros Z hZ hxZ,
490488
obtain ⟨t, rfl⟩ := (is_closed_iff_zero_locus_ideal _).mp hZ,
491-
exact zero_locus_anti_mono (by simpa [hs] using hxZ),
492-
simp [hs]
489+
exact zero_locus_anti_mono (by simpa [hI.radical] using hxZ),
490+
simp [hI.radical]
493491
end
494492

495493
section comap

src/data/multiset/dedup.lean

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@ theorem le_dedup {s t : multiset α} : s ≤ dedup t ↔ s ≤ t ∧ nodup s :=
7171
⟨λ h, ⟨le_trans h (dedup_le _), nodup_of_le h (nodup_dedup _)⟩,
7272
λ ⟨l, d⟩, (le_iff_subset d).2 $ subset.trans (subset_of_le l) (subset_dedup _)⟩
7373

74+
theorem le_dedup_self {s : multiset α} : s ≤ dedup s ↔ nodup s :=
75+
by rw [le_dedup, and_iff_right le_rfl]
76+
7477
theorem dedup_ext {s t : multiset α} : dedup s = dedup t ↔ ∀ a, a ∈ s ↔ a ∈ t :=
7578
by simp [nodup.ext]
7679

src/ring_theory/ideal/operations.lean

Lines changed: 39 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -644,9 +644,18 @@ def radical (I : ideal R) : ideal R :=
644644
(pow_add x m (c-m)).symm ▸ I.mul_mem_right _ hxmi)⟩,
645645
smul_mem' := λ r s ⟨n, hsni⟩, ⟨n, (mul_pow r s n).symm ▸ I.mul_mem_left (r^n) hsni⟩ }
646646

647+
/-- An ideal is radical if it contains its radical. -/
648+
def is_radical (I : ideal R) : Prop := I.radical ≤ I
649+
647650
theorem le_radical : I ≤ radical I :=
648651
λ r hri, ⟨1, (pow_one r).symm ▸ hri⟩
649652

653+
/-- An ideal is radical iff it is equal to its radical. -/
654+
theorem radical_eq_iff : I.radical = I ↔ I.is_radical :=
655+
by rw [le_antisymm_iff, and_iff_left le_radical, is_radical]
656+
657+
alias radical_eq_iff ↔ _ is_radical.radical
658+
650659
variables (R)
651660
theorem radical_top : (radical ⊤ : ideal R) = ⊤ :=
652661
(eq_top_iff_one _).20, submodule.mem_top⟩
@@ -656,26 +665,34 @@ theorem radical_mono (H : I ≤ J) : radical I ≤ radical J :=
656665
λ r ⟨n, hrni⟩, ⟨n, H hrni⟩
657666

658667
variables (I)
668+
669+
theorem radical_is_radical : (radical I).is_radical :=
670+
λ r ⟨n, k, hrnki⟩, ⟨n * k, (pow_mul r n k).symm ▸ hrnki⟩
671+
659672
@[simp] theorem radical_idem : radical (radical I) = radical I :=
660-
le_antisymm (λ r ⟨n, k, hrnki⟩, ⟨n * k, (pow_mul r n k).symm ▸ hrnki⟩) le_radical
673+
(radical_is_radical I).radical
674+
661675
variables {I}
662676

677+
theorem is_radical.radical_le_iff (hJ : J.is_radical) : radical I ≤ J ↔ I ≤ J :=
678+
⟨le_trans le_radical, λ h, hJ.radical ▸ radical_mono h⟩
679+
663680
theorem radical_le_radical_iff : radical I ≤ radical J ↔ I ≤ radical J :=
664-
⟨λ h, le_trans le_radical h, λ h, radical_idem J ▸ radical_mono h⟩
681+
(radical_is_radical J).radical_le_iff
665682

666683
theorem radical_eq_top : radical I = ⊤ ↔ I = ⊤ :=
667684
⟨λ h, (eq_top_iff_one _).2 $ let ⟨n, hn⟩ := (eq_top_iff_one _).1 h in
668685
@one_pow R _ n ▸ hn, λ h, h.symm ▸ radical_top R⟩
669686

670-
theorem is_prime.radical (H : is_prime I) : radical I = I :=
671-
le_antisymm (λ r ⟨n, hrni⟩, H.mem_of_pow_mem n hrni) le_radical
687+
theorem is_prime.is_radical (H : is_prime I) : I.is_radical :=
688+
λ r ⟨n, hrni⟩, H.mem_of_pow_mem n hrni
689+
690+
theorem is_prime.radical (H : is_prime I) : radical I = I := H.is_radical.radical
672691

673692
variables (I J)
674693
theorem radical_sup : radical (I ⊔ J) = radical (radical I ⊔ radical J) :=
675694
le_antisymm (radical_mono $ sup_le_sup le_radical le_radical) $
676-
λ r ⟨n, hrnij⟩, let ⟨s, hs, t, ht, hst⟩ := submodule.mem_sup.1 hrnij in
677-
@radical_idem _ _ (I ⊔ J) ▸ ⟨n, hst ▸ ideal.add_mem _
678-
(radical_mono le_sup_left hs) (radical_mono le_sup_right ht)⟩
695+
radical_le_radical_iff.2 $ sup_le (radical_mono le_sup_left) (radical_mono le_sup_right)
679696

680697
theorem radical_inf : radical (I ⊓ J) = radical I ⊓ radical J :=
681698
le_antisymm (le_inf (radical_mono inf_le_left) (radical_mono inf_le_right))
@@ -685,11 +702,11 @@ le_antisymm (le_inf (radical_mono inf_le_left) (radical_mono inf_le_right))
685702
theorem radical_mul : radical (I * J) = radical I ⊓ radical J :=
686703
le_antisymm (radical_inf I J ▸ radical_mono $ @mul_le_inf _ _ I J)
687704
(λ r ⟨⟨m, hrm⟩, ⟨n, hrn⟩⟩, ⟨m + n, (pow_add r m n).symm ▸ mul_mem_mul hrm hrn⟩)
705+
688706
variables {I J}
689707

690-
theorem is_prime.radical_le_iff (hj : is_prime J) :
691-
radical I ≤ J ↔ I ≤ J :=
692-
⟨le_trans le_radical, λ hij r ⟨n, hrni⟩, hj.mem_of_pow_mem n $ hij hrni⟩
708+
theorem is_prime.radical_le_iff (hJ : is_prime J) :
709+
radical I ≤ J ↔ I ≤ J := hJ.is_radical.radical_le_iff
693710

694711
theorem radical_eq_Inf (I : ideal R) :
695712
radical I = Inf { J : ideal R | I ≤ J ∧ is_prime J } :=
@@ -717,9 +734,12 @@ have is_prime m, from ⟨by rintro rfl; rw radical_top at hrm; exact hrm trivial
717734
(m.mul_mem_left _ hxym))⟩⟩,
718735
hrm $ this.radical.symm ▸ (Inf_le ⟨him, this⟩ : Inf {J : ideal R | I ≤ J ∧ is_prime J} ≤ m) hr
719736

720-
@[simp] lemma radical_bot_of_is_domain {R : Type u} [comm_semiring R] [no_zero_divisors R] :
737+
lemma is_radical_bot_of_no_zero_divisors {R} [comm_semiring R] [no_zero_divisors R] :
738+
(⊥ : ideal R).is_radical := λ x hx, hx.rec_on (λ n hn, pow_eq_zero hn)
739+
740+
@[simp] lemma radical_bot_of_no_zero_divisors {R : Type u} [comm_semiring R] [no_zero_divisors R] :
721741
radical (⊥ : ideal R) = ⊥ :=
722-
eq_bot_iff.2 (λ x hx, hx.rec_on (λ n hn, pow_eq_zero hn))
742+
eq_bot_iff.2 is_radical_bot_of_no_zero_divisors
723743

724744
instance : comm_semiring (ideal R) := submodule.comm_semiring
725745

@@ -1401,17 +1421,20 @@ protected theorem map_pow (n : ℕ) : map f (I^n) = (map f I)^n :=
14011421
map_pow (map_hom f) I n
14021422

14031423
theorem comap_radical : comap f (radical K) = radical (comap f K) :=
1404-
le_antisymm (λ r ⟨n, hfrnk⟩, ⟨n, show f (r ^ n) ∈ K,
1405-
from (map_pow f r n).symm ▸ hfrnk⟩)
1406-
(λ r ⟨n, hfrnk⟩, ⟨n, map_pow f r n ▸ hfrnk⟩)
1424+
by { ext, simpa only [radical, mem_comap, map_pow] }
1425+
1426+
variable {K}
1427+
theorem is_radical.comap (hK : K.is_radical) : (comap f K).is_radical :=
1428+
by { rw [←hK.radical, comap_radical], apply radical_is_radical }
1429+
14071430
omit rc
14081431

14091432
@[simp] lemma map_quotient_self :
14101433
map (quotient.mk I) I = ⊥ :=
14111434
eq_bot_iff.2 $ ideal.map_le_iff_le_comap.2 $ λ x hx,
14121435
(submodule.mem_bot (R ⧸ I)).2 $ ideal.quotient.eq_zero_iff_mem.2 hx
14131436

1414-
variables {I J K L}
1437+
variables {I J L}
14151438

14161439
include rc
14171440
theorem map_radical_le : map f (radical I) ≤ radical (map f I) :=

0 commit comments

Comments
 (0)