That is a bit like this, though not exactly:

sage: E = EllipticCurve(GF(101),3,4)
sage: G = E.abelian_group()
sage: G
Additive abelian group isomorphic to Z/100 embedded in Abelian group of
points on Elliptic Curve defined by y^2 = x^3 + 84*x + 12 over Finite Field
of size 101
sage: G[10]
(45 : 49 : 1)
sage: G[10] in E
False
sage: P = G[10]
sage: P.element()
(45 : 49 : 1)
sage: P.element() in E
True

Elements of the abstract group G display just like points of E but are not
"in" E unless one applies the mysterious "element" method.

On Sun, 18 Nov 2018 at 19:08, Kiran Kedlaya <[email protected]> wrote:

> I just got burned by this, so I thought I should report. However, I'm not
> sure if this can be called a bug, and if so what exactly the bug is.
>
> {{{
> sage: K.<a> = CyclotomicField(4)
> sage: P.<x> = PolynomialRing(QQ)
> sage: L.<b> = K.extension(x^2-x+1)
> sage: u = L.unit_group().gen()
> sage: a in [u^i for i in range(12)]
> False
> sage: a in [L(u)^i for i in range(12)]
> True
> sage: L(a) in [u^i for i in range(12)]
> True
> }}}
>
> The trick here is that u is not an element of L:
> {{{
> sage: parent(u)
> Unit group with structure C12 x Z of Number Field in b with defining
> polynomial x^2 - x + 1 over its base field
> }}}
>
> Nonetheless, I would have expected a and u to be coerced to L for purposes
> of comparison. And in fact, this came up in some legacy code (last tested
> in Sage 4.8) in which this was handled correctly!
>

This seems even worse to me:
sage: a in L.unit_group()
False
sage: a in K.unit_group()
True

despite

sage: a in K
True
sage: a in L
True

SInce

sage: L(a) in L.unit_group()
True

it should be possible to get the "in" test for unit groups to first coerce
into the field.  More bizarrely:

sage: L.unit_group()(a)
u0^9

shows that Sage is quite capable of coercing a into L's unit group; it just
does not try, it seems.

John



>
> Kiran
>
> --
> You received this message because you are subscribed to the Google Groups
> "sage-nt" 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 https://groups.google.com/group/sage-nt.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-nt" 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 https://groups.google.com/group/sage-nt.
For more options, visit https://groups.google.com/d/optout.

Reply via email to