125 lines
3.0 KiB
Julia
125 lines
3.0 KiB
Julia
module SLNs
|
|
|
|
using Nemo
|
|
using Groups
|
|
|
|
if VERSION >= v"0.6.0"
|
|
import Nemo.Generic.perm
|
|
end
|
|
|
|
###############################################################################
|
|
#
|
|
# Generating set
|
|
#
|
|
###############################################################################
|
|
|
|
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 SLsize(n,p)
|
|
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)
|
|
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]]
|
|
else
|
|
S = [E(i,j,G,v) for (i,j) in indexing for v in [1]]
|
|
end
|
|
S = vcat(S, [inv(x) for x in S])
|
|
return G, unique(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
|
|
end
|
|
|
|
###############################################################################
|
|
#
|
|
# Action of WreathProductElems on Nemo.MatElem
|
|
#
|
|
###############################################################################
|
|
|
|
function matrix_emb(MM::MatSpace, g::WreathProductElem)
|
|
parent(g).P.n == MM.cols == MM.rows || throw("No natural embedding of $(parent(g)) in ")
|
|
powers = [(elt == parent(elt)() ? 0: 1) for elt in g.n.elts]
|
|
elt = diagm([(-1)^(elt == parent(elt)() ? 0: 1) for elt in g.n.elts])
|
|
return MM(elt)*MM(Nemo.matrix_repr(g.p)')
|
|
end
|
|
|
|
function (g::WreathProductElem)(A::MatElem)
|
|
G = matrix_emb(parent(A), g)
|
|
inv_G = matrix_emb(parent(A), inv(g))
|
|
return G*A*inv_G
|
|
end
|
|
|
|
function (p::perm)(A::MatElem)
|
|
length(p.d) == A.r == A.c || throw("Can't act via $p on matrix of size ($(A.r), $(A.c))")
|
|
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, p=0, X=false)
|
|
if p == 0
|
|
if X
|
|
name = "oSL$(N)Z⟨X⟩"
|
|
else
|
|
name = "oSL$(N)Z"
|
|
end
|
|
else
|
|
name = "oSL$(N)_$p"
|
|
end
|
|
return name
|
|
end
|
|
|
|
end # of module SLNs
|