From 32b4ca4ffb7db4d7278e1a771d2979318adc3ab3 Mon Sep 17 00:00:00 2001 From: James Mitchell Date: Mon, 26 Mar 2018 09:09:57 +0200 Subject: [PATCH 1/9] Fix bug in PartialPerm if length of img and dom differ Resolve issue #2301. --- lib/pperm.gi | 5 +++-- tst/testinstall/pperm.tst | 6 ++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/pperm.gi b/lib/pperm.gi index 6a652b55f5..40c2cea1ca 100644 --- a/lib/pperm.gi +++ b/lib/pperm.gi @@ -545,12 +545,13 @@ function(arg) fi; elif Length(arg)=2 then if IsSSortedList(arg[1]) and ForAll(arg[1], IsPosInt) and - IsDuplicateFreeList(arg[2]) and ForAll(arg[2], IsPosInt) then + IsDuplicateFreeList(arg[2]) and ForAll(arg[2], IsPosInt) and + Length(arg[1]) = Length(arg[2]) then return SparsePartialPermNC(arg[1], arg[2]); else ErrorNoReturn("usage: the 1st argument must be a set of positive integers ", "and the 2nd argument must be a duplicate-free list of positive ", - "integers"); + "integers of equal length to the first"); fi; fi; diff --git a/tst/testinstall/pperm.tst b/tst/testinstall/pperm.tst index 309ca6315a..6d0a0990af 100644 --- a/tst/testinstall/pperm.tst +++ b/tst/testinstall/pperm.tst @@ -2440,6 +2440,12 @@ gap> MultiplicativeZeroOp(x); gap> MultiplicativeZero(x); +# Test PartialPerm (for sparse incorrect arg) +gap> PartialPerm([1,2,8],[3,4,1,2]); +Error, usage: the 1st argument must be a set of positive integers and the 2nd \ +argument must be a duplicate-free list of positive integers of equal length to\ + the first + # gap> SetUserPreference("PartialPermDisplayLimit", display);; gap> SetUserPreference("NotationForPartialPerm", notationpp);; From 4bdb4e4d800aaaa3a20e9090ba8dd2a0f539d4ab Mon Sep 17 00:00:00 2001 From: James Mitchell Date: Mon, 26 Mar 2018 17:17:07 +0200 Subject: [PATCH 2/9] pperm: remove randomness from tests This also makes the test much faster. --- tst/testinstall/pperm.tst | 385 ++++++++++++++++++++------------------ 1 file changed, 201 insertions(+), 184 deletions(-) diff --git a/tst/testinstall/pperm.tst b/tst/testinstall/pperm.tst index 6d0a0990af..af2ab8c815 100644 --- a/tst/testinstall/pperm.tst +++ b/tst/testinstall/pperm.tst @@ -49,7 +49,7 @@ Error, usage: the argument should be a partial perm, gap> # SmallestIdempotentPower, IndexPeriodOfPartialPerm, IsIdempotent -gap> f:=RandomPartialPerm(100000);; +gap> f:=PartialPerm([1, 100000], [100000, 2]);; gap> IsIdempotent(f^SmallestIdempotentPower(f)); true gap> x:=IndexPeriodOfPartialPerm(f);; @@ -57,7 +57,7 @@ gap> f^x[1]=f^(x[1]+x[2]); true gap> RankOfPartialPerm(f^(x[1]-1))>RankOfPartialPerm(f^x[1]); true -gap> f:=RandomPartialPerm(100000);; +gap> f:=PartialPerm([1, 100000], [100000, 2]);; gap> IsIdempotent(f^SmallestIdempotentPower(f)); true gap> x:=IndexPeriodOfPartialPerm(f);; @@ -65,7 +65,7 @@ gap> f^x[1]=f^(x[1]+x[2]); true gap> RankOfPartialPerm(f^(x[1]-1))>RankOfPartialPerm(f^x[1]); true -gap> f:=RandomPartialPerm(1000);; +gap> f:=PartialPerm([1, 1000], [1000, 2]);; gap> IsIdempotent(f^SmallestIdempotentPower(f)); true gap> x:=IndexPeriodOfPartialPerm(f);; @@ -123,7 +123,7 @@ false # ComponentsOfPartialPerm, NrComponentsOfPartialPerm, # ComponentRepsOfPartialPerm and ComponentPartialPermInt -gap> f:=RandomPartialPerm(100000);; +gap> f:=PartialPerm([1, 100000], [100000, 2]);; gap> NrComponentsOfPartialPerm(f)=Length(ComponentsOfPartialPerm(f)); true gap> Union(ComponentsOfPartialPerm(f))=Union(DomainOfPartialPerm(f), @@ -132,7 +132,7 @@ true gap> List(ComponentRepsOfPartialPerm(f), i-> ComponentPartialPermInt(f, i)) > =ComponentsOfPartialPerm(f); true -gap> f:=RandomPartialPerm(100);; +gap> f:=PartialPerm([1, 100], [100, 2]);; gap> NrComponentsOfPartialPerm(f)=Length(ComponentsOfPartialPerm(f)); true gap> Union(ComponentsOfPartialPerm(f))=Union(DomainOfPartialPerm(f), @@ -160,7 +160,7 @@ gap> NrComponentsOfPartialPerm(f); # FixedPointsOfPartialPerm, MovedPoints, # NrFixedPoints, NrMovedPoints -gap> f:=RandomPartialPerm(100000);; +gap> f:=PartialPerm([1, 100000], [100000, 2]);; gap> FixedPointsOfPartialPerm(f)= > Filtered([1..DegreeOfPartialPerm(f)], i-> i^f=i); true @@ -168,16 +168,18 @@ gap> f:=PartialPermNC([1..100000]); gap> FixedPointsOfPartialPerm(f)=[1..100000]; true -gap> f:=RandomPartialPerm(20);; +gap> f:=PartialPerm( [ 1, 2, 3, 4, 5, 6, 7, 9, 11, 12, 15, 16, 19 ], +> [ 2, 4, 11, 1, 20, 10, 15, 16, 5, 3, 6, 12, 9 ] );; gap> FixedPointsOfPartialPerm(f)= > Filtered([1..DegreeOfPartialPerm(f)], i-> i^f=i); true -gap> f:=RandomPartialPerm(20);; +gap> f:=PartialPerm( [ 1, 2, 3, 4, 5, 6, 7, 9, 11, 12, 15, 16, 19 ], +> [ 2, 4, 11, 1, 20, 10, 15, 16, 5, 3, 6, 12, 9 ] );; gap> DomainOfPartialPerm(f);; gap> FixedPointsOfPartialPerm(f)= > Filtered([1..DegreeOfPartialPerm(f)], i-> i^f=i); true -gap> f:=RandomPartialPerm(100000);; +gap> f:=PartialPerm([1, 100000], [100000, 2]);; gap> NrMovedPoints(f)+NrFixedPoints(f)= > RankOfPartialPerm(f); true @@ -186,7 +188,7 @@ gap> Union(MovedPoints(f), FixedPointsOfPartialPerm(f))= true gap> Intersection(MovedPoints(f), FixedPointsOfPartialPerm(f)); [ ] -gap> f:=RandomPartialPerm(100);; +gap> f:=PartialPerm([1, 100], [100, 2]);; gap> NrMovedPoints(f)+NrFixedPoints(f)= > RankOfPartialPerm(f); true @@ -197,19 +199,19 @@ gap> Intersection(MovedPoints(f), FixedPointsOfPartialPerm(f)); [ ] # LargestMovedPoint, SmallestMovedPoint -gap> f:=RandomPartialPerm(100000);; DomainOfPartialPerm(f);; +gap> f:=PartialPerm([1, 100000], [100000, 2]);; DomainOfPartialPerm(f);; gap> i:=LargestMovedPoint(f);; gap> i^f<>i; true -gap> f:=RandomPartialPerm(100000);; +gap> f:=PartialPerm([1, 100000], [100000, 2]);; gap> i:=LargestMovedPoint(f);; gap> i^f<>i; true -gap> f:=RandomPartialPerm(100);; DomainOfPartialPerm(f);; +gap> f:=PartialPerm([1, 100], [100, 2]);; DomainOfPartialPerm(f);; gap> i:=LargestMovedPoint(f);; gap> i^f<>i; true -gap> f:=RandomPartialPerm(100);; +gap> f:=PartialPerm([1, 100], [100, 2]);; gap> i:=LargestMovedPoint(f);; gap> i^f<>i; true @@ -237,19 +239,19 @@ gap> f:=PartialPermNC([1..100000]); gap> LargestMovedPoint(f); 0 -gap> f:=RandomPartialPerm(100000);; DomainOfPartialPerm(f);; +gap> f:=PartialPerm([1, 100000], [100000, 2]);; DomainOfPartialPerm(f);; gap> i:=SmallestMovedPoint(f);; gap> i^f<>i; true -gap> f:=RandomPartialPerm(100000);; +gap> f:=PartialPerm([1, 100000], [100000, 2]);; gap> i:=SmallestMovedPoint(f);; gap> i^f<>i; true -gap> f:=RandomPartialPerm(100);; DomainOfPartialPerm(f);; +gap> f:=PartialPerm([1, 100], [100, 2]);; DomainOfPartialPerm(f);; gap> i:=SmallestMovedPoint(f);; gap> i^f<>i; true -gap> f:=RandomPartialPerm(100);; +gap> f:=PartialPerm([1, 100], [100, 2]);; gap> i:=SmallestMovedPoint(f);; gap> i^f<>i; true @@ -300,7 +302,7 @@ gap> IsPPerm2Rep(h); true # LeftOne -gap> f:=RandomPartialPerm(10);; DomainOfPartialPerm(f);; +gap> f:=PartialPerm( [ 1, 2, 3, 6, 10 ], [ 2, 7, 8, 10, 6 ] );; DomainOfPartialPerm(f);; gap> e:=LeftOne(f);; gap> IsIdempotent(e); true @@ -310,7 +312,7 @@ gap> DomainOfPartialPerm(e)=DomainOfPartialPerm(f); true gap> ImageListOfPartialPerm(e)=DomainOfPartialPerm(f); true -gap> f:=RandomPartialPerm(10);; +gap> f:=PartialPerm( [ 1, 2, 3, 6, 10 ], [ 2, 7, 8, 10, 6 ] );; gap> e:=LeftOne(f);; gap> IsIdempotent(e); true @@ -320,7 +322,7 @@ gap> DomainOfPartialPerm(e)=DomainOfPartialPerm(f); true gap> ImageListOfPartialPerm(e)=DomainOfPartialPerm(f); true -gap> f:=RandomPartialPerm(100000);; +gap> f:=PartialPerm([1, 100000], [100000, 2]);; gap> e:=LeftOne(f);; gap> IsIdempotent(e); true @@ -330,7 +332,7 @@ gap> DomainOfPartialPerm(e)=DomainOfPartialPerm(f); true gap> ImageListOfPartialPerm(e)=DomainOfPartialPerm(f); true -gap> f:=RandomPartialPerm(100000);; DomainOfPartialPerm(f);; +gap> f:=PartialPerm([1, 100000], [100000, 2]);; DomainOfPartialPerm(f);; gap> e:=LeftOne(f);; gap> IsIdempotent(e); true @@ -354,7 +356,7 @@ gap> e*f=f; true #RightOne -gap> f:=RandomPartialPerm(10);; ImageSetOfPartialPerm(f);; +gap> f:=PartialPerm( [ 1, 2, 3, 6, 10 ], [ 2, 7, 8, 10, 6 ] );; ImageSetOfPartialPerm(f);; gap> e:=RightOne(f);; gap> IsIdempotent(e); true @@ -364,7 +366,7 @@ gap> ImageListOfPartialPerm(e)=ImageSetOfPartialPerm(f); true gap> DomainOfPartialPerm(e)=ImageSetOfPartialPerm(f); true -gap> f:=RandomPartialPerm(10);; +gap> f:=PartialPerm( [ 1, 2, 3, 6, 10 ], [ 2, 7, 8, 10, 6 ] );; gap> e:=RightOne(f);; gap> IsIdempotent(e); true @@ -374,7 +376,7 @@ gap> ImageListOfPartialPerm(e)=ImageSetOfPartialPerm(f); true gap> DomainOfPartialPerm(e)=ImageSetOfPartialPerm(f); true -gap> f:=RandomPartialPerm(100000);; ImageSetOfPartialPerm(f);; +gap> f:=PartialPerm([1, 100000], [100000, 2]);; ImageSetOfPartialPerm(f);; gap> e:=RightOne(f);; gap> IsIdempotent(e); true @@ -384,7 +386,7 @@ gap> ImageListOfPartialPerm(e)=ImageSetOfPartialPerm(f); true gap> DomainOfPartialPerm(e)=ImageSetOfPartialPerm(f); true -gap> f:=RandomPartialPerm(100000);; +gap> f:=PartialPerm([1, 100000], [100000, 2]);; gap> e:=RightOne(f);; gap> IsIdempotent(e); true @@ -682,14 +684,14 @@ gap> f:=PartialPermNC( [ 1, 2, 3, 4, 5, 8, 10 ], [ 7, 1, 4, 3, 2, 6, 5 ] );; gap> g:=PartialPermNC( [ 1, 2, 3, 4, 5, 8, 10 ], [ 3, 1, 4, 2, 5, 6, 7 ] );; gap> MeetOfPartialPerms(f,g); [2,1][3,4][8,6] -gap> f:=RandomPartialPerm(1000);; +gap> f:=PartialPerm([1, 1000], [1000, 2]);; gap> g:=JoinOfPartialPerms(f, PartialPermNC([1001..2000], [1001..2000]));; gap> f=MeetOfPartialPerms(f, g); true gap> g:=JoinOfPartialPerms(f, PartialPermNC([1001..100000], [1001..100000]));; gap> f=MeetOfPartialPerms(f, g); true -gap> g:=RandomPartialPerm(1000);; +gap> g:=PartialPerm([1, 1000], [1000, 2]);; gap> f:=JoinOfPartialPerms(g, PartialPermNC([1001..100000], [1001..100000]));; gap> g=MeetOfPartialPerms(f, g); true @@ -747,13 +749,13 @@ gap> f:=RestrictedPartialPerm(f, [2..10]); gap> AsPermutation(f); () -gap> f:=RandomPartialPerm(1000);; +gap> f:=PartialPerm([1, 1000], [1000, 2]);; gap> x:=IndexPeriodOfPartialPerm(f);; gap> g:=f^x[1];; gap> OnTuples(DomainOfPartialPerm(g),AsPermutation(g))= > OnTuples(DomainOfPartialPerm(g), g); true -gap> f:=RandomPartialPerm(100000);; +gap> f:=PartialPerm([1, 100000], [100000, 2]);; gap> x:=IndexPeriodOfPartialPerm(f);; gap> g:=f^x[1];; gap> OnTuples(DomainOfPartialPerm(g),AsPermutation(g))= @@ -763,12 +765,13 @@ gap> AsPermutation(f); fail # PermLeftQuoPartialPerm -gap> f:=RandomPartialPerm(100);; -gap> p:=Random(SymmetricGroup(ImageSetOfPartialPerm(f)));; +gap> f := PartialPerm([1, 100], [100, 2]);; +gap> p := (2, 100);; gap> g:=f*p;; gap> PermLeftQuoPartialPerm(f, g)=p; true -gap> h:=RandomPartialPerm([101..100000]);; +gap> h := PartialPerm([200, 300, 400, 1900, 10 ^ 6], +> [101, 113, 131, 450, 10 ^ 6]);; gap> h:=JoinOfPartialPerms(h, PartialPermNC([1..100], [1..100]));; gap> g=g*h; true @@ -813,7 +816,7 @@ gap> PermLeftQuoPartialPerm(g, f); # Kernel level functions # # OnePPerm -gap> f:=RandomPartialPerm(100000);; +gap> f:=PartialPerm([1, 100000], [100000, 2]);; gap> e:=One(f);; gap> e*f=f; true @@ -825,7 +828,7 @@ true gap> Union(DomainOfPartialPerm(f), ImageSetOfPartialPerm(f))= > ImageSetOfPartialPerm(e); true -gap> f:=RandomPartialPerm(10000);; +gap> f:=PartialPerm([1, 10000], [10000, 2]);; gap> e:=One(f);; gap> e*f=f; true @@ -862,8 +865,8 @@ gap> f=f*p; true # ProdPPerm2Perm2, Case 1 of 6: codeg(f)<=deg(p), domain known -gap> f:=RandomPartialPerm(10);; DomainOfPartialPerm(f);; -gap> p:=Random(SymmetricGroup(100));; +gap> f:=PartialPerm( [ 1, 2, 3, 6, 10 ], [ 2, 7, 8, 10, 6 ] );; DomainOfPartialPerm(f);; +gap> p:=(7, 100);; gap> g:=f*p;; gap> DomainOfPartialPerm(g)=DomainOfPartialPerm(f); true @@ -873,8 +876,8 @@ gap> CodegreeOfPartialPerm(g)=Maximum(ImageSetOfPartialPerm(g)); true # QuoPPerm2Perm2, Case 1 of 6: codeg(f)<=deg(p), domain known -gap> f:=RandomPartialPerm(10);; DomainOfPartialPerm(f);; -gap> p:=Random(SymmetricGroup(100));; +gap> f:=PartialPerm( [ 1, 2, 3, 6, 10 ], [ 2, 7, 8, 10, 6 ] );; DomainOfPartialPerm(f);; +gap> p:=(7, 100);; gap> g:=f/p;; gap> OnTuples(ImageListOfPartialPerm(f), p^-1)=ImageListOfPartialPerm(g); true @@ -884,15 +887,15 @@ gap> f/p=f*p^-1; true # ProdPPerm2Perm2, Case 2 of 6: codeg(f)<=deg(p), domain not known -gap> f:=RandomPartialPerm(10);; -gap> p:=Random(SymmetricGroup(100));; +gap> f:=PartialPerm( [ 1, 2, 3, 6, 10 ], [ 2, 7, 8, 10, 6 ] );; +gap> p:=(7, 100);; gap> g:=f*p;; gap> DomainOfPartialPerm(g)=DomainOfPartialPerm(f); true gap> OnTuples(ImageListOfPartialPerm(f), p)=ImageListOfPartialPerm(g); true -gap> f:=RandomPartialPerm(10);; -gap> p:=Random(SymmetricGroup(100));; +gap> f:=PartialPerm( [ 1, 2, 3, 6, 10 ], [ 2, 7, 8, 10, 6 ] );; +gap> p:=(7, 100);; gap> g:=f*p;; gap> DomainOfPartialPerm(g)=DomainOfPartialPerm(f); true @@ -902,8 +905,8 @@ gap> CodegreeOfPartialPerm(g)=Maximum(ImageSetOfPartialPerm(g)); true # QuoPPerm2Perm2, Case 2 of 6: codeg(f)<=deg(p), domain not known -gap> f:=RandomPartialPerm(10);; -gap> p:=Random(SymmetricGroup(100));; +gap> f:=PartialPerm( [ 1, 2, 3, 6, 10 ], [ 2, 7, 8, 10, 6 ] );; +gap> p:=(7, 100);; gap> g:=f/p;; gap> DomainOfPartialPerm(g)=DomainOfPartialPerm(f); true @@ -911,8 +914,8 @@ gap> OnTuples(ImageListOfPartialPerm(f), p^-1)=ImageListOfPartialPerm(g); true gap> f/p=f*p^-1; true -gap> f:=RandomPartialPerm(10);; -gap> p:=Random(SymmetricGroup(100));; +gap> f:=PartialPerm( [ 1, 2, 3, 6, 10 ], [ 2, 7, 8, 10, 6 ] );; +gap> p:=(7, 100);; gap> g:=f/p;; gap> DomainOfPartialPerm(g)=DomainOfPartialPerm(f); true @@ -924,8 +927,8 @@ gap> f/p=f*p^-1; true # ProdPPerm2Perm2, Case 3 of 6: codeg(f)>deg(p), domain known -gap> f:=RandomPartialPerm(100);; DomainOfPartialPerm(f);; -gap> p:=Random(SymmetricGroup(10));; +gap> f:=PartialPerm([1, 100], [100, 2]);; DomainOfPartialPerm(f);; +gap> p:=(7, 10);; gap> g:=f*p;; gap> OnTuples(ImageListOfPartialPerm(f), p)=ImageListOfPartialPerm(g); true @@ -933,8 +936,8 @@ gap> DomainOfPartialPerm(g)=DomainOfPartialPerm(f); true gap> CodegreeOfPartialPerm(g)=Maximum(ImageSetOfPartialPerm(g)); true -gap> f:=RandomPartialPerm(65535);; -gap> p:=Random(SymmetricGroup(10000));; +gap> f:=PartialPerm([1, 65535], [65535, 2]);; +gap> p:=(17, 10000);; gap> g:=f*p;; gap> DomainOfPartialPerm(g)=DomainOfPartialPerm(f); true @@ -944,8 +947,8 @@ gap> CodegreeOfPartialPerm(g)=Maximum(ImageSetOfPartialPerm(g)); true # QuoPPerm2Perm2, Case 3 of 6: codeg(f)>deg(p), domain known -gap> f:=RandomPartialPerm(100);; DomainOfPartialPerm(f);; -gap> p:=Random(SymmetricGroup(10));; +gap> f:=PartialPerm([1, 100], [100, 2]);; DomainOfPartialPerm(f);; +gap> p:=(7, 10);; gap> g:=f/p;; gap> OnTuples(ImageListOfPartialPerm(f), p^-1)=ImageListOfPartialPerm(g); true @@ -955,8 +958,8 @@ gap> CodegreeOfPartialPerm(g)=Maximum(ImageSetOfPartialPerm(g)); true gap> f/p=f*p^-1; true -gap> f:=RandomPartialPerm(65535);; -gap> p:=Random(SymmetricGroup(10000));; +gap> f:=PartialPerm([1, 65535], [65535, 2]);; +gap> p:=(17, 10000);; gap> g:=f/p;; gap> DomainOfPartialPerm(g)=DomainOfPartialPerm(f); true @@ -968,8 +971,8 @@ gap> f/p=f*p^-1; true # ProdPPerm2Perm2, Case 4 of 6: codeg(f)>deg(p), domain not known -gap> f:=RandomPartialPerm(100);; -gap> p:=Random(SymmetricGroup(10));; +gap> f:=PartialPerm([1, 100], [100, 2]);; +gap> p:=(7, 10);; gap> g:=f*p;; gap> DomainOfPartialPerm(g)=DomainOfPartialPerm(f); true @@ -977,8 +980,8 @@ gap> OnTuples(ImageListOfPartialPerm(f), p)=ImageListOfPartialPerm(g); true gap> CodegreeOfPartialPerm(g)=Maximum(ImageSetOfPartialPerm(g)); true -gap> f:=RandomPartialPerm(10000);; -gap> p:=Random(SymmetricGroup(1000));; +gap> f:=PartialPerm([1, 10000], [10000, 2]);; +gap> p:=(13, 1000);; gap> g:=f*p;; gap> DomainOfPartialPerm(g)=DomainOfPartialPerm(f); true @@ -988,8 +991,8 @@ gap> CodegreeOfPartialPerm(g)=Maximum(ImageSetOfPartialPerm(g)); true # QuoPPerm2Perm2, Case 4 of 6: codeg(f)>deg(p), domain not known -gap> f:=RandomPartialPerm(100);; -gap> p:=Random(SymmetricGroup(10));; +gap> f:=PartialPerm([1, 100], [100, 2]);; +gap> p:=(7, 10);; gap> g:=f/p;; gap> DomainOfPartialPerm(g)=DomainOfPartialPerm(f); true @@ -999,8 +1002,8 @@ gap> CodegreeOfPartialPerm(g)=Maximum(ImageSetOfPartialPerm(g)); true gap> f/p=f*p^-1; true -gap> f:=RandomPartialPerm(10000);; -gap> p:=Random(SymmetricGroup(1000));; +gap> f:=PartialPerm([1, 10000], [10000, 2]);; +gap> p:=(13, 1000);; gap> g:=f/p;; gap> DomainOfPartialPerm(g)=DomainOfPartialPerm(f); true @@ -1013,7 +1016,7 @@ true # ProdPPerm2Perm2, Case 5 of 6: deg(p)=65536, domain not known gap> p:=(1,65536);; -gap> f:=RandomPartialPerm(10000);; +gap> f:=PartialPerm([1, 10000], [10000, 2]);; gap> g:=f*p;; gap> DomainOfPartialPerm(g)=DomainOfPartialPerm(f); true @@ -1024,7 +1027,7 @@ true # QuoPPerm2Perm2, Case 5 of 6: deg(p)=65536, domain not known gap> p:=(1,65536,123);; -gap> f:=RandomPartialPerm(10000);; +gap> f:=PartialPerm([1, 10000], [10000, 2]);; gap> g:=f/p;; gap> DomainOfPartialPerm(g)=DomainOfPartialPerm(f); true @@ -1036,7 +1039,7 @@ gap> f/p=f*p^-1; true # ProdPPerm2Perm2, Case 6 of 6: deg(p)=65536, domain known -gap> f:=RandomPartialPerm(10000);; DomainOfPartialPerm(f);; +gap> f:=PartialPerm([1, 10000], [10000, 2]);; DomainOfPartialPerm(f);; gap> p:=(1,65536);; gap> g:=f*p;; gap> DomainOfPartialPerm(g)=DomainOfPartialPerm(f); @@ -1047,7 +1050,7 @@ gap> CodegreeOfPartialPerm(g)=Maximum(ImageSetOfPartialPerm(g)); true # QuoPPerm2Perm2, Case 6 of 6: deg(p)=65536, domain known -gap> f:=RandomPartialPerm(10000);; DomainOfPartialPerm(f);; +gap> f:=PartialPerm([1, 10000], [10000, 2]);; DomainOfPartialPerm(f);; gap> p:=(1,65536,123);; gap> g:=f/p;; gap> DomainOfPartialPerm(g)=DomainOfPartialPerm(f); @@ -1060,7 +1063,7 @@ gap> f/p=f*p^-1; true # ProdPPerm2Perm4, Case 1 of 2: domain known -gap> f:=RandomPartialPerm(10);; DomainOfPartialPerm(f);; +gap> f:=PartialPerm( [ 1, 2, 3, 6, 10 ], [ 2, 7, 8, 10, 6 ] );; DomainOfPartialPerm(f);; gap> p:=(1,100000);; gap> g:=f*p;; gap> DomainOfPartialPerm(g)=DomainOfPartialPerm(f); @@ -1071,7 +1074,7 @@ gap> CodegreeOfPartialPerm(g)=Maximum(ImageSetOfPartialPerm(g)); true # QuoPPerm2Perm4, Case 1 of 2: domain known -gap> f:=RandomPartialPerm(10);; DomainOfPartialPerm(f);; +gap> f:=PartialPerm( [ 1, 2, 3, 6, 10 ], [ 2, 7, 8, 10, 6 ] );; DomainOfPartialPerm(f);; gap> p:=(1,100000,123);; gap> g:=f/p;; gap> DomainOfPartialPerm(g)=DomainOfPartialPerm(f); @@ -1084,7 +1087,7 @@ gap> f/p=f*p^-1; true # ProdPPerm2Perm4, Case 2 of 2: domain not known -gap> f:=RandomPartialPerm(1000);; +gap> f:=PartialPerm([1, 1000], [1000, 2]);; gap> p:=(1,100000);; gap> g:=f*p;; gap> OnTuples(ImageListOfPartialPerm(f), p)=ImageListOfPartialPerm(g); @@ -1095,7 +1098,7 @@ gap> DomainOfPartialPerm(g)=DomainOfPartialPerm(f); true # QuoPPerm2Perm4, Case 2 of 2: domain not known -gap> f:=RandomPartialPerm(1000);; +gap> f:=PartialPerm([1, 1000], [1000, 2]);; gap> p:=(1,100000,123);; gap> g:=f/p;; gap> OnTuples(ImageListOfPartialPerm(f), p^-1)=ImageListOfPartialPerm(g); @@ -1283,8 +1286,8 @@ gap> CodegreeOfPartialPerm(g)=Maximum(ImageSetOfPartialPerm(g)); true gap> ImageSetOfPartialPerm(f)=ImageSetOfPartialPerm(g); true -gap> f:=RandomPartialPerm(10000);; -gap> p:=Random(SymmetricGroup(9000));; +gap> f:=PartialPerm([1, 10000], [10000, 2]);; +gap> p:=(13, 9000);; gap> g:=p*f;; gap> OnSets(DomainOfPartialPerm(f), p^-1)=DomainOfPartialPerm(g); true @@ -1313,8 +1316,8 @@ gap> CodegreeOfPartialPerm(g)=Maximum(ImageSetOfPartialPerm(g)); true gap> ImageSetOfPartialPerm(f)=ImageSetOfPartialPerm(g); true -gap> f:=RandomPartialPerm(1000);; -gap> p:=Random(SymmetricGroup(2000));; +gap> f:=PartialPerm([1, 1000], [1000, 2]);; +gap> p:=(13, 2000);; gap> g:=p*f;; gap> OnSets(DomainOfPartialPerm(f), p^-1)=DomainOfPartialPerm(g); true @@ -1521,13 +1524,13 @@ gap> f:=PartialPermNC([100000], [1]); [100000,1] gap> IsPPerm2Rep(f); true -gap> p:=Random(SymmetricGroup(100000));; +gap> p := (17, 100000);; gap> f^p=p^-1*f*p; true # PowPPerm2Perm4, Case 2 of 2, deg(f)<=deg(p) and codeg(f)<=deg(p) -gap> f:=PartialPermNC( [ 1, 2, 3, 4, 5, 6 ], [ 2, 5, 8, 1, 3, 4 ] );; -gap> p:=Random(SymmetricGroup(100000));; +gap> f := PartialPermNC([1, 2, 3, 4, 5, 6], [2, 5, 8, 1, 3, 4]);; +gap> p := (17, 100000);; gap> f^p=p^-1*f*p; true @@ -1537,15 +1540,14 @@ gap> f:=PartialPermNC([100000], [100000]); gap> p:=(1,3,2,10)(5,7)(6,9,8);; gap> f^p; -gap> f:=RandomPartialPerm(100000);; -gap> p:=Random(SymmetricGroup(50000));; +gap> f:=PartialPerm([1, 100000], [100000, 2]);; +gap> p:=(17, 50000);; gap> f^p=p^-1*f*p; true # PowPPerm4Perm2, Case 2 of 4, deg(f)>deg(p) and codeg(f)<=deg(p) gap> f:=PartialPermNC([100000], [1]); [100000,1] -gap> p:=Random(SymmetricGroup(10));; gap> p:=(1,10)(3,8)(4,7,5,9);; gap> f^p; [100000,10] @@ -1589,8 +1591,8 @@ gap> p^-1*f*p; [1,3,4,5](6,10) # PowPPerm4Perm4, Case 1 of 4, deg(f)>deg(p) and codeg(f)>deg(p) -gap> f:=RandomPartialPerm(100000);; -gap> p:=Random(SymmetricGroup(65538));; +gap> f:=PartialPerm([1, 100000], [100000, 2]);; +gap> p:=(17, 65538);; gap> IsPPerm4Rep(f); IsPerm4Rep(p); true true @@ -1599,7 +1601,7 @@ true # PowPPerm4Perm4, Case 2 of 4, deg(f)>deg(p) and codeg(f)<=deg(p) gap> f:=PartialPermNC([100000], [65536]);; -gap> p:=Random(SymmetricGroup(70000));; +gap> p:=(17, 70000);; gap> f^p=p^-1*f*p; true @@ -1610,8 +1612,8 @@ gap> f^p=p^-1*f*p; true # PowPPerm4Perm4, Case 4 of 4, deg(f)<=deg(p) and codeg(f)<=deg(p) -gap> f:=RandomPartialPerm(66000);; -gap> p:=Random(SymmetricGroup(70000));; +gap> f:=PartialPerm([1, 66000], [66000, 2]);; +gap> p:=(17, 70000);; gap> f^p=p^-1*f*p; true @@ -1626,8 +1628,8 @@ gap> f*g^-1; [4,2,3][5,1](9)(10) gap> f*g^-1=f/g; true -gap> f:=RandomPartialPerm(10000);; DomainOfPartialPerm(f);; -gap> g:=RandomPartialPerm(10000);; DomainOfPartialPerm(g);; +gap> f:=PartialPerm([1, 10000], [10000, 2]);; DomainOfPartialPerm(f);; +gap> g:=PartialPerm([1, 10000], [10000, 2]);; DomainOfPartialPerm(g);; gap> f/g=f*g^-1; true gap> f:=PartialPermNC([100000], [1]); @@ -1645,8 +1647,8 @@ gap> f*g^-1; [4,10,3,5](6)(7) gap> f/g=f*g^-1; true -gap> f:=RandomPartialPerm(10000);; -gap> g:=RandomPartialPerm(10000);; DomainOfPartialPerm(g);; +gap> f:=PartialPerm([1, 10000], [10000, 2]);; +gap> g:=PartialPerm([1, 10000], [10000, 2]);; DomainOfPartialPerm(g);; gap> f/g=f*g^-1; true @@ -1658,8 +1660,8 @@ gap> f/g; [5,3,10,4](6)(7) gap> f*g^-1; [5,3,10,4](6)(7) -gap> f:=RandomPartialPerm(10000);; DomainOfPartialPerm(f);; -gap> g:=RandomPartialPerm(10000);; +gap> f:=PartialPerm([1, 10000], [10000, 2]);; DomainOfPartialPerm(f);; +gap> g:=PartialPerm([1, 10000], [10000, 2]);; gap> f/g=f*g^-1; true @@ -1668,80 +1670,88 @@ gap> f:=PartialPermNC([ 1, 8, 10, 0, 4, 3, 7, 0, 0, 2 ]);; gap> g:=PartialPermNC([5,9,4,2,0,3,7,6,0,10]);; gap> f/g=f*g^-1; true -gap> f:=RandomPartialPerm(10000);; -gap> g:=RandomPartialPerm(10000);; +gap> f:=PartialPerm([1, 10000], [10000, 2]);; +gap> g:=PartialPerm([1, 10000], [10000, 2]);; gap> f/g=f*g^-1; true # QuoPPerm24, Case 1 of 4, dom(f) known, dom(g) known -gap> f:=RandomPartialPerm(20);; DomainOfPartialPerm(f);; -gap> g:=RandomPartialPerm(100000);; DomainOfPartialPerm(g);; +gap> f:=PartialPerm( [ 1, 2, 3, 4, 5, 6, 7, 9, 11, 12, 15, 16, 19 ], +> [ 2, 4, 11, 1, 20, 10, 15, 16, 5, 3, 6, 12, 9 ] );; DomainOfPartialPerm(f);; +gap> g:=PartialPerm([1, 100000], [100000, 2]);; DomainOfPartialPerm(g);; gap> f/g=f*g^-1; true # QuoPPerm24, Case 2 of 4, dom(f) known, dom(g) unknown -gap> f:=RandomPartialPerm(20);; DomainOfPartialPerm(f);; -gap> g:=RandomPartialPerm(100000);; +gap> f:=PartialPerm( [ 1, 2, 3, 4, 5, 6, 7, 9, 11, 12, 15, 16, 19 ], +> [ 2, 4, 11, 1, 20, 10, 15, 16, 5, 3, 6, 12, 9 ] );; DomainOfPartialPerm(f);; +gap> g:=PartialPerm([1, 100000], [100000, 2]);; gap> f/g=f*g^-1; true # QuoPPerm24, Case 3 of 4, dom(f) unknown, dom(g) known -gap> f:=RandomPartialPerm(20);; -gap> g:=RandomPartialPerm(100000);; DomainOfPartialPerm(g);; +gap> f:=PartialPerm( [ 1, 2, 3, 4, 5, 6, 7, 9, 11, 12, 15, 16, 19 ], +> [ 2, 4, 11, 1, 20, 10, 15, 16, 5, 3, 6, 12, 9 ] );; +gap> g:=PartialPerm([1, 100000], [100000, 2]);; DomainOfPartialPerm(g);; gap> f/g=f*g^-1; true # QuoPPerm24, Case 4 of 4, dom(f) unknown, dom(g) unknown -gap> f:=RandomPartialPerm(20);; -gap> g:=RandomPartialPerm(100000);; +gap> f:=PartialPerm( [ 1, 2, 3, 4, 5, 6, 7, 9, 11, 12, 15, 16, 19 ], +> [ 2, 4, 11, 1, 20, 10, 15, 16, 5, 3, 6, 12, 9 ] );; +gap> g:=PartialPerm([1, 100000], [100000, 2]);; gap> f/g=f*g^-1; true # QuoPPerm42, Case 1 of 4, dom(f) known, dom(g) known -gap> f:=RandomPartialPerm(100000);; DomainOfPartialPerm(f);; -gap> g:=RandomPartialPerm(20);; DomainOfPartialPerm(g);; +gap> f:=PartialPerm([1, 100000], [100000, 2]);; DomainOfPartialPerm(f);; +gap> g:=PartialPerm( [ 1, 2, 3, 4, 5, 6, 7, 9, 11, 12, 15, 16, 19 ], +> [ 2, 4, 11, 1, 20, 10, 15, 16, 5, 3, 6, 12, 9 ] );; DomainOfPartialPerm(g);; gap> f/g=f*g^-1; true # QuoPPerm42, Case 2 of 4, dom(f) known, dom(g) unknown -gap> f:=RandomPartialPerm(100000);; DomainOfPartialPerm(f);; -gap> g:=RandomPartialPerm(20);; +gap> f:=PartialPerm([1, 100000], [100000, 2]);; DomainOfPartialPerm(f);; +gap> g:=PartialPerm( [ 1, 2, 3, 4, 5, 6, 7, 9, 11, 12, 15, 16, 19 ], +> [ 2, 4, 11, 1, 20, 10, 15, 16, 5, 3, 6, 12, 9 ] );; gap> f/g=f*g^-1; true # QuoPPerm42, Case 3 of 4, dom(f) unknown, dom(g) known -gap> f:=RandomPartialPerm(100000);; -gap> g:=RandomPartialPerm(20);; DomainOfPartialPerm(g);; +gap> f:=PartialPerm([1, 100000], [100000, 2]);; +gap> g:=PartialPerm( [ 1, 2, 3, 4, 5, 6, 7, 9, 11, 12, 15, 16, 19 ], +> [ 2, 4, 11, 1, 20, 10, 15, 16, 5, 3, 6, 12, 9 ] );; DomainOfPartialPerm(g);; gap> f/g=f*g^-1; true # QuoPPerm42, Case 4 of 4, dom(f) unknown, dom(g) unknown -gap> f:=RandomPartialPerm(100000);; -gap> g:=RandomPartialPerm(20);; +gap> f:=PartialPerm([1, 100000], [100000, 2]);; +gap> g:=PartialPerm( [ 1, 2, 3, 4, 5, 6, 7, 9, 11, 12, 15, 16, 19 ], +> [ 2, 4, 11, 1, 20, 10, 15, 16, 5, 3, 6, 12, 9 ] );; gap> f/g=f*g^-1; true # QuoPPerm44, Case 1 of 4, dom(f) known, dom(g) known -gap> f:=RandomPartialPerm(100000);; DomainOfPartialPerm(f);; -gap> g:=RandomPartialPerm(100000);; DomainOfPartialPerm(g);; +gap> f:=PartialPerm([1, 100000], [100000, 2]);; DomainOfPartialPerm(f);; +gap> g:=PartialPerm([1, 100000], [100000, 2]);; DomainOfPartialPerm(g);; gap> f/g=f*g^-1; true # QuoPPerm44, Case 2 of 4, dom(f) known, dom(g) unknown -gap> f:=RandomPartialPerm(100000);; DomainOfPartialPerm(f);; -gap> g:=RandomPartialPerm(100000);; +gap> f:=PartialPerm([1, 100000], [100000, 2]);; DomainOfPartialPerm(f);; +gap> g:=PartialPerm([1, 100000], [100000, 2]);; gap> f/g=f*g^-1; true # QuoPPerm44, Case 3 of 4, dom(f) unknown, dom(g) known -gap> f:=RandomPartialPerm(100000);; -gap> g:=RandomPartialPerm(100000);; DomainOfPartialPerm(g);; +gap> f:=PartialPerm([1, 100000], [100000, 2]);; +gap> g:=PartialPerm([1, 100000], [100000, 2]);; DomainOfPartialPerm(g);; gap> f/g=f*g^-1; true # QuoPPerm44, Case 4 of 4, dom(f) unknown, dom(g) unknown -gap> f:=RandomPartialPerm(100000);; -gap> g:=RandomPartialPerm(100000);; +gap> f:=PartialPerm([1, 100000], [100000, 2]);; +gap> g:=PartialPerm([1, 100000], [100000, 2]);; gap> f/g=f*g^-1; true @@ -1787,32 +1797,32 @@ gap> p^-1*f; [5,8][7,10][13,2][16,3][17,1](4,6,9) gap> last=last2; true -gap> f:=RandomPartialPerm(65535);; -gap> p:=Random(SymmetricGroup(65536));; +gap> f:=PartialPerm([1, 65535], [65535, 2]);; +gap> p:=(17, 65536);; gap> LQUO(p, f)=p^-1*f; true # LQuoPerm2PPerm4, Case 1 of 4, deg(p) f:=RandomPartialPerm(65536);; -gap> p:=Random(SymmetricGroup(60000));; +gap> f:=PartialPerm([1, 65536], [65536, 2]);; +gap> p:=(17, 60000);; gap> LQUO(p, f)=p^-1*f; true # LQuoPerm2PPerm4, Case 2 of 4, deg(p) f:=RandomPartialPerm(65536);; DomainOfPartialPerm(f);; -gap> p:=Random(SymmetricGroup(60000));; +gap> f:=PartialPerm([1, 65536], [65536, 2]);; DomainOfPartialPerm(f);; +gap> p:=(17, 60000);; gap> LQUO(p, f)=p^-1*f; true # LQuoPerm2PPerm4, Case 3 of 4, deg(p)>=deg(f), dom(f) unknown -gap> f:=RandomPartialPerm(65536);; -gap> p:=Random(SymmetricGroup(70000));; +gap> f:=PartialPerm([1, 65536], [65536, 2]);; +gap> p:=(17, 70000);; gap> LQUO(p, f)=p^-1*f; true # LQuoPerm2PPerm4, Case 4 of 4, deg(p)>=deg(f), dom(f) known -gap> f:=RandomPartialPerm(65536);; DomainOfPartialPerm(f);; -gap> p:=Random(SymmetricGroup(60000));; +gap> f:=PartialPerm([1, 65536], [65536, 2]);; DomainOfPartialPerm(f);; +gap> p:=(17, 60000);; gap> LQUO(p, f)=p^-1*f; true @@ -1820,7 +1830,7 @@ true gap> f:=PartialPermNC( [ 2, 3, 4, 5, 6, 7, 8, 10, 11, 12, 14, 15, 17, 19 ], > [ 19, 7, 17, 14, 8, 5, 3, 18, 15, 13, 2, 12, 10, 20 ] );; gap> f:=JoinOfPartialPerms(f, PartialPermNC([100000], [1]));; -gap> p:=Random(SymmetricGroup(70000));; +gap> p:=(17, 70000);; gap> LQUO(p, f)=p^-1*f; true @@ -1829,7 +1839,7 @@ gap> f:=PartialPermNC( [ 2, 3, 4, 5, 6, 7, 8, 10, 11, 12, 14, 15, 17, 19 ], > [ 19, 7, 17, 14, 8, 5, 3, 18, 15, 13, 2, 12, 10, 20 ] );; gap> f:=JoinOfPartialPerms(f, PartialPermNC([100000], [1]));; gap> DomainOfPartialPerm(f);; -gap> p:=Random(SymmetricGroup(70000));; +gap> p:=(17, 70000);; gap> LQUO(p, f)=p^-1*f; true @@ -1837,7 +1847,7 @@ true gap> f:=PartialPermNC( [ 2, 3, 4, 5, 6, 7, 8, 10, 11, 12, 14, 15, 17, 19 ], > [ 19, 7, 17, 14, 8, 5, 3, 18, 15, 13, 2, 12, 10, 20 ] );; gap> f:=JoinOfPartialPerms(f, PartialPermNC([10000], [1]));; -gap> p:=Random(SymmetricGroup(70000));; +gap> p:=(17, 70000);; gap> LQUO(p, f)=p^-1*f; true @@ -1846,33 +1856,33 @@ gap> f:=PartialPermNC( [ 2, 3, 4, 5, 6, 7, 8, 10, 11, 12, 14, 15, 17, 19 ], > [ 19, 7, 17, 14, 8, 5, 3, 18, 15, 13, 2, 12, 10, 20 ] );; gap> f:=JoinOfPartialPerms(f, PartialPermNC([10000], [1]));; gap> DomainOfPartialPerm(f);; -gap> p:=Random(SymmetricGroup(70000));; +gap> p:=(17, 70000);; gap> LQUO(p, f)=p^-1*f; true # LQuoPerm4PPerm4, Case 1 of 4, deg(p) f:=RandomPartialPerm(70000);; -gap> p:=Random(SymmetricGroup(66000));; +gap> f:=PartialPerm([1, 70000], [70000, 2]);; +gap> p:=(17, 66000);; gap> LQUO(p, f)=p^-1*f; true # LQuoPerm4PPerm4, Case 2 of 4, deg(p) f:=RandomPartialPerm(70000);; +gap> f:=PartialPerm([1, 70000], [70000, 2]);; gap> DomainOfPartialPerm(f);; -gap> p:=Random(SymmetricGroup(66000));; +gap> p:=(17, 66000);; gap> LQUO(p, f)=p^-1*f; true # LQuoPerm4PPerm4, Case 3 of 4, deg(p)>=deg(f), dom(f) unknown -gap> f:=RandomPartialPerm(66000);; -gap> p:=Random(SymmetricGroup(70000));; +gap> f:=PartialPerm([1, 66000], [66000, 2]);; +gap> p:=(17, 70000);; gap> LQUO(p, f)=p^-1*f; true # LQuoPerm4PPerm4, Case 4 of 4, deg(p)>=deg(f), dom(f) known -gap> f:=RandomPartialPerm(66000);; +gap> f:=PartialPerm([1, 66000], [66000, 2]);; gap> DomainOfPartialPerm(f);; -gap> p:=Random(SymmetricGroup(70000));; +gap> p:=(17, 70000);; gap> LQUO(p, f)=p^-1*f; true @@ -1887,8 +1897,8 @@ gap> f^-1*g; [2,11,4,5][10,7][12,1][15,20][19,3,13](8,18,14)(9) gap> last=last2; true -gap> f:=RandomPartialPerm(10000);; -gap> g:=RandomPartialPerm(9000);; +gap> f:=PartialPerm([1, 10000], [10000, 2]);; +gap> g:=PartialPerm([1, 9000], [9000, 2]);; gap> LQUO(f, g)=f^-1*g; true @@ -1901,72 +1911,72 @@ gap> LQUO(f, g)=f^-1*g; true gap> LQUO(f, g); [8,12][16,2][18,1,9,5][19,11,10][20,7] -gap> f:=RandomPartialPerm(9000);; DomainOfPartialPerm(f);; -gap> g:=RandomPartialPerm(10000);; DomainOfPartialPerm(g);; +gap> f:=PartialPerm([1, 9000], [9000, 2]);; DomainOfPartialPerm(f);; +gap> g:=PartialPerm([1, 10000], [10000, 2]);; DomainOfPartialPerm(g);; gap> LQUO(f, g)=f^-1*g; true # LQuoPPerm22, Case 3 of 3, dom(g) known, deg(g)<=deg(f) -gap> f:=RandomPartialPerm(10000);; DomainOfPartialPerm(f);; -gap> g:=RandomPartialPerm(9000);; DomainOfPartialPerm(g);; +gap> f:=PartialPerm([1, 10000], [10000, 2]);; DomainOfPartialPerm(f);; +gap> g:=PartialPerm([1, 9000], [9000, 2]);; DomainOfPartialPerm(g);; gap> LQUO(f, g)=f^-1*g; true # LQuoPPerm24, Case 1 of 3, dom(g) unknown -gap> f:=RandomPartialPerm(100);; -gap> g:=RandomPartialPerm(100000);; +gap> f:=PartialPerm([1, 100], [100, 2]);; +gap> g:=PartialPerm([1, 100000], [100000, 2]);; gap> LQUO(f, g)=f^-1*g; true # LQuoPPerm24, Case 2 of 3, dom(g) known, deg(g)>deg(f) -gap> f:=RandomPartialPerm(100);; -gap> g:=RandomPartialPerm(100000);; DomainOfPartialPerm(g);; +gap> f:=PartialPerm([1, 100], [100, 2]);; +gap> g:=PartialPerm([1, 100000], [100000, 2]);; DomainOfPartialPerm(g);; gap> LQUO(f, g)=f^-1*g; true # LQuoPPerm24, Case 3 of 3, dom(g) known, deg(g)<=deg(f) -gap> f:=RandomPartialPerm(9000);; -gap> g:=RandomPartialPerm(100);; +gap> f:=PartialPerm([1, 9000], [9000, 2]);; +gap> g:=PartialPerm([1, 100], [100, 2]);; gap> g:=JoinOfPartialPerms(g, PartialPermNC([101], [100000]));; gap> DomainOfPartialPerm(g);; gap> LQUO(f, g)=f^-1*g; true # LQuoPPerm42, Case 1 of 3, dom(g) unknown -gap> f:=RandomPartialPerm(100000);; -gap> g:=RandomPartialPerm(100);; +gap> f:=PartialPerm([1, 100000], [100000, 2]);; +gap> g:=PartialPerm([1, 100], [100, 2]);; gap> LQUO(f, g)=f^-1*g; true # LQuoPPerm42, Case 2 of 3, dom(g) known, deg(g)>deg(f) -gap> f:=RandomPartialPerm(100000);; -gap> g:=RandomPartialPerm(100);; +gap> f:=PartialPerm([1, 100000], [100000, 2]);; +gap> g:=PartialPerm([1, 100], [100, 2]);; gap> g:=JoinOfPartialPerms(g, PartialPermNC([100001],[101]));; gap> DomainOfPartialPerm(g);; gap> LQUO(f, g)=f^-1*g; true # LQuoPPerm42, Case 3 of 3, dom(g) known, deg(g)<=deg(f) -gap> f:=RandomPartialPerm(100000);; -gap> g:=RandomPartialPerm(100);; DomainOfPartialPerm(g);; +gap> f:=PartialPerm([1, 100000], [100000, 2]);; +gap> g:=PartialPerm([1, 100], [100, 2]);; DomainOfPartialPerm(g);; gap> LQUO(f, g)=f^-1*g; true # LQuoPPerm44, Case 1 of 3, dom(g) unknown -gap> f:=RandomPartialPerm(65536);; -gap> g:=RandomPartialPerm(65536);; +gap> f:=PartialPerm([1, 65536], [65536, 2]);; +gap> g:=PartialPerm([1, 65536], [65536, 2]);; gap> LQUO(f, g)=f^-1*g; true # LQuoPPerm44, Case 2 of 3, dom(g) known, deg(g)>deg(f) -gap> f:=RandomPartialPerm(65536);; -gap> g:=RandomPartialPerm(66000);; DomainOfPartialPerm(g);; +gap> f:=PartialPerm([1, 65536], [65536, 2]);; +gap> g:=PartialPerm([1, 66000], [66000, 2]);; DomainOfPartialPerm(g);; gap> LQUO(f, g)=f^-1*g; true # LQuoPPerm44, Case 3 of 3, dom(g) known, deg(g)<=deg(f) -gap> f:=RandomPartialPerm(66000);; -gap> g:=RandomPartialPerm(66553);; DomainOfPartialPerm(g);; +gap> f:=PartialPerm([1, 66000], [66000, 2]);; +gap> g:=PartialPerm([1, 66553], [66553, 2]);; DomainOfPartialPerm(g);; gap> LQUO(f, g)=f^-1*g; true @@ -1981,8 +1991,8 @@ gap> f^g; [1,12][4,2,11][13,8,21](5,25)(22)(24) gap> g^-1*f*g; [1,12][4,2,11][13,8,21](5,25)(22)(24) -gap> f:=RandomPartialPerm(20000);; -gap> g:=RandomPartialPerm(30000);; +gap> f:=PartialPerm([1, 20000], [20000, 2]);; +gap> g:=PartialPerm([1, 30000], [30000, 2]);; gap> f^g=g^-1*f*g; true @@ -2022,8 +2032,8 @@ gap> g^-1*f*g; [18,9][20,8](11)(14) gap> last=last2; true -gap> f:=RandomPartialPerm(50000);; -gap> g:=RandomPartialPerm(40000);; +gap> f:=PartialPerm([1, 50000], [50000, 2]);; +gap> g:=PartialPerm([1, 40000], [40000, 2]);; gap> f^g=g^-1*f*g; true @@ -2051,16 +2061,18 @@ gap> g^-1*f*g; [4,6][10,1][17,13](19) # PowPPerm24, Case 1 of 6, dom(f) not known, codeg(f)<=deg(g) -gap> f:=RandomPartialPerm(10);; -gap> g:=RandomPartialPerm(65536);; +gap> f:=PartialPerm( [ 1, 2, 3, 6, 10 ], [ 2, 7, 8, 10, 6 ] );; +gap> g:=PartialPerm([1, 65536], [65536, 2]);; gap> f^g=g^-1*f*g; true # PowPPerm24, Case 2 of 6, dom(f) not known, codeg(f)> deg(g) -gap> f:=RandomPartialPerm(10);; +gap> f:=PartialPerm( [ 1, 2, 3, 6, 10 ], [ 2, 7, 8, 10, 6 ] );; gap> f:=JoinOfPartialPerms(f, PartialPermNC([11], [100]));; gap> g:=PartialPermNC([10], [65536]);; -gap> g:=JoinOfPartialPerms(g, RandomPartialPerm(9));; +gap> g:=JoinOfPartialPerms(g, +> PartialPerm([1, 2, 3, 4, 5, 6, 7], +> [8, 3, 6, 1, 5, 7, 2]));; gap> f^g=g^-1*f*g; true @@ -2069,7 +2081,7 @@ gap> f:=PartialPerm( [ 1, 2, 4, 6, 7 ], [ 6, 9, 8, 5, 7 ] );; gap> f:=JoinOfPartialPerms(f, PartialPermNC([11], [100]));; gap> f:=f^-1;; DomainOfPartialPerm(f);; gap> g:=PartialPermNC([20], [65536]);; -gap> g:=JoinOfPartialPerms(g, RandomPartialPerm(9));; +gap> g:=JoinOfPartialPerms(g, PartialPerm( [ 1, 2, 3, 4, 5, 6, 7 ], [ 8, 3, 6, 1, 5, 7, 2 ] ));; gap> DegreeOfPartialPerm(f)>DegreeOfPartialPerm(g); true gap> CodegreeOfPartialPerm(f)<=DegreeOfPartialPerm(g); @@ -2078,7 +2090,10 @@ gap> f^g = g^-1*f*g; true # PowPPerm24, Case 4 of 6, dom(f) known, deg(f)>deg(g), codeg(f)> deg(g) -gap> f:=RandomPartialPerm(30);; DomainOfPartialPerm(f);; +gap> f:=PartialPerm( +> [ 1, 2, 3, 4, 5, 6, 8, 9, 14, 15, 16, 17, 18, 19, 21, 24, 25, 26, 27 ], +> [ 14, 11, 12, 22, 18, 8, 4, 5, 1, 23, 29, 6, 17, 21, 30, 9, 15, 2, 7 ] );; +> DomainOfPartialPerm(f);; gap> DegreeOfPartialPerm(f)>DegreeOfPartialPerm(g); true gap> CoDegreeOfPartialPerm(f)>DegreeOfPartialPerm(g); @@ -2087,8 +2102,10 @@ gap> f^g=g^-1*f*g; true # PowPPerm24, Case 5 of 6, dom(f) known, deg(f)<=deg(g), codeg(f)<=deg(g) -gap> f:=RandomPartialPerm(30);; DomainOfPartialPerm(f);; -gap> g:=RandomPartialPerm(65536);; +gap> f:=PartialPerm( +> [ 1, 2, 3, 4, 5, 6, 8, 9, 14, 15, 16, 17, 18, 19, 21, 24, 25, 26, 27 ], +> [ 14, 11, 12, 22, 18, 8, 4, 5, 1, 23, 29, 6, 17, 21, 30, 9, 15, 2, 7 ] );; DomainOfPartialPerm(f);; +gap> g:=PartialPerm([1, 65536], [65536, 2]);; gap> f^g=g^-1*f*g; true @@ -2139,15 +2156,15 @@ gap> g^-1*f*g=last; true # PowPPerm42, Case 4 of 6, dom(f) known, deg(f)>deg(g), codeg(f)> deg(g) -gap> f:=RandomPartialPerm(70000);; DomainOfPartialPerm(f);; -gap> g:=RandomPartialPerm(10);; +gap> f:=PartialPerm([1, 70000], [70000, 2]);; DomainOfPartialPerm(f);; +gap> g:=PartialPerm( [ 1, 2, 3, 6, 10 ], [ 2, 7, 8, 10, 6 ] );; gap> f^g=g^-1*f*g; true # PowPPerm42, Case 5 of 6, dom(f) known, deg(f)<=deg(g), codeg(f)<=deg(g) gap> g:=PartialPermNC( [ 1, 2, 3, 4, 5, 9, 100000 ], > [ 9, 3, 8, 2, 10, 7, 11 ] );; -gap> f:=RandomPartialPerm(70000);; DomainOfPartialPerm(f);; +gap> f:=PartialPerm([1, 70000], [70000, 2]);; DomainOfPartialPerm(f);; gap> f^g=g^-1*f*g; true @@ -2198,15 +2215,15 @@ gap> g^-1*f*g=last; true # PowPPerm44, Case 4 of 6, dom(f) known, deg(f)>deg(g), codeg(f)> deg(g) -gap> f:=RandomPartialPerm(70000);; +gap> f:=PartialPerm([1, 70000], [70000, 2]);; gap> DomainOfPartialPerm(f);; -gap> g:=RandomPartialPerm(66000);; +gap> g:=PartialPerm([1, 66000], [66000, 2]);; gap> f^g=g^-1*f*g; true # PowPPerm44, Case 5 of 6, dom(f) known, deg(f)<=deg(g), codeg(f)<=deg(g) -gap> f:=RandomPartialPerm(66000);; DomainOfPartialPerm(f);; -gap> g:=RandomPartialPerm(70000);; +gap> f:=PartialPerm([1, 66000], [66000, 2]);; DomainOfPartialPerm(f);; +gap> g:=PartialPerm([1, 70000], [70000, 2]);; gap> f^g=g^-1*f*g; true @@ -2275,7 +2292,7 @@ gap> f[4]^10; gap> f[4]^-4; [8,3](2)(7) gap> -gap> f:=RandomPartialPerm(10000);; +gap> f:=PartialPerm([1, 10000], [10000, 2]);; gap> g:=f^-1;; gap> ForAll(DomainOfPartialPerm(f), i-> (i^f)^g=i); true From c60d83c129ebf4e19bd677dd5acf6f56d1405132 Mon Sep 17 00:00:00 2001 From: James Mitchell Date: Mon, 26 Mar 2018 17:23:00 +0200 Subject: [PATCH 3/9] pperm: IsPosInt -> IsPosInt and IsSmallIntRep This change is necessary since none of the kernel methods work for non-small int rep integers. --- lib/pperm.gi | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/lib/pperm.gi b/lib/pperm.gi index 40c2cea1ca..1a55cbb5a8 100644 --- a/lib/pperm.gi +++ b/lib/pperm.gi @@ -113,13 +113,13 @@ InstallMethod(RightOne, "for a partial perm", InstallMethod(PreImagePartialPerm, "for a partial perm and positive integer", -[IsPartialPerm, IsPosInt], PREIMAGE_PPERM_INT); +[IsPartialPerm, IsPosInt and IsSmallIntRep], PREIMAGE_PPERM_INT); # InstallMethod(ComponentPartialPermInt, "for a partial perm and positive integer", -[IsPartialPerm, IsPosInt], COMPONENT_PPERM_INT); +[IsPartialPerm, IsPosInt and IsSmallIntRep], COMPONENT_PPERM_INT); # @@ -191,7 +191,8 @@ InstallMethod(AsPartialPerm, "for a perm and a list", [IsPerm, IsList], function(p, list) - if not IsSSortedList(list) or not ForAll(list, IsPosInt) then + if not IsSSortedList(list) + or not ForAll(list, x -> IsSmallIntRep(x) and IsPosInt(x)) then ErrorNoReturn("usage: the second argument must be a set of positive integers,"); fi; @@ -206,7 +207,7 @@ InstallMethod(AsPartialPerm, "for a perm", # InstallMethod(AsPartialPerm, "for a perm and pos int", -[IsPerm, IsPosInt], +[IsPerm, IsPosInt and IsSmallIntRep], function(p, n) return AS_PPERM_PERM(p, [1..n]); end); @@ -225,7 +226,8 @@ InstallMethod(AsPartialPerm, "for a transformation and list", [IsTransformation, IsList], function(f, list) - if not IsSSortedList(list) or not ForAll(list, IsPosInt) then + if not IsSSortedList(list) + or not ForAll(list, x -> IsSmallIntRep(x) and IsPosInt(x)) then ErrorNoReturn("usage: the second argument must be a set of positive ", "integers,"); elif not IsInjectiveListTrans(list, f) then @@ -238,14 +240,14 @@ end); # InstallMethod(AsPartialPerm, "for a transformation and positive int", -[IsTransformation, IsPosInt], +[IsTransformation, IsPosInt and IsSmallIntRep], function(f, n) return AsPartialPerm(f, [1..n]); end); # n is image of undefined points InstallMethod(AsTransformation, "for a partial perm and positive integer", -[IsPartialPerm, IsPosInt], +[IsPartialPerm, IsPosInt and IsSmallIntRep], function(f, n) local deg, out, i; @@ -277,7 +279,8 @@ InstallMethod(RestrictedPartialPerm, "for a partial perm", [IsPartialPerm, IsList], function(f, list) - if not IsSSortedList(list) or not ForAll(list, IsPosInt) then + if not IsSSortedList(list) + or not ForAll(list, x -> IsSmallIntRep(x) and IsPosInt(x)) then ErrorNoReturn("usage: the second argument must be a set of positive integers,"); fi; @@ -462,12 +465,12 @@ function(arg) local source, min, max, n, out, seen, j, dom, img, out1, out2, i; if Length(arg)=1 then - if IsPosInt(arg[1]) then + if IsSmallIntRep(arg[1]) and IsPosInt(arg[1]) then source:=[1..arg[1]]; min:=0; max:=arg[1]; - elif IsCyclotomicCollection(arg[1]) and IsSSortedList(arg[1]) and - ForAll(arg[1], IsPosInt) then + elif IsCyclotomicCollection(arg[1]) and IsSSortedList(arg[1]) + and ForAll(arg[1], x -> IsSmallIntRep(x) and IsPosInt(x)) then source:=arg[1]; n:=Length(source); min:=Minimum(source)-1; @@ -490,8 +493,9 @@ function(arg) return DensePartialPermNC(out); # for a domain and image elif Length(arg)=2 and IsCyclotomicCollColl(arg) - and ForAll(arg, IsSSortedList) and ForAll(arg[1], IsPosInt) - and ForAll(arg[2], IsPosInt) then + and ForAll(arg, IsSSortedList) + and ForAll(arg[1], x -> IsSmallIntRep(x) and IsPosInt(x)) + and ForAll(arg[2], x -> IsSmallIntRep(x) and IsPosInt(x)) then dom:=arg[1]; img:=arg[2]; out1:=EmptyPlist(Length(dom)); @@ -536,7 +540,7 @@ InstallGlobalFunction(PartialPerm, function(arg) if Length(arg)=1 then - if ForAll(arg[1], i-> i=0 or IsPosInt(i)) and + if ForAll(arg[1], i -> IsSmallIntRep(i) and i >= 0) and IsDuplicateFreeList(Filtered(arg[1], x-> x<>0)) then return DensePartialPermNC(arg[1]); else @@ -544,8 +548,8 @@ function(arg) "and the non-zero elements must be duplicate-free,"); fi; elif Length(arg)=2 then - if IsSSortedList(arg[1]) and ForAll(arg[1], IsPosInt) and - IsDuplicateFreeList(arg[2]) and ForAll(arg[2], IsPosInt) and + if IsSSortedList(arg[1]) and ForAll(arg[1], IsSmallIntRep) and + IsDuplicateFreeList(arg[2]) and ForAll(arg[2], IsSmallIntRep) and Length(arg[1]) = Length(arg[2]) then return SparsePartialPermNC(arg[1], arg[2]); else From 66fe34787be2b02fc968bf4d0ed29106764489d0 Mon Sep 17 00:00:00 2001 From: James Mitchell Date: Tue, 27 Mar 2018 16:07:58 +0200 Subject: [PATCH 4/9] pperm: add tests and resolve issues in GAP code --- lib/pperm.gi | 13 +- tst/testinstall/invsgp.tst | 9 +- tst/testinstall/pperm.tst | 382 ++++++++++++++++++++++++++++++++++++- 3 files changed, 390 insertions(+), 14 deletions(-) diff --git a/lib/pperm.gi b/lib/pperm.gi index 1a55cbb5a8..6d751a2917 100644 --- a/lib/pperm.gi +++ b/lib/pperm.gi @@ -80,10 +80,13 @@ end); InstallMethod(SmallestMovedPoint, "for a partial perm", [IsPartialPerm], function(f) - if IsOne(f) then + local m; + m := SMALLEST_MOVED_PT_PPERM(f); + if m = fail then return infinity; + else + return m; fi; - return SMALLEST_MOVED_PT_PPERM(f); end); InstallMethod(SmallestImageOfMovedPoint, "for a partial perm", @@ -329,7 +332,6 @@ function(f, D, act) D:=ShallowCopy(D); perm:=Sortex(D); D:=Immutable(D); - SetIsSSortedList(D, true); fi; fi; @@ -402,7 +404,6 @@ function(f, D, act) D:=ShallowCopy(D); perm:=Sortex(D); D:=Immutable(D); - SetIsSSortedList(D, true); fi; fi; @@ -567,7 +568,7 @@ end); InstallMethod(String, "for a partial perm", [IsPartialPerm], function(f) - return STRINGIFY("PartialPermNC( ", DomainOfPartialPerm(f), ", ", + return STRINGIFY("PartialPerm( ", DomainOfPartialPerm(f), ", ", ImageListOfPartialPerm(f), " )"); end); @@ -576,7 +577,7 @@ end); InstallMethod(PrintString, "for a partial perm", [IsPartialPerm], function(f) - return PRINT_STRINGIFY("PartialPermNC( ", + return PRINT_STRINGIFY("PartialPerm( ", Concatenation(PrintString(DomainOfPartialPerm(f)), ", "), ImageListOfPartialPerm(f), " )"); end); diff --git a/tst/testinstall/invsgp.tst b/tst/testinstall/invsgp.tst index 505c9b6b05..3206476371 100644 --- a/tst/testinstall/invsgp.tst +++ b/tst/testinstall/invsgp.tst @@ -5,7 +5,6 @@ ## #Y Copyright (C) 2016 ## - gap> START_TEST("invsgp.tst"); # Test String method for inverse semigroup with generators as a semigroup @@ -43,16 +42,16 @@ true # Test string method for inverse monoid with inverse monoid generators gap> S := InverseMonoid(PartialPerm([1, 2, 3]), PartialPerm([1], [2]));; gap> String(S); -"InverseMonoid( [ PartialPermNC( [ 1, 2, 3 ], [ 1, 2, 3 ] ), PartialPermNC( [ \ -1 ], [ 2 ] ) ] )" +"InverseMonoid( [ PartialPerm( [ 1, 2, 3 ], [ 1, 2, 3 ] ), PartialPerm( [ 1 ],\ + [ 2 ] ) ] )" gap> S = EvalString(String(S)); true # Test string method for inverse semigroup with inverse semigroup generators gap> S := InverseSemigroup(PartialPerm([1, 2, 3]), PartialPerm([1], [2]));; gap> String(S); -"InverseMonoid( [ PartialPermNC( [ 1, 2, 3 ], [ 1, 2, 3 ] ), PartialPermNC( [ \ -1 ], [ 2 ] ) ] )" +"InverseMonoid( [ PartialPerm( [ 1, 2, 3 ], [ 1, 2, 3 ] ), PartialPerm( [ 1 ],\ + [ 2 ] ) ] )" gap> S = EvalString(String(S)); true diff --git a/tst/testinstall/pperm.tst b/tst/testinstall/pperm.tst index af2ab8c815..cbfd5c2738 100644 --- a/tst/testinstall/pperm.tst +++ b/tst/testinstall/pperm.tst @@ -38,6 +38,8 @@ gap> ImageSetOfPartialPerm(f); [ ] gap> ImageListOfPartialPerm(f); [ ] +gap> IMAGE_SET_PPERM(fail); +Error, usage: the argument must be a partial perm, # test input validation gap> DegreeOfPartialPerm(fail); @@ -120,6 +122,12 @@ gap> IndexPeriodOfPartialPerm(f); [ 2, 15 ] gap> IsIdempotent(f); false +gap> IndexPeriodOfPartialPerm(PartialPerm([1, 2, 10 ^ 5], [2, 10 ^ 5, 1])); +[ 1, 3 ] +gap> IsIdempotent(PartialPerm([2,3,1,5,6,7,8,4,10])); +false +gap> IsIdempotent(PartialPermNC([1 .. 70000] + 1)); +false # ComponentsOfPartialPerm, NrComponentsOfPartialPerm, # ComponentRepsOfPartialPerm and ComponentPartialPermInt @@ -157,6 +165,24 @@ gap> ComponentRepsOfPartialPerm(f); [ 9, 1, 4 ] gap> NrComponentsOfPartialPerm(f); 3 +gap> ComponentRepsOfPartialPerm(PartialPerm([1, 2, 10 ^ 5], [2, 10 ^ 5, 1])); +[ 1 ] +gap> NrComponentsOfPartialPerm(PartialPerm([1, 2, 10 ^ 5], [2, 10 ^ 5, 1])); +1 +gap> ComponentsOfPartialPerm(PartialPerm([1, 2, 10 ^ 5], [2, 10 ^ 5, 1])); +[ [ 1, 2, 100000 ] ] +gap> ComponentPartialPermInt(PartialPerm([1, 2, 10 ^ 5], [2, 10 ^ 5, 1]), +> 100000); +[ 100000, 1, 2 ] +gap> ComponentPartialPermInt(PartialPerm([1, 2, 10 ^ 5], [2, 10 ^ 5, 1]), +> 1000); +[ ] +gap> ComponentPartialPermInt(PartialPerm([1, 3], [3, 1]), +> 1000); +[ ] +gap> ComponentPartialPermInt(PartialPerm([1, 2], [2, 1]), +> 2); +[ 2, 1 ] # FixedPointsOfPartialPerm, MovedPoints, # NrFixedPoints, NrMovedPoints @@ -179,6 +205,8 @@ gap> DomainOfPartialPerm(f);; gap> FixedPointsOfPartialPerm(f)= > Filtered([1..DegreeOfPartialPerm(f)], i-> i^f=i); true +gap> NrFixedPoints(f); +0 gap> f:=PartialPerm([1, 100000], [100000, 2]);; gap> NrMovedPoints(f)+NrFixedPoints(f)= > RankOfPartialPerm(f); @@ -197,6 +225,89 @@ gap> Union(MovedPoints(f), FixedPointsOfPartialPerm(f))= true gap> Intersection(MovedPoints(f), FixedPointsOfPartialPerm(f)); [ ] +gap> f := PartialPerm(List([69950 .. 70000], function(x) +> if IsEvenInt(x) then +> return 0; +> else +> return x; +> fi; +> end));; +gap> FixedPointsOfPartialPerm(f); +[ ] +gap> NrFixedPoints(f); +0 +gap> MovedPoints(f); +[ 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, + 42, 44, 46, 48, 50 ] +gap> NrMovedPoints(f); +25 +gap> im := ListWithIdenticalEntries(70000, 0);; +gap> im[65536] := 65536; +65536 +gap> f := PartialPerm(im);; +gap> FixedPointsOfPartialPerm(f); +[ 65536 ] +gap> NrFixedPoints(f); +1 +gap> MovedPoints(f); +[ ] +gap> NrMovedPoints(f); +0 +gap> f := PartialPerm(List([7950 .. 8000], function(x) +> if IsEvenInt(x) then +> return 0; +> else +> return x; +> fi; +> end));; +gap> FixedPointsOfPartialPerm(f); +[ ] +gap> NrFixedPoints(f); +0 +gap> MovedPoints(f); +[ 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, + 42, 44, 46, 48, 50 ] +gap> NrMovedPoints(f); +25 +gap> f := PartialPerm(List([1 .. 100], function(x) +> if IsEvenInt(x) then +> return 0; +> else +> return x; +> fi; +> end));; +gap> FixedPointsOfPartialPerm(f); +[ 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, + 41, 43, 45, 47, 49, 51, 53, 55, 57, 59, 61, 63, 65, 67, 69, 71, 73, 75, 77, + 79, 81, 83, 85, 87, 89, 91, 93, 95, 97, 99 ] +gap> NrFixedPoints(f); +50 +gap> MovedPoints(f); +[ ] +gap> NrMovedPoints(f); +0 +gap> f := PartialPerm([1, 3 .. 99], [1, 3 .. 99]);; +gap> FixedPointsOfPartialPerm(f); +[ 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, + 41, 43, 45, 47, 49, 51, 53, 55, 57, 59, 61, 63, 65, 67, 69, 71, 73, 75, 77, + 79, 81, 83, 85, 87, 89, 91, 93, 95, 97, 99 ] +gap> NrFixedPoints(f); +50 +gap> MovedPoints(f); +[ ] +gap> NrMovedPoints(f); +0 +gap> f := PartialPerm([70001, 70003 .. 70099], [70001, 70003 .. 70099]);; +gap> FixedPointsOfPartialPerm(f); +[ 70001, 70003, 70005, 70007, 70009, 70011, 70013, 70015, 70017, 70019, + 70021, 70023, 70025, 70027, 70029, 70031, 70033, 70035, 70037, 70039, + 70041, 70043, 70045, 70047, 70049, 70051, 70053, 70055, 70057, 70059, + 70061, 70063, 70065, 70067, 70069, 70071, 70073, 70075, 70077, 70079, + 70081, 70083, 70085, 70087, 70089, 70091, 70093, 70095, 70097, 70099 ] +gap> NrFixedPoints(f); +50 +gap> MovedPoints(f); +[ ] # LargestMovedPoint, SmallestMovedPoint gap> f:=PartialPerm([1, 100000], [100000, 2]);; DomainOfPartialPerm(f);; @@ -275,14 +386,25 @@ gap> SmallestMovedPoint(f); gap> f:=PartialPermNC(Concatenation([100001], [2..100000]));; gap> SmallestMovedPoint(f); 1 -gap> f:=PartialPermNC([1..100000]); - +gap> f:=PartialPermNC([1..70000]);; +gap> SmallestMovedPoint(f); +infinity +gap> LargestMovedPoint(f); +0 +gap> f := PartialPermNC([1 .. 10]);; +gap> SmallestMovedPoint(f); +infinity +gap> f := PartialPermNC([1 .. 10], [1 .. 10]);; gap> SmallestMovedPoint(f); infinity +gap> SmallestMovedPoint(PartialPerm([69999, 70001], [69999, 70001])); +infinity # TRIM_PPERM gap> f:=PartialPermNC([65536]); [1,65536] +gap> TRIM_PPERM(f); +[1,65536] gap> g:=PartialPermNC([2,65536], [70000,1]); [2,70000][65536,1] gap> h:=f*g; @@ -301,8 +423,34 @@ gap> TRIM_PPERM(h); h; gap> IsPPerm2Rep(h); true +# HashFuncForPPerm and HASH_FUNC_FOR_PPERM +gap> f := PartialPerm([65536]);; +gap> HASH_FUNC_FOR_PPERM(f, 10 ^ 6); +260581 +gap> f := PartialPermNC([65535]);; +gap> HASH_FUNC_FOR_PPERM(f, 10 ^ 6); +354405 +gap> f := PartialPermNC([65535]);; +gap> HASH_FUNC_FOR_PPERM(f, 10 ^ 6); +354405 +gap> f := PartialPerm([1, 2, 3, 4, 5, 6, 7, 9, 11, 12, 15, 16, 19], +> [2, 4, 11, 1, 20, 10, 15, 16, 5, 3, 6, 12, 9]);; +gap> HASH_FUNC_FOR_PPERM(f, 10 ^ 6); +773594 +gap> f := PartialPermNC([65536]);; +gap> g := PartialPermNC([2, 65536], [70000, 1]);; +gap> h := f * g; + +gap> IsPPerm4Rep(h); +true +gap> HASH_FUNC_FOR_PPERM(h, 10 ^ 6); +567548 +gap> IsPPerm2Rep(h); +true + # LeftOne -gap> f:=PartialPerm( [ 1, 2, 3, 6, 10 ], [ 2, 7, 8, 10, 6 ] );; DomainOfPartialPerm(f);; +gap> f:=PartialPerm( [ 1, 2, 3, 6, 10 ], [ 2, 7, 8, 10, 6 ] );; +> DomainOfPartialPerm(f);; gap> e:=LeftOne(f);; gap> IsIdempotent(e); true @@ -543,6 +691,10 @@ true gap> g:=PartialPerm( [ 1, 3 ], [ 3, 1 ] );; gap> NaturalLeqPartialPerm(f,g); false +gap> NaturalLeqPartialPerm(fail, f); +Error, usage: the arguments must be partial perms, +gap> NaturalLeqPartialPerm(EmptyPartialPerm(), f); +true # AsPartialPerm gap> p:=(1,2,7,5)(3,9)(6,10,8);; @@ -577,6 +729,22 @@ gap> AsPartialPerm(p,9); gap> p:=(1,9)(10,100000);; gap> AsPartialPerm(p,9); (1,9)(2)(3)(4)(5)(6)(7)(8) +gap> AsPartialPerm((1,2), [1, 2, 2 ^ 61]); +Error, usage: the second argument must be a set of positive integers, +gap> AsPartialPerm((1,2), [1, 3, 2]); +Error, usage: the second argument must be a set of positive integers, +gap> AsPartialPerm((1,2), [1, "a", 2]); +Error, usage: the second argument must be a set of positive integers, +gap> AsPartialPerm((1,2), 0); + +gap> AsPartialPerm(Transformation([10, 8, 4, 6, 4, 5, 3, 8, 8, 2]), [1 .. 4]); +[1,10][2,8][3,4,6] +gap> AsPartialPerm(Transformation([10, 8, 4, 6, 4, 5, 3, 8, 8, 2]), [1 .. 5]); +Error, usage: the first argument must be injective on the second, +gap> AsPartialPerm(Transformation([10, 8, 4, 6, 4, 5, 3, 8, 8, 2]), [1, 2, 2, 3]); +Error, usage: the second argument must be a set of positive integers, +gap> AsPartialPerm(Transformation([10, 8, 4, 6, 4, 5, 3, 8, 8, 2]), 4); +[1,10][2,8][3,4,6] # JoinOfPartialPerms gap> f:=PartialPermNC([1],[2]);; @@ -622,6 +790,10 @@ gap> g:=PartialPermNC([0,100000]); [2,100000] gap> JoinOfPartialPerms(f,g); [1,2,100000] +gap> JoinOfPartialPerms([f, g]); +[1,2,100000] +gap> JoinOfPartialPerms(1, 2); +Error, usage: the argument should be a collection of partial perms, gap> JoinOfPartialPerms(last, PartialPermNC([100000],[1])); (1,2,100000) gap> g:=PartialPermNC([0,100000]);; @@ -675,6 +847,24 @@ gap> g:=PartialPermNC([8],[100000]); gap> JoinOfPartialPerms(f, g); [6,1,5,3][8,100000](4,7) +# JOIN_IDEM_PPERMS +gap> JOIN_IDEM_PPERMS(PartialPerm([1 .. 5]), +> PartialPerm([3 .. 10], [3 .. 10])); + +gap> JOIN_IDEM_PPERMS(PartialPerm([3 .. 10], [3 .. 10]), +> PartialPerm([1 .. 5])); + +gap> JOIN_IDEM_PPERMS(PartialPerm([3 .. 10], [3 .. 10]), +> PartialPerm([65536 .. 65538], [65536 .. 65538])); + +gap> JOIN_IDEM_PPERMS(PartialPerm([70000 .. 70010], [70000 .. 70010]), +> PartialPerm([65536 .. 65538], [65536 .. 65538])); + +gap> JoinOfIdempotentPartialPermsNC(1, 2); +Error, usage: the argument should be a collection of partial perms, + # MeetOfPartialPerms gap> f:=PartialPermNC([2]);; gap> g:=PartialPermNC([3]);; @@ -739,6 +929,10 @@ gap> g:=RestrictedPartialPerm(f, [10]); gap> g:=RestrictedPartialPerm(f, [5]); +gap> RestrictedPartialPerm(f, [2, 1, 3]); +Error, usage: the second argument must be a set of positive integers, +gap> RestrictedPartialPerm(f, [1, 2, 2 ^ 61]); +Error, usage: the second argument must be a set of positive integers, # AsPermutation gap> f:=PartialPermNC([10,2,3,4,5]); @@ -812,6 +1006,8 @@ gap> PermLeftQuoPartialPerm(f, g); (1,2) gap> PermLeftQuoPartialPerm(g, f); (1,2) +gap> PermLeftQuoPartialPerm(PartialPerm([1]), PartialPerm([2])); +Error, usage: the arguments must be partial perms with equal image sets, # Kernel level functions # @@ -2337,6 +2533,10 @@ gap> AsTransformation(f); gap> AsTransformation(f); +gap> AsTransformation(PartialPerm([1, 2, 3, 5, 6, 9, 10], +> [3, 5, 8, 4, 1, 9, 7]), +> 3); +Error, usage: the 2nd argument must not be a moved point of the 1st argument, gap> OnTuples([1..DegreeOfPartialPerm(f)], f); [ 9, 10, 5, 7, 2, 8 ] gap> g:=PartialPermNC([ 1, 2, 3, 4, 5, 6, 7, 8, 10, 11, 12, 13, 19 ], @@ -2463,6 +2663,182 @@ Error, usage: the 1st argument must be a set of positive integers and the 2nd \ argument must be a duplicate-free list of positive integers of equal length to\ the first +# New tests +gap> x := PartialPerm([0, 0, 0]); + + +# PreImagePPermInt +gap> 1 / EmptyPartialPerm(); +fail +gap> 1 / PartialPerm([1, 2, 4, 7, 9], [5, 3, 7, 4, 9]); +fail +gap> 3 / PartialPerm([1, 2, 4, 7, 9], [5, 3, 7, 4, 9]); +2 +gap> 3 / PartialPerm([10 ^ 5], [3]); +100000 +gap> 1 / PartialPerm([10 ^ 5], [3]); +fail +gap> 3 / PartialPerm([10 ^ 5], [10 ^ 5 + 1]); +fail +gap> (10 ^ 5 + 1) / PartialPerm([10 ^ 5], [10 ^ 5 + 1]); +100000 +gap> PreImagePartialPerm(PartialPerm([1, 2, 4, 7, 9], [5, 3, 7, 4, 9]), 1); +fail +gap> PreImagePartialPerm(PartialPerm([10 ^ 5], [3]), 3); +100000 + +# IsGeneratorsOfMagmaWithInverses +gap> IsGeneratorsOfMagmaWithInverses([PartialPerm([2]), PartialPerm([1])]); +false +gap> IsGeneratorsOfMagmaWithInverses([PartialPerm([2, 1]), PartialPerm([1])]); +false +gap> IsGeneratorsOfMagmaWithInverses([PartialPerm([2, 1]), PartialPerm([1, 2])]); +true + +# LargestImageOfMovedPoint +gap> LargestImageOfMovedPoint(EmptyPartialPerm()); +0 + +# SmallestImageOfMovedPoint +gap> SmallestImageOfMovedPoint(EmptyPartialPerm()); +infinity +gap> SmallestImageOfMovedPoint(PartialPerm([1, 2, 4, 7, 9], [1, 2, 7, 4, 9])); +4 + +# PartialPermOp/NC +gap> f := Transformation([9, 10, 4, 2, 10, 5, 9, 10, 9, 6]);; +gap> PartialPermOp(f, [6 .. 8], OnPoints); +[1,4][2,5][3,6] +gap> f := Transformation([9, 10, 4, 2, 10, 5, 9, 10, 9, 6]);; +gap> PartialPermOp(f, [8, 6, 7], OnPoints); +[1,5][2,6][3,4] +gap> PartialPermOp(f, [8, 6, 7, 6], OnPoints); +fail +gap> PartialPermOp(f, [7, 9], OnPoints); +fail +gap> PartialPermOp(f, [10, 11, 12], OnPoints); +[1,4](2)(3) +gap> PartialPermOp(f, [10, 11, 12]); +[1,4](2)(3) +gap> PartialPermOp(f, [10, 11, 12], function(x, f) +> if x > 10 then return 100; else return x ^ f; fi; end); +fail +gap> PartialPermOp(PartialPerm([1]), SymmetricInverseMonoid(2), OnRight); +fail +gap> PartialPermOp(PartialPerm([1]), SymmetricInverseMonoid(1), OnRight); + +gap> PartialPermOp(PartialPerm([1]), SymmetricInverseMonoid(1)); + +gap> f := Transformation([9, 10, 4, 2, 10, 5, 9, 10, 9, 6]);; +gap> PartialPermOpNC(f, [6 .. 8], OnPoints); +[1,4][2,5][3,6] +gap> f := Transformation([9, 10, 4, 2, 10, 5, 9, 10, 9, 6]);; +gap> PartialPermOpNC(f, [8, 6, 7], OnPoints); +[1,5][2,6][3,4] +gap> PartialPermOpNC(f, [10, 11, 12], OnPoints); +[1,4](2)(3) +gap> PartialPermOpNC(f, [10, 11, 12]); +[1,4](2)(3) +gap> PartialPermOpNC(f, [10, 11, 12], function(x, f) +> if x > 10 then return 100; else return x ^ f; fi; end); +[1,4][2,5][3,6] +gap> PartialPermOpNC(PartialPerm([1]), SymmetricInverseMonoid(1), OnRight); + +gap> PartialPermOpNC(PartialPerm([1]), SymmetricInverseMonoid(1)); + + +# RandomPartialPerm +gap> RandomPartialPerm(4);; +gap> RandomPartialPerm(2 ^ 60); +Error, usage: the argument must be a positive integer, a set, or 2 sets, of po\ +sitive integers, +gap> f := RandomPartialPerm([4 .. 10]);; +gap> IsSubset([4 .. 10], DomainOfPartialPerm(f)); +true +gap> IsSubset([4 .. 10], ImageSetOfPartialPerm(f)); +true +gap> f := RandomPartialPerm([6 .. 10], [1 .. 5]);; +gap> IsSubset([6 .. 10], DomainOfPartialPerm(f)); +true +gap> IsSubset([1 .. 5], ImageSetOfPartialPerm(f)); +true +gap> f := RandomPartialPerm([1, 2 ^ 60]); +Error, usage: the argument must be a positive integer, a set, or 2 sets, of po\ +sitive integers, +gap> f := RandomPartialPerm([3, 1, 2]); +Error, usage: the argument must be a positive integer, a set, or 2 sets, of po\ +sitive integers, +gap> f := RandomPartialPerm([1 .. 3], [3, 1, 2]); +Error, usage: the argument must be a positive integer, a set, or 2 sets, of po\ +sitive integers, +gap> f := RandomPartialPerm([3, 1, 2], [1 .. 3]); +Error, usage: the argument must be a positive integer, a set, or 2 sets, of po\ +sitive integers, +gap> f := RandomPartialPerm([3, 1, 2], [1, 3, 2 ^ 60]); +Error, usage: the argument must be a positive integer, a set, or 2 sets, of po\ +sitive integers, + +# PartialPermNC +gap> PartialPermNC(1, 2, 3); +Error, usage: there should be one or two arguments, +gap> PartialPerm(1, 2, 3); +Error, usage: there should be one or two arguments, +gap> PartialPerm([1, 2, 2 ^ 60]); +Error, usage: the argument must be a list of non-negative integers and the non\ +-zero elements must be duplicate-free, +gap> PartialPerm([1, 2, 2]); +Error, usage: the argument must be a list of non-negative integers and the non\ +-zero elements must be duplicate-free, + +# String etc +gap> EvalString(String(PartialPerm([1, 2, 4, 7, 9], [5, 3, 7, 4, 9]))) +> = PartialPerm([1, 2, 4, 7, 9], [5, 3, 7, 4, 9]); +true +gap> PrintString(PartialPerm([1, 2, 4, 7, 9], [5, 3, 7, 4, 9])); +"PartialPerm( \>[ 1, 2, 4, 7, 9 ], \<\>[ 5, 3, 7, 4, 9 ]\<\> )\<" +gap> PrintObj(PartialPerm([1, 2, 4, 7, 9], [5, 3, 7, 4, 9])); +> "this string allows us to test the PrintObj method"; +PartialPerm( [ 1, 2, 4, 7, 9 ], [ 5, 3, 7, 4, 9 ] + )"this string allows us to test the PrintObj method" +gap> SetUserPreference("NotationForPartialPerms", "domainimage");; +gap> PartialPerm( [ 1, 2, 4, 7, 9 ], [ 5, 3, 7, 4, 9 ]); +[ 1, 2, 4, 7, 9 ] -> [ 5, 3, 7, 4, 9 ] +gap> PartialPerm([1, 2, 3]); + +gap> SetUserPreference("NotationForPartialPerms", notationpp);; +gap> SetUserPreference("NotationForPartialPerms", "input");; +gap> PartialPerm( [ 1, 2, 4, 7, 9 ], [ 5, 3, 7, 4, 9 ]); +PartialPerm( [ 1, 2, 4, 7, 9 ], [ 5, 3, 7, 4, 9 ] ) +gap> SetUserPreference("NotationForPartialPerms", notationpp);; + +# Collections +gap> coll := [PartialPerm([1, 2, 4, 7, 9], [5, 3, 7, 4, 9]), +> PartialPerm([1, 2, 4, 5, 6, 7], [1, 8, 9, 7, 5, 3])];; +gap> DegreeOfPartialPermCollection(coll); +9 +gap> CodegreeOfPartialPermCollection(coll); +9 +gap> RankOfPartialPermCollection(coll); +7 +gap> ImageOfPartialPermCollection(coll); +[ 1, 3, 4, 5, 7, 8, 9 ] +gap> FixedPointsOfPartialPerm(coll); +[ 1, 9 ] +gap> MovedPoints(coll); +[ 1, 2, 4, 5, 6, 7 ] +gap> NrFixedPoints(coll); +2 +gap> NrMovedPoints(coll); +6 +gap> LargestMovedPoint(coll); +7 +gap> LargestImageOfMovedPoint(coll); +9 +gap> SmallestMovedPoint(coll); +1 +gap> SmallestImageOfMovedPoint(coll); +3 + # gap> SetUserPreference("PartialPermDisplayLimit", display);; gap> SetUserPreference("NotationForPartialPerm", notationpp);; From a5107538bf651708cdfb31269c733554a3f21218 Mon Sep 17 00:00:00 2001 From: James Mitchell Date: Mon, 26 Mar 2018 17:29:59 +0200 Subject: [PATCH 5/9] pperm: add assertions to kernel functions --- src/pperm.c | 228 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 228 insertions(+) diff --git a/src/pperm.c b/src/pperm.c index b019af0923..6dc69e0358 100644 --- a/src/pperm.c +++ b/src/pperm.c @@ -182,6 +182,8 @@ static inline void SET_DOM_PPERM(Obj f, Obj dom) static UInt INIT_PPERM2(Obj f) { + GAP_ASSERT(TNUM_OBJ(f) == T_PPERM2); + UInt deg, rank, i; UInt2 * ptf; Obj img, dom; @@ -230,6 +232,8 @@ static UInt INIT_PPERM2(Obj f) static UInt INIT_PPERM4(Obj f) { + GAP_ASSERT(TNUM_OBJ(f) == T_PPERM4); + UInt deg, rank, i; UInt4 * ptf; Obj img, dom; @@ -289,6 +293,7 @@ UInt RANK_PPERM4(Obj f) static Obj SORT_PLIST_INTOBJ(Obj res) { + GAP_ASSERT(IS_PLIST(res)); if (LEN_PLIST(res) == 0) return res; @@ -299,6 +304,9 @@ static Obj SORT_PLIST_INTOBJ(Obj res) static Obj PreImagePPermInt(Obj pt, Obj f) { + GAP_ASSERT(IS_INTOBJ(pt)); + GAP_ASSERT(IS_PPERM(f)); + UInt2 * ptf2; UInt4 * ptf4; UInt i, cpt, deg; @@ -342,6 +350,8 @@ Obj FuncEmptyPartialPerm(Obj self) /* method for creating a partial perm */ Obj FuncDensePartialPermNC(Obj self, Obj img) { + GAP_ASSERT(IS_LIST(img)); + UInt deg, i, j, codeg; UInt2 * ptf2; UInt4 * ptf4; @@ -392,6 +402,10 @@ Obj FuncDensePartialPermNC(Obj self, Obj img) /* assumes that dom is a set and that img is duplicatefree */ Obj FuncSparsePartialPermNC(Obj self, Obj dom, Obj img) { + GAP_ASSERT(IS_LIST(dom)); + GAP_ASSERT(IS_LIST(img)); + GAP_ASSERT(LEN_LIST(dom) == LEN_LIST(img)); + UInt rank, deg, i, j, codeg; Obj f; UInt2 * ptf2; @@ -494,6 +508,8 @@ Obj FuncRankOfPartialPerm(Obj self, Obj f) /* domain of a partial perm */ Obj FuncDOMAIN_PPERM(Obj self, Obj f) { + GAP_ASSERT(IS_PPERM(f)); + if (DOM_PPERM(f) == NULL) { if (TNUM_OBJ(f) == T_PPERM2) { INIT_PPERM2(f); @@ -508,6 +524,8 @@ Obj FuncDOMAIN_PPERM(Obj self, Obj f) /* image list of pperm */ Obj FuncIMAGE_PPERM(Obj self, Obj f) { + GAP_ASSERT(IS_PPERM(f)); + UInt2 * ptf2; UInt4 * ptf4; UInt i, rank; @@ -599,6 +617,8 @@ Obj FuncPREIMAGE_PPERM_INT(Obj self, Obj f, Obj pt) // find img(f) static UInt4 * FindImg(UInt n, UInt rank, Obj img) { + GAP_ASSERT(IS_PLIST(img)); + UInt i; UInt4 * ptseen; @@ -615,6 +635,8 @@ static UInt4 * FindImg(UInt n, UInt rank, Obj img) // the least m, r such that f^m=f^m+r Obj FuncINDEX_PERIOD_PPERM(Obj self, Obj f) { + GAP_ASSERT(IS_PPERM(f)); + UInt i, len, j, pow, rank, k, deg, n; UInt2 * ptf2; UInt4 * ptseen, *ptf4; @@ -712,6 +734,8 @@ Obj FuncINDEX_PERIOD_PPERM(Obj self, Obj f) // the least power of which is an idempotent Obj FuncSMALLEST_IDEM_POW_PPERM(Obj self, Obj f) { + GAP_ASSERT(IS_PPERM(f)); + Obj x, ind, per, pow; x = FuncINDEX_PERIOD_PPERM(self, f); @@ -727,6 +751,8 @@ Obj FuncSMALLEST_IDEM_POW_PPERM(Obj self, Obj f) * there exists in and a pos int such that . */ Obj FuncCOMPONENT_REPS_PPERM(Obj self, Obj f) { + GAP_ASSERT(IS_PPERM(f)); + UInt i, j, rank, k, deg, nr, n; UInt2 * ptf2; UInt4 * ptseen, *ptf4; @@ -809,6 +835,8 @@ Obj FuncCOMPONENT_REPS_PPERM(Obj self, Obj f) /* the number of components of a partial perm (as a functional digraph) */ Obj FuncNR_COMPONENTS_PPERM(Obj self, Obj f) { + GAP_ASSERT(IS_PPERM(f)); + UInt i, j, n, rank, k, deg, nr; UInt2 * ptf2; UInt4 * ptseen, *ptf4; @@ -881,6 +909,8 @@ Obj FuncNR_COMPONENTS_PPERM(Obj self, Obj f) /* the components of a partial perm (as a functional digraph) */ Obj FuncCOMPONENTS_PPERM(Obj self, Obj f) { + GAP_ASSERT(IS_PPERM(f)); + UInt i, j, n, rank, k, deg, nr, len; Obj dom, img, out; @@ -992,6 +1022,9 @@ Obj FuncCOMPONENTS_PPERM(Obj self, Obj f) // the points that can be obtained from by successively applying . Obj FuncCOMPONENT_PPERM_INT(Obj self, Obj f, Obj pt) { + GAP_ASSERT(IS_PPERM(f)); + GAP_ASSERT(IS_INTOBJ(pt)); + UInt i, j, deg, len; Obj out; @@ -1041,6 +1074,8 @@ Obj FuncCOMPONENT_PPERM_INT(Obj self, Obj f, Obj pt) // the fixed points of a partial perm Obj FuncFIXED_PTS_PPERM(Obj self, Obj f) { + GAP_ASSERT(IS_PPERM(f)); + UInt len, i, j, deg, rank; Obj out, dom; UInt2 * ptf2; @@ -1106,6 +1141,8 @@ Obj FuncFIXED_PTS_PPERM(Obj self, Obj f) Obj FuncNR_FIXED_PTS_PPERM(Obj self, Obj f) { + GAP_ASSERT(IS_PPERM(f)); + UInt nr, i, j, deg, rank; Obj dom; UInt2 * ptf2; @@ -1154,6 +1191,8 @@ Obj FuncNR_FIXED_PTS_PPERM(Obj self, Obj f) // the moved points of a partial perm Obj FuncMOVED_PTS_PPERM(Obj self, Obj f) { + GAP_ASSERT(IS_PPERM(f)); + UInt len, i, j, deg, rank; Obj out, dom; UInt2 * ptf2; @@ -1217,6 +1256,8 @@ Obj FuncMOVED_PTS_PPERM(Obj self, Obj f) Obj FuncNR_MOVED_PTS_PPERM(Obj self, Obj f) { + GAP_ASSERT(IS_PPERM(f)); + UInt nr, i, j, deg, rank; Obj dom; UInt2 * ptf2; @@ -1264,6 +1305,8 @@ Obj FuncNR_MOVED_PTS_PPERM(Obj self, Obj f) Obj FuncLARGEST_MOVED_PT_PPERM(Obj self, Obj f) { + GAP_ASSERT(IS_PPERM(f)); + UInt i, j, deg; Obj dom; UInt2 * ptf2; @@ -1310,6 +1353,8 @@ Obj FuncLARGEST_MOVED_PT_PPERM(Obj self, Obj f) Obj FuncSMALLEST_MOVED_PT_PPERM(Obj self, Obj f) { + GAP_ASSERT(IS_PPERM(f)); + UInt i, j, deg, rank; Obj dom; UInt2 * ptf2; @@ -1359,6 +1404,8 @@ Obj FuncSMALLEST_MOVED_PT_PPERM(Obj self, Obj f) // convert a T_PPERM4 with codeg<65536 to a T_PPERM2 Obj FuncTRIM_PPERM(Obj self, Obj f) { + GAP_ASSERT(IS_PPERM(f)); + UInt deg, i; UInt4 * ptf; @@ -1403,6 +1450,8 @@ Obj FuncHASH_FUNC_FOR_PPERM(Obj self, Obj f, Obj data) { // test if a partial perm is an idempotent Obj FuncIS_IDEM_PPERM(Obj self, Obj f) { + GAP_ASSERT(IS_PPERM(f)); + UInt2 * ptf2; UInt4 * ptf4; UInt deg, i, j, rank; @@ -1452,6 +1501,8 @@ Obj FuncIS_IDEM_PPERM(Obj self, Obj f) /* an idempotent partial perm with ker(e)=ker(f) */ Obj FuncLEFT_ONE_PPERM(Obj self, Obj f) { + GAP_ASSERT(IS_PPERM(f)); + Obj dom, g; UInt deg, i, j, rank; UInt2 * ptg2; @@ -1497,6 +1548,8 @@ Obj FuncLEFT_ONE_PPERM(Obj self, Obj f) // an idempotent partial perm with im(e)=im(f) Obj FuncRIGHT_ONE_PPERM(Obj self, Obj f) { + GAP_ASSERT(IS_PPERM(f)); + Obj g, img; UInt i, j, codeg, rank; UInt2 * ptg2; @@ -1546,6 +1599,9 @@ Obj FuncRIGHT_ONE_PPERM(Obj self, Obj f) // f<=g if and only if f is a restriction of g Obj FuncNaturalLeqPartialPerm(Obj self, Obj f, Obj g) { + GAP_ASSERT(IS_PPERM(f)); + GAP_ASSERT(IS_PPERM(g)); + UInt def, deg, i, j, rank; UInt2 *ptf2, *ptg2; UInt4 *ptf4, *ptg4; @@ -1656,6 +1712,9 @@ Obj FuncNaturalLeqPartialPerm(Obj self, Obj f, Obj g) // could add use of rank to improve things here. JDM Obj FuncJOIN_IDEM_PPERMS(Obj self, Obj f, Obj g) { + GAP_ASSERT(IS_PPERM(f)); + GAP_ASSERT(IS_PPERM(g)); + UInt def, deg, dej, i; Obj join; UInt2 *ptjoin2, *ptf2, *ptg2; @@ -1765,6 +1824,9 @@ Obj FuncJOIN_IDEM_PPERMS(Obj self, Obj f, Obj g) // the union of f and g where this defines an injective function Obj FuncJOIN_PPERMS(Obj self, Obj f, Obj g) { + GAP_ASSERT(IS_PPERM(f)); + GAP_ASSERT(IS_PPERM(g)); + UInt deg, i, j, degf, degg, codeg, rank; UInt2 *ptf2, *ptg2, *ptjoin2; UInt4 *ptf4, *ptg4, *ptjoin4, *ptseen; @@ -2028,6 +2090,9 @@ Obj FuncJOIN_PPERMS(Obj self, Obj f, Obj g) Obj FuncMEET_PPERMS(Obj self, Obj f, Obj g) { + GAP_ASSERT(IS_PPERM(f)); + GAP_ASSERT(IS_PPERM(g)); + UInt deg, i, j, degf, degg, codeg; UInt2 *ptf2, *ptg2, *ptmeet2; UInt4 *ptf4, *ptg4, *ptmeet4; @@ -2152,6 +2217,9 @@ Obj FuncMEET_PPERMS(Obj self, Obj f, Obj g) // restricted partial perm where set is assumed to be a set of positive ints Obj FuncRESTRICTED_PPERM(Obj self, Obj f, Obj set) { + GAP_ASSERT(IS_PPERM(f)); + GAP_ASSERT(IS_LIST(set)); + UInt i, j, n, codeg, deg; UInt2 *ptf2, *ptg2; UInt4 *ptf4, *ptg4; @@ -2217,6 +2285,9 @@ Obj FuncRESTRICTED_PPERM(Obj self, Obj f, Obj set) // a set of positive integers Obj FuncAS_PPERM_PERM(Obj self, Obj p, Obj set) { + GAP_ASSERT(IS_PERM2(p) || IS_PERM4(p)); + GAP_ASSERT(IS_LIST(set)); + UInt i, j, n, deg, codeg, dep; UInt2 *ptf2, *ptp2; UInt4 *ptf4, *ptp4; @@ -2323,6 +2394,8 @@ Obj FuncAS_PPERM_PERM(Obj self, Obj p, Obj set) // for a partial perm with equal dom and img Obj FuncAS_PERM_PPERM(Obj self, Obj f) { + GAP_ASSERT(IS_PPERM(f)); + UInt2 *ptf2, *ptp2; UInt4 *ptf4, *ptp4; UInt deg, i, j, rank; @@ -2369,6 +2442,9 @@ Obj FuncAS_PERM_PPERM(Obj self, Obj f) // and dom(f)=dom(g), no checking Obj FuncPERM_LEFT_QUO_PPERM_NC(Obj self, Obj f, Obj g) { + GAP_ASSERT(IS_PPERM(f)); + GAP_ASSERT(IS_PPERM(g)); + UInt deg, i, j, rank; Obj perm, dom; UInt2 *ptf2, *ptp2, *ptg2; @@ -2552,6 +2628,8 @@ Obj FuncHAS_IMG_PPERM(Obj self, Obj f) // an idempotent partial perm on the union of the domain and image Obj OnePPerm(Obj f) { + GAP_ASSERT(IS_PPERM(f)); + Obj g, img, dom; UInt i, j, deg, rank; UInt2 * ptg2; @@ -2598,6 +2676,9 @@ Obj OnePPerm(Obj f) /* equality for partial perms */ Int EqPPerm22(Obj f, Obj g) { + GAP_ASSERT(TNUM_OBJ(f) == T_PPERM2); + GAP_ASSERT(TNUM_OBJ(g) == T_PPERM2); + UInt2 * ptf = ADDR_PPERM2(f); UInt2 * ptg = ADDR_PPERM2(g); UInt deg = DEG_PPERM2(f); @@ -2630,6 +2711,9 @@ Int EqPPerm22(Obj f, Obj g) Int EqPPerm24(Obj f, Obj g) { + GAP_ASSERT(TNUM_OBJ(f) == T_PPERM2); + GAP_ASSERT(TNUM_OBJ(g) == T_PPERM4); + UInt2 * ptf = ADDR_PPERM2(f); UInt4 * ptg = ADDR_PPERM4(g); UInt deg = DEG_PPERM2(f); @@ -2666,6 +2750,9 @@ Int EqPPerm42(Obj f, Obj g) Int EqPPerm44(Obj f, Obj g) { + GAP_ASSERT(TNUM_OBJ(f) == T_PPERM4); + GAP_ASSERT(TNUM_OBJ(g) == T_PPERM4); + UInt4 * ptf = ADDR_PPERM4(f); UInt4 * ptg = ADDR_PPERM4(g); UInt i, j, rank; @@ -2699,6 +2786,9 @@ Int EqPPerm44(Obj f, Obj g) // beware this is different than it used to be... Int LtPPerm22(Obj f, Obj g) { + GAP_ASSERT(TNUM_OBJ(f) == T_PPERM2); + GAP_ASSERT(TNUM_OBJ(g) == T_PPERM2); + UInt2 * ptf = ADDR_PPERM2(f); UInt2 * ptg = ADDR_PPERM2(g); UInt deg, i; @@ -2726,6 +2816,9 @@ Int LtPPerm22(Obj f, Obj g) Int LtPPerm24(Obj f, Obj g) { + GAP_ASSERT(TNUM_OBJ(f) == T_PPERM2); + GAP_ASSERT(TNUM_OBJ(g) == T_PPERM4); + UInt2 * ptf = ADDR_PPERM2(f); UInt4 * ptg = ADDR_PPERM4(g); UInt deg, i; @@ -2753,6 +2846,9 @@ Int LtPPerm24(Obj f, Obj g) Int LtPPerm42(Obj f, Obj g) { + GAP_ASSERT(TNUM_OBJ(f) == T_PPERM4); + GAP_ASSERT(TNUM_OBJ(g) == T_PPERM2); + UInt4 * ptf = ADDR_PPERM4(f); UInt2 * ptg = ADDR_PPERM2(g); UInt deg, i; @@ -2780,6 +2876,9 @@ Int LtPPerm42(Obj f, Obj g) Int LtPPerm44(Obj f, Obj g) { + GAP_ASSERT(TNUM_OBJ(f) == T_PPERM4); + GAP_ASSERT(TNUM_OBJ(g) == T_PPERM4); + UInt4 * ptf = ADDR_PPERM4(f); UInt4 * ptg = ADDR_PPERM4(g); UInt deg, i; @@ -2808,6 +2907,9 @@ Int LtPPerm44(Obj f, Obj g) /* product of partial perm and partial perm */ Obj ProdPPerm22(Obj f, Obj g) { + GAP_ASSERT(TNUM_OBJ(f) == T_PPERM2); + GAP_ASSERT(TNUM_OBJ(g) == T_PPERM2); + UInt deg, degg, i, j, rank; UInt2 *ptf, *ptg, *ptfg, codeg; Obj fg, dom; @@ -2865,6 +2967,9 @@ Obj ProdPPerm22(Obj f, Obj g) // the product is always pperm2 Obj ProdPPerm42(Obj f, Obj g) { + GAP_ASSERT(TNUM_OBJ(f) == T_PPERM4); + GAP_ASSERT(TNUM_OBJ(g) == T_PPERM2); + UInt deg, degg, i, j, rank; UInt4 * ptf; UInt2 * ptg, *ptfg, codeg; @@ -2921,6 +3026,9 @@ Obj ProdPPerm42(Obj f, Obj g) // it is possible that f*g could be represented as a PPERM2 Obj ProdPPerm44(Obj f, Obj g) { + GAP_ASSERT(TNUM_OBJ(f) == T_PPERM4); + GAP_ASSERT(TNUM_OBJ(g) == T_PPERM4); + UInt deg, degg, codeg, i, j, rank; UInt4 *ptf, *ptg, *ptfg; Obj fg, dom; @@ -2982,6 +3090,9 @@ Obj ProdPPerm44(Obj f, Obj g) // it is possible that f*g could be represented as a PPERM2 Obj ProdPPerm24(Obj f, Obj g) { + GAP_ASSERT(TNUM_OBJ(f) == T_PPERM2); + GAP_ASSERT(TNUM_OBJ(g) == T_PPERM4); + UInt deg, degg, i, j, codeg, rank; UInt2 * ptf; UInt4 * ptg, *ptfg; @@ -3046,6 +3157,9 @@ Obj ProdPPerm24(Obj f, Obj g) // compose partial perms and perms Obj ProdPPerm2Perm2(Obj f, Obj p) { + GAP_ASSERT(TNUM_OBJ(f) == T_PPERM2); + GAP_ASSERT(TNUM_OBJ(p) == T_PERM2); + UInt2 * ptf, *ptp, *ptfp2; UInt4 * ptfp4; Obj fp, dom; @@ -3143,6 +3257,9 @@ Obj ProdPPerm2Perm2(Obj f, Obj p) Obj ProdPPerm4Perm4(Obj f, Obj p) { + GAP_ASSERT(TNUM_OBJ(f) == T_PPERM4); + GAP_ASSERT(TNUM_OBJ(p) == T_PERM4); + UInt4 *ptf, *ptp, *ptfp; Obj fp, dom; UInt codeg, dep, deg, i, j, rank; @@ -3206,6 +3323,9 @@ Obj ProdPPerm4Perm4(Obj f, Obj p) Obj ProdPPerm2Perm4(Obj f, Obj p) { + GAP_ASSERT(TNUM_OBJ(f) == T_PPERM2); + GAP_ASSERT(TNUM_OBJ(p) == T_PERM4); + UInt2 * ptf; UInt4 * ptp, *ptfp; Obj fp, dom; @@ -3243,6 +3363,9 @@ Obj ProdPPerm2Perm4(Obj f, Obj p) Obj ProdPPerm4Perm2(Obj f, Obj p) { + GAP_ASSERT(TNUM_OBJ(f) == T_PPERM4); + GAP_ASSERT(TNUM_OBJ(p) == T_PERM2); + UInt4 *ptf, *ptfp; UInt2 *ptp, dep; Obj fp, dom; @@ -3282,6 +3405,9 @@ Obj ProdPPerm4Perm2(Obj f, Obj p) // product of a perm and a partial perm Obj ProdPerm2PPerm2(Obj p, Obj f) { + GAP_ASSERT(TNUM_OBJ(p) == T_PERM2); + GAP_ASSERT(TNUM_OBJ(f) == T_PPERM2); + UInt2 deg, *ptp, *ptf, *ptpf; UInt degf, i; Obj pf; @@ -3324,6 +3450,9 @@ Obj ProdPerm2PPerm2(Obj p, Obj f) Obj ProdPerm4PPerm4(Obj p, Obj f) { + GAP_ASSERT(TNUM_OBJ(p) == T_PERM4); + GAP_ASSERT(TNUM_OBJ(f) == T_PPERM4); + UInt4 deg, *ptp, *ptf, *ptpf; UInt degf, i; Obj pf; @@ -3366,6 +3495,9 @@ Obj ProdPerm4PPerm4(Obj p, Obj f) Obj ProdPerm4PPerm2(Obj p, Obj f) { + GAP_ASSERT(TNUM_OBJ(p) == T_PERM4); + GAP_ASSERT(TNUM_OBJ(f) == T_PPERM2); + UInt4 deg, *ptp; UInt2 *ptf, *ptpf; UInt degf, i; @@ -3409,6 +3541,9 @@ Obj ProdPerm4PPerm2(Obj p, Obj f) Obj ProdPerm2PPerm4(Obj p, Obj f) { + GAP_ASSERT(TNUM_OBJ(p) == T_PERM2); + GAP_ASSERT(TNUM_OBJ(f) == T_PPERM4); + UInt2 * ptp; UInt4 * ptf, *ptpf; UInt deg, degf, i; @@ -3453,6 +3588,8 @@ Obj ProdPerm2PPerm4(Obj p, Obj f) // the inverse of a partial perm Obj InvPPerm2(Obj f) { + GAP_ASSERT(TNUM_OBJ(f) == T_PPERM2); + UInt deg, codeg, i, j, rank; UInt2 * ptf, *ptinv2; UInt4 * ptinv4; @@ -3504,6 +3641,8 @@ Obj InvPPerm2(Obj f) Obj InvPPerm4(Obj f) { + GAP_ASSERT(TNUM_OBJ(f) == T_PPERM4); + UInt deg, codeg, i, j, rank; UInt2 * ptinv2; UInt4 * ptf, *ptinv4; @@ -3558,6 +3697,9 @@ Obj InvPPerm4(Obj f) // JDM Obj PowPPerm2Perm2(Obj f, Obj p) { + GAP_ASSERT(TNUM_OBJ(f) == T_PPERM2); + GAP_ASSERT(TNUM_OBJ(p) == T_PERM2); + UInt deg, rank, degconj, i, j, k, codeg; UInt2 *ptf, *ptp, *ptconj, dep; Obj conj, dom; @@ -3614,6 +3756,9 @@ Obj PowPPerm2Perm2(Obj f, Obj p) Obj PowPPerm2Perm4(Obj f, Obj p) { + GAP_ASSERT(TNUM_OBJ(f) == T_PPERM2); + GAP_ASSERT(TNUM_OBJ(p) == T_PERM4); + UInt deg, rank, degconj, i, j, k, codeg; UInt2 * ptf; UInt4 * ptp, *ptconj, dep; @@ -3660,6 +3805,9 @@ Obj PowPPerm2Perm4(Obj f, Obj p) Obj PowPPerm4Perm2(Obj f, Obj p) { + GAP_ASSERT(TNUM_OBJ(f) == T_PPERM4); + GAP_ASSERT(TNUM_OBJ(p) == T_PERM2); + UInt deg, rank, degconj, i, j, k, codeg; UInt4 * ptf, *ptconj, dep; UInt2 * ptp; @@ -3716,6 +3864,9 @@ Obj PowPPerm4Perm2(Obj f, Obj p) Obj PowPPerm4Perm4(Obj f, Obj p) { + GAP_ASSERT(TNUM_OBJ(f) == T_PPERM4); + GAP_ASSERT(TNUM_OBJ(p) == T_PERM4); + UInt deg, rank, degconj, i, j, k, codeg; UInt4 *ptf, *ptp, *ptconj, dep; Obj conj, dom; @@ -3775,6 +3926,9 @@ Obj PowPPerm4Perm4(Obj f, Obj p) // JDM not sure this is worth it... Obj PowPPerm22(Obj f, Obj g) { + GAP_ASSERT(TNUM_OBJ(f) == T_PPERM2); + GAP_ASSERT(TNUM_OBJ(g) == T_PPERM2); + UInt2 *ptg, *ptf, *ptconj, img; UInt i, j, def, deg, dec, codeg, codec, min, len; Obj dom, conj; @@ -3993,6 +4147,9 @@ Obj PowPPerm22(Obj f, Obj g) Obj PowPPerm24(Obj f, Obj g) { + GAP_ASSERT(TNUM_OBJ(f) == T_PPERM2); + GAP_ASSERT(TNUM_OBJ(g) == T_PPERM4); + UInt4 * ptg, *ptconj; UInt2 * ptf; UInt i, j, def, deg, dec, codeg, codec, min, img, len; @@ -4212,6 +4369,9 @@ Obj PowPPerm24(Obj f, Obj g) Obj PowPPerm42(Obj f, Obj g) { + GAP_ASSERT(TNUM_OBJ(f) == T_PPERM4); + GAP_ASSERT(TNUM_OBJ(g) == T_PPERM2); + UInt4 * ptf, *ptconj; UInt2 * ptg; UInt i, j, def, deg, dec, codeg, codec, min, img, len; @@ -4431,6 +4591,9 @@ Obj PowPPerm42(Obj f, Obj g) Obj PowPPerm44(Obj f, Obj g) { + GAP_ASSERT(TNUM_OBJ(f) == T_PPERM4); + GAP_ASSERT(TNUM_OBJ(g) == T_PPERM4); + UInt4 *ptg, *ptf, *ptconj, img; UInt i, j, def, deg, dec, codeg, codec, min, len; Obj dom, conj; @@ -4650,6 +4813,9 @@ Obj PowPPerm44(Obj f, Obj g) // f*p^-1 Obj QuoPPerm2Perm2(Obj f, Obj p) { + GAP_ASSERT(TNUM_OBJ(f) == T_PPERM2); + GAP_ASSERT(TNUM_OBJ(p) == T_PERM2); + UInt2 *ptf, *ptp, *ptquo2; UInt4 *ptquo4, *pttmp; Obj quo, dom; @@ -4763,6 +4929,9 @@ Obj QuoPPerm2Perm2(Obj f, Obj p) Obj QuoPPerm4Perm4(Obj f, Obj p) { + GAP_ASSERT(TNUM_OBJ(f) == T_PPERM4); + GAP_ASSERT(TNUM_OBJ(p) == T_PERM4); + UInt4 *ptf, *ptp, *ptquo, *pttmp; Obj quo, dom; UInt codeg, lmp, deg, i, j, rank; @@ -4845,6 +5014,9 @@ Obj QuoPPerm4Perm4(Obj f, Obj p) Obj QuoPPerm2Perm4(Obj f, Obj p) { + GAP_ASSERT(TNUM_OBJ(f) == T_PPERM2); + GAP_ASSERT(TNUM_OBJ(p) == T_PERM4); + UInt4 * ptp, *ptquo, *pttmp; UInt2 * ptf; Obj quo, dom; @@ -4904,6 +5076,9 @@ Obj QuoPPerm2Perm4(Obj f, Obj p) Obj QuoPPerm4Perm2(Obj f, Obj p) { + GAP_ASSERT(TNUM_OBJ(f) == T_PPERM4); + GAP_ASSERT(TNUM_OBJ(p) == T_PERM2); + UInt4 * ptf, *ptquo, *pttmp; UInt2 * ptp; Obj quo, dom; @@ -4961,6 +5136,9 @@ Obj QuoPPerm4Perm2(Obj f, Obj p) // f*g^-1 for partial perms Obj QuoPPerm22(Obj f, Obj g) { + GAP_ASSERT(TNUM_OBJ(f) == T_PPERM2); + GAP_ASSERT(TNUM_OBJ(g) == T_PPERM2); + UInt deg, i, j, deginv, codeg, rank; UInt2 *ptf, *ptg; UInt4 *ptquo, *pttmp; @@ -5039,6 +5217,9 @@ Obj QuoPPerm22(Obj f, Obj g) Obj QuoPPerm24(Obj f, Obj g) { + GAP_ASSERT(TNUM_OBJ(f) == T_PPERM2); + GAP_ASSERT(TNUM_OBJ(g) == T_PPERM4); + UInt deg, i, j, deginv, codeg, rank; UInt2 * ptf; UInt4 * ptg, *ptquo, *pttmp; @@ -5124,6 +5305,9 @@ Obj QuoPPerm24(Obj f, Obj g) Obj QuoPPerm42(Obj f, Obj g) { + GAP_ASSERT(TNUM_OBJ(f) == T_PPERM4); + GAP_ASSERT(TNUM_OBJ(g) == T_PPERM2); + UInt deg, i, j, deginv, codeg, rank; UInt2 * ptg; UInt4 * ptf, *ptquo, *pttmp; @@ -5209,6 +5393,9 @@ Obj QuoPPerm42(Obj f, Obj g) Obj QuoPPerm44(Obj f, Obj g) { + GAP_ASSERT(TNUM_OBJ(f) == T_PPERM4); + GAP_ASSERT(TNUM_OBJ(g) == T_PPERM4); + UInt deg, i, j, deginv, codeg, rank; UInt4 *ptf, *ptg, *ptquo, *pttmp; Obj quo, dom; @@ -5287,6 +5474,7 @@ Obj QuoPPerm44(Obj f, Obj g) // i^f Obj PowIntPPerm2(Obj i, Obj f) { + GAP_ASSERT(TNUM_OBJ(f) == T_PPERM2); if (!IS_INTOBJ(i) || INT_INTOBJ(i) <= 0) { ErrorQuit("usage: the first argument should be a positive integer,", @@ -5299,6 +5487,7 @@ Obj PowIntPPerm2(Obj i, Obj f) Obj PowIntPPerm4(Obj i, Obj f) { + GAP_ASSERT(TNUM_OBJ(f) == T_PPERM4); if (!IS_INTOBJ(i) || INT_INTOBJ(i) <= 0) { ErrorQuit("usage: the first argument should be a positive integer,", @@ -5312,6 +5501,9 @@ Obj PowIntPPerm4(Obj i, Obj f) // p^-1*f Obj LQuoPerm2PPerm2(Obj p, Obj f) { + GAP_ASSERT(TNUM_OBJ(p) == T_PERM2); + GAP_ASSERT(TNUM_OBJ(f) == T_PPERM2); + UInt2 *ptp, *ptf, *ptlquo, dep; UInt def, i, j, del, len; Obj dom, lquo; @@ -5393,6 +5585,9 @@ Obj LQuoPerm2PPerm2(Obj p, Obj f) Obj LQuoPerm2PPerm4(Obj p, Obj f) { + GAP_ASSERT(TNUM_OBJ(p) == T_PERM2); + GAP_ASSERT(TNUM_OBJ(f) == T_PPERM4); + UInt2 *ptp, dep; UInt4 *ptf, *ptlquo; UInt def, i, j, del, len; @@ -5474,6 +5669,9 @@ Obj LQuoPerm2PPerm4(Obj p, Obj f) Obj LQuoPerm4PPerm2(Obj p, Obj f) { + GAP_ASSERT(TNUM_OBJ(p) == T_PERM4); + GAP_ASSERT(TNUM_OBJ(f) == T_PPERM2); + UInt4 *ptp, dep; UInt2 *ptf, *ptlquo; UInt def, i, j, del, len; @@ -5556,6 +5754,9 @@ Obj LQuoPerm4PPerm2(Obj p, Obj f) Obj LQuoPerm4PPerm4(Obj p, Obj f) { + GAP_ASSERT(TNUM_OBJ(p) == T_PERM4); + GAP_ASSERT(TNUM_OBJ(f) == T_PPERM4); + UInt4 *ptp, *ptf, *ptlquo, dep; UInt def, i, j, del, len; Obj dom, lquo; @@ -5638,6 +5839,9 @@ Obj LQuoPerm4PPerm4(Obj p, Obj f) // f^-1*g Obj LQuoPPerm22(Obj f, Obj g) { + GAP_ASSERT(TNUM_OBJ(f) == T_PPERM2); + GAP_ASSERT(TNUM_OBJ(g) == T_PPERM2); + UInt2 *ptg, *ptf, *ptlquo; UInt i, j, def, deg, del, codef, codel, min, len; Obj dom, lquo; @@ -5744,6 +5948,9 @@ Obj LQuoPPerm22(Obj f, Obj g) Obj LQuoPPerm24(Obj f, Obj g) { + GAP_ASSERT(TNUM_OBJ(f) == T_PPERM2); + GAP_ASSERT(TNUM_OBJ(g) == T_PPERM4); + UInt4 * ptg, *ptlquo; UInt2 * ptf; UInt i, j, def, deg, del, codef, codel, min, len; @@ -5851,6 +6058,9 @@ Obj LQuoPPerm24(Obj f, Obj g) Obj LQuoPPerm42(Obj f, Obj g) { + GAP_ASSERT(TNUM_OBJ(f) == T_PPERM4); + GAP_ASSERT(TNUM_OBJ(g) == T_PPERM2); + UInt2 * ptg, *ptlquo; UInt4 * ptf; UInt i, j, def, deg, del, codef, codel, min, len; @@ -5958,6 +6168,9 @@ Obj LQuoPPerm42(Obj f, Obj g) Obj LQuoPPerm44(Obj f, Obj g) { + GAP_ASSERT(TNUM_OBJ(f) == T_PPERM4); + GAP_ASSERT(TNUM_OBJ(g) == T_PPERM4); + UInt4 *ptg, *ptf, *ptlquo; UInt i, j, def, deg, del, codef, codel, min, len; Obj dom, lquo; @@ -6083,6 +6296,7 @@ Obj OnSetsPPerm(Obj set, Obj f) GAP_ASSERT(IS_PLIST(set)); GAP_ASSERT(LEN_PLIST(set) > 0); + GAP_ASSERT(IS_PPERM(f)); const UInt len = LEN_PLIST(set); @@ -6178,6 +6392,7 @@ Obj OnTuplesPPerm(Obj tup, Obj f) GAP_ASSERT(IS_PLIST(tup)); GAP_ASSERT(LEN_PLIST(tup) > 0); + GAP_ASSERT(IS_PPERM(f)); const UInt len = LEN_PLIST(tup); @@ -6232,6 +6447,9 @@ Obj OnTuplesPPerm(Obj tup, Obj f) Obj FuncOnPosIntSetsPartialPerm(Obj self, Obj set, Obj f) { + GAP_ASSERT(IS_LIST(set)); + GAP_ASSERT(IS_PPERM(f)); + UInt2 * ptf2; UInt4 * ptf4; UInt deg; @@ -6304,6 +6522,8 @@ Obj FuncOnPosIntSetsPartialPerm(Obj self, Obj set, Obj f) /* Save and load */ void SavePPerm2(Obj f) { + GAP_ASSERT(TNUM_OBJ(f) == T_PPERM2); + UInt2 * ptr; UInt len, i; len = DEG_PPERM2(f); @@ -6314,6 +6534,8 @@ void SavePPerm2(Obj f) void LoadPPerm2(Obj f) { + GAP_ASSERT(TNUM_OBJ(f) == T_PPERM2); + UInt2 * ptr; UInt len, i; len = DEG_PPERM2(f); @@ -6324,6 +6546,8 @@ void LoadPPerm2(Obj f) void SavePPerm4(Obj f) { + GAP_ASSERT(TNUM_OBJ(f) == T_PPERM4); + UInt4 * ptr; UInt len, i; len = DEG_PPERM4(f); @@ -6334,6 +6558,8 @@ void SavePPerm4(Obj f) void LoadPPerm4(Obj f) { + GAP_ASSERT(TNUM_OBJ(f) == T_PPERM4); + UInt4 * ptr; UInt len, i; len = DEG_PPERM4(f); @@ -6346,6 +6572,7 @@ Obj TYPE_PPERM2; Obj TypePPerm2(Obj f) { + GAP_ASSERT(TNUM_OBJ(f) == T_PPERM2); return TYPE_PPERM2; } @@ -6353,6 +6580,7 @@ Obj TYPE_PPERM4; Obj TypePPerm4(Obj f) { + GAP_ASSERT(TNUM_OBJ(f) == T_PPERM4); return TYPE_PPERM4; } From fb13e862346d47646e732941f30e8112c5d18794 Mon Sep 17 00:00:00 2001 From: James Mitchell Date: Tue, 27 Mar 2018 16:10:13 +0200 Subject: [PATCH 6/9] pperm: add tests and resolve issues in C code Also: add some further comments, and reformat. --- src/pperm.c | 291 ++--- tst/testinstall/pperm.tst | 2299 +++++++++++++++++++++++++++---------- 2 files changed, 1823 insertions(+), 767 deletions(-) diff --git a/src/pperm.c b/src/pperm.c index 6dc69e0358..57f9740d71 100644 --- a/src/pperm.c +++ b/src/pperm.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include @@ -92,6 +93,7 @@ UInt CODEG_PPERM2(Obj f) if (GET_CODEG_PPERM2(f) != 0) { return GET_CODEG_PPERM2(f); } + // The following is only ever entered by the EmptyPartialPerm. UInt codeg = 0; UInt i; UInt2* ptf = ADDR_PPERM2(f); @@ -122,6 +124,7 @@ UInt CODEG_PPERM4(Obj f) if (GET_CODEG_PPERM4(f) != 0) { return GET_CODEG_PPERM4(f); } + // The following is only ever entered by the EmptyPartialPerm. UInt codeg = 0; UInt i; UInt4* ptf = ADDR_PPERM4(f); @@ -164,7 +167,7 @@ static inline void SET_IMG_PPERM(Obj f, Obj img) GAP_ASSERT(IS_PLIST(img) && !IS_MUTABLE_PLIST(img)); GAP_ASSERT(DOM_PPERM(f) == NULL || LEN_PLIST(img) == LEN_PLIST(DOM_PPERM(f))); - // TODO Could check entries of img are valid + // TODO check entries of img are valid ADDR_OBJ(f)[0] = img; } @@ -174,7 +177,7 @@ static inline void SET_DOM_PPERM(Obj f, Obj dom) GAP_ASSERT(IS_PLIST(dom) && !IS_MUTABLE_PLIST(dom)); GAP_ASSERT(IMG_PPERM(f) == NULL || LEN_PLIST(dom) == LEN_PLIST(IMG_PPERM(f))); - // TODO Could check entries of img are valid + // TODO check entries of img are valid ADDR_OBJ(f)[1] = dom; } @@ -213,11 +216,7 @@ static UInt INIT_PPERM2(Obj f) SET_ELM_PLIST(img, rank, INTOBJ_INT(ptf[i])); } } - - if (rank == 0) { - RetypeBag(img, T_PLIST_EMPTY + IMMUTABLE); - RetypeBag(dom, T_PLIST_EMPTY + IMMUTABLE); - } + GAP_ASSERT(rank != 0); // rank = 0 => deg = 0, so this is not allowed SHRINK_PLIST(img, (Int)rank); SET_LEN_PLIST(img, (Int)rank); @@ -262,11 +261,7 @@ static UInt INIT_PPERM4(Obj f) SET_ELM_PLIST(img, rank, INTOBJ_INT(ptf[i])); } } - - if (rank == 0) { - RetypeBag(img, T_PLIST_EMPTY + IMMUTABLE); - RetypeBag(dom, T_PLIST_EMPTY + IMMUTABLE); - } + GAP_ASSERT(rank != 0); // rank = 0 => deg = 0, so this is not allowed SHRINK_PLIST(img, (Int)rank); SET_LEN_PLIST(img, (Int)rank); @@ -341,7 +336,6 @@ static Obj PreImagePPermInt(Obj pt, Obj f) * GAP functions for partial perms *****************************************************************************/ - Obj FuncEmptyPartialPerm(Obj self) { return EmptyPartialPerm; @@ -604,8 +598,8 @@ Obj FuncIMAGE_SET_PPERM(Obj self, Obj f) } else { ErrorQuit("usage: the argument must be a partial perm,", 0L, 0L); + return 0L; } - return Fail; } /* preimage under a partial perm */ @@ -861,7 +855,7 @@ Obj FuncNR_COMPONENTS_PPERM(Obj self, Obj f) nr++; for (k = j; (k <= deg && ptf2[k - 1] != 0); k = ptf2[k - 1]) ptseen[k - 1] = 2; - ptseen[k - 1] = 2; // JDM really required? + ptseen[k - 1] = 2; } } @@ -888,7 +882,7 @@ Obj FuncNR_COMPONENTS_PPERM(Obj self, Obj f) nr++; for (k = j; (k <= deg && ptf4[k - 1] != 0); k = ptf4[k - 1]) ptseen[k - 1] = 2; - ptseen[k - 1] = 2; // REALLY REQUIRED?? JDM + ptseen[k - 1] = 2; } } @@ -897,7 +891,7 @@ Obj FuncNR_COMPONENTS_PPERM(Obj self, Obj f) j = INT_INTOBJ(ELM_PLIST(dom, i)) - 1; if (ptseen[j] == 1) { nr++; - ptseen[j] = 0; // REALLY REQUIRED??? JDM + ptseen[j] = 0; for (k = ptf4[j]; k != j + 1; k = ptf4[k - 1]) ptseen[k - 1] = 0; } @@ -1599,14 +1593,14 @@ Obj FuncRIGHT_ONE_PPERM(Obj self, Obj f) // f<=g if and only if f is a restriction of g Obj FuncNaturalLeqPartialPerm(Obj self, Obj f, Obj g) { - GAP_ASSERT(IS_PPERM(f)); - GAP_ASSERT(IS_PPERM(g)); - UInt def, deg, i, j, rank; UInt2 *ptf2, *ptg2; UInt4 *ptf4, *ptg4; Obj dom; + if (!IS_PPERM(f) || !IS_PPERM(g)) + ErrorQuit("usage: the arguments must be partial perms,", 0L, 0L); + if (TNUM_OBJ(f) == T_PPERM2) { def = DEG_PPERM2(f); ptf2 = ADDR_PPERM2(f); @@ -1632,7 +1626,7 @@ Obj FuncNaturalLeqPartialPerm(Obj self, Obj f, Obj g) } } } - else if (TNUM_OBJ(g) == T_PPERM4) { + else { deg = DEG_PPERM4(g); ptg4 = ADDR_PPERM4(g); if (DOM_PPERM(f) == NULL) { @@ -1651,9 +1645,6 @@ Obj FuncNaturalLeqPartialPerm(Obj self, Obj f, Obj g) } } } - else { - ErrorQuit("usage: the arguments must be partial perms,", 0L, 0L); - } } else if (TNUM_OBJ(f) == T_PPERM4) { def = DEG_PPERM4(f); @@ -1680,7 +1671,7 @@ Obj FuncNaturalLeqPartialPerm(Obj self, Obj f, Obj g) } } } - else if (TNUM_OBJ(g) == T_PPERM4) { + else { deg = DEG_PPERM4(g); ptg4 = ADDR_PPERM4(g); if (DOM_PPERM(f) == NULL) { @@ -1699,125 +1690,72 @@ Obj FuncNaturalLeqPartialPerm(Obj self, Obj f, Obj g) } } } - else { - ErrorQuit("usage: the arguments must be partial perms,", 0L, 0L); - } - } - else { - ErrorQuit("usage: the arguments must be partial perms,", 0L, 0L); } return True; } -// could add use of rank to improve things here. JDM Obj FuncJOIN_IDEM_PPERMS(Obj self, Obj f, Obj g) { GAP_ASSERT(IS_PPERM(f)); GAP_ASSERT(IS_PPERM(g)); - UInt def, deg, dej, i; - Obj join; + UInt def, deg, i; + Obj join = NULL; UInt2 *ptjoin2, *ptf2, *ptg2; UInt4 *ptjoin4, *ptf4, *ptg4; - if (EQ(f, g)) + if (EQ(f, g)) { return f; + } def = DEG_PPERM(f); deg = DEG_PPERM(g); - dej = MAX(def, deg); - if (dej < 65536) { - join = NEW_PPERM2(dej); - SET_CODEG_PPERM2(join, dej); + + if (def > deg) { + SWAP(Obj, f, g); + SWAP(UInt, def, deg); + } + + if (TNUM_OBJ(f) == T_PPERM2 && TNUM_OBJ(g) == T_PPERM2) { + join = NEW_PPERM2(deg); + SET_CODEG_PPERM2(join, deg); ptjoin2 = ADDR_PPERM2(join); ptf2 = ADDR_PPERM2(f); ptg2 = ADDR_PPERM2(g); - if (def < deg) { - for (i = 0; i < def; i++) { - if (ptf2[i] != 0) { - ptjoin2[i] = ptf2[i]; - } - else if (ptg2[i] != 0) { - ptjoin2[i] = ptg2[i]; - } - } - for (; i < deg; i++) { - if (ptg2[i] != 0) - ptjoin2[i] = ptg2[i]; - } + for (i = 0; i < def; i++) { + ptjoin2[i] = (ptf2[i] != 0 ? ptf2[i] : ptg2[i]); } - else { - for (i = 0; i < deg; i++) { - if (ptg2[i] != 0) { - ptjoin2[i] = ptg2[i]; - } - else if (ptf2[i] != 0) { - ptjoin2[i] = ptf2[i]; - } - } - for (; i < def; i++) { - if (ptf2[i] != 0) - ptjoin2[i] = ptf2[i]; - } + for (; i < deg; i++) { + ptjoin2[i] = ptg2[i]; } } - else if (def >= 65536 && deg >= 65536) { // 3 more cases required - join = NEW_PPERM4(dej); - SET_CODEG_PPERM4(join, dej); + else if (TNUM_OBJ(f) == T_PPERM2 && TNUM_OBJ(g) == T_PPERM4) { + join = NEW_PPERM4(deg); + SET_CODEG_PPERM4(join, deg); ptjoin4 = ADDR_PPERM4(join); - ptf4 = ADDR_PPERM4(f); + ptf2 = ADDR_PPERM2(f); ptg4 = ADDR_PPERM4(g); - if (def < deg) { - for (i = 0; i < def; i++) { - if (ptf4[i] != 0) { - ptjoin4[i] = ptf4[i]; - } - else if (ptg4[i] != 0) { - ptjoin4[i] = ptg4[i]; - } - } - for (; i < deg; i++) { - if (ptg4[i] != 0) - ptjoin4[i] = ptg4[i]; - } + for (i = 0; i < def; i++) { + ptjoin4[i] = (ptf2[i] != 0 ? ptf2[i] : ptg4[i]); } - else { - for (i = 0; i < deg; i++) { - if (ptg4[i] != 0) { - ptjoin4[i] = ptg4[i]; - } - else if (ptf4[i] != 0) { - ptjoin4[i] = ptf4[i]; - } - } - for (; i < def; i++) { - if (ptf4[i] != 0) - ptjoin4[i] = ptf4[i]; - } + for (; i < deg; i++) { + ptjoin4[i] = ptg4[i]; } } - else if (def > deg) { // def>=65536>deg - join = NEW_PPERM4(dej); - SET_CODEG_PPERM4(join, dej); + else if (TNUM_OBJ(f) == T_PPERM4 && TNUM_OBJ(g) == T_PPERM4) { + join = NEW_PPERM4(deg); + SET_CODEG_PPERM4(join, deg); ptjoin4 = ADDR_PPERM4(join); ptf4 = ADDR_PPERM4(f); - ptg2 = ADDR_PPERM2(g); - for (i = 0; i < deg; i++) { - if (ptg2[i] != 0) { - ptjoin4[i] = ptg2[i]; - } - else if (ptf4[i] != 0) { - ptjoin4[i] = ptf4[i]; - } + ptg4 = ADDR_PPERM4(g); + for (i = 0; i < def; i++) { + ptjoin4[i] = (ptf4[i] != 0 ? ptf4[i] : ptg4[i]); } - for (; i < def; i++) { - if (ptf4[i] != 0) - ptjoin4[i] = ptf4[i]; + for (; i < deg; i++) { + ptjoin4[i] = ptg4[i]; } } - else { - return FuncJOIN_IDEM_PPERMS(self, g, f); - } + GAP_ASSERT(join != NULL); return join; } @@ -2217,7 +2155,6 @@ Obj FuncMEET_PPERMS(Obj self, Obj f, Obj g) // restricted partial perm where set is assumed to be a set of positive ints Obj FuncRESTRICTED_PPERM(Obj self, Obj f, Obj set) { - GAP_ASSERT(IS_PPERM(f)); GAP_ASSERT(IS_LIST(set)); UInt i, j, n, codeg, deg; @@ -2280,8 +2217,7 @@ Obj FuncRESTRICTED_PPERM(Obj self, Obj f, Obj set) return Fail; } -// convert a permutation

to a partial perm on , which is assumed to -// be +// convert a permutation

to a partial perm on , which is assumed to be // a set of positive integers Obj FuncAS_PPERM_PERM(Obj self, Obj p, Obj set) { @@ -2303,7 +2239,6 @@ Obj FuncAS_PPERM_PERM(Obj self, Obj p, Obj set) dep = DEG_PERM2(p); if (deg < 65536) { if (dep < deg) { - // Pr("Case 1\n", 0L, 0L); f = NEW_PPERM2(deg); ptf2 = ADDR_PPERM2(f); ptp2 = ADDR_PERM2(p); @@ -2314,7 +2249,6 @@ Obj FuncAS_PPERM_PERM(Obj self, Obj p, Obj set) SET_CODEG_PPERM2(f, deg); } else { // deg(f)<=deg(p)<=65536 - // Pr("Case 2\n", 0L, 0L); f = NEW_PPERM2(deg); ptf2 = ADDR_PPERM2(f); ptp2 = ADDR_PERM2(p); @@ -2328,7 +2262,6 @@ Obj FuncAS_PPERM_PERM(Obj self, Obj p, Obj set) } } else { // deg(p)<=65536<=deg(f) - // Pr("Case 3\n", 0L, 0L); f = NEW_PPERM4(deg); ptf4 = ADDR_PPERM4(f); ptp2 = ADDR_PERM2(p); @@ -2342,7 +2275,6 @@ Obj FuncAS_PPERM_PERM(Obj self, Obj p, Obj set) else { // p is PERM4 dep = DEG_PERM4(p); if (dep < deg) { - // Pr("Case 4\n", 0L, 0L); f = NEW_PPERM4(deg); ptf4 = ADDR_PPERM4(f); ptp4 = ADDR_PERM4(p); @@ -2362,8 +2294,6 @@ Obj FuncAS_PPERM_PERM(Obj self, Obj p, Obj set) codeg = j; } if (codeg < 65536) { - - // Pr("Case 5\n", 0L, 0L); f = NEW_PPERM2(deg); ptf2 = ADDR_PPERM2(f); ptp4 = ADDR_PERM4(p); @@ -2374,7 +2304,6 @@ Obj FuncAS_PPERM_PERM(Obj self, Obj p, Obj set) SET_CODEG_PPERM2(f, codeg); } else { - // Pr("Case 6\n", 0L, 0L); f = NEW_PPERM4(deg); ptf4 = ADDR_PPERM4(f); ptp4 = ADDR_PERM4(p); @@ -2539,7 +2468,7 @@ Obj FuncShortLexLeqPartialPerm(Obj self, Obj f, Obj g) if (DEG_PPERM4(g) == 0) return False; rankg = RANK_PPERM4(g); - domg = DOM_PPERM(f); + domg = DOM_PPERM(g); } if (rankf != rankg) @@ -2783,7 +2712,6 @@ Int EqPPerm44(Obj f, Obj g) } /* less than for partial perms */ -// beware this is different than it used to be... Int LtPPerm22(Obj f, Obj g) { GAP_ASSERT(TNUM_OBJ(f) == T_PPERM2); @@ -2951,8 +2879,6 @@ Obj ProdPPerm22(Obj f, Obj g) else { // compose in deg operations for (i = 0; i < deg; i++) { - // JDM could have additional case so that we don't have to check - // ptf[i]<=degg if (ptf[i] != 0 && ptf[i] <= degg) { ptfg[i] = ptg[ptf[i] - 1]; if (ptfg[i] > codeg) @@ -3033,7 +2959,7 @@ Obj ProdPPerm44(Obj f, Obj g) UInt4 *ptf, *ptg, *ptfg; Obj fg, dom; - if (DEG_PPERM4(g) == 0) { + if (DEG_PPERM4(f) == 0 || DEG_PPERM4(g) == 0) { return EmptyPartialPerm; } @@ -3184,7 +3110,6 @@ Obj ProdPPerm2Perm2(Obj f, Obj p) if (codeg <= dep) { codeg = 0; if (DOM_PPERM(f) == NULL) { - // Pr("Case 2\n", 0L, 0L); for (i = 0; i < deg; i++) { if (ptf[i] != 0) { ptfp2[i] = ptp[ptf[i] - 1] + 1; @@ -3194,7 +3119,6 @@ Obj ProdPPerm2Perm2(Obj f, Obj p) } } else { - // Pr("Case 1\n", 0L, 0L); dom = DOM_PPERM(f); rank = RANK_PPERM2(f); for (i = 1; i <= rank; i++) { @@ -3207,7 +3131,6 @@ Obj ProdPPerm2Perm2(Obj f, Obj p) } else { if (DOM_PPERM(f) == NULL) { - // Pr("Case 4\n", 0L, 0L); for (i = 0; i < deg; i++) { if (ptf[i] != 0) { ptfp2[i] = IMAGE(ptf[i] - 1, ptp, dep) + 1; @@ -3215,7 +3138,6 @@ Obj ProdPPerm2Perm2(Obj f, Obj p) } } else { - // Pr("Case 3\n", 0L, 0L); dom = DOM_PPERM(f); rank = RANK_PPERM2(f); for (i = 1; i <= rank; i++) { @@ -3230,7 +3152,6 @@ Obj ProdPPerm2Perm2(Obj f, Obj p) ptfp4 = ADDR_PPERM4(fp); codeg = 0; if (DOM_PPERM(f) == NULL) { - // Pr("Case 6\n", 0L, 0L); for (i = 0; i < deg; i++) { if (ptf[i] != 0) { ptfp4[i] = ptp[ptf[i] - 1] + 1; @@ -3240,7 +3161,6 @@ Obj ProdPPerm2Perm2(Obj f, Obj p) } } else { - // Pr("Case 5\n", 0L, 0L); dom = DOM_PPERM(f); rank = RANK_PPERM2(f); for (i = 1; i <= rank; i++) { @@ -3277,7 +3197,6 @@ Obj ProdPPerm4Perm4(Obj f, Obj p) if (codeg <= dep) { codeg = 0; if (DOM_PPERM(f) == NULL) { - // Pr("case 1\n", 0L, 0L); for (i = 0; i < deg; i++) { if (ptf[i] != 0) { ptfp[i] = ptp[ptf[i] - 1] + 1; @@ -3287,7 +3206,6 @@ Obj ProdPPerm4Perm4(Obj f, Obj p) } } else { - // Pr("case 2\n", 0L, 0L); dom = DOM_PPERM(f); rank = RANK_PPERM4(f); for (i = 1; i <= rank; i++) { @@ -3300,7 +3218,6 @@ Obj ProdPPerm4Perm4(Obj f, Obj p) } else { if (DOM_PPERM(f) == NULL) { - // Pr("case 3\n", 0L, 0L); for (i = 0; i < deg; i++) { if (ptf[i] != 0) { ptfp[i] = IMAGE(ptf[i] - 1, ptp, dep) + 1; @@ -3308,7 +3225,6 @@ Obj ProdPPerm4Perm4(Obj f, Obj p) } } else { - // Pr("case 4\n", 0L, 0L); dom = DOM_PPERM(f); rank = RANK_PPERM4(f); for (i = 1; i <= rank; i++) { @@ -3382,7 +3298,6 @@ Obj ProdPPerm4Perm2(Obj f, Obj p) ptfp = ADDR_PPERM4(fp); if (DOM_PPERM(f) == NULL) { - // Pr("case 1\n", 0L, 0L); for (i = 0; i < deg; i++) { if (ptf[i] != 0) { ptfp[i] = IMAGE(ptf[i] - 1, ptp, dep) + 1; @@ -3390,7 +3305,6 @@ Obj ProdPPerm4Perm2(Obj f, Obj p) } } else { - // Pr("case 2\n", 0L, 0L); dom = DOM_PPERM(f); rank = RANK_PPERM4(f); for (i = 1; i <= rank; i++) { @@ -3419,7 +3333,6 @@ Obj ProdPerm2PPerm2(Obj p, Obj f) degf = DEG_PPERM2(f); if (deg < degf) { - // Pr("case 1\n", 0L, 0L); pf = NEW_PPERM2(degf); ptpf = ADDR_PPERM2(pf); ptp = ADDR_PERM2(p); @@ -3430,7 +3343,6 @@ Obj ProdPerm2PPerm2(Obj p, Obj f) *ptpf++ = ptf[i]; } else { // deg(f)<=deg(p) - // Pr("case 2\n", 0L, 0L); // find the degree ptp = ADDR_PERM2(p); ptf = ADDR_PPERM2(f); @@ -3464,7 +3376,6 @@ Obj ProdPerm4PPerm4(Obj p, Obj f) degf = DEG_PPERM4(f); if (deg < degf) { - // Pr("case 1\n", 0L, 0L); pf = NEW_PPERM4(degf); ptpf = ADDR_PPERM4(pf); ptp = ADDR_PERM4(p); @@ -3475,8 +3386,7 @@ Obj ProdPerm4PPerm4(Obj p, Obj f) *ptpf++ = ptf[i]; } else { // deg(f)= degf || ptf[ptp[deg - 1]] == 0) @@ -3509,7 +3419,6 @@ Obj ProdPerm4PPerm2(Obj p, Obj f) deg = DEG_PERM4(p); degf = DEG_PPERM2(f); if (deg < degf) { - // Pr("case 1\n", 0L, 0L); pf = NEW_PPERM2(degf); ptpf = ADDR_PPERM2(pf); ptp = ADDR_PERM4(p); @@ -3520,7 +3429,6 @@ Obj ProdPerm4PPerm2(Obj p, Obj f) *ptpf++ = ptf[i]; } else { // deg(f)<=deg(p) - // Pr("case 2\n", 0L, 0L); // find the degree ptp = ADDR_PERM4(p); ptf = ADDR_PPERM2(f); @@ -3555,7 +3463,6 @@ Obj ProdPerm2PPerm4(Obj p, Obj f) deg = DEG_PERM2(p); degf = DEG_PPERM4(f); if (deg < degf) { - // Pr("case 1\n", 0L, 0L); pf = NEW_PPERM4(degf); ptpf = ADDR_PPERM4(pf); ptp = ADDR_PERM2(p); @@ -3566,7 +3473,6 @@ Obj ProdPerm2PPerm4(Obj p, Obj f) *ptpf++ = ptf[i]; } else { // deg(f) dep) { - // Pr("case 1\n", 0L, 0L); SET_CODEG_PPERM4(conj, codeg); for (i = 1; i <= rank; i++) { j = INT_INTOBJ(ELM_PLIST(dom, i)) - 1; @@ -3908,7 +3811,6 @@ Obj PowPPerm4Perm4(Obj f, Obj p) } } else { // codeg(f)<=deg(p) - // Pr("case 2"\n, 0L, 0L); codeg = 0; for (i = 1; i <= rank; i++) { j = INT_INTOBJ(ELM_PLIST(dom, i)) - 1; @@ -3922,8 +3824,7 @@ Obj PowPPerm4Perm4(Obj f, Obj p) return conj; } -// g^-1*f*g -// JDM not sure this is worth it... +// g ^ -1 * f * g Obj PowPPerm22(Obj f, Obj g) { GAP_ASSERT(TNUM_OBJ(f) == T_PPERM2); @@ -4852,7 +4753,6 @@ Obj QuoPPerm2Perm2(Obj f, Obj p) if (codeg <= lmp) { codeg = 0; if (DOM_PPERM(f) == NULL) { - // Pr("Case 2\n", 0L, 0L); for (i = 0; i < deg; i++) { if (ptf[i] != 0) { ptquo2[i] = pttmp[ptf[i] - 1] + 1; @@ -4862,7 +4762,6 @@ Obj QuoPPerm2Perm2(Obj f, Obj p) } } else { - // Pr("Case 1\n", 0L, 0L); dom = DOM_PPERM(f); rank = RANK_PPERM2(f); for (i = 1; i <= rank; i++) { @@ -4875,7 +4774,6 @@ Obj QuoPPerm2Perm2(Obj f, Obj p) } else { if (DOM_PPERM(f) == NULL) { - // Pr("Case 4\n", 0L, 0L); for (i = 0; i < deg; i++) { if (ptf[i] != 0) { ptquo2[i] = IMAGE(ptf[i] - 1, pttmp, lmp) + 1; @@ -4883,7 +4781,6 @@ Obj QuoPPerm2Perm2(Obj f, Obj p) } } else { - // Pr("Case 3\n", 0L, 0L); dom = DOM_PPERM(f); rank = RANK_PPERM2(f); for (i = 1; i <= rank; i++) { @@ -4902,7 +4799,6 @@ Obj QuoPPerm2Perm2(Obj f, Obj p) ptquo4 = ADDR_PPERM4(quo); codeg = 0; if (DOM_PPERM(f) == NULL) { - // Pr("Case 6\n", 0L, 0L); for (i = 0; i < deg; i++) { if (ptf[i] != 0) { ptquo4[i] = pttmp[ptf[i] - 1] + 1; @@ -4912,7 +4808,6 @@ Obj QuoPPerm2Perm2(Obj f, Obj p) } } else { - // Pr("Case 5\n", 0L, 0L); dom = DOM_PPERM(f); rank = RANK_PPERM2(f); for (i = 1; i <= rank; i++) { @@ -4968,7 +4863,6 @@ Obj QuoPPerm4Perm4(Obj f, Obj p) if (codeg <= lmp) { codeg = 0; if (DOM_PPERM(f) == NULL) { - // Pr("case 1\n", 0L, 0L); for (i = 0; i < deg; i++) { if (ptf[i] != 0) { ptquo[i] = pttmp[ptf[i] - 1] + 1; @@ -4978,7 +4872,6 @@ Obj QuoPPerm4Perm4(Obj f, Obj p) } } else { - // Pr("case 2\n", 0L, 0L); dom = DOM_PPERM(f); rank = RANK_PPERM4(f); for (i = 1; i <= rank; i++) { @@ -4991,7 +4884,6 @@ Obj QuoPPerm4Perm4(Obj f, Obj p) } else { if (DOM_PPERM(f) == NULL) { - // Pr("case 3\n", 0L, 0L); for (i = 0; i < deg; i++) { if (ptf[i] != 0) { ptquo[i] = IMAGE(ptf[i] - 1, pttmp, lmp) + 1; @@ -4999,7 +4891,6 @@ Obj QuoPPerm4Perm4(Obj f, Obj p) } } else { - // Pr("case 4\n", 0L, 0L); dom = DOM_PPERM(f); rank = RANK_PPERM4(f); for (i = 1; i <= rank; i++) { @@ -5113,7 +5004,6 @@ Obj QuoPPerm4Perm2(Obj f, Obj p) // multiply the partial perm with the inverse if (DOM_PPERM(f) == NULL) { - // Pr("case 1\n", 0L, 0L); for (i = 0; i < deg; i++) { if (ptf[i] != 0) { ptquo[i] = IMAGE(ptf[i] - 1, pttmp, lmp) + 1; @@ -5121,7 +5011,6 @@ Obj QuoPPerm4Perm2(Obj f, Obj p) } } else { - // Pr("case 2\n", 0L, 0L); dom = DOM_PPERM(f); rank = RANK_PPERM4(f); for (i = 1; i <= rank; i++) { @@ -6322,9 +6211,14 @@ Obj OnSetsPPerm(Obj set, Obj f) *ptres++ = tmp; } } - else { /* this case cannot occur since I think POW is not defined - */ - ErrorQuit("not yet implemented!", 0L, 0L); + else { + // This case currently does not work since PowIntPPerm2/4 only + // works for small integers, and returns an error for non-small + // integers. The analogous code in permutat.c uses the macro + // POW, which calls PowIntPerm2/4, which if called with a + // non-small positive integer returns that integer, since every + // permutation fixes every non-small positive integer. + ErrorQuit(" must be a list of small integers", 0, 0); } } } @@ -6342,14 +6236,17 @@ Obj OnSetsPPerm(Obj set, Obj f) *ptres++ = tmp; } } - else { /* this case cannot occur since I think POW is not defined - */ - ErrorQuit("not yet implemented!", 0L, 0L); + else { + // This case currently does not work since PowIntPPerm2/4 only + // works for small integers, and returns an error for non-small + // integers. The analogous code in permutat.c uses the macro + // POW, which calls PowIntPerm2/4, which if called with a + // non-small positive integer returns that integer, since every + // permutation fixes every non-small positive integer. + ErrorQuit(" must be a list of small integers", 0, 0); } } } - // maybe a problem here if the result has length 0, this certainly - // caused a problem in OnPosIntSetsPPerm... if (reslen == 0) { RetypeBag(res, IS_MUTABLE_PLIST(set) ? T_PLIST_EMPTY : T_PLIST_EMPTY + IMMUTABLE); @@ -6415,9 +6312,14 @@ Obj OnTuplesPPerm(Obj tup, Obj f) *(ptres++) = INTOBJ_INT(ptf2[k - 1]); } } - else { /* this case cannot occur since I think POW is not defined - */ - ErrorQuit("not yet implemented!", 0L, 0L); + else { + // This case currently does not work since PowIntPPerm2/4 only + // works for small integers, and returns an error for non-small + // integers. The analogous code in permutat.c uses the macro + // POW, which calls PowIntPerm2/4, which if called with a + // non-small positive integer returns that integer, since every + // permutation fixes every non-small positive integer. + ErrorQuit(" must be a list of small integers", 0, 0); } } } @@ -6433,9 +6335,14 @@ Obj OnTuplesPPerm(Obj tup, Obj f) *(ptres++) = INTOBJ_INT(ptf4[k - 1]); } } - else { /* this case cannot occur since I think POW is not defined - */ - ErrorQuit("not yet implemented!", 0L, 0L); + else { + // This case currently does not work since PowIntPPerm2/4 only + // works for small integers, and returns an error for non-small + // integers. The analogous code in permutat.c uses the macro + // POW, which calls PowIntPerm2/4, which if called with a + // non-small positive integer returns that integer, since every + // permutation fixes every non-small positive integer. + ErrorQuit(" must be a list of small integers", 0, 0); } } } @@ -6465,7 +6372,8 @@ Obj FuncOnPosIntSetsPartialPerm(Obj self, Obj set, Obj f) } PLAIN_LIST(set); - res = NEW_PLIST_WITH_MUTABILITY(IS_MUTABLE_PLIST(set), T_PLIST_CYC_SSORT, LEN_LIST(set)); + res = NEW_PLIST_WITH_MUTABILITY(IS_MUTABLE_PLIST(set), T_PLIST_CYC_SSORT, + LEN_PLIST(set)); /* get the pointer */ ptset = CONST_ADDR_OBJ(set) + LEN_LIST(set); @@ -6783,6 +6691,22 @@ static Int InitLibrary(StructInitInfo * module) EmptyPartialPerm = NEW_PPERM2(0); + // We make the following partial perms to allow testing of some parts of + // the code which would not otherwise be accessible, since no partial perm + // created in this file is a T_PPERM4 can have degree 0, for example. Such + // partial perm can be created by packages with a kernel module, and so we + // introduce these partial perms for testing purposes. + Obj EMPTY_PPERM4 = NEW_PPERM4(0); + AssReadOnlyGVar(GVarName("EMPTY_PPERM4"), EMPTY_PPERM4); + + Obj ID_PPERM2 = NEW_PPERM2(1); + ADDR_PPERM2(ID_PPERM2)[0] = 1; + AssReadOnlyGVar(GVarName("ID_PPERM2"), ID_PPERM2); + + Obj ID_PPERM4 = NEW_PPERM4(1); + ADDR_PPERM4(ID_PPERM4)[0] = 1; + AssReadOnlyGVar(GVarName("ID_PPERM4"), ID_PPERM4); + /* return success */ return 0; } @@ -6809,6 +6733,7 @@ static StructInitInfo module = { StructInitInfo * InitInfoPPerm(void) { - PPermStateOffset = RegisterModuleState(sizeof(PPermModuleState), InitModuleState, 0); + PPermStateOffset = + RegisterModuleState(sizeof(PPermModuleState), InitModuleState, 0); return &module; } diff --git a/tst/testinstall/pperm.tst b/tst/testinstall/pperm.tst index cbfd5c2738..ed094cf38b 100644 --- a/tst/testinstall/pperm.tst +++ b/tst/testinstall/pperm.tst @@ -16,6 +16,25 @@ gap> SetUserPreference("PartialPermDisplayLimit", 100);; gap> SetUserPreference("NotationForPartialPerms", "component");; gap> SetUserPreference("NotationForTransformations", "fr");; +# Some helper functions +gap> PPerm4 := function(arg) +> local out, e; +> if Length(arg) = 1 then +> e := LeftOne(PartialPerm(arg[1])); +> Add(arg[1], 65536); +> return e * PartialPerm(arg[1]); +> else +> Add(arg[2], 65536 + Length(arg[1])); +> out := PartialPerm(arg[1], [65536 .. 65536 + Length(arg[1]) - 1]) * +> PartialPerm([65536 .. 65536 + Length(arg[1])], arg[2]); +> DomainOfPartialPerm(out); +> return out; +> fi; +> end;; +gap> Perm4 := function(p) +> return p * ((1, 65537) * (1, 65537)); +> end;; + # GAP-level functions # gap> f:=PartialPerm( [ 4, 5, 7, 8 ], [ 5, 4, 1, 6 ] ); @@ -425,26 +444,27 @@ true # HashFuncForPPerm and HASH_FUNC_FOR_PPERM gap> f := PartialPerm([65536]);; -gap> HASH_FUNC_FOR_PPERM(f, 10 ^ 6); -260581 -gap> f := PartialPermNC([65535]);; -gap> HASH_FUNC_FOR_PPERM(f, 10 ^ 6); -354405 +gap> GAPInfo.BytesPerVariable = 8 and HASH_FUNC_FOR_PPERM(f, 10 ^ 6) = 260581 +> or GAPInfo.BytesPerVariable = 4 and HASH_FUNC_FOR_PPERM(f, 10 ^ 6) = 953600; +true gap> f := PartialPermNC([65535]);; -gap> HASH_FUNC_FOR_PPERM(f, 10 ^ 6); -354405 +gap> GAPInfo.BytesPerVariable = 8 and HASH_FUNC_FOR_PPERM(f, 10 ^ 6) = 354405 +> or GAPInfo.BytesPerVariable = 4 and HASH_FUNC_FOR_PPERM(f, 10 ^ 6) = 287798; +true gap> f := PartialPerm([1, 2, 3, 4, 5, 6, 7, 9, 11, 12, 15, 16, 19], -> [2, 4, 11, 1, 20, 10, 15, 16, 5, 3, 6, 12, 9]);; -gap> HASH_FUNC_FOR_PPERM(f, 10 ^ 6); -773594 +> [2, 4, 11, 1, 20, 10, 15, 16, 5, 3, 6, 12, 9]);; +gap> GAPInfo.BytesPerVariable = 8 and HASH_FUNC_FOR_PPERM(f, 10 ^ 6) = 773594 +> or GAPInfo.BytesPerVariable = 4 and HASH_FUNC_FOR_PPERM(f, 10 ^ 6) = 982764; +true gap> f := PartialPermNC([65536]);; gap> g := PartialPermNC([2, 65536], [70000, 1]);; gap> h := f * g; gap> IsPPerm4Rep(h); true -gap> HASH_FUNC_FOR_PPERM(h, 10 ^ 6); -567548 +gap> GAPInfo.BytesPerVariable = 8 and HASH_FUNC_FOR_PPERM(h, 10 ^ 6) = 567548 +> or GAPInfo.BytesPerVariable = 4 and HASH_FUNC_FOR_PPERM(h, 10 ^ 6) = 464636; +true gap> IsPPerm2Rep(h); true @@ -745,107 +765,151 @@ gap> AsPartialPerm(Transformation([10, 8, 4, 6, 4, 5, 3, 8, 8, 2]), [1, 2, 2, 3] Error, usage: the second argument must be a set of positive integers, gap> AsPartialPerm(Transformation([10, 8, 4, 6, 4, 5, 3, 8, 8, 2]), 4); [1,10][2,8][3,4,6] +gap> AsPartialPerm((), []); + # JoinOfPartialPerms -gap> f:=PartialPermNC([1],[2]);; -gap> g:=PartialPermNC([1,2,3],[2,4,1]);; +gap> f := PartialPermNC([1], [2]);; +gap> g := PartialPermNC([1, 2, 3], [2, 4, 1]);; gap> JoinOfPartialPerms(f, g); [3,1,2,4] -gap> f:=PartialPermNC([1],[2]); +gap> JoinOfPartialPerms(g, f); +[3,1,2,4] +gap> f := PartialPermNC([1], [2]); [1,2] -gap> g:=PartialPermNC([2],[3]); +gap> g := PartialPermNC([2], [3]); [2,3] gap> JoinOfPartialPerms(f, g); [1,2,3] -gap> g:=PartialPermNC([2],[1]); +gap> JoinOfPartialPerms(g, f); +[1,2,3] +gap> g := PartialPermNC([2], [1]); [2,1] gap> JoinOfPartialPerms(f, g); (1,2) -gap> g:=PartialPermNC([1],[3]); +gap> JoinOfPartialPerms(g, f); +(1,2) +gap> g := PartialPermNC([1], [3]); [1,3] gap> JoinOfPartialPerms(f, g); fail -gap> f:=PartialPermNC([2]);; -gap> g:=PartialPermNC([3]);; +gap> JoinOfPartialPerms(g, f); +fail +gap> f := PartialPermNC([2]);; +gap> g := PartialPermNC([3]);; gap> JoinOfPartialPerms(f, g); fail -gap> f:=PartialPermNC([2]);; -gap> g:=PartialPermNC([0,3]);; +gap> JoinOfPartialPerms(g, f); +fail +gap> f := PartialPermNC([2]);; +gap> g := PartialPermNC([0, 3]);; gap> JoinOfPartialPerms(f, g); [1,2,3] -gap> f:=PartialPermNC([2]); +gap> JoinOfPartialPerms(g, f); +[1,2,3] +gap> f := PartialPermNC([2]); [1,2] -gap> g:=PartialPermNC([0,3]);; +gap> g := PartialPermNC([0, 3]);; gap> JoinOfPartialPerms(f, g); [1,2,3] -gap> f:=PartialPermNC([2]);; -gap> g:=PartialPermNC([0,3]); +gap> JoinOfPartialPerms(g, f); +[1,2,3] +gap> f := PartialPermNC([2]);; +gap> g := PartialPermNC([0, 3]); [2,3] gap> JoinOfPartialPerms(f, g); [1,2,3] -gap> f:=PartialPermNC([2]);; -gap> f:=PartialPermNC([2]); +gap> JoinOfPartialPerms(g, f); +[1,2,3] +gap> f := PartialPermNC([2]); [1,2] -gap> g:=PartialPermNC([0,100000]); +gap> g := PartialPermNC([0, 100000]); [2,100000] -gap> JoinOfPartialPerms(f,g); +gap> JoinOfPartialPerms(f, g); +[1,2,100000] +gap> JoinOfPartialPerms(g, f); [1,2,100000] gap> JoinOfPartialPerms([f, g]); [1,2,100000] +gap> JoinOfPartialPerms([g, f]); +[1,2,100000] gap> JoinOfPartialPerms(1, 2); Error, usage: the argument should be a collection of partial perms, -gap> JoinOfPartialPerms(last, PartialPermNC([100000],[1])); +gap> JoinOfPartialPerms(last, PartialPermNC([100000], [1])); (1,2,100000) -gap> g:=PartialPermNC([0,100000]);; -gap> JoinOfPartialPerms(f,g); +gap> JoinOfPartialPerms(PartialPermNC([100000], [1]), JoinOfPartialPerms([g, f])); +(1,2,100000) +gap> g := PartialPermNC([0, 100000]);; +gap> JoinOfPartialPerms(f, g); [1,2,100000] -gap> f:=PartialPermNC([2]);; -gap> g:=PartialPermNC([0,100000]); +gap> f := PartialPermNC([2]);; +gap> g := PartialPermNC([0, 100000]); [2,100000] -gap> JoinOfPartialPerms(f,g); +gap> JoinOfPartialPerms(f, g); [1,2,100000] -gap> f:=PartialPermNC([2]);; -gap> g:=PartialPermNC([0,100000]);; -gap> JoinOfPartialPerms(f,g); +gap> JoinOfPartialPerms(g, f); [1,2,100000] -gap> last^2; +gap> f := PartialPermNC([2]);; +gap> g := PartialPermNC([0, 100000]);; +gap> JoinOfPartialPerms(f, g); +[1,2,100000] +gap> JoinOfPartialPerms(g, f); +[1,2,100000] +gap> last ^ 2; [1,100000] -gap> f:=PartialPermNC([2]);; -gap> f:=PartialPermNC([0,100000]);; -gap> g:=PartialPermNC([2]);; -gap> JoinOfPartialPerms(f,g); +gap> f := PartialPermNC([0, 100000]);; +gap> g := PartialPermNC([2]);; +gap> JoinOfPartialPerms(f, g); +[1,2,100000] +gap> JoinOfPartialPerms(g, f); [1,2,100000] -gap> f:=PartialPermNC([0,100000]);; -gap> g:=PartialPermNC([0,100000,4]);; -gap> JoinOfPartialPerms(f,g); +gap> f := PartialPermNC([0, 100000]);; +gap> g := PartialPermNC([0, 100000, 4]);; +gap> JoinOfPartialPerms(f, g); +[2,100000][3,4] +gap> JoinOfPartialPerms(g, f); [2,100000][3,4] -gap> g:=PartialPermNC([0,0,4]);; -gap> JoinOfPartialPerms(f,g); +gap> g := PartialPermNC([0, 0, 4]);; +gap> JoinOfPartialPerms(f, g); +[2,100000][3,4] +gap> JoinOfPartialPerms(g, f); [2,100000][3,4] -gap> g:=PartialPermNC([0,0,4]); +gap> g := PartialPermNC([0, 0, 4]); [3,4] -gap> JoinOfPartialPerms(f,g); +gap> JoinOfPartialPerms(f, g); +[2,100000][3,4] +gap> JoinOfPartialPerms(g, f); [2,100000][3,4] -gap> f:=PartialPermNC([0,100000]); +gap> f := PartialPermNC([0, 100000]); [2,100000] -gap> JoinOfPartialPerms(f,g); +gap> JoinOfPartialPerms(f, g); +[2,100000][3,4] +gap> JoinOfPartialPerms(g, f); +[2,100000][3,4] +gap> g := PartialPermNC([0, 0, 4]);; +gap> JoinOfPartialPerms(f, g); [2,100000][3,4] -gap> g:=PartialPermNC([0,0,4]);; -gap> JoinOfPartialPerms(f,g); +gap> JoinOfPartialPerms(g, f); [2,100000][3,4] -gap> f:=PartialPermNC( [ 1, 2, 4, 5, 6, 7 ], [ 5, 100000, 7, 3, 1, 4 ] )* -> PartialPermNC([1..99999]); +gap> f := PartialPermNC([1, 2, 4, 5, 6, 7], [5, 100000, 7, 3, 1, 4]) +> * PartialPermNC([1 .. 99999]); [6,1,5,3](4,7) gap> IsPPerm4Rep(f); true -gap> g:=PartialPermNC([8,100000],[100000,1]); +gap> g := PartialPermNC([8, 100000], [100000, 1]); [8,100000,1] gap> JoinOfPartialPerms(f, g); fail -gap> g:=PartialPermNC([8],[100000]); +gap> JoinOfPartialPerms(g, f); +fail +gap> g := PartialPermNC([8], [100000]); [8,100000] gap> JoinOfPartialPerms(f, g); [6,1,5,3][8,100000](4,7) +gap> JoinOfPartialPerms(g, f); +[6,1,5,3][8,100000](4,7) +gap> JoinOfPartialPerms(f, f); +[6,1,5,3](4,7) # JOIN_IDEM_PPERMS gap> JOIN_IDEM_PPERMS(PartialPerm([1 .. 5]), @@ -898,7 +962,7 @@ gap> MeetOfPartialPerms(PartialPerm([1]), PartialPerm([2])); gap> MeetOfPartialPerms(PartialPerm([1]), PartialPerm([1, 2])); gap> MeetOfPartialPerms([]); -Error, usage: the argument should be a collection of partial perms, +Error, usage: the argument should be a collection of partial perms, gap> MeetOfPartialPerms([PartialPerm([1]), PartialPerm([1, 2])]); gap> MeetOfPartialPerms(SymmetricInverseMonoid(3)); @@ -933,6 +997,8 @@ gap> RestrictedPartialPerm(f, [2, 1, 3]); Error, usage: the second argument must be a set of positive integers, gap> RestrictedPartialPerm(f, [1, 2, 2 ^ 61]); Error, usage: the second argument must be a set of positive integers, +gap> RESTRICTED_PPERM("a", [1, 2, 3]); +fail # AsPermutation gap> f:=PartialPermNC([10,2,3,4,5]); @@ -957,6 +1023,9 @@ gap> OnTuples(DomainOfPartialPerm(g),AsPermutation(g))= true gap> AsPermutation(f); fail +gap> f := PartialPerm([1, 70000], [70000, 1]);; +gap> AsPermutation(f); +(1,70000) # PermLeftQuoPartialPerm gap> f := PartialPerm([1, 100], [100, 2]);; @@ -1046,51 +1115,121 @@ true gap> IsPPerm4Rep(f); true -# EqPPerm24 and EqPPerm42 -gap> f:=PartialPermNC([1..100], [2..101]); - -gap> p:=(1,100000); -(1,100000) -gap> IsPPerm2Rep(f); +# EqPPerm22 +gap> PartialPerm([1, 2]) = PartialPerm([2, 1]); +false +gap> PartialPerm([1, 2], [2, 1]) = PartialPerm([1, 2], [1, 2]); +false +gap> PartialPerm([2], [2]) = PartialPermNC([1 .. 2], [1 .. 2]); +false +gap> PartialPerm([1, 2]) = PartialPerm([1, 2]); true -gap> IsPPerm4Rep(f*p); +gap> PartialPerm([1, 2], [1, 2]) = PartialPerm([1, 2], [1, 2]); true -gap> f*p=f; + +# EqPPerm24 +gap> PartialPerm([1, 2]) = PPerm4([2, 1]); +false +gap> PartialPerm([1, 2], [2, 1]) = PPerm4([1, 2], [1, 2]); +false +gap> PartialPerm([2], [2]) = PPerm4([1 .. 2], [1 .. 2]); +false +gap> PartialPerm([1, 2]) = PPerm4([1, 2]); true -gap> f=f*p; +gap> PartialPerm([1, 2], [1, 2]) = PPerm4([1, 2], [1, 2]); true -# ProdPPerm2Perm2, Case 1 of 6: codeg(f)<=deg(p), domain known -gap> f:=PartialPerm( [ 1, 2, 3, 6, 10 ], [ 2, 7, 8, 10, 6 ] );; DomainOfPartialPerm(f);; -gap> p:=(7, 100);; -gap> g:=f*p;; -gap> DomainOfPartialPerm(g)=DomainOfPartialPerm(f); +# EqPPerm42 +gap> PPerm4([1, 2]) = PartialPerm([2, 1]); +false +gap> PPerm4([1, 2], [2, 1]) = PartialPerm([1, 2], [1, 2]); +false +gap> PPerm4([2], [2]) = PartialPermNC([1 .. 2], [1 .. 2]); +false +gap> PPerm4([1, 2]) = PartialPerm([1, 2]); true -gap> OnTuples(ImageListOfPartialPerm(f), p)=ImageListOfPartialPerm(g); +gap> PPerm4([1, 2], [1, 2]) = PartialPerm([1, 2], [1, 2]); true -gap> CodegreeOfPartialPerm(g)=Maximum(ImageSetOfPartialPerm(g)); + +# EqPPerm44 +gap> PartialPerm([1, 70000]) = PartialPerm([70000, 1]); +false +gap> PartialPerm([1, 70000], [70000, 1]) = PartialPerm([1, 70000], [1, 70000]); +false +gap> PartialPerm([70000], [70000]) = PartialPermNC([1 .. 70000], [1 .. 70000]); +false +gap> PartialPerm([1, 70000]) = PartialPerm([1, 70000]); +true +gap> PartialPerm([1, 70000], [1, 70000]) = PartialPerm([1, 70000], [1, 70000]); true -# QuoPPerm2Perm2, Case 1 of 6: codeg(f)<=deg(p), domain known -gap> f:=PartialPerm( [ 1, 2, 3, 6, 10 ], [ 2, 7, 8, 10, 6 ] );; DomainOfPartialPerm(f);; -gap> p:=(7, 100);; -gap> g:=f/p;; -gap> OnTuples(ImageListOfPartialPerm(f), p^-1)=ImageListOfPartialPerm(g); +# LtPPerm22 +gap> PartialPerm([1, 20]) < PartialPerm([20, 1]); true -gap> CodegreeOfPartialPerm(g)=Maximum(ImageSetOfPartialPerm(g)); +gap> PartialPerm([1, 20], [20, 1]) < PartialPerm([1, 20], [1, 20]); +false +gap> PartialPerm([20], [20]) < PartialPermNC([1 .. 20], [1 .. 20]); true -gap> f/p=f*p^-1; +gap> PartialPerm([1, 20]) < PartialPerm([1, 20]); +false +gap> PartialPerm([1, 20], [1, 20]) < PartialPerm([1, 20], [1, 20]); +false +gap> PartialPerm([1, 21], [1, 21]) < PartialPerm([1, 20], [1, 20]); +false +gap> PartialPerm([1, 21], [1, 21]) < PartialPerm([1, 22], [1, 22]); true -# ProdPPerm2Perm2, Case 2 of 6: codeg(f)<=deg(p), domain not known -gap> f:=PartialPerm( [ 1, 2, 3, 6, 10 ], [ 2, 7, 8, 10, 6 ] );; -gap> p:=(7, 100);; -gap> g:=f*p;; -gap> DomainOfPartialPerm(g)=DomainOfPartialPerm(f); +# LtPPerm24 +gap> PartialPerm([1, 20]) < PPerm4([20, 1]); true -gap> OnTuples(ImageListOfPartialPerm(f), p)=ImageListOfPartialPerm(g); +gap> PartialPerm([1, 20], [20, 1]) < PPerm4([1, 20], [1, 20]); +false +gap> PartialPerm([20], [20]) < PPerm4([1 .. 20], [1 .. 20]); +true +gap> PartialPerm([1, 20]) < PPerm4([1, 20]); +false +gap> PartialPerm([1, 20], [1, 20]) < PPerm4([1, 20], [1, 20]); +false +gap> PartialPerm([1, 21], [1, 21]) < PPerm4([1, 20], [1, 20]); +false +gap> PartialPerm([1, 21], [1, 21]) < PPerm4([1, 22], [1, 22]); +true + +# LtPPerm42 +gap> PPerm4([1, 20]) < PartialPerm([20, 1]); true +gap> PPerm4([1, 20], [20, 1]) < PartialPerm([1, 20], [1, 20]); +false +gap> PPerm4([20], [20]) < PartialPerm([1 .. 20], [1 .. 20]); +true +gap> PPerm4([1, 20]) < PartialPerm([1, 20]); +false +gap> PPerm4([1, 20], [1, 20]) < PartialPerm([1, 20], [1, 20]); +false +gap> PPerm4([1, 21], [1, 21]) < PartialPerm([1, 20], [1, 20]); +false +gap> PPerm4([1, 21], [1, 21]) < PartialPerm([1, 22], [1, 22]); +true + +# LtPPerm44 +gap> PartialPerm([1, 70000]) < PartialPerm([70000, 1]); +true +gap> PartialPerm([1, 70000], [70000, 1]) < PartialPerm([1, 70000], [1, 70000]); +false +gap> PartialPerm([70000], [70000]) < PartialPermNC([1 .. 70000], [1 .. 70000]); +true +gap> PartialPerm([1, 70000]) < PartialPerm([1, 70000]); +false +gap> PartialPerm([1, 70000], [1, 70000]) < PartialPerm([1, 70000], [1, 70000]); +false +gap> PartialPerm([1, 70001], [1, 70001]) < PartialPerm([1, 70000], [1, 70000]); +false +gap> PartialPerm([1, 70001], [1, 70001]) < PartialPerm([1, 70002], [1, 70002]); +true + +# ProdPPerm2Perm2, Case 1 of 6: codeg(f)<=deg(p), domain known gap> f:=PartialPerm( [ 1, 2, 3, 6, 10 ], [ 2, 7, 8, 10, 6 ] );; +> DomainOfPartialPerm(f);; gap> p:=(7, 100);; gap> g:=f*p;; gap> DomainOfPartialPerm(g)=DomainOfPartialPerm(f); @@ -1099,28 +1238,28 @@ gap> OnTuples(ImageListOfPartialPerm(f), p)=ImageListOfPartialPerm(g); true gap> CodegreeOfPartialPerm(g)=Maximum(ImageSetOfPartialPerm(g)); true +gap> f := PartialPerm([1, 2, 3, 6, 10]);; +gap> p := (7, 65536);; +gap> f * p; +[4,6][5,10](1)(2)(3) -# QuoPPerm2Perm2, Case 2 of 6: codeg(f)<=deg(p), domain not known +# ProdPPerm2Perm2, Case 2 of 6: codeg(f)<=deg(p), domain not known gap> f:=PartialPerm( [ 1, 2, 3, 6, 10 ], [ 2, 7, 8, 10, 6 ] );; gap> p:=(7, 100);; -gap> g:=f/p;; +gap> g:=f*p;; gap> DomainOfPartialPerm(g)=DomainOfPartialPerm(f); true -gap> OnTuples(ImageListOfPartialPerm(f), p^-1)=ImageListOfPartialPerm(g); -true -gap> f/p=f*p^-1; +gap> OnTuples(ImageListOfPartialPerm(f), p)=ImageListOfPartialPerm(g); true gap> f:=PartialPerm( [ 1, 2, 3, 6, 10 ], [ 2, 7, 8, 10, 6 ] );; gap> p:=(7, 100);; -gap> g:=f/p;; +gap> g:=f*p;; gap> DomainOfPartialPerm(g)=DomainOfPartialPerm(f); true -gap> OnTuples(ImageListOfPartialPerm(f), p^-1)=ImageListOfPartialPerm(g); +gap> OnTuples(ImageListOfPartialPerm(f), p)=ImageListOfPartialPerm(g); true gap> CodegreeOfPartialPerm(g)=Maximum(ImageSetOfPartialPerm(g)); true -gap> f/p=f*p^-1; -true # ProdPPerm2Perm2, Case 3 of 6: codeg(f)>deg(p), domain known gap> f:=PartialPerm([1, 100], [100, 2]);; DomainOfPartialPerm(f);; @@ -1142,30 +1281,6 @@ true gap> CodegreeOfPartialPerm(g)=Maximum(ImageSetOfPartialPerm(g)); true -# QuoPPerm2Perm2, Case 3 of 6: codeg(f)>deg(p), domain known -gap> f:=PartialPerm([1, 100], [100, 2]);; DomainOfPartialPerm(f);; -gap> p:=(7, 10);; -gap> g:=f/p;; -gap> OnTuples(ImageListOfPartialPerm(f), p^-1)=ImageListOfPartialPerm(g); -true -gap> DomainOfPartialPerm(g)=DomainOfPartialPerm(f); -true -gap> CodegreeOfPartialPerm(g)=Maximum(ImageSetOfPartialPerm(g)); -true -gap> f/p=f*p^-1; -true -gap> f:=PartialPerm([1, 65535], [65535, 2]);; -gap> p:=(17, 10000);; -gap> g:=f/p;; -gap> DomainOfPartialPerm(g)=DomainOfPartialPerm(f); -true -gap> OnTuples(ImageListOfPartialPerm(f), p^-1)=ImageListOfPartialPerm(g); -true -gap> CodegreeOfPartialPerm(g)=Maximum(ImageSetOfPartialPerm(g)); -true -gap> f/p=f*p^-1; -true - # ProdPPerm2Perm2, Case 4 of 6: codeg(f)>deg(p), domain not known gap> f:=PartialPerm([1, 100], [100, 2]);; gap> p:=(7, 10);; @@ -1186,30 +1301,6 @@ true gap> CodegreeOfPartialPerm(g)=Maximum(ImageSetOfPartialPerm(g)); true -# QuoPPerm2Perm2, Case 4 of 6: codeg(f)>deg(p), domain not known -gap> f:=PartialPerm([1, 100], [100, 2]);; -gap> p:=(7, 10);; -gap> g:=f/p;; -gap> DomainOfPartialPerm(g)=DomainOfPartialPerm(f); -true -gap> OnTuples(ImageListOfPartialPerm(f), p^-1)=ImageListOfPartialPerm(g); -true -gap> CodegreeOfPartialPerm(g)=Maximum(ImageSetOfPartialPerm(g)); -true -gap> f/p=f*p^-1; -true -gap> f:=PartialPerm([1, 10000], [10000, 2]);; -gap> p:=(13, 1000);; -gap> g:=f/p;; -gap> DomainOfPartialPerm(g)=DomainOfPartialPerm(f); -true -gap> OnTuples(ImageListOfPartialPerm(f), p^-1)=ImageListOfPartialPerm(g); -true -gap> CodegreeOfPartialPerm(g)=Maximum(ImageSetOfPartialPerm(g)); -true -gap> f/p=f*p^-1; -true - # ProdPPerm2Perm2, Case 5 of 6: deg(p)=65536, domain not known gap> p:=(1,65536);; gap> f:=PartialPerm([1, 10000], [10000, 2]);; @@ -1221,19 +1312,6 @@ true gap> CodegreeOfPartialPerm(g)=Maximum(ImageSetOfPartialPerm(g)); true -# QuoPPerm2Perm2, Case 5 of 6: deg(p)=65536, domain not known -gap> p:=(1,65536,123);; -gap> f:=PartialPerm([1, 10000], [10000, 2]);; -gap> g:=f/p;; -gap> DomainOfPartialPerm(g)=DomainOfPartialPerm(f); -true -gap> OnTuples(ImageListOfPartialPerm(f), p^-1)=ImageListOfPartialPerm(g); -true -gap> CodegreeOfPartialPerm(g)=Maximum(ImageSetOfPartialPerm(g)); -true -gap> f/p=f*p^-1; -true - # ProdPPerm2Perm2, Case 6 of 6: deg(p)=65536, domain known gap> f:=PartialPerm([1, 10000], [10000, 2]);; DomainOfPartialPerm(f);; gap> p:=(1,65536);; @@ -1245,19 +1323,6 @@ true gap> CodegreeOfPartialPerm(g)=Maximum(ImageSetOfPartialPerm(g)); true -# QuoPPerm2Perm2, Case 6 of 6: deg(p)=65536, domain known -gap> f:=PartialPerm([1, 10000], [10000, 2]);; DomainOfPartialPerm(f);; -gap> p:=(1,65536,123);; -gap> g:=f/p;; -gap> DomainOfPartialPerm(g)=DomainOfPartialPerm(f); -true -gap> OnTuples(ImageListOfPartialPerm(f), p^-1)=ImageListOfPartialPerm(g); -true -gap> CodegreeOfPartialPerm(g)=Maximum(ImageSetOfPartialPerm(g)); -true -gap> f/p=f*p^-1; -true - # ProdPPerm2Perm4, Case 1 of 2: domain known gap> f:=PartialPerm( [ 1, 2, 3, 6, 10 ], [ 2, 7, 8, 10, 6 ] );; DomainOfPartialPerm(f);; gap> p:=(1,100000);; @@ -1269,19 +1334,6 @@ true gap> CodegreeOfPartialPerm(g)=Maximum(ImageSetOfPartialPerm(g)); true -# QuoPPerm2Perm4, Case 1 of 2: domain known -gap> f:=PartialPerm( [ 1, 2, 3, 6, 10 ], [ 2, 7, 8, 10, 6 ] );; DomainOfPartialPerm(f);; -gap> p:=(1,100000,123);; -gap> g:=f/p;; -gap> DomainOfPartialPerm(g)=DomainOfPartialPerm(f); -true -gap> OnTuples(ImageListOfPartialPerm(f), p^-1)=ImageListOfPartialPerm(g); -true -gap> CodegreeOfPartialPerm(g)=Maximum(ImageSetOfPartialPerm(g)); -true -gap> f/p=f*p^-1; -true - # ProdPPerm2Perm4, Case 2 of 2: domain not known gap> f:=PartialPerm([1, 1000], [1000, 2]);; gap> p:=(1,100000);; @@ -1293,23 +1345,23 @@ true gap> DomainOfPartialPerm(g)=DomainOfPartialPerm(f); true -# QuoPPerm2Perm4, Case 2 of 2: domain not known -gap> f:=PartialPerm([1, 1000], [1000, 2]);; -gap> p:=(1,100000,123);; -gap> g:=f/p;; -gap> OnTuples(ImageListOfPartialPerm(f), p^-1)=ImageListOfPartialPerm(g); +# ProdPPerm4Perm4, Case 1 of 4: deg(p)>codeg(f) domain not known +gap> p:=(1,100000);; +gap> f:=PartialPermNC(Concatenation(List([1..65535], x-> 0), [1,70000]));; +gap> g:=f*p; +[65536,100000][65537,70000] +gap> OnTuples(ImageListOfPartialPerm(f), p)=ImageListOfPartialPerm(g); true gap> CodegreeOfPartialPerm(g)=Maximum(ImageSetOfPartialPerm(g)); true gap> DomainOfPartialPerm(g)=DomainOfPartialPerm(f); true -gap> f/p=f*p^-1; -true -# ProdPPerm4Perm4, Case 1 of 4: deg(p)>codeg(f) domain not known +# ProdPPerm4Perm4, Case 2 of 4: deg(p)>codeg(f) domain known +gap> f:=PartialPermNC(Concatenation(List([1..65535], x-> 0), [1,70000])); +[65536,1][65537,70000] gap> p:=(1,100000);; -gap> f:=PartialPermNC(Concatenation(List([1..65535], x-> 0), [1,70000]));; -gap> g:=f*p; +gap> g:=f*p; [65536,100000][65537,70000] gap> OnTuples(ImageListOfPartialPerm(f), p)=ImageListOfPartialPerm(g); true @@ -1332,25 +1384,26 @@ true gap> f/p=f*p^-1; true -# ProdPPerm4Perm4, Case 2 of 4: deg(p)>codeg(f) domain known +# QuoPPerm4Perm4, Case 2 of 4: deg(p)>codeg(f) domain known gap> f:=PartialPermNC(Concatenation(List([1..65535], x-> 0), [1,70000])); [65536,1][65537,70000] -gap> p:=(1,100000);; -gap> g:=f*p; -[65536,100000][65537,70000] -gap> OnTuples(ImageListOfPartialPerm(f), p)=ImageListOfPartialPerm(g); +gap> p:=(1,100000,123);; +gap> g:=f/p; +[65536,123][65537,70000] +gap> OnTuples(ImageListOfPartialPerm(f), p^-1)=ImageListOfPartialPerm(g); true gap> CodegreeOfPartialPerm(g)=Maximum(ImageSetOfPartialPerm(g)); true gap> DomainOfPartialPerm(g)=DomainOfPartialPerm(f); true +gap> f/p=f*p^-1; +true -# QuoPPerm4Perm4, Case 2 of 4: deg(p)>codeg(f) domain known -gap> f:=PartialPermNC(Concatenation(List([1..65535], x-> 0), [1,70000])); -[65536,1][65537,70000] +# QuoPPerm4Perm4, Case 3 of 4: deg(p)<=codeg(f) domain not known +gap> f:=PartialPermNC(Concatenation(List([1..65535], x-> 0), [1,100001]));; gap> p:=(1,100000,123);; gap> g:=f/p; -[65536,123][65537,70000] +[65536,123][65537,100001] gap> OnTuples(ImageListOfPartialPerm(f), p^-1)=ImageListOfPartialPerm(g); true gap> CodegreeOfPartialPerm(g)=Maximum(ImageSetOfPartialPerm(g)); @@ -1360,24 +1413,13 @@ true gap> f/p=f*p^-1; true -# ProdPPerm4Perm4, Case 3 of 4: deg(p)<=codeg(f) domain not known -gap> f:=PartialPermNC(Concatenation(List([1..65535], x-> 0), [1,100001]));; -gap> p:=(1,100000);; -gap> g:=f*p; -[65536,100000][65537,100001] -gap> OnTuples(ImageListOfPartialPerm(f), p)=ImageListOfPartialPerm(g); -true -gap> CodegreeOfPartialPerm(g)=Maximum(ImageSetOfPartialPerm(g)); -true -gap> DomainOfPartialPerm(g)=DomainOfPartialPerm(f); -true - -# QuoPPerm4Perm4, Case 3 of 4: deg(p)<=codeg(f) domain not known -gap> f:=PartialPermNC(Concatenation(List([1..65535], x-> 0), [1,100001]));; +# QuoPPerm4Perm4, Case 4 of 4: deg(p)<=codeg(f) domain known +gap> f:=PartialPermNC(Concatenation(List([1..65535], x-> 0), [1,100001])); +[65536,1][65537,100001] gap> p:=(1,100000,123);; gap> g:=f/p; [65536,123][65537,100001] -gap> OnTuples(ImageListOfPartialPerm(f), p^-1)=ImageListOfPartialPerm(g); +gap> OnTuples(ImageListOfPartialPerm(f), p^-1)=ImageListOfPartialPerm(g); true gap> CodegreeOfPartialPerm(g)=Maximum(ImageSetOfPartialPerm(g)); true @@ -1386,33 +1428,182 @@ true gap> f/p=f*p^-1; true -# ProdPPerm4Perm4, Case 4 of 4: deg(p)<=codeg(f) domain known -gap> f:=PartialPermNC(Concatenation(List([1..65535], x-> 0), [1,100001])); -[65536,1][65537,100001] +# QuoPPerm4Perm4: Corner cases +gap> EMPTY_PPERM4 / ((1, 65537) * (1, 65537)); + +gap> PPerm4([1]) / ((1, 65537) * (1, 65537)); + + +# QuoPPerm2Perm2, Case 1 of 4: deg(p) > codeg(f) domain not known +gap> p := (1, 10, 12);; +gap> f := PartialPermNC(Concatenation(List([1 .. 65], x -> 0), [1, 70]));; +gap> g := f / p; +[66,12][67,70] +gap> OnTuples(ImageListOfPartialPerm(f), p ^ -1) = ImageListOfPartialPerm(g); +true +gap> CodegreeOfPartialPerm(g) = Maximum(ImageSetOfPartialPerm(g)); +true +gap> DomainOfPartialPerm(g) = DomainOfPartialPerm(f); +true +gap> f / p = f * p ^ -1; +true + +# QuoPPerm2Perm2, Case 2 of 4: deg(p) > codeg(f) domain known +gap> p := (1, 10, 12);; +gap> f := PartialPermNC(Concatenation(List([1 .. 65], x -> 0), [1, 70]));; +gap> DomainOfPartialPerm(f); +[ 66, 67 ] +gap> g := f / p; +[66,12][67,70] +gap> OnTuples(ImageListOfPartialPerm(f), p ^ -1) = ImageListOfPartialPerm(g); +true +gap> CodegreeOfPartialPerm(g) = Maximum(ImageSetOfPartialPerm(g)); +true +gap> DomainOfPartialPerm(g) = DomainOfPartialPerm(f); +true +gap> f / p = f * p ^ -1; +true + +# QuoPPerm2Perm2, Case 3 of 4: deg(p) <= codeg(f) domain not known +gap> p := (1, 10, 12);; +gap> f := PartialPermNC(Concatenation(List([1 .. 65], x -> 0), [1, 70]));; +gap> g := f / p; +[66,12][67,70] +gap> OnTuples(ImageListOfPartialPerm(f), p ^ -1) = ImageListOfPartialPerm(g); +true +gap> CodegreeOfPartialPerm(g) = Maximum(ImageSetOfPartialPerm(g)); +true +gap> DomainOfPartialPerm(g) = DomainOfPartialPerm(f); +true +gap> f / p = f * p ^ -1; +true + +# QuoPPerm2Perm2, Case 4 of 4: deg(p) <= codeg(f) domain known +gap> p := (1, 10, 12);; +gap> f := PartialPermNC(Concatenation(List([1 .. 65], x -> 0), [1, 70]));; +gap> DomainOfPartialPerm(f);; +gap> g := f / p; +[66,12][67,70] +gap> OnTuples(ImageListOfPartialPerm(f), p ^ -1) = ImageListOfPartialPerm(g); +true +gap> CodegreeOfPartialPerm(g) = Maximum(ImageSetOfPartialPerm(g)); +true +gap> DomainOfPartialPerm(g) = DomainOfPartialPerm(f); +true +gap> f / p = f * p ^ -1; +true + +# QuoPPerm2Perm2: Corner cases +gap> EmptyPartialPerm() / ((1, 10) * (1, 10)); + +gap> PartialPerm([1]) / ((1, 10) * (1, 10)); + +gap> p := (1, 65535);; +gap> f := PartialPermNC(Concatenation(List([1 .. 65], x -> 0), [1, 70]));; +gap> f / p; +[66,65535][67,70] + +# QuoPPerm4Perm2, Case 1 of 4: deg(p) > codeg(f) domain not known +gap> p := (1, 10, 12);; +gap> f := PPerm4(Concatenation(List([1 .. 65], x -> 0), [1, 70]));; +gap> g := f / p; +[66,12][67,70] +gap> OnTuples(ImageListOfPartialPerm(f), p ^ -1) = ImageListOfPartialPerm(g); +true +gap> CodegreeOfPartialPerm(g) = Maximum(ImageSetOfPartialPerm(g)); +true +gap> DomainOfPartialPerm(g) = DomainOfPartialPerm(f); +true +gap> f / p = f * p ^ -1; +true + +# QuoPPerm4Perm2, Case 2 of 4: deg(p) > codeg(f) domain known +gap> p := (1, 10, 12);; +gap> f := PPerm4(Concatenation(List([1 .. 65], x -> 0), [1, 70]));; +gap> DomainOfPartialPerm(f); +[ 66, 67 ] +gap> g := f / p; +[66,12][67,70] +gap> OnTuples(ImageListOfPartialPerm(f), p ^ -1) = ImageListOfPartialPerm(g); +true +gap> CodegreeOfPartialPerm(g) = Maximum(ImageSetOfPartialPerm(g)); +true +gap> DomainOfPartialPerm(g) = DomainOfPartialPerm(f); +true +gap> f / p = f * p ^ -1; +true + +# QuoPPerm4Perm2, Case 3 of 4: deg(p) <= codeg(f) domain not known +gap> p := (1, 10, 12);; +gap> f := PPerm4(Concatenation(List([1 .. 65], x -> 0), [1, 70]));; +gap> g := f / p; +[66,12][67,70] +gap> OnTuples(ImageListOfPartialPerm(f), p ^ -1) = ImageListOfPartialPerm(g); +true +gap> CodegreeOfPartialPerm(g) = Maximum(ImageSetOfPartialPerm(g)); +true +gap> DomainOfPartialPerm(g) = DomainOfPartialPerm(f); +true +gap> f / p = f * p ^ -1; +true + +# QuoPPerm4Perm2, Case 4 of 4: deg(p) <= codeg(f) domain known +gap> p := (1, 10, 12);; +gap> f := PPerm4(Concatenation(List([1 .. 65], x -> 0), [1, 70]));; +gap> DomainOfPartialPerm(f);; +gap> g := f / p; +[66,12][67,70] +gap> OnTuples(ImageListOfPartialPerm(f), p ^ -1) = ImageListOfPartialPerm(g); +true +gap> CodegreeOfPartialPerm(g) = Maximum(ImageSetOfPartialPerm(g)); +true +gap> DomainOfPartialPerm(g) = DomainOfPartialPerm(f); +true +gap> f / p = f * p ^ -1; +true + +# QuoPPerm4Perm2: Corner cases +gap> EMPTY_PPERM4 / ((1, 10) * (1, 10)); + +gap> PPerm4([1]) / ((1, 10) * (1, 10)); + +gap> p := (1, 65536);; +gap> f := PPerm4(Concatenation(List([1 .. 65], x -> 0), [1, 70]));; +gap> f / p; +[66,65536][67,70] + +# QuoPPerm2Perm4 +gap> EmptyPartialPerm() / (1, 65537); + +gap> PartialPerm([1]) / ((1, 65537) * (1, 65537)); + +gap> PartialPerm([1]) / (1, 65537); +[1,65537] + +# ProdPPerm4Perm4, Case 3 of 4: deg(p)<=codeg(f) domain not known +gap> f:=PartialPermNC(Concatenation(List([1..65535], x-> 0), [1,100001]));; gap> p:=(1,100000);; gap> g:=f*p; [65536,100000][65537,100001] -gap> OnTuples(ImageListOfPartialPerm(f), p)=ImageListOfPartialPerm(g); +gap> OnTuples(ImageListOfPartialPerm(f), p)=ImageListOfPartialPerm(g); true gap> CodegreeOfPartialPerm(g)=Maximum(ImageSetOfPartialPerm(g)); true gap> DomainOfPartialPerm(g)=DomainOfPartialPerm(f); true -# QuoPPerm4Perm4, Case 4 of 4: deg(p)<=codeg(f) domain known +# ProdPPerm4Perm4, Case 4 of 4: deg(p)<=codeg(f) domain known gap> f:=PartialPermNC(Concatenation(List([1..65535], x-> 0), [1,100001])); [65536,1][65537,100001] -gap> p:=(1,100000,123);; -gap> g:=f/p; -[65536,123][65537,100001] -gap> OnTuples(ImageListOfPartialPerm(f), p^-1)=ImageListOfPartialPerm(g); +gap> p:=(1,100000);; +gap> g:=f*p; +[65536,100000][65537,100001] +gap> OnTuples(ImageListOfPartialPerm(f), p)=ImageListOfPartialPerm(g); true gap> CodegreeOfPartialPerm(g)=Maximum(ImageSetOfPartialPerm(g)); true gap> DomainOfPartialPerm(g)=DomainOfPartialPerm(f); true -gap> f/p=f*p^-1; -true # ProdPPerm4Perm2, Case 1 of 2: domain not known gap> f:=PartialPermNC(Concatenation(List([1..65535], x-> 0), [1,100001]));; @@ -1426,20 +1617,6 @@ true gap> DomainOfPartialPerm(g)=DomainOfPartialPerm(f); true -# QuoPPerm4Perm2, Case 1 of 2: domain not known -gap> f:=PartialPermNC(Concatenation(List([1..65535], x-> 0), [1,100001]));; -gap> p:=(1,2,4);; -gap> g:=f/p; -[65536,4][65537,100001] -gap> OnTuples(ImageListOfPartialPerm(f), p^-1)=ImageListOfPartialPerm(g); -true -gap> CodegreeOfPartialPerm(g)=Maximum(ImageSetOfPartialPerm(g)); -true -gap> DomainOfPartialPerm(g)=DomainOfPartialPerm(f); -true -gap> f/p=f*p^-1; -true - # ProdPPerm4Perm2, Case 2 of 2: domain known gap> f:=PartialPermNC(Concatenation(List([1..65535], x-> 0), [1,100001])); [65536,1][65537,100001] @@ -1453,21 +1630,6 @@ true gap> DomainOfPartialPerm(g)=DomainOfPartialPerm(f); true -# QuoPPerm4Perm2, Case 2 of 2: domain known -gap> f:=PartialPermNC(Concatenation(List([1..65535], x-> 0), [1,100001])); -[65536,1][65537,100001] -gap> p:=(1,2,4);; -gap> g:=f/p; -[65536,4][65537,100001] -gap> OnTuples(ImageListOfPartialPerm(f), p^-1)=ImageListOfPartialPerm(g); -true -gap> CodegreeOfPartialPerm(g)=Maximum(ImageSetOfPartialPerm(g)); -true -gap> DomainOfPartialPerm(g)=DomainOfPartialPerm(f); -true -gap> f/p=f*p^-1; -true - # ProdPerm2PPerm2, Case 1 of 2: deg(p)<=deg(f) gap> f:=PartialPermNC([ 1, 2, 3, 6, 8, 10 ], [ 2, 6, 7, 9, 1, 5 ]);; gap> p:=(1,2,5,3);; @@ -1559,6 +1721,8 @@ gap> g:=p*f; [65538,1] gap> CodegreeOfPartialPerm(g)=Maximum(ImageSetOfPartialPerm(g)); true +gap> (1, 65537) * EmptyPartialPerm(); + # ProdPerm2PPerm4, Case 1 of 2: deg(p)<=deg(f) gap> p:=(1,10000);; @@ -1665,6 +1829,8 @@ gap> p^-1*f*p; [5,18,4,8][7,6,14][10,17,20][16,1,2,12,15](3,11)(9)(19) gap> f^p=p^-1*f*p; true +gap> EmptyPartialPerm() ^ (); + # PowPPerm2Perm2, Case 2 of 4, deg(f)>deg(p) and codeg(f)<=deg(p) gap> f:=PartialPermNC( [ 11, 12, 13, 14, 15, 18, 19, 20 ], @@ -1723,6 +1889,10 @@ true gap> p := (17, 100000);; gap> f^p=p^-1*f*p; true +gap> EmptyPartialPerm() ^ (1, 65537); + +gap> PartialPerm([1, 10, 3]) ^ ((1, 65537) * (1, 65537)); +[2,10](1)(3) # PowPPerm2Perm4, Case 2 of 2, deg(f)<=deg(p) and codeg(f)<=deg(p) gap> f := PartialPermNC([1, 2, 3, 4, 5, 6], [2, 5, 8, 1, 3, 4]);; @@ -1786,6 +1956,16 @@ gap> f^p; gap> p^-1*f*p; [1,3,4,5](6,10) +# PowPPerm4Perm2 +gap> EMPTY_PPERM4 ^ (); + +gap> EMPTY_PPERM4 ^ (1, 65537); + +gap> () * EMPTY_PPERM4; + + +# + # PowPPerm4Perm4, Case 1 of 4, deg(f)>deg(p) and codeg(f)>deg(p) gap> f:=PartialPerm([1, 100000], [100000, 2]);; gap> p:=(17, 65538);; @@ -1871,102 +2051,228 @@ gap> g:=PartialPerm([1, 10000], [10000, 2]);; gap> f/g=f*g^-1; true -# QuoPPerm24, Case 1 of 4, dom(f) known, dom(g) known -gap> f:=PartialPerm( [ 1, 2, 3, 4, 5, 6, 7, 9, 11, 12, 15, 16, 19 ], -> [ 2, 4, 11, 1, 20, 10, 15, 16, 5, 3, 6, 12, 9 ] );; DomainOfPartialPerm(f);; -gap> g:=PartialPerm([1, 100000], [100000, 2]);; DomainOfPartialPerm(g);; +# QuoPPerm22: corner cases +gap> PartialPermNC([1, 8, 10, 0, 4, 3, 7, 0, 0, 2]) / EmptyPartialPerm(); + +gap> EmptyPartialPerm() / PartialPermNC([1, 8, 10, 0, 4, 3, 7, 0, 0, 2]); + +gap> PartialPerm([1, 2, 3]) / PartialPerm([4, 5, 6]); + + +# QuoPPerm42, Case 1 of 4, dom(g) known, dom(f) known +gap> f:=PPerm4( [ 1, 2, 4, 5, 6, 9, 10 ], [ 8, 7, 9, 5, 10, 6, 1 ] );; +gap> g:=PartialPermNC( [ 1, 2, 3, 4, 5, 6, 9, 10 ], +> [ 5, 9, 7, 4, 2, 3, 6, 1 ] ); +[10,1,5,2,9,6,3,7](4) +gap> f/g; +[4,2,3][5,1](9)(10) +gap> f*g^-1; +[4,2,3][5,1](9)(10) +gap> f*g^-1=f/g; +true +gap> f:=PPerm4([1, 10000], [10000, 2]);; DomainOfPartialPerm(f);; +gap> g:=PartialPerm([1, 10000], [10000, 2]);; DomainOfPartialPerm(g);; gap> f/g=f*g^-1; true +gap> f:=PPerm4([100000], [1]); +[100000,1] +gap> f/f; + -# QuoPPerm24, Case 2 of 4, dom(f) known, dom(g) unknown -gap> f:=PartialPerm( [ 1, 2, 3, 4, 5, 6, 7, 9, 11, 12, 15, 16, 19 ], -> [ 2, 4, 11, 1, 20, 10, 15, 16, 5, 3, 6, 12, 9 ] );; DomainOfPartialPerm(f);; -gap> g:=PartialPerm([1, 100000], [100000, 2]);; +# QuoPPerm42, Case 2 of 4, dom(g) known, dom(f) unknown +gap> f:=PPerm4([5,9,4,2,0,3,7,6,0,10]);; +gap> g:=PartialPermNC( [ 1, 2, 3, 5, 6, 7, 10 ], [ 1, 8, 10, 4, 3, 7, 2 ] ); +[5,4][6,3,10,2,8](1)(7) +gap> f/g; +[4,10,3,5](6)(7) +gap> f*g^-1; +[4,10,3,5](6)(7) gap> f/g=f*g^-1; true - -# QuoPPerm24, Case 3 of 4, dom(f) unknown, dom(g) known -gap> f:=PartialPerm( [ 1, 2, 3, 4, 5, 6, 7, 9, 11, 12, 15, 16, 19 ], -> [ 2, 4, 11, 1, 20, 10, 15, 16, 5, 3, 6, 12, 9 ] );; -gap> g:=PartialPerm([1, 100000], [100000, 2]);; DomainOfPartialPerm(g);; +gap> f:=PPerm4([1, 10000], [10000, 2]);; +gap> g:=PartialPerm([1, 10000], [10000, 2]);; DomainOfPartialPerm(g);; gap> f/g=f*g^-1; true -# QuoPPerm24, Case 4 of 4, dom(f) unknown, dom(g) unknown -gap> f:=PartialPerm( [ 1, 2, 3, 4, 5, 6, 7, 9, 11, 12, 15, 16, 19 ], -> [ 2, 4, 11, 1, 20, 10, 15, 16, 5, 3, 6, 12, 9 ] );; -gap> g:=PartialPerm([1, 100000], [100000, 2]);; +# QuoPPerm42, Case 3 of 4, dom(g) unknown, dom(f) known +gap> g:=PartialPermNC([5,9,4,2,0,3,7,6,0,10]);; +gap> f:=PPerm4( [ 1, 2, 3, 5, 6, 7, 10 ], [ 1, 8, 10, 4, 3, 7, 2 ] ); +[5,4][6,3,10,2,8](1)(7) +gap> f/g; +[5,3,10,4](6)(7) +gap> f*g^-1; +[5,3,10,4](6)(7) +gap> f:=PPerm4([1, 10000], [10000, 2]);; DomainOfPartialPerm(f);; +gap> g:=PartialPerm([1, 10000], [10000, 2]);; gap> f/g=f*g^-1; true -# QuoPPerm42, Case 1 of 4, dom(f) known, dom(g) known -gap> f:=PartialPerm([1, 100000], [100000, 2]);; DomainOfPartialPerm(f);; -gap> g:=PartialPerm( [ 1, 2, 3, 4, 5, 6, 7, 9, 11, 12, 15, 16, 19 ], -> [ 2, 4, 11, 1, 20, 10, 15, 16, 5, 3, 6, 12, 9 ] );; DomainOfPartialPerm(g);; +# QuoPPerm42, Case 4 of 4, dom(g) unknown, dom(f) unknown +gap> f:=PPerm4([ 1, 8, 10, 0, 4, 3, 7, 0, 0, 2 ]);; +gap> g:=PartialPermNC([5,9,4,2,0,3,7,6,0,10]);; gap> f/g=f*g^-1; true - -# QuoPPerm42, Case 2 of 4, dom(f) known, dom(g) unknown -gap> f:=PartialPerm([1, 100000], [100000, 2]);; DomainOfPartialPerm(f);; -gap> g:=PartialPerm( [ 1, 2, 3, 4, 5, 6, 7, 9, 11, 12, 15, 16, 19 ], -> [ 2, 4, 11, 1, 20, 10, 15, 16, 5, 3, 6, 12, 9 ] );; +gap> f:=PPerm4([1, 10000], [10000, 2]);; +gap> g:=PartialPerm([1, 10000], [10000, 2]);; gap> f/g=f*g^-1; true -# QuoPPerm42, Case 3 of 4, dom(f) unknown, dom(g) known -gap> f:=PartialPerm([1, 100000], [100000, 2]);; -gap> g:=PartialPerm( [ 1, 2, 3, 4, 5, 6, 7, 9, 11, 12, 15, 16, 19 ], -> [ 2, 4, 11, 1, 20, 10, 15, 16, 5, 3, 6, 12, 9 ] );; DomainOfPartialPerm(g);; +# QuoPPerm42: corner cases +gap> PPerm4([1, 8, 10, 0, 4, 3, 7, 0, 0, 2]) / EmptyPartialPerm(); + +gap> EMPTY_PPERM4 / PartialPermNC([1, 8, 10, 0, 4, 3, 7, 0, 0, 2]); + +gap> PPerm4([1, 2, 3]) / PartialPerm([4, 5, 6]); + + +# QuoPPerm24, Case 1 of 4, dom(g) known, dom(f) known +gap> f:=PartialPerm( [ 1, 2, 4, 5, 6, 9, 10 ], [ 8, 7, 9, 5, 10, 6, 1 ] );; +gap> g:=PPerm4( [ 1, 2, 3, 4, 5, 6, 9, 10 ], +> [ 5, 9, 7, 4, 2, 3, 6, 1 ] ); +[10,1,5,2,9,6,3,7](4) +gap> f/g; +[4,2,3][5,1](9)(10) +gap> f*g^-1; +[4,2,3][5,1](9)(10) +gap> f*g^-1=f/g; +true +gap> f:=PartialPerm([1, 10000], [10000, 2]);; DomainOfPartialPerm(f);; +gap> g:=PPerm4([1, 10000], [10000, 2]);; DomainOfPartialPerm(g);; gap> f/g=f*g^-1; true +gap> f:=PartialPerm([100000], [1]); +[100000,1] +gap> f/f; + -# QuoPPerm42, Case 4 of 4, dom(f) unknown, dom(g) unknown -gap> f:=PartialPerm([1, 100000], [100000, 2]);; -gap> g:=PartialPerm( [ 1, 2, 3, 4, 5, 6, 7, 9, 11, 12, 15, 16, 19 ], -> [ 2, 4, 11, 1, 20, 10, 15, 16, 5, 3, 6, 12, 9 ] );; +# QuoPPerm24, Case 2 of 4, dom(g) known, dom(f) unknown +gap> f:=PartialPerm([5,9,4,2,0,3,7,6,0,10]);; +gap> g:=PPerm4( [ 1, 2, 3, 5, 6, 7, 10 ], [ 1, 8, 10, 4, 3, 7, 2 ] ); +[5,4][6,3,10,2,8](1)(7) +gap> f/g; +[4,10,3,5](6)(7) +gap> f*g^-1; +[4,10,3,5](6)(7) gap> f/g=f*g^-1; true - -# QuoPPerm44, Case 1 of 4, dom(f) known, dom(g) known -gap> f:=PartialPerm([1, 100000], [100000, 2]);; DomainOfPartialPerm(f);; -gap> g:=PartialPerm([1, 100000], [100000, 2]);; DomainOfPartialPerm(g);; +gap> f:=PartialPerm([1, 10000], [10000, 2]);; +gap> g:=PPerm4([1, 10000], [10000, 2]);; DomainOfPartialPerm(g);; gap> f/g=f*g^-1; true -# QuoPPerm44, Case 2 of 4, dom(f) known, dom(g) unknown -gap> f:=PartialPerm([1, 100000], [100000, 2]);; DomainOfPartialPerm(f);; -gap> g:=PartialPerm([1, 100000], [100000, 2]);; +# QuoPPerm24, Case 3 of 4, dom(g) unknown, dom(f) known +gap> g:=PPerm4([5,9,4,2,0,3,7,6,0,10]);; +gap> f:=PartialPerm( [ 1, 2, 3, 5, 6, 7, 10 ], [ 1, 8, 10, 4, 3, 7, 2 ] ); +[5,4][6,3,10,2,8](1)(7) +gap> f/g; +[5,3,10,4](6)(7) +gap> f*g^-1; +[5,3,10,4](6)(7) +gap> f:=PartialPerm([1, 10000], [10000, 2]);; DomainOfPartialPerm(f);; +gap> g:=PPerm4([1, 10000], [10000, 2]);; gap> f/g=f*g^-1; true -# QuoPPerm44, Case 3 of 4, dom(f) unknown, dom(g) known -gap> f:=PartialPerm([1, 100000], [100000, 2]);; -gap> g:=PartialPerm([1, 100000], [100000, 2]);; DomainOfPartialPerm(g);; +# QuoPPerm24, Case 4 of 4, dom(g) unknown, dom(f) unknown +gap> f:=PartialPerm([ 1, 8, 10, 0, 4, 3, 7, 0, 0, 2 ]);; +gap> g:=PPerm4([5,9,4,2,0,3,7,6,0,10]);; gap> f/g=f*g^-1; true - -# QuoPPerm44, Case 4 of 4, dom(f) unknown, dom(g) unknown -gap> f:=PartialPerm([1, 100000], [100000, 2]);; -gap> g:=PartialPerm([1, 100000], [100000, 2]);; +gap> f:=PartialPerm([1, 10000], [10000, 2]);; +gap> g:=PPerm4([1, 10000], [10000, 2]);; gap> f/g=f*g^-1; true -# LQuoPerm2PPerm2, Case 1 of 4, deg(p) f:=PartialPermNC( -> [ 11, 12, 9, 13, 20, 0, 2, 14, 18, 0, 7, 3, 19, 0, 0, 0, 0, 0, 5, 16 ]);; -gap> p:=(1,7,10,4,9,8)(3,6,5);; -gap> LQUO(p, f); -[1,14][6,9,13,19,5][8,18][10,2,12,3,20,16](7,11) -gap> p^-1*f; -[1,14][6,9,13,19,5][8,18][10,2,12,3,20,16](7,11) -gap> last=last2; -true +# QuoPPerm24: corner cases +gap> PartialPerm([1, 8, 10, 0, 4, 3, 7, 0, 0, 2]) / EMPTY_PPERM4; + +gap> EMPTY_PPERM4 / PPerm4([1, 8, 10, 0, 4, 3, 7, 0, 0, 2]); + +gap> PartialPerm([1, 2, 3]) / PPerm4([4, 5, 6]); + -# LQuoPerm2PPerm2, Case 2 of 4, deg(p) f:=PartialPermNC( [ 1, 2, 3, 4, 6, 8, 9, 10, 12, 13, 15, 16, 18 ], -> [ 13, 9, 18, 1, 5, 7, 3, 10, 2, 12, 14, 11, 16 ] );; -gap> p:=(1,5,8,4,6,3)(2,9,10);; -gap> LQUO(p, f); +# QuoPPerm44, Case 1 of 4, dom(g) known, dom(f) known +gap> f:=PPerm4( [ 1, 2, 4, 5, 6, 9, 10 ], [ 8, 7, 9, 5, 10, 6, 1 ] );; +gap> g:=PPerm4( [ 1, 2, 3, 4, 5, 6, 9, 10 ], +> [ 5, 9, 7, 4, 2, 3, 6, 1 ] ); +[10,1,5,2,9,6,3,7](4) +gap> f/g; +[4,2,3][5,1](9)(10) +gap> f*g^-1; +[4,2,3][5,1](9)(10) +gap> f*g^-1=f/g; +true +gap> f:=PPerm4([1, 10000], [10000, 2]);; DomainOfPartialPerm(f);; +gap> g:=PPerm4([1, 10000], [10000, 2]);; DomainOfPartialPerm(g);; +gap> f/g=f*g^-1; +true +gap> f:=PPerm4([100000], [1]); +[100000,1] +gap> f/f; + + +# QuoPPerm44, Case 2 of 4, dom(g) known, dom(f) unknown +gap> f:=PPerm4([5,9,4,2,0,3,7,6,0,10]);; +gap> g:=PPerm4( [ 1, 2, 3, 5, 6, 7, 10 ], [ 1, 8, 10, 4, 3, 7, 2 ] ); +[5,4][6,3,10,2,8](1)(7) +gap> f/g; +[4,10,3,5](6)(7) +gap> f*g^-1; +[4,10,3,5](6)(7) +gap> f/g=f*g^-1; +true +gap> f:=PPerm4([1, 10000], [10000, 2]);; +gap> g:=PPerm4([1, 10000], [10000, 2]);; DomainOfPartialPerm(g);; +gap> f/g=f*g^-1; +true + +# QuoPPerm44, Case 3 of 4, dom(g) unknown, dom(f) known +gap> g:=PPerm4([5,9,4,2,0,3,7,6,0,10]);; +gap> f:=PPerm4( [ 1, 2, 3, 5, 6, 7, 10 ], [ 1, 8, 10, 4, 3, 7, 2 ] ); +[5,4][6,3,10,2,8](1)(7) +gap> f/g; +[5,3,10,4](6)(7) +gap> f*g^-1; +[5,3,10,4](6)(7) +gap> f:=PPerm4([1, 10000], [10000, 2]);; DomainOfPartialPerm(f);; +gap> g:=PPerm4([1, 10000], [10000, 2]);; +gap> f/g=f*g^-1; +true + +# QuoPPerm44, Case 4 of 4, dom(g) unknown, dom(f) unknown +gap> f:=PPerm4([ 1, 8, 10, 0, 4, 3, 7, 0, 0, 2 ]);; +gap> g:=PPerm4([5,9,4,2,0,3,7,6,0,10]);; +gap> f/g=f*g^-1; +true +gap> f:=PPerm4([1, 10000], [10000, 2]);; +gap> g:=PPerm4([1, 10000], [10000, 2]);; +gap> f/g=f*g^-1; +true + +# QuoPPerm44: corner cases +gap> PPerm4([1, 8, 10, 0, 4, 3, 7, 0, 0, 2]) / EMPTY_PPERM4; + +gap> EMPTY_PPERM4 / PPerm4([1, 8, 10, 0, 4, 3, 7, 0, 0, 2]); + +gap> PPerm4([1, 2, 3]) / PPerm4([4, 5, 6]); + + +# LQuoPerm2PPerm2, Case 1 of 4, deg(p) f:=PartialPermNC( +> [ 11, 12, 9, 13, 20, 0, 2, 14, 18, 0, 7, 3, 19, 0, 0, 0, 0, 0, 5, 16 ]);; +gap> p:=(1,7,10,4,9,8)(3,6,5);; +gap> LQUO(p, f); +[1,14][6,9,13,19,5][8,18][10,2,12,3,20,16](7,11) +gap> p^-1*f; +[1,14][6,9,13,19,5][8,18][10,2,12,3,20,16](7,11) +gap> last=last2; +true + +# LQuoPerm2PPerm2, Case 2 of 4, deg(p) f:=PartialPermNC( [ 1, 2, 3, 4, 6, 8, 9, 10, 12, 13, 15, 16, 18 ], +> [ 13, 9, 18, 1, 5, 7, 3, 10, 2, 12, 14, 11, 16 ] );; +gap> p:=(1,5,8,4,6,3)(2,9,10);; +gap> LQUO(p, f); [4,7][6,1,18,16,11][15,14](2,10,3,5,13,12)(9) gap> p^-1*f; [4,7][6,1,18,16,11][15,14](2,10,3,5,13,12)(9) @@ -1998,90 +2304,125 @@ gap> p:=(17, 65536);; gap> LQUO(p, f)=p^-1*f; true -# LQuoPerm2PPerm4, Case 1 of 4, deg(p) f:=PartialPerm([1, 65536], [65536, 2]);; -gap> p:=(17, 60000);; -gap> LQUO(p, f)=p^-1*f; +# LQuoPerm2PPerm2, corner cases +gap> LQUO(p, EmptyPartialPerm()); + + +# LQuoPerm2PPerm4, Case 1 of 4, deg(p) < deg(f), dom(f) unknown +gap> f := PPerm4( +> [11, 12, 9, 13, 20, 0, 2, 14, 18, 0, 7, 3, 19, 0, 0, 0, 0, 0, 5, 16]);; +gap> p:=(1,7,10,4,9,8)(3,6,5);; +gap> LQUO(p, f); +[1,14][6,9,13,19,5][8,18][10,2,12,3,20,16](7,11) +gap> p ^ -1 * f; +[1,14][6,9,13,19,5][8,18][10,2,12,3,20,16](7,11) +gap> last = last2; true # LQuoPerm2PPerm4, Case 2 of 4, deg(p) f:=PartialPerm([1, 65536], [65536, 2]);; DomainOfPartialPerm(f);; -gap> p:=(17, 60000);; -gap> LQUO(p, f)=p^-1*f; +gap> f:=PPerm4( [ 1, 2, 3, 4, 6, 8, 9, 10, 12, 13, 15, 16, 18 ], +> [ 13, 9, 18, 1, 5, 7, 3, 10, 2, 12, 14, 11, 16 ] );; +gap> p:=(1,5,8,4,6,3)(2,9,10);; +gap> LQUO(p, f); +[4,7][6,1,18,16,11][15,14](2,10,3,5,13,12)(9) +gap> p^-1*f; +[4,7][6,1,18,16,11][15,14](2,10,3,5,13,12)(9) +gap> last=last2; true # LQuoPerm2PPerm4, Case 3 of 4, deg(p)>=deg(f), dom(f) unknown -gap> f:=PartialPerm([1, 65536], [65536, 2]);; -gap> p:=(17, 70000);; -gap> LQUO(p, f)=p^-1*f; +gap> f:=PPerm4([ 7, 0, 10, 0, 4, 8, 9, 0, 0, 6 ]);; +gap> p:=(1,16,4,12,6,20,13,9,19,3,7,17,10,14,11,15,2);; +gap> LQUO(p, f); +[5,4][14,6][16,7,10][17,9][20,8] +gap> p^-1*f; +[5,4][14,6][16,7,10][17,9][20,8] +gap> last=last2; true # LQuoPerm2PPerm4, Case 4 of 4, deg(p)>=deg(f), dom(f) known -gap> f:=PartialPerm([1, 65536], [65536, 2]);; DomainOfPartialPerm(f);; -gap> p:=(17, 60000);; -gap> LQUO(p, f)=p^-1*f; -true - -# LQuoPerm4PPerm2, Case 1 of 4, deg(p) f:=PartialPermNC( [ 2, 3, 4, 5, 6, 7, 8, 10, 11, 12, 14, 15, 17, 19 ], -> [ 19, 7, 17, 14, 8, 5, 3, 18, 15, 13, 2, 12, 10, 20 ] );; -gap> f:=JoinOfPartialPerms(f, PartialPermNC([100000], [1]));; -gap> p:=(17, 70000);; -gap> LQUO(p, f)=p^-1*f; +gap> f := PPerm4([1, 2, 3, 4, 5, 6, 7, 10], +> [2, 3, 8, 9, 10, 6, 1, 4]);; +gap> p:=(1,13,15,3,5,7,17)(2,16,12,11,19,18,14,8,10,9,20)(4,6);; +gap> LQUO(p, f); +[5,8][7,10][13,2][16,3][17,1](4,6,9) +gap> p^-1*f; +[5,8][7,10][13,2][16,3][17,1](4,6,9) +gap> last=last2; true - -# LQuoPerm4PPerm2, Case 2 of 4, deg(p) f:=PartialPermNC( [ 2, 3, 4, 5, 6, 7, 8, 10, 11, 12, 14, 15, 17, 19 ], -> [ 19, 7, 17, 14, 8, 5, 3, 18, 15, 13, 2, 12, 10, 20 ] );; -gap> f:=JoinOfPartialPerms(f, PartialPermNC([100000], [1]));; -gap> DomainOfPartialPerm(f);; -gap> p:=(17, 70000);; +gap> f:=PartialPerm([1, 65535], [65535, 2]);; +gap> p:=(17, 65536);; gap> LQUO(p, f)=p^-1*f; true -# LQuoPerm4PPerm2, Case 3 of 4, deg(p)>=deg(f), dom(f) unknown -gap> f:=PartialPermNC( [ 2, 3, 4, 5, 6, 7, 8, 10, 11, 12, 14, 15, 17, 19 ], -> [ 19, 7, 17, 14, 8, 5, 3, 18, 15, 13, 2, 12, 10, 20 ] );; -gap> f:=JoinOfPartialPerms(f, PartialPermNC([10000], [1]));; -gap> p:=(17, 70000);; -gap> LQUO(p, f)=p^-1*f; -true +# LQuoPerm2PPerm4, corner cases +gap> p:=(2, 17);; +gap> LQUO(p, EMPTY_PPERM4); + -# LQuoPerm4PPerm2, Case 4 of 4, deg(p)>=deg(f), dom(f) known -gap> f:=PartialPermNC( [ 2, 3, 4, 5, 6, 7, 8, 10, 11, 12, 14, 15, 17, 19 ], -> [ 19, 7, 17, 14, 8, 5, 3, 18, 15, 13, 2, 12, 10, 20 ] );; -gap> f:=JoinOfPartialPerms(f, PartialPermNC([10000], [1]));; -gap> DomainOfPartialPerm(f);; -gap> p:=(17, 70000);; -gap> LQUO(p, f)=p^-1*f; -true +# LQuoPerm4PPerm2 +gap> p:=(17, 65537);; +gap> LQUO(p, EmptyPartialPerm()); + +gap> LQUO(p, EMPTY_PPERM4); + -# LQuoPerm4PPerm4, Case 1 of 4, deg(p) f:=PartialPerm([1, 70000], [70000, 2]);; -gap> p:=(17, 66000);; -gap> LQUO(p, f)=p^-1*f; +# LQuoPerm4PPerm4, Case 1 of 4, deg(p) < deg(f), dom(f) unknown +gap> f := PPerm4( +> [11, 12, 9, 13, 20, 0, 2, 14, 18, 0, 7, 3, 19, 0, 0, 0, 0, 0, 5, 16]);; +gap> p := Perm4((1, 7, 10, 4, 9, 8)(3, 6, 5));; +gap> LQUO(p, f); +[1,14][6,9,13,19,5][8,18][10,2,12,3,20,16](7,11) +gap> p ^ -1 * f; +[1,14][6,9,13,19,5][8,18][10,2,12,3,20,16](7,11) +gap> last = last2; true +gap> f := PartialPermNC([1 .. 70000]);; +gap> p := (1, 65537);; +gap> LQUO(p, f); + # LQuoPerm4PPerm4, Case 2 of 4, deg(p) f:=PartialPerm([1, 70000], [70000, 2]);; -gap> DomainOfPartialPerm(f);; -gap> p:=(17, 66000);; -gap> LQUO(p, f)=p^-1*f; +gap> f := PPerm4([1, 2, 3, 4, 6, 8, 9, 10, 12, 13, 15, 16, 18], +> [13, 9, 18, 1, 5, 7, 3, 10, 2, 12, 14, 11, 16]);; +gap> p := Perm4((1, 5, 8, 4, 6, 3)(2, 9, 10));; +gap> LQUO(p, f); +[4,7][6,1,18,16,11][15,14](2,10,3,5,13,12)(9) +gap> p^-1*f; +[4,7][6,1,18,16,11][15,14](2,10,3,5,13,12)(9) +gap> last=last2; true # LQuoPerm4PPerm4, Case 3 of 4, deg(p)>=deg(f), dom(f) unknown -gap> f:=PartialPerm([1, 66000], [66000, 2]);; -gap> p:=(17, 70000);; -gap> LQUO(p, f)=p^-1*f; +gap> f:=PPerm4([ 7, 0, 10, 0, 4, 8, 9, 0, 0, 6 ]);; +gap> p:=Perm4((1,16,4,12,6,20,13,9,19,3,7,17,10,14,11,15,2));; +gap> LQUO(p, f); +[5,4][14,6][16,7,10][17,9][20,8] +gap> p^-1*f; +[5,4][14,6][16,7,10][17,9][20,8] +gap> last=last2; true # LQuoPerm4PPerm4, Case 4 of 4, deg(p)>=deg(f), dom(f) known -gap> f:=PartialPerm([1, 66000], [66000, 2]);; -gap> DomainOfPartialPerm(f);; -gap> p:=(17, 70000);; +gap> f := PPerm4([1, 2, 3, 4, 5, 6, 7, 10], +> [2, 3, 8, 9, 10, 6, 1, 4]);; +gap> p:=Perm4((1,13,15,3,5,7,17)(2,16,12,11,19,18,14,8,10,9,20)(4,6));; +gap> LQUO(p, f); +[5,8][7,10][13,2][16,3][17,1](4,6,9) +gap> p^-1*f; +[5,8][7,10][13,2][16,3][17,1](4,6,9) +gap> last=last2; +true +gap> f:=PartialPerm([1, 65535], [65535, 2]);; +gap> p:=(17, 65536);; gap> LQUO(p, f)=p^-1*f; true +# LQuoPerm4PPerm4, corner cases +gap> p:=(17, 65536);; +gap> LQUO(p, EMPTY_PPERM4); + + # LQuoPPerm22, Case 1 of 3, dom(g) unknown gap> f:=PartialPermNC( [ 1, 2, 3, 4, 5, 6, 7, 8, 10, 11, 12, 16, 17, 18, 19 ], > [ 3, 12, 14, 4, 11, 18, 17, 2, 9, 5, 15, 8, 20, 10, 19 ] );; @@ -2118,90 +2459,175 @@ gap> g:=PartialPerm([1, 9000], [9000, 2]);; DomainOfPartialPerm(g);; gap> LQUO(f, g)=f^-1*g; true -# LQuoPPerm24, Case 1 of 3, dom(g) unknown -gap> f:=PartialPerm([1, 100], [100, 2]);; -gap> g:=PartialPerm([1, 100000], [100000, 2]);; -gap> LQUO(f, g)=f^-1*g; +# LQuoPPerm22, corner cases +gap> LQUO(EmptyPartialPerm(), PartialPerm([1])); + +gap> LQUO(PartialPerm([1]), EmptyPartialPerm()); + + +# LQuoPPerm42, Case 1 of 3, dom(g) unknown +gap> f := PPerm4([1, 2, 3, 4, 5, 6, 7, 8, 10, 11, 12, 16, 17, 18, 19], +> [3, 12, 14, 4, 11, 18, 17, 2, 9, 5, 15, 8, 20, 10, 19]);; +gap> g := PartialPerm( +> [13, 1, 8, 5, 4, 14, 0, 11, 12, 9, 0, 20, 0, 2, 0, 18, 0, 7, 3, 19]);; +gap> LQUO(f, g); +[2,11,4,5][10,7][12,1][15,20][19,3,13](8,18,14)(9) +gap> f ^ -1 * g; +[2,11,4,5][10,7][12,1][15,20][19,3,13](8,18,14)(9) +gap> last = last2; +true +gap> f := PPerm4([1, 10000], [10000, 2]);; +gap> g := PartialPerm([1, 9000], [9000, 2]);; +gap> LQUO(f, g) = f ^ -1 * g; true -# LQuoPPerm24, Case 2 of 3, dom(g) known, deg(g)>deg(f) -gap> f:=PartialPerm([1, 100], [100, 2]);; -gap> g:=PartialPerm([1, 100000], [100000, 2]);; DomainOfPartialPerm(g);; -gap> LQUO(f, g)=f^-1*g; +# LQuoPPerm42, Case 2 of 3, dom(g) known, deg(g)>deg(f) +gap> f := PPerm4([1, 2, 3, 5, 6, 7, 8, 11, 12, 16, 19], +> [9, 18, 20, 11, 5, 16, 8, 19, 14, 13, 1]);; +gap> g := PartialPermNC([1, 2, 3, 4, 5, 7, 8, 10, 11, 13, 18, 19, 20], +> [5, 1, 7, 3, 10, 2, 12, 14, 11, 16, 6, 9, 15]);; +gap> LQUO(f, g) = f ^ -1 * g; +true +gap> LQUO(f, g); +[8,12][16,2][18,1,9,5][19,11,10][20,7] +gap> f := PPerm4([1, 9000], [9000, 2]);; DomainOfPartialPerm(f);; +gap> g := PartialPerm([1, 10000], [10000, 2]);; DomainOfPartialPerm(g);; +gap> LQUO(f, g) = f ^ -1 * g; true -# LQuoPPerm24, Case 3 of 3, dom(g) known, deg(g)<=deg(f) -gap> f:=PartialPerm([1, 9000], [9000, 2]);; -gap> g:=PartialPerm([1, 100], [100, 2]);; -gap> g:=JoinOfPartialPerms(g, PartialPermNC([101], [100000]));; -gap> DomainOfPartialPerm(g);; -gap> LQUO(f, g)=f^-1*g; +# LQuoPPerm42, Case 3 of 3, dom(g) known, deg(g)<=deg(f) +gap> f := PPerm4([1, 10000], [10000, 2]);; DomainOfPartialPerm(f);; +gap> g := PartialPerm([1, 9000], [9000, 2]);; DomainOfPartialPerm(g);; +gap> LQUO(f, g) = f ^ -1 * g; true -# LQuoPPerm42, Case 1 of 3, dom(g) unknown -gap> f:=PartialPerm([1, 100000], [100000, 2]);; -gap> g:=PartialPerm([1, 100], [100, 2]);; -gap> LQUO(f, g)=f^-1*g; +# LQuoPPerm42, corner cases +gap> LQUO(EMPTY_PPERM4, PartialPerm([1])); + +gap> LQUO(PPerm4([1]), EmptyPartialPerm()); + + +# LQuoPPerm24, Case 1 of 3, dom(g) unknown +gap> f := PartialPerm([1, 2, 3, 4, 5, 6, 7, 8, 10, 11, 12, 16, 17, 18, 19], +> [3, 12, 14, 4, 11, 18, 17, 2, 9, 5, 15, 8, 20, 10, 19]);; +gap> g := PPerm4( +> [13, 1, 8, 5, 4, 14, 0, 11, 12, 9, 0, 20, 0, 2, 0, 18, 0, 7, 3, 19]);; +gap> LQUO(f, g); +[2,11,4,5][10,7][12,1][15,20][19,3,13](8,18,14)(9) +gap> f ^ -1 * g; +[2,11,4,5][10,7][12,1][15,20][19,3,13](8,18,14)(9) +gap> last = last2; +true +gap> f := PartialPerm([1, 10000], [10000, 2]);; +gap> g := PPerm4([1, 9000], [9000, 2]);; +gap> LQUO(f, g) = f ^ -1 * g; true -# LQuoPPerm42, Case 2 of 3, dom(g) known, deg(g)>deg(f) -gap> f:=PartialPerm([1, 100000], [100000, 2]);; -gap> g:=PartialPerm([1, 100], [100, 2]);; -gap> g:=JoinOfPartialPerms(g, PartialPermNC([100001],[101]));; -gap> DomainOfPartialPerm(g);; -gap> LQUO(f, g)=f^-1*g; +# LQuoPPerm24, Case 2 of 3, dom(g) known, deg(g)>deg(f) +gap> f := PartialPerm([1, 2, 3, 5, 6, 7, 8, 11, 12, 16, 19], +> [9, 18, 20, 11, 5, 16, 8, 19, 14, 13, 1]);; +gap> g := PPerm4([1, 2, 3, 4, 5, 7, 8, 10, 11, 13, 18, 19, 20], +> [5, 1, 7, 3, 10, 2, 12, 14, 11, 16, 6, 9, 15]);; +gap> LQUO(f, g) = f ^ -1 * g; +true +gap> LQUO(f, g); +[8,12][16,2][18,1,9,5][19,11,10][20,7] +gap> f := PartialPerm([1, 9000], [9000, 2]);; DomainOfPartialPerm(f);; +gap> g := PPerm4([1, 10000], [10000, 2]);; DomainOfPartialPerm(g);; +gap> LQUO(f, g) = f ^ -1 * g; true -# LQuoPPerm42, Case 3 of 3, dom(g) known, deg(g)<=deg(f) -gap> f:=PartialPerm([1, 100000], [100000, 2]);; -gap> g:=PartialPerm([1, 100], [100, 2]);; DomainOfPartialPerm(g);; -gap> LQUO(f, g)=f^-1*g; +# LQuoPPerm24, Case 3 of 3, dom(g) known, deg(g)<=deg(f) +gap> f := PartialPerm([1, 10000], [10000, 2]);; DomainOfPartialPerm(f);; +gap> g := PPerm4([1, 9000], [9000, 2]);; DomainOfPartialPerm(g);; +gap> LQUO(f, g) = f ^ -1 * g; true +# LQuoPPerm24, corner cases +gap> LQUO(EmptyPartialPerm(), PPerm4([1])); + +gap> LQUO(PartialPerm([1]), EMPTY_PPERM4); + + # LQuoPPerm44, Case 1 of 3, dom(g) unknown -gap> f:=PartialPerm([1, 65536], [65536, 2]);; -gap> g:=PartialPerm([1, 65536], [65536, 2]);; -gap> LQUO(f, g)=f^-1*g; +gap> f := PPerm4([1, 2, 3, 4, 5, 6, 7, 8, 10, 11, 12, 16, 17, 18, 19], +> [3, 12, 14, 4, 11, 18, 17, 2, 9, 5, 15, 8, 20, 10, 19]);; +gap> g := PPerm4( +> [13, 1, 8, 5, 4, 14, 0, 11, 12, 9, 0, 20, 0, 2, 0, 18, 0, 7, 3, 19]);; +gap> LQUO(f, g); +[2,11,4,5][10,7][12,1][15,20][19,3,13](8,18,14)(9) +gap> f ^ -1 * g; +[2,11,4,5][10,7][12,1][15,20][19,3,13](8,18,14)(9) +gap> last = last2; +true +gap> f := PPerm4([1, 10000], [10000, 2]);; +gap> g := PPerm4([1, 9000], [9000, 2]);; +gap> LQUO(f, g) = f ^ -1 * g; true # LQuoPPerm44, Case 2 of 3, dom(g) known, deg(g)>deg(f) -gap> f:=PartialPerm([1, 65536], [65536, 2]);; -gap> g:=PartialPerm([1, 66000], [66000, 2]);; DomainOfPartialPerm(g);; -gap> LQUO(f, g)=f^-1*g; +gap> f := PPerm4([1, 2, 3, 5, 6, 7, 8, 11, 12, 16, 19], +> [9, 18, 20, 11, 5, 16, 8, 19, 14, 13, 1]);; +gap> g := PPerm4([1, 2, 3, 4, 5, 7, 8, 10, 11, 13, 18, 19, 20], +> [5, 1, 7, 3, 10, 2, 12, 14, 11, 16, 6, 9, 15]);; +gap> LQUO(f, g) = f ^ -1 * g; +true +gap> LQUO(f, g); +[8,12][16,2][18,1,9,5][19,11,10][20,7] +gap> f := PPerm4([1, 9000], [9000, 2]);; DomainOfPartialPerm(f);; +gap> g := PPerm4([1, 10000], [10000, 2]);; DomainOfPartialPerm(g);; +gap> LQUO(f, g) = f ^ -1 * g; true # LQuoPPerm44, Case 3 of 3, dom(g) known, deg(g)<=deg(f) -gap> f:=PartialPerm([1, 66000], [66000, 2]);; -gap> g:=PartialPerm([1, 66553], [66553, 2]);; DomainOfPartialPerm(g);; -gap> LQUO(f, g)=f^-1*g; +gap> f := PPerm4([1, 10000], [10000, 2]);; DomainOfPartialPerm(f);; +gap> g := PPerm4([1, 9000], [9000, 2]);; DomainOfPartialPerm(g);; +gap> LQUO(f, g) = f ^ -1 * g; true -# PowPPerm22, Case 1 of 6, dom(f) not known, codeg(f)<=deg(g) -gap> f:=PartialPermNC( -> [ 3, 12, 14, 4, 11, 18, 17, 2, 0, 9, 5, 15, 0, 0, 0, 8, 20, 10, 19]);; -gap> g:=PartialPermNC( -> [ 1, 2, 3, 4, 5, 6, 7, 10, 11, 12, 13, 14, 16, 18, 19, 21, 22, -> 23, 25, 29, 30 ], [ 13, 1, 8, 24, 5, 4, 14, 11, 25, 12, 9, 21, 20, 2, 22, -> 23, 18, 30, 7, 3, 19 ] );; -gap> f^g; +# LQuoPPerm44, corner cases +gap> LQUO(EMPTY_PPERM4, PPerm4([1])); + +gap> LQUO(PPerm4([1]), EMPTY_PPERM4); + + +# PowPPerm22, Case 1 of 6, dom(f) not known, codeg(f) <= deg(g) +gap> f:=PartialPerm( +> [3, 12, 14, 4, 11, 18, 17, 2, 0, 9, 5, 15, 0, 0, 0, 8, 20, 10, 19]);; +gap> g := PartialPerm( +> [1, 2, 3, 4, 5, 6, 7, 10, 11, 12, 13, 14, 16, 18, 19, 21, 22], +> [13, 1, 8, 24, 5, 4, 14, 11, 25, 12, 9, 21, 20, 2, 22, 7, 39]);; +gap> f ^ g; [1,12][4,2,11][13,8,21](5,25)(22)(24) -gap> g^-1*f*g; +gap> g ^ -1 * f * g; [1,12][4,2,11][13,8,21](5,25)(22)(24) -gap> f:=PartialPerm([1, 20000], [20000, 2]);; -gap> g:=PartialPerm([1, 30000], [30000, 2]);; -gap> f^g=g^-1*f*g; -true - -# PowPPerm22, Case 2 of 6, dom(f) not known, codeg(f)> deg(g) -gap> f:=PartialPermNC( -> [ 28, 4, 16, 6, 14, 9, 17, 0, 19, 22, 0, 12, 0, 7, 23, 25, 15, 0, 0, 0, 0, 0, -> 26, 0, 0, 24, 0, 0, 0, 5 ]);; +gap> f ^ f; +[3,14][8,2,12,15][17,20][18,10,9](4)(5,11)(19) +gap> g ^ g; +[2,1,13,9][4,24][11,25][22,39](5)(7,14,21)(12) +gap> f ^ g; +[1,12][4,2,11][13,8,21](5,25)(22)(24) +gap> f := PartialPerm([10]);; +gap> g := PartialPerm([11, 12]);; +gap> f ^ g; + +gap> g ^ f; + +gap> f ^ f; + +gap> g ^ g; + + +# PowPPerm22, Case 2 of 6, dom(f) not known, codeg(f) > deg(g) +gap> f:=PartialPermNC( +> [ 28, 4, 16, 6, 14, 9, 17, 0, 19, 22, 0, 12, 0, 7, 23, 25, 15, 0, 0, 0, 0, 0, +> 26, 0, 0, 24, 0, 0, 0, 5 ]);; gap> g:=PartialPermNC( [ 1, 2, 3, 4, 5, 6, 8, 9, 10, 15, 16, 17, 19, 20 ], > [ 9, 3, 15, 17, 20, 2, 12, 10, 18, 11, 6, 7, 8, 4 ] );; gap> f^g=g^-1*f*g; true -# PowPPerm22, Case 3 of 6, dom(f) known, deg(f)>deg(g), codeg(f)<=deg(g) +# PowPPerm22, Case 3 of 6, dom(f) known, deg(f) > deg(g), codeg(f) <= deg(g) gap> f:= > PartialPermNC( [ 1, 2, 3, 4, 8, 10, 100 ], [ 5, 10, 4, 3, 6, 1, 9 ] );; gap> g:= @@ -2210,7 +2636,7 @@ gap> g:= gap> f^g=g^-1*f*g; true -# PowPPerm22, Case 4 of 6, dom(f) known, deg(f)>deg(g), codeg(f)> deg(g) +# PowPPerm22, Case 4 of 6, dom(f) known, deg(f) > deg(g), codeg(f) > deg(g) gap> f:=PartialPermNC( [ 1, 2, 3, 4, 5, 6, 7, 10, 11, 12, 13, 14, 16, 18, 19, > 21, 22, 23, 25, 29, 30 ], [ 13, 1, 8, 24, 5, 4, 14, 11, 25, 12, 9, 21, 20, 2, > 22, 23, 18, 30, 7, 3, 19 ] );; @@ -2233,7 +2659,7 @@ gap> g:=PartialPerm([1, 40000], [40000, 2]);; gap> f^g=g^-1*f*g; true -# PowPPerm22, Case 5 of 6, dom(f) known, deg(f)<=deg(g), codeg(f)<=deg(g) +# PowPPerm22, Case 5 of 6, dom(f) known, deg(f)<=deg(g), codeg(f)<=deg(g) gap> f:= > PartialPermNC( [ 1, 2, 3, 4, 5, 9, 10 ], [ 3, 6, 4, 2, 1, 10, 7 ] );; gap> g:= @@ -2245,7 +2671,7 @@ gap> f^g; gap> g^-1*f*g; [3,4,2] -# PowPPerm22, Case 6 of 6, dom(f) known, deg(f)<=deg(g), codeg(f)> deg(g) +# PowPPerm22, Case 6 of 6, dom(f) known, deg(f) <= deg(g), codeg(f) > deg(g) gap> f:= > PartialPermNC( [ 1, 2, 3, 6, 7, 8, 9, 10 ], [ 5, 8, 2, 4, 7, 3, 1, 100 ] );; gap> g:= @@ -2256,184 +2682,291 @@ gap> f^g; gap> g^-1*f*g; [4,6][10,1][17,13](19) -# PowPPerm24, Case 1 of 6, dom(f) not known, codeg(f)<=deg(g) -gap> f:=PartialPerm( [ 1, 2, 3, 6, 10 ], [ 2, 7, 8, 10, 6 ] );; -gap> g:=PartialPerm([1, 65536], [65536, 2]);; -gap> f^g=g^-1*f*g; -true +# PowPPerm24, Case 1 of 6, dom(f) not known, codeg(f) <= deg(g) +gap> f:=PartialPerm( +> [3, 12, 14, 4, 11, 18, 17, 2, 0, 9, 5, 15, 0, 0, 0, 8, 20, 10, 19]);; +gap> g := PPerm4( +> [1, 2, 3, 4, 5, 6, 7, 10, 11, 12, 13, 14, 16, 18, 19, 21, 22], +> [13, 1, 8, 24, 5, 4, 14, 11, 25, 12, 9, 21, 20, 2, 22, 7, 39]);; +gap> f ^ g; +[1,12][4,2,11][13,8,21](5,25)(22)(24) +gap> g ^ -1 * f * g; +[1,12][4,2,11][13,8,21](5,25)(22)(24) +gap> f ^ f; +[3,14][8,2,12,15][17,20][18,10,9](4)(5,11)(19) +gap> g ^ g; +[2,1,13,9][4,24][11,25][22,39](5)(7,14,21)(12) +gap> f ^ g; +[1,12][4,2,11][13,8,21](5,25)(22)(24) +gap> f := PartialPerm([10]);; +gap> g := PPerm4([11, 12]);; +gap> f ^ g; + +gap> g ^ f; + +gap> f ^ f; + +gap> g ^ g; + +gap> EmptyPartialPerm() ^ g; + +gap> g ^ EmptyPartialPerm(); + -# PowPPerm24, Case 2 of 6, dom(f) not known, codeg(f)> deg(g) -gap> f:=PartialPerm( [ 1, 2, 3, 6, 10 ], [ 2, 7, 8, 10, 6 ] );; -gap> f:=JoinOfPartialPerms(f, PartialPermNC([11], [100]));; -gap> g:=PartialPermNC([10], [65536]);; -gap> g:=JoinOfPartialPerms(g, -> PartialPerm([1, 2, 3, 4, 5, 6, 7], -> [8, 3, 6, 1, 5, 7, 2]));; +# PowPPerm24, Case 2 of 6, dom(f) not known, codeg(f) > deg(g) +gap> f:=PartialPerm( +> [ 28, 4, 16, 6, 14, 9, 17, 0, 19, 22, 0, 12, 0, 7, 23, 25, 15, 0, 0, 0, 0, 0, +> 26, 0, 0, 24, 0, 0, 0, 5 ]);; +gap> g:=PPerm4( [ 1, 2, 3, 4, 5, 6, 8, 9, 10, 15, 16, 17, 19, 20 ], +> [ 9, 3, 15, 17, 20, 2, 12, 10, 18, 11, 6, 7, 8, 4 ] );; gap> f^g=g^-1*f*g; true -# PowPPerm24, Case 3 of 6, dom(f) known, deg(f)>deg(g), codeg(f)<=deg(g) -gap> f:=PartialPerm( [ 1, 2, 4, 6, 7 ], [ 6, 9, 8, 5, 7 ] );; -gap> f:=JoinOfPartialPerms(f, PartialPermNC([11], [100]));; -gap> f:=f^-1;; DomainOfPartialPerm(f);; -gap> g:=PartialPermNC([20], [65536]);; -gap> g:=JoinOfPartialPerms(g, PartialPerm( [ 1, 2, 3, 4, 5, 6, 7 ], [ 8, 3, 6, 1, 5, 7, 2 ] ));; -gap> DegreeOfPartialPerm(f)>DegreeOfPartialPerm(g); -true -gap> CodegreeOfPartialPerm(f)<=DegreeOfPartialPerm(g); -true -gap> f^g = g^-1*f*g; +# PowPPerm24, Case 3 of 6, dom(f) known, deg(f) > deg(g), codeg(f) <= deg(g) +gap> f:= +> PartialPerm( [ 1, 2, 3, 4, 8, 10, 100 ], [ 5, 10, 4, 3, 6, 1, 9 ] );; +gap> g:= +> PPerm4( [ 1, 2, 3, 5, 7, 9, 11, 14, 15, 16, 17, 18 ], +> [ 4, 14, 2, 3, 17, 7, 9, 16, 15, 10, 11, 1 ] );; +gap> f^g=g^-1*f*g; true -# PowPPerm24, Case 4 of 6, dom(f) known, deg(f)>deg(g), codeg(f)> deg(g) -gap> f:=PartialPerm( -> [ 1, 2, 3, 4, 5, 6, 8, 9, 14, 15, 16, 17, 18, 19, 21, 24, 25, 26, 27 ], -> [ 14, 11, 12, 22, 18, 8, 4, 5, 1, 23, 29, 6, 17, 21, 30, 9, 15, 2, 7 ] );; -> DomainOfPartialPerm(f);; -gap> DegreeOfPartialPerm(f)>DegreeOfPartialPerm(g); -true -gap> CoDegreeOfPartialPerm(f)>DegreeOfPartialPerm(g); +# PowPPerm24, Case 4 of 6, dom(f) known, deg(f) > deg(g), codeg(f) > deg(g) +gap> f:=PartialPerm( [ 1, 2, 3, 4, 5, 6, 7, 10, 11, 12, 13, 14, 16, 18, 19, +> 21, 22, 23, 25, 29, 30 ], [ 13, 1, 8, 24, 5, 4, 14, 11, 25, 12, 9, 21, 20, 2, +> 22, 23, 18, 30, 7, 3, 19 ] );; +gap> g:=PPerm4( [ 1, 2, 3, 5, 6, 7, 8, 11, 12, 16, 19 ], +> [ 9, 18, 20, 11, 5, 16, 8, 19, 14, 13, 1 ] );; +gap> DegreeOfPartialPerm(f); DegreeOfPartialPerm(g); +30 +19 +gap> CodegreeOfPartialPerm(f); CodegreeOfPartialPerm(g); +30 +20 +gap> f^g; +[18,9][20,8](11)(14) +gap> g^-1*f*g; +[18,9][20,8](11)(14) +gap> last=last2; true +gap> f:=PartialPerm([1, 50000], [50000, 2]);; +gap> g:=PPerm4([1, 40000], [40000, 2]);; gap> f^g=g^-1*f*g; true -# PowPPerm24, Case 5 of 6, dom(f) known, deg(f)<=deg(g), codeg(f)<=deg(g) -gap> f:=PartialPerm( -> [ 1, 2, 3, 4, 5, 6, 8, 9, 14, 15, 16, 17, 18, 19, 21, 24, 25, 26, 27 ], -> [ 14, 11, 12, 22, 18, 8, 4, 5, 1, 23, 29, 6, 17, 21, 30, 9, 15, 2, 7 ] );; DomainOfPartialPerm(f);; -gap> g:=PartialPerm([1, 65536], [65536, 2]);; -gap> f^g=g^-1*f*g; -true +# PowPPerm24, Case 5 of 6, dom(f) known, deg(f)<=deg(g), codeg(f)<=deg(g) +gap> f:= +> PartialPerm( [ 1, 2, 3, 4, 5, 9, 10 ], [ 3, 6, 4, 2, 1, 10, 7 ] );; +gap> g:= +> PPerm4( [ 1, 2, 3, 5, 7, 9, 11, 14, 15, 16, 17, 18 ], +> [ 4, 14, 2, 3, 17, 7, 9, 16, 15, 10, 11, 1 ] ); +[5,3,2,14,16,10][18,1,4](7,17,11,9)(15) +gap> f^g; +[3,4,2] +gap> g^-1*f*g; +[3,4,2] -# PowPPerm24, Case 6 of 6, dom(f) known, deg(f)<=deg(g), codeg(f)> deg(g) -gap> g:=PartialPermNC([20], [65536]);; -gap> g:=JoinOfPartialPerms(g, PartialPerm( [ 1, 2, 6, 7, 9 ], [ 6, 3, 9, 1, 8 ] ));; -gap> f:=PartialPermNC( [ 10] , [22]);; +# PowPPerm24, Case 6 of 6, dom(f) known, deg(f) <= deg(g), codeg(f) > deg(g) +gap> f:= +> PartialPerm( [ 1, 2, 3, 6, 7, 8, 9, 10 ], [ 5, 8, 2, 4, 7, 3, 1, 100 ] );; +gap> g:= +> PPerm4( [ 1, 2, 3, 4, 5, 6, 7, 10, 11, 13, 15, 16, 17, 18, 19 ], +> [ 17, 1, 10, 6, 13, 4, 19, 11, 7, 12, 16, 2, 9, 8, 20 ] );; gap> f^g; - +[4,6][10,1][17,13](19) gap> g^-1*f*g; +[4,6][10,1][17,13](19) + +# PowPPerm42, Case 1 of 6, dom(f) not known, codeg(f) <= deg(g) +gap> f:=PPerm4( +> [3, 12, 14, 4, 11, 18, 17, 2, 0, 9, 5, 15, 0, 0, 0, 8, 20, 10, 19]);; +gap> g := PartialPerm( +> [1, 2, 3, 4, 5, 6, 7, 10, 11, 12, 13, 14, 16, 18, 19, 21, 22], +> [13, 1, 8, 24, 5, 4, 14, 11, 25, 12, 9, 21, 20, 2, 22, 7, 39]);; +gap> f ^ g; +[1,12][4,2,11][13,8,21](5,25)(22)(24) +gap> g ^ -1 * f * g; +[1,12][4,2,11][13,8,21](5,25)(22)(24) +gap> f ^ f; +[3,14][8,2,12,15][17,20][18,10,9](4)(5,11)(19) +gap> g ^ g; +[2,1,13,9][4,24][11,25][22,39](5)(7,14,21)(12) +gap> f ^ g; +[1,12][4,2,11][13,8,21](5,25)(22)(24) +gap> f := PPerm4([10]);; +gap> g := PartialPerm([11, 12]);; +gap> f ^ g; + +gap> g ^ f; + +gap> f ^ f; + +gap> g ^ g; + +gap> EMPTY_PPERM4 ^ g; + +gap> g ^ EMPTY_PPERM4; -gap> f:=JoinOfPartialPerms(f, PartialPerm( [ 1, 2, 3, 4 ], [ 7, 6, 4, 5 ] ));; -gap> DomainOfPartialPerm(f);; -gap> f^g=g^-1*f*g; -true -# PowPPerm42, Case 1 of 6, dom(f) not known, codeg(f)<=deg(g) -gap> f:=PartialPermNC([ 2, 6, 7, 0, 0, 9, 0, 1, 0, 5, 100000 ]);; -gap> g:=PartialPermNC( [ 1, 2, 3, 4, 6, 7, 8, 10, 100001 ], -> [ 3, 8, 1, 9, 4, 10, 5, 6, 11 ] );; +# PowPPerm42, Case 2 of 6, dom(f) not known, codeg(f) > deg(g) +gap> f:=PPerm4( +> [ 28, 4, 16, 6, 14, 9, 17, 0, 19, 22, 0, 12, 0, 7, 23, 25, 15, 0, 0, 0, 0, 0, +> 26, 0, 0, 24, 0, 0, 0, 5 ]);; +gap> g:=PartialPerm( [ 1, 2, 3, 4, 5, 6, 8, 9, 10, 15, 16, 17, 19, 20 ], +> [ 9, 3, 15, 17, 20, 2, 12, 10, 18, 11, 6, 7, 8, 4 ] );; gap> f^g=g^-1*f*g; true -# PowPPerm42, Case 2 of 6, dom(f) not known, codeg(f)> deg(g) -gap> g:=PartialPermNC( [ 1, 2, 3, 4, 6, 7, 8, 9, 11, 13, 14, 15, 17, 18 ], -> [ 19, 14, 20, 16, 13, 9, 18, 1, 5, 7, 3, 10, 2, 12 ] );; -gap> f^g; -[18,19,14,13,1][20,9] +# PowPPerm42, Case 3 of 6, dom(f) known, deg(f) > deg(g), codeg(f) <= deg(g) +gap> f:= +> PPerm4( [ 1, 2, 3, 4, 8, 10, 100 ], [ 5, 10, 4, 3, 6, 1, 9 ] );; +gap> g:= +> PartialPerm( [ 1, 2, 3, 5, 7, 9, 11, 14, 15, 16, 17, 18 ], +> [ 4, 14, 2, 3, 17, 7, 9, 16, 15, 10, 11, 1 ] );; gap> f^g=g^-1*f*g; true -# PowPPerm42, Case 3 of 6, dom(f) known, deg(f)>deg(g), codeg(f)<=deg(g) -gap> f:=PartialPermNC( [ 1, 2, 4, 5, 8, 10, 100002 ], -> [ 6, 2, 7, 8, 10, 4, 70000 ] );; DomainOfPartialPerm(f);; -gap> g:=PartialPermNC( [ 1, 2, 3, 4, 5, 9, 100000 ], -> [ 9, 3, 8, 2, 10, 7, 11 ] );; -gap> DegreeOfPartialPerm(f); -100002 -gap> DegreeOfPartialPerm(g); -100000 -gap> CodegreeOfPartialPerm(f); -70000 -gap> IsPPerm2Rep(g); -true +# PowPPerm42, Case 4 of 6, dom(f) known, deg(f) > deg(g), codeg(f) > deg(g) +gap> f:=PPerm4( [ 1, 2, 3, 4, 5, 6, 7, 10, 11, 12, 13, 14, 16, 18, 19, +> 21, 22, 23, 25, 29, 30 ], [ 13, 1, 8, 24, 5, 4, 14, 11, 25, 12, 9, 21, 20, 2, +> 22, 23, 18, 30, 7, 3, 19 ] );; +gap> g:=PartialPerm( [ 1, 2, 3, 5, 6, 7, 8, 11, 12, 16, 19 ], +> [ 9, 18, 20, 11, 5, 16, 8, 19, 14, 13, 1 ] );; +gap> DegreeOfPartialPerm(f); DegreeOfPartialPerm(g); +30 +19 +gap> CodegreeOfPartialPerm(f); CodegreeOfPartialPerm(g); +30 +20 gap> f^g; - -gap> g^-1*f*g=last; -true - -# PowPPerm42, Case 4 of 6, dom(f) known, deg(f)>deg(g), codeg(f)> deg(g) -gap> f:=PartialPerm([1, 70000], [70000, 2]);; DomainOfPartialPerm(f);; -gap> g:=PartialPerm( [ 1, 2, 3, 6, 10 ], [ 2, 7, 8, 10, 6 ] );; -gap> f^g=g^-1*f*g; +[18,9][20,8](11)(14) +gap> g^-1*f*g; +[18,9][20,8](11)(14) +gap> last=last2; true - -# PowPPerm42, Case 5 of 6, dom(f) known, deg(f)<=deg(g), codeg(f)<=deg(g) -gap> g:=PartialPermNC( [ 1, 2, 3, 4, 5, 9, 100000 ], -> [ 9, 3, 8, 2, 10, 7, 11 ] );; -gap> f:=PartialPerm([1, 70000], [70000, 2]);; DomainOfPartialPerm(f);; +gap> f:=PPerm4([1, 50000], [50000, 2]);; +gap> g:=PartialPerm([1, 40000], [40000, 2]);; gap> f^g=g^-1*f*g; true -# PowPPerm42, Case 6 of 6, dom(f) known, deg(f)<=deg(g), codeg(f)> deg(g) -gap> f:=PartialPermNC( [ 1, 2, 3, 4, 5, 8, 10, 11 ], -> [ 4, 3, 7, 6, 5, 9, 2, 70000 ] );; DomainOfPartialPerm(f);; -gap> g:=PartialPermNC( [ 1, 2, 3, 4, 5, 6, 7, 8, 11, 15, 16, 19 ], -> [ 10, 2, 18, 17, 16, 5, 13, 20, 15, 11, 4, 6 ] );; +# PowPPerm42, Case 5 of 6, dom(f) known, deg(f)<=deg(g), codeg(f)<=deg(g) +gap> f:= +> PPerm4( [ 1, 2, 3, 4, 5, 9, 10 ], [ 3, 6, 4, 2, 1, 10, 7 ] );; +gap> g:= +> PartialPerm( [ 1, 2, 3, 5, 7, 9, 11, 14, 15, 16, 17, 18 ], +> [ 4, 14, 2, 3, 17, 7, 9, 16, 15, 10, 11, 1 ] ); +[5,3,2,14,16,10][18,1,4](7,17,11,9)(15) gap> f^g; -[2,18,13][10,17,5](16) -gap> g^-1*f*g=last; -true +[3,4,2] +gap> g^-1*f*g; +[3,4,2] -# PowPPerm44, Case 1 of 6, dom(f) not known, codeg(f)<=deg(g) -gap> f:=PartialPermNC( [ 1, 2, 3, 6, 8, 10, 11 ], -> [ 2, 6, 7, 9, 1, 5, 100000 ] );; -gap> g:=PartialPermNC( [ 1, 2, 3, 4, 6, 7, 8, 10, 21, 100001 ], -> [ 3, 8, 1, 9, 4, 10, 5, 6, 100000, 11 ] );; +# PowPPerm42, Case 6 of 6, dom(f) known, deg(f) <= deg(g), codeg(f) > deg(g) +gap> f:= +> PPerm4( [ 1, 2, 3, 6, 7, 8, 9, 10 ], [ 5, 8, 2, 4, 7, 3, 1, 100 ] );; +gap> g:= +> PartialPerm( [ 1, 2, 3, 4, 5, 6, 7, 10, 11, 13, 15, 16, 17, 18, 19 ], +> [ 17, 1, 10, 6, 13, 4, 19, 11, 7, 12, 16, 2, 9, 8, 20 ] );; gap> f^g; -[1,10][5,3,8,4] -gap> g^-1*f*g=last; -true - -# PowPPerm44, Case 2 of 6, dom(f) not known, codeg(f)> deg(g) -gap> f:=PartialPermNC( [ 1, 2, 3, 6, 8, 10, 11 ], -> [ 2, 6, 7, 9, 1, 5, 100000 ] );; -gap> g:=PartialPermNC( [ 1, 2, 3, 4, 6, 7, 8, 9, 11, 13, 14, 15, 17, 18, 21 ], -> [ 19, 14, 20, 16, 13, 9, 18, 1, 5, 7, 3, 10, 2, 12, 100000 ] );; +[4,6][10,1][17,13](19) gap> g^-1*f*g; -[18,19,14,13,1][20,9] -gap> f^g=last; -true +[4,6][10,1][17,13](19) -# PowPPerm44, Case 3 of 6, dom(f) known, deg(f)>deg(g), codeg(f)<=deg(g) -gap> f:=PartialPermNC( [ 1, 2, 4, 5, 8, 10, 100002 ], -> [ 6, 2, 7, 8, 10, 4, 70000 ] );; DomainOfPartialPerm(f);; -gap> g:=PartialPermNC( [ 1, 2, 3, 4, 6, 7, 8, 10, 21, 100001 ], -> [ 3, 8, 1, 9, 4, 10, 5, 6, 100000, 11 ] );; -gap> DegreeOfPartialPerm(f); -100002 -gap> DegreeOfPartialPerm(g); -100001 -gap> CodegreeOfPartialPerm(f); -70000 -gap> f^g; -[3,4][5,6,9,10](8) -gap> g^-1*f*g=last; -true +# PowPPerm44, Case 1 of 6, dom(f) not known, codeg(f) <= deg(g) +gap> f:=PPerm4( +> [3, 12, 14, 4, 11, 18, 17, 2, 0, 9, 5, 15, 0, 0, 0, 8, 20, 10, 19]);; +gap> g := PPerm4( +> [1, 2, 3, 4, 5, 6, 7, 10, 11, 12, 13, 14, 16, 18, 19, 21, 22], +> [13, 1, 8, 24, 5, 4, 14, 11, 25, 12, 9, 21, 20, 2, 22, 7, 39]);; +gap> f ^ g; +[1,12][4,2,11][13,8,21](5,25)(22)(24) +gap> g ^ -1 * f * g; +[1,12][4,2,11][13,8,21](5,25)(22)(24) +gap> f ^ f; +[3,14][8,2,12,15][17,20][18,10,9](4)(5,11)(19) +gap> g ^ g; +[2,1,13,9][4,24][11,25][22,39](5)(7,14,21)(12) +gap> f ^ g; +[1,12][4,2,11][13,8,21](5,25)(22)(24) +gap> f := PPerm4([10]);; +gap> g := PPerm4([11, 12]);; +gap> f ^ g; + +gap> g ^ f; + +gap> f ^ f; + +gap> g ^ g; + +gap> g ^ EMPTY_PPERM4; + +gap> EMPTY_PPERM4 ^ g; + -# PowPPerm44, Case 4 of 6, dom(f) known, deg(f)>deg(g), codeg(f)> deg(g) -gap> f:=PartialPerm([1, 70000], [70000, 2]);; -gap> DomainOfPartialPerm(f);; -gap> g:=PartialPerm([1, 66000], [66000, 2]);; +# PowPPerm44, Case 2 of 6, dom(f) not known, codeg(f) > deg(g) +gap> f:=PPerm4( +> [ 28, 4, 16, 6, 14, 9, 17, 0, 19, 22, 0, 12, 0, 7, 23, 25, 15, 0, 0, 0, 0, 0, +> 26, 0, 0, 24, 0, 0, 0, 5 ]);; +gap> g:=PPerm4( [ 1, 2, 3, 4, 5, 6, 8, 9, 10, 15, 16, 17, 19, 20 ], +> [ 9, 3, 15, 17, 20, 2, 12, 10, 18, 11, 6, 7, 8, 4 ] );; gap> f^g=g^-1*f*g; true -# PowPPerm44, Case 5 of 6, dom(f) known, deg(f)<=deg(g), codeg(f)<=deg(g) -gap> f:=PartialPerm([1, 66000], [66000, 2]);; DomainOfPartialPerm(f);; -gap> g:=PartialPerm([1, 70000], [70000, 2]);; +# PowPPerm44, Case 3 of 6, dom(f) known, deg(f) > deg(g), codeg(f) <= deg(g) +gap> f:= +> PPerm4( [ 1, 2, 3, 4, 8, 10, 100 ], [ 5, 10, 4, 3, 6, 1, 9 ] );; +gap> g:= +> PPerm4( [ 1, 2, 3, 5, 7, 9, 11, 14, 15, 16, 17, 18 ], +> [ 4, 14, 2, 3, 17, 7, 9, 16, 15, 10, 11, 1 ] );; gap> f^g=g^-1*f*g; true -# PowPPerm44, Case 6 of 6, dom(f) known, deg(f)<=deg(g), codeg(f)> deg(g) -gap> f:=PartialPermNC( [ 1, 2, 3, 4, 5, 8, 10, 11 ], -> [ 4, 3, 7, 6, 5, 9, 2, 70000 ] );; DomainOfPartialPerm(f);; -gap> g:=PartialPermNC( [ 1, 2, 3, 4, 5, 6, 7, 8, 11, 15, 16, 19 ], -> [ 10, 2, 18, 17, 16, 5, 13, 20, 15, 11, 4, 6 ] );; -gap> g:=JoinOfPartialPerms(g, PartialPerm([65536], [65536]));; +# PowPPerm44, Case 4 of 6, dom(f) known, deg(f) > deg(g), codeg(f) > deg(g) +gap> f:=PPerm4( [ 1, 2, 3, 4, 5, 6, 7, 10, 11, 12, 13, 14, 16, 18, 19, +> 21, 22, 23, 25, 29, 30 ], [ 13, 1, 8, 24, 5, 4, 14, 11, 25, 12, 9, 21, 20, 2, +> 22, 23, 18, 30, 7, 3, 19 ] );; +gap> g:=PPerm4( [ 1, 2, 3, 5, 6, 7, 8, 11, 12, 16, 19 ], +> [ 9, 18, 20, 11, 5, 16, 8, 19, 14, 13, 1 ] );; +gap> DegreeOfPartialPerm(f); DegreeOfPartialPerm(g); +30 +19 +gap> CodegreeOfPartialPerm(f); CodegreeOfPartialPerm(g); +30 +20 gap> f^g; -[2,18,13][10,17,5](16) -gap> g^-1*f*g=last; +[18,9][20,8](11)(14) +gap> g^-1*f*g; +[18,9][20,8](11)(14) +gap> last=last2; +true +gap> f:=PPerm4([1, 50000], [50000, 2]);; +gap> g:=PPerm4([1, 40000], [40000, 2]);; +gap> f^g=g^-1*f*g; true +# PowPPerm44, Case 5 of 6, dom(f) known, deg(f)<=deg(g), codeg(f)<=deg(g) +gap> f:= +> PPerm4( [ 1, 2, 3, 4, 5, 9, 10 ], [ 3, 6, 4, 2, 1, 10, 7 ] );; +gap> g:= +> PPerm4( [ 1, 2, 3, 5, 7, 9, 11, 14, 15, 16, 17, 18 ], +> [ 4, 14, 2, 3, 17, 7, 9, 16, 15, 10, 11, 1 ] ); +[5,3,2,14,16,10][18,1,4](7,17,11,9)(15) +gap> f^g; +[3,4,2] +gap> g^-1*f*g; +[3,4,2] + +# PowPPerm44, Case 6 of 6, dom(f) known, deg(f) <= deg(g), codeg(f) > deg(g) +gap> f:= +> PPerm4( [ 1, 2, 3, 6, 7, 8, 9, 10 ], [ 5, 8, 2, 4, 7, 3, 1, 100 ] );; +gap> g:= +> PPerm4( [ 1, 2, 3, 4, 5, 6, 7, 10, 11, 13, 15, 16, 17, 18, 19 ], +> [ 17, 1, 10, 6, 13, 4, 19, 11, 7, 12, 16, 2, 9, 8, 20 ] );; +gap> f^g; +[4,6][10,1][17,13](19) +gap> g^-1*f*g; +[4,6][10,1][17,13](19) + # from Semigroups... gap> f:=PartialPermNC([0,1,0,20]); [2,1][4,20] @@ -2560,6 +3093,45 @@ gap> OnSets(DomainOfPartialPerm(f), f)=ImageListOfPartialPerm(f); false gap> OnSets(DomainOfPartialPerm(f), f)=ImageSetOfPartialPerm(f); true +gap> OnPosIntSetsPartialPerm(DomainOfPartialPerm(f), f) +> = ImageSetOfPartialPerm(f); +true +gap> OnTuples(DomainOfPartialPerm(f), f)=ImageSetOfPartialPerm(f); +false +gap> OnTuples(DomainOfPartialPerm(f), f)=ImageListOfPartialPerm(f); +true +gap> OnTuples(ImageListOfPartialPerm(f), f^-1)=DomainOfPartialPerm(f); +true +gap> OnSets(ImageSetOfPartialPerm(f), f^-1)=DomainOfPartialPerm(f); +true +gap> OnPosIntSetsPartialPerm(ImageSetOfPartialPerm(f), f ^ -1) +> = DomainOfPartialPerm(f); +true +gap> OnSets(ImageSetOfPartialPerm(g), g^-1)=DomainOfPartialPerm(g); +true +gap> OnTuples(ImageListOfPartialPerm(g), g^-1)=DomainOfPartialPerm(f); +false +gap> OnPosIntSetsPartialPerm(ImageSetOfPartialPerm(g), g ^ -1) +> = DomainOfPartialPerm(g); +true +gap> OnTuples(ImageListOfPartialPerm(g), g^-1)=DomainOfPartialPerm(g); +true +gap> OnSets([10 .. 20], f); +[ ] +gap> OnPosIntSetsPartialPerm([10 .. 20], f); +[ ] +gap> OnPosIntSetsPartialPerm([0], f) = ImageSetOfPartialPerm(f); +true +gap> f := PPerm4([1, 3, 4, 5, 6, 9], [9, 10, 5, 7, 2, 8]);; +gap> g := PPerm4([1, 2, 3, 4, 5, 6, 7, 8, 10, 11, 12, 13, 19], +> [3, 17, 12, 13, 6, 1, 2, 20, 9, 16, 4, 15, 8]);; +gap> OnSets(DomainOfPartialPerm(f), f)=ImageListOfPartialPerm(f); +false +gap> OnSets(DomainOfPartialPerm(f), f)=ImageSetOfPartialPerm(f); +true +gap> OnPosIntSetsPartialPerm(DomainOfPartialPerm(f), f) +> = ImageSetOfPartialPerm(f); +true gap> OnTuples(DomainOfPartialPerm(f), f)=ImageSetOfPartialPerm(f); false gap> OnTuples(DomainOfPartialPerm(f), f)=ImageListOfPartialPerm(f); @@ -2568,15 +3140,25 @@ gap> OnTuples(ImageListOfPartialPerm(f), f^-1)=DomainOfPartialPerm(f); true gap> OnSets(ImageSetOfPartialPerm(f), f^-1)=DomainOfPartialPerm(f); true +gap> OnPosIntSetsPartialPerm(ImageSetOfPartialPerm(f), f ^ -1) +> = DomainOfPartialPerm(f); +true gap> OnSets(ImageSetOfPartialPerm(g), g^-1)=DomainOfPartialPerm(g); true +gap> OnPosIntSetsPartialPerm(ImageSetOfPartialPerm(g), g ^ -1) +> = DomainOfPartialPerm(g); +true gap> OnTuples(ImageListOfPartialPerm(g), g^-1)=DomainOfPartialPerm(f); false gap> OnTuples(ImageListOfPartialPerm(g), g^-1)=DomainOfPartialPerm(g); true +gap> OnSets([10 .. 20], f); +[ ] +gap> OnPosIntSetsPartialPerm([0], f) = ImageSetOfPartialPerm(f); +true +gap> OnPosIntSetsPartialPerm([], f) = []; +true -#gap> f:=ReadSemigroups(file, 6)[1]; -# # gap> f:=PartialPermNC([ 1, 2, 3, 4, 5, 6, 7, 11, 12, 13, 14, 19 ], > [ 5, 13, 7, 6, 10, 15, 9, 14, 4, 20, 19, 2 ]); @@ -2751,7 +3333,7 @@ gap> PartialPermOpNC(PartialPerm([1]), SymmetricInverseMonoid(1)); gap> RandomPartialPerm(4);; gap> RandomPartialPerm(2 ^ 60); Error, usage: the argument must be a positive integer, a set, or 2 sets, of po\ -sitive integers, +sitive integers, gap> f := RandomPartialPerm([4 .. 10]);; gap> IsSubset([4 .. 10], DomainOfPartialPerm(f)); true @@ -2764,25 +3346,25 @@ gap> IsSubset([1 .. 5], ImageSetOfPartialPerm(f)); true gap> f := RandomPartialPerm([1, 2 ^ 60]); Error, usage: the argument must be a positive integer, a set, or 2 sets, of po\ -sitive integers, +sitive integers, gap> f := RandomPartialPerm([3, 1, 2]); Error, usage: the argument must be a positive integer, a set, or 2 sets, of po\ -sitive integers, +sitive integers, gap> f := RandomPartialPerm([1 .. 3], [3, 1, 2]); Error, usage: the argument must be a positive integer, a set, or 2 sets, of po\ -sitive integers, +sitive integers, gap> f := RandomPartialPerm([3, 1, 2], [1 .. 3]); Error, usage: the argument must be a positive integer, a set, or 2 sets, of po\ -sitive integers, +sitive integers, gap> f := RandomPartialPerm([3, 1, 2], [1, 3, 2 ^ 60]); Error, usage: the argument must be a positive integer, a set, or 2 sets, of po\ -sitive integers, +sitive integers, # PartialPermNC gap> PartialPermNC(1, 2, 3); Error, usage: there should be one or two arguments, gap> PartialPerm(1, 2, 3); -Error, usage: there should be one or two arguments, +Error, usage: there should be one or two arguments, gap> PartialPerm([1, 2, 2 ^ 60]); Error, usage: the argument must be a list of non-negative integers and the non\ -zero elements must be duplicate-free, @@ -2839,6 +3421,555 @@ gap> SmallestMovedPoint(coll); gap> SmallestImageOfMovedPoint(coll); 3 +# ShortLexLeqPartialPerm +gap> f := PartialPerm([1, 2, 3], [70000, 3, 4]); +[1,70000][2,3,4] +gap> ShortLexLeqPartialPerm(f, f); +false +gap> g := PartialPerm([1, 2, 4, 7, 9], [5, 3, 7, 4, 9]);; +gap> ShortLexLeqPartialPerm(f, g); +true +gap> ShortLexLeqPartialPerm(g, f); +false +gap> ShortLexLeqPartialPerm(g, g); +false +gap> ShortLexLeqPartialPerm(EmptyPartialPerm(), g); +true +gap> ShortLexLeqPartialPerm(g, EmptyPartialPerm()); +false +gap> ShortLexLeqPartialPerm(EmptyPartialPerm(), f); +true +gap> ShortLexLeqPartialPerm(f, EmptyPartialPerm()); +false +gap> g := PartialPerm([2, 4, 5], [5, 3, 7]);; +gap> ShortLexLeqPartialPerm(f, g); +true +gap> ShortLexLeqPartialPerm(g, f); +false +gap> g := PartialPerm([1, 2, 4], [5, 3, 7]);; +gap> ShortLexLeqPartialPerm(f, g); +false +gap> ShortLexLeqPartialPerm(g, f); +true +gap> ShortLexLeqPartialPerm(g, g); +false +gap> ShortLexLeqPartialPerm(g ^ -1, g); +false +gap> ShortLexLeqPartialPerm(g, g ^ -1); +true +gap> ShortLexLeqPartialPerm(f ^ -1, f); +false +gap> ShortLexLeqPartialPerm(f, f ^ -1); +true +gap> g := PartialPerm([1, 2, 3], [5, 3, 7]);; +gap> ShortLexLeqPartialPerm(f, g); +false +gap> ShortLexLeqPartialPerm(g, f); +true +gap> ShortLexLeqPartialPerm(f, g); +false +gap> f := PartialPerm([1, 2, 3], [5, 3, 8]);; +gap> g := PartialPerm([1, 2, 3], [5, 3, 7]);; +gap> ShortLexLeqPartialPerm(f, g); +false +gap> ShortLexLeqPartialPerm(g, f); +true +gap> f := PartialPerm([1], [70000]); +[1,70000] +gap> g := PartialPerm([2], [70000]); +[2,70000] +gap> ShortLexLeqPartialPerm(f, g); +true +gap> ShortLexLeqPartialPerm(g, f); +false +gap> f := PartialPerm([1], [70000]); +[1,70000] +gap> g := PartialPerm([1], [70001]); +[1,70001] +gap> ShortLexLeqPartialPerm(f, g); +true +gap> ShortLexLeqPartialPerm(g, f); +false +gap> f := PartialPerm([1, 2, 3], [70000, 3, 4]);; +gap> f := f * f ^ -1; + +gap> ShortLexLeqPartialPerm(f, PartialPerm([1, 2, 3])); +false +gap> ShortLexLeqPartialPerm(PartialPerm([1, 2, 3]), f); +false +gap> f := PartialPermNC([65536]) * PartialPermNC([2, 65536], [70000, 1]); + +gap> ShortLexLeqPartialPerm(f, PartialPerm([1])); +false +gap> ShortLexLeqPartialPerm(PartialPerm([1]), f); +false +gap> ShortLexLeqPartialPerm(1, f); +Error, usage: the arguments must be partial perms, +gap> ShortLexLeqPartialPerm(f, 1); +Error, usage: the arguments must be partial perms, +gap> ShortLexLeqPartialPerm(2, 1); +Error, usage: the arguments must be partial perms, + +# CodegreeOfPartialPerm +gap> CodegreeOfPartialPerm(ID_PPERM2); +1 +gap> CodegreeOfPartialPerm(ID_PPERM4); +1 +gap> DomainOfPartialPerm(EMPTY_PPERM4); +[ ] +gap> ImageSetOfPartialPerm(EMPTY_PPERM4); +[ ] +gap> ImageListOfPartialPerm(EMPTY_PPERM4); +[ ] +gap> NaturalLeqPartialPerm(EMPTY_PPERM4, ID_PPERM4); +true +gap> ShortLexLeqPartialPerm(EMPTY_PPERM4, ID_PPERM4); +true +gap> ShortLexLeqPartialPerm(ID_PPERM4, EMPTY_PPERM4); +false +gap> () * EmptyPartialPerm(); + +gap> (1, 65537) * EMPTY_PPERM4; + + +# ProdPPerm42 +gap> PartialPermNC([65536]) * EmptyPartialPerm(); + + +# ProdPPerm44 +gap> PartialPermNC([65536]) * EMPTY_PPERM4; + +gap> EMPTY_PPERM4 * PartialPermNC([65536]); + + +# ProdPPerm42 +gap> PartialPermNC([1]) * EMPTY_PPERM4; + +gap> EMPTY_PPERM4 * PartialPermNC([1]); + + +# PowIntPPerm2 +gap> (-1) ^ PartialPerm([1]); +Error, usage: the first argument should be a positive integer, +gap> "a" ^ PartialPerm([1]); +Error, no method found! For debugging hints type ?Recovery from NoMethodFound +Error, no 1st choice method found for `^' on 2 arguments +gap> (2 ^ 100) ^ PartialPerm([1]); +Error, no method found! For debugging hints type ?Recovery from NoMethodFound +Error, no 1st choice method found for `^' on 2 arguments + +# PowIntPPerm2 +gap> (-1) ^ PPerm4([1]); +Error, usage: the first argument should be a positive integer, +gap> "a" ^ PPerm4([1]); +Error, no method found! For debugging hints type ?Recovery from NoMethodFound +Error, no 1st choice method found for `^' on 2 arguments +gap> (2 ^ 100) ^ PPerm4([1]); +Error, no method found! For debugging hints type ?Recovery from NoMethodFound +Error, no 1st choice method found for `^' on 2 arguments + +# LQuoPerm4PPerm2, Case 1 of 4, deg(p) f:=PartialPermNC( [ 2, 3, 4, 5, 6, 7, 8, 10, 11, 12, 14, 15, 17, 19 ], +> [ 19, 7, 17, 14, 8, 5, 3, 18, 15, 13, 2, 12, 10, 20 ] );; +gap> f:=JoinOfPartialPerms(f, PartialPermNC([100000], [1]));; +gap> p:=(17, 70000);; +gap> LQUO(p, f)=p^-1*f; +true + +# LQuoPerm4PPerm2, Case 2 of 4, deg(p) f:=PartialPermNC( [ 2, 3, 4, 5, 6, 7, 8, 10, 11, 12, 14, 15, 17, 19 ], +> [ 19, 7, 17, 14, 8, 5, 3, 18, 15, 13, 2, 12, 10, 20 ] );; +gap> f:=JoinOfPartialPerms(f, PartialPermNC([100000], [1]));; +gap> DomainOfPartialPerm(f);; +gap> p:=(17, 70000);; +gap> LQUO(p, f)=p^-1*f; +true + +# LQuoPerm4PPerm2, Case 3 of 4, deg(p)>=deg(f), dom(f) unknown +gap> f:=PartialPermNC( [ 2, 3, 4, 5, 6, 7, 8, 10, 11, 12, 14, 15, 17, 19 ], +> [ 19, 7, 17, 14, 8, 5, 3, 18, 15, 13, 2, 12, 10, 20 ] );; +gap> f:=JoinOfPartialPerms(f, PartialPermNC([10000], [1]));; +gap> p:=(17, 70000);; +gap> LQUO(p, f)=p^-1*f; +true + +# LQuoPerm4PPerm2, Case 4 of 4, deg(p)>=deg(f), dom(f) known +gap> f:=PartialPermNC( [ 2, 3, 4, 5, 6, 7, 8, 10, 11, 12, 14, 15, 17, 19 ], +> [ 19, 7, 17, 14, 8, 5, 3, 18, 15, 13, 2, 12, 10, 20 ] );; +gap> f:=JoinOfPartialPerms(f, PartialPermNC([10000], [1]));; +gap> DomainOfPartialPerm(f);; +gap> p:=(17, 70000);; +gap> LQUO(p, f)=p^-1*f; +true + +# QuoPPerm2Perm2, Case 1 of 6: codeg(f)<=deg(p), domain known +gap> f:=PartialPerm( [ 1, 2, 3, 6, 10 ], [ 2, 7, 8, 10, 6 ] );; DomainOfPartialPerm(f);; +gap> p:=(7, 100);; +gap> g:=f/p;; +gap> OnTuples(ImageListOfPartialPerm(f), p^-1)=ImageListOfPartialPerm(g); +true +gap> CodegreeOfPartialPerm(g)=Maximum(ImageSetOfPartialPerm(g)); +true +gap> f/p=f*p^-1; +true + +# QuoPPerm2Perm2, Case 2 of 6: codeg(f)<=deg(p), domain not known +gap> f:=PartialPerm( [ 1, 2, 3, 6, 10 ], [ 2, 7, 8, 10, 6 ] );; +gap> p:=(7, 100);; +gap> g:=f/p;; +gap> DomainOfPartialPerm(g)=DomainOfPartialPerm(f); +true +gap> OnTuples(ImageListOfPartialPerm(f), p^-1)=ImageListOfPartialPerm(g); +true +gap> f/p=f*p^-1; +true +gap> f:=PartialPerm( [ 1, 2, 3, 6, 10 ], [ 2, 7, 8, 10, 6 ] );; +gap> p:=(7, 100);; +gap> g:=f/p;; +gap> DomainOfPartialPerm(g)=DomainOfPartialPerm(f); +true +gap> OnTuples(ImageListOfPartialPerm(f), p^-1)=ImageListOfPartialPerm(g); +true +gap> CodegreeOfPartialPerm(g)=Maximum(ImageSetOfPartialPerm(g)); +true +gap> f/p=f*p^-1; +true + +# QuoPPerm2Perm2, Case 3 of 6: codeg(f)>deg(p), domain known +gap> f:=PartialPerm([1, 100], [100, 2]);; DomainOfPartialPerm(f);; +gap> p:=(7, 10);; +gap> g:=f/p;; +gap> OnTuples(ImageListOfPartialPerm(f), p^-1)=ImageListOfPartialPerm(g); +true +gap> DomainOfPartialPerm(g)=DomainOfPartialPerm(f); +true +gap> CodegreeOfPartialPerm(g)=Maximum(ImageSetOfPartialPerm(g)); +true +gap> f/p=f*p^-1; +true +gap> f:=PartialPerm([1, 65535], [65535, 2]);; +gap> p:=(17, 10000);; +gap> g:=f/p;; +gap> DomainOfPartialPerm(g)=DomainOfPartialPerm(f); +true +gap> OnTuples(ImageListOfPartialPerm(f), p^-1)=ImageListOfPartialPerm(g); +true +gap> CodegreeOfPartialPerm(g)=Maximum(ImageSetOfPartialPerm(g)); +true +gap> f/p=f*p^-1; +true + +# QuoPPerm2Perm2, Case 4 of 6: codeg(f)>deg(p), domain not known +gap> f:=PartialPerm([1, 100], [100, 2]);; +gap> p:=(7, 10);; +gap> g:=f/p;; +gap> DomainOfPartialPerm(g)=DomainOfPartialPerm(f); +true +gap> OnTuples(ImageListOfPartialPerm(f), p^-1)=ImageListOfPartialPerm(g); +true +gap> CodegreeOfPartialPerm(g)=Maximum(ImageSetOfPartialPerm(g)); +true +gap> f/p=f*p^-1; +true +gap> f:=PartialPerm([1, 10000], [10000, 2]);; +gap> p:=(13, 1000);; +gap> g:=f/p;; +gap> DomainOfPartialPerm(g)=DomainOfPartialPerm(f); +true +gap> OnTuples(ImageListOfPartialPerm(f), p^-1)=ImageListOfPartialPerm(g); +true +gap> CodegreeOfPartialPerm(g)=Maximum(ImageSetOfPartialPerm(g)); +true +gap> f/p=f*p^-1; +true + +# QuoPPerm2Perm2, Case 5 of 6: deg(p)=65536, domain not known +gap> p:=(1,65536,123);; +gap> f:=PartialPerm([1, 10000], [10000, 2]);; +gap> g:=f/p;; +gap> DomainOfPartialPerm(g)=DomainOfPartialPerm(f); +true +gap> OnTuples(ImageListOfPartialPerm(f), p^-1)=ImageListOfPartialPerm(g); +true +gap> CodegreeOfPartialPerm(g)=Maximum(ImageSetOfPartialPerm(g)); +true +gap> f/p=f*p^-1; +true + +# QuoPPerm2Perm2, Case 6 of 6: deg(p)=65536, domain known +gap> f:=PartialPerm([1, 10000], [10000, 2]);; DomainOfPartialPerm(f);; +gap> p:=(1,65536,123);; +gap> g:=f/p;; +gap> DomainOfPartialPerm(g)=DomainOfPartialPerm(f); +true +gap> OnTuples(ImageListOfPartialPerm(f), p^-1)=ImageListOfPartialPerm(g); +true +gap> CodegreeOfPartialPerm(g)=Maximum(ImageSetOfPartialPerm(g)); +true +gap> f/p=f*p^-1; +true + +# QuoPPerm2Perm4, Case 1 of 2: domain known +gap> f:=PartialPerm( [ 1, 2, 3, 6, 10 ], [ 2, 7, 8, 10, 6 ] );; DomainOfPartialPerm(f);; +gap> p:=(1,100000,123);; +gap> g:=f/p;; +gap> DomainOfPartialPerm(g)=DomainOfPartialPerm(f); +true +gap> OnTuples(ImageListOfPartialPerm(f), p^-1)=ImageListOfPartialPerm(g); +true +gap> CodegreeOfPartialPerm(g)=Maximum(ImageSetOfPartialPerm(g)); +true +gap> f/p=f*p^-1; +true + +# QuoPPerm2Perm4, Case 2 of 2: domain not known +gap> f:=PartialPerm([1, 1000], [1000, 2]);; +gap> p:=(1,100000,123);; +gap> g:=f/p;; +gap> OnTuples(ImageListOfPartialPerm(f), p^-1)=ImageListOfPartialPerm(g); +true +gap> CodegreeOfPartialPerm(g)=Maximum(ImageSetOfPartialPerm(g)); +true +gap> DomainOfPartialPerm(g)=DomainOfPartialPerm(f); +true +gap> f/p=f*p^-1; +true + +# QuoPPerm4Perm2, Case 1 of 2: domain not known +gap> f:=PartialPermNC(Concatenation(List([1..65535], x-> 0), [1,100001]));; +gap> p:=(1,2,4);; +gap> g:=f/p; +[65536,4][65537,100001] +gap> OnTuples(ImageListOfPartialPerm(f), p^-1)=ImageListOfPartialPerm(g); +true +gap> CodegreeOfPartialPerm(g)=Maximum(ImageSetOfPartialPerm(g)); +true +gap> DomainOfPartialPerm(g)=DomainOfPartialPerm(f); +true +gap> f/p=f*p^-1; +true + +# QuoPPerm4Perm2, Case 2 of 2: domain known +gap> f:=PartialPermNC(Concatenation(List([1..65535], x-> 0), [1,100001])); +[65536,1][65537,100001] +gap> p:=(1,2,4);; +gap> g:=f/p; +[65536,4][65537,100001] +gap> OnTuples(ImageListOfPartialPerm(f), p^-1)=ImageListOfPartialPerm(g); +true +gap> CodegreeOfPartialPerm(g)=Maximum(ImageSetOfPartialPerm(g)); +true +gap> DomainOfPartialPerm(g)=DomainOfPartialPerm(f); +true +gap> f/p=f*p^-1; +true + +# QuoPPerm24, Case 1 of 4, dom(f) known, dom(g) known +gap> f:=PartialPerm( [ 1, 2, 3, 4, 5, 6, 7, 9, 11, 12, 15, 16, 19 ], +> [ 2, 4, 11, 1, 20, 10, 15, 16, 5, 3, 6, 12, 9 ] );; DomainOfPartialPerm(f);; +gap> g:=PartialPerm([1, 100000], [100000, 2]);; DomainOfPartialPerm(g);; +gap> f/g=f*g^-1; +true + +# QuoPPerm24, Case 2 of 4, dom(f) known, dom(g) unknown +gap> f:=PartialPerm( [ 1, 2, 3, 4, 5, 6, 7, 9, 11, 12, 15, 16, 19 ], +> [ 2, 4, 11, 1, 20, 10, 15, 16, 5, 3, 6, 12, 9 ] );; DomainOfPartialPerm(f);; +gap> g:=PartialPerm([1, 100000], [100000, 2]);; +gap> f/g=f*g^-1; +true + +# QuoPPerm24, Case 3 of 4, dom(f) unknown, dom(g) known +gap> f:=PartialPerm( [ 1, 2, 3, 4, 5, 6, 7, 9, 11, 12, 15, 16, 19 ], +> [ 2, 4, 11, 1, 20, 10, 15, 16, 5, 3, 6, 12, 9 ] );; +gap> g:=PartialPerm([1, 100000], [100000, 2]);; DomainOfPartialPerm(g);; +gap> f/g=f*g^-1; +true + +# QuoPPerm24, Case 4 of 4, dom(f) unknown, dom(g) unknown +gap> f:=PartialPerm( [ 1, 2, 3, 4, 5, 6, 7, 9, 11, 12, 15, 16, 19 ], +> [ 2, 4, 11, 1, 20, 10, 15, 16, 5, 3, 6, 12, 9 ] );; +gap> g:=PartialPerm([1, 100000], [100000, 2]);; +gap> f/g=f*g^-1; +true + +# QuoPPerm42, Case 1 of 4, dom(f) known, dom(g) known +gap> f:=PartialPerm([1, 100000], [100000, 2]);; DomainOfPartialPerm(f);; +gap> g:=PartialPerm( [ 1, 2, 3, 4, 5, 6, 7, 9, 11, 12, 15, 16, 19 ], +> [ 2, 4, 11, 1, 20, 10, 15, 16, 5, 3, 6, 12, 9 ] );; DomainOfPartialPerm(g);; +gap> f/g=f*g^-1; +true + +# QuoPPerm42, Case 2 of 4, dom(f) known, dom(g) unknown +gap> f:=PartialPerm([1, 100000], [100000, 2]);; DomainOfPartialPerm(f);; +gap> g:=PartialPerm( [ 1, 2, 3, 4, 5, 6, 7, 9, 11, 12, 15, 16, 19 ], +> [ 2, 4, 11, 1, 20, 10, 15, 16, 5, 3, 6, 12, 9 ] );; +gap> f/g=f*g^-1; +true + +# QuoPPerm42, Case 3 of 4, dom(f) unknown, dom(g) known +gap> f:=PartialPerm([1, 100000], [100000, 2]);; +gap> g:=PartialPerm( [ 1, 2, 3, 4, 5, 6, 7, 9, 11, 12, 15, 16, 19 ], +> [ 2, 4, 11, 1, 20, 10, 15, 16, 5, 3, 6, 12, 9 ] );; DomainOfPartialPerm(g);; +gap> f/g=f*g^-1; +true + +# QuoPPerm42, Case 4 of 4, dom(f) unknown, dom(g) unknown +gap> f:=PartialPerm([1, 100000], [100000, 2]);; +gap> g:=PartialPerm( [ 1, 2, 3, 4, 5, 6, 7, 9, 11, 12, 15, 16, 19 ], +> [ 2, 4, 11, 1, 20, 10, 15, 16, 5, 3, 6, 12, 9 ] );; +gap> f/g=f*g^-1; +true + +# QuoPPerm44, Case 1 of 4, dom(f) known, dom(g) known +gap> f:=PartialPerm([1, 100000], [100000, 2]);; DomainOfPartialPerm(f);; +gap> g:=PartialPerm([1, 100000], [100000, 2]);; DomainOfPartialPerm(g);; +gap> f/g=f*g^-1; +true + +# QuoPPerm44, Case 2 of 4, dom(f) known, dom(g) unknown +gap> f:=PartialPerm([1, 100000], [100000, 2]);; DomainOfPartialPerm(f);; +gap> g:=PartialPerm([1, 100000], [100000, 2]);; +gap> f/g=f*g^-1; +true + +# QuoPPerm44, Case 3 of 4, dom(f) unknown, dom(g) known +gap> f:=PartialPerm([1, 100000], [100000, 2]);; +gap> g:=PartialPerm([1, 100000], [100000, 2]);; DomainOfPartialPerm(g);; +gap> f/g=f*g^-1; +true + +# QuoPPerm44, Case 4 of 4, dom(f) unknown, dom(g) unknown +gap> f:=PartialPerm([1, 100000], [100000, 2]);; +gap> g:=PartialPerm([1, 100000], [100000, 2]);; +gap> f/g=f*g^-1; +true + +# LQuoPerm2PPerm4, Case 1 of 4, deg(p) f:=PartialPerm([1, 65536], [65536, 2]);; +gap> p:=(17, 60000);; +gap> LQUO(p, f)=p^-1*f; +true + +# LQuoPerm2PPerm4, Case 2 of 4, deg(p) f:=PartialPerm([1, 65536], [65536, 2]);; DomainOfPartialPerm(f);; +gap> p:=(17, 60000);; +gap> LQUO(p, f)=p^-1*f; +true + +# LQuoPerm2PPerm4, Case 3 of 4, deg(p)>=deg(f), dom(f) unknown +gap> f:=PartialPerm([1, 65536], [65536, 2]);; +gap> p:=(17, 70000);; +gap> LQUO(p, f)=p^-1*f; +true + +# LQuoPerm2PPerm4, Case 4 of 4, deg(p)>=deg(f), dom(f) known +gap> f:=PartialPerm([1, 65536], [65536, 2]);; DomainOfPartialPerm(f);; +gap> p:=(17, 60000);; +gap> LQUO(p, f)=p^-1*f; +true + +# LQuoPerm4PPerm4, Case 1 of 4, deg(p) f:=PartialPerm([1, 70000], [70000, 2]);; +gap> p:=(17, 66000);; +gap> LQUO(p, f)=p^-1*f; +true + +# LQuoPerm4PPerm4, Case 2 of 4, deg(p) f:=PartialPerm([1, 70000], [70000, 2]);; +gap> DomainOfPartialPerm(f);; +gap> p:=(17, 66000);; +gap> LQUO(p, f)=p^-1*f; +true + +# LQuoPerm4PPerm4, Case 3 of 4, deg(p)>=deg(f), dom(f) unknown +gap> f:=PartialPerm([1, 66000], [66000, 2]);; +gap> p:=(17, 70000);; +gap> LQUO(p, f)=p^-1*f; +true + +# LQuoPerm4PPerm4, Case 4 of 4, deg(p)>=deg(f), dom(f) known +gap> f:=PartialPerm([1, 66000], [66000, 2]);; +gap> DomainOfPartialPerm(f);; +gap> p:=(17, 70000);; +gap> LQUO(p, f)=p^-1*f; +true + +# LQuoPPerm24, Case 1 of 3, dom(g) unknown +gap> f:=PartialPerm([1, 100], [100, 2]);; +gap> g:=PartialPerm([1, 100000], [100000, 2]);; +gap> LQUO(f, g)=f^-1*g; +true + +# LQuoPPerm24, Case 2 of 3, dom(g) known, deg(g)>deg(f) +gap> f:=PartialPerm([1, 100], [100, 2]);; +gap> g:=PartialPerm([1, 100000], [100000, 2]);; DomainOfPartialPerm(g);; +gap> LQUO(f, g)=f^-1*g; +true + +# LQuoPPerm24, Case 3 of 3, dom(g) known, deg(g)<=deg(f) +gap> f:=PartialPerm([1, 9000], [9000, 2]);; +gap> g:=PartialPerm([1, 100], [100, 2]);; +gap> g:=JoinOfPartialPerms(g, PartialPermNC([101], [100000]));; +gap> DomainOfPartialPerm(g);; +gap> LQUO(f, g)=f^-1*g; +true + +# LQuoPPerm42, Case 1 of 3, dom(g) unknown +gap> f:=PartialPerm([1, 100000], [100000, 2]);; +gap> g:=PartialPerm([1, 100], [100, 2]);; +gap> LQUO(f, g)=f^-1*g; +true + +# LQuoPPerm42, Case 2 of 3, dom(g) known, deg(g)>deg(f) +gap> f:=PartialPerm([1, 100000], [100000, 2]);; +gap> g:=PartialPerm([1, 100], [100, 2]);; +gap> g:=JoinOfPartialPerms(g, PartialPermNC([100001],[101]));; +gap> DomainOfPartialPerm(g);; +gap> LQUO(f, g)=f^-1*g; +true + +# LQuoPPerm42, Case 3 of 3, dom(g) known, deg(g)<=deg(f) +gap> f:=PartialPerm([1, 100000], [100000, 2]);; +gap> g:=PartialPerm([1, 100], [100, 2]);; DomainOfPartialPerm(g);; +gap> LQUO(f, g)=f^-1*g; +true + +# LQuoPPerm44, Case 1 of 3, dom(g) unknown +gap> f:=PartialPerm([1, 65536], [65536, 2]);; +gap> g:=PartialPerm([1, 65536], [65536, 2]);; +gap> LQUO(f, g)=f^-1*g; +true + +# LQuoPPerm44, Case 2 of 3, dom(g) known, deg(g)>deg(f) +gap> f:=PartialPerm([1, 65536], [65536, 2]);; +gap> g:=PartialPerm([1, 66000], [66000, 2]);; DomainOfPartialPerm(g);; +gap> LQUO(f, g)=f^-1*g; +true + +# LQuoPPerm44, Case 3 of 3, dom(g) known, deg(g)<=deg(f) +gap> f:=PartialPerm([1, 66000], [66000, 2]);; +gap> g:=PartialPerm([1, 66553], [66553, 2]);; DomainOfPartialPerm(g);; +gap> LQUO(f, g)=f^-1*g; +true + +# OnSets and OnTuples +gap> OnSets([2 ^ 60], PartialPerm([1, 2, 3, 4, 5, 7], [6, 4, 5, 3, 8, 2])); +Error, must be a list of small integers +gap> OnTuples([2 ^ 60], PartialPerm([1, 2, 3, 4, 5, 7], [6, 4, 5, 3, 8, 2])); +Error, must be a list of small integers +gap> OnSets(["a"], PartialPerm([1, 2, 3, 4, 5, 7], [6, 4, 5, 3, 8, 2])); +Error, must be a list of small integers +gap> OnTuples(["a"], PartialPerm([1, 2, 3, 4, 5, 7], [6, 4, 5, 3, 8, 2])); +Error, must be a list of small integers +gap> OnSets([2 ^ 60], PPerm4([1, 2, 3, 4, 5, 7], [6, 4, 5, 3, 8, 2])); +Error, must be a list of small integers +gap> OnTuples([2 ^ 60], PPerm4([1, 2, 3, 4, 5, 7], [6, 4, 5, 3, 8, 2])); +Error, must be a list of small integers +gap> OnSets(["a"], PPerm4([1, 2, 3, 4, 5, 7], [6, 4, 5, 3, 8, 2])); +Error, must be a list of small integers +gap> OnTuples(["a"], PPerm4([1, 2, 3, 4, 5, 7], [6, 4, 5, 3, 8, 2])); +Error, must be a list of small integers + # gap> SetUserPreference("PartialPermDisplayLimit", display);; gap> SetUserPreference("NotationForPartialPerm", notationpp);; From 4e425fad8e0dec63af8d1030f2faf6be5cba48a2 Mon Sep 17 00:00:00 2001 From: James Mitchell Date: Thu, 29 Mar 2018 20:53:33 +0200 Subject: [PATCH 7/9] pperm: GAP code formatted --- lib/pperm.gd | 15 +- lib/pperm.gi | 636 ++++++++++++++++++++++++--------------------------- 2 files changed, 309 insertions(+), 342 deletions(-) diff --git a/lib/pperm.gd b/lib/pperm.gd index e2a882887c..13d5c5a79c 100644 --- a/lib/pperm.gd +++ b/lib/pperm.gd @@ -8,14 +8,13 @@ ############################################################################## ### - DeclareUserPreference(rec( - name:=["PartialPermDisplayLimit", "NotationForPartialPerms"], - description:=["options for the display of partial perms"], - default:=[100, "component"], - check:=function(a, b) - return IsPosInt(a) - or (IsString(b) and b in ["component", "domainimage", "input"]); + name := ["PartialPermDisplayLimit", "NotationForPartialPerms"], + description := ["options for the display of partial perms"], + default := [100, "component"], + check := function(a, b) + return IsPosInt(a) + or (IsString(b) and b in ["component", "domainimage", "input"]); end)); DeclareGlobalFunction("ComponentStringOfPartialPerm"); @@ -52,7 +51,7 @@ DeclareAttribute("SmallestImageOfMovedPoint", IsPartialPerm); DeclareAttribute("SmallestImageOfMovedPoint", IsPartialPermCollection); # operations -DeclareOperation("PreImagePartialPerm",[IsPartialPerm, IsPosInt]); +DeclareOperation("PreImagePartialPerm", [IsPartialPerm, IsPosInt]); DeclareOperation("ComponentPartialPermInt", [IsPartialPerm, IsPosInt]); DeclareOperation("AsPartialPerm", [IsAssociativeElement, IsList]); DeclareOperation("AsPartialPerm", [IsAssociativeElement]); diff --git a/lib/pperm.gi b/lib/pperm.gi index 6d751a2917..12a02ff3df 100644 --- a/lib/pperm.gi +++ b/lib/pperm.gi @@ -11,8 +11,13 @@ InstallMethod(IsGeneratorsOfMagmaWithInverses, "for a partial perm collection", [IsPartialPermCollection], -coll-> ForAll(coll, x-> DomainOfPartialPerm(x)=DomainOfPartialPerm(coll[1]) and -ImageSetOfPartialPerm(x)=DomainOfPartialPerm(coll[1]))); +function(coll) + return ForAll(coll, x -> DomainOfPartialPerm(x) + = DomainOfPartialPerm(coll[1]) + and + ImageSetOfPartialPerm(x) + = DomainOfPartialPerm(coll[1])); +end); # attributes @@ -40,51 +45,53 @@ InstallMethod(NrComponentsOfPartialPerm, "for a partial perm", InstallMethod(ComponentsOfPartialPerm, "for a partial perm", [IsPartialPerm], COMPONENTS_PPERM); -InstallMethod(IsIdempotent, "for a partial perm", +InstallMethod(IsIdempotent, "for a partial perm", [IsPartialPerm], IS_IDEM_PPERM); -InstallMethod(IsOne, "for a partial perm", +InstallMethod(IsOne, "for a partial perm", [IsPartialPerm], IS_IDEM_PPERM); -InstallMethod(FixedPointsOfPartialPerm, "for a partial perm", +InstallMethod(FixedPointsOfPartialPerm, "for a partial perm", [IsPartialPerm], FIXED_PTS_PPERM); -InstallMethod(NrFixedPoints, "for a partial perm", +InstallMethod(NrFixedPoints, "for a partial perm", [IsPartialPerm], NR_FIXED_PTS_PPERM); -InstallMethod(MovedPoints, "for a partial perm", +InstallMethod(MovedPoints, "for a partial perm", [IsPartialPerm], MOVED_PTS_PPERM); -InstallMethod(NrMovedPoints, "for a partial perm", +InstallMethod(NrMovedPoints, "for a partial perm", [IsPartialPerm], NR_MOVED_PTS_PPERM); -InstallMethod(LargestMovedPoint, "for a partial perm", +InstallMethod(LargestMovedPoint, "for a partial perm", [IsPartialPerm], LARGEST_MOVED_PT_PPERM); InstallMethod(LargestImageOfMovedPoint, "for a partial perm", [IsPartialPerm], function(f) local max, i; - - if IsOne(f) then + + if IsOne(f) then return 0; fi; - - max:=0; - for i in [SmallestMovedPoint(f)..LargestMovedPoint(f)] do - if i^f>max then max:=i^f; fi; + + max := 0; + for i in [SmallestMovedPoint(f) .. LargestMovedPoint(f)] do + if i ^ f > max then + max := i ^ f; + fi; od; return max; end); -InstallMethod(SmallestMovedPoint, "for a partial perm", -[IsPartialPerm], +InstallMethod(SmallestMovedPoint, "for a partial perm", +[IsPartialPerm], function(f) local m; m := SMALLEST_MOVED_PT_PPERM(f); - if m = fail then + if m = fail then return infinity; - else + else return m; fi; end); @@ -93,23 +100,25 @@ InstallMethod(SmallestImageOfMovedPoint, "for a partial perm", [IsPartialPerm], function(f) local min, j, i; - - if IsOne(f) then + + if IsOne(f) then return infinity; fi; - min:=CoDegreeOfPartialPerm(f); - for i in [SmallestMovedPoint(f)..LargestMovedPoint(f)] do - j:=i^f; - if j>0 and j 0 and j < min then + min := j; + fi; od; return min; end); -InstallMethod(LeftOne, "for a partial perm", +InstallMethod(LeftOne, "for a partial perm", [IsPartialPerm], LEFT_ONE_PPERM); -InstallMethod(RightOne, "for a partial perm", +InstallMethod(RightOne, "for a partial perm", [IsPartialPerm], RIGHT_ONE_PPERM); # operations @@ -118,65 +127,62 @@ InstallMethod(PreImagePartialPerm, "for a partial perm and positive integer", [IsPartialPerm, IsPosInt and IsSmallIntRep], PREIMAGE_PPERM_INT); -# - InstallMethod(ComponentPartialPermInt, "for a partial perm and positive integer", [IsPartialPerm, IsPosInt and IsSmallIntRep], COMPONENT_PPERM_INT); -# - -InstallGlobalFunction(JoinOfPartialPerms, +InstallGlobalFunction(JoinOfPartialPerms, function(arg) local join, i; - if IsPartialPermCollection(arg[1]) then + if IsPartialPermCollection(arg[1]) then return CallFuncList(JoinOfPartialPerms, arg[1]); - elif not IsPartialPermCollection(arg) then - ErrorNoReturn("usage: the argument should be a collection of partial perms,"); + elif not IsPartialPermCollection(arg) then + ErrorNoReturn("usage: the argument should be a collection of partial ", + "perms,"); fi; - join:=arg[1]; i:=1; - while ifail do - i:=i+1; - join:=JOIN_PPERMS(join, arg[i]); - od; + join := arg[1]; + i := 1; + while i < Length(arg) and join <> fail do + i := i + 1; + join := JOIN_PPERMS(join, arg[i]); + od; return join; end); -# - -InstallGlobalFunction(JoinOfIdempotentPartialPermsNC, +InstallGlobalFunction(JoinOfIdempotentPartialPermsNC, function(arg) local join, i; - if IsPartialPermCollection(arg[1]) then + if IsPartialPermCollection(arg[1]) then return CallFuncList(JoinOfIdempotentPartialPermsNC, arg[1]); - elif not IsPartialPermCollection(arg) then - ErrorNoReturn("usage: the argument should be a collection of partial perms,"); + elif not IsPartialPermCollection(arg) then + ErrorNoReturn("usage: the argument should be a collection of partial ", + "perms,"); fi; - join:=arg[1]; i:=1; - while i IsSmallIntRep(x) and IsPosInt(x)) then - ErrorNoReturn("usage: the second argument must be a set of positive integers,"); + + if not IsSSortedList(list) + or not ForAll(list, x -> IsSmallIntRep(x) and IsPosInt(x)) then + ErrorNoReturn("usage: the second argument must be a set of positive ", + "integers,"); fi; return AS_PPERM_PERM(p, list); end); -# - InstallMethod(AsPartialPerm, "for a perm", -[IsPerm], p-> AS_PPERM_PERM(p, [1..LargestMovedPoint(p)])); - -# +[IsPerm], p -> AS_PPERM_PERM(p, [1 .. LargestMovedPoint(p)])); InstallMethod(AsPartialPerm, "for a perm and pos int", -[IsPerm, IsPosInt and IsSmallIntRep], +[IsPerm, IsPosInt and IsSmallIntRep], function(p, n) - return AS_PPERM_PERM(p, [1..n]); + return AS_PPERM_PERM(p, [1 .. n]); end); -# - InstallMethod(AsPartialPerm, "for a perm and zero", -[IsPerm, IsZeroCyc], +[IsPerm, IsZeroCyc], function(p, n) return PartialPerm([]); end); @@ -226,287 +225,260 @@ end); # c method? JDM InstallMethod(AsPartialPerm, "for a transformation and list", -[IsTransformation, IsList], +[IsTransformation, IsList], function(f, list) - + if not IsSSortedList(list) - or not ForAll(list, x -> IsSmallIntRep(x) and IsPosInt(x)) then + or not ForAll(list, x -> IsSmallIntRep(x) and IsPosInt(x)) then ErrorNoReturn("usage: the second argument must be a set of positive ", - "integers,"); - elif not IsInjectiveListTrans(list, f) then + "integers,"); + elif not IsInjectiveListTrans(list, f) then ErrorNoReturn("usage: the first argument must be injective on the ", "second,"); fi; - return PartialPermNC(list, OnTuples(list, f)); + return PartialPermNC(list, OnTuples(list, f)); end); -# - InstallMethod(AsPartialPerm, "for a transformation and positive int", -[IsTransformation, IsPosInt and IsSmallIntRep], +[IsTransformation, IsPosInt and IsSmallIntRep], function(f, n) - return AsPartialPerm(f, [1..n]); + return AsPartialPerm(f, [1 .. n]); end); -# n is image of undefined points +# n is image of undefined points InstallMethod(AsTransformation, "for a partial perm and positive integer", [IsPartialPerm, IsPosInt and IsSmallIntRep], function(f, n) local deg, out, i; - - if n0 and n^f<>n then - ErrorNoReturn("usage: the 2nd argument must not be a moved point of the 1st ", - "argument,"); + + if n < DegreeOfPartialPerm(f) and n ^ f <> 0 and n ^ f <> n then + ErrorNoReturn("usage: the 2nd argument must not be a moved ", + "point of the 1st argument,"); fi; - deg:=Maximum(n, LargestMovedPoint(f)+1, LargestImageOfMovedPoint(f)+1); - out:=ListWithIdenticalEntries(deg, n); + deg := Maximum(n, LargestMovedPoint(f) + 1, LargestImageOfMovedPoint(f) + 1); + out := ListWithIdenticalEntries(deg, n); for i in DomainOfPartialPerm(f) do - out[i]:=i^f; + out[i] := i ^ f; od; return Transformation(out); end); -# c method? JDM - InstallMethod(AsTransformation, "for a partial perm", [IsPartialPerm], function(f) - return AsTransformation(f, Maximum(LargestImageOfMovedPoint(f), - LargestMovedPoint(f))+1); + return AsTransformation(f, + Maximum(LargestImageOfMovedPoint(f), + LargestMovedPoint(f)) + 1); end); -# - InstallMethod(RestrictedPartialPerm, "for a partial perm", [IsPartialPerm, IsList], function(f, list) if not IsSSortedList(list) - or not ForAll(list, x -> IsSmallIntRep(x) and IsPosInt(x)) then - ErrorNoReturn("usage: the second argument must be a set of positive integers,"); + or not ForAll(list, x -> IsSmallIntRep(x) and IsPosInt(x)) then + ErrorNoReturn("usage: the second argument must be a set of positive ", + "integers,"); fi; return RESTRICTED_PPERM(f, list); end); -# - InstallMethod(AsPermutation, "for a partial perm", [IsPartialPerm], AS_PERM_PPERM); -# - InstallMethod(PermLeftQuoPartialPermNC, "for a partial perm and partial perm", [IsPartialPerm, IsPartialPerm], PERM_LEFT_QUO_PPERM_NC); -# - InstallMethod(PermLeftQuoPartialPerm, "for a partial perm and partial perm", -[IsPartialPerm, IsPartialPerm], +[IsPartialPerm, IsPartialPerm], function(f, g) - - if ImageSetOfPartialPerm(f)<>ImageSetOfPartialPerm(g) then - ErrorNoReturn("usage: the arguments must be partial perms with equal image sets,"); + + if ImageSetOfPartialPerm(f) <> ImageSetOfPartialPerm(g) then + ErrorNoReturn("usage: the arguments must be partial perms with equal ", + "image sets,"); fi; return PERM_LEFT_QUO_PPERM_NC(f, g); end); -# - InstallMethod(TrimPartialPerm, "for a partial perm", [IsPartialPerm], TRIM_PPERM); -# - InstallMethod(PartialPermOp, "for object, list, function", [IsObject, IsList, IsFunction], function(f, D, act) local perm, out, seen, i, j, pnt, new; - perm:=(); + perm := (); - if IsPlistRep(D) and Length(D)>2 and CanEasilySortElements(D[1]) then - if not IsSSortedList(D) then - D:=ShallowCopy(D); - perm:=Sortex(D); - D:=Immutable(D); + if IsPlistRep(D) and Length(D) > 2 and CanEasilySortElements(D[1]) then + if not IsSSortedList(D) then + D := ShallowCopy(D); + perm := Sortex(D); + D := Immutable(D); fi; fi; - - out:=EmptyPlist(Length(D)); - seen:=EmptyPlist(Length(D)); - i:=0; j:=Length(D); - - for pnt in D do - pnt:=act(pnt, f); - new:=PositionCanonical(D, pnt); - if not pnt in seen then + + out := EmptyPlist(Length(D)); + seen := EmptyPlist(Length(D)); + i := 0; + j := Length(D); + + for pnt in D do + pnt := act(pnt, f); + new := PositionCanonical(D, pnt); + if not pnt in seen then AddSet(seen, pnt); - if new<>fail then - i:=i+1; - out[i]:=new; + if new <> fail then + i := i + 1; + out[i] := new; else - i:=i+1; - j:=j+1; - out[i]:=j; + i := i + 1; + j := j + 1; + out[i] := j; fi; - else + else return fail; fi; od; - out:=PartialPerm([1..Length(D)], out); - - if not IsOne(perm) then - out:=out^perm; + out := PartialPerm([1 .. Length(D)], out); + + if not IsOne(perm) then + out := out ^ perm; fi; return out; end); -# - InstallMethod(PartialPermOp, "for an obj and list", -[IsObject, IsList], -function(obj, list) +[IsObject, IsList], +function(obj, list) return PartialPermOp(obj, list, OnPoints); end); -# - InstallMethod(PartialPermOp, "for an obj and domain", -[IsObject, IsDomain], -function(obj, D) +[IsObject, IsDomain], +function(obj, D) return PartialPermOp(obj, Enumerator(D), OnPoints); end); -# - InstallMethod(PartialPermOp, "for an obj, domain, and function", -[IsObject, IsDomain, IsFunction], -function(obj, D, func) +[IsObject, IsDomain, IsFunction], +function(obj, D, func) return PartialPermOp(obj, Enumerator(D), func); end); -# - InstallMethod(PartialPermOpNC, "for object, list, function", [IsObject, IsList, IsFunction], function(f, D, act) local perm, out, i, j, pnt, new; - perm:=(); + perm := (); - if IsPlistRep(D) and Length(D)>2 and CanEasilySortElements(D[1]) then - if not IsSSortedList(D) then - D:=ShallowCopy(D); - perm:=Sortex(D); - D:=Immutable(D); + if IsPlistRep(D) and Length(D) > 2 and CanEasilySortElements(D[1]) then + if not IsSSortedList(D) then + D := ShallowCopy(D); + perm := Sortex(D); + D := Immutable(D); fi; fi; - - out:=EmptyPlist(Length(D)); - i:=0; j:=Length(D); - - for pnt in D do - pnt:=act(pnt, f); - new:=PositionCanonical(D, pnt); - if new<>fail then - i:=i+1; - out[i]:=new; + + out := EmptyPlist(Length(D)); + i := 0; + j := Length(D); + + for pnt in D do + pnt := act(pnt, f); + new := PositionCanonical(D, pnt); + if new <> fail then + i := i + 1; + out[i] := new; else - i:=i+1; - j:=j+1; - out[i]:=j; + i := i + 1; + j := j + 1; + out[i] := j; fi; od; - out:=PartialPermNC([1..Length(D)], out); - - if not IsOne(perm) then - out:=out^perm; + out := PartialPermNC([1 .. Length(D)], out); + + if not IsOne(perm) then + out := out ^ perm; fi; return out; end); -# - InstallMethod(PartialPermOpNC, "for an obj and list", -[IsObject, IsList], -function(obj, list) +[IsObject, IsList], +function(obj, list) return PartialPermOpNC(obj, list, OnPoints); end); -# - InstallMethod(PartialPermOpNC, "for an obj and domain", -[IsObject, IsDomain], -function(obj, D) +[IsObject, IsDomain], +function(obj, D) return PartialPermOpNC(obj, Enumerator(D), OnPoints); end); -# - InstallMethod(PartialPermOpNC, "for an obj, domain, and function", -[IsObject, IsDomain, IsFunction], -function(obj, D, func) +[IsObject, IsDomain, IsFunction], +function(obj, D, func) return PartialPermOpNC(obj, Enumerator(D), func); end); - -# - -# creating partial perms +# Creating partial perms InstallGlobalFunction(RandomPartialPerm, function(arg) local source, min, max, n, out, seen, j, dom, img, out1, out2, i; - if Length(arg)=1 then - if IsSmallIntRep(arg[1]) and IsPosInt(arg[1]) then - source:=[1..arg[1]]; - min:=0; - max:=arg[1]; - elif IsCyclotomicCollection(arg[1]) and IsSSortedList(arg[1]) - and ForAll(arg[1], x -> IsSmallIntRep(x) and IsPosInt(x)) then - source:=arg[1]; - n:=Length(source); - min:=Minimum(source)-1; - max:=Maximum(source); + if Length(arg) = 1 then + if IsSmallIntRep(arg[1]) and IsPosInt(arg[1]) then + source := [1 .. arg[1]]; + min := 0; + max := arg[1]; + elif IsCyclotomicCollection(arg[1]) and IsSSortedList(arg[1]) + and ForAll(arg[1], x -> IsSmallIntRep(x) and IsPosInt(x)) then + source := arg[1]; + n := Length(source); + min := Minimum(source) - 1; + max := Maximum(source); else ErrorNoReturn("usage: the argument must be a positive integer, a set, ", - "or 2 sets, of positive integers,"); + "or 2 sets, of positive integers, "); fi; - out:=List([1..max], x-> 0); - seen:=BlistList([1..max], []); + out := List([1 .. max], x -> 0); + seen := BlistList([1 .. max], []); for i in source do - j:=Random(source); - if not seen[j-min] then - seen[j-min]:=true; - out[i]:=j; + j := Random(source); + if not seen[j - min] then + seen[j - min] := true; + out[i] := j; fi; od; return DensePartialPermNC(out); # for a domain and image - elif Length(arg)=2 and IsCyclotomicCollColl(arg) + elif Length(arg) = 2 and IsCyclotomicCollColl(arg) and ForAll(arg, IsSSortedList) - and ForAll(arg[1], x -> IsSmallIntRep(x) and IsPosInt(x)) - and ForAll(arg[2], x -> IsSmallIntRep(x) and IsPosInt(x)) then - - dom:=arg[1]; img:=arg[2]; - out1:=EmptyPlist(Length(dom)); - out2:=EmptyPlist(Length(dom)); - seen:=BlistList([1..Maximum(img)], []); - - for i in dom do - j:=Random(img); - if not seen[j] then - seen[j]:=true; + and ForAll(arg[1], x -> IsSmallIntRep(x) and IsPosInt(x)) + and ForAll(arg[2], x -> IsSmallIntRep(x) and IsPosInt(x)) then + + dom := arg[1]; + img := arg[2]; + out1 := EmptyPlist(Length(dom)); + out2 := EmptyPlist(Length(dom)); + seen := BlistList([1 .. Maximum(img)], []); + + for i in dom do + j := Random(img); + if not seen[j] then + seen[j] := true; Add(out1, i); Add(out2, j); fi; @@ -514,167 +486,163 @@ function(arg) ShrinkAllocationPlist(out2); od; return SparsePartialPermNC(out1, out2); - else + else ErrorNoReturn("usage: the argument must be a positive integer, a set, ", - "or 2 sets, of positive integers,"); + "or 2 sets, of positive integers, "); fi; end); -# - InstallGlobalFunction(PartialPermNC, -function(arg) - - if Length(arg)=1 then - return DensePartialPermNC(arg[1]); - elif Length(arg)=2 then - return SparsePartialPermNC(arg[1], arg[2]); - fi; - - ErrorNoReturn("usage: there should be one or two arguments,"); -end); +function(arg) -# + if Length(arg) = 1 then + return DensePartialPermNC(arg[1]); + elif Length(arg) = 2 then + return SparsePartialPermNC(arg[1], arg[2]); + fi; + + ErrorNoReturn("usage: there should be one or two arguments,"); +end); InstallGlobalFunction(PartialPerm, -function(arg) - - if Length(arg)=1 then - if ForAll(arg[1], i -> IsSmallIntRep(i) and i >= 0) and - IsDuplicateFreeList(Filtered(arg[1], x-> x<>0)) then +function(arg) + + if Length(arg) = 1 then + if ForAll(arg[1], i -> IsSmallIntRep(i) and i >= 0) + and IsDuplicateFreeList(Filtered(arg[1], x -> x <> 0)) then return DensePartialPermNC(arg[1]); else - ErrorNoReturn("usage: the argument must be a list of non-negative integers ", - "and the non-zero elements must be duplicate-free,"); + ErrorNoReturn("usage: the argument must be a list of non-negative ", + "integers and the non-zero elements must be ", + "duplicate-free,"); fi; - elif Length(arg)=2 then - if IsSSortedList(arg[1]) and ForAll(arg[1], IsSmallIntRep) and - IsDuplicateFreeList(arg[2]) and ForAll(arg[2], IsSmallIntRep) and - Length(arg[1]) = Length(arg[2]) then - return SparsePartialPermNC(arg[1], arg[2]); + elif Length(arg) = 2 then + if IsSSortedList(arg[1]) and ForAll(arg[1], IsSmallIntRep) + and IsDuplicateFreeList(arg[2]) and ForAll(arg[2], IsSmallIntRep) + and Length(arg[1]) = Length(arg[2]) then + return SparsePartialPermNC(arg[1], arg[2]); else - ErrorNoReturn("usage: the 1st argument must be a set of positive integers ", - "and the 2nd argument must be a duplicate-free list of positive ", - "integers of equal length to the first"); + ErrorNoReturn("usage: the 1st argument must be a set of positive ", + "integers and the 2nd argument must be a duplicate-free ", + "list of positive integers of equal length to the first"); fi; - fi; - - ErrorNoReturn("usage: there should be one or two arguments,"); -end); + fi; + + ErrorNoReturn("usage: there should be one or two arguments, "); +end); # printing, viewing, displaying... -InstallMethod(String, "for a partial perm", -[IsPartialPerm], +InstallMethod(String, "for a partial perm", +[IsPartialPerm], function(f) return STRINGIFY("PartialPerm( ", DomainOfPartialPerm(f), ", ", ImageListOfPartialPerm(f), " )"); end); -# - InstallMethod(PrintString, "for a partial perm", -[IsPartialPerm], +[IsPartialPerm], function(f) return PRINT_STRINGIFY("PartialPerm( ", Concatenation(PrintString(DomainOfPartialPerm(f)), ", "), ImageListOfPartialPerm(f), " )"); end); -# - InstallMethod(PrintObj, "for a partial perm", -[IsPartialPerm], +[IsPartialPerm], function(f) Print("PartialPerm(\>\> ", DomainOfPartialPerm(f), "\<, \>", ImageListOfPartialPerm(f), "\<\< )"); end); -# - InstallMethod(ViewString, "for a partial perm", [IsPartialPerm], function(f) - if DegreeOfPartialPerm(f)=0 then + if DegreeOfPartialPerm(f) = 0 then return ""; fi; - if RankOfPartialPerm(f)ImageListOfPartialPerm(f) then + if RankOfPartialPerm(f) < UserPreference("PartialPermDisplayLimit") then + if UserPreference("NotationForPartialPerms") = "component" then + if DomainOfPartialPerm(f) <> ImageListOfPartialPerm(f) then return ComponentStringOfPartialPerm(f); else - return PRINT_STRINGIFY(""); + return PRINT_STRINGIFY(""); fi; - elif UserPreference("NotationForPartialPerms")="domainimage" then - if DomainOfPartialPerm(f)<>ImageListOfPartialPerm(f) then - return PRINT_STRINGIFY(DomainOfPartialPerm(f), " -> ", - ImageListOfPartialPerm(f)); + elif UserPreference("NotationForPartialPerms") = "domainimage" then + if DomainOfPartialPerm(f) <> ImageListOfPartialPerm(f) then + return PRINT_STRINGIFY(DomainOfPartialPerm(f), + " -> ", + ImageListOfPartialPerm(f)); else - return PRINT_STRINGIFY(""); + return PRINT_STRINGIFY(""); fi; - elif UserPreference("NotationForPartialPerms")="input" then + elif UserPreference("NotationForPartialPerms") = "input" then return PrintString(f); fi; fi; - - return STRINGIFY(""); -end); -# + return STRINGIFY(""); +end); -InstallGlobalFunction(ComponentStringOfPartialPerm, +InstallGlobalFunction(ComponentStringOfPartialPerm, function(f) local n, seen, str, i, j; - n:=Maximum(DegreeOfPartialPerm(f), CoDegreeOfPartialPerm(f)); - seen:=List([1..n], x-> 0); - - #find the image - for i in ImageSetOfPartialPerm(f) do - seen[i]:=1; + n := Maximum(DegreeOfPartialPerm(f), CoDegreeOfPartialPerm(f)); + seen := List([1 .. n], x -> 0); + + #find the image + for i in ImageSetOfPartialPerm(f) do + seen[i] := 1; od; - - str:=""; + + str := ""; #find chains for i in DomainOfPartialPerm(f) do - if seen[i]=0 then + if seen[i] = 0 then Append(str, "\>[\>"); Append(str, String(i)); Append(str, "\<"); - seen[i]:=2; - i:=i^f; - while i<>0 do + seen[i] := 2; + i := i ^ f; + while i <> 0 do Append(str, ",\>"); Append(str, String(i)); Append(str, "\<"); - seen[i]:=2; - i:=i^f; + seen[i] := 2; + i := i ^ f; od; Append(str, "\<]"); fi; od; #find cycles - for i in DomainOfPartialPerm(f) do - if seen[i]=1 then + for i in DomainOfPartialPerm(f) do + if seen[i] = 1 then Append(str, "\>(\>"); Append(str, String(i)); - Append(str, "\<"); - j:=i^f; - while j<>i do + Append(str, "\<"); + j := i ^ f; + while j <> i do Append(str, ",\>"); Append(str, String(j)); Append(str, "\<"); - seen[j]:=2; - j:=j^f; + seen[j] := 2; + j := j ^ f; od; Append(str, "\<)"); fi; @@ -684,57 +652,57 @@ end); #collections -InstallMethod(DegreeOfPartialPermCollection, +InstallMethod(DegreeOfPartialPermCollection, "for a partial perm collection", -[IsPartialPermCollection], coll-> Maximum(List(coll, DegreeOfPartialPerm))); +[IsPartialPermCollection], coll -> Maximum(List(coll, DegreeOfPartialPerm))); -InstallMethod(CodegreeOfPartialPermCollection, +InstallMethod(CodegreeOfPartialPermCollection, "for a partial perm collection", -[IsPartialPermCollection], coll-> Maximum(List(coll, CodegreeOfPartialPerm))); +[IsPartialPermCollection], coll -> Maximum(List(coll, CodegreeOfPartialPerm))); InstallMethod(RankOfPartialPermCollection, "for a partial perm collection", -[IsPartialPermCollection], coll-> Length(DomainOfPartialPermCollection(coll))); +[IsPartialPermCollection], coll -> Length(DomainOfPartialPermCollection(coll))); InstallMethod(DomainOfPartialPermCollection, "for a partial perm coll", -[IsPartialPermCollection], coll-> Union(List(coll, DomainOfPartialPerm))); +[IsPartialPermCollection], coll -> Union(List(coll, DomainOfPartialPerm))); InstallMethod(ImageOfPartialPermCollection, "for a partial perm coll", -[IsPartialPermCollection], coll-> Union(List(coll, ImageSetOfPartialPerm))); +[IsPartialPermCollection], coll -> Union(List(coll, ImageSetOfPartialPerm))); InstallMethod(FixedPointsOfPartialPerm, "for a partial perm coll", -[IsPartialPermCollection], coll-> Union(List(coll, FixedPointsOfPartialPerm))); +[IsPartialPermCollection], coll -> Union(List(coll, FixedPointsOfPartialPerm))); InstallMethod(MovedPoints, "for a partial perm coll", -[IsPartialPermCollection], coll-> Union(List(coll, MovedPoints))); +[IsPartialPermCollection], coll -> Union(List(coll, MovedPoints))); InstallMethod(NrFixedPoints, "for a partial perm coll", -[IsPartialPermCollection], coll-> Length(FixedPointsOfPartialPerm(coll))); +[IsPartialPermCollection], coll -> Length(FixedPointsOfPartialPerm(coll))); InstallMethod(NrMovedPoints, "for a partial perm coll", -[IsPartialPermCollection], coll-> Length(MovedPoints(coll))); +[IsPartialPermCollection], coll -> Length(MovedPoints(coll))); InstallMethod(LargestMovedPoint, "for a partial perm collection", -[IsPartialPermCollection], coll-> Maximum(List(coll, LargestMovedPoint))); +[IsPartialPermCollection], coll -> Maximum(List(coll, LargestMovedPoint))); InstallMethod(LargestImageOfMovedPoint, "for a partial perm collection", -[IsPartialPermCollection], -coll-> Maximum(List(coll, LargestImageOfMovedPoint))); +[IsPartialPermCollection], +coll -> Maximum(List(coll, LargestImageOfMovedPoint))); InstallMethod(SmallestMovedPoint, "for a partial perm collection", -[IsPartialPermCollection], coll-> Minimum(List(coll, SmallestMovedPoint))); +[IsPartialPermCollection], coll -> Minimum(List(coll, SmallestMovedPoint))); InstallMethod(SmallestImageOfMovedPoint, "for a partial perm collection", -[IsPartialPermCollection], -coll-> Minimum(List(coll, SmallestImageOfMovedPoint))); +[IsPartialPermCollection], +coll -> Minimum(List(coll, SmallestImageOfMovedPoint))); -InstallMethod(OneImmutable, "for a partial perm coll", -[IsPartialPermCollection], +InstallMethod(OneImmutable, "for a partial perm coll", +[IsPartialPermCollection], function(x) - return JoinOfIdempotentPartialPermsNC(List(x, OneImmutable)); + return JoinOfIdempotentPartialPermsNC(List(x, OneImmutable)); end); -InstallMethod(OneMutable, "for a partial perm coll", +InstallMethod(OneMutable, "for a partial perm coll", [IsPartialPermCollection], OneImmutable); InstallMethod(MultiplicativeZeroOp, "for a partial perm", From 37aee879bed44ae2bc152d2c3c261ab335e84155 Mon Sep 17 00:00:00 2001 From: James Mitchell Date: Thu, 29 Mar 2018 21:08:48 +0200 Subject: [PATCH 8/9] pperm: kernel code formatted --- src/pperm.c | 137 ++++++++++++++++++++++++++-------------------------- 1 file changed, 69 insertions(+), 68 deletions(-) diff --git a/src/pperm.c b/src/pperm.c index 57f9740d71..f86883982a 100644 --- a/src/pperm.c +++ b/src/pperm.c @@ -1,14 +1,14 @@ /***************************************************************************** -* -* A partial perm is of the form: -* -* [image set, domain, codegree, entries of image list] -* -* An element of the internal rep of a partial perm in T_PPERM2 must be -* at most 65535 and be of UInt2. The is just the degree of -* the inverse or equivalently the maximum element of the image. -* -*****************************************************************************/ + * + * A partial perm is of the form: + * + * [image set, domain, codegree, entries of image list] + * + * An element of the internal rep of a partial perm in T_PPERM2 must be + * at most 65535 and be of UInt2. The is just the degree of + * the inverse or equivalently the maximum element of the image. + * + *****************************************************************************/ #include @@ -40,19 +40,19 @@ static ModuleStateOffset PPermStateOffset = -1; typedef struct { -/************************************************************************** -* -*V TmpPPerm . . . . . . . handle of the buffer bag of the pperm package -* -* 'TmpPPerm' is the handle of a bag of type 'T_PPERM4', which is -* created at initialization time of this package. Functions in this -* package can use this bag for whatever purpose they want. They have -* to make sure of course that it is large enough. -* -* The buffer is *not* guaranteed to have any particular value, routines -* that require a zero-initialization need to do this at the start. -*/ -Obj TmpPPerm; + /************************************************************************** + * + *V TmpPPerm . . . . . . . handle of the buffer bag of the pperm package + * + * 'TmpPPerm' is the handle of a bag of type 'T_PPERM4', which is + * created at initialization time of this package. Functions in this + * package can use this bag for whatever purpose they want. They have + * to make sure of course that it is large enough. + * + * The buffer is *not* guaranteed to have any particular value, routines + * that require a zero-initialization need to do this at the start. + */ + Obj TmpPPerm; } PPermModuleState; @@ -72,8 +72,8 @@ static inline void ResizeTmpPPerm(UInt len) } /***************************************************************************** -* Static functions for partial perms -*****************************************************************************/ + * Static functions for partial perms + *****************************************************************************/ static inline UInt GET_CODEG_PPERM2(Obj f) { @@ -91,16 +91,16 @@ UInt CODEG_PPERM2(Obj f) { GAP_ASSERT(TNUM_OBJ(f) == T_PPERM2); if (GET_CODEG_PPERM2(f) != 0) { - return GET_CODEG_PPERM2(f); + return GET_CODEG_PPERM2(f); } // The following is only ever entered by the EmptyPartialPerm. - UInt codeg = 0; - UInt i; - UInt2* ptf = ADDR_PPERM2(f); + UInt codeg = 0; + UInt i; + UInt2 * ptf = ADDR_PPERM2(f); for (i = 0; i < DEG_PPERM2(f); i++) { - if (ptf[i] > codeg) { - codeg = ptf[i]; - } + if (ptf[i] > codeg) { + codeg = ptf[i]; + } } SET_CODEG_PPERM2(f, codeg); return codeg; @@ -122,16 +122,16 @@ UInt CODEG_PPERM4(Obj f) { GAP_ASSERT(TNUM_OBJ(f) == T_PPERM4); if (GET_CODEG_PPERM4(f) != 0) { - return GET_CODEG_PPERM4(f); + return GET_CODEG_PPERM4(f); } // The following is only ever entered by the EmptyPartialPerm. - UInt codeg = 0; - UInt i; - UInt4* ptf = ADDR_PPERM4(f); + UInt codeg = 0; + UInt i; + UInt4 * ptf = ADDR_PPERM4(f); for (i = 0; i < DEG_PPERM4(f); i++) { - if (ptf[i] > codeg) { - codeg = ptf[i]; - } + if (ptf[i] > codeg) { + codeg = ptf[i]; + } } SET_CODEG_PPERM4(f, codeg); return codeg; @@ -216,7 +216,7 @@ static UInt INIT_PPERM2(Obj f) SET_ELM_PLIST(img, rank, INTOBJ_INT(ptf[i])); } } - GAP_ASSERT(rank != 0); // rank = 0 => deg = 0, so this is not allowed + GAP_ASSERT(rank != 0); // rank = 0 => deg = 0, so this is not allowed SHRINK_PLIST(img, (Int)rank); SET_LEN_PLIST(img, (Int)rank); @@ -261,7 +261,7 @@ static UInt INIT_PPERM4(Obj f) SET_ELM_PLIST(img, rank, INTOBJ_INT(ptf[i])); } } - GAP_ASSERT(rank != 0); // rank = 0 => deg = 0, so this is not allowed + GAP_ASSERT(rank != 0); // rank = 0 => deg = 0, so this is not allowed SHRINK_PLIST(img, (Int)rank); SET_LEN_PLIST(img, (Int)rank); @@ -333,8 +333,8 @@ static Obj PreImagePPermInt(Obj pt, Obj f) } /***************************************************************************** -* GAP functions for partial perms -*****************************************************************************/ + * GAP functions for partial perms + *****************************************************************************/ Obj FuncEmptyPartialPerm(Obj self) { @@ -613,7 +613,7 @@ static UInt4 * FindImg(UInt n, UInt rank, Obj img) { GAP_ASSERT(IS_PLIST(img)); - UInt i; + UInt i; UInt4 * ptseen; ResizeTmpPPerm(n); @@ -905,8 +905,8 @@ Obj FuncCOMPONENTS_PPERM(Obj self, Obj f) { GAP_ASSERT(IS_PPERM(f)); - UInt i, j, n, rank, k, deg, nr, len; - Obj dom, img, out; + UInt i, j, n, rank, k, deg, nr, len; + Obj dom, img, out; n = MAX(DEG_PPERM(f), CODEG_PPERM(f)); @@ -1437,7 +1437,8 @@ Int HashFuncForPPerm(Obj f) (int)2 * DEG_PPERM2(f)); } -Obj FuncHASH_FUNC_FOR_PPERM(Obj self, Obj f, Obj data) { +Obj FuncHASH_FUNC_FOR_PPERM(Obj self, Obj f, Obj data) +{ return INTOBJ_INT(HashFuncForPPerm(f) % INT_INTOBJ(data) + 1); } @@ -2217,8 +2218,8 @@ Obj FuncRESTRICTED_PPERM(Obj self, Obj f, Obj set) return Fail; } -// convert a permutation

to a partial perm on , which is assumed to be -// a set of positive integers +// convert a permutation

to a partial perm on , which is assumed to +// be a set of positive integers Obj FuncAS_PPERM_PERM(Obj self, Obj p, Obj set) { GAP_ASSERT(IS_PERM2(p) || IS_PERM4(p)); @@ -6176,12 +6177,12 @@ Obj LQuoPPerm44(Obj f, Obj g) */ Obj OnSetsPPerm(Obj set, Obj f) { - UInt2 * ptf2; - UInt4 * ptf4; - UInt deg; + UInt2 * ptf2; + UInt4 * ptf4; + UInt deg; const Obj * ptset; - Obj * ptres, tmp, res; - UInt i, isint, k, reslen; + Obj * ptres, tmp, res; + UInt i, isint, k, reslen; GAP_ASSERT(IS_PLIST(set)); GAP_ASSERT(LEN_PLIST(set) > 0); @@ -6280,12 +6281,12 @@ Obj OnSetsPPerm(Obj set, Obj f) */ Obj OnTuplesPPerm(Obj tup, Obj f) { - UInt2 * ptf2; - UInt4 * ptf4; - UInt deg; + UInt2 * ptf2; + UInt4 * ptf4; + UInt deg; const Obj * pttup; - Obj * ptres, res; - UInt i, k, reslen; + Obj * ptres, res; + UInt i, k, reslen; GAP_ASSERT(IS_PLIST(tup)); GAP_ASSERT(LEN_PLIST(tup) > 0); @@ -6357,12 +6358,12 @@ Obj FuncOnPosIntSetsPartialPerm(Obj self, Obj set, Obj f) GAP_ASSERT(IS_LIST(set)); GAP_ASSERT(IS_PPERM(f)); - UInt2 * ptf2; - UInt4 * ptf4; - UInt deg; + UInt2 * ptf2; + UInt4 * ptf4; + UInt deg; const Obj * ptset; - Obj * ptres, tmp, res; - UInt i, k, reslen; + Obj * ptres, tmp, res; + UInt i, k, reslen; if (LEN_LIST(set) == 0) return set; @@ -6525,8 +6526,8 @@ static StructGVarFilt GVarFilts[] = { }; /**************************************************************************** -*V GVarFuncs . . . . . . . . . . . . . . . . . . list of functions to export -*/ + *V GVarFuncs . . . . . . . . . . . . . . . . . . list of functions to export + */ static StructGVarFunc GVarFuncs[] = { GVAR_FUNC(EmptyPartialPerm, 0, ""), @@ -6574,8 +6575,8 @@ static StructGVarFunc GVarFuncs[] = { /**************************************************************************** -*F InitKernel( ) . . . . . . . . initialise kernel data structures -*/ + *F InitKernel( ) . . . . . . . . initialise kernel data structures + */ static Int InitKernel(StructInitInfo * module) { From aedc32e57249ea0fc51f3e7e0167864dd17de14a Mon Sep 17 00:00:00 2001 From: James Mitchell Date: Thu, 5 Apr 2018 10:36:48 +0100 Subject: [PATCH 9/9] pperm: fix bug in PreImagePPermInt This occasionally caused incorrect values to be returned when i == deg and by coincidence ptf2[i] == cpt. When ptf2[deg] is beyond the end of the bag containing f, and so is not valid. For reference, this bug caused errors in: https://github.com/gap-packages/Semigroups/pull/296 https://github.com/gap-packages/Semigroups/pull/472 --- src/pperm.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/pperm.c b/src/pperm.c index f86883982a..356296cd76 100644 --- a/src/pperm.c +++ b/src/pperm.c @@ -316,17 +316,17 @@ static Obj PreImagePPermInt(Obj pt, Obj f) if (TNUM_OBJ(f) == T_PPERM2) { ptf2 = ADDR_PPERM2(f); deg = DEG_PPERM2(f); - while (ptf2[i] != cpt && i < deg) + while (i < deg && ptf2[i] != cpt) i++; - if (ptf2[i] != cpt) + if (i == deg || ptf2[i] != cpt) return Fail; } else { ptf4 = ADDR_PPERM4(f); deg = DEG_PPERM4(f); - while (ptf4[i] != cpt && i < deg) + while (i < deg && ptf4[i] != cpt) i++; - if (ptf4[i] != cpt) + if (i == deg || ptf4[i] != cpt) return Fail; } return INTOBJ_INT(i + 1);