本文整理汇总了Python中sage.combinat.posets.posets.Poset.is_join_semilattice方法的典型用法代码示例。如果您正苦于以下问题:Python Poset.is_join_semilattice方法的具体用法?Python Poset.is_join_semilattice怎么用?Python Poset.is_join_semilattice使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sage.combinat.posets.posets.Poset
的用法示例。
在下文中一共展示了Poset.is_join_semilattice方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: JoinSemilattice
# 需要导入模块: from sage.combinat.posets.posets import Poset [as 别名]
# 或者: from sage.combinat.posets.posets.Poset import is_join_semilattice [as 别名]
def JoinSemilattice(data, *args, **options):
r"""
Construct a join semi-lattice from various forms of input data.
INPUT:
- ``data``, ``*args``, ``**options`` -- data and options that will
be passed down to :func:`Poset` to construct a poset that is
also a join semilattice.
.. seealso:: :func:`Poset`, :func:`MeetSemilattice`, :func:`LatticePoset`
EXAMPLES:
Using data that defines a poset::
sage: JoinSemilattice([[1,2],[3],[3]])
Finite join-semilattice containing 4 elements
sage: JoinSemilattice([[1,2],[3],[3]], cover_relations = True)
Finite join-semilattice containing 4 elements
Using a previously constructed poset::
sage: P = Poset([[1,2],[3],[3]])
sage: J = JoinSemilattice(P); J
Finite join-semilattice containing 4 elements
sage: type(J)
<class 'sage.combinat.posets.lattices.FiniteJoinSemilattice_with_category'>
If the data is not a lattice, then an error is raised::
sage: elms = [1,2,3,4,5,6,7]
sage: rels = [[1,2],[3,4],[4,5],[2,5]]
sage: JoinSemilattice((elms, rels))
Traceback (most recent call last):
...
ValueError: Not a join semilattice.
"""
if isinstance(data,FiniteJoinSemilattice) and len(args) == 0 and len(options) == 0:
return data
P = Poset(data, *args, **options)
if not P.is_join_semilattice():
raise ValueError, "Not a join semilattice."
return FiniteJoinSemilattice(P)