# Number field operations

## Creation of number fields

General number fields can be created using the function NumberField, of which number_field is an alias. To create a simple number field given by a defining polynomial or a non-simple number field given by defining polynomials, the following functions can be used.

NumberFieldMethod
NumberField(f::Poly{NumFieldElem}, s::String;
cached::Bool = false, check::Bool = false) -> NumField, NumFieldElem

Given an irreducible polynomial $f \in K[x]$ over some number field $K$, this function creates the simple number field $L = K[x]/(f)$ and returns $(L, b)$, where $b$ is the class of $x$ in $L$. The string s is used only for printing the primitive element $b$.

• check: Controls whether irreducibility of $f$ is checked.
• cached: Controls whether the result is cached.

Examples

julia> K, a = quadratic_field(5);

julia> Kt, t = K["t"];

julia> L, b = NumberField(t^3 - 3, "b");
NumberFieldMethod
NumberField(f::Vector{PolyElem{<:NumFieldElem}}, s::String="_\$", check = true) -> NumField, Vector{NumFieldElem} Given a list$f_1, \ldots, f_n$of univariate polynomials in$K[x]$over some number field$K$, constructs the extension$K[x_1, \ldots, x_n]/(f_1(x_1), \ldots, f_n(x_n))$. Examples julia> Qx, x = QQ["x"]; julia> K, a = NumberField([x^2 - 2, x^2 - 3], "a") (Non-simple number field with defining polynomials fmpq_mpoly[x1^2 - 2, x2^2 - 3], NfAbsNSElem[a1, a2]) Tip Many of the constructors have arguments of type Symbol or AbstractString. If used, they define the appearance in printing, and printing only. The named parameter check can be true or false, the default being true. This parameter controls whether the polynomials defining the number field are tested for irreducibility or not. Given that this can be potentially very time consuming if the degree if large, one can disable this test. Note however, that the behaviour of Hecke is undefined if a reducible polynomial is used to define a field. The named boolean parameter cached can be used to disable caching. Two number fields defined using the same polynomial from the identical polynomial ring and the same (identical) symbol/string will be identical if cached == true and different if cached == false. For frequently used number fields like quadratic fields, cyclotomic fields or radical extensions, the following functions are provided: cyclotomic_fieldMethod cyclotomic_field(n::Int) -> AnticNumberField, nf_elem The cyclotomic field defined by the$n$-th cyclotomic polynomial. Examples julia> cyclotomic_field(10) (Cyclotomic field of order 10, z_10) quadratic_fieldMethod quadratic_field(d::IntegerUnion) -> AnticNumberField, nf_elem Returns the field with defining polynomial$x^2 - d$. Examples julia> quadratic_field(5) (Real quadratic field defined by x^2 - 5, sqrt(5)) wildanger_fieldMethod wildanger_field(n::Int, B::fmpz) -> AnticNumberField, nf_elem Returns the field with defining polynomial$x^n + \sum_{i=0}^{n-1} (-1)^{n-i}Bx^i$. These fields tend to have non-trivial class groups. Examples julia> wildanger_field(3, ZZ(10), "a") (Number field over Rational Field with defining polynomial x^3 - 10*x^2 + 10*x - 10, a) radical_extensionMethod radical_extension(n::Int, a::NumFieldElem, s = "_$";
check = true, cached = true) -> NumField, NumFieldElem

Given an element $a$ of a number field $K$ and an integer $n$, create the simple extension of $K$ with the defining polynomial $x^n - a$.

Examples

julia> radical_extension(5, QQ(2), "a")
(Number field over Rational Field with defining polynomial x^5 - 2, a)
rationals_as_number_fieldMethod
rationals_as_number_field() -> AnticNumberField, nf_elem

Returns the rational numbers as the number field defined by $x - 1$.

Examples

julia> rationals_as_number_field()
(Number field over Rational Field with defining polynomial x - 1, 1)

## Basic properties

basisMethod
basis(L::SimpleNumField) -> Vector{NumFieldElem}

Return the canonical basis of a simple extension $L/K$, that is, the elements $1,a,\dotsc,a^{d - 1}$, where $d$ is the degree of $K$ and $a$ the primitive element.

Examples

julia> Qx, x = QQ["x"];

julia> K, a = NumberField(x^2 - 2, "a");

julia> basis(K)
2-element Vector{nf_elem}:
1
a
basisMethod
basis(L::NonSimpleNumField) -> Vector{NumFieldElem}

Returns the canonical basis of a non-simple extension $L/K$. If $L = K(a_1,\dotsc,a_n)$ where each $a_i$ has degree $d_i$, then the basis will be $a_1^{i_1}\dotsm a_d^{i_d}$ with $0 \leq i_j \leq d_j - 1$ for $1 \leq j \leq n$.

Examples

julia> Qx, x = QQ["x"];

julia> K, (a1, a2) = NumberField([x^2 - 2, x^2 - 3], "a");

julia> basis(K)
4-element Vector{NfAbsNSElem}:
1
a1
a2
a1*a2
absolute_basisMethod
absolute_basis(K::NumField) -> Vector{NumFieldElem}

Returns an array of elements that form a basis of $K$ (as a vector space) over the rationals.

defining_polynomialMethod
defining_polynomial(L::SimpleNumField) -> PolyElem

Given a simple number field $L/K$, constructed as $L = K[x]/(f)$, this function returns $f$.

defining_polynomialsMethod
defining_polynomials(L::NonSimpleNumField) -> Vector{PolyElem}

Given a non-simple number field $L/K$, constructed as $L = K[x]/(f_1,\dotsc,f_r)$, return the vector containing the $f_i$'s.

absolute_primitive_elementMethod
absolute_primitive_element(K::NumField) -> NumFieldElem

Given a number field $K$, this function returns an element $\gamma \in K$ such that $K = \mathbf{Q}(\gamma)$.

componentMethod
component(L::NonSimpleNumField, i::Int) -> SimpleNumField, Map

Given a non-simple extension $L/K$, this function returns the simple number field corresponding to the $i$-th component of $L$ together with its embedding.

base_fieldMethod
base_field(L::NumField) -> NumField

Given a number field $L/K$ this function returns the base field $K$. For absolute extensions this returns $\mathbf{Q}$.

## Invariants

degreeMethod
degree(L::NumField) -> Int

Given a number field $L/K$, this function returns the degree of $L$ over $K$.

Examples

julia> Qx, x = QQ["x"];

julia> K, a = NumberField(x^2 - 2, "a");

julia> degree(K)
2
absolute_degreeMethod
absolute_degree(L::NumField) -> Int

Given a number field $L/K$, this function returns the degree of $L$ over $\mathbf Q$.

signatureMethod
signature(K::NumField)

Return the signature of the number field of $K$.

Examples

julia> Qx, x = QQ["x"];

julia> K, a = NumberField(x^2 - 2, "a");

julia> signature(K)
(2, 0)
unit_group_rankMethod
unit_group_rank(K::NumField) -> Int

Return the rank of the unit group of any order of $K$.

class_numberMethod
class_number(K::AnticNumberField) -> fmpz

Returns the class number of $K$.

relative_class_numberMethod
relative_class_number(K::AnticNumberField) -> fmpz

Returns the relative class number of $K$. The field must be a CM-field.

regulatorMethod
regulator(K::AnticNumberField)

Computes the regulator of $K$, i.e. the discriminant of the unit lattice for the maximal order of $K$.

discriminantMethod
discriminant(L::SimpleNumField) -> NumFieldElem

The discriminant of the defining polynomial of $L$, not the discriminant of the maximal order of $L$.

absolute_discriminantMethod
absolute_discriminant(L::SimpleNumField, QQ) -> fmpq

The absolute discriminant of the defining polynomial of $L$, not the discriminant of the maximal order of $L$. This is the norm of the discriminant times the $d$-th power of the discriminant of the base field, where $d$ is the degree of $L$.

## Predicates

is_simpleMethod
is_simple(L::NumField) -> Bool

Given a number field $L/K$ this function returns whether $L$ is simple, that is, whether $L/K$ is defined by a univariate polynomial.

is_absoluteMethod
is_absolute(L::NumField) -> Bool

Returns whether $L$ is an absolute extension, that is, whether the base field of $L$ is $\mathbf{Q}$.

is_totally_realMethod
is_totally_real(K::NumberField) -> Bool

Returns true if and only if $K$ is totally real, that is, if all roots of the defining polynomial are real.

is_totally_complexMethod
is_totally_complex(K::AnticNumberField) -> Bool

Returns true if and only if $K$ is totally complex, that is, if all roots of the defining polynomial are not real.

is_cm_fieldMethod
is_cm_field(K::AnticNumberField) -> Bool, NfToNfMor

Given a number field $K$, this function returns true and the complex conjugation if the field is CM, false and the identity otherwise.

is_kummer_extensionMethod
is_kummer_extension(L::SimpleNumField) -> Bool

Tests if $L/K$ is a Kummer extension, that is, if the defining polynomial is of the form $x^n - b$ for some $b \in K$ and if $K$ contains the $n$-th roots of unity.

is_radical_extensionMethod
is_radical_extension(L::SimpleNumField) -> Bool

Tests if $L/K$ is pure, that is, if the defining polynomial is of the form $x^n - b$ for some $b \in K$.

is_linearly_disjointMethod
is_linearly_disjoint(K::SimpleNumField, L::SimpleNumField) -> Bool

Given two number fields $K$ and $L$ with the same base field $k$, this function returns whether $K$ and $L$ are linear disjoint over $k$.

is_weakly_ramifiedMethod
is_weakly_ramified(K::AnticNumberField, P::NfOrdIdl) -> Bool

Given a prime ideal $P$ of a number field $K$, return whether $P$ is weakly ramified, that is, whether the second ramification group is trivial.

is_tamely_ramifiedMethod
is_tamely_ramified(K::AnticNumberField) -> Bool

Returns whether the number field $K$ is tamely ramified.

is_tamely_ramifiedMethod
is_tamely_ramified(O::NfOrd, p::Union{Int, fmpz}) -> Bool

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

is_abelianMethod
is_abelian(L::NumField) -> Bool

Check if the number field $L/K$ is abelian over $K$. The function is probabilistic and assumes GRH.

### Subfields

is_subfieldMethod
is_subfield(K::SimpleNumField, L::SimpleNumField) -> Bool, Map

Return true and an injection from $K$ to $L$ if $K$ is a subfield of $L$. Otherwise the function returns false and a morphism mapping everything to $0$.

subfieldsMethod
subfields(L::SimpleNumField) -> Vector{Tuple{NumField, Map}}

Given a simple extension $L/K$, returns all subfields of $L$ containing $K$ as tuples $(k, \iota)$ consisting of a simple extension $k$ and an embedding $\iota k \to K$.

principal_subfieldsMethod
principal_subfields(L::SimpleNumField) -> Vector{Tuple{NumField, Map}}

Return the principal subfields of $L$ as pairs consisting of a subfield $k$ and an embedding $k \to L$.

compositumMethod
compositum(K::AnticNumberField, L::AnticNumberField) -> AnticNumberField, Map, Map

Assuming $L$ is normal (which is not checked), compute the compositum $C$ of the 2 fields together with the embedding of $K \to C$ and $L \to C$.

embeddingMethod
embedding(k::NumField, K::NumField) -> Map

Assuming $k$ is known to be a subfield of $K$, return the embedding map.

normal_closureMethod
normal_closure(K::AnticNumberField) -> AnticNumberField, NfToNfMor

The normal closure of $K$ together with the embedding map.

relative_simple_extensionMethod
relative_simple_extension(K::NumField, k::NumField) -> NfRel

Given two fields $K\supset k$, it returns $K$ as a simple relative extension $L$ of $k$ and an isomorphism $L \to K$.

is_subfield_normalMethod
  is_subfield_normal(K::AnticNumberField, L::AnticNumberField) -> Bool, NfToNfMor

Returns true and an injection from $K$ to $L$ if $K$ is a subfield of $L$. Otherwise the function returns "false" and a morphism mapping everything to 0.

This function assumes that $K$ is normal.

## Conversion

simplifyMethod
simplify(K::AnticNumberField; canonical::Bool = false) -> AnticNumberField, NfToNfMor

Tries to find an isomorphic field $L$ given by a "simpler" defining polynomial. By default, "simple" is defined to be of smaller index, testing is done only using a LLL-basis of the maximal order.

If canonical is set to true, then a canonical defining polynomial is found, where canonical is using the definition of PARI's polredabs, which is described in http://beta.lmfdb.org/knowledge/show/nf.polredabs.

Both versions require a LLL reduced basis for the maximal order.

absolute_simple_fieldMethod
absolute_simple_field(K::NumField) -> NumField, Map

Given a number field $K$, this function returns an absolute simple number field $M/\mathbf{Q}$ together with a $\mathbf{Q}$-linear isomorphism $M \to K$.

simple_extensionMethod
simple_extension(L::NonSimpleNumField) -> SimpleNumField, Map

Given a non-simple extension $L/K$, this function computes a simple extension $M/K$ and a $K$-linear isomorphism $M \to L$.

simplified_simple_extensionMethod
simplified_simple_extension(L::NonSimpleNumField) -> SimpleNumField, Map

Given a non-simple extension $L/K$, this function returns an isomorphic simple number field with a "small" defining equation together with the isomorphism.

## Morphisms

is_isomorphicMethod
is_isomorphic(K::SimpleNumField, L::SimpleNumField) -> Bool

Return true if $K$ and $L$ are isomorphic, otherwise false.

is_isomorphic_with_mapMethod
is_isomorphic_with_map(K::SimpleNumField, L::SimpleNumField) -> Bool, Map

Return true and an isomorphism from $K$ to $L$ if $K$ and $L$ are isomorphic. Otherwise the function returns false and a morphism mapping everything to $0$.

is_involutionMethod
is_involution(f::NfToNfMor) -> Bool

Returns true if $f$ is an involution, i.e. if $f^2$ is the identity, false otherwise.

fixed_fieldMethod
fixed_field(K::SimpleNumField,
sigma::Map;
simplify::Bool = true) -> NumberField, NfToNfMor

Given a number field $K$ and an automorphism $\sigma$ of $K$, this function returns the fixed field of $\sigma$ as a pair $(L, i)$ consisting of a number field $L$ and an embedding of $L$ into $K$.

By default, the function tries to find a small defining polynomial of $L$. This can be disabled by setting simplify = false.

automorphism_listMethod
automorphism_list(L::NumField) -> Vector{NumFieldMor}

Given a number field $L/K$, return a list of all $K$-automorphisms of $L$.

automorphism_groupMethod
automorphism_group(K::NumField) -> GenGrp, GrpGenToNfMorSet

Given a number field $K$, this function returns a group $G$ and a map from $G$ to the automorphisms of $K$.

complex_conjugationMethod
complex_conjugation(K::AnticNumberField)

Given a totally complex normal number field, this function returns an automorphism which is the restriction of complex conjugation at one embedding.

## Galois theory

normal_basisMethod
normal_basis(L::NumField) -> NumFieldElem

Given a normal number field $L/K$, this function returns an element $a$ of $L$, such that the orbit of $a$ under the Galois group of $L/K$ is an $K$-basis of $L$.

decomposition_groupMethod
decomposition_group(K::AnticNumberField, P::NfOrdIdl, m::Map)
-> Grp, GrpToGrp

Given a prime ideal $P$ of a number field $K$ and a map m return from automorphism_group(K), return the decompositon group of $P$ as a subgroup of the domain of m.

ramification_groupMethod
ramification_group(K::AnticNumberField, P::NfOrdIdl, m::Map) -> Grp, GrpToGrp

Given a prime ideal $P$ of a number field $K$ and a map m return from automorphism_group(K), return the ramification group of $P$ as a subgroup of the domain of m.

inertia_subgroupMethod
inertia_subgroup(K::AnticNumberField, P::NfOrdIdl, m::Map) -> Grp, GrpToGrp

Given a prime ideal $P$ of a number field $K$ and a map m return from automorphism_group(K), return the intertia subgroup of $P$ as a subgroup of the domain of m.

## Infinite places

infinite_placesMethod
infinite_places(K::NumField) -> Vector{Plc}

This function returns all infinite places of $K$.

Examples

julia> Qx, x = QQ["x"];

julia> K, a = NumberField(x^2 - 2, "a");

julia> infinite_places(K)
2-element Vector{InfPlc}:
Real place of
Number field over Rational Field with defining polynomial x^2 - 2
corresponding to the root [-1.414213562373095049 +/- 3.90e-19]
Real place of
Number field over Rational Field with defining polynomial x^2 - 2
corresponding to the root [1.414213562373095049 +/- 3.90e-19]
real_placesMethod
real_places(K::AnticNumberField) -> Vector{InfPlc}

This function returns all infinite real places of $K$.

complex_placesMethod
complex_places(K::AnticNumberField) -> Vector{InfPlc}

This function returns all infinite complex places of $K$.

isrealMethod
isreal(P::Plc)

Return whether the embedding into $\mathbf{C}$ defined by $P$ is real or not.

is_complexMethod
is_complex(P::Plc) -> Bool

Return whether the embedding into $\mathbf{C}$ defined by $P$ is complex or not.

infinite_places_uniformizersMethod
infinite_places_uniformizers(K::AnticNumberField)

Returns a dictionary having as keys the real places of $K$ and the values are uniformizers for the corresponding real place. A uniformizer of a real place $P$ is an element of the field which is negative at $P$ and positive at all the other real places.

## Miscellaneous

norm_equationMethod
norm_equation(K::AnticNumerField, a) -> nf_elem

For $a$ an integer or rational, try to find $T \in K$ s.th. $N(T) = a$. Raises an error if unsuccessful.

lorenz_moduleMethod
lorenz_module(k::AnticNumberField, n::Int) -> NfOrdIdl

Finds an ideal $A$ s.th. for all positive units $e = 1 \bmod A$ we have that $e$ is an $n$-th power. Uses Lorenz, number theory, 9.3.1. If containing is set, it has to be an integral ideal. The resulting ideal will be a multiple of this.

kummer_failureMethod
kummer_failure(x::nf_elem, M::Int, N::Int) -> Int

Computes the quotient of $N$ and $[K(\zeta_M, \sqrt[N](x))\colon K(\zeta_M)]$, where $K$ is the field containing $x$ and $N$ divides $M$.