/- Copyright 2026 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. -/ module public import Mathlib.LinearAlgebra.Dimension.Finite public import Mathlib.RingTheory.MvPolynomial.Homogeneous

Hilbert functions, lex ideals and ideals of pure powers

Let k be a field and let S = k[x₁, …, xₙ], graded by total degree, with the variables ordered by x₁ > x₂ > ⋯ > xₙ. This file defines the Hilbert function d ↦ dim_k I_d of an ideal I of S, monomial ideals, lex ideals, and the ideal generated by pure powers of the first c variables. The sum of a lex ideal and an ideal of pure powers is a lex-plus-powers ideal.

Main definitions

    MvPolynomial.hilbertFunction: the Hilbert function d ↦ dim_k I_d of an ideal I.

    MvPolynomial.IsMonomialIdeal: the ideal is generated by monomials.

    MvPolynomial.IsLexIdeal: a monomial ideal that, in each degree, contains every monomial that is lexicographically larger than one of its monomials.

    MvPolynomial.purePowersIdeal: the ideal (x₁ ^ d₁, …, x_c ^ d_c).

References

    C. A. Francisco, B. P. Richert, Lex-plus-powers ideals, in Syzygies and Hilbert functions, Lect. Notes Pure Appl. Math. 254, 113-144.

@[expose] public sectionnamespace MvPolynomialvariable {n : ℕ} {k : Type*} [Field k]

The Hilbert function of a homogeneous ideal I of $k[x_1, \dots, x_n]$, sending d to $\dim_k I_d$. This is finite, since $I_d$ is a subspace of the finite dimensional space $S_d$. Two homogeneous ideals have the same Hilbert function in this sense if and only if the graded quotients by them do, since $\dim_k (S/I)_d = \dim_k S_d - \dim_k I_d$.

noncomputable def hilbertFunction (I : Ideal (MvPolynomial (Fin n) k)) (d : ℕ) : ℕ := Module.finrank k ↥(Submodule.restrictScalars k I ⊓ homogeneousSubmodule (Fin n) k d)

An ideal of a polynomial ring is a monomial ideal if it is generated by monomials.

def IsMonomialIdeal (I : Ideal (MvPolynomial (Fin n) k)) : Prop := ∃ s : Set (Fin n →₀ ℕ), I = Ideal.span ((fun u => monomial u (1 : k)) '' s)

A lex ideal is a monomial ideal L such that for monomials u, v of the same degree with u larger than v in the lexicographic order, v ∈ L implies u ∈ L. Here the variables are ordered by $x_1 > x_2 > \dots > x_n$, which for exponent vectors is toLex.

def IsLexIdeal (L : Ideal (MvPolynomial (Fin n) k)) : Prop := IsMonomialIdeal L ∧ ∀ u v : Fin n →₀ ℕ, u.degree = v.degree → toLex v < toLex u → monomial v (1 : k) ∈ L → monomial u (1 : k) ∈ L

The ideal generated by the pure powers $x_1^{d_1}, \dots, x_c^{d_c}$.

noncomputable def purePowersIdeal {c : ℕ} (hc : c ≤ n) (d : Fin c → ℕ) : Ideal (MvPolynomial (Fin n) k) := Ideal.span (Set.range fun i : Fin c => (X (Fin.castLE hc i) : MvPolynomial (Fin n) k) ^ d i)

The zero ideal has Hilbert function zero.

All goals completed! 🐙

For c = 0 there are no pure powers, so purePowersIdeal is the zero ideal.

theorem purePowersIdeal_zero (hc : 0 ≤ n) (d : Fin 0 → ℕ) : (purePowersIdeal hc d : Ideal (MvPolynomial (Fin n) k)) = ⊥ := n:ℕk:Type u_1inst✝:Field khc:0 ≤ nd:Fin 0 → ℕ⊢ purePowersIdeal hc d = ⊥ All goals completed! 🐙

The unit ideal is a lex ideal.

n:ℕk:Type u_1inst✝:Field k⊢ 1 ∈ Ideal.span ((fun u ↦ (monomial u) 1) '' Set.univ) exact Ideal.subset_span ⟨0, Set.mem_univ 0, n:ℕk:Type u_1inst✝:Field k⊢ (fun u ↦ (monomial u) 1) 0 = 1 All goals completed! 🐙⟩end MvPolynomial