1
0
mirror of https://github.com/kalmarek/Groups.jl.git synced 2024-12-25 18:15:29 +01:00

letters(A::Alphabet) are no more

This commit is contained in:
Marek Kaluba 2022-10-13 23:21:42 +02:00
parent 2e544d623f
commit 30d58445df
No known key found for this signature in database
GPG Key ID: 8BF1A3855328FC15
5 changed files with 12 additions and 16 deletions

View File

@ -64,7 +64,7 @@ function SurfaceGroup(genus::Integer, boundaries::Integer)
F = FreeGroup(alphabet(rws)) F = FreeGroup(alphabet(rws))
rels = [F(lhs)=>F(rhs) for (lhs,rhs) in word_rels] rels = [F(lhs)=>F(rhs) for (lhs,rhs) in word_rels]
return SurfaceGroup(genus, boundaries, KnuthBendix.letters(Al)[2:2:end], rels, rws) return SurfaceGroup(genus, boundaries, [Al[i] for i in 2:2:length(Al)], rels, rws)
end end
rewriting(S::SurfaceGroup) = S.rws rewriting(S::SurfaceGroup) = S.rws

View File

@ -5,7 +5,7 @@ function SpecialAutomorphismGroup(F::FreeGroup; ordering = KnuthBendix.LenLex, k
n = length(alphabet(F)) ÷ 2 n = length(alphabet(F)) ÷ 2
A, rels = gersten_relations(n, commutative=false) A, rels = gersten_relations(n, commutative=false)
S = KnuthBendix.letters(A)[1:2(n^2-n)] S = [A[i] for i in 1:2:length(A)]
maxrules = 1000*n maxrules = 1000*n

View File

@ -144,7 +144,7 @@ end
function Base.getindex(lm::LettersMap, i::Integer) function Base.getindex(lm::LettersMap, i::Integer)
# here i is an index of an alphabet # here i is an index of an alphabet
@boundscheck 1 i length(KnuthBendix.letters(lm.A)) @boundscheck 1 i length(lm.A)
if !haskey(lm.indices_map, i) if !haskey(lm.indices_map, i)
img = if haskey(lm.indices_map, inv(lm.A, i)) img = if haskey(lm.indices_map, inv(lm.A, i))

View File

@ -153,8 +153,7 @@ struct FreeGroup{T,O} <: AbstractFPGroup
function FreeGroup(gens, ordering::KnuthBendix.WordOrdering) function FreeGroup(gens, ordering::KnuthBendix.WordOrdering)
@assert length(gens) == length(unique(gens)) @assert length(gens) == length(unique(gens))
L = KnuthBendix.letters(alphabet(ordering)) @assert all(l -> l in alphabet(ordering), gens)
@assert all(l -> l in L, gens)
return new{eltype(gens),typeof(ordering)}(gens, ordering) return new{eltype(gens),typeof(ordering)}(gens, ordering)
end end
end end
@ -163,12 +162,11 @@ FreeGroup(gens, A::Alphabet) = FreeGroup(gens, KnuthBendix.LenLex(A))
function FreeGroup(A::Alphabet) function FreeGroup(A::Alphabet)
@boundscheck @assert all( @boundscheck @assert all(
KnuthBendix.hasinverse(l, A) for l in KnuthBendix.letters(A) KnuthBendix.hasinverse(l, A) for l in A
) )
ltrs = KnuthBendix.letters(A) gens = Vector{eltype(A)}()
gens = Vector{eltype(ltrs)}() invs = Vector{eltype(A)}()
invs = Vector{eltype(ltrs)}() for l in A
for l in ltrs
l invs && continue l invs && continue
push!(gens, l) push!(gens, l)
push!(invs, inv(A, l)) push!(invs, inv(A, l))

View File

@ -9,10 +9,10 @@
pauts = let p = perm"(1,3,5)(2,4,6)" pauts = let p = perm"(1,3,5)(2,4,6)"
[Groups.PermRightAut(p^i) for i in 0:2] [Groups.PermRightAut(p^i) for i in 0:2]
end end
T = eltype(KnuthBendix.letters(alphabet(autπ₁Σ))) T = eltype(alphabet(autπ₁Σ))
S = eltype(pauts) S = eltype(pauts)
A = Alphabet(Union{T,S}[KnuthBendix.letters(alphabet(autπ₁Σ)); pauts]) A = Alphabet(Union{T,S}[alphabet(autπ₁Σ)...; pauts])
autG = AutomorphismGroup( autG = AutomorphismGroup(
π₁Σ, π₁Σ,
@ -27,9 +27,7 @@
Al = alphabet(autπ₁Σ) Al = alphabet(autπ₁Σ)
S = [gens(autπ₁Σ); inv.(gens(autπ₁Σ))] S = [gens(autπ₁Σ); inv.(gens(autπ₁Σ))]
sautFn = let ltrs = KnuthBendix.letters(Al) sautFn = parent(Al[1].autFn_word)
parent(first(ltrs).autFn_word)
end
τ = Groups.rotation_element(sautFn) τ = Groups.rotation_element(sautFn)