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
810 stars 161 forks source link

Issue with `RingGeneralMappingByImages` and `FreeMagmaRing` #5428

Open fingolfin opened 1 year ago

fingolfin commented 1 year ago

Consider this:

gap> R:=FreeMagmaRing(Integers, FreeMagma(3));
<free left module over Integers, and ring, with 3 generators>
gap> map := RingGeneralMappingByImages(R, R, GeneratorsOfLeftOperatorRing(R), GeneratorsOfLeftOperatorRing(R));
[ (1)*x1, (1)*x2, (1)*x3 ] -> [ (1)*x1, (1)*x2, (1)*x3 ]

So far, so good. Unfortunately, computing images does not work:

gap> R.1^map;
Error, Record Element: '<rec>.moduli' must have an assigned value in
  FamilyObj( Zero( r ) ) at GAPROOT/lib/ringhom.gi:182 called from
IsSingleValued( map ) at GAPROOT/lib/mapping.gi:916 called from
ImageElm( map, elm ) at GAPROOT/lib/mapping.gi:819 called from
<function "^ for element in the source, and general mapping">( <arguments> )
 called from read-eval loop at *stdin*:12
type 'quit;' to quit to outer loop

OK, so let's help it and inform it that our map really is a mapping:

gap> SetIsMapping(map, true);
gap> R.1^map;
Error, Record Element: '<rec>.moduli' must have an assigned value in
  m := SCRHNFExtend( fam!.moduli, l, piv, ExtRepOfObj( gens[i] ), li, imgs[i] )
 ; at GAPROOT/lib/ringsc.gi:726 called from
StandardGeneratorsImagesSubringSCRing( FamilyObj( Zero( Source( map ) ) ), mapi[1], mapi[2]
 ) at GAPROOT/lib/ringhom.gi:168 called from
MakeSCRingMapping( map ); at GAPROOT/lib/ringhom.gi:435 called from
ImageElm( map, elm ) at GAPROOT/lib/mapping.gi:819 called from
<function "^ for element in the source, and general mapping">( <arguments> )
 called from read-eval loop at *stdin*:15
type 'quit;' to quit to outer loop

I don't know what StandardGeneratorsImagesSubringSCRing and SCRHNFExtend are about.

But in this case, the domain is a free magma, and the generators are its "default" generators, so in this case:

I realize that supporting arbitrary rings is difficult (or rather, impossible), but this seems like a pretty natural case to support. Maybe we can with a few tweaks?

ThomasBreuer commented 1 year ago

There is already a special treatment of mappings from polynomial rings where images of the indeterminates are prescribed; the filter IsPolynomialRingDefaultGeneratorMapping is set by AlgebraGeneralMappingByImages. This approach could be generalized to free magma rings. (Note that this happens in the context of algebra homomorphisms not of ring homomorphisms.)