88public import Mathlib.CategoryTheory.Limits.Shapes.Opposites.Products
99public import Mathlib.AlgebraicGeometry.Pullbacks
1010public import Mathlib.AlgebraicGeometry.AffineScheme
11+ public import Mathlib.CategoryTheory.Limits.MonoCoprod
12+ public import Mathlib.CategoryTheory.Limits.Shapes.DisjointCoproduct
13+
1114
1215/-!
1316# (Co)Limits of Schemes
@@ -120,6 +123,10 @@ noncomputable def isInitialOfIsEmpty {X : Scheme} [IsEmpty X] : IsInitial X :=
120123noncomputable def specPunitIsInitial : IsInitial (Spec <| .of PUnit.{u + 1 }) :=
121124 emptyIsInitial.ofIso (asIso <| emptyIsInitial.to _)
122125
126+ lemma isInitial_iff_isEmpty {X : Scheme.{u}} : Nonempty (IsInitial X) ↔ IsEmpty X :=
127+ ⟨fun ⟨h⟩ ↦ (h.uniqueUpToIso specPunitIsInitial).hom.homeomorph.isEmpty,
128+ fun _ ↦ ⟨isInitialOfIsEmpty⟩⟩
129+
123130instance (priority := 100 ) isAffine_of_isEmpty {X : Scheme} [IsEmpty X] : IsAffine X :=
124131 .of_isIso (inv (emptyIsInitial.to X) ≫ emptyIsInitial.to (Spec <| .of PUnit))
125132
@@ -169,8 +176,8 @@ instance [Small.{u} σ] : PreservesColimitsOfShape (Discrete σ) Scheme.forgetTo
169176instance [Small.{u} σ] : HasColimitsOfShape (Discrete σ) Scheme.{u} :=
170177 ⟨fun _ ↦ hasColimit_of_created _ Scheme.forgetToLocallyRingedSpace⟩
171178
172- lemma sigmaι_eq_iff (i j : ι ) (x y) :
173- Sigma.ι f i x = Sigma.ι f j y ↔ (Sigma.mk i x : Σ i, f i) = Sigma.mk j y := by
179+ lemma sigmaι_eq_iff [Small.{u} σ] (i j : σ ) (x y) :
180+ Sigma.ι g i x = Sigma.ι g j y ↔ (Sigma.mk i x : Σ i, g i) = Sigma.mk j y := by
174181 refine (Scheme.IsLocallyDirected.ι_eq_ι_iff _).trans ⟨?_, ?_⟩
175182 · rintro ⟨k, ⟨⟨⟨⟩⟩⟩, ⟨⟨⟨⟩⟩⟩, x, rfl, rfl⟩; simp
176183 · simp only [Discrete.functor_obj_eq_as, Sigma.mk.injEq]
@@ -179,14 +186,41 @@ lemma sigmaι_eq_iff (i j : ι) (x y) :
179186 exact ⟨⟨i⟩, 𝟙 _, 𝟙 _, x, by simp⟩
180187
181188/-- The images of each component in the coproduct is disjoint. -/
182- lemma disjoint_opensRange_sigmaι (i j : ι ) (h : i ≠ j) :
183- Disjoint (Sigma.ι f i).opensRange (Sigma.ι f j).opensRange := by
189+ lemma disjoint_opensRange_sigmaι [Small.{u} σ] (i j : σ ) (h : i ≠ j) :
190+ Disjoint (Sigma.ι g i).opensRange (Sigma.ι g j).opensRange := by
184191 intro U hU hU' x hx
185192 obtain ⟨x, rfl⟩ := hU hx
186193 obtain ⟨y, hy⟩ := hU' hx
187194 obtain ⟨rfl⟩ := (sigmaι_eq_iff _ _ _ _ _).mp hy
188195 cases h rfl
189196
197+ variable {g} in
198+ lemma isEmpty_of_commSq_sigmaι_of_ne [Small.{u} σ] {i j : σ} {Z : Scheme.{u}} {a : Z ⟶ g i}
199+ {b : Z ⟶ g j} (h : CommSq a b (Sigma.ι g i) (Sigma.ι g j)) (hij : i ≠ j) :
200+ IsEmpty Z := by
201+ refine ⟨fun z ↦ ?_⟩
202+ fapply eq_bot_iff.mp <| disjoint_iff.mp <| disjoint_opensRange_sigmaι g i j hij
203+ · exact (a ≫ Sigma.ι g i).base z
204+ · exact ⟨⟨a.base z, rfl⟩, ⟨b.base z, by rw [← Scheme.Hom.comp_apply, h.w]⟩⟩
205+
206+ lemma isEmpty_pullback_sigmaι_of_ne [Small.{u} σ] {i j : σ} (hij : i ≠ j) :
207+ IsEmpty ↑(pullback (Sigma.ι g i) (Sigma.ι g j)) :=
208+ isEmpty_of_commSq_sigmaι_of_ne ⟨pullback.condition⟩ hij
209+
210+ noncomputable instance [Small.{u} σ] : CoproductsOfShapeDisjoint Scheme.{u} σ where
211+ coproductDisjoint g := by
212+ refine .of_hasCoproduct (fun _ ↦ pullback.cone _ _) (fun _ ↦ pullback.isLimit _ _) ?_
213+ intro i j hij
214+ apply Nonempty.some
215+ rw [isInitial_iff_isEmpty]
216+ exact isEmpty_pullback_sigmaι_of_ne _ hij
217+
218+ instance : HasFiniteCoproducts Scheme.{u} where
219+ out := inferInstance
220+
221+ instance : MonoCoprod Scheme.{u} :=
222+ .mk' fun X Y ↦ ⟨.mk coprod.inl coprod.inr, coprodIsCoprod X Y, inferInstanceAs <| Mono coprod.inl⟩
223+
190224/-- The cover of `∐ X` by the `Xᵢ`. -/
191225@[simps!]
192226noncomputable def sigmaOpenCover [Small.{u} σ] : (∐ g).OpenCover :=
0 commit comments