comm_alg/CommAlg/final_hil_pol.lean

314 lines
15 KiB
Text
Raw Permalink Normal View History

import Mathlib.Order.KrullDimension
import Mathlib.AlgebraicGeometry.PrimeSpectrum.Basic
import Mathlib.Algebra.Module.GradedModule
import Mathlib.RingTheory.Ideal.AssociatedPrime
import Mathlib.RingTheory.Artinian
import Mathlib.Order.Height
2023-06-16 17:22:23 -05:00
import Mathlib.RingTheory.Ideal.Quotient
import Mathlib.RingTheory.SimpleModule
import Mathlib.Algebra.Module.LinearMap
import Mathlib.Algebra.Field.Defs
import CommAlg.krull
-- Setting for "library_search"
set_option maxHeartbeats 0
macro "ls" : tactic => `(tactic|library_search)
-- New tactic "obviously"
macro "obviously" : tactic =>
`(tactic| (
first
| dsimp; simp; done; dbg_trace "it was dsimp simp"
| simp; done; dbg_trace "it was simp"
| tauto; done; dbg_trace "it was tauto"
| simp; tauto; done; dbg_trace "it was simp tauto"
| rfl; done; dbg_trace "it was rfl"
| norm_num; done; dbg_trace "it was norm_num"
| /-change (@Eq _ _);-/ linarith; done; dbg_trace "it was linarith"
-- | gcongr; done
| ring; done; dbg_trace "it was ring"
| trivial; done; dbg_trace "it was trivial"
-- | nlinarith; done
2023-06-16 17:22:23 -05:00
| aesop; done; dbg_trace "it was aesop"
| fail "No, this is not obvious."))
open GradedMonoid.GSmul
open DirectSum
-- @Definitions (to be classified)
section
-- Definition of polynomail of type d
def PolyType (f : ) (d : ) := ∃ Poly : Polynomial , ∃ (N : ), ∀ (n : ), N ≤ n → f n = Polynomial.eval (n : ) Poly ∧ d = Polynomial.degree Poly
2023-06-16 17:22:23 -05:00
-- Make instance of M_i being an R_0-module
2023-06-15 00:10:22 -05:00
instance tada1 (𝒜 : → Type _) (𝓜 : → Type _) [∀ i, AddCommGroup (𝒜 i)] [∀ i, AddCommGroup (𝓜 i)] [DirectSum.GCommRing 𝒜]
[DirectSum.Gmodule 𝒜 𝓜] (i : ) : SMul (𝒜 0) (𝓜 i)
where smul x y := @Eq.rec (0+i) (fun a _ => 𝓜 a) (GradedMonoid.GSmul.smul x y) i (zero_add i)
lemma mylem (𝒜 : → Type _) (𝓜 : → Type _) [∀ i, AddCommGroup (𝒜 i)] [∀ i, AddCommGroup (𝓜 i)] [DirectSum.GCommRing 𝒜]
[h : DirectSum.Gmodule 𝒜 𝓜] (i : ) (a : 𝒜 0) (m : 𝓜 i) :
of _ _ (a • m) = of _ _ a • of _ _ m := by
refine' Eq.trans _ (Gmodule.of_smul_of 𝒜 𝓜 a m).symm
refine' of_eq_of_gradedMonoid_eq _
exact Sigma.ext (zero_add _).symm <| eq_rec_heq _ _
instance tada2 (𝒜 : → Type _) (𝓜 : → Type _) [∀ i, AddCommGroup (𝒜 i)] [∀ i, AddCommGroup (𝓜 i)] [DirectSum.GCommRing 𝒜]
[h : DirectSum.Gmodule 𝒜 𝓜] (i : ) : SMulWithZero (𝒜 0) (𝓜 i) := by
letI := SMulWithZero.compHom (⨁ i, 𝓜 i) (of 𝒜 0).toZeroHom
exact Function.Injective.smulWithZero (of 𝓜 i).toZeroHom Dfinsupp.single_injective (mylem 𝒜 𝓜 i)
instance tada3 (𝒜 : → Type _) (𝓜 : → Type _) [∀ i, AddCommGroup (𝒜 i)] [∀ i, AddCommGroup (𝓜 i)] [DirectSum.GCommRing 𝒜]
[h : DirectSum.Gmodule 𝒜 𝓜] (i : ): Module (𝒜 0) (𝓜 i) := by
letI := Module.compHom (⨁ j, 𝓜 j) (ofZeroRingHom 𝒜)
exact Dfinsupp.single_injective.module (𝒜 0) (of 𝓜 i) (mylem 𝒜 𝓜 i)
-- Definition of a Hilbert function of a graded module
section
2023-06-16 17:22:23 -05:00
noncomputable def length ( A : Type _) (M : Type _)
[CommRing A] [AddCommGroup M] [Module A M] := Set.chainHeight {M' : Submodule A M | M' < }
noncomputable def dimensionmodule ( A : Type _) (M : Type _)
[CommRing A] [AddCommGroup M] [Module A M] := Ideal.krullDim (A (( : Submodule A M).annihilator))
noncomputable def hilbert_function (𝒜 : → Type _) (𝓜 : → Type _) [∀ i, AddCommGroup (𝒜 i)] [∀ i, AddCommGroup (𝓜 i)]
[DirectSum.GCommRing 𝒜]
2023-06-16 17:22:23 -05:00
[DirectSum.Gmodule 𝒜 𝓜] (hilb : ) := ∀ i, hilb i = (ENat.toNat (length (𝒜 0) (𝓜 i)))
lemma lengthfield ( k : Type _) [Field k] : length (k) (k) = 1 := by
sorry
lemma equaldim ( A : Type _) [CommRing A] (I : Ideal A): dimensionmodule (A) (A I) = Ideal.krullDim (A I) := by
sorry
lemma dim_iso ( A : Type _) (M : Type _) (N : Type _) [CommRing A] [AddCommGroup M] [Module A M] [AddCommGroup N] [Module A N] (h : Nonempty (M →ₗ[A] N)) : dimensionmodule A M = dimensionmodule A N := by
sorry
end
-- Definition of homogeneous ideal
def Ideal.IsHomogeneous' (𝒜 : → Type _)
[∀ i, AddCommGroup (𝒜 i)] [DirectSum.GCommRing 𝒜]
(I : Ideal (⨁ i, 𝒜 i)) := ∀ (i : )
⦃r : (⨁ i, 𝒜 i)⦄, r ∈ I → DirectSum.of _ i ( r i : 𝒜 i) ∈ I
-- Definition of homogeneous prime ideal
def HomogeneousPrime (𝒜 : → Type _) [∀ i, AddCommGroup (𝒜 i)] [DirectSum.GCommRing 𝒜] (I : Ideal (⨁ i, 𝒜 i)):= (Ideal.IsPrime I) ∧ (Ideal.IsHomogeneous' 𝒜 I)
-- Definition of homogeneous maximal ideal
def HomogeneousMax (𝒜 : → Type _) [∀ i, AddCommGroup (𝒜 i)] [DirectSum.GCommRing 𝒜] (I : Ideal (⨁ i, 𝒜 i)):= (Ideal.IsMaximal I) ∧ (Ideal.IsHomogeneous' 𝒜 I)
--theorem monotone_stabilizes_iff_noetherian :
-- (∀ f : →o Submodule R M, ∃ n, ∀ m, n ≤ m → f n = f m) ↔ IsNoetherian R M := by
-- rw [isNoetherian_iff_wellFounded, WellFounded.monotone_chain_condition]
instance {𝒜 : → Type _} [∀ i, AddCommGroup (𝒜 i)] [DirectSum.GCommRing 𝒜] :
Algebra (𝒜 0) (⨁ i, 𝒜 i) :=
Algebra.ofModule'
(by
intro r x
sorry)
(by
intro r x
sorry)
2023-06-16 17:22:23 -05:00
2023-06-15 00:10:22 -05:00
class StandardGraded (𝒜 : → Type _) [∀ i, AddCommGroup (𝒜 i)] [DirectSum.GCommRing 𝒜] : Prop where
gen_in_first_piece :
Algebra.adjoin (𝒜 0) (DirectSum.of _ 1 : 𝒜 1 →+ ⨁ i, 𝒜 i).range = ( : Subalgebra (𝒜 0) (⨁ i, 𝒜 i))
-- Each component of a graded ring is an additive subgroup
def Component_of_graded_as_addsubgroup (𝒜 : → Type _)
[∀ i, AddCommGroup (𝒜 i)] [DirectSum.GCommRing 𝒜]
(p : Ideal (⨁ i, 𝒜 i)) (hp : Ideal.IsHomogeneous' 𝒜 p) (i : ) : AddSubgroup (𝒜 i) := by
sorry
2023-06-16 17:22:23 -05:00
def graded_ring_morphism (𝒜 : → Type _) ( : → Type _)
[∀ i, AddCommGroup (𝒜 i)] [∀ i, AddCommGroup ( i)]
[DirectSum.GCommRing 𝒜] [DirectSum.GCommRing ] (f : (⨁ i, 𝒜 i) →+* (⨁ i, i)) := ∀ i, ∀ (r : 𝒜 i), ∀ j, (j ≠ i → f (DirectSum.of _ i r) j = 0)
2023-06-15 01:35:46 -05:00
2023-06-16 17:22:23 -05:00
structure GradedLinearMap (𝒜 : → Type _) (𝓜 : → Type _) (𝓝 : → Type _)
[∀ i, AddCommGroup (𝒜 i)] [∀ i, AddCommGroup (𝓜 i)] [∀ i, AddCommGroup (𝓝 i)]
[DirectSum.GCommRing 𝒜] [DirectSum.Gmodule 𝒜 𝓜] [DirectSum.Gmodule 𝒜 𝓝]
extends LinearMap (RingHom.id (⨁ i, 𝒜 i)) (⨁ i, 𝓜 i) (⨁ i, 𝓝 i) where
respects_grading (i : ) (r : 𝓜 i) (j : ) : j ≠ i → toFun (DirectSum.of _ i r) j = 0
2023-06-15 01:35:46 -05:00
2023-06-16 17:22:23 -05:00
/-- `𝓜 →ᵍₗ[𝒜] 𝓝` denotes the type of graded `𝒜`-linear maps from `𝓜` to `𝓝`. -/
notation:25 𝓜 " →ᵍₗ[" 𝒜:25 "] " 𝓝:0 => GradedLinearMap 𝒜 𝓜 𝓝
2023-06-15 01:35:46 -05:00
2023-06-16 17:22:23 -05:00
structure GradedLinearEquiv (𝒜 : → Type _) (𝓜 : → Type _) (𝓝 : → Type _)
[∀ i, AddCommGroup (𝒜 i)] [∀ i, AddCommGroup (𝓜 i)] [∀ i, AddCommGroup (𝓝 i)]
[DirectSum.GCommRing 𝒜] [DirectSum.Gmodule 𝒜 𝓜][DirectSum.Gmodule 𝒜 𝓝]
extends (⨁ i, 𝓜 i) ≃ (⨁ i, 𝓝 i), 𝓜 →ᵍₗ[𝒜] 𝓝
2023-06-16 17:22:23 -05:00
/-- `𝓜 ≃ᵍₗ[𝒜] 𝓝` denotes the type of graded `𝒜`-linear isomorphisms from `(⨁ i, 𝓜 i)` to `(⨁ i, 𝓝 i)`. -/
notation:25 𝓜 " ≃ᵍₗ[" 𝒜:25 "] " 𝓝:0 => GradedLinearEquiv 𝒜 𝓜 𝓝
2023-06-16 17:22:23 -05:00
def graded_ring_isomorphism (𝒜 : → Type _) (𝓑 : → Type _)
[∀ i, AddCommGroup (𝒜 i)] [∀ i, AddCommGroup (𝓑 i)]
[DirectSum.GCommRing 𝒜] [DirectSum.GCommRing 𝓑]
(f : (⨁ i, 𝒜 i) →+* (⨁ i, 𝓑 i))
:= (graded_ring_morphism 𝒜 𝓑 f) ∧ (Function.Bijective f)
def graded_ring_isomorphic (𝒜 : → Type _) (𝓑 : → Type _)
[∀ i, AddCommGroup (𝒜 i)] [∀ i, AddCommGroup (𝓑 i)]
[DirectSum.GCommRing 𝒜] [DirectSum.GCommRing 𝓑] := ∃ (f : (⨁ i, 𝒜 i) →+* (⨁ i, 𝓑 i)), graded_ring_isomorphism 𝒜 𝓑 f
-- def graded_submodule
-- (𝒜 : → Type _) (𝓜 : → Type _) (𝓝 : → Type _)
-- [∀ i, AddCommGroup (𝒜 i)] [∀ i, AddCommGroup (𝓜 i)] [∀ i, AddCommGroup (𝓝 i)]
-- [DirectSum.GCommRing 𝒜] [DirectSum.Gmodule 𝒜 𝓜][DirectSum.Gmodule 𝒜 𝓝]
-- (h (⨁ i, 𝓝 i) : Submodule (⨁ i, 𝒜 i) (⨁ i, 𝓜 i)) :
-- Prop :=
-- ∃ (piece : Submodule (𝒜 0) (𝓜 i)), piece = 𝓝 i
end
2023-06-16 17:22:23 -05:00
class DirectSum.GalgebrA
(𝒜 : → Type _) [∀ i, AddCommGroup (𝒜 i)] [DirectSum.GCommRing 𝒜]
(𝓜 : → Type _) [∀ i, AddCommGroup (𝓜 i)] [DirectSum.GCommRing 𝓜]
extends DirectSum.Gmodule 𝒜 𝓜
2023-06-16 17:22:23 -05:00
-- def graded_algebra_morphism (𝒜 : → Type _) [∀ i, AddCommGroup (𝒜 i)] [DirectSum.GCommRing 𝒜]
-- (𝓜 : → Type _) [∀ i, AddCommGroup (𝓜 i)] [DirectSum.GCommRing 𝓜] [DirectSum.GalgebrA 𝒜 𝓜]
-- (𝓝 : → Type _) [∀ i, AddCommGroup (𝓝 i)] [DirectSum.GCommRing 𝓝] [DirectSum.GalgebrA 𝒜 𝓝]
-- (f : (⨁ i, 𝓜 i) → (⨁ i, 𝓝 i)) := (graded_ring_morphism 𝓜 𝓝 f) ∧ (GradedLinearMap 𝒜 𝓜 𝓝 toFun)
2023-06-16 17:22:23 -05:00
-- @Quotient of a graded ring R by a graded ideal p is a graded R-alg, preserving each component
2023-06-16 17:22:23 -05:00
instance Quotient_of_graded_gradedring
(𝒜 : → Type _) [∀ i, AddCommGroup (𝒜 i)] [DirectSum.GCommRing 𝒜]
(p : Ideal (⨁ i, 𝒜 i)) (hp : Ideal.IsHomogeneous' 𝒜 p) :
DirectSum.GCommRing (fun i => (𝒜 i)(Component_of_graded_as_addsubgroup 𝒜 p hp i)) := by
sorry
2023-06-15 01:35:46 -05:00
2023-06-16 17:22:23 -05:00
instance Quotient_of_graded_is_gradedalg
(𝒜 : → Type _) [∀ i, AddCommGroup (𝒜 i)] [DirectSum.GCommRing 𝒜]
(p : Ideal (⨁ i, 𝒜 i)) (hp : Ideal.IsHomogeneous' 𝒜 p) :
DirectSum.GalgebrA 𝒜 (fun i => (𝒜 i)(Component_of_graded_as_addsubgroup 𝒜 p hp i)) := by
sorry
2023-06-16 17:22:23 -05:00
section
variable (𝒜 : → Type _) [∀ i, AddCommGroup (𝒜 i)] [DirectSum.GCommRing 𝒜]
[LocalRing (𝒜 0)] (m : LocalRing.maximalIdeal (𝒜 0))
-- check if `Pi.Single` or something writes this more elegantly
def GradedOneComponent (i : ) : Type _ := ite (i = 0) (𝒜 0 LocalRing.maximalIdeal (𝒜 0)) PUnit
instance (i : ) : AddMonoid (GradedOneComponent 𝒜 i) := by
unfold GradedOneComponent
sorry -- split into 0 and nonzero cases and then `inferInstance`
instance : DirectSum.Gmodule 𝒜 (GradedOneComponent 𝒜) := by sorry
lemma Graded_local [StandardGraded 𝒜] (I : Ideal (⨁ i, 𝒜 i)) (hp : (HomogeneousMax 𝒜 I)) [∀ i, Module (𝒜 0) ((𝒜 i)(Component_of_graded_as_addsubgroup 𝒜 I hp.2 i))] (art: IsArtinianRing (𝒜 0)) : (∀ (i : ), (i ≠ 0 → Nonempty (((𝒜 i)(Component_of_graded_as_addsubgroup 𝒜 I hp.2 i)) →ₗ[𝒜 0] (𝒜 i))) ) := by
2023-06-15 01:35:46 -05:00
sorry
2023-06-16 17:22:23 -05:00
end
2023-06-15 01:35:46 -05:00
2023-06-16 17:22:23 -05:00
lemma Quotient_of_graded_ringiso (𝒜 : → Type _) [∀ i, AddCommGroup (𝒜 i)] [DirectSum.GCommRing 𝒜](p : Ideal (⨁ i, 𝒜 i)) (hp : Ideal.IsHomogeneous' 𝒜 p)
-- (hm : 𝓜 = (fun i => (𝒜 i)(Component_of_graded_as_addsubgroup 𝒜 p hp i)))
: Nonempty (((⨁ i, (𝒜 i))p) →ₗ[(⨁ i, 𝒜 i)] (⨁ i, (𝒜 i)(Component_of_graded_as_addsubgroup 𝒜 p hp i))) := by
sorry
2023-06-15 01:35:46 -05:00
2023-06-16 17:22:23 -05:00
def Is.Graded_local (𝒜 : → Type _)
[∀ i, AddCommGroup (𝒜 i)][DirectSum.GCommRing 𝒜] := ∃! ( I : Ideal ((⨁ i, 𝒜 i))),(HomogeneousMax 𝒜 I)
lemma hilfun_eq (𝒜 : → Type _) (𝓜 : → Type _) (𝓝 : → Type _)
[∀ i, AddCommGroup (𝒜 i)] [∀ i, AddCommGroup (𝓜 i)] [∀ i, AddCommGroup (𝓝 i)]
[DirectSum.GCommRing 𝒜] [DirectSum.Gmodule 𝒜 𝓜][DirectSum.Gmodule 𝒜 𝓝] (iso : GradedLinearEquiv 𝒜 𝓜 𝓝)(hilbm : ) (Hhilbm: hilbert_function 𝒜 𝓜 hilbm) (hilbn : ) (Hhilbn: hilbert_function 𝒜 𝓝 hilbn) : ∀ (n : ), hilbm n = hilbn n := by
sorry
-- If A_0 is Artinian and local, then A is graded local
2023-06-16 17:22:23 -05:00
-- @Existence of a chain of submodules of graded submoduels of a f.g graded R-mod M
lemma Exist_chain_of_graded_submodules (𝒜 : → Type _) (𝓜 : → Type _)
[∀ i, AddCommGroup (𝒜 i)] [∀ i, AddCommGroup (𝓜 i)]
[DirectSum.GCommRing 𝒜] [DirectSum.Gmodule 𝒜 𝓜]
(fingen : IsNoetherian (⨁ i, 𝒜 i) (⨁ i, 𝓜 i))
: ∃ (c : List (Submodule (⨁ i, 𝒜 i) (⨁ i, 𝓜 i))), c.Chain' (· < ·) ∧ ∀ M ∈ c, Ture := by
sorry
-- @[BH, 1.5.6 (b)(ii)]
-- An associated prime of a graded R-Mod M is graded
lemma Associated_prime_of_graded_is_graded
(𝒜 : → Type _) (𝓜 : → Type _)
[∀ i, AddCommGroup (𝒜 i)] [∀ i, AddCommGroup (𝓜 i)]
[DirectSum.GCommRing 𝒜] [DirectSum.Gmodule 𝒜 𝓜]
(p : associatedPrimes (⨁ i, 𝒜 i) (⨁ i, 𝓜 i))
: (Ideal.IsHomogeneous' 𝒜 p) ∧ ((∃ (i : ), ∃ (x : 𝒜 i), p = (Submodule.span (⨁ i, 𝒜 i) {DirectSum.of _ i x}).annihilator)) := by
sorry
-- @[BH, 4.1.3] when d ≥ 1
-- If M is a finite graed R-Mod of dimension d ≥ 1, then the Hilbert function H(M, n) is of polynomial type (d - 1)
theorem Hilbert_polynomial_d_ge_1 (d : ) (d1 : 1 ≤ d) (𝒜 : → Type _) (𝓜 : → Type _) [∀ i, AddCommGroup (𝒜 i)] [∀ i, AddCommGroup (𝓜 i)]
[DirectSum.GCommRing 𝒜]
2023-06-16 17:22:23 -05:00
[DirectSum.Gmodule 𝒜 𝓜] [StandardGraded 𝒜] (art: IsArtinianRing (𝒜 0)) (loc : LocalRing (𝒜 0))
(fingen : IsNoetherian (⨁ i, 𝒜 i) (⨁ i, 𝓜 i))
(findim : dimensionmodule (⨁ i, 𝒜 i) (⨁ i, 𝓜 i) = d)
(hilb : ) (Hhilb: hilbert_function 𝒜 𝓜 hilb)
: PolyType hilb (d - 1) := by
sorry
-- (reduced version) [BH, 4.1.3] when d ≥ 1
-- If M is a finite graed R-Mod of dimension d ≥ 1, and M = R 𝓅 for a graded prime ideal 𝓅, then the Hilbert function H(M, n) is of polynomial type (d - 1)
theorem Hilbert_polynomial_d_ge_1_reduced
(d : ) (d1 : 1 ≤ d)
(𝒜 : → Type _) (𝓜 : → Type _) [∀ i, AddCommGroup (𝒜 i)] [∀ i, AddCommGroup (𝓜 i)]
[DirectSum.GCommRing 𝒜]
2023-06-16 17:22:23 -05:00
[DirectSum.Gmodule 𝒜 𝓜] [StandardGraded 𝒜] (art: IsArtinianRing (𝒜 0)) (loc : LocalRing (𝒜 0))
(fingen : IsNoetherian (⨁ i, 𝒜 i) (⨁ i, 𝓜 i))
(findim : dimensionmodule (⨁ i, 𝒜 i) (⨁ i, 𝓜 i) = d)
(hilb : ) (Hhilb: hilbert_function 𝒜 𝓜 hilb)
(p : Ideal (⨁ i, 𝒜 i)) (hp : Ideal.IsHomogeneous' 𝒜 p)
(hm : 𝓜 = (fun i => (𝒜 i)(Component_of_graded_as_addsubgroup 𝒜 p hp i)))
: PolyType hilb (d - 1) := by
sorry
-- @[BH, 4.1.3] when d = 0
-- If M is a finite graed R-Mod of dimension zero, then the Hilbert function H(M, n) = 0 for n >> 0
theorem Hilbert_polynomial_d_0 (𝒜 : → Type _) (𝓜 : → Type _) [∀ i, AddCommGroup (𝒜 i)] [∀ i, AddCommGroup (𝓜 i)]
[DirectSum.GCommRing 𝒜]
2023-06-16 17:22:23 -05:00
[DirectSum.Gmodule 𝒜 𝓜] [StandardGraded 𝒜] (art: IsArtinianRing (𝒜 0)) (loc : LocalRing (𝒜 0))
(fingen : IsNoetherian (⨁ i, 𝒜 i) (⨁ i, 𝓜 i))
(findim : dimensionmodule (⨁ i, 𝒜 i) (⨁ i, 𝓜 i) = 0)
(hilb : ) (Hhilb : hilbert_function 𝒜 𝓜 hilb)
: (∃ (N : ), ∀ (n : ), n ≥ N → hilb n = 0) := by
2023-06-16 17:22:23 -05:00
sorry