2017-01-19 10:14:37 +01:00
|
|
|
|
module AutGroups
|
|
|
|
|
|
|
|
|
|
using Groups
|
|
|
|
|
using Permutations
|
|
|
|
|
|
2017-01-21 17:19:08 +01:00
|
|
|
|
import Base: inv, ^
|
2017-01-21 17:17:45 +01:00
|
|
|
|
import Groups: IdSymbol, change_pow, GWord, ==, hash, reduce!
|
2017-01-19 10:14:37 +01:00
|
|
|
|
|
2017-01-21 17:19:08 +01:00
|
|
|
|
export AutSymbol, AutWord, GWord
|
2017-01-19 10:14:37 +01:00
|
|
|
|
export rmul_AutSymbol, lmul_AutSymbol, flip_AutSymbol, symmetric_AutSymbol
|
|
|
|
|
|
|
|
|
|
immutable AutSymbol <: GSymbol
|
|
|
|
|
gen::String
|
|
|
|
|
pow::Int
|
|
|
|
|
ex::Expr
|
|
|
|
|
end
|
|
|
|
|
|
2017-01-21 17:17:45 +01:00
|
|
|
|
(==)(s::AutSymbol, t::AutSymbol) = s.gen == t.gen && s.pow == t.pow
|
|
|
|
|
hash(s::AutSymbol, h::UInt) = hash(s.gen, hash(s.pow, hash(:AutSymbol, h)))
|
2017-01-19 10:14:37 +01:00
|
|
|
|
|
2017-01-21 17:20:15 +01:00
|
|
|
|
IdSymbol(::Type{AutSymbol}) = AutSymbol("(id)", 0, :(IdAutomorphism(N)))
|
2017-01-19 10:14:37 +01:00
|
|
|
|
|
2017-01-21 17:21:45 +01:00
|
|
|
|
function change_pow(s::AutSymbol, n::Int)
|
|
|
|
|
|
|
|
|
|
if n == 0
|
|
|
|
|
return one(s)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
symbol = s.ex.args[1]
|
2017-01-19 10:14:37 +01:00
|
|
|
|
if symbol == :ɛ
|
2017-01-21 17:21:45 +01:00
|
|
|
|
return flip_AutSymbol(s.ex.args[2], pow=n)
|
2017-01-19 10:14:37 +01:00
|
|
|
|
elseif symbol == :σ
|
2017-01-21 17:21:45 +01:00
|
|
|
|
return symmetric_AutSymbol(s.ex.args[2], pow=n)
|
|
|
|
|
elseif symbol == :ϱ
|
|
|
|
|
return rmul_AutSymbol(s.ex.args[2], s.ex.args[3], pow=n)
|
|
|
|
|
elseif symbol == :λ
|
|
|
|
|
return lmul_AutSymbol(s.ex.args[2], s.ex.args[3], pow=n)
|
|
|
|
|
elseif symbol == :IdAutomorphism
|
|
|
|
|
return s
|
2017-01-19 10:14:37 +01:00
|
|
|
|
else
|
2017-01-21 17:21:45 +01:00
|
|
|
|
warn("Changing an unknown type of symbol! $s")
|
|
|
|
|
return AutSymbol(s.gen, n, s.ex)
|
2017-01-19 10:14:37 +01:00
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function rmul_AutSymbol(i,j, pow::Int=1)
|
|
|
|
|
gen = string('ϱ',Char(8320+i), Char(8320+j)...)
|
|
|
|
|
return AutSymbol(gen, pow, :(ϱ($i,$j)))
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function lmul_AutSymbol(i,j, pow::Int=1)
|
|
|
|
|
gen = string('λ',Char(8320+i), Char(8320+j)...)
|
|
|
|
|
return AutSymbol(gen, pow, :(λ($i,$j)))
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function flip_AutSymbol(j, pow::Int=1)
|
|
|
|
|
gen = string('ɛ', Char(8320 + j))
|
|
|
|
|
return AutSymbol(gen, pow%2, :(ɛ($j)))
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function symmetric_AutSymbol(perm::Vector{Int}, pow::Int=1)
|
|
|
|
|
perm = Permutation(perm)
|
|
|
|
|
ord = order(perm)
|
|
|
|
|
pow = pow % ord
|
|
|
|
|
perm = perm^pow
|
|
|
|
|
gen = string('σ', [Char(8320 + i) for i in array(perm)]...)
|
|
|
|
|
return AutSymbol(gen, 1, :(σ($(array(perm)))))
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
typealias AutWord GWord{AutSymbol}
|
|
|
|
|
|
|
|
|
|
end #end of module AutGroups
|