# Operations on Ideals

In the following, note that since ideals of a full polynomial ring $P$ are regarded as subrings of $P$, the ring $P$ itself is a valid ideal as well (the ideal containing 1).

## Basic Operations

### `I + J: RngMPolLoc, RngMPolLoc -> RngMPolLoc`

Given ideals $I$ and $J$ of the same polynomial ring $P$, return the sum of $I$ and $J$, which is the ideal generated by the generators of $I$ and those of $J$.

### `I * J: RngMPolLoc, RngMPolLoc -> RngMPolLoc`

Given ideals $I$ and $J$ of the same polynomial ring $P$, return the product of $I$ and $J$, which is the ideal generated by the products of the generators of $I$ and those of $J$.

### `I ^ k: RngMPolLoc, RngIntElt -> RngMPolLoc`

Given an ideal $I$ of the polynomial ring $P$, and an integer $k$, return the $k$-th power of $I$.

### `QuotientDimension(I): RngMPol -> RngIntElt`

Given an ideal $I$ of a local polynomial ring $R$ over a field $K$, return the dimension of $P/I$ as a $K$-vector space. Note that this is quite different from the function [`Dimension`](dimension.md#function-rngmpolloc-dimension) below (which returns the Krull dimension of an ideal).

### `Generic(I): RngMPolLoc -> RngMPolLoc`

Given an ideal $I$ of a generic local polynomial ring $R$, return $R$.

### `LeadingMonomialIdeal(I): RngMPolLoc -> RngMPolLoc`

Given an ideal $I$, return the leading monomial ideal of $I$; that is, the ideal generated by all the leading monomials of I.

### `I meet J: RngMPolLoc, RngMPolLoc -> RngMPolLoc`

Given ideals $I$ and $J$ of the same polynomial ring $P$, return the intersection of $I$ and $J$.

### `&meet S: [ RngMPolLoc ] -> RngMPolLoc`

Given a set or sequence $S$ of ideals of the same local polynomial ring $R$, return the intersection of all the ideals of $S$.

## Ideal Predicates

### `I eq J: RngMPolLoc, RngMPolLoc -> BoolElt`

Given two ideals $I$ and $J$ of the same polynomial ring $P$, return whether $I$ and $J$ are equal.

### `I ne J: RngMPolLoc, RngMPolLoc -> BoolElt`

Given two ideals $I$ and $J$ of the same polynomial ring $P$, return whether $I$ and $J$ are not equal.

### `I notsubset J: RngMPolLoc, RngMPolLoc -> BoolElt`

Given two ideals $I$ and $J$ in the same polynomial ring $P$ return whether $I$ is not contained in $J$.

### `I subset J: RngMPolLoc, RngMPolLoc -> BoolElt`

Given two ideals $I$ and $J$ in the same polynomial ring $P$ return whether $I$ is contained in $J$.

### `IsZero(I): RngMPolLoc -> BoolElt`

Given an ideal $I$ of the local polynomial ring $R$, return whether $I$ is the zero ideal (contains zero alone).

### `IsProper(I): RngMPolLoc -> BoolElt`

Given an ideal $I$ of the local polynomial ring $R$, return whether $I$ is proper; that is, whether $I$ is strictly contained in $R$ (or whether the standard basis of $I$ does not contain 1 alone).

### `IsZeroDimensional(I): RngMPolLoc -> BoolElt`

Given an ideal $I$ of the local polynomial ring $R$, return whether $I$ is zero-dimensional (so the quotient of $P$ by $I$ has non-zero finite dimension as a vector space over the coefficient field – see the section on dimension for further details). Note that the ring $R$ has dimension $-1$, so it is not zero-dimensional.

### `Example: Ideal Arithmetic (ex-b95527)`

We construct some ideals in ${\mathbb{Q}}[x, y, z]$ and perform basic arithmetic on them.

```magma
> R<x,y,z> := LocalPolynomialRing(RationalField(), 3);
> I := ideal<R | x*y - z, x^3*z^2 - y^2, x*z^3 - x - y>;
> J := ideal<R | x*y - z, x^2*z - y, x*z^3 - x - y>;
> A := I * J;
> _ := StandardBasis(A);
> A;
Ideal of Localization of Polynomial Ring of rank 3 over Rational Field
Order: Local Lexicographical
Variables: x, y, z
Inhomogeneous, Dimension 0
Standard basis:
[
    x^2 - y^2 + 2*x^3*z,
    x*y + y^2 - x^3*z,
    y^3,
    x*z + y*z,
    y*z,
    z^2
]
> M := I meet J;
> M;
Ideal of Localization of Polynomial Ring of rank 3 over Rational Field
Order: Local Lexicographical
Variables: x, y, z
Homogeneous
Basis:
[
    x + y,
    y^2,
    z
]
> A eq M;
false
> A subset M;
true

```

## Operations on Elements of Ideals

### `f in I: RngMPolLocElt, RngMPolLoc -> BoolElt`

Given a polynomial $f$ from a local polynomial ring $R$, together with an ideal $I$ of $R$, return whether $f$ is in $I$.

### `NormalForm(f, I): RngMPolLocElt, RngMPolLoc -> RngMPolLocElt`

Given a polynomial $f$ from a local polynomial ring $R$, together with an ideal $I$ of $R$, return a normal form of $f$ with respect to (the standard basis of) $I$. The normal form of $f$ is zero if and only if $f$ is in $I$.

### `f notin I: RngMPolLocElt, RngMPolLoc -> BoolElt`

Given a polynomial $f$ from a polynomial ring $P$, together with an ideal $I$ of $P$, return whether $f$ is not in $I$.

### `Example: Element Operations (ex-e2cb48)`

We demonstrate the element operations with respect to an ideal of the localization of ${\mathbb{Q}}[x, y, z]$.

```magma
> R<x,y,z> := LocalPolynomialRing(RationalField(), 3);
> I := ideal<R | (x + y)^3, (y - z)^2, y^2*z + z>;
> NormalForm(y^2*z + z, I);
0
> NormalForm(x^3, I);
-3*x^2*y
> x + y in I;
false

```
