1
0
mirror of https://github.com/kalmarek/PropertyT.jl.git synced 2024-11-23 08:15:29 +01:00

full change_pow function for AutSymbol

This commit is contained in:
kalmar 2017-01-21 17:21:45 +01:00
parent b19d8b7185
commit cb5b70c74d

View File

@ -19,22 +19,27 @@ end
hash(s::AutSymbol, h::UInt) = hash(s.gen, hash(s.pow, hash(:AutSymbol, h))) hash(s::AutSymbol, h::UInt) = hash(s.gen, hash(s.pow, hash(:AutSymbol, h)))
IdSymbol(::Type{AutSymbol}) = AutSymbol("(id)", 0, :(IdAutomorphism(N))) IdSymbol(::Type{AutSymbol}) = AutSymbol("(id)", 0, :(IdAutomorphism(N)))
change_pow(s::AutSymbol, n::Int) = reduce(AutSymbol(s.gen, n, s.ex))
function inv(f::AutSymbol) function change_pow(s::AutSymbol, n::Int)
symbol = f.ex.args[1]
if n == 0
return one(s)
end
symbol = s.ex.args[1]
if symbol == if symbol ==
return change_pow(f, f.pow % 2) return flip_AutSymbol(s.ex.args[2], pow=n)
elseif symbol == :σ elseif symbol == :σ
perm = invperm(f.ex.args[2]) return symmetric_AutSymbol(s.ex.args[2], pow=n)
gen = string('σ', [Char(8320 + i) for i in perm]...) elseif symbol == :ϱ
return AutSymbol(gen, f.pow, :(σ($perm))) return rmul_AutSymbol(s.ex.args[2], s.ex.args[3], pow=n)
elseif symbol == :(ϱ) || symbol == elseif symbol ==
return AutSymbol(f.gen, -f.pow, f.ex) return lmul_AutSymbol(s.ex.args[2], s.ex.args[3], pow=n)
elseif symbol == :IDAutomorphism elseif symbol == :IdAutomorphism
return f return s
else else
throw(ArgumentError("Don't know how to invert $f (of type $symbol)")) warn("Changing an unknown type of symbol! $s")
return AutSymbol(s.gen, n, s.ex)
end end
end end