Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rewriting systems copying methods errors #3108

Closed
ignatsoroko opened this issue Dec 14, 2018 · 2 comments
Closed

rewriting systems copying methods errors #3108

ignatsoroko opened this issue Dec 14, 2018 · 2 comments

Comments

@ignatsoroko
Copy link

ignatsoroko commented Dec 14, 2018

The first error:

is triggered by ShallowCopy:

Observed behaviour

gap> F:=FreeGroup(2);
<free group on the generators [ f1, f2 ]>
gap> mhom:=IsomorphismFpMonoid(F);
MappingByFunction( <free group on the generators [ f1, f2 ]>, <fp monoid on the generators [ f1, f1^-1, f2, f2^-1 
 ]>, function( x ) ... end, function( x ) ... end )
gap> mon:=Image(mhom);
<fp monoid on the generators [ f1, f1^-1, f2, f2^-1 ]>
gap> k:=KnuthBendixRewritingSystem(mon);
Knuth Bendix Rewriting System for Monoid( [ f1, f1^-1, f2, f2^-1 ] ) with rules 
[ [ f1*f1^-1, <identity ...> ], [ f1^-1*f1, <identity ...> ], [ f2*f2^-1, <identity ...> ], 
  [ f2^-1*f2, <identity ...> ] ]
gap> k1:=ShallowCopy(k);
Knuth Bendix Rewriting System for Monoid( [ f1, f1^-1, f2, f2^-1 ] ) with rules 
Error, Record Element: '<rec>.freefam' must have an assigned value in
  fam := kbrws!.freefam; at /proc/cygdrive/C/gap-4.10.0-x86_64/lib/kbsemi.gi:703 called from 
Rules( kbrws ) at /proc/cygdrive/C/gap-4.10.0-x86_64/lib/kbsemi.gi:763 called from
SetUserHasQuit( 1 ); at /proc/cygdrive/C/gap-4.10.0-x86_64/lib/error.g:325 called from
fam := kbrws!.freefam; at /proc/cygdrive/C/gap-4.10.0-x86_64/lib/kbsemi.gi:703 called from
Rules( kbrws ) at /proc/cygdrive/C/gap-4.10.0-x86_64/lib/kbsemi.gi:763 called from
SHELL( GetBottomLVars(  ), false, false, 3, true, prompt, function (  )
      if IsBound( OnGAPPromptHook ) and IsFunction( OnGAPPromptHook ) then
          OnGAPPromptHook(  );
      else
          return;
      fi;
      return;
  end, "*stdin*", "*stdout*", true ); at /proc/cygdrive/C/gap-4.10.0-x86_64/lib/session.g:60 called from
...  at *stdin*:11
you can 'return;' after assigning a value
brk> quit; 

Expected behaviour

gap> F:=FreeGroup(2);
<free group on the generators [ f1, f2 ]>
gap> mhom:=IsomorphismFpMonoid(F);
MappingByFunction( <free group on the generators [ f1, f2 ]>, <fp monoid on the generators [ f1, f1^-1, f2, f2^-1 
 ]>, function( x ) ... end, function( x ) ... end )
gap> mon:=Image(mhom);
<fp monoid on the generators [ f1, f1^-1, f2, f2^-1 ]>
gap> k:=KnuthBendixRewritingSystem(mon);
Knuth Bendix Rewriting System for Monoid( [ f1, f1^-1, f2, f2^-1 ] ) with rules 
[ [ f1*f1^-1, <identity ...> ], [ f1^-1*f1, <identity ...> ], [ f2*f2^-1, <identity ...> ], 
  [ f2^-1*f2, <identity ...> ] ]
gap> k1:=ShallowCopy(k);
Knuth Bendix Rewriting System for Monoid( [ f1, f1^-1, f2, f2^-1 ] ) with rules 
[ [ f1*f1^-1, <identity ...> ], [ f1^-1*f1, <identity ...> ], [ f2*f2^-1, <identity ...> ], 
  [ f2^-1*f2, <identity ...> ] ]

Copy and paste GAP banner (to tell us about your setup)

 ┌───────┐   GAP 4.10.0 of 01-Nov-2018
 │  GAP  │   https://www.gap-system.org
 └───────┘   Architecture: x86_64-unknown-cygwin-default64
 Configuration:  gmp 6.1.0, readline
 Loading the library and packages ...
 Packages:   AClib 1.3.1, Alnuth 3.1.0, AtlasRep 1.5.1, AutoDoc 2018.09.20, AutPGrp 1.10, Browse 1.8.8, CRISP 1.4.4,
             Cryst 4.1.18, CrystCat 1.1.8, CTblLib 1.2.2, FactInt 1.6.2, FGA 1.4.0, GAPDoc 1.6.2, IO 4.5.4,
             IRREDSOL 1.4, LAGUNA 3.9.0, Polenta 1.3.8, Polycyclic 2.14, PrimGrp 3.3.2, RadiRoot 2.8,
             ResClasses 4.7.1, SmallGrp 1.3, Sophus 1.24, SpinSym 1.5, TomLib 1.2.7, TransGrp 2.0.4, utils 0.59
 Try '??help' for help. See also '?copyright', '?cite' and '?authors'

The second error:

is triggered by the AddRule method. Notice that AddRuleReduced works as it should. Continuing the example above:

Observed behaviour

gap> k!.tzrules;
[ [ [ 1, 2 ], [  ] ], [ [ 2, 1 ], [  ] ], [ [ 3, 4 ], [  ] ], [ [ 4, 3 ], [  ] ] ]
gap> AddRule(k,[[4,4],[]]);
Error, no method found! For debugging hints type ?Recovery from NoMethodFound
Error, no 1st choice method found for `AddRule' on 2 arguments at /proc/cygdrive/C/gap-4.10.0-x86_64/lib/methsel2.g:250 called from
<function "HANDLE_METHOD_NOT_FOUND">( <arguments> )
 called from read-eval loop at *stdin*:12
type 'quit;' to quit to outer loop
brk> quit; 
gap> AddRuleReduced(k,[[4,4],[]]);
gap> k!.tzrules;
[ [ [ 1, 2 ], [  ] ], [ [ 2, 1 ], [  ] ], [ [ 3, 4 ], [  ] ], [ [ 4, 3 ], [  ] ], [ [ 4, 4 ], [  ] ] ] 

Expected behaviour

gap> k!.tzrules;
[ [ [ 1, 2 ], [  ] ], [ [ 2, 1 ], [  ] ], [ [ 3, 4 ], [  ] ], [ [ 4, 3 ], [  ] ] ]
gap> AddRule(k,[[4,4],[]]);
gap>
@ChrisJefferson
Copy link
Contributor

I think what this needs is freefam := kbrws!.freefam, adding as line 790 in lib/kbsemi.gi. This would match up with the definition at line 110 of the same file, and fixes the immediate problem.

However, this isn't an area I'm a great expert on, so would it be possible for you to try that, and see if that seems to fix things, and maybe try doing some other things? For example, it seems a bit weird to me we don't make a copy pairs2check (also around line 790), and instead make a new empty list.

Thanks!

@ChrisJefferson
Copy link
Contributor

we also need tzordering := kbrws!.tzordering, to make MakeKnuthBendixRewritingSystemConfluent work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants