From 2f6bf51db6999a7bb02cbaf1303b9479c6e2cc91 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Fri, 23 Oct 2026 22:22:33 +0200 Subject: [PATCH] Fix `Embedding` of a family into its `LieFamily` `Embedding( Fam, LieFamily( Fam ) )` failed for every family: it built the mapping's type with `TypeOfDefaultGeneralMapping`, which expects domains, not families. Build the type from `GeneralMappingsFamily` instead. The preimage methods then failed on `Range`, which such a mapping has no domain for; since the embedding is a bijection of families, they now return the preimage directly. Assisted-by: Generative AI --- lib/liefam.gi | 20 ++++++++++++------- .../2026-10-23-LieFamily-Embedding.tst | 15 ++++++++++++++ 2 files changed, 28 insertions(+), 7 deletions(-) create mode 100644 tst/testbugfix/2026-10-23-LieFamily-Embedding.tst diff --git a/lib/liefam.gi b/lib/liefam.gi index 848e616068..a81f72efd4 100644 --- a/lib/liefam.gi +++ b/lib/liefam.gi @@ -422,7 +422,7 @@ InstallOtherMethod( Embedding, fi; # Make the mapping object. - emb := Objectify( TypeOfDefaultGeneralMapping( Fam, LieFam, + emb := Objectify( NewType( GeneralMappingsFamily( Fam, LieFam ), IsLieEmbeddingRep and IsNonSPGeneralMapping and IsMapping @@ -455,18 +455,24 @@ InstallMethod( PreImagesElmNC, return [ elm![1] ]; end ); +# The embedding is a bijection of families, so every element of the +# range family has a preimage, and there is no range domain to test. 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 []; - fi; - return PreImagesElmNC( emb, elm ); + return [ elm![1] ]; + end ); + +InstallMethod( PreImagesRepresentative, + "for Lie embedding and Lie object in default representation", + FamRangeEqFamElm, + [ IsGeneralMapping and IsLieEmbeddingRep, + IsLieObject and IsPackedElementDefaultRep ], 0, + function( emb, elm ) + return elm![1]; end ); ############################################################################# diff --git a/tst/testbugfix/2026-10-23-LieFamily-Embedding.tst b/tst/testbugfix/2026-10-23-LieFamily-Embedding.tst new file mode 100644 index 0000000000..97d847e4db --- /dev/null +++ b/tst/testbugfix/2026-10-23-LieFamily-Embedding.tst @@ -0,0 +1,15 @@ +# Embedding( Fam, LieFamily( Fam ) ) used to fail with a no method error +gap> F := FamilyObj( 1 );; L := LieFamily( F );; +gap> emb := Embedding( F, L );; +gap> 3 ^ emb = LieObject( 3 ); +true +gap> PreImagesRepresentative( emb, LieObject( 3 ) ); +3 +gap> PreImagesElm( emb, LieObject( 3 ) ); +[ 3 ] +gap> m := [ [ 1, 2 ], [ 3, 4 ] ];; +gap> F := FamilyObj( m );; emb := Embedding( F, LieFamily( F ) );; +gap> m ^ emb = LieObject( m ); +true +gap> PreImagesRepresentative( emb, LieObject( m ) ) = m; +true