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

FreeMagma has unhelpful error messages, inconsistent argument checks, and can create incorrect 0-generator objects #1385

Closed
markuspf opened this issue Jun 5, 2017 · 1 comment · Fixed by #4475
Labels
kind: bug: unexpected error Issues describing bugs in which computation unexpectedly encounters an error, and PRs fixing them kind: bug: wrong result Issues describing bugs that result in mathematically or otherwise wrong results, and PRs fixing them kind: bug Issues describing general bugs, and PRs fixing them topic: library

Comments

@markuspf
Copy link
Member

markuspf commented Jun 5, 2017

First off this is a bug:

gap> FreeSemigroup();
Error, List Element: <list>[1] must have an assigned value in
  if IsFilter( arg[1] )  then
    lesy := arg[1];
    zarg := arg{[ 2 .. Length( arg ) ]};
else
    zarg := arg;
gap> F := FreeSemigroup([]);
<free semigroup on the generators [  ]>
gap> Size(F);
infinity
gap> e := Enumerator(F);
<enumerator of <free semigroup on the generators [  ]>>
gap> e[2];
^2

I would also argue that this is a bug (or at least an extremely unhelpful error message yet again)

gap> FreeMagma(0);
Error, usage: FreeMagma(<name1>,<name2>..),FreeMagma(<rank>) at /home/makx/dev/gap/lib/mgmfree.gi:316 called from
<function "FreeMagma">( <arguments> )
 called from read-eval loop at *stdin*:7
you can 'quit;' to quit to outer loop, or
you can 'return;' to continue
brk>

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

I can fix most of this, just leaving it here for me to remember. (of course I welcome people beating me to it)

@markuspf markuspf self-assigned this Jun 5, 2017
@fingolfin fingolfin added kind: bug Issues describing general bugs, and PRs fixing them kind: bug: wrong result Issues describing bugs that result in mathematically or otherwise wrong results, and PRs fixing them kind: bug: unexpected error Issues describing bugs in which computation unexpectedly encounters an error, and PRs fixing them labels Mar 21, 2019
wilfwilson added a commit to wilfwilson/gap that referenced this issue Apr 8, 2021
See gap-system#1385

It was previously possible to use `FreeSemigroup` to create a
seemingly free semigroup with zero generators (rank zero), but
this object believed itself to be infinite, and to contain elements
(such a semigroup would be empty).

Some other ways that one might want to create free semigroups of
rank zero led to unhelpful error messages, and in general, the
argument checking of `FreeSemigroup` was not very thorough and gave
sometimes unhelpful error messages.

In this commit, I overhaul the way that F`reeSemigroup` checks its
arguments, in particular always disallowing a free semigroup of rank
zero, and overall making the checking more robust, and making the error
messages more descriptive.

This addresses the bugs reporting in issue gap-system#1385, although it does not
address the feature request in that issue to support free semigroups of
rank zero.

I also took the opportunity to fix a typo in the documentation
for `FreeSemigroup`, and to make a clarification. Further improvements
could be made to this documentation, but I leave that to the future.
wilfwilson added a commit to wilfwilson/gap that referenced this issue Apr 8, 2021
See gap-system#1385

It was previously possible to use `FreeSemigroup` to create a
seemingly free semigroup with zero generators (rank zero), but
this object believed itself to be infinite, and to contain elements
(such a semigroup would be empty).

Some other ways that one might want to create free semigroups of
rank zero led to unhelpful error messages, and in general, the
argument checking of `FreeSemigroup` was not very thorough and gave
sometimes unhelpful error messages.

In this commit, I overhaul the way that F`reeSemigroup` checks its
arguments, in particular always disallowing a free semigroup of rank
zero, and overall making the checking more robust, and making the error
messages more descriptive.

This addresses the bugs reporting in issue gap-system#1385, although it does not
address the feature request in that issue to support free semigroups of
rank zero.

I also took the opportunity to fix a typo in the documentation
for `FreeSemigroup`, and to make a clarification. Further improvements
could be made to this documentation, but I leave that to the future.
wilfwilson added a commit to wilfwilson/gap that referenced this issue Apr 8, 2021
See gap-system#1385

It was previously possible to use `FreeSemigroup` to create a
seemingly free semigroup with zero generators (rank zero), but
this object believed itself to be infinite, and to contain elements
(such a semigroup would be empty).

Some other ways that one might want to create free semigroups of
rank zero led to unhelpful error messages, and in general, the
argument checking of `FreeSemigroup` was not very thorough and gave
sometimes unhelpful error messages.

In this commit, I overhaul the way that F`reeSemigroup` checks its
arguments, in particular always disallowing a free semigroup of rank
zero, and overall making the checking more robust, and making the error
messages more descriptive.

This addresses the bugs reporting in issue gap-system#1385, although it does not
address the feature request in that issue to support free semigroups of
rank zero.

I also took the opportunity to fix a typo in the documentation
for `FreeSemigroup`, and to make a clarification. Further improvements
could be made to this documentation, but I leave that to the future.
wilfwilson added a commit to wilfwilson/gap that referenced this issue Apr 8, 2021
See gap-system#1385

It was previously possible to use `FreeSemigroup` to create a
seemingly free semigroup with zero generators (rank zero), but
this object believed itself to be infinite, and to contain elements
(such a semigroup would be empty). Note that free semigroups of rank
zero are not documented as being supported.

Some other ways that one might want to create free semigroups of
rank zero led to unhelpful error messages, and in general, the
argument checking of `FreeSemigroup` was not very thorough and gave
sometimes unhelpful error messages.

In this commit, I overhaul the way that `freeSemigroup` checks its
arguments, in particular always disallowing a free semigroup of rank
zero, and overall making the checking more robust, and making the error
messages more descriptive.

This addresses the _bugs_ reported in issue gap-system#1385, although it does not
address the _feature request_ in that issue to support free semigroups of
rank zero.

I also took the opportunity to fix a typo in the documentation
for `FreeSemigroup`, and to make a clarification. Further improvements
could be made to this documentation, but I leave that to the future.
wilfwilson added a commit to wilfwilson/gap that referenced this issue Apr 8, 2021
See gap-system#1385

It was previously possible to use `FreeSemigroup` to create a
seemingly free semigroup with zero generators (rank zero), but
this object believed itself to be infinite, and to contain elements
(such a semigroup would be empty). Note that free semigroups of rank
zero are not documented as being supported.

Some other ways that one might want to create free semigroups of
rank zero led to unhelpful error messages, and in general, the
argument checking of `FreeSemigroup` was not very thorough and gave
sometimes unhelpful error messages.

In this commit, I overhaul the way that `FreeSemigroup` checks its
arguments, in particular always disallowing a free semigroup of rank
zero, and overall making the checking more robust, and making the error
messages more descriptive.

This addresses the _bugs_ reported in issue gap-system#1385, although it does not
address the _feature request_ in that issue to support free semigroups of
rank zero.

I also took the opportunity to fix a typo in the documentation
for `FreeSemigroup`, and to make a clarification. Further improvements
could be made to this documentation, but I leave that to the future.
wilfwilson added a commit to wilfwilson/gap that referenced this issue Apr 8, 2021
See gap-system#1385

It was previously possible to use `FreeSemigroup` to create a
seemingly free semigroup with zero generators (rank zero), but
this object believed itself to be infinite, and to contain elements
(such a semigroup would be empty). Note that free semigroups of rank
zero are not documented as being supported.

Some other ways that one might want to create free semigroups of
rank zero led to unhelpful error messages, and in general, the
argument checking of `FreeSemigroup` was not very thorough and gave
sometimes unhelpful error messages.

In this commit, I overhaul the way that `FreeSemigroup` checks its
arguments, in particular always disallowing a free semigroup of rank
zero, and overall making the checking more robust, and making the error
messages more descriptive.

This addresses the _bugs_ reported in issue gap-system#1385, although it does not
address the _feature request_ in that issue to support free semigroups of
rank zero.

I also took the opportunity to fix a typo in the documentation
for `FreeSemigroup`, and to make a clarification. Further improvements
could be made to this documentation, but I leave that to the future.
wilfwilson added a commit to wilfwilson/gap that referenced this issue Apr 8, 2021
See gap-system#1385

It was previously possible to use `FreeSemigroup` to create a
seemingly free semigroup with zero generators (rank zero), but
this object believed itself to be infinite, and to contain elements
(such a semigroup would be empty). Note that free semigroups of rank
zero are not documented as being supported.

Some other ways that one might want to create free semigroups of
rank zero led to unhelpful error messages, and in general, the
argument checking of `FreeSemigroup` was not very thorough and gave
sometimes unhelpful error messages.

In this commit, I overhaul the way that `FreeSemigroup` checks its
arguments, in particular always disallowing a free semigroup of rank
zero, and overall making the checking more robust, and making the error
messages more descriptive.

This addresses the _bugs_ reported in issue gap-system#1385, although it does not
address the _feature request_ in that issue to support free semigroups of
rank zero.

I also took the opportunity to fix a typo in the documentation
for `FreeSemigroup`, and to make a clarification. Further improvements
could be made to this documentation, but I leave that to the future.
wilfwilson added a commit to wilfwilson/gap that referenced this issue Apr 8, 2021
See gap-system#1385

It was previously possible to use `FreeSemigroup` to create a
seemingly free semigroup with zero generators (rank zero), but
this object believed itself to be infinite, and to contain elements
(such a semigroup would be empty). Note that free semigroups of rank
zero are not documented as being supported.

Some other ways that one might want to create free semigroups of
rank zero led to unhelpful error messages, and in general, the
argument checking of `FreeSemigroup` was not very thorough and gave
sometimes unhelpful error messages.

In this commit, I overhaul the way that `FreeSemigroup` checks its
arguments, in particular always disallowing a free semigroup of rank
zero, and overall making the checking more robust, and making the error
messages more descriptive.

This addresses the _bugs_ reported in issue gap-system#1385, although it does not
address the _feature request_ in that issue to support free semigroups of
rank zero.

I also took the opportunity to fix a typo in the documentation
for `FreeSemigroup`, and to make a clarification. Further improvements
could be made to this documentation, but I leave that to the future.
wilfwilson added a commit to wilfwilson/gap that referenced this issue Apr 8, 2021
See gap-system#1385

It was previously possible to use `FreeSemigroup` to create a
seemingly free semigroup with zero generators (rank zero), but
this object believed itself to be infinite, and to contain elements
(such a semigroup would be empty). Note that free semigroups of rank
zero are not documented as being supported.

Some other ways that one might want to create free semigroups of
rank zero led to unhelpful error messages, and in general, the
argument checking of `FreeSemigroup` was not very thorough and gave
sometimes unhelpful error messages.

In this commit, I overhaul the way that `FreeSemigroup` checks its
arguments, in particular always disallowing a free semigroup of rank
zero, and overall making the checking more robust, and making the error
messages more descriptive.

This addresses the _bugs_ reported in issue gap-system#1385, although it does not
address the _feature request_ in that issue to support free semigroups of
rank zero.

I also took the opportunity to fix a typo in the documentation
for `FreeSemigroup`, and to make a clarification. Further improvements
could be made to this documentation, but I leave that to the future.
wilfwilson added a commit to wilfwilson/gap that referenced this issue Apr 10, 2021
See gap-system#1385

It was previously possible to use `FreeSemigroup` to create a
seemingly free semigroup with zero generators (rank zero), but
this object believed itself to be infinite, and to contain elements
(such a semigroup would be empty). Note that free semigroups of rank
zero are not documented as being supported.

Some other ways that one might want to create free semigroups of
rank zero led to unhelpful error messages, and in general, the
argument checking of `FreeSemigroup` was not very thorough and gave
sometimes unhelpful error messages.

In this commit, I overhaul the way that `FreeSemigroup` checks its
arguments, in particular always disallowing a free semigroup of rank
zero, and overall making the checking more robust, and making the error
messages more descriptive.

This addresses the _bugs_ reported in issue gap-system#1385, although it does not
address the _feature request_ in that issue to support free semigroups of
rank zero.

I also took the opportunity to fix a typo in the documentation
for `FreeSemigroup`, and to make a clarification. Further improvements
could be made to this documentation, but I leave that to the future.
wilfwilson added a commit to wilfwilson/gap that referenced this issue Apr 10, 2021
See gap-system#1385

It was previously possible to use `FreeSemigroup` to create a
seemingly free semigroup with zero generators (rank zero), but
this object believed itself to be infinite, and to contain elements
(such a semigroup would be empty). Note that free semigroups of rank
zero are not documented as being supported.

Some other ways that one might want to create free semigroups of
rank zero led to unhelpful error messages, and in general, the
argument checking of `FreeSemigroup` was not very thorough and gave
sometimes unhelpful error messages.

In this commit, I overhaul the way that `FreeSemigroup` checks its
arguments, in particular always disallowing a free semigroup of rank
zero, and overall making the checking more robust, and making the error
messages more descriptive.

This addresses the _bugs_ reported in issue gap-system#1385, although it does not
address the _feature request_ in that issue to support free semigroups of
rank zero.

I also took the opportunity to fix a typo in the documentation
for `FreeSemigroup`, and to make a clarification. Further improvements
could be made to this documentation, but I leave that to the future.
wilfwilson added a commit to wilfwilson/gap that referenced this issue Apr 11, 2021
See gap-system#1385

It was previously possible to use `FreeSemigroup` to create a
seemingly free semigroup with zero generators (rank zero), but
this object believed itself to be infinite, and to contain elements
(such a semigroup would be empty). Note that free semigroups of rank
zero are not documented as being supported.

Some other ways that one might want to create free semigroups of
rank zero led to unhelpful error messages, and in general, the
argument checking of `FreeSemigroup` was not very thorough and gave
sometimes unhelpful error messages.

In this commit, I overhaul the way that `FreeSemigroup` checks its
arguments, in particular always disallowing a free semigroup of rank
zero, and overall making the checking more robust, and making the error
messages more descriptive.

This addresses the _bugs_ reported in issue gap-system#1385, although it does not
address the _feature request_ in that issue to support free semigroups of
rank zero.

I also took the opportunity to fix a typo in the documentation
for `FreeSemigroup`, and to make a clarification. Further improvements
could be made to this documentation, but I leave that to the future.
wilfwilson added a commit that referenced this issue Apr 21, 2021
See #1385

It was previously possible to use `FreeSemigroup` to create a
seemingly free semigroup with zero generators (rank zero), but
this object believed itself to be infinite, and to contain elements
(such a semigroup would be empty). Note that free semigroups of rank
zero are not documented as being supported.

Some other ways that one might want to create free semigroups of
rank zero led to unhelpful error messages, and in general, the
argument checking of `FreeSemigroup` was not very thorough and gave
sometimes unhelpful error messages.

In this commit, I overhaul the way that `FreeSemigroup` checks its
arguments, in particular always disallowing a free semigroup of rank
zero, and overall making the checking more robust, and making the error
messages more descriptive.

This addresses the _bugs_ reported in issue #1385, although it does not
address the _feature request_ in that issue to support free semigroups of
rank zero.

I also took the opportunity to fix a typo in the documentation
for `FreeSemigroup`, and to make a clarification. Further improvements
could be made to this documentation, but I leave that to the future.
@wilfwilson wilfwilson changed the title FreeSemigroup and FreeMagma argument checks, unhelpful error messages FreeSemigroup and FreeMagma have unhelpful error messages, inconsistent argument checks, and can create incorrect 0-generator objects Apr 21, 2021
@wilfwilson
Copy link
Member

This has been resolved for FreeSemigroups in #4372.

I will work on a similar fix for FreeMagma (and FreeMonoid and FreeMagmaWithOne, if they have similar problems).

I have added a feature request in #4424 to see about properly supporting these objects with zero generators.

@wilfwilson wilfwilson changed the title FreeSemigroup and FreeMagma have unhelpful error messages, inconsistent argument checks, and can create incorrect 0-generator objects FreeMagma has unhelpful error messages, inconsistent argument checks, and can create incorrect 0-generator objects Apr 22, 2021
wilfwilson added a commit to wilfwilson/gap that referenced this issue Apr 22, 2021
In particular, unify argument processing/error checking in
* FreeSemigroup
* FreeMonoid
* FreeMagma
* FreeMagmaWithOne

Resolves gap-system#1385.
wilfwilson added a commit to wilfwilson/gap that referenced this issue Apr 22, 2021
In particular, unify argument processing/error checking in
* FreeSemigroup
* FreeMonoid
* FreeMagma
* FreeMagmaWithOne

Resolves gap-system#1385.
wilfwilson added a commit to wilfwilson/gap that referenced this issue Apr 22, 2021
In particular, unify argument processing/error checking in
* FreeSemigroup
* FreeMonoid
* FreeMagma
* FreeMagmaWithOne

Resolves gap-system#1385.
wilfwilson added a commit to wilfwilson/gap that referenced this issue May 7, 2021
In particular, unify argument processing/error checking in:
* FreeSemigroup
* FreeMonoid
* FreeMagma
* FreeMagmaWithOne
* FreeGroup

Resolves gap-system#1385.
wilfwilson added a commit to wilfwilson/gap that referenced this issue May 7, 2021
In particular, unify argument processing/error checking in:
* FreeSemigroup
* FreeMonoid
* FreeMagma
* FreeMagmaWithOne
* FreeGroup

Resolves gap-system#1385.
wilfwilson added a commit to wilfwilson/gap that referenced this issue May 10, 2021
In particular, unify argument processing/error checking in:
* FreeSemigroup
* FreeMonoid
* FreeMagma
* FreeMagmaWithOne
* FreeGroup

Resolves gap-system#1385.
wilfwilson added a commit to wilfwilson/gap that referenced this issue May 10, 2021
In particular, unify argument processing/error checking in:
* FreeSemigroup
* FreeMonoid
* FreeMagma
* FreeMagmaWithOne
* FreeGroup

Resolves gap-system#1385.
wilfwilson added a commit to wilfwilson/gap that referenced this issue May 12, 2021
In particular, unify argument processing/error checking in:
* FreeSemigroup
* FreeMonoid
* FreeMagma
* FreeMagmaWithOne
* FreeGroup

Resolves gap-system#1385.
wilfwilson added a commit to wilfwilson/gap that referenced this issue Jun 10, 2021
In particular, unify argument processing/error checking in:
* FreeSemigroup
* FreeMonoid
* FreeMagma
* FreeMagmaWithOne
* FreeGroup

Resolves gap-system#1385.
wilfwilson added a commit to wilfwilson/gap that referenced this issue Jun 11, 2021
In particular, unify argument processing/error checking in:
* FreeSemigroup
* FreeMonoid
* FreeMagma
* FreeMagmaWithOne
* FreeGroup

Resolves gap-system#1385.
wilfwilson added a commit to wilfwilson/gap that referenced this issue Jun 11, 2021
In particular, unify argument processing/error checking in:
* `FreeSemigroup`
* `FreeMonoid`
* `FreeMagma`
* `FreeMagmaWithOne`
* `FreeGroup`

These now use the newly-added function `FreeXArgumentProcessor`.
Their documentation has also been updated, and tests added.

Resolves gap-system#1385.
wilfwilson added a commit to wilfwilson/gap that referenced this issue Jun 11, 2021
In particular, unify argument processing/error checking in:
* `FreeSemigroup`
* `FreeMonoid`
* `FreeMagma`
* `FreeMagmaWithOne`
* `FreeGroup`

These now use the newly-added function `FreeXArgumentProcessor`.
Their documentation has also been updated, and tests added.

Resolves gap-system#1385.
wilfwilson added a commit to wilfwilson/gap that referenced this issue Jun 11, 2021
In particular, unify argument processing/error checking in:
* `FreeSemigroup`
* `FreeMonoid`
* `FreeMagma`
* `FreeMagmaWithOne`
* `FreeGroup`

These now use the newly-added function `FreeXArgumentProcessor`.
Their documentation has also been updated, and tests added.

Resolves gap-system#1385.
wilfwilson added a commit to wilfwilson/gap that referenced this issue Jun 11, 2021
In particular, unify argument processing/error checking in:
* `FreeSemigroup`
* `FreeMonoid`
* `FreeMagma`
* `FreeMagmaWithOne`
* `FreeGroup`

These now use the newly-added function `FreeXArgumentProcessor`.
Their documentation has also been updated, and tests added.

Resolves gap-system#1385.
wilfwilson added a commit to wilfwilson/gap that referenced this issue Jun 11, 2021
In particular, unify argument processing/error checking in:
* `FreeSemigroup`
* `FreeMonoid`
* `FreeMagma`
* `FreeMagmaWithOne`
* `FreeGroup`

These now use the newly-added function `FreeXArgumentProcessor`.
Their documentation has also been updated, and tests added.

Resolves gap-system#1385.
wilfwilson added a commit to wilfwilson/gap that referenced this issue Jun 11, 2021
In particular, unify argument processing/error checking in:
* `FreeSemigroup`
* `FreeMonoid`
* `FreeMagma`
* `FreeMagmaWithOne`
* `FreeGroup`

These now use the newly-added function `FreeXArgumentProcessor`.
Their documentation has also been updated, and tests added.

Resolves gap-system#1385.
wilfwilson added a commit to wilfwilson/gap that referenced this issue Jun 11, 2021
In particular, unify argument processing/error checking in:
* `FreeSemigroup`
* `FreeMonoid`
* `FreeMagma`
* `FreeMagmaWithOne`
* `FreeGroup`

These now use the newly-added function `FreeXArgumentProcessor`.
Their documentation has also been updated, and tests added.

Resolves gap-system#1385.
wilfwilson added a commit to wilfwilson/gap that referenced this issue Jun 15, 2021
In particular, unify argument processing/error checking in:
* `FreeSemigroup`
* `FreeMonoid`
* `FreeMagma`
* `FreeMagmaWithOne`
* `FreeGroup`

These now use the newly-added function `FreeXArgumentProcessor`.
Their documentation has also been updated, and tests added.

Resolves gap-system#1385.
wilfwilson added a commit that referenced this issue Jun 15, 2021
In particular, unify argument processing/error checking in:
* `FreeSemigroup`
* `FreeMonoid`
* `FreeMagma`
* `FreeMagmaWithOne`
* `FreeGroup`

These now use the newly-added function `FreeXArgumentProcessor`.
Their documentation has also been updated, and tests added.

Resolves #1385.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: bug: unexpected error Issues describing bugs in which computation unexpectedly encounters an error, and PRs fixing them kind: bug: wrong result Issues describing bugs that result in mathematically or otherwise wrong results, and PRs fixing them kind: bug Issues describing general bugs, and PRs fixing them topic: library
Projects
None yet
3 participants