Thanks for your reply.
To me the essence of the definition of join and meetsemilattice is about 
joins/meets existing for ALL pairs, as opposed to some pairs. Hence having 
a join/meet operation on any poset is not that unnatural, because almost 
all posets have at least some pairs of element for which the join/meet 
exists (e.g. trivial pairs x<= y). 
I am actually porting some code that I wrote in Macaulay2 to Sage, because 
of Sage's way better support for matroids. In Macaulay2 joins/meets are 
implemented for all posets. I think what I'll do is just use Sage for its 
matroid library, and output the posets I need to Macaulay2 for further 
processing.

As for your code, I think you want to return j.bottom(), not just the first 
element of j, correct? Either way I'm not sure that this is efficient 
enough to be workable, but I will try it. 


Op dinsdag 4 april 2017 06:01:48 UTC+2 schreef [email protected]:
>
> On Mon, 3 Apr 2017, Robin van der veer wrote: 
>
> > I wonder if there is any way to use the join or meet operations in 
> arbitrary 
> > posets?  
>
> How fast that should be? The trivial implementation is just 4 lines long, 
> here with monkey patch: 
>
> def join2(self, a, b): 
>      j = self.subposet([e for e in self.principal_upper_set(a) if e in 
> self.principal_upper_set(b)]) 
>      if len(j) > 1: 
>          raise ValueError("no join for %s and %s" % (a, b)) 
>      return j[0] 
> type(Poset()).join = join2 
>
> P = Poset({1:[3, 4], 2:[3, 4], 3:[5], 4:[5]}) 
> P.join(3, 4) 
>
> It sounds a little unnatural to have join or meet for all posets. Other 
> users might except L.join() to return an error if L is not a 
> join-semilattice. 
>
> -- 
> Jori Mäntysalo

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.

Reply via email to