gap-system / gap

Main development repository for GAP - Groups, Algorithms, Programming, a System for Computational Discrete Algebra
https://www.gap-system.org
GNU General Public License v2.0
803 stars 163 forks source link

Revisit and redesign mappings and homomorphisms in GAP #363

Open stevelinton opened 8 years ago

stevelinton commented 8 years ago

My attention was recently drawn to GeneralRestrictedMapping, which is in the library but undocumented. Unfortunately it only seems to work in certain situations -- essentially when you are restricting the Range of a mapping to a set that still includes its ImagesSource, or includes at least one image of each source point or something.

Otherwise things like this happen:

gap> s := SymmetricGroup(7);
Sym( [ 1 .. 7 ] )
gap> h := Stabilizer(s,[1,2],OnTuples);
Group([ (3,7), (4,7), (5,7), (6,7) ])
gap> k := Stabilizer(s,[6,7],OnTuples); 
Group([ (1,5), (2,5), (3,5), (4,5) ])
gap> phi := IdentityMapping(s);        
IdentityMapping( Sym( [ 1 .. 7 ] ) )
gap> xi := GeneralRestrictedMapping(phi,h,k);
GeneralRestrictedMapping( IdentityMapping( Sym( [ 1 .. 7 ] ) ), Group([ (3,7), (4,7), (5,7), (6,
 7) ]), Group([ (1,5), (2,5), (3,5), (4,5) ]) )
 gap> ImagesSource(xi);
 <group of size 120 with 4 generators>
 gap> GeneratorsOfGroup(last);
 [ fail, fail, fail, fail ]
 gap> 

I discussed this briefly with Alexander Hulpke, whose code it is. He said

"in general the functions for restricted and corestricted mappings are a mess and probably need redesign. The proper way of fixing it might be to separate the declaration of a mapping from the actual image mechanism — the latter currently sometimes implicitly assumes that it is defined for the `Source’ group.

Part of this is the dichotomy between catching illegal input and running in code with guaranteed valid input. If the homomorphism is between permutation groups and given by a stabilizer chain the validity test comes almost for free — in other situations (such as forcibly restricted maps) it has a cost. A function `ImagesRepresentativeNC’ (or so) might be the way out, but then the set or recommended operations becomes long and messy.

Even worse is the situation for e.g. matrix groups where for some homomorphisms the image is very cheap, but a membership test might be very expensive.

In short, the mechanism for homomorphisms and what are basic operations might need a rethink. I’d be happy to participate if anyone was interested."

fingolfin commented 7 years ago

I'd also be interested in such a discussion and the relevant changes.