Skip to content

Commit

Permalink
Trac #25908: Printing of p-adic extensions
Browse files Browse the repository at this point in the history
We make the print representation of p-adic extensions shorter and
clearer (in order to prepare #23218).

For example, the different outputs below from before this ticket:
{{{
sage: R.<a> = ZqCR(25, 40); R
Unramified Extension in a defined by x^2 + 4*x + 2
with capped relative precision 40 over 5-adic Ring

sage: R.<a> = ZqCA(25, 40); R
Unramified Extension in a defined by x^2 + 4*x + 2
with capped absolute precision 40 over 5-adic Ring

sage: R.<a> = ZqFM(25, 40); R
Unramified Extension in a defined by x^2 + 4*x + 2
of fixed modulus 5^40 over 5-adic Ring

sage: R.<a> = ZqFP(25, 40); R
Unramified Extension in a defined by x^2 + 4*x + 2
with floating precision 40 over 5-adic Ring
}}}
become the same shorter outpout after this ticket:
{{{
sage: R.<a> = ZqCR(25, 40); R
5-adic Unramified Extension Ring in a defined by x^2 + 4*x + 2

sage: R.<a> = ZqCA(25, 40); R
5-adic Unramified Extension Ring in a defined by x^2 + 4*x + 2

sage: R.<a> = ZqFM(25, 40); R
5-adic Unramified Extension Ring in a defined by x^2 + 4*x + 2

sage: R.<a> = ZqFP(25, 40); R
5-adic Unramified Extension Ring in a defined by x^2 + 4*x + 2
}}}

URL: https://trac.sagemath.org/25908
Reported by: caruso
Ticket author(s): Xavier Caruso
Reviewer(s): David Roe
  • Loading branch information
Release Manager authored and vbraun committed Aug 10, 2018
2 parents fc68b6b + 648ea64 commit 574d72f
Show file tree
Hide file tree
Showing 26 changed files with 472 additions and 318 deletions.
2 changes: 1 addition & 1 deletion src/sage/categories/pushout.py
Expand Up @@ -2988,7 +2988,7 @@ def _apply_functor(self, R):
sage: R.<a> = K[]
sage: AEF = sage.categories.pushout.AlgebraicExtensionFunctor([a^2-3], ['a'], [None])
sage: AEF(K)
Eisenstein Extension in a defined by a^2 - 3 with capped relative precision 6 over 3-adic Field
3-adic Eisenstein Extension Field in a defined by a^2 - 3
"""
from sage.all import QQ, ZZ, CyclotomicField
Expand Down
19 changes: 15 additions & 4 deletions src/sage/modular/overconvergent/genus0.py
Expand Up @@ -356,7 +356,7 @@ def _set_radius(self, radius):
sage: OverconvergentModularForms(3, 2, 1/40, base_ring=L)
Traceback (most recent call last):
...
ValueError: no element of base ring (=Eisenstein Extension ...) has normalised valuation 3/20
ValueError: no element of base ring (=3-adic Eisenstein Extension ...) has normalised valuation 3/20
"""

p = ZZ(self.prime())
Expand Down Expand Up @@ -418,7 +418,7 @@ def base_extend(self, ring):
sage: M = OverconvergentModularForms(2, 0, 1/2, base_ring = Qp(2))
sage: M.base_extend(Qp(2).extension(x^2 - 2, names="w"))
Space of 2-adic 1/2-overconvergent modular forms of weight-character 0 over Eisenstein Extension ...
Space of 2-adic 1/2-overconvergent modular forms of weight-character 0 over 2-adic Eisenstein Extension ...
sage: M.base_extend(QQ)
Traceback (most recent call last):
...
Expand Down Expand Up @@ -549,7 +549,12 @@ def _params(self):
sage: L.<w> = Qp(7).extension(x^2 - 7)
sage: OverconvergentModularForms(7, 0, 1/4, base_ring=L)._params()
(7, 0, 1/4, Eisenstein Extension ..., 20, Dirichlet character modulo 7 of conductor 1 mapping 3 |--> 1)
(7,
0,
1/4,
7-adic Eisenstein Extension Field in w defined by x^2 - 7,
20,
Dirichlet character modulo 7 of conductor 1 mapping 3 |--> 1)
"""
return (self.prime(), self.weight().k(), self.radius(), self.base_ring(), self.prec(), self.weight().chi())
Expand All @@ -562,7 +567,13 @@ def __reduce__(self):
sage: L.<w> = Qp(7).extension(x^2 - 7)
sage: OverconvergentModularForms(7, 0, 1/4, base_ring=L).__reduce__()
(<function OverconvergentModularForms at ...>, (7, 0, 1/4, Eisenstein Extension ..., 20, Dirichlet character modulo 7 of conductor 1 mapping 3 |--> 1))
(<function OverconvergentModularForms at ...>,
(7,
0,
1/4,
7-adic Eisenstein Extension Field in w defined by x^2 - 7,
20,
Dirichlet character modulo 7 of conductor 1 mapping 3 |--> 1))
"""
return (OverconvergentModularForms, self._params())
Expand Down
4 changes: 2 additions & 2 deletions src/sage/rings/finite_rings/finite_field_base.pyx
Expand Up @@ -1284,15 +1284,15 @@ cdef class FiniteField(Field):
sage: K.<a> = Qq(49); k = K.residue_field()
sage: k.convert_map_from(K)
Reduction morphism:
From: Unramified Extension in a defined by x^2 + 6*x + 3 with capped relative precision 20 over 7-adic Field
From: 7-adic Unramified Extension Field in a defined by x^2 + 6*x + 3
To: Finite Field in a0 of size 7^2
Check that :trac:`8240 is resolved::
sage: R.<a> = Zq(81); k = R.residue_field()
sage: k.convert_map_from(R)
Reduction morphism:
From: Unramified Extension in a defined by x^4 + 2*x^3 + 2 with capped relative precision 20 over 3-adic Ring
From: 3-adic Unramified Extension Ring in a defined by x^4 + 2*x^3 + 2
To: Finite Field in a0 of size 3^4
"""
from sage.rings.padics.padic_generic import pAdicGeneric, ResidueReductionMap
Expand Down
26 changes: 13 additions & 13 deletions src/sage/rings/padics/CA_template.pxi
Expand Up @@ -1203,7 +1203,7 @@ cdef class pAdicConvert_CA_ZZ(RingMap):
sage: f.category()
Category of homsets of sets
"""
if R.degree() > 1 or R.characteristic() != 0 or R.residue_characteristic() == 0:
if R.absolute_degree() > 1 or R.characteristic() != 0 or R.residue_characteristic() == 0:
RingMap.__init__(self, Hom(R, ZZ, SetsWithPartialMaps()))
else:
RingMap.__init__(self, Hom(R, ZZ, Sets()))
Expand Down Expand Up @@ -1363,8 +1363,8 @@ cdef class pAdicCoercion_CA_frac_field(RingHomomorphism):
sage: K = R.fraction_field()
sage: f = K.coerce_map_from(R); f
Ring morphism:
From: Unramified Extension in a defined by x^3 + 2*x + 1 with capped absolute precision 20 over 3-adic Ring
To: Unramified Extension in a defined by x^3 + 2*x + 1 with capped relative precision 20 over 3-adic Field
From: 3-adic Unramified Extension Ring in a defined by x^3 + 2*x + 1
To: 3-adic Unramified Extension Field in a defined by x^3 + 2*x + 1
TESTS::
Expand Down Expand Up @@ -1487,8 +1487,8 @@ cdef class pAdicCoercion_CA_frac_field(RingHomomorphism):
sage: g = copy(f) # indirect doctest
sage: g
Ring morphism:
From: Unramified Extension in a defined by x^3 + 2*x + 1 with capped absolute precision 20 over 3-adic Ring
To: Unramified Extension in a defined by x^3 + 2*x + 1 with capped relative precision 20 over 3-adic Field
From: 3-adic Unramified Extension Ring in a defined by x^3 + 2*x + 1
To: 3-adic Unramified Extension Field in a defined by x^3 + 2*x + 1
sage: g == f
True
sage: g is f
Expand Down Expand Up @@ -1516,8 +1516,8 @@ cdef class pAdicCoercion_CA_frac_field(RingHomomorphism):
sage: g = copy(f) # indirect doctest
sage: g
Ring morphism:
From: Unramified Extension in a defined by x^2 + 2*x + 2 with capped absolute precision 20 over 3-adic Ring
To: Unramified Extension in a defined by x^2 + 2*x + 2 with capped relative precision 20 over 3-adic Field
From: 3-adic Unramified Extension Ring in a defined by x^2 + 2*x + 2
To: 3-adic Unramified Extension Field in a defined by x^2 + 2*x + 2
sage: g == f
True
sage: g is f
Expand Down Expand Up @@ -1573,8 +1573,8 @@ cdef class pAdicConvert_CA_frac_field(Morphism):
sage: K = R.fraction_field()
sage: f = R.convert_map_from(K); f
Generic morphism:
From: Unramified Extension in a defined by x^3 + 2*x + 1 with capped relative precision 20 over 3-adic Field
To: Unramified Extension in a defined by x^3 + 2*x + 1 with capped absolute precision 20 over 3-adic Ring
From: 3-adic Unramified Extension Field in a defined by x^3 + 2*x + 1
To: 3-adic Unramified Extension Ring in a defined by x^3 + 2*x + 1
"""
def __init__(self, K, R):
"""
Expand Down Expand Up @@ -1681,8 +1681,8 @@ cdef class pAdicConvert_CA_frac_field(Morphism):
sage: g = copy(f) # indirect doctest
sage: g
Generic morphism:
From: Unramified Extension in a defined by x^3 + 2*x + 1 with capped relative precision 20 over 3-adic Field
To: Unramified Extension in a defined by x^3 + 2*x + 1 with capped absolute precision 20 over 3-adic Ring
From: 3-adic Unramified Extension Field in a defined by x^3 + 2*x + 1
To: 3-adic Unramified Extension Ring in a defined by x^3 + 2*x + 1
sage: g == f
True
sage: g is f
Expand All @@ -1709,8 +1709,8 @@ cdef class pAdicConvert_CA_frac_field(Morphism):
sage: g = copy(f) # indirect doctest
sage: g
Generic morphism:
From: Unramified Extension in a defined by x^2 + 2*x + 2 with capped relative precision 20 over 3-adic Field
To: Unramified Extension in a defined by x^2 + 2*x + 2 with capped absolute precision 20 over 3-adic Ring
From: 3-adic Unramified Extension Field in a defined by x^2 + 2*x + 2
To: 3-adic Unramified Extension Ring in a defined by x^2 + 2*x + 2
sage: g == f
True
sage: g is f
Expand Down
28 changes: 14 additions & 14 deletions src/sage/rings/padics/CR_template.pxi
Expand Up @@ -1670,7 +1670,7 @@ cdef class pAdicConvert_CR_ZZ(RingMap):
sage: Zp(5).coerce_map_from(ZZ).section().category()
Category of homsets of sets
"""
if R.is_field() or R.degree() > 1 or R.characteristic() != 0 or R.residue_characteristic() == 0:
if R.is_field() or R.absolute_degree() > 1 or R.characteristic() != 0 or R.residue_characteristic() == 0:
RingMap.__init__(self, Hom(R, ZZ, SetsWithPartialMaps()))
else:
RingMap.__init__(self, Hom(R, ZZ, Sets()))
Expand Down Expand Up @@ -1888,7 +1888,7 @@ cdef class pAdicConvert_CR_QQ(RingMap):
sage: f.category()
Category of homsets of sets
"""
if R.degree() > 1 or R.characteristic() != 0 or R.residue_characteristic() == 0:
if R.absolute_degree() > 1 or R.characteristic() != 0 or R.residue_characteristic() == 0:
RingMap.__init__(self, Hom(R, QQ, SetsWithPartialMaps()))
else:
RingMap.__init__(self, Hom(R, QQ, Sets()))
Expand Down Expand Up @@ -2079,8 +2079,8 @@ cdef class pAdicCoercion_CR_frac_field(RingHomomorphism):
sage: K = R.fraction_field()
sage: f = K.coerce_map_from(R); f
Ring morphism:
From: Unramified Extension in a defined by x^3 + 2*x + 1 with capped relative precision 20 over 3-adic Ring
To: Unramified Extension in a defined by x^3 + 2*x + 1 with capped relative precision 20 over 3-adic Field
From: 3-adic Unramified Extension Ring in a defined by x^3 + 2*x + 1
To: 3-adic Unramified Extension Field in a defined by x^3 + 2*x + 1
TESTS::
Expand Down Expand Up @@ -2207,8 +2207,8 @@ cdef class pAdicCoercion_CR_frac_field(RingHomomorphism):
sage: g = copy(f) # indirect doctest
sage: g
Ring morphism:
From: Unramified Extension in a defined by x^3 + 2*x + 1 with capped relative precision 20 over 3-adic Ring
To: Unramified Extension in a defined by x^3 + 2*x + 1 with capped relative precision 20 over 3-adic Field
From: 3-adic Unramified Extension Ring in a defined by x^3 + 2*x + 1
To: 3-adic Unramified Extension Field in a defined by x^3 + 2*x + 1
sage: g == f
True
sage: g is f
Expand Down Expand Up @@ -2236,8 +2236,8 @@ cdef class pAdicCoercion_CR_frac_field(RingHomomorphism):
sage: g = copy(f) # indirect doctest
sage: g
Ring morphism:
From: Unramified Extension in a defined by x^2 + 2*x + 2 with capped relative precision 20 over 3-adic Ring
To: Unramified Extension in a defined by x^2 + 2*x + 2 with capped relative precision 20 over 3-adic Field
From: 3-adic Unramified Extension Ring in a defined by x^2 + 2*x + 2
To: 3-adic Unramified Extension Field in a defined by x^2 + 2*x + 2
sage: g == f
True
sage: g is f
Expand Down Expand Up @@ -2293,8 +2293,8 @@ cdef class pAdicConvert_CR_frac_field(Morphism):
sage: K = R.fraction_field()
sage: f = R.convert_map_from(K); f
Generic morphism:
From: Unramified Extension in a defined by x^3 + 2*x + 1 with capped relative precision 20 over 3-adic Field
To: Unramified Extension in a defined by x^3 + 2*x + 1 with capped relative precision 20 over 3-adic Ring
From: 3-adic Unramified Extension Field in a defined by x^3 + 2*x + 1
To: 3-adic Unramified Extension Ring in a defined by x^3 + 2*x + 1
"""
def __init__(self, K, R):
"""
Expand Down Expand Up @@ -2397,8 +2397,8 @@ cdef class pAdicConvert_CR_frac_field(Morphism):
sage: g = copy(f) # indirect doctest
sage: g
Generic morphism:
From: Unramified Extension in a defined by x^3 + 2*x + 1 with capped relative precision 20 over 3-adic Field
To: Unramified Extension in a defined by x^3 + 2*x + 1 with capped relative precision 20 over 3-adic Ring
From: 3-adic Unramified Extension Field in a defined by x^3 + 2*x + 1
To: 3-adic Unramified Extension Ring in a defined by x^3 + 2*x + 1
sage: g == f
True
sage: g is f
Expand All @@ -2425,8 +2425,8 @@ cdef class pAdicConvert_CR_frac_field(Morphism):
sage: g = copy(f) # indirect doctest
sage: g
Generic morphism:
From: Unramified Extension in a defined by x^2 + 2*x + 2 with capped relative precision 20 over 3-adic Field
To: Unramified Extension in a defined by x^2 + 2*x + 2 with capped relative precision 20 over 3-adic Ring
From: 3-adic Unramified Extension Field in a defined by x^2 + 2*x + 2
To: 3-adic Unramified Extension Ring in a defined by x^2 + 2*x + 2
sage: g == f
True
sage: g is f
Expand Down
26 changes: 13 additions & 13 deletions src/sage/rings/padics/FM_template.pxi
Expand Up @@ -1009,7 +1009,7 @@ cdef class pAdicConvert_FM_ZZ(RingMap):
sage: f.category()
Category of homsets of sets
"""
if R.degree() > 1 or R.characteristic() != 0 or R.residue_characteristic() == 0:
if R.absolute_degree() > 1 or R.characteristic() != 0 or R.residue_characteristic() == 0:
RingMap.__init__(self, Hom(R, ZZ, SetsWithPartialMaps()))
else:
RingMap.__init__(self, Hom(R, ZZ, Sets()))
Expand Down Expand Up @@ -1159,8 +1159,8 @@ cdef class pAdicCoercion_FM_frac_field(RingHomomorphism):
sage: K = R.fraction_field()
sage: f = K.coerce_map_from(R); f
Ring morphism:
From: Unramified Extension in a defined by x^3 + 2*x + 1 of fixed modulus 3^20 over 3-adic Ring
To: Unramified Extension in a defined by x^3 + 2*x + 1 with floating precision 20 over 3-adic Field
From: 3-adic Unramified Extension Ring in a defined by x^3 + 2*x + 1
To: 3-adic Unramified Extension Field in a defined by x^3 + 2*x + 1
TESTS::
Expand Down Expand Up @@ -1278,8 +1278,8 @@ cdef class pAdicCoercion_FM_frac_field(RingHomomorphism):
sage: g = copy(f) # indirect doctest
sage: g
Ring morphism:
From: Unramified Extension in a defined by x^3 + 2*x + 1 of fixed modulus 3^20 over 3-adic Ring
To: Unramified Extension in a defined by x^3 + 2*x + 1 with floating precision 20 over 3-adic Field
From: 3-adic Unramified Extension Ring in a defined by x^3 + 2*x + 1
To: 3-adic Unramified Extension Field in a defined by x^3 + 2*x + 1
sage: g == f
True
sage: g is f
Expand All @@ -1306,8 +1306,8 @@ cdef class pAdicCoercion_FM_frac_field(RingHomomorphism):
sage: g = copy(f) # indirect doctest
sage: g
Ring morphism:
From: Unramified Extension in a defined by x^2 + 2*x + 2 of fixed modulus 3^20 over 3-adic Ring
To: Unramified Extension in a defined by x^2 + 2*x + 2 with floating precision 20 over 3-adic Field
From: 3-adic Unramified Extension Ring in a defined by x^2 + 2*x + 2
To: 3-adic Unramified Extension Field in a defined by x^2 + 2*x + 2
sage: g == f
True
sage: g is f
Expand Down Expand Up @@ -1363,8 +1363,8 @@ cdef class pAdicConvert_FM_frac_field(Morphism):
sage: K = R.fraction_field()
sage: f = R.convert_map_from(K); f
Generic morphism:
From: Unramified Extension in a defined by x^3 + 2*x + 1 with floating precision 20 over 3-adic Field
To: Unramified Extension in a defined by x^3 + 2*x + 1 of fixed modulus 3^20 over 3-adic Ring
From: 3-adic Unramified Extension Field in a defined by x^3 + 2*x + 1
To: 3-adic Unramified Extension Ring in a defined by x^3 + 2*x + 1
"""
def __init__(self, K, R):
"""
Expand Down Expand Up @@ -1456,8 +1456,8 @@ cdef class pAdicConvert_FM_frac_field(Morphism):
sage: g = copy(f) # indirect doctest
sage: g
Generic morphism:
From: Unramified Extension in a defined by x^3 + 2*x + 1 with floating precision 20 over 3-adic Field
To: Unramified Extension in a defined by x^3 + 2*x + 1 of fixed modulus 3^20 over 3-adic Ring
From: 3-adic Unramified Extension Field in a defined by x^3 + 2*x + 1
To: 3-adic Unramified Extension Ring in a defined by x^3 + 2*x + 1
sage: g == f
True
sage: g is f
Expand All @@ -1484,8 +1484,8 @@ cdef class pAdicConvert_FM_frac_field(Morphism):
sage: g = copy(f) # indirect doctest
sage: g
Generic morphism:
From: Unramified Extension in a defined by x^2 + 2*x + 2 with floating precision 20 over 3-adic Field
To: Unramified Extension in a defined by x^2 + 2*x + 2 of fixed modulus 3^20 over 3-adic Ring
From: 3-adic Unramified Extension Field in a defined by x^2 + 2*x + 2
To: 3-adic Unramified Extension Ring in a defined by x^2 + 2*x + 2
sage: g == f
True
sage: g is f
Expand Down

0 comments on commit 574d72f

Please sign in to comment.