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

Added the AutomorphismGroupElem{T} where T structure and some first functionalities. #1

Closed
wants to merge 20 commits into from
Closed
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
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
94 changes: 76 additions & 18 deletions src/Groups/abelian_aut.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
function _isomorphic_gap_group(A::GrpAbFinGen; T=PcGroup)
export
automorphism_group,
isautomorphism


function _isomorphic_gap_group(A::GrpAbFinGen, T = PcGroup)
# find independent generators
if isdiagonal(rels(A))
exponents = diagonal(rels(A))
Expand Down Expand Up @@ -54,10 +59,21 @@ function _gap_to_oscar(a::Oscar.BasicGAPGroupElem, B::GrpAbFinGen)
return B(exp)
end

(f::GAPGroupElem{AutomorphismGroup{GrpAbFinGen}})(x::GrpAbFinGenElem) = apply_automorphism(f, x, true)
Base.:^(x::GrpAbFinGenElem,f::GAPGroupElem{AutomorphismGroup{GrpAbFinGen}}) = apply_automorphism(f, x, true)
"""
automorphism_group(G::GrpAbFinGen) -> AutomorphismGroup{T} where T <: GrpAbFinGen

Return the automorphism group of `G`.
"""
function automorphism_group(G::GrpAbFinGen)
Ggap, to_gap, to_oscar = _isomorphic_gap_group(G)
AutGAP = GAP.Globals.AutomorphismGroup(Ggap.X)
aut = AutomorphismGroup{typeof(G)}(AutGAP, G)
set_attribute!(aut,:to_gap => to_gap)
set_attribute!(aut,:to_oscar => to_oscar)
return aut
end

function apply_automorphism(f::GAPGroupElem{AutomorphismGroup{GrpAbFinGen}}, x::GrpAbFinGenElem, check=true)
function apply_automorphism(f::AutomorphismGroupElem{GrpAbFinGen}, x::GrpAbFinGenElem, check=true)
aut = parent(f)
if check
@assert parent(x) == aut.G "Not in the domain of f!"
Expand All @@ -70,15 +86,9 @@ function apply_automorphism(f::GAPGroupElem{AutomorphismGroup{GrpAbFinGen}}, x::
imgap = typeof(xgap)(domGap, GAP.Globals.Image(f.X,xgap.X))
return to_oscar(imgap)
end

function automorphism_group(G::GrpAbFinGen)
Ggap, to_gap, to_oscar = _isomorphic_gap_group(G)
AutGAP = GAP.Globals.AutomorphismGroup(Ggap.X)
aut = AutomorphismGroup{typeof(G)}(AutGAP, G)
set_attribute!(aut,:to_gap => to_gap)
set_attribute!(aut,:to_oscar => to_oscar)
return aut
end

(f::AutomorphismGroupElem{GrpAbFinGen})(x::GrpAbFinGenElem) = apply_automorphism(f, x, true)
Base.:^(x::GrpAbFinGenElem,f::AutomorphismGroupElem{GrpAbFinGen}) = apply_automorphism(f, x, true)

# the _as_subgroup function needs a redefinition
# to pass on the to_gap and to_oscar attributes to the subgroup
Expand All @@ -95,13 +105,61 @@ function _as_subgroup(aut::AutomorphismGroup{T}, subgrp::GapObj, ::Type{S}) wher
end

"""
hom(f::GAPGroupElem{AutomorphismGroup{T}}) where T
hom(f::AutomorphismGroupElem{T}) where T

Return the element f of type `GrpAbFinGenMap`.
Return the element `f` of type `GrpAbFinGenMap`.
"""
function hom(x::GAPGroupElem{AutomorphismGroup{T}}) where T <: GrpAbFinGen
A = parent(x).G
imgs = [x(a) for a in gens(A)]
function hom(f::AutomorphismGroupElem{T}) where T <: GrpAbFinGen
A = parent(f).G
imgs = [f(a) for a in gens(A)]
return hom(A, A, imgs)
end


function (aut::AutomorphismGroup{T})(f::GrpAbFinGenMap) where T
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose that T should be GrpAbFinGen?

@assert isautomorphism(aut.G,f.map) "Map doesn't define an element of AutomorphismGroup"
to_gap = get_attribute(aut, :to_gap)
to_oscar = get_attribute(aut, :to_oscar)
Agap = domain(to_oscar)
AA = Agap.X
function img_gap(x)
a = to_oscar(group_element(Agap,x))
b = to_gap(f(a))
return b.X
end
gene = GAP.Globals.GeneratorsOfGroup(AA)
img = GAP.julia_to_gap([img_gap(a) for a in gene])
fgap = GAP.Globals.GroupHomomorphismByImagesNC(AA,AA,img)
return AutomorphismGroupElem{T}(fgap,aut)
end


function (aut::AutomorphismGroup{T})(M::fmpz_mat) where T
@assert isautomorphism(aut.G,M) "Matrix doesn't define an element of Automorphism Group"
return aut(hom(aut.G,aut.G,M))
end

"""
matrix(f::AutomorphismGroupElem{T}) where T -> fmpz_mat

Return the underlying matrix of `f` as a module homormorphism.
"""
matrix(f::AutomorphismGroupElem{T}) where T <: GrpAbFinGen = f.map


"""
isautomorphism(G::GrpAbFinGen, M::fmpz_mat) -> Bool

If `M` defines an endomorphism of `G`, return `true` if `M` defines an automorphism of `G`, else `false`.
"""
isautomorphism(G::GrpAbFinGen, M::fmpz_mat) = isbijective(hom(G,G,M))


"""
isinner_automorphism(f::AutomorphismGroupElem{T}) where T -> Bool

If `f` an automorphism of its domain, return `true` if `f` is inner, else `false`.
"""
isinner_automorphism(f::AutomorphismGroupElem{T}) where T = GAP.Globals.IsInnerAutomorphism(f.X)

==(f::AutomorphismGroupElem{T},g::AutomorphismGroupElem{T}) where T = f.X == g.X
26 changes: 26 additions & 0 deletions src/Groups/types.jl
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ import GAP: GapObj, GapInt

export
AutomorphismGroup,
AutomorphismGroupElem,
DirectProductGroup,
DirectProductOfElem,
FPGroup,
Expand Down Expand Up @@ -256,6 +257,31 @@ Group of automorphisms over a group of type `T`. It can be defined via the funct
end
end

mutable struct AutomorphismGroupElem{T} <: GAPGroupElem{AutomorphismGroup{T}}
X::GapObj
parent::AutomorphismGroup{T}
map::fmpz_mat
AbstractAlgebra.@declare_other

function AutomorphismGroupElem{T}(F::GapObj, Aut::AutomorphismGroup{T}) where T
@assert F in Aut.X
z = new{T}(F,Aut,matrix(fmpz[]))
z.map = hom(z).map
return z
end


end

elem_type(Aut::AutomorphismGroup{T}) where T = AutomorphismGroupElem{T}

group_element(Aut::AutomorphismGroup{T}, x::GapObj) where T = AutomorphismGroupElem{T}(x,Aut)

function Base.show(io::IO, AGE::AutomorphismGroupElem{T}) where T
println(io, "Automorphism of ", typeof(AGE.parent.G), " with matrix representation ", AGE.map)
end


################################################################################
#
# Composite Groups
Expand Down