# Ideals

Singular.jl allows the creation of ideals over a Singular polynomial ring. These are internally stored as a list of (polynomial) generators. This list of generators can also have the property of being a Groebner basis.

The default ideal type in Singular.jl is the Singular `sideal`

type.

Ideals objects have a parent object which represents the set of ideals they belong to, the data for which is given by the polynomial ring their generators belong to.

The types of ideals and associated parent objects are given in the following table according to the library providing them.

Library | Element type | Parent type |
---|---|---|

Singular | `sideal{T}` | `Singular.IdealSet{T}` |

These types are parameterised by the type of elements of the polynomial ring over which the ideals are defined.

All ideal types belong directly to the abstract type `Module{T}`

and all the ideal set parent object types belong to the abstract type `Set`

.

## Ideal functionality

Singular.jl ideals implement standard operations one would expect on modules. These include:

Operations common to all AbstractAlgebra objects, such as

`parent`

,`base_ring`

,`elem_type`

,`parent_type`

,`parent`

,`deepcopy`

, etc.Addition

Also implements is the following operations one expects for ideals:

Multiplication

Powering

Below, we describe all of the functionality for Singular.jl ideals that is not included in this list of basic operations.

### Constructors

Given a Singular polynomial ring $R$, the following constructors are available for creating ideals.

```
Ideal(R::PolyRing{T}, ids::spoly{T}...) where T <: Nemo.RingElem
Ideal(R::PolyRing{T}, ids::Vector{spoly{T}}) where T <: Nemo.RingElem
```

Construct the ideal over the polynomial ring $R$ whose (polynomial) generators are given by the given parameter list or array of polynomials, respectively. The list may be empty, resulting in the zero ideal.

**Examples**

```
R, (x, y) = PolynomialRing(ZZ, ["x", "y"])
I1 = Ideal(R, x*y + 1, x^2)
I2 = Ideal(R, [x*y + 1, x^2])
```

### Basic manipulation

`GroupsCore.ngens`

— Method`ngens(I::sideal)`

Return the number of generators in the internal representation of the ideal $I$.

`GroupsCore.gens`

— Method`gens(I::sideal)`

Return the generators in the internal representation of the ideal $I$ as an array.

Singular.jl overloads the `setindex!`

and `getindex`

functions so that one can access the generators of an ideal using array notation.

`I[n::Int]`

`Base.iszero`

— Method`iszero(I::sideal)`

Return `true`

if the given ideal is algebraically the zero ideal.

`Singular.is_zerodim`

— Method`is_zerodim(I::sideal)`

Return `true`

if the given ideal is zero dimensional, i.e. the Krull dimension of $R/I$ is zero, where $R$ is the polynomial ring over which $I$ is an ideal..

`Singular.dimension`

— Method`dimension(I::sideal{spoly{T}}) where T <: Nemo.RingElem`

Given an ideal $I$ this function computes the Krull dimension of the ring $R/I$, where $R$ is the polynomial ring over which $I$ is an ideal. The ideal must be over a polynomial ring and a Groebner basis.

`AbstractAlgebra.is_constant`

— Method`is_constant(I::sideal)`

Return `true`

if the given ideal is a constant ideal, i.e. generated by constants in the polynomial ring over which it is an ideal.

`Singular.is_var_generated`

— Method`is_var_generated(I::sideal)`

Return `true`

if each generator in the representation of the ideal $I$ is a generator of the polynomial ring, i.e. a variable.

`LinearAlgebra.normalize!`

— Method`normalize!(I::sideal)`

Normalize the polynomial generators of the ideal $I$ in-place. This means to reduce their coefficients to lowest terms. In most cases this does nothing, but if the coefficient ring were the rational numbers for example, the coefficients of the polynomials would be reduced to lowest terms.

`Singular.interreduce`

— Method`interreduce(I::sideal{S}) where {T <: Nemo.RingElem, S <: Union{spoly{T}, spluralg{T}}}`

Interreduce the elements of I such that no leading term is divisible by another leading term. This returns a new ideal and does not modify the input ideal.

**Examples**

```
R, (x, y) = PolynomialRing(ZZ, ["x", "y"])
I = Ideal(R, x^2 + 1, x*y)
n = ngens(I)
p = I[1]
I[1] = 2x + y^2
is_constant(I) == false
is_var_generated(I) == false
is_zerodim(I) == false
S, (u, v) = PolynomialRing(QQ, ["u", "v"])
J = Ideal(S, u^2 + 1, u*v)
dimension(std(J)) == 0
```

### Containment

`Base.contains`

— Method`contains(I::sideal{S}, J::sideal{S}) where S`

Returns `true`

if the ideal $I$ contains the ideal $J$. This will be expensive if $I$ is not a Groebner ideal, since its standard basis must be computed.

**Examples**

```
R, (x , y) = PolynomialRing(QQ, ["x", "y"])
I = Ideal(R, x^2 + 1, x*y)
J = Ideal(R, x^2 + 1)
contains(I, J) == true
```

### Comparison

Checking whether two ideals are algebraically equal is very expensive, as it usually requires computing Groebner bases. Therefore we do not overload the `==`

operator for ideals. Instead we have the following two functions.

`Base.isequal`

— Method`isequal(I1::sideal{S}, I2::sideal{S}) where S <: SPolyUnion`

Return `true`

if the given ideals have the same generators in the same order. Note that two algebraically equal ideals with different generators will return `false`

.

`Singular.equal`

— Method`equal(I1::sideal{S}, I2::sideal{S}) where S <: SPolyUnion`

Return `true`

if the two ideals are contained in each other, i.e. are the same ideal mathematically. This function should be called only as a last resort; it is exceptionally expensive to test equality of ideals! Do not define `==`

as an alias for this function!

**Examples**

```
R, (x , y) = PolynomialRing(QQ, ["x", "y"])
I = Ideal(R, x^2 + 1, x*y)
J = Ideal(R, x^2 + x*y + 1, x^2 - x*y + 1)
isequal(I, J) == false
equal(I, J) == true
```

### Intersection

`Singular.intersection`

— Method`intersection(I::sideal{S}, J::sideal{S}) where {T <: Nemo.RingElem, S <: Union{spoly{T}, spluralg{T}}}`

Returns the intersection of the two given ideals.

**Examples**

```
R, (x , y) = PolynomialRing(QQ, ["x", "y"])
I = Ideal(R, x^2 + 1, x*y)
J = Ideal(R, x^2 + x*y + 1, x^2 - x*y + 1)
V = intersection(I, J)
```

### Quotient

`Singular.quotient`

— Method`quotient(I::sideal{S}, J::sideal{S}) where S <: spoly`

Returns the quotient of the two given ideals. Recall that the ideal quotient $(I:J)$ over a polynomial ring $R$ is defined by $\{r \in R \;|\; rJ \subseteq I\}$.

`Singular.quotient`

— Method`quotient(I::sideal{S}, J::sideal{S}) where S <: spluralg`

Returns the quotient of the two given ideals, where $J$ must be two-sided.

**Examples**

```
R, (x , y) = PolynomialRing(QQ, ["x", "y"])
I = Ideal(R, x^2 + 1, x*y)
J = Ideal(R, x + y)
V = quotient(I, J)
```

### Leading terms

`AbstractAlgebra.lead`

— Method`lead(I::sideal{S}) where S <: SPolyUnion`

Return the ideal generated by the leading terms of the polynomials generating $I$.

**Examples**

```
R, (x , y) = PolynomialRing(QQ, ["x", "y"])
I = Ideal(R, x^2 + 1, x*y)
V = lead(I)
```

### Homogeneous ideals

`Singular.is_homogeneous`

— Method`is_homogeneous(I::sideal)`

Return `true`

if each stored generator of `I`

is homogeneous, otherwise `false`

. If `base_ring(I)`

has a weighted monomial ordering, the test is conducted with respect to the corresponding weights.

`Singular.homogenize`

— Method`homogenize(I::sideal{S}, v::S) where S <: spoly`

Multiply each monomial in the generators of `I`

by a suitable power of the variable `v`

and return the corresponding homogeneous ideal. The variable `v`

must have weight `1`

.

### Saturation

`Singular.saturation`

— Method`saturation(I::sideal{T}, J::sideal{T}) where T <: Nemo.RingElem`

Returns the saturation of the ideal $I$ with respect to $J$, i.e. returns the quotient ideal $(I:J^\infty)$ and the number of iterations.

**Examples**

```
R, (x, y) = PolynomialRing(QQ, ["x", "y"])
I = Ideal(R, (x^2 + x*y + 1)*(2y^2+1)^3, (2y^2 + 3)*(2y^2+1)^2)
J = Ideal(R, 2y^2 + 1)
S = saturation(I, J)
```

### Standard basis

`Statistics.std`

— Method`std(I::sideal{S}; complete_reduction::Bool=false) where S <: SPolyUnion`

Compute a Groebner basis for the ideal $I$. Note that without `complete_reduction`

set to `true`

, the generators of the Groebner basis only have unique leading terms (up to permutation and multiplication by constants). If `complete_reduction`

is set to `true`

(and the ordering is a global ordering) then the Groebner basis is unique.

`Singular.fglm`

— Method`fglm(I::sideal{spoly{T}}, ordering::Symbol) where T <: Nemo.RingElem`

Compute a Groebner basis for the zero - dimensional ideal $I$ in the ring $R$ using the FGLM algorithm. All involved orderings have to be global.

`Singular.satstd`

— Method`satstd(I::sideal{spoly{T}}, J::sideal{spoly{T}} = Ideal(base_ring(I), gens(base_ring(I)))) where T <: Nemo.RingElem`

Given an ideal $J$ generated by variables, computes a standard basis of `saturation(I, J)`

. This is accomplished by dividing polynomials that occur throughout the std computation by variables occurring in $J$, where possible. Thus the result can be obtained faster than by first computing the saturation and then the standard basis.

`Singular.lift_std`

— Method`lift_std(M::sideal{S}; complete_reduction::Bool = false) where S <: spoly`

computes the Groebner base G of M and the transformation matrix T such that (Matrix(G) = Matrix(M) * T)

`Singular.lift_std_syz`

— Method`lift_std_syz(M::sideal{S}; complete_reduction::Bool = false) where S <: spoly`

computes the Groebner base G of I, the transformation matrix T and the syzygies of M. Returns G,T,S (Matrix(G) = Matrix(I) * T, 0=Matrix(M)*Matrix(S))

**Examples**

```
R, (x, y) = PolynomialRing(QQ, ["x", "y"])
I = Ideal(R, x^2 + x*y + 1, 2y^2 + 3)
J = Ideal(R, 2*y^2 + 3, x^2 + x*y + 1)
A = std(I)
R, (x, y) = PolynomialRing(QQ, ["x", "y"])
I = Ideal(R, (x*y + 1)*(2x^2*y^2 + x*y - 2) + 2x*y^2 + x, 2x*y + 1)
J = Ideal(R, x)
B = satstd(I, J)
R, (x, y, z) = PolynomialRing(QQ, ["x", "y", "z"], ordering = :lex)
I = Ideal(R, y^3+x^2, x^2*y+x^2, x^3-x^2, z^4-x^2-y)
J = fglm(I, :degrevlex)
```

### Reduction

`Base.reduce`

— Method`reduce(I::sideal{S}, G::sideal{S}) where S <: SPolyUnion`

Return an ideal whose generators are the generators of $I$ reduced by the ideal $G$. The ideal $G$ need not be a Groebner basis. The returned ideal will have the same number of generators as $I$, even if they are zero. For PLURAL rings (S <: spluralg, GAlgebra, WeylAlgebra), the reduction is only a left reduction, and hence cannot be used to test containment in a two-sided ideal. For LETTERPLACE rings (S <: slpalg, FreeAlgebra), the reduction is two-sided as only two-sided ideals can be constructed here.

`Base.reduce`

— Method`reduce(p::S, G::sideal{S}) where S <: SPolyUnion`

Return the polynomial which is $p$ reduced by the polynomials generating $G$. The ideal $G$ need not be a Groebner basis. For PLURAL rings (S <: spluralg, GAlgebra, WeylAlgebra), the reduction is only a left reduction, and hence cannot be used to test membership in a two-sided ideal. For LETTERPLACE rings (S <: slpalg, FreeAlgebra), the reduction is the full two-sided reduction as only two-sided ideals can be constructed here.

**Examples**

```
R, (x, y) = PolynomialRing(QQ, ["x", "y"])
f = x^2*y + 2y + 1
g = y^2 + 1
I = Ideal(R, (x^2 + 1)*f + (x + y)*g + x + 1, (2y^2 + x)*f + y)
J = std(Ideal(R, f, g))
V = reduce(I, J)
h1 = (x^2 + 1)*f + (x + y)*g + x + 1
h2 = reduce(h1, J)
```

### Elimination

`Singular.eliminate`

— Method`eliminate(I::sideal{S}, polys::S...) where {T <: Nemo.RingElem, S <: Union{spoly{T}, spluralg{T}}}`

Given a list of polynomials which are variables, construct the ideal corresponding geometrically to the projection of the variety given by the ideal $I$ where those variables have been eliminated.

**Examples**

```
R, (x, y, t) = PolynomialRing(QQ, ["x", "y", "t"])
I = Ideal(R, x - t^2, y - t^3)
J = eliminate(I, t)
```

### Syzygies

`Singular.syz`

— Method`syz(I::sideal)`

Compute the module of syzygies of the ideal.

**Examples**

```
R, (x, y) = PolynomialRing(QQ, ["x", "y"])
I = Ideal(R, x^2*y + 2y + 1, y^2 + 1)
F = syz(I)
M = Singular.Matrix(I)
N = Singular.Matrix(F)
# check they are actually syzygies
iszero(M*N)
```

### Free resolutions

`Singular.fres`

— Method```
fres{T <: Nemo.FieldElem}(id::Union{sideal{spoly{T}}, smodule{spoly{T}}},
max_length::Int, method::String="complete")
```

Compute a free resolution of the given ideal/module up to the maximum given length. The ideal/module must be over a polynomial ring over a field, and a Groebner basis. The possible methods are "complete", "frame", "extended frame" and "single module". The result is given as a resolution, whose i-th entry is the syzygy module of the previous module, starting with the given ideal/module. The `max_length`

can be set to $0$ if the full free resolution is required.

`Singular.sres`

— Method` sres{T <: Nemo.FieldElem}(id::sideal{spoly{T}}, max_length::Int)`

Compute a (free) Schreyer resolution of the given ideal up to the maximum given length. The ideal must be over a polynomial ring over a field, and a Groebner basis. The result is given as a resolution, whose i-th entry is the syzygy module of the previous module, starting with the given ideal. The `max_length`

can be set to $0$ if the full free resolution is required.

**Examples**

```
R, (x, y) = PolynomialRing(QQ, ["x", "y"])
I = Ideal(R, x^2*y + 2y + 1, y^2 + 1)
F1 = fres(std(I), 0)
F2 = sres(std(I), 2)
```

### Differential operations

`Singular.jet`

— Method`jet(I::sideal{S}, n::Int) where {T <: Nemo.RingElem, S <: Union{spoly{T}, spluralg{T}}}`

Given an ideal $I$ this function truncates the generators of $I$ up to degree $n$.

**Examples**

```
R, (x, y, z) = PolynomialRing(QQ, ["x", "y", "z"])
I = Ideal(R, x^5 - y^2, y^3 - x^6 + z^3)
J1 = jet(I, 3)
```

### Operations on zero-dimensional ideals

`Singular.vdim`

— Method`vdim(I::sideal{S}) where {T <: Nemo.FieldElem, S <: Union{spoly{T}, spluralg{T}}}`

Given a zero-dimensional ideal $I$ this function computes the dimension of the vector space `base_ring(I)/I`

, where `base_ring(I)`

must be a polynomial ring over a field, and $I$ must be a Groebner basis. The return is $-1$ if `!is_zerodim(I)`

.

`Singular.kbase`

— Method`kbase(I::sideal{S}) where {T <: Nemo.FieldElem, S <: Union{spoly{T}, spluralg{T}}}`

Given a zero-dimensional ideal $I$ this function computes a vector space basis of the vector space `base_ring(I)/I`

, where `base_ring(I)`

must be a polynomial ring over a field, and $I$ must be a Groebner basis. The array of vector space basis elements is returned as a Singular ideal, and this array consists of one zero polynomial if `!is_zerodim(I)`

.

`Singular.highcorner`

— Method`highcorner(I::sideal{S}) where {T <: Nemo.FieldElem, S <: Union{spoly{T}, spluralg{T}}}`

Given a zero-dimensional ideal $I$ this function computes its highest corner, which is a polynomial. The ideal must be over a polynomial ring over a field, and a Groebner basis. The return is the zero polynomial if `!is_zerodim(I)`

.

**Examples**

```
R, (x, y) = PolynomialRing(QQ, ["x", "y"]; ordering=:negdegrevlex)
I = Ideal(R, 3*x^2 + y^3, x*y^2)
I = std(I)
n = vdim(I)
J = kbase(I)
f = highcorner(I)
```

### Operations over local rings

If the base ring `R`

is a local ring, a minimal generating set can be computed using the following function

`Singular.minimal_generating_set`

— Method`minimal_generating_set(I::sideal{S}) where S <: spoly`

Given an ideal $I$ in ring $R$ with local ordering, this returns an array containing the minimal generators of $I$.

**Examples**

```
R, (x, y) = PolynomialRing(QQ, ["x", "y"]; ordering=:negdegrevlex)
has_local_ordering(R) == true
I = Ideal(R, y, x^2, (1 + y^3) * (x^2 - y))
min = minimal_generating_set(I)
```

### Independent sets of monomial ideals

Let $I$ be an ideal of $K[x_1, ..., x_n].$ An `independent set`

is a subset $u \subseteq \{x_1, ..., x_n\},$ such that $I \cap K[u]= 0.$ In case $u$ cannot be enlarged, it is called `non-extendable independent set`

. If in addition $|u| = dim(K[x_1, ..., x_n]/I),$ $u$ is called `maximal independent set`

. Using Singular.jl one can compute non-extendable, resp. maximal independent sets for monomial ideals. If an arbitrary ideal $I$ is passed to the function, the computation is performed on the leading ideal of $I$.

`Singular.independent_sets`

— Method`independent_sets(I::sideal{spoly{T}}) where T <: Nemo.FieldElem`

Returns all non-extendable independent sets of $lead(I)$. $I$ has to be given by a Groebner basis.

`Singular.maximal_independent_set`

— Method`maximal_independent_set(I::sideal{spoly{T}}; all::Bool = false) where T <: Nemo.FieldElem`

Returns, by default, an array containing a maximal independent set of $lead(I)$. $I$ has to be given by a Groebner basis. If the additional parameter "all" is set to true, an array containing all maximal independent sets of $lead(I)$ is returned.

```
R, (x, y, u, v, w) = PolynomialRing(QQ, ["x", "y", "u", "v", "w"])
has_local_ordering(R) == true
I = Ideal(R, x*y*w, y*v*w, u*y*w, x*v)
I = std(I)
L1 = independent_sets(I)
L2 = maximal_independent_set(I)
L3 = maximal_independent_set(I, all = true)
```