Skip to content

Commit

Permalink
gh-38964: Drinfeld Modules: Default to zero endomorphism in .hom an…
Browse files Browse the repository at this point in the history
…d avoid inversion of zero endomorphism

    
This PR fixes #38953 and is inspired by the error raised in the issue:
- The main fix is to avoid sampling the zero element of the base field
in the test of `__invert__`, so that `phi.hom(a)` actually returns an
invertible morphism.
- However, the error raised in the issue named above was slightly
confusing, as the call of `phi.hom(K.zero())` does not return any
homomorphism: Since the codomain is not specified, it tries to find a
codomain via the `.velu`-method, but this only works if the given
element defines an isogeny, which `K.zero()` does not. Instead of
raising an error for this special case in `.hom`, it seems more robust
to default to the zero endomorphism of `self` instead.
- Also added the mention of `isog` in the `.velu`-method.
    
URL: #38964
Reported by: Sebastian A. Spindler
Reviewer(s): Xavier Caruso
  • Loading branch information
Release Manager committed Nov 14, 2024
2 parents 7c13ae9 + b192330 commit 54af5b3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1855,7 +1855,7 @@ def rank(self):

def velu(self, isog):
r"""
Return a new Drinfeld module such that input is an
Return a new Drinfeld module such that ``isog`` defines an
isogeny to this module with domain ``self``; if no such isogeny
exists, raise an exception.
Expand Down Expand Up @@ -2018,11 +2018,19 @@ def hom(self, x, codomain=None):
Traceback (most recent call last):
...
ValueError: Ore polynomial does not define a morphism
Check that x = 0 (without specified codomain) gives the zero endomorphism::
sage: phi.hom(K.zero())
Endomorphism of Drinfeld module defined by ...
Defn: 0
"""
# When `x` is in the function ring (or something that coerces to it):
if self.function_ring().has_coerce_map_from(x.parent()):
return self.Hom(self)(x)
if codomain is None:
if x.is_zero():
return self.Hom(self)(0)
try:
codomain = self.velu(x)
except TypeError:
Expand Down
6 changes: 4 additions & 2 deletions src/sage/rings/function_field/drinfeld_modules/morphism.py
Original file line number Diff line number Diff line change
Expand Up @@ -536,9 +536,11 @@ def __invert__(self):
sage: K.<z> = Fq.extension(3)
sage: coeffs = [z] + [K.random_element() for _ in range(10)]
sage: phi = DrinfeldModule(A, coeffs)
sage: f = phi.hom(K.random_element())
sage: a = K.random_element()
sage: while a.is_zero():
....: a = K.random_element()
sage: f = phi.hom(a)
sage: g = ~f
sage: (f*g).is_identity()
True
sage: (g*f).is_identity()
Expand Down

0 comments on commit 54af5b3

Please sign in to comment.