New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement LeftSemigroupIdeal and RightSemigroupIdeal #1009
Open
Jun2M
wants to merge
33
commits into
semigroups:main
Choose a base branch
from
Jun2M:main
base: main
Could not load branches
Branch not found: {{ refName }}
Could not load tags
Nothing to show
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 25 commits
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
335f388
Adding Free Semilattice constructor
Jun2M 5fb0319
For Transformation and PartialPerm Semigroups
Jun2M 4685a06
Lint
Jun2M 721a464
Update semicons.gd
Jun2M c4f56d9
Merge branch 'main' into main
Jun2M 1ec0a1a
Add docs and a whole lot of tests
Jun2M f35961a
Minor test fix
Jun2M 9ae4fd9
Merge branch 'main' into main
Jun2M 432322b
Dial back on the number of tests
Jun2M 708e4c1
Merge branch 'main' into main
james-d-mitchell 917be05
Apply suggestions from code review
james-d-mitchell 7977c3b
Change tst to reflect the new error msg
Jun2M f7338a2
Merge branch 'main' into main
Jun2M b2463bb
Add Monoid constructors to FreeSemilatticeCons
Jun2M 19266ad
Unbind _IsXMonoid in semicons.gi
Jun2M 58013b4
Update semicons.xml and semicons.gi files
Jun2M 0b2d4d4
Merge branch 'semigroups:main' into main
Jun2M cfda100
Add left and right semigroup ideal support
Jun2M df1cc98
Edit docs
Jun2M 0880917
Don't destroy the whole thing
Jun2M 61ac68f
bug fix
Jun2M 4f1200b
Fix ideals.gd
Jun2M eb93dfc
doc update
Jun2M 4aefac6
Linting
Jun2M 1140492
Factor out the input parsing
Jun2M abdf215
Hide internal functions and make first edits on ideal.tst
Jun2M eb4bc56
Appearently not a duplicate
Jun2M 6e76d9b
Linting
Jun2M c74ebcd
Linting for tst file
Jun2M a538cc8
Linting for tst
Jun2M 0a39a7c
More tests
Jun2M 97eb398
Linting
Jun2M 2f825bd
Lint
Jun2M File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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
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 |
---|---|---|
|
@@ -187,81 +187,121 @@ InstallMethod(Representative, "for a semigroup ideal", | |
|
||
# a convenience, similar to the functions <Semigroup>, <Monoid>, etc | ||
|
||
InstallGlobalFunction(SemigroupIdeal, | ||
function(arg...) | ||
InstallGlobalFunction(AnySemigroupIdealInputParsing, | ||
function(inputArgs) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Might be better to stick to
this is like doing
in python |
||
local out, i; | ||
|
||
if Length(arg) <= 1 then | ||
if Length(inputArgs) <= 1 then | ||
ErrorNoReturn("there must be 2 or more arguments"); | ||
elif not IsSemigroup(arg[1]) then | ||
elif not IsSemigroup(inputArgs[1]) then | ||
ErrorNoReturn("the 1st argument is not a semigroup"); | ||
elif Length(arg) = 2 and IsMatrix(arg[2]) then | ||
elif Length(inputArgs) = 2 and IsMatrix(inputArgs[2]) then | ||
# special case for matrices, because they may look like lists | ||
return SemigroupIdealByGenerators(arg[1], [arg[2]]); | ||
return [inputArgs[1], [inputArgs[2]]]; | ||
|
||
elif Length(arg) = 2 and IsList(arg[2]) and 0 < Length(arg[2]) then | ||
elif Length(inputArgs) = 2 and IsList(inputArgs[2]) and 0 < Length(inputArgs[2]) then | ||
# list of generators | ||
return SemigroupIdealByGenerators(arg[1], arg[2]); | ||
elif (IsMultiplicativeElement(arg[2]) | ||
and IsGeneratorsOfSemigroup([arg[2]])) | ||
or (IsListOrCollection(arg[2]) | ||
and IsGeneratorsOfSemigroup(arg[2])) | ||
or (HasIsEmpty(arg[2]) and IsEmpty(arg[2])) then | ||
return [inputArgs[1], inputArgs[2]]; | ||
elif (IsMultiplicativeElement(inputArgs[2]) | ||
and IsGeneratorsOfSemigroup([inputArgs[2]])) | ||
or (IsListOrCollection(inputArgs[2]) | ||
and IsGeneratorsOfSemigroup(inputArgs[2])) | ||
or (HasIsEmpty(inputArgs[2]) and IsEmpty(inputArgs[2])) then | ||
# generators and collections of generators | ||
out := []; | ||
for i in [2 .. Length(arg)] do | ||
for i in [2 .. Length(inputArgs)] do | ||
# so that we can pass the options record | ||
if i = Length(arg) and IsRecord(arg[i]) then | ||
return SemigroupIdealByGenerators(arg[1], out, arg[i]); | ||
elif IsMultiplicativeElement(arg[i]) and | ||
IsGeneratorsOfSemigroup([arg[i]]) then | ||
Add(out, arg[i]); | ||
elif IsGeneratorsOfSemigroup(arg[i]) then | ||
if HasGeneratorsOfSemigroupIdeal(arg[i]) then | ||
Append(out, GeneratorsOfSemigroupIdeal(arg[i])); | ||
elif HasGeneratorsOfSemigroup(arg[i]) then | ||
Append(out, GeneratorsOfSemigroup(arg[i])); | ||
elif IsList(arg[i]) then | ||
Append(out, arg[i]); | ||
if i = Length(inputArgs) and IsRecord(inputArgs[i]) then | ||
return [inputArgs[1], out, inputArgs[i]]; | ||
elif IsMultiplicativeElement(inputArgs[i]) and | ||
IsGeneratorsOfSemigroup([inputArgs[i]]) then | ||
Add(out, inputArgs[i]); | ||
elif IsGeneratorsOfSemigroup(inputArgs[i]) then | ||
if HasGeneratorsOfSemigroupIdeal(inputArgs[i]) then | ||
Append(out, GeneratorsOfSemigroupIdeal(inputArgs[i])); | ||
elif HasGeneratorsOfSemigroup(inputArgs[i]) then | ||
Append(out, GeneratorsOfSemigroup(inputArgs[i])); | ||
elif IsList(inputArgs[i]) then | ||
Append(out, inputArgs[i]); | ||
else | ||
Append(out, AsList(arg[i])); | ||
Append(out, AsList(inputArgs[i])); | ||
fi; | ||
else | ||
ErrorNoReturn("the 2nd argument is not a combination ", | ||
"of generators, lists of generators, ", | ||
"nor semigroups"); | ||
fi; | ||
od; | ||
return SemigroupIdealByGenerators(arg[1], out); | ||
return [inputArgs[1], out]; | ||
fi; | ||
ErrorNoReturn("invalid arguments"); | ||
end); | ||
|
||
InstallMethod(SemigroupIdealByGenerators, | ||
"for a semigroup and list or collections", | ||
[IsSemigroup, IsListOrCollection], | ||
{S, gens} -> SemigroupIdealByGenerators(S, gens, SEMIGROUPS.OptionsRec(S))); | ||
InstallGlobalFunction(SemigroupIdeal, | ||
function(arg...) | ||
local parsed; | ||
parsed := AnySemigroupIdealInputParsing(arg); | ||
if Length(parsed) = 3 then | ||
return AnySemigroupIdealByGenerators(parsed[1], | ||
IsMagmaIdeal, parsed[2], parsed[3]); | ||
else | ||
return AnySemigroupIdealByGenerators(parsed[1], | ||
IsMagmaIdeal, parsed[2]); | ||
fi; | ||
end); | ||
|
||
InstallMethod(SemigroupIdealByGenerators, | ||
"for semigroup, list or collection, and record", | ||
[IsSemigroup, IsListOrCollection, IsRecord], | ||
function(S, gens, opts) | ||
InstallGlobalFunction(LeftSemigroupIdeal, | ||
function(arg...) | ||
local parsed; | ||
parsed := AnySemigroupIdealInputParsing(arg); | ||
if Length(parsed) = 3 then | ||
return AnySemigroupIdealByGenerators(parsed[1], | ||
IsLeftMagmaIdeal, parsed[2], parsed[3]); | ||
else | ||
return AnySemigroupIdealByGenerators(parsed[1], | ||
IsLeftMagmaIdeal, parsed[2]); | ||
fi; | ||
end); | ||
|
||
InstallGlobalFunction(RightSemigroupIdeal, | ||
function(arg...) | ||
local parsed; | ||
parsed := AnySemigroupIdealInputParsing(arg); | ||
if Length(parsed) = 3 then | ||
return AnySemigroupIdealByGenerators(parsed[1], | ||
IsRightMagmaIdeal, parsed[2], parsed[3]); | ||
else | ||
return AnySemigroupIdealByGenerators(parsed[1], | ||
IsRightMagmaIdeal, parsed[2]); | ||
fi; | ||
end); | ||
|
||
InstallMethod(AnySemigroupIdealByGenerators, | ||
"for a semigroup, filter and list or collections", | ||
[IsSemigroup, IsOperation, IsListOrCollection], | ||
{S, filter, gens} -> AnySemigroupIdealByGenerators(S, | ||
filter, gens, SEMIGROUPS.OptionsRec(S))); | ||
|
||
InstallMethod(AnySemigroupIdealByGenerators, | ||
"for semigroup, filter, list or collection, and record", | ||
[IsSemigroup, IsOperation, IsListOrCollection, IsRecord], | ||
function(S, filter, gens, opts) | ||
if not ForAll(gens, x -> x in S) then | ||
ErrorNoReturn("the 2nd argument (a mult. elt. coll.) do not all ", | ||
"belong to the semigroup"); | ||
fi; | ||
return SemigroupIdealByGeneratorsNC(S, gens, opts); | ||
return AnySemigroupIdealByGeneratorsNC(S, filter, gens, opts); | ||
end); | ||
|
||
InstallMethod(SemigroupIdealByGeneratorsNC, | ||
"for a semigroup, list or collections, and record", | ||
[IsSemigroup, IsListOrCollection, IsRecord], | ||
function(S, gens, opts) | ||
InstallMethod(AnySemigroupIdealByGeneratorsNC, | ||
"for a semigroup, filter, (list or collections) and record", | ||
[IsSemigroup, IsOperation, IsListOrCollection, IsRecord], | ||
function(S, filter, gens, opts) | ||
local filts, I; | ||
opts := SEMIGROUPS.ProcessOptionsRec(SEMIGROUPS.DefaultOptionsRec, opts); | ||
gens := AsList(gens); | ||
|
||
filts := IsMagmaIdeal and IsAttributeStoringRep; | ||
filts := filter and IsAttributeStoringRep; | ||
|
||
if opts.acting | ||
and (IsActingSemigroup(S) or IsGeneratorsOfActingSemigroup(gens)) then | ||
|
@@ -313,7 +353,16 @@ function(S, gens, opts) | |
fi; | ||
|
||
SetParent(I, S); | ||
SetGeneratorsOfMagmaIdeal(I, gens); | ||
if "IsLeftActedOnBySuperset" in NamesFilter(filter) and | ||
"IsRightActedOnBySuperset" in NamesFilter(filter) then | ||
SetGeneratorsOfMagmaIdeal(I, gens); | ||
elif "IsLeftActedOnBySuperset" in NamesFilter(filter) then | ||
SetGeneratorsOfLeftMagmaIdeal(I, gens); | ||
elif "IsRightActedOnBySuperset" in NamesFilter(filter) then | ||
SetGeneratorsOfRightMagmaIdeal(I, gens); | ||
else | ||
# PANIC | ||
fi; | ||
|
||
if not IsActingSemigroup(I) then | ||
# to keep the craziness in the library happy! | ||
|
@@ -328,6 +377,25 @@ function(S, gens, opts) | |
return I; | ||
end); | ||
|
||
InstallMethod(SemigroupIdealByGenerators, | ||
"for a semigroup and list or collections", | ||
[IsSemigroup, IsListOrCollection], | ||
{S, gens} -> SemigroupIdealByGenerators(S, gens, SEMIGROUPS.OptionsRec(S))); | ||
|
||
InstallMethod(SemigroupIdealByGenerators, | ||
"for semigroup, list or collection, and record", | ||
[IsSemigroup, IsListOrCollection, IsRecord], | ||
function(S, gens, opts) | ||
return AnySemigroupIdealByGenerators(S, IsMagmaIdeal, gens, opts); | ||
end); | ||
|
||
InstallMethod(SemigroupIdealByGeneratorsNC, | ||
"for a semigroup, list or collections, and record", | ||
[IsSemigroup, IsListOrCollection, IsRecord], | ||
function(S, gens, opts) | ||
return AnySemigroupIdealByGeneratorsNC(S, IsMagmaIdeal, gens, opts); | ||
end); | ||
|
||
InstallMethod(MinimalIdealGeneratingSet, | ||
"for a semigroup ideal with generators", | ||
[IsSemigroupIdeal and HasGeneratorsOfSemigroupIdeal], | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd suggest removing this from here, and instead doing
in the
.gi
file instead. Note also the_
in the name (either do this or just put the function into the recordSEMIGROUPS
, by doing:again in the
.gi
file. Same goes for all of the "internal" functions that start with "Any"