# Orders of Algebras

## `IsCoercible(S, x): AlgEtQOrd, Any -> BoolElt, AlgEtQElt`

Return whether $x$ is coercible into the order $S$ and the result if so.

## `Order(gens): SeqEnum[AlgEtQElt] -> AlgEtQOrd`

```magma
Check            : RngIntElt                    Default: 100
CheckIsKnownOrder: BoolElt                      Default: true
```

Construct the order generated by $gens$ over the rationals. The parameter `Check` (default 100) determines how many times the program tries to obtain a multiplicatively closed lattice by adding the product of the generators. If `Check` is 0 then this step is skipped. The parameter `CheckIsKnownOrder` determines whether the program checks if the order is already known, i.e. in the attribute `KnownOrders` of the algebra. This is to avoid the creation of multiple copies of the same order. The default value is `true`.

## `Order(A, orders): AlgEtQ, Tup -> AlgEtQOrd`

Given a sequence of orders in the number fields defining the étale algebra A, generates the direct sum order.

## `Algebra(S): AlgEtQOrd -> AlgEtQ`

Returns the algebra of the order $S$.

## `ZBasis(S): AlgEtQOrd -> SeqEnum[AlgEtQElt]`

Return a Z-basis of the order $S$.

## `Generators(S): AlgEtQOrd -> SeqEnum[AlgEtQElt]`

Return a set of generators (as a Z-algebra) of the order $S$.

## `O1 eq O2: AlgEtQOrd, AlgEtQOrd -> BoolElt`

Checks equality of orders in an étale algebra.

Equality of orders is performed using the `Hash` attribute which is constructed as follows. Let $S$ be an order. 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 $S$ and $d$ is the least common denominator of its entries. The `Hash` of $S$ 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.

## `x in O: AlgEtQElt, AlgEtQOrd -> BoolElt`

## `x in O: RngIntElt, AlgEtQOrd -> BoolElt`

## `x in O: FldRatElt, AlgEtQOrd -> BoolElt`

Return whether the element $x$ is contained in the order $O$ of an algebra.

## `AbsoluteCoordinates(seq, O): SeqEnum[AlgEtQElt], AlgEtQOrd -> SeqEnum`

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

## `One(S): AlgEtQOrd -> AlgEtQElt`

Returns the unit element of the order $S$.

## `Zero(S): AlgEtQOrd -> AlgEtQElt`

Returns the zero element of the order $S$.

## `Random(O, bd): AlgEtQOrd, RngIntElt -> AlgEtQElt`

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

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

## `Random(O): AlgEtQOrd -> AlgEtQElt`

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

Returns a random (small coefficient) element of the order $O$. 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 is set to `false` by default.

## `IsKnownOrder(~R): AlgEtQOrd`

This procedure checks whether the order $R$ is already in the list of known orders of the algebra $A$ containing $R$. If so then it replaces $R$ with the copy stored in the attribute `KnownOrders`. If not it adds it to `KnownOrders`. This is done to avoid creating multiple copies of the same order.

## `EquationOrder(A): AlgEtQ -> AlgEtQOrd`

Given an étale algebra defined by a polynomial, returns the monogenic order defined by the same polynomial.

## `ProductOfEquationOrders(A): AlgEtQ -> AlgEtQOrd`

Given an étale algebra $A$, returns the order consisting of the product of the equation orders of the number fields.

## `MaximalOrder(A): AlgEtQ -> AlgEtQOrd`

Returns the maximal order of the étale algebra $A$. It is the direct sum of the ring of integers of the number fields composing the algebra.

## `IsMaximal(S): AlgEtQOrd -> BoolElt`

Returns whether the order $S$ is the maximal order of the étale algebra.

## `IsProductOfOrders(O): AlgEtQOrd -> BoolElt, Tup`

Return if the order $O$ is a product of orders in number fields, and if so return also the sequence of these orders.

## `IsProductOfOrdersInComponents(O): AlgEtQOrd -> BoolElt, Tup`

Returns whether the argument is a product of orders in the components of its parent algebra. If so, it returns also a tuple containing these orders.

## `IsProductOfOrdersInFactorAlgebras(S): AlgEtQOrd -> BoolElt, SeqEnum[AlgEtQElt]`

Returns whether the given order is a product of orders living in some factor algebras of the parent algebra. This is equivalent to containing some idempotents of the algebra other than $0$ and $1$. If this is the case, it returns also the idempotents.

## `Example: Orders Factor Algebras (ex-f008b6)`

```magma
> _<x> := PolynomialRing(Integers());
> // We consider the following three number fields
> K1 := NumberField(x^2-2);
> K2 := NumberField(x^2-3);
> K3 := NumberField(x^2-5);
> // We define the product \'etale algebra A and the factor algebras B and C
> // consisting of only the first two components and the last one, respectively.
> B := EtaleAlgebra([K1,K2]);
> C := EtaleAlgebra([K3]);
> A, embs, projs := DirectProduct([B,C]);
> // The maximal order of A is the product of the three ring of integers.
> OA := MaximalOrder(A);
> IsProductOfOrdersInComponents(OA);
true <Maximal Equation Order with defining polynomial x^2 - 2 over its ground
order, Maximal Equation Order with defining polynomial x^2 - 3 over its ground
order, Maximal Order of Equation Order with defining polynomial x^2 - 5 over
its ground order>
> // The equation order of A is not a product in any factor algebra
> EA := EquationOrder(A);
> IsProductOfOrdersInFactorAlgebras(EA);
false []
> // Now we construct an order that is a product of an order in B and one in C,
> // but does not admit further splittings.
> a := PrimitiveElement(A);
> e1 := A![1,0,0];
> e2 := A![0,1,1];
> R := Order([a*e1,a*e2]);
> IsProductOfOrdersInFactorAlgebras(R);
true [ <1, 0, 0>, <0, 1, 1> ]

```

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

Given an order $T$ compute its index with respect to the basis of the algebra of $T$ as a free ${{\Bbb Z}}$-module.

## `Index(S, T): AlgEtQOrd, AlgEtQOrd -> FldRatElt`

Given two orders $T \subset S$, returns $[S:T] = \#S/T$.

## `O1 subset O2: AlgEtQOrd, AlgEtQOrd -> BoolElt`

Checks whether $O1$ is contained in $O2$.

## `O1 * O2: AlgEtQOrd, AlgEtQOrd -> AlgEtQOrd`

Returns the order generated by the orders $O1$ and $O2$.

## `O1 meet O2: AlgEtQOrd, AlgEtQOrd -> AlgEtQOrd`

Return the intersection of orders $O1$ and $O2$.

## `MultiplicatorRing(R): AlgEtQOrd -> AlgEtQOrd`

Returns the multiplicator ring of an order $R$, that is $R$ itself.
