Module Pari.Elliptic_curve

type 'a t constraint 'a = 'b ty
type 'a elt = 'a elliptic_curve ty constraint 'a = 'b ty
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 t -> l:Signed.Long.t -> 'a ty 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.t ty 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
val ellanalyticrank : Rational.t t -> (Rational.t, [ `ROW ]) Vector.t
# let ell = Option.get (Elliptic_curve.create ~a6:(Rational.of_int 6) ());;
val ell : Rational.t Elliptic_curve.t = <abstr>
# Elliptic_curve.ellanalyticrank ell |> Vector.to_string
- : string = "[0, 3.1205690727970642238215206887060527526]"
val ellanalyticrank_bitprec : 'a ty -> 'a ty -> Signed.long -> 'a ty
val ellanal_globalred_all : 'a ty -> 'a ty Ctypes_static.ptr -> 'a ty Ctypes_static.ptr -> 'a ty Ctypes_static.ptr -> 'a ty
val ellsupersingularj_fpxq : 'a ty -> 'a ty -> 'a ty
val elltrace_extension : 'a ty -> Signed.long -> 'a ty -> 'a ty
val ellheegner : 'a ty -> 'a ty
val elll1 : 'a ty -> Signed.long -> Signed.long -> 'a ty
val elll1_bitprec : 'a ty -> Signed.long -> Signed.long -> 'a ty
val ellconvertname : 'a ty -> 'a ty
val elldatagenerators : 'a ty -> 'a ty
val ellidentify : 'a ty -> 'a ty
val ellsearch : 'a ty -> 'a ty
val ellsearchcurve : 'a ty -> 'a ty
val ell_is_integral : 'a ty -> int
val ellq_get_cm : 'a ty -> Signed.long
val ellq_get_n : 'a ty -> 'a ty
val ellq_get_nfa : 'a ty -> 'a ty Ctypes_static.ptr -> 'a ty Ctypes_static.ptr -> unit
val ellqp_tate_uniformization : 'a ty -> Signed.long -> 'a ty
val ellqp_agm : 'a ty -> Signed.long -> 'a ty
val ellqp_u : 'a ty -> Signed.long -> 'a ty
val ellqp_u2 : 'a ty -> Signed.long -> 'a ty
val ellqp_q : 'a ty -> Signed.long -> 'a ty
val ellqp_ab : 'a ty -> Signed.long -> 'a ty
val ellqp_l : 'a ty -> Signed.long -> 'a ty
val ellqp_root : 'a ty -> Signed.long -> 'a ty
val ellqtwist_bsdperiod : 'a ty -> Signed.long -> 'a ty
val ellr_area : 'a ty -> Signed.long -> 'a ty
val ellr_ab : 'a ty -> Signed.long -> 'a ty
val ellr_eta : 'a ty -> Signed.long -> 'a ty
val ellr_omega : 'a ty -> Signed.long -> 'a ty
val ellr_roots : 'a ty -> Signed.long -> 'a ty
val ellan : 'a ty -> Signed.long -> 'a ty
val ellanq_zv : 'a ty -> Signed.long -> 'a ty
val ellanal_globalred : 'a ty -> 'a ty Ctypes_static.ptr -> 'a ty
val ellap : 'a ty -> 'a ty -> 'a ty
val ellap_cm_fast : 'a ty -> pari_ulong -> Signed.long -> Signed.long
val ellbasechar : 'a ty -> 'a ty
val ellbsd : 'a ty -> Signed.long -> 'a ty
val ellchangecurve : 'a ty -> 'a ty -> 'a ty
val ellchangeinvert : 'a ty -> 'a ty
val ellchangepoint : 'a ty -> 'a ty -> 'a ty
val ellchangepointinv : 'a ty -> 'a ty -> 'a ty
val elleisnum : 'a ty -> Signed.long -> Signed.long -> Signed.long -> 'a ty
val elleta : 'a ty -> Signed.long -> 'a ty
val elleulerf : 'a ty -> 'a ty -> 'a ty
val ellff_get_card : 'a ty -> 'a ty
val ellff_get_gens : 'a ty -> 'a ty
val ellff_get_group : 'a ty -> 'a ty
val ellff_get_o : 'a ty -> 'a ty
val ellff_get_p : 'a ty -> 'a ty
val ellff_get_m : 'a ty -> 'a ty
val ellff_get_d : 'a ty -> 'a ty
val ellfromj : 'a ty -> 'a ty
val ellgenerators : 'a ty -> 'a ty
val ellglobalred : 'a ty -> 'a ty
val ellgroup : 'a ty -> 'a ty -> 'a ty
val ellgroup0 : 'a ty -> 'a ty -> Signed.long -> 'a ty
val ellheight0 : 'a ty -> 'a ty -> 'a ty -> Signed.long -> 'a ty
val ellheight : 'a ty -> 'a ty -> Signed.long -> 'a ty
val ellheightmatrix : 'a ty -> 'a ty -> Signed.long -> 'a ty
val ellheightoo : 'a ty -> 'a ty -> Signed.long -> 'a ty
val ellintegralmodel : 'a ty -> 'a ty Ctypes_static.ptr -> 'a ty
val ellintegralmodel_i : 'a ty -> 'a ty Ctypes_static.ptr -> 'a ty
val elliscm : 'a ty -> Signed.long
val ellisoncurve : 'a ty -> 'a ty -> 'a ty
val ellisotree : 'a ty -> 'a ty
val ellissupersingular : 'a ty -> 'a ty -> int
val elljissupersingular : 'a ty -> int
val elllseries : 'a ty -> 'a ty -> 'a ty -> Signed.long -> 'a ty
val elllocalred : 'a ty -> 'a ty -> 'a ty
val elllog : 'a ty -> 'a ty -> 'a ty -> 'a ty -> 'a ty
val ellminimaldisc : 'a ty -> 'a ty
val ellminimalmodel : 'a ty -> 'a ty Ctypes_static.ptr -> 'a ty
val ellminimaltwist : 'a ty -> 'a ty
val ellminimaltwist0 : 'a ty -> Signed.long -> 'a ty
val ellminimaltwistcond : 'a ty -> 'a ty
val ellnf_vecarea : 'a ty -> Signed.long -> 'a ty
val ellnf_veceta : 'a ty -> Signed.long -> 'a ty
val ellnf_vecomega : 'a ty -> Signed.long -> 'a ty
val ellneg : 'a ty -> 'a ty -> 'a ty
val ellorder : 'a ty -> 'a ty -> 'a ty -> 'a ty
val ellorder_q : 'a ty -> 'a ty -> Signed.long
val ellordinate : 'a ty -> 'a ty -> Signed.long -> 'a ty
val ellpadicheight0 : 'a ty -> 'a ty -> Signed.long -> 'a ty -> 'a ty -> 'a ty
val ellpadicheightmatrix : 'a ty -> 'a ty -> Signed.long -> 'a ty -> 'a ty
val ellperiods : 'a ty -> Signed.long -> Signed.long -> 'a ty
val ellrootno : 'a ty -> 'a ty -> Signed.long
val ellrootno_global : 'a ty -> Signed.long
val ellsaturation : 'a ty -> 'a ty -> Signed.long -> Signed.long -> 'a ty
val ellsea : 'a ty -> Signed.long -> 'a ty
val ellsigma : 'a ty -> 'a ty -> Signed.long -> Signed.long -> 'a ty
val ellsupersingularj : 'a ty -> 'a ty
val elltamagawa : 'a ty -> 'a ty
val elltaniyama : 'a ty -> Signed.long -> 'a ty
val elltatepairing : 'a ty -> 'a ty -> 'a ty -> 'a ty -> 'a ty
val elltors : 'a ty -> 'a ty
val elltors0 : 'a ty -> Signed.long -> 'a ty
val elltors_psylow : 'a ty -> pari_ulong -> 'a ty
val elltrace : 'a ty -> 'a ty -> 'a ty
val elltwist : 'a ty -> 'a ty -> 'a ty
val ellwp : 'a ty -> 'a ty -> Signed.long -> 'a ty
val ellwp0 : 'a ty -> 'a ty -> Signed.long -> Signed.long -> 'a ty
val ellwpseries : 'a ty -> Signed.long -> Signed.long -> 'a ty
val ellxn : 'a ty -> Signed.long -> Signed.long -> 'a ty
val ellzeta : 'a ty -> 'a ty -> Signed.long -> 'a ty
val ellfromeqn : 'a ty -> 'a ty
val ellformaldifferential : 'a ty -> Signed.long -> Signed.long -> 'a ty
val ellformalexp : 'a ty -> Signed.long -> Signed.long -> 'a ty
val ellformallog : 'a ty -> Signed.long -> Signed.long -> 'a ty
val ellformalpoint : 'a ty -> Signed.long -> Signed.long -> 'a ty
val ellformalw : 'a ty -> Signed.long -> Signed.long -> 'a ty
val ellnonsingularmultiple : 'a ty -> 'a ty -> 'a ty
val ellpadicl : 'a ty -> 'a ty -> Signed.long -> 'a ty -> Signed.long -> 'a ty -> 'a ty
val ellpadicbsd : 'a ty -> 'a ty -> Signed.long -> 'a ty -> 'a ty
val ellpadicfrobenius : 'a ty -> pari_ulong -> Signed.long -> 'a ty
val ellpadicheight : 'a ty -> 'a ty -> Signed.long -> 'a ty -> 'a ty
val ellpadiclog : 'a ty -> 'a ty -> Signed.long -> 'a ty -> 'a ty
val ellpadicregulator : 'a ty -> 'a ty -> Signed.long -> 'a ty -> 'a ty
val ellpadics2 : 'a ty -> 'a ty -> Signed.long -> 'a ty
val ell2cover : 'a ty -> Signed.long -> 'a ty
val ellrank : 'a ty -> Signed.long -> 'a ty -> Signed.long -> 'a ty
val ellrankinit : 'a ty -> Signed.long -> 'a ty
val ellisdivisible : 'a ty -> 'a ty -> 'a ty -> 'a ty Ctypes_static.ptr -> Signed.long
val ellisogenyapply : 'a ty -> 'a ty -> 'a ty
val ellisogeny : 'a ty -> 'a ty -> Signed.long -> Signed.long -> Signed.long -> 'a ty
val ellisomat : 'a ty -> Signed.long -> Signed.long -> 'a ty
val ellweilcurve : 'a ty -> 'a ty Ctypes_static.ptr -> 'a ty
val ell_get_a1 : 'a ty -> 'a ty
val ell_get_a2 : 'a ty -> 'a ty
val ell_get_a3 : 'a ty -> 'a ty
val ell_get_a4 : 'a ty -> 'a ty
val ell_get_a6 : 'a ty -> 'a ty
val ell_get_b2 : 'a ty -> 'a ty
val ell_get_b4 : 'a ty -> 'a ty
val ell_get_b6 : 'a ty -> 'a ty
val ell_get_b8 : 'a ty -> 'a ty
val ell_get_c4 : 'a ty -> 'a ty
val ell_get_c6 : 'a ty -> 'a ty
val ell_get_type : 'a ty -> Signed.long
val ellff_get_field : 'a ty -> 'a ty
val ellff_get_a4a6 : 'a ty -> 'a ty
val ellqp_get_zero : 'a ty -> 'a ty
val ellqp_get_prec : 'a ty -> Signed.long
val ellqp_get_p : 'a ty -> 'a ty
val ellr_get_prec : 'a ty -> Signed.long
val ellr_get_sign : 'a ty -> Signed.long
val ellnf_get_nf : 'a ty -> 'a ty
val ellnf_get_bnf : 'a ty -> 'a ty
val ellmodulareqn : Signed.long -> Signed.long -> Signed.long -> 'a ty
val ellmoddegree : 'a ty -> 'a ty
val ellratpoints : 'a ty -> 'a ty -> Signed.long -> 'a ty
val elle : 'a ty -> Signed.long -> 'a ty
val ellk : 'a ty -> Signed.long -> 'a ty
val ellpadiclambdamu : 'a ty -> Signed.long -> Signed.long -> Signed.long -> 'a ty
val ell_is_inf : 'a ty -> int