# Ideals

## `Ideal(S, gens): AlgEtQOrd, SeqEnum -> AlgEtQIdl`

Creates an ideal of the order $S$, generated by the elements of $gens$.

## `Ideal(S, idls): AlgEtQOrd, Tup -> AlgEtQIdl`

Given an order $S$ which is a product of orders $S_i$ in the number fields generating `Algebra(S)`, and a tuple of ideals $I_i$ of $S_i$, returns the $S$-ideal corresponding to the direct sum of the $I_i$.

## `Ideal(S, gen): AlgEtQOrd, Any -> AlgEtQIdl`

## `S * gen: AlgEtQOrd, AlgEtQElt -> AlgEtQIdl`

## `S * gen: AlgEtQOrd, RngIntElt -> AlgEtQIdl`

## `S * gen: AlgEtQOrd, FldRatElt -> AlgEtQIdl`

## `gen * S: AlgEtQElt, AlgEtQOrd -> AlgEtQIdl`

## `gen * S: RngIntElt, AlgEtQOrd -> AlgEtQIdl`

## `gen * S: FldRatElt, AlgEtQOrd -> AlgEtQIdl`

Creates an ideal of $S$, generated by $gen$.

## `T !! I: AlgEtQOrd, AlgEtQIdl -> AlgEtQIdl`

Given an $S$-ideal $I$ and an order $T$, returns the extension $IT$ as a $T$-ideal. Note that if $T$ is a subset of $S$, then $IT=I$.

## `Algebra(I): AlgEtQIdl -> AlgEtQ`

Returns the étale algebra in which the ideal $I$ lives.

## `Order(I): AlgEtQIdl -> AlgEtQOrd`

Returns the order of definition of the ideal $I$.

## `ZBasis(I): AlgEtQIdl -> SeqEnum[AlgEtQElt]`

Returns a ${{\Bbb Z}}$-basis of the ideal $I$.

## `Generators(I): AlgEtQIdl -> SeqEnum[AlgEtQElt]`

Returns the generators of the ideal $I$.

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

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

Returns whether the ideals $I$ and $J$ are equal, respectively not equal.

Let $I$ a fractional $S$-ideal in an étale algebra over ${{\Bbb Q}}$. Let $P$ be the upper triangular Hermite normal form of the integer square matrix $d\cdot M$ where $M$ is the matrix whose rows are the coefficients of a ${{\Bbb Z}}$-basis of $I$ and $d$ is the least common denominator of its entries. The `Hash` of $I$ is defined to be the sequence consisting of the least common denominator of ${1\over d}\cdot P$ and the entries of the upper triangular part of ${1\over d}\cdot P$. This hashing method has no collisions and it is independent of the choice of ${{\Bbb Z}}$-basis from which we start the procedure.

## `I eq S: AlgEtQIdl, AlgEtQOrd -> BoolElt`

## `S eq I: AlgEtQOrd, AlgEtQIdl -> BoolElt`

Return whether $I$ is equal to $S$ when $I$ is an ideal of $S$.

## `AbsoluteCoordinates(x, I): AlgEtQElt, AlgEtQIdl -> SeqEnum`

Given an element $x$ and an ideal $I$, returns the coordinates of $x$ with respect to the stored Z-basis of $I$.

## `AbsoluteCoordinates(seq, I): SeqEnum[AlgEtQElt], AlgEtQIdl -> SeqEnum`

Returns the coordinates of the elements in `seq` with respect to the stored Z-basis of $I$.

## `x in I: AlgEtQElt, AlgEtQIdl -> BoolElt`

## `x in I: RngIntElt, AlgEtQIdl -> BoolElt`

## `x in I: FldRatElt, AlgEtQIdl -> BoolElt`

Returns whether the element $x$ is in the ideal $I$.

## `S subset I: AlgEtQOrd, AlgEtQIdl -> BoolElt`

Given an ideal $I$ of an order $S$, return whether $S \subseteq I$.

## `I subset S: AlgEtQIdl, AlgEtQOrd -> BoolElt`

Given an ideal $I$ of an order $S$, return whether $I \subseteq S$.

## `I1 subset I2: AlgEtQIdl, AlgEtQIdl -> BoolElt`

Checks if the ideal $I1$ is inside the ideal $I2$. The ideals need to be fractional.

## `Index(T): AlgEtQIdl -> FldRatElt`

Given an ideal $T$ computes its index with respect to the basis of the algebra of $T$ as a free ${{\Bbb Q}}$-module.

## `Index(J, I): AlgEtQIdl, AlgEtQIdl -> Any`

Given fractional ideals $J$ and $I$ defined over the same order returns $[J:I] = [J:J \cap I]/[I : J \cap I]$.

## `Index(S, I): AlgEtQOrd, AlgEtQIdl -> Any`

Given an ideal $I$ of an order $S$ returns $[S:I] = [S:S \cap I]/[I : S \cap I]$.

## `OneIdeal(S): AlgEtQOrd -> AlgEtQIdl`

Given an order $S$ returns the ideal $1*S$ which will be cached.

## `Conductor(O): AlgEtQOrd -> AlgEtQOrdIdl`

Computes the conductor of an order $O$, defined as the colon ideal $(O:O_K)$, where $O_K$ is the maximal order of the algebra.

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

Returns the sum of two ideals.

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

Product of two ideals.

## `I * x: AlgEtQIdl, AlgEtQElt -> AlgEtQIdl`

## `I * x: AlgEtQIdl, RngIntElt -> AlgEtQIdl`

## `I * x: AlgEtQIdl, FldRatElt -> AlgEtQIdl`

## `x * I: AlgEtQElt, AlgEtQIdl -> AlgEtQIdl`

## `x * I: RngIntElt, AlgEtQIdl -> AlgEtQIdl`

## `x * I: FldRatElt, AlgEtQIdl -> AlgEtQIdl`

Returns $x*I$.

## `I ^ n: AlgEtQIdl, RngIntElt) -> AlgEtQIdl`

Returns the $n$th power of an ideal.

## `I meet S: AlgEtQIdl, AlgEtQOrd -> AlgEtQIdl`

## `S meet I: AlgEtQOrd, AlgEtQIdl -> AlgEtQIdl`

Given an ideal $I$ of $S$, return $S \cap I$.

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

Given ideals $I$ and $J$, return $J \cap I$.

## `&+ seq: SeqEnum[AlgEtQIdl] -> AlgEtQIdl`

Returns the sum of the fractional ideals in the sequence.

## `ColonIdeal(I, J): AlgEtQIdl, AlgEtQIdl -> AlgEtQIdl`

Computes the colon ideal $(I:J)$ (as an $O$-ideal) of two $O$-ideals, which is the set of elements $x$ of the algebra such that $x \cdot J \subset I$.

## `ColonIdeal(O, J): AlgEtQOrd, AlgEtQIdl -> AlgEtQIdl`

Computes the colon ideal $(1 \cdot O:J)$ (as an $O$-ideal).

## `ColonIdeal(I, O): AlgEtQIdl, AlgEtQOrd -> AlgEtQIdl`

Computes the colon ideal $(I:1 \cdot O)$ (as an $O$-ideal).

## `IsInvertible(I): AlgEtQIdl -> BoolElt`

Checks if the ideal $I$ is invertible in its order of definition $O$.

## `Inverse(I): AlgEtQIdl -> AlgEtQIdl`

Computes the inverse of an invertible ideal $I$.

## `MultiplicatorRing(I): AlgEtQIdl -> AlgEtQOrd`

Given a fractional ideal $I$ computes its multiplicator ring $(I:I)$.

## `IsProductOfIdeals(I): AlgEtQIdl -> BoolElt, Tup`

Return if the ideal $I$ is a product of ideals in the number fields defining the algebra. If so, it returns also the sequence of these ideals (in the appropriate orders). Note: we require `Order(I)` to be `MultiplicatorRing(I)`.

## `Random(I, bd): AlgEtQIdl, RngIntElt -> AlgEtQElt`

```magma
ZeroDivisorsAllowed: BoolElt                    Default: false
```

Returns a random element of the ideal $I$. The coefficients are bounded by the positive integer $bd$. One can allow zero-divisors using the optional parameter `ZeroDivisorsAllowed`, which by default is set to `false`.

## `Random(I): AlgEtQIdl -> AlgEtQElt`

```magma
CoeffRange         : RngIntElt                    Default: 3
ZeroDivisorsAllowed: BoolElt                      Default: false
```

Returns a random (small coefficient) element of the ideal $I$. The range of the random coefficients can be increased by giving the optional parameter `CoeffRange`. One can allow zero-divisors using the optional parameter `ZeroDivisorsAllowed`, which by default is set to `false`.

## `IsCoprime(I, J): AlgEtQIdl, AlgEtQIdl -> BoolElt`

Given two integral ideals $I$ and $J$ of an order $S$, returns whether $I+J=R$.

## `IsIntegral(I): AlgEtQIdl -> BoolElt`

Returns whether the ideal $I$ of $S$ is integral, that is $I \subseteq S$.

## `MakeIntegral(I): AlgEtQIdl -> AlgEtQIdl, RngIntElt`

Given a fractional $S$ ideal $I$, returns the ideal $d \cdot I, d$ when $d$ is the smallest integer such that $d \cdot I$ is integral in $S$. Compare with [`SmallRepresentative`](short_elt_small_rep.md#function-smallrep).

## `MinimalInteger(I): AlgEtQIdl -> RngIntElt`

Returns the smallest integer contained in the ideal $I$.

## `CoprimeRepresentative(I, J): AlgEtQIdl, AlgEtQIdl -> AlgEtQElt, AlgEtQIdl`

Returns an element $x$ such that $x \cdot I$ is an integral ideal coprime with $J$, together with the product $x \cdot I$. The first ideal must be invertible and the second should be integral.

## `ZBasisLLL(~S): AlgEtQOrd`

## `ZBasisLLL(~S): AlgEtQIdl`

A procedure that replaces the ZBasis with an LLL-reduced one. Note: the attribute inclusion matrix, which depends on the ${{\Bbb Z}}$-Basis is modified as well.
