On 11/01/2012 11:46, Simon King wrote:
2) A more general consideration: The coercion model prefers to have
unique parents. But many people think that "A == B" should mean "A
and B are canonically isomorphic", and not just "A is B". That could
be solved by making the coercion model consequently use containers
that compare by "is" and not by "==".
I'm not sure what you mean by ``making the coercion model use containers
that compare by "is" and not by "=="'', but I'll just chime in as I
think it could be related to something that I found.
Currently, if two parents A and B are equal according to "==" and no
good coercion map is found, then A.coerce_map_from(B) returns
A._generic_convert_map(B). In case of number fields, this means that if
two number fields have same generator name and same defining polynomial,
then the generators are identified by coercion. There is a NumberField
example where this is incompatible with maps that I would consider
natural. So in the NumberField case, I would prefer not to have a
coercion in this case, but only a conversion.
Marco
PS. More specifically, the example is
sage: K.<a> = NumberField(x^2-2, embedding=-1)
sage: L.<b> = NumberField(x^2-2, embedding=1)
sage: xK = K['x'].gen()
sage: xL = L['x'].gen()
sage: M.<c> = NumberField(xK^2-3)
sage: N.<d> = NumberField(xL^2-3)
sage: O = M.absolute_field('e')
sage: P = N.absolute_field('e')
sage: b_in_a = K(0)+b
sage: map1 = O.structure()[1]
sage: map2 = P.structure()[1]
sage: b_in_a in map1.domain()
# True
sage: b in map2.domain()
# True
sage: map1(b_in_a) - map2(b)
# e^3 - 9*e, which is non-zero, so the maps don't commute!
The maps O <--> M <-- K <--> L --> N <--> P are natural (structure
morphisms and coercions).
The fields O and P have same generator name and same defining
polynomials, hence O==P is True. However, O.structure() and
P.structure() are distinct, which makes O._generic_convert_map(P)
incompatible with the natural maps O <--> M <-- K <--> L --> N <--> P
So I would prefer there not to be a coercion from O to P. I'm fine with
conversion.
--
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org