Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

(Sub)monoids seem to be quite poorly implemented. Not only a method for generating all submonoids is missing, their elements can hardly be compared. For example:

M = FiniteSetMaps([1, 2, 3])
e = M.one()
M1 = M.subsemigroup([M[0],M[1]], one=e, category=Monoids().Finite().Subobjects())
M2 = M.subsemigroup([M[1],M[0]], one=e, category=Monoids().Finite().Subobjects())

Here we create two submonoids with the same generators (given in different order). However, while both M1[0] and M2[0] are essentially e, comparisons like M1[0] == M2[0] and M2(M1[0]) == M2[0] give False. I was able to detect their equality only via conversion to strings.


So, unless there is a better alternative, here is a code that goes over all subsets of elements of M, creates submonoids generated by them, and stores them as set of strings (for comparison purposes).

M = FiniteSetMaps([1, 2, 3])
e = M.one()
result = set()
for S in Subsets( set(M.list()) - {e} ):
    submonoid = frozenset( map(str, M.subsemigroup(S, one=e, category=Monoids().Finite().Subobjects()).list()) )
    if submonoid not in result:
        result.add( submonoid )
        print( submonoid )

Notice that it may take a few hours/days to complete executions. Running for 30 minutes produced 699 distinct submonoids.

(Sub)monoids seem to be quite poorly implemented. Not only a method for generating all submonoids is missing, their elements can hardly be compared. For example:

M = FiniteSetMaps([1, 2, 3])
e = M.one()
M1 = M.subsemigroup([M[0],M[1]], one=e, category=Monoids().Finite().Subobjects())
M2 = M.subsemigroup([M[1],M[0]], one=e, category=Monoids().Finite().Subobjects())

Here we create two submonoids with the same generators (given in different order). However, while both M1[0] and M2[0] are essentially e, comparisons like M1[0] == M2[0] and M2(M1[0]) == M2[0] give False. I was able to detect their equality only via conversion to strings.


So, unless there is a better alternative, here is a code that goes over all subsets of elements of M, creates submonoids generated by them, and stores them as set of strings (for comparison purposes).

M = FiniteSetMaps([1, 2, 3])
e = M.one()
result = set()
for S in Subsets( set(M.list()) - {e} ):
    submonoid = M.subsemigroup(S, one=e, category=Monoids().Finite().Subobjects())
    submonoid_set = frozenset( map(str, M.subsemigroup(S, one=e, category=Monoids().Finite().Subobjects()).list()) )
submonoid.list()) )       # as a frozen set
    if submonoid submonoid_set not in result:
        result.add( submonoid submonoid_set )
        print( submonoid )
submonoid_set )          # print each newly seen submonoid

Notice that it may take a few hours/days to complete executions. Running for 30 minutes produced 699 distinct submonoids.

(Sub)monoids seem to be quite poorly implemented. Not only a method for generating all submonoids is missing, their elements can hardly be compared. For example:

M = FiniteSetMaps([1, 2, 3])
e = M.one()
M1 = M.subsemigroup([M[0],M[1]], one=e, category=Monoids().Finite().Subobjects())
M2 = M.subsemigroup([M[1],M[0]], one=e, category=Monoids().Finite().Subobjects())

Here we create two submonoids with the same generators (given in different order). However, while both M1[0] and M2[0] are essentially e, comparisons like M1[0] == M2[0] and M2(M1[0]) == M2[0] give False. I was able to detect their equality only via conversion to strings.


So, unless there is a better alternative, here is a code that goes over all subsets of elements of M, creates submonoids generated by them, and stores them as set of strings (for comparison purposes).

M = FiniteSetMaps([1, 2, 3])
e = M.one()
result = set()
for S in Subsets( set(M.list()) - {e} ):
    submonoid = M.subsemigroup(S, one=e, category=Monoids().Finite().Subobjects())
    submonoid_set = frozenset( map(str, submonoid.list()) )       # as a frozen set
    if submonoid_set not in result:
        result.add( submonoid_set )
        print( submonoid_set submonoid.list() )          # print each newly seen submonoid

Notice that it may take a few hours/days to complete executions. Running for 30 minutes produced 699 distinct submonoids.

(Sub)monoids seem to be quite poorly implemented. Not only a method for generating all submonoids is missing, their elements can hardly be compared. For example:

M = FiniteSetMaps([1, 2, 3])
e = M.one()
M1 = M.subsemigroup([M[0],M[1]], one=e, category=Monoids().Finite().Subobjects())
M2 = M.subsemigroup([M[1],M[0]], one=e, category=Monoids().Finite().Subobjects())

Here we create two submonoids with the same generators (given in different order). However, while both M1[0] and M2[0] are essentially e, comparisons like M1[0] == M2[0] and M2(M1[0]) == M2[0] give False. I was able to detect their equality only via conversion to strings.


So, unless there is a better alternative, here is a code that goes over all subsets of elements of M, creates submonoids generated by them, and stores them as set of strings (for comparison purposes).

M = FiniteSetMaps([1, 2, 3])
e = M.one()
result = set()
for S in Subsets( set(M.list()) - {e} ):
    submonoid = M.subsemigroup(S, one=e, category=Monoids().Finite().Subobjects())
    submonoid_set = frozenset( map(str, submonoid.list()) )       # as a frozen set
    if submonoid_set not in result:
        result.add( submonoid_set )
        print( submonoid.list() )          # print each newly seen submonoid

Notice that it may take a few hours/days to complete executions. Running for 30 minutes produced However, getting 699 distinct submonoids.of them takes just a couple of minutes. If that's the number, you can break execution after reaching it.

(Sub)monoids seem to be quite poorly implemented. Not only a method for generating all submonoids is missing, their elements can hardly be compared. For example:

M = FiniteSetMaps([1, 2, 3])
e = M.one()
M1 = M.subsemigroup([M[0],M[1]], one=e, category=Monoids().Finite().Subobjects())
M2 = M.subsemigroup([M[1],M[0]], one=e, category=Monoids().Finite().Subobjects())

Here we create two submonoids with the same generators (given in different order). However, while both M1[0] and M2[0] are essentially e, comparisons like M1[0] == M2[0] and M2(M1[0]) == M2[0] give False. I was able to detect their equality only via conversion to strings.


So, unless there is a better alternative, here is a code that goes over all subsets of elements of M, creates submonoids generated by them, and stores them as set of strings (for comparison purposes).

M = FiniteSetMaps([1, 2, 3])
e = M.one()
result = set()
for S in Subsets( set(M.list()) - {e} ):
    submonoid = M.subsemigroup(S, one=e, category=Monoids().Finite().Subobjects())
    submonoid_set = frozenset( map(str, submonoid.list()) )       # as a frozen set
    if submonoid_set not in result:
        result.add( submonoid_set )
        print( submonoid.list() )          # print each newly seen submonoid

Notice that it may take a few hours/days to complete executions. However, getting 699 of them submonoids takes just a couple of minutes. If that's the number, you can break execution after reaching it.

(Sub)monoids seem to be quite poorly implemented. Not only a method for generating all submonoids is missing, their elements can hardly be compared. For example:

M = FiniteSetMaps([1, 2, 3])
e = M.one()
M1 = M.subsemigroup([M[0],M[1]], one=e, category=Monoids().Finite().Subobjects())
M2 = M.subsemigroup([M[1],M[0]], one=e, category=Monoids().Finite().Subobjects())

Here we create two submonoids with the same generators (given in different order). However, while both M1[0] and M2[0] are essentially e, comparisons like M1[0] == M2[0] and M2(M1[0]) == M2[0] give False. I was able to detect their equality only via conversion to strings.


So, unless there is a better alternative, here is a code that goes over all subsets of elements of M, creates submonoids generated by them, and stores them as set sets of strings (for comparison purposes).

M = FiniteSetMaps([1, 2, 3])
e = M.one()
result = set()
for S in Subsets( set(M.list()) - {e} ):
    submonoid = M.subsemigroup(S, one=e, category=Monoids().Finite().Subobjects())
    submonoid_set = frozenset( map(str, submonoid.list()) )       # as a frozen set
    if submonoid_set not in result:
        result.add( submonoid_set )
        print( submonoid.list() )          # print each newly seen submonoid

Notice that it may take a few hours/days to complete executions. However, getting 699 submonoids takes just a couple of minutes. If that's the number, you can break execution after reaching it.

(Sub)monoids seem to be quite poorly implemented. Not only a method for generating all submonoids is missing, their elements can hardly be compared. For example:

M = FiniteSetMaps([1, 2, 3])
e = M.one()
M1 = M.subsemigroup([M[0],M[1]], one=e, category=Monoids().Finite().Subobjects())
M2 = M.subsemigroup([M[1],M[0]], one=e, category=Monoids().Finite().Subobjects())

Here we create two submonoids with the same generators (given in different order). However, while both M1[0] and M2[0] are essentially e, comparisons like M1[0] == M2[0] and M2(M1[0]) == M2[0] give False. I was able to detect their equality only via conversion to strings.


So, unless there is a better alternative, here is a code that goes over all subsets of elements of M, creates submonoids generated by them, and stores them as sets of strings (for comparison purposes).

M = FiniteSetMaps([1, 2, 3])
e = M.one()
result = set()
for S in Subsets( set(M.list()) - {e} ):
    submonoid = M.subsemigroup(S, one=e, category=Monoids().Finite().Subobjects())
    submonoid_set = frozenset( map(str, submonoid.list()) )       # as a frozen set
    if submonoid_set not in result:
        result.add( submonoid_set )
        print( print(len(result),':\t', submonoid.list() )          # print each newly seen submonoid

Notice that it may take a few hours/days to complete executions. However, getting 699 submonoids takes just a couple of minutes. If that's the number, you can break execution after reaching it.

(Sub)monoids seem to be quite poorly implemented. Not only a method for generating all submonoids is missing, their elements can hardly be compared. For example:

M = FiniteSetMaps([1, 2, 3])
e = M.one()
M1 = M.subsemigroup([M[0],M[1]], one=e, category=Monoids().Finite().Subobjects())
M2 = M.subsemigroup([M[1],M[0]], one=e, category=Monoids().Finite().Subobjects())

Here we create two submonoids with the same generators (given in different order). However, while both M1[0] and M2[0] are essentially e, comparisons like M1[0] == M2[0] and M2(M1[0]) == M2[0] give False. I was able to detect their equality only via conversion to strings.


So, unless there is a better alternative, here is a code that goes over all subsets of elements of M, creates submonoids generated by them, and stores them as sets of strings (for comparison purposes).

M = FiniteSetMaps([1, 2, 3])
e = M.one()
result = set()
for S in Subsets( set(M.list()) - {e} ):
    submonoid = M.subsemigroup(S, one=e, category=Monoids().Finite().Subobjects())
    submonoid_set = frozenset( map(str, submonoid.list()) )       # as a frozen set
    if submonoid_set not in result:
        result.add( submonoid_set )
        print(len(result),':\t', submonoid.list() )   # print each newly seen submonoid

Notice that it may take a few hours/days to complete executions. However, getting 699 submonoids takes just a couple of minutes. If that's the number, you can break execution after reaching it.