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

Commit ccc1431

Browse files
kckennylauChrisHughes24Ms2gerjcommelin
committed
feat(ring_theory/ideal_operations): prime avoidance (#773)
```lean /-- Prime avoidance. Atiyah-Macdonald 1.11, Eisenbud 3.3, Stacks 10.14.2 (00DS), Matsumura Ex.1.6. -/ theorem subset_union_prime {s : finset ι} {f : ι → ideal R} (a b : ι) (hp : ∀ i ∈ s, i ≠ a → i ≠ b → is_prime (f i)) {I : ideal R} : (I : set R) ⊆ (⋃ i ∈ (↑s : set ι), f i) ↔ ∃ i ∈ s, I ≤ f i := ``` Co-authored-by: Chris Hughes <33847686+ChrisHughes24@users.noreply.github.com> Co-authored-by: Ms2ger <Ms2ger@gmail.com> Co-authored-by: Johan Commelin <johan@commelin.net>
1 parent 5f15104 commit ccc1431

File tree

1 file changed

+202
-1
lines changed

1 file changed

+202
-1
lines changed

src/ring_theory/ideal/operations.lean

Lines changed: 202 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ noncomputable def quotient_inf_ring_equiv_pi_quotient [fintype ι] (f : ι → i
251251
end chinese_remainder
252252

253253
section mul_and_radical
254-
variables {R : Type u} [comm_ring R]
254+
variables {R : Type u} {ι : Type*} [comm_ring R]
255255
variables {I J K L: ideal R}
256256

257257
instance : has_mul (ideal R) := ⟨(•)⟩
@@ -305,6 +305,15 @@ by { unfold span, rw [submodule.span_mul_span, set.singleton_mul_singleton],}
305305
theorem mul_le_inf : I * J ≤ I ⊓ J :=
306306
mul_le.2 $ λ r hri s hsj, ⟨I.mul_mem_right hri, J.mul_mem_left hsj⟩
307307

308+
theorem prod_le_inf {s : finset ι} {f : ι → ideal R} : s.prod f ≤ s.inf f :=
309+
begin
310+
classical, refine s.induction_on _ _,
311+
{ rw [finset.prod_empty, finset.inf_empty], exact le_top },
312+
intros a s has ih,
313+
rw [finset.prod_insert has, finset.inf_insert],
314+
exact le_trans mul_le_inf (inf_le_inf (le_refl _) ih)
315+
end
316+
308317
theorem mul_eq_inf_of_coprime (h : I ⊔ J = ⊤) : I * J = I ⊓ J :=
309318
le_antisymm mul_le_inf $ λ r ⟨hri, hrj⟩,
310319
let ⟨s, hsi, t, htj, hst⟩ := submodule.mem_sup.1 ((eq_top_iff_one _).1 h) in
@@ -455,6 +464,198 @@ or.cases_on (lt_or_eq_of_le $ nat.le_of_lt_succ H)
455464
... = radical I : inf_idem)
456465
(λ H, H ▸ (pow_one I).symm ▸ rfl)) H
457466

467+
theorem is_prime.mul_le {I J P : ideal R} (hp : is_prime P) :
468+
I * J ≤ P ↔ I ≤ P ∨ J ≤ P :=
469+
⟨λ h, or_iff_not_imp_left.2 $ λ hip j hj, let ⟨i, hi, hip⟩ := set.not_subset.1 hip in
470+
(hp.2 $ h $ mul_mem_mul hi hj).resolve_left hip,
471+
λ h, or.cases_on h (le_trans $ le_trans mul_le_inf inf_le_left)
472+
(le_trans $ le_trans mul_le_inf inf_le_right)⟩
473+
474+
theorem is_prime.inf_le {I J P : ideal R} (hp : is_prime P) :
475+
I ⊓ J ≤ P ↔ I ≤ P ∨ J ≤ P :=
476+
⟨λ h, hp.mul_le.1 $ le_trans mul_le_inf h,
477+
λ h, or.cases_on h (le_trans inf_le_left) (le_trans inf_le_right)⟩
478+
479+
theorem is_prime.prod_le {s : finset ι} {f : ι → ideal R} {P : ideal R}
480+
(hp : is_prime P) (hne: s.nonempty) :
481+
s.prod f ≤ P ↔ ∃ i ∈ s, f i ≤ P :=
482+
suffices s.prod f ≤ P → ∃ i ∈ s, f i ≤ P,
483+
fromthis, λ ⟨i, his, hip⟩, le_trans prod_le_inf $ le_trans (finset.inf_le his) hip⟩,
484+
begin
485+
classical,
486+
obtain ⟨b, hb⟩ : ∃ b, b ∈ s := hne.bex,
487+
obtain ⟨t, hbt, rfl⟩ : ∃ t, b ∉ t ∧ s = insert b t,
488+
from ⟨s.erase b, s.not_mem_erase b, (finset.insert_erase hb).symm⟩,
489+
revert hbt,
490+
refine t.induction_on _ _,
491+
{ simp only [finset.not_mem_empty, insert_emptyc_eq, exists_prop, finset.prod_singleton,
492+
imp_self, exists_eq_left, not_false_iff, finset.mem_singleton] },
493+
intros a s has ih hbs h,
494+
have : a ∉ insert b s,
495+
{ contrapose! has,
496+
apply finset.mem_of_mem_insert_of_ne has,
497+
rintro rfl,
498+
contradiction },
499+
rw [finset.insert.comm, finset.prod_insert this, hp.mul_le] at h,
500+
rw finset.insert.comm,
501+
cases h,
502+
{ exact ⟨a, finset.mem_insert_self a _, h⟩ },
503+
obtain ⟨i, hi, ih⟩ : ∃ i ∈ insert b s, f i ≤ P := ih (mt finset.mem_insert_of_mem hbs) h,
504+
exact ⟨i, finset.mem_insert_of_mem hi, ih⟩
505+
end
506+
507+
theorem is_prime.inf_le' {s : finset ι} {f : ι → ideal R} {P : ideal R} (hp : is_prime P)
508+
(hsne: s.nonempty) :
509+
s.inf f ≤ P ↔ ∃ i ∈ s, f i ≤ P :=
510+
⟨λ h, (hp.prod_le hsne).1 $ le_trans prod_le_inf h,
511+
λ ⟨i, his, hip⟩, le_trans (finset.inf_le his) hip⟩
512+
513+
theorem subset_union {I J K : ideal R} : (I : set R) ⊆ J ∪ K ↔ I ≤ J ∨ I ≤ K :=
514+
⟨λ h, or_iff_not_imp_left.2 $ λ hij s hsi,
515+
let ⟨r, hri, hrj⟩ := set.not_subset.1 hij in classical.by_contradiction $ λ hsk,
516+
or.cases_on (h $ I.add_mem hri hsi)
517+
(λ hj, hrj $ add_sub_cancel r s ▸ J.sub_mem hj ((h hsi).resolve_right hsk))
518+
(λ hk, hsk $ add_sub_cancel' r s ▸ K.sub_mem hk ((h hri).resolve_left hrj)),
519+
λ h, or.cases_on h (λ h, set.subset.trans h $ set.subset_union_left J K)
520+
(λ h, set.subset.trans h $ set.subset_union_right J K)⟩
521+
522+
theorem subset_union_prime' {s : finset ι} {f : ι → ideal R} {a b : ι}
523+
(hp : ∀ i ∈ s, is_prime (f i)) {I : ideal R} :
524+
(I : set R) ⊆ f a ∪ f b ∪ (⋃ i ∈ (↑s : set ι), f i) ↔ I ≤ f a ∨ I ≤ f b ∨ ∃ i ∈ s, I ≤ f i :=
525+
suffices (I : set R) ⊆ f a ∪ f b ∪ (⋃ i ∈ (↑s : set ι), f i) → I ≤ f a ∨ I ≤ f b ∨ ∃ i ∈ s, I ≤ f i,
526+
fromthis, λ h, or.cases_on h (λ h, set.subset.trans h $ set.subset.trans
527+
(set.subset_union_left _ _) (set.subset_union_left _ _)) $
528+
λ h, or.cases_on h (λ h, set.subset.trans h $ set.subset.trans
529+
(set.subset_union_right _ _) (set.subset_union_left _ _)) $
530+
λ ⟨i, his, hi⟩, by refine (set.subset.trans hi $ set.subset.trans _ $
531+
set.subset_union_right _ _);
532+
exact set.subset_bUnion_of_mem (finset.mem_coe.2 his)⟩,
533+
begin
534+
generalize hn : s.card = n, intros h,
535+
unfreezingI { induction n with n ih generalizing a b s },
536+
{ clear hp,
537+
rw finset.card_eq_zero at hn, subst hn,
538+
rw [finset.coe_empty, set.bUnion_empty, set.union_empty, subset_union] at h,
539+
simpa only [exists_prop, finset.not_mem_empty, false_and, exists_false, or_false] },
540+
classical,
541+
replace hn : ∃ (i : ι) (t : finset ι), i ∉ t ∧ insert i t = s ∧ t.card = n := finset.card_eq_succ.1 hn,
542+
unfreezingI { rcases hn with ⟨i, t, hit, rfl, hn⟩ },
543+
replace hp : is_prime (f i) ∧ ∀ x ∈ t, is_prime (f x) := (t.forall_mem_insert _ _).1 hp,
544+
by_cases Ht : ∃ j ∈ t, f j ≤ f i,
545+
{ obtain ⟨j, hjt, hfji⟩ : ∃ j ∈ t, f j ≤ f i := Ht,
546+
obtain ⟨u, hju, rfl⟩ : ∃ u, j ∉ u ∧ insert j u = t,
547+
{ exact ⟨t.erase j, t.not_mem_erase j, finset.insert_erase hjt⟩ },
548+
have hp' : ∀ k ∈ insert i u, is_prime (f k),
549+
{ rw finset.forall_mem_insert at hp ⊢, exact ⟨hp.1, hp.2.2⟩ },
550+
have hiu : i ∉ u := mt finset.mem_insert_of_mem hit,
551+
have hn' : (insert i u).card = n,
552+
{ rwa finset.card_insert_of_not_mem at hn ⊢, exacts [hiu, hju] },
553+
have h' : (I : set R) ⊆ f a ∪ f b ∪ (⋃ k ∈ (↑(insert i u) : set ι), f k),
554+
{ rw finset.coe_insert at h ⊢, rw finset.coe_insert at h,
555+
simp only [set.bUnion_insert] at h ⊢,
556+
rw [← set.union_assoc ↑(f i)] at h,
557+
erw [set.union_eq_self_of_subset_right hfji] at h,
558+
exact h },
559+
specialize @ih a b (insert i u) hp' hn' h',
560+
refine ih.imp id (or.imp id (exists_imp_exists $ λ k, _)), simp only [exists_prop],
561+
exact and.imp (λ hk, finset.insert_subset_insert i (finset.subset_insert j u) hk) id },
562+
by_cases Ha : f a ≤ f i,
563+
{ have h' : (I : set R) ⊆ f i ∪ f b ∪ (⋃ j ∈ (↑t : set ι), f j),
564+
{ rw [finset.coe_insert, set.bUnion_insert, ← set.union_assoc, set.union_right_comm ↑(f a)] at h,
565+
erw [set.union_eq_self_of_subset_left Ha] at h,
566+
exact h },
567+
specialize @ih i b t hp.2 hn h', right,
568+
rcases ih with ih | ih | ⟨k, hkt, ih⟩,
569+
{ exact or.inr ⟨i, finset.mem_insert_self i t, ih⟩ },
570+
{ exact or.inl ih },
571+
{ exact or.inr ⟨k, finset.mem_insert_of_mem hkt, ih⟩ } },
572+
by_cases Hb : f b ≤ f i,
573+
{ have h' : (I : set R) ⊆ f a ∪ f i ∪ (⋃ j ∈ (↑t : set ι), f j),
574+
{ rw [finset.coe_insert, set.bUnion_insert, ← set.union_assoc, set.union_assoc ↑(f a)] at h,
575+
erw [set.union_eq_self_of_subset_left Hb] at h,
576+
exact h },
577+
specialize @ih a i t hp.2 hn h',
578+
rcases ih with ih | ih | ⟨k, hkt, ih⟩,
579+
{ exact or.inl ih },
580+
{ exact or.inr (or.inr ⟨i, finset.mem_insert_self i t, ih⟩) },
581+
{ exact or.inr (or.inr ⟨k, finset.mem_insert_of_mem hkt, ih⟩) } },
582+
by_cases Hi : I ≤ f i,
583+
{ exact or.inr (or.inr ⟨i, finset.mem_insert_self i t, Hi⟩) },
584+
have : ¬I ⊓ f a ⊓ f b ⊓ t.inf f ≤ f i,
585+
{ rcases t.eq_empty_or_nonempty with (rfl | hsne),
586+
{ rw [finset.inf_empty, inf_top_eq, hp.1.inf_le, hp.1.inf_le, not_or_distrib, not_or_distrib],
587+
exact ⟨⟨Hi, Ha⟩, Hb⟩ },
588+
simp only [hp.1.inf_le, hp.1.inf_le' hsne, not_or_distrib],
589+
exact ⟨⟨⟨Hi, Ha⟩, Hb⟩, Ht⟩ },
590+
rcases set.not_subset.1 this with ⟨r, ⟨⟨⟨hrI, hra⟩, hrb⟩, hr⟩, hri⟩,
591+
by_cases HI : (I : set R) ⊆ f a ∪ f b ∪ ⋃ j ∈ (↑t : set ι), f j,
592+
{ specialize ih hp.2 hn HI, rcases ih with ih | ih | ⟨k, hkt, ih⟩,
593+
{ left, exact ih }, { right, left, exact ih },
594+
{ right, right, exact ⟨k, finset.mem_insert_of_mem hkt, ih⟩ } },
595+
exfalso, rcases set.not_subset.1 HI with ⟨s, hsI, hs⟩,
596+
rw [finset.coe_insert, set.bUnion_insert] at h,
597+
have hsi : s ∈ f i := ((h hsI).resolve_left (mt or.inl hs)).resolve_right (mt or.inr hs),
598+
rcases h (I.add_mem hrI hsI) with ⟨ha | hb⟩ | hi | ht,
599+
{ exact hs (or.inl $ or.inl $ add_sub_cancel' r s ▸ (f a).sub_mem ha hra) },
600+
{ exact hs (or.inl $ or.inr $ add_sub_cancel' r s ▸ (f b).sub_mem hb hrb) },
601+
{ exact hri (add_sub_cancel r s ▸ (f i).sub_mem hi hsi) },
602+
{ rw set.mem_bUnion_iff at ht, rcases ht with ⟨j, hjt, hj⟩,
603+
simp only [finset.inf_eq_infi, submodule.mem_coe, submodule.mem_infi] at hr,
604+
exact hs (or.inr $ set.mem_bUnion hjt $ add_sub_cancel' r s ▸ (f j).sub_mem hj $ hr j hjt) }
605+
end
606+
607+
/-- Prime avoidance. Atiyah-Macdonald 1.11, Eisenbud 3.3, Stacks 00DS, Matsumura Ex.1.6. -/
608+
theorem subset_union_prime {s : finset ι} {f : ι → ideal R} (a b : ι)
609+
(hp : ∀ i ∈ s, i ≠ a → i ≠ b → is_prime (f i)) {I : ideal R} :
610+
(I : set R) ⊆ (⋃ i ∈ (↑s : set ι), f i) ↔ ∃ i ∈ s, I ≤ f i :=
611+
suffices (I : set R) ⊆ (⋃ i ∈ (↑s : set ι), f i) → ∃ i, i ∈ s ∧ I ≤ f i,
612+
from ⟨λ h, bex_def.2 $ this h, λ ⟨i, his, hi⟩, set.subset.trans hi $ set.subset_bUnion_of_mem $
613+
show i ∈ (↑s : set ι), from his⟩,
614+
assume h : (I : set R) ⊆ (⋃ i ∈ (↑s : set ι), f i),
615+
begin
616+
classical, tactic.unfreeze_local_instances,
617+
by_cases has : a ∈ s,
618+
{ obtain ⟨t, hat, rfl⟩ : ∃ t, a ∉ t ∧ insert a t = s :=
619+
⟨s.erase a, finset.not_mem_erase a s, finset.insert_erase has⟩,
620+
by_cases hbt : b ∈ t,
621+
{ obtain ⟨u, hbu, rfl⟩ : ∃ u, b ∉ u ∧ insert b u = t :=
622+
⟨t.erase b, finset.not_mem_erase b t, finset.insert_erase hbt⟩,
623+
have hp' : ∀ i ∈ u, is_prime (f i),
624+
{ intros i hiu, refine hp i (finset.mem_insert_of_mem (finset.mem_insert_of_mem hiu)) _ _;
625+
rintro rfl; solve_by_elim only [finset.mem_insert_of_mem, *], },
626+
rw [finset.coe_insert, finset.coe_insert, set.bUnion_insert, set.bUnion_insert,
627+
← set.union_assoc, subset_union_prime' hp', bex_def] at h,
628+
rwa [finset.exists_mem_insert, finset.exists_mem_insert] },
629+
{ have hp' : ∀ j ∈ t, is_prime (f j),
630+
{ intros j hj, refine hp j (finset.mem_insert_of_mem hj) _ _;
631+
rintro rfl; solve_by_elim only [finset.mem_insert_of_mem, *], },
632+
rw [finset.coe_insert, set.bUnion_insert, ← set.union_self (f a : set R),
633+
subset_union_prime' hp', ← or_assoc, or_self, bex_def] at h,
634+
rwa finset.exists_mem_insert } },
635+
{ by_cases hbs : b ∈ s,
636+
{ obtain ⟨t, hbt, rfl⟩ : ∃ t, b ∉ t ∧ insert b t = s :=
637+
⟨s.erase b, finset.not_mem_erase b s, finset.insert_erase hbs⟩,
638+
have hp' : ∀ j ∈ t, is_prime (f j),
639+
{ intros j hj, refine hp j (finset.mem_insert_of_mem hj) _ _;
640+
rintro rfl; solve_by_elim only [finset.mem_insert_of_mem, *], },
641+
rw [finset.coe_insert, set.bUnion_insert, ← set.union_self (f b : set R),
642+
subset_union_prime' hp', ← or_assoc, or_self, bex_def] at h,
643+
rwa finset.exists_mem_insert },
644+
cases s.eq_empty_or_nonempty with hse hsne,
645+
{ subst hse, rw [finset.coe_empty, set.bUnion_empty, set.subset_empty_iff] at h,
646+
have : (I : set R) ≠ ∅ := set.nonempty.ne_empty (set.nonempty_of_mem I.zero_mem),
647+
exact absurd h this },
648+
{ cases hsne.bex with i his,
649+
obtain ⟨t, hit, rfl⟩ : ∃ t, i ∉ t ∧ insert i t = s :=
650+
⟨s.erase i, finset.not_mem_erase i s, finset.insert_erase his⟩,
651+
have hp' : ∀ j ∈ t, is_prime (f j),
652+
{ intros j hj, refine hp j (finset.mem_insert_of_mem hj) _ _;
653+
rintro rfl; solve_by_elim only [finset.mem_insert_of_mem, *], },
654+
rw [finset.coe_insert, set.bUnion_insert, ← set.union_self (f i : set R),
655+
subset_union_prime' hp', ← or_assoc, or_self, bex_def] at h,
656+
rwa finset.exists_mem_insert } }
657+
end
658+
458659
end mul_and_radical
459660

460661
section map_and_comap

0 commit comments

Comments
 (0)