-
Notifications
You must be signed in to change notification settings - Fork 298
/
operations.lean
2349 lines (1885 loc) · 95.2 KB
/
operations.lean
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/-
Copyright (c) 2018 Kenny Lau. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kenny Lau
-/
import algebra.algebra.operations
import algebra.ring.equiv
import data.nat.choose.sum
import ring_theory.coprime.lemmas
import ring_theory.ideal.quotient
import ring_theory.non_zero_divisors
/-!
# More operations on modules and ideals
-/
universes u v w x
open_locale big_operators pointwise
namespace submodule
variables {R : Type u} {M : Type v} {F : Type*} {G : Type*}
section comm_semiring
variables [comm_semiring R] [add_comm_monoid M] [module R M]
open_locale pointwise
instance has_smul' : has_smul (ideal R) (submodule R M) :=
⟨submodule.map₂ (linear_map.lsmul R M)⟩
/-- This duplicates the global `smul_eq_mul`, but doesn't have to unfold anywhere near as much to
apply. -/
protected lemma _root_.ideal.smul_eq_mul (I J : ideal R) : I • J = I * J := rfl
/-- `N.annihilator` is the ideal of all elements `r : R` such that `r • N = 0`. -/
def annihilator (N : submodule R M) : ideal R :=
(linear_map.lsmul R N).ker
variables {I J : ideal R} {N P : submodule R M}
theorem mem_annihilator {r} : r ∈ N.annihilator ↔ ∀ n ∈ N, r • n = (0:M) :=
⟨λ hr n hn, congr_arg subtype.val (linear_map.ext_iff.1 (linear_map.mem_ker.1 hr) ⟨n, hn⟩),
λ h, linear_map.mem_ker.2 $ linear_map.ext $ λ n, subtype.eq $ h n.1 n.2⟩
theorem mem_annihilator' {r} : r ∈ N.annihilator ↔ N ≤ comap (r • (linear_map.id : M →ₗ[R] M)) ⊥ :=
mem_annihilator.trans ⟨λ H n hn, (mem_bot R).2 $ H n hn, λ H n hn, (mem_bot R).1 $ H hn⟩
lemma mem_annihilator_span (s : set M) (r : R) :
r ∈ (submodule.span R s).annihilator ↔ ∀ n : s, r • (n : M) = 0 :=
begin
rw submodule.mem_annihilator,
split,
{ intros h n, exact h _ (submodule.subset_span n.prop) },
{ intros h n hn,
apply submodule.span_induction hn,
{ intros x hx, exact h ⟨x, hx⟩ },
{ exact smul_zero _ },
{ intros x y hx hy, rw [smul_add, hx, hy, zero_add] },
{ intros a x hx, rw [smul_comm, hx, smul_zero] } }
end
lemma mem_annihilator_span_singleton (g : M) (r : R) :
r ∈ (submodule.span R ({g} : set M)).annihilator ↔ r • g = 0 :=
by simp [mem_annihilator_span]
theorem annihilator_bot : (⊥ : submodule R M).annihilator = ⊤ :=
(ideal.eq_top_iff_one _).2 $ mem_annihilator'.2 bot_le
theorem annihilator_eq_top_iff : N.annihilator = ⊤ ↔ N = ⊥ :=
⟨λ H, eq_bot_iff.2 $ λ (n:M) hn, (mem_bot R).2 $
one_smul R n ▸ mem_annihilator.1 ((ideal.eq_top_iff_one _).1 H) n hn,
λ H, H.symm ▸ annihilator_bot⟩
theorem annihilator_mono (h : N ≤ P) : P.annihilator ≤ N.annihilator :=
λ r hrp, mem_annihilator.2 $ λ n hn, mem_annihilator.1 hrp n $ h hn
theorem annihilator_supr (ι : Sort w) (f : ι → submodule R M) :
(annihilator ⨆ i, f i) = ⨅ i, annihilator (f i) :=
le_antisymm (le_infi $ λ i, annihilator_mono $ le_supr _ _)
(λ r H, mem_annihilator'.2 $ supr_le $ λ i,
have _ := (mem_infi _).1 H i, mem_annihilator'.1 this)
theorem smul_mem_smul {r} {n} (hr : r ∈ I) (hn : n ∈ N) : r • n ∈ I • N := apply_mem_map₂ _ hr hn
theorem smul_le {P : submodule R M} : I • N ≤ P ↔ ∀ (r ∈ I) (n ∈ N), r • n ∈ P := map₂_le
@[elab_as_eliminator]
theorem smul_induction_on {p : M → Prop} {x} (H : x ∈ I • N)
(Hb : ∀ (r ∈ I) (n ∈ N), p (r • n))
(H1 : ∀ x y, p x → p y → p (x + y)) : p x :=
begin
have H0 : p 0 := by simpa only [zero_smul] using Hb 0 I.zero_mem 0 N.zero_mem,
refine submodule.supr_induction _ H _ H0 H1,
rintros ⟨i, hi⟩ m ⟨j, hj, (rfl : i • _ = m) ⟩,
exact Hb _ hi _ hj,
end
/-- Dependent version of `submodule.smul_induction_on`. -/
@[elab_as_eliminator]
theorem smul_induction_on' {x : M} (hx : x ∈ I • N)
{p : Π x, x ∈ I • N → Prop}
(Hb : ∀ (r : R) (hr : r ∈ I) (n : M) (hn : n ∈ N),
p (r • n) (smul_mem_smul hr hn))
(H1 : ∀ x hx y hy, p x hx → p y hy → p (x + y) (submodule.add_mem _ ‹_› ‹_›)) :
p x hx :=
begin
refine exists.elim _ (λ (h : x ∈ I • N) (H : p x h), H),
exact smul_induction_on hx
(λ a ha x hx, ⟨_, Hb _ ha _ hx⟩)
(λ x y ⟨_, hx⟩ ⟨_, hy⟩, ⟨_, H1 _ _ _ _ hx hy⟩),
end
theorem mem_smul_span_singleton {I : ideal R} {m : M} {x : M} :
x ∈ I • span R ({m} : set M) ↔ ∃ y ∈ I, y • m = x :=
⟨λ hx, smul_induction_on hx
(λ r hri n hnm,
let ⟨s, hs⟩ := mem_span_singleton.1 hnm in ⟨r * s, I.mul_mem_right _ hri, hs ▸ mul_smul r s m⟩)
(λ m1 m2 ⟨y1, hyi1, hy1⟩ ⟨y2, hyi2, hy2⟩,
⟨y1 + y2, I.add_mem hyi1 hyi2, by rw [add_smul, hy1, hy2]⟩),
λ ⟨y, hyi, hy⟩, hy ▸ smul_mem_smul hyi (subset_span $ set.mem_singleton m)⟩
theorem smul_le_right : I • N ≤ N :=
smul_le.2 $ λ r hr n, N.smul_mem r
theorem smul_mono (hij : I ≤ J) (hnp : N ≤ P) : I • N ≤ J • P := map₂_le_map₂ hij hnp
theorem smul_mono_left (h : I ≤ J) : I • N ≤ J • N := map₂_le_map₂_left h
theorem smul_mono_right (h : N ≤ P) : I • N ≤ I • P := map₂_le_map₂_right h
lemma map_le_smul_top (I : ideal R) (f : R →ₗ[R] M) :
submodule.map f I ≤ I • (⊤ : submodule R M) :=
begin
rintros _ ⟨y, hy, rfl⟩,
rw [← mul_one y, ← smul_eq_mul, f.map_smul],
exact smul_mem_smul hy mem_top
end
@[simp] theorem annihilator_smul (N : submodule R M) : annihilator N • N = ⊥ :=
eq_bot_iff.2 (smul_le.2 (λ r, mem_annihilator.1))
@[simp] theorem annihilator_mul (I : ideal R) : annihilator I * I = ⊥ :=
annihilator_smul I
@[simp] theorem mul_annihilator (I : ideal R) : I * annihilator I = ⊥ :=
by rw [mul_comm, annihilator_mul]
variables (I J N P)
@[simp] theorem smul_bot : I • (⊥ : submodule R M) = ⊥ := map₂_bot_right _ _
@[simp] theorem bot_smul : (⊥ : ideal R) • N = ⊥ := map₂_bot_left _ _
@[simp] theorem top_smul : (⊤ : ideal R) • N = N :=
le_antisymm smul_le_right $ λ r hri, one_smul R r ▸ smul_mem_smul mem_top hri
theorem smul_sup : I • (N ⊔ P) = I • N ⊔ I • P := map₂_sup_right _ _ _ _
theorem sup_smul : (I ⊔ J) • N = I • N ⊔ J • N := map₂_sup_left _ _ _ _
protected theorem smul_assoc : (I • J) • N = I • (J • N) :=
le_antisymm (smul_le.2 $ λ rs hrsij t htn,
smul_induction_on hrsij
(λ r hr s hs,
(@smul_eq_mul R _ r s).symm ▸ smul_smul r s t ▸ smul_mem_smul hr (smul_mem_smul hs htn))
(λ x y, (add_smul x y t).symm ▸ submodule.add_mem _))
(smul_le.2 $ λ r hr sn hsn,
suffices J • N ≤ submodule.comap (r • (linear_map.id : M →ₗ[R] M)) ((I • J) • N),
from this hsn,
smul_le.2 $ λ s hs n hn, show r • (s • n) ∈ (I • J) • N,
from mul_smul r s n ▸ smul_mem_smul (smul_mem_smul hr hs) hn)
lemma smul_inf_le (M₁ M₂ : submodule R M) : I • (M₁ ⊓ M₂) ≤ I • M₁ ⊓ I • M₂ :=
le_inf (submodule.smul_mono_right inf_le_left) (submodule.smul_mono_right inf_le_right)
lemma smul_supr {ι : Sort*} {I : ideal R} {t : ι → submodule R M} :
I • supr t = ⨆ i, I • t i :=
map₂_supr_right _ _ _
lemma smul_infi_le {ι : Sort*} {I : ideal R} {t : ι → submodule R M} :
I • infi t ≤ ⨅ i, I • t i :=
le_infi (λ i, smul_mono_right (infi_le _ _))
variables (S : set R) (T : set M)
theorem span_smul_span : (ideal.span S) • (span R T) =
span R (⋃ (s ∈ S) (t ∈ T), {s • t}) :=
(map₂_span_span _ _ _ _).trans $ congr_arg _ $ set.image2_eq_Union _ _ _
lemma ideal_span_singleton_smul (r : R) (N : submodule R M) :
(ideal.span {r} : ideal R) • N = r • N :=
begin
have : span R (⋃ (t : M) (x : t ∈ N), {r • t}) = r • N,
{ convert span_eq _, exact (set.image_eq_Union _ (N : set M)).symm },
conv_lhs { rw [← span_eq N, span_smul_span] },
simpa
end
lemma span_smul_eq (r : R) (s : set M) : span R (r • s) = r • span R s :=
by rw [← ideal_span_singleton_smul, span_smul_span, ←set.image2_eq_Union,
set.image2_singleton_left, set.image_smul]
lemma mem_of_span_top_of_smul_mem (M' : submodule R M)
(s : set R) (hs : ideal.span s = ⊤) (x : M) (H : ∀ r : s, (r : R) • x ∈ M') : x ∈ M' :=
begin
suffices : (⊤ : ideal R) • (span R ({x} : set M)) ≤ M',
{ rw top_smul at this, exact this (subset_span (set.mem_singleton x)) },
rw [← hs, span_smul_span, span_le],
simpa using H
end
/-- Given `s`, a generating set of `R`, to check that an `x : M` falls in a
submodule `M'` of `x`, we only need to show that `r ^ n • x ∈ M'` for some `n` for each `r : s`. -/
lemma mem_of_span_eq_top_of_smul_pow_mem (M' : submodule R M)
(s : set R) (hs : ideal.span s = ⊤) (x : M)
(H : ∀ r : s, ∃ (n : ℕ), (r ^ n : R) • x ∈ M') : x ∈ M' :=
begin
obtain ⟨s', hs₁, hs₂⟩ := (ideal.span_eq_top_iff_finite _).mp hs,
replace H : ∀ r : s', ∃ (n : ℕ), (r ^ n : R) • x ∈ M' := λ r, H ⟨_, hs₁ r.prop⟩,
choose n₁ n₂ using H,
let N := s'.attach.sup n₁,
have hs' := ideal.span_pow_eq_top (s' : set R) hs₂ N,
apply M'.mem_of_span_top_of_smul_mem _ hs',
rintro ⟨_, r, hr, rfl⟩,
convert M'.smul_mem (r ^ (N - n₁ ⟨r, hr⟩)) (n₂ ⟨r, hr⟩) using 1,
simp only [subtype.coe_mk, smul_smul, ← pow_add],
rw tsub_add_cancel_of_le (finset.le_sup (s'.mem_attach _) : n₁ ⟨r, hr⟩ ≤ N),
end
variables {M' : Type w} [add_comm_monoid M'] [module R M']
theorem map_smul'' (f : M →ₗ[R] M') : (I • N).map f = I • N.map f :=
le_antisymm (map_le_iff_le_comap.2 $ smul_le.2 $ λ r hr n hn, show f (r • n) ∈ I • N.map f,
from (f.map_smul r n).symm ▸ smul_mem_smul hr (mem_map_of_mem hn)) $
smul_le.2 $ λ r hr n hn, let ⟨p, hp, hfp⟩ := mem_map.1 hn in
hfp ▸ f.map_smul r p ▸ mem_map_of_mem (smul_mem_smul hr hp)
variables {I}
lemma mem_smul_span {s : set M} {x : M} :
x ∈ I • submodule.span R s ↔ x ∈ submodule.span R (⋃ (a ∈ I) (b ∈ s), ({a • b} : set M)) :=
by rw [← I.span_eq, submodule.span_smul_span, I.span_eq]; refl
variables (I)
/-- If `x` is an `I`-multiple of the submodule spanned by `f '' s`,
then we can write `x` as an `I`-linear combination of the elements of `f '' s`. -/
lemma mem_ideal_smul_span_iff_exists_sum {ι : Type*} (f : ι → M) (x : M) :
x ∈ I • span R (set.range f) ↔
∃ (a : ι →₀ R) (ha : ∀ i, a i ∈ I), a.sum (λ i c, c • f i) = x :=
begin
split, swap,
{ rintro ⟨a, ha, rfl⟩,
exact submodule.sum_mem _ (λ c _, smul_mem_smul (ha c) $ subset_span $ set.mem_range_self _) },
refine λ hx, span_induction (mem_smul_span.mp hx) _ _ _ _,
{ simp only [set.mem_Union, set.mem_range, set.mem_singleton_iff],
rintros x ⟨y, hy, x, ⟨i, rfl⟩, rfl⟩,
refine ⟨finsupp.single i y, λ j, _, _⟩,
{ letI := classical.dec_eq ι,
rw finsupp.single_apply, split_ifs, { assumption }, { exact I.zero_mem } },
refine @finsupp.sum_single_index ι R M _ _ i _ (λ i y, y • f i) _,
simp },
{ exact ⟨0, λ i, I.zero_mem, finsupp.sum_zero_index⟩ },
{ rintros x y ⟨ax, hax, rfl⟩ ⟨ay, hay, rfl⟩,
refine ⟨ax + ay, λ i, I.add_mem (hax i) (hay i), finsupp.sum_add_index _ _⟩;
intros; simp only [zero_smul, add_smul] },
{ rintros c x ⟨a, ha, rfl⟩,
refine ⟨c • a, λ i, I.mul_mem_left c (ha i), _⟩,
rw [finsupp.sum_smul_index, finsupp.smul_sum];
intros; simp only [zero_smul, mul_smul] },
end
theorem mem_ideal_smul_span_iff_exists_sum' {ι : Type*} (s : set ι) (f : ι → M) (x : M) :
x ∈ I • span R (f '' s) ↔
∃ (a : s →₀ R) (ha : ∀ i, a i ∈ I), a.sum (λ i c, c • f i) = x :=
by rw [← submodule.mem_ideal_smul_span_iff_exists_sum, ← set.image_eq_range]
lemma mem_smul_top_iff (N : submodule R M) (x : N) :
x ∈ I • (⊤ : submodule R N) ↔ (x : M) ∈ I • N :=
begin
change _ ↔ N.subtype x ∈ I • N,
have : submodule.map N.subtype (I • ⊤) = I • N,
{ rw [submodule.map_smul'', submodule.map_top, submodule.range_subtype] },
rw ← this,
convert (function.injective.mem_set_image N.injective_subtype).symm using 1,
refl,
end
@[simp] lemma smul_comap_le_comap_smul (f : M →ₗ[R] M') (S : submodule R M') (I : ideal R) :
I • S.comap f ≤ (I • S).comap f :=
begin
refine (submodule.smul_le.mpr (λ r hr x hx, _)),
rw [submodule.mem_comap] at ⊢ hx,
rw f.map_smul,
exact submodule.smul_mem_smul hr hx
end
end comm_semiring
section comm_ring
variables [comm_ring R] [add_comm_group M] [module R M]
variables {N N₁ N₂ P P₁ P₂ : submodule R M}
/-- `N.colon P` is the ideal of all elements `r : R` such that `r • P ⊆ N`. -/
def colon (N P : submodule R M) : ideal R :=
annihilator (P.map N.mkq)
theorem mem_colon {r} : r ∈ N.colon P ↔ ∀ p ∈ P, r • p ∈ N :=
mem_annihilator.trans ⟨λ H p hp, (quotient.mk_eq_zero N).1 (H (quotient.mk p) (mem_map_of_mem hp)),
λ H m ⟨p, hp, hpm⟩, hpm ▸ (N.mkq).map_smul r p ▸ (quotient.mk_eq_zero N).2 $ H p hp⟩
theorem mem_colon' {r} : r ∈ N.colon P ↔ P ≤ comap (r • (linear_map.id : M →ₗ[R] M)) N :=
mem_colon
theorem colon_mono (hn : N₁ ≤ N₂) (hp : P₁ ≤ P₂) : N₁.colon P₂ ≤ N₂.colon P₁ :=
λ r hrnp, mem_colon.2 $ λ p₁ hp₁, hn $ mem_colon.1 hrnp p₁ $ hp hp₁
theorem infi_colon_supr (ι₁ : Sort w) (f : ι₁ → submodule R M)
(ι₂ : Sort x) (g : ι₂ → submodule R M) :
(⨅ i, f i).colon (⨆ j, g j) = ⨅ i j, (f i).colon (g j) :=
le_antisymm (le_infi $ λ i, le_infi $ λ j, colon_mono (infi_le _ _) (le_supr _ _))
(λ r H, mem_colon'.2 $ supr_le $ λ j, map_le_iff_le_comap.1 $ le_infi $ λ i,
map_le_iff_le_comap.2 $ mem_colon'.1 $ have _ := ((mem_infi _).1 H i),
have _ := ((mem_infi _).1 this j), this)
end comm_ring
end submodule
namespace ideal
section add
variables {R : Type u} [semiring R]
@[simp] lemma add_eq_sup {I J : ideal R} : I + J = I ⊔ J := rfl
@[simp] lemma zero_eq_bot : (0 : ideal R) = ⊥ := rfl
@[simp] lemma sum_eq_sup {ι : Type*} (s : finset ι) (f : ι → ideal R) : s.sum f = s.sup f := rfl
end add
section mul_and_radical
variables {R : Type u} {ι : Type*} [comm_semiring R]
variables {I J K L : ideal R}
instance : has_mul (ideal R) := ⟨(•)⟩
@[simp] lemma one_eq_top : (1 : ideal R) = ⊤ :=
by erw [submodule.one_eq_range, linear_map.range_id]
theorem mul_mem_mul {r s} (hr : r ∈ I) (hs : s ∈ J) : r * s ∈ I * J :=
submodule.smul_mem_smul hr hs
theorem mul_mem_mul_rev {r s} (hr : r ∈ I) (hs : s ∈ J) : s * r ∈ I * J :=
mul_comm r s ▸ mul_mem_mul hr hs
lemma pow_mem_pow {x : R} (hx : x ∈ I) (n : ℕ) : x ^ n ∈ I ^ n :=
submodule.pow_mem_pow _ hx _
lemma prod_mem_prod {ι : Type*} {s : finset ι} {I : ι → ideal R} {x : ι → R} :
(∀ i ∈ s, x i ∈ I i) → ∏ i in s, x i ∈ ∏ i in s, I i :=
begin
classical,
apply finset.induction_on s,
{ intro _, rw [finset.prod_empty, finset.prod_empty, one_eq_top], exact submodule.mem_top },
{ intros a s ha IH h,
rw [finset.prod_insert ha, finset.prod_insert ha],
exact mul_mem_mul (h a $ finset.mem_insert_self a s)
(IH $ λ i hi, h i $ finset.mem_insert_of_mem hi) }
end
theorem mul_le : I * J ≤ K ↔ ∀ (r ∈ I) (s ∈ J), r * s ∈ K :=
submodule.smul_le
lemma mul_le_left : I * J ≤ J :=
ideal.mul_le.2 (λ r hr s, J.mul_mem_left _)
lemma mul_le_right : I * J ≤ I :=
ideal.mul_le.2 (λ r hr s hs, I.mul_mem_right _ hr)
@[simp] lemma sup_mul_right_self : I ⊔ (I * J) = I :=
sup_eq_left.2 ideal.mul_le_right
@[simp] lemma sup_mul_left_self : I ⊔ (J * I) = I :=
sup_eq_left.2 ideal.mul_le_left
@[simp] lemma mul_right_self_sup : (I * J) ⊔ I = I :=
sup_eq_right.2 ideal.mul_le_right
@[simp] lemma mul_left_self_sup : (J * I) ⊔ I = I :=
sup_eq_right.2 ideal.mul_le_left
variables (I J K)
protected theorem mul_comm : I * J = J * I :=
le_antisymm (mul_le.2 $ λ r hrI s hsJ, mul_mem_mul_rev hsJ hrI)
(mul_le.2 $ λ r hrJ s hsI, mul_mem_mul_rev hsI hrJ)
protected theorem mul_assoc : (I * J) * K = I * (J * K) :=
submodule.smul_assoc I J K
theorem span_mul_span (S T : set R) : span S * span T =
span ⋃ (s ∈ S) (t ∈ T), {s * t} :=
submodule.span_smul_span S T
variables {I J K}
lemma span_mul_span' (S T : set R) : span S * span T = span (S*T) :=
by { unfold span, rw submodule.span_mul_span, }
lemma span_singleton_mul_span_singleton (r s : R) :
span {r} * span {s} = (span {r * s} : ideal R) :=
by { unfold span, rw [submodule.span_mul_span, set.singleton_mul_singleton], }
lemma span_singleton_pow (s : R) (n : ℕ):
span {s} ^ n = (span {s ^ n} : ideal R) :=
begin
induction n with n ih, { simp [set.singleton_one], },
simp only [pow_succ, ih, span_singleton_mul_span_singleton],
end
lemma mem_mul_span_singleton {x y : R} {I : ideal R} :
x ∈ I * span {y} ↔ ∃ z ∈ I, z * y = x :=
submodule.mem_smul_span_singleton
lemma mem_span_singleton_mul {x y : R} {I : ideal R} :
x ∈ span {y} * I ↔ ∃ z ∈ I, y * z = x :=
by simp only [mul_comm, mem_mul_span_singleton]
lemma le_span_singleton_mul_iff {x : R} {I J : ideal R} :
I ≤ span {x} * J ↔ ∀ zI ∈ I, ∃ zJ ∈ J, x * zJ = zI :=
show (∀ {zI} (hzI : zI ∈ I), zI ∈ span {x} * J) ↔ ∀ zI ∈ I, ∃ zJ ∈ J, x * zJ = zI,
by simp only [mem_span_singleton_mul]
lemma span_singleton_mul_le_iff {x : R} {I J : ideal R} :
span {x} * I ≤ J ↔ ∀ z ∈ I, x * z ∈ J :=
begin
simp only [mul_le, mem_span_singleton_mul, mem_span_singleton],
split,
{ intros h zI hzI,
exact h x (dvd_refl x) zI hzI },
{ rintros h _ ⟨z, rfl⟩ zI hzI,
rw [mul_comm x z, mul_assoc],
exact J.mul_mem_left _ (h zI hzI) },
end
lemma span_singleton_mul_le_span_singleton_mul {x y : R} {I J : ideal R} :
span {x} * I ≤ span {y} * J ↔ ∀ zI ∈ I, ∃ zJ ∈ J, x * zI = y * zJ :=
by simp only [span_singleton_mul_le_iff, mem_span_singleton_mul, eq_comm]
lemma eq_span_singleton_mul {x : R} (I J : ideal R) :
I = span {x} * J ↔ ((∀ zI ∈ I, ∃ zJ ∈ J, x * zJ = zI) ∧ (∀ z ∈ J, x * z ∈ I)) :=
by simp only [le_antisymm_iff, le_span_singleton_mul_iff, span_singleton_mul_le_iff]
lemma span_singleton_mul_eq_span_singleton_mul {x y : R} (I J : ideal R) :
span {x} * I = span {y} * J ↔
((∀ zI ∈ I, ∃ zJ ∈ J, x * zI = y * zJ) ∧
(∀ zJ ∈ J, ∃ zI ∈ I, x * zI = y * zJ)) :=
by simp only [le_antisymm_iff, span_singleton_mul_le_span_singleton_mul, eq_comm]
lemma prod_span {ι : Type*} (s : finset ι) (I : ι → set R) :
(∏ i in s, ideal.span (I i)) = ideal.span (∏ i in s, I i) :=
submodule.prod_span s I
lemma prod_span_singleton {ι : Type*} (s : finset ι) (I : ι → R) :
(∏ i in s, ideal.span ({I i} : set R)) = ideal.span {∏ i in s, I i} :=
submodule.prod_span_singleton s I
lemma finset_inf_span_singleton {ι : Type*} (s : finset ι) (I : ι → R)
(hI : set.pairwise ↑s (is_coprime on I)) :
(s.inf $ λ i, ideal.span ({I i} : set R)) = ideal.span {∏ i in s, I i} :=
begin
ext x,
simp only [submodule.mem_finset_inf, ideal.mem_span_singleton],
exact ⟨finset.prod_dvd_of_coprime hI,
λ h i hi, (finset.dvd_prod_of_mem _ hi).trans h⟩
end
lemma infi_span_singleton {ι : Type*} [fintype ι] (I : ι → R)
(hI : ∀ i j (hij : i ≠ j), is_coprime (I i) (I j)):
(⨅ i, ideal.span ({I i} : set R)) = ideal.span {∏ i, I i} :=
begin
rw [← finset.inf_univ_eq_infi, finset_inf_span_singleton],
rwa [finset.coe_univ, set.pairwise_univ]
end
lemma sup_eq_top_iff_is_coprime {R : Type*} [comm_semiring R] (x y : R) :
span ({x} : set R) ⊔ span {y} = ⊤ ↔ is_coprime x y :=
begin
rw [eq_top_iff_one, submodule.mem_sup],
split,
{ rintro ⟨u, hu, v, hv, h1⟩,
rw mem_span_singleton' at hu hv,
rw [← hu.some_spec, ← hv.some_spec] at h1,
exact ⟨_, _, h1⟩ },
{ exact λ ⟨u, v, h1⟩,
⟨_, mem_span_singleton'.mpr ⟨_, rfl⟩, _, mem_span_singleton'.mpr ⟨_, rfl⟩, h1⟩ },
end
theorem mul_le_inf : I * J ≤ I ⊓ J :=
mul_le.2 $ λ r hri s hsj, ⟨I.mul_mem_right s hri, J.mul_mem_left r hsj⟩
theorem multiset_prod_le_inf {s : multiset (ideal R)} :
s.prod ≤ s.inf :=
begin
classical, refine s.induction_on _ _,
{ rw [multiset.inf_zero], exact le_top },
intros a s ih,
rw [multiset.prod_cons, multiset.inf_cons],
exact le_trans mul_le_inf (inf_le_inf le_rfl ih)
end
theorem prod_le_inf {s : finset ι} {f : ι → ideal R} : s.prod f ≤ s.inf f :=
multiset_prod_le_inf
theorem mul_eq_inf_of_coprime (h : I ⊔ J = ⊤) : I * J = I ⊓ J :=
le_antisymm mul_le_inf $ λ r ⟨hri, hrj⟩,
let ⟨s, hsi, t, htj, hst⟩ := submodule.mem_sup.1 ((eq_top_iff_one _).1 h) in
mul_one r ▸ hst ▸ (mul_add r s t).symm ▸ ideal.add_mem (I * J) (mul_mem_mul_rev hsi hrj)
(mul_mem_mul hri htj)
lemma sup_mul_eq_of_coprime_left (h : I ⊔ J = ⊤) : I ⊔ (J * K) = I ⊔ K :=
le_antisymm (sup_le_sup_left mul_le_left _) $ λ i hi,
begin
rw eq_top_iff_one at h, rw submodule.mem_sup at h hi ⊢,
obtain ⟨i1, hi1, j, hj, h⟩ := h, obtain ⟨i', hi', k, hk, hi⟩ := hi,
refine ⟨_, add_mem hi' (mul_mem_right k _ hi1), _, mul_mem_mul hj hk, _⟩,
rw [add_assoc, ← add_mul, h, one_mul, hi]
end
lemma sup_mul_eq_of_coprime_right (h : I ⊔ K = ⊤) : I ⊔ (J * K) = I ⊔ J :=
by { rw mul_comm, exact sup_mul_eq_of_coprime_left h }
lemma mul_sup_eq_of_coprime_left (h : I ⊔ J = ⊤) : (I * K) ⊔ J = K ⊔ J :=
by { rw sup_comm at h, rw [sup_comm, sup_mul_eq_of_coprime_left h, sup_comm] }
lemma mul_sup_eq_of_coprime_right (h : K ⊔ J = ⊤) : (I * K) ⊔ J = I ⊔ J :=
by { rw sup_comm at h, rw [sup_comm, sup_mul_eq_of_coprime_right h, sup_comm] }
lemma sup_prod_eq_top {s : finset ι} {J : ι → ideal R} (h : ∀ i, i ∈ s → I ⊔ J i = ⊤) :
I ⊔ ∏ i in s, J i = ⊤ :=
finset.prod_induction _ (λ J, I ⊔ J = ⊤) (λ J K hJ hK, (sup_mul_eq_of_coprime_left hJ).trans hK)
(by rw [one_eq_top, sup_top_eq]) h
lemma sup_infi_eq_top {s : finset ι} {J : ι → ideal R} (h : ∀ i, i ∈ s → I ⊔ J i = ⊤) :
I ⊔ (⨅ i ∈ s, J i) = ⊤ :=
eq_top_iff.mpr $ le_of_eq_of_le (sup_prod_eq_top h).symm $ sup_le_sup_left
(le_of_le_of_eq prod_le_inf $ finset.inf_eq_infi _ _) _
lemma prod_sup_eq_top {s : finset ι} {J : ι → ideal R} (h : ∀ i, i ∈ s → J i ⊔ I = ⊤) :
(∏ i in s, J i) ⊔ I = ⊤ :=
sup_comm.trans (sup_prod_eq_top $ λ i hi, sup_comm.trans $ h i hi)
lemma infi_sup_eq_top {s : finset ι} {J : ι → ideal R} (h : ∀ i, i ∈ s → J i ⊔ I = ⊤) :
(⨅ i ∈ s, J i) ⊔ I = ⊤ :=
sup_comm.trans (sup_infi_eq_top $ λ i hi, sup_comm.trans $ h i hi)
lemma sup_pow_eq_top {n : ℕ} (h : I ⊔ J = ⊤) : I ⊔ (J ^ n) = ⊤ :=
by { rw [← finset.card_range n, ← finset.prod_const], exact sup_prod_eq_top (λ _ _, h) }
lemma pow_sup_eq_top {n : ℕ} (h : I ⊔ J = ⊤) : (I ^ n) ⊔ J = ⊤ :=
by { rw [← finset.card_range n, ← finset.prod_const], exact prod_sup_eq_top (λ _ _, h) }
lemma pow_sup_pow_eq_top {m n : ℕ} (h : I ⊔ J = ⊤) : (I ^ m) ⊔ (J ^ n) = ⊤ :=
sup_pow_eq_top (pow_sup_eq_top h)
variables (I)
@[simp] theorem mul_bot : I * ⊥ = ⊥ :=
submodule.smul_bot I
@[simp] theorem bot_mul : ⊥ * I = ⊥ :=
submodule.bot_smul I
@[simp] theorem mul_top : I * ⊤ = I :=
ideal.mul_comm ⊤ I ▸ submodule.top_smul I
@[simp] theorem top_mul : ⊤ * I = I :=
submodule.top_smul I
variables {I}
theorem mul_mono (hik : I ≤ K) (hjl : J ≤ L) : I * J ≤ K * L :=
submodule.smul_mono hik hjl
theorem mul_mono_left (h : I ≤ J) : I * K ≤ J * K :=
submodule.smul_mono_left h
theorem mul_mono_right (h : J ≤ K) : I * J ≤ I * K :=
submodule.smul_mono_right h
variables (I J K)
theorem mul_sup : I * (J ⊔ K) = I * J ⊔ I * K :=
submodule.smul_sup I J K
theorem sup_mul : (I ⊔ J) * K = I * K ⊔ J * K :=
submodule.sup_smul I J K
variables {I J K}
lemma pow_le_pow {m n : ℕ} (h : m ≤ n) :
I^n ≤ I^m :=
begin
cases nat.exists_eq_add_of_le h with k hk,
rw [hk, pow_add],
exact le_trans (mul_le_inf) (inf_le_left)
end
lemma pow_le_self {n : ℕ} (hn : n ≠ 0) : I^n ≤ I :=
calc I^n ≤ I ^ 1 : pow_le_pow (nat.pos_of_ne_zero hn)
... = I : pow_one _
lemma pow_mono {I J : ideal R} (e : I ≤ J) (n : ℕ) : I ^ n ≤ J ^ n :=
begin
induction n,
{ rw [pow_zero, pow_zero], exact rfl.le },
{ rw [pow_succ, pow_succ], exact ideal.mul_mono e n_ih }
end
lemma mul_eq_bot {R : Type*} [comm_semiring R] [no_zero_divisors R] {I J : ideal R} :
I * J = ⊥ ↔ I = ⊥ ∨ J = ⊥ :=
⟨λ hij, or_iff_not_imp_left.mpr (λ I_ne_bot, J.eq_bot_iff.mpr (λ j hj,
let ⟨i, hi, ne0⟩ := I.ne_bot_iff.mp I_ne_bot in
or.resolve_left (mul_eq_zero.mp ((I * J).eq_bot_iff.mp hij _ (mul_mem_mul hi hj))) ne0)),
λ h, by cases h; rw [← ideal.mul_bot, h, ideal.mul_comm]⟩
instance {R : Type*} [comm_semiring R] [no_zero_divisors R] : no_zero_divisors (ideal R) :=
{ eq_zero_or_eq_zero_of_mul_eq_zero := λ I J, mul_eq_bot.1 }
/-- A product of ideals in an integral domain is zero if and only if one of the terms is zero. -/
lemma prod_eq_bot {R : Type*} [comm_ring R] [is_domain R]
{s : multiset (ideal R)} : s.prod = ⊥ ↔ ∃ I ∈ s, I = ⊥ :=
prod_zero_iff_exists_zero
/-- The radical of an ideal `I` consists of the elements `r` such that `r^n ∈ I` for some `n`. -/
def radical (I : ideal R) : ideal R :=
{ carrier := { r | ∃ n : ℕ, r ^ n ∈ I },
zero_mem' := ⟨1, (pow_one (0:R)).symm ▸ I.zero_mem⟩,
add_mem' := λ x y ⟨m, hxmi⟩ ⟨n, hyni⟩, ⟨m + n,
(add_pow x y (m + n)).symm ▸ I.sum_mem $
show ∀ c ∈ finset.range (nat.succ (m + n)),
x ^ c * y ^ (m + n - c) * (nat.choose (m + n) c) ∈ I,
from λ c hc, or.cases_on (le_total c m)
(λ hcm, I.mul_mem_right _ $ I.mul_mem_left _ $ nat.add_comm n m ▸
(add_tsub_assoc_of_le hcm n).symm ▸
(pow_add y n (m-c)).symm ▸ I.mul_mem_right _ hyni)
(λ hmc, I.mul_mem_right _ $ I.mul_mem_right _ $ add_tsub_cancel_of_le hmc ▸
(pow_add x m (c-m)).symm ▸ I.mul_mem_right _ hxmi)⟩,
smul_mem' := λ r s ⟨n, hsni⟩, ⟨n, (mul_pow r s n).symm ▸ I.mul_mem_left (r^n) hsni⟩ }
/-- An ideal is radical if it contains its radical. -/
def is_radical (I : ideal R) : Prop := I.radical ≤ I
theorem le_radical : I ≤ radical I :=
λ r hri, ⟨1, (pow_one r).symm ▸ hri⟩
/-- An ideal is radical iff it is equal to its radical. -/
theorem radical_eq_iff : I.radical = I ↔ I.is_radical :=
by rw [le_antisymm_iff, and_iff_left le_radical, is_radical]
alias radical_eq_iff ↔ _ is_radical.radical
variables (R)
theorem radical_top : (radical ⊤ : ideal R) = ⊤ :=
(eq_top_iff_one _).2 ⟨0, submodule.mem_top⟩
variables {R}
theorem radical_mono (H : I ≤ J) : radical I ≤ radical J :=
λ r ⟨n, hrni⟩, ⟨n, H hrni⟩
variables (I)
theorem radical_is_radical : (radical I).is_radical :=
λ r ⟨n, k, hrnki⟩, ⟨n * k, (pow_mul r n k).symm ▸ hrnki⟩
@[simp] theorem radical_idem : radical (radical I) = radical I :=
(radical_is_radical I).radical
variables {I}
theorem is_radical.radical_le_iff (hJ : J.is_radical) : radical I ≤ J ↔ I ≤ J :=
⟨le_trans le_radical, λ h, hJ.radical ▸ radical_mono h⟩
theorem radical_le_radical_iff : radical I ≤ radical J ↔ I ≤ radical J :=
(radical_is_radical J).radical_le_iff
theorem radical_eq_top : radical I = ⊤ ↔ I = ⊤ :=
⟨λ h, (eq_top_iff_one _).2 $ let ⟨n, hn⟩ := (eq_top_iff_one _).1 h in
@one_pow R _ n ▸ hn, λ h, h.symm ▸ radical_top R⟩
theorem is_prime.is_radical (H : is_prime I) : I.is_radical :=
λ r ⟨n, hrni⟩, H.mem_of_pow_mem n hrni
theorem is_prime.radical (H : is_prime I) : radical I = I := H.is_radical.radical
variables (I J)
theorem radical_sup : radical (I ⊔ J) = radical (radical I ⊔ radical J) :=
le_antisymm (radical_mono $ sup_le_sup le_radical le_radical) $
radical_le_radical_iff.2 $ sup_le (radical_mono le_sup_left) (radical_mono le_sup_right)
theorem radical_inf : radical (I ⊓ J) = radical I ⊓ radical J :=
le_antisymm (le_inf (radical_mono inf_le_left) (radical_mono inf_le_right))
(λ r ⟨⟨m, hrm⟩, ⟨n, hrn⟩⟩, ⟨m + n, (pow_add r m n).symm ▸ I.mul_mem_right _ hrm,
(pow_add r m n).symm ▸ J.mul_mem_left _ hrn⟩)
theorem radical_mul : radical (I * J) = radical I ⊓ radical J :=
le_antisymm (radical_inf I J ▸ radical_mono $ @mul_le_inf _ _ I J)
(λ r ⟨⟨m, hrm⟩, ⟨n, hrn⟩⟩, ⟨m + n, (pow_add r m n).symm ▸ mul_mem_mul hrm hrn⟩)
variables {I J}
theorem is_prime.radical_le_iff (hJ : is_prime J) :
radical I ≤ J ↔ I ≤ J := hJ.is_radical.radical_le_iff
theorem radical_eq_Inf (I : ideal R) :
radical I = Inf { J : ideal R | I ≤ J ∧ is_prime J } :=
le_antisymm (le_Inf $ λ J hJ, hJ.2.radical_le_iff.2 hJ.1) $
λ r hr, classical.by_contradiction $ λ hri,
let ⟨m, (hrm : r ∉ radical m), him, hm⟩ := zorn_nonempty_partial_order₀
{K : ideal R | r ∉ radical K}
(λ c hc hcc y hyc, ⟨Sup c, λ ⟨n, hrnc⟩, let ⟨y, hyc, hrny⟩ :=
(submodule.mem_Sup_of_directed ⟨y, hyc⟩ hcc.directed_on).1 hrnc in hc hyc ⟨n, hrny⟩,
λ z, le_Sup⟩) I hri in
have ∀ x ∉ m, r ∈ radical (m ⊔ span {x}) := λ x hxm, classical.by_contradiction $ λ hrmx, hxm $
hm (m ⊔ span {x}) hrmx le_sup_left ▸ (le_sup_right : _ ≤ m ⊔ span {x})
(subset_span $ set.mem_singleton _),
have is_prime m, from ⟨by rintro rfl; rw radical_top at hrm; exact hrm trivial,
λ x y hxym, or_iff_not_imp_left.2 $ λ hxm, classical.by_contradiction $ λ hym,
let ⟨n, hrn⟩ := this _ hxm,
⟨p, hpm, q, hq, hpqrn⟩ := submodule.mem_sup.1 hrn,
⟨c, hcxq⟩ := mem_span_singleton'.1 hq in
let ⟨k, hrk⟩ := this _ hym,
⟨f, hfm, g, hg, hfgrk⟩ := submodule.mem_sup.1 hrk,
⟨d, hdyg⟩ := mem_span_singleton'.1 hg in
hrm ⟨n + k, by rw [pow_add, ← hpqrn, ← hcxq, ← hfgrk, ← hdyg, add_mul, mul_add (c*x),
mul_assoc c x (d*y), mul_left_comm x, ← mul_assoc];
refine m.add_mem (m.mul_mem_right _ hpm) (m.add_mem (m.mul_mem_left _ hfm)
(m.mul_mem_left _ hxym))⟩⟩,
hrm $ this.radical.symm ▸ (Inf_le ⟨him, this⟩ : Inf {J : ideal R | I ≤ J ∧ is_prime J} ≤ m) hr
lemma is_radical_bot_of_no_zero_divisors {R} [comm_semiring R] [no_zero_divisors R] :
(⊥ : ideal R).is_radical := λ x hx, hx.rec_on (λ n hn, pow_eq_zero hn)
@[simp] lemma radical_bot_of_no_zero_divisors {R : Type u} [comm_semiring R] [no_zero_divisors R] :
radical (⊥ : ideal R) = ⊥ :=
eq_bot_iff.2 is_radical_bot_of_no_zero_divisors
instance : comm_semiring (ideal R) := submodule.comm_semiring
variables (R)
theorem top_pow (n : ℕ) : (⊤ ^ n : ideal R) = ⊤ :=
nat.rec_on n one_eq_top $ λ n ih, by rw [pow_succ, ih, top_mul]
variables {R}
variables (I)
theorem radical_pow (n : ℕ) (H : n > 0) : radical (I^n) = radical I :=
nat.rec_on n (not.elim dec_trivial) (λ n ih H,
or.cases_on (lt_or_eq_of_le $ nat.le_of_lt_succ H)
(λ H, calc radical (I^(n+1))
= radical I ⊓ radical (I^n) : by { rw pow_succ, exact radical_mul _ _ }
... = radical I ⊓ radical I : by rw ih H
... = radical I : inf_idem)
(λ H, H ▸ (pow_one I).symm ▸ rfl)) H
theorem is_prime.mul_le {I J P : ideal R} (hp : is_prime P) :
I * J ≤ P ↔ I ≤ P ∨ J ≤ P :=
⟨λ h, or_iff_not_imp_left.2 $ λ hip j hj, let ⟨i, hi, hip⟩ := set.not_subset.1 hip in
(hp.mem_or_mem $ h $ mul_mem_mul hi hj).resolve_left hip,
λ h, or.cases_on h (le_trans $ le_trans mul_le_inf inf_le_left)
(le_trans $ le_trans mul_le_inf inf_le_right)⟩
theorem is_prime.inf_le {I J P : ideal R} (hp : is_prime P) :
I ⊓ J ≤ P ↔ I ≤ P ∨ J ≤ P :=
⟨λ h, hp.mul_le.1 $ le_trans mul_le_inf h,
λ h, or.cases_on h (le_trans inf_le_left) (le_trans inf_le_right)⟩
theorem is_prime.multiset_prod_le {s : multiset (ideal R)} {P : ideal R}
(hp : is_prime P) (hne : s ≠ 0) :
s.prod ≤ P ↔ ∃ I ∈ s, I ≤ P :=
suffices s.prod ≤ P → ∃ I ∈ s, I ≤ P,
from ⟨this, λ ⟨i, his, hip⟩, le_trans multiset_prod_le_inf $
le_trans (multiset.inf_le his) hip⟩,
begin
classical,
obtain ⟨b, hb⟩ : ∃ b, b ∈ s := multiset.exists_mem_of_ne_zero hne,
obtain ⟨t, rfl⟩ : ∃ t, s = b ::ₘ t,
from ⟨s.erase b, (multiset.cons_erase hb).symm⟩,
refine t.induction_on _ _,
{ simp only [exists_prop, multiset.cons_zero, multiset.prod_singleton,
multiset.mem_singleton, exists_eq_left, imp_self] },
intros a s ih h,
rw [multiset.cons_swap, multiset.prod_cons, hp.mul_le] at h,
rw multiset.cons_swap,
cases h,
{ exact ⟨a, multiset.mem_cons_self a _, h⟩ },
obtain ⟨I, hI, ih⟩ : ∃ I ∈ b ::ₘ s, I ≤ P := ih h,
exact ⟨I, multiset.mem_cons_of_mem hI, ih⟩
end
theorem is_prime.multiset_prod_map_le {s : multiset ι} (f : ι → ideal R) {P : ideal R}
(hp : is_prime P) (hne : s ≠ 0) :
(s.map f).prod ≤ P ↔ ∃ i ∈ s, f i ≤ P :=
begin
rw hp.multiset_prod_le (mt multiset.map_eq_zero.mp hne),
simp_rw [exists_prop, multiset.mem_map, exists_exists_and_eq_and],
end
theorem is_prime.prod_le {s : finset ι} {f : ι → ideal R} {P : ideal R}
(hp : is_prime P) (hne : s.nonempty) :
s.prod f ≤ P ↔ ∃ i ∈ s, f i ≤ P :=
hp.multiset_prod_map_le f (mt finset.val_eq_zero.mp hne.ne_empty)
theorem is_prime.inf_le' {s : finset ι} {f : ι → ideal R} {P : ideal R} (hp : is_prime P)
(hsne: s.nonempty) :
s.inf f ≤ P ↔ ∃ i ∈ s, f i ≤ P :=
⟨λ h, (hp.prod_le hsne).1 $ le_trans prod_le_inf h,
λ ⟨i, his, hip⟩, le_trans (finset.inf_le his) hip⟩
theorem subset_union {R : Type u} [ring R] {I J K : ideal R} :
(I : set R) ⊆ J ∪ K ↔ I ≤ J ∨ I ≤ K :=
⟨λ h, or_iff_not_imp_left.2 $ λ hij s hsi,
let ⟨r, hri, hrj⟩ := set.not_subset.1 hij in classical.by_contradiction $ λ hsk,
or.cases_on (h $ I.add_mem hri hsi)
(λ hj, hrj $ add_sub_cancel r s ▸ J.sub_mem hj ((h hsi).resolve_right hsk))
(λ hk, hsk $ add_sub_cancel' r s ▸ K.sub_mem hk ((h hri).resolve_left hrj)),
λ h, or.cases_on h (λ h, set.subset.trans h $ set.subset_union_left J K)
(λ h, set.subset.trans h $ set.subset_union_right J K)⟩
theorem subset_union_prime' {R : Type u} [comm_ring R] {s : finset ι} {f : ι → ideal R} {a b : ι}
(hp : ∀ i ∈ s, is_prime (f i)) {I : ideal R} :
(I : set R) ⊆ f a ∪ f b ∪ (⋃ i ∈ (↑s : set ι), f i) ↔ I ≤ f a ∨ I ≤ f b ∨ ∃ i ∈ s, I ≤ f i :=
suffices (I : set R) ⊆ f a ∪ f b ∪ (⋃ i ∈ (↑s : set ι), f i) →
I ≤ f a ∨ I ≤ f b ∨ ∃ i ∈ s, I ≤ f i,
from ⟨this, λ h, or.cases_on h (λ h, set.subset.trans h $ set.subset.trans
(set.subset_union_left _ _) (set.subset_union_left _ _)) $
λ h, or.cases_on h (λ h, set.subset.trans h $ set.subset.trans
(set.subset_union_right _ _) (set.subset_union_left _ _)) $
λ ⟨i, his, hi⟩, by refine (set.subset.trans hi $ set.subset.trans _ $
set.subset_union_right _ _);
exact set.subset_bUnion_of_mem (finset.mem_coe.2 his)⟩,
begin
generalize hn : s.card = n, intros h,
unfreezingI { induction n with n ih generalizing a b s },
{ clear hp,
rw finset.card_eq_zero at hn, subst hn,
rw [finset.coe_empty, set.bUnion_empty, set.union_empty, subset_union] at h,
simpa only [exists_prop, finset.not_mem_empty, false_and, exists_false, or_false] },
classical,
replace hn : ∃ (i : ι) (t : finset ι), i ∉ t ∧ insert i t = s ∧ t.card = n :=
finset.card_eq_succ.1 hn,
unfreezingI { rcases hn with ⟨i, t, hit, rfl, hn⟩ },
replace hp : is_prime (f i) ∧ ∀ x ∈ t, is_prime (f x) := (t.forall_mem_insert _ _).1 hp,
by_cases Ht : ∃ j ∈ t, f j ≤ f i,
{ obtain ⟨j, hjt, hfji⟩ : ∃ j ∈ t, f j ≤ f i := Ht,
obtain ⟨u, hju, rfl⟩ : ∃ u, j ∉ u ∧ insert j u = t,
{ exact ⟨t.erase j, t.not_mem_erase j, finset.insert_erase hjt⟩ },
have hp' : ∀ k ∈ insert i u, is_prime (f k),
{ rw finset.forall_mem_insert at hp ⊢, exact ⟨hp.1, hp.2.2⟩ },
have hiu : i ∉ u := mt finset.mem_insert_of_mem hit,
have hn' : (insert i u).card = n,
{ rwa finset.card_insert_of_not_mem at hn ⊢, exacts [hiu, hju] },
have h' : (I : set R) ⊆ f a ∪ f b ∪ (⋃ k ∈ (↑(insert i u) : set ι), f k),
{ rw finset.coe_insert at h ⊢, rw finset.coe_insert at h,
simp only [set.bUnion_insert] at h ⊢,
rw [← set.union_assoc ↑(f i)] at h,
erw [set.union_eq_self_of_subset_right hfji] at h,
exact h },
specialize @ih a b (insert i u) hp' hn' h',
refine ih.imp id (or.imp id (exists_imp_exists $ λ k, _)), simp only [exists_prop],
exact and.imp (λ hk, finset.insert_subset_insert i (finset.subset_insert j u) hk) id },
by_cases Ha : f a ≤ f i,
{ have h' : (I : set R) ⊆ f i ∪ f b ∪ (⋃ j ∈ (↑t : set ι), f j),
{ rw [finset.coe_insert, set.bUnion_insert, ← set.union_assoc,
set.union_right_comm ↑(f a)] at h,
erw [set.union_eq_self_of_subset_left Ha] at h,
exact h },
specialize @ih i b t hp.2 hn h', right,
rcases ih with ih | ih | ⟨k, hkt, ih⟩,
{ exact or.inr ⟨i, finset.mem_insert_self i t, ih⟩ },
{ exact or.inl ih },
{ exact or.inr ⟨k, finset.mem_insert_of_mem hkt, ih⟩ } },
by_cases Hb : f b ≤ f i,
{ have h' : (I : set R) ⊆ f a ∪ f i ∪ (⋃ j ∈ (↑t : set ι), f j),
{ rw [finset.coe_insert, set.bUnion_insert, ← set.union_assoc, set.union_assoc ↑(f a)] at h,
erw [set.union_eq_self_of_subset_left Hb] at h,
exact h },
specialize @ih a i t hp.2 hn h',
rcases ih with ih | ih | ⟨k, hkt, ih⟩,
{ exact or.inl ih },
{ exact or.inr (or.inr ⟨i, finset.mem_insert_self i t, ih⟩) },
{ exact or.inr (or.inr ⟨k, finset.mem_insert_of_mem hkt, ih⟩) } },
by_cases Hi : I ≤ f i,
{ exact or.inr (or.inr ⟨i, finset.mem_insert_self i t, Hi⟩) },
have : ¬I ⊓ f a ⊓ f b ⊓ t.inf f ≤ f i,
{ rcases t.eq_empty_or_nonempty with (rfl | hsne),
{ rw [finset.inf_empty, inf_top_eq, hp.1.inf_le, hp.1.inf_le, not_or_distrib, not_or_distrib],
exact ⟨⟨Hi, Ha⟩, Hb⟩ },
simp only [hp.1.inf_le, hp.1.inf_le' hsne, not_or_distrib],
exact ⟨⟨⟨Hi, Ha⟩, Hb⟩, Ht⟩ },
rcases set.not_subset.1 this with ⟨r, ⟨⟨⟨hrI, hra⟩, hrb⟩, hr⟩, hri⟩,
by_cases HI : (I : set R) ⊆ f a ∪ f b ∪ ⋃ j ∈ (↑t : set ι), f j,
{ specialize ih hp.2 hn HI, rcases ih with ih | ih | ⟨k, hkt, ih⟩,
{ left, exact ih }, { right, left, exact ih },
{ right, right, exact ⟨k, finset.mem_insert_of_mem hkt, ih⟩ } },
exfalso, rcases set.not_subset.1 HI with ⟨s, hsI, hs⟩,
rw [finset.coe_insert, set.bUnion_insert] at h,
have hsi : s ∈ f i := ((h hsI).resolve_left (mt or.inl hs)).resolve_right (mt or.inr hs),
rcases h (I.add_mem hrI hsI) with ⟨ha | hb⟩ | hi | ht,
{ exact hs (or.inl $ or.inl $ add_sub_cancel' r s ▸ (f a).sub_mem ha hra) },
{ exact hs (or.inl $ or.inr $ add_sub_cancel' r s ▸ (f b).sub_mem hb hrb) },
{ exact hri (add_sub_cancel r s ▸ (f i).sub_mem hi hsi) },
{ rw set.mem_Union₂ at ht, rcases ht with ⟨j, hjt, hj⟩,
simp only [finset.inf_eq_infi, set_like.mem_coe, submodule.mem_infi] at hr,
exact hs (or.inr $ set.mem_bUnion hjt $ add_sub_cancel' r s ▸ (f j).sub_mem hj $ hr j hjt) }
end
/-- Prime avoidance. Atiyah-Macdonald 1.11, Eisenbud 3.3, Stacks 00DS, Matsumura Ex.1.6. -/
theorem subset_union_prime {R : Type u} [comm_ring R] {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 :=
suffices (I : set R) ⊆ (⋃ i ∈ (↑s : set ι), f i) → ∃ i, i ∈ s ∧ I ≤ f i,
from ⟨λ h, bex_def.2 $ this h, λ ⟨i, his, hi⟩, set.subset.trans hi $ set.subset_bUnion_of_mem $
show i ∈ (↑s : set ι), from his⟩,
assume h : (I : set R) ⊆ (⋃ i ∈ (↑s : set ι), f i),
begin
classical,
by_cases has : a ∈ s,
{ unfreezingI { obtain ⟨t, hat, rfl⟩ : ∃ t, a ∉ t ∧ insert a t = s :=
⟨s.erase a, finset.not_mem_erase a s, finset.insert_erase has⟩ },
by_cases hbt : b ∈ t,
{ unfreezingI { obtain ⟨u, hbu, rfl⟩ : ∃ u, b ∉ u ∧ insert b u = t :=
⟨t.erase b, finset.not_mem_erase b t, finset.insert_erase hbt⟩ },
have hp' : ∀ i ∈ u, is_prime (f i),
{ intros i hiu, refine hp i (finset.mem_insert_of_mem (finset.mem_insert_of_mem hiu)) _ _;
unfreezingI { rintro rfl }; solve_by_elim only [finset.mem_insert_of_mem, *], },
rw [finset.coe_insert, finset.coe_insert, set.bUnion_insert, set.bUnion_insert,
← set.union_assoc, subset_union_prime' hp', bex_def] at h,
rwa [finset.exists_mem_insert, finset.exists_mem_insert] },
{ have hp' : ∀ j ∈ t, is_prime (f j),
{ intros j hj, refine hp j (finset.mem_insert_of_mem hj) _ _;
unfreezingI { rintro rfl }; solve_by_elim only [finset.mem_insert_of_mem, *], },
rw [finset.coe_insert, set.bUnion_insert, ← set.union_self (f a : set R),
subset_union_prime' hp', ← or_assoc, or_self, bex_def] at h,
rwa finset.exists_mem_insert } },
{ by_cases hbs : b ∈ s,
{ unfreezingI { obtain ⟨t, hbt, rfl⟩ : ∃ t, b ∉ t ∧ insert b t = s :=
⟨s.erase b, finset.not_mem_erase b s, finset.insert_erase hbs⟩ },
have hp' : ∀ j ∈ t, is_prime (f j),
{ intros j hj, refine hp j (finset.mem_insert_of_mem hj) _ _;
unfreezingI { rintro rfl }; solve_by_elim only [finset.mem_insert_of_mem, *], },
rw [finset.coe_insert, set.bUnion_insert, ← set.union_self (f b : set R),
subset_union_prime' hp', ← or_assoc, or_self, bex_def] at h,
rwa finset.exists_mem_insert },
cases s.eq_empty_or_nonempty with hse hsne,
{ substI hse, rw [finset.coe_empty, set.bUnion_empty, set.subset_empty_iff] at h,
have : (I : set R) ≠ ∅ := set.nonempty.ne_empty (set.nonempty_of_mem I.zero_mem),
exact absurd h this },
{ cases hsne.bex with i his,
unfreezingI { obtain ⟨t, hit, rfl⟩ : ∃ t, i ∉ t ∧ insert i t = s :=
⟨s.erase i, finset.not_mem_erase i s, finset.insert_erase his⟩ },
have hp' : ∀ j ∈ t, is_prime (f j),
{ intros j hj, refine hp j (finset.mem_insert_of_mem hj) _ _;
unfreezingI { rintro rfl }; solve_by_elim only [finset.mem_insert_of_mem, *], },
rw [finset.coe_insert, set.bUnion_insert, ← set.union_self (f i : set R),
subset_union_prime' hp', ← or_assoc, or_self, bex_def] at h,
rwa finset.exists_mem_insert } }
end
section dvd
/-- If `I` divides `J`, then `I` contains `J`.
In a Dedekind domain, to divide and contain are equivalent, see `ideal.dvd_iff_le`.
-/
lemma le_of_dvd {I J : ideal R} : I ∣ J → J ≤ I
| ⟨K, h⟩ := h.symm ▸ le_trans mul_le_inf inf_le_left
lemma is_unit_iff {I : ideal R} :
is_unit I ↔ I = ⊤ :=
is_unit_iff_dvd_one.trans ((@one_eq_top R _).symm ▸
⟨λ h, eq_top_iff.mpr (ideal.le_of_dvd h), λ h, ⟨⊤, by rw [mul_top, h]⟩⟩)
instance unique_units : unique ((ideal R)ˣ) :=
{ default := 1,
uniq := λ u, units.ext
(show (u : ideal R) = 1, by rw [is_unit_iff.mp u.is_unit, one_eq_top]) }
end dvd
end mul_and_radical
section map_and_comap
variables {R : Type u} {S : Type v}
section semiring
variables {F : Type*} [semiring R] [semiring S]
variables [rc : ring_hom_class F R S]
variables (f : F)
variables {I J : ideal R} {K L : ideal S}
include rc
/-- `I.map f` is the span of the image of the ideal `I` under `f`, which may be bigger than
the image itself. -/