[sage-combinat-devel] Re: Categorification of tableaux

2010-09-02 Thread Andrew Mathas
Thanks for the pointer Jason. I'll have a look.

Andrew

On Sep 3, 12:23 am, Jason Bandlow  wrote:
> Dear Andrew and Nicolas,
>
> Nicolas--thanks for you comments! I'm glad to hear that the basic design
> I had in mind isn't totally crazy. :)
>
> Andrew, thanks for agreeing to review!  I will try to work on this in
> the next few weeks.  Please add yourself to the cc of trac ticket #9265,
> and I'll post whatever progress I make there.
>
> >  Is there any documentation written
> > about how all of this is about to work?
>
> I don't think there is any completely comprehensive documentation on
> categories. Doing sage.categories.primer?  will get you started, but all
> I know how to do after that is look at examples. (Of which there are
> some very good ones!)
>
> Cheers,
> Jason
>
> On 09/02/2010 09:33 AM, Andrew Mathas wrote:
>
> > Dear Nicolas and Jason,
>
> > I am happy to be the reviewer. Is there any documentation written
> > about how all of this is about to work? I have looked a little for it
> > without success. My impression is that the general structure is very
> > well thought out but without having Nicolas or Florent sitting next to
> > you it is hard to learn what the intended design is!
>
> > Andrew
>
> > On Sep 1, 2:53 am, "Nicolas M. Thiery" 
> > wrote:
> >>         Hi Jason!
>
> >> For once, I am trying hard to procrastinate on the Sage-Combinat
> >> e-mails in order to focus on finishing our paper with Florent and
> >> Anne, instead of the converse; hence my slow answer.
>
> >> Thanks for your long post! It sounds all fine to me. I'll just insert
> >> a couple micro comments below. I hope someone goes on and implements
> >> this! It would be great if you could do with Andrew as reviewer (or
> >> the converse, or with whatever pair programming scheme fits you).
>
> >> On Thu, Aug 19, 2010 at 12:11:47PM -0400, Jason Bandlow wrote:
> >>> The 'metaclass' trick is so that both of these will work, and the
> >>> parents will be set appropriately.  Anyway, here is what I roughly think
> >>> the element classes should look.
>
> >> And I should mention that the "metaclass trick" is nothing but a
> >> syntactic sugar so that one can use the same name Tableau for both:
>
> >>  - the function used to create a tableau
> >>  - the base class for all tableaux.
>
> >> Currently in Sage, those two gadgets are usually distinct (think
> >> Partition/Partition_class which makes it inconvenient for the user to
> >> access Partition_class, say for an isinstance test.
>
> >>> class Tableaux(UniqueRepresentation, Parent):
> >>> ...
> >>> class SemistandardTableaux(UR, Parent, Tableaux): # similar
> >>> class StandardTableaux(UR, Parent, SemistandardTableaux): # similar
>
> >> No need to specify again UR and Parent; those are inherited through
> >> Tableaux.
>
> >>> Finally we have the specific parent classes.  I think they should look
> >>> roughly as follows.
>
> >>>   The parent classes 
>
> >>> class Tableaux_all(Tableaux):
> >>>   def __init__(self):
> >>>     super(Tableaux_all, self).__init__()
> >>>       # I don't know a good category, since general tableaux (which
> >>>       # allow, for example, real-number entries) are not enumerable.
>
> >> I guess Sets() is the best we can do.
>
> >>> class SemistandardTableaux_all(DisjointUnionEnumeratedSets,
> >>>                   SemistandardTableaux):
>
> >>>   def __init__(self):
> >>>     DisjointUnionEnumeratedSets.__init__(
> >>>             self, Family(NonNegativeIntegers(),
> >>>             SemistandardTableaux_size),
> >>>             facade=True, keepkey = False)
> >>>      # Note that I'm not clear on what facade and keepkey do.
> >>>      # They may not be necessary or advisable.
>
> >>  * With keekkey = True, the elements of the disjoint union would be of
> >>    the form (5, Partition([3,2])). That's only useful when one wants
> >>    to construct the disjoint union of a collection of sets which are
> >>    not originally disjoint (e.g. building n copies of a given set).
>
> >>  * facade = True/False controls whether, for x in
> >>    SemiStandardTableaux(), x.parent() is SemiStandardTableaux() or
> >>    SemiStandardTableaux(shape=...)
>
> >>> class SemistandardTableaux_size(SemistandardTableaux):
>
> >>>   def __init__(self, size):
> >>>     super(SemistandardTableaux_size, self).__init__(
> >>>               category = InfiniteFiniteEnumeratedSets())
>
> >> Interesting category :-) But yes, the category should be set to one or
> >> the other depending on what makes sense.
>
> >>                                 Nicolas
> >> --
> >> Nicolas M. Thi ry "Isil" http://Nicolas.Thiery.name/

-- 
You received this message because you are subscribed to the Google Groups 
"sage-combinat-devel" group.
To post to this group, send email to sage-combinat-de...@googlegroups.com.
To unsubscribe from this group, send email to 
sage-combinat-devel+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sage-combi

[sage-combinat-devel] Re: CombinatorialFreeModule (again)

2010-09-02 Thread Jason Bandlow
On 09/02/2010 04:57 PM, John H Palmieri wrote:
> Did you also ask this on ask.sagemath.org?  I've posted some possibly
> related ideas in the thread  combinatorialfreemodule>.

I've responded there as well, with what I hope supplements my answer
above.  Please ask for more detail if you need it--it would be very good
to improve the documentation of this.


-- 
You received this message because you are subscribed to the Google Groups 
"sage-combinat-devel" group.
To post to this group, send email to sage-combinat-de...@googlegroups.com.
To unsubscribe from this group, send email to 
sage-combinat-devel+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sage-combinat-devel?hl=en.



[sage-combinat-devel] Re: CombinatorialFreeModule (again)

2010-09-02 Thread John H Palmieri
On Sep 2, 3:33 am, Bruce  wrote:
> I am trying to construct the free module on the set of instances of a
> class G.

Did you also ask this on ask.sagemath.org?  I've posted some possibly
related ideas in the thread .

--
John

-- 
You received this message because you are subscribed to the Google Groups 
"sage-combinat-devel" group.
To post to this group, send email to sage-combinat-de...@googlegroups.com.
To unsubscribe from this group, send email to 
sage-combinat-devel+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sage-combinat-devel?hl=en.



Re: [sage-combinat-devel] Re: CombinatorialFreeModule (again)

2010-09-02 Thread Jason Bandlow
Hi Bruce,

Incidentally, the following works for me, with sage 4.5.2, which I think
was your minimal counter-example. Did I misunderstand? What version of
sage are you using?

sage: class G:
: blah = 0
:
sage: f = G()
sage: g = G()
sage: M = CombinatorialFreeModule(QQ, G)
sage: a = M.monomial(f)
sage: b = M.monomial(g)
sage: a + b
B[<__main__.G instance at 0xb39928c>] + B[<__main__.G instance at
0xb3992cc>]
sage: a - a
0
sage: 2*a
2*B[<__main__.G instance at 0xb39928c>]

However, this is not really the way this whole construct was intended to
be used.  Your G is a *class* which has *instances*.  What you should be
passing in is a Parent (in sage-speak) or a *set* (in math-speak) which
has *elements*.

For example, if I say:

sage: class G:
: blah = 0
:
sage: f = G()

then f is an instance of the class G (think: 'an example of a G'); this
is different from being 'an element of G'.  This is why constructions
such as

sage: C = CombinatorialFreeModule(QQ,[1,2,3])

will work.  Sage can easily interpret [1,2,3] as a set.

So what you probably want to do is to define two classes, one of which
inherits from the class Parent and represents a set, the other of which
inherits from SageObject (or something more specific) and represents the
elements of the first class.  There are few specific lines of codes here
that you must include here, that I will undoubtedly mess up if I try to
write them on the fly.  Does anyone know of a minimal example where a
Parent and Element class are defined?

Cheers,
Jason



On 09/02/2010 02:39 PM, Bruce wrote:
> 
> I have played around following Florent's comment and the following
> seems to work
> (while at the same time displaying my ignorance)
> 
> class G:
> blah = 0
> 
> f =G()
> g=G()
> 
> p=parent(f)
> 
> M=CombinatorialFreeModule(QQ,p)
> 
> a=M.monomial(f)
> b=M.monomial(g)
> 
> (2/3)*a+(4/5)*b
> 

-- 
You received this message because you are subscribed to the Google Groups 
"sage-combinat-devel" group.
To post to this group, send email to sage-combinat-de...@googlegroups.com.
To unsubscribe from this group, send email to 
sage-combinat-devel+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sage-combinat-devel?hl=en.



[sage-combinat-devel] Re: CombinatorialFreeModule (again)

2010-09-02 Thread Bruce
Now I am more confused.
Sometimes G and parent(f) are the same so
G == parent(f) is True
and sometimes not.

Moreover this behaves differently to the actual class I want to use.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-combinat-devel" group.
To post to this group, send email to sage-combinat-de...@googlegroups.com.
To unsubscribe from this group, send email to 
sage-combinat-devel+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sage-combinat-devel?hl=en.



[sage-combinat-devel] Re: CombinatorialFreeModule (again)

2010-09-02 Thread Bruce

I have played around following Florent's comment and the following
seems to work
(while at the same time displaying my ignorance)

class G:
blah = 0

f =G()
g=G()

p=parent(f)

M=CombinatorialFreeModule(QQ,p)

a=M.monomial(f)
b=M.monomial(g)

(2/3)*a+(4/5)*b

-- 
You received this message because you are subscribed to the Google Groups 
"sage-combinat-devel" group.
To post to this group, send email to sage-combinat-de...@googlegroups.com.
To unsubscribe from this group, send email to 
sage-combinat-devel+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sage-combinat-devel?hl=en.



[sage-combinat-devel] Re: CombinatorialFreeModule (again)

2010-09-02 Thread Bruce
Hi Florent

I am not sure if you mean it is a bug that a + b works or that 2*a
doesn't.

The documentation describes a Parent as a set. In these terms the
Parent
I want is the set of instances of the class G. I don't know how to
construct
this as a Parent or even if this is allowed.

On Sep 2, 12:49 pm, Florent Hivert 
wrote:
>       Hi Bruce,
>
>
>
> On Thu, Sep 02, 2010 at 03:33:21AM -0700, Bruce wrote:
> > I am trying to construct the fee module on the set of instances of a
> > class G.
> > I start with
>
> > M = CombinatorialFreeModule(QQ,G)
>
> > If f,g are instances of G I then continue with
>
> > a = M.monomial(f)
> > b = M.monomial(g)
>
> > and I can then form a+a , a+b etc. and a - a is indeed 0.
>
> > However if I try 2*a I get a TypeError
>
> > If I try
>
> > M = CombinatorialFreeModule(QQ,NonNegativeIntegers())
>
> > a = M.monomial(3)
>
> > then 2*a seems to work fine.
>
> > Can anyone tell me what I am doing wrong and/or explain this?
>
> I'm in a hurry. so this is only a very short answer. It is maybe a bug but in
> the usual usage  in
>    > M = CombinatorialFreeModule(QQ,G)
> G is supposed to be an Parent (mathematical object) and ont a class (python
> stuff). I'm not sure if this is enforced or not.
>
> Cheers,
>
> Florent

-- 
You received this message because you are subscribed to the Google Groups 
"sage-combinat-devel" group.
To post to this group, send email to sage-combinat-de...@googlegroups.com.
To unsubscribe from this group, send email to 
sage-combinat-devel+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sage-combinat-devel?hl=en.



[sage-combinat-devel] Re: CombinatorialFreeModule (again)

2010-09-02 Thread Bruce
O.K. Then a minimal example to start with would be

class G:
blah = 0

f  = G()
g = G()

On Sep 2, 3:00 pm, bump  wrote:
> On Sep 2, 3:33 am, Bruce  wrote:
>
> > I am trying to construct the fee module on the set of instances of a
> > class G.
>
> It would be good to give a complete example, that is, with a
> particular G.
>
> > Can anyone tell me what I am doing wrong and/or explain this?
> > Thanks

-- 
You received this message because you are subscribed to the Google Groups 
"sage-combinat-devel" group.
To post to this group, send email to sage-combinat-de...@googlegroups.com.
To unsubscribe from this group, send email to 
sage-combinat-devel+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sage-combinat-devel?hl=en.



[sage-combinat-devel] Re: Categorification of tableaux

2010-09-02 Thread Jason Bandlow
Dear Andrew and Nicolas,

Nicolas--thanks for you comments! I'm glad to hear that the basic design
I had in mind isn't totally crazy. :)

Andrew, thanks for agreeing to review!  I will try to work on this in
the next few weeks.  Please add yourself to the cc of trac ticket #9265,
and I'll post whatever progress I make there.

>  Is there any documentation written
> about how all of this is about to work?

I don't think there is any completely comprehensive documentation on
categories. Doing sage.categories.primer?  will get you started, but all
I know how to do after that is look at examples. (Of which there are
some very good ones!)

Cheers,
Jason


On 09/02/2010 09:33 AM, Andrew Mathas wrote:
> Dear Nicolas and Jason,
> 
> I am happy to be the reviewer. Is there any documentation written
> about how all of this is about to work? I have looked a little for it
> without success. My impression is that the general structure is very
> well thought out but without having Nicolas or Florent sitting next to
> you it is hard to learn what the intended design is!
> 
> Andrew
> 
> On Sep 1, 2:53 am, "Nicolas M. Thiery" 
> wrote:
>> Hi Jason!
>>
>> For once, I am trying hard to procrastinate on the Sage-Combinat
>> e-mails in order to focus on finishing our paper with Florent and
>> Anne, instead of the converse; hence my slow answer.
>>
>> Thanks for your long post! It sounds all fine to me. I'll just insert
>> a couple micro comments below. I hope someone goes on and implements
>> this! It would be great if you could do with Andrew as reviewer (or
>> the converse, or with whatever pair programming scheme fits you).
>>
>> On Thu, Aug 19, 2010 at 12:11:47PM -0400, Jason Bandlow wrote:
>>> The 'metaclass' trick is so that both of these will work, and the
>>> parents will be set appropriately.  Anyway, here is what I roughly think
>>> the element classes should look.
>>
>> And I should mention that the "metaclass trick" is nothing but a
>> syntactic sugar so that one can use the same name Tableau for both:
>>
>>  - the function used to create a tableau
>>  - the base class for all tableaux.
>>
>> Currently in Sage, those two gadgets are usually distinct (think
>> Partition/Partition_class which makes it inconvenient for the user to
>> access Partition_class, say for an isinstance test.
>>
>>> class Tableaux(UniqueRepresentation, Parent):
>>> ...
>>> class SemistandardTableaux(UR, Parent, Tableaux): # similar
>>> class StandardTableaux(UR, Parent, SemistandardTableaux): # similar
>>
>> No need to specify again UR and Parent; those are inherited through
>> Tableaux.
>>
>>> Finally we have the specific parent classes.  I think they should look
>>> roughly as follows.
>>
>>>   The parent classes 
>>
>>> class Tableaux_all(Tableaux):
>>>   def __init__(self):
>>> super(Tableaux_all, self).__init__()
>>>   # I don't know a good category, since general tableaux (which
>>>   # allow, for example, real-number entries) are not enumerable.
>>
>> I guess Sets() is the best we can do.
>>
>>> class SemistandardTableaux_all(DisjointUnionEnumeratedSets,
>>>   SemistandardTableaux):
>>
>>>   def __init__(self):
>>> DisjointUnionEnumeratedSets.__init__(
>>> self, Family(NonNegativeIntegers(),
>>> SemistandardTableaux_size),
>>> facade=True, keepkey = False)
>>>  # Note that I'm not clear on what facade and keepkey do.
>>>  # They may not be necessary or advisable.
>>
>>  * With keekkey = True, the elements of the disjoint union would be of
>>the form (5, Partition([3,2])). That's only useful when one wants
>>to construct the disjoint union of a collection of sets which are
>>not originally disjoint (e.g. building n copies of a given set).
>>
>>  * facade = True/False controls whether, for x in
>>SemiStandardTableaux(), x.parent() is SemiStandardTableaux() or
>>SemiStandardTableaux(shape=...)
>>
>>> class SemistandardTableaux_size(SemistandardTableaux):
>>
>>>   def __init__(self, size):
>>> super(SemistandardTableaux_size, self).__init__(
>>>   category = InfiniteFiniteEnumeratedSets())
>>
>> Interesting category :-) But yes, the category should be set to one or
>> the other depending on what makes sense.
>>
>> Nicolas
>> --
>> Nicolas M. Thi ry "Isil" http://Nicolas.Thiery.name/
> 


-- 
You received this message because you are subscribed to the Google Groups 
"sage-combinat-devel" group.
To post to this group, send email to sage-combinat-de...@googlegroups.com.
To unsubscribe from this group, send email to 
sage-combinat-devel+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sage-combinat-devel?hl=en.



[sage-combinat-devel] Re: CombinatorialFreeModule (again)

2010-09-02 Thread bump
On Sep 2, 3:33 am, Bruce  wrote:
> I am trying to construct the fee module on the set of instances of a
> class G.

It would be good to give a complete example, that is, with a
particular G.

> Can anyone tell me what I am doing wrong and/or explain this?
> Thanks

-- 
You received this message because you are subscribed to the Google Groups 
"sage-combinat-devel" group.
To post to this group, send email to sage-combinat-de...@googlegroups.com.
To unsubscribe from this group, send email to 
sage-combinat-devel+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sage-combinat-devel?hl=en.



[sage-combinat-devel] Re: Categorification of tableaux

2010-09-02 Thread Andrew Mathas
Dear Nicolas and Jason,

I am happy to be the reviewer. Is there any documentation written
about how all of this is about to work? I have looked a little for it
without success. My impression is that the general structure is very
well thought out but without having Nicolas or Florent sitting next to
you it is hard to learn what the intended design is!

Andrew

On Sep 1, 2:53 am, "Nicolas M. Thiery" 
wrote:
>         Hi Jason!
>
> For once, I am trying hard to procrastinate on the Sage-Combinat
> e-mails in order to focus on finishing our paper with Florent and
> Anne, instead of the converse; hence my slow answer.
>
> Thanks for your long post! It sounds all fine to me. I'll just insert
> a couple micro comments below. I hope someone goes on and implements
> this! It would be great if you could do with Andrew as reviewer (or
> the converse, or with whatever pair programming scheme fits you).
>
> On Thu, Aug 19, 2010 at 12:11:47PM -0400, Jason Bandlow wrote:
> > The 'metaclass' trick is so that both of these will work, and the
> > parents will be set appropriately.  Anyway, here is what I roughly think
> > the element classes should look.
>
> And I should mention that the "metaclass trick" is nothing but a
> syntactic sugar so that one can use the same name Tableau for both:
>
>  - the function used to create a tableau
>  - the base class for all tableaux.
>
> Currently in Sage, those two gadgets are usually distinct (think
> Partition/Partition_class which makes it inconvenient for the user to
> access Partition_class, say for an isinstance test.
>
> > class Tableaux(UniqueRepresentation, Parent):
> > ...
> > class SemistandardTableaux(UR, Parent, Tableaux): # similar
> > class StandardTableaux(UR, Parent, SemistandardTableaux): # similar
>
> No need to specify again UR and Parent; those are inherited through
> Tableaux.
>
> > Finally we have the specific parent classes.  I think they should look
> > roughly as follows.
>
> >   The parent classes 
>
> > class Tableaux_all(Tableaux):
> >   def __init__(self):
> >     super(Tableaux_all, self).__init__()
> >       # I don't know a good category, since general tableaux (which
> >       # allow, for example, real-number entries) are not enumerable.
>
> I guess Sets() is the best we can do.
>
> > class SemistandardTableaux_all(DisjointUnionEnumeratedSets,
> >                   SemistandardTableaux):
>
> >   def __init__(self):
> >     DisjointUnionEnumeratedSets.__init__(
> >             self, Family(NonNegativeIntegers(),
> >             SemistandardTableaux_size),
> >             facade=True, keepkey = False)
> >      # Note that I'm not clear on what facade and keepkey do.
> >      # They may not be necessary or advisable.
>
>  * With keekkey = True, the elements of the disjoint union would be of
>    the form (5, Partition([3,2])). That's only useful when one wants
>    to construct the disjoint union of a collection of sets which are
>    not originally disjoint (e.g. building n copies of a given set).
>
>  * facade = True/False controls whether, for x in
>    SemiStandardTableaux(), x.parent() is SemiStandardTableaux() or
>    SemiStandardTableaux(shape=...)
>
> > class SemistandardTableaux_size(SemistandardTableaux):
>
> >   def __init__(self, size):
> >     super(SemistandardTableaux_size, self).__init__(
> >               category = InfiniteFiniteEnumeratedSets())
>
> Interesting category :-) But yes, the category should be set to one or
> the other depending on what makes sense.
>
>                                 Nicolas
> --
> Nicolas M. Thi ry "Isil" http://Nicolas.Thiery.name/

-- 
You received this message because you are subscribed to the Google Groups 
"sage-combinat-devel" group.
To post to this group, send email to sage-combinat-de...@googlegroups.com.
To unsubscribe from this group, send email to 
sage-combinat-devel+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sage-combinat-devel?hl=en.



Re: [sage-combinat-devel] CombinatorialFreeModule (again)

2010-09-02 Thread Florent Hivert
  Hi Bruce,

On Thu, Sep 02, 2010 at 03:33:21AM -0700, Bruce wrote:
> I am trying to construct the fee module on the set of instances of a
> class G.
> I start with
> 
> M = CombinatorialFreeModule(QQ,G)
> 
> If f,g are instances of G I then continue with
> 
> a = M.monomial(f)
> b = M.monomial(g)
> 
> and I can then form a+a , a+b etc. and a - a is indeed 0.
> 
> However if I try 2*a I get a TypeError
> 
> If I try
> 
> M = CombinatorialFreeModule(QQ,NonNegativeIntegers())
> 
> a = M.monomial(3)
> 
> then 2*a seems to work fine.
> 
> Can anyone tell me what I am doing wrong and/or explain this?

I'm in a hurry. so this is only a very short answer. It is maybe a bug but in
the usual usage  in
   > M = CombinatorialFreeModule(QQ,G)
G is supposed to be an Parent (mathematical object) and ont a class (python
stuff). I'm not sure if this is enforced or not.

Cheers,

Florent

-- 
You received this message because you are subscribed to the Google Groups 
"sage-combinat-devel" group.
To post to this group, send email to sage-combinat-de...@googlegroups.com.
To unsubscribe from this group, send email to 
sage-combinat-devel+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sage-combinat-devel?hl=en.



[sage-combinat-devel] CombinatorialFreeModule (again)

2010-09-02 Thread Bruce
I am trying to construct the fee module on the set of instances of a
class G.
I start with

M = CombinatorialFreeModule(QQ,G)

If f,g are instances of G I then continue with

a = M.monomial(f)
b = M.monomial(g)

and I can then form a+a , a+b etc. and a - a is indeed 0.

However if I try 2*a I get a TypeError

If I try

M = CombinatorialFreeModule(QQ,NonNegativeIntegers())

a = M.monomial(3)

then 2*a seems to work fine.

Can anyone tell me what I am doing wrong and/or explain this?
Thanks

-- 
You received this message because you are subscribed to the Google Groups 
"sage-combinat-devel" group.
To post to this group, send email to sage-combinat-de...@googlegroups.com.
To unsubscribe from this group, send email to 
sage-combinat-devel+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sage-combinat-devel?hl=en.