#5856: [with patch, needs review] elliptic curves over Z/pZ are treated totally
differently than elliptic curves over GF(p)
---------------------------+------------------------------------------------
 Reporter:  was            |       Owner:  AlexGhitza                       
     Type:  enhancement    |      Status:  assigned                         
 Priority:  major          |   Milestone:  sage-3.4.2                       
Component:  number theory  |    Keywords:  elliptic curve integers mod prime
---------------------------+------------------------------------------------

Comment(by AlexGhitza):

 Replying to [comment:5 cremona]:
 > I was expecting that here,
 > {{{
 > sage: F = Zmod(101)
 >       92              sage: EllipticCurve(F, [2, 3])
 >       93              Elliptic Curve defined by y^2 = x^3 + 2*x + 3 over
 Ring of integers modulo 101
 >       94              sage: E = EllipticCurve([F(2), F(3)])
 >       95              sage: type(E)
 >       96              <class
 'sage.schemes.elliptic_curves.ell_finite_field.EllipticCurve_finite_field'>
 > }}}
 > both would end up as EllipticCurve_finite_field objects, but I guess
 that we have to have a way of constructing the other things, so that is
 ok.
 > But would it not be better to change the base_ring (and base_field) of E
 in the second case to GF(101)?

 Both of these do end up as {{{EllipticCurve_finite_field}}} objects, which
 is fine because (mathematically) {{{Zmod(101)}}} is a finite field.
 However, I did not want to just change the base ring to {{{GF(101)}}}
 because I don't think it is necessary, and after all the user specified
 that she wanted the base ring to be {{{Zmod(101)}}}.  It's a bit pedantic,
 but we should give the user the object she asks for (if possible), not
 something that's isomorphic to it.  I think the point becomes more clear
 in another situation, which I ran into while testing this code: say you
 have an elliptic curve over a number field, and you take its reduction at
 some good prime.  You end up with an elliptic curve over what is
 mathematically a finite field, so should we just force this curve to be
 over {{{GF(q)}}} rather than {{{Residue field of...}}}?  We would be
 throwing away some information here, and I think we shouldn't.

 So my philosophy in this patch was that we keep the base ring that the
 user asked for, but we're smart enough to recognise that it's
 (mathematically) a finite field so we create an elliptic curve of the
 appropriate type.

 > Next (but not this patch's fault at all):
 >
 > {{{
 > sage: R = Zmod(101)
 > sage: is_Field(R)
 > True
 > sage: is_FiniteField(R)
 > False
 > }}}
 >
 > Now the second is justified since the is_*() functions are supposed to
 do a type test, not prove a theorem, but then why should the first not
 also return False?  Should this be a new ticket?

 I noticed this as well when writing the code because I was getting
 inconsistent behaviour from these two functions.  It's a bit annoying for
 the developer (since we somehow assume that {{{is_*()}}} just checks
 types), but I guess it is documented...

 >
 > Here:
 > {{{
 > 227                   raise ValueError, "sequence of coefficients must
 have length at 2 or 5"
 >       246             raise ValueError, "sequence of coefficients must
 have length between 2 and 5"
 > }}}
 > It is [2,5] and not [2..5], and the only valid lengths are 2 and 5, so
 can we put that back to how it was?

 Sorry about this one, I saw it from the corner of my eye and my hands did
 the typing before the brain had time to process it properly.  Also the
 "at" in "length at 2 or 5" confused me.  I've changed it now, and replaced
 the patch.

 > Sorry to be such a pain with my reviews...I'll give it a positive review
 if the very last point is seen to.

 I'm happy you are so careful with the reviews.  It's hard to think of
 everything that could go wrong (thank god for doctests), or that could be
 confusing, or that could be bad design, especially when you fix a
 particular bug without necessarily having the big picture in mind.  So
 it's great to have a fresh pair of eyes look over this stuff.

 I'm marking this as "needs review" again, but the only new change is
 reverting the "2 to 5" mistake.

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/5856#comment:7>
Sage <http://sagemath.org/>
Sage - Open Source Mathematical Software: Building the Car Instead of 
Reinventing the Wheel

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

Reply via email to