Skip to content

Commit 5aaea7a

Browse files
committed
Improve bicoset code
- add `bicoset` to the reference manual index - clarify documentation for `IsBiCoset` ("for example" -> "if and only if") - improve `IsBiCoset` by replacing `r*x/r` with `x^r` - improve multiplication of right cosets to only transfer knowledge about whether this is a bicoset if this was already known for the right operand, instead of unconditionally computing it; but also transfer if it is not (a bicoset times a non-bicoset is not a bicoset) - replace `TryNextMethod` in multiplication method for right cosets with helpful error message, just like we do in the inversion method - improve error message when inverting a right coset which is not a bicoset - add a test that ensures we indeed produce an error when multiplying or inverting right cosets for which these operations are not defined
1 parent 786fe9e commit 5aaea7a

3 files changed

Lines changed: 35 additions & 8 deletions

File tree

lib/csetgrp.gd

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -329,9 +329,11 @@ DeclareCategory("IsRightCoset", IsDomain and IsExternalOrbit and
329329
## <Prop Name="IsBiCoset" Arg='C'/>
330330
##
331331
## <Description>
332-
## A (right) coset is considered a <E>bicoset</E> if its set of elements simultaneously forms a left
333-
## coset for the same subgroup. This is the case, for example, if the coset representative normalizes
334-
## the subgroup.
332+
## <Index>bicoset</Index>
333+
## A (right) coset <M>Ug</M> is considered a <E>bicoset</E> if its set of
334+
## elements simultaneously forms a left coset for the same subgroup. This is
335+
## the case if and only if the coset representative <M>g</M> normalizes the
336+
## subgroup <M>U</M>.
335337
## </Description>
336338
## </ManSection>
337339
## <#/GAPDoc>

lib/csetgrp.gi

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -634,7 +634,7 @@ function(c)
634634
local s,r;
635635
s:=ActingDomain(c);
636636
r:=Representative(c);
637-
return ForAll(GeneratorsOfGroup(s),x->r*x/r in s);
637+
return ForAll(GeneratorsOfGroup(s),x->x^r in s);
638638
end);
639639

640640
InstallMethodWithRandomSource(Random,
@@ -667,11 +667,11 @@ function(a,b)
667667
local c;
668668
if ActingDomain(a)<>ActingDomain(b) then TryNextMethod();fi;
669669
if not IsBiCoset(a) then # product does not require b to be bicoset
670-
TryNextMethod();
670+
ErrorNoReturn("right cosets can only be multiplied if the left operand is a bicoset");
671671
fi;
672672
c:=RightCoset(ActingDomain(a), Representative(a) * Representative(b) );
673-
if IsBiCoset(b) then
674-
SetIsBiCoset(c,true);
673+
if HasIsBiCoset(b) then
674+
SetIsBiCoset(c,IsBiCoset(b));
675675
fi;
676676

677677
return c;
@@ -684,7 +684,7 @@ local s,r;
684684
s:=ActingDomain(a);
685685
r:=Representative(a);
686686
if not IsBiCoset(a) then
687-
Error("Inversion only works for cosets of normal subgroups");
687+
ErrorNoReturn("only right cosets which are bicosets can be inverted");
688688
fi;
689689
r:=RightCoset(s,Inverse(r));
690690
SetIsBiCoset(r,true);
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# We used to allow multiplying and inverting right cosets for which this
2+
# was not valid. This test verifies this is not the case anymore.
3+
# See <https://github.com/gap-system/gap/issues/2555>
4+
gap> G := SymmetricGroup(3);;
5+
gap> U := Group( (1,2) );;
6+
gap> cos1 := RightCoset(U, (1,2));;
7+
gap> cos2 := RightCoset(U, (1,3));;
8+
gap> IsBiCoset(cos1);
9+
true
10+
gap> IsBiCoset(cos2);
11+
false
12+
13+
#
14+
gap> cos1*cos1 = cos1;
15+
true
16+
gap> cos1*cos2 = cos2;
17+
true
18+
gap> cos2*cos1;
19+
Error, right cosets can only be multiplied if the left operand is a bicoset
20+
21+
#
22+
gap> cos1^-1 = cos1;
23+
true
24+
gap> cos2^-1;
25+
Error, only right cosets which are bicosets can be inverted

0 commit comments

Comments
 (0)