Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
Merge branch 'public/18001' in 9.2.b3
Browse files Browse the repository at this point in the history
  • Loading branch information
fchapoton committed Jul 6, 2020
2 parents a79b0fc + e473ebf commit 40afa48
Show file tree
Hide file tree
Showing 8 changed files with 463 additions and 6 deletions.
8 changes: 7 additions & 1 deletion src/sage/categories/all.py
Expand Up @@ -50,10 +50,16 @@

# finite groups/...
from .finite_semigroups import FiniteSemigroups
from .finite_monoids import FiniteMonoids
from .finite_groups import FiniteGroups
from .finite_permutation_groups import FinitePermutationGroups

#monoids/...
from .finite_monoids import FiniteMonoids
from .h_trivial_monoids import HTrivialMonoids
from .r_trivial_monoids import RTrivialMonoids
from .l_trivial_monoids import LTrivialMonoids
from .j_trivial_monoids import JTrivialMonoids

# fields
from .number_fields import NumberFields
from .function_fields import FunctionFields
Expand Down
12 changes: 7 additions & 5 deletions src/sage/categories/examples/finite_semigroups.py
@@ -1,12 +1,12 @@
"""
Examples of finite semigroups
"""
#*****************************************************************************
# ****************************************************************************
# Copyright (C) 2008-2009 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.sets.family import Family
Expand Down Expand Up @@ -103,7 +103,7 @@ class LeftRegularBand(UniqueRepresentation, Parent):
running ._test_some_elements() . . . pass
"""

def __init__(self, alphabet=('a','b','c','d')):
def __init__(self, alphabet=('a', 'b', 'c', 'd'), category=None):
r"""
A left regular band.
Expand All @@ -116,7 +116,9 @@ def __init__(self, alphabet=('a','b','c','d')):
sage: TestSuite(S).run()
"""
self.alphabet = alphabet
Parent.__init__(self, category = Semigroups().Finite().FinitelyGenerated())
if category is None:
category = Semigroups().Finite().FinitelyGenerated()
Parent.__init__(self, category=category)

def _repr_(self):
r"""
Expand All @@ -126,7 +128,7 @@ def _repr_(self):
sage: S._repr_()
"An example of a finite semigroup: the left regular band generated by ('a', 'b', 'c', 'd')"
"""
return "An example of a finite semigroup: the left regular band generated by %s"%(self.alphabet,)
return "An example of a finite semigroup: the left regular band generated by %s" % (self.alphabet,)

def product(self, x, y):
r"""
Expand Down
1 change: 1 addition & 0 deletions src/sage/categories/finite_semigroups.py
Expand Up @@ -134,3 +134,4 @@ def first_idempotent(l):

# TODO: compute eJe, where J is the J-class of e
# TODO: construct the action of self on it, as a permutation group
# TODO: Construct ideals of semigroups, ie R(a) = aS, L(a) = Sa, J(a) = SaS.
60 changes: 60 additions & 0 deletions src/sage/categories/h_trivial_monoids.py
@@ -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
79 changes: 79 additions & 0 deletions src/sage/categories/j_trivial_monoids.py
@@ -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()
70 changes: 70 additions & 0 deletions src/sage/categories/l_trivial_monoids.py
@@ -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)
99 changes: 99 additions & 0 deletions src/sage/categories/r_trivial_monoids.py
@@ -0,0 +1,99 @@
#*****************************************************************************
# 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.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().keys())
[(0,), (0, 1), (0, 1, 2), (0, 2), (1,), (1, 2), (2,)]
"""
s = self.semigroup_generators()
return tuple(i for i in s.keys()
if idempotent * s[i] == idempotent)

0 comments on commit 40afa48

Please sign in to comment.