On Aug 26, 9:30 am, Jason Grout <jason-s...@creativetrax.com> wrote:
> John H Palmieri wrote:
> > On Aug 26, 6:21 am, "Nicolas M. Thiery" <nicolas.thi...@u-psud.fr>
> > wrote:
> >>         Dear  and Javier, dear John,

> >> A little question: if V and W are two vector spaces which turn out to
> >> be also in stronger categories, some with direct sums, and some
> >> without, what should the following do:
>
> >>         sage: direct_sum(V, W)
>
> > Could there be an optional argument:
>
> >   sage: direct_sum(V, W, cat)
>
> > If cat is not present, find the "strongest" category which contains
> > both V and W, and compute the direct sum there, raising an error if it
> > doesn't exist.  (Or just raise an error?  Or raise an error, saying
> > what this strongest category is, and suggesting computing the direct
> > sum there?  Maybe I like this last approach the best.)  If cat is
> > present, check that cat contains both V and W, and then compute the
> > direct sum there.
>
> Isn't this sort of what the coercion system is all about?  If you can't
> do a direct sum of V and W, try coercing them into a category that can
> do a direct sum?  If you want to specifically compute the direct sum in
> a particular category, then do an explicit cast yourself, like
> direct_sum(cat(V), cat(W)), or maybe cat.direct_sum(V,W) or something.

I completely agree with your last point: direct_sum(cat(V), cat(W)) or
cat.direct_sum... is the way to go for explicitly specifying the
category.  This is better than passing an optional argument to
direct_sum.

I'm leaning more strongly toward the point of view that raising an
error is the right approach when the direct sum doesn't exist.  If V
and W are objects in the same category, and that category doesn't have
direct sums, then direct_sum(V,W) should raise an error.  This should
even happen, I think, if there is a forgetful functor to a category in
which the direct sum is defined.  As noted earlier, if V and W are k-
algebras, then they don't have a direct sum in the category of k-
algebras.  If they happen to be commutative, then they do have a
direct sum in the category of commutative k-algebras: V tensor_k W.
They also have direct sums in the category of k-vector spaces (V x W)
and in the category of sets (V disjoint union W).  All of these are
different, so which should you choose? It seems safest to raise an
error, perhaps with the suggestion that the direct sum might exist in
some other category, like the category of k-vector spaces, and so you
might execute direct_sum(VectorSpaces(k)(V), VectorSpaces(k)(W)) (or
whatever the command is) instead.

I suppose there could be another function, "direct_sum_force" or
something, which finds a category containing V and W in which the
direct sum exists.  But I think that if category(V) == category(W) is
True, then

sage: category(V) == category(direct_sum(V, W))

should return True, also, since, as Nicolas says, 'Having a "Category
theory" level of precision is definitely an aim of the category
framework'.

  John

--~--~---------~--~----~------------~-------~--~----~
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
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to