Skip to content

Commit

Permalink
Trac sagemath#34692: Frobenius endomorphism creation fail for infinit…
Browse files Browse the repository at this point in the history
…e ring extension

I wish to instantiate the Frobenius endomorphism of the field `Fq(X)`
seen as a ring over `Fq[X]`. The following raises an exception:

{{{
sage: Fq = GF(11)
sage: FqX.<X> = Fq[]
sage: k = Frac(FqX)
sage: i = Hom(FqX, k).natural_map()
sage: K = k.over(i)
sage: K.frobenius_endomorphism()
------------------------------------------------------------------------
---
NotImplementedError                       Traceback (most recent call
last)
Input In [43], in <cell line: 6>()
      4 i = Hom(FqX, k).natural_map()
      5 K = k.over(i)
----> 6 K.frobenius_endomorphism()

File $SAGE_ROOT/sage/src/sage/rings/ring.pyx:1428, in
sage.rings.ring.CommutativeRing.frobenius_endomorphism()
   1426     """
   1427     from .morphism import FrobeniusEndomorphism_generic
-> 1428     return FrobeniusEndomorphism_generic(self, n)
   1429
   1430 def derivation_module(self, codomain=None, twist=None):

File $SAGE_ROOT/sage/src/sage/rings/morphism.pyx:2929, in
sage.rings.morphism.FrobeniusEndomorphism_generic.__init__()
   2927 if not isinstance(domain, CommutativeRing):
   2928     raise TypeError("The base ring must be a commutative ring")
-> 2929 self._p = domain.characteristic()
   2930 if not self._p.is_prime():
   2931     raise TypeError("the characteristic of the base ring must be
prime")

File $SAGE_ROOT/sage/src/sage/categories/rings.py:588, in
Rings.ParentMethods.characteristic(self)
    586 from sage.rings.infinity import infinity
    587 from sage.rings.integer_ring import ZZ
--> 588 order_1 = self.one().additive_order()
    589 return ZZ.zero() if order_1 is infinity else order_1

File $SAGE_ROOT/sage/src/sage/rings/ring_extension_element.pyx:415, in
sage.rings.ring_extension_element.RingExtensionElement.additive_order()
    413         5
    414     """
--> 415     return self._backend.additive_order()
    416
    417 def multiplicative_order(self):

File $SAGE_ROOT/sage/src/sage/structure/element.pyx:2818, in
sage.structure.element.RingElement.additive_order()
   2816     Return the additive order of ``self``.
   2817     """
-> 2818     raise NotImplementedError
   2819
   2820 def multiplicative_order(self):

NotImplementedError:
}}}

Best,

Antoine Leudière

URL: https://trac.sagemath.org/34692
Reported by: antoine-leudiere
Ticket author(s): Antoine Leudière
Reviewer(s): Xavier Caruso, David Ayotte
  • Loading branch information
Release Manager committed Nov 15, 2022
2 parents df312d1 + ab2c211 commit d883104
Showing 1 changed file with 53 additions and 0 deletions.
53 changes: 53 additions & 0 deletions src/sage/rings/ring_extension.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -1885,6 +1885,59 @@ cdef class RingExtension_generic(CommutativeAlgebra):
parent = self.Hom(codomain, category=category)
return RingExtensionHomomorphism(parent, im_gens, base_map, check)

def characteristic(self):
r"""
Return the characteristic of the extension as a ring.
OUTPUT:
A prime number or zero.
EXAMPLES::
sage: F = GF(5^2).over() # over GF(5)
sage: K = GF(5^4).over(F)
sage: L = GF(5^12).over(K)
sage: F.characteristic()
5
sage: K.characteristic()
5
sage: L.characteristic()
5
::
sage: F = RR.over(ZZ)
sage: F.characteristic()
0
::
sage: F = GF(11)
sage: A.<x> = F[]
sage: K = Frac(F).over(F)
sage: K.characteristic()
11
::
sage: E = GF(7).over(ZZ)
sage: E.characteristic()
7
TESTS:
Ensure ticket :trac:`34692` is fixed::
sage: Fq = GF(11)
sage: FqX.<X> = Fq[]
sage: k = Frac(FqX)
sage: K = k.over(FqX)
sage: K.frobenius_endomorphism()
Frobenius endomorphism x |--> x^11 of Fraction Field of Univariate Polynomial Ring in X over Finite Field of size 11 over its base
"""
return self._backend.characteristic()


# Fraction fields
#################
Expand Down

0 comments on commit d883104

Please sign in to comment.