Return the join of self and other in the lattice.
EXAMPLES:
sage: D = Posets.DiamondPoset(5)
sage: D(1) + D(2)
4
sage: D(1) + D(1)
1
sage: D(1) + D(4)
4
sage: D(1) + D(0)
1
Return the meet of self and other in the lattice.
EXAMPLES:
sage: D = Posets.DiamondPoset(5)
sage: D(1) * D(2)
0
sage: D(1) * D(1)
1
sage: D(1) * D(0)
0
sage: D(1) * D(4)
1
A default comparison of self with other.
Note
The rich comparison methods have been implemented for poset elements, so when a user asks for x < y, for example, rich comparison is used (that is, x.__lt__(y) is returned). This method is implemented because PosetElement inherits from Element, which requires __cmp__ to enable sorting by the cmp method.
If both self and other have the same parent poset, then the comparison is done in the poset. If the elements are incomparable in the poset, then 0 is returned. Note that, in particular, cmp(a,b) == cmp(b,a) if a and b are equal or incomparable in the poset.
TESTS:
sage: P = Poset([[1,2],[4],[3],[4],[]])
sage: P(0).__cmp__(P(4))
-1
sage: P(4).__cmp__(P(0))
1
sage: P(0).__cmp__(P(0))
0
sage: P(1).__cmp__(P(2))
0
sage: cmp(P(0),P(4))
-1
sage: cmp(P(4),P(0))
1
sage: cmp(P(0),P(0))
0
sage: cmp(P(1),P(2))
0
sage: cmp(P(2),P(1))
0
TESTS:
sage: P = Poset([[1,2],[4],[3],[4],[]])
sage: P(0).__eq__(P(4))
False
sage: from sage.combinat.posets.elements import PosetElement
sage: PosetElement(P,0,3) == PosetElement(P,0,3)
True
sage: PosetElement(P,1,3) == PosetElement(P,0,3)
False
sage: PosetElement(P,0,2) == PosetElement(P,0,3)
False
TESTS
sage: dag = DiGraph({0:[2,3], 1:[3,4], 2:[5], 3:[5], 4:[5]})
sage: P = Poset(dag)
sage: P(0).__ge__(P(5))
False
sage: P(5).__ge__(P(0))
True
sage: P(0).__ge__(P(0))
True
TESTS
sage: dag = DiGraph({0:[2,3], 1:[3,4], 2:[5], 3:[5], 4:[5]})
sage: P = Poset(dag)
sage: P(0).__gt__(P(5))
False
sage: P(5).__gt__(P(0))
True
sage: P(0).__gt__(P(0))
False
Establishes the parent-child relationship between poset and element, where element is associated to the vertex vertex of the Hasse diagram of the poset.
INPUT:
TESTS:
sage: from sage.combinat.posets.elements import PosetElement
sage: P = Poset([[1,2],[4],[3],[4],[]])
sage: e = P(0)
sage: e.parent() is P
True
sage: e == loads(dumps(e))
True
TESTS
sage: dag = DiGraph({0:[2,3], 1:[3,4], 2:[5], 3:[5], 4:[5]})
sage: P = Poset(dag)
sage: P(1) <= P(0)
False
sage: P(0) <= P(1)
False
sage: P(0) <= P(3)
True
sage: P(0) <= P(0)
True
TESTS
sage: dag = DiGraph({0:[2,3], 1:[3,4], 2:[5], 3:[5], 4:[5]})
sage: P = Poset(dag)
sage: P(0) < P(1)
False
sage: P(4) < P(1)
False
sage: P(0) < P(0)
False
TESTS:
sage: P = Poset([[1,2],[4],[3],[4],[]])
sage: P(0).__ne__(P(4))
True
sage: from sage.combinat.posets.elements import PosetElement
sage: PosetElement(P,0,3) != PosetElement(P,0,3)
False
sage: PosetElement(P,1,3) != PosetElement(P,0,3)
True
sage: PosetElement(P,0,2) != PosetElement(P,0,3)
True
TESTS:
sage: repr(Poset([[1,2],[4],[3],[4],[]])(0))
'0'
TESTS:
sage: P = Poset([[1,2],[4],[3],[4],[]])
sage: P(0)._cmp(P(4))
-1
sage: P(4)._cmp(P(0))
1
sage: P(0)._cmp(P(0))
0
sage: P(1)._cmp(P(2))