Opened 10 years ago

Closed 9 years ago

Last modified 9 years ago

#11319 closed defect (fixed)

Cannot create homomorphism from prime residue field to finite field

Reported by: johanbosman Owned by: robertwb
Priority: major Milestone: sage-4.8
Component: coercion Keywords: residue fields, finite fields, hom, sd35
Cc: Merged in: sage-4.8.alpha6
Authors: Johan Bosman Reviewers: Kiran Kedlaya, Michiel Kosters
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges

Description (last modified by johanbosman)

Consider K = QQ(sqrt(337)). The prime 5 is inert in K and the prime 13 splits. We'll start with 13 to see what goes wrong:

sage: K.<w> = QuadraticField(337)
sage: pp = K.ideal(13).factor()[0][0]
sage: RF13 = K.residue_field(pp)
sage: RF13.gens()
(1,)
sage: RF13.hom([GF(13)(1)])
...
TypeError: images do not define a valid homomorphism

However, for residue fields that aren't prime fields it does work:

sage: RF5 = K.residue_field(5)
sage: F25 = GF(25, names='a', modulus=RF5.polynomial())
sage: RF5.hom([F25.0])
Ring morphism:
  From: Residue field in wbar of Fractional ideal (5)
  To:   Finite Field in a of size 5^2
  Defn: wbar |--> a

Btw, this is in sage 4.6.2. on Mac OS 10.6.7.

Attachments (2)

trac_11319_prime_field_coercion.patch (2.0 KB) - added by johanbosman 10 years ago.
trac_11319_number_field_example.patch (1.1 KB) - added by johanbosman 10 years ago.
To be used on top of the first patch

Download all attachments as: .zip

Change History (12)

comment:1 Changed 10 years ago by johanbosman

  • Description modified (diff)

Changed 10 years ago by johanbosman

comment:2 Changed 10 years ago by johanbosman

  • Authors set to Johan Bosman
  • Status changed from new to needs_review

comment:3 Changed 10 years ago by aly.deines

  • Status changed from needs_review to needs_work

I was trying out the patch, and the following example didn't work out like I expected:

sage: K
Number Field in a with defining polynomial x^3 - 2
sage: K.<a> = NumberField(x^3-2)
sage: P = K.ideal(7)
sage: P.factor()
Fractional ideal (7)
sage: k = P.residue_field()
sage: k.order()
343
sage: F.<b> = GF(343)
sage: F.order()
343
sage: k
Residue field in abar of Fractional ideal (7)
sage: F
Finite Field in b of size 7^3
sage: k.hom([F(1)])
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)

/Users/aly/Desktop/sage-4.7.rc2/<ipython console> in <module>()

/Users/aly/Desktop/sage-4.7.rc2/local/lib/python2.6/site-packages/sage/structure/parent_gens.so in sage.structure.parent_gens.ParentWithGens.hom (sage/structure/parent_gens.c:3792)()

/Users/aly/Desktop/sage-4.7.rc2/local/lib/python2.6/site-packages/sage/structure/parent.so in sage.structure.parent.Parent.hom (sage/structure/parent.c:9067)()

/Users/aly/Desktop/sage-4.7.rc2/local/lib/python2.6/site-packages/sage/rings/finite_rings/homset.pyc in __call__(self, im_gens, check)
     49                 return self._coerce_impl(im_gens)
     50             except TypeError:
---> 51                 raise TypeError, "images do not define a valid homomorphism"
     52         
     53     def _coerce_impl(self, x):

TypeError: images do not define a valid homomorphism   
sage: k.has_coerce_map_from(F)
False

Should this patch fix this as well?

comment:4 Changed 10 years ago by johanbosman

  • Status changed from needs_work to needs_review

In your example, you're trying to send the generator of k to the element 1 of F, which does indeed not define a field homomorphism. This does work:

sage: root = k.polynomial().roots(F)[0][0]
sage: k.hom([root])
Ring morphism:
  From: Residue field in abar of Fractional ideal (7)
  To:   Finite Field in b of size 7^3
  Defn: abar |--> 4*b^2 + 4*b + 2

comment:5 Changed 10 years ago by kedlaya

  • Reviewers set to Kiran Kedlaya
  • Status changed from needs_review to positive_review

Looks fine, applies against 4.7, no long doctest failures.

comment:6 Changed 10 years ago by jdemeyer

  • Status changed from positive_review to needs_work
  • Work issues set to examples

I think the new patch is a bit low on examples. For example, the ticket mentions number fields, so why not add a number field example?

Changed 10 years ago by johanbosman

To be used on top of the first patch

comment:7 Changed 10 years ago by johanbosman

  • Status changed from needs_work to needs_review
  • Work issues examples deleted

Example added. ;)

comment:8 Changed 10 years ago by mkosters

  • Reviewers changed from Kiran Kedlaya to Kiran Kedlaya, Michiel Kosters
  • Status changed from needs_review to positive_review

comment:9 Changed 9 years ago by jdemeyer

  • Merged in set to sage-4.8.alpha6
  • Resolution set to fixed
  • Status changed from positive_review to closed

comment:10 Changed 9 years ago by mstreng

  • Keywords sd35 added
Note: See TracTickets for help on using tickets.