Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preserve more properties in DirectProduct #3053

Merged
merged 2 commits into from
Nov 26, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions lib/gprd.gi
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,13 @@ local d, prop;

# test/set a few properties and attributes from factors

for prop in [IsFinite, IsNilpotentGroup, IsAbelian, IsSolvableGroup] do
if ForAll(arg, Tester(prop)) then
Setter(prop)(d, ForAll(arg, prop));
for prop in [IsFinite, IsNilpotentGroup, IsAbelian, IsSolvableGroup, IsBand,
IsInverseSemigroup, IsRegularSemigroup, IsIdempotentGenerated,
IsLeftZeroSemigroup, IsRightZeroSemigroup, IsZeroSemigroup] do
if ForAny(arg, x -> Tester(prop)(x) and not prop(x)) then
Setter(prop)(d, false);
elif ForAll(arg, x -> Tester(prop)(x) and prop(x)) then
Setter(prop)(d, true);
fi;
od;

Expand Down
57 changes: 57 additions & 0 deletions tst/testinstall/gprd.tst
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#############################################################################
##
#W gprd.tst GAP library Wilf A. Wilson
##
##
#Y Copyright (C) 2018, The GAP Group
##
#@local g1,g2,g3,d1,d2,d3,d4
gap> START_TEST("gprd.tst");

# Test that information about IsNilpotentGroup is preserved by DirectProduct
gap> g1 := SymmetricGroup(3);;
gap> IsNilpotentGroup(g1);
false
gap> g2 := CyclicGroup(IsPermGroup, 6);;
gap> IsNilpotentGroup(g2);
true
gap> d1 := DirectProduct(g1, g1);;
gap> HasIsNilpotentGroup(d1) and not IsNilpotentGroup(d1);
true
gap> d2 := DirectProduct(g1, g2);;
gap> HasIsNilpotentGroup(d2) and not IsNilpotentGroup(d2);
true
gap> d3 := DirectProduct(g2, g2);;
gap> HasIsNilpotentGroup(d3) and IsNilpotentGroup(d3);
true
gap> g3 := Group([(1,2), (1,2,3)]);;
gap> d4 := DirectProduct(g3, g3, g3);;
gap> (HasIsNilpotentGroup(g3) and HasIsNilpotentGroup(d4)
> and not IsNilpotentGroup(d4)) or (not HasIsNilpotentGroup(g3) and not
> HasIsNilpotentGroup(d4));
true

# Test that information about IsFinite is preserved by DirectProduct
gap> g1 := SymmetricGroup(3);;
gap> HasIsFinite(g1) and IsFinite(g1);
true
gap> g2 := FreeGroup(1);;
gap> IsFinite(g2);
false
gap> d1 := DirectProduct(g1, g1);;
gap> HasIsFinite(d1) and IsFinite(d1);
true
gap> d2 := DirectProduct(g1, g2);;
gap> HasIsFinite(d2) and not IsFinite(d2);
true
gap> d3 := DirectProduct(g2, g2);;
gap> HasIsFinite(d3) and not IsFinite(d3);
true
gap> g3 := SymmetricGroup(5);;
gap> d4 := DirectProduct(g1, g2, g3);;
gap> HasIsFinite(d4) and not IsFinite(d4);
true

#
gap> STOP_TEST("gprd.tst");