Enumerating hyperelliptic curves
over finite fields in quasilinear time
Abstract.
We present an algorithm that, for every fixed genus , will enumerate all hyperelliptic curves of genus over a finite field of odd characteristic in quasilinear time; that is, the time required for the algorithm is , where . Such an algorithm already exists in the case , thanks to work of Mestre and Cardona and Quer, and in the case , thanks to work of Lercier and Ritzenthaler. Experimentally, it appears that our new algorithm is about two orders of magnitude faster in practice than ones based on their work.
Key words and phrases:
Hyperelliptic curve, finite field1991 Mathematics Subject Classification:
Primary 11G20; Secondary 11Y16, 14G15, 14H10, 14H251. Introduction
There are many circumstances in which one may want to enumerate all hyperelliptic curves of a given genus over a given finite field. One may wish to determine whether a hyperelliptic curve with certain special properties exists — for instance, with a certain number of points [14, p. 393], or a certain zeta function, or a certain -number [7, §4], or some other property of interest — and explicit enumeration allows for a direct search. Or perhaps one may wish to gather data about all hyperelliptic curves of a given genus over a given finite field — for example, in order to compute the distribution of the number of points on such curves, as in [1], or to determine experimental results [18] that can inspire future theorems [11].
In this paper we present, for every fixed genus , an algorithm to calculate a list of all hyperelliptic curves of genus over a given finite field of odd characteristic.111Hyperelliptic curves in characteristic are different from those in other characteristics in some basic ways, and, as we discuss later, there already exists an efficient algorithm for enumerating them.
Theorem 1.1.
Fix an integer Together, the algorithms we present in Section 7 provide a method for computing a complete list of hyperelliptic curves of genus over for odd prime powers , with each curve appearing exactly once up to isomorphism. The algorithms take time and space .
From [3, Proposition 7.1] and from the fact that a generic hyperelliptic curve has automorphism group of order , we see that there are roughly hyperelliptic curves of genus over , so our algorithm runs in quasilinear time.
We also present an apparently new explicit enumeration of all monic irreducible homogeneous bivariate quartics over a finite field of odd characteristic, up to the natural action of (see Section 2), which may be of independent interest.
Theorem 1.2.
Given an odd prime power , let be a nonzero element of whose multiplicative order is and let be an element of with . Let be the union of the two sets
and
Then the homogenized minimal polynomials of the elements of provide a complete set of unique representatives for the action of on the monic irreducible homogeneous bivariate quartics over .
We prove this in Section 3. Also, here and elsewhere, when we say we have a “complete set of unique representatives” for an action of a group on a set, we mean that we have a set of orbit representatives that contains exactly one member from each orbit.
Briefly, there are two main ideas behind the algorithms that give us Theorem 1.1. The first is that there is an easy way to tell whether two irreducible homogeneous polynomials in lie in the same orbit under the action of — see Theorem 4.2. We use this fact to reduce the problem of getting a list of all hyperelliptic curves without duplicates in quasilinear time to the problem of getting a list of hyperelliptic curves with a bounded number of duplicates in quasilinear time. The second is that if one understands the cosets of in , and if one has a list of orbit representatives for acting on irreducible homogenous polynomials of degree in , then one can get a list of orbit representatives for acting on irreducible homogenous polynomials of degree in — see Section 7.4. The point of this observation is that the number of orbits of irreducible degree- polynomials over is on the order of , while the number of orbits of degree- polynomials over is roughly , so the former is easier to compute than the latter.
The algorithm for enumerating hyperelliptic curves that we present is designed for simplicity of argument, rather than for efficiency of computation. In Section 8 we describe modifications that will make the algorithm more efficient, and in Section 9 we present even more details and timings for the case of genus and genus .
An obvious issue with our algorithm, as we present it here, is that it requires space. This is because our initial computations often produce some duplicate entries, and we eliminate these duplicates by collecting all the output, computing some invariants, and then discarding entries whose invariants have already been seen. In a followup paper [9], we show how it is possible to modify the techniques presented here in order to get a quasilinear time algorithm for computing genus- hyperelliptic curves over that only requires space. Our implementation of the genus- case of the algorithm from the present paper uses a basic version of the ideas from [9], and it would not be hard to modify the genus- code we provide in [10] so that it requires only space.
We start by considering various reductions, special cases, and lemmas. In Section 2 we show that enumerating hyperelliptic curves of genus over a finite field of odd characteristic can be reduced to enumerating Galois-stable sets of elements of up to the natural action of . The rest of the paper is therefore concerned mostly with the latter problem, which we solve for all finite fields, not just those of odd characteristic. In Section 3 we prove Theorem 1.2, as well as similar results for quartics with one or two irreducible quadratic factors and generalizations to characteristic . In Section 4 we introduce an invariant for orbits of monic irreducible homogeneous bivariate polynomials of degree over , and we use it to provide a very straightforward algorithm for giving a complete set of unique representatives for these orbits in time . In Sections 5 and 6 we give an explicit enumeration of a complete set of unique representatives for the cosets of in for primes . The case is the key result needed for the most difficult case of our algorithm to enumerate hyperelliptic curves. In Section 7 we use the results of the earlier sections to present a collection of algorithms that, together, give a complete set of unique representatives for the orbits of Galois stable sets of elements of . We close with Sections 8 and 9, described above.
For many of our algorithms we require an easily computable total ordering of the elements of or of polynomials in or in . We will always denote such an ordering by “” and we leave the reader to choose their favorite one. Also, if the proof of a proposition is clear, we indicate that the proof will be skipped by including an end-of-proof mark in the statement of the result.
Acknowledgements
I am grateful to the referees for ANTS, who provided helpful feedback that improved this paper.
2. Hyperelliptic curves and Weierstrass points
We begin by setting some general notation. Given a finite field , let be the graded polynomial ring , with the grading given by the degree. For each let be the set of homogeneous polynomials in of degree and let be the union of the . We say that is monic if is monic as a univariate polynomial, and we say that is separable if in it can be written as a constant times a product of distinct monic linear factors. We say that is a root of if , and that is a zero of if .
We also define a left action of on as follows. If is an element of represented by a matrix and if lies in , we define to be the class in of .
Every class of contains a unique monic element, and we define an action of on the monic elements of by writing when is the monic element of . If is represented by a matrix and if , then for some , and if we choose a different matrix to represent , then the constant will be multiplied by an th power. When is even, the class of in therefore depends only on , and we denote this square class by .
Given a separable polynomial , we let denote the set of zeros of in , so that consists of the roots of under the usual inclusion given by , together with if is divisible by . For every integer we let denote the set of all Galois-stable sets of distinct points in , so that the natural action of on leads to an action of on . We see that gives us a bijection between the set of monic separable polynomials in and the set , and we check that for all .
Our goal in this paper is to produce an algorithm to enumerate hyperelliptic curves of a given genus over finite fields of odd characteristic. As a first step, we reduce this problem to the problem of computing representatives for all orbits of , where .
Let be a finite field of odd characteristic and let be a hyperelliptic curve over , that is, a curve of genus with a degree- map to a curve of genus . Every genus- curve over a finite field is isomorphic to , and since our has odd characteristic can be written in the form , where is a separable polynomial of degree or . We can rewrite this as a model in weighted projective space by homogenizing into a polynomial ; here we give the coordinates and weight and the coordinate weight . Then the map gives the double cover , and the points of that ramify in this map are exactly the elements of . If and are two hyperelliptic curves, given by equations and , then every isomorphism from to can be written in the form
where and are nonzero, and where
(1) |
see [17, Corollary 7.4.33]. Then , so we see that , where is the element represented by the matrix . Thus, if and are isomorphic, the element of takes the ramification points of to the ramification points of . Conversely, if takes the ramification points of to the ramification points of , then there is an , with , that makes (1) hold. If lies in , we have an isomorphism between and ; if does not lie in , we have an isomorphism between and the quadratic twist of , that is, the curve , where is a nonsquare in . (In general, a twist of a curve over a finite field is another curve over that becomes isomorphic to when the base field is extended to an algebraic closure of . Twists of correspond to elements of the cohomology set — see [21, §III.1.3] — and by “the quadratic twist” of a hyperelliptic curve we mean the twist corresponding to the cocycle that sends the Frobenius element of to the hyperelliptic involution. Note that sometimes the quadratic twist may in fact be the trivial twist.)
Thus, we have a map from the set of isomorphism classes of genus- hyperelliptic curves over to the set of orbits of , where . This map is clearly surjective, and the orbit of an element of has at most two preimages in the set of isomorphism classes of hyperelliptic curves: the isomorphism classes of and of , where is the unique monic polynomial with and where is a nonsquare in . (We say “at most two” preimages because, as we noted above, these two curves may be isomorphic to one another.)
Whether an element of has one or two preimages is easy to determine: Let be the unique monic polynomial with . Compute all elements of that take the set to itself; at worst this takes time , and since is fixed in our context, this is operations. For each such compute the element of . If any of these elements is nontrivial, then the curve is isomorphic to its twist . (Compare to [20, Lemma 1.2].)
This shows that if we can compute a complete set of unique representatives for the orbits of acting on in time , we can also compute a complete set of unique representatives for the hyperelliptic curves of genus over in time . Thus, for the rest of this paper we focus on enumerating the orbits of , for . In particular, for our application to enumerating hyperelliptic curves we only need to consider even that are at least . The algorithms that we present for the latter problem work for all finite fields, not just those of odd characteristic.
Remark 2.1.
Over a finite field of characteristic there are still roughly hyperelliptic curves of genus , but it is much easier to enumerate them in quasilinear time than it is in odd characteristic, because the ramification divisor of the hyperelliptic structure map is supported on at most points. Enumerating the possible ramification divisors up to the action of in time is therefore much simpler than in odd characteristic, and enumerating the curves with a given ramification divisor is relatively straightforward. The algorithm of Xarles [24] follows this outline; it has been implemented by him in genus , by Dragutinović [6] in genus , and by Huang, Kedlaya, and Lau [12] in genus .
3. Results for quartic polynomials
In this section we prove Theorem 1.2. We also prove similar results that give complete sets of unique representatives for the action of on monic homogeneous quartics that have one or two irreducible quadratic factors, and we state generalizations to finite fields of characteristic . We begin with an elementary lemma.
Lemma 3.1.
Let be a field and let , , , and be distinct elements of . Then there is a unique element of that swaps with and with , and this element is an involution.
Proof.
An element of is determined by where it sends three distinct elements of , so the uniqueness is automatic, and we need only prove existence. By using the action of , we see that it suffices to prove the lemma in the case where , , and . Then the element of is an involution that swaps with and with . ∎
Corollary 3.2.
Let be a prime power and let , , , and be distinct elements of such that Then there is a unique element of that swaps with and with , and this element is an involution.
Proof.
Let be the involution that swaps with and with . Then , by which we mean the element of obtained by taking a representative matrix for and replacing all of its entries by their th powers, is also an involution that swaps with and with , because of the equality of sets in our hypothesis. By the uniqueness property in Lemma 3.1, it follows that in , from which we see that actually lies in . ∎
Proof of Theorem 1.2.
First we show that every monic irreducible quartic in can be transformed into one of the quartics in the statement of the theorem; this is equivalent to showing that every irreducible quartic has a root in that can be moved by to an element of the set from the theorem.
In the statement of the theorem we chose an element of with . Let , so that is a nonsquare in .
Let be an irreducible quartic in , let be a root of in , and set , , , and . By Corollary 3.2 there is a unique involution in that swaps with and with . We refer to this as the involution associated to .
Let be an element of . Then the involution associated to is . Since every involution in is conjugate either to or , we can choose so that is one of these two standard involutions. Now we replace with , with , and with .
Suppose . The subgroup of that stabilizes under conjugation is
We would like to apply an element of to , and if necessary replace with one of its conjugates, to put into a standard form. We accomplish this by considering the function given by applying the element of . Since conjugates to the involution , we see that . This shows that , so the multiplicative order of is even and divides . It follows that we may write for some odd integer with .
Let
Then applying an element of to corresponds to applying an element of to , and the elements of either multiply by an element of or replace with its inverse times an element of . Since the elements of are the powers of , these two actions show that there is a such that for an odd integer with . If we let and replace with , we find that for this .
Finally, replacing with has the effect of replacing with . If we write we see that
so by replacing with its conjugate , if necessary, and then modifying the new by an element of , we find that we may assume that .
We see that every irreducible quartic whose associated involution is has a root in the orbit of , for some odd with . Moreover, from our analysis it is clear that different values of in this range produce quartics in distinct orbits.
Next, suppose the involution associated with a quartic is . The subgroup of that stabilizes under conjugation is
As before, we would like to apply an element of to , and if necessary replace with one of its conjugates, to put into a standard form. This time we consider the function given by applying the element of , where is the element of chosen in the statement of the theorem and . Then conjugates to the involution , and once again we have . As before, we see that , so has multiplicative order dividing . Once again we may write for some odd integer with .
Let and let be the kernel of the norm map from to . We check that
Then applying an element of to corresponds to applying an element of to , and the elements of either multiply by an element of or replace with its inverse times an element of .
The elements of are the powers of , so arguing as before we find that we may replace with for some so that for an odd with . We check that , so replacing with has the effect of replacing with . If we write we see that
so by replacing with its conjugate , if necessary, we find that we may assume that .
We see that every irreducible quartic whose associated involution is has a root in the orbit of , for some odd with , and different values of in this range give irreducible quartics that are not equivalent to one another under the action of . ∎
Remark 3.3.
For a separable quartic , we let denote the -invariant of the Jacobian of the genus- curve . One can show that , where is the discriminant of , and clearly for all , because the curve is geometrically isomorphic to . Using arguments from [8, §3], one can show that takes different values on irreducible quartics that are not in the same orbit.
For products of two distinct irreducible quadratics, we have a similar result.
Theorem 3.4.
Given an odd prime power , let be a generator of , let be an element of with , and let . Let
and let be the set of homogenized minimal polynomials of the elements of . Then the set is a complete set of unique representatives for the action of on the homogeneous quartics that factor into a product of two distinct monic irreducible quadratics.
Proof.
Let be a homogeneous quartic that factors into a product of two monic irreducible quadratics, so that the roots of are , , , and , for two elements and in with conjugates and . We will show that there is a unique element in such that the set can be sent to by an element of . This will be enough to prove the theorem.
By replacing with its image under an element of we may assume that . The subgroup of that fixes the set is the group from the proof of Theorem 1.2. Let . Arguing as in the proof of Theorem 1.2 we find that there is a unique element of so that we can write as for an integer with .
Since by Corollary 3.2 there is an element of that swaps and with and , we would have gotten the same value of if we had normalized and to be and at the beginning of our argument, instead of and . Thus the value of we obtain truly depends only on the orbit of .
This shows that we may assume that is an element of , and different elements of correspond to different orbits. The theorem follows. ∎
Remark 3.5.
If is a homogeneous quartic in that can be factored into the product of two monic irreducible quadratics and , we define
and we check that , where is as in Remark 3.3. Note that is a square, because the two factors in the denominator are the discriminants of the irreducible factors of .
We leave it to the reader to check that for of this form we have for every , so is an invariant of the orbits of such quartics. Given any square in other than , we check that a quartic satisfies if and only if lies on a certain nonsingular conic. Nonsingular conics over finite fields have rational points not on the line at infinity, so there are values of and that give a quartic for which attains the value . Since attains different values, must take different values on the orbits of acting on products of irreducible quadratics.
One can show that is derived from a modular function that parametrizes pairs , where is an elliptic curve and is a point of order . For products of two irreducible quadratics, the elliptic curve is the Jacobian of the curve , and the point of order is represented by the degree- divisor on whose double is the divisor of .
We also have a similar result for quartics with exactly one irreducible quadratic factor, which works in all characteristics.
Theorem 3.6.
Given a prime power , let be a generator of . Let
and let be the set of homogenized minimal polynomials of the elements of . Then the set is a complete set of unique representatives for the action of on the monic separable homogeneous quartics that have exactly one irreducible quadratic factor.
Proof.
The proof follows the same lines as that of Theorem 3.4, but is much simpler. We move the two rational roots of to and , and then show that up to scaling and inversion, every element of has a unique representative in . We leave the details to the reader. ∎
Remark 3.7.
The function defined in Remark 3.5 can be extended to monic separable quartics with exactly one irreducible quadratic factor; when the two zeros of in are finite we can use the same formula as before, and when we can define . Once again, depends only on the orbit of its argument. On quartics of this type, the set of values attained by is the set of nonsquares in together with . Thus, distinguishes orbits of such quartics from one another.
Theorem 3.6 applies to all finite fields, while Theorems 1.2 and 3.4 require the characteristic to be odd. The following theorem generalizes the latter two results to characteristic . The proof is analogous to those of the earlier theorems, but is made much simpler by the fact that in this case every involution in is conjugate to . We leave the details to the reader.
Theorem 3.8.
Let be a power of , let be the set of elements of of absolute trace , and let be an element of . Then the set
is a complete set of unique representatives for the action of on the monic irreducible homogeneous quartics over , and the set
is a complete set of unique representatives for the action of on the homogeneous quartics over that can be written as the product of two distinct monic irreducible quadratics.∎
Remark 3.9.
Theorems 1.2, 3.4, 3.6, and 3.8 lead to quasilinear-time algorithms to give complete sets of unique representatives for the action of on the various types of quartics discussed in the theorems. The only difficulty is obtaining a primitive element for in Theorems 3.4 and 3.6 and an element of order in for Theorem 1.2. But primitive elements for can be determined deterministically in time for every (see [23]), and the required for Theorem 1.2 can be obtained by taking the square root in of a primitive element for .
In quasilinear time we can also create a table of size that we can use to invert the function , which gives us a way to compute the orbit representatives of quartics with one or two irreducible quadratic factors. The function does not reduce well modulo , but the function does; the corresponding function takes a product in characteristic to .
4. An invariant for irreducible polynomials over finite fields
In this section we define an easily computable invariant222Classically, an invariant on the set of homogeneous bivariate polynomials of degree is a function that is constant on orbits. We use the term more generally here, and simply mean a function from to any set that is constant on orbits. for monic irreducible homogeneous bivariate polynomials of arbitrary degree over a finite field under the action of mentioned in Section 2. The invariant is based on the classical cross ratio, which is the function that assigns to an ordered quadruple of distinct elements of the element for which , where is the unique element of that sends to , to , and to . It follows that the cross ratio is constant on the orbits of the diagonal action of on such quadruples, and takes distinct values on distinct orbits. (Compare to [5, Definition III.3.7] and the propositions following it.)
Definition 4.1.
Let be a prime power and let be a monic irreducible homogeneous bivariate polynomial of degree over . We define the cross polynomial of as follows: Let be a root of , and let be the cross ratio of , , , and ; that is,
Then set to be the characteristic polynomial of over .
Note that the denominator of is nonzero, because the powers of involved are four of the distinct conjugates of . Also, replacing with one of its conjugates results in replacing with a conjugate, so the characteristic polynomial remains unchanged. Thus we see that is well-defined.
Theorem 4.2.
Let be a prime power. Two monic irreducible homogenous polynomials in of degree at least lie in the same orbit under the action of if and only if they have the same cross polynomial.
Proof.
Suppose and are irreducible homogenous polynomials in of degree at least . Suppose and lie in the same orbit, say for some . Then and have the same degree, which we denote by . Let be a root of in and let . Then is a root of , and for every we have . In particular, the cross ratio of , , , and is equal to the cross ratio of , , , and , so .
Conversely, suppose and are two monic irreducible polynomials of degree at least with . Since a polynomial has the same degree as its cross polynomial, and have the same degree, say . Since the cross polynomials are equal, there are roots of and of in such that , , , and have the same cross ratio as , , , and . It follows that there is an element of with for . In particular, we have for three distinct values of , namely , , and , so is fixed by Frobenius and therefore lies in . Thus, takes every root of to a root of , so . ∎
As an application of this invariant, we give an algorithm for creating a table of orbit representatives for irreducible polynomials of degree in time .
Algorithm 4.3.
Inverting the cross polynomial function.
-
Input:
A prime power and an integer .
-
Output:
A table, indexed by the values of the cross polynomials for irreducible polynomials of degree , giving for each cross polynomial an irreducible homogeneous of degree with .
-
1.
Construct a copy of with an -basis such that appears with nonzero coefficient in the representation of .
-
2.
Set to be the empty list.
-
3.
For every that does not lie in a proper subfield, and whose representation on the given basis has and has for the first with , do:
-
(a)
Compute the homogenization of the minimal polynomial of .
-
(b)
Compute .
-
(c)
Append the pair to .
-
(a)
-
4.
Sort .
-
5.
Delete every entry of for which the value of appears earlier in the list.
-
6.
Return .
Proposition 4.4.
Algorithm 4.3 produces correct output and runs in time , measured in arithmetic operations in .
Proof.
First we note that every orbit contains an as in step (3). We can see this because starting with an arbitrary , we can subtract an element of to zero out the coefficient of , and then we can scale by an element of so that the first nonzero coefficient is . It follows that every orbit will have a representative included in the output, and step (5) ensures that there is only one representative given for each orbit. Thus the output is correct. Now we analyze the timing.
For fixed , Shoup’s algorithm [22] can construct a finite field in time , and in polynomial time [15] we can find an embedding of our given into this copy of , so step (1) can be done within the stated time bound. Because is fixed, for each the values of and can be computed in time , so creating the list takes time . Finally, sorting a list of length takes time (see [13, §5.2.3]). ∎
5. Explicit coset representatives for in
As part of our algorithm, we will need to have a complete set of unique representatives for the right cosets of the subgroup of . In this section we give an explicit set of such representatives.
Throughout this section, is a prime power, is an element of , and is a generator of the multiplicative group of .
An element of is determined by where it sends , , and , and given any three distinct elements of , there is an element of that sends , , and to those three elements. Thus, we may represent elements of by triples of pairwise distinct elements of , indicating the images of , , and . If is an element of , then sends the element of to .
Proposition 5.1.
Let be the set The following elements give a complete set of unique coset representatives for the left action of on :
-
(1)
;
-
(2)
;
-
(3)
;
-
(4)
;
-
(5)
.
To prove this proposition, we need the following lemma.
Lemma 5.2.
With notation as above, let be the subgroup of that fixes the element . Then the set from Proposition 5.1 is a complete set of unique representatives for the left action of on .
Proof.
Let and let . We check that the group is equal to
Let so that sends to and to . We compute that
By Hilbert , the set of values attained by is equal to the set of elements of whose norms to are equal to , and these elements are precisely the powers of . Thus, the action of on is generated by multiplication by , and it is easy to see that the values are orbit representatives for this action. Applying to these orbit representatives will give us orbit representatives for the action of on , and we see that . ∎
Proof of Proposition 5.1.
Suppose we are given an element of . We will show how to modify it by elements of to put it into one of the forms listed in the proposition. In the course of this demonstration, it will become clear that the elements listed in the proposition do indeed lie in different orbits, because they are fixed by the following procedure.
Recall that is an element of . Given a triple representing an element of , we do the following:
-
(1)
If lies in : In this case, we can apply an element of that moves to . Our element of can now be written , for some new values of and . We can now only apply elements of that fix ; that is, we are limited to the so-called group.
-
(a)
If lies in : In this case, we can use the group to move to . Our element of can now be written , for some new value . Now we can only apply elements of that fix and ; that is, we are limited to scalar multiplication.
-
(i)
If lies in : In this case, we can scale so that it is equal to . We obtain the element listed in part (1) of the proposition, and no further action of is possible.
-
(ii)
If does not lie in : We can write for elements of , with nonzero. There is a unique scaling that will put into the form . We obtain an element from part (2) of the proposition.
-
(i)
-
(b)
If does not lie in : Using the group, we can move to . There is no further action of that fixes and , so can be any element of other than . This gives us an element from part (3) of the proposition.
-
(a)
-
(2)
If does not lie in : In this case, is an element of , and we can use the subgroup of to move to . The only elements of that we can apply once we have fixed are the elements of the group from Lemma 5.2.
- (a)
-
(b)
If is not equal to : We can use to move to a unique element of . Once we have normalized in this way, there is no further action of that fixes and , so can be any element of other than and . This gives us an element from part (5) of the proposition.
These cases enumerate all of the possibilities for our element , so the proposition is proved. ∎
6. Explicit coset representatives for in
It is not necessary for proving our main theorem, but there is a result analogous to Proposition 5.1 for the cosets of in , where is an odd prime. As before, we represent elements of as triples of distinct elements of , indicating where the given element of sends , , and .
Proposition 6.1.
Let be a prime power and let be an odd prime. Let be a set of orbit representatives for the action of on , let be a set of orbit representatives for the action of the subgroup of on , and let be a set of orbit representatives for the multiplicative action of on .
The following elements give a complete set of unique coset representatives for the left action of on :
-
(1)
;
-
(2)
;
-
(3)
;
-
(4)
.
Proof.
The proof is much like that of Proposition 5.1, but simpler. Suppose we are given an arbitrary in . If and both lie in , we can move them to and , and then we can only modify by scaling by elements of . If lies in we get case (1), and if not we get case (2).
If lies in but does not, we move to using . Then the only action of we have left to us is the subgroup. Since lies in , we can use this subgroup to move to an element of . Then can be arbitrary, as long as it is different from and from . This gives us case (3).
If does not lie in then we can move using so that it lies in , and there is no further action of left available to us, because the only elements of with nontrivial stabilizers lie in . This gives us case (4). ∎
This result is useful because we can compute the sets of representatives we need.
Algorithm 6.2.
Orbit representatives for acting on the elements of that do not lie in proper subfields.
-
Input:
A prime power and an integer .
-
Output:
A complete set of unique representatives for the action of on the the elements of that do not lie in proper subfields.
-
1.
Set and to be empty lists.
-
2.
Construct a copy of with an -basis such that appears with nonzero coefficient in the representation of .
-
3.
If return a list containing the single element , and stop.
-
4.
For every that does not lie in a proper subfield, and whose representation on the given basis has and has for the first with , do:
-
(a)
Compute for . If any of these conjugates is smaller than or equal to under a fixed ordering , continue on to the next value of .
-
(b)
Compute the minimal polynomial of .
-
(c)
Find the (unique) irreducible factor of .
-
(d)
Append the pair to .
-
(a)
-
5.
Sort .
-
6.
Delete every element of such that appears as a first entry of an element earlier in the list.
-
7.
For every in , do:
-
(a)
For , append the element to .
-
(a)
-
8.
Return .
Proposition 6.3.
Algorithm 6.2 produces a complete list of unique representatives for the orbits of acting on the elements of that lie in no proper subfield. It runs in time .
Proof.
When , the group acts transitively on , so step (3) gives correct output. For , Algorithm 6.2 is a variation on Algorithm 4.3. The only additional fact we must note is that there is an element of that takes to one of its nontrivial conjugates if and only if the cross polynomial of is not irreducible, and that the order of each such element of is equal to the exponent such that . Thus, the Galois orbit of contains representatives of exactly orbits. ∎
7. Enumerating orbit representatives for
In this section we present our algorithm for enumerating orbit representatives for the action of on in time , for fixed and varying. The algorithm consists of a number of different algorithms, each addressing a subset of elements of . The problem is trivial when , so we will always assume that , and for one case we will also demand that be even. This is sufficient for our application to enumerating hyperelliptic curves of genus , where is even and at least . (See [9] for an algorithm that works for all .)
Recall that an element of is a set of distinct elements of that is stable under the action of the Galois group of over . An element of is primitive if the degree of each extension over is equal to . Every element of can be written in a unique way (up to order) as the union of a collection of primitive elements of , for some sequence of integers with . The sequence , listed in non-increasing order, is the Galois type of . If is the monic homogeneous polynomial whose zero set is , then is also the list of the degrees of the irreducible factors of , and we also refer to this sequence as the Galois type of . We will enumerate the orbits of by enumerating each Galois type separately.
Let be a Galois type for , so that and . In the following subsections we show how to enumerate the orbits of the elements of of this Galois type, based on the value of .
7.1. The case
Every element of of this Galois type is simply a collection of distinct elements of . We can specify a standard form for such elements by considering all possible choices of three distinct points , , and in , and using an element of to move those three points to , , and , respectively. To this choice we associate the polynomial of degree defined by
Our standard form for is the smallest polynomial obtained in this way, under an arbitrary total ordering of the monic homogeneous polynomials of degree .
Our algorithm for enumerating orbit representatives of this Galois type is as follows.
Algorithm 7.1.
Orbit representatives for acting on the elements of of Galois type .
-
Input:
A prime power and an integer .
-
Output:
A complete set of unique representatives for the action of on the monic homogenous polynomials of degree and Galois type .
-
1.
Set to be the empty list, and set , , and .
-
2.
For every set of distinct elements of do:
-
(a)
Set .
-
(b)
Set , where ranges over the elements of that send three elements of to , , and .
-
(c)
If is the smallest element of under the ordering , append to .
-
(a)
-
3.
Return .
Proposition 7.2.
Algorithm 7.1 produces a complete set of unique representatives for the orbits of acting on the monic homogeneous degree- polynomials of Galois type . It runs in time , measured in arithmetic operations in . ∎
7.2. The case
When the possible Galois types consist of values of and values of , where and . We present two algorithms, one that applies when and one that applies when . Since we are assuming throughout that , the only remaining case is when and , but that situation is handled by Theorem 3.6.
Algorithm 7.3.
Orbit representatives for acting on the elements of of Galois type of the form , with entries of and entries of , where .
-
Input:
A prime power , an integer , and integers and with and .
-
Output:
A complete set of unique representatives for the action of on the monic homogenous polynomials of degree with the given Galois type.
-
1.
Set to be the empty list, and set , , and .
-
2.
Create a list of the monic irreducible homogeneous quadratics over .
-
3.
For every set of distinct elements of and every set of distinct elements of do:
-
(a)
Set .
-
(b)
Set , where ranges over the elements of that send three elements of to , , and .
-
(c)
If is the smallest element of under the ordering , append to .
-
(a)
-
4.
Return .
Proposition 7.4.
Algorithm 7.3 produces a complete set of unique representatives for the orbits of acting on the monic homogeneous degree- polynomials of Galois type , with entries of and entries of . It runs in time , measured in arithmetic operations in . ∎
Algorithm 7.5.
Orbit representatives for acting on the elements of of Galois type of the form , with entries of and entries of , where .
-
Input:
A prime power , an integer , and integers and with and .
-
Output:
A complete set of unique representatives for the action of on the monic homogenous polynomials of degree with the given Galois type.
-
1.
Set to be the empty list.
-
2.
Let be the set of polynomials .
-
3.
Create a list of the monic irreducible homogeneous quadratics over .
-
4.
For every pair of irreducible quadratic factors obtained from Theorem 3.4 or Theorem 3.8, for every set of elements of such that the quadratics are distinct, and for every set of distinct elements of , do:
-
(a)
Set .
-
(b)
Set , where ranges over the elements of that send a pair of elements of to the representative of their orbit, calculated using the table mentioned at the end of Remark 3.9.
-
(c)
If is the smallest element of under the ordering , append to .
-
(a)
-
5.
Return .
Remark 7.6.
Proposition 7.7.
Algorithm 7.5 produces a complete set of unique representatives for the orbits of acting on the monic homogeneous degree- polynomials of Galois type , with entries of and entries of . It runs in time , measured in arithmetic operations in . ∎
7.3. The case
Let be a Galois type with . When we will make use of the list of orbit representatives of irreducible polynomials of degree provided by Algorithm 4.3, which will not exceed our claimed time bound of because . When we will use the fact that there is exactly one orbit of irreducible degree- polynomials, so we can take our favorite irreducible polynomial of degree as the sole orbit representative.
Algorithm 7.8.
Orbit representatives for acting on the elements of of Galois type , with .
-
Input:
A prime power , an integer , and a Galois type with .
-
Output:
A complete set of unique representatives for the action of on the monic homogenous polynomials of degree with the given Galois type.
-
1.
Set to be the empty list.
-
2.
For each value of in the set , create a list of the monic irreducible homogeneous polynomials of degree .
-
3.
If , let be the output of Algorithm 4.3 associated to the inputs and and let be the list of orbit representatives of irreducible polynomials of degree obtained as the second elements of each pair on the list .
-
4.
If let be the single-element list consisting of an arbitrary irreducible polynomial of degree .
-
5.
For every element of and every set of distinct polynomials with do:
-
(a)
Set
-
(b)
Let be the set of of degree and set , where ranges over the elements of that send an element of to its associated orbit representative, obtained by computing its cross polynomial and using the lookup table if and by direct calculation if .
-
(c)
If is the smallest element of under the ordering , append to .
-
(a)
-
6.
Return .
Remark 7.9.
Proposition 7.10.
Algorithm 7.8 produces a complete set of unique representatives for the orbits of acting on the monic homogeneous degree- polynomials of the given Galois type. It runs in time , measured in arithmetic operations in .
7.4. The case
This is the first and only case in which we will require to be even. The case is covered by Theorems 1.2 and 3.8, so we may assume that . Note that we cannot just apply Algorithm 4.3, because that takes time , and we want an algorithm that takes time .
Algorithm 7.11.
Orbit representatives for acting on the elements of of Galois type , where is even.
-
Input:
A prime power and an even integer .
-
Output:
A complete set of unique representatives for the action of on the monic irreducible homogenous polynomials of degree .
-
1.
If , let be the list consisting of a single monic irreducible cubic homogeneous polynomial in .
- 2.
-
3.
If , use Algorithm 4.3 to create a list of orbit representatives for the action of acting on the monic irreducible homogeneous polynomials of degree in .
-
4.
Let be the list of coset representative for the left action of on from Proposition 5.1.
-
5.
Let be the list consisting of , for all and in .
-
6.
Let be the list of all products for , where the superscript means to raise each coefficient of a polynomial to the th power.
-
7.
Let be the list of all pairs for .
-
8.
Sort , and then delete every entry where appears as the first element of an earlier entry in .
-
9.
Let be the list of second elements of the entries in .
-
10.
Return .
Proposition 7.12.
Algorithm 7.11 produces a complete set of unique representatives for the orbits of acting on the monic irreducible homogeneous polynomials of degree . It runs in time , measured in arithmetic operations in .
Proof.
To prove correctness, we must show that the list consists of unique representatives for each orbit of irreducible polynomials of degree over . First we show that it contains at least one representative from each orbit.
We know that every monic irreducible homogeneous polynomial of degree in can be written for a monic irreducible homogeneous polynomial in of degree , and is unique up to . If we can show that the list contains an element in every orbit of acting on the left on the set of monic irreducible homogeneous polynomials of degree in , then that will show that contains at least one element in every orbit of acting on the monic irreducible homogeneous polynomials of degree in . But since is a list of representative for the orbits of acting on , and since consists of coset representatives for acting on , this is clear. Thus, contains a representative from each orbit of acting on the set of monic irreducible homogeneous polynomials of degree in . In fact, contains at most two such representatives for each orbit, because of the uniqueness of up to .
By construction (and by Theorem 4.2), the list contains at most one representative from each orbit of acting on the irreducible polynomials. But we already saw that it contains at least one such representative. Therefore, it is a complete list of unique representatives.
8. Additional efficiencies
In this section we mention a few ways that the algorithms in Section 7 can be improved. The asymptotic complexity of the revised algorithms is still , but the speedups in this section improve the algorithms by constant factors.
8.1. Avoiding repeated orbits
Several of our algorithms include a step to deal with elements of that can be normalized (in the manner of the particular algorithm) in several ways. This happens in steps (2)(b) and (c) of Algorithm 7.1, in steps (3)(b) and (c) of Algorithm 7.3, in steps (4)(b) and (c) of Algorithm 7.5, and in steps (5)(b) and (c) of Algorithm 7.8. In Algorithm 7.8, for example, this is needed when there is more than one occurrence of the number in the Galois type. The algorithm normalizes elements of of the given Galois type (represented by monic homogeneous polynomials of degree ) by absorbing all of the action of into one factor of degree . If there is more than one such factor, there is more than one normalization of the same polynomial, and the algorithm has to identify the resulting repeated orbits and return only one of them. (There is also more than one normalization if a factor of degree has nontrivial stabilizer, but that is rare.)
The most straightforward way to avoid this situation is to handle Galois types with occurring more than once in a different way. For instance, if we are working with the Galois type , instead of normalizing on the factors of degree (for which there are two choices), we can instead normalize on the factor of degree . This technique can be used to handle every Galois type that includes at least one value of that is at least and that occurs just once in the type. Similarly, if the value occurs in a type exactly twice, we can normalize the product of two irreducible quadratics.
If we have a Galois type with where this is impossible — for example, — we have another option. We use a modified version of Algorithm 4.3 where we skip step (5); this gives us a list of all monic irreducible polynomials of degree , grouped by their cross polynomials. Then, in Algorithm 7.8, in step (5) we do not consider all sets of distinct polynomials ; instead, we demand that the cross polynomial of every whose degree is equal to not appear earlier on the sorted list that that of . If in fact all of the additional cross polynomials are different from the cross polynomial of , the orbit representative we obtain will not be repeated unless the stabilizer of is nontrivial, which is unusual (and easy to check). If some of the additional cross polynomials are the same as that of , then we keep track of this orbit on a separate list, and deduplicate this (much smaller) list separately.
8.2. Treating the Galois types and more efficiently
Consider the Galois type , corresponding to a product of a linear homogeneous polynomial with an irreducible homogeneous polynomial of degree . Instead of absorbing all the action into the choice of the irreducible polynomial of degree , we can instead demand that the linear polynomial have its zero at . Then we have to find representatives for irreducible homogeneous polynomials of degree up to the group. We can accomplish this by modifying the technique of Algorithm 4.3: We construct a copy of , we choose a basis such that appears with a nonzero coefficient in the representation of , and then we simply list the minimal polynomials of elements whose representation on the given basis begins , with at least one at the beginning and with the first nonzero element being . We can also take care to produce only one element from each Galois orbit at this stage, in order to avoid using cross polynomials to deduplicate the list later.
For the Galois type , we look for orbit representatives of the form for irreducible homogeneous of degree . We can modify only by replacing with or , so we can construct a copy of with basis , list the minimal polynomials of the elements whose representations on the given basis have their first nonzero element equal to , and then deduplicate as usual.
8.3. More efficient computations of orbits of irreducibles
In step (3) of Algorithm 7.8, we obtain a list of orbit representatives for irreducible polynomials of a given degree by using Algorithm 4.3. If is composite, we can use a more efficient algorithm based on the idea of Algorithm 7.11. Namely, if , we can compute orbit representatives for acting on irreducible polynomials in of degree , and then use Proposition 5.1 or Proposition 6.1 to list coset representatives for in . As in Algorithm 7.11, we can combine these two lists to get a complete list of unique orbit representatives for acting on irreducible polynomials of degree .
In fact, what we have just shown is that if is composite, we can compute a complete set of unique representatives for the orbits of acting on the monic irreducible homogeneous polynomials of degree in time . This leaves open the case when is prime. In a followup paper [9], we explain a completely different technique that will produce these orbit representatives for prime — indeed, for odd — in time , but no longer deterministically, because the method relies on factoring polynomials of bounded degree in polynomial time.
9. Implementations for genus and genus
We have implemented our algorithm for hyperelliptic curves of genus and genus in Magma [2]. Magma files with the implementations can be found in several places: in the ancillary files attached the the arXiv version of this paper, on the author’s web page, and in the GitHub repository associated to this paper [10]. In addition to the improvements described in Section 8 and others of a similar nature, our code for the genus- case includes an improvement for the Galois type that allows us to skip the deduplication step in Algorithm 7.11. The basic idea is to choose the irreducible cubic polynomial in step (1) of Algorithm 7.11 so that it lies in and so that its zeros are permuted by the order- element of , so that it is easier to keep track of which elements of in give rise to homogeneous sextic polynomials that lie in the same orbit. The details are too lengthy to include here, but are spelled out in the comments in the code, as well as in the followup paper [9]. Other improvements are described in the comments as well.
For our genus- implementation, we did not spend as much time optimizing, and there are very likely improvements that can be made.
Genus 2 | Genus 3 | ||||||||
---|---|---|---|---|---|---|---|---|---|
This paper | This paper | ||||||||
Magma | Curves | Total | Magma | Curves | Total | ||||
We ran some timing experiments to compare our Magma code to the built-in Magma functions that implement the algorithms of Mestre [19] and Cardona and Quer [4] for genus- curves, and the algorithms of Lercier and Ritzenthaler [16] for genus- curves. We give some sample timings in Table 1, taken by running Magma (V2.28-8) on one core of an Apple M1 Max processor with 64GB RAM. For our algorithm, we divide our timings into two steps: computation of the orbit representatives of and computation of the isomorphism classes of curves. Our algorithm includes a computation of the automorphism groups of the curves, which gives us a consistency check, since the sum over all hyperelliptic curves of genus over of over the size of the automorphism group is equal to [3, Proposition 7.1].
We compare our genus- timings to those of applying the Magma command
Twists(HyperellipticCurveFromG2Invariants([a,b,c]))
to all triples of elements of and then retrieving the polynomials that define the resulting curves. For we estimate the time for the Magma builtin functions by running the above command on random triples and multiplying the time taken by ; these estimates are indicated with asterisks. We see that our genus- code is running approximately times faster than Magma’s internals.
We compare our genus- timings to those of applying the Magma command
TwistedHyperellipticPolynomialsFromShiodaInvariants(S)
to all Shioda invariants with nonzero discriminants, obtained by applying
ShiodaAlgebraicInvariants(V : ratsolve := true)
to every element of the -dimensional weighted projective space over with weights and discarding those with discriminant . For and we estimate Magma’s times as before. It appears that our genus- code is running several hundred times faster than Magma’s internals.
For genus- curves over , our code spent of the time on Galois type , on type , and on type , with the remaining of the time divided among the remaining eight types. For genus- curves over , our code spent of the time on Galois type , on type , on type , and on type , with the remaining of the time divided among the remaining eighteen types.
We note that memory handling issues may have slowed the genus- computation for , which reemphasizes the point, made in the introduction, that it would be good to have a version of our algorithm for higher genera that requires less space. We have not yet implemented the low-memory algorithm from [9] to see whether that will help improve our timings for larger .
References
- [1] Jonas Bergström, Everett W. Howe, Elisa Lorenzo García, and Christophe Ritzenthaler, Refinements of Katz–Sarnak theory for the number of points on curves over finite fields, Canad. J. Math. (2024), online, not yet assigned an issue.
- [2] Wieb Bosma, John Cannon, and Catherine Playoust, The Magma algebra system. I. The user language, J. Symbolic Comput. 24 (1997), no. 3-4, 235–265, Computational algebra and number theory (London, 1993). Software available at http://magma.maths.usyd.edu.au/. MR 1484478
- [3] Bradley W. Brock and Andrew Granville, More points than expected on curves over finite field extensions, Finite Fields Appl. 7 (2001), no. 1, 70–91. MR 1803936
- [4] Gabriel Cardona and Jordi Quer, Field of moduli and field of definition for curves of genus 2, Computational aspects of algebraic curves, Lecture Notes Ser. Comput., vol. 13, World Scientific Publishing, Hackensack, NJ, 2005, pp. 71–83. MR 2181874
- [5] John B. Conway, Functions of one complex variable, second ed., Graduate Texts in Mathematics, vol. 11, Springer-Verlag, New York–Berlin, 1978, Available for digital loan. MR 503901
- [6] Dušan Dragutinović, Computing binary curves of genus five, J. Pure Appl. Algebra 228 (2024), no. 4, Paper No. 107522, 19. MR 4642980
- [7] Sarah Frei, The -number of hyperelliptic curves, Women in numbers Europe II, Assoc. Women Math. Ser., vol. 11, Springer, Cham, 2018, pp. 107–116. MR 3882708
- [8] Everett W. Howe, Curves of medium genus with many points, Finite Fields Appl. 47 (2017), 145–160. MR 3681085
- [9] by same author, Enumerating places of up to automorphisms of in quasilinear time, 2024, in preparation.
- [10] by same author, everetthowe/hyperelliptic, 2024, online GitHub repository, accessed March 2024.
- [11] Everett W. Howe, Enric Nart, and Christophe Ritzenthaler, Jacobians in isogeny classes of abelian surfaces over finite fields, Ann. Inst. Fourier (Grenoble) 59 (2009), no. 1, 239–289. MR 2514865
- [12] Yongyuan Huang, Kiran S. Kedlaya, and Jun Bo Lau, A census of genus curves over , 2024. arXiv:2402.00716 [math.AG]
- [13] Donald E. Knuth, The art of computer programming. Vol. 3: Sorting and searching, second ed., Addison-Wesley, Reading, MA, 1998. MR 3077154
- [14] Tetsuo Kodama, Jaap Top, and Tadashi Washio, Maximal hyperelliptic curves of genus three, Finite Fields Appl. 15 (2009), no. 3, 392–403. MR 2516433
- [15] Hendrik W. Lenstra, Jr., Finding isomorphisms between finite fields, Math. Comp. 56 (1991), no. 193, 329–347. MR 1052099
- [16] Reynald Lercier and Christophe Ritzenthaler, Hyperelliptic curves and their invariants: geometric, arithmetic and algorithmic aspects, J. Algebra 372 (2012), 595–636. MR 2990029
- [17] Qing Liu, Algebraic geometry and arithmetic curves, Oxford Graduate Texts in Mathematics, vol. 6, Oxford University Press, Oxford, 2002, Translated from the French by Reinie Erné, Available for digital loan. MR 1917232
- [18] Daniel Maisner and Enric Nart, Abelian surfaces over finite fields as Jacobians, Experiment. Math. 11 (2002), no. 3, 321–337, With an appendix by Everett W. Howe. MR 1959745
- [19] Jean-François Mestre, Construction de courbes de genre à partir de leurs modules, Effective methods in algebraic geometry (Castiglioncello, 1990), Progr. Math., vol. 94, Birkhäuser Boston, Boston, MA, 1991, pp. 313–334. MR 1106431 (92g:14022)
- [20] Enric Nart, Counting hyperelliptic curves, Adv. Math. 221 (2009), no. 3, 774–787. MR 2511037
- [21] Jean-Pierre Serre, Cohomologie galoisienne, fifth ed., Lecture Notes in Mathematics, vol. 5, Springer-Verlag, Berlin, 1994. MR 1324577
- [22] Victor Shoup, New algorithms for finding irreducible polynomials over finite fields, Math. Comp. 54 (1990), no. 189, 435–447. MR 993933
- [23] Igor Shparlinski, On finding primitive roots in finite fields, Theoret. Comput. Sci. 157 (1996), no. 2, 273–275. MR 1389773
- [24] Xavier Xarles, A census of all genus curves over the field with elements, 2020. arXiv:2007.07822 [math.AG]