-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Expand file tree
/
Copy pathRationalMap.lean
More file actions
670 lines (566 loc) · 30.2 KB
/
Copy pathRationalMap.lean
File metadata and controls
670 lines (566 loc) · 30.2 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
/-
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.SpreadingOut
public import Mathlib.AlgebraicGeometry.FunctionField
public import Mathlib.AlgebraicGeometry.Morphisms.Separated
/-!
# Rational maps between schemes
## Main definitions
* `AlgebraicGeometry.Scheme.PartialMap`: A partial map from `X` to `Y` (`X.PartialMap Y`) is
a morphism into `Y` defined on a dense open subscheme of `X`.
* `AlgebraicGeometry.Scheme.PartialMap.equiv`:
Two partial maps are equivalent if they are equal on a dense open subscheme.
* `AlgebraicGeometry.Scheme.RationalMap`:
A rational map from `X` to `Y` (`X ⤏ Y`) is an equivalence class of partial maps.
* `AlgebraicGeometry.Scheme.RationalMap.equivFunctionFieldOver`:
Given `S`-schemes `X` and `Y` such that `Y` is locally of finite type and `X` is integral,
`S`-morphisms `Spec K(X) ⟶ Y` correspond bijectively to `S`-rational maps from `X` to `Y`.
* `AlgebraicGeometry.Scheme.RationalMap.toPartialMap`:
If `X` is reduced and `Y` is separated, then any `f : X ⤏ Y` can be realized as a partial
map on `f.domain`, the domain of definition of `f`.
-/
@[expose] public section
universe u
open CategoryTheory hiding Quotient
namespace AlgebraicGeometry
variable {X Y Z S : Scheme.{u}} (sX : X ⟶ S) (sY : Y ⟶ S)
namespace Scheme
/--
A partial map from `X` to `Y` (`X.PartialMap Y`) is a morphism into `Y`
defined on a dense open subscheme of `X`.
-/
structure PartialMap (X Y : Scheme.{u}) where
/-- The domain of definition of a partial map. -/
domain : X.Opens
dense_domain : Dense (domain : Set X)
/-- The underlying morphism of a partial map. -/
hom : ↑domain ⟶ Y
variable (S) in
/-- A partial map is an `S`-map if the underlying morphism is. -/
abbrev PartialMap.IsOver [X.Over S] [Y.Over S] (f : X.PartialMap Y) :=
f.hom.IsOver S
namespace PartialMap
lemma ext_iff (f g : X.PartialMap Y) :
f = g ↔ ∃ e : f.domain = g.domain, f.hom = (X.isoOfEq e).hom ≫ g.hom := by
constructor
· rintro rfl
simp
· obtain ⟨U, hU, f⟩ := f
obtain ⟨V, hV, g⟩ := g
rintro ⟨rfl : U = V, e⟩
congr 1
simpa using e
@[ext]
lemma ext (f g : X.PartialMap Y) (e : f.domain = g.domain)
(H : f.hom = (X.isoOfEq e).hom ≫ g.hom) : f = g := by
rw [ext_iff]
exact ⟨e, H⟩
/-- The restriction of a partial map to a smaller domain. -/
@[simps hom domain]
noncomputable
def restrict (f : X.PartialMap Y) (U : X.Opens)
(hU : Dense (U : Set X)) (hU' : U ≤ f.domain) : X.PartialMap Y where
domain := U
dense_domain := hU
hom := X.homOfLE hU' ≫ f.hom
set_option backward.defeqAttrib.useBackward true in
@[simp]
lemma restrict_id (f : X.PartialMap Y) : f.restrict f.domain f.dense_domain le_rfl = f := by
ext1 <;> simp [restrict_domain]
set_option backward.isDefEq.respectTransparency.types false in
lemma restrict_id_hom (f : X.PartialMap Y) :
(f.restrict f.domain f.dense_domain le_rfl).hom = f.hom := by
simp
set_option backward.isDefEq.respectTransparency.types false in
set_option backward.defeqAttrib.useBackward true in
@[simp]
lemma restrict_restrict (f : X.PartialMap Y)
(U : X.Opens) (hU : Dense (U : Set X)) (hU' : U ≤ f.domain)
(V : X.Opens) (hV : Dense (V : Set X)) (hV' : V ≤ U) :
(f.restrict U hU hU').restrict V hV hV' = f.restrict V hV (hV'.trans hU') := by
ext1 <;> simp [restrict_domain]
set_option backward.isDefEq.respectTransparency.types false in
set_option backward.defeqAttrib.useBackward true in
lemma restrict_restrict_hom (f : X.PartialMap Y)
(U : X.Opens) (hU : Dense (U : Set X)) (hU' : U ≤ f.domain)
(V : X.Opens) (hV : Dense (V : Set X)) (hV' : V ≤ U) :
((f.restrict U hU hU').restrict V hV hV').hom = (f.restrict V hV (hV'.trans hU')).hom := by
simp
set_option backward.defeqAttrib.useBackward true in
instance [X.Over S] [Y.Over S] (f : X.PartialMap Y) [f.IsOver S]
(U : X.Opens) (hU : Dense (U : Set X)) (hU' : U ≤ f.domain) :
(f.restrict U hU hU').IsOver S where
/-- The composition of a partial map and a morphism on the right. -/
@[simps]
def compHom (f : X.PartialMap Y) (g : Y ⟶ Z) : X.PartialMap Z where
domain := f.domain
dense_domain := f.dense_domain
hom := f.hom ≫ g
set_option backward.defeqAttrib.useBackward true in
@[simp]
lemma compHom_id (f : X.PartialMap Y) : f.compHom (𝟙 Y) = f := by
ext <;> simp
set_option backward.defeqAttrib.useBackward true in
instance [X.Over S] [Y.Over S] [Z.Over S] (f : X.PartialMap Y) (g : Y ⟶ Z)
[f.IsOver S] [g.IsOver S] : (f.compHom g).IsOver S where
/-- A scheme morphism as a partial map. -/
@[simps]
def _root_.AlgebraicGeometry.Scheme.Hom.toPartialMap (f : X ⟶ Y) :
X.PartialMap Y := ⟨⊤, dense_univ, X.topIso.hom ≫ f⟩
set_option backward.defeqAttrib.useBackward true in
instance (f : X ⟶ Y) [IsDominant f] : IsDominant f.toPartialMap.hom := by
dsimp
have := Opens.isDominant_ι (X := X) (U := ⊤) dense_univ
infer_instance
lemma _root_.AlgebraicGeometry.Scheme.Hom.toPartialMap_compHom (f : X ⟶ Y) (g : Y ⟶ Z) :
f.toPartialMap.compHom g = (f ≫ g).toPartialMap := rfl
variable (X) in
/-- The identity partial map. -/
protected abbrev id : X.PartialMap X := (𝟙 X : X ⟶ X).toPartialMap
lemma id_domain : (PartialMap.id X).domain = ⊤ := rfl
lemma id_hom : (PartialMap.id X).hom = X.topIso.hom := by
rw [Hom.toPartialMap_hom, Category.comp_id]
set_option backward.isDefEq.respectTransparency false in
@[simp]
lemma id_compHom (f : X ⟶ Y) : (PartialMap.id X).compHom f = f.toPartialMap := by
apply PartialMap.ext _ _ rfl
simp
set_option backward.defeqAttrib.useBackward true in
instance [X.Over S] [Y.Over S] (f : X ⟶ Y) [f.IsOver S] : f.toPartialMap.IsOver S where
set_option backward.defeqAttrib.useBackward true in
lemma isOver_iff [X.Over S] [Y.Over S] {f : X.PartialMap Y} :
f.IsOver S ↔ (f.compHom (Y ↘ S)).hom = f.domain.ι ≫ X ↘ S := by
simp
set_option backward.isDefEq.respectTransparency.types false in
set_option backward.defeqAttrib.useBackward true in
lemma isOver_iff_eq_restrict [X.Over S] [Y.Over S] {f : X.PartialMap Y} :
f.IsOver S ↔ f.compHom (Y ↘ S) = (X ↘ S).toPartialMap.restrict _ f.dense_domain (by simp) := by
simp [PartialMap.ext_iff]
/-- If `x` is in the domain of a partial map `f`, then `f` restricts to a map from `Spec 𝒪_x`. -/
noncomputable
def fromSpecStalkOfMem (f : X.PartialMap Y) {x} (hx : x ∈ f.domain) :
Spec (X.presheaf.stalk x) ⟶ Y :=
f.domain.fromSpecStalkOfMem x hx ≫ f.hom
/-- A partial map restricts to a map from `Spec K(X)`. -/
noncomputable
abbrev fromFunctionField [IrreducibleSpace X] (f : X.PartialMap Y) :
Spec X.functionField ⟶ Y :=
f.fromSpecStalkOfMem
((genericPoint_specializes _).mem_open f.domain.2 f.dense_domain.nonempty.choose_spec)
set_option backward.isDefEq.respectTransparency false in
lemma fromSpecStalkOfMem_restrict (f : X.PartialMap Y)
{U : X.Opens} (hU : Dense (U : Set X)) (hU' : U ≤ f.domain) {x} (hx : x ∈ U) :
(f.restrict U hU hU').fromSpecStalkOfMem hx = f.fromSpecStalkOfMem (hU' hx) := by
dsimp only [fromSpecStalkOfMem, restrict, Scheme.Opens.fromSpecStalkOfMem]
have e : ⟨x, hU' hx⟩ = X.homOfLE hU' ⟨x, hx⟩ := by
rw [Scheme.homOfLE_base]
rfl
rw [Category.assoc, ← SpecMap_stalkMap_fromSpecStalk_assoc,
← SpecMap_stalkSpecializes_fromSpecStalk (Inseparable.of_eq e).specializes,
← TopCat.Presheaf.stalkCongr_inv _ (Inseparable.of_eq e)]
simp only [← Category.assoc, ← Spec.map_comp]
congr 3
rw [Iso.eq_inv_comp, ← Category.assoc, IsIso.comp_inv_eq, IsIso.eq_inv_comp,
Hom.stalkMap_congr_hom _ _ (X.homOfLE_ι hU').symm]
simp only [TopCat.Presheaf.stalkCongr_hom]
rw [← Hom.stalkSpecializes_stalkMap_assoc, Hom.stalkMap_comp]
lemma fromFunctionField_restrict (f : X.PartialMap Y) [IrreducibleSpace X]
{U : X.Opens} (hU : Dense (U : Set X)) (hU' : U ≤ f.domain) :
(f.restrict U hU hU').fromFunctionField = f.fromFunctionField :=
fromSpecStalkOfMem_restrict f _ _ _
/--
Given `S`-schemes `X` and `Y` such that `Y` is locally of finite type and
`X` is irreducible germ-injective at `x` (e.g. when `X` is integral),
any `S`-morphism `Spec 𝒪ₓ ⟶ Y` spreads out to a partial map from `X` to `Y`.
-/
noncomputable
def ofFromSpecStalk [IrreducibleSpace X] [LocallyOfFiniteType sY] {x : X} [X.IsGermInjectiveAt x]
(φ : Spec (X.presheaf.stalk x) ⟶ Y) (h : φ ≫ sY = X.fromSpecStalk x ≫ sX) : X.PartialMap Y where
hom := (spread_out_of_isGermInjective' sX sY φ h).choose_spec.choose_spec.choose
domain := (spread_out_of_isGermInjective' sX sY φ h).choose
dense_domain := (spread_out_of_isGermInjective' sX sY φ h).choose.2.dense
⟨_, (spread_out_of_isGermInjective' sX sY φ h).choose_spec.choose⟩
lemma ofFromSpecStalk_comp [IrreducibleSpace X] [LocallyOfFiniteType sY]
{x : X} [X.IsGermInjectiveAt x] (φ : Spec (X.presheaf.stalk x) ⟶ Y)
(h : φ ≫ sY = X.fromSpecStalk x ≫ sX) :
(ofFromSpecStalk sX sY φ h).hom ≫ sY = (ofFromSpecStalk sX sY φ h).domain.ι ≫ sX :=
(spread_out_of_isGermInjective' sX sY φ h).choose_spec.choose_spec.choose_spec.2
lemma mem_domain_ofFromSpecStalk [IrreducibleSpace X] [LocallyOfFiniteType sY]
{x : X} [X.IsGermInjectiveAt x] (φ : Spec (X.presheaf.stalk x) ⟶ Y)
(h : φ ≫ sY = X.fromSpecStalk x ≫ sX) : x ∈ (ofFromSpecStalk sX sY φ h).domain :=
(spread_out_of_isGermInjective' sX sY φ h).choose_spec.choose
lemma fromSpecStalkOfMem_ofFromSpecStalk [IrreducibleSpace X] [LocallyOfFiniteType sY]
{x : X} [X.IsGermInjectiveAt x] (φ : Spec (X.presheaf.stalk x) ⟶ Y)
(h : φ ≫ sY = X.fromSpecStalk x ≫ sX) :
(ofFromSpecStalk sX sY φ h).fromSpecStalkOfMem (mem_domain_ofFromSpecStalk sX sY φ h) = φ :=
(spread_out_of_isGermInjective' sX sY φ h).choose_spec.choose_spec.choose_spec.1.symm
set_option backward.defeqAttrib.useBackward true in
@[simp]
lemma fromSpecStalkOfMem_compHom (f : X.PartialMap Y) (g : Y ⟶ Z) (x) (hx) :
(f.compHom g).fromSpecStalkOfMem (x := x) hx = f.fromSpecStalkOfMem hx ≫ g := by
simp [fromSpecStalkOfMem]
set_option backward.isDefEq.respectTransparency.types false in
set_option backward.defeqAttrib.useBackward true in
@[simp]
lemma fromSpecStalkOfMem_toPartialMap (f : X ⟶ Y) (x) :
f.toPartialMap.fromSpecStalkOfMem (x := x) trivial = X.fromSpecStalk x ≫ f := by
simp [fromSpecStalkOfMem]
/-- Two partial maps are equivalent if they are equal on a dense open subscheme. -/
protected noncomputable
def equiv (f g : X.PartialMap Y) : Prop :=
∃ (W : X.Opens) (hW : Dense (W : Set X)) (hWl : W ≤ f.domain) (hWr : W ≤ g.domain),
(f.restrict W hW hWl).hom = (g.restrict W hW hWr).hom
lemma equiv_of_restrict_eq (f g : X.PartialMap Y) {W₁ W₂ : X.Opens} {hW₁ : Dense (W₁ : Set X)}
{hW₂ : Dense (W₂ : Set X)} {hW₁' : W₁ ≤ f.domain} {hW₂' : W₂ ≤ g.domain}
(H : f.restrict W₁ hW₁ hW₁' = g.restrict W₂ hW₂ hW₂') : f.equiv g := by
have e : W₁ = W₂ := congr($(H).domain)
subst e
exact ⟨W₁, hW₁, hW₁', hW₂', congr($(H).hom)⟩
set_option backward.isDefEq.respectTransparency false in
@[refl]
lemma equiv.refl (f : X.PartialMap Y) : f.equiv f :=
⟨f.domain, f.dense_domain, by simp⟩
@[symm]
lemma equiv.symm {f g : X.PartialMap Y} : f.equiv g → g.equiv f := by
intro ⟨W, hW, hWl, hWr, e⟩
exact ⟨W, hW, hWr, hWl, e.symm⟩
set_option backward.defeqAttrib.useBackward true in
@[trans]
lemma equiv.trans {f g h : X.PartialMap Y} : f.equiv g → g.equiv h → f.equiv h := by
intro ⟨W₁, hW₁, hW₁l, hW₁r, e₁⟩ ⟨W₂, hW₂, hW₂l, hW₂r, e₂⟩
refine ⟨W₁ ⊓ W₂, hW₁.inter_of_isOpen_left hW₂ W₁.2, inf_le_left.trans hW₁l,
inf_le_right.trans hW₂r, ?_⟩
dsimp at e₁ e₂
simp only [restrict_domain, restrict_hom, ← X.homOfLE_homOfLE (U := W₁ ⊓ W₂) inf_le_left hW₁l,
Category.assoc, e₁, ← X.homOfLE_homOfLE (U := W₁ ⊓ W₂) inf_le_right hW₂r, ← e₂]
simp only [homOfLE_homOfLE_assoc]
lemma equivalence_rel : Equivalence (@Scheme.PartialMap.equiv X Y) where
refl := equiv.refl
symm := equiv.symm
trans := equiv.trans
instance : Setoid (X.PartialMap Y) := ⟨@PartialMap.equiv X Y, equivalence_rel⟩
set_option backward.isDefEq.respectTransparency.types false in
set_option backward.defeqAttrib.useBackward true in
lemma restrict_equiv (f : X.PartialMap Y) (U : X.Opens)
(hU : Dense (U : Set X)) (hU' : U ≤ f.domain) : (f.restrict U hU hU').equiv f :=
⟨U, hU, le_rfl, hU', by simp⟩
set_option backward.isDefEq.respectTransparency false in
lemma equiv_id_iff (f : X.PartialMap X) :
f.equiv (PartialMap.id X) ↔ ∃ (U : Opens X) (hU₁ : Dense (U : Set X)) (hU₂ : U ≤ f.domain),
(f.restrict U hU₁ hU₂).hom = U.ι := by
constructor
· intro ⟨U, hU₁, hU₂, w, e⟩
exact ⟨U, hU₁, hU₂, by simpa using homOfLE_ι X w ▸ e⟩
· intro ⟨U, hU₁, hU₂, e⟩
refine ⟨U, hU₁, hU₂, le_top, by simpa using (homOfLE_ι X le_top).symm ▸ e⟩
set_option backward.defeqAttrib.useBackward true in
set_option backward.isDefEq.respectTransparency false in
lemma equiv_of_fromSpecStalkOfMem_eq [IrreducibleSpace X]
{x : X} [X.IsGermInjectiveAt x] (f g : X.PartialMap Y)
(hxf : x ∈ f.domain) (hxg : x ∈ g.domain)
(H : f.fromSpecStalkOfMem hxf = g.fromSpecStalkOfMem hxg) : f.equiv g := by
have hdense : Dense ((f.domain ⊓ g.domain) : Set X) :=
f.dense_domain.inter_of_isOpen_left g.dense_domain f.domain.2
have := (isGermInjectiveAt_iff_of_isOpenImmersion (f := (f.domain ⊓ g.domain).ι)
(x := ⟨x, hxf, hxg⟩)).mp ‹_›
have := spread_out_unique_of_isGermInjective' (X := (f.domain ⊓ g.domain).toScheme)
(X.homOfLE inf_le_left ≫ f.hom) (X.homOfLE inf_le_right ≫ g.hom) (x := ⟨x, hxf, hxg⟩) ?_
· obtain ⟨U, hxU, e⟩ := this
refine ⟨(f.domain ⊓ g.domain).ι ''ᵁ U, ((f.domain ⊓ g.domain).ι ''ᵁ U).2.dense
⟨_, ⟨_, hxU, rfl⟩⟩,
((Set.image_subset_range _ _).trans_eq (Subtype.range_val)).trans inf_le_left,
((Set.image_subset_range _ _).trans_eq (Subtype.range_val)).trans inf_le_right, ?_⟩
rw [← cancel_epi (Scheme.Hom.isoImage _ _).hom]
simp only [restrict_hom, ← Category.assoc] at e ⊢
convert! e using 2 <;> rw [← cancel_mono (Scheme.Opens.ι _)] <;> simp
· rw [← f.fromSpecStalkOfMem_restrict hdense inf_le_left ⟨hxf, hxg⟩,
← g.fromSpecStalkOfMem_restrict hdense inf_le_right ⟨hxf, hxg⟩] at H
simpa only [fromSpecStalkOfMem, restrict_domain, Opens.fromSpecStalkOfMem, Spec.map_inv,
restrict_hom, Category.assoc, IsIso.eq_inv_comp, IsIso.hom_inv_id_assoc] using H
set_option backward.isDefEq.respectTransparency false in
/-- Two partial maps from reduced schemes to separated schemes are equivalent if and only if
they are equal on **any** open dense subset. -/
lemma equiv_iff_of_isSeparated_of_le [X.Over S] [Y.Over S] [IsReduced X]
[IsSeparated (Y ↘ S)] {f g : X.PartialMap Y} [f.IsOver S] [g.IsOver S]
{W : X.Opens} (hW : Dense (X := X) W) (hWl : W ≤ f.domain) (hWr : W ≤ g.domain) : f.equiv g ↔
(f.restrict W hW hWl).hom = (g.restrict W hW hWr).hom := by
refine ⟨fun ⟨V, hV, hVl, hVr, e⟩ ↦ ?_, fun e ↦ ⟨_, _, _, _, e⟩⟩
have : IsDominant (X.homOfLE (inf_le_left : W ⊓ V ≤ W)) :=
Opens.isDominant_homOfLE (hW.inter_of_isOpen_left hV W.2) _
apply ext_of_isDominant_of_isSeparated' S (X.homOfLE (inf_le_left : W ⊓ V ≤ W))
simpa using congr(X.homOfLE (inf_le_right : W ⊓ V ≤ V) ≫ $e)
/-- Two partial maps from reduced schemes to separated schemes are equivalent if and only if
they are equal on the intersection of the domains. -/
lemma equiv_iff_of_isSeparated [X.Over S] [Y.Over S] [IsReduced X]
[IsSeparated (Y ↘ S)] {f g : X.PartialMap Y}
[f.IsOver S] [g.IsOver S] : f.equiv g ↔
(f.restrict _ (f.2.inter_of_isOpen_left g.2 f.domain.2) inf_le_left).hom =
(g.restrict _ (f.2.inter_of_isOpen_left g.2 f.domain.2) inf_le_right).hom :=
equiv_iff_of_isSeparated_of_le (S := S) _ _ _
set_option backward.defeqAttrib.useBackward true in
/-- Two partial maps from reduced schemes to separated schemes with the same domain are equivalent
if and only if they are equal. -/
lemma equiv_iff_of_domain_eq_of_isSeparated [X.Over S] [Y.Over S] [IsReduced X]
[IsSeparated (Y ↘ S)] {f g : X.PartialMap Y} (hfg : f.domain = g.domain)
[f.IsOver S] [g.IsOver S] : f.equiv g ↔ f = g := by
rw [equiv_iff_of_isSeparated_of_le (S := S) f.dense_domain le_rfl hfg.le]
obtain ⟨Uf, _, f⟩ := f
obtain ⟨Ug, _, g⟩ := g
obtain rfl : Uf = Ug := hfg
simp
set_option backward.isDefEq.respectTransparency.types false in
set_option backward.defeqAttrib.useBackward true in
/-- A partial map from a reduced scheme to a separated scheme is equivalent to a morphism
if and only if it is equal to the restriction of the morphism. -/
lemma equiv_toPartialMap_iff_of_isSeparated [X.Over S] [Y.Over S] [IsReduced X]
[IsSeparated (Y ↘ S)] {f : X.PartialMap Y} {g : X ⟶ Y}
[f.IsOver S] [g.IsOver S] : f.equiv g.toPartialMap ↔
f.hom = f.domain.ι ≫ g := by
rw [equiv_iff_of_isSeparated (S := S), ← cancel_epi (X.isoOfEq (inf_top_eq f.domain)).hom]
simp
rfl
end PartialMap
/-- A rational map from `X` to `Y` (`X ⤏ Y`) is an equivalence class of partial maps,
where two partial maps are equivalent if they are equal on a dense open subscheme. -/
def RationalMap (X Y : Scheme.{u}) : Type u :=
@Quotient (X.PartialMap Y) inferInstance
/-- The notation for rational maps. -/
scoped[AlgebraicGeometry] infix:10 " ⤏ " => Scheme.RationalMap
/-- A partial map as a rational map. -/
def PartialMap.toRationalMap (f : X.PartialMap Y) : X ⤏ Y := Quotient.mk _ f
/-- A scheme morphism as a rational map. -/
abbrev Hom.toRationalMap (f : X.Hom Y) : X ⤏ Y := f.toPartialMap.toRationalMap
variable (X) in
/-- The identity rational map. -/
abbrev RationalMap.id : X ⤏ X := (PartialMap.id X).toRationalMap
variable (S) in
/-- A rational map is an `S`-map if some partial map in the equivalence class is an `S`-map. -/
class RationalMap.IsOver [X.Over S] [Y.Over S] (f : X ⤏ Y) : Prop where
exists_partialMap_over : ∃ g : X.PartialMap Y, g.IsOver S ∧ g.toRationalMap = f
instance RationalMap.isOver_toRationalMap [X.Over S] [Y.Over S] (f : PartialMap X Y) [f.IsOver S] :
f.toRationalMap.IsOver S where
exists_partialMap_over := ⟨f, inferInstance, rfl⟩
lemma PartialMap.toRationalMap_surjective : Function.Surjective (@toRationalMap X Y) :=
Quotient.exists_rep
lemma RationalMap.exists_rep (f : X ⤏ Y) : ∃ g : X.PartialMap Y, g.toRationalMap = f :=
Quotient.exists_rep f
lemma PartialMap.toRationalMap_eq_iff {f g : X.PartialMap Y} :
f.toRationalMap = g.toRationalMap ↔ f.equiv g :=
Quotient.eq
/-- An arbitrarily chosen partial map representing `f`. Use `RationalMap.toPartialMap` instead
if `X` is reduced and `Y` is separated. -/
noncomputable def RationalMap.representative (f : X ⤏ Y) : X.PartialMap Y :=
f.exists_rep.choose
@[simp]
lemma RationalMap.toRationalMap_representative (f : X ⤏ Y) :
f.representative.toRationalMap = f :=
f.exists_rep.choose_spec
lemma PartialMap.representative_toRationalMap_equiv (f : X.PartialMap Y) :
f.toRationalMap.representative.equiv f := by
rw [← PartialMap.toRationalMap_eq_iff, f.toRationalMap.toRationalMap_representative]
@[simp]
lemma PartialMap.restrict_toRationalMap (f : X.PartialMap Y) (U : X.Opens)
(hU : Dense (U : Set X)) (hU' : U ≤ f.domain) :
(f.restrict U hU hU').toRationalMap = f.toRationalMap :=
toRationalMap_eq_iff.mpr (f.restrict_equiv U hU hU')
instance [X.Over S] [Y.Over S] (f : X.PartialMap Y) [f.IsOver S] : f.toRationalMap.IsOver S :=
⟨f, ‹_›, rfl⟩
variable (S) in
lemma RationalMap.exists_partialMap_over [X.Over S] [Y.Over S] (f : X ⤏ Y) [f.IsOver S] :
∃ g : X.PartialMap Y, g.IsOver S ∧ g.toRationalMap = f :=
IsOver.exists_partialMap_over
set_option backward.isDefEq.respectTransparency.types false in
set_option backward.defeqAttrib.useBackward true in
/-- The composition of a rational map and a morphism on the right. -/
def RationalMap.compHom (f : X ⤏ Y) (g : Y ⟶ Z) : X ⤏ Z := by
refine Quotient.map (PartialMap.compHom · g) ?_ f
intro f₁ f₂ ⟨W, hW, hWl, hWr, e⟩
refine ⟨W, hW, hWl, hWr, ?_⟩
simp only [PartialMap.restrict_domain, PartialMap.restrict_hom, PartialMap.compHom_domain,
PartialMap.compHom_hom] at e ⊢
rw [reassoc_of% e]
@[simp]
lemma RationalMap.compHom_toRationalMap (f : X.PartialMap Y) (g : Y ⟶ Z) :
(f.compHom g).toRationalMap = f.toRationalMap.compHom g := rfl
@[simp]
lemma RationalMap.id_compHom (f : X ⟶ Y) :
(RationalMap.id X).compHom f = f.toRationalMap := by
rw [RationalMap.id, ← compHom_toRationalMap, PartialMap.id_compHom]
instance [X.Over S] [Y.Over S] [Z.Over S] (f : X ⤏ Y) (g : Y ⟶ Z)
[f.IsOver S] [g.IsOver S] : (f.compHom g).IsOver S where
exists_partialMap_over := by
obtain ⟨f, hf, rfl⟩ := f.exists_partialMap_over S
exact ⟨f.compHom g, inferInstance, rfl⟩
set_option backward.isDefEq.respectTransparency false in
variable (S) in
lemma PartialMap.exists_restrict_isOver [X.Over S] [Y.Over S] (f : X.PartialMap Y)
[f.toRationalMap.IsOver S] : ∃ U hU hU', (f.restrict U hU hU').IsOver S := by
obtain ⟨f', hf₁, hf₂⟩ := RationalMap.IsOver.exists_partialMap_over (S := S) (f := f.toRationalMap)
obtain ⟨U, hU, hUl, hUr, e⟩ := PartialMap.toRationalMap_eq_iff.mp hf₂
exact ⟨U, hU, hUr, by rw [IsOver, ← e]; infer_instance⟩
set_option backward.isDefEq.respectTransparency.types false in
set_option backward.defeqAttrib.useBackward true in
lemma RationalMap.isOver_iff [X.Over S] [Y.Over S] {f : X ⤏ Y} :
f.IsOver S ↔ f.compHom (Y ↘ S) = (X ↘ S).toRationalMap := by
constructor
· intro h
obtain ⟨g, hg, e⟩ := f.exists_partialMap_over S
rw [← e, Hom.toRationalMap, ← compHom_toRationalMap, PartialMap.isOver_iff_eq_restrict.mp hg,
PartialMap.restrict_toRationalMap]
· intro e
obtain ⟨f, rfl⟩ := PartialMap.toRationalMap_surjective f
obtain ⟨U, hU, hUl, hUr, e⟩ := PartialMap.toRationalMap_eq_iff.mp e
exact ⟨⟨f.restrict U hU hUl, by simpa using! e, by simp⟩⟩
set_option backward.defeqAttrib.useBackward true in
set_option backward.isDefEq.respectTransparency false in
lemma PartialMap.isOver_toRationalMap_iff_of_isSeparated [X.Over S] [Y.Over S] [IsReduced X]
[S.IsSeparated] {f : X.PartialMap Y} :
f.toRationalMap.IsOver S ↔ f.IsOver S := by
refine ⟨fun _ ↦ ?_, fun _ ↦ inferInstance⟩
obtain ⟨U, hU, hU', H⟩ := f.exists_restrict_isOver (S := S)
rw [isOver_iff]
have : IsDominant (X.homOfLE hU') := Opens.isDominant_homOfLE hU _
exact ext_of_isDominant (ι := X.homOfLE hU') (by simpa using H.1)
section functionField
set_option backward.defeqAttrib.useBackward true in
/-- A rational map restricts to a map from `Spec K(X)`. -/
noncomputable
def RationalMap.fromFunctionField [IrreducibleSpace X] (f : X ⤏ Y) :
Spec X.functionField ⟶ Y := by
refine Quotient.lift PartialMap.fromFunctionField ?_ f
intro f g ⟨W, hW, hWl, hWr, e⟩
have : f.restrict W hW hWl = g.restrict W hW hWr := by
ext1
· rfl
rw [e]; simp
rw [← f.fromFunctionField_restrict hW hWl, this, g.fromFunctionField_restrict]
@[simp]
lemma RationalMap.fromFunctionField_toRationalMap [IrreducibleSpace X] (f : X.PartialMap Y) :
f.toRationalMap.fromFunctionField = f.fromFunctionField := rfl
/--
Given `S`-schemes `X` and `Y` such that `Y` is locally of finite type and `X` is integral,
any `S`-morphism `Spec K(X) ⟶ Y` spreads out to a rational map from `X` to `Y`.
-/
noncomputable
def RationalMap.ofFunctionField [IsIntegral X] [LocallyOfFiniteType sY]
(f : Spec X.functionField ⟶ Y) (h : f ≫ sY = X.fromSpecStalk _ ≫ sX) : X ⤏ Y :=
(PartialMap.ofFromSpecStalk sX sY f h).toRationalMap
lemma RationalMap.fromFunctionField_ofFunctionField [IsIntegral X] [LocallyOfFiniteType sY]
(f : Spec X.functionField ⟶ Y) (h : f ≫ sY = X.fromSpecStalk _ ≫ sX) :
(ofFunctionField sX sY f h).fromFunctionField = f :=
PartialMap.fromSpecStalkOfMem_ofFromSpecStalk sX sY _ _
lemma RationalMap.eq_of_fromFunctionField_eq [IsIntegral X] (f g : X.RationalMap Y)
(H : f.fromFunctionField = g.fromFunctionField) : f = g := by
obtain ⟨f, rfl⟩ := f.exists_rep
obtain ⟨g, rfl⟩ := g.exists_rep
refine PartialMap.toRationalMap_eq_iff.mpr ?_
exact PartialMap.equiv_of_fromSpecStalkOfMem_eq _ _ _ _ H
set_option backward.isDefEq.respectTransparency.types false in
set_option backward.defeqAttrib.useBackward true in
/--
Given `S`-schemes `X` and `Y` such that `Y` is locally of finite type and `X` is integral,
`S`-morphisms `Spec K(X) ⟶ Y` correspond bijectively to `S`-rational maps from `X` to `Y`.
-/
noncomputable
def RationalMap.equivFunctionField [IsIntegral X] [LocallyOfFiniteType sY] :
{ f : Spec X.functionField ⟶ Y // f ≫ sY = X.fromSpecStalk _ ≫ sX } ≃
{ f : X ⤏ Y // f.compHom sY = sX.toRationalMap } where
toFun f := ⟨.ofFunctionField sX sY f f.2, PartialMap.toRationalMap_eq_iff.mpr
⟨_, PartialMap.dense_domain _, le_rfl, le_top, by simp [PartialMap.ofFromSpecStalk_comp]⟩⟩
invFun f := ⟨f.1.fromFunctionField, by
obtain ⟨f, hf⟩ := f
obtain ⟨f, rfl⟩ := f.exists_rep
simpa [fromFunctionField_toRationalMap] using! congr(RationalMap.fromFunctionField $hf)⟩
left_inv f := Subtype.ext (RationalMap.fromFunctionField_ofFunctionField _ _ _ _)
right_inv f := Subtype.ext (RationalMap.eq_of_fromFunctionField_eq
(ofFunctionField sX sY f.1.fromFunctionField _) f
(RationalMap.fromFunctionField_ofFunctionField _ _ _ _))
/--
Given `S`-schemes `X` and `Y` such that `Y` is locally of finite type and `X` is integral,
`S`-morphisms `Spec K(X) ⟶ Y` correspond bijectively to `S`-rational maps from `X` to `Y`.
-/
noncomputable
def RationalMap.equivFunctionFieldOver [X.Over S] [Y.Over S] [IsIntegral X]
[LocallyOfFiniteType (Y ↘ S)] :
{ f : Spec X.functionField ⟶ Y // f.IsOver S } ≃ { f : X ⤏ Y // f.IsOver S } :=
((Equiv.subtypeEquivProp (by simp only [Hom.isOver_iff]; rfl)).trans
(RationalMap.equivFunctionField (X ↘ S) (Y ↘ S))).trans
(Equiv.subtypeEquivProp (by ext f; rw [RationalMap.isOver_iff]))
end functionField
section domain
/-- The domain of definition of a rational map. -/
def RationalMap.domain (f : X ⤏ Y) : X.Opens :=
sSup { PartialMap.domain g | (g) (_ : g.toRationalMap = f) }
lemma PartialMap.le_domain_toRationalMap (f : X.PartialMap Y) :
f.domain ≤ f.toRationalMap.domain :=
le_sSup ⟨f, rfl, rfl⟩
lemma RationalMap.mem_domain {f : X ⤏ Y} {x} :
x ∈ f.domain ↔ ∃ g : X.PartialMap Y, x ∈ g.domain ∧ g.toRationalMap = f :=
TopologicalSpace.Opens.mem_sSup.trans (by simp [@and_comm (x ∈ _)])
lemma RationalMap.dense_domain (f : X ⤏ Y) : Dense (X := X) f.domain :=
f.inductionOn (fun g ↦ g.dense_domain.mono g.le_domain_toRationalMap)
set_option backward.isDefEq.respectTransparency false in
/-- The open cover of the domain of `f : X ⤏ Y`,
consisting of all the domains of the partial maps in the equivalence class. -/
noncomputable
def RationalMap.openCoverDomain (f : X ⤏ Y) : f.domain.toScheme.OpenCover where
I₀ := { PartialMap.domain g | (g) (_ : g.toRationalMap = f) }
X U := U.1.toScheme
f U := X.homOfLE (le_sSup U.2)
mem₀ := by
rw [presieve₀_mem_precoverage_iff]
refine ⟨fun x ↦ ?_, inferInstance⟩
use ⟨_, (TopologicalSpace.Opens.mem_sSup.mp x.2).choose_spec.1⟩
exact ⟨⟨x.1, (TopologicalSpace.Opens.mem_sSup.mp x.2).choose_spec.2⟩, Subtype.ext (by simp)⟩
set_option backward.isDefEq.respectTransparency false in
/-- If `f : X ⤏ Y` is a rational map from a reduced scheme to a separated scheme,
then `f` can be represented as a partial map on its domain of definition. -/
noncomputable
def RationalMap.toPartialMap [IsReduced X] [Y.IsSeparated] (f : X ⤏ Y) : X.PartialMap Y := by
refine ⟨f.domain, f.dense_domain, f.openCoverDomain.glueMorphisms
(fun x ↦ (X.isoOfEq x.2.choose_spec.2).inv ≫ x.2.choose.hom) ?_⟩
intro x y
let g (x : f.openCoverDomain.I₀) := x.2.choose
have hg₁ (x) : (g x).toRationalMap = f := x.2.choose_spec.1
have hg₂ (x) : (g x).domain = x.1 := x.2.choose_spec.2
refine (cancel_epi (isPullback_opens_inf_le (le_sSup x.2) (le_sSup y.2)).isoPullback.hom).mp ?_
simp only [openCoverDomain, IsPullback.isoPullback_hom_fst_assoc,
IsPullback.isoPullback_hom_snd_assoc]
change _ ≫ _ ≫ (g x).hom = _ ≫ _ ≫ (g y).hom
simp_rw [← cancel_epi (X.isoOfEq congr($(hg₂ x) ⊓ $(hg₂ y))).hom, ← Category.assoc]
convert! (PartialMap.equiv_iff_of_isSeparated (S := ⊤_ _) (f := g x) (g := g y)).mp ?_ using 1
· dsimp; congr 1; simp [g, ← cancel_mono (Opens.ι _)]
· dsimp; congr 1; simp [g, ← cancel_mono (Opens.ι _)]
· rw [← PartialMap.toRationalMap_eq_iff, hg₁, hg₁]
set_option backward.defeqAttrib.useBackward true in
lemma PartialMap.toPartialMap_toRationalMap_restrict [IsReduced X] [Y.IsSeparated]
(f : X.PartialMap Y) : (f.toRationalMap.toPartialMap.restrict _ f.dense_domain
f.le_domain_toRationalMap).hom = f.hom := by
dsimp [RationalMap.toPartialMap]
refine (f.toRationalMap.openCoverDomain.ι_glueMorphisms _ _ ⟨_, f, rfl, rfl⟩).trans ?_
generalize_proofs _ _ H _
have : H.choose = f := (equiv_iff_of_domain_eq_of_isSeparated (S := ⊤_ _) H.choose_spec.2).mp
(toRationalMap_eq_iff.mp H.choose_spec.1)
exact ((ext_iff _ _).mp this.symm).choose_spec.symm
set_option backward.isDefEq.respectTransparency.types false in
set_option backward.defeqAttrib.useBackward true in
@[simp]
lemma RationalMap.toRationalMap_toPartialMap [IsReduced X] [Y.IsSeparated]
(f : X ⤏ Y) : f.toPartialMap.toRationalMap = f := by
obtain ⟨f, rfl⟩ := PartialMap.toRationalMap_surjective f
trans (f.toRationalMap.toPartialMap.restrict _
f.dense_domain f.le_domain_toRationalMap).toRationalMap
· simp
· congr 1
exact PartialMap.ext _ f rfl (by simpa using f.toPartialMap_toRationalMap_restrict)
instance [IsReduced X] [Y.IsSeparated] [S.IsSeparated] [X.Over S] [Y.Over S]
(f : X ⤏ Y) [f.IsOver S] : f.toPartialMap.IsOver S := by
rw [← PartialMap.isOver_toRationalMap_iff_of_isSeparated, f.toRationalMap_toPartialMap]
infer_instance
end domain
end Scheme
end AlgebraicGeometry