# Basic Operations on Ideals

In the following, note that the free algebra $F$ itself is a valid ideal (the ideal containing 1).

## Construction of New Ideals

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

Given ideals $I$ and $J$ belonging to the same algebra $F$, return the sum of $I$ and $J$, which is the ideal generated by the union of the generators of $I$ and $J$.

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

Given ideals $I$ and $J$ belonging to the same algebra $A$, return the product of $I$ and $J$, which is the ideal generated by the products of the generators of $I$ with those of $J$.

### `F / J: AlgFr, AlgFr -> AlgFrRes`

Given an algebra $F$ over a field and an ideal $J$ of $F$, return the fp-algebra $F/J$ (see below).

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

Given an ideal $I$ of a generic algebra $A$, return $A$.

## Ideal Predicates

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

Given two ideals $I$ and $J$ belonging to the same algebra $F$, return whether $I$ and $J$ are equal.

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

Given two ideals $I$ and $J$ belonging to the same algebra $F$, return whether $I$ and $J$ are not equal.

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

Given two ideals $I$ and $J$ belonging to the same algebra $F$ return whether $I$ is not contained in $J$.

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

Given two ideals $I$ and $J$ belonging to the same algebra $F$ return whether $I$ is contained in $J$.

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

Given an ideal $I$ of the algebra $F$, return whether $I$ is the zero ideal (contains zero alone).

## Operations on Elements of Ideals

### `f in I: AlgFrElt, AlgFr -> BoolElt`

Given a polynomial $f$ from an algebra $F$, together with an ideal $I$ of $F$, return whether $f$ is in $I$.

### `NormalForm(f, I): AlgFrElt, AlgFr -> AlgFrElt`

Given a polynomial $f$ from an algebra $F$, together with an ideal $I$ of $F$, return the unique normal form of $f$ with respect to (the Gröbner basis of) $I$. The normal form of $f$ is zero if and only if $f$ is in $I$.

### `NormalForm(f, S): AlgFrElt, [ AlgFrElt ] -> AlgFrElt`

Given a polynomial $f$ from an algebra $F$, together with a set or sequence $S$ of polynomials from $F$, return a normal form of $f$ with respect to $S$. This is not unique in general. If the normal form of $f$ is zero then $f$ is in the ideal generated by $S$, but the converse is false in general. In fact, the normal form is unique if and only if $S$ forms a Groëbner basis.

### `f notin I: AlgFrElt, AlgFr -> BoolElt`

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

### `Example: Element Operations (ex-3dd8c1)`

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

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

```
