Skip to content

Commit

Permalink
congsemigraph: add meet method
Browse files Browse the repository at this point in the history
  • Loading branch information
james-d-mitchell committed Jun 15, 2022
1 parent 256410a commit b961e22
Show file tree
Hide file tree
Showing 2 changed files with 122 additions and 0 deletions.
24 changes: 24 additions & 0 deletions gap/congruences/congsemigraph.gi
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,30 @@ function(cong1, cong2)
return CongruenceByWangPair(S, Union(H, X), Difference(W, Union(H, X)));
end);

InstallMethod(MeetSemigroupCongruences,
"for two congruences by Wang pair",
[IsCongruenceByWangPair, IsCongruenceByWangPair],
function(cong1, cong2)
local out, H1, H2, W1, W2, H, V0, v;
out := OutNeighbours(GraphOfGraphInverseSemigroup(Source(cong1)));
H1 := cong1!.H;
H2 := cong2!.H;
W1 := cong1!.W;
W2 := cong2!.W;
H := Union(H1, H2);
V0 := [];
for v in Difference(Union(W1, W2), H) do
if ForAll(out[v], w -> w in H) then
Add(V0, v);
fi;
od;
return CongruenceByWangPair(Source(cong1),
Intersection(H1, H2),
Union(Intersection(W1, H2),
Intersection(W2, H1),
Difference(Intersection(W1, W2), V0)));
end);

InstallMethod(IsSubrelation,
"for two congruences by Wang pair",
[IsCongruenceByWangPair, IsCongruenceByWangPair],
Expand Down
98 changes: 98 additions & 0 deletions tst/standard/congruences/congsemigraph.tst
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,104 @@ gap> LatticeOfCongruences(S);
<lattice of 12 two-sided congruences over
<finite graph inverse semigroup with 4 vertices, 4 edges>>

# Meet and join
gap> D := Digraph([[3, 4], [3, 4], [4], []]);
<immutable digraph with 4 vertices, 5 edges>
gap> S := GraphInverseSemigroup(D);
<finite graph inverse semigroup with 4 vertices, 5 edges>
gap> L := LatticeOfCongruences(S);
<lattice of 10 two-sided congruences over
<finite graph inverse semigroup with 4 vertices, 5 edges>>
gap> C := CongruencesOfSemigroup(S);
[ <graph inverse semigroup congruence with H = [ 1, 2, 3, 4 ] and W = [ ]>,
<graph inverse semigroup congruence with H = [ 4 ] and W = [ 1, 2 ]>,
<graph inverse semigroup congruence with H = [ 1, 3, 4 ] and W = [ ]>,
<graph inverse semigroup congruence with H = [ 4 ] and W = [ 1 ]>,
<graph inverse semigroup congruence with H = [ 2, 3, 4 ] and W = [ ]>,
<graph inverse semigroup congruence with H = [ 4 ] and W = [ 2 ]>,
<graph inverse semigroup congruence with H = [ 3, 4 ] and W = [ ]>,
<graph inverse semigroup congruence with H = [ ] and W = [ 3 ]>,
<graph inverse semigroup congruence with H = [ 4 ] and W = [ ]>,
<graph inverse semigroup congruence with H = [ ] and W = [ ]> ]
gap> val := true;;
> for i in [1 .. Length(C)] do
> for j in [1 .. Length(C)] do
> pos := Position(C, JoinSemigroupCongruences(C[i], C[j]));
> join := PartialOrderDigraphJoinOfVertices(L, i, j);
> if pos <> join then
> Error(StringFormatted("the join of congruences {} and {} is {} but should be {}",
> i, j, pos, join));
> val := false;
> fi;
> od;
> od;
> val;
true
gap> val := true;;
> for i in [1 .. Length(C)] do
> for j in [1 .. Length(C)] do
> pos := Position(C, MeetSemigroupCongruences(C[i], C[j]));
> meet := PartialOrderDigraphMeetOfVertices(L, i, j);
> if pos <> meet then
> Error(StringFormatted("the meet of congruences {} and {} is {} but should be {}",
> i, j, pos, meet));
> val := false;
> fi;
> od;
> od;
> val;
true

# More meet and join
gap> D := Digraph([[2], [3, 4], [4], []]);
<immutable digraph with 4 vertices, 4 edges>
gap> S := GraphInverseSemigroup(D);
<finite graph inverse semigroup with 4 vertices, 4 edges>
gap> L := LatticeOfCongruences(S);
<lattice of 12 two-sided congruences over
<finite graph inverse semigroup with 4 vertices, 4 edges>>
gap> C := CongruencesOfSemigroup(S);
[ <graph inverse semigroup congruence with H = [ 1, 2, 3, 4 ] and W = [ ]>,
<graph inverse semigroup congruence with H = [ 4 ] and W = [ 1, 2 ]>,
<graph inverse semigroup congruence with H = [ 3, 4 ] and W = [ 1 ]>,
<graph inverse semigroup congruence with H = [ ] and W = [ 1, 3 ]>,
<graph inverse semigroup congruence with H = [ 4 ] and W = [ 1 ]>,
<graph inverse semigroup congruence with H = [ ] and W = [ 1 ]>,
<graph inverse semigroup congruence with H = [ 2, 3, 4 ] and W = [ ]>,
<graph inverse semigroup congruence with H = [ 4 ] and W = [ 2 ]>,
<graph inverse semigroup congruence with H = [ 3, 4 ] and W = [ ]>,
<graph inverse semigroup congruence with H = [ ] and W = [ 3 ]>,
<graph inverse semigroup congruence with H = [ 4 ] and W = [ ]>,
<graph inverse semigroup congruence with H = [ ] and W = [ ]> ]
gap> val := true;;
> for i in [1 .. Length(C)] do
> for j in [1 .. Length(C)] do
> pos := Position(C, JoinSemigroupCongruences(C[i], C[j]));
> join := PartialOrderDigraphJoinOfVertices(L, i, j);
> if pos <> join then
> Error(StringFormatted("the join of congruences {} and {} is {} but should be {}",
> i, j, pos, join));
> val := false;
> fi;
> od;
> od;
> val;
true
gap> val := true;;
> for i in [1 .. Length(C)] do
> for j in [1 .. Length(C)] do
> pos := Position(C, MeetSemigroupCongruences(C[i], C[j]));
> meet := PartialOrderDigraphMeetOfVertices(L, i, j);
> if pos <> meet then
> Error(StringFormatted("the meet of congruences {} and {} is {} but should be {}",
> i, j, pos, meet));
> val := false;
> fi;
> od;
> od;
> val;
true

#
gap> SEMIGROUPS.StopTest();
gap> STOP_TEST("Semigroups package: standard/congruences/cong.tst");

0 comments on commit b961e22

Please sign in to comment.