Ideals in Multivariate Rings
Types
The OSCAR type for ideals in multivariate polynomial rings is of parametrized form MPolyIdeal{T}, where T is the element type of the polynomial ring.
Constructors
ideal — Methodideal(g::Vector{T}) where {T <: MPolyElem}
ideal(g::Vector{T}) where {T <: MPolyElem_dec}Given a vector g of polynomials in a polynomial ring R, say, return the ideal of R generated by these polynomials.
In the graded case, assure that the entries of g are homogeneous.
ideal(R::MPolyRing, g::Vector)Given a vector g of polynomials in R, return the ideal of R generated by these polynomials.
In the graded case, assure that the entries of g are homogeneous.
Examples
julia> R, (x, y) = PolynomialRing(QQ, ["x", "y"])
(Multivariate Polynomial Ring in x, y over Rational Field, fmpq_mpoly[x, y])
julia> I = ideal(R, [x*y-3*x,y^3-2*x^2*y])
ideal(x*y - 3*x, -2*x^2*y + y^3)
julia> typeof(I)
MPolyIdeal{fmpq_mpoly}
julia> S, (x, y) = GradedPolynomialRing(QQ, ["x", "y"], [1, 2])
(Multivariate Polynomial Ring in x, y over Rational Field graded by
x -> [1]
y -> [2], MPolyElem_dec{fmpq, fmpq_mpoly}[x, y])
julia> J = ideal(S, [(x^2+y)^2])
ideal(x^4 + 2*x^2*y + y^2)
julia> typeof(J)
MPolyIdeal{MPolyElem_dec{fmpq, fmpq_mpoly}}Gröbner Bases
Algorithmic means to deal with ideals in multivariate polynomial rings are provided by the concept of Gröbner bases and the workhorse of this concept, Buchberger's algorithm for computing Gröbner bases. For both the concept and the algorithm a convenient way of ordering the monomials appearing in multivariate polynomials and, thus, to distinguish leading terms of such polynomials is needed.
The performance of Buchberger's algorithm and the resulting Gröbner basis depend crucially on the choice of monomial ordering.
Monomial Orderings
Given a ring $R$, we write $R[x]=R[x_1, \ldots, x_n]$ for the polynomial ring over $R$ in the set of variables $x=\{x_1, \ldots, x_n\}$. Monomials in $x=\{x_1, \ldots, x_n\}$ are written using multi–indices: If $\alpha=(\alpha_1, \ldots, \alpha_n)\in \N^n$, set $x^\alpha=x_1^{\alpha_1}\cdots x_n^{\alpha_n}$ and
\[\text{Mon}_n(x) := \text{Mon}_n(x_1, \ldots, x_n) := \{x^\alpha \mid \alpha \in \N^n\}.\]
A monomial ordering on $\text{Mon}_n(x)$ is a total ordering $>$ on $\text{Mon}_n(x)$ such that
\[x^\alpha > x^\beta \Longrightarrow x^\gamma x^\alpha > x^\gamma x^\beta, \; \text{ for all }\; \alpha, \beta, \gamma \in \mathbb N^n.\]
A monomial ordering $>$ on $\text{Mon}_n(x)$ is called
- global if $x^\alpha > 1$ for all $\alpha \not = (0, \dots, 0)$,
- local if $x^\alpha < 1$ for all $\alpha \not = (0, \dots, 0)$, and
- mixed if it is neither global nor local.
We then also say that $>$ is a global , local, or mixed monomial ordering on $R[x]$.
Some monomial orderings are predefined in OSCAR.
Predefined Global Orderings
The Lexicographical Ordering
The lexicographical ordering lex is defined by setting
\[x^\alpha > x^\beta \; \Leftrightarrow \;\exists \; 1 \leq i \leq n: \alpha_1 = \beta_1, \dots, \alpha_{i-1} = \beta_{i-1}, \alpha_i > \beta_i.\]
The Degree Lexicographical Ordering
The degree lexicographical ordering deglex is defined by setting $\;\deg(x^\alpha) = \alpha_1 + \cdots + \alpha_n\;$ and
\[x^\alpha > x^\beta \; \Leftrightarrow \; \deg(x^\alpha) > \deg(x^\beta) \;\text{ or }\; \exists \; 1 \leq i \leq n: \alpha_1 = \beta_1, \dots, \alpha_{i-1} = \beta_{i-1}, \alpha_i > \beta_i.\]
The Reverse Lexicographical Ordering
The reverse lexicographical ordering revlex is defined by setting
\[x^\alpha > x^\beta \; \Leftrightarrow \;\exists \; 1 \leq i \leq n: \alpha_n = \beta_n, \dots, \alpha_{i+1} = \beta_{i+1}, \alpha_i > \beta_i.\]
The Degree Reverse Lexicographical Ordering
The degree reverse lexicographical ordering degrevlex is defined by setting $\;\deg(x^\alpha) = \alpha_1 + \cdots + \alpha_n\;$ and
\[x^\alpha > x^\beta \; \Leftrightarrow \; \deg(x^\alpha) > \deg(x^\beta) \;\text{ or }\;\exists \; 1 \leq i \leq n: \alpha_n = \beta_n, \dots, \alpha_{i+1} = \beta_{i+1}, \alpha_i < \beta_i.\]
Weighted Lexicographical Orderings
If W is a vector of positive integers $w_1, \dots, w_n$, the weighted lexicographical ordering wdeglex(W) is defined by setting $\;\text{wdeg}(x^\alpha) = w_1\alpha_1 + \cdots + w_n\alpha_n\;$ and
\[x^\alpha > x^\beta \; \Leftrightarrow \; \text{wdeg}(x^\alpha) > \text{wdeg}(x^\beta) \;\text{ or }\; \exists \; 1 \leq i \leq n: \alpha_1 = \beta_1, \dots, \alpha_{i-1} = \beta_{i-1}, \alpha_i > \beta_i.\]
Weighted Reverse Lexicographical Orderings
If W is a vector of positive integers $w_1, \dots, w_n$, the weighted reverse lexicographical ordering wdegrevlex(W) is defined by setting $\;\text{wdeg}(x^\alpha) = w_1\alpha_1 + \cdots + w_n\alpha_n\;$ and
\[x^\alpha > x^\beta \; \Leftrightarrow \; \text{wdeg}(x^\alpha) > \text{wdeg}(x^\beta) \;\text{ or }\;\exists \; 1 \leq i \leq n: \alpha_n = \beta_n, \dots, \alpha_{i+1} = \beta_{i+1}, \alpha_i < \beta_i.\]
Predefined Local Orderings
The Negative Lexicographical Ordering
The negative lexicographical ordering neglex is defined by setting
\[x^\alpha > x^\beta \; \Leftrightarrow \;\exists \; 1 \leq i \leq n: \alpha_1 = \beta_1, \dots, \alpha_{i-1} = \beta_{i-1}, \alpha_i < \beta_i.\]
The Negative Degree Lexicographical Ordering
The negative degree lexicographical ordering negdeglex is defined by setting $\;\deg(x^\alpha) = \alpha_1 + \cdots + \alpha_n\;$ and
\[x^\alpha > x^\beta \; \Leftrightarrow \; \deg(x^\alpha) < \deg(x^\beta) \;\text{ or }\; \exists \; 1 \leq i \leq n: \alpha_1 = \beta_1, \dots, \alpha_{i-1} = \beta_{i-1}, \alpha_i > \beta_i.\]
The Negative Reverse Lexicographical Ordering
The negative reverse lexicographical ordering negrevlex is defined by setting
\[x^\alpha > x^\beta \; \Leftrightarrow \;\exists \; 1 \leq i \leq n: \alpha_n = \beta_n, \dots, \alpha_{i+1} = \beta_{i+1}, \alpha_i < \beta_i.\]
The Negative Degree Reverse Lexicographical Ordering
The negative degree reverse lexicographical ordering negdegrevlex is defined by setting $\;\deg(x^\alpha) = \alpha_1 + \cdots + \alpha_n\;$ and
\[x^\alpha > x^\beta \; \Leftrightarrow \; \deg(x^\alpha) < \deg(x^\beta) \;\text{ or }\;\exists \; 1 \leq i \leq n: \alpha_n = \beta_n, \dots, \alpha_{i+1} = \beta_{i+1}, \alpha_i < \beta_i.\]
Negative Weighted Lexicographical Orderings
If W is a vector of positive integers $w_1, \dots, w_n$, the negative weighted lexicographical ordering negwdeglex(W) is defined by setting $\;\text{wdeg}(x^\alpha) = w_1\alpha_1 + \cdots + w_n\alpha_n\;$ and
\[x^\alpha > x^\beta \; \Leftrightarrow \; \text{wdeg}(x^\alpha) < \text{wdeg}(x^\beta) \;\text{ or }\; \exists \; 1 \leq i \leq n: \alpha_1 = \beta_1, \dots, \alpha_{i-1} = \beta_{i-1}, \alpha_i > \beta_i.\]
Negative Weighted Reverse Lexicographical Orderings
If W is a vector of positive integers $w_1, \dots, w_n$, the negative weighted reverse lexicographical ordering negwdegrevlex(W) is defined by setting $\;\text{wdeg}(x^\alpha) = w_1\alpha_1 + \cdots + w_n\alpha_n\;$ and
\[x^\alpha > x^\beta \; \Leftrightarrow \; \text{wdeg}(x^\alpha) < \text{wdeg}(x^\beta) \;\text{ or }\;\exists \; 1 \leq i \leq n: \alpha_n = \beta_n, \dots, \alpha_{i+1} = \beta_{i+1}, \alpha_i < \beta_i.\]
Creating Block Orderings
The concept of block orderings allows one to construct new monomial orderings from already given ones: If $>_1$ and $>_2$ are monomial orderings on $\text{Mon}_s(x_1, \ldots, x_s)$ and $\text{Mon}_{n-s}(x_{s+1}, \ldots, x_n)$, respectively, then the block ordering $>=(>_1, >_2)$ on $\text{Mon}_n(x)=\text{Mon}_n(x_1, \ldots, x_n)$ is defined by setting
\[x^\alpha>x^\beta \;\Leftrightarrow\; x_1^{\alpha_1}\cdots x_s^{\alpha_s} >_1 x_1^{\beta_1}\cdots x_s^{\beta_s} \;\text{ or }\; \bigl(x_1^{\alpha_1}\cdots x_s^{\alpha_s} = x_1^{\beta_1}\cdots x_s^{\beta_s} \text{ and } x_{s+1}^{\alpha_{s+1}}\cdots x_n^{\alpha_n} >_2 x_{s+1}^{\beta_{s+1}}\cdots x_n^{\beta_n}\bigr).\]
Note that $>=(>_1, >_2)$ is global (local) iff both $>_1$ and $>_2$ are global (local). Mixed orderings arise by choosing one of $>_1$ and $>_2$ global and the other one local.
Creating Matrix Orderings
Given a matrix $M\in \text{GL}(n,\mathbb R)$, with rows $m_1,\dots,m_n$, the matrix ordering defined by $M$ is obtained by setting
\[x^\alpha>_M x^\beta \Leftrightarrow \;\exists\; 1\leq i\leq n: m_1\alpha=m_1\beta,\ldots, m_{i-1}\alpha\ =m_{i-1}\beta,\ m_i\alpha>m_i\beta\]
(here, $\alpha$ and $\beta$ are regarded as column vectors).
By a theorem of Robbiano, every monomial ordering arises as a matrix ordering as above.
To create matrix orderings, OSCAR allows for matrices with integer coefficients as input matrices.
Functions for creating orderings
When computing Gröbner bases an ordering must be supplied. Standard Singular orderings, including block orderings, weighted orderings and local orderings are available.
The basic orderings are :lex, :revlex, :deglex, :degrevlex, :neglex, :negrevlex, :negdeglex, :negdegrevlex, :wdeglex, :wdegrevlex, :negwdeglex and :negwdegrevlex.
The orderings starting with w are weighted orderings.
The following functions exist for creating orderings:
lex — Methodlex(v::AbstractVector{<:MPolyElem}) -> MonomialOrderingDefines the lex (lexicographic) ordering on the variables given.
revlex — Methodrevlex(v::AbstractVector{<:MPolyElem}) -> MonomialOrderingDefines the revlex ordering on the variables given.
deglex — Methoddeglex(v::AbstractVector{<:MPolyElem}) -> MonomialOrderingDefines the deglex ordering on the variables given.
degrevlex — Methoddegrevlex(v::AbstractVector{<:MPolyElem}) -> MonomialOrderingDefines the degrevlex ordering on the variables given.
neglex — Methodneglex(v::AbstractVector{<:MPolyElem}) -> MonomialOrderingDefines the neglex ordering on the variables given.
negrevlex — Methodnegrevlex(v::AbstractVector{<:MPolyElem}) -> MonomialOrderingDefines the negrevlex ordering on the variables given.
negdeglex — Methodnegdeglex(v::AbstractVector{<:MPolyElem}) -> MonomialOrderingDefines the negdeglex ordering on the variables given.
negdegrevlex — Methodnegdegrevlex(v::AbstractVector{<:MPolyElem}) -> MonomialOrderingDefines the negdegrevlex ordering on the variables given.
monomial_ordering — Methodmonomial_ordering(v::AbstractVector{<:MPolyElem}, s::Symbol)Defines an ordering to be applied to the variables in v. The symbol s should be one of :lex, :deglex, :degrevlex, :revlex, :neglex, :negdeglex, :negdegrevlex, :negrevlex.
wdeglex — Methodwdeglex(v::AbstractVector{<:MPolyElem}, w::Vector{Int}) -> MonomialOrderingDefines the wdeglex ordering on the variables given with the weights w.
wdegrevlex — Methodwdegrevlex(v::AbstractVector{<:MPolyElem}, w::Vector{Int}) -> MonomialOrderingDefines the wdegrevlex ordering on the variables given with the weights w.
negwdeglex — Methodnegwdeglex(v::AbstractVector{<:MPolyElem}, w::Vector{Int}) -> MonomialOrderingDefines the negwdeglex ordering on the variables given with the weights w.
negwdegrevlex — Methodnegwdegrevlex(v::AbstractVector{<:MPolyElem}, w::Vector{Int}) -> MonomialOrderingDefines the negwdegrevlex ordering on the variables given with the weights w.
monomial_ordering — Methodmonomial_ordering(v::AbstractVector{<:MPolyElem}, s::Symbol, w::Vector{Int})Defines a weighted ordering to be applied to the variables in v. The weight vector w should be the same length as v, and the symbol s should be one of :wdeglex, :wdegrevlex, :negwdeglex, :negwdegrevlex.
matrix_ordering — Methodmatrix_ordering(v::AbstractVector{<:MPolyElem}, M::Union{Matrix{T}, MatElem{T}})Defines the matrix ordering on the variables given with the matrix M. The matrix need not be square nor have full row rank, thus the resulting ordering may be only a partial ordering on the given variables.
weighted_ordering — Methodweighted_ordering(v::AbstractVector{<:MPolyElem}, w::Vector{Int})Defines the (partial) weighted ordering on the variables given with the weight vector w. This is equivalent to a matrix ordering with just one row.
Block orderings can be obtained by concatening monomial orderings using the * operator. The following function can be used to convert Singular.jl orderings:
monomial_ordering — Methodmonomial_ordering(R::MPolyRing, ord::Singular.sordering)Return an ordering on R equivalent to the Singular.jl ordering ord.
Term over position and position over term module orderings are also available. These are also specified byy concatenation using the * operator. One creates the requisite module ordering (lex or revlex) for the generators of the free module.
Term over position is specified by appending the module ordering to the monomial ordering and position over term by prepending the module ordering.
Examples
julia> R, (x, y, s, t, u) = PolynomialRing(QQ, ["x", "y", "s", "t", "u"])(Multivariate Polynomial Ring in x, y, s, t, u over Rational Field, fmpq_mpoly[x, y, s, t, u])julia> O1 = degrevlex(gens(R))degrevlex([x, y, s, t, u])julia> O2 = lex([x, y])*deglex([s, t, u])lex([x, y])*deglex([s, t, u])julia> O3 = wdeglex(gens(R), [2, 3, 5, 7, 3])wdeglex([x, y, s, t, u], [2, 3, 5, 7, 3])julia> O4 = monomial_ordering(R, Singular.ordering_a([1,2,3,4,5])*Singular.ordering_rs(5))weighted_ordering([x, y, s, t, u], [1 2 3 4 5])*negrevlex([x, y, s, t, u])julia> K = FreeModule(R, 3)Free module of rank 3 over Multivariate Polynomial Ring in x, y, s, t, u over Rational Fieldjulia> O5 = revlex(gens(K))*degrevlex(gens(R))revlex([gen(1), gen(2), gen(3)])*degrevlex([x, y, s, t, u])
Normal Forms
normal_form — Methodnormal_form(f::T, J::MPolyIdeal) where { T <: MPolyElem }Compute the normal form of the polynomial f w.r.t. a Groebner basis of J.
CAVEAT: This computation needs a Groebner basis of J. If this Groebner basis is not available, one is computed automatically. This may take some time.
Examples
julia> R,(a,b,c) = PolynomialRing(QQ,["a","b","c"])
(Multivariate Polynomial Ring in a, b, c over Rational Field, fmpq_mpoly[a, b, c])
julia> J = ideal(R,[-1+c+b,-1+b+c*a+2*a*b])
ideal(b + c - 1, 2*a*b + a*c + b - 1)
julia> groebner_basis(J)
2-element Vector{fmpq_mpoly}:
b + c - 1
a*c - 2*a + c
julia> normal_form(-1+c+b+a^3, J)
a^3normal_form — Methodnormal_form(A::Vector{T}, J::MPolyIdeal) where { T <: MPolyElem }Compute the normal form of the elements of the array A w.r.t. a Groebner basis of J.
CAVEAT: This computation needs a Groebner basis of J. If this Groebner basis is not available, one is computed automatically. This may take some time.
Examples
julia> R,(a,b,c) = PolynomialRing(QQ,["a","b","c"])
(Multivariate Polynomial Ring in a, b, c over Rational Field, fmpq_mpoly[a, b, c])
julia> A = [-1+c+b+a^3,-1+b+c*a+2*a^3,5+c*b+c^2*a]
3-element Vector{fmpq_mpoly}:
a^3 + b + c - 1
2*a^3 + a*c + b - 1
a*c^2 + b*c + 5
julia> J = ideal(R,[-1+c+b,-1+b+c*a+2*a*b])
ideal(b + c - 1, 2*a*b + a*c + b - 1)
julia> groebner_basis(J)
2-element Vector{fmpq_mpoly}:
b + c - 1
a*c - 2*a + c
julia> normal_form(A, J)
3-element Vector{fmpq_mpoly}:
a^3
2*a^3 + 2*a - 2*c
4*a - 2*c^2 - c + 5Computing Gröbner Bases
groebner_basis — Methodfunction groebner_basis(I::MPolyIdeal;
ordering::MonomialOrdering = default_ordering(base_ring(I)),
complete_reduction::Bool = false, enforce_global_ordering::Bool = true)Given an ideal I and optional parameters monomial ordering ordering and complete_reduction, compute a Groebner basis (if complete_reduction = true the reduced Groebner basis) of I w.r.t. the given monomial ordering ordering (as default degree reverse lexicographical). If enforce_global_ordering = false it is not checked whether the given ordering is global.
Examples
julia> R, (x, y) = PolynomialRing(QQ, ["x", "y"])
(Multivariate Polynomial Ring in x, y over Rational Field, fmpq_mpoly[x, y])
julia> I = ideal([x*y-3*x,y^3-2*x^2*y])
ideal(x*y - 3*x, -2*x^2*y + y^3)
julia> H = groebner_basis(I, ordering=lex(gens(R)))
3-element Vector{fmpq_mpoly}:
y^4 - 3*y^3
x*y - 3*x
6*x^2 - y^3std_basis — Methodstd_basis(I::MPolyIdeal, o::MonomialOrdering)Compute a standard basis of I for the monomial ordering o.
Note: Since there is no general notion of complete reduction for non-global orderings, this option is not available for this command; instead, use groebner_basis directly.
Examples
julia> R,(x,y) = PolynomialRing(QQ, ["x","y"])
(Multivariate Polynomial Ring in x, y over Rational Field, fmpq_mpoly[x, y])
julia> I = ideal([x*(x+1), x^2-y^2+(x-2)*y])
ideal(x^2 + x, x^2 + x*y - y^2 - 2*y)
julia> std_basis(I, negdegrevlex(gens(R)))
2-element Vector{fmpq_mpoly}:
x
ySee e.g. Gert-Martin Greuel, Gerhard Pfister (2008) for the theoretical background on Groebner- and standard bases.
Gröbner Bases with transformation matrix
groebner_basis_with_transformation_matrix — Methodgroebner_basis_with_transformation_matrix(I::MPolyIdeal; ordering::MonomialOrdering = default_ordering(base_ring(I)), complete_reduction::Bool=false)Return a pair G, m where G is a Groebner basis of the ideal I with respect to the monomial ordering ordering (as default degree reverse lexicographical), and m is a transformation matrix from gens(I)toG. If complete_reductionis set to true (as default 'false') then G will be the reduced Groebner basis.
Examples
julia> R,(x,y) = PolynomialRing(QQ,["x","y"])
(Multivariate Polynomial Ring in x, y over Rational Field, fmpq_mpoly[x, y])
julia> I = ideal([x*y^2-1,x^3+y^2+x*y])
ideal(x*y^2 - 1, x^3 + x*y + y^2)
julia> G,m = groebner_basis_with_transformation_matrix(I)
(fmpq_mpoly[x*y^2 - 1, x^3 + x*y + y^2, x^2 + y^4 + y], [1 0 -x^2-y; 0 1 y^2])
julia> gens(I)*m == G
true
fglm
Gröbner walks
Hilbert-drivenThe following functions are low-level implementations of various Gröbner basis algorithms with many adjustable arguments. Only use these functions directly if you know what you are doing.
f4 — Methodf4(I::MPolyIdeal, <keyword arguments>)Compute a Groebner basis of the given ideal I w.r.t. to the degree reverse lexicographical monomial ordering using Faugère's F4 algorithm. See Jean-Charles Faugère (1999) for more information.
Note: At the moment only ground fields of characteristic p, p prime, p < 2^{31} are supported.
Arguments
Ì::MPolyIdeal: input ideal.initial_hts::Int=17: initial hash table sizelog_2.nr_thrds::Int=1: number of threads for parallel linear algebra.max_nr_pairs::Int=0: maximal number of pairs per matrix, only bounded by minimal degree if0.la_option::Int=2: linear algebra option: exact sparse-dense (1), exact sparse (2, default), probabilistic sparse-dense (42), probabilistic sparse(44).eliminate::Int=0: size of first block of variables to be eliminated.complete_reduction::Bool=true: compute a reduced Gröbner basis forIinfo_level::Int=0: info level printout: off (0, default), summary (1), detailed (2).
Examples
julia> R,(x,y,z) = PolynomialRing(GF(101), ["x","y","z"], ordering=:degrevlex)
(Multivariate Polynomial Ring in x, y, z over Galois field with characteristic 101, gfp_mpoly[x, y, z])
julia> I = ideal(R, [x+2*y+2*z-1, x^2+2*y^2+2*z^2-x, 2*x*y+2*y*z-y])
ideal(x + 2*y + 2*z + 100, x^2 + 2*y^2 + 2*z^2 + 100*x, 2*x*y + 2*y*z + 100*y)
julia> f4(I)
4-element Vector{gfp_mpoly}:
x + 2*y + 2*z + 100
y*z + 82*z^2 + 10*y + 40*z
y^2 + 60*z^2 + 20*y + 81*z
z^3 + 28*z^2 + 64*y + 13*z
julia> isdefined(I, :gb)
trueLeading Ideals
leading_ideal — Methodleading_ideal(g::Vector{T}; ordering::MonomialOrdering) where { T <: MPolyElem }Return the ideal generated by the leading monomials of the given polynomials w.r.t. the given monomial ordering.
Examples
julia> R, (x, y) = PolynomialRing(QQ, ["x", "y"])
(Multivariate Polynomial Ring in x, y over Rational Field, fmpq_mpoly[x, y])
julia> L = leading_ideal([x*y^2-3*x, x^3-14*y^5], ordering=degrevlex(gens(R)))
ideal(x*y^2, y^5)
julia> L = leading_ideal([x*y^2-3*x, x^3-14*y^5], ordering=lex(gens(R)))
ideal(x*y^2, x^3)leading_ideal — Methodleading_ideal(I::MPolyIdeal; ordering::MonomialOrdering)Given a multivariate polynomial ideal Ì this function returns the leading ideal for I. This is done w.r.t. the given monomial ordering.
Examples
julia> R, (x, y) = PolynomialRing(QQ, ["x", "y"])
(Multivariate Polynomial Ring in x, y over Rational Field, fmpq_mpoly[x, y])
julia> I = ideal(R,[x*y^2-3*x, x^3-14*y^5])
ideal(x*y^2 - 3*x, x^3 - 14*y^5)
julia> L = leading_ideal(I, ordering=degrevlex(gens(R)))
ideal(x*y^2, x^4, y^5)
julia> L = leading_ideal(I, ordering=lex(gens(R)))
ideal(y^7, x*y^2, x^3)Gröbner Bases over the integers
Over the integers the coefficients of the polynomials are not invertible, thus their handling when computing Gröbner bases and normal forms plays an important role. This is done when computing strong Gröbner bases which ensure the following property: For any element of an ideal its leading term is divisible by a leading term of an element of a corresponding strong Gröbner basis.
The textbook William W. Adams, Philippe Loustaunau (1994) provides details on theory and algorithms as well as references.
julia> R, (x,y) = PolynomialRing(ZZ, ["x","y"])(Multivariate Polynomial Ring in x, y over Integer Ring, fmpz_mpoly[x, y])julia> I = ideal(R, [2x,3x,4y])ideal(2*x, 3*x, 4*y)julia> H = groebner_basis(I)2-element Vector{fmpz_mpoly}: 4*y x
Syzygies
Generators of syzygies
syzygy_generators — Methodsyzygy_generators(a::Vector{<:MPolyElem})Return generators for the syzygies on the given polynomials.
Examples
julia> R, (x, y) = PolynomialRing(QQ, ["x", "y"])
(Multivariate Polynomial Ring in x, y over Rational Field, fmpq_mpoly[x, y])
julia> S = syzygy_generators([x^3+y+2,x*y^2-13*x^2,y-14])
3-element Vector{FreeModElem{fmpq_mpoly}}:
(-y + 14)*e[2] + (-13*x^2 + x*y^2)*e[3]
(-169*y + 2366)*e[1] + (-13*x*y + 182*x - 196*y + 2744)*e[2] + (13*x^2*y^2 - 2548*x^2 + 196*x*y^2 + 169*y + 338)*e[3]
(-13*x^2 + 196*x)*e[1] + (-x^3 - 16)*e[2] + (x^4*y + 14*x^4 + 13*x^2 + 16*x*y + 28*x)*e[3]Data Associated to Ideals
Basic Data
If I is an ideal of a multivariate polynomial ring R, then
base_ring(I)refers toI,gens(I)to the generators ofI,ngens(I)to the number of these generators, andgen(I, k)as well asI[k]to thek-th such generator.
Examples
julia> R, (x, y) = PolynomialRing(QQ, ["x", "y"])(Multivariate Polynomial Ring in x, y over Rational Field, fmpq_mpoly[x, y])julia> I = ideal(R, [x, y])^2ideal(x^2, x*y, y^2)julia> base_ring(I)Multivariate Polynomial Ring in x, y over Rational Fieldjulia> gens(I)3-element Vector{fmpq_mpoly}: x^2 x*y y^2julia> ngens(I)3julia> gen(I, 2)x*yjulia> x*yx*y
Dimension
dim — Methoddim(I::MPolyIdeal)Return the Krull dimension of I.
Examples
julia> R, (x, y, z) = PolynomialRing(QQ, ["x", "y", "z"])
(Multivariate Polynomial Ring in x, y, z over Rational Field, fmpq_mpoly[x, y, z])
julia> I = ideal(R, [y-x^2, x-z^3])
ideal(-x^2 + y, x - z^3)
julia> dim(I)
1Codimension
codim — Methodcodim(I::MPolyIdeal)Return the codimension of I.
Examples
julia> R, (x, y, z) = PolynomialRing(QQ, ["x", "y", "z"])
(Multivariate Polynomial Ring in x, y, z over Rational Field, fmpq_mpoly[x, y, z])
julia> I = ideal(R, [y-x^2, x-z^3])
ideal(-x^2 + y, x - z^3)
julia> codim(I)
2Minimal Sets of Generators
In the graded case, we have:
minimal_generating_set — Methodminimal_generating_set(I::MPolyIdeal{<:MPolyElem_dec})Given a homogeneous ideal I in a graded multivariate polynomial ring over a field, return an array containing a minimal set of generators of I.
Examples
julia> R, (x, y, z) = GradedPolynomialRing(QQ, ["x", "y", "z"]);
julia> V = [x, z^2, x^3+y^3, y^4, y*z^5];
julia> I = ideal(R, V)
ideal(x, z^2, x^3 + y^3, y^4, y*z^5)
julia> minimal_generating_set(I)
3-element Vector{MPolyElem_dec{fmpq, fmpq_mpoly}}:
x
z^2
x^3 + y^3Operations on Ideals
Simple Ideal Operations
Powers of Ideal
^ — Method:^(I::MPolyIdeal, m::Int)Return the m-th power of I.
Examples
julia> R, (x, y, z) = PolynomialRing(QQ, ["x", "y", "z"])
(Multivariate Polynomial Ring in x, y, z over Rational Field, fmpq_mpoly[x, y, z])
julia> I = ideal(R, [x, y])
ideal(x, y)
julia> I^3
ideal(x^3, x^2*y, x*y^2, y^3)Sum of Ideals
+ — Method:+(I::MPolyIdeal{T}, J::MPolyIdeal{T}) where TReturn the sum of I and J.
Examples
julia> R, (x, y, z) = PolynomialRing(QQ, ["x", "y", "z"])
(Multivariate Polynomial Ring in x, y, z over Rational Field, fmpq_mpoly[x, y, z])
julia> I = ideal(R, [x, y])
ideal(x, y)
julia> J = ideal(R, [z^2])
ideal(z^2)
julia> I+J
ideal(x, y, z^2)Product of Ideals
* — Method:*(I::MPolyIdeal{T}, J::MPolyIdeal{T}) where TReturn the product of I and J.
Examples
julia> R, (x, y, z) = PolynomialRing(QQ, ["x", "y", "z"])
(Multivariate Polynomial Ring in x, y, z over Rational Field, fmpq_mpoly[x, y, z])
julia> I = ideal(R, [x, y])
ideal(x, y)
julia> J = ideal(R, [z^2])
ideal(z^2)
julia> I*J
ideal(x*z^2, y*z^2)Intersection of Ideals
intersect — Methodintersect(I::MPolyIdeal{T}, Js::MPolyIdeal{T}...) where TReturn the intersection of two or more ideals.
Examples
julia> R, (x, y) = PolynomialRing(QQ, ["x", "y"])
(Multivariate Polynomial Ring in x, y over Rational Field, fmpq_mpoly[x, y])
julia> I = intersect(ideal(R, [x, y])^2, ideal(R, [y^2-x^3+x]))
ideal(x^3*y - x*y - y^3, x^4 - x^2 - x*y^2)Ideal Quotients
Given two ideals $I, J$ of a ring $R$, the ideal quotient of $I$ by $J$ is the ideal
\[I:J= \bigl\{f \in R\:\big|\: f J \subset I\bigr\}\subset R.\]
quotient — Methodquotient(I::MPolyIdeal{T}, J::MPolyIdeal{T}) where TReturn the ideal quotient of I by J. Alternatively, use I:J.
quotient(I::MPolyIdeal{T}, f::MPolyElem{T}) where TReturn the ideal quotient of I by the ideal generated by f. Alternatively, use I:f.
Examples
julia> R, (x, y, z) = PolynomialRing(QQ, ["x", "y", "z"])
(Multivariate Polynomial Ring in x, y, z over Rational Field, fmpq_mpoly[x, y, z])
julia> I = ideal(R, [x^4+x^2*y*z+y^3*z, y^4+x^3*z+x*y^2*z, x^3*y+x*y^3])
ideal(x^4 + x^2*y*z + y^3*z, x^3*z + x*y^2*z + y^4, x^3*y + x*y^3)
julia> J = ideal(R, [x, y, z])^2
ideal(x^2, x*y, x*z, y^2, y*z, z^2)
julia> L = quotient(I, J)
ideal(x^3*z + x*y^2*z + y^4, x^3*y + x*y^3, x^4 + x^2*y*z + y^3*z, x^3*z^2 - x^2*y*z^2 + x*y^2*z^2 - y^3*z^2, x^2*y^2*z - x^2*y*z^2 - y^3*z^2, x^3*z^2 + x^2*y^3 - x^2*y^2*z + x*y^2*z^2)
julia> I:J
ideal(x^3*z + x*y^2*z + y^4, x^3*y + x*y^3, x^4 + x^2*y*z + y^3*z, x^3*z^2 - x^2*y*z^2 + x*y^2*z^2 - y^3*z^2, x^2*y^2*z - x^2*y*z^2 - y^3*z^2, x^3*z^2 + x^2*y^3 - x^2*y^2*z + x*y^2*z^2)
julia> I:x
ideal(x^2*y + y^3, x^3*z + x*y^2*z + y^4, x^2*z^2 + x*y^3 - x*y^2*z + y^2*z^2, x^4, x^3*z^2 - x^2*z^3 + 2*x*y^2*z^2 - y^2*z^3, -x^2*z^4 + x*y^2*z^3 - y^2*z^4)Saturation
Given two ideals $I, J$ of a ring $R$, the saturation of $I$ with respect to $J$ is the ideal
\[I:J^{\infty} = \bigl\{ f \in R \:\big|\: f J^k \!\subset I {\text{ for some }}k\geq 1 \bigr\} = \textstyle{\bigcup\limits_{k=1}^{\infty} (I:J^k)}.\]
saturation — Methodsaturation(I::MPolyIdeal{T}, J::MPolyIdeal{T}) where TReturn the saturation of I with respect to J.
Examples
julia> R, (x, y, z) = PolynomialRing(QQ, ["x", "y", "z"])
(Multivariate Polynomial Ring in x, y, z over Rational Field, fmpq_mpoly[x, y, z])
julia> I = ideal(R, [z^3, y*z^2, x*z^2, y^2*z, x*y*z, x^2*z, x*y^2, x^2*y])
ideal(z^3, y*z^2, x*z^2, y^2*z, x*y*z, x^2*z, x*y^2, x^2*y)
julia> J = ideal(R, [x, y, z])
ideal(x, y, z)
julia> K = saturation(I, J)
ideal(z, x*y)saturation_with_index — Methodsaturation_with_index(I::MPolyIdeal{T}, J::MPolyIdeal{T}) where TReturn $I:J^{\infty}$ together with the smallest integer $m$ such that $I:J^m = I:J^{\infty}$.
Examples
julia> R, (x, y, z) = PolynomialRing(QQ, ["x", "y", "z"])
(Multivariate Polynomial Ring in x, y, z over Rational Field, fmpq_mpoly[x, y, z])
julia> I = ideal(R, [z^3, y*z^2, x*z^2, y^2*z, x*y*z, x^2*z, x*y^2, x^2*y])
ideal(z^3, y*z^2, x*z^2, y^2*z, x*y*z, x^2*z, x*y^2, x^2*y)
julia> J = ideal(R, [x, y, z])
ideal(x, y, z)
julia> K, m = saturation_with_index(I, J)
(ideal(z, x*y), 2)Elimination
eliminate — Methodeliminate(I::MPolyIdeal{T}, l::Vector{T}) where T <: MPolyElemGiven a vector l of polynomials which are variables, these variables are eliminated from I. That is, return the ideal of all polynomials in I which only depend on the remaining variables.
eliminate(I::MPolyIdeal, l::AbstractVector{Int})Given a vector l of indices which specify variables, these variables are eliminated from I. That is, return the ideal of all polynomials in I which only depend on the remaining variables.
Examples
julia> R, (t, x, y, z) = PolynomialRing(QQ, ["t", "x", "y", "z"])
(Multivariate Polynomial Ring in t, x, y, z over Rational Field, fmpq_mpoly[t, x, y, z])
julia> I = ideal(R, [t-x, t^2-y, t^3-z])
ideal(t - x, t^2 - y, t^3 - z)
julia> A = [t]
1-element Vector{fmpq_mpoly}:
t
julia> TC = eliminate(I, A)
ideal(-x*z + y^2, x*y - z, x^2 - y)
julia> A = [1]
1-element Vector{Int64}:
1
julia> TC = eliminate(I, A)
ideal(-x*z + y^2, x*y - z, x^2 - y)Tests on Ideals
Basic Tests
iszero — Methodiszero(I::MPolyIdeal)Return true if I is the zero ideal, false otherwise.
Examples
julia> R, (x, y) = PolynomialRing(QQ, ["x", "y"])
(Multivariate Polynomial Ring in x, y over Rational Field, fmpq_mpoly[x, y])
julia> I = ideal(R, y-x^2)
ideal(-x^2 + y)
julia> iszero(I)
falseisone — Methodisone(I::MPolyIdeal)Return true if I is generated by 1, false otherwise.
Examples
julia> R, (x, y) = PolynomialRing(QQ, ["x", "y"])
(Multivariate Polynomial Ring in x, y over Rational Field, fmpq_mpoly[x, y])
julia> I = ideal(R, [x, x + y, y - 1])
ideal(x, x + y, y - 1)
julia> isone(I)
trueis_monomial — Methodis_monomial(f::MPolyElem)Return true if f is a monomial, false otherwise.
is_monomial(I::MPolyIdeal)Return true if I can be generated by monomials, false otherwise.
Examples
julia> R, (x, y) = PolynomialRing(QQ, ["x", "y"])
(Multivariate Polynomial Ring in x, y over Rational Field, fmpq_mpoly[x, y])
julia> f = 2*x+y
2*x + y
julia> g = y
y
julia> is_monomial(f)
false
julia> is_monomial(g)
true
julia> is_monomial(ideal(R, [f, g]))
trueContainment of Ideals
issubset — Methodissubset(I::MPolyIdeal{T}, J::MPolyIdeal{T}) where TReturn true if I is contained in J, false otherwise.
Examples
julia> R, (x, y) = PolynomialRing(QQ, ["x", "y"])
(Multivariate Polynomial Ring in x, y over Rational Field, fmpq_mpoly[x, y])
julia> I = ideal(R, [x^2])
ideal(x^2)
julia> J = ideal(R, [x, y])^2
ideal(x^2, x*y, y^2)
julia> issubset(I, J)
trueEquality of Ideals
== — Method==(I::MPolyIdeal{T}, J::MPolyIdeal{T}) where TReturn true if I is equal to J, false otherwise.
Examples
julia> R, (x, y) = PolynomialRing(QQ, ["x", "y"])
(Multivariate Polynomial Ring in x, y over Rational Field, fmpq_mpoly[x, y])
julia> I = ideal(R, [x^2])
ideal(x^2)
julia> J = ideal(R, [x, y])^2
ideal(x^2, x*y, y^2)
julia> I == J
falseIdeal Membership
ideal_membership — Methodideal_membership(f::T, I::MPolyIdeal{T}) where TReturn true if f is contained in I, false otherwise. Alternatively, use f in I.
Examples
julia> R, (x, y) = PolynomialRing(QQ, ["x", "y"])
(Multivariate Polynomial Ring in x, y over Rational Field, fmpq_mpoly[x, y])
julia> f = x^2
x^2
julia> I = ideal(R, [x, y])^2
ideal(x^2, x*y, y^2)
julia> ideal_membership(f, I)
true
julia> g = x
x
julia> g in I
falseRadical Membership
radical_membership — Methodradical_membership(f::T, I::MPolyIdeal{T}) where TReturn true if f is contained in the radical of I, false otherwise. Alternatively, use inradical(f, I).
Examples
julia> R, (x,) = PolynomialRing(QQ, ["x"])
(Multivariate Polynomial Ring in x over Rational Field, fmpq_mpoly[x])
julia> f = x
x
julia> I = ideal(R, [x^2])
ideal(x^2)
julia> radical_membership(f, I)
true
julia> g = x+1
x + 1
julia> inradical(g, I)
falsePrimality Test
is_prime — Methodis_prime(I::MPolyIdeal)Return true if I is prime, false otherwise.
The function computes the minimal asscociated primes of I. This may take some time.
Examples
julia> R, (x, y) = PolynomialRing(QQ, ["x", "y"])
(Multivariate Polynomial Ring in x, y over Rational Field, fmpq_mpoly[x, y])
julia> I = ideal(R, [x, y])^2
ideal(x^2, x*y, y^2)
julia> is_prime(I)
falsePrimary Test
is_primary — Methodis_primary(I::MPolyIdeal)Return true if I is primary, false otherwise.
The function computes a primary decomposition of I. This may take some time.
Examples
julia> R, (x, y) = PolynomialRing(QQ, ["x", "y"])
(Multivariate Polynomial Ring in x, y over Rational Field, fmpq_mpoly[x, y])
julia> I = ideal(R, [x, y])^2
ideal(x^2, x*y, y^2)
julia> is_primary(I)
trueDecomposition of Ideals
We discuss various decomposition techniques. They are implemented for polynomial rings over fields and, if explicitly mentioned, also for polynomial rings over the integers. See Wolfram Decker, Gert-Martin Greuel, Gerhard Pfister (1999) for a survey.
Radical
radical — Methodradical(I::MPolyIdeal)Return the radical of I.
Implemented Algorithms
If the base ring of I is a polynomial ring over a field, a combination of the algorithms of Krick and Logar (with modifications by Laplagne) and Kemper is used. For polynomial rings over the integers, the algorithm proceeds as suggested by Pfister, Sadiq, and Steidel. See Teresa Krick, Alessandro Logar (1991), Gregor Kemper (2002), and Gerhard Pfister, Afshan Sadiq, Stefan Steidel (2011).
Examples
julia> R, (x, y) = PolynomialRing(QQ, ["x", "y"])
(Multivariate Polynomial Ring in x, y over Rational Field, fmpq_mpoly[x, y])
julia> I = intersect(ideal(R, [x, y])^2, ideal(R, [y^2-x^3+x]))
ideal(x^3*y - x*y - y^3, x^4 - x^2 - x*y^2)
julia> I = intersect(I, ideal(R, [x-y-1])^2)
ideal(x^5*y - 2*x^4*y^2 - 2*x^4*y + x^3*y^3 + 2*x^3*y^2 - x^2*y^3 + 2*x^2*y^2 + 2*x^2*y + 2*x*y^4 + x*y^3 - 2*x*y^2 - x*y - y^5 - 2*y^4 - y^3, x^6 - 2*x^5 - 3*x^4*y^2 - 2*x^4*y + 2*x^3*y^3 + 3*x^3*y^2 + 2*x^3*y + 2*x^3 + 5*x^2*y^2 + 2*x^2*y - x^2 + 3*x*y^4 - 5*x*y^2 - 2*x*y - 2*y^5 - 4*y^4 - 2*y^3)
julia> RI = radical(I)
ideal(x^4 - x^3*y - x^3 - x^2 - x*y^2 + x*y + x + y^3 + y^2)julia> R, (a, b, c, d) = PolynomialRing(ZZ, ["a", "b", "c", "d"])
(Multivariate Polynomial Ring in a, b, c, d over Integer Ring, fmpz_mpoly[a, b, c, d])
julia> I = intersect(ideal(R, [9,a,b]), ideal(R, [3,c]))
ideal(9, 3*b, 3*a, b*c, a*c)
julia> I = intersect(I, ideal(R, [11,2a,7b]))
ideal(99, 3*b, 3*a, b*c, a*c)
julia> I = intersect(I, ideal(R, [13a^2,17b^4]))
ideal(39*a^2, 13*a^2*c, 51*b^4, 17*b^4*c, 3*a^2*b^4, a^2*b^4*c)
julia> I = intersect(I, ideal(R, [9c^5,6d^5]))
ideal(78*a^2*d^5, 117*a^2*c^5, 102*b^4*d^5, 153*b^4*c^5, 6*a^2*b^4*d^5, 9*a^2*b^4*c^5, 39*a^2*c^5*d^5, 51*b^4*c^5*d^5, 3*a^2*b^4*c^5*d^5)
julia> I = intersect(I, ideal(R, [17,a^15,b^15,c^15,d^15]))
ideal(1326*a^2*d^5, 1989*a^2*c^5, 102*b^4*d^5, 153*b^4*c^5, 663*a^2*c^5*d^5, 51*b^4*c^5*d^5, 78*a^2*d^15, 117*a^2*c^15, 78*a^15*d^5, 117*a^15*c^5, 6*a^2*b^4*d^15, 9*a^2*b^4*c^15, 39*a^2*c^5*d^15, 39*a^2*c^15*d^5, 6*a^2*b^15*d^5, 9*a^2*b^15*c^5, 6*a^15*b^4*d^5, 9*a^15*b^4*c^5, 39*a^15*c^5*d^5, 3*a^2*b^4*c^5*d^15, 3*a^2*b^4*c^15*d^5, 3*a^2*b^15*c^5*d^5, 3*a^15*b^4*c^5*d^5)
julia> RI = radical(I)
ideal(102*b*d, 78*a*d, 51*b*c, 39*a*c, 6*a*b*d, 3*a*b*c)Primary Decomposition
primary_decomposition — Methodprimary_decomposition(I::MPolyIdeal; alg = :GTZ)Return a minimal primary decomposition of I. If I is the unit ideal, return [ideal(1)].
The decomposition is returned as a vector of tuples $(Q_1, P_1), \dots, (Q_t, P_t)$, say, where each $Q_i$ is a primary ideal with associated prime $P_i$, and where the intersection of the $Q_i$ is I.
Implemented Algorithms
If the base ring of I is a polynomial ring over a field, the algorithm of Gianni, Trager, and Zacharias is used by default (alg = :GTZ). Alternatively, the algorithm by Shimoyama and Yokoyama can be used by specifying alg = :SY. For polynomial rings over the integers, the algorithm proceeds as suggested by Pfister, Sadiq, and Steidel. See Patrizia Gianni, Barry Trager, Gail Zacharias (1988), Takeshi Shimoyama, Kazuhiro Yokoyama (1996), and Gerhard Pfister, Afshan Sadiq, Stefan Steidel (2011).
Examples
julia> R, (x, y) = PolynomialRing(QQ, ["x", "y"])
(Multivariate Polynomial Ring in x, y over Rational Field, fmpq_mpoly[x, y])
julia> I = intersect(ideal(R, [x, y])^2, ideal(R, [y^2-x^3+x]))
ideal(x^3*y - x*y - y^3, x^4 - x^2 - x*y^2)
julia> I = intersect(I, ideal(R, [x-y-1])^2)
ideal(x^5*y - 2*x^4*y^2 - 2*x^4*y + x^3*y^3 + 2*x^3*y^2 - x^2*y^3 + 2*x^2*y^2 + 2*x^2*y + 2*x*y^4 + x*y^3 - 2*x*y^2 - x*y - y^5 - 2*y^4 - y^3, x^6 - 2*x^5 - 3*x^4*y^2 - 2*x^4*y + 2*x^3*y^3 + 3*x^3*y^2 + 2*x^3*y + 2*x^3 + 5*x^2*y^2 + 2*x^2*y - x^2 + 3*x*y^4 - 5*x*y^2 - 2*x*y - 2*y^5 - 4*y^4 - 2*y^3)
julia> L = primary_decomposition(I)
3-element Vector{Tuple{MPolyIdeal{fmpq_mpoly}, MPolyIdeal{fmpq_mpoly}}}:
(ideal(x^3 - x - y^2), ideal(x^3 - x - y^2))
(ideal(x^2 - 2*x*y - 2*x + y^2 + 2*y + 1), ideal(x - y - 1))
(ideal(y, x^2), ideal(x, y))
julia> L = primary_decomposition(I, alg = :SY)
3-element Vector{Tuple{MPolyIdeal{fmpq_mpoly}, MPolyIdeal{fmpq_mpoly}}}:
(ideal(x^3 - x - y^2), ideal(x^3 - x - y^2))
(ideal(x^2 - 2*x*y - 2*x + y^2 + 2*y + 1), ideal(x - y - 1))
(ideal(y, x^2), ideal(y, x))julia> R, (a, b, c, d) = PolynomialRing(ZZ, ["a", "b", "c", "d"])
(Multivariate Polynomial Ring in a, b, c, d over Integer Ring, fmpz_mpoly[a, b, c, d])
julia> I = ideal(R, [1326*a^2*d^5, 1989*a^2*c^5, 102*b^4*d^5, 153*b^4*c^5,
663*a^2*c^5*d^5, 51*b^4*c^5*d^5, 78*a^2*d^15, 117*a^2*c^15,
78*a^15*d^5, 117*a^15*c^5, 6*a^2*b^4*d^15, 9*a^2*b^4*c^15,
39*a^2*c^5*d^15, 39*a^2*c^15*d^5, 6*a^2*b^15*d^5, 9*a^2*b^15*c^5,
6*a^15*b^4*d^5, 9*a^15*b^4*c^5, 39*a^15*c^5*d^5, 3*a^2*b^4*c^5*d^15,
3*a^2*b^4*c^15*d^5, 3*a^2*b^15*c^5*d^5, 3*a^15*b^4*c^5*d^5])
ideal(1326*a^2*d^5, 1989*a^2*c^5, 102*b^4*d^5, 153*b^4*c^5, 663*a^2*c^5*d^5, 51*b^4*c^5*d^5, 78*a^2*d^15, 117*a^2*c^15, 78*a^15*d^5, 117*a^15*c^5, 6*a^2*b^4*d^15, 9*a^2*b^4*c^15, 39*a^2*c^5*d^15, 39*a^2*c^15*d^5, 6*a^2*b^15*d^5, 9*a^2*b^15*c^5, 6*a^15*b^4*d^5, 9*a^15*b^4*c^5, 39*a^15*c^5*d^5, 3*a^2*b^4*c^5*d^15, 3*a^2*b^4*c^15*d^5, 3*a^2*b^15*c^5*d^5, 3*a^15*b^4*c^5*d^5)
julia> L = primary_decomposition(I)
8-element Vector{Tuple{MPolyIdeal{fmpz_mpoly}, MPolyIdeal{fmpz_mpoly}}}:
(ideal(d^5, c^5), ideal(d, c))
(ideal(a^2, b^4), ideal(b, a))
(ideal(2, c^5), ideal(2, c))
(ideal(3), ideal(3))
(ideal(13, b^4), ideal(13, b))
(ideal(17, a^2), ideal(17, a))
(ideal(17, d^15, c^15, b^15, a^15), ideal(17, d, c, b, a))
(ideal(9, 3*d^5, d^10), ideal(3, d))Absolute Primary Decomposition
absolute_primary_decomposition — Methodabsolute_primary_decomposition(I::MPolyIdeal{<:MPolyElem{fmpq}})If I is an ideal in a multivariate polynomial ring over the rationals, return an absolute minimal primary decomposition of I.
Return the decomposition as a vector of tuples $(Q_i, P_i, P_{ij}, d_{ij})$, say, where $(Q_i, P_i)$ is a (primary, prime) tuple as returned by primary_decomposition(I), and $P_{ij}$ represents a corresponding class of conjugated absolute associated primes defined over a number field of degree $d_{ij}$ whose generator prints as _a.
Implemented Algorithms
The implementation combines the algorithm of Gianni, Trager, and Zacharias for primary decomposition with absolute polynomial factorization.
Examples
julia> R, (y, z) = PolynomialRing(QQ, ["y", "z"])
(Multivariate Polynomial Ring in y, z over Rational Field, fmpq_mpoly[y, z])
julia> p = z^2+1
z^2 + 1
julia> q = z^3+2
z^3 + 2
julia> I = ideal(R, [p*q^2, y-z^2])
ideal(z^8 + z^6 + 4*z^5 + 4*z^3 + 4*z^2 + 4, y - z^2)
julia> L = primary_decomposition(I)
2-element Vector{Tuple{MPolyIdeal{fmpq_mpoly}, MPolyIdeal{fmpq_mpoly}}}:
(ideal(z^2 + 1, y - z^2), ideal(z^2 + 1, y - z^2))
(ideal(z^6 + 4*z^3 + 4, y - z^2), ideal(z^3 + 2, y - z^2))
julia> AL = absolute_primary_decomposition(I)
2-element Vector{Tuple{MPolyIdeal{fmpq_mpoly}, MPolyIdeal{fmpq_mpoly}, MPolyIdeal{AbstractAlgebra.Generic.MPoly{nf_elem}}, Int64}}:
(ideal(z^2 + 1, y + 1), ideal(z^2 + 1, y + 1), ideal(z - _a, y + 1), 2)
(ideal(z^6 + 4*z^3 + 4, y - z^2), ideal(z^3 + 2, y - z^2), ideal(z - _a, y - _a*z), 3)
julia> AP = AL[1][3]
ideal(z - _a, y + 1)
julia> RAP = base_ring(AP)
Multivariate Polynomial Ring in y, z over Number field over Rational Field with defining polynomial x^2 + 1
julia> NF = coefficient_ring(RAP)
Number field over Rational Field with defining polynomial x^2 + 1
julia> a = gen(NF)
_a
julia> minpoly(a)
x^2 + 1Minimal Associated Primes
minimal_primes — Methodminimal_primes(I::MPolyIdeal; alg = :GTZ)Return a vector containing the minimal associated prime ideals of I. If I is the unit ideal, return [ideal(1)].
Implemented Algorithms
If the base ring of I is a polynomial ring over a field, the algorithm of Gianni, Trager, and Zacharias is used by default (alg = :GTZ). Alternatively, characteristic sets can be used by specifying alg = :charSets. For polynomial rings over the integers, the algorithm proceeds as suggested by Pfister, Sadiq, and Steidel. See Patrizia Gianni, Barry Trager, Gail Zacharias (1988) and Gerhard Pfister, Afshan Sadiq, Stefan Steidel (2011).
Examples
julia> R, (x, y) = PolynomialRing(QQ, ["x", "y"])
(Multivariate Polynomial Ring in x, y over Rational Field, fmpq_mpoly[x, y])
julia> I = intersect(ideal(R, [x, y])^2, ideal(R, [y^2-x^3+x]))
ideal(x^3*y - x*y - y^3, x^4 - x^2 - x*y^2)
julia> I = intersect(I, ideal(R, [x-y-1])^2)
ideal(x^5*y - 2*x^4*y^2 - 2*x^4*y + x^3*y^3 + 2*x^3*y^2 - x^2*y^3 + 2*x^2*y^2 + 2*x^2*y + 2*x*y^4 + x*y^3 - 2*x*y^2 - x*y - y^5 - 2*y^4 - y^3, x^6 - 2*x^5 - 3*x^4*y^2 - 2*x^4*y + 2*x^3*y^3 + 3*x^3*y^2 + 2*x^3*y + 2*x^3 + 5*x^2*y^2 + 2*x^2*y - x^2 + 3*x*y^4 - 5*x*y^2 - 2*x*y - 2*y^5 - 4*y^4 - 2*y^3)
julia> L = minimal_primes(I)
2-element Vector{MPolyIdeal{fmpq_mpoly}}:
ideal(x - y - 1)
ideal(x^3 - x - y^2)
julia> L = minimal_primes(I, alg = :charSets)
2-element Vector{MPolyIdeal{fmpq_mpoly}}:
ideal(x - y - 1)
ideal(x^3 - x - y^2)julia> R, (a, b, c, d) = PolynomialRing(ZZ, ["a", "b", "c", "d"])
(Multivariate Polynomial Ring in a, b, c, d over Integer Ring, fmpz_mpoly[a, b, c, d])
julia> I = ideal(R, [1326*a^2*d^5, 1989*a^2*c^5, 102*b^4*d^5, 153*b^4*c^5,
663*a^2*c^5*d^5, 51*b^4*c^5*d^5, 78*a^2*d^15, 117*a^2*c^15,
78*a^15*d^5, 117*a^15*c^5, 6*a^2*b^4*d^15, 9*a^2*b^4*c^15,
39*a^2*c^5*d^15, 39*a^2*c^15*d^5, 6*a^2*b^15*d^5, 9*a^2*b^15*c^5,
6*a^15*b^4*d^5, 9*a^15*b^4*c^5, 39*a^15*c^5*d^5, 3*a^2*b^4*c^5*d^15,
3*a^2*b^4*c^15*d^5, 3*a^2*b^15*c^5*d^5, 3*a^15*b^4*c^5*d^5])
ideal(1326*a^2*d^5, 1989*a^2*c^5, 102*b^4*d^5, 153*b^4*c^5, 663*a^2*c^5*d^5, 51*b^4*c^5*d^5, 78*a^2*d^15, 117*a^2*c^15, 78*a^15*d^5, 117*a^15*c^5, 6*a^2*b^4*d^15, 9*a^2*b^4*c^15, 39*a^2*c^5*d^15, 39*a^2*c^15*d^5, 6*a^2*b^15*d^5, 9*a^2*b^15*c^5, 6*a^15*b^4*d^5, 9*a^15*b^4*c^5, 39*a^15*c^5*d^5, 3*a^2*b^4*c^5*d^15, 3*a^2*b^4*c^15*d^5, 3*a^2*b^15*c^5*d^5, 3*a^15*b^4*c^5*d^5)
julia> L = minimal_primes(I)
6-element Vector{MPolyIdeal{fmpz_mpoly}}:
ideal(d, c)
ideal(b, a)
ideal(2, c)
ideal(3)
ideal(13, b)
ideal(17, a)Weak Equidimensional Decomposition
equidimensional_decomposition_weak — Methodequidimensional_decomposition_weak(I::MPolyIdeal)Return a vector of equidimensional ideals where the last entry is the equidimensional hull of I, that is, the intersection of the primary components of I of maximal dimension. Each of the previous entries is an ideal of lower dimension whose associated primes are exactly the associated primes of I of that dimension. If I is the unit ideal, return [ideal(1)].
Implemented Algorithms
The implementation relies on ideas of Eisenbud, Huneke, and Vasconcelos. See David Eisenbud, Craig Huneke, Wolmer Vasconcelos (1992).
Examples
julia> R, (x, y) = PolynomialRing(QQ, ["x", "y"])
(Multivariate Polynomial Ring in x, y over Rational Field, fmpq_mpoly[x, y])
julia> I = intersect(ideal(R, [x, y])^2, ideal(R, [y^2-x^3+x]))
ideal(x^3*y - x*y - y^3, x^4 - x^2 - x*y^2)
julia> I = intersect(I, ideal(R, [x-y-1])^2)
ideal(x^5*y - 2*x^4*y^2 - 2*x^4*y + x^3*y^3 + 2*x^3*y^2 - x^2*y^3 + 2*x^2*y^2 + 2*x^2*y + 2*x*y^4 + x*y^3 - 2*x*y^2 - x*y - y^5 - 2*y^4 - y^3, x^6 - 2*x^5 - 3*x^4*y^2 - 2*x^4*y + 2*x^3*y^3 + 3*x^3*y^2 + 2*x^3*y + 2*x^3 + 5*x^2*y^2 + 2*x^2*y - x^2 + 3*x*y^4 - 5*x*y^2 - 2*x*y - 2*y^5 - 4*y^4 - 2*y^3)
julia> L = equidimensional_decomposition_weak(I)
2-element Vector{MPolyIdeal{fmpq_mpoly}}:
ideal(y, x)
ideal(x^5 - 2*x^4*y - 2*x^4 + x^3*y^2 + 2*x^3*y - x^2*y^2 + 2*x^2*y + 2*x^2 + 2*x*y^3 + x*y^2 - 2*x*y - x - y^4 - 2*y^3 - y^2)Equidimensional Decomposition of radical
equidimensional_decomposition_radical — Methodequidimensional_decomposition_radical(I::MPolyIdeal)Return a vector of equidimensional radical ideals increasingly ordered by dimension. For each dimension, the returned radical ideal is the intersection of the associated primes of I of that dimension. If I is the unit ideal, return [ideal(1)].
Implemented Algorithms
The implementation combines the algorithms of Krick and Logar (with modifications by Laplagne) and Kemper. See Teresa Krick, Alessandro Logar (1991) and Gregor Kemper (2002).
Examples
julia> R, (x, y) = PolynomialRing(QQ, ["x", "y"])
(Multivariate Polynomial Ring in x, y over Rational Field, fmpq_mpoly[x, y])
julia> I = intersect(ideal(R, [x, y])^2, ideal(R, [y^2-x^3+x]))
ideal(x^3*y - x*y - y^3, x^4 - x^2 - x*y^2)
julia> I = intersect(I, ideal(R, [x-y-1])^2)
ideal(x^5*y - 2*x^4*y^2 - 2*x^4*y + x^3*y^3 + 2*x^3*y^2 - x^2*y^3 + 2*x^2*y^2 + 2*x^2*y + 2*x*y^4 + x*y^3 - 2*x*y^2 - x*y - y^5 - 2*y^4 - y^3, x^6 - 2*x^5 - 3*x^4*y^2 - 2*x^4*y + 2*x^3*y^3 + 3*x^3*y^2 + 2*x^3*y + 2*x^3 + 5*x^2*y^2 + 2*x^2*y - x^2 + 3*x*y^4 - 5*x*y^2 - 2*x*y - 2*y^5 - 4*y^4 - 2*y^3)
julia> L = equidimensional_decomposition_radical(I)
2-element Vector{MPolyIdeal{fmpq_mpoly}}:
ideal(y, x)
ideal(x^4 - x^3*y - x^3 - x^2 - x*y^2 + x*y + x + y^3 + y^2)Equidimensional Hull
equidimensional_hull — Methodequidimensional_hull(I::MPolyIdeal)If the base ring of I is a polynomial ring over a field, return the intersection of the primary components of I of maximal dimension. In the case of polynomials over the integers, return the intersection of the primary components of I of minimal height. If I is the unit ideal, return [ideal(1)].
Implemented Algorithms
For polynomial rings over a field, the implementation relies on ideas as used by Gianni, Trager, and Zacharias or Krick and Logar. For polynomial rings over the integers, the algorithm proceeds as suggested by Pfister, Sadiq, and Steidel. See Patrizia Gianni, Barry Trager, Gail Zacharias (1988), Teresa Krick, Alessandro Logar (1991), and Gerhard Pfister, Afshan Sadiq, Stefan Steidel (2011).
Examples
julia> R, (x, y) = PolynomialRing(QQ, ["x", "y"])
(Multivariate Polynomial Ring in x, y over Rational Field, fmpq_mpoly[x, y])
julia> I = intersect(ideal(R, [x, y])^2, ideal(R, [y^2-x^3+x]))
ideal(x^3*y - x*y - y^3, x^4 - x^2 - x*y^2)
julia> I = intersect(I, ideal(R, [x-y-1])^2)
ideal(x^5*y - 2*x^4*y^2 - 2*x^4*y + x^3*y^3 + 2*x^3*y^2 - x^2*y^3 + 2*x^2*y^2 + 2*x^2*y + 2*x*y^4 + x*y^3 - 2*x*y^2 - x*y - y^5 - 2*y^4 - y^3, x^6 - 2*x^5 - 3*x^4*y^2 - 2*x^4*y + 2*x^3*y^3 + 3*x^3*y^2 + 2*x^3*y + 2*x^3 + 5*x^2*y^2 + 2*x^2*y - x^2 + 3*x*y^4 - 5*x*y^2 - 2*x*y - 2*y^5 - 4*y^4 - 2*y^3)
julia> L = equidimensional_hull(I)
ideal(x^5 - 2*x^4*y - 2*x^4 + x^3*y^2 + 2*x^3*y - x^2*y^2 + 2*x^2*y + 2*x^2 + 2*x*y^3 + x*y^2 - 2*x*y - x - y^4 - 2*y^3 - y^2)julia> R, (a, b, c, d) = PolynomialRing(ZZ, ["a", "b", "c", "d"])
(Multivariate Polynomial Ring in a, b, c, d over Integer Ring, fmpz_mpoly[a, b, c, d])
julia> I = ideal(R, [1326*a^2*d^5, 1989*a^2*c^5, 102*b^4*d^5, 153*b^4*c^5,
663*a^2*c^5*d^5, 51*b^4*c^5*d^5, 78*a^2*d^15, 117*a^2*c^15,
78*a^15*d^5, 117*a^15*c^5, 6*a^2*b^4*d^15, 9*a^2*b^4*c^15,
39*a^2*c^5*d^15, 39*a^2*c^15*d^5, 6*a^2*b^15*d^5, 9*a^2*b^15*c^5,
6*a^15*b^4*d^5, 9*a^15*b^4*c^5, 39*a^15*c^5*d^5, 3*a^2*b^4*c^5*d^15,
3*a^2*b^4*c^15*d^5, 3*a^2*b^15*c^5*d^5, 3*a^15*b^4*c^5*d^5])
ideal(1326*a^2*d^5, 1989*a^2*c^5, 102*b^4*d^5, 153*b^4*c^5, 663*a^2*c^5*d^5, 51*b^4*c^5*d^5, 78*a^2*d^15, 117*a^2*c^15, 78*a^15*d^5, 117*a^15*c^5, 6*a^2*b^4*d^15, 9*a^2*b^4*c^15, 39*a^2*c^5*d^15, 39*a^2*c^15*d^5, 6*a^2*b^15*d^5, 9*a^2*b^15*c^5, 6*a^15*b^4*d^5, 9*a^15*b^4*c^5, 39*a^15*c^5*d^5, 3*a^2*b^4*c^5*d^15, 3*a^2*b^4*c^15*d^5, 3*a^2*b^15*c^5*d^5, 3*a^15*b^4*c^5*d^5)
julia> L = equidimensional_hull(I)
ideal(3)Radical of the Equidimensional Hull
equidimensional_hull_radical — Methodequidimensional_hull_radical(I::MPolyIdeal)Return the intersection of the associated primes of I of maximal dimension. If I is the unit ideal, return [ideal(1)].
Implemented Algorithms
The implementation relies on a combination of the algorithms of Krick and Logar (with modifications by Laplagne) and Kemper. See Teresa Krick, Alessandro Logar (1991) and Gregor Kemper (2002).
Examples
julia> R, (x, y) = PolynomialRing(QQ, ["x", "y"])
(Multivariate Polynomial Ring in x, y over Rational Field, fmpq_mpoly[x, y])
julia> I = intersect(ideal(R, [x, y])^2, ideal(R, [y^2-x^3+x]))
ideal(x^3*y - x*y - y^3, x^4 - x^2 - x*y^2)
julia> I = intersect(I, ideal(R, [x-y-1])^2)
ideal(x^5*y - 2*x^4*y^2 - 2*x^4*y + x^3*y^3 + 2*x^3*y^2 - x^2*y^3 + 2*x^2*y^2 + 2*x^2*y + 2*x*y^4 + x*y^3 - 2*x*y^2 - x*y - y^5 - 2*y^4 - y^3, x^6 - 2*x^5 - 3*x^4*y^2 - 2*x^4*y + 2*x^3*y^3 + 3*x^3*y^2 + 2*x^3*y + 2*x^3 + 5*x^2*y^2 + 2*x^2*y - x^2 + 3*x*y^4 - 5*x*y^2 - 2*x*y - 2*y^5 - 4*y^4 - 2*y^3)
julia> L = equidimensional_hull_radical(I)
ideal(x^4 - x^3*y - x^3 - x^2 - x*y^2 + x*y + x + y^3 + y^2)Homogenization and Dehomogenization
Referring to Martin Kreuzer, Lorenzo Robbiano (2005) for definitions and technical details, we discuss homogenization and dehomogenization in the context of $\mathbb Z^m$-gradings.
homogenization — Functionhomogenization(f::MPolyElem, W::Union{fmpz_mat, Matrix{<:IntegerUnion}}, var::String, pos::Int = 1)If $m$ is the number of rows of W, extend the parent polynomial ring of f by inserting $m$ extra variables, starting at position pos. Correspondingly, extend the integer matrix W by inserting the standard unit vectors of size $m$ as new columns, starting at column pos. Grade the extended ring by converting the columns of the extended matrix to elements of the group $\mathbb Z^m$ and assigning these as weights to the variables. Homogenize f with respect to the induced $\mathbb Z^m$-grading on the original ring, using the extra variables as homogenizing variables. Return the result as an element of the extended ring with its $\mathbb Z^m$-grading. If $m=1$, the extra variable prints as var. Otherwise, the extra variables print as var[$i$], for $i = 1 \dots m$.
homogenization(V::Vector{T}, W::Union{fmpz_mat, Matrix{<:IntegerUnion}}, var::String, pos::Int = 1) where {T <: MPolyElem}Given a vector V of elements in a common polynomial ring, create an extended ring with $\mathbb Z^m$-grading as above. Homogenize the elements of V correspondingly, and return the vector of homogenized elements.
homogenization(I::MPolyIdeal{T}, W::Union{fmpz_mat, Matrix{<:IntegerUnion}}, var::String, pos::Int = 1; ordering::Symbol = :degrevlex) where {T <: MPolyElem}Return the homogenization of I in an extended ring with $\mathbb Z^m$-grading as above.
Applied to an ideal I, the function first homogenizes the generators of I in the extended ring. It then creates the ideal generated by these homogenizations, and saturates this ideal with respect to the ideal which is generated by the homogenizing variables.
Examples
julia> R, (x, y) = PolynomialRing(QQ, ["x", "y"])
(Multivariate Polynomial Ring in x, y over Rational Field, fmpq_mpoly[x, y])
julia> f = x^3+x^2*y+x*y^2+y^3
x^3 + x^2*y + x*y^2 + y^3
julia> W = [1 2; 3 4]
2×2 Matrix{Int64}:
1 2
3 4
julia> F = homogenization(f, W, "z", 3)
x^3*z[1]^3*z[2]^3 + x^2*y*z[1]^2*z[2]^2 + x*y^2*z[1]*z[2] + y^3
julia> parent(F)
Multivariate Polynomial Ring in x, y, z[1], z[2] over Rational Field graded by
x -> [1 3]
y -> [2 4]
z[1] -> [1 0]
z[2] -> [0 1]homogenization — Functionhomogenization(f::MPolyElem, var::String, pos::Int = 1)
homogenization(V::Vector{T}, var::String, pos::Int = 1) where {T <: MPolyElem}
homogenization(I::MPolyIdeal{T}, var::String, pos::Int = 1; ordering::Symbol = :degrevlex) where {T <: MPolyElem}Homogenize f, V, or I with respect to the standard $\mathbb Z$-grading using a homogenizing variable printing as var. Return the result as an element of a graded polynomial ring with the homogenizing variable at position pos.
Applied to an ideal I, the function proceeds by homogenizing the elements of a Gröbner basis of I with respect to a degree compatible monomial ordering such as degrevlex (default). If a Gröbner basis with respect to the specified ordering has not yet been computed and, thus, not yet been cached, executing the homogenization function with argument I may take some time. The degree compatibility of the specified ordering is not checked by the function.
Examples
julia> R, (x, y, z) = PolynomialRing(QQ, ["x", "y", "z"])
(Multivariate Polynomial Ring in x, y, z over Rational Field, fmpq_mpoly[x, y, z])
julia> f = x^3-y^2-z
x^3 - y^2 - z
julia> F = homogenization(f, "w", 4)
x^3 - y^2*w - z*w^2
julia> parent(F)
Multivariate Polynomial Ring in x, y, z, w over Rational Field graded by
x -> [1]
y -> [1]
z -> [1]
w -> [1]
julia> V = [y-x^2, z-x^3]
2-element Vector{fmpq_mpoly}:
-x^2 + y
-x^3 + z
julia> homogenization(V, "w")
2-element Vector{MPolyElem_dec{fmpq, fmpq_mpoly}}:
w*y - x^2
w^2*z - x^3
julia> I = ideal(R, V)
ideal(-x^2 + y, -x^3 + z)
julia> PTC = homogenization(I, "w")
ideal(-x*z + y^2, -w*z + x*y, -w*y + x^2)
julia> parent(PTC[1])
Multivariate Polynomial Ring in w, x, y, z over Rational Field graded by
w -> [1]
x -> [1]
y -> [1]
z -> [1]
julia> homogenization(I, "w", ordering = deglex(gens(base_ring(I))))
ideal(x*z - y^2, -w*z + x*y, -w*y + x^2, -w*z^2 + y^3)dehomogenization — Methoddehomogenization(F::MPolyElem_dec, pos::Int)Given an element F of a $\mathbb Z^m$-graded ring, where the generators of $\mathbb Z^m$ are the assigned weights to the variables at positions pos, $\dots$, pos $-1+m$, dehomogenize F using the variables at these positions. Return the result as an element of a polynomial ring not depending on the variables at these positions.
dehomogenization(V::Vector{T}, pos::Int) where {T <: MPolyElem_dec}Given a vector V of elements in a common graded polynomial ring, create a polynomial ring not depending on the variables at positions pos, $\dots$, pos $-1+m$. Dehomogenize the elements of V correspondingly, and return the vector of dehomogenized elements.
dehomogenization(I::MPolyIdeal{T}, pos::Int) where {T <: MPolyElem_dec}Return the dehomogenization of I in a polynomial ring as above.
Examples
julia> S, (x, y, z) = GradedPolynomialRing(QQ, ["x", "y", "z"])
(Multivariate Polynomial Ring in x, y, z over Rational Field graded by
x -> [1]
y -> [1]
z -> [1], MPolyElem_dec{fmpq, fmpq_mpoly}[x, y, z])
julia> F = x^3-x^2*y-x*z^2
x^3 - x^2*y - x*z^2
julia> f = dehomogenization(F, 1)
-y - z^2 + 1
julia> parent(f)
Multivariate Polynomial Ring in y, z over Rational Field
julia> V = [x*y-z^2, x^2*z-x^3]
2-element Vector{MPolyElem_dec{fmpq, fmpq_mpoly}}:
x*y - z^2
-x^3 + x^2*z
julia> dehomogenization(V, 3)
2-element Vector{fmpq_mpoly}:
x*y - 1
-x^3 + x^2
julia> I = ideal(S, V)
ideal(x*y - z^2, -x^3 + x^2*z)
julia> dehomogenization(I, 3)
ideal(x*y - 1, -x^3 + x^2)
julia> W = [1 2 1 0; 3 4 0 1]
2×4 Matrix{Int64}:
1 2 1 0
3 4 0 1
julia> S, (w, x, y, z) = GradedPolynomialRing(QQ, ["w", "x", "y", "z"], W)
(Multivariate Polynomial Ring in w, x, y, z over Rational Field graded by
w -> [1 3]
x -> [2 4]
y -> [1 0]
z -> [0 1], MPolyElem_dec{fmpq, fmpq_mpoly}[w, x, y, z])
julia> F = w^3*y^3*z^3 + w^2*x*y^2*z^2 + w*x^2*y*z + x^3
w^3*y^3*z^3 + w^2*x*y^2*z^2 + w*x^2*y*z + x^3
julia> dehomogenization(F, 3)
w^3 + w^2*x + w*x^2 + x^3Generating Special Ideals
katsura — Methodkatsura(n::Int)Given a natural number n returns the Katsura ideal generated by $u_m - \sum_{l=n}^n u_{l-m} u_l$, $1 - \sum_{l = -n}^n u_l$ where $u_{-i} = u_i$, and $u_i = 0$ for $i > n$ and $m \in \{-n, \ldots, n\}$. Also note that indices have been shifted to start from 1.
Example
julia> katsura(2)
ideal(x1 + 2*x2 + 2*x3 - 1, x1^2 - x1 + 2*x2^2 + 2*x3^2, 2*x1*x2 + 2*x2*x3 - x2)katsura — Methodkatsura(R::MPolyRing)Returns the Katsura ideal in the given polynomial ring R.
Example
julia> R, _ = QQ["x", "y", "z"]
(Multivariate Polynomial Ring in x, y, z over Rational Field, fmpq_mpoly[x, y, z])
julia> katsura(R)
ideal(x + 2*y + 2*z - 1, x^2 - x + 2*y^2 + 2*z^2, 2*x*y + 2*y*z - y)