Fields are important algebraic domains. Mathematically a **field** is a
commutative ring *F* (see chapter Rings), such that every element
except *0* has a multiplicative inverse. Thus *F* has two operations `+`

and `*`

called addition and multiplication. *(F,+)* must be an abelian
group, whose identity is called *0 _{F}*.

**GAP3** supports the field of rationals (see Rationals), subfields of
cyclotomic fields (see Subfields of Cyclotomic Fields), and finite
fields (see Finite Fields).

This chapter begins with sections that describe how to test whether a domain is a field (see IsField), how to find the smallest field and the default field in which a list of elements lies (see Field and DefaultField), and how to view a field over a subfield (see Fields over Subfields).

The next sections describes the operation applicable to field elements (see Comparisons of Field Elements and Operations for Field Elements).

The next sections describe the functions that are applicable to fields (see GaloisGroup) and their elements (see Conjugates, Norm, Trace, CharPol, and MinPol).

The following sections describe homomorphisms of fields (see Field Homomorphisms, IsFieldHomomorphism, KernelFieldHomomorphism, Mapping Functions for Field Homomorphisms).

The last section describes how fields are represented internally (see Field Records).

Fields are domains, so all functions that are applicable to all domains are also applicable to fields (see chapter Domains).

All functions for fields are in `LIBNAME/"field.g"`

.

- IsField
- Field
- DefaultField
- Fields over Subfields
- Comparisons of Field Elements
- Operations for Field Elements
- GaloisGroup
- MinPol
- CharPol
- Norm
- Trace
- Conjugates
- Field Homomorphisms
- IsFieldHomomorphism
- KernelFieldHomomorphism
- Mapping Functions for Field Homomorphisms
- Field Records

`IsField( `

`D` )

`IsField`

returns `true`

if the object `D` is a field and `false`

otherwise.

More precisely `IsField`

tests whether `D` is a field record (see Field
Records). So, for example, a matrix group may in fact be a field, yet
`IsField`

would return `false`

.

gap> IsField( GaloisField(16) ); true gap> IsField( CyclotomicField(9) ); true gap> IsField( rec( isDomain := true, isField := true ) ); true # it is possible to fool`IsField`

gap> IsField( AsRing( Rationals ) ); false # though this ring is, as a set, still`Rationals`

`Field( `

`z`,.. )`Field( `

`list` )

In the first form `Field`

returns the smallest field that contains all
the elements `z`,.. etc. In the second form `Field`

returns the smallest
field that contains all the elements in the list `list`. If any element
is not an element of a field or the elements lie in no common field an
error is raised.

gap> Field( Z(4) ); GF(2^2) gap> Field( E(9) ); CF(9) gap> Field( [ Z(4), Z(9) ] ); Error, CharFFE: <z> must be a finite field element, vector, or matrix gap> Field( [ E(4), E(9) ] ); CF(36)

`Field`

differs from `DefaultField`

(see DefaultField) in that it
returns the smallest field in which the elements lie, while
`DefaultField`

may return a larger field if that makes sense.

`DefaultField( `

`z`,.. )`DefaultField( `

`list` )

In the first form `DefaultField`

returns the default field that contains
all the elements `z`,.. etc. In the second form `DefaultField`

returns
the default field that contains all the elements in the list `list`. If
any element is not an element of a field or the elements lie in no common
field an error is raised.

The field returned by `DefaultField`

need not be the smallest field in
which the elements lie. For example for elements from cyclotomic fields
`DefaultField`

may return the smallest cyclotomic field in which the
elements lie, which need not be the smallest field overall, because the
elements may in fact lie in a smaller number field which is not a
cyclotomic field.

For the exact definition of the default field of a certain type of elements read the chapter describing this type (see Finite Fields and Subfields of Cyclotomic Fields).

`DefaultField`

is used by `Conjugates`

, `Norm`

, `Trace`

, `CharPol`

, and
`MinPol`

(see Conjugates, Norm, Trace, CharPol, and MinPol) if
no explicit field is given.

gap> DefaultField( Z(4) ); GF(2^2) gap> DefaultField( E(9) ); CF(9) gap> DefaultField( [ Z(4), Z(9) ] ); Error, CharFFE: <z> must be a finite field element, vector, or matrix gap> DefaultField( [ E(4), E(9) ] ); CF(36)

`Field`

(see Field) differs from `DefaultField`

in that it returns the
smallest field in which the elements lie, while `DefaultField`

may return
a larger field if that makes sense.

`F` / `G`

The quotient operator `/`

evaluates to a new field `H`. This field has
the same elements as `F`, i.e., is a domain equal to `F`. However `H` is
viewed as a field over the field `G`, which must be a subfield of `F`.

What subfield a field is viewed over determines its Galois group. As described in GaloisGroup the Galois group is the group of field automorphisms that leave the subfield fixed. It also influences the results of Norm, Trace, CharPol, and MinPol, because they are defined in terms of the Galois group.

gap> F := GF(2^12); GF(2^12) gap> G := GF(2^2); GF(2^2) gap> Q := F / G; GF(2^12)/GF(2^2) gap> Norm( F, Z(2^6) ); Z(2)^0 gap> Norm( Q, Z(2^6) ); Z(2^2)^2

The operator `/`

calls

.
`G`.operations./( `F`, `G` )

The default function called this way is `FieldOps./`

, which simply makes
a copy of `F` and enters `G` into the record component

(see
Field Records).
`F`.field

`f` = `g`

`f` <> `g`

The equality operator `=`

evaluates to `true`

if the two field elements
`f` and `g` are equal, and to `false`

otherwise. The inequality operator
`<>`

evaluates to `true`

if the two field elements `f` and `g` are not
equal, and to `false`

otherwise. Note that any two field elements can be
compared, even if they do not lie in compatible fields. In this case
they cn, of course, never be equal. For each type of fields the equality
of those field elements is given in the respective chapter.

Note that you can compare field elements with elements of other types; of course they are never equal.

`f` < `g`

`f` <= `g`

`f` > `g`

`f` >= `g`

The operators `<`

, `<=`

, `>`

, and `>=`

evaluate to `true`

if the field
element `f` is less than, less than or equal to, greater than, or greater
than or equal to the field element `g`. For each type of fields the
definition of the ordering of those field elements is given in the
respective chapter. The ordering of field elements is as follows.
Rationals are smallest, next are cyclotomics, followed by finite field
elements.

Note that you can compare field elements with elements of other types; they are smaller than everything else.

The following operations are always available for field elements. Of course the operands must lie in compatible fields, i.e., the fields must be equal, or at least have a common superfield.

`f` + `g`

The operator `+`

evaluates to the sum of the two field elements `f` and
`g`, which must lie in compatible fields.

`f` - `g`

The operator `-`

evaluates to the difference of the two field elements
`f` and `g`, which must lie in compatible fields.

`f` * `g`

The operator `*`

evaluates to the product of the two field elements `f`
and `g`, which must lie in compatible fields.

`f` / `g`

The operator `/`

evaluates to the quotient of the two field elements `f`
and `g`, which must lie in compatible fields. If the divisor is 0 an
error is signalled.

`f` ^ `n`

The operator `^`

evaluates to the `n`-th power of the field element `f`.
If `n` is a positive integer then

is `f`^`n`

(`f`*`f`*..*`f``n` factors). If `n` is a negative integer

is defined as
`f`^`n`*1 / f^{-n}*. If 0 is raised to a negative power an error is
signalled. Any field element, even 0, raised to the 0-th power yields 1.

For the precedence of the operators see Operations.

`GaloisGroup( `

`F` )

`GaloisGroup`

returns the Galois group of the field `F` as a group (see
Groups) of field automorphisms (see Field Homomorphisms).

The Galois group of a field `F` over a subfield

is the group
of automorphisms of `F`.field`F` that leave the subfield

fixed. This
group can be interpreted as a permutation group permuting the zeroes of
the characteristic polynomial of a primitive element of `F`.field`F`. The degree
of this group is equal to the number of zeroes, i.e., to the dimension of
`F` as a vector space over the subfield

. It operates
transitively on those zeroes. The normal divisors of the Galois group
correspond to the subfields between `F`.field

and `F`

.
`F`.field

gap> G := GaloisGroup( GF(4096)/GF(4) );; gap> Size( G ); 6 gap> IsCyclic( G ); true # the Galois group of every finite field is # generated by the Frobenius automorphism gap> H := GaloisGroup( CF(60) );; gap> Size( H ); 16 gap> IsAbelian( H ); true

The default function `FieldOps.GaloisGroup`

just raises an error, since
there is no general method to compute the Galois group of a field. This
default function is overlaid by more specific functions for special types
of domains (see Field Functions for Finite Fields and GaloisGroup for
Number Fields).

`MinPol( `

`z` )

`MinPol( `

`F`, `z` )

In the first form `MinPol`

returns the coefficients of the minimal
polynomial of the element
`z` in its default field over its prime field (see DefaultField). In
the second form `MinPol`

returns the coefficients of the minimal
polynomial of the element
`z` in the field `F` over the subfield

.
`F`.field

Let *F/S* be a field extension and *L* a minimal normal extension of *S*,
containing *F*.
The **minimal polynomial** of *z* in *F* over *S* is the squarefree
polynomial
whose roots are precisely the conjugates of *z* in *L* (see
Conjugates). Because the set of
conjugates is fixed under the Galois group of *L* over *S* (see
GaloisGroup), so is the polynomial. Thus all the coefficients of the
minimal polynomial lie in *S*.

gap> MinPol( Z(2^6) ); [ Z(2)^0, Z(2)^0, 0*Z(2), Z(2)^0, Z(2)^0, 0*Z(2), Z(2)^0 ] gap> MinPol( GF(2^12), Z(2^6) ); [ Z(2)^0, Z(2)^0, 0*Z(2), Z(2)^0, Z(2)^0, 0*Z(2), Z(2)^0 ] gap> MinPol( GF(2^12)/GF(2^2), Z(2^6) ); [ Z(2^2), Z(2)^0, Z(2)^0, Z(2)^0 ]

The default function `FieldOps.MinPol`

, which works only for extensions with
abelian Galois group, multiplies the linear factors *x - c*
with `c` ranging over the set of conjugates of `z` in `F` (see
Conjugates). For generic algebraic extensions, it is overlayed by solving
a system of linear equations, given by the coefficients of powers of `z`
in respect to a given base.

`CharPol( `

`z` )

`CharPol( `

`F`, `z` )

In the first form `CharPol`

returns the coefficients of the characteristic
polynomial of the element `z` in its default field over its
prime field (see DefaultField). In the second form `CharPol`

returns
the coefficients of the characteristic
polynomial of the element `z` in the field `F` over the subfield

. The characteristic polynomial is returned as a list of
coefficients, the `F`.field`i`-th entry is the coefficient of *x ^{i-1}*.

The **characteristic polynomial** of an element *z* in a field *F* over a
subfield *S* is the *([F:S])/( deg μ)*-th power of

gap> CharPol( Z(2^6) ); [ Z(2)^0, Z(2)^0, 0*Z(2), Z(2)^0, Z(2)^0, 0*Z(2), Z(2)^0 ] gap> CharPol( GF(2^12), Z(2^6) ); [ Z(2)^0, 0*Z(2), Z(2)^0, 0*Z(2), 0*Z(2), 0*Z(2), Z(2)^0, 0*Z(2), Z(2)^0, 0*Z(2), 0*Z(2), 0*Z(2), Z(2)^0 ] gap> CharPol( GF(2^12)/GF(2^2), Z(2^6) ); [ Z(2^2)^2, 0*Z(2), Z(2)^0, 0*Z(2), Z(2)^0, 0*Z(2), Z(2)^0 ]

The default function `FieldOps.CharPol`

multiplies the linear factors *x - c*
with `c` ranging over the conjugates of `z` in `F` (see Conjugates).
For nonabelian extensions, it is overlayed by a function, which computes the
appropriate power of the minimal polynomial.

`Norm( `

`z` )

`Norm( `

`F`, `z` )

In the first form `Norm`

returns the norm of the field element `z` in its
default field over its prime field (see DefaultField). In the second
form `Norm`

returns the norm of `z` in the field `F` over the subfield

.
`F`.field

The **norm** of an element *z* in a field *F* over a subfield *S* is
*(-1) ^{F.degree/S.degree}=(-1)^{[F:S]}* times the constant term of the
characteristic polynomial of

gap> Norm( Z(2^6) ); Z(2)^0 gap> Norm( GF(2^12), Z(2^6) ); Z(2)^0 gap> Norm( GF(2^12)/GF(2^2), Z(2^6) ); Z(2^2)^2

The default function `FieldOps.Norm`

multiplies the conjugates of `z` in
`F` (see Conjugates). For nonabelian extensions, it is overlayed by a
function, which obtains the norm from the characteristic polynomial.

`Trace( `

`z` )

`Trace( `

`F`, `z` )

In the first form `Trace`

returns the trace of the field element `z` in
its default field over its prime field (see DefaultField). In the
second form `Trace`

returns the trace of the element `z` in the field `F`
over the subfield

.
`F`.field

The **trace** of an element *z* in a field *F* over a subfield *S* is the
negative of the coefficient of the second highest degree
term of the characteristic polynomial of *z* (see CharPol).
Thus the trace lies in *S*. The trace is the
sum over all conjugates of *z* in the normal closure of *F* over *S*
(see Conjugates).

gap> Trace( Z(2^6) ); 0*Z(2) gap> Trace( GF(2^12), Z(2^6) ); 0*Z(2) gap> Trace( GF(2^12)/GF(2^2), Z(2^6) ); 0*Z(2)

The default function `FieldOps.Trace`

adds the conjugates of `z` in `F`
(see Conjugates). For nonabelian extensions, this is overlayed by a
function, which obtains the trace from the characteristic polynomial.

`Conjugates( `

`z` )

`Conjugates( `

`F`, `z` )

In the first form `Conjugates`

returns the list of conjugates of the
field element `z` in its default field over its prime field (see
DefaultField). In the second form `Conjugates`

returns the list of
conjugates of the field element `z` in the field `F` over the subfield

. In either case the list may contain duplicates if `F`.field`z` lies
in a proper subfield of its default field, respectively of `F`.

The **conjugates** of an element *z* in a field *F* over a subfield *S*
are the roots in *F* of the characteristic polynomial of *z* in *F* (see
CharPol). If *F* is a normal extension of *S*, then the conjugates of *z*
are the images of *z* under all elements of the Galois group of *F*
over *S* (see GaloisGroup), i.e., under those automorphisms of *F* that leave
*S* fixed. The number of different conjugates of *z* is given by the
degree of the smallest extension of *S* in which *z* lies.

For a normal extension *F*,
`Norm`

(see Norm) computes the product, `Trace`

(see Trace) the sum
of all conjugates. `CharPol`

(see CharPol) computes the polynomial
that has precisely the conjugates with their corresponding multiplicities
as roots, `MinPol`

(see MinPol) the squarefree polynomial that has
precisely the conjugates as roots.

gap> Conjugates( Z(2^6) ); [ Z(2^6), Z(2^6)^2, Z(2^6)^4, Z(2^6)^8, Z(2^6)^16, Z(2^6)^32 ] gap> Conjugates( GF(2^12), Z(2^6) ); [ Z(2^6), Z(2^6)^2, Z(2^6)^4, Z(2^6)^8, Z(2^6)^16, Z(2^6)^32, Z(2^6), Z(2^6)^2, Z(2^6)^4, Z(2^6)^8, Z(2^6)^16, Z(2^6)^32 ] gap> Conjugates( GF(2^12)/GF(2^2), Z(2^6) ); [ Z(2^6), Z(2^6)^4, Z(2^6)^16, Z(2^6), Z(2^6)^4, Z(2^6)^16 ]

The default function `FieldOps.Conjugates`

applies the automorphisms of
the Galois group of `F` (see GaloisGroup) to `z` and returns the list
of images. For nonabelian extensions, this is overlayed by a factorization
of the characteristic polynomial.

Field homomorphisms are an important class of homomorphisms in **GAP3**
(see chapter Homomorphisms).

A **field homomorphism** *φ* is a mapping that maps each element of a
field *F*, called the source of *φ*, to an element of another field
*G*, called the range of *φ*, such that for each pair *x,y ∈ F* we
have *(x+y) ^{φ} = x^{φ} + y^{φ}* and

An Example of a field homomorphism is the Frobinius automorphism of a
finite field (see FrobeniusAutomorphism). Look under **field
homomorphisms** in the index for a list of all available field
homomorphisms.

Since field homomorphisms are just a special case of homomorphisms, all functions described in chapter Homomorphisms are applicable to all field homomorphisms, e.g., the function to test if a homomorphism is a an automorphism (see IsAutomorphism). More general, since field homomorphisms are just a special case of mappings all functions described in chapter Mappings are also applicable, e.g., the function to compute the image of an element under a homomorphism (see Image).

The following sections describe the functions that test whether a mapping is a field homomorphism (see IsFieldHomomorphism), compute the kernel of a field homomorphism (see KernelFieldHomomorphism), and how the general mapping functions are implemented for field homomorphisms.

`IsFieldHomomorphism( `

`map` )

`IsFieldHomomorphism`

returns `true`

if the mapping `map` is a field
homomorphism and `false`

otherwise. Signals an error if `map` is a multi
valued mapping.

A mapping *map* is a field homomorphism if its source *F* and range *G*
are both fields and if for each pair of elements *x, y ∈ F* we have
*(x+y) ^{map} = x^{map} + y^{map}* and

gap> f := GF( 16 ); GF(2^4) gap> fun := FrobeniusAutomorphism( f ); FrobeniusAutomorphism( GF(2^4) ) gap> IsFieldHomomorphism( fun ); true

`IsFieldHomomorphism`

first tests if the flag

is bound. If the flag is bound, `map`.isFieldHomomorphism`IsFieldHomomorphism`

returns its value.
Otherwise it calls

, remembers the
returned value in `map`.source.operations.IsFieldHomomorphism( `map` )

, and returns it. Note that
of course all functions that create field homomorphism set the flag
`map`.isFieldHomomorphism

to `map`.isFieldHomomorphism`true`

, so that no function is called for
those field homomorphisms.

The default function called this way is `MappingOps.IsFieldHomomorphism`

.
It computes all the elements of the source of `map` and for each pair of
elements *x, y* tests whether *(x+y) ^{map} = x^{map} + y^{map}* and

`KernelFieldHomomorphism( `

`hom` )

`KernelFieldHomomorphism`

returns the kernel of the field homomorphism
`hom`.

Because the kernel must be a ideal in the source and it can not be the full source (because we require that the one of the source is mapped to the one of the range), it must be the trivial ideal. Therefor the kernel of every field homomorphism is the set containing only the zero of the source.

This section describes how the mapping functions defined in chapter Mappings are implemented for field homomorphisms. Those functions not mentioned here are implemented by the default functions described in the respective sections.

`IsInjective( `

`hom` )

Always returns `true`

(see KernelFieldHomomorphism).

`IsSurjective( `

`hom` )

The field homomorphism `hom` is surjective if the size of the image
`Size( Image( `

is equal to the size of the range `hom` ) )```
Size(
```

.
`hom`.range )

`hom1` = `hom2`

The two field homomorphism `hom1` and `hom2` are are equal if the have
the same source and range and if the images of the generators of the
source under `hom1` and `hom2` are equal.

`Image( `

`hom` )

`Image( `

`hom`, `H` )

`Images( `

`hom`, `H` )

The image of a subfield under a field homomorphism is computed by computing the images of a set of generators of the subfield, and the result is the subfield generated by those images.

`PreImage( `

`hom` )

`PreImage( `

`hom`, `H` )

`PreImages( `

`hom`, `H` )

The preimages of a subfield under a field homomorphism are computed by computing the preimages of all the generators of the subfield, and the result is the subfield generated by those elements.

Look in the index under **IsInjective**, **IsSurjective**, **Image**, **Images**,
**PreImage**, **PreImages**, and **equality** to see for which field
homomorphisms these functions are overlaid.

A field is represented by a record that contains important information
about this field. The **GAP3** library predefines some field records, for
example `Rationals`

(see Rationals). Field constructors construct
others, for example `Field`

(see Field), and `GaloisField`

(see
GaloisField). Of course you may also create such a record by hand.

All field records contain the components `isDomain`

, `isField`

, `char`

,
`degree`

, `generators`

, `zero`

, `one`

, `field`

, `base`

, and `dimension`

.
They may also contain the optional components `isFinite`

, `size`

,
`galoisGroup`

. The contents of all components of a field `F` are
described below.

`isDomain`

:-

is always`true`

. This indicates that`F`is a domain.

`isField`

:-

is always`true`

. This indicates that`F`is a field.

`char`

:-

is the characteristic of`F`. For finite fields this is always a prime, for infinite fields this is 0.

`degree`

:-

is the degree of`F`**as extension of the prime field**, not as extension of the subfield`S`. For finite fields the order of`F`is given by

.`F`.char^`F`.degree

`generators`

:-

a list of elements that together generate`F`. That is`F`is the smallest field over the prime field given by

that contains the elements of`F`.char

.`F`.generators

`zero`

:-

is the additive neutral element of the finite field.

`one`

:-

is the multiplicative neutral element of the finite field.

`field`

:-

is the subfield`S`over which`F`was constructed. This is either a field record for`S`, or the same value as

, denoting the prime field (see Fields over Subfields).`F`.char

`base`

:-

is a list of elements of`F`forming a base for`F`as vector space over the subfield`S`.

`dimension`

:-

is the dimension of`F`as vector space over the subfield`S`.

`isFinite`

:-

if present this is`true`

if the field`F`is finite and`false`

otherwise.

`size`

:-

if present this is the size of the field`F`. If`F`is infinite this holds the string "infinity".

`galoisGroup`

:-

if present this holds the Galois group of`F`(see GaloisGroup).

gap3-jm

11 Mar 2019