Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug in order_ideal_complement_generators: 'down' #12848

Closed
nthiery opened this issue Apr 17, 2012 · 32 comments
Closed

Bug in order_ideal_complement_generators: 'down' #12848

nthiery opened this issue Apr 17, 2012 · 32 comments

Comments

@nthiery
Copy link
Contributor

nthiery commented Apr 17, 2012

The down option is broken in order_ideal_complement_generators due to
a glitch:

    sage: P = Poset( ( [1,2,3], [ [1,3], [2,3] ] ) )
    sage: sage: P.order_ideal_complement_generators([1,2], direction='up')
    set([3])
    sage: P.order_ideal_complement_generators([1,2], direction='down')
    set([3])

The result should be [] in the later case.

Upcoming patch on the Sage-Combinat queue

Apply:

attachment: trac_12848-posets-order_ideal_complement_generators_fix-nt-v2.patch
attachment: trac_12848-posets-modifications.patch

CC: @sagetrac-sage-combinat

Component: combinatorics

Keywords: posets, days49

Author: Nicolas M. Thiéry, Frédéric Chapoton

Reviewer: Darij Grinberg, Anne Schilling

Merged: sage-5.11.beta3

Issue created by migration from https://trac.sagemath.org/ticket/12848

@anneschilling
Copy link
Contributor

comment:1

I am looking at the patch on the sage-combinat queue. The method

  •    def upper_set(self, elements, direction='up'):
    
  •        if direction=='up':
    
  •            return self.order_filter(elements)
    
  •        else:
    
  •            return self.order_ideal(elements)
    

is missing a doctest.

@nthiery
Copy link
Contributor Author

nthiery commented May 8, 2012

comment:2

Replying to @anneschilling:

I am looking at the patch on the sage-combinat queue. The method

  •    def upper_set(self, elements, direction='up'):
    
  •        if direction=='up':
    
  •            return self.order_filter(elements)
    
  •        else:
    
  •            return self.order_ideal(elements)
    

is missing a doctest.

Ah right. And we need to discuss the name for this method, and use it in order_ideal_complement_generators

@fchapoton
Copy link
Contributor

comment:3

could you please upload the patch here ?

@fchapoton
Copy link
Contributor

comment:4

Attachment: trac_12848-posets-order_ideal_complement_generators_fix-nt.patch.gz

Here is a modified patch, that should pass all tests and is fully documented.

There is an annoying issue with the names of the methods "upper_ideal", "lower_ideal", "order_ideal", "order_filter"

@anneschilling
Copy link
Contributor

comment:5

There is an annoying issue with the names of the methods "upper_ideal", "lower_ideal", "order_ideal", "order_filter"

What is the precise issue with the names?

Anne

@fchapoton
Copy link
Contributor

comment:6

Well, the issue is that of "order_ideal" is a synonym for "lower ideal" and "order_filter" is a synonym for "upper_ideal". Before this patch, everywhere one uses "order_ideal" and "order_filter". In my opinion, these are bad names, and "lower ideal" and "upper ideal" are much better.

And, well, I think that "upper set" and "lower set" are very bad too.

In any case, there is still some cleanup to do.

@fchapoton
Copy link
Contributor

comment:7

ok, here is a new patch, 100% doctest, should pass all tests.

In principle, it should not break anything anywhere.

@fchapoton
Copy link
Contributor

comment:9

The bot has turned green, and the patch is ready for review !

@fchapoton
Copy link
Contributor

comment:10

anybody out there ? maybe it is ready to go ?

@fchapoton

This comment has been minimized.

@fchapoton
Copy link
Contributor

Changed author from Nicolas M. Thiéry to Nicolas M. Thiéry, Frédéric Chapoton

@anneschilling
Copy link
Contributor

comment:12

Replying to @fchapoton:

If you put the patch on the sage-combinat queue, I will review it!

@fchapoton
Copy link
Contributor

comment:13

done, the patch is in the queue..

@anneschilling
Copy link
Contributor

comment:14

Hi Frédéric,

Thank you for getting this patch ready for submission!

One small technical issue is that the header of the patch needs to start with
#14828: ... description of the patch ...
Could you change this?

I am not so happy about the naming conventions that you used. Could you please give me references that use order filter and order ideal? Why don't you like upper set and lower set? That seems like a standard name, see

http://en.wikipedia.org/wiki/Upper_set

Best,

Anne

@fchapoton
Copy link
Contributor

comment:15

Oh, I have not seen your answer, for some reason.

I will take care of the header question soon.

Concerning terminology, it seems that confusion is everywhere, see for instance

http://en.wikipedia.org/wiki/Order_ideal

saying "The terms order ideal, order filter, semi-ideal, down-set and decreasing subset are sometimes used for arbitrary lower or upper sets"

So far, in sage, we have the following definition (in P.order_ideal?)

I is an order ideal if, for any x in I and y such that y <= x, then y is in I.

So I have tried to stick at this convention and not to introduce two competing notations in sage. I do not like upper set and lower set because of the word set, which does not has the idea of closure. I do not like order ideal and order filter because I never remember which one is which. I would like to use upper ideal and lower ideal, but nobody seems to use that. This is rather boring.

@nthiery
Copy link
Contributor Author

nthiery commented Jun 7, 2013

comment:16

Hi Frederic.

I agree that this naming thing is a pain; which is actually what
stopped me from cleaning this earlier. Thanks for pushing it forward ...

order_ideal and order_filter are definitely bad for the reason you
mention (which one is up, which one is down). So at least this is
settled: we want to move away from those.

upper_set and lower_set has the advantage of being unambiguous and
relatively clear (though I see your point about "closures"). So I
would vote for this. But ... we also would want to be able to pass
upper/lower as argument, and I agree that set(dir="up") really
does not make sense :-) And ``upper_set(dir='down') is not great
either.

I am really not keen with "ideal" because it has two conflicting
meanings. But it's been in Sage for a while and we already do
ideal(side="left/right") in rings/monoids, so ideal(dir="up/down") is
consistent.

Would we have a nice method name for the other definition of ideal
(e.g. a upper set such that any meet of two elements is also in it)?

Cheers,
Nicolas

@fchapoton
Copy link
Contributor

comment:17

The other definition of "order filter" is not quite that: it says "an upper set such that any two elements have a common lowest bound in the upper set"

It seems to imply (for finite posets) that it has a unique minimal element, and that this other definition could be called a "principal upper ideal" or "principal upper set".

There are subtle issues for infinite posets, but should we be concerned about that ?

@nthiery
Copy link
Contributor Author

nthiery commented Jun 7, 2013

comment:18

Replying to @fchapoton:

The other definition of "order filter" is not quite that: it says "an upper set such that any two elements have a common lowest bound in the upper set"

Oops, you are right; I formulated this to fast.

It seems to imply (for finite posets) that it has a unique minimal element, and that this other definition could be called a "principal upper ideal" or "principal upper set".

Indeed.

There are subtle issues for infinite posets, but should we be concerned about that ?

Not right now. But that will come! So it would be good to know that there exist a plan, even if we don't know right away which plan it should be.

@anneschilling
Copy link
Contributor

comment:19

upper ideal and lower ideal is ok with me if really nobody is using this with another meaning!

Anne

@fchapoton
Copy link
Contributor

@fchapoton
Copy link
Contributor

comment:20

Here is new patch, with correct header.

I have chosen to do the following:

  • keep the names "order_ideal" and "order_filter" for backward compatibility
  • introduce "upper_set" and "lower_set" as aliases
  • use the names "ideal_of_subset" and "ideals_of_subsets" for generic cases

This is clearly not at all coherent. Should we try to reach coherence in this ticket, or should we rather use this ticket to solve the issue that has been raised ?

@darijgr
Copy link
Contributor

darijgr commented Jun 19, 2013

comment:21

"Returns the order ideal in self generated by gens."
Shouldn't that gens be elements now?

"generaly" generally

@darijgr
Copy link
Contributor

darijgr commented Jun 19, 2013

comment:22

We (Tom, Emma, me) have a couple of suggestions on this patch (which we are working from). What do you think of them? Mainly it changes ideal_of_subset and ideals_of_subsets into directed_subset and directed_subsets, which IMHO are much less confusing (it's as much ideals as it's filters).

@fchapoton
Copy link
Contributor

comment:23

Yes, it is indeed a better name. I have no time right now to take part in the action, so please do what you want.

@fchapoton
Copy link
Contributor

comment:24

please correct the failing doctests

@darijgr
Copy link
Contributor

darijgr commented Jun 19, 2013

fixed. sorry!!

@anneschilling
Copy link
Contributor

comment:25

Attachment: trac_12848-posets-modifications.patch.gz

@anneschilling

This comment has been minimized.

@anneschilling
Copy link
Contributor

Reviewer: Darij Grinberg, Anne Schilling

@anneschilling
Copy link
Contributor

Changed keywords from posets to posets, days49

@anneschilling
Copy link
Contributor

comment:28

Ok, looks good now and the tests pass!

Anne

@jdemeyer
Copy link
Contributor

Merged: sage-5.11.beta3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants