Fix Coleman integration for even-degree hyperelliptic curves#42124
Fix Coleman integration for even-degree hyperelliptic curves#42124SamSi0322 wants to merge 3 commits into
Conversation
The methods coleman_integrals_on_basis, tiny_integrals_on_basis, P_to_S,
S_to_Q, and coleman_integral hard-coded the cohomology dimension as
2*g, but matrix_of_frobenius_hyperelliptic uses a (d-1)-dimensional
Monsky-Washnitzer basis (dx/2y, x dx/2y, ..., x^{d-2} dx/2y) where d
is the polynomial degree. For even-degree curves (d = 2g+2), this is
2g+1 rather than 2g, causing dimension mismatches and TypeErrors when
multiplying the Frobenius matrix by a vector of wrong size.
This patch replaces the hard-coded 2*g with d-1 in all five locations,
which equals 2*g for odd-degree models (no behavior change) and 2*g+1
for even-degree models (bug fix). Affected docstrings are updated to
state the basis dimension as d-2 instead of 2*g-1.
Tested with monkey-patching on local SageMath 10.7:
- genus 1 deg 3 (odd): dim=2, P->Q + Q->P consistency PASS
- genus 1 deg 4 (even): dim=3, P->Q + Q->P consistency PASS, chain PASS
- genus 2 deg 6 (even): dim=5, P->Q + Q->P consistency PASS
- genus 3 deg 8 (even): dim=7, P->Q + Q->P consistency PASS
|
Can you add a doctest? |
|
Documentation preview for this PR (built with commit 564d494; changes) is ready! 🎉 |
Tests that coleman_integrals_on_basis returns d-1 elements (not 2g) for an even-degree model, verifying the fix works correctly.
|
Can you merge the lastest develop |
|
I'm a bit concerned about this PR mainly as it looks like it has been written by AI. I am not an expert in this area so can't offer a decent review. Maybe @sabrinakunzweiler can say something more intelligent than me. |
|
Hi @GiacomoPope, thanks for raising this — happy to clarify. I found this bug while working on Coleman integration for even-degree hyperelliptic curves as part of my research. When I tried to run The mathematical point: for a hyperelliptic curve y² = f(x) with deg(f) = d, the basis of regular differentials {x^i dx/2y} has i = 0, ..., d-2, giving d-1 elements. When d is odd, d-1 = 2g and the old code is correct. When d is even, d-1 = 2g+1 and the old code is one short. The fix just replaces I did use AI tools to help with writing the commit messages and doctest formatting, but the bug identification, mathematical analysis, and fix are my own work. Happy to discuss the math further or make any changes to the PR. |
|
Hi, I just had a look at the added code, and for me, the new doctest doesn't work: This raises a Is it possible that the suggested fix is based on the old implementation for hyperelliptic curves? About the suggested fix itself: I agree that the dimension for even degree models has to be changed as suggested. I'm not very familiar with the topic, but I believe that there are further necessary changes to fully support the computation of Coleman integrals for even degree models. For instance, one needs to handle the behavior at the points at infinity (which are no longer Weierstrass points). |
|
Thanks everyone for taking a look, especially for the comments about the current smooth-model implementation. I agree with the assessment here. The dimension mismatch I pointed out is real, but fixing it is only a necessary piece, not sufficient to provide full Coleman integration support for even-degree/split hyperelliptic models. In particular, the behavior at the two points at infinity and the associated boundary handling need to be treated carefully. That makes the proper fix larger than I initially expected. Keeping this PR open as a partial change would probably be confusing for the codebase and for future users, because it could suggest that even-degree Coleman integration is now supported when it is not. I am going to close this PR for now. If I return to this, I will open a separate, larger PR that handles the split/even-degree case properly, with tests that cover the infinity behavior and not just the basis-dimension issue. Thanks again for the review and guidance. |
Fix Coleman Integration for Even-Degree Hyperelliptic Curves
Problem
HyperellipticCurve_padic_field.coleman_integrals_on_basisfails forhyperelliptic curves defined by even-degree polynomials with:
This makes Chabauty-Coleman methods unusable for any hyperelliptic curve in
its even-degree model (e.g., y² = ax⁴ + bx³ + cx² + dx + e for genus 1).
Minimal Reproducer
Root Cause
The
coleman_integrals_on_basisand related functions hard-codedim = 2*g, but the underlyingmatrix_of_frobenius_hyperellipticdocumentation explicitly states:
So the basis has
d-1elements:d = 2g+1):d-1 = 2g✓d = 2g+2):d-1 = 2g+1✗ (mismatch)The 2g+1 forms returned for even-degree don't fit into the 2g-dim
VectorSpace, causing the TypeError.Fix
Replace
dim = 2*gwithdim = d - 1(wheredis the polynomial degree)in 4 locations:
tiny_integrals_on_basis(line ~437)coleman_integrals_on_basis(line ~558)tiny_integrals_on_basis_to_S(line ~1207)coleman_integrals_on_basis_from_S(line ~1285)See the attached diff for the precise changes.
Mathematical Justification
For hyperelliptic curves
y² = f(x)withdeg(f) = d:d = 2g+1: 1 point at infinity. de Rham H¹ has dim 2g.d = 2g+2: 2 points at infinity. The natural Monsky-Washnitzercohomology has dim
d-1 = 2g+1generators (the standard basisx^i dx/(2y)fori = 0, ..., d-2).The matrix
M_frob - Iis invertible in both cases (Frobenius has noeigenvalue 1 by Weil-type bounds), so the Coleman integration formula
(M_frob - I)v = bis well-defined.Testing
The fix is verified by line-integral consistency:
∫_P^Q + ∫_Q^P = 0(anti-symmetry)∫_P^Q + ∫_Q^R = ∫_P^R(additivity)Test results:
Use Cases Enabled
This fix unlocks Coleman-Chabauty methods for:
Related Tickets
The new smooth-model implementation (PR #39161) provides better Jacobian
arithmetic but doesn't address Coleman integration. This fix complements
that work for the existing infrastructure.
Test Suite Added
(Full test suite available in attached
sage_clean_fix.sage)