From 1d82aeed8d98e603e7de0755bce3af20a405406d Mon Sep 17 00:00:00 2001 From: kalmarek Date: Wed, 8 Aug 2018 00:21:13 +0200 Subject: [PATCH] implement the SymmetricGroup interface for SLn and AutFn --- groups/autfreegroup.jl | 73 ++++++++++------------ groups/speciallinear.jl | 130 +++++++++++++++------------------------- 2 files changed, 80 insertions(+), 123 deletions(-) diff --git a/groups/autfreegroup.jl b/groups/autfreegroup.jl index 666f7c7..c4923b9 100644 --- a/groups/autfreegroup.jl +++ b/groups/autfreegroup.jl @@ -1,27 +1,33 @@ -module SpecialAutomorphisms +struct SpecialAutomorphismGroup <: SymmetricGroup + args::Dict{String,Any} + group::AutGroup -using AbstractAlgebra -using Groups - -import AbstractAlgebra.perm - -############################################################################### -# -# Generating set -# -############################################################################### - -function generatingset(N::Int) - - SAutFN = AutGroup(FreeGroup(N), special=true) - S = gens(SAutFN); - - return SAutFN, unique([S; inv.(S)]) + function SpecialAutomorphismGroup(args::Dict) + N = args["N"] + return new(args, AutGroup(FreeGroup(N), special=true)) + end end -function generatingset(parsed_args) - N = parsed_args["N"] - return generatingset(N) +function name(G::SpecialAutomorphismGroup) + N = G.args["N"] + + if G.args["nosymmetry"] + return "SAutF$(N)" + else + return "oSAutF$(N)" + end +end + +group(G::SpecialAutomorphismGroup) = G.group + +function generatingset(G::SpecialAutomorphismGroup) + S = gens(group(G)); + return unique([S; inv.(S)]) +end + +function autS(G::SpecialAutomorphismGroup) + N = G.args["N"] + return WreathProduct(PermutationGroup(2), PermutationGroup(N)) end ############################################################################### @@ -33,8 +39,10 @@ end function AutFG_emb(A::AutGroup, g::WreathProductElem) isa(A.objectGroup, FreeGroup) || throw("Not an Aut(Fₙ)") parent(g).P.n == length(A.objectGroup.gens) || throw("No natural embedding of $(parent(g)) into $A") - powers = [(elt == parent(elt)() ? 0: 1) for elt in g.n.elts] - elt = reduce(*, [A(Groups.flip_autsymbol(i))^pow for (i,pow) in enumerate(powers)]) + Id = parent(g.n[1])() + powers = ((el == Id ? 0: 1) for el in g.n.elts) + elt = A() + Groups.r_multiply!(elt, [Groups.flip_autsymbol(i, pow=p) for (i,p) in enumerate(powers)], reduced=false) Groups.r_multiply!(elt, [Groups.perm_autsymbol(g.p)]) return elt end @@ -55,23 +63,4 @@ function (p::perm)(a::Groups.Automorphism) return g*a*g^-1 end -autS(N::Int) = WreathProduct(PermutationGroup(2), PermutationGroup(N)) - -function autS(parsed_args) - return autS(parsed_args["N"]) end - -############################################################################### -# -# Misc -# -############################################################################### - -function groupname(parsed_args) - N = parsed_args["N"] - return groupname(N), N -end - -groupname(N::Int) = "SAutF$(N)" - -end # of module SpecialAutomorphisms diff --git a/groups/speciallinear.jl b/groups/speciallinear.jl index 87c3b04..219551f 100644 --- a/groups/speciallinear.jl +++ b/groups/speciallinear.jl @@ -1,15 +1,39 @@ -module SpecialLinear +struct SpecialLinearGroup <: SymmetricGroup + args::Dict{String,Any} + group::AbstractAlgebra.Group -using Nemo -using Groups + function SpecialLinearGroup(args::Dict) + n = args["N"] + p = args["p"] + X = args["X"] -import Nemo.Generic.perm + if p == 0 + G = MatrixSpace(Nemo.ZZ, n, n) + else + G = MatrixSpace(FiniteField(p), n, n) + end + return new(args, G) + end +end -############################################################################### -# -# Generating set -# -############################################################################### +function name(G::SpecialLinearGroup) + N = G.args["N"] + p = G.args["p"] + X = G.args["X"] + + if p == 0 + R = (X ? "Z[x]" : "Z") + else + R = "F$p" + end + if G.args["nosymmetry"] + return "SL($N,$R)" + else + return "oSL($N,$R)" + end +end + +group(G::SpecialLinearGroup) = G.group function E(i::Int, j::Int, M::MatSpace, val=one(M.base_ring)) @assert i≠j @@ -18,48 +42,27 @@ function E(i::Int, j::Int, M::MatSpace, val=one(M.base_ring)) return m end -function SLsize(n,p) - p == 0 && return Inf - result = BigInt(1) - for k in 0:n-1 - result *= p^n - p^k - end - return div(result, p-1) -end - -function generatingset(n::Int, X::Bool=false) +function generatingset(G::SpecialLinearGroup) + n = G.args["N"] + p = G.args["p"] + X = G.args["X"] + SL = group(G) indexing = [(i,j) for i in 1:n for j in 1:n if i≠j] - G = MatrixSpace(ZZ, n, n) - if X - S = [E(i,j,G,v) for (i,j) in indexing for v in [1, 100]] + + p > 0 && X && throw("SL(n, F_p[x]) not implemented") + + if !X + S = [E(idx[1],idx[2],SL) for idx in indexing] else - S = [E(i,j,G,v) for (i,j) in indexing for v in [1]] + r = G.args["radius"] + S = [E(i,j,SL,v) for (i,j) in indexing for v in [1, 100*r]] end - S = vcat(S, [inv(x) for x in S]) - return G, unique(S) + return unique([S; inv.(S)]) end -function generatingset(n::Int, p::Int, X::Bool=false) - (p > 1 && n > 1) || throw("Both n and p should be positive integers!") - info("Size(SL($n,$p)) = $(SLsize(n,p))") - F = ResidueRing(ZZ, p) - G = MatrixSpace(F, n, n) - indexing = [(i,j) for i in 1:n for j in 1:n if i≠j] - S = [E(i, j, G) for (i,j) in indexing] - S = vcat(S, [inv(x) for x in S]) - return G, unique(S) -end - -function generatingset(parsed_args) - N = parsed_args["N"] - p = parsed_args["p"] - X = parsed_args["X"] - - if p == 0 - return generatingset(N, X) - else - return generatingset(N, p, X) - end +function autS(G::SpecialLinearGroup) + N = G.args["N"] + return WreathProduct(PermutationGroup(2), PermutationGroup(N)) end ############################################################################### @@ -86,38 +89,3 @@ function (p::perm)(A::MatElem) R = parent(A) return p*A*inv(p) end - -autS(N::Int) = WreathProduct(PermutationGroup(2), PermutationGroup(N)) - -function autS(parsed_args) - return autS(parsed_args["N"]) -end - -############################################################################### -# -# Misc -# -############################################################################### - -function groupname(parsed_args) - N = parsed_args["N"] - p = parsed_args["p"] - X = parsed_args["X"] - - return groupname(N, p, X), N -end - -function groupname(N::Int, p::Int=0, X::Bool=false) - if p == 0 - if X - name = "SL$(N)Z⟨X⟩" - else - name = "SL$(N)Z" - end - else - name = "SL$(N)_$p" - end - return name -end - -end # of module SpecialLinear