# Affine Algebras and Their Ideals

With regard to notation, we use *affine algebra* as a synonym for *quotient of a multivariate polynomial ring by an ideal*. More specifically, if $R$ is a multivariate polynomial ring with coefficient ring $C$, and $A=R/I$ is the quotient of $R$ by an ideal $I$ of $R$, we refer to $A$ as an *affine algebra over $C$*, or an *affine $C$-algebra*. In this section, we discuss functionality for handling such algebras in OSCAR.

We emphasize: In this section, we view $R/I$ together with its ring structure. Realizing $R/I$ as an $R$-module means to implement it as the quotient of a free $R$-module of rank 1. See the section on modules.

Most functions discussed here rely on Gröbner basis techniques. In particular, they typically make use of a Gröbner basis for the modulus of the quotient. Nevertheless, the construction of quotients is lazy in the sense that the computation of such a Gröbner basis is delayed until the user performs an operation that indeed requires it. The Gröbner basis is then computed with respect to the monomial ordering entered by the user when creating the quotient; if no ordering is entered, OSCAR will use the `default_ordering`

on the underlying polynomial ring. See the section on Gröbner/Standard Bases for default orderings in OSCAR. Once computed, the Gröbner basis is cached for later reuse.

Recall that Gröbner basis methods are implemented for multivariate polynomial rings over fields (exact fields supported by OSCAR) and, where not indicated otherwise, for multivariate polynomial rings over the integers.

In OSCAR, elements of a quotient $A = R/I$ are not necessarily represented by polynomials which are reduced with regard to $I$. That is, if $f\in R$ is the internal polynomial representative of an element of $A$, then $f$ may not be the normal form mod $I$ with respect to the default ordering on $R$ (see the section on Gröbner/Standard Bases for normal forms). Operations involving Gröbner basis computations may lead to (partial) reductions. The function `simplify`

discussed in this section computes fully reduced representatives.

Each grading on a multivariate polynomial ring `R`

in OSCAR descends to a grading on the affine algebra `A = R/I`

(recall that OSCAR ideals of graded polynomial rings are required to be homogeneous). Functionality for dealing with such gradings and our notation for describing this functionality descend accordingly. This applies, in particular, to the functions `is_graded`

, `is_standard_graded`

, `is_z_graded`

, `is_zm_graded`

, and `is_positively_graded`

which will not be discussed again here.

## Types

The OSCAR type for quotients of multivariate polynomial rings is of parametrized form `MPolyQuoRing{T}`

, with elements of type `MPolyQuoRingElem{T}`

. Here, `T`

is the element type of the polynomial ring.

## Constructors

`quo`

— Method`quo(R::MPolyRing, I::MPolyIdeal; ordering::MonomialOrdering = default_ordering(R)) -> MPolyQuoRing, Map`

Create the quotient ring `R/I`

and return the new ring as well as the projection map `R`

$\to$ `R/I`

.

`quo(R::MPolyRing, V::Vector{MPolyRingElem}; ordering::MonomialOrdering = default_ordering(R)) -> MPolyQuoRing, Map`

As above, where `I`

is the ideal of `R`

generated by the polynomials in `V`

.

Once `R/I`

is created, all computations within `R/I`

relying on division with remainder and/or Gröbner bases are done with respect to `ordering`

.

**Examples**

```
julia> R, (x, y) = polynomial_ring(QQ, ["x", "y"]);
julia> A, p = quo(R, ideal(R, [x^2-y^3, x-y]));
julia> A
Quotient
of multivariate polynomial ring in 2 variables x, y
over rational field
by ideal (x^2 - y^3, x - y)
julia> typeof(A)
MPolyQuoRing{QQMPolyRingElem}
julia> typeof(x)
QQMPolyRingElem
julia> p
Map defined by a julia-function with inverse
from multivariate polynomial ring in 2 variables over QQ
to quotient of multivariate polynomial ring by ideal (x^2 - y^3, x - y)
julia> p(x)
x
julia> typeof(p(x))
MPolyQuoRingElem{QQMPolyRingElem}
```

```
julia> S, (x, y, z) = graded_polynomial_ring(QQ, ["x", "y", "z"]);
julia> B, _ = quo(S, ideal(S, [x^2*z-y^3, x-y]))
(Quotient of multivariate polynomial ring by ideal (x^2*z - y^3, x - y), Map: S -> B)
julia> typeof(B)
MPolyQuoRing{MPolyDecRingElem{QQFieldElem, QQMPolyRingElem}}
```

## Data Associated to Affine Algebras

### Basic Data

If `A=R/I`

is the quotient of a multivariate polynomial ring `R`

modulo an ideal `I`

of `R`

, then

`base_ring(A)`

refers to`R`

,`modulus(A)`

to`I`

,`gens(A)`

to the generators of`A`

,`number_of_generators(A)`

/`ngens(A)`

to the number of these generators,`gen(A, i)`

as well as`A[i]`

to the`i`

-th such generator, and`ordering(A)`

to the monomial ordering used in the construction of`A`

.

###### Examples

```
julia> R, (x, y, z) = polynomial_ring(QQ, ["x", "y", "z"]);
julia> A, _ = quo(R, ideal(R, [y-x^2, z-x^3]));
julia> base_ring(A)
Multivariate polynomial ring in 3 variables x, y, z
over rational field
julia> modulus(A)
Ideal generated by
-x^2 + y
-x^3 + z
julia> gens(A)
3-element Vector{MPolyQuoRingElem{QQMPolyRingElem}}:
x
y
z
julia> number_of_generators(A)
3
julia> gen(A, 2)
y
julia> ordering(A)
degrevlex([x, y, z])
```

In the graded case, we additionally have:

`grading_group`

— Method`grading_group(A::MPolyQuoRing{<:MPolyDecRingElem})`

If `A`

is, say, `G`

-graded, return `G`

.

**Examples**

```
julia> R, (x, y, z) = graded_polynomial_ring(QQ, ["x", "y", "z"]);
julia> A, _ = quo(R, ideal(R, [x^2*z-y^3, x-y]));
julia> grading_group(A)
Z
```

`monomial_basis`

— Method`monomial_basis(A::MPolyQuoRing, g::FinGenAbGroupElem)`

Given an affine algebra `A`

over a field which is graded by a free group of type `FinGenAbGroup`

, and given an element `g`

of that group, return a vector of monomials of `R`

such that the residue classes of these monomials form a `K`

-basis of the graded part of `A`

of degree `g`

.

`monomial_basis(A::MPolyQuoRing, W::Vector{<:IntegerUnion})`

Given a $\mathbb Z^m$-graded affine algebra `A`

over a field and a vector `W`

of $m$ integers, convert `W`

into an element `g`

of the grading group of `A`

and proceed as above.

`monomial_basis(A::MPolyQuoRing, d::IntegerUnion)`

Given a $\mathbb Z$-graded affine algebra `A`

over a field and an integer `d`

, convert `d`

into an element `g`

of the grading group of `A`

and proceed as above.

If the component of the given degree is not finite dimensional, an error message will be thrown.

**Examples**

```
julia> R, (x, y) = graded_polynomial_ring(QQ, ["x", "y"]);
julia> I = ideal(R, [x^2])
Ideal generated by
x^2
julia> A, _ = quo(R, I)
(Quotient of multivariate polynomial ring by ideal (x^2), Map: R -> A)
julia> L = monomial_basis(A, 3)
2-element Vector{MPolyDecRingElem{QQFieldElem, QQMPolyRingElem}}:
y^3
x*y^2
```

`homogeneous_component`

— Method`homogeneous_component(A::MPolyQuoRing{<:MPolyDecRingElem}, g::FinGenAbGroupElem)`

Given a graded quotient `A`

of a multivariate polynomial ring over a field, where the grading group is free of type `FinGenAbGroup`

, and given an element `g`

of that group, return the homogeneous component of `A`

of degree `g`

. Additionally, return the embedding of the component into `A`

.

`homogeneous_component(A::MPolyQuoRing{<:MPolyDecRingElem}, g::Vector{<:IntegerUnion})`

Given a $\mathbb Z^m$-graded quotient `A`

of a multivariate polynomial ring over a field, and given a vector `g`

of $m$ integers, convert `g`

into an element of the grading group of `A`

, and return the homogeneous component of `A`

whose degree is that element. Additionally, return the embedding of the component into `A`

.

`homogeneous_component(A::MPolyQuoRing{<:MPolyDecRingElem}, g::IntegerUnion)`

Given a $\mathbb Z$-graded quotient `A`

of a multivariate polynomial ring over a field, and given an integer `g`

, convert `g`

into an element of the grading group of `A`

, and return the homogeneous component of `A`

whose degree is that element. Additionally, return the embedding of the component into `A`

.

If the component is not finite dimensional, an error message will be thrown.

**Examples**

```
julia> R, (w, x, y, z) = graded_polynomial_ring(QQ, ["w", "x", "y", "z"])
(Graded multivariate polynomial ring in 4 variables over QQ, MPolyDecRingElem{QQFieldElem, QQMPolyRingElem}[w, x, y, z])
julia> L = homogeneous_component(R, 2);
julia> HC = gens(L[1]);
julia> EMB = L[2]
Map defined by a julia-function with inverse
from R_[2] of dim 10
to graded multivariate polynomial ring in 4 variables over QQ
julia> for i in 1:length(HC) println(EMB(HC[i])) end
z^2
y*z
y^2
x*z
x*y
x^2
w*z
w*y
w*x
w^2
julia> PTC = ideal(R, [-x*z + y^2, -w*z + x*y, -w*y + x^2]);
julia> A, _ = quo(R, PTC);
julia> L = homogeneous_component(A, 2);
julia> HC = gens(L[1]);
julia> EMB = L[2]
Map defined by a julia-function with inverse
from quotient space over QQ with 7 generators and no relations
to quotient of multivariate polynomial ring by ideal (-x*z + y^2, -w*z + x*y, -w*y + x^2)
julia> for i in 1:length(HC) println(EMB(HC[i])) end
z^2
y*z
x*z
w*z
w*y
w*x
w^2
```

```
julia> G = abelian_group([0, 0])
Z^2
julia> W = [G[1], G[1], G[2], G[2], G[2]];
julia> S, x, y = graded_polynomial_ring(QQ, "x" => 1:2, "y" => 1:3; weights = W);
julia> L = homogeneous_component(S, [2,1]);
julia> HC = gens(L[1]);
julia> EMB = L[2]
Map defined by a julia-function with inverse
from S_[2 1] of dim 9
to graded multivariate polynomial ring in 5 variables over QQ
julia> for i in 1:length(HC) println(EMB(HC[i])) end
x[2]^2*y[3]
x[2]^2*y[2]
x[2]^2*y[1]
x[1]*x[2]*y[3]
x[1]*x[2]*y[2]
x[1]*x[2]*y[1]
x[1]^2*y[3]
x[1]^2*y[2]
x[1]^2*y[1]
julia> I = ideal(S, [x[1]*y[1]-x[2]*y[2]]);
julia> A, = quo(S, I);
julia> L = homogeneous_component(A, [2,1]);
julia> HC = gens(L[1]);
julia> EMB = L[2]
Map defined by a julia-function with inverse
from quotient space over QQ with 7 generators and no relations
to quotient of multivariate polynomial ring by ideal (x[1]*y[1] - x[2]*y[2])
julia> for i in 1:length(HC) println(EMB(HC[i])) end
x[2]^2*y[3]
x[2]^2*y[2]
x[2]^2*y[1]
x[1]*x[2]*y[3]
x[1]*x[2]*y[2]
x[1]^2*y[3]
x[1]^2*y[2]
```

### Dimension

`dim`

— Method`dim(A::MPolyQuoRing)`

Return the Krull dimension of `A`

.

**Examples**

```
julia> R, (x, y, z) = polynomial_ring(QQ, ["x", "y", "z"]);
julia> A, _ = quo(R, ideal(R, [y-x^2, z-x^3]));
julia> dim(A)
1
```

`is_finite_dimensional_vector_space`

— Method`is_finite_dimensional_vector_space(A::MPolyQuoRing)`

If, say, `A = R/I`

, where `R`

is a multivariate polynomial ring over a field `K`

, and `I`

is an ideal of `R`

, return `true`

if `A`

is finite-dimensional as a `K`

-vector space, `false`

otherwise.

`A`

is finite-dimensional as a `K`

-vector space iff it has Krull dimension zero. This condition is checked by the function.

**Examples**

```
julia> R, (x, y, z) = polynomial_ring(QQ, ["x", "y", "z"]);
julia> A, _ = quo(R, ideal(R, [x^3+y^3+z^3-1, x^2+y^2+z^2-1, x+y+z-1]));
julia> is_finite_dimensional_vector_space(A)
true
julia> A, _ = quo(R, ideal(R, [x]));
julia> is_finite_dimensional_vector_space(A)
false
```

`vector_space_dimension`

— Method`vector_space_dimension(A::MPolyQuoRing)`

If, say, `A = R/I`

, where `R`

is a multivariate polynomial ring over a field `K`

, and `I`

is an ideal of `R`

, return the dimension of `A`

as a `K`

-vector space.

If `A`

is not finite-dimensional as a `K`

-vector space, an error is thrown.

**Examples**

```
julia> R, (x, y, z) = polynomial_ring(QQ, ["x", "y", "z"]);
julia> A, _ = quo(R, ideal(R, [x^3+y^3+z^3-1, x^2+y^2+z^2-1, x+y+z-1]));
julia> vector_space_dimension(A)
6
julia> I = modulus(A)
Ideal generated by
x^3 + y^3 + z^3 - 1
x^2 + y^2 + z^2 - 1
x + y + z - 1
julia> groebner_basis(I, ordering = lex(base_ring(I)))
Gröbner basis with elements
1 -> z^3 - z^2
2 -> y^2 + y*z - y + z^2 - z
3 -> x + y + z - 1
with respect to the ordering
lex([x, y, z])
```

`monomial_basis`

— Method`monomial_basis(A::MPolyQuoRing)`

If, say, `A = R/I`

, where `R`

is a multivariate polynomial ring over a field `K`

, and `I`

is an ideal of `R`

, return a vector of monomials of `R`

such that the residue classes of these monomials form a basis of `A`

as a `K`

-vector space.

If `A`

is not finite-dimensional as a `K`

-vector space, an error is thrown.

**Examples**

```
julia> R, (x, y) = graded_polynomial_ring(QQ, ["x", "y"]);
julia> I = ideal(R, [x^2, y^3])
Ideal generated by
x^2
y^3
julia> A, _ = quo(R, I)
(Quotient of multivariate polynomial ring by ideal (x^2, y^3), Map: R -> A)
julia> L = monomial_basis(A)
6-element Vector{MPolyDecRingElem{QQFieldElem, QQMPolyRingElem}}:
x*y^2
y^2
x*y
y
x
1
```

## Elements of Affine Algebras

### Types

The OSCAR type for elements of quotients of multivariate polynomial rings is of parametrized form `MPolyQuoRing{T}`

, where `T`

is the element type of the polynomial ring.

### Creating Elements of Affine Algebras

Elements of an affine algebra `A=R/I`

are created as images of elements of `R`

under the projection map or by directly coercing elements of `R`

into `A`

.

###### Examples

```
julia> R, (x, y) = polynomial_ring(QQ, ["x", "y"]);
julia> A, p = quo(R, ideal(R, [x^3*y^2-y^3*x^2, x*y^4-x*y^2]));
julia> f = p(x^3*y^2-y^3*x^2+x*y)
x^3*y^2 - x^2*y^3 + x*y
julia> typeof(f)
MPolyQuoRingElem{QQMPolyRingElem}
julia> g = A(x^3*y^2-y^3*x^2+x*y)
x^3*y^2 - x^2*y^3 + x*y
julia> f == g
true
```

### Reducing Polynomial Representatives

`simplify`

— Method`simplify(f::MPolyQuoRingElem)`

If `f`

is an element of the affine algebra `A = R/I`

, say, replace the internal polynomial representative of `f`

by its normal form mod `I`

with respect to `ordering(A)`

.

**Examples**

```
julia> R, (x,) = polynomial_ring(QQ, ["x"]);
julia> A, p = quo(R, ideal(R, [x^4]));
julia> f = p(2*x^6 + x^3 + x)
2*x^6 + x^3 + x
julia> simplify(f)
x^3 + x
julia> f
x^3 + x
```

### Tests on Elements of Affine Algebras

`==`

— Method`==(f::MPolyQuoRingElem{T}, g::MPolyQuoRingElem{T}) where T`

Return `true`

if `f`

is equal to `g`

, `false`

otherwise.

**Examples**

```
julia> R, (x,) = polynomial_ring(QQ, ["x"]);
julia> A, p = quo(R, ideal(R, [x^4]));
julia> f = p(x-x^6)
-x^6 + x
julia> g = p(x)
x
julia> f == g
true
```

In the graded case, we additionally have:

`is_homogeneous`

— Method`is_homogeneous(f::MPolyQuoRingElem{<:MPolyDecRingElem})`

Given an element `f`

of a graded affine algebra, return `true`

if `f`

is homogeneous, `false`

otherwise.

**Examples**

```
julia> R, (x, y, z) = graded_polynomial_ring(QQ, ["x", "y", "z"]);
julia> A, p = quo(R, ideal(R, [y-x, z^3-x^3]));
julia> f = p(y^2-x^2+z^4)
-x^2 + y^2 + z^4
julia> is_homogeneous(f)
true
julia> f
z^4
```

### Data associated to Elements of Affine Algebras

Given an element `f`

of an affine algebra `A`

,

`parent(f)`

refers to`A`

.

In the graded case, we also have:

`homogeneous_components`

— Method`homogeneous_components(f::MPolyQuoRingElem{<:MPolyDecRingElem})`

Given an element `f`

of a graded affine algebra, return the homogeneous components of `f`

.

**Examples**

```
julia> R, (x, y, z) = graded_polynomial_ring(QQ, ["x", "y", "z"]);
julia> A, p = quo(R, ideal(R, [y-x, z^3-x^3]));
julia> f = p(y^2-x^2+x*y*z+z^4)
-x^2 + x*y*z + y^2 + z^4
julia> homogeneous_components(f)
Dict{FinGenAbGroupElem, MPolyQuoRingElem{MPolyDecRingElem{QQFieldElem, QQMPolyRingElem}}} with 2 entries:
[4] => z^4
[3] => y^2*z
```

`homogeneous_component`

— Method`homogeneous_component(f::MPolyQuoRingElem{<:MPolyDecRingElem}, g::FinGenAbGroupElem)`

Given an element `f`

of a graded affine algebra, and given an element `g`

of the grading group of that algebra, return the homogeneous component of `f`

of degree `g`

.

`homogeneous_component(f::MPolyQuoRingElem{<:MPolyDecRingElem}, g::Vector{<:IntegerUnion})`

Given an element `f`

of a $\mathbb Z^m$-graded affine algebra `A`

, say, and given a vector `g`

of $m$ integers, convert `g`

into an element of the grading group of `A`

, and return the homogeneous component of `f`

whose degree is that element.

`homogeneous_component(f::MPolyQuoRingElem{<:MPolyDecRingElem}, g::IntegerUnion)`

Given an element `f`

of a $\mathbb Z$-graded affine algebra `A`

, say, and given an integer `g`

, convert `g`

into an element of the grading group of `A`

, and return the homogeneous component of `f`

whose degree is that element.

**Examples**

```
julia> R, (x, y, z) = graded_polynomial_ring(QQ, ["x", "y", "z"]);
julia> A, p = quo(R, ideal(R, [y-x, z^3-x^3]));
julia> f = p(y^2-x^2+x*y*z+z^4)
-x^2 + x*y*z + y^2 + z^4
julia> homogeneous_component(f, 4)
z^4
```

`degree`

— Method`degree(f::MPolyQuoRingElem{<:MPolyDecRingElem})`

Given a homogeneous element `f`

of a graded affine algebra, return the degree of `f`

.

`degree(::Type{Vector{Int}}, f::MPolyQuoRingElem{<:MPolyDecRingElem})`

Given a homogeneous element `f`

of a $\mathbb Z^m$-graded affine algebra, return the degree of `f`

, converted to a vector of integer numbers.

`degree(::Type{Int}, f::MPolyQuoRingElem{<:MPolyDecRingElem})`

Given a homogeneous element `f`

of a $\mathbb Z$-graded affine algebra, return the degree of `f`

, converted to an integer number.

**Examples**

```
julia> R, (x, y, z) = graded_polynomial_ring(QQ, ["x", "y", "z"] );
julia> A, p = quo(R, ideal(R, [y-x, z^3-x^3]))
(Quotient of multivariate polynomial ring by ideal (-x + y, -x^3 + z^3), Map: R -> A)
julia> f = p(y^2-x^2+z^4)
-x^2 + y^2 + z^4
julia> degree(f)
[4]
julia> typeof(degree(f))
FinGenAbGroupElem
julia> degree(Int, f)
4
julia> typeof(degree(Int, f))
Int64
```

## Ideals in Affine Algebras

### Constructors

`ideal`

— Method`ideal(A::MPolyQuoRing{T}, V::Vector{T}) where T <: MPolyRingElem`

Given a (graded) quotient ring `A=R/I`

and a vector `V`

of (homogeneous) polynomials in `R`

, create the ideal of `A`

which is generated by the images of the entries of `V`

.

`ideal(A::MPolyQuoRing{T}, V::Vector{MPolyQuoRingElem{T}}) where T <: MPolyRingElem`

Given a (graded) quotient ring `A`

and a vector `V`

of (homogeneous) elements of `A`

, create the ideal of `A`

which is generated by the entries of `V`

.

**Examples**

```
julia> R, (x, y) = polynomial_ring(QQ, ["x", "y"]);
julia> A, _ = quo(R, ideal(R, [x^2-y^3, x-y]));
julia> I = ideal(A, [x^2-y])
Ideal generated by
x^2 - y
```

```
julia> S, (x, y, z) = graded_polynomial_ring(QQ, ["x", "y", "z"]);
julia> B, _ = quo(S, ideal(S, [x^2*z-y^3, x-y]));
julia> J = ideal(B, [x^2-y^2])
Ideal generated by
x^2 - y^2
```

### Reducing Polynomial Representatives of Generators

`simplify`

— Method`simplify(a::MPolyQuoIdeal)`

If `a`

is an ideal of the affine algebra `A = R/I`

, say, replace the internal polynomial representative of each generator of `a`

by its normal form mod `I`

with respect to `ordering(A)`

.

**Examples**

```
julia> R, (x, y) = polynomial_ring(QQ, ["x", "y"]);
julia> A, _ = quo(R, ideal(R, [x^3*y^2-y^3*x^2, x*y^4-x*y^2]));
julia> a = ideal(A, [x^3*y^4-x+y, x*y+y^2*x])
Ideal generated by
x^3*y^4 - x + y
x*y^2 + x*y
julia> gens(a)
2-element Vector{MPolyQuoRingElem{QQMPolyRingElem}}:
x^3*y^4 - x + y
x*y^2 + x*y
julia> simplify(a)
Ideal generated by
x^2*y^3 - x + y
x*y^2 + x*y
julia> gens(a)
2-element Vector{MPolyQuoRingElem{QQMPolyRingElem}}:
x^2*y^3 - x + y
x*y^2 + x*y
```

### Data Associated to Ideals in Affine Algebras

#### Basic Data

If `a`

is an ideal of the affine algebra `A`

, then

`base_ring(a)`

refers to`A`

,`gens(a)`

to the generators of`a`

,`number_of_generators(a)`

/`ngens(a)`

to the number of these generators, and`gen(a, i)`

as well as`a[i]`

to the`i`

-th such generator.

###### Examples

```
julia> R, (x, y, z) = polynomial_ring(QQ, ["x", "y", "z"]);
julia> A, _ = quo(R, ideal(R, [y-x^2, z-x^3]));
julia> a = ideal(A, [x-y, z^4])
Ideal generated by
x - y
z^4
julia> base_ring(a)
Quotient
of multivariate polynomial ring in 3 variables x, y, z
over rational field
by ideal (-x^2 + y, -x^3 + z)
julia> gens(a)
2-element Vector{MPolyQuoRingElem{QQMPolyRingElem}}:
x - y
z^4
julia> number_of_generators(a)
2
julia> gen(a, 2)
z^4
```

#### Dimension of Ideals in Affine Algebras

`dim`

— Method`dim(a::MPolyQuoIdeal)`

Return the Krull dimension of `a`

.

**Examples**

```
julia> R, (x, y, z) = polynomial_ring(QQ, ["x", "y", "z"]);
julia> A, _ = quo(R, ideal(R, [y-x^2, z-x^3]));
julia> a = ideal(A, [x-y])
Ideal generated by
x - y
julia> dim(a)
0
```

#### Minimal Sets of Generators

In the graded case, we have:

`minimal_generating_set`

— Method`minimal_generating_set(I::MPolyQuoIdeal{<:MPolyDecRingElem})`

Given a homogeneous ideal `I`

of a graded affine algebra 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> A, p = quo(R, ideal(R, [x-y]));
julia> V = [x, z^2, x^3+y^3, y^4, y*z^5];
julia> a = ideal(A, V);
julia> minimal_generating_set(a)
2-element Vector{MPolyQuoRingElem{MPolyDecRingElem{QQFieldElem, QQMPolyRingElem}}}:
y
z^2
julia> a = ideal(A, [x-y])
Ideal generated by
x - y
julia> minimal_generating_set(a)
MPolyQuoRingElem{MPolyDecRingElem{QQFieldElem, QQMPolyRingElem}}[]
```

### Operations on Ideals in Affine Algebras

#### Simple Ideal Operations in Affine Algebras

##### Powers of Ideal

`^`

— Method`:^(a::MPolyQuoIdeal, m::Int)`

Return the `m`

-th power of `a`

.

**Examples**

```
julia> R, (x, y) = polynomial_ring(QQ, ["x", "y"]);
julia> A, _ = quo(R, [x^2-y, y^2-x+y]);
julia> a = ideal(A, [x+y])
Ideal generated by
x + y
julia> a^2
Ideal generated by
x^2 + 2*x*y + y^2
```

##### Sum of Ideals

`+`

— Method`:+(a::MPolyQuoIdeal{T}, b::MPolyQuoIdeal{T}) where T`

Return the sum of `a`

and `b`

.

**Examples**

```
julia> R, (x, y) = polynomial_ring(QQ, ["x", "y"]);
julia> A, _ = quo(R, [x^2-y, y^2-x+y]);
julia> a = ideal(A, [x+y])
Ideal generated by
x + y
julia> b = ideal(A, [x^2+y^2, x+y])
Ideal generated by
x^2 + y^2
x + y
julia> a+b
Ideal generated by
x + y
x^2 + y^2
```

##### Product of Ideals

`*`

— Method`:*(a::MPolyQuoIdeal{T}, b::MPolyQuoIdeal{T}) where T`

Return the product of `a`

and `b`

.

**Examples**

```
julia> R, (x, y) = polynomial_ring(QQ, ["x", "y"]);
julia> A, _ = quo(R, [x^2-y, y^2-x+y]);
julia> a = ideal(A, [x+y])
Ideal generated by
x + y
julia> b = ideal(A, [x^2+y^2, x+y])
Ideal generated by
x^2 + y^2
x + y
julia> a*b
Ideal generated by
x^3 + x^2*y + x*y^2 + y^3
x^2 + 2*x*y + y^2
```

#### Intersection of Ideals

`intersect`

— Method```
intersect(a::MPolyQuoIdeal{T}, bs::MPolyQuoIdeal{T}...) where T
intersect(V::Vector{MPolyQuoIdeal{T}}) where T
```

Return the intersection of two or more ideals.

**Examples**

```
julia> R, (x, y) = polynomial_ring(QQ, ["x", "y"]);
julia> A, _ = quo(R, ideal(R, [x^2-y^3, x-y]));
julia> a = ideal(A, [y^2])
Ideal generated by
y^2
julia> b = ideal(A, [x])
Ideal generated by
x
julia> intersect(a,b)
Ideal generated by
x*y
julia> intersect([a,b])
Ideal generated by
x*y
```

`intersect`

— Method`intersect(a::AlgAssAbsOrdIdl, b::AlgAssAbsOrdIdl) -> AlgAssAbsOrdIdl`

Returns $a \cap b$.

`intersect(a::AlgAssRelOrdIdl, b::AlgAssRelOrdIdl) -> AlgAssRelOrdIdl`

Returns $a \cap b$.

```
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 generated by
x^3*y - x*y - y^3
x^4 - x^2 - x*y^2
julia> intersect([I, J])
Ideal generated by
x^3*y - x*y - y^3
x^4 - x^2 - x*y^2
```

```
intersect(a::MPolyQuoIdeal{T}, bs::MPolyQuoIdeal{T}...) where T
intersect(V::Vector{MPolyQuoIdeal{T}}) where T
```

Return the intersection of two or more ideals.

**Examples**

```
julia> R, (x, y) = polynomial_ring(QQ, ["x", "y"]);
julia> A, _ = quo(R, ideal(R, [x^2-y^3, x-y]));
julia> a = ideal(A, [y^2])
Ideal generated by
y^2
julia> b = ideal(A, [x])
Ideal generated by
x
julia> intersect(a,b)
Ideal generated by
x*y
julia> intersect([a,b])
Ideal generated by
x*y
```

```
intersect(I::PBWAlgIdeal{D, T, S}, Js::PBWAlgIdeal{D, T, S}...) where {D, T, S}
intersect(V::Vector{PBWAlgIdeal{D, T, S}}) where {D, T, S}
```

Return the intersection of two or more ideals.

**Examples**

```
julia> D, (x, y, dx, dy) = weyl_algebra(QQ, ["x", "y"]);
julia> I = intersect(left_ideal(D, [x^2, x*dy, dy^2])+left_ideal(D, [dx]), left_ideal(D, [dy^2-x^3+x]))
left_ideal(-x^3 + dy^2 + x)
```

`intersect(M::SubquoModule{T}, N::SubquoModule{T}) where T`

Given subquotients `M`

and `N`

such that `ambient_module(M) == ambient_module(N)`

, return the intersection of `M`

and `N`

regarded as submodules of the common ambient module.

Additionally, return the inclusion maps `M`

$\cap$ `N`

$\to$ `M`

and `M`

$\cap$ `N`

$\to$ `N`

.

**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 = free_module(R, 1)
Free module of rank 1 over R
julia> AM = R[x;]
[x]
julia> BM = R[x^2; y^3; z^4]
[x^2]
[y^3]
[z^4]
julia> M = SubquoModule(F, AM, BM)
Subquotient of Submodule with 1 generator
1 -> x*e[1]
by Submodule with 3 generators
1 -> x^2*e[1]
2 -> y^3*e[1]
3 -> z^4*e[1]
julia> AN = R[y;]
[y]
julia> BN = R[x^2; y^3; z^4]
[x^2]
[y^3]
[z^4]
julia> N = SubquoModule(F, AN, BN)
Subquotient of Submodule with 1 generator
1 -> y*e[1]
by Submodule with 3 generators
1 -> x^2*e[1]
2 -> y^3*e[1]
3 -> z^4*e[1]
julia> intersect(M, N)
(Subquotient of Submodule with 2 generators
1 -> -x*y*e[1]
2 -> x*z^4*e[1]
by Submodule with 3 generators
1 -> x^2*e[1]
2 -> y^3*e[1]
3 -> z^4*e[1], Map with following data
Domain:
=======
Subquotient of Submodule with 2 generators
1 -> -x*y*e[1]
2 -> x*z^4*e[1]
by Submodule with 3 generators
1 -> x^2*e[1]
2 -> y^3*e[1]
3 -> z^4*e[1]
Codomain:
=========
Subquotient of Submodule with 1 generator
1 -> x*e[1]
by Submodule with 3 generators
1 -> x^2*e[1]
2 -> y^3*e[1]
3 -> z^4*e[1], Map with following data
Domain:
=======
Subquotient of Submodule with 2 generators
1 -> -x*y*e[1]
2 -> x*z^4*e[1]
by Submodule with 3 generators
1 -> x^2*e[1]
2 -> y^3*e[1]
3 -> z^4*e[1]
Codomain:
=========
Subquotient of Submodule with 1 generator
1 -> y*e[1]
by Submodule with 3 generators
1 -> x^2*e[1]
2 -> y^3*e[1]
3 -> z^4*e[1])
```

```
julia> Rg, (x, y, z) = graded_polynomial_ring(QQ, ["x", "y", "z"]);
julia> F = graded_free_module(Rg, 1);
julia> AM = Rg[x;];
julia> BM = Rg[x^2; y^3; z^4];
julia> M = SubquoModule(F, AM, BM)
Graded subquotient of submodule of F generated by
1 -> x*e[1]
by submodule of F generated by
1 -> x^2*e[1]
2 -> y^3*e[1]
3 -> z^4*e[1]
julia> AN = Rg[y;];
julia> BN = Rg[x^2; y^3; z^4];
julia> N = SubquoModule(F, AN, BN)
Graded subquotient of submodule of F generated by
1 -> y*e[1]
by submodule of F generated by
1 -> x^2*e[1]
2 -> y^3*e[1]
3 -> z^4*e[1]
julia> intersect(M, N)
(Graded subquotient of submodule of F generated by
1 -> -x*y*e[1]
2 -> x*z^4*e[1]
by submodule of F generated by
1 -> x^2*e[1]
2 -> y^3*e[1]
3 -> z^4*e[1], Graded subquotient of submodule of F generated by
1 -> -x*y*e[1]
2 -> x*z^4*e[1]
by submodule of F generated by
1 -> x^2*e[1]
2 -> y^3*e[1]
3 -> z^4*e[1] -> M
-x*y*e[1] -> -x*y*e[1]
x*z^4*e[1] -> x*z^4*e[1]
Homogeneous module homomorphism, Graded subquotient of submodule of F generated by
1 -> -x*y*e[1]
2 -> x*z^4*e[1]
by submodule of F generated by
1 -> x^2*e[1]
2 -> y^3*e[1]
3 -> z^4*e[1] -> N
-x*y*e[1] -> x*y*e[1]
x*z^4*e[1] -> 0
Homogeneous module homomorphism)
```

#### Ideal Quotients

`quotient`

— Method`quotient(a::MPolyQuoIdeal{T}, b::MPolyQuoIdeal{T}) where T`

Return the ideal quotient of `a`

by `b`

. Alternatively, use `a:b`

.

**Examples**

```
julia> R, (x, y) = polynomial_ring(QQ, ["x", "y"]);
julia> A, _ = quo(R, ideal(R, [x^2-y^3, x-y]));
julia> a = ideal(A, [y^2])
Ideal generated by
y^2
julia> b = ideal(A, [x])
Ideal generated by
x
julia> a:b
Ideal generated by
y
```

### Tests on Ideals in Affine Algebras

#### Basic Tests

`is_zero`

— Method`is_zero(a::MPolyQuoIdeal)`

Return `true`

if `a`

is the zero ideal, `false`

otherwise.

**Examples**

```
julia> R, (x, y) = polynomial_ring(QQ, ["x", "y"]);
julia> A, _ = quo(R, [x^2-y, y^2-x+y]);
julia> a = ideal(A, [x^2+y^2, x+y])
Ideal generated by
x^2 + y^2
x + y
julia> is_zero(a)
false
julia> b = ideal(A, [x^2-y])
Ideal generated by
x^2 - y
julia> is_zero(b)
true
```

#### Containment of Ideals in Affine Algebras

`is_subset`

— Method`is_subset(a::MPolyQuoIdeal{T}, b::MPolyQuoIdeal{T}) where T`

Return `true`

if `a`

is contained in `b`

, `false`

otherwise.

**Examples**

```
julia> R, (x, y) = polynomial_ring(QQ, ["x", "y"]);
julia> A, _ = quo(R, ideal(R, [x^3*y^2-y^3*x^2, x*y^4-x*y^2]));
julia> a = ideal(A, [x^3*y^4-x+y, x*y+y^2*x])
Ideal generated by
x^3*y^4 - x + y
x*y^2 + x*y
julia> b = ideal(A, [x^3*y^3-x+y, x^2*y+y^2*x])
Ideal generated by
x^3*y^3 - x + y
x^2*y + x*y^2
julia> is_subset(a,b)
false
julia> is_subset(b,a)
true
```

#### Equality of Ideals in Affine Algebras

`==`

— Method`==(a::MPolyQuoIdeal{T}, b::MPolyQuoIdeal{T}) where T`

Return `true`

if `a`

is equal to `b`

, `false`

otherwise.

**Examples**

```
julia> R, (x, y) = polynomial_ring(QQ, ["x", "y"]);
julia> A, _ = quo(R, ideal(R, [x^3*y^2-y^3*x^2, x*y^4-x*y^2]));
julia> a = ideal(A, [x^3*y^4-x+y, x*y+y^2*x])
Ideal generated by
x^3*y^4 - x + y
x*y^2 + x*y
julia> b = ideal(A, [x^3*y^3-x+y, x^2*y+y^2*x])
Ideal generated by
x^3*y^3 - x + y
x^2*y + x*y^2
julia> a == b
false
```

#### Ideal Membership

`ideal_membership`

— Method`ideal_membership(f::MPolyQuoRingElem{T}, a::MPolyQuoIdeal{T}) where T`

Return `true`

if `f`

is contained in `a`

, `false`

otherwise. Alternatively, use `f in a`

.

**Examples**

```
julia> R, (x, y) = polynomial_ring(QQ, ["x", "y"]);
julia> A, _ = quo(R, ideal(R, [x^3*y^2-y^3*x^2, x*y^4-x*y^2]));
julia> a = ideal(A, [x^3*y^4-x+y, x*y+y^2*x])
Ideal generated by
x^3*y^4 - x + y
x*y^2 + x*y
julia> f = A(x^2*y^3-x+y)
x^2*y^3 - x + y
julia> f in a
true
```

## Homomorphisms From Affine Algebras

If $A=R/I$ is an affine $C$-algebra, and $S$ is any ring, then defining a ring homomorphism $\overline{\phi}: A \to S$ means to define a ring homomorphism $\phi: R \to S$ such that $I\subset \ker(\phi)$. Thus, $\overline{\phi} $ is determined by specifying its restriction to $C$, and by assigning an image to each generator of $A$. In OSCAR, such homomorphisms are created as follows:

`hom`

— Method```
hom(A::MPolyQuoRing, S::NCRing, coeff_map, images::Vector; check::Bool = true)
hom(A::MPolyQuoRing, S::NCRing, images::Vector; check::Bool = true)
```

Given a homomorphism `coeff_map`

from `C`

to `S`

, where `C`

is the coefficient ring of the base ring of `A`

, and given a vector `images`

of `ngens(A)`

elements of `S`

, return the homomorphism `A`

$\to$ `S`

whose restriction to `C`

is `coeff_map`

, and which sends the `i`

-th generator of `A`

to the `i`

-th entry of `images`

.

If no coefficient map is entered, invoke a canonical homomorphism of `C`

to `S`

, if such a homomorphism exists, and throw an error, otherwise.

The function returns a well-defined homomorphism `A`

$\to$ `S`

iff the given data defines a homomorphism `base_ring(A)`

$\to$ `S`

whose kernel contains the modulus of `A`

. This condition is checked by the function in case `check = true`

(default).

In case `check = true`

(default), the function also checks the conditions below:

- If
`S`

is graded, the assigned images must be homogeneous with respect to the given grading. - If
`S`

is noncommutative, the assigned images must pairwise commute.

**Examples**

```
julia> R, (x, y, z) = polynomial_ring(QQ, ["x", "y", "z"] );
julia> A, _ = quo(R, ideal(R, [y-x^2, z-x^3]));
julia> S, (s, t) = polynomial_ring(QQ, ["s", "t"]);
julia> F = hom(A, S, [s, s^2, s^3])
Ring homomorphism
from quotient of multivariate polynomial ring by ideal (-x^2 + y, -x^3 + z)
to multivariate polynomial ring in 2 variables over QQ
defined by
x -> s
y -> s^2
z -> s^3
```

Given a ring homomorphism `F`

: `A`

$\to$ `S`

as above, `domain(F)`

and `codomain(F)`

refer to `A`

and `S`

, respectively. Given ring homomorphisms `F`

: `A`

$\to$ `B`

and `G`

: `B`

$\to$ `T`

as above, `compose(F, G)`

refers to their composition.

## Homomorphisms of Affine Algebras

The OSCAR homomorphism type `AffAlgHom`

models ring homomorphisms `R`

$\to$ `S`

such that the type of both `R`

and `S`

is a subtype of `Union{MPolyRing{T}, MPolyQuoRing{U}}`

, where `T <: FieldElem`

and `U <: MPolyRingElem{T}`

. Functionality for these homomorphism is discussed in what follows.

### Data Associated to Homomorphisms of Affine Algebras

`preimage`

— Method`preimage(F::MPolyAnyMap, I::Ideal)`

Return the preimage of the ideal `I`

under `F`

.

`kernel`

— Method`kernel(F::AffAlgHom)`

Return the kernel of `F`

.

###### Examples

```
julia> D1, (w, x, y, z) = graded_polynomial_ring(QQ, ["w", "x", "y", "z"]);
julia> C1, (s,t) = graded_polynomial_ring(QQ, ["s", "t"]);
julia> V1 = [s^3, s^2*t, s*t^2, t^3];
julia> para = hom(D1, C1, V1)
Ring homomorphism
from graded multivariate polynomial ring in 4 variables over QQ
to graded multivariate polynomial ring in 2 variables over QQ
defined by
w -> s^3
x -> s^2*t
y -> s*t^2
z -> t^3
julia> twistedCubic = kernel(para)
Ideal generated by
-x*z + y^2
-w*z + x*y
-w*y + x^2
julia> C2, p2 = quo(D1, twistedCubic);
julia> D2, (a, b, c) = graded_polynomial_ring(QQ, ["a", "b", "c"]);
julia> V2 = [p2(w-y), p2(x), p2(z)];
julia> proj = hom(D2, C2, V2)
Ring homomorphism
from graded multivariate polynomial ring in 3 variables over QQ
to quotient of multivariate polynomial ring by ideal (-x*z + y^2, -w*z + x*y, -w*y + x^2)
defined by
a -> w - y
b -> x
c -> z
julia> nodalCubic = kernel(proj)
Ideal generated by
-a^2*c + b^3 - 2*b^2*c + b*c^2
```

```
julia> D3,y = polynomial_ring(QQ, "y" => 1:3);
julia> C3, x = polynomial_ring(QQ, "x" => 1:3);
julia> V3 = [x[1]*x[2], x[1]*x[3], x[2]*x[3]];
julia> F3 = hom(D3, C3, V3)
Ring homomorphism
from multivariate polynomial ring in 3 variables over QQ
to multivariate polynomial ring in 3 variables over QQ
defined by
y[1] -> x[1]*x[2]
y[2] -> x[1]*x[3]
y[3] -> x[2]*x[3]
julia> sphere = ideal(C3, [x[1]^3 + x[2]^3 + x[3]^3 - 1])
Ideal generated by
x[1]^3 + x[2]^3 + x[3]^3 - 1
julia> steinerRomanSurface = preimage(F3, sphere)
Ideal generated by
y[1]^6*y[2]^6 + 2*y[1]^6*y[2]^3*y[3]^3 + y[1]^6*y[3]^6 + 2*y[1]^3*y[2]^6*y[3]^3 + 2*y[1]^3*y[2]^3*y[3]^6 - y[1]^3*y[2]^3*y[3]^3 + y[2]^6*y[3]^6
```

### Tests on Homomorphisms of Affine Algebras

`is_injective`

— Method`is_injective(F::AffAlgHom)`

Return `true`

if `F`

is injective, `false`

otherwise.

`is_surjective`

— Method`is_surjective(F::AffAlgHom)`

Return `true`

if `F`

is surjective, `false`

otherwise.

`is_bijective`

— Method`is_bijective(F::AffAlgHom)`

Return `true`

if `F`

is bijective, `false`

otherwise.

`is_finite`

— Method`is_finite(F::AffAlgHom)`

Return `true`

if `F`

is finite, `false`

otherwise.

###### Examples

```
julia> D, (x, y, z) = polynomial_ring(QQ, ["x", "y", "z"]);
julia> S, (a, b, c) = polynomial_ring(QQ, ["a", "b", "c"]);
julia> C, p = quo(S, ideal(S, [c-b^3]));
julia> V = [p(2*a + b^6), p(7*b - a^2), p(c^2)];
julia> F = hom(D, C, V)
Ring homomorphism
from multivariate polynomial ring in 3 variables over QQ
to quotient of multivariate polynomial ring by ideal (-b^3 + c)
defined by
x -> 2*a + c^2
y -> -a^2 + 7*b
z -> c^2
julia> is_surjective(F)
true
julia> D1, _ = quo(D, kernel(F));
julia> F1 = hom(D1, C, V);
julia> is_bijective(F1)
true
```

```
julia> R, (x, y, z) = polynomial_ring(QQ, [ "x", "y", "z"]);
julia> C, (s, t) = polynomial_ring(QQ, ["s", "t"]);
julia> V = [s*t, t, s^2];
julia> paraWhitneyUmbrella = hom(R, C, V)
Ring homomorphism
from multivariate polynomial ring in 3 variables over QQ
to multivariate polynomial ring in 2 variables over QQ
defined by
x -> s*t
y -> t
z -> s^2
julia> D, _ = quo(R, kernel(paraWhitneyUmbrella));
julia> is_finite(hom(D, C, V))
true
```

### Inverting Homomorphisms of Affine Algebras

`inverse`

— Method`inverse(F::AffAlgHom)`

If `F`

is bijective, return its inverse.

**Examples**

```
julia> D1, (x, y, z) = polynomial_ring(QQ, ["x", "y", "z"]);
julia> D, _ = quo(D1, [y-x^2, z-x^3]);
julia> C, (t,) = polynomial_ring(QQ, ["t"]);
julia> F = hom(D, C, [t, t^2, t^3]);
julia> is_bijective(F)
true
julia> G = inverse(F)
Ring homomorphism
from multivariate polynomial ring in 1 variable over QQ
to quotient of multivariate polynomial ring by ideal (-x^2 + y, -x^3 + z)
defined by
t -> x
julia> G(t)
x
```

## Algebraic Independence

`is_algebraically_independent`

— Method`is_algebraically_independent(V::Vector{T}) where T <: Union{MPolyRingElem, MPolyQuoRingElem}`

Given a vector `V`

of elements of a multivariate polynomial ring over a field `K`

, say, or of a quotient of such a ring, return `true`

if the elements of `V`

are algebraically independent over `K`

, and `false`

otherwise.

**Examples**

```
julia> R, (x, y) = polynomial_ring(QQ, ["x", "y"]);
julia> V = [x, y, x^2+y^3]
3-element Vector{QQMPolyRingElem}:
x
y
x^2 + y^3
julia> is_algebraically_independent(V)
false
julia> A, p = quo(R, [x*y]);
julia> is_algebraically_independent([p(x), p(y)])
false
```

`is_algebraically_independent_with_relations`

— Method`is_algebraically_independent_with_relations(V::Vector{T}) where T <: Union{MPolyRingElem, MPolyQuoRingElem}`

Given a vector `V`

of elements of a multivariate polynomial ring over a field `K`

, say, or of a quotient of such a ring, return `(true, Ideal (0))`

if the elements of `V`

are algebraically independent over `K`

. Otherwise, return `false`

together with the ideal of `K`

-algebra relations.

**Examples**

```
julia> R, (x, y) = polynomial_ring(QQ, ["x", "y"]);
julia> V = [x, y, x^2+y^3]
3-element Vector{QQMPolyRingElem}:
x
y
x^2 + y^3
julia> is_algebraically_independent_with_relations(V)
(false, Ideal (t1^2 + t2^3 - t3))
julia> A, p = quo(R, [x*y]);
julia> is_algebraically_independent_with_relations([p(x), p(y)])
(false, Ideal (t1*t2))
```

## Subalgebras

### Subalgebra Membership

`subalgebra_membership`

— Method`subalgebra_membership(f::T, V::Vector{T}) where T <: Union{MPolyRingElem, MPolyQuoRingElem}`

Given an element `f`

of a multivariate polynomial ring over a field, or of a quotient of such a ring, and given a vector `V`

of further elements of that ring, consider the subalgebra generated by the entries of `V`

in the given ring. If `f`

is contained in the subalgebra, return `(true, h)`

, where `h`

is giving the polynomial relation. Return, `(false, 0)`

, otherwise.

**Examples**

```
julia> R, x = polynomial_ring(QQ, "x" => 1:3);
julia> f = x[1]^6*x[2]^6-x[1]^6*x[3]^6;
julia> V = [x[1]^3*x[2]^3-x[1]^3*x[3]^3, x[1]^3*x[2]^3+x[1]^3*x[3]^3]
2-element Vector{QQMPolyRingElem}:
x[1]^3*x[2]^3 - x[1]^3*x[3]^3
x[1]^3*x[2]^3 + x[1]^3*x[3]^3
julia> subalgebra_membership(f, V)
(true, t1*t2)
```

### Minimal Subalgebra Generators

`minimal_subalgebra_generators`

— Method`minimal_subalgebra_generators(V::Vector{T}; check::Bool = true) where T <: Union{MPolyRingElem, MPolyQuoRingElem}`

Given a vector `V`

of homogeneous elements of a positively graded multivariate polynomial ring, or of a quotient of such a ring, return a subset of the elements in `V`

of minimal cardinality which, in the given ring, generate the same subalgebra as all elements in `V`

.

If `check`

is `true`

(default), the conditions on `V`

and the given ring are checked.

**Examples**

```
julia> R, (x, y) = graded_polynomial_ring(QQ, ["x", "y"]);
julia> V = [x, y, x^2+y^2]
3-element Vector{MPolyDecRingElem{QQFieldElem, QQMPolyRingElem}}:
x
y
x^2 + y^2
julia> minimal_subalgebra_generators(V)
2-element Vector{MPolyDecRingElem{QQFieldElem, QQMPolyRingElem}}:
x
y
```

## Noether Normalization

`noether_normalization`

— Method`noether_normalization(A::MPolyQuoRing)`

Given an affine algebra $A=R/I$ over a field $K$, return a triple $(V,F,G)$ such that:

- $V$ is a vector of $d=\dim A$ elements of $A$, represented by linear forms $l_i\in R$, and such that $K[V]\hookrightarrow A$ is a Noether normalization for $A$;
- $F: A=R/I \to B = R/\phi(I)$ is an isomorphism, induced by a linear change $\phi$ of coordinates of $R$ which maps the $l_i$ to the the last $d$ variables of $R$;
- $G = F^{-1}.$

The algorithm may not terminate over a small finite field. If it terminates, the result is correct.

###### Examples

```
julia> R, (x, y, z) = polynomial_ring(QQ, ["x", "y", "z"]);
julia> A, _ = quo(R, ideal(R, [x*y, x*z]));
julia> L = noether_normalization(A);
julia> L[1]
2-element Vector{MPolyQuoRingElem{QQMPolyRingElem}}:
-2*x + y
-5*y + z
julia> L[2]
Ring homomorphism
from quotient of multivariate polynomial ring by ideal (x*y, x*z)
to quotient of multivariate polynomial ring by ideal (2*x^2 + x*y, 10*x^2 + 5*x*y + x*z)
defined by
x -> x
y -> 2*x + y
z -> 10*x + 5*y + z
julia> L[3]
Ring homomorphism
from quotient of multivariate polynomial ring by ideal (2*x^2 + x*y, 10*x^2 + 5*x*y + x*z)
to quotient of multivariate polynomial ring by ideal (x*y, x*z)
defined by
x -> x
y -> -2*x + y
z -> -5*y + z
```

## Normalization

`normalization`

— Method`normalization(A::MPolyQuoRing; algorithm = :equidimDec)`

Find the normalization of a reduced affine algebra over a perfect field $K$. That is, given the quotient $A=R/I$ of a multivariate polynomial ring $R$ over $K$ modulo a radical ideal $I$, compute the integral closure $\overline{A}$ of $A$ in its total ring of fractions $Q(A)$, together with the embedding $f: A \to \overline{A}$.

**Implemented Algorithms and how to Read the Output**

The function relies on the algorithm of Greuel, Laplagne, and Seelisch which proceeds by finding a suitable decomposition $I=I_1\cap\dots\cap I_r$ into radical ideals $I_k$, together with maps $A = R/I \to A_k=\overline{R/I_k}$ which give rise to the normalization map of $A$:

\[A\hookrightarrow A_1\times \dots\times A_r=\overline{A}\]

For each $k$, the function specifies two representations of $A_k$: It returns an array of triples $(A_k, f_k, \mathfrak a_k)$, where $A_k$ is represented as an affine $K$-algebra, and $f_k$ as a map of affine $K$-algebras. The third entry $\mathfrak a_k$ is a tuple $(d_k, J_k)$, consisting of an element $d_k\in A$ and an ideal $J_k\subset A$, such that $\frac{1}{d_k}J_k = A_k$ as $A$-submodules of the total ring of fractions of $A$.

By default (`algorithm = :equidimDec`

), as a first step on its way to find the decomposition $I=I_1\cap\dots\cap I_r$, the algorithm computes an equidimensional decomposition of the radical ideal $I$. Alternatively, if specified by `algorithm = :primeDec`

, the algorithm computes $I=I_1\cap\dots\cap I_r$ as the prime decomposition of the radical ideal $I$. If specified by `algorithm = :isPrime`

, assume that $I$ is prime.

See [GLS10].

The function does not check whether $A$ is reduced. Use `is_reduced(A)`

in case you are unsure (this may take some time).

**Examples**

```
julia> R, (x, y) = polynomial_ring(QQ, ["x", "y"]);
julia> A, _ = quo(R, ideal(R, [(x^2-y^3)*(x^2+y^2)*x]));
julia> L = normalization(A);
julia> size(L)
(2,)
julia> LL = normalization(A, algorithm = :primeDec);
julia> size(LL)
(3,)
julia> LL[1][1]
Quotient
of multivariate polynomial ring in 3 variables T(1), x, y
over rational field
by ideal (-T(1)*y + x, -T(1)*x + y^2, T(1)^2 - y, -x^2 + y^3)
julia> LL[1][2]
Ring homomorphism
from quotient of multivariate polynomial ring by ideal (x^5 - x^3*y^3 + x^3*y^2 - x*y^5)
to quotient of multivariate polynomial ring by ideal (-T(1)*y + x, -T(1)*x + y^2, T(1)^2 - y, -x^2 + y^3)
defined by
x -> x
y -> y
julia> LL[1][3]
(y, Ideal (x, y))
```

`normalization_with_delta`

— Method`normalization_with_delta(A::MPolyQuoRing; algorithm::Symbol = :equidimDec)`

Compute the normalization

\[A\hookrightarrow A_1\times \dots\times A_r=\overline{A}\]

of $A$ as does `normalize(A)`

, but return additionally the `delta invariant`

of $A$, that is, the dimension

\[\dim_K(\overline{A}/A).\]

**How to Read the Output**

The return value is a tuple whose first element is `normalize(A)`

, whose second element is an array containing the delta invariants of the $A_k$, and whose third element is the (total) delta invariant of $A$. The return value -1 in the third element indicates that the delta invariant is infinite.

**Examples**

```
julia> R, (x, y) = polynomial_ring(QQ, ["x", "y"]);
julia> A, _ = quo(R, ideal(R, [(x^2-y^3)*(x^2+y^2)*x]));
julia> L = normalization_with_delta(A);
julia> L[2]
3-element Vector{Int64}:
1
1
0
julia> L[3]
13
```

```
julia> R, (x, y, z) = polynomial_ring(QQ, ["x", "y", "z"]);
julia> A, _ = quo(R, ideal(R, [z^3-x*y^4]));
julia> L = normalization_with_delta(A);
julia> L[3]
-1
```

## Integral Bases

`integral_basis`

— Method`integral_basis(f::MPolyRingElem, i::Int; algorithm::Symbol = :normal_local)`

Given a polynomial $f$ in two variables with coefficients in a perfect field $K$, and given an integer $i\in\{1,2\}$ specifying one of the variables, $f$ must be irreducible and monic in the specified variable: Say, $f\in\mathbb K[x,y]$ is monic in $y$. Then the normalization of $A = K[x,y]/\langle f \rangle$, that is, the integral closure $\overline{A}$ of $A$ in its quotient field, is a free module over $K[x]$ of finite rank, and any set of free generators for $\overline{A}$ over $K[x]$ is called an *integral basis* for $\overline{A}$ over $K[x]$. The function returns a pair $(d, V)$, where $d$ is an element of $A$, and $V$ is a vector of elements in $A$, such that the fractions $v/d, v\in V$, form an integral basis for $\overline{A}$ over $K[x]$.

By default (`algorithm = :normal_local`

), the function relies on the local-to-global approach to normalization presented in [BDLPSS13]. Alternatively, if specified by `algorithm = :normal_global`

, the global normalization algorithm in [GLS10] is used. If $K = \mathbb Q$, it is recommended to apply the algorithm in [BDLP19], which makes use of Puiseux expansions and Hensel lifting (`algorithm = :hensel`

).

The conditions on $f$ are automatically checked.

**Examples**

```
julia> R, (x, y) = polynomial_ring(QQ, ["x", "y"]);
julia> f = (y^2-2)^2 + x^5
x^5 + y^4 - 4*y^2 + 4
julia> integral_basis(f, 2)
(x^2, MPolyQuoRingElem{QQMPolyRingElem}[x^2, x^2*y, y^2 - 2, y^3 - 2*y])
```

## Tests on Affine Algebras

### Reducedness Test

`is_reduced`

— Method`is_reduced(A::MPolyQuoRing)`

Given an affine algebra `A`

, return `true`

if `A`

is reduced, `false`

otherwise.

The function computes the radical of the modulus of `A`

. This may take some time.

**Examples**

```
julia> R, (x,) = polynomial_ring(QQ, ["x"]);
julia> A, _ = quo(R, ideal(R, [x^4]));
julia> is_reduced(A)
false
```

### Normality Test

`is_normal`

— Method`is_normal(A::MPolyQuoRing; check::Bool=true) -> Bool`

Given an affine algebra `A`

over a perfect field, return `true`

if `A`

is normal, and `false`

otherwise.

This function performs the first step of the normalization algorithm of Greuel, Laplagne, and Seelisch [GLS10] and may, thus, be more efficient than computing the full normalization of `A`

.

If `check`

is `true`

, the function checks whether `A`

is indeed reduced. This may take some time.

**Examples**

```
julia> R, (x, y, z) = polynomial_ring(QQ, ["x", "y", "z"]);
julia> A, _ = quo(R, ideal(R, [z^2-x*y]));
julia> is_normal(A)
true
```

### Cohen-Macaulayness Test

`is_cohen_macaulay`

— Method`is_cohen_macaulay(A::MPolyQuoRing)`

Given a $\mathbb Z$-graded affine algebra `A = R/I`

over a field, say, `K`

, where the grading is inherited from the standard $\mathbb Z$-grading on the polynomial ring `R`

, return `true`

if `A`

is a Cohen-Macaulay ring, `false`

otherwise.

**Examples**

```
julia> R, (w, x, y, z) = graded_polynomial_ring(QQ, ["w", "x", "y", "z"]);
julia> I = ideal(R, [x*z-y^2, w*z-x*y, w*y-x^2]);
julia> A, _ = quo(R, I);
julia> is_cohen_macaulay(A)
true
```

```
julia> R, (x, y, z) = graded_polynomial_ring(QQ, ["x", "y", "z"]);
julia> I = ideal(R, [x*z, y*z]);
julia> A, _ = quo(R, I);
julia> is_cohen_macaulay(A)
false
```

## Hilbert Series and Hilbert Polynomial

Given a multivariate polynomial ring $R$ over a field $K$ together with a (multi)grading on $R$ by a finitely generated abelian group $G$, let $I$ be an ideal of $R$ which is homogeneous with respect to this grading. Then the affine $K-$algebra $A=R/I$ inherits the grading: $A = \bigoplus_{g\in G} A_g$. Suppose now that $R$ is positively graded by $G$. That is, $G$ is free and each graded piece $R_g$ has finite dimension. Then also $A_g$ is a finite dimensional $K$-vector space for each $g$, and we have the well-defined *Hilbert function* of $A$,

\[H(A, \underline{\phantom{d}}): G \to \mathbb{N}, \; g\mapsto \dim_K(A_g).\]

The *Hilbert series* of $A$ is the generating function

\[H_A(\mathbb t)=\sum_{g\in G} H(A, g) \mathbb t^g\]

(see Section 8.2 in [MS05] for a formal discussion extending the classical case of $\mathbb Z$-gradings with positive weights to the more general case of multigradings). As in the classical case, the infinitely many values of the Hilbert function can be expressed in finite terms by representing the Hilbert series as a rational function (see Theorem 8.20 in [MS05] for a precise statement).

By a result of Macaulay, if $A = R/I$ is an affine algebra, and $L_{>}(I)$ is the leading ideal of $I$ with respect to a global monomial ordering $>$, then the Hilbert function of $A$ equals that of $R/L_{>}(I)$ (see Theorem 15.26 in [Eis95]). Thus, using Gröbner bases, the computation of Hilbert series can be reduced to the case where the modulus of the affine algebra is a monomial ideal. In the latter case, we face a problem of combinatorial nature, and there are various strategies of how to proceed (see [KR05]). The functions `hilbert_series`

, `hilbert_series_reduced`

, `hilbert_series_expanded`

, `hilbert_function`

, `hilbert_polynomial`

, and `degree`

address the case of $\mathbb Z$-gradings with positive weights, relying on corresponding Singular functionality. The functions `multi_hilbert_series`

, `multi_hilbert_series_reduced`

, and `multi_hilbert_function`

offer a variety of different strategies and allow one to handle positive gradings in general.

### $\mathbb Z$-Gradings With Positive Weights

Let $R=K[x_1, \dots x_n]$ be a polynomial ring in $n$ variables over a field $K$. Assign positive integer weights $w_i$ to the variables $x_i$, and grade $R=\bigoplus_{d\in \mathbb Z} R_d=\bigoplus_{d\geq 0} R_d$ according to the corresponding weighted degree. Let $I$ be an ideal of $R$ which is homogeneous with respect to this grading. Then the affine $K$-algebra $A=R/I$ inherits the grading: $A = \bigoplus_{d\geq 0} A_d$, where each graded piece $A_d$ is a finite dimensional $K$-vector space. In this situation, the *Hilbert function* of $A$ is of type

\[H(A, \underline{\phantom{d}}): \mathbb{N} \to \mathbb{N}, \;d \mapsto \dim_K(d),\]

and the *Hilbert series* of $A$ is the formal power series

\[H_A(t)=\sum_{d\geq 0} H(A, d) t^d\in\mathbb Z[[t]].\]

The Hilbert series can be written as a rational function $p(t)/q(t)$, with denominator

\[q(t) = (1-t^{w_1})\cdots (1-t^{w_n}).\]

In the standard $\mathbb Z$-graded case, where the weights on the variables are all 1, the Hilbert function is of polynomial nature: There exists a unique polynomial $P_A(t)\in\mathbb{Q}[t]$, the *Hilbert polynomial*, which satisfies $H(M,d)=P_M(d)$ for all $d \gg 0$. Furthermore, the *degree* of $A$ is defined as the dimension of $A$ over $K$ if this dimension is finite, and as the integer $d$ such that the leading term of the Hilbert polynomial has the form $d t^e/e!$, otherwise.

`hilbert_series`

— Method`hilbert_series(A::MPolyQuoRing; backend::Symbol=:Singular, algorithm::Symbol=:BayerStillmanA)`

Given a $\mathbb Z$-graded affine algebra $A = R/I$ over a field $K$, where the grading is inherited from a $\mathbb Z$-grading on the polynomial ring $R$ defined by assigning positive integer weights to the variables, return a pair $(p,q)$, say, of univariate polynomials $p, q\in\mathbb Z[t]$ such that $p/q$ represents the Hilbert series of $A$ as a rational function with denominator

\[q = (1-t^{w_1})\cdots (1-t^{w_n}),\]

where $n$ is the number of variables of $R$, and $w_1, \dots, w_n$ are the assigned weights.

See also `hilbert_series_reduced`

.

The advanced user can select different backends for the computation (`:Singular`

and `:Abbott`

for the moment), as well as different algorithms. The latter might be ignored for certain backends.

**Examples**

```
julia> R, (w, x, y, z) = graded_polynomial_ring(QQ, ["w", "x", "y", "z"]);
julia> A, _ = quo(R, ideal(R, [w*y-x^2, w*z-x*y, x*z-y^2]));
julia> hilbert_series(A)
(2*t^3 - 3*t^2 + 1, (-t + 1)^4)
julia> R, (x, y, z) = graded_polynomial_ring(QQ, ["x", "y", "z"], [1, 2, 3]);
julia> A, _ = quo(R, ideal(R, [x*y*z]));
julia> hilbert_series(A)
(-t^6 + 1, (-t^2 + 1)^1*(-t + 1)^1*(-t^3 + 1)^1)
```

`hilbert_series_reduced`

— Method`hilbert_series_reduced(A::MPolyQuoRing)`

Given a $\mathbb Z$-graded affine algebra $A = R/I$ over a field $K$, where the grading is inherited from a $\mathbb Z$-grading on the polynomial ring $R$ defined by assigning positive integer weights to the variables, return a pair $(p,q)$, say, of univariate polynomials $p, q\in\mathbb Z[t]$ such that $p/q$ represents the Hilbert series of $A$ as a rational function written in lowest terms.

See also `hilbert_series`

.

**Examples**

```
julia> R, (w, x, y, z) = graded_polynomial_ring(QQ, ["w", "x", "y", "z"]);
julia> A, _ = quo(R, ideal(R, [w*y-x^2, w*z-x*y, x*z-y^2]));
julia> hilbert_series_reduced(A)
(2*t + 1, t^2 - 2*t + 1)
julia> R, (x, y, z) = graded_polynomial_ring(QQ, ["x", "y", "z"], [1, 2, 3]);
julia> A, _ = quo(R, ideal(R, [x*y*z]));
julia> hilbert_series(A)
(-t^6 + 1, (-t^2 + 1)^1*(-t + 1)^1*(-t^3 + 1)^1)
julia> hilbert_series_reduced(A)
(t^2 - t + 1, t^2 - 2*t + 1)
```

`hilbert_series_expanded`

— Method`hilbert_series_expanded(A::MPolyQuoRing, d::Int)`

Given a $\mathbb Z$-graded affine algebra $A = R/I$ over a field $K$, where the grading is inherited from a $\mathbb Z$-grading on the polynomial ring $R$ defined by assigning positive integer weights to the variables, return the Hilbert series of $A$ to precision $d$.

**Examples**

```
julia> R, (w, x, y, z) = graded_polynomial_ring(QQ, ["w", "x", "y", "z"]);
julia> A, _ = quo(R, ideal(R, [w*y-x^2, w*z-x*y, x*z-y^2]));
julia> hilbert_series_expanded(A, 7)
1 + 4*t + 7*t^2 + 10*t^3 + 13*t^4 + 16*t^5 + 19*t^6 + 22*t^7 + O(t^8)
julia> R, (x, y, z) = graded_polynomial_ring(QQ, ["x", "y", "z"], [1, 2, 3]);
julia> A, _ = quo(R, ideal(R, [x*y*z]));
julia> hilbert_series_expanded(A, 5)
1 + t + 2*t^2 + 3*t^3 + 4*t^4 + 5*t^5 + O(t^6)
```

`hilbert_function`

— Method`hilbert_function(A::MPolyQuoRing, d::Int)`

Given a $\mathbb Z$-graded affine algebra $A = R/I$ over a field $K$, where the grading is inherited from a $\mathbb Z$-grading on the polynomial ring $R$ defined by assigning positive integer weights to the variables, return the value $H(A, d),$ where

\[H(A, \underline{\phantom{d}}): \mathbb{N} \to \mathbb{N}, \; d \mapsto \dim_K A_d,\]

is the Hilbert function of $A$.

**Examples**

```
julia> R, (w, x, y, z) = graded_polynomial_ring(QQ, ["w", "x", "y", "z"]);
julia> A, _ = quo(R, ideal(R, [w*y-x^2, w*z-x*y, x*z-y^2]));
julia> hilbert_function(A,7)
22
julia> R, (x, y, z) = graded_polynomial_ring(QQ, ["x", "y", "z"], [1, 2, 3]);
julia> A, _ = quo(R, ideal(R, [x*y*z]));
julia> hilbert_function(A, 5)
5
```

`hilbert_polynomial`

— Method`hilbert_polynomial(A::MPolyQuoRing)`

Given a $\mathbb Z$-graded affine algebra $A = R/I$ over a field $K$, where the grading is inherited from the standard $\mathbb Z$-grading on the polynomial ring $R$, return the Hilbert polynomial of $A$.

**Examples**

```
julia> R, (w, x, y, z) = graded_polynomial_ring(QQ, ["w", "x", "y", "z"]);
julia> A, _ = quo(R, ideal(R, [w*y-x^2, w*z-x*y, x*z-y^2]));
julia> hilbert_polynomial(A)
3*t + 1
```

`degree`

— Method`degree(A::MPolyQuoRing)`

Given a $\mathbb Z$-graded affine algebra $A = R/I$ over a field $K$, where the grading is inherited from the standard $\mathbb Z$-grading on the polynomial ring $R$, return the degree of $A$.

**Examples**

```
julia> R, (w, x, y, z) = graded_polynomial_ring(QQ, ["w", "x", "y", "z"]);
julia> A, _ = quo(R, ideal(R, [w*y-x^2, w*z-x*y, x*z-y^2]));
julia> degree(A)
3
```

### Positive Gradings in General

`multi_hilbert_series`

— Method`multi_hilbert_series(A::MPolyQuoRing; algorithm::Symbol=:BayerStillmanA, parent::Union{Nothing,Ring}=nothing)`

Return the Hilbert series of the graded affine algebra `A`

.

The advanced user can select an `algorithm`

for the computation; see the code for details.

**Examples**

```
julia> W = [1 1 1; 0 0 -1];
julia> R, x = graded_polynomial_ring(QQ, ["x[1]", "x[2]", "x[3]"], W)
(Graded multivariate polynomial ring in 3 variables over QQ, MPolyDecRingElem{QQFieldElem, QQMPolyRingElem}[x[1], x[2], x[3]])
julia> I = ideal(R, [x[1]^3*x[2], x[2]*x[3]^2, x[2]^2*x[3], x[3]^4]);
julia> A, _ = quo(R, I);
julia> H = multi_hilbert_series(A);
julia> H[1][1]
-t[1]^7*t[2]^-2 + t[1]^6*t[2]^-1 + t[1]^6*t[2]^-2 + t[1]^5*t[2]^-4 - t[1]^4 + t[1]^4*t[2]^-2 - t[1]^4*t[2]^-4 - t[1]^3*t[2]^-1 - t[1]^3*t[2]^-2 + 1
julia> H[1][2]
(-t[1] + 1)^2*(-t[1]*t[2]^-1 + 1)^1
julia> H[2][1]
Z^2
julia> H[2][2]
Identity map
of Z^2
julia> G = abelian_group(ZZMatrix([1 -1]));
julia> g = gen(G, 1)
Abelian group element [0, 1]
julia> W = [g, g, g, g];
julia> R, (w, x, y, z) = graded_polynomial_ring(QQ, ["w", "x", "y", "z"], W);
julia> A, _ = quo(R, ideal(R, [w*y-x^2, w*z-x*y, x*z-y^2]));
julia> (num, den), (H, iso) = multi_hilbert_series(A);
julia> num
2*t^3 - 3*t^2 + 1
julia> den
(-t + 1)^4
julia> H
Z
julia> iso
Map
from Z
to finitely generated abelian group with 2 generators and 1 relation
```

`multi_hilbert_series_reduced`

— Method`multi_hilbert_series_reduced(A::MPolyQuoRing; algorithm::Symbol=:BayerStillmanA)`

Return the reduced Hilbert series of the positively graded affine algebra `A`

.

The advanced user can select a `algorithm`

for the computation; see the code for details.

**Examples**

```
julia> W = [1 1 1; 0 0 -1];
julia> R, x = graded_polynomial_ring(QQ, ["x[1]", "x[2]", "x[3]"], W)
(Graded multivariate polynomial ring in 3 variables over QQ, MPolyDecRingElem{QQFieldElem, QQMPolyRingElem}[x[1], x[2], x[3]])
julia> I = ideal(R, [x[1]^3*x[2], x[2]*x[3]^2, x[2]^2*x[3], x[3]^4]);
julia> A, _ = quo(R, I);
julia> H = multi_hilbert_series_reduced(A);
julia> H[1][1]
-t[1]^5*t[2]^-1 + t[1]^3 + t[1]^3*t[2]^-3 + t[1]^2 + t[1]^2*t[2]^-1 + t[1]^2*t[2]^-2 + t[1] + t[1]*t[2]^-1 + 1
julia> H[1][2]
-t[1] + 1
julia> H[2][1]
Z^2
julia> H[2][2]
Identity map
of Z^2
julia> G = abelian_group(ZZMatrix([1 -1]));
julia> g = gen(G, 1)
Abelian group element [0, 1]
julia> W = [g, g, g, g];
julia> R, (w, x, y, z) = graded_polynomial_ring(QQ, ["w", "x", "y", "z"], W);
julia> A, _ = quo(R, ideal(R, [w*y-x^2, w*z-x*y, x*z-y^2]));
julia> H = multi_hilbert_series_reduced(A);
julia> H[1][1]
2*t + 1
julia> H[1][2]
t^2 - 2*t + 1
julia> H[2][1]
Z
julia> H[2][2]
Map
from Z
to finitely generated abelian group with 2 generators and 1 relation
```

`multi_hilbert_function`

— Method`multi_hilbert_function(A::MPolyQuoRing, g::FinGenAbGroupElem)`

Given a positively graded affine algebra $A$ over a field $K$ with grading group $G$, say, and given an element $g$ of $G$, return the value $H(A, g)$ of the Hilbert function

\[H(A, \underline{\phantom{d}}): G \to \mathbb{N}, \; g\mapsto \dim_K(A_g).\]

`multi_hilbert_function(A::MPolyQuoRing, g::Vector{<:IntegerUnion})`

Given a positively $\mathbb Z^m$-graded affine algebra $A$ over a field $K$, and given a vector $g$ of $m$ integers, convert $g$ into an element of the grading group of $A$, and return the value $H(A, g)$ as above.

`multi_hilbert_function(A::MPolyQuoRing, g::IntegerUnion)`

Given a positively $\mathbb Z$-graded affine algebra $A$ over a field $K$, and given an integer $g$, convert $g$ into an element of the grading group of $A$, and return the value $H(A, g)$ as above.

**Examples**

```
julia> W = [1 1 1; 0 0 -1];
julia> R, x = graded_polynomial_ring(QQ, ["x[1]", "x[2]", "x[3]"], W)
(Graded multivariate polynomial ring in 3 variables over QQ, MPolyDecRingElem{QQFieldElem, QQMPolyRingElem}[x[1], x[2], x[3]])
julia> I = ideal(R, [x[1]^3*x[2], x[2]*x[3]^2, x[2]^2*x[3], x[3]^4]);
julia> A, _ = quo(R, I);
julia> multi_hilbert_function(A::MPolyQuoRing, [1, 0])
2
```

```
julia> R, (w, x, y, z) = graded_polynomial_ring(QQ, ["w", "x", "y", "z"], [-1, -1, -1, -1]);
julia> A, _ = quo(R, ideal(R, [w*y-x^2, w*z-x*y, x*z-y^2]));
julia> multi_hilbert_function(A, -7)
22
```

```
julia> G = abelian_group(ZZMatrix([1 -1]));
julia> g = gen(G, 1);
julia> W = [g, g, g, g];
julia> R, (w, x, y, z) = graded_polynomial_ring(QQ, ["w", "x", "y", "z"], W);
julia> A, _ = quo(R, ideal(R, [w*y-x^2, w*z-x*y, x*z-y^2]));
julia> multi_hilbert_function(A, 7*g)
22
```

## Affine Algebras as Modules

`quotient_ring_as_module`

— Method`quotient_ring_as_module(A::MPolyQuoRing)`

Return `A`

considered as an object of type `SubquoModule`

.

`quotient_ring_as_module(I::MPolyIdeal)`

As above, where `A`

is the quotient of `base_ring(I)`

modulo `I`

.

**Examples**

```
julia> R, (x, y) = polynomial_ring(QQ, ["x", "y"]);
julia> I = ideal(R, [x^2, y^3])
Ideal generated by
x^2
y^3
julia> quotient_ring_as_module(I)
Subquotient of Submodule with 1 generator
1 -> e[1]
by Submodule with 2 generators
1 -> x^2*e[1]
2 -> y^3*e[1]
```

```
julia> S, (x, y) = graded_polynomial_ring(QQ, ["x", "y"]);
julia> I = ideal(S, [x^2, y^3])
Ideal generated by
x^2
y^3
julia> quotient_ring_as_module(I)
Graded subquotient of submodule of S^1 generated by
1 -> e[1]
by submodule of S^1 generated by
1 -> x^2*e[1]
2 -> y^3*e[1]
```