This repository has been archived by the owner on Jan 30, 2023. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'public/18001' in 9.2.b4
- Loading branch information
Showing
8 changed files
with
462 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
from sage.misc.cachefunc import cached_method | ||
from sage.categories.monoids import Monoids | ||
from sage.categories.category import Category | ||
from sage.categories.category_with_axiom import CategoryWithAxiom | ||
|
||
|
||
class HTrivialMonoids(Category): | ||
""" | ||
The category of `H`-trivial monoids | ||
Let `M` be a monoid. The `H`-*preorder* is defined by `x\leq_H y` | ||
if `x \in My` and `x \in yM`. The `H`-*classes* are the | ||
equivalence classes for the associated equivalence relation. A | ||
monoid is `H`-*trivial* if all its `H`-classes are trivial, that | ||
is of cardinality `1`, or equivalently if the `H`-preorder is in | ||
fact an order. | ||
A `H`-trivial monoid is also called an aperiodic monoid. | ||
See :wikipedia:`Aperiodic_semigroup` | ||
EXAMPLES:: | ||
sage: from sage.categories.h_trivial_monoids import * | ||
sage: C = HTrivialMonoids(); C | ||
Category of h trivial monoids | ||
sage: C.super_categories() | ||
[Category of monoids] | ||
sage: C.example() | ||
NotImplemented | ||
.. seealso:: :class:`LTrivialMonoids`, :class:`RTrivialMonoids`, :class:`JTrivialMonoids` | ||
""" | ||
|
||
@cached_method | ||
def super_categories(self): | ||
""" | ||
""" | ||
return [Monoids()] | ||
|
||
class Finite(CategoryWithAxiom): | ||
|
||
class ParentMethods: | ||
pass | ||
|
||
class ElementMethods: | ||
|
||
def pow_omega(self): | ||
""" | ||
The omega power of ``self``. | ||
""" | ||
res_old = self | ||
res_new = res_old * res_old | ||
while res_old != res_new: | ||
res_old = res_new | ||
res_new = res_old * res_old | ||
return res_new | ||
|
||
pow_infinity = pow_omega # for backward compatibility |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
r""" | ||
Finite J-Trivial Monoids | ||
""" | ||
#***************************************************************************** | ||
# Copyright (C) 2009-2010 Florent Hivert <florent.hivert at univ-rouen.fr> | ||
# 2009-2010 Nicolas M. Thiery <nthiery at users.sf.net> | ||
# | ||
# Distributed under the terms of the GNU General Public License (GPL) | ||
# http://www.gnu.org/licenses/ | ||
#****************************************************************************** | ||
|
||
from sage.misc.cachefunc import cached_method | ||
from sage.categories.category import Category | ||
from sage.categories.category_with_axiom import CategoryWithAxiom | ||
from sage.categories.l_trivial_monoids import LTrivialMonoids | ||
from sage.categories.r_trivial_monoids import RTrivialMonoids | ||
from sage.misc.cachefunc import cached_in_parent_method | ||
from sage.sets.family import Family | ||
|
||
|
||
class JTrivialMonoids(Category): | ||
r""" | ||
The category of `J`-trivial monoids | ||
Let `M` be a monoid. The `J`-relation on `M` is given by | ||
`a \sim b iff MaM = MbM`. A monoid is `J`-trivial if all its `J`-classes | ||
are of cardinality one. | ||
""" | ||
|
||
@cached_method | ||
def super_categories(self): | ||
return [LTrivialMonoids(), RTrivialMonoids()] | ||
|
||
class Finite(CategoryWithAxiom): | ||
""" | ||
The category of finite `J`-trivial monoids | ||
""" | ||
class ParentMethods: | ||
|
||
@cached_method | ||
def semigroup_generators(self): | ||
""" | ||
Returns the canonical minimal set of generators. It | ||
consists of the irreducible elements, that is elements | ||
which are not of the form `x*y` with `x` and `y` in | ||
``self`` distinct from `x*y`. | ||
""" | ||
res = [] | ||
G = self.cayley_graph(side="twosided") | ||
for x in G: | ||
if x == self.one().value: | ||
continue | ||
incoming = set(G.incoming_edges(x)) | ||
if all(l == x for u, v, l in incoming): | ||
res.append(self(x)) | ||
return Family(res) | ||
|
||
class ElementMethods: | ||
|
||
@cached_in_parent_method | ||
def symbol(self, side="left"): | ||
""" | ||
Return the unique minimal idempotent `e` (in J-order) | ||
such that `e x = x` (resp. `xe = x`). | ||
INPUT: | ||
- ``self`` -- a monoid element `x` | ||
- ``side`` -- "left", "right" | ||
""" | ||
monoid = self.parent() | ||
|
||
if side == "left": | ||
fix = [s for s in monoid.semigroup_generators() | ||
if s * self == self] | ||
else: | ||
fix = [s for s in monoid.semigroup_generators() | ||
if self * s == self] | ||
return (monoid.prod(fix)).pow_omega() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
from sage.misc.cachefunc import cached_method | ||
from sage.categories.category import Category | ||
from sage.categories.category_with_axiom import CategoryWithAxiom | ||
from sage.categories.h_trivial_monoids import HTrivialMonoids | ||
|
||
|
||
class LTrivialMonoids(Category): | ||
""" | ||
The category of `L`-trivial monoids | ||
Let `M` be a monoid. The `L`-*preorder* is defined by `x\leq_L y` | ||
if `x \in My`. The `L`-*classes* are the equivalence classes | ||
for the associated equivalence relation. A monoid is `L`-*trivial* | ||
if all its `L`-classes are trivial, that is of cardinality `1`, or | ||
equivalently if the `L`-preorder is in fact an order. | ||
EXAMPLES:: | ||
sage: C = LTrivialMonoids(); C | ||
Category of l trivial monoids | ||
sage: C.super_categories() | ||
[Category of h trivial monoids] | ||
.. seealso:: :class:`RTrivialMonoids`, :class:`HTrivialMonoids`, :class:`JTrivialMonoids` | ||
""" | ||
|
||
@cached_method | ||
def super_categories(self): | ||
""" | ||
EXAMPLES: | ||
An L-trivial monoid is also H-trivial:: | ||
sage: LTrivialMonoids().super_categories() | ||
[Category of h trivial monoids] | ||
""" | ||
return [HTrivialMonoids()] | ||
|
||
class Finite(CategoryWithAxiom): | ||
|
||
class ParentMethods: | ||
|
||
def index_of_regular_j_class(self, idempotent): | ||
""" | ||
Return the index that should be used for an idempotent in the transversal. | ||
In this implementation, each idempotent e is indexed | ||
by the subset of the indices `i` of the generators | ||
`s_i` such that `es_i=e` (that is `s_i` acts by `1` on | ||
the corresponding simple module). | ||
.. seealso:: :meth:`FiniteSemigroups.ParentMethods.j_transversal_of_idempotents` | ||
.. TODO:: | ||
This is mostly a duplicate of | ||
:meth:`RTrivialMonoids.Finite.ParentMethods.j_transversal_of_idempotents` | ||
Instead this should be generalized to | ||
DASemigroups.Finite, by testing if idempotent * | ||
s[i] is in the same J-class. And recycled to build | ||
the corresponding simple module. | ||
EXAMPLES:: | ||
sage: TODO! | ||
""" | ||
s = self.semigroup_generators() | ||
return tuple(i for i in s.keys() | ||
if s[i] * idempotent == idempotent) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
# **************************************************************************** | ||
# Copyright (C) 2009-2010 Florent Hivert <florent.hivert at univ-rouen.fr> | ||
# 2009-2010 Nicolas M. Thiery <nthiery at users.sf.net> | ||
# | ||
# Distributed under the terms of the GNU General Public License (GPL) | ||
# https://www.gnu.org/licenses/ | ||
# ***************************************************************************** | ||
|
||
from sage.misc.cachefunc import cached_method | ||
from sage.categories.category import Category | ||
from sage.categories.category_with_axiom import CategoryWithAxiom | ||
from sage.categories.h_trivial_monoids import HTrivialMonoids | ||
|
||
|
||
class RTrivialMonoids(Category): | ||
""" | ||
The category of `R`-trivial monoids | ||
Let `M` be a monoid. The `R`-*preorder* is defined by `x\leq_R y` | ||
if `x \in yM`. The `R`-*classes* are the equivalence classes | ||
for the associated equivalence relation. A monoid is `R`-*trivial* | ||
if all its `R`-classes are trivial, that is of cardinality `1`, or | ||
equivalently if the `R`-preorder is in fact an order. | ||
EXAMPLES:: | ||
sage: C = RTrivialMonoids(); C | ||
Category of r trivial monoids | ||
sage: C.super_categories() | ||
[Category of h trivial monoids] | ||
.. SEEALSO:: :class:`LTrivialMonoids`, :class:`HTrivialMonoids`, :class:`JTrivialMonoids` | ||
""" | ||
|
||
@cached_method | ||
def super_categories(self): | ||
""" | ||
EXAMPLES: | ||
An R-trivial monoid is also H-trivial:: | ||
sage: RTrivialMonoids().super_categories() | ||
[Category of h trivial monoids] | ||
""" | ||
return [HTrivialMonoids()] | ||
|
||
def example(self, alphabet=('a', 'b', 'c')): | ||
""" | ||
Return an example of (finite) right trivial monoid. | ||
.. SEEALSO:: :meth:`Category.example` | ||
.. TODO:: this cheating a bit: this is just a semigroup, not a monoid! | ||
EXAMPLES:: | ||
sage: S = RTrivialMonoids().example(); S | ||
An example of a finite semigroup: the left regular band generated by ('a', 'b', 'c') | ||
sage: S.category() | ||
Category of finitely generated finite enumerated r trivial monoids | ||
""" | ||
from sage.categories.examples.finite_semigroups import LeftRegularBand | ||
return LeftRegularBand(alphabet=alphabet, | ||
category=RTrivialMonoids().Finite().FinitelyGenerated()) | ||
|
||
class Finite(CategoryWithAxiom): | ||
|
||
class ParentMethods: | ||
|
||
def index_of_regular_j_class(self, idempotent): | ||
""" | ||
Return the index that should be used for an idempotent in the transversal. | ||
In this implementation, each idempotent e is indexed | ||
by the subset of the indices `i` of the generators | ||
`s_i` such that `es_i=e` (that is `s_i` acts by `1` on | ||
the corresponding simple module). | ||
.. SEEALSO:: :meth:`FiniteSemigroups.ParentMethods.j_transversal_of_idempotents` | ||
EXAMPLES:: | ||
sage: S = RTrivialMonoids().example(alphabet=('a','b','c')); S | ||
An example of a finite semigroup: the left regular band generated by ('a', 'b', 'c') | ||
sage: S.category() | ||
Category of finitely generated finite enumerated r trivial monoids | ||
sage: a,b,c = S.semigroup_generators() | ||
sage: S.index_of_regular_j_class(a*c) | ||
(0, 2) | ||
This is used to index the transversal of idempotents:: | ||
sage: sorted(S.j_transversal_of_idempotents()) | ||
['a', 'ab', 'abc', 'ac', 'b', 'bc', 'c'] | ||
""" | ||
s = self.semigroup_generators() | ||
return tuple(i for i in s.keys() | ||
if idempotent * s[i] == idempotent) |
Oops, something went wrong.