diff --git a/gap/congruences/congsemigraph.gi b/gap/congruences/congsemigraph.gi index 1b4c1e94b..41157ec2f 100644 --- a/gap/congruences/congsemigraph.gi +++ b/gap/congruences/congsemigraph.gi @@ -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], diff --git a/tst/standard/congruences/congsemigraph.tst b/tst/standard/congruences/congsemigraph.tst index 39efac1ef..2b954d15e 100644 --- a/tst/standard/congruences/congsemigraph.tst +++ b/tst/standard/congruences/congsemigraph.tst @@ -317,6 +317,104 @@ gap> LatticeOfCongruences(S); > +# Meet and join +gap> D := Digraph([[3, 4], [3, 4], [4], []]); + +gap> S := GraphInverseSemigroup(D); + +gap> L := LatticeOfCongruences(S); +> +gap> C := CongruencesOfSemigroup(S); +[ , + , + , + , + , + , + , + , + , + ] +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], []]); + +gap> S := GraphInverseSemigroup(D); + +gap> L := LatticeOfCongruences(S); +> +gap> C := CongruencesOfSemigroup(S); +[ , + , + , + , + , + , + , + , + , + , + , + ] +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");