Skip to content

Commit

Permalink
Linting
Browse files Browse the repository at this point in the history
  • Loading branch information
james-d-mitchell committed Jan 23, 2024
1 parent 27aaea3 commit a27303e
Show file tree
Hide file tree
Showing 93 changed files with 4,344 additions and 5,571 deletions.
2 changes: 1 addition & 1 deletion PackageInfo.g
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

BindGlobal("_RecogsFunnyNameFormatterFunction",
function(st)
if Length(st) = 0 then
if IsEmpty(st) then
return st;
else
return Concatenation(" (", st, ")");
Expand Down
4 changes: 1 addition & 3 deletions gap/attributes/acting.gi
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@
InstallMethod(IsMultiplicativeZero,
"for an acting semigroup and element",
[IsActingSemigroup, IsMultiplicativeElement],
function(S, x)
return MultiplicativeZero(S) <> fail and x = MultiplicativeZero(S);
end);
{S, x} -> MultiplicativeZero(S) <> fail and x = MultiplicativeZero(S));

# same method for ideals

Expand Down
14 changes: 4 additions & 10 deletions gap/attributes/attr.gi
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,7 @@ function(S)
end);

InstallMethod(NrIdempotents, "for a semigroup", [IsSemigroup],
function(S)
return Length(Idempotents(S));
end);
S -> Length(Idempotents(S)));

InstallMethod(GroupOfUnits, "for a semigroup", [IsSemigroup],
function(S)
Expand Down Expand Up @@ -225,9 +223,7 @@ function(coll)
elif IsGeneratorsOfActingSemigroup(coll) then
deg := ActionDegree(coll);
Shuffle(coll);
Sort(coll, function(x, y)
return ActionRank(x, deg) > ActionRank(y, deg);
end);
Sort(coll, {x, y} -> ActionRank(x, deg) > ActionRank(y, deg));
fi;

out := EmptyPlist(Length(coll));
Expand Down Expand Up @@ -717,7 +713,7 @@ function(S)

D := MaximalDClasses(S)[1];

if not NrHClasses(D) = 1 or not IsRegularDClass(D) then
if NrHClasses(D) <> 1 or not IsRegularDClass(D) then
return fail;
fi;

Expand Down Expand Up @@ -1124,9 +1120,7 @@ end);
InstallMethod(TransposedMultiplicationTableWithCanonicalPositions,
"for a semigroup with CanUseFroidurePin",
[IsSemigroup and CanUseFroidurePin],
function(S)
return TransposedMat(MultiplicationTableWithCanonicalPositions(S));
end);
S -> TransposedMat(MultiplicationTableWithCanonicalPositions(S)));

InstallMethod(MinimalFaithfulTransformationDegree, "for a right zero semigroup",
[IsRightZeroSemigroup],
Expand Down
43 changes: 11 additions & 32 deletions gap/attributes/dual.gi
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ function(S)
if IsDualSemigroupRep(S) then
if HasGeneratorsOfSemigroup(S) then
return Semigroup(List(GeneratorsOfSemigroup(S),
x -> UnderlyingElementOfDualSemigroupElement(x)));
UnderlyingElementOfDualSemigroupElement));
fi;
ErrorNoReturn("this dual semigroup cannot be constructed ",
"without knowing generators");
Expand Down Expand Up @@ -91,13 +91,8 @@ function(S)
local dual, inv, iso;

dual := DualSemigroup(S);
iso := function(x)
return SEMIGROUPS.DualSemigroupElementNC(dual, x);
end;

inv := function(x)
return SEMIGROUPS.DualSemigroupElementNC(S, x);
end;
iso := x -> SEMIGROUPS.DualSemigroupElementNC(dual, x);
inv := x -> SEMIGROUPS.DualSemigroupElementNC(S, x);
return MappingByFunction(S, dual, iso, inv);
end);

Expand Down Expand Up @@ -147,37 +142,27 @@ end);
InstallMethod(Size, "for a dual semigroup",
[IsDualSemigroupRep],
10, # add rank to beat enumeration methods
function(S)
return Size(DualSemigroup(S));
end);
S -> Size(DualSemigroup(S)));

InstallMethod(AsList, "for a dual semigroup",
[IsDualSemigroupRep],
10, # add rank to beat enumeration methods
function(S)
return List(DualSemigroup(S), s -> SEMIGROUPS.DualSemigroupElementNC(S, s));
end);
S -> List(DualSemigroup(S), s -> SEMIGROUPS.DualSemigroupElementNC(S, s)));

InstallMethod(\*, "for dual semigroup elements",
IsIdenticalObj,
[IsDualSemigroupElement, IsDualSemigroupElement],
function(x, y)
return Objectify(FamilyObj(x)!.type, [y![1] * x![1]]);
end);
{x, y} -> Objectify(FamilyObj(x)!.type, [y![1] * x![1]]));

InstallMethod(\=, "for dual semigroup elements",
IsIdenticalObj,
[IsDualSemigroupElement, IsDualSemigroupElement],
function(x, y)
return x![1] = y![1];
end);
{x, y} -> x![1] = y![1]);

InstallMethod(\<, "for dual semigroup elements",
IsIdenticalObj,
[IsDualSemigroupElement, IsDualSemigroupElement],
function(x, y)
return x![1] < y![1];
end);
{x, y} -> x![1] < y![1]);

InstallMethod(ViewObj, "for dual semigroup elements",
[IsDualSemigroupElement], PrintObj);
Expand All @@ -204,27 +189,21 @@ end);
#
# InstallMethod(PrintString, "for dual semigroup elements",
# [IsDualSemigroupElement],
# function(x)
# return StringFormatted("<{!v} in the dual semigroup>", x![1]);
# end);
# x -> StringFormatted("<{!v} in the dual semigroup>", x![1]);
#
# InstallMethod(ViewString, "for a dual semigroup",
# [IsDualSemigroupRep], PrintString);
#
# InstallMethod(PrintString, "for a dual semigroup",
# [IsDualSemigroupRep],
# function(S)
# return StringFormatted("<dual semigroup of {!v}>", DualSemigroup(S));
# end);
# S -> StringFormatted("<dual semigroup of {!v}>", DualSemigroup(S));

InstallMethod(ChooseHashFunction, "for a dual semigroup element and int",
[IsDualSemigroupElement, IsInt],
function(x, data)
local H, hashfunc;

H := ChooseHashFunction(x![1], data);
hashfunc := function(a, b)
return H.func(a![1], b);
end;
hashfunc := {a, b} -> H.func(a![1], b);
return rec(func := hashfunc, data := H.data);
end);
27 changes: 9 additions & 18 deletions gap/attributes/homomorph.gi
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,8 @@ end);

InstallMethod(SemigroupHomomorphismByImages, "for two semigroups and one list",
[IsSemigroup, IsSemigroup, IsList],
function(S, T, imgs)
return SemigroupHomomorphismByImages(S, T, GeneratorsOfSemigroup(S), imgs);
end);
{S, T, imgs}
-> SemigroupHomomorphismByImages(S, T, GeneratorsOfSemigroup(S), imgs));

InstallMethod(SemigroupHomomorphismByImages, "for two semigroups",
[IsSemigroup, IsSemigroup],
Expand All @@ -146,9 +145,8 @@ end);

InstallMethod(SemigroupHomomorphismByImages, "for a semigroup and two lists",
[IsSemigroup, IsList, IsList],
function(S, gens, imgs)
return SemigroupHomomorphismByImages(S, Semigroup(imgs), gens, imgs);
end);
{S, gens, imgs}
-> SemigroupHomomorphismByImages(S, Semigroup(imgs), gens, imgs));

InstallMethod(SemigroupIsomorphismByImages, "for two semigroup and two lists",
[IsSemigroup, IsSemigroup, IsList, IsList],
Expand Down Expand Up @@ -180,9 +178,8 @@ end);

InstallMethod(SemigroupIsomorphismByImages, "for two semigroups and one list",
[IsSemigroup, IsSemigroup, IsList],
function(S, T, imgs)
return SemigroupIsomorphismByImages(S, T, GeneratorsOfSemigroup(S), imgs);
end);
{S, T, imgs}
-> SemigroupIsomorphismByImages(S, T, GeneratorsOfSemigroup(S), imgs));

InstallMethod(SemigroupIsomorphismByImages, "for two semigroups",
[IsSemigroup, IsSemigroup],
Expand All @@ -195,9 +192,7 @@ end);

InstallMethod(SemigroupIsomorphismByImages, "for a semigroup and two lists",
[IsSemigroup, IsList, IsList],
function(S, gens, imgs)
return SemigroupIsomorphismByImages(S, Semigroup(imgs), gens, imgs);
end);
{S, gens, imgs} -> SemigroupIsomorphismByImages(S, Semigroup(imgs), gens, imgs));

InstallMethod(SemigroupHomomorphismByImages_NC,
"for two semigroups and two lists",
Expand Down Expand Up @@ -337,15 +332,11 @@ hom -> SemigroupIsomorphismByFunctionNC(Source(hom),
# Methods for SHBI/SIBI/SHBF
InstallMethod(IsSurjective, "for a semigroup homomorphism",
[IsSemigroupHomomorphismByImagesOrFunction],
function(hom)
return Size(ImagesSource(hom)) = Size(Range(hom));
end);
{hom} -> Size(ImagesSource(hom)) = Size(Range(hom)));

InstallMethod(IsInjective, "for a semigroup homomorphism",
[IsSemigroupHomomorphismByImagesOrFunction],
function(hom)
return Size(Source(hom)) = Size(ImagesSource(hom));
end);
{hom} -> Size(Source(hom)) = Size(ImagesSource(hom)));

InstallMethod(ImagesSet, "for a semigroup homom. and list of elements",
[IsSemigroupHomomorphismByImagesOrFunction, IsList],
Expand Down
8 changes: 2 additions & 6 deletions gap/attributes/inverse.gi
Original file line number Diff line number Diff line change
Expand Up @@ -531,9 +531,7 @@ function(S, f)
rank := ActionRank(S);
SortBy(elts, rank);
else
rank := function(x, y)
return IsGreensDGreaterThanFunc(S)(y, x);
end;
rank := {x, y} -> IsGreensDGreaterThanFunc(S)(y, x);
Sort(elts, rank);
fi;

Expand Down Expand Up @@ -707,6 +705,4 @@ InstallMethod(InversesOfSemigroupElementNC,
"for an inverse semigroup and a multiplicative element",
[IsInverseSemigroup and IsGeneratorsOfInverseSemigroup,
IsMultiplicativeElement], SUM_FLAGS,
function(S, elm)
return [elm ^ -1];
end);
{_, elm} -> [elm ^ -1]);
12 changes: 3 additions & 9 deletions gap/attributes/isomorph.gi
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,7 @@ function(S)
return (lit[1] - 1) * n ^ 2 + (lit[2] - 1) * n + lit[3];
end;

DiagonalToLits := function(diag, n)
return List([1 .. n], i -> NumLit([i, i, diag[i]], n));
end;
DiagonalToLits := {diag, n} -> List([1 .. n], i -> NumLit([i, i, diag[i]], n));

TableToLits := function(table, n)
local literals, val, i, j;
Expand All @@ -87,9 +85,7 @@ function(S)
return table;
end;

OnLiterals := n -> function(ln, pi)
return NumLit(OnTuples(LitNum(ln, n), pi), n);
end;
OnLiterals := n -> {ln, pi} -> NumLit(OnTuples(LitNum(ln, n), pi), n);

# for not too big semigroups...
n := Size(S);
Expand All @@ -109,9 +105,7 @@ end);

InstallMethod(IsIsomorphicSemigroup, "for semigroups",
[IsSemigroup, IsSemigroup],
function(S, T)
return IsomorphismSemigroups(S, T) <> fail;
end);
{S, T} -> IsomorphismSemigroups(S, T) <> fail);

InstallMethod(IsomorphismSemigroups, "for finite simple semigroups",
[IsSimpleSemigroup and IsFinite, IsSimpleSemigroup and IsFinite],
Expand Down
19 changes: 11 additions & 8 deletions gap/attributes/isorms.gd
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,17 @@
#############################################################################
##

DeclareCategory("IsRMSIsoByTriple", IsGeneralMapping and IsSPGeneralMapping
and IsTotal and IsSingleValued and
IsInjective and IsSurjective and
IsAttributeStoringRep);
DeclareCategory("IsRZMSIsoByTriple", IsGeneralMapping and IsSPGeneralMapping
and IsTotal and IsSingleValued and
IsInjective and IsSurjective and
IsAttributeStoringRep);
DeclareCategory("IsRMSOrRZMSIsoByTriple",
IsGeneralMapping
and IsSPGeneralMapping
and IsTotal
and IsSingleValued
and IsInjective
and IsSurjective
and IsAttributeStoringRep);

DeclareCategory("IsRMSIsoByTriple", IsRMSOrRZMSIsoByTriple);
DeclareCategory("IsRZMSIsoByTriple", IsRMSOrRZMSIsoByTriple);

DeclareOperation("RMSIsoByTriple", [IsReesMatrixSemigroup,
IsReesMatrixSemigroup,
Expand Down
Loading

0 comments on commit a27303e

Please sign in to comment.