struct SpecialLinearGroup{N} <: SymmetrizedGroup group::AbstractAlgebra.Group p::Int X::Bool end function SpecialLinearGroup(args::Dict) N = args["SL"] p = args["p"] X = args["X"] if p == 0 G = MatrixSpace(Nemo.ZZ, N, N) else R = Nemo.NmodRing(UInt(p)) G = MatrixSpace(R, N, N) end return SpecialLinearGroup{N}(G, p, X) end function name(G::SpecialLinearGroup{N}) where N if G.p == 0 R = (G.X ? "Z[x]" : "Z") else R = "F$(G.p)" end return SL($(G.N),$R) end group(G::SpecialLinearGroup) = G.group function generatingset(G::SpecialLinearGroup{N}) where N G.p > 0 && G.X && throw("SL(n, F_p[x]) not implemented") SL = group(G) return generatingset(SL, G.X) end # r is the injectivity radius of # SL(n, Z[X]) -> SL(n, Z) induced by X -> 100 function generatingset(SL::MatSpace, X::Bool=false, r=5) n = SL.cols indexing = [(i,j) for i in 1:n for j in 1:n if i≠j] if !X S = [E(idx[1],idx[2],SL) for idx in indexing] else S = [E(i,j,SL,v) for (i,j) in indexing for v in [1, 100*r]] end return unique([S; inv.(S)]) end function E(i::Int, j::Int, M::MatSpace, val=one(M.base_ring)) @assert i≠j m = one(M) m[i,j] = val return m end function autS(G::SpecialLinearGroup{N}) where N return WreathProduct(PermutationGroup(2), PermutationGroup(N)) end