Skip to content

Commit

Permalink
Use Pluralize in some ViewString/ViewObj methods
Browse files Browse the repository at this point in the history
The focus of this is to avoid many occurrences of
the phrase "1 generators", which is incorrect
pluralisation (it should be "1 generator").
  • Loading branch information
wilfwilson committed Apr 29, 2020
1 parent b9e45fb commit ce3c6a0
Show file tree
Hide file tree
Showing 44 changed files with 185 additions and 157 deletions.
2 changes: 1 addition & 1 deletion doc/ref/arith.xml
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ hence the generic methods for such domains will have a chance to succeed.
gap> a:= MyObject( Z(7) );
<Z(7)>
gap> m:= Magma( a );
<magma with 1 generators>
<magma with 1 generator>
gap> e:= MultiplicativeNeutralElement( m );
<Z(7)^2>
gap> elms:= AsList( m );
Expand Down
2 changes: 1 addition & 1 deletion doc/ref/fldabnum.xml
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ over a non-cyclotomic field.
<P/>
<Example><![CDATA[
gap> g:= GaloisGroup( AsField( Field( [ Sqrt(5) ] ), CF(5) ) );
<group of size 2 with 1 generators>
<group of size 2 with 1 generator>
gap> gens:= GeneratorsOfGroup( g );
[ ANFAutomorphism( AsField( NF(5,[ 1, 4 ]), CF(5) ), 4 ) ]
gap> x:= last[1];; x^2;
Expand Down
2 changes: 1 addition & 1 deletion doc/ref/methsel.xml
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ gap> InstallMethod(XCons, [IsGroup, IsInt], function(t,x) return CyclicGroup(x);
gap> InstallMethod(XCons, [IsPermGroup, IsInt], function(t,x) return SymmetricGroup(x); end);
gap> InstallMethod(XCons, [IsSemigroup, IsInt], function(t,x) return FullTransformationMonoid(x); end);
gap> XCons(IsGroup,3);
<pc group of size 3 with 1 generators>
<pc group of size 3 with 1 generator>
gap> XCons(IsPermGroup,3);
Sym( [ 1 .. 3 ] )
gap> XCons(IsSemigroup,4);
Expand Down
4 changes: 2 additions & 2 deletions doc/ref/reesmat.xml
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,10 @@ gap> mat:=[[(), 0, 0], [0, (), 0], [0, 0, ()],
> [(), (), ()], [0, 0, ()]];;
gap> R:=ReesZeroMatrixSemigroup(G, mat);
<Rees 0-matrix semigroup 3x5 over
<permutation group of size 1007 with 1 generators>>
<permutation group of size 1007 with 1 generator>>
gap> ReesZeroMatrixSubsemigroup(R, [1,3], G, [1..5]);
<Rees 0-matrix semigroup 2x5 over
<permutation group of size 1007 with 1 generators>>
<permutation group of size 1007 with 1 generator>>
]]></Example>
</Description>
</ManSection>
Expand Down
2 changes: 1 addition & 1 deletion doc/tut/algvspc.xml
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ into one line.
gap> m:= [ [ 1, 2, 3 ], [ 0, 1, 6 ], [ 0, 0, 1 ] ];;
gap> A:= Algebra( Rationals, [ m ] );;
gap> subA:= Subalgebra( A, [ m-m^2 ] );
<algebra over Rationals, with 1 generators>
<algebra over Rationals, with 1 generator>
gap> Dimension( subA );
2
gap> idA:= Ideal( A, [ m-m^3 ] );
Expand Down
4 changes: 2 additions & 2 deletions grp/basic.gd
Original file line number Diff line number Diff line change
Expand Up @@ -253,11 +253,11 @@ DeclareConstructor( "CyclicGroupCons", [ IsGroup, IsInt ] );
## gap> CyclicGroup(IsPermGroup,12);
## Group([ (1,2,3,4,5,6,7,8,9,10,11,12) ])
## gap> matgrp1:= CyclicGroup( IsMatrixGroup, 12 );
## <matrix group of size 12 with 1 generators>
## <matrix group of size 12 with 1 generator>
## gap> FieldOfMatrixGroup( matgrp1 );
## Rationals
## gap> matgrp2:= CyclicGroup( IsMatrixGroup, GF(2), 12 );
## <matrix group of size 12 with 1 generators>
## <matrix group of size 12 with 1 generator>
## gap> FieldOfMatrixGroup( matgrp2 );
## GF(2)
## ]]></Example>
Expand Down
18 changes: 11 additions & 7 deletions lib/addmagma.gi
Original file line number Diff line number Diff line change
Expand Up @@ -68,33 +68,37 @@ InstallMethod( ViewObj,
"for an add. magma with generators",
[ IsAdditiveMagma and HasGeneratorsOfAdditiveMagma ],
function( A )
local nrgens;
nrgens := Length( GeneratorsOfAdditiveMagma( A ) );
Print( "<additive magma with ",
Length( GeneratorsOfAdditiveMagma( A ) ), " generators>" );
nrgens, " ", Pluralize( nrgens, "generator" ), ">" );
end );

InstallMethod( ViewObj,
"for an add. magma-with-zero with generators",
[ IsAdditiveMagmaWithZero and HasGeneratorsOfAdditiveMagmaWithZero ],
function( A )
if IsEmpty( GeneratorsOfAdditiveMagmaWithZero( A ) ) then
local nrgens;
nrgens := GeneratorsOfAdditiveMagmaWithZero( A );
if nrgens = 0 then
Print( "<trivial additive magma-with-zero>" );
else
Print( "<additive magma-with-zero with ",
Length( GeneratorsOfAdditiveMagmaWithZero( A ) ),
" generators>" );
nrgens, " ", Pluralize( nrgens, "generator" ), ">" );
fi;
end );

InstallMethod( ViewObj,
"for an add. magma-with-inverses with generators",
[ IsAdditiveGroup and HasGeneratorsOfAdditiveGroup ],
function( A )
if IsEmpty( GeneratorsOfAdditiveGroup( A ) ) then
local nrgens;
nrgens := GeneratorsOfAdditiveGroup( A );
if nrgens = 0 then
Print( "<trivial additive magma-with-inverses>" );
else
Print( "<additive magma-with-inverses with ",
Length( GeneratorsOfAdditiveGroup( A ) ),
" generators>" );
nrgens, " ", Pluralize( nrgens, "generator" ), ">" );
fi;
end );

Expand Down
28 changes: 14 additions & 14 deletions lib/algebra.gd
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ DeclareAttribute( "GeneratorsOfLeftOperatorRingWithOne",
## <Example><![CDATA[
## gap> m:= [ [ 0, 1, 2 ], [ 0, 0, 3 ], [ 0, 0, 0 ] ];;
## gap> A:= AlgebraWithOne( Rationals, [ m ] );
## <algebra-with-one over Rationals, with 1 generators>
## <algebra-with-one over Rationals, with 1 generator>
## gap> GeneratorsOfAlgebra( A );
## [ [ [ 1, 0, 0 ], [ 0, 1, 0 ], [ 0, 0, 1 ] ],
## [ [ 0, 1, 2 ], [ 0, 0, 3 ], [ 0, 0, 0 ] ] ]
Expand Down Expand Up @@ -287,7 +287,7 @@ DeclareSynonymAttr( "GeneratorsOfFLMLOR", GeneratorsOfLeftOperatorRing );
## <Example><![CDATA[
## gap> m:= [ [ 0, 1, 2 ], [ 0, 0, 3 ], [ 0, 0, 0 ] ];;
## gap> A:= AlgebraWithOne( Rationals, [ m ] );
## <algebra-with-one over Rationals, with 1 generators>
## <algebra-with-one over Rationals, with 1 generator>
## gap> GeneratorsOfAlgebraWithOne( A );
## [ [ [ 0, 1, 2 ], [ 0, 0, 3 ], [ 0, 0, 0 ] ] ]
## ]]></Example>
Expand Down Expand Up @@ -408,7 +408,7 @@ DeclareAttribute( "IndicesOfAdjointBasis", IsBasis );
## <Example><![CDATA[
## gap> m:= [ [ 0, 1, 2 ], [ 0, 0, 3 ], [ 0, 0, 0 ] ];;
## gap> A:= AlgebraWithOneByGenerators( Rationals, [ m ] );
## <algebra-with-one over Rationals, with 1 generators>
## <algebra-with-one over Rationals, with 1 generator>
## gap> RadicalOfAlgebra( A );
## <algebra of dimension 2 over Rationals>
## ]]></Example>
Expand Down Expand Up @@ -543,7 +543,7 @@ DeclareAttribute( "NullAlgebra", IsRing );
## gap> A:= QuaternionAlgebra( Rationals );;
## gap> b:= BasisVectors( Basis( A ) );;
## gap> B:= Subalgebra( A, [ b[4] ] );
## <algebra over Rationals, with 1 generators>
## <algebra over Rationals, with 1 generator>
## gap> ProductSpace( A, B );
## <vector space of dimension 4 over Rationals>
## ]]></Example>
Expand Down Expand Up @@ -662,7 +662,7 @@ DeclareSynonym( "AsAlgebra", AsFLMLOR );
## gap> V:= VectorSpace( Rationals, [ IdentityMat( 2 ) ] );;
## gap> A:= AsAlgebra( Rationals, V );;
## gap> AsAlgebraWithOne( Rationals, A );
## <algebra-with-one over Rationals, with 1 generators>
## <algebra-with-one over Rationals, with 1 generator>
## ]]></Example>
## </Description>
## </ManSection>
Expand Down Expand Up @@ -721,7 +721,7 @@ DeclareSynonym( "AsSubalgebra", AsSubFLMLOR );
## gap> B:= AsAlgebra( Rationals, V );;
## gap> C:= AsAlgebraWithOne( Rationals, B );;
## gap> AC:= AsSubalgebraWithOne( A, C );
## <algebra-with-one over Rationals, with 1 generators>
## <algebra-with-one over Rationals, with 1 generator>
## ]]></Example>
## </Description>
## </ManSection>
Expand Down Expand Up @@ -1189,7 +1189,7 @@ DeclareSynonym( "AlgebraByGenerators", FLMLORByGenerators );
## <Example><![CDATA[
## gap> m:= [ [ 0, 1, 2 ], [ 0, 0, 3], [ 0, 0, 0 ] ];;
## gap> A:= Algebra( Rationals, [ m ] );
## <algebra over Rationals, with 1 generators>
## <algebra over Rationals, with 1 generator>
## gap> Dimension( A );
## 2
## ]]></Example>
Expand Down Expand Up @@ -1226,9 +1226,9 @@ DeclareSynonym( "Algebra", FLMLOR );
## <Example><![CDATA[
## gap> m:= [ [ 0, 1, 2 ], [ 0, 0, 3], [ 0, 0, 0 ] ];;
## gap> A:= Algebra( Rationals, [ m ] );
## <algebra over Rationals, with 1 generators>
## <algebra over Rationals, with 1 generator>
## gap> B:= Subalgebra( A, [ m^2 ] );
## <algebra over Rationals, with 1 generators>
## <algebra over Rationals, with 1 generator>
## ]]></Example>
## </Description>
## </ManSection>
Expand All @@ -1254,7 +1254,7 @@ DeclareSynonym( "Subalgebra", SubFLMLOR );
## <Example><![CDATA[
## gap> m:= RandomMat( 3, 3 );;
## gap> A:= Algebra( Rationals, [ m ] );
## <algebra over Rationals, with 1 generators>
## <algebra over Rationals, with 1 generator>
## gap> SubalgebraNC( A, [ IdentityMat( 3, 3 ) ], "basis" );
## <algebra of dimension 1 over Rationals>
## ]]></Example>
Expand Down Expand Up @@ -1308,7 +1308,7 @@ DeclareSynonym( "AlgebraWithOneByGenerators", FLMLORWithOneByGenerators );
## <Example><![CDATA[
## gap> m:= [ [ 0, 1, 2 ], [ 0, 0, 3], [ 0, 0, 0 ] ];;
## gap> A:= AlgebraWithOne( Rationals, [ m ] );
## <algebra-with-one over Rationals, with 1 generators>
## <algebra-with-one over Rationals, with 1 generator>
## gap> Dimension( A );
## 3
## gap> One(A);
Expand Down Expand Up @@ -1342,7 +1342,7 @@ DeclareSynonym( "AlgebraWithOne", FLMLORWithOne );
## <Example><![CDATA[
## gap> m:= [ [ 0, 1, 2 ], [ 0, 0, 3], [ 0, 0, 0 ] ];;
## gap> A:= AlgebraWithOne( Rationals, [ m ] );
## <algebra-with-one over Rationals, with 1 generators>
## <algebra-with-one over Rationals, with 1 generator>
## gap> B1:= SubalgebraWithOne( A, [ m ] );;
## gap> B2:= Subalgebra( A, [ m ] );;
## gap> Dimension( B1 );
Expand Down Expand Up @@ -1374,7 +1374,7 @@ DeclareSynonym( "SubalgebraWithOne", SubFLMLORWithOne );
## <Example><![CDATA[
## gap> m:= RandomMat( 3, 3 );; A:= Algebra( Rationals, [ m ] );;
## gap> SubalgebraWithOneNC( A, [ m ] );
## <algebra-with-one over Rationals, with 1 generators>
## <algebra-with-one over Rationals, with 1 generator>
## ]]></Example>
## </Description>
## </ManSection>
Expand Down Expand Up @@ -2168,7 +2168,7 @@ DeclareSynonym( "IsLieNilpotentElement", IsNilpotentElement);
## rec( hom_components := function( d ) ... end, max_degree := 9,
## min_degree := 1, source := Integers )
## gap> g.hom_components( 3 );
## <vector space over GF(3), with 1 generators>
## <vector space over GF(3), with 1 generator>
## gap> g.hom_components( 14 );
## <vector space of dimension 0 over GF(3)>
## ]]></Example>
Expand Down
21 changes: 15 additions & 6 deletions lib/algebra.gi
Original file line number Diff line number Diff line change
Expand Up @@ -1887,9 +1887,11 @@ InstallMethod( ViewObj,
"for a FLMLOR with known generators",
[ IsFLMLOR and HasGeneratorsOfAlgebra ],
function( A )
local nrgens;
nrgens := Length( GeneratorsOfFLMLOR( A ) );
Print( "<free left module over ", LeftActingDomain( A ),
", and ring, with ",
Length( GeneratorsOfFLMLOR( A ) ), " generators>" );
nrgens, " ", Pluralize( nrgens, "generator" ), ">" );
end );


Expand Down Expand Up @@ -1943,10 +1945,11 @@ InstallMethod( ViewObj,
"for a FLMLOR-with-one with known generators",
[ IsFLMLORWithOne and HasGeneratorsOfFLMLORWithOne ],
function( A )
local nrgens;
nrgens := Length( GeneratorsOfAlgebraWithOne( A ) );
Print( "<free left module over ", LeftActingDomain( A ),
", and ring-with-one, with ",
Length( GeneratorsOfAlgebraWithOne( A ) ), " generators>" );

nrgens, " ", Pluralize( nrgens, "generator" ), ">" );
end );


Expand Down Expand Up @@ -2000,8 +2003,10 @@ InstallMethod( ViewObj,
"for an algebra with known generators",
[ IsAlgebra and HasGeneratorsOfAlgebra ],
function( A )
local nrgens;
nrgens := Length( GeneratorsOfAlgebra( A ) );
Print( "<algebra over ", LeftActingDomain( A ), ", with ",
Length( GeneratorsOfAlgebra( A ) ), " generators>" );
nrgens, " ", Pluralize( nrgens, "generator" ), ">" );
end );


Expand Down Expand Up @@ -2056,8 +2061,10 @@ InstallMethod( ViewObj,
"for an algebra-with-one with known generators",
[ IsAlgebraWithOne and HasGeneratorsOfAlgebraWithOne ],
function( A )
local nrgens;
nrgens := Length( GeneratorsOfAlgebraWithOne( A ) );
Print( "<algebra-with-one over ", LeftActingDomain( A ), ", with ",
Length( GeneratorsOfAlgebraWithOne( A ) ), " generators>" );
nrgens, " ", Pluralize( nrgens, "generator" ), ">" );
end );


Expand Down Expand Up @@ -2111,8 +2118,10 @@ InstallMethod( ViewObj,
"for a Lie algebra with known generators",
[ IsLieAlgebra and HasGeneratorsOfAlgebra ],
function( A )
local nrgens;
nrgens := Length( GeneratorsOfAlgebra( A ) );
Print( "<Lie algebra over ", LeftActingDomain( A ), ", with ",
Length( GeneratorsOfAlgebra( A ) ), " generators>" );
nrgens, " ", Pluralize( nrgens, "generator" ), ">" );
end );


Expand Down
4 changes: 2 additions & 2 deletions lib/alglie.gd
Original file line number Diff line number Diff line change
Expand Up @@ -772,7 +772,7 @@ DeclareOperation( "PthPowerImage", [ IsJacobianElement, IsInt ] );
## gap> L := JenningsLieAlgebra(SmallGroup(4,1)); # group C_4
## <Lie algebra of dimension 2 over GF(2)>
## gap> L0 := Subalgebra(L,GeneratorsOfAlgebra(L){[1]});
## <Lie algebra over GF(2), with 1 generators>
## <Lie algebra over GF(2), with 1 generator>
## gap> Dimension(L0);
## 1
## gap> PClosureSubalgebra(L0); last=L;
Expand Down Expand Up @@ -1468,7 +1468,7 @@ DeclareAttribute( "JenningsLieAlgebra", IsGroup );
## gap> List( [1,2,3], g.hom_components );
## [ <vector space over GF(3), with 3 generators>,
## <vector space over GF(3), with 2 generators>,
## <vector space over GF(3), with 1 generators> ]
## <vector space over GF(3), with 1 generator> ]
## ]]></Example>
## </Description>
## </ManSection>
Expand Down
4 changes: 2 additions & 2 deletions lib/algrep.gd
Original file line number Diff line number Diff line change
Expand Up @@ -677,9 +677,9 @@ DeclareAttribute( "FaithfulModule", IsAlgebra );
## gap> A:= Rationals^[3,3];;
## gap> V:= LeftAlgebraModuleByGenerators( A, \*, [ [ 1, 0, 0 ] ] );;
## gap> B:= Subalgebra( A, [ Basis(A)[1] ] );
## <algebra over Rationals, with 1 generators>
## <algebra over Rationals, with 1 generator>
## gap> W:= ModuleByRestriction( V, B );
## <left-module over <algebra over Rationals, with 1 generators>>
## <left-module over <algebra over Rationals, with 1 generator>>
## ]]></Example>
## </Description>
## </ManSection>
Expand Down
2 changes: 1 addition & 1 deletion lib/gprd.gd
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ DeclareGlobalFunction("SubdirectDiagonalPerms");
## gap> au:=AutomorphismGroup(n);;
## gap> au:=First(AsSet(au),i->Order(i)=3);;
## gap> au:=Group(au);
## <group with 1 generators>
## <group with 1 generator>
## gap> IsGroupOfAutomorphisms(au);
## true
## gap> SemidirectProduct(au,n);
Expand Down
21 changes: 11 additions & 10 deletions lib/grp.gi
Original file line number Diff line number Diff line change
Expand Up @@ -4396,26 +4396,27 @@ InstallMethod( ViewString,
"for a group with generators",
[ IsGroup and HasGeneratorsOfMagmaWithInverses ],
function( G )
if IsEmpty( GeneratorsOfMagmaWithInverses( G ) ) then
local nrgens;
nrgens := Length( GeneratorsOfMagmaWithInverses( G ) );
if nrgens = 0 then
return "<trivial group>";
else
return Concatenation("<group with ",
String( Length( GeneratorsOfMagmaWithInverses( G ) ) ),
" generators>");
fi;
return Concatenation("<group with ", String( nrgens ), " ",
Pluralize( nrgens, "generator" ), ">");
end );

InstallMethod( ViewString,
"for a group with generators and size",
[ IsGroup and HasGeneratorsOfMagmaWithInverses and HasSize],
function( G )
if IsEmpty( GeneratorsOfMagmaWithInverses( G ) ) then
local nrgens;
nrgens := Length(GeneratorsOfMagmaWithInverses( G ) );
if nrgens = 0 then
return "<trivial group>";
else
return Concatenation("<group of size ", String(Size(G))," with ",
String(Length( GeneratorsOfMagmaWithInverses( G ) )),
" generators>");
fi;
return Concatenation("<group of size ", String(Size(G))," with ",
String(nrgens), " ",
Pluralize(nrgens, "generator"), ">");
end );

InstallMethod( ViewObj, "for a group",
Expand Down
2 changes: 1 addition & 1 deletion lib/grpfp.gd
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ InstallTrueMethod(CanEasilyTestMembership, IsSubgroupFgGroup and IsWholeFamily);
## gap> IsFpGroup(g);
## true
## gap> h:=CyclicGroup(2);
## <pc group of size 2 with 1 generators>
## <pc group of size 2 with 1 generator>
## gap> IsFpGroup(h);
## false
## ]]></Example>
Expand Down
4 changes: 3 additions & 1 deletion lib/grpfp.gi
Original file line number Diff line number Diff line change
Expand Up @@ -5107,6 +5107,7 @@ end);
InstallMethod(ViewObj,"fp group",true,[IsSubgroupFpGroup],
10,# to override the pure `Size' method
function(G)
local nrgens;
if IsFreeGroup(G) then TryNextMethod();fi;
if IsGroupOfFamily(G) then
Print("<fp group");
Expand All @@ -5128,7 +5129,8 @@ function(G)
if G!.gensWordLengthSum <= GAPInfo.ViewLength * 30 then
Print(GeneratorsOfGroup(G));
else
Print("<",Length(GeneratorsOfGroup(G))," generators>");
nrgens := Length(GeneratorsOfGroup(G));
Print("<",nrgens," ",Pluralize(nrgens,"generator"),">");
fi;
else
Print("<fp, no generators known>");
Expand Down
Loading

0 comments on commit ce3c6a0

Please sign in to comment.