示例#1
0
    def __init__(self, sets, category, order=None, **kwargs):
        r"""
        See :class:`CartesianProductPoset` for details.

        TESTS::

            sage: P = Poset((srange(3), lambda left, right: left <= right))
            sage: C = cartesian_product((P, P), order='notexisting')
            Traceback (most recent call last):
            ...
            ValueError: No order 'notexisting' known.
            sage: C = cartesian_product((P, P), category=(Groups(),))
            sage: C.category()
            Join of Category of groups and Category of posets
        """
        if order is None:
            self._le_ = self.le_product
        elif isinstance(order, str):
            try:
                self._le_ = getattr(self, 'le_' + order)
            except AttributeError:
                raise ValueError("No order '%s' known." % (order, ))
        else:
            self._le_ = order

        from sage.categories.category import Category
        from sage.categories.posets import Posets
        if not isinstance(category, tuple):
            category = (category, )
        category = Category.join(category + (Posets(), ))
        super(CartesianProductPoset, self).__init__(sets, category, **kwargs)
示例#2
0
 def __init__(self, **keywords):
     DisjointUnionEnumeratedSets.__init__(
         self,
         Family(NonNegativeIntegers(),
                lambda i: Relations_size(i, **keywords)),
         facade=True,
         keepkey=False,
         category=(Posets(), EnumeratedSets()))
     self._sign = None
     self._initialise_properties(keywords)
示例#3
0
    def super_categories(self):
        r"""
        Returns a list of the (immediate) super categories of
        ``self``, as per :meth:`Category.super_categories`.

        EXAMPLES::

            sage: FinitePosets().super_categories()
            [Category of posets, Category of finite enumerated sets]
        """
        return [Posets(), FiniteEnumeratedSets()]
示例#4
0
    def super_categories(self):
        r"""
        Returns a list of the (immediate) super categories of
        ``self``, as per :meth:`Category.super_categories`.

        EXAMPLES::

            sage: LatticePosets().super_categories()
            [Category of posets]
        """
        return [Posets()]
示例#5
0
    def __init__(self, elements, facade=True):
        """
        Initialize ``self``.

        TESTS::

            sage: TestSuite(TotallyOrderedFiniteSet([1,2,3])).run()
            sage: TestSuite(TotallyOrderedFiniteSet([1,2,3],facade=False)).run()
            sage: TestSuite(TotallyOrderedFiniteSet([1,3,2],facade=False)).run()
            sage: TestSuite(TotallyOrderedFiniteSet([])).run()
        """
        Parent.__init__(self, facade = facade, category = (Posets(),FiniteEnumeratedSets()))
        self._elements = elements
        if facade:
            self._facade_elements = None
        else:
            self._facade_elements = self._elements
            self._elements = [self.element_class(self,x) for x in elements]