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 15, 2024
1 parent 7a9dee1 commit 4574457
Show file tree
Hide file tree
Showing 8 changed files with 83 additions and 110 deletions.
48 changes: 23 additions & 25 deletions PackageInfo.g
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
#############################################################################
##
#W PackageInfo.g Smallsemi - a GAP library of semigroups
#Y Copyright (C) 2008-2015 Andreas Distler & James D. Mitchell
## PackageInfo.g Smallsemi - a GAP library of semigroups
## Copyright (C) 2008-2015 Andreas Distler & James D. Mitchell
##
## Licensing information can be found in the README file of this package.
##
#############################################################################
##

SetPackageInfo( rec(
SetPackageInfo(rec(
PackageName := "Smallsemi",
Subtitle := "A library of small semigroups",
Version := "0.6.13",
Date := "28/02/2022", # this is in dd/mm/yyyy format
Date := "28/02/2022", # this is in dd/mm/yyyy format
License := "GPL-3.0-or-later",

Persons := [
Expand All @@ -21,34 +21,34 @@ Persons := [
IsAuthor := true,
IsMaintainer := false,
Email := "a.distler@tu-bs.de",
),
),
rec(
LastName := "Mitchell",
FirstNames := "James",
IsAuthor := true,
IsMaintainer := true,
Email := "jdm3@st-and.ac.uk",
WWWHome := "http://tinyurl.com/jdmitchell",
PostalAddress := Concatenation( [
PostalAddress := Concatenation([
"Mathematical Institute\n", "North Haugh\n",
"St Andrews\n", "Fife\n", "KY16 9SS\n", "Scotland"] ),
"St Andrews\n", "Fife\n", "KY16 9SS\n", "Scotland"]),
Place := "St Andrews",
Institution := "University of St Andrews"
)
)
],
Status := "deposited",

PackageWWWHome := "https://gap-packages.github.io/smallsemi/",
README_URL := Concatenation( ~.PackageWWWHome, "README" ),
PackageInfoURL := Concatenation( ~.PackageWWWHome, "PackageInfo.g" ),
README_URL := Concatenation(~.PackageWWWHome, "README"),
PackageInfoURL := Concatenation(~.PackageWWWHome, "PackageInfo.g"),
SourceRepository := rec(
Type := "git",
URL := "https://github.com/gap-packages/smallsemi",
),
IssueTrackerURL := Concatenation( ~.SourceRepository.URL, "/issues" ),
ArchiveURL := Concatenation( ~.SourceRepository.URL,
IssueTrackerURL := Concatenation(~.SourceRepository.URL, " / issues"),
ArchiveURL := Concatenation(~.SourceRepository.URL,
"/releases/download/v", ~.Version,
"/smallsemi-", ~.Version ),
" / smallsemi -", ~.Version),
ArchiveFormats := ".tar.gz",

AbstractHTML :=
Expand All @@ -73,25 +73,24 @@ Dependencies := rec(
["gzip is needed in standard location if data files are used uncompressed"]),
AvailabilityTest := ReturnTrue,
BannerString := Concatenation(
ListWithIdenticalEntries(SizeScreen()[1]-3, '-'), "\n", ~.PackageName,
ListWithIdenticalEntries(SizeScreen()[1] - 3, '-'), "\n", ~.PackageName,
" - ", ~.Subtitle, "\n",
"by ", ~.Persons[1].FirstNames, " ", ~.Persons[1].LastName,
" & " , ~.Persons[2].FirstNames, " ", ~.Persons[2].LastName, "\n",
"For contents, type: ?Smallsemi:\n" ,
" & ", ~.Persons[2].FirstNames, " ", ~.Persons[2].LastName, "\n",
"For contents, type: ?Smallsemi:\n",
"Loading ", ~.PackageName, " ", ~.Version, " ...\n",
ListWithIdenticalEntries(SizeScreen()[1]-3, '-'), "\n" ),
ListWithIdenticalEntries(SizeScreen()[1] - 3, '-'), "\n"),
TestFile := "tst/testall.g",
Keywords := ["small semigroups", "data library", "multiplication tables"],

AutoDoc := rec(
entities := rec(
VERSION := ~.Version,
ARCHIVENAME := Remove( SplitString( ~.ArchiveURL, "/" ) ),
),
ARCHIVENAME := Remove(SplitString(~.ArchiveURL, " / "))),
TitlePage := rec(
Version := Concatenation( "Version ", ~.Version ),
Version := Concatenation("Version ", ~.Version),
Copyright := """
&copyright; 2008-19 A. Distler &amp; J. D. Mitchell.<P/>
&copyright; 2008-24 A. Distler &amp; J. D. Mitchell.<P/>
<Package>Smallsemi</Package> is free software: you can
redistribute it and/or modify it under the terms of the GNU
Expand All @@ -116,7 +115,8 @@ AutoDoc := rec(
Colophon := """
If you find any bugs or have any suggestions or comments, we would
very much appreciate it if you would let us know via our
issue tracker (see <URL>https://github.com/gap-packages/smallsemi/issues</URL>).
issue tracker (see
<URL>https://github.com/gap-packages/smallsemi/issues</URL>).
""",

Acknowledgements := """
Expand All @@ -127,8 +127,6 @@ AutoDoc := rec(
The first author acknowledges financial support of the University
of St Andrews. The second author acknowledges support of EPSRC
grant number GR/S/56085/01.
""",
),
"""),
),
));

6 changes: 2 additions & 4 deletions gap/enums.gi
Original file line number Diff line number Diff line change
Expand Up @@ -686,7 +686,7 @@ function(arg...)
repeat
i := i + 2;
stored := STORED_INFO(sizes[j], NAME_FUNC(enum[i]));
if not stored = fail then
if stored <> fail then
if enum[i + 1] = true then
IntersectSet(positions[j], stored);
elif enum[i + 1] = false then
Expand Down Expand Up @@ -903,10 +903,8 @@ function(arg...)
out := [arg[1]];

for i in [2, 4 .. Length(arg) - 1] do

pos1 := PositionProperty(SMALLSEMI_EQUIV, x -> [arg[i], arg[i + 1]] = x[1]);

if not pos1 = fail then
if pos1 <> fail then
out := Concatenation(out, SMALLSEMI_EQUIV[pos1][2]);
elif not (arg[i] in SMALLSEMI_ALWAYS_FALSE and not arg[i + 1]) then
out := Concatenation(out, [arg[i], arg[i + 1]]);
Expand Down
37 changes: 12 additions & 25 deletions gap/greensstar.gi
Original file line number Diff line number Diff line change
Expand Up @@ -130,44 +130,31 @@ end);

### AD The following methods should probably be installed for ViewString

# AD This is overwritten by the method for LeftSemigroupCongruence
InstallMethod(ViewObj, "for Green's R*-relation", [IsRStarRelation],
16, # to beat IsLeftSemigroupCongruence
function(obj)
Print(" <R*-relation on ");
BindGlobal("SMALLSEMI_ViewStarRelation",
function(obj, type)
Print("<", type, "*-relation on ");
ViewObj(Source(obj));
Print(">");
end);

# AD This is overwritten by the method for LeftSemigroupCongruence
InstallMethod(ViewObj, "for Green's R*-relation", [IsRStarRelation],
16, # to beat IsLeftSemigroupCongruence
obj -> SMALLSEMI_ViewStarRelation(obj, "R"));

# AD This is overwritten by the method for RightSemigroupCongruence
InstallMethod(ViewObj, "for Green's L*-relation", [IsLStarRelation],
16, # to beat IsRightSemigroupCongruence
function(obj)
Print("<L*-relation on ");
ViewObj(Source(obj));
Print(">");
end);
obj -> SMALLSEMI_ViewStarRelation(obj, "L"));

InstallMethod(ViewObj, "for Green's J*-relation", [IsJStarRelation],
function(obj)
Print("<J*-relation on ");
ViewObj(Source(obj));
Print(">");
end);
obj -> SMALLSEMI_ViewStarRelation(obj, "J"));

InstallMethod(ViewObj, "for Green's D*-relation", [IsDStarRelation],
function(obj)
Print("<D*-relation on ");
ViewObj(Source(obj));
Print(">");
end);
obj -> SMALLSEMI_ViewStarRelation(obj, "D"));

InstallMethod(ViewObj, "for Green's H*-relation", [IsHStarRelation],
function(obj)
Print("<H*-relation on ");
ViewObj(Source(obj));
Print(">");
end);
obj -> SMALLSEMI_ViewStarRelation(obj, "H"));

InstallMethod(\=, "for starred Green's relations", IsIdenticalObj,
[IsStarRelation and IsEquivalenceRelation,
Expand Down
3 changes: 3 additions & 0 deletions gap/properties.gd
Original file line number Diff line number Diff line change
Expand Up @@ -396,3 +396,6 @@ DeclareProperty("IsSemigroupWithoutClosedIdempotents", IsSmallSemigroup);
# </ManSection>
# <#/GAPDoc>
DeclareGlobalFunction("STORED_INFO");

DeclareGlobalFunction("SMALLSEMI_TableToLiterals");
DeclareGlobalFunction("SMALLSEMI_OnLiterals");
47 changes: 26 additions & 21 deletions gap/properties.gi
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,30 @@ function(S)
return false;
end);

InstallGlobalFunction(SMALLSEMI_TableToLiterals,
function(table, n, NumLit)
local i, j, literals, val;
literals := [];
for i in [1 .. n] do
for j in [1 .. n] do
val := table[i][j];
Add(literals, NumLit([i, j, val], n));
od;
od;
return literals;
end);

InstallGlobalFunction(SMALLSEMI_OnLiterals,
{n, LitNum, NumLit} -> function(ln, pi)
local lit, imlit;
lit := LitNum(ln, n);
imlit := OnTuples(lit, pi);
if (n + 1) ^ pi = n + 2 then
imlit := Permuted(imlit, (1, 2));
fi;
return NumLit(imlit, n);
end);

InstallMethod(IsSelfDualSemigroup, "for a small semigroup",
[IsSmallSemigroup],
function(S)
Expand All @@ -484,27 +508,8 @@ function(S)
return val + (row - 1) * n ^ 2 + (col - 1) * n;
end;

tbl2lits := function(table, n)
local i, j, literals, val;
literals := [];
for i in [1 .. n] do
for j in [1 .. n] do
val := table[i][j];
Add(literals, NumLit([i, j, val], n));
od;
od;
return literals;
end;

onLiterals := n -> function(ln, pi)
local lit, imlit;
lit := LitNum(ln, n);
imlit := OnTuples(lit, pi);
if (n + 1) ^ pi = n + 2 then
imlit := Permuted(imlit, (1, 2));
fi;
return NumLit(imlit, n);
end;
tbl2lits := {table, n} -> SMALLSEMI_TableToLiterals(table, n, NumLit);
onLiterals := n -> SMALLSEMI_OnLiterals(n, LitNum, NumLit);

n := Size(S);
vals := STORED_INFO(n, "IsSelfDualSemigroup");
Expand Down
30 changes: 5 additions & 25 deletions gap/small.gi
Original file line number Diff line number Diff line change
Expand Up @@ -41,37 +41,17 @@ function(S)
QuoInt((ln - 1) mod n ^ 2, n) + 1, (ln - 1) mod n + 1];
end;

NumLit := {lit, n} -> (lit[1] - 1) * n ^ 2 + (lit[2] - 1) * n + lit[3];
diag2lits := {diag, n} -> List([1 .. n], i -> NumLit([i, i, diag[i]], n));

tbl2lits := function(table, n)
local i, j, literals, val;
literals := [];
for i in [1 .. n] do
for j in [1 .. n] do
val := table[i][j];
Add(literals, NumLit([i, j, val], n));
od;
od;
return literals;
end;

onLiterals := n -> function(ln, pi)
local lit, imlit;
lit := LitNum(ln, n);
imlit := OnTuples(lit, pi);
if (n + 1) ^ pi = n + 2 then
imlit := Permuted(imlit, (1, 2));
fi;
return NumLit(imlit, n);
end;
NumLit := {lit, n} -> (lit[1] - 1) * n ^ 2 + (lit[2] - 1) * n + lit[3];
diag2lits := {diag, n} -> List([1 .. n], i -> NumLit([i, i, diag[i]], n));
tbl2lits := {table, n} -> SMALLSEMI_TableToLiterals(table, n, NumLit);
onLiterals := n -> SMALLSEMI_OnLiterals(n, LitNum, NumLit);

is3nilpotent := function(table)
local n, zero, entries, i;

n := Size(table);
zero := First([1 .. n], i -> table[i] = ListWithIdenticalEntries(n, i)
and table{[1 .. n]}[i] = ListWithIdenticalEntries(n, i));
and table{[1 .. n]}[i] = ListWithIdenticalEntries(n, i));
if zero = fail then
return false;
else
Expand Down
4 changes: 2 additions & 2 deletions gap/utils.gd
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#############################################################################
##
#W utils.gd Smallsemi - a GAP library of semigroups
#Y Copyright (C) 2008-2012 Andreas Distler & James D. Mitchell
## utils.gd Smallsemi - a GAP library of semigroups
## Copyright (C) 2008-2024 Andreas Distler & James D. Mitchell
##
## Licensing information can be found in the README file of this package.
##
Expand Down
18 changes: 10 additions & 8 deletions gap/utils.gi
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#############################################################################
##
#W utils.gi Smallsemi - a GAP library of semigroups
#Y Copyright (C) 2008-2014 Andreas Distler & James D. Mitchell
## utils.gi Smallsemi - a GAP library of semigroups
## Copyright (C) 2008-2024 Andreas Distler & James D. Mitchell
##
## Licensing information can be found in the README file of this package.
##
Expand All @@ -14,18 +14,20 @@ function()
record := rec();
record.InfoWarningLevel := InfoLevel(InfoWarning);
SetInfoLevel(InfoWarning, 0);
Read(Filename(DirectoriesPackageLibrary("smallsemi","tst"),"testall.g"));;
Read(Filename(DirectoriesPackageLibrary("smallsemi", "tst"), "testall.g"));
SetInfoLevel(InfoWarning, record.InfoWarningLevel);
return;
end);

InstallGlobalFunction(SmallsemiManualExamples,
function()
return ExtractExamples(DirectoriesPackageLibrary("smallsemi","doc"),
"smallsemi.xml", [ "data.xml", "examples.xml", "intro.xml",
"../gap/3nil.gd", "../gap/coclass.gd", "../gap/enums.gd", "../gap/greensstar.gd",
"../gap/properties.gd", "../gap/small.gd", "../gap/autovars.g",
"../PackageInfo.g" ], "Single");
return ExtractExamples(DirectoriesPackageLibrary("smallsemi", "doc"),
"smallsemi.xml",
["data.xml", "examples.xml", "intro.xml",
"../gap/3nil.gd", "../gap/coclass.gd",
"../gap/enums.gd", "../gap/greensstar.gd",
"../gap/properties.gd", "../gap/small.gd",
"../gap/autovars.g", "../PackageInfo.g"], "Single");
end);

InstallGlobalFunction(SmallsemiTestManualExamples,
Expand Down

0 comments on commit 4574457

Please sign in to comment.