Errors in GAP small groups library

91 views
Skip to first unread message

David Roe

unread,
Feb 16, 2018, 10:12:25 PM2/16/18
to sage-devel
I'm trying to use GAP's small groups library (after installing gap_packages) and getting strange errors that don't occur in GAP when built from source.  In particular (using gap_console to get more traceback)

sage: gap_console()
...
gap> NormalSubgroups(SmallGroup(1458,1180));
Error, List Element: <list>[4] must have an assigned value in
  if map[d] > max  then
    elm := id;
else
    if not IsBound( map[d] )  then
        Error( "<elm> lies not in group defined by <pcgs>" );
    fi;
    ll := LeadingExponentOfPcElement( pa, elm );
    lr := lc[d];
    exp[map[d]] := ll / lr mod ros[d];
    elm := LeftQuotientPowerPcgsElement( pcgs, map[d], exp[map[d]], elm );
fi; at /home/roed/sage/local/gap/latest/lib/pcgsind.gi:1411 called from
ExponentsOfPcElement( NumeratorOfModuloPcgs( pcgs ), elm, pcgs!.depthMap ) at /home/roed/sage/local/gap/latest/lib/pcgsmodu.gi:931 called from
ExponentsOfPcElement( ocr.modulePcgs, x ) at /home/roed/sage/local/gap/latest/lib/onecohom.gi:264 called from
ocr.moduleMap( n ) at /home/roed/sage/local/gap/latest/lib/onecohom.gi:339 called from
ocr.listToCocycle( lc ) at /home/roed/sage/local/gap/latest/lib/grplatt.gi:1926 called from
opr( Zero( vs ), k ) at /home/roed/sage/local/gap/latest/lib/grplatt.gi:1932 called from
...  at line 2 of *stdin*

Similar problems are occurring with other groups and some other functions.

In the interest of finishing my calculation, I tried the following in an attempt to have Sage use a functional GAP:

sage: import sage.interfaces.gap
sage: sage.interfaces.gap.gap_cmd = "/home/roed/gap4r8/bin/gap.sh"
sage: gap.eval('1+1')

which hangs.  Similarly, I tried copying my functional gap installation to $SAGE_LOCAL/gap/ and updating the "latest" symlink; this allows gap_console() to function correctly but gap.eval() still hangs.

I don't tend to work with spkgs very often, so I feel like there's probably something simple I'm overlooking.  Any help in installing a functioning gap would be appreciated.  I'm also happy to help investigate what's wrong with our process for installing the small groups library.
David

David Joyner

unread,
Feb 16, 2018, 10:44:39 PM2/16/18
to sage-devel
I'm not sure if this helps, but in 7.6,

gap> NormalSubgroups(SmallGroup(158,1));
[ Group([ ]), Group([ f2 ]), <pc group of size 158 with 2 generators> ]

and

gap> SmallGroup(1458,1180);
<pc group of size 1458 with 7 generators>

work (but gap> NormalSubgroups(SmallGroup(1458,1180)); fails, as
stated). Moreover

sage: sage: import sage.interfaces.gap
....: sage: sage.interfaces.gap.gap_cmd = "/home/roed/gap4r8/bin/gap.sh"
....: sage: gap.eval('1+1')
....:
'2'

doesn't hang.


> I don't tend to work with spkgs very often, so I feel like there's probably
> something simple I'm overlooking. Any help in installing a functioning gap
> would be appreciated. I'm also happy to help investigate what's wrong with
> our process for installing the small groups library.
> David
>
> --
> You received this message because you are subscribed to the Google Groups
> "sage-devel" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sage-devel+...@googlegroups.com.
> To post to this group, send email to sage-...@googlegroups.com.
> Visit this group at https://groups.google.com/group/sage-devel.
> For more options, visit https://groups.google.com/d/optout.

David Roe

unread,
Feb 16, 2018, 11:21:04 PM2/16/18
to sage-devel
What version of GAP do you have there?  I installed gap-4.6.10; maybe I should try 4.6.8 to be compatible with Sage....
David
 


> I don't tend to work with spkgs very often, so I feel like there's probably
> something simple I'm overlooking.  Any help in installing a functioning gap
> would be appreciated.  I'm also happy to help investigate what's wrong with
> our process for installing the small groups library.
> David
>
> --
> You received this message because you are subscribed to the Google Groups
> "sage-devel" group.
> To unsubscribe from this group and stop receiving emails from it, send an

> To post to this group, send email to sage-...@googlegroups.com.
> Visit this group at https://groups.google.com/group/sage-devel.
> For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscribe@googlegroups.com.

Dima Pasechnik

unread,
Feb 16, 2018, 11:40:25 PM2/16/18
to sage-devel
The problem is in the packages loaded (or not) by Sage's GAP vs by GAP's GAP.
Namely, if I start Sage's gap by ./sage --gap
and do
gap> LoadAllPackages();
gap> NormalSubgroups(SmallGroup(1458,1180));
I'd get your error

Now, if I take GAP's source for 4.8.6:
untar it, and copy its pkg/ directory to $SAGEROOT/local/gap/latest/
 start Sage's gap by ./sage --gap
and do
gap> LoadAllPackages();
gap> NormalSubgroups(SmallGroup(1458,1180));
[ <pc group of size 1458 with 7 generators>, Group([ f1, f2, f3^2*f4, f5, f6, f7 ]), Group([ f2, f3^2*f4, f4, f5, f6, f7 ]), 
  Group([ f1, f3^2*f4, f4, f5, f6, f7 ]), Group([ f1, f2*f4*f6, f3^2*f4, f5, f6, f7 ]), Group([ f1, f2^2*f4*f6^2, f3^2*f4, f5, f6, f7 ]), 
  Group([ f1, f3^2*f4, f5, f6, f7 ]), Group([ f3^2*f4, f4, f5, f6, f7 ]), Group([ f2*f4*f6, f3^2*f4, f5, f6, f7 ]), 
  Group([ f2^2*f4*f6^2, f3^2*f4, f5, f6, f7 ]), Group([ f2, f3^2*f4, f5, f6, f7 ]), Group([ f1, f3^2*f4, f5*f6^2, f7 ]), Group([ f3^2*f4, f5, f6, f7 ]), 
  Group([ f2*f3^2*f4, f3^2*f4^2, f5*f6^2, f6, f7 ]), Group([ f3^2*f4^2, f5*f6^2, f6, f7 ]), Group([ f2*f3*f6*f7, f5*f6^2, f6, f7 ]), 
  Group([ f2^2*f4*f6^2, f5*f6^2, f6, f7 ]), Group([ f2*f3^2*f4, f5*f6^2, f6, f7 ]), Group([ f5*f6^2, f6, f7 ]), Group([ f3^2*f4, f5*f6^2, f7 ]), 
  Group([ f3^2*f4^2, f5^2*f6^2, f7 ]), Group([ f5^2*f6^2, f7 ]), Group([ f5*f6^2, f7 ]), Group([ f7 ]), Group([  ]) ]

--- it works.
Note that LoadAllPackages() is necessary, as apparently the GAP code uses one of these packages for these
computation without telling us.

So this is a sort of bug, yes, in our way of packaging GAP packages (and it's a sort of GAP's bug to call a code from a package
without loading it explicitly...)
I don't know what package it is yet.
It's very early Sat. morning here, I'll have a look at it over the weekend.

David Roe

unread,
Feb 17, 2018, 12:58:17 AM2/17/18
to sage-devel
Thanks, that helps a lot.  After some experimentation, it seems like
gap> LoadPackage("CRISP");
is sufficient.

However, when I try to do it from sage I get the following:
sage: gap.eval('LoadPackage("CRISP");')
Warning: this should never happen

and sage hangs.  Googling leads me to https://groups.google.com/forum/#!topic/sage-support/60HHHL8Bw_8, which I interpret as suggesting that CRISP is using LoadDynamicModule. However, searching on https://github.com/bh11/crisp, I don't see any calls to that function.  Is there something else that could be responsible?  Is there a way to use CRISP through gap.eval in Sage?
David

--

David Roe

unread,
Feb 17, 2018, 2:31:19 AM2/17/18
to sage-devel
I realized that I ran
sage: gap.eval('LoadAllPackages();')
which broke libgap.  For anyone else reading this, the following fixed the problem (taken from gap_reset_workspace, with sonata and guava removed due to "Warning: this should never happen" and braid removed because I don't have it installed):

g = Gap(use_workspace_cache=False, max_workspace_size=None)
g.eval('SetUserPreference("HistoryMaxLines", 30)')
for pkg in ['GAPDoc', 'ctbllib', 'factint', 'gapdoc', 'grape', 'design', 'toric', 'laguna']:
    g.load_package(pkg, verbose=True)
g.save_workspace()
g.quit()

Thanks for the help Dima: my calculations are running smoothly again!
David

Dima Pasechnik

unread,
Feb 17, 2018, 4:08:19 AM2/17/18
to sage-devel


On Saturday, February 17, 2018 at 5:58:17 AM UTC, David Roe wrote:
Thanks, that helps a lot.  After some experimentation, it seems like
gap> LoadPackage("CRISP");
is sufficient.

Indeed, thanks for digging this up.
 

However, when I try to do it from sage I get the following:
sage: gap.eval('LoadPackage("CRISP");')
Warning: this should never happen

this is some kind of pexpect interface problem, I gather, related to Tab completion.
I get this if I just hit Tab
at
sage: gap. 

I guess it's the same kind of issue as https://trac.sagemath.org/ticket/22766 and
https://trac.sagemath.org/ticket/23956 (a gift from Ipython, which in its current 
Sage version does multithreaded tab completion, causing havoc with packages that do non-trivial
things at Tab completion

At least the following works:

sage: libgap.LoadPackage("CRISP")
true
sage: libgap.SmallGroup(1458,1180)
<pc group of size 1458 with 7 generators>
sage: s=libgap.SmallGroup(1458,1180); s
<pc group of size 1458 with 7 generators>
sage: libgap.NormalSubgroups(s)
[ <pc group of size 1458 with 7 generators>, Group([ f1, f2, f3^2*f4, f5, f6, f7 ]), Group([ f2, f3^2*f4, f4, f5, f6, f7 ]), Group([ f1, f3^2*f4, f4, f5, f6, f7 ]), Group([ f1, f2*f4*f6, f3^2*f4, f5, f6, f7 ]), Group([ f1, f2^2*f4*f6^2, f3^2*f4, f5, f6, f7 ]), Group([ f1, f3^2*f4, f5, f6, f7 ]), Group([ f3^2*f4, f4, f5, f6, f7 ]), Group([ f2*f4*f6, f3^2*f4, f5, f6, f7 ]), Group([ f2^2*f4*f6^2, f3^2*f4, f5, f6, f7 ]), Group([ f2, f3^2*f4, f5, f6, f7 ]), Group([ f2*f3^2*f4, f3^2*f4^2, f5, f6, f7 ]), Group([ f3^2*f4^2, f5, f6, f7 ]), Group([ f2*f3*f6*f7, f5, f6, f7 ]), Group([ f2^2*f4*f6^2, f5, f6, f7 ]), Group([ f2*f3^2*f4, f5, f6, f7 ]), Group([ f3^2*f4, f5, f6, f7 ]), Group([ f3^2*f4^2, f5*f6, f7 ]), Group([ f5, f6, f7 ]), Group([ f1, f3^2*f4, f5*f6^2, f7 ]), Group([ f3^2*f4, f5*f6^2, f7 ]), Group([ f5*f6^2, f7 ]), Group([ f5*f6, f7 ]), Group([ f7 ]), Group([  ]) ]


and sage hangs.  Googling leads me to https://groups.google.com/forum/#!topic/sage-support/60HHHL8Bw_8, which I interpret as suggesting that CRISP is using LoadDynamicModule. However, searching on https://github.com/bh11/crisp, I don't see any calls to that function.  Is there something else that could be responsible?  Is there a way to use CRISP through gap.eval in Sage?

use libgap, it works :-)
 
David

To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+...@googlegroups.com.

Dima Pasechnik

unread,
Feb 17, 2018, 5:30:01 AM2/17/18
to sage-devel


On Saturday, February 17, 2018 at 7:31:19 AM UTC, David Roe wrote:
I realized that I ran
sage: gap.eval('LoadAllPackages();')
which broke libgap. 

Really? I don't think so. It didn't break it for me, although it did break GAP's workspaces, which is for some reason very fragile.
(libGAP and GAP have separate workspaces in Sage)
What happened is the following, I think: copying the packages from GAP source broke some GAP packages in Sage's
GAP pkg/ directory, namely at least sonata (mea culpa, I should have warned you about it)

sage: gap_reset_workspace(verbose=True)
Loading GAP package GAPDoc
Loading GAP package ctbllib
Loading GAP package sonata
Warning: this should never happen

(and Sage hangs)

In fact, this is coming from 

    elif x==13: #@w GAP is trying to send a Window command

in src/sage/interfaces/gap.py
I have no clue what "Window command" is. Anyway, the error message should not be identical to the one from

   elif x==12: #@sN shouldn't happen

I also don't know the reason for that "Window command" --- is it cause it is meant to print some info message?

  
To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+...@googlegroups.com.

Dima Pasechnik

unread,
Feb 17, 2018, 6:16:43 AM2/17/18
to sage-devel
I can further add that GAP 4.9 fixes this: for computing NormalSubgroups(SmallGroup(1458,1180));
CRISP is no longer neeed.

Simon King

unread,
Feb 17, 2018, 6:53:51 AM2/17/18
to sage-...@googlegroups.com
Hi!

On 2018-02-17, Dima Pasechnik <dim...@gmail.com> wrote:
> sage: gap_reset_workspace(verbose=True)

Doing that, I get
sage: gap_reset_workspace(verbose=True)
Loading GAP package GAPDoc
Loading GAP package ctbllib
Loading GAP package sonata
Loading GAP package guava
Loading GAP package factint
Loading GAP package gapdoc
Loading GAP package grape
Loading GAP package design
Loading GAP package toric
Loading GAP package laguna
Loading GAP package braid
*** Error loading Gap package braid. You may want to install the
gap_packages and/or database_gap SPKGs.

The punchline is that I installed both gap_packages and database_gap!

Also
sage: gap.eval('LoadPackage("CRISP");')
'fail'
Is CRISP supposed to be part of database_gap?

So, how to fix all that?

Best regards,
Simon

Dima Pasechnik

unread,
Feb 17, 2018, 7:38:53 AM2/17/18
to sage-devel
no. Sage never packaged CRISP.
CRISP can be easily installed as an extra GAP package directly into SAGE_LOCAL/gap/latest/pkg/
as it does not need any compilation, it's all pure GAP code.

There isn't much to fix. 

The GAP situation is somehow unfortunate, as upstream promised to provide a replacement for libGAP
some time ago, but this still has to happen...

Alexander Konovalov

unread,
Feb 18, 2018, 10:17:08 AM2/18/18
to sage-devel
1) For info, CRISP is distributed under the BSD 2-Clause "Simplified" License, repository is at https://github.com/bh11/crisp

2) GAP never included the Braid package in the distribution, and this package was superseded by MapClass package which IS redistributed with GAP and will be updated for GAP 4.9.0 from the https://github.com/gap-packages/MapClass repository. 

Just in case
Alex


On Saturday, February 17, 2018 at 11:53:51 AM UTC, Simon King wrote:
Reply all
Reply to author
Forward
0 new messages