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

Corrected word_problem parsing and added algorithm option #39820

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

EigenVector22
Copy link

@EigenVector22 EigenVector22 commented Mar 29, 2025

This replaces the fragile string parsing in PermutationGroupElement.word_problem with a stable method using GAP's syllable functions (NumberSyllables, GeneratorSyllable, ExponentSyllable). This resolves parsing errors involving parentheses and generator name conflicts (e.g., x10 vs x1).

Introduces an 'algorithm' parameter:

  • 'syllable' (Now default): Returns 1-based generator indices when as_list=True.
  • 'legacy': Old implementation, preserved for testing but deprecated due to known bugs. Returns generator strings when as_list=True.

Updated docstrings and examples accordingly.

Fixes #36419
Also #37042 is taken care of
Related: #28556

📝 Checklist

  • The title is concise and informative.
  • The description explains in detail what this PR is about.
  • I have linked a relevant issue or discussion.
  • I have created tests covering the changes.
  • I have updated the documentation and checked the documentation preview.

⌛ Dependencies

@EigenVector22
Copy link
Author

Hello, @dimpase @fchapoton

Can you please review this, and give feedback about the fix.
Thanks,

@dimpase
Copy link
Member

dimpase commented Mar 29, 2025

@EigenVector22 EigenVector22 force-pushed the fix-word-problem-36419 branch from 45a52de to 63cb1ec Compare March 29, 2025 17:02
@EigenVector22
Copy link
Author

made the necessary changes,

@EigenVector22
Copy link
Author

It looks like some CI checks are failing in unrelated files (linear_code.py, polynomial_element.pyx) with timeouts/cysignal errors, and there's also a Docker image pull error. These seem unrelated to the changes in permgroup_element.pyx, as local tests for that file pass?

@EigenVector22 EigenVector22 force-pushed the fix-word-problem-36419 branch from 63cb1ec to dbd9c9f Compare March 30, 2025 07:44
@EigenVector22
Copy link
Author

made the change

@EigenVector22
Copy link
Author

Why are some tests failing? Have I done any mistake in the implementation?

This replaces the fragile string parsing in PermutationGroupElement.word_problem
with a stable  method using GAP's syllable functions (NumberSyllables,
GeneratorSyllable, ExponentSyllable). This resolves parsing errors
involving parentheses and generator name conflicts (e.g., x10 vs x1).

Introduces an 'algorithm' parameter:
- 'syllable' (Now default): Returns 1-based generator indices when as_list=True.
- 'legacy': Old implementation, preserved for testing but deprecated
  due to known bugs. Returns generator strings when as_list=True.

Updated docstrings and examples accordingly.

Fixes sagemath#36419
Related: sagemath#28556
@EigenVector22 EigenVector22 force-pushed the fix-word-problem-36419 branch from dbd9c9f to 9eb3f7b Compare March 30, 2025 14:01
@EigenVector22 EigenVector22 requested a review from fchapoton March 30, 2025 18:03
@EigenVector22
Copy link
Author

EigenVector22 commented Mar 31, 2025

@fchapoton @dimpase, any further suggestions for revisions?

@dimpase
Copy link
Member

dimpase commented Mar 31, 2025

[sagemath_doc_pdf-none] [spkg-install] [groups   ] docstring of sage.groups.perm_gps.permgroup_element.PermutationGroupElement.word_problem:31: WARNING: Block quote ends without a blank line; unexpected unindent. [docutils]

docs don't build - please fix

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

Successfully merging this pull request may close these issues.

Method word_problem of PermutationGroupElement is severely broken
3 participants