Skip to content

GAP Symplectic Group Construction does not see Zmod(N) is finite #36441

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
GiacomoPope opened this issue Oct 10, 2023 · 2 comments · May be fixed by #39858
Open
2 tasks done

GAP Symplectic Group Construction does not see Zmod(N) is finite #36441

GiacomoPope opened this issue Oct 10, 2023 · 2 comments · May be fixed by #39858

Comments

@GiacomoPope
Copy link
Contributor

Steps To Reproduce

GAP does not allow custom invariant forms for finite groups. An implementation error is raised when an invariant form for GF(p) is used:

sage: I = Matrix(Zmod(11),4,4,[0,0,1,0,0,0,0,1,-1,0,0,0,0,-1,0,0])
sage: G = Sp(4, GF(11), invariant_form=I)
---------------------------------------------------------------------------
NotImplementedError                       Traceback (most recent call last)
Cell In [15], line 1
----> 1 G = Sp(Integer(4), GF(Integer(11)), invariant_form=I)

File ~/sage/sage-10.0/src/sage/groups/matrix_gps/symplectic.py:150, in Sp(n, R, var, invariant_form)
    148 if invariant_form is not None:
    149     if isinstance(ring, FiniteField):
--> 150         raise NotImplementedError("invariant_form for finite groups is fixed by GAP")
    152     invariant_form = normalize_args_invariant_form(ring, degree, invariant_form)
    153     if not invariant_form.is_alternating():

NotImplementedError: invariant_form for finite groups is fixed by GAP

If instead someone uses Zmod(11), then this error is avoided but the invariant form is not set:

sage: I = Matrix(Zmod(11),4,4,[0,0,1,0,0,0,0,1,-1,0,0,0,0,-1,0,0])
sage: G = Sp(4, Zmod(11), invariant_form=I)
sage: G.invariant_form()
[ 0  0  0  1]
[ 0  0  1  0]
[ 0 10  0  0]
[10  0  0  0]
sage: G
Symplectic Group of degree 4 over Ring of integers modulo 11 with respect to alternating bilinear form
[ 0  0  1  0]
[ 0  0  0  1]
[10  0  0  0]
[ 0 10  0  0]

Expected Behavior

G = Sp(4, Zmod(11), invariant_form=I)

Should raise an error

Actual Behavior

It silently fails.

    if invariant_form is not None:
        if isinstance(ring, FiniteField):
            raise NotImplementedError("invariant_form for finite groups is fixed by GAP")

My thought is that this check should be ring.is_finite() -- I am happy to change this, but wanted some advice on what's best here.

Additional Information

No response

Environment

- **OS**: Mac OS
- **Sage Version**: 10.0

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
@EigenVector22
Copy link
Contributor

EigenVector22 commented Apr 3, 2025

@mkoeppe hello, should i go ahead and raise the PR and make the proposed changes?
Thanks,

@GiacomoPope
Copy link
Contributor Author

If you have a fix, make a PR and then tag this issue.

EigenVector22 added a commit to EigenVector22/sage that referenced this issue Apr 3, 2025
Fixes sagemath#36441
The check for whether a custom invariant_form could be used with
Sp(n, R) incorrectly used `isinstance(ring, FiniteField)`. Due to this
it failed to detect finite rings like Zmod(p) (p prime), leading to
the invariant_form being silently ignored by GAP instead of raising
the expected NotImplementedError.

Changed the check to `ring.is_finite()`, which fixes the described
limitation.

Added Doctests.
@EigenVector22 EigenVector22 linked a pull request Apr 3, 2025 that will close this issue
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants