Abelian Group for Elliptic Curve

To produce the abelian group for an elliptic curve.

Given a field, and a conventional elliptic curve in that field, provide the group operation for the abelian group. (((fileVal "AGEC") field sqrt) a b) returns tools for the Abelian group for that curve. Here a point means a pair of values, <x, y> where x and y are both field elements such that y2 = x3 + ax + b (the WeierstraƟ equation). . The multiplication and addition in this equation are from the given field. There is also an honorary point at infinity which serves as the group identity and that we call 0 here. Together these points form an Abelian (commutative) group defined by the peculiar rule that when three points, A, B, C, are on a line, then A+B+C = 0. A line is defined by field values a, b and c, not all zero. For a point <x, y> to be on the line (a, b, c) means that ax+by+c=0.

This is the code which is designed to be used in this framework.

In AG = (((fileVal "AGEC") field sqrt) a b) the argument field is a list such as returned by ((fileVal "GFpq") p q st). sqrt takes a field value and returns some y such that y2 = x modulo the characteristic of the field, if there is one, and returns 'none otherwise. AG is a function that maps selected symbols to particular group tools. (AG 'add) is the operation of the Abelian group. ((AG 'add) p q) returns the curve-sum of the two points p and q. (AG 'neg) is point negation (the group inverse operator), and (AG 'mul) is multiplication of an integer by a point. ((AG 'mul) n p) yields p added to itself n times where p is a point and n is an integer. (AG 'pg) returns a generator of random points on the curve. If (AG 'pg) is not used then the 2nd argument of (fileVal "AGEC") is not used. Points are either pairs of field values or the integer 0 for the honorary point.

((fileVal "AGEC") field) yields #f if the characteristic of the field is 2 or 3 and (((fileVal "AGEC") field) a b) yields #f if the discriminant of the curve is zero. Since I have a square root for GF(p) but not GF(Pq) just now we stick to prime fields for now.

For some odd prime p ((fileVal "AGECp") p a b) returns the same tool set as above but for the curve y2 = x3 + ax + b modulo p.

This is the first reference I have found that describes how the number of points on an elliptic curve over a finite field is found.
elliptic curve