# Creation of Algebraic Function Fields and their Orders

## Creation of Algebraic Function Fields

### `ext< K | f >: FldFunRat, RngUPolElt -> FldFun`

### `ext< K | f >: FldFun, RngUPolElt -> FldFun`

### `FunctionField(f : parameters): RngUPolElt -> FldFun`

```magma
Check : BoolElt                    Default: true
Global: BoolElt                    Default: true
```

Let $k$ be a field and $K = k(x)$ or $K = k(x, \alpha_1, \ldots, \alpha_r)$ some finite extension of $k(x)$. Given an irreducible and separable polynomial $f \in K[y]$ of degree greater than zero with coefficients within $K$, create the algebraic function field $F= K[y] / \langle f \rangle = k(x, \alpha_1, \ldots, \alpha_r, \alpha)$ obtained by adjoining a root $\alpha$ of $f$ to $K$. $F$ will be viewed as a (finite) extension of $K$. The polynomial $f$ is also allowed to be $\in k[x][y]$.

The optional parameter `Check` may be used to prevent some conditions from being tested. The default is `Check := true`, so that $f$ is verified to be irreducible and separable. The optional parameter `Global` may be used to allow another copy of the field to be returned if it is set to `false`, otherwise if a field has already been constructed using $f$ over $K$ and has not been deleted then the existing field will be returned.

The angle bracket notation may be used to assign the root $\alpha$ to an identifier: `F<a> := FunctionField(f)`.

### `FunctionField(f : parameters): RngMPolElt -> FldFun`

```magma
Check : BoolElt                    Default: true
Global: BoolElt                    Default: true
```

Let $k$ be a field. Given an irreducible polynomial $f \in k[x, y]$ of degree greater than zero, create the algebraic function field $F$ which is the field of fractions of $k[x, y] / \langle f \rangle$. The polynomial $f$ must be separable in at least one variable. $F$ will be viewed as (infinite) extension of $k$.

The optional parameter `Check` may be used to prevent some conditions from being tested. The default is `Check := true`, so that $f$ is verified to be irreducible and separable in at least one variable. The optional parameter `Global` may be used to allow another copy of the field to be returned if it is set to `false`, otherwise if a field has already been constructed using $f$ over $K$ and has not been deleted then the existing field will be returned.

The angle bracket notation may be used to assign the images of $x,y$ in $F$ to identifiers: `F<a, b> := FunctionField(f)`.

### `FunctionField(S): [RngUPolElt] -> FldFun`

```magma
Check: BoolElt                    Default: true
```

Return the function field $F$ whose defining polynomials are the polynomials in the sequence $S$. If `Check` is set to `false` then it will not be checked the polynomials actually define a field.

### `HermitianFunctionField(p, d): RngIntElt, RngIntElt -> FldFun`

### `HermitianFunctionField(q): RngIntElt -> FldFun`

Create the Hermitian function field $F = {\bf F}_{q^2}(x, \alpha)$ defined by $\alpha^q + \alpha = x^{q+1}$, where $q$ is the $d$-th power of the prime number $p$.

### `sub<F | S>: FldFun, [] -> FldFun`

### `sub<F | s₁, ..., sᵣ >: FldFun, [] -> FldFun`

The subfield of the function field $F$ containing the elements in the sequence $S$ or the elements $s_i$.

### `AssignNames(~F, s): FldFun, [ MonStgElt ]`

### `AssignNames(~a, s): FldFunElt, [ MonStgElt ]`

Procedure to change the name of the generating element(s) in the function field $F$ ($a$ in $F$) to the contents of the sequence of strings $s$, which must have length $1$ or $2$ in this case.

This procedure only changes the name(s) used in printing the elements of $F$. It does *not* assign to any identifier(s) the value(s) of the generator(s) in $F$; to do this, use an assignment statement, or use angle brackets when creating the field.

Note that since this is a procedure that modifies $F$, it is necessary to have a reference `~F` to $F$ (or $a$) in the call to this function.

### `FunctionField(R): Rng -> FldFunG`

```magma
Global: BoolElt                    Default: true
Type  : Cat                        Default: FldFunRat
```

Return the rational function field over $R$ in one variable. If `Global` is `false` then create a new copy of the field, otherwise reuse any globally created field which already exists. If `Type` is `FldFun` create the field as an algebraic function field, otherwise create as a rational function field.

### `Example: Creation (ex-4f7d5b)`

Let ${\bf F}_{5}$ be the finite field of five elements. To create the function field extension ${\bf F}_{5}(x, \alpha) / {\bf F}_{5}(x)$, where $\alpha$ satisfies $\alpha^2 = 1/x,$ one may proceed in the following, equivalent ways:

```magma
> R<x> := FunctionField(GF(5));
> P<y> := PolynomialRing(R);
> F<alpha> := FunctionField(y^2 - 1/x);
> F;
Algebraic function field defined over Univariate rational function field over
GF(5)
Variables: x by
y^2 + 4/x

```

or

```magma
> R<x> := PolynomialRing(GF(5));
> P<y> := PolynomialRing(R);
> F<alpha> := FunctionField(x*y^2 - 1);
> F;
Algebraic function field defined over Univariate rational function field over
GF(5)
Variables: x by
x*y^2 + 4

```

or

```magma
> R<x> := FunctionField(GF(5));
> P<y> := PolynomialRing(R);
> F<alpha> := ext< R | y^2 - 1/x >;
> F;
Algebraic function field defined over Univariate rational function field over
GF(5)
Variables: x by
y^2 + 4/x

```

### `Example: Creation Rel (ex-b33520)`

An extension of $F$ may be created as follows.

```magma
> R<y> := PolynomialRing(F);
> FF<beta> := FunctionField(y^3 - x/alpha : Check := false);
> FF;
Algebraic function field defined over F by
y^3 + 4*x^2*alpha

```

### `Example: Creation Non Simple (ex-5f689c)`

To create a non–simple extension:

```magma
> R<x> := FunctionField(GF(5));
> P<y> := PolynomialRing(R);
> FF<alpha, beta> := FunctionField([y^2 - 1/x, y^3 + x]);
> FF;
Algebraic function field defined over Univariate rational function field over
GF(5) by
y^2 + 4/x
y^3 + x

```

or

```magma
> P<y> := PolynomialRing(F);
> FF<beta, gamma> := FunctionField([y^2 - x/alpha, y^3 + x]);
> FF;
Algebraic function field defined over F by
y^2 + 4*x^2*alpha
y^3 + x

```

### `Example: Creation Herm (ex-5c6691)`

The creation of an Hermitian function field:

```magma
> F := HermitianFunctionField(9);
> F;
Algebraic function field defined over GF(3^4) by
y^9 + y + 2*x^10

```

## Construction of Orders of Algebraic Function Fields

Equation orders, maximal orders and other orders of algebraic function fields can be constructed.

For more information about the Montes algorithm which can be used to compute maximal orders, see Section [The Montes Algorithm](montes.md#montes-fld-fun).

### `EquationOrderFinite(F): FldFun -> RngFunOrd`

Create the ‘finite’ equation order of the function field $F/k(x, \alpha_1, \ldots, \alpha_r)$, i.e. $k[x, d_1 \alpha_1, \ldots, d_r \alpha_r, d \alpha]$ where $d_j, d \in k[x]$ is chosen such that $d_j \alpha_j, d \alpha$ are integral over $k[x]$.

### `MaximalOrderFinite(F): FldFun -> RngFunOrd`

```magma
Al: MonStgElt                    Default: 
```

Construct the ‘finite’ maximal order of the function field $F/k(x, \alpha_1, \ldots, \alpha_r)$. This is the integral closure of $k[x, d_1 \alpha_1, \ldots, d_r \alpha_r]$ in $F$. If $F$ is an extension of a rational function field over ${\mathbb{Q}}$ or ${\mathbb{F}}_q$ by a single monic integral polynomial and the parameter `Al` is set to `"Montes"` then the Montes algorithm [[Stainsby, 2018](../../references.md#cite-2015arxiv150601904s)] will be used for the computation.

### `EquationOrderInfinite(F): FldFun -> RngFunOrd`

Create the ‘infinite’ equation order of the function field $F/k(x, \alpha_1, \ldots, \alpha_r)$, i.e. $o_{\infty}[\alpha_1, \ldots, \alpha_r, \beta]$ where $o_{\infty}$ denotes the valuation ring of the degree valuation in $k(x)$ and $\beta$ is a primitive element of $F/k(x, \alpha_1, \ldots, \alpha_r)$ which is integral over $o_{\infty}$.

### `MaximalOrderInfinite(F): FldFun -> RngFunOrd`

Create the ‘infinite’ maximal order of the function field $F/k(x, \alpha_1, \ldots, \alpha_r)$. This is the integral closure of $o_{\infty}$ in $F$.

### `IntegralClosure(R, F): Rng, FldFun -> RngFunOrd`

The integral closure of the subring $R$ of the function field $F$ in itself.

### `EquationOrder(O): RngFunOrd -> RngFunOrd`

The equation order of the order $O$. An order whose basis is a transformation of that of $O$ and is a power basis.

### `MaximalOrder(O): RngFunOrd -> RngFunOrd`

```magma
Discriminant: Any                             Default: 
Ramification: SeqEnum                         Default: 
Al          : MonStgElt                       Default: "Auto"
verbose     : MaximalOrder                    Default: Verbose : 5
```

The maximal order of the order $O$ of an algebraic function field.

If $O$ is a radical (pure) extension then specific code is used to calculate each $p$-maximal order, rather than the Round $2$ method. In this case we can compute a pseudo basis for the $p$-maximal orders knowing only the valuation of the constant coefficient of the defining polynomial at $p$ [[Sutherland, 2012](../../references.md#cite-suth-max-kummer)].

If $O$ is an Artin–Schreier extension then the maximal order can be computed directly without computing the $p$-maximal orders. The proof of Proposition III.7.8 of [[Stichtenoth, 1993](../../references.md#cite-stichtenoth)] gives us a start on some elements which are a basis for the maximal order [[Sutherland, 2013](../../references.md#cite-suth-artin)].

If the `Discriminant` or `Ramification` parameters are supplied an algorithm ([[Buchmann and Lenstra jr, 1994](../../references.md#cite-buchman-lenstra)], Theorems 1.2 and 7.6) which can compute the maximal order given the discriminant of the maximal order will be used. `Discriminant` must be an element of the coefficient ring of $O$ if $O$ is a non relative order and must be an ideal of $O$ if $O$ is a relative order. `Ramification` must contain elements of the coefficient ring if $O$ is a non relative order and must contain ideals of $O$ if $O$ is a relative order. The ramification sequence is taken to contain prime factors of the discriminant. Only one of these parameters can be specified and if one of them is then `Al` cannot be specified.

If $O$ is an extension of a polynomial ring over ${\mathbb{Q}}$ or ${\mathbb{F}}_q$ by a single monic integral polynomial and the parameter `Al` is set to `"Montes"` then the Montes algorithm [[Stainsby, 2018](../../references.md#cite-2015arxiv150601904s)] will be used to compute the maximal order. Otherwise `Al` may be set to `"Round2"` to avoid using the algorithms for the special cases above.

### `SetOrderMaximal(O, b): RngFunOrd, BoolElt`

Set the order $O$ of a function field to be maximal if $b$ is `true` and to be non–maximal if $b$ is `false`.

### `ext<O | f>: RngFunOrd, RngUPolElt -> RngFunOrd`

```magma
Check: Bool                    Default: true
```

The order $O$ with a root of $f$ adjoined.

### `Example: orders (ex-68faea)`

Creation of orders is shown below.

```magma
> PR<x> := PolynomialRing(Rationals());
> P<y> := PolynomialRing(PR);
> FR1<a> := FunctionField(y^3 - x*y^2 + y + x^4);
> P<y> := PolynomialRing(FR1);
> FR2<c> := FunctionField(y^2 + y - a/x^5);
> EFR1F := EquationOrderFinite(FR1);
> MFR1F := MaximalOrderFinite(FR1);
> EFR1I := EquationOrderInfinite(FR1);
> MFR1I := MaximalOrderInfinite(FR1);
> EFR2F := EquationOrderFinite(FR2);
> MFR2F := MaximalOrderFinite(FR2);
> EFR2I := EquationOrderInfinite(FR2);
> MFR2I := MaximalOrderInfinite(FR2);
> MaximalOrder(EFR2I);
>> MaximalOrder(EFR2I);
               ^
Runtime error in 'MaximalOrder': Order must be defined over a maximal order
> MFR2I;
Maximal Order of FR2 over MFR1I
> P<y> := PolynomialRing(FR1);
> MaximalOrder(ext<MFR1F | y^2 + y - a*x^5>); MFR2F;
Maximal Equation Order of Algebraic function field defined over FR1 by
y^2 + y - x^5*a over EFR1F
Maximal Order of FR2 over EFR1F
> MaximalOrder(ext<MFR1I | y^2 - 1/a>);
Maximal Order of Algebraic function field defined over FR1 by
y^2 + 1/x^4*a^2 - 1/x^3*a + 1/x^4 over MFR1I

```

### `Example: Int Cl (ex-4ba3aa)`

```magma
> R<x> := FunctionField(GF(5));
> P<y> := PolynomialRing(R);
> f := y^3 + (4*x^3 + 4*x^2 + 2*x + 2)*y^2 + (3*x + 3)*y + 2;
> F<alpha> := FunctionField(f);
> IntegralClosure(R, F);
Algebraic function field defined over GF(5) by
y^3 + (4*x^3 + 4*x^2 + 2*x + 2)*y^2 + (3*x + 3)*y + 2
> IntegralClosure(PolynomialRing(GF(5)), F);
Maximal Order of F over Univariate Polynomial Ring in x over GF(5)
> IntegralClosure(ValuationRing(R), F);
Maximal Order of F over Valuation ring of Rational function field of
rank 1 over GF(5)
Variables: x with generator 1/x

```

### `Order(O, T, d): RngFunOrd, AlgMatElt, RngElt -> RngFunOrd`

```magma
Check: BoolElt                    Default: true
```

Create the order whose basis is that of the order $O$ multiplied by the matrix $T$ over the coefficient ring of $O$ divided by the scalar $d$. If the parameter `Check` is set to `false` then it will not be checked that the result is actually an order (potentially expensive). Note that this can result in a non-order being constructed which may cause errors later.

### `Order(O, M): RngFunOrd, ModDed -> RngFunOrd`

```magma
NFBasis: BoolElt                    Default: true
Check  : BoolElt                    Default: true
```

Create the order whose basis is that of the order $O$ multiplied by the dedekind module $M$. If the parameter `Check` is set to `false` then it will not be checked that the result is actually an order (potentially expensive). Note that this can result in a non-order being constructed which may cause errors later. If the parameter `NFBasis` is set to `false` then the `PseudoGenerators` of the module $M$ will be used rather than the `PseudoBasis`, however these pseudo generators must also be a pseudo basis.

### `Order(O, S): RngFunOrd, [FldFunElt] -> RngFunOrd`

```magma
Verify : BoolElt                    Default: true
IsBasis: BoolElt                    Default: false
```

Given a sequence $S$ of elements in an algebraic function field $F$ create the minimal order $R$ of $F$ which contains all elements of $S$.

The order $O$ may be an order of $F$ which will be used as the suborder of $R$, in which case its coefficient ring should be maximal, or $O$ may be a maximal order of the coefficient field of $F$.

If `Verify` is `true`, it is verified that the elements of $S$ are integral algebraic numbers. This can be a lengthy process if the field is of large degree.

Setting `IsBasis` to `true` assumes that the given elements actually form a basis for the new order, thus it avoids testing for multiplicative closure. Without this parameter the order returned will have a canonical basis chosen with no direct relation to the input. By default, products of the generators will be added until the module is closed under multiplication. Note that setting `IsBasis` to `true` can result in a non-order being constructed if the elements in the sequence are not a basis which may cause errors later.

If `IsBasis` is set to `true` to specify the basis of the resulting order rather than avoid the expense of the multiplicative closure computation, it can be checked that the result $O$ is an order using `Order(SubOrder(O), Matrix(CoefficientRing(O), M*d), d) where d is Denominator(M) where M is BasisMatrix(O);`. If $O$ is not an order this will cause an error.

### `Simplify(O): RngFunOrd -> RngFunOrd`

Return the order $O$ as a direct transformation of its equation order, instead of a composition of transformations.

### `O1 + O2: RngFunOrd, RngFunOrd -> RngFunOrd`

The smallest common over order of $O1$ and $O2$ where $O1$ and $O2$ have the same equation order.

### `O1 meet O2: RngFunOrd, RngFunOrd -> RngFunOrd`

The intersection of orders $O1$ and $O2$ which must have the same equation order.

### `AsExtensionOf(O1, O2): RngFunOrd, RngFunOrd -> RngFunOrd`

Return the order $O1$ as a transformation of the order $O2$ where $O1$ and $O2$ have the same coefficient ring.

### `Example: Order Create More (ex-b548f7)`

Some of the above order creations are shown below.

```magma
> P<x> := PolynomialRing(GF(5));
> P<y> := PolynomialRing(P);
> F<a> := FunctionField(y^3 - x^4);
> O := Order(EquationOrderFinite(F), MatrixAlgebra(Parent(x), 3)!1, Parent(x)!3);
> O;
Order of F over Univariate Polynomial Ring in x over GF(5)
> Basis(O);
[
    2,
    2*a,
    2*a^2
]
> P<y> := PolynomialRing(O);
> EO := ext<MaximalOrder(O) | y^2 + O!(2*a)>;
> V := KModule(F, 2);
> M := Module([V | [1, 0], [4, 3], [9, 2]]);
> M;
Module over Maximal Order of F over Univariate Polynomial Ring in x over GF(5)
Ideal of Maximal Order of F over Univariate Polynomial Ring in x over GF(5)
Generator:
1 car Ideal of Maximal Order of F over Univariate Polynomial Ring in x over
GF(5)
Generator:
2
> O2 := Order(EO, M);
> O2;
Order of Algebraic function field defined over F by
$.1^2 + 2*a over Maximal Order of F over Univariate Polynomial Ring in x over
GF(5)
Transformation of EO

Transformation Matrix:
[[ 1, 0, 0 ] [ 0, 0, 0 ]]
[[ 0, 0, 0 ] [ 1, 0, 0 ]]
> Basis(O2);
[ 1, $.1 ]

```

## Orders and Ideals

Orders may be created using ideals of other orders. Ideals are discussed in Section [Ideals](ideals.md#fldfung-ideals).

### `MultiplicatorRing(I): RngFunOrdIdl -> RngFunOrd`

Returns the multiplicator ring of the ideal $I$ of the order $O$, that is, the subring of elements of the field of fractions of $O$ that multiply $I$ into itself.

### `pMaximalOrder(O, p): RngFunOrd, RngFunOrdIdl -> RngFunOrd`

### `pMaximalOrder(O, p): RngFunOrd, RngElt -> RngFunOrd`

The $p$-maximal over order of $O$ where $p$ is a prime polynomial or ideal of the coefficient ring of $O$ or an element of valuation $1$ of the valuation ring.

If $O$ is a Kummer extension then specific code is used to calculate each $p$-maximal order, rather than the Round $2$ method. In this case we know $1$ or $2$ elements which generate the $p$-maximal order and can write the order down.

If $O$ is an Artin–Schreier extension then we can also write down a basis for the $p$-maximal order and avoid the Round $2$ algorithm. We use [[Stichtenoth, 1993](../../references.md#cite-stichtenoth)] Proposition III.7.8 to get a start on computing these elements.

### `pRadical(O, p): RngFunOrd, RngFunOrdIdl -> RngFunOrdIdl`

### `pRadical(O, p): RngFunOrd, RngElt -> RngFunOrdIdl`

Returns the $p$-radical of an order $O$ for a prime $p$ (polynomial or ideal of the coefficient ring or element of valuation $1$ of the valuation ring), defined as the ideal consisting of elements of $O$ for which some power lies in the ideal $pO$.

It is possible to call this function even if $p$ is not prime. In this case the $p$-trace-radical will be computed, i.e.

$$
\{ x\in F \mid {\operatorname{Tr}}(xO)\subseteq C\}
$$

for F the field of fractions of $O$ and $C$ the order of $p$ (if $p$ is an ideal) or the parent of $p$ otherwise. If $p$ is square free and all divisors are larger than the field degree, this is the intersection of the radicals for all $l$ dividing $p$.
