-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Expand file tree
/
Copy pathTopology.lean
More file actions
1438 lines (1170 loc) · 65.7 KB
/
Topology.lean
File metadata and controls
1438 lines (1170 loc) · 65.7 KB
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) 2020 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin
-/
module
public import Mathlib.Algebra.Order.Ring.Idempotent
public import Mathlib.Order.Heyting.Hom
public import Mathlib.RingTheory.Finiteness.Ideal
public import Mathlib.RingTheory.Ideal.GoingUp
public import Mathlib.RingTheory.Ideal.MinimalPrime.Localization
public import Mathlib.RingTheory.KrullDimension.Basic
public import Mathlib.RingTheory.Localization.Algebra
public import Mathlib.RingTheory.Spectrum.Maximal.Localization
public import Mathlib.Topology.Constructible
public import Mathlib.Topology.KrullDimension
public import Mathlib.Topology.Spectral.Basic
/-!
# The Zariski topology on the prime spectrum of a commutative (semi)ring
## Conventions
We denote subsets of (semi)rings with `s`, `s'`, etc...
whereas we denote subsets of prime spectra with `t`, `t'`, etc...
## Inspiration/contributors
The contents of this file draw inspiration from <https://github.com/ramonfmir/lean-scheme>
which has contributions from Ramon Fernandez Mir, Kevin Buzzard, Kenny Lau,
and Chris Hughes (on an earlier repository).
## Main definitions
* `PrimeSpectrum.zariskiTopology`: the Zariski topology on the prime spectrum, whose closed sets
are zero loci (`zeroLocus`).
* `PrimeSpectrum.basicOpen`: the complement of the zero locus of a single element.
The `basicOpen`s form a topological basis of the Zariski topology:
`PrimeSpectrum.isTopologicalBasis_basic_opens`.
* `PrimeSpectrum.comap`: the continuous map between prime spectra induced by a ring homomorphism.
* `IsLocalRing.closedPoint`: the maximal ideal of a local ring is the unique closed point in its
prime spectrum.
## Main results
* `PrimeSpectrum.instSpectralSpace`: every prime spectrum is a spectral space, i.e. it is
quasi-compact, sober (in particular T0), quasi-separated, and its compact open subsets form
a topological basis.
* `PrimeSpectrum.discreteTopology_iff_finite_and_krullDimLE_zero`: the prime spectrum of a
commutative semiring is discrete iff it is finite and the semiring has zero Krull dimension
or is trivial.
* `PrimeSpectrum.localization_comap_range`, `PrimeSpectrum.localization_comap_isEmbedding`:
localization at a submonoid of a commutative semiring induces an embedding between the prime
spectra, with range consisting of prime ideals disjoint from the submonoid.
* `PrimeSpectrum.localization_away_comap_range`: for localization away from an element, the
range of the embedding is the `basicOpen` associated to the element.
* `PrimeSpectrum.comap_isEmbedding_of_surjective`: a surjective ring homomorphism between
commutative semirings induces an embedding between the prime spectra.
* `PrimeSpectrum.isClosedEmbedding_comap_of_surjective`: a surjective ring homomorphism between
commutative rings induces a closed embedding between the prime spectra.
* `PrimeSpectrum.primeSpectrumProdHomeo`: the prime spectrum of a product semiring is homeomorphic
to the disjoint union of the prime spectra.
* `PrimeSpectrum.stableUnderSpecialization_range_iff`: the range of `PrimeSpectrum.comap _` is
closed iff it is stable under specialization.
* `PrimeSpectrum.denseRange_comap_iff_minimalPrimes`,
`PrimeSpectrum.denseRange_comap_iff_ker_le_nilRadical`: the range of `comap f` is dense
iff it contains all minimal primes, iff the kernel of `f` is contained in the nilradical.
* `PrimeSpectrum.isClosedMap_comap_of_isIntegral`: `comap f` is a closed map if `f` is integral.
* `PrimeSpectrum.isIntegral_of_isClosedMap_comap_mapRingHom`: `f : R →+* S` is integral if
`comap (Polynomial.mapRingHom f : R[X] →+* S[X])` is a closed map.
In the prime spectrum of a commutative semiring:
* `PrimeSpectrum.isClosed_iff_zeroLocus_radical_ideal`, `PrimeSpectrum.isRadical_vanishingIdeal`,
`PrimeSpectrum.zeroLocus_eq_iff`, `PrimeSpectrum.vanishingIdeal_anti_mono_iff`:
closed subsets correspond to radical ideals.
* `PrimeSpectrum.isClosed_singleton_iff_isMaximal`: closed points correspond to maximal ideals.
* `PrimeSpectrum.isIrreducible_iff_vanishingIdeal_isPrime`: irreducible closed subsets correspond
to prime ideals.
* `minimalPrimes.equivIrreducibleComponents`: irreducible components correspond to minimal primes.
* `PrimeSpectrum.mulZeroAddOneEquivClopens`: clopen subsets correspond to pairs of elements
that add up to 1 and multiply to 0 in the semiring.
* `PrimeSpectrum.isIdempotentElemEquivClopens`: (if the semiring is a ring) clopen subsets
correspond to idempotents in the ring.
-/
@[expose] public section
open Topology
noncomputable section
universe u v
variable (R : Type u) (S : Type v)
namespace PrimeSpectrum
section CommSemiring
variable [CommSemiring R] [CommSemiring S]
variable {R S}
/-- The Zariski topology on the prime spectrum of a commutative (semi)ring is defined
via the closed sets of the topology: they are exactly those sets that are the zero locus
of a subset of the ring. -/
instance zariskiTopology : TopologicalSpace (PrimeSpectrum R) :=
TopologicalSpace.ofClosed (Set.range PrimeSpectrum.zeroLocus) ⟨Set.univ, by simp⟩
(by
intro Zs h
rw [Set.sInter_eq_iInter]
choose f hf using fun i : Zs => h i.prop
simp only [← hf]
exact ⟨_, zeroLocus_iUnion _⟩)
(by
rintro _ ⟨s, rfl⟩ _ ⟨t, rfl⟩
exact ⟨_, (union_zeroLocus s t).symm⟩)
theorem isOpen_iff (U : Set (PrimeSpectrum R)) : IsOpen U ↔ ∃ s, Uᶜ = zeroLocus s := by
simp only [@eq_comm _ Uᶜ]; rfl
theorem isClosed_iff_zeroLocus (Z : Set (PrimeSpectrum R)) : IsClosed Z ↔ ∃ s, Z = zeroLocus s := by
rw [← isOpen_compl_iff, isOpen_iff, compl_compl]
theorem isClosed_iff_zeroLocus_ideal (Z : Set (PrimeSpectrum R)) :
IsClosed Z ↔ ∃ I : Ideal R, Z = zeroLocus I :=
(isClosed_iff_zeroLocus _).trans
⟨fun ⟨s, hs⟩ => ⟨_, (zeroLocus_span s).substr hs⟩, fun ⟨I, hI⟩ => ⟨I, hI⟩⟩
theorem isClosed_iff_zeroLocus_radical_ideal (Z : Set (PrimeSpectrum R)) :
IsClosed Z ↔ ∃ I : Ideal R, I.IsRadical ∧ Z = zeroLocus I :=
(isClosed_iff_zeroLocus_ideal _).trans
⟨fun ⟨I, hI⟩ => ⟨_, I.radical_isRadical, (zeroLocus_radical I).substr hI⟩, fun ⟨I, _, hI⟩ =>
⟨I, hI⟩⟩
theorem isClosed_zeroLocus (s : Set R) : IsClosed (zeroLocus s) := by
rw [isClosed_iff_zeroLocus]
exact ⟨s, rfl⟩
theorem zeroLocus_vanishingIdeal_eq_closure (t : Set (PrimeSpectrum R)) :
zeroLocus (vanishingIdeal t : Set R) = closure t := by
rcases isClosed_iff_zeroLocus (closure t) |>.mp isClosed_closure with ⟨I, hI⟩
rw [subset_antisymm_iff, (isClosed_zeroLocus _).closure_subset_iff, hI,
subset_zeroLocus_iff_subset_vanishingIdeal, (gc R).u_l_u_eq_u,
← subset_zeroLocus_iff_subset_vanishingIdeal, ← hI]
exact ⟨subset_closure, subset_zeroLocus_vanishingIdeal t⟩
theorem vanishingIdeal_closure (t : Set (PrimeSpectrum R)) :
vanishingIdeal (closure t) = vanishingIdeal t :=
zeroLocus_vanishingIdeal_eq_closure t ▸ (gc R).u_l_u_eq_u t
theorem closure_singleton (x) : closure ({x} : Set (PrimeSpectrum R)) = zeroLocus x.asIdeal := by
rw [← zeroLocus_vanishingIdeal_eq_closure, vanishingIdeal_singleton]
theorem isClosed_singleton_iff_isMaximal (x : PrimeSpectrum R) :
IsClosed ({x} : Set (PrimeSpectrum R)) ↔ x.asIdeal.IsMaximal := by
rw [← closure_subset_iff_isClosed, ← zeroLocus_vanishingIdeal_eq_closure,
vanishingIdeal_singleton]
constructor <;> intro H
· rcases x.asIdeal.exists_le_maximal x.2.1 with ⟨m, hm, hxm⟩
exact (congr_arg asIdeal (@H ⟨m, hm.isPrime⟩ hxm)) ▸ hm
· exact fun p hp ↦ PrimeSpectrum.ext (H.eq_of_le p.2.1 hp).symm
theorem isRadical_vanishingIdeal (s : Set (PrimeSpectrum R)) : (vanishingIdeal s).IsRadical := by
rw [← vanishingIdeal_closure, ← zeroLocus_vanishingIdeal_eq_closure,
vanishingIdeal_zeroLocus_eq_radical]
apply Ideal.radical_isRadical
theorem zeroLocus_eq_iff {I J : Ideal R} :
zeroLocus (I : Set R) = zeroLocus J ↔ I.radical = J.radical := by
constructor
· intro h; simp_rw [← vanishingIdeal_zeroLocus_eq_radical, h]
· intro h; rw [← zeroLocus_radical, h, zeroLocus_radical]
theorem vanishingIdeal_anti_mono_iff {s t : Set (PrimeSpectrum R)} (ht : IsClosed t) :
s ⊆ t ↔ vanishingIdeal t ≤ vanishingIdeal s :=
⟨vanishingIdeal_anti_mono, fun h => by
rw [← ht.closure_subset_iff, ← ht.closure_eq]
convert ← zeroLocus_anti_mono_ideal h <;> apply zeroLocus_vanishingIdeal_eq_closure⟩
theorem vanishingIdeal_strict_anti_mono_iff {s t : Set (PrimeSpectrum R)} (hs : IsClosed s)
(ht : IsClosed t) : s ⊂ t ↔ vanishingIdeal t < vanishingIdeal s := by
rw [Set.ssubset_def, vanishingIdeal_anti_mono_iff hs, vanishingIdeal_anti_mono_iff ht,
lt_iff_le_not_ge]
/-- The antitone order embedding of closed subsets of `Spec R` into ideals of `R`. -/
def closedsEmbedding (R : Type*) [CommSemiring R] :
(TopologicalSpace.Closeds <| PrimeSpectrum R)ᵒᵈ ↪o Ideal R :=
OrderEmbedding.ofMapLEIff (fun s => vanishingIdeal ↑(OrderDual.ofDual s)) fun s _ =>
(vanishingIdeal_anti_mono_iff s.2).symm
theorem t1Space_iff_isField [IsDomain R] : T1Space (PrimeSpectrum R) ↔ IsField R := by
refine ⟨?_, fun h => ?_⟩
· intro h
exact
Classical.not_not.1
(mt
(Ring.ne_bot_of_isMaximal_of_not_isField <|
(isClosed_singleton_iff_isMaximal _).1 (T1Space.t1 ⟨⊥, inferInstance⟩))
(by simp))
· refine ⟨fun x => (isClosed_singleton_iff_isMaximal x).2 ?_⟩
by_cases hx : x.asIdeal = ⊥
· letI := h.toSemifield
exact hx.symm ▸ Ideal.bot_isMaximal
· exact absurd h (Ring.not_isField_iff_exists_prime.2 ⟨x.asIdeal, ⟨hx, x.2⟩⟩)
local notation "Z(" a ")" => zeroLocus (a : Set R)
theorem isIrreducible_zeroLocus_iff_of_radical (I : Ideal R) (hI : I.IsRadical) :
IsIrreducible (zeroLocus (I : Set R)) ↔ I.IsPrime := by
rw [Ideal.isPrime_iff, IsIrreducible]
apply and_congr
· rw [Set.nonempty_iff_ne_empty, Ne, zeroLocus_empty_iff_eq_top]
· trans ∀ x y : Ideal R, Z(I) ⊆ Z(x) ∪ Z(y) → Z(I) ⊆ Z(x) ∨ Z(I) ⊆ Z(y)
· simp_rw [isPreirreducible_iff_isClosed_union_isClosed, isClosed_iff_zeroLocus_ideal]
constructor
· rintro h x y
exact h _ _ ⟨x, rfl⟩ ⟨y, rfl⟩
· rintro h _ _ ⟨x, rfl⟩ ⟨y, rfl⟩
exact h x y
· simp_rw [← zeroLocus_inf, subset_zeroLocus_iff_le_vanishingIdeal,
vanishingIdeal_zeroLocus_eq_radical, hI.radical]
constructor
· simp_rw [← SetLike.mem_coe, ← Set.singleton_subset_iff, ← Ideal.span_le, ←
Ideal.span_singleton_mul_span_singleton]
refine fun h x y h' => h _ _ ?_
rw [← hI.radical_le_iff] at h' ⊢
simpa only [Ideal.radical_inf, Ideal.radical_mul] using h'
· simp_rw [or_iff_not_imp_left, SetLike.not_le_iff_exists]
rintro h s t h' ⟨x, hx, hx'⟩ y hy
exact h (h' ⟨Ideal.mul_mem_right _ _ hx, Ideal.mul_mem_left _ _ hy⟩) hx'
theorem isIrreducible_zeroLocus_iff (I : Ideal R) :
IsIrreducible (zeroLocus (I : Set R)) ↔ I.radical.IsPrime :=
zeroLocus_radical I ▸ isIrreducible_zeroLocus_iff_of_radical _ I.radical_isRadical
theorem isIrreducible_iff_vanishingIdeal_isPrime {s : Set (PrimeSpectrum R)} :
IsIrreducible s ↔ (vanishingIdeal s).IsPrime := by
rw [← isIrreducible_iff_closure, ← zeroLocus_vanishingIdeal_eq_closure,
isIrreducible_zeroLocus_iff_of_radical _ (isRadical_vanishingIdeal s)]
lemma vanishingIdeal_isIrreducible :
vanishingIdeal (R := R) '' {s | IsIrreducible s} = {P | P.IsPrime} :=
Set.ext fun I ↦ ⟨fun ⟨_, hs, e⟩ ↦ e ▸ isIrreducible_iff_vanishingIdeal_isPrime.mp hs,
fun h ↦ ⟨zeroLocus I, (isIrreducible_zeroLocus_iff_of_radical _ h.isRadical).mpr h,
(vanishingIdeal_zeroLocus_eq_radical I).trans h.radical⟩⟩
lemma vanishingIdeal_isClosed_isIrreducible :
vanishingIdeal (R := R) '' {s | IsClosed s ∧ IsIrreducible s} = {P | P.IsPrime} := by
refine (subset_antisymm ?_ ?_).trans vanishingIdeal_isIrreducible
· exact Set.image_mono fun _ ↦ And.right
rintro _ ⟨s, hs, rfl⟩
exact ⟨closure s, ⟨isClosed_closure, hs.closure⟩, vanishingIdeal_closure s⟩
lemma irreducibleSpace_iff_isPrime_nilradical :
IrreducibleSpace (PrimeSpectrum R) ↔ (nilradical R).IsPrime := by
simp [irreducibleSpace_def, isIrreducible_iff_vanishingIdeal_isPrime]
instance irreducibleSpace [IsDomain R] : IrreducibleSpace (PrimeSpectrum R) := by
simpa [irreducibleSpace_iff_isPrime_nilradical] using Ideal.isPrime_bot
instance quasiSober : QuasiSober (PrimeSpectrum R) :=
⟨fun {S} h₁ h₂ =>
⟨⟨_, isIrreducible_iff_vanishingIdeal_isPrime.1 h₁⟩, by
rw [IsGenericPoint, closure_singleton, zeroLocus_vanishingIdeal_eq_closure, h₂.closure_eq]⟩⟩
instance (I : Set R) : QuasiSober (zeroLocus I) :=
(isClosed_zeroLocus I).isClosedEmbedding_subtypeVal.quasiSober
/-- The prime spectrum of a commutative (semi)ring is a compact topological space. -/
instance compactSpace : CompactSpace (PrimeSpectrum R) := by
refine compactSpace_of_finite_subfamily_closed fun S S_closed S_empty ↦ ?_
choose I hI using fun i ↦ (isClosed_iff_zeroLocus_ideal (S i)).mp (S_closed i)
simp_rw [hI, ← zeroLocus_iSup, zeroLocus_empty_iff_eq_top, ← top_le_iff] at S_empty ⊢
exact CompleteLattice.IsCompactElement.exists_finset_of_le_iSup _
Ideal.isCompactElement_top _ S_empty
/-- The prime spectrum of a commutative semiring has discrete Zariski topology iff it is finite and
the semiring has Krull dimension zero or is trivial. -/
theorem discreteTopology_iff_finite_and_krullDimLE_zero : DiscreteTopology (PrimeSpectrum R) ↔
Finite (PrimeSpectrum R) ∧ Ring.KrullDimLE 0 R :=
⟨fun _ ↦ ⟨finite_of_compact_of_discrete, .mk₀ fun I h ↦ isClosed_singleton_iff_isMaximal ⟨I, h⟩
|>.mp <| discreteTopology_iff_forall_isClosed.mp ‹_› _⟩, fun ⟨_, _⟩ ↦
.of_finite_of_isClosed_singleton fun p ↦ (isClosed_singleton_iff_isMaximal p).mpr inferInstance⟩
/-- The prime spectrum of a semiring has discrete Zariski topology iff there are only
finitely many maximal ideals and their intersection is contained in the nilradical. -/
theorem discreteTopology_iff_finite_isMaximal_and_sInf_le_nilradical :
letI s := {I : Ideal R | I.IsMaximal}
DiscreteTopology (PrimeSpectrum R) ↔ Finite s ∧ sInf s ≤ nilradical R := by
rw [discreteTopology_iff_finite_and_krullDimLE_zero, Ring.krullDimLE_zero_iff,
(equivSubtype R).finite_iff, ← Set.coe_setOf, Set.finite_coe_iff, Set.finite_coe_iff]
refine ⟨fun h ↦ ⟨h.1.subset fun _ h ↦ h.isPrime, nilradical_eq_sInf R ▸ sInf_le_sInf h.2⟩,
fun ⟨fin, le⟩ ↦ ?_⟩
have hpm (I : Ideal R) (hI : I.IsPrime) : I.IsMaximal := by
replace le := le.trans (nilradical_le_prime I)
rw [← fin.coe_toFinset, ← Finset.inf_id_eq_sInf, hI.inf_le'] at le
have ⟨M, hM, hMI⟩ := le
rw [fin.mem_toFinset] at hM
rwa [← hM.eq_of_le hI.1 hMI]
exact ⟨fin.subset hpm, hpm⟩
theorem discreteTopology_of_toLocalization_surjective
(surj : Function.Surjective (toPiLocalization R)) :
DiscreteTopology (PrimeSpectrum R) :=
discreteTopology_iff_finite_and_krullDimLE_zero.mpr ⟨finite_of_toPiLocalization_surjective
surj, .mk₀ fun I prime ↦ isMaximal_of_toPiLocalization_surjective surj ⟨I, prime⟩⟩
section Comap
variable {S' : Type*} [CommSemiring S']
@[fun_prop]
lemma continuous_comap (f : R →+* S) : Continuous (comap f) := by
simp only [continuous_iff_isClosed, isClosed_iff_zeroLocus]
rintro _ ⟨s, rfl⟩
exact ⟨_, preimage_comap_zeroLocus_aux f s⟩
@[deprecated "RingHom.specComap and PrimeSpectrum.comap were unified,\
so this lemma is now a no-op." (since := "2025-12-10"), nolint synTaut]
lemma comap_apply (f : R →+* S) (x : PrimeSpectrum S) : comap f x = comap f x := rfl
variable (f : R →+* S)
variable (S)
theorem localization_comap_injective [Algebra R S] (M : Submonoid R) [IsLocalization M S] :
Function.Injective (comap (algebraMap R S)) := by
intro p q h
replace h := _root_.congr_arg (fun x : PrimeSpectrum R => Ideal.map (algebraMap R S) x.asIdeal) h
dsimp only [comap] at h
rw [IsLocalization.map_comap M S, IsLocalization.map_comap M S] at h
ext1
exact h
@[deprecated (since := "2025-12-10")]
alias localization_specComap_injective := localization_comap_injective
theorem localization_comap_range [Algebra R S] (M : Submonoid R) [IsLocalization M S] :
Set.range (comap (algebraMap R S)) = { p | Disjoint (M : Set R) p.asIdeal } := by
refine Set.ext fun x ↦ ⟨?_, fun h ↦ ?_⟩
· rintro ⟨p, rfl⟩
exact ((IsLocalization.isPrime_iff_isPrime_disjoint ..).mp p.2).2
· use ⟨x.asIdeal.map (algebraMap R S), IsLocalization.isPrime_of_isPrime_disjoint M S _ x.2 h⟩
ext1
exact IsLocalization.comap_map_of_isPrime_disjoint M S x.2 h
@[deprecated (since := "2025-12-10")] alias localization_specComap_range := localization_comap_range
theorem localization_comap_isInducing [Algebra R S] (M : Submonoid R) [IsLocalization M S] :
IsInducing (comap (algebraMap R S)) := by
refine ⟨TopologicalSpace.ext_isClosed fun Z ↦ ?_⟩
simp_rw [isClosed_induced_iff, isClosed_iff_zeroLocus, @eq_comm _ _ (zeroLocus _),
exists_exists_eq_and, preimage_comap_zeroLocus]
constructor
· rintro ⟨s, rfl⟩
refine ⟨(Ideal.span s).comap (algebraMap R S), ?_⟩
rw [← zeroLocus_span, ← zeroLocus_span s, ← Ideal.map, IsLocalization.map_comap M S]
· rintro ⟨s, rfl⟩
exact ⟨_, rfl⟩
theorem localization_comap_isEmbedding [Algebra R S] (M : Submonoid R) [IsLocalization M S] :
IsEmbedding (comap (algebraMap R S)) :=
⟨localization_comap_isInducing S M, localization_comap_injective S M⟩
open Function RingHom
theorem comap_isInducing_of_surjective (hf : Surjective f) : IsInducing (comap f) where
eq_induced := by
simp only [TopologicalSpace.ext_iff, ← isClosed_compl_iff, isClosed_iff_zeroLocus,
isClosed_induced_iff]
refine fun s =>
⟨fun ⟨F, hF⟩ =>
⟨zeroLocus (f ⁻¹' F), ⟨f ⁻¹' F, rfl⟩, by
rw [preimage_comap_zeroLocus, Function.Surjective.image_preimage hf, hF]⟩,
?_⟩
rintro ⟨-, ⟨F, rfl⟩, hF⟩
exact ⟨f '' F, hF.symm.trans (preimage_comap_zeroLocus f F)⟩
/-- The embedding has closed range if the domain (and therefore the codomain) is a ring,
see `PrimeSpectrum.isClosedEmbedding_comap_of_surjective`.
On the other hand, `comap (Nat.castRingHom (ZMod 2))` does not have closed range. -/
theorem isEmbedding_comap_of_surjective (hf : Surjective f) : IsEmbedding (comap f) :=
(isEmbedding_iff _).2 ⟨comap_isInducing_of_surjective _ _ hf, comap_injective_of_surjective f hf⟩
end Comap
/-- Homeomorphism between prime spectra induced by an isomorphism of semirings. -/
def homeomorphOfRingEquiv (e : R ≃+* S) : PrimeSpectrum R ≃ₜ PrimeSpectrum S where
toFun := comap (e.symm : S →+* R)
invFun := comap (e : R →+* S)
left_inv _ := (comap_comp_apply ..).symm.trans (by simp)
right_inv _ := (comap_comp_apply ..).symm.trans (by simp)
lemma isHomeomorph_comap_of_bijective {f : R →+* S} (hf : Function.Bijective f) :
IsHomeomorph (comap f) := (homeomorphOfRingEquiv (.ofBijective f hf)).symm.isHomeomorph
end CommSemiring
section SpecOfSurjective
/-! The comap of a surjective ring homomorphism is a closed embedding between the prime spectra. -/
open Function RingHom
variable [CommRing R] [CommRing S]
variable (f : R →+* S)
variable {R}
theorem comap_singleton_isClosed_of_surjective (f : R →+* S) (hf : Function.Surjective f)
(x : PrimeSpectrum S) (hx : IsClosed ({x} : Set (PrimeSpectrum S))) :
IsClosed ({comap f x} : Set (PrimeSpectrum R)) :=
haveI : x.asIdeal.IsMaximal := (isClosed_singleton_iff_isMaximal x).1 hx
(isClosed_singleton_iff_isMaximal _).2 (Ideal.comap_isMaximal_of_surjective f hf)
lemma comap_quotientMk_bijective_of_le_nilradical {I : Ideal R} (hle : I ≤ nilradical R) :
Function.Bijective (comap <| Ideal.Quotient.mk I) := by
refine ⟨comap_injective_of_surjective _ Ideal.Quotient.mk_surjective, ?_⟩
simpa [← Set.range_eq_univ, range_comap_of_surjective _ _ Ideal.Quotient.mk_surjective,
zeroLocus_eq_univ_iff]
theorem isClosed_range_comap_of_surjective (hf : Surjective f) :
IsClosed (Set.range (comap f)) := by
rw [range_comap_of_surjective _ f hf]
exact isClosed_zeroLocus _
lemma isClosedEmbedding_comap_of_surjective (hf : Surjective f) : IsClosedEmbedding (comap f) where
toIsInducing := comap_isInducing_of_surjective S f hf
injective := comap_injective_of_surjective f hf
isClosed_range := isClosed_range_comap_of_surjective S f hf
end SpecOfSurjective
section SpecProd
variable {R S} [CommSemiring R] [CommSemiring S]
lemma primeSpectrumProd_symm_inl (x) :
(primeSpectrumProd R S).symm (.inl x) = comap (RingHom.fst R S) x := by
ext; simp [Ideal.prod]
lemma primeSpectrumProd_symm_inr (x) :
(primeSpectrumProd R S).symm (.inr x) = comap (RingHom.snd R S) x := by
ext; simp [Ideal.prod]
lemma range_comap_fst :
Set.range (comap (RingHom.fst R S)) = zeroLocus (RingHom.ker (RingHom.fst R S)) := by
refine Set.ext fun p ↦ ⟨?_, fun h ↦ ?_⟩
· rintro ⟨I, hI, rfl⟩; exact Ideal.comap_mono bot_le
obtain ⟨p, hp, eq⟩ | ⟨p, hp, eq⟩ := p.1.ideal_prod_prime.mp p.2
· exact ⟨⟨p, hp⟩, PrimeSpectrum.ext <| by simpa [Ideal.prod] using eq.symm⟩
· refine (hp.ne_top <| (Ideal.eq_top_iff_one _).mpr ?_).elim
simpa [eq] using h (show (0, 1) ∈ RingHom.ker (RingHom.fst R S) by simp)
lemma range_comap_snd :
Set.range (comap (RingHom.snd R S)) = zeroLocus (RingHom.ker (RingHom.snd R S)) := by
refine Set.ext fun p ↦ ⟨?_, fun h ↦ ?_⟩
· rintro ⟨I, hI, rfl⟩; exact Ideal.comap_mono bot_le
obtain ⟨p, hp, eq⟩ | ⟨p, hp, eq⟩ := p.1.ideal_prod_prime.mp p.2
· refine (hp.ne_top <| (Ideal.eq_top_iff_one _).mpr ?_).elim
simpa [eq] using h (show (1, 0) ∈ RingHom.ker (RingHom.snd R S) by simp)
· exact ⟨⟨p, hp⟩, PrimeSpectrum.ext <| by simpa [Ideal.prod] using eq.symm⟩
lemma isClosedEmbedding_comap_fst : IsClosedEmbedding (comap (RingHom.fst R S)) :=
(isClosedEmbedding_iff _).mpr ⟨isEmbedding_comap_of_surjective _ _ Prod.fst_surjective, by
simp_rw [range_comap_fst, isClosed_zeroLocus]⟩
lemma isClosedEmbedding_comap_snd : IsClosedEmbedding (comap (RingHom.snd R S)) :=
(isClosedEmbedding_iff _).mpr ⟨isEmbedding_comap_of_surjective _ _ Prod.snd_surjective, by
simp_rw [range_comap_snd, isClosed_zeroLocus]⟩
/-- The prime spectrum of `R × S` is homeomorphic
to the disjoint union of `PrimeSpectrum R` and `PrimeSpectrum S`. -/
noncomputable
def primeSpectrumProdHomeo :
PrimeSpectrum (R × S) ≃ₜ PrimeSpectrum R ⊕ PrimeSpectrum S := by
refine ((primeSpectrumProd R S).symm.toHomeomorphOfIsInducing ?_).symm
refine (IsClosedEmbedding.of_continuous_injective_isClosedMap ?_
(Equiv.injective _) ?_).isInducing
· rw [continuous_sum_dom]
simp only [Function.comp_def, primeSpectrumProd_symm_inl, primeSpectrumProd_symm_inr]
exact ⟨continuous_comap _, continuous_comap _⟩
· simp_rw [isClosedMap_sum, primeSpectrumProd_symm_inl, primeSpectrumProd_symm_inr]
exact ⟨isClosedEmbedding_comap_fst.isClosedMap, isClosedEmbedding_comap_snd.isClosedMap⟩
end SpecProd
section CommSemiring
variable [CommSemiring R] [CommSemiring S]
variable {R S}
section BasicOpen
/-- `basicOpen r` is the open subset containing all prime ideals not containing `r`. -/
def basicOpen (r : R) : TopologicalSpace.Opens (PrimeSpectrum R) where
carrier := { x | r ∉ x.asIdeal }
is_open' := ⟨{r}, Set.ext fun _ => Set.singleton_subset_iff.trans <| Classical.not_not.symm⟩
@[simp]
theorem mem_basicOpen (f : R) (x : PrimeSpectrum R) : x ∈ basicOpen f ↔ f ∉ x.asIdeal :=
Iff.rfl
theorem isOpen_basicOpen {a : R} : IsOpen (basicOpen a : Set (PrimeSpectrum R)) :=
(basicOpen a).isOpen
@[simp]
theorem basicOpen_eq_zeroLocus_compl (r : R) :
(basicOpen r : Set (PrimeSpectrum R)) = (zeroLocus {r})ᶜ :=
Set.ext fun x => by simp only [SetLike.mem_coe, mem_basicOpen, Set.mem_compl_iff, mem_zeroLocus,
Set.singleton_subset_iff]
@[simp]
theorem basicOpen_one : basicOpen (1 : R) = ⊤ :=
TopologicalSpace.Opens.ext <| by simp
@[simp]
theorem basicOpen_zero : basicOpen (0 : R) = ⊥ :=
TopologicalSpace.Opens.ext <| by simp
theorem basicOpen_le_basicOpen_iff (f g : R) :
basicOpen f ≤ basicOpen g ↔ f ∈ (Ideal.span ({g} : Set R)).radical := by
rw [← SetLike.coe_subset_coe, basicOpen_eq_zeroLocus_compl, basicOpen_eq_zeroLocus_compl,
Set.compl_subset_compl, zeroLocus_subset_zeroLocus_singleton_iff]
theorem basicOpen_le_basicOpen_iff_algebraMap_isUnit {f g : R} [Algebra R S]
[IsLocalization.Away f S] : basicOpen f ≤ basicOpen g ↔ IsUnit (algebraMap R S g) := by
simp_rw [basicOpen_le_basicOpen_iff, Ideal.mem_radical_iff, Ideal.mem_span_singleton,
IsLocalization.Away.algebraMap_isUnit_iff f]
theorem basicOpen_mul (f g : R) : basicOpen (f * g) = basicOpen f ⊓ basicOpen g :=
TopologicalSpace.Opens.ext <| by simp [zeroLocus_singleton_mul]
theorem basicOpen_mul_le_left (f g : R) : basicOpen (f * g) ≤ basicOpen f := by
rw [basicOpen_mul f g]
exact inf_le_left
theorem basicOpen_mul_le_right (f g : R) : basicOpen (f * g) ≤ basicOpen g := by
rw [basicOpen_mul f g]
exact inf_le_right
@[simp]
theorem basicOpen_pow (f : R) (n : ℕ) (hn : 0 < n) : basicOpen (f ^ n) = basicOpen f :=
TopologicalSpace.Opens.ext <| by simpa using zeroLocus_singleton_pow f n hn
lemma le_basicOpen_pow (r : R) (n : ℕ) : basicOpen r ≤ basicOpen (r ^ n) := by
cases n <;> simp
theorem isTopologicalBasis_basic_opens :
TopologicalSpace.IsTopologicalBasis
(Set.range fun r : R => (basicOpen r : Set (PrimeSpectrum R))) := by
apply TopologicalSpace.isTopologicalBasis_of_isOpen_of_nhds
· rintro _ ⟨r, rfl⟩
exact isOpen_basicOpen
· rintro p U hp ⟨s, hs⟩
rw [← compl_compl U, Set.mem_compl_iff, ← hs, mem_zeroLocus, Set.not_subset] at hp
obtain ⟨f, hfs, hfp⟩ := hp
refine ⟨basicOpen f, ⟨f, rfl⟩, hfp, ?_⟩
rw [← Set.compl_subset_compl, ← hs, basicOpen_eq_zeroLocus_compl, compl_compl]
exact zeroLocus_anti_mono (Set.singleton_subset_iff.mpr hfs)
theorem eq_biUnion_of_isOpen {s : Set (PrimeSpectrum R)} (hs : IsOpen s) :
s = ⋃ (r : R) (_ : ↑(basicOpen r) ⊆ s), basicOpen r :=
(isTopologicalBasis_basic_opens.open_eq_sUnion' hs).trans <| by aesop
theorem isBasis_basic_opens : TopologicalSpace.Opens.IsBasis (Set.range (@basicOpen R _)) := by
unfold TopologicalSpace.Opens.IsBasis
convert isTopologicalBasis_basic_opens (R := R)
rw [← Set.range_comp]
rfl
@[simp]
theorem basicOpen_eq_bot_iff (f : R) : basicOpen f = ⊥ ↔ IsNilpotent f := by
rw [← TopologicalSpace.Opens.coe_inj, basicOpen_eq_zeroLocus_compl]
simp only [Set.eq_univ_iff_forall, Set.singleton_subset_iff, TopologicalSpace.Opens.coe_bot,
nilpotent_iff_mem_prime, Set.compl_empty_iff, mem_zeroLocus, SetLike.mem_coe]
exact ⟨fun h I hI => h ⟨I, hI⟩, fun h ⟨I, hI⟩ => h I hI⟩
theorem localization_away_comap_range (S : Type v) [CommSemiring S] [Algebra R S] (r : R)
[IsLocalization.Away r S] : Set.range (comap (algebraMap R S)) = basicOpen r := by
rw [localization_comap_range S (Submonoid.powers r)]
ext x
simp only [mem_zeroLocus, basicOpen_eq_zeroLocus_compl, SetLike.mem_coe, Set.mem_setOf_eq,
Set.singleton_subset_iff, Set.mem_compl_iff, disjoint_iff_inf_le]
constructor
· intro h₁ h₂
exact h₁ ⟨Submonoid.mem_powers r, h₂⟩
· rintro h₁ _ ⟨⟨n, rfl⟩, h₃⟩
exact h₁ (x.2.mem_of_pow_mem _ h₃)
theorem localization_away_isOpenEmbedding (S : Type v) [CommSemiring S] [Algebra R S] (r : R)
[IsLocalization.Away r S] : IsOpenEmbedding (comap (algebraMap R S)) where
toIsEmbedding := localization_comap_isEmbedding S (Submonoid.powers r)
isOpen_range := by
rw [localization_away_comap_range S r]
exact isOpen_basicOpen
theorem isCompact_basicOpen (f : R) : IsCompact (basicOpen f : Set (PrimeSpectrum R)) := by
rw [← localization_away_comap_range (Localization (Submonoid.powers f))]
exact isCompact_range (continuous_comap _)
lemma comap_basicOpen (f : R →+* S) (x : R) :
TopologicalSpace.Opens.comap ⟨comap f, continuous_comap f⟩ (basicOpen x) = basicOpen (f x) :=
rfl
open TopologicalSpace in
lemma iSup_basicOpen_eq_top_iff {ι : Type*} {f : ι → R} :
(⨆ i : ι, PrimeSpectrum.basicOpen (f i)) = ⊤ ↔ Ideal.span (Set.range f) = ⊤ := by
rw [SetLike.ext'_iff, Opens.coe_iSup]
simp only [PrimeSpectrum.basicOpen_eq_zeroLocus_compl, Opens.coe_top, ← Set.compl_iInter,
← PrimeSpectrum.zeroLocus_iUnion]
rw [← PrimeSpectrum.zeroLocus_empty_iff_eq_top, compl_involutive.eq_iff]
simp only [Set.iUnion_singleton_eq_range, Set.compl_univ, PrimeSpectrum.zeroLocus_span]
lemma iSup_basicOpen_eq_top_iff' {s : Set R} :
(⨆ i ∈ s, PrimeSpectrum.basicOpen i) = ⊤ ↔ Ideal.span s = ⊤ := by
conv_rhs => rw [← Subtype.range_val (s := s), ← iSup_basicOpen_eq_top_iff]
simp
theorem isLocalization_away_iff_atPrime_of_basicOpen_eq_singleton [Algebra R S]
{f : R} {p : PrimeSpectrum R} (h : (basicOpen f).1 = {p}) :
IsLocalization.Away f S ↔ IsLocalization.AtPrime S p.1 :=
have : IsLocalization.AtPrime (Localization.Away f) p.1 := by
refine .of_le_of_exists_dvd (.powers f) _
(Submonoid.powers_le.mpr <| by apply h ▸ Set.mem_singleton p) fun r hr ↦ ?_
contrapose! hr
simp_rw [← Ideal.mem_span_singleton] at hr
have ⟨q, prime, le, disj⟩ := Ideal.exists_le_prime_disjoint (Ideal.span {r})
(.powers f) (Set.disjoint_right.mpr hr)
have : ⟨q, prime⟩ ∈ (basicOpen f).1 := Set.disjoint_right.mp disj (Submonoid.mem_powers f)
rw [h, Set.mem_singleton_iff] at this
rw [← this]
exact not_not.mpr (q.span_singleton_le_iff_mem.mp le)
IsLocalization.isLocalization_iff_of_isLocalization _ _ (Localization.Away f)
open Localization Polynomial Set in
lemma range_comap_algebraMap_localization_compl_eq_range_comap_quotientMk
{R : Type*} [CommRing R] (c : R) :
letI := (mapRingHom (algebraMap R (Away c))).toAlgebra
(range (comap (algebraMap R[X] (Away c)[X])))ᶜ
= range (comap (mapRingHom (Ideal.Quotient.mk (.span {c})))) := by
letI := (mapRingHom (algebraMap R (Away c))).toAlgebra
have := Polynomial.isLocalization (.powers c) (Away c)
rw [Submonoid.map_powers] at this
have surj : Function.Surjective (mapRingHom (Ideal.Quotient.mk (.span {c}))) :=
Polynomial.map_surjective _ Ideal.Quotient.mk_surjective
rw [range_comap_of_surjective _ _ surj, localization_away_comap_range _ (C c)]
simp [Polynomial.ker_mapRingHom, Ideal.map_span]
instance : QuasiSeparatedSpace (PrimeSpectrum R) :=
.of_isTopologicalBasis isTopologicalBasis_basic_opens fun i j ↦ by
simpa [← TopologicalSpace.Opens.coe_inf, ← basicOpen_mul, -basicOpen_eq_zeroLocus_compl]
using isCompact_basicOpen _
end BasicOpen
section Pi
variable {ι : Type*} {R : ι → Type*} [∀ i, CommRing (R i)]
lemma comap_evalRingHom_basicOpen [DecidableEq ι] (i : ι) (f : R i) :
comap (Pi.evalRingHom R i) '' basicOpen f = basicOpen (Pi.single i f) := by
ext p
refine ⟨?_, ?_⟩
· rintro ⟨p, hp, rfl⟩
simpa
· intro hp
have : p ∈ Set.range (PrimeSpectrum.comap (Pi.evalRingHom R i)) := by
rw [range_comap_of_surjective _ _ (RingHom.surjective _), mem_zeroLocus,
SetLike.coe_subset_coe]
intro x hx
rw [RingHom.mem_ker, Pi.evalRingHom_apply] at hx
have : Pi.single i f * x = 0 := by
ext j
by_cases h : i = j
· subst h
simp [hx]
· simp [h]
obtain (h | h) := Ideal.IsPrime.mem_or_mem_of_mul_eq_zero p.isPrime this <;> tauto
obtain ⟨q, rfl⟩ := this
exact ⟨q, by simpa using hp, by ext; simp⟩
lemma sigmaToPi_mk_basicOpen [DecidableEq ι] (i : ι) (f : R i) :
sigmaToPi R '' (Sigma.mk i '' basicOpen f) = basicOpen (Pi.single i f) := by
simp only [Set.image_image, sigmaToPi_apply]
exact PrimeSpectrum.comap_evalRingHom_basicOpen _ _
variable (R) in
lemma isOpenEmbedding_sigmaToPi : Topology.IsOpenEmbedding (sigmaToPi R) := by
classical
refine .of_continuous_injective_isOpenMap ?_ ?_ ?_
· rw [continuous_sigma_iff]
intro i
exact continuous_comap (Pi.evalRingHom R i)
· exact sigmaToPi_injective R
· rw [isOpenMap_sigma]
intro i
simp only [sigmaToPi_apply, PrimeSpectrum.isTopologicalBasis_basic_opens.isOpenMap_iff]
rintro - ⟨f, rfl⟩
rw [PrimeSpectrum.comap_evalRingHom_basicOpen]
exact isOpen_basicOpen
/-- If `ι` is finite, the disjoint union of the prime spectra of the `R i` is homeomorphic
to the prime spectrum of the product. -/
noncomputable def sigmaHomeoPi {ι : Type*} (R : ι → Type*) [∀ i, CommRing (R i)] [Finite ι] :
(Σ i, PrimeSpectrum (R i)) ≃ₜ PrimeSpectrum (Π i, R i) :=
(isOpenEmbedding_sigmaToPi R).toHomeomorphOfSurjective (sigmaToPi_bijective R).surjective
@[simp]
lemma sigmaHomeoPi_apply [Finite ι] (p : Σ i, PrimeSpectrum (R i)) :
sigmaHomeoPi R p = sigmaToPi R p :=
rfl
end Pi
section DiscreteTopology
variable (R) [DiscreteTopology (PrimeSpectrum R)]
theorem toPiLocalization_surjective_of_discreteTopology :
Function.Surjective (toPiLocalization R) := fun x ↦ by
have (p : PrimeSpectrum R) : ∃ f, (basicOpen f : Set _) = {p} :=
have ⟨_, ⟨f, rfl⟩, hpf, hfp⟩ := isTopologicalBasis_basic_opens.isOpen_iff.mp
(isOpen_discrete {p}) p rfl
⟨f, hfp.antisymm <| Set.singleton_subset_iff.mpr hpf⟩
choose f hf using this
let e := Equiv.ofInjective f fun p q eq ↦ Set.singleton_injective (hf p ▸ eq ▸ hf q)
have loc a : IsLocalization.AtPrime (Localization.Away a.1) (e.symm a).1 :=
(isLocalization_away_iff_atPrime_of_basicOpen_eq_singleton <| hf _).mp <| by
simp_rw [e, Equiv.apply_ofInjective_symm]; infer_instance
let algE a := IsLocalization.algEquiv (e.symm a).1.primeCompl
(Localization.AtPrime (e.symm a).1) (Localization.Away a.1)
have span_eq : Ideal.span (Set.range f) = ⊤ := iSup_basicOpen_eq_top_iff.mp <| top_unique
fun p _ ↦ TopologicalSpace.Opens.mem_iSup.mpr ⟨p, (hf p).ge rfl⟩
replace hf a : (basicOpen a.1 : Set _) = {e.symm a} := by
simp_rw [e, ← hf, Equiv.apply_ofInjective_symm]
obtain ⟨r, eq, -⟩ := Localization.existsUnique_algebraMap_eq_of_span_eq_top _ span_eq
(fun a ↦ algE a (x _)) fun a b ↦ by
obtain rfl | ne := eq_or_ne a b; · rfl
have nil : IsNilpotent (a * b : R) := (basicOpen_eq_bot_iff _).mp <| by
simp_rw [basicOpen_mul, SetLike.ext'_iff, TopologicalSpace.Opens.coe_inf, hf]
exact bot_unique (fun _ ⟨ha, hb⟩ ↦ ne <| e.symm.injective (ha.symm.trans hb))
apply (IsLocalization.subsingleton (M := .powers (a * b : R)) nil).elim
refine ⟨r, funext fun I ↦ ?_⟩
have := eq (e I)
rwa [← AlgEquiv.symm_apply_eq, AlgEquiv.commutes, e.symm_apply_apply] at this
theorem maximalSpectrumToPiLocalization_surjective_of_discreteTopology :
Function.Surjective (MaximalSpectrum.toPiLocalization R) := by
rw [← piLocalizationToMaximal_comp_toPiLocalization]
exact (piLocalizationToMaximal_surjective R).comp
(toPiLocalization_surjective_of_discreteTopology R)
/-- If the prime spectrum of a commutative semiring R has discrete Zariski topology, then R is
canonically isomorphic to the product of its localizations at the (finitely many) maximal ideals. -/
@[stacks 00JA
"See also `PrimeSpectrum.discreteTopology_iff_finite_isMaximal_and_sInf_le_nilradical`."]
def _root_.MaximalSpectrum.toPiLocalizationEquiv :
R ≃+* MaximalSpectrum.PiLocalization R :=
.ofBijective _ ⟨MaximalSpectrum.toPiLocalization_injective R,
maximalSpectrumToPiLocalization_surjective_of_discreteTopology R⟩
theorem discreteTopology_iff_toPiLocalization_surjective {R} [CommSemiring R] :
DiscreteTopology (PrimeSpectrum R) ↔ Function.Surjective (toPiLocalization R) :=
⟨fun _ ↦ toPiLocalization_surjective_of_discreteTopology _,
discreteTopology_of_toLocalization_surjective⟩
theorem discreteTopology_iff_toPiLocalization_bijective {R} [CommSemiring R] :
DiscreteTopology (PrimeSpectrum R) ↔ Function.Bijective (toPiLocalization R) :=
discreteTopology_iff_toPiLocalization_surjective.trans
(and_iff_right <| toPiLocalization_injective _).symm
lemma toPiLocalization_bijective {R : Type*} [CommRing R]
[DiscreteTopology (PrimeSpectrum R)] : Function.Bijective (toPiLocalization R) :=
discreteTopology_iff_toPiLocalization_bijective.mp inferInstance
end DiscreteTopology
section Order
/-!
## The specialization order
We endow `PrimeSpectrum R` with a partial order, where `x ≤ y` if and only if `y ∈ closure {x}`.
-/
theorem le_iff_mem_closure (x y : PrimeSpectrum R) :
x ≤ y ↔ y ∈ closure ({x} : Set (PrimeSpectrum R)) := by
rw [← asIdeal_le_asIdeal, ← zeroLocus_vanishingIdeal_eq_closure, mem_zeroLocus,
vanishingIdeal_singleton, SetLike.coe_subset_coe]
theorem le_iff_specializes (x y : PrimeSpectrum R) : x ≤ y ↔ x ⤳ y :=
(le_iff_mem_closure x y).trans specializes_iff_mem_closure.symm
/-- `nhds` as an order embedding. -/
@[simps!]
def nhdsOrderEmbedding : PrimeSpectrum R ↪o Filter (PrimeSpectrum R) :=
OrderEmbedding.ofMapLEIff nhds fun a b => (le_iff_specializes a b).symm
instance : T0Space (PrimeSpectrum R) :=
⟨nhdsOrderEmbedding.inj'⟩
instance : PrespectralSpace (PrimeSpectrum R) :=
.of_isTopologicalBasis' isTopologicalBasis_basic_opens isCompact_basicOpen
instance : SpectralSpace (PrimeSpectrum R) where
end Order
/-- If `x` specializes to `y`, then there is a natural map from the localization of `y` to the
localization of `x`. -/
def localizationMapOfSpecializes {x y : PrimeSpectrum R} (h : x ⤳ y) :
Localization.AtPrime y.asIdeal →+* Localization.AtPrime x.asIdeal :=
@IsLocalization.lift _ _ _ _ _ _ _ _ Localization.isLocalization
(algebraMap R (Localization.AtPrime x.asIdeal))
(by
rintro ⟨a, ha⟩
rw [← PrimeSpectrum.le_iff_specializes, ← asIdeal_le_asIdeal, ← SetLike.coe_subset_coe, ←
Set.compl_subset_compl] at h
exact (IsLocalization.map_units (Localization.AtPrime x.asIdeal)
⟨a, show a ∈ x.asIdeal.primeCompl from h ha⟩ :))
section stableUnderSpecialization
variable {R S : Type*} [CommSemiring R] [CommSemiring S] (f : R →+* S)
lemma isClosed_image_of_stableUnderSpecialization
(Z : Set (PrimeSpectrum S)) (hZ : IsClosed Z)
(hf : StableUnderSpecialization (comap f '' Z)) :
IsClosed (comap f '' Z) := by
obtain ⟨I, rfl⟩ := (PrimeSpectrum.isClosed_iff_zeroLocus_ideal Z).mp hZ
refine (isClosed_iff_zeroLocus _).mpr ⟨I.comap f, le_antisymm ?_ fun p hp ↦ ?_⟩
· rintro _ ⟨q, hq, rfl⟩
exact Ideal.comap_mono hq
· obtain ⟨q, hqI, hq, hqle⟩ := p.asIdeal.exists_ideal_comap_le_prime I hp
exact hf ((le_iff_specializes ⟨q.comap f, inferInstance⟩ p).mp hqle) ⟨⟨q, hq⟩, hqI, rfl⟩
@[stacks 00HY]
lemma isClosed_range_of_stableUnderSpecialization
(hf : StableUnderSpecialization (Set.range (comap f))) :
IsClosed (Set.range (comap f)) := by
rw [← Set.image_univ] at hf ⊢
exact isClosed_image_of_stableUnderSpecialization _ _ isClosed_univ hf
variable {f} in
@[stacks 00HY]
lemma stableUnderSpecialization_range_iff :
StableUnderSpecialization (Set.range (comap f)) ↔ IsClosed (Set.range (comap f)) :=
⟨isClosed_range_of_stableUnderSpecialization f, fun h ↦ h.stableUnderSpecialization⟩
lemma stableUnderSpecialization_image_iff
(Z : Set (PrimeSpectrum S)) (hZ : IsClosed Z) :
StableUnderSpecialization (comap f '' Z) ↔ IsClosed (comap f '' Z) :=
⟨isClosed_image_of_stableUnderSpecialization f Z hZ, fun h ↦ h.stableUnderSpecialization⟩
end stableUnderSpecialization
section IsQuotientMap
variable {R S : Type*} [CommSemiring R] [CommSemiring S] {f : R →+* S}
(h₁ : Function.Surjective (comap f))
include h₁
/-- If `f : Spec S → Spec R` is specializing and surjective, the topology on `Spec R` is the
quotient topology induced by `f`. -/
lemma isQuotientMap_of_specializingMap (h₂ : SpecializingMap (comap f)) :
Topology.IsQuotientMap (comap f) := by
rw [Topology.isQuotientMap_iff_isClosed]
exact ⟨h₁, fun s ↦ ⟨fun hs ↦ hs.preimage (continuous_comap f),
fun hsc ↦ Set.image_preimage_eq s h₁ ▸ isClosed_image_of_stableUnderSpecialization _ _ hsc
(h₂.stableUnderSpecialization_image hsc.stableUnderSpecialization)⟩⟩
/-- If `f : Spec S → Spec R` is generalizing and surjective, the topology on `Spec R` is the
quotient topology induced by `f`. -/
lemma isQuotientMap_of_generalizingMap (h₂ : GeneralizingMap (comap f)) :
Topology.IsQuotientMap (comap f) := by
rw [Topology.isQuotientMap_iff_isClosed]
refine ⟨h₁, fun s ↦ ⟨fun hs ↦ hs.preimage (continuous_comap f),
fun hsc ↦ Set.image_preimage_eq s h₁ ▸ ?_⟩⟩
apply isClosed_image_of_stableUnderSpecialization _ _ hsc
rw [Set.image_preimage_eq s h₁, ← stableUnderGeneralization_compl_iff]
convert h₂.stableUnderGeneralization_image hsc.isOpen_compl.stableUnderGeneralization
rw [← Set.preimage_compl, Set.image_preimage_eq _ h₁]
end IsQuotientMap
section denseRange
variable {R S : Type*} [CommSemiring R] [CommSemiring S] (f : R →+* S)
lemma vanishingIdeal_range_comap :
vanishingIdeal (Set.range (comap f)) = (RingHom.ker f).radical := by
ext x
rw [RingHom.ker_eq_comap_bot, ← Ideal.comap_radical, Ideal.radical_eq_sInf]
simp only [mem_vanishingIdeal, Set.mem_range, forall_exists_index, forall_apply_eq_imp_iff,
comap_asIdeal, Ideal.mem_comap, bot_le, true_and, Submodule.mem_sInf, Set.mem_setOf_eq]
exact ⟨fun H I hI ↦ H ⟨I, hI⟩, fun H I ↦ H I.1 I.2⟩
lemma closure_range_comap :
closure (Set.range (comap f)) = zeroLocus (RingHom.ker f) := by
rw [← zeroLocus_vanishingIdeal_eq_closure, vanishingIdeal_range_comap, zeroLocus_radical]
lemma denseRange_comap_iff_ker_le_nilRadical :
DenseRange (comap f) ↔ RingHom.ker f ≤ nilradical R := by
rw [denseRange_iff_closure_range, closure_range_comap, zeroLocus_eq_univ_iff,
SetLike.coe_subset_coe]
@[stacks 00FL]
lemma denseRange_comap_iff_minimalPrimes :
DenseRange (comap f) ↔ ∀ I (h : I ∈ minimalPrimes R), ⟨I, h.1.1⟩ ∈ Set.range (comap f) := by
constructor
· intro H I hI
have : I ∈ (RingHom.ker f).minimalPrimes := by
rw [denseRange_comap_iff_ker_le_nilRadical] at H
simp only [minimalPrimes, Ideal.minimalPrimes, Set.mem_setOf] at hI ⊢
convert hI using 2 with p
exact ⟨fun h ↦ ⟨h.1, bot_le⟩, fun h ↦ ⟨h.1, H.trans (h.1.radical_le_iff.mpr bot_le)⟩⟩
obtain ⟨p, hp, _, rfl⟩ := Ideal.exists_comap_eq_of_mem_minimalPrimes f (I := ⊥) I this
exact ⟨⟨p, hp⟩, rfl⟩
· intro H p
obtain ⟨q, hq, hq'⟩ := Ideal.exists_minimalPrimes_le (J := p.asIdeal) bot_le
exact ((le_iff_specializes ⟨q, hq.1.1⟩ p).mp hq').mem_closed isClosed_closure
(subset_closure (H q hq))
end denseRange
variable (R) in
/--
Zero loci of prime ideals are closed irreducible sets in the Zariski topology and any closed
irreducible set is a zero locus of some prime ideal.
-/
protected def pointsEquivIrreducibleCloseds :
PrimeSpectrum R ≃o (TopologicalSpace.IrreducibleCloseds (PrimeSpectrum R))ᵒᵈ where
__ := irreducibleSetEquivPoints.toEquiv.symm.trans OrderDual.toDual
map_rel_iff' {p q} :=
(RelIso.symm irreducibleSetEquivPoints).map_rel_iff.trans (le_iff_specializes p q).symm
/--
Zero loci of prime ideals are closed irreducible sets in the Zariski topology and any closed
irreducible set is a zero locus of some prime ideal.
-/
protected def zeroLocusEquivIrreducibleCloseds (I : Set R) :
zeroLocus I ≃o (TopologicalSpace.IrreducibleCloseds (zeroLocus I))ᵒᵈ where
__ := irreducibleSetEquivPoints.toEquiv.symm.trans OrderDual.toDual
map_rel_iff' {p q} := (RelIso.symm irreducibleSetEquivPoints).map_rel_iff.trans
((subtype_specializes_iff p q).trans (le_iff_specializes p.1 q.1).symm)
lemma stableUnderSpecialization_singleton {x : PrimeSpectrum R} :
StableUnderSpecialization {x} ↔ x.asIdeal.IsMaximal := by
simp_rw [← isMax_iff, StableUnderSpecialization, ← le_iff_specializes, Set.mem_singleton_iff,
@forall_comm _ (_ = _), forall_eq]
exact ⟨fun H a h ↦ (H a h).le, fun H a h ↦ le_antisymm (H h) h⟩
lemma stableUnderGeneralization_singleton {x : PrimeSpectrum R} :
StableUnderGeneralization {x} ↔ x.asIdeal ∈ minimalPrimes R := by
simp_rw [← isMin_iff, StableUnderGeneralization, ← le_iff_specializes, Set.mem_singleton_iff,
@forall_comm _ (_ = _), forall_eq]
exact ⟨fun H a h ↦ (H a h).ge, fun H a h ↦ le_antisymm h (H h)⟩
lemma isCompact_isOpen_iff {s : Set (PrimeSpectrum R)} :
IsCompact s ∧ IsOpen s ↔ ∃ t : Finset R, (zeroLocus t)ᶜ = s := by
rw [isCompact_open_iff_eq_finite_iUnion_of_isTopologicalBasis _
isTopologicalBasis_basic_opens isCompact_basicOpen]
simp only [basicOpen_eq_zeroLocus_compl, ← Set.compl_iInter₂, ← zeroLocus_iUnion₂,
Set.biUnion_of_singleton]
exact ⟨fun ⟨s, hs, e⟩ ↦ ⟨hs.toFinset, by simpa using e.symm⟩,
fun ⟨s, e⟩ ↦ ⟨s, s.finite_toSet, by simpa using e.symm⟩⟩
lemma isCompact_isOpen_iff_ideal {s : Set (PrimeSpectrum R)} :
IsCompact s ∧ IsOpen s ↔ ∃ I : Ideal R, I.FG ∧ (zeroLocus I)ᶜ = s := by
rw [isCompact_isOpen_iff]
exact ⟨fun ⟨s, e⟩ ↦ ⟨.span s, ⟨s, rfl⟩, by simpa using e⟩,
fun ⟨I, ⟨s, hs⟩, e⟩ ↦ ⟨s, by simpa [hs.symm] using e⟩⟩
lemma basicOpen_eq_zeroLocus_of_mul_add (e f : R) (mul : e * f = 0) (add : e + f = 1) :
basicOpen e = zeroLocus {f} := by
ext p
suffices e ∉ p.asIdeal ↔ f ∈ p.asIdeal by simpa