Possible bug regarding elliptic curves modulo prime powers

104 views
Skip to first unread message

Daniel Loughran

unread,
May 14, 2020, 6:41:04 AM5/14/20
to sage-devel
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
Elliptic_curves_bug.ipynb

Reimundo Heluani

unread,
May 14, 2020, 8:16:33 AM5/14/20
to sage-...@googlegroups.com
On May 14, 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).
>
[2:1:0] is not in that curve as

1^2*0 + 1*0^2 != 1^3 - 1*0^2

The reduction given by sage is however

R
>--
>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 [11]sage-devel+...@googlegroups.com.
>To view this discussion on the web visit [12]https://groups.google.com/d/msgid/
>sage-devel/f2900af4-6aad-4450-9e12-6f1ec95596f8%40googlegroups.com.
>
>References:
>
>[11] mailto:sage-devel+...@googlegroups.com
>[12] https://groups.google.com/d/msgid/sage-devel/f2900af4-6aad-4450-9e12-6f1ec95596f8%40googlegroups.com?utm_medium=email&utm_source=footer


signature.asc

Reimundo Heluani

unread,
May 14, 2020, 8:29:32 AM5/14/20
to 'Reimundo Heluani' via sage-devel
On May 14, 'Reimundo Heluani' via sage-devel wrote:
>On May 14, 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).
>>
>[2:1:0] is not in that curve as
>
>1^2*0 + 1*0^2 != 1^3 - 1*0^2
>
OOops, the LHS is 2^3 - 2*0^2 but still not equal to the RHS :)

R.
>To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+...@googlegroups.com.
>To view this discussion on the web visit https://groups.google.com/d/msgid/sage-devel/20200514121620.GA39760%40vertex.


signature.asc

Daniel Loughran

unread,
May 14, 2020, 9:38:24 AM5/14/20
to sage-devel
I don't follow you; given a rational point on an elliptic curve you can always take its reduction modulo any integer.

The equation of the projective curve is:

Y^2*Z + Y*Z^2 = X^3 - X*Z^2

When you plug in (X:Y:Z) = (2:1:0), all terms involving Z vanish, so you are left with the equation

0 = 2^3 modulo 4,

which indeed holds.
>>To view this discussion on the web visit [12]https://groups.google.com/d/msgid/
>>sage-devel/f2900af4-6aad-4450-9e12-6f1ec95596f8%40googlegroups.com.
>>
>>References:
>>
>>[12] https://groups.google.com/d/msgid/sage-devel/f2900af4-6aad-4450-9e12-6f1ec95596f8%40googlegroups.com?utm_medium=email&utm_source=footer
>
>
>--
>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-...@googlegroups.com.

Reimundo Heluani

unread,
May 14, 2020, 10:26:24 AM5/14/20
to sage-...@googlegroups.com

On May 14, Daniel Loughran wrote:
>I don't follow you; given a rational point on an elliptic curve you can always
>take its reduction modulo any integer.
>
>The equation of the projective curve is:
>
>Y^2*Z + Y*Z^2 = X^3 - X*Z^2
>
>When you plug in (X:Y:Z) = (2:1:0), all terms involving Z vanish, so you are
>left with the equation
>
>0 = 2^3 modulo 4,

My bad, I didn't even check it, just tried:

sage: E4(2,1,0)
Traceback:
...
TypeError: Coordinates [2, 1, 0] do not define a point on Elliptic Curve defined by y^2 + y = x^3 + 3*x over Ring of integers modulo 4
> >>to [11][1]sage-...@googlegroups.com.
> >>To view this discussion on the web visit [12][2]https://groups.google.com
> /d/msgid/
> >>sage-devel/f2900af4-6aad-4450-9e12-6f1ec95596f8%[3]40googlegroups.com.
> >>
> >>References:
> >>
> >>[11] mailto:[4]sage-...@googlegroups.com
> >>[12] [5]https://groups.google.com/d/msgid/sage-devel/f2900af4-
> 6aad-4450-9e12-6f1ec95596f8%40googlegroups.com?utm_medium=email&utm_source=
> footer
> >
> >
> >--
> >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 [6]sage-...@googlegroups.com.
> >To view this discussion on the web visit [7]https://groups.google.com/d/
> msgid/sage-devel/20200514121620.GA39760%40vertex.
>
>
>
>
>
>--
>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 [8]sage-devel+...@googlegroups.com.
>To view this discussion on the web visit [9]https://groups.google.com/d/msgid/
>sage-devel/344c58f2-a339-43c6-8417-93d46c05d0f7%40googlegroups.com.
>
>References:
>
>[1] javascript:
>[2] https://groups.google.com/d/msgid/
>[3] http://40googlegroups.com/
>[4] javascript:
>[5] https://groups.google.com/d/msgid/sage-devel/f2900af4-6aad-4450-9e12-6f1ec95596f8%40googlegroups.com?utm_medium=email&utm_source=footer
>[6] javascript:
>[7] https://groups.google.com/d/msgid/sage-devel/20200514121620.GA39760%40vertex
>[8] mailto:sage-devel+...@googlegroups.com
>[9] https://groups.google.com/d/msgid/sage-devel/344c58f2-a339-43c6-8417-93d46c05d0f7%40googlegroups.com?utm_medium=email&utm_source=footer

signature.asc

Daniel Loughran

unread,
May 14, 2020, 11:14:41 AM5/14/20
to sage-devel
I think your comment further indicates that there seems to be a serious problem with how elliptic curves modulo primes powers are implemented in sage.

Just in case anyone is in doubt, note that sage is perfectly happy to deal with this point correctly if I define my curve as a plane projective curve, rather than an elliptic curve:

P2.<X,Y,Z> = ProjectiveSpace(Rationals(),2); P2
Projective Space of dimension 2 over Rational Field

C=P2.subscheme(Y^2*Z + Y*Z^2 - X^3 + X*Z^2); C
Closed subscheme of Projective Space of dimension 2 over Rational Field defined by: -X^3 + Y^2*Z + X*Z^2 + Y*Z^2

C4=C.change_ring(Integers(4)); C4
Closed subscheme of Projective Space of dimension 2 over Ring of integers modulo 4 defined by: -X^3 + Y^2*Z + X*Z^2 + Y*Z^2

C(2,-3,8)
(1/4 : -3/8 : 1)

C4(2,-3,8)
(2 : 1 : 0)

Reimundo Heluani

unread,
May 14, 2020, 11:17:59 AM5/14/20
to sage-...@googlegroups.com
On May 14, 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.
>
Ok the issue is in ell_generic.__call__() that calls _reduce_point with characteristic
p=4 which is not a prime. This function in turn creates the curve

E' = E.change_ring(GF(4))
instead of your
E4 = E.change_ring(Integers(4))

And then returns the point E'(P) which indeed is the identity.


R
>
>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 [11]sage-devel+...@googlegroups.com.
>To view this discussion on the web visit [12]https://groups.google.com/d/msgid/
>sage-devel/f2900af4-6aad-4450-9e12-6f1ec95596f8%40googlegroups.com.
>
>References:
>
>[11] mailto:sage-devel+...@googlegroups.com
>[12] https://groups.google.com/d/msgid/sage-devel/f2900af4-6aad-4450-9e12-6f1ec95596f8%40googlegroups.com?utm_medium=email&utm_source=footer


signature.asc

Daniel Loughran

unread,
May 14, 2020, 12:04:24 PM5/14/20
to sage-devel
Ha that is quite a funny mistake. The outputs of my experiments start to make more sense now.

Does this also explain the error I found when working modulo 16? Just this was slightly different in nature.
>To view this discussion on the web visit [12]https://groups.google.com/d/msgid/
>sage-devel/f2900af4-6aad-4450-9e12-6f1ec95596f8%40googlegroups.com.
>
>References:
>

Reimundo Heluani

unread,
May 14, 2020, 12:57:42 PM5/14/20
to sage-...@googlegroups.com
Looking at the documentation for EllipticCuve? it says the following

...
"EllipticCurve(R, [a1,a2,a3,a4,a6])": Create the elliptic curve
over R with given a-invariants. Here R can be an arbitrary
commutative ring, although most functionality is only implemented
over fields.
...

So this may not be a bug per-se. But anyway, if you bypass the call to
_reduce_point and call directly ProjectivePlaneCurve.__call__ as in the
attached diff, there is still an issue: the point (2:1:0) will not be
recognized as a point in E4 because the test when z=0 considers that the point
is over a field, it tests that x = 0 instead of x**3 = 0.

The attached diff would be a very temporary workaround to this issue. With it
applied you'd get the right reduction for both integers or rationals in the
definition of E:

sage: E = EllipticCurve(ZZ,[0,0,1,-1,0]);E4 = E.change_ring(Integers(4)); P = E(2,-3,8); P
(2 : -3 : 8)
sage: E4(P)
(2 : 1 : 0)
sage: E = EllipticCurve([0,0,1,-1,0]);E4 = E.change_ring(Integers(4)); P = E(2,-3,8); P
(1/4 : -3/8 : 1)
sage: E4(P)
(2 : 1 : 0)

However this is still wrong because
sage: E = EllipticCurve(ZZ,[0,0,1,-1,0]);E4 = E.change_ring(Integers(4)); P = E(2,-3,8); P
(2 : -3 : 8)
sage: isinstance(P,ell_point.EllipticCurvePoint_field)
False
sage: isinstance(E4(P),ell_point.EllipticCurvePoint_field)
True

Perhaps a trac issue should be open. I'll see if the check for x^3 can be
moved somewhere else and may open it

R.
> >to [11][1]sage-...@googlegroups.com.
> >To view this discussion on the web visit [12][2]https://groups.google.com/
> d/msgid/
> >sage-devel/f2900af4-6aad-4450-9e12-6f1ec95596f8%[3]40googlegroups.com.
> >
> >References:
> >
> >[11] mailto:[4]sage-...@googlegroups.com
> >[12] [5]https://groups.google.com/d/msgid/sage-devel/f2900af4-
> 6aad-4450-9e12-6f1ec95596f8%40googlegroups.com?utm_medium=email&utm_source=
> footer
>
>
>
>--
>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 [6]sage-devel+...@googlegroups.com.
>To view this discussion on the web visit [7]https://groups.google.com/d/msgid/
>sage-devel/e174eb2c-f21b-402d-b0f0-fac380916650%40googlegroups.com.
>[6] mailto:sage-devel+...@googlegroups.com
>[7] https://groups.google.com/d/msgid/sage-devel/e174eb2c-f21b-402d-b0f0-fac380916650%40googlegroups.com?utm_medium=email&utm_source=footer

ell_reduce_point.patch
signature.asc

Reimundo Heluani

unread,
May 14, 2020, 1:20:47 PM5/14/20
to 'Reimundo Heluani' via sage-devel
As a follow-up: it seems that the class EllipticCurvePoint simply does not
have any functionality. It seems that about 12 years ago in #1975 it was
decided to set the class to EllipticCurvePoint_finite_field in these cases so
as to be able to do some arithmetic. I guess if that was accepted then, it
should be reasonable to test against x**3 instead of x when z=0. It shouldn't
hurt performance and would produce the right reductions. I'll open a ticket to
see what people think

R.
>To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+...@googlegroups.com.
>To view this discussion on the web visit https://groups.google.com/d/msgid/sage-devel/20200514165730.GA197854%40vertex.

> [33mdiff --git a/src/sage/schemes/elliptic_curves/ell_generic.py b/src/sage/schemes/elliptic_curves/ell_generic.py [m
> [33mindex 730cb2bce9..e94832250e 100644 [m
> [33m--- a/src/sage/schemes/elliptic_curves/ell_generic.py [m
> [33m+++ b/src/sage/schemes/elliptic_curves/ell_generic.py [m
> [36m@@ -543,66 +543,14 @@ [m [mclass EllipticCurve_generic(WithEqualityById, plane_curve.ProjectivePlaneCurve): [m
> characteristic = self.base_ring().characteristic() [m
> if characteristic != 0 and isinstance(args[0][0], rings.Rational) and isinstance(args[0][1], rings.Rational): [m
> if rings.mod(args[0][0].denominator(),characteristic) == 0 or rings.mod(args[0][1].denominator(),characteristic) == 0: [m
> [31m- return self._reduce_point(args[0], characteristic) [m
> [32m+ [m [32m x, y = args[0].xy() [m
> [32m+ [m [32m d = lcm(x.denominator(), y.denominator()) [m
> [32m+ [m [32m args = ([x*d, y*d, d],) [m
> [32m+ [m
> args = tuple(args[0]) [m
> [m
> return plane_curve.ProjectivePlaneCurve.__call__(self, *args, **kwds) [m
> [m
> [31m- def _reduce_point(self, R, p): [m
> [31m- r""" [m
> [31m- Reduces a point R on an elliptic curve to the corresponding point on [m
> [31m- the elliptic curve reduced modulo p. [m
> [31m- [m
> [31m- Used to coerce points between [m
> [31m- curves when p is a factor of the denominator of one of the [m
> [31m- coordinates. [m
> [31m- [m
> [31m- This functionality is used internally in the ``call`` method for [m
> [31m- elliptic curves. [m
> [31m- [m
> [31m- INPUT: [m
> [31m- [m
> [31m- - R -- a point on an elliptic curve [m
> [31m- - p -- a prime [m
> [31m- [m
> [31m- OUTPUT: [m
> [31m- [m
> [31m- S -- the corresponding point of the elliptic curve containing [m
> [31m- R, but reduced modulo p [m
> [31m- [m
> [31m- EXAMPLES: [m
> [31m- [m
> [31m- Suppose we have a point with large height on a rational elliptic curve [m
> [31m- whose denominator contains a factor of 11:: [m
> [31m- [m
> [31m- sage: E = EllipticCurve([1,-1,0,94,9]) [m
> [31m- sage: R = E([0,3]) + 5*E([8,31]) [m
> [31m- sage: factor(R.xy()[0].denominator()) [m
> [31m- 2^2 * 11^2 * 1457253032371^2 [m
> [31m- [m
> [31m- Since 11 is a factor of the denominator, this point corresponds to the [m
> [31m- point at infinity on the same curve but reduced modulo 11. The reduce [m
> [31m- function tells us this:: [m
> [31m- [m
> [31m- sage: E11 = E.change_ring(GF(11)) [m
> [31m- sage: S = E11._reduce_point(R, 11) [m
> [31m- sage: E11(S) [m
> [31m- (0 : 1 : 0) [m
> [31m- [m
> [31m- The 0 point reduces as expected:: [m
> [31m- [m
> [31m- sage: E11._reduce_point(E(0), 11) [m
> [31m- (0 : 1 : 0) [m
> [31m- [m
> [31m- Note that one need not explicitly call [m
> [31m- \code{EllipticCurve._reduce_point} [m
> [31m- """ [m
> [31m- if R.is_zero(): [m
> [31m- return R.curve().change_ring(rings.GF(p))(0) [m
> [31m- x, y = R.xy() [m
> [31m- d = lcm(x.denominator(), y.denominator()) [m
> [31m- return R.curve().change_ring(rings.GF(p))([x*d, y*d, d]) [m
> [31m- [m
> def is_x_coord(self, x): [m
> r""" [m
> Return True if ``x`` is the `x`-coordinate of a point on this curve. [m
> [33mdiff --git a/src/sage/schemes/elliptic_curves/ell_point.py b/src/sage/schemes/elliptic_curves/ell_point.py [m
> [33mindex fdd20ab16f..e7f1256c35 100644 [m
> [33m--- a/src/sage/schemes/elliptic_curves/ell_point.py [m
> [33m+++ b/src/sage/schemes/elliptic_curves/ell_point.py [m
> [36m@@ -294,7 +294,7 @@ [m [mclass EllipticCurvePoint_field(SchemeMorphism_point_abelian_variety_field): [m
> [m
> x, y, z = v [m
> if z == 0: [m
> [31m- test = x [m
> [32m+ [m [32m test = x**3 [m
> else: [m
> a1, a2, a3, a4, a6 = curve.ainvs() [m
> test = y**2 + (a1*x+a3)*y - (((x+a2)*x+a4)*x+a6) [m



signature.asc

Reimundo Heluani

unread,
May 14, 2020, 2:41:18 PM5/14/20
to 'Reimundo Heluani' via sage-devel
I opened #29690 and #29691

Cheers,
>To view this discussion on the web visit https://groups.google.com/d/msgid/sage-devel/20200514172026.GB197854%40vertex.


signature.asc

chris wuthrich

unread,
May 15, 2020, 4:44:43 AM5/15/20
to sage-devel
Dear Daniel

indeed elliptic curves over rings (what should be called technically Weierstrass equations with non-zero discriminant, instead of unit discriminant) are rather useless in Sage.
I would recommend to work with 2-adics in your case and to reduce modulo 4 in the end. You could work over Qp(p,k) if you want modulo p^k.

I hope that this may help with what you do. Of course, one should implement this properly one day.

Chris

John Cremona

unread,
May 15, 2020, 4:50:28 AM5/15/20
to sage-devel
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 

Daniel Loughran

unread,
May 15, 2020, 4:53:46 AM5/15/20
to sage-devel
Hi Chris,

Thanks for the advice, but I can't seem to get this to work either. I get the error "ValueError: element must have non-negative valuation in order to compute residue".

Any idea how to make this work without errors? Or should I just give up and use magma instead?

E=EllipticCurve(Qp(2,5),[0, 0, 1, -1, 0]); E
Elliptic Curve defined by y^2 + (1+O(2^5))*y = x^3 + (1+2+2^2+2^3+2^4+O(2^5))*x over 2-adic Field with capped relative precision 5

P=E(2,-3,8); P
(2^-2 + O(2^3) : 2^-3 + 2^-1 + 1 + 2 + O(2^2) : 1 + O(2^5))

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)
ValueError: element must have non-negative valuation in order to compute residue.


Dan

chris wuthrich

unread,
May 15, 2020, 8:44:48 AM5/15/20
to sage-devel

I fear you will have to do a lot by hand in sage. You can reduce a projective point modulo p^k as below, but the output will have to be a list of elements in Z/p^kZ, since projective spaces are not defined over general rings as far as I am aware.
What I meant is that you can actually work in E( Qp ) instead and at the end extract the mod p^k information that you need.

I am sure others are better placed to comment how much easier these things are in magma.


Chris

sage: def reduction_of_point(P,k):
....:     """
....:     Reduce projective point P defined over Qp modulo p^k
....:     """
....:     v = min(valuation(x) for x in P)
....:     p = P[0].parent().prime()
....:     R = IntegerModRing(p^k)
....:     return [ R( p^(-v)*x ) for x in P]
Reply all
Reply to author
Forward
0 new messages