Skip to content

Commit 8be428d

Browse files
author
Release Manager
committed
gh-39066: Add degree checks for Jacobian models <!-- ^ Please provide a concise and informative title. --> <!-- ^ Don't put issue numbers in the title, do this in the PR description below. --> <!-- ^ For example, instead of "Fixes #12345" use "Introduce new method to calculate 1 + 2". --> <!-- v Describe your changes below in detail. --> <!-- v Why is this change required? What problem does it solve? --> <!-- v If this PR resolves an open issue, please link to it here. For example, "Fixes #12345". --> Fixes #38623 ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> - [x] The title is concise and informative. - [x] The description explains in detail what this PR is about. - [x] I have linked a relevant issue or discussion. - [x] I have created tests covering the changes. - [x] I have updated the documentation and checked the documentation preview. ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on. For example, --> <!-- - #12345: short description why this is a dependency --> <!-- - #34567: ... --> URL: #39066 Reported by: Kwankyu Lee Reviewer(s): Kwankyu Lee, user202729, Vincent Macri
2 parents 8049b4d + 60e7a5c commit 8be428d

File tree

4 files changed

+85
-6
lines changed

4 files changed

+85
-6
lines changed

src/sage/rings/function_field/jacobian_base.py

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
5353
We can get the corresponding point in the Jacobian in a different model. ::
5454
55+
sage: # long time
5556
sage: p1km = J_km(p1)
5657
sage: p1km.order()
5758
5
@@ -111,6 +112,7 @@ def order(self):
111112
112113
EXAMPLES::
113114
115+
sage: # long time
114116
sage: P2.<x,y,z> = ProjectiveSpace(GF(29), 2)
115117
sage: C = Curve(x^3 + 5*z^3 - y^2*z, P2)
116118
sage: F = C.function_field()
@@ -640,6 +642,7 @@ def __call__(self, x):
640642
641643
TESTS::
642644
645+
sage: # long time
643646
sage: K.<x> = FunctionField(GF(2)); _.<Y> = K[]
644647
sage: F.<y> = K.extension(Y^2 + Y + x + 1/x)
645648
sage: J_hess = F.jacobian(model='hess')
@@ -651,6 +654,26 @@ def __call__(self, x):
651654
True
652655
sage: J_hess(q) == p
653656
True
657+
658+
If ``x`` is an effective divisor, it is checked that the degree
659+
is equal to the degree of the base divisor. See :issue:`38623`.
660+
661+
sage: K.<x> = FunctionField(GF(7))
662+
sage: _.<t> = K[]
663+
sage: F.<y> = K.extension(t^2 - x^6 - 3)
664+
sage: O = F.maximal_order()
665+
sage: D1 = (O.ideal(x + 1, y + 2) * O.ideal(x + 2, y + 2)).divisor()
666+
sage: I = O.ideal(x + 3, y+5) * O.ideal(x + 4, y + 5) * O.ideal(x + 5, y + 5)
667+
sage: D2 = I.divisor()
668+
sage: J = F.jacobian(model='hess')
669+
sage: J(D1)
670+
[Place (x + 1, y + 2) + Place (x + 2, y + 2)]
671+
sage: J(D2)
672+
Traceback (most recent call last):
673+
...
674+
ValueError: effective divisor is not of degree 2
675+
sage: J.base_divisor().degree()
676+
2
654677
"""
655678
F = self._function_field
656679
if isinstance(x, JacobianPoint_base):
@@ -666,9 +689,8 @@ def __call__(self, x):
666689
if x == 0:
667690
return self.group().zero()
668691
if x in F.divisor_group():
669-
G = self.group()
670-
return G.point(x)
671-
raise ValueError(f"Cannot create a point of the Jacobian from {x}")
692+
return self.group()(x)
693+
raise ValueError(f"cannot create a point of the Jacobian from {x}")
672694

673695
def curve(self):
674696
"""

src/sage/rings/function_field/jacobian_hess.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -606,7 +606,7 @@ def _element_constructor_(self, x):
606606
"""
607607
Construct an element of ``self`` from ``x``.
608608
609-
If ``x`` is an effective divisor, then it is assumed to of
609+
If ``x`` is an effective divisor, then it must be of
610610
degree `g`, the genus of the function field.
611611
612612
EXAMPLES::
@@ -634,9 +634,11 @@ def _element_constructor_(self, x):
634634
if x.degree() == 0:
635635
return self.point(x)
636636
if x.is_effective():
637+
if x.degree() != self._genus:
638+
raise ValueError(f"effective divisor is not of degree {self._genus}")
637639
return self.element_class(self, *self._get_dS_ds(x))
638640

639-
raise ValueError(f"Cannot construct a point from {x}")
641+
raise ValueError(f"cannot construct a point from {x}")
640642

641643
def _get_dS_ds(self, divisor):
642644
"""
@@ -805,6 +807,8 @@ def point(self, divisor):
805807
sage: G.point(p - b)
806808
[Place (y + 2, z + 1)]
807809
"""
810+
if divisor.degree() != 0:
811+
raise ValueError('divisor not of degree zero')
808812
c = divisor + self._base_div
809813
f = c.basis_function_space()[0]
810814
d = f.divisor() + c

src/sage/rings/function_field/jacobian_khuri_makdisi.py

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@
6868
6969
EXAMPLES::
7070
71+
sage: # long time
7172
sage: P2.<x,y,z> = ProjectiveSpace(GF(17), 2)
7273
sage: C = Curve(x^3 + 5*z^3 - y^2*z, P2)
7374
sage: F = C.function_field()
@@ -154,6 +155,7 @@ class JacobianPoint(JacobianPoint_base):
154155
155156
EXAMPLES::
156157
158+
sage: # long time
157159
sage: P2.<x,y,z> = ProjectiveSpace(GF(7), 2)
158160
sage: C = Curve(x^3 + 5*z^3 - y^2*z, P2)
159161
sage: b = C([0,1,0]).place()
@@ -176,6 +178,7 @@ def __init__(self, parent, w):
176178
177179
TESTS::
178180
181+
sage: # long time
179182
sage: P2.<x,y,z> = ProjectiveSpace(GF(7), 2)
180183
sage: C = Curve(x^3 + 5*z^3 - y^2*z, P2)
181184
sage: b = C([0,1,0]).place()
@@ -196,6 +199,7 @@ def _repr_(self):
196199
197200
EXAMPLES::
198201
202+
sage: # long time
199203
sage: P2.<x,y,z> = ProjectiveSpace(GF(7), 2)
200204
sage: C = Curve(x^3 + 5*z^3 - y^2*z, P2)
201205
sage: h = C.function(y/x).divisor_of_poles()
@@ -218,6 +222,7 @@ def __hash__(self):
218222
219223
EXAMPLES::
220224
225+
sage: # long time
221226
sage: P2.<x,y,z> = ProjectiveSpace(GF(7), 2)
222227
sage: C = Curve(x^3 + 5*z^3 - y^2*z, P2)
223228
sage: F = C.function_field()
@@ -242,6 +247,7 @@ def _richcmp_(self, other, op):
242247
243248
EXAMPLES::
244249
250+
sage: # long time
245251
sage: P2.<x,y,z> = ProjectiveSpace(GF(7), 2)
246252
sage: C = Curve(x^3 + 5*z^3 - y^2*z, P2)
247253
sage: h = C.function(y/x).divisor_of_poles()
@@ -275,6 +281,7 @@ def _add_(self, other):
275281
276282
EXAMPLES::
277283
284+
sage: # long time
278285
sage: P2.<x,y,z> = ProjectiveSpace(GF(7), 2)
279286
sage: C = Curve(x^3 + 5*z^3 - y^2*z, P2)
280287
sage: h = C.function(y/x).divisor_of_poles()
@@ -306,6 +313,7 @@ def _neg_(self):
306313
307314
EXAMPLES::
308315
316+
sage: # long time
309317
sage: P2.<x,y,z> = ProjectiveSpace(GF(7), 2)
310318
sage: C = Curve(x^3 + 5*z^3 - y^2*z, P2)
311319
sage: F = C.function_field()
@@ -340,6 +348,7 @@ def _rmul_(self, n):
340348
341349
EXAMPLES::
342350
351+
sage: # long time
343352
sage: P2.<x,y,z> = ProjectiveSpace(GF(7), 2)
344353
sage: C = Curve(x^3 + 5*z^3 - y^2*z, P2)
345354
sage: h = C.function(y/x).divisor_of_poles()
@@ -363,6 +372,7 @@ def multiple(self, n):
363372
364373
EXAMPLES::
365374
375+
sage: # long time
366376
sage: P2.<x,y,z> = ProjectiveSpace(GF(7), 2)
367377
sage: C = Curve(x^3 + 5*z^3 - y^2*z, P2)
368378
sage: h = C.function(y/x).divisor_of_poles()
@@ -394,6 +404,7 @@ def addflip(self, other):
394404
395405
EXAMPLES::
396406
407+
sage: # long time
397408
sage: P2.<x,y,z> = ProjectiveSpace(GF(7), 2)
398409
sage: C = Curve(x^3 + 5*z^3 - y^2*z, P2)
399410
sage: h = C.function(y/x).divisor_of_poles()
@@ -426,6 +437,7 @@ def defining_matrix(self):
426437
427438
EXAMPLES::
428439
440+
sage: # long time
429441
sage: P2.<x,y,z> = ProjectiveSpace(GF(7), 2)
430442
sage: C = Curve(x^3 + 5*z^3 - y^2*z, P2)
431443
sage: h = C.function(y/x).divisor_of_poles()
@@ -450,6 +462,7 @@ def divisor(self):
450462
451463
EXAMPLES::
452464
465+
sage: # long time
453466
sage: P2.<x,y,z> = ProjectiveSpace(GF(7), 2)
454467
sage: C = Curve(x^3 + 5*z^3 - y^2*z, P2)
455468
sage: F = C.function_field()
@@ -493,6 +506,7 @@ class JacobianGroupEmbedding(Map):
493506
494507
EXAMPLES::
495508
509+
sage: # long time
496510
sage: k = GF(5)
497511
sage: P2.<x,y,z> = ProjectiveSpace(k, 2)
498512
sage: C = Curve(x^3 + z^3 - y^2*z, P2)
@@ -514,6 +528,7 @@ def __init__(self, base_group, extension_group):
514528
515529
TESTS::
516530
531+
sage: # long time
517532
sage: k = GF(5)
518533
sage: P2.<x,y,z> = ProjectiveSpace(k, 2)
519534
sage: C = Curve(x^3 + z^3 - y^2*z, P2)
@@ -538,6 +553,7 @@ def _repr_type(self):
538553
539554
TESTS::
540555
556+
sage: # long time
541557
sage: k = GF(5)
542558
sage: P2.<x,y,z> = ProjectiveSpace(k, 2)
543559
sage: C = Curve(x^3 + z^3 - y^2*z, P2)
@@ -561,6 +577,7 @@ def _call_(self, x):
561577
562578
TESTS::
563579
580+
sage: # long time
564581
sage: k = GF(5)
565582
sage: P2.<x,y,z> = ProjectiveSpace(k, 2)
566583
sage: C = Curve(x^3 + z^3 - y^2*z, P2)
@@ -592,6 +609,7 @@ class JacobianGroup(UniqueRepresentation, JacobianGroup_base):
592609
593610
EXAMPLES::
594611
612+
sage: # long time
595613
sage: P2.<x,y,z> = ProjectiveSpace(GF(7), 2)
596614
sage: C = Curve(x^3 + 5*z^3 - y^2*z, P2)
597615
sage: h = C.function(y/x).divisor_of_poles()
@@ -609,6 +627,7 @@ def __init__(self, parent, function_field, base_div):
609627
610628
TESTS::
611629
630+
sage: # long time
612631
sage: P2.<x,y,z> = ProjectiveSpace(GF(7), 2)
613632
sage: C = Curve(x^3 + 5*z^3 - y^2*z, P2)
614633
sage: h = C.function(y/x).divisor_of_poles()
@@ -619,6 +638,7 @@ def __init__(self, parent, function_field, base_div):
619638

620639
D0 = base_div
621640

641+
self._base_div_degree = base_div.degree()
622642
self._V_cache = 10*[None]
623643

624644
V_cache = self._V_cache
@@ -672,6 +692,7 @@ def _repr_(self):
672692
673693
EXAMPLES::
674694
695+
sage: # long time
675696
sage: P2.<x,y,z> = ProjectiveSpace(GF(7), 2)
676697
sage: C = Curve(x^3 + 5*z^3 - y^2*z, P2)
677698
sage: h = C.function(y/x).divisor_of_poles()
@@ -693,6 +714,7 @@ def _wd_from_divisor(self, x):
693714
694715
TESTS:
695716
717+
sage: # long time
696718
sage: P2.<x,y,z> = ProjectiveSpace(GF(7), 2)
697719
sage: C = Curve(x^3 + 5*z^3 - y^2*z, P2)
698720
sage: h = C.function(y/x).divisor_of_poles()
@@ -719,6 +741,7 @@ def _element_constructor_(self, x):
719741
720742
TESTS::
721743
744+
sage: # long time
722745
sage: P2.<x,y,z> = ProjectiveSpace(GF(7), 2)
723746
sage: C = Curve(x^3 + 5*z^3 - y^2*z, P2)
724747
sage: h = C.function(y/x).divisor_of_poles()
@@ -760,10 +783,12 @@ def _element_constructor_(self, x):
760783
if x.degree() == 0:
761784
return self.point(x)
762785
if x.is_effective():
786+
if x.degree() != self._base_div_degree:
787+
raise ValueError(f"effective divisor is not of degree {self._base_div_degree}")
763788
wd = self._wd_from_divisor(x)
764789
return self.element_class(self, wd)
765790

766-
raise ValueError(f"Cannot construct a point from {x}")
791+
raise ValueError(f"cannot construct a point from {x}")
767792

768793
def point(self, divisor):
769794
"""
@@ -775,6 +800,7 @@ def point(self, divisor):
775800
776801
EXAMPLES::
777802
803+
sage: # long time
778804
sage: P2.<x,y,z> = ProjectiveSpace(GF(7), 2)
779805
sage: C = Curve(x^3 + 5*z^3 - y^2*z, P2)
780806
sage: h = C.function(y/x).divisor_of_poles()
@@ -808,6 +834,7 @@ def zero(self):
808834
809835
EXAMPLES::
810836
837+
sage: # long time
811838
sage: P2.<x,y,z> = ProjectiveSpace(GF(7), 2)
812839
sage: C = Curve(x^3 + 5*z^3 - y^2*z, P2)
813840
sage: h = C.function(y/x).divisor_of_poles()
@@ -839,6 +866,7 @@ class JacobianGroup_finite_field(JacobianGroup, JacobianGroup_finite_field_base)
839866
840867
EXAMPLES::
841868
869+
sage: # long time
842870
sage: k = GF(7)
843871
sage: P2.<x,y,z> = ProjectiveSpace(k, 2)
844872
sage: C = Curve(x^3 + 5*z^3 - y^2*z, P2)
@@ -862,6 +890,7 @@ def __init__(self, parent, function_field, base_div):
862890
863891
TESTS::
864892
893+
sage: # long time
865894
sage: k = GF(7)
866895
sage: P2.<x,y,z> = ProjectiveSpace(k, 2)
867896
sage: C = Curve(x^3 + 5*z^3 - y^2*z, P2)
@@ -952,6 +981,7 @@ def _frobenius_on(self, pt):
952981
953982
TESTS::
954983
984+
sage: # long time
955985
sage: k = GF(7)
956986
sage: A.<x,y> = AffineSpace(k,2)
957987
sage: C = Curve(y^2 + x^3 + 2*x + 1).projective_closure()
@@ -986,13 +1016,15 @@ def __init__(self, function_field, base_div, model, **kwds):
9861016
9871017
TESTS::
9881018
1019+
sage: # long time
9891020
sage: P2.<x,y,z> = ProjectiveSpace(GF(7), 2)
9901021
sage: C = Curve(x^3 + 5*z^3 - y^2*z, P2)
9911022
sage: J = C.jacobian(model='km_large')
9921023
sage: TestSuite(J).run(skip=['_test_elements', '_test_pickling'])
9931024
9941025
::
9951026
1027+
sage: # long time
9961028
sage: J = C.jacobian(model='km_unknown')
9971029
Traceback (most recent call last):
9981030
...

0 commit comments

Comments
 (0)