Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SingularClosurePartitionSemigroup #690

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions PackageInfo.g
Original file line number Diff line number Diff line change
Expand Up @@ -303,9 +303,10 @@ Dependencies := rec(
GAP := ">=4.9.0",
NeededOtherPackages := [["orb", ">=4.8.2"],
["io", ">=4.5.1"],
["digraphs", ">=1.0.0"],
["digraphs", ">=1.3.0"],
["genss", ">=1.6.5"],
["images", ">=1.3.0"]],
["images", ">=1.3.0"],
["datastructures", ">=0.2.5"]],
SuggestedOtherPackages := [["gapdoc", ">=1.5.1"]],

ExternalConditions := []),
Expand Down
12 changes: 12 additions & 0 deletions doc/semitrans.xml
Original file line number Diff line number Diff line change
Expand Up @@ -376,3 +376,15 @@ gap> Size(WW);
</Description>
</ManSection>
<#/GAPDoc>

<#GAPDoc Label="SingularClosurePartitionSemigroup">
<ManSection>
<Oper Name="SingularClosurePartitionSemigroupSemigroup " Arg="G,n"/>
<Returns>A Partition monoid which contains all singular Partitions.</Returns>
<Description>
When <A>G</A> is a subgroup of the symmertic group on <A>n</A> points then
this returns the least, by containment, Partition monoid of degree
<A>n</A> which contains <A>G</A> and all singular Partitions.
</Description>
</ManSection>
<#/GAPDoc>
3 changes: 3 additions & 0 deletions gap/semigroups/semitrans.gd
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,6 @@ DeclareAttribute("DigraphCore", IsDigraph);
DeclareOperation("WreathProduct",
[IsMultiplicativeElementCollection,
IsMultiplicativeElementCollection]);

DeclareOperation("SingularClosurePartitionSemigroup",
[IsGroup, IsPosInt]);
127 changes: 127 additions & 0 deletions gap/semigroups/semitrans.gi
Original file line number Diff line number Diff line change
Expand Up @@ -691,6 +691,133 @@ function(M, S)
return Semigroup(maps);
end);

InstallMethod(SingularClosurePartitionSemigroup,
" for permutation group and degree", [IsGroup, IsPosInt],
function(G, n)
local D, id, f, o, O, d, I, J, K, L, N, e, q, i,
Digo, nlc, v, E, j, k, M, gcount, g;

# Digraph with nodes {1, .., n} and an edge from x to y if there exists g in
# G such that g(x) = y.
D := Digraph([1 .. n], {x, y} -> ForAny(G, g -> x ^ g = y));
# List such that if v is vertex in digraph D, then id[v] is the index of the
# strongly connected component of D containing v
id := DigraphStronglyConnectedComponents(D).id;
# Takes a pair [i, j] and returns the pair consisting of the index of the scc
# of D containing i and the index of the scc of D containing j.
f := pair -> [id[pair[1]], id[pair[2]]];
# Compute the orbits of G on pairs
o := Orbits(G, Combinations([1 .. n], 2), OnSets);
# List(o, x -> f(x[1])) apply the function f (above) to one representative
# from every orbit of o, and create the digraph with these edges.
O := DigraphByEdges(List(o, x -> f(x[1])));
# removes loops to count number of non loops
d := DigraphNrEdges(DigraphRemoveLoops(O));
# calculate number of digraph vertices
v := DigraphNrVertices(O);
g := Size(Generators(G));
# special case for if quoteient is a point
e := DigraphNrEdges(O);
N := [1 .. (2 * e) + g];
if v = 1 then
for i in [1 .. DigraphNrEdges(O)] do
K := o[i][1][1];
L := o[i][1][2];
N[2 * i] := AsBipartition(Transformation([K], [L]), n);
od;
# cases are if only 1 non loop and otherweise
elif d = 1 then
e := DigraphNrEdges(O);
N := [1 .. (2 * e) + 2 + g];
for i in [1 .. DigraphNrEdges(O)] do
if DigraphEdges(O)[i][1] = DigraphEdges(O)[i][2] then
K := o[i][1][1];
L := o[i][1][2];
N[2 * i] := AsBipartition(Transformation([K], [L]), n);
else
q := i;
fi;
od;
I := o[q][1][1];
J := o[q][1][2];
K := o[q][2][2];
N[2 * (q)] := AsBipartition(Transformation([J], [I]), n);
N[2 * e + 2] := AsBipartition(Transformation([I, J], [J, K]), n);
# second case as StrongOrientation function
# only works on graphs with more vertex than 2
elif d = 2 then
e := DigraphNrEdges(O);
N := [1 .. (2 * e) + g];
nlc := 0;
for i in [1 .. DigraphNrEdges(O)] do
if DigraphEdges(O)[i][1] = DigraphEdges(O)[i][2] then
K := o[i][1][1];
L := o[i][1][2];
elif nlc < 1 then
K := (o)[i][1][1];
L := (o)[i][1][2];
nlc := nlc + 1;
else
K := (o)[i][1][2];
L := (o)[i][1][1];
fi;
N[2 * i] := AsBipartition(Transformation([K], [L]), n);
od;
else
e := DigraphNrEdges(O);
N := [1 .. (2 * e) + g];
Digo := StrongOrientation(DigraphSymmetricClosure(O));
for i in [1 .. DigraphNrEdges(O)] do
if DigraphEdges(O)[i][1] = DigraphEdges(O)[i][2] then
K := o[i][1][1];
L := o[i][1][2];
elif DigraphEdges(O)[i][1] in DigraphEdges(Digo) then
K := o[i][1][1];
L := o[i][1][2];
else
K := o[i][1][2];
L := o[i][1][1];
fi;
# using these start and end point values construct
# a transfomarion which is constant on that edge
N[2 * i] := AsBipartition(Transformation([K], [L]), n);
od;
fi;
if d = 1 then
for i in [1 .. DigraphNrEdges(O) + 1] do
E := ExtRepOfObj(N[2 * i]);
M := [1 .. Size(E)];
for j in [1 .. Size(E)] do
M[j] := ShallowCopy(E[j]);
od;
for j in [1 .. Size(E)] do
for k in [1 .. Size(E[j])] do
M[j][k] := - E[j][k];
od;
od;
N[(2 * i) - 1] := Bipartition(M);
od;
else
for i in [1 .. DigraphNrEdges(O)] do
E := ExtRepOfObj(N[2 * i]);
M := [1 .. Size(E)];
for j in [1 .. Size(E)] do
M[j] := ShallowCopy(E[j]);
od;
for j in [1 .. Size(E)] do
for k in [1 .. Size(E[j])] do
M[j][k] := - E[j][k];
od;
od;
N[(2 * i) - 1] := Bipartition(M);
od;
fi;
for gcount in [1 .. Size(Generators(G))] do
N[Size(N) - gcount + 1] := AsBipartition(Generators(G)[gcount], n);
od;
return Semigroup(N);
end);

#############################################################################
# ?. Isomorphisms
#############################################################################
Expand Down
5 changes: 1 addition & 4 deletions scripts/travis-build-dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,10 @@ CURL="curl --connect-timeout 5 --max-time 10 --retry 5 --retry-delay 0 --retry-m

################################################################################
# Install digraphs, genss, io, orb, images, and profiling
PKGS=( "digraphs" "genss" "io" "orb" "images")
PKGS=( "digraphs" "genss" "io" "orb" "images" "datastructures" )
if [ "$SUITE" == "coverage" ]; then
PKGS+=( "profiling" )
fi
if [ "$PACKAGES" == "latest" ]; then
PKGS+=( "datastructures" )
fi

for PKG in "${PKGS[@]}"; do
cd $GAPROOT/pkg
Expand Down
18 changes: 18 additions & 0 deletions tst/standard/semitrans.tst
Original file line number Diff line number Diff line change
Expand Up @@ -2776,6 +2776,24 @@ true
gap> Transformation([2, 1, 4, 3, 6, 5, 6, 5, 7, 8]) in WW;
false

# SingularClosurePartitionSemigroup
gap> S := SingularClosurePartitionSemigroup(Group((1, 2)(3, 4)), 4);
<bipartition semigroup of degree 4 with 9 generators>
gap> Size(S) = Bell(2 * 4) - Factorial(4) + 2;
true
gap> S := SingularClosurePartitionSemigroup(Group((1, 2), (3, 4)), 4);
<bipartition semigroup of degree 4 with 10 generators>
gap> Size(S) = Bell(2 * 4) - Factorial(4) + 4;
true
gap> S := SingularClosurePartitionSemigroup(SymmetricGroup(4), 4);
<bipartition semigroup of degree 4 with 4 generators>
gap> Size(S) = Bell(2 * 4);
true
gap> S := SingularClosurePartitionSemigroup(Group((1, 2)), 4);
<bipartition semigroup of degree 4 with 9 generators>
gap> Size(S) = Bell(2 * 4) - Factorial(4) + 2;
true

# DigraphCore
gap> D := CompleteBipartiteDigraph(4, 4);
<immutable complete bipartite digraph with bicomponent sizes 4 and 4>
Expand Down