# Orders

Orders, that is, unitary subrings that are free $\mathbf{Z}$-modules of rank equal to the degree of the number field, are at the core of the arithmetic of number fields. In Hecke, orders are always represented using the module structure, be it the $\mathbf{Z}$-module structure for orders of absolute numbers fields, or the structure as a module over the maximal order of the base field in the case of relative number fields. In this chapter we mainly deal with orders of absolute fields. However, many functions apply in same way to relative extensions. There are more general definitions of orders in number fields available, but those are (currently) not implemented in Hecke.

Among all orders in a fixed field, there is a unique maximal order, called the maximal order, or ring of integers of the number field. It is well known that this is the only order that is a Dedekind domain, hence has a rich ideal structure as well. The maximal order is also the integral closure of $\mathbf{Z}$ in the number field and can also be interpreted as a normalization of any other order.

## Creation and basic properties

OrderMethod
Order(B::Vector{nf_elem}; check::Bool = true, cached::Bool = true, isbasis::Bool = false) -> NfOrd
Order(K::AnticNumberField, B::Vector{nf_elem}; check::Bool = true, cached::Bool = true, isbasis::Bool = false) -> NfOrd

Returns the order generated by $B$. If check is set, it is checked whether $B$ defines an order. If isbasis is set, then elements are assumed to form a $\mathbf{Z}$-basis.

OrderMethod
Order(K::AnticNumberField, A::FakeFmpqMat; check::Bool = true) -> NfOrd

Returns the order which has basis matrix $A$ with respect to the power basis of $K$. If check is set, it is checked whether $A$ defines an order.

OrderMethod
Order(K::AnticNumberField, A::fmpz_mat, check::Bool = true) -> NfOrd

Returns the order which has basis matrix $A$ with respect to the power basis of $K$. If check is set, it is checked whether $A$ defines an order.

Order(A::AbsAlgAss{<: NumFieldElem}, M::PMat{<: NumFieldElem, T})
-> AlgAssRelOrd

Returns the order of $A$ with basis pseudo-matrix $M$.

EquationOrderMethod
EquationOrder(K::NumberField) -> NumFieldOrd
equation_order(K::NumberField) -> NumFieldOrd

Returns the equation order of the number field $K$.

MaximalOrderMethod
MaximalOrder(K::NumField{fmpq}; discriminant::fmpz, ramified_primes::Vector{fmpz}) -> NfAbsOrd

Returns the maximal order of $K$. Additional information can be supplied if they are already known, as the ramified primes or the discriminant of the maximal order.

Example

julia> Qx, x = FlintQQ["x"];
julia> K, a = NumberField(x^3 + 2, "a");
julia> O = MaximalOrder(K);
MaximalOrderMethod
MaximalOrder(O::NfAbsOrd; index_divisors::Vector{fmpz}, discriminant::fmpz, ramified_primes::Vector{fmpz}) -> NfAbsOrd

Returns the maximal order of the number field that contains $O$. Additional information can be supplied if they are already known, as the ramified primes, the discriminant of the maximal order or a set of integers dividing the index of $O$ in the maximal order.

MaximalOrder(O::AlgAssAbsOrd)

Given an order $O$, this function returns a maximal order containing $O$.

MaximalOrder(A::AbsAlgAss{fmpq}) -> AlgAssAbsOrd

Returns a maximal order of $A$.

lllMethod
lll(M::NfAbsOrd) -> NfAbsOrd

The same order, but with the basis now being LLL reduced wrt. the Minkowski metric.

any_orderMethod
any_order(K::NumberField)

Return some order in $K$. In case the defining polynomial for $K$ is monic and integral, this just returns the equation order. In the other case $\mathbb Z[\alpha]\cap \mathbb Z[1/\alpha]$ is returned.

### Example

julia> Qx, x = PolynomialRing(FlintQQ, "x");julia> K, a = NumberField(x^2 - 2, "a");julia> O = EquationOrder(K)Order of Number field over Rational Field with defining polynomial x^2 - 2
with Z-basis NfOrdElem[1, a]
parentMethod
parent(O::NfAbsOrd) -> NfOrdSet

Returns the parent of $\mathcal O$, that is, the set of orders of the ambient number field.

signatureMethod
signature(O::NumFieldOrd) -> Tuple{Int, Int}

Returns the signature of the ambient number field of $\mathcal O$.

nfMethod
nf(O::NumFieldOrd) -> NumField

Returns the ambient number field of $\mathcal O$.

basisMethod
basis(O::NfAbsOrd) -> Vector{NfAbsOrdElem}

Returns the $\mathbf Z$-basis of $\mathcal O$.

basis(I::NfAbsOrdFracIdl) -> Vector{nf_elem}

Returns the $\mathbf Z$-basis of $I$.

lll_basisMethod
lll_basis(M::NumFieldOrd) -> Vector{NumFieldElem}

A basis for $M$ that is reduced using the LLL algorithm for the Minkowski metric.

basisMethod
basis(O::NfOrd, K::AnticNumberField) -> Vector{nf_elem}

Returns the $\mathbf Z$-basis elements of $\mathcal O$ as elements of the ambient number field.

pseudo_basisMethod
  pseudo_basis(O::NfRelOrd{T, S}) -> Vector{Tuple{NumFieldElem{T}, S}}

Returns the pseudo-basis of $\mathcal O$.

basis_pmatrixMethod
  basis_pmatrix(O::NfRelOrd) -> PMat

Returns the basis pseudo-matrix of $\mathcal O$ with respect to the power basis of the ambient number field.

basis_nfMethod
  basis_nf(O::NfRelOrd) -> Vector{NumFieldElem}

Returns the elements of the pseudo-basis of $\mathcal O$ as elements of the ambient number field.

inv_coeff_idealsMethod
  inv_coeff_ideals(O::NfRelOrd{T, S}) -> Vector{S}

Returns the inverses of the coefficient ideals of the pseudo basis of $O$.

basis_matrixMethod
basis_matrix(O::NfAbsOrd) -> FakeFmpqMat

Returns the basis matrix of $\mathcal O$ with respect to the basis of the ambient number field.

basis_mat_invMethod
basis_mat_inv(O::NfAbsOrd) -> FakeFmpqMat

Returns the inverse of the basis matrix of $\mathcal O$.

basis_mat_inv(A::GenOrdIdl) -> FakeFracFldMat

Return the inverse of the basis matrix of $A$.

gen_indexMethod
gen_index(O::NfOrd) -> fmpq

Returns the generalized index of $\mathcal O$ with respect to the equation order of the ambient number field.

is_index_divisorMethod
is_index_divisor(O::NfOrd, d::fmpz) -> Bool
is_index_divisor(O::NfOrd, d::Int) -> Bool

Returns whether $d$ is a divisor of the index of $\mathcal O$. It is assumed that $\mathcal O$ contains the equation order of the ambient number field.

minkowski_matrixMethod
minkowski_matrix(O::NfAbsOrd, abs_tol::Int = 64) -> arb_mat

Returns the Minkowski matrix of $\mathcal O$. Thus if $\mathcal O$ has degree $d$, then the result is a matrix in $\operatorname{Mat}_{d\times d}(\mathbf R)$. The entries of the matrix are real balls of type arb with radius less then 2^-abs_tol.

inMethod
in(a::NumFieldElem, O::NumFieldOrd) -> Bool

Checks whether $a$ lies in $\mathcal O$.

norm_change_constMethod
norm_change_const(O::NfOrd) -> (Float64, Float64)

Returns $(c_1, c_2) \in \mathbf R_{>0}^2$ such that for all $x = \sum_{i=1}^d x_i \omega_i \in \mathcal O$ we have $T_2(x) \leq c_1 \cdot \sum_i^d x_i^2$ and $\sum_i^d x_i^2 \leq c_2 \cdot T_2(x)$, where $(\omega_i)_i$ is the $\mathbf Z$-basis of $\mathcal O$.

trace_matrixMethod
trace_matrix(O::NfAbsOrd) -> fmpz_mat

Returns the trace matrix of $\mathcal O$, that is, the matrix $(\operatorname{tr}_{K/\mathbf Q}(b_i \cdot b_j))_{1 \leq i, j \leq d}$.

+Method
+(R::NfOrd, S::NfOrd) -> NfOrd

Given two orders $R$, $S$ of $K$, this function returns the smallest order containing both $R$ and $S$. It is assumed that $R$, $S$ contain the ambient equation order and have coprime index.

poverorderMethod
poverorder(O::NfOrd, p::fmpz) -> NfOrd
poverorder(O::NfOrd, p::Integer) -> NfOrd

This function tries to find an order that is locally larger than $\mathcal O$ at the prime $p$: If $p$ divides the index $[ \mathcal O_K : \mathcal O]$, this function will return an order $R$ such that $v_p([ \mathcal O_K : R]) < v_p([ \mathcal O_K : \mathcal O])$. Otherwise $\mathcal O$ is returned.

poverordersMethod
poverorders(O, p) -> Vector{Ord}

Returns all p-overorders of O, that is all overorders M, such that the index of O in M is a p-power.

pmaximal_overorderMethod
pmaximal_overorder(O::NfOrd, p::fmpz) -> NfOrd
pmaximal_overorder(O::NfOrd, p::Integer) -> NfOrd

This function finds a $p$-maximal order $R$ containing $\mathcal O$. That is, the index $[ \mathcal O_K : R]$ is not divisible by $p$.

pradicalMethod
pradical(O::NfOrd, p::{fmpz|Integer}) -> NfAbsOrdIdl

Given a prime number $p$, this function returns the $p$-radical $\sqrt{p\mathcal O}$ of $\mathcal O$, which is just $\{ x \in \mathcal O \mid \exists k \in \mathbf Z_{\geq 0} \colon x^k \in p\mathcal O \}$. It is not checked that $p$ is prime.

pradicalMethod
  pradical(O::NfRelOrd, P::NfOrdIdl) -> NfRelOrdIdl

Given a prime ideal $P$, this function returns the $P$-radical $\sqrt{P\mathcal O}$ of $\mathcal O$, which is just $\{ x \in \mathcal O \mid \exists k \in \mathbf Z_{\geq 0} \colon x^k \in P\mathcal O \}$. It is not checked that $P$ is prime.

ring_of_multipliersMethod
ring_of_multipliers(I::NfAbsOrdIdl) -> NfAbsOrd

Computes the order $(I : I)$, which is the set of all $x \in K$ with $xI \subseteq I$.

## Invariants

discriminantMethod
discriminant(O::NfOrd) -> fmpz

Returns the discriminant of $\mathcal O$.

discriminant(E::EllCrv{T}) -> T

Compute the discriminant of $E$.

discriminant(C::HypellCrv{T}) -> T

Compute the discriminant of $C$.

discriminant(O::AlgssRelOrd)

Returns the discriminant of $O$.

discriminantMethod
discriminant(O::NfOrd) -> fmpz

Returns the discriminant of $\mathcal O$.

reduced_discriminantMethod
reduced_discriminant(O::NfOrd) -> fmpz

Returns the reduced discriminant, that is, the largest elementary divisor of the trace matrix of $\mathcal O$.

degreeMethod
degree(O::NumFieldOrd) -> Int

Returns the degree of $\mathcal O$.

indexMethod
index(O::NfOrd) -> fmpz

Assuming that the order $\mathcal O$ contains the equation order $\mathbf Z[\alpha]$ of the ambient number field, this function returns the index $[ \mathcal O : \mathbf Z]$.

differentMethod
different(R::NfAbsOrd) -> NfAbsOrdIdl

The differnt ideal of $R$, that is, the ideal generated by all differents of elements in $R$. For Gorenstein orders, this is also the inverse ideal of the co-different.

codifferentMethod
codifferent(R::NfAbsOrd) -> NfOrdIdl

The codifferent ideal of $R$, i.e. the trace-dual of $R$.

is_gorensteinMethod
is_gorenstein(O::NfOrd) -> Bool

Return whether the order \mathcal{O} is Gorenstein.

is_bassMethod
is_bass(O::NfOrd) -> Bool

Return whether the order \mathcal{O} is Bass.

is_equation_orderMethod
is_equation_order(O::NumFieldOrd) -> Bool

Returns whether $\mathcal O$ is the equation order of the ambient number field $K$.

zeta_log_residueMethod
zeta_log_residue(O::NfOrd, error::Float64) -> arb

Computes the residue of the zeta function of $\mathcal O$ at $1$. The output will be an element of type arb with radius less then error.

ramified_primesMethod
ramified_primes(O::NfAbsOrd) -> Vector{fmpz}

Returns the list of prime numbers that divide $\operatorname{disc}(\mathcal O)$.

## Arithmetic

Progress and intermediate results of the functions mentioned here can be obtained via verbose_level, supported are

• ClassGroup
• UnitGroup

All of the functions have a very similar interface: they return an abelian group and a map converting elements of the group into the objects required. The maps also allow a point-wise inverse to server as the discrete logarithm map. For more information on abelian group, see here, for ideals, here.

For the processing of units, there are a couple of helper functions also available:

is_independentFunction
is_independent{T}(x::Vector{T})

Given an array of non-zero units in a number field, returns whether they are multiplicatively independent.

## Predicates

is_containedMethod
is_contained(R::NfAbsOrd, S::NfAbsOrd) -> Bool

Checks if $R$ is contained in $S$.

is_maximalMethod
is_maximal(R::NfAbsOrd) -> Bool

Tests if the order $R$ is maximal. This might trigger the computation of the maximal order.