# Introduction

This chapter deals with (general) number fields, and orders and ideals in number fields.

Special types of number fields (quadratic and cyclotomic) have special features described in the corresponding chapters ([Quadratic Fields](../QuadraticFields/index-quadratic-fields.md#chapfldquad) and [Cyclotomic Fields](../CyclotomicFields/index-cyclotomic-fields.md#chapfldcyc)). All the general features here apply to those types too.

## Types

Number fields have type `FldNum`, with subtypes `FldQuad` and `FldCyc`. Their orders have types `RngOrd`, `RngQuad`, `RngCyc` respectively. The `FieldOfFractions` of an order is not the number field, rather it is an isomorphic field that has the same basis as the order (for speed); it has type `FldOrd`. The container type `FldAlg` is the union of `FldNum` and `FldOrd` (this is used in signatures that allow both).

Elements in fields and orders have corresponding types: `FldNumElt`, `FldAlgElt`, `RngQuadElt` and so on.

Extended types are used to indicate the coefficient ring (i.e. base ring). An absolute extension is a `FldNum[FldRat]`, a relative extension is a `FldNum[FldNum]`, similarly for `RngOrd[RngInt]` and so on.

The `RationalField()` is *not* a number field (`FldRat` is not a subtype of `FldNum`). However, one can create `RationalsAsNumberField()`.

A number field (`FldNum`) is an algebraic extension of finite degree over a base field, which may be a number field $k$ or ${\mathbb{Q}}$. It is constructed as $K = k[t]/(f(t))$ where $f$ is an irreducible polynomial in $k[t]$. A field may also be constructed as a multivariate quotient $K = k[s_1,\ldots,s_n]/(f_1(s_1), \ldots, f_n(s_n))$ where each polynomial is univariate (although the internal representation of this is as a tower of extensions).

Orders can be constructed in two main ways:

- as finite extensions $E$ of a (maximal) order $m$ (or of ${\mathbb{Z}}$) by adjoining a root of a monic integral polynomial $f \in m[t]$

- as a transformation (i.e. change of basis) of another order.

The main restriction for the construction of orders is that the coefficient domain ([`BaseRing`](operation.md#function-rngord-basering)) must always be a maximal order if any structural computations are desired. An order $O$ over some maximal order $m$ is represented using a (pseudo) $m$-basis (of type [Pseudo Matrices](../../Modules/ModulesOverDedekindDomains/pmat.md#pmat) similar to the way modules over Dedekind rings (`ModDed`, [Pseudo Matrices](../../Modules/ModulesOverDedekindDomains/pmat.md#pmat)) are represented in general. Every other order must be free over its base ring.

An order $O$ is equipped with a unique field of fractions, [`FieldOfFractions`](creation.md#function-rngord-fieldoffractions)`(O)`, which has the same basis as the order and whose base field is the field of fractions of the base ring. The field of fractions exists to serve as the parent of fields elements represented in that basis, and support fractional ideals.

An proper ideal of an order has type `RngOrdIdl`, a fractional ideal has type `RngOrdIdlFrac`. An ideal does not play the role of parent to elements in it (their parent is the order or the field of fractions); in particular, there is no coercion of elements into ideals. Sometimes one needs the parent structure of all ideals or all fractional ideals: these are created by `PowerIdeal` of the `RngOrd` or the `FldOrd`.

The conventions regarding the basis of an order can be confusing. For relative extensions, an order $O$ is not necessarily a free module over its base ring $R$ and therefore a relative integral basis may not exist [[Pohst, n.d.](../../references.md#cite-po64)]. Therefore, the module structure of $O$ over $R$ is given by `PseudoBasis(Module(O))` which consists of `Basis(O)` together with `CoefficientIdeals(O)`. The elements in `Basis(O)` are not necessarily contained in $O$; their parent is always `FieldOfFractions(O)`, which has the same basis. Note that `O.i` is `Basis(O)[i]`. For an element $x$ of $O$, `Eltseq(x)` returns a sequence of coefficients giving $x$ in terms of the basis – these coefficients are elements of `FieldOfFractions(R)`.

In this chapter, the phrase *algebraic field* will refer to a `FldAlg`, i.e. either a number field (`FldNum`) or a field of fractions (`FldOrd`).
