Opened 10 years ago

Closed 10 years ago

#10850 closed defect (fixed)

composition and comparison of number-field homomorphisms

Reported by: fwclarke Owned by: davidloeffler
Priority: major Milestone: sage-4.7.2
Component: number fields Keywords:
Cc: SimonKing Merged in: sage-4.7.2.alpha3
Authors: Francis Clarke Reviewers: David Loeffler
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges

Description (last modified by leif)

As of 4.6.2.rc0, when homomorphisms of number fields are composed the result has type RingHomomorphism_im_gens rather than NumberFieldHomomorphism_im_gens:

sage: K = QuadraticField(2)
sage: e, f = End(K)
sage: type(f)
<class 'sage.rings.number_field.morphism.NumberFieldHomomorphism_im_gens'>
sage: type(f*f)
<type 'sage.rings.morphism.RingHomomorphism_im_gens'>

Consequently, comparison fails to work correctly:

sage: f*f == e
sage: f*f
Ring endomorphism of Number Field in a with defining polynomial x^2 - 2
  Defn: a |--> a
sage: e
Ring endomorphism of Number Field in a with defining polynomial x^2 - 2
  Defn: a |--> a

Moreover, for relative number fields composition yields a formal composite map:

sage: L.<a, b> = NumberField([x^2 - 2, x^2 - 3])
sage: g = End(L)[1]
sage: type(g*g)
<type ''>

and this means that powers beyond cubes produce an error:

sage: g^4
Traceback (most recent call last)
AttributeError: '' object has no attribute '_rational_'

Comparison for homomorphisms out of relative number fields needs fixing too, because they are not standard im_gens homomorphisms.

The patch deals with these issues.

Apply trac_10850.patch to the Sage library.

Attachments (1)

trac_10850.patch (4.2 KB) - added by fwclarke 10 years ago.

Download all attachments as: .zip

Change History (5)

Changed 10 years ago by fwclarke

comment:1 Changed 10 years ago by fwclarke

  • Status changed from new to needs_review

comment:2 Changed 10 years ago by davidloeffler

  • Milestone set to sage-4.7.2
  • Reviewers set to David Loeffler
  • Status changed from needs_review to positive_review

This looks great to me -- a simple, clear and well-documented fix. All doctests in sage/rings pass, and the reference manual builds cleanly. Positive review. Always a pleasure to review your patches, Francis!

comment:3 Changed 10 years ago by leif

  • Description modified (diff)

comment:4 Changed 10 years ago by leif

  • Merged in set to sage-4.7.2.alpha3
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.