Skip to content

Commit

Permalink
NEW: Fp Group GHBI uses new TC.
Browse files Browse the repository at this point in the history
This fixes the previously reported bug.
Close #302
  • Loading branch information
hulpke committed Jul 1, 2016
1 parent 58323dd commit 3728bec
Show file tree
Hide file tree
Showing 2 changed files with 160 additions and 75 deletions.
122 changes: 85 additions & 37 deletions lib/ghomfp.gi
Original file line number Diff line number Diff line change
Expand Up @@ -197,30 +197,38 @@ end);
InstallMethod(CosetTableFpHom,"for fp homomorphisms",true,
[ IsFromFpGroupGeneralMappingByImages and IsGroupGeneralMappingByImages],0,
function(hom)
local u,aug,hgu,mapi;
local u,aug,hgu,mapi,w;
# source group with suitable generators
u:=Source(hom);
aug:=false;
mapi:=MappingGeneratorsImages(hom);
hgu:=List(mapi[1],UnderlyingElement);
# try to re-use an existing augmented coset table:
aug:=AugmentedCosetTableInWholeGroup(u,mapi[1]);
if not IsSubset(hgu,aug.primaryGeneratorWords) then
# we don't know what to do with the extra primary words, so enforce MTC
# version
aug:=AugmentedCosetTableMtcInWholeGroup(
SubgroupNC(FamilyObj(u)!.wholeGroup,mapi[1]));
fi;
# as we add homomorphism specific entries, lets be safe and copy.
aug:=CopiedAugmentedCosetTable(aug);

# construct augmented coset table
w:=FamilyObj(mapi[1])!.wholeGroup;
aug:=NEWTC_CosetEnumerator(FreeGeneratorsOfFpGroup(w),
RelatorsOfFpGroup(w),
hgu,
true);

aug.homgens:=mapi[1];
aug.homgenims:=mapi[2];

# assign the primary generator images
aug.primaryImages:=List(aug.primaryGeneratorWords,
aug.primaryImages:=List(aug.subgens,
i->aug.homgenims[Position(hgu,i)]);

# # try to re-use an existing augmented coset table:
# aug:=AugmentedCosetTableInWholeGroup(u,mapi[1]);
# if not IsSubset(hgu,aug.primaryGeneratorWords) then
# # we don't know what to do with the extra primary words, so enforce MTC
# # version
# aug:=AugmentedCosetTableMtcInWholeGroup(
# SubgroupNC(FamilyObj(u)!.wholeGroup,mapi[1]));
# fi;
# as we add homomorphism specific entries, lets be safe and copy.
# aug:=CopiedAugmentedCosetTable(aug);

TrySecondaryImages(aug);

return aug;
Expand All @@ -235,7 +243,7 @@ InstallMethod( ImagesRepresentative, "map from (sub)fp group, rewrite",
[ IsFromFpGroupGeneralMappingByImages and IsGroupGeneralMappingByImages,
IsMultiplicativeElementWithInverse ], 0,
function( hom, word )
local aug,si,r,i,j,tt,ct,cft,c,f,g,ind,e;
local aug,si,r,i,j,tt,ct,cft,c,f,g,ind,e,eval;
# get a coset table
aug:=CosetTableFpHom(hom);
r:=One(Range(hom));
Expand All @@ -247,6 +255,36 @@ local aug,si,r,i,j,tt,ct,cft,c,f,g,ind,e;
else
Error("no decoding possible");
fi;
word:=UnderlyingElement(word);

if IsBound(aug.isNewAugmentedTable) then

eval:=function(i)
local w,j;
w:=One(si[1]);
if not IsBound(si[i]) then
for j in aug.secondary[i] do
if j<0 then
w:=w/eval(-j);
else
w:=w*eval(j);
fi;
od;
si[i]:=w;
fi;
return si[i];
end;

for i in NEWTC_Rewrite(aug,1,LetterRepAssocWord(word)) do
if i<0 then r:=r/eval(-i);
else r:=r*eval(i);
fi;
od;
return r;

fi;

# old version

# instead of calling `RewriteWord', we rewrite locally in the images.
# this ought to be a bit faster and better on memory.
Expand All @@ -260,7 +298,6 @@ local aug,si,r,i,j,tt,ct,cft,c,f,g,ind,e;
fi;
tt:=aug.transtab;

word:=UnderlyingElement(word);
c:=1; # current coset

if not IsLetterAssocWordRep(word) then
Expand Down Expand Up @@ -818,41 +855,52 @@ InstallMethod(IsomorphismFpGroupByGeneratorsNC,"subgroups of fp group",
[IsSubgroupFpGroup,IsList and IsMultiplicativeElementWithInverseCollection,
IsString],0,
function(u,gens,nam)
local aug,w,p,pres,f,fam;
local aug,w,p,pres,f,fam,G;
if HasIsWholeFamily(u) and IsWholeFamily(u) and
IsIdenticalObj(gens,GeneratorsOfGroup(u)) then
return IdentityMapping(u);
fi;
# get an augmented coset table from the group. It must be compatible with
# `gens', so we must always use MTC.
if HasGeneratorsOfGroup(u) and IsIdenticalObj(GeneratorsOfGroup(u),gens) then
aug:=AugmentedCosetTableMtcInWholeGroup(u);
else
w:=FamilyObj(u)!.wholeGroup;
aug:=AugmentedCosetTableMtc(w,SubgroupNC(w,gens),2,"%");
# do not store the generators for the subgroup (the user could do this
# himself if he wanted), the danger of consequential errors due to a
# wrong <gens> list is too high.
fi;

# force computation of words for the secondary generators
SecondaryGeneratorWordsAugmentedCosetTable(aug);

# create a tietze object to reduce the presentation a bit
if not IsBound(aug.subgroupRelators) then
aug.subgroupRelators := RewriteSubgroupRelators( aug, aug.groupRelators);
fi;
aug:=CopiedAugmentedCosetTable(aug);
pres := PresentationAugmentedCosetTable( aug,nam,0,true );
TzOptions(pres).printLevel:=InfoLevel(InfoFpGroup);
DecodeTree(pres);

# use new MTC
w:=FamilyObj(u)!.wholeGroup;
aug:=NEWTC_CosetEnumerator(FreeGeneratorsOfFpGroup(w),
RelatorsOfFpGroup(w),
List(GeneratorsOfGroup(u),UnderlyingElement),
true);

pres:=NEWTC_PresentationMTC(aug,1,"%");

# old code
# if HasGeneratorsOfGroup(u) and IsIdenticalObj(GeneratorsOfGroup(u),gens) then
# aug:=AugmentedCosetTableMtcInWholeGroup(u);
# else
# w:=FamilyObj(u)!.wholeGroup;
# aug:=AugmentedCosetTableMtc(w,SubgroupNC(w,gens),2,"%");
# # do not store the generators for the subgroup (the user could do this
# # himself if he wanted), the danger of consequential errors due to a
# # wrong <gens> list is too high.
# fi;
#
# # force computation of words for the secondary generators
# SecondaryGeneratorWordsAugmentedCosetTable(aug);
#
# # create a tietze object to reduce the presentation a bit
# if not IsBound(aug.subgroupRelators) then
# aug.subgroupRelators := RewriteSubgroupRelators( aug, aug.groupRelators);
# fi;
# aug:=CopiedAugmentedCosetTable(aug);
# pres := PresentationAugmentedCosetTable( aug,nam,0,true );
# TzOptions(pres).printLevel:=InfoLevel(InfoFpGroup);
# DecodeTree(pres);

# new free group
f:=FpGroupPresentation(pres);
aug.homgens:=gens;
aug.homgenims:=GeneratorsOfGroup(f);
aug.primaryImages:=GeneratorsOfGroup(f);
SecondaryImagesAugmentedCosetTable(aug);
aug.secondaryImages:=ShallowCopy(GeneratorsOfGroup(f));

f:=GroupHomomorphismByImagesNC(u,f,gens,GeneratorsOfGroup(f):noassert);

Expand Down
113 changes: 75 additions & 38 deletions lib/sgpres.gi
Original file line number Diff line number Diff line change
Expand Up @@ -2766,36 +2766,51 @@ end);
## augmented coset table data. It must not be applied to augmented coset
## tables which are not of type 2.)
InstallGlobalFunction(CopiedAugmentedCosetTable,function(aug)
local t;
t:=rec(
isAugmentedCosetTable:=true,
type:=aug.type,
tableType:=aug.tableType,
groupGenerators:=aug.groupGenerators,
groupRelators:=aug.groupRelators,
cosetTable:=aug.cosetTable,
cosetFactorTable:=aug.cosetFactorTable,
primaryGeneratorWords:=aug.primaryGeneratorWords,
tree:=aug.tree,
treeNumbers:=aug.treeNumbers,
numberOfSubgroupGenerators:=aug.numberOfSubgroupGenerators,
nameOfSubgroupGenerators:=aug.nameOfSubgroupGenerators,
subgroupGenerators:=aug.subgroupGenerators
);
if IsBound(aug.conversionList) then
t.conversionList:=aug.conversionList;
fi;
if IsBound(aug.primarySubgroupGenerators) then
t.primarySubgroupGenerators:=Immutable(aug.primarySubgroupGenerators);
fi;
if IsBound(aug.subgroupRelators) then
t.subgroupRelators:=Immutable(aug.subgroupRelators);
fi;
if IsBound(aug.translationTable) then
t.translationTable:=Immutable(aug.translationTable);
fi;
if IsBound(aug.secondaryWords) then
t.secondaryWords:=Immutable(aug.secondaryWords);
local t,j;
if IsBound(aug.isNewAugmentedTable) then
t:=rec(isNewAugmentedTable:=true);
for j in
[ "A", "aug", "ct", "defcount", "from", "homgenims", "homgens",
"index", "n", "offset", "primaryImages", "rels",
"secondary", "secount", "secondaryImages", "subgens" ] do
if IsBound(aug.(j)) then
t.(j):=aug.(j);
fi;
od;
else
# old version
t:=rec(
isAugmentedCosetTable:=true,
type:=aug.type,
tableType:=aug.tableType,
groupGenerators:=aug.groupGenerators,
groupRelators:=aug.groupRelators,
cosetTable:=aug.cosetTable,
cosetFactorTable:=aug.cosetFactorTable,
primaryGeneratorWords:=aug.primaryGeneratorWords,
tree:=aug.tree,
treeNumbers:=aug.treeNumbers,
numberOfSubgroupGenerators:=aug.numberOfSubgroupGenerators,
nameOfSubgroupGenerators:=aug.nameOfSubgroupGenerators,
subgroupGenerators:=aug.subgroupGenerators
);
if IsBound(aug.secondaryWords) then
t.secondaryWords:=Immutable(aug.secondaryWords);
fi;

if IsBound(aug.conversionList) then
t.conversionList:=aug.conversionList;
fi;
if IsBound(aug.primarySubgroupGenerators) then
t.primarySubgroupGenerators:=Immutable(aug.primarySubgroupGenerators);
fi;
if IsBound(aug.subgroupRelators) then
t.subgroupRelators:=Immutable(aug.subgroupRelators);
fi;
if IsBound(aug.translationTable) then
t.translationTable:=Immutable(aug.translationTable);
fi;

fi;
return t;
end);
Expand Down Expand Up @@ -3388,7 +3403,8 @@ local m,offset,rels,ri,ccr,i,r,ct,A,a,w,n,DATA,p,ds,
p:=[1];
collapse:=[];
DATA:=rec(ct:=ct,p:=p,ccr:=ccr,rels:=List(rels,LetterRepAssocWord),
subgens:=List(subgens,x->LetterRepAssocWord(UnderlyingElement(x))),
subgens:=subgens,
subgword:=List(subgens,x->LetterRepAssocWord(UnderlyingElement(x))),
n:=n,offset:=offset,A:=A,limit:=2^23,
deductions:=[],dead:=0,defcount:=0,
# a global list for the kernel scan function to return 4 variables
Expand Down Expand Up @@ -3423,9 +3439,9 @@ local m,offset,rels,ri,ccr,i,r,ct,A,a,w,n,DATA,p,ds,

for w in [1..Length(subgens)] do
if DATA.augmented then
NEWTC_ModifiedScanAndFill(DATA,1,DATA.subgens[w],[w]);
NEWTC_ModifiedScanAndFill(DATA,1,DATA.subgword[w],[w]);
else
NEWTC_ScanAndFill(DATA,1,DATA.subgens[w]);
NEWTC_ScanAndFill(DATA,1,DATA.subgword[w]);
fi;
od;
NEWTC_ProcessDeductions(DATA);
Expand Down Expand Up @@ -3648,19 +3664,40 @@ local freegens,freerels,subgens,aug,trace,e,ldc,up,bastime,start,bl,bw,first;
StandardizeTable(ldc);
return ldc;
fi;
e.data.isNewAugmentedTable:=true;
return e.data;

aug:=rec(isNewAugmentedTable:=true,
n:=e.data.n,
A:=e.data.A,
from:=e.data.from,
index:=e.data.index,
rels:=e.data.rels,
ct:=e.data.ct,
aug:=e.data.aug,
defcount:=e.data.defcount,
secount:=e.data.secount,
secondary:=e.data.secondary,
subgens:=e.data.subgens,
subgword:=e.data.subgword,
offset:=e.data.offset
);
return aug;
end);

NEWTC_Rewrite:=function(DATA,start,w)
local offset,c,i,j;
NEWTC_Rewrite:=function(arg)
local DATA,start,w,offset,c,i,j;
DATA:=arg[1];
start:=arg[2];
w:=arg[3];
offset:=DATA.offset;
c:=[];
i:=start;
for j in w do
c:=WordProductLetterRep(c,DATA.aug[j+offset][i]);
i:=DATA.ct[j+offset][i];
od;
if Length(arg)>3 and arg[4]<>i then
Error("Trace did not end at expected coset");
fi;
return c;
end;

Expand Down Expand Up @@ -3712,7 +3749,7 @@ local DATA,rels,i,j,w,f,r,s,fam,new,ri,a,offset,p,rset,re,start,stack,pres,
rels:=[];
subnum:=Length(DATA.subgens);
for i in [1..subnum] do
r:=WordProductLetterRep(NEWTC_Rewrite(DATA,1,DATA.subgens[i]),[-i]);
r:=WordProductLetterRep(NEWTC_Rewrite(DATA,1,DATA.subgword[i]),[-i]);
if Length(r)>0 then
Add(rels,r);
fi;
Expand Down

0 comments on commit 3728bec

Please sign in to comment.