Arithmetic on the Jacobian¶
This module implements the group operation in the Picard group of a hyperelliptic curve, represented as divisors in Mumford representation, using Cantor’s algorithm.
AUTHORS:
Sabrina Kunzweiler, Gareth Ma, Giacomo Pope (2024): adapt to smooth model
- class sage.schemes.hyperelliptic_curves.jacobian_morphism.MumfordDivisorClassField(parent, u, v, check=True)[source]¶
Bases:
AdditiveGroupElement,SchemeMorphismAn element of a Jacobian defined over a field, i.e. in \(J(K) = \mathrm{Pic}^0_K(C)\).
- change_ring(R)[source]¶
Return
selfin the group of points of the Jacobian over a different ring.The argument
Rcan either be a ring or a coercion map into another ring.EXAMPLES:
sage: R.<x> = GF(13)[] sage: H = HyperellipticCurve(x^6 + x + 1) sage: J = H.jacobian() sage: P = J(x + 3, 8, 0) sage: L, phi = GF(13).extension(3, map=True) sage: PL = P.change_ring(L); PL (x + 3, 8 : 0) sage: PL.parent() Abelian group of points over Finite Field in z3 of size 13^3 on Jacobian of Hyperelliptic Curve over Finite Field of size 13 defined by y^2 = x^6 + x + 1 sage: PL = P.change_ring(phi); PL (x + 3, 8 : 0) sage: PL.parent() Abelian group of points over Finite Field in z3 of size 13^3 on Jacobian of Hyperelliptic Curve over Finite Field of size 13 defined by y^2 = x^6 + x + 1
>>> from sage.all import * >>> R = GF(Integer(13))['x']; (x,) = R._first_ngens(1) >>> H = HyperellipticCurve(x**Integer(6) + x + Integer(1)) >>> J = H.jacobian() >>> P = J(x + Integer(3), Integer(8), Integer(0)) >>> L, phi = GF(Integer(13)).extension(Integer(3), map=True) >>> PL = P.change_ring(L); PL (x + 3, 8 : 0) >>> PL.parent() Abelian group of points over Finite Field in z3 of size 13^3 on Jacobian of Hyperelliptic Curve over Finite Field of size 13 defined by y^2 = x^6 + x + 1 >>> PL = P.change_ring(phi); PL (x + 3, 8 : 0) >>> PL.parent() Abelian group of points over Finite Field in z3 of size 13^3 on Jacobian of Hyperelliptic Curve over Finite Field of size 13 defined by y^2 = x^6 + x + 1
R.<x> = GF(13)[] H = HyperellipticCurve(x^6 + x + 1) J = H.jacobian() P = J(x + 3, 8, 0) L, phi = GF(13).extension(3, map=True) PL = P.change_ring(L); PL PL.parent() PL = P.change_ring(phi); PL PL.parent()
- degree()[source]¶
Returns the degree of the affine part of the divisor.
EXAMPLES:
sage: R.<x> = QQ[] sage: H = HyperellipticCurve(6*x^5 + 9*x^4 - x^3 - 3*x^2, 1) sage: J = H.jacobian() sage: J.zero().degree() 0 sage: J(x, 0).degree() 1 sage: J(x^2 + 1/2*x, -x - 1).degree() 2
>>> from sage.all import * >>> R = QQ['x']; (x,) = R._first_ngens(1) >>> H = HyperellipticCurve(Integer(6)*x**Integer(5) + Integer(9)*x**Integer(4) - x**Integer(3) - Integer(3)*x**Integer(2), Integer(1)) >>> J = H.jacobian() >>> J.zero().degree() 0 >>> J(x, Integer(0)).degree() 1 >>> J(x**Integer(2) + Integer(1)/Integer(2)*x, -x - Integer(1)).degree() 2
R.<x> = QQ[] H = HyperellipticCurve(6*x^5 + 9*x^4 - x^3 - 3*x^2, 1) J = H.jacobian() J.zero().degree() J(x, 0).degree() J(x^2 + 1/2*x, -x - 1).degree()
- order()[source]¶
Returns the order of self. This is only implemented over finite fields.
EXAMPLES:
sage: K = FiniteField(7) sage: R.<x> = K[] sage: H = HyperellipticCurve(x^6 + 3*x + 2) sage: JK = Jacobian(H)(K) sage: D = JK(x^2 + 5*x + 6, 6*x + 3) sage: D.order() 38
>>> from sage.all import * >>> K = FiniteField(Integer(7)) >>> R = K['x']; (x,) = R._first_ngens(1) >>> H = HyperellipticCurve(x**Integer(6) + Integer(3)*x + Integer(2)) >>> JK = Jacobian(H)(K) >>> D = JK(x**Integer(2) + Integer(5)*x + Integer(6), Integer(6)*x + Integer(3)) >>> D.order() 38
K = FiniteField(7) R.<x> = K[] H = HyperellipticCurve(x^6 + 3*x + 2) JK = Jacobian(H)(K) D = JK(x^2 + 5*x + 6, 6*x + 3) D.order()
- scheme()[source]¶
Return the scheme this morphism maps to; or, where this divisor lives.
Warning
Although a pointset is defined over a specific field, the scheme returned may be over a different (usually smaller) field. The example below demonstrates this: the pointset is determined over a number field of absolute degree 2 but the scheme returned is defined over the rationals.
EXAMPLES:
sage: x = QQ['x'].gen() sage: f = x^5 + x sage: H = HyperellipticCurve(f) sage: F.<a> = NumberField(x^2 - 2, 'a') # needs sage.rings.number_field sage: J = H.jacobian()(F); J # needs sage.rings.number_field Abelian group of points over Number Field in a with defining polynomial x^2 - 2 on Jacobian of Hyperelliptic Curve over Rational Field defined by y^2 = x^5 + x
>>> from sage.all import * >>> x = QQ['x'].gen() >>> f = x**Integer(5) + x >>> H = HyperellipticCurve(f) >>> F = NumberField(x**Integer(2) - Integer(2), 'a', names=('a',)); (a,) = F._first_ngens(1)# needs sage.rings.number_field >>> J = H.jacobian()(F); J # needs sage.rings.number_field Abelian group of points over Number Field in a with defining polynomial x^2 - 2 on Jacobian of Hyperelliptic Curve over Rational Field defined by y^2 = x^5 + x
x = QQ['x'].gen() f = x^5 + x H = HyperellipticCurve(f) F.<a> = NumberField(x^2 - 2, 'a') # needs sage.rings.number_field J = H.jacobian()(F); J # needs sage.rings.number_field
sage: P = J(H.lift_x(F(1))) # needs sage.rings.number_field sage: P.scheme() # needs sage.rings.number_field Jacobian of Hyperelliptic Curve over Rational Field defined by y^2 = x^5 + x
>>> from sage.all import * >>> P = J(H.lift_x(F(Integer(1)))) # needs sage.rings.number_field >>> P.scheme() # needs sage.rings.number_field Jacobian of Hyperelliptic Curve over Rational Field defined by y^2 = x^5 + x
P = J(H.lift_x(F(1))) # needs sage.rings.number_field P.scheme() # needs sage.rings.number_field
- tate_pairing(Q, n, k=None, q=None)[source]¶
Return the (reduced) Tate pairing of \(P\) =
selfandQ.Let \(P\) be an \(n\)-torsion element of the Jacobian over \(K = \mathbb F_{q^k}\), where \(n\) divides \(q^k-1\), and let \(Q\) be any element of the Jacobian over \(K\). Choose a function \(f_P\) with divisor \(n D_P\), and a divisor \(D_Q\) with support disjoint from \(D_P\). The reduced Tate pairing then equals
\[t_n(P, Q) = f_P(D_Q)^{(q^k-1)/n}.\]The Tate pairing is bilinear and nondegenerate as a pairing \(J[n](K) \times J(K)/nJ(K) \to \mu_n\).
INPUT:
Q– an element of the same group of points of the Jacobian asselfn– positive integer such that \(nP = 0\)k– (optional) positive integer; the embedding degreeq– (optional) positive integer; size of the base field (the “big” field is \(\mathbb F_{q^k}\)). By default, \(q^k\) is the size of the field of definition of the elements.
OUTPUT: an \(n\)-th root of unity in the base field
ALGORITHM:
The function \(f_P\) is computed using Miller’s algorithm and evaluated at a random divisor \(D_Q\). If no suitable divisor is found after a few attempts, which may happen over very small fields, we compute \(u = f_P(D_Q')\) for a divisor \(D_Q'\) over an extension \(L / K\) of degree \(d\) coprime to \(n\). Then \(N_{L/K}(u)\) agrees with \(f_P(D_Q)^d\) up to \(n\)-th powers in \(K^*\), so we recover \(t_n(P, Q) = (N_{L/K}(u)^{(q^k-1)/n})^{1/d}\).
EXAMPLES:
Since \(n\) must divide \(q^k-1\), the Tate pairing can be nondegenerate on elements defined over a field which does not contain the full \(n\)-torsion:
sage: R.<x> = GF(157)[] sage: H = HyperellipticCurve(x^5 + 66*x^4 + 47*x^3 + 15*x^2 + 65*x + 7) sage: J = H.jacobian() sage: J.order().factor() 2 * 7 * 13 * 137 sage: P = J(x^2 + 45*x + 15, 75*x + 136) sage: Q = J(x^2 + 84*x + 87, 81*x + 25) sage: t = P.tate_pairing(Q, 13); t 101 sage: t.multiplicative_order() 13 sage: P.tate_pairing(2*Q, 13) == t^2 True sage: P.tate_pairing(13*Q, 13) 1
>>> from sage.all import * >>> R = GF(Integer(157))['x']; (x,) = R._first_ngens(1) >>> H = HyperellipticCurve(x**Integer(5) + Integer(66)*x**Integer(4) + Integer(47)*x**Integer(3) + Integer(15)*x**Integer(2) + Integer(65)*x + Integer(7)) >>> J = H.jacobian() >>> J.order().factor() 2 * 7 * 13 * 137 >>> P = J(x**Integer(2) + Integer(45)*x + Integer(15), Integer(75)*x + Integer(136)) >>> Q = J(x**Integer(2) + Integer(84)*x + Integer(87), Integer(81)*x + Integer(25)) >>> t = P.tate_pairing(Q, Integer(13)); t 101 >>> t.multiplicative_order() 13 >>> P.tate_pairing(Integer(2)*Q, Integer(13)) == t**Integer(2) True >>> P.tate_pairing(Integer(13)*Q, Integer(13)) 1
R.<x> = GF(157)[] H = HyperellipticCurve(x^5 + 66*x^4 + 47*x^3 + 15*x^2 + 65*x + 7) J = H.jacobian() J.order().factor() P = J(x^2 + 45*x + 15, 75*x + 136) Q = J(x^2 + 84*x + 87, 81*x + 25) t = P.tate_pairing(Q, 13); t t.multiplicative_order() P.tate_pairing(2*Q, 13) == t^2 P.tate_pairing(13*Q, 13)
The Weil pairing can be computed from the Tate pairing:
sage: R.<x> = GF(7)[] sage: H = HyperellipticCurve(x^5 + x) sage: K.<z2> = GF(7^2) sage: J = H.jacobian()(K) sage: P = J(x^2 + (3*z2 + 1)*x + 2*z2 + 2, (3*z2 + 6)*x + z2) sage: Q = J(x^2 + (3*z2 + 5)*x + 3*z2 + 3, (5*z2 + 1)*x + 2*z2) sage: P.tate_pairing(Q, 8) 2*z2 + 1 sage: P.tate_pairing(Q, 8, k=2) == P.tate_pairing(Q, 8, q=7) == P.tate_pairing(Q, 8) True sage: P.tate_pairing(Q, 8) / Q.tate_pairing(P, 8) == P.weil_pairing(Q, 8)^6 True
>>> from sage.all import * >>> R = GF(Integer(7))['x']; (x,) = R._first_ngens(1) >>> H = HyperellipticCurve(x**Integer(5) + x) >>> K = GF(Integer(7)**Integer(2), names=('z2',)); (z2,) = K._first_ngens(1) >>> J = H.jacobian()(K) >>> P = J(x**Integer(2) + (Integer(3)*z2 + Integer(1))*x + Integer(2)*z2 + Integer(2), (Integer(3)*z2 + Integer(6))*x + z2) >>> Q = J(x**Integer(2) + (Integer(3)*z2 + Integer(5))*x + Integer(3)*z2 + Integer(3), (Integer(5)*z2 + Integer(1))*x + Integer(2)*z2) >>> P.tate_pairing(Q, Integer(8)) 2*z2 + 1 >>> P.tate_pairing(Q, Integer(8), k=Integer(2)) == P.tate_pairing(Q, Integer(8), q=Integer(7)) == P.tate_pairing(Q, Integer(8)) True >>> P.tate_pairing(Q, Integer(8)) / Q.tate_pairing(P, Integer(8)) == P.weil_pairing(Q, Integer(8))**Integer(6) True
R.<x> = GF(7)[] H = HyperellipticCurve(x^5 + x) K.<z2> = GF(7^2) J = H.jacobian()(K) P = J(x^2 + (3*z2 + 1)*x + 2*z2 + 2, (3*z2 + 6)*x + z2) Q = J(x^2 + (3*z2 + 5)*x + 3*z2 + 3, (5*z2 + 1)*x + 2*z2) P.tate_pairing(Q, 8) P.tate_pairing(Q, 8, k=2) == P.tate_pairing(Q, 8, q=7) == P.tate_pairing(Q, 8) P.tate_pairing(Q, 8) / Q.tate_pairing(P, 8) == P.weil_pairing(Q, 8)^6
For elliptic curves, we recover
sage.schemes.elliptic_curves.ell_point.EllipticCurvePoint_field.tate_pairing():sage: K.<z2> = GF(11^2) sage: E = EllipticCurve(K, [0, 1]) sage: R.<x> = GF(11)[] sage: J = HyperellipticCurve(x^3 + 1).jacobian()(K) sage: to_J = lambda T: J(x - T.x(), T.y()) if T else J.zero() sage: P = E.torsion_basis(12)[0] sage: Q = E.random_point() sage: to_J(P).tate_pairing(to_J(Q), 12) == P.tate_pairing(Q, 12, 2) True
>>> from sage.all import * >>> K = GF(Integer(11)**Integer(2), names=('z2',)); (z2,) = K._first_ngens(1) >>> E = EllipticCurve(K, [Integer(0), Integer(1)]) >>> R = GF(Integer(11))['x']; (x,) = R._first_ngens(1) >>> J = HyperellipticCurve(x**Integer(3) + Integer(1)).jacobian()(K) >>> to_J = lambda T: J(x - T.x(), T.y()) if T else J.zero() >>> P = E.torsion_basis(Integer(12))[Integer(0)] >>> Q = E.random_point() >>> to_J(P).tate_pairing(to_J(Q), Integer(12)) == P.tate_pairing(Q, Integer(12), Integer(2)) True
K.<z2> = GF(11^2) E = EllipticCurve(K, [0, 1]) R.<x> = GF(11)[] J = HyperellipticCurve(x^3 + 1).jacobian()(K) to_J = lambda T: J(x - T.x(), T.y()) if T else J.zero() P = E.torsion_basis(12)[0] Q = E.random_point() to_J(P).tate_pairing(to_J(Q), 12) == P.tate_pairing(Q, 12, 2)
Over very small fields, the computation may be carried out over an extension field:
sage: S.<t> = GF(3)[] sage: J3 = HyperellipticCurve(t^5 + t^4 + 2*t^2 + t + 2).jacobian() sage: J3.order() 8 sage: P3 = J3(t + 1, 0) sage: Q3 = J3(t + 2, 2) sage: Q3.order() 8 sage: P3.tate_pairing(Q3, 2) 2 sage: P3.tate_pairing(2*Q3, 2) 1
>>> from sage.all import * >>> S = GF(Integer(3))['t']; (t,) = S._first_ngens(1) >>> J3 = HyperellipticCurve(t**Integer(5) + t**Integer(4) + Integer(2)*t**Integer(2) + t + Integer(2)).jacobian() >>> J3.order() 8 >>> P3 = J3(t + Integer(1), Integer(0)) >>> Q3 = J3(t + Integer(2), Integer(2)) >>> Q3.order() 8 >>> P3.tate_pairing(Q3, Integer(2)) 2 >>> P3.tate_pairing(Integer(2)*Q3, Integer(2)) 1
S.<t> = GF(3)[] J3 = HyperellipticCurve(t^5 + t^4 + 2*t^2 + t + 2).jacobian() J3.order() P3 = J3(t + 1, 0) Q3 = J3(t + 2, 2) Q3.order() P3.tate_pairing(Q3, 2) P3.tate_pairing(2*Q3, 2)
- uv()[source]¶
Return the \(u\) and \(v\) component of this Mumford divisor.
EXAMPLES:
sage: x = polygen(GF(1993)) sage: H = HyperellipticCurve(x^7 + 3 * x + 1) sage: J = H.jacobian(); J Jacobian of Hyperelliptic Curve over Finite Field of size 1993 defined by y^2 = x^7 + 3*x + 1 sage: u, v = x^3 + 1570*x^2 + 1930*x + 81, 368*x^2 + 1478*x + 256 sage: P = J(u, v); P (x^3 + 1570*x^2 + 1930*x + 81, 368*x^2 + 1478*x + 256) sage: P.uv() == (u, v) True
>>> from sage.all import * >>> x = polygen(GF(Integer(1993))) >>> H = HyperellipticCurve(x**Integer(7) + Integer(3) * x + Integer(1)) >>> J = H.jacobian(); J Jacobian of Hyperelliptic Curve over Finite Field of size 1993 defined by y^2 = x^7 + 3*x + 1 >>> u, v = x**Integer(3) + Integer(1570)*x**Integer(2) + Integer(1930)*x + Integer(81), Integer(368)*x**Integer(2) + Integer(1478)*x + Integer(256) >>> P = J(u, v); P (x^3 + 1570*x^2 + 1930*x + 81, 368*x^2 + 1478*x + 256) >>> P.uv() == (u, v) True
x = polygen(GF(1993)) H = HyperellipticCurve(x^7 + 3 * x + 1) J = H.jacobian(); J u, v = x^3 + 1570*x^2 + 1930*x + 81, 368*x^2 + 1478*x + 256 P = J(u, v); P P.uv() == (u, v)
- weil_pairing(Q, n)[source]¶
Compute the Weil pairing \(e_n(P, Q)\) of \(P\) =
selfandQ.For \(n\)-torsion elements \(P\), \(Q\) of the Jacobian, choose degree-zero divisors \(D_P\), \(D_Q\) with disjoint supports, and functions \(f_P\), \(f_Q\) with divisors \(n D_P\) and \(n D_Q\). The Weil pairing then equals
\[e_n(P, Q) = \frac{f_P(D_Q)}{f_Q(D_P)}.\]For elliptic curves this agrees with the convention of
sage.schemes.elliptic_curves.ell_point.EllipticCurvePoint_field.weil_pairing().The functions are computed using Miller’s algorithm, where each step of Cantor’s algorithm contributes a function on the curve. The divisors \(D_P\) and \(D_Q\) are chosen at random from their class. If no suitable divisors are found after a few attempts, which may happen over very small fields, the computation is carried out over an extension field instead.
INPUT:
Q– an element of the same group of points asselfn– positive integer such that \(nP = nQ = 0\)
OUTPUT: an \(n\)-th root of unity in the base field
EXAMPLES:
The Jacobian of \(y^2 = x^5 + x\) over \(\mathbb F_7\) is supersingular; over \(\mathbb F_{7^2}\) the Frobenius acts as \(-7\), so the full \(8\)-torsion is rational there:
sage: R.<x> = GF(7)[] sage: H = HyperellipticCurve(x^5 + x) sage: K.<z2> = GF(7^2) sage: J = H.jacobian()(K) sage: J.order().factor() 2^12 sage: P = J(x^2 + (3*z2 + 1)*x + 2*z2 + 2, (3*z2 + 6)*x + z2) sage: Q = J(x^2 + (3*z2 + 5)*x + 3*z2 + 3, (5*z2 + 1)*x + 2*z2) sage: e = P.weil_pairing(Q, 8); e 5*z2 + 3 sage: e.multiplicative_order() 8
>>> from sage.all import * >>> R = GF(Integer(7))['x']; (x,) = R._first_ngens(1) >>> H = HyperellipticCurve(x**Integer(5) + x) >>> K = GF(Integer(7)**Integer(2), names=('z2',)); (z2,) = K._first_ngens(1) >>> J = H.jacobian()(K) >>> J.order().factor() 2^12 >>> P = J(x**Integer(2) + (Integer(3)*z2 + Integer(1))*x + Integer(2)*z2 + Integer(2), (Integer(3)*z2 + Integer(6))*x + z2) >>> Q = J(x**Integer(2) + (Integer(3)*z2 + Integer(5))*x + Integer(3)*z2 + Integer(3), (Integer(5)*z2 + Integer(1))*x + Integer(2)*z2) >>> e = P.weil_pairing(Q, Integer(8)); e 5*z2 + 3 >>> e.multiplicative_order() 8
R.<x> = GF(7)[] H = HyperellipticCurve(x^5 + x) K.<z2> = GF(7^2) J = H.jacobian()(K) J.order().factor() P = J(x^2 + (3*z2 + 1)*x + 2*z2 + 2, (3*z2 + 6)*x + z2) Q = J(x^2 + (3*z2 + 5)*x + 3*z2 + 3, (5*z2 + 1)*x + 2*z2) e = P.weil_pairing(Q, 8); e e.multiplicative_order()
The Weil pairing is bilinear, alternating and Galois equivariant:
sage: P.weil_pairing(P, 8) 1 sage: Q.weil_pairing(P, 8) == e^-1 True sage: (3*P).weil_pairing(5*Q, 8) == e^15 True sage: (P + Q).weil_pairing(Q, 8) == e True sage: frob = lambda D: J(*[c.map_coefficients(lambda a: a^7) for c in D]) sage: frob(P).weil_pairing(frob(Q), 8) == e^7 True
>>> from sage.all import * >>> P.weil_pairing(P, Integer(8)) 1 >>> Q.weil_pairing(P, Integer(8)) == e**-Integer(1) True >>> (Integer(3)*P).weil_pairing(Integer(5)*Q, Integer(8)) == e**Integer(15) True >>> (P + Q).weil_pairing(Q, Integer(8)) == e True >>> frob = lambda D: J(*[c.map_coefficients(lambda a: a**Integer(7)) for c in D]) >>> frob(P).weil_pairing(frob(Q), Integer(8)) == e**Integer(7) True
P.weil_pairing(P, 8) Q.weil_pairing(P, 8) == e^-1 (3*P).weil_pairing(5*Q, 8) == e^15 (P + Q).weil_pairing(Q, 8) == e frob = lambda D: J(*[c.map_coefficients(lambda a: a^7) for c in D]) frob(P).weil_pairing(frob(Q), 8) == e^7
A split example of genus 3:
sage: R.<x> = GF(23)[] sage: H = HyperellipticCurve(x^8 + 1) sage: H.is_split() True sage: K.<z2> = GF(23^2) sage: J = H.jacobian()(K) sage: J.order().factor() 2^18 * 3^6 sage: P = J(x^3 + (5*z2 + 4)*x^2 + (5*z2 + 8)*x + 19*z2 + 13, ....: (19*z2 + 12)*x^2 + (6*z2 + 15)*x + 17*z2 + 6) sage: Q = J(x^3 + (16*z2 + 9)*x^2 + 15*z2*x + 4*z2 + 7, ....: 5*x^2 + (8*z2 + 12)*x + z2 + 17) sage: P.weil_pairing(Q, 3) 19*z2 + 15
>>> from sage.all import * >>> R = GF(Integer(23))['x']; (x,) = R._first_ngens(1) >>> H = HyperellipticCurve(x**Integer(8) + Integer(1)) >>> H.is_split() True >>> K = GF(Integer(23)**Integer(2), names=('z2',)); (z2,) = K._first_ngens(1) >>> J = H.jacobian()(K) >>> J.order().factor() 2^18 * 3^6 >>> P = J(x**Integer(3) + (Integer(5)*z2 + Integer(4))*x**Integer(2) + (Integer(5)*z2 + Integer(8))*x + Integer(19)*z2 + Integer(13), ... (Integer(19)*z2 + Integer(12))*x**Integer(2) + (Integer(6)*z2 + Integer(15))*x + Integer(17)*z2 + Integer(6)) >>> Q = J(x**Integer(3) + (Integer(16)*z2 + Integer(9))*x**Integer(2) + Integer(15)*z2*x + Integer(4)*z2 + Integer(7), ... Integer(5)*x**Integer(2) + (Integer(8)*z2 + Integer(12))*x + z2 + Integer(17)) >>> P.weil_pairing(Q, Integer(3)) 19*z2 + 15
R.<x> = GF(23)[] H = HyperellipticCurve(x^8 + 1) H.is_split() K.<z2> = GF(23^2) J = H.jacobian()(K) J.order().factor() P = J(x^3 + (5*z2 + 4)*x^2 + (5*z2 + 8)*x + 19*z2 + 13, (19*z2 + 12)*x^2 + (6*z2 + 15)*x + 17*z2 + 6) Q = J(x^3 + (16*z2 + 9)*x^2 + 15*z2*x + 4*z2 + 7, 5*x^2 + (8*z2 + 12)*x + z2 + 17) P.weil_pairing(Q, 3)A larger example: the genus-3 curve \(y^2 = x^7 + x\) is superspecial modulo \(p\), and the \((p+1)\)-torsion is rational over \(\mathbb F_{p^2}\). We pair elements of large prime order \(\ell\) dividing \(p+1\), as well as elements of order \(p+1\):
sage: p = 10000000000000001119 sage: R.<x> = GF(p)[] sage: H = HyperellipticCurve(x^7 + x) sage: K.<z2> = GF(p^2) sage: J = H.jacobian()(K) sage: (p + 1) * J.random_element() (1, 0) sage: factor(p + 1) 2^5 * 5 * 197 * 317258883248731 sage: l = 317258883248731 sage: P = ((p + 1) // l) * J.random_element() sage: Q = ((p + 1) // l) * J.random_element() sage: e = P.weil_pairing(Q, l) sage: e.multiplicative_order() == l # random (False with probability about 1/l) True sage: (2*P).weil_pairing(3*Q, l) == e^6 True sage: Q.weil_pairing(P, l) == e^-1 True sage: frob = lambda D: J(*[c.map_coefficients(lambda a: a^p) for c in D]) sage: frob(P).weil_pairing(frob(Q), l) == e^p True sage: P.tate_pairing(Q, l) / Q.tate_pairing(P, l) == e^((p^2-1) // l) True sage: P = J.random_element() sage: Q = J.random_element() sage: e = P.weil_pairing(Q, p + 1) sage: e^(p + 1) 1 sage: (P + Q).weil_pairing(Q, p + 1) == e True
>>> from sage.all import * >>> p = Integer(10000000000000001119) >>> R = GF(p)['x']; (x,) = R._first_ngens(1) >>> H = HyperellipticCurve(x**Integer(7) + x) >>> K = GF(p**Integer(2), names=('z2',)); (z2,) = K._first_ngens(1) >>> J = H.jacobian()(K) >>> (p + Integer(1)) * J.random_element() (1, 0) >>> factor(p + Integer(1)) 2^5 * 5 * 197 * 317258883248731 >>> l = Integer(317258883248731) >>> P = ((p + Integer(1)) // l) * J.random_element() >>> Q = ((p + Integer(1)) // l) * J.random_element() >>> e = P.weil_pairing(Q, l) >>> e.multiplicative_order() == l # random (False with probability about 1/l) True >>> (Integer(2)*P).weil_pairing(Integer(3)*Q, l) == e**Integer(6) True >>> Q.weil_pairing(P, l) == e**-Integer(1) True >>> frob = lambda D: J(*[c.map_coefficients(lambda a: a**p) for c in D]) >>> frob(P).weil_pairing(frob(Q), l) == e**p True >>> P.tate_pairing(Q, l) / Q.tate_pairing(P, l) == e**((p**Integer(2)-Integer(1)) // l) True >>> P = J.random_element() >>> Q = J.random_element() >>> e = P.weil_pairing(Q, p + Integer(1)) >>> e**(p + Integer(1)) 1 >>> (P + Q).weil_pairing(Q, p + Integer(1)) == e True
p = 10000000000000001119 R.<x> = GF(p)[] H = HyperellipticCurve(x^7 + x) K.<z2> = GF(p^2) J = H.jacobian()(K) (p + 1) * J.random_element() factor(p + 1) l = 317258883248731 P = ((p + 1) // l) * J.random_element() Q = ((p + 1) // l) * J.random_element() e = P.weil_pairing(Q, l) e.multiplicative_order() == l # random (False with probability about 1/l) (2*P).weil_pairing(3*Q, l) == e^6 Q.weil_pairing(P, l) == e^-1 frob = lambda D: J(*[c.map_coefficients(lambda a: a^p) for c in D]) frob(P).weil_pairing(frob(Q), l) == e^p P.tate_pairing(Q, l) / Q.tate_pairing(P, l) == e^((p^2-1) // l) P = J.random_element() Q = J.random_element() e = P.weil_pairing(Q, p + 1) e^(p + 1) (P + Q).weil_pairing(Q, p + 1) == e
For elliptic curves, the result matches the Weil pairing implementation in
sage.schemes.elliptic_curves.ell_point.EllipticCurvePoint_field.weil_pairing():sage: K.<z2> = GF(11^2) sage: E = EllipticCurve(K, [0, 1]) sage: R.<x> = GF(11)[] sage: J = HyperellipticCurve(x^3 + 1).jacobian()(K) sage: P, Q = E.torsion_basis(12) sage: to_J = lambda T: J(x - T.x(), T.y()) sage: to_J(P).weil_pairing(to_J(Q), 12) == P.weil_pairing(Q, 12) True
>>> from sage.all import * >>> K = GF(Integer(11)**Integer(2), names=('z2',)); (z2,) = K._first_ngens(1) >>> E = EllipticCurve(K, [Integer(0), Integer(1)]) >>> R = GF(Integer(11))['x']; (x,) = R._first_ngens(1) >>> J = HyperellipticCurve(x**Integer(3) + Integer(1)).jacobian()(K) >>> P, Q = E.torsion_basis(Integer(12)) >>> to_J = lambda T: J(x - T.x(), T.y()) >>> to_J(P).weil_pairing(to_J(Q), Integer(12)) == P.weil_pairing(Q, Integer(12)) True
K.<z2> = GF(11^2) E = EllipticCurve(K, [0, 1]) R.<x> = GF(11)[] J = HyperellipticCurve(x^3 + 1).jacobian()(K) P, Q = E.torsion_basis(12) to_J = lambda T: J(x - T.x(), T.y()) to_J(P).weil_pairing(to_J(Q), 12) == P.weil_pairing(Q, 12)
Pairings can also be computed over very small fields, where the computation may be carried out over an extension field. On the curve \(y^2 = x^5 - x\) over \(\mathbb F_5\), the \(2\)-torsion is rational and the classes \(T_a = (a, 0) - \infty\) satisfy \(e_2(T_a, T_b) = -1\) for \(a \neq b\):
sage: S.<t> = GF(5)[] sage: J5 = HyperellipticCurve(t^5 - t).jacobian() sage: T = [J5(t - a, 0) for a in GF(5)] sage: matrix([[A.weil_pairing(B, 2) for B in T] for A in T]) [1 4 4 4 4] [4 1 4 4 4] [4 4 1 4 4] [4 4 4 1 4] [4 4 4 4 1]
>>> from sage.all import * >>> S = GF(Integer(5))['t']; (t,) = S._first_ngens(1) >>> J5 = HyperellipticCurve(t**Integer(5) - t).jacobian() >>> T = [J5(t - a, Integer(0)) for a in GF(Integer(5))] >>> matrix([[A.weil_pairing(B, Integer(2)) for B in T] for A in T]) [1 4 4 4 4] [4 1 4 4 4] [4 4 1 4 4] [4 4 4 1 4] [4 4 4 4 1]
S.<t> = GF(5)[] J5 = HyperellipticCurve(t^5 - t).jacobian() T = [J5(t - a, 0) for a in GF(5)] matrix([[A.weil_pairing(B, 2) for B in T] for A in T])
- class sage.schemes.hyperelliptic_curves.jacobian_morphism.MumfordDivisorClassFieldInert(parent, u, v, check=True)[source]¶
Bases:
MumfordDivisorClassFieldCreate an element of the Jacobian of an inert hyperelliptic curve.
- class sage.schemes.hyperelliptic_curves.jacobian_morphism.MumfordDivisorClassFieldRamified(parent, u, v, check=True)[source]¶
Bases:
MumfordDivisorClassFieldCreate an element of the Jacobian of a ramified hyperelliptic curve.
- class sage.schemes.hyperelliptic_curves.jacobian_morphism.MumfordDivisorClassFieldSplit(parent, u, v, n=0, check=True)[source]¶
Bases:
MumfordDivisorClassFieldCreate an element of the Jacobian of a split hyperelliptic curve.