# Predicates of Orders

Let $O$ be a quaternion order with base ring ${\mathbb{Z}}$, ${\mathbb{F}}_q[X]$ with $q$ odd, or a number ring. Then Magma can test the following predicates.

## `IsMaximal(O): AlgAssVOrd -> BoolElt`

Returns `true` if and only if the order $O$ is maximal.

## `IspMaximal(O, p): AlgAssVOrd, RngOrdIdl -> BoolElt`

## `IspMaximal(O, p): AlgQuatOrd, RngElt -> BoolElt`

Returns `true` if and only if the order $O$ is maximal at the prime or prime ideal $p$.

## `IsEichler(O): AlgAssVOrd -> BoolElt, AlgAssVOrd, AlgAssVOrd`

```magma
MaximalOrders: BoolElt                    Default: false
```

Returns `true` if and only if the order $O$ is *Eichler*, that is an intersection of two (not necessarily distinct) maximal orders. The function calls the `EichlerInvariant` intrinsic explained below.

If the optional argument `MaximalOrders` is set to `true`, the algorithm also returns two maximal orders such that $O$ is their intersection.

## `IsEichler(O, p): AlgAssVOrd, RngOrdIdl -> BoolElt, AlgAssVOrd, AlgAssVOrd`

## `IsEichler(O, p): AlgQuatOrd, RngElt -> BoolElt, AlgQuatOrd, AlgQuatOrd`

```magma
MaximalOrders: BoolElt                    Default: false
```

Returns `true` if and only if the completion of the order $O$ at the prime (ideal) $p$ is *Eichler*.

If the optional argument `MaximalOrders` is set to `true`, the algorithm also returns two $p$-maximal orders such that $O$ is their intersection.

## `EichlerInvariant(O, p): AlgAssVOrd, RngOrdIdl -> RngIntElt`

## `EichlerInvariant(O, p): AlgQuatOrd, RngElt -> RngIntElt`

Returns the local Eichler invariant of $O$ at some prime (ideal) $p$ which divides the discriminant of $O$. Let $R$ be the base ring of $O$ and let $J$ be the Jacobson radical of the $R/p$-algebra $O/pO$. If $J$ has dimension $3$ then the Eichler invariant is defined to be $0$. Otherwise the quotient of $O/pO$ by $J$ is either isomorphic to a direct sum of two copies of $R/p$ or a quadratic field extension of $R/p$. In the first case the Eichler invariant is $1$, in the latter it is $-1$.

## `IsHereditary(O): AlgAssVOrd -> BoolElt`

Returns `true` if and only if the order $O$ is a hereditary order in a quaternion algebra $A$. That is, every lattice in $A$ of full rank such that $O$ is contained in its left order is a projective left $O$-module. The hereditary orders are precisely those with squarefree discriminant.

## `IsHereditary(O, p): AlgAssVOrd, RngOrdIdl -> BoolElt`

## `IsHereditary(O, p): AlgQuatOrd, RngElt -> BoolElt`

Returns `true` if and only if the completion of the order $O$ at the prime (ideal) $p$ is *hereditary*.

## `IsGorenstein(O): AlgAssVOrd -> BoolElt, .`

Returns `true` if and only if the order $O$ is a Gorenstein order. That is, the dual of $O$ with respect to the trace bilinear form is a projective $O$-module. The second return value is the Brandt invariant of $O$ as in the [`GorensteinClosure`](order-creation.md#function-algquat-gorensteinclosure) intrinsic.

## `IsGorenstein(O, p): AlgAssVOrd, RngOrdIdl -> BoolElt, RngIntElt`

## `IsGorenstein(O, p): AlgQuatOrd, RngElt -> BoolElt, RngIntElt`

Returns `true` if and only if the completion of the order $O$ at the prime (ideal) $p$ is *Gorenstein*. The second return value is the valuation of the Brandt invariant of $O$ at $p$.

## `IsBass(O): AlgAssVOrd -> BoolElt`

Returns `true` if and only if the order $O$ is a Bass order, i.e. every order which contains $O$ is Gorenstein.

## `IsBass(O, p): AlgAssVOrd, RngOrdIdl -> BoolElt`

## `IsBass(O, p): AlgQuatOrd, RngElt -> BoolElt`

Returns `true` if and only if the completion of the order $O$ at the prime (ideal) $p$ is *Bass*.

## `IsSameType(O1, O2): AlgAssVOrd, AlgAssVOrd -> BoolElt`

Returns `true` if and only if the two quaternion orders $O1$ and $O2$ are of the same *type* which means that they are locally isomorphic. The orders must be over the ring of integers or a number ring.
