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

replace inv(A::Alphabet, ...) → inv(..., A)

This commit is contained in:
Marek Kaluba 2022-10-13 23:27:50 +02:00
parent 30d58445df
commit 42d4c41d90
No known key found for this signature in database
GPG Key ID: 8BF1A3855328FC15
6 changed files with 51 additions and 51 deletions

View File

@ -96,7 +96,7 @@ function gersten_relations(::Type{W}, n::Integer; commutative) where {W<:Abstrac
if i j if i j
push!(rels, _hexagonal_rule(W, A, ϱ(i, j), ϱ(j, i), λ(i, j), λ(j, i))) push!(rels, _hexagonal_rule(W, A, ϱ(i, j), ϱ(j, i), λ(i, j), λ(j, i)))
w = W([A[ϱ(i, j)], A[ϱ(j, i)^-1], A[λ(i, j)]]) w = W([A[ϱ(i, j)], A[ϱ(j, i)^-1], A[λ(i, j)]])
push!(rels, w^2 => inv(A, w)^2) push!(rels, w^2 => inv(w, A)^2)
end end
end end
end end

View File

@ -25,7 +25,7 @@ function Te_diagonal(λ::Groups.ΡΛ, ϱ::Groups.ΡΛ, i::Integer)
if i == n if i == n
τ = rotation_element(λ, ϱ) τ = rotation_element(λ, ϱ)
return inv(A, τ) * Te_diagonal(λ, ϱ, 1) * τ return inv(τ, A) * Te_diagonal(λ, ϱ, 1) * τ
end end
@assert 1 <= i < n @assert 1 <= i < n
@ -37,32 +37,32 @@ function Te_diagonal(λ::Groups.ΡΛ, ϱ::Groups.ΡΛ, i::Integer)
g = one(Word(Int[])) g = one(Word(Int[]))
g *= λ[NJ, NI] # β ↦ α g *= λ[NJ, NI] # β ↦ α
g *= λ[NI, I] * inv(A, ϱ[NI, J]) # α ↦ a*α*b^-1 g *= λ[NI, I] * inv(ϱ[NI, J], A) # α ↦ a*α*b^-1
g *= inv(A, λ[NJ, NI]) # β ↦ b*α^-1*a^-1*α g *= inv(λ[NJ, NI], A) # β ↦ b*α^-1*a^-1*α
g *= λ[J, NI] * inv(A, λ[J, I]) # b ↦ α g *= λ[J, NI] * inv(λ[J, I], A) # b ↦ α
g *= inv(A, λ[J, NI]) # b ↦ b*α^-1*a^-1*α g *= inv(λ[J, NI], A) # b ↦ b*α^-1*a^-1*α
g *= inv(A, ϱ[J, NI]) * ϱ[J, I] # b ↦ b*α^-1*a^-1*α*b*α^-1 g *= inv(ϱ[J, NI], A) * ϱ[J, I] # b ↦ b*α^-1*a^-1*α*b*α^-1
g *= ϱ[J, NI] # b ↦ b*α^-1*a^-1*α*b*α^-1*a*α*b^-1 g *= ϱ[J, NI] # b ↦ b*α^-1*a^-1*α*b*α^-1*a*α*b^-1
return g return g
end end
function Te_lantern(A::Alphabet, b₀::T, a₁::T, a₂::T, a₃::T, a₄::T, a₅::T) where {T} function Te_lantern(A::Alphabet, b₀::T, a₁::T, a₂::T, a₃::T, a₄::T, a₅::T) where {T}
a₀ = (a₁ * a₂ * a₃)^4 * inv(A, b₀) a₀ = (a₁ * a₂ * a₃)^4 * inv(b₀, A)
X = a₄ * a₅ * a₃ * a₄ # from Primer X = a₄ * a₅ * a₃ * a₄ # from Primer
b₁ = inv(A, X) * a₀ * X # from Primer b₁ = inv(X, A) * a₀ * X # from Primer
Y = a₂ * a₃ * a₁ * a₂ Y = a₂ * a₃ * a₁ * a₂
return inv(A, Y) * b₁ * Y # b₂ from Primer return inv(Y, A) * b₁ * Y # b₂ from Primer
end end
function Ta(λ::Groups.ΡΛ, i::Integer) function Ta(λ::Groups.ΡΛ, i::Integer)
@assert λ.id == ; @assert λ.id ==
return λ[mod1(λ.N - 2i + 1, λ.N), mod1(λ.N - 2i + 2, λ.N)] return λ[mod1(λ.N - 2i + 1, λ.N), mod1(λ.N - 2i + 2, λ.N)]
end end
function Tα(λ::Groups.ΡΛ, i::Integer) function Tα(λ::Groups.ΡΛ, i::Integer)
@assert λ.id == ; @assert λ.id ==
return inv(λ.A, λ[mod1(λ.N-2i+2, λ.N), mod1(λ.N-2i+1, λ.N)]) return inv(λ[mod1(λ.N - 2i + 2, λ.N), mod1(λ.N - 2i + 1, λ.N)], λ.A)
end end
function Te(λ::ΡΛ, ϱ::ΡΛ, i, j) function Te(λ::ΡΛ, ϱ::ΡΛ, i, j)
@ -85,16 +85,16 @@ function Te(λ::ΡΛ, ϱ::ΡΛ, i, j)
if mod(j - (i + 1), genus) == 0 if mod(j - (i + 1), genus) == 0
return Te_diagonal(λ, ϱ, i) return Te_diagonal(λ, ϱ, i)
else else
return inv(A, Te_lantern( return inv(Te_lantern(
A, A,
# Our notation: # Primer notation: # Our notation: # Primer notation:
inv(A, Ta(λ, i + 1)), # b₀ inv(Ta(λ, i + 1), A), # b₀
inv(A, Ta(λ, i)), # a₁ inv(Ta(λ, i), A), # a₁
inv(A, Tα(λ, i)), # a₂ inv(Tα(λ, i), A), # a₂
inv(A, Te_diagonal(λ, ϱ, i)), # a₃ inv(Te_diagonal(λ, ϱ, i), A), # a₃
inv(A, Tα(λ, i + 1)), # a₄ inv(Tα(λ, i + 1), A), # a₄
inv(A, Te(λ, ϱ, i + 1, j)), # a₅ inv(Te(λ, ϱ, i + 1, j), A), # a₅
)) ), A)
end end
end end
@ -123,24 +123,24 @@ function rotation_element(λ::ΡΛ, ϱ::ΡΛ)
halftwists = map(1:genus-1) do i halftwists = map(1:genus-1) do i
j = i + 1 j = i + 1
x = Ta(λ, j) * inv(A, Ta(λ, i)) * Tα(λ, j) * Te_diagonal(λ, ϱ, i) x = Ta(λ, j) * inv(Ta(λ, i), A) * Tα(λ, j) * Te_diagonal(λ, ϱ, i)
δ = x * Tα(λ, i) * inv(A, x) δ = x * Tα(λ, i) * inv(x, A)
c = c =
inv(A, Ta(λ, j)) * inv(Ta(λ, j), A) *
Te(λ, ϱ, i, j) * Te(λ, ϱ, i, j) *
Tα(λ, i)^2 * Tα(λ, i)^2 *
inv(A, δ) * inv(δ, A) *
inv(A, Ta(λ, j)) * inv(Ta(λ, j), A) *
Ta(λ, i) * Ta(λ, i) *
δ δ
z = z =
Te_diagonal(λ, ϱ, i) * Te_diagonal(λ, ϱ, i) *
inv(A, Ta(λ, i)) * inv(Ta(λ, i), A) *
Tα(λ, i) * Tα(λ, i) *
Ta(λ, i) * Ta(λ, i) *
inv(A, Te_diagonal(λ, ϱ, i)) inv(Te_diagonal(λ, ϱ, i), A)
Ta(λ, i) * inv(A, Ta(λ, j) * Tα(λ, j))^6 * (Ta(λ, j) * Tα(λ, j) * z)^4 * c Ta(λ, i) * inv(Ta(λ, j) * Tα(λ, j), A)^6 * (Ta(λ, j) * Tα(λ, j) * z)^4 * c
end end
τ = (Ta(λ, 1) * Tα(λ, 1))^6 * prod(halftwists) τ = (Ta(λ, 1) * Tα(λ, 1))^6 * prod(halftwists)
@ -201,24 +201,24 @@ function SymplecticMappingClass(
w = if id === :A w = if id === :A
Te(λ, ϱ, i, j) * Te(λ, ϱ, i, j) *
inv(A, Ta(λ, i)) * inv(Ta(λ, i), A) *
Tα(λ, i) * Tα(λ, i) *
Ta(λ, i) * Ta(λ, i) *
inv(A, Te(λ, ϱ, i, j)) * inv(Te(λ, ϱ, i, j), A) *
inv(A, Tα(λ, i)) * inv(Tα(λ, i), A) *
inv(A, Ta(λ, j)) inv(Ta(λ, j), A)
elseif id === :B elseif id === :B
if !minus if !minus
if i j if i j
x = Ta(λ, j) * inv(A, Ta(λ, i)) * Tα(λ, j) * Te(λ, ϱ, i, j) x = Ta(λ, j) * inv(Ta(λ, i), A) * Tα(λ, j) * Te(λ, ϱ, i, j)
δ = x * Tα(λ, i) * inv(A, x) δ = x * Tα(λ, i) * inv(x, A)
Tα(λ, i) * Tα(λ, j) * inv(A, δ) Tα(λ, i) * Tα(λ, j) * inv(δ, A)
else else
inv(A, Tα(λ, i)) inv(Tα(λ, i), A)
end end
else else
if i j if i j
Ta(λ, i) * Ta(λ, j) * inv(A, Te(λ, ϱ, i, j)) Ta(λ, i) * Ta(λ, j) * inv(Te(λ, ϱ, i, j), A)
else else
Ta(λ, i) Ta(λ, i)
end end

View File

@ -45,9 +45,9 @@ Base.@propagate_inbounds @inline function evaluate!(
if !t.inv if !t.inv
append!(word(v[i]), word(v[j])) append!(word(v[i]), word(v[j]))
else else
# append!(word(v[i]), inv(A, word(v[j]))) # append!(word(v[i]), inv(word(v[j]), A))
for l in Iterators.reverse(word(v[j])) for l in Iterators.reverse(word(v[j]))
push!(word(v[i]), inv(A, l)) push!(word(v[i]), inv(l, A))
end end
end end
else # if t.id === :λ else # if t.id === :λ
@ -57,9 +57,9 @@ Base.@propagate_inbounds @inline function evaluate!(
pushfirst!(word(v[i]), l) pushfirst!(word(v[i]), l)
end end
else else
# prepend!(word(v[i]), inv(A, word(v[j]))) # prepend!(word(v[i]), inv(word(v[j]), A))
for l in word(v[j]) for l in word(v[j])
pushfirst!(word(v[i]), inv(A, l)) pushfirst!(word(v[i]), inv(l, A))
end end
end end
end end

View File

@ -147,8 +147,8 @@ function Base.getindex(lm::LettersMap, i::Integer)
@boundscheck 1 i length(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(i, lm.A))
inv(lm.A, lm.indices_map[inv(lm.A, i)]) inv(lm.indices_map[inv(i, lm.A)], lm.A)
else else
@warn "LetterMap: neither $i nor its inverse has assigned value" @warn "LetterMap: neither $i nor its inverse has assigned value"
one(valtype(lm.indices_map)) one(valtype(lm.indices_map))
@ -193,7 +193,7 @@ function generated_evaluate(a::FPGroupElement{<:AutomorphismGroup})
push!(args[idx].args, :(d[$k])) push!(args[idx].args, :(d[$k]))
continue continue
end end
k = findfirst(==(inv(A, l)), first_ltrs) k = findfirst(==(inv(l, A)), first_ltrs)
if k !== nothing if k !== nothing
push!(args[idx].args, :(inv(d[$k]))) push!(args[idx].args, :(inv(d[$k])))
continue continue

View File

@ -88,7 +88,7 @@ struct Homomorphism{Gr1, Gr2, I, W}
end end
end end
for (lhs, rhs) in relations(source) for (lhs, rhs) in relations(source)
relator = lhs*inv(alphabet(source), rhs) relator = lhs * inv(rhs, alphabet(source))
im_r = hom.target(hom(relator)) im_r = hom.target(hom(relator))
@assert isone(im_r) "Map does not define a homomorphism: h($relator) = $(im_r)$(one(target))." @assert isone(im_r) "Map does not define a homomorphism: h($relator) = $(im_r)$(one(target))."
end end

View File

@ -128,7 +128,7 @@ end
function Base.inv(g::GEl) where {GEl<:AbstractFPGroupElement} function Base.inv(g::GEl) where {GEl<:AbstractFPGroupElement}
G = parent(g) G = parent(g)
return GEl(inv(alphabet(G), word(g)), G) return GEl(inv(word(g), alphabet(G)), G)
end end
function Base.:(*)(g::GEl, h::GEl) where {GEl<:AbstractFPGroupElement} function Base.:(*)(g::GEl, h::GEl) where {GEl<:AbstractFPGroupElement}
@ -169,7 +169,7 @@ function FreeGroup(A::Alphabet)
for l in A for l in A
l invs && continue l invs && continue
push!(gens, l) push!(gens, l)
push!(invs, inv(A, l)) push!(invs, inv(l, A))
end end
return FreeGroup(gens, A) return FreeGroup(gens, A)