mirror of
https://github.com/kalmarek/PropertyT.jl.git
synced 2024-11-19 07:20:28 +01:00
26 lines
492 B
Julia
26 lines
492 B
Julia
module FreeGroups
|
|
|
|
using Groups
|
|
|
|
import Base: inv, convert
|
|
|
|
export FGSymbol, IDSymbol
|
|
|
|
immutable FGSymbol <: GSymbol
|
|
gen::String
|
|
pow::Int
|
|
end
|
|
|
|
IDSymbol(::Type{FGSymbol}) = FGSymbol("(id)", 0)
|
|
FGSymbol(x::String) = FGSymbol(x,1)
|
|
|
|
inv(s::FGSymbol) = FGSymbol(s.gen, -s.pow)
|
|
convert(::Type{FGSymbol}, x::String) = FGSymbol(x)
|
|
change_pow(s::FGSymbol, n::Int) = reduce(FGSymbol(s.gen, n))
|
|
|
|
typealias FGWord GWord{FGSymbol}
|
|
|
|
FGWord(s::FGSymbol) = FGWord([s])
|
|
|
|
end #end of module FreeGroups
|