diff --git a/doc/ref/mgmadj.xml b/doc/ref/mgmadj.xml index 38dce73fca..b4b6039074 100644 --- a/doc/ref/mgmadj.xml +++ b/doc/ref/mgmadj.xml @@ -49,7 +49,7 @@ gap> x:=Transformation( [ 7, 7, 7, 3, 7, 3, 7 ] );; gap> x^map; -gap> PreImage(map, x^map)=x; +gap> PreImagesRepresentative(map, x^map)=x; true ]]> @@ -72,7 +72,7 @@ gap> T:=MagmaWithZeroAdjoined(S); gap> UnderlyingInjectionZeroMagma(T); MappingByFunction( , < - with 0 adjoined>, function( elt ) ... end, function( x ) ... end ) + with 0 adjoined>, function( elt ) ... end ) ]]> diff --git a/lib/mgmadj.gi b/lib/mgmadj.gi index 4d17ebf18b..161e9c92c7 100644 --- a/lib/mgmadj.gi +++ b/lib/mgmadj.gi @@ -176,7 +176,10 @@ function(m) fi; SetGeneratorsOfMagma(out, gens); - inj:=MappingByFunction(m, out, inj, x-> x!.elt); + # the zero is not in the image, so is not bijective + inj:=MappingByFunction(m, out, inj, false, x-> x!.elt); + SetIsInjective(inj, true); + SetIsSurjective(inj, false); SetUnderlyingInjectionZeroMagma(out, inj); return inj; diff --git a/lib/reesmat.gi b/lib/reesmat.gi index 778b1bd145..d1e6c9fa5d 100644 --- a/lib/reesmat.gi +++ b/lib/reesmat.gi @@ -1306,7 +1306,7 @@ end); BindGlobal("_InjectionPrincipalFactor", function(D, constructor) - local map, inv, G, mat, rep, R, L, x, RR, LL, rms, iso, hom, i, j; + local map, inv, G, mat, rep, R, L, x, RR, LL, rms, iso, prefun, hom, i, j; map := IsomorphismPermGroup(GroupHClassOfGreensDClass(D)); inv := InverseGeneralMapping(map); @@ -1366,15 +1366,21 @@ function(D, constructor) [i, (rep * RR[i] * x * LL[j]) ^ map, j, mat]); end; - hom := MappingByFunction(D, rms, iso, - function(x) - if x![1] = 0 then - return fail; - fi; - return R[x![1]] * (x![2] ^ inv) * L[x![3]]; - end); - SetIsInjective(hom, true); - SetIsTotal(hom, true); + prefun := function(x) + if x![1] = 0 then + return fail; + fi; + return R[x![1]] * (x![2] ^ inv) * L[x![3]]; + end; + + if IsReesZeroMatrixSemigroup(rms) then + # the zero of is not in the image + hom := MappingByFunction(D, rms, iso, false, prefun); + SetIsInjective(hom, true); + SetIsSurjective(hom, false); + else + hom := MappingByFunction(D, rms, iso, prefun); + fi; return hom; end); @@ -1431,7 +1437,7 @@ function(S) if x = MultiplicativeZero(Range(map)) then return MultiplicativeZero(S); fi; - return x ^ InverseGeneralMapping(map); + return PreImagesRepresentativeNC(map, x); end; return MagmaIsomorphismByFunctionsNC(S, diff --git a/tst/testbugfix/2026-10-18-InjectionZeroMagma.tst b/tst/testbugfix/2026-10-18-InjectionZeroMagma.tst new file mode 100644 index 0000000000..71005a111a --- /dev/null +++ b/tst/testbugfix/2026-10-18-InjectionZeroMagma.tst @@ -0,0 +1,16 @@ +# InjectionZeroMagma is injective but not surjective +gap> map := InjectionZeroMagma( SymmetricGroup( 2 ) );; +gap> [ IsInjective( map ), IsSurjective( map ), IsBijective( map ) ]; +[ true, false, false ] +gap> x := (1,2) ^ map;; +gap> PreImagesRepresentative( map, x ); +(1,2) +gap> PreImagesElm( map, x ); +[ (1,2) ] +gap> z := MultiplicativeZero( Range( map ) );; +gap> PreImagesRepresentative( map, z ); +fail +gap> PreImagesElm( map, z ); +[ ] +gap> PreImage( map, z ); +Error, must be an injective and surjective mapping diff --git a/tst/testinstall/reesmat.tst b/tst/testinstall/reesmat.tst index d0ccf3750f..d34b93060b 100644 --- a/tst/testinstall/reesmat.tst +++ b/tst/testinstall/reesmat.tst @@ -831,8 +831,9 @@ gap> ForAll(S, s -> (s ^ iso) ^ inv = s); true gap> D := GreensDClassOfElement(S, S.1);; gap> iso := _InjectionPrincipalFactor(D, ReesZeroMatrixSemigroup);; -gap> inv := InverseGeneralMapping(iso);; -gap> MultiplicativeZero(Range(iso)) ^ inv; +gap> IsSurjective(iso); +false +gap> PreImagesRepresentative(iso, MultiplicativeZero(Range(iso))); fail # AssociatedReesMatrixSemigroupOfDClass: for a D-class of a finite semigroup diff --git a/tst/testinstall/semigrp.tst b/tst/testinstall/semigrp.tst index 39eb27d0cf..813207d4eb 100644 --- a/tst/testinstall/semigrp.tst +++ b/tst/testinstall/semigrp.tst @@ -125,7 +125,7 @@ gap> g := f/[f.1^4];; gap> phi := InjectionZeroMagma(g); MappingByFunction( , < with 0 adjoined>, function( elt ) ... end, function( x ) ... end ) +[ a ]> with 0 adjoined>, function( elt ) ... end ) gap> m := Range(phi); < with 0 adjoined> gap> el := Elements(m);;