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

rearrange/extend G-set related code #1300

Merged
merged 2 commits into from
May 5, 2022
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
20 changes: 20 additions & 0 deletions docs/src/Groups/action.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,26 @@ permuted
on_indeterminates
```


## G-Sets

The idea behind G-sets is to have objects that encode the permutation action
induced by a group (that need not be a permutation group) on a given set.
A G-set provides an explicit bijection between the elements of the set and
the corresponding set of positive integers on which the induced permutation
group acts,
see [`action_homomorphism(Omega::GSetByElements{T}) where T<:GAPGroup`](@ref).

```@docs
gset(G::GAPGroup, fun::Function, Omega)
permutation
action_homomorphism(Omega::GSetByElements{T}) where T<:GAPGroup
orbit(Omega::GSetByElements{<:GAPGroup}, omega::T) where T
orbit(G::PermGroup, omega)
orbits(Omega::T) where T <: GSetByElements{TG} where TG <: GAPGroup
```


## Stabilizers

```@docs
Expand Down
2 changes: 1 addition & 1 deletion docs/src/Groups/permgroup.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,6 @@ isregular(G::PermGroup, L::AbstractVector{Int} = 1:degree(G))
issemiregular(G::PermGroup, L::AbstractVector{Int} = 1:degree(G))
blocks(G::PermGroup, L::AbstractVector{Int} = moved_points(G))
maximal_blocks(G::PermGroup, L::AbstractVector{Int} = moved_points(G))
representatives_minimal_blocks(G::PermGroup, L::AbstractVector{Int} = moved_points(G))
minimal_block_reps(G::PermGroup, L::AbstractVector{Int} = moved_points(G))
all_blocks(G::PermGroup)
```
2 changes: 1 addition & 1 deletion docs/src/Groups/subgroups.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ minimal_normal_subgroups
characteristic_subgroups
derived_series
sylow_system
hall_subgroups_representatives
hall_subgroup_reps
hall_system
complement_system
```
Expand Down
14 changes: 7 additions & 7 deletions experimental/GaloisGrp/GaloisGrp.jl
Original file line number Diff line number Diff line change
Expand Up @@ -754,15 +754,15 @@ function set_orbit(G::PermGroup, H::PermGroup)
# http://dblp.uni-trier.de/db/journals/jsc/jsc79.html#Elsenhans17
# https://doi.org/10.1016/j.jsc.2016.02.005

l = low_index_subgroups(H, 2*degree(G)^2)
l = low_index_subgroup_reps(H, 2*degree(G)^2)
S, g = slpoly_ring(ZZ, degree(G), cached = false)

sort!(l, lt = (a,b) -> isless(order(b), order(a)))
for U = l
O = orbits(U)
for o in O
#TODO: should use orbits of Set(o)...
f = sum(g[o])
f = sum(g[collect(o)])
oH = probable_orbit(H, f)
oG = probable_orbit(G, f, limit = length(oH)+5)
if length(oH) < length(oG)
Expand All @@ -774,7 +774,7 @@ function set_orbit(G::PermGroup, H::PermGroup)
return true, I
end
end
f = prod(g[o])
f = prod(g[collect(o)])
oH = probable_orbit(H, f)
I = sum(oH)
if isprobably_invariant(I, H) &&
Expand Down Expand Up @@ -809,8 +809,8 @@ function invariant(G::PermGroup, H::PermGroup)

if !istransitive(G)
@vprint :GaloisInvariant 2 "both groups are intransitive\n"
OG = [sort(x) for x = orbits(G)]
OH = [sort(x) for x = orbits(H)]
OG = [sort(collect(x)) for x = orbits(G)]
OH = [sort(collect(x)) for x = orbits(H)]
d = setdiff(OH, OG)
if length(d) > 0
@vprint :GaloisInvariant 2 "groups have different orbits\n"
Expand All @@ -825,7 +825,7 @@ function invariant(G::PermGroup, H::PermGroup)
@vprint :GaloisInvariant 2 "differ on action on $o, recursing\n"
@hassert :GaloisInvariant 0 ismaximal(hG, hH)
I = invariant(hG, hH)
return evaluate(I, g[o])
return evaluate(I, g[collect(o)])
end
end
@vprint :GaloisInvariant 2 "going transitive...\n"
Expand All @@ -840,7 +840,7 @@ function invariant(G::PermGroup, H::PermGroup)
I = invariant(GG, HH)
ex = 1
while true
J = evaluate(I, [sum(g[o])^ex for o = elements(os)])
J = evaluate(I, [sum(g[o])^ex for o = collect(os)])
if !isprobably_invariant(J, G)
I = J
break
Expand Down
158 changes: 6 additions & 152 deletions experimental/GaloisGrp/Group.jl
Original file line number Diff line number Diff line change
@@ -1,59 +1,3 @@
"""
Tests if `U` is a maximal subgroup of `G`. Suboptimal algorithm...
Missing in GAP
"""
function ismaximal(G::Oscar.PermGroup, U::Oscar.PermGroup)
if !issubgroup(G, U)[1]
return false
end
if order(G)//order(U) < 100
t = right_transversal(G, U)[2:end] #drop the identity
if any(x->order(sub(G, vcat(gens(U), [x]))[1]) < order(G), t)
return false
end
return true
end
S = maximal_subgroup_reps(G)
error("not done yet")
if any(x->x == U, S)
return true
end
return false
end

"""
Tests if a conjugate of `V` by some element in `G` is a subgroup of `U`.
Missing from GAP
"""
function isconjugate_subgroup(G::Oscar.PermGroup, U::Oscar.PermGroup, V::Oscar.PermGroup)
if order(V) == 1
return true, one(U)
end
local sigma
while true
sigma = rand(V)
if order(sigma) > 1
break
end
end
s = short_right_transversal(G, U, sigma)
for t = s
if issubgroup(U, V^inv(t))[1]
return true, inv(t)
end
end
return false, one(U)
end

export maximal_subgroup_reps
function maximal_subgroup_reps(G::Oscar.GAPGroup)
return Oscar._as_subgroups(G, GAP.Globals.MaximalSubgroupClassReps(G.X))
end

function low_index_subgroups(G::PermGroup, n::Int)
ll = GAP.Globals.LowIndexSubgroups(G.X, n)
return [Oscar._as_subgroup(G, x)[1] for x = ll]
end

"""
An ascending chain of minimal supergroups linking `U` and `G`.
Expand All @@ -74,108 +18,18 @@ function maximal_subgroup_chain(G::PermGroup, U::PermGroup)
return [Oscar._as_subgroup(G, x)[1] for x = ll]
end

# TODO: add a GSet Julia type which does something similar Magma's,
# or also to GAP's ExternalSet (but don't use ExternalSet, to avoid the overhead)

# TODO: add type BlockSystem

# TODO: add lots of more orbit related stuff

#provided by Thomas Breuer:

Hecke.orbit(G::PermGroup, i::Int) = Vector{Int}(GAP.Globals.Orbit(G.X, GAP.Obj(i)))
orbits(G::PermGroup) = Vector{Vector{Int}}(GAP.Globals.Orbits(G.X, GAP.GapObj(1:degree(G))))

function action_homomorphism(G::PermGroup, omega::AbstractVector{Int})
mp = GAP.Globals.ActionHomomorphism(G.X, GAP.GapObj(omega))
if mp == GAP.Globals.fail throw(ArgumentError("Invalid input")) end
H = PermGroup(GAP.Globals.Range(mp))
return GAPGroupHomomorphism(G, H, mp)
end

function block_system(G::PermGroup, B::Vector{Int})
orb = GAP.Globals.Orbit(G.X, GAP.GapObj(B), GAP.Globals.OnSets)
return Vector{Vector{Int}}(orb)
return collect(orbit(G, on_sets, B))
end

# given a perm group G and a block B, compute a homomorphism into Sym(B^G)
function action_on_blocks(G::PermGroup, B::Vector{Int})
orb = GAP.Globals.Orbit(G.X, GAP.GapObj(B), GAP.Globals.OnSets)
act = GAP.Globals.ActionHomomorphism(G.X, orb, GAP.Globals.OnSets)
H = GAPWrap.Image(act)
T = Oscar._get_type(H)
H = T(H)
return Oscar.GAPGroupHomomorphism(G, H, act)
Omega = gset(G, [B])
return action_homomorphism(Omega)
end

function action_on_block_system(G::PermGroup, B::Vector{Vector{Int}})
orb = GAP.GapObj(B, recursive = true)
act = GAP.Globals.ActionHomomorphism(G.X, orb, GAP.Globals.OnSets)
H = GAPWrap.Image(act)
T = Oscar._get_type(H)
H = T(H)
return Oscar.GAPGroupHomomorphism(G, H, act)
end


@doc Markdown.doc"""
short_right_transversal(G::PermGroup, H::PermGroup, s::PermGroupElem) ->

Determines representatives `g` for all right-cosets of `G` modulo `H`
such that `H^g` contains the element `s`.
"""
function short_right_transversal(G::PermGroup, H::PermGroup, s::PermGroupElem)
C = conjugacy_classes(H)
cs = cycle_structure(s)
can = PermGroupElem[]
for c in C
r = representative(c)
if cs == cycle_structure(r)
push!(can, r)
end
end

R = PermGroupElem[]
for c in can
success, d = representative_action(G, c, s)
if success
push!(R, d)
@assert c^R[end] == s
end
end

S = PermGroupElem[]
C = centralizer(G, s)[1]
for r in R
CH = centralizer(H^r, s)[1]
for t = right_transversal(C, CH)
push!(S, r*t)
end
end

return S
end

"""
Computes representatives (under conjugation) for all subgroups of
the given group. If geven, only subgroups of a certain order
are returned.
"""
function subgroup_reps(G::PermGroup; order::fmpz = fmpz(-1))
C = GAP.Globals.ConjugacyClassesSubgroups(G.X)
C = map(GAP.Globals.Representative, C)
if order != -1
C = [x for x = C if GAP.Globals.Order(x) == order]
end
return [Oscar._as_subgroup(G, x)[1] for x = C]
end

"""
Computes the action of G on the right cosets
"""
function right_coset_action(G::PermGroup, U::PermGroup)
mp = GAP.Globals.FactorCosetAction(G.X, U.X)
if mp == GAP.Globals.fail throw(ArgumentError("Invalid input")) end
H = PermGroup(GAP.Globals.Range(mp))
return GAPGroupHomomorphism(G, H, mp)
Omega = gset(G, B)
set_attribute!(Omega, :elements => Omega.seeds)
return action_homomorphism(Omega)
end
Loading