import Mathlib.RingTheory.GradedAlgebra.Basic import Mathlib.RingTheory.Derivation.Basic import Mathlib.Tactic namespace OAI /-! # A maximal degree shift detected on finitely many algebra generators For an integer-graded algebra, the values of a derivation on finitely many generators have only finitely many homogeneous components. Thus a nonzero derivation has a maximal degree shift which is attained on a generator. These lemmas supply the finite-support step in the leading-derivation construction of Sections 3 and 5 of the supplied manuscript. -/ namespace StableCoordinate namespace DerivationTopShift open DirectSum GradedAlgebra variable {k A ΞΉ : Type*} [CommRing k] [CommRing A] [Algebra k A] variable (π’œ : β„€ β†’ Submodule k A) [GradedAlgebra π’œ] /-- A nonzero element of an internally graded algebra has a nonzero homogeneous projection. -/ theorem exists_proj_ne_zero {a : A} (ha : a β‰  0) : βˆƒ j : β„€, proj π’œ j a β‰  0 := by classical by_contra! h apply ha apply (DirectSum.decompose π’œ).injective ext j simpa using h j /-- A nonzero derivation cannot vanish on all algebra generators. -/ theorem exists_generator_ne_zero (g : ΞΉ β†’ A) (hg : Algebra.adjoin k (Set.range g) = ⊀) (D : Derivation k A A) (hD : D β‰  0) : βˆƒ i, D (g i) β‰  0 := by by_contra! h apply hD apply Derivation.ext_of_adjoin_eq_top (Set.range g) hg intro a ha obtain ⟨i, rfl⟩ := ha simpa using h i variable [Fintype ΞΉ] /-- Finitely many generator images admit a maximal degree shift, and for a nonzero derivation the maximum is attained. No sign restriction is imposed on generator degrees or on the resulting shift. -/ theorem exists_maximal_generator_shift (g : ΞΉ β†’ A) (d : ΞΉ β†’ β„€) (hg : Algebra.adjoin k (Set.range g) = ⊀) (D : Derivation k A A) (hD : D β‰  0) : βˆƒ m : β„€, (βˆ€ i j, d i + m < j β†’ proj π’œ j (D (g i)) = 0) ∧ (βˆƒ i, proj π’œ (d i + m) (D (g i)) β‰  0) := by classical let S : Finset β„€ := Finset.univ.biUnion fun i => ((DirectSum.decompose π’œ (D (g i))).support).image (fun j => j - d i) have memS (i : ΞΉ) (j : β„€) (hj : proj π’œ j (D (g i)) β‰  0) : j - d i ∈ S := by apply Finset.mem_biUnion.mpr refine ⟨i, Finset.mem_univ _, ?_⟩ apply Finset.mem_image.mpr exact ⟨j, (GradedAlgebra.mem_support_iff π’œ _ _).mpr hj, rfl⟩ have hS : S.Nonempty := by obtain ⟨i, hi⟩ := exists_generator_ne_zero g hg D hD obtain ⟨j, hj⟩ := exists_proj_ne_zero π’œ hi exact ⟨j - d i, memS i j hj⟩ refine ⟨S.max' hS, ?_, ?_⟩ Β· intro i j hj by_contra hne have hle := Finset.le_max' S (j - d i) (memS i j hne) omega Β· have hm : S.max' hS ∈ S := Finset.max'_mem S hS obtain ⟨i, _, hi⟩ := Finset.mem_biUnion.mp hm obtain ⟨j, hj, heq⟩ := Finset.mem_image.mp hi refine ⟨i, ?_⟩ have hidx : d i + S.max' hS = j := by omega rw [hidx] exact (GradedAlgebra.mem_support_iff π’œ _ _).mp hj /-- For a family of homogeneous component derivations, vanishing outside the finite shift support can be tested solely on algebra generators. -/ theorem exists_maximal_component (g : ΞΉ β†’ A) (d : ΞΉ β†’ β„€) (hg : Algebra.adjoin k (Set.range g) = ⊀) (D : Derivation k A A) (hD : D β‰  0) (E : β„€ β†’ Derivation k A A) (hE : βˆ€ m i, E m (g i) = proj π’œ (d i + m) (D (g i))) : βˆƒ m : β„€, E m β‰  0 ∧ βˆ€ n, m < n β†’ E n = 0 := by obtain ⟨m, hbound, i, hi⟩ := exists_maximal_generator_shift π’œ g d hg D hD refine ⟨m, ?_, ?_⟩ Β· intro hzero apply hi rw [← hE, hzero] rfl Β· intro n hn apply Derivation.ext_of_adjoin_eq_top (Set.range g) hg intro a ha obtain ⟨i, rfl⟩ := ha rw [hE] exact hbound i (d i + n) (by omega) /-- Once homogeneous components are constructed, finite algebra generation provides a single upper degree-shift bound on every homogeneous input, with an attained nonzero top derivation. This is the hypothesis needed for the leading-component local-nilpotence argument. -/ theorem exists_top_component_and_global_bound (g : ΞΉ β†’ A) (d : ΞΉ β†’ β„€) (hg : Algebra.adjoin k (Set.range g) = ⊀) (hhom : βˆ€ i, g i ∈ π’œ (d i)) (D : Derivation k A A) (hD : D β‰  0) (E : β„€ β†’ Derivation k A A) (hE : βˆ€ m i (x : A), x ∈ π’œ i β†’ E m x = proj π’œ (i + m) (D x)) : βˆƒ m : β„€, E m β‰  0 ∧ (βˆ€ n, m < n β†’ E n = 0) ∧ (βˆ€ i (x : A), x ∈ π’œ i β†’ βˆ€ j, i + m < j β†’ proj π’œ j (D x) = 0) := by obtain ⟨m, hm, hmax⟩ := exists_maximal_component π’œ g d hg D hD E (fun m i => hE m (d i) (g i) (hhom i)) refine ⟨m, hm, hmax, ?_⟩ intro i x hx j hj have heq := hE (j - i) i x hx have hz := hmax (j - i) (by omega) rw [hz] at heq have hidx : i + (j - i) = j := by omega rw [hidx] at heq exact heq.symm end DerivationTopShift end StableCoordinate end OAI