Skip to content
Open
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
9 changes: 9 additions & 0 deletions gap/congruences/congsemigraph.gd
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,12 @@ DeclareOperation("MinimalHereditarySubsetsVertex",
[IsGraphInverseSemigroup, IsPosInt]);

DeclareAttribute("GeneratingCongruencesOfLattice", IsGraphInverseSemigroup);

DeclareCategory("IsTraceOfCongruenceByWangPair",
IsSemigroupCongruence
and CanComputeEquivalenceRelationPartition
and IsMagmaCongruence
and IsAttributeStoringRep
and IsFinite);

DeclareAttribute("TraceOfCongruenceByWangPair", IsCongruenceByWangPair);
104 changes: 103 additions & 1 deletion gap/congruences/congsemigraph.gi
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
############################################################################
##
## congsemigraph.gi
## Copyright (C) 2022 Marina Anagnostopoulou-Merkouri
## Copyright (C) 2022-2026 Marina Anagnostopoulou-Merkouri
## James Mitchell
## Joseph Ward
##
## Licensing information can be found in the README file of this package.
##
Expand Down Expand Up @@ -287,3 +288,104 @@ InstallMethod(TrivialCongruence,
"for a graph inverse semigroup",
[IsGraphInverseSemigroup],
S -> AsCongruenceByWangPair(SemigroupCongruence(S, [])));

InstallMethod(TraceOfCongruenceByWangPair,
"for a congruence by Wang pair",
[IsCongruenceByWangPair],
function(cong)
local S, fam, tr;

S := IdempotentGeneratedSubsemigroup(Source(cong));

fam := GeneralMappingsFamily(ElementsFamily(FamilyObj(S)),
ElementsFamily(FamilyObj(S)));
tr := Objectify(NewType(fam, IsTraceOfCongruenceByWangPair),
rec(cong := cong));
SetSource(tr, S);
SetRange(tr, S);
return tr;
end);

InstallMethod(ViewObj, "for trace of a congruence by Wang pair",
[IsTraceOfCongruenceByWangPair],
function(tr)
Print(ViewString(tr));
end);

InstallMethod(ViewString, "for a congruence by Wang pair",
[IsTraceOfCongruenceByWangPair],
function(tr)
return StringFormatted(
"<trace of graph inverse semigroup congruence with H = {} and W = {}>",
ViewString(tr!.cong!.H),
ViewString(tr!.cong!.W));
end);

# TODO write an explanation of what the next function implements
# TODO add more examples
InstallMethod(CongruenceTestMembershipNC,
"for the trace of a congruence by Wang pair",
[IsTraceOfCongruenceByWangPair,
IsGraphInverseSemigroupElement,
IsGraphInverseSemigroupElement],
function(tr, elm1, elm2)
local p1, p2, range_elm1_in_H, range_elm2_in_H, tmp, S, e, i;

if elm1 = elm2 then
return true;
fi;

p1 := PositivePath(elm1);
p2 := PositivePath(elm2);

range_elm1_in_H := IsMultiplicativeZero(Source(tr), elm1)
or IndexOfVertexOfGraphInverseSemigroup(Range(p1)) in tr!.cong!.H;
range_elm2_in_H := IsMultiplicativeZero(Source(tr), elm2)
or IndexOfVertexOfGraphInverseSemigroup(Range(p2)) in tr!.cong!.H;

if range_elm1_in_H or range_elm2_in_H then
return range_elm1_in_H and range_elm2_in_H;
elif Source(elm1) <> Source(elm2) or Range(elm1) <> Range(elm2) then
return false;
fi;
if Length(p1![1]) > Length(p2![1]) then
tmp := p1;
p1 := p2;
p2 := tmp;
fi;

for i in [1 .. Length(p1![1])] do
if p1![1][i] <> p2![1][i] then
return false;
fi;
od;

S := Source(tr!.cong);
for i in [Length(p1![1]) .. Length(p2![1])] do
e := EdgesOfGraphInverseSemigroup(S)[p2![1][i]];
if not IndexOfVertexOfGraphInverseSemigroup(Source(e)) in tr!.cong!.W then
return false;
fi;
od;

return true;
end);

# TODO add family check to install method below
InstallMethod(ImagesElm,
"for the trace of a congruence by Wang pair and an element",
[IsTraceOfCongruenceByWangPair, IsGraphInverseSemigroupElement],
function(tr, x)

if not IsIdempotent(x) then
Error("TODO");
elif not x in Source(tr) then
# TODO if family check done above then remove this clause.
Error("TODO");
fi;

#TODO


end);

4 changes: 4 additions & 0 deletions gap/semigroups/semigraph.gd
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ DeclareAttribute("Source", IsGraphInverseSemigroupElement);

DeclareOperation("IsVertex", [IsGraphInverseSemigroupElement]);

DeclareAttribute("PositivePath", IsGraphInverseSemigroupElement);
DeclareAttribute("NegativePath", IsGraphInverseSemigroupElement);
# TODO IsEdge?

InstallTrueMethod(IsGeneratorsOfInverseSemigroup,
IsGraphInverseSemigroupElementCollection);

Expand Down
26 changes: 26 additions & 0 deletions gap/semigroups/semigraph.gi
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
#############################################################################
##

# TODO: Implement special methods for:
# * NrIdempotents
# * IdempotentGeneratedSubsemigroup

InstallMethod(AsMonoid, "for a graph inverse semigroup",
[IsGraphInverseSemigroup], ReturnFail);

Expand Down Expand Up @@ -302,3 +306,25 @@ InstallMethod(IsWholeFamily,
"for a subsemigroup of a graph inverse semigroup",
[IsGraphInverseSubsemigroup],
S -> Size(ElementsFamily(FamilyObj(S))!.semigroup) = Size(S));

InstallMethod(PositivePath,
"for a graph inverse semigroup element",
[IsGraphInverseSemigroupElement],
function(elt)
local pos, S;

pos := PositionProperty(elt![1], IsNegInt);
if pos = fail then
return elt;
elif pos = 1 then
return Source(elt);
fi;
# Get the semigroup containing "elt"
S := FamilyObj(elt)!.semigroup;
return EvaluateWord(GeneratorsOfSemigroup(S), elt![1]{[1 .. pos - 1]});
end);

InstallMethod(NegativePath,
"for a graph inverse semigroup element",
[IsGraphInverseSemigroupElement],
elt -> PositivePath(elt ^ -1) ^ -1);
20 changes: 20 additions & 0 deletions tst/standard/semigroups/semigraph.tst
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,26 @@ false
gap> G.1 = H.1;
false

# Positive/NegativePath
gap> D := ChainDigraph(4);
<immutable chain digraph with 4 vertices>
gap> S := GraphInverseSemigroup(D);
<finite graph inverse semigroup with 4 vertices, 3 edges>
gap> x := S.2 * S.3 * S.3 ^ -1 * S.2 ^ -1 * S.1 ^ -1;
e_2e_3e_3^-1e_2^-1e_1^-1
gap> NegativePath(x);
e_3^-1e_2^-1e_1^-1
gap> x = PositivePath(x) * NegativePath(x);
true
gap> Size(S);
31
gap> ForAll(S, x -> x = PositivePath(x) * NegativePath(x));
true
gap> PositivePath(MultiplicativeZero(S));
0
gap> NegativePath(MultiplicativeZero(S));
0

#
gap> SEMIGROUPS.StopTest();
gap> STOP_TEST("Semigroups package: standard/semigroups/semigraph.tst");
Loading