Skip to content

Commit

Permalink
congpairs: fix for non-trivial classes
Browse files Browse the repository at this point in the history
  • Loading branch information
james-d-mitchell committed Jun 15, 2020
1 parent d8ddceb commit e5cd086
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
5 changes: 5 additions & 0 deletions gap/congruences/congpairs.gi
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ function(cong)
S := Range(cong);
gens := GeneratorsOfSemigroup(S);
words_part := CONG_PAIRS_NONTRIVIAL_CLASSES(cong);
if words_part = fail then
# libsemigroups can't compute the non-trivial classes, and threw an
# exception.
return List(Filtered(EquivalenceClasses(cong), x -> Size(x) > 1), AsList);
fi;
return List(words_part, c -> List(c, w -> Product(w, i -> gens[i])));
end);

Expand Down
6 changes: 6 additions & 0 deletions src/congpairs.cc
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,12 @@ gap_list_t CONG_PAIRS_NONTRIVIAL_CLASSES(Obj self, gap_cong_t o) {
initRNams();
Congruence* cong = cong_obj_get_cpp(o);

try {
cong->nr_non_trivial_classes();
} catch (libsemigroups::LibsemigroupsException& e) {
return Fail;
}

// Initialise gap_lists
gap_list_t gap_lists
= NEW_PLIST_IMM(T_PLIST_TAB, cong->nr_non_trivial_classes());
Expand Down
6 changes: 6 additions & 0 deletions tst/testinstall.tst
Original file line number Diff line number Diff line change
Expand Up @@ -1747,6 +1747,12 @@ false
gap> IsUniversalSemigroupCongruence(cong);
false

# Issues 676-677
gap> S := FreeBand(2);;
gap> cong := SemigroupCongruence(S, []);;
gap> NonTrivialCongruenceClasses(cong);
[ ]

# SEMIGROUPS_UnbindVariables
gap> Unbind(B);
gap> Unbind(D);
Expand Down

0 comments on commit e5cd086

Please sign in to comment.