#4726: Creating homomorphisms of relative number fields seems totally broken
---------------------------------+------------------------------------------
       Reporter:  was            |         Owner:  davidloeffler
           Type:  defect         |        Status:  needs_work   
       Priority:  major          |     Milestone:  sage-5.9     
      Component:  number fields  |    Resolution:               
       Keywords:                 |   Work issues:               
Report Upstream:  N/A            |     Reviewers:               
        Authors:  Robert Harron  |     Merged in:               
   Dependencies:                 |      Stopgaps:               
---------------------------------+------------------------------------------
Changes (by fwclarke):

  * status:  needs_review => needs_work


Comment:

 This mostly works well.  I tried it on some cases where the relative
 degrees were different.  For example
 {{{
 sage: C.<z> = CyclotomicField(15)
 sage: K = C.relativize(z^5 + 1, 'a'); K
 Number Field in a0 with defining polynomial x^4 - a1*x^3 + (a1 - 1)*x^2 +
 x - a1 over its base field
 sage: K.inject_variables()
 Defining a0, a1
 sage: L = C.relativize(z^4 + z, 'b'); L
 Number Field in b0 with defining polynomial x^2 - b1*x - 1/2*b1^3 + b1^2 -
 b1 - 1/2 over its base field
 sage: H = Hom(K, L)
 sage: K.hom(map(H[2], K.gens()))
 Relative number field morphism:
   From: Number Field in a0 with defining polynomial x^4 - a1*x^3 + (a1 -
 1)*x^2 + x - a1 over its base field
   To:   Number Field in b0 with defining polynomial x^2 - b1*x - 1/2*b1^3
 + b1^2 - b1 - 1/2 over its base field
   Defn: a0 |--> -b0 + b1
         a1 |--> -1/2*b1^3 + b1^2 - b1 + 1/2
 }}}

 My concerns are about when the default base homomorphism is used.  It is
 certainly not correct to describe `default_base_hom` as "trivial", and not
 clear anyway what that would mean if the domain and codomain differ.  Its
 docstring says

   ''Pick an embedding of the base field of self into the codomain of this
 homset.  This is done in an essentially arbitrary way.''

 Since the value is cached, see line 526 of
 `sage/rings/number_field/morphism.py` (after your patch is applied), using
 the default argument `base_hom=None` should always give the same
 restriction to the base_field.  However, continuing the above example,
 {{{
 sage: [K.hom([h(a0)])(a1) for h in H]
 [-1/2*b1^3 + b1^2 - b1 + 1/2,
  1/2*b1^3 - b1^2 + b1 + 1/2,
  -1/2*b1^3 + b1^2 - b1 + 1/2,
  1/2*b1^3 - b1^2 + b1 + 1/2,
  -1/2*b1^3 + b1^2 - b1 + 1/2,
  1/2*b1^3 - b1^2 + b1 + 1/2,
  1/2*b1^3 - b1^2 + b1 + 1/2,
  -1/2*b1^3 + b1^2 - b1 + 1/2]
 }}}

 This happens because
 `sage.rings.number_field.morphism.RelativeNumberFieldHomset._from_im`
 doesn't do what it claims.  With again the same definitions:
 {{{
 sage: b0 = L.gen(); b1 = L.base_field().gen()
 sage: base_hom = K.base_field().hom([1/2*b1^3 - b1^2 + b1 + 1/2]);
 base_hom
 Ring morphism:
   From: Number Field in a1 with defining polynomial x^2 - x + 1
   To:   Number Field in b1 with defining polynomial x^4 - x^3 + 2*x^2 + x
 + 1
   Defn: a1 |--> 1/2*b1^3 - b1^2 + b1 + 1/2
 sage: H._from_im([b0], base_hom)
 Relative number field morphism:
   From: Number Field in a0 with defining polynomial x^4 - a1*x^3 + (a1 -
 1)*x^2 + x - a1 over its base field
   To:   Number Field in b0 with defining polynomial x^2 - b1*x - 1/2*b1^3
 + b1^2 - b1 - 1/2 over its base field
   Defn: a0 |--> b0
         a1 |--> -1/2*b1^3 + b1^2 - b1 + 1/2
 }}}
 which does not restrict to the base_field correctly.  I note that at
 present `_from_im` is not used anywhere else in Sage.

 In fact since
 {{{
 sage: K.absolute_generator()
 a0
 }}}
 there is only one homomorphism from `K` to `L` that sends `a0` to `b0`, so
 an error should have been raised by `H._from_im([b0], base_hom)`.

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/4726#comment:5>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to