#14489: _S_class_group_and_units is mathematically incorrect
---------------------------------+------------------------------------------
       Reporter:  robharron      |         Owner:  davidloeffler
           Type:  defect         |        Status:  needs_review 
       Priority:  critical       |     Milestone:  sage-5.10    
      Component:  number fields  |    Resolution:               
       Keywords:  S-class group  |   Work issues:               
Report Upstream:  N/A            |     Reviewers:  Peter Bruin  
        Authors:  Robert Harron  |     Merged in:               
   Dependencies:                 |      Stopgaps:               
---------------------------------+------------------------------------------

Old description:

> The output of _S_class_group_and_units is incorrect, and hence the output
> of selmer_group as well, in some cases where S contains non-principal
> ideals. Here's an example:
>
> {{{
> sage: K.<a> = NumberField(x^3 - 381 * x + 127)
> sage: S = tuple(K.primes_above(13))
> sage: K.selmer_group(S, 2)
> [-7/13*a^2 - 140/13*a + 36/13,
>  14/13*a^2 + 267/13*a - 85/13,
>  7/13*a^2 + 127/13*a - 49/13,
>  -1,
>  1/13*a^2 + 20/13*a - 7/13,
>  1/13*a^2 - 19/13*a + 6/13,
>  121,
>  10/13*a^2 + 44/13*a - 4555/13]
> }}}
>
> It's fairly easy, using Sage, to see that the S-2-Selmer group of K is an
> 8-dimensional F_2-vector space. The list of length 8 that is returned is
> supposed to be a basis of this (or rather a set of representatives in
> K^×^). But the S-2-Selmer group is a subgroup of K^×^ mod squares, so 121
> is the zero vector and hence the output is not linearly independent. The
> problem lies in the following:
>
> {{{
> sage: K._S_class_group_and_units(S)
> ([-7/13*a^2 - 140/13*a + 36/13,
>   14/13*a^2 + 267/13*a - 85/13,
>   7/13*a^2 + 127/13*a - 49/13,
>   -1,
>   1/13*a^2 + 20/13*a - 7/13,
>   1/13*a^2 - 19/13*a + 6/13],
>  [(Fractional ideal (11, a - 2), 2, 121),
>   (Fractional ideal (19, 1/13*a^2 - 45/13*a - 332/13),
>    2,
>    10/13*a^2 + 44/13*a - 4555/13)])
> }}}
>
> The 121 in there is supposed to be such that (11, a-2)^2^ = (121). But
> (11, a-2)^2^ is *not* principal (in fact, (11, a-2) is a generator of the
> cyclic subgroup of order 6). It is just in the subgroup of the class
> group generated by the primes in S.
>
> I'll shortly upload a patch that fixes this (partially suggested to me by
> Zev Klagsbrun).

New description:

 The output of _S_class_group_and_units is incorrect, and hence the output
 of selmer_group as well, in some cases where S contains non-principal
 ideals. Here's an example:

 {{{
 sage: K.<a> = NumberField(x^3 - 381 * x + 127)
 sage: S = tuple(K.primes_above(13))
 sage: K.selmer_group(S, 2)
 [-7/13*a^2 - 140/13*a + 36/13,
  14/13*a^2 + 267/13*a - 85/13,
  7/13*a^2 + 127/13*a - 49/13,
  -1,
  1/13*a^2 + 20/13*a - 7/13,
  1/13*a^2 - 19/13*a + 6/13,
  121,
  10/13*a^2 + 44/13*a - 4555/13]
 }}}

 It's fairly easy, using Sage, to see that the S-2-Selmer group of K is an
 8-dimensional F_2-vector space. The list of length 8 that is returned is
 supposed to be a basis of this (or rather a set of representatives in
 K^×^). But the S-2-Selmer group is a subgroup of K^×^ mod squares, so 121
 is the zero vector and hence the output is not linearly independent. The
 problem lies in the following:

 {{{
 sage: K._S_class_group_and_units(S)
 ([-7/13*a^2 - 140/13*a + 36/13,
   14/13*a^2 + 267/13*a - 85/13,
   7/13*a^2 + 127/13*a - 49/13,
   -1,
   1/13*a^2 + 20/13*a - 7/13,
   1/13*a^2 - 19/13*a + 6/13],
  [(Fractional ideal (11, a - 2), 2, 121),
   (Fractional ideal (19, 1/13*a^2 - 45/13*a - 332/13),
    2,
    10/13*a^2 + 44/13*a - 4555/13)])
 }}}

 The 121 in there is supposed to be such that (11, a-2)^2^ = (121). But
 (11, a-2)^2^ is *not* principal (in fact, (11, a-2) is a generator of the
 cyclic subgroup of order 6). It is just in the subgroup of the class group
 generated by the primes in S.

 I'll shortly upload a patch that fixes this (partially suggested to me by
 Zev Klagsbrun).

 Apply: trac_14489_fix_S_class_group_and_units.patch

--

Comment (by pbruin):

 I would tend to give this a positive review.  The patch fixes the problem,
 I believe the code is correct, all tests pass, and the documentation
 builds correctly.  I have a few comments, though:

 1. The changes in the docstrings are not very clearly written.  The
 sentences are very long and contain awkward constructions ("a fractional
 ideal representative of the S-class group generator whose order (in the
 S-class group) is order"; "principal generator").

 2. The new docstring of _S_class_group_and_units in number_field.py
 suggests that to obtain a principal ideal, gen^order^ can be multiplied by
 any fractional ideal J whose class is in the subgroup of the class group
 generated by ideals in S.  However, the condition is more strict: J must
 be in the subgroup of the ''ideal group'' generated by ideals in S.

 3. In general (not because of this patch), the code for computing Selmer
 groups is a bit convoluted.  Conceptually, the computation of the
 generators for principal ideals of the form gen^order^ belongs in
 selmer_group, not _S_class_group_and_units.  In my opinion it would be
 more correct to return, as S-class group generators, pairs (gen, order)
 instead of triples (gen, order, pr), and leave the computation of the
 principal ideal generators to selmer_group.

 I made a patch on top of this one to address these issues.  An additional
 reviewer would probably be needed, but I think it should not be too hard
 to review.  The two patches together have a net effect of simplifying the
 Selmer group code somewhat.

 Alternatively, I could file a new ticket for the additional changes, if
 the second patch would delay closing this ticket too long.

 Any opinions about which option would be better?

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/14489#comment:12>
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.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to