-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Expand file tree
/
Copy pathAffineSpace.lean
More file actions
463 lines (385 loc) · 19 KB
/
Copy pathAffineSpace.lean
File metadata and controls
463 lines (385 loc) · 19 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
/-
Copyright (c) 2024 Andrew Yang. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Andrew Yang
-/
module
public import Mathlib.AlgebraicGeometry.Morphisms.Finite
public import Mathlib.AlgebraicGeometry.Morphisms.Smooth
/-!
# Affine space
## Main definitions
- `AlgebraicGeometry.AffineSpace`: `𝔸(n; S)` is the affine `n`-space over `S`.
- `AlgebraicGeometry.AffineSpace.coord`: The standard coordinate functions on the affine space.
- `AlgebraicGeometry.AffineSpace.homOfVector`:
The morphism `X ⟶ 𝔸(n; S)` given by a `X ⟶ S` and a choice of `n`-coordinate functions.
- `AlgebraicGeometry.AffineSpace.homOverEquiv`:
`S`-morphisms into `Spec 𝔸(n; S)` are equivalent to the choice of `n` global sections.
- `AlgebraicGeometry.AffineSpace.SpecIso`: `𝔸(n; Spec R) ≅ Spec R[n]`
-/
@[expose] public section
open CategoryTheory Limits MvPolynomial
noncomputable section
namespace AlgebraicGeometry
universe v u
variable (n : Type v) (S : Scheme.{max u v})
local notation3 "ℤ[" n "]" => CommRingCat.of (MvPolynomial n (ULift ℤ))
local notation3 "ℤ[" n "].{" u ", " v "}" => CommRingCat.of (MvPolynomial n (ULift.{max u v} ℤ))
/-- `𝔸(n; S)` is the affine `n`-space over `S`.
Note that `n` is an arbitrary index type (e.g. `Fin m`). -/
def AffineSpace (n : Type v) (S : Scheme.{max u v}) : Scheme.{max u v} :=
pullback (terminal.from S) (terminal.from (Spec ℤ[n].{u, v}))
namespace AffineSpace
/-- `𝔸(n; S)` is the affine `n`-space over `S`. -/
scoped[AlgebraicGeometry] notation "𝔸(" n "; " S ")" => AffineSpace n S
variable {n} in
lemma of_mvPolynomial_int_ext {R} {f g : ℤ[n] ⟶ R} (h : ∀ i, f (.X i) = g (.X i)) : f = g := by
suffices f.hom.comp (MvPolynomial.mapEquiv _ ULift.ringEquiv.symm).toRingHom =
g.hom.comp (MvPolynomial.mapEquiv _ ULift.ringEquiv.symm).toRingHom by
ext x
· obtain ⟨x⟩ := x
simpa [-map_intCast, -eq_intCast] using! DFunLike.congr_fun this (C x)
· simpa [-map_intCast, -eq_intCast] using! DFunLike.congr_fun this (X x)
ext1
· exact RingHom.ext_int _ _
· simpa using! h _
@[simps -isSimp]
instance over : 𝔸(n; S).CanonicallyOver S where
hom := pullback.fst _ _
/-- The map from the affine `n`-space over `S` to the integral model `Spec ℤ[n]`. -/
def toSpecMvPoly : 𝔸(n; S) ⟶ Spec ℤ[n].{u, v} := pullback.snd _ _
variable {X : Scheme.{max u v}}
set_option backward.defeqAttrib.useBackward true in
/--
Morphisms into `Spec ℤ[n]` are equivalent the choice of `n` global sections.
Use `homOverEquiv` instead.
-/
@[simps]
def toSpecMvPolyIntEquiv : (X ⟶ Spec ℤ[n]) ≃ (n → Γ(X, ⊤)) where
toFun f i := f.appTop ((Scheme.ΓSpecIso ℤ[n]).inv (.X i))
invFun v := X.toSpecΓ ≫ Spec.map
(CommRingCat.ofHom (MvPolynomial.eval₂Hom ((algebraMap ℤ _).comp ULift.ringEquiv.toRingHom) v))
left_inv f := by
apply (ΓSpec.adjunction.homEquiv _ _).symm.injective
apply Quiver.Hom.unop_inj
rw [Adjunction.homEquiv_symm_apply, Adjunction.homEquiv_symm_apply]
dsimp
simp only [Scheme.toSpecΓ_appTop, Scheme.ΓSpecIso_naturality, Iso.inv_hom_id_assoc]
apply of_mvPolynomial_int_ext
intro i
rw [ConcreteCategory.hom_ofHom, coe_eval₂Hom, eval₂_X]
rfl
right_inv v := by ext; simp
lemma toSpecMvPolyIntEquiv_comp {X Y : Scheme} (f : X ⟶ Y) (g : Y ⟶ Spec ℤ[n]) (i) :
toSpecMvPolyIntEquiv n (f ≫ g) i = f.appTop (toSpecMvPolyIntEquiv n g i) := rfl
variable {n} in
/-- The standard coordinates of `𝔸(n; S)`. -/
def coord (i : n) : Γ(𝔸(n; S), ⊤) := toSpecMvPolyIntEquiv _ (toSpecMvPoly n S) i
section homOfVector
variable {n S}
/-- The morphism `X ⟶ 𝔸(n; S)` given by a `X ⟶ S` and a choice of `n`-coordinate functions. -/
def homOfVector (f : X ⟶ S) (v : n → Γ(X, ⊤)) : X ⟶ 𝔸(n; S) :=
pullback.lift f ((toSpecMvPolyIntEquiv n).symm v) (by simp)
variable (f : X ⟶ S) (v : n → Γ(X, ⊤))
@[reassoc (attr := simp)]
lemma homOfVector_over : homOfVector f v ≫ 𝔸(n; S) ↘ S = f :=
pullback.lift_fst _ _ _
@[reassoc]
lemma homOfVector_toSpecMvPoly :
homOfVector f v ≫ toSpecMvPoly n S = (toSpecMvPolyIntEquiv n).symm v :=
pullback.lift_snd _ _ _
@[simp]
lemma homOfVector_appTop_coord (i) :
(homOfVector f v).appTop (coord S i) = v i := by
rw [coord, ← toSpecMvPolyIntEquiv_comp, homOfVector_toSpecMvPoly,
Equiv.apply_symm_apply]
@[ext 1100]
lemma hom_ext {f g : X ⟶ 𝔸(n; S)}
(h₁ : f ≫ 𝔸(n; S) ↘ S = g ≫ 𝔸(n; S) ↘ S)
(h₂ : ∀ i, f.appTop (coord S i) = g.appTop (coord S i)) : f = g := by
apply pullback.hom_ext h₁
change f ≫ toSpecMvPoly _ _ = g ≫ toSpecMvPoly _ _
apply (toSpecMvPolyIntEquiv n).injective
ext i
rw [toSpecMvPolyIntEquiv_comp, toSpecMvPolyIntEquiv_comp]
exact h₂ i
@[reassoc]
lemma comp_homOfVector {X Y : Scheme} (v : n → Γ(Y, ⊤)) (f : X ⟶ Y) (g : Y ⟶ S) :
f ≫ homOfVector g v = homOfVector (f ≫ g) (f.appTop ∘ v) := by
ext1 <;> simp
end homOfVector
variable [X.Over S]
variable {n}
instance (v : n → Γ(X, ⊤)) : (homOfVector (X ↘ S) v).IsOver S where
/-- `S`-morphisms into `Spec 𝔸(n; S)` are equivalent to the choice of `n` global sections. -/
@[simps]
def homOverEquiv : { f : X ⟶ 𝔸(n; S) // f.IsOver S } ≃ (n → Γ(X, ⊤)) where
toFun f i := f.1.appTop (coord S i)
invFun v := ⟨homOfVector (X ↘ S) v, inferInstance⟩
left_inv f := by
ext : 2
· simp [f.2.1]
· rw [homOfVector_appTop_coord]
right_inv v := by ext i; simp [-TopologicalSpace.Opens.map_top, homOfVector_appTop_coord]
variable (n) in
/--
The affine space over an affine base is isomorphic to the spectrum of the polynomial ring.
Also see `AffineSpace.SpecIso`.
-/
@[simps -isSimp hom inv]
def isoOfIsAffine [IsAffine S] :
𝔸(n; S) ≅ Spec <| .of <| MvPolynomial n Γ(S, ⊤) where
hom := 𝔸(n; S).toSpecΓ ≫ Spec.map (CommRingCat.ofHom
(eval₂Hom ((𝔸(n; S) ↘ S).appTop).hom (coord S)))
inv := homOfVector (Spec.map (CommRingCat.ofHom C) ≫ S.isoSpec.inv)
((Scheme.ΓSpecIso (.of (MvPolynomial n Γ(S, ⊤)))).inv ∘ MvPolynomial.X)
hom_inv_id := by
ext1
· simp only [Category.assoc, homOfVector_over, Category.id_comp]
rw [← Spec.map_comp_assoc, ← CommRingCat.ofHom_comp, eval₂Hom_comp_C,
CommRingCat.ofHom_hom, ← Scheme.toSpecΓ_naturality_assoc]
simp [Scheme.isoSpec]
· simp
inv_hom_id := by
apply ext_of_isAffine
simp only [Scheme.Hom.comp_base, TopologicalSpace.Opens.map_comp_obj,
TopologicalSpace.Opens.map_top, Scheme.Hom.comp_app, Scheme.toSpecΓ_appTop,
Scheme.ΓSpecIso_naturality, Category.assoc, Scheme.Hom.id_app, ← Iso.eq_inv_comp,
Category.comp_id]
ext : 1
apply ringHom_ext'
· change _ = (CommRingCat.ofHom C ≫ _).hom
rw [CommRingCat.hom_comp, RingHom.comp_assoc, CommRingCat.hom_ofHom, eval₂Hom_comp_C,
← CommRingCat.hom_comp, ← CommRingCat.hom_ext_iff,
← cancel_mono (Scheme.ΓSpecIso _).hom]
rw [← Scheme.Hom.comp_appTop, homOfVector_over, Scheme.Hom.comp_appTop]
simp only [Category.assoc, Scheme.ΓSpecIso_naturality, CommRingCat.of_carrier,
← Scheme.toSpecΓ_appTop]
rw [← Scheme.Hom.comp_appTop_assoc, Scheme.isoSpec, asIso_inv, IsIso.hom_inv_id]
simp
· intro i
rw [CommRingCat.comp_apply, ConcreteCategory.hom_ofHom, coe_eval₂Hom]
simp only [eval₂_X]
exact homOfVector_appTop_coord _ _ _
@[simp]
lemma isoOfIsAffine_hom_appTop [IsAffine S] :
(isoOfIsAffine n S).hom.appTop =
(Scheme.ΓSpecIso _).hom ≫ CommRingCat.ofHom
(eval₂Hom ((𝔸(n; S) ↘ S).appTop).hom (coord S)) := by
simp [isoOfIsAffine_hom]
@[simp]
lemma isoOfIsAffine_inv_appTop_coord [IsAffine S] (i) :
(isoOfIsAffine n S).inv.appTop (coord _ i) = (Scheme.ΓSpecIso (.of _)).inv (.X i) :=
homOfVector_appTop_coord _ _ _
@[reassoc (attr := simp)]
lemma isoOfIsAffine_inv_over [IsAffine S] :
(isoOfIsAffine n S).inv ≫ 𝔸(n; S) ↘ S = Spec.map (CommRingCat.ofHom C) ≫ S.isoSpec.inv :=
pullback.lift_fst _ _ _
instance [IsAffine S] : IsAffine 𝔸(n; S) := .of_isIso (isoOfIsAffine n S).hom
variable (n) in
/-- The affine space over an affine base is isomorphic to the spectrum of the polynomial ring. -/
def SpecIso (R : CommRingCat.{max u v}) :
𝔸(n; Spec R) ≅ Spec <| .of <| MvPolynomial n R :=
isoOfIsAffine _ _ ≪≫ Scheme.Spec.mapIso (MvPolynomial.mapEquiv _
(Scheme.ΓSpecIso R).symm.commRingCatIsoToRingEquiv).toCommRingCatIso.op
@[simp]
lemma SpecIso_hom_appTop (R : CommRingCat.{max u v}) :
(SpecIso n R).hom.appTop = (Scheme.ΓSpecIso _).hom ≫
CommRingCat.ofHom (eval₂Hom ((Scheme.ΓSpecIso _).inv ≫
(𝔸(n; Spec R) ↘ Spec R).appTop).hom (coord (Spec R))) := by
ext i
simp [SpecIso]
@[simp]
lemma SpecIso_inv_appTop_coord (R : CommRingCat.{max u v}) (i) :
(SpecIso n R).inv.appTop (coord _ i) = (Scheme.ΓSpecIso (.of _)).inv (.X i) := by
simp only [SpecIso, Iso.trans_inv, Functor.mapIso_inv, Iso.op_inv, Scheme.Spec_map,
Quiver.Hom.unop_op, TopologicalSpace.Opens.map_top, Scheme.Hom.comp_app, CommRingCat.comp_apply]
rw [isoOfIsAffine_inv_appTop_coord, ← CommRingCat.comp_apply, ← Scheme.ΓSpecIso_inv_naturality,
CommRingCat.comp_apply]
congr 1
exact map_X _ _
@[reassoc (attr := simp)]
lemma SpecIso_inv_over (R : CommRingCat.{max u v}) :
(SpecIso n R).inv ≫ 𝔸(n; Spec R) ↘ Spec R = Spec.map (CommRingCat.ofHom C) := by
simp only [SpecIso, Iso.trans_inv, Functor.mapIso_inv, Iso.op_inv, Scheme.Spec_map,
Quiver.Hom.unop_op, Category.assoc, isoOfIsAffine_inv_over, Scheme.isoSpec_Spec_inv,
← Spec.map_comp]
congr 1
rw [Iso.inv_comp_eq]
ext : 2
exact map_C _ _
section functorial
variable (n) in
/-- `𝔸(n; S)` is functorial w.r.t. `S`. -/
def map {S T : Scheme.{max u v}} (f : S ⟶ T) : 𝔸(n; S) ⟶ 𝔸(n; T) :=
homOfVector (𝔸(n; S) ↘ S ≫ f) (coord S)
@[reassoc (attr := simp)]
lemma map_over {S T : Scheme.{max u v}} (f : S ⟶ T) : map n f ≫ 𝔸(n; T) ↘ T = 𝔸(n; S) ↘ S ≫ f :=
pullback.lift_fst _ _ _
@[simp]
lemma map_appTop_coord {S T : Scheme.{max u v}} (f : S ⟶ T) (i) :
(map n f).appTop (coord T i) = coord S i :=
homOfVector_appTop_coord _ _ _
@[reassoc (attr := simp)]
lemma map_toSpecMvPoly {S T : Scheme.{max u v}} (f : S ⟶ T) :
map n f ≫ toSpecMvPoly n T = toSpecMvPoly n S := by
apply (toSpecMvPolyIntEquiv _).injective
ext i
rw [toSpecMvPolyIntEquiv_comp, ← coord, map_appTop_coord, coord]
@[simp]
lemma map_id : map n (𝟙 S) = 𝟙 𝔸(n; S) := by
ext1 <;> simp
@[reassoc, simp]
lemma map_comp {S S' S'' : Scheme} (f : S ⟶ S') (g : S' ⟶ S'') :
map n (f ≫ g) = map n f ≫ map n g := by
ext1
· simp
· simp
lemma map_SpecMap {R S : CommRingCat.{max u v}} (φ : R ⟶ S) :
map n (Spec.map φ) =
(SpecIso n S).hom ≫ Spec.map (CommRingCat.ofHom (MvPolynomial.map φ.hom)) ≫
(SpecIso n R).inv := by
rw [← Iso.inv_comp_eq]
ext1
· simp only [map_over, Category.assoc, SpecIso_inv_over, SpecIso_inv_over_assoc,
← Spec.map_comp, ← CommRingCat.ofHom_comp]
rw [map_comp_C, CommRingCat.ofHom_comp, CommRingCat.ofHom_hom]
· simp only [TopologicalSpace.Opens.map_top, Scheme.Hom.comp_app, CommRingCat.comp_apply]
conv_lhs => enter [2]; tactic => exact map_appTop_coord _ _
conv_rhs => enter [2]; tactic => exact SpecIso_inv_appTop_coord _ _
rw [SpecIso_inv_appTop_coord, ← CommRingCat.comp_apply, ← Scheme.ΓSpecIso_inv_naturality,
CommRingCat.comp_apply, ConcreteCategory.hom_ofHom, map_X]
set_option backward.defeqAttrib.useBackward true in
/-- The map between affine spaces over affine bases is
isomorphic to the natural map between polynomial rings. -/
def mapSpecMap {R S : CommRingCat.{max u v}} (φ : R ⟶ S) :
Arrow.mk (map n (Spec.map φ)) ≅
Arrow.mk (Spec.map (CommRingCat.ofHom (MvPolynomial.map (σ := n) φ.hom))) :=
Arrow.isoMk (SpecIso n S) (SpecIso n R) (by have := (SpecIso n R).inv_hom_id; simp [map_SpecMap])
set_option backward.isDefEq.respectTransparency false in
lemma isPullback_map {S T : Scheme.{max u v}} (f : S ⟶ T) :
IsPullback (map n f) (𝔸(n; S) ↘ S) (𝔸(n; T) ↘ T) f := by
refine (IsPullback.paste_horiz_iff (.flip <| .of_hasPullback _ _) (map_over f)).mp ?_
simp only [terminal.comp_from, ]
convert! (IsPullback.of_hasPullback _ _).flip
rw [← toSpecMvPoly, ← toSpecMvPoly, map_toSpecMvPoly]
/-- `𝔸(n; S)` is functorial w.r.t. `n`. -/
def reindex {n m : Type v} (i : m → n) (S : Scheme.{max u v}) : 𝔸(n; S) ⟶ 𝔸(m; S) :=
homOfVector (𝔸(n; S) ↘ S) (coord S ∘ i)
@[simp, reassoc]
lemma reindex_over {n m : Type v} (i : m → n) (S : Scheme.{max u v}) :
reindex i S ≫ 𝔸(m; S) ↘ S = 𝔸(n; S) ↘ S :=
pullback.lift_fst _ _ _
@[simp]
lemma reindex_appTop_coord {n m : Type v} (i : m → n) (S : Scheme.{max u v}) (j : m) :
(reindex i S).appTop (coord S j) = coord S (i j) :=
homOfVector_appTop_coord _ _ _
@[simp]
lemma reindex_id : reindex id S = 𝟙 𝔸(n; S) := by
ext1 <;> simp
@[simp, reassoc]
lemma reindex_comp {n₁ n₂ n₃ : Type v} (i : n₁ ⟶ n₂) (j : n₂ ⟶ n₃) (S : Scheme.{max u v}) :
reindex (i ≫ j) S = reindex j S ≫ reindex i S := by
ext k <;> simp
@[reassoc (attr := simp)]
lemma map_reindex {n₁ n₂ : Type v} (i : n₁ → n₂) {S T : Scheme.{max u v}} (f : S ⟶ T) :
map n₂ f ≫ reindex i T = reindex i S ≫ map n₁ f := by
apply hom_ext <;> simp
/-- The affine space as a functor. -/
@[simps]
def functor : (Type v)ᵒᵖ ⥤ Scheme.{max u v} ⥤ Scheme.{max u v} where
obj n := { obj := AffineSpace n.unop, map := map n.unop, map_id := map_id, map_comp := map_comp }
map {n m} i := { app := reindex i.unop, naturality := fun _ _ ↦ map_reindex i.unop }
map_id n := by ext : 2; exact reindex_id _
map_comp f g := by ext : 2; dsimp; exact reindex_comp _ _ _
end functorial
section instances
instance : IsAffineHom (𝔸(n; S) ↘ S) := MorphismProperty.pullback_fst _ _ inferInstance
instance : Surjective (𝔸(n; S) ↘ S) := MorphismProperty.pullback_fst _ _ <| by
have := isIso_of_isTerminal specULiftZIsTerminal terminalIsTerminal (terminal.from _)
rw [← terminal.comp_from (Spec.map (CommRingCat.ofHom C)),
MorphismProperty.cancel_right_of_respectsIso (P := @Surjective)]
exact ⟨MvPolynomial.comap_C_surjective⟩
variable (n) in
/-- The affine `n`-space over `S` is smooth of relative dimension `Nat.card n`. -/
instance smoothOfRelativeDimension [Finite n] :
SmoothOfRelativeDimension (Nat.card n) (𝔸(n; S) ↘ S) :=
MorphismProperty.pullback_fst _ _ <| by
have := isIso_of_isTerminal specULiftZIsTerminal.{max u v} terminalIsTerminal (terminal.from _)
rw [← terminal.comp_from (Spec.map (CommRingCat.ofHom C)),
MorphismProperty.cancel_right_of_respectsIso (P := @SmoothOfRelativeDimension _),
HasRingHomProperty.Spec_iff (P := @SmoothOfRelativeDimension _)]
apply RingHom.locally_of RingHom.isStandardSmoothOfRelativeDimension_respectsIso
simp_rw [ConcreteCategory.hom_ofHom, ← MvPolynomial.algebraMap_eq,
RingHom.isStandardSmoothOfRelativeDimension_algebraMap]
exact Algebra.IsStandardSmoothOfRelativeDimension.mvPolynomial _ _
/-- The affine `n`-space (indexed by `Fin n`) over `S` is smooth of relative dimension `n`. -/
instance smoothOfRelativeDimension_fin {S : Scheme.{u}} (n : ℕ) :
SmoothOfRelativeDimension n (𝔸(Fin n; S) ↘ S) := by
simpa using smoothOfRelativeDimension (Fin n) S
instance [Finite n] : Smooth (𝔸(n; S) ↘ S) := (smoothOfRelativeDimension n S).smooth
lemma isOpenMap_over : IsOpenMap (𝔸(n; S) ↘ S) := by
change topologically @IsOpenMap _
wlog hS : ∃ R, S = Spec R
· refine (IsZariskiLocalAtTarget.iff_of_openCover
(P := topologically @IsOpenMap) S.affineCover).mpr ?_
intro i
have := this (n := n) (S.affineCover.X i) ⟨_, rfl⟩
rwa [← (isPullback_map (n := n) (S.affineCover.f i)).isoPullback_hom_snd,
MorphismProperty.cancel_left_of_respectsIso (P := topologically @IsOpenMap)] at this
obtain ⟨R, rfl⟩ := hS
rw [← MorphismProperty.cancel_left_of_respectsIso (P := topologically @IsOpenMap)
(SpecIso n R).inv, SpecIso_inv_over]
exact MvPolynomial.isOpenMap_comap_C
open MorphismProperty in
instance [IsEmpty n] : IsIso (𝔸(n; S) ↘ S) := pullback_fst
(P := isomorphisms _) _ _ <| by
rw [← terminal.comp_from (Spec.map (CommRingCat.ofHom C))]
apply IsStableUnderComposition.comp_mem
· rw [HasAffineProperty.iff_of_isAffine (P := isomorphisms _), ← isomorphisms,
← arrow_mk_iso_iff (isomorphisms _) (arrowIsoΓSpecOfIsAffine _)]
exact ⟨inferInstance, (ConcreteCategory.isIso_iff_bijective _).mpr
⟨C_injective n _, C_surjective _⟩⟩
· exact isIso_of_isTerminal specULiftZIsTerminal terminalIsTerminal (terminal.from _)
lemma isIntegralHom_over_iff_isEmpty : IsIntegralHom (𝔸(n; S) ↘ S) ↔ IsEmpty S ∨ IsEmpty n := by
constructor
· intro h
cases isEmpty_or_nonempty S
· exact .inl ‹_›
refine .inr ?_
wlog hS : ∃ R, S = Spec R
· obtain ⟨x⟩ := ‹Nonempty S›
obtain ⟨y, hy⟩ := S.affineCover.covers x
exact this (S.affineCover.X _) (MorphismProperty.IsStableUnderBaseChange.of_isPullback
(isPullback_map (S.affineCover.f _)) h) ⟨y⟩ ⟨_, rfl⟩
obtain ⟨R, rfl⟩ := hS
have : Nontrivial R := (subsingleton_or_nontrivial R).resolve_left fun H ↦
not_isEmpty_of_nonempty (Spec R) (inferInstanceAs (IsEmpty (PrimeSpectrum R)))
constructor
intro i
have := RingHom.toMorphismProperty_respectsIso_iff.mp RingHom.isIntegral_respectsIso.{max u v}
rw [← MorphismProperty.cancel_left_of_respectsIso @IsIntegralHom (SpecIso n R).inv,
SpecIso_inv_over, HasAffineProperty.iff_of_isAffine (P := @IsIntegralHom)] at h
obtain ⟨p : Polynomial R, hp, hp'⟩ :=
(MorphismProperty.arrow_mk_iso_iff (RingHom.toMorphismProperty RingHom.IsIntegral)
(arrowIsoΓSpecOfIsAffine _)).mpr h.2 (X i)
have : (rename fun _ ↦ i).comp (uniqueAlgEquiv.{_, v} _ PUnit).symm.toAlgHom p = 0 := by
simp [← hp', ← algebraMap_eq]
rw [AlgHom.comp_apply, map_eq_zero_iff _ (rename_injective _ (fun _ _ _ ↦ rfl))] at this
simp only [AlgEquiv.coe_algHom, EmbeddingLike.map_eq_zero_iff] at this
simp [this] at hp
· rintro (_ | _) <;> infer_instance
lemma not_isIntegralHom [Nonempty S] [Nonempty n] : ¬ IsIntegralHom (𝔸(n; S) ↘ S) := by
simp [isIntegralHom_over_iff_isEmpty]
lemma spec_le_iff (R : CommRingCat) (p q : Spec R) : p ≤ q ↔ q.asIdeal ≤ p.asIdeal := by
aesop (add simp PrimeSpectrum.le_iff_specializes)
/--
One should bear this equality in mind when breaking the `Spec R/ PrimeSpectrum R` abstraction
boundary, since these instances are not definitionally equal.
-/
example (R : CommRingCat) :
inferInstance (α := Preorder (Spec R)) = inferInstance (α := Preorder (PrimeSpectrum R)ᵒᵈ) := by
aesop (add simp spec_le_iff)
end instances
end AffineSpace
end AlgebraicGeometry