On Sunday, October 30, 2016 at 6:16:37 AM UTC-7, vdelecroix wrote:
>
> I think that the behavior of these operations should be similar. Do 
> you think that 
>   A) the above is fine (with explanation please) 
>   B) we should raise an error in the first example 
>   C) the second example should work and the answer be an element of 
> Zmod(5) 
>   D) ? 
>

I'd think B or C, depending on what makes for a more consistent coercion 
system (sometimes special cases are naturally resolved one way or another 
by design choices made elsewhere)

I'm leaning more towards B (and perhaps A), since it seems that successful 
action discovery seems due to a fluke in pushout, combined by the use of 
conversion in action implementation where coercion seems more appropriate:

sage: F=GF(5)
sage: K=sage.categories.pushout.pushout(F,QQ)
Finite Field of size 5
sage: F.0*K(QQ.0)
1
sage: F.0*QQ.0
TypeError: unsupported operand parent(s) for '*': 'Finite Field of size 5' 
and 'Rational Field'

so, we see the pushout of F and QQ exists, but QQ does not coerce into it. 
Elements do convert into it, though.

This is different for the uncontroversial case (Z['x'] and QQ)

sage: P=ZZ['x']
sage: R=sage.categories.pushout.pushout(P,QQ); R
Univariate Polynomial Ring in x over Rational Field
sage: P.0*QQ.0
x

In the implementation of sage.structure.ModuleAction, you can see that:
 - pushout is used to find a common module
 - in Action.__call__, a *conversion* is used to put the module element 
into that overmodule. So the fact that there (rightly) isn't a coercion 
from QQ^2 to (GF(5))^2 is actively circumvented. I'm not sure that's such a 
good idea.

I think the pushout of GF(5) and QQ exists because:

sage: sage.categories.pushout.construction_tower(QQ)
[(None, Rational Field), (FractionField, Integer Ring)]
sage: sage.categories.pushout.construction_tower(GF(5))
[(None, Finite Field of size 5), (QuotientFunctor, Integer Ring)]

and we can get GF(5) by taking FractionField(QuotientFunctor(ZZ by (5)). 
Indeed, if we take a quotient of ZZ that is not a field already, the module 
action fails:

sage: a=Zmod(15)(1)
sage: b=(QQ^2).0
sage: a*b
TypeError: unsupported operand parent(s) for '*': 'Ring of integers modulo 
15' and 'Vector space of dimension 2 over Rational Field'

-- 
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 an 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