# Maximal Orders

## Ideals

inv(A::NfMaxOrdIdl) -> NfMaxOrdFracIdl


Computes the inverse of A, that is, the fractional ideal $B$ such that $AB = \mathcal O_K$.

valuation(a::nf_elem, p::NfMaxOrdIdl) -> fmpz
valuation(a::NfOrdElem, p::NfMaxOrdIdl) -> fmpz
valuation(a::fmpz, p::NfMaxOrdIdl) -> fmpz


Computes the $\mathfrak p$-adic valuation of $a$, that is, the largest $i$ such that $a$ is contained in $\mathfrak p^i$.

valuation(A::NfMaxOrdIdl, p::NfMaxOrdIdl) -> fmpz


Computes the $\mathfrak p$-adic valuation of $A$, that is, the largest $i$ such that $A$ is contained in $\mathfrak p^i$.

isramified(O::NfMaxOrd, p::Int) -> Bool


Returns whether the integer $p$ is ramified in $\mathcal O$. It is assumed that $p$ is prime.

prime_decomposition(O::NfMaxOrd,
p::Integer,
degree_limit::Int = 0,
lower_limit::Int = 0) -> Array{Tuple{NfMaxOrdIdl, Int}, 1}


Returns an array of tuples $(\mathfrak p_i,e_i)$ such that $p \mathcal O$ is the product of the $\mathfrak p_i^{e_i}$ and $\mathfrak p_i \neq \mathfrak p_j$ for $i \neq j$.

If degree_limit is a nonzero integer $k > 0$, then only those prime ideals $\mathfrak p$ with $\deg(\mathfrak p) \leq k$ will be returned. Similarly if \lower_limit is a nonzero integer $l > 0$, then only those prime ideals $\mathfrak p$ with $l \leq \deg(\mathfrak p)$ will be returned. Note that in this case it may happen that $p\mathcal O$ is not the product of the $\mathfrak p_i^{e_i}$.

prime_ideals_up_to(O::NfMaxOrd,
B::Int;
degree_limit::Int = 0) -> Array{NfMaxOrdIdl, 1}


Computes the prime ideals $\mathcal O$ with norm up to $B$.

If degree_limit is a nonzero integer $k$, then prime ideals $\mathfrak p$ with $\deg(\mathfrak p) > k$ will be discarded.

factor(A::NfMaxOrdIdl) -> Dict{NfMaxOrdIdl, Int}


Computes the prime ideal factorization $A$ as a dictionary, the keys being the prime ideal divisors: If lp = factor_dict(A), then keys(lp) are the prime ideal divisors of A and lp[P] is the P-adic valuation of A for all P in keys(lp).

divexact(A::NfMaxOrdIdl, y::fmpz) -> NfMaxOrdIdl


Returns $A/y$ assuming that $A/y$ is again an integral ideal.

divexact(A::NfMaxOrdIdl, B::NfMaxOrdIdl) -> NfMaxOrdIdl


Returns $AB^{-1}$ assuming that $AB^{-1}$ is again an integral ideal.

## Fractional ideals

*(I::NfMaxOrdFracIdl, J::NfMaxOrdFracIdl) -> NfMaxOrdFracIdl


Returns $IJ$.

inv(A::NfMaxOrdFracIdl) -> NfMaxOrdFracIdl


Returns the fractional ideal $B$ such that $AB = \mathcal O$.

## Class and unit group

unit_rank(O::NfOrd) -> Int


Returns the unit rank of $\mathcal O$, that is, the rank of the unit group $\mathcal O^\times$.

is_unit(x::NfOrdElem) -> Bool


Returns whether $x$ is invertible or not.

is_torsion_unit(x::NfOrdElem, checkisunit::Bool = false) -> Bool


Returns whether $x$ is a torsion unit, that is, whether there exists $n$ such that $x^n = 1$.

If checkisunit is true, it is first checked whether $x$ is a unit of the maximal order of the number field $x$ is lying in.

torsion_units(O::NfOrd) -> Array{NfOrdElem, 1}


Given an order $O$, compute the torsion units of $O$.

torsion_units(O::NfOrd) -> NfOrdElem


Given an order $O$, compute a generator of the torsion units of $O$.

unit_group(O::NfMaxOrd) -> Map


Returns an isomorphism map $f \colon A \to \mathcal O^\times$. Let A = domain(f). Then a set of fundamental units of $\mathcal O$ can be obtained via [ f(A[i]) for i in 1:unit_rank(O) ].