From 51d898ca7ded76ed76dead486648dd121b40fdf9 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Wed, 30 May 2018 16:06:57 +0200 Subject: [PATCH] Take advantage of implications to simplify some code --- lib/coll.gi | 2 +- lib/grp.gi | 7 +++---- lib/grpmat.gi | 4 +--- lib/grppc.gi | 5 +---- lib/modulrow.gi | 4 ++-- lib/vspcrow.gi | 12 +++++------- 6 files changed, 13 insertions(+), 21 deletions(-) diff --git a/lib/coll.gi b/lib/coll.gi index f788cf5b26..f55867e621 100644 --- a/lib/coll.gi +++ b/lib/coll.gi @@ -3079,7 +3079,7 @@ local filt; fi; return; fi; - if sz=0 then filt:=IsEmpty and IsNonTrivial; # IsNonTrivial hold + if sz=0 then filt:=IsEmpty; elif sz=1 then filt:=IsTrivial; elif sz=infinity then filt:=IsNonTrivial and HasIsFinite; else filt:=IsNonTrivial and IsFinite; diff --git a/lib/grp.gi b/lib/grp.gi index 96f5b9bd18..86999c97ce 100644 --- a/lib/grp.gi +++ b/lib/grp.gi @@ -4316,12 +4316,12 @@ function(fam,filt,gens,id,isgroup) fi; if id<>fail then # cannot do identity in magma if ForAny(gens,x->x<>id) then - filt:=filt and HasIsTrivial and IsNonTrivial; + filt:=filt and IsNonTrivial; if isgroup and Length(gens)<=1 then # cyclic not for magmas filt:=filt and IsCyclic; fi; else - filt:=filt and IsTrivial and HasIsNonTrivial; + filt:=filt and IsTrivial; fi; fi; elif isgroup and Length(gens)<=1 then # cyclic not for magmas @@ -4379,8 +4379,7 @@ local G,fam,typ; fam:= CollectionsFamily( FamilyObj( id ) ); typ:=IsGroup and IsAttributeStoringRep - and HasGeneratorsOfMagmaWithInverses and HasOne and IsTrivial and - HasIsEmpty and HasIsNonTrivial; + and HasGeneratorsOfMagmaWithInverses and HasOne and IsTrivial; typ:=NewType(fam,typ); G:= rec(); diff --git a/lib/grpmat.gi b/lib/grpmat.gi index 9caaeecb7d..00d0778691 100644 --- a/lib/grpmat.gi +++ b/lib/grpmat.gi @@ -868,9 +868,7 @@ local G,fam,typ,f; if not IsFinite(gens) then TryNextMethod(); fi; typ:=MakeGroupyType(FamilyObj([id]), IsGroup and IsAttributeStoringRep - and HasGeneratorsOfMagmaWithInverses and IsFinitelyGeneratedGroup - and HasIsEmpty and IsFinite and HasOne - and IsTrivial and HasIsNonTrivial, + and HasGeneratorsOfMagmaWithInverses and HasOne and IsTrivial, gens,id,true); f:=DefaultScalarDomainOfMatrixList([id]); diff --git a/lib/grppc.gi b/lib/grppc.gi index ad1a10f292..e4018118f0 100644 --- a/lib/grppc.gi +++ b/lib/grppc.gi @@ -412,10 +412,7 @@ local G,fam,typ,pcgs; # pc groups are always finite and gens is finite. typ:=IsGroup and IsAttributeStoringRep - and HasGeneratorsOfMagmaWithInverses and HasOne - and IsFinite and IsFinitelyGeneratedGroup - and IsTrivial and HasIsNonTrivial - and HasIsEmpty and IsSolvableGroup + and HasGeneratorsOfMagmaWithInverses and HasOne and IsTrivial and HasFamilyPcgs and HasHomePcgs and HasGeneralizedPcgs; typ:=NewType(fam,typ); diff --git a/lib/modulrow.gi b/lib/modulrow.gi index efc9d07a15..546be4f133 100644 --- a/lib/modulrow.gi +++ b/lib/modulrow.gi @@ -35,9 +35,9 @@ local M,typ; # the free module record, result fi; if n=0 then - typ:=typ and IsTrivial and HasIsNonTrivial and IsFinite; + typ:=typ and IsTrivial; else - typ:=typ and HasIsTrivial and IsNonTrivial; + typ:=typ and IsNonTrivial; fi; if n<>infinity and HasIsFinite(R) and IsFinite(R) then diff --git a/lib/vspcrow.gi b/lib/vspcrow.gi index 80f5f9b78a..df699b2ad7 100644 --- a/lib/vspcrow.gi +++ b/lib/vspcrow.gi @@ -64,9 +64,9 @@ InstallMethod( LeftModuleByGenerators, fi; if Length(mat)>0 and ForAny(mat,x->not IsZero(x)) then - typ:=typ and HasIsTrivial and IsNonTrivial; + typ:=typ and IsNonTrivial; else - typ:=typ and IsTrivial and HasIsNonTrivial; + typ:=typ and IsTrivial; fi; if HasIsFinite(F) then @@ -98,9 +98,7 @@ InstallMethod( LeftModuleByGenerators, fi; #T explicit 2nd argument above! - typ:=IsAttributeStoringRep and HasIsEmpty and IsFiniteDimensional - and IsGaussianRowSpace and IsTrivial and HasIsNonTrivial and - IsFinite; + typ:=IsAttributeStoringRep and IsGaussianRowSpace and IsTrivial; V:= Objectify( NewType( CollectionsFamily( FamilyObj( F ) ),typ), rec() ); @@ -132,9 +130,9 @@ InstallMethod( LeftModuleByGenerators, fi; if Length(mat)>0 and ForAny(mat,x->not IsZero(x)) then - typ:=typ and HasIsTrivial and IsNonTrivial; + typ:=typ and IsNonTrivial; else - typ:=typ and IsTrivial and HasIsNonTrivial; + typ:=typ and IsTrivial; fi; if HasIsFinite(F) then