/- Copyright 2025 The Formal Conjectures Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at https://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. This file has been modified. -/ import Mathlib.AlgebraicGeometry.Morphisms.Proper import Mathlib.AlgebraicGeometry.ProjectiveSpectrum.Scheme import Mathlib.RingTheory.MvPolynomial.Homogeneous import OAI.CategoryTheory.ConcreteCategory.Notation import Mathlib.AlgebraicGeometry.ProjectiveSpectrum.Proper /-! # Projective Space Is -/ namespace OAI.AlgebraicGeometry.Foundations.ProjectiveSpaceIs open _root_.AlgebraicGeometry /-! # Projective space and explicit projective presentations This file constructs projective space over a scheme as a pullback from `Proj`, proves its structure morphism proper for finitely many homogeneous coordinates, and packages a closed embedding into finite-dimensional projective space as an explicit projective presentation. The original projective-space construction was contributed to Mathlib in [`mathlib4` pull request #26061](https://github.com/leanprover-community/mathlib4/pull/26061). -/ -- The contents of this file will be in mathlib as of #26061 universe u v open _root_.CategoryTheory Limits _root_.MvPolynomial variable (n : Type v) (S : Scheme.{max u v}) local notation "ℤ[" n "]" => homogeneousSubmodule n ℤ local notation3 "ℤ[" n "].{" u "," v "}" => homogeneousSubmodule n (ULift.{max u v} ℤ) attribute [local instance] MvPolynomial.gradedAlgebra /-- Let `S` be a scheme and `n` an index set for homogeneous coordinates. This is projective space over `S`, defined by base change to `S` of `Proj(ℤ[x_i | i ∈ n])` with each variable in degree one. For `n = Fin (d+1)`, this is the usual `d`-dimensional projective space `ℙ^d_S`. -/ noncomputable def ProjectiveSpace : Scheme.{max u v} := pullback (terminal.from S) (terminal.from (Proj ℤ[n].{u, v})) /-- `ℙ(n; S)` is projective space over `S` with homogeneous coordinates indexed by `n`. -/ scoped [AlgebraicGeometry] notation "ℙ("n"; "S")" => OAI.AlgebraicGeometry.Foundations.ProjectiveSpaceIs.ProjectiveSpace n S namespace ProjectiveSpace /-- Let `R` be a commutative ring and `n` an index set of polynomial variables, each assigned degree one. The degree-zero homogeneous subring of `R[x_i | i ∈ n]` is isomorphic to `R`: this equivalence takes the constant coefficient, with inverse the inclusion of constant polynomials. -/ noncomputable def degreeZeroEquiv (R : Type*) [CommRing R] : homogeneousSubmodule n R 0 ≃+* R where toFun f := f.1.coeff 0 invFun r := ⟨C r, isHomogeneous_C n r⟩ left_inv f := Subtype.ext (totalDegree_eq_zero_iff_eq_C.mp ((totalDegree_zero_iff_isHomogeneous n).mpr f.2)).symm right_inv r := coeff_zero_C r map_mul' x y := by have hx := totalDegree_eq_zero_iff_eq_C.mp ((totalDegree_zero_iff_isHomogeneous n).mpr x.2) have hy := totalDegree_eq_zero_iff_eq_C.mp ((totalDegree_zero_iff_isHomogeneous n).mpr y.2) change (x.1 * y.1).coeff 0 = x.1.coeff 0 * y.1.coeff 0 rw [hx, hy, ← map_mul, coeff_zero_C, coeff_zero_C, coeff_zero_C] map_add' _ _ := rfl /-- A polynomial ring in finitely many variables is of finite type over its degree-zero homogeneous subring. -/ noncomputable instance degreeZeroFiniteType [Finite n] (R : Type*) [CommRing R] : Algebra.FiniteType (homogeneousSubmodule n R 0) (MvPolynomial n R) := by rw [← RingHom.finiteType_algebraMap] have hC : (C : R →+* MvPolynomial n R).FiniteType := by rw [← MvPolynomial.algebraMap_eq] exact RingHom.finiteType_algebraMap.mpr inferInstance have he : (degreeZeroEquiv n R).toRingHom.FiniteType := RingHom.FiniteType.of_surjective _ (degreeZeroEquiv n R).surjective have h := hC.comp he convert h using 1 exact RingHom.ext fun x ↦ totalDegree_eq_zero_iff_eq_C.mp ((totalDegree_zero_iff_isHomogeneous n).mpr x.2) /-- Projective space on finitely many homogeneous coordinates is proper over the terminal scheme. -/ noncomputable instance terminalProjProper [Finite n] : IsProper (terminal.from (Proj ℤ[n].{u, v})) := by have hterminal : IsTerminal (Spec ↧(ℤ[n].{u, v} 0)) := IsTerminal.ofIso specULiftZIsTerminal (Scheme.Spec.mapIso (degreeZeroEquiv n (ULift.{max u v} ℤ)).toCommRingCatIso.op) have := isIso_of_isTerminal hterminal terminalIsTerminal (terminal.from _) rw [← terminal.comp_from (Proj.toSpecZero ℤ[n].{u, v}), MorphismProperty.cancel_right_of_respectsIso (P := @IsProper)] infer_instance /-- Let `S` be a scheme and `n` an index set of homogeneous coordinates. This is the structure morphism `ℙ(n; S) → S`, the projection from the base change of `Proj(ℤ[x_i | i ∈ n])` to `S`. -/ noncomputable def toBase : ℙ(n; S) ⟶ S := pullback.fst (terminal.from S) (terminal.from (Proj ℤ[n].{u, v})) /-- Finite-dimensional projective space is proper over its base. -/ noncomputable instance toBaseProper [Finite n] : IsProper (toBase n S) := by change IsProper (pullback.fst (terminal.from S) (terminal.from (Proj ℤ[n].{u, v}))) infer_instance universe w variable {X T : Scheme.{w}} /-- Let `f: X → T` be a morphism of schemes. A projective presentation consists of a natural number `d` and a closed immersion `i: X → ℙ^d_T` such that the composite of `i` with the projection `ℙ^d_T → T` is `f`. -/ structure Presentation (f : X ⟶ T) where /-- The dimension of the ambient projective space. -/ ambientDimension : ℕ /-- The closed embedding into projective space. -/ immersion : X ⟶ ℙ(Fin (ambientDimension + 1); T) [isClosedImmersion : IsClosedImmersion immersion] /-- The embedding is a morphism over the base scheme. -/ immersion_toBase : immersion ≫ toBase (Fin (ambientDimension + 1)) T = f end ProjectiveSpace open OAI.AlgebraicGeometry.Foundations.ProjectiveSpaceIs.ProjectiveSpace universe w variable {X T : Scheme.{w}} /-- A morphism of schemes `f: X → T` is projective here if there exist a natural number `d` and a closed immersion `X → ℙ^d_T` whose composite with the projection to `T` is `f`. -/ class IsProjective (f : X ⟶ T) : Prop where /-- A finite-dimensional projective presentation exists. -/ nonempty_presentation : Nonempty (ProjectiveSpace.Presentation f) /-- A projective morphism in the explicit-presentation sense is proper. -/ instance IsProjective.isProper {f : X ⟶ T} [h : IsProjective f] : IsProper f := by obtain ⟨P⟩ := h.nonempty_presentation let : IsClosedImmersion P.immersion := P.isClosedImmersion have hcomp : IsProper (P.immersion ≫ ProjectiveSpace.toBase (Fin (P.ambientDimension + 1)) T) := by infer_instance rwa [P.immersion_toBase] at hcomp end OAI.AlgebraicGeometry.Foundations.ProjectiveSpaceIs