Skip to content
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

Support 0-generator FreeMagma and FreeSemigroup? #4424

Closed
wilfwilson opened this issue Apr 21, 2021 · 3 comments
Closed

Support 0-generator FreeMagma and FreeSemigroup? #4424

wilfwilson opened this issue Apr 21, 2021 · 3 comments
Labels
kind: enhancement Label for issues suggesting enhancements; and for pull requests implementing enhancements

Comments

@wilfwilson
Copy link
Member

This comes from @markuspf in #1385:

Though it is documented that the rank has to be positive, but why should there not be a FreeSemigroup(0) (which would be empty)?

This may or may not be a good idea. Possibly we also want 0-generator FreeMonoid and FreeMagmaWithOne (which would be trivial).

@wilfwilson wilfwilson added the kind: enhancement Label for issues suggesting enhancements; and for pull requests implementing enhancements label Apr 21, 2021
@fingolfin
Copy link
Member

I am neutral on this. But the work invested in making this possible should be proportional to how useful this is; if this is just there out of completeness, clearly it's far less pressing; OTOH if somebody could really simplify their code if they had this... But to me, it seems somewhat esoteric?

I am also slightly wary whether such an empty collection might break other parts of the code which do not expect such things. Of course that code then could also be fixed; so what I am really wary about is that the amount of work needed to make this happen might spiral out of control.

That said, I have no fundamental objections at all, so if someone wants to make this happen, you are most welcome :-).

@ThomasBreuer
Copy link
Contributor

I think supporting empty domains is asking for trouble. (For example, sooner or later people will ask for maps and morphisms between them, etc., and already the question when two such maps are equal might be challenging in GAP.)

The documentation of IsMagma and IsSemigroup does not forbid empty magmas and semigroups, and Subsemigroup( SymmetricGroup( 3 ), [] ) is printed as <empty semigroup>; thus there is some support for empty domains.
On the other hand, Semigroup( [] ) and MagmaByMultiplicationTable( [] ) run into errors.

Perhaps the term "0-generator objects" mentioned in issue #1385 is misleading, empty lists of generators should be supported if the domains themselves are not empty; for example the trivial subgroup of a group usually has an empty list of generators, and tests for this situation are important; but this is a different issue.

@wilfwilson
Copy link
Member Author

I've thought about this on-and-off recently, and I have settled on thinking that we should not support FreeMagma(0) and FreeSemigroup(0). Although empty magmas and semigroups are mathematically defined, and possible to construct in GAP as @ThomasBreuer demonstrates, I have never seen 'empty free magmas/semigroups' being talked about as 'free' objects. Until/unless someone comes up with a use case for FreeMagma(0) and FreeSemigroup(0) (which I don't foresee), then I think we should not proactively add such support.

Therefore I will close this issue.

Note that FreeMagma(0) and FreeSemigroup(0) are now rejected in a consistent way:

gap> FreeMonoid(0);
<free monoid of rank zero>
gap> FreeGroup(0);
<free group of rank zero>
gap> FreeMagmaWithOne(0);
<free group of rank zero>
gap> FreeSemigroup(0);
#I  FreeSemigroup cannot make an object with no generators
Error, usage: FreeSemigroup( [<wfilt>, ]<rank>[, <name>] )
              FreeSemigroup( [<wfilt>, ]<name1>[, <name2>[, ...]] )
              FreeSemigroup( [<wfilt>, ]<names> )
              FreeSemigroup( [<wfilt>, ]infinity[, <name>][, <init>] ) at /Users/Wilf/gap/lib/mgmfree.gi:441 called from
FreeXArgumentProcessor( "FreeSemigroup", "s", arg, true, false
 ) at /Users/Wilf/gap/lib/smgrpfre.gi:391 called from
<function "FreeSemigroup">( <arguments> )
 called from read-eval loop at *stdin*:4
type 'quit;' to quit to outer loop
gap> FreeMagma(0);
#I  FreeMagma cannot make an object with no generators
Error, usage: FreeMagma( <rank>[, <name>] )
              FreeMagma( <name1>[, <name2>[, ...]] )
              FreeMagma( <names> )
              FreeMagma( infinity[, <name>][, <init>] ) at /Users/Wilf/gap/lib/mgmfree.gi:441 called from
FreeXArgumentProcessor( "FreeMagma", "x", arg, false, false
 ) at /Users/Wilf/gap/lib/mgmfree.gi:481 called from
<function "FreeMagma">( <arguments> )
 called from read-eval loop at *stdin*:4
type 'quit;' to quit to outer loop

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: enhancement Label for issues suggesting enhancements; and for pull requests implementing enhancements
Projects
None yet
Development

No branches or pull requests

3 participants