From 4e792472efa83caf8fd49fbbeef70d1dbef4f576 Mon Sep 17 00:00:00 2001 From: James Mitchell Date: Wed, 18 Jun 2025 17:38:00 +0100 Subject: [PATCH 01/10] Add preliminary support for TwistedBipartitions --- gap/elements/bipart.gd | 3 + gap/elements/bipart.gi | 63 +++++++++++++ gap/elements/twisted-bipart.gd | 19 ++++ gap/elements/twisted-bipart.gi | 159 +++++++++++++++++++++++++++++++++ init.g | 1 + read.g | 1 + twisted.g | 36 ++++++++ 7 files changed, 282 insertions(+) create mode 100644 gap/elements/twisted-bipart.gd create mode 100644 gap/elements/twisted-bipart.gi create mode 100644 twisted.g diff --git a/gap/elements/bipart.gd b/gap/elements/bipart.gd index bf8a60284..e73828385 100644 --- a/gap/elements/bipart.gd +++ b/gap/elements/bipart.gd @@ -72,6 +72,9 @@ DeclareProperty("IsPartialPermBipartition", IsBipartition); DeclareOperation("PermLeftQuoBipartition", [IsBipartition, IsBipartition]); +DeclareOperation("NrFloatingBlocks", [IsBipartition, IsBipartition]); + + # Collections DeclareAttribute("DegreeOfBipartitionCollection", IsBipartitionCollection); DeclareOperation("OneMutable", [IsBipartitionCollection]); diff --git a/gap/elements/bipart.gi b/gap/elements/bipart.gi index 5045482af..76b55e6f9 100644 --- a/gap/elements/bipart.gi +++ b/gap/elements/bipart.gi @@ -1111,3 +1111,66 @@ function(coll) return TensorBipartitions(coll); end); + +InstallMethod(NrFloatingBlocks, "for bipartition and bipartition", +[IsBipartition, IsBipartition], +function(a, b) + local n, anr, fuse, fuseit, ablocks, bblocks, x, y, cblocks, next, made_it, tab, nr, i; + + n := DegreeOfBipartition(a); + anr := NrBlocks(a); + + fuse := [1 .. anr + NrBlocks(b)]; + + fuseit := function(i) + while fuse[i] < i do + i := fuse[i]; + od; + return i; + end; + + ablocks := IntRepOfBipartition(a); + bblocks := IntRepOfBipartition(b); + + for i in [1 .. n] do + x := fuseit(ablocks[i + n]); + y := fuseit(bblocks[i] + anr); + if x <> y then + if x < y then + fuse[y] := x; + else + fuse[x] := y; + fi; + fi; + od; + + cblocks := EmptyPlist(2 * n); + next := 0; + made_it := BlistList(fuse, []); + for i in [1 .. n] do + made_it[fuseit(ablocks[i])] := true; + od; + + for i in [n + 1 .. 2 * n] do + made_it[fuseit(bblocks[i] + anr)] := true; + od; + tab := 0 * fuse; + nr := 0; + + for i in [n + 1 .. 2 * n] do + x := fuseit(ablocks[i]); + if not made_it[x] and tab[x] = 0 then + nr := nr + 1; + tab[x] := 1; + fi; + od; + + for i in [1 .. n] do + x := fuseit(bblocks[i] + anr); + if not made_it[x] and tab[x] = 0 then + nr := nr + 1; + tab[x] := 1; + fi; + od; + return nr; +end); diff --git a/gap/elements/twisted-bipart.gd b/gap/elements/twisted-bipart.gd new file mode 100644 index 000000000..56456778a --- /dev/null +++ b/gap/elements/twisted-bipart.gd @@ -0,0 +1,19 @@ + +DeclareCategory("IsTwistedBipartition", IsMultiplicativeElementWithOne +and IsMultiplicativeElementWithZero and +IsAssociativeElement); + +DeclareOperation("TwistedBipartition", [IsInt, IsBipartition, IsInt]); +DeclareOperation("ZeroTwistedBipartition", [IsInt, IsInt]); +DeclareAttribute("DegreeOfTwistedBipartition", +IsTwistedBipartition); +DeclareAttribute("MaxFloatingBlocks", +IsTwistedBipartition); +DeclareAttribute("NrFloatingBlocks", +IsTwistedBipartition); +DeclareAttribute("UnderlyingBipartition", +IsTwistedBipartition); + +DeclareOperation("RandomNonZeroTwistedBipartition", [IsInt, IsInt]); +DeclareProperty("IsZero", IsTwistedBipartition); +DeclareAttribute("ZeroImmutable", IsTwistedBipartition); diff --git a/gap/elements/twisted-bipart.gi b/gap/elements/twisted-bipart.gi new file mode 100644 index 000000000..8ba1dad10 --- /dev/null +++ b/gap/elements/twisted-bipart.gi @@ -0,0 +1,159 @@ + + +BindGlobal("TYPES_TWISTED_BIPART", []); +BindGlobal("TYPE_TWISTED_BIPART", +function(n, d) + local fam, type; + + if IsBound(TYPES_TWISTED_BIPART[n + 1]) then + if IsBound(TYPES_TWISTED_BIPART[n + 1][d + 1]) then + return TYPES_TWISTED_BIPART[n + 1][d + 1]; + fi; + else + TYPES_TWISTED_BIPART[n + 1] := []; + fi; + + fam := NewFamily(Concatenation("TwistedBipartitionFamily", String(n), "_", String(d)), + IsTwistedBipartition, + CanEasilySortElements, + CanEasilySortElements); + fam!.DegreeOfBipartition := n; + fam!.MaxFloatingBlocks := d; + + type := NewType(fam, IsTwistedBipartition and IsPositionalObjectRep); + TYPES_TWISTED_BIPART[n + 1][d + 1] := type; + return type; +end); + +InstallMethod(ZeroTwistedBipartition, +"for degree and max. floating blocks", [IsInt, IsInt], +function(n, d) + local result; + + result := []; + Objectify(TYPE_TWISTED_BIPART(n, d), result); + return result; +end); + +InstallMethod(TwistedBipartition, +"for number of floating blocks, bipartition and max. floating blocks (d)", +[IsInt, IsBipartition, IsInt], +function(i, bipart, d) + local n, result; + +# TODO check args: i and d are non-negative, +# and i <= d +n := DegreeOfBipartition(bipart); +result := [i, bipart]; +Objectify(TYPE_TWISTED_BIPART(n, d), result); +return result; +end); + +InstallMethod(MaxFloatingBlocks, "for a twisted bipartition", +[IsTwistedBipartition], +x -> FamilyObj(x)!.MaxFloatingBlocks); + +InstallMethod(DegreeOfTwistedBipartition, "for a twisted bipartition", +[IsTwistedBipartition], +x -> FamilyObj(x)!.DegreeOfBipartition); + +InstallMethod(IsZero, "for a twisted bipartition", +[IsTwistedBipartition], x -> not IsBound(x![1])); + +# TODO special case for IsZero +InstallMethod(NrFloatingBlocks, "for a twisted bipartition", +[IsTwistedBipartition], x -> x![1]); + +# TODO special case for IsZero +InstallMethod(UnderlyingBipartition, "for a twisted bipartition", +[IsTwistedBipartition], x -> x![2]); + +# TODO add IsOne and One + +InstallMethod(Zero, "for a twisted bipartition", +[IsTwistedBipartition], +function(x) + local n, d, result; + + if IsZero(x) then + return x; + fi; + + n := DegreeOfBipartition(UnderlyingBipartition(x)); + d := MaxFloatingBlocks(x); +end); + +InstallMethod(One, "for a twisted bipartition", +[IsTwistedBipartition], +function(x) + local n, d; + n := DegreeOfBipartition(UnderlyingBipartition(x)); + d := MaxFloatingBlocks(x); + return TwistedBipartition(0, IdentityBipartition(n), d); +end); + +# TODO IdentityTwistedBipartition + +InstallMethod(ViewString, "for a twisted bipartition", +[IsTwistedBipartition], +function(x) + if IsZero(x) then + return StringFormatted("ZeroTwistedBipartition({}, {})", + DegreeOfTwistedBipartition(x), MaxFloatingBlocks(x)); + fi; + return StringFormatted("TwistedBipartition({}, {}, {})", + NrFloatingBlocks(x), PrintString(UnderlyingBipartition(x)), + MaxFloatingBlocks(x)); +end); + +InstallMethod(RandomNonZeroTwistedBipartition, +"for a degree and max. floating blocks", [IsInt, IsInt], +{n, d} -> TwistedBipartition(Random([0 .. d]), RandomBipartition(n), d)); + +InstallMethod(\*, "for twisted bipartition", IsIdenticalObj, +[IsTwistedBipartition, IsTwistedBipartition], +function(x, y) + local xx, yy, floaters; + + if IsZero(x) then + return x; + elif IsZero(y) then + return y; + fi; + xx := UnderlyingBipartition(x); + yy := UnderlyingBipartition(y); + + floaters := NrFloatingBlocks(xx, yy) + NrFloatingBlocks(x) + NrFloatingBlocks(y); + + if floaters > MaxFloatingBlocks(x) then + return ZeroTwistedBipartition(DegreeOfTwistedBipartition(x), + MaxFloatingBlocks(x)); + fi; + + return TwistedBipartition(floaters, xx * yy, MaxFloatingBlocks(x)); +end); + +InstallMethod(\=, "for twisted bipartition", IsIdenticalObj, +[IsTwistedBipartition, IsTwistedBipartition], +function(x, y) +if IsZero(x) then +return IsZero(y); +elif IsZero(y) then +return false; +fi; +return NrFloatingBlocks(x) = NrFloatingBlocks(y) and UnderlyingBipartition(x) = +UnderlyingBipartition(y); +end); + +InstallMethod(\<, "for twisted bipartition", IsIdenticalObj, +[IsTwistedBipartition, IsTwistedBipartition], +function(x, y) +if IsZero(x) then +return not IsZero(y); +elif IsZero(y) then +return false; +fi; +return NrFloatingBlocks(x) < NrFloatingBlocks(y) or NrFloatingBlocks(x) < +NrFloatingBlocks(y) and UnderlyingBipartition(x) < UnderlyingBipartition(y); +end); + diff --git a/init.g b/init.g index 1c01899ef..28cc0708a 100644 --- a/init.g +++ b/init.g @@ -57,6 +57,7 @@ ReadPackage("semigroups", "gap/elements/star.gd"); ReadPackage("semigroups", "gap/elements/bipart.gd"); ReadPackage("semigroups", "gap/elements/blocks.gd"); +ReadPackage("semigroups", "gap/elements/twisted-bipart.gd"); ReadPackage("semigroups", "gap/elements/boolmat.gd"); ReadPackage("semigroups", "gap/elements/elements.gd"); ReadPackage("semigroups", "gap/elements/ffmat.gd"); diff --git a/read.g b/read.g index d189d3f46..47fc6cf9d 100644 --- a/read.g +++ b/read.g @@ -17,6 +17,7 @@ ReadPackage("semigroups", "gap/elements/star.gi"); ReadPackage("semigroups", "gap/elements/pbr.gi"); ReadPackage("semigroups", "gap/elements/bipart.gi"); ReadPackage("semigroups", "gap/elements/blocks.gi"); +ReadPackage("semigroups", "gap/elements/twisted-bipart.gi"); ReadPackage("semigroups", "gap/elements/semiringmat.gi"); ReadPackage("semigroups", "gap/elements/maxplusmat.gi"); ReadPackage("semigroups", "gap/elements/boolmat.gi"); diff --git a/twisted.g b/twisted.g new file mode 100644 index 000000000..a0edbf693 --- /dev/null +++ b/twisted.g @@ -0,0 +1,36 @@ +TransfsFromTwistedBipartition := function(S, x, l) + local n, L, i, rows, j, p, q; + # quotient of twisted diagram semigroup S by making elements with l loops all equal to 0 + + n := Size(S); + L := AsSortedList(S); + + i := Position(L, x); + rows := List([1 .. l], x -> ListWithIdenticalEntries(l * n + 1, l * n + 1)); + + for j in [1..n] do + for p in [0..l-1] do + for q in [0..l-1] do + if NrFloatingBlocks(L[i],L[j])+p+q Date: Thu, 19 Jun 2025 12:33:15 +0100 Subject: [PATCH 02/10] Add CanUseFroidurePin + nec. code --- gap/elements/twisted-bipart.gd | 12 ++++++++++++ gap/elements/twisted-bipart.gi | 24 +++++++++++++++++++++-- twisted.g | 36 ---------------------------------- 3 files changed, 34 insertions(+), 38 deletions(-) delete mode 100644 twisted.g diff --git a/gap/elements/twisted-bipart.gd b/gap/elements/twisted-bipart.gd index 56456778a..fc92bb5ba 100644 --- a/gap/elements/twisted-bipart.gd +++ b/gap/elements/twisted-bipart.gd @@ -2,6 +2,9 @@ DeclareCategory("IsTwistedBipartition", IsMultiplicativeElementWithOne and IsMultiplicativeElementWithZero and IsAssociativeElement); +DeclareCategoryCollections("IsTwistedBipartition"); +DeclareCategoryCollections("IsTwistedBipartitionCollection"); + DeclareOperation("TwistedBipartition", [IsInt, IsBipartition, IsInt]); DeclareOperation("ZeroTwistedBipartition", [IsInt, IsInt]); @@ -17,3 +20,12 @@ IsTwistedBipartition); DeclareOperation("RandomNonZeroTwistedBipartition", [IsInt, IsInt]); DeclareProperty("IsZero", IsTwistedBipartition); DeclareAttribute("ZeroImmutable", IsTwistedBipartition); + +#TODO move the following into a separate file named semitwistedbipart.gd + +DeclareSynonym("IsTwistedBipartitionSemigroup", +IsTwistedBipartitionCollection and IsSemigroup); +DeclareSynonym("IsTwistedBipartitionMonoid", +IsTwistedBipartitionCollection and IsMonoid); + +InstallTrueMethod(IsFinite, IsTwistedBipartitionSemigroup); diff --git a/gap/elements/twisted-bipart.gi b/gap/elements/twisted-bipart.gi index 8ba1dad10..1c6abfdb7 100644 --- a/gap/elements/twisted-bipart.gi +++ b/gap/elements/twisted-bipart.gi @@ -1,5 +1,7 @@ +InstallTrueMethod(CanUseGapFroidurePin, IsTwistedBipartitionSemigroup); + BindGlobal("TYPES_TWISTED_BIPART", []); BindGlobal("TYPE_TWISTED_BIPART", function(n, d) @@ -153,7 +155,25 @@ return not IsZero(y); elif IsZero(y) then return false; fi; -return NrFloatingBlocks(x) < NrFloatingBlocks(y) or NrFloatingBlocks(x) < -NrFloatingBlocks(y) and UnderlyingBipartition(x) < UnderlyingBipartition(y); +return NrFloatingBlocks(x) < NrFloatingBlocks(y) or (NrFloatingBlocks(x) = +NrFloatingBlocks(y) and UnderlyingBipartition(x) < UnderlyingBipartition(y)); end); +SEMIGROUPS.TwistedBipartitionHashFunc := function(x, data) +if IsZero(x) then +return 1; +fi; + return (211 * data[1].func(NrFloatingBlocks(x), data[1].data) + + data[2].func(UnderlyingBipartition(x), data[2].data)) mod data[3] + 1; +end; + +InstallMethod(ChooseHashFunction, "for a twisted bipartition", +[IsTwistedBipartition, IsInt], +function(x, hashlen) + local data; + data := [ChooseHashFunction(NrFloatingBlocks(x), hashlen), + ChooseHashFunction(UnderlyingBipartition(x), hashlen), + hashlen]; + return rec(func := SEMIGROUPS.TwistedBipartitionHashFunc, + data := data); +end); diff --git a/twisted.g b/twisted.g deleted file mode 100644 index a0edbf693..000000000 --- a/twisted.g +++ /dev/null @@ -1,36 +0,0 @@ -TransfsFromTwistedBipartition := function(S, x, l) - local n, L, i, rows, j, p, q; - # quotient of twisted diagram semigroup S by making elements with l loops all equal to 0 - - n := Size(S); - L := AsSortedList(S); - - i := Position(L, x); - rows := List([1 .. l], x -> ListWithIdenticalEntries(l * n + 1, l * n + 1)); - - for j in [1..n] do - for p in [0..l-1] do - for q in [0..l-1] do - if NrFloatingBlocks(L[i],L[j])+p+q Date: Thu, 19 Jun 2025 14:07:17 +0100 Subject: [PATCH 03/10] Fix linting --- gap/elements/bipart.gd | 1 - gap/elements/bipart.gi | 4 +- gap/elements/twisted-bipart.gd | 12 ++- gap/elements/twisted-bipart.gi | 129 ++++++++++++++++++--------------- 4 files changed, 83 insertions(+), 63 deletions(-) diff --git a/gap/elements/bipart.gd b/gap/elements/bipart.gd index e73828385..650c90e7f 100644 --- a/gap/elements/bipart.gd +++ b/gap/elements/bipart.gd @@ -74,7 +74,6 @@ DeclareOperation("PermLeftQuoBipartition", [IsBipartition, IsBipartition]); DeclareOperation("NrFloatingBlocks", [IsBipartition, IsBipartition]); - # Collections DeclareAttribute("DegreeOfBipartitionCollection", IsBipartitionCollection); DeclareOperation("OneMutable", [IsBipartitionCollection]); diff --git a/gap/elements/bipart.gi b/gap/elements/bipart.gi index 76b55e6f9..681dde508 100644 --- a/gap/elements/bipart.gi +++ b/gap/elements/bipart.gi @@ -1115,7 +1115,7 @@ end); InstallMethod(NrFloatingBlocks, "for bipartition and bipartition", [IsBipartition, IsBipartition], function(a, b) - local n, anr, fuse, fuseit, ablocks, bblocks, x, y, cblocks, next, made_it, tab, nr, i; + local n, anr, fuse, fuseit, ablocks, bblocks, x, y, made_it, tab, nr, i; n := DegreeOfBipartition(a); anr := NrBlocks(a); @@ -1144,8 +1144,6 @@ function(a, b) fi; od; - cblocks := EmptyPlist(2 * n); - next := 0; made_it := BlistList(fuse, []); for i in [1 .. n] do made_it[fuseit(ablocks[i])] := true; diff --git a/gap/elements/twisted-bipart.gd b/gap/elements/twisted-bipart.gd index fc92bb5ba..322ce0fd5 100644 --- a/gap/elements/twisted-bipart.gd +++ b/gap/elements/twisted-bipart.gd @@ -1,3 +1,12 @@ +############################################################################ +## +## elements/twisted-bipart.gd +## Copyright (C) 2025 James D. Mitchell +## +## Licensing information can be found in the README file of this package. +## +############################################################################# +## DeclareCategory("IsTwistedBipartition", IsMultiplicativeElementWithOne and IsMultiplicativeElementWithZero and @@ -5,7 +14,6 @@ IsAssociativeElement); DeclareCategoryCollections("IsTwistedBipartition"); DeclareCategoryCollections("IsTwistedBipartitionCollection"); - DeclareOperation("TwistedBipartition", [IsInt, IsBipartition, IsInt]); DeclareOperation("ZeroTwistedBipartition", [IsInt, IsInt]); DeclareAttribute("DegreeOfTwistedBipartition", @@ -21,7 +29,7 @@ DeclareOperation("RandomNonZeroTwistedBipartition", [IsInt, IsInt]); DeclareProperty("IsZero", IsTwistedBipartition); DeclareAttribute("ZeroImmutable", IsTwistedBipartition); -#TODO move the following into a separate file named semitwistedbipart.gd +# TODO move the following into a separate file named semitwistedbipart.gd DeclareSynonym("IsTwistedBipartitionSemigroup", IsTwistedBipartitionCollection and IsSemigroup); diff --git a/gap/elements/twisted-bipart.gi b/gap/elements/twisted-bipart.gi index 1c6abfdb7..d647cac8f 100644 --- a/gap/elements/twisted-bipart.gi +++ b/gap/elements/twisted-bipart.gi @@ -1,4 +1,12 @@ - +############################################################################ +## +## elements/twisted-bipart.gi +## Copyright (C) 2025 James D. Mitchell +## +## Licensing information can be found in the README file of this package. +## +############################################################################# +## InstallTrueMethod(CanUseGapFroidurePin, IsTwistedBipartitionSemigroup); @@ -15,7 +23,10 @@ function(n, d) TYPES_TWISTED_BIPART[n + 1] := []; fi; - fam := NewFamily(Concatenation("TwistedBipartitionFamily", String(n), "_", String(d)), + fam := NewFamily(Concatenation("TwistedBipartitionFamily", + String(n), + "_", + String(d)), IsTwistedBipartition, CanEasilySortElements, CanEasilySortElements); @@ -32,9 +43,9 @@ InstallMethod(ZeroTwistedBipartition, function(n, d) local result; - result := []; - Objectify(TYPE_TWISTED_BIPART(n, d), result); - return result; + result := []; + Objectify(TYPE_TWISTED_BIPART(n, d), result); + return result; end); InstallMethod(TwistedBipartition, @@ -43,12 +54,12 @@ InstallMethod(TwistedBipartition, function(i, bipart, d) local n, result; -# TODO check args: i and d are non-negative, -# and i <= d -n := DegreeOfBipartition(bipart); -result := [i, bipart]; -Objectify(TYPE_TWISTED_BIPART(n, d), result); -return result; + # TODO check args: i and d are non-negative, + # and i <= d + n := DegreeOfBipartition(bipart); + result := [i, bipart]; + Objectify(TYPE_TWISTED_BIPART(n, d), result); + return result; end); InstallMethod(MaxFloatingBlocks, "for a twisted bipartition", @@ -75,23 +86,24 @@ InstallMethod(UnderlyingBipartition, "for a twisted bipartition", InstallMethod(Zero, "for a twisted bipartition", [IsTwistedBipartition], function(x) - local n, d, result; + local n, d; - if IsZero(x) then + if IsZero(x) then return x; - fi; + fi; - n := DegreeOfBipartition(UnderlyingBipartition(x)); - d := MaxFloatingBlocks(x); + n := DegreeOfBipartition(UnderlyingBipartition(x)); + d := MaxFloatingBlocks(x); + return ZeroTwistedBipartition(n, d); end); InstallMethod(One, "for a twisted bipartition", [IsTwistedBipartition], function(x) - local n, d; - n := DegreeOfBipartition(UnderlyingBipartition(x)); - d := MaxFloatingBlocks(x); - return TwistedBipartition(0, IdentityBipartition(n), d); +local n, d; + n := DegreeOfBipartition(UnderlyingBipartition(x)); + d := MaxFloatingBlocks(x); + return TwistedBipartition(0, IdentityBipartition(n), d); end); # TODO IdentityTwistedBipartition @@ -99,10 +111,10 @@ end); InstallMethod(ViewString, "for a twisted bipartition", [IsTwistedBipartition], function(x) - if IsZero(x) then - return StringFormatted("ZeroTwistedBipartition({}, {})", - DegreeOfTwistedBipartition(x), MaxFloatingBlocks(x)); - fi; + if IsZero(x) then + return StringFormatted("ZeroTwistedBipartition({}, {})", + DegreeOfTwistedBipartition(x), MaxFloatingBlocks(x)); + fi; return StringFormatted("TwistedBipartition({}, {}, {})", NrFloatingBlocks(x), PrintString(UnderlyingBipartition(x)), MaxFloatingBlocks(x)); @@ -117,55 +129,58 @@ InstallMethod(\*, "for twisted bipartition", IsIdenticalObj, function(x, y) local xx, yy, floaters; - if IsZero(x) then - return x; - elif IsZero(y) then - return y; - fi; - xx := UnderlyingBipartition(x); - yy := UnderlyingBipartition(y); + if IsZero(x) then + return x; + elif IsZero(y) then + return y; + fi; + xx := UnderlyingBipartition(x); + yy := UnderlyingBipartition(y); - floaters := NrFloatingBlocks(xx, yy) + NrFloatingBlocks(x) + NrFloatingBlocks(y); + floaters := NrFloatingBlocks(xx, yy) + + NrFloatingBlocks(x) + NrFloatingBlocks(y); - if floaters > MaxFloatingBlocks(x) then - return ZeroTwistedBipartition(DegreeOfTwistedBipartition(x), - MaxFloatingBlocks(x)); - fi; + if floaters > MaxFloatingBlocks(x) then + return ZeroTwistedBipartition(DegreeOfTwistedBipartition(x), + MaxFloatingBlocks(x)); + fi; - return TwistedBipartition(floaters, xx * yy, MaxFloatingBlocks(x)); + return TwistedBipartition(floaters, xx * yy, MaxFloatingBlocks(x)); end); InstallMethod(\=, "for twisted bipartition", IsIdenticalObj, [IsTwistedBipartition, IsTwistedBipartition], function(x, y) -if IsZero(x) then -return IsZero(y); -elif IsZero(y) then -return false; -fi; -return NrFloatingBlocks(x) = NrFloatingBlocks(y) and UnderlyingBipartition(x) = -UnderlyingBipartition(y); + if IsZero(x) then + return IsZero(y); + elif IsZero(y) then + return false; + fi; + return NrFloatingBlocks(x) = NrFloatingBlocks(y) + and UnderlyingBipartition(x) = UnderlyingBipartition(y); end); InstallMethod(\<, "for twisted bipartition", IsIdenticalObj, [IsTwistedBipartition, IsTwistedBipartition], function(x, y) -if IsZero(x) then -return not IsZero(y); -elif IsZero(y) then -return false; -fi; -return NrFloatingBlocks(x) < NrFloatingBlocks(y) or (NrFloatingBlocks(x) = -NrFloatingBlocks(y) and UnderlyingBipartition(x) < UnderlyingBipartition(y)); + if IsZero(x) then + return not IsZero(y); + elif IsZero(y) then + return false; + fi; + return NrFloatingBlocks(x) < NrFloatingBlocks(y) or + (NrFloatingBlocks(x) = NrFloatingBlocks(y) + and UnderlyingBipartition(x) < UnderlyingBipartition(y)); end); SEMIGROUPS.TwistedBipartitionHashFunc := function(x, data) -if IsZero(x) then -return 1; -fi; - return (211 * data[1].func(NrFloatingBlocks(x), data[1].data) - + data[2].func(UnderlyingBipartition(x), data[2].data)) mod data[3] + 1; -end; + if IsZero(x) then + return 1; + fi; + return (211 * data[1].func(NrFloatingBlocks(x), data[1].data) + + data[2].func(UnderlyingBipartition(x), data[2].data)) + mod data[3] + 1; +end InstallMethod(ChooseHashFunction, "for a twisted bipartition", [IsTwistedBipartition, IsInt], From be235534f94e45a2230c595d8b2d8418491dede2 Mon Sep 17 00:00:00 2001 From: James Mitchell Date: Fri, 20 Jun 2025 09:11:43 +0100 Subject: [PATCH 04/10] Fix linting --- gap/elements/twisted-bipart.gi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gap/elements/twisted-bipart.gi b/gap/elements/twisted-bipart.gi index d647cac8f..0c30bf2aa 100644 --- a/gap/elements/twisted-bipart.gi +++ b/gap/elements/twisted-bipart.gi @@ -100,7 +100,7 @@ end); InstallMethod(One, "for a twisted bipartition", [IsTwistedBipartition], function(x) -local n, d; + local n, d; n := DegreeOfBipartition(UnderlyingBipartition(x)); d := MaxFloatingBlocks(x); return TwistedBipartition(0, IdentityBipartition(n), d); From 0d78a0db788910129a912212b56a1b13fe8469ce Mon Sep 17 00:00:00 2001 From: Matthias Fresacher K2 Date: Fri, 8 Aug 2025 14:30:28 +1000 Subject: [PATCH 05/10] Finished in file todo-s - Split file into newly created semitwistedbipart.gx - Added checks for input parameters - Added special cases for zero - Added IsOne - Added IdentityTwistedBipartition - Added authorship --- gap/elements/semitwistedbipart.gd | 43 +++++++++++++++++ gap/elements/semitwistedbipart.gi | 38 +++++++++++++++ gap/elements/twisted-bipart.gd | 40 ++++++++++++---- gap/elements/twisted-bipart.gi | 80 +++++++++++++++++++++++++------ init.g | 1 + read.g | 1 + 6 files changed, 179 insertions(+), 24 deletions(-) create mode 100644 gap/elements/semitwistedbipart.gd create mode 100644 gap/elements/semitwistedbipart.gi diff --git a/gap/elements/semitwistedbipart.gd b/gap/elements/semitwistedbipart.gd new file mode 100644 index 000000000..fe090187b --- /dev/null +++ b/gap/elements/semitwistedbipart.gd @@ -0,0 +1,43 @@ +############################################################################ +## +## elements/semitwistedbipart.gd +## Copyright (C) 2025 James D. Mitchell +## +## Licensing information can be found in the README file of this package. +## +############################################################################# +## +## In collaboration with +## +############################################## +## ## +## Code created ## +## by ## +## *--------------------* ## +## | Matthias Fresacher | ## +## *--------------------* ## +## ## +############################################## + +# *------------------------------* +# |``````````````````````````````| +# |`````____````____`````````````| +# |````|MFMF\ /MFMF|````````````| +# |````|MF|MF\/MF|MF|````````````| +# |````|MF|\MFMF/|MF|_______`````| +# |````|MF|``````|MFMFMFMFMF|````| +# |````|MF|``````|MF|````````````| +# |````|MF|``````|MF|___`````````| +# |``````````````|MFMFMF|````````| +# |``````````````|MF|````````````| +# |``````````````|MF|````````````| +# |``````````````|MF|````````````| +# |``````````````````````````````| +# *------------------------------* + +DeclareSynonym("IsTwistedBipartitionSemigroup", +IsTwistedBipartitionCollection and IsSemigroup); +DeclareSynonym("IsTwistedBipartitionMonoid", +IsTwistedBipartitionCollection and IsMonoid); + +InstallTrueMethod(IsFinite, IsTwistedBipartitionSemigroup); diff --git a/gap/elements/semitwistedbipart.gi b/gap/elements/semitwistedbipart.gi new file mode 100644 index 000000000..8dedd8a5a --- /dev/null +++ b/gap/elements/semitwistedbipart.gi @@ -0,0 +1,38 @@ +############################################################################ +## +## elements/semitwistedbipart.gi +## Copyright (C) 2025 James D. Mitchell +## +## Licensing information can be found in the README file of this package. +## +############################################################################# +## +## In collaboration with +## +############################################## +## ## +## Code created ## +## by ## +## *--------------------* ## +## | Matthias Fresacher | ## +## *--------------------* ## +## ## +############################################## + +# *------------------------------* +# |``````````````````````````````| +# |`````____````____`````````````| +# |````|MFMF\ /MFMF|````````````| +# |````|MF|MF\/MF|MF|````````````| +# |````|MF|\MFMF/|MF|_______`````| +# |````|MF|``````|MFMFMFMFMF|````| +# |````|MF|``````|MF|````````````| +# |````|MF|``````|MF|___`````````| +# |``````````````|MFMFMF|````````| +# |``````````````|MF|````````````| +# |``````````````|MF|````````````| +# |``````````````|MF|````````````| +# |``````````````````````````````| +# *------------------------------* + +InstallTrueMethod(CanUseGapFroidurePin, IsTwistedBipartitionSemigroup); diff --git a/gap/elements/twisted-bipart.gd b/gap/elements/twisted-bipart.gd index 322ce0fd5..a9309e35f 100644 --- a/gap/elements/twisted-bipart.gd +++ b/gap/elements/twisted-bipart.gd @@ -7,6 +7,33 @@ ## ############################################################################# ## +## In collaboration with +## +############################################## +## ## +## Code created ## +## by ## +## *--------------------* ## +## | Matthias Fresacher | ## +## *--------------------* ## +## ## +############################################## + +# *------------------------------* +# |``````````````````````````````| +# |`````____````____`````````````| +# |````|MFMF\ /MFMF|````````````| +# |````|MF|MF\/MF|MF|````````````| +# |````|MF|\MFMF/|MF|_______`````| +# |````|MF|``````|MFMFMFMFMF|````| +# |````|MF|``````|MF|````````````| +# |````|MF|``````|MF|___`````````| +# |``````````````|MFMFMF|````````| +# |``````````````|MF|````````````| +# |``````````````|MF|````````````| +# |``````````````|MF|````````````| +# |``````````````````````````````| +# *------------------------------* DeclareCategory("IsTwistedBipartition", IsMultiplicativeElementWithOne and IsMultiplicativeElementWithZero and @@ -27,13 +54,6 @@ IsTwistedBipartition); DeclareOperation("RandomNonZeroTwistedBipartition", [IsInt, IsInt]); DeclareProperty("IsZero", IsTwistedBipartition); -DeclareAttribute("ZeroImmutable", IsTwistedBipartition); - -# TODO move the following into a separate file named semitwistedbipart.gd - -DeclareSynonym("IsTwistedBipartitionSemigroup", -IsTwistedBipartitionCollection and IsSemigroup); -DeclareSynonym("IsTwistedBipartitionMonoid", -IsTwistedBipartitionCollection and IsMonoid); - -InstallTrueMethod(IsFinite, IsTwistedBipartitionSemigroup); +DeclareProperty("IsOne", IsTwistedBipartition); +DeclareOperation("IdentityTwistedBipartition", [IsPosInt, IsInt]); +DeclareAttribute("ZeroImmutable", IsTwistedBipartition); \ No newline at end of file diff --git a/gap/elements/twisted-bipart.gi b/gap/elements/twisted-bipart.gi index 0c30bf2aa..6793b2b0b 100644 --- a/gap/elements/twisted-bipart.gi +++ b/gap/elements/twisted-bipart.gi @@ -7,8 +7,33 @@ ## ############################################################################# ## - -InstallTrueMethod(CanUseGapFroidurePin, IsTwistedBipartitionSemigroup); +## In collaboration with +## +############################################## +## ## +## Code created ## +## by ## +## *--------------------* ## +## | Matthias Fresacher | ## +## *--------------------* ## +## ## +############################################## + +# *------------------------------* +# |``````````````````````````````| +# |`````____````____`````````````| +# |````|MFMF\ /MFMF|````````````| +# |````|MF|MF\/MF|MF|````````````| +# |````|MF|\MFMF/|MF|_______`````| +# |````|MF|``````|MFMFMFMFMF|````| +# |````|MF|``````|MF|````````````| +# |````|MF|``````|MF|___`````````| +# |``````````````|MFMFMF|````````| +# |``````````````|MF|````````````| +# |``````````````|MF|````````````| +# |``````````````|MF|````````````| +# |``````````````````````````````| +# *------------------------------* BindGlobal("TYPES_TWISTED_BIPART", []); BindGlobal("TYPE_TWISTED_BIPART", @@ -53,9 +78,14 @@ InstallMethod(TwistedBipartition, [IsInt, IsBipartition, IsInt], function(i, bipart, d) local n, result; - - # TODO check args: i and d are non-negative, - # and i <= d + if d < 0 then + ErrorNoReturn("the maximum number of floating blocks must be non-negative"); + fi; + if i < 0 then + ErrorNoReturn("the number of floating blocks must be non-negative"); + elif i > d then + ErrorNoReturn("the number of floating blocks cannot exceed the maximum number of floating blocks"); + fi; n := DegreeOfBipartition(bipart); result := [i, bipart]; Objectify(TYPE_TWISTED_BIPART(n, d), result); @@ -73,15 +103,26 @@ x -> FamilyObj(x)!.DegreeOfBipartition); InstallMethod(IsZero, "for a twisted bipartition", [IsTwistedBipartition], x -> not IsBound(x![1])); -# TODO special case for IsZero +InstallMethod(IsOne, "for a twisted bipartition", +[IsTwistedBipartition], x -> One(x)=x); + InstallMethod(NrFloatingBlocks, "for a twisted bipartition", -[IsTwistedBipartition], x -> x![1]); +[IsTwistedBipartition], +function(x) + if IsZero(x) then + ErrorNoReturn("the zero diagram does not have floating blocks"); + fi; + return x![1]; +end); -# TODO special case for IsZero InstallMethod(UnderlyingBipartition, "for a twisted bipartition", -[IsTwistedBipartition], x -> x![2]); - -# TODO add IsOne and One +[IsTwistedBipartition], +function(x) + if IsZero(x) then + ErrorNoReturn("the zero diagram does not have an underlying bipartition"); + fi; + return x![2]; +end); InstallMethod(Zero, "for a twisted bipartition", [IsTwistedBipartition], @@ -106,7 +147,18 @@ function(x) return TwistedBipartition(0, IdentityBipartition(n), d); end); -# TODO IdentityTwistedBipartition +InstallMethod(IdentityTwistedBipartition, +"for degree n and max. floating blocks (d)", +[IsPosInt, IsInt], +function(n, d) + if n >= 2 ^ 29 then + ErrorNoReturn("the degree (a positive integer) must not exceed 2 ^ 29 - 1"); + fi; + if d < 0 then + ErrorNoReturn("the maximum number of floating blocks must be non-negative"); + fi; + return TwistedBipartition(0, IdentityBipartition(n), d); +end); InstallMethod(ViewString, "for a twisted bipartition", [IsTwistedBipartition], @@ -177,10 +229,10 @@ SEMIGROUPS.TwistedBipartitionHashFunc := function(x, data) if IsZero(x) then return 1; fi; - return (211 * data[1].func(NrFloatingBlocks(x), data[1].data) + return (163 * data[1].func(NrFloatingBlocks(x), data[1].data) + data[2].func(UnderlyingBipartition(x), data[2].data)) mod data[3] + 1; -end +end; InstallMethod(ChooseHashFunction, "for a twisted bipartition", [IsTwistedBipartition, IsInt], diff --git a/init.g b/init.g index 28cc0708a..20eb5fd05 100644 --- a/init.g +++ b/init.g @@ -96,6 +96,7 @@ ReadPackage("semigroups", "gap/semigroups/semiquo.gd"); ReadPackage("semigroups", "gap/semigroups/semiringmat.gd"); ReadPackage("semigroups", "gap/semigroups/semirms.gd"); ReadPackage("semigroups", "gap/semigroups/semitrans.gd"); +ReadPackage("semigroups", "gap/elements/semitwistedbipart.gd"); ReadPackage("semigroups", "gap/semigroups/grpperm.gd"); diff --git a/read.g b/read.g index 47fc6cf9d..53e637e97 100644 --- a/read.g +++ b/read.g @@ -58,6 +58,7 @@ ReadPackage("semigroups", "gap/semigroups/semiffmat.gi"); ReadPackage("semigroups", "gap/semigroups/semiquo.gi"); ReadPackage("semigroups", "gap/semigroups/semieunit.gi"); ReadPackage("semigroups", "gap/semigroups/semidp.gi"); +ReadPackage("semigroups", "gap/elements/semitwistedbipart.gi"); ReadPackage("semigroups", "gap/ideals/ideals.gi"); ReadPackage("semigroups", "gap/ideals/acting.gi"); From 5ac9077b50955c61f107d348ca83418e815e0a20 Mon Sep 17 00:00:00 2001 From: Matthias Fresacher K2 Date: Fri, 8 Aug 2025 15:34:55 +1000 Subject: [PATCH 06/10] Started duplicating bipartition functions - Added input checks --- gap/elements/twisted-bipart.gd | 14 +++++- gap/elements/twisted-bipart.gi | 88 ++++++++++++++++++++++++++++++++-- 2 files changed, 98 insertions(+), 4 deletions(-) diff --git a/gap/elements/twisted-bipart.gd b/gap/elements/twisted-bipart.gd index a9309e35f..03e266d3f 100644 --- a/gap/elements/twisted-bipart.gd +++ b/gap/elements/twisted-bipart.gd @@ -53,7 +53,19 @@ DeclareAttribute("UnderlyingBipartition", IsTwistedBipartition); DeclareOperation("RandomNonZeroTwistedBipartition", [IsInt, IsInt]); +DeclareOperation("RandomNonZeroTwistedBipartition", [IsRandomSource, IsInt, IsInt]); +DeclareOperation("RandomTwistedBipartition", [IsInt, IsInt]); +DeclareOperation("RandomTwistedBipartition", [IsRandomSource, IsInt, IsInt]); DeclareProperty("IsZero", IsTwistedBipartition); DeclareProperty("IsOne", IsTwistedBipartition); DeclareOperation("IdentityTwistedBipartition", [IsPosInt, IsInt]); -DeclareAttribute("ZeroImmutable", IsTwistedBipartition); \ No newline at end of file +DeclareAttribute("ZeroImmutable", IsTwistedBipartition); + +DeclareAttribute("DegreeOfBipartition", IsTwistedBipartition); +DeclareAttribute("NrBlocks", IsTwistedBipartition); +DeclareAttribute("NrLeftBlocks", IsTwistedBipartition); +DeclareAttribute("NrRightBlocks", IsTwistedBipartition); +DeclareAttribute("RankOfBipartition", IsTwistedBipartition); + +DeclareAttribute("DomainOfBipartition", IsTwistedBipartition); +DeclareAttribute("CodomainOfBipartition", IsTwistedBipartition); \ No newline at end of file diff --git a/gap/elements/twisted-bipart.gi b/gap/elements/twisted-bipart.gi index 6793b2b0b..85e8d0c7c 100644 --- a/gap/elements/twisted-bipart.gi +++ b/gap/elements/twisted-bipart.gi @@ -67,7 +67,12 @@ InstallMethod(ZeroTwistedBipartition, "for degree and max. floating blocks", [IsInt, IsInt], function(n, d) local result; - + if n >= 2 ^ 29 then + ErrorNoReturn("the degree (a positive integer) must not exceed 2 ^ 29 - 1"); + fi; + if d < 0 then + ErrorNoReturn("the maximum number of floating blocks must be non-negative"); + fi; result := []; Objectify(TYPE_TWISTED_BIPART(n, d), result); return result; @@ -128,7 +133,6 @@ InstallMethod(Zero, "for a twisted bipartition", [IsTwistedBipartition], function(x) local n, d; - if IsZero(x) then return x; fi; @@ -174,7 +178,61 @@ end); InstallMethod(RandomNonZeroTwistedBipartition, "for a degree and max. floating blocks", [IsInt, IsInt], -{n, d} -> TwistedBipartition(Random([0 .. d]), RandomBipartition(n), d)); +function(n, d) + if n >= 2 ^ 29 then + ErrorNoReturn("the degree (a positive integer) must not exceed 2 ^ 29 - 1"); + fi; + if d < 0 then + ErrorNoReturn("the maximum number of floating blocks must be non-negative"); + fi; + return TwistedBipartition(Random([0 .. d]), RandomBipartition(n), d); +end); + +InstallMethod(RandomNonZeroTwistedBipartition, +"for a random source, degree and max. floating blocks", [IsRandomSource, IsInt, IsInt], +function(rs, n, d) + if n >= 2 ^ 29 then + ErrorNoReturn("the degree (a positive integer) must not exceed 2 ^ 29 - 1"); + fi; + if d < 0 then + ErrorNoReturn("the maximum number of floating blocks must be non-negative"); + fi; + return TwistedBipartition(Random(rs, [0 .. d]), RandomBipartition(rs, n), d); +end); + +InstallMethod(RandomTwistedBipartition, +"for a degree and max. floating blocks", [IsInt, IsInt], +function(n, d) + # Gives 1% chance of selecting zero + if n >= 2 ^ 29 then + ErrorNoReturn("the degree (a positive integer) must not exceed 2 ^ 29 - 1"); + fi; + if d < 0 then + ErrorNoReturn("the maximum number of floating blocks must be non-negative"); + fi; + if Random(GlobalMersenneTwister, 1, 100) = 16 then + return Zero(TwistedBipartition(Random([0 .. d]), RandomBipartition(n), d)); + else + return TwistedBipartition(Random([0 .. d]), RandomBipartition(n), d); + fi; +end); + +InstallMethod(RandomTwistedBipartition, +"for a random source, degree and max. floating blocks", [IsRandomSource, IsInt, IsInt], +function(rs, n, d) + # Gives 1% chance of selecting zero + if n >= 2 ^ 29 then + ErrorNoReturn("the degree (a positive integer) must not exceed 2 ^ 29 - 1"); + fi; + if d < 0 then + ErrorNoReturn("the maximum number of floating blocks must be non-negative"); + fi; + if Random(rs, 1, 100) = 16 then + return Zero(TwistedBipartition(Random([0 .. d]), RandomBipartition(rs, n), d)); + else + return TwistedBipartition(Random([0 .. d]), RandomBipartition(rs, n), d); + fi; +end); InstallMethod(\*, "for twisted bipartition", IsIdenticalObj, [IsTwistedBipartition, IsTwistedBipartition], @@ -244,3 +302,27 @@ function(x, hashlen) return rec(func := SEMIGROUPS.TwistedBipartitionHashFunc, data := data); end); + +# Fundamental attributes + +InstallMethod(DegreeOfBipartition, "for a twisted bipartition", +[IsTwistedBipartition], x -> DegreeOfBipartition(UnderlyingBipartition(x))); + +InstallMethod(NrBlocks, "for a twisted bipartition", +[IsTwistedBipartition], x -> NrBlocks(UnderlyingBipartition(x))); + +InstallMethod(NrLeftBlocks, "for a twisted bipartition", +[IsTwistedBipartition], x -> NrLeftBlocks(UnderlyingBipartition(x))); + +InstallMethod(NrRightBlocks, "for a twisted bipartition", +[IsTwistedBipartition], x -> NrRightBlocks(UnderlyingBipartition(x))); + +InstallMethod(RankOfBipartition, "for a twisted bipartition", +[IsTwistedBipartition], x -> RankOfBipartition(UnderlyingBipartition(x))); + +# Attributes + +InstallMethod(DomainOfBipartition, "for a twisted bipartition", +[IsTwistedBipartition], x -> DomainOfBipartition(UnderlyingBipartition(x))); +InstallMethod(CodomainOfBipartition, "for a twisted bipartition", +[IsTwistedBipartition], x -> DomainOfBipartition(UnderlyingBipartition(x))); \ No newline at end of file From bb96b8ad6b2035fd30b5b7ac09a679ae4cd14d6a Mon Sep 17 00:00:00 2001 From: Matthias Fresacher K2 Date: Thu, 14 Aug 2025 16:15:53 +1000 Subject: [PATCH 07/10] Finished duplication bipartition functions - Some extra work is needed though --- gap/elements/twisted-bipart.gd | 38 +++- gap/elements/twisted-bipart.gi | 346 ++++++++++++++++++++++++++++++++- 2 files changed, 382 insertions(+), 2 deletions(-) diff --git a/gap/elements/twisted-bipart.gd b/gap/elements/twisted-bipart.gd index 03e266d3f..80884ee48 100644 --- a/gap/elements/twisted-bipart.gd +++ b/gap/elements/twisted-bipart.gd @@ -45,12 +45,16 @@ DeclareOperation("TwistedBipartition", [IsInt, IsBipartition, IsInt]); DeclareOperation("ZeroTwistedBipartition", [IsInt, IsInt]); DeclareAttribute("DegreeOfTwistedBipartition", IsTwistedBipartition); +DeclareAttribute("DegreeOfTwistedBipartitionCollection", +IsTwistedBipartitionCollection); DeclareAttribute("MaxFloatingBlocks", IsTwistedBipartition); DeclareAttribute("NrFloatingBlocks", IsTwistedBipartition); DeclareAttribute("UnderlyingBipartition", IsTwistedBipartition); +DeclareAttribute("UnderlyingBipartitionCollection", +IsTwistedBipartitionCollection); DeclareOperation("RandomNonZeroTwistedBipartition", [IsInt, IsInt]); DeclareOperation("RandomNonZeroTwistedBipartition", [IsRandomSource, IsInt, IsInt]); @@ -68,4 +72,36 @@ DeclareAttribute("NrRightBlocks", IsTwistedBipartition); DeclareAttribute("RankOfBipartition", IsTwistedBipartition); DeclareAttribute("DomainOfBipartition", IsTwistedBipartition); -DeclareAttribute("CodomainOfBipartition", IsTwistedBipartition); \ No newline at end of file +DeclareAttribute("CodomainOfBipartition", IsTwistedBipartition); + +DeclareAttribute("NrTransverseBlocks", IsTwistedBipartition); +DeclareOperation("OneMutable", [IsTwistedBipartition, IsInt]); +DeclareOperation("OneMutable", [IsTwistedBipartitionCollection, IsInt]); + +DeclareProperty("IsBlockBijection", IsTwistedBipartition); +DeclareProperty("IsUniformBlockBijection", IsTwistedBipartition); +DeclareProperty("IsPartialPermBipartition", IsTwistedBipartition); +DeclareProperty("IsTransBipartition", IsTwistedBipartition); +DeclareProperty("IsDualTransBipartition", IsTwistedBipartition); +DeclareProperty("IsPermBipartition", IsTwistedBipartition); + +DeclareOperation("AsTwistedBipartition", [IsInt, IsPerm, IsZeroCyc, IsInt]); +DeclareOperation("AsTwistedBipartition", [IsInt, IsPerm, IsInt]); +DeclareOperation("AsTwistedBipartition", [IsInt, IsPerm, IsPosInt, IsInt]); +DeclareOperation("AsTwistedBipartition", [IsInt, IsPartialPerm, IsInt]); +DeclareOperation("AsTwistedBipartition", [IsInt, IsPartialPerm, IsZeroCyc, IsInt]); +DeclareOperation("AsTwistedBipartition", [IsInt, IsPartialPerm, IsPosInt, IsInt]); +DeclareOperation("AsTwistedBipartition", [IsInt, IsTransformation, IsInt]); +DeclareOperation("AsTwistedBipartition", [IsInt, IsTransformation, IsPosInt, IsInt]); +DeclareOperation("AsTwistedBipartition", [IsInt, IsTransformation, IsZeroCyc, IsInt]); +DeclareOperation("AsTwistedBipartition", [IsInt, IsBipartition, IsInt]); +DeclareOperation("AsTwistedBipartition", [IsInt, IsBipartition, IsPosInt, IsInt]); +DeclareOperation("AsTwistedBipartition", [IsTwistedBipartition]); +DeclareOperation("AsTwistedBipartition", [IsTwistedBipartition, IsPosInt]); +DeclareOperation("AsTwistedBipartition", [IsInt, IsBipartition, IsZeroCyc, IsInt]); +# DeclareOperation("AsTwistedBipartition", [IsInt, IsPBR, IsZeroCyc, IsInt]); +# DeclareOperation("AsTwistedBipartition", [IsInt, IsPBR, IsPosInt, IsInt]); +# DeclareOperation("AsTwistedBipartition", [IsInt, IsPBR, IsInt]); + +DeclareOperation("AsBlockBijection", [IsTwistedBipartition, IsPosInt]); +DeclareOperation("AsBlockBijection", [IsTwistedBipartition]); \ No newline at end of file diff --git a/gap/elements/twisted-bipart.gi b/gap/elements/twisted-bipart.gi index 85e8d0c7c..6cbeb44d2 100644 --- a/gap/elements/twisted-bipart.gi +++ b/gap/elements/twisted-bipart.gi @@ -129,6 +129,16 @@ function(x) return x![2]; end); +InstallMethod(UnderlyingBipartitionCollection, "for a twisted bipartition", +[IsTwistedBipartitionCollection], +function(x) + # TODO need to write/check this + if IsZero(x) then + ErrorNoReturn("the zero diagram does not have an underlying bipartition"); + fi; + return x![2]; +end); + InstallMethod(Zero, "for a twisted bipartition", [IsTwistedBipartition], function(x) @@ -176,6 +186,30 @@ function(x) MaxFloatingBlocks(x)); end); +InstallMethod(String, "for a twisted bipartition", +[IsTwistedBipartition], +function(x) + if IsZero(x) then + return StringFormatted("ZeroTwistedBipartition({}, {})", + DegreeOfTwistedBipartition(x), MaxFloatingBlocks(x)); + fi; + return StringFormatted("TwistedBipartition({}, {}, {})", + NrFloatingBlocks(x), PrintString(UnderlyingBipartition(x)), + MaxFloatingBlocks(x)); +end); + +InstallMethod(PrintString, "for a twisted bipartition", +[IsTwistedBipartition], +function(x) + if IsZero(x) then + return StringFormatted("ZeroTwistedBipartition({}, {})", + DegreeOfTwistedBipartition(x), MaxFloatingBlocks(x)); + fi; + return StringFormatted("TwistedBipartition({}, {}, {})", + NrFloatingBlocks(x), PrintString(UnderlyingBipartition(x)), + MaxFloatingBlocks(x)); +end); + InstallMethod(RandomNonZeroTwistedBipartition, "for a degree and max. floating blocks", [IsInt, IsInt], function(n, d) @@ -258,6 +292,24 @@ function(x, y) return TwistedBipartition(floaters, xx * yy, MaxFloatingBlocks(x)); end); +InstallMethod(\*, "for twisted bipartition and a permutation", +[IsTwistedBipartition, IsPerm], {x, y} -> TwistedBipartition(NrFloatingBlocks(x), UnderlyingBipartition(x)*y, MaxFloatingBlocks(x))); +InstallMethod(\*, "for a permutation and twisted bipartition", +[IsPerm, IsTwistedBipartition], {x, y} -> TwistedBipartition(NrFloatingBlocks(y), x*UnderlyingBipartition(y), MaxFloatingBlocks(y))); + +InstallMethod(\*, "for twisted bipartition and a transformation", +[IsTwistedBipartition, IsTransformation], {x, y} -> TwistedBipartition(NrFloatingBlocks(x), UnderlyingBipartition(x)*y, MaxFloatingBlocks(x))); +InstallMethod(\*, "for a transformation and twisted bipartition", +[IsTransformation, IsTwistedBipartition], {x, y} -> TwistedBipartition(NrFloatingBlocks(y), x*UnderlyingBipartition(y), MaxFloatingBlocks(y))); + +InstallMethod(\*, "for twisted bipartition and a partial permutation", +[IsTwistedBipartition, IsPartialPerm], {x, y} -> TwistedBipartition(NrFloatingBlocks(x), UnderlyingBipartition(x)*y, MaxFloatingBlocks(x))); +InstallMethod(\*, "for a partial permutation and twisted bipartition", +[IsPartialPerm, IsTwistedBipartition], {x, y} -> TwistedBipartition(NrFloatingBlocks(y), x*UnderlyingBipartition(y), MaxFloatingBlocks(y))); + +InstallMethod(\^, "for twisted bipartition and a permutation", +[IsTwistedBipartition, IsPerm], {x, y} -> TwistedBipartition(NrFloatingBlocks(x), UnderlyingBipartition(x)^y, MaxFloatingBlocks(x))); + InstallMethod(\=, "for twisted bipartition", IsIdenticalObj, [IsTwistedBipartition, IsTwistedBipartition], function(x, y) @@ -307,6 +359,8 @@ end); InstallMethod(DegreeOfBipartition, "for a twisted bipartition", [IsTwistedBipartition], x -> DegreeOfBipartition(UnderlyingBipartition(x))); +InstallMethod(DegreeOfTwistedBipartitionCollection, "for a twisted bipartition collection", +[IsTwistedBipartitionCollection], x -> DegreeOfBipartitionCollection(UnderlyingBipartitionCollection(x))); InstallMethod(NrBlocks, "for a twisted bipartition", [IsTwistedBipartition], x -> NrBlocks(UnderlyingBipartition(x))); @@ -325,4 +379,294 @@ InstallMethod(RankOfBipartition, "for a twisted bipartition", InstallMethod(DomainOfBipartition, "for a twisted bipartition", [IsTwistedBipartition], x -> DomainOfBipartition(UnderlyingBipartition(x))); InstallMethod(CodomainOfBipartition, "for a twisted bipartition", -[IsTwistedBipartition], x -> DomainOfBipartition(UnderlyingBipartition(x))); \ No newline at end of file +[IsTwistedBipartition], x -> DomainOfBipartition(UnderlyingBipartition(x))); + +InstallMethod(NrTransverseBlocks, "for a twisted bipartition", +[IsTwistedBipartition], x -> NrTransverseBlocks(UnderlyingBipartition(x))); + +InstallMethod(OneMutable, +"for a twisted bipartition and max. floating blocks (d)", +[IsTwistedBipartition, IsInt], +function(x, d) + if d < 0 then + ErrorNoReturn("the maximum number of floating blocks must be non-negative"); + fi; + return TwistedBipartition(0, IdentityBipartition(DegreeOfBipartition(x)), d); +end); + +InstallMethod(OneMutable, +"for a twisted bipartition collection and max. floating blocks (d)", +[IsTwistedBipartitionCollection, IsInt], +function(x, d) + if d < 0 then + ErrorNoReturn("the maximum number of floating blocks must be non-negative"); + fi; + return TwistedBipartition(0, IdentityBipartition(DegreeOfBipartitionCollection(x)), d); +end); + +# Properties + +InstallMethod(IsBlockBijection, "for a twisted bipartition", +[IsTwistedBipartition], x -> IsBlockBijection(UnderlyingBipartition(x))); + +InstallMethod(IsPartialPermBipartition, "for a twisted bipartition", +[IsTwistedBipartition], x -> IsPartialPermBipartition(UnderlyingBipartition(x))); + +InstallMethod(IsTransBipartition, "for a twisted bipartition", +[IsTwistedBipartition], x -> IsTransBipartition(UnderlyingBipartition(x))); + +InstallMethod(IsDualTransBipartition, "for a twisted bipartition", +[IsTwistedBipartition], x -> IsDualTransBipartition(UnderlyingBipartition(x))); + +InstallMethod(IsPermBipartition, "for a twisted bipartition", +[IsTwistedBipartition], x -> IsPermBipartition(UnderlyingBipartition(x))); + +# Changing representations + +InstallMethod(AsTwistedBipartition, +"for number of floating blocks, a permutation, a zero and max. floating blocks (d)", +[IsInt, IsPerm, IsZeroCyc, IsInt], +function(i, f, n, d) + if d < 0 then + ErrorNoReturn("the maximum number of floating blocks must be non-negative"); + fi; + if i < 0 then + ErrorNoReturn("the number of floating blocks must be non-negative"); + elif i > d then + ErrorNoReturn("the number of floating blocks cannot exceed the maximum number of floating blocks"); + fi; + return TwistedBipartition(i, AsBipartition(f, n), d); +end); + +InstallMethod(AsTwistedBipartition, +"for number of floating blocks, a permutation and max. floating blocks (d)", +[IsInt, IsPerm, IsInt], +function(i, f, d) + if d < 0 then + ErrorNoReturn("the maximum number of floating blocks must be non-negative"); + fi; + if i < 0 then + ErrorNoReturn("the number of floating blocks must be non-negative"); + elif i > d then + ErrorNoReturn("the number of floating blocks cannot exceed the maximum number of floating blocks"); + fi; + return TwistedBipartition(i, AsBipartition(f), d); +end); + +InstallMethod(AsTwistedBipartition, +"for number of floating blocks, a permutation, a positive integer and max. floating blocks (d)", +[IsInt, IsPerm, IsPosInt, IsInt], +function(i, f, n, d) + if d < 0 then + ErrorNoReturn("the maximum number of floating blocks must be non-negative"); + fi; + if i < 0 then + ErrorNoReturn("the number of floating blocks must be non-negative"); + elif i > d then + ErrorNoReturn("the number of floating blocks cannot exceed the maximum number of floating blocks"); + fi; + return TwistedBipartition(i, AsBipartition(f, n), d); +end); + +InstallMethod(AsTwistedBipartition, +"for number of floating blocks, a partial permutation and max. floating blocks (d)", +[IsInt, IsPartialPerm, IsInt], +function(i, f, d) + if d < 0 then + ErrorNoReturn("the maximum number of floating blocks must be non-negative"); + fi; + if i < 0 then + ErrorNoReturn("the number of floating blocks must be non-negative"); + elif i > d then + ErrorNoReturn("the number of floating blocks cannot exceed the maximum number of floating blocks"); + fi; + return TwistedBipartition(i, AsBipartition(f), d); +end); + +InstallMethod(AsTwistedBipartition, +"for number of floating blocks, a partial permutation, a positive integer and max. floating blocks (d)", +[IsInt, IsPartialPerm, IsPosInt, IsInt], +function(i, f, n, d) + if d < 0 then + ErrorNoReturn("the maximum number of floating blocks must be non-negative"); + fi; + if i < 0 then + ErrorNoReturn("the number of floating blocks must be non-negative"); + elif i > d then + ErrorNoReturn("the number of floating blocks cannot exceed the maximum number of floating blocks"); + fi; + return TwistedBipartition(i, AsBipartition(f, n), d); +end); + +InstallMethod(AsTwistedBipartition, +"for number of floating blocks, a partial permutation, a zero and max. floating blocks (d)", +[IsInt, IsPartialPerm, IsZeroCyc, IsInt], +function(i, f, n, d) + if d < 0 then + ErrorNoReturn("the maximum number of floating blocks must be non-negative"); + fi; + if i < 0 then + ErrorNoReturn("the number of floating blocks must be non-negative"); + elif i > d then + ErrorNoReturn("the number of floating blocks cannot exceed the maximum number of floating blocks"); + fi; + return TwistedBipartition(i, AsBipartition(f, n), d); +end); + +InstallMethod(AsTwistedBipartition, +"for number of floating blocks, a transformation and max. floating blocks (d)", +[IsInt, IsTransformation, IsInt], +function(i, f, d) + if d < 0 then + ErrorNoReturn("the maximum number of floating blocks must be non-negative"); + fi; + if i < 0 then + ErrorNoReturn("the number of floating blocks must be non-negative"); + elif i > d then + ErrorNoReturn("the number of floating blocks cannot exceed the maximum number of floating blocks"); + fi; + return TwistedBipartition(i, AsBipartition(f), d); +end); + +InstallMethod(AsTwistedBipartition, +"for number of floating blocks, a transformation, a zero and max. floating blocks (d)", +[IsInt, IsTransformation, IsPosInt, IsInt], +function(i, f, n, d) + if d < 0 then + ErrorNoReturn("the maximum number of floating blocks must be non-negative"); + fi; + if i < 0 then + ErrorNoReturn("the number of floating blocks must be non-negative"); + elif i > d then + ErrorNoReturn("the number of floating blocks cannot exceed the maximum number of floating blocks"); + fi; + return TwistedBipartition(i, AsBipartition(f, n), d); +end); + +InstallMethod(AsTwistedBipartition, +"for number of floating blocks, a transformation, a zero and max. floating blocks (d)", +[IsInt, IsTransformation, IsZeroCyc, IsInt], +function(i, f, n, d) + if d < 0 then + ErrorNoReturn("the maximum number of floating blocks must be non-negative"); + fi; + if i < 0 then + ErrorNoReturn("the number of floating blocks must be non-negative"); + elif i > d then + ErrorNoReturn("the number of floating blocks cannot exceed the maximum number of floating blocks"); + fi; + return TwistedBipartition(i, AsBipartition(f, n), d); +end); + +InstallMethod(AsTwistedBipartition, +"for number of floating blocks, a bipartition and max. floating blocks (d)", +[IsInt, IsBipartition, IsInt], +function(i, f, d) + if d < 0 then + ErrorNoReturn("the maximum number of floating blocks must be non-negative"); + fi; + if i < 0 then + ErrorNoReturn("the number of floating blocks must be non-negative"); + elif i > d then + ErrorNoReturn("the number of floating blocks cannot exceed the maximum number of floating blocks"); + fi; + return TwistedBipartition(i, AsBipartition(f), d); +end); + +InstallMethod(AsTwistedBipartition, +"for number of floating blocks, a bipartition, a positive integer and max. floating blocks (d)", +[IsInt, IsBipartition, IsPosInt, IsInt], +function(i, f, n, d) + if d < 0 then + ErrorNoReturn("the maximum number of floating blocks must be non-negative"); + fi; + if i < 0 then + ErrorNoReturn("the number of floating blocks must be non-negative"); + elif i > d then + ErrorNoReturn("the number of floating blocks cannot exceed the maximum number of floating blocks"); + fi; + return TwistedBipartition(i, AsBipartition(f, n), d); +end); + +InstallMethod(AsTwistedBipartition, +"for a twisted bipartition and a positive integer", +[IsTwistedBipartition, IsPosInt], {x, n} -> TwistedBipartition(NrFloatingBlocks(x), AsBipartition(UnderlyingBipartition(x), n), MaxFloatingBlocks(x))); + +InstallMethod(AsTwistedBipartition, "for a twisted bipartition", [IsTwistedBipartition], IdFunc); + +InstallMethod(AsTwistedBipartition, +"for number of floating blocks, a bipartition, a zero and max. floating blocks (d)", +[IsInt, IsBipartition, IsZeroCyc, IsInt], +function(i, f, n, d) + if d < 0 then + ErrorNoReturn("the maximum number of floating blocks must be non-negative"); + fi; + if i < 0 then + ErrorNoReturn("the number of floating blocks must be non-negative"); + elif i > d then + ErrorNoReturn("the number of floating blocks cannot exceed the maximum number of floating blocks"); + fi; + return TwistedBipartition(i, AsBipartition(f, n), d); +end); + +# InstallMethod(AsTwistedBipartition, +# "for number of floating blocks, a partitioned binary relation, a zero and max. floating blocks (d)", +# [IsInt, IsPBR, IsZeroCyc, IsInt], +# function(i, f, n, d) +# if d < 0 then +# ErrorNoReturn("the maximum number of floating blocks must be non-negative"); +# fi; +# if i < 0 then +# ErrorNoReturn("the number of floating blocks must be non-negative"); +# elif i > d then +# ErrorNoReturn("the number of floating blocks cannot exceed the maximum number of floating blocks"); +# fi; +# return TwistedBipartition(i, AsBipartition(f, n), d); +# end); + +# InstallMethod(AsTwistedBipartition, +# "for number of floating blocks, a partitioned binary relation, a positive integer and max. floating blocks (d)", +# [IsInt, IsPBR, IsPosInt, IsInt], +# function(i, f, n, d) +# if d < 0 then +# ErrorNoReturn("the maximum number of floating blocks must be non-negative"); +# fi; +# if i < 0 then +# ErrorNoReturn("the number of floating blocks must be non-negative"); +# elif i > d then +# ErrorNoReturn("the number of floating blocks cannot exceed the maximum number of floating blocks"); +# fi; +# return TwistedBipartition(i, AsBipartition(f, n), d); +# end); + +# InstallMethod(AsTwistedBipartition, +# "for number of floating blocks, a partitioned binary relation and max. floating blocks (d)", +# [IsInt, IsPBR, IsInt], +# function(i, f, d) +# if d < 0 then +# ErrorNoReturn("the maximum number of floating blocks must be non-negative"); +# fi; +# if i < 0 then +# ErrorNoReturn("the number of floating blocks must be non-negative"); +# elif i > d then +# ErrorNoReturn("the number of floating blocks cannot exceed the maximum number of floating blocks"); +# fi; +# return TwistedBipartition(i, AsBipartition(f), d); +# end); + +InstallMethod(AsPartialPerm, "for a twisted bipartition", +[IsTwistedBipartition], x -> AsPartialPerm(UnderlyingBipartition(x))); + +InstallMethod(AsPermutation, "for a twisted bipartition", +[IsTwistedBipartition], x -> AsPermutation(UnderlyingBipartition(x))); + +InstallMethod(AsTransformation, "for a twisted bipartition", +[IsTwistedBipartition], x -> AsTransformation(UnderlyingBipartition(x))); + +InstallMethod(AsBlockBijection, "for a twisted bipartition and positive integer", +[IsTwistedBipartition, IsPosInt], {x, n} -> AsBlockBijection(UnderlyingBipartition(x), n)); +InstallMethod(AsBlockBijection, "for a twisted bipartition", +[IsTwistedBipartition], x -> AsBlockBijection(UnderlyingBipartition(x))); + +InstallMethod(IsUniformBlockBijection, "for a twisted bipartition", +[IsTwistedBipartition], x -> IsUniformBlockBijection(UnderlyingBipartition(x))); \ No newline at end of file From 46df7005870433a32ced124281ab093e0f6f54c0 Mon Sep 17 00:00:00 2001 From: Matthias Fresacher K2 Date: Fri, 15 Aug 2025 11:00:04 +1000 Subject: [PATCH 08/10] Started adding twisted bipartition semigroup examples --- gap/semigroups/semiex.gd | 59 +++++++++ gap/semigroups/semiex.gi | 269 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 328 insertions(+) diff --git a/gap/semigroups/semiex.gd b/gap/semigroups/semiex.gd index fb262d845..8761d9d0a 100644 --- a/gap/semigroups/semiex.gd +++ b/gap/semigroups/semiex.gd @@ -7,6 +7,34 @@ ## ############################################################################# ## +## +## In collaboration with +## +############################################## +## ## +## Code created ## +## by ## +## *--------------------* ## +## | Matthias Fresacher | ## +## *--------------------* ## +## ## +############################################## + +# *------------------------------* +# |``````````````````````````````| +# |`````____````____`````````````| +# |````|MFMF\ /MFMF|````````````| +# |````|MF|MF\/MF|MF|````````````| +# |````|MF|\MFMF/|MF|_______`````| +# |````|MF|``````|MFMFMFMFMF|````| +# |````|MF|``````|MF|````````````| +# |````|MF|``````|MF|___`````````| +# |``````````````|MFMFMF|````````| +# |``````````````|MF|````````````| +# |``````````````|MF|````````````| +# |``````````````|MF|````````````| +# |``````````````````````````````| +# *------------------------------* # Transformation semigroups DeclareOperation("EndomorphismsPartition", [IsCyclotomicCollection]); @@ -74,6 +102,37 @@ DeclareOperation("SingularPlanarPartitionMonoid", [IsPosInt]); DeclareOperation("ModularPartitionMonoid", [IsPosInt, IsPosInt]); DeclareOperation("SingularModularPartitionMonoid", [IsPosInt, IsPosInt]); +# Twisted bipartition semigroups + +DeclareOperation("TwistedBipartitionMonoid", [IsBipartitionMonoid, IsInt]); +DeclareOperation("TwistedBipartitionSemigroup", [IsBipartitionSemigroup, IsInt]); + +DeclareOperation("TwistedPartitionMonoid", [IsInt, IsInt]); + +DeclareOperation("TwistedDualSymmetricInverseMonoid", [IsInt, IsInt]); +DeclareOperation("TwistedPartialDualSymmetricInverseMonoid", [IsInt, IsInt]); + +DeclareOperation("TwistedBrauerMonoid", [IsInt, IsInt]); +DeclareOperation("TwistedPartialBrauerMonoid", [IsInt, IsInt]); + +DeclareOperation("TwistedJonesMonoid", [IsInt, IsInt]); +DeclareSynonym("TwistedTemperleyLiebMonoid", TwistedJonesMonoid); +DeclareOperation("TwistedAnnularJonesMonoid", [IsInt, IsInt]); +DeclareOperation("TwistedPartialJonesMonoid", [IsInt, IsInt]); + +DeclareOperation("TwistedMotzkinMonoid", [IsInt, IsInt]); + +DeclareOperation("TwistedPlanarUniformBlockBijectionMonoid", [IsPosInt, IsInt]); + + + + + + + + + + # Matrix over finite field semigroups DeclareOperation("GeneralLinearMonoid", [IsPosInt, IsPosInt]); diff --git a/gap/semigroups/semiex.gi b/gap/semigroups/semiex.gi index 67696fefe..af87f89ab 100644 --- a/gap/semigroups/semiex.gi +++ b/gap/semigroups/semiex.gi @@ -7,6 +7,34 @@ ## ############################################################################# ## +## +## In collaboration with +## +############################################## +## ## +## Code created ## +## by ## +## *--------------------* ## +## | Matthias Fresacher | ## +## *--------------------* ## +## ## +############################################## + +# *------------------------------* +# |``````````````````````````````| +# |`````____````____`````````````| +# |````|MFMF\ /MFMF|````````````| +# |````|MF|MF\/MF|MF|````````````| +# |````|MF|\MFMF/|MF|_______`````| +# |````|MF|``````|MFMFMFMFMF|````| +# |````|MF|``````|MF|````````````| +# |````|MF|``````|MF|___`````````| +# |``````````````|MFMFMF|````````| +# |``````````````|MF|````````````| +# |``````````````|MF|````````````| +# |``````````````|MF|````````````| +# |``````````````````````````````| +# *------------------------------* # for testing purposes @@ -496,6 +524,50 @@ function(n) return Monoid(gens, rec(acting := false)); end); +InstallMethod(TwistedBipartitionMonoid, "for a bipartition monoid and max. floating blocks", [IsBipartitionMonoid, IsInt], +function(M, d) + local gens, MTwist; + + if d < 0 then + ErrorNoReturn("the maximum number of floating blocks must be non-negative"); + fi; + + gens := List(GeneratorsOfMonoid(M), x -> AsTwistedBipartition(0, x, d)); + if d >= 1 then + Add(gens, TwistedBipartition(1, One(UnderlyingBipartition(gens[1])), d)); + fi; + + MTwist := Monoid(gens); + + # TODO Not sure if these are needed + # SetFilterObj(MTwist, IsRegularActingSemigroupRep); + # SetIsStarSemigroup(MTwist, true); + SetSize(MTwist, Size(M) * (d + 1) + 1); + return MTwist; +end); + +InstallMethod(TwistedBipartitionSemigroup, "for a bipartition semigroup and max. floating blocks", [IsBipartitionSemigroup, IsInt], +function(S, d) + local gens, STwist; + + if d < 0 then + ErrorNoReturn("the maximum number of floating blocks must be non-negative"); + fi; + + gens := List(GeneratorsOfSemigroup(S), x -> AsTwistedBipartition(0, x, d)); + if d >= 1 then + Add(gens, TwistedBipartition(1, One(UnderlyingBipartition(gens[1])), d)); + fi; + + STwist := Semigroup(gens); + + # TODO Not sure if these are needed + # SetFilterObj(STwist, IsRegularActingSemigroupRep); + # SetIsStarSemigroup(STwist, true); + SetSize(STwist, Size(S) * (d + 1) + 1); + return STwist; +end); + InstallMethod(PartitionMonoid, "for an integer", [IsInt], function(n) local gens, M; @@ -520,6 +592,25 @@ function(n) return M; end); +InstallMethod(TwistedPartitionMonoid, "for degree and max. floating blocks", [IsInt, IsInt], +function(n, d) + local M; + + if n < 0 then + ErrorNoReturn("the degree (an integer) is not >= 0"); + fi; + if d < 0 then + ErrorNoReturn("the maximum number of floating blocks must be non-negative"); + fi; + + M := TwistedBipartitionMonoid(PartitionMonoid(n), d); + + # TODO Not sure if these are needed, if not, can get rid of local M and just have above line in return + # SetFilterObj(M, IsRegularActingSemigroupRep); + # SetIsStarSemigroup(M, true); + return M; +end); + InstallMethod(DualSymmetricInverseMonoid, "for an integer", [IsInt], function(n) local gens; @@ -543,6 +634,25 @@ function(n) return InverseMonoid(gens); end); +InstallMethod(TwistedDualSymmetricInverseMonoid, "for degree and max. floating blocks", [IsInt, IsInt], +function(n, d) + local M; + + if n < 0 then + ErrorNoReturn("the degree (an integer) is not >= 0"); + fi; + if d < 0 then + ErrorNoReturn("the maximum number of floating blocks must be non-negative"); + fi; + + M := TwistedBipartitionMonoid(DualSymmetricInverseMonoid(n), d); + + # TODO Not sure if these are needed, if not, can get rid of local M and just have above line in return + # SetFilterObj(M, IsRegularActingSemigroupRep); + # SetIsStarSemigroup(M, true); + return M; +end); + InstallMethod(PartialDualSymmetricInverseMonoid, "for an integer", [IsInt], function(n) local gens; @@ -564,6 +674,25 @@ function(n) return InverseMonoid(gens); end); +InstallMethod(TwistedPartialDualSymmetricInverseMonoid, "for degree and max. floating blocks", [IsInt, IsInt], +function(n, d) + local M; + + if n < 0 then + ErrorNoReturn("the degree (an integer) is not >= 0"); + fi; + if d < 0 then + ErrorNoReturn("the maximum number of floating blocks must be non-negative"); + fi; + + M := TwistedBipartitionMonoid(PartialDualSymmetricInverseMonoid(n), d); + + # TODO Not sure if these are needed, if not, can get rid of local M and just have above line in return + # SetFilterObj(M, IsRegularActingSemigroupRep); + # SetIsStarSemigroup(M, true); + return M; +end); + InstallMethod(BrauerMonoid, "for an integer", [IsInt], function(n) local gens, M; @@ -586,6 +715,25 @@ function(n) return M; end); +InstallMethod(TwistedBrauerMonoid, "for degree and max. floating blocks", [IsInt, IsInt], +function(n, d) + local M; + + if n < 0 then + ErrorNoReturn("the degree (an integer) is not >= 0"); + fi; + if d < 0 then + ErrorNoReturn("the maximum number of floating blocks must be non-negative"); + fi; + + M := TwistedBipartitionMonoid(BrauerMonoid(n), d); + + # TODO Not sure if these are needed, if not, can get rid of local M and just have above line in return + # SetFilterObj(M, IsRegularActingSemigroupRep); + # SetIsStarSemigroup(M, true); + return M; +end); + InstallMethod(PartialBrauerMonoid, "for an integer", [IsInt], function(n) local S; @@ -602,6 +750,25 @@ function(n) return S; end); +InstallMethod(TwistedPartialBrauerMonoid, "for degree and max. floating blocks", [IsInt, IsInt], +function(n, d) + local M; + + if n < 0 then + ErrorNoReturn("the degree (an integer) is not >= 0"); + fi; + if d < 0 then + ErrorNoReturn("the maximum number of floating blocks must be non-negative"); + fi; + + M := TwistedBipartitionMonoid(PartialBrauerMonoid(n), d); + + # TODO Not sure if these are needed, if not, can get rid of local M and just have above line in return + # SetFilterObj(M, IsRegularActingSemigroupRep); + # SetIsStarSemigroup(M, true); + return M; +end); + InstallMethod(JonesMonoid, "for an integer", [IsInt], function(n) @@ -633,6 +800,25 @@ function(n) return M; end); +InstallMethod(TwistedJonesMonoid, "for degree and max. floating blocks", [IsInt, IsInt], +function(n, d) + local M; + + if n < 0 then + ErrorNoReturn("the degree (an integer) is not >= 0"); + fi; + if d < 0 then + ErrorNoReturn("the maximum number of floating blocks must be non-negative"); + fi; + + M := TwistedBipartitionMonoid(JonesMonoid(n), d); + + # TODO Not sure if these are needed, if not, can get rid of local M and just have above line in return + # SetFilterObj(M, IsRegularActingSemigroupRep); + # SetIsStarSemigroup(M, true); + return M; +end); + InstallMethod(AnnularJonesMonoid, "for an integer", [IsInt], function(n) local p, x, M, j; @@ -657,6 +843,25 @@ function(n) return M; end); +InstallMethod(TwistedAnnularJonesMonoid, "for degree and max. floating blocks", [IsInt, IsInt], +function(n, d) + local M; + + if n < 0 then + ErrorNoReturn("the degree (an integer) is not >= 0"); + fi; + if d < 0 then + ErrorNoReturn("the maximum number of floating blocks must be non-negative"); + fi; + + M := TwistedBipartitionMonoid(AnnularJonesMonoid(n), d); + + # TODO Not sure if these are needed, if not, can get rid of local M and just have above line in return + # SetFilterObj(M, IsRegularActingSemigroupRep); + # SetIsStarSemigroup(M, true); + return M; +end); + InstallMethod(PartialJonesMonoid, "for an integer", [IsInt], function(n) @@ -689,6 +894,25 @@ function(n) return M; end); +InstallMethod(TwistedPartialJonesMonoid, "for degree and max. floating blocks", [IsInt, IsInt], +function(n, d) + local M; + + if n < 0 then + ErrorNoReturn("the degree (an integer) is not >= 0"); + fi; + if d < 0 then + ErrorNoReturn("the maximum number of floating blocks must be non-negative"); + fi; + + M := TwistedBipartitionMonoid(PartialJonesMonoid(n), d); + + # TODO Not sure if these are needed, if not, can get rid of local M and just have above line in return + # SetFilterObj(M, IsRegularActingSemigroupRep); + # SetIsStarSemigroup(M, true); + return M; +end); + InstallMethod(MotzkinMonoid, "for an integer", [IsInt], function(n) @@ -708,6 +932,25 @@ function(n) return M; end); +InstallMethod(TwistedMotzkinMonoid, "for degree and max. floating blocks", [IsInt, IsInt], +function(n, d) + local M; + + if n < 0 then + ErrorNoReturn("the degree (an integer) is not >= 0"); + fi; + if d < 0 then + ErrorNoReturn("the maximum number of floating blocks must be non-negative"); + fi; + + M := TwistedBipartitionMonoid(MotzkinMonoid(n), d); + + # TODO Not sure if these are needed, if not, can get rid of local M and just have above line in return + # SetFilterObj(M, IsRegularActingSemigroupRep); + # SetIsStarSemigroup(M, true); + return M; +end); + InstallMethod(POI, "for a positive integer", [IsPosInt], function(n) local out, i; @@ -786,6 +1029,32 @@ function(n) return InverseMonoid(gens); end); +InstallMethod(TwistedPlanarUniformBlockBijectionMonoid, "for a positive integer and max. floating blocks", [IsPosInt, IsInt], +function(n, d) + local M; + + if n < 0 then + ErrorNoReturn("the degree (an integer) is not >= 0"); + fi; + if d < 0 then + ErrorNoReturn("the maximum number of floating blocks must be non-negative"); + fi; + + M := TwistedBipartitionMonoid(PlanarUniformBlockBijectionMonoid(n), d); + + # TODO Not sure if these are needed, if not, can get rid of local M and just have above line in return + # SetFilterObj(M, IsRegularActingSemigroupRep); + # SetIsStarSemigroup(M, true); + return M; +end); + + + + + + +### START HERE + InstallMethod(UniformBlockBijectionMonoid, "for a positive integer", [IsPosInt], function(n) From 33a5419ca7719cd670bb62134f88f8d24b39e475 Mon Sep 17 00:00:00 2001 From: Matthias Fresacher K2 Date: Fri, 22 Aug 2025 08:48:56 +1000 Subject: [PATCH 09/10] Finished adding twisted bipartition semigroup examples --- gap/semigroups/semiex.gd | 25 ++- gap/semigroups/semiex.gi | 434 ++++++++++++++++++++++++++++++++++++++- 2 files changed, 451 insertions(+), 8 deletions(-) diff --git a/gap/semigroups/semiex.gd b/gap/semigroups/semiex.gd index 8761d9d0a..299feee1f 100644 --- a/gap/semigroups/semiex.gd +++ b/gap/semigroups/semiex.gd @@ -123,7 +123,30 @@ DeclareOperation("TwistedPartialJonesMonoid", [IsInt, IsInt]); DeclareOperation("TwistedMotzkinMonoid", [IsInt, IsInt]); DeclareOperation("TwistedPlanarUniformBlockBijectionMonoid", [IsPosInt, IsInt]); - +DeclareOperation("TwistedUniformBlockBijectionMonoid", [IsPosInt, IsInt]); +DeclareOperation("TwistedPartialUniformBlockBijectionMonoid", [IsPosInt, IsInt]); +DeclareOperation("TwistedRookPartitionMonoid", [IsPosInt, IsInt]); + +DeclareOperation("TwistedApsisMonoid", [IsPosInt, IsPosInt, IsInt]); +DeclareOperation("TwistedCrossedApsisMonoid", [IsPosInt, IsPosInt, IsInt]); + +DeclareOperation("TwistedPlanarModularPartitionMonoid", [IsPosInt, IsPosInt, IsInt]); +DeclareOperation("TwistedPlanarPartitionMonoid", [IsPosInt, IsInt]); + +DeclareOperation("TwistedModularPartitionMonoid", [IsPosInt, IsPosInt, IsInt]); + +DeclareOperation("TwistedSingularPartitionMonoid", [IsPosInt, IsInt]); +DeclareOperation("TwistedSingularBrauerMonoid", [IsPosInt, IsInt]); +DeclareOperation("TwistedSingularJonesMonoid", [IsPosInt, IsInt]); +DeclareSynonym("TwistedSingularTemperleyLiebMonoid", TwistedSingularJonesMonoid); +DeclareOperation("TwistedSingularDualSymmetricInverseMonoid", [IsPosInt, IsInt]); +DeclareOperation("TwistedSingularPlanarUniformBlockBijectionMonoid", [IsPosInt, IsInt]); +DeclareOperation("TwistedSingularUniformBlockBijectionMonoid", [IsPosInt, IsInt]); +DeclareOperation("TwistedSingularApsisMonoid", [IsPosInt, IsPosInt, IsInt]); +DeclareOperation("TwistedSingularCrossedApsisMonoid", [IsPosInt, IsPosInt, IsInt]); +DeclareOperation("TwistedSingularPlanarModularPartitionMonoid", [IsPosInt, IsPosInt, IsInt]); +DeclareOperation("TwistedSingularPlanarPartitionMonoid", [IsPosInt, IsInt]); +DeclareOperation("TwistedSingularModularPartitionMonoid", [IsPosInt, IsPosInt, IsInt]); diff --git a/gap/semigroups/semiex.gi b/gap/semigroups/semiex.gi index af87f89ab..b77c627c5 100644 --- a/gap/semigroups/semiex.gi +++ b/gap/semigroups/semiex.gi @@ -1048,13 +1048,6 @@ function(n, d) return M; end); - - - - - -### START HERE - InstallMethod(UniformBlockBijectionMonoid, "for a positive integer", [IsPosInt], function(n) @@ -1069,6 +1062,22 @@ function(n) return InverseMonoid(gens); end); +InstallMethod(TwistedUniformBlockBijectionMonoid, "for a positive integer and max. floating blocks", [IsPosInt, IsInt], +function(n, d) + local M; + + if d < 0 then + ErrorNoReturn("the maximum number of floating blocks must be non-negative"); + fi; + + M := TwistedBipartitionMonoid(UniformBlockBijectionMonoid(n), d); + + # TODO Not sure if these are needed, if not, can get rid of local M and just have above line in return + # SetFilterObj(M, IsRegularActingSemigroupRep); + # SetIsStarSemigroup(M, true); + return M; +end); + InstallMethod(PartialUniformBlockBijectionMonoid, "for a positive integer", [IsPosInt], function(n) @@ -1087,6 +1096,22 @@ function(n) return InverseMonoid(gens); end); +InstallMethod(TwistedPartialUniformBlockBijectionMonoid, "for a positive integer and max. floating blocks", [IsPosInt, IsInt], +function(n, d) + local M; + + if d < 0 then + ErrorNoReturn("the maximum number of floating blocks must be non-negative"); + fi; + + M := TwistedBipartitionMonoid(PartialUniformBlockBijectionMonoid(n), d); + + # TODO Not sure if these are needed, if not, can get rid of local M and just have above line in return + # SetFilterObj(M, IsRegularActingSemigroupRep); + # SetIsStarSemigroup(M, true); + return M; +end); + InstallMethod(RookPartitionMonoid, "for a positive integer", [IsPosInt], function(n) local S; @@ -1098,11 +1123,32 @@ function(n) return S; end); +InstallMethod(TwistedRookPartitionMonoid, "for a positive integer and max. floating blocks", [IsPosInt, IsInt], +function(n, d) + local M; + + if d < 0 then + ErrorNoReturn("the maximum number of floating blocks must be non-negative"); + fi; + + M := TwistedBipartitionMonoid(RookPartitionMonoid(n), d); + + # TODO Not sure if these are needed, if not, can get rid of local M and just have above line in return + # SetFilterObj(M, IsRegularActingSemigroupRep); + # SetIsStarSemigroup(M, true); + return M; +end); + InstallMethod(ApsisMonoid, "for a positive integer and positive integer", [IsPosInt, IsPosInt], function(m, n) local gens, next, S, b, i, j; + + if m > n then + ErrorNoReturn("the 1st argument (a pos. int.) is not <= to the ", + "2nd argument (a pos. int.)"); + fi; if n = 1 and m = 1 then return InverseMonoid(Bipartition([[1], [-1]])); @@ -1160,11 +1206,37 @@ function(m, n) return S; end); +InstallMethod(TwistedApsisMonoid, "for a positive integer, for a positive integer and max. floating blocks", [IsPosInt, IsPosInt, IsInt], +function(m, n, d) + local M; + + if m > n then + ErrorNoReturn("the 1st argument (a pos. int.) is not <= to the ", + "2nd argument (a pos. int.)"); + fi; + + if d < 0 then + ErrorNoReturn("the maximum number of floating blocks must be non-negative"); + fi; + + M := TwistedBipartitionMonoid(ApsisMonoid(m, n), d); + + # TODO Not sure if these are needed, if not, can get rid of local M and just have above line in return + # SetFilterObj(M, IsRegularActingSemigroupRep); + # SetIsStarSemigroup(M, true); + return M; +end); + InstallMethod(CrossedApsisMonoid, "for a positive integer and positive integer", [IsPosInt, IsPosInt], function(m, n) local gens, S; + + if m > n then + ErrorNoReturn("the 1st argument (a pos. int.) is not <= to the ", + "2nd argument (a pos. int.)"); + fi; if n = 1 then if m = 1 then @@ -1187,6 +1259,27 @@ function(m, n) return S; end); +InstallMethod(TwistedCrossedApsisMonoid, "for a positive integer, for a positive integer and max. floating blocks", [IsPosInt, IsPosInt, IsInt], +function(m, n, d) + local M; + + if m > n then + ErrorNoReturn("the 1st argument (a pos. int.) is not <= to the ", + "2nd argument (a pos. int.)"); + fi; + + if d < 0 then + ErrorNoReturn("the maximum number of floating blocks must be non-negative"); + fi; + + M := TwistedBipartitionMonoid(CrossedApsisMonoid(m, n), d); + + # TODO Not sure if these are needed, if not, can get rid of local M and just have above line in return + # SetFilterObj(M, IsRegularActingSemigroupRep); + # SetIsStarSemigroup(M, true); + return M; +end); + InstallMethod(PlanarModularPartitionMonoid, "for a positive integer and positive integer", [IsPosInt, IsPosInt], @@ -1254,9 +1347,41 @@ function(m, n) return S; end); +InstallMethod(TwistedPlanarModularPartitionMonoid, "for a positive integer, for a positive integer and max. floating blocks", [IsPosInt, IsPosInt, IsInt], +function(m, n, d) + local M; + + if d < 0 then + ErrorNoReturn("the maximum number of floating blocks must be non-negative"); + fi; + + M := TwistedBipartitionMonoid(PlanarModularPartitionMonoid(m, n), d); + + # TODO Not sure if these are needed, if not, can get rid of local M and just have above line in return + # SetFilterObj(M, IsRegularActingSemigroupRep); + # SetIsStarSemigroup(M, true); + return M; +end); + InstallMethod(PlanarPartitionMonoid, "for a positive integer", [IsPosInt], n -> PlanarModularPartitionMonoid(1, n)); +InstallMethod(TwistedPlanarPartitionMonoid, "for a positive integer and max. floating blocks", [IsPosInt, IsInt], +function(n, d) + local M; + + if d < 0 then + ErrorNoReturn("the maximum number of floating blocks must be non-negative"); + fi; + + M := TwistedBipartitionMonoid(PlanarPartitionMonoid(n), d); + + # TODO Not sure if these are needed, if not, can get rid of local M and just have above line in return + # SetFilterObj(M, IsRegularActingSemigroupRep); + # SetIsStarSemigroup(M, true); + return M; +end); + InstallMethod(ModularPartitionMonoid, "for a positive integer and positive integer", [IsPosInt, IsPosInt], @@ -1281,6 +1406,22 @@ function(m, n) return S; end); +InstallMethod(TwistedModularPartitionMonoid, "for a positive integer, for a positive integer and max. floating blocks", [IsPosInt, IsPosInt, IsInt], +function(m, n, d) + local M; + + if d < 0 then + ErrorNoReturn("the maximum number of floating blocks must be non-negative"); + fi; + + M := TwistedBipartitionMonoid(ModularPartitionMonoid(m, n), d); + + # TODO Not sure if these are needed, if not, can get rid of local M and just have above line in return + # SetFilterObj(M, IsRegularActingSemigroupRep); + # SetIsStarSemigroup(M, true); + return M; +end); + InstallMethod(SingularPartitionMonoid, "for a positive integer", [IsPosInt], function(n) @@ -1297,6 +1438,33 @@ function(n) return SemigroupIdeal(PartitionMonoid(n), Bipartition(blocks)); end); +InstallMethod(TwistedSingularPartitionMonoid, "for a positive integer and max. floating blocks", [IsPosInt, IsInt], +function(n, d) + local blocks, gens, i; + + if d < 0 then + ErrorNoReturn("the maximum number of floating blocks must be non-negative"); + fi; + + if n = 1 then + gens := [TwistedBipartition(0, Bipartition([[1], [-1]]), d)]; + if d > 0 then + gens := Concatenation(gens, [TwistedBipartition(1, Bipartition([[1, -1]]), d)]); + fi; + return SemigroupIdeal(TwistedPartitionMonoid(1, d),gens); + fi; + + blocks := [[1, 2, -1, -2]]; + for i in [3 .. n] do + blocks[i - 1] := [i, -i]; + od; + gens := [TwistedBipartition(0, Bipartition(blocks), d)]; + if d > 0 then + gens := Concatenation(gens, [TwistedBipartition(1, One(Bipartition(blocks)), d)]); + fi; + return SemigroupIdeal(TwistedPartitionMonoid(n, d), gens); +end); + InstallMethod(SingularTransformationSemigroup, "for a positive integer", [IsPosInt], function(n) @@ -1339,6 +1507,29 @@ function(n) return SemigroupIdeal(S, x); end); +InstallMethod(TwistedSingularBrauerMonoid, "for a positive integer and max. floating blocks", [IsPosInt, IsInt], +function(n, d) + local blocks, gens, i; + + if d < 0 then + ErrorNoReturn("the maximum number of floating blocks must be non-negative"); + fi; + + if n = 1 then + ErrorNoReturn("the degree is too small (n > 1)"); + fi; + + blocks := [[1, 2], [-1, -2]]; + for i in [3 .. n] do + blocks[i] := [i, -i]; + od; + gens := [TwistedBipartition(0, Bipartition(blocks), d)]; + if d > 0 then + gens := Concatenation(gens, [TwistedBipartition(1, One(Bipartition(blocks)), d)]); + fi; + return SemigroupIdeal(TwistedBrauerMonoid(n, d), gens); +end); + InstallMethod(SingularJonesMonoid, "for a positive integer", [IsPosInt], function(n) @@ -1356,6 +1547,29 @@ function(n) return SemigroupIdeal(S, x); end); +InstallMethod(TwistedSingularJonesMonoid, "for a positive integer and max. floating blocks", [IsPosInt, IsInt], +function(n, d) + local blocks, gens, i; + + if d < 0 then + ErrorNoReturn("the maximum number of floating blocks must be non-negative"); + fi; + + if n = 1 then + ErrorNoReturn("the degree is too small (n > 1)"); + fi; + + blocks := [[1, 2], [-1, -2]]; + for i in [3 .. n] do + blocks[i] := [i, -i]; + od; + gens := [TwistedBipartition(0, Bipartition(blocks), d)]; + if d > 0 then + gens := Concatenation(gens, [TwistedBipartition(1, One(Bipartition(blocks)), d)]); + fi; + return SemigroupIdeal(TwistedJonesMonoid(n, d), gens); +end); + InstallMethod(SingularDualSymmetricInverseMonoid, "for a positive integer", [IsPosInt], function(n) @@ -1373,6 +1587,29 @@ function(n) return SemigroupIdeal(S, x); end); +InstallMethod(TwistedSingularDualSymmetricInverseMonoid, "for a positive integer and max. floating blocks", [IsPosInt, IsInt], +function(n, d) + local blocks, gens, i; + + if d < 0 then + ErrorNoReturn("the maximum number of floating blocks must be non-negative"); + fi; + + if n = 1 then + ErrorNoReturn("the degree is too small (n > 1)"); + fi; + + blocks := [[1, 2, -1, -2]]; + for i in [3 .. n] do + blocks[i - 1] := [i, -i]; + od; + gens := [TwistedBipartition(0, Bipartition(blocks), d)]; + if d > 0 then + gens := Concatenation(gens, [TwistedBipartition(1, One(Bipartition(blocks)), d)]); + fi; + return SemigroupIdeal(TwistedDualSymmetricInverseMonoid(n, d), gens); +end); + InstallMethod(SingularPlanarUniformBlockBijectionMonoid, "for a positive integer", [IsPosInt], function(n) @@ -1391,6 +1628,29 @@ function(n) return SemigroupIdeal(S, x); end); +InstallMethod(TwistedSingularPlanarUniformBlockBijectionMonoid, "for a positive integer and max. floating blocks", [IsPosInt, IsInt], +function(n, d) + local blocks, gens, i; + + if d < 0 then + ErrorNoReturn("the maximum number of floating blocks must be non-negative"); + fi; + + if n = 1 then + ErrorNoReturn("the degree is too small (n > 1)"); + fi; + + blocks := [[1, 2, -1, -2]]; + for i in [3 .. n] do + blocks[i - 1] := [i, -i]; + od; + gens := [TwistedBipartition(0, Bipartition(blocks), d)]; + if d > 0 then + gens := Concatenation(gens, [TwistedBipartition(1, One(Bipartition(blocks)), d)]); + fi; + return SemigroupIdeal(TwistedPlanarUniformBlockBijectionMonoid(n, d), gens); +end); + InstallMethod(SingularUniformBlockBijectionMonoid, "for a positive integer", [IsPosInt], function(n) @@ -1409,6 +1669,29 @@ function(n) return SemigroupIdeal(S, x); end); +InstallMethod(TwistedSingularUniformBlockBijectionMonoid, "for a positive integer and max. floating blocks", [IsPosInt, IsInt], +function(n, d) + local blocks, gens, i; + + if d < 0 then + ErrorNoReturn("the maximum number of floating blocks must be non-negative"); + fi; + + if n = 1 then + ErrorNoReturn("the degree is too small (n > 1)"); + fi; + + blocks := [[1, 2, -1, -2]]; + for i in [3 .. n] do + blocks[i - 1] := [i, -i]; + od; + gens := [TwistedBipartition(0, Bipartition(blocks), d)]; + if d > 0 then + gens := Concatenation(gens, [TwistedBipartition(1, One(Bipartition(blocks)), d)]); + fi; + return SemigroupIdeal(TwistedUniformBlockBijectionMonoid(n, d), gens); +end); + InstallMethod(SingularApsisMonoid, "for a positive integer and positive integer", [IsPosInt, IsPosInt], @@ -1429,6 +1712,29 @@ function(m, n) return SemigroupIdeal(S, x); end); +InstallMethod(TwistedSingularApsisMonoid, "for a positive integer, for a positive integer and max. floating blocks", [IsPosInt, IsPosInt, IsInt], +function(m, n, d) + local blocks, gens, i; + + if m > n then + ErrorNoReturn("the 1st argument (a pos. int.) is not <= to the ", + "2nd argument (a pos. int.)"); + fi; + if d < 0 then + ErrorNoReturn("the maximum number of floating blocks must be non-negative"); + fi; + + blocks := [[1 .. m], [-m .. -1]]; + for i in [m + 1 .. n] do + blocks[i - m + 2] := [i, -i]; + od; + gens := [TwistedBipartition(0, Bipartition(blocks), d)]; + if d > 0 then + gens := Concatenation(gens, [TwistedBipartition(1, One(Bipartition(blocks)), d)]); + fi; + return SemigroupIdeal(TwistedApsisMonoid(m, n, d), gens); +end); + InstallMethod(SingularCrossedApsisMonoid, "for a positive integer and positive integer", [IsPosInt, IsPosInt], @@ -1449,6 +1755,29 @@ function(m, n) return SemigroupIdeal(S, x); end); +InstallMethod(TwistedSingularCrossedApsisMonoid, "for a positive integer, for a positive integer and max. floating blocks", [IsPosInt, IsPosInt, IsInt], +function(m, n, d) + local blocks, gens, i; + + if m > n then + ErrorNoReturn("the 1st argument (a pos. int.) is not <= to the ", + "2nd argument (a pos. int.)"); + fi; + if d < 0 then + ErrorNoReturn("the maximum number of floating blocks must be non-negative"); + fi; + + blocks := [[1 .. m], [-m .. -1]]; + for i in [m + 1 .. n] do + blocks[i - m + 2] := [i, -i]; + od; + gens := [TwistedBipartition(0, Bipartition(blocks), d)]; + if d > 0 then + gens := Concatenation(gens, [TwistedBipartition(1, One(Bipartition(blocks)), d)]); + fi; + return SemigroupIdeal(TwistedCrossedApsisMonoid(m, n, d), gens); +end); + InstallMethod(SingularPlanarModularPartitionMonoid, "for a positive integer and positive integer", [IsPosInt, IsPosInt], @@ -1474,6 +1803,38 @@ function(m, n) return SemigroupIdeal(S, x); end); +InstallMethod(TwistedSingularPlanarModularPartitionMonoid, "for a positive integer, for a positive integer and max. floating blocks", [IsPosInt, IsPosInt, IsInt], +function(m, n, d) + local blocks, gens, i; + + if d < 0 then + ErrorNoReturn("the maximum number of floating blocks must be non-negative"); + fi; + + if n = 1 then + if m = 1 then + gens := [TwistedBipartition(0, Bipartition([[1], [-1]]), d)]; + if d > 0 then + gens := Concatenation(gens, [TwistedBipartition(1, Bipartition([[1, -1]]), d)]); + fi; + return SemigroupIdeal(TwistedPlanarModularPartitionMonoid(1, 1, d), gens); + else + ErrorNoReturn("the 2nd argument (a pos. int.) must be > 1", + " when the 1st argument (a pos. int.) is also > 1"); + fi; + fi; + + blocks := [[1 .. m], [-m .. -1]]; + for i in [m + 1 .. n] do + blocks[i - m + 2] := [i, -i]; + od; + gens := [TwistedBipartition(0, Bipartition(blocks), d)]; + if d > 0 then + gens := Concatenation(gens, [TwistedBipartition(1, One(Bipartition(blocks)), d)]); + fi; + return SemigroupIdeal(TwistedPlanarModularPartitionMonoid(m, n, d), gens); +end); + InstallMethod(SingularPlanarPartitionMonoid, "for a positive integer", [IsPosInt], function(n) @@ -1492,6 +1853,33 @@ function(n) return SemigroupIdeal(S, x); end); +InstallMethod(TwistedSingularPlanarPartitionMonoid, "for a positive integer and max. floating blocks", [IsPosInt, IsInt], +function(n, d) + local blocks, gens, i; + + if d < 0 then + ErrorNoReturn("the maximum number of floating blocks must be non-negative"); + fi; + + if n = 1 then + gens := [TwistedBipartition(0, Bipartition([[1], [-1]]), d)]; + if d > 0 then + gens := Concatenation(gens, [TwistedBipartition(1, Bipartition([[1, -1]]), d)]); + fi; + return SemigroupIdeal(TwistedPlanarPartitionMonoid(1, d),gens); + fi; + + blocks := [[1, 2, -1, -2]]; + for i in [3 .. n] do + blocks[i - 1] := [i, -i]; + od; + gens := [TwistedBipartition(0, Bipartition(blocks), d)]; + if d > 0 then + gens := Concatenation(gens, [TwistedBipartition(1, One(Bipartition(blocks)), d)]); + fi; + return SemigroupIdeal(TwistedPlanarPartitionMonoid(n, d), gens); +end); + InstallMethod(SingularModularPartitionMonoid, "for a positive integer and positive integer", [IsPosInt, IsPosInt], @@ -1517,6 +1905,38 @@ function(m, n) return SemigroupIdeal(S, x); end); +InstallMethod(TwistedSingularModularPartitionMonoid, "for a positive integer, for a positive integer and max. floating blocks", [IsPosInt, IsPosInt, IsInt], +function(m, n, d) + local blocks, gens, i; + + if d < 0 then + ErrorNoReturn("the maximum number of floating blocks must be non-negative"); + fi; + + if n = 1 then + if m = 1 then + gens := [TwistedBipartition(0, Bipartition([[1], [-1]]), d)]; + if d > 0 then + gens := Concatenation(gens, [TwistedBipartition(1, Bipartition([[1, -1]]), d)]); + fi; + return SemigroupIdeal(TwistedModularPartitionMonoid(1, 1, d), gens); + else + ErrorNoReturn("the 2nd argument (a pos. int.) must be > 1", + " when the 1st argument (a pos. int.) is also > 1"); + fi; + fi; + + blocks := [[1, 2, -1, -2]]; + for i in [3 .. n] do + blocks[i - 1] := [i, -i]; + od; + gens := [TwistedBipartition(0, Bipartition(blocks), d)]; + if d > 0 then + gens := Concatenation(gens, [TwistedBipartition(1, One(Bipartition(blocks)), d)]); + fi; + return SemigroupIdeal(TwistedModularPartitionMonoid(m, n, d), gens); +end); + ############################################################################# ## 2. Standard examples - known generators ############################################################################# From 5103bfff058ce429051e68a1bb12a11e58bc60e8 Mon Sep 17 00:00:00 2001 From: Matthias Fresacher K2 Date: Tue, 2 Sep 2025 10:25:22 +1000 Subject: [PATCH 10/10] Added/updated View commands - Restructured files - Added authorship --- .mailmap | 2 + PackageInfo.g | 9 +++ gap/elements/semitwistedbipart.gi | 38 ----------- gap/elements/twisted-bipart.gi | 55 ++++++++++++---- .../semitwistedbipart.gd | 6 ++ gap/semigroups/semitwistedbipart.gi | 66 +++++++++++++++++++ init.g | 2 +- read.g | 2 +- 8 files changed, 127 insertions(+), 53 deletions(-) delete mode 100644 gap/elements/semitwistedbipart.gi rename gap/{elements => semigroups}/semitwistedbipart.gd (89%) create mode 100644 gap/semigroups/semitwistedbipart.gi diff --git a/.mailmap b/.mailmap index 26433dbe8..ac96054e2 100644 --- a/.mailmap +++ b/.mailmap @@ -9,6 +9,8 @@ Joseph Edwards Joe Edwards <80713360+Joseph-Edwards@user Joseph Edwards Joseph Edwards Luke Elliott le27 Fernando Flores Brito Fernando Flores Brito +Matthias Fresacher +Matthias Fresacher Tillman Froehlich <47321884+awesometillman@users.noreply.github.com> Nick Ham Robert Hancock Robert Hancock diff --git a/PackageInfo.g b/PackageInfo.g index 6152bcfb1..bbd96e804 100644 --- a/PackageInfo.g +++ b/PackageInfo.g @@ -156,6 +156,15 @@ Persons := [ IsAuthor := true, IsMaintainer := false, Email := "trf1@st-andrews.ac.uk"), + + rec( + LastName := "Fresacher", + FirstNames := "Matthias", + IsAuthor := true, + IsMaintainer := false, + Email := "m.fresacher@westernsydney.edu.au", + WWWHome := "https://staff.cdms.westernsydney.edu.au/~mfresacher/", + Institution := "Western Sydney University"), rec( LastName := "Ham", diff --git a/gap/elements/semitwistedbipart.gi b/gap/elements/semitwistedbipart.gi deleted file mode 100644 index 8dedd8a5a..000000000 --- a/gap/elements/semitwistedbipart.gi +++ /dev/null @@ -1,38 +0,0 @@ -############################################################################ -## -## elements/semitwistedbipart.gi -## Copyright (C) 2025 James D. Mitchell -## -## Licensing information can be found in the README file of this package. -## -############################################################################# -## -## In collaboration with -## -############################################## -## ## -## Code created ## -## by ## -## *--------------------* ## -## | Matthias Fresacher | ## -## *--------------------* ## -## ## -############################################## - -# *------------------------------* -# |``````````````````````````````| -# |`````____````____`````````````| -# |````|MFMF\ /MFMF|````````````| -# |````|MF|MF\/MF|MF|````````````| -# |````|MF|\MFMF/|MF|_______`````| -# |````|MF|``````|MFMFMFMFMF|````| -# |````|MF|``````|MF|````````````| -# |````|MF|``````|MF|___`````````| -# |``````````````|MFMFMF|````````| -# |``````````````|MF|````````````| -# |``````````````|MF|````````````| -# |``````````````|MF|````````````| -# |``````````````````````````````| -# *------------------------------* - -InstallTrueMethod(CanUseGapFroidurePin, IsTwistedBipartitionSemigroup); diff --git a/gap/elements/twisted-bipart.gi b/gap/elements/twisted-bipart.gi index 6cbeb44d2..c4a01d86e 100644 --- a/gap/elements/twisted-bipart.gi +++ b/gap/elements/twisted-bipart.gi @@ -174,28 +174,55 @@ function(n, d) return TwistedBipartition(0, IdentityBipartition(n), d); end); +# Viewing, printing etc + InstallMethod(ViewString, "for a twisted bipartition", [IsTwistedBipartition], function(x) - if IsZero(x) then - return StringFormatted("ZeroTwistedBipartition({}, {})", - DegreeOfTwistedBipartition(x), MaxFloatingBlocks(x)); - fi; - return StringFormatted("TwistedBipartition({}, {}, {})", - NrFloatingBlocks(x), PrintString(UnderlyingBipartition(x)), - MaxFloatingBlocks(x)); + local str, ext, i, d; + + d := MaxFloatingBlocks(x); + + if IsZero(x) then + return StringFormatted("\><{}-twisted zero bipartition>\<", d); + fi; + + if DegreeOfBipartition(x) = 0 then + return StringFormatted("\><{}-twisted empty bipartition>\<", d); + elif IsBlockBijection(UnderlyingBipartition(x)) then + str := "\>\><"; + Append(str, String(d)); + Append(str, "-twisted block bijection:\< ("); + else + str := "\>\><"; + Append(str, String(d)); + Append(str, "-twisted bipartition:\< ("); + fi; + + Append(str, String(NrFloatingBlocks(x))); + Append(str, "; "); + + ext := ExtRepOfObj(UnderlyingBipartition(x)); + Append(str, "\>"); + Append(str, String(ext[1])); + Append(str, "\<"); + + for i in [2 .. Length(ext)] do + Append(str, ", \>"); + Append(str, String(ext[i])); + Append(str, "\<"); + od; + Append(str, ")>\<"); + return str; end); InstallMethod(String, "for a twisted bipartition", [IsTwistedBipartition], function(x) if IsZero(x) then - return StringFormatted("ZeroTwistedBipartition({}, {})", - DegreeOfTwistedBipartition(x), MaxFloatingBlocks(x)); + return Concatenation("ZeroTwistedBipartition(", String(DegreeOfTwistedBipartition(x)), ", ", String(MaxFloatingBlocks(x)), ")"); fi; - return StringFormatted("TwistedBipartition({}, {}, {})", - NrFloatingBlocks(x), PrintString(UnderlyingBipartition(x)), - MaxFloatingBlocks(x)); + return Concatenation("TwistedBipartition(", String(NrFloatingBlocks(x)), ", ", String(UnderlyingBipartition(x)), ", ", String(MaxFloatingBlocks(x)), ")"); end); InstallMethod(PrintString, "for a twisted bipartition", @@ -359,8 +386,10 @@ end); InstallMethod(DegreeOfBipartition, "for a twisted bipartition", [IsTwistedBipartition], x -> DegreeOfBipartition(UnderlyingBipartition(x))); +InstallMethod(DegreeOfTwistedBipartitionCollection, "for a twisted bipartition semigroup", +[IsTwistedBipartitionSemigroup], DegreeOfTwistedBipartitionSemigroup); InstallMethod(DegreeOfTwistedBipartitionCollection, "for a twisted bipartition collection", -[IsTwistedBipartitionCollection], x -> DegreeOfBipartitionCollection(UnderlyingBipartitionCollection(x))); +[IsTwistedBipartitionCollection], {coll} -> DegreeOfBipartition(UnderlyingBipartition(coll[1]))); InstallMethod(NrBlocks, "for a twisted bipartition", [IsTwistedBipartition], x -> NrBlocks(UnderlyingBipartition(x))); diff --git a/gap/elements/semitwistedbipart.gd b/gap/semigroups/semitwistedbipart.gd similarity index 89% rename from gap/elements/semitwistedbipart.gd rename to gap/semigroups/semitwistedbipart.gd index fe090187b..7f5eafd10 100644 --- a/gap/elements/semitwistedbipart.gd +++ b/gap/semigroups/semitwistedbipart.gd @@ -7,6 +7,7 @@ ## ############################################################################# ## +## ## In collaboration with ## ############################################## @@ -41,3 +42,8 @@ DeclareSynonym("IsTwistedBipartitionMonoid", IsTwistedBipartitionCollection and IsMonoid); InstallTrueMethod(IsFinite, IsTwistedBipartitionSemigroup); + +DeclareAttribute("DegreeOfTwistedBipartitionSemigroup", +IsTwistedBipartitionSemigroup); +DeclareAttribute("MaxFloatingBlocksOfTwistedBipartitionSemigroup", +IsTwistedBipartitionSemigroup); diff --git a/gap/semigroups/semitwistedbipart.gi b/gap/semigroups/semitwistedbipart.gi new file mode 100644 index 000000000..f905ef3aa --- /dev/null +++ b/gap/semigroups/semitwistedbipart.gi @@ -0,0 +1,66 @@ +############################################################################# +## +## semigroups/semibipart.gi +## Copyright (C) 2025 James D. Mitchell +## +## Licensing information can be found in the README file of this package. +## +############################################################################# +## +## +## In collaboration with +## +############################################## +## ## +## Code created ## +## by ## +## *--------------------* ## +## | Matthias Fresacher | ## +## *--------------------* ## +## ## +############################################## + +# *------------------------------* +# |``````````````````````````````| +# |`````____````____`````````````| +# |````|MFMF\ /MFMF|````````````| +# |````|MF|MF\/MF|MF|````````````| +# |````|MF|\MFMF/|MF|_______`````| +# |````|MF|``````|MFMFMFMFMF|````| +# |````|MF|``````|MF|````````````| +# |````|MF|``````|MF|___`````````| +# |``````````````|MFMFMF|````````| +# |``````````````|MF|````````````| +# |``````````````|MF|````````````| +# |``````````````|MF|````````````| +# |``````````````````````````````| +# *------------------------------* + + +# this file contains methods for every operation/attribute/property that is +# specific to twisted bipartition semigroups. + +InstallTrueMethod(CanUseGapFroidurePin, IsTwistedBipartitionSemigroup); + +############################################################################# +## Printing and viewing +############################################################################# + +InstallMethod(SemigroupViewStringPrefix, "for a twisted bipartition semigroup", +[IsTwistedBipartitionSemigroup], S -> Concatenation("\>", ViewString(MaxFloatingBlocksOfTwistedBipartitionSemigroup(S)), "-twisted bipartition\< ")); + +InstallMethod(SemigroupViewStringPrefix, "for a twisted bipartition *-semigroup", +[IsTwistedBipartitionSemigroup and IsStarSemigroup], S -> Concatenation("\>", ViewString(MaxFloatingBlocksOfTwistedBipartitionSemigroup(S)), "-twisted bipartition *-\< ")); + +InstallMethod(SemigroupViewStringSuffix, "for a twisted bipartition semigroup", +[IsTwistedBipartitionSemigroup], +function(S) + return Concatenation("\>degree \>", + ViewString(DegreeOfTwistedBipartitionSemigroup(S)), + "\<\< "); +end); + +InstallMethod(DegreeOfTwistedBipartitionSemigroup, "for a twisted bipartition semigroup", +[IsTwistedBipartitionSemigroup], S -> DegreeOfBipartition(Representative(S))); +InstallMethod(MaxFloatingBlocksOfTwistedBipartitionSemigroup, "for a twisted bipartition semigroup", +[IsTwistedBipartitionSemigroup], S -> MaxFloatingBlocks(Representative(S))); \ No newline at end of file diff --git a/init.g b/init.g index 20eb5fd05..2356bd167 100644 --- a/init.g +++ b/init.g @@ -96,7 +96,7 @@ ReadPackage("semigroups", "gap/semigroups/semiquo.gd"); ReadPackage("semigroups", "gap/semigroups/semiringmat.gd"); ReadPackage("semigroups", "gap/semigroups/semirms.gd"); ReadPackage("semigroups", "gap/semigroups/semitrans.gd"); -ReadPackage("semigroups", "gap/elements/semitwistedbipart.gd"); +ReadPackage("semigroups", "gap/semigroups/semitwistedbipart.gd"); ReadPackage("semigroups", "gap/semigroups/grpperm.gd"); diff --git a/read.g b/read.g index 53e637e97..ea6072b3d 100644 --- a/read.g +++ b/read.g @@ -58,7 +58,7 @@ ReadPackage("semigroups", "gap/semigroups/semiffmat.gi"); ReadPackage("semigroups", "gap/semigroups/semiquo.gi"); ReadPackage("semigroups", "gap/semigroups/semieunit.gi"); ReadPackage("semigroups", "gap/semigroups/semidp.gi"); -ReadPackage("semigroups", "gap/elements/semitwistedbipart.gi"); +ReadPackage("semigroups", "gap/semigroups/semitwistedbipart.gi"); ReadPackage("semigroups", "gap/ideals/ideals.gi"); ReadPackage("semigroups", "gap/ideals/acting.gi");