Finite fields

# Finite fields

AbstractAlgebra.jl provides a module, implemented in `src/julia/GF.jl` for finite fields. The module is a naive implementation that supports only fields of degree \$1\$ (prime fields). They are modelled as \$\mathbb{Z}/p\mathbb{Z}\$ for \$p\$ a prime.

## Types and parent objects

Finite fields have type `GFField{T}` where `T` is either `Int` or `BigInt`.

Elements of such a finite field have type `GFElem{T}`.

## Finite field constructors

In order to construct finite fields in AbstractAlgebra.jl, one must first construct the field itself. This is accomplished with the following constructors.

``GF(p::T; check::Bool=true) where T <: Integer``

Return the finite field \$\mathbb{F}_p\$, where \$p\$ is a prime. By default, the integer \$p\$ is checked with a probabilistic algorithm for primality. When `check == false`, no check is made, but the behaviour of the resulting object is undefined if \$p\$ is composite.

Here are some examples of creating a finite field and making use of the resulting parent object to coerce various elements into the field.

Examples

``````julia> F = GF(13)
Finite field F_13

julia> g = F(3)
3

julia> h = F(g)
3

julia> GF(4)
ERROR: DomainError with 4:
Characteristic is not prime in GF(p)
Stacktrace:
[...]``````

## Basic field functionality

The finite field module in AbstractAlgebra.jl implements the full Field interface.

We give some examples of such functionality.

Examples

``````julia> F = GF(13)
Finite field F_13

julia> f = F(7)
7

julia> h = zero(F)
0

julia> k = one(F)
1

julia> isone(k)
true

julia> iszero(h)
true

julia> T = parent(h)
Finite field F_13

julia> h == deepcopy(h)
true

julia> h = h + 2
2

julia> m = inv(k)
1
``````

## Basic manipulation of fields and elements

``gen(R::GFField{T}) where T <: Integer``

Return a generator of the field. Currently this returns 1.

``order(R::GFField)``

Return the order, i.e. the number of element in the given finite field.

``degree(R::GFField)``

Return the degree of the given finite field.

Examples

``````julia> F = GF(13)
Finite field F_13

julia> d = degree(F)
1

julia> n = order(F)
13

julia> g = gen(F)
1
``````