Examples of semigroups in cython
Bases: sage.categories.category.Category
Initializes this category.
EXAMPLES:
sage: class SemiprimitiveRings(Category):
....: def super_categories(self):
....: return [Rings()]
....:
....: class ParentMethods:
....: def jacobson_radical(self):
....: return self.ideal(0)
....:
sage: C = SemiprimitiveRings()
sage: C
Category of semiprimitive rings
sage: C.__class__
<class '__main__.SemiprimitiveRings_with_category'>
Note
Specifying the name of this category by passing a string is deprecated. If the default name (built from the name of the class) is not adequate, please use _repr_object_names() to customize it.
alias of IdempotentSemigroupsElementMethods
EXAMPLES:
sage: from sage.categories.examples.semigroups_cython import IdempotentSemigroups
sage: IdempotentSemigroups().super_categories()
[Category of semigroups]
Bases: object
x.__init__(...) initializes x; see help(type(x)) for signature
EXAMPLES:
sage: from sage.categories.examples.semigroups_cython import LeftZeroSemigroup
sage: S = LeftZeroSemigroup()
sage: S(2).is_idempotent_cpdef() # todo: not implemented (binding; see __getattr__)
True
Bases: sage.categories.examples.semigroups.LeftZeroSemigroup
An example of semigroup
This class illustrates a minimal implementation of a semi-group where the element class is an extension type, and still gets code from the category. Also, the category itself includes some cython methods.
This is purely a proof of concept. The code obviously needs refactorisation!
Comments:
EXAMPLES:
sage: from sage.categories.examples.semigroups_cython import LeftZeroSemigroup
sage: S = LeftZeroSemigroup(); S
An example of a semigroup: the left zero semigroup
This is the semigroup which contains all sort of objects:
sage: S.some_elements()
[3, 42, 'a', 3.4, 'raton laveur']
with product rule is given by for all
.
sage: S('hello') * S('world')
'hello'
sage: S(3)*S(1)*S(2)
3
sage: S(3)^12312321312321 # todo: not implemented (see __getattr__)
3
sage: TestSuite(S).run(verbose = True)
running ._test_an_element() . . . pass
running ._test_associativity() . . . pass
running ._test_category() . . . pass
running ._test_elements() . . .
Running the test suite of self.an_element()
running ._test_category() . . . pass
running ._test_eq() . . . pass
running ._test_not_implemented_methods() . . . pass
running ._test_pickling() . . . pass
pass
running ._test_elements_eq_reflexive() . . . pass
running ._test_elements_eq_symmetric() . . . pass
running ._test_elements_eq_transitive() . . . pass
running ._test_elements_neq() . . . pass
running ._test_eq() . . . pass
running ._test_not_implemented_methods() . . . pass
running ._test_pickling() . . . pass
running ._test_some_elements() . . . pass
That’s really the only method which is obtained from the category ...
sage: S(42).is_idempotent
<bound method IdempotentSemigroups.element_class.is_idempotent of 42>
sage: S(42).is_idempotent()
True
sage: S(42)._pow_ # todo: not implemented (how to bind it?)
<method '_pow_' of 'sage.categories.examples.semigroups_cython.IdempotentSemigroupsElement' objects>
sage: S(42)^10 # todo: not implemented (see __getattr__)
42
sage: S(42).is_idempotent_cpdef # todo: not implemented (how to bind it?)
<method 'is_idempotent_cpdef' of 'sage.categories.examples.semigroups_cython.IdempotentSemigroupsElement' objects>
sage: S(42).is_idempotent_cpdef() # todo: not implemented (see __getattr__)
True
alias of LeftZeroSemigroupElement
Bases: sage.structure.element.Element
EXAMPLES:
sage: from sage.categories.examples.semigroups_cython import LeftZeroSemigroup
sage: S = LeftZeroSemigroup()
sage: x = S(3)
sage: TestSuite(x).run()