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