Module Pari.Elliptic_curve

type 'a t constraint 'a = ('b, field) typ
type 'a elt = (elliptic_curve, group) typ constraint 'a = ('b, field) typ
val create : ?a1:'a -> ?a2:'a -> ?a3:'a -> ?a4:'a -> ?a6:'a -> ?dom:'a -> unit -> 'a t option

create ?a1 ?a2 ?a3 ?a4 ?a6 defines the curve

Y^2 + a_1 XY + a_3 Y = X^3 + a_2 X^2 + a_4 X + a_6

Returns None if the input coefficients do not define an elliptic curve over the field from the coefficients.

val get_a1 : 'a t -> 'a
val get_a2 : 'a t -> 'a
val get_a3 : 'a t -> 'a
val get_a4 : 'a t -> 'a
val get_a6 : 'a t -> 'a
val of_coordinates : x:'a -> y:'a -> 'a elt
val order : 'a t -> Integer.t
# let g = Finite_field.generator ~order:(Integer.of_int 625) (* 5^4 *);;
val g : Finite_field.t = <abstr>
# let ell = Option.get (Elliptic_curve.create ~a4:(Finite_field.pow g (Integer.of_int 4)) ~a6:(Finite_field.pow g (Integer.of_int 6)) ());;
val ell : Finite_field.t Elliptic_curve.t = <abstr>
# Integer.(to_string (Elliptic_curve.order ell));;
- : string = "675"
val discriminant : 'a t -> 'a
val j_invariant : 'a t -> 'a
val random : 'a t -> 'a elt
val weil_pairing : 'a t -> l:Integer.t -> 'a elt -> 'a elt -> 'a

weil_pairing ell ~l p q returns the Weil pairing of the two points of l-torsion p and q on the elliptic curve ell.

# let l = Integer.of_int 3;;
val l : Integer.t = <abstr>
# let ord = Integer.of_int 103;;
val ord : Integer.t = <abstr>
# let ell = Option.get (Elliptic_curve.create ~a3:(Finite_field.prime_field_element (Integer.of_int 1) ~p:ord) ());;
val ell : Finite_field.t Elliptic_curve.t = <abstr>
# let (p, q) = Elliptic_curve.(of_coordinates ~x:(Finite_field.prime_field_element (Integer.of_int 0) ~p:ord) ~y:(Finite_field.prime_field_element (Integer.of_int 0) ~p:ord), of_coordinates ~x:(Finite_field.prime_field_element (Integer.of_int 57) ~p:ord) ~y:(Finite_field.prime_field_element (Integer.of_int 46) ~p:ord));;
val p : Finite_field.t Elliptic_curve.elt = <abstr>
val q : Finite_field.t Elliptic_curve.elt = <abstr>
# let scalar = Elliptic_curve.weil_pairing ell ~l p q;;
val scalar : Finite_field.t = <abstr>
# Finite_field.to_string scalar (* 56 mod 103 *);;
- : string = "56"
# Finite_field.(to_string (pow scalar l));;
- : string = "1"
val l_division_polynomial : ('a, field) typ t -> l:Signed.Long.t -> ('a, ring) typ Polynomial.t
# let g = Finite_field.generator ~order:(Integer.of_int 625) (* 5^4 *);;
val g : Finite_field.t = <abstr>
# let ell = Option.get (Elliptic_curve.create ~a6:(Finite_field.pow g (Integer.of_int 6)) ());;
val ell : Finite_field.t Elliptic_curve.t = <abstr>
# let pdiv7 = (Elliptic_curve.l_division_polynomial ell ~l:(Signed.Long.of_int 7));;
val pdiv7 : (finite_field, ring) typ Polynomial.t = <abstr>
# Polynomial.to_string pdiv7;;
- : string =
"2*x^24 + (2*x^3 + x^2 + x + 2)*x^21 + (x^3 + x^2 + 3*x + 2)*x^18 + (2*x^3 + x^2 + 3*x)*x^15 + (2*x^3 + 4*x^2 + 3)*x^12 + (4*x^3 + x^2 + 2*x)*x^9 + (3*x^3 + 3*x^2)*x^6 + (4*x^3 + 2*x^2 + 3)*x^3 + (3*x^3 + 3*x^2 + 3*x + 1)"
# Polynomial.degree pdiv7 = ((7 * 7 - 1) / 2);;
- : bool = true
val to_string : 'a t -> string
val add : 'a t -> 'a elt -> 'a elt -> 'a elt
val sub : 'a t -> 'a elt -> 'a elt -> 'a elt
val mul : 'a t -> n:Integer.t -> p:'a elt -> 'a elt
val equal : 'a elt -> 'a elt -> bool
val generators : 'a t -> ('a elt, [ `ROW ]) Vector.t
val zero : 'a t -> 'a elt
val get_coordinates : 'a t -> [> `inf | `point of 'a * 'a ]
val order_elt : 'a t -> 'a elt -> Integer.t
val to_string_elt : 'a elt -> string
val log : 'a t -> base:'a elt -> 'a elt -> Integer.t option