diff --git a/lib/algebra.gi b/lib/algebra.gi index c17c6557ff..79660edba5 100644 --- a/lib/algebra.gi +++ b/lib/algebra.gi @@ -3280,6 +3280,28 @@ InstallMethod( IsCentral, IsCentralFromGenerators( GeneratorsOfAlgebraWithOne, GeneratorsOfAlgebraWithOne ) ); +############################################################################# +## +#O IsCentral( , ) . . . . . . . . test if is centralized by +## +InstallMethod( IsCentral, + "for an FLMLOR and an element", + IsCollsElms, + [ IsFLMLOR, IsObject ], + IsCentralElementFromGenerators( GeneratorsOfLeftModule ) ); + +InstallMethod( IsCentral, + "for an associative FLMLOR and an element", + IsCollsElms, + [ IsFLMLOR and IsAssociative, IsObject ], + IsCentralElementFromGenerators( GeneratorsOfAlgebra ) ); + +InstallMethod( IsCentral, + "for an associative FLMLOs-with-one and an element", + IsCollsElms, + [ IsFLMLORWithOne and IsAssociative, IsObject ], + IsCentralElementFromGenerators( GeneratorsOfAlgebraWithOne ) ); + ############################################################################# ## diff --git a/lib/grp.gi b/lib/grp.gi index f4cb52b4dd..f9740a4326 100644 --- a/lib/grp.gi +++ b/lib/grp.gi @@ -3315,27 +3315,17 @@ InstallMethod( \=, InstallMethod( IsCentral, "generic method for two groups", IsIdenticalObj, [ IsGroup, IsGroup ], - function ( G, U ) - local Ggens, # group generators of `G' - one, # identity of `U' - g, # one generator of - u; # one generator of - - # test if all generators of are fixed by the generators of - Ggens:= GeneratorsOfGroup( G ); - one:= One( U ); - for u in GeneratorsOfGroup( U ) do - for g in Ggens do - if Comm( u, g ) <> one then - return false; - fi; - od; - od; + IsCentralFromGenerators( GeneratorsOfGroup, + GeneratorsOfGroup ) ); - # all generators of are fixed, return `true' - return true; - end ); -#T compare method in `mgmgen.g'! +############################################################################# +## +#M IsCentral( , ) . . . . . . . is an element centralized by a group? +## +InstallMethod( IsCentral, + "for a group and an element", + IsCollsElms, [ IsGroup, IsMultiplicativeElementWithInverse ], + IsCentralElementFromGenerators( GeneratorsOfGroup ) ); ############################################################################# ## diff --git a/lib/magma.gd b/lib/magma.gd index 5e7505aeea..d939bcd620 100644 --- a/lib/magma.gd +++ b/lib/magma.gd @@ -894,9 +894,9 @@ end ); ## ## ## -## is a function that takes two domain arguments D1, D2 and checks -## whether GeneratorsStruct1( D1 ) and GeneratorsStruct2( D2 ) -## commute. +## is a function which returns a function that takes two domain arguments D1, +## D2 and checks whether GeneratorsStruct1( D1 ) +## and GeneratorsStruct2( D2 ) commute. ## ## ## @@ -916,6 +916,34 @@ BindGlobal( "IsCentralFromGenerators", end ); +############################################################################# +## +#F IsCentralElementFromGenerators( ) +## +## +## +## +## +## is a function which returns a function that takes a domain argument +## D and an object obj and checks whether +## GeneratorsStruct( D ) and obj commute. +## +## +## +BindGlobal( "IsCentralElementFromGenerators", + function( GeneratorsStruct ) + return function( D, obj ) + local g; + for g in GeneratorsStruct( D ) do + if g * obj <> obj * g then + return false; + fi; + od; + return true; + end; +end ); + + ############################################################################# ## #A MagmaGeneratorsOfFamily( ) diff --git a/lib/magma.gi b/lib/magma.gi index 96fb7c42ca..8deedc4ca1 100644 --- a/lib/magma.gi +++ b/lib/magma.gi @@ -1100,9 +1100,10 @@ InstallMethod( Enumerator, [ IsMagma and IsAttributeStoringRep ], 0, EnumeratorOfMagma ); + ############################################################################# ## -#M IsCentral( , ) . . . . . . . . . . . . . . . . . . for two magmas +#M IsCentral( , ) ## InstallMethod( IsCentral, "for two magmas", @@ -1110,11 +1111,6 @@ InstallMethod( IsCentral, [ IsMagma, IsMagma ], 0, IsCentralFromGenerators( GeneratorsOfMagma, GeneratorsOfMagma ) ); - -############################################################################# -## -#M IsCentral( , ) . . . . . . . . . . . . . . for two magmas with one -## InstallMethod( IsCentral, "for two magmas-with-one", IsIdenticalObj, @@ -1122,11 +1118,6 @@ InstallMethod( IsCentral, IsCentralFromGenerators( GeneratorsOfMagmaWithOne, GeneratorsOfMagmaWithOne ) ); - -############################################################################# -## -#M IsCentral( , ) . . . . . . . . . . . for two magmas with inverses -## InstallMethod( IsCentral, "for two magmas-with-inverses", IsIdenticalObj, @@ -1134,6 +1125,28 @@ InstallMethod( IsCentral, IsCentralFromGenerators( GeneratorsOfMagmaWithInverses, GeneratorsOfMagmaWithInverses ) ); +############################################################################# +## +#M IsCentral( , ) +## +InstallMethod( IsCentral, + "for a magma and an element", + IsCollsElms, + [ IsMagma, IsObject ], 0, + IsCentralElementFromGenerators( GeneratorsOfMagma ) ); + +InstallMethod( IsCentral, + "for a magma-with-one and an element", + IsCollsElms, + [ IsMagmaWithOne, IsObject ], 0, + IsCentralElementFromGenerators( GeneratorsOfMagmaWithOne ) ); + +InstallMethod( IsCentral, + "for a magma-with-inverses and an element", + IsCollsElms, + [ IsMagmaWithInverses, IsObject ], 0, + IsCentralElementFromGenerators( GeneratorsOfMagmaWithInverses ) ); + ############################################################################# ## diff --git a/lib/ring.gi b/lib/ring.gi index 35ff299621..78563a8ee3 100644 --- a/lib/ring.gi +++ b/lib/ring.gi @@ -189,17 +189,33 @@ InstallImmediateMethod( IsZeroMultiplicationRing, InstallMethod( IsCentral, "for two associative rings", IsIdenticalObj, - [ IsRing and IsAssociative, IsRing and IsAssociative ], 0, + [ IsRing and IsAssociative, IsRing and IsAssociative ], IsCentralFromGenerators( GeneratorsOfRing, GeneratorsOfRing ) ); InstallMethod( IsCentral, "for two associative rings-with-one", IsIdenticalObj, [ IsRingWithOne and IsAssociative, - IsRingWithOne and IsAssociative ], 0, + IsRingWithOne and IsAssociative ], IsCentralFromGenerators( GeneratorsOfRingWithOne, GeneratorsOfRingWithOne ) ); +############################################################################# +## +#M IsCentral( , ) . . . . . . . . test if is centralized by +## +InstallMethod( IsCentral, + "for an associative ring and an element", + IsCollsElms, + [ IsRing and IsAssociative, IsObject ], + IsCentralElementFromGenerators( GeneratorsOfRing ) ); + +InstallMethod( IsCentral, + "for an associative ring-with-one and an element", + IsCollsElms, + [ IsRingWithOne and IsAssociative, IsObject ], + IsCentralElementFromGenerators( GeneratorsOfRingWithOne ) ); + ############################################################################# ## diff --git a/tst/testinstall/opers/IsCentral.tst b/tst/testinstall/opers/IsCentral.tst new file mode 100644 index 0000000000..fe7bed1385 --- /dev/null +++ b/tst/testinstall/opers/IsCentral.tst @@ -0,0 +1,92 @@ +gap> START_TEST("IsCentral.tst"); + +# +# for groups +# +gap> G:=SymmetricGroup(3);; + +# a group and an element +gap> List(AsSet(G), g -> [g, IsCentral(G,g)]); +[ [ (), true ], [ (2,3), false ], [ (1,2), false ], [ (1,2,3), false ], + [ (1,3,2), false ], [ (1,3), false ] ] + +# a group and a subgroup +gap> G:=SymmetricGroup(3);; +gap> List(Set(AllSubgroups(G)), H -> [H, IsCentral(G, H)]); +[ [ Group(()), true ], [ Group([ (2,3) ]), false ], + [ Group([ (1,2,3), (2,3) ]), false ], [ Group([ (1,2) ]), false ], + [ Group([ (1,2,3) ]), false ], [ Group([ (1,3) ]), false ] ] + +# +# a set of matrices for the other tests +# +gap> gens := [ DiagonalMat([1,0]), [[0,1],[0,0]], DiagonalMat([1,1]) ];; + +# +# for a magma +# +gap> M:=Magma(gens); + +gap> List(AsSet(M), x->IsCentral(M,x)); +[ true, false, false, true ] +gap> IsCentral(M, Submagma(M, [])); +true +gap> List(AsSet(M), x->IsCentral(M,Submagma(M,[x]))); +[ true, false, false, true ] + +# +# for a magma with one +# +gap> M:=MagmaWithOne(gens); + +gap> List(AsSet(M), x->IsCentral(M,x)); +[ true, false, false, true ] +gap> IsCentral(M, Submagma(M, [])); +true +gap> List(AsSet(M), x->IsCentral(M,Submagma(M,[x]))); +[ true, false, false, true ] + +# +# for an algebra +# +gap> A:=Algebra(Rationals, gens); + +gap> List(GeneratorsOfAlgebra(A), x->IsCentral(A,x)); +[ false, false, true ] +gap> List(GeneratorsOfAlgebra(A), x->IsCentral(A,Subalgebra(A,[x]))); +[ false, false, true ] + +# +# for an algebra with one +# +gap> A:=AlgebraWithOne(Rationals, gens); + +gap> List(GeneratorsOfAlgebraWithOne(A), x->IsCentral(A,x)); +[ false, false, true ] +gap> List(GeneratorsOfAlgebraWithOne(A), x->IsCentral(A,Subalgebra(A,[x]))); +[ false, false, true ] + +# +# for a ring +# +gap> R:=Ring(gens); + +gap> SetIsAssociative(R,true); +gap> List(GeneratorsOfLeftOperatorRing(R), x->IsCentral(R,x)); +[ false, false, true ] +gap> List(GeneratorsOfLeftOperatorRing(R), x->IsCentral(R,SubringNC(R,[x]))); +[ false, false, true ] + +# +# for a ring with one +# +gap> R:=RingWithOne(gens); + +gap> SetIsAssociative(R,true); +gap> List(GeneratorsOfLeftOperatorRingWithOne(R), x->IsCentral(R,x)); +[ false, false, true ] +gap> List(GeneratorsOfLeftOperatorRingWithOne(R), x->IsCentral(R,SubringNC(R,[x]))); +[ false, false, true ] + +# +gap> STOP_TEST("IsCentral.tst", 10000);