# 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

idealMethod
ideal(R::MPolyRing, V::Vector)

Given a vector V of polynomials in R, return the ideal of R generated by these polynomials.

Note

In the graded case, the entries of V must be homogeneous.

Examples

julia> R, (x, y) = polynomial_ring(QQ, ["x", "y"])
(Multivariate polynomial ring in 2 variables over QQ, QQMPolyRingElem[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{QQMPolyRingElem}

julia> S, (x, y) = graded_polynomial_ring(QQ, ["x", "y"],  [1, 2])
(Graded multivariate polynomial ring in 2 variables over QQ, MPolyDecRingElem{QQFieldElem, QQMPolyRingElem}[x, y])

julia> J = ideal(S, [(x^2+y)^2])
ideal(x^4 + 2*x^2*y + y^2)

julia> typeof(J)
MPolyIdeal{MPolyDecRingElem{QQFieldElem, QQMPolyRingElem}}
source

## Data Associated to Ideals

### Basic Data

If I is an ideal of a multivariate polynomial ring R, then

• base_ring(I) refers to R,
• gens(I) to the generators of I,
• ngens(I) to the number of these generators, and
• gen(I, k) as well as I[k] to the k-th such generator.
###### Examples
julia> R, (x, y) = polynomial_ring(QQ, ["x", "y"])
(Multivariate polynomial ring in 2 variables over QQ, QQMPolyRingElem[x, y])

julia> I = ideal(R, [x, y])^2
ideal(x^2, x*y, y^2)

julia> base_ring(I)
Multivariate polynomial ring in 2 variables x, y
over rational field

julia> gens(I)
3-element Vector{QQMPolyRingElem}:
x^2
x*y
y^2

julia> ngens(I)
3

julia> gen(I, 2)
x*y


### Dimension

dimMethod
dim(I::MPolyIdeal)

Return the Krull dimension of I.

Examples

julia> R, (x, y, z) = polynomial_ring(QQ, ["x", "y", "z"])
(Multivariate polynomial ring in 3 variables over QQ, QQMPolyRingElem[x, y, z])

julia> I = ideal(R, [y-x^2, x-z^3])
ideal(-x^2 + y, x - z^3)

julia> dim(I)
1
source

### Codimension

codimMethod
codim(I::MPolyIdeal)

Return the codimension of I.

Examples

julia> R, (x, y, z) = polynomial_ring(QQ, ["x", "y", "z"])
(Multivariate polynomial ring in 3 variables over QQ, QQMPolyRingElem[x, y, z])

julia> I = ideal(R, [y-x^2, x-z^3])
ideal(-x^2 + y, x - z^3)

julia> codim(I)
2
source

### Minimal Sets of Generators

minimal_generating_setMethod
minimal_generating_set(I::MPolyIdeal{<:MPolyDecRingElem})

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. If I is the zero ideal, an empty list is returned.

Examples

julia> R, (x, y, z) = graded_polynomial_ring(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{MPolyDecRingElem{QQFieldElem, QQMPolyRingElem}}:
x
z^2
y^3

julia> I = ideal(R, zero(R))
ideal(0)

julia> minimal_generating_set(I)
MPolyDecRingElem{QQFieldElem, QQMPolyRingElem}[]
source

### Castelnuovo-Mumford Regularity

cm_regularityMethod
cm_regularity(I::MPolyIdeal)

Given a (homogeneous) ideal I in a standard $\mathbb Z$-graded multivariate polynomial ring with coefficients in a field, return the Castelnuovo-Mumford regularity of I.

Examples

julia> R, (w, x, y, z) = graded_polynomial_ring(QQ, ["w", "x", "y", "z"]);

julia> I = ideal(R, [y^2*z − x^2*w, z^4 − x*w^3]);

julia> cm_regularity(I)
6

julia> minimal_betti_table(I);
source

### Degree

degreeMethod
degree(I::MPolyIdeal)

Given a (homogeneous) ideal I in a standard $\mathbb Z$-graded multivariate polynomial ring, return the degree of I (that is, the degree of the quotient of base_ring(I) modulo I). Otherwise, return the degree of the homogenization of I with respect to the standard $\mathbb Z$-grading.

Note

Geometrically, the degree of a homogeneous ideal as above is the number of intersection points of its projective variety with a generic linear subspace of complementary dimension (counted with multiplicities). See also Mateusz Michałek, Bernd Sturmfels (2021).

Examples

julia> R, (x, y, z) = polynomial_ring(QQ, ["x", "y", "z"])
(Multivariate polynomial ring in 3 variables over QQ, QQMPolyRingElem[x, y, z])

julia> I = ideal(R, [y-x^2, x-z^3])
ideal(-x^2 + y, x - z^3)

julia> degree(I)
6
source

## Operations 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) = polynomial_ring(QQ, ["x", "y", "z"])
(Multivariate polynomial ring in 3 variables over QQ, QQMPolyRingElem[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)
source

#### Sum of Ideals

+Method
+(I::MPolyIdeal{T}, J::MPolyIdeal{T}) where T

Return the sum of I and J.

Examples

julia> R, (x, y, z) = polynomial_ring(QQ, ["x", "y", "z"])
(Multivariate polynomial ring in 3 variables over QQ, QQMPolyRingElem[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)
source

#### Product of Ideals

*Method
*(I::MPolyIdeal{T}, J::MPolyIdeal{T}) where T

Return the product of I and J.

Examples

julia> R, (x, y, z) = polynomial_ring(QQ, ["x", "y", "z"])
(Multivariate polynomial ring in 3 variables over QQ, QQMPolyRingElem[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)
source

### Intersection of Ideals

intersectMethod
intersect(I::MPolyIdeal{T}, Js::MPolyIdeal{T}...) where T
intersect(V::Vector{MPolyIdeal{T}}) where T

Return the intersection of two or more ideals.

Examples

julia> R, (x, y) = polynomial_ring(QQ, ["x", "y"])
(Multivariate polynomial ring in 2 variables over QQ, QQMPolyRingElem[x, y])

julia> I = ideal(R, [x, y])^2;

julia> J = ideal(R, [y^2-x^3+x]);

julia> intersect(I, J)
ideal(x^3*y - x*y - y^3, x^4 - x^2 - x*y^2)

julia> intersect([I, J])
ideal(x^3*y - x*y - y^3, x^4 - x^2 - x*y^2)
source

### 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.$$$
quotientMethod
quotient(I::MPolyIdeal{T}, J::MPolyIdeal{T}) where T

Return the ideal quotient of I by J. Alternatively, use I:J.

quotient(I::MPolyIdeal{T}, f::MPolyRingElem{T}) where T

Return the ideal quotient of I by the ideal generated by f. Alternatively, use I:f.

Examples

julia> R, (x, y, z) = polynomial_ring(QQ, ["x", "y", "z"])
(Multivariate polynomial ring in 3 variables over QQ, QQMPolyRingElem[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)
source

### 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)}.$$$
saturationMethod
saturation(I::MPolyIdeal{T}, J::MPolyIdeal{T}) where T

Return the saturation of I with respect to J.

Examples

julia> R, (x, y, z) = polynomial_ring(QQ, ["x", "y", "z"])
(Multivariate polynomial ring in 3 variables over QQ, QQMPolyRingElem[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)
source
saturation_with_indexMethod
saturation_with_index(I::MPolyIdeal{T}, J::MPolyIdeal{T}) where T

Return $I:J^{\infty}$ together with the smallest integer $m$ such that $I:J^m = I:J^{\infty}$.

Examples

julia> R, (x, y, z) = polynomial_ring(QQ, ["x", "y", "z"])
(Multivariate polynomial ring in 3 variables over QQ, QQMPolyRingElem[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)
source

### Elimination

eliminateMethod
eliminate(I::MPolyIdeal{T}, V::Vector{T}) where T <: MPolyRingElem

Given a vector V of polynomials which are variables, these variables are eliminated from I. That is, return the ideal generated by all polynomials in I which only involve the remaining variables.

eliminate(I::MPolyIdeal, V::AbstractVector{Int})

Given a vector V of indices which specify variables, these variables are eliminated from I. That is, return the ideal generated by all polynomials in I which only involve the remaining variables.

Note

The return value is an ideal of the original ring.

Examples

julia> R, (t, x, y, z) = polynomial_ring(QQ, ["t", "x", "y", "z"])
(Multivariate polynomial ring in 4 variables over QQ, QQMPolyRingElem[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{QQMPolyRingElem}:
t

julia> TC = eliminate(I, A)
ideal(-x*z + y^2, x*y - z, x^2 - y)

julia> A = 
1-element Vector{Int64}:
1

julia> TC = eliminate(I, A)
ideal(-x*z + y^2, x*y - z, x^2 - y)

julia> base_ring(TC)
Multivariate polynomial ring in 4 variables t, x, y, z
over rational field
source

### Truncation

truncateMethod
truncate(I::MPolyIdeal, g::GrpAbFinGenElem)

Given a (homogeneous) ideal I in a $\mathbb Z$-graded multivariate polynomial ring with positive weights, return the truncation of I at degree g.

truncate(I::MPolyIdeal, d::Int)

Given an ideal I as above, and given an integer d, convert d into an element g of the grading group of base_ring(I) and proceed as above.

Examples

julia> R, (x, y, z) = graded_polynomial_ring(QQ, ["x", "y", "z"]);

julia> I = ideal(R, [x, y^4, z^6])
ideal(x, y^4, z^6)

julia> truncate(I, 3)
ideal(x*z^2, x*y*z, x*y^2, x^2*z, x^2*y, x^3, y^4, z^6)
julia> R, (x, y, z) = graded_polynomial_ring(QQ, ["x", "y", "z"], [3,2,1]);

julia> I = ideal(R, [x, y^4, z^6])
ideal(x, y^4, z^6)

julia> truncate(I, 3)
ideal(x, y^4, z^6)

julia> truncate(I, 4)
ideal(x*z, z^6, y^4)
source

## Tests on Ideals

### Basic Tests

is_zeroMethod
is_zero(I::MPolyIdeal)

Return true if I is the zero ideal, false otherwise.

Examples

julia> R, (x, y) = polynomial_ring(QQ, ["x", "y"])
(Multivariate polynomial ring in 2 variables over QQ, QQMPolyRingElem[x, y])

julia> I = ideal(R, y-x^2)
ideal(-x^2 + y)

julia> is_zero(I)
false
source
is_oneMethod
is_one(I::MPolyIdeal)

Return true if I is generated by 1, false otherwise.

Examples

julia> R, (x, y) = polynomial_ring(QQ, ["x", "y"])
(Multivariate polynomial ring in 2 variables over QQ, QQMPolyRingElem[x, y])

julia> I = ideal(R, [x, x + y, y - 1])
ideal(x, x + y, y - 1)

julia> is_one(I)
true
source
is_monomialMethod
is_monomial(f::MPolyRingElem)

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) = polynomial_ring(QQ, ["x", "y"])
(Multivariate polynomial ring in 2 variables over QQ, QQMPolyRingElem[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]))
true
source

### Containment of Ideals

is_subsetMethod
is_subset(I::MPolyIdeal{T}, J::MPolyIdeal{T}) where T

Return true if I is contained in J, false otherwise.

Examples

julia> R, (x, y) = polynomial_ring(QQ, ["x", "y"])
(Multivariate polynomial ring in 2 variables over QQ, QQMPolyRingElem[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> is_subset(I, J)
true
source

### Equality of Ideals

==Method
==(I::MPolyIdeal{T}, J::MPolyIdeal{T}) where T

Return true if I is equal to J, false otherwise.

Examples

julia> R, (x, y) = polynomial_ring(QQ, ["x", "y"])
(Multivariate polynomial ring in 2 variables over QQ, QQMPolyRingElem[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
false
source

### Ideal Membership

ideal_membershipMethod
ideal_membership(f::T, I::MPolyIdeal{T}) where T

Return true if f is contained in I, false otherwise. Alternatively, use f in I.

Examples

julia> R, (x, y) = polynomial_ring(QQ, ["x", "y"])
(Multivariate polynomial ring in 2 variables over QQ, QQMPolyRingElem[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
false
source

radical_membershipMethod
radical_membership(f::T, I::MPolyIdeal{T}) where T

Return true if f is contained in the radical of I, false otherwise. Alternatively, use inradical(f, I).

Examples

julia> R, (x,) = polynomial_ring(QQ, ["x"])
(Multivariate polynomial ring in 1 variable over QQ, QQMPolyRingElem[x])

julia> f = x
x

julia> I = ideal(R,  [x^2])
ideal(x^2)

true

julia> g = x+1
x + 1

false
source

### Primality Test

is_primeMethod
is_prime(I::MPolyIdeal)

Return true if I is prime, false otherwise.

Warning

The function computes the minimal associated primes of I. This may take some time.

Examples

julia> R, (x, y) = polynomial_ring(QQ, ["x", "y"])
(Multivariate polynomial ring in 2 variables over QQ, QQMPolyRingElem[x, y])

julia> I = ideal(R, [x, y])^2
ideal(x^2, x*y, y^2)

julia> is_prime(I)
false
source

### Primary Test

is_primaryMethod
is_primary(I::MPolyIdeal)

Return true if I is primary, false otherwise.

Warning

The function computes a primary decomposition of I. This may take some time.

Examples

julia> R, (x, y) = polynomial_ring(QQ, ["x", "y"])
(Multivariate polynomial ring in 2 variables over QQ, QQMPolyRingElem[x, y])

julia> I = ideal(R, [x, y])^2
ideal(x^2, x*y, y^2)

julia> is_primary(I)
true
source

## Decomposition 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.

radicalMethod
radical(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) = polynomial_ring(QQ, ["x", "y"])
(Multivariate polynomial ring in 2 variables over QQ, QQMPolyRingElem[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)

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) = polynomial_ring(ZZ, ["a", "b", "c", "d"])
(Multivariate polynomial ring in 4 variables over ZZ, ZZMPolyRingElem[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)

ideal(102*b*d, 78*a*d, 51*b*c, 39*a*c, 6*a*b*d, 3*a*b*c)
source

### Primary Decomposition

primary_decompositionMethod
primary_decomposition(I::MPolyIdeal; algorithm = :GTZ, cache=true)

Return a minimal primary decomposition of I.

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 (algorithm = :GTZ). Alternatively, the algorithm by Shimoyama and Yokoyama can be used by specifying algorithm = :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).

Warning

The algorithm of Gianni, Trager, and Zacharias may not terminate over a small finite field. If it terminates, the result is correct.

If cache=false is set, the primary decomposition is recomputed and not cached.

Examples

julia> R, (x, y) = polynomial_ring(QQ, ["x", "y"])
(Multivariate polynomial ring in 2 variables over QQ, QQMPolyRingElem[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{QQMPolyRingElem}, MPolyIdeal{QQMPolyRingElem}}}:
(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, algorithm = :SY, cache=false)
3-element Vector{Tuple{MPolyIdeal{QQMPolyRingElem}, MPolyIdeal{QQMPolyRingElem}}}:
(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) = polynomial_ring(ZZ, ["a", "b", "c", "d"])
(Multivariate polynomial ring in 4 variables over ZZ, ZZMPolyRingElem[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{ZZMPolyRingElem}, MPolyIdeal{ZZMPolyRingElem}}}:
(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))
source

### Absolute Primary Decomposition

absolute_primary_decompositionMethod
absolute_primary_decomposition(I::MPolyIdeal{<:MPolyRingElem{QQFieldElem}})

Given an ideal I 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) = polynomial_ring(QQ, ["y", "z"])
(Multivariate polynomial ring in 2 variables over QQ, QQMPolyRingElem[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{QQMPolyRingElem}, MPolyIdeal{QQMPolyRingElem}}}:
(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{QQMPolyRingElem}, MPolyIdeal{QQMPolyRingElem}, 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
ideal(z - _a, y + 1)

julia> RAP = base_ring(AP)
Multivariate polynomial ring in 2 variables y, z
over number field of degree 2 over QQ

julia> NF = coefficient_ring(RAP)
Number field with defining polynomial x^2 + 1
over rational field

julia> a = gen(NF)
_a

julia> minpoly(a)
x^2 + 1
julia> R, (x, y) = graded_polynomial_ring(QQ, ["x", "y"])
(Graded multivariate polynomial ring in 2 variables over QQ, MPolyDecRingElem{QQFieldElem, QQMPolyRingElem}[x, y])

julia> I = ideal(R, [x^2+y^2])
ideal(x^2 + y^2)

julia> AL = absolute_primary_decomposition(I)
1-element Vector{Tuple{MPolyIdeal{MPolyDecRingElem{QQFieldElem, QQMPolyRingElem}}, MPolyIdeal{MPolyDecRingElem{QQFieldElem, QQMPolyRingElem}}, MPolyIdeal{MPolyDecRingElem{nf_elem, AbstractAlgebra.Generic.MPoly{nf_elem}}}, Int64}}:
(ideal(x^2 + y^2), ideal(x^2 + y^2), ideal(x + _a*y), 2)

julia> AP = AL
ideal(x + _a*y)

julia> RAP = base_ring(AP)
Multivariate polynomial ring in 2 variables over number field graded by
x -> 
y -> 
source

### Minimal Associated Primes

minimal_primesMethod
minimal_primes(I::MPolyIdeal; algorithm::Symbol = :GTZ)

Return a vector containing the minimal associated prime ideals of 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 (algorithm = :GTZ). Alternatively, characteristic sets can be used by specifying algorithm = :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) = polynomial_ring(QQ, ["x", "y"])
(Multivariate polynomial ring in 2 variables over QQ, QQMPolyRingElem[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{QQMPolyRingElem}}:
ideal(x - y - 1)
ideal(x^3 - x - y^2)

julia> L = minimal_primes(I, algorithm = :charSets)
2-element Vector{MPolyIdeal{QQMPolyRingElem}}:
ideal(x - y - 1)
ideal(x^3 - x - y^2)
julia> R, (a, b, c, d) = polynomial_ring(ZZ, ["a", "b", "c", "d"])
(Multivariate polynomial ring in 4 variables over ZZ, ZZMPolyRingElem[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{ZZMPolyRingElem}}:
ideal(d, c)
ideal(b, a)
ideal(2, c)
ideal(3)
ideal(13, b)
ideal(17, a)
source

### Weak Equidimensional Decomposition

equidimensional_decomposition_weakMethod
equidimensional_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.

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) = polynomial_ring(QQ, ["x", "y"])
(Multivariate polynomial ring in 2 variables over QQ, QQMPolyRingElem[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{QQMPolyRingElem}}:
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)
source

equidimensional_decomposition_radicalMethod
equidimensional_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.

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) = polynomial_ring(QQ, ["x", "y"])
(Multivariate polynomial ring in 2 variables over QQ, QQMPolyRingElem[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)

2-element Vector{MPolyIdeal{QQMPolyRingElem}}:
ideal(y, x)
ideal(x^4 - x^3*y - x^3 - x^2 - x*y^2 + x*y + x + y^3 + y^2)
source

### Equidimensional Hull

equidimensional_hullMethod
equidimensional_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) = polynomial_ring(QQ, ["x", "y"])
(Multivariate polynomial ring in 2 variables over QQ, QQMPolyRingElem[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) = polynomial_ring(ZZ, ["a", "b", "c", "d"])
(Multivariate polynomial ring in 4 variables over ZZ, ZZMPolyRingElem[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)
source

### Radical of the Equidimensional Hull

equidimensional_hull_radicalMethod
equidimensional_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) = polynomial_ring(QQ, ["x", "y"])
(Multivariate polynomial ring in 2 variables over QQ, QQMPolyRingElem[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)

ideal(x^4 - x^3*y - x^3 - x^2 - x*y^2 + x*y + x + y^3 + y^2)
source

## 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.

homogenizationMethod
homogenization(f::MPolyRingElem, W::Union{ZZMatrix, Matrix{<:IntegerUnion}}, var::VarName; pos::Int)
homogenization(f::MPolyRingElem, W::Union{ZZMatrix, Matrix{<:IntegerUnion}}, var::VarName)

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 (if pos is not specified, it defaults to the position after the last variable). 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{ZZMatrix, Matrix{<:IntegerUnion}}, var::VarName; pos::Int) where {T <: MPolyRingElem}
homogenization(V::Vector{T},  W::Union{ZZMatrix, Matrix{<:IntegerUnion}}, var::VarName) where {T <: MPolyRingElem}

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{ZZMatrix, Matrix{<:IntegerUnion}}, var::VarName; pos::Int) where {T <: MPolyRingElem}
homogenization(I::MPolyIdeal{T},  W::Union{ZZMatrix, Matrix{<:IntegerUnion}}, var::VarName) where {T <: MPolyRingElem}

Return the homogenization of I in an extended ring with $\mathbb Z^m$-grading as above.

Note

If W comprises a single row of positive weights then the method used is essentially the same as for the standard-graded case: compute a wdegrevlex Groebner basis then homogenize its elements. Otherwise 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 product of the homogenizing variables. Source: Kreuzer+Robbiano (vol 2) Cor 4.3.8(a), Defn 4.4.1, Cor 4.4.9, Tutorial 37(g)

Examples

julia> R, (x, y) = polynomial_ring(QQ, ["x", "y"])
(Multivariate polynomial ring in 2 variables over QQ, QQMPolyRingElem[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"; pos=3)
x^3*z^3*z^3 + x^2*y*z^2*z^2 + x*y^2*z*z + y^3

julia> parent(F)
Multivariate polynomial ring in 4 variables over QQ graded by
x -> [1 3]
y -> [2 4]
z -> [1 0]
z -> [0 1]
source
homogenizationMethod
homogenization(f::MPolyRingElem, var::VarName)
homogenization(f::MPolyRingElem, var::VarName; pos::Int)

homogenization(V::Vector{T}, var::VarName) where {T <: MPolyRingElem}
homogenization(V::Vector{T}, var::VarName; pos::Int) where {T <: MPolyRingElem}

homogenization(I::MPolyIdeal{T}, var::VarName; ordering::Symbol = :degrevlex) where {T <: MPolyRingElem}
homogenization(I::MPolyIdeal{T}, var::VarName; pos::Int, ordering::Symbol = :degrevlex) where {T <: MPolyRingElem}

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; if pos is not specified it defaults to just after the last variable.

Note

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) = polynomial_ring(QQ, ["x", "y", "z"])
(Multivariate polynomial ring in 3 variables over QQ, QQMPolyRingElem[x, y, z])

julia> f = x^3-y^2-z
x^3 - y^2 - z

julia> F = homogenization(f, "w"; pos=4)
x^3 - y^2*w - z*w^2

julia> parent(F)
Multivariate polynomial ring in 4 variables over QQ graded by
x -> 
y -> 
z -> 
w -> 

julia> V = [y-x^2, z-x^3]
2-element Vector{QQMPolyRingElem}:
-x^2 + y
-x^3 + z

julia> homogenization(V, "w")
2-element Vector{MPolyDecRingElem{QQFieldElem, QQMPolyRingElem}}:
-x^2 + y*w
-x^3 + z*w^2

julia> I = ideal(R, V)
ideal(-x^2 + y, -x^3 + z)

julia> PTC = homogenization(I, "w")
ideal(-x*z + y^2, x*y - z*w, x^2 - y*w)

julia> parent(PTC)
Multivariate polynomial ring in 4 variables over QQ graded by
x -> 
y -> 
z -> 
w -> 

julia> homogenization(I, "w"; ordering = deglex(gens(base_ring(I))))
ideal(x*z - y^2, x*y - z*w, x^2 - y*w, y^3 - z^2*w)
source
dehomogenizationMethod
dehomogenization(F::MPolyDecRingElem, 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 <: MPolyDecRingElem}

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 <: MPolyDecRingElem}

Return the dehomogenization of I in a polynomial ring as above.

Examples

julia> S, (x, y, z) = graded_polynomial_ring(QQ, ["x", "y", "z"])
(Graded multivariate polynomial ring in 3 variables over QQ, MPolyDecRingElem{QQFieldElem, QQMPolyRingElem}[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 2 variables y, z
over rational field

julia> V = [x*y-z^2, x^2*z-x^3]
2-element Vector{MPolyDecRingElem{QQFieldElem, QQMPolyRingElem}}:
x*y - z^2
-x^3 + x^2*z

julia> dehomogenization(V, 3)
2-element Vector{QQMPolyRingElem}:
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) = graded_polynomial_ring(QQ, ["w", "x", "y", "z"], W)
(Graded multivariate polynomial ring in 4 variables over QQ, MPolyDecRingElem{QQFieldElem, QQMPolyRingElem}[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^3
source

## Ideals as Modules

ideal_as_moduleMethod
ideal_as_module(I::MPolyIdeal)

Return I considered as an object of type SubquoModule.

Examples

julia> R, (x, y) = polynomial_ring(QQ, ["x", "y"]);

julia> I = ideal(R, [x^2, y^3])
ideal(x^2, y^3)

julia> ideal_as_module(I)
Submodule with 2 generators
1 -> x^2*e
2 -> y^3*e
represented as subquotient with no relations.
julia> S, (x, y) = graded_polynomial_ring(QQ, ["x", "y"]);

julia> I = ideal(S, [x^2, y^3])
ideal(x^2, y^3)

julia> ideal_as_module(I)
1 -> x^2*e
2 -> y^3*e
represented as subquotient with no relations
source

## Generating Special Ideals

### Katsura-n

These systems appeared in a problem of magnetism in physics. For a given $n$ katsura(n) has $2^n$ solutions and is defined in a polynomial ring with $n+1$ variables over the rational numbers. For a given polynomial ring R with $n$ variables katsura(R) defines the corresponding system with $2^{n-1}$ solutions.

katsuraMethod
katsura(n::Int)

Given a natural number n return the Katsura ideal over the rational numbers 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\}$.

Note that indices have been shifted to start from 1.

Examples

julia> I = 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)
julia> base_ring(I)
Multivariate polynomial ring in 3 variables x1, x2, x3
over rational field
source
katsuraMethod
katsura(R::MPolyRing)

Return the Katsura ideal in the given polynomial ring R.

Examples

julia> R, _ = QQ["x", "y", "z"]
(Multivariate polynomial ring in 3 variables over QQ, QQMPolyRingElem[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)
source