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

in for matrix groups has hiccups #4568

Open
joschmitt opened this issue Feb 10, 2025 · 3 comments · May be fixed by #4640
Open

in for matrix groups has hiccups #4568

joschmitt opened this issue Feb 10, 2025 · 3 comments · May be fixed by #4640
Assignees
Labels
bug Something isn't working topic: groups

Comments

@joschmitt
Copy link
Member

Describe the bug
Testing containment with in gives an error for matrix groups (over number fields) if the order of the group is known.

To Reproduce

julia> K, a = cyclotomic_field(12, "a")
(Cyclotomic field of order 12, a)

julia> K, a = cyclotomic_field(12, "a");

julia> G = matrix_group([K[a^2 0; 0 inv(a^2)], K[0 -1; 1 0]]);

julia> M = K[a^3 0; 0 a^-3];

julia> M in G
false

julia> order(G)
12

julia> M in G
ERROR: Error thrown by GAP: Error, ArgumentError: Element not in the group in
  GAP_jl._apply( julia_obj, args ) at /home/johannes/.julia/packages/GAP/bMh5a/pkg/JuliaInterface/gap/calls.gi:15 called from 
map!.fun( elm ) at /home/johannes/.julia/artifacts/553ff06be6f5ceb880f85c7905595c81d539bbf7/share/gap/lib/mapprep.gi:616 called from
ImagesRepresentative( nice, elm ) at /home/johannes/.julia/artifacts/553ff06be6f5ceb880f85c7905595c81d539bbf7/share/gap/lib/grpnice.gi:240 called from
<function "in by nice monomorphism">( <arguments> )
 called from read-eval loop at *defin*:0

Stacktrace:
 [1] error(s::String)
   @ Base ./error.jl:35
 [2] ThrowObserver(depth::Int32)
   @ GAP ~/.julia/packages/GAP/bMh5a/src/GAP.jl:101
 [3] _call_gap_func
   @ ~/.julia/packages/GAP/bMh5a/src/ccalls.jl:356 [inlined]
 [4] (::GapObj)(a1::GapObj, a2::GapObj)
   @ GAP ~/.julia/packages/GAP/bMh5a/src/ccalls.jl:321
 [5] IN(x::GapObj, y::GapObj)
   @ GAP.Wrappers ~/.julia/packages/GAP/bMh5a/src/wrappers.jl:25
 [6] in
   @ ~/.julia/packages/GAP/bMh5a/src/adapter.jl:364 [inlined]
 [7] lies_in(x::AbstractAlgebra.Generic.MatSpaceElem{…}, G::MatrixGroup{…}, x_gap::Nothing)
   @ Oscar ~/.julia/dev/Oscar/src/Groups/matrices/MatGrp.jl:293
 [8] in(x::AbstractAlgebra.Generic.MatSpaceElem{…}, G::MatrixGroup{…})
   @ Oscar ~/.julia/dev/Oscar/src/Groups/matrices/MatGrp.jl:296
 [9] top-level scope
   @ REPL[8]:1
Some type information was truncated. Use `show(err)` to see complete types.

System (please complete the following information):

julia> Oscar.versioninfo(full=true)
OSCAR version 1.3.0-DEV - #master, 8fc7969f37 -- 2025-02-08 18:29:40 +0000
  combining:
    AbstractAlgebra.jl   v0.44.5
    GAP.jl               v0.13.1
    Hecke.jl             v0.35.9
    Nemo.jl              v0.48.2
    Polymake.jl          v0.11.25
    Singular.jl          v0.24.1
  building on:
    FLINT_jll               v300.100.301+0
    GAP_jll                 v400.1400.3+0
    Singular_jll            v404.1.700+0
    libpolymake_julia_jll   v0.13.1+0
    libsingular_julia_jll   v0.46.1+0
    polymake_jll            v400.1300.2+0
See `]st -m` for a full list of dependencies.

Julia Version 1.11.3
Commit d63adeda50d (2025-01-21 19:42 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: 16 × 12th Gen Intel(R) Core(TM) i5-1250P
  WORD_SIZE: 64
  LLVM: libLLVM-16.0.6 (ORCJIT, alderlake)
Threads: 1 default, 0 interactive, 1 GC (on 16 virtual cores)
Environment:
  JULIA_EDITOR = vim
Official https://julialang.org/ release

Additional context
There is no issue if I revert #4525.

@joschmitt joschmitt added bug Something isn't working topic: groups labels Feb 10, 2025
@fingolfin
Copy link
Member

Thank you for the report!

The \in method used by GAP here looks like this:

InstallMethod( \in,
    "by nice monomorphism",
    IsElmsColls,
    [ IsMultiplicativeElementWithInverse,
      IsGroup and IsHandledByNiceMonomorphism ],
    0,

function( elm, G )
    local   nice,  img;

    if HasGeneratorsOfGroup(G) and elm in GeneratorsOfGroup(G) then
      return true;
    fi;
    nice := NiceMonomorphism( G );
    img  := ImagesRepresentative( nice, elm:actioncanfail:=true );  # <-- error happens here
    return img<>fail and img in NiceObject( G )
       and PreImagesRepresentative( nice, img ) = elm;
end );

I marked the critical line: we invoke the nice monomorphism with an option that is meant to instruct it to return fail if the input is not in the target group, instead of raising an error.

My guess is that the maps introduced in PR #4525 don't respect this:

  img = function(x)
    return Gp(_reduce(matrix(x), OtoFq))
  end
...
    # map from Gap_G to Gap_Gp
    fun = x -> GapObj(img(G(preimage_matrix(risoG, x); check=false)))

I do see check=false in the second map, but it calls img which doesn't do this. If I insert check=false there, it all works, but I suspect this isn't what we want in general.

@fingolfin
Copy link
Member

@ThomasBreuer can you have a look? PR #4525 was by you so I think you know the code best

@ThomasBreuer
Copy link
Member

The analysis is correct.
However, #4640 tries to solve the problem by avoiding the calls that require check=false:
For GAP, the map in question deals with matrices, embedding them into groups and then unpacking these group elements is in fact not needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working topic: groups
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants