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

minor improvements #2609

Merged
merged 2 commits into from
Aug 2, 2023
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
9 changes: 9 additions & 0 deletions docs/src/General/other.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,15 @@ This section describes differences between GAP and Oscar.
and one assigns a value to a variable with `:=`.
In Julia, equality is checked with `==`,
and `=` denotes assignment.
Similarly, inequality of objects is checked with `<>` in GAP
and with `!=` in Julia.

- In GAP, the operator `not` is used to negate boolean expressions,
whereas `!` is used in Julia.

- In GAP, object identity is checked with the function `IsIdenticalObj`,
whereas the infix operator `===` (with negation `!==`)
is used in Julia.

- In GAP, `if` statements have the form
```
Expand Down
4 changes: 2 additions & 2 deletions docs/src/Groups/subgroups.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ complement_system
```@docs
is_conjugate(G::GAPGroup, x::GAPGroupElem, y::GAPGroupElem)
is_conjugate(G::GAPGroup, H::GAPGroup, K::GAPGroup)
representative_action(G::GAPGroup, x::GAPGroupElem, y::GAPGroupElem)
representative_action(G::GAPGroup, H::GAPGroup, K::GAPGroup)
is_conjugate_with_data(G::GAPGroup, x::GAPGroupElem, y::GAPGroupElem)
is_conjugate_with_data(G::GAPGroup, H::GAPGroup, K::GAPGroup)
centralizer(G::GAPGroup, x::GAPGroupElem)
centralizer(G::T, H::T) where T <: GAPGroup
normalizer(G::GAPGroup, x::GAPGroupElem)
Expand Down
2 changes: 1 addition & 1 deletion experimental/QuadFormAndIsom/src/embeddings.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1131,7 +1131,7 @@ function admissible_equivariant_primitive_extensions(A::ZZLatWithIsom,
# If not, we try the next potential pair.
fSAinOSB = OSB(compose(inv(phi), compose(hom(fSA), phi)))
@hassert :ZZLatWithIsom 1 fSAinOSB in OSBrB # Same as before, since phi is admissible, then the image of fSA should preserve rho_{l+1}(B)
bool, g0 = representative_action(OSBrB, OSBrB(fSAinOSB), fSB)
bool, g0 = is_conjugate_with_data(OSBrB, OSBrB(fSAinOSB), fSB)
bool || continue

# The new phi is "sending" the restriction of fA to this of fB
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ function _local_determinants_morphism(Lf::ZZLatWithIsom)
OqL2 = orthogonal_group(qL2)
ok, phi12 = is_isometric_with_isometry(qL, qL2)
@hassert :ZZLatWithIsom 1 ok
ok, g0 = representative_action(OqL, fqL, OqL(compose(phi12, compose(hom(fqL2), inv(phi12)))))
ok, g0 = is_conjugate_with_data(OqL, fqL, OqL(compose(phi12, compose(hom(fqL2), inv(phi12)))))
@hassert :ZZLatWithIsom 1 ok
phi12 = compose(hom(OqL(g0)), phi12)
@hassert :ZZLatWithIsom 1 is_isometry(phi12)
Expand Down
18 changes: 9 additions & 9 deletions src/Groups/GAPGroups.jl
Original file line number Diff line number Diff line change
Expand Up @@ -575,21 +575,21 @@ i.e., there is an element $z$ in `G` such that `x^`$z$ equals `y`.
"""
function is_conjugate(G::GAPGroup, x::GAPGroupElem, y::GAPGroupElem)
if isdefined(G,:descr) && (G.descr == :GL || G.descr == :SL)
return representative_action_in_gl_or_sl(G, x, y)[1]
return is_conjugate_with_data_in_gl_or_sl(G, x, y)[1]
end
return GAPWrap.IsConjugate(G.X, x.X, y.X)
end

"""
representative_action(G::Group, x::GAPGroupElem, y::GAPGroupElem)
is_conjugate_with_data(G::Group, x::GAPGroupElem, y::GAPGroupElem)

If `x` and `y` are conjugate in `G`,
return `(true, z)`, where `x^z == y` holds;
otherwise, return `(false, nothing)`.
"""
function representative_action(G::GAPGroup, x::GAPGroupElem, y::GAPGroupElem)
function is_conjugate_with_data(G::GAPGroup, x::GAPGroupElem, y::GAPGroupElem)
if isdefined(G,:descr) && (G.descr == :GL || G.descr == :SL)
return representative_action_in_gl_or_sl(G, x, y)
return is_conjugate_with_data_in_gl_or_sl(G, x, y)
end
conj = GAP.Globals.RepresentativeAction(G.X, x.X, y.X)::GapObj
if conj != GAP.Globals.fail
Expand Down Expand Up @@ -795,7 +795,7 @@ false
is_conjugate(G::GAPGroup, H::GAPGroup, K::GAPGroup) = GAPWrap.IsConjugate(G.X,H.X,K.X)

"""
representative_action(G::Group, H::Group, K::Group)
is_conjugate_with_data(G::Group, H::Group, K::Group)

If `H` and `K` are conjugate subgroups in `G`, return `true, z`
where `H^z = K`; otherwise, return `false, nothing`.
Expand All @@ -810,18 +810,18 @@ Group([ (1,2) ])
julia> K = sub(G, [G([1, 2, 4, 3])])[1]
Group([ (3,4) ])

julia> representative_action(G, H, K)
julia> is_conjugate_with_data(G, H, K)
(true, (1,3)(2,4))

julia> K = sub(G, [G([2, 1, 4, 3])])[1]
Group([ (1,2)(3,4) ])

julia> representative_action(G, H, K)
julia> is_conjugate_with_data(G, H, K)
(false, nothing)

```
"""
function representative_action(G::GAPGroup, H::GAPGroup, K::GAPGroup)
function is_conjugate_with_data(G::GAPGroup, H::GAPGroup, K::GAPGroup)
conj = GAP.Globals.RepresentativeAction(G.X, H.X, K.X)::GapObj
if conj != GAP.Globals.fail
return true, group_element(G, conj)
Expand Down Expand Up @@ -912,7 +912,7 @@ function short_right_transversal(G::PermGroup, H::PermGroup, s::PermGroupElem)

R = PermGroupElem[]
for c in can
success, d = representative_action(G, c, s)
success, d = is_conjugate_with_data(G, c, s)
if success
push!(R, d)
@assert c^R[end] == s
Expand Down
5 changes: 2 additions & 3 deletions src/Groups/GrpAb.jl
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,10 @@ conjugacy_classes(G::GrpAbFinGen) = [GrpAbFinGenConjClass(G, x) for x in G]

is_conjugate(G::GrpAbFinGen, x::GrpAbFinGenElem, y::GrpAbFinGenElem) = (x == y)

function representative_action(G::GrpAbFinGen, x::GrpAbFinGenElem, y::GrpAbFinGenElem)
function is_conjugate_with_data(G::GrpAbFinGen, x::GrpAbFinGenElem, y::GrpAbFinGenElem)
x == y ? (true, zero(G)) : (false, nothing)
end


################################################################################
#
# Conjugacy classes of subgroups
Expand Down Expand Up @@ -172,7 +171,7 @@ function is_conjugate(G::GrpAbFinGen, H::GrpAbFinGen, K::GrpAbFinGen)
is_subgroup(H, K)[1] && is_subgroup(K, H)[1]
end

function representative_action(G::GrpAbFinGen, H::GrpAbFinGen, K::GrpAbFinGen)
function is_conjugate_with_data(G::GrpAbFinGen, H::GrpAbFinGen, K::GrpAbFinGen)
if is_subgroup(H, K)[1] && is_subgroup(K, H)[1]
return true, zero(G)
else
Expand Down
11 changes: 8 additions & 3 deletions src/Groups/group_characters.jl
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ julia> tbl = character_table("A5");
julia> characteristic(tbl)
0

julia> characteristic(mod(tbl, 2))
julia> characteristic(tbl % 2)
2
```
"""
Expand Down Expand Up @@ -188,7 +188,7 @@ provided that `tbl` is a Brauer character table.
```jldoctest
julia> tbl = character_table("A5");

julia> ordinary_table(mod(tbl, 2)) === tbl
julia> ordinary_table(tbl % 2) === tbl
true
```
"""
Expand Down Expand Up @@ -1091,15 +1091,18 @@ Base.iterate(tbl::GAPGroupCharacterTable, state = 1) = state > nrows(tbl) ? noth

"""
mod(tbl::GAPGroupCharacterTable, p::T) where T <: IntegerUnion
rem(tbl::GAPGroupCharacterTable, p::T) where T <: IntegerUnion

Return the `p`-modular character table of `tbl`,
or `nothing` if this table cannot be computed.

The syntax `tbl % p` is also supported.

An exception is thrown if `tbl` is not an ordinary character table.

# Examples
```jldoctest
julia> show(mod(character_table("A5"), 2))
julia> show(character_table("A5") % 2)
2-modular Brauer table of A5
```
"""
Expand All @@ -1125,6 +1128,8 @@ function Base.mod(tbl::GAPGroupCharacterTable, p::T) where T <: IntegerUnion
return modtbls[p]
end

rem(tbl::GAPGroupCharacterTable, p::T) where T <: IntegerUnion = mod(tbl, p)

"""
decomposition_matrix(modtbl::GAPGroupCharacterTable)

Expand Down
9 changes: 4 additions & 5 deletions src/Groups/gsets.jl
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,7 @@ is_conjugate(Omega::GSet, omega1, omega2) = omega2 in orbit(Omega, omega1)


"""
representative_action(Omega::GSet, omega1, omega2)
is_conjugate_with_data(Omega::GSet, omega1, omega2)

Determine whether `omega1`, `omega2` are in the same orbit of `Omega`.
If yes, return `true, g` where `g` is an element in the group `G` of
Expand All @@ -560,15 +560,15 @@ Group([ (1,2), (3,4), (1,3)(2,4), (5,6) ])

julia> Omega = gset(G);

julia> representative_action(Omega, 1, 2)
julia> is_conjugate_with_data(Omega, 1, 2)
(true, (1,2))

julia> representative_action(Omega, 1, 5)
julia> is_conjugate_with_data(Omega, 1, 5)
(false, ())

```
"""
function representative_action(Omega::GSet, omega1, omega2)
function is_conjugate_with_data(Omega::GSet, omega1, omega2)
# We do not call GAP's 'RepresentativeAction' with points, generators,
# and actors.
# The method in question would create a new 'ExternalSet' object
Expand All @@ -590,7 +590,6 @@ function representative_action(Omega::GSet, omega1, omega2)
return true, pre[2]
end


############################################################################

Base.length(Omega::GSet) = length(elements(Omega))
Expand Down
17 changes: 8 additions & 9 deletions src/Groups/matrices/MatGrp.jl
Original file line number Diff line number Diff line change
Expand Up @@ -118,14 +118,12 @@ function Base.show(io::IO, x::MatrixGroup)
if isdefined(x, :descr)
if x.descr==:GU || x.descr==:SU
print(io, string(x.descr), "(",x.deg,",",characteristic(x.ring)^(div(degree(x.ring),2)),")")
elseif x.ring isa Field && is_finite(x.ring)
print(io, string(x.descr), "(",x.deg,",",order(x.ring),")")
else
if x.ring isa Field
print(io, string(x.descr), "(",x.deg,",",order(x.ring),")")
else
print(io, string(x.descr), "(",x.deg,",")
print(IOContext(io, :supercompact => true), x.ring)
print(io ,")")
end
print(io, string(x.descr), "(",x.deg,",")
print(IOContext(io, :supercompact => true), x.ring)
print(io ,")")
end
else
print(io, "Matrix group of degree ", x.deg, " over ")
Expand Down Expand Up @@ -529,8 +527,9 @@ end
########################################################################

function _field_from_q(q::Int)
(n,p) = is_power(q)
@req is_prime(p) "The field size must be a prime power"
flag, n, p = is_prime_power_with_data(q)
@req flag "The field size must be a prime power"

return GF(p, n)
end

Expand Down
2 changes: 1 addition & 1 deletion src/Groups/matrices/linear_isconjugate.jl
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ function generalized_jordan_form(A::MatElem{T}; with_pol::Bool=false) where T
end


function representative_action_in_gl_or_sl(G::MatrixGroup, x::MatrixGroupElem, y::MatrixGroupElem)
function is_conjugate_with_data_in_gl_or_sl(G::MatrixGroup, x::MatrixGroupElem, y::MatrixGroupElem)
(isdefined(G,:descr) && (G.descr == :GL || G.descr == :SL)) ||
throw(ArgumentError("Group must be general or special linear group"))

Expand Down
2 changes: 2 additions & 0 deletions src/aliases.jl
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@
@alias isunipotent is_unipotent
@alias isunital is_unital
@alias iswelldefined is_welldefined
@alias representative_action is_conjugate_with_data
@alias representative_action_in_gl_or_sl is_conjugate_with_data_in_gl_or_sl

# Allow backwards compatibility after removal of Oscar.Graphs module.
const Graphs = Oscar
Expand Down
2 changes: 1 addition & 1 deletion src/exports.jl
Original file line number Diff line number Diff line change
Expand Up @@ -707,6 +707,7 @@ export is_complete
export is_congruent
export is_conjugate
export is_conjugate_subgroup
export is_conjugate_with_data
export is_connected
export is_cyclic, has_is_cyclic, set_is_cyclic
export is_degenerate
Expand Down Expand Up @@ -1170,7 +1171,6 @@ export rem_vertex!
export renest
export repres
export representative
export representative_action
export represents_element
export restrict
export restrict_automorphism
Expand Down
4 changes: 2 additions & 2 deletions test/Groups/GrpAb.jl
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ end
@test acting_group(cc[1]) == G1
for x in gens(G1), y in gens(G1)
@test is_conjugate(G1, x, y) == (x == y)
@test representative_action(G1, x, y)[1] == (x == y)
@test is_conjugate_with_data(G1, x, y)[1] == (x == y)
end
C = cc[1]
for H in C
Expand All @@ -95,7 +95,7 @@ end
H = representative(C1)
K = representative(C2)
@test is_conjugate(G1, H, K) == (H == K)
@test representative_action(G1, H, K)[1] == (H == K)
@test is_conjugate_with_data(G1, H, K)[1] == (H == K)
@test is_conjugate_subgroup(G1, H, K) == is_subgroup(K, H)[1]
end
C = CC[1]
Expand Down
28 changes: 14 additions & 14 deletions test/Groups/conjugation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@
y = rand(cc)
@test order(y) == order(x)
@test is_conjugate(G,x,x^y)
@test representative_action(G,x,x^y)[1]
z = representative_action(G,x,x^y)[2]
@test is_conjugate_with_data(G,x,x^y)[1]
z = is_conjugate_with_data(G,x,x^y)[2]
@test x^z == x^y
z = cperm(G,[1,2])
@test !is_conjugate(G,x,z)
@test !representative_action(G,x,z)[1]
@test !is_conjugate_with_data(G,x,z)[1]


@inferred ZZRingElem number_conjugacy_classes(symmetric_group(4))
Expand Down Expand Up @@ -62,12 +62,12 @@
x = rand(c)
y = rand(c)
@test is_conjugate(G,x,y)
@test representative_action(G,x,y)[1]
z = representative_action(G,x,y)[2]
@test is_conjugate_with_data(G,x,y)[1]
z = is_conjugate_with_data(G,x,y)[2]
@test x^z == y
y = rand(C[(i%5)+1])
@test !is_conjugate(G,x,y)
@test !representative_action(G,x,y)[1]
@test !is_conjugate_with_data(G,x,y)[1]
end

CC = @inferred conjugacy_classes_subgroups(G)
Expand All @@ -86,12 +86,12 @@
x = rand(c)
y = rand(c)
@test is_conjugate(G,x,y)
@test representative_action(G,x,y)[1]
z = representative_action(G,x,y)[2]
@test is_conjugate_with_data(G,x,y)[1]
z = is_conjugate_with_data(G,x,y)[2]
@test x^z == y
y = rand(CC[(i % length(CC))+1])
@test !is_conjugate(G,x,y)
@test !representative_action(G,x,y)[1]
@test !is_conjugate_with_data(G,x,y)[1]
end

CC = @inferred conjugacy_classes_maximal_subgroups(G)
Expand Down Expand Up @@ -155,10 +155,10 @@ end
@test order(M) == 4
@test is_conjugate(G, M, inv(M))
@test ! is_conjugate(G, M, M^2)
flag, N = representative_action(G, M, inv(M))
flag, N = is_conjugate_with_data(G, M, inv(M))
@test flag
@test M^N == inv(M)
flag, _ = representative_action(G, M, M^2)
flag, _ = is_conjugate_with_data(G, M, M^2)
@test ! flag
end

Expand All @@ -172,14 +172,14 @@ end
y = generalized_jordan_block(t-1,8)
x[7,8]=l
x=S(x); y=S(y);
vero, z = representative_action(G, x, y)
vero, z = is_conjugate_with_data(G, x, y)
@test vero
@test z in G
@test x^z==y
vero, z = representative_action(S, x, y)
vero, z = is_conjugate_with_data(S, x, y)
@test !vero
x.elm[7,8]=l^8
vero, z = representative_action(S, x, y)
vero, z = is_conjugate_with_data(S, x, y)
@test z in S
@test x^z==y

Expand Down
9 changes: 7 additions & 2 deletions test/Groups/describe.jl
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,13 @@ end
end

@testset "describe() for projective groups" begin
# TODO: PGL / projective_general_linear_group constructor is missing
# TODO: PSL / projective_general_linear_group constructor is missing
@test describe(projective_general_linear_group(2, 2)) == "S3"
@test describe(projective_general_linear_group(2, 7)) == "PSL(3,2) : C2"
@test describe(projective_general_linear_group(3, 2)) == "PSL(3,2)"

@test describe(projective_special_linear_group(2, 2)) == "S3"
@test describe(projective_special_linear_group(2, 7)) == "PSL(3,2)"
@test describe(projective_special_linear_group(3, 2)) == "PSL(3,2)"
end

@testset "describe() for free groups" begin
Expand Down
Loading