import OAI.AlgebraicGeometry.HilbertScheme.Presentations.IntegerPolynomialGrading import Mathlib.RingTheory.Ideal.Quotient.Operations /-! # Integer Graded Quotient -/ namespace OAI.AlgebraicGeometry.HilbertScheme.Presentations.IntegerGradedQuotient.GradedModules.IntegerQuotient noncomputable section /-! The actual quotient ring by an integer-homogeneous ideal inherits its grading. -/ open DirectSum universe u v variable {R : Type u} [CommRing R] {A : Type v} [CommRing A] [Algebra R A] variable (π’œ : β„€ β†’ Submodule R A) [GradedAlgebra π’œ] (I : HomogeneousIdeal π’œ) def quotientMap : A β†’β‚—[R] A β§Έ I.toIdeal := (Ideal.Quotient.mkₐ R I.toIdeal).toLinearMap def grading (d : β„€) : Submodule R (A β§Έ I.toIdeal) := (π’œ d).map (quotientMap π’œ I) def degreeMap (d : β„€) : π’œ d β†’β‚—[R] grading π’œ I d := ((quotientMap π’œ I).comp (π’œ d).subtype).codRestrict (grading π’œ I d) (fun x => ⟨x.val, x.property, rfl⟩) def preDecompose : A β†’β‚—[R] ⨁ d : β„€, grading π’œ I d := (DirectSum.lmap (degreeMap π’œ I)).comp (decomposeLinearEquiv π’œ).toLinearMap theorem preDecompose_mem_kernel : I.toIdeal.restrictScalars R ≀ (preDecompose π’œ I).ker := by intro x hx apply DFinsupp.ext intro d apply Subtype.ext change Ideal.Quotient.mk I.toIdeal (decompose π’œ x d).val = 0 apply Ideal.Quotient.eq_zero_iff_mem.mpr exact (Ideal.IsHomogeneous.mem_iff π’œ I.isHomogeneous).mp hx d def quotientDecompose : (A β§Έ I.toIdeal) β†’β‚—[R] ⨁ d : β„€, grading π’œ I d where toFun := Quotient.lift (preDecompose π’œ I) (by intro x y h have hxy : x - y ∈ I.toIdeal := (Submodule.quotientRel_def _).mp h have hz : preDecompose π’œ I (x - y) = 0 := preDecompose_mem_kernel π’œ I hxy rw [map_sub] at hz exact sub_eq_zero.mp hz) map_add' x y := Quotient.inductionOnβ‚‚ x y (fun f g => map_add (preDecompose π’œ I) f g) map_smul' r x := Quotient.inductionOn x (fun f => map_smul (preDecompose π’œ I) r f) theorem quotientDecompose_mk (x : A) : quotientDecompose π’œ I (Ideal.Quotient.mk I.toIdeal x) = preDecompose π’œ I x := rfl theorem quotientDecompose_homogeneous (d : β„€) (x : π’œ d) : quotientDecompose π’œ I (quotientMap π’œ I x.val) = DirectSum.lof R β„€ (fun d => grading π’œ I d) d (degreeMap π’œ I d x) := by rw [show quotientMap π’œ I x.val = Ideal.Quotient.mk I.toIdeal x.val from rfl, quotientDecompose_mk] change DirectSum.lmap (degreeMap π’œ I) (decomposeLinearEquiv π’œ x.val) = _ rw [decomposeLinearEquiv_apply_coe, DirectSum.lmap_lof] theorem quotientDecompose_left_inverse : (DirectSum.coeLinearMap (grading π’œ I)).comp (quotientDecompose π’œ I) = LinearMap.id := by have h : ((DirectSum.coeLinearMap (grading π’œ I)).comp (quotientDecompose π’œ I)).comp (quotientMap π’œ I) = quotientMap π’œ I := by apply DirectSum.decompose_lhom_ext π’œ intro d apply LinearMap.ext intro x change DirectSum.coeLinearMap (grading π’œ I) (quotientDecompose π’œ I (quotientMap π’œ I x.val)) = _ rw [quotientDecompose_homogeneous, DirectSum.coeLinearMap_lof] rfl apply LinearMap.ext intro x obtain ⟨a, rfl⟩ := Ideal.Quotient.mk_surjective x exact LinearMap.congr_fun h a theorem quotientDecompose_right_inverse : (quotientDecompose π’œ I).comp (DirectSum.coeLinearMap (grading π’œ I)) = LinearMap.id := by apply DirectSum.linearMap_ext intro d apply LinearMap.ext intro x obtain ⟨a, ha, hax⟩ := x.property have hx : degreeMap π’œ I d ⟨a, ha⟩ = x := Subtype.ext hax rw [← hx] change quotientDecompose π’œ I (DirectSum.coeLinearMap (grading π’œ I) (DirectSum.lof R β„€ (fun d => grading π’œ I d) d (degreeMap π’œ I d ⟨a, ha⟩))) = _ rw [DirectSum.coeLinearMap_lof] exact quotientDecompose_homogeneous π’œ I d ⟨a, ha⟩ instance quotientDecomposition : Decomposition (grading π’œ I) := Decomposition.ofLinearMap _ (quotientDecompose π’œ I) (quotientDecompose_left_inverse π’œ I) (quotientDecompose_right_inverse π’œ I) instance quotientGradedAlgebra : GradedAlgebra (grading π’œ I) where one_mem := ⟨1, SetLike.GradedOne.one_mem, map_one (Ideal.Quotient.mk I.toIdeal)⟩ mul_mem d e x y hx hy := by obtain ⟨a, ha, rfl⟩ := hx obtain ⟨b, hb, rfl⟩ := hy exact ⟨a * b, SetLike.mul_mem_graded ha hb, map_mul (Ideal.Quotient.mk I.toIdeal) a b⟩ instance quotientGradedSMul : SetLike.GradedSMul π’œ (grading π’œ I) where smul_mem := by intro d e a x ha hx obtain ⟨b, hb, rfl⟩ := hx refine ⟨a * b, SetLike.mul_mem_graded ha hb, ?_⟩ change Ideal.Quotient.mk I.toIdeal (a * b) = a β€’ Ideal.Quotient.mk I.toIdeal b rw [map_mul] rfl end end OAI.AlgebraicGeometry.HilbertScheme.Presentations.IntegerGradedQuotient.GradedModules.IntegerQuotient