Skip to content

Overfllow in libgap interface #39998

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

Open
2 tasks done
edgarcosta opened this issue Apr 22, 2025 · 0 comments · May be fixed by #39999
Open
2 tasks done

Overfllow in libgap interface #39998

edgarcosta opened this issue Apr 22, 2025 · 0 comments · May be fixed by #39999
Labels

Comments

@edgarcosta
Copy link
Member

edgarcosta commented Apr 22, 2025

Steps To Reproduce

sage: t = tuple(2**15 - i for i in range(2))
sage: for i in range(5):SymmetricGroup(2**16+2**i)(t)._libgap_()
(32767,32768)
(32767,32768)(65537,1)
(32767,32768)(65537,1)(65538,2)(65539,3)
(32767,32768)(65537,1)(65538,2)(65539,3)(65540,4)(65541,5)(65542,6)(65543,7)
(32767,32768)(65537,1)(65538,2)(65539,3)(65540,4)(65541,5)(65542,6)(65543,7)(65544,8)(65545,9)(65546,10)(65547,11)(65548,12)(65549,13)(65550,14)(65551,15)

# things seem to work okay on the Sage side
sage: for i in range(5):SymmetricGroup(2**16+2**i)(t)
(32767,32768)
(32767,32768)
(32767,32768)
(32767,32768)
(32767,32768)
# Or if one starts with libgap.eval
sage: for i in range(5): SymmetricGroup(2**16+2**i)(libgap.eval(str(t)))._libgap_()
(32767,32768)
(32767,32768)
(32767,32768)
(32767,32768)
(32767,32768)

You can find the input for the next one example here: https://gist.github.com/edgarcosta/b79829984882a1130b4c393d2c76acca

which shows a more complicated instance of the bug:

sage: with open("gen.txt") as F: t = list(map(int, F.read().strip('[]').split(",")))
....: g = SymmetricGroup(133056)(t)
....: str(g)[:100]
'(1,57540,25120,1448,104704,13859,56037,108143,58468,62518,100393,105055,34694,44594,112570,94911,226'
sage: g._libgap_()
(1,57540,25120,1448,39168,22052,59100,14610,61565,20424,22325,15039,5029,444,10671,13061,31435,9614,58000,1913,10874,43926,28119,2653,5246,61031,60645,65486,64440,39550,25105,17490,12979,754,12962,24389,27915,2726,52978,9061,23145,4176,58615,10828,57514,48011,65216,11116,55494,5729,39947,38980,44661,15661,57780,27470,20878,37357,3451,60212,49100,39886,5449,34933,1853,2108,7939,13051,33836,1358,53820,44310,38202,57735,15477,37793,4504,24280,2485,45145,34787)(2,57539,25119,1447,39167,22051,59099,14609,61566,20423,22326,15040,5030,443,10672,13062,31436,9613,57999,1914,10873,43925,28120,2654,5245,61032,60646,65485,64439,39549,25106,17489,12980,753,12961,24390,27916,2725,52977,9062,23146,4175,58616,10827,57513,48012,65215,11115,55493,5730,39948,38979,44662,15662,57779,27469,20877,37358,3452,60211,49099,39885,5450,34934,1854,2107,7940,13052,33835,1357,53819,44309,38201,57736,15478,37794,4503,24279,2486,45146,34788)(3,30205,9512,1198,1719,40274,1906,44900,3014,40298,2157,52832,20879,32214,16526,32566,26113,54114,25183,3912,38661)(4,30206,9511,1197,1720,40273,1905,44899,3013,40297,2158,52831,20880,32213,16525,32565,26114,54113,25184,3911,38662)( [...] )

Additional Information

A workaround for the moment is to use the pexpect interface.

Environment

  • OS: OSX/Unix
  • Sage Version: 10.7.beta1

Checklist

  • I have searched the existing issues for a bug report that matches the one I want to file, without success.
  • I have read the documentation and troubleshoot guide
@edgarcosta edgarcosta changed the title Overfllow in libap interface Overfllow in libgap interface Apr 22, 2025
@edgarcosta edgarcosta linked a pull request Apr 22, 2025 that will close this issue
5 tasks
vbraun pushed a commit to vbraun/sage that referenced this issue Apr 30, 2025
sagemathgh-39999: handle permutations in S_n with n > 2^16
    
This resolves sagemath#39998, as the issue is gap having small and large
permutations:
https://github.com/gap-system/gap/blob/f0b438db8fa5786d19975e6040076fd46
b08bd85/src/permutat.h#L18-L26

### 📝 Checklist

<!-- Put an `x` in all the boxes that apply. -->

- [x] The title is concise and informative.
- [x] The description explains in detail what this PR is about.
- [x] I have linked a relevant issue or discussion.
- [x] I have created tests covering the changes.
- [x] I have updated the documentation and checked the documentation
preview.
    
URL: sagemath#39999
Reported by: Edgar Costa
Reviewer(s): Dima Pasechnik, Julian Rüth, Travis Scrimshaw
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant