Finite Fields
William Stein
Jan 20, 2016 (part 2)
A finite field is a field that is finite. The most basic slightly nontrivial mathematical facts about finite fields are:
Theorem: There exists a unique, up to isomorphism, finite field of each prime power order.
Theorem: The automorphism group of is cyclic of order , generated by the Frobenius map .
Finite fields are incredibly useful, and frequently arise natural in algebraic number thoery as quotient rings of the form , where is a nonzero prime ideal in the ring of integers of a number field.
Sage is extremely powerful at working with finite fields (for state-of-the-art research). Sage builds on several very fast/powerful C/C++ libraries for finite field arithmetic, and polynomial arithmetic over finite fields, including Givaro, Singular, FLINT, Pari, and NTL. Different libraries are used for different field sizes.
In practice, some computational issues that arise when you work with finite fields are mainly:
Choosing a "nice" or "canonical" polynomial to define the finite field, . There are many competing issues here. E.g., cryptographers care desparately about arithmetic speed, especially when ; others care about different people agreeing easily on a common choice efficiently (I remember Lenstra et al. getting deeply obsessed with this problem a few years ago). Still others, care about...
Working with the lattice of extensions of . If you end up with elements in a choice of and , and and then suddenly want to work with ... what to do? This can get very subtle and interesting. I first encountered using such a thing in Magma and was very impressed. For example, there is a frustrating paper about how Magma magically does this, in which they talk about how awesome their approach is, but seem to actually not tell you what it is (and Magma is closed source). I think David Roe and others figured out something just as good that is in Sage.
Performance: Make computing and in very, very fast. This is extremely interesting, with a wide range of techniques depending on and . For example, if is really small, just make a lookup table (that is in cache).
Arithemetic over finite fields, e.g., with polynomials. This is huge: linear algebra, all polynomial arithmetic, Groebner basis, etc., all over finite fields. Implementations (in Sage) can easily have little to do with how basic arithmetic is implemented... (e.g., large degree polynomial multiplication might be done via a Fourier transform, and matrix multiplication may be done by breaking matrices up into blocks and multiplying them using floating point numbers!).
ASIDE: Sage-devel post that appeared right when I write this complaining about the requirment when creating finite fieldsthat you explicitly name the generator...
Making finite fields directly
The Sage documentation explains how you can make finite fields either by directly defining them, or by constructing them as a quotient of the ring of integers of a number field by a prime ideal. I'll show you how to do both below.
The basics
Write GF(p^n,'a')
or FiniteField(p^n, 'a')
to make the (unique up to isomorphism) finite field of that size.
A Prime finite field (so )
Arithmetic in small finite fields is reasonably fast.
Exercise: How many additions/multiplications with elements of GF(3) can you do in one second?
Memorize the answer to this question -- it will help you a lot when thinking about how long things should take.
For comparison try Sage number field elements:
Quick Exercise: Easy -- how many number field operations per second?
Also one with big .
Non-prime finite fields, so
Exercise: Is arithmetic in GF(9) in Sage "fast"? How does it compare to GF(3) above?
Lattice of finite fields...
However, Sage does support working in , which is possibly very nice and solves the same problem.
Next time, finite fields from number fields.