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

Broken IsTrivial for empty semigroups #459

Closed
fingolfin opened this issue Feb 16, 2018 · 6 comments
Closed

Broken IsTrivial for empty semigroups #459

fingolfin opened this issue Feb 16, 2018 · 6 comments
Labels
bug Label for issues or PR which report or fix bugs

Comments

@fingolfin
Copy link
Contributor

Without semigroups loaded:

gap> M0:=Magma(FamilyObj([1]), []);
<commutative semigroup with 0 generators>
gap> IsTrivial(M0);
false
gap> Size(M0);
0

But with semigroups loaded, I get an error due to the last line of this method provided by semigroups:

InstallMethod(IsTrivial, "for a semigroup with generators",
[IsSemigroup and HasGeneratorsOfSemigroup],
function(S)
  local gens;

  if not IsFinite(S) then
    return false;
  fi;
  gens := GeneratorsOfSemigroup(S);
  return IsIdempotent(gens[1]) and ForAll(gens, x -> gens[1] = x);
end);

I guess a simple fix would be to add Length(gens) > 0 and to the condition in the return. And I assume a test case should be added, too?

@fingolfin fingolfin added the bug Label for issues or PR which report or fix bugs label Feb 16, 2018
@james-d-mitchell
Copy link
Collaborator

@fingolfin thanks for the report, the empty semigroup rears its head again! Happy with your proposed fix, also will be happy to implement this if you don't have time

@fingolfin
Copy link
Contributor Author

I would appreciate if you could take care of it. I am never sure which branche(s) I should target with fixes. Also, not sure where you'd like to have a test case.

BTW, we noticed this because it broke a new test case in GAP master.

@olexandr-konovalov
Copy link
Contributor

The broken test can be seen on travis here: https://travis-ci.org/gap-system/gap-docker-master-testsuite/builds/342310829 (that's a travis cron build which now performs testinstall/standard/bugfix with three combinations of packages: none, default and all loaded.

@james-d-mitchell
Copy link
Collaborator

Fixing it now, and, of course, happy to do so.

For the record @fingolfin I think we are using the same branch structure as GAP itself, bug fixes go into stable-3.0 (at present) and new features into master, and for every file in the semigroups/gap directory and its subdirectories there is a test file in tst/standard/ which contains tests for that file.

@james-d-mitchell
Copy link
Collaborator

This is resolved by PR #460.

@fingolfin
Copy link
Contributor Author

Thanks @james-d-mitchell . But for the record, this is not how GAP works: We do all work on the master branch, and then cherry-pick selected fixes to the stable-4.9 branch (for a few weeks, we did it differently, but that was mostly an exception for a few bigger changes we still wanted to get into GAP 4.9).

Also, you have two (semi-)active stable branches, 2.8 and 3.0 (or at least you had -- but perhaps now 2.8 is closed), which added to my uncertainty -- i.e. did not know into which subset of 2.8, 3.0, master you want this fix. So I thought it'd save everybody time to just mention the issue and leave it to you guys to know where you want this :-).

Anyway, I'll submit PRs again in the future, too, and if I select the wrong branch, I am sure you'll guys will let me know and I can then simply rebase :-).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Label for issues or PR which report or fix bugs
Projects
None yet
Development

No branches or pull requests

3 participants