Skip to content

Commit

Permalink
Take advantage of implications to simplify some code
Browse files Browse the repository at this point in the history
  • Loading branch information
fingolfin committed Jun 7, 2018
1 parent 4ef4c7f commit 51d898c
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 21 deletions.
2 changes: 1 addition & 1 deletion lib/coll.gi
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
7 changes: 3 additions & 4 deletions lib/grp.gi
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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();
Expand Down
4 changes: 1 addition & 3 deletions lib/grpmat.gi
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
Expand Down
5 changes: 1 addition & 4 deletions lib/grppc.gi
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
4 changes: 2 additions & 2 deletions lib/modulrow.gi
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 5 additions & 7 deletions lib/vspcrow.gi
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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() );
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 51d898c

Please sign in to comment.