I think I can explain this.

Basically, Sage does *not* support elliptic curves over rings which are not 
integral domains, and in particular does not support them over Z/NZ except 
for N prime.  BUT  at some opint in the past it had been possible to 
demonstrate the elliptic curve factorization method by creating elliptic 
curves over Z/NZ (where N is the number to be factored), and when that 
stoppped working becuase someone actually put in a test that the base ring 
was in integral domain, people who used Sage for teaching complained.  One 
such person was Ken Ribet, whose opinion counts for something among number 
theorists (and beyond, he has been President of the AMS).  So someone else 
(OK it was me) put a fudge into the constructor whereby if the base field 
is finite then it constructs the curve of type elliptic_curve_field -- so 
that one is then allowed to construct points and add them etc -- which kept 
Ribet happy.

Now one can remove that fudge -- ot at least have a big warning output when 
it is used, but there will be people who object.

If someone wants to implement elliptic curves over Z/NZ for arbitrary N (or 
just prime power N) then they are welcome, but you will want to think very 
carefully about what you are doing and whether it even makes sense to do 
arithmetic on points.

John 


On Thursday, May 14, 2020 at 11:41:04 AM UTC+1, Daniel Loughran wrote:
>
> Hello. I think that I may have found a bug involving elliptic curves 
> modulo powers of primes. I have attached the working jupyter notebook, but 
> my code and results are also below.
>
> In my code I have an elliptic curve E over Q with good reduction at 2 and 
> the point P = (2:-3:8) (homogeneous coordinates).
>
> It is clear that the reduction modulo 4 of this point in projective space 
> is (2:1:0).
>
> However, sage is telling me that when I reduce the curve modulo 4 then ask 
> what point P reduces to, I get the identity element (0:1:0).
>
> My guess is that sage does something like put this point into the form 
> (1/4:-3/8:1), then notices that 4 divides the denominator of the 
> x-coordinate so just kills it. But really it should be clearing 
> denominators before it tries to reduce modulo 4. 
>
> There is another related bug: if I try to instead reduce this point modulo 
> 16, then I just get the error "inverse of Mod(4, 16) does not exist". I 
> guess this is a similar problem to the above.
>
>
>
> ------------------------------------------------------------------------------------------------------------------------------
>
> E=EllipticCurve([0, 0, 1, -1, 0]); E
>
> Elliptic Curve defined by y^2 + y = x^3 - x over Rational Field
>
> P=E(2,-3,8); P
>
> (1/4 : -3/8 : 1)
>
> E4=E.change_ring(Integers(4)); E4
>
> Elliptic Curve defined by y^2 + y = x^3 + 3*x over Ring of integers modulo 4
>
> E4(P)
>
> (0 : 1 : 0)
>
> P2.<X,Y,Z> = ProjectiveSpace(Integers(4),2); P2
>
> Projective Space of dimension 2 over Ring of integers modulo 4
>
> P2(2,-3,8)
>
> (2 : 1 : 0)
>
> P2(0,1,0)
>
> (0 : 1 : 0)
>
> P2(2,-3,8)==P2(0,1,0)
>
> False
>
> E16=E.change_ring(Integers(16)); E16
>
> Elliptic Curve defined by y^2 + y = x^3 + 15*x over Ring of integers modulo 16
>
> E16(P)
> ZeroDivisionError: inverse of Mod(4, 16) does not exist
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-devel/c41b3535-0fc7-4246-a814-67b8b05a602d%40googlegroups.com.

Reply via email to