Skip to content

Commit

Permalink
WORKAROUND: Avoid problems in Kan package.
Browse files Browse the repository at this point in the history
The Kan package copied library code and thus uses undocumented entries
of rewriting systems. Added workaround to avoid triggering an error
in the test.

This resolves #5478
  • Loading branch information
hulpke committed Jul 26, 2023
1 parent 044b391 commit 3de7b02
Showing 1 changed file with 28 additions and 9 deletions.
37 changes: 28 additions & 9 deletions lib/kbsemi.gi
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,9 @@ DeclareRepresentation("IsKnuthBendixRewritingSystemRep",
## refers to one of the rules. A pair corresponds to a pair
## of rules where confluence was not yet checked (according to
## the Knuth Bendix algorithm).
## Pairs might also be given in the form of a 3-entry list
## ['A',x,l] to denote all pairs of the form [x,y] for y in l,
## respectively ['B',l,y] for pairs [x,y[] with x in l.
##
## Note that at this stage the kb rws obtained might not be reduced
## (the same relation might even appear several times).
Expand Down Expand Up @@ -767,6 +770,22 @@ function ( rws )
" rules" );
end);

# We store compressed data -- expand, (and also delete old stuff)
BindGlobal("KBRWSUnpackPairsAt",function(kbrws,p)
local i,a;
i:=kbrws!.pairs2check[p];
if IsChar(i[1]) then
# We store compressed data -- expand, (and also delete old stuff)
if i[1]='A' then
a:=List(i[3],x->[i[2],x]);
elif i[1]='B' then
a:=List(i[2],x->[x,i[3]]);
else Error("kind"); fi;
kbrws!.pairs2check:=Concatenation(a,kbrws!.pairs2check{[p+1..Length(kbrws!.pairs2check)]});
p:=1;
fi;
return p;
end);



Expand All @@ -776,7 +795,15 @@ end);
BindGlobal("KBOverlaps",function(ui,vi,kbrws,p)
local u,v,m,k,a,c,lsu,lsv,lu,eq,i,j;

# work around copied code in kan package
if IsChar(ui) then # must unpack
p:=KBRWSUnpackPairsAt(kbrws,p);
vi:=kbrws!.pairs2check[p];
ui:=vi[1];vi:=vi[2];
fi;

u:=kbrws!.tzrules[ui]; v:=kbrws!.tzrules[vi];

lsu:=u[1];
lu:=Length(lsu);
lsv:=v[1];
Expand Down Expand Up @@ -860,15 +887,7 @@ local pn,lp,rl,p,i,a;
i:=kbrws!.pairs2check[p];
if IsChar(i[1]) then
# We store compressed data -- expand, (and also delete old stuff)
if i[1]='A' then
a:=List(i[3],x->[i[2],x]);
elif i[1]='B' then
a:=List(i[2],x->[x,i[3]]);
else Error("kind"); fi;
kbrws!.pairs2check:=Concatenation(a,kbrws!.pairs2check{[p+1..Length(kbrws!.pairs2check)]});
p:=1;
i:=kbrws!.pairs2check[p];
lp:=Length(kbrws!.pairs2check);
p:=KBRWSUnpackPairsAt(kbrws,p);
fi;

p:=KBOverlaps(i[1],i[2],kbrws,p)+1;
Expand Down

0 comments on commit 3de7b02

Please sign in to comment.