# Ideals of Orders

## Construction of Ideals

### `lideal<O | E>: AlgAssVOrd, [AlgAssVOrdElt] -> AlgAssVOrdIdl`

### `rideal<O | E>: AlgAssVOrd, [AlgAssVOrdElt] -> AlgAssVOrdIdl`

### `ideal<O | E>: AlgAssVOrd, [AlgAssVOrdElt] -> AlgAssVOrdIdl`

For an associative order $O$, this constructs the left, right or two sided $O$-ideal generated by the elements in the given sequence $E$ (these elements should be coercible into $O$).

### `lideal<O | M>: AlgAssVOrd, PMat -> AlgAssVOrdIdl`

### `lideal<O | M>: AlgAssVOrd, Mtrx -> AlgAssVOrdIdl`

### `rideal<O | M>: AlgAssVOrd, PMat -> AlgAssVOrdIdl`

### `rideal<O | M>: AlgAssVOrd, Mtrx -> AlgAssVOrdIdl`

### `ideal<O | M>: AlgAssVOrd, PMat -> AlgAssVOrdIdl`

### `ideal<O | M>: AlgAssVOrd, Mtrx -> AlgAssVOrdIdl`

Constructs a left, right or two sided ideal of the associative order $O$ whose basis is given by $M$, which may be either a matrix or a pseudo matrix.

### `O * e: AlgAssVOrd, RngElt -> AlgAssVOrdIdl`

### `e * O: RngElt, AlgAssVOrd -> AlgAssVOrdIdl`

The principal left (right) ideal of the associative order $O$ generated by the element $e$.

## Attributes of Ideals

In this section, $I$ is an ideal of some order in an associative algebra.

### `Order(I): AlgAssVOrdIdl -> AlgAssVOrd`

For an ideal $I$ created as an ideal of an order $O$, this returns $O$.

### `Algebra(I): AlgAssVOrdIdl -> AlgAssV`

This returns `Algebra(Order(I))`.

### `LeftOrder(I): AlgAssVOrdIdl -> AlgAssVOrd`

### `RightOrder(I): AlgAssVOrdIdl -> AlgAssVOrd`

For an ideal $I$, this returns the (full) order in `Algebra(I)` which stabilizes $I$ under multiplication on the left or right respectively. Explicitly, the left order of $I$ is defined as $\{ x : x I \subseteq I \}$.

### `ArithmeticRadical(O, p): AlgAssVOrd[RngOrd], RngOrdIdl -> AlgAssVOrdIdl`

### `ArithmeticRadical(O, p): AlgQuat, RngElt -> AlgQuatOrdIdl`

Given an order $O$ over a number ring $R$ and a prime ideal $p$ in $R$, return the *Arithmetic Radical* of $O$ over $p$. This is the unique two-sided ideal $J$ of $O$ over $pO$ such that $J/pO$ is the Jacobson radical of $O/pO$.

### `RadicalIdealizer(O, p): AlgAssVOrd[RngOrd], RngOrdIdl -> AlgAssVOrd`

### `RadicalIdealizer(O, p): AlgQuat, RngElt -> AlgQuat`

```magma
Side: MonStgElt                    Default: "Intersection"
```

Returns either the left or right order of the arithmetical radical of $O$ at $p$ or the intersection of these two orders, depending on whether `Side` is `"Left"`, `"Right"` or `"Intersection"`.

### `Neighbors(I, p): AlgAssVOrdIdl, RngOrdIdl -> SeqEnum[AlgAssVOrdIdl]`

### `Neighbors(I, p): AlgQuatOrdIdl, RngInt -> SeqEnum[AlgQuatOrdIdl]`

Returns the $p$-neighbors of the ideal $I$, namely the ideals $J \subseteq I$ such that ${\rm Nm}(J) = p {\rm Nm}(I)$. Currently, only implemented for squarefree ideals $p$ coprime to ${\rm Disc}(O) {\rm Nm}(I)$, where $O$ is `Order(I)`.

### `ElementsOfNorm(I, n): AlgAssVOrdIdl, RngElt -> SeqEnum`

```magma
ModUnits: BoolElt                    Default: false
```

Returns the elements in $I$ of norm $n$. Currently, only implemented when $I$ is an ideal in a definite quaternion algebra. If `ModUnits` is set to `true`, returns only one representative from every orbit under the action of the group of units of norm $1$ in $O$, where $O$ is `Order(I)`.

## Bases of Ideals

In this section, $I$ is an ideal of an order $O$ in an associative algebra.

### `Denominator(I): AlgAssVOrdIdl -> RngElt`

This returns an element $d$ of `BaseRing(O)` such that $d I \subseteq O$, where $O$ is `Order(I)`.

### `PseudoBasis(I): AlgAssVOrdIdl[RngOrd] -> SeqEnum`

Given an ideal $I$ of an order over $R$, where $R$ is an order in a number field, this returns data describing $I$ as an $R$-module. It returns a sequence of tuples $\langle I_i, b_i \rangle$ where $I_i$ is an ideal of $R$ and $b_i$ is an element of `Algebra(I)`, such that $I$ is the direct sum of the $R$-modules $I_i b_i$. In particular, the $b_i$ form a basis of `Algebra(I)` as a vector space over the field of fractions of $R$. Note that the $b_i$ may not lie in $I$.

### `PseudoMatrix(I): AlgAssVOrdIdl[RngOrd] -> PMat`

### `PseudoMatrix(I): AlgAssVOrdIdl[RngFunOrd] -> PMat`

Returns the pseudomatrix corresponding to `PseudoBasis(I)`.

### `Basis(I): AlgAssVOrdIdl -> SeqEnum`

When $I$ is an ideal of an order over ${\mathbb{Z}}$, this returns a ${\mathbb{Z}}$-module basis of $I$.

When the base ring of `Order(I)` is an extension of ${\mathbb{Z}}$, this returns part of the data returned by `PseudoBasis(I)`: it returns a basis of `Algebra(I)`. Note that this determines nothing about $I$, while the full data returned by `PseudoBasis(I)` determines $I$.

### `BasisMatrix(I): AlgAssVOrdIdl -> AlgMatElt`

This returns `Basis(I)` as a row matrix.

### `ZBasis(I): AlgAssVOrdIdl[RngOrd] -> [AlgAssVOrdElt]`

Returns a ${\mathbb{Z}}$-module basis for the ideal $I$.

### `Generators(I): AlgAssVOrdIdl[RngOrd] -> [AlgAssVOrdElt]`

Returns a sequence of generators for the ideal $I$ as a module over its base ring.

### `LocalBasis(I, p): AlgAssVOrdIdl, RngOrdIdl -> [AlgAssElt]`

```magma
Type: MonStgElt                    Default: ""
```

Given an ideal $I$ of an $R$-order in an algebra $A$, this function returns a basis of a free $R$-module $F$ in $A$ such that $I$ and $F$ agree at the completion at the prime ideal $p$ of $R$. If `Type` is specified, it must either be `"Submodule"` or `"Supermodule"`. In which case $F$ is either a sub- or supermodule of $I$.

### `PseudoBasis(I, R): AlgAssVOrdIdl[RngOrd], Str -> SeqEnum`

### `PseudoMatrix(I, R): AlgAssVOrdIdl[RngOrd], Str -> PMat`

### `Basis(I, R): AlgAssVOrdIdl, Str -> SeqEnum`

### `BasisMatrix(I, R): AlgAssVOrdIdl, Str -> AlgMatElt`

In these variants of the functions described above, the elements of the basis are expressed with respect to the basis of $R$, where $R$ is some ring contained in $A =$ `Algebra(I)` such that $R \otimes F = A$ where $F$ is the base field of $A$.

## Arithmetic for Ideals

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

The sum of the ideals $I$ and $J$, which are ideals which share a side in equal orders.

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

### `I * J: AlgAssVOrdIdl[RngOrd], AlgAssVOrdIdl[RngOrd] -> AlgAssVOrdIdl, AlgAssVOrdIdl`

The product of the ideals $I$ and $J$, where $I$ is a right ideal and $J$ is a left ideal of the same order $O$. Returns the product given the structure of left and right ideal.

### `a * I: RngElt, AlgAssVOrdIdl -> AlgAssVOrdIdl`

### `I * a: AlgAssVOrdIdl, RngElt -> AlgAssVOrdIdl`

### `a * I: RngElt, AlgQuatOrdIdl -> AlgQuatOrdIdl`

### `I * a: AlgQuatOrdIdl, RngElt -> AlgQuatOrdIdl`

Returns the product of $a$ and $I$ as an ideal.

### `A * I: RngOrdFracIdl, AlgAssVOrdIdl[RngOrd]) -> AlgAssVOrdIdl`

### `I * A: RngOrdFracIdl, AlgAssVOrdIdl[RngOrd]) -> AlgAssVOrdIdl`

Returns the product of a fractional ideal $A$ of the base ring with $I$ as an ideal.

### `Colon(J, I): AlgAssVOrdIdl[RngOrd], AlgAssVOrdIdl[RngOrd] -> PMat`

If $I,J$ are left ideals, returns the colon $(J:I)=\{x \in A: xI \subset J\}$, similarly defined if $I,J$ are right ideals.

### `MultiplicatorRing(I): AlgAssVOrdIdl -> AlgAssVOrd`

Returns the colon $(I:I)$ of the ideal $I$, the set of all elements which multiply $I$ into $I$.

## Predicates on Ideals

### `IsLeftIdeal(I): AlgAssVOrdIdl -> BoolElt`

### `IsRightIdeal(I): AlgAssVOrdIdl -> BoolElt`

### `IsTwoSidedIdeal(I): AlgAssVOrdIdl -> BoolElt`

Return `true` if the associative ideal $I$ is a left, right or two sided ideal (respectively).

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

Return `true` if the associative ideals $I$ and $J$ are equal.

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

Returns `true` if and only if the ideal $I$ is contained in the ideal $J$.

### `a in I: AlgAssVElt, AlgAssVOrdIdl -> BoolElt`

### `a notin I: AlgAssVElt, AlgAssVOrdIdl -> BoolElt`

Return `true` (`false`) if the element $a$ of an associative algebra is contained in the associative ideal $I$.

## Other Operations on Ideals

### `Norm(I): AlgAssVOrdIdl[RngOrd] -> RngOrdIdl`

Returns the norm of the ideal $I$, the ideal of the base number ring of $I$ generated by the norms of the elements in $I$.

### `Example: sumandadjoin (ex-d618e7)`

```magma
> F<w> := CyclotomicField(3);
%%> // MaximalOrder is random
> R := MaximalOrder(F);
> A := Algebra(FPAlgebra<F, x, y | x^3-3, y^3+5, y*x-w*x*y>);
> O := Order([A.i : i in [1..9]]);
> MinimalPolynomial(O.2);
$.1^3 + 5/1*R.1
> I := rideal<O | O.2>;
> IsLeftIdeal(I), IsRightIdeal(I), IsTwoSidedIdeal(I);
false true false
> MultiplicatorRing(I) eq O;
true
> PseudoBasis(I);
[
    <Principal Ideal of R
    Generator:
        R.1, (0 R.1 0 0 0 0 0 0 0)>,
    <Principal Ideal of R
    Generator:
        R.1, (0 0 0 R.1 0 0 0 0 0)>,
    <Principal Ideal of R
    Generator:
        R.1, (0 0 0 0 -R.1 - R.2 0 0 0 0)>,
    <Principal Ideal of R
    Generator:
        R.1, (-5/1*R.1 0 0 0 0 0 0 0 0)>,
    <Principal Ideal of R
    Generator:
        R.1, (0 0 0 0 0 0 -R.1 - R.2 0 0)>,
    <Principal Ideal of R
    Generator:
        R.1, (0 0 0 0 0 0 0 R.2 0)>,
    <Principal Ideal of R
    Generator:
        R.1, (0 0 5/1*R.1 + 5/1*R.2 0 0 0 0 0 0)>,
    <Principal Ideal of R
    Generator:
        R.1, (0 0 0 0 0 0 0 0 R.2)>,
    <Principal Ideal of R
    Generator:
        R.1, (0 0 0 0 0 -5/1*R.2 0 0 0)>
]
> ZBasis(I);
[ [0 R.1 0 0 0 0 0 0 0], [0 R.2 0 0 0 0 0 0 0], [0 0 0 R.1 0 0 0 0 0], [0 0 0
    R.2 0 0 0 0 0], [0 0 0 0 -R.1 - R.2 0 0 0 0], [0 0 0 0 R.1 0 0 0 0],
    [-5/1*R.1 0 0 0 0 0 0 0 0], [-5/1*R.2 0 0 0 0 0 0 0 0] ]
> Norm(I);
Principal Ideal of R
Generator:
    15625/1*R.1
> J := rideal<O | O.3>;
> Norm(J);
Principal Ideal of R
Generator:
    729/1*R.1
> A!1 in I+J;
false
> Denominator(1/6*I);
[1, 0]
> Colon(J,I);
Pseudo-matrix over Maximal Equation Order with defining polynomial x^2 + x + 1
over its ground order
Principal Ideal of R
Generator:
    3/1*R.1 * ( R.1 0 0 0 0 0 0 0 0 )
Principal Ideal of R
Generator:
    3/1*R.1 * ( 0 R.1 0 0 0 0 0 0 0 )
Principal Ideal of R
Generator:
    R.1 * ( 0 0 R.1 0 0 0 0 0 0 )
Fractional Principal Ideal of R
Generator:
    3/5*R.1 * ( 0 0 0 R.1 0 0 0 0 0 )
Principal Ideal of R
Generator:
    R.1 * ( 0 0 0 0 R.1 0 0 0 0 )
Principal Ideal of R
Generator:
    R.1 * ( 0 0 0 0 0 R.1 0 0 0 )
Fractional Principal Ideal of R
Generator:
    -1/5*R.1 * ( 0 0 0 0 0 0 R.1 0 0 )
Principal Ideal of R
Generator:
    R.1 * ( 0 0 0 0 0 0 0 R.1 0 )
Fractional Principal Ideal of R
Generator:
    1/5*R.1 * ( 0 0 0 0 0 0 0 0 R.1 )

```
