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

fix too restrictive method installations #4149

Merged
merged 4 commits into from
Sep 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/src/Groups/autgroup.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ automorphism_group(G::GAPGroup)

The following functions are available for automorphisms, some of them similar to the corresponding functions for homomorphisms of groups.
```@docs
is_invariant(f::GAPGroupElem{AutomorphismGroup{T}}, H::T) where T<:GAPGroup
restrict_automorphism(f::GAPGroupElem{AutomorphismGroup{T}}, H::T, A=automorphism_group(H)) where T <: GAPGroup
is_invariant(f::GAPGroupElem{AutomorphismGroup{T}}, H::GAPGroup) where T <: GAPGroup
lgoettgens marked this conversation as resolved.
Show resolved Hide resolved
restrict_automorphism(f::GAPGroupElem{AutomorphismGroup{T}}, H::GAPGroup, A=automorphism_group(H)) where T <: GAPGroup
lgoettgens marked this conversation as resolved.
Show resolved Hide resolved
induced_automorphism(f::GAPGroupHomomorphism, mH::GAPGroupHomomorphism)
hom(x::GAPGroupElem{AutomorphismGroup{T}}) where T <: GAPGroup
```
Expand Down
15 changes: 7 additions & 8 deletions src/Groups/homomorphisms.jl
Original file line number Diff line number Diff line change
Expand Up @@ -231,8 +231,7 @@ end


"""
is_invariant(f::GAPGroupHomomorphism, H::Group)
is_invariant(f::GAPGroupElem{AutomorphismGroup{T}}, H::T)
is_invariant(f::GAPGroupHomomorphism, H::GAPGroup)

Return whether `f(H) == H` holds.
An exception is thrown if `domain(f)` and `codomain(f)` are not equal
Expand Down Expand Up @@ -1298,7 +1297,7 @@ end
Base.:^(x::GAPGroupElem{T},f::GAPGroupElem{AutomorphismGroup{T}}) where T <: GAPGroup = apply_automorphism(f, x, true)
#Base.:^(f::GAPGroupElem{AutomorphismGroup{T}},g::GAPGroupElem{AutomorphismGroup{T}}) where T <: GAPGroup = g^-1*f*g

function (A::AutomorphismGroup{T})(f::GAPGroupHomomorphism{T,T}) where T <: GAPGroup
function (A::AutomorphismGroup{<: GAPGroup})(f::GAPGroupHomomorphism{T,T}) where T <: GAPGroup
@assert domain(f)==A.G && codomain(f)==A.G "f not in A"
@assert is_bijective(f) "f not in A"
return group_element(A, GapObj(f))
Expand Down Expand Up @@ -1351,11 +1350,11 @@ function inner_automorphism_group(A::AutomorphismGroup{T}) where T <: GAPGroup
end

"""
is_invariant(f::GAPGroupElem{AutomorphismGroup{T}}, H::T)
is_invariant(f::GAPGroupElem{AutomorphismGroup{T}}, H::GAPGroup) where T <: GAPGroup

Return whether `f`(`H`) == `H`.
"""
function is_invariant(f::GAPGroupElem{AutomorphismGroup{T}}, H::T) where T<:GAPGroup
function is_invariant(f::GAPGroupElem{AutomorphismGroup{T}}, H::GAPGroup) where T <: GAPGroup
@assert GAPWrap.IsSubset(GapObj(parent(f).G), GapObj(H)) "Not a subgroup of the domain"
return GAPWrap.Image(GapObj(f), GapObj(H)) == GapObj(H)
end
Expand All @@ -1379,18 +1378,18 @@ end
induced_automorphism(f::GAPGroupHomomorphism, mH::GAPGroupElem{AutomorphismGroup{T}}) where T <: GAPGroup = induced_automorphism(f,hom(mH))

"""
restrict_automorphism(f::GAPGroupElem{AutomorphismGroup{T}}, H::T)
restrict_automorphism(f::GAPGroupElem{AutomorphismGroup{T}}, H::GAPGroup) where T <: GAPGroup

Return the restriction of `f` to `H` as an automorphism of `H`.
An exception is thrown if `H` is not invariant under `f`.
"""
function restrict_automorphism(f::GAPGroupElem{AutomorphismGroup{T}}, H::T, A=automorphism_group(H)) where T <: GAPGroup
function restrict_automorphism(f::GAPGroupElem{AutomorphismGroup{T}}, H::GAPGroup, A=automorphism_group(H)) where T <: GAPGroup
@assert is_invariant(f,H) "H is not invariant under f!"
fh = hom(H, H, gens(H), [f(x) for x in gens(H)], check = false)
return A(fh)
end

function restrict_homomorphism(f::GAPGroupElem{AutomorphismGroup{T}}, H::T) where T <: GAPGroup
function restrict_homomorphism(f::GAPGroupElem{AutomorphismGroup{T}}, H::GAPGroup) where T <: GAPGroup
return restrict_homomorphism(hom(f),H)
end

Expand Down
2 changes: 1 addition & 1 deletion src/Groups/libraries/smallgroups.jl
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ Pc group of order 60
```
"""
function small_group(::Type{T}, n::IntegerUnion, m::IntegerUnion) where T
G = _small_group(n, m)
G = small_group(n, m)
lgoettgens marked this conversation as resolved.
Show resolved Hide resolved
return T(G)
end

Expand Down
3 changes: 1 addition & 2 deletions src/Groups/sub.jl
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ julia> H == alternating_group(4)
true
```
"""
function sub(G::GAPGroup, gens::AbstractVector{S}; check::Bool = true) where S <: GAPGroupElem
@assert elem_type(G) == S
function sub(G::GAPGroup, gens::AbstractVector{<: GAPGroupElem}; check::Bool = true)
if check
@req all(x -> parent(x) === G || x in G, gens) "not all elements of gens lie in G"
end
Expand Down
129 changes: 68 additions & 61 deletions test/Groups/homomorphisms.jl
Original file line number Diff line number Diff line change
Expand Up @@ -656,69 +656,76 @@ end
test_kernel(G,H,f)
end

@testset "Automorphism group of Sym(n)" begin
G=symmetric_group(4)
A=automorphism_group(G)

@test A isa AutomorphismGroup
@test A isa AutomorphismGroup{PermGroup}
@test A.G == G
@test is_isomorphic(G,A)
@test order(A) == 24
@test A==inner_automorphism_group(A)[1]

f = rand(A)
g = rand(A)
x = rand(G)
o = order(f)
fh = hom(f)
@test f isa Oscar.GAPGroupElem{typeof(A)}
@test fh isa Oscar.GAPGroupHomomorphism{PermGroup,PermGroup}
@test A(fh)==f
@test f(x)==x^f
@test f^o == one(A)
@test f*f^-1 == one(A)
@test (f*g)(x) == g(f(x))
@test comm(f,g) == f^-1*g^-1*f*g
@test f(G[1])==fh(G[1])
@test f(G[2])==fh(G[2])
alt = alternating_group(4)
N,e = sub(G,[alt[1],alt[2]])
@test e*f==e*fh
@testset "Automorphism group of a perm. group or a (sub) pc group" begin
for T in [PermGroup, PcGroup, SubPcGroup]
G = small_group(T, 24, 12)
A = automorphism_group(G)

@test A isa AutomorphismGroup
@test A isa AutomorphismGroup{T}
@test A.G === G
@test is_isomorphic(G, A)
@test order(A) == 24
@test A == inner_automorphism_group(A)[1]

f = rand(A)
g = rand(A)
x = rand(G)
o = order(f)
fh = hom(f)
@test f isa Oscar.GAPGroupElem{typeof(A)}
@test fh isa Oscar.GAPGroupHomomorphism{T, T}
@test A(fh) == f
@test f(x) == x^f
@test f^o == one(A)
@test f*f^-1 == one(A)
@test (f*g)(x) == g(f(x))
@test comm(f, g) == f^-1*g^-1*f*g
@test f(G[1]) == fh(G[1])
@test f(G[2]) == fh(G[2])
H = derived_subgroup(G)[1]
N, e = sub(G, [H[1], H[2]])
@test e*f == e*fh

C = cyclic_group(2) # type is independent of `T`
oC = one(C)
gC = gen(C, 1)
g = hom(G, C, x -> x in H ? oC : gC)
@test f*g == fh*g
@test kernel(f*g) == kernel(g)
@test induced_automorphism(g, f) == induced_automorphism(g, fh)

@test is_inner_automorphism(f)
g1 = inner_automorphism(G(H[1]))
@test !(g in A)
g1 = A(g1)
@test g1 in A
g2 = A(inner_automorphism(G(H[2])))
AA, phi = sub(A, [g1, g2])
@test is_isomorphic(AA, H)
@test index(A, AA) == 2
@test is_normal_subgroup(AA, A)
@test is_normalized_by(AA, A)
@test phi(AA[1]) == AA[1]
@test phi(AA[2]) == AA[2]
@test order(quo(A, AA)[1]) == 2
@test is_invariant(f, H)

S = sylow_subgroup(G, 3)[1]
x = gen(S, 1)
f = A(hom(G, G, y -> y^x))
fHa = restrict_automorphism(f, H)
fHh = restrict_homomorphism(f, H)
@test parent(fHa) == automorphism_group(H)
@testset for g in gens(H)
@test fHa(g) == H(f(g))
@test fHh(g) == H(f(g))
end

C=cyclic_group(2)
g = hom(G,C,x -> C[1]^((1-sign(x))÷2) )
@test f*g == fh*g
@test kernel(f*g)==kernel(g)

@test is_inner_automorphism(f)
g1 = inner_automorphism(G(alt[1]))
@test !(g in A)
g1 = A(g1)
@test g1 in A
g2 = A(inner_automorphism(G(alt[2])))
AA,phi = sub(A,[g1,g2])
@test is_isomorphic(AA,alt)
@test index(A,AA)==2
@test is_normal_subgroup(AA, A)
@test is_normalized_by(AA, A)
@test phi(AA[1])==AA[1]
@test phi(AA[2])==AA[2]
@test order(quo(A,AA)[1])==2
@test is_invariant(f,alt)

H = alternating_group(4)
x = cperm(G,[1,2,3])
f = A(hom(G,G,y->y^x))
fa = restrict_automorphism(f,H)
@test parent(fa)==automorphism_group(H)
@testset for g in gens(H)
@test fa(g)==H(f(g))
V, _ = pcore(G, 2)
S, g = quo(G, V)
@test induced_automorphism(g, f) == automorphism_group(S)(inner_automorphism(g(x)))
end

S = symmetric_group(3)
g = hom(G,S,[cperm([1,2,3,4]), cperm([1,2])], [cperm([1,3]), cperm([1,2])])
@test induced_automorphism(g,f)==automorphism_group(S)(inner_automorphism(cperm(S,[1,2,3])))
end

@testset "Other automorphisms groups" begin
Expand Down
Loading