On Tue, Dec 28, 2010 at 12:46 AM, Simon King <simon.k...@uni-jena.de> wrote:
> Hi Robert,
>
> On 28 Dez., 01:27, Robert Bradshaw <rober...@math.washington.edu>
> wrote:
>> ... You're working on
>> moving modules over to the new coercion framework, right?
>
> Yes.
>
>> > But how does one
>> > define an action? I guess that one is supposed to use
>> > sage.categories.action, but so far it has no example at all.
>>
>> http://hg.sagemath.org/sage-main/file/120c07be6358/sage/matrix/action...
>> is the most comprehensive example to date.
>
> Yes, I had looked at that example when I tried to understand how
> matrix action works. However, I couldn't see how it relates with
> functors, since it seems to me that it overrides all "typical" methods
> of functors.
>
>> > How are these two definitions related?
>>
>> Consider the category with a single object whose morphisms are the
>> element of G. Then the functor send the elements of G to morphisms in
>> Sets.
>
> That makes sense, but it does neither match the code nor the
> documentation.

I agree 100%. This is a case of someone (likely me) trying to map a
single mathematical view of an object onto an implementation. Even if
there is an "is a" relationship, it would probably make more sense for
Action to not inherit from Functor, as they behave and are used
completely differently.

> sage.categories.action.Action.__init__ is
> {{{
>    def __init__(self, G, S, bint is_left = 1, op=None):
>        from groupoid import Groupoid
>        Functor.__init__(self, Groupoid(G), S.category())
>        self.G = G
>        self.S = S
>        self._is_left = is_left
>        self.op = op
> }}}
> and sage.categories.action.__doc__ states "A group action G x S
> rightarrow S is a functor from G to Sets."
>
> According to your post, it should be "A group action G x S rightarrow
> S is a functor from G (considered as a category) to the category of
> Morphisms of Sets", and in the code it should be
> Functor.__init__(self, Groupoid(G), S.category().hom_category()).

Not quite. It is G considered as a category where the elements of G
are the morphisms and there only one object, so it is actually a
functor to the categories of sets. But, as I've stated above, this is
not the most useful perspective of an action (in our context at
least).

> Moreover, sage.matrix.action.MatrixMatrixAction is implemented by a
> _call_ method that has the signature
>   cpdef Element _call_(self, g, s)
> Hence, essentially it is a map (not a functor) from GxS to S -- so,
> the implementation uses the category-free definition of an action, but
> pretends to be categorical.
>
> One crucial question is, IMO:
> Would it really be wise to use a categorical approach towards actions?

I don't think so. Especially now that the category framework allows
attaching abstract mathematical structure to objects independent of
their inheritance and implementation.

> Using the categorical definition would mean: To any given element g of
> G, create a morphism from S to S (very slow!), and apply it to a given
> element s of S. I guess caching the morphism from S to S would not
> really be a solution.  So, the current approach to think of an action
> as a map from GxS to S probably yields a better implementation (speed-
> wise).

It's often useful to be able to obtain the morphism corresponding to
any element (there is currently such a method on actions), but as
reflected in the current state of things and your comments this does
not yield a good implementation.

> But then, the question is what one should do with
> sage.categories.action? Should it be overhauled so that it really
> matches the categorical definition, just for completeness, even though
> it would not be used in Sage?
>
> Should there also be an "official" new framework for the non-
> categorical version of an action, say, in sage.structure.action? Then,
> actions that currently tacitly use the non-categorical definition
> (like MatrixMatrixAction) could finally be "officially non-
> categorical"?

Unless I'm mistaken, nearly every action that's used is in the context
of the coercion framework, which, though I want it to be
mathematically sound, I consider to be as much of a user interface
component as a mathematical one.

In fact, I just did a search through the sage sources and it looks
like there aren't any Actions other than the coercion one, so we could
probably just cut out the (weak) categorical ties.

- Robert

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

Reply via email to