diff --git a/lib/algebra.gi b/lib/algebra.gi index e8457b37e1..df6d32f75f 100644 --- a/lib/algebra.gi +++ b/lib/algebra.gi @@ -3647,7 +3647,7 @@ InstallMethod( CentralIdempotentsOfAlgebra, until k>Length(ideals); - id:= List( ids, e -> PreImagesRepresentative( hom, e ) ); + id:= List( ids, e -> PreImagesRepresentativeNC( hom, e ) ); # Now we lift the idempotents to the big algebra `A'. The # first idempotent is lifted as follows: diff --git a/lib/algfp.gi b/lib/algfp.gi index 1776bc7dc0..34b9185e6f 100644 --- a/lib/algfp.gi +++ b/lib/algfp.gi @@ -705,7 +705,7 @@ InstallHandlingByNiceBasis( "IsFpAlgebraElementsSpace", rec( if hom = fail then TryNextMethod(); fi; - return PreImagesRepresentative( hom, r ); + return PreImagesRepresentativeNC( hom, r ); end ) ); diff --git a/lib/alghom.gi b/lib/alghom.gi index 8dc79c6efd..428c3e6b73 100644 --- a/lib/alghom.gi +++ b/lib/alghom.gi @@ -576,16 +576,31 @@ InstallMethod( ImagesRepresentative, ############################################################################# ## +#M PreImagesRepresentativeNC( , ) . . . . . for algebra g.m.b.i. #M PreImagesRepresentative( , ) . . . . . . for algebra g.m.b.i. ## +InstallMethod( PreImagesRepresentativeNC, + "for algebra g.m.b.i., and element", + FamRangeEqFamElm, + [ IsGeneralMapping and IsAlgebraGeneralMappingByImagesDefaultRep, + IsObject ], + function( map, elm ) + return PreImagesRepresentativeNC( + AsLeftModuleGeneralMappingByImages(map), elm ); + end ); + InstallMethod( PreImagesRepresentative, "for algebra g.m.b.i., and element", FamRangeEqFamElm, [ IsGeneralMapping and IsAlgebraGeneralMappingByImagesDefaultRep, IsObject ], function( map, elm ) - return PreImagesRepresentative( AsLeftModuleGeneralMappingByImages(map), - elm ); + if not ( elm in Range( map ) ) then + Error( " is not in the range of " ); + elif not ( elm in Image( map ) ) then + return fail; + fi; + return PreImagesRepresentativeNC( map, elm ); end ); @@ -902,6 +917,7 @@ InstallMethod( ImagesRepresentative, ############################################################################# ## +#M PreImagesRepresentativeNC( , ) #M PreImagesRepresentative( , ) ## BindGlobal( "PreImagesRepresentativeOperationAlgebraHomomorphism", function( ophom, mat ) @@ -915,12 +931,24 @@ BindGlobal( "PreImagesRepresentativeOperationAlgebraHomomorphism", function( oph return mat; end ); -InstallMethod( PreImagesRepresentative, +InstallMethod( PreImagesRepresentativeNC, "for an operation algebra homomorphism, and an element", FamRangeEqFamElm, [ IsOperationAlgebraHomomorphismDefaultRep, IsMatrix ], PreImagesRepresentativeOperationAlgebraHomomorphism ); +InstallMethod( PreImagesRepresentative, + "for an operation algebra homomorphism, and an element", + FamRangeEqFamElm, + [ IsOperationAlgebraHomomorphismDefaultRep, IsMatrix ], + function( ophom, mat ) + if not ( mat in Range( ophom ) ) then + Error( " not in the range of mapping " ); + elif not ( mat in Image( ophom ) ) then + return fail; + fi; + return PreImagesRepresentativeOperationAlgebraHomomorphism( ophom, mat ); +end ); ############################################################################# ## @@ -1076,14 +1104,27 @@ InstallMethod( ImagesRepresentative, ############################################################################# ## +#M PreImagesRepresentativeNC( , ) #M PreImagesRepresentative( , ) ## -InstallMethod( PreImagesRepresentative, +InstallMethod( PreImagesRepresentativeNC, "for an alg. hom. from f. p. algebra, and an element", FamRangeEqFamElm, [ IsAlgebraHomomorphismFromFpRep, IsMatrix ], PreImagesRepresentativeOperationAlgebraHomomorphism ); +InstallMethod( PreImagesRepresentative, + "for an alg. hom. from f. p. algebra, and an element", + FamRangeEqFamElm, + [ IsAlgebraHomomorphismFromFpRep, IsMatrix ], + function( ophom, mat ) + if not ( mat in Range( ophom ) ) then + Error( " is not in the range of mapping " ); + elif not ( mat in Image( ophom ) ) then + return fail; + fi; + return PreImagesRepresentativeOperationAlgebraHomomorphism( ophom, mat ); + end ); ############################################################################# ## diff --git a/lib/alglie.gi b/lib/alglie.gi index 322e003d6d..b3c02be371 100644 --- a/lib/alglie.gi +++ b/lib/alglie.gi @@ -1706,7 +1706,7 @@ InstallMethod( LieSolvableRadical, quo:= ImagesSource( hom ); r1:= LieSolvableRadical( quo ); B:= BasisVectors( Basis( r1 ) ); - B:= List( B, x -> PreImagesRepresentative( hom, x ) ); + B:= List( B, x -> PreImagesRepresentativeNC( hom, x ) ); Append( B, BasisVectors( Basis( n ) ) ); fi; @@ -2092,7 +2092,7 @@ InstallMethod( DirectSumDecomposition, SetRadicalOfAlgebra( Q, Subalgebra( Q, [ Zero( Q ) ] ) ); id:= List( CentralIdempotentsOfAlgebra( Q ), - x->PreImagesRepresentative(hom,x)); + x->PreImagesRepresentativeNC(hom,x)); # Now we lift the idempotents to the big algebra `A'. The # first idempotent is lifted as follows: @@ -4017,9 +4017,10 @@ InstallMethod( ImagesRepresentative, ########################################################################### ## +#M PreImagesRepresentativeNC( f, x ) #M PreImagesRepresentative( f, x ) ## -InstallMethod( PreImagesRepresentative, +InstallMethod( PreImagesRepresentativeNC, "for Fp to SCA mapping, and element", FamRangeEqFamElm, [ IsFptoSCAMorphism, IsSCAlgebraObj ], 0, @@ -4095,6 +4096,21 @@ InstallMethod( PreImagesRepresentative, end); +InstallMethod( PreImagesRepresentative, + "for Fp to SCA mapping, and element", + FamRangeEqFamElm, + [ IsFptoSCAMorphism, IsSCAlgebraObj ], 0, + + function( f, x ) + if not ( x in Range( f ) ) then + Error( " is not in the range of mapping " ); + elif not ( x in Image( f ) ) then + return fail; + fi; + return PreImagesRepresentativeNC( f, x ); + +end ); + ############################################################################# ## #M Dimension( ) @@ -5592,8 +5608,8 @@ InstallMethod( JenningsLieAlgebra, T:= EmptySCTable( dim , Zero(F) , "antisymmetric" ); pimgs := []; for i in [1..dim] do - a:= PreImagesRepresentative( Homs[pos[i]] , - PreImagesRepresentative( hom_pcg[pos[i]], gens[i] ) ); + a:= PreImagesRepresentativeNC( Homs[pos[i]] , + PreImagesRepresentativeNC( hom_pcg[pos[i]], gens[i] ) ); # calculate the p-th power image of `a': @@ -5610,8 +5626,8 @@ InstallMethod( JenningsLieAlgebra, # Calculate the commutator [a,b], and map the result into # the correct homogeneous component. - b:= PreImagesRepresentative( Homs[pos[j]], - PreImagesRepresentative( hom_pcg[pos[j]], gens[j] )); + b:= PreImagesRepresentativeNC( Homs[pos[j]], + PreImagesRepresentativeNC( hom_pcg[pos[j]], gens[j] )); c:= Image( hom_pcg[pos[i] + pos[j]], Image(Homs[pos[i] + pos[j]], a^-1*b^-1*a*b) ); e:= ExtRepOfObj(c); @@ -5788,8 +5804,8 @@ InstallMethod( PCentralLieAlgebra, T:= EmptySCTable( dim , Zero(F) , "antisymmetric" ); pimgs := []; for i in [1..dim] do - a:= PreImagesRepresentative( Homs[pos[i]] , - PreImagesRepresentative( hom_pcg[pos[i]], gens[i] ) ); + a:= PreImagesRepresentativeNC( Homs[pos[i]] , + PreImagesRepresentativeNC( hom_pcg[pos[i]], gens[i] ) ); # calculate the p-th power image of `a': @@ -5807,8 +5823,8 @@ InstallMethod( PCentralLieAlgebra, # Calculate the commutator [a,b], and map the result into # the correct homogeneous component. - b:= PreImagesRepresentative( Homs[pos[j]], - PreImagesRepresentative( hom_pcg[pos[j]], gens[j] )); + b:= PreImagesRepresentativeNC( Homs[pos[j]], + PreImagesRepresentativeNC( hom_pcg[pos[j]], gens[j] )); c:= Image( hom_pcg[pos[i] + pos[j]], Image(Homs[pos[i] + pos[j]], a^-1*b^-1*a*b) ); e:= ExtRepOfObj(c); diff --git a/lib/algrep.gi b/lib/algrep.gi index 8d331feee2..7607190b94 100644 --- a/lib/algrep.gi +++ b/lib/algrep.gi @@ -1212,24 +1212,24 @@ InstallMethod( NaturalHomomorphismBySubAlgebraModule, if IsLeftAlgebraModuleElementCollection( V ) then if IsRightAlgebraModuleElementCollection( V ) then left_op:= function( x, v ) - return ImagesRepresentative( f, x^PreImagesRepresentative( f, v ) ); + return ImagesRepresentative( f, x^PreImagesRepresentativeNC( f, v ) ); end; right_op:= function( v, x ) - return ImagesRepresentative( f, PreImagesRepresentative( f, v )^x ); + return ImagesRepresentative( f, PreImagesRepresentativeNC( f, v )^x ); end; qmod:= BiAlgebraModule( LeftActingAlgebra( V ), RightActingAlgebra( V ), left_op, right_op, quot ); else left_op:= function( x, v ) - return ImagesRepresentative( f, x^PreImagesRepresentative( f, v ) ); + return ImagesRepresentative( f, x^PreImagesRepresentativeNC( f, v ) ); end; qmod:= LeftAlgebraModule( LeftActingAlgebra( V ), left_op, quot); fi; else right_op:= function( v, x ) - return ImagesRepresentative( f, PreImagesRepresentative( f, v )^x ); + return ImagesRepresentative( f, PreImagesRepresentativeNC( f, v )^x ); end; qmod:= RightAlgebraModule( RightActingAlgebra( V ), right_op, quot ); diff --git a/lib/autsr.gi b/lib/autsr.gi index edc3b758ed..782b12dd8c 100644 --- a/lib/autsr.gi +++ b/lib/autsr.gi @@ -167,7 +167,7 @@ local rels:=Filtered(RelatorsOfFpGroup(fp),x->ForAll(ExponentSums(x),x->x mod p=0)); rels:=List(rels,x->ElementOfFpGroup(FamilyObj(One(fp)),x)); new:=RestrictedMapping(nat,C)*hom; - pre:=List(rels,x->PreImagesRepresentative(new,x)); + pre:=List(rels,x->PreImagesRepresentativeNC(new,x)); for i in [1..Length(rels)] do if not pre[i] in sub then Add(all,MappedWord(rels[i], @@ -214,7 +214,7 @@ local fpg:=FreeGeneratorsOfFpGroup(Range(fphom)); ocr.factorpres:=[fpg,RelatorsOfFpGroup(Range(fphom))]; ocr.generators:=List(GeneratorsOfGroup(Range(fphom)), - i->PreImagesRepresentative(fphom,i)); + i->PreImagesRepresentativeNC(fphom,i)); OCAddMatrices(ocr,ocr.generators); OCAddRelations(ocr,ocr.generators); OCAddSumMatrices(ocr,ocr.generators); @@ -392,12 +392,10 @@ BindGlobal("AGSRAutomLift",function(ocr,nat,fhom,miso) # allow deducing corresponding module aut. t:=ocr.trickrels; phom:=IdentityMapping(ocr.moduleauts); - - #s:=List(t.gens,x->PreImagesRepresentative(nat,x)); - #l:=List(t.gens,x->PreImagesRepresentative(nat,ImagesRepresentative(fhom,x))); - + #s:=List(t.gens,x->PreImagesRepresentativeNC(nat,x)); + #l:=List(t.gens,x->PreImagesRepresentativeNC(nat,ImagesRepresentative(fhom,x))); # word expression for images (to have some "hom-like" property - ws:=List(t.gens,x->PreImagesRepresentative(t.epi,ImagesRepresentative(fhom,x))); + ws:=List(t.gens,x->PreImagesRepresentativeNC(t.epi,ImagesRepresentative(fhom,x))); # evaluated in pregens l:=List(ws,x->MappedWord(x,GeneratorsOfGroup(t.free),t.pregens)); @@ -422,7 +420,7 @@ BindGlobal("AGSRAutomLift",function(ocr,nat,fhom,miso) fi; for ep in enum do - e:=PreImagesRepresentative(phom,ep); + e:=PreImagesRepresentativeNC(phom,ep); psim:=e*miso; psim:=psim^-1; w:=-List(v,i->i*psim); @@ -656,7 +654,7 @@ local cnt:=0; for b in t do - new:=PreImagesRepresentative(hom,b); + new:=PreImagesRepresentativeNC(hom,b); if (pp=false or new^pp in S) and locond(new) then S:=ClosureGroup(S,new); have:=true; @@ -1369,7 +1367,7 @@ local b:=MTX.BasisRadical(mo); fratsim:=Length(b)=0; if not fratsim then - b:=List(b,x->PreImagesRepresentative(hom,PcElementByExponents(MPcgs,x))); + b:=List(b,x->PreImagesRepresentativeNC(hom,PcElementByExponents(MPcgs,x))); for j in b do N:=ClosureSubgroup(N,b); od; @@ -1477,8 +1475,8 @@ local if perm in Aperm then return true; fi; - aut:=PreImagesRepresentative(AQiso,perm); - newgens:=List(gens,x->PreImagesRepresentative(comiso, + aut:=PreImagesRepresentativeNC(AQiso,perm); + newgens:=List(gens,x->PreImagesRepresentativeNC(comiso, ImagesRepresentative(aut,ImagesRepresentative(comiso,x)))); mo2:=GModuleByMats(LinearActionLayer(newgens,MPcgs),mo.field); @@ -1516,9 +1514,9 @@ local if perm in Aperm then return true; fi; - aut:=PreImagesRepresentative(AQiso,perm); + aut:=PreImagesRepresentativeNC(AQiso,perm); newgens:=List(GeneratorsOfGroup(Q), - x->PreImagesRepresentative(q,Image(aut,ImagesRepresentative(q,x)))); + x->PreImagesRepresentativeNC(q,Image(aut,ImagesRepresentative(q,x)))); mo2:=GModuleByMats(LinearActionLayer(newgens,MPcgs),mo.field); return MTX.IsomorphismModules(mo,mo2)<>fail; end; @@ -1535,9 +1533,9 @@ local if perm in Aperm then return true; fi; - aut:=PreImagesRepresentative(AQiso,perm); + aut:=PreImagesRepresentativeNC(AQiso,perm); newgens:=List(GeneratorsOfGroup(Q), - x->PreImagesRepresentative(q,Image(aut,ImagesRepresentative(q,x)))); + x->PreImagesRepresentativeNC(q,Image(aut,ImagesRepresentative(q,x)))); mo2:=GModuleByMats(LinearActionLayer(newgens,MPcgs),mo.field); iso:=MTX.IsomorphismModules(mo,mo2); if iso=fail then @@ -1595,12 +1593,12 @@ local # stabilize class k:=SmallGeneratingSet(sub); ac:=OrbitStabilizerAlgorithm(sub,false,false, - k,List(k,x->PreImagesRepresentative(AQiso,x)), + k,List(k,x->PreImagesRepresentativeNC(AQiso,x)), rec(pnt:=j, act:= function(set,phi) #local phi; - #phi:=PreImagesRepresentative(AQiso,perm); + #phi:=PreImagesRepresentativeNC(AQiso,perm); return Set(List(set,x->Image(phi,x))); end, onlystab:=true)); @@ -1728,7 +1726,7 @@ local GeneratorsOfGroup(rf), List(GeneratorsOfGroup(rf), y->ImagesRepresentative(hom,ImagesRepresentative(j, - PreImagesRepresentative(hom,y))))); + PreImagesRepresentativeNC(hom,y))))); Assert(2,IsBijective(k)); Add(ind,k); od; @@ -1751,7 +1749,7 @@ local proj:=GroupHomomorphismByImagesNC(AQP,Image(resperm), B[2],List(GeneratorsOfGroup(res),x->ImagesRepresentative(resperm,x))); C:=PreImage(proj,Image(resperm,ind)); - C:=List(SmallGeneratingSet(C),x->PreImagesRepresentative(AQiso,x)); + C:=List(SmallGeneratingSet(C),x->PreImagesRepresentativeNC(AQiso,x)); AQ:=Group(C); SetIsFinite(AQ,true); SetIsGroupOfAutomorphismsFiniteGroup(AQ,true); @@ -1777,7 +1775,7 @@ local C:=MappingGeneratorsImages(AQiso); if C[2]<>GeneratorsOfGroup(AQP) then C:=[List(GeneratorsOfGroup(AQP), - x->PreImagesRepresentative(AQiso,x)), + x->PreImagesRepresentativeNC(AQiso,x)), GeneratorsOfGroup(AQP)]; fi; for j in u do @@ -1812,7 +1810,7 @@ local substb:=SmallGeneratingSet(substb); AQP:=Group(substb); SetSize(AQP,B); - C:=[List(substb,x->PreImagesRepresentative(AQiso,x)),substb]; + C:=[List(substb,x->PreImagesRepresentativeNC(AQiso,x)),substb]; fi; od; @@ -2354,7 +2352,7 @@ local else gens:=SmallGeneratingSet(api); fi; - pre:=List(gens,x->PreImagesRepresentative(iso,x)); + pre:=List(gens,x->PreImagesRepresentativeNC(iso,x)); map:=RepresentativeAction(SubgroupNC(a,pre),u,v,asAutomorphism); if map=fail then return fail; @@ -2375,6 +2373,6 @@ local fi; return GroupHomomorphismByImagesNC(G,H,GeneratorsOfGroup(G), - List(GeneratorsOfGroup(G),x->PreImagesRepresentative(e2, + List(GeneratorsOfGroup(G),x->PreImagesRepresentativeNC(e2, Image(conj,Image(e1,x))))); end); diff --git a/lib/clas.gi b/lib/clas.gi index b933b7d50b..2a27e3cbba 100644 --- a/lib/clas.gi +++ b/lib/clas.gi @@ -395,7 +395,7 @@ local H,cl,a,c; H:=Image(hom,G); cl:=[]; for c in ConjugacyClasses(H) do - a:=ConjugacyClass(G,PreImagesRepresentative(hom,Representative(c))); + a:=ConjugacyClass(G,PreImagesRepresentativeNC(hom,Representative(c))); if HasStabilizerOfExternalSet(c) then SetStabilizerOfExternalSet(a,PreImage(hom,StabilizerOfExternalSet(c))); fi; diff --git a/lib/clashom.gi b/lib/clashom.gi index 89c327ff2e..5cbe5995db 100644 --- a/lib/clashom.gi +++ b/lib/clashom.gi @@ -499,7 +499,7 @@ local clT, # classes T for k in clop do Info(InfoHomClass,1,"lifting class ",Representative(k)); - r:=PreImagesRepresentative(ophom,Representative(k)); + r:=PreImagesRepresentativeNC(ophom,Representative(k)); # try to make r of small order rp:=r^Order(Representative(k)); rp:=RepresentativeAction(M,Concatenation(components), @@ -564,7 +564,7 @@ local clT, # classes T orb:=[]; for p in [1..Length(clTR)] do - repres:=PreImagesRepresentative(projections[i],clTR[p]); + repres:=PreImagesRepresentativeNC(projections[i],clTR[p]); if i=1 or isdirprod or reps[j]*RestrictedPermNC(repres,components[i]) in Mproj[i] then @@ -586,8 +586,8 @@ local clT, # classes T #was: #clTR:=List(clTR,i->ConjugacyClass(localcent_r,i)); - #clTR:=List(clTR,j->[PreImagesRepresentative(projections[i], - # Representative(j)), + #clTR:=List(clTR,j->[PreImagesRepresentativeNC(projections[i], + # Representative(j)), # PreImage(centrhom,Centralizer(j)), # j]); @@ -706,7 +706,7 @@ local clT, # classes T #change the transversal element to map to the representative con:=trans[orpo]*gen; limg:=opfun(repres,con); - con:=con*PreImagesRepresentative(centrhom, + con:=con*PreImagesRepresentativeNC(centrhom, RepresentativeAction(localcent_r, Image(projections[i],limg), Representative(clTR[p][3]))); @@ -798,7 +798,7 @@ local clT, # classes T # centralizers_r-conjugation.) con:=trans[orpo]*gen; limg:=opfun(repres,con); - con:=con*PreImagesRepresentative(centrhom, + con:=con*PreImagesRepresentativeNC(centrhom, RepresentativeAction(localcent_r, Image(projections[i],limg), Representative(orb[p][3]))); @@ -870,7 +870,7 @@ local clT, # classes T # remember the element to try trymap:=[p,(cengen[genpos2]* - PreImagesRepresentative( + PreImagesRepresentativeNC( RestrictedMapping(projections[i], centralizers[j]), RepresentativeAction( @@ -1140,7 +1140,7 @@ local cs, # chief series of G # compute the classes of the simple nonabelian factor by random search hom:=NaturalHomomorphismByNormalSubgroupNC(G,lastM); cl:=ConjugacyClasses(Image(hom)); - cl:=List(cl,i->[PreImagesRepresentative(hom,Representative(i)), + cl:=List(cl,i->[PreImagesRepresentativeNC(hom,Representative(i)), PreImage(hom,StabilizerOfExternalSet(i))]); cs:=Concatenation([G],Filtered(cs,x->IsSubset(lastM,x))); fi; @@ -1207,7 +1207,7 @@ local cs, # chief series of G autos:=List(GeneratorsOfGroup(G), i->GroupHomomorphismByImagesNC(T1,T1,GeneratorsOfGroup(T1), List(GeneratorsOfGroup(T1), - j->Image(Thom,PreImagesRepresentative(Thom,j)^i)))); + j->Image(Thom,PreImagesRepresentativeNC(Thom,j)^i)))); # find (probably another) permutation rep for T1 for which all # automorphisms can be represented by permutations @@ -1268,7 +1268,7 @@ local cs, # chief series of G autos:=List(GeneratorsOfGroup(S), i->GroupHomomorphismByImagesNC(T1,T1,GeneratorsOfGroup(T1), List(GeneratorsOfGroup(T1), - j->Image(Thom,PreImagesRepresentative(Thom,j)^i)))); + j->Image(Thom,PreImagesRepresentativeNC(Thom,j)^i)))); # find (probably another) permutation rep for T1 for which all # automorphisms can be represented by permutations @@ -1288,7 +1288,7 @@ local cs, # chief series of G # define isomorphisms between the components reps:=List([1..n],i-> - PreImagesRepresentative(Qhom,RepresentativeAction(Q,1,i))); + PreImagesRepresentativeNC(Qhom,RepresentativeAction(Q,1,i))); genimages:=[]; for j in GeneratorsOfGroup(G) do @@ -1345,7 +1345,7 @@ local cs, # chief series of G SetSize(F,Size(G)); FM:=GroupHomomorphismByImagesNC(G,F,GeneratorsOfGroup(G),FM); clF:=ConjugacyClassesFittingFreeGroup(F); - clF:=List(clF,x->[PreImagesRepresentative(FM,x[1]),PreImage(FM,x[2])]); + clF:=List(clF,x->[PreImagesRepresentativeNC(FM,x[1]),PreImage(FM,x[2])]); return clF; fi; #fi; @@ -1374,9 +1374,9 @@ local cs, # chief series of G Info(InfoHomClass,1, "homomorphism is faithful for relevant factor, take preimages"); if Size(N)=1 and onlysizes=true then - cl:=List(clF,i->[PreImagesRepresentative(Fhom,i[1]),Size(i[2])]); + cl:=List(clF,i->[PreImagesRepresentativeNC(Fhom,i[1]),Size(i[2])]); else - cl:=List(clF,i->[PreImagesRepresentative(Fhom,i[1]), + cl:=List(clF,i->[PreImagesRepresentativeNC(Fhom,i[1]), PreImage(Fhom,i[2])]); fi; else @@ -1391,7 +1391,7 @@ local cs, # chief series of G for k in clF do # modify the representative with a kernel elm. to project # correctly on the second component - elm:=j[1]*PreImagesRepresentative(FMhom, + elm:=j[1]*PreImagesRepresentativeNC(FMhom, LeftQuotient(Image(Fhom,j[1]),k[1])); zentr:=Intersection(j[2],PreImage(Fhom,k[2])); Assert(3,ForAll(GeneratorsOfGroup(zentr), @@ -1449,7 +1449,7 @@ local cs, # chief series of G if Image(Qhom,elm)=jim then # modify the representative with a kernel elm. to project # correctly on the second component - elm:=l[1]*PreImagesRepresentative(FMhom, + elm:=l[1]*PreImagesRepresentativeNC(FMhom, LeftQuotient(Image(Fhom,l[1]),elm)); zentr:=PreImage(Fhom,k[2]^l1); zentr:=Intersection(zentr,l[2]); @@ -1957,7 +1957,7 @@ local classes, # classes to be constructed, the result c := [h * PcElementByExponentsNC( Npcgs,w*com.factorspace), stabrad,stabfacgens,stabfacimg,subsz,stabrsubsz]; #if reduce<>fail then - # Add(classes,[PreImagesRepresentative(reduce,c[1]), + # Add(classes,[PreImagesRepresentativeNC(reduce,c[1]), # PreImage(reduce,c[2])]); # else @@ -2022,7 +2022,7 @@ BindGlobal("LiftClassesEATrivRep", nsfgens:=NormalIntersection(fants[usent],Group(cl[4])); fasize:=Size(nsfgens); nsfgens:=SmallGeneratingSet(nsfgens); - nsgens:=List(nsfgens,x->PreImagesRepresentative(hom,x)); + nsgens:=List(nsfgens,x->PreImagesRepresentativeNC(hom,x)); nsimgs:=List(Concatenation(pcgs,nsgens),npcgsact); mo:=GModuleByMats(nsimgs,field); if not MTX.IsIrreducible(mo) then @@ -2338,7 +2338,7 @@ local r, #radical if IsPermGroup(Range(hom)) and not IsPermGroup(Source(hom)) then f:=Image(hom,G); cl:=ConjugacyClassesFittingFreeGroup(f:onlysizes:=false); - cl:=List(cl,x->[PreImagesRepresentative(hom,x[1]), + cl:=List(cl,x->[PreImagesRepresentativeNC(hom,x[1]), PreImage(hom,x[2])]); else cl:=ConjugacyClassesFittingFreeGroup(G:onlysizes:=false); @@ -2398,12 +2398,12 @@ local r, #radical if ntrihom then ncl:=[]; for i in cl do - new:=[PreImagesRepresentative(hom,i[1])]; + new:=[PreImagesRepresentativeNC(hom,i[1])]; if not IsInt(i[2]) then Add(new,[]); # no generators in radical yet gens:=SmallGeneratingSet(i[2]); Add(new, - List(gens,x->PreImagesRepresentative(hom,x))); + List(gens,x->PreImagesRepresentativeNC(hom,x))); Add(new,gens); #TODO: PreImage groups? #Add(new,PreImage(hom,i[2])); @@ -2886,10 +2886,10 @@ local r, #radical fi; prereps:=f!.classpreimgs; if not IsBound(prereps[j]) then - prereps[j]:=PreImagesRepresentative(hom,Representative(cl[j])); + prereps[j]:=PreImagesRepresentativeNC(hom,Representative(cl[j])); fi; - r:=PreImagesRepresentative(hom,conj); + r:=PreImagesRepresentativeNC(hom,conj); d:=GeneratorsOfGroup(Centralizer(cl[j])); # Format for cl is: @@ -2897,7 +2897,7 @@ local r, #radical # in factor, 4:conjugator, 5:cenpcgs, # 6:cenfac, 7:cenfacimgs, 8:censize, 9:cenfacsize Add(nreps,[i,i^r,prereps[j],r,[], - List(d,x->PreImagesRepresentative(hom,x)),d, + List(d,x->PreImagesRepresentativeNC(hom,x)),d, radsize*Size(Centralizer(cl[j])), Size(Centralizer(cl[j]))]); od; reps:=nreps; diff --git a/lib/csetgrp.gi b/lib/csetgrp.gi index ba7bad5da9..36dff6b004 100644 --- a/lib/csetgrp.gi +++ b/lib/csetgrp.gi @@ -238,7 +238,7 @@ local cla,clb,i,j,k,bd,r,rep,b2,dc,clu, r:=SmallerDegreePermutationRepresentation(b:cheap); k:=Image(r,b); gens:=MorFindGeneratingSystem(k,MorMaxFusClasses(MorRatClasses(k))); - gens:=List(gens,x->PreImagesRepresentative(r,x)); + gens:=List(gens,x->PreImagesRepresentativeNC(r,x)); else gens:=MorFindGeneratingSystem(b,MorMaxFusClasses(MorRatClasses(b))); fi; @@ -1103,7 +1103,7 @@ local c, flip, maxidx, cano, tryfct, p, r, t, Assert(2,Size(a2)*Size(tra)=Size(b)); SetKernelOfMultiplicativeGeneralMapping(r,a2); - dcs:=List(dcs,x->[PreImagesRepresentative(quot,x[1]),Size(a1)*x[2], + dcs:=List(dcs,x->[PreImagesRepresentativeNC(quot,x[1]),Size(a1)*x[2], PreImage(r,x[3])]); r:=List(dcs,x->x[1]); stabs:=List(dcs,x->x[3]); diff --git a/lib/ctblfuns.gi b/lib/ctblfuns.gi index c648c9401f..eec04e92e4 100644 --- a/lib/ctblfuns.gi +++ b/lib/ctblfuns.gi @@ -2049,8 +2049,8 @@ InstallMethod( InertiaSubgroup, if stab = permgrp then return G; else - return PreImagesSet( GroupHomomorphismByImages( G, permgrp, - GeneratorsOfGroup( G ), perms ), + return PreImagesSetNC( GroupHomomorphismByImages( G, permgrp, + GeneratorsOfGroup( G ), perms ), stab ); fi; end ); diff --git a/lib/ctblgrp.gi b/lib/ctblgrp.gi index 6a1db26069..27d37164ea 100644 --- a/lib/ctblgrp.gi +++ b/lib/ctblgrp.gi @@ -1606,7 +1606,7 @@ local tm,tme,piso,gpcgs,gals,ord,l,l2,f,fgens,rws,pow,pos,i,j,k,gen, # not easily transfer to mod p. k:=Image(piso,TrivialSubgroup(D.galMorphisms)); gpcgs:=Pcgs(k); - gals:=List(gpcgs,i->PreImagesRepresentative(piso,i)); + gals:=List(gpcgs,i->PreImagesRepresentativeNC(piso,i)); ord:=List(gpcgs,i->RelativeOrderOfPcElement(gpcgs,i)); l:=Length(gpcgs); @@ -1827,7 +1827,7 @@ local often,trans,e,neu,i,inv,cent,l,s,s1,x,dom; if dom=fail then x:=D.classreps[inv]; - l:=List(s,i->[x^PreImagesRepresentative(e, + l:=List(s,i->[x^PreImagesRepresentativeNC(e, RepresentativeAction(Image(e),1,i[1])),Size(cent)*Length(i)]); else l:=List(s,i->[dom[i[1]],Size(cent)*Length(i)]); diff --git a/lib/ctblsolv.gi b/lib/ctblsolv.gi index af159f39c2..6f055a4bbd 100644 --- a/lib/ctblsolv.gi +++ b/lib/ctblsolv.gi @@ -176,7 +176,7 @@ InstallGlobalFunction( ProjectiveCharDeg, function( G, z, q ) # `N' is a normal subgroup such that `N/' is a chief factor of `G' # of order `i' which is a power of `p'. - N:= PreImagesSet( h, N ); + N:= PreImagesSetNC( h, N ); i:= Size( N ) / oz; p:= Factors( i )[1]; @@ -184,7 +184,7 @@ InstallGlobalFunction( ProjectiveCharDeg, function( G, z, q ) # `c' is a list of complement classes of `N' modulo `z' c:= List( ComplementClassesRepresentatives( ImagesSource( h ), ImagesSet( h, N ) ), - x -> PreImagesSet( h, x ) ); + x -> PreImagesSetNC( h, x ) ); r:= Centralizer( G, N ); for L in c do if IsSubset( L, r ) then @@ -563,7 +563,7 @@ InstallGlobalFunction( CoveringTriplesCharacters, function( G, z ) N:= ChiefSeriesUnderAction( img, N ); N:= N[ Length( N ) - 1 ]; fi; - N:= PreImagesSet( h, N ); + N:= PreImagesSetNC( h, N ); if not IsAbelian( N ) then Info( InfoCharacterTable, 2, @@ -582,9 +582,9 @@ InstallGlobalFunction( CoveringTriplesCharacters, function( G, z ) h:= NaturalHomomorphismByNormalSubgroupNC( G, P ); r:= List( CoveringTriplesCharacters( ImagesSource( h ), ImageElm( h, z ) ), - x -> [ PreImagesSet( h, x[1] ), - PreImagesSet( h, x[2] ), - PreImagesRepresentative( h, x[3] ) ] ); + x -> [ PreImagesSetNC( h, x[1] ), + PreImagesSetNC( h, x[2] ), + PreImagesRepresentativeNC( h, x[3] ) ] ); if p = i then @@ -622,9 +622,9 @@ InstallGlobalFunction( CoveringTriplesCharacters, function( G, z ) c:= Stabilizer( img, zn ); fi; Append( r, List( CoveringTriplesCharacters( c, zn ), - x -> [ PreImagesSet( h, x[1] ), - PreImagesSet( h, x[2] ), - PreImagesRepresentative( h, x[3] ) ] ) ); + x -> [ PreImagesSetNC( h, x[1] ), + PreImagesSetNC( h, x[2] ), + PreImagesRepresentativeNC( h, x[3] ) ] ) ); od; return r; @@ -663,9 +663,9 @@ InstallGlobalFunction( CoveringTriplesCharacters, function( G, z ) img:= ImagesSource( h ); Append( r, List( CoveringTriplesCharacters( img, ImageElm( h, z ) ), - x -> [ PreImagesSet( h, x[1] ), - PreImagesSet( h, x[2] ), - PreImagesRepresentative( h, x[3] ) ] ) ); + x -> [ PreImagesSetNC( h, x[1] ), + PreImagesSetNC( h, x[2] ), + PreImagesRepresentativeNC( h, x[3] ) ] ) ); fi; od; return r; @@ -1069,7 +1069,7 @@ InstallMethod( BaumClausenInfo, for i in [ 2 .. Length( ssr.ds ) ] do j:= NaturalHomomorphismByNormalSubgroupNC( ds[ i-1 ], ds[i] ); Append( pcgs, List( SpecialPcgs( ImagesSource( j ) ), - x -> PreImagesRepresentative( j, x ) ) ); + x -> PreImagesRepresentativeNC( j, x ) ) ); od; Append( pcgs, SpecialPcgs( Last( ds ) ) ); G:= ImagesSource( hom ); @@ -1911,7 +1911,7 @@ InstallMethod( BaumClausenInfo, k:= Pcgs( kernel ); pcgs:= PcgsByPcSequence( ElementsFamily( FamilyObj( kernel ) ), Concatenation( List( pcgs, - x -> PreImagesRepresentative( hom, x ) ), + x -> PreImagesRepresentativeNC( hom, x ) ), k ) ); k:= ListWithIdenticalEntries( Length( k ), 0 ); diff --git a/lib/field.gi b/lib/field.gi index c4ee2c4895..1f4897bf75 100644 --- a/lib/field.gi +++ b/lib/field.gi @@ -1315,15 +1315,16 @@ InstallMethod( ImagesSet, ############################################################################# ## -#M PreImagesElm( , ) . . . . . . . . . . . . preimage of an elm +#M PreImagesElmNC( , ) . . . . . . . . . . . . preimage of an elm +#M PreImagesElm( , ) . . . . . . . . . . . . . preimage of an elm ## -InstallMethod( PreImagesElm, +InstallMethod( PreImagesElmNC, "for field homomorphism and element", FamRangeEqFamElm, [ IsFieldHomomorphism, IsObject ], function ( hom, elm ) if IsInjective( hom ) then - return [ PreImagesRepresentative( hom, elm ) ]; + return [ PreImagesRepresentativeNC( hom, elm ) ]; elif IsZero( elm ) then return Source( hom ); else @@ -1331,18 +1332,42 @@ InstallMethod( PreImagesElm, fi; end ); +InstallMethod( PreImagesElm, + "for field homomorphism and element", + FamRangeEqFamElm, + [ IsFieldHomomorphism, IsObject ], + function ( hom, elm ) + if not (elm in Range(hom)) then + Error( " is not in the range of " ); + elif not (elm in Image(hom)) then + return fail; + fi; + return PreImagesElmNC( hom, elm ); + end ); ############################################################################# ## -#M PreImagesSet( , ) . . . . . . . . . . . . . preimage of a set +#M PreImagesSetNC +#M PreImagesSet ## -InstallMethod( PreImagesSet, +InstallMethod( PreImagesSetNC, "for field homomorphism and field", CollFamRangeEqFamElms, [ IsFieldHomomorphism, IsField ], function ( hom, elms ) elms:= FieldByGenerators( List( GeneratorsOfField( elms ), - gen -> PreImagesRepresentative( hom, gen ) ) ); + gen -> PreImagesRepresentativeNC( hom, gen ) ) ); UseSubsetRelation( Source( hom ), elms ); return elms; end ); + +InstallMethod( PreImagesSet, + "for field homomorphism and field", + CollFamRangeEqFamElms, + [ IsFieldHomomorphism, IsField ], + function ( hom, elms ) + if not IsSubset( Range(hom), elms ) then + Error( " is not a subset of the range of " ); + fi; + return PreImagesSetNC( hom, Intersection( elms, Image( hom ) ) ); + end ); diff --git a/lib/fieldfin.gi b/lib/fieldfin.gi index 612e990f38..bc1eaad7cc 100644 --- a/lib/fieldfin.gi +++ b/lib/fieldfin.gi @@ -759,7 +759,7 @@ InstallMethod( ImagesRepresentative, return elm ^ aut!.power; end ); -InstallMethod( PreImagesRepresentative, +InstallMethod( PreImagesRepresentativeNC, "for Frobenius automorphism and range element", FamRangeEqFamElm, [ IsFrobeniusAutomorphism, IsObject ], @@ -768,6 +768,18 @@ InstallMethod( PreImagesRepresentative, return ImagesRepresentative( InverseGeneralMapping( aut ), elm ); end ); +InstallMethod( PreImagesRepresentative, + "for Frobenius automorphism and range element", + FamRangeEqFamElm, + [ IsFrobeniusAutomorphism, IsObject ], + function( aut, elm ) + # surjective, so range membership implies image membership + if not ( elm in Range( aut ) ) then + Error( " is not in the range of mapping " ); + fi; + return PreImagesRepresentativeNC( aut, elm ); + end ); + InstallMethod( CompositionMapping2, "for two Frobenius automorphisms", IsIdenticalObj, diff --git a/lib/fitfree.gi b/lib/fitfree.gi index 66e1782cd5..31b71a4982 100644 --- a/lib/fitfree.gi +++ b/lib/fitfree.gi @@ -81,7 +81,7 @@ local ffs,pcisom,rest,kpc,k,x,ker,r,pool,i,xx,pregens,iso; else iso:=IsomorphismFpGroup(Image(rest,U)); pregens:=List(GeneratorsOfGroup(Range(iso)),x-> - PreImagesRepresentative(rest,PreImagesRepresentative(iso,x))); + PreImagesRepresentativeNC(rest,PreImagesRepresentativeNC(iso,x))); # evaluate relators pool:=List(RelatorsOfFpGroup(Range(iso)), x->MappedWord(x,FreeGeneratorsOfFpGroup(Range(iso)),pregens)); @@ -91,7 +91,7 @@ local ffs,pcisom,rest,kpc,k,x,ker,r,pool,i,xx,pregens,iso; iso:=IsomorphismFpGroup(Image(rest,U)); pregens:=List(GeneratorsOfGroup(Range(iso)),x-> - PreImagesRepresentative(rest,PreImagesRepresentative(iso,x))); + PreImagesRepresentativeNC(rest,PreImagesRepresentativeNC(iso,x))); # evaluate relators pool:=List(RelatorsOfFpGroup(Range(iso)), x->MappedWord(x,FreeGeneratorsOfFpGroup(Range(iso)),pregens)); @@ -135,7 +135,7 @@ local ffs,pcisom,rest,kpc,k,x,ker,r,pool,i,xx,pregens,iso; # od; SetSize(U,Size(Image(rest))*Size(kpc)); k:=InducedPcgs(FamilyPcgs(Image(pcisom)),kpc); - k:=List(k,x->PreImagesRepresentative(pcisom,x)); + k:=List(k,x->PreImagesRepresentativeNC(pcisom,x)); k:=InducedPcgsByPcSequenceNC(ffs.pcgs,k); ker:=SubgroupNC(G,k); SetSize(ker,Size(kpc)); @@ -257,7 +257,7 @@ local ffs,hom,U,rest,ker,r,p,l,i,depths,pcisom,subsz,pcimgs; pcimgs:=List(ipcgs,x->ImagesRepresentative(ffs.pcisom,x)); ker:=SubgroupNC(G,List(MinimalGeneratingSet(Group(pcimgs,One(Range(ffs.pcisom)))), - x->PreImagesRepresentative(ffs.pcisom,x))); + x->PreImagesRepresentativeNC(ffs.pcisom,x))); SetPcgs(ker,ipcgs); if Length(ipcgs)=0 then SetSize(ker,1); @@ -916,8 +916,9 @@ local ser,hom,s,fphom,sf,sg,sp,fp,d,head,mran,nran,mpcgs,ocr,len,pcgs,gens; s:=SylowSubgroup(Image(hom),prime); fphom:=IsomorphismFpGroup(s); fp:=Image(fphom); - sf:=List(GeneratorsOfGroup(Image(fphom)),x->PreImagesRepresentative(fphom,x)); - sg:=List(sf,x->PreImagesRepresentative(hom,x)); + sf:=List(GeneratorsOfGroup(Image(fphom)), + x->PreImagesRepresentativeNC(fphom,x)); + sg:=List(sf,x->PreImagesRepresentativeNC(hom,x)); sp:=[]; PushOptions( rec( Run_In_GGMBI:= true ) ); # hack to skip Nice treatment fphom:=GroupGeneralMappingByImagesNC(Group(sg,One(G)),fp,sg, @@ -1194,7 +1195,7 @@ local s,d,c,act,o,i,j,h,p,hf,img,n,k,ns,all,hl,hcomp, norm:=n); for j in [2..Length(i)] do c[i[j]]:=rec(orbit:=i,orbitpos:=j, - rep:=PreImagesRepresentative(act, + rep:=PreImagesRepresentativeNC(act, RepresentativeAction(Image(act),i[1],i[j])), component:=d[i[j]],hall:=h, norm:=n); od; @@ -1232,7 +1233,7 @@ local s,d,c,act,o,i,j,h,p,hf,img,n,k,ns,all,hl,hcomp, fp:=Range(fphom); gens:=MappingGeneratorsImages(fphom); imgs:=gens[2];gens:=gens[1]; - gens:=List(gens,x->PreImagesRepresentative(act,x)); + gens:=List(gens,x->PreImagesRepresentativeNC(act,x)); # adapt to normalize B gens:=List(gens,x->x/RepresentativeAction(t,b^x,b)); @@ -1280,7 +1281,7 @@ local s,d,c,act,o,i,j,h,p,hf,img,n,k,ns,all,hl,hcomp, fp:=Image(fphom); gens:=MappingGeneratorsImages(fphom); imgs:=gens[2];gens:=gens[1]; - gens:=List(gens,x->PreImagesRepresentative(hom,x)); + gens:=List(gens,x->PreImagesRepresentativeNC(hom,x)); fi; # now run through the candidates for Hall in S @@ -1408,8 +1409,9 @@ local ser,hom,s,fphom,sf,sg,sp,fp,d,head,mran,nran,mpcgs,ocr,len,pcgs, for s in HallsFittingFree(Image(hom),pi) do fphom:=IsomorphismFpGroup(s); fp:=Image(fphom); - sf:=List(GeneratorsOfGroup(Image(fphom)),x->PreImagesRepresentative(fphom,x)); - sg:=List(sf,x->PreImagesRepresentative(hom,x)); + sf:=List(GeneratorsOfGroup(Image(fphom)), + x->PreImagesRepresentativeNC(fphom,x)); + sg:=List(sf,x->PreImagesRepresentativeNC(hom,x)); sp:=[]; PushOptions( rec( Run_In_GGMBI:= true ) ); # hack to skip Nice treatment fphom:=GroupGeneralMappingByImagesNC(Group(sg,One(G)),fp,sg, diff --git a/lib/fldabnum.gi b/lib/fldabnum.gi index 5902772c5e..b934f57a47 100644 --- a/lib/fldabnum.gi +++ b/lib/fldabnum.gi @@ -1911,16 +1911,21 @@ InstallMethod( PreImageElm, [ IsFieldHomomorphism and IsBijective and IsANFAutomorphismRep, IsScalar ], function ( aut, elm ) - return GaloisCyc( elm, ( 1 / aut!.galois ) - mod Conductor( Range( aut ) ) ); + if not ( elm in Image( aut ) ) then + Error( " is not in the image of " ); + else + return GaloisCyc( elm, ( 1 / aut!.galois ) + mod Conductor( Range( aut ) ) ); + fi; end ); ############################################################################# ## +#M PreImagesElmNC( , ) . . . . . for autom. of ab. number fields #M PreImagesElm( , ) . . . . . . for autom. of ab. number fields ## -InstallMethod( PreImagesElm, +InstallMethod( PreImagesElmNC, "for ANF automorphism and scalar", FamRangeEqFamElm, [ IsFieldHomomorphism and IsANFAutomorphismRep, IsScalar ], @@ -1929,12 +1934,25 @@ InstallMethod( PreImagesElm, mod Conductor( Range( aut ) ) ) ]; end ); +InstallMethod( PreImagesElm, + "for ANF automorphism and scalar", + FamRangeEqFamElm, + [ IsFieldHomomorphism and IsANFAutomorphismRep, IsScalar ], + function ( aut, elm ) + if not ( elm in Range(aut) ) then + Error( " is not in the range of mapping " ); + elif not ( elm in Image(aut) ) then + return fail; + fi; + return PreImagesElmNC( aut, elm ); + end ); ############################################################################# ## -#M PreImagesSet( , ) . . . . . for autom. of ab. number fields +#M PreImagesSetNC( , ) . . . . . for autom. of ab. number fields +#M PreImagesSet( , ) . . . . . . for autom. of ab. number fields ## -InstallMethod( PreImagesSet, +InstallMethod( PreImagesSetNC, "for ANF automorphism and scalar", CollFamRangeEqFamElms, [ IsFieldHomomorphism and IsANFAutomorphismRep, IsField ], @@ -1942,12 +1960,23 @@ InstallMethod( PreImagesSet, return F; end ); +InstallMethod( PreImagesSet, + "for ANF automorphism and scalar", + CollFamRangeEqFamElms, + [ IsFieldHomomorphism and IsANFAutomorphismRep, IsField ], + function ( aut, F ) + if not IsSubset( Range(aut), F ) then + Error( " is not a subset of the range of mapping " ); + fi; + return PreImagesSetNC( aut, Intersection( F, Image( aut ) ) ); + end ); ############################################################################# ## +#M PreImagesRepresentativeNC( , ) for autom. of ab. number fields #M PreImagesRepresentative( , ) . for autom. of ab. number fields ## -InstallMethod( PreImagesRepresentative, +InstallMethod( PreImagesRepresentativeNC, "for ANF automorphism and scalar", FamRangeEqFamElm, [ IsFieldHomomorphism and IsANFAutomorphismRep, IsScalar ], @@ -1956,6 +1985,18 @@ InstallMethod( PreImagesRepresentative, mod Conductor( Range( aut ) ) ); end ); +InstallMethod( PreImagesRepresentative, + "for ANF automorphism and scalar", + FamRangeEqFamElm, + [ IsFieldHomomorphism and IsANFAutomorphismRep, IsScalar ], + function ( aut, elm ) + if not ( elm in Range( aut ) ) then + Error( " is not in the range of mapping " ); + elif not ( elm in Image( aut ) ) then + return fail; + fi; + return PreImagesRepresentativeNC( aut, elm ); + end ); ############################################################################# ## diff --git a/lib/ghom.gi b/lib/ghom.gi index 6a962762da..52e9da3d78 100644 --- a/lib/ghom.gi +++ b/lib/ghom.gi @@ -253,9 +253,10 @@ end ); ############################################################################# ## +#M PreImagesRepresentativeNC( , ) . . . . . . . . . . via images #M PreImagesRepresentative( , ) . . . . . . . . . . . via images -## -InstallMethod( PreImagesRepresentative, "for PBG-Hom", FamRangeEqFamElm, + +InstallMethod( PreImagesRepresentativeNC, "for PBG-Hom", FamRangeEqFamElm, [ IsPreimagesByAsGroupGeneralMappingByImages, IsMultiplicativeElementWithInverse ], 0, function( hom, elm ) @@ -264,8 +265,20 @@ function( hom, elm ) # group return ImagesRepresentative( RestrictedInverseGeneralMapping( hom ), elm ); else - return PreImagesRepresentative( AsGroupGeneralMappingByImages( hom ), elm ); + return PreImagesRepresentativeNC( AsGroupGeneralMappingByImages( hom ), elm ); + fi; +end ); + +InstallMethod( PreImagesRepresentative, "for PBG-Hom", FamRangeEqFamElm, + [ IsPreimagesByAsGroupGeneralMappingByImages, + IsMultiplicativeElementWithInverse ], 0, +function( hom, elm ) + if not ( elm in Range( hom ) ) then + Error( " is not in the range of mapping " ); + elif not ( elm in Image( hom ) ) then + return fail; fi; + return PreImagesRepresentativeNC( hom, elm ); end ); InstallAttributeMethodByGroupGeneralMappingByImages( CoKernelOfMultiplicativeGeneralMapping ); @@ -875,9 +888,10 @@ InstallMethod( ImagesRepresentative, ############################################################################# ## +#M PreImagesRepresentativeNC( , ) . . . . . . . . . . . for GHBI #M PreImagesRepresentative( , ) . . . . . . . . . . . . for GHBI ## -InstallMethod( PreImagesRepresentative, +InstallMethod( PreImagesRepresentativeNC, "for GHBI and mult.-elm.-with-inverse", FamRangeEqFamElm, [ IsGroupGeneralMappingByImages, @@ -890,6 +904,19 @@ InstallMethod( PreImagesRepresentative, fi; end ); +InstallMethod( PreImagesRepresentative, + "for GHBI and mult.-elm.-with-inverse", + FamRangeEqFamElm, + [ IsGroupGeneralMappingByImages, + IsMultiplicativeElementWithInverse ], 0, +function( hom, elm ) + if not ( elm in Range( hom ) ) then + Error( " is not in the range of mapping " ); + elif not ( elm in Image( hom ) ) then + return fail; + fi; + return PreImagesRepresentativeNC( hom, elm ); +end ); ############################################################################# ## @@ -1225,9 +1252,10 @@ InstallMethod( ImagesSet, ############################################################################# ## +#M PreImagesRepresentativeNC( , ) . . . for conjugator isomorphism #M PreImagesRepresentative( , ) . . . . for conjugator isomorphism ## -InstallMethod( PreImagesRepresentative, +InstallMethod( PreImagesRepresentativeNC, "for conjugator isomorphism", FamRangeEqFamElm, [ IsConjugatorIsomorphism, IsMultiplicativeElementWithInverse ], 0, @@ -1235,12 +1263,26 @@ InstallMethod( PreImagesRepresentative, return g ^ ( ConjugatorOfConjugatorIsomorphism( hom ) ^ -1 ); end ); +InstallMethod( PreImagesRepresentative, + "for conjugator isomorphism", + FamRangeEqFamElm, + [ IsConjugatorIsomorphism, IsMultiplicativeElementWithInverse ], 0, +function( hom, g ) + if not ( g in Range( hom ) ) then + Error( " is not in the range of mapping " ); + elif not ( g in Image( hom ) ) then + return fail; + fi; + return PreImagesRepresentativeNC( hom, g ); +end ); + ############################################################################# ## +#M PreImagesSetNC( , ) . . . . . . . . for conjugator isomorphism #M PreImagesSet( , ) . . . . . . . . . for conjugator isomorphism ## -InstallMethod( PreImagesSet, +InstallMethod( PreImagesSetNC, "for conjugator isomorphism, and group", CollFamRangeEqFamElms, [ IsConjugatorIsomorphism, IsGroup ], 0, @@ -1248,6 +1290,17 @@ InstallMethod( PreImagesSet, return U ^ ( ConjugatorOfConjugatorIsomorphism( hom ) ^ -1 ); end ); +InstallMethod( PreImagesSet, + "for conjugator isomorphism, and group", + CollFamRangeEqFamElms, + [ IsConjugatorIsomorphism, IsGroup ], 0, +function( hom, U ) + if not IsSubset( Range( hom ), U ) then + Error( " is not a subset of the range of mapping " ); + fi; + return PreImagesSetNC( hom, Intersection( U, Image( hom ) ) ); +end ); + ############################################################################# ## diff --git a/lib/ghomfp.gi b/lib/ghomfp.gi index dc2e436af7..7bdc307d4d 100644 --- a/lib/ghomfp.gi +++ b/lib/ghomfp.gi @@ -441,7 +441,7 @@ local q,r,tg,dtg,pemb,ugens,g,gi,d,o,gens,genims,i,gr,img,l,mapi; #better: orbit algo #r:=ShallowCopy(RightTransversal(q,qu)); #Sort(r,function(a,b) return 1^a<1^b;end); - #r:=List(r,i->PreImagesRepresentative(beta,i)); + #r:=List(r,i->PreImagesRepresentativeNC(beta,i)); # compute transversal with short words from orbit algorithm on points o:=[1]; @@ -527,9 +527,10 @@ end); ############################################################################# ## +#M PreImagesSetNC( , ) #M PreImagesSet( , ) ## -InstallMethod( PreImagesSet, "map from (sub)group of fp group", +InstallMethod( PreImagesSetNC, "map from (sub)group of fp group", CollFamRangeEqFamElms, [ IsFromFpGroupHomomorphism,IsGroup ],0, function(hom,u) @@ -624,6 +625,16 @@ local s,gens,t,p,w,c,q,chom,tg,thom,hi,i,lp,max; return SubgroupOfWholeGroupByQuotientSubgroup(FamilyObj(s),u,Stabilizer(u,1)); end); +InstallMethod( PreImagesSet, "map from (sub)group of fp group", + CollFamRangeEqFamElms, + [ IsFromFpGroupHomomorphism,IsGroup ],0, +function(hom,u) + if not IsSubset( Range(hom), u ) then + Error( " is not a subset of the range of " ); + fi; + return PreImagesSetNC( hom, Intersection( u, Image(hom) ) ); +end); + ############################################################################# ## @@ -718,9 +729,10 @@ end); ############################################################################# ## +#M PreImagesRepresentativeNC #M PreImagesRepresentative ## -InstallMethod( PreImagesRepresentative, +InstallMethod( PreImagesRepresentativeNC, "hom. to standard generators of fp group, using 'MappedWord'", FamRangeEqFamElm, [IsToFpGroupHomomorphismByImages,IsMultiplicativeElementWithInverse], @@ -747,6 +759,21 @@ local mapi; return mapi; end); +InstallMethod( PreImagesRepresentative, + "hom. to standard generators of fp group, using 'MappedWord'", + FamRangeEqFamElm, + [IsToFpGroupHomomorphismByImages,IsMultiplicativeElementWithInverse], + 1, +function(hom,elm) + if not (elm in Range(hom)) then + Error( " is not in the range of mapping " ); + elif not (elm in Image(hom)) then + return fail; + fi; + return PreImagesRepresentativeNC(hom,elm); +end); + + ############################################################################# ## ## methods to construct homomorphisms to fp groups @@ -1291,7 +1318,7 @@ local v,aiu,aiv,G,primes,irrel,ma,mao,mau,a,k,gens,imgs,q,dec,deco,piv,co; fi; gens:=SmallGeneratingSet(a); - imgs:=List(gens,x->Image(mau,Image(hom,PreImagesRepresentative(ma,x)))); + imgs:=List(gens,x->Image(mau,Image(hom,PreImagesRepresentativeNC(ma,x)))); q:=GroupHomomorphismByImages(a,Image(mau),gens,imgs); k:=KernelOfMultiplicativeGeneralMapping(q); @@ -1302,7 +1329,7 @@ local v,aiu,aiv,G,primes,irrel,ma,mao,mau,a,k,gens,imgs,q,dec,deco,piv,co; dec:=EpimorphismFromFreeGroup(Group(gens)); deco:=function(x) local i; - x:=ExponentSums(PreImagesRepresentative(dec,x)); + x:=ExponentSums(PreImagesRepresentativeNC(dec,x)); for i in [1..Length(aiv)] do x[i]:=x[i] mod aiv[i]; od; @@ -1339,7 +1366,7 @@ local hom,pcgs,impcgs; impcgs:=FamilyPcgs(Image(hom,M)); pcgs:=PcgsByPcSequenceCons(IsPcgsDefaultRep,IsModuloPcgsFpGroupRep, ElementsFamily(FamilyObj(M)), - List(impcgs,i->PreImagesRepresentative(hom,i)), + List(impcgs,i->PreImagesRepresentativeNC(hom,i)), [] ); pcgs!.hom:=hom; diff --git a/lib/ghompcgs.gi b/lib/ghompcgs.gi index 4daa70ad6b..c8fc3f27e0 100644 --- a/lib/ghompcgs.gi +++ b/lib/ghompcgs.gi @@ -503,9 +503,10 @@ end); ############################################################################# ## +#M PreImagesRepresentativeNC( , ) . . . . . . . . . . via images #M PreImagesRepresentative( , ) . . . . . . . . . . . via images ## -InstallMethod( PreImagesRepresentative, "method for pcgs hom", +InstallMethod( PreImagesRepresentativeNC, "method for pcgs hom", FamRangeEqFamElm, [ IsToPcGroupHomomorphismByImages,IsMultiplicativeElementWithInverse ], 0, function( hom, elm ) @@ -530,6 +531,18 @@ function( hom, elm ) return pre; end); +InstallMethod( PreImagesRepresentative, "method for pcgs hom", + FamRangeEqFamElm, + [ IsToPcGroupHomomorphismByImages,IsMultiplicativeElementWithInverse ], 0, +function( hom, elm ) + if not ( elm in Range( hom ) ) then + Error( " is not in the range of mapping " ); + elif not ( elm in Image( hom ) ) then + return fail; + fi; + return PreImagesRepresentativeNC( hom, elm ); +end ); + ############################################################################# ## #M NaturalHomomorphismByNormalSubgroup( , ) . . . . . . for pc groups @@ -627,9 +640,10 @@ end ); ############################################################################# ## +#M PreImagesRepresentativeNC( , ) . . . . . . . . . via depth map #M PreImagesRepresentative( , ) . . . . . . . . . . via depth map ## -InstallMethod( PreImagesRepresentative, FamRangeEqFamElm, +InstallMethod( PreImagesRepresentativeNC, FamRangeEqFamElm, [ IsPcgsToPcgsHomomorphism,IsMultiplicativeElementWithInverse ], 0, function( hom, elm ) local exp; @@ -637,6 +651,17 @@ local exp; return PcElementByExponentsNC( hom!.rangePcgsPreImages, exp ); end ); +InstallMethod( PreImagesRepresentative, FamRangeEqFamElm, + [ IsPcgsToPcgsHomomorphism,IsMultiplicativeElementWithInverse ], 0, +function( hom, elm ) + if not ( elm in Range( hom ) ) then + Error( " is not in the range of mapping " ); + elif not ( elm in Image( hom ) ) then + return fail; + fi; + return PreImagesRepresentativeNC( hom, elm ); +end ); + ############################################################################# ## #M = . . . . . . . . . . . . . . . . . . . . . . . . for GHBI diff --git a/lib/ghomperm.gi b/lib/ghomperm.gi index 204bafc24e..b094c0d397 100644 --- a/lib/ghomperm.gi +++ b/lib/ghomperm.gi @@ -11,9 +11,10 @@ ############################################################################# ## -#M PreImagesSet( , ) . for s.p. gen. mapping resp. mult. & inv. +#M PreImagesSetNC( , ) . for s.p. gen. mapping resp. mult. & inv. +#M PreImagesSet( , ) . . for s.p. gen. mapping resp. mult. & inv. ## -InstallMethod( PreImagesSet, +InstallMethod( PreImagesSetNC, "method for permgroup homs", CollFamRangeEqFamElms, [ IsPermGroupHomomorphism, IsGroup ], @@ -22,7 +23,7 @@ local genpreimages, pre,kg,sz,ol,orb,pos,dom,one; genpreimages:=GeneratorsOfMagmaWithInverses( elms ); genpreimages:= List(genpreimages, - gen -> PreImagesRepresentative( map, gen ) ); + gen -> PreImagesRepresentativeNC( map, gen ) ); if fail in genpreimages then TryNextMethod(); fi; @@ -78,6 +79,17 @@ local genpreimages, pre,kg,sz,ol,orb,pos,dom,one; return pre; end ); +InstallMethod( PreImagesSet, + "method for permgroup homs", + CollFamRangeEqFamElms, + [ IsPermGroupHomomorphism, IsGroup ], +function( map, elms ) + if not IsSubgroup( Range( map ), elms ) then + Error( " is not a subgroup of the range of " ); + fi; + return PreImagesSetNC( map, Intersection( elms, Image( map ) ) ); +end ); + ############################################################################# ## #F AddGeneratorsGenimagesExtendSchreierTree( , , ) . . @@ -1152,7 +1164,7 @@ local r, fgens, gens, kg; fi; fgens:=ShallowCopy(GeneratorsOfGroup(r)); gens:=List(fgens, - i->PreImagesRepresentative(hom2,PreImagesRepresentative(hom1,i))); + i->PreImagesRepresentativeNC(hom2,PreImagesRepresentativeNC(hom1,i))); kg:=GeneratorsOfGroup(KernelOfMultiplicativeGeneralMapping(hom2)); Append(gens,kg); Append(fgens,List(kg,i->One(r))); @@ -1162,15 +1174,28 @@ end); ############################################################################# ## +#M PreImagesRepresentativeNC( , ) . . . . . for perm group range #M PreImagesRepresentative( , ) . . . . . . for perm group range ## -InstallMethod( PreImagesRepresentative, FamRangeEqFamElm, +InstallMethod( PreImagesRepresentativeNC, FamRangeEqFamElm, [ IsToPermGroupGeneralMappingByImages, IsMultiplicativeElementWithInverse ], 0, function( hom, elm ) return ImagesRepresentative( RestrictedInverseGeneralMapping( hom ), elm ); end ); +InstallMethod( PreImagesRepresentative, FamRangeEqFamElm, + [ IsToPermGroupGeneralMappingByImages, + IsMultiplicativeElementWithInverse ], 0, + function( hom, elm ) + if not ( elm in Range( hom ) ) then + Error( " is not in the range of mapping " ); + elif not ( elm in Image( hom ) ) then + return fail; + fi; + return PreImagesRepresentativeNC( hom, elm ); +end ); + ############################################################################# ## #F StabChainPermGroupToPermGroupGeneralMappingByImages( ) . . . local @@ -1570,9 +1595,10 @@ InstallMethod( ImagesSource,"constituent homomorphism",true, ############################################################################# ## +#M PreImagesRepresentativeNC( , ) #M PreImagesRepresentative( , ) ## -InstallMethod( PreImagesRepresentative,"constituent homomorphism", +InstallMethod( PreImagesRepresentativeNC,"constituent homomorphism", FamRangeEqFamElm,[IsConstituentHomomorphism,IsPerm], 0, function( hom, elm ) local D,DP; @@ -1585,11 +1611,23 @@ local D,DP; return RepresentativeAction(Source(hom),D,DP,OnTuples); end); +InstallMethod( PreImagesRepresentative,"constituent homomorphism", + FamRangeEqFamElm,[IsConstituentHomomorphism,IsPerm], 0, +function( hom, elm ) + if not ( elm in Range( hom ) ) then + Error( " is not in the range of mapping " ); + elif not ( elm in Image( hom ) ) then + return fail; + fi; + return PreImagesRepresentativeNC( hom, elm ); +end ); + ############################################################################# ## +#M PreImagesSetNC( , ) . . . . . . . . . . . . . . . for const hom #M PreImagesSet( , ) . . . . . . . . . . . . . . . . for const hom ## -InstallMethod( PreImagesSet, "constituent homomorphism",CollFamRangeEqFamElms, +InstallMethod( PreImagesSetNC, "constituent homomorphism",CollFamRangeEqFamElms, [ IsConstituentHomomorphism, IsPermGroup ], 0, function( hom, I ) local H, # preimage of , result @@ -1602,7 +1640,7 @@ InstallMethod( PreImagesSet, "constituent homomorphism",CollFamRangeEqFamElms, # create the preimage group H := EmptyStabChain( [ ], One( Source( hom ) ) ); S := ConjugateStabChain( StabChainMutable( I ), H, x -> - PreImagesRepresentative( hom, x ), hom!.conperm ^ -1 ); + PreImagesRepresentativeNC( hom, x ), hom!.conperm ^ -1 ); T := H; while IsBound( T.stabilizer ) do AddGeneratorsExtendSchreierTree( T, GeneratorsOfGroup( K ) ); @@ -1618,6 +1656,15 @@ InstallMethod( PreImagesSet, "constituent homomorphism",CollFamRangeEqFamElms, return GroupStabChain( Source( hom ), H, true ); end ); +InstallMethod( PreImagesSet, "constituent homomorphism",CollFamRangeEqFamElms, + [ IsConstituentHomomorphism, IsPermGroup ], 0, + function( hom, I ) + if not IsSubset( Range( hom ), I ) then + Error( " is not a subset of the range of mapping " ); + fi; + return PreImagesSetNC( hom, Intersection( I, Image( hom ) ) ); +end ); + ############################################################################# ## #M KernelOfMultiplicativeGeneralMapping( ) . . . . . . . for const hom @@ -1825,9 +1872,10 @@ end ); ############################################################################# ## +#M PreImagesRepresentativeNC( , ) . . . . . . . . for blocks hom #M PreImagesRepresentative( , ) . . . . . . . . . for blocks hom ## -InstallMethod( PreImagesRepresentative, "blocks homomorphism", +InstallMethod( PreImagesRepresentativeNC, "blocks homomorphism", FamRangeEqFamElm, [ IsBlocksHomomorphism, IsMultiplicativeElementWithInverse ], 0, function( hom, elm ) @@ -1875,11 +1923,24 @@ InstallMethod( PreImagesRepresentative, "blocks homomorphism", return pre; end) ; +InstallMethod( PreImagesRepresentative, "blocks homomorphism", + FamRangeEqFamElm, + [ IsBlocksHomomorphism, IsMultiplicativeElementWithInverse ], 0, + function( hom, elm ) + if not ( elm in Range( hom ) ) then + Error( " is not in the range of mapping " ); + elif not ( elm in Image( hom ) ) then + return fail; + fi; + return PreImagesRepresentativeNC( hom, elm ); +end ); + ############################################################################# ## +#M PreImagesSetNC( , ) . . . . . . . . . . . . . . for blocks hom #M PreImagesSet( , ) . . . . . . . . . . . . . . . for blocks hom ## -InstallMethod( PreImagesSet, CollFamRangeEqFamElms, +InstallMethod( PreImagesSetNC, CollFamRangeEqFamElms, [ IsBlocksHomomorphism, IsPermGroup ], 0, function( hom, I ) local H; # preimage of under , result @@ -1888,6 +1949,15 @@ InstallMethod( PreImagesSet, CollFamRangeEqFamElms, return GroupStabChain( Source( hom ), H, true ); end ); +InstallMethod( PreImagesSet, CollFamRangeEqFamElms, + [ IsBlocksHomomorphism, IsPermGroup ], 0, + function( hom, I ) + if not IsSubset( Range( hom ), I ) then + Error( " is not a subset of the range of mapping " ); + fi; + return PreImagesSetNC( hom, Intersection( I, Image( hom ) ) ); +end ); + ############################################################################# ## #F PreImageSetStabBlocksHomomorphism( , ) . . . recursive function @@ -1913,7 +1983,7 @@ InstallGlobalFunction( PreImageSetStabBlocksHomomorphism, function( hom, I ) H := PreImageSetStabBlocksHomomorphism( hom, I.stabilizer ); ChangeStabChain( H, [ pnt ], false ); for gen in I.generators do - pre := PreImagesRepresentative( hom, gen ); + pre := PreImagesRepresentativeNC( hom, gen ); if not IsBound( H.translabels[ pnt ^ pre ] ) then AddGeneratorsExtendSchreierTree( H, [ pre ] ); fi; diff --git a/lib/gpfpiso.gi b/lib/gpfpiso.gi index 9bef6090f5..35ccf559cf 100644 --- a/lib/gpfpiso.gi +++ b/lib/gpfpiso.gi @@ -94,7 +94,7 @@ local l,iso,fp,stbc,gens; fp:=IsomorphismFpGroup(l); iso:=GroupHomomorphismByImagesNC(G,Range(fp), List(MappingGeneratorsImages(fp)[1], - i->PreImagesRepresentative(iso,i)), + i->PreImagesRepresentativeNC(iso,i)), MappingGeneratorsImages(fp)[2]); SetIsBijective(iso,true); return iso; @@ -174,8 +174,8 @@ function( G, str ) IsNaturalAlternatingGroup(H); new:=IsomorphismFpGroup(H,"@"); gensH:=List(GeneratorsOfGroup(Image(new)), - i->PreImagesRepresentative(new,i)); - preiH := List( gensH, x -> PreImagesRepresentative( hom, x ) ); + i->PreImagesRepresentativeNC(new,i)); + preiH := List( gensH, x -> PreImagesRepresentativeNC( hom, x ) ); c := Length( gensH ); @@ -193,7 +193,7 @@ function( G, str ) w := MappedWord( rel, gensT, gensE{[1..c]} ); t := MappedWord( rel, gensT, imgsE{[1..c]} ); if not t = One( G ) then - t := PreImagesRepresentative( free, t ); + t := PreImagesRepresentativeNC( free, t ); t := MappedWord( t, gensF, gensE{[c+1..n+c]} ); else t := One( E ); @@ -207,7 +207,7 @@ function( G, str ) w := Comm( gensE[c+j], gensE[i] ); t := Comm( imgsE[c+j], imgsE[i] ); if not t = One( G ) then - t := PreImagesRepresentative( free, t ); + t := PreImagesRepresentativeNC( free, t ); t := MappedWord( t, gensF, gensE{[c+1..n+c]} ); else t := One( E ); @@ -303,7 +303,7 @@ function(g,str,N) gens:=Union(gens,Union(List(ser,SmallGeneratingSet))); fi; if f<>g then - gens:=List(gens,x->PreImagesRepresentative(hom,x)); + gens:=List(gens,x->PreImagesRepresentativeNC(hom,x)); ser:=List(ser,x->PreImage(hom,x)); fi; # change generators to make split @@ -408,7 +408,8 @@ function(g,str,N) fgens:=GeneratorsOfGroup(f); auts:=List(GeneratorsOfGroup(g),i-> GroupHomomorphismByImagesNC(f,f,fgens, - List(fgens,j->Image(hom,PreImagesRepresentative(hom,j)^i)):noassert)); + List(fgens, + j->Image(hom,PreImagesRepresentativeNC(hom,j)^i)):noassert)); for j in auts do SetIsBijective(j,true); od; @@ -437,7 +438,7 @@ function(g,str,N) else a:=IsomorphismFpGroup(sf:noassert); fi; - ad:=List(GeneratorsOfGroup(Range(a)),i->PreImagesRepresentative(a,i)); + ad:=List(GeneratorsOfGroup(Range(a)),i->PreImagesRepresentativeNC(a,i)); lad:=Length(ad); n:=Length(orb); @@ -472,7 +473,7 @@ function(g,str,N) fp:=fg/rels; a:=GroupHomomorphismByImagesNC(f,fp,fgens,GeneratorsOfGroup(fp):noassert); fi; - Append(gens,List(fgens,i->PreImagesRepresentative(hom,i))); + Append(gens,List(fgens,i->PreImagesRepresentativeNC(hom,i))); # here we really want a composed homomorphism, to avoid extra work for # a new stabilizer chain @@ -651,7 +652,7 @@ local fpq, qgens, qreps, fpqg, rels, pcgs, p, f, qimg, idx, nimg, decomp, ngen, fp, hom2, di, source, dih, dec, i, j; fpq:=Range(hom); qgens:=GeneratorsOfGroup(fpq); - qreps:=List(qgens,i->PreImagesRepresentative(hom,i)); + qreps:=List(qgens,i->PreImagesRepresentativeNC(hom,i)); fpqg:=FreeGeneratorsOfFpGroup(fpq); rels:=[]; if IsModuloPcgs(mnsf) then @@ -705,7 +706,7 @@ local fpq, qgens, qreps, fpqg, rels, pcgs, p, f, qimg, idx, nimg, decomp, ngen:=FreeGeneratorsOfFpGroup(p); # This is not really a pcgs, but treated as layer generators the same # way, thus use the same variable name - pcgs:=List(GeneratorsOfGroup(p),i->PreImagesRepresentative(mnsf,i)); + pcgs:=List(GeneratorsOfGroup(p),i->PreImagesRepresentativeNC(mnsf,i)); f:=FreeGroup(Length(fpqg)+Length(pcgs)); qimg:=GeneratorsOfGroup(f){[1..Length(fpqg)]}; idx:=[Length(fpqg)+1..Length(fpqg)+Length(pcgs)]; @@ -977,7 +978,7 @@ function( G, series, str ) gensH := GeneratorsOfGroup( H ); gensH := Filtered( gensH, x -> x <> One(H) ); - preiH := List( gensH, x -> PreImagesRepresentative( hom, x ) ); + preiH := List( gensH, x -> PreImagesRepresentativeNC( hom, x ) ); c := Length( gensH ); # compute presentation of H @@ -1000,7 +1001,7 @@ function( G, series, str ) w := MappedWord( rel, gensT, gensE{[1..c]} ); t := MappedWord( rel, gensT, imgsE{[1..c]} ); if not t = One( G ) then - t := PreImagesRepresentative( free, t ); + t := PreImagesRepresentativeNC( free, t ); t := MappedWord( t, gensF, gensE{[c+1..n+c]} ); else t := One( E ); @@ -1014,7 +1015,7 @@ function( G, series, str ) w := Comm( gensE[c+j], gensE[i] ); t := Comm( imgsE[c+j], imgsE[i] ); if not t = One( G ) then - t := PreImagesRepresentative( free, t ); + t := PreImagesRepresentativeNC( free, t ); t := MappedWord( t, gensF, gensE{[c+1..n+c]} ); else t := One( E ); @@ -1239,8 +1240,8 @@ local iso,fp,dec,homs,mos,i,j,ffp,imo,m,k,gens,fm,mgens,rules, for r in Rules(k) do left:=MappedWord(r[1],FreeGeneratorsOfFpMonoid(m),monreps); right:=MappedWord(r[2],FreeGeneratorsOfFpMonoid(m),monreps); - diff:=LeftQuotient(PreImagesRepresentative(iso,right), - PreImagesRepresentative(iso,left)); + diff:=LeftQuotient(PreImagesRepresentativeNC(iso,right), + PreImagesRepresentativeNC(iso,left)); diff:=ImagesRepresentative(iso,diff); left:=MappedWord(r[1],FreeGeneratorsOfFpMonoid(m),monreal); @@ -1259,7 +1260,7 @@ local iso,fp,dec,homs,mos,i,j,ffp,imo,m,k,gens,fm,mgens,rules, if reduce(mgens[k])=mgens[k] then right:=fmgens[j]^-1*fmgens[k]*fmgens[j]; #collect - right:=ImagesRepresentative(iso,PreImagesRepresentative(iso,right)); + right:=ImagesRepresentative(iso,PreImagesRepresentativeNC(iso,right)); right:=Product(List(LetterRepAssocWord(UnderlyingElement(right)), x->mgens[Position(nums,x)])); right:=reduce(mgens[j]*right); @@ -1331,7 +1332,7 @@ local pcgs,iso,fp,i,j,gens,numi,ord,fm,fam,mword,k,r,addrule,a,e,m; pcgs:=Pcgs(G); iso:=IsomorphismFpGroup(G); fp:=Range(iso); - if List(GeneratorsOfGroup(fp),x->PreImagesRepresentative(iso,x))<>pcgs then + if List(GeneratorsOfGroup(fp),x->PreImagesRepresentativeNC(iso,x))<>pcgs then Error("pcgs"); fi; gens:=[]; @@ -1531,7 +1532,7 @@ local iso,n,fn,sz,bigcount,tryweyl; iso:=IsomorphismGroups(G,P); if iso<>fail then P:=List(GeneratorsOfGroup(H), - x->PreImagesRepresentative(iso,ImagesRepresentative(isp,x))); + x->PreImagesRepresentativeNC(iso,ImagesRepresentative(isp,x))); iso:=GroupHomomorphismByImagesNC(G,H,P,GeneratorsOfGroup(H)); fi; return iso; @@ -1739,13 +1740,13 @@ local isob,isos,iso,gens,a,rels,l,i,j,bgens,cb,cs,b,f,k,w,monoid, # force going to pc group, as this will give better ordering isob:=GroupHomomorphismByFunction(borel,Range(cb.fphom), x->ImagesRepresentative(cb.fphom,ImagesRepresentative(pciso,x)), - x->PreImagesRepresentative(pciso,PreImagesRepresentative(cb.fphom,x))); + x->PreImagesRepresentativeNC(pciso,PreImagesRepresentativeNC(cb.fphom,x))); b:=Range(isob); wgens:=GeneratorsOfGroup(weyl); - bgens:=List(GeneratorsOfGroup(b),x->PreImagesRepresentative(isob,x)); + bgens:=List(GeneratorsOfGroup(b),x->PreImagesRepresentativeNC(isob,x)); if newstyle and bgens<>GeneratorsOfGroup(borel) then Error("gens");fi; bpairs:=Concatenation(List(bgens,x->[x,x^-1])); @@ -1890,7 +1891,7 @@ local isob,isos,iso,gens,a,rels,l,i,j,bgens,cb,cs,b,f,k,w,monoid, x:=UnderlyingElement(ImagesRepresentative(cb.monhom,x)); x:=reduce(x,RelationsOfFpMonoid(monoid),mdag,fail); x:=ElementOfFpMonoid(FamilyObj(One(monoid)),x); - return PreImagesRepresentative(cb.monhom,x); + return PreImagesRepresentativeNC(cb.monhom,x); end; mdag:=EmptyKBDAG(Union(List(FreeGeneratorsOfFpMonoid(monoid), @@ -1935,7 +1936,7 @@ local isob,isos,iso,gens,a,rels,l,i,j,bgens,cb,cs,b,f,k,w,monoid, x:=UnderlyingElement(ImagesRepresentative(cs.monhom,x)); x:=reduce(x,RelationsOfFpMonoid(Range(cs.monhom)),wdag,fail); x:=ElementOfFpMonoid(FamilyObj(One(Range(cs.monhom))),x); - return PreImagesRepresentative(cs.monhom,x); + return PreImagesRepresentativeNC(cs.monhom,x); end; wdag:=EmptyKBDAG(Union(List(FreeGeneratorsOfFpMonoid(Range(cs.monhom)), @@ -1977,7 +1978,7 @@ local isob,isos,iso,gens,a,rels,l,i,j,bgens,cb,cs,b,f,k,w,monoid, a:=Group(SmallGeneratingSet(group)); # so nothing stores csetperm:=List(GeneratorsOfGroup(a),x->Permutation(x,rt,OnRight)); iso:=EpimorphismFromFreeGroup(a); - csetperm:=List(bgens,x->MappedWord(PreImagesRepresentative(iso,x), + csetperm:=List(bgens,x->MappedWord(PreImagesRepresentativeNC(iso,x), MappingGeneratorsImages(iso)[1],csetperm)); act:=Group(csetperm,()); @@ -2025,7 +2026,7 @@ local isob,isos,iso,gens,a,rels,l,i,j,bgens,cb,cs,b,f,k,w,monoid, a:=PositionCanonical(rt,elm); b:=rti[a]; rep:=RepresentativeAction(Image(bhom),a,dcnums[b][1]); - rep:=PreImagesRepresentative(bhom,rep); + rep:=PreImagesRepresentativeNC(bhom,rep); if single then a:=[CanonicalRightCosetElement(ac[1],rt[dcnums[b][1]]),rep]; else @@ -2085,9 +2086,8 @@ local isob,isos,iso,gens,a,rels,l,i,j,bgens,cb,cs,b,f,k,w,monoid, # a:=Group(SmallGeneratingSet(group)); # so nothing stores # csetperm:=List(GeneratorsOfGroup(a),x->Permutation(x,rt,OnRight)); # iso:=EpimorphismFromFreeGroup(a); -# csetperm:=List(bgens,x->MappedWord(PreImagesRepresentative(iso,x),MappingGeneratorsImages(iso)[1],csetperm)); -# act:=Group(csetperm,()); -# +# csetperm:=List(bgens,x->MappedWord(PreImagesRepresentativeNC(iso,x), +# MappingGeneratorsImages(iso)[1],csetperm)); act:=Group(csetperm,()); # bhom:=GroupHomomorphismByImagesNC(borel,act,bgens,csetperm); # #Assert(0,bhom<>fail); # @@ -2130,7 +2130,7 @@ local isob,isos,iso,gens,a,rels,l,i,j,bgens,cb,cs,b,f,k,w,monoid, # pos:=rti[PositionCanonical(rt,elm)]; # #rep:=RepresentativeAction(borel,PositionCanonical(rt,elm), # # PositionCanonical(rt,dcreps[pos]),bgens,csetperm,OnPoints); -# rep:=PreImagesRepresentative(bhom, +# rep:=PreImagesRepresentativeNC(bhom, # RepresentativeAction(Range(bhom),PositionCanonical(rt,elm), # PositionCanonical(rt,dcreps[pos]))); # rep:=[elm*rep/dcreps[pos],dcreps[pos],rep^-1]; @@ -2452,7 +2452,7 @@ if rule[1]=rule[2] then return;fi; else # BN-style reductions - pcgs:=List(GeneratorsOfGroup(b),x->PreImagesRepresentative(isob,x)); + pcgs:=List(GeneratorsOfGroup(b),x->PreImagesRepresentativeNC(isob,x)); # remove powers pcgs:=pcgs{ Filtered([1..Length(pcgs)],i->not ForAny([1..i-1], @@ -2466,7 +2466,7 @@ if rule[1]=rule[2] then return;fi; # which elements b*i can we write as i*\tilde b. Then b^i=\tilde b, that # is b\in B\cvap B^(i^-1) - pri:=PreImagesRepresentative(isos,i); + pri:=PreImagesRepresentativeNC(isos,i); stb:=Intersection(borel,borel^(pri^-1)); Info(InfoFpGroup,2,i," ",Size(stb)); @@ -2522,14 +2522,14 @@ if rule[1]=rule[2] then return;fi; Info(InfoFpGroup,3,"borelrun ",Position(wo,i)," of ",Length(wo)); # rewrite i*b*j as \tilde b*k*\hat b. - pri:=PreImagesRepresentative(isos,i); + pri:=PreImagesRepresentativeNC(isos,i); stb:=Intersection(borel^pri,borel); for j in wo do Info(InfoFpGroup,2,"DC:",i,", ",j," from ",Length(rels)); for k in borelelm do #RightTransversal(borel,stb) do - a:=PreImagesRepresentative(isos,i)*k* - PreImagesRepresentative(isos,j); + a:=PreImagesRepresentativeNC(isos,i)*k* + PreImagesRepresentativeNC(isos,j); a:=decomp(a); a:=[nofob(ImagesRepresentative(isob,a[1])), nofow(ImagesRepresentative(isos,a[2])), @@ -2695,7 +2695,7 @@ end); # if List(mg,x->LetterRepAssocWord(UnderlyingElement(x)))<> # List([1..Length(mg)],x->[x]) then Error("gens!"); fi; # pre:=List(mg,x->LetterRepAssocWord(UnderlyingElement( -# PreImagesRepresentative(miso,x)))); +# PreImagesRepresentativeNC(miso,x)))); # if ForAny(pre,x->Length(x)<>1) then Error("double");fi; # Add(l,Concatenation(pre)); # if IsBound(m!.rewritingSystem) then @@ -2907,7 +2907,7 @@ local d,f,group,act,g,sy,b,c,borel,weyl,a,i,iso,ucs,gens,gl; fi; c:=c[1]; a:=SubgroupNC(group,List(GeneratorsOfGroup(weyl), - x->PreImagesRepresentative(c,x))); + x->PreImagesRepresentativeNC(c,x))); Size(a); a!.epiweyl:=weyl; weyl:=a; diff --git a/lib/gpprmsya.gi b/lib/gpprmsya.gi index f2f0276e05..72b65a64ba 100644 --- a/lib/gpprmsya.gi +++ b/lib/gpprmsya.gi @@ -1265,7 +1265,7 @@ syll, act, typ, sel, bas, wdom, comp, lperm, other, away, i, j,b0,opg,bp; w:=AutomorphismGroup(b); opg:=NaturalHomomorphismByNormalSubgroupNC(w, InnerAutomorphismsAutomorphismGroup(w)); - ll:=List(AsSSortedList(Image(opg)),x->PreImagesRepresentative(opg,x)); + ll:=List(AsSSortedList(Image(opg)),x->PreImagesRepresentativeNC(opg,x)); ll:=Filtered(ll,IsConjugatorAutomorphism); ll:=List(ll,ConjugatorInnerAutomorphism); pg:=b; diff --git a/lib/gprd.gi b/lib/gprd.gi index e32bf13af7..49b091d983 100644 --- a/lib/gprd.gi +++ b/lib/gprd.gi @@ -715,7 +715,7 @@ InstallGlobalFunction(InnerSubdirectProducts2,function( D, U, V ) # and obtain double coset reps reps := List( DoubleCosets( P, autU, autV ), Representative ); - reps := List( reps, x -> PreImagesRepresentative( gamma, x ) ); + reps := List( reps, x -> PreImagesRepresentativeNC( gamma, x ) ); # loop over automorphisms for rep in reps do @@ -724,9 +724,9 @@ InstallGlobalFunction(InnerSubdirectProducts2,function( D, U, V ) gens := Concatenation( GeneratorsOfGroup( N ), GeneratorsOfGroup( M ) ); for r in GeneratorsOfGroup( UN ) do - g := PreImagesRepresentative( pair[1], r ); + g := PreImagesRepresentativeNC( pair[1], r ); h := Image( iso, Image( rep, r ) ); - h := PreImagesRepresentative( pair[2], h ); + h := PreImagesRepresentativeNC( pair[2], h ); Add( gens, g * h ); od; S := SubgroupNC( D, gens ); @@ -1094,7 +1094,7 @@ local info,map,U,mapfun,P; function(elm) elm:=elm![n]; if n>info.degI then - elm:=PreImagesRepresentative(info.alpha,elm); + elm:=PreImagesRepresentativeNC(info.alpha,elm); fi; return elm; end); @@ -1118,7 +1118,7 @@ local info,map,np; map:=GroupHomomorphismByFunction(G,info.groups[2], function(elm) - return PreImagesRepresentative(info.alpha,elm![np]); + return PreImagesRepresentativeNC(info.alpha,elm![np]); end, false, # not bijective function(elm) @@ -1179,7 +1179,7 @@ local giso,niso,P,gens,a,Go,No,i; N:=Image(niso,N); gens:=[]; for i in GeneratorsOfGroup(G) do - i:=Image(aut,PreImagesRepresentative(giso,i)); + i:=Image(aut,PreImagesRepresentativeNC(giso,i)); i:=InducedAutomorphism(niso,i); Add(gens,i); od; @@ -1220,9 +1220,9 @@ local Go,No,giso,niso,FG,GP,FN,NP,F,GI,NI,rels,i,j,P; N:=Image(niso,N); FG:=FreeGeneratorsOfFpGroup(G); - GP:=List(GeneratorsOfGroup(G),x->PreImagesRepresentative(giso,x)); + GP:=List(GeneratorsOfGroup(G),x->PreImagesRepresentativeNC(giso,x)); FN:=FreeGeneratorsOfFpGroup(N); - NP:=List(GeneratorsOfGroup(N),x->PreImagesRepresentative(niso,x)); + NP:=List(GeneratorsOfGroup(N),x->PreImagesRepresentativeNC(niso,x)); F:=FreeGroup(List(Concatenation(FG,FN),String)); GI:=GeneratorsOfGroup(F){[1..Length(FG)]}; diff --git a/lib/gprdmat.gi b/lib/gprdmat.gi index 2480d861d1..a94623e6ac 100644 --- a/lib/gprdmat.gi +++ b/lib/gprdmat.gi @@ -143,9 +143,10 @@ end); ############################################################################# ## -#M PreImagesRepresentative(,) . . . . . . . . . . . of embedding +#M PreImagesRepresentativeNC(,) . . . . . . . . . . . of embedding +#M PreImagesRepresentative(,) . . . . . . . . . . . . of embedding ## -InstallMethod(PreImagesRepresentative,"matrix direct product embedding", +InstallMethod(PreImagesRepresentativeNC,"matrix direct product embedding", FamRangeEqFamElm, [ IsEmbeddingDirectProductMatrixGroup, IsMultiplicativeElementWithInverse ], @@ -162,6 +163,19 @@ local info,a,b; fi; end); +InstallMethod(PreImagesRepresentative,"matrix direct product embedding", + FamRangeEqFamElm, + [ IsEmbeddingDirectProductMatrixGroup, + IsMultiplicativeElementWithInverse ], +function(emb,g) + if not (g in Range(emb)) then + Error( " is not in the range of mapping " ); + elif not ( g in Image(emb) ) then + return fail; + fi; + return PreImagesRepresentativeNC(emb,g); +end); + ############################################################################# ## #R IsProjectionDirectProductMatrixGroup() projection onto direct factor @@ -206,9 +220,10 @@ end); ############################################################################# ## -#M PreImagesRepresentative(,) . . . . . . . . . . . of projection +#M PreImagesRepresentativeNC(,) . . . . . . . . . . . of projection +#M PreImagesRepresentative(,) . . . . . . . . . . . . of projection ## -InstallMethod(PreImagesRepresentative,"matrix direct product projection", +InstallMethod(PreImagesRepresentativeNC,"matrix direct product projection", FamRangeEqFamElm, [ IsProjectionDirectProductMatrixGroup, IsMultiplicativeElementWithInverse ],0, @@ -220,6 +235,19 @@ local info,a; return ImmutableMatrix(info.field,a); end); +InstallMethod(PreImagesRepresentative,"matrix direct product projection", + FamRangeEqFamElm, + [ IsProjectionDirectProductMatrixGroup, + IsMultiplicativeElementWithInverse ],0, +function(prj,m) + if not ( m in Range(prj) ) then + Error( " not in the range of mapping " ); + elif not ( m in Image(prj) ) then + return fail; + fi; + return PreImagesRepresentativeNC(prj,m); +end); + ############################################################################# ## #M KernelOfMultiplicativeGeneralMapping() . . . . . . . of projection @@ -382,9 +410,10 @@ end); ############################################################################# ## -#M PreImagesRepresentative( , ) . . . . . . . . . . . of embedding +#M PreImagesRepresentativeNC( , ) . . . . . . . . . . of embedding +#M PreImagesRepresentative( , ) . . . . . . . . . . . of embedding ## -InstallMethod( PreImagesRepresentative, +InstallMethod( PreImagesRepresentativeNC, "imprim matrix wreath product embedding", FamRangeEqFamElm, [ IsEmbeddingImprimitiveWreathProductMatrixGroup, IsMultiplicativeElementWithInverse ], 0, @@ -401,6 +430,18 @@ local info,a,b; fi; end); +InstallMethod( PreImagesRepresentative, + "imprim matrix wreath product embedding", FamRangeEqFamElm, + [ IsEmbeddingImprimitiveWreathProductMatrixGroup, + IsMultiplicativeElementWithInverse ], 0, +function( emb, g ) + if not (g in Range(emb)) then + Error( " is not in the range of mapping " ); + elif not (g in Image(emb)) then + return fail; + fi; + return PreImagesRepresentativeNC(emb,g); +end); ############################################################################# ## diff --git a/lib/gprdpc.gi b/lib/gprdpc.gi index 6994897c39..a17e46436a 100644 --- a/lib/gprdpc.gi +++ b/lib/gprdpc.gi @@ -421,7 +421,7 @@ local pg,ph,kg,kh,ig,ih,mg,mh,S,info; ig:=InducedPcgs(pg,kg); ih:=InducedPcgs(ph,kh); mg:=pg mod ig; - mh:=List(mg,i->PreImagesRepresentative(hh,Image(gh,i))); + mh:=List(mg,i->PreImagesRepresentativeNC(hh,Image(gh,i))); pg:=Concatenation(mg,ig,List(ih,i->One(G))); ph:=Concatenation(mh,List(ig,i->One(H)),ih); S:=SubdirProdPcGroups(G,pg,H,ph); diff --git a/lib/gprdperm.gi b/lib/gprdperm.gi index 327f812adc..e6fc1111aa 100644 --- a/lib/gprdperm.gi +++ b/lib/gprdperm.gi @@ -169,9 +169,10 @@ end ); ############################################################################# ## +#M PreImagesRepresentativeNC( , ) . . . . . . . . . . of embedding #M PreImagesRepresentative( , ) . . . . . . . . . . . of embedding ## -InstallMethod( PreImagesRepresentative, "perm direct product embedding", +InstallMethod( PreImagesRepresentativeNC, "perm direct product embedding", FamRangeEqFamElm, [ IsEmbeddingDirectProductPermGroup, IsMultiplicativeElementWithInverse ], @@ -191,6 +192,19 @@ InstallMethod( PreImagesRepresentative, "perm direct product embedding", fi; end ); +InstallMethod( PreImagesRepresentative, "perm direct product embedding", + FamRangeEqFamElm, + [ IsEmbeddingDirectProductPermGroup, + IsMultiplicativeElementWithInverse ], + function( emb, g ) + if not ( g in Range( emb ) ) then + Error( " is not in the range of mapping " ); + elif not ( g in Image( emb ) ) then + return fail; + fi; + return PreImagesRepresentativeNC( emb, g ); +end ); + ############################################################################# ## #M ImagesSource( ) . . . . . . . . . . . . . . . . . . . of embedding @@ -292,9 +306,10 @@ end ); ############################################################################# ## +#M PreImagesRepresentativeNC( , ) . . . . . . . . . . of projection #M PreImagesRepresentative( , ) . . . . . . . . . . . of projection ## -InstallMethod( PreImagesRepresentative,"perm direct product projection", +InstallMethod( PreImagesRepresentativeNC,"perm direct product projection", FamRangeEqFamElm, [ IsProjectionDirectProductPermGroup, IsMultiplicativeElementWithInverse ], 0, @@ -302,6 +317,19 @@ InstallMethod( PreImagesRepresentative,"perm direct product projection", return g ^ DirectProductInfo( Source( prj ) ).perms[ prj!.component ]; end ); +InstallMethod( PreImagesRepresentative,"perm direct product projection", + FamRangeEqFamElm, + [ IsProjectionDirectProductPermGroup, + IsMultiplicativeElementWithInverse ], 0, + function( prj, g ) + if not ( g in Range( prj ) ) then + Error( " is not in the range of mapping " ); + elif not ( g in Image( prj ) ) then + return fail; + fi; + return PreImagesRepresentativeNC( prj, g ); +end ); + ############################################################################# ## #M KernelOfMultiplicativeGeneralMapping( ) . . . . . . . of projection @@ -388,7 +416,7 @@ InstallMethod( SubdirectProductOp,"permgroup", true, # over the generators of the kernel of $phi_2$. gens := []; for gen in GeneratorsOfGroup( G1 ) do - Add( gens, gen^emb1 * PreImagesRepresentative(phi2,gen^phi1)^emb2 ); + Add( gens, gen^emb1 * PreImagesRepresentativeNC(phi2,gen^phi1)^emb2 ); od; for gen in GeneratorsOfGroup( KernelOfMultiplicativeGeneralMapping( phi2 ) ) do @@ -466,9 +494,10 @@ end ); ############################################################################# ## +#M PreImagesRepresentativeNC( , ) . . . . . . . . . . of projection #M PreImagesRepresentative( , ) . . . . . . . . . . . of projection ## -InstallMethod( PreImagesRepresentative,"perm subdirect product projection", +InstallMethod( PreImagesRepresentativeNC,"perm subdirect product projection", FamRangeEqFamElm, [ IsProjectionSubdirectProductPermGroup, IsMultiplicativeElementWithInverse ], 0, @@ -487,17 +516,30 @@ InstallMethod( PreImagesRepresentative,"perm subdirect product projection", # compute the preimage if 1 = prj!.component then - elm := img ^ info.perms[1] - * PreImagesRepresentative(phi2,img^phi1) ^ info.perms[2]; + elm := img ^ info.perms[1] + * PreImagesRepresentativeNC(phi2,img^phi1) ^ info.perms[2]; else - elm := img ^ info.perms[2] - * PreImagesRepresentative(phi1,img^phi2) ^ info.perms[1]; + elm := img ^ info.perms[2] + * PreImagesRepresentativeNC(phi1,img^phi2) ^ info.perms[1]; fi; # return the preimage return elm; end ); +InstallMethod( PreImagesRepresentative,"perm subdirect product projection", + FamRangeEqFamElm, + [ IsProjectionSubdirectProductPermGroup, + IsMultiplicativeElementWithInverse ], 0, + function( prj, img ) + if not ( img in Range( prj ) ) then + Error( " is not in the range of mapping " ); + elif not ( img in Image( prj ) ) then + return fail; + fi; + return PreImagesRepresentativeNC( prj, img ); +end ); + ############################################################################# ## #M KernelOfMultiplicativeGeneralMapping( ) . . . . . . . of projection @@ -799,9 +841,10 @@ end ); ############################################################################# ## +#M PreImagesRepresentativeNC( , ) . . . . . . . . . . of embedding #M PreImagesRepresentative( , ) . . . . . . . . . . . of embedding ## -InstallMethod( PreImagesRepresentative, +InstallMethod( PreImagesRepresentativeNC, "imprim perm wreath product embedding", FamRangeEqFamElm, [ IsEmbeddingImprimitiveWreathProductPermGroup, IsMultiplicativeElementWithInverse ], 0, @@ -820,6 +863,18 @@ InstallMethod( PreImagesRepresentative, ^ (info.perms[ emb!.component ] ^ -1); end ); +InstallMethod( PreImagesRepresentative, + "imprim perm wreath product embedding", FamRangeEqFamElm, + [ IsEmbeddingImprimitiveWreathProductPermGroup, + IsMultiplicativeElementWithInverse ], 0, + function( emb, g ) + if not ( g in Range( emb ) ) then + Error( " is not in the range of mapping " ); + elif not ( g in Image( emb ) ) then + return fail; + fi; + return PreImagesRepresentativeNC( emb, g ); +end ); ############################################################################# ## diff --git a/lib/grp.gi b/lib/grp.gi index def28c7419..8553e41225 100644 --- a/lib/grp.gi +++ b/lib/grp.gi @@ -515,12 +515,12 @@ local p, hom, reps, as, a, b, ap, bp, ab, ap_bp, ab_p, g, h, H, N; reps := ConjugacyClasses(Image(hom)); reps := List(reps, Representative); reps := Filtered(reps, g -> not IsOne(g)); - reps := List(reps, g -> PreImagesRepresentative(hom, g)); + reps := List(reps, g -> PreImagesRepresentativeNC(hom, g)); as := List(reps, a -> [a,a^p]); for b in Image(hom) do - b := PreImagesRepresentative(hom, b); + b := PreImagesRepresentativeNC(hom, b); bp := b^p; for a in as do ap := a[2]; a := a[1]; @@ -1913,7 +1913,7 @@ local hom,gens; fi; hom:=IsomorphismPermGroup(G); gens:=IndependentGeneratorsOfAbelianGroup(Image(hom,G)); - return List(gens,i->PreImagesRepresentative(hom,i)); + return List(gens,i->PreImagesRepresentativeNC(hom,i)); end); @@ -2210,8 +2210,8 @@ InstallGlobalFunction( SupersolvableResiduumDefault, function( G ) # dual space of the module, w.r.t. `pcgs'. mg:= List( gs, x -> TransposedMat( List( pcgs, y -> one * ExponentsOfPcElement( pcgs, Image( ph, - Image( dh, PreImagesRepresentative( - dh, PreImagesRepresentative(ph,y) )^x ) ) )))^-1); + Image( dh, PreImagesRepresentativeNC( + dh, PreImagesRepresentativeNC(ph,y) )^x ) ) )))^-1); #T inverting is not necessary, or? mg:= Filtered( mg, x -> x <> idm ); @@ -2261,11 +2261,11 @@ InstallGlobalFunction( SupersolvableResiduumDefault, function( G ) # Construct a group element corresponding to # the basis element of the submodule. - Add( tmp2, PreImagesRepresentative( ph, + Add( tmp2, PreImagesRepresentativeNC( ph, PcElementByExponentsNC( pcgs, v ) ) ); od; - Add( ds, PreImagesSet( dh, + Add( ds, PreImagesSetNC( dh, SubgroupNC( df, Concatenation( tmp2, gen ) ) ) ); od; Append( gen, tmp2 ); @@ -2274,14 +2274,14 @@ InstallGlobalFunction( SupersolvableResiduumDefault, function( G ) else # cyclic case - Add( ds, PreImagesSet( dh, + Add( ds, PreImagesSetNC( dh, SubgroupNC( df, AsSSortedList( gen ) ) ) ); fi; od; # Generate the new candidate. - ssr:= PreImagesSet( dh, SubgroupNC( df, AsSSortedList( gen ) ) ); + ssr:= PreImagesSetNC( dh, SubgroupNC( df, AsSSortedList( gen ) ) ); fi; @@ -3718,7 +3718,7 @@ InstallMethod( HallSubgroupOp, iso := IsomorphismPermGroup( G ); H := HallSubgroup( ImagesSource( iso ), pi ); - return PreImagesSet(iso, H); + return PreImagesSetNC(iso, H); end ); @@ -5495,7 +5495,7 @@ InstallMethod (MinimalNormalSubgroups, local hom; hom := NiceMonomorphism (grp); return List (MinimalNormalSubgroups (NiceObject (grp)), - N -> PreImagesSet (hom, N)); + N -> PreImagesSetNC(hom, N)); end); diff --git a/lib/grpcompl.gi b/lib/grpcompl.gi index ff59627161..df3ef8187d 100644 --- a/lib/grpcompl.gi +++ b/lib/grpcompl.gi @@ -100,11 +100,11 @@ local G,N,K,s, h, q, fpi, factorpres, com, comgens, cen, ocrels, fpcgs, ncom, factorpres:=[FreeGeneratorsOfFpGroup(Range(fpi)), RelatorsOfFpGroup(Range(fpi)), List(GeneratorsOfGroup(Range(fpi)), - i->PreImagesRepresentative(fpi,i))]; - Assert(1,ForAll(factorpres[3],i->Image(h,PreImagesRepresentative(h,i))=i)); + i->PreImagesRepresentativeNC(fpi,i))]; + Assert(1,ForAll(factorpres[3],i->Image(h,PreImagesRepresentativeNC(h,i))=i)); # initialize com:=[G]; - comgens:=[List(factorpres[3],i->PreImagesRepresentative(h,i))]; + comgens:=[List(factorpres[3],i->PreImagesRepresentativeNC(h,i))]; cen:=[s[1]]; ocrels:=false; diff --git a/lib/grpfp.gi b/lib/grpfp.gi index 24f94943c3..4434ecd3f9 100644 --- a/lib/grpfp.gi +++ b/lib/grpfp.gi @@ -319,7 +319,7 @@ local fam,hom; if hom=fail then TryNextMethod(); fi; - return PreImagesRepresentative(hom,Random(rs, Image(hom,gp))); + return PreImagesRepresentativeNC(hom,Random(rs, Image(hom,gp))); end ); ############################################################################# @@ -2031,11 +2031,11 @@ local d,A,B,e1,e2,Ag,Bg,s,sg,u,v,map,sz; # instead of intersecting both preimages with s we only intersect the # intersection - u:=PreImagesSet(Projection(d,1),G!.sub); + u:=PreImagesSetNC(Projection(d,1),G!.sub); if HasSize(B) then SetSize(u,Size(G!.sub)*Size(B)); fi; - v:=PreImagesSet(Projection(d,2),H!.sub); + v:=PreImagesSetNC(Projection(d,2),H!.sub); if HasSize(A) then SetSize(v,Size(H!.sub)*Size(A)); fi; @@ -3167,7 +3167,7 @@ InstallMethod( LowIndexSubgroupsFpGroupIterator, local u, v; u:= NextIterator( iter!.fullIterator ); - v:= PreImagesSet( fpi, u ); + v:= PreImagesSetNC( fpi, u ); SetIndexInWholeGroup( v, IndexInWholeGroup( G ) * IndexInWholeGroup( u ) ); return v; @@ -3236,7 +3236,7 @@ local fpi,u,l,i,a; l:=[]; for i in u do - a:=PreImagesSet(fpi,i); + a:=PreImagesSetNC(fpi,i); SetIndexInWholeGroup(a,IndexInWholeGroup(G)*IndexInWholeGroup(i)); Add(l,a); od; @@ -3379,8 +3379,8 @@ local d,A,B,e1,e2,Ag,Bg,s,sg,u,v; # get both subgroups in the direct product via the projections # instead of intersecting both preimages with s we only intersect the # intersection - u:=PreImagesSet(Projection(d,1),G!.sub); - v:=PreImagesSet(Projection(d,2),H!.sub); + u:=PreImagesSetNC(Projection(d,1),G!.sub); + v:=PreImagesSetNC(Projection(d,2),H!.sub); u:=Intersection(u,s); v:=Intersection(v,s); @@ -5497,7 +5497,7 @@ local G,T,gens,g,reps,ng,index,i,j,ndef,n,iso; subgroup := U, iso:=iso, table:=T, - reps:=List(reps,i->PreImagesRepresentative(iso,i)))); + reps:=List(reps,i->PreImagesRepresentativeNC(iso,i)))); fi; ndef := 1; @@ -5517,7 +5517,7 @@ local G,T,gens,g,reps,ng,index,i,j,ndef,n,iso; subgroup := U, iso:=iso, table:=T, - reps:=List(reps,i->PreImagesRepresentative(iso,i)))); + reps:=List(reps,i->PreImagesRepresentativeNC(iso,i)))); fi; fi; od; diff --git a/lib/grplatt.gi b/lib/grplatt.gi index ae4a2a9f87..bd64ccb213 100644 --- a/lib/grplatt.gi +++ b/lib/grplatt.gi @@ -955,7 +955,7 @@ InstallGlobalFunction(LatticeViaRadical,function(arg) #k:=PreImage(hom,a); # make generators of homomorphism fit nicely to presentation gf:=IsomorphismFpGroup(a); - e:=List(MappingGeneratorsImages(gf)[1],x->PreImagesRepresentative(hom,x)); + e:=List(MappingGeneratorsImages(gf)[1],x->PreImagesRepresentativeNC(hom,x)); # we cannot guarantee that the parent contains e, so no # ClosureSubgroup. k:=ClosureGroup(KernelOfMultiplicativeGeneralMapping(hom),e); @@ -2628,7 +2628,7 @@ local fgi,inducedfactorautos,projs,psubs,info,n,l,nl,emb,u,pos, auts:=[]; for i in GeneratorsOfGroup(n) do aut:=GroupHomomorphismByImages(f,f,gens,List(gens,x-> - Image(hom,PreImagesRepresentative(hom,x)^i))); + Image(hom,PreImagesRepresentativeNC(hom,x)^i))); SetIsBijective(aut,true); Add(auts,aut); od; @@ -2705,7 +2705,7 @@ local fgi,inducedfactorautos,projs,psubs,info,n,l,nl,emb,u,pos, for dc in DoubleCosetRepsAndSizes(t[7],ind,t[8]) do # form the subdirect product g:=List(GeneratorsOfGroup(j[1]), - x->x*Image(emb,PreImagesRepresentative(t[5], + x->x*Image(emb,PreImagesRepresentativeNC(t[5], Image(dc[1],Image(iso,x))) )); Append(g,List(GeneratorsOfGroup(t[1]),x->Image(emb,x))); g:=Subgroup(D,g); diff --git a/lib/grpmat.gi b/lib/grpmat.gi index 86dcc4a815..43c407eec7 100644 --- a/lib/grpmat.gi +++ b/lib/grpmat.gi @@ -621,7 +621,7 @@ local gens,s,dom,mon,no; # call the recursive function to do the work gens:= SCMinSmaGens( no, s, [], One( no ), true ).gens; SetMinimalStabChain(G,s); - return List(gens,i->PreImagesRepresentative(mon,i)); + return List(gens,i->PreImagesRepresentativeNC(mon,i)); end); ############################################################################# @@ -658,7 +658,7 @@ local s,dom,mon, img; i->Position(HomeEnumerator(dom),i)))); # call the recursive function to do the work s:= LargestElementStabChain( s, One( img ) ); - return PreImagesRepresentative(mon,s); + return PreImagesRepresentativeNC(mon,s); end); ############################################################################# @@ -697,7 +697,7 @@ local mon,dom,S,o,oimgs,p,i,g; od; # change by corresponding matrix element - e:=PreImagesRepresentative(mon,g)*e; + e:=PreImagesRepresentativeNC(mon,g)*e; S:=S.stabilizer; od; @@ -1200,9 +1200,10 @@ InstallMethod( ImagesRepresentative, ############################################################################# ## -#M PreImagesRepresentative( , ) . . . for a blow up isomorphism +#M PreImagesRepresentativeNC( , ) . . . for a blow up isomorphism +#M PreImagesRepresentative( , ) . . . . for a blow up isomorphism ## -InstallMethod( PreImagesRepresentative, +InstallMethod( PreImagesRepresentativeNC, "for a blow up isomorphism, and a matrix in the range", FamRangeEqFamElm, [ IsBlowUpIsomorphism, IsMatrix ], @@ -1255,6 +1256,19 @@ InstallMethod( PreImagesRepresentative, return preim; end ); +InstallMethod( PreImagesRepresentative, + "for a blow up isomorphism, and a matrix in the range", + FamRangeEqFamElm, + [ IsBlowUpIsomorphism, IsMatrix ], + function( iso, mat ) + if not ( mat in Range(iso) ) then + Error( " is not in the range of mapping " ); + elif not ( mat in Image(iso) ) then + return fail; + fi; + return PreImagesRepresentativeNC( iso, mat ); + end ); + ############################################################################# ## diff --git a/lib/grpnames.gi b/lib/grpnames.gi index 67bd30f23d..0cef332bbf 100644 --- a/lib/grpnames.gi +++ b/lib/grpnames.gi @@ -173,7 +173,7 @@ InstallMethod( NormalComplementNC, i:=0; for gF in IndependentGeneratorsOfAbelianGroup(F) do i := i+1; - g := PreImagesRepresentative(nat, gF); + g := PreImagesRepresentativeNC(nat, gF); R := RightCoset(N, g); # DirectFactorsOfGroup already computed Center and RationalClasses # when calling NormalComplement diff --git a/lib/grpnice.gd b/lib/grpnice.gd index 42af00ab06..cb7062fe13 100644 --- a/lib/grpnice.gd +++ b/lib/grpnice.gd @@ -366,7 +366,7 @@ BindGlobal( "AttributeMethodByNiceMonomorphismList", function( oper, par ) local nice; nice:= NiceMonomorphism( obj ); return List( oper( NiceObject( obj ) ), - x -> PreImagesRepresentative( nice, x ) ); + x -> PreImagesRepresentativeNC( nice, x ) ); end ); end ); @@ -401,7 +401,7 @@ BindGlobal( "AttributeMethodByNiceMonomorphismCollElm", function( oper, par ) img := ImagesRepresentative( nice, obj2 : actioncanfail:= true ); if img = fail or not ( img in ImagesSource( nice ) and - PreImagesRepresentative( nice, img ) = obj2 ) then + PreImagesRepresentativeNC( nice, img ) = obj2 ) then TryNextMethod(); fi; return oper( NiceObject( obj1 ), img ); @@ -444,7 +444,7 @@ BindGlobal( "AttributeMethodByNiceMonomorphismElmColl", img := ImagesRepresentative( nice, obj1 : actioncanfail:= true ); if img = fail or not (img in ImagesSource( nice ) and - PreImagesRepresentative( nice, img ) = obj1) then + PreImagesRepresentativeNC( nice, img ) = obj1) then TryNextMethod(); fi; return oper( img, NiceObject( obj2 ) ); @@ -528,7 +528,7 @@ BindGlobal( "GroupMethodByNiceMonomorphismCollElm", img := ImagesRepresentative( nice, obj2 : actioncanfail:= true ); if img = fail or not (img in ImagesSource( nice ) and - PreImagesRepresentative( nice, img ) = obj2) then + PreImagesRepresentativeNC( nice, img ) = obj2) then TryNextMethod(); fi; img1 := oper( NiceObject( obj1 ), img ); @@ -616,7 +616,7 @@ BindGlobal( "SubgroupMethodByNiceMonomorphismCollColl", function( oper, par ) img:=ImagesSet( nice, obj2 ); if img = fail or not ( IsSubset( ImagesSource( nice ), img ) and - PreImagesSet( nice, img ) = obj2 ) then + PreImagesSetNC( nice, img ) = obj2 ) then TryNextMethod(); fi; img := oper( NiceObject( obj1 ), img ); @@ -640,7 +640,7 @@ BindGlobal( "SubgroupMethodByNiceMonomorphismCollElm", function( oper, par ) img := ImagesRepresentative( nice, obj2 : actioncanfail:= true ); if img = fail or not ( img in ImagesSource( nice ) and - PreImagesRepresentative (nice , img ) = obj2 ) then + PreImagesRepresentativeNC( nice, img ) = obj2 ) then TryNextMethod(); fi; img1 := oper( NiceObject( obj1 ), img ); @@ -767,7 +767,7 @@ BindGlobal( "GroupSeriesMethodByNiceMonomorphismCollElm", img := ImagesRepresentative( nice, obj2 : actioncanfail:= true ); if img = fail or not ( img in ImagesSource( nice ) and - PreImagesRepresentative( nice, img ) = obj2 ) then + PreImagesRepresentativeNC( nice, img ) = obj2 ) then TryNextMethod(); fi; list := ShallowCopy( oper( NiceObject( obj1 ), img ) ); diff --git a/lib/grpnice.gi b/lib/grpnice.gi index 9216cfdb78..ca8f0f1f41 100644 --- a/lib/grpnice.gi +++ b/lib/grpnice.gi @@ -212,7 +212,7 @@ function( elm, G ) nice := NiceMonomorphism( G ); img := ImagesRepresentative( nice, elm:actioncanfail:=true ); return img<>fail and img in NiceObject( G ) - and PreImagesRepresentative( nice, img ) = elm; + and PreImagesRepresentativeNC( nice, img ) = elm; end ); @@ -284,7 +284,7 @@ function( obj1, obj2 ) img := ImagesRepresentative( nice, obj2:actioncanfail:=true ); if img = fail or not (img in ImagesSource(nice) and - PreImagesRepresentative(nice,img)=obj2) then + PreImagesRepresentativeNC(nice,img)=obj2) then TryNextMethod(); fi; no:=NiceObject(obj1); @@ -344,7 +344,7 @@ local mon,cl,clg,c,i; cl:=ConjugacyClasses(NiceObject(g)); clg:=[]; for i in cl do - c:=ConjugacyClass(g,PreImagesRepresentative(mon,Representative(i))); + c:=ConjugacyClass(g,PreImagesRepresentativeNC(mon,Representative(i))); c!.niceClass:=i; if HasStabilizerOfExternalSet(i) then SetStabilizerOfExternalSet(c,PreImages(mon,StabilizerOfExternalSet(i))); @@ -783,7 +783,7 @@ SubgroupMethodByNiceMonomorphism( SolvableRadical, InstallMethodWithRandomSource( Random, "for a random source and a group handled by nice monomorphism", [ IsRandomSource, IsGroup and IsHandledByNiceMonomorphism ], 0, - {rs, G} -> PreImagesRepresentative( NiceMonomorphism( G ), + {rs, G} -> PreImagesRepresentativeNC( NiceMonomorphism( G ), Random( rs, NiceObject( G ) ) ) ); @@ -799,7 +799,7 @@ local mon,cl,clg,c,i; cl:=RationalClasses(NiceObject(g)); clg:=[]; for i in cl do - c:=RationalClass(g,PreImagesRepresentative(mon,Representative(i))); + c:=RationalClass(g,PreImagesRepresentativeNC(mon,Representative(i))); if HasStabilizerOfExternalSet(i) then SetStabilizerOfExternalSet(c,PreImages(mon,StabilizerOfExternalSet(i))); fi; @@ -822,7 +822,7 @@ function(g,u) local mon,rt; mon:=NiceMonomorphism(g); rt:=RightTransversal(ImagesSet(mon,g),ImagesSet(mon,u)); - rt:=List(rt,i->RightCoset(u,PreImagesRepresentative(mon,i))); + rt:=List(rt,i->RightCoset(u,PreImagesRepresentativeNC(mon,i))); return rt; end); @@ -894,7 +894,7 @@ local hom,rep; rep:= RepresentativeAction( NiceObject( G ), ImageElm( hom, a ), ImageElm( hom, b ), OnPoints ); if rep<>fail then - rep:=PreImagesRepresentative(hom,rep); + rep:=PreImagesRepresentativeNC(hom,rep); fi; return rep; end); @@ -996,9 +996,10 @@ end); ############################################################################# ## +#M PreImagesRepresentativeNC( , ) . . . . . . . . . . via images #M PreImagesRepresentative( , ) . . . . . . . . . . . via images ## -InstallMethod( PreImagesRepresentative, "for PBG-Niceo", +InstallMethod( PreImagesRepresentativeNC, "for PBG-Niceo", FamRangeEqFamElm, [ IsPreimagesByAsGroupGeneralMappingByImages and IsNiceMonomorphism, IsMultiplicativeElementWithInverse ], 0, @@ -1006,11 +1007,24 @@ function( hom, elm ) local p; # avoid the double dispatch for `AsGroupGeneralMappingByImages' PushOptions( rec( Run_In_GGMBI:= true ) ); - p:=PreImagesRepresentative( AsGroupGeneralMappingByImages( hom ), elm ); + p:=PreImagesRepresentativeNC( AsGroupGeneralMappingByImages( hom ), elm ); PopOptions(); return p; end ); +InstallMethod( PreImagesRepresentative, "for PBG-Niceo", + FamRangeEqFamElm, + [ IsPreimagesByAsGroupGeneralMappingByImages and IsNiceMonomorphism, + IsMultiplicativeElementWithInverse ], 0, +function( hom, elm ) + if not ( elm in Range(hom) ) then + Error( " is not in the range of mapping " ); + elif not ( elm in Image(hom) ) then + return fail; + fi; + return PreImagesRepresentativeNC( hom, elm ); +end ); + ############################################################################# ## #M NiceMonomorphism( ) . . @@ -1101,7 +1115,7 @@ InstallMethod( \[\],"enum-by-niceo", true, function( enum, pos ) local img; img:=enum!.niceEnumerator[pos]; - return PreImagesRepresentative(enum!.morphism,img); + return PreImagesRepresentativeNC(enum!.morphism,img); end); diff --git a/lib/grppc.gi b/lib/grppc.gi index f01a7af92d..9233d045e2 100644 --- a/lib/grppc.gi +++ b/lib/grppc.gi @@ -2147,7 +2147,7 @@ local e, # EAS if iso<>false then V:=PreImage(iso,V); no:=PreImage(iso,no); - ce:=PreImagesRepresentative(iso,ce); + ce:=PreImagesRepresentativeNC(iso,ce); fi; return [V,no,ce]; end ); @@ -2568,7 +2568,7 @@ local q, pcgs, sub, hom, f, ex, C; ex:=ExponentOfPGroupAndElm(f,q); while ex[1]>q do # take the element of highest order in f and take power of its preimage - ex:=PreImagesRepresentative(hom,ex[2]^q); + ex:=PreImagesRepresentativeNC(hom,ex[2]^q); sub:=NormalClosure(G,ClosureSubgroupNC(sub,ex)); hom:=NaturalHomomorphismByNormalSubgroup(G,sub); f:=Range(hom); @@ -2646,7 +2646,7 @@ function(G,p,e) local f; f:=MaximalAbelianQuotient(G); IsAbelian(Image(f)); - return SubgroupByPcgs(G,Pcgs(PreImagesSet(f,Omega(Image(f),p,e)))); + return SubgroupByPcgs(G,Pcgs(PreImagesSetNC(f,Omega(Image(f),p,e)))); end); # Efficiency notes: @@ -2679,7 +2679,7 @@ local z,f; f:=NaturalHomomorphismByNormalSubgroup(G,Subgroup(G,[z])); IsAbelian(Image(f)); # Probably is not, but quick to check - return SubgroupByPcgs(G,Pcgs(PreImagesSet(f,Omega(Image(f),p,e)))); + return SubgroupByPcgs(G,Pcgs(PreImagesSetNC(f,Omega(Image(f),p,e)))); end); # Efficiency Points: @@ -2820,7 +2820,7 @@ InstallMethod (HallSubgroupOp, "via IsomoprhismPcGroup", true, function (grp, pi) local iso; iso := IsomorphismPcGroup (grp); - return PreImagesSet (iso, HallSubgroup (ImagesSource (iso), pi)); + return PreImagesSetNC(iso, HallSubgroup (ImagesSource (iso), pi)); end); @@ -2841,7 +2841,7 @@ InstallMethod (SylowComplementOp, "via IsomoprhismPcGroup", true, function (grp, p) local iso; iso := IsomorphismPcGroup (grp); - return PreImagesSet (iso, SylowComplement (ImagesSource (iso), p)); + return PreImagesSetNC(iso, SylowComplement (ImagesSource (iso), p)); end); diff --git a/lib/grppcaut.gi b/lib/grppcaut.gi index 8f776a142d..b6e5de2d02 100644 --- a/lib/grppcaut.gi +++ b/lib/grppcaut.gi @@ -437,7 +437,7 @@ local spec,s,n,M, if d = 1 then hom := IsomorphismPermGroup( B ); pcgs := Pcgs( Image( hom ) ); - pcs := List( pcgs, x -> PreImagesRepresentative( hom, x ) ); + pcs := List( pcgs, x -> PreImagesRepresentativeNC( hom, x ) ); TransferPcgsInfo( B, pcs, RelativeOrders( pcgs ) ); return B; fi; @@ -509,12 +509,12 @@ local spec,s,n,M, Info( InfoOverGr, 1, "computed normalizer of size ", Size(L)); # go back to mat group - B := List( GeneratorsOfGroup(L), x -> PreImagesRepresentative(hom,x) ); + B := List( GeneratorsOfGroup(L), x -> PreImagesRepresentativeNC(hom,x) ); w := PrimitiveRoot(field)* Immutable( IdentityMat( d, field ) ); B := SubgroupNC( S, Concatenation( B, [w] ) ); if IsSolvableGroup( L ) then - pcgs := List( Pcgs(L), x -> PreImagesRepresentative( hom, x ) ); + pcgs := List( Pcgs(L), x -> PreImagesRepresentativeNC( hom, x ) ); Add( pcgs, w ); rels := ShallowCopy( RelativeOrders( Pcgs(L) ) ); Add( rels, p-1 ); @@ -536,7 +536,7 @@ BindGlobal( "CocycleSQ", function( epi, field ) H := Source( epi ); F := Image( epi ); N := KernelOfMultiplicativeGeneralMapping( epi ); - pcsH := List( Pcgs( F ), x -> PreImagesRepresentative( epi, x ) ); + pcsH := List( Pcgs( F ), x -> PreImagesRepresentativeNC( epi, x ) ); pcsN := Pcgs( N ); pcgsH := PcgsByPcSequence( ElementsFamily( FamilyObj( H ) ), Concatenation( pcsH, pcsN ) ); @@ -646,7 +646,7 @@ BindGlobal( "LiftInduciblePair", function( epi, ind, M, weight ) pcgsF := Pcgs( F ); - pcsH := List( pcgsF, x -> PreImagesRepresentative( epi, x ) ); + pcsH := List( pcgsF, x -> PreImagesRepresentativeNC( epi, x ) ); pcsN := Pcgs( N ); pcgsH := PcgsByPcSequence( ElementsFamily( FamilyObj( H ) ), Concatenation( pcsH, pcsN ) ); @@ -656,7 +656,7 @@ BindGlobal( "LiftInduciblePair", function( epi, ind, M, weight ) # use automorphism of F imgsF := List( pcgsF, x -> Image( ind[1], x ) ); opmats := List( imgsF, x -> MappedPcElement( x, pcgsF, M.generators ) ); - imgsF := List( imgsF, x -> PreImagesRepresentative( epi, x ) ); + imgsF := List( imgsF, x -> PreImagesRepresentativeNC( epi, x ) ); # use automorphism of N imgsN := List( pcsN, x -> ExponentsOfPcElement( pcsN, x ) ); @@ -1420,11 +1420,11 @@ InstallGlobalFunction(AutomorphismGroupSolvableGroup,function( G ) hom := ActionHomomorphism( xset, "surjective"); P := Image( hom ); if IsSolvableGroup( P ) then - pcsA := List( Pcgs(P), x -> PreImagesRepresentative( hom, x )); + pcsA := List( Pcgs(P), x -> PreImagesRepresentativeNC( hom, x )); TransferPcgsInfo( A, pcsA, RelativeOrders( Pcgs(P) ) ); else imgs := SmallGeneratingSet( P ); - gens := List( imgs, x -> PreImagesRepresentative( hom, x ) ); + gens := List( imgs, x -> PreImagesRepresentativeNC( hom, x ) ); tmp := Size( A ); A := GroupByGenerators( gens, One( A ) ); SetSize( A, tmp ); @@ -1551,10 +1551,10 @@ InstallGlobalFunction(AutomorphismGroupFrattFreeGroup,function( G ) imgs := []; for i in [1..Length(gensK)] do m := gensU[i]^n; - a := PreImagesRepresentative( hom, m ); + a := PreImagesRepresentativeNC( hom, m ); Add( imgs, a ); od; - l := PreImagesRepresentative( iso, n ); + l := PreImagesRepresentativeNC( iso, n ); Append( imgs, List( gensF, x -> Image( l, x ) ) ); new := GroupHomomorphismByImagesNC( G, G, gensG, imgs ); SetIsBijective( new, true ); diff --git a/lib/grppccom.gi b/lib/grppccom.gi index a9a317aaba..74229971ae 100644 --- a/lib/grppccom.gi +++ b/lib/grppccom.gi @@ -19,7 +19,7 @@ local r,img,i,gens,img2; gens:=GeneratorsOfGroup(img); img2:=Image(h[i],G); r[i]:=GroupHomomorphismByImagesNC(img,img2,gens,List(gens,j-> - Image(h[i],PreImagesRepresentative(h[i+1],j)))); + Image(h[i],PreImagesRepresentativeNC(h[i+1],j)))); SetKernelOfMultiplicativeGeneralMapping(r[i], Image(h[i+1],KernelOfMultiplicativeGeneralMapping(h[i]))); img:=img2; @@ -890,7 +890,7 @@ local H, E, cor, a, i, fun2,pcgs,home; #a :=NaturalHomomorphism( G, G / N ); #cor:=PPrimeSetsOC( Image( a ) ); #cor.generators:=List( cor.generators, x -> - # PreImagesRepresentative( a, x ) ); + # PreImagesRepresentativeNC( a, x ) ); cor:=rec(home:=home,generators:=pcgs mod InducedPcgs(pcgs,N)); cor.useCentralSK:=true; fi; diff --git a/lib/grppcext.gi b/lib/grppcext.gi index f65bdec547..f51981eaab 100644 --- a/lib/grppcext.gi +++ b/lib/grppcext.gi @@ -382,11 +382,11 @@ local ag, p1iso, agp, p2iso, DP, p1, p2, gens, genimgs, triso,s,i,u,opt, genimgs:=List(gens, i->ImagesRepresentative(Embedding(D,1), - PreImagesRepresentative(p1iso, - PreImagesRepresentative(pc1,ImagesRepresentative(p1,i)))) + PreImagesRepresentativeNC(p1iso, + PreImagesRepresentativeNC(pc1,ImagesRepresentative(p1,i)))) *ImagesRepresentative(Embedding(D,2), - PreImagesRepresentative(p2iso, - PreImagesRepresentative(pc2,ImagesRepresentative(p2,i)))) ); + PreImagesRepresentativeNC(p2iso, + PreImagesRepresentativeNC(pc2,ImagesRepresentative(p2,i)))) ); else opt:=rec(limit:=s,random:=1); @@ -435,9 +435,9 @@ local ag, p1iso, agp, p2iso, DP, p1, p2, gens, genimgs, triso,s,i,u,opt, genimgs:=List(gens, i->ImagesRepresentative(Embedding(D,1), - PreImagesRepresentative(p1iso,ImagesRepresentative(p1,i))) + PreImagesRepresentativeNC(p1iso,ImagesRepresentative(p1,i))) *ImagesRepresentative(Embedding(D,2), - PreImagesRepresentative(p2iso,ImagesRepresentative(p2,i))) ); + PreImagesRepresentativeNC(p2iso,ImagesRepresentative(p2,i))) ); fi; triso:=GroupHomomorphismByImagesNC(DP,D,gens,genimgs); @@ -565,7 +565,7 @@ local G, M, Mgrp, oper, A, B, D, translate, gens, genimgs, triso, K, K1, M.IsOverFiniteField:=true; test:=function(perm) local aut,imgs,mat; - aut:=PreImagesRepresentative(triso,perm); + aut:=PreImagesRepresentativeNC(triso,perm); imgs:=List(gens,x->ImagesRepresentative(aut,x)); imgs:=List(imgs,x->ImagesRepresentative(modulehom,x)); mat:=MTX.IsomorphismModules(M,GModuleByMats(imgs,M.field)); @@ -749,9 +749,9 @@ local G, M, Mgrp, oper, A, B, D, translate, gens, genimgs, triso, K, K1, basicact:=function( tup, elm ) local gens; - #gens := List( tup[1], x -> PreImagesRepresentative( elm[1], x ) ); + #gens := List( tup[1], x -> PreImagesRepresentativeNC( elm[1], x ) ); #gens := List( gens, x -> MappedPcElement( x, tup[1], tup[2] ) ); - gens := List( Ggens, x -> PreImagesRepresentative( elm[1], x ) ); + gens := List( Ggens, x -> PreImagesRepresentativeNC( elm[1], x ) ); gens := List( gens, x -> MappedPcElement( x, Ggens, tup ) ); gens := List( gens, x -> x ^ elm[2] ); return gens; @@ -764,10 +764,10 @@ local G, M, Mgrp, oper, A, B, D, translate, gens, genimgs, triso, K, K1, Assert(1,MappingGeneratorsImages(epi)[2]=Ggens); f:=function( tup, elm ) local gens; - #gens := List( tup[1], x -> PreImagesRepresentative( elm[1], x ) ); + #gens := List( tup[1], x -> PreImagesRepresentativeNC( elm[1], x ) ); #gens := List( gens, x -> MappedPcElement( x, tup[1], tup[2] ) ); - gens := List( Ggens, x -> PreImagesRepresentative( elm[1], x ) ); - gens := List( gens, x -> MappedWord( PreImagesRepresentative(epi,x), + gens := List( Ggens, x -> PreImagesRepresentativeNC( elm[1], x ) ); + gens := List( gens, x -> MappedWord( PreImagesRepresentativeNC(epi,x), GeneratorsOfGroup(Source(epi)), tup ) ); gens := List( gens, x -> x ^ elm[2] ); return gens; @@ -783,13 +783,13 @@ local G, M, Mgrp, oper, A, B, D, translate, gens, genimgs, triso, K, K1, elmlist:=[]; tmp:=List(genimgs,x->x[1]); - preimlist:=List(tmp,x->[x,List(Ggens,y->PreImagesRepresentative(x,y))]); + preimlist:=List(tmp,x->[x,List(Ggens,y->PreImagesRepresentativeNC(x,y))]); f:=function( tup, elm ) local gens,p; p:=PositionProperty(preimlist,x->IsIdenticalObj(x[1],elm[1])); if p=fail then - gens := List( Ggens, x -> PreImagesRepresentative( elm[1], x ) ); + gens := List( Ggens, x -> PreImagesRepresentativeNC( elm[1], x ) ); else gens:=preimlist[p][2]; fi; @@ -834,7 +834,7 @@ local G, M, Mgrp, oper, A, B, D, translate, gens, genimgs, triso, K, K1, if elmlist<>fail then tmp:=List(genimgs,x->x[1]); - preimlist:=List(tmp,x->[x,List(Ggens,y->PreImagesRepresentative(x,y))]); + preimlist:=List(tmp,x->[x,List(Ggens,y->PreImagesRepresentativeNC(x,y))]); # ensure we also account for action u:=Group(tup); @@ -965,7 +965,7 @@ BindGlobal( "MatrixOperationOfCPGroup", function( cc, gens ) mats := List( gens, x -> [] ); base := Basis( Image( cc.cohom ) ); - prei := List( base, x -> PreImagesRepresentative( cc.cohom, x ) ); + prei := List( base, x -> PreImagesRepresentativeNC( cc.cohom, x ) ); pcgs := Pcgs( cc.group ); ords := RelativeOrders( pcgs ); @@ -1062,7 +1062,7 @@ function( G, M, C ) return [ExtensionSQ( cc.collector, G, M, 0 )]; elif Dimension( Image(cc.cohom)) = 1 then c := Basis(Image(cc.cohom))[1]; - c := PreImagesRepresentative(cc.cohom, c); + c := PreImagesRepresentativeNC(cc.cohom, c); return [ExtensionSQ( cc.collector, G, M, 0 ), ExtensionSQ( cc.collector, G, M, c )]; fi; @@ -1072,7 +1072,7 @@ function( G, M, C ) # compute orbit of mats on H^2( G, M ) Mgrp := GroupByGenerators( mats ); orbs := OrbitsDomain( Mgrp, Image(cc.cohom), OnRight ); - orbs := List( orbs, x -> PreImagesRepresentative( cc.cohom, x[1] ) ); + orbs := List( orbs, x -> PreImagesRepresentativeNC( cc.cohom, x[1] ) ); ext := List( orbs, x -> ExtensionSQ( cc.collector, G, M, x ) ); return ext; end); @@ -1167,7 +1167,7 @@ BindGlobal( "NonSplitExtensions", function( arg ) red := true; elif Dimension( Image(cc.cohom ) ) = 1 then - c := PreImagesRepresentative(cc.cohom, Basis(Image(cc.cohom))[1]); + c := PreImagesRepresentativeNC(cc.cohom, Basis(Image(cc.cohom))[1]); all := [ExtensionSQ( C, G, M, c)]; red := true; @@ -1175,7 +1175,7 @@ BindGlobal( "NonSplitExtensions", function( arg ) elif IsBound( arg[3] ) and not arg[3] then all := NormedRowVectors( Image(cc.cohom) ); all := List( all, x -> ExtensionSQ(cohom.collector, G, M, - PreImagesRepresentative(cc.cohom,x ))); + PreImagesRepresentativeNC(cc.cohom,x ))); red := false; # sometimes we do not want to reduce @@ -1186,7 +1186,7 @@ BindGlobal( "NonSplitExtensions", function( arg ) then all := NormedRowVectors( Image(cc.cohom) ); all := List( all, x -> ExtensionSQ(cc.collector, G, M, - PreImagesRepresentative(cc.cohom, x ))); + PreImagesRepresentativeNC(cc.cohom, x ))); red := false; # then we want to reduce @@ -1205,7 +1205,7 @@ BindGlobal( "NonSplitExtensions", function( arg ) # create extensions and add info all := List( all, x -> ExtensionSQ(cc.collector, G, M, - PreImagesRepresentative(cc.cohom, x ))); + PreImagesRepresentativeNC(cc.cohom, x ))); fi; if red then diff --git a/lib/grppclat.gi b/lib/grppclat.gi index e528ff0483..28db0a7278 100644 --- a/lib/grppclat.gi +++ b/lib/grppclat.gi @@ -86,7 +86,7 @@ local f; else aut:= GroupHomomorphismByImagesNC(f,f,GeneratorsOfGroup(f), List(GeneratorsOfGroup(f), - i->Image(epi,Image(aut,PreImagesRepresentative(epi,i))))); + i->Image(epi,Image(aut,PreImagesRepresentativeNC(epi,i))))); SetIsInjective(aut,true); SetIsSurjective(aut,true); fi; @@ -672,7 +672,7 @@ local g, # group # hom:=[]; # for i in func do # hom2:=GroupHomomorphismByImagesNC(g,g,g.generators,List(g.generators, -# j->Image(isom,Image(i,PreImagesRepresentative(isom,j))))); +# j->Image(isom,Image(i,PreImagesRepresentativeNC(isom,j))))); # hom2.isMapping:=true; # Add(hom,hom2); # od; @@ -788,7 +788,7 @@ local g, # group hom:= GroupHomomorphismByImagesNC(f,fa,GeneratorsOfGroup(f), List(GeneratorsOfGroup(f),i-> - Image(hom,PreImagesRepresentative(epi,i)))); + Image(hom,PreImagesRepresentativeNC(epi,i)))); Assert(2,KernelOfMultiplicativeGeneralMapping(hom)=n); # lift the known groups diff --git a/lib/grpperm.gi b/lib/grpperm.gi index 020398dfe5..08f7805298 100644 --- a/lib/grpperm.gi +++ b/lib/grpperm.gi @@ -1592,7 +1592,7 @@ InstallGlobalFunction( SylowSubgroupPermGroup, function( G, p ) O := Orbit( S, D[1] ); f := ActionHomomorphism( S, O,"surjective" ); T := SylowSubgroupPermGroup( Range( f ), p ); - S := PreImagesSet( f, T ); + S := PreImagesSetNC( f, T ); SubtractSet( D, O ); od; return S; @@ -1605,7 +1605,7 @@ InstallGlobalFunction( SylowSubgroupPermGroup, function( G, p ) f := ActionHomomorphism( G, B, OnSets,"surjective" ); T := SylowSubgroupPermGroup( Range( f ), p ); if Size( T ) < Size( Range( f ) ) then - T := PreImagesSet( f, T ); + T := PreImagesSetNC( f, T ); S := SylowSubgroupPermGroup( T , p) ; return S; fi; @@ -1630,7 +1630,7 @@ InstallGlobalFunction( SylowSubgroupPermGroup, function( G, p ) Info(InfoGroup,1,"PermSylow: cycleaction"); f := ActionHomomorphism( C, B, OnSets,"surjective" ); T := SylowSubgroupPermGroup( Range( f ), p ); - S := PreImagesSet( f, T ); + S := PreImagesSetNC( f, T ); return S; end ); diff --git a/lib/grpprmcs.gi b/lib/grpprmcs.gi index c8a8a1166a..4b4d6d91a6 100644 --- a/lib/grpprmcs.gi +++ b/lib/grpprmcs.gi @@ -1173,7 +1173,7 @@ InstallGlobalFunction( PullbackKernelCSPG, fi; for g in gens do for j in [1..i-1] do - g := PreImagesRepresentative(homlist[i-j],g); + g := PreImagesRepresentativeNC(homlist[i-j],g); od; Add(normals[index],g); Add(factors[index],()); @@ -1193,7 +1193,7 @@ InstallGlobalFunction( PullbackCSPG, function(p,homlist) # compute a preimage of the permutation p in the input group lenhomlist := Length(homlist); for i in [1..lenhomlist] do - p := PreImagesRepresentative(homlist[lenhomlist+1-i],p); + p := PreImagesRepresentativeNC(homlist[lenhomlist+1-i],p); od; return p; end ); @@ -1522,7 +1522,7 @@ InstallMethod( PCoreOp, for g in GeneratorsOfGroup( KernelOfMultiplicativeGeneralMapping( homlist[i] ) ) do for j in [1..i-1] do - g := PreImagesRepresentative(homlist[i-j],g); + g := PreImagesRepresentativeNC(homlist[i-j],g); od; Add(pgenlist,g); od; @@ -1747,7 +1747,7 @@ InstallMethod( SolvableRadical, for g in GeneratorsOfGroup( KernelOfMultiplicativeGeneralMapping( homlist[i] ) ) do for j in [1..i-1] do - g := PreImagesRepresentative(homlist[i-j],g); + g := PreImagesRepresentativeNC(homlist[i-j],g); od; Add(solvable,g); od; diff --git a/lib/liefam.gi b/lib/liefam.gi index 6122a753b0..f0fafb4e8f 100644 --- a/lib/liefam.gi +++ b/lib/liefam.gi @@ -447,7 +447,7 @@ InstallMethod( ImagesElm, return [ LieObject( elm ) ]; end ); -InstallMethod( PreImagesElm, +InstallMethod( PreImagesElmNC, "for Lie embedding and Lie object in default representation", FamRangeEqFamElm, [ IsGeneralMapping and IsLieEmbeddingRep, @@ -456,6 +456,19 @@ InstallMethod( PreImagesElm, return [ elm![1] ]; end ); +InstallMethod( PreImagesElm, + "for Lie embedding and Lie object in default representation", + FamRangeEqFamElm, + [ IsGeneralMapping and IsLieEmbeddingRep, + IsLieObject and IsPackedElementDefaultRep ], 0, + function( emb, elm ) + if not ( elm in Range(emb) ) then + Error( " is not in the range of mapping " ); + elif not ( elm in Image(emb) ) then + return fail; + fi; + return PreImagesElmNC( emb, elm ); + end ); ############################################################################# ## diff --git a/lib/mapphomo.gi b/lib/mapphomo.gi index 3e396945ff..471926d265 100644 --- a/lib/mapphomo.gi +++ b/lib/mapphomo.gi @@ -330,9 +330,10 @@ InstallMethod( ImagesSet, ############################################################################# ## -#M PreImagesElm( , ) . for s.p. gen. mapping resp. mult. & inv. +#M PreImagesElmNC( , ) . for s.p. gen. mapping resp. mult. & inv. +#M PreImagesElm( , ) . . for s.p. gen. mapping resp. mult. & inv. ## -InstallMethod( PreImagesElm, +InstallMethod( PreImagesElmNC, "method for s.p. general mapping respecting mult. & inv., and element", FamRangeEqFamElm, [ IsSPGeneralMapping and RespectsMultiplication and RespectsInverses, @@ -340,7 +341,7 @@ InstallMethod( PreImagesElm, function( map, elm ) local pre; - pre:= PreImagesRepresentative( map, elm ); + pre:= PreImagesRepresentativeNC( map, elm ); if pre = fail then return []; else @@ -348,12 +349,26 @@ InstallMethod( PreImagesElm, fi; end ); +InstallMethod( PreImagesElm, + "method for s.p. general mapping respecting mult. & inv., and element", + FamRangeEqFamElm, + [ IsSPGeneralMapping and RespectsMultiplication and RespectsInverses, + IsObject ], +function( map, elm ) + if not ( elm in Range( map ) ) then + Error( " is not in the range of " ); + elif not ( elm in Image( map ) ) then + return fail; + fi; + return PreImagesElmNC( map, elm ); +end ); + ############################################################################# ## -#M PreImagesSet( , ) . for s.p. gen. mapping resp. mult. & inv. +#M PreImagesSetNC( , ) . for s.p. gen. mapping resp. mult. & inv. ## -InstallMethod( PreImagesSet, +InstallMethod( PreImagesSetNC, "method for s.p. general mapping respecting mult. & inv., and group", CollFamRangeEqFamElms, [ IsSPGeneralMapping and RespectsMultiplication and RespectsInverses, @@ -367,7 +382,7 @@ InstallMethod( PreImagesSet, fi; genpreimages:= List(genpreimages, - gen -> PreImagesRepresentative( map, gen ) ); + gen -> PreImagesRepresentativeNC( map, gen ) ); if fail in genpreimages then TryNextMethod(); fi; @@ -385,6 +400,19 @@ InstallMethod( PreImagesSet, end ); InstallMethod( PreImagesSet, + "method for s.p. general mapping respecting mult. & inv., and group", + CollFamRangeEqFamElms, + [ IsSPGeneralMapping and RespectsMultiplication and RespectsInverses, + IsGroup ], + function( map, elms ) + if not IsSubset( Range( map ), elms ) then + Error( " is not a subset of the range of " ); + fi; + return PreImagesSetNC( map, Intersection( elms, Image( map ) ) ); + end ); + + +InstallMethod( PreImagesSetNC, "method for injective s.p. mapping respecting mult. & inv., and group", CollFamRangeEqFamElms, [ IsSPGeneralMapping and IsMapping and IsInjective and @@ -395,11 +423,24 @@ InstallMethod( PreImagesSet, pre := SubgroupNC( Source( map ), List( GeneratorsOfMagmaWithInverses( elms ), - gen -> PreImagesRepresentative( map, gen ) ) ); + gen -> PreImagesRepresentativeNC( map, gen ) ) ); UseIsomorphismRelation( elms, pre ); return pre; end ); +InstallMethod( PreImagesSet, + "method for injective s.p. mapping respecting mult. & inv., and group", + CollFamRangeEqFamElms, + [ IsSPGeneralMapping and IsMapping and IsInjective and + RespectsMultiplication and RespectsInverses, + IsGroup ], + function( map, elms ) + if not IsSubset( Range( map ), elms ) then + Error( " is not a subset of the range of " ); + fi; + return PreImagesSetNC( map, Intersection( elms, Image( map ) ) ); + end ); + ############################################################################# ## @@ -684,9 +725,10 @@ InstallMethod( ImagesSet, ############################################################################# ## -#M PreImagesElm( , ) for s.p. gen. mapping resp. add. & add.inv. +#M PreImagesElmNC( , ) for s.p. gen. mapping resp. add. & add.inv. +#M PreImagesElm( , ) . for s.p. gen. mapping resp. add. & add.inv. ## -InstallMethod( PreImagesElm, +InstallMethod( PreImagesElmNC, "method for s.p. gen. mapping respecting add. & add.inv., and element", FamRangeEqFamElm, [ IsSPGeneralMapping and RespectsAddition and RespectsAdditiveInverses, @@ -694,7 +736,7 @@ InstallMethod( PreImagesElm, function( map, elm ) local pre; - pre:= PreImagesRepresentative( map, elm ); + pre:= PreImagesRepresentativeNC( map, elm ); if pre = fail then return []; else @@ -702,12 +744,27 @@ InstallMethod( PreImagesElm, fi; end ); +InstallMethod( PreImagesElm, + "method for s.p. gen. mapping respecting add. & add.inv., and element", + FamRangeEqFamElm, + [ IsSPGeneralMapping and RespectsAddition and RespectsAdditiveInverses, + IsObject ], + function( map, elm ) + if not ( elm in Range( map ) ) then + Error( " is not in the range of " ); + elif not ( elm in Image( map ) ) then + return fail; + fi; + return PreImagesElmNC( map, elm ); + end ); + ############################################################################# ## -#M PreImagesSet( , ) for s.p. gen. mapping resp. add. & add.inv. +#M PreImagesSetNC( , ) for s.p. gen. mapp. resp. add. & add.inv. +#M PreImagesSet( , ) . for s.p. gen. mapp. resp. add. & add.inv. ## -InstallMethod( PreImagesSet, +InstallMethod( PreImagesSetNC, "method for s.p. gen. mapping resp. add. & add.inv., and add. group", CollFamRangeEqFamElms, [ IsSPGeneralMapping and RespectsAddition and RespectsAdditiveInverses, @@ -715,17 +772,28 @@ InstallMethod( PreImagesSet, function( map, elms ) local genpreimages; genpreimages:= List( GeneratorsOfAdditiveGroup( elms ), - gen -> PreImagesRepresentative( map, gen ) ); + gen -> PreImagesRepresentativeNC( map, gen ) ); if fail in genpreimages then TryNextMethod(); fi; - return SubadditiveGroupNC( Source( map ), Concatenation( GeneratorsOfAdditiveGroup( KernelOfAdditiveGeneralMapping( map ) ), genpreimages ) ); end ); +InstallMethod( PreImagesSet, + "method for s.p. gen. mapping resp. add. & add.inv., and add. group", + CollFamRangeEqFamElms, + [ IsSPGeneralMapping and RespectsAddition and RespectsAdditiveInverses, + IsAdditiveGroup ], + function( map, elms ) + if not IsSubset( Range( map ), elms ) then + Error( " is not a subset of the range of " ); + fi; + return PreImagesSetNC( map, Intersection( elms, Image( map ) ) ); + end ); + ############################################################################# ## @@ -890,9 +958,10 @@ InstallMethod( ImagesSet, ############################################################################# ## +#M PreImagesSetNC( , ) . . . for linear mapping and left module #M PreImagesSet( , ) . . . . for linear mapping and left module ## -InstallMethod( PreImagesSet, +InstallMethod( PreImagesSetNC, "method for linear mapping and left module", CollFamRangeEqFamElms, [ IsSPGeneralMapping and RespectsAddition and RespectsAdditiveInverses @@ -901,17 +970,29 @@ InstallMethod( PreImagesSet, function( map, elms ) local genpreimages; genpreimages:= List( GeneratorsOfLeftModule( elms ), - gen -> PreImagesRepresentative( map, gen ) ); + gen -> PreImagesRepresentativeNC( map, gen ) ); if fail in genpreimages then TryNextMethod(); fi; - return SubmoduleNC( Source( map ), Concatenation( GeneratorsOfLeftModule( KernelOfAdditiveGeneralMapping( map ) ), genpreimages ) ); end ); +InstallMethod( PreImagesSet, + "method for linear mapping and left module", + CollFamRangeEqFamElms, + [ IsSPGeneralMapping and RespectsAddition and RespectsAdditiveInverses + and RespectsScalarMultiplication, + IsLeftModule ], + function( map, elms ) + if not IsSubset( Range( map ), elms ) then + Error( " is not a subset of the range of " ); + fi; + return PreImagesSetNC( map, Intersection( elms, Image( map ) ) ); + end ); + ############################################################################# ## @@ -984,9 +1065,10 @@ InstallMethod( ImagesSet, ############################################################################# ## +#M PreImagesSetNC( , ) . . . . . . . for algebra hom. and FLMLOR #M PreImagesSet( , ) . . . . . . . . for algebra hom. and FLMLOR ## -InstallMethod( PreImagesSet, +InstallMethod( PreImagesSetNC, "method for algebra hom. and FLMLOR", CollFamRangeEqFamElms, [ IsSPGeneralMapping and RespectsAddition and RespectsAdditiveInverses @@ -995,11 +1077,10 @@ InstallMethod( PreImagesSet, function( map, elms ) local genpreimages; genpreimages:= List( GeneratorsOfLeftOperatorRing( elms ), - gen -> PreImagesRepresentative( map, gen ) ); + gen -> PreImagesRepresentativeNC( map, gen ) ); if fail in genpreimages then TryNextMethod(); fi; - return SubFLMLORNC( Source( map ), Concatenation( GeneratorsOfLeftOperatorRing( KernelOfAdditiveGeneralMapping( map ) ), @@ -1007,12 +1088,26 @@ InstallMethod( PreImagesSet, #T handle the case of ideals! end ); +InstallMethod( PreImagesSet, + "method for algebra hom. and FLMLOR", + CollFamRangeEqFamElms, + [ IsSPGeneralMapping and RespectsAddition and RespectsAdditiveInverses + and RespectsScalarMultiplication and RespectsMultiplication, + IsFLMLOR ], + function( map, elms ) + if not IsSubset( Range( map ), elms ) then + Error( " is not a subset of the range of " ); + fi; + return PreImagesSetNC( map, Intersection( elms, Image( map ) ) ); + end ); + ############################################################################# ## -#M PreImagesSet( , ) for alg.-with-one hom. and FLMLOR-with-one +#M PreImagesSetNC( , ) for alg-with-one hom. and FLMLOR-with-one +#M PreImagesSet( , ) . for alg-with-one hom. and FLMLOR-with-one ## -InstallMethod( PreImagesSet, +InstallMethod( PreImagesSetNC, "method for algebra-with-one hom. and FLMLOR-with-one", CollFamRangeEqFamElms, [ IsSPGeneralMapping and RespectsAddition and RespectsAdditiveInverses @@ -1022,11 +1117,10 @@ InstallMethod( PreImagesSet, function( map, elms ) local genpreimages; genpreimages:= List( GeneratorsOfLeftOperatorRingWithOne( elms ), - gen -> PreImagesRepresentative( map, gen ) ); + gen -> PreImagesRepresentativeNC( map, gen ) ); if fail in genpreimages then TryNextMethod(); fi; - return SubFLMLORNC( Source( map ), Concatenation( GeneratorsOfLeftOperatorRingWithOne( KernelOfAdditiveGeneralMapping( map ) ), @@ -1034,6 +1128,20 @@ InstallMethod( PreImagesSet, #T handle the case of ideals! end ); +InstallMethod( PreImagesSet, + "method for algebra-with-one hom. and FLMLOR-with-one", + CollFamRangeEqFamElms, + [ IsSPGeneralMapping and RespectsAddition and RespectsAdditiveInverses + and RespectsScalarMultiplication and RespectsMultiplication + and RespectsOne, + IsFLMLORWithOne ], + function( map, elms ) + if not IsSubset( Range( map ), elms ) then + Error( " is not a subset of the range of " ); + fi; + return PreImagesSetNC( map, Intersection( elms, Image( map ) ) ); + end ); + ############################################################################# ## diff --git a/lib/mapping.gd b/lib/mapping.gd index 12d2ff39dc..aefde3d805 100644 --- a/lib/mapping.gd +++ b/lib/mapping.gd @@ -751,8 +751,8 @@ DeclareAttribute( "ImagesSource", IsGeneralMapping ); ## ## is the set of preimages of the range of the general mapping map. ##

-## delegates to , -## it is introduced only to store the preimage of map as attribute +## delegates to . +## It is introduced only to store the preimage of map as an attribute ## value. ## ## @@ -968,24 +968,36 @@ DeclareGlobalFunction( "Images" ); ############################################################################# ## -#O PreImagesElm( , ) . all preimages of elm under a gen. mapping +#O PreImagesElm( , ) . . . . . . . . . . . . all preimages of elm +#O PreImagesElmNC( , ) . . . . . . . . . . . under a gen. mapping ## ## <#GAPDoc Label="PreImagesElm"> ## ## +## ## ## ## If elm is an element of the range of the general mapping ## map then returns the set of all ## preimages of elm under map. ##

-## Anything may happen if elm is not an element of the range of -## map. +## From &GAP; version 4.17.0 +## PreImagesElm was renamed PreImagesElmNC +## throughout the library, and the new PreImagesElm checks that +## elm is an element of the image before calling PreImagesElmNC. +## If elm is in the range but not in the image then fail +## is returned. +## If elm is not even in the range then an error is signalled. +##

+## When using PreImagesElmNC anything may happen if elm +## is not an element of the image of map. +##

## ## ## <#/GAPDoc> ## DeclareOperation( "PreImagesElm", [ IsGeneralMapping, IsObject ] ); +DeclareOperation( "PreImagesElmNC", [ IsGeneralMapping, IsObject ] ); ############################################################################# @@ -1002,8 +1014,8 @@ DeclareOperation( "PreImagesElm", [ IsGeneralMapping, IsObject ] ); ## returns the unique preimage of elm under ## map. ##

-## Anything may happen if elm is not an element of the range of -## map. +## If elm is not an element of the image of map +## then an error message is returned. ## ## ## <#/GAPDoc> @@ -1015,49 +1027,70 @@ DeclareOperation( "PreImageElm", ############################################################################# ## #O PreImagesRepresentative( , ) . . . one preimage of an element -## under a gen. mapping +#O PreImagesRepresentativeNC( , ) . . . . under a general mapping ## ## <#GAPDoc Label="PreImagesRepresentative"> ## ## +## ## ## -## If elm is an element of the range of the general mapping -## map then returns either a -## representative of the set of preimages of elm under map or -## fail, the latter if and only if elm -## has no preimages under map. +## If elm is an element of the image of the general mapping +## map then returns a +## representative of the set of preimages of elm under map. +##

+## From &GAP; version 4.17.0 the operation PreImagesRepresentative +## was renamed PreImagesRepresentativeNC throughout the library, +## and the new PreImagesRepresentative checks that elm is an +## element of the image before calling PreImagesRepresentativeNC. +## If elm is in the range but not in the image then fail +## is returned. +## If elm is not even in the range then an error is signalled. +##

+## When using PreImagesRepresentativeNC anything may happen if +## elm is not an element of the image of map. ##

-## Anything may happen if elm is not an element of the range of -## map. ## ## ## <#/GAPDoc> ## -DeclareOperation( "PreImagesRepresentative", - [ IsGeneralMapping, IsObject ] ); +DeclareOperation( "PreImagesRepresentative", [ IsGeneralMapping, IsObject ] ); +DeclareOperation( "PreImagesRepresentativeNC", [ IsGeneralMapping, IsObject ] ); ############################################################################# ## #O PreImagesSet( , ) +#O PreImagesSetNC( , ) ## ## <#GAPDoc Label="PreImagesSet"> ## ## +## ## ## ## If elms is a subset of the range of the general mapping map ## then returns the set of all preimages of ## elms under map. ##

-## Anything may happen if elms is not a subset of the range of -## map. +## From &GAP; version 4.17.0 PreImagesSet +## has been renamed PreImagesSetNC throughout the library, +## and the new PreImagesSet checks that elms is a +## subset of the range before calling PreImagesSetNC. +## If elms is a subset of the range but not a subset of the image then +## the returned set is +## PreImagesSetNC( map, Intersection( elms, Image(map) ) ). +## If elms is not a subset of the range then an error is signalled. +##

+## When using PreImagesSetNC anything may happen if elms +## is not a subset of the image of map. +##

## ## ## <#/GAPDoc> ## DeclareOperation( "PreImagesSet", [ IsGeneralMapping, IsListOrCollection ] ); +DeclareOperation( "PreImagesSetNC", [ IsGeneralMapping, IsListOrCollection ] ); ############################################################################# @@ -1077,37 +1110,14 @@ DeclareOperation( "PreImagesSet", [ IsGeneralMapping, IsListOrCollection ] ); ## Label="set of preimages of a collection under a general mapping"/> ## ## -## PreImage( map ) is the preimage of the general mapping -## map, i.e., the subset of elements of the source of map -## that actually have values under map. -## Note that in this case the argument may also be non-injective or -## non-surjective. -##

-## PreImage( map, elm ) is the preimage of the element -## elm of the range of the injective and surjective mapping -## map under map, i.e., the unique element of the source -## which is mapped under map to elm. -## Note that map must be injective and surjective -## (see ). -##

-## PreImage( map, coll ) is the preimage of the subset -## coll of the range of the general mapping map under -## map, i.e., the subset of the source which is mapped under -## map to elements of coll. coll may be a proper set -## or a domain. -## The result will be either a proper set or a domain. -## Note that in this case map may also be non-injective or -## non-surjective. -## (If coll and the result are lists then the positions of -## entries do in general not correspond.) -##

-## -## delegates to when -## called with one argument, -## and to resp. when -## called with two arguments. +## PreImage is a global function with three delegations. +## It delegates to when +## called with one argument. +## In the second form it delegates to , +## so that map should be injective and surjective. +## In the third form it delegates to . ##

-## If the second argument is not an element or a subset of the range of +## If the second argument is not an element or a subset of the image of ## the first argument, an error is signalled. ## ## @@ -1133,29 +1143,11 @@ DeclareGlobalFunction( "PreImage" ); ## Label="set of preimages of a collection under a general mapping"/> ## ## -## PreImages( map ) is the preimage of the general mapping -## map, i.e., the subset of elements of the source of map -## that have actually values under map. -##

-## PreImages( map, elm ) is the set of preimages of the -## element elm of the range of the general mapping map under -## map, i.e., the set of elements of the source which map maps -## to elm. -##

-## PreImages( map, coll ) is the set of images of the -## subset coll of the range of the general mapping map under -## map, i.e., the subset of the source which map maps to -## elements of coll. -## coll may be a proper set or a domain. -## The result will be either a proper set or a domain. -## (If coll and the result are lists then the positions of -## entries do in general not correspond.) -##

-## -## delegates to when -## called with one argument, -## and to resp. when -## called with two arguments. +## PreImages is a global function with three delegations. +## It delegates to when +## called with one argument. +## In the second form it delegates to , +## and in the third form it delegates to . ##

## If the second argument is not an element or a subset of the range of ## the first argument, an error is signalled. diff --git a/lib/mapping.gi b/lib/mapping.gi index 7ae902e971..58d78a473b 100644 --- a/lib/mapping.gi +++ b/lib/mapping.gi @@ -239,7 +239,8 @@ end ); InstallGlobalFunction( PreImage, function ( arg ) local map, # gen. mapping , first argument - img; # element , second argument + img, # element , second argument + rng; # the range of map if Length( arg ) > 0 and not IsGeneralMapping( arg[1] ) then ErrorNoReturn( " must be a general mapping" ); @@ -254,28 +255,29 @@ InstallGlobalFunction( PreImage, function ( arg ) map := arg[1]; img := arg[2]; + rng := Range( map ); # preimage of a single element under if FamRangeEqFamElm( FamilyObj( map ), FamilyObj( img ) ) then if not ( IsInjective( map ) and IsSurjective( map ) ) then ErrorNoReturn( " must be an injective and surjective ", "mapping" ); - elif not img in Range( map ) then + elif not img in rng then ErrorNoReturn( " must be an element of Range()" ); fi; return PreImageElm( map, img ); # preimage of a collection of elements under elif CollFamRangeEqFamElms( FamilyObj( map ), FamilyObj( img ) ) then - if not IsSubset( Range( map ), img ) then + if not IsSubset( rng, img ) then ErrorNoReturn( "the collection must be contained in ", "Range()" ); fi; if IsDomain( img ) or IsSSortedList( img ) then - return PreImagesSet( map, img ); + return PreImagesSetNC( map, Intersection( img, Image( map ) ) ); elif IsHomogeneousList( img ) then - return PreImagesSet( map, Set( img ) ); + return PreImagesSetNC( map, Intersection( Set( img ), Image( map ) ) ); fi; # preimage of the empty list @@ -1073,15 +1075,15 @@ InstallMethod( PreImageElm, ############################################################################# ## #M PreImagesElm( , ) . . . . . . for general mapping and element +#M PreImagesElmNC( , ) . . . . . for general mapping and element ## ## more or less delegate to `ImagesElm' ## -InstallMethod( PreImagesElm, +InstallMethod( PreImagesElmNC, "for general mapping with finite source, and element", FamRangeEqFamElm, [ IsGeneralMapping, IsObject ], 0, function ( map, elm ) - # for a finite source simply run over the elements of the source if IsFinite( Source( map ) ) then return Filtered( Source( map ), @@ -1093,12 +1095,26 @@ InstallMethod( PreImagesElm, fi; end ); +InstallMethod( PreImagesElm, + "for general mapping with finite source, and element", + FamRangeEqFamElm, + [ IsGeneralMapping, IsObject ], 0, + function ( map, elm ) + if not ( elm in Range( map ) ) then + Error( " is not in the range of " ); + elif not ( elm in Image( map ) ) then + return fail; + fi; + return PreImagesElmNC( map, elm ); + end ); + ############################################################################# ## -#M PreImagesElm( , ) for const. time access gen. map., and elm. +#M PreImagesElm( , ) . for const. time access gen. map., and elm. +#M PreImagesElmNC( , ) for const. time access gen. map., and elm. ## -InstallMethod( PreImagesElm, +InstallMethod( PreImagesElmNC, "for constant time access general mapping, and element", FamRangeEqFamElm, [ IsGeneralMapping and IsConstantTimeAccessGeneralMapping, IsObject ], 0, @@ -1113,12 +1129,26 @@ InstallMethod( PreImagesElm, return preimgs; end ); +InstallMethod( PreImagesElm, + "for constant time access general mapping, and element", + FamRangeEqFamElm, + [ IsGeneralMapping and IsConstantTimeAccessGeneralMapping, IsObject ], 0, + function( map, elm ) + if not ( elm in Range( map ) ) then + Error( " is not in the range of " ); + elif not ( elm in Image( map ) ) then + return fail; + fi; + return PreImagesElmNC( map, elm ); + end ); + ############################################################################# ## #M PreImagesSet( , ) . for general mapping and finite collection +#M PreImagesSetNC( , ) for general mapping and finite collection ## -InstallMethod( PreImagesSet, +InstallMethod( PreImagesSetNC, "for general mapping, and finite collection", CollFamRangeEqFamElms, [ IsGeneralMapping, IsCollection ], 0, @@ -1129,12 +1159,26 @@ InstallMethod( PreImagesSet, fi; primgs:= []; for elm in Enumerator( elms ) do - UniteSet( primgs, AsList( PreImagesElm( map, elm ) ) ); + UniteSet( primgs, AsList( PreImagesElmNC( map, elm ) ) ); od; return primgs; end ); + InstallMethod( PreImagesSet, + "for general mapping, and finite collection", + CollFamRangeEqFamElms, + [ IsGeneralMapping, IsCollection ], 0, + function( map, elms ) + local inter; + if not IsSubset( Range( map ), elms ) then + Error( " is not a subset of the range of " ); + fi; + inter := Intersection( elms, Image( map ) ); + return PreImagesSetNC( map, inter ); + end ); + +InstallMethod( PreImagesSetNC, "for general mapping, and empty list", true, [ IsGeneralMapping, IsList and IsEmpty ], 0, @@ -1142,6 +1186,14 @@ InstallMethod( PreImagesSet, return []; end ); +InstallMethod( PreImagesSet, + "for general mapping, and empty list", + true, + [ IsGeneralMapping, IsList and IsEmpty ], 0, + function( map, elms ) + return []; + end ); + ############################################################################# ## @@ -1151,7 +1203,7 @@ InstallMethod( PreImagesRange, "for general mapping", true, [ IsGeneralMapping ], 0, - map -> PreImagesSet( map, Range( map ) ) ); + map -> PreImagesSetNC( map, Range( map ) ) ); ############################################################################# @@ -1169,8 +1221,47 @@ InstallMethod( PreImagesRange, ############################################################################# ## #M PreImagesRepresentative( , ) . . for s.p. gen. mapping & elm +#M PreImagesRepresentativeNC( , ) . for s.p. gen. mapping & elm ## InstallMethod( PreImagesRepresentative, + "for s.p. general mapping, and element", + FamRangeEqFamElm, + [ IsSPGeneralMapping, IsObject ], 0, + function( map, elm ) + if not elm in Range( map ) then + Error( " is not in the range of " ); + elif not elm in Image( map ) then + return fail; + else + return PreImagesRepresentativeNC( map, elm ); + fi; + end ); + +InstallMethod( PreImagesRepresentativeNC, + "for s.p. general mapping, and element", + FamRangeEqFamElm, + [ IsSPGeneralMapping, IsObject ], 0, + function( map, elm ) + Error( "no default method for s.p. general mapping" ); + end ); + +InstallMethod( PreImagesRepresentativeNC, + "for s.p. general mapping, and element", + FamRangeEqFamElm, + [ IsSPGeneralMapping, IsObject ], 0, + function( map, elm ) + Error( "no default method for s.p. general mapping" ); + end ); + +InstallMethod( PreImagesRepresentativeNC, + "for s.p. general mapping, and element", + FamRangeEqFamElm, + [ IsSPGeneralMapping, IsObject ], 0, + function( map, elm ) + Error( "no default method for s.p. general mapping" ); + end ); + +InstallMethod( PreImagesRepresentativeNC, "for s.p. general mapping, and element", FamRangeEqFamElm, [ IsSPGeneralMapping, IsObject ], 0, @@ -1182,8 +1273,9 @@ InstallMethod( PreImagesRepresentative, ############################################################################# ## #M PreImagesRepresentative( , ) +#M PreImagesRepresentativeNC( , ) ## -InstallMethod( PreImagesRepresentative, +InstallMethod( PreImagesRepresentativeNC, "for total non-s.p. general mapping, and element", FamRangeEqFamElm, [ IsNonSPGeneralMapping, IsObject ], 0, @@ -1191,7 +1283,7 @@ InstallMethod( PreImagesRepresentative, local pres; # all preimages of under # get all preimages of under - pres := PreImagesElm( map, elm ); + pres := PreImagesElmNC( map, elm ); # check that has at least one preimage under if IsEmpty( pres ) then @@ -1202,6 +1294,19 @@ InstallMethod( PreImagesRepresentative, return Representative( pres ); end ); +InstallMethod( PreImagesRepresentative, + "for total non-s.p. general mapping, and element", + FamRangeEqFamElm, + [ IsNonSPGeneralMapping, IsObject ], 0, + function( map, elm ) + if not elm in Range( map ) then + Error( " is not in the range of " ); + elif not elm in Image( map ) then + return fail; + fi; + return PreImagesRepresentativeNC( map, elm ); + end ); + ############################################################################# ## @@ -1459,7 +1564,7 @@ InstallMethod( Enumerator, return enum; elif IsFinite( R ) then for elm in Enumerator( R ) do - imgs:= PreImagesElm( map, elm ); + imgs:= PreImagesElmNC( map, elm ); if IsFinite( imgs ) then UniteSet( enum, List( imgs, im -> DirectProductElement( [ im, elm ] ) ) ); else diff --git a/lib/mapprep.gi b/lib/mapprep.gi index 96bf008e8b..89baaa1567 100644 --- a/lib/mapprep.gi +++ b/lib/mapprep.gi @@ -302,65 +302,94 @@ InstallMethod( ImagesRepresentative, ############################################################################# ## +#M PreImagesElmNC( , ) . . . . . . . . . for composition mapping #M PreImagesElm( , ) . . . . . . . . . . for composition mapping ## -InstallMethod( PreImagesElm, +InstallMethod( PreImagesElmNC, "for a composition mapping, and an element", FamRangeEqFamElm, [ IsCompositionMappingRep, IsObject ], 0, function( com, elm ) local im; - im:= PreImagesElm( com!.map2, elm ); + # The preimages of under the second map form a set (not an + # element), so we compute the preimages of this set under the first map. + im:= PreImagesElmNC( com!.map2, elm ); if not IsEmpty( im ) then - return PreImagesSet( com!.map1, im ); + return PreImagesSetNC( com!.map1, im ); else return []; fi; end ); +InstallMethod( PreImagesElm, + "for a composition mapping, and an element", + FamRangeEqFamElm, + [ IsCompositionMappingRep, IsObject ], 0, + function( com, elm ) + if not ( elm in Range(com) ) then + Error( " is not in the range of mapping " ); + elif not ( elm in Image(com) ) then + return fail; + fi; + return PreImagesElmNC( com, elm ); + end ); + ############################################################################# ## +#M PreImagesSetNC( , ) . . . . . . . . . for composition mapping #M PreImagesSet( , ) . . . . . . . . . . for composition mapping ## -InstallMethod( PreImagesSet, +InstallMethod( PreImagesSetNC, "for a composition mapping, and a collection", CollFamRangeEqFamElms, [ IsCompositionMappingRep, IsCollection ], 0, function( com, elms ) local im; - im:= PreImagesSet( com!.map2, elms ); + im:= PreImagesSetNC( com!.map2, elms ); if not IsEmpty( im ) then - return PreImagesSet( com!.map1, im ); + return PreImagesSetNC( com!.map1, im ); else return []; fi; end ); +InstallMethod( PreImagesSet, + "for a composition mapping, and a collection", + CollFamRangeEqFamElms, + [ IsCompositionMappingRep, IsCollection ], 0, + function( com, elms ) + if not IsSubset( Range(com), elms ) then + Error( " is not a subset of the range of mapping " ); + fi; + return PreImagesSetNC( com, Intersection( elms, Image( com ) ) ); + end ); + ############################################################################# ## +#M PreImagesRepresentativeNC( , ) . . . . for composition mapping #M PreImagesRepresentative( , ) . . . . . for composition mapping ## -InstallMethod( PreImagesRepresentative, +InstallMethod( PreImagesRepresentativeNC, "for a composition mapping, and an element", FamRangeEqFamElm, [ IsCompositionMappingRep, IsObject ], 0, function( com, elm ) local im, rep; - im:= PreImagesRepresentative( com!.map2, elm ); + im:= PreImagesRepresentativeNC( com!.map2, elm ); if im = fail then # 'elm' has no preimages under 'com!.map2', so it has none under 'com'. return fail; else - im:= PreImagesRepresentative( com!.map1, im ); + im:= PreImagesRepresentativeNC( com!.map1, im ); if im <> fail then return im; fi; # It may happen that only the chosen representative has no preimages. - for im in Enumerator( PreImagesElm( com!.map2, elm ) ) do - rep:= PreImagesRepresentative( com!.map1, im ); + for im in Enumerator( PreImagesElmNC( com!.map2, elm ) ) do + rep:= PreImagesRepresentativeNC( com!.map1, im ); if rep <> fail then return rep; fi; @@ -369,6 +398,19 @@ InstallMethod( PreImagesRepresentative, fi; end ); +InstallMethod( PreImagesRepresentative, + "for a composition mapping, and an element", + FamRangeEqFamElm, + [ IsCompositionMappingRep, IsObject ], 0, + function( com, elm ) + if not ( elm in Range(com) ) then + Error( " is not in the range of mapping " ); + elif not ( elm in Image(com) ) then + return fail; + fi; + return PreImagesRepresentativeNC( com, elm ); + end ); + ############################################################################# ## @@ -383,7 +425,7 @@ InstallMethod( KernelOfAdditiveGeneralMapping, if IsInjective( com!.map2 ) then return KernelOfAdditiveGeneralMapping( com!.map1 ); else - return PreImagesSet( com!.map1, + return PreImagesSetNC( com!.map1, KernelOfAdditiveGeneralMapping( com!.map2 ) ); fi; end ); @@ -421,7 +463,7 @@ InstallMethod( KernelOfMultiplicativeGeneralMapping, if IsInjective( com!.map2 ) then return KernelOfMultiplicativeGeneralMapping( com!.map1 ); else - return PreImagesSet( com!.map1, + return PreImagesSetNC( com!.map1, KernelOfMultiplicativeGeneralMapping( com!.map2 ) ); fi; end ); @@ -629,9 +671,10 @@ end ); ############################################################################# ## +#M PreImagesRepresentativeNC( , ) . . . . for mapping by function #M PreImagesRepresentative( , ) . . . . . for mapping by function ## -InstallMethod( PreImagesRepresentative, +InstallMethod( PreImagesRepresentativeNC, "for mapping by function", FamRangeEqFamElm, [ IsMappingByFunctionRep, IsObject ], 0, @@ -643,6 +686,19 @@ InstallMethod( PreImagesRepresentative, return map!.prefun( elm ); end ); +InstallMethod( PreImagesRepresentative, + "for mapping by function", + FamRangeEqFamElm, + [ IsMappingByFunctionRep, IsObject ], 0, + function ( map, elm ) + if not ( elm in Range(map) ) then + Error( " is not in the range of " ); + elif not ( elm in Image(map) ) then + return fail; + fi; + return PreImagesRepresentativeNC( map, elm ); + end ); + ############################################################################# ## @@ -653,15 +709,20 @@ InstallMethod( PreImageElm, FamRangeEqFamElm, [ IsMappingByFunctionWithInverseRep, IsObject ], 0, function ( map, elm ) - return map!.invFun( elm ); + if not ( elm in Image( map ) ) then + Error( " is not in the image of " ); + else + return map!.invFun( elm ); + fi; end ); ############################################################################# ## -#M PreImagesElm( , ) . . . . . . . . . . for mapping by function +#M PreImagesElmNC( , ) . . . . . . . . . . for mapping by function +#M PreImagesElm( , ) . . . . . . . . . . . for mapping by function ## -InstallMethod( PreImagesElm, +InstallMethod( PreImagesElmNC, "for mapping by function", FamRangeEqFamElm, [ IsMappingByFunctionWithInverseRep, IsObject ], 0, @@ -669,11 +730,26 @@ InstallMethod( PreImagesElm, return [ map!.invFun( elm ) ]; end ); +InstallMethod( PreImagesElm, + "for mapping by function", + FamRangeEqFamElm, + [ IsMappingByFunctionWithInverseRep, IsObject ], 0, + function ( map, elm ) + if not ( elm in Range(map) ) then + Error( " is not in the range of " ); + elif not ( elm in Image(map) ) then + return fail; + fi; + return PreImagesElmNC( map, elm ); + end ); + + ############################################################################# ## +#M PreImagesRepresentativeNC( , ) . . . . for mapping by function #M PreImagesRepresentative( , ) . . . . . for mapping by function ## -InstallMethod( PreImagesRepresentative, +InstallMethod( PreImagesRepresentativeNC, "for mapping by function with inverse", FamRangeEqFamElm, [ IsMappingByFunctionWithInverseRep, IsObject ], 0, @@ -681,6 +757,18 @@ InstallMethod( PreImagesRepresentative, return map!.invFun( elm ); end ); +InstallMethod( PreImagesRepresentative, + "for mapping by function with inverse", + FamRangeEqFamElm, + [ IsMappingByFunctionWithInverseRep, IsObject ], 0, + function ( map, elm ) + if not ( elm in Range(map) ) then + Error( " is not in the range of " ); + elif not ( elm in Image(map) ) then + return fail; + fi; + return PreImagesRepresentativeNC( map, elm ); + end ); ############################################################################# @@ -1008,7 +1096,7 @@ InstallMethod( ImagesElm, FamSourceEqFamElm, [ IsGeneralMapping and IsInverseGeneralMappingRep, IsObject ], 0, function ( inv, elm ) - return PreImagesElm( InverseGeneralMapping( inv ), elm ); + return PreImagesElmNC( InverseGeneralMapping( inv ), elm ); end ); @@ -1021,7 +1109,7 @@ InstallMethod( ImagesSet, CollFamSourceEqFamElms, [ IsGeneralMapping and IsInverseGeneralMappingRep, IsCollection ], 0, function ( inv, elms ) - return PreImagesSet( InverseGeneralMapping( inv ), elms ); + return PreImagesSetNC( InverseGeneralMapping( inv ), elms ); end ); @@ -1034,7 +1122,7 @@ InstallMethod( ImagesRepresentative, FamSourceEqFamElm, [ IsGeneralMapping and IsInverseGeneralMappingRep, IsObject ], 0, function ( inv, elm ) - return PreImagesRepresentative( InverseGeneralMapping( inv ), elm ); + return PreImagesRepresentativeNC( InverseGeneralMapping( inv ), elm ); end ); @@ -1048,15 +1136,20 @@ InstallMethod( PreImageElm, [ IsGeneralMapping and IsInverseGeneralMappingRep and IsInjective and IsSurjective, IsObject ], 0, function ( inv, elm ) - return ImageElm( InverseGeneralMapping( inv ), elm ); + if not ( elm in Image( inv ) ) then + Error( " is not in the image of " ); + else + return ImageElm( InverseGeneralMapping( inv ), elm ); + fi; end ); ############################################################################# ## +#M PreImagesElmNC( , ) . . . . for inverse mapping and element #M PreImagesElm( , ) . . . . . for inverse mapping and element ## -InstallMethod( PreImagesElm, +InstallMethod( PreImagesElmNC, "for an inverse mapping and an element", FamRangeEqFamElm, [ IsGeneralMapping and IsInverseGeneralMappingRep, IsObject ], 0, @@ -1064,12 +1157,26 @@ InstallMethod( PreImagesElm, return ImagesElm( InverseGeneralMapping( inv ), elm ); end ); +InstallMethod( PreImagesElm, + "for an inverse mapping and an element", + FamRangeEqFamElm, + [ IsGeneralMapping and IsInverseGeneralMappingRep, IsObject ], 0, + function ( inv, elm ) + if not ( elm in Range(inv) ) then + Error( " is not in the range of mapping " ); + elif not ( elm in Image(inv) ) then + return fail; + fi; + return PreImagesElmNC( inv, elm ); + end ); + ############################################################################# ## -#M PreImagesSet( , ) . . for inverse mapping and collection +#M PreImagesSetNC( , ) . . for inverse mapping and collection +#M PreImagesSet( , ) . . . for inverse mapping and collection ## -InstallMethod( PreImagesSet, +InstallMethod( PreImagesSetNC, "for an inverse mapping and a collection", CollFamRangeEqFamElms, [ IsGeneralMapping and IsInverseGeneralMappingRep, IsCollection ], 0, @@ -1077,12 +1184,24 @@ InstallMethod( PreImagesSet, return ImagesSet( InverseGeneralMapping( inv ), elms ); end ); +InstallMethod( PreImagesSet, + "for an inverse mapping and a collection", + CollFamRangeEqFamElms, + [ IsGeneralMapping and IsInverseGeneralMappingRep, IsCollection ], 0, + function ( inv, elms ) + if not IsSubset( Range(inv), elms ) then + Error( " is not a subset of the range of mapping " ); + fi; + return PreImagesSetNC( inv, Intersection( elms, Image( inv ) ) ); + end ); + ############################################################################# ## -#M PreImagesRepresentative( , ) . . for inv. mapping and elm. +#M PreImagesRepresentativeNC( , ) . . for inv. mapping and elm. +#M PreImagesRepresentative( , ) . . . for inv. mapping and elm. ## -InstallMethod( PreImagesRepresentative, +InstallMethod( PreImagesRepresentativeNC, "for an inverse mapping and an element", FamRangeEqFamElm, [ IsInverseGeneralMappingRep, IsObject ], 0, @@ -1090,6 +1209,19 @@ InstallMethod( PreImagesRepresentative, return ImagesRepresentative( InverseGeneralMapping( inv ), elm ); end ); +InstallMethod( PreImagesRepresentative, + "for an inverse mapping and an element", + FamRangeEqFamElm, + [ IsInverseGeneralMappingRep, IsObject ], 0, + function ( inv, elm ) + if not elm in Range(inv) then + Error( " is not in the range of mapping " ); + elif not elm in Image(inv) then + return fail; + fi; + return PreImagesRepresentativeNC( inv, elm ); + end ); + ############################################################################# ## @@ -1287,15 +1419,20 @@ InstallMethod( PreImageElm, [ IsGeneralMapping and IsOne, IsObject ], SUM_FLAGS, # can't do better function ( id, elm ) - return elm; + if not ( elm in Image( id ) ) then + Error( " is not in the image of " ); + else + return elm; + fi; end ); ############################################################################# ## +#M PreImagesElmNC( , ) . . . for identity mapping and element #M PreImagesElm( , ) . . . . for identity mapping and element ## -InstallMethod( PreImagesElm, +InstallMethod( PreImagesElmNC, "for identity mapping and object", FamRangeEqFamElm, [ IsGeneralMapping and IsOne, IsObject ], @@ -1304,12 +1441,27 @@ InstallMethod( PreImagesElm, return [ elm ]; end ); +InstallMethod( PreImagesElm, + "for identity mapping and object", + FamRangeEqFamElm, + [ IsGeneralMapping and IsOne, IsObject ], + SUM_FLAGS, # can't do better + function ( id, elm ) + if not ( elm in Range(id) ) then + Error( " is not in the range of mapping " ); + elif not ( elm in Image(id) ) then + return fail; + fi; + return PreImagesElmNC( id, elm ); + end ); + ############################################################################# ## +#M PreImagesSetNC( , ) . . for identity mapping and collection #M PreImagesSet( , ) . . . for identity mapping and collection ## -InstallMethod( PreImagesSet, +InstallMethod( PreImagesSetNC, "for identity mapping and collection", CollFamRangeEqFamElms, [ IsGeneralMapping and IsOne, IsCollection ], @@ -1318,12 +1470,25 @@ InstallMethod( PreImagesSet, return elms; end ); +InstallMethod( PreImagesSet, + "for identity mapping and collection", + CollFamRangeEqFamElms, + [ IsGeneralMapping and IsOne, IsCollection ], + SUM_FLAGS, # can't do better + function ( id, elms ) + if not IsSubset( Range(id), elms ) then + Error( " is not a subset of the range of mapping " ); + fi; + return PreImagesSetNC( id, Intersection( elms, Image( id ) ) ); + end ); + ############################################################################# ## +#M PreImagesRepresentativeNC( , ) #M PreImagesRepresentative( , ) ## -InstallMethod( PreImagesRepresentative, +InstallMethod( PreImagesRepresentativeNC, "for identity mapping and object", FamRangeEqFamElm, [ IsGeneralMapping and IsOne, IsObject ], @@ -1332,6 +1497,19 @@ InstallMethod( PreImagesRepresentative, return elm; end ); +InstallMethod( PreImagesRepresentative, + "for identity mapping and object", + FamRangeEqFamElm, + [ IsGeneralMapping and IsOne, IsObject ], + SUM_FLAGS, # can't do better + function ( id, elm ) + if not ( elm in Range(id) ) then + Error( " is not in the range of mapping " ); + elif not ( elm in Image(id) ) then + return fail; + fi; + return elm; + end ); ############################################################################# ## @@ -1581,9 +1759,10 @@ InstallMethod( ImagesRepresentative, ############################################################################# ## +#M PreImagesElmNC( , ) . . . . for zero mapping and element #M PreImagesElm( , ) . . . . . for zero mapping and element ## -InstallMethod( PreImagesElm, +InstallMethod( PreImagesElmNC, "for zero mapping and object", FamRangeEqFamElm, [ IsGeneralMapping and IsZero, IsObject ], SUM_FLAGS, @@ -1595,12 +1774,26 @@ InstallMethod( PreImagesElm, fi; end ); +InstallMethod( PreImagesElm, + "for zero mapping and object", + FamRangeEqFamElm, + [ IsGeneralMapping and IsZero, IsObject ], SUM_FLAGS, + function( zero, elm ) + if not ( elm in Range(zero) ) then + Error( " is not in the range of mapping " ); + elif not ( elm in Image(zero) ) then + return fail; + fi; + return PreImagesElmNC( zero, elm ); + end ); + ############################################################################# ## +#M PreImagesSetNC( , ) . . . for zero mapping and collection #M PreImagesSet( , ) . . . . for zero mapping and collection ## -InstallMethod( PreImagesSet, +InstallMethod( PreImagesSetNC, "for zero mapping and collection", CollFamRangeEqFamElms, [ IsGeneralMapping and IsZero, IsCollection ], SUM_FLAGS, @@ -1612,12 +1805,24 @@ InstallMethod( PreImagesSet, fi; end ); +InstallMethod( PreImagesSet, + "for zero mapping and collection", + CollFamRangeEqFamElms, + [ IsGeneralMapping and IsZero, IsCollection ], SUM_FLAGS, + function( zero, elms ) + if not IsSubset( Range(zero), elms ) then + Error( " is not a subset of the range of mapping " ); + fi; + return PreImagesSetNC( zero, Intersection( elms, Image( zero ) ) ); + end ); + ############################################################################# ## +#M PreImagesRepresentativeNC( , ) #M PreImagesRepresentative( , ) ## -InstallMethod( PreImagesRepresentative, +InstallMethod( PreImagesRepresentativeNC, "for zero mapping and object", FamRangeEqFamElm, [ IsGeneralMapping and IsZero, IsObject ], SUM_FLAGS, @@ -1629,6 +1834,19 @@ InstallMethod( PreImagesRepresentative, fi; end ); +InstallMethod( PreImagesRepresentative, + "for zero mapping and object", + FamRangeEqFamElm, + [ IsGeneralMapping and IsZero, IsObject ], SUM_FLAGS, + function( zero, elm ) + if not elm in Range(zero) then + Error( " is not in the range of mapping " ); + elif not elm in Image(zero) then + return fail; + fi; + return PreImagesRepresentativeNC( zero, elm ); + end ); + ############################################################################# ## @@ -1817,34 +2035,49 @@ end ); ############################################################################# ## +#M PreImagesElmNC( , ) . . . . . . . . . for restricted mapping #M PreImagesElm( , ) . . . . . . . . . . for restricted mapping ## -InstallMethod( PreImagesElm, +InstallMethod( PreImagesElmNC, "for a restricted mapping, and an element", FamRangeEqFamElm, [ IsGeneralRestrictedMappingRep, IsObject ], 0, function( res, elm ) local preim; - preim:= PreImagesElm( res!.map, elm ); + preim:= PreImagesElmNC( res!.map, elm ); if not ( (HasIsInjective(res) and IsInjective(res)) or (HasIsInjective(res!.map) and IsInjective(res!.map)) ) then preim:=Intersection(Source(res),preim); fi; return preim; -end ); + end ); + +InstallMethod( PreImagesElm, + "for a restricted mapping, and an element", + FamRangeEqFamElm, + [ IsGeneralRestrictedMappingRep, IsObject ], 0, + function( res, elm ) + if not ( elm in Range(res) ) then + Error( " is not in the range of mapping " ); + elif not ( elm in Image(res) ) then + return fail; + fi; + return PreImagesElmNC( res, elm ); + end ); ############################################################################# ## +#M PreImagesSetNC( , ) . . . . . . . . . for restricted mapping #M PreImagesSet( , ) . . . . . . . . . . for restricted mapping ## -InstallMethod( PreImagesSet, +InstallMethod( PreImagesSetNC, "for a restricted mapping, and a collection", CollFamRangeEqFamElms, [ IsGeneralRestrictedMappingRep, IsCollection ], 0, function( res, elms ) local preim; - preim:= PreImagesSet( res!.map, elms ); + preim:= PreImagesSetNC( res!.map, elms ); if not ( (HasIsInjective(res) and IsInjective(res)) or (HasIsInjective(res!.map) and IsInjective(res!.map)) ) then preim:=Intersection(Source(res),preim); @@ -1852,18 +2085,30 @@ InstallMethod( PreImagesSet, return preim; end ); +InstallMethod( PreImagesSet, + "for a restricted mapping, and a collection", + CollFamRangeEqFamElms, + [ IsGeneralRestrictedMappingRep, IsCollection ], 0, + function( res, elms ) + if not IsSubset( Range(res), elms ) then + Error( " is not a subset of the range of mapping " ); + fi; + return PreImagesSetNC( res, Intersection( elms, Image( res ) ) ); + end ); + ############################################################################# ## +#M PreImagesRepresentativeNC( , ) . . . . for restricted mapping #M PreImagesRepresentative( , ) . . . . . for restricted mapping ## -InstallMethod( PreImagesRepresentative, +InstallMethod( PreImagesRepresentativeNC, "for a restricted mapping, and an element", FamRangeEqFamElm, [ IsGeneralRestrictedMappingRep, IsObject ], 0, function( res, elm ) local preim; - preim:= PreImagesRepresentative( res!.map, elm ); + preim:= PreImagesRepresentativeNC( res!.map, elm ); if preim = fail then # 'elm' has no preimages under 'res!.map', so it has none under 'res'. return fail; @@ -1877,6 +2122,19 @@ InstallMethod( PreImagesRepresentative, fi; end ); +InstallMethod( PreImagesRepresentative, + "for a restricted mapping, and an element", + FamRangeEqFamElm, + [ IsGeneralRestrictedMappingRep, IsObject ], 0, + function( res, elm ) + if not ( elm in Range(res) ) then + Error( " is not in the range of mapping " ); + elif not ( elm in Image(res) ) then + return fail; + fi; + return PreImagesRepresentativeNC( res, elm ); + end ); + ############################################################################# ## diff --git a/lib/maxsub.gi b/lib/maxsub.gi index 2b0d174a43..2f9d01df5c 100644 --- a/lib/maxsub.gi +++ b/lib/maxsub.gi @@ -182,7 +182,7 @@ BindGlobal("MaximalSubgroupClassesSol",function(G) sel:=Filtered([1..Length(mgi[2])],x->not IsOne(mgi[2][x])); if 4^Length(sel)>Size(Range(ff.factorhom)) then f:=SmallGeneratingSet(Image(ff.factorhom)); - mgi:=[List(f,x->PreImagesRepresentative(ff.factorhom,x)),f]; + mgi:=[List(f,x->PreImagesRepresentativeNC(ff.factorhom,x)),f]; sel:=[1..Length(mgi[1])]; fi; gensG:=mgi[1]{sel}; @@ -195,8 +195,8 @@ BindGlobal("MaximalSubgroupClassesSol",function(G) fam:=FamilyObj(One(Range(fphom))); # just in case the stored group generators differ... wordfpgens:=List(wordgens,x->ElementOfFpGroup(fam,x)); - wordpre:=List(wordfpgens,x->PreImagesRepresentative(ff.factorhom, - PreImagesRepresentative(fphom,x))); + wordpre:=List(wordfpgens,x->PreImagesRepresentativeNC(ff.factorhom, + PreImagesRepresentativeNC(fphom,x))); fphom:=ff.factorhom*fphom; # no assertion as this is not a proper homomorphism, but an inverse # multiplicative map @@ -511,7 +511,7 @@ local hom,embs,s,k,agens,ad,i,j,perm,dia,ggens,e,tgens,d,m,reco,emba,outs,id; m:=[]; d:=SubgroupNC(w,d); for i in e do - j:=PreImagesRepresentative(hom,i^-1); + j:=PreImagesRepresentativeNC(hom,i^-1); Info(InfoLattice,2,"Orders:",Order(i),",",Order(j)); j:=d^j; if donorm then @@ -637,9 +637,9 @@ local dom, o, t1, a1, t1d, proj, reps, ts, ta, tb, s1, i, fix, wnew, max, s, p1, # get the ts corresponding to points proj:=Projection(w); projG:=RestrictedMapping(proj,G); - reps:=List([1..n],i->PreImagesRepresentative(projG,RepresentativeAction(Image(projG),1,i))); + reps:=List([1..n],i->PreImagesRepresentativeNC(projG,RepresentativeAction(Image(projG),1,i))); reps[n+1]:= - PreImagesRepresentative(proj,RepresentativeAction(Image(proj),[1..n],[n+1..2*n],OnSets)); + PreImagesRepresentativeNC(proj,RepresentativeAction(Image(proj),[1..n],[n+1..2*n],OnSets)); for i in [2..n] do j:=reps[i]*reps[n+1]; reps[1^Image(proj,j)]:=j; @@ -669,8 +669,8 @@ local dom, o, t1, a1, t1d, proj, reps, ts, ta, tb, s1, i, fix, wnew, max, s, p1, en1:=Embedding(wnew,1); en2:=Embedding(wnew,2); emb:=List(GeneratorsOfGroup(s),i-> - Image(en1,PreImagesRepresentative(p1,RestrictedPerm(i,ts[1]))) - *Image(en2,PreImagesRepresentative(p2,RestrictedPerm(i,ts[f]))) ); + Image(en1,PreImagesRepresentativeNC(p1,RestrictedPerm(i,ts[1]))) + *Image(en2,PreImagesRepresentativeNC(p2,RestrictedPerm(i,ts[f]))) ); emb:=GroupHomomorphismByImages(s,wnew,GeneratorsOfGroup(s),emb); ma:=MaxesType3(wnew,Image(emb,s),a1,t1,2,false); for i in ma do @@ -703,7 +703,7 @@ local m, fact, fg, reps, ma, idx, nm, embs, proj, kproj, k, ag, agl, ug, # type 4c reps:=List([1..n], - i->PreImagesRepresentative(fact,RepresentativeAction(fg,1,i))); + i->PreImagesRepresentativeNC(fact,RepresentativeAction(fg,1,i))); # get the maximal subgroups of A, intersect with t to get the socle part @@ -762,8 +762,8 @@ local m, fact, fg, reps, ma, idx, nm, embs, proj, kproj, k, ag, agl, ug, #phi:=ActionHomomorphism(fg,u.orbit,OnSets); #ue:=Image(phi,fg); #reps:=List([1..nlb],i->RepresentativeAction(ue,1,i)); - #reps:=List(reps,i->PreImagesRepresentative(phi,i)); - #reps:=List(reps,i->PreImagesRepresentative(fact,i)); + #reps:=List(reps,i->PreImagesRepresentativeNC(phi,i)); + #reps:=List(reps,i->PreImagesRepresentativeNC(fact,i)); #u:=u.stabilizer; uphi:=ActionHomomorphism(Image(fact,u),b); diff --git a/lib/mgmring.gi b/lib/mgmring.gi index 077f27c153..534042435a 100644 --- a/lib/mgmring.gi +++ b/lib/mgmring.gi @@ -1220,7 +1220,7 @@ InstallMethod( ImagesRepresentative, end ); -InstallMethod( PreImagesElm, +InstallMethod( PreImagesElmNC, "for embedding of ring into magma ring, and free magma ring element", FamRangeEqFamElm, [ IsEmbeddingRingMagmaRing, IsElementOfFreeMagmaRing ], @@ -1236,7 +1236,20 @@ InstallMethod( PreImagesElm, fi; end ); -InstallMethod( PreImagesRepresentative, +InstallMethod( PreImagesElm, + "for embedding of ring into magma ring, and free magma ring element", + FamRangeEqFamElm, + [ IsEmbeddingRingMagmaRing, IsElementOfFreeMagmaRing ], + function ( emb, elm ) + if not ( elm in Range( emb ) ) then + Error( " is not in the range of mapping " ); + elif not ( elm in Image( emb ) ) then + return fail; + fi; + return PreImagesElmNC( emb, elm ); + end ); + +InstallMethod( PreImagesRepresentativeNC, "for embedding of ring into magma ring, and free magma ring element", FamRangeEqFamElm, [ IsEmbeddingRingMagmaRing, IsElementOfFreeMagmaRing ], @@ -1252,6 +1265,19 @@ InstallMethod( PreImagesRepresentative, fi; end ); +InstallMethod( PreImagesRepresentative, + "for embedding of ring into magma ring, and free magma ring element", + FamRangeEqFamElm, + [ IsEmbeddingRingMagmaRing, IsElementOfFreeMagmaRing ], + function ( emb, elm ) + if not ( elm in Range( emb ) ) then + Error( " is not in the range of the mapping " ); + elif not ( elm in Image( emb ) ) then + return fail; + fi; + return PreImagesRepresentativeNC( emb, elm ); + end ); + ############################################################################# ## @@ -1324,7 +1350,7 @@ InstallMethod( ImagesRepresentative, end ); -InstallMethod( PreImagesElm, +InstallMethod( PreImagesElmNC, "for embedding of magma into magma ring, and free magma ring element", FamRangeEqFamElm, [ IsEmbeddingMagmaMagmaRing, IsElementOfFreeMagmaRing ], @@ -1340,7 +1366,20 @@ InstallMethod( PreImagesElm, fi; end ); -InstallMethod( PreImagesRepresentative, +InstallMethod( PreImagesElm, + "for embedding of magma into magma ring, and free magma ring element", + FamRangeEqFamElm, + [ IsEmbeddingMagmaMagmaRing, IsElementOfFreeMagmaRing ], + function ( emb, elm ) + if not ( elm in Range( emb ) ) then + Error( " is not in the range of mapping " ); + elif not ( elm in Image( emb ) ) then + return fail; + fi; + return PreImagesElmNC( emb, elm ); + end ); + +InstallMethod( PreImagesRepresentativeNC, "for embedding of magma into magma ring, and free magma ring element", FamRangeEqFamElm, [ IsEmbeddingMagmaMagmaRing, IsElementOfFreeMagmaRing ], @@ -1356,6 +1395,18 @@ InstallMethod( PreImagesRepresentative, fi; end ); +InstallMethod( PreImagesRepresentative, + "for embedding of magma into magma ring, and free magma ring element", + FamRangeEqFamElm, + [ IsEmbeddingMagmaMagmaRing, IsElementOfFreeMagmaRing ], + function ( emb, elm ) + if not ( elm in Range( emb ) ) then + Error( " is not in the range of mapping " ); + elif not ( elm in Image( emb ) ) then + return fail; + fi; + return PreImagesRepresentativeNC( emb, elm ); + end ); ############################################################################# ## diff --git a/lib/morpheus.gi b/lib/morpheus.gi index dfcbd155a8..d205b48ef9 100644 --- a/lib/morpheus.gi +++ b/lib/morpheus.gi @@ -753,10 +753,10 @@ local hom, gens, c, ran, r, cen, img, u, orbs, function(perm) if perm in store[1] then return ConjugatorAutomorphismNC(g, - PreImagesRepresentative(img[2],perm)); + PreImagesRepresentativeNC(img[2],perm)); fi; return GroupHomomorphismByImagesNC(g,g,GeneratorsOfGroup(g), - List(store[2],i->PreImagesRepresentative(img[2],i^perm))); + List(store[2],i->PreImagesRepresentativeNC(img[2],i^perm))); end); if bestdegPreImagesRepresentative(store[3],i^perm))); + List(store[4],i->PreImagesRepresentativeNC(store[3],i^perm))); end); if bestdeg not in the range of mapping " ); + elif not (elm in Image(hom)) then + return fail; + fi; + return PreImagesRepresentativeNC(hom,elm); +end); + ############################################################################# ## @@ -1776,7 +1788,7 @@ local combi,Gr,Gcl,Ggc,Hr,Hcl,bg,bpri,x,dat, if IsSolvableGroup(G) then gens:=IsomorphismPcGroup(G); gens:=List(MinimalGeneratingSet(Image(gens)), - i->PreImagesRepresentative(gens,i)); + i->PreImagesRepresentativeNC(gens,i)); Ggc:=List(gens,i->First(Gcl,j->ForAny(j,j->ForAny(j.classes,k->i in k)))); combi:=List(Ggc,i->Concatenation(List(i,i->i.classes))); bcl:=ShallowCopy(combi); @@ -2167,7 +2179,7 @@ local d,id,H,iso,aut,auts,i,all,hom,field,dim,P,diag,mats,gens,gal; fi; aut:=GroupGeneralMappingByImages(G,G,gens, List(gens, - x->PreImagesRepresentative(iso,Image(iso,x)^(1,2)))); + x->PreImagesRepresentativeNC(iso,Image(iso,x)^(1,2)))); auts:=[aut]; all:=true; fi; @@ -2228,7 +2240,7 @@ local d,id,H,iso,aut,auts,i,all,hom,field,dim,P,diag,mats,gens,gal; fi; auts:=Concatenation(auts, List(mats,s->GroupGeneralMappingByImages(G,G,gens,List(gens,x-> - Image(hom,PreImagesRepresentative(hom,x)^s))))); + Image(hom,PreImagesRepresentativeNC(hom,x)^s))))); else gal:=Group(()); # to force trivial @@ -2240,13 +2252,13 @@ local d,id,H,iso,aut,auts,i,all,hom,field,dim,P,diag,mats,gens,gal; List(MinimalGeneratingSet(gal), s->GroupGeneralMappingByImages(G,G,gens,List(gens,x-> Image(hom, - List(PreImagesRepresentative(hom,x),r->List(r,y->Image(s,y)))))))); + List(PreImagesRepresentativeNC(hom,x),r->List(r,y->Image(s,y)))))))); fi; # graph if id.series="L" and id.parameter[1]>2 then Add(auts, GroupGeneralMappingByImages(G,G,gens,List(gens,x-> - Image(hom,Inverse(TransposedMat(PreImagesRepresentative(hom,x))))))); + Image(hom,Inverse(TransposedMat(PreImagesRepresentativeNC(hom,x))))))); all:=true; elif id.series="L" and id.parameter[1]=2 then # note no graph @@ -2411,7 +2423,7 @@ InstallGlobalFunction(AutomorphismGroupFittingFree,function(g) thom:=i[j][2]; thom:=GroupHomomorphismByImagesNC(t,t,GeneratorsOfGroup(t), List(GeneratorsOfGroup(t), - j->Image(thom,PreImagesRepresentative(thom,j)^gen))); + j->Image(thom,PreImagesRepresentativeNC(thom,j)^gen))); thom:=Image(auph,thom); Add(genimgs,thom); od; @@ -2469,7 +2481,7 @@ InstallGlobalFunction(AutomorphismGroupFittingFree,function(g) for i in gens do au:=GroupHomomorphismByImages(g,g,GeneratorsOfGroup(g), List(GeneratorsOfGroup(g), - j->PreImagesRepresentative(emb,Image(emb,j)^i))); + j->PreImagesRepresentativeNC(emb,Image(emb,j)^i))); Add(a,au); od; au:=Group(a); @@ -2510,7 +2522,7 @@ InstallGlobalFunction(AutomorphismGroupFittingFree,function(g) bi:=[]; for i in newbas do s:=List(stbs[i], - x->Image(emb,Image(autom,PreImagesRepresentative(emb,x)))); + x->Image(emb,Image(autom,PreImagesRepresentativeNC(emb,x)))); s:=First(orb[orpo[i]],x->ForAll(s,j->x^j=x)); Add(bi,s); od; diff --git a/lib/norad.gi b/lib/norad.gi index 7457f035e8..6323d1070d 100644 --- a/lib/norad.gi +++ b/lib/norad.gi @@ -173,7 +173,7 @@ local d,orb,len,S,depths,rel,stb,img,pos,i,j,k,ii,po,rep,sg,sf,sfs,fr,first, if r<>fail then Add(good,r);fi; return r<>fail; end); - good:=List(good,x->PreImagesRepresentative(pacthom,x)); + good:=List(good,x->PreImagesRepresentativeNC(pacthom,x)); good:=Filtered(good,x->not IsOne(x[2])); @@ -418,7 +418,7 @@ local sus,ser,len,factorhom,uf,n,d,up,mran,nran,mpcgs,pcgs,pcisom,nf,ng,np,sub, glact:=ActionHomomorphism(glperm,lvecs, GeneratorsOfGroup(glperm), List(GeneratorsOfGroup(glperm), - x->PreImagesRepresentative(glhom,x)), + x->PreImagesRepresentativeNC(glhom,x)), OnLines,"surjective"); stb:=Image(glact); for clu in localclust do @@ -478,7 +478,7 @@ local sus,ser,len,factorhom,uf,n,d,up,mran,nran,mpcgs,pcgs,pcisom,nf,ng,np,sub, Info(InfoFitFree,1,"Radsize= ",Size(ufr)," index ",Index(uf,ufr)); uff:=SmallGeneratingSet(uf); - ufg:=List(uff,x->PreImagesRepresentative(sus.rest,x)); + ufg:=List(uff,x->PreImagesRepresentativeNC(sus.rest,x)); n:=Normalizer(Image(factorhom),uf); @@ -503,7 +503,7 @@ local sus,ser,len,factorhom,uf,n,d,up,mran,nran,mpcgs,pcgs,pcisom,nf,ng,np,sub, nf:=SmallGeneratingSet(n); fi; - ng:=List(nf,x->PreImagesRepresentative(factorhom,x)); + ng:=List(nf,x->PreImagesRepresentativeNC(factorhom,x)); np:=pcgs; up:=sus.pcgs; diff --git a/lib/onecohom.gi b/lib/onecohom.gi index b49eb0b2a3..f7d0f93ec1 100644 --- a/lib/onecohom.gi +++ b/lib/onecohom.gi @@ -128,7 +128,7 @@ local hom,fg,fpi,fpg,nt,fam; fpg:=FreeGeneratorsOfFpGroup(Range(hom)); ocr.factorpres:=[fpg,RelatorsOfFpGroup(Range(hom))]; ocr.generators:=List(GeneratorsOfGroup(Range(hom)), - i->PreImagesRepresentative(hom,i)); + i->PreImagesRepresentativeNC(hom,i)); else if (Index(ocr.group,nt)>Size(nt)^3 @@ -159,9 +159,9 @@ local hom,fg,fpi,fpg,nt,fam; fpg:=FreeGeneratorsOfFpGroup(Range(fpi)); ocr.factorpres:=[fpg,RelatorsOfFpGroup(Range(fpi)), List(GeneratorsOfGroup(Range(fpi)), - i->PreImagesRepresentative(fpi,i))]; + i->PreImagesRepresentativeNC(fpi,i))]; if not IsBound(ocr.generators) then - ocr.generators:=List(ocr.factorpres[3],i->PreImagesRepresentative(hom,i)); + ocr.generators:=List(ocr.factorpres[3],i->PreImagesRepresentativeNC(hom,i)); fi; @@ -171,7 +171,7 @@ local hom,fg,fpi,fpg,nt,fam; # else # old code # fpi:=IsomorphismFpGroup(ocr.group:noshort:=true); # ocr.generators:=List(MappingGeneratorsImages(fpi)[2], -# i->PreImagesRepresentative(fpi,i)); +# i->PreImagesRepresentativeNC(fpi,i)); # fi; fpg:=FreeGeneratorsOfFpGroup(Range(fpi)); ocr.factorpres:=[fpg,RelatorsOfFpGroup(Range(fpi))]; @@ -191,7 +191,7 @@ local hom,fg,fpi,fpg,nt,fam; fpi:=IsomorphismFpGroupByChiefSeriesFactor(ocr.group,"f",nt); fam:=FamilyObj(One(Range(fpi))); fpg:=FreeGeneratorsOfFpGroup(Range(fpi)); - ocr.generators:=List(fpg,i->PreImagesRepresentative(fpi, + ocr.generators:=List(fpg,i->PreImagesRepresentativeNC(fpi, ElementOfFpGroup(fam,i))); ocr.factorpres:=[fpg,RelatorsOfFpGroup(Range(fpi)),ocr.generators]; fi; diff --git a/lib/oprt.gi b/lib/oprt.gi index bfc36ed13b..a3b4bfb659 100644 --- a/lib/oprt.gi +++ b/lib/oprt.gi @@ -2942,7 +2942,7 @@ local G, D, d, e, gens, acts, act, xset, hom, p, rep; rep := RepresentativeActionOp( ImagesSource( hom ), d, e, OnPoints ); if rep <> fail then - rep := PreImagesRepresentative( hom, rep ); + rep := PreImagesRepresentativeNC( hom, rep ); fi; return rep; elif IsBound( D ) then @@ -3396,9 +3396,10 @@ end ); ############################################################################# ## +#M PreImagesRepresentativeNC( , ) . . . . . . . . . build matrix #M PreImagesRepresentative( , ) . . . . . . . . . . build matrix ## -InstallMethod( PreImagesRepresentative,"IsLinearActionHomomorphism", +InstallMethod( PreImagesRepresentativeNC,"IsLinearActionHomomorphism", FamRangeEqFamElm, [ IsLinearActionHomomorphism, IsPerm ], 0, function( hom, elm ) local V, G, Grep, filt, R, xset,lab,f; @@ -3410,7 +3411,7 @@ function( hom, elm ) TryNextMethod(); fi; - # PreImagesRepresentative does not test membership + # PreImagesRepresentativeNC does not test membership #if not elm in Image( hom ) then return fail; fi; xset:=UnderlyingExternalSet(hom); V := HomeEnumerator(xset); @@ -3440,8 +3441,20 @@ function( hom, elm ) return hom!.linActInverse*elm; end ); +InstallMethod( PreImagesRepresentative,"IsLinearActionHomomorphism", + FamRangeEqFamElm, [ IsLinearActionHomomorphism, IsPerm ], 0, +function( hom, elm ) + if not ( elm in Range( hom ) ) then + Error( " is not in the range of mapping " ); + elif not ( elm in Image( hom ) ) then + return fail; + fi; + return PreImagesRepresentativeNC( hom, elm ); +end ); + ############################################################################# ## +#M PreImagesRepresentativeNC( , ) . . . . . . . . . build matrix #M PreImagesRepresentative( , ) . . . . . . . . . . build matrix ## ## The idea is as follows. @@ -3463,7 +3476,7 @@ end ); ## matrix group contains all scalar matrices, or we know that the preimage ## has determinant $1$ and taking the root in question is unique. ## -InstallMethod( PreImagesRepresentative,"IsProjectiveActionHomomorphism", +InstallMethod( PreImagesRepresentativeNC,"IsProjectiveActionHomomorphism", FamRangeEqFamElm, [ IsProjectiveActionHomomorphism, IsPerm ], 0, function( hom, elm ) local V, G, Grep, filt, R, mat, xset,lab,dim,sol,i; @@ -3479,7 +3492,7 @@ function( hom, elm ) TryNextMethod(); fi; - # PreImagesRepresentative does not test membership + # PreImagesRepresentativeNC does not test membership #if not elm in Image( hom ) then return fail; fi; xset:=UnderlyingExternalSet(hom); V := HomeEnumerator(xset); @@ -3515,6 +3528,17 @@ function( hom, elm ) return MakeImmutable( mat ); end); +InstallMethod( PreImagesRepresentative,"IsProjectiveActionHomomorphism", + FamRangeEqFamElm, [ IsProjectiveActionHomomorphism, IsPerm ], 0, +function( hom, elm ) + if not ( elm in Range( hom ) ) then + Error( " is not in the range of mapping " ); + elif not ( elm in Image( hom ) ) then + return fail; + fi; + return PreImagesRepresentativeNC( hom, elm ); +end); + ############################################################################# ## #A LinearActionBasis() diff --git a/lib/oprtglat.gi b/lib/oprtglat.gi index 789936468c..deba2ddf15 100644 --- a/lib/oprtglat.gi +++ b/lib/oprtglat.gi @@ -224,7 +224,7 @@ local acts,gps,clusters,conj,ncl,nacts,i,j,new,q,hom,lhom,c,n,r,len, Info(InfoLattice,5,"reduced (factor) by ",Size(q)/Size(n)); Add(nacts,PreImage(lhom,n)); for k in new.clusters[j] do - r:=PreImagesRepresentative(lhom,new.conjugators[k]); + r:=PreImagesRepresentativeNC(lhom,new.conjugators[k]); conj[c[k]]:=conj[c[k]]*r; gps[c[k]]:=gps[c[k]]^r; od; diff --git a/lib/oprtperm.gi b/lib/oprtperm.gi index b0f3c87872..c9cafbd956 100644 --- a/lib/oprtperm.gi +++ b/lib/oprtperm.gi @@ -987,7 +987,7 @@ InstallMethod( Earns, "G, ints, gens, perms, act", true, fi; gens := [ ]; for gen in GeneratorsOfGroup( Centre( P ) ) do - pre := PreImagesRepresentative( f, gen ); + pre := PreImagesRepresentativeNC( f, gen ); ord := Order( pre ); pa := 1; while ord mod p = 0 do ord := ord / p; diff --git a/lib/pcgsnice.gi b/lib/pcgsnice.gi index 0496a0c212..caa90d90ec 100644 --- a/lib/pcgsnice.gi +++ b/lib/pcgsnice.gi @@ -23,7 +23,7 @@ AttributeMethodByNiceMonomorphism( Pcgs, if npcgs = fail then return fail; fi; - pcgs := List( npcgs, gen -> PreImagesRepresentative( nice, gen ) ); + pcgs := List( npcgs, gen -> PreImagesRepresentativeNC( nice, gen ) ); pcgs := PcgsByPcSequenceNC( ElementsFamily( FamilyObj( G ) ), pcgs ); if HasIsPrimeOrdersPcgs( npcgs ) and IsPrimeOrdersPcgs( npcgs ) then SetIsPrimeOrdersPcgs( pcgs, true ); diff --git a/lib/permdeco.gi b/lib/permdeco.gi index 104191f1f9..9b6ae8d4b3 100644 --- a/lib/permdeco.gi +++ b/lib/permdeco.gi @@ -314,7 +314,7 @@ local tryrep,sel,selin,a,s,dom,iso,stabs,outs,map,i,j,p,found,seln, for i in GeneratorsOfGroup(G) do a:=One(d); for j in [1..Length(stabs)] do - a:=a*Image(Embedding(d,j),PreImagesRepresentative(outs[j],i)); + a:=a*Image(Embedding(d,j),PreImagesRepresentativeNC(outs[j],i)); od; Add(p,a); od; @@ -360,7 +360,7 @@ local G,H,tg,th,hom, tga, Gemb, C, outs, auts, ar, Hemb; i->GroupHomomorphismByImagesNC(tg,tg, GeneratorsOfGroup(tg), List(GeneratorsOfGroup(tg), - j->Image(hom,PreImagesRepresentative(hom,j)^i)))); + j->Image(hom,PreImagesRepresentativeNC(hom,j)^i)))); Gemb:=fail; if ForAll(tga,IsConjugatorAutomorphism) then @@ -442,7 +442,7 @@ local cs,i,k,u,o,norm,T,Thom,autos,ng,a,Qhom,Q,Ehom,genimages, autos:=List(ng,i->GroupHomomorphismByImagesNC(T,T, GeneratorsOfGroup(T), List(GeneratorsOfGroup(T), - j->Image(Thom,PreImagesRepresentative(Thom,j)^i)))); + j->Image(Thom,PreImagesRepresentativeNC(Thom,j)^i)))); a:=AutomorphismRepresentingGroup(T,autos); Thom:=GroupHomomorphismByImagesNC(norm,a[1],ng,a[3]); a:=a[1]; @@ -455,7 +455,7 @@ local cs,i,k,u,o,norm,T,Thom,autos,ng,a,Qhom,Q,Ehom,genimages, # define isomorphisms between the components reps:=List([1..n],i-> - PreImagesRepresentative(Qhom,RepresentativeAction(Q,1,i))); + PreImagesRepresentativeNC(Qhom,RepresentativeAction(Q,1,i))); genimages:=[]; for i in GeneratorsOfGroup(G) do @@ -539,7 +539,7 @@ local limit, r, pcgs, ser, ind, m, p, l, l2, good, i, j,nser,hom; ser:=InvariantElementaryAbelianSeries(p, List( GeneratorsOfGroup( G ), i -> GroupHomomorphismByImagesNC(p,p,GeneratorsOfGroup(p), List(GeneratorsOfGroup(p), - j->Image(m,PreImagesRepresentative(m,j)^i)))), + j->Image(m,PreImagesRepresentativeNC(m,j)^i)))), TrivialSubgroup(p),true); ser:=List(ser,i->PreImage(m,i)); else diff --git a/lib/relation.gi b/lib/relation.gi index e5208df4b7..5a41b6eec5 100644 --- a/lib/relation.gi +++ b/lib/relation.gi @@ -71,7 +71,7 @@ ## ## I. Operations and methods for binary relations on points ## 1. ImagesElm (compatibility with GeneralMapping) -## 2. PreImagesElm (compatibility with GeneralMapping) +## 2. PreImagesElmNC (compatibility with GeneralMapping) ## 3. \=, \in, \< ## 4. \* for relations, transformations, and permutation ## 5. Set operations \+, \- (union, difference) @@ -92,7 +92,7 @@ ## 4. MeetEquivalenceRelations ## 5. \= ## 6. ImagesElm (compatibility with GeneralMapping) -## 7. PreImagesElm (compatibility with GeneralMapping) +## 7. PreImagesElmNC (compatibility with GeneralMapping) ## 8. PrintObj ## ## L. Constructors of equivalence classes @@ -104,7 +104,7 @@ ## 2. PrintObj, Enumerator ## 3. \< ## 4. ImagesRepresentative -## 6. PreImagesRepresentative +## 6. PreImagesRepresentativeNC ## ############################################################################ ############################################################################ @@ -206,9 +206,9 @@ InstallGlobalFunction(BinaryRelationByElements, ## #P IsReflexiveBinaryRelation() ## -InstallMethod(IsReflexiveBinaryRelation, - "reflexive test binary relation", true, - [IsBinaryRelation], 0, +InstallMethod( IsReflexiveBinaryRelation, + "reflexive test binary relation", true, + [IsBinaryRelation], 0, function(m) local e; @@ -230,10 +230,10 @@ InstallMethod(IsReflexiveBinaryRelation, ## #P IsSymmetricBinaryRelation() ## -## Depends on Images and Preimages returning SSorted lists. +## Depends on Images and PreimagesNC returning SSorted lists. ## -InstallMethod(IsSymmetricBinaryRelation, +InstallMethod( IsSymmetricBinaryRelation, "symmetric test binary relation", true, [IsBinaryRelation], 0, function(m) local e,el; @@ -263,7 +263,7 @@ InstallMethod(IsSymmetricBinaryRelation, ## ## Assumes that Images returns a sorted list ## -InstallMethod(IsTransitiveBinaryRelation, +InstallMethod( IsTransitiveBinaryRelation, "transitive test binary relation", true, [IsBinaryRelation], 0, function(m) local e,el,i,im; @@ -294,7 +294,7 @@ InstallMethod(IsTransitiveBinaryRelation, ## #P IsAntisymmetricBinaryRelation() ## -InstallMethod(IsAntisymmetricBinaryRelation, +InstallMethod( IsAntisymmetricBinaryRelation, "test for Antisymmetry of a binary relation", true, [IsBinaryRelation], 0, function(rel) @@ -325,7 +325,7 @@ InstallMethod(IsAntisymmetricBinaryRelation, ## #P IsPreOrderBinaryRelation() ## -InstallMethod(IsPreOrderBinaryRelation, +InstallMethod( IsPreOrderBinaryRelation, "test for whether a binary relation is a preorder", true, [IsBinaryRelation], 0, function(rel) @@ -339,7 +339,7 @@ InstallMethod(IsPreOrderBinaryRelation, ## #P IsPartialOrderBinaryRelation() ## -InstallMethod(IsPartialOrderBinaryRelation, +InstallMethod( IsPartialOrderBinaryRelation, "test for whether a binary relation is a partial order", true, [IsBinaryRelation], 0, function(rel) @@ -354,7 +354,7 @@ InstallMethod(IsPartialOrderBinaryRelation, ## #P IsPartialOrderBinaryRelation() ## -InstallMethod(IsLatticeOrderBinaryRelation, +InstallMethod( IsLatticeOrderBinaryRelation, "test for whether a binary relation is a lattice order", true, [IsBinaryRelation],0, function(rel) @@ -394,7 +394,7 @@ end); ## #P IsEquivalenceRelation() ## -InstallMethod(IsEquivalenceRelation, +InstallMethod( IsEquivalenceRelation, "test for equivalence relation", true, [IsBinaryRelation], 0, function(rel) @@ -424,7 +424,7 @@ InstallMethod(IsEquivalenceRelation, ## is not finite. Can install more specific methods for relations over ## infinite domains where we can do better. ## -InstallMethod(ReflexiveClosureBinaryRelation, +InstallMethod( ReflexiveClosureBinaryRelation, "for binary relation", true, [IsBinaryRelation], 0, function(r) local ur,i,d, newrel; @@ -469,7 +469,7 @@ InstallMethod(ReflexiveClosureBinaryRelation, ## is not finite. Can install more specific methods for relations over ## infinite domains where we can do better. ## -InstallMethod(SymmetricClosureBinaryRelation, +InstallMethod( SymmetricClosureBinaryRelation, "for binary relation", true, [IsBinaryRelation], 0, function(r) local ur,i,t,d, newrel; @@ -513,7 +513,7 @@ InstallMethod(SymmetricClosureBinaryRelation, ## is not finite. Can install more specific methods for relations over ## infinite domains where we can do better. ## -InstallMethod(TransitiveClosureBinaryRelation, +InstallMethod( TransitiveClosureBinaryRelation, "for binary relation", true, [IsBinaryRelation], 0, function(r) @@ -583,7 +583,7 @@ InstallMethod(TransitiveClosureBinaryRelation, ## If is a partial order then return the smallest relation contained ## in whose reflexive and transitive closure is equal to ## -InstallMethod(HasseDiagramBinaryRelation, +InstallMethod( HasseDiagramBinaryRelation, "for binary relation", true, [IsBinaryRelation], 0, function(rel) @@ -607,11 +607,11 @@ InstallMethod(HasseDiagramBinaryRelation, HDBRMinElts := function(list, rel) ## x minimal if - ## {y in list | y<>x and y in PreImagesElm( rel,x)} is empty + ## {y in list | y<>x and y in PreImagesElmNC( rel,x)} is empty ## return Filtered(list, x->IsEmpty(Filtered(list, y-> (y <> x) and - (y in PreImagesElm(rel,x))))); + (y in PreImagesElmNC(rel,x))))); end; ## return the elements which cover x in rel @@ -690,7 +690,7 @@ InstallGlobalFunction(PartialOrderByOrderingFunction, ## ## returns an equivalence relation on the vertices of the relation. ## -InstallMethod(StronglyConnectedComponents, "for general binary relations", +InstallMethod( StronglyConnectedComponents, "for general binary relations", true, [IsBinaryRelation],0, function(rel) local r, # representation of rel as a binary relation on points @@ -854,43 +854,43 @@ InstallGlobalFunction(RandomBinaryRelationOnPoints, #P IsEquivalenceRelation() ## ## -InstallMethod(IsReflexiveBinaryRelation, "for binary relations on points", +InstallMethod( IsReflexiveBinaryRelation, "for binary relations on points", true, [IsBinaryRelation and IsBinaryRelationOnPointsRep],0, rel -> ForAll([1..DegreeOfBinaryRelation(rel)], i->i in Successors(rel)[i]) ); -InstallMethod(IsSymmetricBinaryRelation, "for binary relations on points", +InstallMethod( IsSymmetricBinaryRelation, "for binary relations on points", true, [IsBinaryRelation and IsBinaryRelationOnPointsRep],0, rel -> ForAll([1..DegreeOfBinaryRelation(rel)], i-> ForAll(Successors(rel)[i], j-> i in Successors(rel)[j] )) ); -InstallMethod(IsTransitiveBinaryRelation, "for binary relations on points", +InstallMethod( IsTransitiveBinaryRelation, "for binary relations on points", true, [IsBinaryRelation and IsBinaryRelationOnPointsRep],0, rel -> ForAll([1..DegreeOfBinaryRelation(rel)], i-> ForAll(Successors(rel)[i], j-> IsSubset(Successors(rel)[i],Successors(rel)[j]))) ); -InstallMethod(IsAntisymmetricBinaryRelation, "for binary relations on points", +InstallMethod( IsAntisymmetricBinaryRelation, "for binary relations on points", true, [IsBinaryRelation and IsBinaryRelationOnPointsRep],0, rel -> ForAll([1..DegreeOfBinaryRelation(rel)], i-> ForAll(Successors(rel)[i], j-> j=i or (not j=i and not i in Successors(rel)[j]))) ); -InstallMethod(IsPreOrderBinaryRelation, "for binary relations on points", +InstallMethod( IsPreOrderBinaryRelation, "for binary relations on points", true, [IsBinaryRelation and IsBinaryRelationOnPointsRep],0, rel -> IsReflexiveBinaryRelation(rel) and IsTransitiveBinaryRelation(rel) ); -InstallMethod(IsPartialOrderBinaryRelation, "for binary relations on points", +InstallMethod( IsPartialOrderBinaryRelation, "for binary relations on points", true, [IsBinaryRelation and IsBinaryRelationOnPointsRep],0, rel -> IsPreOrderBinaryRelation(rel) and IsAntisymmetricBinaryRelation(rel) ); -InstallMethod(IsEquivalenceRelation, "for binary relations on points", +InstallMethod( IsEquivalenceRelation, "for binary relations on points", true, [IsBinaryRelation and IsBinaryRelationOnPointsRep],0, rel -> IsReflexiveBinaryRelation(rel) and IsSymmetricBinaryRelation(rel) and IsTransitiveBinaryRelation(rel) @@ -909,14 +909,14 @@ InstallMethod(IsEquivalenceRelation, "for binary relations on points", #O TransitiveClosureBinaryRelation() ## ## -InstallMethod(ReflexiveClosureBinaryRelation, "for binary relations on points", +InstallMethod( ReflexiveClosureBinaryRelation, "for binary relations on points", true, [IsBinaryRelation and IsBinaryRelationOnPointsRep],0, rel -> BinaryRelationOnPointsNC( List([1..DegreeOfBinaryRelation(rel)], i-> Union2(Successors(rel)[i],[i]))) ); -InstallMethod(SymmetricClosureBinaryRelation, "for binary relations on points", +InstallMethod( SymmetricClosureBinaryRelation, "for binary relations on points", true, [IsBinaryRelation and IsBinaryRelationOnPointsRep],0, function(rel) local suc, #successors of given relation @@ -938,7 +938,7 @@ InstallMethod(SymmetricClosureBinaryRelation, "for binary relations on points", return newrel; end); -InstallMethod(TransitiveClosureBinaryRelation, "for binary relations on points", +InstallMethod( TransitiveClosureBinaryRelation, "for binary relations on pts", true, [IsBinaryRelation and IsBinaryRelationOnPointsRep],0, function(rel) local i,j, #index variables @@ -971,7 +971,7 @@ InstallMethod(TransitiveClosureBinaryRelation, "for binary relations on points", ## ## For binary relations over [1..n] represented as a list of images ## -InstallMethod(ImagesElm, +InstallMethod( ImagesElm, "for binary relations over [1..n] with images list", true, [IsBinaryRelation and IsBinaryRelationOnPointsRep, IsPosInt], 0, function( rel, n ) @@ -983,11 +983,12 @@ InstallMethod(ImagesElm, ############################################################################# ## +#M PreImagesElmNC( , ) #M PreImagesElm( , ) ## ## For binary relations over [1..n] represented as a list of images ## -InstallMethod(PreImagesElm, +InstallMethod( PreImagesElmNC, "for binary rels over [1..n] with images list", true, [IsBinaryRelation and IsBinaryRelationOnPointsRep, IsPosInt], 0, function( rel, n ) @@ -995,6 +996,18 @@ InstallMethod(PreImagesElm, i->n in Successors(rel)[i]); end); +InstallMethod( PreImagesElm, + "for binary rels over [1..n] with images list", + true, [IsBinaryRelation and IsBinaryRelationOnPointsRep, IsPosInt], 0, + function( rel, n ) + if not ( n in Range(rel) ) then + Error( " is not in the range of " ); + elif not ( n in Image(rel) ) then + return fail; + fi; + return PreImagesElmNC( rel, n ); + end ); + ############################################################################# ## #A Successors( ) @@ -1002,7 +1015,7 @@ InstallMethod(PreImagesElm, ## Returns the list of images of a binary relation. If the underlying ## domain of the relation is not [1..n] then an error is signalled. ## -InstallMethod(Successors, "for a generic relation", true, +InstallMethod( Successors, "for a generic relation", true, [IsBinaryRelation], 0, function(r) local eldom; # Elements of the domain @@ -1256,7 +1269,7 @@ InstallMethod( One, "for binary relation on points and a set of integers",true, ## ## Display binary relation on n points. ## -InstallMethod(PrintObj, "for a binary relation on n points", true, +InstallMethod( PrintObj, "for a binary relation on n points", true, [IsBinaryRelation and IsBinaryRelationOnPointsRep],0, function(rel) Print("Binary Relation on ",DegreeOfBinaryRelation(rel)," points"); @@ -1652,7 +1665,7 @@ InstallMethod( MeetEquivalenceRelations, #A GeneratorsOfEquivalenceRelationPartition( ) ## ## -InstallMethod(GeneratorsOfEquivalenceRelationPartition, +InstallMethod( GeneratorsOfEquivalenceRelationPartition, "generators for an equivalence with a partition", true, [IsEquivalenceRelation], 0, function(equiv) @@ -1673,7 +1686,7 @@ InstallMethod(GeneratorsOfEquivalenceRelationPartition, ## #M \= for equivalence relations ## -InstallMethod(\=, "for eqivalence relations", IsIdenticalObj, +InstallMethod( \=, "for eqivalence relations", IsIdenticalObj, [IsEquivalenceRelation, IsEquivalenceRelation], 0, function(x, y) @@ -1740,7 +1753,7 @@ InstallMethod(\=, "for eqivalence relations", IsIdenticalObj, ## It has been given a +1 rank which WILL NEED TUNING when the ## other methods are in. ## -InstallMethod(\in, "for eq relation with partition", true, +InstallMethod( \in, "for eq relation with partition", true, [IsList, IsEquivalenceRelation and HasEquivalenceRelationPartition], 1, function(tup, rel) local f; # first block that contains first tuple component @@ -1781,11 +1794,23 @@ InstallMethod( ImagesRepresentative, "equivalence relations", ############################################################################# ## -#M PreImagesRepresentative( , ) . . . for equivalence relations +#M PreImagesRepresentativeNC( , ) . . . for equivalence relations +#M PreImagesRepresentative( , ) . . . . for equivalence relations ## +InstallMethod( PreImagesRepresentativeNC, "equivalence relations", + FamRangeEqFamElm, [IsEquivalenceRelation, IsObject], 0, + function( map, elm ) + return elm; + end); + InstallMethod( PreImagesRepresentative, "equivalence relations", FamRangeEqFamElm, [IsEquivalenceRelation, IsObject], 0, function( map, elm ) + if not ( elm in Range(map) ) then + Error( " is not in the range of " ); + elif not ( elm in Image(map) ) then + return fail; + fi; return elm; end); @@ -1813,9 +1838,10 @@ InstallMethod( ImagesElm, ############################################################################# ## -#M PreImagesElm( , ) for equivalence relations with partition +#M PreImagesElmNC( , ) . for equivalence relations with partition +#M PreImagesElm( , ) . . for equivalence relations with partition ## -InstallMethod( PreImagesElm, +InstallMethod( PreImagesElmNC, "equivalence relations with partition and element", FamRangeEqFamElm, [IsEquivalenceRelation and HasEquivalenceRelationPartition, @@ -1826,6 +1852,20 @@ InstallMethod( PreImagesElm, return ImagesElm(rel, elm); end); +InstallMethod( PreImagesElm, + "equivalence relations with partition and element", + FamRangeEqFamElm, + [IsEquivalenceRelation and HasEquivalenceRelationPartition, + IsObject],0, + function( rel, elm ) + if not ( elm in Range( rel ) ) then ## ?? is there a Range(rel)? + Error( " not in the range of " ); + elif not ( elm in Image( rel ) ) then ## ?? is there an Image(rel)? + return fail; + fi; + return PreImagesElmNC( rel, elm ); + end); + ############################################################################# ## #M PrintObj( ) for equivalence relation @@ -1842,7 +1882,7 @@ InstallMethod( PrintObj, "for an equivalence relation", true, ## ## Wraparound function which calls the two-argument method ## -InstallMethod(EquivalenceClasses, "wraparound to call 2-argument version", +InstallMethod( EquivalenceClasses, "wraparound to call 2-argument version", true, [IsEquivalenceRelation], 0, e->EquivalenceClasses(e, UnderlyingDomainOfBinaryRelation(e)) ); @@ -1855,7 +1895,7 @@ InstallMethod(EquivalenceClasses, "wraparound to call 2-argument version", ## This generic method will not terminate for an equivalence over an ## infinite set. ## -InstallOtherMethod(EquivalenceClasses, "for a generic equivalence relation", +InstallOtherMethod( EquivalenceClasses, "for a generic equivalence relation", true, [IsEquivalenceRelation, IsCollection], 0, function(E, D) @@ -1922,7 +1962,7 @@ InstallOtherMethod(EquivalenceClasses, "for a generic equivalence relation", ## membership tests (for example when checking membership of a ## transformation in a monoid, we use Greens relations and classes). ## -InstallMethod(EquivalenceClassOfElementNC, "no check", true, +InstallMethod( EquivalenceClassOfElementNC, "no check", true, [IsEquivalenceRelation, IsObject], 0, function(rel, rep) @@ -1937,7 +1977,7 @@ InstallMethod(EquivalenceClassOfElementNC, "no check", true, return new; end); -InstallMethod(EquivalenceClassOfElement, "with checking", true, +InstallMethod( EquivalenceClassOfElement, "with checking", true, [IsEquivalenceRelation, IsObject], 0, function(rel, rep) @@ -1954,7 +1994,7 @@ InstallMethod(EquivalenceClassOfElement, "with checking", true, ## ## Display an equivalence class. ## -InstallMethod(PrintObj, "for an eq. class", true, +InstallMethod( PrintObj, "for an eq. class", true, [IsEquivalenceClass],0, function(c) Print("{", Representative(c),"}"); @@ -1967,7 +2007,7 @@ InstallMethod(PrintObj, "for an eq. class", true, ## Checks whether is contained in the equivalence class ## If is infinite, this will not necessarily terminate. ## -InstallMethod(\in, "for element and equivalence class", true, +InstallMethod( \in, "for element and equivalence class", true, [IsObject, IsEquivalenceClass], 0, function(x, C) local iter; # iterator of the equivalence class @@ -2027,7 +2067,7 @@ InstallMethod( Enumerator, "for equivalence classes", true, ## ## Equality of equivalence classes ## -InstallMethod(\=, "for two equivalence classes", +InstallMethod( \=, "for two equivalence classes", IsIdenticalObj, [IsEquivalenceClass, IsEquivalenceClass], 0, function(x, y) return Representative(x) in y; @@ -2049,7 +2089,7 @@ InstallMethod( \<, "for two equivalence classes", IsIdenticalObj, return RepresentativeSmallest(x1) < RepresentativeSmallest(x2); end ); -InstallMethod(AsPermutation, "for binary relations on points", true, +InstallMethod( AsPermutation, "for binary relations on points", true, [IsBinaryRelation and IsBinaryRelationOnPointsRep], 0, function(rel) if not IsMapping(rel) then diff --git a/lib/ringhom.gi b/lib/ringhom.gi index a665b14b35..98e25249d1 100644 --- a/lib/ringhom.gi +++ b/lib/ringhom.gi @@ -439,9 +439,10 @@ end ); ############################################################################# ## -#M PreImagesRepresentative( , ) . . . . . . for ring g.m.b.i. +#M PreImagesRepresentativeNC( , ) . . . . . . for ring g.m.b.i. +#M PreImagesRepresentative( , ) . . . . . . . for ring g.m.b.i. ## -InstallMethod( PreImagesRepresentative, +InstallMethod( PreImagesRepresentativeNC, "for ring g.m.b.i., and element", FamRangeEqFamElm, [ IsRingGeneralMapping and IsRingGeneralMappingByImagesDefaultRep, @@ -450,6 +451,20 @@ function( map, elm ) return ImagesRepresentative(InverseGeneralMapping(map),elm); end ); +InstallMethod( PreImagesRepresentative, + "for ring g.m.b.i., and element", + FamRangeEqFamElm, + [ IsRingGeneralMapping and IsRingGeneralMappingByImagesDefaultRep, + IsObject ], +function( map, elm ) + if not ( elm in Range( map ) ) then + Error( " is not in the range of " ); + elif not ( elm in Image( map ) ) then + return fail; + fi; + return PreImagesRepresentativeNC( map, elm ); +end ); + BindGlobal("IsomorphismSCRing",function(R) local e, z, one, o, sel, g, go, elms, dec, p, cands, m, a, b, nr, hom, i, j; if Size(R)>100000 then diff --git a/lib/schur.gi b/lib/schur.gi index 265419f3ae..9f8d4f651f 100644 --- a/lib/schur.gi +++ b/lib/schur.gi @@ -129,7 +129,7 @@ BindGlobal("EpimorphismSchurCoverFP", j->One(F))))); hom:=GroupHomomorphismByImagesNC(D,G,GeneratorsOfGroup(D), - List(Dgens,i->PreImagesRepresentative(iso,i))); + List(Dgens,i->PreImagesRepresentativeNC(iso,i))); Dgens:=TzImagesOldGens(p); Dgens:=List(Dgens{[Length(Fgens)+1..Length(Dgens)]}, i->MappedWord(i,p!.generators,GeneratorsOfGroup(D))); @@ -190,7 +190,7 @@ local iso,F; iso:=IsomorphismFpGroupByPcgs(Pcgs(Q),"f"); F:=Image(iso); return rec( - gens:=List(GeneratorsOfGroup(F),i->PreImagesRepresentative(iso,i)), + gens:=List(GeneratorsOfGroup(F),i->PreImagesRepresentativeNC(iso,i)), free:=FreeGeneratorsOfFpGroup(F), rels:=RelatorsOfFpGroup(F), null:=NullspaceIntMat(List(RelatorsOfFpGroup(F), @@ -202,7 +202,7 @@ end); # Q; is a function mapping Q into P by conjugation. BindGlobal("SCHUR_CorestrictionValues",function(epi,data,act) local lift,val,res,a,i,x; - lift:=List(data.gens,i->PreImagesRepresentative(epi,act(i))); + lift:=List(data.gens,i->PreImagesRepresentativeNC(epi,act(i))); val:=List(data.rels,r->MappedWord(r,data.free,lift)); res:=[]; for a in data.null do @@ -253,7 +253,7 @@ local s,iso,S,pcgs,n,cov,pco,i,d,q,data,base,img, base:=SCHUR_CorestrictionValues(epi,data,x->x); for i in GeneratorsOfGroup(n) do img:=SCHUR_CorestrictionValues(epi,data, - x->ImagesRepresentative(iso,PreImagesRepresentative(iso,x)^i)); + x->ImagesRepresentative(iso,PreImagesRepresentativeNC(iso,x)^i)); rels:=ClosureGroup(rels,List([1..Length(base)],j->base[j]/img[j])); od; Info(InfoSchur,2,"normalizer fusion leaves ",Index(mul,rels)); @@ -274,7 +274,7 @@ local s,iso,S,pcgs,n,cov,pco,i,d,q,data,base,img, data:=SCHUR_FusionSetup(Image(iso,q)); base:=SCHUR_CorestrictionValues(epi,data,x->x); img:=SCHUR_CorestrictionValues(epi,data, - x->ImagesRepresentative(iso,PreImagesRepresentative(iso,x)^d)); + x->ImagesRepresentative(iso,PreImagesRepresentativeNC(iso,x)^d)); rels:=ClosureGroup(rels,List([1..Length(base)],j->base[j]/img[j])); fi; fi; @@ -285,13 +285,13 @@ local s,iso,S,pcgs,n,cov,pco,i,d,q,data,base,img, # form the quotient, make it the new cover and the new multiplicator; the # result must map onto the Sylow subgroup of g, not onto its pc copy hom:=NaturalHomomorphismByNormalSubgroupNC(cov,rels); - pco:=List(pcgs,i->Image(hom,PreImagesRepresentative(epi,i))); + pco:=List(pcgs,i->Image(hom,PreImagesRepresentativeNC(epi,i))); mul:=Image(hom,mul); cov:=Image(hom,cov); Append(pco,Pcgs(mul)); pco:=PcgsByPcSequenceNC(FamilyObj(One(cov)),pco); epi:=GroupHomomorphismByImagesNC(cov,s,pco, - Concatenation(List(pcgs,i->PreImagesRepresentative(iso,i)), + Concatenation(List(pcgs,i->PreImagesRepresentativeNC(iso,i)), List(Pcgs(mul),i->One(s)))); SetKernelOfMultiplicativeGeneralMapping(epi,mul); return epi; @@ -342,7 +342,7 @@ BindGlobal("PositiveExponentsPresentationFpHom",function(hom) local G,F,geni,ro,fam,r,i,j,rel,n,e; G:=Image(hom); F:=FreeGeneratorsOfFpGroup(G); - geni:=List(GeneratorsOfGroup(G),i->PreImagesRepresentative(hom,i)); + geni:=List(GeneratorsOfGroup(G),i->PreImagesRepresentativeNC(hom,i)); ro:=List(geni,Order); fam:=FamilyObj(F[1]); r:=[]; @@ -390,7 +390,7 @@ local G,H,D,T,i,j,l,a,h,jj,nk,evals,rels,gens,r,np,g,invlist,el,elp,TL,rp,pos, # this will guarantee we always take the same preimages el:=AsSSortedListNonstored(H); - elp:=List(el,i->PreImagesRepresentative(s,i)); + elp:=List(el,i->PreImagesRepresentativeNC(s,i)); #ensure the preimage of identity is one if IsOne(el[1]) then pos:=1; @@ -462,8 +462,8 @@ local G,H,D,T,i,j,l,a,h,jj,nk,evals,rels,gens,r,np,g,invlist,el,elp,TL,rp,pos, fi; od; - #Print(PreImagesRepresentative(s,Image(s,h))*h,"\n"); - #a:=a/PreImagesRepresentative(s,Image(s,h))*h; + #Print(PreImagesRepresentativeNC(s,Image(s,h))*h,"\n"); + #a:=a/PreImagesRepresentativeNC(s,Image(s,h))*h; a:=a/h*elp[Position(el,Image(s,h))]; od; @@ -541,7 +541,7 @@ local G,B,P,s,D,i,j,v,ri,rank,bas,basr,row,rel,sol,snf,mat; j:=NaturalHomomorphismByNormalSubgroupNC(D,v); i:=GeneratorsOfGroup(Image(j)); i:=GroupHomomorphismByImagesNC(Image(j),P,i, - List(i,k->ImageElm(s,PreImagesRepresentative(j,k)))); + List(i,k->ImageElm(s,PreImagesRepresentativeNC(j,k)))); SetKernelOfMultiplicativeGeneralMapping(i, Image(j,KernelOfMultiplicativeGeneralMapping(s))); return i; @@ -618,7 +618,7 @@ local hom, #isomorphism fp s:=sl[pp]; mg:=IsomorphismPermGroup(KernelOfMultiplicativeGeneralMapping(s)); mg:=List(IndependentGeneratorsOfAbelianGroup(Image(mg)), - i->PreImagesRepresentative(mg,i)); + i->PreImagesRepresentativeNC(mg,i)); sdc:=ListWithIdenticalEntries(Last(ngl),One(Source(s))); sdc{[ngl[pp]+1..ngl[pp+1]]}:=mg; @@ -639,7 +639,7 @@ local hom, #isomorphism fp q:=[]; for i in ce do - Add(q,PreImagesRepresentative(sdc,i[2])); + Add(q,PreImagesRepresentativeNC(sdc,i[2])); od; rel2[pp]:=q; od; @@ -717,7 +717,7 @@ local G,pl,iso,hom,D,gens,ker; ker:=KernelOfMultiplicativeGeneralMapping(hom); hom:=GroupHomomorphismByImagesNC(D,G,gens, List(gens, - i->PreImagesRepresentative(iso,ImagesRepresentative(hom,i)))); + i->PreImagesRepresentativeNC(iso,ImagesRepresentative(hom,i)))); SetKernelOfMultiplicativeGeneralMapping(hom,ker); SetIsSurjective(hom,true); return hom; diff --git a/lib/semirel.gi b/lib/semirel.gi index dd0fad38fa..f3bb8188cc 100644 --- a/lib/semirel.gi +++ b/lib/semirel.gi @@ -1299,7 +1299,7 @@ end); ######## ######## -InstallMethod(PreImagesRepresentative, "for semigroup homomorphism by images", +InstallMethod(PreImagesRepresentativeNC, "for semigroup homomorphism by images", FamRangeEqFamElm, [IsSemigroupHomomorphism and IsSemigroupHomomorphismByImagesRep, IsMultiplicativeElement], function(hom, x) diff --git a/lib/stbcbckt.gi b/lib/stbcbckt.gi index f0b4eb0046..1d9ccd727f 100644 --- a/lib/stbcbckt.gi +++ b/lib/stbcbckt.gi @@ -2602,7 +2602,7 @@ dom, et, ft, Pr, rbase, BF, Q, data,lc; found:=PartitionBacktrack( G, Pr, true, rbase, data, L, R ); if IsPerm(found) and map<>false then - found:=PreImagesRepresentative(map,found); + found:=PreImagesRepresentativeNC(map,found); fi; return found; end ); diff --git a/lib/twocohom.gi b/lib/twocohom.gi index d504e29dc3..99f89dd6c2 100644 --- a/lib/twocohom.gi +++ b/lib/twocohom.gi @@ -813,7 +813,7 @@ local field,fp,fpg,gens,hom,mats,fm,mon,tzrules,dim,rules,eqs,i,j,k,l,o,l1, od; gens:=List(GeneratorsOfGroup(FamilyObj(fpg)!.wholeGroup), - x->PreImagesRepresentative(fp,x)); + x->PreImagesRepresentativeNC(fp,x)); hom:=GroupHomomorphismByImagesNC(G,Group(mo.generators), GeneratorsOfGroup(G),mo.generators); @@ -845,7 +845,7 @@ local field,fp,fpg,gens,hom,mats,fm,mon,tzrules,dim,rules,eqs,i,j,k,l,o,l1, else # Length of r[1] is 1. That is, this generator is not used! m:=First(RelationsOfFpMonoid(mon),x->List(x,LetterRepAssocWord)=r); - m:=List(m,x->PreImagesRepresentative(fm,ElementOfFpMonoid(FamilyObj(One(mon)),x))); + m:=List(m,x->PreImagesRepresentativeNC(fm,ElementOfFpMonoid(FamilyObj(One(mon)),x))); m:=List(m,UnderlyingElement); # free group elements/words if not IsOne(m[1]*Subword(m[2],1,1)) then @@ -866,7 +866,7 @@ local field,fp,fpg,gens,hom,mats,fm,mon,tzrules,dim,rules,eqs,i,j,k,l,o,l1, model:=ValueOption("model"); if model<>fail then q:=GQuotients(model,G)[1]; - pre:=List(gens,x->PreImagesRepresentative(q,x)); + pre:=List(gens,x->PreImagesRepresentativeNC(q,x)); ker:=KernelOfMultiplicativeGeneralMapping(q); pcgs:=Pcgs(ker); l1:=GModuleByMats(LinearActionLayer(Group(pre),pcgs),mo.field); @@ -880,7 +880,7 @@ local field,fp,fpg,gens,hom,mats,fm,mon,tzrules,dim,rules,eqs,i,j,k,l,o,l1, m:=GroupGeneralMappingByImagesNC(fpg,model,GeneratorsOfGroup(fpg),pre); mats:=List(GeneratorsOfMonoid(mon), x->ImagesRepresentative(m, - PreImagesRepresentative(fm,x))); #Elements for monoid generators + PreImagesRepresentativeNC(fm,x))); #Elements for monoid generators nonone:=[1..Length(mats)]; pre:=mats; onemat:=One(G); @@ -896,8 +896,8 @@ local field,fp,fpg,gens,hom,mats,fm,mon,tzrules,dim,rules,eqs,i,j,k,l,o,l1, zerovec:=Zero(onemat[1]); mats:=List(GeneratorsOfMonoid(mon), - x->ImagesRepresentative(hom,PreImagesRepresentative(fp, - PreImagesRepresentative(fm,x)))); # matrices for monoid generators + x->ImagesRepresentative(hom,PreImagesRepresentativeNC(fp, + PreImagesRepresentativeNC(fm,x)))); # matrices for monoid generators one:=One(mats[1]); nonone:=Filtered([1..Length(mats)],x->not IsOne(mats[x])); zero:=zerovec; @@ -1047,7 +1047,7 @@ local field,fp,fpg,gens,hom,mats,fm,mon,tzrules,dim,rules,eqs,i,j,k,l,o,l1, one:=One(FreeGroupOfFpGroup(fpg)); k:=List(GeneratorsOfMonoid(mon), - x->UnderlyingElement(PreImagesRepresentative(fm,x))); + x->UnderlyingElement(PreImagesRepresentativeNC(fm,x))); # matrix corresponding to monoid word mapped2:=function(list) local a,i; @@ -1125,8 +1125,8 @@ local field,fp,fpg,gens,hom,mats,fm,mon,tzrules,dim,rules,eqs,i,j,k,l,o,l1, local a; if not IsBound(imagemonwords[nr]) then # apply automorphism - a:=PreImagesRepresentative(fm,GeneratorsOfMonoid(mon)[nr]); - a:=PreImagesRepresentative(fp,a); + a:=PreImagesRepresentativeNC(fm,GeneratorsOfMonoid(mon)[nr]); + a:=PreImagesRepresentativeNC(fp,a); a:=ImagesRepresentative(autom,a); a:=ImagesRepresentative(fp,a); a:=ImagesRepresentative(fm,a); diff --git a/lib/vspchom.gi b/lib/vspchom.gi index 4b6aee7a75..04b231a314 100644 --- a/lib/vspchom.gi +++ b/lib/vspchom.gi @@ -486,8 +486,9 @@ InstallMethod( ImagesRepresentative, ############################################################################# ## #M PreImagesRepresentative( , ) . . . . for left module g.m.b.i. +#M PreImagesRepresentativeNC( , ) . . . for left module g.m.b.i. ## -InstallMethod( PreImagesRepresentative, +InstallMethod( PreImagesRepresentativeNC, "for left module g.m.b.i., and element", FamRangeEqFamElm, [ IsGeneralMapping and IsLinearGeneralMappingByImagesDefaultRep, @@ -503,6 +504,19 @@ InstallMethod( PreImagesRepresentative, return LinearCombination( map!.preimagesbasisimage, elm ); end ); +InstallMethod( PreImagesRepresentative, + "for left module g.m.b.i., and element", + FamRangeEqFamElm, + [ IsGeneralMapping and IsLinearGeneralMappingByImagesDefaultRep, + IsObject ], + function( map, elm ) + if not ( elm in Range( map ) ) then + Error( " is not in the range of " ); + elif not ( elm in Image( map ) ) then + return fail; + fi; + return PreImagesRepresentativeNC( map, elm ); + end ); ############################################################################# ## @@ -1221,9 +1235,9 @@ InstallMethod( ImagesRepresentative, ############################################################################# ## -#M PreImagesRepresentative( , ) . . . . . for left module m.b.m. +#M PreImagesRepresentativeNC( , ) . . . . for left module m.b.m. ## -InstallMethod( PreImagesRepresentative, +InstallMethod( PreImagesRepresentativeNC, "for left module m.b.m., and element", FamRangeEqFamElm, [ IsGeneralMapping and IsLinearMappingByMatrixDefaultRep, @@ -1239,6 +1253,20 @@ InstallMethod( PreImagesRepresentative, return LinearCombination( map!.preimagesbasisimage, elm ); end ); +InstallMethod( PreImagesRepresentative, + "for left module m.b.m., and element", + FamRangeEqFamElm, + [ IsGeneralMapping and IsLinearMappingByMatrixDefaultRep, + IsObject ], + function( map, elm ) + if not ( elm in Range( map ) ) then + Error( " is not in the range of " ); + elif not ( elm in Image( map ) ) then + return fail; + fi; + return PreImagesRepresentativeNC( map, elm ); + end ); + ############################################################################# ## diff --git a/tst/testbugfix/2012-11-25-t00264.tst b/tst/testbugfix/2012-11-25-t00264.tst index 29e0fb14ee..3d570f79c5 100644 --- a/tst/testbugfix/2012-11-25-t00264.tst +++ b/tst/testbugfix/2012-11-25-t00264.tst @@ -1,9 +1,11 @@ # 2012/11/25 (AK) # Fix of a bug that was reproducible in GAP 4.5.6 with FGA 1.1.1 +# (20/05/26): gap> Image(iso,PreImagesRepresentative(iso,f.1)); +# cannot be made to work because the code for the NC version is in a package gap> f := FreeGroup(2); gap> iso:=GroupHomomorphismByImagesNC(f,f,[f.1*f.2,f.1*f.2^2],[f.2^2*f.1,f.2*f.1]); [ f1*f2, f1*f2^2 ] -> [ f2^2*f1, f2*f1 ] gap> SetIsSurjective(iso,true); -gap> Image(iso,PreImagesRepresentative(iso,f.1)); +gap> Image(iso,PreImagesRepresentativeNC(iso,f.1)); f1 diff --git a/tst/testinstall/mapphomo.tst b/tst/testinstall/mapphomo.tst index d6468f7834..8096d2e025 100644 --- a/tst/testinstall/mapphomo.tst +++ b/tst/testinstall/mapphomo.tst @@ -91,5 +91,32 @@ gap> for G in [ SymmetricGroup(5), DihedralGroup(8), GL(2,3) ] do > PreImagesRepresentative( hom, G.1 ); > od; +# Check PreImages... now that NC versions have been added +gap> gens := [ (1,2,3,4), (1,2,3) ];; +gap> G := Group( gens );; +gap> H := Group( [ (4,5,6,7,8,9), (5,9)(6,8) ] );; +gap> imgs := [ (5,9)(6,8), (4,6,8)(5,7,9) ];; +gap> hom := GroupHomomorphismByImages( G, H, gens, imgs );; +gap> PreImagesSet( hom, [ (4,6)(7,9) ] ); +[ (2,3), (1,2,4,3), (1,3,4,2), (1,4) ] +gap> PreImagesSet( hom, [ (4,5,6,7,8,9) ] ); +[ ] +gap> PreImagesSet( hom, [ (4,6)(7,9), (4,5,6,7,8,9) ] ); +[ (2,3), (1,2,4,3), (1,3,4,2), (1,4) ] +gap> PreImagesSet( hom, [ (7,8,9) ] ); +Error, is not a subset of the range of +gap> PreImagesElm( hom, (4,6)(7,9) ); +RightCoset(Group([ (1,4)(2,3), (1,2)(3,4) ]),(1,2,4,3)) +gap> PreImagesRepresentative( hom, (4,6)(7,9) ); +(1,2,4,3) +gap> PreImagesElm( hom, (4,5,6,7,8,9) ); +fail +gap> PreImagesRepresentative( hom, (4,5,6,7,8,9) ); +fail +gap> PreImagesElm( hom, (7,8,9) ); +Error, is not in the range of +gap> PreImagesRepresentative( hom, (7,8,9) ); +Error, is not in the range of mapping + # gap> STOP_TEST( "mapphomo.tst" ); diff --git a/tst/testinstall/preimages.tst b/tst/testinstall/preimages.tst new file mode 100644 index 0000000000..36a84b28dd --- /dev/null +++ b/tst/testinstall/preimages.tst @@ -0,0 +1,209 @@ +#@local f,tuples,map,comp,id,inv,g,z,mf,d,hom,D,emb,prj,F,fp,fhom,aut,frob +#@local V,W,vf,C2,C6,pchom,rel +gap> START_TEST("preimages.tst"); + +# perm group homomorphism by images: injective, not surjective +gap> f := GroupHomomorphismByImages(Group((1,2)), SymmetricGroup(3), +> [(1,2)], [(1,2)]);; +gap> PreImagesRepresentative(f, (1,2)); +(1,2) +gap> PreImagesRepresentative(f, (1,2,3)); +fail +gap> PreImagesRepresentative(f, (1,4)); +Error, is not in the range of mapping +gap> PreImagesElm(f, (1,2)); +RightCoset(Group(()),(1,2)) +gap> PreImagesElm(f, (1,2,3)); +fail +gap> PreImagesElm(f, (1,4)); +Error, is not in the range of +gap> PreImagesSet(f, Group((1,2))); +Group([ (1,2) ]) +gap> PreImagesSet(f, Group((1,2,3))); +Group(()) +gap> PreImagesSet(f, Group((1,4))); +Error, is not a subgroup of the range of + +# constant time access general mapping +gap> tuples := [DirectProductElement([(),()]), +> DirectProductElement([(1,2),(1,2)])];; +gap> map := GeneralMappingByElements(Group((1,2)), SymmetricGroup(3), tuples);; +gap> PreImagesRepresentative(map, (1,2)); +(1,2) +gap> PreImagesRepresentative(map, (1,2,3)); +fail +gap> PreImagesRepresentative(map, (1,4)); +Error, is not in the range of +gap> PreImagesElm(map, (1,2)); +[ (1,2) ] +gap> PreImagesElm(map, (1,2,3)); +fail +gap> PreImagesElm(map, (1,4)); +Error, is not in the range of +gap> PreImagesSet(map, [(), (1,2,3)]); +[ () ] +gap> PreImagesSet(map, [(1,4)]); +Error, is not a subset of the range of + +# composition mapping +gap> comp := CompositionMapping(GroupHomomorphismByImages(SymmetricGroup(3), +> SymmetricGroup(4), [(1,2),(1,2,3)], [(1,2),(1,2,3)]), map);; +gap> IsCompositionMappingRep(comp); +true +gap> PreImagesRepresentative(comp, (1,2)); +(1,2) +gap> PreImagesRepresentative(comp, (1,2,3)); +fail +gap> PreImagesRepresentative(comp, (1,5)); +Error, is not in the range of mapping +gap> PreImagesElm(comp, (1,2)); +[ (1,2) ] +gap> PreImagesElm(comp, (1,2,3)); +fail +gap> PreImagesElm(comp, (1,5)); +Error, is not in the range of mapping +gap> PreImagesSet(comp, [(), (1,2,3)]); +[ () ] +gap> PreImagesSet(comp, [(1,5)]); +Error, is not a subset of the range of mapping + +# identity mapping +gap> id := IdentityMapping(SymmetricGroup(3));; +gap> PreImagesRepresentative(id, (1,2)); +(1,2) +gap> PreImagesRepresentative(id, (1,4)); +Error, is not in the range of mapping +gap> PreImagesElm(id, (1,2)); +[ (1,2) ] +gap> PreImagesElm(id, (1,4)); +Error, is not in the range of mapping +gap> PreImagesSet(id, [(1,2)]); +[ (1,2) ] +gap> PreImagesSet(id, [(1,4)]); +Error, is not a subset of the range of mapping + +# inverse general mapping +gap> g := GroupHomomorphismByImages(Group((1,2,3)), Group((4,5,6)), +> [(1,2,3)], [(4,5,6)]);; +gap> inv := InverseGeneralMapping(g);; +gap> PreImagesRepresentative(inv, (1,2,3)); +(4,5,6) +gap> PreImagesRepresentative(inv, (1,2)); +Error, is not in the range of mapping +gap> PreImagesElm(inv, (1,3,2)); +RightCoset(Group(()),(4,6,5)) +gap> PreImagesElm(inv, (1,2)); +Error, is not in the range of + +# zero mapping +gap> z := ZeroMapping(GF(3), GF(3));; +gap> PreImagesRepresentative(z, 0*Z(3)); +0*Z(3) +gap> PreImagesRepresentative(z, Z(3)); +fail +gap> PreImagesRepresentative(z, Z(9)); +Error, is not in the range of mapping +gap> PreImagesElm(z, Z(3)); +fail +gap> PreImagesElm(z, Z(9)); +Error, is not in the range of mapping +gap> PreImagesSet(z, [0*Z(3), Z(3)]); +GF(3) +gap> PreImagesSet(z, [Z(9)]); +Error, is not a subset of the range of mapping + +# mapping by function +gap> d := Domain([1, 2, 3, 4]);; +gap> mf := MappingByFunction(d, d, x -> Minimum(x + 1, 4));; +gap> PreImagesRepresentative(mf, 4); +3 +gap> PreImagesRepresentative(mf, 1); +fail +gap> PreImagesElm(mf, 4); +[ 3, 4 ] +gap> PreImagesElm(mf, 1); +fail +gap> PreImagesElm(mf, 7); +Error, is not in the range of + +# action homomorphism +gap> hom := ActionHomomorphism(Group((1,2,3,4)), [1..4]);; +gap> PreImagesRepresentative(hom, (1,2,3,4)); +(1,2,3,4) +gap> PreImagesRepresentative(hom, (1,2)); +fail +gap> PreImagesRepresentative(hom, (1,5)); +Error, is not in the range of mapping + +# direct product of perm groups +gap> D := DirectProduct(Group((1,2)), Group((1,2,3)));; +gap> emb := Embedding(D, 2);; +gap> PreImagesRepresentative(emb, (3,4,5)); +(1,2,3) +gap> PreImagesRepresentative(emb, (1,2)); +fail +gap> PreImagesRepresentative(emb, (1,3)); +Error, is not in the range of mapping +gap> prj := Projection(D, 1);; +gap> PreImagesRepresentative(prj, (1,2)); +(1,2) +gap> PreImagesRepresentative(prj, (1,3)); +Error, is not in the range of mapping + +# homomorphism from fp group +gap> F := FreeGroup("a", "b");; +gap> fp := F / [F.1^2, F.2^3, (F.1*F.2)^2];; +gap> fhom := GroupHomomorphismByImages(fp, SymmetricGroup(3), +> GeneratorsOfGroup(fp), [(1,2), (1,2,3)]);; +gap> PreImagesRepresentative(fhom, (1,2)); +a^-1 +gap> PreImagesRepresentative(fhom, (1,4)); +Error, is not in the range of mapping +gap> Size(PreImagesSet(fhom, Group((1,2,3)))); +3 +gap> PreImagesSet(fhom, Group((1,4))); +Error, is not a subset of the range of + +# field automorphisms +gap> aut := ANFAutomorphism(CF(5), 2);; +gap> PreImagesRepresentative(aut, E(5)); +E(5)^3 +gap> PreImagesRepresentative(aut, E(7)); +Error, is not in the range of mapping +gap> PreImagesElm(aut, E(5)); +[ E(5)^3 ] +gap> PreImagesElm(aut, E(7)); +Error, is not in the range of mapping +gap> PreImagesSet(aut, CF(35)); +Error, is not a subset of the range of mapping +gap> frob := FrobeniusAutomorphism(GF(4));; +gap> PreImagesElm(frob, Z(8)); +Error, is not in the range of + +# vector space homomorphism: not surjective +gap> V := GF(2)^2;; +gap> W := GF(2)^3;; +gap> vf := LeftModuleHomomorphismByImages(V, W, Basis(V), +> [[Z(2), 0*Z(2), 0*Z(2)], [0*Z(2), Z(2), 0*Z(2)]]);; +gap> PreImagesRepresentative(vf, [Z(2), Z(2), 0*Z(2)]); + +gap> PreImagesRepresentative(vf, [0*Z(2), 0*Z(2), Z(2)]); +fail + +# pc group homomorphism: not surjective +gap> C2 := CyclicGroup(IsPcGroup, 2);; +gap> C6 := CyclicGroup(IsPcGroup, 6);; +gap> pchom := GroupHomomorphismByImages(C2, C6, GeneratorsOfGroup(C2), +> [C6.1^3]);; +gap> PreImagesRepresentative(pchom, C6.1^3) = C2.1; +true +gap> PreImagesRepresentative(pchom, C6.1^2); +fail + +# binary relation on points +gap> rel := BinaryRelationOnPoints([[1, 2], [2], [3]]);; +gap> PreImagesElm(rel, 2); +[ 1, 2 ] +gap> PreImagesElm(rel, 5); +Error, is not in the range of +gap> STOP_TEST("preimages.tst");