Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Changing the default behaviour of Poset
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  5 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Nicolas M. Thiery  
View profile  
 More options Nov 12 2012, 6:28 am
From: "Nicolas M. Thiery" <Nicolas.Thi...@u-psud.fr>
Date: Mon, 12 Nov 2012 11:28:42 +0000
Local: Mon, Nov 12 2012 6:28 am
Subject: Re: [sage-devel] Re: Changing the default behaviour of Poset

First thing: for those who want to know more on what a facade is:

    sage: S = Sets()
    sage: S.Facade?

Now, just to put this in perspective. I think many people would find
the following madness if the end result was 3 and not 0:

    sage: G = IntegerModRing(3)
    sage: G.list()
    [0, 1, 2]
    sage: a,b,c=G.list()
    sage: b+c
    0

In the above use case, you want the element of G, as returned by G, to
be aware that they live in G, so that arithmetic get done
accordingly. Similarly, for posets, there are use cases where one
wants a<b to compare a and b in the poset.

All of this to say that both facade and non facade posets are useful.
Now there is the question of the default value for this option. I
think we all agree (including the original poset authors; facades did
not exist back then), that facade=True is the natural default as this
is the most common use case.

The single remaining question is whether the issue is important enough
to break backward compatibility (with an appropriate transition period
of course).

> Actually, I tried googling poset+facade, and all the maths hits are
> Sage, with an exception of a dissertation on posets, where the only
> place the word "facade" is used is the following quote:

>   It turns out that an eerie type of chaos
>   can lurk just behind a facade of order
>   and yet, deep inside the chaos
>   lurks an even eerier type of order.
>                                   D. Hofstadter

> Thus indeed, we should not show "an eerie type of chaos",
> unless a user expicitly asks for it...

:-)

Cheers,
                                Nicolas
--
Nicolas M. Thi ry "Isil" <nthi...@users.sf.net>
http://Nicolas.Thiery.name/


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Dima Pasechnik  
View profile  
 More options Nov 12 2012, 10:02 am
Followup-To: gmane.comp.mathematics.sage.devel
From: Dima Pasechnik <dimp...@gmail.com>
Date: Mon, 12 Nov 2012 15:02:08 +0000 (UTC)
Local: Mon, Nov 12 2012 10:02 am
Subject: Re: [sage-devel] Re: Changing the default behaviour of Poset
On 2012-11-12, Nicolas M. Thiery <Nicolas.Thi...@u-psud.fr> wrote:

Absolutely! But if one builds a poset from a set with '<' already
defined (e.g. a subset of integers, or vertices of a directed acyclic graph),
and keeps in mind this order, one should not have to jump any hoops.
One way or another, I don't see a (mathematical) reason for
the elements of the poset to be replaced by some strange creatures...

> All of this to say that both facade and non facade posets are useful.
> Now there is the question of the default value for this option. I
> think we all agree (including the original poset authors; facades did
> not exist back then), that facade=True is the natural default as this
> is the most common use case.

> The single remaining question is whether the issue is important enough
> to break backward compatibility (with an appropriate transition period
> of course).

the naturalness of interface should overwrite backwards compatibility.
Thanks goodness, Sage is not M$oft Office :-)


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Travis Scrimshaw  
View profile  
 More options Nov 23 2012, 9:53 pm
From: Travis Scrimshaw <tsc...@ucdavis.edu>
Date: Fri, 23 Nov 2012 18:53:56 -0800 (PST)
Local: Fri, Nov 23 2012 9:53 pm
Subject: Re: [sage-devel] Re: Changing the default behaviour of Poset

Hey everyone,
   I just had an idea, and maybe this is more wishful thinking, but I feel
like we should be able to pass a poset/lambda function(s)/class which
contains comparison methods into a parent and have that be able to override
the default ordering (similar to what C++ does in the STL). Something like
this:

    sage: g = DiGraph([(0,1),(0,2)])
    sage: p = Poset(g)
    sage: G = IntegerRingMod(3, ordering=p)
    sage: G(0) < G(1)
    True
    sage: G(0) < G(2)
    True
    sage: G(1) < G(2)
    False

Or for partitions under dominance order (instead of how we currently are
doing them in 13605):

    sage: P = Partitions(3, cmp_lt=Partition_class.dominates) # after 13605
this would just be Partition.dominates
    sage: P([2,2,1]) < P([3,1,1])
    True

Thoughts?

Best,
Travis


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Nicolas M. Thiery  
View profile  
 More options Nov 29 2012, 5:36 pm
From: "Nicolas M. Thiery" <Nicolas.Thi...@u-psud.fr>
Date: Thu, 29 Nov 2012 23:36:05 +0100
Local: Thurs, Nov 29 2012 5:36 pm
Subject: Re: [sage-devel] Re: Changing the default behaviour of Poset

Well, maybe not that much of a wishful thinking actually!

Define this category:

    class Blahs(Category):
        def super_categories(self): return [Rings()]
        class ParentMethods:
            def blah(self): print "blah"
        class ElementMethods:
            def blih(self): print "blih"
            def __lt__(self, other):
                 print "comparing!"

And create the ring in this category:

    sage: G = IntegerModRing(3, category=Blahs())
    sage: g = G.an_element()

Now you can do:

    sage: G.blah()
    blah
    sage: g.blih()
    blih

So in principle one could use that to provide comparison methods. Alas
this does not work completely, because there already is a comparison
method implemented in G which override that of the category:

    sage: g < g
    False

This also fails for partitions because they do not yet accept a
category parameter.

Cheers,
                                Nicolas
--
Nicolas M. Thi ry "Isil" <nthi...@users.sf.net>
http://Nicolas.Thiery.name/


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Travis Scrimshaw  
View profile  
 More options Nov 29 2012, 11:28 pm
From: Travis Scrimshaw <tsc...@ucdavis.edu>
Date: Thu, 29 Nov 2012 20:28:05 -0800 (PST)
Local: Thurs, Nov 29 2012 11:28 pm
Subject: Re: [sage-devel] Re: Changing the default behaviour of Poset

Hey Nicolas,
   I don't think it is feasible to make this as a change to a parent or
category as we would have to change all classes in sage to support this
framework. I almost feel as if poset should be a general construct for
changing the default order on any set of objects, and we should strive to
make it as lightweight and hidden as possible. Here's my current thoughts
on how to do this:

- We have elements of a poset P be the elements of the set S, but on
creation, we override their comparison operations. I foresee (small)
problem with doing this. In an ideal world, I would rather the elements'
parent be P, rather than S, but there are many classes that rely on calls
to methods in S via the parent() method. Thus it becomes unclear that these
elements came from P. Do you see anyway around this?

- Have elements always be wrappers, but make it less obvious that it is a
wrapper by having it perform the _latex_, _repr_, arithmetic (maybe return
wrapped elements? perhaps throw an error/warning if result is not in the
poset?), and any other common methods of the wrapped element. Also equality
testing should be much more robust by testing against the wrapped element
if the RHS is not a poset element (and not checking that they have the same
parent, but just checking the wrapped elements).

The more I think about it, the more I grow uncomfortable with the idea of
facades. For example:

sage: g = DiGraph([(0,1),(0,2)])
sage: P = Poset(g, facade=True)
sage: P(1) < P(2)
True

so to do comparisons in the poset, you have to do

sage: P.lt(1, 2)
False

and this seems even more troubling to me if facade is True by default,
since I would expect P(1) and P(2) to be elements of the poset and be
incomparable. Although I feel like the underlying problem is not facades,
but instead the equality comparison method is not robust enough.

Best,
Travis


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »